Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/SB/Core/x/xCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -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;
}
Expand Down
77 changes: 77 additions & 0 deletions src/SB/Core/x/xEntMotion.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "xDebug.h"
#include "xEntMotion.h"
#include "xMath.h"

Expand Down Expand Up @@ -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;
}
23 changes: 22 additions & 1 deletion src/SB/Game/zEntPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down