From 84864747d4a387c726b39e5aaf52c97894cf3d92 Mon Sep 17 00:00:00 2001 From: TotallyNotMichael-GH Date: Sat, 1 Feb 2025 19:31:01 -0500 Subject: [PATCH 1/4] 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/4] 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/4] 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/4] 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)