Skip to content

Commit 61eeb99

Browse files
committed
Match xEntMechReverse
1 parent 53907d3 commit 61eeb99

File tree

3 files changed

+101
-6
lines changed

3 files changed

+101
-6
lines changed

src/SB/Core/x/xCamera.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ void xCameraUpdate(xCamera* cam, F32 dt)
563563

564564
num_updates = std::ceilf(_1283 * dt);
565565

566-
// non-matching: int-to-float conversion
567566
sdt = dt / num_updates;
568567

569568
for (i = 0; i < num_updates; i++)
@@ -674,11 +673,9 @@ void xCameraFXZoomUpdate(cameraFX* f, F32 dt, const xMat4x3*, xMat4x3* m)
674673
f->zoom.velCur += f->zoom.accel * dt;
675674
f->zoom.distanceCur -= f->zoom.velCur * dt;
676675

677-
// non-matching: float registers swapped
678-
679-
if (f->zoom.distanceCur <= _765)
676+
if (f->zoom.distanceCur <= 0.0f)
680677
{
681-
f->zoom.distanceCur = _765;
678+
f->zoom.distanceCur = 0.0f;
682679
f->zoom.mode = CAMERAFX_ZOOM_MODE_3;
683680
f->flags |= 0x2;
684681
}

src/SB/Core/x/xEntMotion.cpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "xDebug.h"
12
#include "xEntMotion.h"
23
#include "xMath.h"
34

@@ -158,3 +159,79 @@ void xEntMechForward(xEntMotion* motion)
158159
}
159160
}
160161
}
162+
163+
void xEntMechReverse(xEntMotion* motion)
164+
{
165+
xEntMotionMechData* mech = &(motion->asset->mech);
166+
xEntMotionAsset* mkasst = motion->asset;
167+
168+
xEntMotionRun(motion);
169+
170+
if (motion->mech.state == 0)
171+
{
172+
motion->mech.ss = -motion->mech.ss;
173+
motion->mech.sr = -motion->mech.sr;
174+
motion->tmr = mkasst->mech.sld_tm - motion->tmr;
175+
motion->mech.state = 3;
176+
}
177+
else if (motion->mech.state == 1)
178+
{
179+
motion->mech.ss = -motion->mech.ss;
180+
motion->mech.sr = -motion->mech.sr;
181+
motion->tmr = mkasst->mech.rot_tm - motion->tmr;
182+
motion->mech.state = 4;
183+
}
184+
else if ((motion->mech.state != 2) && (motion->mech.state != 3) && (motion->mech.state != 4) && (motion->mech.state != 5) && (motion->mech.state == 6))
185+
{
186+
motion->mech.ss = -motion->mech.ss;
187+
motion->mech.sr = -motion->mech.sr;
188+
motion->tmr = 0.0f;
189+
190+
if ((mech->type == 0) || (mech->type == 2) || (mech->type == 4))
191+
{
192+
motion->mech.state = 3;
193+
}
194+
else
195+
{
196+
motion->mech.state = 4;
197+
}
198+
}
199+
}
200+
201+
static xEntMotion** dbg_xems;
202+
static U16 dbg_num;
203+
static U16 dbg_num_allocd;
204+
static S16 dbg_idx;
205+
206+
void xEntMotionDebugCB();
207+
208+
// Non-matching: scheduling
209+
void xEntMotionDebugInit(U16 num_xems)
210+
{
211+
if (num_xems != 0)
212+
{
213+
xDebugModeAdd("DBG_XENTMOTION", xEntMotionDebugCB);
214+
dbg_num = 0;
215+
dbg_xems = (xEntMotion**)xMemAlloc(gActiveHeap, num_xems << 2, 0);
216+
dbg_num_allocd = num_xems;
217+
dbg_idx = 0;
218+
}
219+
}
220+
221+
// This scheduling is absolutely shambolic
222+
void xEntMotionDebugAdd(xEntMotion* motion)
223+
{
224+
if (dbg_num < dbg_num_allocd)
225+
{
226+
dbg_num++;
227+
dbg_xems[dbg_num] = motion;
228+
}
229+
}
230+
231+
void xEntMotionDebugExit()
232+
{
233+
dbg_num = 0;
234+
dbg_xems = NULL;
235+
dbg_num_allocd = 0;
236+
dbg_idx = -1;
237+
}

src/SB/Game/zEntPlayer.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static U32 sCurrentStreamSndID;
7272
static F32 sPlayerSndStreamVolume[ePlayerStreamSnd_Total] = {};
7373
static F32 sPlayerSndSneakDelay;
7474
static S32 sPlayerDiedLastTime;
75-
static S32 sPlayerIgnoreSound;
75+
volatile static S32 sPlayerIgnoreSound;
7676
static S32 sPlayerAttackInAir;
7777

7878
#define MAX_DELAYED_SOUNDS 8
@@ -3683,6 +3683,15 @@ static void load_player_ini()
36833683
}
36843684
}
36853685

3686+
void zEntPlayer_RestoreSounds()
3687+
{
3688+
sPlayerIgnoreSound--;
3689+
if (sPlayerIgnoreSound < 0)
3690+
{
3691+
sPlayerIgnoreSound = 0;
3692+
}
3693+
}
3694+
36863695
void zEntPlayer_Load(xEnt* ent, xSerial* serial)
36873696
{
36883697
return;
@@ -3693,6 +3702,18 @@ void zEntPlayer_PatrickLaunch(xEnt* patLauncher)
36933702
globals.player.carry.patLauncher = patLauncher;
36943703
}
36953704

3705+
void zEntPlayerUpdateModelSB();
3706+
3707+
void zEntPlayerUpdateModel()
3708+
{
3709+
zPlayerGlobals* pg = &globals.player;
3710+
3711+
if (pg->ent.model == pg->model_spongebob)
3712+
{
3713+
zEntPlayerUpdateModelSB();
3714+
}
3715+
}
3716+
36963717
S32 zEntPlayer_Damage(xBase* src, U32 damage, const xVec3* knockback)
36973718
{
36983719
S32 newDamage = zEntPlayer_Damage(src, damage);

0 commit comments

Comments
 (0)