mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 13:44:59 +00:00
Changed choice lists to allow text formatting
This commit is contained in:
@@ -1326,15 +1326,28 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
windowheight += self.borderY
|
windowheight += self.borderY
|
||||||
if !width || width < 0
|
if !width || width < 0
|
||||||
width = 0
|
width = 0
|
||||||
tmpbitmap = Bitmap.new(1, 1)
|
tmp_bitmap = Bitmap.new(1, 1)
|
||||||
pbSetSystemFont(tmpbitmap)
|
pbSetSystemFont(tmp_bitmap)
|
||||||
commands.each do |i|
|
commands.each do |cmd|
|
||||||
txt = toUnformattedText(i).gsub(/\n/, "")
|
txt = toUnformattedText(cmd).gsub(/\n/, "")
|
||||||
width = [width, tmpbitmap.text_size(txt).width].max
|
txt_width = tmp_bitmap.text_size(txt).width
|
||||||
|
check_text = cmd
|
||||||
|
while check_text[FORMATREGEXP]
|
||||||
|
if $~[2].downcase == "icon" && $~[3]
|
||||||
|
check_text = $~.post_match
|
||||||
|
filename = $~[4].sub(/\s+$/, "")
|
||||||
|
temp_graphic = Bitmap.new("Graphics/Icons/#{filename}")
|
||||||
|
txt_width += temp_graphic.width
|
||||||
|
temp_graphic.dispose
|
||||||
|
else
|
||||||
|
check_text = $~.post_match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
width = [width, txt_width].max
|
||||||
end
|
end
|
||||||
# one 16 to allow cursor
|
# one 16 to allow cursor
|
||||||
width += 16 + 16 + SpriteWindow_Base::TEXT_PADDING
|
width += 16 + 16 + SpriteWindow_Base::TEXT_PADDING
|
||||||
tmpbitmap.dispose
|
tmp_bitmap.dispose
|
||||||
end
|
end
|
||||||
# Store suggested width and height of window
|
# Store suggested width and height of window
|
||||||
dims[0] = [self.borderX + 1,
|
dims[0] = [self.borderX + 1,
|
||||||
@@ -1347,7 +1360,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
dims = []
|
dims = []
|
||||||
getAutoDims(commands, dims, width)
|
getAutoDims(commands, dims, width)
|
||||||
self.width = dims[0]
|
self.width = dims[0]
|
||||||
self.height = dims[1] - 6
|
self.height = dims[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def itemCount
|
def itemCount
|
||||||
@@ -1363,7 +1376,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
|||||||
rect.width, rect.height, @commands[index], self.baseColor, self.shadowColor)
|
rect.width, rect.height, @commands[index], self.baseColor, self.shadowColor)
|
||||||
else
|
else
|
||||||
chars = getFormattedText(self.contents, rect.x, rect.y + (self.contents.text_offset_y || 0) + 2, # TEXT OFFSET
|
chars = getFormattedText(self.contents, rect.x, rect.y + (self.contents.text_offset_y || 0) + 2, # TEXT OFFSET
|
||||||
rect.width, rect.height, @commands[index], rect.height, true, true)
|
rect.width, rect.height, @commands[index], rect.height, true, true, false, self)
|
||||||
drawFormattedChars(self.contents, chars)
|
drawFormattedChars(self.contents, chars)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ def fmtReplaceEscapes(text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def toUnformattedText(text)
|
def toUnformattedText(text)
|
||||||
text2 = text.gsub(FORMATREGEXP, "")
|
text2 = text.clone
|
||||||
|
pbReplaceMessageText(text2, nil)
|
||||||
|
text2 = text2.gsub(FORMATREGEXP, "")
|
||||||
fmtReplaceEscapes(text2)
|
fmtReplaceEscapes(text2)
|
||||||
return text2
|
return text2
|
||||||
end
|
end
|
||||||
@@ -314,7 +316,7 @@ end
|
|||||||
#===============================================================================
|
#===============================================================================
|
||||||
def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = 32,
|
def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight = 32,
|
||||||
newlineBreaks = true, explicitBreaksOnly = false,
|
newlineBreaks = true, explicitBreaksOnly = false,
|
||||||
collapseAlignments = false)
|
collapseAlignments = false, msg_window = nil)
|
||||||
dummybitmap = nil
|
dummybitmap = nil
|
||||||
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
if !bitmap || bitmap.disposed? # allows function to be called with nil bitmap
|
||||||
dummybitmap = Bitmap.new(1, 1)
|
dummybitmap = Bitmap.new(1, 1)
|
||||||
@@ -327,6 +329,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
|||||||
textchunks = []
|
textchunks = []
|
||||||
controls = []
|
controls = []
|
||||||
# oldtext = text
|
# oldtext = text
|
||||||
|
pbReplaceMessageText(text, msg_window)
|
||||||
while text[FORMATREGEXP]
|
while text[FORMATREGEXP]
|
||||||
textchunks.push($~.pre_match)
|
textchunks.push($~.pre_match)
|
||||||
if $~[3]
|
if $~[3]
|
||||||
@@ -376,7 +379,11 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
|||||||
fontsize = defaultfontsize
|
fontsize = defaultfontsize
|
||||||
fontnamestack = []
|
fontnamestack = []
|
||||||
fontsizestack = []
|
fontsizestack = []
|
||||||
|
if msg_window
|
||||||
|
defaultcolors = [msg_window.baseColor, msg_window.shadowColor]
|
||||||
|
else
|
||||||
defaultcolors = [oldfont.color.clone, nil]
|
defaultcolors = [oldfont.color.clone, nil]
|
||||||
|
end
|
||||||
if defaultfontname.is_a?(Array)
|
if defaultfontname.is_a?(Array)
|
||||||
defaultfontname = defaultfontname.find { |i| Font.exist?(i) } || "Arial"
|
defaultfontname = defaultfontname.find { |i| Font.exist?(i) } || "Arial"
|
||||||
elsif !Font.exist?(defaultfontname)
|
elsif !Font.exist?(defaultfontname)
|
||||||
@@ -917,17 +924,18 @@ def drawSingleFormattedChar(bitmap, ch)
|
|||||||
if ch[5] # If a graphic
|
if ch[5] # If a graphic
|
||||||
graphic = Bitmap.new(ch[0])
|
graphic = Bitmap.new(ch[0])
|
||||||
graphicRect = ch[15]
|
graphicRect = ch[15]
|
||||||
bitmap.blt(ch[1], ch[2], graphic, graphicRect, ch[8].alpha)
|
bitmap.blt(ch[1], ch[2] - (bitmap.text_offset_y || 0), graphic, graphicRect, ch[8].alpha)
|
||||||
graphic.dispose
|
graphic.dispose
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
bitmap.font.size = ch[13] if bitmap.font.size != ch[13]
|
bitmap.font.size = ch[13] if bitmap.font.size != ch[13]
|
||||||
if ch[9] # shadow
|
if ch[9] # shadow
|
||||||
if ch[10] # underline
|
if ch[10] # underline
|
||||||
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2, ch[3], 4, ch[9])
|
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2 - (bitmap.text_offset_y || 0),
|
||||||
|
ch[3], 4, ch[9])
|
||||||
end
|
end
|
||||||
if ch[11] # strikeout
|
if ch[11] # strikeout
|
||||||
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3], 4, ch[9])
|
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2) - (bitmap.text_offset_y || 0), ch[3], 4, ch[9])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ch[0] == "\n" || ch[0] == "\r" || ch[0] == " " || isWaitChar(ch[0])
|
if ch[0] == "\n" || ch[0] == "\r" || ch[0] == " " || isWaitChar(ch[0])
|
||||||
@@ -969,10 +977,11 @@ def drawSingleFormattedChar(bitmap, ch)
|
|||||||
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
|
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
|
||||||
end
|
end
|
||||||
if ch[10] # underline
|
if ch[10] # underline
|
||||||
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2, ch[3] - 2, 2, ch[8])
|
bitmap.fill_rect(ch[1], ch[2] + ch[4] - [(ch[4] - bitmap.font.size) / 2, 0].max - 2 - (bitmap.text_offset_y || 0),
|
||||||
|
ch[3] - 2, 2, ch[8])
|
||||||
end
|
end
|
||||||
if ch[11] # strikeout
|
if ch[11] # strikeout
|
||||||
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2), ch[3] - 2, 2, ch[8])
|
bitmap.fill_rect(ch[1], ch[2] + 2 + (ch[4] / 2) - (bitmap.text_offset_y || 0), ch[3] - 2, 2, ch[8])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -336,9 +336,9 @@ def pbReplaceMessageText(text, msg_window)
|
|||||||
text.gsub!(/\\r/i, female_text_tag)
|
text.gsub!(/\\r/i, female_text_tag)
|
||||||
# Other text colors
|
# Other text colors
|
||||||
text.gsub!(/\\\[([0-9a-f]{8,8})\]/i) { "<c2=" + $1 + ">" }
|
text.gsub!(/\\\[([0-9a-f]{8,8})\]/i) { "<c2=" + $1 + ">" }
|
||||||
isDarkSkin = isDarkWindowskin(msg_window.windowskin)
|
isDarkSkin = msg_window && isDarkWindowskin(msg_window.windowskin)
|
||||||
text.gsub!(/\\c\[([0-9]+)\]/i) do
|
text.gsub!(/\\c\[([0-9]+)\]/i) do
|
||||||
main_color, shadow_color = get_text_colors_for_windowskin(msg_window.windowskin, $1.to_i, isDarkSkin)
|
main_color, shadow_color = get_text_colors_for_windowskin(msg_window&.windowskin, $1.to_i, isDarkSkin)
|
||||||
next shadowc3tag(main_color, shadow_color)
|
next shadowc3tag(main_color, shadow_color)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -732,7 +732,7 @@ end
|
|||||||
|
|
||||||
def pbShowCommands(msgwindow, commands = nil, cmdIfCancel = 0, defaultCmd = 0)
|
def pbShowCommands(msgwindow, commands = nil, cmdIfCancel = 0, defaultCmd = 0)
|
||||||
return 0 if !commands
|
return 0 if !commands
|
||||||
cmdwindow = Window_CommandPokemonEx.new(commands)
|
cmdwindow = Window_AdvancedCommandPokemon.new(commands)
|
||||||
cmdwindow.z = 99999
|
cmdwindow.z = 99999
|
||||||
cmdwindow.visible = true
|
cmdwindow.visible = true
|
||||||
cmdwindow.resizeToFit(cmdwindow.commands)
|
cmdwindow.resizeToFit(cmdwindow.commands)
|
||||||
@@ -772,7 +772,7 @@ def pbShowCommandsWithHelp(msgwindow, commands, help, cmdIfCancel = 0, defaultCm
|
|||||||
oldlbl = msgwin.letterbyletter
|
oldlbl = msgwin.letterbyletter
|
||||||
msgwin.letterbyletter = false
|
msgwin.letterbyletter = false
|
||||||
if commands
|
if commands
|
||||||
cmdwindow = Window_CommandPokemonEx.new(commands)
|
cmdwindow = Window_AdvancedCommandPokemon.new(commands)
|
||||||
cmdwindow.z = 99999
|
cmdwindow.z = 99999
|
||||||
cmdwindow.visible = true
|
cmdwindow.visible = true
|
||||||
cmdwindow.resizeToFit(cmdwindow.commands)
|
cmdwindow.resizeToFit(cmdwindow.commands)
|
||||||
|
|||||||
@@ -893,5 +893,5 @@ MultipleForms.register(:QUILAVA, {
|
|||||||
MultipleForms.copy(:QUILAVA,
|
MultipleForms.copy(:QUILAVA,
|
||||||
:DEWOTT, :PETILILL, :RUFFLET, :GOOMY, :BERGMITE, :DARTRIX)
|
:DEWOTT, :PETILILL, :RUFFLET, :GOOMY, :BERGMITE, :DARTRIX)
|
||||||
|
|
||||||
# Paldean forms
|
# Paldean forms.
|
||||||
# None!
|
# None!
|
||||||
|
|||||||
Reference in New Issue
Block a user