diff options
| author | Roman971 <32455037+Roman971@users.noreply.github.com> | 2020-08-23 23:50:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-23 17:50:30 -0400 |
| commit | 49609dd78bb586c8ab3349105ceedeb2eb0d91ea (patch) | |
| tree | c076c98bff5e83feb342219344ed027718519acf /src | |
| parent | 281aaa0cb6a55f19eceb322871a8d27da9e0e8b2 (diff) | |
Match/Improve a bunch of non matchings (#342)
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/fault.c | 19 | ||||
| -rw-r--r-- | src/code/sched.c | 9 | ||||
| -rw-r--r-- | src/code/sys_math3d.c | 6 | ||||
| -rw-r--r-- | src/code/ucode_disas.c | 70 | ||||
| -rw-r--r-- | src/code/z_collision_check.c | 10 | ||||
| -rw-r--r-- | src/code/z_fcurve_data_skelanime.c | 45 | ||||
| -rw-r--r-- | src/code/z_kaleido_setup.c | 11 | ||||
| -rw-r--r-- | src/code/z_map_exp.c | 15 | ||||
| -rw-r--r-- | src/code/z_parameter.c | 45 | ||||
| -rw-r--r-- | src/code/z_room.c | 11 | ||||
| -rw-r--r-- | src/code/z_scene.c | 29 | ||||
| -rw-r--r-- | src/code/z_view.c | 4 | ||||
| -rw-r--r-- | src/libultra_code/contpfs.c | 15 | ||||
| -rw-r--r-- | src/libultra_code/pfsinitpak.c | 15 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c | 60 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h | 7 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 15 |
17 files changed, 135 insertions, 251 deletions
diff --git a/src/code/fault.c b/src/code/fault.c index 3862d381f..e47441792 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -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; diff --git a/src/code/sched.c b/src/code/sched.c index 9b159894f..7bd13383a 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -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) { diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 6016ea1e6..296135b84 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -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; diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index 8a331d94e..1f4975799 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -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; + if ((sUCodeDisasGeometryModes[i].value & mode) == 0) { + continue; + } - DISAS_LOG("%s", sUCodeDisasGeometryModes[i].name); + 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; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 1091a374c..fca60ed13 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -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 = { diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index c175c3fd2..5aabe18f8 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -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) { diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 4e8fcacc9..ce5513bb4 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -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 diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 17d2ef1f0..301bda17b 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -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 diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index a228941d4..d5c48350e 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -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; diff --git a/src/code/z_room.c b/src/code/z_room.c index 2294bf201..898fd57a1 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -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) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 6fdb658cb..23ef3a510 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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) { diff --git a/src/code/z_view.c b/src/code/z_view.c index b0566e7a4..9ab4db07e 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -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); diff --git a/src/libultra_code/contpfs.c b/src/libultra_code/contpfs.c index 3087b7adc..4f0aa41ce 100644 --- a/src/libultra_code/contpfs.c +++ b/src/libultra_code/contpfs.c @@ -161,15 +161,13 @@ s32 __osCheckPackId(OSPfs* pfs, __OSPackId* temp) { return 0; } -#ifdef NON_MATCHING -// regalloc differences, probably the same issue as osPfsInitPak s32 __osGetId(OSPfs* pfs) { - - u16 sum, isum; + u16 sum; + u16 isum; u8 temp[BLOCKSIZE]; + __OSPackId* id; __OSPackId newid; s32 ret; - __OSPackId* id; if (pfs->activebank != 0) { if ((ret = __osPfsSelectBank(pfs, 0)) != 0) { @@ -180,6 +178,7 @@ s32 __osGetId(OSPfs* pfs) { if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_ID_0AREA, temp)) != 0) { return ret; } + __osIdCheckSum((u16*)temp, &sum, &isum); id = (__OSPackId*)temp; if ((id->checksum != sum) || (id->invertedChecksum != isum)) { @@ -207,6 +206,8 @@ s32 __osGetId(OSPfs* pfs) { bcopy(id, pfs->id, BLOCKSIZE); + if (0) {} + pfs->version = id->version; pfs->banks = id->banks; @@ -215,15 +216,13 @@ s32 __osGetId(OSPfs* pfs) { pfs->inode_table = 1 * PFS_ONE_PAGE; pfs->minode_table = (1 + pfs->banks) * PFS_ONE_PAGE; pfs->dir_table = pfs->minode_table + (pfs->banks * PFS_ONE_PAGE); + if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_LABEL_AREA, pfs->label)) != 0) { return ret; } return 0; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/contpfs/__osGetId.s") -#endif s32 __osCheckId(OSPfs* pfs) { u8 temp[BLOCKSIZE]; diff --git a/src/libultra_code/pfsinitpak.c b/src/libultra_code/pfsinitpak.c index 2ce03b79d..a83619e59 100644 --- a/src/libultra_code/pfsinitpak.c +++ b/src/libultra_code/pfsinitpak.c @@ -1,10 +1,8 @@ #include <ultra64.h> #include <global.h> -#ifdef NON_MATCHING -// regalloc differences, probably the same issue as __osGetId s32 osPfsInitPak(OSMesgQueue* queue, OSPfs* pfs, s32 channel) { - s32 ret = 0; + s32 ret; u16 sum; u16 isum; u8 temp[BLOCKSIZE]; @@ -36,6 +34,7 @@ s32 osPfsInitPak(OSMesgQueue* queue, OSPfs* pfs, s32 channel) { if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_ID_0AREA, temp)) != 0) { return (ret); } + __osIdCheckSum((u16*)temp, &sum, &isum); id = (__OSPackId*)temp; if ((id->checksum != sum) || (id->invertedChecksum != isum)) { @@ -61,7 +60,9 @@ s32 osPfsInitPak(OSMesgQueue* queue, OSPfs* pfs, s32 channel) { bcopy(id, pfs->id, BLOCKSIZE); - pfs->version = (s32)id->version; + if (0) {} + + pfs->version = id->version; pfs->banks = id->banks; pfs->inodeStartPage = 1 + DEF_DIR_PAGES + (2 * pfs->banks); pfs->dir_size = DEF_DIR_PAGES * PFS_ONE_PAGE; @@ -69,17 +70,15 @@ s32 osPfsInitPak(OSMesgQueue* queue, OSPfs* pfs, s32 channel) { pfs->minode_table = (1 + pfs->banks) * PFS_ONE_PAGE; pfs->dir_table = pfs->minode_table + (pfs->banks * PFS_ONE_PAGE); - if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_LABEL_AREA, (u8*)pfs->label)) != 0) { + if ((ret = __osContRamRead(pfs->queue, pfs->channel, PFS_LABEL_AREA, pfs->label)) != 0) { return ret; } ret = osPfsChecker(pfs); pfs->status |= PFS_INITIALIZED; + return ret; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/pfsinitpak/osPfsInitPak.s") -#endif s32 __osPfsCheckRamArea(OSPfs* pfs) { s32 i = 0; diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index 6c014d0a2..72e6b35fd 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -10,19 +10,19 @@ #define THIS ((EnHorseGanon*)thisx) +typedef struct { + /* 0x0 */ Vec3s unk_0; + /* 0x6 */ u8 unk_6; +} unk_D_80A69248; // size = 0x8 + void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx); void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx); void EnHorseGanon_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_80A68660(unk_D_80A69248* data, s32 index, Vec3f* vec); -void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx); -void func_80A68870(EnHorseGanon* this); void func_80A68AC4(EnHorseGanon* this); void func_80A68AF0(EnHorseGanon* this, GlobalContext* globalCtx); -void func_80A68B20(EnHorseGanon* this); void func_80A68DB0(EnHorseGanon* this, GlobalContext* globalCtx); -void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx); const ActorInit En_Horse_Ganon_InitVars = { ACTOR_EN_HORSE_GANON, @@ -36,9 +36,7 @@ const ActorInit En_Horse_Ganon_InitVars = { (ActorFunc)EnHorseGanon_Draw, }; -AnimationHeader* D_80A691B0[] = { 0x06004AA4, 0x06005264, 0x06005B78, 0x06002CE4 }; - -AnimationHeader* D_80A691C0[] = { 0x06002650, 0x06003858 }; +static AnimationHeader* D_80A691B0[] = { 0x06004AA4, 0x06005264, 0x06005B78, 0x06002CE4, 0x06002650, 0x06003858 }; static f32 sAnimPlaybackSpeeds[] = { 0.66666666f, 0.66666666f, 1.0f, 1.0f, 1.0f, 0.66666666f }; @@ -68,23 +66,21 @@ static CollisionCheckInfoInit sColChkInfoInit = { 0xFE, }; -unk_D_80A69248 D_80A69248[] = { { 0x09B8, 0x0126, 0x0E2C, 0x07 }, { 0x0C11, 0x017A, 0x1269, 0x07 }, - { 0x064E, 0xFEFB, 0x1DAC, 0x07 }, { 0x02F2, 0xFF45, 0x244F, 0x07 }, - { 0xF96E, 0xFE0C, 0x3122, 0x07 }, { 0xF328, 0xFE0C, 0x32D5, 0x07 }, - { 0xEBEA, 0xFE5F, 0x2D6E, 0x07 }, { 0xE95E, 0xFE27, 0x2565, 0x07 }, - { 0xE593, 0xFE0C, 0x20AC, 0x07 }, { 0xE625, 0xFE77, 0x1B07, 0x07 }, - { 0xEBB7, 0x007C, 0x1539, 0x07 }, { 0xF466, 0x0002, 0x11B9, 0x07 }, - { 0xF47B, 0xFFDD, 0x11AF, 0x07 }, { 0xF88D, 0xFFD1, 0x0BA2, 0x07 } }; +static unk_D_80A69248 D_80A69248[] = { + { 0x09B8, 0x0126, 0x0E2C, 0x07 }, { 0x0C11, 0x017A, 0x1269, 0x07 }, { 0x064E, 0xFEFB, 0x1DAC, 0x07 }, + { 0x02F2, 0xFF45, 0x244F, 0x07 }, { 0xF96E, 0xFE0C, 0x3122, 0x07 }, { 0xF328, 0xFE0C, 0x32D5, 0x07 }, + { 0xEBEA, 0xFE5F, 0x2D6E, 0x07 }, { 0xE95E, 0xFE27, 0x2565, 0x07 }, { 0xE593, 0xFE0C, 0x20AC, 0x07 }, + { 0xE625, 0xFE77, 0x1B07, 0x07 }, { 0xEBB7, 0x007C, 0x1539, 0x07 }, { 0xF466, 0x0002, 0x11B9, 0x07 }, + { 0xF47B, 0xFFDD, 0x11AF, 0x07 }, { 0xF88D, 0xFFD1, 0x0BA2, 0x07 }, +}; -s32 D_80A692B8[] = { 0, 0x00000010 }; +static s32 D_80A692B8[] = { 0, 16 }; static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP), }; -static EnHorseGanonActionFunc sActionFuncs[] = { func_80A68AF0, func_80A68DB0, NULL }; - -const f32 D_80A692D0 = 10430.3779f; +static EnHorseGanonActionFunc sActionFuncs[] = { func_80A68AF0, func_80A68DB0 }; extern SkeletonHeader D_06008668; extern AnimationHeader D_06004AA4; @@ -133,24 +129,18 @@ void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx) { } } -#ifdef NON_MATCHING -// regalloc mismatch void func_80A68870(EnHorseGanon* this) { - if (this->skin.skelAnime.animCurrentFrame > D_80A692B8[this->soundCount]) { - if (D_80A692B8[this->soundCount] != 0 || !(this->skin.skelAnime.animCurrentFrame > D_80A692B8[1])) { - Audio_PlaySoundGeneral(NA_SE_EV_HORSE_WALK, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, - &D_801333E8); - - this->soundCount++; - if (this->soundCount >= 2) { - this->soundCount = 0; - } + if ((this->skin.skelAnime.animCurrentFrame > D_80A692B8[this->soundCount]) && + (this->soundCount != 0 || !(this->skin.skelAnime.animCurrentFrame > D_80A692B8[1]))) { + Audio_PlaySoundGeneral(NA_SE_EV_HORSE_WALK, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + + this->soundCount++; + if (this->soundCount >= 2) { + this->soundCount = 0; } } } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Ganon/func_80A68870.s") -#endif void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) { EnHorseGanon* this = THIS; @@ -188,7 +178,7 @@ void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80A68AC4(EnHorseGanon* this) { this->action = 0; - SkelAnime_ChangeAnimDefaultRepeat(&this->skin.skelAnime, D_80A691C0[0]); + SkelAnime_ChangeAnimDefaultRepeat(&this->skin.skelAnime, D_80A691B0[4]); } void func_80A68AF0(EnHorseGanon* this, GlobalContext* globalCtx) { @@ -268,7 +258,7 @@ void func_80A68E14(EnHorseGanon* this, GlobalContext* globalCtx) { temp_ret = func_8003C940(&globalCtx->colCtx, &col, &temp1, &v); this->unk_1F4 = temp_ret; - this->actor.shape.rot.x = D_80A692D0 * Math_atan2f(this->actor.posRot.pos.y - temp_ret, 30.0f); + this->actor.shape.rot.x = 10430.3779f * Math_atan2f(this->actor.posRot.pos.y - temp_ret, 30.0f); } void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h index 8faa106d7..cb2d91d94 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h @@ -4,13 +4,6 @@ #include <ultra64.h> #include <global.h> -struct unk_D_80A69248; - -typedef struct unk_D_80A69248 { - /* 0x0 */ Vec3s unk_0; - /* 0x6 */ u8 unk_6; -} unk_D_80A69248; // size = 0x8 - struct EnHorseGanon; typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, GlobalContext*); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index f6a01fc45..d86adb553 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -406,11 +406,9 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { this->unk_20C[arg2] = arg1; } -#ifdef NON_MATCHING -// single register swap in a subu instruction void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { s32 temp_v1; - s32 temp_t0; + s16 temp_t0; s32 temp_t2; s32 temp_t3; s32 phi_v0; @@ -420,7 +418,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { if (this->unk_24C != 0) { temp_v1 = this->unk_1DC[arg2] - arg1; - temp_t0 = (s16)temp_v1; + temp_t0 = temp_v1; temp_t2 = temp_t0; temp_t3 = this->unk_1AC[arg2]; phi_v0 = temp_t3; @@ -450,7 +448,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { phi_t5 = -ABS(this->unk_1AC[index1AC]); } - if ((s32)fabsf((f32)temp_t3) > 0x8000) { + if ((s32)fabsf(temp_t3) > 0x8000) { if (arg1 > 0) { temp_t3 -= 0x10000; } else { @@ -462,7 +460,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { } if (temp_t3 != 0) { - phi_v0 += (temp_t3 - temp_1AC) / 16; + phi_v0 += (temp_t3 - phi_v0) / 16; } if (phi_v0 != 0) { phi_v0 -= phi_v0 / 10; @@ -471,7 +469,7 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { phi_v0 -= temp_t0 / 50; } temp_v1 += phi_v0; - if (((temp_1AC * phi_v0) <= 0) && (temp_t2 >= -0x63) && (temp_t2 < 0x64)) { + if (((this->unk_1AC[arg2] * phi_v0) <= 0) && (temp_t2 >= -0x63) && (temp_t2 < 0x64)) { temp_v1 = 0; phi_v0 = 0; } @@ -480,9 +478,6 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) { } this->unk_20C[arg2] = arg1; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Zl2/func_80B4F230.s") -#endif s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) { |
