1#include "RaceConfig.hh"
3#include "game/system/KPadDirector.hh"
5#include <abstract/File.hh>
10void RaceConfig::init() {
11 m_raceScenario.init();
18 m_raceScenario.playerCount = 1;
31 switch (m_raceScenario.players[0].type) {
32 case Player::Type::Ghost:
35 case Player::Type::Local:
36 KPadDirector::Instance()->setHostPad(m_raceScenario.players[0].driftIsAuto);
39 PANIC(
"Players must be either local or ghost!");
50 m_raceScenario.course = ghost.course();
51 Player &player = m_raceScenario.players[0];
52 player.character = ghost.character();
53 player.vehicle = ghost.vehicle();
54 player.driftIsAuto = ghost.driftIsAuto();
56 KPadDirector::Instance()->setGhostPad(ghost.inputs(), ghost.driftIsAuto());
67void RaceConfig::DestroyInstance() {
69 auto *instance = s_instance;
75RaceConfig::RaceConfig() =
default;
78RaceConfig::~RaceConfig() {
81 WARN(
"RaceConfig instance not explicitly handled!");
86void RaceConfig::Scenario::init() {
88 course = Course::GCN_Mario_Circuit;
90 for (
size_t i = 0; i < players.size(); ++i) {
91 Player &player = players[i];
92 player.character = Character::Mario;
93 player.vehicle = Vehicle::Standard_Kart_M;
94 player.type = Player::Type::None;
98RaceConfig *RaceConfig::s_instance =
nullptr;
Parsed representation of a binary ghost file.
Initializes the player with parameters specified in the provided ghost file.
static void * s_onInitCallbackArg
The argument sent into the callback. This is expected to be reinterpret_casted.
void initGhost()
Initializes the ghost.
static InitCallback s_onInitCallback
Host-agnostic way of initializing RaceConfig. The type of the first player must be set to either Loca...
void initControllers()
Initializes the controllers.
High-level handling for generic system operations, such as input reading, race configuration,...