ovl_Eff_Zoraband decompiled (#854)

* ovl_Eff_Zoraband decompiled

* != 0

* alpha and stateFlags

* name fix

* pr review fix

* PlayState

Co-authored-by: SonicDcer <noreply@github.com>
This commit is contained in:
Alejandro Asenjo 2022-07-11 21:51:53 -03:00 committed by GitHub
parent 3cdb4597f3
commit ed2f1390bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 15 deletions

3
spec
View File

@ -4933,8 +4933,7 @@ beginseg
name "ovl_Eff_Zoraband"
compress
include "build/src/overlays/actors/ovl_Eff_Zoraband/z_eff_zoraband.o"
include "build/data/ovl_Eff_Zoraband/ovl_Eff_Zoraband.data.o"
include "build/data/ovl_Eff_Zoraband/ovl_Eff_Zoraband.reloc.o"
include "build/src/overlays/actors/ovl_Eff_Zoraband/ovl_Eff_Zoraband_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_eff_zoraband.h"
#include "objects/object_zoraband/object_zoraband.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -13,11 +14,10 @@
void EffZoraband_Init(Actor* thisx, PlayState* play);
void EffZoraband_Destroy(Actor* thisx, PlayState* play);
void EffZoraband_Update(Actor* thisx, PlayState* play);
void EffZoraband_Draw(Actor* thisx, PlayState* play);
void EffZoraband_Draw(Actor* thisx, PlayState* play2);
void func_80C07790(EffZoraband* this, PlayState* play);
void EffZoraband_MikauFadeOut(EffZoraband* this, PlayState* play);
#if 0
const ActorInit Eff_Zoraband_InitVars = {
ACTOR_EFF_ZORABAND,
ACTORCAT_ITEMACTION,
@ -30,16 +30,71 @@ const ActorInit Eff_Zoraband_InitVars = {
(ActorFunc)EffZoraband_Draw,
};
#endif
void EffZoraband_Init(Actor* thisx, PlayState* play) {
EffZoraband* this = THIS;
extern UNK_TYPE D_06000F38;
Actor_SetScale(&this->actor, 1.0f);
this->actionFunc = EffZoraband_MikauFadeOut;
this->alpha = 0;
this->actor.shape.rot.z = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Zoraband/EffZoraband_Init.s")
void EffZoraband_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Zoraband/EffZoraband_Destroy.s")
void EffZoraband_MikauFadeOut(EffZoraband* this, PlayState* play) {
if (Cutscene_CheckActorAction(play, 0x20F)) {
if ((EFFZORABAND_GET_F(&this->actor) + 2) ==
play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x20F)]->action) {
this->stateFlags |= 2;
}
if (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x20F)]->action == 7) {
this->actor.draw = NULL;
} else {
this->actor.draw = EffZoraband_Draw;
}
}
if ((this->actor.home.rot.z != 0) && (this->actor.draw != NULL)) {
func_800B9010(&this->actor, NA_SE_EV_UFO_LIGHT_BEAM - SFX_FLAG);
}
if (this->stateFlags & 2) {
if (this->alpha < 240) {
this->alpha += 25;
} else {
this->alpha = 255;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Zoraband/func_80C07790.s")
void EffZoraband_Update(Actor* thisx, PlayState* play) {
EffZoraband* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Zoraband/EffZoraband_Update.s")
this->actionFunc(this, play);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Zoraband/EffZoraband_Draw.s")
void EffZoraband_Draw(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
EffZoraband* this = THIS;
if (this->alpha != 0) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
Matrix_RotateYS((Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamera]) + 0x8000), MTXMODE_APPLY);
AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(object_zoraband_Matanimheader_000F38));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->actor.home.rot.z != 0) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 100, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 255);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 0, 100, 255, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 100, 255);
}
gSPDisplayList(POLY_XLU_DISP++, object_zoraband_DL_000180);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 200, 255, 255, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 255);
gSPDisplayList(POLY_XLU_DISP++, object_zoraband_DL_0002A8);
CLOSE_DISPS(play->state.gfxCtx);
}
}

View File

@ -3,14 +3,17 @@
#include "global.h"
#define EFFZORABAND_GET_F(thisx) ((thisx)->params & 0xF)
struct EffZoraband;
typedef void (*EffZorabandActionFunc)(struct EffZoraband*, PlayState*);
typedef struct EffZoraband {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x4];
/* 0x0148 */ EffZorabandActionFunc actionFunc;
/* 0x000 */ Actor actor;
/* 0x144 */ s16 alpha;
/* 0x146 */ u16 stateFlags;
/* 0x148 */ EffZorabandActionFunc actionFunc;
} EffZoraband; // size = 0x14C
extern const ActorInit Eff_Zoraband_InitVars;