SpaghettiKart
Loading...
Searching...
No Matches
Truck.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 "
engine/registry/RegisterContent.h
"
7
#include "
engine/SpawnParams.h
"
8
9
extern
"C"
{
10
#include "
sounds.h
"
11
}
12
13
class
ATruck
:
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
const
char
*
Type
;
21
size_t
Index
;
22
f32
Speed
;
23
s16
ActorIndex
;
24
Vec3f
Position
;
25
Vec3f
Velocity
;
26
Vec3s
Rotation
;
27
f32
SomeMultiplierTheSequel
;
28
s8
SomeFlagsTheSequel
= 0;
29
u16
WaypointIndex
;
30
s8
SomeFlags
= 0;
31
s16
SomeType
;
32
33
f32
SomeArg3
= 55.0f;
34
f32
SomeArg4
= 12.5f;
35
u32
SoundBits
=
SOUND_ARG_LOAD
(0x51, 0x01, 0x80, 0x03);
36
37
float
SpeedB
= 0.0f;
38
ATruck::SpawnMode
SpawnType
=
ATruck::SpawnMode::AUTO
;
39
uint32_t
PathIndex
= 0;
40
uint32_t
PathPoint
= 0;
41
42
// This is simply a helper function to keep Spawning code clean
43
static
ATruck
*
Spawn
(f32 speedA, f32 speedB, uint32_t pathIndex, uint32_t pathPoint,
ATruck::SpawnMode
spawnMode) {
44
SpawnParams
params = {
45
.Name =
"mk:truck"
,
46
.Type =
static_cast<
uint16_t
>
(spawnMode),
47
.
PathIndex
= pathIndex,
48
.
PathPoint
= pathPoint,
49
.
Speed
= speedA,
50
.
SpeedB
= speedB
51
};
52
return
dynamic_cast<
ATruck
*
>
(
AddActorToWorld<ATruck>
(params));
53
}
54
55
explicit
ATruck
(
const
SpawnParams
& params);
56
57
~ATruck
() {
58
_count
--;
59
}
60
61
static
size_t
GetCount
() {
62
return
_count
;
63
}
64
65
virtual
void
SetSpawnParams
(
SpawnParams
& params)
override
;
66
virtual
void
Tick
()
override
;
67
virtual
void
Draw
(
Camera
* 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>>
TruckCounts
;
75
};
Actor.h
RegisterContent.h
AddActorToWorld
static AActor * AddActorToWorld(const SpawnParams ¶ms)
Definition
RegisterContent.h:14
SpawnParams.h
AActor::AActor
AActor()
Definition
Actor.cpp:13
ATruck::SomeType
s16 SomeType
Definition
Truck.h:31
ATruck::PathIndex
uint32_t PathIndex
Definition
Truck.h:39
ATruck::Position
Vec3f Position
Definition
Truck.h:24
ATruck::SpeedB
float SpeedB
Definition
Truck.h:37
ATruck::Tick
virtual void Tick() override
Definition
Truck.cpp:118
ATruck::Index
size_t Index
Definition
Truck.h:21
ATruck::Rotation
Vec3s Rotation
Definition
Truck.h:26
ATruck::DrawEditorProperties
virtual void DrawEditorProperties() override
Definition
Truck.cpp:314
ATruck::ActorIndex
s16 ActorIndex
Definition
Truck.h:23
ATruck::SomeArg3
f32 SomeArg3
Definition
Truck.h:33
ATruck::GetCount
static size_t GetCount()
Definition
Truck.h:61
ATruck::~ATruck
~ATruck()
Definition
Truck.h:57
ATruck::SetSpawnParams
virtual void SetSpawnParams(SpawnParams ¶ms) override
Definition
Truck.cpp:86
ATruck::SomeFlagsTheSequel
s8 SomeFlagsTheSequel
Definition
Truck.h:28
ATruck::IsMod
virtual bool IsMod() override
Definition
Truck.cpp:95
ATruck::VehicleCollision
virtual void VehicleCollision(s32 playerId, Player *player) override
Definition
Truck.cpp:181
ATruck::SoundBits
u32 SoundBits
Definition
Truck.h:35
ATruck::Velocity
Vec3f Velocity
Definition
Truck.h:25
ATruck::ATruck
ATruck(const SpawnParams ¶ms)
Definition
Truck.cpp:24
ATruck::SpawnMode
SpawnMode
Definition
Truck.h:15
ATruck::POINT
@ POINT
Definition
Truck.h:16
ATruck::AUTO
@ AUTO
Definition
Truck.h:17
ATruck::WaypointIndex
u16 WaypointIndex
Definition
Truck.h:29
ATruck::_count
static size_t _count
Definition
Truck.h:73
ATruck::Draw
virtual void Draw(Camera *camera) override
Definition
Truck.cpp:99
ATruck::SpawnType
ATruck::SpawnMode SpawnType
Definition
Truck.h:38
ATruck::Type
const char * Type
Definition
Truck.h:20
ATruck::SomeMultiplierTheSequel
f32 SomeMultiplierTheSequel
Definition
Truck.h:27
ATruck::SomeArg4
f32 SomeArg4
Definition
Truck.h:34
ATruck::SomeFlags
s8 SomeFlags
Definition
Truck.h:30
ATruck::Speed
f32 Speed
Definition
Truck.h:22
ATruck::TruckCounts
static std::map< uint32_t, std::vector< uint32_t > > TruckCounts
Definition
Truck.h:74
ATruck::PathPoint
uint32_t PathPoint
Definition
Truck.h:40
ATruck::Spawn
static ATruck * Spawn(f32 speedA, f32 speedB, uint32_t pathIndex, uint32_t pathPoint, ATruck::SpawnMode spawnMode)
Definition
Truck.h:43
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
Truck.h
Generated by
1.13.2