[Scummvm-git-logs] scummvm master -> 2410da08f793b711252e4cffdc2df5334b644658

dreammaster dreammaster at scummvm.org
Wed Jan 17 04:42:21 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2410da08f7 XEEN: Add spells debugger command to give party all the spells


Commit: 2410da08f793b711252e4cffdc2df5334b644658
    https://github.com/scummvm/scummvm/commit/2410da08f793b711252e4cffdc2df5334b644658
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-16T22:42:14-05:00

Commit Message:
XEEN: Add spells debugger command to give party all the spells

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/character.h
    engines/xeen/debugger.cpp
    engines/xeen/debugger.h
    engines/xeen/dialogs_party.cpp
    engines/xeen/dialogs_spells.cpp
    engines/xeen/party.cpp


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 7372c87..e95bf6d 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -702,7 +702,7 @@ void Character::clear() {
 	_tempAge = 0;
 	Common::fill(&_skills[0], &_skills[18], 0);
 	Common::fill(&_awards[0], &_awards[128], 0);
-	Common::fill(&_spells[0], &_spells[39], 0);
+	Common::fill(&_spells[0], &_spells[39], false);
 	_lloydMap = 0;
 	_hasSpells = false;
 	_currentSpell = 0;
diff --git a/engines/xeen/character.h b/engines/xeen/character.h
index 54e8d1a..2db5734 100644
--- a/engines/xeen/character.h
+++ b/engines/xeen/character.h
@@ -334,7 +334,7 @@ public:
 	int _tempAge;
 	int _skills[18];
 	int _awards[128];
-	int _spells[MAX_SPELLS_PER_CLASS];
+	bool _spells[MAX_SPELLS_PER_CLASS];
 	int _lloydMap;
 	Common::Point _lloydPosition;
 	bool _hasSpells;
diff --git a/engines/xeen/debugger.cpp b/engines/xeen/debugger.cpp
index 68d2c0c..24cb947 100644
--- a/engines/xeen/debugger.cpp
+++ b/engines/xeen/debugger.cpp
@@ -47,6 +47,7 @@ static int strToInt(const char *s) {
 Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm) {
 	registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
 	registerCmd("spell", WRAP_METHOD(Debugger, cmdSpell));
+	registerCmd("spells", WRAP_METHOD(Debugger, cmdSpells));
 	registerCmd("dump", WRAP_METHOD(Debugger, cmdDump));
 	registerCmd("gold", WRAP_METHOD(Debugger, cmdGold));
 	registerCmd("gems", WRAP_METHOD(Debugger, cmdGems));
@@ -87,6 +88,19 @@ bool Debugger::cmdSpell(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::cmdSpells(int argc, const char **argv) {
+	Party &party = *_vm->_party;
+
+	for (uint charIdx = 0; charIdx < party._activeParty.size(); ++charIdx) {
+		Character &c = party._activeParty[charIdx];
+		Common::fill(c._spells, c._spells + MAX_SPELLS_PER_CLASS, true);
+		c._currentSp = 500;
+	}
+
+	party._gems += 500;
+	return false;
+}
+
 bool Debugger::cmdDump(int argc, const char **argv) {
 	File f;
 
diff --git a/engines/xeen/debugger.h b/engines/xeen/debugger.h
index 5916419..6841d60 100644
--- a/engines/xeen/debugger.h
+++ b/engines/xeen/debugger.h
@@ -35,15 +35,46 @@ private:
 	XeenEngine *_vm;
 	int _spellId;
 
+	/**
+	 * Casts a spell
+	 */
 	bool cmdSpell(int argc, const char **argv);
+
+	/**
+	 * Gives all the characters a full spellbook
+	 */
+	bool cmdSpells(int argc, const char **argv);
+
+	/**
+	 * Dumps a resource to a file
+	 */
 	bool cmdDump(int argc, const char **argv);
+
+	/**
+	 * Gives gold to the party or bank
+	 */
 	bool cmdGold(int argc, const char **argv);
+
+	/**
+	 * Gives gems to the party or bank
+	 */
 	bool cmdGems(int argc, const char **argv);
+
+	/**
+	 * Jumps to a given map, and optionally a given position
+	 */
 	bool cmdMap(int argc, const char **argv);
+
+	/**
+	 * Changes the party's position in the current map
+	 */
 	bool cmdPos(int argc, const char **argv);
 public:
 	Debugger(XeenEngine *vm);
 
+	/**
+	 * Updates the debugger window if active
+	 */
 	void update();
 };
 
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index 64f57d6..226776c 100644
--- a/engines/xeen/dialogs_party.cpp
+++ b/engines/xeen/dialogs_party.cpp
@@ -1031,7 +1031,7 @@ bool PartyDialog::saveCharacter(Character &c, int classId,
 		if (Res.NEW_CHARACTER_SPELLS[c._class][idx] != -1) {
 			c._hasSpells = true;
 			c._currentSpell = Res.NEW_CHARACTER_SPELLS[c._class][idx];
-			c._spells[c._currentSpell] = 1;
+			c._spells[c._currentSpell] = true;
 		}
 	}
 
diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp
index bdd4940..ab0347e 100644
--- a/engines/xeen/dialogs_spells.cpp
+++ b/engines/xeen/dialogs_spells.cpp
@@ -237,7 +237,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
 
 					if (Confirm::show(_vm, msg, castingCopy + 1)) {
 						if (party.subtract(CONS_GOLD, spellCost, WHERE_PARTY, WT_FREEZE_WAIT)) {
-							++c->_spells[spellIndex];
+							c->_spells[spellIndex] = true;
 							sound.stopSound();
 							intf._overallFrame = 0;
 							sound.playSound(isDarkCc ? "guild12.voc" : "parrot2.voc", 1);
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 90f913d..3460118 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -817,7 +817,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
 
 		for (int idx = 0; idx < 39; ++idx) {
 			if (Res.SPELLS_ALLOWED[idx2][idx] == takeVal) {
-				ps._spells[idx] = 0;
+				ps._spells[idx] = false;
 				break;
 			}
 		}
@@ -1086,7 +1086,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
 
 		for (int idx = 0; idx < 39; ++idx) {
 			if (Res.SPELLS_ALLOWED[idx2][idx] == giveVal) {
-				ps._spells[idx] = 1;
+				ps._spells[idx] = true;
 				intf.spellFX(&ps);
 				break;
 			}





More information about the Scummvm-git-logs mailing list