diff options
-rw-r--r-- | engines/titanic/files_manager.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/files_manager.h | 12 | ||||
-rw-r--r-- | engines/titanic/game_manager.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/game_view.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/game_view.h | 7 | ||||
-rw-r--r-- | engines/titanic/input_handler.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/main_game_window.h | 5 | ||||
-rw-r--r-- | engines/titanic/screen_manager.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/screen_manager.h | 4 |
10 files changed, 62 insertions, 21 deletions
diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 47da8e53ba..7ff0b51af8 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -27,7 +27,7 @@ namespace Titanic { CFilesManager::CFilesManager() : _gameManager(nullptr), - _assetsPath("Assets"), _field0(0), _field14(0), + _assetsPath("Assets"), _field0(0), _drive(-1), _field18(0), _field1C(0), _field3C(0) { } @@ -65,12 +65,20 @@ bool CFilesManager::scanForFile(const CString &name) { return fileExists(fname); } -void CFilesManager::fn1() { - warning("TODO: CFilesManager::fn1"); +void CFilesManager::loadDrive() { + assert(_drive == -1); + resetView(); } void CFilesManager::debug(CScreenManager *screenManager) { warning("TODO: CFilesManager::debug"); } +void CFilesManager::resetView() { + if (_gameManager) { + _gameManager->_gameState.setMode(GSMODE_1); + _gameManager->initBounds(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index a767056bdf..ab92151055 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -40,7 +40,7 @@ private: CString _string1; CString _string2; int _field0; - int _field14; + int _drive; int _field18; int _field1C; int _field3C; @@ -65,9 +65,17 @@ public: */ bool scanForFile(const CString &name); - void fn1(); + /** + * Handles displaying a load drive view if necessary + */ + void loadDrive(); void debug(CScreenManager *screenManager); + + /** + * Resets the view being displayed + */ + void resetView(); }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 675323198e..49a881d8e2 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -181,8 +181,9 @@ void CGameManager::update() { // Set the surface bounds screenManager->setSurfaceBounds(0, _bounds); + // Handle redrawing the view if (!_bounds.isEmpty()) { - _gameView->proc4(_bounds); + _gameView->draw(_bounds); _bounds = Common::Rect(); } diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 86ad072f61..d04c3e1cfc 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -67,8 +67,8 @@ void CSTGameView::setView(CViewItem *view) { _gameWindow->setActiveView(view); } -void CSTGameView::proc4(const Common::Rect &bounds) { - _gameWindow->fn2(); +void CSTGameView::draw(const Common::Rect &bounds) { + _gameWindow->draw(); } } // End of namespace Titanic diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index be4d934a33..a3e1fe7720 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -57,7 +57,7 @@ public: */ virtual void setView(CViewItem *item) = 0; - virtual void proc4(const Common::Rect &bounds) = 0; + virtual void draw(const Common::Rect &bounds) = 0; /** * Creates a surface from a specified resource @@ -76,7 +76,10 @@ public: */ virtual void setView(CViewItem *item); - virtual void proc4(const Common::Rect &bounds); + /** + * Handles drawing the view + */ + virtual void draw(const Common::Rect &bounds); }; } // End of namespace Titanic diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 5d50c00377..c710374d05 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -53,7 +53,7 @@ void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { if (_gameManager->_gameState._mode == GSMODE_1) { processMessage(&msg); } else if (!msg.isMouseMsg()) { - g_vm->_filesManager.fn1(); + g_vm->_filesManager.loadDrive(); } } } diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 2c148c8c2e..6a6a46ea65 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -55,7 +55,6 @@ void CMainGameWindow::applicationStarting() { // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); screenManager->setMode(640, 480, 16, 1, true); - _inputAllowed = true; // TODO: Remove initial background and palette @@ -67,6 +66,8 @@ void CMainGameWindow::applicationStarting() { // Load either a new game or selected existing save _project->loadGame(saveSlot); + _inputAllowed = true; + _gameManager->_gameState.setMode(GSMODE_1); // TODO: Cursor/image @@ -109,7 +110,7 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) { } } -void CMainGameWindow::fn2() { +void CMainGameWindow::draw() { if (_gameManager) { if (_gameView->_surface) { CViewItem *view = _gameManager->getView(); @@ -128,7 +129,7 @@ void CMainGameWindow::fn2() { warning("TODO: Stuff"); case GSMODE_5: - g_vm->_filesManager.fn1(); + g_vm->_filesManager.debug(scrManager); break; default: diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 6a72dbf45e..8f6fb81228 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -74,7 +74,10 @@ public: */ void setActiveView(CViewItem *viewItem); - void fn2(); + /** + * Main draw method for the window + */ + void draw(); /** * Called by the event handler when a mouse event has been generated diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 59a322e919..fe15d9aec0 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -51,7 +51,7 @@ void CScreenManager::setWindowHandle(int v) { } bool CScreenManager::resetWindowHandle(int v) { - proc27(); + hideCursor(); return true; } @@ -79,6 +79,8 @@ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), OSScreenManager::~OSScreenManager() { destroyFrontAndBackBuffers(); + delete _mouseCursor; + delete _textCursor; } void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { @@ -152,8 +154,14 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) { void OSScreenManager::proc23() {} void OSScreenManager::proc24() {} void OSScreenManager::proc25() {} -void OSScreenManager::showCursor() {} -void OSScreenManager::proc27() {} + +void OSScreenManager::showCursor() { + +} + +void OSScreenManager::hideCursor() { + +} void OSScreenManager::destroyFrontAndBackBuffers() { delete _frontRenderSurface; @@ -165,7 +173,16 @@ void OSScreenManager::destroyFrontAndBackBuffers() { } void OSScreenManager::loadCursors() { - // TODO + if (_mouseCursor) { + hideCursor(); + delete _mouseCursor; + } + _mouseCursor = new CMouseCursor(); + showCursor(); + + if (!_textCursor) { + _textCursor = new CTextCursor(); + } } } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index a8b7ee4bd6..a5fa562bc8 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -108,7 +108,7 @@ public: virtual void proc24() = 0; virtual void proc25() = 0; virtual void showCursor() = 0; - virtual void proc27() = 0; + virtual void hideCursor() = 0; void setSurfaceBounds(int surfaceNum, const Common::Rect &r); }; @@ -177,7 +177,7 @@ public: virtual void proc24(); virtual void proc25(); virtual void showCursor(); - virtual void proc27(); + virtual void hideCursor(); }; } // End of namespace Titanic |