diff options
| author | Kelebek1 <34639600+Kelebek1@users.noreply.github.com> | 2020-08-15 19:03:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-15 14:03:03 -0400 |
| commit | 337aaf2937a1b89d4c36536117261a5fc7b73c97 (patch) | |
| tree | 9ee0fa491d0466390eed5524ca69cae0b9228c55 /src/code | |
| parent | d8d789d2a538f9468d1e9009423acf67a3e0af0f (diff) | |
Match Interface_Update (#322)
* Match Interface_Update
* z_actor.c func_8002C124
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 28 | ||||
| -rw-r--r-- | src/code/z_parameter.c | 32 |
2 files changed, 23 insertions, 37 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index fc9a8e362..a34bd41fa 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -307,13 +307,11 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global func_8002BE98(targetCtx, actor->type, globalCtx); } -#ifdef NON_MATCHING -// regalloc and minor ordering differences void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { - Actor* actor; - Player* player; - GraphicsContext* gfxCtx; + Actor* actor = targetCtx->targetedActor; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* dispRefs[4]; + Player* player; TargetContextEntry* entry; s16 spCE; f32 temp1; @@ -326,8 +324,6 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { f32 var2; s32 i; - actor = targetCtx->targetedActor; - gfxCtx = globalCtx->state.gfxCtx; Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 2029); if (targetCtx->unk_48 != 0) { @@ -355,11 +351,11 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { func_8002BE04(globalCtx, &targetCtx->targetCenterPos, &spBC, &spB4); - temp1 = ((spBC.x * spB4) * 160) * var1; - spBC.x = (temp1 < -320) ? -320 : ((temp1 > 320) ? 320 : temp1); + spBC.x = (160 * (spBC.x * spB4)) * var1; + spBC.x = CLAMP(spBC.x, -320.0f, 320.0f); - temp1 = ((spBC.y * spB4) * 120) * var1; - spBC.y = (temp1 < -240) ? -240 : ((temp1 > 240) ? 240 : temp1); + spBC.y = (120 * (spBC.y * spB4)) * var1; + spBC.y = CLAMP(spBC.y, -240.0f, 240.0f); spBC.z = spBC.z * var1; @@ -373,7 +369,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) { gfxCtx->overlay.p = Gfx_CallSetupDL(gfxCtx->overlay.p, 0x39); - for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++) { + for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) { entry = &targetCtx->arr_50[spAC]; if (entry->unk_0C < 500.0f) { @@ -397,16 +393,15 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY); gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2116), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->overlay.p++, &D_0404D450); + gSPDisplayList(gfxCtx->overlay.p++, D_0404D450); Matrix_Pull(); } } - spCE = spCE - (0xFF / 3); + spCE -= 0xFF / 3; if (spCE < 0) { spCE = 0; } - spAC = (spAC + 1) % 3; } } } @@ -430,9 +425,6 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 2158); } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_8002C124.s") -#endif void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) { s32 pad; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 3715d0180..a228941d4 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3960,16 +3960,14 @@ s16 sTimerDigits[5]; #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Draw.s") #endif -#ifdef NON_MATCHING -// regalloc and minor ordering differences void Interface_Update(GlobalContext* globalCtx) { static u8 D_80125B60 = 0; static s16 D_80125B64 = 0; MessageContext* msgCtx = &globalCtx->msgCtx; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; Player* player = PLAYER; - s16 alpha; // sp+0x3A - s16 alpha1; // sp+0x38 + s16 alpha; + s16 alpha1; u16 action; Input* input = &globalCtx->state.input[2]; @@ -4164,14 +4162,14 @@ void Interface_Update(GlobalContext* globalCtx) { switch (interfaceCtx->unk_1EC) { case 1: - interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); + interfaceCtx->unk_1F4 += 31400.0f / WREG(5); if (interfaceCtx->unk_1F4 >= 15700.0f) { interfaceCtx->unk_1F4 = -15700.0f; interfaceCtx->unk_1EC = 2; } break; case 2: - interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); + interfaceCtx->unk_1F4 += 31400.0f / WREG(5); if (interfaceCtx->unk_1F4 >= 0.0f) { interfaceCtx->unk_1F4 = 0.0f; interfaceCtx->unk_1EC = 0; @@ -4184,14 +4182,14 @@ void Interface_Update(GlobalContext* globalCtx) { } break; case 3: - interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); + interfaceCtx->unk_1F4 += 31400.0f / WREG(5); if (interfaceCtx->unk_1F4 >= 15700.0f) { interfaceCtx->unk_1F4 = -15700.0f; interfaceCtx->unk_1EC = 2; } break; case 4: - interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); + interfaceCtx->unk_1F4 += 31400.0f / WREG(5); if (interfaceCtx->unk_1F4 >= 0.0f) { interfaceCtx->unk_1F4 = 0.0f; interfaceCtx->unk_1EC = 0; @@ -4253,8 +4251,7 @@ void Interface_Update(GlobalContext* globalCtx) { } } - sHBAScoreDigits[1] = 0; - sHBAScoreDigits[0] = 0; + sHBAScoreDigits[0] = sHBAScoreDigits[1] = 0; sHBAScoreDigits[2] = 0; sHBAScoreDigits[3] = gSaveContext.minigameScore; @@ -4289,10 +4286,12 @@ void Interface_Update(GlobalContext* globalCtx) { gSaveContext.unk_1422 = 2; D_80125B64 = D_8011FB40; D_8011FB40 = 400; - } else if ((D_80125B60 == 0) && (gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) { - gSaveContext.unk_1422 = 0; - D_8011FB40 = D_80125B64; - globalCtx->msgCtx.unk_E3EE = 4; + } else if (D_80125B60 == 0) { + if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) { + gSaveContext.unk_1422 = 0; + D_8011FB40 = D_80125B64; + globalCtx->msgCtx.unk_E3EE = 4; + } } else if (gSaveContext.dayTime > 0xC001) { gSaveContext.unk_1422 = 0; D_8011FB40 = D_80125B64; @@ -4328,8 +4327,3 @@ void Interface_Update(GlobalContext* globalCtx) { } } } -#else -u8 D_80125B60 = 0; -s16 D_80125B64 = 0; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_Update.s") -#endif |
