summaryrefslogtreecommitdiff
path: root/src/engine/Rulesets.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-07-20 17:13:35 -0600
committerGitHub <noreply@github.com>2025-07-20 17:13:35 -0600
commitadc7dd050f3a2fd13b85b2d799154061d196ef09 (patch)
treea29def388d8045fa491de1c6f6ff42c1f5bfe8c9 /src/engine/Rulesets.cpp
parentd62d4bb90050ee195ef10996bd702b770c519eb1 (diff)
Add Rulesets (#494)
Diffstat (limited to 'src/engine/Rulesets.cpp')
-rw-r--r--src/engine/Rulesets.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/engine/Rulesets.cpp b/src/engine/Rulesets.cpp
new file mode 100644
index 000000000..acdbfde2a
--- /dev/null
+++ b/src/engine/Rulesets.cpp
@@ -0,0 +1,48 @@
+#include "Rulesets.h"
+#include "objects/Thwomp.h"
+#include "objects/Trophy.h"
+
+extern "C" {
+#include "code_800029B0.h"
+#include "memory.h"
+}
+
+// Before the game is loaded, and before vertices and displaylists are unpacked.
+// Only runs a single time at the beginning of a track.
+void Rulesets::PreLoad() {
+}
+
+// Just before BeginPlay() (used to spawn actors) is ran.
+// Only runs a single time at the beginning of a track.
+void Rulesets::PreInit() {
+ if (CVarGetInteger("gDisableItemboxes", false) == true) {
+ gPlaceItemBoxes = false;
+ } else {
+ gPlaceItemBoxes = true;
+ }
+}
+
+// Just after BeginPlay() is ran.
+// Only runs a single time at the beginning of a track.
+void Rulesets::PostInit() {
+ if (CVarGetInteger("gAllThwompsAreMarty", false) == true) {
+ for (auto object : gWorldInstance.Objects) {
+ if (OThwomp* thwomp = dynamic_cast<OThwomp*>(object)) {
+ gObjectList[thwomp->_objectIndex].unk_0D5 = OThwomp::States::JAILED; // Sets all the thwomp behaviour flags to marty
+ thwomp->State = OThwomp::States::JAILED;
+ }
+ }
+ }
+
+ if (CVarGetInteger("gAllBombKartsChase", false) == true) {
+ for (auto object : gWorldInstance.Objects) {
+ if (OBombKart* kart = dynamic_cast<OBombKart*>(object)) {
+ kart->State = OBombKart::States::CHASE;
+ }
+ }
+ }
+
+ if (CVarGetInteger("gGoFish", false) == true) {
+ gWorldInstance.AddObject(new OTrophy(FVector(0,0,0), OTrophy::TrophyType::GOLD, OTrophy::Behaviour::GO_FISH));
+ }
+}