aboutsummaryrefslogtreecommitdiff
path: root/engines/supernova2/state.cpp
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-05-30 15:12:37 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit701a9570070009dfc45f93330d19645b6f6ed1ce (patch)
treec5624edce685c49ff13fd8bcf253a1ac022ed6ae /engines/supernova2/state.cpp
parent6bd7e561b4325b48255d0d71a654432fd1c84889 (diff)
downloadscummvm-rg350-701a9570070009dfc45f93330d19645b6f6ed1ce.tar.gz
scummvm-rg350-701a9570070009dfc45f93330d19645b6f6ed1ce.tar.bz2
scummvm-rg350-701a9570070009dfc45f93330d19645b6f6ed1ce.zip
SUPERNOVA2: Add taxi stand room
Diffstat (limited to 'engines/supernova2/state.cpp')
-rw-r--r--engines/supernova2/state.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index 00b54c147e..4a10522cd8 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -158,6 +158,7 @@ GameManager::~GameManager() {
void GameManager::destroyRooms() {
delete _rooms[INTRO];
delete _rooms[AIRPORT];
+ delete _rooms[TAXISTAND];
}
void GameManager::initState() {
@@ -174,6 +175,7 @@ void GameManager::initState() {
_mouseY = -1;
_mouseField = -1;
_inventoryScroll = 0;
+ _oldTime = g_system->getMillis();
_timerPaused = 0;
_timePaused = false;
_messageDuration = 0;
@@ -193,6 +195,7 @@ void GameManager::initState() {
void GameManager::initRooms() {
_rooms[INTRO] = new Intro(_vm, this);
_rooms[AIRPORT] = new Airport(_vm, this);
+ _rooms[TAXISTAND] = new TaxiStand(_vm, this);
}
void GameManager::initGui() {
@@ -238,6 +241,7 @@ void GameManager::initGui() {
}
void GameManager::updateEvents() {
+ handleTime();
if (_animationEnabled && !_vm->_screen->isMessageShown() && _animationTimer == 0)
_currentRoom->animation();
@@ -677,6 +681,24 @@ bool GameManager::waitOnInput(int ticks, Common::KeyCode &keycode) {
return false;
}
+void GameManager::setAnimationTimer(int ticks) {
+ _animationTimer = ticksToMsec(ticks);
+}
+
+void GameManager::handleTime() {
+ if (_timerPaused)
+ return;
+ int32 newTime = g_system->getMillis();
+ int32 delta = newTime - _oldTime;
+
+ if (_animationTimer > delta)
+ _animationTimer -= delta;
+ else
+ _animationTimer = 0;
+
+ _oldTime = newTime;
+}
+
int GameManager::invertSection(int section) {
if (section < 128)
section += 128;