mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-27 06:40:36 +00:00
ovl_Elf_Msg3 decompiled (#865)
* progress * ovl_Elf_Msg3 decompiled * pr review changes * PlayState * if else * chained assignment * pr review changes
This commit is contained in:
parent
c35d699d8a
commit
2bcb88c05f
3
spec
3
spec
@ -2617,8 +2617,7 @@ beginseg
|
||||
name "ovl_Elf_Msg3"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Elf_Msg3/z_elf_msg3.o"
|
||||
include "build/data/ovl_Elf_Msg3/ovl_Elf_Msg3.data.o"
|
||||
include "build/data/ovl_Elf_Msg3/ovl_Elf_Msg3.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Elf_Msg3/ovl_Elf_Msg3_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_elf_msg3.h"
|
||||
#include "overlays/actors/ovl_En_Elf/z_en_elf.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
@ -14,9 +15,8 @@ void ElfMsg3_Init(Actor* thisx, PlayState* play);
|
||||
void ElfMsg3_Destroy(Actor* thisx, PlayState* play);
|
||||
void ElfMsg3_Update(Actor* thisx, PlayState* play);
|
||||
|
||||
void ElfMsg3_SetupAction(ElfMsg3* this, ElfMsg3ActionFunc actionFunc);
|
||||
void func_80A2CF7C(ElfMsg3* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit Elf_Msg3_InitVars = {
|
||||
ACTOR_ELF_MSG3,
|
||||
ACTORCAT_ITEMACTION,
|
||||
@ -29,28 +29,118 @@ const ActorInit Elf_Msg3_InitVars = {
|
||||
(ActorFunc)NULL,
|
||||
};
|
||||
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static InitChainEntry D_80A2D1E0[] = {
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#endif
|
||||
void ElfMsg3_SetupAction(ElfMsg3* this, ElfMsg3ActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
extern InitChainEntry D_80A2D1E0[];
|
||||
s32 func_80A2CD1C(ElfMsg3* this, PlayState* play) {
|
||||
if ((this->actor.home.rot.y > 0) && (this->actor.home.rot.y < 0x81) &&
|
||||
(Flags_GetSwitch(play, this->actor.home.rot.y - 1))) {
|
||||
(void)"共倒れ"; // "Collapse together"
|
||||
if (ELFMSG3_GET_SWITCH(&this->actor) != 0x7F) {
|
||||
Flags_SetSwitch(play, ELFMSG3_GET_SWITCH(&this->actor));
|
||||
}
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
return true;
|
||||
}
|
||||
if (this->actor.home.rot.y == 0x81) {
|
||||
if (Flags_GetClear(play, this->actor.room)) {
|
||||
if (ELFMSG3_GET_SWITCH(&this->actor) != 0x7F) {
|
||||
Flags_SetSwitch(play, ELFMSG3_GET_SWITCH(&this->actor));
|
||||
}
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (ELFMSG3_GET_SWITCH(&this->actor) == 0x7F) {
|
||||
return false;
|
||||
}
|
||||
if (Flags_GetSwitch(play, ELFMSG3_GET_SWITCH(&this->actor))) {
|
||||
(void)"共倒れ"; // "Collapse together"
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/D_80A2D1F0.s")
|
||||
void ElfMsg3_Init(Actor* thisx, PlayState* play) {
|
||||
ElfMsg3* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/ElfMsg3_SetupAction.s")
|
||||
if (!func_80A2CD1C(this, play)) {
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
if (ABS_ALT(this->actor.home.rot.x) == 0) {
|
||||
this->actor.scale.z = 0.4f;
|
||||
this->actor.scale.x = 0.4f;
|
||||
} else {
|
||||
this->actor.scale.x = this->actor.scale.z = ABS_ALT(this->actor.home.rot.x) * 0.04f;
|
||||
}
|
||||
if (this->actor.home.rot.z == 0) {
|
||||
this->actor.scale.y = 0.4f;
|
||||
} else {
|
||||
this->actor.scale.y = this->actor.home.rot.z * 0.04f;
|
||||
}
|
||||
ElfMsg3_SetupAction(this, func_80A2CF7C);
|
||||
this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/func_80A2CD1C.s")
|
||||
void ElfMsg3_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/ElfMsg3_Init.s")
|
||||
s32 func_80A2CF50(ElfMsg3* this) {
|
||||
if (ELFMSG3_GET_8000(&this->actor) != 0) {
|
||||
return ELFMSG3_GET_FF(&this->actor) + 0x200;
|
||||
} else {
|
||||
return -0x200 - ELFMSG3_GET_FF(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/ElfMsg3_Destroy.s")
|
||||
void func_80A2CF7C(ElfMsg3* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
EnElf* tatl = (EnElf*)player->tatlActor;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/func_80A2CF50.s")
|
||||
if (((((player->tatlActor != NULL) &&
|
||||
(fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x))) &&
|
||||
(this->actor.world.pos.y <= player->actor.world.pos.y)) &&
|
||||
((player->actor.world.pos.y - this->actor.world.pos.y) < (100.0f * this->actor.scale.y))) &&
|
||||
(fabsf(player->actor.world.pos.z - this->actor.world.pos.z) < (100.0f * this->actor.scale.z))) {
|
||||
player->tatlTextId = func_80A2CF50(this);
|
||||
ActorCutscene_SetIntentToPlay(0x7C);
|
||||
tatl->elfMsg = &this->actor;
|
||||
if (this->actor.cutscene == -1) {
|
||||
this->actor.cutscene = 0x7C;
|
||||
}
|
||||
if ((player->tatlTextId < 0) && (this->actor.home.rot.x < 0)) {
|
||||
if (ActorCutscene_GetCurrentIndex() == 0x7D) {
|
||||
ActorCutscene_Stop(0x7D);
|
||||
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
|
||||
} else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
|
||||
ActorCutscene_Start(this->actor.cutscene, &this->actor);
|
||||
func_800E0348(play->cameraPtrs[0]);
|
||||
} else {
|
||||
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/func_80A2CF7C.s")
|
||||
void ElfMsg3_Update(Actor* thisx, PlayState* play) {
|
||||
ElfMsg3* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg3/ElfMsg3_Update.s")
|
||||
if (!func_80A2CD1C(this, play)) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
|
||||
if (ELFMSG3_GET_SWITCH(thisx) != 0x7F) {
|
||||
Flags_SetSwitch(play, ELFMSG3_GET_SWITCH(thisx));
|
||||
}
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
} else if ((this->actor.home.rot.y >= 0) || (this->actor.home.rot.y < -0x80) ||
|
||||
(Flags_GetSwitch(play, -1 - this->actor.home.rot.y))) {
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,17 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define ELFMSG3_GET_SWITCH(thisx) (((thisx)->params & 0x7F00) >> 8)
|
||||
#define ELFMSG3_GET_FF(thisx) ((thisx)->params & 0xFF)
|
||||
#define ELFMSG3_GET_8000(thisx) ((thisx)->params & 0x8000)
|
||||
|
||||
struct ElfMsg3;
|
||||
|
||||
typedef void (*ElfMsg3ActionFunc)(struct ElfMsg3*, PlayState*);
|
||||
|
||||
typedef struct ElfMsg3 {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ ElfMsg3ActionFunc actionFunc;
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ ElfMsg3ActionFunc actionFunc;
|
||||
} ElfMsg3; // size = 0x148
|
||||
|
||||
extern const ActorInit Elf_Msg3_InitVars;
|
||||
|
Loading…
Reference in New Issue
Block a user