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
25 changed files with 138 additions and 3869 deletions
+17 -29
View File
@@ -5,25 +5,19 @@ void func_80110990(GlobalContext* globalCtx) {
Map_Destroy(globalCtx);
}
#ifdef NON_MATCHING
// regalloc, stack usage and minor ordering differences
void func_801109B0(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 parameterStart;
s32 parameterSize;
s32 do_actionStart;
s32 do_actionOffset;
s32 temp;
u32 parameterSize;
u16 do_actionOffset;
u8 temp;
gSaveContext.unk_1422 = 0;
gSaveContext.unk_13EA = 0;
gSaveContext.unk_13E8 = 0;
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0;
View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx);
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = 0;
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
interfaceCtx->unk_1F0 = 0;
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0;
interfaceCtx->unk_22E = 0;
interfaceCtx->unk_230 = 16;
interfaceCtx->unk_1F4 = 0.0f;
@@ -34,34 +28,32 @@ void func_801109B0(GlobalContext* globalCtx) {
interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = interfaceCtx->healthAlpha = interfaceCtx->startAlpha =
interfaceCtx->magicAlpha = 0;
parameterStart = _parameter_staticSegmentRomStart;
parameterSize = _parameter_staticSegmentRomEnd - parameterStart;
parameterSize = (u32)_parameter_staticSegmentRomEnd - (u32)_parameter_staticSegmentRomStart;
// Translates to: "Permanent PARAMETER Segment = %x"
osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize);
interfaceCtx->parameterSegment = GameState_Alloc(&globalCtx->state, parameterSize, "../z_construct.c", 159);
osSyncPrintf("parameter->parameterSegment=%x", interfaceCtx->parameterSegment);
osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment);
if (interfaceCtx->parameterSegment == NULL) {
__assert("parameter->parameterSegment != NULL", "../z_construct.c", 161);
}
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, parameterStart, parameterSize, "../z_construct.c", 162);
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (u32)_parameter_staticSegmentRomStart, parameterSize,
"../z_construct.c", 162);
interfaceCtx->do_actionSegment = GameState_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166);
// Translates to: "DO Action Texture Initialization"
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480);
osSyncPrintf("parameter->do_actionSegment=%x", interfaceCtx->do_actionSegment);
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->do_actionSegment);
if (interfaceCtx->do_actionSegment == NULL) {
__assert("parameter->do_actionSegment != NULL", "../z_construct.c", 169);
}
do_actionStart = _do_action_staticSegmentRomStart;
if (gSaveContext.language == 0) {
do_actionOffset = 0;
} else if (gSaveContext.language == 1) {
@@ -70,8 +62,8 @@ void func_801109B0(GlobalContext* globalCtx) {
do_actionOffset = 0x5700;
}
DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, do_actionStart + do_actionOffset, 0x300, "../z_construct.c",
174);
DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, (u32)_do_action_staticSegmentRomStart + do_actionOffset, 0x300,
"../z_construct.c", 174);
if (gSaveContext.language == 0) {
do_actionOffset = 0x480;
@@ -81,8 +73,8 @@ void func_801109B0(GlobalContext* globalCtx) {
do_actionOffset = 0x5B80;
}
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300), do_actionStart + do_actionOffset, 0x180,
"../z_construct.c", 178);
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300),
(u32)_do_action_staticSegmentRomStart + do_actionOffset, 0x180, "../z_construct.c", 178);
interfaceCtx->icon_itemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
@@ -126,11 +118,11 @@ void func_801109B0(GlobalContext* globalCtx) {
"../z_construct.c", 219);
}
osSyncPrintf("EVENT=%d\n", gSaveContext.timer1State);
osSyncPrintf("EVENT=%d\n", ((void)0, gSaveContext.timer1State));
if ((gSaveContext.timer1State == 4) || (gSaveContext.timer1State == 8) || (gSaveContext.timer2State == 4) ||
(gSaveContext.timer2State == 10)) {
osSyncPrintf("restart_flag=%d\n", gSaveContext.respawnFlag);
osSyncPrintf("restart_flag=%d\n", ((void)0, gSaveContext.respawnFlag));
if ((gSaveContext.respawnFlag == -1) || (gSaveContext.respawnFlag == 1)) {
if (gSaveContext.timer1State == 4) {
@@ -167,8 +159,7 @@ void func_801109B0(GlobalContext* globalCtx) {
Health_InitData(globalCtx);
Map_Init(globalCtx);
interfaceCtx->unk_242 = 0;
interfaceCtx->unk_23C = 0;
interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0;
R_ITEM_BTN_X(0) = 160;
R_B_BTN_COLOR(0) = 255;
@@ -182,9 +173,6 @@ void func_801109B0(GlobalContext* globalCtx) {
R_A_BTN_COLOR(1) = 200;
R_A_BTN_COLOR(2) = 50;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_construct/func_801109B0.s")
#endif
void func_80110F68(GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
+10 -14
View File
@@ -129,14 +129,12 @@ s32 EffectSpark_Update(void* thisx) {
}
// original name: "EffectSparkInfo_disp"
#ifdef NON_MATCHING
// minor ordering and saved register usage differences
void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
Vtx* vertices;
EffectSpark* this = (EffectSpark*)thisx; // sp1E0
EffectSparkElement* elem;
EffectSpark* this = (EffectSpark*)thisx;
GlobalContext* globalCtx;
f32 ratio;
s32 i;
s32 j;
u8 sp1D3;
u8 sp1D2;
u8 sp1D1;
@@ -153,11 +151,12 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
u8 sp1C6;
u8 sp1C5;
u8 sp1C4;
s32 i;
s32 j;
f32 ratio;
globalCtx = Effect_GetGlobalCtx();
if (1) {}
OPEN_DISPS(gfxCtx, "../z_eff_spark.c", 293);
if (this != NULL) {
@@ -182,7 +181,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
if (vertices == NULL) {
// Translates to: "Memory Allocation Failure graph_malloc"
osSyncPrintf("EffectSparkInfo_disp():メモリー確保失敗 graph_malloc\n");
return;
goto end;
}
j = 0;
@@ -210,6 +209,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
MtxF spEC;
MtxF spAC;
MtxF sp6C;
EffectSparkElement* elem;
Mtx* mtx;
f32 temp;
@@ -267,11 +267,9 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
j += 4;
if (this) {}
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C);
if (mtx == NULL) {
break;
goto end;
}
gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -282,8 +280,6 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
gDPPipeSync(oGfxCtx->polyXlu.p++);
}
end:
CLOSE_DISPS(gfxCtx, "../z_eff_spark.c", 498);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Draw.s")
#endif
+11 -16
View File
@@ -14,18 +14,17 @@ ElfMessage sAdultSariaMsgs[] = {
{ 0x06, 0x30, 0x6C, 0x69 }, { 0x06, 0x30, 0x6C, 0x6A }, { 0xE0, 0x00, 0x6D, 0x00 },
};
#ifdef NON_MATCHING
// minor ordering and regalloc differences
u32 ElfMessage_CheckCondition(ElfMessage* msg) {
u16 temp;
s32 type = msg->byte0 & 0x1E;
u16 flag;
switch (msg->byte0 & 0x1E) {
switch (type) {
case 0:
temp = 1 << (msg->byte1 & 0x0F);
return ((msg->byte0 & 1) == 1) == !!(gSaveContext.eventChkInf[(msg->byte1 & 0xF0) >> 4] & temp);
flag = 1 << (msg->byte1 & 0x0F);
return ((msg->byte0 & 1) == 1) == ((flag & gSaveContext.eventChkInf[(msg->byte1 & 0xF0) >> 4]) != 0);
case 2:
return ((msg->byte0 & 1) == 1) ==
!!(gBitFlags[msg->byte1 - ITEM_KEY_BOSS] & gSaveContext.dungeonItems[gSaveContext.mapIndex]);
((gSaveContext.dungeonItems[gSaveContext.mapIndex] & gBitFlags[msg->byte1 - ITEM_KEY_BOSS]) != 0);
case 4:
return ((msg->byte0 & 1) == 1) == (msg->byte3 == INV_CONTENT(msg->byte1));
case 6:
@@ -34,16 +33,16 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
return ((msg->byte0 & 1) == 1) == ((msg->byte1 & 0x0F) == CUR_UPG_VALUE(UPG_STRENGTH));
case 0x10:
return ((msg->byte0 & 1) == 1) ==
!!((gBitFlags[msg->byte3 - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) &
gSaveContext.equipment);
(((gBitFlags[msg->byte3 - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) &
gSaveContext.equipment) != 0);
case 0x20:
return ((msg->byte0 & 1) == 1) ==
!!(CHECK_QUEST_ITEM(msg->byte3 - ITEM_SONG_MINUET + QUEST_SONG_MINUET));
((CHECK_QUEST_ITEM(msg->byte3 - ITEM_SONG_MINUET + QUEST_SONG_MINUET)) != 0);
case 0x30:
return ((msg->byte0 & 1) == 1) ==
!!(CHECK_QUEST_ITEM(msg->byte3 - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST));
((CHECK_QUEST_ITEM(msg->byte3 - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST)) != 0);
case 0x40:
return ((msg->byte0 & 1) == 1) == !!gSaveContext.magicAcquired;
return ((msg->byte0 & 1) == 1) == (((void)0, gSaveContext.magicAcquired) != 0);
}
}
@@ -53,10 +52,6 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
return false;
}
#else
u32 ElfMessage_CheckCondition(ElfMessage* msg);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/ElfMessage_CheckCondition.s")
#endif
u32 func_8006BE88(ElfMessage** msgp) {
u32 temp = true;
+2 -1
View File
@@ -36,6 +36,7 @@ void TransitionFade_Destroy(TransitionFade* this) {
}
#ifdef NON_MATCHING
// ordering differences
void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
char pad[2];
s16 newAlpha;
@@ -50,7 +51,7 @@ void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
this->fadeTimer = gSaveContext.fadeDuration;
this->isDone = 1;
}
if (gSaveContext.fadeDuration == 0) {
if (!gSaveContext.fadeDuration) {
// Divide by 0! Zero is included in ZCommonGet fade_speed
osSyncPrintf(VT_COL(RED, WHITE) "0除算! ZCommonGet fade_speed に0がはいってる" VT_RST);
}
+2 -20
View File
@@ -142,8 +142,6 @@ typedef struct {
/* 0x10 */ s16 type;
} struct_8011F9B8;
#ifdef NON_MATCHING
// regalloc differences
void func_8006D684(GlobalContext* globalCtx, Player* player) {
s32 pad;
s32 i;
@@ -203,9 +201,9 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) {
if ((globalCtx->sceneNum == D_8011F9B8[i].scene) &&
(gSaveContext.cutsceneIndex == D_8011F9B8[i].cutsceneIndex)) {
(((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) {
if (D_8011F9B8[i].type == 7) {
if ((globalCtx->sceneNum == 99) && (gSaveContext.cutsceneIndex == 0xFFF1)) {
if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
D_8011F9B8[i].pos.x = player->actor.posRot.pos.x;
D_8011F9B8[i].pos.y = player->actor.posRot.pos.y;
D_8011F9B8[i].pos.z = player->actor.posRot.pos.z;
@@ -223,7 +221,6 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
} else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) {
Vec3f sp54;
s32 temp;
s32 pad2;
temp = 0;
if (((gSaveContext.eventInf[0] & 0x10) >> 4) && D_8011F9B8[i].type == 6) {
@@ -261,21 +258,6 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
}
}
}
#else
Vec3s D_8011F9A0[] = {
{ 0xF46F, 0x0139, 0x1E14 },
{ 0xF894, 0x0139, 0x1B67 },
{ 0xF035, 0x0139, 0x1B15 },
{ 0xF6F7, 0x0139, 0x1766 },
};
struct_8011F9B8 D_8011F9B8[] = {
{ 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 },
{ 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 },
{ 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 },
{ 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_8006D684.s")
#endif
void func_8006DC68(GlobalContext* globalCtx, Player* player) {
if (LINK_IS_ADULT) {
+4 -8
View File
@@ -311,11 +311,10 @@ void Map_Init(GlobalContext* globalCtx) {
}
}
#ifdef NON_MATCHING
// regalloc and minor ordering differences
void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
s32 pad;
Player* player = PLAYER;
s16 tempX, tempY, tempZ;
s16 tempX, tempZ;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 565);
@@ -335,8 +334,8 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
Matrix_Translate((R_COMPASS_OFFSET_X + tempX) / 10.0f, (R_COMPASS_OFFSET_Y - tempZ) / 10.0f, 0.0f, MTXMODE_NEW);
Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY);
Matrix_RotateX(-1.6f, MTXMODE_APPLY);
tempY = (0x7FFF - player->actor.shape.rot.y) / 0x400;
Matrix_RotateY(tempY / 10.0f, MTXMODE_APPLY);
tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400;
Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY);
gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 585),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -360,9 +359,6 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 607);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/Minimap_DrawCompassIcons.s")
#endif
void Minimap_Draw(GlobalContext* globalCtx) {
s32 pad[2];
@@ -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;
@@ -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--;
@@ -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) {