From 6a1d06c1fc9b730731aae3fcce66aa2cff751cf9 Mon Sep 17 00:00:00 2001 From: Matt P <5638426+mattbruv@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:03:57 -0500 Subject: [PATCH] pat boss progress --- src/SB/Core/x/xEnt.h | 2 +- src/SB/Core/x/xMath3.h | 1 + src/SB/Core/x/xModel.h | 1 + src/SB/Game/zGlobals.h | 2 +- src/SB/Game/zLightning.h | 12 +- src/SB/Game/zNPCTypeBoss.cpp | 4 + src/SB/Game/zNPCTypeBossPatrick.cpp | 1078 ++++++++++++++++++++++++++- src/SB/Game/zNPCTypeBossPatrick.h | 200 ++--- src/SB/Game/zNPCTypeBossSB1.cpp | 2 +- src/SB/Game/zNPCTypeRobot.h | 65 +- src/SB/Game/zNPCTypeVillager.h | 57 +- 11 files changed, 1317 insertions(+), 107 deletions(-) diff --git a/src/SB/Core/x/xEnt.h b/src/SB/Core/x/xEnt.h index 2ba999c4..5fcb0f8e 100644 --- a/src/SB/Core/x/xEnt.h +++ b/src/SB/Core/x/xEnt.h @@ -180,7 +180,7 @@ struct xEnt : xBase xShadowSimpleCache* simpShadow; xEntShadow* entShadow; anim_coll_data* anim_coll; - void* user_data; + void* user_data; // 0xCC }; // collision types diff --git a/src/SB/Core/x/xMath3.h b/src/SB/Core/x/xMath3.h index 089e0d00..db96c9be 100644 --- a/src/SB/Core/x/xMath3.h +++ b/src/SB/Core/x/xMath3.h @@ -121,6 +121,7 @@ void xMat3x3Scale(xMat3x3* m, const xVec3* s); void xMat3x3ScaleC(xMat3x3* m, F32 x, F32 y, F32 z); void xMat3x3RMulRotY(xMat3x3* o, const xMat3x3* m, F32 t); void xMat3x3Mul(xMat3x3* o, const xMat3x3* a, const xMat3x3* b); +void xMat3x3SMul(xMat3x3*, const xMat3x3*, F32); void xBoxFromLine(xBox& box, const xLine3& line); void xBoxFromRay(xBox& box, const xRay3& ray); void xMat3x3Identity(xMat3x3* matrix); diff --git a/src/SB/Core/x/xModel.h b/src/SB/Core/x/xModel.h index 66f0499b..f6fdadad 100644 --- a/src/SB/Core/x/xModel.h +++ b/src/SB/Core/x/xModel.h @@ -135,6 +135,7 @@ void xModelAnimCollStart(xModelInstance& m); void xModelSetFrame(xModelInstance* modelInst, const xMat4x3* frame); xModelInstance* xModelInstanceAlloc(RpAtomic* data, void* object, U16 flags, U8 boneIndex, U8* boneRemap); +void xModelInstanceFree(xModelInstance* modelInst); void xModelInstanceAttach(xModelInstance* inst, xModelInstance* parent); void xModelRender(xModelInstance* modelInst); void xModelRender2D(const xModelInstance& model, const basic_rect& r, const xVec3& from, diff --git a/src/SB/Game/zGlobals.h b/src/SB/Game/zGlobals.h index 8179a107..ea0e627e 100644 --- a/src/SB/Game/zGlobals.h +++ b/src/SB/Game/zGlobals.h @@ -210,7 +210,7 @@ struct zPlayerGlobals F32 IdleSitTimer; S32 Transparent; zEnt* FireTarget; - U32 ControlOff; + U32 ControlOff; // 0x1788 U32 ControlOnEvent; // Offset: 0x1790 diff --git a/src/SB/Game/zLightning.h b/src/SB/Game/zLightning.h index a202e9a2..1ac428fa 100644 --- a/src/SB/Game/zLightning.h +++ b/src/SB/Game/zLightning.h @@ -101,14 +101,14 @@ void zLightningKill(zLightning* l); void RenderLightning(zLightning* l); void zLightningRender(); void zLightningModifyEndpoints(zLightning* l, xVec3* start, xVec3* end); -void xDebugAddTweak(char* name, U8* property, U8 param_3, U8 param_4, - tweak_callback* callback, void* param_6, U32 param_7); +void xDebugAddTweak(char* name, U8* property, U8 param_3, U8 param_4, tweak_callback* callback, + void* param_6, U32 param_7); void xDebugAddFlagTweak(char* name, U32* property, U32 param_3, tweak_callback* callback, void* param_5, U32 param_6); -void xDebugAddSelectTweak(char* name, U32* param_2, char** param_3, U32* param_4, - U32 param_5, tweak_callback* callback, void* param_7, U32 param_8); -void xDebugAddTweak(char* name, S16* property, S16 param_3, S16 param_4, - tweak_callback* callback, void* param_6, U32 param_7); +void xDebugAddSelectTweak(char* name, U32* param_2, char** param_3, U32* param_4, U32 param_5, + tweak_callback* callback, void* param_7, U32 param_8); +void xDebugAddTweak(char* name, S16* property, S16 param_3, S16 param_4, tweak_callback* callback, + void* param_6, U32 param_7); void zLightningInit(); void zLightningUpdate(F32 seconds); diff --git a/src/SB/Game/zNPCTypeBoss.cpp b/src/SB/Game/zNPCTypeBoss.cpp index c11bb024..bef50225 100644 --- a/src/SB/Game/zNPCTypeBoss.cpp +++ b/src/SB/Game/zNPCTypeBoss.cpp @@ -11,6 +11,10 @@ U32 g_hash_bossanim[ANIM_COUNT] = {}; +void foo(zNPCBPatrick* pat) +{ +} + // clang-format off char* g_strz_bossanim[ANIM_COUNT] = { diff --git a/src/SB/Game/zNPCTypeBossPatrick.cpp b/src/SB/Game/zNPCTypeBossPatrick.cpp index a1d0ddac..e6a5753f 100644 --- a/src/SB/Game/zNPCTypeBossPatrick.cpp +++ b/src/SB/Game/zNPCTypeBossPatrick.cpp @@ -1,11 +1,1077 @@ -#include "xVec3.h" +#include +#include "string.h" + +#include "iModel.h" + +#include "xMath.h" #include "xMath3.h" +#include "xstransvc.h" +#include "xVec3.h" +#include "zCamera.h" +#include "zEntSimpleObj.h" +#include "zEntDestructObj.h" +#include "zGlobals.h" #include "zNPCTypeBossPatrick.h" +#include "zRenderState.h" +#include "zNPCGoals.h" +#include "zLightning.h" +#include "zNPCTypeRobot.h" -#include +#define f831 1.0f +#define f832 0.0f +#define f833 0.2f +#define f870 -1.0f +#define f875 (double)4503601774854144 // wtf? +#define f891 2.0f +#define f892 -0.4f +#define f1045 0.125f +#define f1046 0.5f +#define f1047 0.7f +#define f1048 8.0f +#define f1049 5.0f +#define f1050 2.5f +#define f1051 3.0f +#define f1052 4.2f +#define f1053 12.0f +#define f1054 6.0f +#define f1055 10.0f +#define f1056 50.0f +#define f1137 5.5f +#define f1138 6.5f +#define f1139 0.365f +#define f1140 3.1415927f +#define f1141 20.0f +#define f1142 15.0f +#define f1143 -1000000000.0f +#define f1144 1000000000.0f +#define f1656 0.0001f +#define f1657 400.0f +#define f1658 0.5775f +#define f1659 40.0f +#define f1660 -2.01f +#define f1661 0.175f +#define f1662 0.025f +#define f1663 1.25f +#define f1664 0.25f +#define f1665 80.0f +#define f1666 6.2831855f +#define f1667 3.15f +#define f1668 0.00001f +#define f1669 0.1f +#define f1670 4.0f +#define f1671 0.77f +#define f1672 0.3f +#define f1673 1.5707964f +#define f1674 0.15f +#define f1675 0.65f +#define f1676 0.75f +#define f1677 0.01f +#define f1678 0.33f +#define f1679 18.5f +#define f1680 -18.5f +#define f1681 -20.0f +#define f1682 7.0f +#define f2006 100.0f +#define f2077 5.95f +#define f2078 0.539f +#define f2215 8.5f +#define f2256 0.50049996f +#define f2257 0.45f +#define f2280 1.7f +#define f2405 -3.1415927f +#define f2423 0.4f +#define f2424 0.8f +#define f2425 1.2f +#define f2426 1.5f +#define f2427 1.8f +#define f2428 2.1f +#define f2512 0.35f +#define f2596 -0.08f +#define f2597 25.0f +#define f2610 0.6545f +#define f2629 0.7853982f +#define f2630 1.75f +#define f2696 -4.0f +#define f2697 300.0f +#define f2885 12.5f +#define f2994 7.5f + +static unsigned char sUseBossCam; +static unsigned char sWasUsingBossCam; +static unsigned char sOthersHaventBeenAdded; +static zNPCBPatrick* sPat_Ptr; +static xVec3* sCamSubTarget; +static F32 sSecsSincePatWasCarryingHead; +static xVec3 sCamSubTargetFixed; +static F32 sCurrYaw; +static F32 sCurrHeight; +static F32 sCurrRadius; +static F32 sCurrPitch; +static F32 sCurrYawOffset; +static F32 sCurrCamInterp; +static F32 minYVel; +static F32 varYVel; +static F32 minHMul; +static F32 varHMul; +static F32 minT; +static F32 varT; +static S32 sBone[10]; +static S32 sBoundBone[4]; +static F32 sBoundRadius[4]; +static xVec3 sBoneOffset[4]; +static newsfishSound sNFComment[37]; +static U32 sCurrNFSound; +static tweak_callback newsfish_cb; +static tweak_callback recenter_cb; + +void test(S32) +{ +} + +static void Pat_ResetGlobalStuff() +{ +} + +void zNPCBPatrick::Init(xEntAsset* asset) +{ + /* + signed int i; // r20 + class xEnt * ent; // r19 + class RwTexture * tempTexture; // r2 + */ +} + +void on_change_newsfish(const tweak_info&) +{ + sPat_Ptr->newsfish->SpeakStart(sNFComment[sCurrNFSound].soundID, 0, -1); +} + +void on_change_recenter(const tweak_info&) +{ + sPat_Ptr->bossFlags |= 0x200; +} + +// 73% match. Kind of a difficult function +void zNPCBPatrick::Setup() +{ + char tempString[32]; // r29+0xA0 + char objName[32]; // r29+0x80 + /* + char tempString[32]; // r29+0xA0 + signed int i; // r18 + signed int j; // r20 + class RpAtomic * tempIModel; // r2 + class xMarkerAsset * marker; // r2 + char objName[32]; // r29+0x80 + */ + + this->freezeBreathEmitter = zParEmitterFind("FREEZE_BREATH_EMIT"); + this->fudgeEmitter = zParEmitterFind("FUDGE_EMIT"); + this->steamEmitter = zParEmitterFind("STEAM PAR EMIT"); + this->gooObj = (xEnt*)zSceneFindObject(xStrHash("GOO OBJ")); + this->fudgeHandle = (xEnt*)zSceneFindObject(xStrHash("FUDGE_HANDLE")); + + // + + strcpy(objName, "SWINGHOOK 00"); + this->origSwingerHeight = f832; + + for (S32 i = 0; i < 8; i++) + { + objName[11]++; + this->swinger[i] = (xEnt*)zSceneFindObject(xStrHash(objName)); + this->origSwingerHeight = + this->swinger[i]->model->Mat->pos.y * f1045 + this->origSwingerHeight; + } + + for (S32 i = 0; i < 8; i++) + { + this->swinger[i]->model->Mat->pos.y += + (this->origSwingerHeight - this->swinger[i]->model->Mat->pos.y); + } + + // + + strcpy(objName, "WOODEN_PLAT_00_00"); + + for (S32 i = 0; i < 8; i++) + { + objName[16]++; + + for (S32 j = 0; j < 3; j++) + { + objName[13]++; + this->box[j][i].box = (xEnt*)zSceneFindObject(xStrHash(objName)); + this->box[j][i].minY = this->box[j][i].box->model->Mat->pos.y; + // must be being cast to some other data type to dereference 0xd8 + // probably zEntSimpleObj? + ((zEntSimpleObj*)this->box[j][i].box)->sflags |= 8; + } + } + + this->backBox.box = (xEnt*)zSceneFindObject(xStrHash("WOODEN_PLAT_BACK")); + this->backBox.minY = f1046; + + // must be being cast to some other data type to dereference 0xd8 + // zEntDestructObj? + // zUI? + // zEntSimpleObj? + // zEGenerator? + // not exactly sure what type it is exactly, + // but it's probably zEntSimpleObj because 0xd8 is flags + ((zEntSimpleObj*)this->backBox.box)->sflags |= 8; + + this->boxBreak = (zShrapnelAsset*)xSTFindAsset(xStrHash("b2_box_shrapnel"), NULL); + this->boxSplash = (zShrapnelAsset*)xSTFindAsset(xStrHash("b2_box_splash_shrapnel"), NULL); + this->spitModel = (RpAtomic*)xSTFindAsset(xStrHash("fx_boss_pa_spit"), NULL); + this->splatModel = (RpAtomic*)xSTFindAsset(xStrHash("fx_boss_pa_splat"), NULL); + this->shardModel = (RpAtomic*)xSTFindAsset(xStrHash("b2_ice_shard"), NULL); + this->iceBreak = (zShrapnelAsset*)xSTFindAsset(xStrHash("sb_ice_break"), NULL); + + RpAtomic* tempIModel = (RpAtomic*)xSTFindAsset(xStrHash("b2_SB_frozen"), NULL); + this->frozenSB = NULL; + this->frozenSB = (xModelInstance*)xModelInstanceAlloc(tempIModel, NULL, 0, 0, NULL); + + tempIModel = (RpAtomic*)xSTFindAsset(xStrHash("b2_SB_frozen_ice"), NULL); + this->frozenSBIce = NULL; + this->frozenSBIce = (xModelInstance*)xModelInstanceAlloc(tempIModel, NULL, 0, 0, NULL); + this->frozenSBIce->Alpha = f1047; + + this->round1Csn = (zCutsceneMgr*)zSceneFindObject(xStrHash("CSNMGR_ROUND1")); + this->round2Csn = (zCutsceneMgr*)zSceneFindObject(xStrHash("CSNMGR_ROUND2")); + this->round3Csn = (zCutsceneMgr*)zSceneFindObject(xStrHash("CSNMGR_ROUND3")); + + this->safeGroundPortal = (_zPortal*)zSceneFindObject(xStrHash("SAFEGROUND_PORTAL")); + xVec3Copy(&this->arenaExtent, (xVec3*)xSTFindAsset(xStrHash("MK ARENA EXTENT"), NULL)); + xVec3Copy(&this->fudgePos, (xVec3*)xSTFindAsset(xStrHash("FUDGE_POS"), NULL)); + xVec3Init(&this->fudgeFace, f832, f832, f831); + xVec3AddTo(&this->fudgeFace, &this->fudgePos); + + // + + strcpy(objName, "ROBOT_CHUCK_NPC01"); + + for (S32 i = 0; i < 3; i++) + { + this->chuckList[i] = (zNPCCommon*)zSceneFindObject(xStrHash(objName)); + objName[16]++; + } + + strcpy(objName, "MP_CHUCK_ARENA01"); + + for (S32 i = 0; i < 3; i++) + { + this->chuckMovePoint[i] = (zMovePoint*)zSceneFindObject(xStrHash(objName)); + objName[15]++; + } + + for (S32 i = 0; i < 3; i++) + { + ((zNPCRobot*)this->chuckList[i])->DuploOwner(this); + } + + this->newsfish = (zNPCNewsFish*)zSceneFindObject(xStrHash("NEWSFISH")); + this->newsfish->TalkOnScreen(1); + + strcpy(tempString, "HEALTH_00"); + + for (S32 i = 0; i < 2; i++) + { + this->underwear[i] = (zEntPickup*)zSceneFindObject(xStrHash(tempString)); + tempString[8]++; + } + + this->conveyorBelt[0] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 01")); + this->conveyorBelt[1] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 02")); + this->conveyorBelt[2] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 03")); + this->conveyorBelt[3] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 04")); + this->conveyorBelt[4] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 08")); + this->conveyorBelt[5] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 09")); + this->conveyorBelt[6] = (zPlatform*)zSceneFindObject(xStrHash("CONVEYOR BELT 10")); + + this->bossCam.cfg.zone_rest.distance = f1048; + this->bossCam.cfg.zone_rest.height = f1049; + this->bossCam.cfg.zone_rest.height_focus = f1050; + this->bossCam.cfg.zone_above.distance = f1051; + this->bossCam.cfg.zone_above.height = f1052; + this->bossCam.cfg.zone_above.height_focus = f870; + this->bossCam.cfg.zone_below.distance = f1053; + this->bossCam.cfg.zone_below.height = f1051; + this->bossCam.cfg.zone_below.height_focus = f1054; + this->bossCam.cfg.move_speed = f1055; + this->bossCam.cfg.turn_speed = f1055; + this->bossCam.cfg.stick_speed = f1055; + this->bossCam.cfg.stick_yaw_vel = f1055; + this->bossCam.cfg.max_yaw_vel = f1056; + this->bossCam.cfg.margin_angle = f870; + + this->bossCam.init(); + this->bossCam.add_tweaks("NPC|zNPCBPatrick|Boss Cam|"); + xDebugAddTweak("NPC|zNPCBPatrick|Boss Cam|Recenter", "*", (tweak_callback*)&recenter_cb, + (void*)0x0, 0); + + zNPCCommon::Setup(); +} + +static S32 idleCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 tauntCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 hitCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 spitCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 runCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 smackCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 freezeCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 spawnCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 spinCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); +static S32 fudgeCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); + +void zNPCBPatrick::SelfSetup() +{ + Pat_ResetGlobalStuff(); + + xBehaveMgr* bmgr = xBehaveMgr_GetSelf(); + this->psy_instinct = bmgr->Subscribe(this, 0); + + xPsyche* psy = this->psy_instinct; + + psy->BrainBegin(); + + xGoal* goal = psy->AddGoal(NPC_GOAL_BOSSPATIDLE, NULL); + goal->SetCallbacks(idleCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATTAUNT, NULL); + goal->SetCallbacks(tauntCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATHIT, NULL); + goal->SetCallbacks(hitCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATSPIT, NULL); + goal->SetCallbacks(spitCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATRUN, NULL); + goal->SetCallbacks(runCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATSMACK, NULL); + goal->SetCallbacks(smackCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATFREEZE, NULL); + goal->SetCallbacks(freezeCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATSPAWN, NULL); + goal->SetCallbacks(spawnCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATSPIN, NULL); + goal->SetCallbacks(spinCB, NULL, NULL, NULL); + + goal = psy->AddGoal(NPC_GOAL_BOSSPATFUDGE, NULL); + goal->SetCallbacks(fudgeCB, NULL, NULL, NULL); + + psy->BrainEnd(); + + psy->SetSafety(NPC_GOAL_BOSSPATIDLE); +} + +WEAK void xDebugAddTweak(const char*, U32*, U32, U32, const tweak_callback*, void*, U32); +void xDebugAddTweak(const char*, float*, float, float, const tweak_callback*, void*, unsigned int); + +void zNPCBPatrick::Reset() +{ + /* + signed int i; // r5 + class bossPatBox * bx; // r2 + */ + Pat_ResetGlobalStuff(); + + if (this->model) + { + if (this->model->Next) + { + if (this->model->Next->Next) + { + if (this->model->Next->Next->Next) + { + this->model->Next->Next->Next->Flags &= 0xfffe; + } + } + } + } + + sUseBossCam = 1; + sCurrHeight = f1137; + sCurrRadius = f1138; + sCurrPitch = f1139; + sCurrYaw = f1140; + zCameraDisableTracking(CO_BOSS); + sCamSubTarget = (xVec3*)&this->model->Mat->pos; + + this->bossFlags = 0x100; + gotoRound(this->round); + this->firstUpdate = true; + this->notSwingingLastFrame = true; + + S32 i = 0; + + for (i = 0; i < 50; i++) + { + this->glob[i].flags = 0; + } + + /* + for (S32 i = 2; i > 0; i++) + { + // this-> + } + */ + + this->currGlob = 0; + this->splatTimer = f832; + + for (i = 0; i < 6; i++) + { + bossPatBox* box = &this->box[0][i]; + + box->velocity = f832; + box->flags = 0; + box->pos = f1141 + this->box[0][i].minY; + } + + this->backBox.velocity = f832; + this->backBox.flags = 0; + this->backBox.pos = f1141 + (this->backBox.minY); + + this->chuckFlags[0] = 1; + this->chuckFlags[1] = 1; + this->chuckFlags[2] = 1; + + this->frozenTimer = f870; + + zEntPlayerControlOn(CONTROL_OWNER_FROZEN); + + this->csnTimer = f832; + this->nfFlags = 0; + + this->badHitTimer = f832; + this->numPCHitsInARow = 0; + this->numMissesInARow = 0; + + zNPCCommon::Reset(); + + if (this->psy_instinct) + { + this->psy_instinct->GoalSet(NPC_GOAL_BOSSPATIDLE, 0); + } + + minHMul = f1142; + minT = f1049; + minYVel = f1049; + varHMul = f832; + varT = f1049; + varYVel = f832; + + xDebugAddTweak("NPC|zNPCBPatrick|globs|minYVel", &minYVel, f1143, f1144, (tweak_callback*)0x0, + (void*)0x0, 0); + xDebugAddTweak("NPC|zNPCBPatrick|globs|varYVel", &varYVel, f1143, f1144, (tweak_callback*)0x0, + (void*)0x0, 0); + xDebugAddTweak("NPC|zNPCBPatrick|globs|minHMul", (float*)&minHMul, f1143, f1144, + (tweak_callback*)0x0, (void*)0x0, 0); + xDebugAddTweak("NPC|zNPCBPatrick|globs|varHMul", &varHMul, f1143, f1144, (tweak_callback*)0x0, + (void*)0x0, 0); + xDebugAddTweak("NPC|zNPCBPatrick|globs|minT", (float*)&minT, f1143, f1144, (tweak_callback*)0x0, + (void*)0x0, 0); + xDebugAddTweak("NPC|zNPCBPatrick|globs|varT", (float*)&varT, f1143, f1144, (tweak_callback*)0x0, + (void*)0x0, 0); + xDebugAddTweak("NPC|zNPCBPatrick|Newsfish", "Speak", (tweak_callback*)&newsfish_cb, (void*)0x0, + 0); + xDebugAddTweak("NPC|zNPCBPatrick|NewsfishComment", &sCurrNFSound, 0, 0x24, (tweak_callback*)0x0, + (void*)0x0, 0); +} + +void zNPCBPatrick::Destroy() +{ + if (this->frozenSB) + { + xModelInstanceFree(this->frozenSB); + this->frozenSB = NULL; + } + + if (this->frozenSBIce) + { + xModelInstanceFree(this->frozenSBIce); + this->frozenSBIce = NULL; + } + + zNPCCommon::Destroy(); +} + +U32 zNPCBPatrick::AnimPick(S32 rawgoal, en_NPC_GOAL_SPOT gspot, xGoal* goal) +{ + S32 index = -1; + U32 animId = 0; + + switch (rawgoal) + { + case NPC_GOAL_BOSSPATIDLE: + index = 1; + break; + case NPC_GOAL_BOSSPATTAUNT: + index = 3; + break; + case NPC_GOAL_BOSSPATHIT: + index = 7; + break; + case NPC_GOAL_BOSSPATSPIT: + { + S32 stage = ((zNPCGoalBossPatSpit*)rawgoal)->stage; + // animId = *(int*)(param_3 + 0x50); + if (stage == 0) + { + index = 0x20; + } + else if (stage == 1) + { + index = 0x21; + } + else if (stage == 2) + { + index = 0x22; + } + break; + } + case NPC_GOAL_BOSSPATRUN: + index = 4; + break; + case NPC_GOAL_BOSSPATSMACK: + index = 6; + break; + case NPC_GOAL_BOSSPATFREEZE: + index = 0x1c; + break; + case NPC_GOAL_BOSSPATSPAWN: + index = 0x23; + break; + case NPC_GOAL_BOSSPATSPIN: + { + S32 stage = ((zNPCGoalBossPatSpin*)rawgoal)->stage; + if (stage == 0) + { + index = 0x24; + } + else if (stage == 1) + { + index = 0x25; + } + else if (stage == 2) + { + index = 0x26; + } + else if (stage == 3) + { + index = 10; + } + else if (stage == 4) + { + index = 0x27; + } + else if (stage == 5) + { + index = 0x28; + } + else if (stage == 6) + { + index = 9; + } + break; + } + case NPC_GOAL_BOSSPATFUDGE: + { + S32 stage = ((zNPCGoalBossPatFudge*)rawgoal)->stage; + + if (((stage == 0) || (stage == 1)) || (stage == 2)) + { + index = 4; + } + else if ((stage == 3) || (stage == 4)) + { + index = 0x1d; + } + else if (stage == 5) + { + index = 0x1e; + } + else if (stage == 6) + { + index = 0x1f; + } + break; + } + default: + index = 1; + break; + } + + if (index > -1) + { + animId = g_hash_bossanim[index]; + } + + return animId; +} + +void zNPCBPatrick::Process(xScene* xscn, F32 dt) +{ + /* + signed int i; // r5 + signed int j; // r21 + signed int csn; // r17 + float fudgeRate; // r1 + float * swingY; // r4 + signed int shouldPlayIt; // r3 + float finalHeight; // r2 + class xModelInstance * tempModel; // r19 + float maxDist; // r28 + float numSnowflakes; // r27 + float currSize; // r26 + class xVec3 snowDir; // r29+0x170 + class xVec3 snowPos; // r29+0x160 + signed int numSamples; // r20 + float interp; // r25 + signed int numToEmit; // r19 + float theta; // r21 + float moveSplat; // r20 + float timeTillEnd; // r1 + class xCollis colls; // r29+0xF0 + unsigned int doDamage; // r20 + class xVec3 knockback; // r29+0x150 + signed int touchDamage; // r19 + class xCollis * coll; // r6 + class xCollis * cend; // r5 + class xVec3 bubbleVel; // r29+0x140 + unsigned int picker; // r2 + signed int num; // r17 + */ +} + +void zNPCBPatrick::DuploNotice(en_SM_NOTICES note, void* data) +{ + if (note != 1) + { + return; + } + + for (S32 i = 0; i < 3; i++) + { + if (this->chuckList[i] == (zNPCCommon*)data) + { + this->chuckFlags[i] |= 1; + } + } +} + +void zNPCBPatrick::Damage(en_NPC_DAMAGE_TYPE dmg_type, xBase* who, const xVec3* vec_hit) +{ + xVec3 toHit; + + if (dmg_type == DMGTYP_SIDE || dmg_type == DMGTYP_CRUISEBUBBLE || dmg_type == DMGTYP_BUBBOWL) + { + if (this->bossFlags & 4) + { + if (vec_hit) + { + xVec3Copy(&toHit, vec_hit); + } + else + { + xVec3Sub(&toHit, (xVec3*)&this->model->Mat->pos, + (xVec3*)&globals.player.ent.model->Mat->pos); + } + + toHit.y = f832; + + xVec3Normalize(&toHit, &toHit); + + if (xVec3Dot(&toHit, (xVec3*)&this->model->Mat->at) > f832) + { + this->bossFlags |= 8; + this->badHitTimer = f1054; + } + } + else if (this->badHitTimer < f832) + { + if (this->nfFlags & 4) + { + if (xrand() & 0x80 && this->round != 2) + { + this->newsfish->SpeakStart(sNFComment[24].soundID, 0, -1); + } + else + { + this->newsfish->SpeakStart(sNFComment[25].soundID, 0, -1); + } + } + else + { + if (this->round != 2) + { + this->newsfish->SpeakStart(sNFComment[24].soundID, 0, -1); + } + else + { + this->newsfish->SpeakStart(sNFComment[25].soundID, 0, -1); + } + + this->nfFlags |= 4; + } + this->badHitTimer = f1054; + } + } +} + +void zNPCBPatrick_GameIsPaused(zScene* scn) +{ + if (sPat_Ptr && sPat_Ptr->bossFlags & 0x100) + { + sPat_Ptr->bossFlags &= 0xfffffeff; + sPat_Ptr->hiddenByCutscene(); + } +} + +void zNPCBPatrick::RenderGlobs() +{ + /* + class xMat4x3 globMat; // r29+0xB0 + signed int i; // r29+0xA0 + */ +} + +void zNPCBPatrick::RenderFrozenPlayer() +{ + xMat4x3 globMat; + xVec3 player_pos; + + xVec3Copy(&player_pos, (xVec3*)&globals.player.ent.model->Mat->pos); + + player_pos.x = this->shakeAmp * isin(this->shakePhase) + player_pos.x; + player_pos.z = this->shakeAmp * icos(this->shakePhase) + player_pos.z; + + for (S32 i = 0; i < 10; i++) + { + if (this->shard[i].size > f832) + { + xMat3x3Rot(&globMat, &this->shard[i].rotVec, this->shard[i].ang); + xVec3Copy(&globMat.pos, &player_pos); + xMat3x3SMul(&globMat, &globMat, this->shard[i].size); + if (!iModelCull(this->shardModel, (RwMatrixTag*)&globMat)) + { + F32 ivar1 = f2006 * ((f831 - this->shard[i].maxSize) + this->shard[i].size); + iModelSetMaterialAlpha(this->shardModel, ivar1); + iModelRender(this->shardModel, (RwMatrix*)&globMat); + } + } + } + + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)5); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)6); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)1); + + if (this->frozenSB) + { + // I don't think Mat->right here is necessarily correct + // It looks like it should just be Mat + xMat4x3Copy((xMat4x3*)&this->frozenSB->Mat->right, + (xMat4x3*)&globals.player.ent.model->Mat->right); + xModelRender(this->frozenSB); + } + + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)5); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)2); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)0); + + if (this->frozenSBIce) + { + xMat4x3Copy((xMat4x3*)&this->frozenSBIce->Mat->right, + (xMat4x3*)&globals.player.ent.model->Mat->right); + xModelRender(this->frozenSBIce); + } +} + +void zNPCBPatrick::RenderExtra() +{ + zNPCCommon::RenderExtra(); + + _SDRenderState oldState = zRenderStateCurrent(); + + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)5); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)2); + + this->RenderGlobs(); + + if (this->bossFlags & 0x10) + { + this->RenderFrozenPlayer(); + } + + zRenderState(SDRS_Default); + zRenderState(oldState); +} + +void zNPCBPatrick::NewTime(xScene* xscn, F32 dt) +{ + // signed int i; // r20 +} + +S32 zNPCBPatrick::nextGoal() +{ + S32 nextgoal = 0; + + if (this->bossFlags & 0x100) + { + return NPC_GOAL_BOSSPATIDLE; + } + + if (this->bossFlags & 2) + { + return NPC_GOAL_BOSSPATTAUNT; + } + + nextgoal = this->task[this->currTask]; + this->currTask++; + + if (this->currTask >= this->numTasks) + { + this->currTask = 0; + } + + if (nextgoal == NPC_GOAL_BOSSPATSPAWN && !this->canSpawnChucks()) + { + nextgoal = this->nextGoal(); + } + + return nextgoal; +} + +// not in PS2 dwarf +bossPatGlob* zNPCBPatrick::getNextFreeGlob() +{ + bossPatGlob* glob = &this->glob[this->currGlob]; + + this->currGlob++; + + if (this->currGlob >= 50) + { + this->currGlob = 0; + } + + glob->flags = 1; + return glob; +} + +void zNPCBPatrick::playSplat(xVec3* pos) +{ + // float picker; // r2 +} + +U32 zNPCBPatrick::canSpawnChucks() +{ + U32 result = 0; + + for (S32 i = 0; i < 3; i++) + { + if (this->chuckFlags[i] & 1) + { + result = 1; + break; + } + } + + return result; +} + +void zNPCBPatrick::gotoRound(S32 num) +{ + this->round = num; + + switch (this->round) + { + case 1: + { + this->numTasks = 12; + this->task[0] = NPC_GOAL_BOSSPATIDLE; + this->task[1] = NPC_GOAL_BOSSPATSMACK; + this->task[2] = NPC_GOAL_BOSSPATIDLE; + this->task[3] = NPC_GOAL_BOSSPATSPIT; + this->task[4] = NPC_GOAL_BOSSPATIDLE; + this->task[5] = NPC_GOAL_BOSSPATSPIN; + this->task[6] = NPC_GOAL_BOSSPATIDLE; + this->task[7] = NPC_GOAL_BOSSPATSMACK; + this->task[8] = NPC_GOAL_BOSSPATIDLE; + this->task[9] = NPC_GOAL_BOSSPATSPIT; + this->task[10] = NPC_GOAL_BOSSPATIDLE; + this->task[11] = NPC_GOAL_BOSSPATSPIN; + this->currTask = 0; + this->hitPoints = 9; + this->gooLevel = 0; + this->gooHeight = this->gooLevel - f1046; + break; + } + case 2: + { + this->numTasks = 8; + this->task[0] = NPC_GOAL_BOSSPATIDLE; + this->task[1] = NPC_GOAL_BOSSPATSPIT; + this->task[2] = NPC_GOAL_BOSSPATIDLE; + this->task[3] = NPC_GOAL_BOSSPATSPIN; + this->task[4] = NPC_GOAL_BOSSPATIDLE; + this->task[5] = NPC_GOAL_BOSSPATSPIT; + this->task[6] = NPC_GOAL_BOSSPATIDLE; + this->task[7] = NPC_GOAL_BOSSPATSPIN; + this->currTask = 0; + this->hitPoints = 6; + this->gooLevel = 0; + this->gooHeight = this->gooLevel - f1046; + break; + } + case 3: + { + this->numTasks = 10; + this->task[0] = NPC_GOAL_BOSSPATIDLE; + this->task[1] = NPC_GOAL_BOSSPATFREEZE; + this->task[2] = NPC_GOAL_BOSSPATSPIT; + this->task[3] = NPC_GOAL_BOSSPATIDLE; + this->task[4] = NPC_GOAL_BOSSPATSPIN; + this->task[5] = NPC_GOAL_BOSSPATIDLE; + this->task[6] = NPC_GOAL_BOSSPATFREEZE; + this->task[7] = NPC_GOAL_BOSSPATSPIT; + this->task[8] = NPC_GOAL_BOSSPATIDLE; + this->task[9] = NPC_GOAL_BOSSPATSPIN; + this->currTask = 0; + this->hitPoints = 3; + this->gooLevel = 3; + break; + } + case 4: + { + zEntEvent(this, 36); + this->numTasks = 1; + this->task[0] = NPC_GOAL_BOSSPATIDLE; + this->currTask = 0; + this->hitPoints = 0; + this->gooLevel = 3; + break; + } + } +} + +// return type probably wrong. not in PS2 dwarf +void zNPCBPatrick::ConveyorTimeLeft(zPlatform* platform, xVec3* vec_unk) +{ +} + +void zNPCBPatrick::ParabolaHitsConveyors(xParabola* path, xCollis* colls) +{ + /* + signed int i; // r13 + signed int j; // r12 + class xMat4x3 * mat; // r11 + class xVec3 * lower; // r10 + class xVec3 * upper; // r9 + float a; // r10 + float b; // r9 + float det; // r4 + float t[2]; // r29+0x18 + float dispX; // r11 + float dispZ; // r8 + */ +} + +// return type probably wrong. not in PS2 dwarf +void zNPCBPatrick::bossPatBoxCheckCollide(bossPatBox* bx) +{ +} + +void zNPCBPatrick::bossPatBoxUpdate(bossPatBox* bx, F32 dt) +{ +} + +static S32 idleCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 tauntCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 hitCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 spitCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 runCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 smackCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} -void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) +static S32 freezeCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 spawnCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 spinCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ +} + +static S32 fudgeCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*) +{ + zNPCGoalBossPatFudge* fudge = (zNPCGoalBossPatFudge*)rawgoal; + zNPCBPatrick* pat = (zNPCBPatrick*)rawgoal->GetOwner(); + S32 nextgoal = 0; + + if (fudge->stage == 5 && globals.player.ControlOff & 0xffffbaff) + { + if (fudge->vomitSndID) + { + xSndStop(fudge->vomitSndID); + } + + *trantype = GOAL_TRAN_SET; + return NPC_GOAL_BOSSPATIDLE; + } + + if (fudge->stage == 6 && pat->AnimTimeRemain(NULL) < f2280 * dt) + { + nextgoal = pat->nextGoal(); + *trantype = GOAL_TRAN_SET; + } + + return nextgoal; +} + +void zNPCBPatrick::hiddenByCutscene() +{ + /* + signed int i; // r17 + class bossPatBox * bx; // r2 + class bossPatBox * bx; // r2 + */ +} + +void zNPCBPatrick_AddBoundEntsToGrid(zScene* scn) +{ + /* + signed int i; // r17 + class xEnt * ent; // r18 + */ +} + +static void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) { F32 x = m->right.x * v->x + m->up.x * v->y + m->at.x * v->z; F32 y = m->right.y * v->x + m->up.y * v->y + m->at.y * v->z; @@ -16,10 +1082,6 @@ void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) o->z = z; } -void Pat_ResetGlobalStuff() -{ -} - -void xDebugAddTweak(const char*, U32*, U32, U32, const tweak_callback*, void*, U32) +WEAK void xDebugAddTweak(const char*, U32*, U32, U32, const tweak_callback*, void*, U32) { } diff --git a/src/SB/Game/zNPCTypeBossPatrick.h b/src/SB/Game/zNPCTypeBossPatrick.h index dfb0b911..b392d97f 100644 --- a/src/SB/Game/zNPCTypeBossPatrick.h +++ b/src/SB/Game/zNPCTypeBossPatrick.h @@ -8,27 +8,34 @@ #include "zEntPickup.h" #include "xCamera.h" +#include "zNPCTypeVillager.h" -struct zNPCNewsFish; +class newsfishSound +{ + // total size: 0x8 +public: + char* soundName; // offset 0x0, size 0x4 + unsigned int soundID; // offset 0x4, size 0x4 +}; struct bossPatGlob { - xParabola path; - F32 t; - xVec3 lastPos; - xVec3 norm; - xVec3 convVel; - zPlatform* conv; - U32 flags; + xParabola path; // offset 0x0, size 0x24 + F32 t; // offset 0x24, size 0x4 + xVec3 lastPos; // offset 0x28, size 0xC + xVec3 norm; // offset 0x34, size 0xC + xVec3 convVel; // offset 0x40, size 0xC + zPlatform* conv; // offset 0x4C, size 0x4 + U32 flags; // offset 0x50, size 0x4 }; struct bossPatBox { xEnt* box; - F32 velocity; - F32 pos; - F32 minY; - U32 flags; + F32 velocity; // 0x1594 + F32 pos; // 0x1598 + F32 minY; // 0x159C + U32 flags; // 0x15A0 }; struct bossPatShard @@ -41,76 +48,101 @@ struct bossPatShard struct zNPCBPatrick : zNPCBoss { - U32 bossFlags; - S32 hitPoints; - S32 round; - F32 gooHeight; - S32 gooLevel; - S32 notSwingingLastFrame; - xEnt* gooObj; - RpAtomic* spitModel; - RpAtomic* splatModel; - xVec3 arenaExtent; - xVec3 fudgePos; - xVec3 fudgeFace; - S32 numTasks; - S32 currTask; - S32 task[20]; - bossPatGlob glob[50]; - S32 currGlob; - F32 splatTimer; - xEnt** boundList; - U32 chuckFlags[3]; - zNPCCommon* chuckList[3]; - zMovePoint* chuckMovePoint[3]; - xParEmitterCustomSettings freezeBreathSetting; - zParEmitter* freezeBreathEmitter; - xPar* parList[4]; - xPar* lastEmitted; - S32 numParticles; - F32 particleTimer; - F32 frozenTimer; - xAnimState* animState; - xAnimTransitionList* animTranList; - xEnt* fudgeHandle; - zParEmitter* fudgeEmitter; - zParEmitter* steamEmitter; - bossPatBox box[3][8]; - bossPatBox backBox; - zShrapnelAsset* boxBreak; - zShrapnelAsset* boxSplash; - F32 boxLandSndTimer; - F32 boxSplashSndTimer; - xEnt* swinger[8]; - S32 currSwinger; - F32 origSwingerHeight; - F32 swingTimer; - xModelInstance* frozenSB; - xModelInstance* frozenSBIce; - RpAtomic* shardModel; - bossPatShard shard[10]; - F32 iceScale; - F32 shakeAmp; - F32 shakePhase; - zShrapnelAsset* iceBreak; - RwRaster* iceWaveRaster; - zCutsceneMgr* round1Csn; - zCutsceneMgr* round2Csn; - zCutsceneMgr* round3Csn; - F32 csnTimer; - _zPortal* safeGroundPortal; - zNPCNewsFish* newsfish; - U32 nfFlags; - F32 badHitTimer; - S32 numPCHitsInARow; - S32 numMissesInARow; - S32 firstTimeR1Csn; - S32 firstUpdate; - zEntPickup* underwear[2]; - zPlatform* conveyorBelt[7]; + U32 bossFlags; // offset 0x2B4, size 0x4 + S32 hitPoints; // offset 0x2B8, size 0x4 + S32 round; // offset 0x2BC, size 0x4 + F32 gooHeight; // offset 0x2C0, size 0x4 + S32 gooLevel; // offset 0x2C4, size 0x4 + S32 notSwingingLastFrame; // offset 0x2C8, size 0x4 + xEnt* gooObj; // offset 0x2CC, size 0x4 + RpAtomic* spitModel; // offset 0x2D0, size 0x4 + RpAtomic* splatModel; // offset 0x2D4, size 0x4 + xVec3 arenaExtent; // offset 0x2D8, size 0xC + xVec3 fudgePos; // offset 0x2E4, size 0xC + xVec3 fudgeFace; // offset 0x2F0, size 0xC + S32 numTasks; // offset 0x2FC, size 0x4 + S32 currTask; // offset 0x300, size 0x4 + S32 task[20]; // offset 0x304, size 0x50 + bossPatGlob glob[50]; // offset 0x354, size 0x1068 + S32 currGlob; // offset 0x13BC, size 0x4 + F32 splatTimer; // offset 0x13C0, size 0x4 + xEnt** boundList; // offset 0x13C4, size 0x4 + U32 chuckFlags[3]; // offset 0x13C8, size 0xC + zNPCCommon* chuckList[3]; // offset 0x13D4, size 0xC + zMovePoint* chuckMovePoint[3]; // offset 0x13E0, size 0xC + xParEmitterCustomSettings freezeBreathSetting; // offset 0x13EC, size 0x16C + zParEmitter* freezeBreathEmitter; // offset 0x1558, size 0x4 + xPar* parList[4]; // offset 0x155C, size 0x10 + xPar* lastEmitted; // offset 0x156C, size 0x4 + S32 numParticles; // offset 0x1570, size 0x4 + F32 particleTimer; // offset 0x1574, size 0x4 + F32 frozenTimer; // offset 0x1578, size 0x4 + xAnimState* animState; // offset 0x157C, size 0x4 + xAnimTransitionList* animTranList; // offset 0x1580, size 0x4 + xEnt* fudgeHandle; // offset 0x1584, size 0x4 + zParEmitter* fudgeEmitter; // offset 0x1588, size 0x4 + zParEmitter* steamEmitter; // offset 0x158C, size 0x4 + bossPatBox box[3][8]; // offset 0x1590, size 0x1E0 + bossPatBox backBox; // offset 0x1770, size 0x14 + zShrapnelAsset* boxBreak; // offset 0x1784, size 0x4 + zShrapnelAsset* boxSplash; // offset 0x1788, size 0x4 + F32 boxLandSndTimer; // offset 0x178C, size 0x4 + F32 boxSplashSndTimer; // offset 0x1790, size 0x4 + xEnt* swinger[8]; // offset 0x1794, size 0x20 + S32 currSwinger; // offset 0x17B4, size 0x4 + F32 origSwingerHeight; // offset 0x17B8, size 0x4 + F32 swingTimer; // offset 0x17BC, size 0x4 + xModelInstance* frozenSB; // offset 0x17C0, size 0x4 + xModelInstance* frozenSBIce; // offset 0x17C4, size 0x4 + RpAtomic* shardModel; // offset 0x17C8, size 0x4 + bossPatShard shard[10]; // offset 0x17CC, size 0xF0 + F32 iceScale; // offset 0x18BC, size 0x4 + F32 shakeAmp; // offset 0x18C0, size 0x4 + F32 shakePhase; // offset 0x18C4, size 0x4 + zShrapnelAsset* iceBreak; // offset 0x18C8, size 0x4 + RwRaster* iceWaveRaster; // offset 0x18CC, size 0x4 + zCutsceneMgr* round1Csn; // offset 0x18D0, size 0x4 + zCutsceneMgr* round2Csn; // offset 0x18D4, size 0x4 + zCutsceneMgr* round3Csn; // offset 0x18D8, size 0x4 + F32 csnTimer; // offset 0x18DC, size 0x4 + _zPortal* safeGroundPortal; // offset 0x18E0, size 0x4 + zNPCNewsFish* newsfish; // offset 0x18E4, size 0x4 + U32 nfFlags; // offset 0x18E8, size 0x4 + F32 badHitTimer; // offset 0x18EC, size 0x4 + S32 numPCHitsInARow; // offset 0x18F0, size 0x4 + S32 numMissesInARow; // offset 0x18F4, size 0x4 + S32 firstTimeR1Csn; // offset 0x18F8, size 0x4 + S32 firstUpdate; // offset 0x18FC, size 0x4 + zEntPickup* underwear[2]; // offset 0x1900, size 0x8 + zPlatform* conveyorBelt[7]; // offset 0x1908, size 0x1C xBinaryCamera bossCam; zNPCBPatrick(S32 myType); + + void Init(xEntAsset* asset); + void Setup(); + void SelfSetup(); + void Reset(); + void Destroy(); + U32 AnimPick(S32 rawgoal, en_NPC_GOAL_SPOT gspot, xGoal* goal); + void Process(xScene* xscn, F32 dt); + void DuploNotice(en_SM_NOTICES note, void* data); + void Damage(en_NPC_DAMAGE_TYPE dmg_type, xBase* who, const xVec3* vec_hit); + + void RenderGlobs(); + void RenderFrozenPlayer(); + void RenderExtra(); + void NewTime(xScene* xscn, F32 dt); + S32 nextGoal(); + bossPatGlob* getNextFreeGlob(); // Not in PS2 DWARF + void playSplat(xVec3* pos); + U32 canSpawnChucks(); + void gotoRound(S32 num); + void ConveyorTimeLeft(zPlatform* platform, xVec3* vec_unk); // Not in PS2 DWARF + void ParabolaHitsConveyors(xParabola* parabola, xCollis* collis_unk); + void bossPatBoxCheckCollide(bossPatBox* bx); // Not in PS2 DWARF + void bossPatBoxUpdate(bossPatBox* bx, F32 dt); + void hiddenByCutscene(); }; struct zNPCGoalBossPatIdle : zNPCGoalCommon @@ -215,11 +247,11 @@ struct zNPCGoalBossPatSpin : zNPCGoalCommon struct zNPCGoalBossPatFudge : zNPCGoalCommon { - F32 timeInGoal; - U32 stage; - F32 lerp; - F32 globNum; - U32 vomitSndID; + F32 timeInGoal; // offset 0x4C, size 0x4 + U32 stage; // offset 0x50, size 0x4 + F32 lerp; // offset 0x54, size 0x4 + F32 globNum; // offset 0x58, size 0x4 + U32 vomitSndID; // offset 0x5C, size 0x4 zNPCGoalBossPatFudge(S32 goalID) : zNPCGoalCommon(goalID) { diff --git a/src/SB/Game/zNPCTypeBossSB1.cpp b/src/SB/Game/zNPCTypeBossSB1.cpp index ae153f91..e7b50bdc 100644 --- a/src/SB/Game/zNPCTypeBossSB1.cpp +++ b/src/SB/Game/zNPCTypeBossSB1.cpp @@ -302,7 +302,7 @@ void zNPCB_SB1::Init(xEntAsset* asset) SB1_ResetGlobalStuff(); } -static S32 idleCB(xGoal* rawgoal, void*, en_trantype* trantype, F32, void*); +static S32 idleCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); static S32 tauntCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); static S32 stompCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); static S32 smashCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*); diff --git a/src/SB/Game/zNPCTypeRobot.h b/src/SB/Game/zNPCTypeRobot.h index 7086e9b1..d9b53c0a 100644 --- a/src/SB/Game/zNPCTypeRobot.h +++ b/src/SB/Game/zNPCTypeRobot.h @@ -68,8 +68,8 @@ struct zNPCRobot : zNPCCommon zNPCRobot(S32); - S32 LaunchProjectile(en_npchaz haztyp, F32 spd_proj, F32 dst_minRange, - en_mdlvert idx_mvtx, F32 tym_predictMax, F32 hyt_offset); + S32 LaunchProjectile(en_npchaz haztyp, F32 spd_proj, F32 dst_minRange, en_mdlvert idx_mvtx, + F32 tym_predictMax, F32 hyt_offset); void ShowerConfetti(xVec3* pos); F32 MoveTowardsArena(F32 dt, F32 speed); void CornerOfArena(xVec3* pos_corner, F32 dst); @@ -79,8 +79,7 @@ struct zNPCRobot : zNPCCommon void InflictPain(S32 numHitPoints, S32 giveCreditToPlayer); void LassoNotify(en_LASSO_EVENT event); void SyncStunGlyph(F32 tmr_remain, F32 height); - void AddStunThrow(xPsyche* psy, - S32 (*eval_evilpat)(xGoal*, void*, en_trantype*, F32, void*), + void AddStunThrow(xPsyche* psy, S32 (*eval_evilpat)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_stunned)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_patcarry)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_patthrow)(xGoal*, void*, en_trantype*, F32, void*)); @@ -111,7 +110,7 @@ struct zNPCRobot : zNPCCommon void Process(xScene* xscn, F32 dt); void NewTime(xScene* xscn, F32 dt); S32 SysEvent(xBase* from, xBase* to, U32 toEvent, F32* toParam, xBase* toParamWidget, - S32* handled); + S32* handled); void CollideReview(); U8 PhysicsFlags() const; U8 ColPenFlags() const; @@ -244,6 +243,62 @@ struct zNPCChuck : zNPCRobot xVec3 dir_attack; zNPCChuck(S32 myType); + // 0x00000000; // 0x0 + // 0x00000000; // 0x4 + /* + Init(xEntAsset*); // 0x8 zNPCChuck + PostInit(); // 0xC xNPCBasic + Setup(); // 0x10 zNPCCommon + PostSetup(); // 0x14 xNPCBasic + Reset(); // 0x18 zNPCChuck + Process(xScene*, float); // 0x1C zNPCRobot + BUpdate(xVec3*); // 0x20 zNPCCommon + NewTime(xScene*, float); // 0x24 zNPCRobot + Move(xScene*, float, xEntFrame*); // 0x28 zNPCCommon + SysEvent(xBase*, xBase*, unsigned int, const float*, xBase*, int*); // 0x2C zNPCRobot + Render(); // 0x30 xNPCBasic + Save(xSerial*) const; // 0x34 xNPCBasic + Load(xSerial*); // 0x38 xNPCBasic + CollideReview(); // 0x3C zNPCRobot + ColChkFlags() const; // 0x40 zNPCRobot + ColPenFlags() const; // 0x44 zNPCRobot + ColChkByFlags() const; // 0x48 zNPCRobot + ColPenByFlags() const; // 0x4C zNPCRobot + PhysicsFlags() const; // 0x50 zNPCRobot + Destroy(); // 0x54 zNPCCommon + NPCMessage(NPCMsg*); // 0x58 zNPCRobot + RenderExtra(); // 0x5C zNPCCommon + RenderExtraPostParticles(); // 0x60 zNPCCommon + ParseINI(); // 0x64 zNPCChuck + ParseLinks(); // 0x68 zNPCCommon + ParseProps(); // 0x6C zNPCCommon + SelfSetup(); // 0x70 zNPCChuck + SelfDestroy(); // 0x74 zNPCCommon + IsHealthy(); // 0x78 zNPCRobot + IsAlive(); // 0x7C zNPCRobot + Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); // 0x80 zNPCCommon + Respawn(const xVec3*, zMovePoint*, zMovePoint*); // 0x84 zNPCCommon + DuploOwner(zNPCCommon*); // 0x88 zNPCRobot + DuploNotice(en_SM_NOTICES, void*); // 0x8C zNPCCommon + CanRope(); // 0x90 zNPCCommon + LassoNotify(en_LASSO_EVENT); // 0x94 zNPCRobot + SetCarryState(en_NPC_CARRY_STATE); // 0x98 zNPCRobot + Stun(float); // 0x9C zNPCRobot + SpeakBegin(); // 0xA0 zNPCCommon + SpeakEnd(); // 0xA4 zNPCCommon + SpeakStart(unsigned int, unsigned int, int); // 0xA8 zNPCCommon + SpeakStop(); // 0xAC zNPCCommon + AnimPick(int, en_NPC_GOAL_SPOT, xGoal*); // 0xB0 zNPCChuck + GetParm(en_npcparm, void*); // 0xB4 zNPCCommon + GetParmDefault(en_npcparm, void*); // 0xB8 zNPCCommon + GenShadCacheRad(); // 0xBC zNPCRobot + PRIV_GetDriverData(); // 0xC0 zNPCRobot + PRIV_GetLassoData(); // 0xC4 zNPCRobot + LassoSetup(); // 0xC8 zNPCRobot + RoboHandleMail(NPCMsg*); // 0xCC zNPCRobot + IsDying(); // 0xD0 zNPCRobot + LassoModelIndex(int*, int*); // 0xD4 zNPCChuck + */ }; enum en_tubestat diff --git a/src/SB/Game/zNPCTypeVillager.h b/src/SB/Game/zNPCTypeVillager.h index d8951f4c..d11341c9 100644 --- a/src/SB/Game/zNPCTypeVillager.h +++ b/src/SB/Game/zNPCTypeVillager.h @@ -89,7 +89,62 @@ struct zNPCNewsFish : zNPCVillager F32 screenLerp; zNPCNewsFish(S32 myType); - void SelfSetup(); + + // Vtable Information + // 0x00000000; // 0x0 + // 0x00000000; // 0x4 + void Init(xEntAsset*); // 0x8 zNPCNewsFish + void PostInit(); // 0xC xNPCBasic + void Setup(); // 0x10 zNPCCommon + void PostSetup(); // 0x14 zNPCNewsFish + void Reset(); // 0x18 zNPCNewsFish + void Process(xScene*, F32); // 0x1C zNPCNewsFish + void BUpdate(xVec3*); // 0x20 zNPCCommon + void NewTime(xScene*, F32); // 0x24 zNPCCommon + void Move(xScene*, F32, xEntFrame*); // 0x28 zNPCCommon + S32 SysEvent(xBase*, xBase*, U32, const F32*, xBase*, S32*); // 0x2C zNPCCommon + void Render(); // 0x30 zNPCNewsFish + void Save(xSerial*) const; // 0x34 xNPCBasic + void Load(xSerial*); // 0x38 xNPCBasic + void CollideReview(); // 0x3C zNPCVillager + U8 ColChkFlags() const; // 0x40 zNPCVillager + U8 ColPenFlags() const; // 0x44 zNPCVillager + U8 ColChkByFlags() const; // 0x48 zNPCVillager + U8 ColPenByFlags() const; // 0x4C zNPCVillager + U8 PhysicsFlags() const; // 0x50 zNPCVillager + void Destroy(); // 0x54 zNPCCommon + S32 NPCMessage(NPCMsg*); // 0x58 zNPCVillager + void RenderExtra(); // 0x5C zNPCCommon + void RenderExtraPostParticles(); // 0x60 zNPCCommon + void ParseINI(); // 0x64 zNPCVillager + void ParseLinks(); // 0x68 zNPCCommon + void ParseProps(); // 0x6C zNPCCommon + void SelfSetup(); // 0x70 zNPCNewsFish + void SelfDestroy(); // 0x74 zNPCCommon + S32 IsHealthy(); // 0x78 zNPCCommon + S32 IsAlive(); // 0x7C zNPCCommon + void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); // 0x80 zNPCCommon + S32 Respawn(const xVec3*, zMovePoint*, zMovePoint*); // 0x84 zNPCCommon + void DuploOwner(zNPCCommon*); // 0x88 zNPCCommon + void DuploNotice(en_SM_NOTICES, void*); // 0x8C zNPCCommon + S32 CanRope(); // 0x90 zNPCCommon + void LassoNotify(en_LASSO_EVENT); // 0x94 zNPCCommon + S32 SetCarryState(en_NPC_CARRY_STATE); // 0x98 zNPCCommon + void Stun(F32); // 0x9C zNPCCommon + void SpeakBegin(); // 0xA0 zNPCVillager + void SpeakEnd(); // 0xA4 zNPCVillager + void SpeakStart(U32 sndid, U32 sndhandle, S32 anim); // 0xA8 zNPCNewsFish + void SpeakStop(); // 0xAC zNPCNewsFish + U32 AnimPick(S32, en_NPC_GOAL_SPOT, xGoal*); // 0xB0 zNPCVillager + void GetParm(en_npcparm, void*); // 0xB4 zNPCCommon + void GetParmDefault(en_npcparm, void*); // 0xB8 zNPCCommon + F32 GenShadCacheRad(); // 0xBC zNPCVillager + xEntDrive* PRIV_GetDriverData(); // 0xC0 zNPCCommon + zNPCLassoInfo* PRIV_GetLassoData(); // 0xC4 zNPCCommon + S32 LassoSetup(); // 0xC8 zNPCCommon + void FolkHandleMail(NPCMsg*); // 0xCC zNPCVillager + + void TalkOnScreen(S32 talkOnScreen); }; struct zNPCNewsFishTV : zNPCVillager