More tweaks from the Rubocop overlord

This commit is contained in:
Maruno17
2021-12-19 17:28:59 +00:00
parent 33781493f4
commit 65b1a8d6c3
161 changed files with 2839 additions and 2967 deletions

View File

@@ -222,7 +222,7 @@ class AnimationWindow < SpriteWrapper
@contents.clear
@contents.fill_rect(0, 0, @contents.width, @contents.height, Color.new(180, 180, 180))
@contents.blt(0, 0, @arrows.bitmap, Rect.new(0, 0, arrowwidth, 96))
@contents.blt(arrowwidth + NUMFRAMES * 96, 0, @arrows.bitmap,
@contents.blt(arrowwidth + (NUMFRAMES * 96), 0, @arrows.bitmap,
Rect.new(arrowwidth, 0, arrowwidth, 96))
havebitmap = (self.animbitmap && !self.animbitmap.disposed?)
if havebitmap
@@ -238,9 +238,9 @@ class AnimationWindow < SpriteWrapper
end
end
for i in 0...NUMFRAMES
drawrect(@contents, arrowwidth + i * 96, 0, 96, 96, Color.new(100, 100, 100))
drawrect(@contents, arrowwidth + (i * 96), 0, 96, 96, Color.new(100, 100, 100))
if @start + i == @selected && havebitmap
drawborder(@contents, arrowwidth + i * 96, 0, 96, 96, Color.new(255, 0, 0))
drawborder(@contents, arrowwidth + (i * 96), 0, 96, 96, Color.new(255, 0, 0))
end
end
end
@@ -258,7 +258,7 @@ class AnimationWindow < SpriteWrapper
arrowwidth = @arrows.bitmap.width / 2
maxindex = (self.animbitmap.height / 192) * 5
left = Rect.new(0, 0, arrowwidth, 96)
right = Rect.new(arrowwidth + NUMFRAMES * 96, 0, arrowwidth, 96)
right = Rect.new(arrowwidth + (NUMFRAMES * 96), 0, arrowwidth, 96)
left.x += self.x
left.y += self.y
right.x += self.x
@@ -266,7 +266,7 @@ class AnimationWindow < SpriteWrapper
swatchrects = []
repeattime = Input.time?(Input::MOUSELEFT) / 1000
for i in 0...NUMFRAMES
swatchrects.push(Rect.new(arrowwidth + i * 96 + self.x, self.y, 96, 96))
swatchrects.push(Rect.new(arrowwidth + (i * 96) + self.x, self.y, 96, 96))
end
for i in 0...NUMFRAMES
if swatchrects[i].contains(mousepos[0], mousepos[1])
@@ -410,7 +410,7 @@ class SpriteFrame < InvalidatableSprite
@contents.fill_rect(63, 0, 1, 64, color)
# Determine frame number graphic to use from @iconbitmap
yoffset = (@previous) ? (NUM_ROWS + 1) * 16 : 0 # 1 is for padlock icon
bmrect = Rect.new((@id % 10) * 16, yoffset + (@id / 10) * 16, 16, 16)
bmrect = Rect.new((@id % 10) * 16, yoffset + ((@id / 10) * 16), 16, 16)
@contents.blt(0, 0, @iconbitmap.bitmap, bmrect)
# Draw padlock if frame is locked
if @locked && !@previous
@@ -986,8 +986,8 @@ class BitmapDisplayWindow < SpriteWindow_Base
return if !bmap
ww = bmap.width
wh = bmap.height
sx = self.contents.width * 1.0 / ww
sy = self.contents.height * 1.0 / wh
sx = self.contents.width / ww.to_f
sy = self.contents.height / wh.to_f
if sx > sy
ww = sy * ww
wh = self.contents.height

View File

@@ -829,12 +829,8 @@ class ControlWindow < SpriteWindow_Base
mousepos = Mouse.getMousePos
return false if !mousepos
return false if i < 0 || i >= @controls.length
rc = Rect.new(
@controls[i].parentX,
@controls[i].parentY,
@controls[i].width,
@controls[i].height
)
rc = Rect.new(@controls[i].parentX, @controls[i].parentY,
@controls[i].width, @controls[i].height)
return rc.contains(mousepos[0], mousepos[1])
end

View File

@@ -117,7 +117,7 @@ class PointPath
len = @points.length
dx = @points[len - 2][0] - @points[len - 1][0]
dy = @points[len - 2][1] - @points[len - 1][1]
dist = Math.sqrt(dx * dx + dy * dy)
dist = Math.sqrt((dx * dx) + (dy * dy))
@distances.push(dist)
@totaldist += dist
end
@@ -171,8 +171,8 @@ class PointPath
distT = 1.0 - ((curdist - distForT) / dist)
dx = @points[i + 1][0] - @points[i][0]
dy = @points[i + 1][1] - @points[i][1]
ret = [@points[i][0] + dx * distT,
@points[i][1] + dy * distT]
ret = [@points[i][0] + (dx * distT),
@points[i][1] + (dy * distT)]
break
end
end
@@ -188,9 +188,9 @@ def catmullRom(p1, p2, p3, p4, t)
# p1=prevPoint, p2=startPoint, p3=endPoint, p4=nextPoint, t is from 0 through 1
t2 = t * t
t3 = t2 * t
return 0.5 * (2 * p2 + t * (p3 - p1) +
t2 * (2 * p1 - 5 * p2 + 4 * p3 - p4) +
t3 * (p4 - 3 * p3 + 3 * p2 - p1))
return 0.5 * ((2 * p2) + (t * (p3 - p1)) +
(t2 * ((2 * p1) - (5 * p2) + (4 * p3) - p4)) +
(t3 * (p4 - (3 * p3) + (3 * p2) - p1)))
end
def getCatmullRomPoint(src, t)
@@ -275,10 +275,10 @@ def pbDefinePath(canvas)
points.push(point)
end
curve = [
ControlPointSprite.new(true, canvas.viewport),
ControlPointSprite.new(false, canvas.viewport),
ControlPointSprite.new(false, canvas.viewport),
ControlPointSprite.new(true, canvas.viewport)
ControlPointSprite.new(true, canvas.viewport),
ControlPointSprite.new(false, canvas.viewport),
ControlPointSprite.new(false, canvas.viewport),
ControlPointSprite.new(true, canvas.viewport)
]
showline = false
sliderwin2.visible = false
@@ -321,10 +321,10 @@ def pbDefinePath(canvas)
if !showline
curve[1].visible = true
curve[2].visible = true
curve[1].x = curve[0].x + 0.3333 * (curve[3].x - curve[0].x)
curve[1].y = curve[0].y + 0.3333 * (curve[3].y - curve[0].y)
curve[2].x = curve[0].x + 0.6666 * (curve[3].x - curve[0].x)
curve[2].y = curve[0].y + 0.6666 * (curve[3].y - curve[0].y)
curve[1].x = curve[0].x + (0.3333 * (curve[3].x - curve[0].x))
curve[1].y = curve[0].y + (0.3333 * (curve[3].y - curve[0].y))
curve[2].x = curve[0].x + (0.6666 * (curve[3].x - curve[0].x))
curve[2].y = curve[0].y + (0.6666 * (curve[3].y - curve[0].y))
end
showline = true
end

View File

@@ -154,11 +154,10 @@ def pbAnimList(animations, canvas, animwin)
next
end
if Input.trigger?(Input::USE) && animations.length > 0
cmd2 = pbShowCommands(helpwindow, [
_INTL("Load Animation"),
_INTL("Rename"),
_INTL("Delete")
], -1)
cmd2 = pbShowCommands(helpwindow,
[_INTL("Load Animation"),
_INTL("Rename"),
_INTL("Delete")], -1)
case cmd2
when 0 # Load Animation
canvas.loadAnimation(animations[cmdwin.index])
@@ -223,12 +222,8 @@ def pbSetTone(cel, previewsprite)
okbutton = sliderwin2.addButton(_INTL("OK"))
cancelbutton = sliderwin2.addButton(_INTL("Cancel"))
loop do
previewsprite.tone.set(
sliderwin2.value(0),
sliderwin2.value(1),
sliderwin2.value(2),
sliderwin2.value(3)
)
previewsprite.tone.set(sliderwin2.value(0), sliderwin2.value(1),
sliderwin2.value(2), sliderwin2.value(3))
Graphics.update
Input.update
sliderwin2.update
@@ -257,12 +252,8 @@ def pbSetFlash(cel, previewsprite)
okbutton = sliderwin2.addButton(_INTL("OK"))
cancelbutton = sliderwin2.addButton(_INTL("Cancel"))
loop do
previewsprite.tone.set(
sliderwin2.value(0),
sliderwin2.value(1),
sliderwin2.value(2),
sliderwin2.value(3)
)
previewsprite.tone.set(sliderwin2.value(0), sliderwin2.value(1),
sliderwin2.value(2), sliderwin2.value(3))
Graphics.update
Input.update
sliderwin2.update
@@ -1030,11 +1021,11 @@ def animationEditorMain(animation)
next
elsif Input.trigger?(Input::MOUSERIGHT) && sliderwin.hittest?(0) # Right mouse button
commands = [
_INTL("Copy Frame"),
_INTL("Paste Frame"),
_INTL("Clear Frame"),
_INTL("Insert Frame"),
_INTL("Delete Frame")
_INTL("Copy Frame"),
_INTL("Paste Frame"),
_INTL("Clear Frame"),
_INTL("Insert Frame"),
_INTL("Delete Frame")
]
hit = pbTrackPopupMenu(commands)
case hit
@@ -1067,13 +1058,13 @@ def animationEditorMain(animation)
mousepos = Mouse.getMousePos
mousepos = [0, 0] if !mousepos
commands = [
_INTL("Properties..."),
_INTL("Cut"),
_INTL("Copy"),
_INTL("Paste"),
_INTL("Delete"),
_INTL("Renumber..."),
_INTL("Extrapolate Path...")
_INTL("Properties..."),
_INTL("Cut"),
_INTL("Copy"),
_INTL("Paste"),
_INTL("Delete"),
_INTL("Renumber..."),
_INTL("Extrapolate Path...")
]
hit = pbTrackPopupMenu(commands)
case hit