summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-11 22:03:03 +0100
committerAki <please@ignore.pl>2022-03-11 22:03:03 +0100
commitdbff7e371b0a0261bf6d3680843d389cd92249bb (patch)
treee6adc10b729ad856bcd8a45ab1176a4b7989adf0
parentba3ebf161e74c54deb7ab10621177769b479305c (diff)
downloadstarshatter-dbff7e371b0a0261bf6d3680843d389cd92249bb.zip
starshatter-dbff7e371b0a0261bf6d3680843d389cd92249bb.tar.gz
starshatter-dbff7e371b0a0261bf6d3680843d389cd92249bb.tar.bz2
Moved part of Init to GameWinDX9
-rw-r--r--Stars45/Game.cpp41
-rw-r--r--Stars45/GameWinDX9.cpp55
-rw-r--r--Stars45/GameWinDX9.h3
-rw-r--r--Stars45/StarServer.cpp3
-rw-r--r--Stars45/Starshatter.cpp3
5 files changed, 62 insertions, 43 deletions
diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp
index add37b1..ed2ee92 100644
--- a/Stars45/Game.cpp
+++ b/Stars45/Game.cpp
@@ -188,47 +188,6 @@ bool
Game::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
{
status = OK;
- hInst = hi;
-
- Print(" Initializing Game\n");
-
- stats.Clear();
-
- if (!InitApplication(hInst)) { // Initialize shared things
- Panic::Panic("Could not initialize the application.");
- status = INIT_FAILED;
- }
-
- if (status == OK && !video_settings) {
- Panic::Panic("No video settings specified");
- status = INIT_FAILED;
- }
-
- if (status == OK) {
- static int os_version = MachineInfo::GetPlatform();
-
- if (os_version == MachineInfo::OS_WIN95 || os_version == MachineInfo::OS_WIN98) {
- Panic::Panic(" Windows 95 and 98 are no longer supported. Please update to Windows XP or higher.");
- status = INIT_FAILED;
- } else if (os_version == MachineInfo::OS_WINNT) {
- Panic::Panic(" D3D not available under WinNT 4");
- status = INIT_FAILED;
- } else if (MachineInfo::GetDirectXVersion() < MachineInfo::DX_9) {
- Panic::Panic(" Insufficient DirectX detected (Dx9 IS REQUIRED)");
- status = INIT_FAILED;
- }
-
- Print(" Gamma Level = %d\n", gamma);
- }
-
- if (status == OK) {
- Print("\n Initializing instance...\n");
- // Perform initializations that apply to a specific instance
- if (!InitInstance(hInst, nCmdShow)) {
- Panic::Panic("Could not initialize the instance.");
- status = INIT_FAILED;
- }
- }
if (status == OK) {
Print(" Initializing content...\n");
diff --git a/Stars45/GameWinDX9.cpp b/Stars45/GameWinDX9.cpp
index 19fe60d..2cd4fbe 100644
--- a/Stars45/GameWinDX9.cpp
+++ b/Stars45/GameWinDX9.cpp
@@ -7,6 +7,9 @@
#include "GameWinDX9.h"
#include "Game.h"
+#include "MachineInfo.h"
+#include "Panic.h"
+#include "Types.h"
GameWinDX9::GameWinDX9()
@@ -17,3 +20,55 @@ GameWinDX9::GameWinDX9()
GameWinDX9::~GameWinDX9()
{
}
+
+
+bool
+GameWinDX9::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
+{
+ status = OK;
+ hInst = hi;
+
+ Print(" Initializing Game\n");
+
+ stats.Clear();
+
+ if (!InitApplication(hInst)) { // Initialize shared things
+ Panic::Panic("Could not initialize the application.");
+ status = INIT_FAILED;
+ }
+
+ if (status == OK && !video_settings) {
+ Panic::Panic("No video settings specified");
+ status = INIT_FAILED;
+ }
+
+ if (status == OK) {
+ static int os_version = MachineInfo::GetPlatform();
+
+ if (os_version == MachineInfo::OS_WIN95 || os_version == MachineInfo::OS_WIN98) {
+ Panic::Panic(" Windows 95 and 98 are no longer supported. Please update to Windows XP or higher.");
+ status = INIT_FAILED;
+ } else if (os_version == MachineInfo::OS_WINNT) {
+ Panic::Panic(" D3D not available under WinNT 4");
+ status = INIT_FAILED;
+ } else if (MachineInfo::GetDirectXVersion() < MachineInfo::DX_9) {
+ Panic::Panic(" Insufficient DirectX detected (Dx9 IS REQUIRED)");
+ status = INIT_FAILED;
+ }
+
+ Print(" Gamma Level = %d\n", gamma);
+ }
+
+ if (status == OK) {
+ Print("\n Initializing instance...\n");
+ // Perform initializations that apply to a specific instance
+ if (!InitInstance(hInst, nCmdShow)) {
+ Panic::Panic("Could not initialize the instance.");
+ status = INIT_FAILED;
+ }
+ }
+
+ if (status != OK)
+ return false;
+ return Game::Init(hi, hpi, cmdline, nCmdShow);
+}
diff --git a/Stars45/GameWinDX9.h b/Stars45/GameWinDX9.h
index 1aee8df..3ad8a7c 100644
--- a/Stars45/GameWinDX9.h
+++ b/Stars45/GameWinDX9.h
@@ -8,6 +8,7 @@
#define GameWinDX9_h
#include "Game.h"
+#include "Types.h"
class GameWinDX9 : public Game
@@ -15,6 +16,8 @@ class GameWinDX9 : public Game
public:
GameWinDX9();
virtual ~GameWinDX9();
+
+ virtual bool Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow);
};
diff --git a/Stars45/StarServer.cpp b/Stars45/StarServer.cpp
index 418d607..e0b17b8 100644
--- a/Stars45/StarServer.cpp
+++ b/Stars45/StarServer.cpp
@@ -44,6 +44,7 @@
#include "Token.h"
#include "MachineInfo.h"
#include "Game.h"
+#include "GameWinDX9.h"
#include "ContentBundle.h"
#include "Keyboard.h"
#include "Mouse.h"
@@ -140,7 +141,7 @@ StarServer::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
if (loader)
loader->UseFileSystem(false);
- return Game::Init(hi, hpi, cmdline, nCmdShow);
+ return GameWinDX9::Init(hi, hpi, cmdline, nCmdShow);
}
// +--------------------------------------------------------------------+
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp
index 4f53d5b..4f04777 100644
--- a/Stars45/Starshatter.cpp
+++ b/Stars45/Starshatter.cpp
@@ -84,6 +84,7 @@
#include "MachineInfo.h"
#include "Game.h"
+#include "GameWinDX9.h"
#include "ContentBundle.h"
#include "VideoFactory.h"
#include "Screen.h"
@@ -391,7 +392,7 @@ Starshatter::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow)
if (loader)
loader->UseFileSystem(use_file_system);
- return Game::Init(hi, hpi, cmdline, nCmdShow);
+ return GameWinDX9::Init(hi, hpi, cmdline, nCmdShow);
}
// +--------------------------------------------------------------------+