Applied most Rubocop-suggested layout fixes

This commit is contained in:
Maruno17
2021-12-18 01:56:10 +00:00
parent 5dc64f1709
commit 2480ab0f9e
88 changed files with 839 additions and 783 deletions

View File

@@ -239,7 +239,7 @@ def pbRepositionMessageWindow(msgwindow, linecount=2)
when 1 # middle
msgwindow.y=(Graphics.height/2)-(msgwindow.height/2)
when 2
msgwindow.y=(Graphics.height)-(msgwindow.height)
msgwindow.y=(Graphics.height)-(msgwindow.height)
end
msgwindow.opacity = 0 if $game_system.message_frame != 0
end
@@ -339,9 +339,9 @@ def getSkinColor(windowskin,color,isDarkSkin)
"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::DARK_TEXT_SHADOW_COLOR), # 11 Dark default
colorToRgb32(MessageConfig::LIGHT_TEXT_MAIN_COLOR),
colorToRgb32(MessageConfig::LIGHT_TEXT_SHADOW_COLOR) # 12 Light default
colorToRgb32(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
@@ -616,10 +616,10 @@ def pbFadeOutInWithMusic(zViewport=99999)
$game_system.bgs_pause(1.0)
pos = $game_system.bgm_position
pbFadeOutIn(zViewport) {
yield
$game_system.bgm_position = pos
$game_system.bgm_resume(playingBGM)
$game_system.bgs_resume(playingBGS)
yield
$game_system.bgm_position = pos
$game_system.bgm_resume(playingBGM)
$game_system.bgs_resume(playingBGS)
}
end

View File

@@ -322,8 +322,8 @@ class Window
def ensureBitmap(bitmap,dwidth,dheight)
if !bitmap||bitmap.disposed?||bitmap.width<dwidth||bitmap.height<dheight
bitmap.dispose if bitmap
bitmap=Bitmap.new([1,dwidth].max,[1,dheight].max)
bitmap.dispose if bitmap
bitmap=Bitmap.new([1,dwidth].max,[1,dheight].max)
end
return bitmap
end
@@ -392,9 +392,9 @@ class Window
@sprites["scroll0"].visible = @visible && hascontents && @oy > 0
@sprites["scroll1"].visible = @visible && hascontents && @ox > 0
@sprites["scroll2"].visible = @visible && hascontents &&
(@contents.width - @ox) > @width-32
(@contents.width - @ox) > @width-32
@sprites["scroll3"].visible = @visible && hascontents &&
(@contents.height - @oy) > @height-32
(@contents.height - @oy) > @height-32
else
for i in 0...4
@sprites["corner#{i}"].visible=false
@@ -454,19 +454,18 @@ class Window
else
@sprites["contents"].src_rect.set(0,0,0,0)
end
pauseRects=[
trimX+32,trimY+64,
trimX+48,trimY+64,
trimX+32,trimY+80,
trimX+48,trimY+80,
pauseRects = [
trimX + 32, trimY + 64,
trimX + 48, trimY + 64,
trimX + 32, trimY + 80,
trimX + 48, trimY + 80
]
pauseWidth=16
pauseHeight=16
@sprites["pause"].src_rect.set(
pauseRects[@pauseframe*2],
pauseRects[@pauseframe*2+1],
pauseWidth,pauseHeight
)
@sprites["pause"].src_rect.set(pauseRects[@pauseframe * 2],
pauseRects[@pauseframe * 2 + 1],
pauseWidth,
pauseHeight)
@sprites["pause"].x=@x+(@width/2)-(pauseWidth/2)
@sprites["pause"].y=@y+@height-16 # 16 refers to skin margin
@sprites["contents"].x=@x+16
@@ -547,8 +546,8 @@ class Window
@sprites["cursor"].src_rect.set(0,0,0,0)
end
for i in 0...4
dwidth = (i==0 || i==3) ? @width-32 : 16
dheight = (i==0 || i==3) ? 16 : @height-32
dwidth = [0, 3].include?(i) ? @width - 32 : 16
dheight = [0, 3].include?(i) ? 16 : @height - 32
@sidebitmaps[i]=ensureBitmap(@sidebitmaps[i],dwidth,dheight)
@sprites["side#{i}"].bitmap=@sidebitmaps[i]
@sprites["side#{i}"].src_rect.set(0,0,dwidth,dheight)

View File

@@ -186,8 +186,8 @@ class SpriteWindow < Window
end
def active=(value)
@active=value
privRefresh(true)
@active=value
privRefresh(true)
end
def cursor_rect=(value)
@@ -519,9 +519,9 @@ class SpriteWindow < Window
@sprites["back"].visible=@visible
@sprites["contents"].visible=@visible && @openness==255
@sprites["pause"].visible=supported && @visible && @pause &&
(@combat & CompatBits::ShowPause)
(@combat & CompatBits::ShowPause)
@sprites["cursor"].visible=supported && @visible && @openness==255 &&
(@combat & CompatBits::ShowCursor)
(@combat & CompatBits::ShowCursor)
@sprites["scroll0"].visible = false
@sprites["scroll1"].visible = false
@sprites["scroll2"].visible = false
@@ -599,7 +599,7 @@ class SpriteWindow < Window
pauseRects[@pauseframe*2],
pauseRects[@pauseframe*2+1],
pauseWidth,pauseHeight
)
)
end
else
trimStartX=@trim[0]
@@ -850,7 +850,7 @@ class SpriteWindow_Base < SpriteWindow
def __setWindowskin(skin)
if skin && (skin.width==192 && skin.height==128) || # RPGXP Windowskin
(skin.width==128 && skin.height==128) # RPGVX Windowskin
(skin.width==128 && skin.height==128) # RPGVX Windowskin
self.skinformat=0
else
self.skinformat=1

View File

@@ -134,7 +134,7 @@ class Window_AdvancedTextPokemon < SpriteWindow_Base
@lastDrawnChar = -1
@fmtchars = []
@frameskipChanged = false
@frameskip = MessageConfig.pbGetTextSpeed()
@frameskip = MessageConfig.pbGetTextSpeed
super(0,0,33,33)
@pausesprite = nil
@text = ""
@@ -679,7 +679,7 @@ class Window_InputNumberPokemon < SpriteWindow_Base
refresh if @frame%15==0
if self.active
if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
pbPlayCursorSE()
pbPlayCursorSE
if @index==0 && @sign
@negative=!@negative
else
@@ -696,14 +696,14 @@ class Window_InputNumberPokemon < SpriteWindow_Base
refresh
elsif Input.repeat?(Input::RIGHT)
if digits >= 2
pbPlayCursorSE()
pbPlayCursorSE
@index = (@index + 1) % digits
@frame=0
refresh
end
elsif Input.repeat?(Input::LEFT)
if digits >= 2
pbPlayCursorSE()
pbPlayCursorSE
@index = (@index + digits - 1) % digits
@frame=0
refresh
@@ -847,7 +847,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
oldindex = @index
@index = (@index - @column_max + @item_max) % @item_max
if @index!=oldindex
pbPlayCursorSE()
pbPlayCursorSE
update_cursor_rect
end
end
@@ -857,7 +857,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
oldindex = @index
@index = (@index + @column_max) % @item_max
if @index!=oldindex
pbPlayCursorSE()
pbPlayCursorSE
update_cursor_rect
end
end
@@ -866,7 +866,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
oldindex = @index
@index -= 1
if @index!=oldindex
pbPlayCursorSE()
pbPlayCursorSE
update_cursor_rect
end
end
@@ -875,7 +875,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
oldindex = @index
@index += 1
if @index!=oldindex
pbPlayCursorSE()
pbPlayCursorSE
update_cursor_rect
end
end
@@ -884,7 +884,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
oldindex = @index
@index = [self.index-self.page_item_max, 0].max
if @index!=oldindex
pbPlayCursorSE()
pbPlayCursorSE
self.top_row -= self.page_row_max
update_cursor_rect
end
@@ -894,7 +894,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
oldindex = @index
@index = [self.index+self.page_item_max, @item_max-1].min
if @index!=oldindex
pbPlayCursorSE()
pbPlayCursorSE
self.top_row += self.page_row_max
update_cursor_rect
end
@@ -1092,8 +1092,8 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
tmpbitmap.dispose
end
# Store suggested width and height of window
dims[0] = [self.borderX+1,(width*self.columns)+self.borderX+
(self.columns-1)*self.columnSpacing].max
dims[0] = [self.borderX + 1,
(width * self.columns) + self.borderX + (self.columns - 1) * self.columnSpacing].max
dims[1] = [self.borderY+1,windowheight].max
dims[1] = [dims[1],Graphics.height].min
end
@@ -1117,11 +1117,10 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
return 0
end
def drawItem(index,count,rect) # to be implemented by derived classes
end
def drawItem(index, count, rect); end # to be implemented by derived classes
def refresh
@item_max = itemCount()
@item_max = itemCount
dwidth = self.width-self.borderX
dheight = self.height-self.borderY
self.contents = pbDoEnsureBitmap(self.contents,dwidth,dheight)

View File

@@ -65,18 +65,18 @@ def rgbToColor(param)
((baseint>>10)&0x1F)<<3
)
elsif param.length==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]
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
@@ -199,7 +199,7 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
if newlineBreaks # treat newline as break
havenl=true
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,
false,colorclone,nil,false,false,"",8,position,nil,0])
false,colorclone,nil,false,false,"",8,position,nil,0])
y+=1
x=0
hadspace=true
@@ -228,14 +228,15 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
textchars[position],
x+xStart,texty,width+2,lineheight,
false,bold,italic,colorclone,nil,false,false,
defaultfontname,bitmap.font.size,position,nil,0])
defaultfontname,bitmap.font.size,position,nil,0
])
end
x+=width
if !explicitBreaksOnly && x+2>widthDst && lastword[1]!=0 &&
(!hadnonspace || !hadspace)
havenl=true
characters.insert(lastword[0],["\n",x,y*lineheight+yDst,0,lineheight,
false,false,false,colorclone,nil,false,false,"",8,position])
false,false,false,colorclone,nil,false,false,"",8,position])
lastword[0]+=1
y+=1
x=0
@@ -256,7 +257,7 @@ def getFormattedTextFast(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight,
if characters[i][5]!=false # If not a character
firstspace=-1
elsif (characters[i][0]=="\n" || isWaitChar(characters[i][0])) &&
firstspace>=0
firstspace>=0
for j in firstspace...i
characters[j]=nil
end
@@ -306,10 +307,10 @@ def getLastColors(colorstack,opacitystack,defaultcolors)
colors=getLastParam(colorstack,defaultcolors)
opacity=getLastParam(opacitystack,255)
if opacity!=255
colors=[Color.new(colors[0].red,colors[0].green,colors[0].blue,
colors[0].alpha*opacity/255),
colors[1] ? Color.new(colors[1].red,colors[1].green,colors[1].blue,
colors[1].alpha*opacity/255) : nil]
colors = [
Color.new(colors[0].red, colors[0].green, colors[0].blue, colors[0].alpha * opacity / 255),
colors[1] ? Color.new(colors[1].red, colors[1].green, colors[1].blue, colors[1].alpha * opacity / 255) : nil
]
end
return colors
end
@@ -629,7 +630,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
nextline.times do
havenl=true
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,false,
defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil,0])
defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil,0])
charactersInternal.push([alignment,y,0])
y+=1
x=0
@@ -643,7 +644,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
if nextline==0
havenl=true
characters.push(["\n",x,y*lineheight+yDst,0,lineheight,false,false,false,
defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil,0])
defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil,0])
charactersInternal.push([alignment,y,0])
y+=1
x=0
@@ -692,9 +693,10 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
if !explicitBreaksOnly && x+2>widthDst && lastword[1]!=0 &&
(!hadnonspace || !hadspace)
havenl=true
characters.insert(lastword[0],["\n",x,y*lineheight+yDst,0,lineheight,false,
false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position,
nil])
characters.insert(lastword[0], ["\n", x, y * lineheight + yDst, 0, lineheight,
false, false, false,
defaultcolors[0], defaultcolors[1],
false, false, "", 8, position, nil])
charactersInternal.insert(lastword[0],[alignment,y,0])
lastword[0]+=1
y+=1
@@ -763,7 +765,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
if characters[i][5]!=false # If not a character
firstspace=-1
elsif (characters[i][0]=="\n" || isWaitChar(characters[i][0])) &&
firstspace>=0
firstspace>=0
for j in firstspace...i
characters[j]=nil
charactersInternal[j]=nil