[Scummvm-git-logs] scummvm master -> 943ff7f9c511849bb03b5e322e5fa333961e9930

dreammaster noreply at scummvm.org
Wed Feb 8 04:09:01 UTC 2023


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

Summary:
a43b5c4d2a MM: MM1: In progress enhanced QuickRef dialog
d4f8c51567 MM: MM1: Load character names in camel case in enhanced version
e1977dbd77 MM: MM1: Further QuickRef dialog
fbfad865ff MM: MM1: Remainder of QuickRef dialog
943ff7f9c5 MM: MM1: Allow selecting characters from QuickRef


Commit: a43b5c4d2ad11f594e19f3153828a278e0fef1fe
    https://github.com/scummvm/scummvm/commit/a43b5c4d2ad11f594e19f3153828a278e0fef1fe
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-07T20:02:26-08:00

Commit Message:
MM: MM1: In progress enhanced QuickRef dialog

Changed paths:
  A engines/mm/mm1/views_enh/quick_ref.cpp
  A engines/mm/mm1/views_enh/quick_ref.h
    devtools/create_mm/files/mm1/strings_en.yml
    engines/mm/mm1/views_enh/dialogs.h
    engines/mm/mm1/views_enh/game_commands.cpp
    engines/mm/module.mk


diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index fbb6718aba0..9fe20edc9c7 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -485,6 +485,16 @@ enhdialogs:
 		no_gold: "no gold,\nno food!"
 	misc:
 		exit: "exit"
+	quickref:
+		title: "Quick Reference Chart"
+		headers:
+			name: "Name"
+			class: "Cls"
+			level: "Lvl"
+			hp: "H.P."
+			sp: "S.P."
+			ac: "A.C."
+			cond: "Cond"
 	temple:
 		title: "temple"
 		heal: "\x01""37heal"
diff --git a/engines/mm/mm1/views_enh/dialogs.h b/engines/mm/mm1/views_enh/dialogs.h
index 27802e22e82..94c8395ccd7 100644
--- a/engines/mm/mm1/views_enh/dialogs.h
+++ b/engines/mm/mm1/views_enh/dialogs.h
@@ -28,12 +28,12 @@
 #include "mm/mm1/views/locations/inn.h"
 #include "mm/mm1/views/main_menu.h"
 #include "mm/mm1/views/protect.h"
-#include "mm/mm1/views/quick_ref.h"
 #include "mm/mm1/views/title.h"
 //#include "mm/mm1/views/char.h"
 #include "mm/mm1/views_enh/character_info.h"
 #include "mm/mm1/views_enh/game.h"
 #include "mm/mm1/views_enh/map_popup.h"
+#include "mm/mm1/views_enh/quick_ref.h"
 #include "mm/mm1/views_enh/locations/market.h"
 #include "mm/mm1/views_enh/locations/temple.h"
 
@@ -52,11 +52,11 @@ private:
 	Views::Locations::Inn _inn;
 	Views::MainMenu _mainMenu;
 	Views::Protect _protect;
-	Views::QuickRef _quickRef;
 	Views::Title _title;
 //	Views::ViewCharacters _viewCharacters;
 //	Views::ViewCharacter _viewCharacter;
 	ViewsEnh::MapPopup _mapPopup;
+	ViewsEnh::QuickRef _quickRef;
 	ViewsEnh::Locations::Market _market;
 	ViewsEnh::Locations::Temple _temple;
 public:
diff --git a/engines/mm/mm1/views_enh/game_commands.cpp b/engines/mm/mm1/views_enh/game_commands.cpp
index f3f32df7228..d4192680768 100644
--- a/engines/mm/mm1/views_enh/game_commands.cpp
+++ b/engines/mm/mm1/views_enh/game_commands.cpp
@@ -61,6 +61,9 @@ bool GameCommands::msgAction(const ActionMessage & msg) {
 	case KEYBIND_MAP:
 		addView("MapPopup");
 		return true;
+	case KEYBIND_QUICKREF:
+		addView("QuickRef");
+		return true;
 	default:
 		break;
 	}
diff --git a/engines/mm/mm1/views_enh/quick_ref.cpp b/engines/mm/mm1/views_enh/quick_ref.cpp
new file mode 100644
index 00000000000..6332cad2ed7
--- /dev/null
+++ b/engines/mm/mm1/views_enh/quick_ref.cpp
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "mm/mm1/views_enh/quick_ref.h"
+#include "mm/mm1/maps/maps.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+#define COLUMN_NUM 15
+#define COLUMN_NAME 35
+#define COLUMN_CLASS 118
+#define COLUMN_LEVEL 162
+#define COLUMN_HP 180
+#define COLUMN_SP 216
+#define COLUMN_AC 250
+#define COLUMN_CONDITION 278
+
+
+QuickRef::QuickRef() : ScrollPopup("QuickRef") {
+	setBounds(Common::Rect(0, 0, 320, 146));
+}
+
+void QuickRef::draw() {
+	ScrollPopup::draw();
+
+	// Title
+	writeString(0, 0, STRING["enhdialogs.quickref.title"], ALIGN_MIDDLE);
+
+	// Header line
+	writeString(COLUMN_NUM, 20, "#");
+	writeString(COLUMN_NAME, 20, STRING["enhdialogs.quickref.headers.name"]);
+	writeString(COLUMN_CLASS, 20, STRING["enhdialogs.quickref.headers.class"]);
+	writeString(COLUMN_LEVEL, 20, STRING["enhdialogs.quickref.headers.level"], ALIGN_RIGHT);
+	writeString(COLUMN_HP, 20, " ");
+	writeString(STRING["enhdialogs.quickref.headers.hp"]);
+	writeString(COLUMN_SP, 20, " ");
+	writeString(STRING["enhdialogs.quickref.headers.sp"]);
+	writeString(COLUMN_AC, 20, STRING["enhdialogs.quickref.headers.ac"]);
+	writeString(COLUMN_CONDITION, 20, STRING["enhdialogs.quickref.headers.cond"]);
+
+	// Write out individual character lines
+	for (uint i = 0; i < g_globals->_party.size(); ++i)
+		writeCharacterLine(i);
+}
+
+void QuickRef::writeCharacterLine(int charNum) {
+	const Character &c = g_globals->_party[charNum];
+	const int yp = 30 + (charNum * 10);
+
+	writeChar(COLUMN_NUM, yp, '1' + charNum);
+	writeChar(')');
+
+	writeString(COLUMN_NAME, yp, c._name);
+
+	Common::String classStr = STRING[Common::String::format(
+		"stats.classes.%d", c._class)];
+	writeString(COLUMN_CLASS, yp, Common::String(
+		classStr.c_str(), classStr.c_str() + 3));
+
+	writeString(COLUMN_LEVEL, yp,
+		Common::String::format("%d", c._level), ALIGN_RIGHT);
+}
+
+} // namespace Views
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/quick_ref.h b/engines/mm/mm1/views_enh/quick_ref.h
new file mode 100644
index 00000000000..005312ff897
--- /dev/null
+++ b/engines/mm/mm1/views_enh/quick_ref.h
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MM1_VIEWS_ENH_QUICK_REF_H
+#define MM1_VIEWS_ENH_QUICK_REF_H
+
+#include "mm/mm1/views_enh/scroll_popup.h"
+#include "mm/mm1/views_enh/map.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+class QuickRef : public ScrollPopup {
+private:
+	/**
+	 * Write the line for a single character
+	 */
+	void writeCharacterLine(int charNum);
+public:
+	QuickRef();
+	virtual ~QuickRef() {}
+
+	void draw() override;
+};
+
+} // namespace Views
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 859e9055f72..bbd029f2bea 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -119,6 +119,7 @@ MODULE_OBJS := \
 	mm1/views_enh/game_messages.o \
 	mm1/views_enh/map.o \
 	mm1/views_enh/map_popup.o \
+	mm1/views_enh/quick_ref.o \
 	mm1/views_enh/scroll_popup.o \
 	mm1/views_enh/scroll_text.o \
 	mm1/views_enh/scroll_view.o \


Commit: d4f8c51567667135af2f26692fab5ff9249347d6
    https://github.com/scummvm/scummvm/commit/d4f8c51567667135af2f26692fab5ff9249347d6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-07T20:02:26-08:00

Commit Message:
MM: MM1: Load character names in camel case in enhanced version

Changed paths:
    engines/mm/mm1/data/character.cpp
    engines/mm/utils/strings.cpp
    engines/mm/utils/strings.h


diff --git a/engines/mm/mm1/data/character.cpp b/engines/mm/mm1/data/character.cpp
index 4b78296ec60..d43cf434ec5 100644
--- a/engines/mm/mm1/data/character.cpp
+++ b/engines/mm/mm1/data/character.cpp
@@ -21,6 +21,7 @@
 
 #include "common/algorithm.h"
 #include "mm/mm1/data/character.h"
+#include "mm/utils/strings.h"
 #include "mm/mm1/mm1.h"
 
 namespace MM {
@@ -159,7 +160,21 @@ Character::Character() : PrimaryAttributes() {
 }
 
 void Character::synchronize(Common::Serializer &s) {
-	s.syncBytes((byte *)_name, 16);
+	char name[16];
+	if (s.isSaving()) {
+		// Save the name in uppercase to match original
+		Common::strlcpy(name, uppercase(_name).c_str(), 16);
+		s.syncBytes((byte *)name, 16);
+	} else {
+		s.syncBytes((byte *)name, 16);
+		name[15] = '\0';
+
+		if (g_engine->isEnhanced())
+			Common::strlcpy(_name, camelCase(name).c_str(), 16);
+		else
+			Common::strlcpy(_name, uppercase(name).c_str(), 16);
+	}
+
 	s.syncAsByte(_sex);
 	s.syncAsByte(_alignmentInitial);
 	s.syncAsByte(_alignment);
diff --git a/engines/mm/utils/strings.cpp b/engines/mm/utils/strings.cpp
index 979a97ff905..f839965e106 100644
--- a/engines/mm/utils/strings.cpp
+++ b/engines/mm/utils/strings.cpp
@@ -66,6 +66,15 @@ Common::String camelCase(const Common::String &str) {
 	return result;
 }
 
+Common::String uppercase(const Common::String &str) {
+	Common::String result;
+
+	for (uint i = 0; i < str.size(); ++i)
+		result += toupper(str[i]);
+
+	return result;
+}
+
 Common::String searchAndReplace(const Common::String &str,
 		const Common::String &find, const Common::String &replace) {
 	Common::String result = str;
diff --git a/engines/mm/utils/strings.h b/engines/mm/utils/strings.h
index 83bf4e4adf1..a3e597ceb72 100644
--- a/engines/mm/utils/strings.h
+++ b/engines/mm/utils/strings.h
@@ -29,6 +29,7 @@ namespace MM {
 
 extern Common::String capitalize(const Common::String &str);
 extern Common::String camelCase(const Common::String &str);
+extern Common::String uppercase(const Common::String &str);
 extern Common::String searchAndReplace(const Common::String &str,
 	const Common::String &find, const Common::String &replace);
 extern int strToInt(const Common::String &str);


Commit: e1977dbd77faa7f5c0b633c044786f4c8a746c23
    https://github.com/scummvm/scummvm/commit/e1977dbd77faa7f5c0b633c044786f4c8a746c23
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-07T20:02:26-08:00

Commit Message:
MM: MM1: Further QuickRef dialog

Changed paths:
    engines/mm/mm1/data/character.cpp
    engines/mm/mm1/data/character.h
    engines/mm/mm1/views_enh/quick_ref.cpp


diff --git a/engines/mm/mm1/data/character.cpp b/engines/mm/mm1/data/character.cpp
index d43cf434ec5..f0b4a269267 100644
--- a/engines/mm/mm1/data/character.cpp
+++ b/engines/mm/mm1/data/character.cpp
@@ -654,5 +654,18 @@ size_t Character::getPerformanceTotal() const {
 		+ totalFlags;
 }
 
+int Character::statColor(int amount, int threshold) const {
+	if (amount < 1)
+		return 6;
+	else if (amount > threshold)
+		return 2;
+	else if (amount == threshold)
+		return 15;
+	else if (amount >= (threshold / 4))
+		return 9;
+	else
+		return 32;
+}
+
 } // namespace MM1
 } // namespace MM
diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index 5d982e2da53..1f45508fb07 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -532,6 +532,12 @@ struct Character : public PrimaryAttributes {
 	 * value for the party at the end of the game
 	 */
 	size_t getPerformanceTotal() const;
+
+	/**
+	 * Returns the color to use in enhanced mode to
+	 * represent the color of a character attribute
+	 */
+	int statColor(int amount, int threshold) const;
 };
 
 } // namespace MM1
diff --git a/engines/mm/mm1/views_enh/quick_ref.cpp b/engines/mm/mm1/views_enh/quick_ref.cpp
index 6332cad2ed7..d1c01d9e2d6 100644
--- a/engines/mm/mm1/views_enh/quick_ref.cpp
+++ b/engines/mm/mm1/views_enh/quick_ref.cpp
@@ -52,10 +52,8 @@ void QuickRef::draw() {
 	writeString(COLUMN_NAME, 20, STRING["enhdialogs.quickref.headers.name"]);
 	writeString(COLUMN_CLASS, 20, STRING["enhdialogs.quickref.headers.class"]);
 	writeString(COLUMN_LEVEL, 20, STRING["enhdialogs.quickref.headers.level"], ALIGN_RIGHT);
-	writeString(COLUMN_HP, 20, " ");
-	writeString(STRING["enhdialogs.quickref.headers.hp"]);
-	writeString(COLUMN_SP, 20, " ");
-	writeString(STRING["enhdialogs.quickref.headers.sp"]);
+	writeString(COLUMN_HP, 20, STRING["enhdialogs.quickref.headers.hp"]);
+	writeString(COLUMN_SP, 20, STRING["enhdialogs.quickref.headers.sp"]);
 	writeString(COLUMN_AC, 20, STRING["enhdialogs.quickref.headers.ac"]);
 	writeString(COLUMN_CONDITION, 20, STRING["enhdialogs.quickref.headers.cond"]);
 
@@ -78,8 +76,23 @@ void QuickRef::writeCharacterLine(int charNum) {
 	writeString(COLUMN_CLASS, yp, Common::String(
 		classStr.c_str(), classStr.c_str() + 3));
 
+	setTextColor(c.statColor(c._level._current, c._level._base));
 	writeString(COLUMN_LEVEL, yp,
-		Common::String::format("%d", c._level), ALIGN_RIGHT);
+		Common::String::format("%d", c._level._current), ALIGN_RIGHT);
+
+	setTextColor(c.statColor(c._hpCurrent, c._hpMax));
+	writeNumber(COLUMN_HP, yp, c._hpCurrent);
+
+	setTextColor(c.statColor(c._sp._current, c._sp._base));
+	writeChar(COLUMN_SP, yp, ' ');
+	writeNumber(c._sp._current);
+
+	setTextColor(c.statColor(c._ac._current, c._ac._base));
+	writeChar(COLUMN_AC, yp, ' ');
+	writeNumber(c._ac._current);
+
+
+	setTextColor(0);
 }
 
 } // namespace Views


Commit: fbfad865ffbbbbb47bd538e94674fe433f5ef754
    https://github.com/scummvm/scummvm/commit/fbfad865ffbbbbb47bd538e94674fe433f5ef754
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-07T20:02:26-08:00

Commit Message:
MM: MM1: Remainder of QuickRef dialog

Changed paths:
    devtools/create_mm/files/mm1/strings_en.yml
    engines/mm/mm1/data/character.cpp
    engines/mm/mm1/data/character.h
    engines/mm/mm1/views_enh/quick_ref.cpp


diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index 9fe20edc9c7..ff86e51a92c 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -526,17 +526,17 @@ stats:
 		2: "Female"
 		3: "Yes Please"
 	conditions:
-		good: "good"
-		eradicated: "eradicated"
-		dead: "dead,"
-		stone: "stone,"
-		unconscious: "unconscious,"
-		paralyzed: "paralyzed,"
-		poisoned: "poisoned,"
-		diseased: "diseased,"
-		silenced: "silenced,"
-		blinded: "blinded,"
-		asleep: "asleep,"
+		good: "Good"
+		eradicated: "Eradicated"
+		dead: "Dead"
+		stone: "Stone"
+		unconscious: "Unconscious"
+		paralyzed: "Paralyzed"
+		poisoned: "Poisoned"
+		diseased: "Diseased"
+		silenced: "Silenced"
+		blinded: "Blinded"
+		asleep: "Asleep"
 	attributes:
 		int: "Int="
 		level: "lEvel="
diff --git a/engines/mm/mm1/data/character.cpp b/engines/mm/mm1/data/character.cpp
index f0b4a269267..a30084e3594 100644
--- a/engines/mm/mm1/data/character.cpp
+++ b/engines/mm/mm1/data/character.cpp
@@ -513,24 +513,24 @@ Common::String Character::getConditionString() const {
 		if (cond & BAD_CONDITION) {
 			// Fatal conditions
 			if (cond & DEAD)
-				result += STRING["stats.conditions.dead"];
+				result += STRING["stats.conditions.dead"] + ",";
 			if (cond & STONE)
-				result += STRING["stats.conditions.stone"];
+				result += STRING["stats.conditions.stone"] + ",";
 		} else {
 			if (cond & UNCONSCIOUS)
-				result += STRING["stats.conditions.unconscious"];
+				result += STRING["stats.conditions.unconscious"] + ",";
 			if (cond & PARALYZED)
-				result += STRING["stats.conditions.paralyzed"];
+				result += STRING["stats.conditions.paralyzed"] + ",";
 			if (cond & POISONED)
-				result += STRING["stats.conditions.poisoned"];
+				result += STRING["stats.conditions.poisoned"] + ",";
 			if (cond & DISEASED)
-				result += STRING["stats.conditions.diseased"];
+				result += STRING["stats.conditions.diseased"] + ",";
 			if (cond & SILENCED)
-				result += STRING["stats.conditions.silenced"];
+				result += STRING["stats.conditions.silenced"] + ",";
 			if (cond & BLINDED)
-				result += STRING["stats.conditions.blinded"];
+				result += STRING["stats.conditions.blinded"] + ",";
 			if (cond & ASLEEP)
-				result += STRING["stats.conditions.asleep"];
+				result += STRING["stats.conditions.asleep"] + ",";
 		}
 
 		result.deleteLastChar();
@@ -654,7 +654,7 @@ size_t Character::getPerformanceTotal() const {
 		+ totalFlags;
 }
 
-int Character::statColor(int amount, int threshold) const {
+byte Character::statColor(int amount, int threshold) const {
 	if (amount < 1)
 		return 6;
 	else if (amount > threshold)
@@ -667,5 +667,60 @@ int Character::statColor(int amount, int threshold) const {
 		return 32;
 }
 
+byte Character::conditionColor() const {
+	if (_condition == ERADICATED)
+		return 32;
+	else if (_condition == FINE)
+		return 15;
+	else if (_condition & BAD_CONDITION)
+		return 6;
+	else
+		return 9;
+}
+
+ConditionEnum Character::worstCondition() const {
+	if (_condition == ERADICATED) {
+		return C_ERADICATED;
+	} else if (_condition & BAD_CONDITION) {
+		if (_condition & DEAD)
+			return C_DEAD;
+		if (_condition & STONE)
+			return C_STONE;
+		if (_condition & UNCONSCIOUS)
+			return C_UNCONSCIOUS;
+	} else {
+		if (_condition & PARALYZED)
+			return C_PARALYZED;
+		if (_condition & POISONED)
+			return C_POISONED;
+		if (_condition & DISEASED)
+			return C_DISEASED;
+		if (_condition & SILENCED)
+			return C_SILENCED;
+		if (_condition & BLINDED)
+			return C_BLINDED;
+		if (_condition & ASLEEP)
+			return C_ASLEEP;
+	}
+
+	return C_GOOD;
+}
+
+Common::String Character::getConditionString(ConditionEnum cond) {
+	switch (cond) {
+	case C_ERADICATED: return STRING["stats.conditions.eradicated"];
+	case C_DEAD: return STRING["stats.conditions.dead"];
+	case C_STONE: return STRING["stats.conditions.stone"];
+	case C_UNCONSCIOUS: return STRING["stats.conditions.unconscious"];
+	case C_PARALYZED: return STRING["stats.conditions.paralyzed"];
+	case C_POISONED: return STRING["stats.conditions.poisoned"];
+	case C_DISEASED: return STRING["stats.conditions.diseased"];
+	case C_SILENCED: return STRING["stats.conditions.silenced"];
+	case C_BLINDED: return STRING["stats.conditions.blinded"];
+	case C_ASLEEP: return STRING["stats.conditions.asleep"];
+	default: return STRING["stats.conditions.good"];
+	}
+}
+
 } // namespace MM1
 } // namespace MM
diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index 1f45508fb07..1b6228a7ede 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -56,6 +56,13 @@ enum Condition {
 	DISEASED = 8,  SILENCED = 4, BLINDED = 2, ASLEEP = 1
 };
 
+enum ConditionEnum {
+	C_GOOD, C_ERADICATED, C_DEAD, C_STONE, C_UNCONSCIOUS,
+	C_PARALYZED, C_POISONED, C_DISEASED, C_SILENCED,
+	C_BLINDED, C_ASLEEP
+};
+
+
 enum Resistance {
 	RESISTANCE_MAGIC = 0, RESISTANCE_FIRE = 1, RESISTANCE_COLD = 2,
 	RESISTANCE_ELECTRICITY = 3, RESISTANCE_ACID = 4,
@@ -537,7 +544,23 @@ struct Character : public PrimaryAttributes {
 	 * Returns the color to use in enhanced mode to
 	 * represent the color of a character attribute
 	 */
-	int statColor(int amount, int threshold) const;
+	byte statColor(int amount, int threshold) const;
+
+	/**
+	 * Returns the condition color for display
+	 */
+	byte conditionColor() const;
+
+	/**
+	 * Returns the worst condition, if any, a character
+	 * currently has.
+	 */
+	ConditionEnum worstCondition() const;
+
+	/**
+	 * Returns a string for a given condition
+	 */
+	static Common::String getConditionString(ConditionEnum cond);
 };
 
 } // namespace MM1
diff --git a/engines/mm/mm1/views_enh/quick_ref.cpp b/engines/mm/mm1/views_enh/quick_ref.cpp
index d1c01d9e2d6..b0db247d8b1 100644
--- a/engines/mm/mm1/views_enh/quick_ref.cpp
+++ b/engines/mm/mm1/views_enh/quick_ref.cpp
@@ -36,7 +36,6 @@ namespace ViewsEnh {
 #define COLUMN_AC 250
 #define COLUMN_CONDITION 278
 
-
 QuickRef::QuickRef() : ScrollPopup("QuickRef") {
 	setBounds(Common::Rect(0, 0, 320, 146));
 }
@@ -91,6 +90,9 @@ void QuickRef::writeCharacterLine(int charNum) {
 	writeChar(COLUMN_AC, yp, ' ');
 	writeNumber(c._ac._current);
 
+	setTextColor(c.conditionColor());
+	Common::String condStr = c.getConditionString(c.worstCondition());
+	writeString(COLUMN_CONDITION, yp, condStr);
 
 	setTextColor(0);
 }


Commit: 943ff7f9c511849bb03b5e322e5fa333961e9930
    https://github.com/scummvm/scummvm/commit/943ff7f9c511849bb03b5e322e5fa333961e9930
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-07T20:08:48-08:00

Commit Message:
MM: MM1: Allow selecting characters from QuickRef

Changed paths:
    engines/mm/mm1/views_enh/quick_ref.cpp
    engines/mm/mm1/views_enh/quick_ref.h


diff --git a/engines/mm/mm1/views_enh/quick_ref.cpp b/engines/mm/mm1/views_enh/quick_ref.cpp
index b0db247d8b1..dc8fd55c8d6 100644
--- a/engines/mm/mm1/views_enh/quick_ref.cpp
+++ b/engines/mm/mm1/views_enh/quick_ref.cpp
@@ -40,6 +40,16 @@ QuickRef::QuickRef() : ScrollPopup("QuickRef") {
 	setBounds(Common::Rect(0, 0, 320, 146));
 }
 
+bool QuickRef::msgFocus(const FocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_PARTY_MENUS);
+	return ScrollPopup::msgFocus(msg);
+}
+
+bool QuickRef::msgUnfocus(const UnfocusMessage &msg) {
+	MetaEngine::setKeybindingMode(KeybindingMode::KBMODE_MENUS);
+	return ScrollPopup::msgUnfocus(msg);
+}
+
 void QuickRef::draw() {
 	ScrollPopup::draw();
 
@@ -62,7 +72,9 @@ void QuickRef::draw() {
 }
 
 void QuickRef::writeCharacterLine(int charNum) {
-	const Character &c = g_globals->_party[charNum];
+	const Character &c = isInCombat() ?
+		*g_globals->_combatParty[charNum] :
+		g_globals->_party[charNum];
 	const int yp = 30 + (charNum * 10);
 
 	writeChar(COLUMN_NUM, yp, '1' + charNum);
@@ -97,6 +109,38 @@ void QuickRef::writeCharacterLine(int charNum) {
 	setTextColor(0);
 }
 
+bool QuickRef::msgAction(const ActionMessage &msg) {
+	switch (msg._action) {
+	case KEYBIND_VIEW_PARTY1:
+	case KEYBIND_VIEW_PARTY2:
+	case KEYBIND_VIEW_PARTY3:
+	case KEYBIND_VIEW_PARTY4:
+	case KEYBIND_VIEW_PARTY5:
+	case KEYBIND_VIEW_PARTY6:
+	{
+		uint charNum = msg._action - KEYBIND_VIEW_PARTY1;
+		if (charNum < g_globals->_party.size()) {
+			if (isInCombat()) {
+				g_globals->_currCharacter = g_globals->_combatParty[charNum];
+				replaceView("CharacterViewCombat");
+			} else {
+				g_globals->_currCharacter = &g_globals->_party[charNum];
+				replaceView("CharacterInfo");
+			}
+		}
+		break;
+	}
+	default:
+		break;
+	}
+
+	return false;
+}
+
+bool QuickRef::isInCombat() const {
+	return g_events->isPresent("Combat");
+}
+
 } // namespace Views
 } // namespace MM1
 } // namespace MM
diff --git a/engines/mm/mm1/views_enh/quick_ref.h b/engines/mm/mm1/views_enh/quick_ref.h
index 005312ff897..95eccdd3be8 100644
--- a/engines/mm/mm1/views_enh/quick_ref.h
+++ b/engines/mm/mm1/views_enh/quick_ref.h
@@ -35,10 +35,15 @@ private:
 	 * Write the line for a single character
 	 */
 	void writeCharacterLine(int charNum);
+
+	bool isInCombat() const;
 public:
 	QuickRef();
 	virtual ~QuickRef() {}
 
+	bool msgFocus(const FocusMessage &msg) override;
+	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgAction(const ActionMessage &msg) override;
 	void draw() override;
 };
 




More information about the Scummvm-git-logs mailing list