[Scummvm-git-logs] scummvm master -> 883fd87e8f665c5621f88d7ca8e0c27cbc274ed8

dreammaster dreammaster at scummvm.org
Sat Nov 25 03:10:30 CET 2017


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

Summary:
883fd87e8f XEEN: Fixes for blacksmith wares initialization and rendering


Commit: 883fd87e8f665c5621f88d7ca8e0c27cbc274ed8
    https://github.com/scummvm/scummvm/commit/883fd87e8f665c5621f88d7ca8e0c27cbc274ed8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-11-24T21:10:22-05:00

Commit Message:
XEEN: Fixes for blacksmith wares initialization and rendering

Changed paths:
    engines/xeen/dialogs_items.cpp
    engines/xeen/party.cpp
    engines/xeen/resources.cpp
    engines/xeen/resources.h


diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 78a63c1..5cc8181 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -223,18 +223,14 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
 				));
 				break;
 
-			case ITEMMODE_BLACKSMITH: {
-				// TODO: Original uses var in this block that's never set?!
-				const int v1 = 0;
+			case ITEMMODE_BLACKSMITH:
 				screen._windows[30].writeString(Common::String::format(Res.AVAILABLE_GOLD_COST,
-					Res.CATEGORY_NAMES[category],
-					v1 ? "" : "s", party._gold,
+					Res.CATEGORY_NAMES[category], party._gold,
 					lines[0].c_str(), lines[1].c_str(), lines[2].c_str(), lines[3].c_str(),
 					lines[4].c_str(), lines[5].c_str(), lines[6].c_str(), lines[7].c_str(),
 					lines[8].c_str()
 				));
 				break;
-			}
 
 			case ITEMMODE_2:
 			case ITEMMODE_RECHARGE:
@@ -618,7 +614,7 @@ void ItemsDialog::setEquipmentIcons() {
 	for (int typeIndex = 0; typeIndex < 4; ++typeIndex) {
 		for (int idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
 			switch (typeIndex) {
-			case 0: {
+			case CATEGORY_WEAPON: {
 				XeenItem &i = _itemsCharacter._weapons[idx];
 				if (i._id <= 17)
 					i._frame = 1;
@@ -629,7 +625,7 @@ void ItemsDialog::setEquipmentIcons() {
 				break;
 			}
 
-			case 1: {
+			case CATEGORY_ARMOR: {
 				XeenItem &i = _itemsCharacter._armor[idx];
 				if (i._id <= 7)
 					i._frame = 3;
@@ -644,7 +640,7 @@ void ItemsDialog::setEquipmentIcons() {
 				break;
 			}
 
-			case 2: {
+			case CATEGORY_ACCESSORY: {
 				XeenItem &i = _itemsCharacter._accessories[idx];
 				if (i._id == 1)
 					i._id = 8;
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 45b85f2..5ed2ea8 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -1439,7 +1439,7 @@ void Party::resetBlacksmithWares() {
 				int itemCat = c.makeItem(idx2 + 1, 0, 0);
 				if (catCount[itemCat] < 8) {
 					switch (itemCat) {
-					case 0: {
+					case CATEGORY_WEAPON: {
 						XeenItem &item = _blacksmithWeapons[0][catCount[itemCat] * 4 + idx1];
 						item._id = c._weapons[0]._id;
 						item._material = c._weapons[0]._material;
@@ -1447,27 +1447,27 @@ void Party::resetBlacksmithWares() {
 						break;
 					}
 
-					case 1: {
+					case CATEGORY_ARMOR: {
 						XeenItem &item = _blacksmithArmor[0][catCount[itemCat] * 4 + idx1];
-						item._id = c._weapons[0]._id;
-						item._material = c._weapons[0]._material;
-						item._bonusFlags = c._weapons[0]._bonusFlags;
+						item._id = c._armor[0]._id;
+						item._material = c._armor[0]._material;
+						item._bonusFlags = c._armor[0]._bonusFlags;
 						break;
 					}
 
-					case 2: {
+					case CATEGORY_ACCESSORY: {
 						XeenItem &item = _blacksmithAccessories[0][catCount[itemCat] * 4 + idx1];
-						item._id = c._weapons[0]._id;
-						item._material = c._weapons[0]._material;
-						item._bonusFlags = c._weapons[0]._bonusFlags;
+						item._id = c._accessories[0]._id;
+						item._material = c._accessories[0]._material;
+						item._bonusFlags = c._accessories[0]._bonusFlags;
 						break;
 					}
 
-					case 3: {
+					case CATEGORY_MISC: {
 						XeenItem &item = _blacksmithMisc[0][catCount[itemCat] * 4 + idx1];
-						item._id = c._weapons[0]._id;
-						item._material = c._weapons[0]._material;
-						item._bonusFlags = c._weapons[0]._bonusFlags;
+						item._id = c._misc[0]._id;
+						item._material = c._misc[0]._material;
+						item._bonusFlags = c._misc[0]._bonusFlags;
 						break;
 					}
 
@@ -1489,7 +1489,7 @@ void Party::resetBlacksmithWares() {
 				int itemCat = c.makeItem(idx2 + (idx1 >= 2 ? 3 : 1), 0, 0);
 				if (catCount[itemCat] < 8) {
 					switch (itemCat) {
-					case 0: {
+					case CATEGORY_WEAPON: {
 						XeenItem &item = _blacksmithWeapons[1][catCount[itemCat] * 4 + idx1];
 						item._id = c._weapons[0]._id;
 						item._material = c._weapons[0]._material;
@@ -1497,27 +1497,27 @@ void Party::resetBlacksmithWares() {
 						break;
 					}
 
-					case 1: {
+					case CATEGORY_ARMOR: {
 						XeenItem &item = _blacksmithArmor[1][catCount[itemCat] * 4 + idx1];
-						item._id = c._weapons[0]._id;
-						item._material = c._weapons[0]._material;
-						item._bonusFlags = c._weapons[0]._bonusFlags;
+						item._id = c._armor[0]._id;
+						item._material = c._armor[0]._material;
+						item._bonusFlags = c._armor[0]._bonusFlags;
 						break;
 					}
 
-					case 2: {
+					case CATEGORY_ACCESSORY: {
 						XeenItem &item = _blacksmithAccessories[1][catCount[itemCat] * 4 + idx1];
-						item._id = c._weapons[0]._id;
-						item._material = c._weapons[0]._material;
-						item._bonusFlags = c._weapons[0]._bonusFlags;
+						item._id = c._accessories[0]._id;
+						item._material = c._accessories[0]._material;
+						item._bonusFlags = c._accessories[0]._bonusFlags;
 						break;
 					}
 
-					case 3: {
+					case CATEGORY_MISC: {
 						XeenItem &item = _blacksmithMisc[1][catCount[itemCat] * 4 + idx1];
-						item._id = c._weapons[0]._id;
-						item._material = c._weapons[0]._material;
-						item._bonusFlags = c._weapons[0]._bonusFlags;
+						item._id = c._misc[0]._id;
+						item._material = c._misc[0]._material;
+						item._bonusFlags = c._misc[0]._bonusFlags;
 						break;
 					}
 
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index b48f4ac..142d119 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -1130,7 +1130,7 @@ const char *const Resources::WEAPON_NAMES[35] = {
 };
 
 const char *const Resources::ARMOR_NAMES[14] = {
-	nullptr, "Robes ", "Scale rmor ", "ring mail ", "chain mail ",
+	nullptr, "robes ", "sale armor ", "ring mail ", "chain mail ",
 	"splint mail ", "plate mail ", "plate armor ", "shield ",
 	"helm ", "boots ", "cloak ", "cape ", "gauntlets "
 };
@@ -1258,7 +1258,7 @@ const int Resources::WEAPON_BASE_COSTS[35] = {
 	100, 15, 30, 15, 200, 80, 250, 150, 400, 100, 40, 120,
 	300, 100, 200, 300, 25, 100, 50, 15, 0
 };
-const int Resources::ARMOR_BASE_COSTS[25] = {
+const int Resources::ARMOR_BASE_COSTS[14] = {
 	0, 20, 100, 200, 400, 600, 1000, 2000, 100, 60, 40, 250, 200, 100
 };
 const int Resources::ACCESSORY_BASE_COSTS[11] = {
@@ -1314,7 +1314,7 @@ const char *const Resources::X_FOR_Y_GOLD =
 const char *const Resources::FMT_CHARGES = "\x3rr\t000Charges\x3l";
 
 const char *const Resources::AVAILABLE_GOLD_COST =
-	"\x1\fd\r\x3l\v000\t000Available %s%s\t150Gold - %lu\x3r\t000Cost"
+	"\x1\fd\r\x3l\v000\t000Available %s\t150Gold - %lu\x3r\t000Cost"
 	"\x3l\v011\x2%s%s%s%s%s%s%s%s%s\x1\xC""d";
 
 const char *const Resources::CHARGES = "Charges";
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index aa19baa..4b59ac6 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -233,7 +233,7 @@ public:
 	static const char *const EFFECTIVENESS_NAMES[7];
 	static const char *const QUEST_ITEM_NAMES[85];
 	static const int WEAPON_BASE_COSTS[35];
-	static const int ARMOR_BASE_COSTS[25];
+	static const int ARMOR_BASE_COSTS[14];
 	static const int ACCESSORY_BASE_COSTS[11];
 	static const int MISC_MATERIAL_COSTS[22];
 	static const int MISC_BASE_COSTS[76];





More information about the Scummvm-git-logs mailing list