diff --git a/src/SB/Core/gc/iScrFX.cpp b/src/SB/Core/gc/iScrFX.cpp index cbc94338..0fa144fd 100644 --- a/src/SB/Core/gc/iScrFX.cpp +++ b/src/SB/Core/gc/iScrFX.cpp @@ -104,22 +104,18 @@ S32 iScrFxMotionBlurOpen(RwCamera* camera) return 0; } -#if 0 -// Something strange going one here. S32 iScrFxCameraDestroyed(RwCamera* pCamera) { GCMB_KillFrameBufferCopy(); - bool ret = sMBD.motionBlurFrontBuffer != NULL; - if (ret) + if (sMBD.motionBlurFrontBuffer != NULL) { RwRasterDestroy(sMBD.motionBlurFrontBuffer); sMBD.motionBlurFrontBuffer = NULL; + return 1; } - return ret; + return 0; } -#endif - #if 0 // WIP. void iScrFxMotionBlurRender(RwCamera* camera, U32 col) diff --git a/src/SB/Core/gc/isavegame.cpp b/src/SB/Core/gc/isavegame.cpp index 46d0070b..76052932 100644 --- a/src/SB/Core/gc/isavegame.cpp +++ b/src/SB/Core/gc/isavegame.cpp @@ -37,7 +37,6 @@ S32 iSGShutdown() return 1; } -#if 0 // WIP char* iSGMakeName(en_NAMEGEN_TYPE type, const char* base, S32 idx) { @@ -74,7 +73,6 @@ char* iSGMakeName(en_NAMEGEN_TYPE type, const char* base, S32 idx) return use_buf; } -#endif #if 0 // Struct definition is screwed up. diff --git a/src/SB/Core/x/xJSP.cpp b/src/SB/Core/x/xJSP.cpp index 08587a35..4bdce4ef 100644 --- a/src/SB/Core/x/xJSP.cpp +++ b/src/SB/Core/x/xJSP.cpp @@ -21,26 +21,16 @@ RpAtomic* CountAtomicCB(RpAtomic* atomic, U32* param_2) return atomic; } -#if 0 -RpMesh* AddMeshCB(RpMesh* mesh, RpMeshHeader* header, RwV3d** param_3) +static RpMesh* AddMeshCB(RpMesh* mesh, RpMeshHeader* header, void* param_3) { - U32 i = 0; - S32 counter = 0; - - // the loop looks accurate, but it seems like - // the original function uses much more of the stack? - while (i < mesh->numIndices) + for (int i = 0; i < mesh->numIndices; i++) { - **param_3 = sCurrVert[*mesh->indices + counter]; - - counter = counter + 2; - i = i + 1; - *param_3 = *param_3 + 1; + **(RwV3d**)(param_3) = sCurrVert[mesh->indices[i]]; + *((S32*)(param_3)) += sizeof(RwV3d); } return mesh; } -#endif #if 0 // ¯\_(ツ)_/¯ diff --git a/src/SB/Game/zLightEffect.cpp b/src/SB/Game/zLightEffect.cpp index 50a530e6..1032586f 100644 --- a/src/SB/Game/zLightEffect.cpp +++ b/src/SB/Game/zLightEffect.cpp @@ -36,16 +36,12 @@ void zLightOn(_zLight* zl, S32 on) } } -#if 0 -// WIP. -F32 leGetRandom() +static F32 leGetRandom() { - U32 rnd = rand(); - return ((float)(rnd & 0xffff) - lbl_803CDB68) / lbl_803CDB60; + F32 ret = (U16)rand() / (F32)0xffff; + return ret; } -#endif - void zLightEffectInitStrobe(_zLight* zlight) { } diff --git a/src/SB/Game/zLightEffect.h b/src/SB/Game/zLightEffect.h index 2bf40838..7b33edf8 100644 --- a/src/SB/Game/zLightEffect.h +++ b/src/SB/Game/zLightEffect.h @@ -11,7 +11,7 @@ typedef void (*lightInitFunc)(_zLight*); void zLightEffectSet(_zLight* zlight, S32 idx); void zLightOn(_zLight* zl, S32 on); -F32 leGetRandom(); +static F32 leGetRandom(); void zLightEffectInitStrobe(_zLight* zlight); void zLightEffectInitDim(_zLight* zlight); void zLightEffectInitHalfDim(_zLight* zlight); diff --git a/src/SB/Game/zMenu.cpp b/src/SB/Game/zMenu.cpp index e28155bc..b54b0162 100644 --- a/src/SB/Game/zMenu.cpp +++ b/src/SB/Game/zMenu.cpp @@ -250,17 +250,13 @@ U32 zMenuLoop() if (globals.sceneCur->pendingPortal) { - // NOTE (Square): The original compiler emitted a seemingly redundant clrlwi r0,r5,24 - // instruction before storing src[0] in tgt[3]. This is confusing because the - // upper 24 bits should already be zero. There may be a different way of doing - // this byte swap. char* src = (char*)&globals.sceneCur->pendingPortal->passet->sceneID; char* tgt = (char*)&s; tgt[0] = src[3]; tgt[1] = src[2]; tgt[2] = src[1]; tgt[3] = src[0]; - if (src[0] < '0' || src[0] > '9') + if (tgt[3] < '0' || tgt[3] > '9') { memcpy(tgt, src, sizeof(U32)); } diff --git a/src/SB/Game/zNPCMgr.cpp b/src/SB/Game/zNPCMgr.cpp index 3b24efb2..75454687 100644 --- a/src/SB/Game/zNPCMgr.cpp +++ b/src/SB/Game/zNPCMgr.cpp @@ -34,7 +34,6 @@ void zNPCMgr_Startup() #endif -#if 0 // Doesn't set r4 to 1 before calling the delete operator... void zNPCMgr_Shutdown() { @@ -53,8 +52,6 @@ void zNPCMgr_Shutdown() } } -#endif - void zNPCMgr_scenePrepare(S32 npccnt) { zNPCMgrSelf()->ScenePrepare(npccnt); @@ -131,30 +128,30 @@ void zNPCMgr::ScenePrepare(S32 npccnt) #endif -#if 0 -// Yeah good luck getting it to spit out an li instead of doing a shift. S32 zNPCMgr_OrdComp_npcid(void* vkey, void* vitem) { - U32 key = *(U32*)vkey; - U32 item = *(U32*)vitem; + S32 rc; + U32 item; + U32 key; + + key = *(U32*)vkey; + item = *(U32*)vitem; if (key < item) { - return -1; + rc = -1; + } + else if (key > item) + { + rc = 1; } else { - if (key > item) - { - return 1; - } - else - { - return 0; - } + rc = 0; } + + return rc; } -#endif zNPCMgr::zNPCMgr() { diff --git a/src/SB/Game/zNPCTypeDuplotron.cpp b/src/SB/Game/zNPCTypeDuplotron.cpp index a6e943f8..7c6a5c42 100644 --- a/src/SB/Game/zNPCTypeDuplotron.cpp +++ b/src/SB/Game/zNPCTypeDuplotron.cpp @@ -72,7 +72,6 @@ void ZNPC_Destroy_Duplotron(xFactoryInst* inst) delete inst; } -#if 0 // 100% match that needs the full vtable to be filled out // because it induces vtable generation void zNPCDuplotron::SelfSetup() @@ -86,7 +85,6 @@ void zNPCDuplotron::SelfSetup() psy->BrainEnd(); psy->SetSafety(0x4E474430); } -#endif #if 0 // non-matching: scheduling? diff --git a/src/SB/Game/zSurface.cpp b/src/SB/Game/zSurface.cpp index be32623a..52ba3ec4 100644 --- a/src/SB/Game/zSurface.cpp +++ b/src/SB/Game/zSurface.cpp @@ -7,6 +7,8 @@ #include #include +#include "xMath.h" + extern volatile S32 sMapperCount; extern zMaterialMapAsset* sMapper[1]; @@ -137,18 +139,14 @@ U8 zSurfaceOutOfBounds(const xSurface& s) return 0; } -#if 0 -// Float issues F32 zSurfaceGetSlideStartAngle(const xSurface* surf) { if (surf->moprops) { - return (lbl_803CDEE0 * ((zSurfaceProps*)surf->moprops)->asset->sld_start - lbl_803CDEE4) / - lbl_803CDEF0; + return ((((zSurfaceProps*)surf->moprops)->asset->sld_start) * PI) / 176.0f; } - return lbl_803CDEE8; + return PI / 9; } -#endif U32 zSurfaceGetMatchOrient(const xSurface* surf) {