ovl_Elf_Msg5 decompiled (#882)

* ovl_Elf_Msg5 decompiled

* pr review changes

* pr reviews

* ELFMSG5_GET_FF
This commit is contained in:
Alejandro Asenjo 2022-07-11 23:06:44 -03:00 committed by GitHub
parent 6dec68464f
commit 9bcd3e2fea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 16 deletions

3
spec
View File

@ -3660,8 +3660,7 @@ beginseg
name "ovl_Elf_Msg5"
compress
include "build/src/overlays/actors/ovl_Elf_Msg5/z_elf_msg5.o"
include "build/data/ovl_Elf_Msg5/ovl_Elf_Msg5.data.o"
include "build/data/ovl_Elf_Msg5/ovl_Elf_Msg5.reloc.o"
include "build/src/overlays/actors/ovl_Elf_Msg5/ovl_Elf_Msg5_reloc.o"
endseg
beginseg

View File

@ -15,8 +15,8 @@ void ElfMsg5_Destroy(Actor* thisx, PlayState* play);
void ElfMsg5_Update(Actor* thisx, PlayState* play);
void func_80AFDB38(ElfMsg5* this, PlayState* play);
s32 func_80AFD990(ElfMsg5* this, PlayState* play);
#if 0
const ActorInit Elf_Msg5_InitVars = {
ACTOR_ELF_MSG5,
ACTORCAT_BG,
@ -29,24 +29,65 @@ const ActorInit Elf_Msg5_InitVars = {
(ActorFunc)NULL,
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_80AFDBD0[] = {
static InitChainEntry sInitChainsInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 200, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_STOP),
};
#endif
s32 func_80AFD990(ElfMsg5* 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 (ELFMSG5_GET_SWITCHFLAG(&this->actor) != 0x7F) {
Flags_SetSwitch(play, ELFMSG5_GET_SWITCHFLAG(&this->actor));
}
Actor_MarkForDeath(&this->actor);
return true;
}
if (this->actor.home.rot.y == 0x81) {
if (Flags_GetClear(play, this->actor.room)) {
(void)"共倒れ2"; // Collapse 2
if (ELFMSG5_GET_SWITCHFLAG(&this->actor) != 0x7F) {
Flags_SetSwitch(play, ELFMSG5_GET_SWITCHFLAG(&this->actor));
}
Actor_MarkForDeath(&this->actor);
return true;
}
}
if (ELFMSG5_GET_SWITCHFLAG(&this->actor) == 0x7F) {
return false;
}
if (Flags_GetSwitch(play, ELFMSG5_GET_SWITCHFLAG(&this->actor))) {
(void)"共倒れ"; // Collapse together
Actor_MarkForDeath(&this->actor);
return true;
}
return false;
}
extern InitChainEntry D_80AFDBD0[];
void ElfMsg5_Init(Actor* thisx, PlayState* play) {
ElfMsg5* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg5/D_80AFDBE0.s")
if (!func_80AFD990(this, play)) {
Actor_ProcessInitChain(&this->actor, sInitChainsInitChain);
this->actor.shape.rot.z = 0;
this->actionFunc = func_80AFDB38;
this->actor.home.rot.x = -0x961;
this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg5/func_80AFD990.s")
void ElfMsg5_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg5/ElfMsg5_Init.s")
void func_80AFDB38(ElfMsg5* this, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg5/ElfMsg5_Destroy.s")
void ElfMsg5_Update(Actor* thisx, PlayState* play) {
ElfMsg5* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg5/func_80AFDB38.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Elf_Msg5/ElfMsg5_Update.s")
if ((this->actor.home.rot.y >= 0) || (this->actor.home.rot.y < -0x80) ||
(Flags_GetSwitch(play, -this->actor.home.rot.y - 1))) {
this->actionFunc(this, play);
}
}

View File

@ -3,13 +3,16 @@
#include "global.h"
#define ELFMSG5_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0x7F)
#define ELFMSG5_GET_FF(thisx) ((thisx)->params & 0xFF)
struct ElfMsg5;
typedef void (*ElfMsg5ActionFunc)(struct ElfMsg5*, PlayState*);
typedef struct ElfMsg5 {
/* 0x0000 */ Actor actor;
/* 0x0144 */ ElfMsg5ActionFunc actionFunc;
/* 0x000 */ Actor actor;
/* 0x144 */ ElfMsg5ActionFunc actionFunc;
} ElfMsg5; // size = 0x148
extern const ActorInit Elf_Msg5_InitVars;