mirror of https://github.com/zeldaret/mm.git
`ovl_En_Okarina_Tag` OK (#953)
* `ovl_En_Okarina_Tag` decompiled * Suggested changes * Minor changes
This commit is contained in:
parent
40bfef9f02
commit
3a1f3a04c0
3
spec
3
spec
|
|
@ -1468,8 +1468,7 @@ beginseg
|
|||
name "ovl_En_Okarina_Tag"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.o"
|
||||
include "build/data/ovl_En_Okarina_Tag/ovl_En_Okarina_Tag.data.o"
|
||||
include "build/data/ovl_En_Okarina_Tag/ovl_En_Okarina_Tag.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Okarina_Tag/ovl_En_Okarina_Tag_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ void EnOkarinaTag_Update(Actor* thisx, PlayState* play);
|
|||
void func_8093E518(EnOkarinaTag* this, PlayState* play);
|
||||
void func_8093E68C(EnOkarinaTag* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Okarina_Tag_InitVars = {
|
||||
ACTOR_EN_OKARINA_TAG,
|
||||
ACTORCAT_SWITCH,
|
||||
|
|
@ -30,14 +29,122 @@ const ActorInit En_Okarina_Tag_InitVars = {
|
|||
(ActorFunc)NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/EnOkarinaTag_Destroy.s")
|
||||
void EnOkarinaTag_Init(Actor* thisx, PlayState* play) {
|
||||
EnOkarinaTag* this = THIS;
|
||||
f32 zRot = 0.0f;
|
||||
s32 i = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/EnOkarinaTag_Init.s")
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
this->unk148 = ENOKARINATAG_GET_F800(thisx);
|
||||
this->unk14A = ENOKARINATAG_GET_780(thisx);
|
||||
this->switchFlags = ENOKARINATAG_GET_SWITCHFLAGS(thisx);
|
||||
if (this->actor.world.rot.z > 0) {
|
||||
zRot = this->actor.world.rot.z;
|
||||
while (zRot > 10.0f) {
|
||||
zRot -= 10.0f;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
this->unk154 = zRot * 50.0f;
|
||||
this->unk158 = i * 50.0f;
|
||||
if (this->switchFlags == 0x7F) {
|
||||
this->switchFlags = -1;
|
||||
}
|
||||
if (this->unk14A == 0xF) {
|
||||
this->unk14A = -1;
|
||||
}
|
||||
this->actor.targetMode = 1;
|
||||
this->actionFunc = func_8093E518;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/func_8093E518.s")
|
||||
void func_8093E518(EnOkarinaTag* this, PlayState* play) {
|
||||
f32 xzRange;
|
||||
f32 yRange;
|
||||
s16 yDiff;
|
||||
u16 var_v1;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/func_8093E68C.s")
|
||||
if (this->switchFlags >= 0) {
|
||||
if (this->unk148 == 0) {
|
||||
if (Flags_GetSwitch(play, this->switchFlags)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this->unk148 == 1) {
|
||||
if (!Flags_GetSwitch(play, this->switchFlags)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
var_v1 = this->unk14A;
|
||||
if (var_v1 == 6) {
|
||||
var_v1 = 0xA;
|
||||
if (gSaveContext.save.unk_F65 == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this->unk14A == -1) {
|
||||
var_v1 = 0;
|
||||
}
|
||||
if (func_800B8718(&this->actor, &play->state)) {
|
||||
func_80152434(play, var_v1 + 0x29);
|
||||
this->actionFunc = func_8093E68C;
|
||||
} else {
|
||||
yDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y));
|
||||
if (yDiff >= 0x4300) {
|
||||
this->unk150 = 0;
|
||||
return;
|
||||
}
|
||||
xzRange = this->unk154;
|
||||
this->unk150 = 1;
|
||||
if (xzRange == 0.0f) {
|
||||
xzRange = 50000.0f;
|
||||
}
|
||||
yRange = this->unk158;
|
||||
if (yRange == 0.0f) {
|
||||
yRange = 50000.0f;
|
||||
}
|
||||
func_800B874C(&this->actor, play, xzRange, yRange);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Okarina_Tag/EnOkarinaTag_Update.s")
|
||||
void func_8093E68C(EnOkarinaTag* this, PlayState* play) {
|
||||
if (play->msgCtx.ocarinaMode == 4) {
|
||||
this->actionFunc = func_8093E518;
|
||||
} else {
|
||||
if ((play->msgCtx.ocarinaMode == 3) ||
|
||||
((this->unk14A == -1) &&
|
||||
((play->msgCtx.ocarinaMode == 5) || (play->msgCtx.ocarinaMode == 6) || (play->msgCtx.ocarinaMode == 7) ||
|
||||
(play->msgCtx.ocarinaMode == 8) || (play->msgCtx.ocarinaMode == 0xA) || (play->msgCtx.ocarinaMode == 9) ||
|
||||
(play->msgCtx.ocarinaMode == 0xF)))) {
|
||||
if (this->switchFlags >= 0) {
|
||||
switch (this->unk148) {
|
||||
case 0:
|
||||
Flags_SetSwitch(play, this->switchFlags);
|
||||
break;
|
||||
case 1:
|
||||
Flags_UnsetSwitch(play, this->switchFlags);
|
||||
break;
|
||||
case 2:
|
||||
if (Flags_GetSwitch(play, this->switchFlags)) {
|
||||
Flags_UnsetSwitch(play, this->switchFlags);
|
||||
} else {
|
||||
Flags_SetSwitch(play, this->switchFlags);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
play->msgCtx.ocarinaMode = 4;
|
||||
play_sound(NA_SE_SY_CORRECT_CHIME);
|
||||
this->actionFunc = func_8093E518;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnOkarinaTag_Update(Actor* thisx, PlayState* play) {
|
||||
EnOkarinaTag* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,19 @@ struct EnOkarinaTag;
|
|||
|
||||
typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, PlayState*);
|
||||
|
||||
#define ENOKARINATAG_GET_SWITCHFLAGS(thisx) (((thisx)->params & 0x7F))
|
||||
#define ENOKARINATAG_GET_780(thisx) (((thisx)->params >> 0x7) & 0xF)
|
||||
#define ENOKARINATAG_GET_F800(thisx) (((thisx)->params >> 0xB) & 0x1F)
|
||||
|
||||
typedef struct EnOkarinaTag {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnOkarinaTagActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x14];
|
||||
/* 0x148 */ s16 unk148;
|
||||
/* 0x14A */ s16 unk14A;
|
||||
/* 0x14C */ s32 switchFlags;
|
||||
/* 0x150 */ s8 unk150;
|
||||
/* 0x154 */ f32 unk154;
|
||||
/* 0x158 */ f32 unk158;
|
||||
} EnOkarinaTag; // size = 0x15C
|
||||
|
||||
extern const ActorInit En_Okarina_Tag_InitVars;
|
||||
|
|
|
|||
Loading…
Reference in New Issue