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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Feb 24 21:50:09 CET 2009


Revision: 38854
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38854&view=rev
Author:   fingolfin
Date:     2009-02-24 20:50:09 +0000 (Tue, 24 Feb 2009)

Log Message:
-----------
SCI: Replaced gfxop_usleep by gfxop_sleep (taking millisecs instead of microsecs)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmenu.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/gfx/gfx_test.cpp
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/gfx/operations.h

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2009-02-24 20:50:09 UTC (rev 38854)
@@ -45,7 +45,7 @@
 		// waiting!
 		int delay = s->script_000->locals_block->locals[SCI_VARIABLE_GAME_SPEED].offset;
 
-		gfxop_usleep(s->gfx_state, (1000000 * delay) / 60);
+		gfxop_sleep(s->gfx_state, delay * 1000 / 60);
 	}
 
 	// If there's a simkey pending, and the game wants a keyboard event, use the

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-24 20:50:09 UTC (rev 38854)
@@ -659,7 +659,7 @@
 	s->kernel_opt_flags &= ~(KERNEL_OPT_FLAG_GOT_EVENT | KERNEL_OPT_FLAG_GOT_2NDEVENT);
 
 	sleep_time *= debug_sleeptime_factor;
-	GFX_ASSERT(gfxop_usleep(s->gfx_state, sleep_time * 1000000 / 60));
+	GFX_ASSERT(gfxop_sleep(s->gfx_state, sleep_time * 1000 / 60));
 
 	return s->r_acc;
 }
@@ -2593,7 +2593,7 @@
 			gfxop_update(s->gfx_state);
 			GRAPH_BLANK_BOX(s, 319 - i, 10, granularity1, 190, 0);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
@@ -2605,7 +2605,7 @@
 			gfxop_update(s->gfx_state);
 			GRAPH_UPDATE_BOX(s, 319 - i, 10, granularity1, 190);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2618,7 +2618,7 @@
 			gfxop_update(s->gfx_state);
 			GRAPH_BLANK_BOX(s, 0, 199 - i, 320, granularity2, 0);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, 2 * s->animation_delay);
+			gfxop_sleep(s->gfx_state, 2 * s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
@@ -2630,7 +2630,7 @@
 			gfxop_update(s->gfx_state);
 			GRAPH_UPDATE_BOX(s, 0, 199 - i, 320, granularity2);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, 2 * s->animation_delay);
+			gfxop_sleep(s->gfx_state, 2 * s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2641,7 +2641,7 @@
 		for (i = 0; i < 319 + granularity0; i += granularity0) {
 			GRAPH_BLANK_BOX(s, i, 10, granularity0, 190, 0);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay / 2);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 2 / 1000);
 			process_sound_events(s);
 		}
 		GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
@@ -2650,7 +2650,7 @@
 		for (i = 319; i >= 1 - granularity0; i -= granularity0) {
 			GRAPH_UPDATE_BOX(s, i, 10, granularity0, 190);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay / 2);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 2 / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2661,7 +2661,7 @@
 		for (i = 319; i >= 1 - granularity0; i -= granularity0) {
 			GRAPH_BLANK_BOX(s, i, 10, granularity0, 190, 0);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay / 2);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 2 / 1000);
 			process_sound_events(s);
 		}
 		GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
@@ -2671,7 +2671,7 @@
 		for (i = 0; i < 319 + granularity0; i += granularity0) {
 			GRAPH_UPDATE_BOX(s, i, 10, granularity0, 190);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay / 2);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 2 / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2682,7 +2682,7 @@
 		for (i = 10; i < 199 + granularity1; i += granularity1) {
 			GRAPH_BLANK_BOX(s, 0, i, 320, granularity1, 0);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
@@ -2692,7 +2692,7 @@
 		for (i = 199; i >= 11 - granularity1; i -= granularity1) {
 			GRAPH_UPDATE_BOX(s, 0, i, 320, granularity1);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2703,7 +2703,7 @@
 		for (i = 199; i >= 11 - granularity1; i -= granularity1) {
 			GRAPH_BLANK_BOX(s, 0, i, 320, granularity1, 0);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
@@ -2713,7 +2713,7 @@
 		for (i = 10; i < 199 + granularity1; i += granularity1) {
 			GRAPH_UPDATE_BOX(s, 0, i, 320, granularity1);
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay);
+			gfxop_sleep(s->gfx_state, s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2738,7 +2738,7 @@
 			GRAPH_BLANK_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l, 0);
 			gfxop_update(s->gfx_state);
 
-			gfxop_usleep(s->gfx_state, 4 * s->animation_delay);
+			gfxop_sleep(s->gfx_state, 4 * s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 
@@ -2761,7 +2761,7 @@
 			GRAPH_UPDATE_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l);
 			gfxop_update(s->gfx_state);
 
-			gfxop_usleep(s->gfx_state, 4 * s->animation_delay);
+			gfxop_sleep(s->gfx_state, 4 * s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 
@@ -2786,7 +2786,7 @@
 			GRAPH_BLANK_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l, 0);
 			gfxop_update(s->gfx_state);
 
-			gfxop_usleep(s->gfx_state, 7 * s->animation_delay);
+			gfxop_sleep(s->gfx_state, 7 * s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 
@@ -2809,7 +2809,7 @@
 			GRAPH_UPDATE_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l);
 			gfxop_update(s->gfx_state);
 
-			gfxop_usleep(s->gfx_state, 7 * s->animation_delay);
+			gfxop_sleep(s->gfx_state, 7 * s->animation_delay / 1000);
 			process_sound_events(s);
 		}
 		break;
@@ -2839,7 +2839,7 @@
 			}
 
 			if (remaining_checkers & 1) {
-				gfxop_usleep(s->gfx_state, s->animation_delay / 4);
+				gfxop_sleep(s->gfx_state, s->animation_delay / 4 / 1000);
 			}
 
 			--remaining_checkers;
@@ -2871,7 +2871,7 @@
 			}
 
 			if (remaining_checkers & 1) {
-				gfxop_usleep(s->gfx_state, s->animation_delay / 4);
+				gfxop_sleep(s->gfx_state, s->animation_delay / 4 / 1000);
 			}
 
 			--remaining_checkers;
@@ -2886,7 +2886,7 @@
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(320 - i, 0, i, 190), Common::Point(0, 10)));
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, 0, 320 - i, 190), Common::Point(i, 10)));
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay >> 3);
+			gfxop_sleep(s->gfx_state, (s->animation_delay >> 3) / 1000);
 		}
 		GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
 		break;
@@ -2897,7 +2897,7 @@
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(0, 0, i, 190), Common::Point(319 - i, 10)));
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(i, 0, 320 - i, 190), Common::Point(0, 10)));
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay >> 3);
+			gfxop_sleep(s->gfx_state, (s->animation_delay >> 3) / 1000);
 		}
 		GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
 		break;
@@ -2908,7 +2908,7 @@
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(0, 190 - i, 320, i), Common::Point(0, 10)));
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, 0, 320, 190 - i), Common::Point(0, 10 + i)));
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay >> 3);
+			gfxop_sleep(s->gfx_state, (s->animation_delay >> 3) / 1000);
 		}
 		GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
 		break;
@@ -2919,7 +2919,7 @@
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(0, 0, 320, i), Common::Point(0, 200 - i)));
 			GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, i, 320, 190 - i), Common::Point(0, 10)));
 			gfxop_update(s->gfx_state);
-			gfxop_usleep(s->gfx_state, s->animation_delay >> 3);
+			gfxop_sleep(s->gfx_state, (s->animation_delay >> 3) / 1000);
 		}
 		GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
 		break;
@@ -3071,11 +3071,11 @@
 		                  Common::Point(shake_right, shake_down));
 
 		gfxop_update(s->gfx_state);
-		gfxop_usleep(s->gfx_state, 50000);
+		gfxop_sleep(s->gfx_state, 50);
 
 		gfxop_draw_pixmap(s->gfx_state, screen, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
 		gfxop_update(s->gfx_state);
-		gfxop_usleep(s->gfx_state, 50000);
+		gfxop_sleep(s->gfx_state, 50);
 	}
 
 	gfxop_free_pixmap(s->gfx_state, screen);

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-02-24 20:50:09 UTC (rev 38854)
@@ -276,7 +276,7 @@
 			if (event.type == SCI_EVT_KEYBOARD)
 				cont = 0;
 
-			gfxop_usleep(s->gfx_state, 25000);
+			gfxop_sleep(s->gfx_state, 25);
 		}
 
 
@@ -458,7 +458,7 @@
 				break;
 
 			case SCI_EVT_NONE:
-				gfxop_usleep(s->gfx_state, 2500);
+				gfxop_sleep(s->gfx_state, 2500 / 1000);
 				break;
 			}
 

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-02-24 20:50:09 UTC (rev 38854)
@@ -1607,7 +1607,7 @@
 	s->visual->draw(GFXW(s->visual), Common::Point(0, 0));
 	gfxop_update_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
 	gfxop_update(s->gfx_state);
-	gfxop_usleep(s->gfx_state, 10);
+	gfxop_sleep(s->gfx_state, 0);
 
 	return 0;
 }
@@ -1766,7 +1766,7 @@
 	gfxop_new_pic(s->gfx_state, cmd_params[0].val, flags, default_palette);
 	gfxop_clear_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
 	gfxop_update(s->gfx_state);
-	gfxop_usleep(s->gfx_state, 0);
+	gfxop_sleep(s->gfx_state, 0);
 
 	return 0;
 }
@@ -1911,7 +1911,7 @@
 	else
 		gfxop_update_box(s->gfx_state, rect);
 	gfxop_update(s->gfx_state);
-	gfxop_usleep(s->gfx_state, 10);
+	gfxop_sleep(s->gfx_state, 0);
 
 	return 0;
 }

Modified: scummvm/trunk/engines/sci/gfx/gfx_test.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_test.cpp	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/gfx/gfx_test.cpp	2009-02-24 20:50:09 UTC (rev 38854)
@@ -580,7 +580,7 @@
 		if (event.type)
 			return 0;
 
-		gfxop_usleep(state, 1000);
+		gfxop_sleep(state, 1);
 	}
 	return 1;
 }
@@ -597,7 +597,7 @@
 		        && event.data == key)
 			return 0;
 
-		gfxop_usleep(state, 1000);
+		gfxop_sleep(state, 1);
 	}
 	return 1;
 }
@@ -800,7 +800,7 @@
 	for (i = 0; i <= 40; i++) {
 		gfxop_update_box(state, gfx_rect(i*4, 0 , 4, 150));
 		gfxop_update_box(state, gfx_rect(317 - i*4, 0 , 4, 150));
-		gfxop_usleep(state, 4000);
+		gfxop_sleep(state, 4);
 	}
 
 	gfxop_disable_dirty_frames(state);
@@ -814,7 +814,7 @@
 	for (i = 159; i >= 0; i--) {
 		gfxop_update_box(state, gfx_rect(i, 0 , 1, 150));
 		gfxop_update_box(state, gfx_rect(319 - i, 0 , 1, 150));
-		gfxop_usleep(state, 1000);
+		gfxop_sleep(state, 1);
 	}
 
 	clear();
@@ -887,7 +887,7 @@
 				gfxop_update_box(state, line);
 			}
 
-		gfxop_usleep(state, 1000);
+		gfxop_sleep(state, 1);
 	}
 
 	event.type = 0;
@@ -929,7 +929,7 @@
 		clear_buffer();
 		gfxop_draw_cel(state, 0, 0, 0, gfx_point(x, 40), white, 0);
 		update();
-		gfxop_usleep(state, 10000);
+		gfxop_sleep(state, 10);
 	}
 
 	MESSAGE("E.2: Pic views\nFour pic views will now be added to\nthe static buffer");
@@ -957,7 +957,7 @@
 		gfxop_draw_cel(state, 0, 0, 2, gfx_point(x, 20), white8, 0);
 		gfxop_draw_cel(state, 0, 0, 2, gfx_point(x, 100), white16, 0);
 		update();
-		gfxop_usleep(state, 10000);
+		gfxop_sleep(state, 10);
 	}
 
 	gfxop_add_to_pic(state, 1, 0, 0);
@@ -975,7 +975,7 @@
 		gfxop_update(state);
 		/*		gfxop_update_box(state, gfx_rect(x-1, 40, 17, 16)); */
 		/*		gfxop_update_box(state, gfx_rect(x-1, 70, 17, 16)); */
-		gfxop_usleep(state, 10000);
+		gfxop_sleep(state, 10);
 	}
 	waitkey();
 }

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-24 20:50:09 UTC (rev 38854)
@@ -30,8 +30,6 @@
 
 #include "common/system.h"
 
-#include <ctype.h>
-
 namespace Sci {
 
 #define PRECISE_PRIORITY_MAP // Duplicate all operations on the local priority map as appropriate
@@ -1362,11 +1360,11 @@
 	return 0;
 }
 
-int gfxop_usleep(gfx_state_t *state, long usecs) {
+int gfxop_sleep(gfx_state_t *state, uint32 msecs) {
 	BASIC_CHECKS(GFX_FATAL);
 
 	uint32 time;
-	const uint32 wakeup_time = g_system->getMillis() + usecs / 1000;
+	const uint32 wakeup_time = g_system->getMillis() + msecs;
 
 	while (true) {
 		GFXOP_FULL_POINTER_REFRESH;

Modified: scummvm/trunk/engines/sci/gfx/operations.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.h	2009-02-24 20:49:52 UTC (rev 38853)
+++ scummvm/trunk/engines/sci/gfx/operations.h	2009-02-24 20:50:09 UTC (rev 38854)
@@ -371,10 +371,10 @@
 /* Pointer and IO ops */
 /**********************/
 
-int gfxop_usleep(gfx_state_t *state, long usecs);
-/* Suspends program execution for the specified amount of microseconds
+int gfxop_sleep(gfx_state_t *state, uint32 msecs);
+/* Suspends program execution for the specified amount of milliseconds
 ** Parameters: (gfx_state_t *) state: The state affected
-**             (long) usecs: The amount of microseconds to wait
+**             (uint32) usecs: The amount of milliseconds to wait
 ** Returns   : (int) GFX_OK or GFX_ERROR
 ** The mouse pointer will be redrawn continually, if applicable
 */


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