Fixed Pokédex showing genders for the wrong species, fixed AI always switching sleeping/frozen Pokémon, fixed class PngAnimatedBitmap animating slowly

This commit is contained in:
Maruno17
2023-08-23 21:08:32 +01:00
parent ea7b5d56d2
commit efea53aa5a
5 changed files with 12 additions and 9 deletions

View File

@@ -48,14 +48,14 @@ class PngAnimatedBitmap
if filename[/^\[(\d+)(?:,(\d+))?\]/] # Starts with 1 or 2 numbers in brackets
# File has a frame count
numFrames = $1.to_i
duration = $2.to_i
duration = $2.to_i # In 1/20ths of a second
duration = 5 if duration == 0
raise "Invalid frame count in #{filename}" if numFrames <= 0
raise "Invalid frame duration in #{filename}" if duration <= 0
if panorama.width % numFrames != 0
raise "Bitmap's width (#{panorama.width}) is not divisible by frame count: #{filename}"
end
@frame_duration = duration
@frame_duration = duration / 20.0
subWidth = panorama.width / numFrames
numFrames.times do |i|
subBitmap = Bitmap.new(subWidth, panorama.height)
@@ -99,7 +99,7 @@ class PngAnimatedBitmap
# Actually returns the total number of 1/20ths of a second this animation lasts.
def totalFrames
return @frame_duration * @frames.length
return (@frame_duration * @frames.length * 20).to_i
end
def each