mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-03 22:44:30 +00:00
Match/Improve a bunch of non matchings (#342)
This commit is contained in:
parent
281aaa0cb6
commit
49609dd78b
37 changed files with 137 additions and 2673 deletions
|
@ -536,21 +536,21 @@ void Fault_Wait5Seconds(void) {
|
|||
sFaultStructPtr->faultActive = true;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences
|
||||
void Fault_WaitForButtonCombo() {
|
||||
Input* curInput = &sFaultStructPtr->padInput;
|
||||
Input** curInputPtr = &curInput;
|
||||
s32 state;
|
||||
u32 s1;
|
||||
u32 s2;
|
||||
u32 kDown;
|
||||
u32 kCur;
|
||||
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
|
||||
osSyncPrintf(
|
||||
VT_FGCOL(WHITE) "KeyWaitB (LRZ " VT_FGCOL(WHITE) "上" VT_FGCOL(YELLOW) "下 " VT_FGCOL(YELLOW) "上" VT_FGCOL(WHITE) "下 " VT_FGCOL(WHITE) "左" VT_FGCOL(
|
||||
YELLOW) "左 " VT_FGCOL(YELLOW) "右" VT_FGCOL(WHITE) "右 " VT_FGCOL(GREEN) "B" VT_FGCOL(BLUE) "A" VT_FGCOL(RED) "START" VT_FGCOL(WHITE)
|
||||
VT_RST "\n");
|
||||
YELLOW) "左 " VT_FGCOL(YELLOW) "右" VT_FGCOL(WHITE) "右 " VT_FGCOL(GREEN) "B" VT_FGCOL(BLUE) "A" VT_FGCOL(RED) "START" VT_FGCOL(WHITE) ")" VT_RST
|
||||
"\n");
|
||||
osSyncPrintf(VT_FGCOL(WHITE) "KeyWaitB'(LR左" VT_FGCOL(YELLOW) "右 +" VT_FGCOL(RED) "START" VT_FGCOL(
|
||||
WHITE) ")" VT_RST "\n");
|
||||
|
||||
|
@ -568,10 +568,8 @@ void Fault_WaitForButtonCombo() {
|
|||
kDown = curInput->press.in.button;
|
||||
kCur = curInput->cur.in.button;
|
||||
|
||||
if (kCur == 0) {
|
||||
if (s1 == s2) {
|
||||
s1 = 0;
|
||||
}
|
||||
if ((kCur == 0) && (s1 == s2)) {
|
||||
s1 = 0;
|
||||
} else if (kDown != 0) {
|
||||
if (s1 == s2) {
|
||||
state = 0;
|
||||
|
@ -682,9 +680,6 @@ void Fault_WaitForButtonCombo() {
|
|||
osWritebackDCacheAll();
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_WaitForButtonCombo.s")
|
||||
#endif
|
||||
|
||||
void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
|
||||
u32* alignedAddr;
|
||||
|
|
|
@ -179,8 +179,6 @@ OSScTask* func_800C89D4(SchedContext* sc, OSScTask* task) {
|
|||
return task;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc
|
||||
s32 Sched_Schedule(SchedContext* sc, OSScTask** sp, OSScTask** dp, s32 state) {
|
||||
s32 ret = state;
|
||||
OSScTask* gfxTask = sc->gfxListHead;
|
||||
|
@ -195,7 +193,7 @@ s32 Sched_Schedule(SchedContext* sc, OSScTask** sp, OSScTask** dp, s32 state) {
|
|||
sc->audioListTail = NULL;
|
||||
}
|
||||
} else if (gfxTask != NULL) {
|
||||
if (gfxTask->state & OS_SC_YIELDED || !(sc->gfxListHead->flags & OS_SC_NEEDS_RDP)) {
|
||||
if (gfxTask->state & OS_SC_YIELDED || !(gfxTask->flags & OS_SC_NEEDS_RDP)) {
|
||||
if (ret & OS_SC_SP) {
|
||||
*sp = gfxTask;
|
||||
ret &= ~OS_SC_SP;
|
||||
|
@ -205,7 +203,7 @@ s32 Sched_Schedule(SchedContext* sc, OSScTask** sp, OSScTask** dp, s32 state) {
|
|||
}
|
||||
}
|
||||
} else if (ret == (OS_SC_SP | OS_SC_DP)) {
|
||||
if (sc->gfxListHead->framebuffer == NULL || func_800C89D4(sc, gfxTask) != NULL) {
|
||||
if (gfxTask->framebuffer == NULL || func_800C89D4(sc, gfxTask) != NULL) {
|
||||
*sp = *dp = gfxTask;
|
||||
ret &= ~(OS_SC_SP | OS_SC_DP);
|
||||
sc->gfxListHead = sc->gfxListHead->next;
|
||||
|
@ -217,9 +215,6 @@ s32 Sched_Schedule(SchedContext* sc, OSScTask** sp, OSScTask** dp, s32 state) {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/Sched_Schedule.s")
|
||||
#endif
|
||||
|
||||
void func_800C8BC4(SchedContext* sc, OSScTask* task) {
|
||||
if (sc->pendingSwapBuf1 == NULL) {
|
||||
|
|
|
@ -47,13 +47,9 @@ s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32
|
|||
/**
|
||||
* Creates a line segment which is perpendicular to the line segments `lineAPointA`->`lineAPointB` and
|
||||
* `lineBPointA`->`lineBPointB`
|
||||
*
|
||||
*/
|
||||
#ifdef NON_MATCHING
|
||||
/**
|
||||
* NON_MATCHING:
|
||||
* Lots of regalloc, but is functionally equivilent, some reordering.
|
||||
*/
|
||||
// Lots of regalloc, but is functionally equivilent, some reordering.
|
||||
s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
|
||||
Vec3f* lineAIntersect, Vec3f* lineBIntersect) {
|
||||
f32 sp5C;
|
||||
|
|
|
@ -161,36 +161,26 @@ void UCodeDisas_SetCurUCodeImpl(UCodeDisas* this, void* ptr) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// s4/s6 swap (basically same diff as UCodeDisas_ParseRenderMode)
|
||||
void UCodeDisas_ParseGeometryMode(UCodeDisas* this, u32 mode) {
|
||||
u32 first = true;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sUCodeDisasGeometryModes); i++) {
|
||||
if (sUCodeDisasGeometryModes[i].value & mode) {
|
||||
u32 cond = first;
|
||||
if (!cond) {
|
||||
DISAS_LOG("|");
|
||||
}
|
||||
first = false;
|
||||
|
||||
DISAS_LOG("%s", sUCodeDisasGeometryModes[i].name);
|
||||
if ((sUCodeDisasGeometryModes[i].value & mode) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (first) {
|
||||
} else {
|
||||
DISAS_LOG("|");
|
||||
}
|
||||
first = false;
|
||||
|
||||
DISAS_LOG("%s", sUCodeDisasGeometryModes[i].name);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void UCodeDisas_ParseGeometryMode(UCodeDisas* this, u32 mode);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/ucode_disas/UCodeDisas_ParseGeometryMode.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// s1/s2 swap (basically same diff as UCodeDisas_ParseGeometryMode)
|
||||
void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
||||
s32 i;
|
||||
s32 a;
|
||||
s32 b;
|
||||
|
||||
static F3dzexRenderMode sUCodeDisasRenderModeFlags[] = {
|
||||
F3DZEX_RENDERMODE(AA_EN, 0x8),
|
||||
F3DZEX_RENDERMODE(Z_CMP, 0x10),
|
||||
|
@ -209,7 +199,6 @@ void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
|||
F3DZEX_RENDERMODE(ALPHA_CVG_SEL, 0x2000),
|
||||
F3DZEX_RENDERMODE(FORCE_BL, 0x4000),
|
||||
};
|
||||
|
||||
static const char* D_8012DDDC[4][4] = {
|
||||
{ "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" },
|
||||
{ "G_BL_A_IN", "G_BL_A_FOG", "G_BL_A_SHADE", "G_BL_0" },
|
||||
|
@ -217,18 +206,24 @@ void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
|||
{ "G_BL_1MA", "G_BL_A_MEM", "G_BL_1", "G_BL_0" },
|
||||
};
|
||||
|
||||
s32 i;
|
||||
s32 a;
|
||||
s32 b;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sUCodeDisasRenderModeFlags); i++) {
|
||||
if ((mode & sUCodeDisasRenderModeFlags[i].mask) == sUCodeDisasRenderModeFlags[i].value) {
|
||||
DISAS_LOG("%s|", sUCodeDisasRenderModeFlags[i].name);
|
||||
if ((mode & sUCodeDisasRenderModeFlags[i].mask) != sUCodeDisasRenderModeFlags[i].value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DISAS_LOG("%s|", sUCodeDisasRenderModeFlags[i].name);
|
||||
}
|
||||
|
||||
a = (mode >> 18) & 0x3333;
|
||||
b = (mode >> 16) & 0x3333;
|
||||
|
||||
if (1) {}
|
||||
// clang-format off
|
||||
if (this->enableLog == 0) {} else { osSyncPrintf("\nGBL_c1(%s, %s, %s, %s)|", D_8012DDDC[0][a >> 12 & 3], D_8012DDDC[1][a >> 8 & 3], D_8012DDDC[2][a >> 4 & 3], D_8012DDDC[3][a >> 0 & 3]); }
|
||||
if (this->enableLog == 0) {} else { osSyncPrintf("\nGBL_c1(%s, %s, %s, %s)|",
|
||||
D_8012DDDC[0][a >> 12 & 3], D_8012DDDC[1][a >> 8 & 3], D_8012DDDC[2][a >> 4 & 3], D_8012DDDC[3][a >> 0 & 3]); }
|
||||
// clang-format on
|
||||
|
||||
if (this->enableLog) {
|
||||
|
@ -236,33 +231,6 @@ void UCodeDisas_ParseRenderMode(UCodeDisas* this, u32 mode) {
|
|||
D_8012DDDC[2][b >> 4 & 3], D_8012DDDC[3][b >> 0 & 3]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
F3dzexRenderMode sUCodeDisasRenderModeFlags[] = {
|
||||
F3DZEX_RENDERMODE(AA_EN, 0x8),
|
||||
F3DZEX_RENDERMODE(Z_CMP, 0x10),
|
||||
F3DZEX_RENDERMODE(Z_UPD, 0x20),
|
||||
F3DZEX_RENDERMODE(IM_RD, 0x40),
|
||||
F3DZEX_RENDERMODE(CLR_ON_CVG, 0x80),
|
||||
F3DZEX_RENDERMODE(CVG_DST_CLAMP, 0x300),
|
||||
F3DZEX_RENDERMODE(CVG_DST_WRAP, 0x300),
|
||||
F3DZEX_RENDERMODE(CVG_DST_FULL, 0x300),
|
||||
F3DZEX_RENDERMODE(CVG_DST_SAVE, 0x300),
|
||||
F3DZEX_RENDERMODE(ZMODE_OPA, 0xC00),
|
||||
F3DZEX_RENDERMODE(ZMODE_INTER, 0xC00),
|
||||
F3DZEX_RENDERMODE(ZMODE_XLU, 0xC00),
|
||||
F3DZEX_RENDERMODE(ZMODE_DEC, 0xC00),
|
||||
F3DZEX_RENDERMODE(CVG_X_ALPHA, 0x1000),
|
||||
F3DZEX_RENDERMODE(ALPHA_CVG_SEL, 0x2000),
|
||||
F3DZEX_RENDERMODE(FORCE_BL, 0x4000),
|
||||
};
|
||||
const char* D_8012DDDC[4][4] = {
|
||||
{ "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" },
|
||||
{ "G_BL_A_IN", "G_BL_A_FOG", "G_BL_A_SHADE", "G_BL_0" },
|
||||
{ "G_BL_CLR_IN", "G_BL_CLR_MEM", "G_BL_CLR_BL", "G_BL_CLR_FOG" },
|
||||
{ "G_BL_1MA", "G_BL_A_MEM", "G_BL_1", "G_BL_0" },
|
||||
};
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/ucode_disas/UCodeDisas_ParseRenderMode.s")
|
||||
#endif
|
||||
|
||||
void UCodeDisas_PrintVertices(UCodeDisas* this, Vtx* vtx, s32 count, s32 start) {
|
||||
s32 i;
|
||||
|
|
|
@ -1285,7 +1285,7 @@ void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
|
|||
#else
|
||||
void func_8005DFAC(GlobalContext* globalCtx, Collider* collider, Vec3f* v);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DFAC.s")
|
||||
#endif // NON_MATCHING
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Green EffectSpark
|
||||
|
@ -1341,7 +1341,7 @@ void func_8005E10C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
|
|||
#else
|
||||
void func_8005E10C(GlobalContext* globalCtx, Collider* collider, Vec3f* v);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E10C.s")
|
||||
#endif // NON_MATCHING
|
||||
#endif
|
||||
|
||||
void func_8005E26C(GlobalContext* globalCtx, Collider* collider, Vec3f* v) {
|
||||
func_800299AC(globalCtx, v);
|
||||
|
@ -2934,7 +2934,7 @@ void func_800628A4(s32 arg0, ColliderJntSph* collider) {
|
|||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800628A4.s")
|
||||
#endif // NON_MATCHING
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Purple EffectSpark
|
||||
|
@ -2989,7 +2989,7 @@ void func_80062A28(GlobalContext* globalCtx, Vec3f* v) {
|
|||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062A28.s")
|
||||
#endif // NON_MATCHING
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// White EffectSpark (Bubbles?)
|
||||
|
@ -3044,7 +3044,7 @@ void func_80062B80(GlobalContext* globalCtx, Vec3f* v) {
|
|||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062B80.s")
|
||||
#endif // NON_MATCHING
|
||||
#endif
|
||||
|
||||
void func_80062CD4(GlobalContext* globalCtx, Vec3f* v) {
|
||||
static EffectShieldParticleInit init = {
|
||||
|
|
|
@ -99,24 +99,24 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Very minor stack alloc, lod = 0 gSPMatrix places gfxPtr at stack + 0x4c instead of 0x50
|
||||
void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* skelCurve,
|
||||
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* actor) {
|
||||
SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->limbList[limbIndex]);
|
||||
Gfx* dispRefs[5];
|
||||
Vec3f scale;
|
||||
Vec3s rot;
|
||||
Vec3f pos;
|
||||
Gfx* d;
|
||||
Vec3s* transform;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad;
|
||||
Gfx* dispRefs[4];
|
||||
|
||||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279);
|
||||
|
||||
Matrix_Push();
|
||||
|
||||
if (overrideLimbDraw == NULL ||
|
||||
(overrideLimbDraw != NULL && overrideLimbDraw(globalCtx, skelCurve, limbIndex, actor))) {
|
||||
Vec3f scale;
|
||||
Vec3s rot;
|
||||
Vec3f pos;
|
||||
Gfx* dList;
|
||||
Vec3s* transform;
|
||||
|
||||
transform = &skelCurve->transforms[limbIndex];
|
||||
scale.x = transform->x * (1.0f / 1024.0f);
|
||||
scale.y = transform->y * (1.0f / 1024.0f);
|
||||
|
@ -129,30 +129,36 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
|
|||
pos.x = transform->x;
|
||||
pos.y = transform->y;
|
||||
pos.z = transform->z;
|
||||
|
||||
Matrix_JointPosition(&pos, &rot);
|
||||
Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY);
|
||||
|
||||
if (lod == 0) {
|
||||
d = limb->dList[0];
|
||||
if (d != NULL) {
|
||||
s32 pad1;
|
||||
|
||||
dList = limb->dList[0];
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(gfxCtx->polyOpa.p++,
|
||||
Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 321),
|
||||
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, d);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, dList);
|
||||
}
|
||||
} else if (lod == 1) {
|
||||
d = limb->dList[0];
|
||||
if (d != NULL) {
|
||||
s32 pad2;
|
||||
|
||||
dList = limb->dList[0];
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(gfxCtx->polyOpa.p++,
|
||||
Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 332),
|
||||
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, d);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, dList);
|
||||
}
|
||||
d = limb->dList[1];
|
||||
if (d != NULL) {
|
||||
dList = limb->dList[1];
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(gfxCtx->polyXlu.p++,
|
||||
Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 338),
|
||||
G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, d);
|
||||
gSPDisplayList(gfxCtx->polyXlu.p++, dList);
|
||||
}
|
||||
} else {
|
||||
// FcSkeletonInfo_draw_child (): Not supported
|
||||
|
@ -176,9 +182,6 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve*
|
|||
|
||||
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/SkelCurve_DrawLimb.s")
|
||||
#endif
|
||||
|
||||
void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve,
|
||||
OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* actor2) {
|
||||
|
|
|
@ -86,11 +86,10 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc
|
||||
// regalloc differences
|
||||
void KaleidoSetup_Init(GlobalContext* globalCtx) {
|
||||
|
||||
PauseContext* pauseCtx = &globalCtx->pauseCtx;
|
||||
s32 temp;
|
||||
|
||||
pauseCtx->state = 0;
|
||||
pauseCtx->flag = 0;
|
||||
pauseCtx->unk_208 = 0;
|
||||
|
@ -110,7 +109,6 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
|
|||
pauseCtx->unk_21A = VREG(30) + 3;
|
||||
pauseCtx->unk_21C = 0;
|
||||
pauseCtx->unk_21E = 1;
|
||||
temp = pauseCtx->unk_21E;
|
||||
pauseCtx->unk_220 = 10;
|
||||
pauseCtx->unk_222 = 0;
|
||||
pauseCtx->unk_22C = 0;
|
||||
|
@ -125,15 +123,16 @@ void KaleidoSetup_Init(GlobalContext* globalCtx) {
|
|||
pauseCtx->unk_242 = 999;
|
||||
pauseCtx->unk_244 = 59;
|
||||
pauseCtx->unk_246 = 0;
|
||||
pauseCtx->unk_248 = (VREG(30) + 3) & 0xFFFF;
|
||||
pauseCtx->unk_248 = VREG(30) + 3;
|
||||
pauseCtx->unk_24A = 0;
|
||||
pauseCtx->unk_24C = pauseCtx->unk_21E;
|
||||
pauseCtx->unk_25A = -40;
|
||||
pauseCtx->unk_25C = 0;
|
||||
pauseCtx->unk_25E = 0;
|
||||
pauseCtx->unk_260 = 4;
|
||||
pauseCtx->unk_264 = -1;
|
||||
pauseCtx->unk_238 = 0;
|
||||
pauseCtx->unk_24C = temp;
|
||||
|
||||
View_Init(&pauseCtx->view, globalCtx->state.gfxCtx);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -8,7 +8,6 @@ s16 sPlayerInitialPosX = 0;
|
|||
s16 sPlayerInitialPosZ = 0;
|
||||
s16 sPlayerInitialDirection = 0;
|
||||
s16 sEntranceIconMapIndex = 0;
|
||||
s16 sLastRoomNum = 99;
|
||||
|
||||
void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
|
@ -515,9 +514,8 @@ s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) {
|
|||
return gMapData->floorTexIndexOffset[mapIndex][floor];
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// single extra load instruction
|
||||
void Map_Update(GlobalContext* globalCtx) {
|
||||
static s16 sLastRoomNum = 99;
|
||||
Player* player = PLAYER;
|
||||
s32 mapIndex = gSaveContext.mapIndex;
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
@ -536,13 +534,6 @@ void Map_Update(GlobalContext* globalCtx) {
|
|||
case SCENE_HAKADAN:
|
||||
case SCENE_HAKADANCH:
|
||||
case SCENE_ICE_DOUKUTO:
|
||||
case SCENE_GANON:
|
||||
case SCENE_MEN:
|
||||
case SCENE_GERUDOWAY:
|
||||
case SCENE_GANONTIKA:
|
||||
case SCENE_GANON_SONOGO:
|
||||
case SCENE_GANONTIKA_SONOGO:
|
||||
case SCENE_TAKARAYA:
|
||||
interfaceCtx->unk_140[30] = 0;
|
||||
if (gSaveContext.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) {
|
||||
interfaceCtx->unk_140[31] = 1;
|
||||
|
@ -568,7 +559,6 @@ void Map_Update(GlobalContext* globalCtx) {
|
|||
// Translates to "Current floor = %d Current room = %x Number of rooms = %d"
|
||||
osSyncPrintf("現在階=%d 現在部屋=%x 部屋数=%d\n", floor, interfaceCtx->mapRoomNum,
|
||||
gMapData->switchEntryCount[mapIndex]);
|
||||
if (interfaceCtx->mapRoomNum) {} // Improves codegen but may not be necessary
|
||||
sLastRoomNum = interfaceCtx->mapRoomNum;
|
||||
}
|
||||
|
||||
|
@ -602,6 +592,3 @@ void Map_Update(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/Map_Update.s")
|
||||
#endif
|
||||
|
|
|
@ -1134,8 +1134,6 @@ Gfx* Gfx_TextureI8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 te
|
|||
return displayListHead;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences
|
||||
void Inventory_SwapAgeEquipment(void) {
|
||||
s16 i;
|
||||
u16 temp;
|
||||
|
@ -1162,15 +1160,14 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
gSaveContext.equips.buttonItems[1] = ITEM_NUT;
|
||||
gSaveContext.equips.cButtonSlots[0] = SLOT_NUT;
|
||||
} else {
|
||||
gSaveContext.equips.cButtonSlots[0] = SLOT_NONE;
|
||||
gSaveContext.equips.buttonItems[1] = ITEM_NONE;
|
||||
gSaveContext.equips.buttonItems[1] = gSaveContext.equips.cButtonSlots[0] = ITEM_NONE;
|
||||
}
|
||||
|
||||
gSaveContext.equips.buttonItems[2] = ITEM_BOMB;
|
||||
gSaveContext.equips.buttonItems[3] = gSaveContext.items[SLOT_OCARINA];
|
||||
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
|
||||
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
|
||||
gSaveContext.equips.equipment = 0x1122;
|
||||
gSaveContext.equips.buttonItems[3] = gSaveContext.items[SLOT_OCARINA];
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSaveContext.equips.buttonItems[i] = gSaveContext.adultEquips.buttonItems[i];
|
||||
|
@ -1232,9 +1229,6 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_SwapAgeEquipment.s")
|
||||
#endif
|
||||
|
||||
void Interface_InitHorsebackArchery(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
|
@ -1678,7 +1672,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
|
|||
}
|
||||
return ITEM_NONE;
|
||||
} else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) {
|
||||
gSaveContext.questItems += (1 << QUEST_HEART_PIECE);
|
||||
gSaveContext.questItems += 1 << (QUEST_HEART_PIECE + 4);
|
||||
return ITEM_NONE;
|
||||
} else if (item == ITEM_HEART_CONTAINER) {
|
||||
gSaveContext.healthCapacity += 0x10;
|
||||
|
@ -1949,21 +1943,18 @@ void Inventory_DeleteItem(u16 item, u16 invSlot) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences
|
||||
s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) {
|
||||
s16 i;
|
||||
s16 j;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.items); i++) {
|
||||
if (gSaveContext.items[i] == oldItem) {
|
||||
gSaveContext.items[i] = newItem;
|
||||
// Translates to: "Item Purge (%d)"
|
||||
osSyncPrintf("アイテム消去(%d)", i);
|
||||
for (j = 1; j < 4; j++) {
|
||||
if (gSaveContext.equips.buttonItems[j] == oldItem) {
|
||||
gSaveContext.equips.buttonItems[j] = newItem;
|
||||
Interface_LoadItemIcon1(globalCtx, j);
|
||||
osSyncPrintf("アイテム消去(%d)\n", i);
|
||||
for (i = 1; i < 4; i++) {
|
||||
if (gSaveContext.equips.buttonItems[i] == oldItem) {
|
||||
gSaveContext.equips.buttonItems[i] = newItem;
|
||||
Interface_LoadItemIcon1(globalCtx, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1973,9 +1964,6 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_ReplaceItem.s")
|
||||
#endif
|
||||
|
||||
s32 Inventory_HasEmptyBottle(void) {
|
||||
u8* items = gSaveContext.items;
|
||||
|
@ -2009,8 +1997,6 @@ s32 Inventory_HasSpecificBottle(u8 bottleItem) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// save context pointer isn't reused after Interface_LoadItemIcon1 when it should be
|
||||
void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton) {
|
||||
osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, cButton,
|
||||
gSaveContext.equips.cButtonSlots[cButton - 1],
|
||||
|
@ -2025,19 +2011,12 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton) {
|
|||
gSaveContext.items[gSaveContext.equips.cButtonSlots[cButton - 1]] = item;
|
||||
gSaveContext.equips.buttonItems[cButton] = item;
|
||||
|
||||
if (1) {} // Improves codegen but may not be necessary
|
||||
|
||||
Interface_LoadItemIcon1(globalCtx, cButton);
|
||||
|
||||
globalCtx->pauseCtx.unk_23E = item;
|
||||
gSaveContext.buttonStatus[0] = BTN_ENABLED;
|
||||
gSaveContext.buttonStatus[cButton] = BTN_ENABLED;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_UpdateBottleItem.s")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// mostly regalloc, minor ordering, and stack usage differences
|
||||
s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
|
||||
s32 bottleSlot;
|
||||
s16 i;
|
||||
|
@ -2051,22 +2030,20 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) {
|
|||
if (gSaveContext.equips.buttonItems[j] == ITEM_FAIRY) {
|
||||
gSaveContext.equips.buttonItems[j] = ITEM_BOTTLE;
|
||||
Interface_LoadItemIcon1(globalCtx, j);
|
||||
i = 0;
|
||||
bottleSlot = gSaveContext.equips.cButtonSlots[j - 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Translates to: "Fairy Usage=%d"
|
||||
osSyncPrintf("妖精使用=%d\n", bottleSlot);
|
||||
gSaveContext.items[bottleSlot] = ITEM_BOTTLE;
|
||||
gSaveContext.items[bottleSlot + i] = ITEM_BOTTLE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_ConsumeFairy.s")
|
||||
#endif
|
||||
|
||||
void func_80086D5C(s32* buf, u16 size) {
|
||||
u16 i;
|
||||
|
|
|
@ -344,8 +344,8 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
|
|||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 628);
|
||||
|
||||
camera = ACTIVE_CAM;
|
||||
sp9C = (camera->setting == 25);
|
||||
polygon1 = &room->mesh->polygon1;
|
||||
sp9C = (camera->setting ^ 25) == 0;
|
||||
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
|
||||
sp98 = (flags & 1) && sp9C && polygon1->single.source && !(SREG(25) & 1);
|
||||
sp94 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2);
|
||||
|
@ -424,13 +424,11 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
// Room Draw Polygon Type 1 - Multi Format
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences
|
||||
void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
|
||||
Camera* camera;
|
||||
Gfx* spA8;
|
||||
BgImage* bgImage;
|
||||
PolygonType1* polygon1;
|
||||
BgImage* bgImage;
|
||||
PolygonDlist* polygonDlist;
|
||||
u32 sp98;
|
||||
u32 sp94;
|
||||
|
@ -443,7 +441,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
|
|||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 752);
|
||||
|
||||
camera = ACTIVE_CAM;
|
||||
sp98 = (camera->setting ^ 25) == 0;
|
||||
sp98 = (camera->setting == 25);
|
||||
polygon1 = &room->mesh->polygon1;
|
||||
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
|
||||
bgImage = func_80096A74(polygon1, globalCtx);
|
||||
|
@ -488,9 +486,6 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) {
|
|||
|
||||
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 819);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80096B6C.s")
|
||||
#endif
|
||||
|
||||
// Room Draw Polygon Type 1
|
||||
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) {
|
||||
|
|
|
@ -200,13 +200,11 @@ void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) {
|
|||
ActorEntry* linkEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) +
|
||||
globalCtx->setupEntranceList[globalCtx->curSpawn].spawn;
|
||||
s16 linkObjectId;
|
||||
s32 linkAge;
|
||||
|
||||
globalCtx->linkActorEntry = linkEntry;
|
||||
globalCtx->linkAgeOnLoad = gSaveContext.linkAge;
|
||||
globalCtx->linkAgeOnLoad = ((void)0, gSaveContext.linkAge);
|
||||
|
||||
linkAge = gSaveContext.linkAge;
|
||||
linkObjectId = gLinkObjectIds[linkAge];
|
||||
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)];
|
||||
|
||||
gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId;
|
||||
Object_Spawn(&globalCtx->objectCtx, linkObjectId);
|
||||
|
@ -455,19 +453,18 @@ void func_8009918C(GlobalContext* globalCtx, SceneCmd* cmd) {
|
|||
}
|
||||
|
||||
// Scene Command 0x18: Alternate Headers
|
||||
#ifdef NON_MATCHING
|
||||
// minor ordering and regalloc differences
|
||||
void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
SceneCmd** altHeaders;
|
||||
s32 pad;
|
||||
SceneCmd* altHeader;
|
||||
|
||||
osSyncPrintf("\n[ZU]sceneset age =[%X]", gSaveContext.linkAge);
|
||||
osSyncPrintf("\n[ZU]sceneset time =[%X]", gSaveContext.cutsceneIndex);
|
||||
osSyncPrintf("\n[ZU]sceneset counter=[%X]", gSaveContext.sceneSetupIndex);
|
||||
osSyncPrintf("\n[ZU]sceneset age =[%X]", ((void)0, gSaveContext.linkAge));
|
||||
osSyncPrintf("\n[ZU]sceneset time =[%X]", ((void)0, gSaveContext.cutsceneIndex));
|
||||
osSyncPrintf("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneSetupIndex));
|
||||
|
||||
if (gSaveContext.sceneSetupIndex != 0) {
|
||||
altHeaders = SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment);
|
||||
altHeader = altHeaders[gSaveContext.sceneSetupIndex - 1];
|
||||
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment))[gSaveContext.sceneSetupIndex - 1];
|
||||
|
||||
if (1) {}
|
||||
|
||||
if (altHeader != NULL) {
|
||||
Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader));
|
||||
|
@ -477,8 +474,8 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) {
|
|||
osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!");
|
||||
|
||||
if (gSaveContext.sceneSetupIndex == 3) {
|
||||
altHeaders = SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment);
|
||||
altHeader = altHeaders[gSaveContext.sceneSetupIndex - 2];
|
||||
altHeader =
|
||||
((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment))[gSaveContext.sceneSetupIndex - 2];
|
||||
|
||||
// Translates to: "USING ADULT DAY DATA THERE!"
|
||||
osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!");
|
||||
|
@ -491,10 +488,6 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_scene/func_800991A0.s")
|
||||
#endif
|
||||
|
||||
// Scene Command 0x17: Cutscene Data
|
||||
void func_8009934C(GlobalContext* globalCtx, SceneCmd* cmd) {
|
||||
|
|
|
@ -537,10 +537,10 @@ s32 func_800AB9EC(View* view, s32 arg1, Gfx** gfxp) {
|
|||
Mtx* projection;
|
||||
Mtx* viewing;
|
||||
|
||||
arg1 = (arg1 & view->flags) | (arg1 >> 4);
|
||||
arg1 = (view->flags & arg1) | (arg1 >> 4);
|
||||
|
||||
if (arg1 & 2) {
|
||||
vp = Graph_Alloc(view->gfxCtx, sizeof(Vp));
|
||||
vp = Graph_Alloc(gfxCtx, sizeof(Vp));
|
||||
LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 910);
|
||||
View_ViewportToVp(vp, &view->viewport);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue