ovl_Eff_Lastday Decompiled (#921)

* all functions matching

* ovl_Eff_Lastday Decompiled

* renaming

* final clean up

* enums

* pr review

* pr review

* Prefix

* renamings
This commit is contained in:
Alejandro Asenjo
2022-07-19 12:10:35 -04:00
committed by GitHub
parent aebbebd6cf
commit bd94105568
6 changed files with 231 additions and 30 deletions
+3
View File
@@ -1,5 +1,8 @@
<Root>
<File Name="object_lastday" Segment="6">
<Array Name="object_lastday_Vtx_000000" Count="6" Offset="0x0">
<Vtx/>
</Array>
<DList Name="object_lastday_DL_000060" Offset="0x60" />
<TextureAnimation Name="object_lastday_Matanimheader_000148" Offset="0x148" />
<DList Name="object_lastday_DL_000210" Offset="0x210" />
+1 -2
View File
@@ -4752,8 +4752,7 @@ beginseg
name "ovl_Eff_Lastday"
compress
include "build/src/overlays/actors/ovl_Eff_Lastday/z_eff_lastday.o"
include "build/data/ovl_Eff_Lastday/ovl_Eff_Lastday.data.o"
include "build/data/ovl_Eff_Lastday/ovl_Eff_Lastday.reloc.o"
include "build/src/overlays/actors/ovl_Eff_Lastday/ovl_Eff_Lastday_reloc.o"
endseg
beginseg
@@ -5,12 +5,13 @@
*/
#include "z_eff_lastday.h"
#include "objects/object_lastday/object_lastday.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
#define THIS ((EffLastday*)thisx)
void EffLastday_Init(Actor* thisx, PlayState* play);
void EffLastday_Init(Actor* thisx, PlayState* play2);
void EffLastday_Destroy(Actor* thisx, PlayState* play);
void EffLastday_Update(Actor* thisx, PlayState* play);
void EffLastday_Draw(Actor* thisx, PlayState* play);
@@ -20,7 +21,13 @@ void func_80BEBDF8(EffLastday* this, PlayState* play);
void func_80BEBEB8(EffLastday* this, PlayState* play);
void func_80BEBF78(EffLastday* this, PlayState* play);
#if 0
typedef enum EffLastDayAction {
/* 0x0 */ EFFLASTDAY_ACTION_NONE,
/* 0x1 */ EFFLASTDAY_ACTION_1,
/* 0x2 */ EFFLASTDAY_ACTION_2,
/* 0x3 */ EFFLASTDAY_ACTION_3
} EffLastDayAction;
const ActorInit Eff_Lastday_InitVars = {
ACTOR_EFF_LASTDAY,
ACTORCAT_ITEMACTION,
@@ -33,25 +40,216 @@ const ActorInit Eff_Lastday_InitVars = {
(ActorFunc)EffLastday_Draw,
};
#endif
void EffLastday_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
EffLastday* this = THIS;
extern UNK_TYPE D_06000000;
extern UNK_TYPE D_06000510;
Actor_SetScale(&this->actor, 0.1f);
switch (EFFLASTDAY_GET_F(&this->actor)) {
case EFFLASTDAY_PARAMS_1:
this->dList = object_lastday_DL_000510;
this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000608);
this->csActionCmd = 0x1FC;
this->actionFunc = func_80BEBDF8;
Actor_SetScale(&this->actor, 1.0f);
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Init.s")
case EFFLASTDAY_PARAMS_2:
this->dList = object_lastday_DL_000210;
this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000308);
this->csActionCmd = 0x1FD;
this->actionFunc = func_80BEBEB8;
Actor_SetScale(&this->actor, 0.5f);
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Destroy.s")
case EFFLASTDAY_PARAMS_3:
this->dList = object_lastday_DL_000060;
this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000148);
this->csActionCmd = 0x1FE;
this->actionFunc = func_80BEBF78;
Actor_SetScale(&this->actor, 0.2f);
this->actor.home.rot.z = 0;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBD0C.s")
default:
this->dList = object_lastday_DL_000370;
this->matAnim = Lib_SegmentedToVirtual(object_lastday_Matanimheader_000448);
this->csActionCmd = 0x1FB;
this->actionFunc = func_80BEBD0C;
Actor_SetScale(&this->actor, 1.0f);
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0,
EFFLASTDAY_PARAMS_1);
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0,
EFFLASTDAY_PARAMS_2);
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_LASTDAY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0,
EFFLASTDAY_PARAMS_3);
break;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBDF8.s")
void EffLastday_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBEB8.s")
void func_80BEBD0C(EffLastday* this, PlayState* play) {
u16 csAction;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEBF78.s")
if ((Cutscene_CheckActorAction(play, this->csActionCmd))) {
Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd));
csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action;
switch (csAction) {
default:
this->actor.draw = NULL;
this->alpha = 0;
this->step = 0;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Update.s")
case EFFLASTDAY_ACTION_2:
this->actor.draw = NULL;
this->actor.draw = EffLastday_Draw;
if (this->alpha < 255) {
this->alpha += 10;
}
if (this->alpha > 255) {
this->alpha = 255;
}
this->step++;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/func_80BEC0A4.s")
case EFFLASTDAY_ACTION_3:
this->actor.draw = EffLastday_Draw;
break;
}
} else {
this->actor.draw = NULL;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Lastday/EffLastday_Draw.s")
void func_80BEBDF8(EffLastday* this, PlayState* play) {
u16 csAction;
if (Cutscene_CheckActorAction(play, this->csActionCmd)) {
Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd));
csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action;
switch (csAction) {
default:
this->actor.draw = NULL;
this->step = 0;
break;
case EFFLASTDAY_ACTION_2:
this->actor.draw = EffLastday_Draw;
this->step++;
break;
case EFFLASTDAY_ACTION_3:
this->actor.draw = EffLastday_Draw;
break;
}
} else {
this->actor.draw = NULL;
}
}
void func_80BEBEB8(EffLastday* this, PlayState* play) {
u16 csAction;
if (Cutscene_CheckActorAction(play, this->csActionCmd)) {
Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd));
csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action;
switch (csAction) {
default:
this->actor.draw = NULL;
this->step = 0;
break;
case EFFLASTDAY_ACTION_2:
this->actor.draw = EffLastday_Draw;
this->step++;
break;
case EFFLASTDAY_ACTION_3:
this->actor.draw = EffLastday_Draw;
break;
}
} else {
this->actor.draw = NULL;
}
}
void func_80BEBF78(EffLastday* this, PlayState* play) {
u16 csAction;
if (Cutscene_CheckActorAction(play, this->csActionCmd)) {
Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionCmd));
csAction = play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionCmd)]->action;
switch (csAction) {
default:
this->actor.draw = NULL;
this->alpha = 0;
this->step = 0;
break;
case EFFLASTDAY_ACTION_2:
if (!this->actor.home.rot.z) {
this->actor.home.rot.z = true;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_COMING_FIRE);
}
this->actor.draw = EffLastday_Draw;
if (this->alpha < 255) {
this->alpha += 5;
}
if (this->alpha > 255) {
this->alpha = 255;
}
this->step++;
break;
case EFFLASTDAY_ACTION_3:
this->actor.draw = EffLastday_Draw;
break;
}
} else {
this->actor.draw = NULL;
}
}
void EffLastday_Update(Actor* thisx, PlayState* play) {
EffLastday* this = THIS;
this->actionFunc(this, play);
}
void EffLastday_SetVtxAlpha(s16 alpha) {
Vtx* vtx = Lib_SegmentedToVirtual(object_lastday_Vtx_000000);
vtx[0].v.cn[3] = alpha;
vtx[3].v.cn[3] = alpha;
vtx[4].v.cn[3] = alpha;
vtx[5].v.cn[3] = alpha;
}
void EffLastday_Draw(Actor* thisx, PlayState* play) {
EffLastday* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
switch (EFFLASTDAY_GET_F(thisx)) {
case EFFLASTDAY_PARAMS_1:
case EFFLASTDAY_PARAMS_2:
break;
case EFFLASTDAY_PARAMS_3:
EffLastday_SetVtxAlpha(this->alpha);
break;
default:
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->alpha);
break;
}
AnimatedMat_DrawAlphaStep(play, this->matAnim, 1.0f, this->step);
Gfx_DrawDListXlu(play, this->dList);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -3,16 +3,29 @@
#include "global.h"
#define EFFLASTDAY_GET_F(thisx) ((thisx)->params & 0xF)
struct EffLastday;
typedef void (*EffLastdayActionFunc)(struct EffLastday*, PlayState*);
typedef struct EffLastday {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x10];
/* 0x144 */ Gfx* dList;
/* 0x148 */ AnimatedMaterial* matAnim;
/* 0x14C */ s16 step;
/* 0x14E */ s16 alpha;
/* 0x150 */ s16 csActionCmd;
/* 0x154 */ EffLastdayActionFunc actionFunc;
} EffLastday; // size = 0x158
typedef enum EffLastDayParams {
/* 0x0 */ EFFLASTDAY_PARAMS_0,
/* 0x1 */ EFFLASTDAY_PARAMS_1,
/* 0x2 */ EFFLASTDAY_PARAMS_2,
/* 0x3 */ EFFLASTDAY_PARAMS_3
} EffLastDayParams;
extern const ActorInit Eff_Lastday_InitVars;
#endif // Z_EFF_LASTDAY_H
+1 -1
View File
@@ -16218,7 +16218,7 @@
0x80BEBEB8:("func_80BEBEB8",),
0x80BEBF78:("func_80BEBF78",),
0x80BEC080:("EffLastday_Update",),
0x80BEC0A4:("func_80BEC0A4",),
0x80BEC0A4:("EffLastday_SetVtxAlpha",),
0x80BEC0DC:("EffLastday_Draw",),
0x80BEC240:("BgIkanaDharma_SpawnEffects",),
0x80BEC3F4:("BgIkanaDharma_Init",),
-12
View File
@@ -864,18 +864,6 @@ D_06000000 = 0x06000000;
D_06000140 = 0x06000140;
D_06001AF0 = 0x06001AF0;
// ovl_Eff_Lastday
D_06000000 = 0x06000000;
D_06000060 = 0x06000060;
D_06000148 = 0x06000148;
D_06000210 = 0x06000210;
D_06000308 = 0x06000308;
D_06000370 = 0x06000370;
D_06000448 = 0x06000448;
D_06000510 = 0x06000510;
D_06000608 = 0x06000608;
// ovl_Eff_Stk
D_06008920 = 0x06008920;