diff options
| author | MegaMech <7255464+MegaMech@users.noreply.github.com> | 2025-05-23 11:53:03 -0600 |
|---|---|---|
| committer | MegaMech <7255464+MegaMech@users.noreply.github.com> | 2025-05-23 11:53:03 -0600 |
| commit | db68d0b1c53bd9e627c0b343870bd0633bf782d4 (patch) | |
| tree | 88477098a1c71fda6813455e2e1a3c675ebb3da7 /src/engine | |
| parent | ba9af8e063b0963d06c667ddf04d8cefbf50dbb4 (diff) | |
Track unique_ptr : This probably compiles
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/World.cpp | 17 | ||||
| -rw-r--r-- | src/engine/World.h | 2 | ||||
| -rw-r--r-- | src/engine/objects/BombKart.cpp | 8 | ||||
| -rw-r--r-- | src/engine/objects/GrandPrixBalloons.cpp | 6 | ||||
| -rw-r--r-- | src/engine/objects/HotAirBalloon.cpp | 2 | ||||
| -rw-r--r-- | src/engine/objects/Lakitu.cpp | 4 | ||||
| -rw-r--r-- | src/engine/objects/TrashBin.cpp | 2 |
7 files changed, 27 insertions, 14 deletions
diff --git a/src/engine/World.cpp b/src/engine/World.cpp index e84cd5c47..998e3ba71 100644 --- a/src/engine/World.cpp +++ b/src/engine/World.cpp @@ -90,20 +90,31 @@ void World::SetCourse(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) { - CurrentCourse = Courses[i]; + CurrentCourse = Courses[i].get(); break; } } std::runtime_error("SetCourse() Course name not found in Courses list"); } +template<typename T> +void World::SetCourseByType() { + for (const auto& course : Courses) { + if (dynamic_cast<T*>(course.get())) { + CurrentCourse = course.get(); + return; + } + } + printf("World::SetCourseByType() No course by the type found"); +} + void World::NextCourse() { if (CourseIndex < Courses.size() - 1) { CourseIndex++; } else { CourseIndex = 0; } - gWorldInstance.CurrentCourse = Courses[CourseIndex]; + gWorldInstance.CurrentCourse = Courses[CourseIndex].get(); } void World::PreviousCourse() { @@ -112,7 +123,7 @@ void World::PreviousCourse() { } else { CourseIndex = Courses.size() - 1; } - gWorldInstance.CurrentCourse = Courses[CourseIndex]; + gWorldInstance.CurrentCourse = Courses[CourseIndex].get(); } AActor* World::AddActor(AActor* actor) { diff --git a/src/engine/World.h b/src/engine/World.h index 7a4fdc159..440b14fb2 100644 --- a/src/engine/World.h +++ b/src/engine/World.h @@ -94,6 +94,8 @@ public: // These are only for browsing through the course list void SetCourse(const char*); + template<typename T> + void SetCourseByType(); void NextCourse(void); void PreviousCourse(void); diff --git a/src/engine/objects/BombKart.cpp b/src/engine/objects/BombKart.cpp index 53b4a4262..8aaaae6cf 100644 --- a/src/engine/objects/BombKart.cpp +++ b/src/engine/objects/BombKart.cpp @@ -118,7 +118,7 @@ void OBombKart::Tick() { return; } - if (((Unk_4A != 1) || (GetCourse() == GetPodiumCeremony()))) { + if (((Unk_4A != 1) || (IsPodiumCeremony()))) { newPos[0] = Pos[0]; newPos[1] = Pos[1]; newPos[2] = Pos[2]; @@ -128,7 +128,7 @@ void OBombKart::Tick() { bounceTimer = BounceTimer; circleTimer = CircleTimer; if ((state != States::DISABLED) && (state != States::EXPLODE)) { - if (GetCourse() == GetPodiumCeremony()) { + if (IsPodiumCeremony()) { if (D_8016347E == 1) { player = gPlayerFour; temp_f0 = newPos[0] - player->pos[0]; @@ -152,7 +152,7 @@ void OBombKart::Tick() { if ((((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) + (temp_f12 * temp_f12)) < 25.0f) { state = States::EXPLODE; circleTimer = 0; - if (GetCourse() == GetFrappeSnowland()) { + if (IsFrappeSnowland()) { player->soundEffects |= 0x01000000; } else { player->soundEffects |= 0x400000; @@ -346,7 +346,7 @@ void OBombKart::Draw(s32 cameraId) { return; } - if (GetCourse() == GetPodiumCeremony()) { + if (IsPodiumCeremony()) { if ((_idx == 0) && (WaypointIndex < 16)) { return; } else { diff --git a/src/engine/objects/GrandPrixBalloons.cpp b/src/engine/objects/GrandPrixBalloons.cpp index 544a3e4d1..ec85ddaa4 100644 --- a/src/engine/objects/GrandPrixBalloons.cpp +++ b/src/engine/objects/GrandPrixBalloons.cpp @@ -139,7 +139,7 @@ void OGrandPrixBalloons::func_80074924(s32 objectIndex) { object = &gObjectList[objectIndex]; object->sizeScaling = 0.15f; - if (GetCourse() == GetMarioRaceway()) { + if (IsMarioRaceway) { sp2C = random_int(0x00C8U); sp28 = random_int(_numBalloons3); sp24 = random_int(0x0096U); @@ -147,7 +147,7 @@ void OGrandPrixBalloons::func_80074924(s32 objectIndex) { object->origin_pos[0] = (f32) ((((f64) Pos.x + 100.0) - (f64) sp2C) * (f64) xOrientation); object->origin_pos[1] = (f32) (Pos.y + sp28); object->origin_pos[2] = (f32) (((f64) Pos.z + 200.0) - (f64) sp24); - } else if (GetCourse() == GetRoyalRaceway()) { + } else if (IsRoyalRaceway()) { sp2C = random_int(0x0168U); sp28 = random_int(_numBalloons3); sp24 = random_int(0x00B4U); @@ -155,7 +155,7 @@ void OGrandPrixBalloons::func_80074924(s32 objectIndex) { object->origin_pos[0] = (f32) ((((f64) Pos.x + 180.0) - (f64) sp2C) * (f64) xOrientation); object->origin_pos[1] = (f32) (Pos.y + sp28); object->origin_pos[2] = (f32) (((f64) Pos.z + 200.0) - (f64) sp24); - } else if (GetCourse() == GetLuigiRaceway()) { + } else if (IsLuigiRaceway()) { sp2C = random_int(0x012CU); sp28 = random_int(_numBalloons3); sp24 = random_int(0x0096U); diff --git a/src/engine/objects/HotAirBalloon.cpp b/src/engine/objects/HotAirBalloon.cpp index 4e337d98e..f1e367d8d 100644 --- a/src/engine/objects/HotAirBalloon.cpp +++ b/src/engine/objects/HotAirBalloon.cpp @@ -21,7 +21,7 @@ OHotAirBalloon::OHotAirBalloon(const FVector& pos) { D_80165898 = 0; // Spawn balloon on second lap. - if (GetCourse() == GetLuigiRaceway()) { + if (IsLuigiRaceway()) { _visible = (bool*)&D_80165898; } else { // Spawn balloon on race start bool mod = true; diff --git a/src/engine/objects/Lakitu.cpp b/src/engine/objects/Lakitu.cpp index 92f164e95..988d3bc22 100644 --- a/src/engine/objects/Lakitu.cpp +++ b/src/engine/objects/Lakitu.cpp @@ -297,7 +297,7 @@ void OLakitu::func_800729EC(s32 objectIndex) { D_8018D2BC = 1; D_8018D2A4 = 1; - if (GetCourse() != GetYoshiValley()) { + if (!IsYoshiValley()) { for (i = 0; i < gPlayerCount; i++) { playerHUD[i].unk_81 = temp_v1; } @@ -366,7 +366,7 @@ void OLakitu::func_800797AC(s32 playerId) { objectIndex = gIndexLakituList[playerId]; player = &gPlayerOne[playerId]; - //if ((GetCourse() == GetSherbetLand()) && (player->unk_0CA & 1)) { + //if ((IsSherbetLand()) && (player->unk_0CA & 1)) { if ((CM_GetProps()->LakituTowType == LakituTowType::ICE) && (player->unk_0CA & 1)) { init_object(objectIndex, 7); player->unk_0CA |= 0x10; diff --git a/src/engine/objects/TrashBin.cpp b/src/engine/objects/TrashBin.cpp index e721f299c..dc62626dc 100644 --- a/src/engine/objects/TrashBin.cpp +++ b/src/engine/objects/TrashBin.cpp @@ -32,7 +32,7 @@ OTrashBin::OTrashBin(const FVector& pos, const IRotator& rotation, f32 scale, OT init_object(_objectIndex, 0); - if (GetCourse() != GetBansheeBoardwalk()) { + if (!IsBansheeBoardwalk()) { _drawBin = true; } } |
