From af43070e150452c7876a6bc949c7ad36ae761508 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 3 Jul 2019 15:15:42 +0200 Subject: HDB: Implemented HDBGame::startMap() --- engines/hdb/hdb.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ engines/hdb/hdb.h | 10 ++++++++++ 2 files changed, 52 insertions(+) diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index d4db1cf536..6e19f1e389 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -52,6 +52,8 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst _window = new Window; _rnd = new Common::RandomSource("hdb"); + _currentMapname[0] = _currentLuaName[0] = 0; + DebugMan.addDebugChannel(kDebugExample1, "Example1", "This is just an example to test"); DebugMan.addDebugChannel(kDebugExample2, "Example2", "This is also an example"); } @@ -145,6 +147,40 @@ void HDBGame::changeGameState() { } } +bool HDBGame::restartMap() { + if (!_currentMapname[0]) + return false; + + warning("STUB: HDBGame::restartMap()"); + + return true; +} + +bool HDBGame::startMap(char *name) { + // save last mapname + strcpy(_lastMapname, _currentMapname); + + // set current mapname + strcpy(_currentMapname, name); + strcat(_currentMapname, ".MSM"); + + // set current luaname + strcpy(_currentLuaName, name ); + strcat(_currentLuaName, ".LUA"); + + restartMap(); + + // + // here is where we will be autosaving the start of level + // don't save cine intro/outro/etc...OR map30 (secret star map) + // + if (!scumm_strnicmp(name, "map", 3) && scumm_stricmp(name, "map30")) { + //_menu->fillSavegameSlots(); + saveSlot(0); // we ignore the slot parameter in everything else since we just keep saving... + } + return true; +} + void HDBGame::paint() { switch (_gameState) { case GAME_TITLE: @@ -322,6 +358,12 @@ void HDBGame::setTargetXY(int x, int y) { } } +bool HDBGame::saveSlot(int slot) { + warning("STUB: HDBGame::saveSlot(%d)", slot); + + return true; +} + // PLAYER is trying to use this entity void HDBGame::useEntity(AIEntity *e) { warning("STUB: HDBGame::useEntity incomplete"); diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index 62c266e442..53ac40fe5a 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -147,6 +147,12 @@ public: bool init(); void start(); + + bool restartMap(); + bool startMap(char *name); + + bool saveSlot(int slot); + void setGameState(GameState gs) { _gameState = gs; } @@ -209,8 +215,12 @@ private: int _actionMode; // 0 or 1 int _pauseFlag; + char _currentMapname[64]; char _lastMapname[64]; + char _currentLuaName[64]; + char _lastLuaName[64]; + }; extern HDBGame *g_hdb; -- cgit v1.2.3