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

dreammaster noreply at scummvm.org
Fri Mar 31 02:46:58 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:
3d425ddad8 MM: MM1: Draw interface background when char info opened from combat
c06cdb5213 MM: MM1: Fixes for using inventory items


Commit: 3d425ddad8687f4a4680c6cc9706e768f8f676c3
    https://github.com/scummvm/scummvm/commit/3d425ddad8687f4a4680c6cc9706e768f8f676c3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-30T19:19:34-07:00

Commit Message:
MM: MM1: Draw interface background when char info opened from combat

Changed paths:
    engines/mm/mm1/globals.cpp
    engines/mm/mm1/globals.h
    engines/mm/mm1/views_enh/character_info.cpp
    engines/mm/mm1/views_enh/game.cpp
    engines/mm/mm1/views_enh/game.h
    engines/mm/mm1/views_enh/game_party.cpp


diff --git a/engines/mm/mm1/globals.cpp b/engines/mm/mm1/globals.cpp
index 198fb6d3ef6..833cfb1e36c 100644
--- a/engines/mm/mm1/globals.cpp
+++ b/engines/mm/mm1/globals.cpp
@@ -81,6 +81,15 @@ bool Globals::load(bool isEnhanced) {
 
 		createBlankButton();
 
+		{
+			// Load the Xeen game screen background
+			Common::File f;
+			if (!f.open("back.raw"))
+				error("Could not load background");
+			_gameBackground.create(320, 200);
+			f.read(_gameBackground.getPixels(), 320 * 200);
+		}
+
 		{
 			Common::File f;
 			if (!f.open("symbols.bin"))
diff --git a/engines/mm/mm1/globals.h b/engines/mm/mm1/globals.h
index a32db31598d..c2c0730141c 100644
--- a/engines/mm/mm1/globals.h
+++ b/engines/mm/mm1/globals.h
@@ -77,6 +77,7 @@ public:
 	Shared::Xeen::SpriteResource _tileSprites;
 	Shared::Xeen::SpriteResource _escSprites;
 	Graphics::ManagedSurface _blankButton;
+	Graphics::ManagedSurface _gameBackground;
 	byte SYMBOLS[20][64];
 	XeenFont _fontNormal;
 	XeenFont _fontReduced;
diff --git a/engines/mm/mm1/views_enh/character_info.cpp b/engines/mm/mm1/views_enh/character_info.cpp
index 23c39b64aa6..ea783646190 100644
--- a/engines/mm/mm1/views_enh/character_info.cpp
+++ b/engines/mm/mm1/views_enh/character_info.cpp
@@ -195,6 +195,7 @@ bool CharacterInfo::msgMouseUp(const MouseUpMessage &msg) {
 
 void CharacterInfo::draw() {
 	ScrollView::draw();
+
 	drawTitle();
 	drawIcons();
 	drawStats();
diff --git a/engines/mm/mm1/views_enh/game.cpp b/engines/mm/mm1/views_enh/game.cpp
index 50efb1e192e..98fdcbab12d 100644
--- a/engines/mm/mm1/views_enh/game.cpp
+++ b/engines/mm/mm1/views_enh/game.cpp
@@ -33,13 +33,6 @@ Game::Game() : TextView("Game"),
 		_commands(this),
 		_party(this) {
 	_view.setBounds(Common::Rect(8, 15, 224, 130));
-
-	// Load the Xeen background
-	Common::File f;
-	if (!f.open("back.raw"))
-		error("Could not load background");
-	_bg.create(320, 200);
-	f.read(_bg.getPixels(), 320 * 200);
 }
 
 bool Game::msgFocus(const FocusMessage &msg) {
@@ -54,7 +47,7 @@ bool Game::msgUnfocus(const UnfocusMessage &msg) {
 
 void Game::draw() {
 	Graphics::ManagedSurface s = getSurface();
-	s.blitFrom(_bg);
+	s.blitFrom(g_globals->_gameBackground);
 
 	UIElement::draw();
 }
diff --git a/engines/mm/mm1/views_enh/game.h b/engines/mm/mm1/views_enh/game.h
index 252e23ad955..7a6c4a69a4b 100644
--- a/engines/mm/mm1/views_enh/game.h
+++ b/engines/mm/mm1/views_enh/game.h
@@ -35,7 +35,6 @@ namespace ViewsEnh {
 
 class Game : public Views::TextView {
 private:
-	Graphics::ManagedSurface _bg;
 	ViewsEnh::GameView _view;
 	GameCommands _commands;
 	GameParty _party;
diff --git a/engines/mm/mm1/views_enh/game_party.cpp b/engines/mm/mm1/views_enh/game_party.cpp
index 3a12dea7c6f..41657876021 100644
--- a/engines/mm/mm1/views_enh/game_party.cpp
+++ b/engines/mm/mm1/views_enh/game_party.cpp
@@ -50,6 +50,11 @@ GameParty::GameParty(UIElement *owner) : TextView("GameParty", owner),
 
 void GameParty::draw() {
 	Graphics::ManagedSurface s = getSurface();
+
+	// Draw Xeen background
+	s.blitFrom(g_globals->_gameBackground, Common::Rect(0, 144, 320, 200),
+		Common::Point(0, 0));
+
 	_restoreSprites.draw(&s, 0, Common::Point(8, 5));
 
 	// Handle drawing the party faces


Commit: c06cdb5213baf5f64cbac87dc370f2beeb3230bf
    https://github.com/scummvm/scummvm/commit/c06cdb5213baf5f64cbac87dc370f2beeb3230bf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-03-30T19:46:53-07:00

Commit Message:
MM: MM1: Fixes for using inventory items

Changed paths:
    devtools/create_mm/files/mm1/strings_en.yml
    engines/mm/mm1/views_enh/character_info.cpp
    engines/mm/mm1/views_enh/character_info.h
    engines/mm/mm1/views_enh/character_inventory.cpp


diff --git a/devtools/create_mm/files/mm1/strings_en.yml b/devtools/create_mm/files/mm1/strings_en.yml
index ca5e43f0037..6f836ca883d 100644
--- a/devtools/create_mm/files/mm1/strings_en.yml
+++ b/devtools/create_mm/files/mm1/strings_en.yml
@@ -52,15 +52,15 @@ dialogs:
 		cast_spell: "cast spell:  level="
 		number: "number="
 		use_combat:
-			use_no_special_power: "no special power"
-			use_not_equipped: "not equipped"
-			no_charges_left: "no charges left"
-			done: "done"
+			no_special_power: "No special power"
+			not_equipped: "Not equipped"
+			no_charges_left: "No charges left"
+			done: "Done"
 		use_noncombat:
-			no_special_power: "*** no special power ***"
-			not_equipped: "*** not equipped ***"
-			no_charges_left: "*** no charges left ***"
-			done: "*** done ***"
+			no_special_power: "*** No special power ***"
+			not_equipped: "*** Not equipped ***"
+			no_charges_left: "*** No charges left ***"
+			done: "*** Done ***"
 	create_characters:
 		title: "Create New Characters"
 		intellect: "intellect...="
diff --git a/engines/mm/mm1/views_enh/character_info.cpp b/engines/mm/mm1/views_enh/character_info.cpp
index ea783646190..3f779ace135 100644
--- a/engines/mm/mm1/views_enh/character_info.cpp
+++ b/engines/mm/mm1/views_enh/character_info.cpp
@@ -94,6 +94,15 @@ bool CharacterInfo::msgUnfocus(const UnfocusMessage &msg) {
 	return PartyView::msgUnfocus(msg);
 }
 
+bool CharacterInfo::msgGame(const GameMessage &msg) {
+	if (msg._name == "USE") {
+		g_events->send("CharacterInventory", GameMessage("USE"));
+		return true;
+	}
+
+	return false;
+}
+
 bool CharacterInfo::msgKeypress(const KeypressMessage &msg) {
 	int idx;
 
diff --git a/engines/mm/mm1/views_enh/character_info.h b/engines/mm/mm1/views_enh/character_info.h
index 7e4f0912e02..b7a874665d1 100644
--- a/engines/mm/mm1/views_enh/character_info.h
+++ b/engines/mm/mm1/views_enh/character_info.h
@@ -78,6 +78,7 @@ public:
 
 	bool msgFocus(const FocusMessage &msg) override;
 	bool msgUnfocus(const UnfocusMessage &msg) override;
+	bool msgGame(const GameMessage &msg) override;
 	bool msgKeypress(const KeypressMessage &msg) override;
 	bool msgAction(const ActionMessage &msg) override;
 	bool msgMouseUp(const MouseUpMessage &msg) override;
diff --git a/engines/mm/mm1/views_enh/character_inventory.cpp b/engines/mm/mm1/views_enh/character_inventory.cpp
index 6c9776e915b..a7b3203ba22 100644
--- a/engines/mm/mm1/views_enh/character_inventory.cpp
+++ b/engines/mm/mm1/views_enh/character_inventory.cpp
@@ -53,8 +53,10 @@ bool CharacterInventory::msgFocus(const FocusMessage &msg) {
 
 	if (dynamic_cast<WhichItem *>(msg._priorView) == nullptr &&
 		dynamic_cast<Trade *>(msg._priorView) == nullptr &&
-		dynamic_cast<GameMessages *>(msg._priorView) == nullptr)
+		dynamic_cast<GameMessages *>(msg._priorView) == nullptr) {
 		_mode = BACKPACK_MODE;
+		_selectedButton = BTN_NONE;
+	}
 	populateItems();
 
 	return true;
@@ -75,6 +77,10 @@ bool CharacterInventory::msgGame(const GameMessage &msg) {
 		if (msg._value != -1)
 			trade(_tradeMode, _tradeAmount, &g_globals->_party[msg._value]);
 		return true;
+	} else if (msg._name == "USE") {
+		// Combat use item mode
+		addView();
+		return true;
 	}
 
 	return ItemsView::msgGame(msg);
@@ -154,7 +160,6 @@ bool CharacterInventory::msgAction(const ActionMessage &msg) {
 void CharacterInventory::populateItems() {
 	_items.clear();
 	_selectedItem = -1;
-	_selectedButton = BTN_NONE;
 
 	const Character &c = *g_globals->_currCharacter;
 	const Inventory &inv = (_mode == ARMS_MODE) ? c._equipped : c._backpack;
@@ -184,7 +189,7 @@ void CharacterInventory::charSwitched(Character *priorChar) {
 }
 
 void CharacterInventory::itemSelected() {
-	if (g_events->isInCombat() && dynamic_cast<Combat *>(g_events) != nullptr) {
+	if (g_events->isInCombat() && dynamic_cast<Combat *>(g_events->priorView()) != nullptr) {
 		useItem();
 	}
 }
@@ -269,6 +274,8 @@ void CharacterInventory::useItem() {
 		msg = Game::UseItem::combatUseItem(inv, *invEntry, _mode == BACKPACK_MODE);
 	else
 		msg = Game::UseItem::nonCombatUseItem(inv, *invEntry, _mode == BACKPACK_MODE);
+
+	displayMessage(msg);
 }
 
 void CharacterInventory::discardItem() {




More information about the Scummvm-git-logs mailing list