mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
More tweaks from the Rubocop overlord
This commit is contained in:
@@ -372,7 +372,7 @@ class TilemapRenderer
|
||||
if tile_id < true_tileset_start_id
|
||||
filename = ""
|
||||
if tile_id < TILESET_START_ID # Real autotiles
|
||||
filename = map.autotile_names[tile_id / TILES_PER_AUTOTILE - 1]
|
||||
filename = map.autotile_names[(tile_id / TILES_PER_AUTOTILE) - 1]
|
||||
elsif tile_id < single_autotile_start_id # Large extra autotiles
|
||||
filename = extra_autotile_arrays[0][(tile_id - TILESET_START_ID) / TILES_PER_AUTOTILE]
|
||||
else # Single extra autotiles
|
||||
@@ -406,8 +406,8 @@ class TilemapRenderer
|
||||
|
||||
# x and y are the positions of tile within @tiles, not a map x/y
|
||||
def refresh_tile_coordinates(tile, x, y)
|
||||
tile.x = x * DISPLAY_TILE_WIDTH - @pixel_offset_x
|
||||
tile.y = y * DISPLAY_TILE_HEIGHT - @pixel_offset_y
|
||||
tile.x = (x * DISPLAY_TILE_WIDTH) - @pixel_offset_x
|
||||
tile.y = (y * DISPLAY_TILE_HEIGHT) - @pixel_offset_y
|
||||
end
|
||||
|
||||
def refresh_tile_z(tile, map, y, layer, tile_id)
|
||||
@@ -417,7 +417,7 @@ class TilemapRenderer
|
||||
tile.z = 0
|
||||
else
|
||||
priority = tile.priority
|
||||
tile.z = (priority == 0) ? 0 : y * DISPLAY_TILE_HEIGHT + priority * 32 + 32
|
||||
tile.z = (priority == 0) ? 0 : (y * DISPLAY_TILE_HEIGHT) + (priority * 32) + 32
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class TilemapRenderer
|
||||
TILESET_WIDTH = SOURCE_TILE_WIDTH * TILESET_TILES_PER_ROW
|
||||
# Looks useless, but covers weird numbers given to mkxp.json or a funky driver
|
||||
MAX_TEX_SIZE = (Bitmap.max_size / 1024) * 1024
|
||||
MAX_TEX_SIZE_BOOSTED = MAX_TEX_SIZE**2 / TILESET_WIDTH
|
||||
MAX_TEX_SIZE_BOOSTED = (MAX_TEX_SIZE**2) / TILESET_WIDTH
|
||||
|
||||
module_function
|
||||
|
||||
@@ -49,7 +49,7 @@ class TilemapRenderer
|
||||
def getWrappedRect(src_rect)
|
||||
ret = Rect.new(0, 0, 0, 0)
|
||||
col = (src_rect.y / MAX_TEX_SIZE.to_f).floor
|
||||
ret.x = col * TILESET_WIDTH + src_rect.x.clamp(0, TILESET_WIDTH)
|
||||
ret.x = (col * TILESET_WIDTH) + src_rect.x.clamp(0, TILESET_WIDTH)
|
||||
ret.y = src_rect.y % MAX_TEX_SIZE
|
||||
ret.width = src_rect.width.clamp(0, TILESET_WIDTH - src_rect.x)
|
||||
ret.height = src_rect.height.clamp(0, MAX_TEX_SIZE)
|
||||
@@ -70,8 +70,8 @@ class TilemapRenderer
|
||||
# FIXME: won't work on heights longer than two columns, but nobody should need
|
||||
# more than 32k pixels high at once anyway
|
||||
side = {
|
||||
:a => MAX_TEX_SIZE - srcrect_mod.y,
|
||||
:b => srcrect_mod.height - MAX_TEX_SIZE + srcrect_mod.y
|
||||
:a => MAX_TEX_SIZE - srcrect_mod.y,
|
||||
:b => srcrect_mod.height - MAX_TEX_SIZE + srcrect_mod.y
|
||||
}
|
||||
dest.blt(destX, destY, src, Rect.new(srcrect_mod.x, srcrect_mod.y, srcrect_mod.width, side[:a]))
|
||||
dest.blt(destX, destY + side[:a], src, Rect.new(srcrect_mod.x + TILESET_WIDTH, 0, srcrect_mod.width, side[:b]))
|
||||
|
||||
@@ -36,11 +36,11 @@ class TilemapRenderer
|
||||
SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT))
|
||||
when 2 # Top right corner
|
||||
new_bitmap.blt(dest_x, dest_y, bitmap,
|
||||
Rect.new(SOURCE_TILE_WIDTH + frame * SOURCE_TILE_WIDTH * 3, SOURCE_TILE_HEIGHT * 4,
|
||||
Rect.new(SOURCE_TILE_WIDTH + (frame * SOURCE_TILE_WIDTH * 3), SOURCE_TILE_HEIGHT * 4,
|
||||
SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT))
|
||||
when 4 # Bottom right corner
|
||||
new_bitmap.blt(dest_x, dest_y, bitmap,
|
||||
Rect.new(SOURCE_TILE_WIDTH + frame * SOURCE_TILE_WIDTH * 3, SOURCE_TILE_HEIGHT * 5,
|
||||
Rect.new(SOURCE_TILE_WIDTH + (frame * SOURCE_TILE_WIDTH * 3), SOURCE_TILE_HEIGHT * 5,
|
||||
SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT))
|
||||
when 8 # Bottom left corner
|
||||
new_bitmap.blt(dest_x, dest_y, bitmap,
|
||||
|
||||
@@ -89,7 +89,7 @@ class TileDrawingHelper
|
||||
|
||||
def bltSmallAutotile(bitmap, x, y, cxTile, cyTile, id, frame)
|
||||
return if id >= 384 || frame < 0 || !@autotiles
|
||||
autotile = @autotiles[id / 48 - 1]
|
||||
autotile = @autotiles[(id / 48) - 1]
|
||||
return if !autotile || autotile.disposed?
|
||||
cxTile = [cxTile / 2, 1].max
|
||||
cyTile = [cyTile / 2, 1].max
|
||||
@@ -104,8 +104,8 @@ class TileDrawingHelper
|
||||
src = Rect.new(0, 0, 0, 0)
|
||||
for i in 0...4
|
||||
tile_position = tiles[i] - 1
|
||||
src.set(tile_position % 6 * 16 + anim, tile_position / 6 * 16, 16, 16)
|
||||
bitmap.stretch_blt(Rect.new(i % 2 * cxTile + x, i / 2 * cyTile + y, cxTile, cyTile),
|
||||
src.set((tile_position % 6 * 16) + anim, tile_position / 6 * 16, 16, 16)
|
||||
bitmap.stretch_blt(Rect.new((i % 2 * cxTile) + x, (i / 2 * cyTile) + y, cxTile, cyTile),
|
||||
autotile, src)
|
||||
end
|
||||
end
|
||||
@@ -180,9 +180,9 @@ def bltMinimapAutotile(dstBitmap, x, y, srcBitmap, id)
|
||||
src = Rect.new(0, 0, 0, 0)
|
||||
for i in 0...4
|
||||
tile_position = tiles[i] - 1
|
||||
src.set(tile_position % 6 * cxTile + anim,
|
||||
src.set((tile_position % 6 * cxTile) + anim,
|
||||
tile_position / 6 * cyTile, cxTile, cyTile)
|
||||
dstBitmap.blt(i % 2 * cxTile + x, i / 2 * cyTile + y, srcBitmap, src)
|
||||
dstBitmap.blt((i % 2 * cxTile) + x, (i / 2 * cyTile) + y, srcBitmap, src)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user