[Scummvm-git-logs] scummvm master -> c52ddc46752ab37d39dcbd9c0409d0f3767a1b3c

dreammaster noreply at scummvm.org
Mon Feb 13 06:21:17 UTC 2023


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

Summary:
ce5a61d8de MM: MM1: In progress displaying enhanced mode party portraits
be0c003f63 MM: MM1: Adding portrait sprites to Character class
c52ddc4675 MM: MM1: Adding party highlight for selected character


Commit: ce5a61d8de5ab6ef4b7641ed127f8ad11174f6ac
    https://github.com/scummvm/scummvm/commit/ce5a61d8de5ab6ef4b7641ed127f8ad11174f6ac
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-12T22:03:09-08:00

Commit Message:
MM: MM1: In progress displaying enhanced mode party portraits

Changed paths:
  A engines/mm/mm1/views_enh/game_party.cpp
  A engines/mm/mm1/views_enh/game_party.h
    engines/mm/mm1/data/character.h
    engines/mm/mm1/events.h
    engines/mm/mm1/views_enh/game.cpp
    engines/mm/mm1/views_enh/game.h
    engines/mm/module.mk
    engines/mm/shared/xeen/sprites.h


diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index 1b6228a7ede..6b7b781e427 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -57,12 +57,21 @@ enum Condition {
 };
 
 enum ConditionEnum {
-	C_GOOD, C_ERADICATED, C_DEAD, C_STONE, C_UNCONSCIOUS,
-	C_PARALYZED, C_POISONED, C_DISEASED, C_SILENCED,
-	C_BLINDED, C_ASLEEP
+	HEART_BROKEN = 1,
+	C_BLINDED = 2,			// WEAK condition in Xeen
+	C_POISONED = 3,
+	C_DISEASED = 4,
+	C_ASLEEP = 8,
+	DEPRESSED = 9,
+	C_SILENCED = 10,		// CONFUSED condition in Xeen
+	C_PARALYZED = 11,
+	C_UNCONSCIOUS = 12,
+	C_DEAD = 13,
+	C_STONE = 14,
+	C_ERADICATED = 15,
+	C_GOOD = 16
 };
 
-
 enum Resistance {
 	RESISTANCE_MAGIC = 0, RESISTANCE_FIRE = 1, RESISTANCE_COLD = 2,
 	RESISTANCE_ELECTRICITY = 3, RESISTANCE_ACID = 4,
diff --git a/engines/mm/mm1/events.h b/engines/mm/mm1/events.h
index fca219678e8..6dd8a13e98e 100644
--- a/engines/mm/mm1/events.h
+++ b/engines/mm/mm1/events.h
@@ -332,6 +332,13 @@ public:
 	 */
 	bool isPresent(const Common::String &name) const;
 
+	/**
+	 * Returns true if combat is active
+	 */
+	bool isInCombat() const {
+		return isPresent("Combat");
+	}
+
 	Graphics::Screen *getScreen() const {
 		return _screen;
 	}
diff --git a/engines/mm/mm1/views_enh/game.cpp b/engines/mm/mm1/views_enh/game.cpp
index c3c27ec7ce3..241edaf137b 100644
--- a/engines/mm/mm1/views_enh/game.cpp
+++ b/engines/mm/mm1/views_enh/game.cpp
@@ -31,7 +31,8 @@ namespace ViewsEnh {
 Game::Game() : TextView("Game"),
 		_view(this),
 		_commands(this),
-		_messages(this) {
+		_messages(this),
+		_party(this) {
 	_view.setBounds(Common::Rect(8, 15, 224, 130));
 
 	// Load the Xeen background
diff --git a/engines/mm/mm1/views_enh/game.h b/engines/mm/mm1/views_enh/game.h
index ab16a7175f6..050a11e67cb 100644
--- a/engines/mm/mm1/views_enh/game.h
+++ b/engines/mm/mm1/views_enh/game.h
@@ -27,6 +27,7 @@
 #include "mm/mm1/views/game_view.h"
 #include "mm/mm1/views_enh/game_commands.h"
 #include "mm/mm1/views_enh/game_messages.h"
+#include "mm/mm1/views_enh/game_party.h"
 
 namespace MM {
 namespace MM1 {
@@ -38,6 +39,7 @@ private:
 	Views::GameView _view;
 	GameCommands _commands;
 	GameMessages _messages;
+	GameParty _party;
 public:
 	Game();
 	virtual ~Game() {}
diff --git a/engines/mm/mm1/views_enh/game_party.cpp b/engines/mm/mm1/views_enh/game_party.cpp
new file mode 100644
index 00000000000..b34f23b4e78
--- /dev/null
+++ b/engines/mm/mm1/views_enh/game_party.cpp
@@ -0,0 +1,101 @@
+/* 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/game_party.h"
+#include "mm/mm1/events.h"
+#include "mm/mm1/globals.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+static const byte CONDITION_COLORS[17] = {
+	9, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32, 32, 6, 6, 6, 6, 15
+};
+
+const byte FACE_CONDITION_FRAMES[17] = {
+	2, 2, 2, 1, 1, 4, 4, 4, 3, 2, 4, 3, 3, 5, 6, 7, 0
+};
+
+const byte CHAR_FACES_X[6] = { 10, 45, 81, 117, 153, 189 };
+
+const byte HP_BARS_X[6] = { 13, 50, 86, 122, 158, 194 };
+
+GameParty::GameParty(UIElement *owner) : TextView("GameParty", owner),
+		_restoreSprites("restorex.icn"),
+		_hpSprites("hpbars.icn"),
+		_dseFace("dse.fac") {
+	setBounds(Common::Rect(0, 144, 234, 200));
+}
+
+void GameParty::draw() {
+	Graphics::ManagedSurface s = getSurface();
+	_restoreSprites.draw(&s, 0, Common::Point(8, 5));
+
+	// Handle drawing the party faces
+	bool inCombat = g_events->isInCombat();
+
+	// Draw character frames
+	for (uint idx = 0; idx < g_globals->_party.size(); ++idx) {
+		const Character &c = inCombat ? *g_globals->_combatParty[idx] : g_globals->_party[idx];
+		ConditionEnum charCondition = c.worstCondition();
+		int charFrame = FACE_CONDITION_FRAMES[charCondition];
+
+//		Shared::Xeen::SpriteResource *sprites = (charFrame > 4) ? &_dseFace : c._faceSprites;
+		Shared::Xeen::SpriteResource *sprites = &_dseFace;
+		assert(sprites);
+		if (charFrame > 4)
+			charFrame -= 5;
+
+		sprites->draw(&s, charFrame, Common::Point(CHAR_FACES_X[idx], 6));
+	}
+
+	for (uint idx = 0; idx < g_globals->_party.size(); ++idx) {
+		const Character &c = inCombat ? *g_globals->_combatParty[idx] : g_globals->_party[idx];
+
+		// Draw the Hp bar
+		int maxHp = c._hpMax;
+		int frame;
+		if (c._hpCurrent < 1)
+			frame = 4;
+		else if (c._hpCurrent > maxHp)
+			frame = 3;
+		else if (c._hpCurrent == maxHp)
+			frame = 0;
+		else if (c._hpCurrent < (maxHp / 4))
+			frame = 2;
+		else
+			frame = 1;
+
+		_hpSprites.draw(&s, frame, Common::Point(HP_BARS_X[idx], 38));
+
+		// Also draw the highlight if character is selected
+
+	}
+	/*
+	if (_hiliteChar != HILIGHT_CHAR_NONE)
+		_globalSprites.draw(&s, 8, Common::Point(CHAR_FACES_X[_hiliteChar] - 1, 149));
+*/
+}
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
diff --git a/engines/mm/mm1/views_enh/game_party.h b/engines/mm/mm1/views_enh/game_party.h
new file mode 100644
index 00000000000..c450a90581e
--- /dev/null
+++ b/engines/mm/mm1/views_enh/game_party.h
@@ -0,0 +1,55 @@
+/* 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_GAME_PARTY_H
+#define MM1_VIEWS_ENH_GAME_PARTY_H
+
+#include "mm/mm1/views_enh/text_view.h"
+#include "mm/shared/xeen/sprites.h"
+
+namespace MM {
+namespace MM1 {
+namespace ViewsEnh {
+
+/**
+ * Handles displaying the party portraits
+ */
+class GameParty : public TextView {
+private:
+	Shared::Xeen::SpriteResource _restoreSprites;
+	Shared::Xeen::SpriteResource _hpSprites;
+	Shared::Xeen::SpriteResource _dseFace;
+
+public:
+	GameParty(UIElement *owner);
+	virtual ~GameParty() {}
+
+	/**
+	 * Draw the view
+	 */
+	void draw() override;
+};
+
+} // namespace ViewsEnh
+} // namespace MM1
+} // namespace MM
+
+#endif
diff --git a/engines/mm/module.mk b/engines/mm/module.mk
index 58596e9ebe8..1b3dc0324dd 100644
--- a/engines/mm/module.mk
+++ b/engines/mm/module.mk
@@ -125,6 +125,7 @@ MODULE_OBJS += \
 	mm1/views_enh/game.o \
 	mm1/views_enh/game_commands.o \
 	mm1/views_enh/game_messages.o \
+	mm1/views_enh/game_party.o \
 	mm1/views_enh/main_menu.o \
 	mm1/views_enh/map.o \
 	mm1/views_enh/map_popup.o \
diff --git a/engines/mm/shared/xeen/sprites.h b/engines/mm/shared/xeen/sprites.h
index c75bea695aa..2edb1649311 100644
--- a/engines/mm/shared/xeen/sprites.h
+++ b/engines/mm/shared/xeen/sprites.h
@@ -109,18 +109,6 @@ public:
 	void draw(XSurface &dest, int frame, const Common::Point &destPos,
 		uint flags = 0, int scale = 0);
 
-	/**
-	 * Draw a sprite onto a given window
-	 * @param windowIndex	Destination window number
-	 * @param frame		Frame number
-	 * @param destPos	Destination position
-	 * @param flags		Flags
-	 * @param scale		Scale: 0=No scale, SCALE_ENLARGE=Enlarge it
-	 *					1..15   -> reduces the sprite: the higher, the smaller it'll be
-	 */
-	void draw(int windowIndex, int frame, const Common::Point &destPos,
-		uint flags = 0, int scale = 0);
-
 	/**
 	 * Draw the sprite onto the given surface
 	 * @param dest		Destination surface


Commit: be0c003f63efe62b5450f11ed26b290893de86ed
    https://github.com/scummvm/scummvm/commit/be0c003f63efe62b5450f11ed26b290893de86ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-12T22:18:32-08:00

Commit Message:
MM: MM1: Adding portrait sprites to Character class

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


diff --git a/engines/mm/mm1/data/character.cpp b/engines/mm/mm1/data/character.cpp
index 9662ce22830..bf10e525af3 100644
--- a/engines/mm/mm1/data/character.cpp
+++ b/engines/mm/mm1/data/character.cpp
@@ -228,6 +228,11 @@ void Character::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_alignmentCtr);
 	s.syncBytes(_flags, 14);
 	s.syncAsByte(_portrait);
+
+	if (s.isLoading() && g_engine->isEnhanced()) {
+		Common::String name = Common::String::format("char%02d.fac", _portrait + 1);
+		_faceSprites.load(name);
+	}
 }
 
 void Character::clear() {
diff --git a/engines/mm/mm1/data/character.h b/engines/mm/mm1/data/character.h
index 6b7b781e427..095c6309ab8 100644
--- a/engines/mm/mm1/data/character.h
+++ b/engines/mm/mm1/data/character.h
@@ -25,6 +25,7 @@
 #include "common/array.h"
 #include "common/serializer.h"
 #include "mm/mm1/data/items.h"
+#include "mm/shared/xeen/sprites.h"
 
 namespace MM {
 namespace MM1 {
@@ -456,7 +457,9 @@ struct Character : public PrimaryAttributes {
 	byte _worthiness = 0;
 	byte _alignmentCtr = 0;
 	byte _flags[14];
+
 	byte _portrait = 0;
+	Shared::Xeen::SpriteResource _faceSprites;
 
 	// Non persistent fields
 	byte _numDrinks = 0;
diff --git a/engines/mm/mm1/views_enh/game_party.cpp b/engines/mm/mm1/views_enh/game_party.cpp
index b34f23b4e78..0221dd2cbc1 100644
--- a/engines/mm/mm1/views_enh/game_party.cpp
+++ b/engines/mm/mm1/views_enh/game_party.cpp
@@ -55,12 +55,11 @@ void GameParty::draw() {
 
 	// Draw character frames
 	for (uint idx = 0; idx < g_globals->_party.size(); ++idx) {
-		const Character &c = inCombat ? *g_globals->_combatParty[idx] : g_globals->_party[idx];
+		Character &c = inCombat ? *g_globals->_combatParty[idx] : g_globals->_party[idx];
 		ConditionEnum charCondition = c.worstCondition();
 		int charFrame = FACE_CONDITION_FRAMES[charCondition];
 
-//		Shared::Xeen::SpriteResource *sprites = (charFrame > 4) ? &_dseFace : c._faceSprites;
-		Shared::Xeen::SpriteResource *sprites = &_dseFace;
+		Shared::Xeen::SpriteResource *sprites = (charFrame > 4) ? &_dseFace : &c._faceSprites;
 		assert(sprites);
 		if (charFrame > 4)
 			charFrame -= 5;


Commit: c52ddc46752ab37d39dcbd9c0409d0f3767a1b3c
    https://github.com/scummvm/scummvm/commit/c52ddc46752ab37d39dcbd9c0409d0f3767a1b3c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-02-12T22:20:51-08:00

Commit Message:
MM: MM1: Adding party highlight for selected character

Changed paths:
    engines/mm/mm1/views_enh/game_party.cpp


diff --git a/engines/mm/mm1/views_enh/game_party.cpp b/engines/mm/mm1/views_enh/game_party.cpp
index 0221dd2cbc1..913bc8b32da 100644
--- a/engines/mm/mm1/views_enh/game_party.cpp
+++ b/engines/mm/mm1/views_enh/game_party.cpp
@@ -87,12 +87,9 @@ void GameParty::draw() {
 		_hpSprites.draw(&s, frame, Common::Point(HP_BARS_X[idx], 38));
 
 		// Also draw the highlight if character is selected
-
+		if (g_globals->_currCharacter == &c)
+			g_globals->_globalSprites.draw(&s, 8, Common::Point(CHAR_FACES_X[idx] - 1, 5));
 	}
-	/*
-	if (_hiliteChar != HILIGHT_CHAR_NONE)
-		_globalSprites.draw(&s, 8, Common::Point(CHAR_FACES_X[_hiliteChar] - 1, 149));
-*/
 }
 
 } // namespace ViewsEnh




More information about the Scummvm-git-logs mailing list