[Scummvm-git-logs] scummvm master -> 46f69af4a56117f1193b103ae82fec7d688abc47

dreammaster noreply at scummvm.org
Sun Feb 5 20:11:31 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dea9cdb37a MM: MM1: Combat field renaming
46f69af4a5 MM: MM1: Fix QuickRef in combat to show remaining comobat party


Commit: dea9cdb37a1befc29e50d2ba2246349a6e52b0a9
    https://github.com/scummvm/scummvm/commit/dea9cdb37a1befc29e50d2ba2246349a6e52b0a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T12:11:19-08:00

Commit Message:
MM: MM1: Combat field renaming

Changed paths:
    engines/mm/mm1/game/combat.cpp
    engines/mm/mm1/game/combat.h


diff --git a/engines/mm/mm1/game/combat.cpp b/engines/mm/mm1/game/combat.cpp
index 5c12f4df451..8a150b2d4d3 100644
--- a/engines/mm/mm1/game/combat.cpp
+++ b/engines/mm/mm1/game/combat.cpp
@@ -54,7 +54,7 @@ void Combat::clear() {
 	_val1 = 0;
 	_val6 = _val7 = 0;
 	_partyIndex = _val9 = 0;
-	_val10 = _destCharCtr = 0;
+	_monsterShootingCtr = _destCharCtr = 0;
 	_activeMonsterNum = 0;
 	_destAC = 0;
 	_numberOfTimes = 0;
@@ -720,7 +720,7 @@ void Combat::removeDeadMonsters() {
 }
 
 void Combat::checkParty() {
-	_val10 = 0;
+	_monsterShootingCtr = 0;
 
 	if (g_globals->_party.checkPartyIncapacitated())
 		return;
@@ -912,7 +912,7 @@ void Combat::updateMonsterStatus() {
 bool Combat::monsterTouch(Common::String &line) {
 	line.clear();
 
-	if (_val10 || !_monsterP->_bonusOnTouch)
+	if (_monsterShootingCtr || !_monsterP->_bonusOnTouch)
 		return false;
 	if (_monsterP->_bonusOnTouch & 0x80) {
 		proc9();
@@ -1473,13 +1473,13 @@ void Combat::monsterAttackRandom() {
 	size_t monsterNameSize = enc._monsterList[getMonsterIndex()]._name.size() + 1;
 
 	_monsterAttackStyle = getRandomNumber((monsterNameSize < 13) ? 15 : 11);
-	_val10 = 0;
+	_monsterShootingCtr = 0;
 
 	monsterAttackInner();
 }
 
 void Combat::monsterAttackShooting() {
-	++_val10;
+	++_monsterShootingCtr;
 	_monsterAttackStyle = 99;	// shooting
 
 	monsterAttackInner();
@@ -1497,7 +1497,7 @@ void Combat::monsterAttackInner() {
 	if (c._condition & (ASLEEP | BLINDED | PARALYZED))
 		_attackerLevel += 5;
 
-	if (_val10) {
+	if (_monsterShootingCtr) {
 		_attackAttr2._base = _monsterP->_specialAbility & 0x7f;
 		_numberOfTimes = 1;
 
@@ -1524,7 +1524,7 @@ void Combat::monsterAttackInner() {
 	if (g_globals->_activeSpells._s.power_shield)
 		_damage /= 2;
 
-	if (_val10 && g_globals->_activeSpells._s.shield)
+	if (_monsterShootingCtr && g_globals->_activeSpells._s.shield)
 		_damage = MAX((int)_damage - 8, 0);
 
 	// Display the result
diff --git a/engines/mm/mm1/game/combat.h b/engines/mm/mm1/game/combat.h
index d5e85d9bb08..5d7ee271b42 100644
--- a/engines/mm/mm1/game/combat.h
+++ b/engines/mm/mm1/game/combat.h
@@ -44,7 +44,7 @@ protected:
 	int _monsterIndex, _currentChar;
 	bool _allowFight, _allowShoot, _allowCast, _allowAttack;
 	byte _val6, _val7;
-	int _partyIndex, _val9, _val10;
+	int _partyIndex, _val9, _monsterShootingCtr;
 	int _activeMonsterNum;
 	int _destCharCtr;
 	int _destAC;


Commit: 46f69af4a56117f1193b103ae82fec7d688abc47
    https://github.com/scummvm/scummvm/commit/46f69af4a56117f1193b103ae82fec7d688abc47
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-05T12:11:19-08:00

Commit Message:
MM: MM1: Fix QuickRef in combat to show remaining comobat party

Changed paths:
    engines/mm/mm1/views/combat.cpp
    engines/mm/mm1/views/quick_ref.cpp
    engines/mm/mm1/views/quick_ref.h


diff --git a/engines/mm/mm1/views/combat.cpp b/engines/mm/mm1/views/combat.cpp
index 3bcae10595c..ae0a58f5781 100644
--- a/engines/mm/mm1/views/combat.cpp
+++ b/engines/mm/mm1/views/combat.cpp
@@ -343,7 +343,6 @@ bool Combat::msgAction(const ActionMessage &msg) {
 		}
 		break;
 	default:
-		// TODO: Character and quickref views
 		break;
 	}
 
diff --git a/engines/mm/mm1/views/quick_ref.cpp b/engines/mm/mm1/views/quick_ref.cpp
index 0fa678cf432..41d9bdaea08 100644
--- a/engines/mm/mm1/views/quick_ref.cpp
+++ b/engines/mm/mm1/views/quick_ref.cpp
@@ -41,8 +41,12 @@ void QuickRef::draw() {
 	writeString(STRING["dialogs.quick_ref.title"]);
 
 	// Print list of characters, hit pts, spell pts, and ac
-	for (uint idx = 0; idx < g_globals->_party.size(); ++idx) {
-		Character &c = g_globals->_party[idx];
+	size_t partySize = getPartySize();
+	bool inCombat = isInCombat();
+
+	for (uint idx = 0; idx < partySize; ++idx) {
+		Character &c = inCombat ? *g_globals->_combatParty[idx] :
+			g_globals->_party[idx];
 
 		// Number and name
 		writeNumber(0, 2 + idx, idx + 1);
@@ -108,9 +112,14 @@ bool QuickRef::msgAction(const ActionMessage &msg) {
 	case KEYBIND_VIEW_PARTY5:
 	case KEYBIND_VIEW_PARTY6: {
 		uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
-		if (charNum < g_globals->_party.size()) {
-			g_globals->_currCharacter = &g_globals->_party[charNum];
-			replaceView("CharacterInfo");
+		if (charNum < getPartySize()) {
+			if (isInCombat()) {
+				g_globals->_currCharacter = g_globals->_combatParty[charNum];
+				replaceView("CharacterViewCombat");
+			} else {
+				g_globals->_currCharacter = &g_globals->_party[charNum];
+				replaceView("CharacterInfo");
+			}
 		}
 		break;
 	}
@@ -121,6 +130,16 @@ bool QuickRef::msgAction(const ActionMessage &msg) {
 	return false;
 }
 
+bool QuickRef::isInCombat() const {
+	return g_events->isPresent("Combat");
+}
+
+size_t QuickRef::getPartySize() const {
+	bool inCombat = isInCombat();
+	return inCombat ? g_globals->_combatParty.size() :
+		g_globals->_party.size();
+}
+
 } // namespace Views
 } // namespace MM1
 } // namespace MM
diff --git a/engines/mm/mm1/views/quick_ref.h b/engines/mm/mm1/views/quick_ref.h
index 85d3519c85e..3bf01603abc 100644
--- a/engines/mm/mm1/views/quick_ref.h
+++ b/engines/mm/mm1/views/quick_ref.h
@@ -32,6 +32,9 @@ namespace Views {
  * Quick reference list of all the characters.
  */
 class QuickRef : public CharacterBase {
+private:
+	bool isInCombat() const;
+	size_t getPartySize() const;
 public:
 	QuickRef() : CharacterBase("QuickRef") {}
 	virtual ~QuickRef() {}




More information about the Scummvm-git-logs mailing list