1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
#pragma once
#include <libultraship.h>
#include "GameObject.h"
#include "Cup.h"
#include "vehicles/Vehicle.h"
#include "vehicles/Train.h"
#include "vehicles/Car.h"
#include "vehicles/OBombKart.h"
#include "vehicles/Train.h"
#include "TrainCrossing.h"
#include "vehicles/OThwomp.h"
#include "vehicles/OPenguin.h"
#include <memory>
#include "Actor.h"
extern "C" {
#include "camera.h"
#include "objects.h"
#include "engine/Engine.h"
};
class Cup; // <-- Forward declaration
class Course;
class AVehicle;
class ATrain;
class ACar;
class TrainCrossing;
class OThwomp;
class World {
typedef struct {
uint8_t r, g, b;
} RGB8;
typedef struct {
RGB8 TopRight;
RGB8 BottomRight;
RGB8 BottomLeft;
RGB8 TopLeft;
RGB8 FloorTopRight;
RGB8 FloorBottomRight;
RGB8 FloorBottomLeft;
RGB8 FloorTopLeft;
} SkyboxColours;
typedef struct {
const char* Name;
const char* DebugName;
const char* CourseLength;
const char* AIBehaviour;
float AIMaximumSeparation;
float AIMinimumSeparation;
int16_t *SomePtr;
uint32_t AISteeringSensitivity;
_struct_gCoursePathSizes_0x10 PathSizes;
Vec4f D_0D009418;
Vec4f D_0D009568;
Vec4f D_0D0096B8;
Vec4f D_0D009808;
const char* PathTable[4];
const char* PathTable2[4];
CloudData *Clouds;
CloudData *CloudList;
int32_t MinimapFinishlineX;
int32_t MinimapFinishlineY;
SkyboxColours Skybox;
MusicSeq Sequence;
} Properties;
typedef struct {
std::vector<Mtx> Hud;
std::vector<Mtx> Objects;
std::vector<Mtx> Shadows;
std::vector<Mtx> Karts;
std::vector<Mtx> Effects;
} Matrix;
public:
explicit World();
void AddCourse(Course* course);
AActor* AddActor(AActor* actor);
struct Actor* AddBaseActor();
AActor* GetActor(size_t index);
void TickActors();
void RemoveExpiredActors();
AActor* ConvertActorToAActor(Actor* actor);
Actor* ConvertAActorToActor(AActor* actor);
Object* AddObject(std::unique_ptr<GameObject> object);
CProperties* GetCourseProps();
void TickObjects();
void DrawObjects(Camera *camera);
void ExpiredObjects();
void DestroyObjects();
Object *GetObjectByIndex(size_t);
void AddCup(Cup*);
void SetCup(Cup* cup);
const char* GetCupName();
u32 GetCupIndex();
u32 NextCup();
u32 PreviousCup();
void SetCourseFromCup();
World* GetWorld(void);
// These are only for browsing through the course list
void SetCourse(const char*);
void NextCourse(void);
void PreviousCourse(void);
Matrix Mtx;
// Holds all available courses
Course* CurrentCourse;
Cup* CurrentCup;
std::vector<Cup*> Cups;
size_t CupIndex = 1;
std::vector<AActor*> Actors;
std::vector<std::unique_ptr<GameObject>> GameObjects;
/** Actors */
void AddBoat(f32 speed, uint32_t waypoint);
void AddTrain(ATrain::TenderStatus tender, size_t numCarriages, f32 speed, uint32_t waypoint);
void AddTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
void AddBus(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
void AddTankerTruck(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
void AddCar(f32 speedA, f32 speedB, TrackWaypoint* path, uint32_t waypoint);
std::vector<std::unique_ptr<AVehicle>> Vehicles;
void ClearVehicles(void);
/** Objects **/
std::vector<std::unique_ptr<OBombKart>> BombKarts;
void AddBombKart(Vec3f pos, TrackWaypoint* waypoint, uint16_t waypointIndex, uint16_t state, f32 unk_3C);
std::vector<std::unique_ptr<OThwomp>> Thwomps;
void AddThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize = 7);
std::vector<std::shared_ptr<OPenguin>> Penguins;
std::shared_ptr<OPenguin> AddPenguin(Vec3f pos, u16 direction, OPenguin::PenguinType type, OPenguin::Behaviour behaviour);
TrainCrossing* AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius, f32 exitRadius);
std::vector<std::shared_ptr<TrainCrossing>> Crossings;
std::vector<Course*> Courses;
size_t CourseIndex = 0; // For browsing courses.
private:
};
extern World gWorldInstance;
|