Effect Kfire OK (#837)

* OK

* Small change

* Matrix renames

* else if
This commit is contained in:
Derek Hensley 2022-06-19 15:05:12 -07:00 committed by GitHub
parent 7ca70d496d
commit 9831e5e063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 8 deletions

3
spec
View File

@ -1908,8 +1908,7 @@ beginseg
name "ovl_Effect_Ss_K_Fire" name "ovl_Effect_Ss_K_Fire"
compress compress
include "build/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.o" include "build/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.o"
include "build/data/ovl_Effect_Ss_K_Fire/ovl_Effect_Ss_K_Fire.data.o" include "build/src/overlays/effects/ovl_Effect_Ss_K_Fire/ovl_Effect_Ss_K_Fire_reloc.o"
include "build/data/ovl_Effect_Ss_K_Fire/ovl_Effect_Ss_K_Fire.reloc.o"
endseg endseg
beginseg beginseg

View File

@ -5,23 +5,103 @@
*/ */
#include "z_eff_ss_k_fire.h" #include "z_eff_ss_k_fire.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define rAlpha regs[0]
#define rScroll regs[2]
#define rType regs[3]
#define rYScale regs[4]
#define rXZScale regs[5]
#define rScaleMax regs[6]
#define PARAMS ((EffectSsKFireInitParams*)initParamsx) #define PARAMS ((EffectSsKFireInitParams*)initParamsx)
s32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
#if 0
const EffectSsInit Effect_Ss_K_Fire_InitVars = { const EffectSsInit Effect_Ss_K_Fire_InitVars = {
EFFECT_SS_K_FIRE, EFFECT_SS_K_FIRE,
EffectSsKFire_Init, EffectSsKFire_Init,
}; };
#endif u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsKFireInitParams* initParams = PARAMS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_K_Fire/EffectSsKFire_Init.s") this->pos = initParams->pos;
this->velocity = initParams->velocity;
this->accel = initParams->accel;
this->life = 100;
this->rScaleMax = initParams->scaleMax;
this->rAlpha = 255;
this->rScroll = Rand_ZeroFloat(5.0f) - 25;
this->rType = initParams->type;
this->draw = EffectSsKFire_Draw;
this->update = EffectSsKFire_Update;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_K_Fire/EffectSsKFire_Draw.s") return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_K_Fire/EffectSsKFire_Update.s") void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
f32 xzScale;
f32 yScale;
xzScale = this->rXZScale / 10000.0f;
yScale = this->rYScale / 10000.0f;
OPEN_DISPS(gfxCtx);
Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
Matrix_Scale(xzScale, yScale, xzScale, MTXMODE_APPLY);
func_8012C2DC(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0,
globalCtx->state.frames * this->rScroll, 0x20, 0x80));
if (this->rType >= 100) {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, this->rAlpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, 0);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, this->rAlpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 0);
}
gDPPipeSync(POLY_XLU_DISP++);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
if ((index % 2) != 0) {
Matrix_RotateYF(M_PI, MTXMODE_APPLY);
}
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL);
CLOSE_DISPS(gfxCtx);
}
void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
if (this->rXZScale < this->rScaleMax) {
this->rXZScale += 4;
this->rYScale += 4;
if (this->rXZScale > this->rScaleMax) {
this->rXZScale = this->rScaleMax;
if (this->rType != 3) {
this->rYScale = this->rScaleMax;
}
}
} else if (this->rAlpha > 0) {
this->rAlpha -= 10;
if (this->rAlpha <= 0) {
this->rAlpha = 0;
this->life = 0;
}
}
if (this->rType == 3) {
this->rYScale++;
}
}