Skip to content

Commit 2e7ba09

Browse files
authored
Instant spinout bug documentation (#753)
1 parent d3feca2 commit 2e7ba09

5 files changed

Lines changed: 20 additions & 10 deletions

File tree

include/defines.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,16 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
331331
#define MAX_TIME 0x927C0
332332
#define DEGREES_CONVERSION_FACTOR 182
333333

334+
// player->unk_046
335+
336+
/* The first time you touch a penguin or bat, and anytime you touch a thwomp during a
337+
race will set a flag which will cause your next spinout to be instant (i.e. no
338+
sliding forward). Probably half-implemented code to prevent sliding through enemies,
339+
but causes this bug */
340+
#define CRITTER_TOUCH 0x2 // Touched a penguin, bat or thwomp
341+
#define CRITTER_TOUCH_GATE 0x4
342+
#define INSTANT_SPINOUT 0x40
343+
334344
// player->oobProps
335345
/* Deals with the lower out of bounds (OOB) plane on levels. Represented by fluids (water / lava)
336346
or nothing for Rainbow Road and Skyscraper. */

src/code_80086E70.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ f32 func_8008933C(Player* player, s32 objectIndex, f32 arg2, f32 arg3) {
10421042
var_f2 = 0.0f;
10431043
if (temp_v1->unk_18[6] == 0) {
10441044
object = &gObjectList[objectIndex];
1045-
player->unk_046 |= 2;
1045+
player->unk_046 |= CRITTER_TOUCH;
10461046
player->effects |= ENEMY_BONK_EFFECT;
10471047
temp_v1->unk_18[6] = 4;
10481048
something = (player->pos[0] - object->pos[0]) * object->velocity[0];

src/effects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void func_8008C8C4(Player* player, s8 playerId) {
307307
D_80165190[2][playerId] = 1;
308308
D_80165190[3][playerId] = 1;
309309

310-
player->unk_046 &= 0xFFBF;
310+
player->unk_046 &= ~INSTANT_SPINOUT;
311311

312312
if ((gIsPlayerTripleAButtonCombo[playerId] == true) && ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN)) {
313313
player->currentSpeed = (f32) (player->currentSpeed + 100.0f);
@@ -325,7 +325,7 @@ void func_8008C9EC(Player* player, s8 playerIndex) {
325325

326326
player->unk_206 = 0;
327327
player->slopeAccel = 0;
328-
if ((player->unk_046 & 0x40) == 0x40) {
328+
if ((player->unk_046 & INSTANT_SPINOUT) == INSTANT_SPINOUT) {
329329
player_decelerate_alternative(player, 100.0f);
330330
} else {
331331
if ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) {

src/player_controller.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ void func_8002B9CC(Player* player, s8 playerIndex, UNUSED s32 arg2) {
15821582
s16 temp;
15831583
s16 temp2;
15841584

1585-
if ((player->unk_046 & 2) == 2) {
1585+
if ((player->unk_046 & CRITTER_TOUCH) == CRITTER_TOUCH) {
15861586
temp_f0 = D_8018CE10[playerIndex].unk_04[0];
15871587
temp_f2 = 0;
15881588
temp_f14 = D_8018CE10[playerIndex].unk_04[2];
@@ -1890,10 +1890,10 @@ void func_8002C7E4(Player* player, s8 playerIndex, s8 arg2) {
18901890
if ((player->type & PLAYER_HUMAN) == PLAYER_HUMAN) {
18911891
func_8001CA24(player, 2.8f);
18921892
}
1893-
if ((player->unk_046 & 2) == 2) {
1894-
if ((player->unk_046 & 4) != 4) {
1895-
player->unk_046 |= 4;
1896-
player->unk_046 |= 0x40;
1893+
if ((player->unk_046 & CRITTER_TOUCH) == CRITTER_TOUCH) {
1894+
if ((player->unk_046 & CRITTER_TOUCH_GATE) != CRITTER_TOUCH_GATE) {
1895+
player->unk_046 |= CRITTER_TOUCH_GATE;
1896+
player->unk_046 |= INSTANT_SPINOUT;
18971897
if (player->effects & MUSHROOM_EFFECT) {
18981898
remove_mushroom_effect(player);
18991899
}

src/update_objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6004,7 +6004,7 @@ void func_80080B28(s32 objectIndex, s32 playerId) {
60046004
}
60056005
func_800722A4(objectIndex, 2);
60066006
temp_s0->unk_040 = (s16) objectIndex;
6007-
temp_s0->unk_046 |= 2;
6007+
temp_s0->unk_046 |= CRITTER_TOUCH;
60086008
temp_s0->triggers |= THWOMP_SQUISH_TRIGGER;
60096009
func_80088FF0(temp_s0);
60106010
}
@@ -6144,7 +6144,7 @@ void func_80081210(void) {
61446144
player = gPlayerOne;
61456145
for (var_s4 = 0; var_s4 < NUM_PLAYERS; var_s4++, player++) {
61466146
player->tyres[FRONT_LEFT].unk_14 &= ~3;
6147-
player->unk_046 &= ~0x0006;
6147+
player->unk_046 &= ~(CRITTER_TOUCH_GATE | CRITTER_TOUCH);
61486148
for (var_s2_3 = 0; var_s2_3 < gNumActiveThwomps; var_s2_3++) {
61496149
objectIndex = indexObjectList1[var_s2_3];
61506150
if (!(player->effects & BOO_EFFECT)) {

0 commit comments

Comments
 (0)