From 5fc7ed4cdecfe3e8862fc17efcf132180a1012ba Mon Sep 17 00:00:00 2001 From: escape209 Date: Fri, 20 Sep 2024 00:58:26 +0100 Subject: [PATCH] Slightly more stuff --- src/SB/Core/x/xVec3.h | 1 + src/SB/Game/zNPCGoalRobo.cpp | 572 ++++++++++++++++++++++++++++++++++- src/SB/Game/zNPCGoalRobo.h | 5 +- src/SB/Game/zNPCGoalStd.h | 391 ++++++++++++++++++++---- src/SB/Game/zNPCSupplement.h | 1 + src/SB/Game/zNPCSupport.h | 1 + src/SB/Game/zNPCTypeCommon.h | 1 + src/SB/Game/zNPCTypeRobot.h | 6 + 8 files changed, 912 insertions(+), 66 deletions(-) diff --git a/src/SB/Core/x/xVec3.h b/src/SB/Core/x/xVec3.h index 489ee6a7..d1309010 100644 --- a/src/SB/Core/x/xVec3.h +++ b/src/SB/Core/x/xVec3.h @@ -37,6 +37,7 @@ struct xVec3 xVec3& invert(); F32 dot(const xVec3& c) const; xVec3& normalize(); + xVec3& assign(F32 val); }; F32 xVec3Normalize(xVec3* o, const xVec3* v); diff --git a/src/SB/Game/zNPCGoalRobo.cpp b/src/SB/Game/zNPCGoalRobo.cpp index a17dc567..2f641ce7 100644 --- a/src/SB/Game/zNPCGoalRobo.cpp +++ b/src/SB/Game/zNPCGoalRobo.cpp @@ -13,6 +13,8 @@ #include "zGameExtras.h" #include "zNPCSupport.h" #include "zNPCTypeBoss.h" +#include "zNPCSupplement.h" +#include "zNPCMessenger.h" #include "zNPCMgr.h" @@ -200,6 +202,212 @@ xFactoryInst* GOALCreate_Robotic(S32 who, RyzMemGrow* grow, void*) return goal; } +void zNPCGoalTubeLasso::ChkPrelimTran(en_trantype* trantype, int* nextgoal) +{ + zNPCTubeSlave* npc = (zNPCTubeSlave*)(psyche->clt_owner); + + switch (npc->tub_pete->tubestat) + { + case TUBE_STAT_BORN: + *nextgoal = NPC_GOAL_TUBEBIRTH; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DUCKLING: + *nextgoal = NPC_GOAL_TUBEDUCKLING; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_ATTACK: + *nextgoal = NPC_GOAL_TUBEATTACK; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DYING: + case TUBE_STAT_DEAD: + *nextgoal = NPC_GOAL_TUBEDYING; + *trantype = GOAL_TRAN_SET; + break; + + } + + // ????? + if (*trantype == GOAL_TRAN_NONE) + { + return; + } +} + +void zNPCGoalTubePal::ChkPrelimTran(en_trantype* trantype, int* nextgoal) +{ + zNPCTubeSlave* npc = ((zNPCTubeSlave*)(psyche->clt_owner)); + + switch (npc->tub_pete->tubestat) + { + case TUBE_STAT_BORN: + *nextgoal = NPC_GOAL_TUBEBIRTH; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_DUCKLING: + *nextgoal = NPC_GOAL_TUBEDUCKLING; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_ATTACK: + *nextgoal = NPC_GOAL_TUBEATTACK; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_LASSO: + *nextgoal = NPC_GOAL_TUBELASSO; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_DYING: + *nextgoal = NPC_GOAL_TUBEDYING; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_DEAD: + *nextgoal = NPC_GOAL_TUBEDEAD; + *trantype = GOAL_TRAN_SET; + return; + } +} + +void zNPCGoalTubeDuckling::ChkPrelimTran(en_trantype* trantype, int* nextgoal) +{ + zNPCTubeSlave* npc = ((zNPCTubeSlave*)(psyche->clt_owner)); + + switch (npc->tub_pete->tubestat) + { + case TUBE_STAT_BORN: + *nextgoal = NPC_GOAL_TUBEBIRTH; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_ATTACK: + if (flg_duckling & 2) + { + break; + } + *nextgoal = NPC_GOAL_TUBEATTACK; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_LASSO: + *nextgoal = NPC_GOAL_TUBELASSO; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DYING: + case TUBE_STAT_DEAD: + *nextgoal = NPC_GOAL_TUBEDYING; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DUCKLING: + break; + } + + if (npc->hitpoints == 0) + { + *nextgoal = NPC_GOAL_TUBEBONKED; + *trantype = GOAL_TRAN_PUSH; + } +} + +void zNPCGoalTubeAttack::ChkPrelimTran(en_trantype* trantype, int* nextgoal) +{ + zNPCTubeSlave* npc = (zNPCTubeSlave*)(psyche->clt_owner); + + switch (npc->tub_pete->tubestat) + { + case TUBE_STAT_BORN: + *nextgoal = NPC_GOAL_TUBEBIRTH; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DUCKLING: + *nextgoal = NPC_GOAL_TUBEDUCKLING; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_LASSO: + *nextgoal = NPC_GOAL_TUBELASSO; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DYING: + case TUBE_STAT_DEAD: + *nextgoal = NPC_GOAL_TUBEDYING; + *trantype = GOAL_TRAN_SET; + break; + + } + + if (*trantype != 0) + { + return; + } + + if (npc->hitpoints != 0) + { + return; + } + + *nextgoal = NPC_GOAL_TUBEBONKED; + *trantype = GOAL_TRAN_PUSH; +} + +void zNPCGoalTubeBirth::ChkPrelimTran(en_trantype* trantype, int* nextgoal) +{ + zNPCTubeSlave* npc = (zNPCTubeSlave*)(psyche->clt_owner); + + switch (npc->tub_pete->tubestat) + { + case TUBE_STAT_DUCKLING: + *nextgoal = NPC_GOAL_TUBEDUCKLING; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_ATTACK: + *nextgoal = NPC_GOAL_TUBEATTACK; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_LASSO: + *nextgoal = NPC_GOAL_TUBELASSO; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_DYING: + case TUBE_STAT_DEAD: + *nextgoal = NPC_GOAL_TUBEDYING; + *trantype = GOAL_TRAN_SET; + break; + case TUBE_STAT_BORN: + break; + } + + if (npc->hitpoints != 0) + { + return; + } + + *nextgoal = NPC_GOAL_TUBEBONKED; + *trantype = GOAL_TRAN_PUSH; +} + +void zNPCGoalTubeDead::ChkPrelimTran(en_trantype* trantype, int* nextgoal) +{ + zNPCTubeSlave* npc = (zNPCTubeSlave*)(psyche->clt_owner); + + switch (npc->tub_pete->tubestat) + { + case TUBE_STAT_BORN: + *nextgoal = NPC_GOAL_TUBEBIRTH; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_DUCKLING: + *nextgoal = NPC_GOAL_TUBEDUCKLING; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_ATTACK: + *nextgoal = NPC_GOAL_TUBEATTACK; + *trantype = GOAL_TRAN_SET; + return; + case TUBE_STAT_LASSO: + *nextgoal = NPC_GOAL_TUBELASSO; + *trantype = GOAL_TRAN_SET; + return; + } + return; +} + S32 zNPCGoalAlertFodder::Enter(F32 dt, void* updCtxt) { flg_attack = 0; @@ -208,6 +416,12 @@ S32 zNPCGoalAlertFodder::Enter(F32 dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } +S32 zNPCGoalAlertPuppy::Enter(F32 dt, void* updCtxt) +{ + alertpup = PUPPY_ALERT_YAPPY; + return zNPCGoalCommon::Enter(dt, updCtxt); +} + S32 zNPCGoalAlertFodder::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene) { zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner; @@ -414,6 +628,50 @@ S32 zNPCGoalAttackFodder::Enter(F32 dt, void* updCtxt) return this->zNPCGoalPushAnim::Enter(dt, updCtxt); } +S32 zNPCGoalAttackCQC::Enter(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = (zNPCCommon*)this->psyche->clt_owner; + flg_attack = 0; + return this->zNPCGoalPushAnim::Enter(dt, updCtxt); +} + +S32 zNPCGoalAttackHammer::Exit(F32 dt, void* updCtxt) +{ + FXStreakDone(); + return this->zNPCGoalPushAnim::Exit(dt, updCtxt); +} + +S32 zNPCGoalLassoThrow::Exit(F32 dt, void* updCtxt) +{ + xEnt* ent = (xEnt*)(this->psyche->clt_owner); + + if ((flg_throw & 0x10) == 0) + { + ent->pflags &= 0xfb; + } + + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalKnock::StreakPrep() +{ + streakID = NPCC_StreakCreate(NPC_STRK_TOSSEDROBOT); +} + +S32 zNPCGoalAttackHammer::FXStreakPrep() +{ + streakID[0] = NPCC_StreakCreate(NPC_STRK_HAMMERSMASH_HORZ); + streakID[1] = NPCC_StreakCreate(NPC_STRK_HAMMERSMASH_VERT); +} + +S32 zNPCGoalAttackArfMelee::FXStreakPrep() +{ + for (int i = 0; i < 4; i++) + { + streakID[i] = NPCC_StreakCreate(NPC_STRK_ARFMELEE); + } +} + S32 zNPCGoalAttackFodder::Exit(F32 dt, void* updCtxt) { if (this->haz_cattle) @@ -425,8 +683,6 @@ S32 zNPCGoalAttackFodder::Exit(F32 dt, void* updCtxt) return this->zNPCGoalPushAnim::Exit(dt, updCtxt); } -#define f_1370 1.0f - S32 zNPCGoalAttackFodder::SyncCattleProd() { xVec3 vec1; @@ -439,7 +695,7 @@ S32 zNPCGoalAttackFodder::SyncCattleProd() return var1; } - if (this->haz_cattle->tmr_remain < f_1370) + if (this->haz_cattle->tmr_remain < 1.0f) { this->haz_cattle->tym_lifespan = npc->AnimDuration(NULL); this->haz_cattle->tmr_remain = npc->AnimTimeRemain(NULL); @@ -475,6 +731,14 @@ S32 zNPCGoalAttackFodder::Process(en_trantype* trantype, F32 dt, void* updCtxt, return this->zNPCGoalPushAnim::Process(trantype, dt, updCtxt, scene); } +S32 zNPCGoalBashed::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene) +{ + xEnt* ent = ((xEnt*)(psyche->clt_owner)); + ent->frame->vel.y = -(dt * 30.0f - ent->frame->vel.y); + ent->frame->mode |= 4; + return this->zNPCGoalLoopAnim::Process(trantype, dt, updCtxt, scene); +} + void zNPCGoalAlertFodBzzt::GetInArena(F32 dt) { zNPCRobot* npc; @@ -710,7 +974,8 @@ void NPCC_DrawPlayerPredict(int, float, float) void NPCLaser::ColorSet(const RwRGBA* unk1, const RwRGBA* unk2) { - // unk2->alpha = unk1->alpha; + rgba[0] = *unk1; + rgba[1] = *unk2; } void xDrawCyl(const xVec3*, float, float, unsigned int) @@ -933,6 +1198,18 @@ S32 zNPCGoalAttackArfMelee::Enter(F32 dt, void* updCtxt) zNPCGoalPushAnim::Enter(dt, updCtxt); } +S32 zNPCGoalAttackHammer::Enter(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + flg_attack = 0; + FXStreakPrep(); + + npc->GetVertPos(NPC_MDLVERT_ATTACK, &pos_lastVert); + pos_oldVert = pos_lastVert; + + return zNPCGoalPushAnim::Enter(dt, updCtxt); +} + void zNPCGoalAttackHammer::ModifyAnimSpeed() { zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); @@ -946,6 +1223,27 @@ void zNPCGoalAttackHammer::ModifyAnimSpeed() anim->CurrentSpeed = speed; } +void zNPCGoalAttackHammer::TellBunnies() +{ + static en_NPCTYPES toTypes[3] = + { + NPC_TYPE_FODDER, + NPC_TYPE_FODBOMB, + NPC_TYPE_CHOMPER + }; + + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + + zNPCMsg_AreaNotify + ( + npc, + NPC_MID_BUNNYHOP, + 8.0f, + 18, + (en_NPCTYPES)toTypes + ); +} + S32 zNPCGoalEvade::Enter(F32 dt, void* updCtxt) { flg_evade = 0; @@ -980,6 +1278,17 @@ S32 zNPCGoalTubeBirth::Enter(F32 dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } +S32 zNPCGoalAlertTarTar::Enter(F32 dt, void* updCtxt) +{ + zNPCTarTar* npc = ((zNPCTarTar*)(psyche->clt_owner)); + flg_attack = 0; + alerttart = TARTAR_ALERT_BEGIN; + hoppy = HOPPY_PATTERN_START; + tmr_reload = 0.0f; + npc->VelStop(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + S32 zNPCGoalAlertTarTar::Resume(F32 dt, void* updCtxt) { zNPCTarTar* npc = ((zNPCTarTar*)(psyche->clt_owner)); @@ -1020,6 +1329,42 @@ S32 zNPCGoalAlertChuck::Enter(F32 dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } +S32 zNPCGoalTubeAttack::Enter(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + npc->VelStop(); + AttackDataReset(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +void zNPCGoalTubeAttack::MaryzBlessing() +{ + zNPCTubelet* npc = ((zNPCTubelet*)(psyche->clt_owner)); + npc->hitpoints = 1; + npc->tub_paul->hitpoints = 1; + npc->tub_paul->tub_pete->hitpoints = 1; +} + +S32 zNPCGoalTubeAttack::MarySpinDown(F32 dt) +{ + zNPCTubelet* npc = ((zNPCTubelet*)(psyche->clt_owner)); + + S32 ret = 0; + + if (mary.ang_spinrate < npc->cfg_npc->spd_turnMax) + { + ret = 1; + } + else + { + mary.ang_spinrate = -((2 * PI) * dt - mary.ang_spinrate); + } + + npc->frame->drot.angle = dt * mary.ang_spinrate; + npc->frame->mode |= 0x20; + return ret; +} + S32 zNPCGoalAlertChomper::Enter(F32 dt, void* updCtxt) { zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); @@ -1030,6 +1375,16 @@ S32 zNPCGoalAlertChomper::Enter(F32 dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } +S32 zNPCGoalAlertMonsoon::Enter(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + flg_attack = 0; + alertmony = MONSOON_ALERT_NOTICE; + tmr_reload = 0.0; + xVec3Copy(&pos_corner, npc->Pos()); + zNPCGoalCommon::Enter(dt, updCtxt); +} + S32 zNPCGoalTubeLasso::Enter(F32 dt, void* updCtxt) { zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); @@ -1037,6 +1392,12 @@ S32 zNPCGoalTubeLasso::Enter(F32 dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } +S32 zNPCGoalTubeDying::DeathByLasso(const xVec3* vec) +{ + flg_tubedying |= 1; + pos_lassoDeath = *vec; +} + S32 zNPCGoalAlertSlick::Resume(F32 dt, void* updCtxt) { zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); @@ -1045,6 +1406,35 @@ S32 zNPCGoalAlertSlick::Resume(F32 dt, void* updCtxt) return zNPCGoalCommon::Resume(dt, updCtxt); } +S32 zNPCGoalAlertSlick::Enter(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + alertslik = SLICK_ALERT_BEGIN; + tmr_reload = -1.0f; + npc->VelStop(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalAttackSlick::FireOne(S32) +{ + zNPCRobot* npc = ((zNPCRobot*)(psyche->clt_owner)); + return npc->LaunchProjectile(NPC_HAZ_OILBUBBLE, 9.0f, 4.0f, NPC_MDLVERT_ATTACK, 4.0f, 0.1f); +} + +S32 zNPCGoalAttackChuck::BombzAway(F32 param_1) +{ + zNPCRobot* npc = ((zNPCRobot*)(psyche->clt_owner)); + npc->SndPlayRandom(NPC_STYP_ATTACK); + return npc->LaunchProjectile(NPC_HAZ_CHUCKBOMB, 15.0f, 3.0f, NPC_MDLVERT_ATTACK, 4.0f, 0.0f); +} + +S32 zNPCGoalAttackChuck::Exit(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + npc->ModelAtomicHide(1, NULL); + return zNPCGoalPushAnim::Exit(dt, updCtxt); +} + S32 zNPCGoalAlertTubelet::Enter(F32 dt, void* updCtxt) { zNPCTubeSlave* npc = ((zNPCTubeSlave*)(psyche->clt_owner)); @@ -1060,6 +1450,42 @@ S32 zNPCGoalAlertTubelet::Exit(F32 dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } +S32 zNPCGoalAlertHammer::Exit(F32 dt, void* updCtxt) +{ + zNPCHammer* npc = ((zNPCHammer*)(psyche->clt_owner)); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalLassoBase::Exit(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = ((zNPCCommon*)(psyche->clt_owner)); + npc->LassoNotify(LASS_EVNT_ENDED); + return xGoal::Exit(dt, updCtxt); +} + +// Equivalent. Weirdness with reloading zNPCFodBzzt::cnt_alerthokey and regalloc. +S32 zNPCGoalAlertFodBzzt::Exit(F32 dt, void* updCtxt) +{ + zNPCFodBzzt::cnt_alerthokey--; + zNPCFodBzzt::cnt_alerthokey = ~(zNPCFodBzzt::cnt_alerthokey >> 31) & zNPCFodBzzt::cnt_alerthokey; + + zNPC_SNDStop(eNPCSnd_FodBzztAttack); + zNPCTubelet* npc = ((zNPCTubelet*)(psyche->clt_owner)); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalAlertArf::Exit(F32 dt, void* updCtxt) +{ + zNPCArfArf* npc = ((zNPCArfArf*)(psyche->clt_owner)); + flg_info = 0; + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalAlertMonsoon::Exit(F32 dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + S32 zNPCGoalAlertTubelet::Resume(F32 dt, void* updCtxt) { zNPCTubelet* npc = ((zNPCTubelet*)(psyche->clt_owner)); @@ -1067,6 +1493,14 @@ S32 zNPCGoalAlertTubelet::Resume(F32 dt, void* updCtxt) return zNPCGoalCommon::Resume(dt, updCtxt); } +S32 zNPCGoalTubeAttack::Resume(F32 dt, void* updCtxt) +{ + zNPCTubelet* npc = ((zNPCTubelet*)(psyche->clt_owner)); + npc->VelStop(); + AttackDataReset(); + return zNPCGoalCommon::Resume(dt, updCtxt); +} + S32 zNPCGoalAlertPuppy::Resume(F32 dt, void* updCtxt) { zNPCChomper* npc = ((zNPCChomper*)(psyche->clt_owner)); @@ -1102,12 +1536,30 @@ S32 zNPCGoalAlertFodBomb::Resume(F32 dt, void* updCtxt) return zNPCGoalCommon::Resume(dt, updCtxt); } +S32 zNPCGoalAttackArf::Exit(F32 dt, void* updCtxt) +{ + flg_attack = 0; + return zNPCGoalPushAnim::Exit(dt, updCtxt); +} + S32 zNPCGoalAttackArfMelee::Exit(F32 dt, void* updCtxt) { FXStreakDone(); return zNPCGoalPushAnim::Exit(dt, updCtxt); } +S32 zNPCGoalAttackArf::LaunchBone(F32 dt, S32 param_2) +{ + zNPCArfArf* npc = ((zNPCArfArf*)(psyche->clt_owner)); + return npc->LaunchProjectile(NPC_HAZ_ARFBONE, 8.0, 3.5, NPC_MDLVERT_ATTACK, 4.0f, 0.35f); +} + +void zNPCGoalKnock::StreakDone() +{ + xFXStreakStop(streakID); + streakID = 0xDEAD; +} + void zNPCGoalAttackArfMelee::FXStreakDone() { for (S32 i = 0; i < (S32)(sizeof(this->streakID) / sizeof(U32)); i++) @@ -1117,6 +1569,15 @@ void zNPCGoalAttackArfMelee::FXStreakDone() } } +S32 zNPCGoalAttackHammer::FXStreakDone() +{ + for (S32 i = 0; i < (S32)(sizeof(this->streakID) / sizeof(U32)); i++) + { + xFXStreakStop(streakID[i]); + streakID[i] = 0xDEAD; + } +} + void zNPCGoalTubeAttack::AttackDataReset() { zNPCTubelet* npc = ((zNPCTubelet*)(psyche->clt_owner)); @@ -1144,6 +1605,33 @@ S32 zNPCGoalWound::NPCMessage(NPCMsg* msg) return 0; } +S32 zNPCGoalTeleport::NPCMessage(NPCMsg* msg) +{ + switch (msg->msgid) + { + case NPC_MID_DAMAGE: + return 1; + } + return 0; +} + +S32 zNPCGoalAlertTubelet::PeteAttackBegin() +{ + zNPCTubelet* npc = (zNPCTubelet *)(psyche->clt_owner); + npc->pete_attack_last = 1; + zNPC_SNDPlay3D(eNPCSnd_TubeAttack, npc); +} + +S32 zNPCGoalAlertGlove::Resume(F32 dt, void* updCtxt) +{ + zNPCCommon* npc = (zNPCCommon *)(psyche->clt_owner); + npc->flg_vuln &= 0xffefffff; + npc->flg_vuln &= 0x7dfeffff; + tmr_minAttack = 1.0; + zNPC_SNDPlay3D(eNPCSnd_GloveAttack, npc); + zNPCGoalCommon::Resume(dt, updCtxt); +} + S32 zNPCGoalRespawn::InputInfo(NPCSpawnInfo* info) { zNPCRobot* npc = ((zNPCRobot*)(psyche->clt_owner)); @@ -1175,7 +1663,14 @@ S32 zNPCGoalStunned::InputInfo(NPCStunInfo* info) return flg_info; } -F32 zNPCGoalEvilPat::GlyphStop() +S32 zNPCGoalEvilPat::InputStun(NPCStunInfo* info) +{ + xPsyche* psyche = xGoal::GetPsyche(); + zNPCGoalStunned* stunned = (zNPCGoalStunned *)psyche->FindGoal(NPC_GOAL_STUNNED); + return stunned == NULL ? 0 : stunned->InputInfo(info); +} + +void zNPCGoalEvilPat::GlyphStop() { zNPCRobot* npc = ((zNPCRobot*)(psyche->clt_owner)); if (npc->glyf_stun != NULL) @@ -1183,4 +1678,71 @@ F32 zNPCGoalEvilPat::GlyphStop() npc->glyf_stun->Discard(); } npc->glyf_stun = NULL; +} + +S32 zNPCGoalAlertFodBzzt::Suspend(F32 dt, void* updCtxt) +{ + zNPCGlove* npc = ((zNPCGlove*)(psyche->clt_owner)); + zNPC_SNDStop(eNPCSnd_FodBzztAttack); + xGoal::Suspend(dt, updCtxt); +} + +S32 zNPCGoalAlertGlove::Suspend(F32 dt, void* updCtxt) +{ + zNPCGlove* npc = ((zNPCGlove*)(psyche->clt_owner)); + npc->flg_vuln |= 0x00100000; + npc->flg_vuln |= 0x82010000; + zNPC_SNDStop(eNPCSnd_GloveAttack); + xGoal::Suspend(dt, updCtxt); +} + +void NPCArena::IncludesNPC(zNPCCommon* npc, float dt, xVec3* vec) +{ + xVec3* pos = npc->Pos(); + IncludesPos(pos, dt, vec); +} + +S32 zNPCGoalDamage::NPCMessage(NPCMsg* msg) +{ + U32 ret = 1; + xPsyche* psyche = (xPsyche *)xGoal::GetPsyche(); + switch (msg->msgid) + { + case NPC_MID_DAMAGE: + if + ( + (msg->infotype == NPC_MDAT_DAMAGE) && + ((msg->dmgdata.dmg_type == DMGTYP_SURFACE) || + (msg->dmgdata.dmg_type == DMGTYP_DAMAGE_SURFACE)) + ) + { + psyche->GoalSet(NPC_GOAL_AFTERLIFE, 0); + } + break; + default: + ret = 0; + break; + } + + return ret; +} + +xVec3& xVec3::assign(float dt) +{ + return assign(dt, dt, dt); +} + +F32 EASE(float rhs) +{ + return rhs * ((rhs * 3.0f) - (rhs * 2.0f) * rhs); +} + +F32 LERP(F32 x, F32 y, F32 z) +{ + return (x * (z - y)) + y; +} + +U8 LERP(float x, U8 y, U8 z) +{ + return (U8)(x * (z - y)) + y; } \ No newline at end of file diff --git a/src/SB/Game/zNPCGoalRobo.h b/src/SB/Game/zNPCGoalRobo.h index ff2bfdae..7fffc74c 100644 --- a/src/SB/Game/zNPCGoalRobo.h +++ b/src/SB/Game/zNPCGoalRobo.h @@ -6,7 +6,10 @@ class zNPCGoalNotice : public zNPCGoalPushAnim { public: - zNPCGoalNotice(S32); + zNPCGoalNotice(S32 id) : zNPCGoalPushAnim(id) + { + SetFlags(2); + } }; void ROBO_PrepRoboCop(); diff --git a/src/SB/Game/zNPCGoalStd.h b/src/SB/Game/zNPCGoalStd.h index 17de4d83..09ae78ae 100644 --- a/src/SB/Game/zNPCGoalStd.h +++ b/src/SB/Game/zNPCGoalStd.h @@ -271,7 +271,13 @@ class zNPCGoalAttackChuck : public zNPCGoalPushAnim { // total size: 0x58 public: - zNPCGoalAttackChuck(S32); + zNPCGoalAttackChuck(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + + S32 BombzAway(F32); + S32 Exit(F32 dt, void* updCtxt); S32 idx_launch; // offset 0x54, size 0x4 }; @@ -279,21 +285,35 @@ class zNPCGoalLassoBase : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalLassoBase(S32); + zNPCGoalLassoBase(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(12); + } + + S32 Exit(F32 dt, void* updCtxt); }; class zNPCGoalLassoGrab : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalLassoGrab(S32); + zNPCGoalLassoGrab(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + } }; class zNPCGoalLassoThrow : public zNPCGoalCommon { // total size: 0x58 public: - zNPCGoalLassoThrow(S32); + zNPCGoalLassoThrow(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + flg_npcgable |= 1; + } + + S32 Exit(F32 dt, void* updCtxt); S32 flg_throw; // offset 0x4C, size 0x4 S32 floorBounce; // offset 0x50, size 0x4 F32 tmr_colDelay; // offset 0x54, size 0x4 @@ -303,7 +323,12 @@ class zNPCGoalAttackSlick : public zNPCGoalLoopAnim { // total size: 0x70 public: - zNPCGoalAttackSlick(S32); + zNPCGoalAttackSlick(S32 id) : zNPCGoalLoopAnim(id) + { + xGoal::SetFlags(6); + } + + S32 FireOne(S32); S32 idx_launch; // offset 0x6C, size 0x4 }; @@ -311,7 +336,11 @@ class zNPCGoalAttackArfMelee : public zNPCGoalPushAnim { // total size: 0x64 public: - zNPCGoalAttackArfMelee(S32); + zNPCGoalAttackArfMelee(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(6); + } + S32 Enter(F32 dt, void* updCtxt); S32 Exit(F32 dt, void* updCtxt); S32 FXStreakPrep(); @@ -324,7 +353,13 @@ class zNPCGoalAttackArf : public zNPCGoalPushAnim { // total size: 0x58 public: - zNPCGoalAttackArf(S32); + zNPCGoalAttackArf(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(6); + } + + S32 LaunchBone(F32 dt, S32 param_2); + S32 Exit(F32 dt, void* updCtxt); S32 flg_attack; // offset 0x54, size 0x4 }; @@ -389,27 +424,39 @@ class zNPCGoalEvilPat : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalEvilPat(S32); + zNPCGoalEvilPat(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(12); + } + S32 Enter(F32 dt, void* updCtxt); S32 Exit(F32 dt, void* updCtxt); F32 GlyphStart(); - F32 GlyphStop(); + void GlyphStop(); S32 NPCMessage(NPCMsg* mail); S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene); + S32 InputStun(NPCStunInfo* info); }; class zNPCGoalPatCarry : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalPatCarry(S32); + zNPCGoalPatCarry(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + } }; class zNPCGoalStunned : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalStunned(S32); + zNPCGoalStunned(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + } + S32 InputInfo(NPCStunInfo* info); S32 Enter(F32 dt, void* updCtxt); }; @@ -417,7 +464,11 @@ class zNPCGoalStunned : public zNPCGoalCommon class zNPCGoalEvade : public zNPCGoalCommon { public: - zNPCGoalEvade(S32); + zNPCGoalEvade(S32 id) : zNPCGoalCommon(id) + { + SetFlags(2); + } + S32 Enter(F32 dt, void* updCtxt); S32 flg_evade; // offset 0x4C, size 0x4 }; @@ -425,7 +476,10 @@ class zNPCGoalEvade : public zNPCGoalCommon class zNPCGoalGoHome : public zNPCGoalCommon { public: - zNPCGoalGoHome(S32); + zNPCGoalGoHome(S32 id) : zNPCGoalCommon(id) + { + SetFlags(2); + } }; enum en_slepatak @@ -450,9 +504,16 @@ class zNPCGoalAlertArf : public zNPCGoalCommon { // total size: 0x54 public: - zNPCGoalAlertArf(S32); + zNPCGoalAlertArf(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + xGoal::AddFlags(8); + flg_npcgauto &= 0xfffffff9; + } + S32 Enter(F32 dt, void* updCtxt); S32 Resume(F32 dt, void* updCtxt); + S32 Exit(F32 dt, void* updCtxt); en_alertarf alertarf; // offset 0x4C, size 0x4 F32 tmr_reload; // offset 0x50, size 0x4 }; @@ -471,8 +532,13 @@ class zNPCGoalAlertPuppy : public zNPCGoalCommon { // total size: 0x50 public: - zNPCGoalAlertPuppy(S32); + zNPCGoalAlertPuppy(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 Resume(F32 dt, void* updCtxt); + S32 Enter(F32 dt, void* updCtxt); enum en_alertpuppy alertpup; // offset 0x4C, size 0x4 }; @@ -480,7 +546,11 @@ class zNPCGoalAlertSleepy : public zNPCGoalCommon { // total size: 0x64 public: - zNPCGoalAlertSleepy(S32); + zNPCGoalAlertSleepy(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + xVec3 dir_attack; // offset 0x4C, size 0xC S32 flg_attack; // offset 0x58, size 0x4 en_slepatak sleepattack; // offset 0x5C, size 0x4 @@ -491,20 +561,31 @@ class zNPCGoalChase : public zNPCGoalCommon { // total size: 0x50 public: - zNPCGoalChase(S32); + zNPCGoalChase(S32 id) : zNPCGoalCommon(id) + { + SetFlags(2); + } + S32 flg_chase; // offset 0x4C, size 0x4 }; struct zNPCGoalTaunt : zNPCGoalLoopAnim { - zNPCGoalTaunt(S32); + zNPCGoalTaunt(S32 id) : zNPCGoalLoopAnim(id) + { + SetFlags(2); + } + S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn); S32 Enter(F32 dt, void* updCtxt); }; struct zNPCGoalPatThrow : zNPCGoalCommon { - zNPCGoalPatThrow(S32); + zNPCGoalPatThrow(S32 id) : zNPCGoalCommon(id) + { + flg_npcgable = 1; + } S32 Enter(F32 dt, void* updCtxt); U8 CollReview(void*); @@ -527,7 +608,12 @@ class zNPCGoalAttackCQC : public zNPCGoalPushAnim { // total size: 0x64 public: - zNPCGoalAttackCQC(S32); + zNPCGoalAttackCQC(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + + S32 Enter(F32 dt, void* updCtxt); xVec3 dir_attack; // offset 0x54, size 0xC S32 flg_attack; // offset 0x60, size 0x4 }; @@ -539,7 +625,11 @@ struct zNPCGoalAlertSlick : zNPCGoalCommon F32 tmr_reload; xVec3 pos_corner; - zNPCGoalAlertSlick(S32); + zNPCGoalAlertSlick(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + void MoveCorner(F32 dt); void GetInArena(F32 dt); S32 NPCMessage(NPCMsg* mail); @@ -552,10 +642,16 @@ class zNPCGoalAlertTubelet : public zNPCGoalCommon { // total size: 0x5C public: - zNPCGoalAlertTubelet(S32); + zNPCGoalAlertTubelet(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + + S32 PeteAttackBegin(); S32 Exit(F32 dt, void* updCtxt); S32 Enter(F32 dt, void* updCtxt); S32 Resume(F32 dt, void* updCtxt); + S32 PeteAttackBegin(F32 dt, void* updCtxt); S32 flg_attack; // offset 0x4C, size 0x4 S32 cnt_nextlos; // offset 0x50, size 0x4 F32 len_laser; // offset 0x54, size 0x4 @@ -572,7 +668,11 @@ struct zNPCGoalAlertChuck : zNPCGoalCommon xVec3 dir_zoom; F32 dst_zoom; - zNPCGoalAlertChuck(S32); + zNPCGoalAlertChuck(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 ZoomMove(F32 dt); void GetInArena(F32 dt); S32 Process(en_trantype* trantype, F32 dt, void* updCtxt); @@ -584,8 +684,14 @@ class zNPCGoalAlertMonsoon : public zNPCGoalCommon { // total size: 0x70 public: - zNPCGoalAlertMonsoon(S32); + zNPCGoalAlertMonsoon(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 Resume(F32 dt, void* updCtxt); + S32 Enter(F32 dt, void* updCtxt); + S32 Exit(F32 dt, void* updCtxt); xVec3 dir_attack; // offset 0x4C, size 0xC S32 flg_attack; // offset 0x58, size 0x4 en_alertmony alertmony; // offset 0x5C, size 0x4 @@ -597,7 +703,13 @@ class zNPCGoalAlertGlove : public zNPCGoalCommon { // total size: 0x84 public: - zNPCGoalAlertGlove(S32); + zNPCGoalAlertGlove(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + flg_npcgable |= 1; + } + S32 Suspend(F32 dt, void* updCtxt); + S32 Resume(F32 dt, void* updCtxt); F32 tmr_attack; // offset 0x4C, size 0x4 F32 tmr_minAttack; // offset 0x50, size 0x4 xVec3 pos_began; // offset 0x54, size 0xC @@ -615,7 +727,11 @@ struct zNPCGoalAlertTarTar : zNPCGoalCommon en_hoppy hoppy; F32 tmr_reload; - zNPCGoalAlertTarTar(S32); + zNPCGoalAlertTarTar(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + void GetInArena(F32 dt); S32 HoppyUpdate(en_trantype* trantype, F32 dt); S32 NPCMessage(NPCMsg* mail); @@ -630,7 +746,11 @@ struct zNPCGoalAlertChomper : zNPCGoalCommon xVec3 pos_evade; F32 tmr_evade; - zNPCGoalAlertChomper(S32); + zNPCGoalAlertChomper(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 CheckSpot(); S32 MoveEvadePos(xVec3* pos, F32 dt); S32 CalcEvadePos(xVec3* pos); @@ -644,8 +764,13 @@ class zNPCGoalAlertHammer : public zNPCGoalCommon { // total size: 0x58 public: - zNPCGoalAlertHammer(S32); + zNPCGoalAlertHammer(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 Enter(F32 dt, void* updCtxt); + S32 Exit(F32 dt, void* updCtxt); S32 flg_attack; // offset 0x4C, size 0x4 en_alertham alertham; // offset 0x50, size 0x4 F32 tmr_alertham; // offset 0x54, size 0x4 @@ -663,14 +788,18 @@ struct zNPCGoalAlertFodBzzt : zNPCGoalCommon RwRGBA rgba_deathRay; S32 cnt_inContact; - zNPCGoalAlertFodBzzt(S32); + zNPCGoalAlertFodBzzt(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + void DeathRayRender(); void DeathRayUpdate(F32 dt); void OrbitPlayer(F32 dt); S32 Process(en_trantype* trantype, F32 dt, void* updCtxt); S32 Resume(F32 dt, void* updCtxt); - S32 Suspend(); - S32 Exit(); + S32 Suspend(F32 dt, void* updCtxt); + S32 Exit(F32 dt, void* updCtxt); S32 Enter(F32 dt, void* updCtxt); void GetInArena(F32 dt); void ToggleOrbit(); @@ -682,7 +811,11 @@ class zNPCGoalAttackMonsoon : public zNPCGoalPushAnim { // total size: 0x58 public: - zNPCGoalAttackMonsoon(S32); + zNPCGoalAttackMonsoon(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + S32 Enter(F32 dt, void* updCtxt); S32 idx_launch; // offset 0x54, size 0x4 }; @@ -691,7 +824,11 @@ class zNPCGoalAttackTarTar : public zNPCGoalPushAnim { // total size: 0x68 public: - zNPCGoalAttackTarTar(S32); + zNPCGoalAttackTarTar(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + S32 Enter(F32 dt, void* updCtxt); S32 flg_attack; // offset 0x54, size 0x4 S32 idx_launch; // offset 0x58, size 0x4 @@ -702,8 +839,17 @@ class zNPCGoalAttackHammer : public zNPCGoalPushAnim { // total size: 0x78 public: - zNPCGoalAttackHammer(S32); + zNPCGoalAttackHammer(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + void ModifyAnimSpeed(); + S32 Exit(F32 dt, void* updCtxt); + S32 FXStreakPrep(); + S32 FXStreakDone(); + void TellBunnies(); + S32 Enter(F32 dt, void* updCtxt); S32 flg_attack; // offset 0x54, size 0x4 xVec3 pos_lastVert; // offset 0x58, size 0xC xVec3 pos_oldVert; // offset 0x64, size 0xC @@ -714,7 +860,11 @@ class zNPCGoalAttackChomper : public zNPCGoalPushAnim { // total size: 0x54 public: - zNPCGoalAttackChomper(S32); + zNPCGoalAttackChomper(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + S32 Enter(F32 dt, void* updCtxt); }; @@ -724,7 +874,11 @@ struct zNPCGoalAttackFodder : zNPCGoalPushAnim { zNPCGoalAttackFodder* goal; - CattleNotify(S32 myType); + CattleNotify() + { + + } + S32 Notify(en_haznote note, NPCHazard*); }; @@ -733,7 +887,11 @@ struct zNPCGoalAttackFodder : zNPCGoalPushAnim CattleNotify cbNotify; NPCHazard* haz_cattle; // 0x6C - zNPCGoalAttackFodder(S32); + zNPCGoalAttackFodder(S32 id) : zNPCGoalPushAnim(id), cbNotify() + { + xGoal::SetFlags(2); + } + S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn); S32 Exit(F32 dt, void* updCtxt); S32 Enter(F32 dt, void* updCtxt); @@ -744,7 +902,13 @@ class zNPCGoalAlert : public zNPCGoalCommon { // total size: 0x50 public: - zNPCGoalAlert(S32); + zNPCGoalAlert(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(0x0000C); + xGoal::AddFlags(0x20000); + flg_npcgauto &= 0xfffffff9; + } + S32 flg_alert; // offset 0x4C, size 0x4 }; @@ -752,7 +916,11 @@ class zNPCGoalAlertFodBomb : public zNPCGoalCommon { // total size: 0x5C public: - zNPCGoalAlertFodBomb(S32); + zNPCGoalAlertFodBomb(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 Resume(F32 dt, void* updCtxt); S32 flg_attack; // offset 0x4C, size 0x4 en_alertbomb alertbomb; // offset 0x50, size 0x4 @@ -763,7 +931,11 @@ class zNPCGoalAlertFodBomb : public zNPCGoalCommon class zNPCGoalAlertFodder : public zNPCGoalCommon { public: - zNPCGoalAlertFodder(S32); + zNPCGoalAlertFodder(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(6); + } + S32 flg_attack; // offset 0x4C, size 0x4 en_alertfod alertfod; // offset 0x50, size 0x4 F32 tmr_alertfod; // offset 0x54, size 0x4 @@ -784,7 +956,12 @@ struct zNPCGoalDogLaunch : zNPCGoalCommon xParabola parabinfo; F32 tmr_remain; - zNPCGoalDogLaunch(S32); + zNPCGoalDogLaunch(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + flg_npcgable = 1; + } + void BubTrailCone(xVec3* pos, S32 num, xVec3* pos_rand, xVec3* vel_rand, xMat3x3* mat); S32 BallisticUpdate(F32 dt); void PreCollide(); @@ -799,7 +976,10 @@ class zNPCGoalDogBark : public zNPCGoalLoopAnim { // total size: 0x6C public: - zNPCGoalDogBark(S32); + zNPCGoalDogBark(S32 id) : zNPCGoalLoopAnim(id) + { + xGoal::SetFlags(2); + } S32 Enter(F32 dt, void* updCtxt); }; @@ -808,7 +988,11 @@ class zNPCGoalDamage : public zNPCGoalCommon { // total size: 0x50 public: - zNPCGoalDamage(S32); + zNPCGoalDamage(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(12); + } + S32 NPCMessage(NPCMsg*); S32 flg_howtodie; // offset 0x4C, size 0x4 }; @@ -816,14 +1000,22 @@ class zNPCGoalBashed : public zNPCGoalLoopAnim { // total size: 0x6C public: - zNPCGoalBashed(S32); + zNPCGoalBashed(S32 id) : zNPCGoalLoopAnim(id) + { + xGoal::SetFlags(2); + } + + S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene); }; class zNPCGoalAfterlife : public zNPCGoalDead { // total size: 0x54 public: - zNPCGoalAfterlife(S32); + zNPCGoalAfterlife(S32 id) : zNPCGoalDead(id) + { + SetFlags(12); + } }; class NPCBullseye @@ -847,22 +1039,37 @@ class zNPCGoalTubeLasso : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalTubeLasso(S32); + zNPCGoalTubeLasso(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(4); + } + S32 Enter(F32 dt, void* updCtxt); + void ChkPrelimTran(en_trantype* trantype, int* nextgoal); }; class zNPCGoalTubeDead : public zNPCGoalDead { // total size: 0x54 public: - zNPCGoalTubeDead(S32); + zNPCGoalTubeDead(S32 id) : zNPCGoalDead(id) + { + + } + + void ChkPrelimTran(en_trantype*, int*); }; class zNPCGoalTubeDying : public zNPCGoalCommon { // total size: 0x6C public: - zNPCGoalTubeDying(S32); + zNPCGoalTubeDying(S32 id) : zNPCGoalCommon(id) + { + + } + + S32 DeathByLasso(const xVec3*); S32 flg_tubedying; // offset 0x4C, size 0x4 F32 spd_gothatway; // offset 0x50, size 0x4 S32 cnt_loop; // offset 0x54, size 0x4 @@ -875,7 +1082,11 @@ class zNPCGoalTubeBonked : public zNPCGoalCommon { // total size: 0x60 public: - zNPCGoalTubeBonked(S32); + zNPCGoalTubeBonked(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + } + F32 tmr_recover; // offset 0x4C, size 0x4 F32 ang_spinrate; // offset 0x50, size 0x4 xVec3 vec_offsetPete; // offset 0x54, size 0xC @@ -884,8 +1095,13 @@ class zNPCGoalTubeBonked : public zNPCGoalCommon class zNPCGoalTubeBirth : public zNPCGoalCommon { public: - zNPCGoalTubeBirth(S32); + zNPCGoalTubeBirth(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(4); + } + S32 Enter(F32 dt, void* updCtxt); + void ChkPrelimTran(en_trantype* trantype, int* nextgoal); // total size: 0x4C }; @@ -893,8 +1109,18 @@ class zNPCGoalTubeAttack : public zNPCGoalCommon { // total size: 0x84 public: - zNPCGoalTubeAttack(S32); + zNPCGoalTubeAttack(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(4); + } + void AttackDataReset(); + S32 Enter(F32 dt, void* updCtxt); + S32 Resume(F32 dt, void* updCtxt); + S32 LaserRender(); + void MaryzBlessing(); + S32 MarySpinDown(F32 dt); + void ChkPrelimTran(en_trantype* trantype, int* nextgoal); S32 flg_attack; // offset 0x4C, size 0x4 union { @@ -923,7 +1149,13 @@ class zNPCGoalTubeDuckling : public zNPCGoalCommon { // total size: 0x70 public: - zNPCGoalTubeDuckling(S32); + zNPCGoalTubeDuckling(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(4); + } + + void ChkPrelimTran(en_trantype* trantype, int* nextgoal); + S32 flg_duckling; // offset 0x4C, size 0x4 F32 tmr_running; // offset 0x50, size 0x4 F32 tmr_hoverCycle; // offset 0x54, size 0x4 @@ -937,14 +1169,25 @@ class zNPCGoalTubePal : public zNPCGoalCommon { // total size: 0x4C public: - zNPCGoalTubePal(S32); + zNPCGoalTubePal(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(0x0000C); + xGoal::AddFlags(0x20000); + flg_npcgauto &= 0xfffffff9; + } + + void ChkPrelimTran(en_trantype* trantype, int* nextgoal); }; class zNPCGoalDeflate : public zNPCGoalCommon { // total size: 0x58 public: - zNPCGoalDeflate(S32); + zNPCGoalDeflate(S32 id) : zNPCGoalCommon(id) + { + SetFlags(2); + } + F32 spd_gothatway; // offset 0x4C, size 0x4 S32 cnt_loop; // offset 0x50, size 0x4 F32 scl_shrink; // offset 0x54, size 0x4 @@ -954,7 +1197,11 @@ class zNPCGoalRespawn : public zNPCGoalCommon { // total size: 0x64 public: - zNPCGoalRespawn(S32); + zNPCGoalRespawn(S32 id) : zNPCGoalCommon(id) + { + SetFlags(2); + } + S32 InputInfo(NPCSpawnInfo* info); F32 tmr_respawn; // offset 0x4C, size 0x4 F32 tmr_robobits; // offset 0x50, size 0x4 @@ -972,6 +1219,8 @@ class zNPCGoalKnock : public zNPCGoalCommon flg_npcgable |= 1; } + void StreakDone(); + S32 StreakPrep(); S32 flg_knock; // offset 0x4C, size 0x4 xVec3 pos_bumper; // offset 0x50, size 0xC S32 floorBounce; // offset 0x5C, size 0x4 @@ -982,7 +1231,12 @@ class zNPCGoalWound : public zNPCGoalPushAnim { // total size: 0x64 public: - zNPCGoalWound(S32); + zNPCGoalWound(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + flg_npcgable |= 1; + } + S32 NPCMessage(NPCMsg*); xVec3 dir_fling; // offset 0x54, size 0xC S32 flg_knock; // offset 0x60, size 0x4 @@ -992,7 +1246,11 @@ class zNPCGoalHokeyPokey : public zNPCGoalLoopAnim { // total size: 0x74 public: - zNPCGoalHokeyPokey(S32); + zNPCGoalHokeyPokey(S32 id) : zNPCGoalLoopAnim(id) + { + xGoal::SetFlags(2); + } + S32 Enter(F32 dt, void* updCtxt); S32 flg_hokey; // offset 0x6C, size 0x4 F32 ang_spinrate; // offset 0x70, size 0x4 @@ -1002,7 +1260,12 @@ class zNPCGoalTeleport : public zNPCGoalCommon { // total size: 0x50 public: - zNPCGoalTeleport(S32); + zNPCGoalTeleport(S32 id) : zNPCGoalCommon(id) + { + xGoal::SetFlags(2); + } + + S32 NPCMessage(NPCMsg* msg); F32 tmr_countdown; // offset 0x4C, size 0x4 }; @@ -1010,7 +1273,11 @@ class zNPCGoalDogPounce : public zNPCGoalPushAnim { // total size: 0x54 public: - zNPCGoalDogPounce(S32); + zNPCGoalDogPounce(S32 id) : zNPCGoalPushAnim(id) + { + xGoal::SetFlags(2); + } + S32 NPCMessage(NPCMsg* mail); S32 Enter(F32 dt, void* updCtxt); S32 Exit(F32 dt, void* updCtxt); @@ -1021,7 +1288,11 @@ class zNPCGoalDogDash : public zNPCGoalLoopAnim { // total size: 0x6C public: - zNPCGoalDogDash(S32); + zNPCGoalDogDash(S32 id) : zNPCGoalLoopAnim(id) + { + xGoal::SetFlags(2); + } + S32 Enter(F32 dt, void* updCtxt); }; diff --git a/src/SB/Game/zNPCSupplement.h b/src/SB/Game/zNPCSupplement.h index 39e0318d..02350575 100644 --- a/src/SB/Game/zNPCSupplement.h +++ b/src/SB/Game/zNPCSupplement.h @@ -116,6 +116,7 @@ void NPCC_ShadowCacheReset(); void NPAR_Timestep(F32 dt); void NPCC_MakeStreakInfo(en_npcstreak styp, StreakInfo* info); void xFXStreakStart(en_npcstreak* styp); +S32 NPCC_StreakCreate(en_npcstreak styp); void UpdateAndRender(NPARMgmt param_1, F32 dt); F32 BOWL3(F32 param_1); F32 QUB(F32 param_1); diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index c103db45..66fd3d6a 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -59,5 +59,6 @@ void NPCC_ang_toXZDir(F32 angle, xVec3* dir); F32 NPCC_aimVary(xVec3* dir_aim, xVec3* pos_src, xVec3* pos_tgt, F32 dst_vary, S32 flg_vary, xVec3* pos_aimPoint); F32 NPCC_ds2_toCam(const xVec3* pos_from, xVec3* delta); void zNPC_SNDStop(_tageNPCSnd snd); +void zNPC_SNDPlay3D(_tageNPCSnd snd, xEnt*); #endif diff --git a/src/SB/Game/zNPCTypeCommon.h b/src/SB/Game/zNPCTypeCommon.h index d467db8e..09e4abe2 100644 --- a/src/SB/Game/zNPCTypeCommon.h +++ b/src/SB/Game/zNPCTypeCommon.h @@ -407,6 +407,7 @@ struct zNPCCommon : xNPCBasic void ModelScaleSet(F32 x, F32 y, F32 z); void ModelScaleSet(F32 unk); void ModelScaleSet(const xVec3* vec); + xModelInstance* ModelAtomicHide(int index, xModelInstance* mdl); S32 AnimStart(U32 animID, S32 forceRestart); xAnimState* AnimFindState(U32 animID); xAnimState* AnimCurState(); diff --git a/src/SB/Game/zNPCTypeRobot.h b/src/SB/Game/zNPCTypeRobot.h index 7ae2e05a..66582c69 100644 --- a/src/SB/Game/zNPCTypeRobot.h +++ b/src/SB/Game/zNPCTypeRobot.h @@ -27,6 +27,7 @@ struct NPCArena F32 DstSqFromHome(xVec3* pos, xVec3* delt); F32 PctFromHome(xVec3* pos); S32 IncludesPos(xVec3* pos, F32 rad_thresh, xVec3* vec); + void IncludesNPC(zNPCCommon*, float, xVec3*); F32 Radius(F32 unk); xVec3* Pos(); S32 IncludesPlayer(F32 rad_thresh, xVec3* vec); @@ -44,6 +45,7 @@ struct NPCLaser void ColorSet(const RwRGBA*, const RwRGBA*); U32 TextureGet(); + static void Render(xVec3&, xVec3&); }; struct NPCBattle @@ -171,6 +173,8 @@ struct zNPCFodBomb : zNPCRobot struct zNPCFodBzzt : zNPCRobot { + volatile static S32 cnt_alerthokey; + RwRGBA rgba_discoLight; F32 tmr_discoLight; xVec3 pos_discoLight; @@ -359,6 +363,8 @@ enum en_tubespot struct zNPCTubeSlave : zNPCRobot { + static NPCLaser laser; + en_tubespot tubespot; zNPCTubelet* tub_pete;