From 779970b544ec0c9cbe09c3575a0eb2ba421fce5b Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 11 Mar 2025 20:47:04 -0400 Subject: [PATCH 01/20] zNPCSupport - added NPCSupport_Startup --- src/SB/Game/zNPCSupplement.h | 1 + src/SB/Game/zNPCSupport.cpp | 15 ++++++++++++++- src/SB/Game/zNPCSupport.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCSupplement.h b/src/SB/Game/zNPCSupplement.h index 02350575d..bdd2efaa5 100644 --- a/src/SB/Game/zNPCSupplement.h +++ b/src/SB/Game/zNPCSupplement.h @@ -107,6 +107,7 @@ struct StreakInfo }; void NPCC_MakeASplash(const xVec3* pos, F32 radius); +void NPCSupplement_Startup (); void NPCSupplement_Shutdown(); void NPAR_ScenePrepare(); void NPAR_SceneFinish(); diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 69b44fafd..8bd6e9c8f 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -8,6 +8,16 @@ #include "xMathInlines.h" +void NPCSupport_Startup() + +{ + zNPCHazard_Startup(); + zNPCGlyph_Startup(); + NPCWidget_Startup(); + NPCSupplement_Startup(); + return; +} + void NPCSupport_Shutdown() { zNPCHazard_Shutdown(); @@ -16,6 +26,9 @@ void NPCSupport_Shutdown() NPCSupplement_Shutdown(); } +void NPCWidget_Startup() +{ +} void NPCWidget_Shutdown() { } @@ -42,4 +55,4 @@ F32 NPCC_TmrCycle(float* tmr, float dt, float interval) } return parameterized; -} \ No newline at end of file +} diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index 74199baaa..da86ac444 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -46,6 +46,7 @@ struct NPCBlinker void Reset(); }; +void NPCWidget_Startup() ; void NPCWidget_Shutdown(); void NPCSupport_Startup(); void NPCSupport_ScenePrepare(); From 8ad094acfee2304e724771333f435d2b9896bfd8 Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 11 Mar 2025 20:58:48 -0400 Subject: [PATCH 02/20] clang format pass --- src/SB/Game/zNPCSupplement.h | 2 +- src/SB/Game/zNPCSupport.cpp | 16 ++++++++-------- src/SB/Game/zNPCSupport.h | 5 +++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/SB/Game/zNPCSupplement.h b/src/SB/Game/zNPCSupplement.h index bdd2efaa5..7856eac2c 100644 --- a/src/SB/Game/zNPCSupplement.h +++ b/src/SB/Game/zNPCSupplement.h @@ -107,7 +107,7 @@ struct StreakInfo }; void NPCC_MakeASplash(const xVec3* pos, F32 radius); -void NPCSupplement_Startup (); +void NPCSupplement_Startup(); void NPCSupplement_Shutdown(); void NPAR_ScenePrepare(); void NPAR_SceneFinish(); diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 8bd6e9c8f..ac21e005c 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -11,11 +11,11 @@ void NPCSupport_Startup() { - zNPCHazard_Startup(); - zNPCGlyph_Startup(); - NPCWidget_Startup(); - NPCSupplement_Startup(); - return; + zNPCHazard_Startup(); + zNPCGlyph_Startup(); + NPCWidget_Startup(); + NPCSupplement_Startup(); + return; } void NPCSupport_Shutdown() @@ -26,8 +26,8 @@ void NPCSupport_Shutdown() NPCSupplement_Shutdown(); } -void NPCWidget_Startup() -{ +void NPCWidget_Startup() +{ } void NPCWidget_Shutdown() { @@ -51,7 +51,7 @@ F32 NPCC_TmrCycle(float* tmr, float dt, float interval) if (*tmr > interval) { - *tmr = xfmod(*tmr,interval); + *tmr = xfmod(*tmr, interval); } return parameterized; diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index da86ac444..f8573a82b 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -46,7 +46,7 @@ struct NPCBlinker void Reset(); }; -void NPCWidget_Startup() ; +void NPCWidget_Startup(); void NPCWidget_Shutdown(); void NPCSupport_Startup(); void NPCSupport_ScenePrepare(); @@ -60,7 +60,8 @@ F32 NPCC_TmrCycle(float* tmr, float dt, float interval); xVec3* NPCC_rightDir(xEnt* ent); xVec3* NPCC_faceDir(xEnt* ent); 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_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*); From fd5746232d0d6210be3828bb0b32410fe972ed4f Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 11 Mar 2025 23:50:07 -0400 Subject: [PATCH 03/20] zNPCSupport - completed some functions --- src/SB/Game/zNPCSupplement.h | 5 ++ src/SB/Game/zNPCSupport.cpp | 91 ++++++++++++++++++++++++++++++++++++ src/SB/Game/zNPCSupport.h | 14 +++++- 3 files changed, 108 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCSupplement.h b/src/SB/Game/zNPCSupplement.h index 7856eac2c..38219ab51 100644 --- a/src/SB/Game/zNPCSupplement.h +++ b/src/SB/Game/zNPCSupplement.h @@ -109,6 +109,11 @@ struct StreakInfo void NPCC_MakeASplash(const xVec3* pos, F32 radius); void NPCSupplement_Startup(); void NPCSupplement_Shutdown(); +void NPCSupplement_ScenePrepare(); +void NPCSupplement_SceneFinish(); +void NPCSupplement_SceneReset(); +void NPCSupplement_ScenePostInit(); +void NPCSupplement_Timestep(F32 dt); void NPAR_ScenePrepare(); void NPAR_SceneFinish(); NPARMgmt* NPAR_PartySetup(en_nparptyp parType, void** userData, NPARXtraData* xtraData); diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index ac21e005c..17ed8c330 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -26,6 +26,56 @@ void NPCSupport_Shutdown() NPCSupplement_Shutdown(); } + +bool NPCSupport_ScenePrepare() +{ + zNPCHazard_ScenePrepare(); + zNPCGlyph_ScenePrepare(); + NPCWidget_ScenePrepare(); + NPCSupplement_ScenePrepare(); + Firework_ScenePrepare(); + return NPCC_ForceTalkOk(); +} + +void NPCSupport_SceneFinish() +{ + zNPCHazard_SceneFinish(); + zNPCGlyph_SceneFinish(); + NPCWidget_SceneFinish(); + NPCSupplement_SceneFinish(); + Firework_SceneFinish(); + return; +} + +void NPCSupport_ScenePostInit() +{ + zNPCHazard_ScenePostInit(); + zNPCGlyph_ScenePostInit(); + NPCWidget_ScenePostInit(); + NPCSupplement_ScenePostInit(); + zNPC_SNDInit(); + return; +} + +void NPCSupport_SceneReset() +{ + zNPCHazard_SceneReset(); + zNPCGlyph_SceneReset(); + NPCWidget_SceneReset(); + NPCSupplement_SceneReset(); + Firework_SceneReset(0); + return; +} + +void NPCSupport_Timestep(F32 dt) +{ + zNPCGlyph_Timestep(dt); + zNPCHazard_Timestep(dt); + NPCSupplement_Timestep(dt); + Firework_Timestep(dt); +} + + void NPCWidget_Startup() { } @@ -37,6 +87,47 @@ void NPCWidget_ScenePrepare() { } +void NPCWidget_SceneFinish() +{ +} + +void NPCWidget_SceneReset() +{ +} + +void NPCWidget_ScenePostInit() +{ +} + +void Firework_ScenePrepare() +{ + NPAR_PartySetup(NPAR_TYP_FIREWORKS, NULL, NULL); + Firework_SceneReset(0); +} + +void Firework_SceneFinish() +{ +} + +void Firework_SceneReset(int) +{ +} + +void Firework_Timestep(F32 dt) +{ +} + +bool NPCC_ForceTalkOk() +{ + return false; +} + +void zNPC_SNDInit() +{ +} + + + F32 NPCC_TmrCycle(float* tmr, float dt, float interval) { F32 parameterized; diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index f8573a82b..bd3d9fd29 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -46,17 +46,27 @@ struct NPCBlinker void Reset(); }; +bool NPCC_ForceTalkOk() ; void NPCWidget_Startup(); void NPCWidget_Shutdown(); +void NPCWidget_ScenePrepare(); +void NPCWidget_SceneFinish(); +void NPCWidget_SceneReset(); +void NPCWidget_ScenePostInit(); void NPCSupport_Startup(); -void NPCSupport_ScenePrepare(); +bool NPCSupport_ScenePrepare(); void NPCSupport_SceneFinish(); void NPCSupport_Timestep(F32 dt); void NPCSupport_SceneReset(); void NPCSupport_Shutdown(); void NPCSupport_ScenePostInit(); +void Firework_SceneReset(S32); +void Firework_ScenePrepare(); +void Firework_SceneFinish(); +void Firework_Timestep(F32 dt); +void zNPC_SNDInit(); S32 NPCC_LampStatus(); -F32 NPCC_TmrCycle(float* tmr, float dt, float interval); +F32 NPCC_TmrCycle(F32* tmr, F32 dt, F32 interval); xVec3* NPCC_rightDir(xEnt* ent); xVec3* NPCC_faceDir(xEnt* ent); void NPCC_ang_toXZDir(F32 angle, xVec3* dir); From c7b0c4cb6b85beec79d77ec3231d930a0d6ed761 Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 11 Mar 2025 23:52:56 -0400 Subject: [PATCH 04/20] clang pass --- src/SB/Game/zNPCSupport.cpp | 52 +++++++++++++++++-------------------- src/SB/Game/zNPCSupport.h | 2 +- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 17ed8c330..8dc7fc151 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -26,45 +26,44 @@ void NPCSupport_Shutdown() NPCSupplement_Shutdown(); } - bool NPCSupport_ScenePrepare() { - zNPCHazard_ScenePrepare(); - zNPCGlyph_ScenePrepare(); - NPCWidget_ScenePrepare(); - NPCSupplement_ScenePrepare(); - Firework_ScenePrepare(); - return NPCC_ForceTalkOk(); + zNPCHazard_ScenePrepare(); + zNPCGlyph_ScenePrepare(); + NPCWidget_ScenePrepare(); + NPCSupplement_ScenePrepare(); + Firework_ScenePrepare(); + return NPCC_ForceTalkOk(); } void NPCSupport_SceneFinish() { - zNPCHazard_SceneFinish(); - zNPCGlyph_SceneFinish(); - NPCWidget_SceneFinish(); - NPCSupplement_SceneFinish(); - Firework_SceneFinish(); - return; + zNPCHazard_SceneFinish(); + zNPCGlyph_SceneFinish(); + NPCWidget_SceneFinish(); + NPCSupplement_SceneFinish(); + Firework_SceneFinish(); + return; } void NPCSupport_ScenePostInit() { - zNPCHazard_ScenePostInit(); - zNPCGlyph_ScenePostInit(); - NPCWidget_ScenePostInit(); - NPCSupplement_ScenePostInit(); - zNPC_SNDInit(); - return; + zNPCHazard_ScenePostInit(); + zNPCGlyph_ScenePostInit(); + NPCWidget_ScenePostInit(); + NPCSupplement_ScenePostInit(); + zNPC_SNDInit(); + return; } void NPCSupport_SceneReset() { - zNPCHazard_SceneReset(); - zNPCGlyph_SceneReset(); - NPCWidget_SceneReset(); - NPCSupplement_SceneReset(); - Firework_SceneReset(0); - return; + zNPCHazard_SceneReset(); + zNPCGlyph_SceneReset(); + NPCWidget_SceneReset(); + NPCSupplement_SceneReset(); + Firework_SceneReset(0); + return; } void NPCSupport_Timestep(F32 dt) @@ -75,7 +74,6 @@ void NPCSupport_Timestep(F32 dt) Firework_Timestep(dt); } - void NPCWidget_Startup() { } @@ -126,8 +124,6 @@ void zNPC_SNDInit() { } - - F32 NPCC_TmrCycle(float* tmr, float dt, float interval) { F32 parameterized; diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index bd3d9fd29..115428388 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -46,7 +46,7 @@ struct NPCBlinker void Reset(); }; -bool NPCC_ForceTalkOk() ; +bool NPCC_ForceTalkOk(); void NPCWidget_Startup(); void NPCWidget_Shutdown(); void NPCWidget_ScenePrepare(); From 8c254f113bcc450e0521516472af38b1de7c06b6 Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:44:47 -0400 Subject: [PATCH 05/20] 2 rwrasters --- src/SB/Game/zNPCSupport.cpp | 24 ++++++++++++++++++++++++ src/SB/Game/zNPCSupport.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 8dc7fc151..de26c843a 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -120,6 +120,30 @@ bool NPCC_ForceTalkOk() return false; } +RwRaster* NPCC_FindRWRaster(const char* txtrname) +{ + RwTexture* txtr = NPCC_FindRWTexture(txtrname); + if (txtr != NULL) + { + return txtr->raster; + } + return NULL; +} + +RwTexture* NPCC_FindRWTexture(const char*) +{ + return NULL; +} + +RwRaster* NPCC_FindRWRaster(RwTexture* txtr) +{ + if (txtr != NULL) + { + return txtr->raster; + } + return NULL; +} + void zNPC_SNDInit() { } diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index 115428388..c30bd99ce 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -64,6 +64,10 @@ void Firework_SceneReset(S32); void Firework_ScenePrepare(); void Firework_SceneFinish(); void Firework_Timestep(F32 dt); +RwTexture* NPCC_FindRWTexture(U32 hashid); +RwTexture* NPCC_FindRWTexture(const char* txtrname); +RwRaster* NPCC_FindRWRaster(const char* txtrname); +RwRaster* NPCC_FindRWRaster(RwTexture* txtr); void zNPC_SNDInit(); S32 NPCC_LampStatus(); F32 NPCC_TmrCycle(F32* tmr, F32 dt, F32 interval); From b80600eb65fe575b8e12c163bd0beda5f841ae53 Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:58:06 -0400 Subject: [PATCH 06/20] more changes --- src/SB/Game/zNPCSupport.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index de26c843a..90c325f0b 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -105,6 +105,7 @@ void Firework_ScenePrepare() void Firework_SceneFinish() { + Firework_SceneReset(1); } void Firework_SceneReset(int) From f33d36221b13d8d5df337fbbab558f2cbf018166 Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Wed, 12 Mar 2025 23:28:50 -0400 Subject: [PATCH 07/20] worked through npcwidget_scenereset and npcwidget_startup --- src/SB/Game/zNPCSupport.cpp | 11 +++++++++-- src/SB/Game/zNPCSupport.h | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 90c325f0b..546cb8d89 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -9,7 +9,6 @@ #include "xMathInlines.h" void NPCSupport_Startup() - { zNPCHazard_Startup(); zNPCGlyph_Startup(); @@ -76,7 +75,9 @@ void NPCSupport_Timestep(F32 dt) void NPCWidget_Startup() { + g_hash_uiwidgets[0] = xStrHash((const char*)g_strz_uiwidgets); } + void NPCWidget_Shutdown() { } @@ -87,9 +88,15 @@ void NPCWidget_ScenePrepare() void NPCWidget_SceneFinish() { + NPCWidget_SceneReset(); +} + +void NPCWidget_SceneReset() // Come back after more data is in +{ + g_npc_widgets->Reset(); } -void NPCWidget_SceneReset() +void NPCWidget::Reset() { } diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index c30bd99ce..d6a889fb7 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -25,6 +25,11 @@ enum _tageNPCSnd eNPCSnd_Total }; +enum en_NPC_UI_WIDGETS +{ + NPC_UI_WIDGETS_unk // Come back after more data is put in +}; + struct NPCTarget { en_npctgt typ_target; @@ -46,13 +51,29 @@ struct NPCBlinker void Reset(); }; +struct NPCWidget +{ + en_NPC_UI_WIDGETS idxID; + xBase* base_widge; + zNPCCommon* npc_ownerlock; + + U32 NPCIsTheLocker(zNPCCommon* npc_lock); + U32 IsVisible(); + U32 Off(zNPCCommon* npc, U32 theman); + U32 On(zNPCCommon* npc, U32 theman); + void Reset(); +}; + bool NPCC_ForceTalkOk(); void NPCWidget_Startup(); +static U32 g_hash_uiwidgets[1]; +static char* g_strz_uiwidgets[1] = {}; void NPCWidget_Shutdown(); void NPCWidget_ScenePrepare(); void NPCWidget_SceneFinish(); void NPCWidget_SceneReset(); void NPCWidget_ScenePostInit(); +NPCWidget g_npc_widgets[1] = {}; void NPCSupport_Startup(); bool NPCSupport_ScenePrepare(); void NPCSupport_SceneFinish(); From 3d070afa80f4260add3151b5fd77231a9f31a47e Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Wed, 12 Mar 2025 23:37:07 -0400 Subject: [PATCH 08/20] ficed the nonbuilding --- src/SB/Game/zNPCSupport.cpp | 4 ++++ src/SB/Game/zNPCSupport.h | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SB/Game/zNPCSupport.cpp b/src/SB/Game/zNPCSupport.cpp index 546cb8d89..8d5e43ce3 100644 --- a/src/SB/Game/zNPCSupport.cpp +++ b/src/SB/Game/zNPCSupport.cpp @@ -8,6 +8,10 @@ #include "xMathInlines.h" +NPCWidget g_npc_widgets[1] = {}; +static U32 g_hash_uiwidgets[1]; +static char* g_strz_uiwidgets[1] = {}; + void NPCSupport_Startup() { zNPCHazard_Startup(); diff --git a/src/SB/Game/zNPCSupport.h b/src/SB/Game/zNPCSupport.h index d6a889fb7..e10cd9bab 100644 --- a/src/SB/Game/zNPCSupport.h +++ b/src/SB/Game/zNPCSupport.h @@ -66,14 +66,11 @@ struct NPCWidget bool NPCC_ForceTalkOk(); void NPCWidget_Startup(); -static U32 g_hash_uiwidgets[1]; -static char* g_strz_uiwidgets[1] = {}; void NPCWidget_Shutdown(); void NPCWidget_ScenePrepare(); void NPCWidget_SceneFinish(); void NPCWidget_SceneReset(); void NPCWidget_ScenePostInit(); -NPCWidget g_npc_widgets[1] = {}; void NPCSupport_Startup(); bool NPCSupport_ScenePrepare(); void NPCSupport_SceneFinish(); From a5031b45d33896d3fb8b1ed064f4ff32a75fa5f0 Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Thu, 13 Mar 2025 02:34:48 -0400 Subject: [PATCH 09/20] Multiple simple exit functions and others --- src/SB/Game/zNPCTypeDutchman.cpp | 60 ++++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeDutchman.h | 15 +++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 232977380..db6a368f0 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -4,6 +4,10 @@ #include +namespace +{ +} + 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; @@ -15,6 +19,22 @@ void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) o->z = z; } +void zNPCDutchman::Setup() +{ + zNPCSubBoss::Setup(); +} + +void zNPCDutchman::Destroy() +{ + zNPCCommon::Destroy(); + dutchman_count--; +} + +void zNPCDutchman::Render() +{ + zNPCDutchman::render_debug(); +} + void zNPCDutchman::render_debug() { } @@ -27,6 +47,46 @@ void zNPCDutchman::add_splash(const xVec3&, float) { } +void zNPCDutchman::vanish() +{ +} + +void zNPCDutchman::reset_speed() +{ +} + +//S32 zNPCGoalDutchmanInitiate::Exit(F32 dt, void* updCtxt) +//{ +// owner; +// return xGoal::Exit(dt, updCtxt); +//} + +S32 zNPCGoalDutchmanIdle::Exit(F32 dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalDutchmanDisappear::Exit(F32 dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalDutchmanTeleport::Exit(F32 dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalDutchmanReappear::Exit(F32 dt, void* updCtxt) +{ + owner.reset_speed(); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalDutchmanBeam::Exit(F32 dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + U8 zNPCDutchman::PhysicsFlags() const { return 3; diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index b5f383126..c4cdc06ea 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -137,9 +137,14 @@ struct zNPCDutchman : zNPCSubBoss RwRaster* laser_raster; zNPCDutchman(S32 myType); + void Setup(); + void Destroy(); + void Render(); void render_debug(); void update_animation(float); void add_splash(const xVec3&, float); + void vanish(); + void reset_speed(); U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; @@ -155,6 +160,7 @@ struct zNPCGoalDutchmanNil : zNPCGoalCommon struct zNPCGoalDutchmanInitiate : zNPCGoalCommon { zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -162,6 +168,7 @@ struct zNPCGoalDutchmanInitiate : zNPCGoalCommon struct zNPCGoalDutchmanIdle : zNPCGoalCommon { zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -169,6 +176,7 @@ struct zNPCGoalDutchmanIdle : zNPCGoalCommon struct zNPCGoalDutchmanDisappear : zNPCGoalCommon { zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -176,6 +184,7 @@ struct zNPCGoalDutchmanDisappear : zNPCGoalCommon struct zNPCGoalDutchmanTeleport : zNPCGoalCommon { zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -183,6 +192,8 @@ struct zNPCGoalDutchmanTeleport : zNPCGoalCommon struct zNPCGoalDutchmanReappear : zNPCGoalCommon { zNPCDutchman& owner; + S32 Exit(float, void*); + void reset_speed(); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -215,7 +226,7 @@ struct zNPCGoalDutchmanBeam : zNPCGoalCommon S32 shots; beam_data beam[2]; zNPCDutchman& owner; - + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -280,5 +291,7 @@ struct zNPCGoalDutchmanDeath : zNPCGoalCommon }; xAnimTable* ZNPC_AnimTable_Dutchman(); +U32 dutchman_count; +void Exit(); #endif From 7aa4b6fb37dfeb33c1993f9762696d8c60322b6d Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Thu, 13 Mar 2025 16:15:35 -0400 Subject: [PATCH 10/20] completed functions and added some mem offsets --- src/SB/Core/x/xBehaviour.h | 2 +- src/SB/Game/zNPCSndTable.h | 12 +++++----- src/SB/Game/zNPCTypeCommon.h | 21 ++++++++--------- src/SB/Game/zNPCTypeDutchman.cpp | 39 ++++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeDutchman.h | 26 ++++++++++++++++----- src/SB/Game/zNPCTypeSubBoss.h | 4 ++-- 6 files changed, 78 insertions(+), 26 deletions(-) diff --git a/src/SB/Core/x/xBehaviour.h b/src/SB/Core/x/xBehaviour.h index b878f6517..0db2b7249 100644 --- a/src/SB/Core/x/xBehaviour.h +++ b/src/SB/Core/x/xBehaviour.h @@ -215,7 +215,7 @@ struct xGoal : xListItem, xFactoryInst virtual S32 Process(en_trantype* trantype, float dt, void* ctxt, xScene* scene); virtual S32 SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget, S32* handled) + xBase* toParamWidget, S32* handled) { return 1; } diff --git a/src/SB/Game/zNPCSndTable.h b/src/SB/Game/zNPCSndTable.h index ed89a46c3..717d41611 100644 --- a/src/SB/Game/zNPCSndTable.h +++ b/src/SB/Game/zNPCSndTable.h @@ -43,13 +43,13 @@ struct NPCSndTrax U32 aid_sound; }; -struct NPCSndQueue +struct NPCSndQueue //0x14 { - U32 sndDirect; - en_NPC_SOUND sndtype; - S32 flg_snd; - F32 tmr_delay; - F32 radius; + U32 sndDirect; //0x0 + en_NPC_SOUND sndtype; //0x4 + S32 flg_snd; //0x8 + F32 tmr_delay; //0xC + F32 radius; //0x10 }; void NPCS_Startup(); diff --git a/src/SB/Game/zNPCTypeCommon.h b/src/SB/Game/zNPCTypeCommon.h index 1cb628024..3e7a5d806 100644 --- a/src/SB/Game/zNPCTypeCommon.h +++ b/src/SB/Game/zNPCTypeCommon.h @@ -363,7 +363,7 @@ struct zNPCLassoInfo xModelInstance* grabGuideModel; }; -struct zNPCCommon : xNPCBasic +struct zNPCCommon : xNPCBasic //Size of zNPCCommon: 0x2A0 { xEntAsset* entass; // 0x1BC xEntNPCAsset* npcass; // 0x1C0 @@ -388,11 +388,11 @@ struct zNPCCommon : xNPCBasic S32 flg_xtrarend; F32 tmr_fidget; F32 tmr_invuln; // 0x23C - zShrapnelAsset* explosion; - xModelAssetParam* parmdata; - U32 pdatsize; - zNPCLassoInfo* lassdata; - NPCSndQueue snd_queue[4]; + zShrapnelAsset* explosion; // 0x240 + xModelAssetParam* parmdata; // 0x244 + U32 pdatsize; //0x248 + zNPCLassoInfo* lassdata; //0x24C + NPCSndQueue snd_queue[4]; //0x250 zNPCCommon(S32 myType); @@ -436,8 +436,7 @@ struct zNPCCommon : xNPCBasic S32 LassoUseGuides(S32 idx_grabmdl, S32 idx_holdmdl); S32 GetVertPos(en_mdlvert vid, xVec3* pos); void Vibrate(en_npcvibe vibe, F32 duration); - void AddScripting(xPsyche* psy, - S32 (*eval_script)(xGoal*, void*, en_trantype*, F32, void*), + void AddScripting(xPsyche* psy, S32 (*eval_script)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_playanim)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_attack)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_move)(xGoal*, void*, en_trantype*, F32, void*), @@ -488,7 +487,7 @@ struct zNPCCommon : xNPCBasic virtual void NewTime(xScene* xscn, F32 dt); virtual void Move(xScene* xscn, F32 dt, xEntFrame*); virtual S32 SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget, S32* handled); + xBase* toParamWidget, S32* handled); virtual void CollideReview(); virtual void Destroy(); @@ -642,8 +641,8 @@ void ZNPC_Common_Shutdown(); void NPCC_BuildStandardAnimTran(xAnimTable* table, char** namelist, S32* ourAnims, S32 idx_dflt, F32 blend); -xAnimTable * ZNPC_AnimTable_Common(); -xAnimTable * ZNPC_AnimTable_LassoGuide(); +xAnimTable* ZNPC_AnimTable_Common(); +xAnimTable* ZNPC_AnimTable_LassoGuide(); S32 NPCC_NPCIsConversing(); void zNPCCommon_EjectPhlemOnPawz(); U32 xSndIsPlaying(U32 assetID, U32 parid); diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index db6a368f0..56a0ae46d 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -6,6 +6,7 @@ namespace { + delay_goal sequence[16][3]; } void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) @@ -35,6 +36,19 @@ void zNPCDutchman::Render() zNPCDutchman::render_debug(); } +void zNPCDutchman::Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*) +{ + xPsyche* psy = this->psy_instinct; + psy->GIDOfActive(); +} + +// double zNPCDutchman::goal_delay() +// { +// move_info* tempR4; +// tempR4 = &this->move; +// move = *tempR4; +// } + void zNPCDutchman::render_debug() { } @@ -43,10 +57,18 @@ void zNPCDutchman::update_animation(float) { } +void zNPCDutchman::stop_hand_trail() +{ +} + void zNPCDutchman::add_splash(const xVec3&, float) { } +void zNPCDutchman::stop_flames() +{ +} + void zNPCDutchman::vanish() { } @@ -87,6 +109,23 @@ S32 zNPCGoalDutchmanBeam::Exit(F32 dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } +S32 zNPCGoalDutchmanFlame::Exit(F32 dt, void* updCtxt) +{ + S32 tempR0; + tempR0 = this->owner.flg_vuln; + tempR0 = tempR0 &= 0xFEFFFFFF; + this->owner.flg_vuln = tempR0; + + owner.stop_flames(); + owner.stop_hand_trail(); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalDutchmanCaught::Exit(float dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + U8 zNPCDutchman::PhysicsFlags() const { return 3; diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index c4cdc06ea..a8302f4fa 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -4,6 +4,8 @@ #include "zNPCTypeSubBoss.h" #include "zNPCGoalCommon.h" #include "containers.h" +#include "xBehaviour.h" +#include "zNPCTypeCommon.h" struct zNPCDutchman : zNPCSubBoss { @@ -80,11 +82,11 @@ struct zNPCDutchman : zNPCSubBoss move_enum move; fade_enum fade; } flag; - S32 life; - S32 round; - S32 stage; - F32 delay; - F32 alpha; + S32 life; //0x2B4 + S32 round; //0x2B8 + S32 stage; //0x2BC + F32 delay; //0x2C0 + F32 alpha; //0x2C4 struct { xVec2 dir; @@ -92,7 +94,7 @@ struct zNPCDutchman : zNPCSubBoss F32 accel; F32 max_vel; } turn; - move_info move; + move_info move; //0x2C8 struct { U8 moreFlags; @@ -145,6 +147,10 @@ struct zNPCDutchman : zNPCSubBoss void add_splash(const xVec3&, float); void vanish(); void reset_speed(); + void stop_flames(); + void stop_hand_trail(); + void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); + double goal_delay(); U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; @@ -244,6 +250,7 @@ struct zNPCGoalDutchmanFlame : zNPCGoalCommon xVec2 move_dir; U8 stopped; zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -259,6 +266,7 @@ struct zNPCGoalDutchmanCaught : zNPCGoalCommon { U8 grabbed; zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -271,6 +279,12 @@ struct zNPCGoalDutchmanDamage : zNPCGoalCommon static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; +struct delay_goal +{ + U32 goal; + F32 delay; +}; + struct zNPCGoalDutchmanDeath : zNPCGoalCommon { enum substate_enum diff --git a/src/SB/Game/zNPCTypeSubBoss.h b/src/SB/Game/zNPCTypeSubBoss.h index b46649270..a597c5375 100644 --- a/src/SB/Game/zNPCTypeSubBoss.h +++ b/src/SB/Game/zNPCTypeSubBoss.h @@ -4,9 +4,9 @@ #include "zNPCTypeCommon.h" #include "zNPCSupport.h" -struct zNPCSubBoss : zNPCCommon +struct zNPCSubBoss : zNPCCommon //Size of zNPCSubBoss: 0x2B4 { - NPCTarget tgt_cur; + NPCTarget tgt_cur; //0x2A0 zNPCSubBoss(S32 myType); From 8097de9057318d50e9fac07fbc42e0369c042cca Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Thu, 13 Mar 2025 16:41:55 -0400 Subject: [PATCH 11/20] 2nd try --- src/SB/Game/zNPCTypeDutchman.cpp | 1 - src/SB/Game/zNPCTypeDutchman.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index fcfd783bb..fb441e0a1 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -64,7 +64,6 @@ void zNPCDutchman::add_splash(const xVec3&, float) { } - void zNPCDutchman::stop_flames() { } diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index 9e7d96029..c8459a764 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -146,7 +146,10 @@ struct zNPCDutchman : zNPCSubBoss void update_animation(float); void add_splash(const xVec3&, float); void vanish(); + void stop_flames(); + void stop_hand_trail(); void reset_speed(); + void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; From d671a0056af391030d673f5f0f2a327cb69e2203 Mon Sep 17 00:00:00 2001 From: Livewire <87439290+LivewireCB@users.noreply.github.com> Date: Sat, 15 Mar 2025 03:00:04 -0400 Subject: [PATCH 12/20] functions and updated mem offsets --- src/SB/Game/zNPCTypeDutchman.cpp | 45 ++++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeDutchman.h | 24 ++++++++++------- 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index fb441e0a1..9de1acf89 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -56,20 +56,65 @@ void zNPCDutchman::update_animation(float) { } +void zNPCDutchman::start_eye_glow() //Matches but the data is fucked +{ + flag.eye_glow = true; + eye_glow.size = 1; +} + +void zNPCDutchman::stop_eye_glow() +{ + flag.eye_glow = false; +} + void zNPCDutchman::stop_hand_trail() { + flag.hand_trail = false; } void zNPCDutchman::add_splash(const xVec3&, float) { } +void zNPCDutchman::start_beam() +{ + if ((flag.beaming) != 0) + { + return; + } + flag.beaming = 1; + flag.was_beaming = 0; + beam[1].segments = 0; //0x54C + beam[0].segments = 0; //0x430 + + //Could also write as: + + //for (S32 i = 1; i >= 0; --i) + // { + // beam[i].segments = 0; + // } +} + +void zNPCDutchman::stop_beam() +{ + flag.beaming = false; +} + void zNPCDutchman::stop_flames() { + flag.flaming = false; } void zNPCDutchman::vanish() { + old.moreFlags = moreFlags; + pflags = 0; + moreFlags = 0; + flags2.flg_colCheck = 0; + flags2.flg_penCheck = 0; + chkby = 0; + penby = 0; + xEntHide(this); } void zNPCDutchman::reset_speed() diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index c8459a764..74e5fafad 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -78,7 +78,7 @@ struct zNPCDutchman : zNPCSubBoss bool hurting; bool flaming; bool eye_glow; - bool hand_trail; + bool hand_trail; //0x2bb move_enum move; fade_enum fade; } flag; @@ -97,20 +97,20 @@ struct zNPCDutchman : zNPCSubBoss move_info move; //0x2C8 struct { - U8 moreFlags; + U8 moreFlags; //0x31c?? } old; - beam_info beam[2]; - static_queue waves; + beam_info beam[2]; //Needed for start_beam func + static_queue waves; //Needed for start_beam func struct { - F32 size; - F32 time; - S32 emitted; + F32 size; //0x56c + F32 time; //0x570 + S32 emitted; //0x574 U8 splash_break; xVec3 splash_loc; U8 blob_break; xVec3 blob_loc; - F32 imax_dist; + F32 imax_dist; //0x598 xMat3x3 blob_mat; } flames; struct @@ -123,7 +123,7 @@ struct zNPCDutchman : zNPCSubBoss F32 duration; F32 iduration; xVec3 sound_loc; - U32 sound_handle; + U32 sound_handle; //0x5fc } fade; struct { @@ -133,7 +133,7 @@ struct zNPCDutchman : zNPCSubBoss } slime; struct { - F32 size; + F32 size; //0x62C } eye_glow; zNPCLassoInfo lasso_info; RwRaster* laser_raster; @@ -146,10 +146,14 @@ struct zNPCDutchman : zNPCSubBoss void update_animation(float); void add_splash(const xVec3&, float); void vanish(); + void start_beam(); + void stop_beam(); void stop_flames(); void stop_hand_trail(); void reset_speed(); void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); + void start_eye_glow(); + void stop_eye_glow(); U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; From 7179a0f80fab573b0f8c3e9ab8ca31f844a10f7b Mon Sep 17 00:00:00 2001 From: Livewire Date: Sat, 15 Mar 2025 23:22:31 -0400 Subject: [PATCH 13/20] completed functions and updated mem offsets --- src/SB/Core/x/containers.h | 1 + src/SB/Core/x/xEnt.h | 2 +- src/SB/Game/zNPCTypeDutchman.cpp | 46 ++++++++++++++++++++++++++++++-- src/SB/Game/zNPCTypeDutchman.h | 17 ++++++++---- 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/SB/Core/x/containers.h b/src/SB/Core/x/containers.h index f584cb2af..58773407f 100644 --- a/src/SB/Core/x/containers.h +++ b/src/SB/Core/x/containers.h @@ -38,6 +38,7 @@ template struct static_queue U32 _max_size; U32 _max_size_mask; T* _buffer; + void clear(); }; template struct fixed_queue diff --git a/src/SB/Core/x/xEnt.h b/src/SB/Core/x/xEnt.h index 602b38524..29fd66791 100644 --- a/src/SB/Core/x/xEnt.h +++ b/src/SB/Core/x/xEnt.h @@ -127,7 +127,7 @@ struct xEnt : xBase // Offset: 0x10 xEntAsset* asset; - U16 idx; + U16 idx; //0x14 U16 num_updates; // Offset: 0x18 diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 9de1acf89..af73bdc13 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -6,7 +6,10 @@ namespace { -} + void kill_sound(S32 a, U32 b) + { + } +} // namespace void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) { @@ -48,6 +51,12 @@ void zNPCDutchman::Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*) // move = *tempR4; // } +S32 zNPCDutchman::LassoSetup() +{ + zNPCCommon::LassoUseGuides(1, 1); + zNPCCommon::LassoSetup(); +} + void zNPCDutchman::render_debug() { } @@ -56,6 +65,11 @@ void zNPCDutchman::update_animation(float) { } +void zNPCDutchman::kill_wave(zNPCDutchman::wave_data& wave) +{ + kill_sound(1, wave.sound_handle); +} + void zNPCDutchman::start_eye_glow() //Matches but the data is fucked { flag.eye_glow = true; @@ -100,6 +114,17 @@ void zNPCDutchman::stop_beam() flag.beaming = false; } +void zNPCDutchman::start_flames() +{ + //static_queue::clear(); + flag.flaming = true; + flames.time = 0.0; + flames.emitted = 0; + flames.blob_break = 1; + flames.splash_break = 1; + slime.slices.clear(); +} + void zNPCDutchman::stop_flames() { flag.flaming = false; @@ -117,16 +142,28 @@ void zNPCDutchman::vanish() xEntHide(this); } +void zNPCDutchman::reappear() +{ + moreFlags = old.moreFlags; + xNPCBasic::RestoreColFlags(); + xEntShow(this); +} + void zNPCDutchman::reset_speed() { } //S32 zNPCGoalDutchmanInitiate::Exit(F32 dt, void* updCtxt) //{ -// owner; // return xGoal::Exit(dt, updCtxt); //} +S32 zNPCGoalDutchmanIdle::Enter(F32 dt, void* updCtxt) +{ + owner.face_player(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + S32 zNPCGoalDutchmanIdle::Exit(F32 dt, void* updCtxt) { return xGoal::Exit(dt, updCtxt); @@ -194,3 +231,8 @@ U8 zNPCDutchman::ColChkFlags() const { return 0; } + +WEAK void zNPCDutchman::face_player() +{ + flag.face_player = true; +} diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index 74e5fafad..61f017fcb 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -76,7 +76,7 @@ struct zNPCDutchman : zNPCSubBoss bool beaming; bool was_beaming; bool hurting; - bool flaming; + bool flaming; //0x2b9 bool eye_glow; bool hand_trail; //0x2bb move_enum move; @@ -97,10 +97,10 @@ struct zNPCDutchman : zNPCSubBoss move_info move; //0x2C8 struct { - U8 moreFlags; //0x31c?? + U8 moreFlags; //0x31c } old; - beam_info beam[2]; //Needed for start_beam func - static_queue waves; //Needed for start_beam func + beam_info beam[2]; + static_queue waves; struct { F32 size; //0x56c @@ -108,7 +108,7 @@ struct zNPCDutchman : zNPCSubBoss S32 emitted; //0x574 U8 splash_break; xVec3 splash_loc; - U8 blob_break; + U8 blob_break; //0x588 xVec3 blob_loc; F32 imax_dist; //0x598 xMat3x3 blob_mat; @@ -144,14 +144,20 @@ struct zNPCDutchman : zNPCSubBoss void Render(); void render_debug(); void update_animation(float); + void kill_wave(zNPCDutchman::wave_data&); void add_splash(const xVec3&, float); void vanish(); + void reappear(); + void face_player(); void start_beam(); void stop_beam(); + void start_flames(); void stop_flames(); void stop_hand_trail(); + void reset_lasso_anim(); void reset_speed(); void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); + S32 LassoSetup(); void start_eye_glow(); void stop_eye_glow(); U8 PhysicsFlags() const; @@ -177,6 +183,7 @@ struct zNPCGoalDutchmanInitiate : zNPCGoalCommon struct zNPCGoalDutchmanIdle : zNPCGoalCommon { zNPCDutchman& owner; + S32 Enter(float, void*); S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); From 912f798e4099c5aee7985d837f8d1c3fd11a7449 Mon Sep 17 00:00:00 2001 From: Livewire Date: Sat, 15 Mar 2025 23:35:51 -0400 Subject: [PATCH 14/20] funcs and mem offsets --- src/SB/Game/zNPCTypeDutchman.cpp | 9 --------- src/SB/Game/zNPCTypeDutchman.h | 12 ------------ 2 files changed, 21 deletions(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index ce1296992..af73bdc13 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -65,14 +65,11 @@ void zNPCDutchman::update_animation(float) { } -<<<<<<< HEAD void zNPCDutchman::kill_wave(zNPCDutchman::wave_data& wave) { kill_sound(1, wave.sound_handle); } -======= ->>>>>>> main void zNPCDutchman::start_eye_glow() //Matches but the data is fucked { flag.eye_glow = true; @@ -117,7 +114,6 @@ void zNPCDutchman::stop_beam() flag.beaming = false; } -<<<<<<< HEAD void zNPCDutchman::start_flames() { //static_queue::clear(); @@ -129,8 +125,6 @@ void zNPCDutchman::start_flames() slime.slices.clear(); } -======= ->>>>>>> main void zNPCDutchman::stop_flames() { flag.flaming = false; @@ -146,7 +140,6 @@ void zNPCDutchman::vanish() chkby = 0; penby = 0; xEntHide(this); -<<<<<<< HEAD } void zNPCDutchman::reappear() @@ -154,8 +147,6 @@ void zNPCDutchman::reappear() moreFlags = old.moreFlags; xNPCBasic::RestoreColFlags(); xEntShow(this); -======= ->>>>>>> main } void zNPCDutchman::reset_speed() diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index 8977638f1..ac3bc8e79 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -97,11 +97,7 @@ struct zNPCDutchman : zNPCSubBoss move_info move; //0x2C8 struct { -<<<<<<< HEAD U8 moreFlags; //0x31c -======= - U8 moreFlags; //0x31c?? ->>>>>>> main } old; beam_info beam[2]; //Needed for start_beam func static_queue waves; //Needed for start_beam func @@ -151,25 +147,17 @@ struct zNPCDutchman : zNPCSubBoss void kill_wave(zNPCDutchman::wave_data&); void add_splash(const xVec3&, float); void vanish(); -<<<<<<< HEAD void reappear(); void face_player(); void start_beam(); void stop_beam(); void start_flames(); -======= - void start_beam(); - void stop_beam(); ->>>>>>> main void stop_flames(); void stop_hand_trail(); void reset_lasso_anim(); void reset_speed(); void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); -<<<<<<< HEAD S32 LassoSetup(); -======= ->>>>>>> main void start_eye_glow(); void stop_eye_glow(); U8 PhysicsFlags() const; From 71d460e789532b422c635bd6f8e5cda8c6993345 Mon Sep 17 00:00:00 2001 From: Livewire Date: Sat, 15 Mar 2025 23:38:41 -0400 Subject: [PATCH 15/20] funcs and mem offsets --- src/SB/Game/zNPCTypeDutchman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index af73bdc13..046fdf5b7 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -10,7 +10,7 @@ namespace { } } // namespace - +//dummy text for pushing 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; From 9c10cbdc81b32b8c8a9497125132975f451679b4 Mon Sep 17 00:00:00 2001 From: Livewire Date: Sun, 16 Mar 2025 01:14:53 -0400 Subject: [PATCH 16/20] register_tweak is at 42% --- src/SB/Game/zEntCruiseBubble.cpp | 1 + src/SB/Game/zNPCTypePrawn.cpp | 202 +++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypePrawn.h | 102 ++++++++++++++++ 3 files changed, 305 insertions(+) diff --git a/src/SB/Game/zEntCruiseBubble.cpp b/src/SB/Game/zEntCruiseBubble.cpp index 6f50f0457..d4f9dfaef 100644 --- a/src/SB/Game/zEntCruiseBubble.cpp +++ b/src/SB/Game/zEntCruiseBubble.cpp @@ -1753,6 +1753,7 @@ void cruise_bubble::tweak_group::register_tweaks(bool init, xModelAssetParam* ap { if (init) { + this->aim_delay; this->aim_delay = zEntCruiseBubble_f_0_2; auto_tweak::load_param(this->aim_delay, 1.0f, zEntCruiseBubble_f_0_0, 1.0f, ap, apsize, "aim_delay"); diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 44bfc85f4..52661b151 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -2,6 +2,208 @@ #include +namespace +{ + sound_data_type sound_data[4]; + U32 sound_asset_ids[6][4]; + + struct tweak_group + { + F32 turn_accel; + F32 spawn_delay; + F32 repel_radius; + struct + { + range_type pattern; + } safe; + struct + { + range_type pattern; + F32 state_delay; // 0x1c + F32 transition_delay; + } begin; + struct + { + F32 delay[3]; + range_type pattern; + F32 state_delay; + F32 transition_delay; + F32 exhaust_vel; + F32 knock_back; + struct + { + S32 amount[3]; + F32 arc; + F32 delay; + F32 accel; + F32 max_vel; + } sweep; + fire_type fire; + } beam; + _class_7 aim_lane; + _class_14 lane; + _class_25 danger; + sound_property sound[4]; + void* context; + tweak_callback cb_sound; + tweak_callback cb_sound_asset; + + void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize); + }; // namespace tweak_group +} // namespace + +/* + +TODO: 42%, needs quite a bit of work still. +Thought this function was going to be an easy copy/paste like other register_tweak fn, +but turning out to be harder to decipher than I anticipated so leaving it like this for now. +*/ +void tweak_group::register_tweaks(bool init, xModelAssetParam* ap, U32 apsize) +{ + if (init) + { + this->sound[0].volume = 0; + auto_tweak::load_param(this->sound[0].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO1"); + } + + if (init) + { + this->sound[0].range_inner = 0; + auto_tweak::load_param(this->sound[0].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO2"); + } + if (init) + { + this->sound[0].range_outer = 0; + auto_tweak::load_param(this->sound[0].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO3"); + } + + if (init) + { + this->sound[0].delay = 0; + auto_tweak::load_param(this->sound[0].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO4"); + } + if (init) + { + this->sound[1].volume = 0; + auto_tweak::load_param(this->sound[1].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "TODo5"); + } + if (init) + { + this->sound[1].range_inner = 0; + auto_tweak::load_param(this->sound[1].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "TODo6"); + } + + if (init) + { + this->sound[1].range_outer = 0; + auto_tweak::load_param(this->sound[1].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "todo7"); + } + if (init) + { + this->sound[1].delay = 0; + auto_tweak::load_param(this->sound[1].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo8"); + } + if (init) + { + this->sound[2].volume = 0; + auto_tweak::load_param(this->sound[2].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "todo9"); + } + if (init) + { + this->sound[2].range_inner = 0; + auto_tweak::load_param(this->sound[2].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "todo10"); + } + + if (init) + { + this->sound[2].range_outer = 0; + auto_tweak::load_param(this->sound[2].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "todo11"); + } + if (init) + { + this->sound[2].delay = 0; + auto_tweak::load_param(this->sound[2].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo12"); + } + if (init) + { + this->sound[3].volume = 0; + auto_tweak::load_param(this->sound[3].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "todo13"); + } + if (init) + { + this->sound[3].range_inner = 0; + auto_tweak::load_param(this->sound[3].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "todo14"); + } + + if (init) + { + this->sound[3].range_outer = 0; + auto_tweak::load_param(this->sound[3].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "todo15"); + } + if (init) + { + this->sound[3].delay = 0; + auto_tweak::load_param(this->sound[3].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo16"); + } + + if (init) + { + this->sound[3].delay = 0; + auto_tweak::load_param(this->sound[3].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo17"); + } + + if (init) + { + sound_data[0].volume = sound[0].volume; + sound_data[0].id = sound_asset_ids[0][0] = xStrHash("TES1"); + } + if (init) + { + sound_data[1].volume = sound[1].volume; + sound_data[1].id = sound_asset_ids[0][1] = xStrHash("TES2"); + } + if (init) + { + sound_data[2].volume = sound[2].volume; + sound_data[2].id = sound_asset_ids[0][2] = xStrHash("TES3"); + } + if (init) + { + sound_data[3].volume = sound[3].volume; + sound_data[3].id = sound_asset_ids[0][3] = xStrHash("TES4"); + } + + /* + *(undefined4 *)(param_1 + 0x1ac) = sound_asset_ids__27@unnamed@zNPCTypePrawn_cpp@; + sound_data__27@unnamed@zNPCTypePrawn_cpp@ = + xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 0x1ac) * 4]); + *(undefined4 *)(param_1 + 0x1c4) = DAT_80329548; + DAT_803295b0 = xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 0x1c4) * 4]); + *(undefined4 *)(param_1 + 0x1dc) = DAT_80329560; + DAT_803295c0 = xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 0x1dc) * 4]); + *(undefined4 *)(param_1 + 500) = DAT_80329578; + DAT_803295d0 = xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 500) * 4]); + } + */ +} + void zNPCPrawn::render_debug() { } diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index cc52d5821..5743a69a8 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -7,6 +7,108 @@ #include "zNPCSpawner.h" #include "containers.h" +struct sound_data_type +{ + U32 id; + U32 handle; + xVec3* loc; + F32 volume; +}; + +struct range_type +{ + S32 min; + S32 max; +}; + +struct _class_5 +{ + F32 size; + F32 alpha; + F32 vel; + F32 accel; + F32 emit_delay; + F32 grow; + F32 fade_dist; + F32 kill_dist; + F32 follow; + F32 hit_radius; + xVec3 hit_offset; +}; + +struct config_0 +{ + F32 duration; + S32 sound_interval; + _class_5 ring; +}; + +struct _class_8 +{ + S32 first; + S32 range; + S32 offset; + S32 size; +}; + +struct _class_7 +{ + F32 duration; + F32 state_delay; + F32 transition_delay; + _class_8 pattern; +}; + +struct _class_18 +{ + S32 first; + S32 range; + S32 offset; + S32 size; +}; + +struct _class_25 +{ + F32 state_delay; + F32 transition_delay; + F32 cycle_delay; // 0x100 + S32 pattern_offset; + S32 pattern_size; + range_type pattern[20]; +}; + +struct sound_property +{ + U32 asset; + F32 volume; + F32 range_inner; + F32 range_outer; + F32 delay; + F32 fade_time; +}; + +struct _class_14 +{ + F32 duration[3]; + F32 state_delay; + F32 transition_delay; + _class_18 pattern; +}; + +struct fire_type : config_0 +{ + S32 emit_bone; + xVec3 offset; + F32 yaw; + F32 pitch; +}; + +namespace auto_tweak +{ + template + void load_param(T1&, T2, T2, T2, xModelAssetParam*, U32, const char*); +}; + struct aqua_beam { struct config From bbc5d9a2b16360b3aa63813c3d4eea95f043ead9 Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 17 Mar 2025 01:42:17 -0400 Subject: [PATCH 17/20] couple of decent sized functions. did zNPCPrawn::SelfSetup() and updated some memory offsets --- src/SB/Core/x/containers.h | 1 + src/SB/Game/zDiscoFloor.h | 1 + src/SB/Game/zNPCTypePrawn.cpp | 102 ++++++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypePrawn.h | 43 +++++++++----- 4 files changed, 133 insertions(+), 14 deletions(-) diff --git a/src/SB/Core/x/containers.h b/src/SB/Core/x/containers.h index 58773407f..05b894acf 100644 --- a/src/SB/Core/x/containers.h +++ b/src/SB/Core/x/containers.h @@ -51,6 +51,7 @@ template struct fixed_queue void push_front(const T& element); bool full() const; void pop_back(); + bool empty() const; }; #endif diff --git a/src/SB/Game/zDiscoFloor.h b/src/SB/Game/zDiscoFloor.h index 36f812a29..3b06d5e4a 100644 --- a/src/SB/Game/zDiscoFloor.h +++ b/src/SB/Game/zDiscoFloor.h @@ -42,6 +42,7 @@ struct z_disco_floor : xBase bool glow_culled; } flag; z_disco_floor_asset* asset; + U8** state_masks; U8* active_state_mask; U8* next_state_mask; diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 52661b151..dcec200e8 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -204,14 +204,116 @@ void tweak_group::register_tweaks(bool init, xModelAssetParam* ap, U32 apsize) */ } +void aqua_beam::reset() // I don't know whats wrong here. Probably a simple error +{ + firing = 0; + bool bvar; + + while (true) + { + bvar = ring.queue.empty(); + if (bvar) + break; + aqua_beam::kill_ring(); + } + ring_sounds = 0; + + // Ghidra output + // bool bVar1; + // *(undefined *)(param_1 + 0x3c) = 0; + // while( true ) { + // bVar1 = empty__42fixed_queue<>CFv((int *)(param_1 + 0xa4)); + // if (bVar1) break; + // kill_ring__9aqua_beamFv(param_1); + // } + // *(undefined4 *)(param_1 + 0xf54) = 0; + // return; +} + +void aqua_beam::start() //100% code match, data does not match +{ + firing = 1; + time = 0; + ring.emit_time = 0; +} + +void aqua_beam::stop() +{ + firing = 0; +} + +void aqua_beam::render() +{ +} + +void zNPCPrawn::NewTime(xScene* xscn, float dt) +{ + zNPCCommon::NewTime(xscn, dt); + zNPCPrawn::render_closeup(); +} + +void zNPCPrawn::SelfSetup() +{ + xBehaveMgr* bmgr; + xPsyche* psy; + + bmgr = xBehaveMgr_GetSelf(); + psy_instinct = bmgr->Subscribe(this, 0); + psy = psy_instinct; + psy->BrainBegin(); + psy->AddGoal(NPC_GOAL_PRAWNIDLE, NULL); + psy->AddGoal(NPC_GOAL_PRAWNBEAM, NULL); + psy->AddGoal(NPC_GOAL_PRAWNBOWL, NULL); + psy->AddGoal(NPC_GOAL_PRAWNDAMAGE, NULL); + psy->AddGoal(NPC_GOAL_PRAWNDEATH, NULL); + psy->AddGoal(NPC_GOAL_LIMBO, NULL); + psy->BrainEnd(); + psy->SetSafety(NPC_GOAL_PRAWNIDLE); +} + void zNPCPrawn::render_debug() { } +void zNPCPrawn::Render() +{ + xNPCBasic::Render(); + isCulled = 0; + beam.render(); + zNPCPrawn::render_debug(); +} + void zNPCPrawn::update_particles(float) { } +void zNPCPrawn::apply_pending() +{ + pending.change = 0; + disco->set_state_range(pending.pattern.min, pending.pattern.max, SM_NPC_DEAD); + disco->set_transition_delay(pending.transition_delay); + disco->set_state_delay(pending.state_delay); +} + +// void zNPCPrawn::vanish() //Didn't figure out how to finish it +// { +// //0x18 is "flags" +// pflags = 0; //0x1b +// moreFlags = 0; //0x1c +// chkby = 0; //0x22 +// penby = 0; //0x23 +// flags2.flg_colCheck = 0; //0xf0 +// flags2.flg_penCheck = 0; // 0xf1 +// } + +void zNPCPrawn::reappear() +{ +} + +void zNPCPrawn::render_closeup() +{ +} + void xDebugAddTweak(const char*, xVec3*, const tweak_callback*, void*, U32) { } diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index 5743a69a8..e681ff0b2 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -3,9 +3,11 @@ #include "zNPCTypeSubBoss.h" #include "zNPCGoalCommon.h" +#include "zNPCGoals.h" #include "zDiscoFloor.h" #include "zNPCSpawner.h" #include "containers.h" +#include "xBehaviour.h" struct sound_data_type { @@ -122,7 +124,7 @@ struct aqua_beam F32 vel; F32 accel; F32 emit_delay; - F32 grow; + F32 grow; //0x1c F32 fade_dist; F32 kill_dist; F32 follow; @@ -153,16 +155,16 @@ struct aqua_beam }; config cfg; - U8 firing; + U8 firing; //0x3c xVec3 loc; xVec3 dir; xMat4x3 mat; - F32 time; + F32 time; //0x98 struct { RpAtomic* model_data; - F32 emit_time; - fixed_queue queue; + F32 emit_time; //0xa0 + fixed_queue queue; //0xa4 } ring; struct { @@ -170,7 +172,12 @@ struct aqua_beam F32 alpha; F32 scale; } squiggle; - S32 ring_sounds; + S32 ring_sounds; //0xf54 + void reset(); + void start(); + void stop(); + bool kill_ring(); + void render(); }; struct zNPCPrawn : zNPCSubBoss @@ -187,22 +194,22 @@ struct zNPCPrawn : zNPCSubBoss struct range_type { - S32 min; - S32 max; + S32 min; //0x304 + S32 max; //0x308 }; struct { } flag; - S32 life; - S32 round; + S32 life; //0x2b8 + S32 round; //0x2bc U8 face_player; xVec2 look_dir; z_disco_floor* disco; zNPCSpawner* spawner[3]; - U32 danger_mask; + U32 danger_mask; //0x2dc floor_state_enum floor_state; - S32 floor_state_index; + S32 floor_state_index; //0x2e4 U32 floor_state_counter; F32 floor_time; F32 delay; @@ -210,9 +217,9 @@ struct zNPCPrawn : zNPCSubBoss U8 fighting; struct { - U8 change; + U8 change; //0x2f8 floor_state_enum floor_state; - U32 counter; + U32 counter; //0x300 range_type pattern; F32 transition_delay; F32 state_delay; @@ -235,7 +242,15 @@ struct zNPCPrawn : zNPCSubBoss zNPCPrawn(S32 myType); void render_debug(); + void Render(); void update_particles(float); + void NewTime(xScene*, float); + void SelfSetup(); + void apply_pending(); + void vanish(); + void reappear(); + void render_closeup(); + void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; From bf4eaa19adf56155923d0d4d0bfaff5cd46b60a8 Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 17 Mar 2025 14:59:15 -0400 Subject: [PATCH 18/20] more funcs --- src/SB/Core/x/xListItem.h | 3 +- src/SB/Game/zNPCTypePrawn.cpp | 67 +++++++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypePrawn.h | 14 ++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/SB/Core/x/xListItem.h b/src/SB/Core/x/xListItem.h index ff2d4598f..6e0fe9a4a 100644 --- a/src/SB/Core/x/xListItem.h +++ b/src/SB/Core/x/xListItem.h @@ -9,7 +9,8 @@ template struct xListItem T* next; T* prev; - xListItem() { + xListItem() + { flg_travFilter = 0; prev = NULL; next = NULL; diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index dcec200e8..e9df26b21 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -283,6 +283,14 @@ void zNPCPrawn::Render() zNPCPrawn::render_debug(); } +void zNPCPrawn::update_round() +{ +} + +void zNPCPrawn::decompose() +{ +} + void zNPCPrawn::update_particles(float) { } @@ -295,6 +303,10 @@ void zNPCPrawn::apply_pending() disco->set_state_delay(pending.state_delay); } +void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum, bool, bool) +{ +} + // void zNPCPrawn::vanish() //Didn't figure out how to finish it // { // //0x18 is "flags" @@ -314,10 +326,65 @@ void zNPCPrawn::render_closeup() { } +void zNPCGoalPrawnBeam::update_aim(float dt) //Needs clrlwi and cntlzw to be finished +{ + zNPCPrawn& prawn = *((zNPCPrawn*)this->psyche->clt_owner); + prawn.turning(); +} + +S32 zNPCGoalPrawnDamage::Enter(float dt, void* updCtxt) +{ + zNPCPrawn& prawn = *(zNPCPrawn*)psyche->clt_owner; + prawn.set_floor_state(prawn.FS_DANGER, false, false); + zNPCGoalCommon::Enter(dt, updCtxt); +} + +// S32 zNPCGoalPrawnBowl::Enter(float dt, void* updCtxt) +// { +// zNPCPrawn& prawn = *(zNPCPrawn*)psyche->clt_owner; +// prawn.set_floor_state(prawn.FS_DANGER, false, false); +// zNPCGoalCommon::Enter(dt, updCtxt); +// } + +S32 zNPCGoalPrawnBowl::Exit(float dt, void* updCtxt) +{ + zNPCPrawn& prawn = *(zNPCPrawn*)psyche->clt_owner; + prawn.set_floor_state(prawn.FS_BEGIN, true, false); + xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalPrawnDamage::Exit(float dt, void* updCtxt) +{ + zNPCPrawn& prawn = *(zNPCPrawn*)this->psyche->clt_owner; + prawn.update_round(); + xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalPrawnDeath::Enter(float dt, void* updCtxt) +{ + zNPCPrawn& prawn = *(zNPCPrawn*)this->psyche->clt_owner; + prawn.decompose(); + zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalPrawnDeath::Exit(float dt, void* updCtxt) +{ + xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalPrawnDeath::Process(en_trantype* trantype, float dt, void* updCtxt, xScene* xscn) +{ + xGoal::Process(trantype, dt, updCtxt, xscn); +} + void xDebugAddTweak(const char*, xVec3*, const tweak_callback*, void*, U32) { } +void zNPCPrawn::turning() const +{ +} + U8 zNPCPrawn::PhysicsFlags() const { return 3; diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index e681ff0b2..20234ed29 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -250,7 +250,12 @@ struct zNPCPrawn : zNPCSubBoss void vanish(); void reappear(); void render_closeup(); + void turning() const; + void update_round(); + void decompose(); + void set_floor_state(zNPCPrawn::floor_state_enum, bool, bool); void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); + U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; @@ -281,6 +286,7 @@ struct zNPCGoalPrawnBeam : zNPCGoalCommon F32 sweep_dir; F32 delay; + void update_aim(float); zNPCGoalPrawnBeam(S32 goalID) : zNPCGoalCommon(goalID) { } @@ -289,6 +295,8 @@ struct zNPCGoalPrawnBeam : zNPCGoalCommon struct zNPCGoalPrawnBowl : zNPCGoalCommon { U8 aiming; + S32 Enter(float, void*); + S32 Exit(float, void*); zNPCGoalPrawnBowl(S32 goalID) : zNPCGoalCommon(goalID) { @@ -297,6 +305,9 @@ struct zNPCGoalPrawnBowl : zNPCGoalCommon struct zNPCGoalPrawnDamage : zNPCGoalCommon { + S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn); + S32 Exit(float dt, void* updCtxt); + S32 Enter(F32 dt, void* updCtxt); zNPCGoalPrawnDamage(S32 goalID) : zNPCGoalCommon(goalID) { } @@ -304,6 +315,9 @@ struct zNPCGoalPrawnDamage : zNPCGoalCommon struct zNPCGoalPrawnDeath : zNPCGoalCommon { + S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn); + S32 Exit(float dt, void* updCtxt); + S32 Enter(F32 dt, void* updCtxt); zNPCGoalPrawnDeath(S32 goalID) : zNPCGoalCommon(goalID) { } From 6706c58bface6e6a7df667e4bd1a00d829be612b Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 17 Mar 2025 15:11:50 -0400 Subject: [PATCH 19/20] push fix --- src/SB/Game/zNPCTypePrawn.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index 634bb726a..d439458a3 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -113,10 +113,13 @@ namespace auto_tweak struct sound_data_type { - U32 id; - U32 handle; - xVec3* loc; - F32 volume; + union + { + U32 id; + U32 handle; + xVec3* loc; + F32 volume; + }; }; struct range_type From aab8617728955004bc102cf6422b64c0e314dcee Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 17 Mar 2025 15:28:23 -0400 Subject: [PATCH 20/20] pr fix 2 --- src/SB/Game/zNPCTypePrawn.h | 102 ------------------------------------ 1 file changed, 102 deletions(-) diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index d439458a3..290e2e82b 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -9,108 +9,6 @@ #include "containers.h" #include "xBehaviour.h" -struct sound_data_type -{ - U32 id; - U32 handle; - xVec3* loc; - F32 volume; -}; - -struct range_type -{ - S32 min; - S32 max; -}; - -struct _class_5 -{ - F32 size; - F32 alpha; - F32 vel; - F32 accel; - F32 emit_delay; - F32 grow; - F32 fade_dist; - F32 kill_dist; - F32 follow; - F32 hit_radius; - xVec3 hit_offset; -}; - -struct config_0 -{ - F32 duration; - S32 sound_interval; - _class_5 ring; -}; - -struct _class_8 -{ - S32 first; - S32 range; - S32 offset; - S32 size; -}; - -struct _class_7 -{ - F32 duration; - F32 state_delay; - F32 transition_delay; - _class_8 pattern; -}; - -struct _class_18 -{ - S32 first; - S32 range; - S32 offset; - S32 size; -}; - -struct _class_25 -{ - F32 state_delay; - F32 transition_delay; - F32 cycle_delay; // 0x100 - S32 pattern_offset; - S32 pattern_size; - range_type pattern[20]; -}; - -struct sound_property -{ - U32 asset; - F32 volume; - F32 range_inner; - F32 range_outer; - F32 delay; - F32 fade_time; -}; - -struct _class_14 -{ - F32 duration[3]; - F32 state_delay; - F32 transition_delay; - _class_18 pattern; -}; - -struct fire_type : config_0 -{ - S32 emit_bone; - xVec3 offset; - F32 yaw; - F32 pitch; -}; - -namespace auto_tweak -{ - template - void load_param(T1&, T2, T2, T2, xModelAssetParam*, U32, const char*); -}; - struct sound_data_type { union