From 32632cacdb316d7f2d3b6ecdb634f0ef9aebadf0 Mon Sep 17 00:00:00 2001 From: MegaMech Date: Wed, 14 May 2025 18:30:32 -0600 Subject: Impl new intro (#193) * Update menus * Update CMakeLists.txt * Add Ship * Impl hm ship actors * Update HM course * Impl new intro * Finish intro scene * Rename * Start Editor Work * raycast works * Fix ScreenRayTrace in widescreen * Basic Actor Picking * wip * Editor use vtx collision * gizmo work * otr works for object picking * Impl objects for editor * actor init * Update * Add all axis move (freemove) * Docking Windows works here * Setup imgui layout for editor * Editor Snap to Ground works * Basic Scene Explorer Works * Editor get actor names * Impl editor object names * impl Editor Play and Pause buttons * Editor translate works while paused * Fix freecam lighting * Added adjustable track properties to editor * Editor matrix, icons, rotation, impl light * Setup Track Properties 1 * Editor tooling wip * Load modded o2rs * Don't enable hud if editor is enabled * Updates * SceneManager nearly working * Fix mario kart 64 intro logo sizing * Fix Rotator * Finish new matrix translation code * Cleanup headers * Cleanup * Cleanup 2 * Cleanup 3 * Prevent divize by zero crash * Add visible circle for translate in all axis * Editor scaling/rot works properly now * Scale All_Axis evenly * Fixes to includes to work on Linux. * Removed overfilled arguments in gfx_create_framebuffer() * Added missing function definitions to Game.h * Editor sun face the camera * Add rotation model to gizmo * Add new handles * Failed attempt at transforming collision * Impl water volume * Import fast64 paths * water surface * Scene Setup 1 * Custom Track O2R almost working needs testing * Custom Track Load path O2r * Render custom track. Wip collision * Add missing function * Debug Spawning Custom O2R Track * Import courses working now * Fix memory leak * Remove New Track Button * Engine.cpp more consistent with sf64 * Fix Editor Enable Button * Editor Accurate mouse click drag objects * Editor selects closest object and cleanup * Gizmo rot and scale collision working * Remove constexpr from IRotator * Impl properties for location/rot/scale * Better Properties display, swap rot handles * Fix content browser dock and editor now disabled by default * Remove GameInfoWindow, Multiplayer Button, and FPS Slider * Disable Editor when its disabled * Add new logo to hm intro * Fix pause menu item box cursor * Remove minimap from Course::from_json and to_json * Impl Import Minimap * Fix custom minimap rendering * minimap uses extension .png * Refactor minimap * Freecam only for player 1 * GrandPrix Balloons work in custom track * Track Id is now std::string and outside of Props * Moved editor assets to be included in ship.o2r * Fixed GenerateO2R to package the correct folder and save to the correct filename * Linux specific changes. * Added "#include " that required them * Changed how the "ship.o2r" file is loaded to allow it to load the file from within appimages. * Changed the Linuxdeploy version to avoid errors later when the Github Actions creates appimages(same fix applied to other ports.) * Revert "Moved editor assets to be included in ship.o2r" This reverts commit 05704c01f761baa67a83e357d9765f5c6b5e3fdb. * Added back files(this time without LUS changes) * Changed workflow file to use correct filename for assets file. * Missed a few spots in the workflow file. * Added .desktop file and made corrections to the main workflow. * Added the rest of upstream CMakeLists.txt * disabled USE_NETWORKING * New InverseMatrix * Renamed both .o2r files to be more accurate to its contents. * Reverted CmakeList.txt --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com> Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> --- src/port/Engine.cpp | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'src/port/Engine.cpp') diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 179315595..958f27183 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -18,10 +18,12 @@ #include "resource/importers/ActorSpawnDataFactory.h" #include "resource/importers/UnkActorSpawnDataFactory.h" #include "resource/importers/ArrayFactory.h" +#include "resource/importers/MinimapFactory.h" #include #include #include "window/gui/resource/Font.h" #include "window/gui/resource/FontFactory.h" +#include "SpaghettiGui.h" #include #include @@ -50,14 +52,17 @@ float gInterpolationStep = 0.0f; GameEngine* GameEngine::Instance; GameEngine::GameEngine() { + + const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("mk64.o2r"); + const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("spaghetti.o2r"); + + std::vector archiveFiles; + #ifdef __SWITCH__ Ship::Switch::Init(Ship::PreInitPhase); Ship::Switch::Init(Ship::PostInitPhase); #endif - std::vector archiveFiles; - const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("spaghetti.o2r"); - const std::string assets_path = Ship::Context::GetPathRelativeToAppDirectory("ship.o2r"); #ifdef _WIN32 AllocConsole(); @@ -87,7 +92,7 @@ GameEngine::GameEngine() { if (std::filesystem::is_directory(patches_path)) { for (const auto& p : std::filesystem::recursive_directory_iterator(patches_path)) { auto ext = p.path().extension().string(); - if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) { + if (StringHelper::IEquals(ext, ".zip") || StringHelper::IEquals(ext, ".o2r")) { archiveFiles.push_back(p.path().generic_string()); } } @@ -105,7 +110,10 @@ GameEngine::GameEngine() { this->context->InitResourceManager(archiveFiles, {}, 3); // without this line InitWindow fails in Gui::Init() this->context->InitConsole(); // without this line the GuiWindow constructor fails in ConsoleWindow::InitElement() - auto wnd = std::make_shared(std::vector>({})); + auto gui = std::make_shared(std::vector>({})); + auto wnd = std::make_shared(gui); + + //auto wnd = std::make_shared(std::vector>({})); //auto wnd = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); this->context->Init(archiveFiles, {}, 3, { 26800, 512, 1100 }, wnd, controlDeck); @@ -163,15 +171,24 @@ GameEngine::GameEngine() { loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "TrackSections", static_cast(MK64::ResourceType::TrackSection), 0); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_XML, "TrackSections", + static_cast(MK64::ResourceType::TrackSection), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Waypoints", static_cast(MK64::ResourceType::Waypoints), 0); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_XML, "Paths", + static_cast(MK64::ResourceType::Waypoints), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "SpawnData", static_cast(MK64::ResourceType::SpawnData), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "UnkSpawnData", static_cast(MK64::ResourceType::UnkSpawnData), 0); + loader->RegisterResourceFactory(std::make_shared(), + RESOURCE_FORMAT_BINARY, "Minimap", + static_cast(MK64::ResourceType::Minimap), 0); fontMono = CreateFontWithSize(16.0f, "fonts/Inconsolata-Regular.ttf"); fontMonoLarger = CreateFontWithSize(20.0f, "fonts/Inconsolata-Regular.ttf"); @@ -280,11 +297,10 @@ void GameEngine::StartFrame() const { void GameEngine::RunCommands(Gfx* Commands) { auto wnd = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); - if (wnd == nullptr) { + if (nullptr == wnd) { return; } - // Process window events for resize, mouse, keyboard events wnd->HandleEvents(); wnd->DrawAndRunGraphicsCommands(Commands, {}); @@ -298,12 +314,12 @@ void GameEngine::RunCommands(Gfx* Commands) { } void GameEngine::ProcessGfxCommands(Gfx* commands) { - RunCommands(commands); auto wnd = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); if (wnd != nullptr) { wnd->SetTargetFps(CVarGetInteger("gInterpolationFPS", 30)); wnd->SetMaximumFrameLatency(1); } + RunCommands(commands); } // Audio @@ -640,3 +656,11 @@ extern "C" uint32_t OTRGetGameRenderWidth() { extern "C" uint32_t OTRGetGameRenderHeight() { return gfx_current_dimensions.height; } + +extern "C" uint32_t OTRGetGameViewportWidth() { + return gfx_current_game_window_viewport.width; +} + +extern "C" uint32_t OTRGetGameViewportHeight() { + return gfx_current_game_window_viewport.height; +} \ No newline at end of file -- cgit v1.2.3