X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=e2352d185703d22585a66931c5e3a5ab07b199ac;hb=78731da5bda94be8ad5633fc5ef615c35db318a7;hp=0e030f7bb9da94839d8983af84c264c11f42054e;hpb=88199e14f3fde57971167f35ec0cd13113e7d01c;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 0e030f7b..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; @@ -649,7 +652,7 @@ void FadeSetEnterScreen() void FadeSetNextScreen() { - fading = menu.next_screen; + fading = menu.next_screen[game_status]; // (do not overwrite fade mode set by FadeSetEnterScreen) // FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */ @@ -875,7 +878,8 @@ static void RedrawGlobalBorderIfNeeded() return; // copy current draw buffer to later copy back areas that have not changed - BlitBitmap(backbuffer, bitmap_db_store, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + if (game_status_last != GAME_MODE_TITLE) + BlitBitmap(backbuffer, bitmap_db_store, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); if (CheckIfGlobalBorderRedrawIsNeeded()) { @@ -1064,8 +1068,8 @@ void getSizedGraphicSourceExt(int graphic, int frame, int tilesize, } *bitmap = src_bitmap; - *x = src_x * tilesize / TILESIZE; - *y = src_y * tilesize / TILESIZE; + *x = src_x * tilesize / g->tile_size; + *y = src_y * tilesize / g->tile_size; } void getFixedGraphicSourceExt(int graphic, int frame, Bitmap **bitmap, @@ -1126,6 +1130,9 @@ inline static void getGraphicSourceExt(int graphic, int frame, Bitmap **bitmap, *x = src_x + frame * g->offset_x; *y = src_y + frame * g->offset_y; } + + *x = *x * TILESIZE_VAR / g->tile_size; + *y = *y * TILESIZE_VAR / g->tile_size; } void getGraphicSource(int graphic, int frame, Bitmap **bitmap, int *x, int *y) @@ -1235,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); } @@ -2388,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++) { @@ -3400,8 +3399,7 @@ void WaitForEventToContinue() DoAnimation(); - /* don't eat all CPU time */ - Delay(10); + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } } @@ -3572,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;