mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-09 21:51:32 -04:00
Effect EnFire OK (#977)
* OK * Gameplay keep fire * & * &2 * PR * Fire textures * Second mask
This commit is contained in:
@@ -872,14 +872,14 @@ void EffectSsFireTail_SpawnFlameOnPlayer(PlayState* play, f32 scale, s16 bodyPar
|
||||
|
||||
// EffectSsEnFire Spawn Functions
|
||||
|
||||
void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags,
|
||||
void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, s16 params, s16 flags,
|
||||
s16 bodyPart) {
|
||||
EffectSsEnFireInitParams initParams;
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
initParams.actor = actor;
|
||||
initParams.scale = scale;
|
||||
initParams.unk_12 = arg4;
|
||||
initParams.params = params;
|
||||
initParams.flags = flags;
|
||||
initParams.bodyPart = bodyPart;
|
||||
|
||||
@@ -890,7 +890,7 @@ void EffectSsEnFire_SpawnVec3f(PlayState* play, Actor* actor, Vec3f* pos, s16 sc
|
||||
EffectSs_Spawn(play, EFFECT_SS_EN_FIRE, 128, &initParams);
|
||||
}
|
||||
|
||||
void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 arg4, s16 flags,
|
||||
void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 scale, s16 params, s16 flags,
|
||||
s16 bodyPart) {
|
||||
EffectSsEnFireInitParams initParams;
|
||||
|
||||
@@ -899,8 +899,8 @@ void EffectSsEnFire_SpawnVec3s(PlayState* play, Actor* actor, Vec3s* pos, s16 sc
|
||||
initParams.pos.z = pos->z;
|
||||
initParams.actor = actor;
|
||||
initParams.scale = scale;
|
||||
initParams.unk_12 = arg4;
|
||||
initParams.flags = flags | 0x8000;
|
||||
initParams.params = params;
|
||||
initParams.flags = flags | ENFIRE_FLAGS_BODYPART_POS_VEC3S;
|
||||
initParams.bodyPart = bodyPart;
|
||||
|
||||
if (actor != NULL) {
|
||||
|
||||
@@ -5,23 +5,144 @@
|
||||
*/
|
||||
|
||||
#include "z_eff_ss_en_fire.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#define rScaleMax regs[0]
|
||||
#define rScale regs[1]
|
||||
#define rLifespan regs[2]
|
||||
#define rUnused regs[3]
|
||||
#define rPitch regs[4]
|
||||
#define rYaw regs[5]
|
||||
#define rReg6 regs[6]
|
||||
#define rBodyPart regs[7]
|
||||
#define rFlags regs[8]
|
||||
#define rScroll regs[9]
|
||||
|
||||
#define PARAMS ((EffectSsEnFireInitParams*)initParamsx)
|
||||
|
||||
s32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
|
||||
u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
|
||||
void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this);
|
||||
void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this);
|
||||
|
||||
#if 0
|
||||
const EffectSsInit Effect_Ss_En_Fire_InitVars = {
|
||||
EFFECT_SS_EN_FIRE,
|
||||
EffectSsEnFire_Init,
|
||||
};
|
||||
|
||||
#endif
|
||||
u32 EffectSsEnFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
|
||||
EffectSsEnFireInitParams* initParams = PARAMS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Init.s")
|
||||
Math_Vec3f_Copy(&this->pos, &initParams->pos);
|
||||
Math_Vec3f_Copy(&this->velocity, &gZeroVec3f);
|
||||
Math_Vec3f_Copy(&this->accel, &gZeroVec3f);
|
||||
this->life = 20;
|
||||
this->rLifespan = this->life;
|
||||
this->actor = initParams->actor;
|
||||
this->rScroll = Rand_ZeroOne() * 20.0f;
|
||||
this->draw = EffectSsEnFire_Draw;
|
||||
this->update = EffectSsEnFire_Update;
|
||||
this->rUnused = -15;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Draw.s")
|
||||
if (initParams->bodyPart < 0) {
|
||||
this->rYaw = Math_Vec3f_Yaw(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.y;
|
||||
this->rPitch =
|
||||
Math_Vec3f_Pitch(&initParams->actor->world.pos, &initParams->pos) - initParams->actor->shape.rot.x;
|
||||
this->vec.z = Math_Vec3f_DistXYZ(&initParams->pos, &initParams->actor->world.pos);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Fire/EffectSsEnFire_Update.s")
|
||||
this->rScaleMax = initParams->scale;
|
||||
|
||||
if (initParams->params & ENFIRE_PARAMS_USE_SCALE) {
|
||||
this->rScale = initParams->scale;
|
||||
} else {
|
||||
this->rScale = 0;
|
||||
}
|
||||
|
||||
this->rReg6 = initParams->params & 0x7FFF;
|
||||
this->rBodyPart = initParams->bodyPart;
|
||||
this->rFlags = initParams->flags;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void EffectSsEnFire_Draw(PlayState* play, u32 index, EffectSs* this) {
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
f32 scale;
|
||||
s16 camYaw;
|
||||
s32 pad[3];
|
||||
s16 redGreen;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
|
||||
camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000);
|
||||
Matrix_RotateYS(camYaw, MTXMODE_APPLY);
|
||||
|
||||
scale = Math_SinS(this->life * 0x333) * (this->rScale * 0.00005f);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
redGreen = this->life - 5;
|
||||
|
||||
if (redGreen < 0) {
|
||||
redGreen = 0;
|
||||
}
|
||||
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, redGreen * 12.7f, 0, 0, 0);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x0, 0x80, redGreen * 12.7f, redGreen * 12.7f, 0, 255);
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, (this->rScroll * -20) & 0x1FF, 0x20, 0x80));
|
||||
|
||||
if ((this->rFlags & 0x7FFF) || (this->life < 18)) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffFire2DL);
|
||||
} else {
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x14C */ Vec3f firePos[10];
|
||||
} FireActorF; // size = 0x1BC
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x14C */ Vec3s firePos[10];
|
||||
} FireActorS; // size = 0x180
|
||||
|
||||
void EffectSsEnFire_Update(PlayState* play, u32 index, EffectSs* this) {
|
||||
this->rScroll++;
|
||||
|
||||
if (this->actor != NULL) {
|
||||
if (this->actor->colorFilterTimer >= 22) {
|
||||
this->life++;
|
||||
}
|
||||
if (this->actor->update != NULL) {
|
||||
Math_SmoothStepToS(&this->rScale, this->rScaleMax, 1, this->rScaleMax >> 3, 0);
|
||||
|
||||
if (this->rBodyPart < 0) {
|
||||
Matrix_Translate(this->actor->world.pos.x, this->actor->world.pos.y, this->actor->world.pos.z,
|
||||
MTXMODE_NEW);
|
||||
Matrix_RotateYS(this->rYaw + this->actor->shape.rot.y, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(this->rPitch + this->actor->shape.rot.x, MTXMODE_APPLY);
|
||||
Matrix_MultVec3f(&this->vec, &this->pos);
|
||||
} else if (this->rFlags & ENFIRE_FLAGS_BODYPART_POS_VEC3S) {
|
||||
this->pos.x = ((FireActorS*)this->actor)->firePos[this->rBodyPart].x;
|
||||
this->pos.y = ((FireActorS*)this->actor)->firePos[this->rBodyPart].y;
|
||||
this->pos.z = ((FireActorS*)this->actor)->firePos[this->rBodyPart].z;
|
||||
} else {
|
||||
this->pos.x = ((FireActorF*)this->actor)->firePos[this->rBodyPart].x;
|
||||
this->pos.y = ((FireActorF*)this->actor)->firePos[this->rBodyPart].y;
|
||||
this->pos.z = ((FireActorF*)this->actor)->firePos[this->rBodyPart].z;
|
||||
}
|
||||
} else if (this->rReg6 != 0) {
|
||||
this->life = 0;
|
||||
} else {
|
||||
this->actor = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define ENFIRE_FLAGS_BODYPART_POS_VEC3S (1 << 15)
|
||||
#define ENFIRE_PARAMS_USE_SCALE (1 << 15)
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Actor* actor;
|
||||
/* 0x04 */ Vec3f pos;
|
||||
/* 0x10 */ s16 scale;
|
||||
/* 0x12 */ s16 unk_12;
|
||||
/* 0x12 */ s16 params;
|
||||
/* 0x14 */ s16 flags;
|
||||
/* 0x16 */ s16 bodyPart;
|
||||
} EffectSsEnFireInitParams; // size = 0x18
|
||||
|
||||
Reference in New Issue
Block a user