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
5 changes: 5 additions & 0 deletions config/SOME01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,7 @@ GameUtil/TickFlow.cpp:
.text start:0x801DD6F4 end:0x801DEFE4
.rodata start:0x802E4CA0 end:0x802E4D50
.data start:0x8031E748 end:0x8031E8B0
.sdata2 start:0x80329670 end:0x80329698
.bss start:0x803D5D38 end:0x803D5D78

GameUtil/TickFlowManager.cpp:
Expand Down Expand Up @@ -3106,6 +3107,10 @@ GameUtil/InputCheckManager.cpp:

GameUtil/TimeRatio.cpp:
.text start:0x801E9D90 end:0x801EAA7C
.rodata start:0x802E50A4 end:0x802E50C0
.data start:0x8031E9B8 end:0x8031EA40
.sdata start:0x803200A0 end:0x803200B8
.sdata2 start:0x80329770 end:0x803297A0

GameUtil/List.cpp:
.text start:0x801EAA7C end:0x801EAC38
Expand Down
10 changes: 5 additions & 5 deletions config/SOME01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7919,14 +7919,14 @@ _08__16CCellAnimManagerFv = .text:0x801DABCC; // type:function size:0x90
_14__16CCellAnimManagerFv = .text:0x801DAC5C; // type:function size:0x138
_18__16CCellAnimManagerFv = .text:0x801DAD94; // type:function size:0x8C
_1C__16CCellAnimManagerFPFv_vPFv_v = .text:0x801DAE20; // type:function size:0x178
fn_801DAF98 = .text:0x801DAF98; // type:function size:0x190
fn_801DB128 = .text:0x801DB128; // type:function size:0x164
_20__16CCellAnimManagerFlPFv_vPFv_v = .text:0x801DAF98; // type:function size:0x190
_24__16CCellAnimManagerFlPFv_vPFv_v = .text:0x801DB128; // type:function size:0x164
fn_801DB28C__16CCellAnimManagerFv = .text:0x801DB28C; // type:function size:0x14C
fn_801DB3D8__16CCellAnimManagerFUcP16CellAnim_CellOBJil = .text:0x801DB3D8; // type:function size:0x180
fn_801DB558__16CCellAnimManagerFUc = .text:0x801DB558; // type:function size:0x10
fn_801DB568__16CCellAnimManagerFPvPvUc = .text:0x801DB568; // type:function size:0x304
fn_801DB86C = .text:0x801DB86C; // type:function size:0x154
fn_801DB9C0 = .text:0x801DB9C0; // type:function size:0xD8
fn_801DB86C__16CCellAnimManagerFP9_GXTexObjllffUc = .text:0x801DB86C; // type:function size:0x154
fn_801DB9C0__16CCellAnimManagerFP9_GXTexObjUc = .text:0x801DB9C0; // type:function size:0xD8
fn_801DBA98__16CCellAnimManagerFUc = .text:0x801DBA98; // type:function size:0xC0
fn_801DBB58__16CCellAnimManagerFP9CCellAnim = .text:0x801DBB58; // type:function size:0x104
fn_801DBC5C__16CCellAnimManagerFP9CCellAnim = .text:0x801DBC5C; // type:function size:0x20
Expand Down Expand Up @@ -8173,7 +8173,7 @@ _14__8CTRFloatFv = .text:0x801EA6A4; // type:function size:0x1C
__ct__11CTRParabolaFv = .text:0x801EA6C0; // type:function size:0x1C4
__dt__11CTRParabolaFv = .text:0x801EA884; // type:function size:0x5C
fn_801EA8E0__11CTRParabolaFfffffff = .text:0x801EA8E0; // type:function size:0x150
fn_801EAA30 = .text:0x801EAA30; // type:function size:0x4C
_14__11CTRParabolaFv = .text:0x801EAA30; // type:function size:0x4C
finalDestroy__5CListFv = .text:0x801EAA7C; // type:function size:0x4
finalInsert__5CListFv = .text:0x801EAA80; // type:function size:0x4
__ct__5CListFv = .text:0x801EAA84; // type:function size:0x1C
Expand Down
4 changes: 4 additions & 0 deletions include/nw4r/math/arithmetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ inline f32 FModf(f32 x, f32* pY) {
}

inline f32 FSqrt(f32 x) {
if (!(x >= 0.0f)) {
NW4R_WARNING(627, "FSqrt: Input is out of the domain.");
}

return x <= 0.0f ? 0.0f : x * FrSqrt(x);
}

Expand Down
121 changes: 120 additions & 1 deletion src/Game/ExFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

#include "Mem.hpp"

#include "SceneManager.hpp"
#include "GameManager.hpp"
#include "CheckPointManager.hpp"
#include "MyCanvas.hpp"

#include "ExScene.hpp"

#include "ExFlowDecl.hpp"

CExFlow::CExFlow(const TickFlowCode *code, f32 initRest) :
CTickFlow(code, initRest)
{}
Expand All @@ -10,8 +19,118 @@ TICKFLOW_IMPL_CREATE_FN(CExFlow)

CExFlow::~CExFlow(void) {}

// TODO: many many commands
bool CExFlow::_1C(u32 opcode, u32 arg0, const s32 *args) {
// TODO: implement
switch (opcode) {
case TF_SET_SCENE: {
if (arg0 == 0) {
gSceneManager->fn_80089FE0(static_cast<ESceneID>(args[0]), reinterpret_cast<const TickFlowCode *>(args[1]));
} else
if (arg0 == 1) {
gSceneManager->setUnk404(true);
}
} break;
case TF_SET_SCENE_VER: {
gSceneManager->fn_8008A4DC(static_cast<ESceneID>(args[0]), args[1]);
} break;
case TF_SCENE_ASSETS: {
if (arg0 == 0) {
gSceneManager->fn_8008A704(static_cast<ESceneID>(args[0]));
} else
if (arg0 == 1) {
gSceneManager->fn_8008A82C(static_cast<ESceneID>(args[0]));
}
} break;
case TF_CHECK_SCENE_HIST: {
if (arg0 == 0) {
mCondvar = gSceneManager->fn_8008B0FC(args[0], args[1]);
} else
if (arg0 == 1) {
mCondvar = gSceneManager->fn_8008B118(static_cast<ESceneID>(args[0]));
}
} break;
case TF_GET_SCENE_RUNNING: {
if (gGameManager->getCurrentScene()->getState() == CScene::eState_Active) {
mCondvar = true;
} else {
mCondvar = false;
}
} break;

case TF_CHECKPOINT_SET_CRITERIA: {
gCheckPointManager->setUnkC5(args[0]);
} break;
case TF_CHECKPOINT_ENABLE_SCORING: {
gCheckPointManager->setUnkDD(args[0]);
} break;
case TF_11B: {
gCheckPointManager->setUnkCC(args[0]);
gCheckPointManager->setUnkD0(args[0]);
} break;

case TF_125: {
if (arg0 == 0) {
gMyCanvasManager->fn_8007BF6C(args[0],
static_cast<u32>(args[1]) / 256.0f, static_cast<u32>(args[2]) / 256.0f);
} else
if (arg0 == 1) {
gMyCanvasManager->fn_8007C000(args[0], args[1], (u8)args[2], args[3],
static_cast<u32>(args[4]) / 256.0f, static_cast<u32>(args[5]) / 256.0f);
} else
if (arg0 == 2) {
gMyCanvasManager->fn_8007C200(args[0]);
}
} break;

case TF_LOAD_SND_GROUP: {
fn_8008364C(args[0], static_cast<ESoundHeap>(arg0));
} break;
case TF_CLEAR_SND_HEAP: {
fn_80083668(static_cast<ESoundHeap>(arg0));
} break;
case TF_RESET_SND_GROUP_HEAP: {
fn_800836C0(static_cast<ESoundHeap>(arg0));
} break;
case TF_SND_LOADING: {
if (arg0 == 0) {
fn_800836E0(args[0]);
} else
if (arg0 == 1) {
mCondvar = lbl_80320440;
}
} break;

case TF_REMIX8_MASK: {
if (arg0 == 0) {
CExScene::fn_8000A084();
} else
if (arg0 == 1) {
CExScene::fn_8000A0A4();
} else
if (arg0 == 2) {
mCondvar = CExScene::fn_8000A0EC();
} else
if (arg0 == 3) {
CExScene::fn_8000A0F8();
} else
if (arg0 == 4) {
CExScene::fn_8000A1D4(args[0]);
} else
if (arg0 == 5) {
CExScene::fn_8000A1E0(args[0]);
}
} break;

case TF_141: {
if (arg0 == 0) {
mCondvar = SCGetAspectRatio() == args[0];
}
} break;

default: {
return CTickFlow::_1C(opcode, arg0, args);
}
}
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions src/GameUtil/CellAnim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ class CCellAnim : public CList {
bool getPlaybackReverse(void) const { return mReversePlayback; }
void setPlaybackReverse(bool reversed) { mReversePlayback = reversed; }

void setDestroyAtEnd(bool destroy) { mDestroyAtEnd = destroy; }

CCellAnim *getBaseAnim(void) const { return mBaseAnim; }

CCellAnim *getBaseLinkedHead(void) const { return mBaseLinkedHead; }
Expand Down
62 changes: 61 additions & 1 deletion src/GameUtil/CellAnimManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void CCellAnimManager::_18(void) {
}
}

// not matching (argument passing via stack/high registers, maybe a struct?)
static void setupProj(Mtx44 mtx, f32 left, f32 top, f32 right, f32 bottom, f32 near, f32 far, f32 wWide, f32 wStd) {
if (SCGetAspectRatio() == SC_ASPECT_STD) {
C_MTXOrtho(mtx, top, bottom, left, right, near, far);
Expand Down Expand Up @@ -116,6 +117,61 @@ void CCellAnimManager::_1C(DrawSetupFn setupFn, DrawRestoreFn endFn) {
}
}

void CCellAnimManager::_20(s32 lastLayer, DrawSetupFn setupFn, DrawRestoreFn endFn) {
if (setupFn) {
setupFn();
}
else {
fn_801DB28C();
}

Mtx44 projMtx;
setupProj(projMtx, -304.0f, -228.0f, 304.0f, 228.0f, 0.0f, 10000.0f, 832.0f, 608.0f);
GXSetProjection(projMtx, GX_ORTHOGRAPHIC);

for (CCellAnim *cellAnim = mCellAnimHead; cellAnim != NULL; cellAnim = cellAnim->getNext()) {
cellAnim->makeMtx(TRUE, NULL);
}
for (CCellAnim *cellAnim = mCellAnimHead; cellAnim != NULL; cellAnim = cellAnim->getNext()) {
if (cellAnim->getLayer() < lastLayer) {
break;
}
if (cellAnim->getEnabled()) {
cellAnim->draw(FALSE);
}
}

if (endFn) {
endFn();
}
}

void CCellAnimManager::_24(s32 lastLayer, DrawSetupFn setupFn, DrawRestoreFn endFn) {
if (setupFn) {
setupFn();
}
else {
fn_801DB28C();
}

Mtx44 projMtx;
setupProj(projMtx, -304.0f, -228.0f, 304.0f, 228.0f, 0.0f, 10000.0f, 832.0f, 608.0f);
GXSetProjection(projMtx, GX_ORTHOGRAPHIC);

for (CCellAnim *cellAnim = mCellAnimHead; cellAnim != NULL; cellAnim = cellAnim->getNext()) {
if (!(cellAnim->getLayer() < lastLayer)) {
continue;
}
if (cellAnim->getEnabled()) {
cellAnim->draw(FALSE);
}
}

if (endFn) {
endFn();
}
}

void CCellAnimManager::fn_801DB28C(void) {
GXSetTevDirect(GX_TEVSTAGE0);
GXClearVtxDesc();
Expand All @@ -141,6 +197,7 @@ bool CCellAnimManager::fn_801DB558(u8 bankID) {
return mBank[bankID].loaded;
}

// not matching (messy function)
void CCellAnimManager::fn_801DB568(void *brcadAddr, void *tplAddr, u8 bankID) {
CellAnim_Bank *bank = &mBank[bankID];

Expand Down Expand Up @@ -307,17 +364,20 @@ void CCellAnimManager::fn_801DBA98(u8 bankID) {
}

u16 CCellAnimManager::fn_801DBB58(CCellAnim *cellAnim) {
return 0;
CellAnim_Anim *anim = fn_801DBC5C(cellAnim);
return anim->getTotalFrameCount();
}

CellAnim_Anim *CCellAnimManager::fn_801DBC5C(CCellAnim *cellAnim) {
return &mBank[cellAnim->getBankID()].animArr[cellAnim->getAnimID()];
}

// not matching (regswap in lol)
CellAnim_AnimKey *CCellAnimManager::fn_801DBC7C(CCellAnim *cellAnim) {
return lol(cellAnim);
}

// not matching (regswap in lol)
CellAnim_Cell *CCellAnimManager::fn_801DBD38(CCellAnim *cellAnim) {
CellAnim_Bank *bank = &mBank[cellAnim->getBankID()];

Expand Down
8 changes: 8 additions & 0 deletions src/GameUtil/CellAnimStr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ struct CellAnim_Anim {

return frame;
}

u16 getTotalFrameCount(void) const {
u16 frameCount = 0;
for (s32 i = 0; i < keyCount; i++) {
frameCount += keyArr[i].frameCount;
}
return frameCount;
}
};

struct CellAnim_Bank {
Expand Down
12 changes: 11 additions & 1 deletion src/GameUtil/CheckPointManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,21 @@ class CCheckPointManager : public TSingleton<CCheckPointManager> {
void setUnkC4(u8 arg0) {
unkC4 = arg0;
}
void setUnkC5(u8 arg0) {
unkC5 = arg0;
}
u8 getUnkC5(void) {
return unkC5;
}

void setUnkDD(u8 unk) { unkDD = unk; }
void setUnkCC(s32 arg0) {
unkCC = arg0;
}
void setUnkD0(u32 arg0) {
unkD0 = arg0;
}

void setUnkDD(bool unk) { unkDD = unk; }
u8 getUnkDD(void) const { return unkDD; }

bool doUnkCheck(u16 arg0, u16 arg1, f32 arg2) {
Expand Down
2 changes: 1 addition & 1 deletion src/GameUtil/DebugPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void CDebugPrint::fn_801EC674(s32 x, s32 y, s32 frames, const char *format, ...)
va_end(args);
}

// non matching: data
// not matching (data;
// ptmfs are misplaced, may have something
// to do with the pool data hack below
// (needed to match fn_801EC850)
Expand Down
6 changes: 3 additions & 3 deletions src/GameUtil/InputCheckManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

static u8 lbl_803D5D78[16];

// regswaps
// not matching (regswaps)
void CInputCheckManager::fn_801E8118(void) {
static const u32 lbl_802E4FE0[] = {
WPAD_BUTTON_UP, WPAD_BUTTON_DOWN, WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT,
Expand Down Expand Up @@ -205,6 +205,7 @@ void CInputCheckManager::_14(void) {
unk48D = false;
}

// not matching (see updateUnk0C)
void CInputCheckManager::fn_801E8A08(void) {
if (mGamePaused) {
return;
Expand All @@ -215,12 +216,11 @@ void CInputCheckManager::fn_801E8A08(void) {
}
fn_801E8BD0();
updateUnk10();
// not matching in updateUnk0C
updateUnk0C();
}


// regswaps, missing code (may be nonequivalent)
// not matching (regswap between i and next)
void CInputCheckManager::fn_801E8BD0(void) {
u32 temp_r23;
CInputChecker *cur;
Expand Down
5 changes: 4 additions & 1 deletion src/GameUtil/InputCheckManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class CInputCheckManager : public TSingleton<CInputCheckManager> {
void setUnk429(bool allow) {
mAllowInput = allow;
}
void setUnk42A(bool allow, s32 controller) {
mAllowInputController[controller] = allow;
}
void setUnk42A(bool allow) {
mAllowInputController[0] = allow;
}
Expand Down Expand Up @@ -203,7 +206,7 @@ class CInputCheckManager : public TSingleton<CInputCheckManager> {
}

void updateUnk0C(void) {
// not matching: regswap cur/next
// not matching (regswap cur/next)
for (CInputChecker *cur = mCheckerHead, *next; cur != NULL; cur = next) {
next = cur->getNext();
if (!cur->_18()) {
Expand Down
Loading
Loading