[Scummvm-cvs-logs] CVS: scummvm/saga render.cpp,1.9,1.10 render.h,1.6,1.7 timer.cpp,1.2,1.3 timer.h,1.1,1.2

Jonathan Gray khalek at users.sourceforge.net
Sat May 1 19:13:00 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19666

Modified Files:
	render.cpp render.h timer.cpp timer.h 
Log Message:
get rid of the last bits of SDL timer usage, SAGA should now be 100% OSystem

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- render.cpp	2 May 2004 00:00:39 -0000	1.9
+++ render.cpp	2 May 2004 02:11:55 -0000	1.10
@@ -66,7 +66,6 @@
 
 int RENDER_Init(OSystem *system) {
 	R_GAME_DISPLAYINFO disp_info;
-	int result;
 	int tmp_w, tmp_h, tmp_bytepp;
 
 	// Initialize system graphics
@@ -77,10 +76,7 @@
 	}
 
 	// Initialize FPS timer callback
-	result = SYSTIMER_CreateTimer(&RenderModule.r_fps_timer, 1000, NULL, RENDER_FpsTimer);
-	if (result != R_SUCCESS) {
-		return R_FAILURE;
-	}
+	g_timer->installTimerProc(&RENDER_FpsTimer, 1000, _vm);
 
 	// Create background buffer 
 	RenderModule.r_bg_buf_w = disp_info.logical_w;
@@ -227,10 +223,7 @@
 	return framecount;
 }
 
-void RENDER_FpsTimer(unsigned long interval, void *param) {
-	YS_IGNORE_PARAM(interval);
-	YS_IGNORE_PARAM(param);
-
+void RENDER_FpsTimer(void *refCon) {
 	RenderModule.r_fps = RenderModule.r_framecount;
 	RenderModule.r_framecount = 0;
 

Index: render.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- render.h	1 May 2004 19:41:47 -0000	1.6
+++ render.h	2 May 2004 02:11:55 -0000	1.7
@@ -53,7 +53,6 @@
 	int r_tmp_buf_w;
 	int r_tmp_buf_h;
 
-	R_SYSTIMER *r_fps_timer;
 	R_SPRITELIST *r_test_sprite;
 
 	unsigned int r_fps;
@@ -62,7 +61,7 @@
 	int r_mode;
 };
 
-void RENDER_FpsTimer(unsigned long interval, void *param);
+void RENDER_FpsTimer(void *refCon);
 
 } // End of namespace Saga
 

Index: timer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/timer.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- timer.cpp	2 May 2004 01:39:14 -0000	1.2
+++ timer.cpp	2 May 2004 02:11:55 -0000	1.3
@@ -23,18 +23,16 @@
 
 #include "reinherit.h"
 
-#include <SDL.h>
-
 #include "timer.h"
 
+// FIXME: replace calls to this with direct OSystem calls
+
 namespace Saga {
 
 struct R_SYSTIMER {
 	int t_running;
 	unsigned long t_interval;
 	void *t_param;
-	R_SYSTIMER_CALLBACK t_callback_f;
-	SDL_TimerID t_sdl_timerid;
 };
 
 struct R_SYSTIMER_DATA {
@@ -46,8 +44,6 @@
 
 static R_SYSTIMER_DATA R_TimerData;
 
-static Uint32 SYSTIMER_Callback(Uint32 interval, void *param);
-
 int SYSTIMER_InitMSCounter() {
 	if (R_TimerData.initialized) {
 		return R_FAILURE;
@@ -60,7 +56,7 @@
 }
 
 unsigned long SYSTIMER_ReadMSCounter() {
-	Uint32 ms_elapsed = 0;
+	uint32 ms_elapsed = 0;
 
 	if (!R_TimerData.initialized) {
 		return 0;
@@ -94,46 +90,5 @@
 	return R_SUCCESS;
 }
 
-int SYSTIMER_CreateTimer(R_SYSTIMER **timer, unsigned long interval, void *param, R_SYSTIMER_CALLBACK callback) {
-	R_SYSTIMER *new_timer = (R_SYSTIMER *)malloc(sizeof *new_timer);
-	if (new_timer == NULL) {
-		return R_MEM;
-	}
-
-	new_timer->t_interval = interval;
-	new_timer->t_param = param;
-	new_timer->t_callback_f = callback;
-
-	*timer = new_timer;
-
-	new_timer->t_sdl_timerid = SDL_AddTimer(interval, SYSTIMER_Callback, new_timer);
-
-	if (new_timer->t_sdl_timerid == NULL) {
-		free(new_timer);
-		*timer = NULL;
-		return R_FAILURE;
-	}
-
-	return R_SUCCESS;
-}
-
-int SYSTIMER_DestroyTimer(R_SYSTIMER *timer) {
-	if (timer == NULL) {
-		return R_FAILURE;
-	}
-
-	timer->t_running = 0;
-	SDL_RemoveTimer(timer->t_sdl_timerid);
-	free(timer);
-
-	return R_SUCCESS;
-}
-
-Uint32 SYSTIMER_Callback(Uint32 interval, void *param) {
-	R_SYSTIMER *timer_p = (R_SYSTIMER *)param;
-	timer_p->t_callback_f(timer_p->t_interval, timer_p->t_param);
-
-	return timer_p->t_interval;
-}
 
 } // End of namespace Saga

Index: timer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/timer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- timer.h	1 May 2004 23:46:23 -0000	1.1
+++ timer.h	2 May 2004 02:11:55 -0000	1.2
@@ -23,9 +23,9 @@
 #ifndef SAGA_SYSTIMER_H__
 #define SAGA_SYSTIMER_H__
 
-namespace Saga {
+#include <common/timer.h>
 
-typedef void (*R_SYSTIMER_CALLBACK) (unsigned long, void *);
+namespace Saga {
 
 struct R_SYSTIMER;
 
@@ -33,9 +33,6 @@
 unsigned long SYSTIMER_ReadMSCounter();
 int SYSTIMER_ResetMSCounter();
 int SYSTIMER_Sleep(uint16 msec);
-int SYSTIMER_CreateTimer(R_SYSTIMER **,
-unsigned long, void *, R_SYSTIMER_CALLBACK);
-int SYSTIMER_DestroyTimer(R_SYSTIMER *);
 
 
 } // End of namespace Saga





More information about the Scummvm-git-logs mailing list