Skip to content

Commit 25c4150

Browse files
authored
Merge branch 'master' into better
2 parents bf82814 + a927b1d commit 25c4150

23 files changed

+793
-686
lines changed

include/defines.h

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -341,34 +341,47 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
341341
#define HOLD_BANANA_SOUND_EFFECT 0x40000 // holding a banana
342342
#define REVERSE_SOUND_EFFECT 0x400000 // being in the wrong direction
343343
#define BOOST_RAMP_ASPHALT_SOUND_EFFECT 0x800000 // being boosted by a boost pad
344-
#define HIT_BY_ITEM_SOUND_EFFECT 0x1000000 // being hit by an item
344+
#define HIT_BY_STAR_SOUND_EFFECT 0x1000000 // being hit by an item
345345

346346
/**
347347
* @brief effect of player's
348348
* for effects
349349
*/
350-
#define UNKNOWN_EFFECT_0x1 0x1 //
351-
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
352-
#define UNKNOWN_EFFECT_0x10 0x10 //
353-
#define UNKNOWN_EFFECT_0x40 0x40 //
354-
#define UNKNOWN_EFFECT_0x80 0x80 //
355-
#define UNKNOWN_EFFECT_0xC 0xC //
356-
#define UNKNOWN_EFFECT_0x10 0x10 //
357-
#define UNKNOWN_EFFECT_0x100 0x100 //
358-
#define UNKNOWN_EFFECT_0x1000 0x1000 //
359-
#define STAR_EFFECT 0x200 // being a star
360-
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
361-
#define UNKNOWN_EFFECT_0x10000 0x10000 //
362-
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
363-
#define UNKNOWN_EFFECT_0x200000 0x200000 //
364-
#define REVERSE_EFFECT 0x400000 // being in reverse of the course
365-
#define UNKNOWN_EFFECT_0x1000000 0x1000000 //
366-
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
367-
#define HIT_EFFECT 0x4000000 // hitting an object
368-
#define UNKNOWN_EFFECT_0x10000000 0x10000000 //
369-
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
370-
#define BOO_EFFECT 0x80000000 // being a boo
371-
350+
// clang-format off
351+
#define BRAKING_EFFECT 0x1 // pressing brake
352+
#define HOP_EFFECT 0x2 // from when you hop to when you land
353+
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by DKJP ramp
354+
#define MIDAIR_EFFECT 0x8 // in midair
355+
#define DRIFTING_EFFECT 0x10 // drifting
356+
#define AB_SPIN_EFFECT 0x20 // spinning with a+b
357+
#define DRIVING_SPINOUT_EFFECT 0x40 // spinout (from erratic driving) or crab
358+
#define BANANA_SPINOUT_EFFECT 0x80 // spinout (from hitting a banana or another driver)
359+
#define MINI_TURBO_EFFECT 0x100 // mini-turbo
360+
#define STAR_EFFECT 0x200 // using a star
361+
#define HIT_BY_GREEN_SHELL_EFFECT 0x400 // tumbling after hit with a green shell
362+
#define BANANA_NEAR_SPINOUT_EFFECT 0x800 // decreased steering sensitivity after hitting a banana, but before spinning out
363+
#define LOST_RACE_EFFECT 0x1000 // lost race in GP mode
364+
#define MUSHROOM_EFFECT 0x2000 // using a mushroom
365+
#define EARLY_START_SPINOUT_EFFECT 0x4000 // spinning out by pressing a too early at the startline or after lakitu retrieves you
366+
#define ENEMY_BONK_EFFECT 0x8000 // bouncing off an enemy (penguin, thwomp, etc)
367+
#define TERRAIN_TUMBLE_EFFECT 0x10000 // tumbling after hitting steep terrain
368+
#define LIGHTNING_STRIKE_EFFECT 0x20000 // spinning and shrinking during a lightning strike
369+
#define BANANA_SPINOUT_SAVE_EFFECT 0x40000 // avoid spinning out by pressing b
370+
#define UNKNOWN_EFFECT_0x80000 0x80000 // Only set when soundEffect 0x1000 is set. Unclear if it ever is
371+
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by the Royal Raceway ramp
372+
#define CPU_FAST_EFFECT 0x200000 // CPU Rubberbanding flag
373+
#define REVERSE_EFFECT 0x400000 // facing backwards
374+
#define UNKNOWN_EFFECT_0x800000 0x800000 // Only set when soundEffect 0x20000 is set
375+
#define EXPLOSION_CRASH_EFFECT 0x1000000 // vertical launch (hitting car, snowman, etc.)
376+
#define HIT_BY_STAR_EFFECT 0x2000000 // being hit by a red shell or star
377+
#define SQUISH_EFFECT 0x4000000 // hitting an object
378+
#define POST_SQUISH_EFFECT 0x8000000 // briefly after being squished (boulder, thwomp, etc.)
379+
#define UNKNOWN_EFFECT_0x10000000 0x10000000 // UNUSED (set in unused func_8008FDF4)
380+
#define DRIFT_OUTSIDE_EFFECT 0x20000000 // drifting toward the outside of your turn
381+
#define LIGHTNING_EFFECT 0x40000000 // suffering the effects of lightning
382+
#define BOO_EFFECT 0x80000000 // being a boo
383+
#define ALL_EFFECTS 0xFFFFFFFF
384+
// clang-format on
372385

373386
/**
374387
* @brief durations of effects

src/actors/kiwano_fruit/update.inc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void update_actor_kiwano_fruit(struct KiwanoFruit* fruit) {
5151
if ((player->effects & STAR_EFFECT) != 0) {
5252
func_800C9060(player - gPlayerOne, SOUND_ARG_LOAD(0x19, 0x00, 0xA0, 0x52));
5353
} else {
54-
player->effects |= 0x8000;
54+
player->effects |= ENEMY_BONK_EFFECT;
5555
player->pos[0] -= temp_f2 * 4.0f;
5656
player->pos[2] -= temp_f14 * 4.0f;
5757
player->velocity[0] -= temp_f2 * 0.7f;

src/audio/external.c

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ void func_800C6108(u8 playerId) {
19201920
} else {
19211921
D_800E9E54[playerId] = (f32) -player->unk_0C0;
19221922
}
1923-
if ((player->effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) {
1923+
if ((player->effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
19241924
D_800E9EB4[playerId] = D_800E9E64[playerId] + D_800E9DE4[playerId];
19251925
} else {
19261926
D_800E9EB4[playerId] = D_800E9E64[playerId] + D_800E9DE4[playerId] - (D_800E9E54[playerId] / 12000.0f);
@@ -2190,8 +2190,7 @@ void func_800C683C(u8 cameraId) {
21902190
void func_800C70A8(u8 playerId) {
21912191
if (D_800EA0EC[playerId] == 0) {
21922192
D_800E9E74[playerId] = 0;
2193-
if ((D_800E9E54[playerId] > 3500.0f) ||
2194-
((gPlayers[playerId].effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10)) {
2193+
if ((D_800E9E54[playerId] > 3500.0f) || ((gPlayers[playerId].effects & DRIFTING_EFFECT) == DRIFTING_EFFECT)) {
21952194
D_800E9E74[playerId] = 1;
21962195
switch (gPlayers[playerId].tyres[AUDIO_LEFT_TYRE].surfaceType) {
21972196
case DIRT: /* switch 1 */
@@ -2223,7 +2222,7 @@ void func_800C70A8(u8 playerId) {
22232222
break;
22242223
}
22252224
}
2226-
if ((gPlayers[playerId].effects & UNKNOWN_EFFECT_0x10) == UNKNOWN_EFFECT_0x10) {
2225+
if ((gPlayers[playerId].effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
22272226
D_800E9E74[playerId] = 2;
22282227
switch (gPlayers[playerId].tyres[AUDIO_LEFT_TYRE].surfaceType) { /* switch 2 */
22292228
case DIRT: /* switch 2 */
@@ -2375,17 +2374,21 @@ void func_800C70A8(u8 playerId) {
23752374
D_800E9E74[playerId] = 0x0000001B;
23762375
break;
23772376
}
2378-
if (((gPlayers[playerId].speed < 0.5f) || ((gPlayers[playerId].effects & 8) == 8)) &&
2377+
if (((gPlayers[playerId].speed < 0.5f) || ((gPlayers[playerId].effects & MIDAIR_EFFECT) == MIDAIR_EFFECT)) &&
23792378
(D_800E9E74[playerId] != 0x0000001C)) {
23802379
D_800E9E74[playerId] = 0;
23812380
}
2382-
if ((((gPlayers[playerId].effects & 0x4000) == 0x4000) && ((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
2383-
((gPlayers[playerId].effects & 0x800) == 0x800) || ((gPlayers[playerId].effects & 0x80) == 0x80) ||
2384-
((gPlayers[playerId].effects & 0x40) == 0x40) || ((gPlayers[playerId].unk_044 & 0x4000) == 0x4000)) {
2381+
if ((((gPlayers[playerId].effects & EARLY_START_SPINOUT_EFFECT) == EARLY_START_SPINOUT_EFFECT) &&
2382+
((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
2383+
((gPlayers[playerId].effects & BANANA_NEAR_SPINOUT_EFFECT) == BANANA_NEAR_SPINOUT_EFFECT) ||
2384+
((gPlayers[playerId].effects & BANANA_SPINOUT_EFFECT) == BANANA_SPINOUT_EFFECT) ||
2385+
((gPlayers[playerId].effects & DRIVING_SPINOUT_EFFECT) == DRIVING_SPINOUT_EFFECT) ||
2386+
((gPlayers[playerId].unk_044 & 0x4000) == 0x4000)) {
23852387
D_800E9E74[playerId] = 0x00000012;
23862388
}
2387-
if ((((gPlayers[playerId].effects & 0x20) == 0x20) && ((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
2388-
((gPlayers[playerId].effects & 0x800) == 0x800)) {
2389+
if ((((gPlayers[playerId].effects & AB_SPIN_EFFECT) == AB_SPIN_EFFECT) &&
2390+
((gPlayers[playerId].type & 0x2000) != 0x2000)) ||
2391+
((gPlayers[playerId].effects & BANANA_NEAR_SPINOUT_EFFECT) == BANANA_NEAR_SPINOUT_EFFECT)) {
23892392
D_800E9E74[playerId] = 0x00000013;
23902393
}
23912394
if (gPlayers[playerId].unk_20C != 0.0f) {
@@ -2714,13 +2717,13 @@ void func_800C847C(u8 playerId) {
27142717
}
27152718

27162719
void func_800C86D8(u8 playerId) {
2717-
if (((gPlayers[playerId].effects & 0x40000000) != 0x40000000) && (D_800E9F24[playerId] == 1)) {
2720+
if (((gPlayers[playerId].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) && (D_800E9F24[playerId] == 1)) {
27182721
func_800C90F4(playerId, (gPlayers[playerId].characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08));
27192722
}
27202723
}
27212724

27222725
void func_800C8770(u8 playerId) {
2723-
if ((gPlayers[playerId].effects & 0x40000000) == 0x40000000) {
2726+
if ((gPlayers[playerId].effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) {
27242727
D_800E9F24[playerId] = 1;
27252728
if (D_800E9F2C[playerId] < 0xFA) {
27262729
D_800E9F2C[playerId]++;
@@ -2753,11 +2756,14 @@ void func_800C8770(u8 playerId) {
27532756

27542757
// Checks the same field for all players before doing something?
27552758
void func_800C8920(void) {
2756-
if (((u8) D_800EA168 != 0) && ((gPlayers[0].effects & 0x40000000) != 0x40000000) &&
2757-
((gPlayers[1].effects & 0x40000000) != 0x40000000) && ((gPlayers[2].effects & 0x40000000) != 0x40000000) &&
2758-
((gPlayers[3].effects & 0x40000000) != 0x40000000) && ((gPlayers[4].effects & 0x40000000) != 0x40000000) &&
2759-
((gPlayers[5].effects & 0x40000000) != 0x40000000) && ((gPlayers[6].effects & 0x40000000) != 0x40000000) &&
2760-
((gPlayers[7].effects & 0x40000000) != 0x40000000)) {
2759+
if (((u8) D_800EA168 != 0) && ((gPlayers[0].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2760+
((gPlayers[1].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2761+
((gPlayers[2].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2762+
((gPlayers[3].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2763+
((gPlayers[4].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2764+
((gPlayers[5].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2765+
((gPlayers[6].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT) &&
2766+
((gPlayers[7].effects & LIGHTNING_EFFECT) != LIGHTNING_EFFECT)) {
27612767
func_800CAC08();
27622768
}
27632769
}
@@ -2928,7 +2934,8 @@ void func_800C90F4(u8 playerId, u32 soundBits) {
29282934
((soundBits & ~0xF0) == SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x05))) {
29292935
D_800EA180 = 1;
29302936
}
2931-
if (((gPlayers[playerId].effects & 0x40000000) == 0x40000000) && ((s32) D_800E9F2C[playerId] >= 0x1F)) {
2937+
if (((gPlayers[playerId].effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) &&
2938+
((s32) D_800E9F2C[playerId] >= 0x1F)) {
29322939
play_sound(soundBits, &D_800E9F7C[playerId].pos, playerId, &D_800EA150, &D_800EA1D4,
29332940
(s8*) &D_800E9F7C[playerId].unk_14);
29342941
} else {
@@ -2957,7 +2964,8 @@ void func_800C92CC(u8 playerId, u32 soundBits) {
29572964
(u8) var_s0, soundBits);
29582965
if (temp_v0 != NULL) {
29592966
temp_v0->unk34 = 170.0f;
2960-
if (((gPlayers[playerId].effects & 0x40000000) == 0x40000000) && ((s32) D_800E9F2C[playerId] >= 0x1F)) {
2967+
if (((gPlayers[playerId].effects & LIGHTNING_EFFECT) == LIGHTNING_EFFECT) &&
2968+
((s32) D_800E9F2C[playerId] >= 0x1F)) {
29612969
play_sound((gPlayers[playerId].characterId * 0x10) + soundBits, &temp_v0->unk18, var_s0,
29622970
&D_800EA150, &D_800EA1D4, (s8*) &D_800EA06C[playerId].unk0C);
29632971
} else {

0 commit comments

Comments
 (0)