aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPeter Kohaut2019-02-11 20:57:57 +0100
committerPeter Kohaut2019-02-11 22:48:55 +0100
commit6854ea3ddd83798a9045307763bbb346d8a1736b (patch)
tree14fefc869658b53c4b2ee62b37fc04735508c13b /engines
parentb14fbaa72b3218862a533dd7f7c0e97e1bed4df7 (diff)
downloadscummvm-rg350-6854ea3ddd83798a9045307763bbb346d8a1736b.tar.gz
scummvm-rg350-6854ea3ddd83798a9045307763bbb346d8a1736b.tar.bz2
scummvm-rg350-6854ea3ddd83798a9045307763bbb346d8a1736b.zip
BLADERUNNER: Improved time management
This should fix thi issue with freezing actors after loading save game, but works on new saves only. Game was not paused before saving and wrong timer value got saved.
Diffstat (limited to 'engines')
-rw-r--r--engines/bladerunner/bladerunner.cpp40
-rw-r--r--engines/bladerunner/bladerunner.h3
-rw-r--r--engines/bladerunner/debugger.cpp5
-rw-r--r--engines/bladerunner/item_pickup.cpp5
-rw-r--r--engines/bladerunner/slice_animations.cpp3
-rw-r--r--engines/bladerunner/time.cpp9
-rw-r--r--engines/bladerunner/time.h1
-rw-r--r--engines/bladerunner/ui/end_credits.cpp7
-rw-r--r--engines/bladerunner/ui/kia.cpp10
-rw-r--r--engines/bladerunner/ui/kia_section_diagnostic.cpp5
-rw-r--r--engines/bladerunner/ui/kia_section_load.cpp5
-rw-r--r--engines/bladerunner/ui/kia_section_pogo.cpp5
-rw-r--r--engines/bladerunner/ui/kia_section_save.cpp5
-rw-r--r--engines/bladerunner/ui/ui_check_box.cpp5
-rw-r--r--engines/bladerunner/ui/ui_input_box.cpp7
-rw-r--r--engines/bladerunner/ui/ui_scroll_box.cpp21
-rw-r--r--engines/bladerunner/vqa_player.cpp5
17 files changed, 70 insertions, 71 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 5c49281256..5aef48caa4 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -274,7 +274,9 @@ Common::Error BladeRunnerEngine::saveGameState(int slot, const Common::String &d
BladeRunner::SaveFileManager::writeHeader(*saveFile, header);
+ _time->pause();
saveGame(*saveFile, thumbnail);
+ _time->resume();
saveFile->finalize();
@@ -285,6 +287,10 @@ Common::Error BladeRunnerEngine::saveGameState(int slot, const Common::String &d
return Common::kNoError;
}
+void BladeRunnerEngine::pauseEngineIntern(bool pause) {
+ _mixer->pauseAll(pause);
+}
+
Common::Error BladeRunnerEngine::run() {
Graphics::PixelFormat format = createRGB555();
initGraphics(640, 480, &format);
@@ -1113,7 +1119,7 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) {
_kia->open(kKIASectionSettings);
break;
case Common::KEYCODE_SPACE:
- // TODO: combat::switchCombatMode(&Combat);
+ _combat->change();
break;
default:
break;
@@ -1122,16 +1128,8 @@ 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;
}
@@ -1968,32 +1966,12 @@ void BladeRunnerEngine::autoSaveGame(int textId, bool endgame) {
if (slot == -1) {
slot = maxSlot + 1;
}
-
- Common::OutSaveFile *saveFile = BladeRunner::SaveFileManager::openForSaving(getTargetName(), slot);
- if (saveFile == nullptr || saveFile->err()) {
- delete saveFile;
- }
-
- BladeRunner::SaveFileHeader header;
if (endgame) {
- header._name = "END_GAME_STATE";
+ saveGameState(slot, "END_GAME_STATE");
} else {
- header._name = textAutoSave.getText(textId);
+ saveGameState(slot, textAutoSave.getText(textId));
}
- BladeRunner::SaveFileManager::writeHeader(*saveFile, header);
-
- Graphics::Surface thumbnail = generateThumbnail();
-
- _time->pause();
- saveGame(*saveFile, thumbnail);
- _time->resume();
-
- saveFile->finalize();
-
- thumbnail.free();
-
- delete saveFile;
}
void BladeRunnerEngine::ISez(const Common::String &str) {
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index e1469dbbe1..74387b1807 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -236,8 +236,9 @@ public:
Common::Error loadGameState(int slot) override;
bool canSaveGameStateCurrently() override;
Common::Error saveGameState(int slot, const Common::String &desc) override;
+ void pauseEngineIntern(bool pause) override;
- Common::Error run();
+ Common::Error run() override;
bool startup(bool hasSavegames = false);
void initChapterAndScene();
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index 49abdfc4c2..fae61d0e37 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -42,6 +42,7 @@
#include "bladerunner/set.h"
#include "bladerunner/set_effects.h"
#include "bladerunner/text_resource.h"
+#include "bladerunner/time.h"
#include "bladerunner/vector.h"
#include "bladerunner/view.h"
#include "bladerunner/vqa_decoder.h"
@@ -706,7 +707,9 @@ bool Debugger::cmdSave(int argc, const char **argv) {
Graphics::Surface thumbnail = _vm->generateThumbnail();
+ _vm->_time->pause();
_vm->saveGame(*saveFile, thumbnail);
+ _vm->_time->resume();
saveFile->finalize();
@@ -714,7 +717,7 @@ bool Debugger::cmdSave(int argc, const char **argv) {
delete saveFile;
- return true;
+ return false;
}
void Debugger::drawDebuggerOverlay() {
diff --git a/engines/bladerunner/item_pickup.cpp b/engines/bladerunner/item_pickup.cpp
index 1bed3bb640..4991828d1d 100644
--- a/engines/bladerunner/item_pickup.cpp
+++ b/engines/bladerunner/item_pickup.cpp
@@ -27,6 +27,7 @@
#include "bladerunner/game_info.h"
#include "bladerunner/slice_animations.h"
#include "bladerunner/slice_renderer.h"
+#include "bladerunner/time.h"
#include "bladerunner/zbuffer.h"
namespace BladeRunner {
@@ -56,7 +57,7 @@ void ItemPickup::setup(int animationId, int screenX, int screenY) {
int pan = (150 * _screenX - 48000) / 640;
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(335), 80, pan, pan, 50, 0);
- _timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ _timeLast = _vm->_time->currentSystem();
}
void ItemPickup::reset() {
@@ -75,7 +76,7 @@ void ItemPickup::tick() {
return;
}
- int timeNow = _vm->getTotalPlayTime(); // Original game is using system timer
+ int timeNow = _vm->_time->currentSystem();
int timeDiff = timeNow - _timeLast;
_timeLast = timeNow;
timeDiff = MIN(MIN(timeDiff, 67), _timeLeft);
diff --git a/engines/bladerunner/slice_animations.cpp b/engines/bladerunner/slice_animations.cpp
index 274d39fc9f..b180e84ac0 100644
--- a/engines/bladerunner/slice_animations.cpp
+++ b/engines/bladerunner/slice_animations.cpp
@@ -23,6 +23,7 @@
#include "bladerunner/slice_animations.h"
#include "bladerunner/bladerunner.h"
+#include "bladerunner/time.h"
#include "common/debug.h"
#include "common/file.h"
@@ -182,7 +183,7 @@ void *SliceAnimations::getFramePtr(uint32 animation, uint32 frame) {
if (!_pages[page]._data)
error("Unable to locate page %d for animation %d frame %d", page, animation, frame);
- _pages[page]._lastAccess = _vm->_system->getMillis();
+ _pages[page]._lastAccess = _vm->_time->currentSystem();
return (byte *)_pages[page]._data + pageOffset;
}
diff --git a/engines/bladerunner/time.cpp b/engines/bladerunner/time.cpp
index 2e412824f8..5d82a0cd55 100644
--- a/engines/bladerunner/time.cpp
+++ b/engines/bladerunner/time.cpp
@@ -25,20 +25,25 @@
#include "bladerunner/bladerunner.h"
#include "common/timer.h"
+#include "common/system.h"
namespace BladeRunner {
Time::Time(BladeRunnerEngine *vm) {
_vm = vm;
- _start = _vm->getTotalPlayTime();
+ _start = currentSystem();
_pauseCount = 0;
_offset = 0;
_pauseStart = 0;
}
+int Time::currentSystem() {
+ return _vm->getTotalPlayTime();
+}
+
int Time::current() {
- int time = _vm->getTotalPlayTime() - _offset;
+ int time = currentSystem() - _offset;
return time - _start;
}
diff --git a/engines/bladerunner/time.h b/engines/bladerunner/time.h
index 11f96ed29f..4e372ea05f 100644
--- a/engines/bladerunner/time.h
+++ b/engines/bladerunner/time.h
@@ -38,6 +38,7 @@ class Time {
public:
Time(BladeRunnerEngine *vm);
+ int currentSystem();
int current();
int pause();
int getPauseStart();
diff --git a/engines/bladerunner/ui/end_credits.cpp b/engines/bladerunner/ui/end_credits.cpp
index 0fc97d09be..1e9a3acfad 100644
--- a/engines/bladerunner/ui/end_credits.cpp
+++ b/engines/bladerunner/ui/end_credits.cpp
@@ -33,6 +33,7 @@
#include "bladerunner/mouse.h"
#include "bladerunner/music.h"
#include "bladerunner/text_resource.h"
+#include "bladerunner/time.h"
#include "bladerunner/ui/end_credits.h"
namespace BladeRunner {
@@ -95,7 +96,7 @@ void EndCredits::show() {
_vm->_vqaStopIsRequested = false;
double position = 0.0;
- uint32 timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ uint32 timeLast = _vm->_time->currentSystem();
while (!_vm->_vqaStopIsRequested && !_vm->shouldQuit()) {
if (position >= textPositions[textCount - 1]) {
@@ -106,12 +107,12 @@ void EndCredits::show() {
_vm->handleEvents();
if (!_vm->_windowIsActive) {
- timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ timeLast = _vm->_time->currentSystem();
continue;
}
- uint32 timeNow = _vm->getTotalPlayTime(); // Original game is using system timer
+ uint32 timeNow = _vm->_time->currentSystem();
position += (double)(timeNow - timeLast) * 0.05f;
timeLast = timeNow;
diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp
index d54133a7e4..42aaf3c409 100644
--- a/engines/bladerunner/ui/kia.cpp
+++ b/engines/bladerunner/ui/kia.cpp
@@ -73,14 +73,14 @@ KIA::KIA(BladeRunnerEngine *vm) {
_currentSectionId = kKIASectionNone;
_lastSectionIdKIA = kKIASectionCrimes;
_lastSectionIdOptions = kKIASectionSettings;
- _playerVqaTimeLast = _vm->getTotalPlayTime();
+ _playerVqaTimeLast = _vm->_time->currentSystem();
_playerVqaFrame = 0;
_playerVisualizerState = 0;
_playerPhotographId = -1;
_playerPhotograph = nullptr;
_playerSliceModelId = -1;
_playerSliceModelAngle = 0.0f;
- _timeLast = _vm->getTotalPlayTime();
+ _timeLast = _vm->_time->currentSystem();
_playerActorDialogueQueuePosition = 0;
_playerActorDialogueQueueSize = 0;
_playerActorDialogueState = 0;
@@ -223,7 +223,7 @@ void KIA::tick() {
return;
}
- int timeNow = _vm->getTotalPlayTime();
+ int timeNow = _vm->_time->currentSystem();
int timeDiff = timeNow - _timeLast;
if (_playerActorDialogueQueueSize == _playerActorDialogueQueuePosition) {
@@ -650,8 +650,8 @@ void KIA::init() {
playerReset();
_playerVqaFrame = 0;
- _playerVqaTimeLast = _vm->getTotalPlayTime();
- _timeLast = _vm->getTotalPlayTime();
+ _playerVqaTimeLast = _vm->_time->currentSystem();
+ _timeLast = _vm->_time->currentSystem();
if (_vm->_gameFlags->query(kFlagKIAPrivacyAddon) && !_vm->_gameFlags->query(kFlagKIAPrivacyAddonIntro)) {
_vm->_gameFlags->set(kFlagKIAPrivacyAddonIntro);
diff --git a/engines/bladerunner/ui/kia_section_diagnostic.cpp b/engines/bladerunner/ui/kia_section_diagnostic.cpp
index 55672cdf2c..333cf6389e 100644
--- a/engines/bladerunner/ui/kia_section_diagnostic.cpp
+++ b/engines/bladerunner/ui/kia_section_diagnostic.cpp
@@ -26,6 +26,7 @@
#include "bladerunner/font.h"
#include "bladerunner/game_constants.h"
#include "bladerunner/text_resource.h"
+#include "bladerunner/time.h"
#include "bladerunner/ui/kia.h"
namespace BladeRunner {
@@ -45,7 +46,7 @@ void KIASectionDiagnostic::open() {
}
_vm->_kia->playActorDialogue(kActorRunciter, 140);
_offset = 0;
- _timeLast = _vm->getTotalPlayTime();
+ _timeLast = _vm->_time->currentSystem();
}
void KIASectionDiagnostic::close() {
@@ -53,7 +54,7 @@ void KIASectionDiagnostic::close() {
}
void KIASectionDiagnostic::draw(Graphics::Surface &surface) {
- int timeNow = _vm->getTotalPlayTime();
+ int timeNow = _vm->_time->currentSystem();
for (int i = 0; i < _text->getCount(); ++i) {
int y = kLineHeight * i + 366 - _offset;
diff --git a/engines/bladerunner/ui/kia_section_load.cpp b/engines/bladerunner/ui/kia_section_load.cpp
index 9b37f5e554..a512188b43 100644
--- a/engines/bladerunner/ui/kia_section_load.cpp
+++ b/engines/bladerunner/ui/kia_section_load.cpp
@@ -27,6 +27,7 @@
#include "bladerunner/game_info.h"
#include "bladerunner/savefile.h"
#include "bladerunner/text_resource.h"
+#include "bladerunner/time.h"
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
@@ -74,7 +75,7 @@ void KIASectionLoad::open() {
_scrollBox->addLine(_vm->_textOptions->getText(29), _newGameHardLineId, 0); // Hard
_hoveredLineId = -1;
- _timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ _timeLast = _vm->_time->currentSystem();
_timeLeft = 800;
}
@@ -108,7 +109,7 @@ void KIASectionLoad::draw(Graphics::Surface &surface){
_hoveredLineId = selectedLineId;
}
- uint32 now = _vm->getTotalPlayTime(); // Original game is using system timer
+ uint32 now = _vm->_time->currentSystem();
if (selectedLineId >= 0 && selectedLineId < (int)_saveList.size()) {
if (_timeLeft) {
uint32 timeDiff = now - _timeLast;
diff --git a/engines/bladerunner/ui/kia_section_pogo.cpp b/engines/bladerunner/ui/kia_section_pogo.cpp
index a0c5ac6a63..037cea957c 100644
--- a/engines/bladerunner/ui/kia_section_pogo.cpp
+++ b/engines/bladerunner/ui/kia_section_pogo.cpp
@@ -27,6 +27,7 @@
#include "bladerunner/font.h"
#include "bladerunner/game_info.h"
#include "bladerunner/text_resource.h"
+#include "bladerunner/time.h"
namespace BladeRunner {
@@ -225,14 +226,14 @@ void KIASectionPogo::open() {
_lineOffsets[i] = 0;
}
- _timeLast = _vm->getTotalPlayTime();
+ _timeLast = _vm->_time->currentSystem();
_vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(319), 100, 0, 0, 50, 0);
}
void KIASectionPogo::draw(Graphics::Surface &surface) {
// Timing fixed for 60Hz by ScummVM team
- int timeNow = _vm->getTotalPlayTime();
+ int timeNow = _vm->_time->currentSystem();
bool updateTimeout = false;
if (timeNow - _timeLast > 1000 / 60) {
updateTimeout = true;
diff --git a/engines/bladerunner/ui/kia_section_save.cpp b/engines/bladerunner/ui/kia_section_save.cpp
index 6bdcec964e..07873e39b7 100644
--- a/engines/bladerunner/ui/kia_section_save.cpp
+++ b/engines/bladerunner/ui/kia_section_save.cpp
@@ -28,6 +28,7 @@
#include "bladerunner/game_info.h"
#include "bladerunner/savefile.h"
#include "bladerunner/text_resource.h"
+#include "bladerunner/time.h"
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_shapes.h"
#include "bladerunner/ui/ui_container.h"
@@ -121,7 +122,7 @@ void KIASectionSave::open() {
}
_hoveredLineId = -1;
- _timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ _timeLast = _vm->_time->currentSystem();
_timeLeft = 800;
}
@@ -191,7 +192,7 @@ void KIASectionSave::draw(Graphics::Surface &surface){
_hoveredLineId = selectedLineId;
}
- uint32 now = _vm->getTotalPlayTime(); // Original game is using system timer
+ uint32 now = _vm->_time->currentSystem();
if (selectedLineId >= 0 && selectedLineId < (int)_saveList.size()) {
if (_timeLeft) {
uint32 timeDiff = now - _timeLast;
diff --git a/engines/bladerunner/ui/ui_check_box.cpp b/engines/bladerunner/ui/ui_check_box.cpp
index 631b9ba942..510d6e6dbd 100644
--- a/engines/bladerunner/ui/ui_check_box.cpp
+++ b/engines/bladerunner/ui/ui_check_box.cpp
@@ -25,6 +25,7 @@
#include "bladerunner/audio_player.h"
#include "bladerunner/bladerunner.h"
#include "bladerunner/game_info.h"
+#include "bladerunner/time.h"
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_shapes.h"
@@ -47,7 +48,7 @@ UICheckBox::UICheckBox(BladeRunnerEngine *vm, UIComponentCallback *valueChangedC
_frame = 0;
}
- _timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ _timeLast = _vm->_time->currentSystem();
_rect = rect;
_isChecked = isChecked;
}
@@ -56,7 +57,7 @@ UICheckBox::UICheckBox(BladeRunnerEngine *vm, UIComponentCallback *valueChangedC
void UICheckBox::draw(Graphics::Surface &surface) {
int shapeId;
if (_rect.right > _rect.left && _rect.bottom > _rect.top) {
- uint timeNow = _vm->getTotalPlayTime(); // Original game is using system timer
+ uint timeNow = _vm->_time->currentSystem();
if (timeNow - _timeLast > 67) {
int frameDelta = (timeNow - _timeLast) / 67u;
_timeLast = timeNow;
diff --git a/engines/bladerunner/ui/ui_input_box.cpp b/engines/bladerunner/ui/ui_input_box.cpp
index 6b9388c767..6ad2db2578 100644
--- a/engines/bladerunner/ui/ui_input_box.cpp
+++ b/engines/bladerunner/ui/ui_input_box.cpp
@@ -24,6 +24,7 @@
#include "bladerunner/bladerunner.h"
#include "bladerunner/font.h"
+#include "bladerunner/time.h"
#include "common/keyboard.h"
@@ -43,7 +44,7 @@ UIInputBox::UIInputBox(BladeRunnerEngine *vm, UIComponentCallback *valueChangedC
setText(text);
_cursorIsVisible = false;
- _timeLast = _vm->getTotalPlayTime(); // Original game is using system timer
+ _timeLast = _vm->_time->currentSystem();
}
void UIInputBox::draw(Graphics::Surface &surface) {
@@ -60,8 +61,8 @@ void UIInputBox::draw(Graphics::Surface &surface) {
surface.vLine(textHalfWidth + rectHalfWidth + 2, _rect.top, _rect.bottom - 1, 0x7FDD); // 11111 11110 11101
}
- if (_vm->getTotalPlayTime() - _timeLast > 500) { // Original game is using system timer
- _timeLast = _vm->getTotalPlayTime();
+ if (_vm->_time->currentSystem() - _timeLast > 500) {
+ _timeLast = _vm->_time->currentSystem();
_cursorIsVisible = !_cursorIsVisible;
}
}
diff --git a/engines/bladerunner/ui/ui_scroll_box.cpp b/engines/bladerunner/ui/ui_scroll_box.cpp
index d39e580cd3..39e4174fa3 100644
--- a/engines/bladerunner/ui/ui_scroll_box.cpp
+++ b/engines/bladerunner/ui/ui_scroll_box.cpp
@@ -27,6 +27,7 @@
#include "bladerunner/font.h"
#include "bladerunner/game_info.h"
#include "bladerunner/shape.h"
+#include "bladerunner/time.h"
#include "bladerunner/ui/kia.h"
#include "bladerunner/ui/kia_shapes.h"
@@ -62,9 +63,9 @@ UIScrollBox::UIScrollBox(BladeRunnerEngine *vm, UIScrollBoxCallback *lineSelecte
_isVisible = false;
_style = style;
_center = center;
- _timeLastScroll = _vm->getTotalPlayTime(); // Original game is using system timer
- _timeLastCheckbox = _vm->getTotalPlayTime();
- _timeLastHighlight = _vm->getTotalPlayTime();
+ _timeLastScroll = _vm->_time->currentSystem();
+ _timeLastCheckbox = _vm->_time->currentSystem();
+ _timeLastHighlight = _vm->_time->currentSystem();
_highlightFrame = 0;
@@ -113,9 +114,9 @@ void UIScrollBox::show() {
_scrollAreaDownHover = false;
_scrollBarHover = false;
- _timeLastScroll = _vm->getTotalPlayTime(); // Original game is using system timer
- _timeLastCheckbox = _vm->getTotalPlayTime();
- _timeLastHighlight = _vm->getTotalPlayTime();
+ _timeLastScroll = _vm->_time->currentSystem();
+ _timeLastCheckbox = _vm->_time->currentSystem();
+ _timeLastHighlight = _vm->_time->currentSystem();
_highlightFrame = 0;
_isVisible = true;
@@ -267,7 +268,7 @@ void UIScrollBox::handleMouseDown(bool alternateButton) {
if (!alternateButton) {
if (_scrollUpButtonHover) {
_scrollUpButtonState = 2;
- _timeLastScroll = _vm->getTotalPlayTime() - 160; // Original game is using system timer
+ _timeLastScroll = _vm->_time->currentSystem() - 160;
} else {
_scrollUpButtonState = 1;
}
@@ -283,13 +284,13 @@ void UIScrollBox::handleMouseDown(bool alternateButton) {
}
if (_scrollAreaUpHover) {
_scrollAreaUpState = 2;
- _timeLastScroll = _vm->getTotalPlayTime() - 160; // Original game is using system timer
+ _timeLastScroll = _vm->_time->currentSystem() - 160;
} else {
_scrollAreaUpState = 1;
}
if (_scrollAreaDownHover) {
_scrollAreaDownState = 2;
- _timeLastScroll = _vm->getTotalPlayTime() - 160; // Original game is using system timer
+ _timeLastScroll = _vm->_time->currentSystem() - 160;
} else {
_scrollAreaDownState = 1;
}
@@ -321,7 +322,7 @@ int UIScrollBox::getSelectedLineData() {
}
void UIScrollBox::draw(Graphics::Surface &surface) {
- int timeNow = _vm->getTotalPlayTime(); // Original game is using system timer
+ int timeNow = _vm->_time->currentSystem();
// update scrolling
if (_scrollUpButtonState == 2 && _scrollUpButtonHover) {
diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp
index 0d83237ef4..f073895ae5 100644
--- a/engines/bladerunner/vqa_player.cpp
+++ b/engines/bladerunner/vqa_player.cpp
@@ -23,6 +23,7 @@
#include "bladerunner/vqa_player.h"
#include "bladerunner/bladerunner.h"
+#include "bladerunner/time.h"
#include "audio/decoders/raw.h"
@@ -72,7 +73,7 @@ void VQAPlayer::close() {
}
int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics::Surface *customSurface) {
- uint32 now = 60 * _vm->_system->getMillis();
+ uint32 now = 60 * _vm->_time->currentSystem();
int result = -1;
if (_frameNext < 0) {
@@ -216,7 +217,7 @@ bool VQAPlayer::setBeginAndEndFrame(int begin, int end, int repeatsCount, int lo
bool VQAPlayer::seekToFrame(int frame) {
_frameNext = frame;
- _frameNextTime = 60 * _vm->_system->getMillis();
+ _frameNextTime = 60 * _vm->_time->currentSystem();
return true;
}