More Rubocopping

This commit is contained in:
Maruno17
2021-12-20 17:18:21 +00:00
parent db4acd3369
commit 33fcbf623b
154 changed files with 1388 additions and 1420 deletions

View File

@@ -120,7 +120,7 @@ module RPG
return if @max == value
@max = value.clamp(0, MAX_SPRITES)
ensureSprites
for i in 0...MAX_SPRITES
MAX_SPRITES.times do |i|
@sprites[i].visible = (i < @max) if @sprites[i]
end
end
@@ -149,7 +149,7 @@ module RPG
weather_data = GameData::Weather.get(new_type)
bitmap_names = weather_data.graphics
@weatherTypes[new_type] = [weather_data, [], []]
for i in 0...2 # 0=particles, 1=tiles
2.times do |i| # 0=particles, 1=tiles
next if !bitmap_names[i]
bitmap_names[i].each do |name|
bitmap = RPG::Cache.load_bitmap("Graphics/Weather/", name)
@@ -160,7 +160,7 @@ module RPG
def ensureSprites
if @sprites.length < MAX_SPRITES && @weatherTypes[@type] && @weatherTypes[@type][1].length > 0
for i in 0...MAX_SPRITES
MAX_SPRITES.times do |i|
if !@sprites[i]
sprite = Sprite.new(@origViewport)
sprite.z = 1000
@@ -175,7 +175,7 @@ module RPG
end
if @fading && @new_sprites.length < MAX_SPRITES && @weatherTypes[@target_type] &&
@weatherTypes[@target_type][1].length > 0
for i in 0...MAX_SPRITES
MAX_SPRITES.times do |i|
if !@new_sprites[i]
sprite = Sprite.new(@origViewport)
sprite.z = 1000
@@ -192,7 +192,7 @@ module RPG
def ensureTiles
return if @tiles.length >= @tiles_wide * @tiles_tall
for i in 0...(@tiles_wide * @tiles_tall)
(@tiles_wide * @tiles_tall).times do |i|
if !@tiles[i]
sprite = Sprite.new(@origViewport)
sprite.z = 1000
@@ -497,7 +497,7 @@ module RPG
# Update weather particles (raindrops, snowflakes, etc.)
if @weatherTypes[@type] && @weatherTypes[@type][1].length > 0
ensureSprites
for i in 0...MAX_SPRITES
MAX_SPRITES.times do |i|
update_sprite_position(@sprites[i], i, false)
end
elsif @sprites.length > 0
@@ -507,7 +507,7 @@ module RPG
# Update new weather particles (while fading in only)
if @fading && @weatherTypes[@target_type] && @weatherTypes[@target_type][1].length > 0
ensureSprites
for i in 0...MAX_SPRITES
MAX_SPRITES.times do |i|
update_sprite_position(@new_sprites[i], i, true)
end
elsif @new_sprites.length > 0

View File

@@ -74,8 +74,8 @@ class DarknessSprite < SpriteWrapper
cy = Graphics.height / 2
cradius = @radius
numfades = 5
for i in 1..numfades
for j in cx - cradius..cx + cradius
(1..numfades).each do |i|
(cx - cradius..cx + cradius).each do |j|
diff2 = (cradius * cradius) - ((j - cx) * (j - cx))
diff = Math.sqrt(diff2)
@darkness.fill_rect(j, cy - diff, 1, diff * 2, Color.new(0, 0, 0, 255.0 * (numfades - i) / numfades))
@@ -209,7 +209,7 @@ Events.onSpritesetCreate += proc { |_sender, e|
spriteset = e[0] # Spriteset being created
viewport = e[1] # Viewport used for tilemap and characters
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
for i in map.events.keys
map.events.keys.each do |i|
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i], viewport, map, filename))

View File

@@ -18,7 +18,7 @@ def pbCaveEntranceEx(exiting)
x = 0
y = 0
# Calculate color of each band
for k in 0...totalBands
totalBands.times do |k|
next if k >= totalBands * j / totalFrames
inc = increment
inc *= -1 if exiting
@@ -28,7 +28,7 @@ def pbCaveEntranceEx(exiting)
# Draw gray rectangles
rectwidth = Graphics.width
rectheight = Graphics.height
for i in 0...totalBands
totalBands.times do |i|
currentGray = grays[i]
sprite.bitmap.fill_rect(Rect.new(x, y, rectwidth, rectheight),
Color.new(currentGray, currentGray, currentGray))
@@ -47,7 +47,7 @@ def pbCaveEntranceEx(exiting)
pbToneChangeAll(Tone.new(-255, -255, -255), 0)
end
# Animate fade to white (if exiting) or black (if entering)
for j in 0...totalFrames
totalFrames.times do |j|
if exiting
sprite.color = Color.new(255, 255, 255, j * increment)
else