Demo_Effect (#764)

* Demo_Effect

* PR

* PR

* Fix
This commit is contained in:
Maide 2022-04-24 17:09:41 +01:00 committed by GitHub
parent 31f0e19b57
commit 51dcbd728e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 295 additions and 30 deletions

View File

@ -1,10 +1,13 @@
<Root>
<File Name="object_efc_tw" Segment="6">
<!-- <Blob Name="object_efc_tw_Blob_000000" Size="0x60" Offset="0x0" /> -->
<CurveAnimation Name="object_efc_tw_CurveAnim_000050" SkelOffset="0x12E8" Offset="0x50" />
<Array Name="object_efc_tw_Vtx_000060" Count="21" Offset="0x60" >
<Vtx/>
</Array>
<DList Name="object_efc_tw_DL_0001B0" Offset="0x1B0" />
<Texture Name="object_efc_tw_Tex_0002C8" OutName="tex_0002C8" Format="i8" Width="64" Height="64" Offset="0x2C8" />
<Limb Name="object_efc_tw_Standardlimb_0012C8" Type="Standard" EnumName="OBJECT_EFC_TW_LIMB_01" Offset="0x12C8" />
<Limb Name="object_efc_tw_Standardlimb_0012D4" Type="Standard" EnumName="OBJECT_EFC_TW_LIMB_02" Offset="0x12D4" />
<Skeleton Name="object_efc_tw_Skel_0012E8" Type="Normal" LimbType="Standard" LimbNone="OBJECT_EFC_TW_LIMB_NONE" LimbMax="OBJECT_EFC_TW_LIMB_MAX" EnumName="object_efc_tw_Limbs" Offset="0x12E8" />
<Limb Name="object_efc_tw_Curvelimb_0012C8" Type="Curve" EnumName="OBJECT_EFC_TW_LIMB_01" Offset="0x12C8" />
<Limb Name="object_efc_tw_Curvelimb_0012D4" Type="Curve" EnumName="OBJECT_EFC_TW_LIMB_02" Offset="0x12D4" />
<Skeleton Name="object_efc_tw_Skel_0012E8" Type="Curve" LimbType="Curve" LimbNone="OBJECT_EFC_TW_LIMB_NONE" LimbMax="OBJECT_EFC_TW_LIMB_MAX" EnumName="object_efc_tw_Limbs" Offset="0x12E8" />
</File>
</Root>

3
spec
View File

@ -1116,8 +1116,7 @@ beginseg
name "ovl_Demo_Effect"
compress
include "build/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.o"
include "build/data/ovl_Demo_Effect/ovl_Demo_Effect.data.o"
include "build/data/ovl_Demo_Effect/ovl_Demo_Effect.reloc.o"
include "build/src/overlays/actors/ovl_Demo_Effect/ovl_Demo_Effect_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,8 @@
*/
#include "z_demo_effect.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_efc_tw/object_efc_tw.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -15,11 +17,14 @@ void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx);
void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx);
void func_808CD940(DemoEffect* this, GlobalContext* globalCtx);
void func_808CD998(DemoEffect* this, GlobalContext* globalCtx);
void func_808CDBDC(DemoEffect* this, GlobalContext* globalCtx);
void func_808CDCEC(DemoEffect* this, GlobalContext* globalCtx);
void func_808CDD70(DemoEffect* this, GlobalContext* globalCtx);
void func_808CDDE0(DemoEffect* this, GlobalContext* globalCtx);
void func_808CDFF8(Actor* thisx, GlobalContext* globalCtx);
void func_808CE078(Actor* thisx, GlobalContext* globalCtx2);
#if 0
const ActorInit Demo_Effect_InitVars = {
ACTOR_DEMO_EFFECT,
ACTORCAT_BG,
@ -32,33 +37,287 @@ const ActorInit Demo_Effect_InitVars = {
(ActorFunc)NULL,
};
#endif
void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx) {
static s16 D_808CE2C0[] = {
OBJECT_EFC_TW, OBJECT_EFC_TW, OBJECT_EFC_TW, OBJECT_EFC_TW, GAMEPLAY_KEEP,
GAMEPLAY_KEEP, GAMEPLAY_KEEP, GAMEPLAY_KEEP, GAMEPLAY_KEEP,
};
s32 pad;
DemoEffect* this = THIS;
s32 sp3C = DEMOEFFECT_GET_FF(&this->actor);
s32 phi_v1;
s32 pad2;
Color_RGB8 sp24[] = {
{ 200, 200, 0 }, { 255, 40, 100 }, { 50, 255, 0 }, { 0, 0, 255 }, { 255, 255, 80 },
};
extern UNK_TYPE D_06000050;
extern UNK_TYPE D_06000060;
if (D_808CE2C0[sp3C] == 1) {
phi_v1 = 0;
} else {
phi_v1 = Object_GetIndex(&globalCtx->objectCtx, D_808CE2C0[sp3C]);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/DemoEffect_Init.s")
if (phi_v1 >= 0) {
this->unk_164 = phi_v1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/DemoEffect_Destroy.s")
Actor_SetScale(&this->actor, 0.2f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CD940.s")
switch (sp3C) {
case 0:
case 1:
this->actor.flags |= ACTOR_FLAG_2000000;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CD998.s")
case 2:
case 3:
this->unk_174 = func_808CDFF8;
this->unk_170 = func_808CD998;
this->unk_168[0] = 0;
this->unk_168[1] = 100;
this->unk_168[2] = 255;
SkelCurve_Clear(&this->skelCurve);
this->unk_16C = 0;
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDAD0.s")
case 4:
case 5:
case 6:
case 7:
case 8:
this->unk_168[0] = sp24[sp3C - 4].r;
this->unk_168[1] = sp24[sp3C - 4].g;
this->unk_168[2] = sp24[sp3C - 4].b;
Actor_SetScale(&this->actor, 0.0f);
this->unk_174 = func_808CE078;
this->unk_170 = func_808CDDE0;
this->unk_16C = 0;
break;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDBDC.s")
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
this->actionFunc = func_808CD940;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDCEC.s")
u8 D_808CE2D4[] = {
1, 1, 2, 0, 1, 1, 2, 0, 1, 2, 0, 2, 1, 0, 1, 0, 2, 0, 2, 2, 0,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDD70.s")
void DemoEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DemoEffect* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDDE0.s")
switch (DEMOEFFECT_GET_FF(&this->actor)) {
case 0:
case 1:
case 2:
case 3:
SkelCurve_Destroy(globalCtx, &this->skelCurve);
break;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/DemoEffect_Update.s")
void func_808CD940(DemoEffect* this, GlobalContext* globalCtx) {
if (Object_IsLoaded(&globalCtx->objectCtx, this->unk_164)) {
this->actor.objBankIndex = this->unk_164;
this->actor.draw = this->unk_174;
this->actionFunc = this->unk_170;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDE78.s")
void func_808CD998(DemoEffect* this, GlobalContext* globalCtx) {
s32 sp34 = DEMOEFFECT_GET_FF(&this->actor);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CDFF8.s")
if (SkelCurve_Init(globalCtx, &this->skelCurve, &object_efc_tw_Skel_0012E8, &object_efc_tw_CurveAnim_000050)) {}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Demo_Effect/func_808CE078.s")
SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_CurveAnim_000050, 1.0f, 59.0f, 1.0f, 1.7f);
SkelCurve_Update(globalCtx, &this->skelCurve);
this->actionFunc = func_808CDCEC;
switch (sp34) {
case 0:
Actor_SetScale(&this->actor, 0.16800001f);
break;
case 1:
Actor_SetScale(&this->actor, 0.08400001f);
break;
case 2:
Actor_SetScale(&this->actor, 0.16800001f);
break;
case 3:
Actor_SetScale(&this->actor, 0.28f);
break;
default:
Actor_SetScale(&this->actor, 0.014f);
break;
}
}
void func_808CDAD0(f32 arg0) {
s32 i;
Vtx* temp_v0 = Lib_SegmentedToVirtual(object_efc_tw_Vtx_000060);
u8 sp24[3];
sp24[0] = 0;
sp24[1] = (s8)(202.0f * arg0);
sp24[2] = (s8)(255.0f * arg0);
for (i = 0; i < ARRAY_COUNT(D_808CE2D4); i++) {
if (D_808CE2D4[i] != 0) {
temp_v0[i].v.cn[3] = sp24[D_808CE2D4[i]];
}
}
}
void func_808CDBDC(DemoEffect* this, GlobalContext* globalCtx) {
s32 params = DEMOEFFECT_GET_FF(&this->actor);
f32 temp_f0;
f32 temp_f12;
this->unk_16C++;
if (this->unk_16C <= 100) {
temp_f12 = (100 - this->unk_16C) * 0.01f;
temp_f0 = temp_f12 * 0.14f;
switch (params) {
case 0:
temp_f0 *= 1.2f;
break;
case 1:
temp_f0 *= 0.6f;
break;
case 2:
temp_f0 *= 1.2f;
break;
case 3:
temp_f0 *= 2.0f;
break;
}
this->actor.scale.x = temp_f0;
this->actor.scale.z = temp_f0;
func_808CDAD0(temp_f12);
func_800B8FE8(&this->actor, NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG);
} else {
func_808CDAD0(1.0f);
Actor_MarkForDeath(&this->actor);
}
}
void func_808CDCEC(DemoEffect* this, GlobalContext* globalCtx) {
func_800B8FE8(&this->actor, NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG);
if (SkelCurve_Update(globalCtx, &this->skelCurve)) {
SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_CurveAnim_000050, 1.0f, 60.0f, 59.0f, 0.0f);
this->actionFunc = func_808CDBDC;
this->unk_16C = 0;
}
}
void func_808CDD70(DemoEffect* this, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, this->actor.scale.x - 0.02f);
this->unk_16C++;
if (this->actor.scale.x < 0.02f) {
Actor_MarkForDeath(&this->actor);
}
}
void func_808CDDE0(DemoEffect* this, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, (this->actor.scale.x * 0.5f) + 0.2f);
this->unk_16C++;
if (this->unk_16C >= 3) {
this->actionFunc = func_808CDD70;
}
}
void DemoEffect_Update(Actor* thisx, GlobalContext* globalCtx) {
DemoEffect* this = THIS;
this->actionFunc(this, globalCtx);
}
s32 func_808CDE78(GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex, Actor* thisx) {
s32 pad;
DemoEffect* this = THIS;
u32 sp4C = globalCtx->gameplayFrames;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, this->unk_168[0], this->unk_168[1], this->unk_168[2], 255);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (sp4C * 6) % 1024, 255 - ((sp4C * 16) % 256), 0x100, 0x40,
1, (sp4C * 4) % 512, 127 - ((sp4C * 12) % 128), 0x80, 0x20));
CLOSE_DISPS(globalCtx->state.gfxCtx);
if (limbIndex == 0) {
LimbTransform* transform = skelCuve->transforms;
transform->scale.x = 0x400;
transform->scale.y = 0x400;
transform->scale.z = transform->scale.x;
}
return true;
}
void func_808CDFF8(Actor* thisx, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
DemoEffect* this = THIS;
OPEN_DISPS(gfxCtx);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 25);
Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY);
SkelCurve_Draw(&this->actor, globalCtx, &this->skelCurve, func_808CDE78, NULL, 1, &this->actor);
CLOSE_DISPS(gfxCtx);
}
void func_808CE078(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
DemoEffect* this = THIS;
s16 sp46 = (this->unk_16C * 0x400) & 0xFFFF;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, this->unk_168[0], this->unk_168[1], this->unk_168[2], 255);
Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_StatePush();
Matrix_InsertZRotation_s(sp46, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023288);
Matrix_StatePop();
Matrix_InsertZRotation_s(sp46 * -1, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_023288);
CLOSE_DISPS(globalCtx->state.gfxCtx);
D_801F4E32 = 1;
D_801F4E38.x = thisx->world.pos.x;
D_801F4E38.y = thisx->world.pos.y;
D_801F4E38.z = thisx->world.pos.z;
D_801F4E44 = thisx->scale.x * 60.0f;
D_801F4E48 = thisx->scale.x * 50.0f;
D_801F4E4C = thisx->scale.x * 250.0f;
}

View File

@ -6,10 +6,20 @@
struct DemoEffect;
typedef void (*DemoEffectActionFunc)(struct DemoEffect*, GlobalContext*);
typedef void (*DemoEffectUnkFunc)(struct DemoEffect*, GlobalContext*);
typedef void (*DemoEffectUnkFunc2)(Actor*, GlobalContext*);
#define DEMOEFFECT_GET_FF(thisx) ((thisx)->params & 0xFF)
typedef struct DemoEffect {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x34];
/* 0x0144 */ SkelAnimeCurve skelCurve;
/* 0x0164 */ u8 unk_164;
/* 0x0165 */ UNK_TYPE1 unk_165[3];
/* 0x0168 */ u8 unk_168[3];
/* 0x016C */ s16 unk_16C;
/* 0x0170 */ DemoEffectUnkFunc unk_170;
/* 0x0174 */ DemoEffectUnkFunc2 unk_174;
/* 0x0178 */ DemoEffectActionFunc actionFunc;
} DemoEffect; // size = 0x17C

View File

@ -840,12 +840,6 @@ D_060134D0 = 0x060134D0;
D_06013828 = 0x06013828;
D_06014040 = 0x06014040;
// ovl_Demo_Effect
D_06000050 = 0x06000050;
D_06000060 = 0x06000060;
D_060012E8 = 0x060012E8;
// ovl_Demo_Moonend
D_06001214 = 0x06001214;