ovl_Eff_Stk decompiled (#1265)

* ovl_Eff_Stk decompiled

* ovl_Eff_Stk improvements

* ovl_Eff_Stk forgot to remove variables

* ovl_Eff_Stk improvements
This commit is contained in:
Nuss 2023-06-02 17:50:57 +02:00 committed by GitHub
parent 91182a796b
commit a995e4cf61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 11 deletions

3
spec
View File

@ -4602,8 +4602,7 @@ beginseg
name "ovl_Eff_Stk"
compress
include "build/src/overlays/actors/ovl_Eff_Stk/z_eff_stk.o"
include "build/data/ovl_Eff_Stk/ovl_Eff_Stk.data.o"
include "build/data/ovl_Eff_Stk/ovl_Eff_Stk.reloc.o"
include "build/src/overlays/actors/ovl_Eff_Stk/ovl_Eff_Stk_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_eff_stk.h"
#include "objects/object_stk2/object_stk2.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -15,7 +16,8 @@ void EffStk_Destroy(Actor* thisx, PlayState* play);
void EffStk_Update(Actor* thisx, PlayState* play);
void EffStk_Draw(Actor* thisx, PlayState* play);
#if 0
void func_80BF0DE0(EffStk* this, PlayState* play);
ActorInit Eff_Stk_InitVars = {
ACTOR_EFF_STK,
ACTORCAT_ITEMACTION,
@ -28,16 +30,75 @@ ActorInit Eff_Stk_InitVars = {
(ActorFunc)EffStk_Draw,
};
#endif
void EffStk_Init(Actor* thisx, PlayState* play) {
EffStk* this = THIS;
extern UNK_TYPE D_06009F60;
Actor_SetScale(&this->actor, 0.2f);
this->actionFunc = func_80BF0DE0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Stk/EffStk_Init.s")
void EffStk_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Stk/EffStk_Destroy.s")
void func_80BF0DE0(EffStk* this, PlayState* play) {
if (Cutscene_IsCueInChannel(play, CS_CMD_ACTOR_CUE_512)) {
switch (play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_512)]->id) {
case 2:
this->actor.draw = EffStk_Draw;
if (this->unk146 < 0x3C00) {
this->unk146 += 0x400;
this->unk148 = Math_SinS(this->unk146) * -630.0f;
}
this->unk144++;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Stk/func_80BF0DE0.s")
case 3:
this->actor.draw = EffStk_Draw;
if (this->unk146 < 0x3C00) {
this->unk146 += 0x400;
this->unk148 = Math_SinS(this->unk146) * -630.0f;
}
this->unk144--;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Stk/EffStk_Update.s")
default:
this->actor.draw = NULL;
this->unk146 = 0;
this->unk148 = 0.0f;
break;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Eff_Stk/EffStk_Draw.s")
void EffStk_Update(Actor* thisx, PlayState* play) {
EffStk* this = THIS;
this->actionFunc(this, play);
}
void EffStk_Draw(Actor* thisx, PlayState* play) {
EffStk* this = THIS;
s32 pad;
Camera* activeCam = GET_ACTIVE_CAM(play);
Vec3f eye = activeCam->eye;
Vec3f quakeOffset;
Camera_GetQuakeOffset(&quakeOffset, activeCam);
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, this->unk148, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
AnimatedMat_DrawAlphaStep(play, Lib_SegmentedToVirtual(object_stk2_Matanimheader_009F60), 1.0f, this->unk144);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE);
gSPDisplayList(POLY_XLU_DISP++, object_stk2_DL_008920);
gSPDisplayList(POLY_XLU_DISP++, object_stk2_DL_008A38);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -9,7 +9,9 @@ typedef void (*EffStkActionFunc)(struct EffStk*, PlayState*);
typedef struct EffStk {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x8];
/* 0x144 */ s16 unk144;
/* 0x146 */ s16 unk146;
/* 0x148 */ f32 unk148;
/* 0x14C */ EffStkActionFunc actionFunc;
} EffStk; // size = 0x150