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

dreammaster dreammaster at scummvm.org
Sun Feb 25 03:18:20 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:
72e540e203 XEEN: Add difficulty selection dialog to WOX starting menu
da65468c47 XEEN: Set correct starting date for each game


Commit: 72e540e203a0fa6c1fbf8c05860d375e4bae094e
    https://github.com/scummvm/scummvm/commit/72e540e203a0fa6c1fbf8c05860d375e4bae094e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-24T21:17:44-05:00

Commit Message:
XEEN: Add difficulty selection dialog to WOX starting menu

Changed paths:
  A dists/engine-data/dark.cc
  A engines/xeen/dialogs_difficulty.cpp
  A engines/xeen/dialogs_difficulty.h
    devtools/create_xeen/constants.cpp
    dists/engine-data/xeen.ccs
    engines/xeen/combat.cpp
    engines/xeen/module.mk
    engines/xeen/resources.cpp
    engines/xeen/resources.h
    engines/xeen/worldofxeen/worldofxeen_menu.cpp


diff --git a/devtools/create_xeen/constants.cpp b/devtools/create_xeen/constants.cpp
index 8fc5b92..ef2b16c 100644
--- a/devtools/create_xeen/constants.cpp
+++ b/devtools/create_xeen/constants.cpp
@@ -1767,6 +1767,8 @@ const char *const MUSIC_FILES2[6][7] = {
 	{ "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m", "sf05.m" }
 };
 
+const char *const DIFFICULTY_TEXT = "\v000\t000\x3""cSelect Game Preference";
+
 void writeConstants(CCArchive &cc) {
 	Common::MemFile file;
 	file.syncString(CREDITS);
@@ -2093,6 +2095,7 @@ void writeConstants(CCArchive &cc) {
 	file.syncStrings(GOOBER, 3);
 	file.syncStrings(MUSIC_FILES1, 5);
 	file.syncStrings2D((const char *const *)MUSIC_FILES2, 6, 7);
+	file.syncString(DIFFICULTY_TEXT);
 
 	cc.add("CONSTANTS", file);
 }
diff --git a/dists/engine-data/dark.cc b/dists/engine-data/dark.cc
new file mode 100644
index 0000000..875ed74
Binary files /dev/null and b/dists/engine-data/dark.cc differ
diff --git a/dists/engine-data/xeen.ccs b/dists/engine-data/xeen.ccs
index 1561baa..46d09c3 100644
Binary files a/dists/engine-data/xeen.ccs and b/dists/engine-data/xeen.ccs differ
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 2f512f6..32984c1 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -1708,7 +1708,7 @@ void Combat::getWeaponDamage(Character &c, RangeType rangeType) {
 
 	if (_weaponDamage < 1)
 		_weaponDamage = 0;
-	if (!party._difficulty) {
+	if (party._difficulty == ADVENTURER) {
 		_hitChanceBonus += 5;
 		_weaponDamage *= 3;
 	}
diff --git a/engines/xeen/dialogs_difficulty.cpp b/engines/xeen/dialogs_difficulty.cpp
new file mode 100644
index 0000000..e7c7445
--- /dev/null
+++ b/engines/xeen/dialogs_difficulty.cpp
@@ -0,0 +1,77 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "xeen/dialogs_difficulty.h"
+#include "xeen/resources.h"
+#include "xeen/xeen.h"
+
+namespace Xeen {
+
+int DifficultyDialog::show(XeenEngine *vm) {
+	DifficultyDialog *dlg = new DifficultyDialog(vm);
+	int result = dlg->execute();
+	delete dlg;
+
+	return result;
+}
+
+DifficultyDialog::DifficultyDialog(XeenEngine *vm) : ButtonContainer(vm) {
+	loadButtons();
+}
+
+int DifficultyDialog::execute() {
+	EventsManager &events = *_vm->_events;
+	Interface &intf = *_vm->_interface;
+	Party &party = *_vm->_party;
+	Windows &windows = *_vm->_windows;
+
+	Window &w = windows[6];
+	w.open();
+	w.writeString(Res.DIFFICULTY_TEXT);
+	drawButtons(&w);
+
+	int result = -1;
+	while (!_vm->shouldExit()) {
+		events.pollEventsAndWait();
+		checkEvents(_vm);
+
+		if (_buttonValue == Common::KEYCODE_a)
+			result = ADVENTURER;
+		else if (_buttonValue == Common::KEYCODE_w)
+			result = WARRIOR;
+		else if (_buttonValue != Common::KEYCODE_ESCAPE)
+			continue;
+
+		break;
+	}
+
+	w.close();
+	return result;
+}
+
+void DifficultyDialog::loadButtons() {
+	_sprites.load("choice.icn");
+	addButton(Common::Rect(68, 167, 158, 187), Common::KEYCODE_a, &_sprites);
+	addButton(Common::Rect(166, 167, 256, 187), Common::KEYCODE_w, &_sprites);
+}
+
+} // End of namespace Xeen
diff --git a/engines/xeen/dialogs_difficulty.h b/engines/xeen/dialogs_difficulty.h
new file mode 100644
index 0000000..e0771a5
--- /dev/null
+++ b/engines/xeen/dialogs_difficulty.h
@@ -0,0 +1,60 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_DIALOGS_DIFFICULTY_H
+#define XEEN_DIALOGS_DIFFICULTY_H
+
+#include "xeen/dialogs.h"
+#include "xeen/party.h"
+
+namespace Xeen {
+
+class DifficultyDialog : public ButtonContainer {
+private:
+	SpriteResource _sprites;
+
+	/**
+	 * Constructor
+	 */
+	DifficultyDialog(XeenEngine *vm);
+
+	/**
+	 * Shows the dialog
+	 */
+	int execute();
+
+	/**
+	 * Loads buttons for the dialog
+	 */
+	void loadButtons();
+public:
+	/**
+	 * Shows the difficulty selection dialog
+	 * @param vm		Engine reference
+	 * @returns			0=Adventurer, 1=Warrior, -1 exit
+	 */
+	static int show(XeenEngine *vm);
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_DIALOGS_DIFFICULTY_H */
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index c963ad3..2a5ef61 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -18,6 +18,7 @@ MODULE_OBJS := \
 	dialogs_char_info.o \
 	dialogs_control_panel.o \
 	dialogs_create_char.o \
+	dialogs_difficulty.o \
 	dialogs_dismiss.o \
 	dialogs_exchange.o \
 	dialogs_info.o \
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 7f9e1df..0aa7d8a 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -386,6 +386,7 @@ void Resources::loadData() {
 	file.syncStrings(GOOBER, 3);
 	file.syncStrings(MUSIC_FILES1, 5);
 	file.syncStrings2D(&MUSIC_FILES2[0][0], 6, 7);
+	file.syncString(DIFFICULTY_TEXT);
 }
 
 } // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 09f7202..67ac992 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -441,6 +441,7 @@ public:
 	const char *GOOBER[3];
 	const char *MUSIC_FILES1[5];
 	const char *MUSIC_FILES2[6][7];
+	const char *DIFFICULTY_TEXT;
 public:
 	/**
 	 * Constructor
diff --git a/engines/xeen/worldofxeen/worldofxeen_menu.cpp b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
index dad16ec..ff2e9ac 100644
--- a/engines/xeen/worldofxeen/worldofxeen_menu.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen_menu.cpp
@@ -22,8 +22,9 @@
 
 #include "common/scummsys.h"
 #include "xeen/worldofxeen/worldofxeen_menu.h"
-#include "xeen/resources.h"
 #include "xeen/worldofxeen/worldofxeen.h"
+#include "xeen/dialogs_difficulty.h"
+#include "xeen/resources.h"
 
 namespace Xeen {
 namespace WorldOfXeen {
@@ -104,6 +105,11 @@ void WorldOfXeenMenu::execute() {
 				break;
 			} else if (key == 'S') {
 				// Start new game
+				int result = DifficultyDialog::show(_vm);
+				if (result == -1)
+					break;
+
+				_vm->_party->_difficulty = (Difficulty)result;
 				WOX_VM._pendingAction = WOX_PLAY_GAME;
 				closeWindow();
 				return;


Commit: da65468c474258eab62ca82191a85d9a4274a23f
    https://github.com/scummvm/scummvm/commit/da65468c474258eab62ca82191a85d9a4274a23f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-24T21:18:07-05:00

Commit Message:
XEEN: Set correct starting date for each game

Changed paths:
    engines/xeen/saves.cpp


diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp
index 27819fd..828d1ea 100644
--- a/engines/xeen/saves.cpp
+++ b/engines/xeen/saves.cpp
@@ -55,8 +55,20 @@ SavesManager::SavesManager(const Common::String &targetName): _targetName(target
 	// Set any final initial values
 	Party &party = *g_vm->_party;
 	party.resetBlacksmithWares();
-	party._year = g_vm->getGameID() == GType_WorldOfXeen ? 610 : 850;
 	party._totalTime = 0;
+
+	switch (g_vm->getGameID()) {
+	case GType_Swords:
+		party._year = 1050;
+		break;
+	case GType_DarkSide:
+		party._year = 850;
+		break;
+	default:
+		party._year = 610;
+		break;
+	}
+	party._day = 1;
 }
 
 SavesManager::~SavesManager() {





More information about the Scummvm-git-logs mailing list