aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/combat.cpp7
-rw-r--r--engines/xeen/combat.h5
-rw-r--r--engines/xeen/saves.cpp8
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);