[Scummvm-git-logs] scummvm master -> 21a00458283f12c7bebb473e609c8e6523fae097

dreammaster dreammaster at scummvm.org
Sun Mar 18 19:36:32 CET 2018


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:
b0bb560138 XEEN: Properly write party character data when saving the game
21a0045828 XEEN: Fix display of Spells list dialog within Guild shops


Commit: b0bb560138f1f1415654a540cdc8fd51fef13501
    https://github.com/scummvm/scummvm/commit/b0bb560138f1f1415654a540cdc8fd51fef13501
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-18T14:33:03-04:00

Commit Message:
XEEN: Properly write party character data when saving the game

Changed paths:
    engines/xeen/party.cpp


diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 83490ab..8e94c93 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -54,6 +54,14 @@ Roster::Roster() {
 }
 
 void Roster::synchronize(Common::Serializer &s) {
+	Party &party = *g_vm->_party;
+
+	if (s.isSaving()) {
+		// Copy out the party's characters back to the roster
+		for (uint idx = 0; idx < party._activeParty.size(); ++idx)
+			(*this)[party._activeParty[idx]._rosterId] = party._activeParty[idx];
+	}
+
 	for (uint i = 0; i < TOTAL_CHARACTERS; ++i)
 		(*this)[i].synchronize(s);
 }


Commit: 21a00458283f12c7bebb473e609c8e6523fae097
    https://github.com/scummvm/scummvm/commit/21a00458283f12c7bebb473e609c8e6523fae097
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-18T14:35:22-04:00

Commit Message:
XEEN: Fix display of Spells list dialog within Guild shops

Changed paths:
    engines/xeen/dialogs/dialogs_spells.cpp
    engines/xeen/dialogs/dialogs_spells.h
    engines/xeen/locations.cpp


diff --git a/engines/xeen/dialogs/dialogs_spells.cpp b/engines/xeen/dialogs/dialogs_spells.cpp
index 9148c41..5842416 100644
--- a/engines/xeen/dialogs/dialogs_spells.cpp
+++ b/engines/xeen/dialogs/dialogs_spells.cpp
@@ -46,6 +46,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
 	Sound &sound = *_vm->_sound;
 	Spells &spells = *_vm->_spells;
 	Windows &windows = *_vm->_windows;
+	Window &w = windows[25];
 	int ccNum = _vm->_files->_ccNum;
 	loadButtons();
 
@@ -54,7 +55,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
 	int selection = -1;
 	int topIndex = 0;
 	int newSelection;
-	windows[25].open();
+	w.open();
 
 	do {
 		if (!isCasting) {
@@ -69,13 +70,12 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
 			Common::String msg = Common::String::format(Res.GUILD_OPTIONS,
 				title.c_str(), XeenEngine::printMil(party._gold).c_str());
 			windows[10].writeString(msg);
-
-			warning("TODO: Sprite draw using previously used button sprites");
+			priorDialog->drawButtons(&windows[10]);
 		}
 
 		_spells.clear();
 		const char *errorMsg = setSpellText(c, castingCopy);
-		windows[25].writeString(Common::String::format(Res.SPELLS_FOR,
+		w.writeString(Common::String::format(Res.SPELLS_FOR,
 			errorMsg == nullptr ? Res.SPELL_LINES_0_TO_9 : "",
 			c->_name.c_str()));
 
@@ -111,9 +111,9 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
 		_scrollSprites.draw(0, 0, Common::Point(187, 26));
 		_scrollSprites.draw(0, 2, Common::Point(187, 111));
 		if (isCasting)
-			_scrollSprites.draw(windows[25], 5, Common::Point(132, 123));
+			_scrollSprites.draw(w, 5, Common::Point(132, 123));
 
-		windows[25].update();
+		w.update();
 
 		do {
 			events.pollEventsAndWait();
@@ -273,7 +273,7 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
 		}
 	} while (!_vm->shouldExit() && _buttonValue != Common::KEYCODE_ESCAPE);
 
-	windows[25].close();
+	w.close();
 
 	if (_vm->shouldExit())
 		selection = -1;
@@ -379,9 +379,10 @@ const char *SpellsDialog::setSpellText(Character *c, int isCasting) {
 				for (int spellId = 0; spellId < 20; ++spellId) {
 					int idx = 0;
 					while (Res.CLOUDS_SPELL_OFFSETS[party._mazeId - 29][spellId] !=
-						(int)Res.SPELLS_ALLOWED[category][idx] && idx < 40) ;
+						(int)Res.SPELLS_ALLOWED[category][idx] && idx <= MAX_SPELLS_PER_CLASS)
+						++idx;
 
-					if (idx < 40) {
+					if (idx <= MAX_SPELLS_PER_CLASS) {
 						if (!c->_spells[idx] || (isCasting & 0x80)) {
 							int cost = spells.calcSpellCost(Res.SPELLS_ALLOWED[category][idx], expenseFactor);
 							_spells.push_back(SpellEntry(Common::String::format("\x3l%s\x3r\x9""000%u",
diff --git a/engines/xeen/dialogs/dialogs_spells.h b/engines/xeen/dialogs/dialogs_spells.h
index 2bcaef4..bbe8fae 100644
--- a/engines/xeen/dialogs/dialogs_spells.h
+++ b/engines/xeen/dialogs/dialogs_spells.h
@@ -39,20 +39,39 @@ struct SpellEntry {
 		_name(name), _spellIndex(spellIndex), _spellId(spellId), _color(9) {}
 };
 
+/**
+ * Spells list dialog. Used for both selecting spells to cast, as well as the
+ * spells listing when visiting Guild locations
+ */
 class SpellsDialog : public ButtonContainer {
 private:
 	SpriteResource _iconSprites;
 	SpriteResource _scrollSprites;
 	Common::Array<SpellEntry> _spells;
 
+	/**
+	 * Constructor
+	 */
 	SpellsDialog(XeenEngine *vm) : ButtonContainer(vm) {}
 
+	/**
+	 * Executes the dialog
+	 */
 	Character *execute(ButtonContainer *priorDialog, Character *c, int isCasting);
 
+	/**
+	 * Loads buttons for the dialog
+	 */
 	void loadButtons();
 
+	/**
+	 * Sets the spell text
+	 */
 	const char *setSpellText(Character *c, int isCasting);
 public:
+	/**
+	 * Show the spells list dialog
+	 */
 	static Character *show(XeenEngine *vm, ButtonContainer *priorDialog,
 		Character *c, int isCasting);
 };
diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp
index 7043f4a..e0fd9df 100644
--- a/engines/xeen/locations.cpp
+++ b/engines/xeen/locations.cpp
@@ -529,12 +529,12 @@ Character *GuildLocation::doOptions(Character *c) {
 		}
 	} else if (_buttonValue == Common::KEYCODE_s) {
 		if (c->guildMember())
-			c = SpellsDialog::show(_vm, nullptr, c, 0x80);
+			c = SpellsDialog::show(_vm, this, c, 0x80);
 		_buttonValue = 0;
-	} else if (_buttonValue == Common::KEYCODE_c) {
+	} else if (_buttonValue == Common::KEYCODE_b) {
 		if (!c->noActions()) {
 			if (c->guildMember())
-				c = SpellsDialog::show(_vm, nullptr, c, 0);
+				c = SpellsDialog::show(_vm, this, c, 0);
 			_buttonValue = 0;
 		}
 	}





More information about the Scummvm-git-logs mailing list