summaryrefslogtreecommitdiff
path: root/src/engine/World.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-12-07 21:00:06 -0700
committerGitHub <noreply@github.com>2025-12-07 21:00:06 -0700
commitdbae0c3aca33a022e8c1d511fe521407375057b2 (patch)
tree889ebe9e5c03261d92304545c5beae13892831f2 /src/engine/World.cpp
parent04ca19a9757752676450364e998d6af0d90e73ef (diff)
Name ScreenContext, Refactor Course class to Track (#583)
* Rename Screen Contexts * typedef ScreenContext struct * Fix Compile * Rename Course.cpp to Track.cpp * Refactor Course to Track * A few renames * General Cleanup * More Rename * More names * Move TrackSections struct to Track.h --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/engine/World.cpp')
-rw-r--r--src/engine/World.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/engine/World.cpp b/src/engine/World.cpp
index ac7cfb372..f204ee0f8 100644
--- a/src/engine/World.cpp
+++ b/src/engine/World.cpp
@@ -1,7 +1,7 @@
#include <libultraship.h>
#include "World.h"
#include "Cup.h"
-#include "courses/Course.h"
+#include "tracks/Track.h"
#include "objects/BombKart.h"
#include "TrainCrossing.h"
#include <memory>
@@ -27,7 +27,7 @@ extern "C" {
#include "engine/cameras/TourCamera.h"
#include "engine/cameras/LookBehindCamera.h"
-std::shared_ptr<Course> CurrentCourse;
+std::shared_ptr<Track> mTrack;
Cup* CurrentCup;
World::World() {
@@ -38,27 +38,27 @@ World::~World() {
CleanWorld();
}
-std::shared_ptr<Course> World::AddCourse(std::shared_ptr<Course> course) {
- gWorldInstance.Courses.push_back(course);
- return course;
+std::shared_ptr<Track> World::AddTrack(std::shared_ptr<Track> track) {
+ gWorldInstance.Tracks.push_back(track);
+ return track;
}
void World::AddCup(Cup* cup) {
Cups.push_back(cup);
}
-void World::SetCurrentCourse(std::shared_ptr<Course> course) {
- if (CurrentCourse) {
- UnLoadCourse();
+void World::SetCurrentTrack(std::shared_ptr<Track> track) {
+ if (mTrack) {
+ UnLoadTrack();
}
- if (CurrentCourse == course) {
+ if (mTrack == track) {
return;
}
- CurrentCourse = std::move(course);
+ mTrack = std::move(track);
}
-void World::SetCourseFromCup() {
- SetCurrentCourse(CurrentCup->GetCourse());
+void World::SetTrackFromCup() {
+ SetCurrentTrack(CurrentCup->GetTrack());
}
TrainCrossing* World::AddCrossing(Vec3f position, u32 waypointMin, u32 waypointMax, f32 approachRadius,
@@ -114,39 +114,39 @@ void World::SetCurrentCup(Cup* cup) {
}
}
-void World::SetCourse(const char* name) {
+void World::SetTrack(const char* name) {
//! @todo Use content dictionary instead
- for (size_t i = 0; i < Courses.size(); i++) {
- if (strcmp(Courses[i]->Props.Name, name) == 0) {
- SetCurrentCourse(Courses[i]);
+ for (size_t i = 0; i < Tracks.size(); i++) {
+ if (strcmp(Tracks[i]->Props.Name, name) == 0) {
+ SetCurrentTrack(Tracks[i]);
break;
}
}
- std::runtime_error("SetCourse() Course name not found in Courses list");
+ std::runtime_error("[World] [SetTrack()] Track name not found in Track list");
}
-void World::NextCourse() {
- if (CourseIndex < Courses.size() - 1) {
- CourseIndex++;
+void World::NextTrack() {
+ if (TrackIndex < Tracks.size() - 1) {
+ TrackIndex++;
} else {
- CourseIndex = 0;
+ TrackIndex = 0;
}
- gWorldInstance.SetCurrentCourse(Courses[CourseIndex]);
+ gWorldInstance.SetCurrentTrack(Tracks[TrackIndex]);
}
-void World::PreviousCourse() {
- if (CourseIndex > 0) {
- CourseIndex--;
+void World::PreviousTrack() {
+ if (TrackIndex > 0) {
+ TrackIndex--;
} else {
- CourseIndex = Courses.size() - 1;
+ TrackIndex = Tracks.size() - 1;
}
- gWorldInstance.SetCurrentCourse(Courses[CourseIndex]);
+ gWorldInstance.SetCurrentTrack(Tracks[TrackIndex]);
}
void World::TickCameras() {
for (size_t i = 0; i < 4; i++) {
- struct UnkStruct_800DC5EC* screen = &D_8015F480[i];
+ ScreenContext* screen = &gScreenContexts[i];
if (NULL == screen->pendingCamera) { continue; }
if (screen->pendingCamera != screen->camera) {
screen->camera = screen->pendingCamera;