additional matching functions in z_room, z_camera, and En_Zl3 (#541)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* could be useful

* whoops

* ZAP2 stuff

* ZAP why

* ZAP again

* small improvement

* also minor

* merge

* matches

* the room?

* woo matches

* spelling fix
This commit is contained in:
petrie911
2020-12-18 21:09:38 -06:00
committed by GitHub
parent 83e53bbaf2
commit 2373c779d1
9 changed files with 143 additions and 1643 deletions
+34 -48
View File
@@ -2888,7 +2888,7 @@ s32 Camera_Battle1(Camera* camera) {
if (!skipEyeAtCalc) {
var3 = atToTargetDir.pitch * batt1->swingPitchAdj;
var2 = F32_LERPIMP(sp7C, sp78, distRatio);
tmpAng1 = DEGF_TO_BINANG(var2) - (s16)(playerToTargetDir.pitch * (.5f + distRatio * (1.0f - .5f)));
tmpAng1 = DEGF_TO_BINANG(var2) - (s16)(playerToTargetDir.pitch * (0.5f + distRatio * (1.0f - 0.5f)));
tmpAng1 += (s16)(var3);
if (tmpAng1 < -0x2AA8) {
@@ -3209,7 +3209,7 @@ s32 Camera_KeepOn1(Camera* camera) {
if (sp88 == 0) {
spE2 = DEGF_TO_BINANG((f32)(keep1->unk_14 + ((keep1->unk_18 - keep1->unk_14) * sp84)));
spE2 -= (s16)(spC8.pitch * (.5f + (sp84 * .5f)));
spE2 -= (s16)(spC8.pitch * (0.5f + (sp84 * 0.5f)));
spE8 = spD0.pitch * keep1->unk_1C;
spE2 += (s16)spE8;
@@ -3439,7 +3439,6 @@ s32 Camera_KeepOn3(Camera* camera) {
return 1;
}
#ifdef NON_MATCHING
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;
static Vec3f D_8015BD60;
@@ -3477,15 +3476,15 @@ s32 Camera_KeepOn4(Camera* camera) {
camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50;
return 1;
}
camera->unk_14C &= ~0x20;
unk20->unk_14 = *temp_s0;
camera->unk_14C &= ~0x20;
}
if (unk20->unk_14 != *temp_s0) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: item: item type changed %d -> %d\n" VT_RST, unk20->unk_14,
*temp_s0);
camera->unk_14C |= 0x20;
camera->animState = 0x14;
camera->unk_14C |= 0x20;
camera->unk_14C &= ~(0x4 | 0x2);
camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50;
return 1;
@@ -3631,6 +3630,7 @@ s32 Camera_KeepOn4(Camera* camera) {
spA0 = DEGF_TO_BINANG(keep4->unk_0C);
} else if ((keep4->unk_1C & 8) && camera->target != NULL) {
PosRot sp60;
func_8002EF44(&sp60, camera->target);
spA2 = DEGF_TO_BINANG(keep4->unk_08) - sp60.rot.x;
spA0 = BINANG_SUB(BINANG_ROT180(sp60.rot.y), spA8.yaw) > 0
@@ -3640,13 +3640,12 @@ s32 Camera_KeepOn4(Camera* camera) {
sp9C++;
} else if ((keep4->unk_1C & 0x80) && camera->target != NULL) {
PosRot sp4C;
func_8002EF14(&sp4C, camera->target);
spA2 = ((s16)((keep4->unk_08) * (182.04167f) + .5f));
if (1) {
sp9E = Camera_XZAngle(&sp4C.pos, &playerPosRot->pos);
spA0 = (BINANG_SUB(sp9E, spA8.yaw) > 0) ? sp9E + ((s16)((keep4->unk_0C) * (182.04167f) + .5f))
: sp9E - ((s16)((keep4->unk_0C) * (182.04167f) + .5f));
}
spA2 = DEGF_TO_BINANG(keep4->unk_08);
sp9E = Camera_XZAngle(&sp4C.pos, &playerPosRot->pos);
spA0 = (BINANG_SUB(sp9E, spA8.yaw) > 0) ? sp9E + DEGF_TO_BINANG(keep4->unk_0C)
: sp9E - DEGF_TO_BINANG(keep4->unk_0C);
spCC[1] = camera->target;
sp9C++;
} else if (keep4->unk_1C & 0x40) {
@@ -3675,8 +3674,7 @@ s32 Camera_KeepOn4(Camera* camera) {
}
osSyncPrintf("camera: item: BG&collision check %d time(s)\n", i);
}
temp_f0_2 = BINANG_SUB(spB8.pitch, spA8.pitch) / (f32)unk20->unk_10;
unk20->unk_04 = temp_f0_2;
unk20->unk_04 = BINANG_SUB(spB8.pitch, spA8.pitch) / (f32)unk20->unk_10;
unk20->unk_00 = BINANG_SUB(spB8.yaw, spA8.yaw) / (f32)unk20->unk_10;
unk20->unk_0C = spA8.yaw;
unk20->unk_0E = spA8.pitch;
@@ -3699,7 +3697,8 @@ s32 Camera_KeepOn4(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(at, at, &spB8);
}
camera->atLERPStepScale = 0.0f;
spB8.r = camera->dist = Camera_LERPCeilF(keep4->unk_04, camera->dist, 0.25f, 2.0f);
camera->dist = Camera_LERPCeilF(keep4->unk_04, camera->dist, 0.25f, 2.0f);
spB8.r = camera->dist;
if (unk20->unk_10 != 0) {
camera->unk_14C |= 0x20;
unk20->unk_0C += (s16)unk20->unk_00;
@@ -3734,12 +3733,6 @@ s32 Camera_KeepOn4(Camera* camera) {
camera->fov = Camera_LERPCeilF(keep4->unk_18, camera->fov, camera->fovUpdateRate, 1.0f);
camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA);
}
#else
Vec3f D_8015BD50;
Vec3f D_8015BD60;
Vec3f D_8015BD70;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_KeepOn4.s")
#endif
/**
* Talking in a pre-rendered room
@@ -6983,31 +6976,25 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) {
}
#ifdef NON_MATCHING
// Lots of saved register problems. Probably equivalent, but not certain.
void Camera_PrintSettings(Camera* camera) {
char sp58[8];
char sp50[8];
char sp48[8];
s16 temp_v0;
s32 temp_v0_2;
s8* temp_t6;
s8* temp_t7;
s8* temp_t8;
s8* temp_t9;
Camera* temp_a0;
s32 phi_a1;
char* phi_v1;
char* phi_t0;
s32 phi_v0;
s32 phi_v0_2;
s32 phi_a1;
if (OREG(0) & 1 && camera->thisIdx == camera->globalCtx->activeCamera && !gDbgCamEnabled) {
for (phi_a1 = 0, phi_v1 = sp58, phi_t0 = sp48; phi_v1 < &sp58[4]; phi_v1++, phi_t0++, phi_a1++) {
temp_a0 = camera->globalCtx->cameraPtrs[phi_a1];
if (temp_a0 == NULL) {
if ((OREG(0) & 1) && (camera->thisIdx == camera->globalCtx->activeCamera) && !gDbgCamEnabled) {
phi_a1 = 0;
phi_v1 = sp58;
phi_t0 = sp48;
for (; phi_v1 < sp58 + 4; phi_v1++, phi_t0++, phi_a1++) {
if (camera->globalCtx->cameraPtrs[phi_a1] == NULL) {
*phi_v1 = '-';
*phi_t0 = ' ';
} else {
switch (temp_a0->status) {
switch (camera->globalCtx->cameraPtrs[phi_a1]->status) {
case 0:
*phi_v1 = 'c';
*phi_t0 = ' ';
@@ -7035,8 +7022,8 @@ void Camera_PrintSettings(Camera* camera) {
}
}
}
*phi_v1++ = '\0';
*phi_t0++ = '\0';
*phi_v1 = '\0';
*phi_t0 = '\0';
sp48[camera->globalCtx->activeCamera] = 'a';
func_8006376C(3, 0x16, 5, sp58);
@@ -7049,20 +7036,19 @@ void Camera_PrintSettings(Camera* camera) {
func_8006376C(5, 0x19, 4,
sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx]);
phi_v0 = 0;
phi_a1 = 0;
if (camera->camDataIdx < 0) {
sp50[phi_v0++] = '-';
sp50[phi_a1++] = '-';
}
phi_v0_2 = camera->camDataIdx / 0xA;
if (phi_v0_2 != 0) {
sp50[phi_v0++] = phi_v0 / 0xA + '0';
if (camera->camDataIdx / 0xA != 0) {
sp50[phi_a1++] = phi_a1 / 0xA + '0';
}
sp50[phi_v0++] = phi_v0 % 10 + '0';
sp50[phi_v0++] = ' ';
sp50[phi_v0++] = ' ';
sp50[phi_v0++] = ' ';
sp50[phi_v0++] = ' ';
sp50[phi_v0] = '\0';
sp50[phi_a1++] = phi_a1 % 10 + '0';
sp50[phi_a1++] = ' ';
sp50[phi_a1++] = ' ';
sp50[phi_a1++] = ' ';
sp50[phi_a1++] = ' ';
sp50[phi_a1] = '\0';
func_8006376C(3, 26, 5, "I:");
func_8006376C(5, 26, 4, sp50);
}
+63 -69
View File
@@ -81,13 +81,13 @@ typedef struct struct_80095D04 {
// Room Draw Polygon Type 2
#ifdef NON_MATCHING
// this function still needs some work but it should be functionally equivalent
// Saved register problems and ordering issues, but definitely equivalent.
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
PolygonType2* polygon2;
PolygonDlist2* polygonDlist;
struct_80095D04 spB8[SHAPE_SORT_MAX];
struct_80095D04* spB4;
struct_80095D04* spB0;
struct_80095D04* spB4 = NULL;
struct_80095D04* spB0 = NULL;
struct_80095D04* phi_v0;
struct_80095D04* phi_a0;
struct_80095D04* spA4;
@@ -98,21 +98,18 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
f32 sp80;
PolygonDlist2* phi_s0;
PolygonDlist2* sp78;
f32 temp_f0;
PolygonDlist2* temp;
f32 temp_f2;
spB0 = NULL;
spB4 = NULL;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 287);
if (flags & 1) {
func_800342EC(&D_801270A0, globalCtx);
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
func_80093C80(globalCtx);
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (1) {}
if (1) {}
if (flags & 2) {
func_8003435C(&D_801270A0, globalCtx);
gSPSegment(POLY_XLU_DISP++, 0x03, room->segment);
@@ -120,31 +117,29 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
spA4 = &spB8[0];
polygonDlist = SEGMENTED_TO_VIRTUAL(room->mesh->polygon2.start);
polygon2 = &room->mesh->polygon2;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon2->start);
spA4 = spB8;
if (polygon2->num > SHAPE_SORT_MAX) {
__assert("polygon2->num <= SHAPE_SORT_MAX", "../z_room.c", 317);
}
sp78 = polygonDlist;
for (sp9C = 0; sp9C < polygon2->num; sp9C++) {
for (sp9C = 0; sp9C < polygon2->num; sp9C++, polygonDlist++) {
sp90.x = polygonDlist->pos.x;
sp90.y = polygonDlist->pos.y;
sp90.z = polygonDlist->pos.z;
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &sp90, &sp84, &sp80);
temp_f0 = polygonDlist->unk_06;
if (-temp_f0 < sp84.z) {
temp_f2 = sp84.z - temp_f0;
if (-(f32)polygonDlist->unk_06 < sp84.z) {
temp_f2 = sp84.z - polygonDlist->unk_06;
if (temp_f2 < globalCtx->lightCtx.unk_0C) {
phi_v0 = spB4;
spA4->unk_00 = polygonDlist;
spA4->unk_04 = temp_f2;
phi_v0 = spB4;
if (spB4 == 0) {
spB0 = spA4;
spB4 = spA4;
spA4->unk_0C = NULL;
spA4->unk_08 = NULL;
if (phi_v0 == NULL) {
spB4 = spB0 = spA4;
spA4->unk_08 = spA4->unk_0C = NULL;
} else {
do {
if (spA4->unk_04 < phi_v0->unk_04) {
@@ -159,59 +154,65 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) {
spB0->unk_0C = spA4;
spB0 = spA4;
} else {
phi_a0 = phi_v0->unk_08;
spA4->unk_08 = phi_a0;
if (phi_a0 == NULL) {
spA4->unk_08 = phi_v0->unk_08;
if (spA4->unk_08 == NULL) {
spB4 = spA4;
} else {
phi_a0->unk_0C = spA4;
spA4->unk_08->unk_0C = spA4;
}
phi_v0->unk_08 = spA4;
spA4->unk_0C = (void*)phi_v0;
spA4->unk_0C = phi_v0;
}
}
spA4 = spA4++;
spA4++;
}
}
polygonDlist++;
}
iREG(87) = polygon2->num;
sp9C = 1;
while (spB4 != NULL) {
for (sp9C = 1; spB4 != NULL; spB4 = spB4->unk_0C, sp9C++) {
Gfx* temp2;
phi_s0 = spB4->unk_00;
if (iREG(86) != 0) {
phi_v1 = 0;
while (phi_v1 < polygon2->num) {
if (phi_s0 == sp78) {
break;
temp = sp78;
for (phi_v1 = 0; phi_v1 < polygon2->num; phi_v1++, temp++) {
if (phi_s0 == temp) {
break; // This loop does nothing?
}
phi_v1++;
sp78++;
}
if (((iREG(86) == 1) && (iREG(89) > sp9C)) || ((iREG(86) == 2) && (iREG(89) == sp9C))) {
if ((flags & 1) && (phi_s0->opa != NULL)) {
gSPDisplayList(POLY_OPA_DISP++, phi_s0->opa);
if (((iREG(86) == 1) && (iREG(89) >= sp9C)) || ((iREG(86) == 2) && (iREG(89) == sp9C))) {
if (flags & 1) {
temp2 = phi_s0->opa;
if (temp2 != NULL) {
gSPDisplayList(POLY_OPA_DISP++, temp2);
}
}
if ((flags & 2) && (phi_s0->xlu != NULL)) {
gSPDisplayList(POLY_XLU_DISP++, phi_s0->xlu);
if (flags & 2) {
temp2 = phi_s0->xlu;
if (temp2 != NULL) {
gSPDisplayList(POLY_XLU_DISP++, temp2);
}
}
}
} else {
if ((flags & 1) && (phi_s0->opa != NULL)) {
gSPDisplayList(POLY_OPA_DISP++, phi_s0->opa);
if (flags & 1) {
temp2 = phi_s0->opa;
if (temp2 != NULL) {
gSPDisplayList(POLY_OPA_DISP++, temp2);
}
}
if ((flags & 2) && (phi_s0->xlu != NULL)) {
gSPDisplayList(POLY_XLU_DISP++, phi_s0->xlu);
if (flags & 2) {
temp2 = phi_s0->xlu;
if (temp2 != NULL) {
gSPDisplayList(POLY_XLU_DISP++, temp2);
}
}
}
spB4 = spB4->unk_0C;
sp9C++;
}
iREG(88) = sp9C - 1;
@@ -256,19 +257,17 @@ s32 func_80096238(void* data) {
return 0;
}
#ifdef NON_MATCHING
// pointer arithmetic doesn't quite match
void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
u16 tlutCount, f32 frameX, f32 frameY) {
Gfx* displayListHead;
uObjBg* bg;
s32 temp;
displayListHead = *displayList;
func_80096238(SEGMENTED_TO_VIRTUAL(source));
displayListHead++;
gSPBranchList(displayListHead, (u8*)displayListHead + sizeof(uObjBg));
bg = (void*)displayListHead;
bg = displayListHead + 1;
gSPBranchList(displayListHead, (u8*)bg + sizeof(uObjBg));
bg->b.imageX = 0;
bg->b.imageW = width * 4;
bg->b.frameX = frameX * 4;
@@ -282,11 +281,10 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh
bg->b.imagePal = 0;
bg->b.imageFlip = 0;
displayListHead = (void*)(bg + 1);
if (fmt == G_IM_FMT_CI) {
displayListHead = (void*)(bg + 1);
gDPLoadTLUT(displayListHead++, tlutCount, 256, tlut);
} else {
displayListHead = (void*)(bg + 1);
gDPPipeSync(displayListHead++);
}
@@ -297,13 +295,17 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh
gDPSetOtherMode(displayListHead++, mode0 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
gSPBgRectCopy(displayListHead++, bg);
} else {
bg->s.frameW = width * 4;
bg->s.frameH = height * 4;
bg->s.scaleW = 1024;
bg->s.scaleH = 1024;
bg->s.imageYorig = bg->b.imageY;
gDPSetOtherMode(displayListHead++, mode0 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
if (1) {}
gDPSetOtherMode(displayListHead++,
mode0 | G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE |
G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA));
@@ -315,11 +317,6 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh
gDPPipeSync(displayListHead++);
*displayList = displayListHead;
}
#else
void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
u16 tlutCount, f32 frameX, f32 frameY);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8009638C.s")
#endif
// Room Draw Polygon Type 1 - Single Format
void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) {
@@ -495,7 +492,7 @@ void func_80096FD4(GlobalContext* globalCtx, Room* room) {
}
#ifdef NON_MATCHING
// regalloc differences
// regalloc differences near the end
u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
u8 nextRoomNum;
u32 maxRoomSize = 0;
@@ -512,7 +509,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
}
if (globalCtx->nbTransitionActors != 0) {
s32 j = 0;
s32 j;
RomFile* roomList = globalCtx->roomList;
TransitionActorEntry* transitionActor = &globalCtx->transitionActorList[0];
@@ -547,11 +544,8 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
roomCtx->unk_30 = 0;
roomCtx->status = 0;
if (gSaveContext.respawnFlag > 0) {
nextRoomNum = gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex;
} else {
nextRoomNum = globalCtx->setupEntranceList[globalCtx->curSpawn].room;
}
nextRoomNum = (gSaveContext.respawnFlag - 1 >= 0) ? gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex
: globalCtx->setupEntranceList[globalCtx->curSpawn].room;
func_8009728C(globalCtx, roomCtx, nextRoomNum);
return maxRoomSize;
@@ -542,6 +542,7 @@ void func_80ADA35C(EnPoSisters* this, GlobalContext* globalCtx) {
if (this->unk_196 != 0) {
this->unk_196--;
}
this->actor.posRot.pos.y += (2.0f + 0.5f * Math_Rand_ZeroOne()) * Math_Sins(this->unk_196 * 0x800);
if (this->unk_22E.a == 255 && this->actionFunc != func_80ADA8C0 && this->actionFunc != func_80ADA7F0) {
if (this->actionFunc == func_80ADAC70) {
@@ -35,7 +35,7 @@ void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyaketiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyatekiMan_RestartGame(EnSyatekiMan* this, GlobalContext* globalCtx);
void EnSyatekiMan_BlinkWait(EnSyatekiMan* this);
@@ -313,13 +313,13 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) {
void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx) {
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
if (Actor_HasParent(&this->actor, globalCtx)) {
this->actionFunc = EnSyaketiMan_FinishPrize;
this->actionFunc = EnSyatekiMan_FinishPrize;
} else {
func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f);
}
}
void EnSyaketiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx) {
void EnSyatekiMan_FinishPrize(EnSyatekiMan* this, GlobalContext* globalCtx) {
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
if ((func_8010BDBC(&globalCtx->msgCtx) == 6) && func_80106BC8(globalCtx)) {
// Successful completion
+41 -51
View File
@@ -234,20 +234,19 @@ void func_80B53974(EnZl3* this, u8 arg1) {
this->unk_3C8 = arg1;
}
#ifdef NON_MATCHING
void func_80B53980(EnZl3* this, s16 y, s32 idx) {
SkelAnime* skelAnime = &this->skelAnime;
void func_80B53980(EnZl3* thisx, s16 y, s32 idx) {
EnZl3* this = THIS; // this function might take thisx
s32 action = this->action;
EnZl3* this2 = this;
s16 y2 = y;
s32 yTemp;
f32 animCurrentFrame;
f32 unk_3DC;
if (this->unk_2FC != 0) {
s32 temp25C = this2->unk_25C[idx];
s32 temp28C = (s16)(y + this2->unk_28C[idx]);
s32 temp2BC = y - this2->unk_2BC[idx];
SkelAnime* skelAnime = &this->skelAnime;
s32 temp25C = this->unk_25C[idx];
s32 temp28C = (s16)(y + this->unk_28C[idx]);
s32 temp2BC = y - this->unk_2BC[idx];
if ((s32)fabsf(temp2BC) > 0x8000) {
if (y2 > 0) {
@@ -274,7 +273,6 @@ void func_80B53980(EnZl3* this, s16 y, s32 idx) {
temp28C = y;
temp25C = 0;
}
if (idx == 0 && action == 3) {
yTemp = y + -11000;
if (skelAnime->mode == 2) {
@@ -302,30 +300,22 @@ void func_80B53980(EnZl3* this, s16 y, s32 idx) {
}
this->unk_2BC[idx] = y;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Zl3/func_80B53980.s")
#endif
// Assorted regalloc issues
#ifdef NON_MATCHING
void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
void func_80B53B64(EnZl3* thisx, s16 z, s32 idx) {
EnZl3* this = THIS;
SkelAnime* skelAnime = &this->skelAnime;
s32 action = this->action;
s32 phi_a1;
s32 idx25C;
s16 temp_t1;
s32 temp_a0;
s32 temp_a3_2;
s32 temp_a3_3;
s32 temp_a3_4;
s32 temp_a3_5;
s32 temp_a3_6;
s32 temp_a3_7;
s32 temp_a3_8;
s32 temp_a3;
s32 temp_v1_3;
s32 phi_v1;
s32 phi_v0;
s32 phi_v1_2;
s32 test;
if (idx == 2) {
phi_a1 = 15000;
@@ -351,11 +341,10 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
}
if (this->unk_2FC != 0) {
temp_t1 = this->unk_25C[idx];
temp_a3_3 = this->unk_28C[idx] + z;
phi_v0 = temp_t1 = this->unk_25C[idx];
temp_a3 = this->unk_28C[idx] + z;
phi_v1 = z - this->unk_2BC[idx];
temp_a0 = (s16)(temp_a3_3);
phi_v0 = temp_t1;
temp_a0 = (s16)(temp_a3);
if ((s32)fabsf(phi_v1) > 0x8000) {
if (z > 0) {
@@ -391,9 +380,10 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
if (phi_v0 != 0) {
phi_v0 -= phi_v0 / 10;
}
test = (s16)(temp_a0 - phi_a1);
if ((s16)(temp_a0 - phi_a1) != 0) {
phi_v0 -= (s16)(temp_a0 - phi_a1) / 50;
if (test != 0) {
phi_v0 -= test / 50;
}
temp_a0 += phi_v0;
@@ -408,9 +398,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
if (skelAnime->mode == 2) {
f32 animCurrentFrame = skelAnime->animCurrentFrame;
temp_a3_2 = (s32)(((this->unk_3E0 - animCurrentFrame) / this->unk_3E0) * -2000.0f) + phi_a1;
if (temp_a3_2 >= phi_a1) {
phi_a1 = temp_a3_2;
temp_a3 = (s32)(((this->unk_3E0 - animCurrentFrame) / this->unk_3E0) * -2000.0f) + phi_a1;
if (temp_a3 >= phi_a1) {
phi_a1 = temp_a3;
if (phi_v0 < 0) {
phi_v0 /= -2;
}
@@ -418,9 +408,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
}
} else if (action == 5) {
if (skelAnime->mode == 2) {
temp_a3_3 = (s32)((skelAnime->animCurrentFrame / this->unk_3E4) * -2000.0f) + phi_a1;
if (temp_a3_3 >= phi_a1) {
phi_a1 = temp_a3_3;
temp_a3 = (s32)((skelAnime->animCurrentFrame / this->unk_3E4) * -2000.0f) + phi_a1;
if (temp_a3 >= phi_a1) {
phi_a1 = temp_a3;
if (phi_v0 < 0) {
phi_v0 /= -2;
}
@@ -438,15 +428,15 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
f32 unk_3F4 = this->unk_3F4;
if (skelAnime->animCurrentFrame <= 42.0f) {
phi_v1_2 = phi_a1 - 2000;
temp_a3 = phi_a1 - 2000;
} else {
phi_v1_2 =
temp_a3 =
(s32)((((skelAnime->animCurrentFrame - 42.0f) * 6200.0f) / (unk_3F4 - 42.0f)) + -2000.0f) +
phi_a1;
}
if (phi_v1_2 >= phi_a1) {
phi_a1 = phi_v1_2;
if (temp_a3 >= phi_a1) {
phi_a1 = temp_a3;
if (phi_v0 < 0) {
phi_v0 /= -2;
}
@@ -461,9 +451,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
}
} else if (action == 22) {
if (skelAnime->mode == 2) {
temp_a3_4 = (s32)(((skelAnime->animCurrentFrame / this->unk_3EC) * -5200.0f) + 4200.0f) + phi_a1;
if (temp_a3_4 >= phi_a1) {
phi_a1 = temp_a3_4;
temp_a3 = (s32)(((skelAnime->animCurrentFrame / this->unk_3EC) * -5200.0f) + 4200.0f) + phi_a1;
if (temp_a3 >= phi_a1) {
phi_a1 = temp_a3;
if (phi_v0 < 0) {
phi_v0 /= -2;
}
@@ -478,9 +468,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
}
} else if (action == 23) {
if (skelAnime->mode == 2) {
temp_a3_5 = (s32)(((skelAnime->animCurrentFrame / this->unk_3F0) * -7600.0f) + -2000.0f) + phi_a1;
if (temp_a3_5 >= phi_a1) {
phi_a1 = temp_a3_5;
temp_a3 = (s32)(((skelAnime->animCurrentFrame / this->unk_3F0) * -7600.0f) + -2000.0f) + phi_a1;
if (temp_a3 >= phi_a1) {
phi_a1 = temp_a3;
if (phi_v0 < 0) {
phi_v0 /= -2;
}
@@ -495,9 +485,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
}
} else if (action == 24) {
if (skelAnime->mode == 2) {
temp_a3_6 = (s32)(((skelAnime->animCurrentFrame / this->unk_3E8) * 21000.0f) + -9600.0f) + phi_a1;
if (temp_a3_6 >= phi_a1) {
phi_a1 = temp_a3_6;
temp_a3 = (s32)(((skelAnime->animCurrentFrame / this->unk_3E8) * 21000.0f) + -9600.0f) + phi_a1;
if (temp_a3 >= phi_a1) {
phi_a1 = temp_a3;
if (phi_v0 < 0) {
phi_v0 /= -2;
}
@@ -514,9 +504,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
} else if (idx == 11 || idx == 17) {
if (action == 4) {
if (skelAnime->mode == 2) {
temp_a3_7 = (s32)((skelAnime->animCurrentFrame / this->unk_3E0) * -7000.0f) + phi_a1;
if (phi_a1 >= temp_a3_7) {
phi_a1 = temp_a3_7;
temp_a3 = (s32)((skelAnime->animCurrentFrame / this->unk_3E0) * -7000.0f) + phi_a1;
if (phi_a1 >= temp_a3) {
phi_a1 = temp_a3;
if (phi_v0 > 0) {
phi_v0 /= -2;
}
@@ -533,9 +523,9 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) {
if (skelAnime->mode == 2) {
f32 animCurrentFrame = skelAnime->animCurrentFrame;
temp_a3_8 = (s32)(((this->unk_3E4 - animCurrentFrame) / this->unk_3E4) * -7000.0f) + phi_a1;
if (phi_a1 >= temp_a3_8) {
phi_a1 = temp_a3_8;
temp_a3 = (s32)(((this->unk_3E4 - animCurrentFrame) / this->unk_3E4) * -7000.0f) + phi_a1;
if (phi_a1 >= temp_a3) {
phi_a1 = temp_a3;
if (phi_v0 > 0) {
phi_v0 /= -2;
}