From 84864747d4a387c726b39e5aaf52c97894cf3d92 Mon Sep 17 00:00:00 2001 From: TotallyNotMichael-GH Date: Sat, 1 Feb 2025 19:31:01 -0500 Subject: [PATCH 1/5] Match zNPCGoalJellyAttack::Enter(float, void*) My first Function in god knows how long. --- src/SB/Game/zNPCGoalAmbient.cpp | 13 ++++++++++++- src/SB/Game/zNPCGoalAmbient.h | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCGoalAmbient.cpp b/src/SB/Game/zNPCGoalAmbient.cpp index 74c6ffd12..71bf8d427 100644 --- a/src/SB/Game/zNPCGoalAmbient.cpp +++ b/src/SB/Game/zNPCGoalAmbient.cpp @@ -2,8 +2,8 @@ #include "xMath3.h" #include "xVec3.h" - #include "zNPCGoalAmbient.h" +#include "zNPCSndTable.h" void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) { @@ -15,3 +15,14 @@ void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) o->y = y; o->z = z; } + +S32 zNPCGoalJellyAttack::Enter(F32 arg0, void* arg1) +{ + zNPCJelly* temp_r31 = (zNPCJelly*)psyche->clt_owner; + + temp_r31->SndPlayRandom(NPC_STYP_ENCOUNTER); + temp_r31->VelStop(); + lastAnimTime = 0; + zNPCGoalJellyAttack::ZapperStart(); + return zNPCGoalPushAnim::Enter(arg0, arg1); +} diff --git a/src/SB/Game/zNPCGoalAmbient.h b/src/SB/Game/zNPCGoalAmbient.h index 4c1cf7ce2..7c4ad3c4e 100644 --- a/src/SB/Game/zNPCGoalAmbient.h +++ b/src/SB/Game/zNPCGoalAmbient.h @@ -1,7 +1,12 @@ #ifndef ZNPCGOALAMBIENT_H #define ZNPCGOALAMBIENT_H +#include "zNPCGoalAmbient.h" #include "zNPCGoalCommon.h" +#include "zNPCGoalStd.h" +#include "zNPCSndTable.h" +#include "zNPCTypeAmbient.h" + xFactoryInst* GOALCreate_Ambient(S32 who, RyzMemGrow* grow, void*); @@ -15,4 +20,11 @@ struct zNPCGoalJellyBirth : zNPCGoalCommon S32 Enter(F32 dt, void* updCtxt); }; +struct zNPCGoalJellyAttack : zNPCGoalPushAnim +{ + U32 lastAnimTime; + S32 Enter(F32 dt, void* updCtxt); + S32 ZapperStart(); +}; + #endif From fa576ff84d0dc461312f34b623e0a1caaf311c0e Mon Sep 17 00:00:00 2001 From: TotallyNotMichael-GH Date: Sun, 2 Feb 2025 18:11:41 -0500 Subject: [PATCH 2/5] Even more functions out of the way Thanks to Square for helping with ZapperStop! --- src/SB/Game/zEntSimpleObj.cpp | 15 +++++++++++++++ src/SB/Game/zNPCGoalAmbient.cpp | 30 ++++++++++++++++++++++++++++++ src/SB/Game/zNPCGoalAmbient.h | 9 ++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zEntSimpleObj.cpp b/src/SB/Game/zEntSimpleObj.cpp index c24ca845f..6ae70c887 100644 --- a/src/SB/Game/zEntSimpleObj.cpp +++ b/src/SB/Game/zEntSimpleObj.cpp @@ -5,3 +5,18 @@ void zEntSimpleObj_Move(xEnt*, xScene*, F32, xEntFrame*) { } + +void zEntSimpleObj_Setup(zEntSimpleObj *arg0) +{ + zEntSetup((zEnt *) arg0); +} + +void zEntSimpleObj_Save(zEntSimpleObj *arg0, xSerial *arg1) +{ + zEntSave((zEnt *) arg0, arg1); +} + +void zEntSimpleObj_Load(zEntSimpleObj *arg0, xSerial *arg1) +{ + zEntLoad((zEnt *) arg0, arg1); +} diff --git a/src/SB/Game/zNPCGoalAmbient.cpp b/src/SB/Game/zNPCGoalAmbient.cpp index 71bf8d427..8993a6827 100644 --- a/src/SB/Game/zNPCGoalAmbient.cpp +++ b/src/SB/Game/zNPCGoalAmbient.cpp @@ -26,3 +26,33 @@ S32 zNPCGoalJellyAttack::Enter(F32 arg0, void* arg1) zNPCGoalJellyAttack::ZapperStart(); return zNPCGoalPushAnim::Enter(arg0, arg1); } + +S32 zNPCGoalJellyAttack::Exit(F32 arg0, void* arg1) +{ + zNPCGoalJellyAttack::ZapperStop(); + return zNPCGoalPushAnim::Exit(arg0, arg1); +} + +S32 zNPCGoalJellyAttack::Process(en_trantype* arg0, F32 arg1, void* arg2, xScene* arg3) +{ + zNPCGoalJellyAttack::ZapperUpdate(); + return zNPCGoalPushAnim::Process(arg0, arg1, arg2, arg3); +} + +S32 zNPCGoalJellyAttack::ZapperStop() +{ + s32 var_r29; + zLightning *temp_r3; + zNPCGoalJellyAttack *var_r30; + zNPC_SNDStop((_tageNPCSnd) 4); + var_r30 = this; + var_r29 = 0; + for (S32 i = 0; i< 3; ++i) + { + if(zap_lytnin[i] != NULL) + { + zLightningKill(zap_lytnin[i]); + } + zap_lytnin[i] = NULL; + } +} diff --git a/src/SB/Game/zNPCGoalAmbient.h b/src/SB/Game/zNPCGoalAmbient.h index 7c4ad3c4e..89d06d1e8 100644 --- a/src/SB/Game/zNPCGoalAmbient.h +++ b/src/SB/Game/zNPCGoalAmbient.h @@ -6,6 +6,8 @@ #include "zNPCGoalStd.h" #include "zNPCSndTable.h" #include "zNPCTypeAmbient.h" +#include "zNPCSupport.h" +#include "zLightning.h" xFactoryInst* GOALCreate_Ambient(S32 who, RyzMemGrow* grow, void*); @@ -22,9 +24,14 @@ struct zNPCGoalJellyBirth : zNPCGoalCommon struct zNPCGoalJellyAttack : zNPCGoalPushAnim { + class zLightning * zap_lytnin[3]; U32 lastAnimTime; S32 Enter(F32 dt, void* updCtxt); - S32 ZapperStart(); + S32 Exit(F32 dt, void* updCtxt); + S32 Process(en_trantype* trantyp, F32 dt, void* updCxt, xScene* xscn); + S32 ZapperStart(); + S32 ZapperStop(); + S32 ZapperUpdate(); }; #endif From c3a40aa6e4bac55515f61cdf360b7bfa3b070864 Mon Sep 17 00:00:00 2001 From: TotallyNotMichael-GH Date: Sun, 2 Feb 2025 18:11:41 -0500 Subject: [PATCH 3/5] Even more functions out of the way Thanks to Square for helping with ZapperStop! --- src/SB/Game/zEntSimpleObj.cpp | 15 +++++++++++++++ src/SB/Game/zNPCGoalAmbient.cpp | 30 ++++++++++++++++++++++++++++++ src/SB/Game/zNPCGoalAmbient.h | 9 ++++++++- 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zEntSimpleObj.cpp b/src/SB/Game/zEntSimpleObj.cpp index c24ca845f..6ae70c887 100644 --- a/src/SB/Game/zEntSimpleObj.cpp +++ b/src/SB/Game/zEntSimpleObj.cpp @@ -5,3 +5,18 @@ void zEntSimpleObj_Move(xEnt*, xScene*, F32, xEntFrame*) { } + +void zEntSimpleObj_Setup(zEntSimpleObj *arg0) +{ + zEntSetup((zEnt *) arg0); +} + +void zEntSimpleObj_Save(zEntSimpleObj *arg0, xSerial *arg1) +{ + zEntSave((zEnt *) arg0, arg1); +} + +void zEntSimpleObj_Load(zEntSimpleObj *arg0, xSerial *arg1) +{ + zEntLoad((zEnt *) arg0, arg1); +} diff --git a/src/SB/Game/zNPCGoalAmbient.cpp b/src/SB/Game/zNPCGoalAmbient.cpp index 71bf8d427..8993a6827 100644 --- a/src/SB/Game/zNPCGoalAmbient.cpp +++ b/src/SB/Game/zNPCGoalAmbient.cpp @@ -26,3 +26,33 @@ S32 zNPCGoalJellyAttack::Enter(F32 arg0, void* arg1) zNPCGoalJellyAttack::ZapperStart(); return zNPCGoalPushAnim::Enter(arg0, arg1); } + +S32 zNPCGoalJellyAttack::Exit(F32 arg0, void* arg1) +{ + zNPCGoalJellyAttack::ZapperStop(); + return zNPCGoalPushAnim::Exit(arg0, arg1); +} + +S32 zNPCGoalJellyAttack::Process(en_trantype* arg0, F32 arg1, void* arg2, xScene* arg3) +{ + zNPCGoalJellyAttack::ZapperUpdate(); + return zNPCGoalPushAnim::Process(arg0, arg1, arg2, arg3); +} + +S32 zNPCGoalJellyAttack::ZapperStop() +{ + s32 var_r29; + zLightning *temp_r3; + zNPCGoalJellyAttack *var_r30; + zNPC_SNDStop((_tageNPCSnd) 4); + var_r30 = this; + var_r29 = 0; + for (S32 i = 0; i< 3; ++i) + { + if(zap_lytnin[i] != NULL) + { + zLightningKill(zap_lytnin[i]); + } + zap_lytnin[i] = NULL; + } +} diff --git a/src/SB/Game/zNPCGoalAmbient.h b/src/SB/Game/zNPCGoalAmbient.h index 7c4ad3c4e..89d06d1e8 100644 --- a/src/SB/Game/zNPCGoalAmbient.h +++ b/src/SB/Game/zNPCGoalAmbient.h @@ -6,6 +6,8 @@ #include "zNPCGoalStd.h" #include "zNPCSndTable.h" #include "zNPCTypeAmbient.h" +#include "zNPCSupport.h" +#include "zLightning.h" xFactoryInst* GOALCreate_Ambient(S32 who, RyzMemGrow* grow, void*); @@ -22,9 +24,14 @@ struct zNPCGoalJellyBirth : zNPCGoalCommon struct zNPCGoalJellyAttack : zNPCGoalPushAnim { + class zLightning * zap_lytnin[3]; U32 lastAnimTime; S32 Enter(F32 dt, void* updCtxt); - S32 ZapperStart(); + S32 Exit(F32 dt, void* updCtxt); + S32 Process(en_trantype* trantyp, F32 dt, void* updCxt, xScene* xscn); + S32 ZapperStart(); + S32 ZapperStop(); + S32 ZapperUpdate(); }; #endif From 8576f0f171043420ab35255e6069411c73341a4d Mon Sep 17 00:00:00 2001 From: TotallyNotMichael-GH Date: Sun, 2 Feb 2025 18:33:11 -0500 Subject: [PATCH 4/5] Thank you, Square --- src/SB/Game/zNPCGoalAmbient.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/SB/Game/zNPCGoalAmbient.cpp b/src/SB/Game/zNPCGoalAmbient.cpp index 8993a6827..3cbda0b23 100644 --- a/src/SB/Game/zNPCGoalAmbient.cpp +++ b/src/SB/Game/zNPCGoalAmbient.cpp @@ -41,12 +41,7 @@ S32 zNPCGoalJellyAttack::Process(en_trantype* arg0, F32 arg1, void* arg2, xScene S32 zNPCGoalJellyAttack::ZapperStop() { - s32 var_r29; - zLightning *temp_r3; - zNPCGoalJellyAttack *var_r30; zNPC_SNDStop((_tageNPCSnd) 4); - var_r30 = this; - var_r29 = 0; for (S32 i = 0; i< 3; ++i) { if(zap_lytnin[i] != NULL) From e669e0219a64518751390660fb23265b040a1265 Mon Sep 17 00:00:00 2001 From: TotallyNotMichael-GH Date: Thu, 13 Feb 2025 21:53:44 -0500 Subject: [PATCH 5/5] zCombo Matches --- src/SB/Game/zCombo.cpp | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/src/SB/Game/zCombo.cpp b/src/SB/Game/zCombo.cpp index 5e5fe6075..9aa396069 100644 --- a/src/SB/Game/zCombo.cpp +++ b/src/SB/Game/zCombo.cpp @@ -8,6 +8,7 @@ #include "xTextAsset.h" #include "zGlobals.h" #include "zTextBox.h" +#include "zUIFont.h" extern const char zCombo_Strings[]; extern const F32 zCombo_float_zero; @@ -29,19 +30,23 @@ struct widget_chunk : xBase xhud::text_widget w; }; -extern widget_chunk* comboHUD; +/* .bss */ +static xVec3 sUnderCamPos; +static xtextbox * sHideText[5]; -extern zComboReward comboReward[16]; - -extern S32 zCombo_int32_1; // probably comboPending -extern S32 zCombo_int32_2; // probably comboLastCounter -extern S32 zCombo_int32_3; // probably comboCounter +/* .sbss */ +static widget_chunk* comboHUD; +static zUIFont* sHideUIF[1]; +static S32 comboPending; +static S32 comboLastCounter; +static S32 comboCounter; +static F32 comboTimer; -extern F32 zCombo_float32_1; // probably comboMaxTime -extern F32 zCombo_float32_3; // probably comboTimer +/* .sdata */ +static F32 comboMaxTime = 1.0f; +static F32 comboDisplayTime = 2.0f; -extern xBase* sHideText[5]; -extern xBase* sHideUIF[1]; +extern zComboReward comboReward[16]; void fillCombo(zComboReward* reward) { @@ -80,6 +85,23 @@ void fillCombo(zComboReward* reward) reward->rewardNum = j; } +void zCombo_Add(S32 arg0) +{ + if (comboTimer < 0.0f) + { + comboTimer = comboMaxTime; + comboPending = arg0 - 1; + return; + } + comboTimer = comboMaxTime; + comboCounter += arg0; + if ((S32) comboPending != 0) + { + comboCounter += comboPending; + comboPending = 0; + } +} + #if 0 // Can't get the floating point instructions to go in the right order // the zCombo_float32_3 = zCombo_float_minusone always gets lifted to the