summaryrefslogtreecommitdiff
path: root/src/engine/World.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-12-07 13:14:45 -0700
committerGitHub <noreply@github.com>2025-12-07 13:14:45 -0700
commit65853330926fa5c77ad75effab8c479ba1d96952 (patch)
treeb2bd8f865401a8d7c4ce9f78b94f34bfb778dbaf /src/engine/World.cpp
parent02ad54ca72f5baf4614cb9b7c30f8dd780764d90 (diff)
Camera Refactor --> Adds Track Tour Camera (#568)
* Impl SpawnParams * Added json submodule * Update json * Update * Works * Remove comment * Works refactor * Snowman and thwomp working * Impl hot air balloon * More progress * All OObjects are done * cleanup * Refactor 2Dpath to normal path * Update nlohmann json & fix compile * Rest of actors * MORE CHANGES * Finish actors * Done PR, some fix to collision viewer * Impl falling rocks * Add const * wip editor refactor * Property work * continue * Overridable editor properties * Actor saving/loading works now * Fix light alignment * Clarification * Impl penguin * params impl signs * properties impl falling rock * More property impls * impl air balloon * Add spawnParams to OObject Translate * Snowman translate better * impl hedgehog properly * properties impl trophy * thwomp progress * Finish impl properties * Fix compile * Fix cursor collisions * Move registered actors * Rename pathPoint XYZ to xyz * Fix editor pause bug * Clean up * Review comments * Remove SpawnParams struct from actor classes * Rename * Player Label First Iteration * Work now * Working 3d text * Fix boo bug * Finish AText actor * Fix spawnparams compile * Register AText * Finish Text Actor * Fix thwomp interpolation * Fix compile * Fix crab and hedgehog * Fix loading flagpole * Fix Hot Air Balloon * Turn zbuffer on for AText * Update * Camera Refactor * Camera Refactor Complete * Place Lookbehind behind a CVar * Make Tour CVar * Fix Tour Camera Billboarding * micro optimization * Impl tour cam in imgui editor and add to scenefile * As per review * Revert cleanWorld change as per review * Cleanup SceneManager * Func rename * Proper enabling of freecam and wip zoom fix * Couple fix * Fix credits * Fix podium ceremony * Stop music on reset & label new play sequence func * Rename func_800C8EF8 to play_sequence2 * Rename func_800CA414 to play_sequences * Fix compile * Label play_sequences * Clean up * Verify lakitu access * Renames * Fix tour enable logic * Add Audio * tour camera impl ending transition * As per review * Fix linux compile, probably * Update TourCamera.cpp * Update TourCamera.cpp * Update TrackProperties.cpp * Update TrackProperties.cpp * Update Game.cpp * Update SceneManager.cpp * Update camera.c * Update render_objects.h * Update render_objects.h * Update code_80057C60.h * fixing compile * addition --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/engine/World.cpp')
-rw-r--r--src/engine/World.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/engine/World.cpp b/src/engine/World.cpp
index 0922e6c6e..ac7cfb372 100644
--- a/src/engine/World.cpp
+++ b/src/engine/World.cpp
@@ -17,10 +17,16 @@ extern "C" {
#include "defines.h"
#include "audio/external.h"
#include "menus.h"
+#include "code_800029B0.h"
#include "assets/models/common_data.h"
#include "assets/models/tracks/mario_raceway/mario_raceway_data.h"
}
+#include "engine/cameras/GameCamera.h"
+#include "engine/cameras/FreeCamera.h"
+#include "engine/cameras/TourCamera.h"
+#include "engine/cameras/LookBehindCamera.h"
+
std::shared_ptr<Course> CurrentCourse;
Cup* CurrentCup;
@@ -29,7 +35,7 @@ World::World() {
}
World::~World() {
- ClearWorld();
+ CleanWorld();
}
std::shared_ptr<Course> World::AddCourse(std::shared_ptr<Course> course) {
@@ -137,6 +143,24 @@ void World::PreviousCourse() {
gWorldInstance.SetCurrentCourse(Courses[CourseIndex]);
}
+void World::TickCameras() {
+
+ for (size_t i = 0; i < 4; i++) {
+ struct UnkStruct_800DC5EC* screen = &D_8015F480[i];
+ if (NULL == screen->pendingCamera) { continue; }
+ if (screen->pendingCamera != screen->camera) {
+ screen->camera = screen->pendingCamera;
+ screen->pendingCamera = nullptr;
+ }
+ }
+
+ for (GameCamera* camera : Cameras) {
+ if (camera->IsActive()) {
+ camera->Tick();
+ }
+ }
+}
+
AActor* World::AddActor(AActor* actor) {
Actors.push_back(actor);
actor->BeginPlay();
@@ -196,7 +220,7 @@ StaticMeshActor* World::AddStaticMeshActor(std::string name, FVector pos, IRotat
}
void World::DrawStaticMeshActors() {
- for (const auto& actor: StaticMeshActors) {
+ for (const auto& actor : StaticMeshActors) {
actor->Draw();
}
}
@@ -266,7 +290,7 @@ Object* World::GetObjectByIndex(size_t index) {
}
// Deletes all objects from the world
-void World::ClearWorld(void) {
+void World::CleanWorld(void) {
printf("[Game.cpp] Clean World\n");
World* world = &gWorldInstance;
for (auto& actor : world->Actors) {
@@ -297,7 +321,4 @@ void World::ClearWorld(void) {
gWorldInstance.Objects.clear();
gWorldInstance.Emitters.clear();
gWorldInstance.Lakitus.clear();
-
- gWorldInstance.GetRaceManager().Clean();
-
}