added custom graphics properties to define image and in-game tile size
authorHolger Schemel <info@artsoft.org>
Thu, 4 Sep 2014 22:09:15 +0000 (00:09 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 4 Sep 2014 22:09:15 +0000 (00:09 +0200)
ChangeLog
src/conf_gfx.c
src/conftime.h
src/init.c
src/libgame/image.c
src/libgame/image.h
src/libgame/system.c
src/libgame/system.h
src/main.h
src/tools.c

index b1896e90b1b9c95a69088c3a79287904a3dba7b9..ee3945eb4601b6c682ebe380342e61c118a8072f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-09-04
+       * added custom graphics property "game.tile_size" to define in-game tile
+         size (this defines the tile size actually displayed on the playfield);
+         tile graphics will either be scaled to the defined game tile size or
+         have to be specified with the same image size (using ".tile_size")
+
+2014-09-01
+       * added custom graphics property ".tile_size" to define tile image size
+         for game element graphics (like "custom_1.tile_size"); non-standard
+         sized images will then be scaled accordingly to standard tile size
+
 2014-08-30
        * fixed music still being played in Android version when in background
 
index 9ac6c9089d78181c92a9729e566dd26d203bf1b0..fad76e3f568cbd9fd0b4d37b17bf18864742cb0c 100644 (file)
@@ -59,6 +59,7 @@ struct ConfigTypeInfo image_config_suffix[] =
   { ".post_delay_random",              ARG_UNDEFINED,  TYPE_INTEGER    },
   { ".name",                           ARG_UNDEFINED,  TYPE_STRING     },
   { ".scale_up_factor",                        ARG_UNDEFINED,  TYPE_INTEGER    },
+  { ".tile_size",                      ARG_UNDEFINED,  TYPE_INTEGER    },
   { ".clone_from",                     ARG_UNDEFINED,  TYPE_GRAPHIC    },
   { ".fade_mode",                      ARG_UNDEFINED,  TYPE_INTEGER    },
   { ".fade_delay",                     ARG_UNDEFINED,  TYPE_INTEGER    },
index b9b2330ae647f14be36a9cdd318e7bc5cc829b6f..da246efe463035933f86ee3aadf67641d59b1d0d 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2014-09-02 22:37"
+#define COMPILE_DATE_STRING "2014-09-04 23:52"
index 0dc30c653d58cb24389d2824db335b13d14322aa..dfe8d77f213db5e8559e9d9a2b534696dcc1616a 100644 (file)
@@ -196,7 +196,8 @@ inline void InitElementSmallImagesScaledUp(int graphic)
   printf("::: '%s' -> '%s'\n", fi->token, fi->filename);
 #endif
 
-  CreateImageWithSmallImages(graphic, graphic_info[graphic].scale_up_factor);
+  CreateImageWithSmallImages(graphic, graphic_info[graphic].scale_up_factor,
+                            graphic_info[graphic].tile_size);
 }
 
 void InitElementSmallImages()
@@ -1182,6 +1183,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter,
   g->diggable_like = -1;               /* do not use clone element */
   g->border_size = TILEX / 8;          /* "CRUMBLED" border size */
   g->scale_up_factor = 1;              /* default: no scaling up */
+  g->tile_size = TILESIZE;             /* default: standard tile size */
   g->clone_from = -1;                  /* do not use clone graphic */
   g->anim_delay_fixed = 0;
   g->anim_delay_random = 0;
@@ -1207,6 +1209,14 @@ static void set_graphic_parameters_ext(int graphic, int *parameter,
     g->scale_up_factor = 1;            /* no scaling */
 #endif
 
+#if 1
+  /* optional tile size for using non-standard image size */
+  if (parameter[GFX_ARG_TILE_SIZE] != ARG_UNDEFINED_VALUE)
+    g->tile_size = parameter[GFX_ARG_TILE_SIZE];
+  if (g->tile_size < TILESIZE)
+    g->tile_size = TILESIZE;           /* standard tile size */
+#endif
+
 #if 1
   if (g->use_image_size)
   {
@@ -2402,6 +2412,10 @@ static void ReinitializeGraphics()
 {
   print_timestamp_init("ReinitializeGraphics");
 
+#if NEW_GAME_TILESIZE
+  InitGfxTileSizeInfo(game.tile_size, TILESIZE);
+#endif
+
   InitGraphicInfo();                   /* graphic properties mapping */
   print_timestamp_time("InitGraphicInfo");
   InitElementGraphicInfo();            /* element game graphic mapping */
index 36fd184aea85bf46c777755c73c2132f5e193f6d..7f8302fcc2605101fdaae9f404367b7272dbe26f 100644 (file)
@@ -260,14 +260,14 @@ void ReloadCustomImages()
   print_timestamp_done("ReloadCustomImages");
 }
 
-void CreateImageWithSmallImages(int pos, int zoom_factor)
+void CreateImageWithSmallImages(int pos, int zoom_factor, int tile_size)
 {
   ImageInfo *img_info = getImageInfoEntryFromImageID(pos);
 
   if (img_info == NULL || img_info->contains_small_images)
     return;
 
-  CreateBitmapWithSmallBitmaps(img_info->bitmap, zoom_factor);
+  CreateBitmapWithSmallBitmaps(img_info->bitmap, zoom_factor, tile_size);
 
   img_info->contains_small_images = TRUE;
   img_info->scaled_up = TRUE;
index 0d8dd27a807b7c4fdcdd560de1577afb460783f0..12754ea9f2f9468fe3d5fa4727caa503d2fa4de5 100644 (file)
@@ -31,7 +31,7 @@ void InitImageList(struct ConfigInfo *, int, struct ConfigTypeInfo *,
                   char **, char **, char **, char **, char **);
 
 void ReloadCustomImages();
-void CreateImageWithSmallImages(int, int);
+void CreateImageWithSmallImages(int, int, int);
 void ScaleImage(int, int);
 
 void FreeAllImages();
index f8a606801c1bf6b8a14c28f59e39f65dd69be61b..78a323486fdb8ec8536196d4b83038db39d66adb 100644 (file)
@@ -196,6 +196,12 @@ void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize,
   SetDrawBackgroundMask(REDRAW_NONE);          /* deactivate masked drawing */
 }
 
+void InitGfxTileSizeInfo(int game_tile_size, int standard_tile_size)
+{
+  gfx.game_tile_size = game_tile_size;
+  gfx.standard_tile_size = standard_tile_size;
+}
+
 void InitGfxDoor1Info(int dx, int dy, int dxsize, int dysize)
 {
   gfx.dx = dx;
@@ -1117,42 +1123,107 @@ Bitmap *ZoomBitmap(Bitmap *src_bitmap, int zoom_width, int zoom_height)
 }
 
 static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
-                               boolean create_small_bitmaps)
+                               int tile_size, boolean create_small_bitmaps)
 {
   Bitmap swap_bitmap;
   Bitmap *new_bitmap;
-  Bitmap *tmp_bitmap_1;
-  Bitmap *tmp_bitmap_2;
-  Bitmap *tmp_bitmap_4;
-  Bitmap *tmp_bitmap_8;
-  Bitmap *tmp_bitmap_16;
-  Bitmap *tmp_bitmap_32;
+  Bitmap *tmp_bitmap_final = NULL;
+  Bitmap *tmp_bitmap_0 = NULL;
+  Bitmap *tmp_bitmap_1 = NULL;
+  Bitmap *tmp_bitmap_2 = NULL;
+  Bitmap *tmp_bitmap_4 = NULL;
+  Bitmap *tmp_bitmap_8 = NULL;
+  Bitmap *tmp_bitmap_16 = NULL;
+  Bitmap *tmp_bitmap_32 = NULL;
+  int width_final, height_final;
+  int width_0, height_0;
   int width_1, height_1;
   int width_2, height_2;
   int width_4, height_4;
   int width_8, height_8;
   int width_16, height_16;
-#if 0
+#if 1
   int width_32, height_32;
 #endif
+  int old_width, old_height;
   int new_width, new_height;
 
-  /* calculate new image dimensions for normal sized image */
-  width_1  = old_bitmap->width  * zoom_factor;
-  height_1 = old_bitmap->height * zoom_factor;
+  old_width  = old_bitmap->width;
+  old_height = old_bitmap->height;
+
+#if 1
+  /* calculate new image dimensions for final image size */
+  width_final  = old_width  * zoom_factor;
+  height_final = old_height * zoom_factor;
 
-  /* get image with normal size (this might require scaling up) */
+  /* get image with final size (this might require scaling up) */
+  /* ("final" size may result in non-standard tile size image) */
+  if (zoom_factor != 1)
+    tmp_bitmap_final = ZoomBitmap(old_bitmap, width_final, height_final);
+  else
+    tmp_bitmap_final = old_bitmap;
+
+#else
+
+  /* calculate new image dimensions for final image size */
+  width_1  = old_width  * zoom_factor;
+  height_1 = old_height * zoom_factor;
+
+  /* get image with final size (this might require scaling up) */
+  /* ("final" size may result in non-standard tile size image) */
   if (zoom_factor != 1)
     tmp_bitmap_1 = ZoomBitmap(old_bitmap, width_1, height_1);
   else
     tmp_bitmap_1 = old_bitmap;
+#endif
+
+  UPDATE_BUSY_STATE();
+
+  width_0  = width_1  = width_final;
+  height_0 = height_1 = height_final;
+
+  tmp_bitmap_0 = tmp_bitmap_1 = tmp_bitmap_final;
+
+#if 1
+  if (create_small_bitmaps)
+  {
+    /* check if we have a non-gameplay tile size image */
+    if (tile_size != gfx.game_tile_size)
+    {
+      /* get image with gameplay tile size */
+      width_0  = width_final  * gfx.game_tile_size / tile_size;
+      height_0 = height_final * gfx.game_tile_size / tile_size;
+
+      if (width_0 == old_width)
+       tmp_bitmap_0 = old_bitmap;
+      else if (width_0 == width_final)
+       tmp_bitmap_0 = tmp_bitmap_final;
+      else
+       tmp_bitmap_0 = ZoomBitmap(old_bitmap, width_0, height_0);
+
+      UPDATE_BUSY_STATE();
+    }
 
-  /* this is only needed to make compilers happy */
-  tmp_bitmap_2 = NULL;
-  tmp_bitmap_4 = NULL;
-  tmp_bitmap_8 = NULL;
-  tmp_bitmap_16 = NULL;
-  tmp_bitmap_32 = NULL;
+    /* check if we have a non-standard tile size image */
+    if (tile_size != gfx.standard_tile_size)
+    {
+      /* get image with standard tile size */
+      width_1  = width_final  * gfx.standard_tile_size / tile_size;
+      height_1 = height_final * gfx.standard_tile_size / tile_size;
+
+      if (width_1 == old_width)
+       tmp_bitmap_1 = old_bitmap;
+      else if (width_1 == width_final)
+       tmp_bitmap_1 = tmp_bitmap_final;
+      else if (width_1 == width_0)
+       tmp_bitmap_1 = tmp_bitmap_0;
+      else
+       tmp_bitmap_1 = ZoomBitmap(old_bitmap, width_1, height_1);
+
+      UPDATE_BUSY_STATE();
+    }
+  }
+#endif
 
   if (create_small_bitmaps)
   {
@@ -1165,13 +1236,54 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
     height_8 = height_1 / 8;
     width_16  = width_1  / 16;
     height_16 = height_1 / 16;
-#if 0
+#if 1
     width_32  = width_1  / 32;
     height_32 = height_1 / 32;
 #endif
 
+#if 1
+    /* get image with 1/2 of normal size (for use in the level editor) */
+    if (width_2 == old_width)
+      tmp_bitmap_2 = old_bitmap;
+    else
+      tmp_bitmap_2 = ZoomBitmap(tmp_bitmap_1, width_2, height_2);
+
     UPDATE_BUSY_STATE();
 
+    /* get image with 1/4 of normal size (for use in the level editor) */
+    if (width_4 == old_width)
+      tmp_bitmap_4 = old_bitmap;
+    else
+      tmp_bitmap_4 = ZoomBitmap(tmp_bitmap_2, width_4, height_4);
+
+    UPDATE_BUSY_STATE();
+
+    /* get image with 1/8 of normal size (for use on the preview screen) */
+    if (width_8 == old_width)
+      tmp_bitmap_8 = old_bitmap;
+    else
+      tmp_bitmap_8 = ZoomBitmap(tmp_bitmap_4, width_8, height_8);
+
+    UPDATE_BUSY_STATE();
+
+    /* get image with 1/16 of normal size (for use on the preview screen) */
+    if (width_16 == old_width)
+      tmp_bitmap_16 = old_bitmap;
+    else
+      tmp_bitmap_16 = ZoomBitmap(tmp_bitmap_8, width_16, height_16);
+
+    UPDATE_BUSY_STATE();
+
+    /* get image with 1/32 of normal size (for use on the preview screen) */
+    if (width_32 == old_width)
+      tmp_bitmap_32 = old_bitmap;
+    else
+      tmp_bitmap_32 = ZoomBitmap(tmp_bitmap_16, width_32, height_32);
+
+    UPDATE_BUSY_STATE();
+
+#else
+
     /* get image with 1/2 of normal size (for use in the level editor) */
     if (zoom_factor != 2)
       tmp_bitmap_2 = ZoomBitmap(tmp_bitmap_1, width_1 / 2, height_1 / 2);
@@ -1211,6 +1323,7 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
       tmp_bitmap_32 = old_bitmap;
 
     UPDATE_BUSY_STATE();
+#endif
   }
 
 #if 0
@@ -1235,8 +1348,21 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
     new_width  = width_1;
     new_height = height_1 + (height_1 + 1) / 2;     /* prevent odd height */
 
+#if 1
+    if (width_0 != width_1)
+    {
+      new_width += width_0;
+      new_height = MAX(new_height, height_0);
+    }
+#endif
+
     new_bitmap = CreateBitmap(new_width, new_height, DEFAULT_DEPTH);
 
+#if 1
+    if (width_0 != width_1)
+      BlitBitmap(tmp_bitmap_0, new_bitmap, 0, 0, width_0, height_0, width_1, 0);
+#endif
+
     BlitBitmap(tmp_bitmap_1, new_bitmap, 0, 0, width_1, height_1, 0, 0);
     BlitBitmap(tmp_bitmap_2, new_bitmap, 0, 0, width_1 / 2, height_1 / 2,
               0, height_1);
@@ -1262,6 +1388,37 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
   if (create_small_bitmaps)
   {
     /* if no small bitmaps created, tmp_bitmap_1 is used as new bitmap now */
+
+#if 1
+    if (tmp_bitmap_final != old_bitmap)
+      FreeBitmap(tmp_bitmap_final);
+
+    if (tmp_bitmap_0 != old_bitmap &&
+       tmp_bitmap_0 != tmp_bitmap_final)
+      FreeBitmap(tmp_bitmap_0);
+
+    if (tmp_bitmap_1 != old_bitmap &&
+       tmp_bitmap_1 != tmp_bitmap_final &&
+       tmp_bitmap_1 != tmp_bitmap_0)
+      FreeBitmap(tmp_bitmap_1);
+
+    if (tmp_bitmap_2 != old_bitmap)
+      FreeBitmap(tmp_bitmap_2);
+
+    if (tmp_bitmap_4 != old_bitmap)
+      FreeBitmap(tmp_bitmap_4);
+
+    if (tmp_bitmap_8 != old_bitmap)
+      FreeBitmap(tmp_bitmap_8);
+
+    if (tmp_bitmap_16 != old_bitmap)
+      FreeBitmap(tmp_bitmap_16);
+
+    if (tmp_bitmap_32 != old_bitmap)
+      FreeBitmap(tmp_bitmap_32);
+
+#else
+
     if (zoom_factor != 1)
       FreeBitmap(tmp_bitmap_1);
 
@@ -1279,6 +1436,7 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
 
     if (zoom_factor != 32)
       FreeBitmap(tmp_bitmap_32);
+#endif
   }
 
   /* replace image with extended image (containing 1/1, 1/2, 1/4, 1/8 size) */
@@ -1305,8 +1463,10 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
 
     SDL_SetColorKey(old_surface, SET_TRANSPARENT_PIXEL,
                    SDL_MapRGB(old_surface->format, 0x00, 0x00, 0x00));
-    if ((old_bitmap->surface_masked = SDL_DisplayFormat(old_surface)) ==NULL)
+
+    if ((old_bitmap->surface_masked = SDL_DisplayFormat(old_surface)) == NULL)
       Error(ERR_EXIT, "SDL_DisplayFormat() failed");
+
     SDL_SetColorKey(old_surface, UNSET_TRANSPARENT_PIXEL, 0);
   }
 #endif
@@ -1316,14 +1476,15 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor,
   FreeBitmap(new_bitmap);      /* this actually frees the _old_ bitmap now */
 }
 
-void CreateBitmapWithSmallBitmaps(Bitmap *old_bitmap, int zoom_factor)
+void CreateBitmapWithSmallBitmaps(Bitmap *old_bitmap, int zoom_factor,
+                                 int tile_size)
 {
-  CreateScaledBitmaps(old_bitmap, zoom_factor, TRUE);
+  CreateScaledBitmaps(old_bitmap, zoom_factor, tile_size, TRUE);
 }
 
 void ScaleBitmap(Bitmap *old_bitmap, int zoom_factor)
 {
-  CreateScaledBitmaps(old_bitmap, zoom_factor, FALSE);
+  CreateScaledBitmaps(old_bitmap, zoom_factor, 0, FALSE);
 }
 
 
index e9b4cb510802a73c9dfbce395eae22919321b50b..162e153653a74d67cc1a458f387d75b5309e2fcd 100644 (file)
@@ -775,6 +775,8 @@ struct GfxInfo
   int full_sxsize, full_sysize;
   int scrollbuffer_width, scrollbuffer_height;
 
+  int game_tile_size, standard_tile_size;
+
   int dx, dy;
   int dxsize, dysize;
 
@@ -1276,6 +1278,7 @@ void InitPlatformDependentStuff(void);
 void ClosePlatformDependentStuff(void);
 
 void InitGfxFieldInfo(int, int, int, int, int, int, int, int, Bitmap *);
+void InitGfxTileSizeInfo(int, int);
 void InitGfxDoor1Info(int, int, int, int);
 void InitGfxDoor2Info(int, int, int, int);
 void InitGfxDoor3Info(int, int, int, int);
@@ -1331,7 +1334,7 @@ Bitmap *LoadCustomImage(char *);
 void ReloadCustomImage(Bitmap *, char *);
 
 Bitmap *ZoomBitmap(Bitmap *, int, int);
-void CreateBitmapWithSmallBitmaps(Bitmap *, int);
+void CreateBitmapWithSmallBitmaps(Bitmap *, int, int);
 void ScaleBitmap(Bitmap *, int);
 
 void SetMouseCursor(int);
index 0bd31a501b444b74bc47fa1708683591d5660fc7..1357db711ec600a931715f596bb09f0635a8f464 100644 (file)
@@ -31,6 +31,7 @@
 #include "conf_mus.h"  /* include auto-generated data structure definitions */
 
 
+#define NEW_GAME_TILESIZE              1
 #define NEW_TILESIZE                   1
 #define NEW_SCROLL                     1
 
 #define GFX_ARG_POST_DELAY_RANDOM      35
 #define GFX_ARG_NAME                   36
 #define GFX_ARG_SCALE_UP_FACTOR                37
-#define GFX_ARG_CLONE_FROM             38
-#define GFX_ARG_FADE_MODE              39
-#define GFX_ARG_FADE_DELAY             40
-#define GFX_ARG_POST_DELAY             41
-#define GFX_ARG_AUTO_DELAY             42
-#define GFX_ARG_ALIGN                  43
-#define GFX_ARG_VALIGN                 44
-#define GFX_ARG_SORT_PRIORITY          45
-#define GFX_ARG_CLASS                  46
-#define GFX_ARG_STYLE                  47
-#define GFX_ARG_ACTIVE_XOFFSET         48
-#define GFX_ARG_ACTIVE_YOFFSET         49
-#define GFX_ARG_PRESSED_XOFFSET                50
-#define GFX_ARG_PRESSED_YOFFSET                51
-
-#define NUM_GFX_ARGS                   52
+#define GFX_ARG_TILE_SIZE              38
+#define GFX_ARG_CLONE_FROM             39
+#define GFX_ARG_FADE_MODE              40
+#define GFX_ARG_FADE_DELAY             41
+#define GFX_ARG_POST_DELAY             42
+#define GFX_ARG_AUTO_DELAY             43
+#define GFX_ARG_ALIGN                  44
+#define GFX_ARG_VALIGN                 45
+#define GFX_ARG_SORT_PRIORITY          46
+#define GFX_ARG_CLASS                  47
+#define GFX_ARG_STYLE                  48
+#define GFX_ARG_ACTIVE_XOFFSET         49
+#define GFX_ARG_ACTIVE_YOFFSET         50
+#define GFX_ARG_PRESSED_XOFFSET                51
+#define GFX_ARG_PRESSED_YOFFSET                52
+
+#define NUM_GFX_ARGS                   53
 
 
 /* values for sound configuration suffixes */
@@ -2792,6 +2794,7 @@ struct GraphicInfo
   int border_size;             /* border size for "crumbled" graphics */
 
   int scale_up_factor;         /* optional factor for scaling image up */
+  int tile_size;               /* optional explicitly defined tile size */
 
   int clone_from;              /* graphic for cloning *all* settings */
 
index c812e3021588e52138ca93ff71b29d56dfc07fb8..968ddc7a226868097e523f327a5ba737d5d18e0b 100644 (file)
@@ -1520,12 +1520,28 @@ void getSizedGraphicSourceExt(int graphic, int frame, int tilesize_raw,
   Bitmap *src_bitmap = g->bitmap;
   int tilesize = MIN(MAX(1, tilesize_raw), TILESIZE);
   int offset_calc_pos = log_2(tilesize);
+  int bitmap_width  = src_bitmap->width;
+  int bitmap_height = src_bitmap->height;
   int width_mult  = offset_calc[offset_calc_pos].width_mult;
   int width_div   = offset_calc[offset_calc_pos].width_div;
   int height_mult = offset_calc[offset_calc_pos].height_mult;
   int height_div  = offset_calc[offset_calc_pos].height_div;
-  int startx = src_bitmap->width * width_mult / width_div;
-  int starty = src_bitmap->height * height_mult / height_div;
+  int startx = bitmap_width * width_mult / width_div;
+  int starty = bitmap_height * height_mult / height_div;
+
+#if NEW_GAME_TILESIZE
+
+  int src_x = (g->src_x + (get_backside ? g->offset2_x : 0)) *
+    tilesize_raw / TILESIZE;
+  int src_y = (g->src_y + (get_backside ? g->offset2_y : 0)) *
+    tilesize_raw / TILESIZE;
+  int width = g->width * tilesize_raw / TILESIZE;
+  int height = g->height * tilesize_raw / TILESIZE;
+  int offset_x = g->offset_x * tilesize_raw / TILESIZE;
+  int offset_y = g->offset_y * tilesize_raw / TILESIZE;
+
+#else
+
 #if NEW_TILESIZE
   int src_x = (g->src_x + (get_backside ? g->offset2_x : 0)) *
     tilesize / TILESIZE;
@@ -1540,6 +1556,34 @@ void getSizedGraphicSourceExt(int graphic, int frame, int tilesize_raw,
   int offset_x = g->offset_x * tilesize / TILESIZE;
   int offset_y = g->offset_y * tilesize / TILESIZE;
 
+#endif
+
+#if NEW_GAME_TILESIZE
+  if (game.tile_size != TILESIZE)
+  {
+    int bitmap_width_std =
+      bitmap_width * TILESIZE / (TILESIZE + game.tile_size);
+    int bitmap_height_std =
+      bitmap_height * TILESIZE / game.tile_size * 3 / 2;
+
+    if (tilesize_raw == game.tile_size)
+    {
+      startx = bitmap_width_std;
+      starty = 0;
+    }
+    else
+    {
+      bitmap_width = bitmap_width_std;
+
+      if (game.tile_size > TILESIZE * 3 / 2)
+       bitmap_height = bitmap_height_std;
+
+      startx = bitmap_width * width_mult / width_div;
+      starty = bitmap_height * height_mult / height_div;
+    }
+  }
+#endif
+
   if (g->offset_y == 0)                /* frames are ordered horizontally */
   {
     int max_width = g->anim_frames_per_line * width;
@@ -1609,7 +1653,6 @@ inline void getGraphicSourceExt(int graphic, int frame, Bitmap **bitmap,
   int src_y = g->src_y + (get_backside ? g->offset2_y : 0);
 
 #if NEW_TILESIZE
-
   if (TILESIZE_VAR != TILESIZE)
     return getSizedGraphicSourceExt(graphic, frame, TILESIZE_VAR, bitmap, x, y,
                                    get_backside);
@@ -11510,7 +11553,14 @@ void ChangeViewportPropertiesIfNeeded()
   int new_exsize       = vp_door_3->width;
   int new_eysize       = vp_door_3->height;
 #if NEW_TILESIZE
+
+#if NEW_GAME_TILESIZE
+  int new_tilesize_var =
+    (setup.small_game_graphics ? MINI_TILESIZE : game.tile_size);
+#else
   int new_tilesize_var = TILESIZE / (setup.small_game_graphics ? 2 : 1);
+#endif
+
   int tilesize = (gfx_game_mode == GAME_MODE_PLAYING ? new_tilesize_var :
                  gfx_game_mode == GAME_MODE_EDITOR ? MINI_TILESIZE : TILESIZE);
   int new_scr_fieldx = new_sxsize / tilesize;