[Scummvm-git-logs] scummvm master -> 45ea120eb794b28e01f4996dc4c418996667fab7
dreammaster
noreply at scummvm.org
Tue Sep 3 02:51:13 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:
45ea120eb7 MM: MM1: Fix setting spell sp/gem requirements
Commit: 45ea120eb794b28e01f4996dc4c418996667fab7
https://github.com/scummvm/scummvm/commit/45ea120eb794b28e01f4996dc4c418996667fab7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-09-02T19:51:07-07:00
Commit Message:
MM: MM1: Fix setting spell sp/gem requirements
Changed paths:
NEWS.md
engines/mm/mm1/game/spell_casting.cpp
diff --git a/NEWS.md b/NEWS.md
index 78667712b36..c2954530f0c 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -40,6 +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
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 bfa59661af3..0d1f29dbaad 100644
--- a/engines/mm/mm1/game/spell_casting.cpp
+++ b/engines/mm/mm1/game/spell_casting.cpp
@@ -106,21 +106,19 @@ void SpellCasting::setSpell(const Character *chr, int lvl, int num) {
// Figure the offset in the spell list
int spellIndex = getSpellIndex(chr, lvl, num);
- // Get required SP
- int requiredSp = lvl - 1;
+ // The required SP matches the spell level
+ int requiredSp = lvl;
if (SPELLS_SP_GEMS[spellIndex] < 0)
// required SP increases with character's level
requiredSp = chr->_level;
- if (!chr->_sp._current) {
- if (SPELLS_SP_GEMS[spellIndex] < 0 && chr->_sp._current < chr->_level._current)
- _spellState = SS_NOT_ENOUGH_SP;
- else if ((lvl - 1) > chr->_sp._current)
- _spellState = SS_NOT_ENOUGH_SP;
- }
+ if (SPELLS_SP_GEMS[spellIndex] < 0 && chr->_sp._current < chr->_level._current)
+ _spellState = SS_NOT_ENOUGH_SP;
+ else if ((lvl - 1) > chr->_sp._current)
+ _spellState = SS_NOT_ENOUGH_SP;
- int requiredGems = (uint8)SPELLS_SP_GEMS[spellIndex] & 0x7f;
+ int requiredGems = ABS(SPELLS_SP_GEMS[spellIndex]);
if (_spellState == SS_OK)
setSpell(spellIndex, requiredSp, requiredGems);
More information about the Scummvm-git-logs
mailing list