Match a few functions (#324)

* match a few functions

* run formath.sh

* minor fixes
This commit is contained in:
Random
2020-08-15 19:23:29 +02:00
committed by GitHub
parent d3b88e1b1c
commit d8d789d2a5
25 changed files with 145 additions and 1528 deletions
+10 -13
View File
@@ -719,12 +719,10 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
FaultDrawer_SetCharPad(0, 0);
}
#ifdef NON_MATCHING
// regalloc differences
void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
Input* curInput = &sFaultStructPtr->padInput;
u32 addr = pc;
u32 count;
s32 count;
u32 off;
do {
@@ -766,34 +764,33 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
if (CHECK_PAD(curInput->cur, Z_TRIG)) {
off = 0x100;
}
if (CHECK_PAD(curInput->cur, B_BUTTON)) {
off <<= 8;
}
if (CHECK_PAD(curInput->cur, U_JPAD)) {
if (CHECK_PAD(curInput->press, U_JPAD)) {
addr -= off;
}
if (CHECK_PAD(curInput->cur, D_JPAD)) {
if (CHECK_PAD(curInput->press, D_JPAD)) {
addr += off;
}
if (CHECK_PAD(curInput->cur, U_CBUTTONS)) {
if (CHECK_PAD(curInput->press, U_CBUTTONS)) {
addr = pc;
}
if (CHECK_PAD(curInput->cur, D_CBUTTONS)) {
if (CHECK_PAD(curInput->press, D_CBUTTONS)) {
addr = sp;
}
if (CHECK_PAD(curInput->cur, L_CBUTTONS)) {
if (CHECK_PAD(curInput->press, L_CBUTTONS)) {
addr = unk0;
}
if (CHECK_PAD(curInput->cur, R_CBUTTONS)) {
if (CHECK_PAD(curInput->press, R_CBUTTONS)) {
addr = unk1;
}
} while (!CHECK_PAD(curInput->cur, L_TRIG));
} while (!CHECK_PAD(curInput->press, L_TRIG));
sFaultStructPtr->faultActive = true;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_DrawMemDump.s")
#endif
void Fault_WalkStack(u32* spPtr, u32* pcPtr, u32* raPtr) {
u32 sp = *spPtr;
+17 -21
View File
@@ -186,7 +186,7 @@ s32 Sched_Schedule(SchedContext* sc, OSScTask** sp, OSScTask** dp, s32 state) {
OSScTask* gfxTask = sc->gfxListHead;
OSScTask* audioTask = sc->audioListHead;
if (sc->doAudio && ret & OS_SC_SP) {
if (sc->doAudio && (ret & OS_SC_SP)) {
*sp = audioTask;
ret &= ~OS_SC_SP;
sc->doAudio = 0;
@@ -194,27 +194,23 @@ s32 Sched_Schedule(SchedContext* sc, OSScTask** sp, OSScTask** dp, s32 state) {
if (sc->audioListHead == NULL) {
sc->audioListTail = NULL;
}
} else {
if (gfxTask != NULL) {
if (gfxTask->state & OS_SC_YIELDED || !(sc->gfxListHead->flags & OS_SC_NEEDS_RDP)) {
if (ret & OS_SC_SP) {
*sp = gfxTask;
ret &= ~OS_SC_SP;
sc->gfxListHead = sc->gfxListHead->next;
if (sc->gfxListHead == NULL) {
sc->gfxListTail = NULL;
}
} else if (gfxTask != NULL) {
if (gfxTask->state & OS_SC_YIELDED || !(sc->gfxListHead->flags & OS_SC_NEEDS_RDP)) {
if (ret & OS_SC_SP) {
*sp = gfxTask;
ret &= ~OS_SC_SP;
sc->gfxListHead = sc->gfxListHead->next;
if (sc->gfxListHead == NULL) {
sc->gfxListTail = NULL;
}
} else {
if (ret == (OS_SC_SP | OS_SC_DP)) {
if (sc->gfxListHead->framebuffer == NULL || func_800C89D4(sc, gfxTask) != NULL) {
*sp = *dp = gfxTask;
ret &= ~(OS_SC_SP | OS_SC_DP);
sc->gfxListHead = sc->gfxListHead->next;
if (sc->gfxListHead == NULL) {
sc->gfxListTail = NULL;
}
}
}
} else if (ret == (OS_SC_SP | OS_SC_DP)) {
if (sc->gfxListHead->framebuffer == NULL || func_800C89D4(sc, gfxTask) != NULL) {
*sp = *dp = gfxTask;
ret &= ~(OS_SC_SP | OS_SC_DP);
sc->gfxListHead = sc->gfxListHead->next;
if (sc->gfxListHead == NULL) {
sc->gfxListTail = NULL;
}
}
}
+5 -5
View File
@@ -357,7 +357,7 @@ s32 func_800CB934(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2) {
s32 ret = 0;
if ((arg2->y - arg1->x) < (arg0->y - arg0->x)) {
ret = 1;
ret |= 1;
}
if ((arg0->y - arg0->x) < (arg1->y - arg2->x)) {
@@ -413,19 +413,19 @@ s32 func_800CBAE4(Vec3f* v0, Vec3f* v1, Vec3f* v2) {
s32 ret = 0;
if ((v2->x + v2->y + v2->z) < (v0->x + v0->y + v0->z)) {
ret = 0x01;
ret |= 1;
}
if ((-v1->x + v2->y + v2->z) < (-v0->x + v0->y + v0->z)) {
ret |= 0x02;
ret |= 2;
}
if ((-v1->x + v2->y - v1->z) < (-v0->x + v0->y - v0->z)) {
ret |= 0x04;
ret |= 4;
}
if ((v2->x + v2->y - v1->z) < (v0->x + v0->y - v0->z)) {
ret |= 0x08;
ret |= 8;
}
if ((v2->x - v1->y + v2->z) < (v0->x - v0->y + v0->z)) {
+2 -2
View File
@@ -1,7 +1,7 @@
#include <ultra64.h>
#include <global.h>
extern LightsList sLightsList;
LightsList sLightsList;
void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue,
s16 radius, u32 type) {
@@ -59,7 +59,7 @@ Light* Lights_MapperGetNextFreeSlot(LightMapper* mapper) {
return &mapper->lights[mapper->numLights++];
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A084.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A0B4.s")
void func_8007A40C(LightMapper* mapper, LightInfoDirectionalParams* params, GlobalContext* globalCtx) {
Light* light = Lights_MapperGetNextFreeSlot(mapper);
+79 -95
View File
@@ -65,74 +65,74 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
transitionCtx->setType = TransitionCircle_SetType;
transitionCtx->setColor = TransitionCircle_SetColor;
transitionCtx->setEnvColor = TransitionCircle_SetEnvColor;
return;
} else {
switch (transitionCtx->transitionType) {
case 1:
transitionCtx->init = TransitionTriforce_Init;
transitionCtx->destroy = TransitionTriforce_Destroy;
transitionCtx->start = TransitionTriforce_Start;
transitionCtx->isDone = TransitionTriforce_IsDone;
transitionCtx->draw = TransitionTriforce_Draw;
transitionCtx->update = TransitionTriforce_Update;
transitionCtx->setType = TransitionTriforce_SetType;
transitionCtx->setColor = TransitionTriforce_SetColor;
transitionCtx->setEnvColor = NULL;
break;
case 0:
case 8:
transitionCtx->init = TransitionWipe_Init;
transitionCtx->destroy = TransitionWipe_Destroy;
transitionCtx->start = TransitionWipe_Start;
transitionCtx->isDone = TransitionWipe_IsDone;
transitionCtx->draw = TransitionWipe_Draw;
transitionCtx->update = TransitionWipe_Update;
transitionCtx->setType = TransitionWipe_SetType;
transitionCtx->setColor = TransitionWipe_SetColor;
transitionCtx->setEnvColor = NULL;
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 17:
case 18:
case 19:
transitionCtx->init = TransitionFade_Init;
transitionCtx->destroy = TransitionFade_Destroy;
transitionCtx->start = TransitionFade_Start;
transitionCtx->isDone = TransitionFade_IsDone;
transitionCtx->draw = TransitionFade_Draw;
transitionCtx->update = TransitionFade_Update;
transitionCtx->setType = TransitionFade_SetType;
transitionCtx->setColor = TransitionFade_SetColor;
transitionCtx->setEnvColor = NULL;
break;
case 9:
case 10:
globalCtx->transitionMode = 4;
break;
case 11:
globalCtx->transitionMode = 10;
break;
case 12:
globalCtx->transitionMode = 7;
break;
case 14:
globalCtx->transitionMode = 12;
break;
case 15:
globalCtx->transitionMode = 14;
break;
case 16:
globalCtx->transitionMode = 16;
break;
default:
Fault_AddHungupAndCrash("../z_play.c", 2290);
break;
}
}
switch (transitionCtx->transitionType) {
case 1:
transitionCtx->init = TransitionTriforce_Init;
transitionCtx->destroy = TransitionTriforce_Destroy;
transitionCtx->start = TransitionTriforce_Start;
transitionCtx->isDone = TransitionTriforce_IsDone;
transitionCtx->draw = TransitionTriforce_Draw;
transitionCtx->update = TransitionTriforce_Update;
transitionCtx->setType = TransitionTriforce_SetType;
transitionCtx->setColor = TransitionTriforce_SetColor;
transitionCtx->setEnvColor = NULL;
return;
case 0:
case 8:
transitionCtx->init = TransitionWipe_Init;
transitionCtx->destroy = TransitionWipe_Destroy;
transitionCtx->start = TransitionWipe_Start;
transitionCtx->isDone = TransitionWipe_IsDone;
transitionCtx->draw = TransitionWipe_Draw;
transitionCtx->update = TransitionWipe_Update;
transitionCtx->setType = TransitionWipe_SetType;
transitionCtx->setColor = TransitionWipe_SetColor;
transitionCtx->setEnvColor = NULL;
return;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 17:
case 18:
case 19:
transitionCtx->init = TransitionFade_Init;
transitionCtx->destroy = TransitionFade_Destroy;
transitionCtx->start = TransitionFade_Start;
transitionCtx->isDone = TransitionFade_IsDone;
transitionCtx->draw = TransitionFade_Draw;
transitionCtx->update = TransitionFade_Update;
transitionCtx->setType = TransitionFade_SetType;
transitionCtx->setColor = TransitionFade_SetColor;
transitionCtx->setEnvColor = NULL;
return;
case 9:
case 10:
globalCtx->transitionMode = 4;
return;
case 11:
globalCtx->transitionMode = 10;
return;
case 12:
globalCtx->transitionMode = 7;
return;
case 14:
globalCtx->transitionMode = 12;
return;
case 15:
globalCtx->transitionMode = 14;
return;
case 16:
globalCtx->transitionMode = 16;
return;
}
Fault_AddHungupAndCrash("../z_play.c", 2290);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC5E0.s")
@@ -1589,19 +1589,15 @@ Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId) {
}
s32 func_800C04D8(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3) {
u32 ret;
s32 ret = 0;
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
Camera* camera;
Camera* camera = globalCtx->cameraPtrs[camIdx];
Player* player;
camera = globalCtx->cameraPtrs[camIdx];
ret = Camera_SetParam(camera, 1, arg2);
ret *= 2;
ret |= Camera_SetParam(camera, 1, arg2);
ret <<= 1;
ret |= Camera_SetParam(camera, 2, arg3);
if (1) {} // Necessary to match
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
player = camera->player;
@@ -1618,22 +1614,16 @@ s32 func_800C04D8(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3)
return ret;
}
#ifdef NON_MATCHING
// missing an extra stack store/load instruction pair
s32 func_800C05E4(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4) {
u32 ret;
s32 ret = 0;
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
Camera* camera;
Camera* camera = globalCtx->cameraPtrs[camIdx];
Player* player;
camera = globalCtx->cameraPtrs[camIdx];
if (1) {} // Probably necessary to match
ret = Camera_SetParam(camera, 1, arg2);
ret *= 2;
ret |= Camera_SetParam(camera, 1, arg2);
ret <<= 1;
ret |= Camera_SetParam(camera, 2, arg3);
ret *= 2;
ret <<= 1;
ret |= Camera_SetParam(camera, 4, arg4);
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
@@ -1651,18 +1641,12 @@ s32 func_800C05E4(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3,
return ret;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C05E4.s")
#endif
#ifdef NON_MATCHING
// missing an extra move instruction
s32 func_800C0704(GlobalContext* globalCtx, s16 camId, f32 arg2) {
return (Camera_SetParam(globalCtx->cameraPtrs[camId], 32, &arg2) & 1);
s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 32, &arg2) & 1;
if (1) {}
return ret;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0704.s")
#endif
s32 func_800C0744(GlobalContext* globalCtx, s16 camId, s16 arg2) {
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
+1 -1
View File
@@ -273,7 +273,7 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh
func_80096238(SEGMENTED_TO_VIRTUAL(source));
displayListHead++;
gSPBranchList(displayListHead, displayListHead + 5);
gSPBranchList(displayListHead, (u8*)displayListHead + sizeof(uObjBg));
bg = (void*)displayListHead;
bg->b.imageX = 0;
bg->b.imageW = width * 4;
@@ -97,11 +97,12 @@ void func_80892890(BgIngate* this, GlobalContext* globalCtx) {
}
}
void BgIngate_DoNothing(BgIngate* this, GlobalContext* globalCtx) {}
void BgIngate_DoNothing(BgIngate* this, GlobalContext* globalCtx) {
}
void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx) {
BgIngate* this = THIS;
this->actionFunc(this, globalCtx);
}
@@ -83,7 +83,7 @@ void BgJyaBombiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_Kill(thisx);
} else {
Actor_ProcessInitChain(thisx, sInitChain);
// Rock destroyed by jya bomb
osSyncPrintf("(jya 爆弾で破壊岩)(arg_data 0x%04x)\n", thisx->params);
}
@@ -83,8 +83,8 @@ void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx) {
frames = globalCtx->state.frames;
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1,
frames % 128, frames & 0x7F, 32, 32));
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, frames % 128,
frames & 0x7F, 32, 32));
gSPDisplayList(gfxCtx->polyXlu.p++, D_060007D0);
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244);
+9 -16
View File
@@ -182,28 +182,25 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
#ifdef NON_MATCHING
// Issue with Gfx_TwoTexScroll I think
void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnBx* this = THIS;
void* matrices = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx));
Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx));
f32 tmpf1;
f32 tmpf2;
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* dispRefs[4];
Mtx* matrix = &matrices[0];
s16 i;
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bx.c", 464);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x0C, matrices);
gSPSegment(gfxCtx->polyOpa.p++, 0x0C, mtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F]));
gSPSegment(gfxCtx->polyOpa.p++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x10, 0x10, 1, 0,
(-globalCtx->gameplayFrames * 10) % 128, 0x20, 0x20));
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0,
(globalCtx->gameplayFrames * -10) % 128, 32, 32));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bx.c", 478),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -212,14 +209,13 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
this->unk_14E -= 0xBB8;
tmpf1 = Math_Coss(this->unk_14E);
tmpf1 = (tmpf1 * 0.0075f) + 0.015f;
tmpf1 = (Math_Coss(this->unk_14E) * 0.0075f) + 0.015f;
thisx->scale.x = tmpf1;
thisx->scale.z = tmpf1;
for (i = 3; i >= 0; i--) {
tmpf2 = Math_Coss(this->unk_14E + ((i & 0xFF) * 8192));
tmpf2 = (tmpf2 * 0.0075f) + 0.015f;
s16 off = (0x2000 * i);
tmpf2 = (Math_Coss(this->unk_14E + off) * 0.0075f) + 0.015f;
this->unk_184[i].x = tmpf2;
this->unk_184[i].z = tmpf2;
this->unk_1B4[i].x = thisx->shape.rot.x;
@@ -227,17 +223,14 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->unk_1B4[i].z = thisx->shape.rot.z;
}
for (i = 0; i < 4; i++, matrix++) {
for (i = 0; i < 4; i++, mtx++) {
Matrix_Translate(this->unk_154[i].x, this->unk_154[i].y, this->unk_154[i].z, MTXMODE_NEW);
Matrix_RotateRPY(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY);
Matrix_Scale(this->unk_184[i].x, this->unk_184[i].y, this->unk_184[i].z, MTXMODE_APPLY);
Matrix_ToMtx(matrix, "../z_en_bx.c", 507);
Matrix_ToMtx(mtx, "../z_en_bx.c", 507);
}
gSPDisplayList(gfxCtx->polyOpa.p++, D_060022F0);
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bx.c", 511);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Bx/EnBx_Draw.s")
#endif
+4 -11
View File
@@ -342,8 +342,6 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) {
}
}
#ifdef NON_MATCHING
// Regalloc
void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) {
f32 tmpf1;
f32 tmpf2;
@@ -362,15 +360,15 @@ void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) {
if (this->unk_19F == 1) {
Math_SmoothScaleMaxMinF(&this->unk_1F0, this->unk_1F4, 1.0f, 0.1f, 0.001f);
tmpf1 = Math_SmoothScaleMaxMinF(&this->unk_1E8, this->unk_1EC, 1.0f, this->unk_1F0, 0.001f);
this->unk_1A0[0].y += (s16)(this->unk_1E8 * 182.04445f);
this->unk_1A0[0].y += (s32)(this->unk_1E8 * 182.04445f);
if (tmpf1 == 0.0f) {
this->unk_200 = 0;
this->unk_19F = 2;
}
}
if (this->unk_19F == 2) {
this->unk_1A0[0].y = this->unk_1A0[0].y + (s32)(this->unk_1E8 * 182.04445f);
if ((this->unk_200++ < 0x29) ^ 1) {
this->unk_1A0[0].y += (s32)(this->unk_1E8 * 182.04445f);
if (this->unk_200++ > 0x28) {
this->unk_1E8 = this->unk_1B4[0].y - 1.0f;
this->unk_1EC = 1.5f;
this->unk_1F0 = this->unk_1B4[1].y - 1.0f;
@@ -434,8 +432,7 @@ void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) {
this->unk_1B4[0].x = this->unk_1F0 + 1.0f;
this->unk_1B4[0].y = this->unk_1E8 + 1.0f;
this->unk_1B4[0].x += sinf((((this->unk_200 % 0xA) * 0.1f) * 360.0f) * 0.017453292f) * this->unk_1F8;
this->unk_1B4[0].y =
this->unk_1B4[0].y + (sinf((((this->unk_200 % 0xA) * 0.1f) * 360.0f) * 0.017453292f) * this->unk_1F8);
this->unk_1B4[0].y += (sinf((((this->unk_200 % 0xA) * 0.1f) * 360.0f) * 0.017453292f) * this->unk_1F8);
this->unk_200++;
if ((tmpf1 == 0.0f) && (tmpf2 == 0.0f) && (tmpf3 == 0.0f)) {
this->unk_19C = 0;
@@ -446,10 +443,6 @@ void func_80A4F13C(EnGs* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_STONE_ROLLING);
}
}
#else
void func_80A4F13C(EnGs* this, GlobalContext* globalCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gs/func_80A4F13C.s")
#endif
void func_80A4F700(EnGs* this, GlobalContext* globalCtx) {
if (this->unk_200-- <= 0) {
@@ -141,7 +141,7 @@ void func_80A68870(EnHorseGanon* this) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_WALK, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
this->soundCount += 1;
this->soundCount++;
if (this->soundCount >= 2) {
this->soundCount = 0;
}
@@ -69,22 +69,16 @@ void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) {
}
}
#ifdef NON_MATCHING
// regalloc and stack usage differences, most likely the same differences as EnTuboTrap_SpawnWaterFragments
void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx) {
Vec3f* actorPos;
f32 rand;
f32 cos;
f32 sin;
u32 addr;
Vec3f spC8;
Vec3f spBC;
s16 var;
s32 temp;
s32 i;
addr = &D_05017A60;
actorPos = &this->actor.posRot.pos;
Vec3f* actorPos = &this->actor.posRot.pos;
for (i = 0, var = 0; i < 15; i++, var += 20000) {
sin = Math_Sins(var);
@@ -111,31 +105,22 @@ void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx) {
}
func_80029E8C(globalCtx, &spC8, &spBC, actorPos, -240, temp, 10, 10, 0, (Math_Rand_ZeroOne() * 65.0f) + 15.0f,
0, 32, 60, -1, 3, addr);
0, 32, 60, -1, 3, &D_05017A60);
}
func_80033480(globalCtx, actorPos, 30.0f, 4, 20, 50, 0);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_SpawnFragments.s")
#endif
#ifdef NON_MATCHING
// regalloc and stack usage differences, most likely the same differences as EnTuboTrap_SpawnFragments
void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx) {
Vec3f* actorPos;
f32 rand;
f32 cos;
f32 sin;
u32 addr;
Vec3f spC8;
Vec3f spBC;
s16 var;
s32 temp;
s32 i;
addr = &D_05017A60;
actorPos = &this->actor.posRot.pos;
Vec3f* actorPos = &this->actor.posRot.pos;
spC8 = *actorPos;
spC8.y += this->actor.waterY;
@@ -149,9 +134,9 @@ void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx)
spC8.y = (Math_Rand_ZeroOne() * 5.0f) + 2.0f;
spC8.z = cos * 8.0f;
spBC.x = spC8.x * 0.23f;
spBC.x = spC8.x * 0.20f;
spBC.y = (Math_Rand_ZeroOne() * 4.0f) + 2.0f;
spBC.z = spC8.z * 0.23f;
spBC.z = spC8.z * 0.20f;
spC8.x += actorPos->x;
spC8.y += actorPos->y;
@@ -165,12 +150,9 @@ void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx)
}
func_80029E8C(globalCtx, &spC8, &spBC, actorPos, -180, temp, 30, 30, 0, (Math_Rand_ZeroOne() * 65.0f) + 15.0f,
0, 32, 70, -1, 3, addr);
0, 32, 70, -1, 3, &D_05017A60);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_SpawnWaterFragments.s")
#endif
#ifdef NON_MATCHING
void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) {
+4 -4
View File
@@ -407,7 +407,7 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) {
}
#ifdef NON_MATCHING
// Some missing ABS instructions near the bottom of the section on lines 454-461
// single register swap in a subu instruction
void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) {
s32 temp_v1;
s32 temp_t0;
@@ -444,13 +444,13 @@ void func_80B4F230(EnZl2* this, s16 arg1, s32 arg2) {
phi_t5 = ABS(this->unk_1AC[index1AC]);
} else if (arg2 == 16) {
index1AC = 15;
phi_t5 = ABS(this->unk_1AC[index1AC]);
phi_t5 = -ABS(this->unk_1AC[index1AC]);
} else {
index1AC = 18;
phi_t5 = ABS(this->unk_1AC[index1AC]);
phi_t5 = -ABS(this->unk_1AC[index1AC]);
}
if ((s32)fabsf((f32)temp_t3) >= 0x8001) {
if ((s32)fabsf((f32)temp_t3) > 0x8000) {
if (arg1 > 0) {
temp_t3 -= 0x10000;
} else {