Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SB/Core/x/xNPCBasic.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum en_npcdcat
eNPCDCAT_Seven = 7,
eNPCDCAT_Eight = 8,
eNPCDCAT_Eleven = 11,
eNPCDCAT_Thirteen = 13,
};

struct xNPCBasic : xEnt, xFactoryInst
Expand Down
1 change: 1 addition & 0 deletions src/SB/Game/zNPCGoalCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct zNPCGoalCommon : xGoal

U32 DoAutoAnim(en_NPC_GOAL_SPOT gspot, S32 forceRestart);
U32 DoExplicitAnim(U32 anid, S32 forceRestart);
void KickFromTheNest();

const char* Name()
{
Expand Down
154 changes: 154 additions & 0 deletions src/SB/Game/zNPCGoalRobo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@ void zNPCGoalTubeLasso::ChkPrelimTran(en_trantype* trantype, int* nextgoal)
}
}

S32 zNPCGoalTubeLasso::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene)
{
S32 nextgoal = 0;
ChkPrelimTran(trantype, &nextgoal);
if (*trantype != GOAL_TRAN_NONE)
{
return nextgoal;
}
MoveTryToEscape(dt);
return xGoal::Process(trantype, dt, updCtxt, NULL);
}

void zNPCGoalDogDash::HoundPlayer(F32 dt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
npc->ThrottleAdjust(dt, 4.0f, 20.0f);
xVec3* dir = NPCC_faceDir(npc);
npc->ThrottleApply(dt, dir, 0);
}

S32 zNPCGoalPatThrow::Enter(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
Expand All @@ -246,11 +266,106 @@ S32 zNPCGoalPatThrow::Enter(F32 dt, void* updCtxt)
return zNPCGoalCommon::Enter(dt, updCtxt);
}

S32 zNPCGoalAlertGlove::Enter(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
CalcAttackVector();
npc->flg_vuln &= 0xffefffff;
npc->flg_vuln &= 0x7dfeffff;
tmr_minAttack = 1.0f;
zNPC_SNDPlay3D(eNPCSnd_GloveAttack, npc);
return zNPCGoalCommon::Enter(dt, updCtxt);
}

S32 zNPCGoalAlertSleepy::Enter(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
flg_attack = 0;
sleepattack = SLEEP_ATAK_REACT;
npc->VelStop();
npc->ModelAtomicHide(1, NULL);
zNPC_SNDPlay3D(eNPCSnd_SleepyAttack, npc);
return zNPCGoalCommon::Enter(dt, updCtxt);
}

S32 zNPCGoalAttackSlick::Enter(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
idx_launch = 1;
zNPCGoalLoopAnim::LoopCountSet(1);
npc->SndPlayRandom(NPC_STYP_ATTACK);
return zNPCGoalLoopAnim::Enter(dt, updCtxt);
}

S32 zNPCGoalAttackChuck::Enter(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
idx_launch = 1;
npc->ModelAtomicHide(1, NULL);
npc->SndPlayRandom(NPC_STYP_WEPLAUNCH);
return zNPCGoalPushAnim::Enter(dt, updCtxt);
}

S32 zNPCGoalPatCarry::Enter(F32 dt, void* updCtxt)
{
static xVec3 scale = { 0.3f, 0.3f, 0.3f };

zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
NPCGlyph* glyph = npc->glyf_stun;
if (glyph != NULL)
{
glyph->ScaleSet(&scale);
}
return zNPCGoalCommon::Enter(dt, updCtxt);
}

S32 zNPCGoalAlertFodBomb::Enter(F32 dt, void* updCtxt)
{
zNPCFodBomb* npc = (zNPCFodBomb*)(psyche->clt_owner);
flg_attack = 0;
tmr_nextping = 0.0f;
alertbomb = FODBOMB_ALERT_NOTICE;
npc->BlinkerReset();
return zNPCGoalCommon::Enter(dt, updCtxt);
}

void zNPCGoalTubeAttack::LaserRender()
{
zNPCTubeSlave::laser.Render(&paul.pos_laserSource, &paul.pos_laserTarget);
}

S32 zNPCGoalTubeAttack::MarySpinUp(F32 dt)
{
S32 retval = 0;
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
npc->DBG_IsNormLog(eNPCDCAT_Thirteen, -1);
if (mary.ang_spinrate > (8 * PI))
{
retval = 1;
}
else
{
mary.ang_spinrate += (2 * PI) * dt;
}
npc->frame->drot.angle = (dt * mary.ang_spinrate);
npc->frame->mode |= 0x20;
return retval;
}

void zNPCGoalAlertFodBomb::Detonate()
{
zNPCFodBomb* npc = *(zNPCFodBomb**)(&psyche->clt_owner);
npc->SndPlayRandom(NPC_STYP_ATTACK);
NPCHazard* haz = HAZ_Acquire();
if (haz != NULL)
{
haz->ConfigHelper(NPC_HAZ_FODBOMB);
haz->SetNPCOwner(npc);
xVec3* center = xEntGetCenter(npc);
haz->Start(center, -1.0f);
}
}

void zNPCGoalTubeAttack::MaryzFury()
{
zNPCTubelet* npc = *(zNPCTubelet**)(&psyche->clt_owner);
Expand Down Expand Up @@ -1749,6 +1864,45 @@ void zNPCGoalKnock::StreakDone()
streakID = 0xDEAD;
}

S32 zNPCGoalRespawn::Enter(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
tmr_respawn = 0.35f;
cnt_ring = 0;
if (!(flg_info & 0x10))
{
xVec3Copy(&pos_poofHere, &npc->entass->pos);
npc->GetParm(NPC_PARM_FIRSTMVPT, &((zNPCCommon*)(npc))->nav_curr);
}
xVec3Copy(npc->Pos(), &pos_poofHere);
xVec3Copy(&npc->frame->mat.pos, &pos_poofHere);
npc->frame->mode = 1;
flg_info = 0;
if (((zNPCCommon*)(npc))->npc_duplodude != 0)
{
tmr_robobits = LaunchRoboBits();
xEntHide(npc);
}
else
{
tmr_robobits = -1.0f;
}
return zNPCGoalCommon::Enter(dt, updCtxt);
}

S32 zNPCGoalRespawn::Exit(F32 dt, void* updCtxt)
{
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
KickFromTheNest();
xEntShow(npc);
zNPCCommon* duper = npc->npc_duplodude;
if (duper != NULL)
{
duper->DuploNotice(SM_NOTE_NPCALIVE, npc);
}
return xGoal::Exit(dt, updCtxt);
}

void zNPCGoalAttackArfMelee::FXStreakDone()
{
for (S32 i = 0; i < (S32)(sizeof(this->streakID) / sizeof(U32)); i++)
Expand Down
17 changes: 16 additions & 1 deletion src/SB/Game/zNPCGoalStd.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ class zNPCGoalAttackChuck : public zNPCGoalPushAnim

S32 BombzAway(F32);
S32 Exit(F32 dt, void* updCtxt);
S32 Enter(F32 dt, void* updCtxt);
S32 idx_launch; // offset 0x54, size 0x4
};

Expand Down Expand Up @@ -329,6 +330,7 @@ class zNPCGoalAttackSlick : public zNPCGoalLoopAnim
}

S32 FireOne(S32);
S32 Enter(F32 dt, void* updCtxt);
S32 idx_launch; // offset 0x6C, size 0x4
};

Expand Down Expand Up @@ -447,6 +449,8 @@ class zNPCGoalPatCarry : public zNPCGoalCommon
{
xGoal::SetFlags(2);
}

S32 Enter(F32 dt, void* updCtxt);
};

class zNPCGoalStunned : public zNPCGoalCommon
Expand Down Expand Up @@ -558,6 +562,7 @@ class zNPCGoalAlertSleepy : public zNPCGoalCommon
F32 tmr_minAttack; // offset 0x60, size 0x4

S32 Exit(F32, void*);
S32 Enter(F32 dt, void* updCtxt);
};

class zNPCGoalChase : public zNPCGoalCommon
Expand Down Expand Up @@ -713,7 +718,9 @@ class zNPCGoalAlertGlove : public zNPCGoalCommon
}
S32 Suspend(F32 dt, void* updCtxt);
S32 Resume(F32 dt, void* updCtxt);
S32 Enter(F32 dt, void* updCtxt);
S32 Exit(F32 dt, void* updCtxt);
void CalcAttackVector();
F32 tmr_attack; // offset 0x4C, size 0x4
F32 tmr_minAttack; // offset 0x50, size 0x4
xVec3 pos_began; // offset 0x54, size 0xC
Expand Down Expand Up @@ -925,6 +932,8 @@ class zNPCGoalAlertFodBomb : public zNPCGoalCommon
}

S32 Resume(F32 dt, void* updCtxt);
S32 Enter(F32 dt, void* updCtxt);
void Detonate();
S32 flg_attack; // offset 0x4C, size 0x4
en_alertbomb alertbomb; // offset 0x50, size 0x4
F32 tmr_nextping; // offset 0x54, size 0x4
Expand Down Expand Up @@ -1050,6 +1059,8 @@ class zNPCGoalTubeLasso : public zNPCGoalCommon
S32 Enter(F32 dt, void* updCtxt);
S32 Exit(F32 dt, void* updCtxt);
void ChkPrelimTran(en_trantype* trantype, int* nextgoal);
S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene);
void MoveTryToEscape(F32 dt);
};

class zNPCGoalTubeDead : public zNPCGoalDead
Expand Down Expand Up @@ -1123,7 +1134,7 @@ class zNPCGoalTubeAttack : public zNPCGoalCommon
void AttackDataReset();
S32 Enter(F32 dt, void* updCtxt);
S32 Resume(F32 dt, void* updCtxt);
bool MarySpinUp(float);
S32 MarySpinUp(F32 dt);
void LaserRender();
void MaryzBlessing();
void MaryzFury();
Expand Down Expand Up @@ -1213,6 +1224,9 @@ class zNPCGoalRespawn : public zNPCGoalCommon
}

S32 InputInfo(NPCSpawnInfo* info);
S32 Enter(F32, void*);
S32 Exit(F32, void*);
F32 LaunchRoboBits();
F32 tmr_respawn; // offset 0x4C, size 0x4
F32 tmr_robobits; // offset 0x50, size 0x4
S32 cnt_ring; // offset 0x54, size 0x4
Expand Down Expand Up @@ -1306,6 +1320,7 @@ class zNPCGoalDogDash : public zNPCGoalLoopAnim
}

S32 Enter(F32 dt, void* updCtxt);
void HoundPlayer(F32 dt);
};

xFactoryInst* GOALCreate_Standard(S32 who, RyzMemGrow* grow, void*);
Expand Down
Loading