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 20:30:22 -07:00 committed by GitHub
parent f927730418
commit e997a0b67f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 131 additions and 15 deletions

View File

@ -28,17 +28,24 @@
extern GraphicsContext* oGfxCtx;
#define OPEN_DISPS(gfxCtx, file, line) \
#define OPEN_DISPS(gfxCtx) \
{ \
GraphicsContext* oGfxCtx; \
Gfx* dispRefs[4]; \
oGfxCtx = gfxCtx; \
#define CLOSE_DISPS(gfxCtx, file, line) \
} \
#define CLOSE_DISPS(gfxCtx) \
} \
(void)0
#define GRAPH_ALLOC(gfxCtx, size) \
((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - (size)))
#define SQ(x) ((x)*(x))
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define ULTRA_ABS(x) ((x) > 0) ? (x) : -(x)
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
#endif // _MACROS_H_

View File

@ -4629,8 +4629,9 @@ SECTIONS
ovl_En_Dy_Extra : AT(RomLocation)
{
build/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.o(.text)
build/asm/ovl_En_Dy_Extra_data.o(.data)
build/asm/ovl_En_Dy_Extra_rodata.o(.rodata)
build/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.o(.data)
build/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.o(.rodata)
build/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -34,5 +34,9 @@ D_06018DA0 = 0x06018DA0;
D_0601EF10 = 0x0601EF10;
D_06018C60 = 0x06018C60;
/* z_en_dy_extra */
D_0600DD40 = 0x0600DD40;
D_0600DEF0 = 0x0600DEF0;
/* arms_hook */
D_0601D960 = 0x0601D960;

View File

@ -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);
}
}

View File

@ -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;