1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 06:40:15 +00:00

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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 145 additions and 1528 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);

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

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) {

View file

@ -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;
}

View file

@ -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) {

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 {