mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
Tidied up usage of colour tags (everything uses c3 now via def shadowc3tag), moved gender text colours to MessageConfig
This commit is contained in:
@@ -2,26 +2,30 @@
|
||||
#
|
||||
#===============================================================================
|
||||
module MessageConfig
|
||||
LIGHT_TEXT_MAIN_COLOR = Color.new(248, 248, 248)
|
||||
LIGHT_TEXT_SHADOW_COLOR = Color.new(72, 80, 88)
|
||||
DARK_TEXT_MAIN_COLOR = Color.new(80, 80, 88)
|
||||
DARK_TEXT_SHADOW_COLOR = Color.new(160, 160, 168)
|
||||
FONT_NAME = "Power Green"
|
||||
FONT_SIZE = 27
|
||||
FONT_Y_OFFSET = 8
|
||||
SMALL_FONT_NAME = "Power Green Small"
|
||||
SMALL_FONT_SIZE = 21
|
||||
SMALL_FONT_Y_OFFSET = 8
|
||||
NARROW_FONT_NAME = "Power Green Narrow"
|
||||
NARROW_FONT_SIZE = 27
|
||||
NARROW_FONT_Y_OFFSET = 8
|
||||
LIGHT_TEXT_MAIN_COLOR = Color.new(248, 248, 248)
|
||||
LIGHT_TEXT_SHADOW_COLOR = Color.new(72, 80, 88)
|
||||
DARK_TEXT_MAIN_COLOR = Color.new(80, 80, 88)
|
||||
DARK_TEXT_SHADOW_COLOR = Color.new(160, 160, 168)
|
||||
MALE_TEXT_MAIN_COLOR = Color.new(48, 80, 200) # Used by message tag "\b"
|
||||
MALE_TEXT_SHADOW_COLOR = Color.new(208, 208, 200)
|
||||
FEMALE_TEXT_MAIN_COLOR = Color.new(224, 8, 8) # Used by message tag "\r"
|
||||
FEMALE_TEXT_SHADOW_COLOR = Color.new(208, 208, 200)
|
||||
FONT_NAME = "Power Green"
|
||||
FONT_SIZE = 27
|
||||
FONT_Y_OFFSET = 8
|
||||
SMALL_FONT_NAME = "Power Green Small"
|
||||
SMALL_FONT_SIZE = 21
|
||||
SMALL_FONT_Y_OFFSET = 8
|
||||
NARROW_FONT_NAME = "Power Green Narrow"
|
||||
NARROW_FONT_SIZE = 27
|
||||
NARROW_FONT_Y_OFFSET = 8
|
||||
# 0 = Pause cursor is displayed at end of text
|
||||
# 1 = Pause cursor is displayed at bottom right
|
||||
# 2 = Pause cursor is displayed at lower middle side
|
||||
CURSOR_POSITION = 1
|
||||
WINDOW_OPACITY = 255
|
||||
TEXT_SPEED = nil # can be positive to wait frames or negative to
|
||||
# show multiple characters in a single frame
|
||||
CURSOR_POSITION = 1
|
||||
WINDOW_OPACITY = 255
|
||||
TEXT_SPEED = nil # can be positive to wait frames, or negative
|
||||
# to show multiple characters in a single frame
|
||||
@@systemFrame = nil
|
||||
@@defaultTextSkin = nil
|
||||
@@textSpeed = nil
|
||||
@@ -328,21 +332,22 @@ def getSkinColor(windowskin, color, isDarkSkin)
|
||||
if !windowskin || windowskin.disposed? ||
|
||||
windowskin.width != 128 || windowskin.height != 128
|
||||
# Base color, shadow color (these are reversed on dark windowskins)
|
||||
# Values in arrays are RGB numbers
|
||||
textcolors = [
|
||||
"0070F8", "78B8E8", # 1 Blue
|
||||
"E82010", "F8A8B8", # 2 Red
|
||||
"60B048", "B0D090", # 3 Green
|
||||
"48D8D8", "A8E0E0", # 4 Cyan
|
||||
"D038B8", "E8A0E0", # 5 Magenta
|
||||
"E8D020", "F8E888", # 6 Yellow
|
||||
"A0A0A8", "D0D0D8", # 7 Grey
|
||||
"F0F0F8", "C8C8D0", # 8 White
|
||||
"9040E8", "B8A8E0", # 9 Purple
|
||||
"F89818", "F8C898", # 10 Orange
|
||||
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
|
||||
[ 0, 112, 248], [120, 184, 232], # 1 Blue
|
||||
[232, 32, 16], [248, 168, 184], # 2 Red
|
||||
[ 96, 176, 72], [174, 208, 144], # 3 Green
|
||||
[ 72, 216, 216], [168, 224, 224], # 4 Cyan
|
||||
[208, 56, 184], [232, 160, 224], # 5 Magenta
|
||||
[232, 208, 32], [248, 232, 136], # 6 Yellow
|
||||
[160, 160, 168], [208, 208, 216], # 7 Gray
|
||||
[240, 240, 248], [200, 200, 208], # 8 White
|
||||
[114, 64, 232], [184, 168, 224], # 9 Purple
|
||||
[248, 152, 24], [248, 200, 152], # 10 Orange
|
||||
MessageConfig::DARK_TEXT_MAIN_COLOR,
|
||||
MessageConfig::DARK_TEXT_SHADOW_COLOR, # 11 Dark default
|
||||
MessageConfig::LIGHT_TEXT_MAIN_COLOR,
|
||||
MessageConfig::LIGHT_TEXT_SHADOW_COLOR # 12 Light default
|
||||
]
|
||||
if color == 0 || color > textcolors.length / 2 # No special colour, use default
|
||||
if isDarkSkin # Dark background, light text
|
||||
@@ -353,10 +358,10 @@ def getSkinColor(windowskin, color, isDarkSkin)
|
||||
end
|
||||
# Special colour as listed above
|
||||
if isDarkSkin && color != 12 # Dark background, light text
|
||||
return sprintf("<c3=%s,%s>", textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)])
|
||||
return shadowc3tag(textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)])
|
||||
end
|
||||
# Light background, dark text
|
||||
return sprintf("<c3=%s,%s>", textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1])
|
||||
return shadowc3tag(textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1])
|
||||
else # VX windowskin
|
||||
color = 0 if color >= 32
|
||||
x = 64 + ((color % 8) * 8)
|
||||
|
||||
@@ -307,7 +307,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
@fmtchars = []
|
||||
fmt = getFormattedText(self.contents, 0, 0,
|
||||
self.width - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1,
|
||||
shadowctag(@baseColor, @shadowColor) + value, 32, true)
|
||||
shadowc3tag(@baseColor, @shadowColor) + value, 32, true)
|
||||
@oldfont = self.contents.font.clone
|
||||
fmt.each do |ch|
|
||||
chx = ch[1] + ch[3]
|
||||
@@ -334,7 +334,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
else
|
||||
@fmtchars = getFormattedText(self.contents, 0, 0,
|
||||
self.width - self.borderX - SpriteWindow_Base::TEXT_PADDING, -1,
|
||||
shadowctag(@baseColor, @shadowColor) + value, 32, true)
|
||||
shadowc3tag(@baseColor, @shadowColor) + value, 32, true)
|
||||
@oldfont = self.contents.font.clone
|
||||
@fmtchars.each do |ch|
|
||||
chx = ch[1] + ch[3]
|
||||
|
||||
@@ -1,25 +1,40 @@
|
||||
#===============================================================================
|
||||
# Text colors
|
||||
#===============================================================================
|
||||
# TODO: Unused.
|
||||
# Unused
|
||||
def ctag(color)
|
||||
return sprintf("<c=%s>", color.to_rgb32(true))
|
||||
end
|
||||
|
||||
# Unused
|
||||
def shadowctag(base, shadow)
|
||||
return sprintf("<c2=%s%s>", base.to_rgb15, shadow.to_rgb15)
|
||||
end
|
||||
|
||||
# base and shadow are either instances of class Color, or are arrays containing
|
||||
# 3 or 4 integers which are RGB(A) values.
|
||||
def shadowc3tag(base, shadow)
|
||||
return sprintf("<c3=%s,%s>", base.to_rgb32, shadow.to_rgb32)
|
||||
if base.is_a?(Color)
|
||||
base_text = base.to_rgb32
|
||||
else
|
||||
base_text = sprintf("%02X%02X%02X", base[0], base[1], base[2])
|
||||
base_text += sprintf("02X", base[3]) if base[3]
|
||||
end
|
||||
if shadow.is_a?(Color)
|
||||
shadow_text = shadow.to_rgb32
|
||||
else
|
||||
shadow_text = sprintf("%02X%02X%02X", shadow[0], shadow[1], shadow[2])
|
||||
shadow_text += sprintf("02X", shadow[3]) if shadow[3]
|
||||
end
|
||||
return sprintf("<c3=%s,%s>", base_text, shadow_text)
|
||||
end
|
||||
|
||||
# TODO: Unused.
|
||||
# Unused
|
||||
def shadowctagFromColor(color)
|
||||
return shadowc3tag(color, color.get_contrast_color)
|
||||
end
|
||||
|
||||
# TODO: Unused.
|
||||
# Unused
|
||||
def shadowctagFromRgb(param)
|
||||
return shadowctagFromColor(Color.new_from_rgb(param))
|
||||
end
|
||||
@@ -1022,7 +1037,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 = shadowctag(base, shadow) + text
|
||||
text = shadowc3tag(base, shadow) + text
|
||||
chars = getFormattedText(bitmap, x, y, width, -1, text, lineheight)
|
||||
drawFormattedChars(bitmap, chars)
|
||||
end
|
||||
|
||||
@@ -442,8 +442,10 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
text.gsub!(/\\pog/i, "\\b") if $player&.female?
|
||||
text.gsub!(/\\pg/i, "")
|
||||
text.gsub!(/\\pog/i, "")
|
||||
text.gsub!(/\\b/i, "<c3=3050C8,D0D0C8>")
|
||||
text.gsub!(/\\r/i, "<c3=E00808,D0D0C8>")
|
||||
male_text_tag = shadowc3tag(MessageConfig::MALE_TEXT_MAIN_COLOR, MessageConfig::MALE_TEXT_SHADOW_COLOR)
|
||||
female_text_tag = shadowc3tag(MessageConfig::FEMALE_TEXT_MAIN_COLOR, MessageConfig::FEMALE_TEXT_SHADOW_COLOR)
|
||||
text.gsub!(/\\b/i, male_text_tag)
|
||||
text.gsub!(/\\r/i, female_text_tag)
|
||||
text.gsub!(/\\[Ww]\[([^\]]*)\]/) do
|
||||
w = $1.to_s
|
||||
if w == ""
|
||||
|
||||
Reference in New Issue
Block a user