Skip to content

Commit

Permalink
some define comment and replace number by const (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
coco875 authored Oct 19, 2023
1 parent ac17d94 commit 134e126
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 162 deletions.
99 changes: 48 additions & 51 deletions include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@


/**
* Options for Controller Pak state
* @brief Options for Controller Pak state
*/
#define OK 1
#define BAD 0

/**
* Enable debug mode
* @brief Enable debug mode
*
* Press start to skip through menus
*
Expand Down Expand Up @@ -37,13 +37,13 @@
* D-pad RIGHT = BOWSER
* D-pad DOWN = MARIO
*
*/
*/
#define DEBUG_MODE 0
#define DEBUG_MENU 1
#define HOLD_ALL_DPAD_AND_C_BUTTONS (U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS)

/**
* Options for gDebugMenuSelection
* @brief Options for gDebugMenuSelection
*/
#define DEBUG_MENU_DISABLED 1
#define DEBUG_MENU_DEBUG_MODE 2
Expand All @@ -55,16 +55,15 @@
#define DEBUG_MENU_EXITED 64

/**
* Options for gDebugGotoScene
* @brief Options for gDebugGotoScene
*/
#define DEBUG_GOTO_RACING 0
#define DEBUG_GOTO_ENDING_SEQUENCE 1
#define DEBUG_GOTO_CREDITS_SEQUENCE_CC_50 2
#define DEBUG_GOTO_CREDITS_SEQUENCE_CC_EXTRA 3

/**
* Jump to demo mode from the debug menu
* using L and A
* @brief Jump to demo mode from the debug menu using L and A
*/
#define DEMO_MODE_ACTIVE 1
#define DEMO_MODE_INACTIVE 0
Expand All @@ -75,18 +74,16 @@
* Start sequence means waiting for the light to turn green.
* Used in the Player struct's 'type' member: player->type
*/

#define PLAYER_INACTIVE 0 // 0x0000
#define PLAYER_EXISTS (1 << 15) // 0x8000
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_CPU (1 << 12) // 0x1000
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_HUMAN (1 << 14) // 0x4000
#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
#define PLAYER_UNKNOWN_0x40 (1 << 6) // 0x0040
// unused?
#define PLAYER_UNKNOWN (1 << 10) // 0x0400
#define PLAYER_EXISTS (1 << 15) // 0x8000

// Compiles to -0x1000 in diff.py
#define PLAYER_HUMAN_AND_CPU PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_CPU | PLAYER_START_SEQUENCE
Expand Down Expand Up @@ -117,15 +114,15 @@
#define MAX_NUM_MAIN_MENU_GAME_TYPES 3

/**
* Options for gModeSelection
**/
* @brief Options for gModeSelection
*/
#define GRAND_PRIX 0
#define TIME_TRIALS 1
#define VERSUS 2
#define BATTLE 3

/**
* Options for gCCSelection
* @brief Options for gCCSelection
* CC stands for cubic-centimetres.
* It measures engine displacement composed from
* cylinder volume.
Expand All @@ -139,11 +136,11 @@
#define CC_BATTLE 4

/**
* Options for gCupSelection
* @brief Options for gCupSelection
* There is a "cup" for battle mode, probably so that
* the battle courses could be displayed in the same
* way race courses are.
**/
*/
#define MUSHROOM_CUP 0
#define FLOWER_CUP 1
#define STAR_CUP 2
Expand All @@ -152,11 +149,11 @@
#define NUM_CUPS 5

/**
* Character IDs
* @brief Character IDs
* Note that these are not the same as the values
* found in gCharacterGridSelections as those are
* ordered by table
**/
*/
#define MARIO 0
#define LUIGI 1
#define YOSHI 2
Expand All @@ -167,8 +164,8 @@
#define BOWSER 7

/**
* Options for gMenuSelection
**/
* @brief Options for gMenuSelection
*/
#define OPTIONS_MENU 5
#define DATA_MENU 6
#define COURSE_DATA_MENU 7
Expand All @@ -181,8 +178,8 @@
#define RACING_DUPLICATE 14

/**
* Options for gGameState gMenuSelectionFromQuit and gMenuSelectionFromEndingSequence
**/
* @brief Options for gGameState gMenuSelectionFromQuit and gMenuSelectionFromEndingSequence
*/
#define START_MENU_FROM_QUIT 0
#define MAIN_MENU_FROM_QUIT 1
#define PLAYER_SELECT_MENU_FROM_QUIT 2
Expand All @@ -192,8 +189,8 @@
#define CREDITS_SEQUENCE 9

/**
* Options for gMainMenuSelectionDepth
**/
* @brief Options for gMainMenuSelectionDepth
*/
#define BLANK_MAIN_MENU 0
#define OPTIONS_SELECTION 1
#define DATA_SELECTION 2
Expand All @@ -205,8 +202,8 @@
#define TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT 8

/**
* Options for gControllerPakMenuSelection
**/
* @brief Options for gControllerPakMenuSelection
*/
#define CONTROLLER_PAK_MENU_SELECT_RECORD 1
#define CONTROLLER_PAK_MENU_END 2
#define CONTROLLER_PAK_MENU_ERASE 3
Expand All @@ -219,7 +216,7 @@
#define CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED 10

/**
* Options for gScreenModeSelection and gActiveScreenMode
* @brief Options for gScreenModeSelection and gActiveScreenMode
*/
#define SCREEN_MODE_1P 0
#define SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL 1
Expand All @@ -228,8 +225,8 @@
#define NUM_SCREEN_MODES 4

/**
* Indexes for accessing Time Trial records
**/
* @brief Indexes for accessing Time Trial records
*/
#define TIME_TRIAL_3LAP_RECORD_1 0
#define TIME_TRIAL_3LAP_RECORD_2 1
#define TIME_TRIAL_3LAP_RECORD_3 2
Expand All @@ -238,13 +235,13 @@
#define TIME_TRIAL_1LAP_RECORD 5

/**
* Text color options
* @brief Text color options
* The 2 cycling options cycle through Blue -> Green -> Red
* Cycle 2 appears to be one step ahead of Cycle 1
* Other values like 6 and 7 sort of work, they cause rapid
* flashing between 2 colors, but also cause individual characters
* to be cutoff on their right side
**/
*/
#define TEXT_BLUE 0
#define TEXT_GREEN 1
#define TEXT_RED 2
Expand All @@ -253,20 +250,20 @@
#define TEXT_BLUE_GREEN_RED_CYCLE_2 5

/**
* Sound mode options
* @brief Sound mode options
* Option 2 appears to be unused, as such its probably not
* a valid option
**/
*/
#define SOUND_STEREO 0
#define SOUND_HEADPHONES 1
#define SOUND_UNUSED 2
#define SOUND_MONO 3
#define NUM_SOUND_MODES 4

/**
* Title screen demo options
* @brief Title screen demo options
* All demos use 100 CC
**/
*/
#define DEMO_ONE 0 // Mario, Mario Raceway, Grand Prix
#define DEMO_TWO 1 // Yoshi DK, Choco Mountain, Versus
#define DEMO_THREE 2 // Luigi, Kalamari Desert, Grand Prix
Expand All @@ -282,8 +279,8 @@
#define NUM_COURSES_PER_CUP 4

/**
* Item IDs
**/
* @brief Item IDs
*/
#define ITEM_NONE 0
#define ITEM_BANANA 1
#define ITEM_BANANA_BUNCH 2
Expand All @@ -302,29 +299,29 @@
#define ITEM_SUPER_MUSHROOM 15

/**
* Balloon status
**/
* @brief Balloon status
*/
#define BALLOON_STATUS_GONE 0
#define BALLOON_STATUS_PRESENT 1
#define BALLOON_STATUS_DEPARTING 2

/**
* Max representable time, 100 minutes measured in centiseconds
* @brief Max representable time, 100 minutes measured in centiseconds
*/
#define MAX_TIME 0x927C0

/**
* @brief effect of player's
* for statusEffect
*/
#define BOOST_EFFECT 0x200 // being boosted by trigger a mushroom or star
#define BOO_EFFECT 0x800 // being a boo
#define STAR_EFFECT 0x2000 // being a star
#define HOLD_BANANA_EFFECT 0x40000 // holding a banana
#define BOOST_EFFECT 0x200 // being boosted by trigger a mushroom or star
#define BOO_EFFECT 0x800 // being a boo
#define STAR_EFFECT 0x2000 // being a star
#define HIT_ROTATING_EFFECT 0x4000 // hitting a rotating object
#define HIT_BY_ITEM_EFFECT 0x1000000 // being hit by an item
#define REVERSE_EFFECT 0x400000 // being in the wrong direction
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define HOLD_BANANA_EFFECT 0x40000 // holding a banana
#define REVERSE_EFFECT 0x400000 // being in the wrong direction
#define HIT_BY_ITEM_EFFECT 0x1000000 // being hit by an item
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning


/**
Expand Down
4 changes: 2 additions & 2 deletions src/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ void func_8001F394(Player *player, f32 *arg1) {
}

if (D_80164A08[playerIndex] == 0) {
if (player->statusEffects & 0x40000) {
if (player->statusEffects & HOLD_BANANA_EFFECT) {
D_80164A08[playerIndex] = 1;
}
if ((player->effects & 0x2000) == 0x2000) {
Expand All @@ -1025,7 +1025,7 @@ void func_8001F394(Player *player, f32 *arg1) {
}
switch (D_80164A08[playerIndex]) {
case 1:
if (player->statusEffects & 0x40000) {
if (player->statusEffects & HOLD_BANANA_EFFECT) {
move_f32_towards(&D_80164498[playerIndex], 20.0f, 0.2f);
} else {
if (D_80164498[playerIndex] > 1.0f) {
Expand Down
22 changes: 11 additions & 11 deletions src/code_80005FD0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ void func_8000929C(s32 playerId, Player *player) {
func_80008F38(playerId);
func_80011AE4(playerId);
*(&D_801642DE + (playerId * 0x10)) = 0;
if ((D_8016348C == 0) && !(player->type & 0x800)) {
if ((D_8016348C == 0) && !(player->type & PLAYER_CINEMATIC_MODE)) {
sp30 = var_a3;
sp34 = var_t0;
temp_f0_2 = func_80009258(playerId, sp38, sp44, (u16 *) var_a3);
Expand Down Expand Up @@ -6219,7 +6219,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3
if ((temp_f0 > -20.0) && (temp_f0 < 20.0)) {
temp_f0_2 = (f64) temp_f24;
if ((temp_f0_2 > -100.0) && (temp_f0_2 < 100.0) && (func_80006018(temp_f12, temp_f14, var_s0->velocity[0], var_s0->velocity[2], arg3, arg4, spC4, spBC) == (s32) 1U)) {
player->statusEffects |= 0x400000;
player->statusEffects |= REVERSE_EFFECT;
}
}
}
Expand Down Expand Up @@ -8821,7 +8821,7 @@ void func_8001AC10(s32 playerId) {
struct BananaBunchParent *bananaBunchParent;

player = &gPlayerOne[playerId];
if (((gModeSelection != ((s32) 1)) && (((u16) D_801646CC) != ((u16) 1))) && (!(player->type & 0x800))) {
if (((gModeSelection != ((s32) 1)) && (((u16) D_801646CC) != ((u16) 1))) && (!(player->type & PLAYER_CINEMATIC_MODE))) {
temp_s0 = &D_801642D8[playerId];
switch (temp_s0->unk_00) {
case 0:
Expand Down Expand Up @@ -8857,7 +8857,7 @@ void func_8001AC10(s32 playerId) {
} else if (temp_s0->unk_00 == 1) {
temp_s0->actorIndex = use_banana_item(player);
if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
player->statusEffects |= 0x40000;
player->statusEffects |= HOLD_BANANA_EFFECT;
temp_s0->unk_00 = 2;
temp_s0->unk_04 = 0;
temp_s0->unk_06 += 1;
Expand Down Expand Up @@ -8903,7 +8903,7 @@ void func_8001AC10(s32 playerId) {
if ((temp_s0->actorIndex >= 0) && (temp_s0->actorIndex < 0x64)) {
banana = (struct BananaActor*)&gActorList[temp_s0->actorIndex];
banana->state = 4;
player->statusEffects |= 0x40000;
player->statusEffects |= HOLD_BANANA_EFFECT;
temp_s0->unk_00 = 0x0023;
temp_s0->unk_04 = 0;
temp_s0->unk_06 += 1;
Expand Down Expand Up @@ -9179,7 +9179,7 @@ void func_8001AC10(s32 playerId) {
break;

case 25:
player->statusEffects |= 0x2000;
player->statusEffects |= STAR_EFFECT;
temp_s0->unk_00 = 0x001A;
temp_s0->unk_04 = 0;
temp_s0->unk_06 += 1;
Expand All @@ -9193,7 +9193,7 @@ void func_8001AC10(s32 playerId) {
break;

case 27:
player->statusEffects |= 0x800;
player->statusEffects |= BOO_EFFECT;
temp_s0->unk_00 = 0x001C;
temp_s0->unk_04 = 0;
temp_s0->unk_06 += 1;
Expand All @@ -9207,23 +9207,23 @@ void func_8001AC10(s32 playerId) {
break;

case 29:
player->statusEffects |= 0x200;
player->statusEffects |= BOOST_EFFECT;
temp_s0->unk_00 = 0;
temp_s0->unk_04 = 0;
temp_s0->unk_06 += 1;
break;

case 30:
if (temp_s0->unk_04 >= 0x3D) {
player->statusEffects |= 0x200;
player->statusEffects |= BOOST_EFFECT;
temp_s0->unk_00 = 0x001D;
temp_s0->unk_04 = 0;
}
break;

case 31:
if (temp_s0->unk_04 >= 0x3D) {
player->statusEffects |= 0x200;
player->statusEffects |= BOOST_EFFECT;
temp_s0->unk_00 = 0x001E;
temp_s0->unk_04 = 0;
}
Expand All @@ -9237,7 +9237,7 @@ void func_8001AC10(s32 playerId) {

case 33:
if ((((s16) temp_s0->unk_04) % 60) == 0) {
player->statusEffects |= 0x200;
player->statusEffects |= BOOST_EFFECT;
if (temp_s0->unk_0E < temp_s0->unk_04) {
temp_s0->unk_00 = 0;
temp_s0->unk_04 = 0;
Expand Down
Loading

0 comments on commit 134e126

Please sign in to comment.