Player bitflag attributes (#750)

* unk_044 initial documentation

* Define player.unk_044 magic values

* Turns more than 5 degrees

* Lakitu Effects

* UNK_0B6 (effect graphics) documentation

* UNK_002 documentation

* Document UNK_0DE and define magic values

* Use defined player types

* Rename `player->unk_0CA` to `lakitu_props`

* rename `player->unk_0B6` to `kart_graphics`

* Rename `player->unk_0DE` to `oobProps`

* rename `player->unk_044` to kartProps

* Formatting updates

* Use camelCase instead of snake_case for player properties

* Fix reference to wrong attribute in comment

* Rename `PRESS_A` to `THROTTLE`

Rename `PRESS_A` to `THROTTLE` to describe the Kart state, which may be slightly different than just pressing A.
This commit is contained in:
Jed Grabman
2025-09-15 20:34:25 -04:00
committed by GitHub
parent e49fe2acfc
commit d3feca2536
22 changed files with 551 additions and 410 deletions
+4 -4
View File
@@ -263,7 +263,7 @@ typedef struct {
/* 0x0034 */ Vec3f velocity;
/* 0x0040 */ s16 unk_040;
/* 0x0042 */ s16 unk_042;
/* 0x0044 */ s16 unk_044;
/* 0x0044 */ s16 kartProps;
/* 0x0046 */ u16 unk_046;
/* 0x0048 */ Vec4s unk_048;
/* 0x0050 */ Vec4s unk_050;
@@ -293,7 +293,7 @@ typedef struct {
/* 0x00B0 */ s16 unk_0B0;
/* 0x00B2 */ s16 unk_0B2;
/* 0x00B4 */ u16 unk_0B4;
/* 0x00B6 */ u16 unk_0B6;
/* 0x00B6 */ u16 kartGraphics;
/* 0x00B8 */ f32 unk_0B8;
/* 0x00BC */ u32 effects;
/* 0x00C0 */ s16 unk_0C0;
@@ -301,11 +301,11 @@ typedef struct {
/* 0x00C4 */ s16 slopeAccel;
/* 0x00C6 */ s16 alpha;
/* 0x00C8 */ s16 unk_0C8;
/* 0x00CA */ s16 unk_0CA;
/* 0x00CA */ s16 lakituProps;
/* 0x00CC */ Vec4s unk_0CC;
/* 0x00D4 */ Vec4s unk_0D4;
/* 0x00DC */ s16 boostTimer;
/* 0x00DE */ u16 unk_0DE;
/* 0x00DE */ u16 oobProps;
/* 0x00E0 */ s16 unk_0E0;
/* 0x00E2 */ s16 unk_0E2;
/* 0x00E4 */ f32 unk_0E4;
+67 -5
View File
@@ -93,7 +93,9 @@
* Used in the Player struct's 'type' member: player->type
*/
#define PLAYER_INACTIVE 0 // 0x0000
#define PLAYER_UNKNOWN_0x10 (1 << 4) // 0x0010 // unused?
#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
#define PLAYER_UNKNOWN_0x80 (1 << 7) // 0x0080 // UNUSED
#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
@@ -327,6 +329,64 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
* @brief Max representable time, 100 minutes measured in centiseconds
*/
#define MAX_TIME 0x927C0
#define DEGREES_CONVERSION_FACTOR 182
// player->oobProps
/* Deals with the lower out of bounds (OOB) plane on levels. Represented by fluids (water / lava)
or nothing for Rainbow Road and Skyscraper. */
#define UNDER_OOB_OR_FLUID_LEVEL 0x1 // Set while mostly under the plane. Does not necessarily trigger Lakitu on Koopa Troopa Beach.
#define PASS_OOB_OR_FLUID_LEVEL 0x2 // Set when passing through the lower plane in either direction
// The next two are also activated when passing through the lower plane.
#define UNDER_FLUID_LEVEL 0x4 // Stays active until Lakitu places back on track
#define UNDER_OOB_LEVEL 0x8 // Active while under a non-fluid OOB plane. Is momentarily active when passing through fluids.
/* UNK_002 has something to do with player animations. Each player has a 32-bit
flag broken into 8 groups of 4 bits. Those 4 bits affect how each of the 8 players
appear to the specified player */
#define CHANGING_ANIMATION 0x1 // Seems to be set when the kart animation has to change.
#define UNK_002_UNKNOWN_0x2 0x2
#define UNK_002_UNKNOWN_0x4 0x4 /* Unclear, but has to do with viewing the side of player. At least tends to change if target
player spins. Something with avoding rollover of aniamation frame data? */
#define SIDE_OF_KART 0x8 // Seems to be whether you are in a rectangle shooting out from both sides of target player
#define WHISTLE 0x20 // Whistle spinout save graphic
#define CRASH 0x40 // Crash! graphic (vertical tumble)
#define WHIRRR 0x80 // Whirrr! graphic (spinning out)
#define POOMP 0x100 // Poomp! graphic (landing from a height)
#define BOING 0x800 // Boing! graphic (hopping)
#define EXPLOSION 0x1000 // Big shock looking graphic when starting tumble
// player->lakituProps
#define LAKITU_RETRIEVAL 0x1 // While lakitu is grabbing you, but before the scene transition of being placed on the track
#define HELD_BY_LAKITU 0x2
#define LAKITU_FIZZLE 0x4 // Disintegration and reintegration effect when transitioning from retrieval to placement
#define LAKITU_SCENE 0x8 // the whole segment from when lakitu is called to when you regain control
#define FRIGID_EFFECT 0x10 // Cold colors on Sherbet Land after in frigid water
#define THAWING_EFFECT 0x20 // Regaining usual colors post frigid effect
#define FROZEN_EFFECT 0x80 // In the ice cube
#define WENT_OVER_OOB 0x100 // Player went over (or is on) an OOB area. Cancelled if touch back in bounds
#define LAKITU_LAVA 0x1000 // smoky effect when retrieved from lava
#define LAKITU_WATER 0x2000 // dripping effect when retreived from water
// player->kartProps
#define BACK_UP 0x1
#define RIGHT_TURN 0x2 // non-drifting (more than 5 degrees)
#define LEFT_TURN 0x4 // non-drifting (more than 5 degrees)
#define MOVE_BACKWARDS 0x8 // includes lakitu
#define LOSE_GP_RACE 0x10 // pointless, only unsets itself
#define THROTTLE 0x20 // Closely tied to just pressing A. Possible exception for AB-spins
#define EARLY_SPINOUT_RIGHT 0x40 // Spinning out while facing right (not actually used for anything)
#define EARLY_SPINOUT_LEFT 0x80 // Spinning out while facing left
#define POST_TUMBLE_GAS 0x100 // Causes particles after a vertical tumble, I think
#define BECOME_INVISIBLE 0x200
#define UNUSED_0x400 0x400 // locked behind 0x800 (func_80091440)
#define UNUSED_0x800 0x800 // locked behind 0x400 (func_8002B830 -> func_800911B4)
#define UNUSED_0x1000 0x1000 // 0x1000 locked behind 0x400 (func_8002B830 -> func_800911B4)
#define UNUSED_0x2000 0x2000 // 0x2000 locked behind 0x400 and 0x800 (func_8002B830 -> func_800911B4, apply_effect -> func_80091298,
// func_80091440)
#define DRIVING_SPINOUT 0x4000
#define UNKNOWN_BATTLE_VAR 0x8000 // 0x8000 something battle related, unclear if ever set
/*
* @brief triggers indicating that an effect should be applied to a kart
@@ -357,11 +417,13 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
#define ALL_TRIGGERS (0xFFFFFFFF)
#define RACING_SPINOUT_TRIGGERS (SPINOUT_TRIGGER | DRIVING_SPINOUT_TRIGGER | HIT_BANANA_TRIGGER) // 0x200081
#define RAMP_BOOST_TRIGGERS (BOOST_RAMP_ASPHALT_TRIGGER | BOOST_RAMP_WOOD_TRIGGER) // 0x00808000
#define ANY_BOOST_TRIGGERS (RAMP_BOOST_TRIGGERS | SHROOM_TRIGGER) // 0x00808200
#define STATE_TRANSITION_TRIGGERS (STAR_TRIGGER | BOO_TRIGGER | UNUSED_TRIGGER_0x1000 | UNUSED_TRIGGER_0x20000)// 0x00023800
#define HIT_TRIGGERS (HIT_BY_STAR_TRIGGER | VERTICAL_TUMBLE_TRIGGER | \
LIGHTNING_STRIKE_TRIGGER | LOW_TUMBLE_TRIGGER | HIGH_TUMBLE_TRIGGER | THWOMP_SQUISH_TRIGGER) // 0x01404106
#define RAMP_BOOST_TRIGGERS (BOOST_RAMP_ASPHALT_TRIGGER | BOOST_RAMP_WOOD_TRIGGER) // 0x00808000
#define ANY_BOOST_TRIGGERS (RAMP_BOOST_TRIGGERS | SHROOM_TRIGGER) // 0x00808200
#define STATE_TRANSITION_TRIGGERS \
(STAR_TRIGGER | BOO_TRIGGER | UNUSED_TRIGGER_0x1000 | UNUSED_TRIGGER_0x20000) // 0x00023800
#define HIT_TRIGGERS \
(HIT_BY_STAR_TRIGGER | VERTICAL_TUMBLE_TRIGGER | LIGHTNING_STRIKE_TRIGGER | LOW_TUMBLE_TRIGGER | \
HIGH_TUMBLE_TRIGGER | THWOMP_SQUISH_TRIGGER) // 0x01404106
/**
* @brief effect of player's