XEEN: Add extra ending code for pausing turns

This commit is contained in:
Paul Gilbert 2015-01-19 12:13:03 -05:00
parent 687423b361
commit ec294d662e
7 changed files with 44 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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();
}
}