mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-05-23 15:02:12 -04:00
a1f0d32d66
* 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) * fix course (#659) * fix typo debug (#660) * fix typo data (#661) * replace number with const (#665) * fix typo buffers (#655) * fix typo buffers * tweak ld file * rename to sMemoryPool * add a warning --------- * fix typo src (#654) * fix typo src * fix non matcing * Update code_80091750.c --------- * fix typo racing (#653) * fix typo racing * get it match * replace G_LINE3D to G_QUAD --------- * fix typo src (#652) * 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 --------- * 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 --------- * 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) * start documenting animation (#668) * start documenting animation * Update course_data.c * change comment * update libultra asm (#648) * update libultra asm * fix gcc __osThreadTail --------- * 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 --------- * 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 --------- * Update linkonly_generator.py (#670) * format more file * update * fix compilation issue * remove course_metadata folder * re add course metadata folder * fix banshee bordwalk crash * fix windows eurk * Update CMakeLists.txt ---------
138 lines
5.2 KiB
C
138 lines
5.2 KiB
C
#ifndef MK64_H
|
|
#define MK64_H
|
|
|
|
#include <libultraship.h>
|
|
#include <string.h>
|
|
#include <libultra/gbi.h>
|
|
|
|
/**
|
|
* @file mk64.h
|
|
* Global header for mk64
|
|
*/
|
|
|
|
/*=======================
|
|
Configuration
|
|
=======================*/
|
|
|
|
#define AUDIO_HEAP_SIZE 0x48C00
|
|
#define AUDIO_HEAP_INIT_SIZE 0x2600
|
|
|
|
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void*) / 4))
|
|
|
|
#define SCREEN_WIDTH 320
|
|
#define SCREEN_HEIGHT 240
|
|
|
|
#define STACKSIZE 0x2000
|
|
|
|
// Border Height Define for NTSC Versions
|
|
#define BORDER_HEIGHT 1
|
|
|
|
typedef enum {
|
|
/* 0x00 */ COURSE_MARIO_RACEWAY = 0,
|
|
/* 0x01 */ COURSE_CHOCO_MOUNTAIN,
|
|
/* 0x02 */ COURSE_BOWSER_CASTLE,
|
|
/* 0x03 */ COURSE_BANSHEE_BOARDWALK,
|
|
/* 0x04 */ COURSE_YOSHI_VALLEY,
|
|
/* 0x05 */ COURSE_FRAPPE_SNOWLAND,
|
|
/* 0x06 */ COURSE_KOOPA_BEACH,
|
|
/* 0x07 */ COURSE_ROYAL_RACEWAY,
|
|
/* 0x08 */ COURSE_LUIGI_RACEWAY,
|
|
/* 0x09 */ COURSE_MOO_MOO_FARM,
|
|
/* 0x0A */ COURSE_TOADS_TURNPIKE,
|
|
/* 0x0B */ COURSE_KALAMARI_DESERT,
|
|
/* 0x0C */ COURSE_SHERBET_LAND,
|
|
/* 0x0D */ COURSE_RAINBOW_ROAD,
|
|
/* 0x0E */ COURSE_WARIO_STADIUM,
|
|
/* 0x0F */ COURSE_BLOCK_FORT,
|
|
/* 0x10 */ COURSE_SKYSCRAPER,
|
|
/* 0x11 */ COURSE_DOUBLE_DECK,
|
|
/* 0x12 */ COURSE_DK_JUNGLE,
|
|
/* 0x13 */ COURSE_BIG_DONUT,
|
|
/* 0x14 */ COURSE_AWARD_CEREMONY,
|
|
/* 0x15 */ NUM_COURSES
|
|
} COURSES;
|
|
|
|
#define COURSE_NULL 0xFF
|
|
|
|
typedef enum {
|
|
/* 0x00 */ TIME_TRIAL_DATA_LUIGI_RACEWAY,
|
|
/* 0x01 */ TIME_TRIAL_DATA_MOO_MOO_FARM,
|
|
/* 0x02 */ TIME_TRIAL_DATA_KOOPA_BEACH,
|
|
/* 0x03 */ TIME_TRIAL_DATA_KALAMARI_DESERT,
|
|
/* 0x04 */ TIME_TRIAL_DATA_TOADS_TURNPIKE,
|
|
/* 0x05 */ TIME_TRIAL_DATA_FRAPPE_SNOWLAND,
|
|
/* 0x06 */ TIME_TRIAL_DATA_CHOCO_MOUNTAIN,
|
|
/* 0x07 */ TIME_TRIAL_DATA_MARIO_RACEWAY,
|
|
/* 0x08 */ TIME_TRIAL_DATA_WARIO_STADIUM,
|
|
/* 0x09 */ TIME_TRIAL_DATA_SHERBET_LAND,
|
|
/* 0x0A */ TIME_TRIAL_DATA_ROYAL_RACEWAY,
|
|
/* 0x0B */ TIME_TRIAL_DATA_BOWSER_CASTLE,
|
|
/* 0x0C */ TIME_TRIAL_DATA_DK_JUNGLE,
|
|
/* 0x0D */ TIME_TRIAL_DATA_YOSHI_VALLEY,
|
|
/* 0x0E */ TIME_TRIAL_DATA_BANSHEE_BOARDWALK,
|
|
/* 0x0F */ TIME_TRIAL_DATA_RAINBOW_ROAD,
|
|
/* 0x10 */ NUM_TIME_TRIAL_DATA
|
|
} TIME_TRIAL_DATA_INDEX;
|
|
|
|
/**
|
|
* @brief The different types of surface in the game.
|
|
*/
|
|
enum SURFACE_TYPE {
|
|
/* -0x1 */ SURFACE_DEFAULT = -1,
|
|
/* 0x00 */ AIRBORNE,
|
|
/* 0x01 */ ASPHALT, // Luigi's Raceway, Toad's Turnpike, Koopa Troop beach shortcut tunnel, Mario Raceway, Royal
|
|
// Raceway, Rainbow Road, Block Fort, Double Deck, Skyscraper
|
|
/* 0x02 */ DIRT, // Luigi's Raceway, Moo Moo Farm, Kalimiari Desert on course, Choco Mountain, Wario Stadium, DK
|
|
// Jungle on course, Yoshi Valley
|
|
/* 0x03 */ SAND, // Koopa Troopa Beach light color, Royal Raceway
|
|
/* 0x04 */ STONE, // Royal Raceway castle entrance, Bowser's Castle
|
|
/* 0x05 */ SNOW, // Frappe Snowland on course, Sherber Land tunnel
|
|
/* 0x06 */ BRIDGE, // Royal Raceway castle bridges (even the wooden one), Banshee's Boardwalk, Big Donut
|
|
/* 0x07 */ SAND_OFFROAD, // Mario Raceway
|
|
/* 0x08 */ GRASS, // Luigi's Raceway, Mario Raceway, Royal Raceway, Bowser's Castle, DK Jungle, Yoshi Valley
|
|
/* 0x09 */ ICE, // Sherbert Land
|
|
/* 0x0A */ WET_SAND, // Koop Troopa Beach dark color
|
|
/* 0x0B */ SNOW_OFFROAD, // Frappe Snowland off course
|
|
/* 0x0C */ CLIFF, // Koopa Troopa Beach, Choco Mountain
|
|
/* 0x0D */ DIRT_OFFROAD, // Kalimari Desert off course
|
|
/* 0x0E */ TRAIN_TRACK, // Kalimari Desert
|
|
/* 0x0F */ CAVE, // DK Jungle cave
|
|
/* 0x10 */ ROPE_BRIDGE, // Bowser's Castle bridge 2, DK Jungle bridge
|
|
/* 0x11 */ WOOD_BRIDGE, // Frappe Snowland bridge, Bowser's Castle bridge 1,3, Yoshi Valley bridge 2
|
|
/* 0xFC */ BOOST_RAMP_WOOD = 0xFC, // DK Jungle
|
|
/* 0xFD */ OUT_OF_BOUNDS, // DK Jungle river island
|
|
/* 0xFE */ BOOST_RAMP_ASPHALT, // Royal Raceway
|
|
/* 0xFF */ RAMP // Koopa Troopa beach
|
|
};
|
|
|
|
#define GFX_GET_OPCODE(var) ((uint32_t) ((var) & 0xFF000000))
|
|
|
|
// Pointer casting is technically UB, and avoiding it gets rid of endian issues
|
|
// as well as a nice side effect.
|
|
#ifdef AVOID_UB
|
|
#define GET_HIGH_U16_OF_32(var) ((u16) ((var) >> 16))
|
|
#define GET_HIGH_S16_OF_32(var) ((s16) ((var) >> 16))
|
|
#define GET_LOW_U16_OF_32(var) ((u16) ((var) & 0xFFFF))
|
|
#define GET_LOW_S16_OF_32(var) ((s16) ((var) & 0xFFFF))
|
|
#define SET_HIGH_U16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
|
|
#define SET_HIGH_S16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
|
|
#else
|
|
#define GET_HIGH_U16_OF_32(var) (((u16*) &(var))[0])
|
|
#define GET_HIGH_S16_OF_32(var) (((s16*) &(var))[0])
|
|
#define GET_LOW_U16_OF_32(var) (((u16*) &(var))[1])
|
|
#define GET_LOW_S16_OF_32(var) (((s16*) &(var))[1])
|
|
#define SET_HIGH_U16_OF_32(var, x) ((((u16*) &(var))[0]) = (x))
|
|
#define SET_HIGH_S16_OF_32(var, x) ((((s16*) &(var))[0]) = (x))
|
|
#endif
|
|
|
|
#define MACRO_COLOR_FLAG(r, g, b, flag) (r & ~0x3) | (flag & 0x3), (g & ~0x3) | ((flag >> 2) & 0x3), b
|
|
|
|
// Extra gbi commands
|
|
void gSPSegmentLoadRes(void* value, int segNum, uintptr_t target);
|
|
void gSPDisplayList(Gfx* pkt, Gfx* dl);
|
|
void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset);
|
|
void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0);
|
|
void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr);
|
|
|
|
#endif // MK64_H
|