diff --git a/src/SB/Core/x/xCamera.cpp b/src/SB/Core/x/xCamera.cpp index 2ac1510f9..716dfdae2 100644 --- a/src/SB/Core/x/xCamera.cpp +++ b/src/SB/Core/x/xCamera.cpp @@ -563,7 +563,6 @@ void xCameraUpdate(xCamera* cam, F32 dt) num_updates = std::ceilf(_1283 * dt); - // non-matching: int-to-float conversion sdt = dt / num_updates; for (i = 0; i < num_updates; i++) @@ -674,11 +673,9 @@ void xCameraFXZoomUpdate(cameraFX* f, F32 dt, const xMat4x3*, xMat4x3* m) f->zoom.velCur += f->zoom.accel * dt; f->zoom.distanceCur -= f->zoom.velCur * dt; - // non-matching: float registers swapped - - if (f->zoom.distanceCur <= _765) + if (f->zoom.distanceCur <= 0.0f) { - f->zoom.distanceCur = _765; + f->zoom.distanceCur = 0.0f; f->zoom.mode = CAMERAFX_ZOOM_MODE_3; f->flags |= 0x2; } diff --git a/src/SB/Core/x/xEntMotion.cpp b/src/SB/Core/x/xEntMotion.cpp index bee2977d2..5096aecb3 100644 --- a/src/SB/Core/x/xEntMotion.cpp +++ b/src/SB/Core/x/xEntMotion.cpp @@ -1,3 +1,4 @@ +#include "xDebug.h" #include "xEntMotion.h" #include "xMath.h" @@ -158,3 +159,79 @@ void xEntMechForward(xEntMotion* motion) } } } + +void xEntMechReverse(xEntMotion* motion) +{ + xEntMotionMechData* mech = &(motion->asset->mech); + xEntMotionAsset* mkasst = motion->asset; + + xEntMotionRun(motion); + + if (motion->mech.state == 0) + { + motion->mech.ss = -motion->mech.ss; + motion->mech.sr = -motion->mech.sr; + motion->tmr = mkasst->mech.sld_tm - motion->tmr; + motion->mech.state = 3; + } + else if (motion->mech.state == 1) + { + motion->mech.ss = -motion->mech.ss; + motion->mech.sr = -motion->mech.sr; + motion->tmr = mkasst->mech.rot_tm - motion->tmr; + motion->mech.state = 4; + } + else if ((motion->mech.state != 2) && (motion->mech.state != 3) && (motion->mech.state != 4) && (motion->mech.state != 5) && (motion->mech.state == 6)) + { + motion->mech.ss = -motion->mech.ss; + motion->mech.sr = -motion->mech.sr; + motion->tmr = 0.0f; + + if ((mech->type == 0) || (mech->type == 2) || (mech->type == 4)) + { + motion->mech.state = 3; + } + else + { + motion->mech.state = 4; + } + } +} + +static xEntMotion** dbg_xems; +static U16 dbg_num; +static U16 dbg_num_allocd; +static S16 dbg_idx; + +void xEntMotionDebugCB(); + +// Non-matching: scheduling +void xEntMotionDebugInit(U16 num_xems) +{ + if (num_xems != 0) + { + xDebugModeAdd("DBG_XENTMOTION", xEntMotionDebugCB); + dbg_num = 0; + dbg_xems = (xEntMotion**)xMemAlloc(gActiveHeap, num_xems << 2, 0); + dbg_num_allocd = num_xems; + dbg_idx = 0; + } +} + +// This scheduling is absolutely shambolic +void xEntMotionDebugAdd(xEntMotion* motion) +{ + if (dbg_num < dbg_num_allocd) + { + dbg_num++; + dbg_xems[dbg_num] = motion; + } +} + +void xEntMotionDebugExit() +{ + dbg_num = 0; + dbg_xems = NULL; + dbg_num_allocd = 0; + dbg_idx = -1; +} diff --git a/src/SB/Game/zEntPlayer.cpp b/src/SB/Game/zEntPlayer.cpp index 664954693..eeb9ad8ee 100644 --- a/src/SB/Game/zEntPlayer.cpp +++ b/src/SB/Game/zEntPlayer.cpp @@ -72,7 +72,7 @@ static U32 sCurrentStreamSndID; static F32 sPlayerSndStreamVolume[ePlayerStreamSnd_Total] = {}; static F32 sPlayerSndSneakDelay; static S32 sPlayerDiedLastTime; -static S32 sPlayerIgnoreSound; +volatile static S32 sPlayerIgnoreSound; static S32 sPlayerAttackInAir; #define MAX_DELAYED_SOUNDS 8 @@ -3683,6 +3683,15 @@ static void load_player_ini() } } +void zEntPlayer_RestoreSounds() +{ + sPlayerIgnoreSound--; + if (sPlayerIgnoreSound < 0) + { + sPlayerIgnoreSound = 0; + } +} + void zEntPlayer_Load(xEnt* ent, xSerial* serial) { return; @@ -3693,6 +3702,18 @@ void zEntPlayer_PatrickLaunch(xEnt* patLauncher) globals.player.carry.patLauncher = patLauncher; } +void zEntPlayerUpdateModelSB(); + +void zEntPlayerUpdateModel() +{ + zPlayerGlobals* pg = &globals.player; + + if (pg->ent.model == pg->model_spongebob) + { + zEntPlayerUpdateModelSB(); + } +} + S32 zEntPlayer_Damage(xBase* src, U32 damage, const xVec3* knockback) { S32 newDamage = zEntPlayer_Damage(src, damage);