[Scummvm-git-logs] scummvm master -> 409b5809ba3dceffd54bf6729108220f149481f3

dreammaster noreply at scummvm.org
Tue Sep 3 03:10:21 UTC 2024


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:
409b5809ba MM: MM1: Actually deduct SP when casting spells in enhanced mode


Commit: 409b5809ba3dceffd54bf6729108220f149481f3
    https://github.com/scummvm/scummvm/commit/409b5809ba3dceffd54bf6729108220f149481f3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-09-02T20:10:16-07:00

Commit Message:
MM: MM1: Actually deduct SP when casting spells in enhanced mode

Changed paths:
    NEWS.md
    engines/mm/mm1/game/spell_casting.cpp
    engines/mm/mm1/views/spells/cast_spell.cpp
    engines/mm/mm1/views_enh/spells/cast_spell.cpp


diff --git a/NEWS.md b/NEWS.md
index c2954530f0c..f162fc8aa40 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -40,7 +40,7 @@ For a more comprehensive changelog of the latest experimental code, see:
  MM:
    - Added MT32/LAPC-1 support for Xeen engine.
    - Fixed Xeen regression which caused some sound effects to stop abruptly.
-   - Fixed spell SP/gem requirements
+   - Fixed spell SP/gem requirements in MM1 enhanced mode, and actually remove spell points & gems when spells are cast.
 
  SCI:
    - Added support for Russian fan-translation of QFG3.
diff --git a/engines/mm/mm1/game/spell_casting.cpp b/engines/mm/mm1/game/spell_casting.cpp
index 0d1f29dbaad..b4d1d43e56d 100644
--- a/engines/mm/mm1/game/spell_casting.cpp
+++ b/engines/mm/mm1/game/spell_casting.cpp
@@ -115,7 +115,7 @@ void SpellCasting::setSpell(const Character *chr, int lvl, int num) {
 
 	if (SPELLS_SP_GEMS[spellIndex] < 0 && chr->_sp._current < chr->_level._current)
 		_spellState = SS_NOT_ENOUGH_SP;
-	else if ((lvl - 1) > chr->_sp._current)
+	else if (requiredSp > chr->_sp._current)
 		_spellState = SS_NOT_ENOUGH_SP;
 
 	int requiredGems = ABS(SPELLS_SP_GEMS[spellIndex]);
diff --git a/engines/mm/mm1/views/spells/cast_spell.cpp b/engines/mm/mm1/views/spells/cast_spell.cpp
index 93ec6848f63..b64c8d6dc61 100644
--- a/engines/mm/mm1/views/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views/spells/cast_spell.cpp
@@ -206,8 +206,8 @@ void CastSpell::timeout() {
 
 void CastSpell::performSpell(Character *chr) {
 	Character &c = *g_globals->_currCharacter;
-	c._sp._current = MAX(c._sp._current - _requiredSp, 0);
-	c._gems = MAX(c._gems - _requiredGems, 0);
+	c._sp._current = MAX((int)c._sp._current - _requiredSp, 0);
+	c._gems = MAX((int)c._gems - _requiredGems, 0);
 
 	if (!isMagicAllowed()) {
 		spellDone(STRING["spells.magic_doesnt_work"], 5);
diff --git a/engines/mm/mm1/views_enh/spells/cast_spell.cpp b/engines/mm/mm1/views_enh/spells/cast_spell.cpp
index b46fb79be4c..18d23fe97dd 100644
--- a/engines/mm/mm1/views_enh/spells/cast_spell.cpp
+++ b/engines/mm/mm1/views_enh/spells/cast_spell.cpp
@@ -172,6 +172,10 @@ void CastSpell::castSpell(Character *target) {
 	if (_spellIndex == -1)
 		return;
 
+	Character &c = *g_globals->_currCharacter;
+	c._sp._current = MAX((int)c._sp._current - _requiredSp, 0);
+	c._gems = MAX((int)c._gems - _requiredGems, 0);
+
 	if (!isMagicAllowed()) {
 		g_events->send(InfoMessage(STRING["spells.magic_doesnt_work"]));
 




More information about the Scummvm-git-logs mailing list