X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=3af2b5f9220a853757939b8c7664fea97427eeb8;hb=01342840f91b6a1a215d4f7ed90cddbe7da18099;hp=a04238724c35f92b03cd788de7ec1efdb411a070;hpb=dbe473b63ac67dabfb47c82e104f2b8f33ca2d51;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index a0423872..3af2b5f9 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1052,6 +1052,10 @@ void getSizedGraphicSourceExt(int graphic, int frame, int tilesize, int src_y = g->src_y + (get_backside ? g->offset2_y : 0); int tilesize_capped = MIN(MAX(1, tilesize), TILESIZE); + // if no in-game graphics defined, always use standard graphic size + if (g->bitmaps[IMG_BITMAP_GAME] == NULL) + tilesize = TILESIZE; + if (tilesize == gfx.standard_tile_size) src_bitmap = g->bitmaps[IMG_BITMAP_STANDARD]; else if (tilesize == game.tile_size) @@ -2024,6 +2028,14 @@ void DrawLevelField(int x, int y) } } +void DrawSizedElement(int x, int y, int element, int tilesize) +{ + int graphic; + + graphic = el2edimg(element); + DrawSizedGraphic(x, y, graphic, 0, tilesize); +} + void DrawMiniElement(int x, int y, int element) { int graphic; @@ -2032,6 +2044,19 @@ void DrawMiniElement(int x, int y, int element) DrawMiniGraphic(x, y, graphic); } +void DrawSizedElementOrWall(int sx, int sy, int scroll_x, int scroll_y, + int tilesize) +{ + int x = sx + scroll_x, y = sy + scroll_y; + + if (x < -1 || x > lev_fieldx || y < -1 || y > lev_fieldy) + DrawSizedElement(sx, sy, EL_EMPTY, tilesize); + else if (x > -1 && x < lev_fieldx && y > -1 && y < lev_fieldy) + DrawSizedElement(sx, sy, Feld[x][y], tilesize); + else + DrawSizedGraphic(sx, sy, el2edimg(getBorderElement(x, y)), 0, tilesize); +} + void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) { int x = sx + scroll_x, y = sy + scroll_y; @@ -2497,6 +2522,18 @@ void DrawLevel(int draw_background_mask) redraw_mask |= REDRAW_FIELD; } +void DrawSizedLevel(int size_x, int size_y, int scroll_x, int scroll_y, + int tilesize) +{ + int x,y; + + for (x = 0; x < size_x; x++) + for (y = 0; y < size_y; y++) + DrawSizedElementOrWall(x, y, scroll_x, scroll_y, tilesize); + + redraw_mask |= REDRAW_FIELD; +} + void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) { int x,y; @@ -3932,11 +3969,13 @@ void InitGraphicCompatibilityInfo_Doors() { num_panel_steps = 2 * door_rect->height / door->step_offset; door->panel.start_step = num_panel_steps - num_door_steps; + door->panel.start_step_closing = door->panel.start_step; } else { num_panel_steps = door_rect->height / door->step_offset; door->panel.start_step = num_panel_steps - num_door_steps / 2; + door->panel.start_step_closing = door->panel.start_step; door->panel.step_delay *= 2; } } @@ -4037,15 +4076,6 @@ unsigned int MoveDoor(unsigned int door_state) unsigned int door_delay_value; int i; - if (door_1.width < 0 || door_1.width > DXSIZE) - door_1.width = DXSIZE; - if (door_1.height < 0 || door_1.height > DYSIZE) - door_1.height = DYSIZE; - if (door_2.width < 0 || door_2.width > VXSIZE) - door_2.width = VXSIZE; - if (door_2.height < 0 || door_2.height > VYSIZE) - door_2.height = VYSIZE; - if (door_state == DOOR_GET_STATE) return (door1 | door2); @@ -4361,8 +4391,6 @@ void DrawSpecialEditorDoor() int vy = VY - outer_border; int exsize = EXSIZE + 2 * outer_border; - CloseDoor(DOOR_CLOSE_2); - /* draw bigger level editor toolbox window */ BlitBitmap(gfx1->bitmap, drawto, gfx1->src_x, gfx1->src_y, top_border_width, top_border_height, ex, ey - top_border_height); @@ -7996,6 +8024,7 @@ void ChangeViewportPropertiesIfNeeded() boolean init_video_buffer = FALSE; boolean init_gadgets_and_toons = FALSE; boolean init_em_graphics = FALSE; + boolean drawing_area_changed = FALSE; if (viewport.window.width != WIN_XSIZE || viewport.window.height != WIN_YSIZE) @@ -8054,6 +8083,19 @@ void ChangeViewportPropertiesIfNeeded() init_em_graphics = TRUE; } + if (new_sx != SX || + new_sy != SY || + new_sxsize != SXSIZE || + new_sysize != SYSIZE || + new_real_sx != REAL_SX || + new_real_sy != REAL_SY || + new_full_sxsize != FULL_SXSIZE || + new_full_sysize != FULL_SYSIZE) + { + if (!init_video_buffer) + drawing_area_changed = TRUE; + } + SX = new_sx; SY = new_sy; DX = new_dx; @@ -8094,6 +8136,11 @@ void ChangeViewportPropertiesIfNeeded() SCR_FIELDX = new_scr_fieldx; SCR_FIELDY = new_scr_fieldy; + + gfx.drawing_area_changed = drawing_area_changed; + + SetDrawDeactivationMask(REDRAW_NONE); + SetDrawBackgroundMask(REDRAW_FIELD); } if (init_video_buffer) @@ -8101,9 +8148,6 @@ void ChangeViewportPropertiesIfNeeded() // printf("::: init_video_buffer\n"); InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); - - SetDrawDeactivationMask(REDRAW_NONE); - SetDrawBackgroundMask(REDRAW_FIELD); } if (init_gadgets_and_toons)