diff options
author | Eugene Sandulenko | 2019-07-03 17:01:00 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:09 +0200 |
commit | 74eb242b5a0606a274b38e1fdc12b9b8fb908368 (patch) | |
tree | 6a25512ffa51b285c182016f97199721f877bb81 | |
parent | 34a3e1685bef4b57f10d4acdbf568a217315fa32 (diff) | |
download | scummvm-rg350-74eb242b5a0606a274b38e1fdc12b9b8fb908368.tar.gz scummvm-rg350-74eb242b5a0606a274b38e1fdc12b9b8fb908368.tar.bz2 scummvm-rg350-74eb242b5a0606a274b38e1fdc12b9b8fb908368.zip |
HDB: Unstub HDBGame::restartMap()
-rw-r--r-- | engines/hdb/gfx.cpp | 8 | ||||
-rw-r--r-- | engines/hdb/gfx.h | 14 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 39 | ||||
-rw-r--r-- | engines/hdb/hdb.h | 15 | ||||
-rw-r--r-- | engines/hdb/lua-script.cpp | 14 | ||||
-rw-r--r-- | engines/hdb/lua-script.h | 4 | ||||
-rw-r--r-- | engines/hdb/map.cpp | 10 | ||||
-rw-r--r-- | engines/hdb/map.h | 3 | ||||
-rw-r--r-- | engines/hdb/menu.cpp | 3 | ||||
-rw-r--r-- | engines/hdb/menu.h | 9 | ||||
-rw-r--r-- | engines/hdb/sound.cpp | 4 | ||||
-rw-r--r-- | engines/hdb/sound.h | 2 |
12 files changed, 124 insertions, 1 deletions
diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index 3dfe6445fd..bf9c43e8af 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -233,6 +233,10 @@ Tile *Gfx::getTile(int index) { return _tLookupArray[index].tData; } +void Gfx::emptyGfxCaches() { + warning("STUB: mptyGfxCaches()"); +} + void Gfx::cacheTileSequence(int tileIndex, int count) { for (int i = tileIndex; i < tileIndex + count; i++) getTile(i); @@ -462,6 +466,10 @@ void Gfx::drawSky() { } } +void Gfx::drawSnow() { + debug(9, "STUB: Gfx::drawSnow()"); +} + int Gfx::animateTile(int tileIndex) { return _tLookupArray[tileIndex].animIndex; } diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h index d369edc040..fb26fe4e04 100644 --- a/engines/hdb/gfx.h +++ b/engines/hdb/gfx.h @@ -107,6 +107,7 @@ public: bool isFadeActive() { return _fadeInfo.active; } bool isFadeStaying() { return _fadeInfo.stayFaded; } void turnOffFade() { _fadeInfo.active = _fadeInfo.stayFaded = false; } + void turnOffSnow() { _snowInfo.active = false; } Picture *loadPic(const char *picName); Tile *loadTile(const char *tileName); @@ -116,6 +117,8 @@ public: int getTileIndex(const char *name); Picture *getPicture(const char *name); + void emptyGfxCaches(); + // Returns: true->Tile, false->Pic bool selectGfxType(const char *name); Tile *getTileGfx(const char *name, uint32 size); @@ -128,6 +131,7 @@ public: void draw3DStars(); void draw3DStarsLeft(); void drawSky(); + void drawSnow(); int animateTile(int tileIndex); @@ -162,6 +166,16 @@ private: int curStep; } _fadeInfo; +#define MAX_SNOW 50 // how many snowflakes onscreen +#define MAX_SNOW_XV 12 + struct { + bool active; + double x[MAX_SNOW]; + double y[MAX_SNOW]; + double yv[MAX_SNOW]; + int xvindex[MAX_SNOW]; + } _snowInfo; + struct { int x, y, speed; uint16 color; diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 0d10b506d9..fdbacecb2f 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -56,6 +56,10 @@ HDBGame::HDBGame(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst _currentMapname[0] = _currentLuaName[0] = 0; + _monkeystone7 = STARS_MONKEYSTONE_7_FAKE; + _monkeystone14 = STARS_MONKEYSTONE_14_FAKE; + _monkeystone21 = STARS_MONKEYSTONE_21_FAKE; + DebugMan.addDebugChannel(kDebugExample1, "Example1", "This is just an example to test"); DebugMan.addDebugChannel(kDebugExample2, "Example2", "This is also an example"); } @@ -153,7 +157,40 @@ bool HDBGame::restartMap() { if (!_currentMapname[0]) return false; - warning("STUB: HDBGame::restartMap()"); + _gfx->emptyGfxCaches(); + _lua->callFunction("level_shutdown", 0); + + _gfx->turnOffSnow(); + _window->restartSystem(); + _ai->restartSystem(); + _lua->init(); + _lua->loadLua(_currentLuaName); + + _sound->markSoundCacheFreeable(); + _map->restartSystem(); + + if (!_map->loadMap(_currentMapname)) + return false; + + _ai->initAnimInfo(); + + // if there are Secret Stars here, stick the variable in Lua + if (!_menu->_starWarp && getStarsMonkeystone7() == STARS_MONKEYSTONE_7) + _lua->setLuaGlobalValue("secretstars", 1); + if (_menu->_starWarp == 1 && getStarsMonkeystone14() == STARS_MONKEYSTONE_14) + _lua->setLuaGlobalValue("secretstars", 2); + if (_menu->_starWarp == 2 && getStarsMonkeystone21() == STARS_MONKEYSTONE_21) + _lua->setLuaGlobalValue("secretstars", 3); + + _lua->callFunction("level_loaded", 0); + if (!_ai->cinematicsActive()) + _gfx->turnOffFade(); + + // center the player on the screen + int x, y; + + _ai->getPlayerXY(&x, &y); + _map->centerMapXY(x + 16, y + 16); return true; } diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h index b9247db0e6..573f9534fb 100644 --- a/engines/hdb/hdb.h +++ b/engines/hdb/hdb.h @@ -200,6 +200,17 @@ public: char *lastMapname() { return _lastMapname; } + // + // monkeystone secret stars + // + int32 getStarsMonkeystone7() { return _monkeystone7; } + int32 getStarsMonkeystone14() { return _monkeystone14; } + int32 getStarsMonkeystone21() { return _monkeystone21; } + + void setStarsMonkeystone7(int32 value) { _monkeystone7 = value; } + void setStarsMonkeystone14(int32 value) { _monkeystone14 = value; } + void setStarsMonkeystone21(int32 value) { _monkeystone21 = value; } + bool _gameShutdown; Graphics::PixelFormat _format; @@ -224,6 +235,10 @@ private: char _currentLuaName[64]; char _lastLuaName[64]; + int32 _monkeystone7; + int32 _monkeystone14; + int32 _monkeystone21; + }; extern HDBGame *g_hdb; diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp index 8e7083b653..eaf46abe85 100644 --- a/engines/hdb/lua-script.cpp +++ b/engines/hdb/lua-script.cpp @@ -72,6 +72,20 @@ bool LuaScript::init() { return true; } +bool LuaScript::loadLua(char *name) { + warning("STUB: loadLua(%s)", name); + + return true; +} + +void LuaScript::setLuaGlobalValue(const char *name, int value) { + if (!_state) + return; + + lua_pushnumber(_state, value); + lua_setglobal(_state, name); +} + /* Called from Lua, this will pop into the menu */ diff --git a/engines/hdb/lua-script.h b/engines/hdb/lua-script.h index 5cab8cb17b..4679d2ca82 100644 --- a/engines/hdb/lua-script.h +++ b/engines/hdb/lua-script.h @@ -42,6 +42,8 @@ public: LuaScript(); ~LuaScript(); + bool loadLua(char *name); + bool init(); bool initScript(Common::SeekableReadStream *stream, const char *scriptName, int32 length); @@ -58,6 +60,8 @@ public: const char *getStringOffStack(); + void setLuaGlobalValue(const char *name, int value); + private: lua_State *_state; int _pcallErrorhandlerRegistryIndex; diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp index ccad3b4130..c34104c5a1 100644 --- a/engines/hdb/map.cpp +++ b/engines/hdb/map.cpp @@ -68,6 +68,16 @@ int Map::loadTiles() { return skyIndex; } +void Map::restartSystem() { + warning("STUB: Map::restartSystem()"); +} + +bool Map::loadMap(char *name) { + warning("STUB: loadMap(%s)", name); + + return true; +} + bool Map::load(Common::SeekableReadStream *stream) { if (_mapLoaded) { return false; diff --git a/engines/hdb/map.h b/engines/hdb/map.h index fcbd82ea06..3360e91ec8 100644 --- a/engines/hdb/map.h +++ b/engines/hdb/map.h @@ -74,8 +74,11 @@ public: Map(); ~Map(); + void restartSystem(); + int loadTiles(); bool load(Common::SeekableReadStream *stream); + bool loadMap(char *name); void draw(); void drawEnts(); void drawGratings(); diff --git a/engines/hdb/menu.cpp b/engines/hdb/menu.cpp index a707e847ea..73c0eac8fc 100644 --- a/engines/hdb/menu.cpp +++ b/engines/hdb/menu.cpp @@ -26,7 +26,10 @@ namespace HDB { bool Menu::init() { + _starWarp = 0; + warning("STUB: Menu::init()"); + return true; } diff --git a/engines/hdb/menu.h b/engines/hdb/menu.h index cd23b970bd..73e5a80a30 100644 --- a/engines/hdb/menu.h +++ b/engines/hdb/menu.h @@ -25,12 +25,21 @@ namespace HDB { +#define STARS_MONKEYSTONE_7 0xfe257d // magic value in the config file for the unlocking of the Monkeystone secret #7 +#define STARS_MONKEYSTONE_7_FAKE 0x11887e // fake value that means it hasn't been unlocked +#define STARS_MONKEYSTONE_14 0x3341fe // <same> for the Monkeystone #14 +#define STARS_MONKEYSTONE_14_FAKE 0x1cefd0 // fake value that means it hasn't been unlocked +#define STARS_MONKEYSTONE_21 0x77ace3 // <same> for the Monkeystone #21 +#define STARS_MONKEYSTONE_21_FAKE 0x3548fe // fake value that means it hasn't been unlocked + class Menu { public: bool init(); void fillSavegameSlots(); + + int _starWarp; }; } // End of Namespace diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp index 4d39febbb3..e37a6daccd 100644 --- a/engines/hdb/sound.cpp +++ b/engines/hdb/sound.cpp @@ -39,4 +39,8 @@ bool Sound::playVoice(int index, int actor) { return true; } +void Sound::markSoundCacheFreeable() { + warning("STUB: Sound::markSoundCacheFreeable() "); +} + } // End of Namespace diff --git a/engines/hdb/sound.h b/engines/hdb/sound.h index 1493ad234d..f268309d0b 100644 --- a/engines/hdb/sound.h +++ b/engines/hdb/sound.h @@ -1383,6 +1383,8 @@ public: bool playSound(int index); bool playVoice(int index, int actor); + + void markSoundCacheFreeable(); }; } // End of Namespace |