X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=e2352d185703d22585a66931c5e3a5ab07b199ac;hb=adab6bbf3e2b3b78b7b51f18379e6db399b62b5c;hp=7a15c03e81b4973bbf5d29a533252ade5b43d30d;hpb=45bfdb3c0aed7513d056425e6f0abcdc0dc21867;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 7a15c03e..e2352d18 100644 --- a/src/tools.c +++ b/src/tools.c @@ -173,6 +173,9 @@ static int el_act2crm(int, int); static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS]; static int request_gadget_id = -1; +static unsigned int sync_frame_delay = 0; +static unsigned int sync_frame_delay_value = GAME_FRAME_DELAY; + static char *print_if_not_empty(int element) { static char *s = NULL; @@ -1239,13 +1242,12 @@ void DrawGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y, int graphic, void DrawFixedGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y, int graphic, int frame) { - struct GraphicInfo *g = &graphic_info[graphic]; Bitmap *src_bitmap; int src_x, src_y; getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y); - BlitBitmapMasked(src_bitmap, d, src_x, src_y, g->width, g->height, + BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dst_x, dst_y); } @@ -2392,13 +2394,6 @@ void AnimateEnvelopeRequest(int anim_mode, int action) ystart = yend; end = 0; } - else - { - if (action == ACTION_OPENING) - PlayMenuSoundStereo(SND_DOOR_OPENING, SOUND_MIDDLE); - else if (action == ACTION_CLOSING) - PlayMenuSoundStereo(SND_DOOR_CLOSING, SOUND_MIDDLE); - } for (i = start; i <= end; i++) { @@ -3404,8 +3399,7 @@ void WaitForEventToContinue() DoAnimation(); - /* don't eat all CPU time */ - Delay(10); + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } } @@ -3576,12 +3570,11 @@ static int RequestHandleEvents(unsigned int req_state) else { DoAnimation(); - - if (!PendingEvent()) /* delay only if no pending events */ - Delay(10); } BackToFront(); + + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } return result;