diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kevent.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 50 | ||||
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_test.cpp | 16 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gfx/operations.h | 6 |
7 files changed, 44 insertions, 46 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 083ecb18d6..451d49c413 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -45,7 +45,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { // 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 diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index ef47e04ada..75b989e0c4 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -659,7 +659,7 @@ reg_t kWait(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * } 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * } 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t * 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 @@ reg_t kShakeScreen(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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); diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index be5b8b9c22..300a762e76 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -276,7 +276,7 @@ about_freesci(EngineState *s) { if (event.type == SCI_EVT_KEYBOARD) cont = 0; - gfxop_usleep(s->gfx_state, 25000); + gfxop_sleep(s->gfx_state, 25); } @@ -458,7 +458,7 @@ kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) { break; case SCI_EVT_NONE: - gfxop_usleep(s->gfx_state, 2500); + gfxop_sleep(s->gfx_state, 2500 / 1000); break; } diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 26c8131a9f..1f3ddfa235 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -1607,7 +1607,7 @@ static int c_redraw_screen(EngineState *s) { 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 @@ static int c_gfx_drawpic(EngineState *s) { 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 @@ static int c_gfx_propagate_rect(EngineState *s) { 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; } diff --git a/engines/sci/gfx/gfx_test.cpp b/engines/sci/gfx/gfx_test.cpp index 2987aab47e..bca8d56748 100644 --- a/engines/sci/gfx/gfx_test.cpp +++ b/engines/sci/gfx/gfx_test.cpp @@ -580,7 +580,7 @@ waitkey(void) { if (event.type) return 0; - gfxop_usleep(state, 1000); + gfxop_sleep(state, 1); } return 1; } @@ -597,7 +597,7 @@ wait_specific_key(int key) { && event.data == key) return 0; - gfxop_usleep(state, 1000); + gfxop_sleep(state, 1); } return 1; } @@ -800,7 +800,7 @@ test_c(void) { 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 @@ test_c(void) { 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 @@ test_d(void) { gfxop_update_box(state, line); } - gfxop_usleep(state, 1000); + gfxop_sleep(state, 1); } event.type = 0; @@ -929,7 +929,7 @@ test_e(void) { 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 @@ test_e(void) { 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 @@ test_e(void) { 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(); } diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index bcdc12223e..f29aeb395c 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -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 @@ static int _gfxop_full_pointer_refresh(gfx_state_t *state) { 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; diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h index d3cdedceac..5eee47e79c 100644 --- a/engines/sci/gfx/operations.h +++ b/engines/sci/gfx/operations.h @@ -371,10 +371,10 @@ int gfxop_free_color(gfx_state_t *state, gfx_color_t *color); /* 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 */ |