aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins
diff options
context:
space:
mode:
authorPaul Gilbert2012-09-15 11:45:36 +1000
committerPaul Gilbert2012-09-15 11:45:36 +1000
commit6e8fd5812ba1d03c8dd4753eb75d6da34f8d7033 (patch)
treee091e193a5605d88bf9bb1ca2455c09c66c3d23c /engines/hopkins
parentf1fce64994e687aada097f6293776108bdedcd68 (diff)
downloadscummvm-rg350-6e8fd5812ba1d03c8dd4753eb75d6da34f8d7033.tar.gz
scummvm-rg350-6e8fd5812ba1d03c8dd4753eb75d6da34f8d7033.tar.bz2
scummvm-rg350-6e8fd5812ba1d03c8dd4753eb75d6da34f8d7033.zip
HOPKINS: Cleanup and refactoring of frame counting and delays
Diffstat (limited to 'engines/hopkins')
-rw-r--r--engines/hopkins/anim.cpp5
-rw-r--r--engines/hopkins/events.cpp16
-rw-r--r--engines/hopkins/events.h2
-rw-r--r--engines/hopkins/hopkins.cpp21
-rw-r--r--engines/hopkins/hopkins.h1
5 files changed, 25 insertions, 20 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
index f7e4df4c76..cb3c5af2c5 100644
--- a/engines/hopkins/anim.cpp
+++ b/engines/hopkins/anim.cpp
@@ -51,10 +51,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui
doneFlag = 0;
for (;;) {
MAIN_LOOP:
- v15 = 0;
- v14 = 0;
- v17 = 0;
- v16 = 0;
+ v14 = v15 = v16 = v17 = 0;
v18 = 1;
screenP = _vm->_graphicsManager.VESA_SCREEN;
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp
index c0c3c6e3e8..49e472ad17 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/events.cpp
@@ -83,13 +83,25 @@ void EventsManager::CONTROLE_MES() {
pollEvents();
}
-void EventsManager::pollEvents() {
+void EventsManager::checkForNextFrameCounter() {
uint32 milli = g_system->getMillis();
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
_priorFrameTime = milli;
++lItCounter;
+
+ g_system->updateScreen();
}
+}
+
+void EventsManager::delay(int delay) {
+ uint32 delayEnd = g_system->getMillis() + delay;
+ while (!g_system->getEventManager()->shouldQuit() && g_system->getMillis() < delayEnd) {
+ g_system->delayMillis(10);
+ }
+}
+
+void EventsManager::pollEvents() {
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
// Handle keypress
@@ -111,6 +123,8 @@ void EventsManager::pollEvents() {
default:
break;
}
+
+ checkForNextFrameCounter();
}
}
diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h
index 8dc00a04c3..19629bfc5f 100644
--- a/engines/hopkins/events.h
+++ b/engines/hopkins/events.h
@@ -34,6 +34,7 @@ namespace Hopkins {
class EventsManager {
private:
void pollEvents();
+ void checkForNextFrameCounter();
public:
bool souris_flag;
bool mouse_linux;
@@ -60,6 +61,7 @@ public:
void showCursor();
void CONTROLE_MES();
+ void delay(int delay);
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index dae6cceb03..a0d192e091 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -72,18 +72,19 @@ Common::Error HopkinsEngine::run() {
_graphicsManager.LOAD_IMAGE("LINUX");
_graphicsManager.FADE_INW();
- delay(1500);
+ _eventsManager.delay(1500);
_graphicsManager.FADE_OUTW();
if (!GLOBALS.internet) {
_graphicsManager.FADE_LINUX = 2;
_animationManager.PLAY_ANM("MP.ANM", 10, 16, 200);
}
- /*
- LOAD_IMAGE("H2");
- FADE_INW();
- SDL_Delay(500);
- FADE_OUTW();
+
+ _graphicsManager.LOAD_IMAGE("H2");
+ _graphicsManager.FADE_INW();
+ _eventsManager.delay(500);
+ _graphicsManager.FADE_OUTW();
+/*
if ( !ESC_KEY )
INTRORUN(a1);
iRegul = 0;
@@ -601,12 +602,4 @@ void HopkinsEngine::Init_Interrupt() {
// TODO: Determine whether the timer is needed
}
-void HopkinsEngine::delay(int delay) {
- uint32 delayEnd = g_system->getMillis() + delay;
-
- while (!g_vm->shouldQuit() && g_system->getMillis() < delayEnd) {
- g_system->delayMillis(10);
- }
-}
-
} // End of namespace Hopkins
diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h
index 6a9398fd49..568b9db6db 100644
--- a/engines/hopkins/hopkins.h
+++ b/engines/hopkins/hopkins.h
@@ -98,7 +98,6 @@ public:
bool getIsDemo() const;
int getRandomNumber(int maxNumber);
- void delay(int delay);
};
// Global reference to the HopkinsEngine object