Effect Bomb2 Ok (#1039)

* OK

* PR
This commit is contained in:
Derek Hensley 2022-09-24 10:31:20 -07:00 committed by GitHub
parent 1402db4008
commit 77be902c25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 189 additions and 28 deletions

View File

@ -845,17 +845,17 @@
<Texture Name="gBombchuBodyTex" OutName="bombchu_body" Format="rgba16" Width="8" Height="8" Offset="0x16060" />
<DList Name="gBombchuDL" Offset="0x16360" />
<Texture Name="gameplay_keep_Tex_0164D0" OutName="tex_0164D0" Format="ia16" Width="32" Height="32" Offset="0x164D0" />
<Texture Name="gameplay_keep_Tex_016CD0" OutName="tex_016CD0" Format="ia16" Width="32" Height="32" Offset="0x16CD0" />
<Texture Name="gameplay_keep_Tex_0174D0" OutName="tex_0174D0" Format="ia16" Width="32" Height="32" Offset="0x174D0" />
<Texture Name="gameplay_keep_Tex_017CD0" OutName="tex_017CD0" Format="ia16" Width="32" Height="32" Offset="0x17CD0" />
<Texture Name="gameplay_keep_Tex_0184D0" OutName="tex_0184D0" Format="ia16" Width="32" Height="32" Offset="0x184D0" />
<Texture Name="gameplay_keep_Tex_018CD0" OutName="tex_018CD0" Format="ia16" Width="32" Height="32" Offset="0x18CD0" />
<Texture Name="gameplay_keep_Tex_0194D0" OutName="tex_0194D0" Format="ia16" Width="32" Height="32" Offset="0x194D0" />
<Texture Name="gameplay_keep_Tex_019CD0" OutName="tex_019CD0" Format="ia16" Width="32" Height="32" Offset="0x19CD0" />
<DList Name="gameplay_keep_DL_01A4D0" Offset="0x1A4D0" />
<DList Name="gameplay_keep_DL_01A538" Offset="0x1A538" />
<DList Name="gameplay_keep_DL_01A590" Offset="0x1A590" />
<Texture Name="gEffBombExplosion1Tex" OutName="eff_bomb_explosion_1" Format="ia16" Width="32" Height="32" Offset="0x164D0" />
<Texture Name="gEffBombExplosion2Tex" OutName="eff_bomb_explosion_2" Format="ia16" Width="32" Height="32" Offset="0x16CD0" />
<Texture Name="gEffBombExplosion3Tex" OutName="eff_bomb_explosion_3" Format="ia16" Width="32" Height="32" Offset="0x174D0" />
<Texture Name="gEffBombExplosion4Tex" OutName="eff_bomb_explosion_4" Format="ia16" Width="32" Height="32" Offset="0x17CD0" />
<Texture Name="gEffBombExplosion5Tex" OutName="eff_bomb_explosion_5" Format="ia16" Width="32" Height="32" Offset="0x184D0" />
<Texture Name="gEffBombExplosion6Tex" OutName="eff_bomb_explosion_6" Format="ia16" Width="32" Height="32" Offset="0x18CD0" />
<Texture Name="gEffBombExplosion7Tex" OutName="eff_bomb_explosion_7" Format="ia16" Width="32" Height="32" Offset="0x194D0" />
<Texture Name="gEffBombExplosion8Tex" OutName="eff_bomb_explosion_8" Format="ia16" Width="32" Height="32" Offset="0x19CD0" />
<DList Name="gEffBombExplosion1DL" Offset="0x1A4D0" />
<DList Name="gEffBombExplosion2DL" Offset="0x1A538" />
<DList Name="gEffBombExplosion3DL" Offset="0x1A590" />
<DList Name="gEffFragments1DL" Offset="0x1A620" />
<Texture Name="gWitheredLeafTex" OutName="withered_leaf" Format="rgba16" Width="16" Height="16" Offset="0x1A6B0" />
<Texture Name="gameplay_keep_Tex_01A8B0" OutName="tex_01A8B0" Format="i8" Width="16" Height="32" Offset="0x1A8B0" />

3
spec
View File

@ -1751,8 +1751,7 @@ beginseg
name "ovl_Effect_Ss_Bomb2"
compress
include "build/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.o"
include "build/data/ovl_Effect_Ss_Bomb2/ovl_Effect_Ss_Bomb2.data.o"
include "build/data/ovl_Effect_Ss_Bomb2/ovl_Effect_Ss_Bomb2.reloc.o"
include "build/src/overlays/effects/ovl_Effect_Ss_Bomb2/ovl_Effect_Ss_Bomb2_reloc.o"
endseg
beginseg

View File

@ -1,30 +1,195 @@
/*
* File: z_eff_ss_bomb2.c
* Overlay: ovl_Effect_Ss_Bomb2
* Description:
* Description: Bomb Blast
*/
#include "z_eff_ss_bomb2.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define rScale regs[0]
#define rTexIndex regs[1]
#define rPrimColorR regs[2]
#define rPrimColorG regs[3]
#define rPrimColorB regs[4]
#define rPrimColorA regs[5]
#define rEnvColorR regs[6]
#define rEnvColorG regs[7]
#define rEnvColorB regs[8]
#define rScaleStep regs[9]
#define rDepth regs[10]
#define PARAMS ((EffectSsBomb2InitParams*)initParamsx)
s32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this);
void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this);
void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this);
void func_80978138(PlayState* play, u32 index, EffectSs* this);
void func_80978304(PlayState* play, u32 index, EffectSs* this);
#if 0
const EffectSsInit Effect_Ss_Bomb2_InitVars = {
EFFECT_SS_BOMB2,
EffectSsBomb2_Init,
};
#endif
static EffectSsDrawFunc sDrawFuncs[] = {
EffectSsBomb2_DrawFade,
EffectSsBomb2_DrawLayered,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/EffectSsBomb2_Init.s")
static TexturePtr sTextures[] = {
gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex,
gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/func_80978138.s")
static TexturePtr sLayeredTextures[] = {
gEffBombExplosion1Tex, gEffBombExplosion2Tex, gEffBombExplosion3Tex, gEffBombExplosion4Tex,
gEffBombExplosion5Tex, gEffBombExplosion6Tex, gEffBombExplosion7Tex, gEffBombExplosion8Tex,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/func_80978304.s")
u32 EffectSsBomb2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsBomb2InitParams* initParams = PARAMS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Bomb2/EffectSsBomb2_Update.s")
Math_Vec3f_Copy(&this->pos, &initParams->pos);
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->gfx = gEffBombExplosion1DL;
this->life = 24;
this->update = EffectSsBomb2_Update;
this->draw = sDrawFuncs[initParams->drawMode];
this->rScale = initParams->scale;
this->rScaleStep = initParams->scaleStep;
this->rPrimColorR = 255;
this->rPrimColorG = 255;
this->rPrimColorB = 255;
this->rPrimColorA = 255;
this->rEnvColorR = 0;
this->rEnvColorG = 0;
this->rEnvColorB = 200;
return 1;
}
// unused in the original game. looks like EffectSsBomb but with color
void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
MtxF mfTransBillboard;
Mtx* mtx;
s32 pad;
f32 scale;
OPEN_DISPS(gfxCtx);
scale = this->rScale * 0.01f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_8012C974(gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sTextures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
}
CLOSE_DISPS(gfxCtx);
}
void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
MtxF mfTransBillboard;
MtxF mtx2F;
Mtx* mtx2;
Mtx* mtx;
s32 pad[3];
f32 scale;
f32 depth;
f32 layer2Scale = 0.925f;
s32 i;
OPEN_DISPS(gfxCtx);
depth = this->rDepth;
scale = this->rScale * 0.01f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx2 = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
if (mtx2 != NULL) {
func_8012C974(gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sLayeredTextures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion2DL);
gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL);
Matrix_MtxToMtxF(mtx2, &mtx2F);
Matrix_Put(&mtx2F);
for (i = 1; i >= 0; i--) {
Matrix_Translate(0.0f, 0.0f, depth, MTXMODE_APPLY);
Matrix_RotateZF((this->life * 0.02f) + 180.0f, MTXMODE_APPLY);
Matrix_Scale(layer2Scale, layer2Scale, layer2Scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL);
layer2Scale -= 0.15f;
}
}
}
CLOSE_DISPS(gfxCtx);
}
void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) {
s32 divisor;
this->rTexIndex = (23 - this->life) / 3;
this->rScale += this->rScaleStep;
if (this->rScaleStep == 30) {
this->rDepth += 4;
} else {
this->rDepth += 2;
}
if ((this->life < 23) && (this->life > 13)) {
divisor = this->life - 13;
this->rPrimColorR = func_800B096C(this->rPrimColorR, 255, divisor);
this->rPrimColorG = func_800B096C(this->rPrimColorG, 255, divisor);
this->rPrimColorB = func_800B096C(this->rPrimColorB, 150, divisor);
this->rPrimColorA = func_800B096C(this->rPrimColorA, 255, divisor);
this->rEnvColorR = func_800B096C(this->rEnvColorR, 150, divisor);
this->rEnvColorG = func_800B096C(this->rEnvColorG, 0, divisor);
this->rEnvColorB = func_800B096C(this->rEnvColorB, 0, divisor);
} else if ((this->life < 14) && (this->life > -1)) {
divisor = this->life + 1;
this->rPrimColorR = func_800B096C(this->rPrimColorR, 50, divisor);
this->rPrimColorG = func_800B096C(this->rPrimColorG, 50, divisor);
this->rPrimColorB = func_800B096C(this->rPrimColorB, 50, divisor);
this->rPrimColorA = func_800B096C(this->rPrimColorA, 150, divisor);
this->rEnvColorR = func_800B096C(this->rEnvColorR, 10, divisor);
this->rEnvColorG = func_800B096C(this->rEnvColorG, 10, divisor);
this->rEnvColorB = func_800B096C(this->rEnvColorB, 10, divisor);
}
}

View File

@ -8137,8 +8137,8 @@
0x80977E6C:("func_80977E6C",),
0x80977F28:("func_80977F28",),
0x80978070:("EffectSsBomb2_Init",),
0x80978138:("func_80978138",),
0x80978304:("func_80978304",),
0x80978138:("EffectSsBomb2_DrawFade",),
0x80978304:("EffectSsBomb2_DrawLayered",),
0x80978628:("EffectSsBomb2_Update",),
0x809788D0:("EffectSsBlast_Init",),
0x809789FC:("EffectSsBlast_Draw",),

View File

@ -385,9 +385,6 @@ D_04014560 = 0x04014560;
D_04015DB0 = 0x04015DB0;
D_04015FA0 = 0x04015FA0;
D_04016360 = 0x04016360;
D_0401A4D0 = 0x0401A4D0;
D_0401A538 = 0x0401A538;
D_0401A590 = 0x0401A590;
D_0401ACF0 = 0x0401ACF0;
D_0401ED00 = 0x0401ED00;
D_0401F0F0 = 0x0401F0F0;