mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Fixed replacement battler being invisible if its predecessor fainted and used the same sprite, refactoring
This commit is contained in:
@@ -330,58 +330,52 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Determine which text colours to use based on the darkness of the background
|
# Determine which text colours to use based on the darkness of the background
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
def getSkinColor(windowskin, color, isDarkSkin)
|
def get_text_colors_for_windowskin(windowskin, color, isDarkSkin)
|
||||||
if !windowskin || windowskin.disposed? ||
|
# VX windowskin
|
||||||
windowskin.width != 128 || windowskin.height != 128
|
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 = [
|
|
||||||
[ 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
|
|
||||||
return shadowc3tag(MessageConfig::LIGHT_TEXT_MAIN_COLOR, MessageConfig::LIGHT_TEXT_SHADOW_COLOR)
|
|
||||||
end
|
|
||||||
# Light background, dark text
|
|
||||||
return shadowc3tag(MessageConfig::DARK_TEXT_MAIN_COLOR, MessageConfig::DARK_TEXT_SHADOW_COLOR)
|
|
||||||
end
|
|
||||||
# Special colour as listed above
|
|
||||||
if isDarkSkin && color != 12 # Dark background, light text
|
|
||||||
return shadowc3tag(textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)])
|
|
||||||
end
|
|
||||||
# Light background, dark text
|
|
||||||
return shadowc3tag(textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1])
|
|
||||||
else # VX windowskin
|
|
||||||
color = 0 if color >= 32
|
color = 0 if color >= 32
|
||||||
x = 64 + ((color % 8) * 8)
|
x = 64 + ((color % 8) * 8)
|
||||||
y = 96 + ((color / 8) * 8)
|
y = 96 + ((color / 8) * 8)
|
||||||
pixel = windowskin.get_pixel(x, y)
|
pixel = windowskin.get_pixel(x, y)
|
||||||
return shadowc3tag(pixel, pixel.get_contrast_color)
|
return pixel, pixel.get_contrast_color
|
||||||
end
|
end
|
||||||
|
# No windowskin or not a VX windowskin
|
||||||
|
# Base color, shadow color (these are reversed on dark windowskins)
|
||||||
|
# Values in arrays are RGB numbers
|
||||||
|
textcolors = [
|
||||||
|
[ 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
|
||||||
|
return MessageConfig::LIGHT_TEXT_MAIN_COLOR, MessageConfig::LIGHT_TEXT_SHADOW_COLOR
|
||||||
|
end
|
||||||
|
# Light background, dark text
|
||||||
|
return MessageConfig::DARK_TEXT_MAIN_COLOR, MessageConfig::DARK_TEXT_SHADOW_COLOR
|
||||||
|
end
|
||||||
|
# Special colour as listed above
|
||||||
|
if isDarkSkin && color != 12 # Dark background, light text
|
||||||
|
return Color.new(*textcolors[(2 * (color - 1)) + 1]), Color.new(*textcolors[2 * (color - 1)])
|
||||||
|
end
|
||||||
|
# Light background, dark text
|
||||||
|
return Color.new(*textcolors[2 * (color - 1)]), Color.new(*textcolors[(2 * (color - 1)) + 1])
|
||||||
end
|
end
|
||||||
|
|
||||||
def getDefaultTextColors(windowskin)
|
def getDefaultTextColors(windowskin)
|
||||||
if !windowskin || windowskin.disposed? ||
|
# VX windowskin
|
||||||
windowskin.width != 128 || windowskin.height != 128
|
if windowskin && !windowskin.disposed? && windowskin.width == 128 && windowskin.height == 128
|
||||||
if isDarkWindowskin(windowskin)
|
|
||||||
return [MessageConfig::LIGHT_TEXT_MAIN_COLOR, MessageConfig::LIGHT_TEXT_SHADOW_COLOR] # White
|
|
||||||
else
|
|
||||||
return [MessageConfig::DARK_TEXT_MAIN_COLOR, MessageConfig::DARK_TEXT_SHADOW_COLOR] # Dark gray
|
|
||||||
end
|
|
||||||
else # VX windowskin
|
|
||||||
color = windowskin.get_pixel(64, 96)
|
color = windowskin.get_pixel(64, 96)
|
||||||
shadow = nil
|
shadow = nil
|
||||||
isDark = (color.red + color.green + color.blue) / 3 < 128
|
isDark = (color.red + color.green + color.blue) / 3 < 128
|
||||||
@@ -390,8 +384,13 @@ def getDefaultTextColors(windowskin)
|
|||||||
else
|
else
|
||||||
shadow = Color.new(color.red - 64, color.green - 64, color.blue - 64)
|
shadow = Color.new(color.red - 64, color.green - 64, color.blue - 64)
|
||||||
end
|
end
|
||||||
return [color, shadow]
|
return color, shadow
|
||||||
end
|
end
|
||||||
|
# No windowskin or not a VX windowskin
|
||||||
|
if isDarkWindowskin(windowskin)
|
||||||
|
return MessageConfig::LIGHT_TEXT_MAIN_COLOR, MessageConfig::LIGHT_TEXT_SHADOW_COLOR # White
|
||||||
|
end
|
||||||
|
return MessageConfig::DARK_TEXT_MAIN_COLOR, MessageConfig::DARK_TEXT_SHADOW_COLOR # Dark gray
|
||||||
end
|
end
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|||||||
@@ -30,9 +30,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
|||||||
pbSetSystemFont(self.contents)
|
pbSetSystemFont(self.contents)
|
||||||
@text = text
|
@text = text
|
||||||
@letterbyletter = false # Not supported in this class
|
@letterbyletter = false # Not supported in this class
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
resizeToFit(text)
|
resizeToFit(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -88,9 +86,7 @@ class Window_UnformattedTextPokemon < SpriteWindow_Base
|
|||||||
oldshadowg = @shadowColor.green
|
oldshadowg = @shadowColor.green
|
||||||
oldshadowb = @shadowColor.blue
|
oldshadowb = @shadowColor.blue
|
||||||
oldshadowa = @shadowColor.alpha
|
oldshadowa = @shadowColor.alpha
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
if oldbaser != @baseColor.red || oldbaseg != @baseColor.green ||
|
if oldbaser != @baseColor.red || oldbaseg != @baseColor.green ||
|
||||||
oldbaseb != @baseColor.blue || oldbasea != @baseColor.alpha ||
|
oldbaseb != @baseColor.blue || oldbasea != @baseColor.alpha ||
|
||||||
oldshadowr != @shadowColor.red || oldshadowg != @shadowColor.green ||
|
oldshadowr != @shadowColor.red || oldshadowg != @shadowColor.green ||
|
||||||
@@ -142,9 +138,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
self.contents = Bitmap.new(1, 1)
|
self.contents = Bitmap.new(1, 1)
|
||||||
pbSetSystemFont(self.contents)
|
pbSetSystemFont(self.contents)
|
||||||
self.resizeToFit(text, Graphics.width)
|
self.resizeToFit(text, Graphics.width)
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
self.text = text
|
self.text = text
|
||||||
@starting = false
|
@starting = false
|
||||||
end
|
end
|
||||||
@@ -266,9 +260,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
|||||||
oldshadowg = @shadowColor.green
|
oldshadowg = @shadowColor.green
|
||||||
oldshadowb = @shadowColor.blue
|
oldshadowb = @shadowColor.blue
|
||||||
oldshadowa = @shadowColor.alpha
|
oldshadowa = @shadowColor.alpha
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
if redrawText &&
|
if redrawText &&
|
||||||
(oldbaser != @baseColor.red || oldbaseg != @baseColor.green ||
|
(oldbaser != @baseColor.red || oldbaseg != @baseColor.green ||
|
||||||
oldbaseb != @baseColor.blue || oldbasea != @baseColor.alpha ||
|
oldbaseb != @baseColor.blue || oldbasea != @baseColor.alpha ||
|
||||||
@@ -634,9 +626,7 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
|||||||
super(0, 0, 32, 32)
|
super(0, 0, 32, 32)
|
||||||
self.width = (digits_max * 24) + 8 + self.borderX
|
self.width = (digits_max * 24) + 8 + self.borderX
|
||||||
self.height = 32 + self.borderY
|
self.height = 32 + self.borderY
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
@index = digits_max - 1
|
@index = digits_max - 1
|
||||||
self.active = true
|
self.active = true
|
||||||
refresh
|
refresh
|
||||||
@@ -1068,9 +1058,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
|||||||
RPG::Cache.retain("Graphics/UI/sel_arrow")
|
RPG::Cache.retain("Graphics/UI/sel_arrow")
|
||||||
end
|
end
|
||||||
@index = 0
|
@index = 0
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1118,9 +1106,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
|||||||
def setSkin(skin)
|
def setSkin(skin)
|
||||||
super(skin)
|
super(skin)
|
||||||
privRefresh(true)
|
privRefresh(true)
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def drawCursor(index, rect)
|
def drawCursor(index, rect)
|
||||||
@@ -1173,9 +1159,7 @@ class Window_CommandPokemon < Window_DrawableCommand
|
|||||||
self.height = dims[1]
|
self.height = dims[1]
|
||||||
@commands = commands
|
@commands = commands
|
||||||
self.active = true
|
self.active = true
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
self.baseColor = colors[0]
|
|
||||||
self.shadowColor = colors[1]
|
|
||||||
refresh
|
refresh
|
||||||
@starting = false
|
@starting = false
|
||||||
end
|
end
|
||||||
@@ -1282,9 +1266,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
self.height = dims[1]
|
self.height = dims[1]
|
||||||
@commands = commands
|
@commands = commands
|
||||||
self.active = true
|
self.active = true
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
self.baseColor = colors[0]
|
|
||||||
self.shadowColor = colors[1]
|
|
||||||
refresh
|
refresh
|
||||||
@starting = false
|
@starting = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -452,7 +452,8 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
|||||||
end
|
end
|
||||||
isDarkSkin = isDarkWindowskin(msgwindow.windowskin)
|
isDarkSkin = isDarkWindowskin(msgwindow.windowskin)
|
||||||
text.gsub!(/\\c\[([0-9]+)\]/i) do
|
text.gsub!(/\\c\[([0-9]+)\]/i) do
|
||||||
next getSkinColor(msgwindow.windowskin, $1.to_i, isDarkSkin)
|
main_color, shadow_color = get_text_colors_for_windowskin(msgwindow.windowskin, $1.to_i, isDarkSkin)
|
||||||
|
next shadowc3tag(main_color, shadow_color)
|
||||||
end
|
end
|
||||||
loop do
|
loop do
|
||||||
last_text = text.clone
|
last_text = text.clone
|
||||||
@@ -469,9 +470,11 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
|||||||
end
|
end
|
||||||
colortag = ""
|
colortag = ""
|
||||||
if $game_system && $game_system.message_frame != 0
|
if $game_system && $game_system.message_frame != 0
|
||||||
colortag = getSkinColor(msgwindow.windowskin, 0, true)
|
main_color, shadow_color = get_text_colors_for_windowskin(msgwindow.windowskin, 0, true)
|
||||||
|
colortag = shadowc3tag(main_color, shadow_color)
|
||||||
else
|
else
|
||||||
colortag = getSkinColor(msgwindow.windowskin, 0, isDarkSkin)
|
main_color, shadow_color = get_text_colors_for_windowskin(msgwindow.windowskin, 0, isDarkSkin)
|
||||||
|
colortag = shadowc3tag(main_color, shadow_color)
|
||||||
end
|
end
|
||||||
text = colortag + text
|
text = colortag + text
|
||||||
### Controls
|
### Controls
|
||||||
|
|||||||
@@ -85,9 +85,7 @@ end
|
|||||||
class Window_TextEntry < SpriteWindow_Base
|
class Window_TextEntry < SpriteWindow_Base
|
||||||
def initialize(text, x, y, width, height, heading = nil, usedarkercolor = false)
|
def initialize(text, x, y, width, height, heading = nil, usedarkercolor = false)
|
||||||
super(x, y, width, height)
|
super(x, y, width, height)
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
if usedarkercolor
|
if usedarkercolor
|
||||||
@baseColor = Color.new(16, 24, 32)
|
@baseColor = Color.new(16, 24, 32)
|
||||||
@shadowColor = Color.new(168, 184, 184)
|
@shadowColor = Color.new(168, 184, 184)
|
||||||
@@ -264,9 +262,7 @@ end
|
|||||||
class Window_MultilineTextEntry < SpriteWindow_Base
|
class Window_MultilineTextEntry < SpriteWindow_Base
|
||||||
def initialize(text, x, y, width, height)
|
def initialize(text, x, y, width, height)
|
||||||
super(x, y, width, height)
|
super(x, y, width, height)
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
@baseColor, @shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
@baseColor = colors[0]
|
|
||||||
@shadowColor = colors[1]
|
|
||||||
@helper = CharacterEntryHelper.new(text)
|
@helper = CharacterEntryHelper.new(text)
|
||||||
@firstline = 0
|
@firstline = 0
|
||||||
@cursorLine = 0
|
@cursorLine = 0
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ class Battle::Scene
|
|||||||
#=============================================================================
|
#=============================================================================
|
||||||
def pbFaintBattler(battler)
|
def pbFaintBattler(battler)
|
||||||
@briefMessage = false
|
@briefMessage = false
|
||||||
|
old_height = @sprites["pokemon_#{battler.index}"].src_rect.height
|
||||||
# Pokémon plays cry and drops down, data box disappears
|
# Pokémon plays cry and drops down, data box disappears
|
||||||
faintAnim = Animation::BattlerFaint.new(@sprites, @viewport, battler.index, @battle)
|
faintAnim = Animation::BattlerFaint.new(@sprites, @viewport, battler.index, @battle)
|
||||||
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, battler.index)
|
dataBoxAnim = Animation::DataBoxDisappear.new(@sprites, @viewport, battler.index)
|
||||||
@@ -323,6 +324,7 @@ class Battle::Scene
|
|||||||
end
|
end
|
||||||
faintAnim.dispose
|
faintAnim.dispose
|
||||||
dataBoxAnim.dispose
|
dataBoxAnim.dispose
|
||||||
|
@sprites["pokemon_#{battler.index}"].src_rect.height = old_height
|
||||||
end
|
end
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ class Window_CharacterEntry < Window_DrawableCommand
|
|||||||
@charset = charset
|
@charset = charset
|
||||||
@othercharset = ""
|
@othercharset = ""
|
||||||
super(0, 96, 480, 192)
|
super(0, 96, 480, 192)
|
||||||
colors = getDefaultTextColors(self.windowskin)
|
self.baseColor, self.shadowColor = getDefaultTextColors(self.windowskin)
|
||||||
self.baseColor = colors[0]
|
|
||||||
self.shadowColor = colors[1]
|
|
||||||
self.columns = XSIZE
|
self.columns = XSIZE
|
||||||
refresh
|
refresh
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user