summaryrefslogtreecommitdiff
path: root/src/engine/actors
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-11-14 14:50:33 -0700
committerGitHub <noreply@github.com>2025-11-14 14:50:33 -0700
commitfffd3f7fe92c6eb45b68c0ca522066bf9c54abb2 (patch)
tree3dace8aa5a702dddfc0e5d7d7fde948c358a67dd /src/engine/actors
parentc2755aee40bb37c8440ec58f260b4bd36bd6e256 (diff)
RaceManager class (#562)
* Create RaceManager.cpp * Create RaceManager class for race lifecycle management Added RaceManager class to manage race events lifecycle. * Refactor World class and implement ClearWorld method Refactor World class constructor and destructor. Implement ClearWorld method to delete all objects and reset state. * Add RaceManager to World class * Update ValidateString for editor mode checks Refactor ValidateString to handle editor mode and empty strings. * Update Text.cpp * Add SetText method to Text class * Document RunGarbageCollector function Added documentation for the RunGarbageCollector function. * Refactor Game.cpp by removing dead code Removed unused ruleset handling and clean-up code. * Update Game.h * Remove CM_SpawnFromLevelProps call * Update Text.cpp * Update World.cpp * Add Clean method to RaceManager class * Update RaceManager.cpp * Update World.cpp * Update World.h * Update World.cpp
Diffstat (limited to 'src/engine/actors')
-rw-r--r--src/engine/actors/Text.cpp19
-rw-r--r--src/engine/actors/Text.h2
2 files changed, 16 insertions, 5 deletions
diff --git a/src/engine/actors/Text.cpp b/src/engine/actors/Text.cpp
index 2d2fab0b0..06a74c54d 100644
--- a/src/engine/actors/Text.cpp
+++ b/src/engine/actors/Text.cpp
@@ -77,7 +77,11 @@ AText::AText(const SpawnParams& params) : AActor(params) {
* But these need to be checked thoroughly before white-listing.
*/
std::string AText::ValidateString(const std::string_view& s) {
- if (s.empty()) { return "Blank Text"; }
+ if (CVarGetInteger("gIsEditorEnabled", false) == true) {
+ if (s.empty()) { return "Blank Text"; }
+ } else {
+ if (s.empty()) { return ""; }
+ }
Text.clear();
@@ -100,6 +104,11 @@ std::string AText::ValidateString(const std::string_view& s) {
return Text;
}
+void AText::SetText(std::string text) {
+ AText::ValidateString(text);
+ Refresh();
+}
+
/*
* Most changes during runtime require a refresh because the text is generated statically
* with the intention of this code being somewhat performant
@@ -353,7 +362,9 @@ void AText::DrawText3D(Camera* camera) { // Based on func_80095BD0
FrameInterpolation_RecordOpenChild("actor_text", TAG_LETTER(this));
gSPDisplayList(gDisplayListHead++, (Gfx*)D_020077A8);
- switch (1) {
+
+ for (CharacterList& tex : TextureList) {
+ switch (tex.mode) {
case 1:
gSPDisplayList(gDisplayListHead++, (Gfx*)D_020077F8);
break;
@@ -361,8 +372,6 @@ void AText::DrawText3D(Camera* camera) { // Based on func_80095BD0
gSPDisplayList(gDisplayListHead++, (Gfx*)D_02007818);
break;
}
-
- for (CharacterList& tex : TextureList) {
//printf("tex texture %p width %d height %d mode %d col %f\n", tex.Texture, tex.width, tex.height, tex.mode, tex.column);
gDPLoadTextureTile_4b(gDisplayListHead++, (Gfx*)tex.Texture, G_IM_FMT_I, tex.width, 0, 0, 0, tex.width, tex.height + 2, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
@@ -585,4 +594,4 @@ void AText::DrawColourEditor(bool* updated) {
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/engine/actors/Text.h b/src/engine/actors/Text.h
index 7a9ac7407..e0b436709 100644
--- a/src/engine/actors/Text.h
+++ b/src/engine/actors/Text.h
@@ -118,6 +118,8 @@ public:
void DrawColourEditor(bool* updated);
void FollowPlayer();
+ void SetText(std::string text);
+
std::string ValidateString(const std::string_view& text);
void Refresh();
void Print3D(char* text, s32 tracking, s32 mode);