aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
authorPaul Gilbert2018-01-16 22:42:14 -0500
committerPaul Gilbert2018-01-16 22:42:14 -0500
commit2410da08f793b711252e4cffdc2df5334b644658 (patch)
treed07693721d263e348b517c06831778618f42d813 /engines/xeen
parent9518fd7210a371ded3a482acbcb34777fd6dd51c (diff)
downloadscummvm-rg350-2410da08f793b711252e4cffdc2df5334b644658.tar.gz
scummvm-rg350-2410da08f793b711252e4cffdc2df5334b644658.tar.bz2
scummvm-rg350-2410da08f793b711252e4cffdc2df5334b644658.zip
XEEN: Add spells debugger command to give party all the spells
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/character.cpp2
-rw-r--r--engines/xeen/character.h2
-rw-r--r--engines/xeen/debugger.cpp14
-rw-r--r--engines/xeen/debugger.h31
-rw-r--r--engines/xeen/dialogs_party.cpp2
-rw-r--r--engines/xeen/dialogs_spells.cpp2
-rw-r--r--engines/xeen/party.cpp4
7 files changed, 51 insertions, 6 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 7372c87917..e95bf6d4c8 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 54e8d1a37c..2db5734909 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 68d2c0cbd4..24cb947ef4 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 5916419ce8..6841d606e1 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 64f57d62e8..226776c7d3 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 bdd4940146..ab0347e869 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 90f913dbf9..346011838c 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;
}