- 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 = bitmap_width * width_mult / width_div;
- int starty = bitmap_height * height_mult / height_div;
- 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;
-
- 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;
+ int src_x = g->src_x + (get_backside ? g->offset2_x : 0);
+ int src_y = g->src_y + (get_backside ? g->offset2_y : 0);
+ int tilesize_capped = MIN(MAX(1, tilesize), TILESIZE);