Files
haikuports/games-arcade/astromenace/patches/astromenace-1.4.3.patchset
2025-04-19 15:49:35 +10:00

109 lines
3.8 KiB
Plaintext

From 9f8b075d0f8db58b34799019749cf5007aa6b2f1 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 18 Jul 2023 23:43:53 +1000
Subject: Haiku fixes
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 0837c84..c472b24 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -201,7 +201,11 @@ void InitGame()
GameExperience = (GameConfig().Profile[CurrentProfile].Experience - GameConfig().Profile[CurrentProfile].ByMissionExperience[CurrentMission]) * 1.0f;
// grab mouse control for both - windows and fullscren mode (need this for multi-monitor systems)
+#ifdef __HAIKU__
+ SDL_SetRelativeMouseMode(SDL_TRUE);
+#else
SDL_SetWindowGrab(reinterpret_cast<SDL_Window*>(vw_GetSDLWindow()), SDL_TRUE);
+#endif
vw_ResetMouseButtons();
@@ -340,7 +344,11 @@ void RealExitGame()
vw_ReleaseParticleSystem(Shild2);
// release mouse control
+#ifdef __HAIKU__
+ SDL_SetRelativeMouseMode(SDL_FALSE);
+#else
SDL_SetWindowGrab(reinterpret_cast<SDL_Window*>(vw_GetSDLWindow()), SDL_FALSE);
+#endif
}
//------------------------------------------------------------------------------------
@@ -531,7 +539,11 @@ void DrawGame()
SetShowGameCursor(true);
// release mouse control
+#ifdef __HAIKU__
+ SDL_SetRelativeMouseMode(SDL_FALSE);
+#else
SDL_SetWindowGrab(reinterpret_cast<SDL_Window*>(vw_GetSDLWindow()), SDL_FALSE);
+#endif
SDL_WarpMouseInWindow(reinterpret_cast<SDL_Window*>(vw_GetSDLWindow()), LastMouseXR, LastMouseYR);
}
// smooth increase game speed
@@ -548,7 +560,11 @@ void DrawGame()
GameMenuStatus = eGameMenuStatus::GAME_MENU;
// grab mouse control for both - windows and fullscren mode (need this for multi-monitor systems)
+#ifdef __HAIKU__
+ SDL_SetRelativeMouseMode(SDL_TRUE);
+#else
SDL_SetWindowGrab(reinterpret_cast<SDL_Window*>(vw_GetSDLWindow()), SDL_TRUE);
+#endif
SDL_WarpMouseInWindow(reinterpret_cast<SDL_Window*>(vw_GetSDLWindow()), LastMouseXR, LastMouseYR);
}
// set game speed to zero (should looks like all 3D objects are freeze in time)
diff --git a/src/main.cpp b/src/main.cpp
index e112ef5..8b1e787 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -100,6 +100,11 @@ static bool VideoConfig(bool FirstStart)
}
if (FirstStart) {
+#ifdef __HAIKU__
+ ChangeGameConfig().Width = 1024;
+ ChangeGameConfig().Height = 600;
+ ChangeGameConfig().Fullscreen = false;
+#else
if (!DetectFullscreenSize().empty()) {
ChangeGameConfig().Width = DetectFullscreenSize().back().Width;
ChangeGameConfig().Height = DetectFullscreenSize().back().Height;
@@ -109,6 +114,7 @@ static bool VideoConfig(bool FirstStart)
ChangeGameConfig().Height = DetectWindowSizeArray().back().Height;
ChangeGameConfig().Fullscreen = false;
}
+#endif
return true;
}
@@ -157,6 +163,14 @@ static bool CheckOpenGLCapabilities(bool FirstStart)
FirstStart = false;
#endif
if (FirstStart) {
+#ifdef __HAIKU__
+ ChangeGameConfig().UseGLSL120 = false;
+ ChangeGameConfig().ShadowMap = 0;
+ ChangeGameConfig().MSAA = 0;
+ ChangeGameConfig().CSAA = 0;
+ ChangeGameConfig().MaxPointLights = 1;
+ ChangeGameConfig().AnisotropyLevel = 0;
+#else
if (vw_DevCaps().OpenGL_3_0_supported) {
ChangeGameConfig().UseGLSL120 = true;
ChangeGameConfig().ShadowMap = 1;
@@ -172,6 +186,7 @@ static bool CheckOpenGLCapabilities(bool FirstStart)
ChangeGameConfig().CSAA = 4;
ChangeGameConfig().MaxPointLights = 6;
}
+#endif
}
// NOTE in future, use std::clamp (since C++17)
--
2.37.3