summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfig02 <fig02srl@gmail.com>2020-07-19 09:54:24 -0400
committerGitHub <noreply@github.com>2020-07-19 09:54:24 -0400
commit5f7bce6e2e87cdb772ab3da92212f860f428d72d (patch)
treec35378dd511a02057dbb2cc65ea84627f2fd7184 /src
parent66e9475b25b0809ffca5cffba932fab3e13b5596 (diff)
Bg_Heavy_Block and Eff_Ss_Dust (#258)
* heavy_rock progress * heavy block progress, 2 functions left * progress * progress * heavy_block OK * comments * heavy block done * eff ss dust ok * naming * done i think * comment * clean up dust usages * remove docs * remove reloc * move enum and rename flag * effect enum
Diffstat (limited to 'src')
-rw-r--r--src/code/z_actor.c52
-rw-r--r--src/code/z_effect_soft_sprite.c2
-rw-r--r--src/code/z_effect_soft_sprite_old_init.c145
-rw-r--r--src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c515
-rw-r--r--src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h17
-rw-r--r--src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c1
-rw-r--r--src/overlays/actors/ovl_En_Floormas/z_en_floormas.c52
-rw-r--r--src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c3
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c199
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h20
10 files changed, 893 insertions, 113 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index db059634d..d79e96003 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -3173,56 +3173,56 @@ s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx,
return 1;
}
-void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, s32 arg4, f32 arg5, s16 arg6,
- s16 arg7, u8 arg8) {
- Vec3f sp9C;
- Vec3f sp90 = { 0.0f, 0.0f, 0.0f };
- Vec3f sp84 = { 0.0f, 0.3f, 0.0f };
+void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, s32 arg4, f32 arg5, s16 scale,
+ s16 scaleStep, u8 arg8) {
+ Vec3f pos;
+ Vec3f velocity = { 0.0f, 0.0f, 0.0f };
+ Vec3f accel = { 0.0f, 0.3f, 0.0f };
f32 var;
s32 i;
var = (Math_Rand_ZeroOne() - 0.5f) * 6.28f;
- sp9C.y = actor->groundY;
- sp84.y += (Math_Rand_ZeroOne() - 0.5f) * 0.2f;
+ pos.y = actor->groundY;
+ accel.y += (Math_Rand_ZeroOne() - 0.5f) * 0.2f;
for (i = arg4; i >= 0; i--) {
- sp9C.x = (func_800CA720(var) * arg3) + arg2->x;
- sp9C.z = (func_800CA774(var) * arg3) + arg2->z;
- sp84.x = (Math_Rand_ZeroOne() - 0.5f) * arg5;
- sp84.z = (Math_Rand_ZeroOne() - 0.5f) * arg5;
+ pos.x = (func_800CA720(var) * arg3) + arg2->x;
+ pos.z = (func_800CA774(var) * arg3) + arg2->z;
+ accel.x = (Math_Rand_ZeroOne() - 0.5f) * arg5;
+ accel.z = (Math_Rand_ZeroOne() - 0.5f) * arg5;
- if (arg6 == 0) {
- func_8002857C(globalCtx, &sp9C, &sp90, &sp84);
+ if (scale == 0) {
+ func_8002857C(globalCtx, &pos, &velocity, &accel);
} else if (arg8 != 0) {
- func_800286CC(globalCtx, &sp9C, &sp90, &sp84, arg6, arg7);
+ func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
} else {
- func_8002865C(globalCtx, &sp9C, &sp90, &sp84, arg6, arg7);
+ func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
}
var += 6.28f / (arg4 + 1.0f);
}
}
-void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s16 arg4, s16 arg5, u8 arg6) {
- Vec3f sp94;
- Vec3f sp88 = { 0.0f, 0.0f, 0.0f };
- Vec3f sp7C = { 0.0f, 0.3f, 0.0f };
- s16 var;
+void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s16 arg4, s16 scaleStep, u8 arg6) {
+ Vec3f pos;
+ Vec3f velocity = { 0.0f, 0.0f, 0.0f };
+ Vec3f accel = { 0.0f, 0.3f, 0.0f };
+ s16 scale;
u32 var2;
s32 i;
for (i = arg3; i >= 0; i--) {
- sp94.x = arg1->x + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
- sp94.y = arg1->y + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
- sp94.z = arg1->z + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
+ pos.x = arg1->x + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
+ pos.y = arg1->y + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
+ pos.z = arg1->z + ((Math_Rand_ZeroOne() - 0.5f) * arg2);
- var = (s16)((Math_Rand_ZeroOne() * arg4) * 0.2f) + arg4;
+ scale = (s16)((Math_Rand_ZeroOne() * arg4) * 0.2f) + arg4;
var2 = arg6;
if (var2 != 0) {
- func_800286CC(globalCtx, &sp94, &sp88, &sp7C, var, arg5);
+ func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
} else {
- func_8002865C(globalCtx, &sp94, &sp88, &sp7C, var, arg5);
+ func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
}
}
}
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index 03754d7c4..5ba79f306 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -88,7 +88,7 @@ void EffectSs_Reset(EffectSs* effectSs) {
effectSs->priority = 128;
effectSs->draw = NULL;
effectSs->update = NULL;
- effectSs->unk_38 = 0;
+ effectSs->unk_38 = NULL;
effectSs->unk_3C = NULL;
for (i = 0; i < ARRAY_COUNT(effectSs->regs); i++) {
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index f06dc4a03..3612c4ad4 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -1,50 +1,155 @@
#include <ultra64.h>
#include <global.h>
+#include "overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h"
#include "overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h"
#include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h"
+extern Color_RGBA8_n D_801158CC;
+extern Color_RGBA8_n D_801158D0;
+
// Draw utility for some G effects
+
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80027F80.s")
// EffectSsDust Spawn Functions
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800281E8.s")
+void EffectSsDust_Spawn(GlobalContext* globalCtx, u16 drawFlags, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
+ Color_RGBA8_n* primColor, Color_RGBA8_n* envColor, s16 scale, s16 scaleStep, s16 life,
+ u8 updateMode) {
+ EffectSsDustInitParams initParams;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002829C.s")
+ Math_Vec3f_Copy(&initParams.pos, pos);
+ Math_Vec3f_Copy(&initParams.velocity, velocity);
+ Math_Vec3f_Copy(&initParams.accel, accel);
+ initParams.primColor = *primColor;
+ initParams.envColor = *envColor;
+ initParams.drawFlags = drawFlags;
+ initParams.scale = scale;
+ initParams.scaleStep = scaleStep;
+ initParams.life = life;
+ initParams.updateMode = updateMode;
+ EffectSs_Spawn(globalCtx, EFFECT_SS_DUST, 128, &initParams);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028304.s")
+void func_8002829C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep) {
+ EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002836C.s")
+void func_80028304(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep) {
+ EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800283D4.s")
+void func_8002836C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep, s16 life) {
+ EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002843C.s")
+void func_800283D4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep, s16 life) {
+ EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800284A4.s")
+void func_8002843C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep, s16 life) {
+ EffectSsDust_Spawn(globalCtx, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028510.s")
+// unused
+void func_800284A4(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep) {
+ EffectSsDust_Spawn(globalCtx, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002857C.s")
+// unused
+void func_80028510(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor, s16 scale, s16 scaleStep) {
+ EffectSsDust_Spawn(globalCtx, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800285EC.s")
+void func_8002857C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
+ EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801158CC, &D_801158D0, 100, 5, 10, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002865C.s")
+// unused
+void func_800285EC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
+ EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801158CC, &D_801158D0, 100, 5, 10, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800286CC.s")
+void func_8002865C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
+ EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801158CC, &D_801158D0, scale, scaleStep, 10, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002873C.s")
+void func_800286CC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
+ EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801158CC, &D_801158D0, scale, scaleStep, 10, 0);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800287AC.s")
+void func_8002873C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
+ s16 life) {
+ EffectSsDust_Spawn(globalCtx, 4, pos, velocity, accel, &D_801158CC, &D_801158D0, scale, scaleStep, life, 0);
+}
+
+void func_800287AC(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
+ s16 life) {
+ EffectSsDust_Spawn(globalCtx, 5, pos, velocity, accel, &D_801158CC, &D_801158D0, scale, scaleStep, life, 0);
+}
+
+void func_8002881C(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor) {
+ func_8002829C(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5);
+}
+
+// unused
+void func_80028858(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8_n* primColor,
+ Color_RGBA8_n* envColor) {
+ func_80028304(globalCtx, pos, velocity, accel, primColor, envColor, 100, 5);
+}
+
+void func_80028894(Vec3f* srcPos, f32 randScale, Vec3f* newPos, Vec3f* velocity, Vec3f* accel) {
+ s16 randAngle;
+ f32 rand;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002881C.s")
+ rand = Math_Rand_ZeroOne() * randScale;
+ randAngle = (Math_Rand_ZeroOne() * 65536.0f);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028858.s")
+ *newPos = *srcPos;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028894.s")
+ newPos->x += Math_Sins(randAngle) * rand;
+ newPos->z += Math_Coss(randAngle) * rand;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028990.s")
+ velocity->y = 1.0f;
+ velocity->x = Math_Sins(randAngle);
+ velocity->z = Math_Coss(randAngle);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028A54.s")
+ accel->x = 0.0f;
+ accel->y = 0.0f;
+ accel->z = 0.0f;
+}
+
+void func_80028990(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
+ s32 i;
+ Vec3f pos;
+ Vec3f velocity;
+ Vec3f accel;
+
+ for (i = 0; i < 20; i++) {
+ func_80028894(srcPos, randScale, &pos, &velocity, &accel);
+ func_8002873C(globalCtx, &pos, &velocity, &accel, 100, 30, 7);
+ }
+}
+
+void func_80028A54(GlobalContext* globalCtx, f32 randScale, Vec3f* srcPos) {
+ s32 i;
+ Vec3f pos;
+ Vec3f velocity;
+ Vec3f accel;
+
+ for (i = 0; i < 20; i++) {
+ func_80028894(srcPos, randScale, &pos, &velocity, &accel);
+ func_800287AC(globalCtx, &pos, &velocity, &accel, 100, 30, 7);
+ }
+}
// EffectSsKiraKira Spawn Functions
@@ -190,6 +295,8 @@ void EffectSsFhgFlash_Spawn2(GlobalContext* globalCtx, Actor* arg1, Vec3f* pos,
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029DBC.s")
+// EffectSsSolderSrchBall Spawn Functions
+
void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 arg4,
s16* linkDetected) {
EffectSsSolderSrchBallInitParams initParams;
diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c
index 482433525..dba3c6abc 100644
--- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c
+++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c
@@ -1,15 +1,32 @@
+/*
+ * File: z_bg_heavy_block.c
+ * Overlay: ovl_Bg_Heavy_Block
+ * Description: Large block that can only be lifted with Golden Gauntlets
+ */
+
#include "z_bg_heavy_block.h"
+#include <vt.h>
#define FLAGS 0x00000000
#define THIS ((BgHeavyBlock*)thisx)
+#define PIECE_FLAG_HIT_FLOOR (1 << 0)
+
void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx);
void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgHeavyBlock_Update(Actor* thisx, GlobalContext* globalCtx);
void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx);
-/*
+void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx);
+
+void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx);
+void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx);
+void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx);
+void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx);
+void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx);
+void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx);
+
const ActorInit Bg_Heavy_Block_InitVars = {
ACTOR_BG_HEAVY_BLOCK,
ACTORTYPE_BG,
@@ -21,35 +38,497 @@ const ActorInit Bg_Heavy_Block_InitVars = {
(ActorFunc)BgHeavyBlock_Update,
(ActorFunc)BgHeavyBlock_Draw,
};
-*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80883790.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80883820.s")
+static InitChainEntry sInitChain[] = {
+ ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP),
+};
+
+extern UNK_TYPE D_0600169C;
+extern Gfx D_060013C0[];
+extern Gfx D_06001A30[];
+extern Gfx D_060018A0[];
+
+void BgHeavyBlock_SetPieceRandRot(BgHeavyBlock* this, f32 scale) {
+ this->dyna.actor.posRot.rot.x = Math_Rand_CenteredFloat(1024.0f) * scale;
+ this->dyna.actor.posRot.rot.y = Math_Rand_CenteredFloat(1024.0f) * scale;
+ this->dyna.actor.posRot.rot.z = Math_Rand_CenteredFloat(1024.0f) * scale;
+}
+
+void BgHeavyBlock_InitPiece(BgHeavyBlock* this, f32 scale) {
+ f32 rand;
+ f32 yawSinCos;
+ f32 randChoice;
+
+ this->dyna.actor.gravity = -0.6f;
+ this->dyna.actor.minVelocityY = -12.0f;
+ randChoice = Math_Rand_CenteredFloat(12.0f * scale);
+ rand = (randChoice < 0.0f) ? randChoice - 2.0f : randChoice + 2.0f;
+ this->dyna.actor.velocity.y = (Math_Rand_ZeroFloat(8.0f) + 4.0f) * scale;
+ this->dyna.actor.velocity.z = Math_Rand_ZeroFloat(-8.0f * scale);
+ yawSinCos = Math_Coss(this->dyna.actor.posRot.rot.y);
+ this->dyna.actor.velocity.x =
+ (Math_Sins(this->dyna.actor.posRot.rot.y) * this->dyna.actor.velocity.z + (yawSinCos * rand));
+ yawSinCos = Math_Sins(this->dyna.actor.posRot.rot.y);
+ this->dyna.actor.velocity.z =
+ (Math_Coss(this->dyna.actor.posRot.rot.y) * this->dyna.actor.velocity.z) + (-yawSinCos * rand);
+ BgHeavyBlock_SetPieceRandRot(this, scale);
+ Actor_SetScale(&this->dyna.actor, Math_Rand_CenteredFloat(0.2f) + 1.0f);
+}
+
+void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ s32 pad[2];
+ UNK_TYPE a1;
+
+ a1 = 0;
+ this->dyna.actor.flags |= 0x20030;
+ DynaPolyInfo_SetActorMove(&this->dyna, 0);
+ DynaPolyInfo_Alloc(&D_0600169C, &a1);
+ this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, a1);
+}
+
+void BgHeavyBlock_Init(Actor* thisx, GlobalContext* globalCtx) {
+ BgHeavyBlock* this = THIS;
+
+ Actor_ProcessInitChain(thisx, sInitChain);
+ ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f);
+ this->pieceFlags = 0;
+
+ if (globalCtx->sceneNum == SCENE_GANON_TOU) {
+ thisx->params &= 0xFF00;
+ thisx->params |= 4;
+ }
+
+ switch (thisx->params & 0xFF) {
+ case HEAVYBLOCK_BIG_PIECE:
+ thisx->draw = BgHeavyBlock_DrawPiece;
+ this->actionFunc = BgHeavyBlock_MovePiece;
+ BgHeavyBlock_InitPiece(this, 1.0f);
+ this->timer = 120;
+ thisx->flags |= 0x10;
+ this->unk_164.y = -50.0f;
+ break;
+ case HEAVYBLOCK_SMALL_PIECE:
+ thisx->draw = BgHeavyBlock_DrawPiece;
+ this->actionFunc = BgHeavyBlock_MovePiece;
+ BgHeavyBlock_InitPiece(this, 2.0f);
+ this->timer = 120;
+ thisx->flags |= 0x10;
+ this->unk_164.y = -20.0f;
+ break;
+ case HEAVYBLOCK_BREAKABLE:
+ BgHeavyBlock_SetupDynapoly(this, globalCtx);
+
+ if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) {
+ Actor_Kill(thisx);
+ return;
+ }
+
+ this->actionFunc = BgHeavyBlock_Wait;
+ break;
+ case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
+ BgHeavyBlock_SetupDynapoly(this, globalCtx);
+
+ if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) {
+ this->actionFunc = BgHeavyBlock_DoNothing;
+ thisx->shape.rot.x = thisx->posRot.rot.x = 0x8AD0;
+ thisx->shape.rot.y = thisx->posRot.rot.y = 0xC000;
+ thisx->shape.rot.z = thisx->posRot.rot.z = 0x0;
+ thisx->posRot.pos.x = 1704.0f;
+ thisx->posRot.pos.y = 1504.0f;
+ thisx->posRot.pos.z = 516.0f;
+ }
+
+ this->actionFunc = BgHeavyBlock_Wait;
+ break;
+ case HEAVYBLOCK_UNBREAKABLE:
+ BgHeavyBlock_SetupDynapoly(this, globalCtx);
+ this->actionFunc = BgHeavyBlock_Wait;
+ break;
+ default:
+ BgHeavyBlock_SetupDynapoly(this, globalCtx);
+ this->actionFunc = BgHeavyBlock_Wait;
+ break;
+ }
+ // "Largest Block Save Bit %x"
+ osSyncPrintf(VT_FGCOL(CYAN) " 最大 ブロック セーブビット %x\n" VT_RST, thisx->params);
+}
+
+void BgHeavyBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ BgHeavyBlock* this = THIS;
+ switch (this->dyna.actor.params & 0xFF) {
+ case HEAVYBLOCK_BIG_PIECE:
+ break;
+ case HEAVYBLOCK_SMALL_PIECE:
+ break;
+ default:
+ DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
+ }
+}
+
+void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ Actor* thisx = &this->dyna.actor;
+
+ thisx->velocity.y += thisx->gravity;
+
+ if (thisx->velocity.y < thisx->minVelocityY) {
+ thisx->velocity.y = thisx->minVelocityY;
+ }
+
+ thisx->velocity.x *= 0.98f;
+ thisx->velocity.z *= 0.98f;
+ func_8002D7EC(thisx);
+ thisx->shape.rot.x += thisx->posRot.rot.x;
+ thisx->shape.rot.y += thisx->posRot.rot.y;
+ thisx->shape.rot.z += thisx->posRot.rot.z;
+
+ if (!(this->pieceFlags & PIECE_FLAG_HIT_FLOOR)) {
+ thisx->posRot.pos.y += this->unk_164.y;
+ thisx->pos4.y += this->unk_164.y;
+ func_8002E4B4(globalCtx, thisx, 50.0f, 50.0f, 0.0f, 5);
+ thisx->posRot.pos.y -= this->unk_164.y;
+ thisx->pos4.y -= this->unk_164.y;
+ if (thisx->bgCheckFlags & 1) {
+ this->pieceFlags |= PIECE_FLAG_HIT_FLOOR;
+ thisx->velocity.y = Math_Rand_ZeroFloat(4.0f) + 2.0f;
+ thisx->velocity.x = Math_Rand_CenteredFloat(8.0f);
+ thisx->velocity.z = Math_Rand_CenteredFloat(8.0f);
+ BgHeavyBlock_SetPieceRandRot(this, 1.0f);
+ Audio_PlayActorSound2(thisx, NA_SE_EV_ROCK_BROKEN);
+ func_800AA000(thisx->xzDistFromLink, 0x96, 0xA, 8);
+ }
+ }
+
+ if (this->timer > 0) {
+ this->timer--;
+ } else {
+ Actor_Kill(thisx);
+ }
+}
+
+void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 posZ, f32 velX, f32 velY, f32 velZ,
+ u8 dustParams) {
+ Color_RGBA8_n primColor;
+ Color_RGBA8_n envColor;
+ Vec3f eye;
+ Vec3f at;
+ s16 sp6E;
+ s16 sp6C;
+ Vec3f accel;
+ Vec3f velocity;
+ Vec3f pos;
+ f32 sp44;
+ s16 scaleStep;
+ s16 scale;
+
+ pos.x = posX;
+ pos.y = posY;
+ pos.z = posZ;
+
+ if (dustParams & 1) {
+ // red dust, landed in fire
+ primColor.r = 150;
+ primColor.g = primColor.b = envColor.g = envColor.b = 0;
+ envColor.r = 80;
+ primColor.a = envColor.a = 0;
+ } else {
+ // brown dust
+ // clang-format off
+ primColor.r = 170; primColor.g = 130; primColor.b = 90; primColor.a = 255;
+ envColor.r = 100; envColor.g = 60; envColor.b = 20; envColor.a = 255;
+ // clang-format on
+ }
+
+ accel.z = 0.0f;
+ accel.x = 0.0f;
+ accel.y = (dustParams & 8) ? 0.0f : 0.5f;
+
+ eye = ACTIVE_CAM->eye;
+ at = ACTIVE_CAM->at;
+
+ scale = 1000;
+ scaleStep = 160;
+
+ switch (dustParams & 6) {
+ case 4:
+ case 6:
+ velocity.x = velX;
+ velocity.y = velY;
+ velocity.z = velZ;
+ scale = 300;
+ scaleStep = 50;
+ break;
+ case 2:
+ sp44 = Math_Rand_ZeroFloat(5.0f) + 5.0f;
+ sp6E = Math_Rand_CenteredFloat(65280.0f);
+
+ velocity.x = (Math_Sins(sp6E) * sp44) + velX;
+ velocity.y = velY;
+ velocity.z = (Math_Coss(sp6E) * sp44) + velZ;
+ break;
+ case 0:
+ sp6E = Math_Vec3f_Yaw(&eye, &at);
+ sp6C = -Math_Vec3f_Pitch(&eye, &at);
+
+ velocity.x = ((5.0f * Math_Sins(sp6E)) * Math_Coss(sp6C)) + velX;
+ velocity.y = (Math_Sins(sp6C) * 5.0f) + velY;
+ velocity.z = ((5.0f * Math_Coss(sp6E)) * Math_Coss(sp6C)) + velZ;
+
+ pos.x -= (velocity.x * 20.0f);
+ pos.y -= (velocity.y * 20.0f);
+ pos.z -= (velocity.z * 20.0f);
+ break;
+ }
+
+ func_8002843C(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, scaleStep,
+ (s32)Math_Rand_ZeroFloat(10.0f) + 20);
+}
+
+void BgHeavyBlock_SpawnPieces(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ s32 i;
+ Vec3f spA4[] = {
+ { 0.0f, 300.0f, -20.0f }, { 50.0f, 200.0f, -20.0f }, { -50.0f, 200.0f, -20.0f },
+ { 0.0f, 100.0f, 30.0f }, { 0.0f, 100.0f, -70.0f }, { 0.0f, 0.0f, -20.0f },
+ };
+ s32 pad;
+ Vec3f pos;
+ f32 sinPitch;
+ f32 cosPitch;
+ f32 sinYaw;
+ f32 cosYaw;
+
+ sinPitch = Math_Sins(this->dyna.actor.posRot.rot.x);
+ cosPitch = Math_Coss(this->dyna.actor.posRot.rot.x);
+ sinYaw = Math_Sins(this->dyna.actor.posRot.rot.y);
+ cosYaw = Math_Coss(this->dyna.actor.posRot.rot.y);
+
+ for (i = 0; i < ARRAY_COUNT(spA4); i++) {
+ pos.z = (spA4[i].y * sinPitch) + (spA4[i].z * cosPitch);
+
+ pos.x = this->dyna.actor.posRot.pos.x + (spA4[i].x * cosYaw) + (sinYaw * pos.z);
+ pos.y = this->dyna.actor.posRot.pos.y + (spA4[i].y * cosPitch) + (-spA4[i].z * sinPitch);
+ pos.z = this->dyna.actor.posRot.pos.z + (spA4[i].x * -sinYaw) + (cosYaw * pos.z);
+
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z,
+ this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, 0, 2);
+ Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_BG_HEAVY_BLOCK, pos.x, pos.y, pos.z,
+ this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, 0, 3);
+
+ BgHeavyBlock_SpawnDust(globalCtx, pos.x, pos.y, pos.z, 0.0f, 0.0f, 0.0f, 0);
+ }
+}
+
+void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ s32 quakeIndex;
+
+ // if attached A is set, start onepointdemo (cutscene) and quake
+ if (func_8002F410(&this->dyna.actor, globalCtx)) {
+ this->timer = 0;
+
+ switch (this->dyna.actor.params & 0xFF) {
+ case HEAVYBLOCK_BREAKABLE:
+ func_800800F8(globalCtx, 0xFB4, 0x10E, &this->dyna.actor, 0);
+ break;
+ case HEAVYBLOCK_UNBREAKABLE:
+ func_800800F8(globalCtx, 0xFB5, 0xDC, &this->dyna.actor, 0);
+ break;
+ case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
+ func_800800F8(globalCtx, 0xFB6, 0xD2, &this->dyna.actor, 0);
+ break;
+ }
+
+ quakeIndex = Quake_Add(ACTIVE_CAM, 3);
+ Quake_SetSpeed(quakeIndex, 25000);
+ Quake_SetQuakeValues(quakeIndex, 1, 1, 5, 0);
+ Quake_SetCountdown(quakeIndex, 10);
+ this->actionFunc = BgHeavyBlock_LiftedUp;
+ }
+}
+
+void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ Player* player = PLAYER;
+ s32 pad;
+ f32 cosYaw;
+ f32 zOffset;
+ f32 sinYaw;
+ f32 xOffset;
+
+ if (this->timer == 11) {
+ func_800AA000(0.0f, 0xFF, 0x14, 0x14);
+ func_8002F7DC(player, NA_SE_PL_PULL_UP_BIGROCK);
+ LOG_STRING("NA_SE_PL_PULL_UP_BIGROCK", "../z_bg_heavy_block.c", 691);
+ }
+
+ if (this->timer < 40) {
+ xOffset = Math_Rand_CenteredFloat(110.0f);
+ sinYaw = Math_Sins(this->dyna.actor.shape.rot.y);
+ zOffset = Math_Rand_CenteredFloat(110.0f);
+ cosYaw = Math_Coss(this->dyna.actor.shape.rot.y);
+
+ BgHeavyBlock_SpawnDust(globalCtx, (sinYaw * -70.0f) + (this->dyna.actor.posRot.pos.x + xOffset),
+ this->dyna.actor.posRot.pos.y + 10.0f,
+ (cosYaw * -70.0f) + (this->dyna.actor.posRot.pos.z + zOffset), 0.0f, -1.0f, 0.0f, 0xC);
+ }
+
+ this->timer++;
+
+ func_8002DF54(globalCtx, player, 8);
+
+ // if attachedA is NULL, link threw it
+ if (func_8002F5A0(&this->dyna.actor, globalCtx)) {
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HEAVY_THROW);
+ this->actionFunc = BgHeavyBlock_Fly;
+ }
+}
+
+void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ UNK_PTR arg2;
+ s32 quakeIndex;
+ Vec3f pos;
+ f32 raycastResult;
+
+ Actor_MoveForward(&this->dyna.actor);
+ pos.x = this->dyna.actor.initPosRot.pos.x;
+ pos.y = this->dyna.actor.initPosRot.pos.y + 1000.0f;
+ pos.z = this->dyna.actor.initPosRot.pos.z;
+ raycastResult = func_8003C9A4(&globalCtx->colCtx, &this->dyna.actor.floorPoly, &arg2, &this->dyna.actor, &pos);
+ this->dyna.actor.groundY = raycastResult;
+
+ if (this->dyna.actor.initPosRot.pos.y <= raycastResult) {
+ func_800AA000(0.0f, 0xFF, 0x3C, 4);
+
+ switch (this->dyna.actor.params & 0xFF) {
+ case HEAVYBLOCK_BREAKABLE:
+ BgHeavyBlock_SpawnPieces(this, globalCtx);
+ Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
+ Actor_Kill(&this->dyna.actor);
+
+ quakeIndex = Quake_Add(ACTIVE_CAM, 3);
+ Quake_SetSpeed(quakeIndex, 28000);
+ Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
+ Quake_SetCountdown(quakeIndex, 30);
+
+ quakeIndex = Quake_Add(ACTIVE_CAM, 2);
+ Quake_SetSpeed(quakeIndex, 12000);
+ Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 999);
+
+ Audio_PlaySoundAtPosition(globalCtx, &this->dyna.actor.posRot.pos, 30, NA_SE_EV_ELECTRIC_EXPLOSION);
+ return;
+ case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
+
+ quakeIndex = Quake_Add(ACTIVE_CAM, 3);
+ Quake_SetSpeed(quakeIndex, 28000);
+ Quake_SetQuakeValues(quakeIndex, 16, 2, 120, 0);
+ Quake_SetCountdown(quakeIndex, 40);
+
+ this->actionFunc = BgHeavyBlock_Land;
+ Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
+ break;
+ case HEAVYBLOCK_UNBREAKABLE:
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
+
+ quakeIndex = Quake_Add(ACTIVE_CAM, 3);
+ Quake_SetSpeed(quakeIndex, 28000);
+ Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
+ Quake_SetCountdown(quakeIndex, 40);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80883998.s")
+ this->actionFunc = BgHeavyBlock_Land;
+ break;
+ default:
+ quakeIndex = Quake_Add(ACTIVE_CAM, 3);
+ Quake_SetSpeed(quakeIndex, 28000);
+ Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
+ Quake_SetCountdown(quakeIndex, 40);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/BgHeavyBlock_Init.s")
+ this->actionFunc = BgHeavyBlock_Land;
+ }
+ }
+ this->dyna.actor.shape.rot.x = atan2s(this->dyna.actor.velocity.y, this->dyna.actor.speedXZ);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/BgHeavyBlock_Destroy.s")
+void BgHeavyBlock_DoNothing(BgHeavyBlock* this, GlobalContext* globalCtx) {
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80883C90.s")
+void BgHeavyBlock_Land(BgHeavyBlock* this, GlobalContext* globalCtx) {
+ s32 pad;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80883E54.s")
+ if (Math_SmoothScaleMaxMinS(&this->dyna.actor.shape.rot.x, 0x8AD0, 6, 2000, 100) != 0) {
+ Math_ApproxF(&this->dyna.actor.speedXZ, 0.0f, 20.0f);
+ Math_ApproxF(&this->dyna.actor.velocity.y, 0.0f, 3.0f);
+ this->dyna.actor.gravity = 0.0f;
+ this->dyna.actor.posRot.pos = this->dyna.actor.initPosRot.pos;
+ Actor_MoveForward(&this->dyna.actor);
+ this->dyna.actor.initPosRot.pos = this->dyna.actor.posRot.pos;
+ switch (this->dyna.actor.params & 0xFF) {
+ case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
+ BgHeavyBlock_SpawnDust(globalCtx, Math_Rand_CenteredFloat(30.0f) + 1678.0f,
+ Math_Rand_ZeroFloat(100.0f) + 1286.0f, Math_Rand_CenteredFloat(30.0f) + 552.0f,
+ 0.0f, 0.0f, 0.0f, 0);
+ BgHeavyBlock_SpawnDust(globalCtx, Math_Rand_CenteredFloat(30.0f) + 1729.0f,
+ Math_Rand_ZeroFloat(80.0f) + 1269.0f, Math_Rand_CenteredFloat(30.0f) + 600.0f,
+ 0.0f, 0.0f, 0.0f, 0);
+ break;
+ case HEAVYBLOCK_UNBREAKABLE:
+ BgHeavyBlock_SpawnDust(globalCtx, Math_Rand_CenteredFloat(100.0f) + -735.0f, 29.0f,
+ Math_Rand_CenteredFloat(100.0f) + -3418.0f, 0.0f, 0.0f, 0.0f, 3);
+ break;
+ }
+ } else {
+ this->dyna.actor.flags &= ~0x30;
+ this->actionFunc = BgHeavyBlock_DoNothing;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_808841B8.s")
+void BgHeavyBlock_Update(Actor* thisx, GlobalContext* globalCtx) {
+ BgHeavyBlock* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_808843B0.s")
+ this->actionFunc(this, globalCtx);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_808844D0.s")
+void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ static Vec3f D_80884EC8 = { 0.0f, 0.0f, 0.0f };
+ static Vec3f D_80884ED4 = { 0.0f, 400.0f, 0.0f };
+ BgHeavyBlock* this = THIS;
+ s32 pad;
+ Player* player = PLAYER;
+ GraphicsContext* gfxCtx;
+ Gfx* dispRefs[4];
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80884658.s")
+ gfxCtx = globalCtx->state.gfxCtx;
+ Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_8088496C.s")
+ if (BgHeavyBlock_LiftedUp == this->actionFunc) {
+ func_800D1694(player->unk_3B0.x, player->unk_3B0.y, player->unk_3B0.z, &thisx->shape.rot);
+ Matrix_Translate(-this->unk_164.x, -this->unk_164.y, -this->unk_164.z, MTXMODE_APPLY);
+ } else if ((thisx->gravity == 0.0f) && (BgHeavyBlock_Land == this->actionFunc)) {
+ func_800D1694(thisx->initPosRot.pos.x, thisx->initPosRot.pos.y, thisx->initPosRot.pos.z, &thisx->shape.rot);
+ Matrix_Translate(-D_80884ED4.x, -D_80884ED4.y, -D_80884ED4.z, MTXMODE_APPLY);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80884978.s")
+ Matrix_MultVec3f(&D_80884EC8, &thisx->posRot);
+ Matrix_MultVec3f(&D_80884ED4, &thisx->initPosRot);
+ func_80093D18(globalCtx->state.gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/BgHeavyBlock_Update.s")
+ gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 931),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(gfxCtx->polyOpa.p++, D_060013C0);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/BgHeavyBlock_Draw.s")
+ Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 935);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Heavy_Block/func_80884DB4.s")
+void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx) {
+ switch (thisx->params & 0xFF) {
+ case HEAVYBLOCK_BIG_PIECE:
+ Matrix_Translate(50.0f, -260.0f, -20.0f, MTXMODE_APPLY);
+ Gfx_DrawDListOpa(globalCtx, D_060018A0);
+ break;
+ case HEAVYBLOCK_SMALL_PIECE:
+ Matrix_Translate(45.0f, -280.0f, -5.0f, MTXMODE_APPLY);
+ Gfx_DrawDListOpa(globalCtx, D_06001A30);
+ break;
+ }
+}
diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h
index 179c48b5e..1dbdde633 100644
--- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h
+++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h
@@ -6,11 +6,24 @@
struct BgHeavyBlock;
+typedef void (*BgHeavyBlockActionFunc)(struct BgHeavyBlock*, GlobalContext*);
+
typedef struct BgHeavyBlock {
- /* 0x0000 */ Actor actor;
- /* 0x014C */ char unk_14C[0x2C];
+ /* 0x0000 */ DynaPolyActor dyna;
+ /* 0x0164 */ Vec3f unk_164;
+ /* 0x0170 */ s16 timer;
+ /* 0x0172 */ u16 pieceFlags;
+ /* 0x0174 */ BgHeavyBlockActionFunc actionFunc;
} BgHeavyBlock; // size = 0x0178
+typedef enum {
+ /* 0x00 */ HEAVYBLOCK_UNBREAKABLE,
+ /* 0x01 */ HEAVYBLOCK_BREAKABLE,
+ /* 0x02 */ HEAVYBLOCK_BIG_PIECE,
+ /* 0x03 */ HEAVYBLOCK_SMALL_PIECE,
+ /* 0x04 */ HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE
+} HeavyBlockType;
+
extern const ActorInit Bg_Heavy_Block_InitVars;
#endif
diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
index d1f34f64e..bc7db716f 100644
--- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
+++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
@@ -22,6 +22,7 @@ const ActorInit Eff_Dust_InitVars = {
(ActorFunc)EffDust_Draw,
};
*/
+
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Eff_Dust/func_8099D8D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Eff_Dust/func_8099D8D8.s")
diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c
index e4bce5c72..21ead1029 100644
--- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c
+++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c
@@ -13,7 +13,6 @@
#define SPAWN_INVISIBLE 0x8000
#define SPAWN_SMALL 0x10
-// Merge params
#define MERGE_MASTER 0x40
#define MERGE_SLAVE 0x20
@@ -77,38 +76,10 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(gravity, 0xFC18, ICHAIN_STOP),
};
-static Vec3f D_80A1A4D0 = {
- 0.0f,
- 0.0f,
- 0.0f,
-};
-
-static Vec3f D_80A1A4DC = {
- 0.0f,
- 0.0f,
- 0.0f,
-};
-
-static Vec3f sDustPos = {
- 0.0f,
- 0.0f,
- 0.0f,
-};
-
-static Color_RGBA8 sMergeColor = {
- 0,
- 255,
- 0,
- 0,
-};
-
-// display lists
extern Gfx D_06008688[];
-// skeleton
extern SkeletonHeader D_06008FB0;
-// animations
extern AnimationHeader D_06009DB0;
extern AnimationHeader D_060039B0;
extern AnimationHeader D_06000EA4;
@@ -314,6 +285,8 @@ void EnFloormas_SetupSmDecideAction(EnFloormas* this) {
}
void EnFloormas_SetupSmShrink(EnFloormas* this, GlobalContext* globalCtx) {
+ static Vec3f D_80A1A4D0 = { 0.0f, 0.0f, 0.0f };
+ static Vec3f D_80A1A4DC = { 0.0f, 0.0f, 0.0f };
Vec3f pos;
this->actor.speedXZ = 0.0f;
@@ -558,25 +531,24 @@ void EnFloormas_Hover(EnFloormas* this, GlobalContext* globalCtx) {
}
void EnFloormas_Slide(EnFloormas* this, GlobalContext* globalCtx) {
+ static Vec3f accel = { 0.0f, 0.0f, 0.0f };
Vec3f pos;
- Vec3f pos2;
+ Vec3f velocity;
pos.x = this->actor.posRot.pos.x;
pos.z = this->actor.posRot.pos.z;
pos.y = this->actor.groundY;
- pos2.y = 2.0f;
- pos2.x = Math_Sins(this->actor.shape.rot.y + 0x6000) * 7.0f;
- pos2.z = Math_Coss(this->actor.shape.rot.y + 0x6000) * 7.0f;
+ velocity.y = 2.0f;
+ velocity.x = Math_Sins(this->actor.shape.rot.y + 0x6000) * 7.0f;
+ velocity.z = Math_Coss(this->actor.shape.rot.y + 0x6000) * 7.0f;
- // create dust particle
- func_800286CC(globalCtx, &pos, &pos2, &sDustPos, 0x1C2, 0x64);
+ func_800286CC(globalCtx, &pos, &velocity, &accel, 450, 100);
- pos2.x = Math_Sins(this->actor.shape.rot.y - 0x6000) * 7.0f;
- pos2.z = Math_Coss(this->actor.shape.rot.y - 0x6000) * 7.0f;
+ velocity.x = Math_Sins(this->actor.shape.rot.y - 0x6000) * 7.0f;
+ velocity.z = Math_Coss(this->actor.shape.rot.y - 0x6000) * 7.0f;
- // create dust particle
- func_800286CC(globalCtx, &pos, &pos2, &sDustPos, 0x1C2, 0x64);
+ func_800286CC(globalCtx, &pos, &velocity, &accel, 450, 100);
func_8002F974(this, NA_SE_EN_FLOORMASTER_SLIDING);
}
@@ -1099,6 +1071,8 @@ void EnFloormas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
}
}
+static Color_RGBA8 sMergeColor = { 0x00, 0xFF, 0x00, 0x00 };
+
void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnFloormas* this = THIS;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c
index bc871a32e..b036a525b 100644
--- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c
+++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c
@@ -76,8 +76,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(gravity, 0xFA24, 0),
};
-static Vec3f D_80B30D70 = { 0.0f, 0.0f, 0.0f };
-
extern AnimationHeader D_06000EA4;
extern AnimationHeader D_06000590;
extern AnimationHeader D_0600299C;
@@ -217,6 +215,7 @@ void EnWallmas_SetupCooldown(EnWallmas* this) {
}
void EnWallmas_SetupDie(EnWallmas* this, GlobalContext* globalCtx) {
+ static Vec3f D_80B30D70 = { 0.0f, 0.0f, 0.0f };
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c
index 497360c13..e570a4fe6 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c
@@ -1,10 +1,197 @@
-#include <ultra64.h>
-#include <global.h>
+/*
+ * File: z_eff_ss_dust.c
+ * Overlay: ovl_Effect_Ss_Dust
+ * Description: Dust Particle Effect
+ */
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dust/func_809A22D0.s")
+#include "z_eff_ss_dust.h"
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dust/func_809A2480.s")
+typedef enum {
+ /* 0x00 */ SS_DUST_PRIM_R,
+ /* 0x01 */ SS_DUST_PRIM_G,
+ /* 0x02 */ SS_DUST_PRIM_B,
+ /* 0x03 */ SS_DUST_PRIM_A,
+ /* 0x04 */ SS_DUST_ENV_R,
+ /* 0x05 */ SS_DUST_ENV_G,
+ /* 0x06 */ SS_DUST_ENV_B,
+ /* 0x07 */ SS_DUST_ENV_A,
+ /* 0x08 */ SS_DUST_TEX_IDX, // this reg is also used to set specific colors in the fire update function
+ /* 0x09 */ SS_DUST_SCALE,
+ /* 0x0A */ SS_DUST_SCALE_STEP,
+ /* 0x0B */ SS_DUST_DRAW_FLAGS,
+ /* 0x0C */ SS_DUST_LIFE_START
+} EffectSsDustRegs;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dust/func_809A27F0.s")
+u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
+void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
+void EffectSsBlast_UpdateFire(GlobalContext* globalCtx, u32 index, EffectSs* this);
+void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dust/func_809A28EC.s")
+EffectSsInit Effect_Ss_Dust_InitVars = {
+ EFFECT_SS_DUST,
+ EffectSsDust_Init,
+};
+
+static void* sUpdateFuncs[] = { EffectSsDust_Update, EffectSsBlast_UpdateFire };
+
+UNK_PTR D_809A2A50[] = {
+ 0x04051DB0, 0x040521B0, 0x040525B0, 0x040529B0, 0x04052DB0, 0x040531B0, 0x040535B0, 0x040539B0
+};
+
+extern Gfx D_04010050[];
+
+u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
+ s32 randColorOffset;
+ EffectSsDustInitParams* initParams = (EffectSsDustInitParams*)initParamsx;
+
+ Math_Vec3f_Copy(&this->pos, &initParams->pos);
+ Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
+ Math_Vec3f_Copy(&this->accel, &initParams->accel);
+ this->unk_38 = SEGMENTED_TO_VIRTUAL(&D_04010050);
+ this->life = initParams->life;
+ this->update = sUpdateFuncs[initParams->updateMode];
+ this->draw = EffectSsDust_Draw;
+
+ if (initParams->drawFlags & 4) {
+ randColorOffset = Math_Rand_ZeroOne() * 20.0f - 10.0f;
+ this->regs[SS_DUST_PRIM_R] = initParams->primColor.r + randColorOffset;
+ this->regs[SS_DUST_PRIM_G] = initParams->primColor.g + randColorOffset;
+ this->regs[SS_DUST_PRIM_B] = initParams->primColor.b + randColorOffset;
+ this->regs[SS_DUST_ENV_R] = initParams->envColor.r + randColorOffset;
+ this->regs[SS_DUST_ENV_G] = initParams->envColor.g + randColorOffset;
+ this->regs[SS_DUST_ENV_B] = initParams->envColor.b + randColorOffset;
+ } else {
+ this->regs[SS_DUST_PRIM_R] = initParams->primColor.r;
+ this->regs[SS_DUST_PRIM_G] = initParams->primColor.g;
+ this->regs[SS_DUST_PRIM_B] = initParams->primColor.b;
+ this->regs[SS_DUST_ENV_R] = initParams->envColor.r;
+ this->regs[SS_DUST_ENV_G] = initParams->envColor.g;
+ this->regs[SS_DUST_ENV_B] = initParams->envColor.b;
+ }
+
+ this->regs[SS_DUST_PRIM_A] = initParams->primColor.a;
+ this->regs[SS_DUST_ENV_A] = initParams->envColor.a;
+ this->regs[SS_DUST_TEX_IDX] = 0;
+ this->regs[SS_DUST_SCALE] = initParams->scale;
+ this->regs[SS_DUST_SCALE_STEP] = initParams->scaleStep;
+ this->regs[SS_DUST_LIFE_START] = initParams->life;
+ this->regs[SS_DUST_DRAW_FLAGS] = initParams->drawFlags;
+
+ return 1;
+}
+
+void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
+ s32 pad;
+ MtxF sp144;
+ MtxF sp104;
+ MtxF spC4;
+ MtxF sp84;
+ s32 pad1;
+ Mtx* mtx;
+ f32 scale;
+ GraphicsContext* gfxCtx;
+ Gfx* dispRefs[4];
+
+ gfxCtx = globalCtx->state.gfxCtx;
+ Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_ss_dust.c", 321);
+
+ scale = this->regs[SS_DUST_SCALE] * 0.0025f;
+
+ func_800A7A24(&sp144, this->pos.x, this->pos.y, this->pos.z);
+ func_800A76A4(&sp104, scale, scale, 1.0f);
+ func_800A6FA0(&sp144, &globalCtx->mf_11DA0, &sp84);
+ func_800A6FA0(&sp84, &sp104, &spC4);
+
+ gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ mtx = func_800A7E70(gfxCtx, &spC4);
+
+ if (mtx != NULL) {
+ gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gDPPipeSync(gfxCtx->polyXlu.p++);
+ gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809A2A50[this->regs[SS_DUST_TEX_IDX]]));
+ gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0);
+ gDPPipeSync(gfxCtx->polyXlu.p++);
+
+ if (this->regs[SS_DUST_DRAW_FLAGS] & 1) {
+ gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0,
+ COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED);
+ gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2);
+ gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_FOG | G_LIGHTING);
+ } else if (this->regs[SS_DUST_DRAW_FLAGS] & 2) {
+ gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2);
+ gSPClearGeometryMode(gfxCtx->polyXlu.p++, G_FOG | G_LIGHTING);
+ } else {
+ gSPClearGeometryMode(gfxCtx->polyXlu.p++, G_LIGHTING);
+ }
+
+ gDPPipeSync(gfxCtx->polyXlu.p++);
+ gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_DUST_PRIM_R], this->regs[SS_DUST_PRIM_G],
+ this->regs[SS_DUST_PRIM_B], 255);
+ gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_DUST_ENV_R], this->regs[SS_DUST_ENV_G],
+ this->regs[SS_DUST_ENV_B], this->regs[SS_DUST_ENV_A]);
+ gSPDisplayList(gfxCtx->polyXlu.p++, this->unk_38);
+ }
+
+ Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_ss_dust.c", 389);
+}
+
+void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
+ this->accel.x = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
+ this->accel.z = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
+
+ if ((this->regs[SS_DUST_LIFE_START] >= this->life) && (this->life >= (this->regs[SS_DUST_LIFE_START] - 7))) {
+ if (this->regs[SS_DUST_LIFE_START] >= 5) {
+ this->regs[SS_DUST_TEX_IDX] = this->regs[SS_DUST_LIFE_START] - this->life;
+ } else {
+ this->regs[SS_DUST_TEX_IDX] =
+ ((this->regs[SS_DUST_LIFE_START] - this->life) * (8 / this->regs[SS_DUST_LIFE_START]));
+ }
+ } else {
+ this->regs[SS_DUST_TEX_IDX] = 7;
+ }
+ this->regs[SS_DUST_SCALE] += this->regs[SS_DUST_SCALE_STEP];
+}
+
+// this update mode is unused in the original game
+void EffectSsBlast_UpdateFire(GlobalContext* globalCtx, u32 index, EffectSs* this) {
+ this->accel.x = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
+ this->accel.z = (Math_Rand_ZeroOne() * 0.4f) - 0.2f;
+
+ switch (this->regs[SS_DUST_TEX_IDX]) {
+ case 0:
+ this->regs[SS_DUST_PRIM_R] = 255;
+ this->regs[SS_DUST_PRIM_G] = 150;
+ this->regs[SS_DUST_PRIM_B] = 0;
+ this->regs[SS_DUST_ENV_R] = 150;
+ this->regs[SS_DUST_ENV_G] = 50;
+ this->regs[SS_DUST_ENV_B] = 0;
+ break;
+ case 1:
+ this->regs[SS_DUST_PRIM_R] = 200;
+ this->regs[SS_DUST_PRIM_G] = 50;
+ this->regs[SS_DUST_PRIM_B] = 0;
+ this->regs[SS_DUST_ENV_R] = 100;
+ this->regs[SS_DUST_ENV_G] = 0;
+ this->regs[SS_DUST_ENV_B] = 0;
+ break;
+ case 2:
+ this->regs[SS_DUST_PRIM_R] = 50;
+ this->regs[SS_DUST_PRIM_G] = 0;
+ this->regs[SS_DUST_PRIM_B] = 0;
+ this->regs[SS_DUST_ENV_R] = 0;
+ this->regs[SS_DUST_ENV_G] = 0;
+ this->regs[SS_DUST_ENV_B] = 0;
+ break;
+ case 3:
+ this->regs[SS_DUST_PRIM_R] = 50;
+ this->regs[SS_DUST_ENV_R] = this->regs[SS_DUST_PRIM_G] = this->regs[SS_DUST_ENV_G] =
+ this->regs[SS_DUST_PRIM_B] = this->regs[SS_DUST_ENV_B] = 0;
+ break;
+ }
+
+ if (this->regs[SS_DUST_TEX_IDX] < 7) {
+ this->regs[SS_DUST_TEX_IDX]++;
+ }
+
+ this->regs[SS_DUST_SCALE] += this->regs[SS_DUST_SCALE_STEP];
+}
diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h
new file mode 100644
index 000000000..56ebf3d8c
--- /dev/null
+++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h
@@ -0,0 +1,20 @@
+#ifndef _Z_EFF_SS_DUST_H_
+#define _Z_EFF_SS_DUST_H_
+
+#include <ultra64.h>
+#include <global.h>
+
+typedef struct {
+ /* 0x00 */ Vec3f pos;
+ /* 0x0C */ Vec3f velocity;
+ /* 0x18 */ Vec3f accel;
+ /* 0x24 */ Color_RGBA8_n primColor;
+ /* 0x28 */ Color_RGBA8_n envColor;
+ /* 0x2C */ s16 scale;
+ /* 0x2E */ s16 scaleStep;
+ /* 0x30 */ s16 life;
+ /* 0x32 */ u16 drawFlags;
+ /* 0x34 */ u8 updateMode;
+} EffectSsDustInitParams; // size = 0x38
+
+#endif