1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 06:40:15 +00:00

En_Dy_Extra OK and matching (#351)

* Almost done with en_dy_extra

* All matching other than draw function, which just has some stack issues + possibly a localGfxCtx issue.

* OK, one non-matching.

* z_en_dy_extra OK and matching

* Deleted asm and updated spec

* Changed colors to decimal and got rid of padding in the u8 array

* Ran format script again to clean up after last commit

* All requested fixes

* Made further requested changes
This commit is contained in:
fullgrowngaming 2020-08-27 23:30:09 -07:00 committed by GitHub
parent 88ad705457
commit 04a0d7c132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 118 additions and 441 deletions

View file

@ -1,4 +1,11 @@
/*
* File: z_en_dy_extra.c
* Overlay: ovl_En_Dy_Extra
* Description: Spiral Beams (Great Fairy Fountains)
*/
#include "z_en_dy_extra.h"
#include "vt.h"
#define FLAGS 0x00000030
@ -9,7 +16,9 @@ void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_809FF7AC(EnDyExtra* this, GlobalContext* globalCtx);
void func_809FF840(EnDyExtra* this, GlobalContext* globalCtx);
const ActorInit En_Dy_Extra_InitVars = {
ACTOR_EN_DY_EXTRA,
ACTORTYPE_PROP,
@ -21,15 +30,102 @@ const ActorInit En_Dy_Extra_InitVars = {
(ActorFunc)EnDyExtra_Update,
(ActorFunc)EnDyExtra_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dy_Extra/EnDyExtra_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dy_Extra/EnDyExtra_Init.s")
extern Vtx D_0601BFB0[];
extern Gfx D_0601C160[];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dy_Extra/func_809FF7AC.s")
void EnDyExtra_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dy_Extra/func_809FF840.s")
void EnDyExtra_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDyExtra* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dy_Extra/EnDyExtra_Update.s")
osSyncPrintf("\n\n");
// "Big fairy effect"
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 大妖精効果 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params);
this->type = this->actor.params;
this->unk_15C.x = 0.025f;
this->unk_15C.y = 0.039f;
this->unk_15C.z = 0.025f;
this->unk_168 = this->actor.posRot.pos;
this->actor.gravity = -0.2f;
this->unk_158 = 1.0f;
this->unk_154 = 0x3C;
this->actionFunc = func_809FF7AC;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dy_Extra/EnDyExtra_Draw.s")
void func_809FF7AC(EnDyExtra* this, GlobalContext* globalCtx) {
Math_SmoothScaleMaxF(&this->actor.gravity, 0.0f, 0.1f, 0.005f);
if (this->actor.posRot.pos.y < -55.0f) {
this->actor.velocity.y = 0.0f;
}
if (this->unk_154 == 0 && this->unk_152 != 0) {
this->unk_154 = 0xC8;
this->actionFunc = func_809FF840;
}
}
void func_809FF840(EnDyExtra* this, GlobalContext* globalCtx) {
Math_SmoothScaleMaxF(&this->actor.gravity, 0.0f, 0.1f, 0.005f);
if (this->unk_154 == 0 || this->unk_158 < 0.02f) {
Actor_Kill(&this->actor);
return;
}
Math_SmoothDownscaleMaxF(&this->unk_158, 0.03f, 0.05f);
if (this->actor.posRot.pos.y < -55.0f) {
this->actor.velocity.y = 0.0f;
}
}
void EnDyExtra_Update(Actor* thisx, GlobalContext* globalCtx) {
EnDyExtra* this = THIS;
DECR(this->unk_154);
this->actor.scale.x = this->unk_15C.x;
this->actor.scale.y = this->unk_15C.y;
this->actor.scale.z = this->unk_15C.z;
Audio_PlayActorSound2(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG);
this->actionFunc(this, globalCtx);
Actor_MoveForward(&this->actor);
}
void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) {
static Color_RGBA8_n primColors[] = { { 255, 255, 170, 255 }, { 255, 255, 170, 255 } };
static Color_RGBA8_n envColors[] = { { 255, 100, 255, 255 }, { 100, 255, 255, 255 } };
static u8 D_809FFC50[] = { 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 };
EnDyExtra* this = THIS;
s32 pad;
GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx;
Vtx* vertices = SEGMENTED_TO_VIRTUAL(D_0601BFB0);
s32 i;
u8 unk[3];
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
unk[0] = 0.0f;
unk[1] = (s8)(this->unk_158 * 240.0f);
unk[2] = (s8)(this->unk_158 * 255.0f);
for (i = 0; i < 27; i++) {
if (D_809FFC50[i]) {
vertices[i].v.cn[3] = unk[D_809FFC50[i]];
}
}
gfxCtx = localGfxCtx;
Graph_OpenDisps(dispRefs, localGfxCtx, "../z_en_dy_extra.c", 294);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->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(gfxCtx->polyXlu.p++);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dy_extra.c", 307),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0x80, primColors[this->type].r, primColors[this->type].g,
primColors[this->type].b, 255);
gDPSetEnvColor(gfxCtx->polyXlu.p++, envColors[this->type].r, envColors[this->type].g, envColors[this->type].b, 128);
gSPDisplayList(gfxCtx->polyXlu.p++, D_0601C160);
Graph_CloseDisps(dispRefs, localGfxCtx, "../z_en_dy_extra.c", 325);
}

View file

@ -6,9 +6,17 @@
struct EnDyExtra;
typedef void (*EnDyExtraActionFunc)(struct EnDyExtra*, GlobalContext*);
typedef struct EnDyExtra {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x28];
/* 0x014C */ EnDyExtraActionFunc actionFunc;
/* 0x0150 */ s16 type;
/* 0x0152 */ s16 unk_152;
/* 0x0154 */ s16 unk_154;
/* 0x0158 */ f32 unk_158;
/* 0x015C */ Vec3f unk_15C;
/* 0x0168 */ Vec3f unk_168;
} EnDyExtra; // size = 0x0174
extern const ActorInit En_Dy_Extra_InitVars;