diff --git a/configure.py b/configure.py index f4e52e634..3b4f87535 100644 --- a/configure.py +++ b/configure.py @@ -451,7 +451,7 @@ def MatchingFor(*versions): Object(Matching, "SB/Core/x/xParMgr.cpp"), Object(Matching, "SB/Core/x/xPartition.cpp", extra_cflags=["-sym on"]), Object(NonMatching, "SB/Core/x/xpkrsvc.cpp"), - Object(NonMatching, "SB/Core/x/xQuickCull.cpp"), + Object(Matching, "SB/Core/x/xQuickCull.cpp"), Object(Matching, "SB/Core/x/xsavegame.cpp"), Object(NonMatching, "SB/Core/x/xScene.cpp"), Object(NonMatching, "SB/Core/x/xScrFx.cpp"), @@ -501,7 +501,7 @@ def MatchingFor(*versions): Object(NonMatching, "SB/Game/zLOD.cpp"), Object(NonMatching, "SB/Game/zMain.cpp"), Object(Equivalent, "SB/Game/zMenu.cpp"), - Object(NonMatching, "SB/Game/zMovePoint.cpp"), + Object(Matching, "SB/Game/zMovePoint.cpp"), Object(NonMatching, "SB/Game/zMusic.cpp"), Object(Equivalent, "SB/Game/zParCmd.cpp"), Object(Matching, "SB/Game/zParEmitter.cpp"), diff --git a/src/SB/Core/x/xMovePoint.h b/src/SB/Core/x/xMovePoint.h index 55dcd9beb..705e9e844 100644 --- a/src/SB/Core/x/xMovePoint.h +++ b/src/SB/Core/x/xMovePoint.h @@ -42,7 +42,7 @@ struct xMovePoint : xBase xSpline3* spl; }; -xVec3* xMovePointGetPos(xMovePoint* m); +xVec3* xMovePointGetPos(const xMovePoint* m); F32 xMovePointGetNext(const xMovePoint* m, const xMovePoint* prev, xMovePoint** next, xVec3* hdng); void xMovePointSplineDestroy(xMovePoint* m); void xMovePointSplineSetup(xMovePoint* m); diff --git a/src/SB/Core/x/xQuickCull.cpp b/src/SB/Core/x/xQuickCull.cpp index 7c5580a4b..8684425cf 100644 --- a/src/SB/Core/x/xQuickCull.cpp +++ b/src/SB/Core/x/xQuickCull.cpp @@ -19,9 +19,7 @@ void xQuickCullInit(xQCControl* ctrl, F32 xmin, F32 ymin, F32 zmin, F32 xmax, F3 ctrl->world_zsz = zmax - zmin; if (((ctrl->world_xsz <= 0.0f) || (ctrl->world_ysz <= 0.0f)) || (ctrl->world_zsz <= 0.0f)) { - ctrl->world_zsz = 1.0f; - ctrl->world_ysz = 1.0f; - ctrl->world_xsz = 1.0f; + ctrl->world_xsz = ctrl->world_ysz = ctrl->world_zsz = 1.0f; } ctrl->scale_x = 127.0f / ctrl->world_xsz; ctrl->scale_y = 127.0f / ctrl->world_ysz; @@ -37,7 +35,6 @@ void xQuickCullInit(xQCControl* ctrl, const xBox* box) box->upper.z); } -// WIP. S32 xQuickCullIsects(const xQCData* a, const xQCData* b) { return a->xmin <= b->xmax && a->ymin <= b->ymax && a->zmin <= b->zmax && b->xmin <= a->xmax && diff --git a/src/SB/Game/zDispatcher.cpp b/src/SB/Game/zDispatcher.cpp index 2cc85d32f..d39437b86 100644 --- a/src/SB/Game/zDispatcher.cpp +++ b/src/SB/Game/zDispatcher.cpp @@ -20,24 +20,18 @@ extern st_ZDISPATCH_CONTEXT lbl_80254E00; extern char lbl_80254E10[512]; -extern S32 g_zdsp_init; -extern S32 warned_zDispatcher; -extern signed char init_zDispatcher; -extern S32 oldVibrationOption; -extern U32 oldSoundMode; -extern U32 oldMusicVolume; -extern U32 oldSFXVolume; +S32 g_zdsp_init; +S32 oldVibrationOption; +U32 oldSoundMode; +U32 oldMusicVolume; +U32 oldSFXVolume; extern st_ZDISPATCH_DEPOT g_zdsp_depot; extern iColor_tag _1143; extern iColor_tag _1142; -extern F32 _1179; -extern F32 _1180; -extern F32 _1181; -extern F32 _1197; -extern F64 _1199; +extern F64 _1199; // 4503601774854144.0f // float conversion number extern U8 menu_fmv_played; extern char zEventLogBuf[256][20]; @@ -178,15 +172,17 @@ S32 ZDSP_doCommand(st_ZDISPATCH_DATA* dspdata, st_ZDISPATCH_CONTEXT* cmdCtxt) en_DISPATCH_COMMAND cmd = cmdCtxt->cmd; void* indata = cmdCtxt->indata; void* result = cmdCtxt->result; + static S32 warned; + static signed char init; - if (init_zDispatcher == 0) + if ((S32)init == 0) { - warned_zDispatcher = 0; - init_zDispatcher = 1; + warned = 0; + init = 1; } - if (warned_zDispatcher == 0) + if (warned == 0) { - warned_zDispatcher = 1; + warned = 1; } switch (cmd) @@ -432,11 +428,11 @@ S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, xBase* t break; case 0xc2: - zEntPlayer_SNDPlay(ePlayerSnd_CheckPoint, _1179); + zEntPlayer_SNDPlay(ePlayerSnd_CheckPoint, 1.0f); F32 fVar2; - if (*toParam != _1179) + if (*toParam != 1.0f) { - fVar2 = _1180 * *toParam; + fVar2 = 0.017453292f * *toParam; } else { @@ -457,7 +453,7 @@ S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, xBase* t break; case 0x126: menu_fmv_played = 1; - zFMVPlay(zFMVFileGetName((eFMVFile)(U32)*toParam), 0x10001, _1181, 1, 0); + zFMVPlay(zFMVFileGetName((eFMVFile)(U32)*toParam), 0x10001, 0.01f, 1, 0); break; case 0x130: zSceneEnableScreenAdj(1); @@ -471,7 +467,7 @@ S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, xBase* t break; case 0x1fd: - xCameraFXShake(*toParam, toParam[1], toParam[2], toParam[3], _1179, NULL, NULL); + xCameraFXShake(*toParam, toParam[1], toParam[2], toParam[3], 1.0f, NULL, NULL); break; case 0x210: xCMstart((xCreditsData*)toParamWidget, *toParam, xb); @@ -520,16 +516,16 @@ S32 ZDSP_elcb_event(xBase*, xBase* xb, U32 toEvent, const F32* toParam, xBase* t void WRAP_xsnd_setMusicVolume(S32 i) { - float f1 = _1181 * i; - float f2 = MIN(f1, _1197); + float f1 = 0.01f * i; + float f2 = MIN(f1, 1.0f); - if (f1 < _1179) + if (f1 < 1.0f) { f2 = f1; } else { - f2 = _1197; + f2 = 1.0f; } xSndSetCategoryVol(SND_CAT_MUSIC, f2); zMusicRefreshVolume(); @@ -537,16 +533,16 @@ void WRAP_xsnd_setMusicVolume(S32 i) void WRAP_xsnd_setSFXVolume(S32 i) { - F32 fcmp = _1181 * i; // - _1199; - F32 f = MIN(fcmp, _1197); //_1197 < fcmp ? fcmp : _1197; + F32 fcmp = 0.01f * i; // - _1199; + F32 f = MIN(fcmp, 1.0f); //1.0f < fcmp ? fcmp : 1.0f; - if (f > _1179) + if (f > 1.0f) { - f = _1197; + f = 1.0f; } else { - f = fcmp < _1197 ? fcmp : _1197; + f = fcmp < 1.0f ? fcmp : 1.0f; } xSndSetCategoryVol(SND_CAT_GAME, f); xSndSetCategoryVol(SND_CAT_DIALOG, f); diff --git a/src/SB/Game/zMovePoint.cpp b/src/SB/Game/zMovePoint.cpp index 08bdb013c..0f0e1a80a 100644 --- a/src/SB/Game/zMovePoint.cpp +++ b/src/SB/Game/zMovePoint.cpp @@ -5,28 +5,15 @@ #include -extern zMovePoint* g_mvpt_list; -extern S32 g_mvpt_cnt; -extern F32 lbl_803CDD40; -extern F32 lbl_803CDD44; +zMovePoint* g_mvpt_list; +S32 g_mvpt_cnt; // Random load word at the end of the function for some reason. zMovePoint* zMovePoint_GetMemPool(S32 cnt) { - /*if (cnt != 0) - { - g_mvpt_list = (zMovePoint*)xMemAllocSize(cnt * sizeof(zMovePoint)); - } - else - { - g_mvpt_list = NULL; - } - g_mvpt_cnt = cnt; - return g_mvpt_list;*/ - g_mvpt_list = cnt ? (zMovePoint*)xMemAllocSize(cnt * sizeof(zMovePoint)) : NULL; g_mvpt_cnt = cnt; - return g_mvpt_list; + return *(__typeof__(g_mvpt_list) volatile*)&g_mvpt_list; } void zMovePointInit(zMovePoint* m, xMovePointAsset* asset) @@ -104,9 +91,9 @@ S32 zMovePointEventCB(xBase* from, xBase* to, U32 toEvent, const F32* toParam, x xVec3* pos = ((zMovePoint*)to)->pos; if (pos != NULL) { - if (*toParam < lbl_803CDD40) + if (*toParam < 1e-5f) { - NPCC_MakeASplash(pos, lbl_803CDD44); + NPCC_MakeASplash(pos, -1.0f); } else { @@ -134,7 +121,7 @@ F32 zMovePointGetDelay(const zMovePoint* m) return xMovePointGetDelay((xMovePoint*)m); } -F32 xMovePointGetDelay(const xMovePoint* m) +inline F32 xMovePointGetDelay(const xMovePoint* m) { return m->delay; }