mirror of https://github.com/zeldaret/mm.git
Effect Dfire OK (#1038)
* OK * rename function * MTXMODE enum * PR * Format * % -> & * note
This commit is contained in:
parent
b5a9189cef
commit
1402db4008
|
@ -62,7 +62,13 @@
|
|||
<Animation Name="object_dodongo_Anim_008B1C" Offset="0x8B1C" />
|
||||
<Animation Name="object_dodongo_Anim_008DE0" Offset="0x8DE0" />
|
||||
<Animation Name="object_dodongo_Anim_009088" Offset="0x9088" />
|
||||
<!-- <Blob Name="object_dodongo_Blob_009098" Size="0x808" Offset="0x9098" /> -->
|
||||
<DList Name="object_dodongo_DL_0098A0" Offset="0x98A0" />
|
||||
|
||||
<!-- Fire Effect Textures -->
|
||||
<Texture Name="gDodongoFire0Tex" OutName="dodongo_fire_0" Format="i4" Width="32" Height="32" Offset="0x90A0"/>
|
||||
<Texture Name="gDodongoFire1Tex" OutName="dodongo_fire_1" Format="i4" Width="32" Height="32" Offset="0x92A0"/>
|
||||
<Texture Name="gDodongoFire2Tex" OutName="dodongo_fire_2" Format="i4" Width="32" Height="32" Offset="0x94A0"/>
|
||||
<Texture Name="gDodongoFire3Tex" OutName="dodongo_fire_3" Format="i4" Width="32" Height="32" Offset="0x96A0"/>
|
||||
|
||||
<DList Name="gDodongoFireDL" Offset="0x98A0" />
|
||||
</File>
|
||||
</Root>
|
||||
|
|
|
@ -539,7 +539,7 @@ void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* arg1, Vec3f* arg2
|
|||
void EffectSsGSpk_SpawnFuse(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* velocity, Vec3f* accel);
|
||||
// void EffectSsGSpk_SpawnRandColor(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7);
|
||||
// void EffectSsGSpk_SpawnSmall(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 fadeDelay, s16 life, s32 arg9);
|
||||
void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 alpha, s16 alphaStep, s16 fadeDelay, s32 life);
|
||||
void EffectSsBubble_Spawn(PlayState* play, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale);
|
||||
void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMax, s16 life);
|
||||
void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 scale);
|
||||
|
|
3
spec
3
spec
|
@ -1774,8 +1774,7 @@ beginseg
|
|||
name "ovl_Effect_Ss_D_Fire"
|
||||
compress
|
||||
include "build/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.o"
|
||||
include "build/data/ovl_Effect_Ss_D_Fire/ovl_Effect_Ss_D_Fire.data.o"
|
||||
include "build/data/ovl_Effect_Ss_D_Fire/ovl_Effect_Ss_D_Fire.reloc.o"
|
||||
include "build/src/overlays/effects/ovl_Effect_Ss_D_Fire/ovl_Effect_Ss_D_Fire_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -404,7 +404,7 @@ void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* v
|
|||
|
||||
// EffectSsDFire Spawn Functions
|
||||
void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
|
||||
s16 alpha, s16 fadeDelay, s16 arg8, s32 life) {
|
||||
s16 alpha, s16 alphaStep, s16 fadeDelay, s32 life) {
|
||||
EffectSsDFireInitParams initParams;
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
|
@ -413,8 +413,8 @@ void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
|
|||
initParams.scale = scale;
|
||||
initParams.scaleStep = scaleStep;
|
||||
initParams.alpha = alpha;
|
||||
initParams.alphaStep = alphaStep;
|
||||
initParams.fadeDelay = fadeDelay;
|
||||
initParams.unk_2C = arg8;
|
||||
initParams.life = life;
|
||||
|
||||
EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams);
|
||||
|
|
|
@ -1,31 +1,115 @@
|
|||
/*
|
||||
* File: z_eff_ss_d_fire.c
|
||||
* Overlay: ovl_Effect_Ss_D_Fire
|
||||
* Description:
|
||||
* Description: Dodongo Fire
|
||||
*/
|
||||
|
||||
#include "z_eff_ss_d_fire.h"
|
||||
#include "objects/object_dodongo/object_dodongo.h"
|
||||
|
||||
#define rScale regs[0]
|
||||
#define rTexIndex regs[1]
|
||||
#define rAlpha regs[5]
|
||||
#define rAlphaStep regs[6]
|
||||
#define rFadeDelay regs[7]
|
||||
#define rScaleStep regs[8]
|
||||
#define rObjectIndex regs[9]
|
||||
|
||||
#define PARAMS ((EffectSsDFireInitParams*)initParamsx)
|
||||
|
||||
s32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
|
||||
u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
|
||||
void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this);
|
||||
void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this);
|
||||
|
||||
#if 0
|
||||
const EffectSsInit Effect_Ss_D_Fire_InitVars = {
|
||||
EFFECT_SS_D_FIRE,
|
||||
EffectSsDFire_Init,
|
||||
};
|
||||
|
||||
#endif
|
||||
static TexturePtr sFireTextures[] = { gDodongoFire0Tex, gDodongoFire1Tex, gDodongoFire2Tex, gDodongoFire3Tex };
|
||||
|
||||
extern UNK_TYPE D_060098A0;
|
||||
s32 EffectSsDFire_CheckForObject(EffectSs* this, PlayState* play) {
|
||||
if (((this->rObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DODONGO)) < 0) ||
|
||||
!Object_IsLoaded(&play->objectCtx, this->rObjectIndex)) {
|
||||
this->life = -1;
|
||||
this->draw = NULL;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/func_809791B0.s")
|
||||
u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
|
||||
EffectSsDFireInitParams* initParams = PARAMS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/EffectSsDFire_Init.s")
|
||||
if (EffectSsDFire_CheckForObject(this, play)) {
|
||||
Math_Vec3f_Copy(&this->pos, &initParams->pos);
|
||||
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
|
||||
Math_Vec3f_Copy(&this->accel, &initParams->accel);
|
||||
this->gfx = gDodongoFireDL;
|
||||
this->life = initParams->life;
|
||||
this->rScale = initParams->scale;
|
||||
this->rScaleStep = initParams->scaleStep;
|
||||
this->draw = EffectSsDFire_Draw;
|
||||
this->update = EffectSsDFire_Update;
|
||||
this->rTexIndex = (play->state.frames & 3) ^ 3; // The xor reverses order, i.e 3 -> 2 -> 1 -> 0 -> 3
|
||||
this->rAlpha = initParams->alpha;
|
||||
this->rFadeDelay = this->life - initParams->fadeDelay;
|
||||
this->rAlphaStep = initParams->alphaStep;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/EffectSsDFire_Draw.s")
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_D_Fire/EffectSsDFire_Update.s")
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) {
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
s32 pad;
|
||||
void* object;
|
||||
f32 scale;
|
||||
|
||||
if (EffectSsDFire_CheckForObject(this, play)) {
|
||||
object = play->objectCtx.status[this->rObjectIndex].segment;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(object);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, object);
|
||||
|
||||
scale = this->rScale / 100.0f;
|
||||
|
||||
Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_8012C974(gfxCtx);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 50, this->rAlpha);
|
||||
|
||||
{
|
||||
TexturePtr* tex = sFireTextures[this->rTexIndex];
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(tex));
|
||||
}
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this) {
|
||||
this->rTexIndex++;
|
||||
this->rTexIndex &= 3;
|
||||
this->rScale += this->rScaleStep;
|
||||
if (this->life < this->rFadeDelay) {
|
||||
this->rAlpha -= this->rAlphaStep;
|
||||
if (this->rAlpha < 0) {
|
||||
this->rAlpha = 0;
|
||||
this->life = -1;
|
||||
}
|
||||
}
|
||||
|
||||
EffectSsDFire_CheckForObject(this, play);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ typedef struct {
|
|||
/* 0x24 */ s16 scale;
|
||||
/* 0x26 */ s16 scaleStep;
|
||||
/* 0x28 */ s16 alpha;
|
||||
/* 0x2A */ s16 fadeDelay;
|
||||
/* 0x2C */ s16 unk_2C;
|
||||
/* 0x2A */ s16 alphaStep;
|
||||
/* 0x2C */ s16 fadeDelay;
|
||||
/* 0x30 */ s32 life;
|
||||
} EffectSsDFireInitParams; // size = 0x34
|
||||
|
||||
|
|
|
@ -8147,7 +8147,7 @@
|
|||
0x80978D70:("EffectSsGSpk_Draw",),
|
||||
0x80978F40:("EffectSsGSpk_Update",),
|
||||
0x80979068:("EffectSsGSpk_UpdateNoAccel",),
|
||||
0x809791B0:("func_809791B0",),
|
||||
0x809791B0:("EffectSsDFire_CheckForObject",),
|
||||
0x80979228:("EffectSsDFire_Init",),
|
||||
0x8097930C:("EffectSsDFire_Draw",),
|
||||
0x809794D4:("EffectSsDFire_Update",),
|
||||
|
|
|
@ -844,14 +844,6 @@ D_060057D8 = 0x060057D8;
|
|||
D_060058C8 = 0x060058C8;
|
||||
D_06007238 = 0x06007238;
|
||||
|
||||
// ovl_Effect_Ss_D_Fire
|
||||
|
||||
D_060098A0 = 0x060098A0;
|
||||
|
||||
// ovl_Effect_Ss_Extra
|
||||
|
||||
D_06000DC0 = 0x06000DC0;
|
||||
|
||||
// ovl_Eff_Kamejima_Wave
|
||||
|
||||
D_06000000 = 0x06000000;
|
||||
|
|
Loading…
Reference in New Issue