aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/ui
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/bladerunner/ui
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/bladerunner/ui')
-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
9 files changed, 39 insertions, 31 deletions
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) {