From 3ca08f27b80968a5e4ff6536a8bd9db419ad25bf Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 7 Mar 2021 19:16:05 +0000 Subject: [PATCH] Changed functionality of running key, added compatibility with old Mystery Gifts --- .../001_Technical/002_Ruby Utilities.rb | 2 +- Data/Scripts/001_Technical/005_Sockets.rb | 4 +-- .../001b_Save data/005_BuiltinConversions.rb | 4 +-- .../008_Game_Player_Visuals.rb | 2 +- .../006_Game processing/002_Scene_Map.rb | 4 --- .../001_BitmapCache.rb | 6 ++--- .../008_AnimatedBitmap.rb | 4 +-- .../009_Objects and windows/010_DrawText.rb | 4 +-- ...EncounterTypes.rb => 016_EncounterType.rb} | 0 .../013_Overworld/003_PField_Visuals.rb | 2 +- .../013_Overworld/005_PField_Metadata.rb | 2 -- .../014_Trainers/001b_Trainer_deprecated.rb | 2 +- Data/Scripts/017_UI/015_PScreen_Options.rb | 9 ++----- .../Scripts/017_UI/026_PScreen_MysteryGift.rb | 25 +++++++++++++------ .../002_PSystem_System.rb | 6 +++-- 15 files changed, 38 insertions(+), 38 deletions(-) rename Data/Scripts/011_Data/002_Hardcoded data/{016_PBEncounterTypes.rb => 016_EncounterType.rb} (100%) diff --git a/Data/Scripts/001_Technical/002_Ruby Utilities.rb b/Data/Scripts/001_Technical/002_Ruby Utilities.rb index b0f016839..39b4cd343 100644 --- a/Data/Scripts/001_Technical/002_Ruby Utilities.rb +++ b/Data/Scripts/001_Technical/002_Ruby Utilities.rb @@ -162,7 +162,7 @@ class Bitmap end end # Zlib deflation - smoldata = Zlib::Deflate.deflate(data.pack("C*")).bytes.map { |e| e.to_i } + smoldata = Zlib::Deflate.deflate(data.pack("C*")).bytes # data chunk length f.write_int smoldata.size # IDAT diff --git a/Data/Scripts/001_Technical/005_Sockets.rb b/Data/Scripts/001_Technical/005_Sockets.rb index f08407d94..7d1b4f512 100644 --- a/Data/Scripts/001_Technical/005_Sockets.rb +++ b/Data/Scripts/001_Technical/005_Sockets.rb @@ -48,7 +48,7 @@ def pbDownloadData(url, filename = nil, authorization = nil, depth = 0, &block) return ret if !ret.is_a?(Hash) return "" if ret[:status] != 200 return ret[:body] if !filename - File.open(filename, "wb"){|f|f.write(ret[:body])} + File.open(filename, "wb") { |f| f.write(ret[:body]) } return "" end @@ -82,4 +82,4 @@ def pbPostToFile(url, postdata, file) pbPostData(url, postdata,file) rescue end -end \ No newline at end of file +end diff --git a/Data/Scripts/001b_Save data/005_BuiltinConversions.rb b/Data/Scripts/001b_Save data/005_BuiltinConversions.rb index 89943cbcb..a77850fab 100644 --- a/Data/Scripts/001b_Save data/005_BuiltinConversions.rb +++ b/Data/Scripts/001b_Save data/005_BuiltinConversions.rb @@ -39,8 +39,8 @@ SaveData.register_conversion(:v19_convert_player) do display_title 'Converting player trainer class' to_all do |save_data| next if save_data[:player].is_a?(PlayerTrainer) - # Conversion of the party is handled in PokeBattle_Trainer.copy - save_data[:player] = PokeBattle_Trainer.copy(save_data[:player]) + # Conversion of the party is handled in PokeBattle_Trainer.convert + save_data[:player] = PokeBattle_Trainer.convert(save_data[:player]) end end diff --git a/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb b/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb index af9fb70e4..bd5b6bb44 100644 --- a/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb +++ b/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb @@ -24,7 +24,7 @@ class Game_Player < Game_Character @move_route_forcing || $game_temp.message_window_showing || pbMapInterpreterRunning? terrain = pbGetTerrainTag - input = ($PokemonSystem.runstyle==1) ? $PokemonGlobal.runtoggle : Input.press?(Input::SPECIAL) + input = ($PokemonSystem.runstyle == 1) ^ Input.press?(Input::SPECIAL) return input && $PokemonGlobal.runningShoes && !jumping? && !$PokemonGlobal.diving && !$PokemonGlobal.surfing && !$PokemonGlobal.bicycle && !PBTerrain.onlyWalk?(terrain) diff --git a/Data/Scripts/006_Game processing/002_Scene_Map.rb b/Data/Scripts/006_Game processing/002_Scene_Map.rb index bc2b0b3b4..a30e3adfb 100644 --- a/Data/Scripts/006_Game processing/002_Scene_Map.rb +++ b/Data/Scripts/006_Game processing/002_Scene_Map.rb @@ -187,10 +187,6 @@ class Scene_Map unless $game_player.moving? $PokemonTemp.keyItemCalling = true end - elsif Input.trigger?(Input::SPECIAL) - if $PokemonSystem.runstyle==1 - $PokemonGlobal.runtoggle = !$PokemonGlobal.runtoggle - end elsif Input.press?(Input::F9) $game_temp.debug_calling = true if $DEBUG end diff --git a/Data/Scripts/009_Objects and windows/001_BitmapCache.rb b/Data/Scripts/009_Objects and windows/001_BitmapCache.rb index a088f7d4e..d4b62fed2 100644 --- a/Data/Scripts/009_Objects and windows/001_BitmapCache.rb +++ b/Data/Scripts/009_Objects and windows/001_BitmapCache.rb @@ -114,7 +114,7 @@ class BitmapWrapper < Bitmap def dispose return if self.disposed? @refcount -= 1 - super if @refcount == 0 + super if @refcount <= 0 end def initialize(*arg) @@ -265,8 +265,8 @@ module BitmapCache objKey = fromCache(key) if !objKey bitmap = BitmapWrapper.new(Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT) - x = (tile_id - 384) % 8 * 32 - y = (tile_id - 384) / 8 * 32 + x = (tile_id - 384) % 8 * Game_Map::TILE_WIDTH + y = (tile_id - 384) / 8 * Game_Map::TILE_HEIGHT rect = Rect.new(x, y, Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT) tileset = yield(filename) bitmap.blt(0, 0, tileset, rect) diff --git a/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb b/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb index 6e44b5e87..65264cfec 100644 --- a/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb +++ b/Data/Scripts/009_Objects and windows/008_AnimatedBitmap.rb @@ -296,7 +296,7 @@ class GifBitmap end def totalFrames - @totalframes/2 # Due to frame count being incremented by 2 + @totalframes/2 # Due to frame count being incremented by 2 end def disposed? @@ -311,7 +311,7 @@ class GifBitmap @gifbitmaps.length==0 ? 0 : @gifbitmaps[0].height end - # This function must be called in order to animate the GIF image. + # This function must be called in order to animate the GIF image. def update return if disposed? if @gifbitmaps.length>0 diff --git a/Data/Scripts/009_Objects and windows/010_DrawText.rb b/Data/Scripts/009_Objects and windows/010_DrawText.rb index 4c8716b26..783769279 100644 --- a/Data/Scripts/009_Objects and windows/010_DrawText.rb +++ b/Data/Scripts/009_Objects and windows/010_DrawText.rb @@ -592,7 +592,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32, alignstack.push(0) nextline=1 if x>0 && nextline==0 else - alignstack.pop; + alignstack.pop nextline=1 if x>0 && nextline==0 end elsif control=="ac" # Center align @@ -600,7 +600,7 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32, alignstack.push(2) nextline=1 if x>0 && nextline==0 else - alignstack.pop; + alignstack.pop nextline=1 if x>0 && nextline==0 end elsif control=="icon" # Icon diff --git a/Data/Scripts/011_Data/002_Hardcoded data/016_PBEncounterTypes.rb b/Data/Scripts/011_Data/002_Hardcoded data/016_EncounterType.rb similarity index 100% rename from Data/Scripts/011_Data/002_Hardcoded data/016_PBEncounterTypes.rb rename to Data/Scripts/011_Data/002_Hardcoded data/016_EncounterType.rb diff --git a/Data/Scripts/013_Overworld/003_PField_Visuals.rb b/Data/Scripts/013_Overworld/003_PField_Visuals.rb index 76ad71dc9..fc512fbcc 100644 --- a/Data/Scripts/013_Overworld/003_PField_Visuals.rb +++ b/Data/Scripts/013_Overworld/003_PField_Visuals.rb @@ -335,7 +335,7 @@ class LocationWindow @window.dispose return end - if @frames>80 + if @frames > Graphics.frame_rate * 2 @window.y -= 4 @window.dispose if @window.y+@window.height<0 else diff --git a/Data/Scripts/013_Overworld/005_PField_Metadata.rb b/Data/Scripts/013_Overworld/005_PField_Metadata.rb index 3e16e5b84..e77d0c4bd 100644 --- a/Data/Scripts/013_Overworld/005_PField_Metadata.rb +++ b/Data/Scripts/013_Overworld/005_PField_Metadata.rb @@ -10,7 +10,6 @@ class PokemonGlobalMetadata attr_accessor :sliding attr_accessor :fishing attr_accessor :runningShoes - attr_accessor :runtoggle # Player data attr_accessor :startTime attr_accessor :stepcount @@ -71,7 +70,6 @@ class PokemonGlobalMetadata @sliding = false @fishing = false @runningShoes = false - @runtoggle = false # Player data @startTime = Time.now @stepcount = 0 diff --git a/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb b/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb index dbdd7131a..99b063fc9 100644 --- a/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb +++ b/Data/Scripts/014_Trainers/001b_Trainer_deprecated.rb @@ -44,7 +44,7 @@ class PokeBattle_Trainer attr_reader :pokedex, :pokegear attr_reader :mysterygiftaccess, :mysterygift - def self.copy(trainer) + def self.convert(trainer) validate trainer => self ret = PlayerTrainer.new(trainer.name, trainer.trainertype) ret.id = trainer.id diff --git a/Data/Scripts/017_UI/015_PScreen_Options.rb b/Data/Scripts/017_UI/015_PScreen_Options.rb index 1676345c9..8c543eaeb 100644 --- a/Data/Scripts/017_UI/015_PScreen_Options.rb +++ b/Data/Scripts/017_UI/015_PScreen_Options.rb @@ -349,14 +349,9 @@ class PokemonOption_Scene proc { $PokemonSystem.battlestyle }, proc { |value| $PokemonSystem.battlestyle = value } ), - EnumOption.new(_INTL("Running Key"),[_INTL("Hold"),_INTL("Toggle")], + EnumOption.new(_INTL("Default Movement"),[_INTL("Walking"),_INTL("Running")], proc { $PokemonSystem.runstyle }, - proc { |value| - if $PokemonSystem.runstyle!=value - $PokemonSystem.runstyle = value - $PokemonGlobal.runtoggle = false if $PokemonGlobal - end - } + proc { |value| $PokemonSystem.runstyle = value } ), NumberOption.new(_INTL("Speech Frame"),1,Settings::SPEECH_WINDOWSKINS.length, proc { $PokemonSystem.textskin }, diff --git a/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb b/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb index 40ff4f099..d22bb8b5d 100644 --- a/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb +++ b/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb @@ -7,8 +7,7 @@ # NOTE: Essentials cannot handle https addresses. You must use a http address. #=============================================================================== module MysteryGift - URL = "http://images1.wikia.nocookie.net/pokemonessentials/images/e/e7/MysteryGift.txt" - # URL = "http://pastebin.com/raw/w6BqqUsm" + URL = "https://pastebin.com/raw/w6BqqUsm" end #=============================================================================== @@ -57,7 +56,8 @@ def pbEditMysteryGift(type,item,id=0,giftname="") end end if id==0 - master=[]; idlist=[] + master=[] + idlist=[] if safeExists?("MysteryGiftMaster.txt") master=IO.read("MysteryGiftMaster.txt") master=pbMysteryGiftDecrypt(master) @@ -146,7 +146,7 @@ def pbManageMysteryGifts pbMessage(_INTL("Online Mystery Gifts found.\\wtnp[20]")) online=pbMysteryGiftDecrypt(online) t=[] - for gift in online; t.push(gift[0]); end + online.each { |gift| t.push(gift[0]) } online=t end # Show list of all gifts. @@ -155,9 +155,9 @@ def pbManageMysteryGifts commands=pbRefreshMGCommands(master,online) command=pbMessage(_INTL("\\ts[]Manage Mystery Gifts (X=online)."),commands,-1,nil,command) # Gift chosen - if command==-1 || command==commands.length-1 + if command==-1 || command==commands.length-1 # Cancel break - elsif command==commands.length-2 + elsif command==commands.length-2 # Export selected to file begin newfile=[] for gift in master @@ -170,7 +170,7 @@ def pbManageMysteryGifts rescue pbMessage(_INTL("Couldn't save the gifts to MysteryGift.txt.")) end - elsif command>=0 && command=0 && command