From 166676462ae3ed6ddbe186504cf7ecb5f2e55703 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 Jan 2015 16:54:59 -1000 Subject: XEEN: Completed assembleGameBorder method --- engines/xeen/resources.cpp | 2 + engines/xeen/resources.h | 2 + engines/xeen/screen.h | 3 +- engines/xeen/xeen.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++++-- engines/xeen/xeen.h | 13 +++++- 5 files changed, 114 insertions(+), 5 deletions(-) diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index de0804dc5c..d7d3fccf98 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -232,4 +232,6 @@ const byte TEXT_COLORS[40][4] = { { 0x00, 0xDB, 0xDB, 0xDB }, }; +const char *DIRECTION_TEXT[4] = { "NORTH", "EAST", "SOUTH", "WEST" }; + } // End of namespace Xeen diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index d24b1fe4bf..cf4207b814 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -36,6 +36,8 @@ extern const byte SYMBOLS[20][64]; extern const byte TEXT_COLORS[40][4]; +extern const char *DIRECTION_TEXT[4]; + } // End of namespace Xeen #endif /* XEEN_RESOURCES_H */ diff --git a/engines/xeen/screen.h b/engines/xeen/screen.h index 0f16934e6b..d62191e501 100644 --- a/engines/xeen/screen.h +++ b/engines/xeen/screen.h @@ -50,9 +50,10 @@ private: int _border; int _xLo, _xHi; int _ycL, _ycH; - bool _enabled; void open2(); +public: + bool _enabled; public: virtual void addDirtyRect(const Common::Rect &r); public: diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 315e5172b7..ec98a5ffe8 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -30,6 +30,7 @@ #include "xeen/xeen.h" #include "xeen/dialogs_options.h" #include "xeen/files.h" +#include "xeen/resources.h" namespace Xeen { @@ -50,6 +51,15 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc) _spotDoorsAllowed = false; _dangerSenseUIFrame = 0; _dangerSenseAllowed = false; + _face1UIFrame = 0; + _face1State = 0; + _face2UIFrame = 0; + _face2State = 0; + _blessedUIFrame = 0; + _powerShieldUIFrame = 0; + _holyBonusUIFrame = 0; + _heroismUIFrame = 0; + _noDirectionSense = false; } XeenEngine::~XeenEngine() { @@ -262,6 +272,8 @@ void XeenEngine::setupUI(bool soundPlayed) { _globalSprites.load("global.icn"); _borderSprites.load("border.icn"); _spellFxSprites.load("spellfx.icn"); + _fecpSprites.load("fecp.brd"); + _blessSprites.load("bless.icn"); // Get mappings to the active characters in the party _party._activeParty.resize(_party._partyCount); @@ -326,10 +338,10 @@ void XeenEngine::loadCharIcons(int numChars) { void XeenEngine::setupGameBackground() { _screen->loadBackground("back.raw"); - assembleBorder(); + assembleGameBorder(); } -void XeenEngine::assembleBorder() { +void XeenEngine::assembleGameBorder() { Window &gameWindow = _screen->_windows[28]; // Draw the outer frame @@ -351,8 +363,89 @@ void XeenEngine::assembleBorder() { Common::Point(107, 9)); _dangerSenseUIFrame = (_dangerSenseUIFrame + 1) % 12; + // Handle the face UI elements for indicating clairvoyance status + _face1UIFrame = (_face1UIFrame + 1) % 4; + if (_face1State == 0) + _face1UIFrame += 4; + else if (_face1State == 2) + _face1UIFrame = 0; + + _face2UIFrame = (_face2UIFrame + 1) % 4 + 12; + if (_face2State == 0) + _face2UIFrame += 252; + else if (_face2State == 2) + _face2UIFrame = 0; + + if (!_party._clairvoyanceActive) { + _face1UIFrame = 0; + _face2UIFrame = 8; + } - // TODO + _borderSprites.draw(*_screen, _face1UIFrame, Common::Point(0, 32)); + _borderSprites.draw(*_screen, + _screen->_windows[10]._enabled || _screen->_windows[2]._enabled ? + 52 : _face2UIFrame, + Common::Point(215, 32)); + + // Draw resistence indicators + if (!_screen->_windows[10]._enabled && !_screen->_windows[2]._enabled + && _screen->_windows[38]._enabled) { + _fecpSprites.draw(*_screen, _party._fireResistence ? 1 : 0, + Common::Point(2, 2)); + _fecpSprites.draw(*_screen, _party._electricityResistence ? 3 : 2, + Common::Point(219, 2)); + _fecpSprites.draw(*_screen, _party._coldResistence ? 5 : 4, + Common::Point(2, 134)); + _fecpSprites.draw(*_screen, _party._poisonResistence ? 7 : 6, + Common::Point(219, 134)); + } else { + _fecpSprites.draw(*_screen, _party._fireResistence ? 9 : 8, + Common::Point(8, 8)); + _fecpSprites.draw(*_screen, _party._electricityResistence ? 10 : 11, + Common::Point(219, 8)); + _fecpSprites.draw(*_screen, _party._coldResistence ? 12 : 13, + Common::Point(8, 134)); + _fecpSprites.draw(*_screen, _party._poisonResistence ? 14 : 15, + Common::Point(219, 134)); + } + + // Draw UI element for blessed + _blessSprites.draw(*_screen, 16, Common::Point(33, 137)); + if (_party._blessedActive) { + _blessedUIFrame = (_blessedUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _blessedUIFrame, Common::Point(33, 137)); + } + + // Draw UI element for power shield + if (_party._powerShieldActive) { + _powerShieldUIFrame = (_powerShieldUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _powerShieldUIFrame + 4, + Common::Point(55, 137)); + } + + // Draw UI element for holy bonus + if (_party._holyBonusActive) { + _holyBonusUIFrame = (_holyBonusUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _holyBonusUIFrame + 8, Common::Point(160, 137)); + } + + // Draw UI element for heroism + if (_party._heroismActive) { + _heroismUIFrame = (_heroismUIFrame + 1) % 4; + _blessSprites.draw(*_screen, _heroismUIFrame + 12, Common::Point(182, 137)); + } + + // Draw direction character if direction sense is active + if (_party.checkSkill(DIRECTION_SENSE) && !_noDirectionSense) { + const char *dirText = DIRECTION_TEXT[_party._mazeDirection]; + Common::String msg = Common::String::format( + "\002""08\003""c\013""139\011""116%c\014""d\001", *dirText); + _screen->_windows[0].writeString(msg); + } + + // Draw view frame + if (_screen->_windows[12]._enabled) + _screen->_windows[12].frame(); } } // End of namespace Xeen diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index f63f73d434..c175048389 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -90,12 +90,23 @@ private: SpriteResource _globalSprites; SpriteResource _borderSprites; SpriteResource _spellFxSprites; + SpriteResource _fecpSprites; + SpriteResource _blessSprites; bool _buttonsLoaded; int _batUIFrame; int _spotDoorsUIFrame; bool _spotDoorsAllowed; int _dangerSenseUIFrame; bool _dangerSenseAllowed; + int _face1UIFrame; + bool _face1State; + int _face2UIFrame; + bool _face2State; + int _blessedUIFrame; + int _powerShieldUIFrame; + int _holyBonusUIFrame; + int _heroismUIFrame; + bool _noDirectionSense; void showIntro(); @@ -107,7 +118,7 @@ private: void setupGameBackground(); - void assembleBorder(); + void assembleGameBorder(); protected: /** * Play the game -- cgit v1.2.3