ovl_Obj_Demo decompiled (#860)

* ovl_Obj_Demo decompiled

* pr review

* pr review changes

* Empty-Commit

* pr review
This commit is contained in:
Alejandro Asenjo 2022-07-11 22:19:45 -03:00 committed by GitHub
parent 35961a7cb9
commit ffb90132c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 12 deletions

3
spec
View File

@ -1996,8 +1996,7 @@ beginseg
name "ovl_Obj_Demo"
compress
include "build/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.o"
include "build/data/ovl_Obj_Demo/ovl_Obj_Demo.data.o"
include "build/data/ovl_Obj_Demo/ovl_Obj_Demo.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Demo/ovl_Obj_Demo_reloc.o"
endseg
beginseg

View File

@ -15,8 +15,8 @@ void ObjDemo_Update(Actor* thisx, PlayState* play);
void func_80983678(ObjDemo* this, PlayState* play);
void func_80983704(ObjDemo* this, PlayState* play);
void func_80983634(PlayState* play);
#if 0
const ActorInit Obj_Demo_InitVars = {
ACTOR_OBJ_DEMO,
ACTORCAT_PROP,
@ -29,14 +29,88 @@ const ActorInit Obj_Demo_InitVars = {
(ActorFunc)NULL,
};
#endif
void ObjDemo_Init(Actor* thisx, PlayState* play) {
ObjDemo* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Demo/ObjDemo_Init.s")
thisx->params = OBJDEMO_GET_FF(thisx);
if ((thisx->params != OBJDEMO_FF_FF) && (Flags_GetSwitch(play, thisx->params))) {
Actor_MarkForDeath(&this->actor);
return;
}
if (thisx->shape.rot.x < 0) {
this->unk_148 = 1;
thisx->shape.rot.x = -thisx->shape.rot.x;
}
if (thisx->shape.rot.x == 0) {
this->xzRange = 80.0f;
} else {
this->xzRange = thisx->shape.rot.x * 4.0f;
thisx->shape.rot.x = 0;
thisx->world.rot.x = 0;
}
if (thisx->shape.rot.z == 0) {
this->yRange = 60.0f;
} else {
this->yRange = thisx->shape.rot.z * 4.0f;
thisx->shape.rot.z = 0;
thisx->world.rot.z = 0;
}
func_80983634(play);
this->actionFunc = func_80983678;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Demo/func_80983634.s")
void func_80983634(PlayState* play) {
if ((play->sceneNum == SCENE_CASTLE) && (func_801A8A50(0) == NA_BGM_IKANA_CASTLE)) {
Audio_QueueSeqCmd(0x100100FF);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Demo/func_80983678.s")
void func_80983678(ObjDemo* this, PlayState* play) {
func_80983634(play);
if ((this->actor.xzDistToPlayer < this->xzRange) && (fabsf(this->actor.playerHeightRel) < this->yRange)) {
if (this->unk_148 == 1) {
ActorCutscene_Stop(0x7D);
}
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
this->actionFunc = func_80983704;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Demo/func_80983704.s")
void func_80983704(ObjDemo* this, PlayState* play) {
if ((this->unk_148 == 1) && (ActorCutscene_GetCurrentIndex() == 0x7D)) {
ActorCutscene_Stop(0x7D);
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
} else {
if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) {
if (this->unk_148 == 1) {
ActorCutscene_Start(this->actor.cutscene, &this->actor);
func_800E0348(play->cameraPtrs[0]);
} else {
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
}
if (play->sceneNum == SCENE_CASTLE) {
Audio_QueueSeqCmd(NA_BGM_IKANA_CASTLE | 0x8000);
}
this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene);
if (this->actor.cutscene == -1) {
if (this->actor.params != 0xFF) {
Flags_SetSwitch(play, this->actor.params);
}
Actor_MarkForDeath(&this->actor);
}
} else {
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
func_80983634(play);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Demo/ObjDemo_Update.s")
void ObjDemo_Update(Actor* thisx, PlayState* play) {
ObjDemo* this = THIS;
if ((this->actor.params != 0xFF) && Flags_GetSwitch(play, this->actor.params)) {
Actor_MarkForDeath(&this->actor);
return;
}
this->actionFunc(this, play);
}

View File

@ -3,14 +3,18 @@
#include "global.h"
#define OBJDEMO_GET_FF(thisx) ((thisx)->params & 0xFF)
#define OBJDEMO_FF_FF 0xFF
struct ObjDemo;
typedef void (*ObjDemoActionFunc)(struct ObjDemo*, PlayState*);
typedef struct ObjDemo {
/* 0x0000 */ Actor actor;
/* 0x0144 */ ObjDemoActionFunc actionFunc;
/* 0x0148 */ char unk_148[0xC];
/* 0x000 */ Actor actor;
/* 0x144 */ ObjDemoActionFunc actionFunc;
/* 0x148 */ s32 unk_148;
/* 0x14C */ f32 xzRange;
/* 0x150 */ f32 yRange;
} ObjDemo; // size = 0x154
extern const ActorInit Obj_Demo_InitVars;