mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-04 02:09:46 -04:00
Effect EnIce OK (#976)
* Ok * Material/Model * Cleanup * format * IceFragment Assets * PR
This commit is contained in:
+2
-2
@@ -4544,7 +4544,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 32, 16, 1, 0,
|
||||
(gameplayFrames * 2) & 0xFF, 64, 32));
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gFrozenIceDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL);
|
||||
|
||||
effectAlphaScaled = effectAlpha * 255.0f;
|
||||
|
||||
@@ -4575,7 +4575,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f limbPos[], s16
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, gFrozenIceVtxDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL);
|
||||
}
|
||||
|
||||
limbPos = limbPosStart; // reset limbPos
|
||||
|
||||
@@ -780,15 +780,15 @@ void EffectSsIcePiece_SpawnBurst(PlayState* play, Vec3f* refPos, f32 scale) {
|
||||
|
||||
// EffectSsEnIce Spawn Functions
|
||||
|
||||
void EffectSsEnIce_SpawnFlyingVec3f(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env,
|
||||
f32 scale) {
|
||||
void EffectSsEnIce_SpawnFlying(PlayState* play, Actor* actor, Vec3f* pos, Color_RGBA8* prim, Color_RGBA8* env,
|
||||
f32 scale) {
|
||||
EffectSsEnIceInitParams initParams;
|
||||
|
||||
initParams.actor = actor;
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
Color_RGBA8_Copy(&initParams.primColor, prim);
|
||||
Color_RGBA8_Copy(&initParams.envColor, env);
|
||||
initParams.type = 0;
|
||||
initParams.type = ENICE_TYPE_FLYING;
|
||||
initParams.scale = scale;
|
||||
|
||||
if (actor != NULL) {
|
||||
@@ -802,7 +802,7 @@ void func_800B2B44(PlayState* play, Actor* actor, Vec3f* pos, f32 scale) {
|
||||
static Color_RGBA8 primColor = { 150, 150, 150, 250 };
|
||||
static Color_RGBA8 envColor = { 235, 245, 255, 255 };
|
||||
|
||||
EffectSsEnIce_SpawnFlyingVec3f(play, actor, pos, &primColor, &envColor, scale);
|
||||
EffectSsEnIce_SpawnFlying(play, actor, pos, &primColor, &envColor, scale);
|
||||
}
|
||||
|
||||
void func_800B2B7C(PlayState* play, Actor* actor, Vec3s* arg2, f32 scale) {
|
||||
@@ -823,7 +823,7 @@ void EffectSsEnIce_Spawn(PlayState* play, Vec3f* pos, f32 scale, Vec3f* velocity
|
||||
Color_RGBA8_Copy(&initParams.envColor, envColor);
|
||||
initParams.scale = scale;
|
||||
initParams.life = life;
|
||||
initParams.type = 1;
|
||||
initParams.type = ENICE_TYPE_NORMAL;
|
||||
|
||||
EffectSs_Spawn(play, EFFECT_SS_EN_ICE, 128, &initParams);
|
||||
}
|
||||
|
||||
@@ -1082,7 +1082,7 @@ void func_80A137C0(EnGo* this, PlayState* play, f32 arg2, f32 arg3) {
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames1, 0x20, 0x10, 1, 0, frames2, 0x40, 0x20));
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, (u8)arg3);
|
||||
gSPDisplayList(POLY_XLU_DISP++, &gameplay_keep_DL_050D10);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ void ObjIcePoly_Draw(Actor* thisx, PlayState* play) {
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, play->gameplayFrames % 256, 0x20, 0x10, 1, 0,
|
||||
(play->gameplayFrames * 2) % 256, 0x40, 0x20));
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, this->unk_148);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_050D10);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -1,30 +1,157 @@
|
||||
/*
|
||||
* File: z_eff_ss_en_ice.c
|
||||
* Overlay: ovl_Effect_Ss_En_Ice
|
||||
* Description:
|
||||
* Description: Ice clumps
|
||||
*/
|
||||
|
||||
#include "z_eff_ss_en_ice.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#define rLifespan regs[0]
|
||||
#define rYaw regs[1]
|
||||
#define rPitch regs[2]
|
||||
#define rRotSpeed regs[3]
|
||||
#define rPrimColorR regs[4]
|
||||
#define rPrimColorG regs[5]
|
||||
#define rPrimColorB regs[6]
|
||||
#define rPrimColorA regs[7]
|
||||
#define rEnvColorR regs[8]
|
||||
#define rEnvColorG regs[9]
|
||||
#define rEnvColorB regs[10]
|
||||
#define rAlphaMode regs[11]
|
||||
#define rScale regs[12]
|
||||
|
||||
#define PARAMS ((EffectSsEnIceInitParams*)initParamsx)
|
||||
|
||||
s32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
|
||||
void func_8097F62C(PlayState* play, u32 index, EffectSs* this);
|
||||
void func_8097F7EC(PlayState* play, u32 index, EffectSs* this);
|
||||
u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
|
||||
void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this);
|
||||
void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this);
|
||||
void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this);
|
||||
|
||||
#if 0
|
||||
const EffectSsInit Effect_Ss_En_Ice_InitVars = {
|
||||
EFFECT_SS_EN_ICE,
|
||||
EffectSsEnIce_Init,
|
||||
};
|
||||
|
||||
#endif
|
||||
u32 EffectSsEnIce_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
|
||||
EffectSsEnIceInitParams* initParams = PARAMS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Init.s")
|
||||
if (initParams->type == ENICE_TYPE_FLYING) {
|
||||
Math_Vec3f_Copy(&this->pos, &initParams->pos);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/EffectSsEnIce_Draw.s")
|
||||
if (initParams->actor != NULL) {
|
||||
Math_Vec3f_Diff(&this->pos, &initParams->actor->world.pos, &this->vec);
|
||||
} else {
|
||||
Math_Vec3f_Copy(&this->vec, &initParams->pos);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F62C.s")
|
||||
Math_Vec3f_Copy(&this->velocity, &gZeroVec3f);
|
||||
Math_Vec3f_Copy(&this->accel, &gZeroVec3f);
|
||||
this->life = 10;
|
||||
this->actor = initParams->actor;
|
||||
this->draw = EffectSsEnIce_Draw;
|
||||
this->update = EffectSsEnIce_UpdateFlying;
|
||||
this->rScale = initParams->scale * 100.0f;
|
||||
this->rPrimColorR = initParams->primColor.r;
|
||||
this->rPrimColorG = initParams->primColor.g;
|
||||
this->rPrimColorB = initParams->primColor.b;
|
||||
this->rPrimColorA = initParams->primColor.a;
|
||||
this->rEnvColorR = initParams->envColor.r;
|
||||
this->rEnvColorG = initParams->envColor.g;
|
||||
this->rEnvColorB = initParams->envColor.b;
|
||||
this->rAlphaMode = 1;
|
||||
this->rPitch = randPlusMinusPoint5Scaled(0x10000);
|
||||
} else if (initParams->type == ENICE_TYPE_NORMAL) {
|
||||
Math_Vec3f_Copy(&this->pos, &initParams->pos);
|
||||
Math_Vec3f_Copy(&this->vec, &initParams->pos);
|
||||
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
|
||||
Math_Vec3f_Copy(&this->accel, &initParams->accel);
|
||||
this->life = initParams->life;
|
||||
this->draw = EffectSsEnIce_Draw;
|
||||
this->update = EffectSsEnIce_Update;
|
||||
this->rLifespan = initParams->life;
|
||||
this->rScale = initParams->scale * 100.0f;
|
||||
this->rYaw = Math_FAtan2F(initParams->velocity.z, initParams->velocity.x);
|
||||
this->rPitch = 0;
|
||||
this->rPrimColorR = initParams->primColor.r;
|
||||
this->rPrimColorG = initParams->primColor.g;
|
||||
this->rPrimColorB = initParams->primColor.b;
|
||||
this->rPrimColorA = initParams->primColor.a;
|
||||
this->rEnvColorR = initParams->envColor.r;
|
||||
this->rEnvColorG = initParams->envColor.g;
|
||||
this->rEnvColorB = initParams->envColor.b;
|
||||
this->rAlphaMode = 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_En_Ice/func_8097F7EC.s")
|
||||
return 1;
|
||||
}
|
||||
|
||||
void EffectSsEnIce_Draw(PlayState* play, u32 index, EffectSs* this) {
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
s32 pad;
|
||||
f32 scale = this->rScale * 0.01f;
|
||||
u32 gameplayFrames = play->gameplayFrames;
|
||||
f32 alpha;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
if (this->rAlphaMode != 0) {
|
||||
alpha = this->life * 12.0f;
|
||||
} else if ((this->rLifespan > 0) && (this->life < (this->rLifespan >> 1))) {
|
||||
alpha = (this->life * 2.0f) / this->rLifespan;
|
||||
alpha *= 255.0f;
|
||||
} else {
|
||||
alpha = 255.0f;
|
||||
}
|
||||
|
||||
Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
Matrix_RotateYS(this->rYaw, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(this->rPitch, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
func_800BCC68(&this->pos, play);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, gameplayFrames & 0xFF, 0x20, 0x10, 1, 0,
|
||||
(gameplayFrames * 2) & 0xFF, 0x40, 0x20));
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
|
||||
this->rPrimColorA);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, (u32)alpha);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2MaterialDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment2ModelDL);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) {
|
||||
s16 rand;
|
||||
|
||||
if ((this->actor != NULL) && (this->actor->update != NULL)) {
|
||||
if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && (!(this->actor->colorFilterParams & 0xC000))) {
|
||||
Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos);
|
||||
this->life++;
|
||||
} else if (this->life == 9) {
|
||||
this->accel.x = Math_SinS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f);
|
||||
this->accel.z = Math_CosS(Math_Vec3f_Yaw(&this->actor->world.pos, &this->pos)) * (Rand_ZeroOne() + 1.0f);
|
||||
this->accel.y = -1.5f;
|
||||
this->velocity.y = 5.0f;
|
||||
}
|
||||
} else {
|
||||
this->actor = NULL;
|
||||
if (this->life >= 9) {
|
||||
rand = randPlusMinusPoint5Scaled(0xFFFF);
|
||||
this->accel.x = Math_SinS(rand) * (Rand_ZeroOne() + 1.0f);
|
||||
this->accel.z = Math_CosS(rand) * (Rand_ZeroOne() + 1.0f);
|
||||
this->life = 8;
|
||||
this->accel.y = -1.5f;
|
||||
this->velocity.y = 5.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectSsEnIce_Update(PlayState* play, u32 index, EffectSs* this) {
|
||||
this->rPitch += this->rRotSpeed; // rRotSpeed is not initialized so this does nothing
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
typedef enum EffectSsEnIceType {
|
||||
/* 0 */ ENICE_TYPE_FLYING,
|
||||
/* 1 */ ENICE_TYPE_NORMAL
|
||||
} EffectSsEnIceType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Actor* actor;
|
||||
/* 0x04 */ Vec3f pos;
|
||||
|
||||
@@ -71,7 +71,7 @@ void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) {
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, frames % 256, 0x20, 0x10, 1, 0, (2 * frames) % 256, 0x40, 0x20));
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragmentDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment1DL);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user