summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2022-08-07 16:24:05 -0700
committerGitHub <noreply@github.com>2022-08-07 19:24:05 -0400
commitbc3883d098fdc04ac28573ed2adefccc99f0a797 (patch)
tree08b66cd090b2f20e34bcf0bf8a7cecc581dacd2a /src
parent9f6bacbb883df3db1d3c73eb5a46d5de98cd4e99 (diff)
Effect Fhgflash OK (#975)
* OK * format * extract tex explicitly * FHGFLASH_SHOCK_NO_ACTOR * typo * Hitmark * sZeroVec * eff
Diffstat (limited to 'src')
-rw-r--r--src/code/z_effect_soft_sprite_old_init.c6
-rw-r--r--src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h13
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c106
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h8
4 files changed, 119 insertions, 14 deletions
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index b6a5c46fa..f9592478e 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -659,15 +659,15 @@ void EffectSsHitmark_SpawnCustomScale(PlayState* play, s32 type, s16 scale, Vec3
* param determines where the ligntning should go
* 0: dont attach to any actor. spawns at the position specified by pos
* 1: spawn at one of Player's body parts, chosen at random
- * 2: spawn at one of Phantom Ganon's body parts, chosen at random
+ * 2 - 6: spawn at one of Goht's body parts
*/
-void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) {
+void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 params) {
EffectSsFhgFlashInitParams initParams;
initParams.actor = actor;
Math_Vec3f_Copy(&initParams.pos, pos);
initParams.scale = scale;
- initParams.param = param;
+ initParams.params = params;
initParams.type = FHGFLASH_SHOCK;
EffectSs_Spawn(play, EFFECT_SS_FHG_FLASH, 128, &initParams);
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
index ce809a32a..4b8227021 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h
@@ -18,13 +18,22 @@ typedef struct BossHakuginEffect {
#define BOSS_HAKUGIN_EFFECT_COUNT 180
+typedef struct BossHakuginFhgFlashUnkStruct {
+ /* 0x00 */ Vec3f unk_00;
+ /* 0x0C */ char unk_0C[0x8];
+} BossHakuginFhgFlashUnkStruct; // size = 0x14
+
typedef struct BossHakugin {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_0144[0x44];
/* 0x0188 */ BossHakuginActionFunc actionFunc;
- /* 0x018C */ char unk_018C[0x86C];
+ /* 0x018C */ char unk_018C[0x5];
+ /* 0x0191 */ u8 unk_191;
+ /* 0x018C */ char unk_0192[0x866];
/* 0x09F8 */ BossHakuginEffect unk_9F8[BOSS_HAKUGIN_EFFECT_COUNT];
- /* 0x2618 */ char unk_2618[0x11F8];
+ /* 0x2618 */ char unk_2618[0x8E8];
+ /* 0x2F00 */ BossHakuginFhgFlashUnkStruct unk_2F00[7][15];
+ /* 0x3734 */ char unk_3734[0xDC];
} BossHakugin; // size = 0x3810
extern const ActorInit Boss_Hakugin_InitVars;
diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
index 073b6bb1d..764828bf4 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
@@ -1,27 +1,119 @@
/*
* File: z_eff_ss_fhg_flash.c
* Overlay: ovl_Effect_Ss_Fhg_Flash
- * Description:
+ * Description: Shock and Light Ball Effect
*/
#include "z_eff_ss_fhg_flash.h"
+#include "overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h"
+#include "assets/overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.h"
+
+#define rAlpha regs[0]
+#define rXZRot regs[3]
+#define rParams regs[4]
+#define rScale regs[8]
#define PARAMS ((EffectSsFhgFlashInitParams*)initParamsx)
-s32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
+u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this);
void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this);
-#if 0
const EffectSsInit Effect_Ss_Fhg_Flash_InitVars = {
EFFECT_SS_FHG_FLASH,
EffectSsFhgFlash_Init,
};
-#endif
+u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
+ static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
+ EffectSsFhgFlashInitParams* initParams = PARAMS;
+ Vec3f noActorPos = { 0.0f, -1000.0f, 0.0f };
+
+ this->actor = initParams->actor;
+ Math_Vec3f_Copy(&this->velocity, &gZeroVec3f);
+ Math_Vec3f_Copy(&this->accel, &gZeroVec3f);
+ this->life = (s32)(Rand_ZeroOne() * 10.0f) + 111;
+ this->rScale = (s32)Rand_ZeroFloat(initParams->scale) + initParams->scale;
+ this->rAlpha = 255;
+ this->draw = EffectSsFhgFlash_Draw;
+ this->update = EffectSsFhgFlash_Update;
+ this->rParams = initParams->params;
+
+ if (initParams->params != FHGFLASH_SHOCK_NO_ACTOR) {
+ this->pos = noActorPos;
+ this->gfx = gEffFhgFlashDL;
+ } else {
+ this->pos = initParams->pos;
+ this->gfx = gEffFhgFlashDL;
+ }
+
+ return 1;
+}
+
+#include "overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.c"
+
+void EffectSsFhgFlash_Draw(PlayState* play, u32 index, EffectSs* this) {
+ s32 pad;
+ GraphicsContext* gfxCtx = play->state.gfxCtx;
+ f32 scale = this->rScale / 100.0f;
+
+ OPEN_DISPS(gfxCtx);
+
+ Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
+ if (this->rParams != FHGFLASH_SHOCK_NO_ACTOR) {
+ func_8012C448(play->state.gfxCtx);
+ Matrix_RotateXS(this->rXZRot, MTXMODE_APPLY);
+ gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2);
+ } else {
+ func_8012C2DC(play->state.gfxCtx);
+ Matrix_ReplaceRotation(&play->billboardMtxF);
+ gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2);
+ }
+ gDPPipeSync(POLY_XLU_DISP++);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 155, 0);
+ Matrix_RotateZS(this->rXZRot, MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+
+ gSPDisplayList(POLY_XLU_DISP++, this->gfx);
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void EffectSsFhgFlash_Update(PlayState* play, u32 index, EffectSs* this) {
+ s16 randBodyPart;
+ s16 rand = Rand_ZeroOne() * 20000.0f;
+
+ this->rXZRot = (this->rXZRot + rand) + 0x4000;
+ if (this->rParams == FHGFLASH_SHOCK_PLAYER) {
+ Player* player = GET_PLAYER(play);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Init.s")
+ randBodyPart = Rand_ZeroFloat(18 - 0.1f);
+ this->pos.x = player->bodyPartsPos[randBodyPart].x + randPlusMinusPoint5Scaled(10.0f);
+ this->pos.y = player->bodyPartsPos[randBodyPart].y + randPlusMinusPoint5Scaled(15.0f);
+ this->pos.z = player->bodyPartsPos[randBodyPart].z + randPlusMinusPoint5Scaled(10.0f);
+ } else if ((this->rParams >= FHGFLASH_SHOCK_GOHT_2) && (this->rParams <= FHGFLASH_SHOCK_GOHT_6)) {
+ s32 pad;
+ Vec3f* bodyPartPos;
+ BossHakugin* goht = (BossHakugin*)this->actor;
+ s32 index = goht->unk_191 - 3;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Draw.s")
+ if (index < 0) {
+ bodyPartPos = &goht->unk_2F00[this->rParams][12].unk_00;
+ } else {
+ bodyPartPos = &goht->unk_2F00[this->rParams][index].unk_00;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Fhg_Flash/EffectSsFhgFlash_Update.s")
+ this->pos.x = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->x;
+ this->pos.y = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->y;
+ this->pos.z = randPlusMinusPoint5Scaled(70.0f) + bodyPartPos->z;
+ }
+ if (this->life < 100) {
+ this->rAlpha -= 50;
+ if (this->rAlpha < 0) {
+ this->rAlpha = 0;
+ this->life = 0;
+ }
+ }
+}
diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h
index 0598377f8..c464047b5 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h
+++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h
@@ -23,7 +23,11 @@ typedef enum {
typedef enum {
/* 0x00 */ FHGFLASH_SHOCK_NO_ACTOR,
/* 0x01 */ FHGFLASH_SHOCK_PLAYER,
- /* 0x02 */ FHGFLASH_SHOCK_PG
+ /* 0x02 */ FHGFLASH_SHOCK_GOHT_2,
+ /* 0x03 */ FHGFLASH_SHOCK_GOHT_3,
+ /* 0x04 */ FHGFLASH_SHOCK_GOHT_4,
+ /* 0x05 */ FHGFLASH_SHOCK_GOHT_5,
+ /* 0x06 */ FHGFLASH_SHOCK_GOHT_6
} FhgFlashLightningParam;
typedef struct {
@@ -31,7 +35,7 @@ typedef struct {
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
/* 0x24 */ s16 scale;
- /* 0x26 */ u8 param;
+ /* 0x26 */ u8 params;
/* 0x28 */ Actor* actor;
/* 0x2C */ u8 type;
} EffectSsFhgFlashInitParams; // size = 0x30