diff options
-rw-r--r-- | engines/xeen/character.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/character.h | 7 | ||||
-rw-r--r-- | engines/xeen/dialogs.cpp | 8 | ||||
-rw-r--r-- | engines/xeen/dialogs.h | 7 | ||||
-rw-r--r-- | engines/xeen/dialogs_char_info.cpp | 3 | ||||
-rw-r--r-- | engines/xeen/module.mk | 1 | ||||
-rw-r--r-- | engines/xeen/resources.cpp | 9 | ||||
-rw-r--r-- | engines/xeen/resources.h | 3 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 8 | ||||
-rw-r--r-- | engines/xeen/town.h | 11 |
11 files changed, 39 insertions, 22 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp index 26794d8080..29b8dcb94a 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 24c54deffe..c16ae6addb 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 4875c2f0a9..3925d69b45 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 921c72a33f..680963f907 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 187845fe4e..3d039c111b 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 1be0d28207..7656f4cac0 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 001d1e7023..59add7aedb 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 515b6d6334..0326e7b010 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 d64141aabb..e630893f41 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 069ff8f818..1ebd683826 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 03f29e7b2a..1f2728be13 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(); |