mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-29 01:22:04 -04:00
Add Rulesets (#494)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <libultraship.h>
|
||||
#include "World.h"
|
||||
|
||||
class Rulesets {
|
||||
public:
|
||||
virtual void PreLoad();
|
||||
virtual void PreInit();
|
||||
virtual void PostInit();
|
||||
};
|
||||
@@ -192,6 +192,10 @@ void KalimariDesert::BeginPlay() {
|
||||
|
||||
s32 centerWaypoint = 160;
|
||||
|
||||
_numTrains = CVarGetInteger("gNumTrains", 2);
|
||||
_numCarriages = CVarGetInteger("gNumCarriages", 5);
|
||||
_tender = (ATrain::TenderStatus)CVarGetInteger("gHasTender", 1);
|
||||
|
||||
// Spawn two trains
|
||||
for (size_t i = 0; i < _numTrains; ++i) {
|
||||
uint32_t waypoint = CalculateWaypointDistribution(i, _numTrains, gVehicle2DPathLength, centerWaypoint);
|
||||
|
||||
@@ -176,6 +176,11 @@ void ToadsTurnpike::BeginPlay() {
|
||||
a /= 2; // Normally vehicle logic is only ran every 2 frames. This slows the vehicles down to match.
|
||||
b /= 2;
|
||||
|
||||
_numTrucks = CVarGetInteger("gNumTrucks", 7);
|
||||
_numBuses = CVarGetInteger("gNumBuses", 7);
|
||||
_numTankerTrucks = CVarGetInteger("gNumTankerTrucks", 7);
|
||||
_numCars = CVarGetInteger("gNumCars", 7);
|
||||
|
||||
// Other game modes spawn seven of each vehicle
|
||||
if (gModeSelection == TIME_TRIALS) {
|
||||
_numTrucks = 8;
|
||||
|
||||
@@ -253,6 +253,11 @@ void OBombKart::Tick() {
|
||||
}
|
||||
break;
|
||||
case States::CHASE:
|
||||
// Prevents chasing during race staging
|
||||
if (gRaceState != RACE_IN_PROGRESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_target) {
|
||||
_target = OBombKart::FindTarget();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user