diff options
author | Paul Gilbert | 2018-04-07 15:41:16 -0400 |
---|---|---|
committer | Paul Gilbert | 2018-04-07 15:41:16 -0400 |
commit | 569833b4ca80116efaab15e47d0097b5c62ecb6c (patch) | |
tree | ff9d27f7628cd03fb7aa02e47f2ec121228d3e8a /engines | |
parent | 25eeee8e508d81f1f9d2d063dc7fcc59c7355267 (diff) | |
download | scummvm-rg350-569833b4ca80116efaab15e47d0097b5c62ecb6c.tar.gz scummvm-rg350-569833b4ca80116efaab15e47d0097b5c62ecb6c.tar.bz2 scummvm-rg350-569833b4ca80116efaab15e47d0097b5c62ecb6c.zip |
XEEN: Reset combat data when loading a new savegame
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/combat.cpp | 7 | ||||
-rw-r--r-- | engines/xeen/combat.h | 5 | ||||
-rw-r--r-- | engines/xeen/saves.cpp | 8 |
3 files changed, 20 insertions, 0 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 2293dcd612..71ad6303a8 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -2095,4 +2095,11 @@ bool Combat::areMonstersPresent() const { return false; } +void Combat::reset() { + clearShooting(); + setupCombatParty(); + + _combatMode = COMBATMODE_STARTUP; +} + } // End of namespace Xeen diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h index c3fa987fb1..e55c8b7553 100644 --- a/engines/xeen/combat.h +++ b/engines/xeen/combat.h @@ -205,6 +205,11 @@ public: void clearShooting(); /** + * Resets all combat related data + */ + void reset(); + + /** * Gives damage to character or characters in the party */ void giveCharDamage(int damage, DamageType attackType, int charIndex); diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 2f290960d3..4aee1a6a34 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -152,6 +152,7 @@ Common::Error SavesManager::saveGameState(int slot, const Common::String &desc) } Common::Error SavesManager::loadGameState(int slot) { + Combat &combat = *g_vm->_combat; EventsManager &events = *g_vm->_events; FileManager &files = *g_vm->_files; Map &map = *g_vm->_map; @@ -187,6 +188,9 @@ Common::Error SavesManager::loadGameState(int slot) { // Read in miscellaneous files.load(*saveFile); + // Reset any combat information from the previous game + combat.reset(); + // Load the new map map.clearMaze(); map._loadCcNum = files._ccNum; @@ -206,6 +210,10 @@ void SavesManager::newGame() { File::_xeenSave = nullptr; File::_darkSave = nullptr; + // Reset any combat information from the previous game + g_vm->_combat->reset(); + + // Reset the game states if (g_vm->getGameID() != GType_Clouds) { File::_darkSave = new SaveArchive(g_vm->_party); File::_darkSave->reset(File::_darkCc); |