Minor tidying

This commit is contained in:
Maruno17
2021-03-09 21:31:17 +00:00
parent 4c35a7ecfe
commit 117396f8e2
11 changed files with 38 additions and 34 deletions

View File

@@ -106,7 +106,7 @@ class Sprite_Character < RPG::Sprite
@oldbushdepth = @character.bush_depth
if @tile_id>=384
@charbitmap.dispose if @charbitmap
@charbitmap = pbGetTileBitmap(@character.map.tileset_name,@tile_id,@character.character_hue)
@charbitmap = pbGetTileBitmap(@character.map.tileset_name,@tile_id,@character_hue)
@charbitmapAnimated = false
@bushbitmap.dispose if @bushbitmap
@bushbitmap = nil
@@ -120,7 +120,7 @@ class Sprite_Character < RPG::Sprite
else
@charbitmap.dispose if @charbitmap
@charbitmap = AnimatedBitmap.new(
"Graphics/Characters/"+@character.character_name,@character.character_hue)
"Graphics/Characters/"+@character_name,@character_hue)
@charbitmapAnimated = true
@bushbitmap.dispose if @bushbitmap
@bushbitmap = nil

View File

@@ -18,13 +18,13 @@ class Sprite_SurfBase
end
def dispose
if !@disposed
return if @disposed
@sprite.dispose if @sprite
@sprite = nil
@surfbitmap.dispose
@divebitmap.dispose
@disposed = true
end
end
def disposed?
@disposed
@@ -49,9 +49,13 @@ class Sprite_SurfBase
@sprite = Sprite.new(@viewport) if !@sprite
if @sprite
if $PokemonGlobal.surfing
@sprite.bitmap = @surfbitmap.bitmap; cw = @cws; ch = @chs
@sprite.bitmap = @surfbitmap.bitmap
cw = @cws
ch = @chs
elsif $PokemonGlobal.diving
@sprite.bitmap = @divebitmap.bitmap; cw = @cwd; ch = @chd
@sprite.bitmap = @divebitmap.bitmap
cw = @cwd
ch = @chd
end
sx = @event.pattern_surf*cw
sy = ((@event.direction-2)/2)*ch

View File

@@ -90,7 +90,7 @@ module RTP
end
def self.getImagePath(filename)
return self.getPath(filename,["",".png",".gif"]) # ".jpg",".bmp",".jpeg"
return self.getPath(filename,["",".png",".gif"]) # ".jpg", ".jpeg", ".bmp"
end
def self.getAudioPath(filename)
@@ -158,7 +158,7 @@ end
module FileTest
Image_ext = ['.bmp', '.png', '.jpg', '.jpeg', '.gif']
Image_ext = ['.png', '.gif'] # '.jpg', '.jpeg', '.bmp',
Audio_ext = ['.mp3', '.mid', '.midi', '.ogg', '.wav', '.wma']
def self.audio_exist?(filename)

View File

@@ -138,7 +138,6 @@ class BitmapWrapper < Bitmap
end
module BitmapCache
@cache = ObjectSpace::WeakMap.new
@@ -154,7 +153,9 @@ module BitmapCache
end
def self.debug
File.open("bitmapcache2.txt", "wb") { |f|
t = Time.now
filename = t.strftime("%H %M %S.%L.txt")
File.open("bitmapcache_" + filename, "wb") { |f|
for i in @cache.keys
k = fromCache(i)
if !k

View File

@@ -199,10 +199,10 @@ class GifBitmap
filestrName=file+".gif"
elsif (filestring=pbGetFileChar(file+".png"))
filestrName=file+".png"
elsif (filestring=pbGetFileChar(file+".jpg"))
filestrName=file+".jpg"
elsif (filestring=pbGetFileChar(file+".bmp"))
filestrName=file+".bmp"
# elsif (filestring=pbGetFileChar(file+".jpg"))
# filestrName=file+".jpg"
# elsif (filestring=pbGetFileChar(file+".bmp"))
# filestrName=file+".bmp"
end
end
end

View File

@@ -8,8 +8,7 @@ end
def pbScreenCapture
t = pbGetTimeNow
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S")
filestart = sprintf("%s.%03d", filestart, (t.to_f - t.to_i) * 1000) # milliseconds
filestart = t.strftime("[%Y-%m-%d] %H_%M_%S.%L")
# capturefile = RTP.getSaveFileName(sprintf("%s.png", filestart))
# Graphics.snap_to_bitmap.save_to_png(capturefile)
capturefile = RTP.getSaveFileName(sprintf("%s.bmp", filestart))

View File

@@ -634,7 +634,7 @@ def pbImportAllAnimations
pbSafeCopyFile(audio,RTP.getAudioPath("Audio/SE/Anim/"+File.basename(audio)),"Audio/SE/Anim/"+File.basename(audio))
end
images = []
%w( png jpg bmp gif ).each { |ext|
%w( png gif ).each { |ext| # jpg jpeg bmp
upext = ext.upcase
images.concat(files.find_all { |f| f[f.length-3,3]==ext })
images.concat(files.find_all { |f| f[f.length-3,3]==upext })

View File

@@ -582,11 +582,11 @@ def pbSelectBG(canvas,timing)
animfiles[cmdErase=animfiles.length]=_INTL("[Erase background graphic]")
ret=false
pbRgssChdir(File.join("Graphics", "Animations")) {
animfiles.concat(Dir.glob("*.bmp"))
animfiles.concat(Dir.glob("*.png"))
animfiles.concat(Dir.glob("*.jpg"))
animfiles.concat(Dir.glob("*.jpeg"))
animfiles.concat(Dir.glob("*.gif"))
# animfiles.concat(Dir.glob("*.jpg"))
# animfiles.concat(Dir.glob("*.jpeg"))
# animfiles.concat(Dir.glob("*.bmp"))
}
cmdwin=pbListWindow(animfiles,320)
cmdwin.height=480

View File

@@ -149,12 +149,12 @@ class GraphicsLister
Dir.glob("*.PNG") { |f| @commands.push(f) }
Dir.glob("*.gif") { |f| @commands.push(f) }
Dir.glob("*.GIF") { |f| @commands.push(f) }
# Dir.glob("*.bmp") { |f| @commands.push(f) }
# Dir.glob("*.BMP") { |f| @commands.push(f) }
# Dir.glob("*.jpg") { |f| @commands.push(f) }
# Dir.glob("*.JPG") { |f| @commands.push(f) }
# Dir.glob("*.jpeg") { |f| @commands.push(f) }
# Dir.glob("*.JPEG") { |f| @commands.push(f) }
# Dir.glob("*.bmp") { |f| @commands.push(f) }
# Dir.glob("*.BMP") { |f| @commands.push(f) }
}
@commands.sort!
@commands.length.times do |i|

View File

@@ -79,7 +79,7 @@ module Compiler
def convert_pokemon_sprites(src_dir, dest_dir)
return if !FileTest.directory?(src_dir)
# generates a list of all graphic files
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
files = readDirectoryFiles(src_dir, ["*.png"])
# starts automatic renaming
files.each_with_index do |file, i|
Graphics.update if i % 100 == 0
@@ -104,7 +104,7 @@ module Compiler
def convert_pokemon_icons(src_dir, dest_dir)
return if !FileTest.directory?(src_dir)
# generates a list of all graphic files
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
files = readDirectoryFiles(src_dir, ["*.png"])
# starts automatic renaming
files.each_with_index do |file, i|
Graphics.update if i % 100 == 0
@@ -124,7 +124,7 @@ module Compiler
def convert_pokemon_footprints(src_dir, dest_dir)
return if !FileTest.directory?(src_dir)
# generates a list of all graphic files
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
files = readDirectoryFiles(src_dir, ["*.png"])
# starts automatic renaming
files.each_with_index do |file, i|
Graphics.update if i % 100 == 0
@@ -140,7 +140,7 @@ module Compiler
def convert_item_icons(src_dir, dest_dir)
return if !FileTest.directory?(src_dir)
# generates a list of all graphic files
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
files = readDirectoryFiles(src_dir, ["*.png"])
# starts automatic renaming
files.each_with_index do |file, i|
Graphics.update if i % 100 == 0
@@ -191,7 +191,7 @@ module Compiler
def convert_trainer_sprites(src_dir)
return if !FileTest.directory?(src_dir)
# generates a list of all graphic files
files = readDirectoryFiles(src_dir, ["*.png", "*.gif"])
files = readDirectoryFiles(src_dir, ["*.png"])
# starts automatic renaming
files.each_with_index do |file, i|
Graphics.update if i % 100 == 0