Labeling particle related code (#719)

* Labeling particle related code

* More labeling. Naming pass on what was labeled last commit

* Stick X clamped with deadzone

* Renaming TyreParticle to Particle

* Matching coco's names and renaming some already labeled to keep style consistent

* Minor extra particle labeling

* Small extra labeling. Restoring some removed newlines

* One last newline adjustment

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
ZackWeinstein
2025-06-21 14:59:32 -04:00
committed by GitHub
parent 184f5939f2
commit d6076b5cb7
9 changed files with 1447 additions and 1445 deletions
+1290 -1289
View File
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -117,15 +117,15 @@ void func_8005D1F4(s32);
void func_8005D290(void);
void func_8005D6C0(Player*);
void func_8005D794(Player*, UnkPlayerStruct258*, f32, f32, f32, s8, s8);
s32 func_8005D7D8(UnkPlayerStruct258*, s8, f32);
s32 func_8005D800(UnkPlayerStruct258*, s32, s16);
s32 func_8005D82C(UnkPlayerStruct258*, s32, s16);
void func_8005D898(Player*, s16, s32, s8, s8);
void func_8005DA30(Player*, s16, s32, s8, s8);
void set_particle_position_and_rotation(Player*, Particle*, f32, f32, f32, s8, s8);
s32 init_new_particle_player(Particle*, s8, f32);
s32 set_particle_colour(Particle*, s32, s16);
s32 set_particle_colour_randomly_varried(Particle*, s32, s16);
void set_drift_particles(Player*, s16, s32, s8, s8);
void check_drift_particles_setup_valid(Player*, s16, s32, s8, s8);
void func_8005DAD0(void);
void func_8005DAD8(UnkPlayerStruct258*, s16, s16, s16);
void func_8005DAF4(Player*, s16, s32, s8, s8);
void func_8005DAD8(Particle*, s16, s16, s16);
void setup_tyre_particles(Player*, s16, s32, s8, s8);
void func_8005EA94(Player*, s16, s32, s8, s8);
void func_8005ED48(Player*, s16, s32, s8, s8);
@@ -150,7 +150,7 @@ void func_80061D4C(Player*, s16, s32, s8, s8);
void func_80061EF4(Player*, s16, s32, s8, s8);
void func_800621BC(Player*, s16, s32, s8, s8);
void func_80062484(Player*, UnkPlayerStruct258*, s32);
void func_80062484(Player*, Particle*, s32);
void func_800624D8(Player*, s32, s32, s8, s8);
void func_800628C0(Player*, s8, s8, s8);
void func_80062914(Player*, s8, s8, s8);
@@ -162,7 +162,7 @@ void func_80062B18(f32*, f32*, f32*, f32, f32, f32, u16, u16);
void func_80062C74(Player*, s16, s32, s32);
void func_80062F98(Player*, s16, s8, s8);
void func_800630C0(Player*, s16, s8, s8);
void set_oob_splash_particle_position(Player*, s16, s8, s8);
void func_800631A8(Player*, s16, s8, s8);
void func_80063268(Player*, s16, s8, s8);
void func_80063408(Player*, s16, s8, s8);
@@ -200,19 +200,19 @@ void func_80066998(Player*, s8, s16, s8);
void func_80066BAC(Player*, s8, s16, s8);
void func_80067280(Player*, s8, s16, s8);
void func_80067604(Player*, s8, s16, s8);
void func_80067964(Player*, s8, f32, s8, s8);
void func_80067D3C(Player*, s8, u8*, s8, f32, s32);
void render_player_boost_spark_particles(Player*, s8, s16, s8);
void render_player_onomatopoeia_whrrrr(Player*, s8, f32, s8, s8);
void render_player_speech_bubble(Player*, s8, u8*, s8, f32, s32);
void func_8006801C(Player*, s8, u8*, s8, f32, s32);
void render_music_note(Player*, s8, u8*, s8, f32, s32);
void func_80068310(Player*, s8, f32, s8, s8);
void func_80068724(Player*, s8, f32, s8, s8);
void func_80068AA4(Player*, s8, f32, s8, s8);
void func_80068DA0(Player*, s8, f32, s8, s8);
void render_player_onomatopoeia_boing(Player*, s8, f32, s8, s8);
void render_player_onomatopoeia_pomp(Player*, s8, f32, s8, s8);
void func_800691B8(Player*, s8, s16, s8);
void render_actor_bonk_particles(Player*, s8, s16, s8);
void func_80069444(Player*, s8, s16, s8);
void func_800696CC(Player*, s8, s16, s8, f32);
void render_wall_bonk_star_particles(Player*, s8, s16, s8, f32);
void func_80069938(Player*, s8, s16, s8);
void func_80069BA8(Player*, s8, s16, s8);
void func_80069DB8(Player*, s8, s16, s8);
+27 -27
View File
@@ -1467,9 +1467,9 @@ void apply_boo_sound_effect(Player* player, s8 playerIndex) {
player->unk_044 |= 0x200;
for (temp_v1 = 0; temp_v1 < 10; ++temp_v1) {
player->unk_258[temp_v1].unk_01C = 0;
player->unk_258[temp_v1].unk_01E = 0;
player->unk_258[temp_v1].unk_012 = 0;
player->particles[temp_v1].IsAlive = 0;
player->particles[temp_v1].timer = 0;
player->particles[temp_v1].type = 0;
}
}
@@ -1548,9 +1548,9 @@ void func_8008FD4C(Player* player, UNUSED s8 arg1) {
player->unk_044 |= 0x200;
for (temp_v0 = 0; temp_v0 < 10; ++temp_v0) {
player->unk_258[temp_v0].unk_01C = 0;
player->unk_258[temp_v0].unk_01E = 0;
player->unk_258[temp_v0].unk_012 = 0;
player->particles[temp_v0].IsAlive = 0;
player->particles[temp_v0].timer = 0;
player->particles[temp_v0].type = 0;
}
}
@@ -1558,9 +1558,9 @@ void func_8008FDA8(Player* player, UNUSED s8 arg1) {
s16 temp_v0;
player->unk_044 |= 0x200;
for (temp_v0 = 0; temp_v0 < 10; ++temp_v0) {
player->unk_258[temp_v0].unk_01C = 0;
player->unk_258[temp_v0].unk_01E = 0;
player->unk_258[temp_v0].unk_012 = 0;
player->particles[temp_v0].IsAlive = 0;
player->particles[temp_v0].timer = 0;
player->particles[temp_v0].type = 0;
}
}
@@ -2025,30 +2025,30 @@ void func_800911B4(Player* player, s8 arg1) {
player->unk_078 = 0;
D_8018D920[arg1] = 0;
player->unk_258[31].unk_012 = 0;
player->unk_258[31].unk_01E = 0;
player->unk_258[31].unk_01C = 0;
player->unk_258[30].unk_012 = 0;
player->unk_258[30].unk_01E = 0;
player->unk_258[30].unk_01C = 0;
player->particles[31].type = 0;
player->particles[31].timer = 0;
player->particles[31].IsAlive = 0;
player->particles[30].type = 0;
player->particles[30].timer = 0;
player->particles[30].IsAlive = 0;
// clang-format off
temp_v0 = 2; do {
// clang-format on
player->unk_258[31 + temp_v0].unk_01C = 0;
player->unk_258[31 + temp_v0].unk_01E = 0;
player->unk_258[31 + temp_v0].unk_012 = 0;
player->unk_258[32 + temp_v0].unk_01C = 0;
player->unk_258[32 + temp_v0].unk_01E = 0;
player->unk_258[32 + temp_v0].unk_012 = 0;
player->unk_258[33 + temp_v0].unk_01C = 0;
player->unk_258[33 + temp_v0].unk_01E = 0;
player->unk_258[33 + temp_v0].unk_012 = 0;
player->particles[31 + temp_v0].IsAlive = 0;
player->particles[31 + temp_v0].timer = 0;
player->particles[31 + temp_v0].type = 0;
player->particles[32 + temp_v0].IsAlive = 0;
player->particles[32 + temp_v0].timer = 0;
player->particles[32 + temp_v0].type = 0;
player->particles[33 + temp_v0].IsAlive = 0;
player->particles[33 + temp_v0].timer = 0;
player->particles[33 + temp_v0].type = 0;
temp_v0 += 4;
player->unk_258[26 + temp_v0].unk_01C = 0;
player->unk_258[26 + temp_v0].unk_01E = 0;
player->unk_258[26 + temp_v0].unk_012 = 0;
player->particles[26 + temp_v0].IsAlive = 0;
player->particles[26 + temp_v0].timer = 0;
player->particles[26 + temp_v0].type = 0;
} while (temp_v0 < 10);
}
+90 -89
View File
@@ -1096,10 +1096,10 @@ void func_8002A704(Player* player, s8 playerIndex) {
void func_8002A79C(Player* player, s8 playerIndex) {
if (((player->effects & UNKNOWN_EFFECT_0x100) != UNKNOWN_EFFECT_0x100) &&
((player->effects & UNKNOWN_EFFECT_0x10) != UNKNOWN_EFFECT_0x10) && (player->unk_22A >= 2)) {
((player->effects & UNKNOWN_EFFECT_0x10) != UNKNOWN_EFFECT_0x10) && (player->driftState >= 2)) {
player->effects |= UNKNOWN_EFFECT_0x100;
player->unk_23A = 0;
player->unk_22A = 0;
player->driftState = 0;
player->unk_228 = 0;
if (D_8015F890 != 1) {
if ((player->type & PLAYER_HUMAN) && !(player->type & PLAYER_INVISIBLE_OR_BOMB)) {
@@ -1113,7 +1113,7 @@ void func_8002A79C(Player* player, s8 playerIndex) {
if (player->unk_23A >= 0x1F) {
player->unk_23A = 0;
player->effects &= ~0x100;
player->unk_22A = 0;
player->driftState = 0;
player->unk_228 = 0;
}
}
@@ -1130,15 +1130,15 @@ void func_8002A8A4(Player* player, s8 playerIndex) {
}
} else {
if ((player->unk_228 >= 0x12) && (player->unk_228 < 0x64)) {
if (player->unk_22A < 3) {
player->unk_22A++;
if (player->driftState < 3) {
player->driftState++;
}
}
if ((player->unk_228 >= 0xA) && (player->unk_228 < 0x64)) {
player->unk_228 = 0x000A;
} else {
player->unk_228 = 0;
player->unk_22A = 0;
player->driftState = 0;
}
}
} else if (((s32) player->unk_07C >> 0x10) >= 0xA) {
@@ -1150,15 +1150,15 @@ void func_8002A8A4(Player* player, s8 playerIndex) {
}
} else {
if ((player->unk_228 >= 0x12) && (player->unk_228 < 0x64)) {
if (player->unk_22A < 3) {
player->unk_22A++;
if (player->driftState < 3) {
player->driftState++;
}
}
if ((player->unk_228 >= 0xA) && (player->unk_228 < 0x64)) {
player->unk_228 = 0x000A;
} else {
player->unk_228 = 0;
player->unk_22A = 0;
player->driftState = 0;
}
}
}
@@ -3846,7 +3846,7 @@ void func_80033AE0(Player* player, struct Controller* controller, s8 arg2) {
player->unk_044 &= 0xFFF9;
}
sp2E4 = player->unk_07C;
temp_v0_3 = func_80038534(controller);
temp_v0_3 = get_clamped_stickX_with_deadzone(controller);
if (((player->unk_044 & 1) == 1) || ((player->unk_044 & 8) == 8)) {
temp_v0_3 = -temp_v0_3;
}
@@ -4066,8 +4066,8 @@ void func_80033AE0(Player* player, struct Controller* controller, s8 arg2) {
}
}
player->unk_228 = 0;
if (player->unk_22A < 2) {
player->unk_22A = 0;
if (player->driftState < 2) {
player->driftState = 0;
}
}
} else if (((player->effects & 8) != 8) && ((player->effects & 2) != 2)) {
@@ -4375,6 +4375,7 @@ void func_80037614(Player* player, Vec3f arg1, Vec3f arg2) {
arg2[2] = arg1[2];
}
void func_8003777C(Player* player, Vec3f arg1, Vec3f arg2) {
f32 var_f12;
f32 var_f2;
@@ -4554,14 +4555,14 @@ void func_80037CFC(Player* player, struct Controller* controller, s8 playerIndex
}
}
if ((!(player->effects & BOOST_RAMP_ASPHALT_EFFECT)) && (!(player->effects & 4))) {
if (((func_800388B0(controller) < (-0x31)) && (((player->speed / 18.0f) * 216.0f) <= 5.0f)) &&
if (((get_clamped_stickY_with_deadzone(controller) < (-0x31)) && (((player->speed / 18.0f) * 216.0f) <= 5.0f)) &&
(controller->button & B_BUTTON)) {
player->currentSpeed = 140.0f;
player->unk_044 |= 1;
player->unk_08C = (player->currentSpeed * player->currentSpeed) / 25.0f;
player->unk_20C = 0.0f;
}
if ((func_800388B0(controller) >= -0x1D) || (!(controller->button & B_BUTTON))) {
if ((get_clamped_stickY_with_deadzone(controller) >= -0x1D) || (!(controller->button & B_BUTTON))) {
if ((player->unk_044 & 1) == 1) {
player->unk_044 &= 0xFFFE;
player->currentSpeed = 0.0f;
@@ -4680,111 +4681,111 @@ void handle_a_press_for_all_players_during_race(void) {
}
}
s16 func_80038534(struct Controller* controller) {
s16 temp_a2;
s16 var_a3;
s16 var_t0;
s16 temp_v0;
s16 get_clamped_stickX_with_deadzone(struct Controller* controller) {
s16 temp_stickY;
s16 temp_stickX2;
s16 temp_stickY2;
s16 temp_stickX;
temp_v0 = controller->rawStickX;
temp_a2 = controller->rawStickY;
var_a3 = temp_v0;
var_t0 = temp_a2;
temp_stickX = controller->rawStickX;
temp_stickY = controller->rawStickY;
temp_stickX2 = temp_stickX;
temp_stickY2 = temp_stickY;
if (temp_v0 > 0xC) {
var_t0 = (temp_a2 * 0x000C) / temp_v0;
var_a3 = 0x000C;
if (temp_stickX > 0xC) {
temp_stickY2 = (temp_stickY * 0x000C) / temp_stickX;
temp_stickX2 = 0x000C;
}
if (var_a3 < -0xC) {
var_t0 = (var_t0 * 0x000C) / -var_a3;
var_a3 = -0x000C;
if (temp_stickX2 < -0xC) {
temp_stickY2 = (temp_stickY2 * 0x000C) / -temp_stickX2;
temp_stickX2 = -0x000C;
}
if (var_t0 > 0xC) {
var_a3 = (var_a3 * 0x000C) / var_t0;
var_t0 = 0x000C;
if (temp_stickY2 > 0xC) {
temp_stickX2 = (temp_stickX2 * 0x000C) / temp_stickY2;
temp_stickY2 = 0x000C;
}
if (var_t0 < -0xC) {
var_a3 = (var_a3 * 0x000C) / -var_t0;
var_t0 = -0x000C;
if (temp_stickY2 < -0xC) {
temp_stickX2 = (temp_stickX2 * 0x000C) / -temp_stickY2;
temp_stickY2 = -0x000C;
}
if ((((controller->rawStickX > -0xD) && (controller->rawStickX < 0xD)) && (controller->rawStickY > -0xD)) &&
(controller->rawStickY < 0xD)) {
temp_v0 = 0;
temp_a2 = 0;
temp_stickX = 0;
temp_stickY = 0;
} else {
temp_v0 -= var_a3;
temp_a2 -= var_t0;
temp_stickX -= temp_stickX2;
temp_stickY -= temp_stickY2;
}
if (temp_v0 > 0x35) {
temp_a2 = (temp_a2 * 0x0035) / temp_v0;
temp_v0 = 0x0035;
if (temp_stickX > 0x35) {
temp_stickY = (temp_stickY * 0x0035) / temp_stickX;
temp_stickX = 0x0035;
}
if (temp_v0 < -0x35) {
temp_a2 = (temp_a2 * 0x0035) / -temp_v0;
temp_v0 = -0x0035;
if (temp_stickX < -0x35) {
temp_stickY = (temp_stickY * 0x0035) / -temp_stickX;
temp_stickX = -0x0035;
}
if (temp_a2 > 0x35) {
temp_v0 = (temp_v0 * 0x0035) / temp_a2;
temp_a2 = 0x0035;
if (temp_stickY > 0x35) {
temp_stickX = (temp_stickX * 0x0035) / temp_stickY;
temp_stickY = 0x0035;
}
if (temp_a2 < -0x35) {
temp_v0 = (temp_v0 * 0x0035) / -temp_a2;
if (temp_stickY < -0x35) {
temp_stickX = (temp_stickX * 0x0035) / -temp_stickY;
}
return temp_v0;
return temp_stickX;
}
s16 func_800388B0(struct Controller* controller) {
s16 temp_a2;
s16 var_a3;
s16 var_t0;
s16 temp_v0;
s16 get_clamped_stickY_with_deadzone(struct Controller* controller) {
s16 temp_StickY;
s16 temp_StickX2;
s16 temp_StickY2;
s16 temp_StickX;
temp_v0 = controller->rawStickX;
temp_a2 = controller->rawStickY;
var_a3 = temp_v0;
var_t0 = temp_a2;
temp_StickX = controller->rawStickX;
temp_StickY = controller->rawStickY;
temp_StickX2 = temp_StickX;
temp_StickY2 = temp_StickY;
if (temp_v0 > 0xC) {
var_t0 = (temp_a2 * 0x000C) / temp_v0;
var_a3 = 0x000C;
if (temp_StickX > 0xC) {
temp_StickY2 = (temp_StickY * 0x000C) / temp_StickX;
temp_StickX2 = 0x000C;
}
if (var_a3 < -0xC) {
var_t0 = (var_t0 * 0x000C) / -var_a3;
var_a3 = -0x000C;
if (temp_StickX2 < -0xC) {
temp_StickY2 = (temp_StickY2 * 0x000C) / -temp_StickX2;
temp_StickX2 = -0x000C;
}
if (var_t0 > 0xC) {
var_a3 = (var_a3 * 0x000C) / var_t0;
var_t0 = 0x000C;
if (temp_StickY2 > 0xC) {
temp_StickX2 = (temp_StickX2 * 0x000C) / temp_StickY2;
temp_StickY2 = 0x000C;
}
if (var_t0 < -0xC) {
var_a3 = (var_a3 * 0x000C) / -var_t0;
var_t0 = -0x000C;
if (temp_StickY2 < -0xC) {
temp_StickX2 = (temp_StickX2 * 0x000C) / -temp_StickY2;
temp_StickY2 = -0x000C;
}
if ((((controller->rawStickX > -0xD) && (controller->rawStickX < 0xD)) && (controller->rawStickY > -0xD)) &&
(controller->rawStickY < 0xD)) {
temp_v0 = 0;
temp_a2 = 0;
temp_StickX = 0;
temp_StickY = 0;
} else {
temp_v0 -= var_a3;
temp_a2 -= var_t0;
temp_StickX -= temp_StickX2;
temp_StickY -= temp_StickY2;
}
if (temp_v0 > 0x35) {
temp_a2 = (temp_a2 * 0x0035) / temp_v0;
temp_v0 = 0x0035;
if (temp_StickX > 0x35) {
temp_StickY = (temp_StickY * 0x0035) / temp_StickX;
temp_StickX = 0x0035;
}
if (temp_v0 < -0x35) {
temp_a2 = (temp_a2 * 0x0035) / -temp_v0;
temp_v0 = -0x0035;
if (temp_StickX < -0x35) {
temp_StickY = (temp_StickY * 0x0035) / -temp_StickX;
temp_StickX = -0x0035;
}
if (temp_a2 > 0x35) {
temp_v0 = (temp_v0 * 0x0035) / temp_a2;
temp_a2 = 0x0035;
if (temp_StickY > 0x35) {
temp_StickX = (temp_StickX * 0x0035) / temp_StickY;
temp_StickY = 0x0035;
}
if (temp_a2 < -0x35) {
temp_v0 = (temp_v0 * 0x0035) / -temp_a2;
temp_a2 = -0x0035;
if (temp_StickY < -0x35) {
temp_StickX = (temp_StickX * 0x0035) / -temp_StickY;
temp_StickY = -0x0035;
}
return temp_a2;
return temp_StickY;
}
void func_80038BE4(Player* player, s16 arg1) {
+2 -2
View File
@@ -106,8 +106,8 @@ void func_80037CFC(Player*, struct Controller*, s8);
void handle_a_press_for_player_during_race(Player*, struct Controller*, s8);
void handle_a_press_for_all_players_during_race(void);
s16 func_80038534(struct Controller*);
s16 func_800388B0(struct Controller*);
s16 get_clamped_stickX_with_deadzone(struct Controller*);
s16 get_clamped_stickY_with_deadzone(struct Controller*);
void func_80038BE4(Player*, s16);
void func_80038C6C(Player*, Camera*, s8, s8);
+1 -1
View File
@@ -195,7 +195,7 @@ void spawn_player(Player* player, s8 playerIndex, f32 startingRow, f32 startingC
player->unk_204 = 0;
player->nearestPathPointId = 0;
player->unk_228 = 0;
player->unk_22A = 0;
player->driftState = 0;
player->unk_234 = 0;
player->unk_236 = 0;
player->unk_238 = 0;