Changed: TilemapXP @@ -254,1 +254,1 @@ - return if !autotile + return if !autotile || autotile.disposed? Changed: PokemonMap @@ -258,0 +258,4 @@ + attr_accessor :language + def language + return (!@language) ? 0 : @language + end @@ -270,0 +274,1 @@ + @language=0 Changed: PokemonOption @@ -227,1 +227,1 @@ - NumberOption.new(_INTL("FRAME"),_INTL("TYPE%d"),1,28), + NumberOption.new(_INTL("FRAME"),_INTL("TYPE%d"),1,$TextFrames.length), @@ -230,1 +230,2 @@ - EnumOption2.new(_INTL("SPEECH FRAME"),[_INTL("DEFAULT"),_INTL("R/S"),_INTL("FIRE/LEAF"),_INTL("EMERALD")]) + NumberOption.new(_INTL("SPEECH FRAME"),_INTL("TYPE%d"),1,$SpeechFrames.length) +# EnumOption2.new(_INTL("SPEECH FRAME"),[_INTL("DEFAULT"),_INTL("R/S"),_INTL("FIRE/LEAF"),_INTL("EMERALD")]) @@ -259,1 +260,1 @@ - end + end Changed: PokemonDayCare @@ -1,0 +1,6 @@ +################################# + +EGGINITIALLEVEL = 5 + +################################# + @@ -155,0 +161,3 @@ + if ret!=species + ret=pbGetBaby(ret) + end @@ -319,1 +328,1 @@ - egg=PokeBattle_Pokemon.new(babyspecies,5,$Trainer) + egg=PokeBattle_Pokemon.new(babyspecies,EGGINITIALLEVEL,$Trainer) Changed: PokeBattle_Effects @@ -91,1 +91,2 @@ - @battle.pbDisplay(_INTL("{1}'s Synchronize had no effect on {2}!",opponent.pbThis,pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} had no effect on {3}!",opponent.pbThis, + PBAbilities.getName(opponent.ability),pbThis)) @@ -98,1 +99,4 @@ - @battle.pbDisplay(_INTL("{1}'s Immunity prevents {2}'s Synchronize from working!",pbThis,opponent.pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} prevents {3}'s {4} from working!", + pbThis,PBAbilities.getName(self.ability), + opponent.pbThis,PBAbilities.getName(opponent.ability) + )) @@ -297,1 +301,4 @@ - @battle.pbDisplay(_INTL("{1}'s Water Veil prevented {2}'s Synchronize from working!",pbThis,opponent.pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} prevents {3}'s {4} from working!", + pbThis,PBAbilities.getName(self.ability), + opponent.pbThis,PBAbilities.getName(opponent.ability) + )) Changed: PokemonMenu @@ -113,1 +113,1 @@ - @scene.pbShowInfo(_INTL("STEPS: {1}/600
BALLS: {2}",pbSafariState.steps,pbSafariState.ballcount)) + @scene.pbShowInfo(_INTL("STEPS: {1}/600\nBALLS: {2}",pbSafariState.steps,pbSafariState.ballcount)) @@ -117,1 +117,1 @@ - @scene.pbShowInfo(_INTL("CAUGHT: {1}
LEVEL: {2}
BALLS: {3}", + @scene.pbShowInfo(_INTL("CAUGHT: {1}\nLEVEL: {2}\nBALLS: {3}", @@ -122,1 +122,1 @@ - @scene.pbShowInfo(_INTL("CAUGHT: None
BALLS: {1}",pbBugContestState.ballcount)) + @scene.pbShowInfo(_INTL("CAUGHT: None\nBALLS: {1}",pbBugContestState.ballcount)) Changed: PokeBattle_MoveEffects @@ -124,1 +124,1 @@ - @battle.pbDisplay(_INTL("{1}'s Attack won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Attack won't go higher!",attacker.pbThis)) @@ -139,1 +139,1 @@ - @battle.pbDisplay(_INTL("{1}'s Defense won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Defense won't go higher!",attacker.pbThis)) @@ -158,1 +158,1 @@ - @battle.pbDisplay(_INTL("{1}'s Special Attack won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Special Attack won't go higher!",attacker.pbThis)) @@ -180,1 +180,1 @@ - @battle.pbDisplay(_INTL("{1}'s evasiveness won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s evasiveness won't go higher!",attacker.pbThis)) @@ -674,1 +674,1 @@ - @battle.pbDisplay(_INTL("{1}'s Attack won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Attack won't go higher!",attacker.pbThis)) @@ -690,1 +690,1 @@ - @battle.pbDisplay(_INTL("{1}'s Defense won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Defense won't go higher!",attacker.pbThis)) @@ -706,1 +706,1 @@ - @battle.pbDisplay(_INTL("{1}'s Speed won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Speed won't go higher!",attacker.pbThis)) @@ -722,1 +722,1 @@ - @battle.pbDisplay(_INTL("{1}'s Special Attack won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Special Attack won't go higher!",attacker.pbThis)) @@ -738,1 +738,1 @@ - @battle.pbDisplay(_INTL("{1}'s Special Defense won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Special Defense won't go higher!",attacker.pbThis)) @@ -1465,1 +1465,1 @@ - @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,ability.name,@name)) + @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name)) @@ -1509,1 +1509,1 @@ - @battle.pbDisplay(_INTL("{1}'s evasiveness won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s evasiveness won't go higher!",attacker.pbThis)) @@ -2335,1 +2335,1 @@ - @battle.pbDisplay(_INTL("{1}'s Defense won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s Defense won't go higher!",attacker.pbThis)) @@ -2895,1 +2895,2 @@ - @battle.pbDisplay(_INTL("{1}'s Sticky Hold made {2} ineffective!",opponent.pbThis,@name)) + abilityname=PBAbilities.getName(opponent.ability) + @battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",opponent.pbThis,abilityname,@name)) @@ -3206,1 +3207,1 @@ - @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis)) @@ -3230,1 +3231,1 @@ - @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis)) @@ -3275,1 +3276,1 @@ - @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis)) @@ -3296,1 +3297,1 @@ - @battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",attacker.pbThis)) + @battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis)) Changed: RTPAndRegistry @@ -481,0 +481,40 @@ + +def getPlayMusic + begin + ret=true + Win32::Registry.open( + Win32::Registry::HKEY_CURRENT_USER,"SOFTWARE\\Enterbrain\\RGSS"){|key| + ret=(key["PlayMusic"] == 1) + } + return ret + rescue + return true + end +end + +def getPlaySound + begin + ret=true + Win32::Registry.open( + Win32::Registry::HKEY_CURRENT_USER,"SOFTWARE\\Enterbrain\\RGSS"){|key| + ret=(key["PlaySound"] == 1) + } + return ret + rescue + p $!.message,$!.class.name + return true + end +end + +def getButtonAssign + begin + Win32::Registry.open( + Win32::Registry::HKEY_CURRENT_USER,"SOFTWARE\\Enterbrain\\RGSS"){|key| + return key.read_bin("ButtonAssign") + } + rescue + p $!.message,$!.class.name + return nil + end +end + Changed: PBIntl @@ -8,-1 +8,10 @@ + } +end + +def pbAddRgssScriptTexts(items,script) + script.scan(/(?:_INTL|_ISPRINTF)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/){|s| + string=s[0] + string.gsub!(/\\r/,"\r") + string.gsub!(/\\n/,"\n") + string.gsub!(/\\\"/,"\"") + string.gsub!(/\\\\/,"\\") @@ -24,8 +35,1 @@ - scr.scan(/(?:_INTL|_ISPRINTF)\s*\(\s*\"((?:[^\\\"]*\\\"?)*[^\"]*)\"/){|s| - string=s[0] - string.gsub!(/\\r/,"\r") - string.gsub!(/\\n/,"\n") - string.gsub!(/\\\"/,"\"") - string.gsub!(/\\\\/,"\\") - texts.push(string) - } + pbAddRgssScriptTexts(texts,scr) @@ -38,1 +42,3 @@ - MessageTypes.setMapMessagesAsHash(0,texts) + # Must add messages since this code is shared by game system + # and editor + MessageTypes.addMapMessagesAsHash(0,texts) @@ -277,0 +283,196 @@ +class Messages + def initialize(filename=nil,delayLoad=false) + @messages=nil + @filename=filename + if @filename && !delayLoad + loadMessageFile(filename) + end + end + def delayedLoad + if @filename && !@messages + loadMessageFile(filename) + @filename=nil + end + end + def self.stringToKey(str) + if str[/[\r\n\t]|^\s+|\s+$|\s{2,}/] + key=str.clone + key.gsub!(/^\s+/,"") + key.gsub!(/\s+$/,"") + key.gsub!(/\s{2,}/," ") + return key + end + return str + end + def self.normalizeValue(value) + if value[/[\r\n\t]|^[\[\]]/] + ret=value.clone + ret.gsub!(/\r/,"<>") + ret.gsub!(/\n/,"<>") + ret.gsub!(/\t/,"<>") + ret.gsub!(/\[/,"<<[>>") + ret.gsub!(/\]/,"<<]>>") + return ret + end + return value + end + def self.denormalizeValue(value) + if value[/<<[rnt\[\]]>>/] + ret=value.clone + ret.gsub!(/<>/,"\r") + ret.gsub!(/<>/,"\n") + ret.gsub!(/<<\[>>/,"[") + ret.gsub!(/<<\]>>/,"]") + ret.gsub!(/<>/,"\t") + return ret + end + return value + end + def self.writeObject(f,msgs,secname,origMessages=nil) + return if !msgs + if msgs.is_a?(Array) + f.write("[#{secname}]\r\n") + for j in 0...msgs.length + next if msgs[j]==nil || msgs[j]=="" + value=Messages.normalizeValue(msgs[j]) + origValue="" + if origMessages + origValue=Messages.normalizeValue(origMessages.get(secname,j)) + else + origValue=Messages.normalizeValue(MessageTypes.get(secname,j)) + end + f.write("#{j}\r\n") + f.write(origValue+"\r\n") + f.write(value+"\r\n") + end + elsif msgs.is_a?(OrderedHash) + f.write("[#{secname}]\r\n") + keys=msgs.keys + for key in keys + next if msgs[key]==nil || msgs[key]=="" + value=Messages.normalizeValue(msgs[key]) + valkey=Messages.normalizeValue(key) + # key is already serialized + f.write(valkey+"\r\n") + f.write(value+"\r\n") + end + end + end + def messages + return @messages || [] + end + def extract(outfile) + return if !@messages + origMessages=Messages.new("Data/messages.dat") + File.open(outfile,"wb"){|f| + f.write(0xef.chr) + f.write(0xbb.chr) + f.write(0xbf.chr) + f.write("# To localize this text for a particular language, please\r\n") + f.write("# translate every second line of this file.\r\n") + if @messages[0] + for i in 0...@messages[0].length + msgs=@messages[0][i] + Messages.writeObject(f,msgs,"Map#{i}",origMessages) + end + end + for i in 1...@messages.length + msgs=@messages[i] + Messages.writeObject(f,msgs,i,origMessages) + end + } + end + def setMessages(type,array) + arr=[] + @messages=[] if !@messages + for i in 0...array.length + arr[i]=(array[i]) ? array[i] : "" + end + @messages[type]=arr + end + def self.createHash(type,array) + arr=OrderedHash.new + for i in 0...array.length + if array[i] + key=Messages.stringToKey(array[i]) + arr[key]=array[i] + end + end + return arr + end + def self.addToHash(type,array,hash) + if !hash + hash=OrderedHash.new + end + for i in 0...array.length + if array[i] + key=Messages.stringToKey(array[i]) + hash[key]=array[i] + end + end + return hash + end + def setMapMessagesAsHash(type,array) + @messages=[] if !@messages + @messages[0]=[] if !@messages[0] + @messages[0][type]=Messages.createHash(type,array) + end + def addMapMessagesAsHash(type,array) + @messages=[] if !@messages + @messages[0]=[] if !@messages[0] + @messages[0][type]=Messages.addToHash(type,array,@messages[0][type]) + end + def setMessagesAsHash(type,array) + @messages=[] if !@messages + @messages[type]=Messages.createHash(type,array) + end + def saveMessages(filename=nil) + filename="Data/messages.dat" if !filename + File.open(filename,"wb"){|f| + Marshal.dump(@messages,f) + } + end + def loadMessageFile(filename) + begin + Kernel.pbRgssOpen(filename,"rb"){|f| + @messages=Marshal.load(f) + } + return @messages + rescue + p $!.message,$!.backtrace + @messages=nil + return nil + end + end + def set(type,id,value) + delayedLoad + return if !@messages + return if !@messages[type] + @messages[type][id]=value + end + def get(type,id) + delayedLoad + return "" if !@messages + return "" if !@messages[type] + return "" if !@messages[type][id] + return @messages[type][id] + end + def getFromHash(type,key) + delayedLoad + return key if !@messages + return key if !@messages[type] + id=Messages.stringToKey(key) + return key if !@messages[type][id] + return @messages[type][id] + end + def getFromMapHash(type,key) + delayedLoad + return key if !@messages + return key if !@messages[0] + return key if !@messages[0][type] + id=Messages.stringToKey(key) + return key if !@messages[0][type][id] + return @messages[0][type][id] + end +end + @@ -294,1 +496,2 @@ - @@messages=nil + @@messages=Messages.new + @@messagesFallback=Messages.new("Data/messages.dat",true) @@ -296,8 +499,1 @@ - if str[/[\r\n\t]|^\s+|\s+$|\s{2,}/] - key=str.clone - key.gsub!(/^\s+/,"") - key.gsub!(/\s+$/,"") - key.gsub!(/\s{2,}/," ") - return key - end - return str + return Messages.stringToKey(str) @@ -306,10 +502,1 @@ - if value[/[\r\n\t]|^[\[\]]/] - ret=value.clone - ret.gsub!(/\r/,"<>") - ret.gsub!(/\n/,"<>") - ret.gsub!(/\t/,"<>") - ret.gsub!(/\[/,"<<[>>") - ret.gsub!(/\]/,"<<]>>") - return ret - end - return value + return Messages.normalizeValue(value) @@ -318,10 +505,1 @@ - if value[/<<[rnt\[\]]>>/] - ret=value.clone - ret.gsub!(/<>/,"\r") - ret.gsub!(/<>/,"\n") - ret.gsub!(/<<\[>>/,"[") - ret.gsub!(/<<\]>>/,"]") - ret.gsub!(/<>/,"\t") - return ret - end - return value + Messages.denormalizeValue(value) @@ -330,22 +508,1 @@ - return if !msgs - if msgs.is_a?(Array) - f.write("[#{secname}]\r\n") - for j in 0...msgs.length - next if msgs[j]==nil || msgs[j]=="" - value=self.normalizeValue(msgs[j]) - f.write("#{j}\r\n") - f.write(value+"\r\n") - f.write(value+"\r\n") - end - elsif msgs.is_a?(OrderedHash) - f.write("[#{secname}]\r\n") - keys=msgs.keys - for key in keys - next if msgs[key]==nil || msgs[key]=="" - value=self.normalizeValue(msgs[key]) - valkey=self.normalizeValue(key) - # key is already serialized - f.write(valkey+"\r\n") - f.write(value+"\r\n") - end - end + Messages.denormalizeValue(str) @@ -354,18 +511,1 @@ - return if !@@messages - File.open(outfile,"wb"){|f| - f.write(0xef.chr) - f.write(0xbb.chr) - f.write(0xbf.chr) - f.write("# To localize this text for a particular language, please\r\n") - f.write("# translate every second line of this file.\r\n") - if @@messages[0] - for i in 0...@@messages[0].length - msgs=@@messages[0][i] - self.writeObject(f,msgs,"Map#{i}") - end - end - for i in 1...@@messages.length - msgs=@@messages[i] - self.writeObject(f,msgs,"#{i}") - end - } + @@messages.extract(outfile) @@ -374,6 +514,1 @@ - arr=[] - @@messages=[] if !@@messages - for i in 0...array.length - arr[i]=(array[i]) ? array[i] : "" - end - @@messages[type]=arr + @@messages.setMessages(type,array) @@ -382,8 +517,4 @@ - arr=OrderedHash.new - for i in 0...array.length - if array[i] - key=self.stringToKey(array[i]) - arr[key]=array[i] - end - end - return arr + Messages.createHash(type,array) + end + def self.addMapMessagesAsHash(type,array) + @@messages.addMapMessagesAsHash(type,array) @@ -392,3 +523,1 @@ - @@messages=[] if !@@messages - @@messages[0]=[] if !@@messages[0] - @@messages[0][type]=self.createHash(type,array) + @@messages.setMapMessagesAsHash(type,array) @@ -397,7 +526,4 @@ - @@messages=[] if !@@messages - @@messages[type]=self.createHash(type,array) - end - def self.saveMessages - File.open("Data/messages.dat","wb"){|f| - Marshal.dump(@@messages,f) - } + @@messages.setMessagesAsHash(type,array) + end + def self.saveMessages(filename=nil) + @@messages.saveMessages(filename) @@ -406,21 +532,1 @@ - begin - pbRgssOpen(filename,"rb"){|f| - @@messages=Marshal.load(f) - } - return @@messages - rescue - @@messages=nil - return nil - end - end - def self.loadMessages - if !@@messages - begin - pbRgssOpen("Data/messages.dat","rb"){|f| - @@messages=Marshal.load(f) - } - rescue Errno::ENOENT - return nil - end - end - return @@messages + @@messages.loadMessageFile(filename) @@ -429,5 +535,8 @@ - self.loadMessages - return "" if !@@messages - return "" if !@@messages[type] - return "" if !@@messages[type][id] - return @@messages[type][id] + ret=@@messages.get(type,id) + if ret=="" + ret=@@messagesFallback.get(type,id) + end + return ret + end + def self.getOriginal(type,id) + return @@messagesFallback.get(type,id) @@ -436,6 +545,1 @@ - self.loadMessages - id=self.stringToKey(key) - return key if !@@messages - return key if !@@messages[type] - return key if !@@messages[type][id] - return @@messages[type][id] + @@messages.getFromHash(type,key) @@ -444,7 +548,1 @@ - self.loadMessages - id=self.stringToKey(key) - return key if !@@messages - return key if !@@messages[0] - return key if !@@messages[0][type] - return key if !@@messages[0][type][id] - return @@messages[0][type][id] + @@messages.getFromMapHash(type,key) Changed: AnimationSprite @@ -81,0 +81,1 @@ + return if @tilemap.disposed? Changed: PokemonField @@ -156,9 +156,2 @@ - skin=$PokemonSystem.textskin - case skin - when 1 - return "rstextskin" - when 2 - return "frlgtextskin" - when 3 - return "emtextskin" - else + skin=$PokemonSystem ? $PokemonSystem.textskin : nil + if !skin || !$SpeechFrames[skin] @@ -167,0 +160,2 @@ + else + return $SpeechFrames[skin] @@ -998,0 +993,1 @@ + return if !scene || !scene.spriteset @@ -1033,4 +1029,5 @@ - -def Kernel.pbOnSpritesetCreate(spriteset,viewport) - map=spriteset.map - for i in map.events.keys +Events.onSpritesetCreate+=proc{|sender,e| + spriteset=e[0] + viewport=e[1] + map=spriteset.map + for i in map.events.keys @@ -1042,2 +1039,5 @@ - end - spriteset.addUserSprite(Particle_Engine.new(viewport,map)) + end + spriteset.addUserSprite(Particle_Engine.new(viewport,map)) +} + +def Kernel.pbOnSpritesetCreate(spriteset,viewport) @@ -1915,1 +1915,0 @@ - echoln [currentTag,facingTag] Changed: PokemonSave @@ -31,0 +31,22 @@ +def pbEmergencySave + oldscene=$scene + $scene=nil + Kernel.pbMessage(_INTL("The script is taking too long. The game will restart.")) + return if !$Trainer + if FileTest.exist?("Game.rxdata") + File.open("Game.rxdata", 'rb') {|r| + File.open("Game.rxdata.bak", 'wb') {|w| + while s = r.read(4096) + w.write s + end + } + } + end + Kernel.pbMessageBrief(_INTL("Saving...\r\nDon't turn off the power.")) + if pbSave + Kernel.pbMessageSound(_INTL("The game was saved."),"Audio/SE/save.wav") + else + Kernel.pbMessageSound(_INTL("Save failed."),nil) + end + $scene=oldscene +end Changed: Game_Map* @@ -99,2 +99,3 @@ - pbCueBGM(@map.bgm.name+"n", - @map.bgm.volume,@map.bgm.pitch,1.0) # Plays it + pbCueBGM( + RPG::AudioFile.new(@map.bgm.name+"n", + @map.bgm.volume,@map.bgm.pitch),1.0) # Plays it Changed: PokemonMart @@ -178,0 +178,2 @@ + # Scroll right before showing screen + pbScrollMap(6,5,5) @@ -215,1 +217,1 @@ - pbFadeInAndShow(@sprites) + Graphics.frame_reset @@ -252,1 +254,0 @@ - pbFadeOutAndHide(@sprites) @@ -255,0 +256,2 @@ + # Scroll left after showing screen + pbScrollMap(4,5,5) @@ -508,5 +511,3 @@ - pbFadeOutIn(99999){ - scene=PokemonMartScene.new - screen=PokemonMartScreen.new(scene,stock) - screen.pbBuyScreen - } + scene=PokemonMartScene.new + screen=PokemonMartScreen.new(scene,stock) + screen.pbBuyScreen Changed: PokeBattle_ActualScene @@ -1007,1 +1007,1 @@ - +#################################################### @@ -1580,0 +1580,1 @@ + # Show shiny animation @@ -2233,1 +2234,1 @@ - end + end Changed: PokemonTrainers @@ -92,0 +92,1 @@ + trainername=trainer[1] ? trainer[1].gsub(/,/,";") : "???" @@ -93,1 +94,1 @@ - f.write(sprintf("%s\r\n",trainer[1])) + f.write(sprintf("%s\r\n",trainername)) @@ -95,1 +96,1 @@ - f.write(sprintf("%s,%d\r\n",trainer[1],trainer[4])) + f.write(sprintf("%s,%d\r\n",trainername,trainer[4])) Changed: PokeBattle_Trainer @@ -3,-1 +3,4 @@ +########## +# Trainer's initial money +INITIALMONEY=2000 +########## @@ -127,1 +132,1 @@ - @money=2000 + @money=INITIALMONEY Changed: PokemonLoad @@ -181,0 +181,18 @@ +def pbTryLoadFile(savefile) + trainer=nil + framecount=nil + game_system=nil + pokemonSystem=nil + File.open(savefile){|f| + trainer=Marshal.load(f) + framecount=Marshal.load(f) + game_system=Marshal.load(f) + pokemonSystem=Marshal.load(f) + } + raise "Corrupted file" if !trainer.is_a?(PokeBattle_Trainer) + raise "Corrupted file" if !framecount.is_a?(Numeric) + raise "Corrupted file" if !game_system.is_a?(Game_System) + raise "Corrupted file" if !pokemonSystem.is_a?(PokemonSystem) + return [trainer,framecount,game_system,pokemonSystem] +end + @@ -185,1 +203,1 @@ - $PokemonSystem=PokemonSystem.new + $PokemonSystem=PokemonSystem.new if !$PokemonSystem @@ -190,0 +208,1 @@ + cmdLanguage=-1 @@ -197,0 +216,1 @@ + haveBackup=false @@ -198,10 +218,25 @@ - File.open(savefile){|f| - trainer=Marshal.load(f) - framecount=Marshal.load(f) - $game_system=Marshal.load(f) - $PokemonSystem=Marshal.load(f) - } - raise "Corrupted file" if !trainer.is_a?(PokeBattle_Trainer) - raise "Corrupted file" if !framecount.is_a?(Numeric) - raise "Corrupted file" if !$game_system.is_a?(Game_System) - raise "Corrupted file" if !$PokemonSystem.is_a?(PokemonSystem) + trainer, framecount, $game_system, $PokemonSystem=pbTryLoadFile(savefile) + showContinue=true + rescue + if FileTest.exist?(savefile+".bak") + begin + trainer, framecount, $game_system, $PokemonSystem=pbTryLoadFile(savefile+".bak") + haveBackup=true + showContinue=true + rescue + end + end + if haveBackup + Kernel.pbMessage(_INTL("The save file is corrupt. The previous save file will be loaded.")) + else + begin; File.delete(savefile); rescue; end + begin; File.delete(savefile+".bak"); rescue; end + $PokemonSystem=PokemonSystem.new if !$PokemonSystem + $game_system=Game_System.new + Kernel.pbMessage(_INTL("The save file was deleted due to corruption or damage.")) + end + end + if showContinue + if !haveBackup + begin; File.delete(savefile+".bak"); rescue; end + end @@ -217,9 +252,0 @@ - showContinue=true - rescue - $PokemonSystem=PokemonSystem.new - $game_system=Game_System.new - begin - File.delete(savefile) - rescue - end - Kernel.pbMessage(_INTL("The save file was deleted due to corruption or damage.")) @@ -234,-1 +260,2 @@ + if LANGUAGES.length>=2 + commands[cmdLanguage=commands.length]=_INTL("LANGUAGE") @@ -265,0 +294,18 @@ + elsif cmdLanguage>=0 && command==cmdLanguage + @scene.pbEndScene + $PokemonSystem.language=pbChooseLanguage + pbLoadMessages("Data/"+LANGUAGES[$PokemonSystem.language][1]) + savedata=[] + if FileTest.exist?(savefile) + File.open(savefile,"rb"){|f| + 14.times { savedata.push(Marshal.load(f)) } + } + savedata[3]=$PokemonSystem + begin + File.open("Game.rxdata","wb"){|f| + 14.times {|i| Marshal.dump(savedata[i],f) } + } + rescue; end + end + $scene=pbCallTitle + return @@ -276,1 +323,1 @@ - $PokemonSystem=Marshal.load(f) + Marshal.load(f) # PokemonSystem already loaded Changed: Main @@ -31,0 +31,1 @@ + begin @@ -47,0 +48,4 @@ + rescue Hangup + pbEmergencySave + raise + end Changed: PokemonEntry @@ -996,2 +996,2 @@ - if @cursor < self.text.scan(/./m).length - @cursor+=1 + if @helper.cursor < self.text.scan(/./m).length + @helper.cursor+=1 Changed: Compiler @@ -20,1 +20,3 @@ - print("#{message}\r\nThis exception was logged in errorlog.txt.\r\nPress Ctrl+C to copy this message to the clipboard.") + if !e.is_a?(Hangup) + print("#{message}\r\nThis exception was logged in errorlog.txt.\r\nPress Ctrl+C to copy this message to the clipboard.") + end @@ -150,1 +152,1 @@ - if str[/[,\"]/] + if str[/[,\"]/] || str[/^\s/] || str[/\s$/] || str[/^#/] @@ -1330,4 +1332,5 @@ - for i in 1..493 - speciesname=PBSpecies.getName(i) - kind=pbGetMessage(MessageTypes::Kinds,i) - entry=pbGetMessage(MessageTypes::Entries,i) + messages=Messages.new("Data/messages.dat") + for i in 1..PBSpecies.getCount + speciesname=messages.get(MessageTypes::Species,i) + kind=messages.get(MessageTypes::Kinds,i) + entry=messages.get(MessageTypes::Entries,i) @@ -2330,1 +2333,1 @@ - if g[0]==e + if g[0]==e && (g[3]&EVODATAMASK)==EVONEXTFORM @@ -2774,0 +2777,3 @@ + if FileTest.exist?("Data/messages.dat") + MessageTypes.loadMessageFile("Data/messages.dat") + end @@ -2814,1 +2820,3 @@ - MessageTypes.loadMessageFile("Data/messages.dat") + if FileTest.exist?("Data/messages.dat") + MessageTypes.loadMessageFile("Data/messages.dat") + end @@ -2820,0 +2828,3 @@ + if !$INEDITOR && LANGUAGES.length>=2 + pbLoadMessages("Data/"+LANGUAGES[$PokemonSystem.language][1]) + end @@ -2893,0 +2904,67 @@ + +=begin +if !$INEDITOR && FileTest.exist?("en.dat") + + +def findMessage(msg) + value=msg.downcase + value.gsub!(/\xc3\xa9/,"e") + value.gsub!(/[ \r\t\f\n]/,"") + value.gsub!("\\1","") + return $ENHASH[value] +end + +def checkMsgs(m,srcArray) + if m.is_a?(Array) + for j in 0...m.length + next if m[j]==nil || m[j]=="" + msgidx=findMessage(m[j]) + if msgidx + vv=srcArray[msgidx[0]][msgidx[1]].split("\n") + m[j]=vv[msgidx[2]] + end + end + elsif m.is_a?(OrderedHash) + for key in m.keys + next if m[key]==nil || m[key]=="" + msgidx=findMessage(m[key]) + if msgidx + vv=srcArray[msgidx[0]][msgidx[1]].split("\n") + m[key]=vv[msgidx[2]] + end + end + end +end + +=begin +$EN=load_data("en.dat") +$DE=load_data("de.dat") +$ENHASH={} + for i in 0...$EN.length + next if !$EN[i] + for j in 0...$EN[i].length + value=$EN[i][j] + value.gsub!("\\1","") + values=value.split("\n") + for v in 0...values.length + if !$ENHASH[values[v]] + $ENHASH[values[v]]=[i,j,v] + end + end + end + end +msgs=Messages.new +messages=msgs.loadMessageFile("messages.dat") +if messages[0] + for i in 0...messages[0].length + m=messages[0][i] + checkMsgs(m,$DE) + end +end +for i in 1...messages.length + m=messages[i] + checkMsgs(m,$DE) +end +msgs.extract("de.txt") +end +=end Changed: Audio @@ -57,1 +57,3 @@ - AudioContextSetVolume=bgmstop=Win32API.new("audio.dll","AudioContextSetVolume","ll","") + AudioContextSetVolume=Win32API.new("audio.dll","AudioContextSetVolume","ll","") +# AudioContextMute=Win32API.new("audio.dll","AudioContextMute","ll","") +# AudioContextUnmute=Win32API.new("audio.dll","AudioContextUnmute","ll","") @@ -82,1 +84,1 @@ - AudioContextSetVolume=bgmstop=nil + AudioContextSetVolume=nil @@ -89,1 +91,4 @@ - @volume=100.0 + @bgmVolume=100.0 + @meVolume=100.0 + @bgsVolume=100.0 + @seVolume=100.0 @@ -131,0 +136,1 @@ + volume=0 if !getPlayMusic() @@ -148,0 +154,1 @@ + volume=0 if !getPlayMusic() @@ -197,1 +204,1 @@ - return if !AudioState.bgmActive? + return 0 if !AudioState.bgmActive? @@ -207,0 +214,25 @@ +def Audio_bgm_mute + AudioState::AudioContextMute.call(AudioState.context,300) +end +def Audio_me_mute + AudioState::AudioContextMute.call(AudioState.meContext,300) +end +def Audio_bgs_mute + AudioState::AudioContextMute.call(AudioState.bgsContext,300) +end +def Audio_se_mute + AudioState::AudioContextMute.call(AudioState.seContext,300) +end + +def Audio_bgm_unmute + AudioState::AudioContextUnmute.call(AudioState.context,300) +end +def Audio_me_unmute + AudioState::AudioContextUnmute.call(AudioState.meContext,300) +end +def Audio_bgs_unmute + AudioState::AudioContextUnmute.call(AudioState.bgsContext,300) +end +def Audio_se_unmute + AudioState::AudioContextUnmute.call(AudioState.seContext,300) +end @@ -210,0 +242,1 @@ + volume=0 if !getPlaySound() @@ -228,0 +261,1 @@ + volume=0 if !getPlaySound() @@ -256,0 +290,2 @@ + @@musicstate=nil + @@soundstate=nil @@ -258,0 +294,22 @@ +=begin + pm=getPlayMusic() + ps=getPlaySound() + if @@musicstate!=false && !pm + @@musicstate=false + Kernel.Audio_bgm_mute + Kernel.Audio_me_mute + elsif @@musicstate!=true && pm + @@musicstate=true + Kernel.Audio_bgm_unmute + Kernel.Audio_me_unmute + end + if @@soundstate!=false && !ps + @@soundstate=false + Kernel.Audio_bgs_mute + Kernel.Audio_se_mute + elsif @@soundstate!=true && ps + @@musicstate=true + Kernel.Audio_bgs_unmute + Kernel.Audio_se_unmute + end +=end Changed: PokemonEditor @@ -451,0 +451,29 @@ +end + +def pbChooseTypeList(defaultMoveID=0,movetype=false) + cmdwin=pbListWindow([],200) + commands=[] + moveDefault=0 + for i in 1..PBTypes.getCount + commands.push([i,PBTypes.getName(i)]) + end + commands.sort! {|a,b| a[1]<=>b[1]} + if defaultMoveID>0 + commands.each_with_index {|item,index| + moveDefault=index if index[0]==defaultMoveID + } + end + realcommands=[] + for command in commands + realcommands.push(_ISPRINTF("{2:s}",command[0],command[1])) + end + loop do + ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true) + retval=ret>=0 ? commands[ret][0] : 0 + if retval==PBTypes::QMARKS && !movetype + Kernel.pbMessage(_INTL("Can't choose type '???'.")) + else + cmdwin.dispose + return retval + end + end @@ -1215,0 +1244,14 @@ + +class LimitStringProperty + def initialize(limit) + @limit=limit + end + def set(settingname,oldsetting) + message=Kernel.pbMessageFreeText(_INTL("Set the value for {1}.",settingname), + oldsetting ? oldsetting : "",false,@limit) + end + def format(value) + return value + end +end + @@ -1316,0 +1359,14 @@ + +module TypeProperty + def self.set(settingname,oldsetting) + ret=pbChooseTypeList(oldsetting ? oldsetting : 0) + return (ret<0) ? (oldsetting ? oldsetting : 0) : ret + end + def self.format(value) + return value ? PBTypes.getName(value) : "-" + end + def self.defaultValue + return 0 + end +end + @@ -1498,7 +1555,8 @@ - if Kernel.pbConfirmMessage(_INTL("Reset the setting {1}?",properties[selectedmap][0])) - propobj=properties[selectedmap][1] - if propobj.respond_to?("defaultValue") - data[selectedmap]=propobj.defaultValue - else - data[selectedmap]=nil - end + propobj=properties[selectedmap][1] + if !propobj.is_a?(ReadOnlyProperty) && + Kernel.pbConfirmMessage(_INTL("Reset the setting {1}?",properties[selectedmap][0])) + if propobj.respond_to?("defaultValue") + data[selectedmap]=propobj.defaultValue + else + data[selectedmap]=nil + end @@ -2286,0 +2344,74 @@ + +class PokemonLister + def initialize(selection,includeNew) + @sprite=SpriteWrapper.new + @sprite.bitmap=nil + @sprite.z=2 + @selection=selection + @commands=[] + @ids=[] + @includeNew=includeNew + @trainers=nil + @index=0 + end + def setViewport(viewport) + @sprite.viewport=viewport + end + def startIndex + return @index + end + def commands + @commands.clear + @ids.clear + if @includeNew + @commands.push(_ISPRINTF("[NEW POKeMON]")) + @ids.push(-1) + end + for i in 1..PBSpecies.getCount + # Index: TrainerType TrainerName + @commands.push(_ISPRINTF("{1:3d}: {2:s}",i,PBSpecies.getName(i))) + @ids.push(i) + end + @index=@selection + @index=@commands.length-1 if @index>=@commands.length + @index=0 if @index<0 + return @commands + end + def value(index) + return nil if (index<0) + return -1 if index==0 && @includeNew + realIndex=(@includeNew) ? index-1 : index + return realIndex+1 + end + def dispose + @sprite.bitmap.dispose if @sprite.bitmap + @sprite.dispose + end + def refresh(index) + @sprite.bitmap.dispose if @sprite.bitmap + return if index<0 + begin + @sprite.bitmap=BitmapCache.battler(sprintf("%03d",@ids[index]),0) + rescue + @sprite.bitmap=Bitmap.new(32,32) + end + ww=@sprite.bitmap.width + wh=@sprite.bitmap.height + sx=224.0/ww + sy=416.0/wh + if sx<1.0 || sy<1.0 + if sx>sy + ww=sy*ww + wh=416.0 + else + wh=sx*wh + ww=224.0 + end + end + @sprite.zoom_x=ww*1.0/@sprite.bitmap.width + @sprite.zoom_y=wh*1.0/@sprite.bitmap.height + @sprite.x=368-(ww/2) + @sprite.y=192-(wh/2) + end +end + @@ -2298,1 +2430,1 @@ - [_INTL("Move 1"),MoveProperty, + [_INTL("Move 1"),MoveProperty2.new(oldsetting), @@ -2300,1 +2432,1 @@ - [_INTL("Move 2"),MoveProperty, + [_INTL("Move 2"),MoveProperty2.new(oldsetting), @@ -2302,1 +2434,1 @@ - [_INTL("Move 3"),MoveProperty, + [_INTL("Move 3"),MoveProperty2.new(oldsetting), @@ -2304,1 +2436,1 @@ - [_INTL("Move 4"),MoveProperty, + [_INTL("Move 4"),MoveProperty2.new(oldsetting), @@ -2326,0 +2458,124 @@ +end +class MoveProperty2 + def initialize(pokemondata) + @pokemondata=pokemondata + end + def set(settingname,oldsetting) + ret=pbChooseMoveListForSpecies(@pokemondata[0],oldsetting ? oldsetting : 1) + return (ret<=0) ? (oldsetting ? oldsetting : 0) : ret + end + def format(value) + return value ? PBMoves.getName(value) : "-" + end + def defaultValue + return 0 + end +end + + +def pbGetBabySpecies(species) + ret=species + pbRgssOpen("Data/evolutions.dat","rb"){|f| + f.pos=(species-1)*8 + offset=f.fgetdw + length=f.fgetdw + if length>0 + f.pos=offset + i=0; loop do break unless i>1 + atkdata.pos=offset + for k in 0..length-1 + level=atkdata.fgetw + move=atkdata.fgetw + moves.push(move) + end + } + $ItemData=readItemList("Data/items.dat") + tmdat=load_data("Data/tm.dat") + for i in 0...$ItemData.length + next if !$ItemData[i] + atk=$ItemData[i][8] + next if !atk || atk==0 + next if !tmdat[atk] + if tmdat[atk].any? {|item| item==species } + moves.push(atk) + end + end + babyspecies=pbGetBabySpecies(species) + pbRgssOpen("Data/eggEmerald.dat","rb"){|f| + f.pos=(babyspecies-1)*8 + offset=f.fgetdw + length=f.fgetdw + if length>0 + f.pos=offset + i=0; loop do break unless ib[1]} + if defaultMoveID>0 + commands.each_with_index {|item,index| + if moveDefault==0 + moveDefault=index if index[0]==defaultMoveID + end + } + end + commands2=[] + for i in 1..PBMoves.getCount + commands2.push([i,PBMoves.getName(i)]) + end + commands2.sort! {|a,b| a[1]<=>b[1]} + if defaultMoveID>0 + commands2.each_with_index {|item,index| + if moveDefault==0 + moveDefault=index if index[0]==defaultMoveID + end + } + end + commands.concat(commands2) + realcommands=[] + for command in commands + realcommands.push(_ISPRINTF("{2:s}",command[0],command[1])) + end + + ret=pbCommands2(cmdwin,realcommands,-1,moveDefault,true) + cmdwin.dispose + return ret>=0 ? commands[ret][0] : 0 @@ -2375,0 +2631,14 @@ + trainers=load_data("Data/trainers.dat") + trainernames=load_data("Data/trainernames.dat") + modified=false + for trainer in trainers + trtype=trainer[0] + if !trainernames || !trainernames[trtype] + trainer[0]=0 + modified=true + end + end + if modified + save_data(data,"Data/trainers.dat") + pbConvertTrainerData + end @@ -2470,0 +2740,102 @@ +def pbPokemonEditor + selection=0 + trainerTypes=[ + ["Name",LimitStringProperty.new(10), + _INTL("Name of the Pokemon.")], + ["InternalName",ReadOnlyProperty, + _INTL("Internal name of the Pokemon.")], + ["Kind",LimitStringProperty.new(12), + _INTL("Kind of Pokemon species.")], + ["Pokedex",StringProperty, + _INTL("Description of the Pokemon as displayed in the Pokedex.")], + ["Type1",TypeProperty, + _INTL("Pokemon's type. If same as type 2, this Pokemon has a single type.")], + ["Type2",TypeProperty, + _INTL("Pokemon's type. If same as type 1, this Pokemon has a single type.")], + ["BaseHP",LimitProperty.new(255), + _INTL("Base HP.")], + ["BaseAttack",LimitProperty.new(255), + _INTL("Base Attack stat.")], + ["BaseDefense",LimitProperty.new(255), + _INTL("Base Defense stat.")], + ["BaseSpeed",LimitProperty.new(255), + _INTL("Base Speed stat.")], + ["BaseSpAtk",LimitProperty.new(255), + _INTL("Base Special Attack stat.")], + ["BaseSpDef",LimitProperty.new(255), + _INTL("Base Special Defense stat.")], + ["Color",EnumProperty.new([_INTL("Red"),_INTL("Blue"), + _INTL("Yellow"),_INTL("Green"),_INTL("Black"),_INTL("Brown"), + _INTL("Purple"),_INTL("Gray"),_INTL("White"),_INTL("Pink")]), + _INTL("Pokemon's body color.")], + ["Compat1",EnumProperty.new([ + "Undefined","Monster","Water1","Bug","Flying", + "Ground","Fairy","Plant","Humanshape","Water3", + "Mineral","Indeterminate","Water2","Ditto","Dragon","NoEggs"]), + _INTL("Compatibility group (egg group) for breeding purposes.")], + ["Compat2",EnumProperty.new([ + "Undefined","Monster","Water1","Bug","Flying", + "Ground","Fairy","Plant","Humanshape","Water3", + "Mineral","Indeterminate","Water2","Ditto","Dragon","NoEggs"]), + _INTL("Compatibility group (egg group) for breeding purposes.")], + ["WildItemCommon",ItemProperty, + _INTL("Item commonly held by wild Pokemon of this species.")], + ["WildItemRare",ItemProperty, + _INTL("Item rarely held by wild Pokemon of this species.")], + ["EffortHP",LimitProperty.new(3), + _INTL("HP effort values earned when this species is defeated.")], + ["EffortAttack",LimitProperty.new(3), + _INTL("Attack effort values earned when this species is defeated.")], + ["EffortDefense",LimitProperty.new(3), + _INTL("Defense effort values earned when this species is defeated.")], + ["EffortSpeed",LimitProperty.new(3), + _INTL("Speed effort values earned when this species is defeated.")], + ["EffortSpAtk",LimitProperty.new(3), + _INTL("Special Attack effort values earned when this species is defeated.")], + ["EffortSpDef",LimitProperty.new(3), + _INTL("Special Defense effort values earned when this species is defeated.")], + ] + messages=Messages.new("Data/messages.dat") + pbListScreenBlock(_INTL("Pokemon"),PokemonLister.new(selection,true)){|button,trtype| + if trtype + if button==Input::A + elsif button==Input::C + selection=trtype + if selection<0 + Kernel.pbMessage("New Pokemon would be created here.") + # newid=pbTrainerTypeEditorNew(nil) + # if newid>=0 + # selection=newid + # end + else + dexdata=pbOpenDexData + pbDexDataOffset(dexdata,selection,8) + type1=dexdata.fgetb + type2=dexdata.fgetb + base=[ + dexdata.fgetb,dexdata.fgetb,dexdata.fgetb, + dexdata.fgetb,dexdata.fgetb,dexdata.fgetb + ] + pbDexDataOffset(dexdata,selection,31) + compat1=dexdata.fgetb + compat2=dexdata.fgetb + data=[ +messages.get(MessageTypes::Species,selection), +getConstantName(PBSpecies,selection), +messages.get(MessageTypes::Kinds,selection), +messages.get(MessageTypes::Entries,selection), +type1,type2,base[0],base[1],base[2],base[3],base[4],base[5], +0,compat1,compat2,0,0, +0,0,0,0,0,0 + ] + dexdata.close + save=pbPropertyList("Edit Species",data,trainerTypes,true) + # if save + # pbTrainerTypeEditorSave(selection,data) + # end + end + end + end + } +end + @@ -2473,1 +2845,1 @@ - [_INTL("Internal Name"),StringProperty, + [_INTL("Internal Name"),ReadOnlyProperty, @@ -2514,0 +2886,1 @@ + # trtype[2] contains trainer's name to display as title @@ -2523,1 +2896,2 @@ -#pbEditorScreen + +#pbPokemonEditor Changed: PokemonMessages @@ -957,23 +957,0 @@ -end - -def getDefaultTextColors(windowskin) - if !windowskin || windowskin.disposed? || - windowskin.width!=128 || windowskin.height!=128 - if isDarkWindowskin(windowskin) - return [Color.new(31*8,31*8,31*8), - Color.new(23*8,23*8,23*8)] # White - else - return [Color.new(12*8,12*8,12*8), - Color.new(26*8,26*8,25*8)] # Dark gray - end - else # VX windowskin - color=windowskin.get_pixel(64, 96) - shadow=nil - isdark=(color.red+color.green+color.blue)/3 < 128 - if isdark - shadow=Color.new(color.red+64,color.green+64,color.blue+64) - else - shadow=Color.new(color.red-64,color.green-64,color.blue-64) - end - return [color,shadow] - end @@ -1560,0 +1537,24 @@ + +def pbScrollMap(direction, distance, speed) + return if !$game_map + if speed==0 + case direction + when 2 + $game_map.scroll_down(distance * 128) + when 4 + $game_map.scroll_left(distance * 128) + when 6 + $game_map.scroll_right(distance * 128) + when 8 + $game_map.scroll_up(distance * 128) + end + else + $game_map.start_scroll(direction, distance, speed); + loop do + Graphics.update + Input.update + break if !$game_map.scrolling? + pbUpdateSceneMap + end + end +end Changed: SpriteWindow @@ -13,0 +13,4 @@ +LIGHTTEXTBASE=Color.new(31*8,31*8,31*8) +LIGHTTEXTSHADOW=Color.new(23*8,23*8,23*8) +DARKTEXTBASE=Color.new(12*8,12*8,12*8) +DARKTEXTSHADOW=Color.new(26*8,26*8,25*8) @@ -77,1 +81,6 @@ -"Graphics/Windowskins/skin28.png" +"Graphics/Windowskins/skin28.png", +"Graphics/Windowskins/textbox0.png", +"Graphics/Windowskins/textbox1.png", +"Graphics/Windowskins/textbox2.png", +"Graphics/Windowskins/textbox3.png", +"Graphics/Windowskins/textbox4.png" @@ -79,1 +88,26 @@ - +$SpeechFrames=[ +nil, # Default text skin, leave as nil +"rstextskin", +"frlgtextskin", +"emtextskin", +"textbox0", +"textbox1", +"textbox2", +"textbox3", +"textbox4", +"textbox5", +"textbox6", +"textbox7", +"textbox8", +"textbox9", +"textbox10", +"textbox11", +"textbox12", +"textbox13", +"textbox14", +"textbox15", +"textbox16", +"textbox17", +"textbox18", +"textbox19" +] @@ -131,0 +165,20 @@ +def getDefaultTextColors(windowskin) + if !windowskin || windowskin.disposed? || + windowskin.width!=128 || windowskin.height!=128 + if isDarkWindowskin(windowskin) + return [LIGHTTEXTBASE,LIGHTTEXTSHADOW] # White + else + return [DARKTEXTBASE,DARKTEXTSHADOW] # Dark gray + end + else # VX windowskin + color=windowskin.get_pixel(64, 96) + shadow=nil + isdark=(color.red+color.green+color.blue)/3 < 128 + if isdark + shadow=Color.new(color.red+64,color.green+64,color.blue+64) + else + shadow=Color.new(color.red-64,color.green-64,color.blue-64) + end + return [color,shadow] + end +end @@ -1181,0 +1235,1 @@ + # width of left end of window @@ -1182,0 +1237,1 @@ + # width of top end of window @@ -1185,2 +1241,3 @@ - cx=@skinrect.x+@skinrect.width - cy=@skinrect.y+@skinrect.height + cx=@skinrect.x+@skinrect.width # right side of BODY rect + cy=@skinrect.y+@skinrect.height # bottom side of BODY rect + # width of right end of window @@ -1188,0 +1245,1 @@ + # height of bottom end of window @@ -1197,4 +1255,4 @@ - Rect.new(startX,0,@skinrect.width,startY), - Rect.new(0,startY,startX,@skinrect.height), - Rect.new(cx,startY,startX,@skinrect.height), - Rect.new(startX,cy,@skinrect.width,endY) + Rect.new(startX,0,@skinrect.width,startY), # side0 (top) + Rect.new(0,startY,startX,@skinrect.height), # side1 (left) + Rect.new(cx,startY,endX,@skinrect.height), # side2 (right) + Rect.new(startX,cy,@skinrect.width,endY) # side3 (bottom) Changed: PokemonSystem @@ -16,0 +16,9 @@ +LANGUAGES=[ + # Languages used in the game. When the game starts and no save file exists, + # a menu displays the available languages and a "Language" option appears on + # the main menu. + # Uncomment to add entries to the array + # Name of language in native language, message file in Data folder +# ["English","english.dat"], +# ["Deutsch","deutsch.dat"] +] @@ -17,0 +26,7 @@ +def pbChooseLanguage + commands=[] + for lang in LANGUAGES + commands.push(lang[0]) + end + return Kernel.pbShowCommands(nil,commands) +end @@ -19,0 +35,2 @@ + ############# + ############# @@ -22,0 +40,1 @@ + havedata=false @@ -32,0 +51,1 @@ + havedata=true @@ -40,0 +60,1 @@ + # Load constants @@ -50,-1 +71,5 @@ + if LANGUAGES.length>=2 + if !havedata + $PokemonSystem.language=pbChooseLanguage + end + pbLoadMessages("Data/"+LANGUAGES[$PokemonSystem.language][1]) Changed: PokemonSummary @@ -687,1 +687,2 @@ - case @page + if dorefresh + case @page @@ -694,0 +695,1 @@ + end Changed: PokemonUtilities @@ -125,1 +125,7 @@ - party=[25,16,7,387,390,393] + party=[] + party.push(PBSpecies::PIKACHU) if hasConst?(PBSpecies,:PIKACHU) + party.push(PBSpecies::SQUIRTLE) if hasConst?(PBSpecies,:SQUIRTLE) + party.push(PBSpecies::CHARMANDER) if hasConst?(PBSpecies,:CHARMANDER) + party.push(PBSpecies::TURTWIG) if hasConst?(PBSpecies,:TURTWIG) + party.push(PBSpecies::CHIMCHAR) if hasConst?(PBSpecies,:CHIMCHAR) + party.push(PBSpecies::PIPLUP) if hasConst?(PBSpecies,:PIPLUP) @@ -164,1 +170,1 @@ - Kernel.pbMessage(_INTL("Box \"{1}\" on {2}'s PC was full.",curboxname,creator)) + Kernel.pbMessage(_INTL("Box \"{1}\" on {2}'s PC was full.\1",curboxname,creator)) @@ -166,1 +172,1 @@ - Kernel.pbMessage(_INTL("Box \"{1}\" on someone's PC was full.",curboxname)) + Kernel.pbMessage(_INTL("Box \"{1}\" on someone's PC was full.\1",curboxname)) @@ -171,1 +177,1 @@ - Kernel.pbMessage(_INTL("{1} was transferred to {2}'s PC.",pokemon.name,creator)) + Kernel.pbMessage(_INTL("{1} was transferred to {2}'s PC.\1",pokemon.name,creator)) @@ -173,1 +179,1 @@ - Kernel.pbMessage(_INTL("{1} was transferred to someone's PC.",pokemon.name)) + Kernel.pbMessage(_INTL("{1} was transferred to someone's PC.\1",pokemon.name)) @@ -195,0 +201,16 @@ +end + +def pbAddForeignPokemon(species,level,ownerName) + if $Trainer.party.length==6 + return false + end + speciesname=PBSpecies.getName(species) + Kernel.pbMessage(_INTL("{1} received a Pokemon from {2}.\1",$Trainer.name,ownername)) + pokemon=PokeBattle_Pokemon.new(species,level,$Trainer) + # Set ID and OT name to a foreign one + pokemon.id=$Trainer.getForeignID + pokemon.ot=ownerName + # Recalculate stats + pokemon.calcStats + pbStorePokemon(pokemon) + return true @@ -765,6 +787,0 @@ - if rand(2)==0 - return PBSpecies::KADABRA - end - if rand(2)==0 - return PBSpecies::SHROOMISH - end @@ -781,0 +797,8 @@ + itemlist=[] + for i in 44..44 + itemlist.push(i) + end + for i in 133..200 + itemlist.push(i) + end + p.item=itemlist[rand(itemlist.length)] Changed: PokeBattle_Battler @@ -523,1 +523,1 @@ - @battle.pbDisplay(_INTL("{1} Traced {2}'s {3}!",pbThis,battlername,abilityname)) + @battle.pbDisplay(_INTL("{1} traced {2}'s {3}!",pbThis,battlername,abilityname)) @@ -618,0 +618,1 @@ + itemname=(self.item==0) ? "" : PBItems.getName(self.item) @@ -619,1 +620,1 @@ - @battle.pbDisplay(_INTL("{1}'s Berry Juice restored health!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} restored health!",pbThis,itemname)) @@ -625,1 +626,1 @@ - @battle.pbDisplay(_INTL("{1}'s Oran Berry restored health!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} restored health!",pbThis,itemname)) @@ -631,1 +632,1 @@ - @battle.pbDisplay(_INTL("{1}'s Sitrus Berry restored health!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} restored health!",pbThis,itemname)) @@ -637,1 +638,1 @@ - @battle.pbDisplay(_INTL("{1}'s Cheri Berry cured its paralysis problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis problem!",pbThis,itemname)) @@ -643,1 +644,1 @@ - @battle.pbDisplay(_INTL("{1}'s Chesto Berry cured its sleep problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its sleep problem!",pbThis,itemname)) @@ -649,1 +650,1 @@ - @battle.pbDisplay(_INTL("{1}'s Pecha Berry cured its poison problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its poison problem!",pbThis,itemname)) @@ -655,1 +656,1 @@ - @battle.pbDisplay(_INTL("{1}'s Rawst Berry cured its burn problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its burn problem!",pbThis,itemname)) @@ -661,1 +662,1 @@ - @battle.pbDisplay(_INTL("{1}'s Aspear Berry cured its ice problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its ice problem!",pbThis,itemname)) @@ -675,1 +676,1 @@ - @battle.pbDisplay(_INTL("{1}'s Leppa Berry restored {2}'s PP!",pbThis,movename)) + @battle.pbDisplay(_INTL("{1}'s {2} restored {3}'s PP!",pbThis,itemname,movename)) @@ -683,1 +684,1 @@ - @battle.pbDisplay(_INTL("{1}'s Persim Berry cured its confusion problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its confusion problem!",pbThis,itemname)) @@ -690,1 +691,1 @@ - @battle.pbDisplay(_INTL("{1}'s Lum Berry cured its confusion problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its confusion problem!",pbThis,itemname)) @@ -694,1 +695,1 @@ - @battle.pbDisplay(_INTL("{1}'s Lum Berry cured its paralysis problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis problem!",pbThis,itemname)) @@ -696,1 +697,1 @@ - @battle.pbDisplay(_INTL("{1}'s Lum Berry cured its sleep problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its sleep problem!",pbThis,itemname)) @@ -698,1 +699,1 @@ - @battle.pbDisplay(_INTL("{1}'s Lum Berry cured its poison problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its poison problem!",pbThis,itemname)) @@ -700,1 +701,1 @@ - @battle.pbDisplay(_INTL("{1}'s Lum Berry cured its burn problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its burn problem!",pbThis,itemname)) @@ -702,1 +703,1 @@ - @battle.pbDisplay(_INTL("{1}'s Lum Berry cured its frozen problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its frozen problem!",pbThis,itemname)) @@ -712,2 +713,2 @@ - _INTL("{1}'s Figy Berry restored health!",pbThis), - _INTL("For {1}, the Figy Berry was too spicy!",pbThis)) + _INTL("{1}'s {2} restored health!",pbThis,itemname), + _INTL("For {1}, the {2} was too spicy!",pbThis,itemname)) @@ -715,2 +716,2 @@ - _INTL("{1}'s Wiki Berry restored health!",pbThis), - _INTL("For {1}, the Wiki Berry was too dry!",pbThis)) + _INTL("{1}'s {2} restored health!",pbThis,itemname), + _INTL("For {1}, the {2} was too dry!",pbThis,itemname)) @@ -718,2 +719,2 @@ - _INTL("{1}'s Mago Berry restored health!",pbThis), - _INTL("For {1}, the Mago Berry was too sweet!",pbThis)) + _INTL("{1}'s {2} restored health!",pbThis,itemname), + _INTL("For {1}, the {2} was too sweet!",pbThis,itemname)) @@ -721,2 +722,2 @@ - _INTL("{1}'s Aguav Berry restored health!",pbThis), - _INTL("For {1}, the Aguav Berry was too bitter!",pbThis)) + _INTL("{1}'s {2} restored health!",pbThis,itemname), + _INTL("For {1}, the {2} was too bitter!",pbThis,itemname)) @@ -724,2 +725,2 @@ - _INTL("{1}'s Iapapa Berry restored health!",pbThis), - _INTL("For {1}, the Iapapa Berry was too sour!",pbThis)) + _INTL("{1}'s {2} restored health!",pbThis,itemname), + _INTL("For {1}, the {2} was too sour!",pbThis,itemname)) @@ -727,1 +728,1 @@ - _INTL("Using its Liechi Berry, the Attack of {1} rose!",pbThis)) + _INTL("Using its {1}, the Attack of {2} rose!",itemname,pbThis)) @@ -729,1 +730,1 @@ - _INTL("Using its Ganlon Berry, the Defense of {1} rose!",pbThis)) + _INTL("Using its {1}, the Defense of {2} rose!",itemname,pbThis)) @@ -731,1 +732,1 @@ - _INTL("Using its Salac Berry, the Speed of {1} rose!",pbThis)) + _INTL("Using its {1}, the Speed of {2} rose!",itemname,pbThis)) @@ -733,1 +734,1 @@ - _INTL("Using its Petaya Berry, the Special Attack of {1} rose!",pbThis)) + _INTL("Using its {1}, the Special Attack of {2} rose!",itemname,pbThis)) @@ -735,1 +736,1 @@ - _INTL("Using its Apicot Berry, the Special Defense of {1} rose!",pbThis)) + _INTL("Using its {1}, the Special Defense of {2} rose!",itemname,pbThis)) @@ -738,1 +739,1 @@ - @battle.pbDisplay(_INTL("{1} used its Lansat Berry to get pumped!",pbThis)) + @battle.pbDisplay(_INTL("{1} used its {2} to get pumped!",pbThis,itemname)) @@ -746,5 +747,5 @@ - _INTL("Using Starf Berry, the Attack of {1} sharply rose!"), - _INTL("Using Starf Berry, the Defense of {1} sharply rose!"), - _INTL("Using Starf Berry, the Speed of {1} sharply rose!"), - _INTL("Using Starf Berry, the Special Attack of {1} sharply rose!"), - _INTL("Using Starf Berry, the Special Defense of {1} sharply rose!") + _INTL("Using {1}, the Attack of {2} sharply rose!",itemname,pbThis), + _INTL("Using {1}, the Defense of {2} sharply rose!",itemname,pbThis), + _INTL("Using {1}, the Speed of {2} sharply rose!",itemname,pbThis), + _INTL("Using {1}, the Special Attack of {2} sharply rose!",itemname,pbThis), + _INTL("Using {1}, the Special Defense of {2} sharply rose!",itemname,pbThis) @@ -759,1 +760,1 @@ - @battle.pbDisplay(messages[stat].gsub(/\{1\}/){pbThis}) + @battle.pbDisplay(messages[stat]) @@ -774,1 +775,1 @@ - @battle.pbDisplay(_INTL("{1}'s White Herb restored its status!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} restored its status!",pbThis,itemname)) @@ -780,1 +781,1 @@ - @battle.pbDisplay(_INTL("{1}'s Mental Herb cured its love problem!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} cured its love problem!",pbThis,itemname)) @@ -787,1 +788,1 @@ - @battle.pbDisplay(_INTL("{1}'s Leftovers restored its HP a little!",pbThis)) + @battle.pbDisplay(_INTL("{1}'s {2} restored its HP a little!",pbThis,itemname)) Changed: PokemonDebug @@ -764,3 +764,1 @@ - _INTL("To use the file in a game, add the text \"pbLoadMessages(X)\" to a script in the project, where X is the filename (such as \"intl.dat\").")) - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("Alternatively, rename the \"intl.dat\" file to \"messages.dat\" and put the file in the project's Data folder.")) + _INTL("To use the file in a game, place the file in the Data folder under a different name, and edit the LANGUAGES array in the PokemonSystem script.")) Changed: PokemonOrgBattle @@ -440,0 +440,7 @@ + end +end + +def pbDebugPlayBattle + num=Kernel.pbMessageChooseNumberNew(_INTL("Choose a battle."),-1,3,nil,500) + if num>=0 + pbPlayBattleFromFile(sprintf("Battles/Battle%03d.dat",num)) Changed: TilemapXP Changed: PokemonMap Changed: PokemonOption Changed: PokemonDayCare Changed: PokeBattle_Effects Changed: PokemonMenu Changed: PokeBattle_MoveEffects Changed: RTPAndRegistry Changed: PBIntl Changed: AnimationSprite Changed: PokemonField Changed: PokemonSave Changed: Game_Map* Changed: PokemonMart Changed: PokeBattle_ActualScene Changed: PokemonTrainers Changed: PokeBattle_Trainer Changed: PokemonLoad Changed: Main Changed: PokemonEntry Changed: Compiler Changed: Audio Changed: PokemonEditor Changed: PokemonMessages Changed: SpriteWindow Changed: PokemonSystem Changed: PokemonSummary Changed: PokemonUtilities Changed: PokeBattle_Battler Changed: PokemonDebug Changed: PokemonOrgBattle