diff --git a/Data/Scripts/001_Technical/006_DebugConsole.rb b/Data/Scripts/001_Technical/006_DebugConsole.rb index 10b5b1f50..2b87d941f 100644 --- a/Data/Scripts/001_Technical/006_DebugConsole.rb +++ b/Data/Scripts/001_Technical/006_DebugConsole.rb @@ -4,24 +4,23 @@ module Console def self.setup_console return unless $DEBUG - echo "#{System.game_title} Output Window\n" - echo "-------------------------------\n" - echo "If you are seeing this window, you are running\n" - echo "#{System.game_title} in Debug Mode. This means\n" - echo "that you're either playing a Debug Version, or\n" - echo "you are playing from within RPG Maker XP.\n" - echo "\n" - echo "Closing this window will close the game. If \n" - echo "you want to get rid of this window, run the\n" - echo "program from the Shell, or download a Release\n" - echo "version.\n" - echo "\n" - echo "Gameplay will be paused while the console has\n" - echo "focus. To resume playing, switch to the Game\n" - echo "Window.\n" - echo "-------------------------------\n" - echo "Debug Output:\n" - echo "-------------------------------\n\n" + echoln "--------------------------------" + echoln "#{System.game_title} Output Window" + echoln "--------------------------------" + echoln "If you are seeing this window, you are running" + echoln "#{System.game_title} in Debug Mode. This means" + echoln "that you're either playing a Debug Version, or" + echoln "you are playing from within RPG Maker XP." + echoln "" + echoln "Closing this window will close the game. If" + echoln "you want to get rid of this window, run the" + echoln "program from the Shell, or download a Release" + echoln "version." + echoln "" + echoln "--------------------------------" + echoln "Debug Output:" + echoln "--------------------------------" + echoln "" end def self.readInput @@ -37,13 +36,9 @@ module Console end end - - module Kernel def echo(string) - unless $DEBUG - return - end + return unless $DEBUG printf(string.is_a?(String) ? string : string.inspect) end @@ -52,3 +47,5 @@ module Kernel echo("\r\n") end end + +Console.setup_console diff --git a/Data/Scripts/001_Technical/011_Input.rb b/Data/Scripts/001_Technical/011_Input.rb index cd0836ff2..68dd78128 100644 --- a/Data/Scripts/001_Technical/011_Input.rb +++ b/Data/Scripts/001_Technical/011_Input.rb @@ -2,6 +2,19 @@ module Input USE = C BACK = B SPECIAL = A + + unless defined?(update_KGC_ScreenCapture) + class << Input + alias update_KGC_ScreenCapture update + end + end + + def self.update + update_KGC_ScreenCapture + if trigger?(Input::F8) + pbScreenCapture + end + end end module Mouse diff --git a/Data/Scripts/006_Map renderer/001_Tilemap_XP.rb b/Data/Scripts/006_Map renderer/001_Tilemap_XP.rb index 4204faa08..dd01df122 100644 --- a/Data/Scripts/006_Map renderer/001_Tilemap_XP.rb +++ b/Data/Scripts/006_Map renderer/001_Tilemap_XP.rb @@ -122,7 +122,6 @@ end -#Console::setup_console class CustomTilemapSprite < Sprite end diff --git a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb index 7dc18aefc..80895bd44 100644 --- a/Data/Scripts/007_Objects and windows/002_MessageConfig.rb +++ b/Data/Scripts/007_Objects and windows/002_MessageConfig.rb @@ -40,31 +40,31 @@ module MessageConfig end def self.pbDefaultSystemFrame - begin + if $PokemonSystem return pbResolveBitmap("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[$PokemonSystem.frame]) || "" - rescue + else return pbResolveBitmap("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[0]) || "" end end def self.pbDefaultSpeechFrame - begin + if $PokemonSystem return pbResolveBitmap("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[$PokemonSystem.textskin]) || "" - rescue + else return pbResolveBitmap("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[0]) || "" end end def self.pbDefaultSystemFontName - begin + if $PokemonSystem return MessageConfig.pbTryFonts(Settings::FONT_OPTIONS[$PokemonSystem.font], "Arial Narrow", "Arial") - rescue + else return MessageConfig.pbTryFonts(Settings::FONT_OPTIONS[0], "Arial Narrow", "Arial") end end def self.pbDefaultTextSpeed - return pbSettingToTextSpeed(($PokemonSystem.textspeed rescue nil)) + return ($PokemonSystem) ? pbSettingToTextSpeed($PokemonSystem.textspeed) : pbSettingToTextSpeed(nil) end def self.pbSettingToTextSpeed(speed) diff --git a/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb b/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb index c47089256..6d71e87f8 100644 --- a/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb +++ b/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb @@ -208,12 +208,12 @@ Events.onSpritesetCreate += proc { |_sender,e| if map.events[i].name[/^outdoorlight\((\w+)\)$/i] filename = $~[1].to_s spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map,filename)) - elsif map.events[i].name.downcase=="outdoorlight" + elsif map.events[i].name[/^outdoorlight$/i] spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map)) elsif map.events[i].name[/^light\((\w+)\)$/i] filename = $~[1].to_s spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map,filename)) - elsif map.events[i].name.downcase=="light" + elsif map.events[i].name[/^light$/i] spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map)) end end diff --git a/Data/Scripts/013_Overworld/004_Overworld_FieldMoves.rb b/Data/Scripts/013_Overworld/004_Overworld_FieldMoves.rb index de9576c32..114070572 100644 --- a/Data/Scripts/013_Overworld/004_Overworld_FieldMoves.rb +++ b/Data/Scripts/013_Overworld/004_Overworld_FieldMoves.rb @@ -205,7 +205,7 @@ end HiddenMoveHandlers::CanUseMove.add(:CUT,proc { |move,pkmn,showmsg| next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_CUT,showmsg) facingEvent = $game_player.pbFacingEvent - if !facingEvent || !facingEvent.name[/tree/i] + if !facingEvent || !facingEvent.name[/cuttree/i] pbMessage(_INTL("Can't use that here.")) if showmsg next false end @@ -225,8 +225,10 @@ HiddenMoveHandlers::UseMove.add(:CUT,proc { |move,pokemon| def pbSmashEvent(event) return if !event - if event.name[/tree/i]; pbSEPlay("Cut",80) - elsif event.name[/rock/i]; pbSEPlay("Rock Smash",80) + if event.name[/cuttree/i] + pbSEPlay("Cut",80) + elsif event.name[/smashrock/i] + pbSEPlay("Rock Smash",80) end pbMoveRoute(event,[ PBMoveRoute::Wait,2, @@ -618,7 +620,7 @@ end HiddenMoveHandlers::CanUseMove.add(:ROCKSMASH,proc { |move,pkmn,showmsg| next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKSMASH,showmsg) facingEvent = $game_player.pbFacingEvent - if !facingEvent || !facingEvent.name[/rock/i] + if !facingEvent || !facingEvent.name[/smashrock/i] pbMessage(_INTL("Can't use that here.")) if showmsg next false end @@ -667,7 +669,7 @@ end Events.onAction += proc { |_sender,_e| facingEvent = $game_player.pbFacingEvent - pbStrength if facingEvent && facingEvent.name[/boulder/i] + pbStrength if facingEvent && facingEvent.name[/strengthboulder/i] } HiddenMoveHandlers::CanUseMove.add(:STRENGTH,proc { |move,pkmn,showmsg| diff --git a/Data/Scripts/013_Overworld/006_Overworld_BerryPlants.rb b/Data/Scripts/013_Overworld/006_Overworld_BerryPlants.rb index f4c04d8e0..5b82a5141 100644 --- a/Data/Scripts/013_Overworld/006_Overworld_BerryPlants.rb +++ b/Data/Scripts/013_Overworld/006_Overworld_BerryPlants.rb @@ -3,7 +3,7 @@ Events.onSpritesetCreate += proc { |_sender,e| viewport = e[1] map = spriteset.map for i in map.events.keys - if map.events[i].name.downcase=="berryplant" + if map.events[i].name[/berryplant/i] spriteset.addUserSprite(BerryPlantMoistureSprite.new(map.events[i],map,viewport)) spriteset.addUserSprite(BerryPlantSprite.new(map.events[i],map,viewport)) end diff --git a/Data/Scripts/020_System and utilities/002_PSystem_System.rb b/Data/Scripts/020_System and utilities/002_PSystem_System.rb deleted file mode 100644 index 070388d8c..000000000 --- a/Data/Scripts/020_System and utilities/002_PSystem_System.rb +++ /dev/null @@ -1,48 +0,0 @@ -def pbChooseLanguage - commands=[] - for lang in Settings::LANGUAGES - commands.push(lang[0]) - end - return pbShowCommands(nil,commands) -end - -def pbScreenCapture - t = pbGetTimeNow - 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)) - Graphics.screenshot(capturefile) - pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full") -end - -def pbDebugF7 - if $DEBUG - Console::setup_console - begin - debugBitmaps - rescue - end - pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full") - end -end - - - -module Input - unless defined?(update_KGC_ScreenCapture) - class << Input - alias update_KGC_ScreenCapture update - end - end - - def self.update - update_KGC_ScreenCapture - if trigger?(Input::F8) - pbScreenCapture - end - if trigger?(Input::F7) - pbDebugF7 - end - end -end diff --git a/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb b/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb index d03174b33..801ff4963 100644 --- a/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb +++ b/Data/Scripts/020_System and utilities/005_PSystem_Utilities.rb @@ -624,3 +624,21 @@ def pbLoadRpgxpScene(scene) pbShowObjects(visibleObjects) Graphics.transition(20) end + +def pbChooseLanguage + commands=[] + for lang in Settings::LANGUAGES + commands.push(lang[0]) + end + return pbShowCommands(nil,commands) +end + +def pbScreenCapture + t = pbGetTimeNow + 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)) + Graphics.screenshot(capturefile) + pbSEPlay("Pkmn exp full") if FileTest.audio_exist?("Audio/SE/Pkmn exp full") +end diff --git a/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb index 33b6bc89b..2006b134b 100644 --- a/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb @@ -433,6 +433,22 @@ DebugMenuCommands.register("roamers", { } }) +DebugMenuCommands.register("encounterversion", { + "parent" => "battlemenu", + "name" => _INTL("Set encounters version"), + "description" => _INTL("Choose which version of wild encounters should be used."), + "effect" => proc { + params = ChooseNumberParams.new + params.setRange(0, 99) + params.setInitialValue($PokemonGlobal.encounter_version) + params.setCancelValue(-1) + value = pbMessageChooseNumber(_INTL("Set encounters version to which value?"), params) + if value >= 0 + $PokemonGlobal.encounter_version = value + end + } +}) + #=============================================================================== # Item options #=============================================================================== @@ -1059,19 +1075,66 @@ DebugMenuCommands.register("compiledata", { "always_show" => true, "effect" => proc { msgwindow = pbCreateMessageWindow - Compiler.compile_all(true) { |msg| pbMessageDisplay(msgwindow, msg, false) } + Compiler.compile_all(true) { |msg| pbMessageDisplay(msgwindow, msg, false); echoln(msg) } pbMessageDisplay(msgwindow, _INTL("All game data was compiled.")) pbDisposeMessageWindow(msgwindow) } }) -DebugMenuCommands.register("debugconsole", { +DebugMenuCommands.register("createpbs", { "parent" => "othermenu", - "name" => _INTL("Debug Console"), - "description" => _INTL("Open the Debug Console."), + "name" => _INTL("Create PBS file(s)"), + "description" => _INTL("Choose one or all PBS files and create it."), "always_show" => true, "effect" => proc { - Console::setup_console + cmd = 0 + cmds = [ + _INTL("[Create all]"), + "abilities.txt", + "berryplants.txt", + "connections.txt", + "encounters.txt", + "items.txt", + "metadata.txt", + "moves.txt", + "phone.txt", + "pokemon.txt", + "pokemonforms.txt", + "regionaldexes.txt", + "ribbons.txt", + "shadowmoves.txt", + "townmap.txt", + "trainerlists.txt", + "trainers.txt", + "trainertypes.txt", + "types.txt" + ] + loop do + cmd = pbShowCommands(nil, cmds, -1, cmd) + case cmd + when 0 then Compiler.write_all + when 1 then Compiler.write_abilities + when 2 then Compiler.write_berry_plants + when 3 then Compiler.write_connections + when 4 then Compiler.write_encounters + when 5 then Compiler.write_items + when 6 then Compiler.write_metadata + when 7 then Compiler.write_moves + when 8 then Compiler.write_phone + when 9 then Compiler.write_pokemon + when 10 then Compiler.write_pokemon_forms + when 11 then Compiler.write_regional_dexes + when 12 then Compiler.write_ribbons + when 13 then Compiler.write_shadow_movesets + when 14 then Compiler.write_town_map + when 15 then Compiler.write_trainer_lists + when 16 then Compiler.write_trainers + when 17 then Compiler.write_trainer_types + when 18 then Compiler.write_types + else break + end + pbMessage(_INTL("File written.")) + end } }) diff --git a/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb b/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb index 7256e3971..1598d6e1d 100644 --- a/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb +++ b/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb @@ -619,6 +619,39 @@ PokemonDebugMenuCommands.register("setinitialmoves", { #=============================================================================== # Other options #=============================================================================== +PokemonDebugMenuCommands.register("setitem", { + "parent" => "main", + "name" => _INTL("Set item"), + "always_show" => true, + "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| + cmd = 0 + commands = [ + _INTL("Change item"), + _INTL("Remove item") + ] + loop do + msg = (pkmn.hasItem?) ? _INTL("Item is {1}.", pkmn.item.name) : _INTL("No item.") + cmd = screen.pbShowCommands(msg, commands, cmd) + break if cmd < 0 + case cmd + when 0 # Change item + item = pbChooseItemList(pkmn.item_id) + if item && item != pkmn.item_id + pkmn.item = item + screen.pbRefreshSingle(pkmnid) + end + when 1 # Remove item + if pkmn.hasItem? + pkmn.item = nil + screen.pbRefreshSingle(pkmnid) + end + else + break + end + end + } +}) + PokemonDebugMenuCommands.register("setability", { "parent" => "main", "name" => _INTL("Set ability"), @@ -677,8 +710,8 @@ PokemonDebugMenuCommands.register("setnature", { commands.push(_INTL("[Reset]")) cmd = ids.index(pkmn.nature_id || ids[0]) loop do - mag = _INTL("Nature is {1}.", pkmn.nature.name) - cmd = screen.pbShowCommands(mag, commands, cmd) + msg = _INTL("Nature is {1}.", pkmn.nature.name) + cmd = screen.pbShowCommands(msg, commands, cmd) break if cmd < 0 if cmd >= 0 && cmd < commands.length - 1 # Set nature pkmn.nature = ids[cmd] diff --git a/Data/Scripts/022_Compiler/001_Compiler.rb b/Data/Scripts/022_Compiler/001_Compiler.rb index ea3163b2d..f464cc253 100644 --- a/Data/Scripts/022_Compiler/001_Compiler.rb +++ b/Data/Scripts/022_Compiler/001_Compiler.rb @@ -681,6 +681,9 @@ module Compiler MessageTypes.loadMessageFile("Data/messages.dat") end if mustCompile + echoln "" + echoln _INTL("*** Starting full compile ***") + echoln "" yield(_INTL("Compiling town map data")) compile_town_map # No dependencies yield(_INTL("Compiling map connection data")) @@ -728,6 +731,9 @@ module Compiler MessageTypes.saveMessages yield(_INTL("Renaming sprites and cries")) convert_files + echoln "" + echoln _INTL("*** Finished full compile ***") + echoln "" end pbSetWindowText(nil) System.reload_cache @@ -798,13 +804,13 @@ module Compiler if mustCompile for i in 0...dataFiles.length begin - File.delete("Data/#{dataFiles[i]}") + File.delete("Data/#{dataFiles[i]}") if File.exists?("Data/#{dataFiles[i]}") rescue SystemCallError end end end # Recompile all data - compile_all(mustCompile) { |msg| pbSetWindowText(msg) } + compile_all(mustCompile) { |msg| pbSetWindowText(msg); echoln(msg) } rescue Exception e = $! raise e if "#{e.class}"=="Reset" || e.is_a?(Reset) || e.is_a?(SystemExit) diff --git a/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb index 4c75ccac0..99aa05add 100644 --- a/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/022_Compiler/004_Compiler_MapsAndEvents.rb @@ -447,7 +447,7 @@ module Compiler if isFirstCommand if !event.name[/trainer/i] ret.name = "Trainer(3)" - elsif event.name[/^\s*trainer\s+\((\d+)\)\s*$/i] + elsif event.name[/^\s*trainer\s*\((\d+)\)\s*$/i] ret.name = "Trainer(#{$1})" end end @@ -680,12 +680,12 @@ module Compiler ret.pages = [] itemName = "" hidden = false - if name[/^HiddenItem\:\s*(\w+)\s*$/] + if name[/^hiddenitem\:\s*(\w+)\s*$/i] itemName = $1 return nil if !GameData::Item.exists?(itemName) ret.name = "HiddenItem" hidden = true - elsif name[/^Item\:\s*(\w+)\s*$/] + elsif name[/^item\:\s*(\w+)\s*$/i] itemName = $1 return nil if !GameData::Item.exists?(itemName) ret.name = "Item" @@ -835,6 +835,21 @@ module Compiler return changed end + def fix_event_name(event) + return false if !event + case event.name.downcase + when "tree" + event.name = "CutTree" + when "rock" + event.name = "SmashRock" + when "boulder" + event.name = "StrengthBoulder" + else + return false + end + return true + end + def fix_event_use(event,_mapID,mapData) return nil if event_is_empty?(event) changed = false @@ -1385,6 +1400,7 @@ module Compiler map.events[key] = newevent changed = true end + changed = true if fix_event_name(map.events[key]) newevent = fix_event_use(map.events[key],id,mapData) if newevent map.events[key] = newevent