summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2021-08-08 13:28:28 +0200
committerGitHub <noreply@github.com>2021-08-08 07:28:28 -0400
commit9455c885f850f0ea728995199026f6765695f524 (patch)
tree2aaf81a3b432bb83c370d69c7e5b623d3efbabed /src/code
parentca2ea1ce2ddecc410d2967dbf81dc28aceefc50d (diff)
EnMb documented (Moblins) (#861)
* Document Moblins (EnMb) * Use actual decomp-style function names * Add renamed functions to actorfixer.py * Add general documentation and add EnMbType enum to check moblin subtype * Add fig's doc comment on Actor_TestFloorInDirection * Revert documentation on z_eff_ss_dead.c * remove `gSPFogPosition(?,?)` comments on `gSPFogFactor` uses in z_rcp.c * run formatter
Diffstat (limited to 'src/code')
-rw-r--r--src/code/audio_seqplayer.c8
-rw-r--r--src/code/z_actor.c71
-rw-r--r--src/code/z_rcp.c12
3 files changed, 51 insertions, 40 deletions
diff --git a/src/code/audio_seqplayer.c b/src/code/audio_seqplayer.c
index 5214ac33e..7f86f0bc1 100644
--- a/src/code/audio_seqplayer.c
+++ b/src/code/audio_seqplayer.c
@@ -1410,15 +1410,15 @@ void Audio_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x10:
if (lowBits < 8) {
channel->soundScriptIO[lowBits] = -1;
- if (Audio_SyncLoadSample(channel->bankId, scriptState->value, &channel->soundScriptIO[lowBits]) ==
- -1) {
+ if (Audio_SyncLoadSample(channel->bankId, scriptState->value,
+ &channel->soundScriptIO[lowBits]) == -1) {
break;
}
} else {
lowBits -= 8;
channel->soundScriptIO[lowBits] = -1;
- if (Audio_SyncLoadSample(channel->bankId, channel->unk_22 + 0x100, &channel->soundScriptIO[lowBits]) ==
- -1) {
+ if (Audio_SyncLoadSample(channel->bankId, channel->unk_22 + 0x100,
+ &channel->soundScriptIO[lowBits]) == -1) {
break;
}
}
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 37613baf4..6f275987c 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -2212,20 +2212,20 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
gSPSegment(POLY_XLU_DISP++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment);
if (actor->colorFilterTimer != 0) {
- Color_RGBA8 sp2C = { 0, 0, 0, 255 };
+ Color_RGBA8 color = { 0, 0, 0, 255 };
if (actor->colorFilterParams & 0x8000) {
- sp2C.r = sp2C.g = sp2C.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
+ color.r = color.g = color.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
} else if (actor->colorFilterParams & 0x4000) {
- sp2C.r = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
+ color.r = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
} else {
- sp2C.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
+ color.b = ((actor->colorFilterParams & 0x1F00) >> 5) | 7;
}
if (actor->colorFilterParams & 0x2000) {
- func_80026860(globalCtx, &sp2C, actor->colorFilterTimer, actor->colorFilterParams & 0xFF);
+ func_80026860(globalCtx, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF);
} else {
- func_80026400(globalCtx, &sp2C, actor->colorFilterTimer, actor->colorFilterParams & 0xFF);
+ func_80026400(globalCtx, &color, actor->colorFilterTimer, actor->colorFilterParams & 0xFF);
}
}
@@ -3167,33 +3167,35 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob
return true;
}
-void Actor_SpawnFloorDust(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, s32 arg4, f32 randAccelWeight,
- s16 scale, s16 scaleStep, u8 arg8) {
+void Actor_SpawnFloorDustRing(GlobalContext* globalCtx, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne,
+ f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting) {
Vec3f pos;
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3f accel = { 0.0f, 0.3f, 0.0f };
- f32 var;
+ f32 angle;
s32 i;
- var = (Rand_ZeroOne() - 0.5f) * 6.28f;
+ angle = (Rand_ZeroOne() - 0.5f) * (2.0f * 3.14f);
pos.y = actor->floorHeight;
accel.y += (Rand_ZeroOne() - 0.5f) * 0.2f;
- for (i = arg4; i >= 0; i--) {
- pos.x = (Math_SinF(var) * arg3) + arg2->x;
- pos.z = (Math_CosF(var) * arg3) + arg2->z;
+ for (i = amountMinusOne; i >= 0; i--) {
+ pos.x = Math_SinF(angle) * radius + posXZ->x;
+ pos.z = Math_CosF(angle) * radius + posXZ->z;
accel.x = (Rand_ZeroOne() - 0.5f) * randAccelWeight;
accel.z = (Rand_ZeroOne() - 0.5f) * randAccelWeight;
if (scale == 0) {
func_8002857C(globalCtx, &pos, &velocity, &accel);
- } else if (arg8 != 0) {
- func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
} else {
- func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
+ if (useLighting) {
+ func_800286CC(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
+ } else {
+ func_8002865C(globalCtx, &pos, &velocity, &accel, scale, scaleStep);
+ }
}
- var += 6.28f / (arg4 + 1.0f);
+ angle += (2.0f * 3.14f) / (amountMinusOne + 1.0f);
}
}
@@ -3388,24 +3390,33 @@ void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTex
actor->textId = prefix | baseTextId;
}
-s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) {
+/**
+ * Checks if a given actor will be standing on the ground after being translated
+ * by the provided distance and angle.
+ *
+ * Returns true if the actor will be standing on ground.
+ */
+s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 distance, s16 angle) {
s16 ret;
- s16 sp44;
- f32 sp40;
- f32 sp3C;
- Vec3f sp30;
+ s16 prevBgCheckFlags;
+ f32 dx;
+ f32 dz;
+ Vec3f prevActorPos;
+
+ Math_Vec3f_Copy(&prevActorPos, &actor->world.pos);
+ prevBgCheckFlags = actor->bgCheckFlags;
+
+ dx = Math_SinS(angle) * distance;
+ dz = Math_CosS(angle) * distance;
+ actor->world.pos.x += dx;
+ actor->world.pos.z += dz;
- Math_Vec3f_Copy(&sp30, &actor->world.pos);
- sp44 = actor->bgCheckFlags;
- sp40 = Math_SinS(arg3) * arg2;
- sp3C = Math_CosS(arg3) * arg2;
- actor->world.pos.x += sp40;
- actor->world.pos.z += sp3C;
Actor_UpdateBgCheckInfo(globalCtx, actor, 0.0f, 0.0f, 0.0f, 4);
- Math_Vec3f_Copy(&actor->world.pos, &sp30);
+
+ Math_Vec3f_Copy(&actor->world.pos, &prevActorPos);
ret = actor->bgCheckFlags & 1;
- actor->bgCheckFlags = sp44;
+ actor->bgCheckFlags = prevBgCheckFlags;
return ret;
}
diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c
index c7385c0f0..53e5e8efc 100644
--- a/src/code/z_rcp.c
+++ b/src/code/z_rcp.c
@@ -782,11 +782,11 @@ Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
gDPSetFogColor(gfx++, r, g, b, a);
if (n >= 1000) {
- gSPFogFactor(gfx++, 0, 0); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(gfx++, 0, 0);
} else if (n >= 997) {
- gSPFogFactor(gfx++, 0x7FFF, 0x8100); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(gfx++, 0x7FFF, 0x8100);
} else if (n < 0) {
- gSPFogFactor(gfx++, 0, 255); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(gfx++, 0, 255);
} else {
gSPFogPosition(gfx++, n, f);
}
@@ -804,11 +804,11 @@ Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
gDPSetFogColor(gfx++, r, g, b, a);
if (n >= 1000) {
- gSPFogFactor(gfx++, 0, 0); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(gfx++, 0, 0);
} else if (n >= 997) {
- gSPFogFactor(gfx++, 0x7FFF, 0x8100); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(gfx++, 0x7FFF, 0x8100);
} else if (n < 0) {
- gSPFogFactor(gfx++, 0, 255); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(gfx++, 0, 255);
} else {
gSPFogPosition(gfx++, n, f);
}