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

@@ -38,8 +38,8 @@ class Sprite_Timer
@timer.text = _ISPRINTF("<ac>{1:02d}:{2:02d}", min, sec)
end
@timer.update
else
@timer.visible = false if @timer
elsif @timer
@timer.visible = false
end
end
end

View File

@@ -117,7 +117,7 @@ class Sprite_Character < RPG::Sprite
self.oy = @ch
else
@charbitmap = AnimatedBitmap.new(
'Graphics/Characters/' + @character_name, @character_hue
'Graphics/Characters/' + @character_name, @character_hue
)
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @character == $game_player
@charbitmapAnimated = true

View File

@@ -57,10 +57,10 @@ class Sprite_Reflection
y += @height * 16
width = @rsprite.src_rect.width
height = @rsprite.src_rect.height
@sprite.x = x + width / 2
@sprite.y = y + height + height / 2
@sprite.x = x + (width / 2)
@sprite.y = y + height + (height / 2)
@sprite.ox = width / 2
@sprite.oy = height / 2 - 2 # Hard-coded 2 pixel shift up
@sprite.oy = (height / 2) - 2 # Hard-coded 2 pixel shift up
@sprite.oy -= @rsprite.character.bob_height * 2
@sprite.z = -50 # Still water is -100, map is 0 and above
@sprite.z += 1 if @event == $game_player

View File

@@ -63,8 +63,8 @@ class Sprite_SurfBase
sy = ((@event.direction - 2) / 2) * ch
@sprite.src_rect.set(sx, sy, cw, ch)
if $game_temp.surf_base_coords
@sprite.x = ($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X - @event.map.display_x + 3) / 4 + (Game_Map::TILE_WIDTH / 2)
@sprite.y = ($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y - @event.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT / 2) + 16
@sprite.x = ((($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X) - @event.map.display_x + 3) / 4) + (Game_Map::TILE_WIDTH / 2)
@sprite.y = ((($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y) - @event.map.display_y + 3) / 4) + (Game_Map::TILE_HEIGHT / 2) + 16
else
@sprite.x = @rsprite.x
@sprite.y = @rsprite.y

View File

@@ -9,7 +9,7 @@ class ClippableSprite < Sprite_Character
def update
super
@_src_rect = self.src_rect
tmright = @tilemap.map_data.xsize * Game_Map::TILE_WIDTH - @tilemap.ox
tmright = (@tilemap.map_data.xsize * Game_Map::TILE_WIDTH) - @tilemap.ox
echoln "x=#{self.x},ox=#{self.ox},tmright=#{tmright},tmox=#{@tilemap.ox}"
if @tilemap.ox - self.ox < -self.x
# clipped on left

View File

@@ -18,9 +18,9 @@ class AnimationSprite < RPG::Sprite
end
def setCoords
self.x = ((@tileX * Game_Map::REAL_RES_X - @map.display_x) / Game_Map::X_SUBPIXELS).ceil
self.x = (((@tileX * Game_Map::REAL_RES_X) - @map.display_x) / Game_Map::X_SUBPIXELS).ceil
self.x += Game_Map::TILE_WIDTH / 2
self.y = ((@tileY * Game_Map::REAL_RES_Y - @map.display_y) / Game_Map::Y_SUBPIXELS).ceil
self.y = (((@tileY * Game_Map::REAL_RES_Y) - @map.display_y) / Game_Map::Y_SUBPIXELS).ceil
self.y += Game_Map::TILE_HEIGHT
end

View File

@@ -9,23 +9,23 @@ class Particle_Engine
@disposed = false
@firsttime = true
@effects = {
# PinkMan's Effects
"fire" => Particle_Engine::Fire,
"smoke" => Particle_Engine::Smoke,
"teleport" => Particle_Engine::Teleport,
"spirit" => Particle_Engine::Spirit,
"explosion" => Particle_Engine::Explosion,
"aura" => Particle_Engine::Aura,
# BlueScope's Effects
"soot" => Particle_Engine::Soot,
"sootsmoke" => Particle_Engine::SootSmoke,
"rocket" => Particle_Engine::Rocket,
"fixteleport" => Particle_Engine::FixedTeleport,
"smokescreen" => Particle_Engine::Smokescreen,
"flare" => Particle_Engine::Flare,
"splash" => Particle_Engine::Splash,
# By Peter O.
"starteleport" => Particle_Engine::StarTeleport
# PinkMan's Effects
"fire" => Particle_Engine::Fire,
"smoke" => Particle_Engine::Smoke,
"teleport" => Particle_Engine::Teleport,
"spirit" => Particle_Engine::Spirit,
"explosion" => Particle_Engine::Explosion,
"aura" => Particle_Engine::Aura,
# BlueScope's Effects
"soot" => Particle_Engine::Soot,
"sootsmoke" => Particle_Engine::SootSmoke,
"rocket" => Particle_Engine::Rocket,
"fixteleport" => Particle_Engine::FixedTeleport,
"smokescreen" => Particle_Engine::Smokescreen,
"flare" => Particle_Engine::Flare,
"splash" => Particle_Engine::Splash,
# By Peter O.
"starteleport" => Particle_Engine::StarTeleport
}
end
@@ -261,9 +261,9 @@ class ParticleEffect_Event < ParticleEffect
@real_y = newRealY
if @opacityvar > 0 && @viewport
opac = 255.0 / @opacityvar
minX = opac * (-@xgravity * 1.0 / @slowdown).floor + @startingx
maxX = opac * (@xgravity * 1.0 / @slowdown).floor + @startingx
minY = opac * (-@ygravity * 1.0 / @slowdown).floor + @startingy
minX = (opac * (-@xgravity.to_f / @slowdown).floor) + @startingx
maxX = (opac * (@xgravity.to_f / @slowdown).floor) + @startingx
minY = (opac * (-@ygravity.to_f / @slowdown).floor) + @startingy
maxY = @startingy
minX -= @bmwidth
minY -= @bmheight
@@ -309,14 +309,12 @@ class ParticleEffect_Event < ParticleEffect
@particlex[i] = 0.0
@particley[i] = 0.0
end
else
if @opacity[i] <= 0
@opacity[i] = 250
@particles[i].y = @startingy + @yoffset
@particles[i].x = @startingx + @xoffset
@particlex[i] = 0.0
@particley[i] = 0.0
end
elsif @opacity[i] <= 0
@opacity[i] = 250
@particles[i].y = @startingy + @yoffset
@particles[i].x = @startingx + @xoffset
@particlex[i] = 0.0
@particley[i] = 0.0
end
calcParticlePos(i)
if @randomhue == 1
@@ -333,11 +331,11 @@ class ParticleEffect_Event < ParticleEffect
def calcParticlePos(i)
@leftright = rand(2)
if @leftright == 1
xo = -@xgravity * 1.0 / @slowdown
xo = -@xgravity.to_f / @slowdown
else
xo = @xgravity * 1.0 / @slowdown
xo = @xgravity.to_f / @slowdown
end
yo = -@ygravity * 1.0 / @slowdown
yo = -@ygravity.to_f / @slowdown
@particlex[i] += xo
@particley[i] += yo
@particlex[i] -= @__offsetx

View File

@@ -47,23 +47,23 @@ def getCubicPoint2(src, t)
x1 = src[6]
y1 = src[7]
x1 = cx1 + (x1 - cx1) * t
x0 = x0 + (cx0 - x0) * t
cx0 = cx0 + (cx1 - cx0) * t
cx1 = cx0 + (x1 - cx0) * t
cx0 = x0 + (cx0 - x0) * t
cx = cx0 + (cx1 - cx0) * t
x1 = cx1 + ((x1 - cx1) * t)
x0 = x0 + ((cx0 - x0) * t)
cx0 = cx0 + ((cx1 - cx0) * t)
cx1 = cx0 + ((x1 - cx0) * t)
cx0 = x0 + ((cx0 - x0) * t)
cx = cx0 + ((cx1 - cx0) * t)
# a = x1 - 3 * cx1 + 3 * cx0 - x0
# b = 3 * (cx1 - 2 * cx0 + x0)
# c = 3 * (cx0 - x0)
# d = x0
# cx = a*t*t*t + b*t*t + c*t + d
y1 = cy1 + (y1 - cy1) * t
y0 = y0 + (cy0 - y0) * t
cy0 = cy0 + (cy1 - cy0) * t
cy1 = cy0 + (y1 - cy0) * t
cy0 = y0 + (cy0 - y0) * t
cy = cy0 + (cy1 - cy0) * t
y1 = cy1 + ((y1 - cy1) * t)
y0 = y0 + ((cy0 - y0) * t)
cy0 = cy0 + ((cy1 - cy0) * t)
cy1 = cy0 + ((y1 - cy0) * t)
cy0 = y0 + ((cy0 - y0) * t)
cy = cy0 + ((cy1 - cy0) * t)
# a = y1 - 3 * cy1 + 3 * cy0 - y0
# b = 3 * (cy1 - 2 * cy0 + y0)
# c = 3 * (cy0 - y0)
@@ -121,11 +121,12 @@ class PictureEx
end
def callback(cb)
if cb.is_a?(Proc)
case cb
when Proc
cb.call(self)
elsif cb.is_a?(Array)
when Array
cb[0].method(cb[1]).call(self)
elsif cb.is_a?(Method)
when Method
cb.call(self)
end
end
@@ -390,31 +391,31 @@ class PictureEx
dur = (process[2] == 0) ? 1 : process[2] # Total duration of process
case process[0]
when Processes::XY, Processes::DeltaXY
@x = process[5] + fra * (process[7] - process[5]) / dur
@y = process[6] + fra * (process[8] - process[6]) / dur
@x = process[5] + (fra * (process[7] - process[5]) / dur)
@y = process[6] + (fra * (process[8] - process[6]) / dur)
when Processes::Curve
@x, @y = getCubicPoint2(process[5], fra.to_f / dur)
when Processes::Z
@z = process[5] + fra * (process[6] - process[5]) / dur
@z = process[5] + (fra * (process[6] - process[5]) / dur)
when Processes::Zoom
@zoom_x = process[5] + fra * (process[7] - process[5]) / dur
@zoom_y = process[6] + fra * (process[8] - process[6]) / dur
@zoom_x = process[5] + (fra * (process[7] - process[5]) / dur)
@zoom_y = process[6] + (fra * (process[8] - process[6]) / dur)
when Processes::Angle
@angle = process[5] + fra * (process[6] - process[5]) / dur
@angle = process[5] + (fra * (process[6] - process[5]) / dur)
when Processes::Tone
@tone.red = process[5].red + fra * (process[6].red - process[5].red) / dur
@tone.green = process[5].green + fra * (process[6].green - process[5].green) / dur
@tone.blue = process[5].blue + fra * (process[6].blue - process[5].blue) / dur
@tone.gray = process[5].gray + fra * (process[6].gray - process[5].gray) / dur
@tone.red = process[5].red + (fra * (process[6].red - process[5].red) / dur)
@tone.green = process[5].green + (fra * (process[6].green - process[5].green) / dur)
@tone.blue = process[5].blue + (fra * (process[6].blue - process[5].blue) / dur)
@tone.gray = process[5].gray + (fra * (process[6].gray - process[5].gray) / dur)
when Processes::Color
@color.red = process[5].red + fra * (process[6].red - process[5].red) / dur
@color.green = process[5].green + fra * (process[6].green - process[5].green) / dur
@color.blue = process[5].blue + fra * (process[6].blue - process[5].blue) / dur
@color.alpha = process[5].alpha + fra * (process[6].alpha - process[5].alpha) / dur
@color.red = process[5].red + (fra * (process[6].red - process[5].red) / dur)
@color.green = process[5].green + (fra * (process[6].green - process[5].green) / dur)
@color.blue = process[5].blue + (fra * (process[6].blue - process[5].blue) / dur)
@color.alpha = process[5].alpha + (fra * (process[6].alpha - process[5].alpha) / dur)
when Processes::Hue
@hue = (process[6] - process[5]).to_f / dur
when Processes::Opacity
@opacity = process[5] + fra * (process[6] - process[5]) / dur
@opacity = process[5] + (fra * (process[6] - process[5]) / dur)
when Processes::Visible
@visible = process[5]
when Processes::BlendType

View File

@@ -51,26 +51,26 @@ class Interpolator
def update
if @tweening
t = (@step * 1.0) / @frames
t = @step.to_f / @frames
for i in 0...@tweensteps.length
item = @tweensteps[i]
next if !item
case i
when ZOOM_X
@sprite.zoom_x = item[0] + item[1] * t
@sprite.zoom_x = item[0] + (item[1] * t)
when ZOOM_Y
@sprite.zoom_y = item[0] + item[1] * t
@sprite.zoom_y = item[0] + (item[1] * t)
when X
@sprite.x = item[0] + item[1] * t
@sprite.x = item[0] + (item[1] * t)
when Y
@sprite.y = item[0] + item[1] * t
@sprite.y = item[0] + (item[1] * t)
when OPACITY
@sprite.opacity = item[0] + item[1] * t
@sprite.opacity = item[0] + (item[1] * t)
when COLOR
@sprite.color = Color.new(item[0].red + item[1].red * t,
item[0].green + item[1].green * t,
item[0].blue + item[1].blue * t,
item[0].alpha + item[1].alpha * t)
@sprite.color = Color.new(item[0].red + (item[1].red * t),
item[0].green + (item[1].green * t),
item[0].blue + (item[1].blue * t),
item[0].alpha + (item[1].alpha * t))
end
end
@step += 1
@@ -108,19 +108,19 @@ class RectInterpolator
def update
return if done?
t = (@curframe * 1.0 / @frames)
t = @curframe.to_f / @frames
x1 = @oldrect.x
x2 = @newrect.x
x = x1 + t * (x2 - x1)
x = x1 + (t * (x2 - x1))
y1 = @oldrect.y
y2 = @newrect.y
y = y1 + t * (y2 - y1)
y = y1 + (t * (y2 - y1))
rx1 = @oldrect.x + @oldrect.width
rx2 = @newrect.x + @newrect.width
rx = rx1 + t * (rx2 - rx1)
rx = rx1 + (t * (rx2 - rx1))
ry1 = @oldrect.y + @oldrect.height
ry2 = @newrect.y + @newrect.height
ry = ry1 + t * (ry2 - ry1)
ry = ry1 + (t * (ry2 - ry1))
minx = x < rx ? x : rx
maxx = x > rx ? x : rx
miny = y < ry ? y : ry
@@ -157,13 +157,13 @@ class PointInterpolator
def update
return if done?
t = (@curframe * 1.0 / @frames)
t = @curframe.to_f / @frames
rx1 = @oldx
rx2 = @newx
@x = rx1 + t * (rx2 - rx1)
@x = rx1 + (t * (rx2 - rx1))
ry1 = @oldy
ry2 = @newy
@y = ry1 + t * (ry2 - ry1)
@y = ry1 + (t * (ry2 - ry1))
@curframe += 1
end
end