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
52 changes: 25 additions & 27 deletions src/SB/Core/gc/iTRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,71 +73,69 @@ void ROMFont::DrawTextBox(int, int, int, int, char*)

}



int ResetButton::EnableReset()
{
return ResetButton::mResetEnabled = 1;
void ResetButton::EnableReset()
{
ResetButton::mResetEnabled = 1;
}

int ResetButton::DisableReset()
{
return ResetButton::mResetEnabled = 0;
void ResetButton::DisableReset()
{
ResetButton::mResetEnabled = 0;
}

void ResetButton::SetSndKillFunction(void (*Func)())
{

ResetButton::mSndKill = Func;
}

void ResetButton::CheckResetButton()
{

}

bool iTRCDisk::Init(void)
{
bool RFInit = ROMFont::Init();
return RFInit;
return ROMFont::Init();
}

void iTRCDisk::SetErrorMessage(const char*)
void iTRCDisk::SetErrorMessage(const char* message)
{

strcpy(mMessage, message);
}

void iTRCDisk::ResetMessage()
{
memset(mMessage, 0, 0x100);
}

void iTRCDisk::SetPadStopRumblingFunction(void (*)(void))
void iTRCDisk::SetPadStopRumblingFunction(void (*Func)())
{

mPadStopRumbling = Func;
}

void iTRCDisk::SetSndSuspendFunction(void (*)(void))
void iTRCDisk::SetSndSuspendFunction(void (*Func)())
{

mSndSuspend = Func;
}

void iTRCDisk::SetSndResumeFunction(void (*)(void))
void iTRCDisk::SetSndResumeFunction(void (*Func)())
{

mSndResume = Func;
}

void iTRCDisk::SetSndKillFunction(void (*)(void))
void iTRCDisk::SetSndKillFunction(void (*Func)())
{

mSndKill = Func;
}

void iTRCDisk::SetMovieSuspendFunction(void (*)(void))
void iTRCDisk::SetMovieSuspendFunction(void (*Func)())
{

mMovieSuspendFunction = Func;
}

void iTRCDisk::SetMovieResumeFunction(void (*)(void))
void iTRCDisk::SetMovieResumeFunction(void (*Func)())
{

mMovieResumeFunction = Func;
}

bool iTRCDisk::IsDiskIDed()
Expand All @@ -147,7 +145,7 @@ bool iTRCDisk::IsDiskIDed()

void iTRCDisk::DisplayErrorMessage()
{

}

void iTRCDisk::SetDVDState()
Expand Down
17 changes: 13 additions & 4 deletions src/SB/Core/gc/iTRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ namespace ROMFont
// Yes, this is a namespace, not a class.
namespace iTRCDisk
{
char mMessage[];
void (*mPadStopRumbling)();
void (*mSndSuspend)();
void (*mSndResume)();
void (*mSndKill)();
void (*mMovieSuspendFunction)();
void (*mMovieResumeFunction)();

void SetPadStopRumblingFunction(void (*)(void));
void SetSndSuspendFunction(void (*)(void));
void SetSndResumeFunction(void (*)(void));
Expand All @@ -41,14 +49,15 @@ namespace iTRCDisk
void SetDVDState();
void SetErrorMessage(const char*);
bool IsDiskIDed();
char mMessage();
} // namespace iTRCDisk

namespace ResetButton
{
int EnableReset();
int mResetEnabled;
int DisableReset();
bool mResetEnabled;
void (*mSndKill)();

void EnableReset();
void DisableReset();
void SetSndKillFunction(void (*func)());
void CheckResetButton();

Expand Down
146 changes: 146 additions & 0 deletions src/SB/Core/x/xEntMotion.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "xEntMotion.h"
#include "xMath.h"

#include <types.h>

Expand All @@ -12,3 +13,148 @@ void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v)
o->y = y;
o->z = z;
}

// Artificial
enum en_MOTIONTYPE
{
MOTION_TYPE_EXRT,
MOTION_TYPE_ORBT,
MOTION_TYPE_SPLN,
MOTION_TYPE_MVPT,
MOTION_TYPE_MECH,
MOTION_TYPE_PEND
};

void xEntMotionInit(xEntMotion* a, xEnt* b, xEntMotionAsset* c)
{
a->asset = c;
a->type = c->type;
a->flags = c->flags;

if (a->type == MOTION_TYPE_EXRT)
{
xVec3Copy(&a->er.a, &c->er.ret_pos);
xVec3Add(&a->er.b, &c->er.ret_pos, &c->er.ext_dpos);

a->er.et = c->er.ext_tm;
a->er.wet = c->er.ext_wait_tm;
a->er.rt = c->er.ret_tm;
a->er.wrt = c->er.ret_wait_tm;

if (a->er.p <= 0)
{
a->er.p = 10.0f;
}

a->er.brt = a->er.et + a->er.wet;
a->er.ert = a->er.brt + a->er.rt;
a->er.p = a->er.ert + a->er.wrt;
}
else if (a->type == MOTION_TYPE_ORBT)
{
xVec3Copy((xVec3*)(&a->er.b), &c->er.ret_pos);

a->orb.a = c->orb.w;
a->orb.b = c->orb.h;

if (c->orb.period <= 0.0f)
{
c->orb.period = 10.0f;
}

a->orb.p = c->orb.period;
a->orb.w = (2 * PI) / c->orb.period;
}
else if (a->type == MOTION_TYPE_MVPT)
{
// literally nothing
}
else if (a->type == MOTION_TYPE_PEND)
{
if (c->pen.period <= 1e-5f)
{
c->pen.period = 0;
}

a->pen.w = (2 * PI) / c->pen.period;
}
else if (a->type == MOTION_TYPE_MECH)
{
if (c->mp.speed < 1e-5f)
{
c->mp.speed = 0;
}

if (c->mech.sld_acc_tm + c->mech.sld_dec_tm > c->mech.sld_tm)
{
c->mech.sld_dec_tm =
c->mech.sld_acc_tm =
c->mech.sld_tm * 0.5f;
}

if (c->mech.rot_tm < 3.0f)
{
c->mech.rot_tm = 1.0f;
}

if (c->mech.type == 2)
{
if ( c->mech.rot_tm != c->mech.sld_tm )
{
c->mech.rot_tm = c->mech.sld_tm;
}
}
if (c->mech.rot_acc_tm + c->mech.rot_dec_tm > c->mech.rot_tm)
{
c->mech.rot_dec_tm =
c->mech.rot_acc_tm =
c->mech.rot_tm * 0.5f;
}
}

a->owner = b;
a->target = NULL;

xEntMotionDebugAdd(a);
}

void xEntMechForward(xEntMotion* motion)
{
xEntMotionMechData* mech = &(motion->asset->mech);
xEntMotionAsset* mkasst = motion->asset;

xEntMotionRun(motion);

if ((motion->mech.state != 0) && (motion->mech.state != 1) && (motion->mech.state != 2))
{
if (motion->mech.state == 3)
{
motion->mech.ss = -motion->mech.ss;
motion->mech.sr = -motion->mech.sr;
motion->tmr = mkasst->mech.sld_tm - motion->tmr;
motion->mech.state = 0;
}
else if (motion->mech.state == 4)
{
motion->mech.ss = -motion->mech.ss;
motion->mech.sr = -motion->mech.sr;
motion->tmr = mkasst->mech.rot_tm - motion->tmr;
motion->mech.state = 1;
}
else if ((motion->mech.state != 5) && (motion->mech.state != 6) && (motion->mech.state == 7))
{
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 = 0;
}
else
{
motion->mech.state = 1;
}
}
}
}
1 change: 1 addition & 0 deletions src/SB/Core/x/xEntMotion.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ void xEntMotionReset(xEntMotion* motion, xScene* sc);
void xEntMotionMove(xEntMotion* motion, xScene* sc, F32 dt, xEntFrame* frame);
void xEntMotionTranslate(xEntMotion* motion, const xVec3* dpos, xMat4x3* dmat);
void xEntMotionDebugInit(U16 num_xems);
void xEntMotionDebugAdd(xEntMotion*);
void xEntMotionDebugExit();
void xEntMotionStop(xEntMotion* motion);
void xEntMotionRun(xEntMotion* motion);
Expand Down
13 changes: 2 additions & 11 deletions src/SB/Core/x/xNPCBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,32 +103,23 @@ void xNPCBasic::Init(xEntAsset* asset)
baseFlags &= 0xffef;
}

// Register assignment in the floating point instructions is slightly wrong.
void xNPCBasic::Reset()
{
xEntReset(this);
DBG_PStatClear();
if (!(U32(flags1.flg_basenpc) & 0x2))
{
xVec3Copy(&frame->drot.axis, &g_Y3);
frame->drot.angle = xNPCBasic_float_0;
frame->drot.angle = 0.0f;
xVec3Copy(&frame->rot.axis, &g_Y3);
frame->rot.angle = asset->ang.x;
}

flags1.flg_basenpc |= 4;
colFreq = -1;

F32 f1 = xurand();
F32 f0 = xNPCBasic_float_onehalf;
F32 f2 = xNPCBasic_float_onequarter;
f1 -= f0;
f0 = xNPCBasic_float_15;
f1 = f2 * f1;
f0 = f0 * f1 + f0;
colFreqReset = (S32)f0;
colFreqReset = (15.0f * (0.25f * (xurand() - 0.5f))) + 15.0f;
RestoreColFlags();
return;
}

void NPC_alwaysUseSphere(xEnt* ent, xVec3* value)
Expand Down
22 changes: 6 additions & 16 deletions src/SB/Core/x/xString.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "xString.h"
#include "xMath.h"

#include <types.h>

Expand Down Expand Up @@ -76,24 +77,13 @@ U32 tolower__21_esc__2_unnamed_esc__2_xString_cpp_esc__2_Fi(U32 param_1)
}
}

/*
// Non-matching
S32 icompare(const substr& s1, const substr& s2)
{
S32 result;
U32 len;

len = s2.size;

if (s1.size < s2.size)
{
len = s1.size;
}

result = imemcmp(s1.text, s2.text, len);

if (result == 0)
U32 len = MIN(s1.size, s2.size);
S32 result = imemcmp(s1.text, s2.text, len);
switch (result)
{
case 0:
if (s1.size == s2.size)
{
result = 0;
Expand All @@ -106,7 +96,7 @@ S32 icompare(const substr& s1, const substr& s2)
result = -1;
}
}
break;
}
return result;
}
*/
2 changes: 1 addition & 1 deletion src/SB/Game/zNPCSpawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ st_XORDEREDARRAY* zNPCSpawner::FillPending()
{
ClearPending();
ReFillPending();
return &this->actvlist;
return (st_XORDEREDARRAY*)this->pendlist.cnt;
}

st_XORDEREDARRAY* zNPCSpawner::ReFillPending()
Expand Down
Loading