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

Match/Improve more non matching functions (#366)

* Match/Improve more non matchings

* Remove SET_NEXT_GAMESTATE from preserved macros
This commit is contained in:
Roman971 2020-08-30 18:51:46 +02:00 committed by GitHub
parent 2a2fdf7f3e
commit b4ac94a8fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 138 additions and 3869 deletions

View file

@ -19,6 +19,7 @@ void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx);
void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx);
void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx);
void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx);
void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx);
const ActorInit Bg_Ydan_Maruta_InitVars = {
ACTOR_BG_YDAN_MARUTA,
@ -57,13 +58,11 @@ extern UNK_TYPE D_060066A8;
extern Gfx D_06008D88[];
extern Gfx D_06006570[];
#ifdef NON_MATCHING
// Register issues
void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 i;
s32 pad;
BgYdanMaruta* this = THIS;
Vec3f sp4C[3];
s32 pad;
s32 i;
f32 sinRotY;
f32 cosRotY;
s32 localConst = 0;
@ -72,13 +71,15 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(thisx, D_808BF388);
Collider_InitTris(globalCtx, &this->collider);
Collider_SetTris(globalCtx, &this->collider, thisx, &D_808BF378, &this->colliderItems);
this->unk_168 = thisx->params;
thisx->params = ((thisx->params >> 8) & 0xFF) & 0xFF;
items = &D_808BF300[1];
this->unk_168 = thisx->params & 0xFFFF;
thisx->params = (thisx->params >> 8) & 0xFF;
if (thisx->params == 0) {
items = &D_808BF300[0];
this->actionFunc = func_808BEFF4;
} else {
items = &D_808BF300[1];
DynaPolyInfo_SetActorMove(&this->dyna, 0);
DynaPolyInfo_Alloc(&D_060066A8, &localConst);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localConst);
@ -90,22 +91,24 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = func_808BF078;
}
}
sinRotY = Math_Sins(thisx->shape.rot.y);
cosRotY = Math_Coss(thisx->shape.rot.y);
for (i = 0; i < 3; i++) {
sp4C[i].x = (items->dim.vtx[i].x * cosRotY) + thisx->posRot.pos.x;
sp4C[i].y = items->dim.vtx[i].y + thisx->posRot.pos.y;
sp4C[i].z = thisx->posRot.pos.z - (items->dim.vtx[i].x * sinRotY);
}
func_800627A0(&this->collider, 0, &sp4C[0], &sp4C[1], &sp4C[2]);
sp4C[1].x = (items->dim.vtx[2].x * cosRotY) + thisx->posRot.pos.x;
sp4C[1].y = items->dim.vtx[0].y + thisx->posRot.pos.y;
sp4C[1].z = thisx->posRot.pos.z - (items->dim.vtx[2].x * sinRotY);
func_800627A0(&this->collider, 1, &sp4C[0], &sp4C[2], &sp4C[1]);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Init.s")
#endif
void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgYdanMaruta* this = THIS;
@ -137,10 +140,8 @@ void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx) {
}
}
#ifdef NON_EQUIVALENT
// Casting issues and a branch issue
void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) {
s16 phi_v0;
s16 temp;
if (this->unk_16A != 0) {
this->unk_16A--;
@ -148,25 +149,23 @@ void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) {
if (this->unk_16A == 0) {
this->actionFunc = func_808BF1EC;
}
phi_v0 = this->unk_16A;
if ((phi_v0 < 0) && ((phi_v0 % 4) != 0)) {
phi_v0 -= 4;
}
phi_v0 -= 2;
if (phi_v0 == -2) {
phi_v0 = 0;
if (1) {}
temp = (this->unk_16A % 4) - 2;
if (temp == -2) {
temp = 0;
} else {
phi_v0 *= 2;
temp *= 2;
}
this->dyna.actor.posRot.pos.x =
(Math_Coss(this->dyna.actor.shape.rot.y) * phi_v0) + this->dyna.actor.initPosRot.pos.x;
(Math_Coss(this->dyna.actor.shape.rot.y) * temp) + this->dyna.actor.initPosRot.pos.x;
this->dyna.actor.posRot.pos.z =
(Math_Sins(this->dyna.actor.shape.rot.y) * phi_v0) + this->dyna.actor.initPosRot.pos.z;
(Math_Sins(this->dyna.actor.shape.rot.y) * temp) + this->dyna.actor.initPosRot.pos.z;
func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/func_808BF108.s")
#endif
void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y += 1.0f;

View file

@ -43,44 +43,50 @@ const ActorInit En_Ex_Ruppy_InitVars = {
static Vec3f D_80A0B358[] = { { 0.0f, 0.1f, 0.0f }, { 0.0f, 0.0f, 0.0f } };
static Vec3f D_80A0B370[] = { { 0.0f, 0.01f, 0.0f }, { 0.0f, 0.0f, 0.0f } };
#ifdef NON_MATCHING
// Regalloc
void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) {
EnExRuppy* this = THIS;
s16 temp_v0;
f32 phi_f12;
f32 temp;
EnDivingGame* divingGame;
f32 temp1;
f32 temp2;
s16 temp3;
this->unk_152 = this->actor.params;
// Index
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ インデックス ☆☆☆☆☆ %x" VT_RST, this->unk_152);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ インデックス ☆☆☆☆☆ %x\n" VT_RST, this->unk_152); // "Index"
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 25.0f);
switch (this->unk_152) {
case 0:
this->unk_160 = 0.01f;
Actor_SetScale(&this->actor, this->unk_160);
this->actor.room = -1;
this->actor.gravity = 0.0f;
// If you havnt won the diving game before you will get 5 blue ruppees.
// If you haven't won the diving game before, you will always get 5 rupees
if (!(gSaveContext.eventChkInf[3] & 0x100)) {
this->rupeeValue = 5;
this->unk_150 = 1;
} else {
phi_f12 = 200.99f;
if ((thisx->parent != NULL) && (thisx->parent->update != NULL)) {
phi_f12 = 200.99f + ((EnDivingGame*)thisx->parent)->unk_2AA * 10.0f;
temp1 = 200.99f;
if (this->actor.parent != NULL) {
divingGame = (EnDivingGame*)this->actor.parent;
if (divingGame->actor.update != NULL) {
temp2 = divingGame->unk_2AA * 10.0f;
temp1 += temp2;
}
}
temp_v0 = Math_Rand_ZeroFloat(phi_f12);
if ((temp_v0 >= 0) && (temp_v0 < 40)) {
temp3 = Math_Rand_ZeroFloat(temp1);
if ((temp3 >= 0) && (temp3 < 40)) {
this->rupeeValue = 1;
this->unk_150 = 0;
} else if ((temp_v0 >= 40) && (temp_v0 < 170)) {
} else if ((temp3 >= 40) && (temp3 < 170)) {
this->rupeeValue = 5;
this->unk_150 = 1;
} else if ((temp_v0 >= 170) && (temp_v0 < 190)) {
} else if ((temp3 >= 170) && (temp3 < 190)) {
this->rupeeValue = 20;
this->unk_150 = 2;
} else if ((temp_v0 >= 190) && (temp_v0 < 200)) {
} else if ((temp3 >= 190) && (temp3 < 200)) {
this->rupeeValue = 50;
this->unk_150 = 4;
} else {
@ -88,39 +94,43 @@ void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, this->unk_160);
this->rupeeValue = 500;
this->unk_150 = 3;
if ((thisx->parent != NULL) && (thisx->parent->update != NULL)) {
((EnDivingGame*)thisx->parent)->unk_2AA = 0;
if (this->actor.parent != NULL) {
divingGame = (EnDivingGame*)this->actor.parent;
if (divingGame->actor.update != NULL) {
divingGame->unk_2AA = 0;
}
}
}
}
temp_v0 = this->actor.posRot.rot.z;
this->actor.posRot.rot.z = 0;
this->timer = 30;
this->actor.shape.unk_10 = 7.0f;
this->actor.shape.unk_08 = 700.0f;
this->unk_15A = temp_v0;
this->unk_15A = this->actor.posRot.rot.z;
this->actor.posRot.rot.z = 0;
this->timer = 30;
this->actor.flags &= ~1;
this->actionFunc = EnExRuppy_DropIntoWater;
break;
case 1:
case 2: // Giant pink ruppe that explodes when you touch it
if (this->unk_152 == 1) {
Actor_SetScale(thisx, 0.1f);
Actor_SetScale(&this->actor, 0.1f);
this->unk_150 = 4;
} else {
Actor_SetScale(thisx, 0.02f);
this->unk_150 = (s16)Math_Rand_ZeroFloat(3.99f) + 1;
}
this->actor.gravity = -3.0f;
// Wow Coin
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ わーなーコイン ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ わーなーコイン ☆☆☆☆☆ \n" VT_RST); // "Wow Coin"
this->actor.shape.unk_10 = 6.0f;
this->actor.shape.unk_08 = 700.0f;
this->actor.flags &= ~1;
this->actionFunc = EnExRuppy_WaitToBlowUp;
break;
case 3: // Spawned by the guard in Hyrule courtyard
Actor_SetScale(thisx, 0.02f);
Actor_SetScale(&this->actor, 0.02f);
this->unk_150 = 0;
switch ((s16)Math_Rand_ZeroFloat(30.99f)) {
case 0:
@ -128,32 +138,28 @@ void EnExRuppy_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
case 10:
case 20:
this->unk_150 = 1;
break;
case 30:
this->unk_150 = 1;
break;
}
this->actor.gravity = -3.0f;
// Normal rupee
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ノーマルルピー ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ ノーマルルピー ☆☆☆☆☆ \n" VT_RST); // "Normal rupee"
this->actor.shape.unk_10 = 6.0f;
this->actor.shape.unk_08 = 700.0f;
this->actor.flags &= ~1;
this->actionFunc = EnExRuppy_WaitAsCollectible;
break;
case 4:
this->actor.gravity = -3.0f;
this->actor.flags &= ~1;
Actor_SetScale(thisx, 0.01f);
Actor_SetScale(&this->actor, 0.01f);
this->actor.shape.unk_10 = 6.0f;
this->actor.shape.unk_08 = -700.0f;
this->actionFunc = func_80A0B0F4;
break;
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ex_Ruppy/EnExRuppy_Init.s")
#endif
void EnExRuppy_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
@ -268,7 +274,7 @@ void func_80A0AD88(EnExRuppy* this, GlobalContext* globalCtx) {
func_800293E4(globalCtx, &this->actor.posRot.pos, 0.0f, 5.0f, 5.0f, Math_Rand_ZeroFloat(0.03f) + 0.07f);
}
if (this->actor.parent != NULL) {
divingGame = this->actor.parent;
divingGame = (EnDivingGame*)this->actor.parent;
if (divingGame->actor.update != NULL) {
if (divingGame->unk_29C == 0) {
this->timer = 20;
@ -311,11 +317,11 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, GlobalContext* globalCtx) {
((EnDivingGame*)this->actor.parent)->transitionDrawTable[15].z = 1;
}
} else {
// That idiot! error
// "That idiot! error"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ そ、そんなばかな!エラー!!!!! ☆☆☆☆☆ \n" VT_RST);
}
// Stupid!
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ バカめ! ☆☆☆☆☆ \n" VT_RST);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ バカめ! ☆☆☆☆☆ \n" VT_RST); // "Stupid!"
explosionScale = 100;
explosionScaleStep = 30;
if (this->unk_152 == 2) {
@ -350,7 +356,7 @@ void func_80A0B0F4(EnExRuppy* this, GlobalContext* globalCtx) {
void EnExRuppy_Update(Actor* thisx, GlobalContext* globalCtx) {
EnExRuppy* this = THIS;
thisx->shape.rot.y += 1960;
this->actor.shape.rot.y += 1960;
this->actionFunc(this, globalCtx);
if (this->timer != 0) {
this->timer--;

View file

@ -564,18 +564,20 @@ void func_80B12BA4(EnSyatekiNiw* this, GlobalContext* globalCtx) {
}
}
#ifdef NON_MATCHING
// Regalloc in the switch, tmp in v1 rather than s0
void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
s16 i;
s32 tmp;
EnSyatekiNiw* this = THIS;
s32 pad;
s16 i;
Vec3f sp90 = { 0.0f, 0.0f, 0.0f };
Vec3f sp84 = { 0.0f, 0.0f, 0.0f };
Vec3f sp78;
Vec3f sp6C;
Vec3f sp60;
if (1) {}
if (1) {}
if (1) {}
func_80B132A8(this, globalCtx);
this->unk_28C++;
if (this->unk_254 != 0) {
@ -640,30 +642,25 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
tmp = 0;
i = 0;
switch (this->unk_29E) {
case 0:
if (globalCtx->unk_11E5C != 0) {
tmp = 1;
i = 1;
}
break;
case 1:
tmp = 1;
i = 1;
break;
}
if (tmp) {
if (i != 0) {
Collider_CylinderUpdate(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
#else
Vec3f D_80B136B8 = { 0.0f, 0.0f, 0.0f };
Vec3f D_80B136C4 = { 0.0f, 0.0f, 0.0f };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Syateki_Niw/EnSyatekiNiw_Update.s")
#endif
s32 SyatekiNiw_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* thisx) {