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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 1447 additions and 1445 deletions

View File

@ -355,14 +355,14 @@ extern u8 gTextureKartShadow[];
extern u8 gTexture69B03C[]; extern u8 gTexture69B03C[];
extern u8 gTexture69B140[]; extern u8 gTexture69B140[];
extern u8 gTexture69B378[]; extern u8 gTexture69B378[];
extern u8 gTexture69B960[]; extern u8 gTextureMusicNote[];
extern u8 gTexture69BA28[]; extern u8 gTextureSpeechBubble[];
extern u8 gTextureBoingExclamation[]; extern u8 gTextureBoingExclamation[];
extern u8 gTexture69BE6C[]; extern u8 gTexture69BE6C[];
extern u8 gTexture69BF54[]; extern u8 gTexture69BF54[];
extern u8 gTexture69C090[]; extern u8 gTexture69C090[];
extern u8 gTexture69C1E8[]; extern u8 gTexture69C1E8[];
extern u8 gTexture69C354[]; extern u8 gTextureSmokePuff[];
extern u8 gTexture69C4E4[]; extern u8 gTexture69C4E4[];
extern u8 gTexture69C80C[]; extern u8 gTexture69C80C[];
extern u8 gTexture69C9C4[]; extern u8 gTexture69C9C4[];

View File

@ -1424,11 +1424,11 @@ glabel gTexture69B378
.incbin "textures/standalone/texture_69B378.rgba16.mio0" .incbin "textures/standalone/texture_69B378.rgba16.mio0"
.balign 4, 0x00 .balign 4, 0x00
glabel gTexture69B960 glabel gTextureMusicNote
.incbin "textures/standalone/texture_69B960.i8.mio0" .incbin "textures/standalone/texture_69B960.i8.mio0"
.balign 4, 0x00 .balign 4, 0x00
glabel gTexture69BA28 glabel gTextureSpeechBubble
.incbin "textures/standalone/texture_69BA28.i8.mio0" .incbin "textures/standalone/texture_69BA28.i8.mio0"
.balign 4, 0x00 .balign 4, 0x00
@ -1452,7 +1452,7 @@ glabel gTexture69C1E8
.incbin "textures/standalone/texture_69C1E8.ia16.mio0" .incbin "textures/standalone/texture_69C1E8.ia16.mio0"
.balign 4, 0x00 .balign 4, 0x00
glabel gTexture69C354 glabel gTextureSmokePuff
.incbin "textures/standalone/texture_69C354.ia8.mio0" .incbin "textures/standalone/texture_69C354.ia8.mio0"
.balign 4, 0x00 .balign 4, 0x00

View File

@ -145,15 +145,15 @@ typedef struct {
} Collision; } Collision;
typedef struct { typedef struct {
/* 0x00 */ Vec3f unk_000; /* 0x00 */ Vec3f pos;
/* 0x0C */ f32 unk_00C; /* 0x0C */ f32 scale;
/* 0x10 */ u16 unk_010; /* 0x10 */ u16 unk_010;
/* 0x12 */ u16 unk_012; /* 0x12 */ u16 type;
/* 0x14 */ f32 unk_014; /* 0x14 */ f32 unk_014;
/* 0x18 */ f32 unk_018; /* 0x18 */ f32 unk_018;
/* 0x1C */ s16 unk_01C; /* 0x1C */ s16 IsAlive;
/* 0x1E */ s16 unk_01E; /* 0x1E */ s16 timer;
/* 0x20 */ s16 unk_020; /* 0x20 */ s16 rotation;
/* 0x22 */ s16 unk_022; /* 0x22 */ s16 unk_022;
/* 0x24 */ f32 unk_024; /* 0x24 */ f32 unk_024;
/* 0x28 */ f32 unk_028; /* 0x28 */ f32 unk_028;
@ -163,15 +163,15 @@ typedef struct {
/* 0x32 */ s16 unk_032; /* 0x32 */ s16 unk_032;
/* 0x34 */ s16 unk_034; /* 0x34 */ s16 unk_034;
/* 0x36 */ s16 unk_036; /* 0x36 */ s16 unk_036;
/* 0x38 */ s16 unk_038; /* 0x38 */ s16 red;
/* 0x3A */ s16 unk_03A; /* 0x3A */ s16 green;
/* 0x3C */ s16 unk_03C; /* 0x3C */ s16 blue;
/* 0x3E */ s16 unk_03E; /* 0x3E */ s16 alpha;
/* 0x40 */ s16 unk_040; /* 0x40 */ s16 unk_040;
/* 0x42 */ s16 unk_042; /* 0x42 */ s16 unk_042;
/* 0x44 */ s16 unk_044; /* 0x44 */ s16 unk_044;
/* 0x46 */ s16 unk_046; /* 0x46 */ s16 unk_046;
} UnkPlayerStruct258; // size = 0x48 } Particle; // size = 0x48
// This struct is almost identical to the GBI Vtx_t type, // This struct is almost identical to the GBI Vtx_t type,
// except that its missing the "flag" member. // except that its missing the "flag" member.
@ -340,7 +340,7 @@ typedef struct {
/* 0x0222 */ s16 unk_222; /* 0x0222 */ s16 unk_222;
/* 0x0224 */ f32 size; /* 0x0224 */ f32 size;
/* 0x0228 */ s16 unk_228; /* 0x0228 */ s16 unk_228;
/* 0x022A */ s16 unk_22A; /* 0x022A */ s16 driftState;
/* 0x022C */ f32 previousSpeed; /* 0x022C */ f32 previousSpeed;
/* 0x0230 */ f32 unk_230; /* 0x0230 */ f32 unk_230;
/* 0x0234 */ s16 unk_234; /* 0x0234 */ s16 unk_234;
@ -353,7 +353,7 @@ typedef struct {
/* 0x024C */ u16 animGroupSelector[4]; /* 0x024C */ u16 animGroupSelector[4];
/* 0x0254 */ u16 characterId; /* 0x0254 */ u16 characterId;
/* 0x0256 */ u16 unk_256; /* 0x0256 */ u16 unk_256;
/* 0x0258 */ UnkPlayerStruct258 unk_258[40]; /* 0x0258 */ Particle particles[40];
/* 0x0D98 */ s16 unk_D98; /* 0x0D98 */ s16 unk_D98;
/* 0x0D9A */ s16 unk_D9A; /* 0x0D9A */ s16 unk_D9A;
/* 0x0D9C */ f32 unk_D9C; /* 0x0D9C */ f32 unk_D9C;

File diff suppressed because it is too large Load Diff

View File

@ -117,15 +117,15 @@ void func_8005D1F4(s32);
void func_8005D290(void); void func_8005D290(void);
void func_8005D6C0(Player*); void func_8005D6C0(Player*);
void func_8005D794(Player*, UnkPlayerStruct258*, f32, f32, f32, s8, s8); void set_particle_position_and_rotation(Player*, Particle*, f32, f32, f32, s8, s8);
s32 func_8005D7D8(UnkPlayerStruct258*, s8, f32); s32 init_new_particle_player(Particle*, s8, f32);
s32 func_8005D800(UnkPlayerStruct258*, s32, s16); s32 set_particle_colour(Particle*, s32, s16);
s32 func_8005D82C(UnkPlayerStruct258*, s32, s16); s32 set_particle_colour_randomly_varried(Particle*, s32, s16);
void func_8005D898(Player*, s16, s32, s8, s8); void set_drift_particles(Player*, s16, s32, s8, s8);
void func_8005DA30(Player*, s16, s32, s8, s8); void check_drift_particles_setup_valid(Player*, s16, s32, s8, s8);
void func_8005DAD0(void); void func_8005DAD0(void);
void func_8005DAD8(UnkPlayerStruct258*, s16, s16, s16); void func_8005DAD8(Particle*, s16, s16, s16);
void func_8005DAF4(Player*, s16, s32, s8, s8); void setup_tyre_particles(Player*, s16, s32, s8, s8);
void func_8005EA94(Player*, s16, s32, s8, s8); void func_8005EA94(Player*, s16, s32, s8, s8);
void func_8005ED48(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_80061EF4(Player*, s16, s32, s8, s8);
void func_800621BC(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_800624D8(Player*, s32, s32, s8, s8);
void func_800628C0(Player*, s8, s8, s8); void func_800628C0(Player*, s8, s8, s8);
void func_80062914(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_80062C74(Player*, s16, s32, s32);
void func_80062F98(Player*, s16, s8, s8); 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_800631A8(Player*, s16, s8, s8);
void func_80063268(Player*, s16, s8, s8); void func_80063268(Player*, s16, s8, s8);
void func_80063408(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_80066BAC(Player*, s8, s16, s8);
void func_80067280(Player*, s8, s16, s8); void func_80067280(Player*, s8, s16, s8);
void func_80067604(Player*, s8, s16, s8); void render_player_boost_spark_particles(Player*, s8, s16, s8);
void func_80067964(Player*, s8, f32, s8, s8); void render_player_onomatopoeia_whrrrr(Player*, s8, f32, s8, s8);
void func_80067D3C(Player*, s8, u8*, s8, f32, s32); 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_80068310(Player*, s8, f32, s8, s8);
void func_80068724(Player*, s8, f32, s8, s8); void func_80068724(Player*, s8, f32, s8, s8);
void func_80068AA4(Player*, s8, f32, s8, s8); void render_player_onomatopoeia_boing(Player*, s8, f32, s8, s8);
void func_80068DA0(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_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_80069938(Player*, s8, s16, s8);
void func_80069BA8(Player*, s8, s16, s8); void func_80069BA8(Player*, s8, s16, s8);
void func_80069DB8(Player*, s8, s16, s8); void func_80069DB8(Player*, s8, s16, s8);

View File

@ -1467,9 +1467,9 @@ void apply_boo_sound_effect(Player* player, s8 playerIndex) {
player->unk_044 |= 0x200; player->unk_044 |= 0x200;
for (temp_v1 = 0; temp_v1 < 10; ++temp_v1) { for (temp_v1 = 0; temp_v1 < 10; ++temp_v1) {
player->unk_258[temp_v1].unk_01C = 0; player->particles[temp_v1].IsAlive = 0;
player->unk_258[temp_v1].unk_01E = 0; player->particles[temp_v1].timer = 0;
player->unk_258[temp_v1].unk_012 = 0; player->particles[temp_v1].type = 0;
} }
} }
@ -1548,9 +1548,9 @@ void func_8008FD4C(Player* player, UNUSED s8 arg1) {
player->unk_044 |= 0x200; player->unk_044 |= 0x200;
for (temp_v0 = 0; temp_v0 < 10; ++temp_v0) { for (temp_v0 = 0; temp_v0 < 10; ++temp_v0) {
player->unk_258[temp_v0].unk_01C = 0; player->particles[temp_v0].IsAlive = 0;
player->unk_258[temp_v0].unk_01E = 0; player->particles[temp_v0].timer = 0;
player->unk_258[temp_v0].unk_012 = 0; player->particles[temp_v0].type = 0;
} }
} }
@ -1558,9 +1558,9 @@ void func_8008FDA8(Player* player, UNUSED s8 arg1) {
s16 temp_v0; s16 temp_v0;
player->unk_044 |= 0x200; player->unk_044 |= 0x200;
for (temp_v0 = 0; temp_v0 < 10; ++temp_v0) { for (temp_v0 = 0; temp_v0 < 10; ++temp_v0) {
player->unk_258[temp_v0].unk_01C = 0; player->particles[temp_v0].IsAlive = 0;
player->unk_258[temp_v0].unk_01E = 0; player->particles[temp_v0].timer = 0;
player->unk_258[temp_v0].unk_012 = 0; player->particles[temp_v0].type = 0;
} }
} }
@ -2025,30 +2025,30 @@ void func_800911B4(Player* player, s8 arg1) {
player->unk_078 = 0; player->unk_078 = 0;
D_8018D920[arg1] = 0; D_8018D920[arg1] = 0;
player->unk_258[31].unk_012 = 0; player->particles[31].type = 0;
player->unk_258[31].unk_01E = 0; player->particles[31].timer = 0;
player->unk_258[31].unk_01C = 0; player->particles[31].IsAlive = 0;
player->unk_258[30].unk_012 = 0; player->particles[30].type = 0;
player->unk_258[30].unk_01E = 0; player->particles[30].timer = 0;
player->unk_258[30].unk_01C = 0; player->particles[30].IsAlive = 0;
// clang-format off // clang-format off
temp_v0 = 2; do { temp_v0 = 2; do {
// clang-format on // clang-format on
player->unk_258[31 + temp_v0].unk_01C = 0; player->particles[31 + temp_v0].IsAlive = 0;
player->unk_258[31 + temp_v0].unk_01E = 0; player->particles[31 + temp_v0].timer = 0;
player->unk_258[31 + temp_v0].unk_012 = 0; player->particles[31 + temp_v0].type = 0;
player->unk_258[32 + temp_v0].unk_01C = 0; player->particles[32 + temp_v0].IsAlive = 0;
player->unk_258[32 + temp_v0].unk_01E = 0; player->particles[32 + temp_v0].timer = 0;
player->unk_258[32 + temp_v0].unk_012 = 0; player->particles[32 + temp_v0].type = 0;
player->unk_258[33 + temp_v0].unk_01C = 0; player->particles[33 + temp_v0].IsAlive = 0;
player->unk_258[33 + temp_v0].unk_01E = 0; player->particles[33 + temp_v0].timer = 0;
player->unk_258[33 + temp_v0].unk_012 = 0; player->particles[33 + temp_v0].type = 0;
temp_v0 += 4; temp_v0 += 4;
player->unk_258[26 + temp_v0].unk_01C = 0; player->particles[26 + temp_v0].IsAlive = 0;
player->unk_258[26 + temp_v0].unk_01E = 0; player->particles[26 + temp_v0].timer = 0;
player->unk_258[26 + temp_v0].unk_012 = 0; player->particles[26 + temp_v0].type = 0;
} while (temp_v0 < 10); } while (temp_v0 < 10);
} }

View File

@ -1096,10 +1096,10 @@ void func_8002A704(Player* player, s8 playerIndex) {
void func_8002A79C(Player* player, s8 playerIndex) { void func_8002A79C(Player* player, s8 playerIndex) {
if (((player->effects & UNKNOWN_EFFECT_0x100) != UNKNOWN_EFFECT_0x100) && 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->effects |= UNKNOWN_EFFECT_0x100;
player->unk_23A = 0; player->unk_23A = 0;
player->unk_22A = 0; player->driftState = 0;
player->unk_228 = 0; player->unk_228 = 0;
if (D_8015F890 != 1) { if (D_8015F890 != 1) {
if ((player->type & PLAYER_HUMAN) && !(player->type & PLAYER_INVISIBLE_OR_BOMB)) { 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) { if (player->unk_23A >= 0x1F) {
player->unk_23A = 0; player->unk_23A = 0;
player->effects &= ~0x100; player->effects &= ~0x100;
player->unk_22A = 0; player->driftState = 0;
player->unk_228 = 0; player->unk_228 = 0;
} }
} }
@ -1130,15 +1130,15 @@ void func_8002A8A4(Player* player, s8 playerIndex) {
} }
} else { } else {
if ((player->unk_228 >= 0x12) && (player->unk_228 < 0x64)) { if ((player->unk_228 >= 0x12) && (player->unk_228 < 0x64)) {
if (player->unk_22A < 3) { if (player->driftState < 3) {
player->unk_22A++; player->driftState++;
} }
} }
if ((player->unk_228 >= 0xA) && (player->unk_228 < 0x64)) { if ((player->unk_228 >= 0xA) && (player->unk_228 < 0x64)) {
player->unk_228 = 0x000A; player->unk_228 = 0x000A;
} else { } else {
player->unk_228 = 0; player->unk_228 = 0;
player->unk_22A = 0; player->driftState = 0;
} }
} }
} else if (((s32) player->unk_07C >> 0x10) >= 0xA) { } else if (((s32) player->unk_07C >> 0x10) >= 0xA) {
@ -1150,15 +1150,15 @@ void func_8002A8A4(Player* player, s8 playerIndex) {
} }
} else { } else {
if ((player->unk_228 >= 0x12) && (player->unk_228 < 0x64)) { if ((player->unk_228 >= 0x12) && (player->unk_228 < 0x64)) {
if (player->unk_22A < 3) { if (player->driftState < 3) {
player->unk_22A++; player->driftState++;
} }
} }
if ((player->unk_228 >= 0xA) && (player->unk_228 < 0x64)) { if ((player->unk_228 >= 0xA) && (player->unk_228 < 0x64)) {
player->unk_228 = 0x000A; player->unk_228 = 0x000A;
} else { } else {
player->unk_228 = 0; 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; player->unk_044 &= 0xFFF9;
} }
sp2E4 = player->unk_07C; 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)) { if (((player->unk_044 & 1) == 1) || ((player->unk_044 & 8) == 8)) {
temp_v0_3 = -temp_v0_3; temp_v0_3 = -temp_v0_3;
} }
@ -4066,8 +4066,8 @@ void func_80033AE0(Player* player, struct Controller* controller, s8 arg2) {
} }
} }
player->unk_228 = 0; player->unk_228 = 0;
if (player->unk_22A < 2) { if (player->driftState < 2) {
player->unk_22A = 0; player->driftState = 0;
} }
} }
} else if (((player->effects & 8) != 8) && ((player->effects & 2) != 2)) { } 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]; arg2[2] = arg1[2];
} }
void func_8003777C(Player* player, Vec3f arg1, Vec3f arg2) { void func_8003777C(Player* player, Vec3f arg1, Vec3f arg2) {
f32 var_f12; f32 var_f12;
f32 var_f2; 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 ((!(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)) { (controller->button & B_BUTTON)) {
player->currentSpeed = 140.0f; player->currentSpeed = 140.0f;
player->unk_044 |= 1; player->unk_044 |= 1;
player->unk_08C = (player->currentSpeed * player->currentSpeed) / 25.0f; player->unk_08C = (player->currentSpeed * player->currentSpeed) / 25.0f;
player->unk_20C = 0.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) { if ((player->unk_044 & 1) == 1) {
player->unk_044 &= 0xFFFE; player->unk_044 &= 0xFFFE;
player->currentSpeed = 0.0f; 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 get_clamped_stickX_with_deadzone(struct Controller* controller) {
s16 temp_a2; s16 temp_stickY;
s16 var_a3; s16 temp_stickX2;
s16 var_t0; s16 temp_stickY2;
s16 temp_v0; s16 temp_stickX;
temp_v0 = controller->rawStickX; temp_stickX = controller->rawStickX;
temp_a2 = controller->rawStickY; temp_stickY = controller->rawStickY;
var_a3 = temp_v0; temp_stickX2 = temp_stickX;
var_t0 = temp_a2; temp_stickY2 = temp_stickY;
if (temp_v0 > 0xC) { if (temp_stickX > 0xC) {
var_t0 = (temp_a2 * 0x000C) / temp_v0; temp_stickY2 = (temp_stickY * 0x000C) / temp_stickX;
var_a3 = 0x000C; temp_stickX2 = 0x000C;
} }
if (var_a3 < -0xC) { if (temp_stickX2 < -0xC) {
var_t0 = (var_t0 * 0x000C) / -var_a3; temp_stickY2 = (temp_stickY2 * 0x000C) / -temp_stickX2;
var_a3 = -0x000C; temp_stickX2 = -0x000C;
} }
if (var_t0 > 0xC) { if (temp_stickY2 > 0xC) {
var_a3 = (var_a3 * 0x000C) / var_t0; temp_stickX2 = (temp_stickX2 * 0x000C) / temp_stickY2;
var_t0 = 0x000C; temp_stickY2 = 0x000C;
} }
if (var_t0 < -0xC) { if (temp_stickY2 < -0xC) {
var_a3 = (var_a3 * 0x000C) / -var_t0; temp_stickX2 = (temp_stickX2 * 0x000C) / -temp_stickY2;
var_t0 = -0x000C; temp_stickY2 = -0x000C;
} }
if ((((controller->rawStickX > -0xD) && (controller->rawStickX < 0xD)) && (controller->rawStickY > -0xD)) && if ((((controller->rawStickX > -0xD) && (controller->rawStickX < 0xD)) && (controller->rawStickY > -0xD)) &&
(controller->rawStickY < 0xD)) { (controller->rawStickY < 0xD)) {
temp_v0 = 0; temp_stickX = 0;
temp_a2 = 0; temp_stickY = 0;
} else { } else {
temp_v0 -= var_a3; temp_stickX -= temp_stickX2;
temp_a2 -= var_t0; temp_stickY -= temp_stickY2;
} }
if (temp_v0 > 0x35) { if (temp_stickX > 0x35) {
temp_a2 = (temp_a2 * 0x0035) / temp_v0; temp_stickY = (temp_stickY * 0x0035) / temp_stickX;
temp_v0 = 0x0035; temp_stickX = 0x0035;
} }
if (temp_v0 < -0x35) { if (temp_stickX < -0x35) {
temp_a2 = (temp_a2 * 0x0035) / -temp_v0; temp_stickY = (temp_stickY * 0x0035) / -temp_stickX;
temp_v0 = -0x0035; temp_stickX = -0x0035;
} }
if (temp_a2 > 0x35) { if (temp_stickY > 0x35) {
temp_v0 = (temp_v0 * 0x0035) / temp_a2; temp_stickX = (temp_stickX * 0x0035) / temp_stickY;
temp_a2 = 0x0035; temp_stickY = 0x0035;
} }
if (temp_a2 < -0x35) { if (temp_stickY < -0x35) {
temp_v0 = (temp_v0 * 0x0035) / -temp_a2; temp_stickX = (temp_stickX * 0x0035) / -temp_stickY;
} }
return temp_v0; return temp_stickX;
} }
s16 func_800388B0(struct Controller* controller) { s16 get_clamped_stickY_with_deadzone(struct Controller* controller) {
s16 temp_a2; s16 temp_StickY;
s16 var_a3; s16 temp_StickX2;
s16 var_t0; s16 temp_StickY2;
s16 temp_v0; s16 temp_StickX;
temp_v0 = controller->rawStickX; temp_StickX = controller->rawStickX;
temp_a2 = controller->rawStickY; temp_StickY = controller->rawStickY;
var_a3 = temp_v0; temp_StickX2 = temp_StickX;
var_t0 = temp_a2; temp_StickY2 = temp_StickY;
if (temp_v0 > 0xC) { if (temp_StickX > 0xC) {
var_t0 = (temp_a2 * 0x000C) / temp_v0; temp_StickY2 = (temp_StickY * 0x000C) / temp_StickX;
var_a3 = 0x000C; temp_StickX2 = 0x000C;
} }
if (var_a3 < -0xC) { if (temp_StickX2 < -0xC) {
var_t0 = (var_t0 * 0x000C) / -var_a3; temp_StickY2 = (temp_StickY2 * 0x000C) / -temp_StickX2;
var_a3 = -0x000C; temp_StickX2 = -0x000C;
} }
if (var_t0 > 0xC) { if (temp_StickY2 > 0xC) {
var_a3 = (var_a3 * 0x000C) / var_t0; temp_StickX2 = (temp_StickX2 * 0x000C) / temp_StickY2;
var_t0 = 0x000C; temp_StickY2 = 0x000C;
} }
if (var_t0 < -0xC) { if (temp_StickY2 < -0xC) {
var_a3 = (var_a3 * 0x000C) / -var_t0; temp_StickX2 = (temp_StickX2 * 0x000C) / -temp_StickY2;
var_t0 = -0x000C; temp_StickY2 = -0x000C;
} }
if ((((controller->rawStickX > -0xD) && (controller->rawStickX < 0xD)) && (controller->rawStickY > -0xD)) && if ((((controller->rawStickX > -0xD) && (controller->rawStickX < 0xD)) && (controller->rawStickY > -0xD)) &&
(controller->rawStickY < 0xD)) { (controller->rawStickY < 0xD)) {
temp_v0 = 0; temp_StickX = 0;
temp_a2 = 0; temp_StickY = 0;
} else { } else {
temp_v0 -= var_a3; temp_StickX -= temp_StickX2;
temp_a2 -= var_t0; temp_StickY -= temp_StickY2;
} }
if (temp_v0 > 0x35) { if (temp_StickX > 0x35) {
temp_a2 = (temp_a2 * 0x0035) / temp_v0; temp_StickY = (temp_StickY * 0x0035) / temp_StickX;
temp_v0 = 0x0035; temp_StickX = 0x0035;
} }
if (temp_v0 < -0x35) { if (temp_StickX < -0x35) {
temp_a2 = (temp_a2 * 0x0035) / -temp_v0; temp_StickY = (temp_StickY * 0x0035) / -temp_StickX;
temp_v0 = -0x0035; temp_StickX = -0x0035;
} }
if (temp_a2 > 0x35) { if (temp_StickY > 0x35) {
temp_v0 = (temp_v0 * 0x0035) / temp_a2; temp_StickX = (temp_StickX * 0x0035) / temp_StickY;
temp_a2 = 0x0035; temp_StickY = 0x0035;
} }
if (temp_a2 < -0x35) { if (temp_StickY < -0x35) {
temp_v0 = (temp_v0 * 0x0035) / -temp_a2; temp_StickX = (temp_StickX * 0x0035) / -temp_StickY;
temp_a2 = -0x0035; temp_StickY = -0x0035;
} }
return temp_a2; return temp_StickY;
} }
void func_80038BE4(Player* player, s16 arg1) { void func_80038BE4(Player* player, s16 arg1) {

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_player_during_race(Player*, struct Controller*, s8);
void handle_a_press_for_all_players_during_race(void); void handle_a_press_for_all_players_during_race(void);
s16 func_80038534(struct Controller*); s16 get_clamped_stickX_with_deadzone(struct Controller*);
s16 func_800388B0(struct Controller*); s16 get_clamped_stickY_with_deadzone(struct Controller*);
void func_80038BE4(Player*, s16); void func_80038BE4(Player*, s16);
void func_80038C6C(Player*, Camera*, s8, s8); void func_80038C6C(Player*, Camera*, s8, s8);

View File

@ -195,7 +195,7 @@ void spawn_player(Player* player, s8 playerIndex, f32 startingRow, f32 startingC
player->unk_204 = 0; player->unk_204 = 0;
player->nearestPathPointId = 0; player->nearestPathPointId = 0;
player->unk_228 = 0; player->unk_228 = 0;
player->unk_22A = 0; player->driftState = 0;
player->unk_234 = 0; player->unk_234 = 0;
player->unk_236 = 0; player->unk_236 = 0;
player->unk_238 = 0; player->unk_238 = 0;