Skip to content

Commit ea58420

Browse files
authored
zNPCTypeBossSandy.cpp / zNPCTypeBossSandy.h (#662)
1 parent 41bc74f commit ea58420

File tree

2 files changed

+210
-8
lines changed

2 files changed

+210
-8
lines changed

src/SB/Game/zNPCTypeBossSandy.cpp

Lines changed: 208 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "xCamera.h"
88
#include "xMath3.h"
99
#include "xDebug.h"
10+
#include "xJaw.h"
1011

1112
#include "zEnt.h"
1213
#include "zFX.h"
@@ -315,14 +316,81 @@ void zNPCBSandy::Init(xEntAsset* asset)
315316
zNPCCommon::Init(asset);
316317
sSandyPtr = this;
317318

318-
round = 1;
319-
firstTimeR1Csn = 1;
320-
boundFlags = (U32*)xMemAlloc(gActiveHeap, 13 * sizeof(U32), 0x0);
321-
boundList = (xEnt**)xMemAlloc(gActiveHeap, 13 * sizeof(xEnt*), 0x0);
322-
323-
for (i = 0; i < 13; i++)
319+
this->round = 1;
320+
this->firstTimeR1Csn = 1;
321+
this->boundFlags = (U32*)xMemAlloc(gActiveHeap, 13 * sizeof(U32), 0x0);
322+
this->boundList = (xEnt**)xMemAlloc(gActiveHeap, 13 * sizeof(xEnt*), 0x0);
323+
this->curveNode[0].time = 0.0f;
324+
this->curveNode[0].scale = 1.0f;
325+
colorPicker = 255.0f;
326+
this->curveNode[1].color.a = 0xff;
327+
this->curveNodeAlpha = 1.0f;
328+
this->laserShow.set_curve(&this->curveNode[0], 0x6);
329+
this->laserShow.cfg.life_time = 0.5f;
330+
this->laserShow.cfg.blend_src = 0x5;
331+
this->laserShow.cfg.blend_dst = 0x2;
332+
this->laserShow.refresh_config();
333+
this->laserShow.set_texture(xStrHash("lightning"));
334+
335+
for (i = 0; i < 30; i++)
324336
{
337+
sNFSoundValue[i] = xStrHash(sNFSoundLabel[i]);
325338
}
339+
340+
this->iconVert[0].objVertex.x = 1.0f;
341+
this->iconVert[0].objVertex.y = 0.0f;
342+
this->iconVert[0].objVertex.z = 1.0f;
343+
this->iconVert[1].objVertex.x = -1.0f;
344+
this->iconVert[1].objVertex.y = 1.0f;
345+
this->iconVert[1].objVertex.z = 1.0f;
346+
this->iconVert[2].objVertex.x = 0.0f;
347+
this->iconVert[2].objVertex.y = -1.0f;
348+
this->iconVert[2].objVertex.z = -1.0f;
349+
this->iconVert[3].objVertex.x = -1.0f;
350+
this->iconVert[3].objVertex.y = 0.0f;
351+
this->iconVert[3].objVertex.z = -1.0f;
352+
this->iconVert[0].c.preLitColor.red = 0xff;
353+
this->iconVert[0].c.preLitColor.green = 0xff;
354+
this->iconVert[0].c.preLitColor.blue = 0xff;
355+
this->iconVert[0].c.preLitColor.alpha = 0xff;
356+
this->iconVert[1].c.preLitColor.red = 0xff;
357+
this->iconVert[1].c.preLitColor.green = 0xff;
358+
this->iconVert[1].c.preLitColor.blue = 0xff;
359+
this->iconVert[1].c.preLitColor.alpha = 0xff;
360+
this->iconVert[2].c.preLitColor.red = 0xff;
361+
this->iconVert[2].c.preLitColor.green = 0xff;
362+
this->iconVert[2].c.preLitColor.blue = 0xff;
363+
this->iconVert[2].c.preLitColor.alpha = 0xff;
364+
this->iconVert[3].c.preLitColor.red = 0xff;
365+
this->iconVert[3].c.preLitColor.green = 0xff;
366+
this->iconVert[3].c.preLitColor.blue = 0xff;
367+
this->iconVert[3].c.preLitColor.alpha = 0xff;
368+
this->iconVert[0].u = 0.0f;
369+
this->iconVert[1].u = 1.0f;
370+
this->iconVert[2].u = 0.0f;
371+
this->iconVert[3].u = 1.0f;
372+
this->iconVert[0].v = 0.0f;
373+
this->iconVert[1].v = 0.0f;
374+
this->iconVert[2].v = 1.0f;
375+
this->iconVert[3].v = 1.0f;
376+
this->wireLight[0] = 0;
377+
this->wireLight[1] = 0;
378+
379+
xDebugAddTweak("NPC|zNPCBSandy|Newsfish", "Speak", &newsfish_cb, 0, 0);
380+
xDebugAddSelectTweak("NPC|zNPCBSandy|NewsfishComment", &sCurrNFSound, 0, &sNFSoundValue[0], 0x1e, 0, 0, 0);
381+
xDebugAddTweak("NPC|zNPCBSandy|Shockwave|Do It", "Go", &shockwave_cb, 0, 0);
382+
383+
this->shockwaveGrowthRate = 20.0f;
384+
this->shockwaveMaxRadius = 10.0f;
385+
386+
xDebugAddTweak("NPC|zNPCBSandy|Shockwave|GrowthRate", &this->shockwaveGrowthRate, 0.0f, 1000000000.0f, 0, 0, 0);
387+
xDebugAddTweak("NPC|zNPCBSandy|Shockwave|MaxRadius", &this->shockwaveMaxRadius, 0.0f, 1000000000.0f, 0, 0, 0);
388+
389+
this->edropShockwaveTime = 2.25f;
390+
this->edropTurnMinTime = 1.0f;
391+
392+
xDebugAddTweak("NPC|zNPCBSandy|ElbowDrop|ShockwaveTime", &this->edropShockwaveTime, 0.0f, 1000000000.0f, 0, 0, 0);
393+
xDebugAddTweak("NPC|zNPCBSandy|ElbowDrop|TurnTime", &this->edropTurnMinTime, 0.0f, 1000000000.0f, 0, 0, 0);
326394
}
327395

328396
void zNPCBSandy::Setup()
@@ -434,6 +502,140 @@ void zNPCBSandy::SelfSetup()
434502
psy->SetSafety('NGB1');
435503
}
436504

505+
void zNPCBSandy::Reset()
506+
{
507+
S32 i;
508+
S32 j;
509+
RwTexture* tempTex;
510+
char objName[32];
511+
U32 size;
512+
xMarkerAsset* marker;
513+
xAnimState* state;
514+
xModelInstance* currModel;
515+
xVec3 endPnt;
516+
517+
zNPCCommon::Reset();
518+
519+
this->firstUpdate = 0x1;
520+
this->bossFlags = 0x400;
521+
*this->boundFlags = 0;
522+
523+
this->dustEddieEmitter = zParEmitterFind("PAREMIT_DUST_SWIRL");
524+
this->shockwaveEmitter = zParEmitterFind("PAREMIT_SHOCKWAVE");
525+
this->headBoulder = (xEntBoulder*)zSceneFindObject(xStrHash("SANDY_HEAD_BOULDER"));
526+
this->headBoulder->bound.box.box.upper.x = 1.25f;
527+
this->headBoulder->localCenter.x = 0.0f;
528+
this->headBoulder->localCenter.y = 0.036f;
529+
this->headBoulder->localCenter.z = 0.11f;
530+
531+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|radius", &this->headBoulder->bound.sph.r, 0.1f, 10.0f, 0, 0, 0);
532+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|x", &this->headBoulder->bound.sph.center.x, -10.0f, 10.0f, 0, 0, 0);
533+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|y", &this->headBoulder->bound.sph.center.y, -10.0f, 10.0f, 0, 0, 0);
534+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|center|z", &this->headBoulder->bound.sph.center.z, -10.0f, 10.0f, 0, 0, 0);
535+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|x", &this->headBoulder->localCenter.x, -10.0f, 10.0f, 0, 0, 0);
536+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|y", &this->headBoulder->localCenter.y, -10.0f, 10.0f, 0, 0, 0);
537+
xDebugAddTweak("NPC|zNPCBSandy|headBoulder|localCener|z", &this->headBoulder->localCenter.z, -10.0f, 10.0f, 0, 0, 0);
538+
539+
this->hangingScoreboard = (xEnt*)zSceneFindObject(xStrHash("SO_SCOREBOARD"));
540+
this->bustedScoreboard = (xEnt*)zSceneFindObject(xStrHash("SCOREBOARD_BUSTED"));
541+
this->crashedScoreboard = (xEnt*)zSceneFindObject(xStrHash("SCOREBOARD_HAZARD"));
542+
this->scoreboardShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_shrapnel"), 0);
543+
this->sboardSecondShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_secondary_shrapnel"), 0);
544+
this->sboardThirdShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scoreboard_tertiary_shrapnel"), 0);
545+
this->lightRigShrap = (zShrapnelAsset*)xSTFindAsset(xStrHash("pdome_scaffolding_shrapnel"), 0);
546+
this->lightRig[0] = (xEnt*)zSceneFindObject(xStrHash("SO_LIGHTRIG01"));
547+
this->lightRig[1] = (xEnt*)zSceneFindObject(xStrHash("SO_LIGHTRIG010"));
548+
this->lightRig[2] = (xEnt*)zSceneFindObject(xStrHash("SO_LIGHTRIG0100"));
549+
this->lightRig[3] = (xEnt*)zSceneFindObject(xStrHash("SO_LIGHTRIG01000"));
550+
this->round1Csn = (zCutsceneMgr*)zSceneFindObject(xStrHash("CSNMGR_ROUND1"));
551+
this->round2Csn = (zCutsceneMgr*)zSceneFindObject(xStrHash("CSNMGR_ROUND2"));
552+
this->round3Csn = (zCutsceneMgr*)zSceneFindObject(xStrHash("CSNMGR_ROUND3"));
553+
this->targetRaster = 0;
554+
this->helmetRaster = 0;
555+
this->feetRaster = 0;
556+
557+
RwRaster** x;
558+
559+
if (x = (RwRaster**)xSTFindAsset(xStrHash("target"), 0))
560+
{
561+
this->helmetRaster = *x;
562+
}
563+
564+
if (x = (RwRaster**)xSTFindAsset(xStrHash("target_foot"), 0))
565+
{
566+
this->feetRaster = *x;
567+
}
568+
569+
crashedScoreboard->chkby += 0xef;
570+
571+
xVec3Copy(&this->ringCorner[0], (xVec3*)xSTFindAsset(xStrHash("CORNER_00"), &size));
572+
xVec3Add(&this->ringEdgeCenter[0], &this->ringCorner[0], 0);
573+
xVec3SMulBy(&this->ringEdgeCenter[0], 0.5f);
574+
xVec3Sub(&this->ropeNormal[0], 0, &this->ringCorner[0]);
575+
576+
this->ropeNormal[0].y = this->ropeNormal[0].z;
577+
this->ropeNormal[0].z = -this->ropeNormal[0].x;
578+
this->ropeNormal[0].x = this->ropeNormal[0].y;
579+
this->ropeNormal[0].y = 0.0f;
580+
581+
xVec3Normalize(&this->ropeNormal[0], &this->ropeNormal[0]);
582+
xVec3Copy(&this->bouncePoint[0], &this->ringEdgeCenter[0]);
583+
xVec3AddScaled(&this->bouncePoint[0], &this->ringEdgeCenter[0], 6.042f);
584+
strcpy(objName, "ROPE_0_0");
585+
586+
this->ropeObject[0][0] = (xEnt*)zSceneFindObject(xStrHash(objName));
587+
this->ropeObject[0][0]->model->PipeFlags |= 4;
588+
589+
strcmp(this->ropeObject[0][0]->model->Anim->Table->StateList->Name, "Idle01");
590+
strcpy(objName, "ROPE_0_LO");
591+
this-> ropeObjectLo[0] = (xEnt*)zSceneFindObject(xStrHash(objName));
592+
this->ropeSbDamaged = (xEnt*)zSceneFindObject(xStrHash("ROPE_4_LO_DAMAGED"));
593+
strcpy(objName, "TURNBUCKLE_OBJ_00");
594+
this->turnbuckle[0] = (xEnt*)zSceneFindObject(xStrHash(objName));
595+
sRadiusOfRing = xVec3Length(&endPnt) * 0.125f + sRadiusOfRing;
596+
597+
sLeftLegSpring.bound->type = 0;
598+
sRightLegSpring.bound->type = 0;
599+
sLeftArmSpring.bound->type = 0;
600+
sRightArmSpring.bound->type = 0;
601+
602+
zEntEvent(headBoulder, 0x25);
603+
604+
this->timeToNextBolt[0] = 0.0f;
605+
this->jawData = xJaw_FindData(xStrHash("SpongebobPoseidome 44"));
606+
607+
zNPCBSandy::InitFX();
608+
609+
if (this->psy_instinct)
610+
{
611+
this->psy_instinct->GoalSet(0x4e474231, 0);
612+
}
613+
614+
nfFlags = 0;
615+
xVec3Init(&endPnt, 0.0f, 0.0f, 0.0f);
616+
617+
this->sparks[4].start = &endPnt;
618+
this->sparks[4].end = &endPnt;
619+
620+
if (!this->wireLight[0])
621+
{
622+
this->wireLight[0] = zLightningAdd(&this->sparks[4]);
623+
}
624+
625+
this->sparks[4].start = 0;
626+
this->sparks[4].end = 0;
627+
this->sparks[5].start = 0;
628+
this->sparks[5].end = 0;
629+
630+
if (!this->wireLight[1])
631+
{
632+
this->wireLight[1] = zLightningAdd(&this->sparks[5]);
633+
}
634+
635+
this->sparks[5].start = 0;
636+
this->sparks[5].end = 0;
637+
}
638+
437639
void zNPCBSandy::ParseINI()
438640
{
439641
zNPCCommon::ParseINI();

src/SB/Game/zNPCTypeBossSandy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct zNPCBSandy : zNPCBoss
7070
zCutsceneMgr* round2Csn;
7171
zCutsceneMgr* round3Csn;
7272
F32 csnTimer;
73-
_tagLightningAdd sparks[6];
73+
_tagLightningAdd sparks[6]; // 0x7F8
7474
zLightning* wireLight[2]; // 0x978
7575
xVec3 endPoints[2][4];
7676
xMat4x3 sparkTransform[2][2];
@@ -86,7 +86,7 @@ struct zNPCBSandy : zNPCBoss
8686
xVec3 laserPoint[16];
8787
xFXRibbon laserShow;
8888
xFXRibbon::curve_node curveNode[2];
89-
F32 curveNodeAlpha;
89+
F32 curveNodeAlpha; // 0xD24
9090
F32 curveNodeR;
9191
F32 curveNodeG;
9292
F32 curveNodeB;

0 commit comments

Comments
 (0)