mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +00:00
z_demo_tre_lgt OK (#521)
* z_demo_tre_lgt ok * ok * made suggested changes * fixed
This commit is contained in:
parent
60b1f5dd41
commit
81c269b417
15 changed files with 158 additions and 551 deletions
|
@ -1,4 +1,5 @@
|
|||
#include "z_demo_tre_lgt.h"
|
||||
#include "overlays/actors/ovl_En_Box/z_en_box.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
|
@ -9,9 +10,25 @@ void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
extern UNK_TYPE D_06005EB8;
|
||||
void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx);
|
||||
void func_80993754(DemoTreLgt* this);
|
||||
void func_8099375C(DemoTreLgt* this, GlobalContext* globalCtx);
|
||||
void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame);
|
||||
|
||||
extern SkelCurveLimbList D_06005EB8;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ f32 startFrame;
|
||||
/* 0x04 */ f32 endFrame;
|
||||
/* 0x08 */ f32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
} DemoTreLgtInfo; // size = 0x10
|
||||
|
||||
static DemoTreLgtInfo sDemoTreLgtInfo[] = {
|
||||
{ 1.0f, 136.0f, 190.0f, 40.0f },
|
||||
{ 1.0f, 136.0f, 220.0f, 50.0f },
|
||||
};
|
||||
|
||||
/*
|
||||
const ActorInit Demo_Tre_Lgt_InitVars = {
|
||||
ACTOR_DEMO_TRE_LGT,
|
||||
ACTORTYPE_ITEMACTION,
|
||||
|
@ -23,21 +40,135 @@ const ActorInit Demo_Tre_Lgt_InitVars = {
|
|||
(ActorFunc)DemoTreLgt_Update,
|
||||
(ActorFunc)DemoTreLgt_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/DemoTreLgt_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/DemoTreLgt_Destroy.s")
|
||||
static TransformUpdateIndex* sTransformUpdIdx[] = { 0x06004B60, 0x06004F70 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/func_80993754.s")
|
||||
static DemoTreLgtActionFunc sActionFuncs[] = {
|
||||
func_8099375C,
|
||||
func_80993848,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/func_8099375C.s")
|
||||
void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/func_809937B4.s")
|
||||
if (!SkelCurve_Init(globalCtx, &this->skelCurve, &D_06005EB8, sTransformUpdIdx[0])) {
|
||||
osSyncPrintf("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n");
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/func_80993848.s")
|
||||
// This assert is optimized out but it exists due to its presence in rodata
|
||||
if (0) {
|
||||
__assert("1", "../z_demo_tre_lgt.c", UNK_LINE);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/DemoTreLgt_Update.s")
|
||||
this->unk_170 = 255;
|
||||
this->unk_174 = 255;
|
||||
this->status = 0;
|
||||
func_80993754(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/func_80993B2C.s")
|
||||
void DemoTreLgt_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Tre_Lgt/DemoTreLgt_Draw.s")
|
||||
SkelCurve_Destroy(globalCtx, &this->skelCurve);
|
||||
}
|
||||
|
||||
void func_80993754(DemoTreLgt* this) {
|
||||
this->action = DEMO_TRE_LGT_ACTION_WAIT;
|
||||
}
|
||||
|
||||
void func_8099375C(DemoTreLgt* this, GlobalContext* globalCtx) {
|
||||
EnBox* treasureChest = (EnBox*)this->actor.parent;
|
||||
|
||||
if (treasureChest != NULL && func_800A56C8(&treasureChest->skelanime, 10.0f)) {
|
||||
func_809937B4(this, globalCtx, treasureChest->skelanime.animCurrentFrame);
|
||||
}
|
||||
}
|
||||
|
||||
void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame) {
|
||||
SkelAnimeCurve* skelCurve = &this->skelCurve;
|
||||
s32 pad[2];
|
||||
|
||||
this->action = DEMO_TRE_LGT_ACTION_ANIMATE;
|
||||
|
||||
SkelCurve_SetAnim(skelCurve, sTransformUpdIdx[gSaveContext.linkAge], 1.0f,
|
||||
sDemoTreLgtInfo[gSaveContext.linkAge].endFrame +
|
||||
sDemoTreLgtInfo[gSaveContext.linkAge].unk_08,
|
||||
currentFrame, 1.0f);
|
||||
SkelCurve_Update(globalCtx, skelCurve);
|
||||
}
|
||||
|
||||
void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
|
||||
f32 currentFrame = this->skelCurve.animCurFrame;
|
||||
|
||||
if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame) {
|
||||
this->unk_170 = 255;
|
||||
} else {
|
||||
if (currentFrame <= (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame +
|
||||
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) {
|
||||
this->unk_170 = ((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame - currentFrame) /
|
||||
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08) *
|
||||
255.0f) +
|
||||
255.0f);
|
||||
} else {
|
||||
this->unk_170 = 0;
|
||||
}
|
||||
}
|
||||
if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C) {
|
||||
this->unk_174 = 255;
|
||||
} else if (currentFrame < (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C + 10.0f)) {
|
||||
this->unk_174 =
|
||||
((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) +
|
||||
255.0f);
|
||||
} else {
|
||||
this->unk_174 = 0;
|
||||
}
|
||||
if ((currentFrame > 30.0f) && !(this->status & 1)) {
|
||||
this->status |= 1;
|
||||
Audio_PlaySoundGeneral(NA_SE_EV_TRE_BOX_FLASH, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
}
|
||||
if (SkelCurve_Update(globalCtx, &this->skelCurve)) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
sActionFuncs[this->action](this, globalCtx);
|
||||
}
|
||||
|
||||
s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) {
|
||||
s32 pad;
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_tre_lgt.c", 423);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 2) % 256, 0, 64, 32, 1,
|
||||
(globalCtx->state.frames * -2) % 256, 0, 64, 32));
|
||||
|
||||
if (limbIndex == 1) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->unk_170);
|
||||
} else if ((limbIndex == 13) || (limbIndex == 7) || (limbIndex == 4) || (limbIndex == 10)) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 180, this->unk_174);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_tre_lgt.c", 448);
|
||||
}
|
||||
|
||||
void DemoTreLgt_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_tre_lgt.c", 461);
|
||||
|
||||
if (this->action != DEMO_TRE_LGT_ACTION_ANIMATE) {
|
||||
return;
|
||||
}
|
||||
|
||||
func_80093D84(gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 0);
|
||||
SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, DemoTreLgt_PostLimbDraw, NULL, 1, thisx);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_demo_tre_lgt.c", 476);
|
||||
}
|
||||
|
|
|
@ -6,11 +6,22 @@
|
|||
|
||||
struct DemoTreLgt;
|
||||
|
||||
typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, GlobalContext*);
|
||||
|
||||
typedef struct DemoTreLgt {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x30];
|
||||
/* 0x014C */ SkelAnimeCurve skelCurve;
|
||||
/* 0x016C */ s32 action;
|
||||
/* 0x0170 */ u32 unk_170; // some sort of alpha
|
||||
/* 0x0174 */ u32 unk_174; // another sort of alpha
|
||||
/* 0x0178 */ u8 status;
|
||||
} DemoTreLgt; // size = 0x017C
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ DEMO_TRE_LGT_ACTION_WAIT, // wait until animation is needed
|
||||
/* 0x01 */ DEMO_TRE_LGT_ACTION_ANIMATE
|
||||
} DemoTreLgtAction;
|
||||
|
||||
extern const ActorInit Demo_Tre_Lgt_InitVars;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue