[Scummvm-cvs-logs] CVS: scummvm/backends/dc dc.h,1.7,1.8 dcmain.cpp,1.5,1.6 input.cpp,1.5,1.6 time.cpp,1.1,1.2

Marcus Comstedt marcus_c at users.sourceforge.net
Sun Mar 2 12:23:53 CET 2003


Update of /cvsroot/scummvm/scummvm/backends/dc
In directory sc8-pr-cvs1:/tmp/cvs-serv3902

Modified Files:
	dc.h dcmain.cpp input.cpp time.cpp 
Log Message:
Timer implemented.

Index: dc.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/dc.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dc.h	2 Mar 2003 17:41:47 -0000	1.7
+++ dc.h	2 Mar 2003 20:17:21 -0000	1.8
@@ -104,6 +104,10 @@
   int _screen_buffer, _overlay_buffer, _mouse_buffer;
   float _overlay_fade;
 
+  uint32 _timer_duration, _timer_next_expiry;
+  bool _timer_active;
+  int (*_timer_callback) (int);
+
   unsigned char *screen;
   unsigned short *mouse;
   unsigned short *overlay;

Index: dcmain.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/dcmain.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dcmain.cpp	18 Oct 2002 01:38:01 -0000	1.5
+++ dcmain.cpp	2 Mar 2003 20:17:21 -0000	1.6
@@ -122,10 +122,6 @@
   warning("Creating a thread! (not supported.)\n");
 }
 
-void OSystem_Dreamcast::set_timer(int timer, int (*callback)(int))
-{
-  warning("Setting a timer! (not supported.)\n");  
-}
 
 /* Mutex handling */
 void *OSystem_Dreamcast::create_mutex(void)

Index: input.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/input.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- input.cpp	6 Dec 2002 01:30:38 -0000	1.5
+++ input.cpp	2 Mar 2003 20:17:21 -0000	1.6
@@ -140,6 +140,12 @@
 bool OSystem_Dreamcast::poll_event(Event *event)
 {
   unsigned int t = Timer();
+
+  if(_timer_active && ((int)(t-_timer_next_expiry))>=0) {
+    _timer_duration = _timer_callback(_timer_duration);
+    _timer_next_expiry = t+USEC_TO_TIMER(1000*_timer_duration);
+  }
+
   if(((int)(t-_devpoll))<0)
     return false;
   _devpoll += USEC_TO_TIMER(17000);

Index: time.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/dc/time.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- time.cpp	18 Oct 2002 01:35:46 -0000	1.1
+++ time.cpp	2 Mar 2003 20:17:21 -0000	1.2
@@ -53,6 +53,18 @@
   get_msecs();
 }
 
+void OSystem_Dreamcast::set_timer(int timer, int (*callback)(int))
+{
+  if (callback != NULL) {
+    _timer_duration = timer;
+    _timer_next_expiry = Timer() + USEC_TO_TIMER(1000*timer);
+    _timer_callback = callback;
+    _timer_active = true;
+  } else {
+    _timer_active = false;
+  }
+}
+
 
 /*
 void waitForTimer(Scumm *s, int time)





More information about the Scummvm-git-logs mailing list