aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/game_manager.cpp32
-rw-r--r--engines/titanic/game_manager.h43
-rw-r--r--engines/titanic/game_view.cpp41
-rw-r--r--engines/titanic/game_view.h56
-rw-r--r--engines/titanic/main_game_window.cpp36
-rw-r--r--engines/titanic/main_game_window.h26
-rw-r--r--engines/titanic/module.mk2
-rw-r--r--engines/titanic/objects/project_item.h5
-rw-r--r--engines/titanic/screen_manager.cpp11
-rw-r--r--engines/titanic/screen_manager.h8
10 files changed, 256 insertions, 4 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
new file mode 100644
index 0000000000..94e1ad3fb2
--- /dev/null
+++ b/engines/titanic/game_manager.cpp
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/game_manager.h"
+
+namespace Titanic {
+
+CGameManager::CGameManager(CProjectItem *project, CGameView *gameView):
+ _project(project), _gameView(gameView) {
+ // TODO
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h
new file mode 100644
index 0000000000..0c1374e9a3
--- /dev/null
+++ b/engines/titanic/game_manager.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_GAME_MANAGER_H
+#define TITANIC_GAME_MANAGER_H
+
+#include "common/scummsys.h"
+
+namespace Titanic {
+
+class CProjectItem;
+class CGameView;
+
+class CGameManager {
+private:
+ CProjectItem *_project;
+ CGameView *_gameView;
+public:
+ CGameManager(CProjectItem *project, CGameView *gameView);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_GAME_MANAGER_H */
diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp
new file mode 100644
index 0000000000..d8410f1457
--- /dev/null
+++ b/engines/titanic/game_view.cpp
@@ -0,0 +1,41 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/game_view.h"
+#include "titanic/game_manager.h"
+
+namespace Titanic {
+
+CGameView::CGameView() : _gameManager(nullptr), _field8(0), _fieldC(0) {
+}
+
+void CGameView::setGameManager(CGameManager *gameManager) {
+ _gameManager = gameManager;
+}
+
+/*------------------------------------------------------------------------*/
+
+CTitanicGameView::CTitanicGameView(CMainGameWindow *gameWindow) :
+ CGameView(), _gameWindow(gameWindow) {
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h
new file mode 100644
index 0000000000..588cf938e3
--- /dev/null
+++ b/engines/titanic/game_view.h
@@ -0,0 +1,56 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_GAME_VIEW_H
+#define TITANIC_GAME_VIEW_H
+
+#include "common/scummsys.h"
+
+namespace Titanic {
+
+class CMainGameWindow;
+class CGameManager;
+
+class CGameView {
+protected:
+ CGameManager *_gameManager;
+ int _field8;
+ int _fieldC;
+public:
+ CGameView();
+
+ /**
+ * Set the game manager
+ */
+ void setGameManager(CGameManager *gameManager);
+};
+
+class CTitanicGameView: public CGameView {
+private:
+ CMainGameWindow *_gameWindow;
+public:
+ CTitanicGameView(CMainGameWindow *gameWindow);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_GAME_VIEW_H */
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 78e07e9af2..41eb825543 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -22,6 +22,8 @@
#include "titanic/titanic.h"
#include "titanic/main_game_window.h"
+#include "titanic/game_manager.h"
+#include "titanic/game_view.h"
namespace Titanic {
@@ -44,4 +46,38 @@ bool CMainGameWindow::Create() {
return true;
}
+void CMainGameWindow::applicationStarting() {
+ // Set up the game project, and get game slot
+ int saveSlot = selectSavegame();
+ assert(_project);
+
+ // Set the video mode
+ CScreenManager *screenManager = CScreenManager::setCurrent();
+ screenManager->setMode(640, 480, 1, 1, false);
+
+ // TODO: Clear surfaces
+
+ // Create game view and manager
+ _gameView = new CTitanicGameView(this);
+ _gameManager = new CGameManager(_project, _gameView);
+ _gameView->setGameManager(_gameManager);
+
+ // Load either a new game or selected existing save
+ _project->loadGame(saveSlot);
+
+ // TODO: Cursor/image and message generation
+}
+
+int CMainGameWindow::loadGame() {
+ _project = new CProjectItem();
+ _project->setFilename("starship.prj");
+
+ return selectSavegame();
+}
+
+int CMainGameWindow::selectSavegame() {
+ // TODO: For now, hardcoded to -1 for new saves
+ return -1;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h
index 9b41212d7a..dc2fdfd025 100644
--- a/engines/titanic/main_game_window.h
+++ b/engines/titanic/main_game_window.h
@@ -25,7 +25,10 @@
#include "common/scummsys.h"
#include "common/array.h"
+#include "titanic/game_manager.h"
+#include "titanic/game_view.h"
#include "titanic/image.h"
+#include "titanic/objects/project_item.h"
namespace Titanic {
@@ -34,10 +37,22 @@ class TitanicEngine;
class CMainGameWindow {
private:
TitanicEngine *_vm;
+
+ /**
+ * Checks for the presence of any savegames and, if present,
+ * lets the user pick one to resume
+ */
+ int loadGame();
+
+ /**
+ * Creates the game "project" and determine a game save slot
+ * to use
+ */
+ int selectSavegame();
public:
- void *_gameView;
- void *_gameManager;
- void *_project;
+ CGameView *_gameView;
+ CGameManager *_gameManager;
+ CProjectItem *_project;
int _field50;
Image *_image;
void *_cursor;
@@ -48,6 +63,11 @@ public:
* Creates the window
*/
bool Create();
+
+ /**
+ * Called when the application starts
+ */
+ void applicationStarting();
};
} // End of namespace Titanic
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 7d126b4094..fc855d2df0 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -6,6 +6,8 @@ MODULE_OBJS := \
detection.o \
direct_draw.o \
font.o \
+ game_manager.o \
+ game_view.o \
image.o \
main_game_window.o \
screen_manager.o \
diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h
index 60fee9b912..b313387a74 100644
--- a/engines/titanic/objects/project_item.h
+++ b/engines/titanic/objects/project_item.h
@@ -72,6 +72,11 @@ public:
* Clear any currently loaded project
*/
void clear();
+
+ /**
+ * Set the proejct's name
+ */
+ void setFilename(const CString &name) { _filename = name; }
};
} // End of namespace Titanic
diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp
index 08262dfd61..9df9fc3075 100644
--- a/engines/titanic/screen_manager.cpp
+++ b/engines/titanic/screen_manager.cpp
@@ -34,8 +34,12 @@ CScreenManagerRec::CScreenManagerRec() {
/*------------------------------------------------------------------------*/
+CScreenManager *CScreenManager::_screenManagerPtr;
+CScreenManager *CScreenManager::_currentScreenManagerPtr;
+
CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) {
_screenManagerPtr = nullptr;
+ _currentScreenManagerPtr = nullptr;
_frontRenderSurface = nullptr;
_mouseCursor = nullptr;
@@ -56,6 +60,13 @@ bool CScreenManager::resetWindowHandle(int v) {
return true;
}
+CScreenManager *CScreenManager::setCurrent() {
+ if (!_currentScreenManagerPtr)
+ _currentScreenManagerPtr = _screenManagerPtr;
+
+ return _currentScreenManagerPtr;
+}
+
/*------------------------------------------------------------------------*/
OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm),
diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h
index 4836bb33fc..0b847c2b49 100644
--- a/engines/titanic/screen_manager.h
+++ b/engines/titanic/screen_manager.h
@@ -50,7 +50,13 @@ class CScreenManager {
protected:
TitanicEngine *_vm;
public:
- void *_screenManagerPtr;
+ static CScreenManager *_screenManagerPtr;
+ static CScreenManager *_currentScreenManagerPtr;
+
+ /**
+ * Set the current screen manager
+ */
+ static CScreenManager *setCurrent();
public:
Common::Array<CVideoSurface *> _backSurfaces;
CVideoSurface *_frontRenderSurface;