mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-09 14:56:07 -04:00
Fixes made so far (#198)
* Fixed compile * Moved GetInterpreter() to a single function under the Engine.h
This commit is contained in:
+19
-3
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user