From 127fa930c1869368688a4bb2757b1a45a44d650d Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Tue, 25 Mar 2025 12:32:27 -0500 Subject: [PATCH] zPlatform: zPlatform_PaddleStartRotate 100% code match --- src/SB/Game/zPlatform.cpp | 48 +++++++++++++++++++++++++++++++++++++++ src/SB/Game/zPlatform.h | 5 +++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zPlatform.cpp b/src/SB/Game/zPlatform.cpp index 63974cba5..d17a36d1f 100644 --- a/src/SB/Game/zPlatform.cpp +++ b/src/SB/Game/zPlatform.cpp @@ -395,6 +395,54 @@ U32 zMechIsStartingBack(zPlatform* ent, U16 param_2) } } +static F32 SolvePaddleMotion(zPlatform* plat, F32* time, F32 tmr) +{ +} + +void zPlatform_PaddleStartRotate(xEnt* entplat, S32 direction, S32 stutter) +{ + zPlatform* plat = (zPlatform*)entplat; + F32 time[3]; + + if (stutter != 0) + { + if (direction > 0) + { + plat->state = ZPLATFORM_STATE_UNK4; + } + else if (direction < 0) + { + plat->state = ZPLATFORM_STATE_UNK1; + } + } + else + { + if (direction > 0) + { + plat->state = ZPLATFORM_STATE_UNK3; + plat->ctr += 1; + + if (plat->ctr >= plat->passet->paddle.countOrient) + { + plat->ctr = 0; + } + } + else if (direction < 0) + { + plat->state = ZPLATFORM_STATE_UNK2; + plat->ctr -= 1; + + if (plat->ctr < 0) + { + plat->ctr = plat->passet->paddle.countOrient - 1; + } + } + } + + SolvePaddleMotion(plat, time, -1.0f); + plat->tmr = time[0] + time[1] + time[2]; +} + S32 zPlatformEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, xBase* base3) { return 1; diff --git a/src/SB/Game/zPlatform.h b/src/SB/Game/zPlatform.h index 031096700..d5594fa34 100644 --- a/src/SB/Game/zPlatform.h +++ b/src/SB/Game/zPlatform.h @@ -161,9 +161,11 @@ struct zPlatform : zEnt #define ZPLATFORM_SUBTYPE_PADDLE 12 #define ZPLATFORM_SUBTYPE_FM 13 -#define ZPLATFORM_STATE_UNK1 0x3 #define ZPLATFORM_STATE_INIT 0x0 +#define ZPLATFORM_STATE_UNK1 0x3 +#define ZPLATFORM_STATE_UNK2 0x1 #define ZPLATFORM_STATE_UNK3 0x2 +#define ZPLATFORM_STATE_UNK4 0x4 void zPlatform_Init(void* plat, void* asset); void zPlatform_Init(zPlatform* plat, xEntAsset* asset); @@ -171,6 +173,7 @@ void zPlatform_Setup(zPlatform* plat, xScene* sc); void zPlatform_Save(zPlatform* ent, xSerial* s); void zPlatform_Load(zPlatform* ent, xSerial* s); void zPlatform_Reset(zPlatform* plat, xScene* sc); +void zPlatform_PaddleStartRotate(class xEnt* entplat, S32 direction, S32 stutter); void zPlatform_Update(xEnt* ent, xScene* sc, float dt); U32 zPlatform_PaddleCollide(xCollis* coll, const xVec3* hitsource, const xVec3* hitvel, U32 worldSpaceNorm);