Skip to content

Commit

Permalink
XEEN: Do rendering delays like the original did
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 10, 2017
1 parent deb4261 commit 65ecb6e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion engines/xeen/dialogs_map.cpp
Expand Up @@ -73,7 +73,7 @@ void MapDialog::execute() {
events.updateGameCounter();
do {
if (drawFlag)
intf.draw3d(false, true);
intf.draw3d(false);
windows[5].writeString("\r");

if (map._isOutdoors)
Expand Down
6 changes: 6 additions & 0 deletions engines/xeen/events.cpp
Expand Up @@ -161,6 +161,12 @@ void EventsManager::ipause(uint amount) {
} while (!_vm->shouldQuit() && timeElapsed() < amount);
}

void EventsManager::ipause5(uint amount) {
do {
pollEventsAndWait();
} while (!_vm->shouldQuit() && timeElapsed5() < amount);
}

void EventsManager::nextFrame() {
++_frameCounter;

Expand Down
8 changes: 8 additions & 0 deletions engines/xeen/events.h
Expand Up @@ -109,7 +109,15 @@ class EventsManager {

bool wait(uint numFrames, bool interruptable = true);

/**
* Pause for a set amount
*/
void ipause(uint amount);

/**
* Pauses a set amount past the previous call to timeMark5
*/
void ipause5(uint amount);
};

class GameEvent {
Expand Down
11 changes: 3 additions & 8 deletions engines/xeen/interface.cpp
Expand Up @@ -1242,15 +1242,15 @@ void Interface::bash(const Common::Point &pt, Direction direction) {
drawParty(true);
}

void Interface::draw3d(bool updateFlag, bool skipDelay) {
void Interface::draw3d(bool updateFlag) {
Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
Scripts &scripts = *_vm->_scripts;
Windows &windows = *_vm->_windows;

events.updateGameCounter();
events.timeMark5();
if (windows[11]._enabled)
return;

Expand Down Expand Up @@ -1299,12 +1299,7 @@ void Interface::draw3d(bool updateFlag, bool skipDelay) {
}

party._stepped = false;
if (_vm->_mode == MODE_RECORD_EVENTS) {
// TODO: Save current scripts data?
}

if (!skipDelay)
events.wait(2, false);
events.ipause5(2);
}

void Interface::handleFalling() {
Expand Down
8 changes: 7 additions & 1 deletion engines/xeen/interface.h
Expand Up @@ -161,9 +161,15 @@ class Interface: public ButtonContainer, public InterfaceScene,

void rest();

/**
* Handles bash actions
*/
void bash(const Common::Point &pt, Direction direction);

void draw3d(bool updateFlag, bool skipDelay = false);
/**
* Handles drawing the elements of the interface and game scene
*/
void draw3d(bool updateFlag);

/**
* Draw the display borders
Expand Down

0 comments on commit 65ecb6e

Please sign in to comment.