X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftools.c;h=5c1f6549daee1d533f5e27333abf84f8d79e97cb;hp=9b903d35b337b8e02959b367424a48a4e0c2951b;hb=064971ae82e2e3f98dc55e75b15c192c9165fb4e;hpb=e3c693baf2ea4f86e6874f00254e60f72d4afd10 diff --git a/src/tools.c b/src/tools.c index 9b903d35..5c1f6549 100644 --- a/src/tools.c +++ b/src/tools.c @@ -227,7 +227,7 @@ void DumpTile(int x, int y) printf(" CustomValue: %d\n", CustomValue[x][y]); printf(" GfxElement: %d\n", GfxElement[x][y]); printf(" GfxAction: %d\n", GfxAction[x][y]); - printf(" GfxFrame: %d\n", GfxFrame[x][y]); + printf(" GfxFrame: %d [%d]\n", GfxFrame[x][y], FrameCounter); printf("\n"); } @@ -330,8 +330,8 @@ void DrawMaskedBorder_ALL() void DrawMaskedBorder(int redraw_mask) { /* never draw masked screen borders on borderless screens */ - if (effectiveGameStatus() == GAME_MODE_LOADING || - effectiveGameStatus() == GAME_MODE_TITLE) + if (game_status == GAME_MODE_LOADING || + game_status == GAME_MODE_TITLE) return; if (redraw_mask & REDRAW_ALL) @@ -649,7 +649,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) */ @@ -826,6 +826,10 @@ boolean CheckIfGlobalBorderRedrawIsNeeded() if (game_status == game_status_last) return FALSE; + // redraw if last screen was title screen + if (game_status_last == GAME_MODE_TITLE) + return TRUE; + // redraw if global screen border has changed if (CheckIfGlobalBorderHasChanged()) return TRUE; @@ -871,7 +875,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()) { @@ -1298,20 +1303,20 @@ inline static void DrawGraphicShiftedNormal(int x, int y, int dx, int dy, width = -dx; dx = TILEX + dx; } - else if (x==BX1 && dx < 0) /* object leaves playfield to the left */ + else if (x == BX1 && dx < 0) /* object leaves playfield to the left */ { width += dx; cx = -dx; dx = 0; } - else if (x==BX2 && dx > 0) /* object leaves playfield to the right */ + else if (x == BX2 && dx > 0) /* object leaves playfield to the right */ width -= dx; else if (dx) /* general horizontal movement */ MarkTileDirty(x + SIGN(dx), y); if (y < BY1) /* object enters playfield from the top */ { - if (cut_mode==CUT_BELOW) /* object completely above top border */ + if (cut_mode == CUT_BELOW) /* object completely above top border */ return; y = BY1; @@ -1325,7 +1330,7 @@ inline static void DrawGraphicShiftedNormal(int x, int y, int dx, int dy, height = -dy; dy = TILEY + dy; } - else if (y==BY1 && dy < 0) /* object leaves playfield to the top */ + else if (y == BY1 && dy < 0) /* object leaves playfield to the top */ { height += dy; cy = -dy; @@ -8138,10 +8143,13 @@ void ChangeViewportPropertiesIfNeeded() int gfx_game_mode = game_status; int gfx_game_mode2 = (game_status == GAME_MODE_EDITOR ? GAME_MODE_DEFAULT : game_status); + struct RectWithBorder *vp_window = &viewport.window[gfx_game_mode]; struct RectWithBorder *vp_playfield = &viewport.playfield[gfx_game_mode]; - struct RectWithBorder *vp_door_1 = &viewport.door_1[gfx_game_mode]; - struct RectWithBorder *vp_door_2 = &viewport.door_2[gfx_game_mode2]; - struct RectWithBorder *vp_door_3 = &viewport.door_2[GAME_MODE_EDITOR]; + struct RectWithBorder *vp_door_1 = &viewport.door_1[gfx_game_mode]; + struct RectWithBorder *vp_door_2 = &viewport.door_2[gfx_game_mode2]; + struct RectWithBorder *vp_door_3 = &viewport.door_2[GAME_MODE_EDITOR]; + int new_win_xsize = vp_window->width; + int new_win_ysize = vp_window->height; int border_size = vp_playfield->border_size; int new_sx = vp_playfield->x + border_size; int new_sy = vp_playfield->y + border_size; @@ -8177,11 +8185,11 @@ void ChangeViewportPropertiesIfNeeded() boolean init_gadgets_and_toons = FALSE; boolean init_em_graphics = FALSE; - if (viewport.window.width != WIN_XSIZE || - viewport.window.height != WIN_YSIZE) + if (new_win_xsize != WIN_XSIZE || + new_win_ysize != WIN_YSIZE) { - WIN_XSIZE = viewport.window.width; - WIN_YSIZE = viewport.window.height; + WIN_XSIZE = new_win_xsize; + WIN_YSIZE = new_win_ysize; init_video_buffer = TRUE; init_gfx_buffers = TRUE;