Permalink
Browse files

BLADERUNNER: Fixed scene video resume

Video in the back was always reset to the 1st frame. Now it is working
properly.
Also added game pause when the debugger is opened.
  • Loading branch information...
peterkohaut committed Jan 9, 2019
1 parent 03319bc commit 9d5bfdd01518f9bf1156b859894efbbb7d9f46ec
@@ -911,7 +911,6 @@ void BladeRunnerEngine::gameTick() {
_sceneScript->sceneFrameAdvanced(frame);
backgroundChanged = true;
}
(void)backgroundChanged;
blit(_surfaceBack, _surfaceFront);

_overlays->tick();
@@ -1112,8 +1111,16 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) {

void BladeRunnerEngine::handleKeyDown(Common::Event &event) {
if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) {
_time->pause();
getDebugger()->attach();
getDebugger()->onFrame();

_time->resume();

if (!_kia->isOpen() && !_spinner->isOpen() && !_elevator->isOpen() && !_esper->isOpen() && !_dialogueMenu->isOpen() && !_scores->isOpen()) {
_scene->resume();
}

return;
}

@@ -209,8 +209,8 @@ bool Scene::close(bool isLoadingGame) {
return result;
}

int Scene::advanceFrame() {
int frame = _vqaPlayer->update();
int Scene::advanceFrame(bool useTime) {
int frame = _vqaPlayer->update(false, true, useTime);
if (frame >= 0) {
blit(_vm->_surfaceBack, _vm->_surfaceFront);
_vqaPlayer->updateZBuffer(_vm->_zbuffer);
@@ -268,7 +268,7 @@ void Scene::resume(bool isLoadingGame) {
if (_defaultLoopPreloadedSet) {
_specialLoopMode = kSceneLoopModeNone;
startDefaultLoop();
advanceFrame();
advanceFrame(false);
loopStartSpecial(_specialLoopMode, _specialLoop, false);
} else {
_defaultLoopPreloadedSet = true;
@@ -285,7 +285,7 @@ void Scene::resume(bool isLoadingGame) {

int frame;
do {
frame = advanceFrame();
frame = advanceFrame(false);
} while (frame >= 0 && frame != targetFrame);

if (!isLoadingGame) {
@@ -71,7 +71,7 @@ class Scene {

bool open(int setId, int sceneId, bool isLoadingGame);
bool close(bool isLoadingGame);
int advanceFrame();
int advanceFrame(bool useTime = true);
void resume(bool isLoadingGame = false);
void startDefaultLoop();
void setActorStart(Vector3 position, int facing);
@@ -71,7 +71,7 @@ void VQAPlayer::close() {
_s = nullptr;
}

int VQAPlayer::update(bool forceDraw, bool advanceFrame, Graphics::Surface *customSurface) {
int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics::Surface *customSurface) {
uint32 now = 60 * _vm->_system->getMillis();
int result = -1;

@@ -106,7 +106,7 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, Graphics::Surface *cust
result = -1;
} else if (_frameNext > _frameEnd) {
result = -3;
} else if (now < _frameNextTime) {
} else if (useTime && (now < _frameNextTime)) {
result = -1;
} else if (advanceFrame) {
_frame = _frameNext;
@@ -131,11 +131,13 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, Graphics::Surface *cust
queueAudioFrame(_decoder.decodeAudioFrame());
}
}
if (_frameNextTime == 0) {
_frameNextTime = now + 60000 / 15;
}
else {
_frameNextTime += 60000 / 15;
if (useTime) {
if (_frameNextTime == 0) {
_frameNextTime = now + 60000 / 15;
}
else {
_frameNextTime += 60000 / 15;
}
}
_frameNext++;
result = _frame;
@@ -108,7 +108,7 @@ class VQAPlayer {
bool open();
void close();

int update(bool forceDraw = false, bool advanceFrame = true, Graphics::Surface *customSurface = nullptr);
int update(bool forceDraw = false, bool advanceFrame = true, bool useTime = true, Graphics::Surface *customSurface = nullptr);
void updateZBuffer(ZBuffer *zbuffer);
void updateView(View *view);
void updateScreenEffects(ScreenEffects *screenEffects);

0 comments on commit 9d5bfdd

Please sign in to comment.