Changed: TilemapXP @@ -848,4 +848,4 @@ - @priorect[0]!=minX || - @priorect[1]!=minY || - @priorect[2]!=maxX || - @priorect[3]!=maxY + @priotilesrect[0]!=minX || + @priotilesrect[1]!=minY || + @priotilesrect[2]!=maxX || + @priotilesrect[3]!=maxY @@ -858,1 +858,1 @@ - @priorect=[minX,minY,maxX,maxY] + @priotilesrect=[minX,minY,maxX,maxY] @@ -868,4 +868,4 @@ - @priorect[0]!=minX || - @priorect[1]!=minY || - @priorect[2]!=maxX || - @priorect[3]!=maxY + @priotilesrect[0]!=minX || + @priotilesrect[1]!=minY || + @priotilesrect[2]!=maxX || + @priotilesrect[3]!=maxY Changed: PokemonSafari @@ -120,0 +120,1 @@ + $PokemonGlobal.nextBattleBack=nil Changed: Sprite_Picture @@ -10,1 +10,0 @@ - @sprite.bitmap.dispose if @sprite.bitmap != nil @@ -15,0 +14,1 @@ + @sprite.update if @sprite @@ -22,2 +22,2 @@ - @sprite=Sprite.new(@viewport) if !@sprite - @sprite.bitmap = RPG::Cache.picture(@picture_name) + @sprite.dispose if @sprite + @sprite=GifSprite.new("Graphics/Pictures/"+@picture_name,@viewport) Changed: PokemonMap @@ -165,0 +165,1 @@ + attr_accessor :nextBattleBack @@ -175,0 +176,1 @@ + attr_accessor :nextBattleBG Changed: PokemonField @@ -391,0 +391,1 @@ + $PokemonGlobal.nextBattleBack=nil @@ -437,0 +438,1 @@ + $PokemonGlobal.nextBattleBack=nil @@ -466,0 +468,1 @@ + $PokemonGlobal.nextBattleBack=nil @@ -539,0 +542,1 @@ + $PokemonGlobal.nextBattleBack=nil @@ -633,1 +637,2 @@ - $game_system.map_interpreter.running? + $game_system.map_interpreter.running? || + !$Trainer @@ -686,1 +691,1 @@ - if !eventTriggered + if !eventTriggered @@ -690,1 +695,1 @@ - if encounter && !(Input.press?(Input::CTRL) && $DEBUG) + if encounter && !(Input.press?(Input::CTRL) && $DEBUG) && $Trainer.party.length > 0 @@ -702,1 +707,1 @@ - if encounter && !(Input.press?(Input::CTRL) && $DEBUG) + if encounter && !(Input.press?(Input::CTRL) && $DEBUG) && $Trainer.party.length > 0 @@ -715,1 +720,1 @@ - if encounter && !(Input.press?(Input::CTRL) && $DEBUG) + if encounter && !(Input.press?(Input::CTRL) && $DEBUG) && $Trainer.party.length > 0 Changed: PokeBattle_ActualScene @@ -1099,1 +1099,1 @@ - @sprites["battlebg"].update if @sprites["battlebg"].is_a?(Sprite) + @sprites["battlebg"].update if @sprites["battlebg"].respond_to?("update") @@ -1376,0 +1376,3 @@ + end + if $PokemonGlobal.nextBattleBack + id=$PokemonGlobal.nextBattleBack Changed: PokemonLoad @@ -212,0 +212,10 @@ + data_system = pbLoadRxData("Data/System") + mapfile=$RPGVX ? sprintf("Data/Map%03d.rvdata",data_system.start_map_id) : + sprintf("Data/Map%03d.rxdata",data_system.start_map_id) + if data_system.start_map_id==0 || !FileTest.exist?(mapfile) + Kernel.pbMessage(_INTL("No starting position was set in the map editor.\1")) + Kernel.pbMessage(_INTL("The game cannot continue.")) + @scene.pbEndScene + $scene=nil + return + end Changed: Main @@ -32,0 +32,3 @@ + getCurrentProcess=Win32API.new("kernel32.dll","GetCurrentProcess","","l") + setPriorityClass=Win32API.new("kernel32.dll","SetPriorityClass",%w(l i),"") + getPriorityClass=Win32API.new("kernel32.dll","GetPriorityClass",%w(l),"l") @@ -34,2 +37,1 @@ - setThreadPriority.call(getCurrentThread.call(),2) -# setThreadPriority.call(getCurrentThread.call(),1) + setPriorityClass.call(getCurrentProcess.call(),32768) # "Above normal" priority class Changed: BitmapCache @@ -362,1 +362,0 @@ - bm = BitmapWrapper.new(32, 32) @@ -366,1 +365,0 @@ - bm = BitmapWrapper.new(32, 32) Changed: Spriteset_Map @@ -20,1 +20,1 @@ - @panorama = Plane.new(@viewport1) + @panorama = AnimatedPlane.new(@viewport1) @@ -22,1 +22,1 @@ - @fog = Plane.new(@viewport1) + @fog = AnimatedPlane.new(@viewport1) @@ -188,2 +188,1 @@ - @panorama.bitmap.dispose - @panorama.bitmap = nil + @panorama.setPanorama(nil) @@ -192,1 +191,1 @@ - @panorama.bitmap = BitmapCache.panorama(@panorama_name, @panorama_hue) + @panorama.setPanorama(@panorama_name, @panorama_hue) @@ -200,2 +199,1 @@ - @fog.bitmap.dispose - @fog.bitmap = nil + @fog.setFog(nil) @@ -204,1 +202,1 @@ - @fog.bitmap = BitmapCache.fog(@fog_name, @fog_hue) + @fog.setFog(@fog_name, @fog_hue) @@ -237,0 +235,2 @@ + @panorama.update + @fog.update Changed: PokemonEditor @@ -2892,1 +2892,1 @@ - [_INTL("Money per level"),UIntProperty.new(3), + [_INTL("Money per level"),LimitProperty.new(255), Changed: SpriteWindow @@ -2688,0 +2688,65 @@ +class AnimatedPlane < Plane + def initialize(viewport=nil) + super(viewport) + @frames=[] + @currentFrame=0 + end + def dispose + clearBitmaps + super + end + def update + if @frames.length>1 + currentFrame=(Graphics.frame_count/10) % @frames.length + self.bitmap=@frames[currentFrame] + end + end + def clearBitmaps + for bitmap in @frames + bitmap.dispose + end + @frames.clear + self.bitmap=nil if !self.disposed? + end + def setupBitmaps(file,panorama) + if file[/^\[(\d+)\]/] + # File has a frame count + numFrames=$1.to_i + if numFrames<=0 + raise "Invalid frame count in #{file}" + end + if panorama.width % numFrames != 0 + raise "Bitmap's width (#{panorama.width}) is not divisible by frame count: #{file}" + end + subWidth=panorama.width/numFrames + for i in 0...numFrames + subBitmap=Bitmap.new(subWidth,panorama.height) + subBitmap.blt(0,0,panorama,Rect.new(subWidth*i,0,subWidth,panorama.height)) + @frames.push(subBitmap) + end + panorama.dispose + else + @frames=[panorama] + self.bitmap=@frames[0] + end + end + def setPanorama(file, hue=0) + clearBitmaps() + return if file==nil + panorama=BitmapCache.panorama(file, hue) + setupBitmaps(file,panorama) + end + def setFog(file, hue=0) + clearBitmaps() + return if file==nil + panorama=BitmapCache.fog(file, hue) + setupBitmaps(file,panorama) + end + def setBitmap(file, hue=0) + clearBitmaps() + return if file==nil + panorama=BitmapCache.load_bitmap(file, hue) + setupBitmaps(file,panorama) + end +end + Changed: PokemonUtilities @@ -392,1 +392,0 @@ - p d @@ -1404,1 +1403,1 @@ - # optional viewport + # optional viewport. Can also load non-animated bitmaps. @@ -1411,0 +1410,1 @@ + bitmap=nil @@ -1412,5 +1412,18 @@ - if !filestring - filestring=pbGetFileString(file+".gif") - end - if filestring && GifLibrary::PngDll - result=GifLibrary::GifToPngFilesInMemory.call(filestring,filestring.length,File.basename(file)) + filestring=pbGetFileString(file+".gif") if !filestring + filestring=pbGetFileString(file+".png") if !filestring + filestring=pbGetFileString(file+".jpg") if !filestring + filestring=pbGetFileString(file+".bmp") if !filestring + if filestring && filestring[0]!=0x47 + begin + bitmap=BitmapCache.load_bitmap(file) + rescue + bitmap=nil + end + end + if bitmap + # Have a regular non-animated bitmap + @totalframes=1 + @framecount=0 + @gifbitmaps=[bitmap] + @gifdelays=[1] + @sprite.bitmap=@gifbitmaps[0] @@ -1418,17 +1431,24 @@ - result=0 - end - if result>0 - @gifdelays=GifLibrary.getDataFromResult(result) - @totalframes=@gifdelays.pop - for i in 0...@gifdelays.length - @gifdelays[i]=[@gifdelays[i],1].max - bmfile=sprintf("%s%d.png",File.basename(file),i); - if FileTest.exist?(bmfile) - @gifbitmaps.push(Bitmap.new(bmfile)) - File.delete(bmfile) - else - @gifbitmaps.push(Bitmap.new(1,1)) - end - @sprite.bitmap=@gifbitmaps[0] - end - end + if filestring && GifLibrary::PngDll + result=GifLibrary::GifToPngFilesInMemory.call(filestring,filestring.length,File.basename(file)) + else + result=0 + end + if result>0 + @gifdelays=GifLibrary.getDataFromResult(result) + @totalframes=@gifdelays.pop + for i in 0...@gifdelays.length + @gifdelays[i]=[@gifdelays[i],1].max + bmfile=sprintf("%s%d.png",File.basename(file),i); + if FileTest.exist?(bmfile) + @gifbitmaps.push(Bitmap.new(bmfile)) + File.delete(bmfile) + else + @gifbitmaps.push(Bitmap.new(1,1)) + end + @sprite.bitmap=@gifbitmaps[0] + end + end + end + end + def bitmap + @totalframes<=0 ? nil : @gifbitmaps[0] Changed: PokemonItems @@ -869,1 +869,1 @@ - scene.pbRefresh + scene.pbHardRefresh Changed: PokemonScreen @@ -874,0 +874,4 @@ +def pbHardRefresh + @scene.pbHardRefresh +end + Changed: PokemonBugContest @@ -378,0 +378,1 @@ + $PokemonGlobal.nextBattleBack=nil @@ -420,0 +421,1 @@ + $PokemonGlobal.nextBattleBack=nil Changed: TilemapXP Changed: PokemonSafari Changed: Sprite_Picture Changed: PokemonMap Changed: PokemonField Changed: PokeBattle_ActualScene Changed: PokemonLoad Changed: Main Changed: BitmapCache Changed: Spriteset_Map Changed: PokemonEditor Changed: SpriteWindow Changed: PokemonUtilities Changed: PokemonItems Changed: PokemonScreen Changed: PokemonBugContest