MADS: Fix inter-frame wait loop

This commit is contained in:
Paul Gilbert 2014-03-11 23:42:20 -04:00
parent 2d99f761f0
commit 709fcc6fac
5 changed files with 16 additions and 18 deletions

View File

@ -36,7 +36,6 @@ EventsManager::EventsManager(MADSEngine *vm) {
_vm = vm;
_cursorSprites = nullptr;
_frameCounter = 0;
_frameNumber = 0;
_priorFrameTime = 0;
_keyPressed = false;
_mouseClicked = false;
@ -166,8 +165,8 @@ void EventsManager::delay(int cycles) {
}
void EventsManager::waitForNextFrame() {
uint32 frameNum = getFrameCounter();
while (!_vm->shouldQuit() && !_vm->_game->_abortTimers && frameNum == _frameNumber)
uint32 frameCtr = getFrameCounter();
while (!_vm->shouldQuit() && frameCtr == _frameCounter)
delay(1);
}

View File

@ -38,7 +38,6 @@ class EventsManager {
private:
MADSEngine *_vm;
uint32 _frameCounter;
uint32 _frameNumber;
uint32 _priorFrameTime;
Common::Point _mousePos;
Common::Point _currentPos;

View File

@ -41,7 +41,7 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) {
int GameNebular::checkCopyProtection() {
// DEBUG: Flag copy protection failure
_globals[5] = 0xFFFF;
_globals[5] = -1;
if (!ConfMan.getBool("copy_protection"))
return true;
@ -60,13 +60,13 @@ void GameNebular::initialiseGlobals() {
// Set specific values needed by the game
_globals[4] = 8;
_globals[33] = 1;
_globals[10] = 0xFFFF;
_globals[13] = 0xFFFF;
_globals[15] = 0xFFFF;
_globals[19] = 0xFFFF;
_globals[20] = 0xFFFF;
_globals[21] = 0xFFFF;
_globals[95] = 0xFFFF;
_globals[10] = -1;
_globals[13] = -1;
_globals[15] = -1;
_globals[19] = -1;
_globals[20] = -1;
_globals[21] = -1;
_globals[95] = -1;
_objects.setData(3, 17, nullptr);
@ -101,8 +101,8 @@ void GameNebular::initialiseGlobals() {
}
_globals[120] = 501;
_globals[121] = 0xFFFF;
_globals[55] = 0xFFFF;
_globals[121] = -1;
_globals[55] = -1;
_globals[119] = 1;
_globals[134] = 4;
@ -133,7 +133,7 @@ void GameNebular::initialiseGlobals() {
case DIFFICULTY_MEDIUM:
_globals[35] = 0;
_objects.setRoom(8, 1);
_globals[137] = 0xFFFF;
_globals[137] = -1;
_globals[136] = 6;
break;
case DIFFICULTY_EASY:

View File

@ -33,7 +33,7 @@ namespace Nebular {
class Globals {
private:
Common::Array<uint16> _flags;
Common::Array<int16> _flags;
public:
Common::Array<int> _spriteIndexes;
@ -55,7 +55,7 @@ public:
/**
* Square brackets operator for accessing flags
*/
uint16 &operator[](int idx) { return _flags[idx]; }
int16 &operator[](int idx) { return _flags[idx]; }
};
} // End of namespace Nebular

View File

@ -88,7 +88,7 @@ void Scene804::enter() {
_globals._v8 = 0;
if (_globals[5]) {
// Copy protection failed
_globals[165] = 0xFFFF;
_globals[165] = -1;
_globals[164] = 0;
}