Skip to content

Commit

Permalink
XEEN: More interface setup and UI button definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jan 7, 2015
1 parent eb0c292 commit 31f4f5b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 6 deletions.
2 changes: 1 addition & 1 deletion engines/xeen/dialogs.cpp
Expand Up @@ -46,7 +46,7 @@ void ButtonContainer::restoreButtons() {
_buttons = _savedButtons.pop();
}

void ButtonContainer::addButton(const Common::Rect &bounds, int val, SpriteResource *sprites, bool draw = true) {
void ButtonContainer::addButton(const Common::Rect &bounds, int val, SpriteResource *sprites, bool draw) {
_buttons.push_back(UIButton(bounds, val, sprites, draw));
}

Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/dialogs.h
Expand Up @@ -66,7 +66,7 @@ class ButtonContainer {

void restoreButtons();

void addButton(const Common::Rect &bounds, int val, SpriteResource *sprites, bool draw);
void addButton(const Common::Rect &bounds, int val, SpriteResource *sprites, bool draw = true);
};

class SettingsBaseDialog : public ButtonContainer {
Expand Down
49 changes: 49 additions & 0 deletions engines/xeen/interface.cpp
Expand Up @@ -38,11 +38,16 @@ Interface::Interface(XeenEngine *vm) : ButtonContainer(), _vm(vm) {
_powerShieldUIFrame = 0;
_holyBonusUIFrame = 0;
_heroismUIFrame = 0;
_flipUIFrame = 0;
_isEarlyGame = false;
_buttonsLoaded = false;
_hiliteChar = -1;
Common::fill(&_combatCharIds[0], &_combatCharIds[8], 0);
_intrIndex1 = 0;
_flipWtr = false;
_flag1 = false;
_flag2 = false;
_tillMove = 0;

initDrawStructs();
}
Expand Down Expand Up @@ -534,6 +539,17 @@ void Interface::draw3d(bool flag) {
if (!screen._windows[11]._enabled)
return;

_flipUIFrame = (_flipUIFrame + 1) % 4;
if (_flipUIFrame == 0)
_flipWtr = !_flipWtr;
if (_tillMove && (_vm->_mode == MODE_1 || _vm->_mode == MODE_2) &&
!_flag1 && _vm->_moveMonsters) {
if (--_tillMove == 0)
moveMonsters();
}

// TODO: more

warning("TODO");
}

Expand Down Expand Up @@ -578,6 +594,10 @@ void Interface::startup() {
_mainList[0]._sprites = &_globalSprites;
for (int i = 1; i < 16; ++i)
_mainList[i]._sprites = &_iconSprites;

setIconButtons();

_tillMove = false;
}

void Interface::mainIconsPrint() {
Expand All @@ -588,4 +608,33 @@ void Interface::mainIconsPrint() {
screen._windows[34].update();
}

void Interface::moveMonsters() {

}

void Interface::setIconButtons() {
clearButtons();

addButton(Common::Rect(235, 75, 259, 95), 83, &_iconSprites);
addButton(Common::Rect(260, 75, 284, 95), 67, &_iconSprites);
addButton(Common::Rect(286, 75, 310, 95), 82, &_iconSprites);
addButton(Common::Rect(235, 96, 259, 116), 66, &_iconSprites);
addButton(Common::Rect(260, 96, 284, 116), 68, &_iconSprites);
addButton(Common::Rect(286, 96, 310, 116), 86, &_iconSprites);
addButton(Common::Rect(235, 117, 259, 137), 77, &_iconSprites);
addButton(Common::Rect(260, 117, 284, 137), 73, &_iconSprites);
addButton(Common::Rect(286, 117, 310, 137), 81, &_iconSprites);
addButton(Common::Rect(109, 137, 122, 147), 9, &_iconSprites);
addButton(Common::Rect(235, 148, 259, 168), 240, &_iconSprites);
addButton(Common::Rect(260, 148, 284, 168), 242, &_iconSprites);
addButton(Common::Rect(286, 148, 310, 168), 241, &_iconSprites);
addButton(Common::Rect(235, 169, 259, 189), 176, &_iconSprites);
addButton(Common::Rect(260, 169, 284, 189), 243, &_iconSprites);
addButton(Common::Rect(286, 169, 310, 189), 177, &_iconSprites);
addButton(Common::Rect(236, 11, 308, 69), 61, &_iconSprites, false);
addButton(Common::Rect(239, 27, 312, 37), 49, &_iconSprites, false);
addButton(Common::Rect(239, 37, 312, 47), 50, &_iconSprites, false);
addButton(Common::Rect(239, 47, 312, 57), 51, &_iconSprites, false);
}

} // End of namespace Xeen
9 changes: 9 additions & 0 deletions engines/xeen/interface.h
Expand Up @@ -60,11 +60,16 @@ class Interface: public ButtonContainer {
int _powerShieldUIFrame;
int _holyBonusUIFrame;
int _heroismUIFrame;
int _flipUIFrame;
bool _isEarlyGame;
bool _buttonsLoaded;
Common::String _interfaceText;
int _hiliteChar;
int _intrIndex1;
bool _flipWtr;
bool _flag1;
bool _flag2;
byte _tillMove;

void loadSprites();

Expand All @@ -91,6 +96,10 @@ class Interface: public ButtonContainer {
void setOutdoorsMonsters();

void setOutdoorsObjects();

void moveMonsters();

void setIconButtons();
public:
Interface(XeenEngine *vm);

Expand Down
4 changes: 2 additions & 2 deletions engines/xeen/xeen.cpp
Expand Up @@ -52,7 +52,6 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
_face2State = 0;
_noDirectionSense = false;
_falling = false;
_tillMove = false;
_moveMonsters = false;
_mode = MODE_0;
}
Expand Down Expand Up @@ -298,12 +297,13 @@ void XeenEngine::play() {
_events->setCursor(0);

_moveMonsters = true;
_tillMove = false;
if (_mode == MODE_0) {
_mode = MODE_1;
_screen->fadeIn(4);
}

_moveMonsters = true;

// Main game loop
while (!shouldQuit()) {
_events->pollEventsAndWait();
Expand Down
3 changes: 1 addition & 2 deletions engines/xeen/xeen.h
Expand Up @@ -93,8 +93,6 @@ class XeenEngine : public Engine {
const XeenGameDescription *_gameDescription;
Common::RandomSource _randomSource;
int _loadSaveSlot;
bool _moveMonsters;
bool _tillMove;

void showIntro();

Expand Down Expand Up @@ -146,6 +144,7 @@ class XeenEngine : public Engine {
int _face2State;
bool _noDirectionSense;
bool _falling;
bool _moveMonsters;
public:
XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc);
virtual ~XeenEngine();
Expand Down

0 comments on commit 31f4f5b

Please sign in to comment.