[Scummvm-cvs-logs] CVS: scummvm/queen queen.h,1.9,1.10 queen.cpp,1.20,1.21 display.h,1.6,1.7 display.cpp,1.9,1.10

Gregory Montoir cyx at users.sourceforge.net
Mon Oct 20 13:15:18 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv18699

Modified Files:
	queen.h queen.cpp display.h display.cpp 
Log Message:
scrolling timing (copy/paste from SkyEngine)

Index: queen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- queen.h	17 Oct 2003 08:40:48 -0000	1.9
+++ queen.h	20 Oct 2003 20:12:58 -0000	1.10
@@ -74,7 +74,8 @@
 
 	void initialise();
 
-	static int CDECL game_thread_proc(void *param);
+	static void timerHandler(void *ptr);
+	void gotTimerTick();
 };
 
 // XXX: Temporary hack to allow Graphics to call delay()

Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- queen.cpp	20 Oct 2003 19:18:02 -0000	1.20
+++ queen.cpp	20 Oct 2003 20:12:59 -0000	1.21
@@ -222,7 +222,21 @@
 	_graphics = new Graphics(_display, _resource);
 	_logic = new Logic(_resource, _graphics, _display);
 	//_sound = new Sound(_mixer, _detector->_sfx_volume);
+	_timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second
+}
+
+
+void QueenEngine::timerHandler(void *ptr) {
+
+	((QueenEngine *)ptr)->gotTimerTick();
 }
+
+
+void QueenEngine::gotTimerTick() {
+
+	_display->handleTimer();
+}
+
 
 void QueenEngine::delay(uint amount) { 
 

Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- display.h	20 Oct 2003 10:26:56 -0000	1.6
+++ display.h	20 Oct 2003 20:12:59 -0000	1.7
@@ -100,6 +100,9 @@
 
 	bool fullscreen() const { return _fullscreen; }
 
+	void handleTimer();
+	void waitForTimer();
+
 
 private:
 
@@ -136,6 +139,8 @@
 	uint16 _bdWidth, _bdHeight;
 
 	Common::RandomSource _randomizer;
+
+	bool _gotTick;
 
 	Dynalum _dynalum;
 	OSystem *_system;

Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- display.cpp	20 Oct 2003 10:26:56 -0000	1.9
+++ display.cpp	20 Oct 2003 20:12:59 -0000	1.10
@@ -212,7 +212,7 @@
 	_system->set_palette(tempPal + start * 4, start, end - start + 1);
 	if (updateScreen) {
 		_system->update_screen();
-		_system->delay_msecs(20);
+		waitForTimer();
 	}
 }
 
@@ -783,6 +783,25 @@
 
 	_horizontalScroll = scroll;
 }
+
+
+void Display::handleTimer() {
+
+	_gotTick = true;
+}
+
+
+void Display::waitForTimer() {
+
+	_gotTick = false;
+	while (!_gotTick) {
+		OSystem::Event event;
+
+		_system->delay_msecs(10);
+		while (_system->poll_event(&event));
+	}
+}
+
 
 
 const uint8 TextRenderer::FONT[] = {





More information about the Scummvm-git-logs mailing list