8#include <egg/core/Heap.hh>
40 Moonview_Highway = 10,
47 GCN_Mario_Circuit = 17,
48 GCN_Waluigi_Stadium = 18,
52 DS_Peach_Gardens = 22,
53 DS_Delfino_Square = 23,
54 SNES_Mario_Circuit_3 = 24,
55 SNES_Ghost_Valley_2 = 25,
56 N64_Mario_Raceway = 26,
57 N64_Sherbet_Land = 27,
58 N64_Bowsers_Castle = 28,
59 N64_DKs_Jungle_Parkway = 29,
60 GBA_Bowser_Castle_3 = 30,
61 GBA_Shy_Guy_Beach = 31,
64 Chain_Chomp_Roulette = 34,
68 DS_Twilight_House = 38,
69 SNES_Battle_Course_4 = 39,
70 GBA_Battle_Course_3 = 40,
72 Galaxy_Colosseum = 54,
100 Standard_Bike_L = 20,
119enum class Character {
144 Small_Mii_Outfit_A_Male = 24,
145 Small_Mii_Outfit_A_Female = 25,
146 Small_Mii_Outfit_B_Male = 26,
147 Small_Mii_Outfit_B_Female = 27,
148 Small_Mii_Outfit_C_Male = 28,
149 Small_Mii_Outfit_C_Female = 29,
150 Medium_Mii_Outfit_A_Male = 30,
151 Medium_Mii_Outfit_A_Female = 31,
152 Medium_Mii_Outfit_B_Male = 32,
153 Medium_Mii_Outfit_B_Female = 33,
154 Medium_Mii_Outfit_C_Male = 34,
155 Medium_Mii_Outfit_C_Female = 35,
156 Large_Mii_Outfit_A_Male = 36,
157 Large_Mii_Outfit_A_Female = 37,
158 Large_Mii_Outfit_B_Male = 38,
159 Large_Mii_Outfit_B_Female = 39,
160 Large_Mii_Outfit_C_Male = 40,
161 Large_Mii_Outfit_C_Female = 41,
165 Peach_Biker_Outfit = 45,
166 Daisy_Biker_Outfit = 46,
167 Rosalina_Biker_Outfit = 47,
171enum class WeightClass {
178enum class GroupID :
u16 {
194static constexpr WeightClass CharacterToWeight(Character character) {
196 case Character::Baby_Peach:
197 case Character::Baby_Daisy... Character::Baby_Mario:
198 case Character::Toad:
199 case Character::Baby_Luigi... Character::Koopa_Troopa:
200 case Character::Small_Mii_Outfit_A_Male... Character::Small_Mii_Outfit_C_Female:
201 case Character::Small_Mii:
202 return WeightClass::Light;
203 case Character::Mario:
204 case Character::Luigi:
205 case Character::Yoshi:
206 case Character::Daisy... Character::Diddy_Kong:
207 case Character::Bowser_Jr:
208 case Character::Medium_Mii_Outfit_A_Male... Character::Medium_Mii_Outfit_C_Female:
209 case Character::Medium_Mii:
210 case Character::Peach_Biker_Outfit:
211 case Character::Daisy_Biker_Outfit:
212 return WeightClass::Medium;
213 case Character::Waluigi:
214 case Character::Bowser:
215 case Character::Donkey_Kong:
216 case Character::Wario:
217 case Character::King_Boo:
218 case Character::Dry_Bowser... Character::Rosalina:
219 case Character::Large_Mii_Outfit_A_Male... Character::Large_Mii_Outfit_C_Female:
220 case Character::Large_Mii:
221 case Character::Rosalina_Biker_Outfit:
222 return WeightClass::Heavy;
224 return WeightClass::Invalid;
228static constexpr WeightClass VehicleToWeight(Vehicle vehicle) {
230 case Vehicle::Standard_Kart_S:
231 case Vehicle::Baby_Booster:
232 case Vehicle::Mini_Beast:
233 case Vehicle::Cheep_Charger:
234 case Vehicle::Tiny_Titan:
235 case Vehicle::Blue_Falcon:
236 case Vehicle::Standard_Bike_S:
237 case Vehicle::Bullet_Bike:
238 case Vehicle::Bit_Bike:
239 case Vehicle::Quacker:
240 case Vehicle::Magikruiser:
241 case Vehicle::Jet_Bubble:
242 return WeightClass::Light;
243 case Vehicle::Standard_Kart_M:
244 case Vehicle::Classic_Dragster:
245 case Vehicle::Wild_Wing:
246 case Vehicle::Super_Blooper:
247 case Vehicle::Daytripper:
248 case Vehicle::Sprinter:
249 case Vehicle::Standard_Bike_M:
250 case Vehicle::Mach_Bike:
251 case Vehicle::Sugarscoot:
252 case Vehicle::Zip_Zip:
253 case Vehicle::Sneakster:
254 case Vehicle::Dolphin_Dasher:
255 return WeightClass::Medium;
256 case Vehicle::Standard_Kart_L:
257 case Vehicle::Offroader:
258 case Vehicle::Flame_Flyer:
259 case Vehicle::Piranha_Prowler:
260 case Vehicle::Jetsetter:
261 case Vehicle::Honeycoupe:
262 case Vehicle::Standard_Bike_L:
263 case Vehicle::Flame_Runner:
264 case Vehicle::Wario_Bike:
265 case Vehicle::Shooting_Star:
267 case Vehicle::Phantom:
268 return WeightClass::Heavy;
270 return WeightClass::Invalid;
274static constexpr const char *COURSE_NAMES[59] = {
285 "ridgehighway_course",
336static constexpr const char *VEHICLE_NAMES[36] = {
375STATIC_ASSERT(std::numeric_limits<f32>::epsilon() == 1.0f / 8388608.0f);
377 std::endian::native == std::endian::big || std::endian::native == std::endian::little);
382template <
template <
typename...>
class Base,
typename Derived>
385 template <
typename... Ts>
386 static std::true_type test(
const Base<Ts...> *);
388 static std::false_type test(...);
391 static constexpr bool value =
decltype(test(std::declval<Derived *>()))::value;
394template <
template <
typename...>
class Base,
typename Derived>
402 (std::is_floating_point_v<T> && (
sizeof(T) == 4 ||
sizeof(T) == 8));
405template <IntegralType T>
406static inline T form(
const u8 *data) {
408 for (
size_t i = 0; i <
sizeof(T); ++i) {
409 result = (result << 8) | data[i];
415template <ParseableType T>
416static inline constexpr T parse(T val, std::endian endian = std::endian::big) {
417 if constexpr (std::is_integral_v<T>) {
418 return endian == std::endian::native ? val : std::byteswap(val);
420 if constexpr (
sizeof(T) == 4) {
421 return std::bit_cast<T>(parse<u32>(std::bit_cast<u32>(val), endian));
423 return std::bit_cast<T>(parse<u64>(std::bit_cast<u64>(val), endian));
429static inline constexpr u32 f2u(f32 val) {
430 return std::bit_cast<u32>(val);
Pertains to item handling.
Pertains to kart-related functionality.
Helper template which uses function overloading and implict up-casting to determine whether or not a ...