summaryrefslogtreecommitdiff
path: root/src/engine/objects
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-12-13 11:50:28 -0700
committerGitHub <noreply@github.com>2025-12-13 11:50:28 -0700
commitb934e98fc34964970ab5efacb2fb7c3372ae0b1a (patch)
treecd96e5fabec7fdcc098d0de33b3b7e2754fb6cd5 /src/engine/objects
parente6acb59ef4797ce27ddc9e21982c3f4e40824b52 (diff)
Refactor Track Class To Instantiate On Track Load (#587)
* Initial Commit * First compilation of Registry template * Further changes * wip changes * Impl TrackBrowser and Registry Info * Remove const from TInfo * Prep GetWorld * Name refactor * Refactor gWorldInstance to GetWorld() * wip * Should work now * Data menu work again * Fix editor staying open after program close * Rename LoadLevel to LoadTrackDataFromJson * More changes * Add statue * Add search to content browser using tags * Fix statue pos and register tags * Fix actor loading * Fix delete all bug which deleted cameras * reduce some boiler plate in actor and object * Remove unused rulesets * Search bar for all tabs * fix data screen * fix actor spawning * temp editor fix * Clean up * improve extra mode transformation * fix podium crash * Fix editor clicking * Fix editor clicking 2 * fix extra in custom track * Fix FI for three actors * Fix divide by zero error * Ids managed by Registry * Add scary comment --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: coco875 <pereira.jannin@gmail.com>
Diffstat (limited to 'src/engine/objects')
-rw-r--r--src/engine/objects/Bat.h3
-rw-r--r--src/engine/objects/BombKart.h16
-rw-r--r--src/engine/objects/Boos.h3
-rw-r--r--src/engine/objects/ChainChomp.cpp10
-rw-r--r--src/engine/objects/ChainChomp.h1
-rw-r--r--src/engine/objects/CheepCheep.h3
-rw-r--r--src/engine/objects/Crab.h3
-rw-r--r--src/engine/objects/Flagpole.h5
-rw-r--r--src/engine/objects/GrandPrixBalloons.h13
-rw-r--r--src/engine/objects/Hedgehog.h3
-rw-r--r--src/engine/objects/HotAirBalloon.h17
-rw-r--r--src/engine/objects/MoleGroup.cpp2
-rw-r--r--src/engine/objects/Penguin.h17
-rw-r--r--src/engine/objects/Podium.h19
-rw-r--r--src/engine/objects/Seagull.h16
-rw-r--r--src/engine/objects/Snowman.h13
-rw-r--r--src/engine/objects/Thwomp.h15
-rw-r--r--src/engine/objects/TrashBin.h17
-rw-r--r--src/engine/objects/Trophy.cpp7
-rw-r--r--src/engine/objects/Trophy.h13
20 files changed, 63 insertions, 133 deletions
diff --git a/src/engine/objects/Bat.h b/src/engine/objects/Bat.h
index 75318e5d8..d38f3e8a2 100644
--- a/src/engine/objects/Bat.h
+++ b/src/engine/objects/Bat.h
@@ -4,6 +4,7 @@
#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
#include "CoreMath.h"
@@ -36,7 +37,7 @@ public:
.Location = pos,
.Rotation = rot,
};
- return static_cast<OBat*>(gWorldInstance.AddObject(new OBat(params)));
+ return dynamic_cast<OBat*>(AddObjectToWorld<OBat>(params));
}
explicit OBat(const SpawnParams& params);
diff --git a/src/engine/objects/BombKart.h b/src/engine/objects/BombKart.h
index 20c8392a0..5d59eeb1a 100644
--- a/src/engine/objects/BombKart.h
+++ b/src/engine/objects/BombKart.h
@@ -1,19 +1,13 @@
#pragma once
#include <libultraship.h>
+#include "RegisterContent.h"
#include "engine/objects/Object.h"
-#include <vector>
-#include "engine/Matrix.h"
#include "World.h"
extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
#include "common_structs.h"
-#include "objects.h"
}
/**
@@ -52,7 +46,7 @@ class OBombKart : public OObject {
// This is simply a helper function to keep Spawning code clean
// Spawn object at a position
- static inline OBombKart* Spawn(FVector pos, uint16_t behaviour, f32 unk_3C) {
+ static OBombKart* Spawn(FVector pos, uint16_t behaviour, f32 unk_3C) {
SpawnParams params = {
.Name = "mk:bomb_kart",
.Behaviour = behaviour,
@@ -60,11 +54,11 @@ class OBombKart : public OObject {
.Speed = unk_3C, // Only used for podium ceremony. Arbitrarily chose Speed for this
.SpeedB = 2.7f, // Chase speed
};
- return static_cast<OBombKart*>(gWorldInstance.AddObject(new OBombKart(params)));
+ return dynamic_cast<OBombKart*>(AddObjectToWorld<OBombKart>(params));
}
// Spawn object at a point along the tracks path
- static inline OBombKart* Spawn(uint32_t pathIndex, uint32_t pathPoint, uint16_t behaviour, f32 unk_3C) {
+ static OBombKart* Spawn(uint32_t pathIndex, uint32_t pathPoint, uint16_t behaviour, f32 unk_3C) {
SpawnParams params = {
.Name = "mk:bomb_kart",
.Behaviour = behaviour,
@@ -72,7 +66,7 @@ class OBombKart : public OObject {
.PathPoint = pathPoint,
.Speed = unk_3C, // Only used for podium ceremony. Arbitrarily chose Speed for this
};
- return static_cast<OBombKart*>(gWorldInstance.AddObject(new OBombKart(params)));
+ return dynamic_cast<OBombKart*>(AddObjectToWorld<OBombKart>(params));
}
// Set waypoint to NULL if using a spawn position and not a waypoint.
diff --git a/src/engine/objects/Boos.h b/src/engine/objects/Boos.h
index 693405dcb..175fd45fc 100644
--- a/src/engine/objects/Boos.h
+++ b/src/engine/objects/Boos.h
@@ -4,6 +4,7 @@
#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
#include "CoreMath.h"
@@ -45,7 +46,7 @@ public:
.TriggerSpan = triggerBoundary,
.RightExitSpan = rightBoundary,
};
- return static_cast<OBoos*>(gWorldInstance.AddObject(new OBoos(params)));
+ return static_cast<OBoos*>(AddObjectToWorld<OBoos>(params));
}
explicit OBoos(const SpawnParams& params);
diff --git a/src/engine/objects/ChainChomp.cpp b/src/engine/objects/ChainChomp.cpp
index fafed0846..db12b3ba2 100644
--- a/src/engine/objects/ChainChomp.cpp
+++ b/src/engine/objects/ChainChomp.cpp
@@ -29,6 +29,16 @@ OChainChomp::OChainChomp() {
_count++;
}
+OChainChomp::OChainChomp(const SpawnParams& params) {
+ Name = "Chain Chomp";
+ ResourceName = "mk:chain_chomp";
+ _idx = _count;
+ init_object(indexObjectList2[_idx], 0);
+ _objectIndex = indexObjectList2[_idx];
+
+ _count++;
+}
+
void OChainChomp::Tick() {
s32 objectIndex;
Object* object;
diff --git a/src/engine/objects/ChainChomp.h b/src/engine/objects/ChainChomp.h
index e1eb35347..0d76a079c 100644
--- a/src/engine/objects/ChainChomp.h
+++ b/src/engine/objects/ChainChomp.h
@@ -23,6 +23,7 @@ extern "C" {
class OChainChomp : public OObject {
public:
explicit OChainChomp();
+ explicit OChainChomp(const SpawnParams& params);
~OChainChomp() {
diff --git a/src/engine/objects/CheepCheep.h b/src/engine/objects/CheepCheep.h
index 4cbe8bd60..45b0ff435 100644
--- a/src/engine/objects/CheepCheep.h
+++ b/src/engine/objects/CheepCheep.h
@@ -3,6 +3,7 @@
#include <libultraship.h>
#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "engine/CoreMath.h"
#include "World.h"
@@ -32,7 +33,7 @@ public:
.Location = pos,
.PathSpan = span,
};
- return static_cast<OCheepCheep*>(gWorldInstance.AddObject(new OCheepCheep(params)));
+ return static_cast<OCheepCheep*>(AddObjectToWorld<OCheepCheep>(params));
}
explicit OCheepCheep(const SpawnParams& params);
diff --git a/src/engine/objects/Crab.h b/src/engine/objects/Crab.h
index c89bb1df2..0c285e92c 100644
--- a/src/engine/objects/Crab.h
+++ b/src/engine/objects/Crab.h
@@ -2,6 +2,7 @@
#include <libultraship.h>
#include <vector>
+#include "RegisterContent.h"
#include "engine/objects/Object.h"
#include "CoreMath.h"
#include "World.h"
@@ -37,7 +38,7 @@ public:
.PatrolStart = start,
.PatrolEnd = end,
};
- return static_cast<OCrab*>(gWorldInstance.AddObject(new OCrab(params)));
+ return static_cast<OCrab*>(AddObjectToWorld<OCrab>(params));
}
explicit OCrab(const SpawnParams& params);
diff --git a/src/engine/objects/Flagpole.h b/src/engine/objects/Flagpole.h
index db5621a2d..218c2a6bf 100644
--- a/src/engine/objects/Flagpole.h
+++ b/src/engine/objects/Flagpole.h
@@ -4,6 +4,7 @@
#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
extern "C" {
@@ -24,7 +25,7 @@ public:
explicit OFlagpole(const SpawnParams& params);
// This is simply a helper function to keep Spawning code clean
- static inline OFlagpole* Spawn(FVector pos, s16 direction) {
+ static OFlagpole* Spawn(FVector pos, s16 direction) {
IRotator rot;
rot.Set(0, direction, 0);
SpawnParams params = {
@@ -32,7 +33,7 @@ public:
.Location = pos,
.Rotation = rot,
};
- return static_cast<OFlagpole*>(gWorldInstance.AddObject(new OFlagpole(params)));
+ return dynamic_cast<OFlagpole*>(AddObjectToWorld<OFlagpole>(params));
}
~OFlagpole() {
diff --git a/src/engine/objects/GrandPrixBalloons.h b/src/engine/objects/GrandPrixBalloons.h
index 04bac0915..91bbb24b9 100644
--- a/src/engine/objects/GrandPrixBalloons.h
+++ b/src/engine/objects/GrandPrixBalloons.h
@@ -1,20 +1,13 @@
#pragma once
#include <libultraship.h>
-#include <vector>
+#include "RegisterContent.h"
#include "engine/World.h"
#include "engine/objects/Object.h"
extern "C" {
#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
-#include "common_structs.h"
-#include "objects.h"
-#include "camera.h"
-#include "some_data.h"
}
@@ -28,12 +21,12 @@ public:
explicit OGrandPrixBalloons(const SpawnParams& params);
// This is simply a helper function to keep Spawning code clean
- static inline OGrandPrixBalloons* Spawn(const FVector& pos) {
+ static OGrandPrixBalloons* Spawn(const FVector& pos) {
SpawnParams params = {
.Name = "mk:grand_prix_balloons",
.Location = pos,
};
- return static_cast<OGrandPrixBalloons*>(gWorldInstance.AddObject(new OGrandPrixBalloons(params)));
+ return dynamic_cast<OGrandPrixBalloons*>(AddObjectToWorld<OGrandPrixBalloons>(params));
}
~OGrandPrixBalloons() {
diff --git a/src/engine/objects/Hedgehog.h b/src/engine/objects/Hedgehog.h
index 7a90f9a91..560639f26 100644
--- a/src/engine/objects/Hedgehog.h
+++ b/src/engine/objects/Hedgehog.h
@@ -4,6 +4,7 @@
#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "engine/World.h"
extern "C" {
@@ -34,7 +35,7 @@ public:
.Location = pos,
.PatrolEnd = patrolPoint,
};
- return static_cast<OHedgehog*>(gWorldInstance.AddObject(new OHedgehog(params)));
+ return static_cast<OHedgehog*>(AddObjectToWorld<OHedgehog>(params));
}
~OHedgehog() {
diff --git a/src/engine/objects/HotAirBalloon.h b/src/engine/objects/HotAirBalloon.h
index 7199a7cf4..49b5c7e82 100644
--- a/src/engine/objects/HotAirBalloon.h
+++ b/src/engine/objects/HotAirBalloon.h
@@ -1,33 +1,22 @@
#pragma once
#include <libultraship.h>
-#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
-extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
-#include "common_structs.h"
-#include "objects.h"
-#include "camera.h"
-#include "some_data.h"
-}
-
class OHotAirBalloon : public OObject {
public:
explicit OHotAirBalloon(const SpawnParams& params);
// This is simply a helper function to keep Spawning code clean
- static inline OHotAirBalloon* Spawn(FVector pos) {
+ static OHotAirBalloon* Spawn(FVector pos) {
SpawnParams params = {
.Name = "mk:hot_air_balloon",
.Location = pos,
};
- return static_cast<OHotAirBalloon*>(gWorldInstance.AddObject(new OHotAirBalloon(params)));
+ return dynamic_cast<OHotAirBalloon*>(AddObjectToWorld<OHotAirBalloon>(params));
}
virtual void Tick() override;
diff --git a/src/engine/objects/MoleGroup.cpp b/src/engine/objects/MoleGroup.cpp
index d1b8cb27d..a01e55877 100644
--- a/src/engine/objects/MoleGroup.cpp
+++ b/src/engine/objects/MoleGroup.cpp
@@ -15,7 +15,7 @@ OMoleGroup::OMoleGroup(std::vector<FVector>& spawns, size_t tickRate) {
_tickRate = tickRate;
for (auto& pos : spawns) {
pos.x * xOrientation;
- OMole* ptr = reinterpret_cast<OMole*>(gWorldInstance.AddObject(new OMole(pos, this)));
+ OMole* ptr = reinterpret_cast<OMole*>(GetWorld()->AddObject(std::make_unique<OMole>(pos, this)));
_moles.push_back({ptr, pos, false});
}
diff --git a/src/engine/objects/Penguin.h b/src/engine/objects/Penguin.h
index 4c9c04dd6..f4f79d461 100644
--- a/src/engine/objects/Penguin.h
+++ b/src/engine/objects/Penguin.h
@@ -1,20 +1,10 @@
#pragma once
#include <libultraship.h>
-#include <vector>
+#include "RegisterContent.h"
#include "engine/World.h"
#include "engine/objects/Object.h"
-extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
-#include "common_structs.h"
-#include "objects.h"
-#include "course_offsets.h"
-}
-
class OPenguin : public OObject {
public:
enum PenguinType : int16_t {
@@ -34,11 +24,10 @@ public:
SLIDE6,
};
-public:
explicit OPenguin(const SpawnParams& params);
// This is simply a helper function to keep Spawning code clean
- static inline OPenguin* Spawn(FVector pos, u16 direction, u16 mirrorModeAngleOffset, f32 diameter, PenguinType type, Behaviour behaviour) {
+ static OPenguin* Spawn(FVector pos, u16 direction, u16 mirrorModeAngleOffset, f32 diameter, PenguinType type, Behaviour behaviour) {
IRotator rot;
rot.Set(0, direction, mirrorModeAngleOffset);
SpawnParams params = {
@@ -49,7 +38,7 @@ public:
.Rotation = rot,
.Speed = diameter, // Diameter of the walking circle
};
- return static_cast<OPenguin*>(gWorldInstance.AddObject(new OPenguin(params)));
+ return dynamic_cast<OPenguin*>(AddObjectToWorld<OPenguin>(params));
}
PenguinType Type = PenguinType::CHICK;
diff --git a/src/engine/objects/Podium.h b/src/engine/objects/Podium.h
index f4f02fc8c..2f00bb50d 100644
--- a/src/engine/objects/Podium.h
+++ b/src/engine/objects/Podium.h
@@ -1,38 +1,25 @@
#pragma once
#include <libultraship.h>
-#include <vector>
+#include "RegisterContent.h"
#include "World.h"
-extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
-#include "common_structs.h"
-#include "objects.h"
-#include "course_offsets.h"
-#include "some_data.h"
-}
-
class OPodium : public OObject {
public:
enum Behaviour : uint16_t {
};
-public:
-
explicit OPodium(const SpawnParams& params);
// This is simply a helper function to keep Spawning code clean
- static inline OPodium* Spawn(const FVector& pos) {
+ static OPodium* Spawn(const FVector& pos) {
SpawnParams params = {
.Name = "mk:podium",
.Location = pos,
};
- return static_cast<OPodium*>(gWorldInstance.AddObject(new OPodium(params)));
+ return dynamic_cast<OPodium*>(AddObjectToWorld<OPodium>(params));
}
virtual void Tick() override;
diff --git a/src/engine/objects/Seagull.h b/src/engine/objects/Seagull.h
index 73d06a900..b944c1348 100644
--- a/src/engine/objects/Seagull.h
+++ b/src/engine/objects/Seagull.h
@@ -1,21 +1,11 @@
#pragma once
#include <libultraship.h>
-#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "engine/World.h"
-extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
-#include "common_structs.h"
-#include "objects.h"
-#include "camera.h"
-}
-
//! @todo unk_0D5 needs to be a struct variable probably. What does it do? Behaviour?
class OSeagull : public OObject {
public:
@@ -30,12 +20,12 @@ public:
}
// This is simply a helper function to keep Spawning code clean
- static inline OSeagull* Spawn(const FVector& pos) {
+ static OSeagull* Spawn(const FVector& pos) {
SpawnParams params = {
.Name = "mk:seagull",
.Location = pos,
};
- return static_cast<OSeagull*>(gWorldInstance.AddObject(new OSeagull(params)));
+ return dynamic_cast<OSeagull*>(AddObjectToWorld<OSeagull>(params));
}
virtual void Tick() override;
diff --git a/src/engine/objects/Snowman.h b/src/engine/objects/Snowman.h
index 42217f040..cc08c443a 100644
--- a/src/engine/objects/Snowman.h
+++ b/src/engine/objects/Snowman.h
@@ -1,31 +1,24 @@
#pragma once
#include <libultraship.h>
-#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
#include "common_structs.h"
-#include "objects.h"
-#include "camera.h"
-#include "some_data.h"
}
class OSnowman : public OObject {
public:
// This is simply a helper function to keep Spawning code clean
- static inline OSnowman* Spawn(FVector pos) {
+ static OSnowman* Spawn(FVector pos) {
SpawnParams params = {
.Name = "mk:snowman",
.Location = FVector(pos.x, pos.y, pos.z),
};
- return static_cast<OSnowman*>(gWorldInstance.AddObject(new OSnowman(params)));
+ return dynamic_cast<OSnowman*>(AddObjectToWorld<OSnowman>(params));
}
explicit OSnowman(const SpawnParams& params);
diff --git a/src/engine/objects/Thwomp.h b/src/engine/objects/Thwomp.h
index a76872093..e46e682c5 100644
--- a/src/engine/objects/Thwomp.h
+++ b/src/engine/objects/Thwomp.h
@@ -1,25 +1,16 @@
#pragma once
#include <libultraship.h>
-#include <vector>
+#include "RegisterContent.h"
#include "engine/World.h"
#include "engine/SpawnParams.h"
#include "engine/CoreMath.h"
#include "engine/objects/Object.h"
-class World;
-extern World gWorldInstance;
-
extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
#include "common_structs.h"
-#include "objects.h"
#include "camera.h"
-#include "some_data.h"
}
//! @todo Make shadow size bigger if thwomp is scaled up
@@ -48,7 +39,7 @@ public:
};
// This is simply a helper function to keep Spawning code clean
- static inline OThwomp* Spawn(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize = 7) {
+ static OThwomp* Spawn(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize = 7) {
IRotator rot;
rot.Set(0, direction, 0);
@@ -61,7 +52,7 @@ public:
.PrimAlpha = primAlpha,
.BoundingBoxSize = boundingBoxSize
};
- return static_cast<OThwomp*>(gWorldInstance.AddObject(new OThwomp(params)));
+ return dynamic_cast<OThwomp*>(AddObjectToWorld<OThwomp>(params));
}
explicit OThwomp(const SpawnParams& params);
diff --git a/src/engine/objects/TrashBin.h b/src/engine/objects/TrashBin.h
index 4f2ea4132..d516cbe2c 100644
--- a/src/engine/objects/TrashBin.h
+++ b/src/engine/objects/TrashBin.h
@@ -1,22 +1,11 @@
#pragma once
#include <libultraship.h>
-#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
-extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
-#include "common_structs.h"
-#include "objects.h"
-#include "camera.h"
-#include "some_data.h"
-}
-
class OTrashBin : public OObject {
public:
@@ -26,7 +15,7 @@ public:
};
// This is simply a helper function to keep Spawning code clean
- static inline OTrashBin* Spawn(const FVector& pos, const IRotator& rot, f32 scale, OTrashBin::Behaviour bhv) {
+ static OTrashBin* Spawn(const FVector& pos, const IRotator& rot, f32 scale, OTrashBin::Behaviour bhv) {
SpawnParams params = {
.Name = "mk:trash_bin",
.Behaviour = bhv,
@@ -34,7 +23,7 @@ public:
.Rotation = rot,
.Scale = FVector(0, scale, 0),
};
- return static_cast<OTrashBin*>(gWorldInstance.AddObject(new OTrashBin(params)));
+ return dynamic_cast<OTrashBin*>(AddObjectToWorld<OTrashBin>(params));
}
explicit OTrashBin(const SpawnParams& params);
diff --git a/src/engine/objects/Trophy.cpp b/src/engine/objects/Trophy.cpp
index 44b9e7e51..760c16138 100644
--- a/src/engine/objects/Trophy.cpp
+++ b/src/engine/objects/Trophy.cpp
@@ -92,7 +92,7 @@ OTrophy::OTrophy(const SpawnParams& params) : OObject(params) {
object->pos[1] = spawnPos.y;
object->pos[2] = spawnPos.z;
- _emitter = reinterpret_cast<StarEmitter*>(gWorldInstance.AddEmitter(new StarEmitter()));
+ _emitter = reinterpret_cast<StarEmitter*>(GetWorld()->AddEmitter(new StarEmitter()));
}
void OTrophy::SetSpawnParams(SpawnParams& params) {
@@ -228,6 +228,11 @@ void OTrophy::Draw(s32 cameraId) {
Mat4 someMatrix1;
Mat4 someMatrix2;
Object* object;
+
+ if (Editor_IsPaused()) {
+ return;
+ }
+
if (*_toggleVisibility == true) {
object = &gObjectList[listIndex];
if (object->state >= 2) {
diff --git a/src/engine/objects/Trophy.h b/src/engine/objects/Trophy.h
index 628248edc..aedfef48c 100644
--- a/src/engine/objects/Trophy.h
+++ b/src/engine/objects/Trophy.h
@@ -1,20 +1,13 @@
#pragma once
#include <libultraship.h>
-#include <vector>
#include "Object.h"
+#include "RegisterContent.h"
#include "World.h"
#include "engine/particles/StarEmitter.h"
extern "C" {
-#include "macros.h"
-#include "main.h"
-#include "vehicles.h"
-#include "waypoints.h"
#include "common_structs.h"
-#include "objects.h"
-#include "course_offsets.h"
-#include "some_data.h"
}
class OTrophy : public OObject {
@@ -37,14 +30,14 @@ public:
};
// This is simply a helper function to keep Spawning code clean
- static inline OTrophy* Spawn(const FVector& pos, TrophyType trophy, Behaviour bhv) {
+ static OTrophy* Spawn(const FVector& pos, TrophyType trophy, Behaviour bhv) {
SpawnParams params = {
.Name = "mk:trophy",
.Type = trophy,
.Behaviour = bhv,
.Location = pos,
};
- return static_cast<OTrophy*>(gWorldInstance.AddObject(new OTrophy(params)));
+ return dynamic_cast<OTrophy*>(AddObjectToWorld<OTrophy>(params));
}
explicit OTrophy(const SpawnParams& params);