Refactored some code relating to colours, trivially simplified some calculations

This commit is contained in:
Maruno17
2022-08-13 23:59:24 +01:00
parent aa9b1a9e23
commit b1cde2db42
42 changed files with 294 additions and 250 deletions

View File

@@ -111,10 +111,10 @@ class PokemonTilesetScene
# Draw tile (at 200% size)
@tilehelper.bltSmallTile(overlay, tile_x, tile_y, TILE_SIZE * 2, TILE_SIZE * 2, tile_id)
# Draw box around tile image
overlay.fill_rect(tile_x - 1, tile_y - 1, (TILE_SIZE * 2) + 2, 1, Color.new(255, 255, 255))
overlay.fill_rect(tile_x - 1, tile_y - 1, 1, (TILE_SIZE * 2) + 2, Color.new(255, 255, 255))
overlay.fill_rect(tile_x - 1, tile_y + (TILE_SIZE * 2), (TILE_SIZE * 2) + 2, 1, Color.new(255, 255, 255))
overlay.fill_rect(tile_x + (TILE_SIZE * 2), tile_y - 1, 1, (TILE_SIZE * 2) + 2, Color.new(255, 255, 255))
overlay.fill_rect(tile_x - 1, tile_y - 1, (TILE_SIZE * 2) + 2, 1, Color.white)
overlay.fill_rect(tile_x - 1, tile_y - 1, 1, (TILE_SIZE * 2) + 2, Color.white)
overlay.fill_rect(tile_x - 1, tile_y + (TILE_SIZE * 2), (TILE_SIZE * 2) + 2, 1, Color.white)
overlay.fill_rect(tile_x + (TILE_SIZE * 2), tile_y - 1, 1, (TILE_SIZE * 2) + 2, Color.white)
# Write terrain tag info about selected tile
terrain_tag = @tileset.terrain_tags[tile_id] || 0
if GameData::TerrainTag.exists?(terrain_tag)

View File

@@ -339,7 +339,7 @@ class SpritePositioner
pbFadeInAndShow(@sprites) { update }
@starting = false
end
cw = Window_CommandPokemonEx.newEmpty(0, 0, 260, 32 + (24 * 6), @viewport)
cw = Window_CommandPokemonEx.newEmpty(0, 0, 260, 176, @viewport)
cw.rowHeight = 24
pbSetSmallFont(cw.contents)
cw.x = Graphics.width - cw.width

View File

@@ -368,7 +368,7 @@ class SpriteFrame < InvalidatableSprite
@previous = previous
@locked = false
@selected = false
@selcolor = Color.new(0, 0, 0)
@selcolor = Color.black
@unselcolor = Color.new(220, 220, 220)
@prevcolor = Color.new(64, 128, 192)
@contents = Bitmap.new(64, 64)

View File

@@ -7,11 +7,11 @@ class ControlPointSprite < Sprite
def initialize(red, viewport = nil)
super(viewport)
self.bitmap = Bitmap.new(6, 6)
self.bitmap.fill_rect(0, 0, 6, 1, Color.new(0, 0, 0))
self.bitmap.fill_rect(0, 0, 1, 6, Color.new(0, 0, 0))
self.bitmap.fill_rect(0, 5, 6, 1, Color.new(0, 0, 0))
self.bitmap.fill_rect(5, 0, 1, 6, Color.new(0, 0, 0))
color = (red) ? Color.new(255, 0, 0) : Color.new(0, 0, 0)
self.bitmap.fill_rect(0, 0, 6, 1, Color.black)
self.bitmap.fill_rect(0, 0, 1, 6, Color.black)
self.bitmap.fill_rect(0, 5, 6, 1, Color.black)
self.bitmap.fill_rect(5, 0, 1, 6, Color.black)
color = (red) ? Color.new(255, 0, 0) : Color.black
self.bitmap.fill_rect(2, 2, 2, 2, color)
self.x = -6
self.y = -6
@@ -54,7 +54,7 @@ class PointSprite < Sprite
def initialize(x, y, viewport = nil)
super(viewport)
self.bitmap = Bitmap.new(2, 2)
self.bitmap.fill_rect(0, 0, 2, 2, Color.new(0, 0, 0))
self.bitmap.fill_rect(0, 0, 2, 2, Color.black)
self.x = x
self.y = y
end

View File

@@ -68,14 +68,14 @@ class SpriteWindow_DebugVariables < Window_DrawableCommand
x += (w / 2) - (width / 2)
end
y += 8 # TEXT OFFSET
base = Color.new(12 * 8, 12 * 8, 12 * 8)
base = Color.new(96, 96, 96)
case colors
when 1 # Red
base = Color.new(168, 48, 56)
when 2 # Green
base = Color.new(0, 144, 0)
end
pbDrawShadowText(self.contents, x, y, [width, w].max, h, t, base, Color.new(26 * 8, 26 * 8, 25 * 8))
pbDrawShadowText(self.contents, x, y, [width, w].max, h, t, base, Color.new(208, 208, 200))
end
def drawItem(index, _count, rect)
@@ -394,18 +394,18 @@ class SpriteWindow_DebugRoamers < Window_DrawableCommand
width = self.contents.text_size(t).width
case align
when 1
x += (w - width) # Right aligned
x += (w - width) # Right aligned
when 2
x += (w / 2) - (width / 2) # Centre aligned
end
base = Color.new(12 * 8, 12 * 8, 12 * 8)
base = Color.new(96, 96, 96)
case colors
when 1
base = Color.new(168, 48, 56) # Red
when 2
base = Color.new(0, 144, 0) # Green
end
pbDrawShadowText(self.contents, x, y, [width, w].max, h, t, base, Color.new(26 * 8, 26 * 8, 25 * 8))
pbDrawShadowText(self.contents, x, y, [width, w].max, h, t, base, Color.new(208, 208, 200))
end
def drawItem(index, _count, rect)