[Scummvm-cvs-logs] SF.net SVN: scummvm:[48119] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Feb 23 23:48:13 CET 2010


Revision: 48119
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48119&view=rev
Author:   fingolfin
Date:     2010-02-23 22:47:53 +0000 (Tue, 23 Feb 2010)

Log Message:
-----------
SCI: Turn kernel_sleep() into SciEvent::sleep()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kmisc.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/event.cpp
    scummvm/trunk/engines/sci/event.h
    scummvm/trunk/engines/sci/graphics/menu.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-02-23 22:44:46 UTC (rev 48118)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-02-23 22:47:53 UTC (rev 48119)
@@ -721,26 +721,6 @@
 	return false;
 }
 
-void kernel_sleep(SciEvent *event, uint32 msecs) {
-	uint32 time;
-	const uint32 wakeup_time = g_system->getMillis() + msecs;
-
-	while (true) {
-		// let backend process events and update the screen
-		event->get(SCI_EVENT_PEEK);
-		// TODO: we need to call Cursor::refreshPosition() before each screen update to limit the mouse cursor position
-		time = g_system->getMillis();
-		if (time + 10 < wakeup_time) {
-			g_system->delayMillis(10);
-		} else {
-			if (time < wakeup_time)
-				g_system->delayMillis(wakeup_time - time);
-			break;
-		}
-
-	}
-}
-
 void Kernel::setDefaultKernelNames(Common::String gameId) {
 	_kernelNames = Common::StringList(sci_default_knames, SCI_KNAMES_DEFAULT_ENTRIES_NR);
 

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-02-23 22:44:46 UTC (rev 48118)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-02-23 22:47:53 UTC (rev 48119)
@@ -77,7 +77,7 @@
 		uint32 neededSleep = 30;
 
 		if (duration < neededSleep) {
-			kernel_sleep(s->_event, neededSleep - duration);
+			s->_event->sleep(neededSleep - duration);
 			s->_throttleLastTime = g_system->getMillis();
 		} else {
 			s->_throttleLastTime = curTime;

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-02-23 22:44:46 UTC (rev 48118)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-02-23 22:47:53 UTC (rev 48119)
@@ -27,7 +27,7 @@
 
 #include "sci/sci.h"	// for INCLUDE_OLDGFX
 #include "sci/debug.h"	// for g_debug_sleeptime_factor
-#include "sci/event.h"	// for kernel_sleep
+#include "sci/event.h"
 
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
@@ -93,7 +93,7 @@
 	last_wait_time = time;
 
 	ticks *= g_debug_sleeptime_factor;
-	kernel_sleep(_event, ticks * 1000 / 60);
+	_event->sleep(ticks * 1000 / 60);
 }
 
 uint16 EngineState::currentRoomNumber() const {

Modified: scummvm/trunk/engines/sci/event.cpp
===================================================================
--- scummvm/trunk/engines/sci/event.cpp	2010-02-23 22:44:46 UTC (rev 48118)
+++ scummvm/trunk/engines/sci/event.cpp	2010-02-23 22:47:53 UTC (rev 48119)
@@ -351,4 +351,25 @@
 	return event;
 }
 
+void SciEvent::sleep(uint32 msecs) {
+	uint32 time;
+	const uint32 wakeup_time = g_system->getMillis() + msecs;
+
+	while (true) {
+		// let backend process events and update the screen
+		get(SCI_EVENT_PEEK);
+		// TODO: we need to call Cursor::refreshPosition() before each screen update to limit the mouse cursor position
+		time = g_system->getMillis();
+		if (time + 10 < wakeup_time) {
+			g_system->delayMillis(10);
+		} else {
+			if (time < wakeup_time)
+				g_system->delayMillis(wakeup_time - time);
+			break;
+		}
+
+	}
+}
+
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/event.h
===================================================================
--- scummvm/trunk/engines/sci/event.h	2010-02-23 22:44:46 UTC (rev 48118)
+++ scummvm/trunk/engines/sci/event.h	2010-02-23 22:47:53 UTC (rev 48119)
@@ -118,6 +118,8 @@
 
 	sciEvent get(unsigned int mask);
 
+	void sleep(uint32 msecs);
+
 private:
 	int altify (int ch);
 	int shiftify (int c);
@@ -127,8 +129,6 @@
 	Common::List<sciEvent> _events;
 };
 
-void kernel_sleep(SciEvent *event, uint32 msecs); // is in kernel.cpp
-
 } // End of namespace Sci
 
 #endif

Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-23 22:44:46 UTC (rev 48118)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-23 22:47:53 UTC (rev 48119)
@@ -760,7 +760,7 @@
 			}
 			break;
 		case SCI_EVENT_NONE:
-			kernel_sleep(_event, 2500 / 1000);
+			_event->sleep(2500 / 1000);
 			break;
 		}
 	}
@@ -799,7 +799,7 @@
 			return curItemEntry;
 
 		case SCI_EVENT_NONE:
-			kernel_sleep(_event, 2500 / 1000);
+			_event->sleep(2500 / 1000);
 			break;
 		}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list