Mario Kart 64
Loading...
Searching...
No Matches
Car.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <libultraship.h>
4
#include "
Actor.h
"
5
#include <vector>
6
#include "
RegisterContent.h
"
7
#include "
engine/SpawnParams.h
"
8
9
extern
"C"
{
10
#include "
sounds.h
"
11
}
12
13
class
ACar
:
public
AActor
{
14
public
:
15
enum
SpawnMode
: uint16_t {
16
POINT
,
// Spawn car at a specific path point
17
AUTO
,
// Automatically distribute cars based on a specific path point
18
};
19
20
explicit
ACar
(
const
SpawnParams
& params);
21
22
~ACar
() {
23
_count
--;
24
}
25
26
static
size_t
GetCount
() {
27
return
_count
;
28
}
29
30
// This is simply a helper function to keep Spawning code clean
31
static
ACar
*
Spawn
(f32 speedA, f32 speedB, uint32_t pathIndex, uint32_t pathPoint,
ACar::SpawnMode
spawnMode) {
32
SpawnParams
params = {
33
.Name =
"mk:car"
,
34
.Type =
static_cast<
uint16_t
>
(spawnMode),
35
.
PathIndex
= pathIndex,
36
.
PathPoint
= pathPoint,
37
.
Speed
= speedA,
38
.
SpeedB
= speedB
39
};
40
return
dynamic_cast<
ACar
*
>
(
AddActorToWorld<ACar>
(params));
41
}
42
43
const
char
*
Type
;
44
size_t
Index
;
45
f32
Speed
;
46
s16
ActorIndex
;
47
Vec3f
Position
;
48
Vec3f
Velocity
;
49
Vec3s
Rotation
;
50
f32
SomeMultiplierTheSequel
;
51
s8
SomeFlagsTheSequel
= 0;
52
u16
WaypointIndex
;
53
s8
SomeFlags
= 0;
54
s16
SomeType
;
55
56
f32
SomeArg3
= 11.5f;
57
f32
SomeArg4
= 8.5f;
58
u32
SoundBits
=
SOUND_ARG_LOAD
(0x51, 0x01, 0x80, 0x05);
59
60
ACar::SpawnMode
SpawnType
=
ACar::SpawnMode::AUTO
;
61
float
SpeedB
= 0.0f;
62
uint32_t
PathIndex
= 0;
63
uint32_t
PathPoint
= 0;
64
65
virtual
void
SetSpawnParams
(
SpawnParams
& params)
override
;
66
virtual
void
Tick
()
override
;
67
virtual
void
Draw
(
Camera
*)
override
;
68
virtual
void
VehicleCollision
(s32 playerId,
Player
* player)
override
;
69
virtual
bool
IsMod
()
override
;
70
virtual
void
DrawEditorProperties
()
override
;
71
72
private
:
73
static
size_t
_count
;
74
static
std::map<uint32_t, std::vector<uint32_t>>
CarCounts
;
75
};
Actor.h
RegisterContent.h
AddActorToWorld
static AActor * AddActorToWorld(const SpawnParams ¶ms)
Definition
RegisterContent.h:13
SpawnParams.h
AActor::AActor
AActor()
Definition
Actor.cpp:13
ACar::~ACar
~ACar()
Definition
Car.h:22
ACar::SomeArg4
f32 SomeArg4
Definition
Car.h:57
ACar::SomeMultiplierTheSequel
f32 SomeMultiplierTheSequel
Definition
Car.h:50
ACar::CarCounts
static std::map< uint32_t, std::vector< uint32_t > > CarCounts
Definition
Car.h:74
ACar::SpawnType
ACar::SpawnMode SpawnType
Definition
Car.h:60
ACar::SetSpawnParams
virtual void SetSpawnParams(SpawnParams ¶ms) override
Definition
Car.cpp:87
ACar::Type
const char * Type
Definition
Car.h:43
ACar::SpeedB
float SpeedB
Definition
Car.h:61
ACar::Rotation
Vec3s Rotation
Definition
Car.h:49
ACar::SomeType
s16 SomeType
Definition
Car.h:54
ACar::Spawn
static ACar * Spawn(f32 speedA, f32 speedB, uint32_t pathIndex, uint32_t pathPoint, ACar::SpawnMode spawnMode)
Definition
Car.h:31
ACar::Speed
f32 Speed
Definition
Car.h:45
ACar::ACar
ACar(const SpawnParams ¶ms)
Definition
Car.cpp:25
ACar::VehicleCollision
virtual void VehicleCollision(s32 playerId, Player *player) override
Definition
Car.cpp:182
ACar::SoundBits
u32 SoundBits
Definition
Car.h:58
ACar::SomeFlags
s8 SomeFlags
Definition
Car.h:53
ACar::SpawnMode
SpawnMode
Definition
Car.h:15
ACar::AUTO
@ AUTO
Definition
Car.h:17
ACar::POINT
@ POINT
Definition
Car.h:16
ACar::WaypointIndex
u16 WaypointIndex
Definition
Car.h:52
ACar::PathPoint
uint32_t PathPoint
Definition
Car.h:63
ACar::_count
static size_t _count
Definition
Car.h:73
ACar::Tick
virtual void Tick() override
Definition
Car.cpp:100
ACar::ActorIndex
s16 ActorIndex
Definition
Car.h:46
ACar::Velocity
Vec3f Velocity
Definition
Car.h:48
ACar::Position
Vec3f Position
Definition
Car.h:47
ACar::DrawEditorProperties
virtual void DrawEditorProperties() override
Definition
Car.cpp:315
ACar::SomeArg3
f32 SomeArg3
Definition
Car.h:56
ACar::Draw
virtual void Draw(Camera *) override
Definition
Car.cpp:163
ACar::SomeFlagsTheSequel
s8 SomeFlagsTheSequel
Definition
Car.h:51
ACar::IsMod
virtual bool IsMod() override
Definition
Car.cpp:96
ACar::GetCount
static size_t GetCount()
Definition
Car.h:26
ACar::Index
size_t Index
Definition
Car.h:44
ACar::PathIndex
uint32_t PathIndex
Definition
Car.h:62
Vec3f
f32 Vec3f[3]
Definition
common_structs.h:10
Vec3s
s16 Vec3s[3]
Definition
common_structs.h:15
sounds.h
SOUND_ARG_LOAD
#define SOUND_ARG_LOAD(sound_bank, byte2, byte3, sound_id)
Definition
sounds.h:14
Camera
Definition
camera.h:35
Player
Definition
common_structs.h:264
SpawnParams
Definition
SpawnParams.h:30
src
engine
vehicles
Car.h
Generated by
1.13.2