[Scummvm-git-logs] scummvm master -> 3f293e898596f85f805d9d711d72634683b71d2c

dreammaster dreammaster at scummvm.org
Mon Dec 11 03:41:09 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:
3f293e8985 XEEN: Implemented awards listing dialog


Commit: 3f293e898596f85f805d9d711d72634683b71d2c
    https://github.com/scummvm/scummvm/commit/3f293e898596f85f805d9d711d72634683b71d2c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-12-10T21:40:58-05:00

Commit Message:
XEEN: Implemented awards listing dialog

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/character.h
    engines/xeen/dialogs.cpp
    engines/xeen/dialogs.h
    engines/xeen/dialogs_char_info.cpp
    engines/xeen/module.mk
    engines/xeen/resources.cpp
    engines/xeen/resources.h
    engines/xeen/scripts.cpp
    engines/xeen/town.cpp
    engines/xeen/town.h


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 26794d8..29b8dcb 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -1508,7 +1508,7 @@ int Character::getNumSkills() const {
 
 int Character::getNumAwards() const {
 	int total = 0;
-	for (int idx = 0; idx < 88; ++idx) {
+	for (int idx = 0; idx < AWARDS_TOTAL; ++idx) {
 		if (hasAward(idx))
 			++total;
 	}
diff --git a/engines/xeen/character.h b/engines/xeen/character.h
index 24c54de..c16ae6a 100644
--- a/engines/xeen/character.h
+++ b/engines/xeen/character.h
@@ -34,6 +34,7 @@ namespace Xeen {
 
 #define INV_ITEMS_TOTAL 9
 #define MAX_SPELLS_PER_CLASS 39
+#define AWARDS_TOTAL 88
 
 enum BonusFlags {
 	ITEMFLAG_BONUS_MASK = 0xBF, ITEMFLAG_CURSED = 0x40, ITEMFLAG_BROKEN = 0x80
@@ -396,8 +397,14 @@ public:
 
 	uint getCurrentExperience() const;
 
+	/**
+	 * Returns the number of skills the character has
+	 */
 	int getNumSkills() const;
 
+	/**
+	 * Returns the number of awards the character has
+	 */
 	int getNumAwards() const;
 
 	int makeItem(int p1, int itemIndex, int p3);
diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp
index 4875c2f..3925d69 100644
--- a/engines/xeen/dialogs.cpp
+++ b/engines/xeen/dialogs.cpp
@@ -152,6 +152,14 @@ bool ButtonContainer::doScroll(bool rollUp, bool fadeIn) {
 	}
 }
 
+void ButtonContainer::loadStrings(const Common::String &name) {
+	File f(name);
+	_textStrings.clear();
+	while (f.pos() < f.size())
+		_textStrings.push_back(f.readString());
+	f.close();
+}
+
 /*------------------------------------------------------------------------*/
 
 void SettingsBaseDialog::showContents(SpriteResource &title1, bool waitFlag) {
diff --git a/engines/xeen/dialogs.h b/engines/xeen/dialogs.h
index 921c72a..680963f 100644
--- a/engines/xeen/dialogs.h
+++ b/engines/xeen/dialogs.h
@@ -52,6 +52,7 @@ private:
 	Common::Stack< Common::Array<UIButton> > _savedButtons;
 protected:
 	Common::Array<UIButton> _buttons;
+	Common::StringArray _textStrings;
 	int _buttonValue;
 
 	bool checkEvents(XeenEngine *vm);
@@ -63,6 +64,12 @@ protected:
 	 * @returns		True if key or mouse pressed
 	 */
 	virtual bool doScroll(bool rollUp, bool fadeIn);
+
+	/**
+	 * Load a set of text strings from the given resource
+	 * @param name		Name of resource containing strings
+	 */
+	void loadStrings(const Common::String &name);
 public:
 	ButtonContainer(XeenEngine *vm) : Cutscenes(vm), _buttonValue(0) {}
 
diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp
index 187845f..3d039c1 100644
--- a/engines/xeen/dialogs_char_info.cpp
+++ b/engines/xeen/dialogs_char_info.cpp
@@ -20,6 +20,7 @@
  *
  */
 
+#include "xeen/dialogs_awards.h"
 #include "xeen/dialogs_char_info.h"
 #include "xeen/dialogs_exchange.h"
 #include "xeen/dialogs_items.h"
@@ -460,7 +461,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
 
 	case 14:
 		// Awards
-		error("AwardsDialog::show");
+		Awards::show(_vm, &c);
 		return false;
 
 	case 15:
diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index 1be0d28..7656f4c 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -12,6 +12,7 @@ MODULE_OBJS := \
 	debugger.o \
 	detection.o \
 	dialogs.o \
+	dialogs_awards.o \
 	dialogs_char_info.o \
 	dialogs_control_panel.o \
 	dialogs_dismiss.o \
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 001d1e7..59add7a 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -1609,4 +1609,13 @@ const char *const Resources::EVENT_SAMPLES[6] = {
 const char *const Resources::MOONS_NOT_ALIGNED =
 "\x3""c\xB""012\t000The moons are not aligned. Passage to the %s is unavailable";
 
+const char *const Resources::AWARDS_FOR =
+	"\r\x1\fd\x3""c\v000\t000Awards for %s the %s\x3""l\x2\n"
+	"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\x1";
+
+const char *const Resources::AWARDS_TEXT =
+	"\r\x2\x3""c\xB""021\t221\xC""37U\xC""dp\t255\xC""37D\xC""down\t289Exit";
+
+const char *const Resources::NO_AWARDS = "\x3""cNo Awards";
+
 } // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 515b6d6..0326e7b 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -344,6 +344,9 @@ public:
 	static const char *const IDENTIFY_MONSTERS;
 	static const char *const EVENT_SAMPLES[6];
 	static const char *const MOONS_NOT_ALIGNED;
+	static const char *const AWARDS_FOR;
+	static const char *const AWARDS_TEXT;
+	static const char *const NO_AWARDS;
 public:
 	/**
 	 * Initializes an instnace of the resources
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index d64141a..e630893 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -1480,7 +1480,7 @@ bool Scripts::ifProc(int action, uint32 val, int mode, int charIndex) {
 		break;
 	case 15:
 		// Award
-		assert(val < 128);
+		assert(val < AWARDS_TOTAL);
 		if (ps.hasAward(val))
 			v = val;
 		break;
diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp
index 069ff8f..1ebd683 100644
--- a/engines/xeen/town.cpp
+++ b/engines/xeen/town.cpp
@@ -52,14 +52,6 @@ TownLocation::~TownLocation() {
 	intf.mainIconsPrint();
 }
 
-void TownLocation::loadStrings(const Common::String &name) {
-	File f(name);
-	_textStrings.clear();
-	while (f.pos() < f.size())
-		_textStrings.push_back(f.readString());
-	f.close();
-}
-
 int TownLocation::show() {
 	Map &map = *g_vm->_map;
 	Party &party = *g_vm->_party;
diff --git a/engines/xeen/town.h b/engines/xeen/town.h
index 03f29e7..1f2728b 100644
--- a/engines/xeen/town.h
+++ b/engines/xeen/town.h
@@ -45,7 +45,6 @@ protected:
 	TownAction _townActionId;
 	Common::Array<SpriteResource> _townSprites;
 	SpriteResource _icons1, _icons2;
-	Common::StringArray _textStrings;
 	int _townMaxId;
 	const bool &_isDarkCc;
 	int _animFrame;
@@ -54,18 +53,8 @@ protected:
 	int _drawFrameIndex;
 	uint _farewellTime;
 	int _drawCtr1, _drawCtr2;
-
-/*
-	int _v1, _v2;
-	int _dayOfWeek;
-	*/
 protected:
 	/**
-	 * Load a set of text strings from the given resource
-	 */
-	void loadStrings(const Common::String &name);
-
-	/**
 	 * Draw the window
 	 */
 	void drawWindow();





More information about the Scummvm-git-logs mailing list