mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
More Rubocopping
This commit is contained in:
@@ -144,13 +144,13 @@ module MessageConfig
|
||||
end
|
||||
|
||||
def self.pbTryFonts(*args)
|
||||
for a in args
|
||||
args.each do |a|
|
||||
next if !a
|
||||
case a
|
||||
when String
|
||||
return a if Font.exist?(a)
|
||||
when Array
|
||||
for aa in a
|
||||
a.each do |aa|
|
||||
ret = MessageConfig.pbTryFonts(aa)
|
||||
return ret if ret != ""
|
||||
end
|
||||
@@ -455,14 +455,14 @@ end
|
||||
def pbSetSpritesToColor(sprites, color)
|
||||
return if !sprites || !color
|
||||
colors = {}
|
||||
for i in sprites
|
||||
sprites.each do |i|
|
||||
next if !i[1] || pbDisposed?(i[1])
|
||||
colors[i[0]] = i[1].color.clone
|
||||
i[1].color = pbSrcOver(i[1].color, color)
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
for i in colors
|
||||
colors.each do |i|
|
||||
next if !sprites[i[0]]
|
||||
sprites[i[0]].color = i[1]
|
||||
end
|
||||
@@ -480,7 +480,7 @@ def using(window)
|
||||
end
|
||||
|
||||
def pbUpdateSpriteHash(windows)
|
||||
for i in windows
|
||||
windows.each do |i|
|
||||
window = i[1]
|
||||
if window
|
||||
if window.is_a?(Sprite) || window.is_a?(Window)
|
||||
@@ -503,7 +503,7 @@ end
|
||||
# Disposes all objects in the specified hash.
|
||||
def pbDisposeSpriteHash(sprites)
|
||||
return if !sprites
|
||||
for i in sprites.keys
|
||||
sprites.keys.each do |i|
|
||||
pbDisposeSprite(sprites, i)
|
||||
end
|
||||
sprites.clear
|
||||
@@ -552,7 +552,7 @@ def pbFadeOutIn(z = 99999, nofadeout = false)
|
||||
viewport.z = z
|
||||
numFrames = (Graphics.frame_rate * 0.4).floor
|
||||
alphaDiff = (255.0 / numFrames).ceil
|
||||
for j in 0..numFrames
|
||||
(0..numFrames).each do |j|
|
||||
col.set(0, 0, 0, j * alphaDiff)
|
||||
viewport.color = col
|
||||
Graphics.update
|
||||
@@ -566,7 +566,7 @@ def pbFadeOutIn(z = 99999, nofadeout = false)
|
||||
ensure
|
||||
pbPopFade
|
||||
if !nofadeout
|
||||
for j in 0..numFrames
|
||||
(0..numFrames).each do |j|
|
||||
col.set(0, 0, 0, (numFrames - j) * alphaDiff)
|
||||
viewport.color = col
|
||||
Graphics.update
|
||||
@@ -583,7 +583,7 @@ def pbFadeOutInWithUpdate(z, sprites, nofadeout = false)
|
||||
viewport.z = z
|
||||
numFrames = (Graphics.frame_rate * 0.4).floor
|
||||
alphaDiff = (255.0 / numFrames).ceil
|
||||
for j in 0..numFrames
|
||||
(0..numFrames).each do |j|
|
||||
col.set(0, 0, 0, j * alphaDiff)
|
||||
viewport.color = col
|
||||
pbUpdateSpriteHash(sprites)
|
||||
@@ -596,7 +596,7 @@ def pbFadeOutInWithUpdate(z, sprites, nofadeout = false)
|
||||
ensure
|
||||
pbPopFade
|
||||
if !nofadeout
|
||||
for j in 0..numFrames
|
||||
(0..numFrames).each do |j|
|
||||
col.set(0, 0, 0, (numFrames - j) * alphaDiff)
|
||||
viewport.color = col
|
||||
pbUpdateSpriteHash(sprites)
|
||||
@@ -629,12 +629,12 @@ def pbFadeOutAndHide(sprites)
|
||||
numFrames = (Graphics.frame_rate * 0.4).floor
|
||||
alphaDiff = (255.0 / numFrames).ceil
|
||||
pbDeactivateWindows(sprites) {
|
||||
for j in 0..numFrames
|
||||
(0..numFrames).each do |j|
|
||||
pbSetSpritesToColor(sprites, Color.new(0, 0, 0, j * alphaDiff))
|
||||
(block_given?) ? yield : pbUpdateSpriteHash(sprites)
|
||||
end
|
||||
}
|
||||
for i in sprites
|
||||
sprites.each do |i|
|
||||
next if !i[1]
|
||||
next if pbDisposed?(i[1])
|
||||
visiblesprites[i[0]] = true if i[1].visible
|
||||
@@ -645,7 +645,7 @@ end
|
||||
|
||||
def pbFadeInAndShow(sprites, visiblesprites = nil)
|
||||
if visiblesprites
|
||||
for i in visiblesprites
|
||||
visiblesprites.each do |i|
|
||||
if i[1] && sprites[i[0]] && !pbDisposed?(sprites[i[0]])
|
||||
sprites[i[0]].visible = true
|
||||
end
|
||||
@@ -654,7 +654,7 @@ def pbFadeInAndShow(sprites, visiblesprites = nil)
|
||||
numFrames = (Graphics.frame_rate * 0.4).floor
|
||||
alphaDiff = (255.0 / numFrames).ceil
|
||||
pbDeactivateWindows(sprites) {
|
||||
for j in 0..numFrames
|
||||
(0..numFrames).each do |j|
|
||||
pbSetSpritesToColor(sprites, Color.new(0, 0, 0, ((numFrames - j) * alphaDiff)))
|
||||
(block_given?) ? yield : pbUpdateSpriteHash(sprites)
|
||||
end
|
||||
@@ -665,7 +665,7 @@ end
|
||||
# _activeStatuses_ is the result of a previous call to pbActivateWindows
|
||||
def pbRestoreActivations(sprites, activeStatuses)
|
||||
return if !sprites || !activeStatuses
|
||||
for k in activeStatuses.keys
|
||||
activeStatuses.keys.each do |k|
|
||||
if sprites[k] && sprites[k].is_a?(Window) && !pbDisposed?(sprites[k])
|
||||
sprites[k].active = activeStatuses[k] ? true : false
|
||||
end
|
||||
@@ -688,7 +688,7 @@ end
|
||||
def pbActivateWindow(sprites, key)
|
||||
return if !sprites
|
||||
activeStatuses = {}
|
||||
for i in sprites
|
||||
sprites.each do |i|
|
||||
if i[1] && i[1].is_a?(Window) && !pbDisposed?(i[1])
|
||||
activeStatuses[i[0]] = i[1].active
|
||||
i[1].active = (i[0] == key)
|
||||
@@ -723,7 +723,7 @@ def addBackgroundPlane(sprites, planename, background, viewport = nil)
|
||||
sprites[planename].visible = false
|
||||
else
|
||||
sprites[planename].setBitmap(bitmapName)
|
||||
for spr in sprites.values
|
||||
sprites.values.each do |spr|
|
||||
if spr.is_a?(Window)
|
||||
spr.windowskin = nil
|
||||
end
|
||||
@@ -745,7 +745,7 @@ def addBackgroundOrColoredPlane(sprites, planename, background, color, viewport
|
||||
else
|
||||
sprites[planename] = AnimatedPlane.new(viewport)
|
||||
sprites[planename].setBitmap(bitmapName)
|
||||
for spr in sprites.values
|
||||
sprites.values.each do |spr|
|
||||
if spr.is_a?(Window)
|
||||
spr.windowskin = nil
|
||||
end
|
||||
@@ -772,7 +772,7 @@ end
|
||||
if !defined?(_INTL)
|
||||
def _INTL(*args)
|
||||
string = args[0].clone
|
||||
for i in 1...args.length
|
||||
(1...args.length).each do |i|
|
||||
string.gsub!(/\{#{i}\}/, "#{args[i]}")
|
||||
end
|
||||
return string
|
||||
@@ -782,7 +782,7 @@ end
|
||||
if !defined?(_ISPRINTF)
|
||||
def _ISPRINTF(*args)
|
||||
string = args[0].clone
|
||||
for i in 1...args.length
|
||||
(1...args.length).each do |i|
|
||||
string.gsub!(/\{#{i}\:([^\}]+?)\}/) { |m|
|
||||
next sprintf("%" + $1, args[i])
|
||||
}
|
||||
@@ -794,7 +794,7 @@ end
|
||||
if !defined?(_MAPINTL)
|
||||
def _MAPINTL(*args)
|
||||
string = args[1].clone
|
||||
for i in 2...args.length
|
||||
(2...args.length).each do |i|
|
||||
string.gsub!(/\{#{i}\}/, "#{args[i + 1]}")
|
||||
end
|
||||
return string
|
||||
|
||||
@@ -89,7 +89,7 @@ class Window
|
||||
@cursorbitmap = nil
|
||||
@bgbitmap = nil
|
||||
@viewport = viewport
|
||||
for i in @spritekeys
|
||||
@spritekeys.each do |i|
|
||||
@sprites[i] = Sprite.new(@viewport)
|
||||
end
|
||||
@disposed = false
|
||||
@@ -126,12 +126,12 @@ class Window
|
||||
|
||||
def dispose
|
||||
if !self.disposed?
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].dispose if i[1]
|
||||
@sprites[i[0]] = nil
|
||||
end
|
||||
for i in 0...@sidebitmaps.length
|
||||
@sidebitmaps[i].dispose if @sidebitmaps[i]
|
||||
@sidebitmaps.each_with_index do |bitmap, i|
|
||||
bitmap.dispose if bitmap
|
||||
@sidebitmaps[i] = nil
|
||||
end
|
||||
@blankcontents.dispose
|
||||
@@ -164,7 +164,7 @@ class Window
|
||||
|
||||
def viewport=(value)
|
||||
@viewport = value
|
||||
for i in @spritekeys
|
||||
@spritekeys.each do |i|
|
||||
@sprites[i].dispose
|
||||
if @sprites[i].is_a?(Sprite)
|
||||
@sprites[i] = Sprite.new(@viewport)
|
||||
@@ -286,7 +286,7 @@ class Window
|
||||
|
||||
def flash(color, duration)
|
||||
return if disposed?
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].flash(color, duration)
|
||||
end
|
||||
end
|
||||
@@ -313,7 +313,7 @@ class Window
|
||||
mustchange = true
|
||||
end
|
||||
privRefresh if mustchange
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].update
|
||||
end
|
||||
end
|
||||
@@ -350,14 +350,14 @@ class Window
|
||||
backopac = self.back_opacity * self.opacity / 255
|
||||
contopac = self.contents_opacity
|
||||
cursoropac = @cursoropacity * contopac / 255
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
@sprites["corner#{i}"].bitmap = @_windowskin
|
||||
@sprites["scroll#{i}"].bitmap = @_windowskin
|
||||
end
|
||||
@sprites["pause"].bitmap = @_windowskin
|
||||
@sprites["contents"].bitmap = @contents
|
||||
if @_windowskin && !@_windowskin.disposed?
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
@sprites["corner#{i}"].opacity = @opacity
|
||||
@sprites["corner#{i}"].tone = @tone
|
||||
@sprites["corner#{i}"].color = @color
|
||||
@@ -374,7 +374,7 @@ class Window
|
||||
@sprites["scroll#{i}"].color = @color
|
||||
@sprites["scroll#{i}"].visible = @visible
|
||||
end
|
||||
for i in ["back", "cursor", "pause", "contents"]
|
||||
["back", "cursor", "pause", "contents"].each do |i|
|
||||
@sprites[i].color = @color
|
||||
@sprites[i].tone = @tone
|
||||
@sprites[i].blend_type = @blend_type
|
||||
@@ -396,7 +396,7 @@ class Window
|
||||
@sprites["scroll3"].visible = @visible && hascontents &&
|
||||
(@contents.height - @oy) > @height - 32
|
||||
else
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
@sprites["corner#{i}"].visible = false
|
||||
@sprites["side#{i}"].visible = false
|
||||
@sprites["scroll#{i}"].visible = false
|
||||
@@ -410,7 +410,7 @@ class Window
|
||||
@sprites["pause"].visible = false
|
||||
@sprites["cursor"].visible = false
|
||||
end
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].z = @z
|
||||
end
|
||||
if @rpgvx
|
||||
@@ -540,7 +540,7 @@ class Window
|
||||
@sprites["cursor"].visible = false
|
||||
@sprites["cursor"].src_rect.set(0, 0, 0, 0)
|
||||
end
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
dwidth = [0, 3].include?(i) ? @width - 32 : 16
|
||||
dheight = [0, 3].include?(i) ? 16 : @height - 32
|
||||
@sidebitmaps[i] = ensureBitmap(@sidebitmaps[i], dwidth, dheight)
|
||||
@@ -573,7 +573,7 @@ class Window
|
||||
end
|
||||
if @openness != 255
|
||||
opn = @openness / 255.0
|
||||
for k in @spritekeys
|
||||
@spritekeys.each do |k|
|
||||
sprite = @sprites[k]
|
||||
ratio = (@height <= 0) ? 0 : (sprite.y - @y) / @height.to_f
|
||||
sprite.zoom_y = opn
|
||||
@@ -581,14 +581,14 @@ class Window
|
||||
sprite.y = (@y + (@height / 2.0) + (@height * ratio * opn) - (@height / 2 * opn)).floor
|
||||
end
|
||||
else
|
||||
for k in @spritekeys
|
||||
@spritekeys.each do |k|
|
||||
sprite = @sprites[k]
|
||||
sprite.zoom_y = 1.0
|
||||
end
|
||||
end
|
||||
i = 0
|
||||
# Ensure Z order
|
||||
for k in @spritekeys
|
||||
@spritekeys.each do |k|
|
||||
sprite = @sprites[k]
|
||||
y = sprite.y
|
||||
sprite.y = i
|
||||
|
||||
@@ -66,7 +66,7 @@ class SpriteWindow < Window
|
||||
@sidebitmaps = [nil, nil, nil, nil]
|
||||
@cursorbitmap = nil
|
||||
@bgbitmap = nil
|
||||
for i in @spritekeys
|
||||
@spritekeys.each do |i|
|
||||
@sprites[i] = Sprite.new(@viewport)
|
||||
end
|
||||
@disposed = false
|
||||
@@ -112,12 +112,12 @@ class SpriteWindow < Window
|
||||
|
||||
def dispose
|
||||
if !self.disposed?
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].dispose if i[1]
|
||||
@sprites[i[0]] = nil
|
||||
end
|
||||
for i in 0...@sidebitmaps.length
|
||||
@sidebitmaps[i].dispose if @sidebitmaps[i]
|
||||
@sidebitmaps.each_with_index do |bitmap, i|
|
||||
bitmap.dispose if bitmap
|
||||
@sidebitmaps[i] = nil
|
||||
end
|
||||
@blankcontents.dispose
|
||||
@@ -142,7 +142,7 @@ class SpriteWindow < Window
|
||||
|
||||
def viewport=(value)
|
||||
@viewport = value
|
||||
for i in @spritekeys
|
||||
@spritekeys.each do |i|
|
||||
@sprites[i].dispose if @sprites[i]
|
||||
if @sprites[i].is_a?(Sprite)
|
||||
@sprites[i] = Sprite.new(@viewport)
|
||||
@@ -288,7 +288,7 @@ class SpriteWindow < Window
|
||||
def flash(color, duration)
|
||||
return if disposed?
|
||||
@flash = duration + 1
|
||||
for i in @sprites
|
||||
@sprites.each do |i|
|
||||
i[1].flash(color, duration)
|
||||
end
|
||||
end
|
||||
@@ -317,7 +317,7 @@ class SpriteWindow < Window
|
||||
end
|
||||
privRefresh if mustchange
|
||||
if @flash > 0
|
||||
for i in @sprites.values
|
||||
@sprites.values.each do |i|
|
||||
i.update
|
||||
end
|
||||
@flash -= 1
|
||||
@@ -477,14 +477,14 @@ class SpriteWindow < Window
|
||||
contopac = self.contents_opacity
|
||||
cursoropac = @cursoropacity * contopac / 255
|
||||
haveskin = @_windowskin && !@_windowskin.disposed?
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
@sprites["corner#{i}"].bitmap = @_windowskin
|
||||
@sprites["scroll#{i}"].bitmap = @_windowskin
|
||||
end
|
||||
@sprites["pause"].bitmap = @_windowskin
|
||||
@sprites["contents"].bitmap = @contents
|
||||
if haveskin
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
@sprites["corner#{i}"].opacity = @opacity
|
||||
@sprites["corner#{i}"].tone = @tone
|
||||
@sprites["corner#{i}"].color = @color
|
||||
@@ -501,7 +501,7 @@ class SpriteWindow < Window
|
||||
@sprites["scroll#{i}"].visible = @visible
|
||||
@sprites["scroll#{i}"].blend_type = @blend_type
|
||||
end
|
||||
for i in ["back", "cursor", "pause", "contents"]
|
||||
["back", "cursor", "pause", "contents"].each do |i|
|
||||
@sprites[i].color = @color
|
||||
@sprites[i].tone = @tone
|
||||
@sprites[i].blend_type = @blend_type
|
||||
@@ -524,7 +524,7 @@ class SpriteWindow < Window
|
||||
@sprites["scroll2"].visible = false
|
||||
@sprites["scroll3"].visible = false
|
||||
else
|
||||
for i in 0...4
|
||||
4.times do |i|
|
||||
@sprites["corner#{i}"].visible = false
|
||||
@sprites["side#{i}"].visible = false
|
||||
@sprites["scroll#{i}"].visible = false
|
||||
@@ -538,7 +538,7 @@ class SpriteWindow < Window
|
||||
@sprites["pause"].visible = false
|
||||
@sprites["cursor"].visible = false
|
||||
end
|
||||
for i in @spritekeys
|
||||
@spritekeys.each do |i|
|
||||
@sprites[i].z = @z
|
||||
end
|
||||
if (@compat & CompatBits::CorrectZ) > 0 && @skinformat == 0 && !@rpgvx
|
||||
@@ -725,7 +725,7 @@ class SpriteWindow < Window
|
||||
@sprites["cursor"].src_rect.set(0, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
for i in 0..3
|
||||
4.times do |i|
|
||||
case i
|
||||
when 0
|
||||
dwidth = @width - startX - endX
|
||||
@@ -783,7 +783,7 @@ class SpriteWindow < Window
|
||||
end
|
||||
if @openness != 255
|
||||
opn = @openness / 255.0
|
||||
for k in @spritekeys
|
||||
@spritekeys.each do |k|
|
||||
sprite = @sprites[k]
|
||||
ratio = (@height <= 0) ? 0 : (sprite.y - @y) / @height.to_f
|
||||
sprite.zoom_y = opn
|
||||
@@ -792,7 +792,7 @@ class SpriteWindow < Window
|
||||
sprite.y = (@y + (@height / 2.0) + (@height * ratio * opn) - (@height / 2 * opn)).floor
|
||||
end
|
||||
else
|
||||
for k in @spritekeys
|
||||
@spritekeys.each do |k|
|
||||
sprite = @sprites[k]
|
||||
sprite.zoom_x = 1.0
|
||||
sprite.zoom_y = 1.0
|
||||
@@ -800,7 +800,7 @@ class SpriteWindow < Window
|
||||
end
|
||||
i = 0
|
||||
# Ensure Z order
|
||||
for k in @spritekeys
|
||||
@spritekeys.each do |k|
|
||||
sprite = @sprites[k]
|
||||
y = sprite.y
|
||||
sprite.y = i
|
||||
|
||||
@@ -235,7 +235,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
cwidth = (maxwidth < 0) ? Graphics.width : maxwidth
|
||||
chars = getFormattedTextForDims(self.contents, 0, 0,
|
||||
cwidth - self.borderX - 2 - 6, -1, text, @lineHeight, true)
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
dims[0] = [dims[0], ch[1] + ch[3]].max
|
||||
dims[1] = [dims[1], ch[2] + ch[4]].max
|
||||
end
|
||||
@@ -312,7 +312,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
self.width - self.borderX - SpriteWindow_Base::TEXTPADDING, -1,
|
||||
shadowctag(@baseColor, @shadowColor) + value, 32, true)
|
||||
@oldfont = self.contents.font.clone
|
||||
for ch in fmt
|
||||
fmt.each do |ch|
|
||||
chx = ch[1] + ch[3]
|
||||
chy = ch[2] + ch[4]
|
||||
width = chx if width < chx
|
||||
@@ -340,7 +340,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
self.width - self.borderX - SpriteWindow_Base::TEXTPADDING, -1,
|
||||
shadowctag(@baseColor, @shadowColor) + value, 32, true)
|
||||
@oldfont = self.contents.font.clone
|
||||
for ch in @fmtchars
|
||||
@fmtchars.each do |ch|
|
||||
chx = ch[1] + ch[3]
|
||||
chy = ch[2] + ch[4]
|
||||
width = chx if width < chx
|
||||
@@ -390,7 +390,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
|
||||
def maxPosition
|
||||
pos = 0
|
||||
for ch in @fmtchars
|
||||
@fmtchars.each do |ch|
|
||||
# index after the last character's index
|
||||
pos = ch[14] + 1 if pos < ch[14] + 1
|
||||
end
|
||||
@@ -481,7 +481,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
|
||||
end
|
||||
maxX = self.width - self.borderX
|
||||
maxY = self.height - self.borderY
|
||||
for i in @drawncurchar + 1..numchars
|
||||
(@drawncurchar + 1..numchars).each do |i|
|
||||
next if i >= @fmtchars.length
|
||||
if !self.letterbyletter
|
||||
next if @fmtchars[i][1] >= maxX
|
||||
@@ -667,7 +667,7 @@ class Window_InputNumberPokemon < SpriteWindow_Base
|
||||
if @sign
|
||||
textHelper(0, 0, @negative ? "-" : "+", 0)
|
||||
end
|
||||
for i in 0...@digits_max
|
||||
@digits_max.times do |i|
|
||||
index = i + (@sign ? 1 : 0)
|
||||
textHelper(index * 24, 0, s[i, 1], index)
|
||||
end
|
||||
@@ -1084,7 +1084,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
||||
width = 0
|
||||
tmpbitmap = BitmapWrapper.new(1, 1)
|
||||
pbSetSystemFont(tmpbitmap)
|
||||
for i in commands
|
||||
commands.each do |i|
|
||||
width = [width, tmpbitmap.text_size(i).width].max
|
||||
end
|
||||
# one 16 to allow cursor
|
||||
@@ -1125,7 +1125,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
|
||||
dheight = self.height - self.borderY
|
||||
self.contents = pbDoEnsureBitmap(self.contents, dwidth, dheight)
|
||||
self.contents.clear
|
||||
for i in 0...@item_max
|
||||
@item_max.times do |i|
|
||||
next if i < self.top_item || i > self.top_item + self.page_item_max
|
||||
drawItem(i, @item_max, itemRect(i))
|
||||
end
|
||||
@@ -1250,7 +1250,7 @@ class Window_AdvancedCommandPokemon < Window_DrawableCommand
|
||||
chars = getFormattedText(bitmap, 0, 0,
|
||||
Graphics.width - self.borderX - SpriteWindow_Base::TEXTPADDING - 16,
|
||||
-1, text, self.rowHeight, true, true)
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
dims[0] = dims[0] ? [dims[0], ch[1]].min : ch[1]
|
||||
dims[1] = [dims[1], ch[1] + ch[3]].max
|
||||
end
|
||||
|
||||
@@ -57,7 +57,7 @@ class PngAnimatedBitmap
|
||||
end
|
||||
@frameDelay = delay
|
||||
subWidth = panorama.width / numFrames
|
||||
for i in 0...numFrames
|
||||
numFrames.times do |i|
|
||||
subBitmap = BitmapWrapper.new(subWidth, panorama.height)
|
||||
subBitmap.blt(0, 0, panorama, Rect.new(subWidth * i, 0, subWidth, panorama.height))
|
||||
@frames.push(subBitmap)
|
||||
@@ -76,7 +76,7 @@ class PngAnimatedBitmap
|
||||
def height; self.bitmap.height; end
|
||||
|
||||
def deanimate
|
||||
for i in 1...@frames.length
|
||||
(1...@frames.length).each do |i|
|
||||
@frames[i].dispose
|
||||
end
|
||||
@frames = [@frames[0]]
|
||||
@@ -134,9 +134,7 @@ class PngAnimatedBitmap
|
||||
def copy
|
||||
x = self.clone
|
||||
x.frames = x.frames.clone
|
||||
for i in 0...x.frames.length
|
||||
x.frames[i] = x.frames[i].copy
|
||||
end
|
||||
x.frames.each_with_index { |frame, i| x.frames[i] = frame.copy }
|
||||
return x
|
||||
end
|
||||
end
|
||||
|
||||
@@ -238,7 +238,7 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig
|
||||
lastword[0] += 1
|
||||
y += 1
|
||||
x = 0
|
||||
for i in lastword[0]...characters.length
|
||||
(lastword[0]...characters.length).each do |i|
|
||||
characters[i][2] += lineheight
|
||||
charwidth = characters[i][3] - 2
|
||||
characters[i][1] = x
|
||||
@@ -251,12 +251,12 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig
|
||||
# Eliminate spaces before newlines and pause character
|
||||
if havenl
|
||||
firstspace = -1
|
||||
for i in 0...characters.length
|
||||
characters.length.times do |i|
|
||||
if characters[i][5] != false # If not a character
|
||||
firstspace = -1
|
||||
elsif (characters[i][0] == "\n" || isWaitChar(characters[i][0])) &&
|
||||
firstspace >= 0
|
||||
for j in firstspace...i
|
||||
(firstspace...i).each do |j|
|
||||
characters[j] = nil
|
||||
end
|
||||
firstspace = -1
|
||||
@@ -267,21 +267,17 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig
|
||||
end
|
||||
end
|
||||
if firstspace > 0
|
||||
for j in firstspace...characters.length
|
||||
(firstspace...characters.length).each do |j|
|
||||
characters[j] = nil
|
||||
end
|
||||
end
|
||||
characters.compact!
|
||||
end
|
||||
for i in 0...characters.length
|
||||
characters[i][1] = xDst + characters[i][1]
|
||||
end
|
||||
characters.each { |char| char[1] = xDst + char[1] }
|
||||
# Remove all characters with Y greater or equal to _yDst_+_heightDst_
|
||||
if heightDst >= 0
|
||||
for i in 0...characters.length
|
||||
if characters[i][2] >= yDst + heightDst
|
||||
characters[i] = nil
|
||||
end
|
||||
characters.each_with_index do |char, i|
|
||||
characters[i] = nil if char[2] >= yDst + heightDst
|
||||
end
|
||||
characters.compact!
|
||||
end
|
||||
@@ -397,7 +393,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
end
|
||||
textchunks = []
|
||||
controls = []
|
||||
oldtext = text
|
||||
# oldtext = text
|
||||
while text[FORMATREGEXP]
|
||||
textchunks.push($~.pre_match)
|
||||
if $~[3]
|
||||
@@ -424,7 +420,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
# realtextStart = oldtext[0, oldtext.length - realtext.length]
|
||||
# end
|
||||
textchunks.push(text)
|
||||
for chunk in textchunks
|
||||
textchunks.each do |chunk|
|
||||
chunk.gsub!(/</, "<")
|
||||
chunk.gsub!(/>/, ">")
|
||||
chunk.gsub!(/'/, "'")
|
||||
@@ -432,9 +428,9 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
chunk.gsub!(/&/, "&")
|
||||
end
|
||||
textlen = 0
|
||||
for i in 0...controls.length
|
||||
controls.each_with_index do |control, i|
|
||||
textlen += textchunks[i].scan(/./m).length
|
||||
controls[i][2] = textlen
|
||||
control[2] = textlen
|
||||
end
|
||||
text = textchunks.join("")
|
||||
textchars = text.scan(/./m)
|
||||
@@ -475,7 +471,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
graphicWidth = nil
|
||||
graphicHeight = nil
|
||||
graphicRect = nil
|
||||
for i in 0...controls.length
|
||||
controls.length.times do |i|
|
||||
if controls[i] && controls[i][2] == position
|
||||
control = controls[i][0]
|
||||
param = controls[i][1]
|
||||
@@ -694,7 +690,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
lastword[0] += 1
|
||||
y += 1
|
||||
x = 0
|
||||
for i in lastword[0]...characters.length
|
||||
(lastword[0]...characters.length).each do |i|
|
||||
characters[i][2] += lineheight
|
||||
charactersInternal[i][1] += 1
|
||||
extraspace = (charactersInternal[i][4]) ? charactersInternal[i][4] : 0
|
||||
@@ -754,12 +750,12 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
if havenl
|
||||
# Eliminate spaces before newlines and pause character
|
||||
firstspace = -1
|
||||
for i in 0...characters.length
|
||||
characters.length.times do |i|
|
||||
if characters[i][5] != false # If not a character
|
||||
firstspace = -1
|
||||
elsif (characters[i][0] == "\n" || isWaitChar(characters[i][0])) &&
|
||||
firstspace >= 0
|
||||
for j in firstspace...i
|
||||
(firstspace...i).each do |j|
|
||||
characters[j] = nil
|
||||
charactersInternal[j] = nil
|
||||
end
|
||||
@@ -773,7 +769,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
end
|
||||
end
|
||||
if firstspace > 0
|
||||
for j in firstspace...characters.length
|
||||
(firstspace...characters.length).each do |j|
|
||||
characters[j] = nil
|
||||
charactersInternal[j] = nil
|
||||
end
|
||||
@@ -788,7 +784,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
lastalign = 0
|
||||
lasty = 0
|
||||
runstart = 0
|
||||
for i in 0...characters.length
|
||||
characters.length.times do |i|
|
||||
c = characters[i]
|
||||
if i > 0 && (charactersInternal[i][0] != lastalign ||
|
||||
charactersInternal[i][1] != lasty)
|
||||
@@ -806,7 +802,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
if collapseAlignments
|
||||
# Calculate the total width of each line
|
||||
totalLineWidths = []
|
||||
for block in widthblocks
|
||||
widthblocks.each do |block|
|
||||
y = block[4]
|
||||
if !totalLineWidths[y]
|
||||
totalLineWidths[y] = 0
|
||||
@@ -821,9 +817,9 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
|
||||
widthDst = [widthDst, (totalLineWidths.compact.max || 0)].min
|
||||
end
|
||||
# Now, based on the text runs found, recalculate Xs
|
||||
for block in widthblocks
|
||||
widthblocks.each do |block|
|
||||
next if block[0] >= block[1]
|
||||
for i in block[0]...block[1]
|
||||
(block[0]...block[1]).each do |i|
|
||||
case block[2]
|
||||
when 1 then characters[i][1] = xDst + (widthDst - block[3] - 4) + characters[i][1]
|
||||
when 2 then characters[i][1] = xDst + ((widthDst / 2) - (block[3] / 2)) + characters[i][1]
|
||||
@@ -874,7 +870,7 @@ def getLineBrokenText(bitmap, value, width, dims)
|
||||
next
|
||||
end
|
||||
words = [ccheck]
|
||||
for i in 0...words.length
|
||||
words.length.times do |i|
|
||||
word = words[i]
|
||||
if word && word != ""
|
||||
textSize = bitmap.text_size(word)
|
||||
@@ -929,7 +925,7 @@ def getLineBrokenChunks(bitmap, value, width, dims, plain = false)
|
||||
else
|
||||
words = [ccheck]
|
||||
end
|
||||
for i in 0...words.length
|
||||
words.length.times do |i|
|
||||
word = words[i]
|
||||
if word && word != ""
|
||||
textSize = bitmap.text_size(word)
|
||||
@@ -955,25 +951,25 @@ def getLineBrokenChunks(bitmap, value, width, dims, plain = false)
|
||||
end
|
||||
|
||||
def renderLineBrokenChunks(bitmap, xDst, yDst, normtext, maxheight = 0)
|
||||
for i in 0...normtext.length
|
||||
width = normtext[i][3]
|
||||
textx = normtext[i][1] + xDst
|
||||
texty = normtext[i][2] + yDst
|
||||
if maxheight == 0 || normtext[i][2] < maxheight
|
||||
bitmap.font.color = normtext[i][5]
|
||||
bitmap.draw_text(textx, texty, width + 2, normtext[i][4], normtext[i][0])
|
||||
normtext.each do |text|
|
||||
width = text[3]
|
||||
textx = text[1] + xDst
|
||||
texty = text[2] + yDst
|
||||
if maxheight == 0 || text[2] < maxheight
|
||||
bitmap.font.color = text[5]
|
||||
bitmap.draw_text(textx, texty, width + 2, text[4], text[0])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def renderLineBrokenChunksWithShadow(bitmap, xDst, yDst, normtext, maxheight, baseColor, shadowColor)
|
||||
for i in 0...normtext.length
|
||||
width = normtext[i][3]
|
||||
textx = normtext[i][1] + xDst
|
||||
texty = normtext[i][2] + yDst
|
||||
if maxheight == 0 || normtext[i][2] < maxheight
|
||||
height = normtext[i][4]
|
||||
text = normtext[i][0]
|
||||
normtext.each do |text|
|
||||
width = text[3]
|
||||
textx = text[1] + xDst
|
||||
texty = text[2] + yDst
|
||||
if maxheight == 0 || text[2] < maxheight
|
||||
height = text[4]
|
||||
text = text[0]
|
||||
bitmap.font.color = shadowColor
|
||||
bitmap.draw_text(textx + 2, texty, width + 2, height, text)
|
||||
bitmap.draw_text(textx, texty + 2, width + 2, height, text)
|
||||
@@ -987,7 +983,7 @@ end
|
||||
def drawBitmapBuffer(chars)
|
||||
width = 1
|
||||
height = 1
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
chx = ch[1] + ch[3]
|
||||
chy = ch[2] + ch[4]
|
||||
width = chx if width < chx
|
||||
@@ -1057,7 +1053,7 @@ end
|
||||
def drawFormattedChars(bitmap, chars)
|
||||
return if chars.length == 0 || !bitmap || bitmap.disposed?
|
||||
oldfont = bitmap.font.clone
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
drawSingleFormattedChar(bitmap, ch)
|
||||
end
|
||||
bitmap.font = oldfont
|
||||
@@ -1066,10 +1062,10 @@ end
|
||||
# Unused
|
||||
def drawTextTable(bitmap, x, y, totalWidth, rowHeight, columnWidthPercents, table)
|
||||
yPos = y
|
||||
for i in 0...table.length
|
||||
table.length.times do |i|
|
||||
row = table[i]
|
||||
xPos = x
|
||||
for j in 0...row.length
|
||||
row.length.times do |j|
|
||||
cell = row[j]
|
||||
cellwidth = columnWidthPercents[j] * totalWidth / 100
|
||||
chars = getFormattedText(bitmap, xPos, yPos, cellwidth, -1, cell, rowHeight)
|
||||
@@ -1149,7 +1145,7 @@ end
|
||||
# 5 - Shadow color
|
||||
# 6 - If true or 1, the text has an outline. Otherwise, the text has a shadow.
|
||||
def pbDrawTextPositions(bitmap, textpos)
|
||||
for i in textpos
|
||||
textpos.each do |i|
|
||||
textsize = bitmap.text_size(i[0])
|
||||
x = i[1]
|
||||
y = i[2] + 6
|
||||
@@ -1178,7 +1174,7 @@ def pbCopyBitmap(dstbm, srcbm, x, y, opacity = 255)
|
||||
end
|
||||
|
||||
def pbDrawImagePositions(bitmap, textpos)
|
||||
for i in textpos
|
||||
textpos.each do |i|
|
||||
srcbitmap = AnimatedBitmap.new(pbBitmapName(i[0]))
|
||||
x = i[1]
|
||||
y = i[2]
|
||||
|
||||
@@ -28,12 +28,12 @@ def pbEventCommentInput(*args)
|
||||
trigger = args[2] # Trigger
|
||||
return nil if list == nil
|
||||
return nil unless list.is_a?(Array)
|
||||
for item in list
|
||||
list.each do |item|
|
||||
next unless item.code == 108 || item.code == 408
|
||||
if item.parameters[0] == trigger
|
||||
start = list.index(item) + 1
|
||||
finish = start + elements
|
||||
for id in start...finish
|
||||
(start...finish).each do |id|
|
||||
next if !list[id]
|
||||
parameters.push(list[id].parameters[0])
|
||||
end
|
||||
@@ -225,8 +225,7 @@ class FaceWindowVX < SpriteWindow_Base
|
||||
@facebitmaptmp = AnimatedBitmap.new(facefile)
|
||||
@facebitmap = BitmapWrapper.new(96, 96)
|
||||
@facebitmap.blt(0, 0, @facebitmaptmp.bitmap,
|
||||
Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96)
|
||||
)
|
||||
Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96))
|
||||
self.contents = @facebitmap
|
||||
end
|
||||
|
||||
@@ -235,8 +234,7 @@ class FaceWindowVX < SpriteWindow_Base
|
||||
if @facebitmaptmp.totalFrames > 1
|
||||
@facebitmaptmp.update
|
||||
@facebitmap.blt(0, 0, @facebitmaptmp.bitmap,
|
||||
Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96)
|
||||
)
|
||||
Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -504,11 +502,11 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
text = $~.post_match
|
||||
end
|
||||
textchunks.push(text)
|
||||
for chunk in textchunks
|
||||
textchunks.each do |chunk|
|
||||
chunk.gsub!(/\005/, "\\")
|
||||
end
|
||||
textlen = 0
|
||||
for i in 0...controls.length
|
||||
controls.length.times do |i|
|
||||
control = controls[i][0]
|
||||
case control
|
||||
when "wt", "wtnp", ".", "|"
|
||||
@@ -524,7 +522,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
signWaitTime = Graphics.frame_rate / 2
|
||||
haveSpecialClose = false
|
||||
specialCloseSE = ""
|
||||
for i in 0...controls.length
|
||||
controls.length.times do |i|
|
||||
control = controls[i][0]
|
||||
param = controls[i][1]
|
||||
case control
|
||||
@@ -582,7 +580,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime)
|
||||
end
|
||||
end
|
||||
for i in 0...controls.length
|
||||
controls.length.times do |i|
|
||||
next if !controls[i]
|
||||
next if controls[i][2] > msgwindow.position || msgwindow.waitcount != 0
|
||||
control = controls[i][0]
|
||||
@@ -686,7 +684,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
|
||||
if haveSpecialClose
|
||||
pbSEPlay(pbStringToAudioFile(specialCloseSE))
|
||||
atTop = (msgwindow.y == 0)
|
||||
for i in 0..signWaitTime
|
||||
(0..signWaitTime).each do |i|
|
||||
if atTop
|
||||
msgwindow.y = -msgwindow.height * i / signWaitTime
|
||||
else
|
||||
|
||||
@@ -41,7 +41,7 @@ class CharacterEntryHelper
|
||||
return false if @maxlength >= 0 && chars.length >= @maxlength
|
||||
chars.insert(@cursor, ch)
|
||||
@text = ""
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
@text += ch if ch
|
||||
end
|
||||
@cursor += 1
|
||||
@@ -59,7 +59,7 @@ class CharacterEntryHelper
|
||||
return false if chars.length <= 0 || @cursor <= 0
|
||||
chars.delete_at(@cursor - 1)
|
||||
@text = ""
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
@text += ch if ch
|
||||
end
|
||||
@cursor -= 1
|
||||
@@ -75,7 +75,7 @@ class CharacterEntryHelper
|
||||
chars = chars[0, @maxlength]
|
||||
end
|
||||
@text = ""
|
||||
for ch in chars
|
||||
chars.each do |ch|
|
||||
@text += ch if ch
|
||||
end
|
||||
end
|
||||
@@ -198,7 +198,7 @@ class Window_TextEntry < SpriteWindow_Base
|
||||
break if fromcursor > width - 4
|
||||
startpos -= 1
|
||||
end
|
||||
for i in startpos...scanlength
|
||||
(startpos...scanlength).each do |i|
|
||||
c = (@helper.passwordChar != "") ? @helper.passwordChar : textscan[i]
|
||||
textwidth = bitmap.text_size(c).width
|
||||
next if c == "\n"
|
||||
@@ -352,9 +352,9 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
line = 0 if line < 0
|
||||
line = totallines - 1 if line >= totallines
|
||||
maximumY = 0
|
||||
for i in 0...textchars.length
|
||||
thisline = textchars[i][5]
|
||||
y = textchars[i][2]
|
||||
textchars.each do |text|
|
||||
thisline = text[5]
|
||||
y = text[2]
|
||||
return y if thisline == line
|
||||
maximumY = y if maximumY < y
|
||||
end
|
||||
@@ -368,9 +368,9 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
line = 0 if line < 0
|
||||
line = totallines - 1 if line >= totallines
|
||||
endpos = 0
|
||||
for i in 0...textchars.length
|
||||
thisline = textchars[i][5]
|
||||
thislength = textchars[i][8]
|
||||
textchars.each do |text|
|
||||
thisline = text[5]
|
||||
thislength = text[8]
|
||||
endpos += thislength if thisline == line
|
||||
end
|
||||
return endpos
|
||||
@@ -383,11 +383,11 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
line = 0 if line < 0
|
||||
line = totallines - 1 if line >= totallines
|
||||
endpos = 0
|
||||
for i in 0...textchars.length
|
||||
thisline = textchars[i][5]
|
||||
thispos = textchars[i][6]
|
||||
thiscolumn = textchars[i][7]
|
||||
thislength = textchars[i][8]
|
||||
textchars.each do |text|
|
||||
thisline = text[5]
|
||||
thispos = text[6]
|
||||
thiscolumn = text[7]
|
||||
thislength = text[8]
|
||||
if thisline == line
|
||||
endpos = thispos + thislength
|
||||
# echoln [endpos,thispos+(column-thiscolumn),textchars[i]]
|
||||
@@ -510,40 +510,40 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
cursorcolor = Color.new(0, 0, 0)
|
||||
textchars = getTextChars
|
||||
startY = getLineY(@firstline)
|
||||
for i in 0...textchars.length
|
||||
thisline = textchars[i][5]
|
||||
thiscolumn = textchars[i][7]
|
||||
thislength = textchars[i][8]
|
||||
textY = textchars[i][2] - startY
|
||||
textchars.each do |text|
|
||||
thisline = text[5]
|
||||
thiscolumn = text[7]
|
||||
thislength = text[8]
|
||||
textY = text[2] - startY
|
||||
# Don't draw lines before the first or zero-length segments
|
||||
next if thisline < @firstline || thislength == 0
|
||||
# Don't draw lines beyond the window's height
|
||||
break if textY >= height
|
||||
c = textchars[i][0]
|
||||
c = text[0]
|
||||
# Don't draw spaces
|
||||
next if c == " "
|
||||
textwidth = textchars[i][3] + 4 # add 4 to prevent draw_text from stretching text
|
||||
textheight = textchars[i][4]
|
||||
textwidth = text[3] + 4 # add 4 to prevent draw_text from stretching text
|
||||
textheight = text[4]
|
||||
# Draw text
|
||||
pbDrawShadowText(bitmap, textchars[i][1], textY, textwidth, textheight, c, @baseColor, @shadowColor)
|
||||
pbDrawShadowText(bitmap, text[1], textY, textwidth, textheight, c, @baseColor, @shadowColor)
|
||||
end
|
||||
# Draw cursor
|
||||
if ((@frame / 10) & 1) == 0
|
||||
textheight = bitmap.text_size("X").height
|
||||
cursorY = (textheight * @cursorLine) - startY
|
||||
cursorX = 0
|
||||
for i in 0...textchars.length
|
||||
thisline = textchars[i][5]
|
||||
thiscolumn = textchars[i][7]
|
||||
thislength = textchars[i][8]
|
||||
textchars.each do |text|
|
||||
thisline = text[5]
|
||||
thiscolumn = text[7]
|
||||
thislength = text[8]
|
||||
if thisline == @cursorLine && @cursorColumn >= thiscolumn &&
|
||||
@cursorColumn <= thiscolumn + thislength
|
||||
cursorY = textchars[i][2] - startY
|
||||
cursorX = textchars[i][1]
|
||||
textheight = textchars[i][4]
|
||||
cursorY = text[2] - startY
|
||||
cursorX = text[1]
|
||||
textheight = text[4]
|
||||
posToCursor = @cursorColumn - thiscolumn
|
||||
if posToCursor >= 0
|
||||
partialString = textchars[i][0].scan(/./m)[0, posToCursor].join("")
|
||||
partialString = text[0].scan(/./m)[0, posToCursor].join("")
|
||||
cursorX += bitmap.text_size(partialString).width
|
||||
end
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user