diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-05-15 10:30:39 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-15 10:30:39 -0600 |
| commit | e7415ec072ee1cdc99a49db658062d4de0b3301c (patch) | |
| tree | 5b01d3f1921e221d03b05ec101d10d7513624974 /src/port/Engine.cpp | |
| parent | 0e35858050fd00e5871f0ac9d1684edc61251d49 (diff) | |
Fixes made so far (#198)
* Fixed compile
* Moved GetInterpreter() to a single function under the Engine.h
Diffstat (limited to 'src/port/Engine.cpp')
| -rw-r--r-- | src/port/Engine.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 958f27183..440363efa 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -19,14 +19,14 @@ #include "resource/importers/UnkActorSpawnDataFactory.h" #include "resource/importers/ArrayFactory.h" #include "resource/importers/MinimapFactory.h" -#include <Fast3D/Fast3dWindow.h> #include <Fonts.h> #include "window/gui/resource/Font.h" #include "window/gui/resource/FontFactory.h" #include "SpaghettiGui.h" -#include <Fast3D/gfx_pc.h> -#include <Fast3D/gfx_rendering_api.h> +#include <graphic/Fast3D/Fast3dWindow.h> +#include <graphic/Fast3D/interpreter.h> +//#include <Fast3D/gfx_rendering_api.h> #include <SDL2/SDL.h> #include <utility> @@ -49,6 +49,16 @@ float gInterpolationStep = 0.0f; #include "audio/GameAudio.h" } +std::weak_ptr<Fast::Interpreter> GameEngine::mInterpreter; + +std::shared_ptr<Fast::Interpreter> GameEngine::GetInterpreter() { + auto intP = mInterpreter.lock(); + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + } + return intP; +} + GameEngine* GameEngine::Instance; GameEngine::GameEngine() { @@ -533,6 +543,7 @@ extern "C" void GameEngine_UnloadSequence(const uint8_t seqId) { } extern "C" float GameEngine_GetAspectRatio() { + auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; return gfx_current_dimensions.aspect_ratio; } @@ -606,6 +617,7 @@ extern "C" void Timer_SetValue(int32_t* address, int32_t value) { // } extern "C" float OTRGetAspectRatio() { + auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; return gfx_current_dimensions.aspect_ratio; } @@ -649,18 +661,22 @@ extern "C" uint32_t OTRCalculateCenterOfAreaFromLeftEdge(int32_t center) { // Gets the width of the current render target area extern "C" uint32_t OTRGetGameRenderWidth() { + auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; return gfx_current_dimensions.width; } // Gets the height of the current render target area extern "C" uint32_t OTRGetGameRenderHeight() { + auto gfx_current_dimensions = GameEngine::GetInterpreter().get()->mCurDimensions; return gfx_current_dimensions.height; } extern "C" uint32_t OTRGetGameViewportWidth() { + auto gfx_current_game_window_viewport = GameEngine::GetInterpreter().get()->mGameWindowViewport; return gfx_current_game_window_viewport.width; } extern "C" uint32_t OTRGetGameViewportHeight() { + auto gfx_current_game_window_viewport = GameEngine::GetInterpreter().get()->mGameWindowViewport; return gfx_current_game_window_viewport.height; }
\ No newline at end of file |
