Files
coco875 203090e591 update with the decomp (#97)
* Update menus.c (#634)

* Update common_data.yml (#635)

* Renames for screenId and other changes (#636)

* screenId renames

* Rename surface map to collision mesh (#637)

* Rename some stack vars (#638)

* Fix syntax error (#639)

* Rename some stack vars

* Update collision.c

* Collision Documentation (#640)

* Collision related renames

* update doxygen (#649)

* change bool (#644)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* Update (#642)

* Delete trig_tables_bss.c (#650)

* fix typo audio (#656)

* fix typo src actor (#657)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix typo include (#658)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix course (#659)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix typo debug (#660)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix typo data (#661)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* replace number with const (#665)

* fix typo buffers (#655)

* fix typo buffers

* tweak ld file

* rename to sMemoryPool

* add a warning

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix typo src (#654)

* fix typo src

* fix non matcing

* Update code_80091750.c

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix typo racing (#653)

* fix typo racing

* get it match

* replace G_LINE3D to G_QUAD

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix typo src (#652)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* fix ending typo (#651)

* Action more info when it doesn't match and fix first diff (#662)

* Update linux-compile.yml

* fix first-diff

* Update first-diff.py

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* document texture of kart (#663)

* document texture of kart

* change screenPlayerId to screenId

* some documentation around object

* Revert "some documentation around object"

This reverts commit cbb39078e036bf2a417bed67359e910213acab28.

* more rename

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* Make evaluate_collision_players_palm_tree better (#667)

This matches just the same as before,	but using those two casts instead of
shifts seems more likely to be accurate to the original source code

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>

* add fedora instruciton (#666)

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* start documenting animation (#668)

* start documenting animation

* Update course_data.c

* change comment

* update libultra asm (#648)

* update libultra asm

* fix gcc __osThreadTail

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* Document Vehicles (#641)

* start doc collision

* fix merge

* finish rename fonction related to vehicle

* document around waypoint of vehicle

* make some modification

* make some change and rename one

* copy_ to oldPos

* doc smoke ferry and train

* some rename

* fix some renaming

* precise index

* rename a funciton

* simplify waypoint_vehicles

* change some name

* change some name

* rename move_to_point_direction

* fix some conflict

* Update code_80005FD0.c

* Update code_80005FD0.h

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* Label a save info loop (#645)

* save info

* more gcc progress

* fix a value and do a rename (#669)

* update clang and add action (#664)

* update clang and add action

* try clang on course folder only

* forget two file

* Update course_displaylists.inc.c

* forget few other file

* Update course_vertices.inc.c

* format all code while get it match

* second pass

* format other dir

* disable clang format on bad ido code

* fix some tabulation

* revert format on tool dir

* Update clang-format.yml

* ignore gbi.h

* add some read me instruction

* fix error

* format and fixing error

* Update README.md

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* Update linkonly_generator.py (#670)

* some rename for torch (#588)

* rename gBombKartSpawns, and fix cup ID

* Update doxygen_syms.md

* rename for gCourseIndexInCup and his constant

* rename to gCupSelectedCourseIndex

* forget a change in constant

* fix compilation issue

* Update Dockerfile to latest Ubuntu LTS + fixed missing cmake (#674)

* Fix color font matrix function (#676)

* Fix label variables used in menus (#675)

* Fix label variables used in menus

* split D_800F2BDC and clang format menu.c

---------

Co-authored-by: coco875 <pereira.jannin@gmail.com>

* Fix some libultra struct types (#677)

* Uintptr (#671)

* Update render_courses.c

* Update math_util.c

* Update math_util.c

* Update math_util.h

* Update render_courses.c

* Clang suggest (#678)

* add clang suggestion

* Update clang-format-suggest.yml

* Update clang-format-suggest.yml

* simplify

* switch to ubuntu

* Update clang-format-suggest.yml

* update ubuntu

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* Clang pr (#679)

* Create clang-pr.yml

* Update clang-pr.yml

* Update osCreateMesgQueue.c

* Update osCreateMesgQueue.c

* Update clang-pr.yml

* Update clang-pr.yml

* Update clang-format.yml

* clang format (#680)

Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>

* some rename in ceremony (#647)

* rename ceremony

* apply some suggestion

* some rename

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* clang format (#681)

Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>

* Rename Object Timing Related Code (#673)

* start making models extraction with blender

* finishing extract model

* Update fast64

* extract course

* Update fast64

* Update fast64

* simplify import of course_displaylists and course_textures and remplace adress with texture

* Update fast64

* change data format and simplify the thread queue

* move in a blender folder

* remove fast64

* re add fast64

* add model_extract and fast64_blender in makefile

* multithread with make file split the models into multiple json and add course segment

* Update fast64

* remove old model_extract

* remove the error when he don't find blender

* start rename around course section

* rename around object

* update submodule fast64

* fix compilation issue and add some model to extract

* Update fast64

* remove fast64

* re add fast64

* update submodule

* fix compilation issue

* add other collision gfx and prepare reorganise file

* re arrange json

* Create README.MD

* Update README.MD

* Update README.MD

* update fast64

* rename to initiate_next_state

* Revert "Merge branch '3d-objects' into general-object"

This reverts commit f5347b38cc75af4d10ee3726dc1524c1c71d6849, reversing
changes made to a353c4d954fb5b50c8b48fe3f9d67c95ccaab299.

* revert the revert...

* revert 3d-models PR

* finish some revert

* Update code_80005FD0.c

* fix code_80091750.c

* Update code_80091750.c

* rename isTimerRunning to isTimerActive and set_object_timer_running to set_object_timer_state

* rename to initialize_next_state

* rename to object_next_state

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* extract models with blender (#577)

* start making models extraction with blender

* finishing extract model

* Update fast64

* extract course

* Update fast64

* Update fast64

* simplify import of course_displaylists and course_textures and remplace adress with texture

* Update fast64

* change data format and simplify the thread queue

* move in a blender folder

* remove fast64

* re add fast64

* add model_extract and fast64_blender in makefile

* multithread with make file split the models into multiple json and add course segment

* Update fast64

* remove old model_extract

* remove the error when he don't find blender

* start rename around course section

* update submodule fast64

* fix compilation issue and add some model to extract

* Update fast64

* remove fast64

* re add fast64

* update submodule

* fix compilation issue

* add other collision gfx and prepare reorganise file

* re arrange json

* Create README.MD

* Update README.MD

* Update README.MD

* update fast64

---------

Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>

* other

* fix some error of compilation

* finish fix all error

---------

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
Co-authored-by: Gabriel Ravier <gabravier@gmail.com>
Co-authored-by: MisterSheeple <27652712+MisterSheeple@users.noreply.github.com>
Co-authored-by: AloXado320 <38191089+AloXado320@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
2024-09-17 09:32:50 -06:00

413 lines
11 KiB
C

#ifndef DEFINES_H
#define DEFINES_H
/**
* @brief Options for Controller Pak state
*/
#define OK 1
#define BAD 0
/**
* @brief Enable debug mode
*
* Press start to skip through menus
*
* Toggle resource meters by holding R and tapping B. L must not be held.
*
* Reset to start screen by holding A, B, R, and L.
*
* View player direction and currentPathPoint in a single player race during staging tap L while holding A and B.
* Turn off this UI by tapping R while holding A and B.
* @bug This looks like it should work at any point in the race.
*
* Set player 1 to the final lap by tapping D-pad up.
* Set player 1 and player 2 to the final lap by tapping D-pad right.
* Set player all players to the final lap by tapping D-pad down.
*
* Immediately start the race if any controller presses Z.
*
* As the ceremony cutscene starts hold a C or D-pad to switch characters.
* C UP = LUIGI
* C LEFT = YOSHI
* C RIGHT = TOAD
* C DOWN = DK
* D-pad UP = WARIO
* D-pad LEFT = PEACH
* D-pad RIGHT = BOWSER
* D-pad DOWN = MARIO
*
*/
#if defined(GCC) || defined(DEBUG)
#define DEBUG_MODE 1
#define DEBUG_MENU 2
#else
#define DEBUG_MODE 1
#define DEBUG_MENU 2
#endif
#define HOLD_ALL_DPAD_AND_C_BUTTONS \
(U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS)
/**
* @brief Options for gDebugMenuSelection
*/
#define DEBUG_MENU_DISABLED 1
#define DEBUG_MENU_DEBUG_MODE 2
#define DEBUG_MENU_COURSE 3
#define DEBUG_MENU_SCREEN_MODE 4
#define DEBUG_MENU_PLAYER 5
#define DEBUG_MENU_SOUND_MODE 6
#define DEBUG_MENU_GIVE_ALL_GOLD_CUP 7
#define DEBUG_MENU_EXITED 64
/**
* @brief Options for gDebugGotoScene
*/
#define DEBUG_GOTO_RACING 0
#define DEBUG_GOTO_ENDING 1
#define DEBUG_GOTO_CREDITS_SEQUENCE_CC_50 2
#define DEBUG_GOTO_CREDITS_SEQUENCE_CC_EXTRA 3
/**
* @brief Jump to demo mode from the debug menu using L and A
*/
#define DEMO_MODE_ACTIVE 1
#define DEMO_MODE_INACTIVE 0
#ifdef VERSION_EU
#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
#else
#define COURSE_TIMER_ITER 0.01666666 // 1 / 60
#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60
#endif
#define V_BlANK_TIMER_ITER 0.01666666
/**
* Racing terms:
* Staging means aligning a racecar to the starting line.
* 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_UNKNOWN_0x40 (1 << 6) // 0x0040
#define PLAYER_INVISIBLE_OR_BOMB (1 << 8) // 0x0100
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_KART_AI (1 << 12) // 0x1000
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_HUMAN (1 << 14) // 0x4000
#define PLAYER_EXISTS (1 << 15) // 0x8000
// Compiles to -0x1000 in diff.py
#define PLAYER_HUMAN_AND_KART_AI PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_KART_AI | PLAYER_START_SEQUENCE
#define ZERO_PLAYERS_SELECTED 0
#define ONE_PLAYERS_SELECTED 1
#define TWO_PLAYERS_SELECTED 2
#define THREE_PLAYERS_SELECTED 3
#define FOUR_PLAYERS_SELECTED 4
#define SELECTED_PLAYER_DEFINES_TOTAL 5
enum PlayerId {
PLAYER_NONE = -1,
PLAYER_ONE = 0,
PLAYER_TWO = 1,
PLAYER_THREE = 2,
PLAYER_FOUR = 3,
PLAYER_FIVE = 4,
PLAYER_SIX = 5,
PLAYER_SEVEN = 6,
PLAYER_EIGHT = 7
};
#define NUM_PLAYERS 8
#define MARIO_SIZE 0.75f
#define LUIGI_SIZE 0.75f
#define YOSHI_SIZE 0.75f
#define TOAD_SIZE 0.75f
#define DK_SIZE 0.75f
#define WARIO_SIZE 0.75f
#define PEACH_SIZE 0.75f
#define BOWSER_SIZE 0.75f
// 2P Game has Grand Prix, VS, and Battle as available game types
#define MAX_NUM_MAIN_MENU_GAME_TYPES 3
/**
* @brief Options for gModeSelection
*/
#define GRAND_PRIX 0
#define TIME_TRIALS 1
#define VERSUS 2
#define BATTLE 3
/**
* @brief Options for gCCSelection
* CC stands for cubic-centimetres.
* It measures engine displacement composed from
* cylinder volume.
* Generally, the main determiner of horsepower output.
*/
#define CC_50 0
#define CC_100 1
#define CC_150 2
#define CC_EXTRA 3
#define CC_BATTLE 4
/**
* @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.
*/
enum { MUSHROOM_CUP, FLOWER_CUP, STAR_CUP, SPECIAL_CUP, BATTLE_CUP, NUM_CUPS };
#define NUM_COURSES_PER_CUP 4
/**
* @brief Options for gCourseIndexInCup
*/
enum { COURSE_ONE, COURSE_TWO, COURSE_THREE, COURSE_FOUR };
/**
* @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
#define TOAD 3
#define DK 4
#define WARIO 5
#define PEACH 6
#define BOWSER 7
/**
* @brief Options for gMenuSelection
*/
#define OPTIONS_MENU 5
#define DATA_MENU 6
#define COURSE_DATA_MENU 7
#define LOGO_INTRO_MENU 8
#define CONTROLLER_PAK_MENU 9
#define START_MENU 10
#define MAIN_MENU 11
#define PLAYER_SELECT_MENU 12
#define COURSE_SELECT_MENU 13
#define RACING_DUPLICATE 14
/**
* @brief Options for gGameState gGotoMode and gGotoMenu
*/
#define START_MENU_FROM_QUIT 0
#define MAIN_MENU_FROM_QUIT 1
#define PLAYER_SELECT_MENU_FROM_QUIT 2
#define COURSE_SELECT_MENU_FROM_QUIT 3
#define RACING 4
#define ENDING 5
#define CREDITS_SEQUENCE 9
/**
* @brief Options for gMainMenuSelectionDepth
*/
#define BLANK_MAIN_MENU 0
#define OPTIONS_SELECTION 1
#define DATA_SELECTION 2
#define PLAYER_NUM_SELECTION 3
#define GAME_MODE_SELECTION 4
#define GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION \
5 // Selecting CC for GP and Versus. Selecting "Begin" or "Data" for Time Trials. Unused for Battle
#define CONFIRM_OK_SELECTION 6
#define CONFIRM_OK_SELECTION_FROM_BACK_OUT 7
#define TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT 8
/**
* @brief Options for gControllerPakMenuSelection
*/
#define CONTROLLER_PAK_MENU_SELECT_RECORD 1
#define CONTROLLER_PAK_MENU_END 2
#define CONTROLLER_PAK_MENU_ERASE 3
#define CONTROLLER_PAK_MENU_QUIT 4
#define CONTROLLER_PAK_MENU_TABLE_GAME_DATA 5
#define CONTROLLER_PAK_MENU_GO_TO_ERASING 6
#define CONTROLLER_PAK_MENU_ERASING 7
#define CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED 8
#define CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK 9
#define CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED 10
/**
* @brief Options for gScreenModeSelection and gActiveScreenMode
*/
#define SCREEN_MODE_1P 0
#define SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL 1
#define SCREEN_MODE_2P_SPLITSCREEN_VERTICAL 2
#define SCREEN_MODE_3P_4P_SPLITSCREEN 3
#define NUM_SCREEN_MODES 4
/**
* @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
#define TIME_TRIAL_3LAP_RECORD_4 3
#define TIME_TRIAL_3LAP_RECORD_5 4
#define TIME_TRIAL_1LAP_RECORD 5
/**
* @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
#define TEXT_YELLOW 3
#define TEXT_BLUE_GREEN_RED_CYCLE_1 4
#define TEXT_BLUE_GREEN_RED_CYCLE_2 5
/**
* @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
/**
* @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
#define DEMO_FOUR 3 // Wario Yoshi Bowser, Wario Stadium, Versus
#define DEMO_FIVE 4 // Bowser, Bowser Castle, Grand Prix
#define DEMO_SIX 5 // Mario Luigi Peach Toad, Sherbert Land, Versus
#define NUM_DEMOS 6
/**
* @brief Item IDs
*/
enum ITEMS {
/* 0x00 */ ITEM_NONE = 0,
/* 0x01 */ ITEM_BANANA,
/* 0x02 */ ITEM_BANANA_BUNCH,
/* 0x03 */ ITEM_GREEN_SHELL,
/* 0x04 */ ITEM_TRIPLE_GREEN_SHELL,
/* 0x05 */ ITEM_RED_SHELL,
/* 0x06 */ ITEM_TRIPLE_RED_SHELL,
/* 0x07 */ ITEM_BLUE_SPINY_SHELL,
/* 0x08 */ ITEM_THUNDERBOLT,
/* 0x09 */ ITEM_FAKE_ITEM_BOX,
/* 0x0A */ ITEM_STAR,
/* 0x0B */ ITEM_BOO,
/* 0x0C */ ITEM_MUSHROOM,
/* 0x0D */ ITEM_DOUBLE_MUSHROOM,
/* 0x0E */ ITEM_TRIPLE_MUSHROOM,
/* 0x0F */ ITEM_SUPER_MUSHROOM,
/* 0x0G */ ITEM_MAX,
};
enum KART_AI_BEHAVIOURS {
BEHAVIOUR_NONE = 0,
BEHAVIOUR_1,
BEHAVIOUR_HOP,
BEHAVIOUR_3,
BEHAVIOUR_4,
BEHAVIOUR_5,
BEHAVIOUR_NORMAL_SPEED,
BEHAVIOUR_FAST_SPEED,
BEHAVIOUR_SLOW_SPEED,
BEHAVIOUR_9,
BEHAVIOUR_10,
BEHAVIOUR_MAX_SPEED
};
enum DIRECTION {
NORTH,
EAST,
SOUTH,
WEST
};
/**
* @brief Balloon status
*/
#define BALLOON_STATUS_GONE 0
#define BALLOON_STATUS_PRESENT 1
#define BALLOON_STATUS_DEPARTING 2
/**
* @brief Max representable time, 100 minutes measured in centiseconds
*/
#define MAX_TIME 0x927C0
/**
* @brief sound effect of player's
* for soundEffect
*/
#define HIT_SOUND_EFFECT 0x100 // hitting an object
#define BOOST_SOUND_EFFECT 0x200 // being boosted by trigger a mushroom
#define BOO_SOUND_EFFECT 0x800 // being a boo
#define STAR_SOUND_EFFECT 0x2000 // being a star
#define HIT_ROTATING_SOUND_EFFECT 0x4000 // hitting a rotating object
#define BOOST_RAMP_WOOD_SOUND_EFFECT 0x8000 // being boosted by a ramp
#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
/**
* @brief effect of player's
* for effects
*/
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
#define STAR_EFFECT 0x200 // being a star
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
#define HIT_EFFECT 0x4000000 // hitting an object
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define BOO_EFFECT 0x80000000 // being a boo
/**
* @brief shell state
*
*/
#define SPAWN_FIRST_SHELL 0
#define SPAWN_SECOND_SHELL 1
#define SPAWN_THIRD_SHELL 2
#define GPACK_RGB888(r, g, b) (((r) << 16) | ((g) << 8) | (b))
#define COLOR_LIGHT GPACK_RGB888(0x1C, 0x00, 0x00)
#define COLOR_LAVA GPACK_RGB888(0x34, 0x00, 0x00)
#define COLOR_BLACK GPACK_RGB888(0, 0, 0)
#endif // DEFINES_H
/**
*
* Collision mesh flags
*
*/
#define GRID_SIZE 32
#define FACING_Y_AXIS 0x4000
#define FACING_X_AXIS 0x8000
#define FACING_Z_AXIS 0x2000