Document effects and define magic values (#733)

* Document projection matrix function

Document function for computing a projection matrix. Used for camera and graphics.

* Fix loop index bug

Fix straightforward loop index bug introduced in last commit

* Style guide updates

Changes to match style recommendations
* Update function variables to camelCase
* Use dOxygen tags
* Use block comment

* Document math functions

* Give all functions in src\racing\math_util.c descriptive names

* Improve documentation for math_util

Improves a number of functions by giving descriptive argument names and comments

* Additional merge

* Fix style issues

update variables / parameters to use camelCase instead of snakeCase

* doxygen and other documentation

* Add doxygen documentation
* Rename mat -> mtx for consistency among matrices
* Theta -> Angle for angles
* Give some arguments more descriptive names

* Partial documentation for calculate_orientation_matrix

Documentation for when cosAxisY is 1 and observations that things break when if it does not equal 1.

* Rename functions

Renamed multiple functions for accuracy or clarity

* doxygen whitespace alignment

Improve readability of doxygen info by aligning text

* Make format check

Formatting updates suggested by make format

* Make skyboxes static

* Change function name

angle_from_coords -> get_angle_between_coords

* Math values renamed

Functions:
render_distance_squared -> distance_if_visible
mtxf_rotation_zxy_translate -> mtxf_rotate_zxy_translate

Arguments:
vecTrans -> translate

* Document many effects

Define effects for
* Braking
* Drifting
* Spinning out (driving and bananas)
* Mini turbos
* Losing at GP
* Tumbling on terrain
* CPU rubberbanding

And substitute some pre-existing defined effect names in place of bit flags

* Replace effect magic numbers with defined values

* Separate effect bit-flags into components

* Document more effects

* Rename some effects

* Replace effect bit_flags with defined values

* Formatting fixes

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
Jed Grabman 2025-07-17 22:53:11 -04:00 committed by GitHub
parent 0a27fbbba0
commit a5526cc5bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 776 additions and 668 deletions

View File

@ -341,34 +341,47 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
#define HOLD_BANANA_SOUND_EFFECT 0x40000 // holding a banana
#define REVERSE_SOUND_EFFECT 0x400000 // being in the wrong direction
#define BOOST_RAMP_ASPHALT_SOUND_EFFECT 0x800000 // being boosted by a boost pad
#define HIT_BY_ITEM_SOUND_EFFECT 0x1000000 // being hit by an item
#define HIT_BY_STAR_SOUND_EFFECT 0x1000000 // being hit by an item
/**
* @brief effect of player's
* for effects
*/
#define UNKNOWN_EFFECT_0x1 0x1 //
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
#define UNKNOWN_EFFECT_0x10 0x10 //
#define UNKNOWN_EFFECT_0x40 0x40 //
#define UNKNOWN_EFFECT_0x80 0x80 //
#define UNKNOWN_EFFECT_0xC 0xC //
#define UNKNOWN_EFFECT_0x10 0x10 //
#define UNKNOWN_EFFECT_0x100 0x100 //
#define UNKNOWN_EFFECT_0x1000 0x1000 //
#define STAR_EFFECT 0x200 // being a star
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
#define UNKNOWN_EFFECT_0x10000 0x10000 //
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
#define UNKNOWN_EFFECT_0x200000 0x200000 //
#define REVERSE_EFFECT 0x400000 // being in reverse of the course
#define UNKNOWN_EFFECT_0x1000000 0x1000000 //
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
#define HIT_EFFECT 0x4000000 // hitting an object
#define UNKNOWN_EFFECT_0x10000000 0x10000000 //
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define BOO_EFFECT 0x80000000 // being a boo
// clang-format off
#define BRAKING_EFFECT 0x1 // pressing brake
#define HOP_EFFECT 0x2 // from when you hop to when you land
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by DKJP ramp
#define MIDAIR_EFFECT 0x8 // in midair
#define DRIFTING_EFFECT 0x10 // drifting
#define AB_SPIN_EFFECT 0x20 // spinning with a+b
#define DRIVING_SPINOUT_EFFECT 0x40 // spinout (from erratic driving) or crab
#define BANANA_SPINOUT_EFFECT 0x80 // spinout (from hitting a banana or another driver)
#define MINI_TURBO_EFFECT 0x100 // mini-turbo
#define STAR_EFFECT 0x200 // using a star
#define HIT_BY_GREEN_SHELL_EFFECT 0x400 // tumbling after hit with a green shell
#define BANANA_NEAR_SPINOUT_EFFECT 0x800 // decreased steering sensitivity after hitting a banana, but before spinning out
#define LOST_RACE_EFFECT 0x1000 // lost race in GP mode
#define MUSHROOM_EFFECT 0x2000 // using a mushroom
#define EARLY_START_SPINOUT_EFFECT 0x4000 // spinning out by pressing a too early at the startline or after lakitu retrieves you
#define ENEMY_BONK_EFFECT 0x8000 // bouncing off an enemy (penguin, thwomp, etc)
#define TERRAIN_TUMBLE_EFFECT 0x10000 // tumbling after hitting steep terrain
#define LIGHTNING_STRIKE_EFFECT 0x20000 // spinning and shrinking during a lightning strike
#define BANANA_SPINOUT_SAVE_EFFECT 0x40000 // avoid spinning out by pressing b
#define UNKNOWN_EFFECT_0x80000 0x80000 // Only set when soundEffect 0x1000 is set. Unclear if it ever is
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by the Royal Raceway ramp
#define CPU_FAST_EFFECT 0x200000 // CPU Rubberbanding flag
#define REVERSE_EFFECT 0x400000 // facing backwards
#define UNKNOWN_EFFECT_0x800000 0x800000 // Only set when soundEffect 0x20000 is set
#define EXPLOSION_CRASH_EFFECT 0x1000000 // vertical launch (hitting car, snowman, etc.)
#define HIT_BY_STAR_EFFECT 0x2000000 // being hit by a red shell or star
#define SQUISH_EFFECT 0x4000000 // hitting an object
#define POST_SQUISH_EFFECT 0x8000000 // briefly after being squished (boulder, thwomp, etc.)
#define UNKNOWN_EFFECT_0x10000000 0x10000000 // UNUSED (set in unused func_8008FDF4)
#define DRIFT_OUTSIDE_EFFECT 0x20000000 // drifting toward the outside of your turn
#define LIGHTNING_EFFECT 0x40000000 // suffering the effects of lightning
#define BOO_EFFECT 0x80000000 // being a boo
#define ALL_EFFECTS 0xFFFFFFFF
// clang-format on
/**
* @brief durations of effects

View File

@ -51,7 +51,7 @@ void update_actor_kiwano_fruit(struct KiwanoFruit* fruit) {
if ((player->effects & STAR_EFFECT) != 0) {
func_800C9060(player - gPlayerOne, SOUND_ARG_LOAD(0x19, 0x00, 0xA0, 0x52));
} else {
player->effects |= 0x8000;
player->effects |= ENEMY_BONK_EFFECT;
player->pos[0] -= temp_f2 * 4.0f;
player->pos[2] -= temp_f14 * 4.0f;
player->velocity[0] -= temp_f2 * 0.7f;

View File

@ -1920,7 +1920,7 @@ void func_800C6108(u8 playerId) {
} else {
D_800E9E54[playerId] = (f32) -player->unk_0C0;
}
if ((player->effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) {
if ((player->effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
D_800E9EB4[playerId] = D_800E9E64[playerId] + D_800E9DE4[playerId];
} else {
D_800E9EB4[playerId] = D_800E9E64[playerId] + D_800E9DE4[playerId] - (D_800E9E54[playerId] / 12000.0f);
@ -2190,8 +2190,7 @@ void func_800C683C(u8 cameraId) {
void func_800C70A8(u8 playerId) {
if (D_800EA0EC[playerId] == 0) {
D_800E9E74[playerId] = 0;
if ((D_800E9E54[playerId] > 3500.0f) ||
((gPlayers[playerId].effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10)) {
if ((D_800E9E54[playerId] > 3500.0f) || ((gPlayers[playerId].effects & DRIFTING_EFFECT) == DRIFTING_EFFECT)) {
D_800E9E74[playerId] = 1;
switch (gPlayers[playerId].tyres[AUDIO_LEFT_TYRE].surfaceType) {
case DIRT: /* switch 1 */
@ -2223,7 +2222,7 @@ void func_800C70A8(u8 playerId) {
break;
}
}
if ((gPlayers[playerId].effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) {
if ((gPlayers[playerId].effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
D_800E9E74[playerId] = 2;
switch (gPlayers[playerId].tyres[AUDIO_LEFT_TYRE].surfaceType) { /* switch 2 */
case DIRT: /* switch 2 */
@ -2375,17 +2374,21 @@ void func_800C70A8(u8 playerId) {
D_800E9E74[playerId] = 0x0000001B;
break;
}
if (((gPlayers[playerId].speed < 0.5f) || ((gPlayers[playerId].effects & 8) == 8)) &&
if (((gPlayers[playerId].speed < 0.5f) || ((gPlayers[playerId].effects & MIDAIR_EFFECT) == MIDAIR_EFFECT)) &&
(D_800E9E74[playerId] != 0x0000001C)) {
D_800E9E74[playerId] = 0;
}
if ((((gPlayers[playerId].effects & 0x4000) == 0x4000) && ((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
((gPlayers[playerId].effects & 0x800) == 0x800) || ((gPlayers[playerId].effects & 0x80) == 0x80) ||
((gPlayers[playerId].effects & 0x40) == 0x40) || ((gPlayers[playerId].unk_044 & 0x4000) == 0x4000)) {
if ((((gPlayers[playerId].effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) &&
((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
((gPlayers[playerId].effects & BANANA_NEAR_SPINOUT_EFFECT) == BANANA_NEAR_SPINOUT_EFFECT) ||
((gPlayers[playerId].effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((gPlayers[playerId].effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) ||
((gPlayers[playerId].unk_044 & 0x4000) == 0x4000)) {
D_800E9E74[playerId] = 0x00000012;
}
if ((((gPlayers[playerId].effects & 0x20) == 0x20) && ((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
((gPlayers[playerId].effects & 0x800) == 0x800)) {
if ((((gPlayers[playerId].effects & AB_SPIN_EFFECT) == AB_SPIN_EFFECT) &&
((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
((gPlayers[playerId].effects & BANANA_NEAR_SPINOUT_EFFECT) == BANANA_NEAR_SPINOUT_EFFECT)) {
D_800E9E74[playerId] = 0x00000013;
}
if (gPlayers[playerId].unk_20C != 0.0f) {
@ -2714,13 +2717,13 @@ void func_800C847C(u8 playerId) {
}
void func_800C86D8(u8 playerId) {
if (((gPlayers[playerId].effects & 0x40000000) != 0x40000000) && (D_800E9F24[playerId] == 1)) {
if (((gPlayers[playerId].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) && (D_800E9F24[playerId] == 1)) {
func_800C90F4(playerId, (gPlayers[playerId].characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08));
}
}
void func_800C8770(u8 playerId) {
if ((gPlayers[playerId].effects & 0x40000000) == 0x40000000) {
if ((gPlayers[playerId].effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) {
D_800E9F24[playerId] = 1;
if (D_800E9F2C[playerId] < 0xFA) {
D_800E9F2C[playerId]++;
@ -2753,11 +2756,14 @@ void func_800C8770(u8 playerId) {
// Checks the same field for all players before doing something?
void func_800C8920(void) {
if (((u8) D_800EA168 != 0) && ((gPlayers[0].effects & 0x40000000) != 0x40000000) &&
((gPlayers[1].effects & 0x40000000) != 0x40000000) && ((gPlayers[2].effects & 0x40000000) != 0x40000000) &&
((gPlayers[3].effects & 0x40000000) != 0x40000000) && ((gPlayers[4].effects & 0x40000000) != 0x40000000) &&
((gPlayers[5].effects & 0x40000000) != 0x40000000) && ((gPlayers[6].effects & 0x40000000) != 0x40000000) &&
((gPlayers[7].effects & 0x40000000) != 0x40000000)) {
if (((u8) D_800EA168 != 0) && ((gPlayers[0].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[1].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[2].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[3].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[4].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[5].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[6].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
((gPlayers[7].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT)) {
func_800CAC08();
}
}
@ -2928,7 +2934,8 @@ void func_800C90F4(u8 playerId, u32 soundBits) {
((soundBits & ~0xF0) == SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x05))) {
D_800EA180 = 1;
}
if (((gPlayers[playerId].effects & 0x40000000) == 0x40000000) && ((s32) D_800E9F2C[playerId] >= 0x1F)) {
if (((gPlayers[playerId].effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) &&
((s32) D_800E9F2C[playerId] >= 0x1F)) {
play_sound(soundBits, &D_800E9F7C[playerId].pos, playerId, &D_800EA150, &D_800EA1D4,
(s8*) &D_800E9F7C[playerId].unk_14);
} else {
@ -2957,7 +2964,8 @@ void func_800C92CC(u8 playerId, u32 soundBits) {
(u8) var_s0, soundBits);
if (temp_v0 != NULL) {
temp_v0->unk34 = 170.0f;
if (((gPlayers[playerId].effects & 0x40000000) == 0x40000000) && ((s32) D_800E9F2C[playerId] >= 0x1F)) {
if (((gPlayers[playerId].effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) &&
((s32) D_800E9F2C[playerId] >= 0x1F)) {
play_sound((gPlayers[playerId].characterId * 0x10) + soundBits, &temp_v0->unk18, var_s0,
&D_800EA150, &D_800EA1D4, (s8*) &D_800EA06C[playerId].unk0C);
} else {

View File

@ -362,7 +362,7 @@ void func_8001CCEC(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
arg2[0] = camera->lookAt[0];
arg2[1] = camera->lookAt[1];
arg2[2] = camera->lookAt[2];
if ((player->effects & UNKNOWN_EFFECT_0x1000000) == UNKNOWN_EFFECT_0x1000000) {
if ((player->effects & EXPLOSION_CRASH_EFFECT) == EXPLOSION_CRASH_EFFECT) {
sp84[2] /= 3.0f;
}
calculate_orientation_matrix(sp9C, 0, 1, 0, arg7);
@ -375,7 +375,7 @@ void func_8001CCEC(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
arg2[0] += (x - camera->lookAt[0]) * D_80164A78[index];
arg2[2] += ((z - camera->lookAt[2]) * D_80164A78[index]);
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & 2) == 2)) {
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & HOP_EFFECT) == HOP_EFFECT)) {
arg2[1] += ((y - camera->lookAt[1]) * 0.02);
} else {
arg2[1] += ((y - camera->lookAt[1]) * 0.5);
@ -383,7 +383,7 @@ void func_8001CCEC(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
mtxf_transform_vec3f_mat3(sp90, sp9C);
x = player->pos[0] + sp90[0];
z = player->pos[2] + sp90[2];
if ((player->effects & UNKNOWN_EFFECT_0x1000000) != UNKNOWN_EFFECT_0x1000000) {
if ((player->effects & EXPLOSION_CRASH_EFFECT) != EXPLOSION_CRASH_EFFECT) {
var_f0 = player->pos[1] + sp90[1];
// permute
y = var_f0;
@ -394,7 +394,7 @@ void func_8001CCEC(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
*arg3 = camera->pos[0] + ((x - camera->pos[0]) * D_80164A78[index]);
*arg5 = camera->pos[2] + ((z - camera->pos[2]) * D_80164A78[index]);
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & 2) == 2)) {
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & HOP_EFFECT) == HOP_EFFECT)) {
*arg4 = camera->pos[1] + (((y - camera->pos[1]) * 0.01));
} else {
*arg4 = camera->pos[1] + (((y - camera->pos[1]) * 0.15));
@ -582,7 +582,7 @@ void func_8001D944(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
arg2[0] = camera->lookAt[0];
arg2[1] = camera->lookAt[1];
arg2[2] = camera->lookAt[2];
if ((player->effects & UNKNOWN_EFFECT_0x1000000) == UNKNOWN_EFFECT_0x1000000) {
if ((player->effects & EXPLOSION_CRASH_EFFECT) == EXPLOSION_CRASH_EFFECT) {
sp84[2] /= 3.0f;
}
calculate_orientation_matrix(sp9C, 0, 1, 0, arg7);
@ -595,7 +595,7 @@ void func_8001D944(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
arg2[0] += (x - camera->lookAt[0]) * D_80164A78[index];
arg2[2] += ((z - camera->lookAt[2]) * D_80164A78[index]);
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & 2) == 2)) {
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & HOP_EFFECT) == HOP_EFFECT)) {
arg2[1] += ((y - camera->lookAt[1]) * 0.02);
} else {
arg2[1] += ((y - camera->lookAt[1]) * 0.5);
@ -603,7 +603,7 @@ void func_8001D944(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
mtxf_transform_vec3f_mat3(sp90, sp9C);
x = player->pos[0] + sp90[0];
z = player->pos[2] + sp90[2];
if ((player->effects & UNKNOWN_EFFECT_0x1000000) != UNKNOWN_EFFECT_0x1000000) {
if ((player->effects & EXPLOSION_CRASH_EFFECT) != EXPLOSION_CRASH_EFFECT) {
var_f0 = player->pos[1] + sp90[1];
// permute
y = var_f0;
@ -614,7 +614,7 @@ void func_8001D944(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a
*arg3 = camera->pos[0] + ((x - camera->pos[0]) * D_80164A78[index]);
*arg5 = camera->pos[2] + ((z - camera->pos[2]) * D_80164A78[index]);
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & 2) == 2)) {
if ((((player->speed / 18) * 216) <= 5.0f) && ((player->effects & HOP_EFFECT) == HOP_EFFECT)) {
*arg4 = camera->pos[1] + (((y - camera->pos[1]) * 0.01));
} else {
*arg4 = camera->pos[1] + (((y - camera->pos[1]) * 0.15));
@ -704,21 +704,21 @@ void func_8001E45C(Camera* camera, Player* player, s8 arg2) {
UNUSED s16 pad6;
s16 temp;
if ((player->effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) {
if ((player->effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
var_a3 = 100;
if (player->unk_078 == 0) {
camera->unk_B0 = 0;
} else {
if (player->unk_078 < 0) {
var_a3 = 0xA5 - (player->unk_078 / 2);
if ((player->effects & 0x20000000) == 0x20000000) {
if ((player->effects & DRIFT_OUTSIDE_EFFECT) == DRIFT_OUTSIDE_EFFECT) {
move_s16_towards(&camera->unk_B0, -0x0B60, 0.1f);
} else {
move_s16_towards(&camera->unk_B0, -0x0888, 0.1f);
}
} else {
var_a3 = (player->unk_078 / 2) + 0xA5;
if ((player->effects & 0x20000000) == 0x20000000) {
if ((player->effects & DRIFT_OUTSIDE_EFFECT) == DRIFT_OUTSIDE_EFFECT) {
move_s16_towards(&camera->unk_B0, 0x0B60, 0.1f);
} else {
move_s16_towards(&camera->unk_B0, 0x0888, 0.1f);
@ -729,7 +729,7 @@ void func_8001E45C(Camera* camera, Player* player, s8 arg2) {
move_s16_towards(&camera->unk_B0, 0, 0.05f);
var_a3 = ((s16) camera->unk_2C / 182) - ((s16) player->rotation[1] / 182);
if (player->unk_078 == 0) {
if ((player->effects & 0x20) == 0x20) {
if ((player->effects & AB_SPIN_EFFECT) == AB_SPIN_EFFECT) {
var_a3 = 0x02D8;
} else {
var_a3 = 0x01F4;
@ -746,11 +746,14 @@ void func_8001E45C(Camera* camera, Player* player, s8 arg2) {
var_a3 = (player->unk_078 / 2) + 0xA5;
}
}
if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40) ||
((player->effects & 0x4000) == 0x4000) || ((player->effects & 0x80000) == 0x80000) ||
((player->effects & 0x800000) == 0x800000) || (((player->effects & 0x20) == 0x20) && (player->unk_078 != 0)) ||
if (((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((player->effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) ||
((player->effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) ||
((player->effects & UNKNOWN_EFFECT_0x80000) == UNKNOWN_EFFECT_0x80000) ||
((player->effects & UNKNOWN_EFFECT_0x800000) == UNKNOWN_EFFECT_0x800000) ||
(((player->effects & AB_SPIN_EFFECT) == AB_SPIN_EFFECT) && (player->unk_078 != 0)) ||
(player->collision.surfaceDistance[0] <= 0.0f) || (player->collision.surfaceDistance[1] <= 0.0f) ||
((player->effects & 0x20000) == 0x20000)) {
((player->effects & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT)) {
func_8001CCEC(player, camera, sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
adjust_angle(&camera->unk_2C, (s16) (player->rotation[1] + camera->unk_B0), var_a3);
@ -826,7 +829,7 @@ void func_8001EA0C(Camera* camera, Player* player, s8 arg2) {
UNUSED s16 pad6;
s16 temp;
if ((player->effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) {
if ((player->effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
var_a3 = 100;
if (player->unk_078 == 0) {
camera->unk_B0 = 0;
@ -834,14 +837,14 @@ void func_8001EA0C(Camera* camera, Player* player, s8 arg2) {
if (player->unk_078 < 0) {
var_a3 = 0xA5 - (player->unk_078 / 2);
if ((player->effects & 0x20000000) == 0x20000000) {
if ((player->effects & DRIFT_OUTSIDE_EFFECT) == DRIFT_OUTSIDE_EFFECT) {
move_s16_towards(&camera->unk_B0, -0x0B60, 0.1f);
} else {
move_s16_towards(&camera->unk_B0, -0x0888, 0.1f);
}
} else {
var_a3 = (player->unk_078 / 2) + 0xA5;
if ((player->effects & 0x20000000) == 0x20000000) {
if ((player->effects & DRIFT_OUTSIDE_EFFECT) == DRIFT_OUTSIDE_EFFECT) {
move_s16_towards(&camera->unk_B0, 0x0B60, 0.1f);
} else {
move_s16_towards(&camera->unk_B0, 0x0888, 0.1f);
@ -852,7 +855,7 @@ void func_8001EA0C(Camera* camera, Player* player, s8 arg2) {
move_s16_towards(&camera->unk_B0, 0, 0.05f);
var_a3 = ((s16) camera->unk_2C / 182) - ((s16) player->rotation[1] / 182);
if (player->unk_078 == 0) {
if ((player->effects & 0x20) == 0x20) {
if ((player->effects & AB_SPIN_EFFECT) == AB_SPIN_EFFECT) {
var_a3 = 0x02D8;
} else {
var_a3 = 0x01F4;
@ -869,11 +872,14 @@ void func_8001EA0C(Camera* camera, Player* player, s8 arg2) {
var_a3 = (player->unk_078 / 2) + 0xA5;
}
}
if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40) ||
((player->effects & 0x4000) == 0x4000) || ((player->effects & 0x80000) == 0x80000) ||
((player->effects & 0x800000) == 0x800000) || (((player->effects & 0x20) == 0x20) && (player->unk_078 != 0)) ||
if (((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((player->effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) ||
((player->effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) ||
((player->effects & UNKNOWN_EFFECT_0x80000) == UNKNOWN_EFFECT_0x80000) ||
((player->effects & UNKNOWN_EFFECT_0x800000) == UNKNOWN_EFFECT_0x800000) ||
(((player->effects & AB_SPIN_EFFECT) == AB_SPIN_EFFECT) && (player->unk_078 != 0)) ||
(player->collision.surfaceDistance[0] <= 0.0f) || (player->collision.surfaceDistance[1] <= 0.0f) ||
((player->effects & 0x20000) == 0x20000)) {
((player->effects & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT)) {
func_8001D944(player, camera, sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2);
} else {
adjust_angle(&camera->unk_2C, (s16) (player->rotation[1] + camera->unk_B0), var_a3);
@ -1027,7 +1033,7 @@ void func_8001F394(Player* player, f32* arg1) {
if (player->soundEffects & HOLD_BANANA_SOUND_EFFECT) {
D_80164A08[playerIndex] = 1;
}
if ((player->effects & BOOST_EFFECT) == BOOST_EFFECT) {
if ((player->effects & MUSHROOM_EFFECT) == MUSHROOM_EFFECT) {
D_80164A08[playerIndex] = 2;
}
if ((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT) {
@ -1036,7 +1042,8 @@ void func_8001F394(Player* player, f32* arg1) {
if ((player->soundEffects & 0x100) == 0x100) {
D_80164A08[playerIndex] = 4;
}
if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((player->effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT)) {
D_80164A08[playerIndex] = 5;
}
D_80164498[playerIndex] = 0.0f;
@ -1055,7 +1062,7 @@ void func_8001F394(Player* player, f32* arg1) {
}
break;
case 2:
if ((player->effects & BOOST_EFFECT) == BOOST_EFFECT) {
if ((player->effects & MUSHROOM_EFFECT) == MUSHROOM_EFFECT) {
if (player->boostTimer != 0) {
move_f32_towards(&D_80164498[playerIndex], 8.0f, 0.2f);
}
@ -1070,7 +1077,7 @@ void func_8001F394(Player* player, f32* arg1) {
break;
case 3:
if (((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT) &&
((player->effects & 8) == 8)) {
((player->effects & MIDAIR_EFFECT) == MIDAIR_EFFECT)) {
move_f32_towards(&D_80164498[playerIndex], 20.0f, 0.1f);
} else {
if (D_80164498[playerIndex] > 1.0f) {
@ -1094,7 +1101,8 @@ void func_8001F394(Player* player, f32* arg1) {
}
break;
case 5:
if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((player->effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT)) {
move_f32_towards(&D_80164498[playerIndex], 18.0f, 0.2f);
} else {
if (D_80164498[playerIndex] > 1.0f) {

View File

@ -73,13 +73,13 @@ void func_8003E048(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
arg3[2] = (-(player->slopeAccel / 182) * 0xB4);
player_decelerate_alternative(player, 4.0f);
player->unk_DAC = 0.5f;
if ((player->effects & BOOST_EFFECT) != 0) {
remove_boost_effect(player);
if ((player->effects & MUSHROOM_EFFECT) != 0) {
remove_mushroom_effect(player);
player->currentSpeed /= 2;
player->unk_08C /= 2;
}
} else if ((((player->speed / 18.0f) * 216.0f) > 20.0f) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000)) {
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
arg3[0] = ((player->unk_206 / 182) * 0x32);
arg3[2] = (-(player->slopeAccel / 182) * 0x3C);
} else {
@ -102,13 +102,13 @@ void func_8003E37C(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
player_decelerate_alternative(player, 5.0f);
}
player->unk_DAC = 0.5f;
if ((player->effects & BOOST_EFFECT) != 0) {
remove_boost_effect(player);
if ((player->effects & MUSHROOM_EFFECT) != 0) {
remove_mushroom_effect(player);
player->currentSpeed /= 2;
player->unk_08C /= 2;
}
} else if ((((player->speed / 18.0f) * 216.0f) > 20.0f) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000)) {
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
arg3[0] = ((player->unk_206 / 182) * 0x32);
arg3[2] = (-(player->slopeAccel / 182) * 0x32);
} else {
@ -130,7 +130,7 @@ void func_8003E6EC(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
player_decelerate_alternative(player, 4.0f);
func_8003DC40(player);
} else if ((((player->speed / 18.0f) * 216.0f) > 20.0f) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000)) {
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
arg3[0] = ((player->unk_206 / 182) * 0x32);
arg3[2] = (-(player->slopeAccel / 182) * 0x3C);
} else {
@ -153,7 +153,7 @@ void func_8003E9EC(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
func_8003DC40(player);
} else {
if ((((player->speed / 18.0f) * 216.0f) > 20.0f) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000)) {
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
if ((player->tyres[BACK_LEFT].surfaceType == ASPHALT) ||
(player->tyres[BACK_RIGHT].surfaceType == ASPHALT) ||
(player->tyres[FRONT_RIGHT].surfaceType == ASPHALT) ||
@ -167,7 +167,7 @@ void func_8003E9EC(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
arg3[0] = 0.0f;
arg3[2] = (-(player->slopeAccel / 182) * 0x32);
}
if ((player->effects & UNKNOWN_EFFECT_0x10000) != 0) {
if ((player->effects & TERRAIN_TUMBLE_EFFECT) != 0) {
arg3[0] = ((player->unk_206 / 182) * 0x78);
arg3[2] = (-(player->slopeAccel / 182) * 0xB4);
}
@ -187,7 +187,7 @@ void func_8003EE2C(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
player_decelerate_alternative(player, 4.0f);
func_8003DC40(player);
} else if ((((player->speed / 18.0f) * 216.0f) > 20.0f) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000)) {
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
arg3[0] = ((player->unk_206 / 182) * 0x32);
arg3[2] = (-(player->slopeAccel / 182) * 0x3C);
} else {
@ -213,7 +213,7 @@ void func_8003F138(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
player->unk_DAC = 0.5f;
arg3[0] = 0;
} else if ((((player->speed / 18.0f) * 216.0f) > 20.0f) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000)) {
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
arg3[0] = ((player->unk_206 / 182) * 0x78);
arg3[2] = (-(player->slopeAccel / 182) * 0x78);
arg3[0] = 0;
@ -268,7 +268,7 @@ void func_8003F46C(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4
#else
#endif
if (player->effects & UNKNOWN_EFFECT_0x10000) {
if (player->effects & TERRAIN_TUMBLE_EFFECT) {
player->unk_DAC = 0.5f;
}
}
@ -296,7 +296,7 @@ void func_8003F734(Player* player, Vec3f arg1, Vec3f arg2, f32* arg3, f32* arg4,
*arg5 += arg1[1] * player->collision.surfaceDistance[0] * 0.1;
*arg6 += arg1[2] * player->collision.surfaceDistance[0] * 1;
func_8002A5F4(arg1, *arg3, arg2, 1, 0);
if ((!(player->effects & UNKNOWN_EFFECT_0x10000)) && ((player->effects & 8) == 0)) {
if ((!(player->effects & TERRAIN_TUMBLE_EFFECT)) && ((player->effects & MIDAIR_EFFECT) == 0)) {
arg2[1] *= -1e-05;
}
} else {
@ -309,11 +309,11 @@ void func_8003F734(Player* player, Vec3f arg1, Vec3f arg2, f32* arg3, f32* arg4,
}
*arg6 += arg1[2] * player->collision.surfaceDistance[0] * 1;
func_8002A5F4(arg1, *arg3, arg2, 1.2f, 0);
if ((!(player->effects & UNKNOWN_EFFECT_0x10000)) && ((player->effects & 8) == 0)) {
if ((!(player->effects & TERRAIN_TUMBLE_EFFECT)) && ((player->effects & MIDAIR_EFFECT) == 0)) {
arg2[1] *= -1e-05;
}
}
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
temp_f12 = player->collision.surfaceDistance[0] * arg1[0];
temp_f14 = player->collision.surfaceDistance[0] * arg1[2];
if (((temp_f12 >= 0) && (temp_f14 >= 0)) || ((temp_f12 < 0) && (temp_f14 >= 0))) {
@ -350,7 +350,7 @@ void func_8003FBAC(Player* player, Vec3f arg1, Vec3f arg2, f32* arg3, f32* arg4,
*arg5 += arg1[1] * player->collision.surfaceDistance[1] * 0.1;
*arg6 += arg1[2] * player->collision.surfaceDistance[1] * 1;
func_8002A5F4(arg1, *arg3, arg2, 1, 0);
if ((!(player->effects & UNKNOWN_EFFECT_0x10000)) && ((player->effects & 8) == 0)) {
if ((!(player->effects & TERRAIN_TUMBLE_EFFECT)) && ((player->effects & MIDAIR_EFFECT) == 0)) {
arg2[1] *= -1e-05;
}
} else {
@ -363,11 +363,11 @@ void func_8003FBAC(Player* player, Vec3f arg1, Vec3f arg2, f32* arg3, f32* arg4,
}
*arg6 += arg1[2] * player->collision.surfaceDistance[1] * 1;
func_8002A5F4(arg1, *arg3, arg2, 1.2f, 0);
if ((!(player->effects & UNKNOWN_EFFECT_0x10000)) && ((player->effects & 8) == 0)) {
if ((!(player->effects & TERRAIN_TUMBLE_EFFECT)) && ((player->effects & MIDAIR_EFFECT) == 0)) {
arg2[1] *= -1e-05;
}
}
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
temp_f12 = player->collision.surfaceDistance[1] * arg1[0];
temp_f14 = player->collision.surfaceDistance[1] * arg1[2];
if (((temp_f12 >= 0) && (temp_f14 >= 0)) || ((temp_f12 >= 0) && (temp_f14 < 0))) {

View File

@ -1442,7 +1442,8 @@ void func_8005A14C(s32 playerId) {
objectIndex = D_8018CE10[playerId].objectIndex;
lapCount = gLapCountByPlayerId[playerId];
if (player->type & PLAYER_EXISTS) {
if (player->effects & 0x204C0) {
if (player->effects &
(LIGHTNING_STRIKE_EFFECT | HIT_BY_GREEN_SHELL_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) {
gObjectList[objectIndex].direction_angle[2] += 0x1000;
} else {
if (gObjectList[objectIndex].direction_angle[2] != 0) {
@ -1454,12 +1455,12 @@ void func_8005A14C(s32 playerId) {
} else {
f32_step_towards(&gObjectList[objectIndex].sizeScaling, 0.6f, 0.02f);
}
if (player->effects & HIT_EFFECT) {
if (player->effects & SQUISH_EFFECT) {
u16_step_up_towards(&gObjectList[objectIndex].direction_angle[0], 0x0C00U, 0x0100U);
} else {
u16_step_down_towards(&gObjectList[objectIndex].direction_angle[0], 0, 0x00000100);
}
if (player->effects & 0x03000000) {
if (player->effects & (HIT_BY_STAR_EFFECT | EXPLOSION_CRASH_EFFECT)) {
func_80087D24(objectIndex, 6.0f, 1.5f, 0.0f);
} else {
f32_step_towards(&gObjectList[objectIndex].offset[1], 0.0f, 1.0f);
@ -3376,7 +3377,7 @@ void func_8005F90C(Player* player, s16 arg1, s32 arg2, UNUSED s8 arg3, UNUSED s8
f32 var_f12;
var_t1 = 0;
if ((player->effects & 0x80) == 0x80) {
if ((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) {
var_f0 = player->pos[0];
var_f2 = player->pos[1] - player->boundingBoxSize;
var_f12 = player->pos[2];
@ -3584,7 +3585,7 @@ void func_80060504(Player* player, s16 arg1, s32 arg2, UNUSED s8 arg3, UNUSED s8
player->particles[arg1].unk_024 = 0.0f;
if ((player->unk_044 & 0x20) == 0x20) {
player->particles[arg1].unk_040 = 0;
if ((player->effects & BOOST_EFFECT) == BOOST_EFFECT) {
if ((player->effects & MUSHROOM_EFFECT) == MUSHROOM_EFFECT) {
set_particle_colour(&player->particles[arg1], 0x00FFFF00, 0x0080);
player->particles[arg1].red = 1;
} else {
@ -3593,7 +3594,7 @@ void func_80060504(Player* player, s16 arg1, s32 arg2, UNUSED s8 arg3, UNUSED s8
}
} else {
player->particles[arg1].unk_040 = 1;
if ((player->effects & BOOST_EFFECT) == BOOST_EFFECT) {
if ((player->effects & MUSHROOM_EFFECT) == MUSHROOM_EFFECT) {
set_particle_colour(&player->particles[arg1], 0x00FFFF00, 0x0080);
player->particles[arg1].red = 1;
} else {
@ -3824,8 +3825,8 @@ void func_80061754(Player* player, s16 arg1, UNUSED s32 arg2, UNUSED s32 arg3, U
sp48 = random_int(2U);
set_particle_position_and_rotation(player, &player->particles[0x1E + arg1], 0.0f, 0.0f, 0.0f, (s8) 0, (s8) 0);
init_new_particle_player(&player->particles[0x1E + arg1], 6, 1.0f);
if ((player->effects & HIT_BY_ITEM_EFFECT) || ((player->effects) & UNKNOWN_EFFECT_0x1000000) ||
((player->effects) & 0x400) || ((player->effects) & BOO_EFFECT)) {
if ((player->effects & HIT_BY_STAR_EFFECT) || ((player->effects) & EXPLOSION_CRASH_EFFECT) ||
((player->effects) & HIT_BY_GREEN_SHELL_EFFECT) || ((player->effects) & BOO_EFFECT)) {
set_particle_colour(&player->particles[0x1E + arg1], 0x00FFFFFF, 0x00A0);
player->particles[0x1E + arg1].red -= temp_s1;
player->particles[0x1E + arg1].green -= temp_s1;
@ -4260,7 +4261,7 @@ void func_80062C74(Player* player, s16 arg1, UNUSED s32 arg2, UNUSED s32 arg3) {
} else {
var_f6 = -((player->unk_098 / 6000.0f) + 0.1);
}
if (((player->effects & BOOST_EFFECT) == BOOST_EFFECT) && (player->particles[arg1].timer >= 6)) {
if (((player->effects & MUSHROOM_EFFECT) == MUSHROOM_EFFECT) && (player->particles[arg1].timer >= 6)) {
player->particles[arg1].scale = player->particles[arg1].scale + 0.06;
}
player->particles[arg1].unk_010++;
@ -4382,7 +4383,7 @@ void func_80063408(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) {
++player->particles[10 + arg1].timer;
player->particles[10 + arg1].pos[1] += 1.0f;
if (((player->effects & 0x80) != 0) || ((player->effects & 0x40) != 0)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) != 0) || ((player->effects & DRIVING_SPINOUT_EFFECT) != 0)) {
player->particles[10 + arg1].IsAlive = 0;
player->particles[10 + arg1].timer = 0;
}
@ -4444,7 +4445,7 @@ void func_800635D4(Player* player, s16 arg1, UNUSED s8 arg2, UNUSED s8 arg3) {
++player->particles[10 + arg1].timer;
player->particles[10 + arg1].pos[1] += 0.2;
if (((player->effects & 0x80) != 0) || ((player->effects & 0x40) != 0)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) != 0) || ((player->effects & DRIVING_SPINOUT_EFFECT) != 0)) {
player->particles[10 + arg1].IsAlive = 0;
player->particles[10 + arg1].timer = 0;
}
@ -4927,13 +4928,14 @@ void func_800650FC(Player* player, UNUSED s8 arg1, UNUSED s8 arg2, s8 arg3) {
player->particles[20 + arg3].pos[2] = (f32) player->pos[2];
player->particles[20 + arg3].pos[0] = (f32) player->pos[0];
player->particles[20 + arg3].pos[1] = (f32) (player->pos[1] + 4.0f);
if ((player->effects & 0x80) == 0x80) {
if ((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) {
player->particles[20 + arg3].rotation += 4732;
} else {
player->particles[20 + arg3].rotation -= 4732;
}
if (((player->effects & 0x80) != 0x80) && ((player->effects & 0x40) != 0x40)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) != BANANA_SPINOUT_EFFECT) &&
((player->effects & DRIVING_SPINOUT_EFFECT) != DRIVING_SPINOUT_EFFECT)) {
player->particles[20 + arg3].IsAlive = 0;
player->particles[20 + arg3].timer = 0;
player->particles[20 + arg3].type = 0;
@ -4993,7 +4995,8 @@ void func_8006538C(Player* player, s8 playerIndex, s16 arg2, s8 arg3) {
spAC[0] = 0;
spAC[1] = player->unk_048[arg3];
spAC[2] = 0;
if ((player->effects & STAR_EFFECT) && (((s32) gCourseTimer - gPlayerStarEffectStartTime[playerIndex]) < STAR_EFFECT_DURATION - 1)) {
if ((player->effects & STAR_EFFECT) &&
(((s32) gCourseTimer - gPlayerStarEffectStartTime[playerIndex]) < STAR_EFFECT_DURATION - 1)) {
primRed = (primColors[1] >> 0x10) & 0xFF;
primGreen = (primColors[1] >> 0x08) & 0xFF;
primBlue = (primColors[1] >> 0x00) & 0xFF;
@ -6262,17 +6265,19 @@ void func_8006C6AC(Player* player, s16 arg1, s8 arg2, s8 arg3) {
} else {
if (player->unk_0DE & 1) {
func_80060BCC(player, arg1, sp28, arg2_copy, arg3);
} else if (!(player->effects & 8) && !(player->effects & 2)) {
if (((player->effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) &&
} else if (!(player->effects & MIDAIR_EFFECT) && !(player->effects & HOP_EFFECT)) {
if (((player->effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) &&
((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
check_drift_particles_setup_valid(player, arg1, sp28, arg2_copy, arg3);
} else if (((f64) (D_801652A0[arg2_copy] - player->tyres[BACK_RIGHT].baseHeight) >= 3.5) ||
((f64) (D_801652A0[arg2_copy] - player->tyres[BACK_LEFT].baseHeight) >= 3.5)) {
func_8005EA94(player, arg1, sp28, arg2_copy, arg3);
} else if (((player->effects & 0x80) == 0x80) || ((player->effects & 0x40) == 0x40)) {
} else if (((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((player->effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT)) {
func_8005F90C(player, arg1, sp28, arg2_copy, arg3);
} else if (((player->effects & 0x4000) && !(player->type & PLAYER_START_SEQUENCE)) ||
(player->effects & 0x800) || (player->effects & 0x20) || (player->unk_044 & 0x4000)) {
} else if (((player->effects & EARLY_START_SPINOUT_EFFECT) && !(player->type & PLAYER_START_SEQUENCE)) ||
(player->effects & BANANA_NEAR_SPINOUT_EFFECT) || (player->effects & AB_SPIN_EFFECT) ||
(player->unk_044 & 0x4000)) {
func_8005ED48(player, arg1, sp28, arg2_copy, arg3);
} else {
setup_tyre_particles(player, arg1, sp28, arg2_copy, arg3);
@ -6336,9 +6341,9 @@ void func_8006C9B8(Player* player, s16 arg1, s8 playerIndex, s8 arg3) {
return;
}
if (((((player->unk_0CA & 0x1000) == 0x1000) ||
((player->unk_0E0 < 2) && (player->effects & UNKNOWN_EFFECT_0x1000000))) ||
((player->unk_0E0 < 2) && (player->effects & HIT_BY_ITEM_EFFECT))) ||
(player->effects & 0x400)) {
((player->unk_0E0 < 2) && (player->effects & EXPLOSION_CRASH_EFFECT))) ||
((player->unk_0E0 < 2) && (player->effects & HIT_BY_STAR_EFFECT))) ||
(player->effects & HIT_BY_GREEN_SHELL_EFFECT)) {
func_8006199C(player, arg1, sp28, playerIndex, arg3);
player->unk_046 &= ~0x0008;
player->unk_044 &= ~0x0100;
@ -6350,7 +6355,8 @@ void func_8006C9B8(Player* player, s16 arg1, s8 playerIndex, s8 arg3) {
player->unk_044 &= ~0x0100;
return;
}
if ((player->effects & STAR_EFFECT) && ((((s32) gCourseTimer) - gPlayerStarEffectStartTime[playerIndex]) < STAR_EFFECT_DURATION - 1)) {
if ((player->effects & STAR_EFFECT) &&
((((s32) gCourseTimer) - gPlayerStarEffectStartTime[playerIndex]) < STAR_EFFECT_DURATION - 1)) {
func_800615AC(player, arg1, sp28, playerIndex, arg3);
player->unk_046 &= ~0x0008;
player->unk_044 &= ~0x0100;
@ -6367,11 +6373,11 @@ void func_8006C9B8(Player* player, s16 arg1, s8 playerIndex, s8 arg3) {
player->unk_044 &= ~0x0100;
return;
}
if ((player->effects & BOOST_EFFECT) && (player->type & PLAYER_HUMAN)) {
if ((player->effects & MUSHROOM_EFFECT) && (player->type & PLAYER_HUMAN)) {
func_800621BC(player, arg1, sp28, playerIndex, arg3);
return;
}
if (((player->effects & 0x200000) || (player->effects & BOOST_RAMP_ASPHALT_EFFECT)) &&
if (((player->effects & CPU_FAST_EFFECT) || (player->effects & BOOST_RAMP_ASPHALT_EFFECT)) &&
((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
func_80061EF4(player, arg1, sp28, playerIndex, arg3);
player->unk_046 &= ~0x0008;
@ -6414,7 +6420,7 @@ void func_8006CEC0(Player* arg0, s16 arg1, s8 arg2, s8 arg3) {
if ((arg0->unk_044 & 0x200) && (arg0->type & 0x4000)) {
func_80061224(arg0, arg1, sp20, arg2, arg3);
return;
} else if (((arg0->effects & 0x40000000) == 0x40000000) && (arg0->unk_0B0 < 0x32)) {
} else if (((arg0->effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) && (arg0->unk_0B0 < 0x32)) {
func_80061094(arg0, arg1, sp20, arg2, arg3);
return;
} else if ((arg0->type & 0x4000) == 0x4000) {
@ -6428,8 +6434,9 @@ void func_8006CEC0(Player* arg0, s16 arg1, s8 arg2, s8 arg3) {
}
switch (gActiveScreenMode) {
case SCREEN_MODE_1P:
if (((arg0->effects & 0x04000000) != 0x04000000) && ((arg0->effects & 0x400) != 0x400) &&
((arg0->effects & UNKNOWN_EFFECT_0x1000000) != UNKNOWN_EFFECT_0x1000000)) {
if (((arg0->effects & SQUISH_EFFECT) != SQUISH_EFFECT) &&
((arg0->effects & HIT_BY_GREEN_SHELL_EFFECT) != HIT_BY_GREEN_SHELL_EFFECT) &&
((arg0->effects & EXPLOSION_CRASH_EFFECT) != EXPLOSION_CRASH_EFFECT)) {
if (((arg0->unk_0CA & 2) != 2) && ((arg0->unk_0CA & 0x10) != 0x10) && !(arg0->unk_0CA & 0x100)) {
func_80060504(arg0, arg1, sp20, arg2, arg3);
}
@ -6440,9 +6447,9 @@ void func_8006CEC0(Player* arg0, s16 arg1, s8 arg2, s8 arg3) {
case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL:
case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL:
case SCREEN_MODE_3P_4P_SPLITSCREEN:
if (((arg0->type & 0x4000) != 0) && ((arg0->effects & 0x04000000) != 0x04000000) &&
((arg0->effects & 0x400) != 0x400) &&
((arg0->effects & UNKNOWN_EFFECT_0x1000000) != UNKNOWN_EFFECT_0x1000000)) {
if (((arg0->type & 0x4000) != 0) && ((arg0->effects & SQUISH_EFFECT) != SQUISH_EFFECT) &&
((arg0->effects & HIT_BY_GREEN_SHELL_EFFECT) != HIT_BY_GREEN_SHELL_EFFECT) &&
((arg0->effects & EXPLOSION_CRASH_EFFECT) != EXPLOSION_CRASH_EFFECT)) {
if (((arg0->unk_0CA & 2) != 2) && ((arg0->unk_0CA & 0x10) != 0x10) && !(arg0->unk_0CA & 0x100)) {
func_80060504(arg0, arg1, sp20, arg2, arg3);
}

View File

@ -976,7 +976,7 @@ void func_80089020(s32 playerId, f32* arg1) {
} else {
var_f2 = -*arg1;
}
if (player->effects & 0xC0) {
if (player->effects & (BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) {
if (gCurrentCourseId == COURSE_SHERBET_LAND) {
if (var_f2 <= 0.5) {
var_f0 = 0.025f;
@ -1043,7 +1043,7 @@ f32 func_8008933C(Player* player, s32 objectIndex, f32 arg2, f32 arg3) {
if (temp_v1->unk_18[6] == 0) {
object = &gObjectList[objectIndex];
player->unk_046 |= 2;
player->effects |= 0x8000;
player->effects |= ENEMY_BONK_EFFECT;
temp_v1->unk_18[6] = 4;
something = (player->pos[0] - object->pos[0]) * object->velocity[0];
if (something >= 0.0f) {
@ -1181,7 +1181,7 @@ s32 func_80089B50(s32 objectIndex) {
player = gPlayerOne;
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++, test++) {
if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | UNKNOWN_EFFECT_0x1000000)) &&
if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | EXPLOSION_CRASH_EFFECT)) &&
(player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) &&
(has_collided_horizontally_with_player(objectIndex, player) != 0)) {
if (!(player->effects & STAR_EFFECT)) {
@ -1208,7 +1208,7 @@ s32 func_80089CBC(s32 objectIndex, f32 arg1) {
player = gPlayerOne;
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++) {
if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | UNKNOWN_EFFECT_0x1000000))) {
if ((gObjectList[objectIndex].state != 0) && !(player->effects & (BOO_EFFECT | EXPLOSION_CRASH_EFFECT))) {
if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) &&
(has_collided_with_player_and_within_height(objectIndex, player, arg1) != 0)) {
if (!(player->effects & STAR_EFFECT)) {
@ -1234,7 +1234,8 @@ s32 func_80089E18(s32 objectIndex) {
player = gPlayerOne;
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++) {
if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x800000C0) &&
if ((gObjectList[objectIndex].state != 0) &&
!(player->effects & (BOO_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) &&
(has_collided_horizontally_with_player(objectIndex, player) != 0)) {
if (player->effects & STAR_EFFECT) {
var_s6 = 1;
@ -1256,7 +1257,8 @@ s32 func_80089F24(s32 objectIndex) {
player = gPlayerOne;
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++) {
if ((gObjectList[objectIndex].state != 0) && !(player->effects & 0x800002C0)) {
if ((gObjectList[objectIndex].state != 0) &&
!(player->effects & (BOO_EFFECT | STAR_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT))) {
if ((player->type & PLAYER_EXISTS) && !(player->type & PLAYER_INVISIBLE_OR_BOMB) &&
(has_collided_horizontally_with_player(objectIndex, player) != 0)) {
var_s7 = 1;

View File

@ -1239,7 +1239,7 @@ void update_player_path_completion(s32 playerId, Player* player) {
s16 var_t0 = 0;
if (gCurrentCourseId == COURSE_KALAMARI_DESERT) {
D_801634EC = 0;
if (player->effects & 0x200) {
if (player->effects & STAR_EFFECT) {
D_801634EC = 1;
}
if (gIsMirrorMode != 0) {
@ -1353,14 +1353,15 @@ void update_vehicles(void) {
void play_cpu_sound_effect(s32 arg0, Player* player) {
if (D_80163398[arg0] >= 0xB) {
if ((player->effects & 0x80) || (player->effects & 0x40) || (player->effects & 0x20000)) {
if ((player->effects & BANANA_SPINOUT_EFFECT) || (player->effects & DRIVING_SPINOUT_EFFECT) ||
(player->effects & LIGHTNING_STRIKE_EFFECT)) {
func_800C92CC(arg0, SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x0A));
D_80163398[arg0] = 0;
}
}
if (D_801633B0[arg0] >= 0xB) {
if ((player->soundEffects & REVERSE_EFFECT) || (player->soundEffects & 0x01000000) ||
(player->soundEffects & 2) || (player->soundEffects & 4) || (player->effects & HIT_EFFECT)) {
if ((player->soundEffects & 0x400000) || (player->soundEffects & 0x01000000) || (player->soundEffects & 2) ||
(player->soundEffects & 4) || (player->effects & SQUISH_EFFECT)) {
func_800C92CC(arg0, SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x0B));
D_801633B0[arg0] = 0;
}
@ -1481,7 +1482,7 @@ void update_player(s32 playerId) {
break;
}
D_801631E0[playerId] = false;
if ((player->effects & UNKNOWN_EFFECT_0x1000) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) {
if ((player->effects & LOST_RACE_EFFECT) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) {
D_801631E0[playerId] = true;
}
if ((D_801646CC == 1) || (player->type & PLAYER_CINEMATIC_MODE) ||
@ -1520,7 +1521,7 @@ void update_player(s32 playerId) {
}
if (D_801631E0[playerId] == true) {
D_801630E8[playerId] = 0;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
if ((playerId & 1) != (gIncrementUpdatePlayer & 1)) {
apply_cpu_turn(player, 0);
regulate_cpu_speed(playerId, gPreviousCpuTargetSpeed[playerId], player);
@ -1542,7 +1543,8 @@ void update_player(s32 playerId) {
determine_ideal_cpu_position_offset(playerId, gCurrentNearestPathPoint);
distX = gOffsetPosition[0] - player->pos[0];
minAngle = gOffsetPosition[2] - player->pos[2];
if (!(player->effects & 0x80) && !(player->effects & 0x40) && !(player->effects & 0x800)) {
if (!(player->effects & BANANA_SPINOUT_EFFECT) && !(player->effects & DRIVING_SPINOUT_EFFECT) &&
!(player->effects & BANANA_NEAR_SPINOUT_EFFECT)) {
if (((distX * distX) + (minAngle * minAngle)) > 6400.0f) {
if (gPlayerPathIndex == 0) {
func_8000B140(playerId);
@ -1564,7 +1566,7 @@ void update_player(s32 playerId) {
return;
}
if ((D_801630E8[playerId] == 1) || (D_801630E8[playerId] == -1)) {
player->effects |= UNKNOWN_EFFECT_0x10;
player->effects |= DRIFTING_EFFECT;
}
if (D_801630E8[playerId] != 0) {
sPlayerAngle[playerId] = -get_xz_angle_between_points(player->oldPos, player->pos);
@ -1596,13 +1598,13 @@ void update_player(s32 playerId) {
case -1:
if (steeringSensitivity > 5) {
D_801630E8[playerId] = 0;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
}
break;
case 1:
if (steeringSensitivity < -5) {
D_801630E8[playerId] = 0;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
}
break;
default:
@ -1699,9 +1701,9 @@ void update_player(s32 playerId) {
if ((cpu_BehaviourState[playerId] == CPU_BEHAVIOUR_STATE_RUNNING) &&
((gTrackPositionFactor[playerId] > 0.9f) || (gTrackPositionFactor[playerId] < -0.9f))) {
D_801630E8[playerId] = 0;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
}
if (player->effects & 2) {
if (player->effects & HOP_EFFECT) {
switch (D_801630E8[playerId]) {
case 1:
newAngle = 0x0035;
@ -1714,7 +1716,7 @@ void update_player(s32 playerId) {
(gPreviousAngleSteering[playerId] + ((angle * steeringSensitivity) / minAngle)) / 2;
break;
}
} else if (player->effects & (UNKNOWN_EFFECT_0x10000000 | UNKNOWN_EFFECT_0xC)) {
} else if (player->effects & (UNKNOWN_EFFECT_0x10000000 | MIDAIR_EFFECT | BOOST_RAMP_WOOD_EFFECT)) {
newAngle = 0;
} else {
newAngle = (gPreviousAngleSteering[playerId] + ((angle * steeringSensitivity) / minAngle)) / 2;
@ -1723,7 +1725,7 @@ void update_player(s32 playerId) {
gPreviousAngleSteering[playerId] = newAngle;
if ((gIsPlayerInCurve[playerId] == true) || (D_801630E8[playerId] == 1) ||
(D_801630E8[playerId] == -1) ||
(player->effects & (UNKNOWN_EFFECT_0x10000000 | UNKNOWN_EFFECT_0xC))) {
(player->effects & (UNKNOWN_EFFECT_0x10000000 | MIDAIR_EFFECT | BOOST_RAMP_WOOD_EFFECT))) {
cpu_TargetSpeed[playerId] = GET_COURSE_cpu_CurveTargetSpeed(gCCSelection);
} else {
cpu_TargetSpeed[playerId] = GET_COURSE_cpu_NormalTargetSpeed(gCCSelection);
@ -1738,7 +1740,7 @@ void update_player(s32 playerId) {
cpu_TargetSpeed[playerId] = 3.3333333f;
}
gCurrentCpuTargetSpeed = cpu_TargetSpeed[playerId];
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
gPreviousCpuTargetSpeed[playerId] = gCurrentCpuTargetSpeed;
check_ai_crossing_distance(playerId);
regulate_cpu_speed(playerId, gCurrentCpuTargetSpeed, player);
@ -1771,7 +1773,7 @@ void func_8000B140(s32 playerId) {
Player* player;
player = &gPlayers[playerId];
if (player->effects & UNKNOWN_EFFECT_0x10) {
if (player->effects & DRIFTING_EFFECT) {
return;
}
@ -2421,7 +2423,7 @@ void func_80015390(Camera* camera, UNUSED Player* player, UNUSED s32 arg2) {
} else {
var_a2 = 0xA0 + (temp_s1->unk_078 / 16);
}
if (!((temp_s1->effects & 0x80) || (temp_s1->effects & 0x40))) {
if (!((temp_s1->effects & BANANA_SPINOUT_EFFECT) || (temp_s1->effects & DRIVING_SPINOUT_EFFECT))) {
adjust_angle(&camera->unk_2C, temp_s1->rotation[1], var_a2);
}
func_8001D794(temp_s1, camera, sp64, &sp84, &sp80, &sp7C, camera->unk_2C);
@ -3707,7 +3709,7 @@ void func_8001A450(s32 playerId, s32 arg1, s32 arg2) {
s16 pathPoint;
s32 temp_v0;
if (!(gPlayers[playerId].effects & (UNKNOWN_EFFECT_0x10000000 | UNKNOWN_EFFECT_0xC))) {
if (!(gPlayers[playerId].effects & (UNKNOWN_EFFECT_0x10000000 | MIDAIR_EFFECT | BOOST_RAMP_WOOD_EFFECT))) {
temp_v1 = D_80164680[arg1];
pathPoint = gNearestPathPointByCameraId[arg1];
temp_v0 = func_8001A310(pathPoint, (temp_v1 + 1) % 10);
@ -4439,7 +4441,7 @@ void cpu_use_item_strategy(s32 playerId) {
if (cpuStrategy->timer < 10000) {
cpuStrategy->timer += 1;
}
if (player->effects & (BOO_EFFECT | BOOST_EFFECT | STAR_EFFECT)) { // 0x80002200
if (player->effects & (BOO_EFFECT | MUSHROOM_EFFECT | STAR_EFFECT)) {
cpuStrategy->timer = 0;
}
}
@ -4549,12 +4551,12 @@ void func_8001C14C(void) {
D_80163480 = 0;
}
} else if (D_8016347E == 0) {
if (!(temp_s0->effects & UNKNOWN_EFFECT_0x1000000)) {
if (!(temp_s0->effects & EXPLOSION_CRASH_EFFECT)) {
temp_s0->type |= 0x2000;
}
D_8016347E = 1;
D_80163484 = 0;
} else if (!(temp_s0->effects & UNKNOWN_EFFECT_0x1000000)) {
} else if (!(temp_s0->effects & EXPLOSION_CRASH_EFFECT)) {
temp_s0->type |= 0x2000;
}
}

View File

@ -47,7 +47,7 @@ void cpu_behaviour_start(s32 playerId, Player* player) {
break;
case BEHAVIOUR_HOP:
kart_hop(player);
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
D_801630E8[playerId] = 0;
break;
case BEHAVIOUR_DRIVE_CENTER:
@ -74,7 +74,7 @@ void cpu_behaviour_start(s32 playerId, Player* player) {
case BEHAVIOUR_9:
D_801633F8[playerId] = 1;
D_801631E0[playerId] = false;
gPlayers[playerId].effects &= ~UNKNOWN_EFFECT_0x1000;
gPlayers[playerId].effects &= ~LOST_RACE_EFFECT;
break;
case BEHAVIOUR_10:
D_801633F8[playerId] = 0;
@ -95,7 +95,7 @@ void cpu_behaviour_end(s32 playerIndex, Player* player) {
if (nearestPathPoint >= pathPointEnd) {
switch (behaviourType) {
case BEHAVIOUR_1:
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
D_801630E8[playerIndex] = 0;
cpu_BehaviourState[playerIndex] = CPU_BEHAVIOUR_STATE_START;
break;
@ -144,7 +144,7 @@ void func_80011EC0(s32 playerIndex, Player* player, s32 arg2, UNUSED u16 arg3) {
if ((arg2 >= -9) && (D_80162FF8[playerIndex] == 0)) {
if ((gTrackPositionFactor[playerIndex] > -0.8) && (gTrackPositionFactor[playerIndex] < 0.5)) {
kart_hop(player);
player->effects |= UNKNOWN_EFFECT_0x10;
player->effects |= DRIFTING_EFFECT;
D_801630E8[playerIndex] = 1;
break;
}
@ -156,7 +156,7 @@ void func_80011EC0(s32 playerIndex, Player* player, s32 arg2, UNUSED u16 arg3) {
if ((arg2 < 0xA) && (D_80162FF8[playerIndex] == 0)) {
if ((gTrackPositionFactor[playerIndex] > -0.5) && (gTrackPositionFactor[playerIndex] < 0.8)) {
kart_hop(player);
player->effects |= UNKNOWN_EFFECT_0x10;
player->effects |= DRIFTING_EFFECT;
D_801630E8[playerIndex] = -1;
break;
}

View File

@ -147,7 +147,7 @@ void func_8000DF8C(s32 bombKartId) {
for (var_a0 = 0; var_a0 < gPlayerCount; var_a0++) {
var_v0 = &gPlayers[var_a0];
if (!(var_v0->effects & 0x80000000)) {
if (!(var_v0->effects & BOO_EFFECT)) {
temp_f0 = var_f22 - var_v0->pos[0];
temp_f2 = var_f20 - var_v0->pos[1];
temp_f12 = var_f24 - var_v0->pos[2];

View File

@ -11,13 +11,13 @@ void func_80007D04(s32 playerId, Player* player) {
s16 val2 = temp_t2 - temp_t1;
if (val2 > 400 && val1 >= 6) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_accelerate_alternative(player);
D_801634C0[playerId] = 4;
return;
}
} else {
player->effects |= UNKNOWN_EFFECT_0x200000;
player->effects |= CPU_FAST_EFFECT;
player_accelerate_alternative(player);
D_801634C0[playerId] = 3;
return;
@ -63,19 +63,19 @@ void func_80007D04(s32 playerId, Player* player) {
}
if (temp_t2 < temp_t1) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player->effects |= CPU_FAST_EFFECT;
player_accelerate_alternative(player);
D_801634C0[playerId] = 1;
} else if (temp_t2 < (temp_t1 + var_v0 + 0x32)) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_accelerate_alternative(player);
D_801634C0[playerId] = 3;
} else if (D_801631E0[playerId] == false) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_accelerate_alternative(player);
D_801634C0[playerId] = 2;
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_decelerate_alternative(player, 1.0f);
D_801634C0[playerId] = -1;
}
@ -133,9 +133,9 @@ void regulate_cpu_speed(s32 playerId, f32 targetSpeed, Player* player) {
s32 var_a1;
speed = player->speed;
if (!(player->effects & 0x80) && !(player->effects & 0x40) && !(player->effects & 0x20000) &&
!(player->soundEffects & 0x400000) && !(player->soundEffects & 0x01000000) && !(player->soundEffects & 2) &&
!(player->soundEffects & 4)) {
if (!(player->effects & BANANA_SPINOUT_EFFECT) && !(player->effects & DRIVING_SPINOUT_EFFECT) &&
!(player->effects & LIGHTNING_STRIKE_EFFECT) && !(player->soundEffects & 0x400000) &&
!(player->soundEffects & 0x01000000) && !(player->soundEffects & 2) && !(player->soundEffects & 4)) {
if (gCurrentCourseId == COURSE_AWARD_CEREMONY) {
func_80007FA4(playerId, player, speed);
} else if ((bStopAICrossing[playerId] == true) && !(player->effects & (STAR_EFFECT | BOO_EFFECT))) {
@ -158,34 +158,34 @@ void regulate_cpu_speed(s32 playerId, f32 targetSpeed, Player* player) {
break;
}
if (speed < var_f0) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_accelerate_alternative(player);
} else if (player->type & PLAYER_CINEMATIC_MODE) {
if (speed < targetSpeed) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_accelerate_alternative(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_decelerate_alternative(player, 1.0f);
}
} else if ((D_801631E0[playerId] == true) && (D_80163330[playerId] != 1)) {
if (func_800088D8(playerId, gLapCountByPlayerId[playerId], gGPCurrentRaceRankByPlayerIdDup[playerId]) ==
1) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player->effects |= CPU_FAST_EFFECT;
player_accelerate_alternative(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_decelerate_alternative(player, 1.0f);
}
} else {
var_a1 = 1;
switch (gSpeedCPUBehaviour[playerId]) { /* switch 1; irregular */
case SPEED_CPU_BEHAVIOUR_FAST: /* switch 1 */
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_accelerate_alternative(player);
break;
case SPEED_CPU_BEHAVIOUR_MAX: /* switch 1 */
player->effects |= UNKNOWN_EFFECT_0x200000;
player->effects |= CPU_FAST_EFFECT;
player_accelerate_alternative(player);
break;
case SPEED_CPU_BEHAVIOUR_SLOW: /* switch 1 */
@ -207,14 +207,14 @@ void regulate_cpu_speed(s32 playerId, f32 targetSpeed, Player* player) {
func_80007D04(playerId, player);
} else if (func_800088D8(playerId, gLapCountByPlayerId[playerId],
gGPCurrentRaceRankByPlayerIdDup[playerId]) == true) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player->effects |= CPU_FAST_EFFECT;
player_accelerate_alternative(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
player_decelerate_alternative(player, 1.0f);
}
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player->effects &= ~CPU_FAST_EFFECT;
if (targetSpeed > 1.0f) {
player_decelerate_alternative(player, 2.0f);
} else {

View File

@ -361,7 +361,7 @@ void handle_trains_interactions(s32 playerId, Player* player) {
s32 passengerCarIndex;
if (D_801631E0[playerId] != true) {
if (!(player->effects & UNKNOWN_EFFECT_0x1000000)) {
if (!(player->effects & EXPLOSION_CRASH_EFFECT)) {
playerPosX = player->pos[0];
playerPosZ = player->pos[2];
for (trainIndex = 0; trainIndex < NUM_TRAINS; trainIndex++) {
@ -605,7 +605,7 @@ void handle_paddle_boats_interactions(Player* player) {
f32 playerZ;
f32 playerY;
if (!((player->effects & UNKNOWN_EFFECT_0x1000000)) && (!(player->effects & HIT_BY_ITEM_EFFECT))) {
if (!((player->effects & EXPLOSION_CRASH_EFFECT)) && (!(player->effects & HIT_BY_STAR_EFFECT))) {
playerX = player->pos[0];
playerY = player->pos[1];
playerZ = player->pos[2];
@ -788,7 +788,7 @@ void handle_vehicle_interactions(s32 playerId, Player* player, VehicleStuff* veh
f32 playerZ;
if (((D_801631E0[playerId] != true) || ((((player->type & PLAYER_HUMAN) != 0)) && !(player->type & PLAYER_CPU))) &&
!(player->effects & UNKNOWN_EFFECT_0x1000000)) {
!(player->effects & EXPLOSION_CRASH_EFFECT)) {
playerX = player->pos[0];
playerY = player->pos[1];

View File

@ -135,7 +135,7 @@ UNUSED void func_unnamed33(void) {
void func_8008C310(Player* player) {
if ((player->soundEffects & 2) || (player->soundEffects & 4) || ((player->soundEffects << 9) < 0) ||
(player->soundEffects & HIT_BY_ITEM_SOUND_EFFECT)) {
(player->soundEffects & HIT_BY_STAR_SOUND_EFFECT)) {
player->unk_0B6 = ((u16) player->unk_0B6 | 0x1000);
}
}
@ -145,33 +145,34 @@ UNUSED void func_unnamed34(void) {
void clean_effect(Player* player, s8 playerIndex) {
if ((player->effects & 0x400) == 0x400) {
if ((player->effects & HIT_BY_GREEN_SHELL_EFFECT) == HIT_BY_GREEN_SHELL_EFFECT) {
func_8008C6D0(player, playerIndex);
}
if (((player->effects & 0x80) == 0x80) || (player->effects & 0x40) == 0x40) {
if (((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
(player->effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) {
func_8008C8C4(player, playerIndex);
}
if ((player->effects & 0x800) == 0x800) {
if ((player->effects & BANANA_NEAR_SPINOUT_EFFECT) == BANANA_NEAR_SPINOUT_EFFECT) {
func_8008D0E4(player, playerIndex);
}
if ((player->unk_044 & 0x4000) != 0) {
func_8008D3B0(player, playerIndex);
}
if ((player->effects & BOOST_EFFECT) == BOOST_EFFECT) {
remove_boost_effect(player);
if ((player->effects & MUSHROOM_EFFECT) == MUSHROOM_EFFECT) {
remove_mushroom_effect(player);
}
if ((player->effects & 0x80000) == 0x80000) {
if ((player->effects & UNKNOWN_EFFECT_0x80000) == UNKNOWN_EFFECT_0x80000) {
func_8008D760(player);
}
if ((player->effects & 0x800000) == 0x800000) {
if ((player->effects & UNKNOWN_EFFECT_0x800000) == UNKNOWN_EFFECT_0x800000) {
func_8008D97C(player);
}
if ((player->effects & UNKNOWN_EFFECT_0x1000000) == UNKNOWN_EFFECT_0x1000000) {
if ((player->effects & EXPLOSION_CRASH_EFFECT) == EXPLOSION_CRASH_EFFECT) {
func_8008E884(player, playerIndex);
}
if ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) {
remove_hit_by_item_effect(player, playerIndex);
if ((player->effects & HIT_BY_STAR_EFFECT) == HIT_BY_STAR_EFFECT) {
remove_hit_by_star_effect(player, playerIndex);
}
if ((player->effects & BOOST_RAMP_ASPHALT_EFFECT) == BOOST_RAMP_ASPHALT_EFFECT) {
remove_boost_ramp_asphalt_effect(player);
@ -179,17 +180,17 @@ void clean_effect(Player* player, s8 playerIndex) {
if ((player->effects & BOOST_RAMP_WOOD_EFFECT) == BOOST_RAMP_WOOD_EFFECT) {
remove_boost_ramp_wood_effect(player);
}
if ((player->effects & 0x4000) == 0x4000) {
if ((player->effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) {
func_8008F3E0(player);
}
if ((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000) {
if ((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT) {
func_8008F5A4(player, playerIndex);
}
if ((player->effects & UNKNOWN_EFFECT_0x10000000) == UNKNOWN_EFFECT_0x10000000) {
func_8008FEDC(player, playerIndex);
}
player->unk_044 = (s16) (player->unk_044 & 0xFFFE);
player->effects = (s32) (player->effects & ~0x20);
player->effects = (s32) (player->effects & ~AB_SPIN_EFFECT);
}
void func_8008C528(Player* player, s8 playerIndex) {
@ -204,8 +205,8 @@ void func_8008C528(Player* player, s8 playerIndex) {
player->kartHopVelocity = D_800E3790[temp_v1];
player->unk_0A8 = 0;
player->effects = player->effects | 0x400;
player->effects = player->effects & ~0x10;
player->effects = player->effects | HIT_BY_GREEN_SHELL_EFFECT;
player->effects = player->effects & ~DRIFTING_EFFECT;
player->unk_0C0 = 0;
player->unk_236 = 2;
player->unk_042 = 0;
@ -241,7 +242,7 @@ void func_8008C6D0(Player* player, s8 playerIndex) {
player->unk_206 = 0;
player->slopeAccel = 0;
player->effects = (s32) (player->effects & ~0x400);
player->effects = (s32) (player->effects & ~HIT_BY_GREEN_SHELL_EFFECT);
player->unk_0A8 = 0;
player->unk_0C0 = 0;
player->unk_07C = 0;
@ -257,13 +258,14 @@ void func_8008C6D0(Player* player, s8 playerIndex) {
void func_8008C73C(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
if (((player->effects & UNKNOWN_EFFECT_0x80) != UNKNOWN_EFFECT_0x80) && ((player->effects & UNKNOWN_EFFECT_0x40) != UNKNOWN_EFFECT_0x40)) {
player->effects &= ~UNKNOWN_EFFECT_0x10;
if (((player->effects & BANANA_SPINOUT_EFFECT) != BANANA_SPINOUT_EFFECT) &&
((player->effects & DRIVING_SPINOUT_EFFECT) != DRIVING_SPINOUT_EFFECT)) {
player->effects &= ~DRIFTING_EFFECT;
if ((player->unk_0C0 / 182) >= 0) {
player->effects |= UNKNOWN_EFFECT_0x40;
player->effects |= DRIVING_SPINOUT_EFFECT;
} else {
player->effects |= UNKNOWN_EFFECT_0x80;
player->effects |= BANANA_SPINOUT_EFFECT;
}
player->unk_0B6 |= 0x80;
@ -291,13 +293,13 @@ void func_8008C73C(Player* player, s8 playerIndex) {
}
void func_8008C8C4(Player* player, s8 playerId) {
player->effects &= ~UNKNOWN_EFFECT_0x80;
player->effects &= ~UNKNOWN_EFFECT_0x40;
player->effects &= ~BANANA_SPINOUT_EFFECT;
player->effects &= ~DRIVING_SPINOUT_EFFECT;
player->unk_0A8 = 0;
player->rotation[1] = player->unk_0AE;
player->unk_07C = 0;
player->unk_0C0 = 0;
player->effects &= ~0x800;
player->effects &= ~BANANA_NEAR_SPINOUT_EFFECT;
D_80165190[0][playerId] = 1;
D_80165190[1][playerId] = 1;
@ -334,7 +336,7 @@ void func_8008C9EC(Player* player, s8 playerIndex) {
player_decelerate_alternative(player, 30.0f);
}
}
if ((player->effects & 0x80) == 0x80) {
if ((player->effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) {
player->rotation[1] -= sp30[player->unk_0B2];
D_8018D920[playerIndex] -= sp30[player->unk_0B2];
stackPadding1 = (u16) D_8018D920[playerIndex] / (0x10000 / (0x168 / (sp30[player->unk_0B2] / 182)));
@ -376,14 +378,14 @@ void func_8008CDC0(Player* player, s8 playerIndex) {
player->unk_0B4 = 0;
player->unk_0B8 = 3.0f;
player->unk_0AC = 1;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
if (((player->unk_07C >> 0x10) >= 0x14) || ((player->unk_07C >> 0x10) < -0x13) ||
(((player->speed / 18.0f) * 216.0f) <= 30.0f) || ((player->effects & 8) != 0) ||
(((player->type & PLAYER_HUMAN) == 0) && ((player->effects & UNKNOWN_EFFECT_0x1000) == 0))) {
(((player->speed / 18.0f) * 216.0f) <= 30.0f) || ((player->effects & MIDAIR_EFFECT) != 0) ||
(((player->type & PLAYER_HUMAN) == 0) && ((player->effects & LOST_RACE_EFFECT) == 0))) {
func_8008C73C(player, playerIndex);
} else {
player->effects |= 0x800;
player->effects |= BANANA_NEAR_SPINOUT_EFFECT;
}
}
@ -402,17 +404,17 @@ void func_8008CEB0(Player* player, s8 playerIndex) {
var_v1 = 0;
var_a3 = -var_a3;
var_f0 *= 0.8;
if ((player->effects & 1) == 1) {
player->effects |= 0x40000;
if ((player->effects & BRAKING_EFFECT) == BRAKING_EFFECT) {
player->effects |= BANANA_SPINOUT_SAVE_EFFECT;
}
if (var_f0 <= 1.0f) {
player->effects &= ~0x800;
if ((player->effects & 0x40000) != 0x40000) {
player->effects &= ~BANANA_NEAR_SPINOUT_EFFECT;
if ((player->effects & BANANA_SPINOUT_SAVE_EFFECT) != BANANA_SPINOUT_SAVE_EFFECT) {
func_8008C73C(player, playerIndex);
var_v1 = 0;
} else {
player->unk_0B6 |= 0x20;
player->effects &= ~0x40000;
player->effects &= ~BANANA_SPINOUT_SAVE_EFFECT;
if ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) {
func_800C90F4(playerIndex, (player->characterId * 0x10) + 0x29008008);
var_v1 = 0;
@ -431,14 +433,14 @@ void func_8008CEB0(Player* player, s8 playerIndex) {
player->unk_0B8 = var_f0;
player->unk_0B4 = var_v1;
player->unk_0AC = var_a3;
if (player->effects & 8) {
if (player->effects & MIDAIR_EFFECT) {
func_8008C73C(player, playerIndex);
player->effects &= ~0x800;
player->effects &= ~BANANA_NEAR_SPINOUT_EFFECT;
}
}
void func_8008D0E4(Player* player, UNUSED s8 playerIndex) {
player->effects &= ~0x800;
player->effects &= ~BANANA_NEAR_SPINOUT_EFFECT;
}
void func_8008D0FC(Player* player, s8 playerIndex) {
@ -448,7 +450,7 @@ void func_8008D0FC(Player* player, s8 playerIndex) {
player->unk_0B4 = 0;
player->unk_0B8 = 2.0f;
player->unk_0AC = 1;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
player->unk_044 |= 0x4000;
}
@ -467,17 +469,17 @@ void func_8008D170(Player* player, s8 playerIndex) {
var_v1 = 0;
var_a3 = -var_a3;
var_f0 *= 0.9;
if (((player->effects & 1) == 1) || !(player->unk_044 & 0x20)) {
player->effects |= 0x40000;
if (((player->effects & BRAKING_EFFECT) == BRAKING_EFFECT) || !(player->unk_044 & 0x20)) {
player->effects |= BANANA_SPINOUT_SAVE_EFFECT;
}
if (var_f0 <= 1.3) {
player->unk_044 &= ~0x4000;
if ((player->effects & 0x40000) != 0x40000) {
if ((player->effects & BANANA_SPINOUT_SAVE_EFFECT) != BANANA_SPINOUT_SAVE_EFFECT) {
func_8008C73C(player, playerIndex);
var_v1 = 0;
} else {
player->unk_0B6 |= 0x20;
player->effects &= ~0x40000;
player->effects &= ~BANANA_SPINOUT_SAVE_EFFECT;
if ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) {
func_800C90F4(playerIndex, (player->characterId * 0x10) + 0x29008008);
var_v1 = 0;
@ -496,7 +498,7 @@ void func_8008D170(Player* player, s8 playerIndex) {
player->unk_0B8 = var_f0;
player->unk_0B4 = var_v1;
player->unk_0AC = var_a3;
if (player->effects & 8) {
if (player->effects & MIDAIR_EFFECT) {
func_8008C73C(player, playerIndex);
player->unk_044 &= ~0x4000;
}
@ -510,7 +512,7 @@ void apply_boost_sound_effect(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
player->effects |= BOOST_EFFECT;
player->effects |= MUSHROOM_EFFECT;
player->soundEffects &= ~BOOST_SOUND_EFFECT;
player->unk_DB4.unk0 = 0;
player->unk_DB4.unk8 = 8.0f;
@ -531,7 +533,7 @@ void apply_boost_sound_effect(Player* player, s8 playerIndex) {
player->boostTimer = 0x50;
}
void apply_boost_effect(Player* player) {
void apply_mushroom_effect(Player* player) {
player->currentSpeed = (f32) player->topSpeed;
if (player->boostTimer > 0) {
--player->boostTimer;
@ -544,12 +546,12 @@ void apply_boost_effect(Player* player) {
}
if (player->boostPower <= 1.0f) {
player->effects &= ~BOOST_EFFECT;
player->effects &= ~MUSHROOM_EFFECT;
}
}
void remove_boost_effect(Player* player) {
player->effects &= ~BOOST_EFFECT;
void remove_mushroom_effect(Player* player) {
player->effects &= ~MUSHROOM_EFFECT;
player->boostPower = 0.0f;
}
@ -557,8 +559,8 @@ void func_8008D570(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
player->unk_0AE = player->rotation[1];
player->effects |= 0x80000;
player->effects &= ~0x10;
player->effects |= UNKNOWN_EFFECT_0x80000;
player->effects &= ~DRIFTING_EFFECT;
player->soundEffects &= ~0x1000;
player->kartHopJerk = D_800E3730[player->characterId];
player->kartHopAcceleration = 0.0f;
@ -596,7 +598,7 @@ void func_8008D698(Player* player, s8 playerIndex) {
if (player->unk_0B2 <= 0) {
player->unk_0B2 = 0;
}
if ((player->unk_0B2 == 0) && ((player->effects & 8) != 8)) {
if ((player->unk_0B2 == 0) && ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT)) {
func_8008D760(player);
}
}
@ -607,7 +609,7 @@ void func_8008D760(Player* player) {
player->unk_07C = 0;
player->unk_0C0 = 0;
player->rotation[1] = player->unk_0AE;
player->effects &= 0xFFF7FFFF;
player->effects &= ~UNKNOWN_EFFECT_0x80000;
player->kartGravity = gKartGravityTable[player->characterId];
player->type &= 0xFF7F;
}
@ -616,8 +618,8 @@ void func_8008D7B0(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
player->unk_0AE = player->rotation[1];
player->effects |= 0x800000;
player->effects &= ~0x10;
player->effects |= UNKNOWN_EFFECT_0x800000;
player->effects &= ~DRIFTING_EFFECT;
player->soundEffects &= ~0x20000;
player->kartHopJerk = D_800E3770[player->characterId];
player->kartHopAcceleration = 0.0f;
@ -650,7 +652,7 @@ void func_8008D8B4(Player* player, s8 playerIndex) {
if (player->unk_0B2 <= 0) {
player->unk_0B2 = 0;
}
if ((player->unk_0B2 == 0) && ((player->effects & 8) != 8)) {
if ((player->unk_0B2 == 0) && ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT)) {
func_8008D97C(player);
}
}
@ -661,7 +663,7 @@ void func_8008D97C(Player* player) {
player->unk_07C = 0;
player->unk_0C0 = 0;
player->rotation[1] = player->unk_0AE;
player->effects &= 0xFF7FFFFF;
player->effects &= ~UNKNOWN_EFFECT_0x800000;
player->kartGravity = gKartGravityTable[player->characterId];
}
@ -690,12 +692,12 @@ void func_8008D9C0(Player* player) {
void apply_hit_sound_effect(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
if ((player->effects & HIT_EFFECT) == 0) {
if ((player->effects & SQUISH_EFFECT) == 0) {
player->unk_DB4.unk2 = 0;
player->unk_238 = 0;
player->unk_DB4.unk10 = 4.5f;
D_8018D990[playerIndex] = 0;
player->effects &= ~0x08000010;
player->effects &= ~(POST_SQUISH_EFFECT | DRIFTING_EFFECT);
D_80165190[0][playerIndex] = 1;
D_80165190[1][playerIndex] = 1;
D_80165190[2][playerIndex] = 1;
@ -708,11 +710,11 @@ void apply_hit_sound_effect(Player* player, s8 playerIndex) {
player->unk_046 |= 0x80;
}
if (((player->type & PLAYER_HUMAN) != 0) && ((player->effects & HIT_EFFECT) == 0)) {
if (((player->type & PLAYER_HUMAN) != 0) && ((player->effects & SQUISH_EFFECT) == 0)) {
func_800C90F4(playerIndex, (player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x05));
}
player->effects |= HIT_EFFECT;
player->effects |= SQUISH_EFFECT;
if (((player->type) & 0x1000) != 0) {
play_cpu_sound_effect(playerIndex, player);
}
@ -727,7 +729,7 @@ void apply_hit_effect(Player* player, s8 playerIndex) {
player->unk_08C = 0.0f;
player->currentSpeed = 0.0f;
// clang-format off
if ((player->collision.surfaceDistance[2] >= 600.0f) || ((player->effects & UNKNOWN_EFFECT_0x1000) != 0)) { D_8018D990[playerIndex] = 3; } // placed block on same line to match
if ((player->collision.surfaceDistance[2] >= 600.0f) || ((player->effects & LOST_RACE_EFFECT) != 0)) { D_8018D990[playerIndex] = 3; } // placed block on same line to match
// clang-format on
switch (D_8018D990[playerIndex]) {
@ -801,7 +803,7 @@ void apply_hit_effect(Player* player, s8 playerIndex) {
player->unk_DB4.unk10 = 4.5f;
player->pos[1] -= 0.085;
if ((player->effects & 8) != 8) {
if ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT) {
D_8018D990[playerIndex] = 3;
player->unk_238 = 0;
}
@ -810,9 +812,9 @@ void apply_hit_effect(Player* player, s8 playerIndex) {
break;
case 3:
player->unk_DB4.unk10 = 3.0f;
player->effects &= ~HIT_EFFECT;
player->effects &= ~SQUISH_EFFECT;
player->unk_DB4.unk2 = 0;
player->effects |= 0x08000000;
player->effects |= POST_SQUISH_EFFECT;
player->size = 1.0f;
player->boundingBoxSize = gKartBoundingBoxSizeTable[player->characterId];
D_80165190[0][playerIndex] = 1;
@ -831,8 +833,8 @@ void apply_hit_rotating_sound_effect(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
player->soundEffects &= ~HIT_ROTATING_SOUND_EFFECT;
player->effects |= 0x40020000;
player->effects &= ~0x10;
player->effects |= (LIGHTNING_EFFECT | LIGHTNING_STRIKE_EFFECT);
player->effects &= ~DRIFTING_EFFECT;
player->unk_08C *= 0.6;
player->unk_0B0 = 0;
player->size = 1.0f;
@ -863,8 +865,9 @@ void apply_hit_rotating_sound_effect(Player* player, s8 playerIndex) {
void apply_lightning_effect(Player* player, s8 playerIndex) {
s16 test;
if (((player->effects & 0x8000) == 0x8000) && ((player->effects & HIT_EFFECT) != HIT_EFFECT)) {
player->effects &= ~0x20000;
if (((player->effects & ENEMY_BONK_EFFECT) == ENEMY_BONK_EFFECT) &&
((player->effects & SQUISH_EFFECT) != SQUISH_EFFECT)) {
player->effects &= ~LIGHTNING_STRIKE_EFFECT;
player->unk_0A8 = 0;
player->unk_07C = 0;
player->unk_0C0 = 0;
@ -875,7 +878,7 @@ void apply_lightning_effect(Player* player, s8 playerIndex) {
D_80165190[2][playerIndex] = 1;
D_80165190[3][playerIndex] = 1;
apply_hit_sound_effect(player, playerIndex);
} else if ((player->effects & 0x20000) == 0x20000) {
} else if ((player->effects & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT) {
player->rotation[1] -= 0x5B0;
D_8018D920[playerIndex] -= 0x5B0;
test = (u16) D_8018D920[playerIndex] / 1456;
@ -883,7 +886,7 @@ void apply_lightning_effect(Player* player, s8 playerIndex) {
player->unk_0B2--;
if (player->unk_0B2 <= 0) {
player->unk_0A8 = 0;
player->effects &= ~0x20000;
player->effects &= ~LIGHTNING_STRIKE_EFFECT;
player->unk_07C = 0;
player->unk_0C0 = 0;
player->rotation[1] = player->unk_0AE;
@ -922,13 +925,13 @@ void remove_lightning_effect(Player* player, UNUSED s8 playerIndex) {
player->boundingBoxSize = gKartBoundingBoxSizeTable[player->characterId];
player->unk_DB4.unk10 = 3.0f;
player->unk_DB4.unk2 = 0;
player->effects |= 0x08000000;
player->effects |= POST_SQUISH_EFFECT;
if ((player->effects & 0x20000) == 0x20000) {
if ((player->effects & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT) {
player->rotation[1] = player->unk_0AE;
}
player->effects &= ~0x20000;
player->effects &= ~LIGHTNING_STRIKE_EFFECT;
}
void func_8008E4A4(Player* player, s8 playerIndex) {
@ -942,14 +945,14 @@ void func_8008E4A4(Player* player, s8 playerIndex) {
player->currentSpeed = 0.0f;
player->velocity[0] = 0.0f;
player->velocity[2] = 0.0f;
player->effects &= ~0xC0;
player->effects &= ~(BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT);
if ((player->effects & 8) != 8) {
if ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT) {
++player->unk_0E0;
}
if (player->unk_0E0 == 3) {
player->effects &= ~UNKNOWN_EFFECT_0x1000000;
player->effects &= ~EXPLOSION_CRASH_EFFECT;
player->unk_0A8 = 0;
player->unk_236 = 0;
D_80165190[0][playerIndex] = 1;
@ -971,7 +974,7 @@ void func_8008E4A4(Player* player, s8 playerIndex) {
player->unk_0A8 = 0;
--player->unk_236;
if (player->unk_236 == 0) {
player->effects &= ~UNKNOWN_EFFECT_0x1000000;
player->effects &= ~EXPLOSION_CRASH_EFFECT;
player->unk_236 = 0;
D_80165190[0][playerIndex] = 1;
D_80165190[1][playerIndex] = 1;
@ -982,7 +985,8 @@ void func_8008E4A4(Player* player, s8 playerIndex) {
if (gModeSelection == BATTLE) {
pop_player_balloon(player, playerIndex);
}
if ((gIsPlayerTripleAButtonCombo[playerIndex] == true) && ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
if ((gIsPlayerTripleAButtonCombo[playerIndex] == true) &&
((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
player->currentSpeed += 100.0f;
}
@ -997,8 +1001,8 @@ void apply_reverse_sound_effect(Player* player, s8 playerIndex) {
func_8008C310(player);
player->unk_0A8 = 0;
player->effects |= UNKNOWN_EFFECT_0x1000000;
player->effects &= ~0x10;
player->effects |= EXPLOSION_CRASH_EFFECT;
player->effects &= ~DRIFTING_EFFECT;
player->kartHopJerk = 0.0f;
player->kartHopAcceleration = 0.0f;
player->kartHopVelocity = 0.0f;
@ -1034,7 +1038,7 @@ void apply_reverse_sound_effect(Player* player, s8 playerIndex) {
}
void func_8008E884(Player* player, s8 playerIndex) {
player->effects &= ~UNKNOWN_EFFECT_0x1000000;
player->effects &= ~EXPLOSION_CRASH_EFFECT;
player->unk_0A8 = 0;
player->unk_236 = 0;
D_80165190[0][playerIndex] = 1;
@ -1044,7 +1048,7 @@ void func_8008E884(Player* player, s8 playerIndex) {
player->unk_042 = 0;
}
void apply_hit_by_item_effect(Player* player, s8 playerIndex) {
void apply_hit_by_star_effect(Player* player, s8 playerIndex) {
player->unk_206 = 0;
player->slopeAccel = 0;
player->unk_0C0 = 0;
@ -1053,14 +1057,14 @@ void apply_hit_by_item_effect(Player* player, s8 playerIndex) {
player->unk_042 += 0xAAA;
player->unk_08C /= 2;
player->currentSpeed = 0.0f;
player->effects &= ~0xC0;
player->effects &= ~(BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT);
if ((player->effects & 8) != 8) {
if ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT) {
++player->unk_0E0;
}
if (player->unk_0E0 == 4) {
player->effects &= ~HIT_BY_ITEM_EFFECT;
player->effects &= ~HIT_BY_STAR_EFFECT;
player->unk_0A8 = 0;
player->unk_236 = 0;
D_80165190[3][playerIndex] = 1;
@ -1082,14 +1086,15 @@ void apply_hit_by_item_effect(Player* player, s8 playerIndex) {
player->unk_0A8 = 0;
--player->unk_236;
if (player->unk_236 == 0) {
player->effects &= ~HIT_BY_ITEM_EFFECT;
player->effects &= ~HIT_BY_STAR_EFFECT;
player->unk_236 = 0;
D_80165190[0][playerIndex] = 1;
D_80165190[1][playerIndex] = 1;
D_80165190[2][playerIndex] = 1;
D_80165190[3][playerIndex] = 1;
player->unk_042 = 0;
if ((gIsPlayerTripleAButtonCombo[playerIndex] == true) && ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
if ((gIsPlayerTripleAButtonCombo[playerIndex] == true) &&
((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
player->currentSpeed += 100.0f;
}
@ -1101,12 +1106,12 @@ void apply_hit_by_item_effect(Player* player, s8 playerIndex) {
}
}
void apply_hit_by_item_sound_effect(Player* player, s8 playerIndex) {
void apply_hit_by_star_sound_effect(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
func_8008C310(player);
player->unk_0A8 = 0;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
player->kartHopJerk = 0.0f;
player->kartHopAcceleration = 0.0f;
player->kartHopVelocity = 0.0f;
@ -1124,7 +1129,7 @@ void apply_hit_by_item_sound_effect(Player* player, s8 playerIndex) {
play_cpu_sound_effect(playerIndex, player);
}
player->effects |= HIT_BY_ITEM_EFFECT;
player->effects |= HIT_BY_STAR_EFFECT;
player->unk_0B6 |= 0x40;
player->soundEffects &= ~0x01000002;
@ -1134,8 +1139,8 @@ void apply_hit_by_item_sound_effect(Player* player, s8 playerIndex) {
gFrameSinceLastACombo[playerIndex] = 0;
}
void remove_hit_by_item_effect(Player* player, s8 playerIndex) {
player->effects &= ~HIT_BY_ITEM_EFFECT;
void remove_hit_by_star_effect(Player* player, s8 playerIndex) {
player->effects &= ~HIT_BY_STAR_EFFECT;
player->unk_0A8 = 0;
player->unk_236 = 0;
D_80165190[0][playerIndex] = 1;
@ -1162,7 +1167,7 @@ void apply_boost_ramp_asphalt_sound_effect(Player* player, s8 playerId) {
func_800C9060(playerId, 0x1900A40B);
}
player->unk_044 &= ~0x1;
player->effects &= ~0x20;
player->effects &= ~AB_SPIN_EFFECT;
}
void apply_boost_ramp_asphalt_effect(Player* player) {
@ -1172,7 +1177,7 @@ void apply_boost_ramp_asphalt_effect(Player* player) {
if ((u16) player->unk_256 > 0) {
player->currentSpeed = 0.0f;
}
if ((player->surfaceType != BOOST_RAMP_ASPHALT) && ((player->effects & 8) != 8)) {
if ((player->surfaceType != BOOST_RAMP_ASPHALT) && ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT)) {
move_f32_towards(&player->boostPower, 0, 1.0f);
} else {
move_f32_towards(&player->boostPower, 400.0f, 0.01f);
@ -1210,13 +1215,13 @@ void apply_boost_ramp_wood_sound_effect(Player* player, s8 playerId) {
}
player->unk_044 &= ~0x1;
player->effects &= ~0x20;
player->effects &= ~AB_SPIN_EFFECT;
}
void apply_boost_ramp_wood_effect(Player* player) {
player->currentSpeed = gTopSpeedTable[0][player->characterId];
if ((player->surfaceType != BOOST_RAMP_WOOD) && ((player->effects & 8) != 8)) {
if ((player->surfaceType != BOOST_RAMP_WOOD) && ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT)) {
move_f32_towards(&player->boostPower, 0, 1.0f);
} else {
move_f32_towards(&player->boostPower, 300.0f, 0.1f);
@ -1242,7 +1247,7 @@ void func_8008F104(Player* player, s8 playerIndex) {
player->unk_0B2 = 2;
player->unk_0C0 = 0;
player->unk_07C = 0;
player->effects |= 0x4000;
player->effects |= EARLY_START_SPINOUT_EFFECT;
player->unk_078 = 0;
D_8018D920[playerIndex] = -0x8000;
@ -1263,7 +1268,7 @@ void func_8008F1B8(Player* player, s8 arg1) {
temp = ((u16) D_8018D920[arg1] / 182);
if (temp == 180) {
player->effects &= ~0x4000;
player->effects &= ~EARLY_START_SPINOUT_EFFECT;
player->type &= ~0x80;
player->currentSpeed /= 3.0f;
}
@ -1273,7 +1278,7 @@ void func_8008F1B8(Player* player, s8 arg1) {
D_8018D920[arg1] -= 182;
temp = ((u16) D_8018D920[arg1] / 182);
if (temp == 180) {
player->effects &= ~0x4000;
player->effects &= ~EARLY_START_SPINOUT_EFFECT;
player->type &= ~0x80;
player->currentSpeed /= 3.0f;
}
@ -1302,7 +1307,7 @@ void func_8008F1B8(Player* player, s8 arg1) {
}
void func_8008F3E0(Player* player) {
player->effects &= ~0x4000;
player->effects &= ~EARLY_START_SPINOUT_EFFECT;
}
void func_8008F3F4(Player* player, UNUSED s8 arg1) {
@ -1315,7 +1320,7 @@ void func_8008F3F4(Player* player, UNUSED s8 arg1) {
player->unk_0A8 = 0;
--player->unk_236;
if (player->unk_236 == 0) {
player->effects &= ~UNKNOWN_EFFECT_0x10000;
player->effects &= ~TERRAIN_TUMBLE_EFFECT;
func_80090778(player);
func_80090868(player);
}
@ -1323,9 +1328,9 @@ void func_8008F3F4(Player* player, UNUSED s8 arg1) {
}
void func_8008F494(Player* player, s8 playerIndex) {
if ((((player->effects & UNKNOWN_EFFECT_0x80) != 0) || ((player->effects & UNKNOWN_EFFECT_0x40) != 0) ||
((player->effects & UNKNOWN_EFFECT_0x1000000)) || ((player->effects & HIT_BY_ITEM_EFFECT)) ||
((player->effects & 0x400) != 0)) &&
if ((((player->effects & BANANA_SPINOUT_EFFECT) != 0) || ((player->effects & DRIVING_SPINOUT_EFFECT) != 0) ||
((player->effects & EXPLOSION_CRASH_EFFECT)) || ((player->effects & HIT_BY_STAR_EFFECT)) ||
((player->effects & HIT_BY_GREEN_SHELL_EFFECT) != 0)) &&
(gModeSelection == BATTLE)) {
player->unk_044 |= 0x8000;
}
@ -1334,8 +1339,8 @@ void func_8008F494(Player* player, s8 playerIndex) {
func_8008F86C(player, playerIndex);
player->unk_0A8 = 0;
player->effects |= UNKNOWN_EFFECT_0x10000;
player->effects &= ~0x10;
player->effects |= TERRAIN_TUMBLE_EFFECT;
player->effects &= ~DRIFTING_EFFECT;
player->unk_236 = 0x1E;
player->unk_042 = 0;
@ -1354,7 +1359,7 @@ void func_8008F5A4(Player* player, s8 playerIndex) {
player->unk_206 = 0;
player->slopeAccel = 0;
player->effects &= ~UNKNOWN_EFFECT_0x10000;
player->effects &= ~TERRAIN_TUMBLE_EFFECT;
player->unk_0A8 = 0;
player->unk_0C0 = 0;
player->unk_07C = 0;
@ -1442,7 +1447,7 @@ void apply_boo_effect(Player* player, s8 playerIndex) {
if (player->alpha >= 0xF0) {
player->alpha = ALPHA_MAX;
gPlayerOtherScreensAlpha[playerIndex] = ALPHA_MAX;
player->effects &= ~0x80000000;
player->effects &= ~BOO_EFFECT;
if ((player->type & 0x4000) != 0) {
func_800CB064(playerIndex);
}
@ -1452,7 +1457,7 @@ void apply_boo_effect(Player* player, s8 playerIndex) {
if (gPlayerOtherScreensAlpha[playerIndex] >= 0xF0) {
gPlayerOtherScreensAlpha[playerIndex] = ALPHA_MAX;
player->alpha = ALPHA_MAX;
player->effects &= ~0x80000000;
player->effects &= ~BOO_EFFECT;
if ((player->type & 0x4000) != 0) {
func_800CB064(playerIndex);
}
@ -1491,7 +1496,7 @@ void func_8008FB30(Player* player, s8 playerIndex) {
player->alpha = ALPHA_MAX;
gPlayerOtherScreensAlpha[playerIndex] = ALPHA_MAX;
player->effects &= ~0x80000000;
player->effects &= ~BOO_EFFECT;
if ((player->type & 0x4000) != 0) {
func_800CB064(playerIndex);
}
@ -1501,7 +1506,7 @@ void func_8008FB30(Player* player, s8 playerIndex) {
if (gPlayerOtherScreensAlpha[playerIndex] >= 0xE0) {
gPlayerOtherScreensAlpha[playerIndex] = ALPHA_MAX;
player->alpha = ALPHA_MAX;
player->effects &= ~0x80000000;
player->effects &= ~BOO_EFFECT;
if ((player->type & 0x4000) != 0) {
func_800CB064(playerIndex);
}
@ -1567,7 +1572,7 @@ void func_8008FDA8(Player* player, UNUSED s8 arg1) {
void func_8008FDF4(Player* player, s8 playerIndex) {
clean_effect(player, playerIndex);
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
player->kartHopJerk = D_800E37F0[player->characterId];
player->kartHopAcceleration = 0.0f;
player->kartHopVelocity = D_800E37D0[player->characterId];
@ -1576,8 +1581,8 @@ void func_8008FDF4(Player* player, s8 playerIndex) {
}
void func_8008FE84(Player* player, UNUSED s8 playerIndex) {
player->effects &= ~0x10;
if ((player->effects & 8) != 8) {
player->effects &= ~DRIFTING_EFFECT;
if ((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT) {
player->effects &= ~UNKNOWN_EFFECT_0x10000000;
player->currentSpeed /= 2;
player->unk_08C /= 2;
@ -1768,7 +1773,7 @@ void func_80090778(Player* player) {
player->unk_07C = 0;
player->unk_0C0 = 0;
player->unk_0CA |= 8;
player->effects &= ~0x10;
player->effects &= ~DRIFTING_EFFECT;
player->unk_222 = 0;
player->unk_08C = 0.0f;
@ -1779,8 +1784,8 @@ void func_80090778(Player* player) {
player->unk_0C2 = 0;
player->unk_DB4.unk8 = 0.0f;
if ((player->effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) {
if ((player->effects & 0x20000) == 0x20000) {
player->effects &= ~0x20000;
if ((player->effects & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT) {
player->effects &= ~LIGHTNING_STRIKE_EFFECT;
player->unk_0A8 = 0;
player->unk_07C = 0;
player->unk_0C0 = 0;
@ -1788,7 +1793,7 @@ void func_80090778(Player* player) {
}
remove_lightning_effect(player, playerIndex);
}
player->effects &= ~0x20;
player->effects &= ~AB_SPIN_EFFECT;
}
void func_80090868(Player* player) {
@ -1931,7 +1936,7 @@ void func_80090970(Player* player, s8 playerId, s8 arg2) {
}
move_f32_towards(&player->pos[1], (player->unk_074 + player->boundingBoxSize) - 2.0f, 0.04f);
player->unk_0C8++;
if (((player->effects & 8) != 8) || (player->effects & 0x8000)) {
if (((player->effects & MIDAIR_EFFECT) != MIDAIR_EFFECT) || (player->effects & ENEMY_BONK_EFFECT)) {
player->unk_0CA &= ~0x1000;
if (player->unk_0C8 >= 0x5B) {
if (player->type & PLAYER_HUMAN) {
@ -1972,10 +1977,11 @@ void func_80090970(Player* player, s8 playerId, s8 arg2) {
}
}
#define EFFECT_BLACKLIST_USE_ITEM \
LIGHTNING_EFFECT | 0x10000000 | 0x8000000 | HIT_EFFECT | HIT_BY_ITEM_EFFECT | 0x1000000 | 0x800000 | \
BOOST_RAMP_ASPHALT_EFFECT | 0x20000 | 0x10000 | 0x4000 | 0x800 | 0x400 | STAR_EFFECT | 0x80 | 0x40 | \
BOOST_RAMP_WOOD_EFFECT
#define BLOCK_ITEM_USE_EFFECTS \
LIGHTNING_EFFECT | UNKNOWN_EFFECT_0x10000000 | POST_SQUISH_EFFECT | SQUISH_EFFECT | HIT_BY_STAR_EFFECT | \
EXPLOSION_CRASH_EFFECT | UNKNOWN_EFFECT_0x800000 | BOOST_RAMP_ASPHALT_EFFECT | LIGHTNING_STRIKE_EFFECT | \
TERRAIN_TUMBLE_EFFECT | EARLY_START_SPINOUT_EFFECT | BANANA_NEAR_SPINOUT_EFFECT | HIT_BY_GREEN_SHELL_EFFECT | \
STAR_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT | BOOST_RAMP_WOOD_EFFECT
bool prevent_item_use(Player* player) {
s32 phi_v0 = 0;
@ -1991,15 +1997,15 @@ bool prevent_item_use(Player* player) {
case ITEM_DOUBLE_MUSHROOM:
case ITEM_TRIPLE_MUSHROOM:
case ITEM_SUPER_MUSHROOM:
if ((player->effects & 8) != 0) {
if ((player->effects & MIDAIR_EFFECT) != 0) {
return true;
}
phi_v0 = EFFECT_BLACKLIST_USE_ITEM;
phi_v0 = BLOCK_ITEM_USE_EFFECTS;
goto prevent_item_use_label;
case ITEM_STAR:
phi_v0 = BOO_EFFECT | EFFECT_BLACKLIST_USE_ITEM;
phi_v0 = BOO_EFFECT | BLOCK_ITEM_USE_EFFECTS;
case ITEM_BOO:
phi_v0 = phi_v0 | (BOO_EFFECT | EFFECT_BLACKLIST_USE_ITEM);
phi_v0 = phi_v0 | (BOO_EFFECT | BLOCK_ITEM_USE_EFFECTS);
prevent_item_use_label:
default:
if ((player->effects & phi_v0) != 0) {

View File

@ -60,8 +60,8 @@ void func_8008D0FC(Player*, s8);
void func_8008D170(Player*, s8);
void func_8008D3B0(Player*, s8);
void apply_boost_sound_effect(Player*, s8);
void apply_boost_effect(Player*);
void remove_boost_effect(Player*);
void apply_mushroom_effect(Player*);
void remove_mushroom_effect(Player*);
void func_8008D570(Player*, s8);
void func_8008D698(Player*, s8);
void func_8008D760(Player*);
@ -77,9 +77,9 @@ void remove_lightning_effect(Player*, s8);
void func_8008E4A4(Player*, s8);
void apply_reverse_sound_effect(Player*, s8);
void func_8008E884(Player*, s8);
void apply_hit_by_item_effect(Player*, s8);
void apply_hit_by_item_sound_effect(Player*, s8);
void remove_hit_by_item_effect(Player*, s8);
void apply_hit_by_star_effect(Player*, s8);
void apply_hit_by_star_sound_effect(Player*, s8);
void remove_hit_by_star_effect(Player*, s8);
void apply_boost_ramp_asphalt_sound_effect(Player*, s8);
void apply_boost_ramp_asphalt_effect(Player*);
void remove_boost_ramp_asphalt_effect(Player*);

View File

@ -1187,8 +1187,11 @@ u8* gKartPalettes[] = {
**/
void load_kart_texture(Player* player, s8 playerId, s8 screenId, s8 screenId2, s8 index) {
s32 temp = player->effects;
if (((temp & 0x80) == 0x80) || ((temp & 0x40) == 0x40) || ((temp & 0x80000) == 0x80000) ||
((temp & 0x800000) == 0x800000) || ((temp & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0)) {
if (((temp & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((temp & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) ||
((temp & UNKNOWN_EFFECT_0x80000) == UNKNOWN_EFFECT_0x80000) ||
((temp & UNKNOWN_EFFECT_0x800000) == UNKNOWN_EFFECT_0x800000) ||
((temp & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT) || ((player->unk_044 & 0x800) != 0)) {
if (player->animFrameSelector[screenId] != 0) {
osInvalDCache(&gEncodedKartTexture[index][screenId2][playerId], D_800DDEB0[player->characterId]);
@ -1212,8 +1215,10 @@ void load_kart_texture(Player* player, s8 playerId, s8 screenId, s8 screenId2, s
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000)) {
} else if (((temp & HIT_BY_GREEN_SHELL_EFFECT) == HIT_BY_GREEN_SHELL_EFFECT) ||
((temp & EXPLOSION_CRASH_EFFECT) == EXPLOSION_CRASH_EFFECT) ||
((temp & HIT_BY_STAR_EFFECT) == HIT_BY_STAR_EFFECT) ||
((temp & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
osInvalDCache(&gEncodedKartTexture[index][screenId2][playerId], 0x780U);
// player->unk_0A8 >> 8 converts an 8.8 fixed-point animation frame to a whole number.
osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ,
@ -1238,8 +1243,11 @@ void load_kart_texture(Player* player, s8 playerId, s8 screenId, s8 screenId2, s
void load_kart_texture_non_blocking(Player* player, s8 arg1, s8 arg2, s8 arg3, s8 arg4) {
s32 temp = player->effects;
if (((temp & 0x80) == 0x80) || ((temp & 0x40) == 0x40) || ((temp & 0x80000) == 0x80000) ||
((temp & 0x800000) == 0x800000) || ((temp & 0x20000) == 0x20000) || ((player->unk_044 & 0x800) != 0)) {
if (((temp & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
((temp & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) ||
((temp & UNKNOWN_EFFECT_0x80000) == UNKNOWN_EFFECT_0x80000) ||
((temp & UNKNOWN_EFFECT_0x800000) == UNKNOWN_EFFECT_0x800000) ||
((temp & LIGHTNING_STRIKE_EFFECT) == LIGHTNING_STRIKE_EFFECT) || ((player->unk_044 & 0x800) != 0)) {
if (player->animFrameSelector[arg2] != 0) {
osInvalDCache(&gEncodedKartTexture[arg4][arg3][arg1], D_800DDEB0[player->characterId]);
@ -1257,8 +1265,10 @@ void load_kart_texture_non_blocking(Player* player, s8 arg1, s8 arg2, s8 arg3, s
[player->animFrameSelector[arg2]])],
&gEncodedKartTexture[arg4][arg3][arg1], D_800DDEB0[player->characterId], &gDmaMesgQueue);
}
} else if (((temp & 0x400) == 0x400) || ((temp & 0x01000000) == 0x01000000) ||
((temp & 0x02000000) == 0x02000000) || ((temp & 0x10000) == 0x10000)) {
} else if (((temp & HIT_BY_GREEN_SHELL_EFFECT) == HIT_BY_GREEN_SHELL_EFFECT) ||
((temp & EXPLOSION_CRASH_EFFECT) == EXPLOSION_CRASH_EFFECT) ||
((temp & HIT_BY_STAR_EFFECT) == HIT_BY_STAR_EFFECT) ||
((temp & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT)) {
osInvalDCache(&gEncodedKartTexture[arg4][arg3][arg1], 0x780);
// player->unk_0A8 >> 8 converts an 8.8 fixed-point animation frame to a whole number.
osPiStartDma(&gDmaIoMesg, OS_MESG_PRI_NORMAL, OS_READ,

File diff suppressed because it is too large Load Diff

View File

@ -1552,7 +1552,7 @@ bool query_and_resolve_collision_player_actor(Player* player, Vec3f pos, f32 min
player->pos[0] += (xVelocity / temp_f0_4) * minDist;
player->pos[2] += (zVelocity / temp_f0_4) * minDist;
} else {
player->effects |= 0x8000;
player->effects |= ENEMY_BONK_EFFECT;
xDist /= sqrtDist;
zDist /= sqrtDist;
temp_f0_5 = sqrtf((xVelocity * xVelocity) + (zVelocity * zVelocity));
@ -1729,7 +1729,7 @@ bool collision_tree(Player* player, struct Actor* actor) {
}
}
if (!(player->effects & STAR_EFFECT)) {
player->effects |= 0x8000;
player->effects |= ENEMY_BONK_EFFECT;
}
actorPos[0] = actor->pos[0];
actorPos[1] = actor->pos[1];
@ -2077,7 +2077,8 @@ void evaluate_collision_between_player_actor(Player* player, struct Actor* actor
}
break;
case ACTOR_BANANA:
if (player->effects & (BOO_EFFECT | 0x8C0)) {
if (player->effects &
(BOO_EFFECT | BANANA_NEAR_SPINOUT_EFFECT | BANANA_SPINOUT_EFFECT | DRIVING_SPINOUT_EFFECT)) {
break;
}
if (player->soundEffects & 1) {
@ -2106,7 +2107,7 @@ void evaluate_collision_between_player_actor(Player* player, struct Actor* actor
destroy_destructable_actor(actor);
break;
case ACTOR_GREEN_SHELL:
if (player->effects & 0x80000400) {
if (player->effects & (BOO_EFFECT | HIT_BY_GREEN_SHELL_EFFECT)) {
break;
}
if (player->soundEffects & 4) {
@ -2148,7 +2149,7 @@ void evaluate_collision_between_player_actor(Player* player, struct Actor* actor
break;
case ACTOR_RED_SHELL:
temp_v1 = actor->rot[2];
if (player->effects & UNKNOWN_EFFECT_0x1000000) {
if (player->effects & EXPLOSION_CRASH_EFFECT) {
break;
}
if (player->soundEffects & 2) {
@ -2281,12 +2282,12 @@ void evaluate_collision_for_players_and_actors(void) {
for (i = 0; i < NUM_PLAYERS; i++) {
phi_s1 = &gPlayers[i];
if (((phi_s1->type & PLAYER_EXISTS) != 0) && ((phi_s1->effects & 0x4000000) == 0)) {
if (((phi_s1->type & PLAYER_EXISTS) != 0) && ((phi_s1->effects & SQUISH_EFFECT) == 0)) {
func_802977E4(phi_s1);
for (j = 0; j < ACTOR_LIST_SIZE; j++) {
temp_a1 = &gActorList[j];
if ((phi_s1->effects & 0x4000000) == 0) {
if ((phi_s1->effects & SQUISH_EFFECT) == 0) {
// temp_v0 = temp_a1->unk2;
if (((temp_a1->flags & 0x8000) != 0) && ((temp_a1->flags & 0x4000) != 0)) {
evaluate_collision_between_player_actor(phi_s1, temp_a1);

View File

@ -1148,15 +1148,15 @@ void func_802903D8(Player* playerOne, Player* playerTwo) {
func_800C9060(playerOne - gPlayerOne, 0x19008001U);
return;
}
if (playerOne->effects & 0x200) {
if (!(playerTwo->effects & 0x200)) {
playerTwo->soundEffects |= HIT_BY_ITEM_SOUND_EFFECT;
if (playerOne->effects & STAR_EFFECT) {
if (!(playerTwo->effects & STAR_EFFECT)) {
playerTwo->soundEffects |= HIT_BY_STAR_SOUND_EFFECT;
}
} else if (playerTwo->effects & 0x200) {
playerOne->soundEffects |= HIT_BY_ITEM_SOUND_EFFECT;
} else if (playerTwo->effects & STAR_EFFECT) {
playerOne->soundEffects |= HIT_BY_STAR_SOUND_EFFECT;
} else {
playerOne->effects |= 0x8000;
playerTwo->effects |= 0x8000;
playerOne->effects |= ENEMY_BONK_EFFECT;
playerTwo->effects |= ENEMY_BONK_EFFECT;
}
temp_f0_2 = sqrtf((sp54[0] * sp54[0]) + (sp54[1] * sp54[1]) + (sp54[2] * sp54[2]));
sp60[0] /= temp_f0;
@ -1175,7 +1175,7 @@ void func_802903D8(Player* playerOne, Player* playerTwo) {
temp_f16 = ((sp60[0] * sp54[0]) + (sp60[1] * sp54[1]) + (sp60[2] * sp54[2])) / temp_f0_2;
}
temp_f0_2 = temp_f0_2 * temp_f16 * 0.85;
if ((playerOne->effects & 0x200) != 0x200) {
if ((playerOne->effects & STAR_EFFECT) != STAR_EFFECT) {
temp_f2 = (temp_f0_2 * sp20) / sp24;
playerOne->velocity[0] += sp60[0] * temp_f2;
playerOne->velocity[1] += sp60[1] * temp_f2;
@ -1184,7 +1184,7 @@ void func_802903D8(Player* playerOne, Player* playerTwo) {
playerOne->pos[1] -= sp60[1] * sp74 * 0.5f;
playerOne->pos[2] -= sp60[2] * sp74 * 0.5f;
}
if ((playerTwo->effects & 0x200) != 0x200) {
if ((playerTwo->effects & STAR_EFFECT) != STAR_EFFECT) {
temp_f2 = (temp_f0_2 * sp24) / sp20;
playerTwo->velocity[0] -= sp60[0] * temp_f2;
playerTwo->velocity[1] -= sp60[1] * temp_f2;
@ -1211,14 +1211,14 @@ void func_802909F0(void) {
for (i = 0; i < 7; i++) {
ply = &gPlayers[i];
if ((ply->type & PLAYER_EXISTS) && (!(ply->effects & 0x80000000)) &&
(!(ply->type & PLAYER_INVISIBLE_OR_BOMB)) && (!(ply->effects & 0x4000000))) {
if ((ply->type & PLAYER_EXISTS) && (!(ply->effects & BOO_EFFECT)) &&
(!(ply->type & PLAYER_INVISIBLE_OR_BOMB)) && (!(ply->effects & SQUISH_EFFECT))) {
for (k = i + 1; k < NUM_PLAYERS; k++) {
ply2 = &gPlayers[k];
if ((ply2->type & PLAYER_EXISTS) && (!(ply2->effects & 0x80000000)) &&
(!(ply2->type & PLAYER_INVISIBLE_OR_BOMB)) && (!(ply2->effects & 0x4000000))) {
if ((ply2->type & PLAYER_EXISTS) && (!(ply2->effects & BOO_EFFECT)) &&
(!(ply2->type & PLAYER_INVISIBLE_OR_BOMB)) && (!(ply2->effects & SQUISH_EFFECT))) {
func_802903D8(ply, ply2);
}

View File

@ -956,11 +956,11 @@ void func_80022A98(Player* player, s8 playerIndex) {
if ((player->type & PLAYER_EXISTS) == PLAYER_EXISTS) {
func_80026A48(player, playerIndex);
func_800235AC(player, playerIndex);
if (((player->effects & HIT_EFFECT) == HIT_EFFECT) || ((player->effects & 0x08000000) == 0x08000000)) {
if ((player->effects & HIT_EFFECT) == HIT_EFFECT) {
if (((player->effects & SQUISH_EFFECT) == SQUISH_EFFECT) || ((player->effects & POST_SQUISH_EFFECT) == POST_SQUISH_EFFECT)) {
if ((player->effects & SQUISH_EFFECT) == SQUISH_EFFECT) {
func_80022B50(player, playerIndex);
}
if ((player->effects & 0x08000000) == 0x08000000) {
if ((player->effects & POST_SQUISH_EFFECT) == POST_SQUISH_EFFECT) {
func_80022BC4(player, playerIndex);
}
} else {
@ -998,7 +998,7 @@ void func_80022BC4(Player* player, UNUSED s8 playerIndex) {
temp_f0 *= 0.8;
temp_v0 = 0;
if (temp_f0 <= 0.1) {
player->effects &= 0xF7FFFFFF;
player->effects &= ~POST_SQUISH_EFFECT;
temp_f0 = 0.0f;
}
}
@ -1271,7 +1271,7 @@ void func_800235AC(Player* player, s8 playerIndex) {
}
void func_80023BF0(Player* player, s8 playerId, s8 screenId, s8 arg3) {
if (((player->effects & HIT_EFFECT) == HIT_EFFECT) || ((player->effects & 0x8000000) == 0x8000000)) {
if (((player->effects & SQUISH_EFFECT) == SQUISH_EFFECT) || ((player->effects & POST_SQUISH_EFFECT) == POST_SQUISH_EFFECT)) {
func_80022CA8(player, playerId, screenId, arg3);
} else {
func_80022E84(player, playerId, screenId, arg3);
@ -1300,11 +1300,11 @@ void render_player_shadow(Player* player, s8 playerId, s8 screenId) {
spB0 = -coss(temp_t9 << 7) * 2;
spAC = -sins(temp_t9 << 7) * 2;
if (((player->effects & UNKNOWN_EFFECT_0x1000000) == UNKNOWN_EFFECT_0x1000000) ||
((player->effects & 0x400) == 0x400) || ((player->effects & 0x80000) == 0x80000) ||
((player->effects & 0x800000) == 0x800000) || ((player->effects & 0x400) == 0x400) ||
((player->unk_0CA & 2) == 2) || ((player->effects & HIT_BY_ITEM_EFFECT) == HIT_BY_ITEM_EFFECT) ||
((player->effects & UNKNOWN_EFFECT_0x10000) == UNKNOWN_EFFECT_0x10000) || ((player->effects & 8) == 8)) {
if (((player->effects & EXPLOSION_CRASH_EFFECT) == EXPLOSION_CRASH_EFFECT) ||
((player->effects & HIT_BY_GREEN_SHELL_EFFECT) == HIT_BY_GREEN_SHELL_EFFECT) || ((player->effects & UNKNOWN_EFFECT_0x80000) == UNKNOWN_EFFECT_0x80000) ||
((player->effects & UNKNOWN_EFFECT_0x800000) == UNKNOWN_EFFECT_0x800000) || ((player->effects & HIT_BY_GREEN_SHELL_EFFECT) == HIT_BY_GREEN_SHELL_EFFECT) ||
((player->unk_0CA & 2) == 2) || ((player->effects & HIT_BY_STAR_EFFECT) == HIT_BY_STAR_EFFECT) ||
((player->effects & TERRAIN_TUMBLE_EFFECT) == TERRAIN_TUMBLE_EFFECT) || ((player->effects & MIDAIR_EFFECT) == MIDAIR_EFFECT)) {
var_f2 = (f32) (1.0 - ((f64) player->collision.surfaceDistance[2] * 0.02));
if (var_f2 < 0.0f) {
@ -1435,14 +1435,14 @@ void render_kart(Player* player, s8 playerId, s8 arg2, s8 flipOffset) {
} else {
thing = (u16) (player->unk_048[arg2] + player->rotation[1] + player->unk_0C0);
temp_v1 = player->unk_0CC[arg2] * sins(thing);
if ((player->effects & 8) == 8) {
if ((player->effects & MIDAIR_EFFECT) == MIDAIR_EFFECT) {
sp14C[0] = cameras[arg2].rot[0] - 0x4000;
} else {
sp14C[0] = -temp_v1 * 0.8;
}
sp14C[1] = player->unk_048[arg2];
sp14C[2] = player->unk_050[arg2];
if (((s32) player->effects & HIT_EFFECT) == HIT_EFFECT) {
if (((s32) player->effects & SQUISH_EFFECT) == SQUISH_EFFECT) {
func_80062B18(&sp148, &sp144, &sp140, 0.0f, 8.0f, 0.0f, -player->unk_048[arg2], player->unk_050[arg2]);
sp154[1] = (player->pos[1] - player->boundingBoxSize) + player->unk_108;
sp154[0] = player->pos[0] + sp148;
@ -1747,7 +1747,7 @@ void render_player(Player* player, s8 playerId, s8 screenId) {
void func_80026A48(Player* player, s8 playerIndex) {
f32 temp_f0;
if (((player->effects & 0x4000) == 0x4000) && ((player->type & PLAYER_START_SEQUENCE) == 0)) {
if (((player->effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) && ((player->type & PLAYER_START_SEQUENCE) == 0)) {
player->tyreSpeed += D_800DDE74[8];
if (player->tyreSpeed >= 0x400) {
player->tyreSpeed = 0;
@ -1779,10 +1779,10 @@ void update_wheel_palette(Player* player, s8 playerId, s8 screenId, s8 arg3) {
s16 temp_t2 = player->tyreSpeed;
s16 temp_num = 0x40; // setting this as a variable gets rid of regalloc
if (((player->effects & 0x4000) == 0x4000) && ((player->type & PLAYER_START_SEQUENCE) == 0)) {
if (((player->effects & 0x80) != 0x80) && ((player->effects & 0x40) != 0x40) &&
((player->effects & 0x20000) != 0x20000) && ((player->effects & 0x80000) != 0x80000) &&
((player->effects & 0x800000) != 0x800000) && ((player->unk_044 & 0x800) == 0)) {
if (((player->effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) && ((player->type & PLAYER_START_SEQUENCE) == 0)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) != BANANA_SPINOUT_EFFECT) && ((player->effects & DRIVING_SPINOUT_EFFECT) != DRIVING_SPINOUT_EFFECT) &&
((player->effects & LIGHTNING_STRIKE_EFFECT) != LIGHTNING_STRIKE_EFFECT) && ((player->effects & UNKNOWN_EFFECT_0x80000) != UNKNOWN_EFFECT_0x80000) &&
((player->effects & UNKNOWN_EFFECT_0x800000) != UNKNOWN_EFFECT_0x800000) && ((player->unk_044 & 0x800) == 0)) {
if (frameId <= 20) {
load_player_data_non_blocking(player,
@ -1809,9 +1809,9 @@ void update_wheel_palette(Player* player, s8 playerId, s8 screenId, s8 arg3) {
}
}
} else {
if (((player->effects & 0x80) != 0x80) && ((player->effects & 0x40) != 0x40) &&
((player->effects & 0x80000) != 0x80000) && ((player->effects & 0x800000) != 0x800000) &&
((player->effects & 0x20000) != 0x20000) && ((player->unk_044 & 0x800) == 0)) {
if (((player->effects & BANANA_SPINOUT_EFFECT) != BANANA_SPINOUT_EFFECT) && ((player->effects & DRIVING_SPINOUT_EFFECT) != DRIVING_SPINOUT_EFFECT) &&
((player->effects & UNKNOWN_EFFECT_0x80000) != UNKNOWN_EFFECT_0x80000) && ((player->effects & UNKNOWN_EFFECT_0x800000) != UNKNOWN_EFFECT_0x800000) &&
((player->effects & LIGHTNING_STRIKE_EFFECT) != LIGHTNING_STRIKE_EFFECT) && ((player->unk_044 & 0x800) == 0)) {
if (frameId <= 20) {
load_player_data_non_blocking(player,

View File

@ -3152,7 +3152,7 @@ void func_80079860(s32 playerId) {
player = &gPlayerOne[playerId];
if ((func_80072354(objectIndex, 1) != 0) &&
(((func_802ABDF4(player->collision.meshIndexZX) != 0) && (player->collision.surfaceDistance[2] <= 3.0f)) ||
(player->unk_0CA & 1) || ((player->surfaceType == OUT_OF_BOUNDS) && !(player->effects & 8)))) {
(player->unk_0CA & 1) || ((player->surfaceType == OUT_OF_BOUNDS) && !(player->effects & MIDAIR_EFFECT)))) {
func_80090778(player);
func_800797AC(playerId);
}
@ -3476,7 +3476,7 @@ void update_object_lakitu_reverse(s32 objectIndex, s32 playerId) {
}
switch (gObjectList[objectIndex].unk_0D6) { /* switch 1; irregular */
case 1: /* switch 1 */
if ((gObjectList[objectIndex].state >= 3) && (!(sp2C->effects & 0x400000))) {
if ((gObjectList[objectIndex].state >= 3) && (!(sp2C->effects & REVERSE_EFFECT))) {
func_80086F10(objectIndex, 6, &D_800E69F4);
gObjectList[objectIndex].unk_0D6 = 2;
gObjectList[objectIndex].unk_04C = 0x00000050;
@ -3536,7 +3536,7 @@ void func_8007A88C(s32 playerId) {
objectIndex = gIndexLakituList[playerId];
player = &gPlayerOne[playerId];
if ((gObjectList[objectIndex].state == 0) && (player->effects & 0x400000)) {
if ((gObjectList[objectIndex].state == 0) && (player->effects & REVERSE_EFFECT)) {
func_800790E4(playerId);
}
}
@ -5983,10 +5983,10 @@ void func_80080B28(s32 objectIndex, s32 playerId) {
if (is_obj_flag_status_active(objectIndex, 0x00000200) != 0) {
if (!(temp_s0->soundEffects & 0x100)) {
temp_f0 = func_80088F54(objectIndex, temp_s0);
if ((temp_f0 <= 9.0) && !(temp_s0->effects & 0x04000000) &&
if ((temp_f0 <= 9.0) && !(temp_s0->effects & SQUISH_EFFECT) &&
(has_collided_horizontally_with_player(objectIndex, temp_s0) != 0)) {
if ((temp_s0->type & PLAYER_EXISTS) && !(temp_s0->type & 0x100)) {
if (!(temp_s0->effects & 0x200)) {
if (!(temp_s0->effects & STAR_EFFECT)) {
func_80089474(objectIndex, playerId, 1.4f, 1.1f, SOUND_ARG_LOAD(0x19, 0x00, 0xA0, 0x4C));
} else if (func_80072354(objectIndex, 0x00000040) != 0) {
if (temp_s0->type & 0x1000) {
@ -6386,7 +6386,7 @@ void func_80081D34(s32 objectIndex) {
player = gPlayerOne;
var_s4 = camera1;
for (playerIndex = 0; playerIndex < D_8018D158; playerIndex++, player++, var_s4++) {
if ((is_obj_flag_status_active(objectIndex, 0x00000200) != 0) && !(player->effects & 0x80000000) &&
if ((is_obj_flag_status_active(objectIndex, 0x00000200) != 0) && !(player->effects & BOO_EFFECT) &&
(has_collided_with_player(objectIndex, player) != 0)) {
if ((player->type & PLAYER_EXISTS) && !(player->type & 0x100)) {
var_s5 = 1;
@ -6394,7 +6394,7 @@ void func_80081D34(s32 objectIndex) {
if (is_obj_flag_status_active(objectIndex, 0x04000000) != 0) {
func_80072180();
}
if (player->effects & 0x200) {
if (player->effects & STAR_EFFECT) {
func_800C9060(playerIndex, 0x1900A046U);
} else {
player->soundEffects |= 2;