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

@@ -188,17 +188,95 @@ class Color
return init_original(*args)
end
# Returns this color as a hex string like "#RRGGBB".
def to_hex
r = sprintf("%02X", self.red)
g = sprintf("%02X", self.green)
b = sprintf("%02X", self.blue)
return ("#" + r + g + b).upcase
def self.new_from_rgb(param)
return Font.default_color if !param
base_int = param.to_i(16)
case param.length
when 8 # 32-bit hex
return Color.new(
(base_int >> 24) & 0xFF,
(base_int >> 16) & 0xFF,
(base_int >> 8) & 0xFF,
(base_int) & 0xFF
)
when 6 # 24-bit hex
return Color.new(
(base_int >> 16) & 0xFF,
(base_int >> 8) & 0xFF,
(base_int) & 0xFF
)
when 4 # 15-bit hex
return Color.new(
((base_int) & 0x1F) << 3,
((base_int >> 5) & 0x1F) << 3,
((base_int >> 10) & 0x1F) << 3
)
when 1, 2 # Color number
case base_int
when 0 then return Color.white
when 1 then return Color.blue
when 2 then return Color.red
when 3 then return Color.green
when 4 then return Color.cyan
when 5 then return Color.pink
when 6 then return Color.yellow
when 7 then return Color.gray
else return Font.default_color
end
end
return Font.default_color
end
# Returns this color as a 24-bit color integer.
# @return [String] the 15-bit representation of this color in a string, ignoring its alpha
def to_rgb15
ret = (self.red >> 3)
ret |= ((self.green >> 3) << 5)
ret |= ((self.blue >> 3) << 10)
return sprintf("%04X", ret)
end
# @return [String] this color in the format "RRGGBB", ignoring its alpha
def to_rgb24
return sprintf("%02X%02X%02X", self.red, self.green, self.blue)
end
# @return [String] this color in the format "RRGGBBAA" (or "RRGGBB" if this color's alpha is 255)
def to_rgb32(always_include_alpha = false)
return sprintf("%02X%02X%02X", self.red, self.green, self.blue) if self.alpha == 255 && !always_include_alpha
return sprintf("%02X%02X%02X%02X", self.red, self.green, self.blue, self.alpha)
end
# @return [String] this color in the format "#RRGGBB", ignoring its alpha
def to_hex
return "#" + to_rgb24
end
# @return [Integer] this color in RGB format converted to an integer
def to_i
return self.to_hex.delete("#").to_i(16)
return self.to_rgb24.to_i(16)
end
# @return [Color] the contrasting color to this one
def get_contrast_color
r = self.red
g = self.green
b = self.blue
yuv = [
(r * 0.299) + (g * 0.587) + (b * 0.114),
(r * -0.1687) + (g * -0.3313) + (b * 0.500) + 0.5,
(r * 0.500) + (g * -0.4187) + (b * -0.0813) + 0.5
]
if yuv[0] < 127.5
yuv[0] += (255 - yuv[0]) / 2
else
yuv[0] = yuv[0] / 2
end
return Color.new(
yuv[0] + (1.4075 * (yuv[2] - 0.5)),
yuv[0] - (0.3455 * (yuv[1] - 0.5)) - (0.7169 * (yuv[2] - 0.5)),
yuv[0] + (1.7790 * (yuv[1] - 0.5)),
self.alpha
)
end
# Converts the provided hex string/24-bit integer to RGB values.
@@ -223,18 +301,44 @@ class Color
return nil
end
# Returns color object for some commonly used colors
def self.red; return Color.new(255, 0, 0); end
def self.green; return Color.new( 0, 255, 0); end
def self.blue; return Color.new( 0, 0, 255); end
def self.black; return Color.new( 0, 0, 0); end
def self.white; return Color.new(255, 255, 255); end
def self.yellow; return Color.new(255, 255, 0); end
# Returns color object for some commonly used colors.
def self.red; return Color.new(255, 128, 128); end
def self.green; return Color.new(128, 255, 128); end
def self.blue; return Color.new(128, 128, 255); end
def self.yellow; return Color.new(255, 255, 128); end
def self.magenta; return Color.new(255, 0, 255); end
def self.teal; return Color.new( 0, 255, 255); end
def self.cyan; return Color.new(128, 255, 255); end
def self.white; return Color.new(255, 255, 255); end
def self.gray; return Color.new(192, 192, 192); end
def self.black; return Color.new( 0, 0, 0); end
def self.pink; return Color.new(255, 128, 255); end
def self.orange; return Color.new(255, 155, 0); end
def self.purple; return Color.new(155, 0, 255); end
def self.brown; return Color.new(112, 72, 32); end
# TODO: These are from def getSkinColor. It isn't appropriate to make Color
# objects of these, though, as they're just converted straight back into
# hex strings.
# def self.text_blue; return Color.new( 0, 112, 248); end
# def self.text_blue_light; return Color.new(120, 184, 232); end
# def self.text_red; return Color.new(232, 32, 16); end
# def self.text_red_light; return Color.new(248, 168, 184); end
# def self.text_green; return Color.new( 96, 176, 72); end
# def self.text_green_light; return Color.new(174, 208, 144); end
# def self.text_cyan; return Color.new( 72, 216, 216); end
# def self.text_cyan_light; return Color.new(168, 224, 224); end
# def self.text_magenta; return Color.new(208, 56, 184); end
# def self.text_magenta_light; return Color.new(232, 160, 224); end
# def self.text_yellow; return Color.new(232, 208, 32); end
# def self.text_yellow_light; return Color.new(248, 232, 136); end
# def self.text_gray; return Color.new(160, 160, 168); end
# def self.text_gray_light; return Color.new(208, 208, 216); end
# def self.text_white; return Color.new(240, 240, 248); end
# def self.text_white_light; return Color.new(200, 200, 208); end # Intentionally darker than text_white
# def self.text_purple; return Color.new(114, 64, 232); end
# def self.text_purple_light; return Color.new(184, 168, 224); end
# def self.text_orange; return Color.new(248, 152, 24); end
# def self.text_orange_light; return Color.new(248, 200, 152); end
end
#===============================================================================

View File

@@ -201,7 +201,7 @@ class SpriteAnimation
sprite.y = sprite_y + cell_data[i, 2]
next if quick_update
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
sprite.src_rect.set((pattern % 5) * 192, (pattern / 5) * 192, 192, 192)
case @_animation_height
when 0 then sprite.z = 1
when 1 then sprite.z = sprite.y + (Game_Map::TILE_HEIGHT * 3 / 2) + 1

View File

@@ -87,7 +87,7 @@ class Sprite_Shadow < RPG::Sprite
end
@deltax = ScreenPosHelper.pbScreenX(@source) - self.x
@deltay = ScreenPosHelper.pbScreenY(@source) - self.y
self.color = Color.new(0, 0, 0)
self.color = Color.black
@distance = ((@deltax**2) + (@deltay**2))
self.opacity = @self_opacity * 13_000 / ((@distance * 370 / @distancemax) + 6000)
self.angle = 57.3 * Math.atan2(@deltax, @deltay)

View File

@@ -104,7 +104,7 @@ class TileDrawingHelper
src = Rect.new(0, 0, 0, 0)
4.times do |i|
tile_position = tiles[i] - 1
src.set((tile_position % 6 * 16) + anim, tile_position / 6 * 16, 16, 16)
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
@@ -113,7 +113,7 @@ class TileDrawingHelper
def bltSmallRegularTile(bitmap, x, y, cxTile, cyTile, id)
return if id < 384 || !@tileset || @tileset.disposed?
rect = Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32, 32, 32)
rect = Rect.new(((id - 384) % 8) * 32, ((id - 384) / 8) * 32, 32, 32)
rect = TilemapRenderer::TilesetWrapper.getWrappedRect(rect) if @shouldWrap
bitmap.stretch_blt(Rect.new(x, y, cxTile, cyTile), @tileset, rect)
end
@@ -150,7 +150,7 @@ def createMinimap(mapid)
map = load_data(sprintf("Data/Map%03d.rxdata", mapid)) rescue nil
return BitmapWrapper.new(32, 32) if !map
bitmap = BitmapWrapper.new(map.width * 4, map.height * 4)
black = Color.new(0, 0, 0)
black = Color.black
tilesets = $data_tilesets
tileset = tilesets[map.tileset_id]
return bitmap if !tileset

View File

@@ -67,7 +67,7 @@ module RPG
ret.addRef
else
ret = BitmapWrapper.new(32 * width, 32 * height)
x = (tile_id - 384) % 8 * 32
x = ((tile_id - 384) % 8) * 32
y = (((tile_id - 384) / 8) - height + 1) * 32
tileset = yield(filename)
ret.blt(0, 0, tileset, Rect.new(x, y, 32 * width, 32 * height))

View File

@@ -342,10 +342,10 @@ def getSkinColor(windowskin, color, isDarkSkin)
"F0F0F8", "C8C8D0", # 8 White
"9040E8", "B8A8E0", # 9 Purple
"F89818", "F8C898", # 10 Orange
colorToRgb32(MessageConfig::DARK_TEXT_MAIN_COLOR),
colorToRgb32(MessageConfig::DARK_TEXT_SHADOW_COLOR), # 11 Dark default
colorToRgb32(MessageConfig::LIGHT_TEXT_MAIN_COLOR),
colorToRgb32(MessageConfig::LIGHT_TEXT_SHADOW_COLOR) # 12 Light default
MessageConfig::DARK_TEXT_MAIN_COLOR.to_rgb24,
MessageConfig::DARK_TEXT_SHADOW_COLOR.to_rgb24, # 11 Dark default
MessageConfig::LIGHT_TEXT_MAIN_COLOR.to_rgb24,
MessageConfig::LIGHT_TEXT_SHADOW_COLOR.to_rgb24 # 12 Light default
]
if color == 0 || color > textcolors.length / 2 # No special colour, use default
if isDarkSkin # Dark background, light text
@@ -365,7 +365,7 @@ def getSkinColor(windowskin, color, isDarkSkin)
x = 64 + ((color % 8) * 8)
y = 96 + ((color / 8) * 8)
pixel = windowskin.get_pixel(x, y)
return shadowctagFromColor(pixel)
return shadowc3tag(pixel, pixel.get_contrast_color)
end
end

View File

@@ -447,13 +447,13 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
when 1 # Lower right
pauseWidth = @pausesprite.bitmap ? @pausesprite.framewidth : 16
pauseHeight = @pausesprite.bitmap ? @pausesprite.frameheight : 16
@pausesprite.x = self.x + self.width - (20 * 2) + (pauseWidth / 2)
@pausesprite.y = self.y + self.height - (30 * 2) + (pauseHeight / 2)
@pausesprite.x = self.x + self.width - 40 + (pauseWidth / 2)
@pausesprite.y = self.y + self.height - 60 + (pauseHeight / 2)
when 2 # Lower middle
pauseWidth = @pausesprite.bitmap ? @pausesprite.framewidth : 16
pauseHeight = @pausesprite.bitmap ? @pausesprite.frameheight : 16
@pausesprite.x = self.x + (self.width / 2) - (pauseWidth / 2)
@pausesprite.y = self.y + self.height - (18 * 2) + (pauseHeight / 2)
@pausesprite.y = self.y + self.height - 36 + (pauseHeight / 2)
end
end

View File

@@ -1,118 +1,57 @@
#===============================================================================
# Text colours
#===============================================================================
# TODO: Unused.
def ctag(color)
ret = (color.red.to_i << 24)
ret |= ((color.green.to_i) << 16)
ret |= ((color.blue.to_i) << 8)
ret |= ((color.alpha.to_i))
return sprintf("<c=%08X>", ret)
return sprintf("<c=%s>", color.to_rgb32(true))
end
def shadowctag(base, shadow)
return sprintf("<c2=%s%s>", colorToRgb16(base), colorToRgb16(shadow))
return sprintf("<c2=%s%s>", base.to_rgb15, shadow.to_rgb15)
end
def shadowc3tag(base, shadow)
return sprintf("<c3=%s,%s>", colorToRgb32(base), colorToRgb32(shadow))
return sprintf("<c3=%s,%s>", base.to_rgb32, shadow.to_rgb32)
end
# TODO: Unused.
def shadowctagFromColor(color)
return shadowc3tag(color, getContrastColor(color))
return shadowc3tag(color, color.get_contrast_color)
end
# TODO: Unused.
def shadowctagFromRgb(param)
return shadowctagFromColor(rgbToColor(param))
return shadowctagFromColor(Color.new_from_rgb(param))
end
# @deprecated This method is slated to be removed in v22.
def colorToRgb32(color)
return "" if !color
if color.alpha.to_i == 255
return sprintf("%02X%02X%02X", color.red.to_i, color.green.to_i, color.blue.to_i)
else
return sprintf("%02X%02X%02X%02X",
color.red.to_i, color.green.to_i, color.blue.to_i, color.alpha.to_i)
end
Deprecation.warn_method("colorToRgb32", "v22", "color.to_rgb32")
return color.to_rgb32
end
# @deprecated This method is slated to be removed in v22.
def colorToRgb16(color)
ret = (color.red.to_i >> 3)
ret |= ((color.green.to_i >> 3) << 5)
ret |= ((color.blue.to_i >> 3) << 10)
return sprintf("%04X", ret)
Deprecation.warn_method("colorToRgb16", "v22", "color.to_rgb15")
return color.to_rgb15
end
# @deprecated This method is slated to be removed in v22.
def rgbToColor(param)
return Font.default_color if !param
baseint = param.to_i(16)
case param.length
when 8 # 32-bit hex
return Color.new(
(baseint >> 24) & 0xFF,
(baseint >> 16) & 0xFF,
(baseint >> 8) & 0xFF,
(baseint) & 0xFF
)
when 6 # 24-bit hex
return Color.new(
(baseint >> 16) & 0xFF,
(baseint >> 8) & 0xFF,
(baseint) & 0xFF
)
when 4 # 16-bit hex
return Color.new(
((baseint) & 0x1F) << 3,
((baseint >> 5) & 0x1F) << 3,
((baseint >> 10) & 0x1F) << 3
)
when 1 # Color number
i = param.to_i
return Font.default_color if i >= 8
return [
Color.new(255, 255, 255, 255),
Color.new(128, 128, 255, 255),
Color.new(255, 128, 128, 255),
Color.new(128, 255, 128, 255),
Color.new(128, 255, 255, 255),
Color.new(255, 128, 255, 255),
Color.new(255, 255, 128, 255),
Color.new(192, 192, 192, 255)
][i]
else
return Font.default_color
end
Deprecation.warn_method("rgbToColor", "v22", "Color.new_from_rgb(param)")
return Color.new_from_rgb(param)
end
def Rgb16ToColor(param)
baseint = param.to_i(16)
return Color.new(
((baseint) & 0x1F) << 3,
((baseint >> 5) & 0x1F) << 3,
((baseint >> 10) & 0x1F) << 3
)
# @deprecated This method is slated to be removed in v22.
def rgb15ToColor(param)
Deprecation.warn_method("rgb15ToColor", "v22", "Color.new_from_rgb(param)")
return Color.new_from_rgb(param)
end
# @deprecated This method is slated to be removed in v22.
def getContrastColor(color)
raise "No color given" if !color
r = color.red
g = color.green
b = color.blue
yuv = [
(r * 0.299) + (g * 0.587) + (b * 0.114),
(r * -0.1687) + (g * -0.3313) + (b * 0.500) + 0.5,
(r * 0.500) + (g * -0.4187) + (b * -0.0813) + 0.5
]
if yuv[0] < 127.5
yuv[0] += (255 - yuv[0]) / 2
else
yuv[0] = yuv[0] / 2
end
return Color.new(
yuv[0] + (1.4075 * (yuv[2] - 0.5)),
yuv[0] - (0.3455 * (yuv[1] - 0.5)) - (0.7169 * (yuv[2] - 0.5)),
yuv[0] + (1.7790 * (yuv[1] - 0.5)),
color.alpha
)
Deprecation.warn_method("getContrastColor", "v22", "color.get_contrast_color")
return color.get_contrast_color
end
@@ -151,8 +90,8 @@ def itemIconTag(item)
if item.respond_to?("icon_name")
return sprintf("<icon=%s>", item.icon_name)
else
ix = item.icon_index % 16 * 24
iy = item.icon_index / 16 * 24
ix = (item.icon_index % 16) * 24
iy = (item.icon_index / 16) * 24
return sprintf("<img=Graphics/System/Iconset|%d|%d|24|24>", ix, iy)
end
end
@@ -481,15 +420,15 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
if endtag
colorstack.pop
else
color = rgbToColor(param)
color = Color.new_from_rgb(param)
colorstack.push([color, nil])
end
when "c2"
if endtag
colorstack.pop
else
base = Rgb16ToColor(param[0, 4])
shadow = Rgb16ToColor(param[4, 4])
base = Color.new_from_rgb(param[0, 4])
shadow = Color.new_from_rgb(param[4, 4])
colorstack.push([base, shadow])
end
when "c3"
@@ -499,8 +438,8 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
param = param.split(",")
# get pure colors unaffected by opacity
oldColors = getLastParam(colorstack, defaultcolors)
base = (param[0] && param[0] != "") ? rgbToColor(param[0]) : oldColors[0]
shadow = (param[1] && param[1] != "") ? rgbToColor(param[1]) : oldColors[1]
base = (param[0] && param[0] != "") ? Color.new_from_rgb(param[0]) : oldColors[0]
shadow = (param[1] && param[1] != "") ? Color.new_from_rgb(param[1]) : oldColors[1]
colorstack.push([base, shadow])
end
when "o"
@@ -921,7 +860,7 @@ def getLineBrokenChunks(bitmap, value, width, dims, plain = false)
end
textcols = []
if ccheck[/</] && !plain
ccheck.scan(re) { textcols.push(rgbToColor($1)) }
ccheck.scan(re) { textcols.push(Color.new_from_rgb($1)) }
words = ccheck.split(reNoMatch) # must have no matches because split can include match
else
words = [ccheck]
@@ -1086,7 +1025,7 @@ end
def drawFormattedTextEx(bitmap, x, y, width, text, baseColor = nil, shadowColor = nil, lineheight = 32)
base = baseColor ? baseColor.clone : Color.new(96, 96, 96)
shadow = shadowColor ? shadowColor.clone : Color.new(208, 208, 200)
text = "<c2=" + colorToRgb16(base) + colorToRgb16(shadow) + ">" + text
text = shadowctag(base, shadow) + text
chars = getFormattedText(bitmap, x, y, width, -1, text, lineheight)
drawFormattedChars(bitmap, chars)
end

View File

@@ -507,7 +507,7 @@ class Window_MultilineTextEntry < SpriteWindow_Base
bitmap.clear
getTextChars
height = self.height - self.borderY
cursorcolor = Color.new(0, 0, 0)
cursorcolor = Color.black
textchars = getTextChars
startY = getLineY(@firstline)
textchars.each do |text|

View File

@@ -256,7 +256,7 @@ module Transitions
@overworld_sprite.visible = false
# Black background
@black_sprite = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@black_sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0))
@black_sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.black)
# Overworld sprites
sprite_width = @overworld_bitmap.width / NUM_SPRITES_X
sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y
@@ -1292,7 +1292,7 @@ module Transitions
@foe_sprite = new_sprite(Graphics.width + @foe_bitmap.width, @sprites[0].y + @sprites[0].height - 12,
@foe_bitmap, @foe_bitmap.width / 2, @foe_bitmap.height)
@foe_sprite.z = 7
@foe_sprite.color = Color.new(0, 0, 0)
@foe_sprite.color = Color.black
# Sprite with foe's name written in it
@text_sprite = BitmapSprite.new(Graphics.width, @bar_bitmap.height, @viewport)
@text_sprite.y = BAR_Y
@@ -1481,13 +1481,13 @@ module Transitions
@player_bar_sprite.y + BAR_HEIGHT - TRAINER_Y_OFFSET,
@player_bitmap, @player_bitmap.width / 2, @player_bitmap.height)
@player_sprite.z = 7
@player_sprite.color = Color.new(0, 0, 0)
@player_sprite.color = Color.black
# Foe sprite
@foe_sprite = new_sprite(@foe_bar_sprite.x + (@bar_bitmap.width / 2) - TRAINER_X_OFFSET,
@foe_bar_sprite.y + @foe_bitmap.height - TRAINER_Y_OFFSET,
@foe_bitmap, @foe_bitmap.width / 2, @foe_bitmap.height)
@foe_sprite.z = 7
@foe_sprite.color = Color.new(0, 0, 0)
@foe_sprite.color = Color.black
# Sprite with foe's name written in it
@text_sprite = BitmapSprite.new(@bar_bitmap.width / 2, BAR_HEIGHT, @viewport)
@text_sprite.x = @foe_bar_start_x

View File

@@ -105,7 +105,7 @@ module Battle::Scene::Animation::BallAnimationMixin
if traSprite.bitmap.width < traSprite.bitmap.height * 2
ball.setVisible(7, true)
ballStartX = traSprite.x
ballStartX -= ball.totalDuration * (Graphics.width / (2 * 16)) if !safariThrow
ballStartX -= ball.totalDuration * (Graphics.width / 32) if !safariThrow
ballStartY = traSprite.y - (traSprite.bitmap.height / 2)
return ballStartX, ballStartY
end
@@ -122,11 +122,11 @@ module Battle::Scene::Animation::BallAnimationMixin
# Arm stretched out behind player
ball.setVisible(0, true)
ball.setXY(0, coordSets[0][0], coordSets[0][1])
ball.moveDelta(0, 5, -5 * (Graphics.width / (2 * 16)), 0) if !safariThrow
ball.moveDelta(0, 5, -5 * (Graphics.width / 32), 0) if !safariThrow
ball.setDelta(0, -12, 0) if safariThrow
# Arm mid throw
ball.setDelta(5, coordSets[1][0], coordSets[1][1])
ball.moveDelta(5, 2, -2 * (Graphics.width / (2 * 16)), 0) if !safariThrow
ball.moveDelta(5, 2, -2 * (Graphics.width / 32), 0) if !safariThrow
ball.setDelta(5, 34, 0) if safariThrow
# Start of throw
ball.setDelta(7, coordSets[2][0], coordSets[2][1])
@@ -137,7 +137,7 @@ module Battle::Scene::Animation::BallAnimationMixin
ballStartX += c[0]
ballStartY += c[1]
end
ballStartX -= ball.totalDuration * (Graphics.width / (2 * 16)) if !safariThrow
ballStartX -= ball.totalDuration * (Graphics.width / 32) if !safariThrow
ballStartX += 8 if safariThrow # -12 + 34 - 14
return ballStartX, ballStartY
end

View File

@@ -268,7 +268,7 @@ class PBAnimTiming
@colorAlpha = nil
@duration = 5
@flashScope = 0
@flashColor = Color.new(255, 255, 255, 255)
@flashColor = Color.white
@flashDuration = 5
end
@@ -722,7 +722,7 @@ class PBAnimationPlayerX
@animsprites[i].visible = false
end
# Create background colour sprite
@bgColor = ColoredPlane.new(Color.new(0, 0, 0), @viewport)
@bgColor = ColoredPlane.new(Color.black, @viewport)
@bgColor.z = 5
@bgColor.opacity = 0
@bgColor.refresh
@@ -733,7 +733,7 @@ class PBAnimationPlayerX
@bgGraphic.opacity = 0
@bgGraphic.refresh
# Create foreground colour sprite
@foColor = ColoredPlane.new(Color.new(0, 0, 0), @viewport)
@foColor = ColoredPlane.new(Color.black, @viewport)
@foColor.z = 85
@foColor.opacity = 0
@foColor.refresh

View File

@@ -69,7 +69,7 @@ class DarknessSprite < Sprite
end
def refresh
@darkness.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 255))
@darkness.fill_rect(0, 0, Graphics.width, Graphics.height, Color.black)
cx = Graphics.width / 2
cy = Graphics.height / 2
cradius = @radius

View File

@@ -138,7 +138,7 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
$PokemonGlobal.nextBattleBack = nil
$PokemonEncounters.reset_step_count
# Fade back to the overworld in 0.4 seconds
viewport.color = Color.new(0, 0, 0, 255)
viewport.color = Color.black
timer = 0.0
loop do
Graphics.update
@@ -179,7 +179,7 @@ def pbBattleAnimationCore(anim, viewport, location, num_flashes = 2)
$game_temp.background_bitmap = Graphics.snap_to_bitmap
# Play main animation
Graphics.freeze
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
viewport.color = Color.black # Ensure screen is black
Graphics.transition(25, "Graphics/Transitions/" + anim)
# Slight pause after animation before starting up the battle scene
pbWait(Graphics.frame_rate / 10)
@@ -421,7 +421,7 @@ SpecialBattleIntroAnimations.register("alternate_vs_trainer_animation", 50, #
viewvs.dispose
viewopp.dispose
viewplayer.dispose
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
viewport.color = Color.black # Ensure screen is black
}
)

View File

@@ -81,8 +81,8 @@ def pbHiddenMoveAnimation(pokemon)
strobebitmap = AnimatedBitmap.new("Graphics/Pictures/hiddenMoveStrobes")
strobes = []
15.times do |i|
strobe = BitmapSprite.new(26 * 2, 8 * 2, viewport)
strobe.bitmap.blt(0, 0, strobebitmap.bitmap, Rect.new(0, (i % 2) * 8 * 2, 26 * 2, 8 * 2))
strobe = BitmapSprite.new(52, 16, viewport)
strobe.bitmap.blt(0, 0, strobebitmap.bitmap, Rect.new(0, (i % 2) * 16, 52, 16))
strobe.z = (i.even? ? 2 : 0)
strobe.visible = false
strobes.push(strobe)

View File

@@ -13,6 +13,8 @@
# trainers, but allow scripted calls as normal).
# TODO: Better messages, more customisation of messages.
# TODO: Add a Debug way of upgrading old phone script calls to new ones, or at
# least to find events using old phone scripts for the dev to update.
#===============================================================================
#
#===============================================================================
@@ -550,25 +552,25 @@ EventHandlers.add(:on_frame_update, :phone_call_counter,
# : Branch End
# : Branch End
# @>
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneRegisterBattle(message, event, trainer_type, name, versions_count)
Deprecation.warn_method("pbPhoneRegisterBattle", "v21", "several scripts and event commands; see def pbPhoneRegisterBattle")
Deprecation.warn_method("pbPhoneRegisterBattle", "v22", "several scripts and event commands; see def pbPhoneRegisterBattle")
return false if !Phone.can_add?(trainer_type, name, 0)
message = _INTL("Let me register you.") if !message
return false if !pbConfirmMessage(message)
return Phone.add(event, trainer_type, name, 0, versions_count)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneRegister(event, trainer_type, name)
Deprecation.warn_method("pbPhoneRegister", "v21", "Phone.add_silent(event, trainer_type, name)")
Deprecation.warn_method("pbPhoneRegister", "v22", "Phone.add_silent(event, trainer_type, name)")
Phone.add_silent(event, trainer_type, name)
end
# Called by events.
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneRegisterNPC(common_event_id, name, map_id, show_message = true)
Deprecation.warn_method("pbPhoneRegisterNPC", "v21", "Phone.add(map_id, name, common_event_id) or Phone.add_silent(map_id, name, common_event_id)")
Deprecation.warn_method("pbPhoneRegisterNPC", "v22", "Phone.add(map_id, name, common_event_id) or Phone.add_silent(map_id, name, common_event_id)")
if show_message
Phone.add(map_id, name, common_event_id)
else
@@ -576,34 +578,34 @@ def pbPhoneRegisterNPC(common_event_id, name, map_id, show_message = true)
end
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneDeleteContact(index)
Deprecation.warn_method("pbPhoneDeleteContact", "v21", "$PokemonGlobal.phone.contacts[index].visible = false")
Deprecation.warn_method("pbPhoneDeleteContact", "v22", "$PokemonGlobal.phone.contacts[index].visible = false")
$PokemonGlobal.phone.contacts[index].visible = false
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbFindPhoneTrainer(trainer_type, name)
Deprecation.warn_method("pbFindPhoneTrainer", "v21", "Phone.get(trainer_type, name)")
Deprecation.warn_method("pbFindPhoneTrainer", "v22", "Phone.get(trainer_type, name)")
return Phone.get(trainer_type, name)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbHasPhoneTrainer?(trainer_type, name)
Deprecation.warn_method("pbHasPhoneTrainer", "v21", "Phone.get(trainer_type, name) != nil")
Deprecation.warn_method("pbHasPhoneTrainer", "v22", "Phone.get(trainer_type, name) != nil")
return Phone.get(trainer_type, name) != nil
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneReadyToBattle?(trainer_type, name)
Deprecation.warn_method("pbPhoneReadyToBattle", "v21", "Phone.get(trainer_type, name).can_rematch?")
Deprecation.warn_method("pbPhoneReadyToBattle", "v22", "Phone.get(trainer_type, name).can_rematch?")
contact = Phone.get(trainer_type, name)
return contact && contact.can_rematch?
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneReset(tr_type, tr_name)
Deprecation.warn_method("pbPhoneReadyToBattle", "v21", "Phone.get(trainer_type, name) and other things")
Deprecation.warn_method("pbPhoneReadyToBattle", "v22", "Phone.get(trainer_type, name) and other things")
contact = Phone.get(trainer_type, name)
return false if !contact
contact.time_to_ready = 0
@@ -614,64 +616,64 @@ def pbPhoneReset(tr_type, tr_name)
end
# Called by events.
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneBattleCount(trainer_type, name)
Deprecation.warn_method("pbPhoneBattleCount", "v21", "Phone.variant(trainer_type, name)")
Deprecation.warn_method("pbPhoneBattleCount", "v22", "Phone.variant(trainer_type, name)")
return Phone.variant(trainer_type, name)
end
# Called by events.
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneIncrement(trainer_type, name, versions_count)
Deprecation.warn_method("pbPhoneIncrement", "v21", "Phone.increment_version(trainer_type, name, start_version)")
Deprecation.warn_method("pbPhoneIncrement", "v22", "Phone.increment_version(trainer_type, name, start_version)")
Phone.increment_version(trainer_type, name, 0)
end
# Used in phone calls that say they're ready for a rematch, used in Debug function.
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbSetReadyToBattle(contact)
Deprecation.warn_method("pbSetReadyToBattle", "v21", "contact.set_trainer_event_ready_for_rematch")
Deprecation.warn_method("pbSetReadyToBattle", "v22", "contact.set_trainer_event_ready_for_rematch")
contact.set_trainer_event_ready_for_rematch
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbRandomPhoneTrainer
Deprecation.warn_method("pbRandomPhoneTrainer", "v21", "Phone::Call.get_random_trainer_for_incoming_call")
Deprecation.warn_method("pbRandomPhoneTrainer", "v22", "Phone::Call.get_random_trainer_for_incoming_call")
return Phone::Call.get_random_trainer_for_incoming_call
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbCallTrainer(trainer_type, name)
Deprecation.warn_method("pbCallTrainer", "v21", "Phone::Call.make_outgoing(trainer_type, name)")
Deprecation.warn_method("pbCallTrainer", "v22", "Phone::Call.make_outgoing(trainer_type, name)")
Phone::Call.make_outgoing(trainer_type, name)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneGenerateCall(contact)
Deprecation.warn_method("pbPhoneGenerateCall", "v21", "Phone::Call.generate_trainer_dialogue(contact)")
Deprecation.warn_method("pbPhoneGenerateCall", "v22", "Phone::Call.generate_trainer_dialogue(contact)")
return Phone::Call.generate_trainer_dialogue(contact)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbPhoneCall(dialogue, contact)
Deprecation.warn_method("pbPhoneCall", "v21", "Phone::Call.play(dialogue, contact)")
Deprecation.warn_method("pbPhoneCall", "v22", "Phone::Call.play(dialogue, contact)")
Phone::Call.play(dialogue, contact)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbEncounterSpecies(contact)
Deprecation.warn_method("pbEncounterSpecies", "v21", "Phone::Call.get_random_encounter_species(contact)")
Deprecation.warn_method("pbEncounterSpecies", "v22", "Phone::Call.get_random_encounter_species(contact)")
return Phone::Call.get_random_encounter_species(contact)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbTrainerSpecies(contact)
Deprecation.warn_method("pbTrainerSpecies", "v21", "Phone::Call.get_random_contact_pokemon_species(contact)")
Deprecation.warn_method("pbTrainerSpecies", "v22", "Phone::Call.get_random_contact_pokemon_species(contact)")
return Phone::Call.get_random_contact_pokemon_species(contact)
end
# @deprecated This method is slated to be removed in v21.
# @deprecated This method is slated to be removed in v22.
def pbTrainerMapName(contact)
Deprecation.warn_method("pbTrainerMapName", "v21", "Phone::Call.get_map_name(contact)")
Deprecation.warn_method("pbTrainerMapName", "v22", "Phone::Call.get_map_name(contact)")
return Phone::Call.get_map_name(contact)
end

View File

@@ -69,13 +69,13 @@ def pbDisplayMail(mail, _bearer = nil)
baseForLightBG = Color.new(80, 80, 88)
shadowForLightBG = Color.new(168, 168, 176)
if mail.message && mail.message != ""
isDark = isDarkBackground(sprites["card"].bitmap, Rect.new(48, 48, Graphics.width - 96, 32 * 7))
isDark = isDarkBackground(sprites["card"].bitmap, Rect.new(48, 48, Graphics.width - 96, 224))
drawTextEx(overlay, 48, 52, Graphics.width - 94, 7, mail.message,
(isDark) ? baseForDarkBG : baseForLightBG,
(isDark) ? shadowForDarkBG : shadowForLightBG)
end
if mail.sender && mail.sender != ""
isDark = isDarkBackground(sprites["card"].bitmap, Rect.new(336, 322, 144, 32 * 1))
isDark = isDarkBackground(sprites["card"].bitmap, Rect.new(336, 322, 144, 32))
drawTextEx(overlay, 336, 328, 144, 1, mail.sender,
(isDark) ? baseForDarkBG : baseForLightBG,
(isDark) ? shadowForDarkBG : shadowForLightBG)

View File

@@ -68,7 +68,7 @@ class ButtonEventScene < EventScene
# End scene
$game_temp.background_bitmap = Graphics.snap_to_bitmap
Graphics.freeze
@viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
@viewport.color = Color.black # Ensure screen is black
Graphics.transition(8, "fadetoblack")
$game_temp.background_bitmap.dispose
scene.dispose

View File

@@ -45,8 +45,7 @@ class PokemonEggHatch_Scene
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["overlay"].z = 200
@sprites["overlay"].bitmap = Bitmap.new(Graphics.width, Graphics.height)
@sprites["overlay"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height,
Color.new(255, 255, 255))
@sprites["overlay"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.white)
@sprites["overlay"].opacity = 0
# Start up scene
pbFadeInAndShow(@sprites)

View File

@@ -70,7 +70,7 @@ class PokemonTrade_Scene
picturePoke.setOrigin(0, PictureOrigin::BOTTOM)
picturePoke.setVisible(0, true)
# Change Pokémon color
picturePoke.moveColor(2, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
picturePoke.moveColor(2, 5, Color.new(248, 176, 140))
# Recall
delay = picturePoke.totalDuration
picturePoke.setSE(delay, "Battle recall")
@@ -110,7 +110,7 @@ class PokemonTrade_Scene
# Starting position of sprite
picturePoke.setOrigin(0, PictureOrigin::BOTTOM)
picturePoke.setZoom(0, 0)
picturePoke.setColor(0, Color.new(31 * 8, 22 * 8, 30 * 8, 255))
picturePoke.setColor(0, Color.new(248, 176, 240))
picturePoke.setVisible(0, false)
# Dropping ball
y = Graphics.height - 96 - 16 - 16 # end point of Poké Ball
@@ -141,7 +141,7 @@ class PokemonTrade_Scene
picturePoke.moveXY(delay, 8, Graphics.width / 2, @sprites["rsprite2"].y)
# Return Pokémon's color to normal and play cry
delay = picturePoke.totalDuration
picturePoke.moveColor(delay, 5, Color.new(31 * 8, 22 * 8, 30 * 8, 0))
picturePoke.moveColor(delay, 5, Color.new(248, 176, 240, 0))
cry = GameData::Species.cry_filename_from_pokemon(@pokemon2)
picturePoke.setSE(delay, cry) if cry
# Play animation

View File

@@ -161,7 +161,7 @@ class HallOfFame_Scene
def xpositionformula(battlernumber)
ret = 0
if SINGLEROW
ret = battlernumber % 2 * 2
ret = (battlernumber % 2) * 2
else
ret = (battlernumber / 3).even? ? (19 - battlernumber) % 3 : (19 + battlernumber) % 3
end
@@ -173,7 +173,7 @@ class HallOfFame_Scene
if SINGLEROW
ret = 1
else
ret = (battlernumber / 3) % 2 * 2
ret = ((battlernumber / 3) % 2) * 2
end
return ret
end

View File

@@ -201,7 +201,7 @@ _END_
pbBGMFade(2.0)
$game_temp.background_bitmap = Graphics.snap_to_bitmap
Graphics.freeze
viewport.color = Color.new(0, 0, 0, 255) # Ensure screen is black
viewport.color = Color.black # Ensure screen is black
Graphics.transition(8, "fadetoblack")
$game_temp.background_bitmap.dispose
@background_sprite.dispose

View File

@@ -10,7 +10,7 @@ class Window_DexesList < Window_CommandPokemon
super(commands, width)
@selarrow = AnimatedBitmap.new("Graphics/Pictures/selarrow_white")
self.baseColor = Color.new(248, 248, 248)
self.shadowColor = Color.new(0, 0, 0)
self.shadowColor = Color.black
self.windowskin = nil
end

View File

@@ -428,7 +428,7 @@ class PokemonPokedex_Scene
end
end
textpos = [
[dexname, Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.new(0, 0, 0)]
[dexname, Graphics.width / 2, 10, 2, Color.new(248, 248, 248), Color.black]
]
textpos.push([GameData::Species.get(iconspecies).name, 112, 58, 2, base, shadow]) if iconspecies
if @searchResults

View File

@@ -216,7 +216,7 @@ class PokemonPokedexInfo_Scene
end
textpos = [
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
246, 48, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)]
246, 48, 0, Color.new(248, 248, 248), Color.black]
]
if @show_battled_count
textpos.push([_INTL("Number Battled"), 314, 164, 0, base, shadow])
@@ -243,7 +243,7 @@ class PokemonPokedexInfo_Scene
end
end
# Draw the Pokédex entry text
drawTextEx(overlay, 40, 246, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
drawTextEx(overlay, 40, 246, Graphics.width - 80, 4, # overlay, x, y, width, num lines
species_data.pokedex_entry, base, shadow)
# Draw the footprint
footprintfile = GameData::Species.footprint_filename(@species, @form)

View File

@@ -498,7 +498,7 @@ class PokemonParty_Scene
@sprites["storagetext"].z = 10
@sprites["storagetext"].viewport = @viewport
@sprites["storagetext"].baseColor = Color.new(248, 248, 248)
@sprites["storagetext"].shadowColor = Color.new(0, 0, 0)
@sprites["storagetext"].shadowColor = Color.black
@sprites["storagetext"].windowskin = nil
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new(starthelptext)
@sprites["helpwindow"].viewport = @viewport

View File

@@ -104,7 +104,7 @@ class PokemonRegionMap_Scene
pbMessage(_INTL("The map data cannot be found."))
return false
end
addBackgroundOrColoredPlane(@sprites, "background", "mapbg", Color.new(0, 0, 0), @viewport)
addBackgroundOrColoredPlane(@sprites, "background", "mapbg", Color.black, @viewport)
@sprites["map"] = IconSprite.new(0, 0, @viewport)
@sprites["map"].setBitmap("Graphics/Pictures/#{@map[1]}")
@sprites["map"].x += (Graphics.width - @sprites["map"].bitmap.width) / 2
@@ -250,7 +250,7 @@ class PokemonRegionMap_Scene
text = (@mode == 0) ? _INTL("ACTION: Fly") : _INTL("ACTION: Cancel Fly")
pbDrawTextPositions(
@sprites["help"].bitmap,
[[text, Graphics.width - 16, 4, 1, Color.new(248, 248, 248), Color.new(0, 0, 0)]]
[[text, Graphics.width - 16, 4, 1, Color.new(248, 248, 248), Color.black]]
)
@sprites.each do |key, sprite|
next if !key.include?("point")

View File

@@ -57,7 +57,7 @@ class PokemonPhoneScene
_INTL("Phone"), 2, -18, 128, 64, @viewport
)
@sprites["header"].baseColor = Color.new(248, 248, 248)
@sprites["header"].shadowColor = Color.new(0, 0, 0)
@sprites["header"].shadowColor = Color.black
@sprites["header"].windowskin = nil
@sprites["bottom"] = Window_AdvancedTextPokemon.newWithSize(
"", 162, Graphics.height - 64, Graphics.width - 158, 64, @viewport

View File

@@ -17,7 +17,7 @@ class PokemonJukebox_Scene
_INTL("Jukebox"), 2, -18, 128, 64, @viewport
)
@sprites["header"].baseColor = Color.new(248, 248, 248)
@sprites["header"].shadowColor = Color.new(0, 0, 0)
@sprites["header"].shadowColor = Color.black
@sprites["header"].windowskin = nil
@sprites["commands"] = Window_CommandPokemon.newWithSize(
@commands, 94, 92, 324, 224, @viewport

View File

@@ -124,7 +124,7 @@ class PokemonReadyMenu_Scene
@viewport.z = 99999
@sprites = {}
@sprites["cmdwindow"] = Window_CommandPokemon.new((@index[2] == 0) ? @movecommands : @itemcommands)
@sprites["cmdwindow"].height = 6 * 32
@sprites["cmdwindow"].height = 192
@sprites["cmdwindow"].visible = false
@sprites["cmdwindow"].viewport = @viewport
@commands[0].length.times do |i|

View File

@@ -695,15 +695,15 @@ class PokemonStorageScene
def pbSetArrow(arrow, selection)
case selection
when -1, -4, -5 # Box name, move left, move right
arrow.x = 157 * 2
arrow.y = -12 * 2
when -2 # Party Pokémon
arrow.x = 119 * 2
arrow.y = 139 * 2
when -3 # Close Box
arrow.x = 207 * 2
arrow.y = 139 * 2
when -1, -4, -5 # Box name, move left, move right
arrow.x = 314
arrow.y = -24
when -2 # Party Pokémon
arrow.x = 238
arrow.y = 278
when -3 # Close Box
arrow.x = 414
arrow.y = 278
else
arrow.x = (97 + (24 * (selection % PokemonBox::BOX_WIDTH))) * 2
arrow.y = (8 + (24 * (selection / PokemonBox::BOX_WIDTH))) * 2

View File

@@ -238,7 +238,7 @@ class PokemonMart_Scene
)
pbPrepareWindow(@sprites["itemtextwindow"])
@sprites["itemtextwindow"].baseColor = Color.new(248, 248, 248)
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
@sprites["itemtextwindow"].shadowColor = Color.black
@sprites["itemtextwindow"].windowskin = nil
@sprites["helpwindow"] = Window_AdvancedTextPokemon.new("")
pbPrepareWindow(@sprites["helpwindow"])

View File

@@ -69,7 +69,7 @@ class MoveRelearner_Scene
moveData = GameData::Move.get(moveobject)
type_number = GameData::Type.get(moveData.display_type(@pokemon)).icon_position
imagepos.push(["Graphics/Pictures/types", 12, yPos - 4, 0, type_number * 28, 64, 28])
textpos.push([moveData.name, 80, yPos, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([moveData.name, 80, yPos, 0, Color.new(248, 248, 248), Color.black])
textpos.push([_INTL("PP"), 112, yPos + 32, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)])
if moveData.total_pp > 0
textpos.push([_INTL("{1}/{1}", moveData.total_pp), 230, yPos + 32, 1,
@@ -87,11 +87,11 @@ class MoveRelearner_Scene
basedamage = selMoveData.display_damage(@pokemon)
category = selMoveData.display_category(@pokemon)
accuracy = selMoveData.display_accuracy(@pokemon)
textpos.push([_INTL("CATEGORY"), 272, 120, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([_INTL("POWER"), 272, 152, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([_INTL("CATEGORY"), 272, 120, 0, Color.new(248, 248, 248), Color.black])
textpos.push([_INTL("POWER"), 272, 152, 0, Color.new(248, 248, 248), Color.black])
textpos.push([basedamage <= 1 ? basedamage == 1 ? "???" : "---" : sprintf("%d", basedamage),
468, 152, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
textpos.push([_INTL("ACCURACY"), 272, 184, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)])
textpos.push([_INTL("ACCURACY"), 272, 184, 0, Color.new(248, 248, 248), Color.black])
textpos.push([accuracy == 0 ? "---" : "#{accuracy}%",
468, 184, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)])
pbDrawTextPositions(overlay, textpos)

View File

@@ -27,7 +27,7 @@ end
#===============================================================================
def pbDrawGauge(bitmap, rect, color, value, maxValue)
return if !bitmap
bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, Color.new(0, 0, 0))
bitmap.fill_rect(rect.x, rect.y, rect.width, rect.height, Color.black)
width = (maxValue <= 0) ? 0 : (rect.width - 4) * value / maxValue
if rect.width >= 4 && rect.height >= 4
bitmap.fill_rect(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4, Color.new(248, 248, 248))
@@ -713,7 +713,7 @@ class DirectFlowDiagram
def ensurePoint(j)
if !@points[j] || @points[j].disposed?
@points[j] = BitmapSprite.new(8, 8, @viewport)
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.new(0, 0, 0))
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.black)
end
@points[j].tone = (@strength == 2) ? Tone.new(232, 232, 248) : Tone.new(16, 16, 232)
@points[j].visible = (@strength != 0)
@@ -787,7 +787,7 @@ class FlowDiagram
def ensurePoint(j)
if !@points[j] || @points[j].disposed?
@points[j] = BitmapSprite.new(8, 8, @viewport)
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.new(0, 0, 0))
@points[j].bitmap.fill_rect(0, 0, 8, 8, Color.black)
end
@points[j].tone = (@strength == 2) ? Tone.new(232, 232, 248) : Tone.new(16, 16, 232)
@points[j].visible = (@strength != 0)
@@ -854,7 +854,7 @@ class PurifyChamberSetView < Sprite
@heldpkmn = nil
@cursor = -1
@view = BitmapSprite.new(64, 64, viewport)
@view.bitmap.fill_rect(8, 8, 48, 48, Color.new(255, 255, 255))
@view.bitmap.fill_rect(8, 8, 48, 48, Color.white)
@view.bitmap.fill_rect(10, 10, 44, 44, Color.new(255, 255, 255, 128))
@info = BitmapSprite.new(Graphics.width - 112, 48, viewport)
@flows = []

View File

@@ -125,21 +125,21 @@ class PokemonEntryScene
if meta
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x = 33 * 2
@sprites["shadow"].y = 32 * 2
@sprites["shadow"].x = 66
@sprites["shadow"].y = 64
filename = pbGetPlayerCharset(meta.walk_charset, nil, true)
@sprites["subject"] = TrainerWalkingCharSprite.new(filename, @viewport)
charwidth = @sprites["subject"].bitmap.width
charheight = @sprites["subject"].bitmap.height
@sprites["subject"].x = (44 * 2) - (charwidth / 8)
@sprites["subject"].y = (38 * 2) - (charheight / 4)
@sprites["subject"].x = 88 - (charwidth / 8)
@sprites["subject"].y = 76 - (charheight / 4)
end
when 2 # Pokémon
if pokemon
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x = 33 * 2
@sprites["shadow"].y = 32 * 2
@sprites["shadow"].x = 66
@sprites["shadow"].y = 64
@sprites["subject"] = PokemonIconSprite.new(pokemon, @viewport)
@sprites["subject"].setOffset(PictureOrigin::CENTER)
@sprites["subject"].x = 88
@@ -160,21 +160,21 @@ class PokemonEntryScene
when 3 # NPC
@sprites["shadow"] = IconSprite.new(0, 0, @viewport)
@sprites["shadow"].setBitmap("Graphics/Pictures/Naming/icon_shadow")
@sprites["shadow"].x = 33 * 2
@sprites["shadow"].y = 32 * 2
@sprites["shadow"].x = 66
@sprites["shadow"].y = 64
@sprites["subject"] = TrainerWalkingCharSprite.new(pokemon.to_s, @viewport)
charwidth = @sprites["subject"].bitmap.width
charheight = @sprites["subject"].bitmap.height
@sprites["subject"].x = (44 * 2) - (charwidth / 8)
@sprites["subject"].y = (38 * 2) - (charheight / 4)
@sprites["subject"].x = 88 - (charwidth / 8)
@sprites["subject"].y = 76 - (charheight / 4)
when 4 # Storage box
@sprites["subject"] = TrainerWalkingCharSprite.new(nil, @viewport)
@sprites["subject"].altcharset = "Graphics/Pictures/Naming/icon_storage"
@sprites["subject"].animspeed = 4
charwidth = @sprites["subject"].bitmap.width
charheight = @sprites["subject"].bitmap.height
@sprites["subject"].x = (44 * 2) - (charwidth / 8)
@sprites["subject"].y = (26 * 2) - (charheight / 2)
@sprites["subject"].x = 88 - (charwidth / 8)
@sprites["subject"].y = 52 - (charheight / 2)
end
pbFadeInAndShow(@sprites)
end

View File

@@ -159,17 +159,17 @@ class VoltorbFlip
pbSetSystemFont(@sprites["level"].bitmap)
@sprites["curtain"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["curtain"].z = 99999
@sprites["curtain"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0))
@sprites["curtain"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.black)
@sprites["curtain"].opacity = 0
@sprites["curtainL"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["curtainL"].z = 99999
@sprites["curtainL"].x = Graphics.width / 2
@sprites["curtainL"].angle = -90
@sprites["curtainL"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0))
@sprites["curtainL"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.black)
@sprites["curtainR"] = BitmapSprite.new(Graphics.width, Graphics.height * 2, @viewport)
@sprites["curtainR"].z = 99999
@sprites["curtainR"].x = Graphics.width / 2
@sprites["curtainR"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height * 2, Color.new(0, 0, 0))
@sprites["curtainR"].bitmap.fill_rect(0, 0, Graphics.width, Graphics.height * 2, Color.black)
@sprites["cursor"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@sprites["cursor"].z = 99998
@sprites["icon"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)

View File

@@ -531,7 +531,7 @@ class MiningGameScene
collapseFraction = (Graphics.height.to_f / collapseTime).ceil
(1..collapseTime).each do |i|
@sprites["collapse"].bitmap.fill_rect(0, collapseFraction * (i - 1),
Graphics.width, collapseFraction * i, Color.new(0, 0, 0))
Graphics.width, collapseFraction * i, Color.black)
Graphics.update
end
pbMessage(_INTL("The wall collapsed!"))

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)