mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-12 11:51:58 -04:00
EffectSsStone1 Ok (#730)
* EffectSsStone1 OK * gameplay object stuff * unk_C -> reg0 * Fix * Reverse order of stone textures * undef syms
This commit is contained in:
@@ -625,11 +625,11 @@ void EffectSsSibuki_SpawnBurst(GlobalContext* globalCtx, Vec3f* pos) {
|
||||
|
||||
// EffectSsStone1 Spawn Functions
|
||||
|
||||
void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 arg2) {
|
||||
void EffectSsStone1_Spawn(GlobalContext* globalCtx, Vec3f* pos, s32 reg0) {
|
||||
EffectSsStone1InitParams initParams;
|
||||
|
||||
initParams.pos = *pos;
|
||||
initParams.unk_C = arg2;
|
||||
initParams.reg0 = reg0;
|
||||
|
||||
EffectSs_Spawn(globalCtx, EFFECT_SS_STONE1, 128, &initParams);
|
||||
}
|
||||
|
||||
@@ -5,23 +5,78 @@
|
||||
*/
|
||||
|
||||
#include "z_eff_ss_stone1.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#define PARAMS ((EffectSsStone1InitParams*)initParamsx)
|
||||
|
||||
s32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
|
||||
#define rReg0 regs[0]
|
||||
|
||||
u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
|
||||
void EffectSsStone1_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
||||
void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
|
||||
|
||||
#if 0
|
||||
const EffectSsInit Effect_Ss_Stone1_InitVars = {
|
||||
EFFECT_SS_STONE1,
|
||||
EffectSsStone1_Init,
|
||||
};
|
||||
|
||||
#endif
|
||||
typedef struct {
|
||||
/* 0x00 */ TexturePtr texture;
|
||||
/* 0x04 */ Color_RGBA8 primColor;
|
||||
/* 0x08 */ Color_RGBA8 envColor;
|
||||
} EffStoneDrawInfo;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Stone1/EffectSsStone1_Init.s")
|
||||
static EffStoneDrawInfo sDrawInfo[] = {
|
||||
{ gEffStone8Tex, { 200, 0, 0, 255 }, { 0, 0, 0, 255 } },
|
||||
{ gEffStone7Tex, { 255, 100, 0, 255 }, { 100, 0, 0, 255 } },
|
||||
{ gEffStone6Tex, { 255, 200, 0, 255 }, { 200, 0, 0, 255 } },
|
||||
{ gEffStone5Tex, { 255, 255, 0, 255 }, { 255, 0, 0, 255 } },
|
||||
{ gEffStone4Tex, { 255, 255, 150, 255 }, { 255, 150, 0, 255 } },
|
||||
{ gEffStone3Tex, { 255, 255, 255, 255 }, { 255, 255, 0, 255 } },
|
||||
{ gEffStone2Tex, { 255, 255, 255, 255 }, { 0, 255, 0, 255 } },
|
||||
{ gEffStone1Tex, { 255, 255, 255, 255 }, { 0, 255, 255, 255 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Stone1/EffectSsStone1_Draw.s")
|
||||
u32 EffectSsStone1_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
|
||||
EffectSsStone1InitParams* initParams = PARAMS;
|
||||
Vec3f pos = initParams->pos;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Stone1/EffectSsStone1_Update.s")
|
||||
this->pos = pos;
|
||||
this->vec = pos;
|
||||
this->life = 8;
|
||||
this->rReg0 = initParams->reg0;
|
||||
this->draw = EffectSsStone1_Draw;
|
||||
this->update = EffectSsStone1_Update;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void EffectSsStone1_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
EffStoneDrawInfo* drawParams = &sDrawInfo[this->life];
|
||||
Vec3f mfVec;
|
||||
f32 mfW;
|
||||
f32 scale;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &this->pos, &mfVec, &mfW);
|
||||
scale = (mfW < 1500.0f) ? 3.0f : (mfW / 1500.0f) * 3.0f;
|
||||
Matrix_InsertTranslation(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_8012C9BC(gfxCtx);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(drawParams->texture));
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, drawParams->primColor.r, drawParams->primColor.g, drawParams->primColor.b,
|
||||
255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, drawParams->envColor.r, drawParams->envColor.g, drawParams->envColor.b, 255);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gEffStoneDL);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void EffectSsStone1_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
|
||||
if ((this->life == 6) && (this->rReg0 != 0)) {
|
||||
iREG(50) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3f pos;
|
||||
/* 0x00 */ s32 unk_C;
|
||||
/* 0x0C */ s32 reg0;
|
||||
} EffectSsStone1InitParams; // size = 0x10
|
||||
|
||||
extern const EffectSsInit Effect_Ss_Stone1_InitVars;
|
||||
|
||||
Reference in New Issue
Block a user