en_dy_extra OK (#35)

* dy_extra decomped, but not ok

* Formatting

* Fixed data, en_dy_extra now OK

* Formatting

* Removed unnecessary color struct

* added newlines
This commit is contained in:
fullgrowngaming
2020-10-12 22:30:22 -05:00
committed by GitHub
parent f927730418
commit e997a0b67f
5 changed files with 131 additions and 15 deletions
@@ -9,7 +9,9 @@ void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80A61334(EnDyExtra* this, GlobalContext* globalCtx);
void func_80A613C8(EnDyExtra* this, GlobalContext* globalCtx);
const ActorInit En_Dy_Extra_InitVars = {
ACTOR_EN_DY_EXTRA,
ACTORTYPE_PROP,
@@ -21,16 +23,109 @@ const ActorInit En_Dy_Extra_InitVars = {
(ActorFunc)EnDyExtra_Update,
(ActorFunc)EnDyExtra_Draw
};
*/
GLOBAL_ASM("asm/non_matchings/ovl_En_Dy_Extra_0x80A612B0/EnDyExtra_Destroy.asm")
extern Vtx D_0600DD40[];
extern Gfx D_0600DEF0[];
GLOBAL_ASM("asm/non_matchings/ovl_En_Dy_Extra_0x80A612B0/EnDyExtra_Init.asm")
void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
GLOBAL_ASM("asm/non_matchings/ovl_En_Dy_Extra_0x80A612B0/func_80A61334.asm")
void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDyExtra* this = THIS;
GLOBAL_ASM("asm/non_matchings/ovl_En_Dy_Extra_0x80A612B0/func_80A613C8.asm")
this->type = this->actor.params;
this->actor.scale.x = 0.025f;
this->actor.scale.y = 0.039f;
this->actor.scale.z = 0.025f;
this->unk160 = this->actor.currPosRot.pos;
this->actor.gravity = -0.2f;
this->unk150 = 1.0f;
this->unk14C = 0x3C;
this->actionFunc = func_80A61334;
}
GLOBAL_ASM("asm/non_matchings/ovl_En_Dy_Extra_0x80A612B0/EnDyExtra_Update.asm")
void func_80A61334(EnDyExtra* this, GlobalContext* globalCtx) {
Math_SmoothScaleMaxF(&this->actor.gravity, 0.0f, 0.1f, 0.005f);
GLOBAL_ASM("asm/non_matchings/ovl_En_Dy_Extra_0x80A612B0/EnDyExtra_Draw.asm")
if (this->actor.currPosRot.pos.y < -85.0f) {
this->actor.velocity.y = 0.0f;
}
if (this->unk14C == 0 && this->unk14A != 0) {
this->unk14C = 0x32;
this->actionFunc = func_80A613C8;
}
}
void func_80A613C8(EnDyExtra* this, GlobalContext* globalCtx) {
Math_SmoothScaleMaxF(&this->actor.gravity, 0.0f, 0.1f, 0.005f);
if (this->unk14C == 0 || this->unk150 < 0.02f) {
Actor_MarkForDeath(&this->actor);
return;
}
this->unk150 -= 0.02f;
if (this->actor.currPosRot.pos.y < -85.0f) {
this->actor.velocity.y = 0.0f;
}
}
void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDyExtra* this = THIS;
DECR(this->unk14C);
func_800B8EC8(&this->actor, 0xC4U);
this->actionFunc(this, globalCtx);
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
}
void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) {
static ColorRGBA8 D_80A61740[] = { { 255, 255, 170, 255 },
{ 255, 170, 255, 255 },
{ 255, 255, 170, 255 },
{ 170, 255, 255, 255 },
{ 255, 255, 170, 255 } };
static ColorRGBA8 D_80A61754[] = {
{ 255, 100, 0, 255 }, { 255, 0, 100, 255 }, { 100, 255, 0, 255 }, { 0, 100, 255, 255 }, { 255, 230, 0, 255 }
};
static u8 D_80A61768[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01,
0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00, 0x00 };
EnDyExtra* this = THIS;
s32 pad;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Vtx* vertices = Lib_PtrSegToVirt(D_0600DD40);
s32 i;
u8 unk[3];
unk[0] = 0.0f;
unk[1] = (s8)(this->unk150 * 240.0f);
unk[2] = (s8)(this->unk150 * 255.0f);
for (i = 0; i < 27; i++) {
if (D_80A61768[i]) {
vertices[i].v.cn[3] = unk[D_80A61768[i]];
}
}
{
s32 pad2;
OPEN_DISPS(gfxCtx);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(oGfxCtx->polyXlu.p++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1,
globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10));
gDPPipeSync(oGfxCtx->polyXlu.p++);
gSPMatrix(oGfxCtx->polyXlu.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0x80, D_80A61740[this->type].red, D_80A61740[this->type].green,
D_80A61740[this->type].blue, 255);
gDPSetEnvColor(oGfxCtx->polyXlu.p++, D_80A61754[this->type].red, D_80A61754[this->type].green,
D_80A61754[this->type].blue, 128);
gSPDisplayList(oGfxCtx->polyXlu.p++, D_0600DEF0);
CLOSE_DISPS(gfxCtx);
}
}
@@ -5,9 +5,18 @@
struct EnDyExtra;
typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, GlobalContext*);
typedef struct EnDyExtra {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x28];
/* 0x144 */ EnDyExtraActionFunc actionFunc;
/* 0x148 */ s16 type;
/* 0x14A */ s16 unk14A;
/* 0x14C */ s16 unk14C;
/* 0x14E */ s16 unk14E;
/* 0x150 */ f32 unk150;
/* 0x154 */ char unk154[0xC];
/* 0x160 */ Vec3f unk160;
} EnDyExtra; // size = 0x16C
extern const ActorInit En_Dy_Extra_InitVars;