Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
RaceConfig.hh
1
#pragma once
2
3
#include "game/system/GhostFile.hh"
4
5
#include <functional>
6
7
namespace
Host
{
8
9
class
Context;
10
11
}
// namespace Host
12
13
namespace
System
{
14
21
class
RaceConfig
:
EGG::Disposer
{
22
friend
class
Host::Context
;
23
24
public
:
25
struct
Player
{
26
public
:
27
enum class
Type {
28
Local = 0,
// Inputs managed by ML algorithm
29
Ghost = 3,
// Inputs managed by ghost
30
None = 5,
31
};
32
33
Character character;
34
Vehicle vehicle;
35
Type type;
36
bool
driftIsAuto;
37
};
38
39
struct
Scenario
{
40
public
:
41
enum class
GameMode {
42
Time_Trial = 2,
43
Ghost_Race = 5,
44
};
45
46
void
init();
47
48
std::array<Player, 12> players;
49
u8 playerCount;
50
Course course;
51
};
52
53
typedef
std::function<void(
RaceConfig
*,
void
*)> InitCallback;
54
55
void
init();
56
void
initRace
();
57
void
initControllers
();
58
void
initGhost
();
59
60
[[nodiscard]]
const
Scenario
&raceScenario()
const
{
61
return
m_raceScenario;
62
}
63
64
[[nodiscard]] Scenario &raceScenario() {
65
return
m_raceScenario;
66
}
67
68
void
setGhost(
const
u8 *rkg) {
69
m_ghost = rkg;
70
}
71
72
static
void
RegisterInitCallback(
const
InitCallback &callback,
void
*arg) {
73
s_onInitCallback
= callback;
74
s_onInitCallbackArg
= arg;
75
}
76
77
static
RaceConfig *CreateInstance();
78
static
void
DestroyInstance();
79
80
[[nodiscard]]
static
RaceConfig *Instance() {
81
return
s_instance;
82
}
83
84
private
:
85
RaceConfig();
86
~RaceConfig()
override
;
87
88
Scenario m_raceScenario;
89
RawGhostFile m_ghost;
90
91
static
RaceConfig *s_instance;
92
static
InitCallback
s_onInitCallback
;
93
static
void
*
s_onInitCallbackArg
;
94
};
95
96
}
// namespace System
EGG::Disposer
An interface for ensuring certain structures and classes are destroyed with the heap.
Definition
Disposer.hh:11
Host::Context
Contexts can be used to restore a previous memory state for the current session.
Definition
Context.hh:59
System::RaceConfig
Initializes the player with parameters specified in the provided ghost file.
Definition
RaceConfig.hh:21
System::RaceConfig::initRace
void initRace()
Definition
RaceConfig.cc:17
System::RaceConfig::s_onInitCallbackArg
static void * s_onInitCallbackArg
The argument sent into the callback. This is expected to be reinterpret_casted.
Definition
RaceConfig.hh:93
System::RaceConfig::initGhost
void initGhost()
Initializes the ghost.
Definition
RaceConfig.cc:47
System::RaceConfig::s_onInitCallback
static InitCallback s_onInitCallback
Host-agnostic way of initializing RaceConfig. The type of the first player must be set to either Loca...
Definition
RaceConfig.hh:92
System::RaceConfig::initControllers
void initControllers()
Initializes the controllers.
Definition
RaceConfig.cc:30
Host
Represents the host application.
Definition
HeapCommon.hh:9
System
High-level handling for generic system operations, such as input reading, race configuration,...
Definition
CourseMap.cc:5
System::RaceConfig::Player
Definition
RaceConfig.hh:25
System::RaceConfig::Scenario
Definition
RaceConfig.hh:39
game
system
RaceConfig.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.12.0