From ec294d662e7d54a9927c2b85ec430e1519be5de7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 19 Jan 2015 12:13:03 -0500 Subject: XEEN: Add extra ending code for pausing turns --- engines/xeen/dialogs.cpp | 1 + engines/xeen/interface.cpp | 32 ++++++++++++++++++++++++++++++-- engines/xeen/interface.h | 7 ++++++- engines/xeen/party.cpp | 4 ++-- engines/xeen/party.h | 2 +- engines/xeen/sound.h | 2 ++ engines/xeen/xeen.cpp | 4 ++-- 7 files changed, 44 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp index 824e8249ce..d1662aeb68 100644 --- a/engines/xeen/dialogs.cpp +++ b/engines/xeen/dialogs.cpp @@ -52,6 +52,7 @@ void ButtonContainer::addButton(const Common::Rect &bounds, int val, SpriteResou bool ButtonContainer::checkEvents(XeenEngine *vm) { EventsManager &events = *vm->_events; + _buttonValue = 0; if (events._leftButton) { // Check whether any button is selected diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index e15c0574aa..8ff0b92d13 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -49,6 +49,7 @@ Interface::Interface(XeenEngine *vm) : ButtonContainer(), InterfaceMap(vm), _vm( _thinWall = false; _overallFrame = 0; _upDoorText = false; + _steppingFX = 0; Common::fill(&_combatCharIds[0], &_combatCharIds[8], 0); initDrawStructs(); @@ -2316,7 +2317,7 @@ void Interface::updateAutoMap() { * Waits for a keypress or click, whilst still allowing the game scene to * be animated. */ -void Interface::wait() { +void Interface::perform() { EventsManager &events = *_vm->_events; Map &map = *_vm->_map; Party &party = *_vm->_party; @@ -2328,7 +2329,7 @@ void Interface::wait() { draw3d(true); // Wait for a frame - while (!_vm->shouldQuit()) { + do { events.pollEventsAndWait(); checkEvents(_vm); } while (!_buttonValue && events.timeElapsed() < 1 && !_vm->_party->_partyDead); @@ -2392,6 +2393,8 @@ void Interface::wait() { _upDoorText = false; _flipDefaultGround = !_flipDefaultGround; _flipGround = !_flipGround; + + stepTime(); break; default: break; @@ -2410,4 +2413,29 @@ void Interface::chargeStep() { } } +/** + * Handles incrementing game time + */ +void Interface::stepTime() { + Party &party = *_vm->_party; + SoundManager &sound = *_vm->_sound; + doStepCode(); + + if (++party._ctr24 == 24) + party._ctr24 = 0; + + if (_buttonValue != Common::KEYCODE_SPACE && _buttonValue != Common::KEYCODE_w) { + _steppingFX ^= 1; + sound.playFX(_steppingFX + 7); + } + + _upDoorText = false; + _flipDefaultGround = !_flipDefaultGround; + _flipGround = !_flipGround; +} + +void Interface::doStepCode() { + // TODO +} + } // End of namespace Xeen diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h index c6fee9e0d4..af26611e6d 100644 --- a/engines/xeen/interface.h +++ b/engines/xeen/interface.h @@ -74,6 +74,7 @@ private: bool _thinWall; int _overallFrame; bool _upDoorText; + int _steppingFX; void initDrawStructs(); @@ -100,6 +101,10 @@ private: void updateAutoMap(); void chargeStep(); + + void stepTime(); + + void doStepCode(); public: Interface(XeenEngine *vm); @@ -119,7 +124,7 @@ public: void charIconsPrint(bool updateFlag); - void wait(); + void perform(); }; } // End of namespace Xeen diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 6d5cc22ffa..4571bbe518 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -198,7 +198,7 @@ Party::Party(XeenEngine *vm): _vm(vm) { _cloudsEnd = false; _darkSideEnd = false; _worldEnd = false; - hour_maybe = 0; + _ctr24 = 0; _day = 0; _year = 0; _minutes = 0; @@ -273,7 +273,7 @@ void Party::synchronize(Common::Serializer &s) { s.syncAsUint16LE(_cloudsEnd); s.syncAsUint16LE(_darkSideEnd); s.syncAsUint16LE(_worldEnd); - s.syncAsUint16LE(hour_maybe); + s.syncAsUint16LE(_ctr24); s.syncAsUint16LE(_day); s.syncAsUint16LE(_year); s.syncAsUint16LE(_minutes); diff --git a/engines/xeen/party.h b/engines/xeen/party.h index 75a6c2b07b..8db52df1a6 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -176,7 +176,7 @@ public: bool _cloudsEnd; bool _darkSideEnd; bool _worldEnd; - int hour_maybe; + int _ctr24; // TODO: Figure out proper name int _day; int _year; int _minutes; diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index 553b1c6f44..c1215249a9 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -42,6 +42,8 @@ public: void playSong(Common::SeekableReadStream &f) {} void playSample(const Common::SeekableReadStream *stream, int v2) {} + + void playFX(int id) {} }; } // End of namespace Xeen diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index b8f9030c85..e9b4d93de8 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -327,8 +327,8 @@ void XeenEngine::gameLoop() { } _scripts->giveTreasure(); - // Wait loop - _interface->wait(); + // Main user interface handler for waiting for and processing user input + _interface->perform(); } } -- cgit v1.2.3