Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matches and improved non-matches #375

Merged
merged 1 commit into from
Sep 25, 2024
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
26 changes: 14 additions & 12 deletions src/SB/Core/x/xSnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,35 +312,37 @@ void xSndSetExternalCallback(void (*callback)(U32))
}

#if 0
// Subtle issue with the register use in the setup of the loop
U8 xSndStreamReady(U32 owner)
U32 xSndStreamReady(U32 owner)
{
for (xSndVoiceInfo* voice = gSnd.voice; voice != gSnd.voice + 6; voice++)
xSndVoiceInfo* begin = gSnd.voice;
xSndVoiceInfo* end = begin + 6;

for (xSndVoiceInfo* v = begin; v != end; v++)
{
if (voice->lock_owner == owner)
if (v->lock_owner == owner)
{
return !(voice->flags & 1);
return (v->flags & 1) >> 5; // Missing cntlzw instruction.
}
}

return 0;
}
#endif

#if 0
// Same issue as xSndStreamReady
void xSndStreamUnlock(U32 owner)
{
xSndVoiceInfo* voice = gSnd.voice;
for (; voice != gSnd.voice + 6; voice++)
xSndVoiceInfo* begin = gSnd.voice;
xSndVoiceInfo* end = begin + 6;

for (xSndVoiceInfo* v = begin; v != end; v++)
{
if (voice->lock_owner == owner)
if (v->lock_owner == owner)
{
voice->lock_owner = 0;
v->lock_owner = 0;
return;
}
}
}
#endif

#if 0
U32 xSndCategoryGetsEffects(sound_category category)
Expand Down
27 changes: 10 additions & 17 deletions src/SB/Game/zCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,23 +205,20 @@ F32 EaseInOut(F32 param)
return param * (param * (zCamera_f_2_0 - zCamera_f_1_5 * param) + zCamera_f_0_5);
}

#if 0
void zCameraConversUpdate(xCamera* cam, F32 dt)
{
if (zcam_dest == NULL)
{
return;
}

// zcam_tmr should use f2 instead of f1
if (zcam_tmr <= zCamera_f_0_0)
if (zcam_tmr <= 0.0f)
{
zcam_tmr = zCamera_f_0_0;
zcam_tmr = 0.0f;
return;
}

// zCamera_f_1_0 should use f1 instead of f2
if ((dt / zcam_tmr) > zCamera_f_1_0)
if ((dt / zcam_tmr) > 1.0f)
{
cam->mat.right = zcam_dest->right;
cam->mat.up = zcam_dest->up;
Expand All @@ -232,9 +229,9 @@ void zCameraConversUpdate(xCamera* cam, F32 dt)
}
else
{
F32 ease1 = EaseInOut(zCamera_f_1_0 - (zcam_tmr / zcam_ttm));
F32 ease2 = EaseInOut(zCamera_f_1_0 - (zcam_tmr - dt) / zcam_ttm);
F32 t = (ease2 - ease1) / (zCamera_f_1_0 - ease1);
F32 ease1 = EaseInOut(1.0f - (zcam_tmr / zcam_ttm));
F32 ease2 = EaseInOut(1.0f - (zcam_tmr - dt) / zcam_ttm);
F32 t = (ease2 - ease1) / (1.0f - ease1);

xQuat tOld;
xQuat tNew;
Expand All @@ -247,7 +244,6 @@ void zCameraConversUpdate(xCamera* cam, F32 dt)

zcam_tmr = zcam_tmr - dt;
}
#endif

F32 TranSpeed(zFlyKey keys[])
{
Expand Down Expand Up @@ -308,7 +304,6 @@ void zCameraFlyStart(U32 assetID)
}
#endif

#if 0
void zCameraFreeLookSetGoals(xCamera* cam, F32 pitch_s, F32& dgoal, F32& hgoal,
F32& pitch_goal, F32& lktm, F32 dt)
{
Expand Down Expand Up @@ -408,20 +403,18 @@ void zCameraFreeLookSetGoals(xCamera* cam, F32 pitch_s, F32& dgoal, F32& hgoal,
pitch_goal = -pitch_s * (zcam_above_pitch - p) + p;
}

// f0 and f1 should be swapped from here
if (lktm > zCamera_f_0_1)
if (lktm > 0.1f)
{
lktm -= dt;
if (lktm < zCamera_f_0_1)
if (lktm < 0.1f)
{
lktm = zCamera_f_0_1;
lktm = 0.1f;
}
return;
}

lktm = zCamera_f_0_1;
lktm = 0.1f;
}
#endif

void zCameraSetBbounce(S32 bbouncing)
{
Expand Down
19 changes: 8 additions & 11 deletions src/SB/Game/zFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,22 @@ void zFXGoo_SceneEnter()
goo_timer_textbox = (ztextbox*)zSceneFindObject(gameID);
}

#if 0
void zFXGoo_SceneReset()
{
// This almost matches, only two instructions are flipped.
// otherwise, its perfect.
S32 i;
zFXGooInstance* goo = zFXGooInstances;

for (i = 0; i < 24; i++)
for (i = 0; i < 24;)
{
if (goo->state != zFXGooStateInactive)
{
goo->state = zFXGooStateNormal;
}
i++;
goo++;
}
}

#endif

void zFXGoo_SceneExit()
{
S32 i;
Expand All @@ -128,16 +124,17 @@ void zFXUpdate(F32 dt)
xFXUpdate(dt);
}

#if 0
// Idk what the name of the other function is.
namespace
{
void add_popper_tweaks() { }
}

void init_poppers()
{
reset_poppers();
add_popper_tweaks__17 @unnamed @zFX_cpp @Fv();
add_popper_tweaks();
}

#endif

void xDebugAddTweak(const char* unk1, const char* unk2, const tweak_callback* unk3, void* unk4,
U32 unk5)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SB/Game/zFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void reset_poppers();

void reset_entrails();

void init_poppers();
static void init_poppers();

void update_poppers(F32 dt);

Expand Down
18 changes: 8 additions & 10 deletions src/SB/Game/zGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ extern F32 lbl_803CF5AC; // A
extern F32 lbl_803CDA54;
extern F32 lbl_803CDA58;

extern char stringBase0[];

#ifdef NON_MATCHING
// Scheduling, I guess
void zGameInit(U32 theSceneID)
Expand Down Expand Up @@ -214,41 +216,37 @@ S32 zGameOkToPause()
return uVar1;
}

#ifdef NON_MATCHING
void zGamePause()
{
if (!zGameIsPaused())
{
if ((globals.sceneCur)->sceneID == 0x50473132)
if ((globals.sceneCur)->sceneID == 'PG12')
{
zGameStall();
}
else
{
zEntEvent("techbutton6_click", 24);
zEntEvent("SAVING GAME ICON UI", 4);
zEntEvent("MNU4 AUTO SAVE FAILED", 4);
zEntEvent("MNU4 SAVE COMPLETED", 4);
zEntEvent(stringBase0 + 0xff, 24); // "techbutton6_click"
zEntEvent(stringBase0 + 0x111, 4); // "SAVING GAME ICON UI"
zEntEvent(stringBase0 + 0x125, 4); // "MNU4 AUTO SAVE FAILED"
zEntEvent(stringBase0 + 0x13b, 4); // "MNU4 SAVE COMPLETED"
iPadStopRumble(globals.pad0);
zGameModeSwitch(eGameMode_Pause);
zGameStateSwitch(0);
}
}
}
#endif

#ifdef NON_MATCHING
void zGameStall()
{
if (!zGameIsPaused())
{
zGameModeSwitch(eGameMode_Stall);
xSndPauseAll(1, 1);
iPadStopRumble(globals.pad0);
zEntEvent("techbutton6_click", 24);
zEntEvent(stringBase0 + 0xff, 24); // "techbutton6_click"
}
}
#endif

void zGameTakeSnapShot(RwCamera*)
{
Expand Down
2 changes: 1 addition & 1 deletion src/SB/Game/zLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void zLightAddLocalEnv()
iLight* light = &zlight->light;
iLightEnv(light, 1);
light->hw->inWorld.prev = gLightWorld->directionalLightList.link.prev;
light->hw->inWorld.next = gLightWorld->directionalLightList.link.next;
light->hw->inWorld.next = &gLightWorld->directionalLightList.link;
gLightWorld->directionalLightList.link.prev->next = &light->hw->inWorld;
gLightWorld->directionalLightList.link.prev = &light->hw->inWorld;

Expand Down
5 changes: 1 addition & 4 deletions src/SB/Game/zTaskBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,14 @@ bool ztaskbox::exists(state_enum stage)
return state != STATE_BEGIN && xSTFindAsset(state, NULL);
}

#if 0
void ztaskbox::on_talk_start()
{
if (this->cb != NULL)
{
// SOMETHING.
cb->on_talk_start();
}
}

#endif

void ztaskbox::talk_callback::on_start()
{
this->task->on_talk_start();
Expand Down