fixed bugs when using element graphics with non-standard tile size
[rocksndiamonds.git] / src / tools.c
index 5c1f6549daee1d533f5e27333abf84f8d79e97cb..7a15c03e81b4973bbf5d29a533252ade5b43d30d 100644 (file)
@@ -1065,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,
@@ -1127,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)