[Scummvm-git-logs] scummvm master -> ca769bc3755ec5999690fef74290b4d82f098791

dreammaster noreply at scummvm.org
Mon Feb 6 06:19:09 UTC 2023


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:
ca769bc375 MM: MM1: Debugger command to allow all spells in combat


Commit: ca769bc3755ec5999690fef74290b4d82f098791
    https://github.com/scummvm/scummvm/commit/ca769bc3755ec5999690fef74290b4d82f098791
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T22:18:55-08:00

Commit Message:
MM: MM1: Debugger command to allow all spells in combat

Changed paths:
    engines/mm/mm1/console.cpp
    engines/mm/mm1/console.h
    engines/mm/mm1/game/spell_casting.cpp
    engines/mm/mm1/globals.h
    engines/mm/mm1/views/spells/cast_spell.cpp


diff --git a/engines/mm/mm1/console.cpp b/engines/mm/mm1/console.cpp
index 52b50462905..5b2578ac5f6 100644
--- a/engines/mm/mm1/console.cpp
+++ b/engines/mm/mm1/console.cpp
@@ -40,6 +40,7 @@ Console::Console() : GUI::Debugger() {
 	registerCmd("pos", WRAP_METHOD(Console, cmdPos));
 	registerCmd("intangible", WRAP_METHOD(Console, cmdIntangible));
 	registerCmd("cast", WRAP_METHOD(Console, cmdCast));
+	registerCmd("spells", WRAP_METHOD(Console, cmdSpellsAll));
 	registerCmd("encounter", WRAP_METHOD(Console, cmdEncounter));
 	registerCmd("encounters", WRAP_METHOD(Console, cmdEncounters));
 	registerCmd("specials", WRAP_METHOD(Console, cmdSpecials));
@@ -326,6 +327,13 @@ bool Console::cmdCast(int argc, const char **argv) {
 	}
 }
 
+bool Console::cmdSpellsAll(int argc, const char **argv) {
+	g_globals->_allSpells = (argc == 2) && !strcmp(argv[1], "on");
+	debugPrintf("All spells is %s\n",
+		g_globals->_allSpells ? "enabled" : "disabled");
+	return true;
+}
+
 bool Console::cmdEncounter(int argc, const char **argv) {
 	if (argc < 2) {
 		debugPrintf("encounter <monster-num> [<level>, <# monsters>, <encounter type>]\n");
diff --git a/engines/mm/mm1/console.h b/engines/mm/mm1/console.h
index 625e3d3f407..74b4040d9fc 100644
--- a/engines/mm/mm1/console.h
+++ b/engines/mm/mm1/console.h
@@ -70,6 +70,11 @@ protected:
 	 */
 	bool cmdCast(int argc, const char **argv);
 
+	/**
+	 * Enables/disables casting any spell
+	 */
+	bool cmdSpellsAll(int argc, const char **argv);
+
 	/**
 	 * Trigger an encounter
 	 */
diff --git a/engines/mm/mm1/game/spell_casting.cpp b/engines/mm/mm1/game/spell_casting.cpp
index 7d62de16ac2..2aeb3bce7bc 100644
--- a/engines/mm/mm1/game/spell_casting.cpp
+++ b/engines/mm/mm1/game/spell_casting.cpp
@@ -107,6 +107,13 @@ void SpellCasting::setSpell(Character *chr, int lvl, int num) {
 	int requiredGems = (uint8)SPELLS_SP_GEMS[spellIndex] & 0x7f;
 	if (_spellState == SS_OK)
 		setSpell(spellIndex, requiredSp, requiredGems);
+
+	// Supporting debugger command that enables all spells
+	if (g_globals->_allSpells && _spellState != SS_COMBAT_ONLY &&
+			_spellState != SS_NONCOMBAT_ONLY && _spellState != SS_OUTDOORS_ONLY) {
+		_requiredSp = _requiredGems = 0;
+		_spellState = SS_OK;
+	}
 }
 
 void SpellCasting::setSpell(int spellIndex, int requiredSp, int requiredGems) {
diff --git a/engines/mm/mm1/globals.h b/engines/mm/mm1/globals.h
index 99b65a5241d..c267f0b86f0 100644
--- a/engines/mm/mm1/globals.h
+++ b/engines/mm/mm1/globals.h
@@ -62,6 +62,7 @@ public:
 	// Console flags
 	bool _intangible = false;
 	bool _encountersOn = true;
+	bool _allSpells = false;
 
 public:
 	// Enhanced mode globals
diff --git a/engines/mm/mm1/views/spells/cast_spell.cpp b/engines/mm/mm1/views/spells/cast_spell.cpp
index 46e184ba325..bfed318fb8a 100644
--- a/engines/mm/mm1/views/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views/spells/cast_spell.cpp
@@ -132,7 +132,7 @@ void CastSpell::draw() {
 void CastSpell::spellLevelEntered(uint level) {
 	// Ensure the spell level is valid
 	if (level < 1 || level > 7 ||
-		level > g_globals->_currCharacter->_spellLevel) {
+		(!g_globals->_allSpells && level > g_globals->_currCharacter->_spellLevel)) {
 		close();
 		return;
 	}




More information about the Scummvm-git-logs mailing list