aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-02 16:02:24 -1000
committerPaul Gilbert2015-01-02 16:02:24 -1000
commit7d4fcfd5afb272c62ad7f1628cc1adfe17c8ee6f (patch)
tree389700cc8f82c3fdecb554c1f6ad38a0b64a4914
parent9b40bd5c6aa8110e7b3a13eec2550a4c6f201668 (diff)
downloadscummvm-rg350-7d4fcfd5afb272c62ad7f1628cc1adfe17c8ee6f.tar.gz
scummvm-rg350-7d4fcfd5afb272c62ad7f1628cc1adfe17c8ee6f.tar.bz2
scummvm-rg350-7d4fcfd5afb272c62ad7f1628cc1adfe17c8ee6f.zip
XEEN: Added checkSkill and animating indicators to assembleBorder
-rw-r--r--engines/xeen/dialogs.cpp2
-rw-r--r--engines/xeen/dialogs_options.cpp8
-rw-r--r--engines/xeen/party.h2
-rw-r--r--engines/xeen/screen.h1
-rw-r--r--engines/xeen/sprites.cpp4
-rw-r--r--engines/xeen/sprites.h4
-rw-r--r--engines/xeen/xeen.cpp65
-rw-r--r--engines/xeen/xeen.h12
8 files changed, 85 insertions, 13 deletions
diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp
index 810c136431..70a22d16ee 100644
--- a/engines/xeen/dialogs.cpp
+++ b/engines/xeen/dialogs.cpp
@@ -214,7 +214,7 @@ void CreditsScreen::execute() {
// Handle drawing the credits screen
doScroll(_vm, true, false);
- screen._windows[28].close();
+ screen._windows[GAME_WINDOW].close();
screen.loadBackground("marb.raw");
screen._windows[0].writeString(CREDITS);
diff --git a/engines/xeen/dialogs_options.cpp b/engines/xeen/dialogs_options.cpp
index eace67eecd..fb7366c5c7 100644
--- a/engines/xeen/dialogs_options.cpp
+++ b/engines/xeen/dialogs_options.cpp
@@ -56,7 +56,7 @@ void OptionsMenu::execute() {
File newBright("newbrigh.m");
_vm->_sound->playMusic(newBright);
- screen._windows[28].setBounds(Common::Rect(72, 25, 248, 175));
+ screen._windows[GAME_WINDOW].setBounds(Common::Rect(72, 25, 248, 175));
Common::String title1, title2;
startup(title1, title2);
@@ -202,7 +202,7 @@ void WorldOptionsMenu::setBackground(bool doFade) {
}
void WorldOptionsMenu::openWindow() {
- _vm->_screen->_windows[28].open();
+ _vm->_screen->_windows[GAME_WINDOW].open();
}
void WorldOptionsMenu::showContents(SpriteResource &title1, bool waitFlag) {
@@ -215,8 +215,8 @@ void WorldOptionsMenu::showContents(SpriteResource &title1, bool waitFlag) {
title1.draw(screen._windows[0], _bgFrame);
// Draw the basic frame for the optitons menu and title text
- screen._windows[28].frame();
- screen._windows[28].writeString(OPTIONS_TITLE);
+ screen._windows[GAME_WINDOW].frame();
+ screen._windows[GAME_WINDOW].writeString(OPTIONS_TITLE);
drawButtons(&screen._windows[0]);
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 9031b8831e..a42fe6ee98 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -50,7 +50,7 @@ enum Skill { THIEVERY = 0, ARMS_MASTER = 1, ASTROLOGER = 2, BODYBUILDER = 3,
SPOT_DOORS = 16, DANGER_SENSE = 17
};
-enum ConditionType { CURSED = 0, HEART_BROKEN = 1, WEAK = 2, POISONED = 3,
+enum ConditionType { CURSED = 0, HEARTBROKEN = 1, WEAK = 2, POISONED = 3,
DISEASED = 4, INSANE = 5, IN_LOVE = 6, DRUNK = 7, SLEEP = 8,
DEPRESSED = 9, CONFUSED = 10, PARALYZED = 11
};
diff --git a/engines/xeen/screen.h b/engines/xeen/screen.h
index fd8a50968f..0f16934e6b 100644
--- a/engines/xeen/screen.h
+++ b/engines/xeen/screen.h
@@ -36,6 +36,7 @@ namespace Xeen {
#define SCREEN_HEIGHT 200
#define PALETTE_COUNT 256
#define PALETTE_SIZE (256 * 3)
+#define GAME_WINDOW 28
class XeenEngine;
class Screen;
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 9485bd28b8..5b8fe5266a 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -64,10 +64,6 @@ SpriteResource::~SpriteResource() {
delete[] _data;
}
-int SpriteResource::size() const {
- return _index.size();
-}
-
void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Point &destPos) const {
// Get cell header
Common::MemoryReadStream f(_data, _filesize);
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index 8613d90b29..e9cdf721eb 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -55,7 +55,9 @@ public:
void draw(XSurface &dest, int frame) const;
- int size() const;
+ int size() const { return _index.size(); }
+
+ bool empty() const { return _index.size() == 0; }
};
} // End of namespace Xeen
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index d7f6138342..a46526e6ec 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -46,6 +46,11 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
_isEarlyGame = false;
_loadDarkSide = 1;
_buttonsLoaded = false;
+ _batUIFrame = 0;
+ _spotDoorsUIFrame = 0;
+ _spotDoorsAllowed = false;
+ _dangerSenseUIFrame = 0;
+ _dangerSenseAllowed = false;
}
XeenEngine::~XeenEngine() {
@@ -254,8 +259,10 @@ void XeenEngine::playGame() {
* TODO: Consider renaming method when better understood
*/
void XeenEngine::setupUI(bool soundPlayed) {
- SpriteResource sprites1("global.icn"), borderSprites("border.icn"),
- uiSprites("inn.icn");
+ SpriteResource uiSprites("inn.icn");
+ _globalSprites.load("global.icn");
+ _borderSprites.load("border.icn");
+ _spellFxSprites.load("spellfx.icn");
// Get mappings to the active characters in the party
Common::fill(&_activeRoster[0], &_activeRoster[MAX_ACTIVE_PARTY], nullptr);
@@ -319,7 +326,61 @@ void XeenEngine::loadCharIcons(int numChars) {
}
void XeenEngine::setupGameBackground() {
+ _screen->loadBackground("back.raw");
+ assembleBorder();
+}
+
+void XeenEngine::assembleBorder() {
+ Window &gameWindow = _screen->_windows[28];
+
+ // Draw the outer frame
+ _globalSprites.draw(gameWindow, 0);
+ // Draw the animating bat character used to show when levitate is active
+ _borderSprites.draw(*_screen, _party._levitateActive ? _batUIFrame + 16 : 16);
+ _batUIFrame = (_batUIFrame + 1) % 12;
+
+ // Draw UI element to indicate whether can spot hidden doors
+ _borderSprites.draw(*_screen,
+ (_spotDoorsAllowed && checkSkill(SPOT_DOORS)) ? _spotDoorsUIFrame + 28 : 28,
+ Common::Point(194, 91));
+ _spotDoorsUIFrame = (_spotDoorsUIFrame + 1) % 12;
+
+ // Draw UI element to indicate whether can sense danger
+ _borderSprites.draw(*_screen,
+ (_dangerSenseAllowed && checkSkill(DANGER_SENSE)) ? _spotDoorsUIFrame + 40 : 40,
+ Common::Point(107, 9));
+ _dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12;
+
+
+ // TODO
+}
+
+bool XeenEngine::checkSkill(Skill skillId) {
+ int total = 0;
+ for (int i = 0; i < _party._partyCount; ++i) {
+ if (_activeRoster[i]->_skills[skillId]) {
+ ++total;
+
+ switch (skillId) {
+ case MOUNTAINEER:
+ case PATHFINDER:
+ // At least two characters need skill for check to return true
+ if (total == 2)
+ return true;
+ break;
+ case CRUSADER:
+ case SWIMMING:
+ // Entire party must have skill for check to return true
+ if (total == _party._partyCount)
+ return true;
+ break;
+ default:
+ // All other skills only need to have a single player having it
+ return true;
+ }
+ }
+ }
}
} // End of namespace Xeen
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index 7261efc879..b6ca766088 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -87,7 +87,15 @@ private:
SpriteResource _charFaces[TOTAL_CHARACTERS];
SpriteResource *_partyFaces[MAX_ACTIVE_PARTY];
SpriteResource _dseFace;
+ SpriteResource _globalSprites;
+ SpriteResource _borderSprites;
+ SpriteResource _spellFxSprites;
bool _buttonsLoaded;
+ int _batUIFrame;
+ int _spotDoorsUIFrame;
+ bool _spotDoorsAllowed;
+ int _dangerSenseUIFrame;
+ bool _dangerSenseAllowed;
void showIntro();
@@ -98,6 +106,10 @@ private:
void loadCharIcons(int numChars);
void setupGameBackground();
+
+ void assembleBorder();
+
+ bool checkSkill(Skill skillId);
protected:
/**
* Play the game