[Scummvm-git-logs] scummvm master -> 2dca8d872888e494c129cde604b966feaa6244e9
dreammaster
noreply at scummvm.org
Sun Feb 5 19:34:14 UTC 2023
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8ae35291f1 MM: MM1: Fix calculating damage when monster attacks
ed1a0cbd05 MM: MM1: Renaming of character HP fields
f71236806e MM: MM1: Cleaned up calculating char defense adjusts damage
2dca8d8728 MM: MM1: Fix indexing of attack type messages
Commit: 8ae35291f164dee916b45d0ce3783bc32d6243ad
https://github.com/scummvm/scummvm/commit/8ae35291f164dee916b45d0ce3783bc32d6243ad
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T11:19:38-08:00
Commit Message:
MM: MM1: Fix calculating damage when monster attacks
Changed paths:
engines/mm/mm1/game/combat.cpp
diff --git a/engines/mm/mm1/game/combat.cpp b/engines/mm/mm1/game/combat.cpp
index 9a6859088a4..98eeea5acd2 100644
--- a/engines/mm/mm1/game/combat.cpp
+++ b/engines/mm/mm1/game/combat.cpp
@@ -1514,6 +1514,8 @@ void Combat::monsterAttackInner() {
_attackerLevel = (attackerLevel > 255) ? 192 : attackerLevel;
}
+ // Calculate attack damage and set mode to display the result
+ addAttackDamage();
setMode(MONSTER_ATTACK);
}
Commit: ed1a0cbd05a1cc7f0f27140221ac5b3a020b5037
https://github.com/scummvm/scummvm/commit/ed1a0cbd05a1cc7f0f27140221ac5b3a020b5037
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T11:22:56-08:00
Commit Message:
MM: MM1: Renaming of character HP fields
Changed paths:
engines/mm/mm1/data/character.cpp
engines/mm/mm1/data/character.h
engines/mm/mm1/data/trap.cpp
engines/mm/mm1/data/trap.h
engines/mm/mm1/game/combat.cpp
engines/mm/mm1/game/spells_party.cpp
engines/mm/mm1/maps/map.cpp
engines/mm/mm1/maps/map06.cpp
engines/mm/mm1/maps/map09.cpp
engines/mm/mm1/maps/map15.cpp
engines/mm/mm1/maps/map27.cpp
engines/mm/mm1/maps/map28.cpp
engines/mm/mm1/maps/map33.cpp
engines/mm/mm1/views/character_base.cpp
engines/mm/mm1/views/create_characters.cpp
engines/mm/mm1/views/locations/temple.cpp
engines/mm/mm1/views_enh/locations/temple.cpp
diff --git a/engines/mm/mm1/data/character.cpp b/engines/mm/mm1/data/character.cpp
index 7888d90a42e..4b78296ec60 100644
--- a/engines/mm/mm1/data/character.cpp
+++ b/engines/mm/mm1/data/character.cpp
@@ -182,7 +182,7 @@ void Character::synchronize(Common::Serializer &s) {
_spellLevel.synchronize(s);
s.syncAsUint16LE(_gems);
- s.syncAsUint16LE(_hpBase);
+ s.syncAsUint16LE(_hpCurrent);
s.syncAsUint16LE(_hp);
s.syncAsUint16LE(_hpMax);
@@ -230,7 +230,7 @@ void Character::clear() {
_sp = 0;
_spellLevel = 0;
_gems = 0;
- _hpBase = _hp = _hpMax = 0;
+ _hpCurrent = _hp = _hpMax = 0;
_gold = 0;
_ac = 0;
_food = 0;
@@ -317,8 +317,8 @@ Character::LevelIncrease Character::increaseLevel() {
else
newHP = MAX(newHP - 3, 1);
- _hpBase += newHP;
- _hp = _hpMax = _hpBase;
+ _hpCurrent += newHP;
+ _hp = _hpMax = _hpCurrent;
int gainedSpells = 0;
if (classNum < ARCHER) {
@@ -538,8 +538,8 @@ void Character::rest() {
_condition &= ~(ASLEEP | BLINDED | SILENCED |
PARALYZED | UNCONSCIOUS);
- if (_hpBase == 0)
- _hpBase = 1;
+ if (_hpCurrent == 0)
+ _hpCurrent = 1;
if (_age._current++ == 255) {
_age._base = MIN((int)_age._base + 1, 255);
@@ -582,7 +582,7 @@ void Character::rest() {
}
if (_condition & DISEASED) {
- _hpBase = _hpMax;
+ _hpCurrent = _hpMax;
_sp._current = _sp._base;
}
}
@@ -620,7 +620,7 @@ size_t Character::getPerformanceTotal() const {
+ _sp.getPerformanceTotal()
+ _spellLevel.getPerformanceTotal()
+ PERF16(_gems)
- + PERF16(_hpBase)
+ + PERF16(_hpCurrent)
+ PERF16(_hp)
+ PERF16(_hpMax)
+ PERF32(_gold)
diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index 322fcf04512..5d982e2da53 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -426,7 +426,7 @@ struct Character : public PrimaryAttributes {
uint32 _exp = 0;
uint16 _gems = 0;
- uint16 _hpBase = 0, _hp = 0, _hpMax = 0;
+ uint16 _hpCurrent = 0, _hp = 0, _hpMax = 0;
uint32 _gold = 0;
uint8 _food = 0;
uint8 _condition = 0;
diff --git a/engines/mm/mm1/data/trap.cpp b/engines/mm/mm1/data/trap.cpp
index 61de8d36aa1..6f694e5773f 100644
--- a/engines/mm/mm1/data/trap.cpp
+++ b/engines/mm/mm1/data/trap.cpp
@@ -88,7 +88,7 @@ void TrapData::trap() {
}
for (uint i = 0; i < g_globals->_party.size(); ++i, _reduced = val4) {
- _hp = maxVal;
+ _hpInitial = maxVal;
damageChar(i);
}
}
@@ -96,12 +96,12 @@ void TrapData::trap() {
void TrapData::damageChar(uint partyIndex) {
Character &c = g_globals->_party[partyIndex];
if (&c != g_globals->_currCharacter)
- _hp >>= 1;
+ _hpInitial >>= 1;
if (_resistanceIndex != -1 &&
c._resistances._arr[_resistanceIndex] != 0 &&
getRandomNumber(100) < c._resistances._arr[_resistanceIndex]) {
- _hp >>= 1;
+ _hpInitial >>= 1;
++_reduced;
}
@@ -109,27 +109,27 @@ void TrapData::damageChar(uint partyIndex) {
int luckLevel2 = getRandomNumber(luckLevel1 + 20);
if (getRandomNumber(luckLevel2) < luckLevel1) {
- _hp >>= 1;
+ _hpInitial >>= 1;
++_reduced;
}
if (c._condition & BAD_CONDITION) {
- c._hpBase = 0;
+ c._hpCurrent = 0;
} else if (c._condition & UNCONSCIOUS) {
c._condition = BAD_CONDITION | DEAD;
- c._hpBase = 0;
+ c._hpCurrent = 0;
} else {
- c._hpBase = MAX((int)c._hpBase - _hp, 0);
+ c._hpCurrent = MAX((int)c._hpCurrent - _hpInitial, 0);
- if (c._hpBase == 0) {
+ if (c._hpCurrent == 0) {
c._condition |= UNCONSCIOUS;
} else if (!_reduced && _condition &&
getRandomNumber(luckLevel1 + 20) >= luckLevel1) {
if (_condition >= UNCONSCIOUS)
- c._hpBase = 0;
+ c._hpCurrent = 0;
if (!(c._condition & BAD_CONDITION))
c._condition = _condition;
diff --git a/engines/mm/mm1/data/trap.h b/engines/mm/mm1/data/trap.h
index 8a86b9fc6c2..b36c9eae0dc 100644
--- a/engines/mm/mm1/data/trap.h
+++ b/engines/mm/mm1/data/trap.h
@@ -43,7 +43,7 @@ protected:
static byte DAMAGE_TYPE[7];
int _trapType = 0;
- int _hp = 0;
+ int _hpInitial = 0;
int _reduced = 0;
int _resistanceIndex = 0;
byte _condition = 0;
diff --git a/engines/mm/mm1/game/combat.cpp b/engines/mm/mm1/game/combat.cpp
index 98eeea5acd2..f61918ca9ae 100644
--- a/engines/mm/mm1/game/combat.cpp
+++ b/engines/mm/mm1/game/combat.cpp
@@ -728,7 +728,7 @@ void Combat::checkParty() {
// Update the array for the party
for (uint i = 0; i < g_globals->_combatParty.size(); ++i) {
const Character &c = *g_globals->_combatParty[i];
- if ((c._condition & BAD_CONDITION) || !c._hpBase)
+ if ((c._condition & BAD_CONDITION) || !c._hpCurrent)
g_globals->_combatParty[i]->_checked = true;
}
@@ -1232,8 +1232,8 @@ bool Combat::divineIntervention() {
if (c._condition != ERADICATED) {
c._condition = 0;
- c._hpBase = c._hp;
- c._hpMax = c._hpBase;
+ c._hpCurrent = c._hp;
+ c._hpMax = c._hpCurrent;
}
}
@@ -1625,14 +1625,14 @@ void Combat::combatDone() {
Common::String Combat::subtractDamageFromChar() {
Character &c = *g_globals->_currCharacter;
- int newHp = c._hpBase - _damage;
+ int newHp = c._hpCurrent - _damage;
Common::String result;
if (newHp > 0) {
- c._hpBase = newHp;
+ c._hpCurrent = newHp;
} else {
- c._hpBase = 0;
+ c._hpCurrent = 0;
if (!(c._condition & (BAD_CONDITION | UNCONSCIOUS))) {
c._condition |= UNCONSCIOUS;
diff --git a/engines/mm/mm1/game/spells_party.cpp b/engines/mm/mm1/game/spells_party.cpp
index e678adce3fb..52d18e03850 100644
--- a/engines/mm/mm1/game/spells_party.cpp
+++ b/engines/mm/mm1/game/spells_party.cpp
@@ -473,8 +473,8 @@ SpellResult SpellsParty::cleric54_removeCondition() {
} else {
_destChar->_condition = FINE;
- if (!_destChar->_hpBase)
- _destChar->_hpBase = 1;
+ if (!_destChar->_hpCurrent)
+ _destChar->_hpCurrent = 1;
restoreHp(1);
return SR_SUCCESS_DONE;
@@ -534,7 +534,7 @@ SpellResult SpellsParty::cleric62_raiseDead() {
else
_destChar->_condition = FINE;
- _destChar->_hpBase = 1;
+ _destChar->_hpCurrent = 1;
return SR_SUCCESS_DONE;
}
@@ -561,7 +561,7 @@ SpellResult SpellsParty::cleric64_stoneToFlesh() {
else
_destChar->_condition = FINE;
- _destChar->_hpBase = 1;
+ _destChar->_hpCurrent = 1;
return SR_SUCCESS_DONE;
}
@@ -1022,7 +1022,7 @@ void SpellsParty::restoreHp(uint16 hp) {
}
void SpellsParty::restoreHp(Character &c, uint16 hp) {
- c._hpBase = MIN((int)(c._hpBase + hp), (int)c._hpMax);
+ c._hpCurrent = MIN((int)(c._hpCurrent + hp), (int)c._hpMax);
if (!(c._condition & BAD_CONDITION))
c._condition &= ~UNCONSCIOUS;
}
diff --git a/engines/mm/mm1/maps/map.cpp b/engines/mm/mm1/maps/map.cpp
index 1cf2e24a4ff..f821959ba53 100644
--- a/engines/mm/mm1/maps/map.cpp
+++ b/engines/mm/mm1/maps/map.cpp
@@ -93,7 +93,7 @@ void Map::dataWord(uint16 ofs, uint16 val) {
void Map::reduceHP() {
for (uint i = 0; i < g_globals->_party.size(); ++i)
- g_globals->_party[i]._hpBase /= 2;
+ g_globals->_party[i]._hpCurrent /= 2;
}
void Map::updateGame() {
diff --git a/engines/mm/mm1/maps/map06.cpp b/engines/mm/mm1/maps/map06.cpp
index 87a04e5a04c..6affcd21a06 100644
--- a/engines/mm/mm1/maps/map06.cpp
+++ b/engines/mm/mm1/maps/map06.cpp
@@ -137,8 +137,8 @@ void Map06::special04() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
- c._hpBase = MAX((int)c._hpBase - 15, 0);
- if (!c._hpBase) {
+ c._hpCurrent = MAX((int)c._hpCurrent - 15, 0);
+ if (!c._hpCurrent) {
if (!(c._condition & BAD_CONDITION))
c._condition = UNCONSCIOUS;
}
diff --git a/engines/mm/mm1/maps/map09.cpp b/engines/mm/mm1/maps/map09.cpp
index 4a8fd468239..e4536dce247 100644
--- a/engines/mm/mm1/maps/map09.cpp
+++ b/engines/mm/mm1/maps/map09.cpp
@@ -172,7 +172,7 @@ void Map09::special14() {
if (!g_globals->_activeSpells._s.poison &&
!(c._condition & BAD_CONDITION))
c._condition = POISONED;
- c._hpBase /= 2;
+ c._hpCurrent /= 2;
}
SoundMessage msg(
diff --git a/engines/mm/mm1/maps/map15.cpp b/engines/mm/mm1/maps/map15.cpp
index de5393f670f..e43cf70c7ee 100644
--- a/engines/mm/mm1/maps/map15.cpp
+++ b/engines/mm/mm1/maps/map15.cpp
@@ -73,7 +73,7 @@ void Map15::special() {
if (!g_globals->_activeSpells._s.fire) {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
- c._hpBase = MAX((int)c._hpBase - 15, 0);
+ c._hpCurrent = MAX((int)c._hpCurrent - 15, 0);
}
}
}
diff --git a/engines/mm/mm1/maps/map27.cpp b/engines/mm/mm1/maps/map27.cpp
index c174e335698..1c104807d90 100644
--- a/engines/mm/mm1/maps/map27.cpp
+++ b/engines/mm/mm1/maps/map27.cpp
@@ -81,7 +81,7 @@ void Map27::special02() {
Character &c = g_globals->_party[i];
if (c._condition != ERADICATED) {
c._condition = 0;
- c._hpBase = c._hpMax = c._hp;
+ c._hpCurrent = c._hpMax = c._hp;
}
}
diff --git a/engines/mm/mm1/maps/map28.cpp b/engines/mm/mm1/maps/map28.cpp
index 2d148ee252c..1416af8dacc 100644
--- a/engines/mm/mm1/maps/map28.cpp
+++ b/engines/mm/mm1/maps/map28.cpp
@@ -201,7 +201,7 @@ void Map28::setCondition(byte condition) {
void Map28::reduceHpBase() {
for (uint i = 0; i < g_globals->_party.size(); ++i) {
Character &c = g_globals->_party[i];
- c._hpBase /= 2;
+ c._hpCurrent /= 2;
}
}
diff --git a/engines/mm/mm1/maps/map33.cpp b/engines/mm/mm1/maps/map33.cpp
index 862a8621608..e63c2f3877b 100644
--- a/engines/mm/mm1/maps/map33.cpp
+++ b/engines/mm/mm1/maps/map33.cpp
@@ -78,7 +78,7 @@ void Map33::special() {
];
if (!(c._condition & BAD_CONDITION)) {
c._condition |= SILENCED | PARALYZED | UNCONSCIOUS;
- c._hpBase = 0;
+ c._hpCurrent = 0;
msg._lines.push_back(Line(0, 2, STRING["maps.map33.quicksand"]));
Sound::sound(SOUND_3);
}
diff --git a/engines/mm/mm1/views/character_base.cpp b/engines/mm/mm1/views/character_base.cpp
index 00df3e5e01c..75b6f9bcdd8 100644
--- a/engines/mm/mm1/views/character_base.cpp
+++ b/engines/mm/mm1/views/character_base.cpp
@@ -73,7 +73,7 @@ void CharacterBase::printStats() {
writeNumber(re._speed);
_textPos.x = 8;
writeString(STRING["stats.attributes.hp"]);
- writeNumber(re._hp);
+ writeNumber(re._hpCurrent);
_textPos.x = 16;
writeChar('/');
writeNumber(re._hpMax);
diff --git a/engines/mm/mm1/views/create_characters.cpp b/engines/mm/mm1/views/create_characters.cpp
index 4c7c71db9c3..f29f9d36250 100644
--- a/engines/mm/mm1/views/create_characters.cpp
+++ b/engines/mm/mm1/views/create_characters.cpp
@@ -147,7 +147,7 @@ void CreateCharacters::NewCharacter::setHP(int hp) {
else if (_attribs1[ENDURANCE] < 8)
hp -= 1;
- re._hpBase = re._hp = re._hpMax = hp;
+ re._hpCurrent = re._hp = re._hpMax = hp;
int ac = 0;
if (_attribs1[SPEED] >= 19)
diff --git a/engines/mm/mm1/views/locations/temple.cpp b/engines/mm/mm1/views/locations/temple.cpp
index 05ff9f411d3..40e152b952e 100644
--- a/engines/mm/mm1/views/locations/temple.cpp
+++ b/engines/mm/mm1/views/locations/temple.cpp
@@ -161,7 +161,7 @@ void Temple::restoreHealth() {
if (subtractGold(_healCost)) {
Character &c = *g_globals->_currCharacter;
c._condition = FINE;
- c._hpBase = c._hp;
+ c._hpCurrent = c._hp;
if (_isEradicated) {
c._age._current += 10;
diff --git a/engines/mm/mm1/views_enh/locations/temple.cpp b/engines/mm/mm1/views_enh/locations/temple.cpp
index cc3fa2d73ab..f3cda000f18 100644
--- a/engines/mm/mm1/views_enh/locations/temple.cpp
+++ b/engines/mm/mm1/views_enh/locations/temple.cpp
@@ -159,7 +159,7 @@ void Temple::restoreHealth() {
if (subtractGold(_healCost)) {
Character &c = *g_globals->_currCharacter;
c._condition = FINE;
- c._hpBase = c._hp;
+ c._hpCurrent = c._hp;
if (_isEradicated) {
c._age._current += 10;
Commit: f71236806ee60d713ff86ede1e57376671f49f4b
https://github.com/scummvm/scummvm/commit/f71236806ee60d713ff86ede1e57376671f49f4b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T11:28:22-08:00
Commit Message:
MM: MM1: Cleaned up calculating char defense adjusts damage
Changed paths:
engines/mm/mm1/game/combat.cpp
engines/mm/mm1/game/spells_monsters.h
engines/mm/mm1/views/combat.cpp
diff --git a/engines/mm/mm1/game/combat.cpp b/engines/mm/mm1/game/combat.cpp
index f61918ca9ae..5c12f4df451 100644
--- a/engines/mm/mm1/game/combat.cpp
+++ b/engines/mm/mm1/game/combat.cpp
@@ -892,6 +892,8 @@ void Combat::addAttackDamage() {
++_timesHit;
}
}
+
+ _displayedDamage = _damage;
}
void Combat::updateMonsterStatus() {
@@ -1514,8 +1516,18 @@ void Combat::monsterAttackInner() {
_attackerLevel = (attackerLevel > 255) ? 192 : attackerLevel;
}
- // Calculate attack damage and set mode to display the result
+ // Calculate attack damage
addAttackDamage();
+
+ // Do some final damage adjustment which may reduce the
+ // actual damage from what gets displayed
+ if (g_globals->_activeSpells._s.power_shield)
+ _damage /= 2;
+
+ if (_val10 && g_globals->_activeSpells._s.shield)
+ _damage = MAX((int)_damage - 8, 0);
+
+ // Display the result
setMode(MONSTER_ATTACK);
}
diff --git a/engines/mm/mm1/game/spells_monsters.h b/engines/mm/mm1/game/spells_monsters.h
index 0352e3bfae0..83ac48832ff 100644
--- a/engines/mm/mm1/game/spells_monsters.h
+++ b/engines/mm/mm1/game/spells_monsters.h
@@ -133,7 +133,7 @@ private:
protected:
Common::Array<Monster *> _remainingMonsters;
LineArray _lines;
- int _damage = 0;
+ int _damage = 0, _displayedDamage = 0;
virtual bool canMonsterCast() const = 0;
virtual int getMonsterIndex() const = 0;
diff --git a/engines/mm/mm1/views/combat.cpp b/engines/mm/mm1/views/combat.cpp
index 90128917a6c..3bcae10595c 100644
--- a/engines/mm/mm1/views/combat.cpp
+++ b/engines/mm/mm1/views/combat.cpp
@@ -655,15 +655,6 @@ void Combat::writeMonsterAttack() {
writeString(0, 20, line);
writeString(0, 21, getAttackString());
- // It's not ideal, but we have to do some final minor damage
- // adjustment here after we've written the basic damage the
- // character will receive
- if (g_globals->_activeSpells._s.power_shield)
- _damage /= 2;
-
- if (_val10 && g_globals->_activeSpells._s.shield)
- _damage = MAX((int)_damage - 8, 0);
-
if (_damage) {
// Attacks wake up sleeping characters
if (!(c._condition & BAD_CONDITION))
@@ -806,7 +797,7 @@ Common::String Combat::getAttackString() {
line1 += Common::String::format(" %s ", STRING["dialogs.combat.and"].c_str());
- if (_damage == 0) {
+ if (_displayedDamage == 0) {
line1 += STRING["dialogs.combat.misses"];
} else {
line1 += STRING["dialogs.combat.hit"];
@@ -823,7 +814,7 @@ Common::String Combat::getAttackString() {
}
line1 += Common::String::format(" %s %d %s",
- STRING["dialogs.combat.for"].c_str(), _damage,
+ STRING["dialogs.combat.for"].c_str(), _displayedDamage,
STRING[_damage == 1 ? "dialogs.combat.point" : "dialogs.combat.points"].c_str());
if (line1.size() < 30) {
Commit: 2dca8d872888e494c129cde604b966feaa6244e9
https://github.com/scummvm/scummvm/commit/2dca8d872888e494c129cde604b966feaa6244e9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T11:34:01-08:00
Commit Message:
MM: MM1: Fix indexing of attack type messages
Changed paths:
devtools/create_mm/files/mm1/strings_en.yml
diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index 22c98afa0cc..10cd46e8237 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -404,21 +404,21 @@ dialogs:
8: "(dead) "
wounded: "(wounded) "
attack_types:
- 0: "attacks"
- 1: "fights"
- 2: "charges"
- 3: "assaults"
- 4: "battles"
- 5: "stabs at"
- 6: "flails at"
- 7: "lunges at"
- 8: "swings at"
- 9: "chops at"
- 10: "hacks at"
- 11: "thrusts at"
- 12: "slashes at"
- 13: "strikes at"
- 14: "thrashes at"
+ 1: "attacks"
+ 2: "fights"
+ 3: "charges"
+ 4: "assaults"
+ 5: "battles"
+ 6: "stabs at"
+ 7: "flails at"
+ 8: "lunges at"
+ 9: "swings at"
+ 10: "chops at"
+ 11: "hacks at"
+ 12: "thrusts at"
+ 13: "slashes at"
+ 14: "strikes at"
+ 15: "thrashes at"
99: "shoots at"
enhdialogs:
map:
More information about the Scummvm-git-logs
mailing list