From c874c47b6428f82e39aa77b6053aa3642df04f06 Mon Sep 17 00:00:00 2001 From: escape209 Date: Tue, 20 Aug 2024 18:22:46 +0100 Subject: [PATCH] Various matches --- src/SB/Core/gc/iFMV.cpp | 6 +----- src/SB/Core/x/xSFX.cpp | 13 ++++++++----- src/SB/Core/x/xScene.cpp | 3 --- src/SB/Game/zGame.cpp | 15 ++++++--------- src/SB/Game/zNPCTypeBoss.cpp | 11 +++++------ 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/SB/Core/gc/iFMV.cpp b/src/SB/Core/gc/iFMV.cpp index bac9bb81..b107ce20 100644 --- a/src/SB/Core/gc/iFMV.cpp +++ b/src/SB/Core/gc/iFMV.cpp @@ -18,8 +18,6 @@ void iFMVfree(void* mem) RwFree(mem); } -#ifdef NON_MATCHING -// For some reason, the check for frame_num is always optimized to true. U32 iFMVPlay(char* filename, U32 buttons, F32 time, bool skippable, bool lockController) { if (filename == NULL) @@ -29,7 +27,7 @@ U32 iFMVPlay(char* filename, U32 buttons, F32 time, bool skippable, bool lockCon else { frame_num = 0; - while (frame_num >= 0) + while ((S32)frame_num >= 0) { PlayFMV(filename, buttons, time); } @@ -37,8 +35,6 @@ U32 iFMVPlay(char* filename, U32 buttons, F32 time, bool skippable, bool lockCon } } -#endif - static void Setup_surface_array() { Bink_surface_type[0] = BINKSURFACE32; diff --git a/src/SB/Core/x/xSFX.cpp b/src/SB/Core/x/xSFX.cpp index 39744fc5..15b72bb5 100644 --- a/src/SB/Core/x/xSFX.cpp +++ b/src/SB/Core/x/xSFX.cpp @@ -13,23 +13,26 @@ void xSFXEnvironmentalStreamSceneExit(void) memset(&s_managedEnvSFX, 0, 4); } -#ifdef NON_MATCHING S32 xSFXWillSendDone(xSFX* param_1) { - if (param_1->linkCount != 0) + S32 iLink = param_1->linkCount; + + if ((U32)iLink != 0) { - for (int i = 0; i < param_1->linkCount; i++) + xLinkAsset* pLink = param_1->link; + + for (; iLink > 0; iLink--) { - if ((¶m_1->link[i])->srcEvent == 0xbf) + if (pLink->srcEvent == 0xbf) { return 1; } + pLink++; } } return 0; } -#endif void xSFXInit(void* t, void* asset) diff --git a/src/SB/Core/x/xScene.cpp b/src/SB/Core/x/xScene.cpp index 69075a07..e0c96a52 100644 --- a/src/SB/Core/x/xScene.cpp +++ b/src/SB/Core/x/xScene.cpp @@ -286,8 +286,6 @@ void ProjectTriangle(xVec3* param_1, xVec3* param_2, float* param_3, float* para return; } -#ifdef NON_MATCHING -// Float memes void ProjectBox(xVec3* param_1, xBox* param_2, float* param_3, float* param_4) { F32 fVar7 = lbl_803CCF78 * (param_1->x * ((param_2->upper).x + (param_2->lower).x) + @@ -299,7 +297,6 @@ void ProjectBox(xVec3* param_1, xBox* param_2, float* param_3, float* param_4) *param_3 = fVar7 - fVar1; *param_4 = fVar7 + fVar1; } -#endif static RpCollisionTriangle* nearestFloorCB(RpIntersection*, RpCollisionTriangle* collTriangle, F32, void* data); diff --git a/src/SB/Game/zGame.cpp b/src/SB/Game/zGame.cpp index 13f689fb..b233feec 100644 --- a/src/SB/Game/zGame.cpp +++ b/src/SB/Game/zGame.cpp @@ -162,15 +162,13 @@ S32 zGameIsPaused() return 0; } -#ifdef NON_MATCHING -S32 zGameLoopContinue() +iTime t1; + +static S32 zGameLoopContinue() { if (gGameMode == eGameMode_Game) { - if (((gGameState == 1) || (gGameState == 3)) || (gGameState == 4)) - { - return 1; - } + return gGameState == 1 || gGameState == 3 || gGameState == 4; } else { @@ -179,12 +177,11 @@ S32 zGameLoopContinue() gGameWhereAmI = eGameWhere_SaveLoop; zSaveLoad_SaveLoop(); sTimeLast = iTimeGet(); + t1 = iTimeGet(); } - return 1; } - return 0; + return 1; } -#endif S32 zGameOkToPause() { diff --git a/src/SB/Game/zNPCTypeBoss.cpp b/src/SB/Game/zNPCTypeBoss.cpp index bef50225..348ff3c0 100644 --- a/src/SB/Game/zNPCTypeBoss.cpp +++ b/src/SB/Game/zNPCTypeBoss.cpp @@ -181,24 +181,23 @@ void ZNPC_Destroy_Boss(xFactoryInst* inst) delete inst; } -#ifdef NON_MATCHING xAnimTable* ZNPC_AnimTable_BossSBobbyArm() { - // non-matching: surprisingly the floats in this function are fine - // r4 and r5 is swapped for some reason during the ourAnims assignment xAnimTable* table; + S32 ourAnims[2] = { 1, 0 }; - table = xAnimTableNew("zNPCBBobbyArm", NULL, 0); + // Nearly identical, save for a redundant r5 load being skipped. + table = xAnimTableNew("zNPCBBobbyArm", NULL, ourAnims[0]); + xAnimTableNewState(table, g_strz_bossanim[1], 0x10, 0, _920_2, NULL, NULL, _921_2, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); - NPCC_BuildStandardAnimTran(table, (char**)g_strz_bossanim, ourAnims, 1, _922_0); + NPCC_BuildStandardAnimTran(table, (char**)g_strz_bossanim, &ourAnims[0], 1, _922_0); return table; } -#endif void BOSS_InitEffects();