X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=87478255cfe81a26d71ce89f7c9ea41906b22041;hb=e82d8640dfa77aa8fc3cee9d4385dd9419d1bb51;hp=695a536223c87d07372d8d55be2a62f7b8dd888a;hpb=14801844faf14be284c590b66f030c6bf7cea5c2;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 695a5362..87478255 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1265,6 +1265,8 @@ static int dx_last = -1, dy_last = -1; static int dxsize_last = -1, dysize_last = -1; static int vx_last = -1, vy_last = -1; static int vxsize_last = -1, vysize_last = -1; +static int ex_last = -1, ey_last = -1; +static int exsize_last = -1, eysize_last = -1; boolean CheckIfGlobalBorderHasChanged() { @@ -1307,6 +1309,11 @@ boolean CheckIfGlobalBorderRedrawIsNeeded() vxsize_last != VXSIZE || vysize_last != VYSIZE) return TRUE; + // redraw if position or size of editor area has changed + if (ex_last != EX || ey_last != EY || + exsize_last != EXSIZE || eysize_last != EYSIZE) + return TRUE; + return FALSE; } @@ -1327,20 +1334,29 @@ void RedrawGlobalBorder() redraw_mask = REDRAW_ALL; } +#define ONLY_REDRAW_GLOBAL_BORDER_IF_NEEDED 0 + static void RedrawGlobalBorderIfNeeded() { +#if ONLY_REDRAW_GLOBAL_BORDER_IF_NEEDED if (game_status == game_status_last) return; +#endif // copy current draw buffer to later copy back areas that have not changed if (game_status_last != GAME_MODE_TITLE) BlitBitmap(backbuffer, bitmap_db_store_1, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); +#if ONLY_REDRAW_GLOBAL_BORDER_IF_NEEDED if (CheckIfGlobalBorderRedrawIsNeeded()) +#endif { // redraw global screen border (or clear, if defined to be empty) RedrawGlobalBorderFromBitmap(global_border_bitmap); + if (game_status == GAME_MODE_EDITOR) + DrawSpecialEditorDoor(); + // copy previous playfield and door areas, if they are defined on both // previous and current screen and if they still have the same size @@ -1357,11 +1373,22 @@ static void RedrawGlobalBorderIfNeeded() BlitBitmap(bitmap_db_store_1, backbuffer, dx_last, dy_last, DXSIZE, DYSIZE, DX, DY); - if (vx_last != -1 && vy_last != -1 && - VX != -1 && VY != -1 && - vxsize_last == VXSIZE && vysize_last == VYSIZE) - BlitBitmap(bitmap_db_store_1, backbuffer, - vx_last, vy_last, VXSIZE, VYSIZE, VX, VY); + if (game_status != GAME_MODE_EDITOR) + { + if (vx_last != -1 && vy_last != -1 && + VX != -1 && VY != -1 && + vxsize_last == VXSIZE && vysize_last == VYSIZE) + BlitBitmap(bitmap_db_store_1, backbuffer, + vx_last, vy_last, VXSIZE, VYSIZE, VX, VY); + } + else + { + if (ex_last != -1 && ey_last != -1 && + EX != -1 && EY != -1 && + exsize_last == EXSIZE && eysize_last == EYSIZE) + BlitBitmap(bitmap_db_store_1, backbuffer, + ex_last, ey_last, EXSIZE, EYSIZE, EX, EY); + } redraw_mask = REDRAW_ALL; } @@ -1382,6 +1409,10 @@ static void RedrawGlobalBorderIfNeeded() vy_last = VY; vxsize_last = VXSIZE; vysize_last = VYSIZE; + ex_last = EX; + ey_last = EY; + exsize_last = EXSIZE; + eysize_last = EYSIZE; } void ClearField() @@ -4150,6 +4181,8 @@ static int RequestHandleEvents(unsigned int req_state) break; case KSYM_Return: + case KSYM_y: + case KSYM_Y: #if defined(TARGET_SDL2) case KSYM_Select: case KSYM_Menu: @@ -4161,6 +4194,8 @@ static int RequestHandleEvents(unsigned int req_state) break; case KSYM_Escape: + case KSYM_n: + case KSYM_N: #if defined(TARGET_SDL2) case KSYM_Back: #if defined(KSYM_FastForward)