Skip to content

Commit

Permalink
Assorted matches
Browse files Browse the repository at this point in the history
  • Loading branch information
escape209 committed Aug 31, 2024
1 parent bf09039 commit c4a15be
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 74 deletions.
33 changes: 18 additions & 15 deletions src/SB/Core/gc/iSnd.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "iSnd.h"

#include "intrin.h"

#include <types.h>

#include "dolphin/dolphin.h"
Expand Down Expand Up @@ -40,23 +42,22 @@ void iSndInitSceneLoaded()
{
}

#ifdef NON_MATCHING
U32 iVolFromX(F32 param1)
{
float f = MAX(param1, _1263);
float f = MAX(param1, 1e-20f);

S32 i = _1262 * xlog(f);
i = (i & i >> 0x1f);
if (i < -0x388)
S32 i = 43.43f * xlog(f);
S32 comp = i & (i >> 0x1f);

if (comp < -0x388)
{
return -0x388;
}
else
{
return (i & i >> 0x1f);
return i & (i >> 0x3f);
}
}
#endif

void iSndVolUpdate(xSndVoiceInfo* info, vinfo* vinfo)
{
Expand Down Expand Up @@ -122,28 +123,30 @@ void iSndWaitForDeadSounds()
}
#endif

//
void iSndSuspendCD(U32)
{
}

void iSndMessWithEA(sDSPADPCM* param1) //sDSPADPCM*
void iSndMessWithEA(sDSPADPCM* param1)
{
if (param1 != NULL)
{
param1->buffer[5] = SampleToNybbleAddress(param1->buffer[0] - 1);
}
}

#if 0
U32 SampleToNybbleAddress(U32 sample)
{
U32 i = sample * 0x124924925U >> 0x20;
i = i & 0xfffffff0;
i = i + sample % 0xe + 2;
return i;
U32 a = __mulhwu(0x24924925, sample);
U32 b = (sample - a) >> 1;

a = b + a;
b = (a >> 3);
a = (a << 1) & 0xfffffff0;
a = a + (sample - (b * 0xe)) + 2;

return a;
}
#endif

void sndloadcb(tag_xFile* tag)
{
Expand Down
2 changes: 0 additions & 2 deletions src/SB/Core/x/xBehaveMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern S32 g_modinit_xBehaveMgr;
extern xBehaveMgr* g_behavmgr;

#ifdef NON_MATCHING
void xBehaveMgr_Startup()
{
if (g_modinit_xBehaveMgr++ == 0)
Expand All @@ -17,7 +16,6 @@ void xBehaveMgr_Startup()
g_behavmgr->Startup(0xfa, 0xfa);
}
}
#endif

#if 0
void xBehaveMgr_Shutdown()
Expand Down
1 change: 0 additions & 1 deletion src/SB/Game/zActionLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ void zActionLineInit()
}
}

// Equivalent. Compiler is optimizing out the reduntant float load.
void zActionLineUpdate(F32 seconds)
{
for (S32 i = 0; i < 8; i++)
Expand Down
10 changes: 6 additions & 4 deletions src/SB/Game/zTaskBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ void ztaskbox::fail()
}
}

#if 0
// Why does the compiler add a random compare at the end????
void ztaskbox::complete()
{
if (this->flag.enabled)
Expand All @@ -182,11 +180,15 @@ void ztaskbox::complete()
this->flag.enabled = false;
zEntEvent(this, this, eEventTaskBox_OnComplete);
this->current = (ztaskbox*)zSceneFindObject(this->asset->next_task);

// Bruh
if (this->current != NULL)
{
return;
}
}
}

#endif

void ztaskbox::set_callback(callback* cb)
{
this->cb = cb;
Expand Down
27 changes: 12 additions & 15 deletions src/SB/Game/zThrown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,22 @@ void Recurse_TranslateStack(xEnt* ent, xVec3* delta)
sDebugDepth--;
}

#if 0
// WIP.
void zThrown_PatrickLauncher(xEnt* ent, xEnt* launcher)
{
for (U32 i = 0; i < zThrownCount; i++)
int i = 0;

for (; i < zThrownCount; i++)
{
if (ent == zThrownList[i].ent)
{
zThrownList[i].patLauncher = launcher;
}
break;
}
}

#endif
if (i != zThrownCount)
{
zThrownStruct* listInd = &zThrownList[i];
listInd->patLauncher = launcher;
}
}

void zThrownCollide_ThrowFreeze(zThrownStruct* thrown, xEntCollis* collis, float* bounce,
float* friction)
Expand Down Expand Up @@ -117,23 +119,18 @@ S32 zThrown_IsFruit(xEnt* ent, F32* stackHeight)

#endif

#if 0
// Random OR added in.
void checkAgainstButtons(xEnt* ent)
{
xVec3* d = xBoundCenter(&ent->bound);
struct
{
xVec3 center;
F32 unk;
} data;
xVec3Copy(&data.center, d);
data.unk = _842;
xVec3Copy(&data.center, xBoundCenter(&ent->bound));
data.unk = 0.5f;
zSceneForAllBase(zThrown_ButtonIteratorCB, 0x18, (void*)&data);
}

#endif

void xDrawSphere(const xSphere*, U32)
{
}
67 changes: 30 additions & 37 deletions src/SB/Game/zVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,29 +567,30 @@ U32 zVarEntryCB_SndMode(void* arg)
return gSnd.stereo;
}

#if 0
// Can't get the fp register assignment right for these regardless of what
// order I put the three expressions in.
extern F64 volumeMod1;
extern F64 volumeMod2;

U32 zVarEntryCB_SndMusicVol(void* arg)
{
return volumeMod2 + gSnd.categoryVolFader[2] * volumeMod1;
F64 f0 = 10.0;
F64 f1 = 0.5;
F64 f2 = gSnd.categoryVolFader[2];

f2 *= f1;
f2 = f0 + f2;

return f2;
}

U32 zVarEntryCB_SndFXVol(void* arg)
{
return volumeMod2 + gSnd.categoryVolFader[0] * volumeMod1;
F64 f0 = 10.0;
F64 f1 = 0.5;
F64 f2 = gSnd.categoryVolFader[0];

f2 *= f1;
f2 = f0 + f2;

return f2;
}
#endif

#if 0
// The branching in this function is totally stupid, no idea how to untangle
// what they originally wrote here because the code makes no sense. I think
// that it might be trying to return the number of save games which aren't
// empty, but is had a bug where one of the calls is xSGGameIsEmpty(NULL, 0)
// instead of xSGGameIsEmpty(NULL, 2) thanks to a copy-paste error.
U32 zVarEntryCB_MCAvailable(void* arg)
{
if (xSGGameIsEmpty(NULL, 0) == 1)
Expand All @@ -598,33 +599,25 @@ U32 zVarEntryCB_MCAvailable(void* arg)
{
return 0;
}
else if (xSGGameIsEmpty(NULL, 1) == 0)
{
return 0;
}
else
if (xSGGameIsEmpty(NULL, 1) == 0)
{
return 2;
}
}
else if (xSGGameIsEmpty(NULL, 0))
{
return 0;
}
else if (xSGGameIsEmpty(NULL, 1))
{
return 1;
}
else if (xSGGameIsEmpty(NULL, 1))
else if (xSGGameIsEmpty(NULL, 0) == 0)
{
return 0;
}
else
{
return 3;
if (xSGGameIsEmpty(NULL, 1) == 1)
{
return 1;
}
if (xSGGameIsEmpty(NULL, 1) == 0)
{
return 3;
}
}

return 0;
}
#endif

U32 zVarEntryCB_VibrationOn(void* arg)
{
Expand All @@ -633,7 +626,7 @@ U32 zVarEntryCB_VibrationOn(void* arg)
return globals.option_vibration & 0x1;
}

S32 zVarEntryCB_CurrentSceneLetter()
S32 zVarEntryCB_CurrentSceneLetter(void*)
{
char buffer[16];
sprintf(buffer, &zVar_strings[0x10] /*"%s"*/, xUtil_idtag2string(globals.sceneCur->sceneID, 0));
Expand All @@ -655,7 +648,7 @@ S32 zVarEntryCB_CurrentSceneLetter()
return (mostSignificantChar - 'A') + 1;
}

S32 zVarEntryCB_CurrentRoom()
S32 zVarEntryCB_CurrentRoom(void*)
{
char buffer[16];
sprintf(buffer, &zVar_strings[0x10] /*"%s"*/, xUtil_idtag2string(globals.sceneCur->sceneID, 0));
Expand Down

0 comments on commit c4a15be

Please sign in to comment.