From dfd00a8c1f667f7ee14228fc78a9d747fdf9cd32 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 23 Jul 2022 15:09:55 -0400 Subject: [PATCH] Match 3 functions (#964) --- include/functions.h | 2 +- src/code/PreRender.c | 9 ++++----- src/code/z_demo.c | 25 +++++++++++-------------- src/code/z_sram_NES.c | 14 ++++---------- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/include/functions.h b/include/functions.h index a72b6da7d8..b4753d4ce2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1448,7 +1448,7 @@ s16 ActorCutscene_GetCurrentIndex(void); ActorCutscene* ActorCutscene_GetCutscene(s16 index); s16 ActorCutscene_GetAdditionalCutscene(s16 index); s16 ActorCutscene_GetLength(s16 index); -s32 func_800F2138(s8 arg0); +s32 func_800F2138(s32 arg0); s32 func_800F2178(s16 arg0); s16 ActorCutscene_GetCurrentSubCamId(s16 index); s16 func_800F21CC(void); diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 0afb1df689..46fd8ee6bb 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -191,8 +191,6 @@ void func_80170774(PreRender* this, Gfx** gfxp) { func_8016FF70(this, gfxp, this->zbufSave, this->zbuf); } -#ifdef NON_MATCHING -// just regalloc void func_80170798(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 y; @@ -235,6 +233,10 @@ void func_80170798(PreRender* this, Gfx** gfxp) { gDPLoadMultiTile(gfx++, this->cvgSave, 0x0160, rtile, G_IM_FMT_I, G_IM_SIZ_8b, this->width, this->height, uls, ult, lrs, lrt, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + //! FAKE + if (1) {} + // The two if (1) {}'s above can be removed with do {} while(0) around macros + if (1) {} if (1) {} gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5, ult << 5, 1 << 10, 1 << 10); @@ -247,9 +249,6 @@ void func_80170798(PreRender* this, Gfx** gfxp) { *gfxp = gfx; } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/PreRender/func_80170798.s") -#endif void func_80170AE0(PreRender* this, Gfx** gfxp, s32 alpha) { func_8016FF90(this, gfxp, this->fbufSave, this->fbuf, 255, 255, 255, alpha); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 1827acc854..80e30e69c6 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1494,11 +1494,9 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { } } -#ifdef NON_MATCHING // HandleFlags? -// regalloc void func_800EDBE0(PlayState* play) { - CutsceneEntry* temp_a3; + s32 pad; s16 sp2A; SceneTableEntry* sp24; s32 temp_v0_3; @@ -1508,15 +1506,16 @@ void func_800EDBE0(PlayState* play) { if (sp2A != -1) { temp_v0_3 = func_800F2138(sp2A); if (temp_v0_3 != -1) { - temp_a3 = ((void)0, play->csCtx.sceneCsList); - if ((temp_a3[temp_v0_3].unk7 != 0xFF) && (gSaveContext.respawnFlag == 0)) { - if (temp_a3[temp_v0_3].unk7 == 0xFE) { + if ((play->csCtx.sceneCsList[temp_v0_3].unk7 != 0xFF) && (gSaveContext.respawnFlag == 0)) { + if (play->csCtx.sceneCsList[temp_v0_3].unk7 == 0xFE) { ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; - } else if (!((1 << (temp_a3[temp_v0_3].unk7 % 8)) & - gSaveContext.save.weekEventReg[temp_a3[temp_v0_3].unk7 / 8])) { - gSaveContext.save.weekEventReg[(temp_a3[temp_v0_3].unk7 / 8)] |= - 1 << (temp_a3[temp_v0_3].unk7 % 8); + } else if (!(((void)0, + gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) & + (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)))) { + gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)] = + ((void)0, gSaveContext.save.weekEventReg[(play->csCtx.sceneCsList[temp_v0_3].unk7 / 8)]) | + (1 << (play->csCtx.sceneCsList[temp_v0_3].unk7 % 8)); ActorCutscene_Start(sp2A, NULL); gSaveContext.showTitleCard = false; } @@ -1530,7 +1529,8 @@ void func_800EDBE0(PlayState* play) { if ((gSaveContext.respawnFlag == 0) || (gSaveContext.respawnFlag == -2)) { sp24 = play->loadedScene; if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { - if ((Entrance_GetTransitionFlags(gSaveContext.sceneSetupIndex + gSaveContext.save.entranceIndex) & + if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entranceIndex) + + ((void)0, gSaveContext.sceneSetupIndex)) & 0x4000) != 0) { func_80151A68(play, sp24->titleTextId); } @@ -1539,9 +1539,6 @@ void func_800EDBE0(PlayState* play) { gSaveContext.showTitleCard = true; } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800EDBE0.s") -#endif void func_800EDDB0(PlayState* play) { } diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 8139846e68..10ce64f47b 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -887,13 +887,11 @@ void func_80144A94(SramContext* sramCtx) { u16 D_801C6A58[] = { 0x68B0, 0x6A60, 0xB230, 0x9A80, 0xD890, 0x3E40, 0x8640, 0x84A0, 0x2040, 0xAA30 }; -#ifdef NON_MATCHING -// Small regalloc between v0/t6/t7 void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { s32 i; s32 pad; s32 phi_t1; - s32 pad1[2]; + s32 pad1; s32 fileNum; if (gSaveContext.unk_3F3F) { @@ -959,12 +957,11 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; } } else { - gSaveContext.save.entranceIndex = D_801C6A58[gSaveContext.save.owlSaveLocation]; - if (D_801C6A58[gSaveContext.save.owlSaveLocation] == 0x84A0 && (gSaveContext.save.weekEventReg[20] & 2)) { + gSaveContext.save.entranceIndex = D_801C6A58[(void)0, gSaveContext.save.owlSaveLocation]; + if ((gSaveContext.save.entranceIndex == 0x84A0) && (gSaveContext.save.weekEventReg[20] & 2)) { // Unconfirmed weekEventReg: "Woodfall Temple Prison Entrance raised / Water cleansed" gSaveContext.save.entranceIndex = 0xCA0; - } else if (D_801C6A58[gSaveContext.save.owlSaveLocation] == 0x9A80 && - (gSaveContext.save.weekEventReg[33] & 0x80)) { + } else if ((gSaveContext.save.entranceIndex == 0x9A80) && (gSaveContext.save.weekEventReg[33] & 0x80)) { // Unconfirmed weekEventReg: "Mountain Village Unfrozen" gSaveContext.save.entranceIndex = 0xAE80; } @@ -988,9 +985,6 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { func_80147314(sramCtx, fileNum); } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/Sram_OpenSave.s") -#endif // Similar to func_80145698, but accounts for owl saves? void func_8014546C(SramContext* sramCtx) {