X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftools.c;h=7a15c03e81b4973bbf5d29a533252ade5b43d30d;hp=1dc080b22906ea71c5afa4815509c72c52eae037;hb=eb72f4adc74084da40e39484b2545e3d49d39eaa;hpb=0aa29de86fecb91c38b9a1a54e0ce7015aed39b4 diff --git a/src/tools.c b/src/tools.c index 1dc080b2..7a15c03e 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()) { @@ -1060,8 +1065,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, @@ -1122,6 +1127,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) @@ -1298,20 +1306,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 +1333,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; @@ -2283,7 +2291,7 @@ void DrawEnvelopeRequest(char *text) int text_width = line_length * font_width; int width = request.width; int height = request.height; - int tile_size = request.step_offset; + int tile_size = MAX(request.step_offset, 1); int x_steps = width / tile_size; int y_steps = height / tile_size; int sx_offset = border_size; @@ -2294,7 +2302,7 @@ void DrawEnvelopeRequest(char *text) if (request.centered) sx_offset = (request.width - text_width) / 2; - if (request.wrap_single_words) + if (request.wrap_single_words && !request.autowrap) { char *src_text_ptr, *dst_text_ptr; @@ -2362,7 +2370,7 @@ void AnimateEnvelopeRequest(int anim_mode, int action) int anim_delay_value = (no_delay ? 0 : delay_value + 500 * 0) / 2; unsigned int anim_delay = 0; - int tile_size = request.step_offset; + int tile_size = MAX(request.step_offset, 1); int max_xsize = request.width / tile_size; int max_ysize = request.height / tile_size; int max_xsize_inner = max_xsize - 2; @@ -8138,10 +8146,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 +8188,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;