Changed: Particle Engine @@ -264,1 +264,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -273,1 +273,2 @@ - setParameters([0,0,0,80,20,0.5,0,480,0,640,0.5,0.10,-5,-15,5,80]) + setParameters([0,0,0,80,20,0.5,0, + Graphics.height,0,Graphics.width,0.5,0.10,-5,-15,5,80]) @@ -281,1 +282,2 @@ - setParameters([1,1,1,10,rand(360),1,0,480,0,640,0,3,-8,-15,20,0]) + setParameters([1,1,1,10,rand(360),1,0, + Graphics.height,0,Graphics.width,0,3,-8,-15,20,0]) @@ -294,1 +296,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -304,1 +306,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -314,1 +316,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -324,1 +326,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -335,1 +337,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -349,1 +351,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -358,1 +360,2 @@ - setParameters([1,0,1,10,rand(360),1,-480,480,0,640,0,3,-8,-15,20,0]) + setParameters([1,0,1,10,rand(360),1, + -Graphics.height,Graphics.height,0,Graphics.width,0,3,-8,-15,20,0]) @@ -371,1 +374,2 @@ - setParameters([0,0,1,10,0,1,-480,480,0,640,0,3,-8,-15,10,0]) + setParameters([0,0,1,10,0,1, + -Graphics.height,Graphics.height,0,Graphics.width,0,3,-8,-15,10,0]) @@ -385,1 +389,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -420,1 +424,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, @@ -430,1 +434,1 @@ - 0,480,0,640, + 0,Graphics.height,0,Graphics.width, Changed: PokeBattle_Pokemon @@ -1,2 +1,0 @@ -#70997466 -begin @@ -29,0 +27,53 @@ +def nextUtf8(str,index) + utf8tbl = [ + [0x00,0x7F,0 ,0 ,0x7F,0], + [0xC2,0xDF,0x80,0xBF,0x1F,1], + [0xE0,0xE0,0xA0,0xBF,0x0F,2], + [0xE1,0xEF,0x80,0xBF,0x0F,2], + [0xF0,0xF0,0x90,0xBF,0x07,3], + [0xF1,0xF3,0x80,0xBF,0x07,3], + [0xF4,0xF4,0x80,0x8F,0x07,3], + [0 ,0 ,0 ,0 ,0 ,0] + ] + length=str.length + if index==length + return -1 + end + b1=str[index] + index+=1 + return b1 if b1<0x80 + row=0 + ret=0 + while (utf8tbl[row][4]&&((b1utf8tbl[row][1]))) + row+=1 + end + utfrow=utf8tbl[row] + if utfrow[4]==0 + return -1 + end + ret=(b1&utfrow[4]) + if utfrow[5]==0 + return ret + end + trail=str[index,utfrow[5]] + index+=utfrow[5] + if trail.length!=utfrow[5] + return -1 + end + utfrow[5].times do |i| + tbyte=trail[i] + if i==0 + if(tbyteutfrow[3]) + return -1 + end + else + if(tbyte<0x80||tbyte>0xBF) + return -1 + end + end + ret=(ret<<6)|(tbyte&0x3F) + end + return ret +end + + @@ -39,0 +90,1 @@ +attr_accessor(:abilityflag) # Ability flag @@ -90,0 +142,2 @@ + namechars=@name.scan(/./m) + otchars=@ot.scan(/./m) @@ -91,3 +145,3 @@ - ret+=(i>=@name.length) ? 0xFF.chr : $FontConv[@name[i]].chr - end - ret+=[0,0].pack("CC") # Font, sanity byte + ret+=(i>=namechars.length) ? 0xFF.chr : $FontConv[nextUtf8(namechars[i],0)].chr + end + ret+=[2,2].pack("CC") # Font, sanity byte @@ -95,1 +149,1 @@ - ret+=(i>=@ot.length) ? 0xFF.chr : $FontConv[@ot[i]].chr + ret+=(i>=otchars.length) ? 0xFF.chr : $FontConv[nextUtf8(otchars[i],0)].chr @@ -100,1 +154,1 @@ - @happiness,0,0].pack("vvVCCCC") + @eggsteps==0 ? @happiness : (@eggsteps>>8),0,0].pack("vvVCCCC") @@ -109,0 +163,4 @@ + iv=@iv[0]|(@iv[1]<<5)|(@iv[2]<<10)|(@iv[3]<<15)|(@iv[4]<<20)|(@iv[5]<<25) + iv|=0x80000000 if @abilityflag==1 + iv|=0x40000000 if @eggsteps>0 + pokerus=[0,1,0x10][@pokerus] @@ -110,2 +168,1 @@ - 0,0,0,0, - @iv[0]|(@iv[1]<<5)|(@iv[2]<<10)|(@iv[3]<<15)|(@iv[4]<<20)|(@iv[5]<<25),0 + pokerus,0,0,0,iv,0 @@ -161,1 +218,1 @@ - abil=@personalID&1 + abil=@abilityflag ? @abilityflag : 0 @@ -168,1 +225,5 @@ - ret=ret2 if ret2!=0 + ret=ret2 + if ret2==0 + @abilityflag=0 + ret=ret1 + end @@ -210,0 +271,1 @@ + calcStats @@ -249,0 +311,1 @@ + calcStats @@ -343,0 +406,1 @@ + @abilityflag=rand(2) @@ -407,7 +471,0 @@ - -rescue Exception -if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset" -raise $! -else -end -end Changed: PokemonDayCare @@ -75,1 +75,1 @@ - pbDexDataOffset(dexdata,pokemon2.species,48) + pbDexDataOffset(dexdata,pokemon2.species,31) @@ -254,3 +254,5 @@ - for i in 0...$PokemonMachines.length - if pbSpeciesCompatible?(babyspecies,i) - atk=$PokemonMachines[i] + for i in 0...$ItemData.length + next if !$ItemData[i] + atk=$ItemData[i][ITEMMACHINE] + next if !atk || atk==0 + if pbSpeciesCompatible?(babyspecies,atk) @@ -308,2 +310,1 @@ - pid&=~1 - pid|=babyability + abilityflag=rand(2) @@ -315,1 +316,1 @@ - break if pid%25==mother.nature && (pid&1)==babyability && (pid&0xFFFF0000) + break if pid%25==mother.nature && (pid&0xFFFF0000)!=0 @@ -321,0 +322,1 @@ + egg.abilityflag=abilityflag @@ -359,0 +361,2 @@ + pokemon.trainerID=$Trainer.id + pokemon.ot=$Trainer.name Changed: PokemonPokedex @@ -227,1 +227,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -229,1 +229,2 @@ - @sprites["pokedex"]=Window_Pokedex.new(160,0,320,320) + @sprites["pokedex"]=Window_Pokedex.new( + 160,0,Graphics.width-160,Graphics.height) @@ -235,1 +236,1 @@ - @sprites["overlay"].bitmap=Bitmap.new(480,320) + @sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height) @@ -514,1 +515,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -520,1 +521,1 @@ - @sprites["overlay"].bitmap=Bitmap.new(480,320) + @sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height) Changed: PokemonAnimEditor @@ -2,1 +2,2 @@ -begin +begin + @@ -2134,2 +2135,3 @@ - helpwindow=Window_SimpleTextPokemon.new(_INTL("Press F5 to rename an animation; press ESC to cancel"),320,0,320,128) - helpwindow.viewport=canvas.viewport + helpwindow=Window_SimpleTextPokemon.newWithSize( + _INTL("Press F5 to rename an animation; press ESC to cancel"), + 320,0,320,128,canvas.viewport) @@ -2403,1 +2405,1 @@ - cmdwin=Window_SimpleTextPokemon.new(helptext,0,0,480,480) + cmdwin=Window_SimpleTextPokemon.newWithSize(helptext,0,0,480,480) @@ -2738,7 +2740,13 @@ -end -rescue Exception -if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset" -raise $! -else -end -end +end + +rescue Exception + +if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset" + +raise $! + +else + +end + +end Changed: PokemonMenu @@ -107,2 +107,2 @@ - commands[cmdPokedex=commands.length]=_INTL("POKeDEX") if $Trainer.pokedex - commands[cmdPokemon=commands.length]=_INTL("POKeMON") if $Trainer.party.length>0 + commands[cmdPokedex=commands.length]=_INTL("POKéDEX") if $Trainer.pokedex + commands[cmdPokemon=commands.length]=_INTL("POKéMON") if $Trainer.party.length>0 @@ -110,1 +110,1 @@ - commands[cmdPokegear=commands.length]=_INTL("POKeGEAR") if $Trainer.pokegear + commands[cmdPokegear=commands.length]=_INTL("POKéGEAR") if $Trainer.pokegear Changed: PBIntl @@ -17,1 +17,1 @@ - if Time.now.to_i - t > 5 + if Time.now.to_i - t >= 5 @@ -38,0 +38,4 @@ + if Time.now.to_i - t >= 5 + t = Time.now.to_i + Graphics.update + end @@ -44,1 +48,1 @@ - if Time.now.to_i - t > 5 + if Time.now.to_i - t >= 5 @@ -58,1 +62,0 @@ - items|=[] @@ -69,1 +72,0 @@ - choices|=[] @@ -77,1 +79,0 @@ - items|=[] @@ -80,1 +81,0 @@ - items|=[] @@ -86,1 +86,0 @@ - items|=[] @@ -94,1 +93,0 @@ - items|=[] @@ -101,1 +99,12 @@ - MessageTypes.setMapMessagesAsHash(id,items.concat(choices)) + if Time.now.to_i - t >= 5 + t = Time.now.to_i + Graphics.update + end + items|=[] + choices|=[] + items.concat(choices) + MessageTypes.setMapMessagesAsHash(id,items) + if Time.now.to_i - t >= 5 + t = Time.now.to_i + Graphics.update + end @@ -283,0 +292,1 @@ + if str[/[\r\n\t]|^\s+|\s+$|\s{2,}/] @@ -289,1 +299,1 @@ - key.gsub!(/\s+/," ") + key.gsub!(/\s{2,}/," ") @@ -291,0 +301,2 @@ + end + return str @@ -293,5 +305,8 @@ - ret=value.clone - ret.gsub!(/\r/,"") - ret.gsub!(/\n/,"") - ret.gsub!(/\t/,"") - return ret + if value[/[\r\n\t]/] + ret=value.clone + ret.gsub!(/\r/,"") + ret.gsub!(/\n/,"") + ret.gsub!(/\t/,"") + return ret + end + return value @@ -300,5 +315,8 @@ - ret=value.clone - ret.gsub!(//,"\r") - ret.gsub!(//,"\n") - ret.gsub!(//,"\t") - return ret + if value[/<[rnt]>/] + ret=value.clone + ret.gsub!(//,"\r") + ret.gsub!(//,"\n") + ret.gsub!(//,"\t") + return ret + end + return value Changed: Scene_Map @@ -180,3 +180,3 @@ - sscene=PokemonMenu_Scene.new - sscreen=PokemonMenu.new(sscene) - sscreen.pbStartPokemonMenu + sscene=PokemonMenu_Scene.new + sscreen=PokemonMenu.new(sscene) + sscreen.pbStartPokemonMenu Changed: AnimationSprite @@ -45,1 +45,1 @@ - viewport=Viewport.new(0,0,480,320) + viewport=Viewport.new(0,0,Graphics.width,Graphics.height) Changed: Interpreter @@ -243,1 +243,1 @@ - for bt in $!.backtrace + for bt in $!.backtrace[0,10] Changed: Pokegear @@ -9,2 +9,0 @@ - WIDTH=480 - HEIGHT=320 @@ -31,1 +29,1 @@ - @command_window.x = (WIDTH - @command_window.width) - 8 + @command_window.x = (Graphics.width - @command_window.width) - 8 @@ -80,2 +78,2 @@ - @info.height = HEIGHT / 4 + 16 - @info.width = WIDTH / 2 + 74 + @info.height = Graphics.height / 4 + 16 + @info.width = Graphics.width / 2 + 74 @@ -83,1 +81,1 @@ - @info.y = HEIGHT - @info.height + @info.y = Graphics.height - @info.height Changed: Resolution* @@ -5,2 +5,0 @@ -CENTER_X = (480/2 - 16) * 4 # X coordinate in the center of the screen -CENTER_Y = (320/2 - 16) * 4 # Y coordinate in the center of the screen @@ -8,4 +6,6 @@ - max_x = ($game_map.width - 15) * 128 - max_y = ($game_map.height - 11.25) * 128 - dispx=x * 128 - CENTER_X - dispy=y * 128 - CENTER_Y + center_x = (Graphics.width/2 - 16) * 4 # X coordinate in the center of the screen + center_y = (Graphics.height/2 - 16) * 4 # Y coordinate in the center of the screen + max_x = ($game_map.width - Graphics.width/32.0) * 128 + max_y = ($game_map.height - Graphics.height/32.0) * 128 + dispx=x * 128 - center_x + dispy=y * 128 - center_y @@ -31,1 +31,1 @@ -if 320 / 32.0 < self.height - 1 +if Graphics.height / 32.0 < self.height - 1 @@ -49,1 +49,1 @@ -if 480 / 32.0 < self.width - 1 +if Graphics.width / 32.0 < self.width - 1 Changed: PerspectiveTilemap @@ -159,2 +159,0 @@ - @@width=480 - @@height=320 @@ -163,2 +161,2 @@ - return ((ch.screen_y - 16) - (@@height / 2)) * - (Draw_Tilemap::Pitch*1.0 / (@@height * 25)) + 1 + return ((ch.screen_y - 16) - (Graphics.height / 2)) * + (Draw_Tilemap::Pitch*1.0 / (Graphics.height * 25)) + 1 @@ -171,2 +169,2 @@ - return ((ch.screen_y - 16) - (@@height / 2)) * - (Draw_Tilemap::Pitch*1.0 / (@@height * 25)) + 1 + return ((ch.screen_y - 16) - (Graphics.height / 2)) * + (Draw_Tilemap::Pitch*1.0 / (Graphics.height * 25)) + 1 @@ -180,1 +178,1 @@ - widthdiv2=(@@width / 2) + widthdiv2=(Graphics.width / 2) @@ -191,1 +189,1 @@ - (2 * ((Draw_Tilemap::Pitch*1.0 / 100) / (@@height*1.0 / 16.0))) + 0.5)) + (2 * ((Draw_Tilemap::Pitch*1.0 / 100) / (Graphics.height*1.0 / 16.0))) + 0.5)) @@ -239,2 +237,0 @@ - @@width=480 - @@height=320 @@ -328,2 +324,2 @@ - minvalue=[0, ((@@height / 2) - ((@@height * 60) / @pitch) + @oy) / StripSize].max.to_i - maxvalue=[@numsprites - 1,(@oy + @@height) / StripSize].min.to_i + minvalue=[0, ((Graphics.height / 2) - ((Graphics.height * 60) / @pitch) + @oy) / StripSize].max.to_i + maxvalue=[@numsprites - 1,(@oy + Graphics.height) / StripSize].min.to_i @@ -353,1 +349,1 @@ - x=@@width/2 + x=Graphics.width/2 @@ -359,1 +355,1 @@ - zoom_x = (y - @@height*1.0 / 2) * (@pitch*1.0 / (@@height * 25)) + 1 + zoom_x = (y - Graphics.height*1.0 / 2) * (@pitch*1.0 / (Graphics.height * 25)) + 1 @@ -365,1 +361,1 @@ - (@@height*1.0 / (StripSize * 2)))) + 0.5) + (Graphics.height*1.0 / (StripSize * 2)))) + 0.5) @@ -427,1 +423,1 @@ - sprite.x = @@width / 2 + sprite.x = Graphics.width / 2 Changed: PokemonField @@ -13,0 +13,1 @@ +EXCLAMATION_ANIMATION_ID=17 @@ -106,1 +107,1 @@ - viewport=Viewport.new(0,0,480,320) + viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -493,1 +494,1 @@ - @darkness=Bitmap.new(480,320) + @darkness=Bitmap.new(Graphics.width,Graphics.height) @@ -508,1 +509,1 @@ - @darkness.fill_rect(0,0,480,320,Color.new(0,0,0,255)) + @darkness.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,255)) @@ -536,1 +537,1 @@ - @window.resizeToFit(name) + @window.resizeToFit(name,Graphics.width) Changed: PokemonSave @@ -5,1 +5,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -7,1 +7,0 @@ - @spriteskin=Bitmap.new($TextFrames[$PokemonSystem.frame]) @@ -20,2 +19,1 @@ - @sprites["locwindow"].windowskin=@spriteskin - @sprites["locwindow"].resizeToFit(loctext) + @sprites["locwindow"].resizeToFit(loctext,Graphics.width) @@ -31,1 +29,0 @@ - @spriteskin.dispose Changed: PokemonNetwork @@ -453,1 +453,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -543,1 +543,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -643,1 +643,1 @@ - cmdwin=Window_CommandPokemon.newEmpty(0,0,320,320) + cmdwin=Window_CommandPokemon.newEmpty(0,0,320,Graphics.height) @@ -783,1 +783,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -802,1 +802,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -819,1 +819,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -835,1 +835,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -1038,1 +1038,1 @@ - cmdwin=Window_CommandPokemon.newEmpty(0,0,480,320,@viewport) + cmdwin=Window_CommandPokemon.newEmpty(0,0,Graphics.width,Graphics.height,@viewport) @@ -1120,1 +1120,1 @@ - cmdwin=Window_CommandPokemon.newEmpty(0,0,320,320,@viewport) + cmdwin=Window_CommandPokemon.newEmpty(0,0,320,Graphics.height,@viewport) Changed: PokemonMart @@ -76,4 +76,3 @@ - if item>=$PokemonFirstMachine && item<$PokemonFirstMachine+$PokemonMachines.length - machine=$PokemonMachines[item-$PokemonFirstMachine] - itemname+=" " - itemname+=PBMoves.getName(machine) + if $ItemData[item][ITEMPOCKET]==3 + machine=$ItemData[item][ITEMMACHINE] + itemname=_INTL("{1} {2}",itemname,PBMoves.getName(machine)) Changed: PokemonTrainers @@ -76,0 +76,2 @@ + trname=getConstantName(PBTrainers,trainer[0]) rescue nil + next if !trname @@ -77,1 +79,1 @@ - f.write(sprintf("%s\r\n",getConstantName(PBTrainers,trainer[0]))) + f.write(sprintf("%s\r\n",trname)) @@ -107,29 +109,0 @@ -end - -def pbNewTrainerType(trainertype) - record=[] - record[3]=30 - record[1]=trainertype - Kernel.pbMessage(_INTL("Please enter the trainer type's name.")) - record[2]=pbEnterText(_INTL("Trainer type's name:"),1,12,trainertype) - record[2]=trainertype if record[2]=="" - record[7]=Kernel.pbMessage(_INTL("Is the Trainer male, female, or mixed gender?"),[ - _INTL("MALE"),_INTL("FEMALE"),_INTL("MIXED") - ],0) - record[3]=Kernel.pbMessageChooseNumber( - _INTL("Set the money per level won for defeating the Trainer."),40,2 - ) - data=load_data("Data/trainernames.dat") - maxid=-1 - for rec in data - next if !rec - maxid=[maxid,rec[0]].max - end - record[0]=maxid+1 - PBTrainers.const_set(trainertype,record[0]) - data[record[0]]=record - data=save_data(data,"Data/trainernames.dat") - pbConvertTrainerData - Kernel.pbMessage(_INTL("The Trainer type was added to PBS/trainernames.txt.")) - Kernel.pbMessage(_INTL("See that file for other settings, including music.")) - Kernel.pbMessage(_ISPRINTF("Put the Trainer's graphic (trainer{1:03d}.png) in Graphics/Characters, or it will be blank.",record[0])) @@ -177,1 +150,1 @@ - pbNewTrainerType(symbol.to_s) + pbTrainerTypeEditorNew(symbol.to_s) @@ -319,0 +292,3 @@ + elsif $game_screen.weather_type==5 + battle.weather=PBWeather::SUNNYDAY + battle.weatherduration=-1 @@ -326,0 +302,2 @@ + $game_system.bgm_play(playingBGM) + $game_system.bgs_play(playingBGS) Changed: SpriteResizer @@ -10,0 +10,17 @@ + + +module Graphics + @width=480 + @height=320 + def self.width + return @width + end + def self.height + return @height + end + def self.resize_screen(w,h) + @width=w + @height=h + pbSetResizeFactor($ResizeFactor) + end +end @@ -48,2 +65,2 @@ - (480+$ResizeOffsetX*2)*factor, - (320+$ResizeOffsetY*2)*factor + (Graphics.width+$ResizeOffsetX*2)*factor, + (Graphics.height+$ResizeOffsetY*2)*factor @@ -309,1 +326,3 @@ - @defaultbitmap=Bitmap.new(640,480) + @defaultwidth=640 + @defaultheight=480 + @defaultbitmap=Bitmap.new(@defaultwidth,@defaultheight) @@ -336,6 +355,6 @@ - @defaultbitmap.fill_rect(0,0,640,$ResizeOffsetY,Color.new(0,0,0)) - @defaultbitmap.fill_rect(0,0,$ResizeOffsetX,480,Color.new(0,0,0)) - @defaultbitmap.fill_rect(640-$ResizeOffsetX,0, - $ResizeOffsetX,480,Color.new(0,0,0)) - @defaultbitmap.fill_rect(0,480-$ResizeOffsetY, - 640,$ResizeOffsetY,Color.new(0,0,0)) + @defaultbitmap.fill_rect(0,0,@defaultwidth,$ResizeOffsetY,Color.new(0,0,0)) + @defaultbitmap.fill_rect(0,0,$ResizeOffsetX,@defaultheight,Color.new(0,0,0)) + @defaultbitmap.fill_rect(@defaultwidth-$ResizeOffsetX,0, + $ResizeOffsetX,@defaultheight,Color.new(0,0,0)) + @defaultbitmap.fill_rect(0,@defaultheight-$ResizeOffsetY, + @defaultwidth,$ResizeOffsetY,Color.new(0,0,0)) Changed: PokemonLoad @@ -22,1 +22,1 @@ - @sprites["locwindow"].resizeToFit(loctext) + @sprites["locwindow"].resizeToFit(loctext,Graphics.width) Changed: Main @@ -6,1 +6,0 @@ - @@ -9,1 +8,0 @@ - raise "test" Changed: PokeBattle_AI @@ -44,0 +44,1 @@ + score-=40 if opponent.pbHasType?(PBTypes::FIRE) @@ -107,0 +108,1 @@ + score-=90 if opponent.pbHasType?(PBTypes::POISON) || opponent.pbHasType?(PBTypes::STEEL) @@ -165,0 +167,1 @@ + score-=90 if opponent.pbHasType?(PBTypes::POISON) || opponent.pbHasType?(PBTypes::STEEL) @@ -368,0 +371,1 @@ + score-=90 if opponent.pbHasType?(PBTypes::FIRE) Changed: WindowAndTilemap @@ -1102,1 +1102,1 @@ - val=(val*$ResizeFactor).to_i + val=(val*$ResizeFactor).round @@ -1109,1 +1109,1 @@ - val=(val*$ResizeFactor).to_i + val=(val*$ResizeFactor).round Changed: PokemonWeather @@ -14,1 +14,1 @@ - @viewport=Viewport.new(0,0,640,480) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -164,2 +164,2 @@ - nomwidth=480 - nomheight=320 + nomwidth=Graphics.width + nomheight=Graphics.height Changed: Game_Event* @@ -20,1 +20,1 @@ - moveto(@event.x, @event.y) + moveto(@event.x, @event.y) if map Changed: Game_System @@ -61,1 +61,1 @@ - def bgm_play(bgm,volume=100,pitch=100) + def bgm_play_ex(bgm,volume,pitch,setplaying) @@ -65,1 +65,3 @@ - @playing_bgm = bgm==nil ? nil : bgm.clone + if setplaying + @playing_bgm = bgm==nil ? nil : bgm.clone + end @@ -80,0 +82,3 @@ + end + def bgm_play(bgm,volume=100,pitch=100) + bgm_play_ex(bgm,volume,pitch,true) Changed: Compiler @@ -7,0 +7,1 @@ + emessage=e.message @@ -20,1 +21,2 @@ - e.backtrace.each do |i| + s="" + e.backtrace[0,10].each do |i| @@ -24,0 +26,1 @@ + File.open("errorlog.txt","ab"){|f| f.write(message) } @@ -48,0 +51,48 @@ +module FileLineData + @file="" + @linedata="" + @lineno=0 + @section=nil + @key=nil + @value=nil + def self.file + @file + end + def self.file=(value) + @file=value + end + def self.clear + @file="" + @linedata="" + @lineno="" + @section=nil + @key=nil + @value=nil + end + def self.linereport + if @section + return _INTL("File {1}, section {2}, key {3}\r\n{4}\r\n",@file,@section,@key,@value) + else + return _INTL("File {1}, line {2}\r\n{3}\r\n",@file,@lineno,@linedata) + end + end + def self.setSection(section,key,value) + @section=section + @key=key + if value && value.length>200 + @value=_INTL("{1}...",value[0,200]) + else + @value=value + end + end + def self.setLine(line,lineno) + @section=nil + if line && line.length>200 + @linedata=_INTL("{1}...",line[0,200]) + else + @linedata=line + end + @lineno=lineno + end +end + @@ -62,2 +113,2 @@ - line.sub!(/\s*\#.*$/){""} - line.sub!(/\s*$/){""} + line.sub!(/\s*\#.*$/,"") + line.sub!(/\s+$/,"") @@ -86,1 +137,1 @@ - raise _INTL("Invalid quoted field (in: {1})",ret) + raise _INTL("Invalid quoted field (in: {1})\r\n{2}",ret,FileLineData.linereport) @@ -99,1 +150,1 @@ - ret + return ret @@ -118,1 +169,1 @@ - raise _INTL("Field {1} is not a Boolean value [line {2}]",ret,line) + raise _INTL("Field {1} is not a Boolean value (true, false, 1, 0)\r\n{2}",ret,FileLineData.linereport) @@ -127,1 +178,1 @@ - raise _INTL("Field {1} is not a positive integer [line {2}]",ret,line) + raise _INTL("Field {1} is not a positive integer\r\n{2}",ret,FileLineData.linereport) @@ -135,1 +186,1 @@ - raise _INTL("Field {1} is not an integer [line {2}]",ret,line) + raise _INTL("Field {1} is not an integer\r\n{2}",ret,FileLineData.linereport) @@ -143,1 +194,1 @@ - return Float(ret) rescue raise _INTL("Field {1} is not a number [section {2}, key {3}]",ret,section,key) + return Float(ret) rescue raise _INTL("Field {1} is not a number\r\n{2}",FileLineData.linereport) @@ -154,0 +205,1 @@ + @@ -326,1 +378,1 @@ - raise _INTL("Field {1} is not a positive integer (line {2})",field,lineno) + raise _INTL("Field {1} is not a positive integer\r\n{2}",field,FileLineData.linereport) @@ -342,1 +394,1 @@ - record.push(csvEnumField!(rec,schema[2+i],"",_INTL("(line {1})",lineno))) + record.push(csvEnumField!(rec,schema[2+i],"",FileLineData.linereport)) @@ -420,0 +472,36 @@ + +def pbCompilerEachCommentedLine(filename) + File.open(filename,"rb"){|f| + FileLineData.file=filename + lineno=1 + f.each_line {|line| + if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF + line=line[3,line.length-3] + end + if !line[/^\#/] && !line[/^\s*$/] + FileLineData.setLine(line,lineno) + yield line, lineno + end + lineno+=1 + } + } +end + +def pbCompilerEachPreppedLine(filename) + File.open(filename,"rb"){|f| + FileLineData.file=filename + lineno=1 + f.each_line {|line| + if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF + line=line[3,line.length-3] + end + line=prepline(line) + if !line[/^\#/] && !line[/^\s*$/] + FileLineData.setLine(line,lineno) + yield line, lineno + end + lineno+=1 + } + } +end + @@ -422,2 +510,1 @@ - File.open("PBS/btpokemon.txt","rb"){|f| - pbEachCommentedLine(f){|line,lineno| + pbCompilerEachCommentedLine("PBS/btpokemon.txt"){|line,lineno| @@ -426,1 +513,0 @@ - } @@ -442,0 +528,1 @@ + FileLineData.file="PBS/bttrainers.txt" @@ -447,0 +534,1 @@ + FileLineData.setSection(name,key,section[key]) @@ -468,2 +556,1 @@ - File.open("PBS/townmap.txt","rb"){|f| - pbEachCommentedLine(f){|line,lineno| + pbCompilerEachCommentedLine("PBS/townmap.txt"){|line,lineno| @@ -475,1 +562,1 @@ - raise _INTL("Expected a section at the beginning of the file (line {1})",lineno) + raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport) @@ -478,1 +565,1 @@ - raise _INTL("Bad line syntax (expected syntax like XXX=YYY) (line {1})",lineno) + raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}",FileLineData.linereport) @@ -496,2 +583,2 @@ - } - File.open("Data/townmap.dat","wb"){|f| + } + File.open("Data/townmap.dat","wb"){|f| @@ -499,1 +586,0 @@ - } @@ -538,2 +624,1 @@ - File.open("PBS/metadata.txt","rb"){|f| - pbEachCommentedLine(f) {|line,lineno| + pbCompilerEachCommentedLine("PBS/metadata.txt") {|line,lineno| @@ -553,1 +638,1 @@ - raise _INTL("Expected a section at the beginning of the file (line {1})",lineno) + raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport) @@ -556,1 +641,1 @@ - raise _INTL("Bad line syntax (expected syntax like XXX=YYY) (line {1})",lineno) + raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}",FileLineData.linereport) @@ -559,0 +644,1 @@ + FileLineData.setSection(currentmap,$~[1],$~[2]) @@ -569,4 +655,3 @@ - } - File.open("Data/metadata.dat","wb"){|f| - Marshal.dump(sections,f) - } + } + File.open("Data/metadata.dat","wb"){|f| + Marshal.dump(sections,f) @@ -575,1 +660,1 @@ - MessageTypes::StorageCreator,[sections[0][6]] + MessageTypes::StorageCreator,[sections[0][6]] @@ -584,8 +669,2 @@ - File.open("PBS/items.txt","rb"){|f| - lineno=1 - f.each_line {|line| - if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF - line=line[3,line.length-3] - end - if !line[/^\#/] && !line[/^\s*$/] - linerecord=pbGetCsvRecord(line,lineno,[0,"ussuusuuU"]) + pbCompilerEachCommentedLine("PBS/items.txt"){|line,lineno| + linerecord=pbGetCsvRecord(line,lineno,[0,"ussuusuuUS"]) @@ -606,0 +685,5 @@ + if linerecord[9]!="" && linerecord[9] + record.push(PBMoves.const_get(linerecord[9])) + else + record.push(0) + end @@ -607,3 +691,0 @@ - lineno+=1 - end - } @@ -625,2 +706,1 @@ - File.open("PBS/connections.txt","rb"){|f| - pbEachPreppedLine(f){|line,lineno| + pbCompilerEachPreppedLine("PBS/connections.txt"){|line,lineno| @@ -642,1 +722,1 @@ - raise _INTL("North side of first map must connect with south side of second map (line {1})",lineno) if record[4]!="S" + raise _INTL("North side of first map must connect with south side of second map\r\n{1}",FileLineData.linereport) if record[4]!="S" @@ -644,1 +724,1 @@ - raise _INTL("South side of first map must connect with north side of second map (line {1})",lineno) if record[4]!="N" + raise _INTL("South side of first map must connect with north side of second map\r\n{1}",FileLineData.linereport) if record[4]!="N" @@ -646,1 +726,1 @@ - raise _INTL("East side of first map must connect with west side of second map (line {1})",lineno) if record[4]!="W" + raise _INTL("East side of first map must connect with west side of second map\r\n{1}",FileLineData.linereport) if record[4]!="W" @@ -648,1 +728,1 @@ - raise _INTL("West side of first map must connect with east side of second map (line {1})",lineno) if record[4]!="E" + raise _INTL("West side of first map must connect with east side of second map\r\n{1}",FileLineData.linereport) if record[4]!="E" @@ -652,1 +732,0 @@ - } @@ -691,12 +770,0 @@ -def linetoarr(line) - splitarr=strsplit(line,/\s*,\s*/) - splitarr[2]=splitarr[1] if splitarr.length==2 - splitarr[1]=splitarr[1].to_i - splitarr[2]=splitarr[2].to_i - if splitarr[1]>splitarr[2] - raise _INTL("Minimum level is greater than maximum level: {1}",line) - end - splitarr[0]=parseSpecies(splitarr[0]) - return splitarr -end - @@ -718,1 +785,1 @@ - return pbGetConst(PBItems,item,"Undefined item constant name: %s") + return pbGetConst(PBItems,item,_INTL("Undefined item constant name: %s\r\n{1}",FileLineData.linereport)) @@ -727,1 +794,1 @@ - return pbGetConst(PBSpecies,item,"Undefined species constant name: %s") + return pbGetConst(PBSpecies,item,_INTL("Undefined species constant name: %s\r\n{1}",FileLineData.linereport)) @@ -734,1 +801,1 @@ - return pbGetConst(PBMoves,item,"Undefined move constant name: %s") + return pbGetConst(PBMoves,item,_INTL("Undefined move constant name: %s\r\n{1}",FileLineData.linereport)) @@ -741,1 +808,1 @@ - return pbGetConst(PBTrainers,item,"Undefined Trainer constant name: %s") + return pbGetConst(PBTrainers,item,_INTL("Undefined Trainer constant name: %s\r\n{1}",FileLineData.linereport)) @@ -765,0 +832,2 @@ +linenos=[] +FileLineData.file="PBS/encounters.txt" @@ -766,0 +835,1 @@ + lineno=1 @@ -768,1 +838,5 @@ - lines[lines.length]=line if line!="" + if line.length!=0 + lines[lines.length]=line + linenos[linenos.length]=lineno + end + lineno+=1 @@ -777,1 +851,2 @@ -i=0; loop do break unless isplitarr[2] + raise _INTL("Minimum level is greater than maximum level: {1}\r\n{2}",line,FileLineData.linereport) @@ -816,0 +894,2 @@ + splitarr[0]=parseSpecies(splitarr[0]) + linearr=splitarr @@ -823,1 +903,1 @@ - needdensity + needdensity=false @@ -834,1 +914,1 @@ - raise _INTL("Wrong syntax for densities in encounters.txt; got \"{1}\"",line) + raise _INTL("Wrong syntax for densities in encounters.txt; got \"{1}\"\r\n{2}",line,FileLineData.linereport) @@ -838,2 +918,2 @@ - raise _INTL("Undefined encounter type {1}, expected one of the following:\r\n{2}", - line,EncounterTypes::Names.inspect) + raise _INTL("Undefined encounter type {1}, expected one of the following:\r\n{2}\r\n{3}", + line,EncounterTypes::Names.inspect,FileLineData.linereport) @@ -849,8 +929,1 @@ -File.open("PBS/moves.txt","rb"){|f| - lineno=1 - f.each_line {|line| - if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF - line=line[3,line.length-3] - end - line=prepline(line) - next if line=="" +pbCompilerEachPreppedLine("PBS/moves.txt"){|line,lineno| @@ -861,2 +934,0 @@ - lineno+=1 - } @@ -920,8 +991,1 @@ -File.open("PBS/abilities.txt","rb"){|f| - lineno=1 - f.each_line {|line| - if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF - line=line[3,line.length-3] - end - line=prepline(line) - next if line=="" + pbCompilerEachPreppedLine("PBS/abilities.txt"){|line,lineno| @@ -932,3 +996,1 @@ - lineno+=1 - } -} + } @@ -978,8 +1040,1 @@ -File.open("PBS/trainernames.txt","rb"){|f| - lineno=1 - f.each_line {|line| - if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF - line=line[3,line.length-3] - end - line=prepline(line) - next if line=="" + pbCompilerEachPreppedLine("PBS/trainernames.txt"){|line,lineno| @@ -991,1 +1046,1 @@ - raise _INTL("Bad money amount (must be from 0 through 255) [in: {1}]",lineno) + raise _INTL("Bad money amount (must be from 0 through 255)\r\n{1}",FileLineData.linereport) @@ -996,2 +1051,2 @@ - raise _INTL("Two trainer types ({1} and {2}) have the same ID ({3}), which is not allowed.", - records[record[0]][1],record[1],record[0]) + raise _INTL("Two trainer types ({1} and {2}) have the same ID ({3}), which is not allowed.\r\n{4}", + records[record[0]][1],record[1],record[0],FileLineData.linereport) @@ -1000,3 +1055,1 @@ - lineno+=1 - } -} + } @@ -1020,0 +1073,1 @@ + FileLineData.file="PBS/trainers.txt" @@ -1034,0 +1088,1 @@ + FileLineData.setLine(lines[i],linenos[i]) @@ -1035,0 +1090,1 @@ + FileLineData.setLine(lines[i+1],linenos[i+1]) @@ -1037,1 +1093,1 @@ - raise _INTL("Trainer name too long (trainers.txt line {1})",linenos[i+1]) if name.length>=0x10000 + raise _INTL("Trainer name too long\r\n{1}",FileLineData.linereport) if name.length>=0x10000 @@ -1041,1 +1097,1 @@ - raise _INTL("Expected a number for the number of Pokemon (trainers.txt line {1})",linenos[i+2]) if !nameline[1][/^\d+$/] + raise _INTL("Expected a number for the trainer battle ID\r\n{1}",FileLineData.linereport) if !nameline[1][/^\d+$/] @@ -1044,0 +1100,1 @@ + FileLineData.setLine(lines[i+2],linenos[i+2]) @@ -1047,1 +1104,1 @@ - raise _INTL("Expected a number for the number of Pokemon (trainers.txt line {1})",linenos[i+2]) if !items[0][/^\d+$/] + raise _INTL("Expected a number for the number of Pokemon\r\n{1}",FileLineData.linereport) if !items[0][/^\d+$/] @@ -1050,1 +1107,1 @@ - raise _INTL("Too many items (max. 4) (trainers.txt line {1})",linenos[i+2]) if items.length>5 + raise _INTL("Too many items (max. 4)\r\n{1}",FileLineData.linereport) if items.length>5 @@ -1058,0 +1115,1 @@ + FileLineData.setLine(lines[i+j+3],linenos[i+j+3]) @@ -1062,1 +1120,1 @@ - raise _INTL("Expected a species name: {1} (trainers.txt line {2})",poke[0],linenos[i+j+3]) + raise _INTL("Expected a species name: {1}\r\n{2}",poke[0],FileLineData.linereport) @@ -1065,1 +1123,1 @@ - raise _INTL("Bad level: {1} (trainers.txt line {2})",poke[1],linenos[i+j+3]) if poke[1]<=0 || poke[1]>100 + raise _INTL("Bad level: {1} (must be from 1-100)\r\n{2}",poke[1],FileLineData.linereport) if poke[1]<=0 || poke[1]>100 @@ -1070,1 +1128,1 @@ - raise _INTL("Bad IV: {1} (trainers.txt line {2})",poke[2],linenos[i+j+3]) if poke[2]<0 || poke[2]>31 + raise _INTL("Bad IV: {1} (must be from 0-31)\r\n{2}",poke[2],FileLineData.linereport) if poke[2]<0 || poke[2]>31 @@ -1093,0 +1151,24 @@ +def removeConstantName(mod,name) + for c in mod.constants + if name.to_sym==c.to_sym + mod.send(:remove_const,c.to_sym) + end + end +end + +def removeConstantValue(mod,value) + for c in mod.constants + if mod.const_get(c.to_sym)==value + mod.send(:remove_const,c.to_sym) + end + end +end + +def setConstantName(mod,value,name) + for c in mod.constants + if mod.const_get(c.to_sym)==value + mod.send(:remove_const,c.to_sym) + end + end + mod.const_set(name,value) +end @@ -1099,0 +1181,42 @@ +end + +def pbCompileMachines + lineno=1 + havesection=false + sectionname=nil + sections=[] + f=File.open("PBS/tm.txt","rb") + FileLineData.file="PBS/tm.txt" + f.each_line {|line| + if lineno==1&&line[0]==0xEF&&line[1]==0xBB&&line[2]==0xBF + line=line[3,line.length-3] + end + FileLineData.setLine(line,lineno) + if !line[/^\#/] && !line[/^\s*$/] + if line[/^\s*\[\s*(.*)\s*\]\s*$/] + sectionname=PBMoves.const_get($~[1]) + sections[sectionname]=WordArray.new + havesection=true + else + if sectionname==nil + raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport) + end + specieslist=line.split(",") + for species in specieslist + species.sub!(/^\s+/,"") + species.sub!(/\s+$/,"") + sec=sections[sectionname] + sec[sec.length]=PBSpecies.const_get(species) + end + end + end + lineno+=1 + if lineno%500==0 + Graphics.update + end + if lineno%50==0 + Win32API.SetWindowText(_INTL("Processing line {1}",lineno)) + end + } + save_data(sections,"Data/tm.dat") + f.close @@ -1559,1 +1683,1 @@ - raise _INTL("Expected a section at the beginning of the file (line {1})",lineno) + raise _INTL("Expected a section at the beginning of the file\r\n{1}",FileLineData.linereport) @@ -1562,1 +1686,1 @@ - raise _INTL("Bad line syntax (expected syntax like XXX=YYY) (line {1})",lineno) + raise _INTL("Bad line syntax (expected syntax like XXX=YYY)\r\n{1}",FileLineData.linereport) @@ -1620,0 +1744,33 @@ + end +end + +class WordArray + include Enumerable + def initialize(data=nil) + if data + @a=data.unpack("v*") + else + @a=[] + end + end + def []=(i,value) + @a[i]=value + end + def [](i) + return @a[i] + end + def length;@a.length;end + def size;@a.size;end + def fillNils(length,value) + for i in 0...length + @a[i]=value if !@a[i] + end + end + def each + @a.each {|i| yield i} + end + def self._load(str) + return self.new(str) + end + def _dump(depth=100) + return @a.pack("v*") @@ -1714,0 +1871,1 @@ + FileLineData.file="PBS/pokemon.txt" @@ -1726,0 +1884,1 @@ + FileLineData.setSection(currentmap,key,lastsection[key]) @@ -1778,5 +1937,5 @@ - elsif key=="Machines" - raise _INTL("Invalid machine value: {1} (section {2})",value,currentmap) if value<=0||value>58 - value-=1 - machines[currentmap]=[0,0,0,0,0,0,0,0] if !machines[currentmap] - machines[currentmap][value>>3]|=(1<<(value&7)) +# elsif key=="Machines" +# raise _INTL("Invalid machine value: {1} (section {2})",value,currentmap) if value<=0||value>58 +# value-=1 +# machines[currentmap]=[0,0,0,0,0,0,0,0] if !machines[currentmap] +# machines[currentmap][value>>3]|=(1<<(value&7)) @@ -1841,0 +2000,1 @@ + FileLineData.setSection(i,"Evolutions","") @@ -1853,1 +2013,1 @@ - evolist[i][2]=csvEnumField!(evolist[i][2],PBItems,"Evolutions",currentmap) + evolist[i][2]=csvEnumField!(evolist[i][2],PBItems,"Evolutions",i) @@ -1855,1 +2015,1 @@ - evolist[i][2]=csvEnumField!(evolist[i][2],PBMoves,"Evolutions",currentmap) + evolist[i][2]=csvEnumField!(evolist[i][2],PBMoves,"Evolutions",i) @@ -1857,1 +2017,1 @@ - evolist[i][2]=csvEnumField!(evolist[i][2],PBSpecies,"Evolutions",currentmap) + evolist[i][2]=csvEnumField!(evolist[i][2],PBSpecies,"Evolutions",i) @@ -1960,0 +2120,1 @@ +=begin @@ -1972,0 +2133,1 @@ +=end @@ -1987,1 +2149,1 @@ -"tmRS.dat", +"tm.dat", @@ -2005,1 +2167,2 @@ -"bttrainers.txt" +"bttrainers.txt", +"tm.txt" @@ -2275,0 +2438,50 @@ +def pbCompileAllData(mustcompile) + FileLineData.clear + if mustcompile + yield(_INTL("Compiling town map data")) + pbCompileTownMap + # No dependencies + yield(_INTL("Compiling map connection data")) + pbCompileConnections + # No dependencies + yield(_INTL("Compiling move data")) + pbCompileMoves + # No dependencies + yield(_INTL("Compiling ability data")) + pbCompileAbilities + # No dependencies + yield(_INTL("Compiling item data")) + pbCompileItems + # Depends on PBMoves, PBSpecies, PBItems, PBAbilities + yield(_INTL("Compiling Pokemon data")) + pbCompilePokemonData + # Depends on PBSpecies, PBMoves + yield(_INTL("Compiling machine data")) + pbCompileMachines + # Depends on PBSpecies, PBItems, PBMoves + yield(_INTL("Compiling Trainer data")) + pbCompileTrainers + # Depends on PBTrainers + yield(_INTL("Compiling phone data")) + pbCompilePhoneData + # Depends on PBTrainers + yield(_INTL("Compiling metadata")) + pbCompileMetadata + # Depends on PBTrainers + yield(_INTL("Compiling battle Trainer data")) + pbCompileBTTrainers + # Depends on PBSpecies + yield(_INTL("Compiling encounter data")) + pbCompileEncounters + # Depends on PBSpecies, PBItems, PBMoves, PBNatures + yield(_INTL("Compiling battle Pokemon data")) + pbCompileBattlePokemon + yield(_INTL("Compiling messages")) + else + MessageTypes.loadMessageFile("Data/messages.dat") + end + pbCompileAnimations + pbCompileTrainerEvents + pbSetTextMessages + MessageTypes.saveMessages +end @@ -2309,44 +2522,2 @@ - # No dependencies - Win32API.SetWindowText(_INTL("Compiling town map data")) - pbCompileTownMap - # No dependencies - Win32API.SetWindowText(_INTL("Compiling map connection data")) - pbCompileConnections - # No dependencies - Win32API.SetWindowText(_INTL("Compiling move data")) - pbCompileMoves - # No dependencies - Win32API.SetWindowText(_INTL("Compiling ability data")) - pbCompileAbilities - # No dependencies - Win32API.SetWindowText(_INTL("Compiling item data")) - pbCompileItems - # Depends on PBMoves, PBSpecies, PBItems, PBAbilities - Win32API.SetWindowText(_INTL("Compiling Pokemon data")) - pbCompilePokemonData - # Depends on PBSpecies, PBItems, PBMoves - Win32API.SetWindowText(_INTL("Compiling Trainer data")) - pbCompileTrainers - # Depends on PBTrainers - Win32API.SetWindowText(_INTL("Compiling phone data")) - pbCompilePhoneData - # Depends on PBTrainers - Win32API.SetWindowText(_INTL("Compiling metadata")) - pbCompileMetadata - # Depends on PBTrainers - Win32API.SetWindowText(_INTL("Compiling battle Trainer data")) - pbCompileBTTrainers - # Depends on PBSpecies - Win32API.SetWindowText(_INTL("Compiling encounter data")) - pbCompileEncounters - # Depends on PBSpecies, PBItems, PBMoves, PBNatures - Win32API.SetWindowText(_INTL("Compiling battle Pokemon data")) - pbCompileBattlePokemon - Win32API.SetWindowText(_INTL("Compiling messages")) - else - MessageTypes.loadMessageFile("Data/messages.dat") - end - pbCompileAnimations - pbCompileTrainerEvents - pbSetTextMessages - MessageTypes.saveMessages + end + pbCompileAllData(mustcompile){|msg| Win32API.SetWindowText(msg) } Changed: Game_Player* @@ -135,2 +135,0 @@ - CENTER_X = (480 - 16) * 4 # Center screen x-coordinate * 4 - CENTER_Y = (360 - 16) * 4 # Center screen y-coordinate * 4 @@ -398,4 +396,6 @@ - max_x = ($game_map.width - 15) * 128 - max_y = ($game_map.height - 11.25) * 128 - $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max - $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max + center_x = (Graphics.width/2 - 16) * 4 # Center screen x-coordinate * 4 + center_y = (Graphics.height/2 - 16) * 4 # Center screen y-coordinate * 4 + max_x = ($game_map.width - Graphics.width/32.0) * 128 + max_y = ($game_map.height - Graphics.height/32.0) * 128 + $game_map.display_x = [0, [x * 128 - center_x, max_x].min].max + $game_map.display_y = [0, [y * 128 - center_y, max_y].min].max @@ -589,0 +589,2 @@ + center_x = (Graphics.width/2 - 16) * 4 # Center screen x-coordinate * 4 + center_y = (Graphics.height/2 - 16) * 4 # Center screen y-coordinate * 4 @@ -591,1 +593,1 @@ - if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y + if @real_y > last_real_y and @real_y - $game_map.display_y > center_y @@ -597,1 +599,1 @@ - if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X + if @real_x < last_real_x and @real_x - $game_map.display_x < center_x @@ -603,1 +605,1 @@ - if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X + if @real_x > last_real_x and @real_x - $game_map.display_x > center_x @@ -609,1 +611,1 @@ - if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y + if @real_y < last_real_y and @real_y - $game_map.display_y < center_y @@ -634,1 +636,1 @@ - if Input.trigger?(Input::C) + if Input.trigger?(Input::C) && !$PokemonTemp.miniupdate Changed: PokemonEvolution @@ -352,1 +352,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -366,4 +366,4 @@ - rsprite1.x=240 - rsprite1.y=120 - rsprite2.x=240 - rsprite2.y=120 + rsprite1.x=Graphics.width/2 + rsprite1.y=(Graphics.height-96)/2 + rsprite2.x=Graphics.width/2 + rsprite2.y=(Graphics.height-96)/2 Changed: Spriteset_Map @@ -5,4 +5,4 @@ - @viewport1 = Viewport.new(0, 0, 640, 480) - @viewport1a = Viewport.new(0, 0, 640, 480) - @viewport2 = Viewport.new(0, 0, 640, 480) - @viewport3 = Viewport.new(0, 0, 640, 480) + @viewport1 = Viewport.new(0, 0, Graphics.width,Graphics.height) + @viewport1a = Viewport.new(0, 0, Graphics.width,Graphics.height) + @viewport2 = Viewport.new(0, 0, Graphics.width,Graphics.height) + @viewport3 = Viewport.new(0, 0, Graphics.width,Graphics.height) @@ -150,1 +150,1 @@ - screne_width += 480*4+256 # 2816 + screne_width += Graphics.width*4+256 # 2816 @@ -152,1 +152,1 @@ - screne_height += 320*4+256 # 2176 + screne_height += Graphics.height*4+256 # 2176 @@ -185,2 +185,4 @@ - @tilemap.ox = @map.display_x / 4 - @tilemap.oy = @map.display_y / 4 + tmox = @map.display_x.to_i / 4 + tmoy = @map.display_y.to_i / 4 + @tilemap.ox=tmox + @tilemap.oy=tmoy @@ -188,2 +190,2 @@ - @viewport1.rect.x=[-@tilemap.ox,0].max - @viewport1.rect.y=[-@tilemap.oy,0].max + @viewport1.rect.x=[-tmox,0].max + @viewport1.rect.y=[-tmoy,0].max @@ -191,1 +193,1 @@ - [@tilemap.map_data.xsize*32-@tilemap.ox,480].min + [@tilemap.map_data.xsize*32-tmox,480].min @@ -193,3 +195,3 @@ - [@tilemap.map_data.ysize*32-@tilemap.oy,320].min - @viewport1.ox=[-@tilemap.ox,0].max - @viewport1.oy=[-@tilemap.oy,0].max + [@tilemap.map_data.ysize*32-tmoy,320].min + @viewport1.ox=[-tmox,0].max + @viewport1.oy=[-tmoy,0].max @@ -197,1 +199,1 @@ - @viewport1.rect.set(0,0,640,480) + @viewport1.rect.set(0,0,Graphics.width,Graphics.height) Changed: PokemonEditor @@ -1,0 +1,40 @@ + +def bltSmallAutotile(autotiles,bitmap,x,y,id,frame) + return if frame<0 || !autotiles || id>=384 + autotile=autotiles[id/48-1] + return if !autotile || autotile.disposed? + cxTile=2 + cyTile=2 + if autotile.height==32 + anim=frame*32 + src_rect=Rect.new(anim,0,32,32) + bitmap.stretch_blt(Rect.new(x,y,cxTile*2,cyTile*2),autotile,src_rect) + else + anim=frame*96 + id%=48 + tiles = TileDrawingHelper::Autotiles[id>>3][id&7] + src=Rect.new(0,0,0,0) + for i in 0...4 + tile_position = tiles[i] - 1 + src.set(tile_position % 6 * 16 + anim, + tile_position / 6 * 16, 16, 16) + bitmap.stretch_blt(Rect.new(i%2*cxTile+x,i/2*cyTile+y,cxTile,cyTile), + autotile, src) + end + end +end + + +def bltSmallRegularTile(tileset,bitmap,x,y,id) + return if !tileset || id<384 || tileset.disposed? + rect=Rect.new((id - 384) % 8 * 32, (id - 384) / 8 * 32,32,32) + bitmap.stretch_blt(Rect.new(x,y,4,4),tileset,rect) +end + +def bltSmallTile(tileset,autotiles,bitmap,x,y,id,frame=0) + if id>=384 + bltSmallRegularTile(tileset,bitmap,x,y,id) + elsif id>0 + bltSmallAutotile(autotiles,bitmap,x,y,id,frame) + end +end @@ -5,0 +45,1 @@ + black=Color.new(0,0,0) @@ -7,5 +48,5 @@ - blue=Color.new(0,0,255) - darkblue=Color.new(0,0,128) - brown=Color.new(128,64,0) - white=Color.new(255,255,255) - black=Color.new(0,0,0) + bmtileset=RPG::Cache.tileset(tileset.tileset_name) + bmautotiles=[] + for i in 0...7 + bmautotiles.push(RPG::Cache.autotile(tileset.autotile_names[i])) + end @@ -16,1 +57,1 @@ - for z in [2,1,0] + for z in [0,1,2] @@ -19,12 +60,2 @@ - terrain=tileset.terrain_tags[id] if terrain==0 - terrain=0 if !terrain - passable=false if (tileset.passages[id]&0x0F)==0x0F - end - if terrain==PBTerrain::Water || terrain==PBTerrain::StillWater - bitmap.fill_rect(x*4,y*4,4,4,blue) - elsif terrain==PBTerrain::DeepWater - bitmap.fill_rect(x*4,y*4,4,4,darkblue) - elsif !passable - bitmap.fill_rect(x*4,y*4,4,4,brown) - else - bitmap.fill_rect(x*4,y*4,4,4,white) + bltSmallTile(bmtileset,bmautotiles, + bitmap,x*4,y*4,id) @@ -131,1 +162,6 @@ - return [0,@firstitem+(y/24)] + item=@firstitem+(y/24) + if item<0||item>=@commands.length + return [-1,-1] + else + return [0,item] + end @@ -224,1 +260,1 @@ - self.height=480 + self.height=Graphics.width @@ -235,2 +271,2 @@ - @sprite.x=240-(@sprite.bitmap.width/2) - @sprite.y=160-(@sprite.bitmap.height/2) + @sprite.x=(Graphics.width/2)-(@sprite.bitmap.width/2) + @sprite.y=(Graphics.height/2)-(@sprite.bitmap.height/2) @@ -315,2 +351,2 @@ - @sprite.x=240-(@sprite.bitmap.width/2) - @sprite.y=160-(@sprite.bitmap.height/2) + @sprite.x=(Graphics.width/2)-(@sprite.bitmap.width/2) + @sprite.y=(Graphics.height/2)-(@sprite.bitmap.height/2) @@ -378,1 +414,1 @@ - list.height=320 + list.height=Graphics.height @@ -387,1 +423,1 @@ - commands.push(PBSpecies.getName(i)) + commands.push(_ISPRINTF("{1:03d} {2:s}",i,PBSpecies.getName(i))) @@ -553,3 +589,3 @@ - cmdwindow.height=320 - end - cmdwindow.height=320 if cmdwindow.height>320 + cmdwindow.height=Graphics.height + end + cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height @@ -629,0 +665,730 @@ +def pbListScreen(title,lister) + viewport=Viewport.new(0,0,Graphics.width,Graphics.height) + viewport.z=99999 + list=ListWindow.new(viewport) + list.width=256 + list.height=Graphics.height + list.z=2 + title=Window_SimpleTextPokemon.new(title) + title.x=256 + title.y=0 + title.width=Graphics.width-256 + title.height=64 + title.viewport=viewport + title.z=2 + lister.setViewport(viewport) + selectedmap=-1 + commands=lister.commands + selindex=lister.startIndex + if commands.length==0 + value=lister.value(-1) + lister.dispose + return value + end + list.commands=commands + list.index=selindex + loop do + Graphics.update + Input.updateex + list.update + if list.index!=selectedmap + lister.refresh(list.index) + selectedmap=list.index + end + if Input.trigger?(Input::C) || list.doubleclick? + break + elsif Input.trigger?(Input::B) + selectedmap=-1 + break + end + end + value=lister.value(selectedmap) + lister.dispose + title.dispose + list.dispose + Input.updateex + return value +end + + +def pbListScreenBlock(title,lister) + viewport=Viewport.new(0,0,Graphics.width,Graphics.height) + viewport.z=99999 + list=ListWindow.new(viewport) + list.width=256 + list.height=Graphics.height + list.z=2 + title=Window_SimpleTextPokemon.new(title) + title.x=256 + title.y=0 + title.width=Graphics.width-256 + title.height=64 + title.viewport=viewport + title.z=2 + lister.setViewport(viewport) + selectedmap=-1 + commands=lister.commands + selindex=lister.startIndex + if commands.length==0 + value=lister.value(-1) + lister.dispose + return value + end + list.commands=commands + list.index=selindex + loop do + Graphics.update + Input.updateex + list.update + if list.index!=selectedmap + lister.refresh(list.index) + selectedmap=list.index + end + if Input.trigger?(Input::A) + yield(Input::A, lister.value(selectedmap)) + list.commands=lister.commands + if list.index==list.commands.length + list.index=list.commands.length + end + lister.refresh(list.index) + elsif Input.trigger?(Input::C) || list.doubleclick? + yield(Input::C, lister.value(selectedmap)) + list.commands=lister.commands + if list.index==list.commands.length + list.index=list.commands.length + end + lister.refresh(list.index) + elsif Input.trigger?(Input::B) + break + end + end + lister.dispose + title.dispose + list.dispose + Input.updateex +end + +class MusicFileLister + def initialize(bgm,setting) + @oldbgm=$game_system.getPlayingBGM + @commands=[] + @bgm=bgm + @setting=setting + @index=0 + end + def startIndex + return @index + end + def setViewport(viewport) + end + def commands + folder=(@bgm) ? "Audio/BGM/" : "Audio/ME/" + @commands.clear + Dir.chdir(folder){ + Dir.glob("*.mp3"){|f| @commands.push(f) } + Dir.glob("*.MP3"){|f| @commands.push(f) } + Dir.glob("*.mid"){|f| @commands.push(f) } + Dir.glob("*.MID"){|f| @commands.push(f) } + } + @commands.length.times do |i| + @index=i if @commands[i]==@setting + end + if @commands.length==0 + Kernel.pbMessage(_INTL("There are no files.")) + end + return @commands + end + def value(index) + return (index<0) ? "" : @commands[index] + end + def dispose + $game_system.bgm_play(@oldbgm) + end + def refresh(index) + return if index<0 + if @bgm + $game_system.bgm_play(@commands[index]) + else + $game_system.bgm_play("../../Audio/ME/"+@commands[index]) + end + end +end + +class GraphicsLister + def initialize(folder,selection) + @sprite=SpriteWrapper.new + @sprite.bitmap=nil + @sprite.z=2 + @folder=folder + @selection=selection + @commands=[] + @index=0 + end + def setViewport(viewport) + @sprite.viewport=viewport + end + def startIndex + return @index + end + def commands + @commands.clear + Dir.chdir(@folder){ + Dir.glob("*.png"){|f| @commands.push(f) } + Dir.glob("*.PNG"){|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) } + } + @commands.length.times do |i| + @index=i if @commands[i]==@selection + end + if @commands.length==0 + Kernel.pbMessage(_INTL("There are no files.")) + end + return @commands + end + def value(index) + return (index<0) ? "" : @commands[index] + 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 + @sprite.bitmap=BitmapCache.load_bitmap(@folder+@commands[index]) + 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 + + +class TrainerTypeLister + 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 + @trainers=load_data("Data/trainernames.dat") + if @includeNew + @commands.push(_ISPRINTF("[NEW TRAINER TYPE]")) + @ids.push(-1) + end + @trainers.length.times do |i| + next if !@trainers[i] + @commands.push(_ISPRINTF("{1:3d}: {2:s}",i,@trainers[i][2])) + @ids.push(@trainers[i][0]) + end + @commands.length.times do |i| + @index=i if @ids[i]==@selection + end + return @commands + end + def value(index) + return nil if (index<0) + return [-1] if @ids[index]==-1 + return @trainers[@ids[index]] + 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.character(sprintf("trainer%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 + +class MapLister + def initialize(selmap) + @sprite=SpriteWrapper.new + @sprite.bitmap=nil + @sprite.z=2 + @commands=[] + @maps=pbMapTree + @index=0 + for i in 0...@maps.length + @index=i if @maps[i][0]==@selmap + end + end + def setViewport(viewport) + @sprite.viewport=viewport + end + def startIndex + return @index + end + def commands + @commands.clear + for i in 0...@maps.length + @commands.push(sprintf("%s%03d %s",(" "*@maps[i][2]),@maps[i][0],@maps[i][1])) + end + return @commands + end + def value(index) + return (index<0) ? -1 : @maps[index][0] + 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 + @sprite.bitmap=createMinimap(@maps[index][0]) + @sprite.x=368-(@sprite.bitmap.width/2) + @sprite.y=192-(@sprite.bitmap.height/2) + end +end + +def chooseMapPoint(map,rgnmap=false) + viewport=Viewport.new(0,0,480,320) + viewport.z=99999 + title=Window_SimpleTextPokemon.new(_INTL("Click a point on the map.")) + title.x=0 + title.y=256 + title.width=480 + title.height=64 + title.viewport=viewport + title.z=2 + if rgnmap + sprite=RegionMapSprite.new(map,viewport) + else + sprite=MapSprite.new(map,viewport) + end + sprite.z=2 + ret=nil + loop do + Graphics.update + Input.updateex + xy=sprite.getXY + if xy + ret=xy + break + end + if Input.trigger?(Input::B) + ret=nil + break + end + end + sprite.dispose + title.dispose + return ret +end + +###################################################################### + + +class UIntProperty + def initialize(maxdigits) + @maxdigits=maxdigits + end + def set(settingname,oldsetting) + return Kernel.pbMessageChooseNumberNew( + _INTL("Set the value for {1}.",settingname),oldsetting,@maxdigits) + end + def format(value) + return value.inspect + end +end + +class ReadOnlyProperty + def self.set(settingname,oldsetting) + Kernel.pbMessage(_INTL("This property cannot be edited.")) + return oldsetting + end + def self.format(value) + return value.inspect + end +end + +class EnumProperty + def initialize(values) + @values=values + end + def set(settingname,oldsetting) + commands=[] + for value in @values + commands.push(value) + end + cmd=Kernel.pbMessage(_INTL("Choose a value for {1}.",settingname), + commands,-1) + if cmd<0 + return oldsetting + else + return cmd + end + end + def format(value) + return value ? @values[value] : value.inspect + end +end +module UndefinedProperty + def self.set(settingname,oldsetting) + Kernel.pbMessage(_INTL("This property can't be edited here at this time.")) + return oldsetting + end + def self.format(value) + return value.inspect + end +end +module BooleanProperty + def self.set(settingname,oldsetting) + return Kernel.pbConfirmMessage(_INTL("Enable the setting {1}?",settingname)) ? true : false + end + def self.format(value) + return value.inspect + end +end +module MapProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting : 0)) + return chosenmap>0 ? chosenmap : oldsetting + end + def self.format(value) + return value.inspect + end +end + +module BGMProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname,MusicFileLister.new(true,oldsetting)) + return chosenmap && chosenmap!="" ? chosenmap : oldsetting + end + def self.format(value) + return value + end +end + +module MEProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname,MusicFileLister.new(false,oldsetting)) + return chosenmap && chosenmap!="" ? chosenmap : oldsetting + end + def self.format(value) + return value + end +end + +module WindowskinProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname, + GraphicsLister.new("Graphics/Windowskins/",oldsetting)) + return chosenmap && chosenmap!="" ? chosenmap : oldsetting + end + def self.format(value) + return value + end +end + + +module CharacterProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname, + GraphicsLister.new("Graphics/Characters/",oldsetting)) + return chosenmap && chosenmap!="" ? chosenmap : oldsetting + end + def self.format(value) + return value + end +end + + +module PictureProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname, + GraphicsLister.new("Graphics/Characters/",oldsetting)) + return chosenmap && chosenmap!="" ? chosenmap : oldsetting + end + def self.format(value) + return value + end +end + + +module TrainerTypeProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname, + TrainerTypeLister.new(oldsetting,false)) + return chosenmap ? chosenmap[0] : oldsetting + end + def self.format(value) + return !value ? value.inspect : PBTrainers.getName(value) + end +end + +module StringProperty + def self.set(settingname,oldsetting) + message=Kernel.pbMessageFreeText(_INTL("Set the value for {1}.",settingname), + oldsetting ? oldsetting : "",false,256) + end + def self.format(value) + return value + end +end + +module WeatherEffectProperty + def self.set(settingname,oldsetting) + cmd=Kernel.pbMessage(_INTL("Choose a weather effect."),[ + _INTL("No weather"), + _INTL("Rain"), + _INTL("Storm"), + _INTL("Snow"), + _INTL("Sandstorm") + ],1) + if cmd==0 + return nil + else + number=Kernel.pbMessageChooseNumber(_INTL("Set the effect chance."), + 100,3,nil,100) + return [cmd,number] + end + end + def self.format(value) + return value.inspect + end +end + +module MapCoordsProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting[0] : 0)) + if chosenmap>=0 + mappoint=chooseMapPoint(chosenmap) + if mappoint + return [chosenmap,mappoint[0],mappoint[1]] + else + return oldsetting + end + else + return oldsetting + end + end + def self.format(value) + return value.inspect + end +end + + +module MapCoordsFacingProperty + def self.set(settingname,oldsetting) + chosenmap=pbListScreen(settingname,MapLister.new(oldsetting ? oldsetting[0] : 0)) + if chosenmap>=0 + mappoint=chooseMapPoint(chosenmap) + if mappoint + facing=Kernel.pbMessage(_INTL("Choose a facing."), + [_INTL("Down"),_INTL("Left"),_INTL("Right"),_INTL("Up")],-1) + if facing<0 + return oldsetting + else + return [chosenmap,mappoint[0],mappoint[1],[2,4,6,8][facing]] + end + else + return oldsetting + end + else + return oldsetting + end + end + def self.format(value) + return value.inspect + end +end + +module RegionMapCoordsProperty + def self.set(settingname,oldsetting) + regions=getMapNameList + selregion=-1 + if regions.length==0 + Kernel.pbMessage(_INTL("No region maps are defined.")) + return oldsetting + elsif regions.length==1 + selregion=regions[0][0] + else + cmds=[] + for region in regions + cmds.push(region[1]) + end + selcmd=Kernel.pbMessage(_INTL("Choose a region map."),cmds,-1) + if selcmd>=0 + selregion=regions[selcmd][0] + else + return oldsetting + end + end + mappoint=chooseMapPoint(selregion,true) + if mappoint + return [selregion,mappoint[0],mappoint[1]] + else + return oldsetting + end + end + def self.format(value) + return value.inspect + end +end + +module PlayerProperty + def self.set(settingname,oldsetting) + oldsetting=[0,"xxx","xxx","xxx","xxx","xxx","xxx"] if !oldsetting + properties=[ + [_INTL("Trainer Type"),TrainerTypeProperty, + _INTL("Trainer type of this player.")], + [_INTL("Sprite"),CharacterProperty, + _INTL("Character sprite for this player.")], + [_INTL("Bike"),CharacterProperty, + _INTL("Character sprite when mounted on a bike.")], + [_INTL("Trainer Back"),PictureProperty, + _INTL("Back of the player, for use in battles.")], + [_INTL("Surfing"),CharacterProperty, + _INTL("Surfing character sprite.")], + [_INTL("Running"),CharacterProperty, + _INTL("Running character sprite.")], + [_INTL("Diving"),CharacterProperty, + _INTL("Diving character sprite.")] + ] + pbPropertyList(settingname,oldsetting,properties,false) + return oldsetting + end + def self.format(value) + return value.inspect + end +end + +def pbPropertyList(title,data,properties,saveprompt=false) + viewport=Viewport.new(0,0,Graphics.width,Graphics.height) + viewport.z=99999 + list=ListWindow.new(viewport) + list.width=256 + list.height=320 + list.z=2 + title=Window_SimpleTextPokemon.new(title) + title.x=256 + title.y=0 + title.width=224 + title.height=64 + title.viewport=viewport + title.z=2 + desc=Window_SimpleTextPokemon.new("") + desc.x=256 + desc.y=64 + desc.width=224 + desc.height=256 + desc.viewport=viewport + desc.z=2 + selectedmap=-1 + index=0 + retval=nil + commands=[] + for i in 0...properties.length + propobj=properties[i][1] + commands.push(sprintf("%s=%s",properties[i][0],propobj.format(data[i]))) + end + list.commands=commands + list.index=0 + begin + loop do + Graphics.update + Input.updateex + list.update + desc.update + if list.index!=selectedmap + desc.text=properties[list.index][2] + selectedmap=list.index + end + if Input.trigger?(Input::A) + if Kernel.pbConfirmMessage(_INTL("Reset the setting {1}?",properties[selectedmap][0])) + data[selectedmap]=nil + end + commands.clear + for i in 0...properties.length + propobj=properties[i][1] + commands.push(sprintf("%s=%s",properties[i][0],propobj.format(data[i]))) + end + list.commands=commands + elsif Input.trigger?(Input::C) || list.doubleclick? + propobj=properties[selectedmap][1] + oldsetting=data[selectedmap] + newsetting=propobj.set(properties[selectedmap][0],oldsetting) + data[selectedmap]=newsetting + commands.clear + for i in 0...properties.length + propobj=properties[i][1] + commands.push(sprintf("%s=%s",properties[i][0],propobj.format(data[i]))) + end + list.commands=commands + break + elsif Input.trigger?(Input::B) + selectedmap=-1 + break + end + end + if selectedmap==-1 && saveprompt + cmd=Kernel.pbMessage(_INTL("Save changes?"), + [_INTL("YES"),_INTL("NO"),_INTL("CANCEL")],3) + if cmd==2 + selectedmap=list.index + else + retval=(cmd==0) + end + end + end while selectedmap!=-1 + title.dispose + list.dispose + desc.dispose + Input.updateex + return retval +end + @@ -717,1 +1483,1 @@ - ret[i][0]==mapid + ret[i][3]==mapid @@ -804,4 +1570,0 @@ -def printConnections - print generateConnectionData.inspect -end - @@ -825,0 +1587,10 @@ +def saveMapSpritePos + @mapspritepos.clear + for i in @mapsprites.keys + s=@mapsprites[i] + if s && !s.disposed? + @mapspritepos[i]=[s.x,s.y] + end + end +end + @@ -828,0 +1600,1 @@ + @mapspritepos={} @@ -917,84 +1690,0 @@ -def chooseMapPoint(map,rgnmap=false) - title=Window_SimpleTextPokemon.new(_INTL("Click a point on the map.")) - title.x=0 - title.y=256 - title.width=480 - title.height=64 - title.viewport=@viewport - title.z=2 - if rgnmap - sprite=RegionMapSprite.new(map,@viewport) - else - sprite=MapSprite.new(map,@viewport) - end - sprite.z=2 - ret=nil - loop do - Graphics.update - Input.updateex - xy=sprite.getXY - if xy - ret=xy - break - end - if Input.trigger?(Input::B) - ret=nil - break - end - end - sprite.dispose - title.dispose - return ret -end - -def pbBoolean(settingname,oldsetting) - return Kernel.pbConfirmMessage(_INTL("Enable the setting {1}?",settingname)) ? true : false -end - -def pbMap(settingname,oldsetting) - chosenmap=chooseMapScreen(settingname,oldsetting ? oldsetting : 0) - return chosenmap>0 ? chosenmap : oldsetting -end - -def pbMapWithCoords(settingname,oldsetting) - chosenmap=chooseMapScreen(settingname,oldsetting ? oldsetting[0] : 0) - if chosenmap>=0 - mappoint=chooseMapPoint(chosenmap) - if mappoint - return [chosenmap,mappoint[0],mappoint[1]] - else - return oldsetting - end - else - return oldsetting - end -end - -def pbRegionMapWithCoords(settingname,oldsetting) - regions=getMapNameList - selregion=-1 - if regions.length==0 - Kernel.pbMessage(_INTL("No region maps are defined.")) - return oldsetting - elsif regions.length==1 - selregion=regions[0][0] - else - cmds=[] - for region in regions - cmds.push(region[1]) - end - selcmd=Kernel.pbMessage(_INTL("Choose a region map."),cmds,-1) - if selcmd>=0 - selregion=regions[selcmd][0] - else - return oldsetting - end - end - mappoint=chooseMapPoint(selregion,true) - if mappoint - return [selregion,mappoint[0],mappoint[1]] - else - return oldsetting - end -end - @@ -1008,1 +1697,2 @@ - helptext+=_INTL("Double-click: Edit map's metadata") + helptext+=_INTL("Double-click: Edit map's metadata\r\n") + helptext+=_INTL("Canvas can be dragged to view connected maps better") @@ -1026,31 +1716,50 @@ -def propertyList(map) - localmaps=[ - "Outdoor", - "EscapePoint", - "ShowArea", - "Bicycle", - "BicycleAlways", - "HealingSpot", - "Weather", - "MapPosition", - "DiveMap", - "DarkMap", - "SafariMap" - ] - localmapdescs=[ - _INTL("If true, this map is an outdoor map and will be tinted according to time of day."), - _INTL("Map ID and X and Y coordinates of the point where the player goes when Dig or the Escape Rope is used."), - _INTL("If true, the game will display the map's name upon entry."), - _INTL("If true, the bicycle can be used on this map."), - _INTL("If true, the bicycle will be mounted automatically on this map."), - _INTL("Map ID and X and Y coordinates of this map's entrance. Use only if this map is a Pokemon Center, etc."), - _INTL("Weather conditions in effect for this map."), - _INTL("Identifies the point on the regional map for this map."), - _INTL("Specifies the underwater layer of this map. Use only if this map has deep water."), - _INTL("If true, this map is dark and a circle of light appears around the player."), - _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.") - ] - list=ListWindow.new(@viewport) - list.width=256 - list.height=320 - list.z=2 +LOCALMAPS=[ + ["Outdoor",BooleanProperty, + _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")], + ["EscapePoint",MapCoordsProperty, + _INTL("Map ID and X and Y coordinates of the point where the player goes when Dig or the Escape Rope is used.")], + ["ShowArea",BooleanProperty, + _INTL("If true, the game will display the map's name upon entry.")], + ["Bicycle",BooleanProperty, + _INTL("If true, the bicycle can be used on this map.")], + ["BicycleAlways",BooleanProperty, + _INTL("If true, the bicycle will be mounted automatically on this map.")], + ["HealingSpot",MapCoordsProperty, + _INTL("Map ID and X and Y coordinates of this map's entrance. Use only if this map is a Pokemon Center, etc.")], + ["Weather",WeatherEffectProperty, + _INTL("Weather conditions in effect for this map.")], + ["MapPosition",RegionMapCoordsProperty, + _INTL("Identifies the point on the regional map for this map.")], + ["DiveMap",MapProperty, + _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")], + ["DarkMap",BooleanProperty, + _INTL("If true, this map is dark and a circle of light appears around the player.")], + ["SafariMap",BooleanProperty, + _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")] +] +GLOBALMETADATA=[ + ["Home",MapCoordsFacingProperty, + _INTL("Map ID and X and Y coordinates of where the player goes if no Pokemon Center was entered after a loss.")], + ["PlayerA",PlayerProperty, + _INTL("Specifies player A.")], + ["PlayerB",PlayerProperty, + _INTL("Specifies player B.")], + ["PlayerC",PlayerProperty, + _INTL("Specifies player C.")], + ["PlayerD",PlayerProperty, + _INTL("Specifies player D.")], + ["StorageCreator",StringProperty, + _INTL("Creator of the Pokemon Storage System.")], + ["WildBattleBGM",BGMProperty, + _INTL("Default BGM for wild Pokemon battles.")], + ["TrainerBattleBGM",BGMProperty, + _INTL("Default BGM for trainer battles.")], + ["WildVictoryME",MEProperty, + _INTL("Default ME played after winning a wild Pokemon battle.")], + ["TrainerVictoryME",MEProperty, + _INTL("Default ME played after winning a Trainer battle.")], + ["TextSkin",WindowskinProperty, + _INTL("Default windowskin for speech messages.")] +] + +def propertyList(map,properties) @@ -1058,145 +1767,11 @@ - title=Window_SimpleTextPokemon.new(infos[map].name) - title.x=256 - title.y=0 - title.width=224 - title.height=64 - title.viewport=@viewport - title.z=2 - desc=Window_SimpleTextPokemon.new("") - desc.x=256 - desc.y=64 - desc.width=224 - desc.height=256 - desc.viewport=@viewport - desc.z=2 - maps=pbMapTree - selectedmap=-1 - index=0 - commands=[] - for i in 0...localmaps.length - commands.push(sprintf("%s=%s",localmaps[i], - getMetadata(map,i+1).inspect)) - end - list.commands=commands - list.index=0 - begin - loop do - Graphics.update - Input.updateex - list.update - desc.update - if list.index!=selectedmap - desc.text=localmapdescs[list.index] - selectedmap=list.index - end - if Input.trigger?(Input::A) - if Kernel.pbConfirmMessage(_INTL("Reset the setting {1}?",localmaps[selectedmap])) - setMetadata(map,selectedmap+1,nil) - end - commands=[] - for i in 0...localmaps.length - commands.push(sprintf("%s=%s",localmaps[i], - getMetadata(map,i+1).inspect)) - end - list.commands=commands - elsif Input.trigger?(Input::C) || list.doubleclick? - oldsetting=getMetadata(map,selectedmap+1) - case selectedmap - when 0,2,3,4,9,11 - newsetting=pbBoolean(localmaps[selectedmap],oldsetting) - when 8 - newsetting=pbMap(localmaps[selectedmap],oldsetting) - when 1,5 - newsetting=pbMapWithCoords(localmaps[selectedmap],oldsetting) - when 7 - newsetting=pbRegionMapWithCoords(localmaps[selectedmap],oldsetting) - when 6 - cmd=Kernel.pbMessage(_INTL("Choose a weather effect."),[ - _INTL("No weather"), - _INTL("Rain"), - _INTL("Storm"), - _INTL("Snow"), - _INTL("Sandstorm") - ],1) - if cmd==0 - newsetting=nil - else - number=Kernel.pbMessageChooseNumber(_INTL("Set the effect chance."), - 100,3,nil,100) - newsetting=[cmd,number] - end - end - setMetadata(map,selectedmap+1,newsetting) - commands=[] - for i in 0...localmaps.length - commands.push(sprintf("%s=%s",localmaps[i], - getMetadata(map,i+1).inspect)) - end - list.commands=commands - break - elsif Input.trigger?(Input::B) - selectedmap=-1 - break - end - end - end while selectedmap!=-1 - title.dispose - list.dispose - desc.dispose - Input.updateex - return selectedmap -end - -def chooseMapScreen(title,selmap=0) - list=ListWindow.new(@viewport) - list.width=256 - list.height=320 - list.z=2 - title=Window_SimpleTextPokemon.new(title) - title.x=256 - title.y=0 - title.width=224 - title.height=64 - title.viewport=@viewport - title.z=2 - sprite=Sprite.new(@viewport) - sprite.bitmap=nil - sprite.z=2 - maps=pbMapTree - selectedmap=-1 - commands=[] - index=0 - for i in 0...maps.length - index=i if maps[i][0]==selmap - commands.push(sprintf("%s%03d %s",(" "*maps[i][2]),maps[i][0],maps[i][1])) - end - list.commands=commands - list.index=index - loop do - Graphics.update - Input.updateex - list.update - if list.index!=selectedmap - sprite.bitmap.dispose if sprite.bitmap - if list.index>=0 - sprite.bitmap=createMinimap(maps[list.index][0]) - sprite.x=368-(sprite.bitmap.width/2) - sprite.y=192-(sprite.bitmap.height/2) - end - selectedmap=list.index - end - if Input.trigger?(Input::C) || list.doubleclick? - break - end - if Input.trigger?(Input::B) - selectedmap=-1 - break - end - end - sprite.bitmap.dispose if sprite.bitmap - sprite.dispose - title.dispose - list.dispose - Input.updateex - return selectedmap<0 ? -1 : maps[selectedmap][0] -end + mapname=(map==0) ? _INTL("Global Metadata") : infos[map].name + data=[] + for i in 0...properties.length + data.push(getMetadata(map,i+1)) + end + pbPropertyList(mapname,data,properties) + for i in 0...properties.length + setMetadata(map,i+1,data[i]) + end +end + @@ -1219,1 +1794,0 @@ - echo("doubleclick (#{mapid})\r\n") @@ -1221,1 +1795,3 @@ - propertyList(mapid) + propertyList(mapid,LOCALMAPS) + else + propertyList(0,GLOBALMETADATA) @@ -1230,1 +1806,1 @@ - echo("click (#{mapid})\r\n") + @lastclick=Graphics.frame_count @@ -1232,1 +1808,0 @@ - @lastclick=Graphics.frame_count @@ -1246,0 +1821,3 @@ + @dragOffsetX=x + @dragOffsetY=y + saveMapSpritePos @@ -1275,0 +1853,7 @@ + xpos=x-@dragOffsetX + ypos=y-@dragOffsetY + for i in @mapspritepos.keys + sprite=getMapSprite(i) + sprite.x=(@mapspritepos[i][0]+xpos)&~3 + sprite.y=(@mapspritepos[i][1]+ypos)&~3 + end @@ -1390,0 +1975,118 @@ + +def pbTrainerTypeEditorSave(trainertype,ttdata) + record=[] + record[0]=trainertype + record[1]="" + for i in 1..ttdata.length + record.push(ttdata[i]) + end + setConstantName(PBTrainers,trainertype,ttdata[0]) + data=load_data("Data/trainernames.dat") + data[record[0]]=record + data=save_data(data,"Data/trainernames.dat") + pbConvertTrainerData +end + +def pbTrainerTypeEditorNew(trconst) + data=load_data("Data/trainernames.dat") + maxid=-1 + for rec in data + next if !rec + maxid=[maxid,rec[0]].max + end + trainertype=maxid+1 + trname=Kernel.pbMessageFreeText(_INTL("Please enter the trainer type's name."),trconst ? trconst : "",false,256) + if trname=="" && !trconst + return -1 + else + if !trconst + trconst=trname.gsub(/[^A-Za-z0-9_]/,"") + trconst=trconst.upcase + if trconst.length==0 + trconst=sprintf("T_%03d",trainertype) + elsif !trconst[0,1][/[A-Z]/] + trconst="T_"+trconst + end + if hasConst?(PBTrainers,trconst) + trconst=sprintf("%s_%03d",trconst,trainertype) + end + if hasConst?(PBTrainers,trconst) + Kernel.pbMessage(_INTL("Failed to create the trainer type. Choose a different name.")) + return -1 + end + else + trname=trconst if trname=="" + end + record=[] + record[0]=trainertype + record[2]=trname + record[7]=Kernel.pbMessage(_INTL("Is the Trainer male, female, or mixed gender?"),[ + _INTL("MALE"),_INTL("FEMALE"),_INTL("MIXED") + ],0) + record[3]=Kernel.pbMessageChooseNumber( + _INTL("Set the money per level won for defeating the Trainer."),40,2 + ) + PBTrainers.const_set(trconst,record[0]) + data[record[0]]=record + save_data(data,"Data/trainernames.dat") + pbConvertTrainerData + Kernel.pbMessage(_INTL("The Trainer type was created.")) + Kernel.pbMessage( + _ISPRINTF("Put the Trainer's graphic (trainer{1:03d}.png) in Graphics/Characters, or it will be blank.", + record[0])) + return record[0] + end +end +def pbTrainerTypeEditor + selection=0 + trainerTypes=[ + [_INTL("Internal Name"),StringProperty, + _INTL("Internal name that appears in constructs like PBTrainers::XXX.")], + [_INTL("Trainer Name"),StringProperty, + _INTL("Name of the trainer type as displayed by the game.")], + [_INTL("Money per level"),UIntProperty.new(3), + _INTL("Player earns this amount times the highest level among the trainer type's Pokemon.")], + [_INTL("Battle BGM"),BGMProperty, + _INTL("BGM played in battles against trainers of this type.")], + [_INTL("Battle End ME"),MEProperty, + _INTL("ME played when player wins battles against trainers of this type.")], + [_INTL("Battle Intro ME"),MEProperty, + _INTL("ME played before battles against trainers of this type.")], + [_INTL("Gender"),EnumProperty.new([_INTL("Male"),_INTL("Female"),_INTL("Mixed gender")]), + _INTL("Gender of this Trainer type.")] + ] + pbListScreenBlock(_INTL("Trainer Types"),TrainerTypeLister.new(selection,true)){|button,trtype| + if trtype + if button==Input::A + if trtype[0]>=0 + command=Kernel.pbMessage("Delete this trainer type?",[_INTL("NO"),_INTL("YES")],1) + if command==1 + data=load_data("Data/trainernames.dat") + removeConstantValue(PBTrainers,trtype[0]) + data[trtype[0]]=nil + save_data(data,"Data/trainernames.dat") + pbConvertTrainerData + Kernel.pbMessage(_INTL("The Trainer type was deleted.")) + end + end + elsif button==Input::C + selection=trtype[0] + if selection<0 + newid=pbTrainerTypeEditorNew(nil) + if newid>=0 + selection=newid + end + else + data=[getConstantName(PBTrainers,trtype[0])] + for i in 2..trtype.length + data.push(trtype[i]) + end + save=pbPropertyList(trtype[2],data,trainerTypes,true) + if save + pbTrainerTypeEditorSave(selection,data) + end + end + end + end + } +end @@ -1391,1 +2094,0 @@ -#pbAnimationEditor Changed: PBAbilities @@ -83,0 +83,2 @@ +def self.getCount +return 77 @@ -84,0 +86,1 @@ +end Changed: PokemonMessages @@ -22,0 +22,44 @@ +end + + +def pbCsvField!(str) + ret="" + str.sub!(/^\s*/,"") + if str[0,1]=="\"" + str[0,1]="" + escaped=false + fieldbytes=0 + str.scan(/./) do |s| + fieldbytes+=s.length + break if s=="\"" && !escaped + if s=="\\" && !escaped + escaped=true + else + ret+=s + escaped=false + end + end + str[0,fieldbytes]="" + if !str[/^\s*,/] && !str[/^\s*$/] + raise _INTL("Invalid quoted field (in: {1})",ret) + end + str[0,str.length]=$~.post_match + else + if str[/,/] + str[0,str.length]=$~.post_match + ret=$~.pre_match + else + ret=str.clone + str[0,str.length]="" + end + ret.gsub!(/\s+$/,"") + end + return ret +end + +def pbCsvPosInt!(str) + ret=pbCsvField!(str) + if !ret[/^\d+$/] + raise _INTL("Field {1} is not a positive integer",ret) + end + return ret.to_i @@ -54,2 +98,0 @@ - -EXCLAMATION_ANIMATION_ID=17 @@ -343,1 +385,1 @@ - cmdwindow.resizeToFit(cmdwindow.text,480) + cmdwindow.resizeToFit(cmdwindow.text,Graphics.width) @@ -397,1 +439,1 @@ - height=[cmdwindow.height,320-msgwindow.height].min + height=[cmdwindow.height,Graphics.height-msgwindow.height].min @@ -402,1 +444,1 @@ - cmdwindow.height=320 if cmdwindow.height>320 + cmdwindow.height=Graphics.height if cmdwindow.height>Graphics.height @@ -450,1 +492,2 @@ - window.loadSkinFile("#{skin}.txt") + skinbase=skin.sub(/\.....?$/,"") + window.loadSkinFile("#{skinbase}.txt") @@ -657,2 +700,2 @@ - cmdvariable=csvPosInt!(cmds) - cmdIfCancel=csvfield!(cmds).to_i + cmdvariable=pbCsvPosInt!(cmds) + cmdIfCancel=pbCsvField!(cmds).to_i @@ -661,1 +704,1 @@ - commands.push(csvfield!(cmds)) + commands.push(pbCsvField!(cmds)) @@ -681,1 +724,1 @@ - goldwindow.resizeToFit(goldwindow.text,480) + goldwindow.resizeToFit(goldwindow.text,Graphics.width) @@ -868,1 +911,1 @@ -class PBMoveRoute +module PBMoveRoute Changed: SpriteWindow @@ -250,2 +250,2 @@ - window.x=480-window.width - window.y=320-window.height + window.x=Graphics.width-window.width + window.y=Graphics.height-window.height @@ -256,4 +256,4 @@ - window.y=320-window.height -end - -def pbBottomLeftLines(window,lines,width=480) + window.y=Graphics.height-window.height +end + +def pbBottomLeftLines(window,lines,width=nil) @@ -261,1 +261,1 @@ - window.width=width + window.width=width ? width : Graphics.width @@ -263,1 +263,1 @@ - window.y=320-window.height + window.y=Graphics.height-window.height @@ -541,2 +541,3 @@ - if bm && (bm.width<480 || bm.height<320) - newbitmap=Bitmap.new(480,320) + if bm && (bm.width448 + windowheight=Graphics.height-32 if windowheight>Graphics.height-32 @@ -2339,1 +2337,1 @@ - def initialize(text,x=0,y=0,cx=448,cy=96) + def initialize(text) @@ -2349,1 +2347,1 @@ - super(x,y,cx,cy) + super(0,0,33,33) @@ -2354,1 +2352,3 @@ - self.contents=Bitmap.new(self.width-self.borderX,self.height-self.borderY) + self.contents=Bitmap.new( + [self.width-self.borderX,1].max, + [self.height-self.borderY,1].max) @@ -2356,0 +2356,1 @@ + self.resizeToFit(text,Graphics.width) @@ -2561,1 +2562,0 @@ - @@ -2563,0 +2563,16 @@ + def text=(value) + @curchar=0 + @drawncurchar=-1 + @text=value + @normtext=getLineBrokenTextEx(value,self.width,nil) + @textchars=@normtext.gsub(/\\\[[^\]]*\]/,"").scan(/./m) + @scrollstate=0 + @scrollY=0 + @linesdrawn=0 + @realframes=0 + prerenderText + stopPause + @displaying=self.letterbyletter + self.contents.clear + refresh + end Changed: PokemonSystem @@ -25,2 +25,0 @@ - - @@ -46,0 +44,21 @@ +def pbLoadFromCodes +str=[] +File.open("codes.txt","rb"){|f| + while !f.eof? + ln=f.gets + if ln[/^[A-F0-9]+\:([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])([A-F0-9][A-F0-9])\s*$/] + str.push($4.hex,$3.hex,$2.hex,$1.hex) + end + end +} +bytes=str.pack("C*") +$Trainer.party[0]=pbLoadFromFile(bytes) +end + +def pbDebugF7 + if $DEBUG + if $Trainer + end + end +end + @@ -56,0 +75,3 @@ + if trigger?(Input::F7) + pbDebugF7 + end Changed: PokemonSummary @@ -274,1 +274,1 @@ - [_ISPRINTF("{1: 3d}/{2: 3d}",pokemon.hp,pokemon.totalhp),346,114,1,Color.new(0,0,0),Color.new(208,208,200)], + [_ISPRINTF("{1:3d}/{2:3d}",pokemon.hp,pokemon.totalhp),346,114,1,Color.new(0,0,0),Color.new(208,208,200)], @@ -455,2 +455,4 @@ - for i in 0...8 - return true if $PokemonMachines[50+i]==move + for i in 0...$ItemData.length + next if !pbIsHiddenMachine?(i) + atk=$ItemData[i][ITEMMACHINE] + return true if move==atk Changed: PokemonUtilities @@ -127,1 +127,1 @@ -def pbNicknameAndStore(pokemon) +def pbStorePokemon(pokemon) @@ -131,8 +131,1 @@ - end - speciesname=PBSpecies.getName(pokemon.species) - $Trainer.seen[pokemon.species]=true - $Trainer.owned[pokemon.species]=true - if Kernel.pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?",speciesname)) - helptext=_INTL("{1}'s nickname?",speciesname) - newname=pbEnterText(helptext,0,10) - pokemon.name=newname if newname!="" + return @@ -169,0 +162,17 @@ +def pbNicknameAndStore(pokemon) + if pbBoxesFull? + Kernel.pbMessage(_INTL("There's no more room for Pokemon!\1")) + Kernel.pbMessage(_INTL("The Pokemon Boxes are full and can't accept any more!")) + return + end + speciesname=PBSpecies.getName(pokemon.species) + $Trainer.seen[pokemon.species]=true + $Trainer.owned[pokemon.species]=true + if Kernel.pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?",speciesname)) + helptext=_INTL("{1}'s nickname?",speciesname) + newname=pbEnterText(helptext,0,10) + pokemon.name=newname if newname!="" + end + pbStorePokemon(pokemon) +end + @@ -260,1 +270,2 @@ - $game_system.me_play(pbStringToAudioFile(bgm)) + bgm=pbStringToAudioFile(bgm) + $game_system.bgm_play_ex("../../Audio/ME/#{bgm.name}",bgm.volume,bgm.pitch,false) @@ -262,1 +273,1 @@ - end + end @@ -382,1 +393,3 @@ -def getRandomName(*formats) + +#Modified by Wichu, adapted by Peter O. +def getRandomNameEx(type,variable,upper,*formats) @@ -384,1 +397,8 @@ - formats=%w( Cvcvvc Cvvcvc Cvcvcv Vcvvc Cvcv Cvvc Cvcv Cvve bvc bve Cve bvvc bvcv bvcvc) + case type + when 0 + formats=%w( 1423 2341 23441 14235 1415 14141 142314 41423 4141 42341 ) + when 1 + formats=%w( 1416 14416 141416 23416 41416 423416 414236 14236 1414236 14146 ) + when 2 + formats=%w( cvcvvc cvvcvc cvcvcv vcvvc cvcv cvvc cvcv cvve bvc bve cve bvvc bvcv bvcvc) + end @@ -390,6 +410,0 @@ - when "C" - set=%w( B C D F G H J K L L M N N P R R S S T T V W X Z ) - name+=set[rand(set.length)] - when "V" - set=%w( A A A E E E I I I O O O U U U Y ) - name+=set[rand(set.length)] @@ -402,4 +416,0 @@ - when "B" # two-letter "blends" - set=%w( BR BL CH CL CR DR FR FL GH GL GR PH PL PR SC SH SK SL - SM SN SP ST SW TH TR TW WH WR ) - name+=set[rand(set.length)] @@ -407,6 +417,2 @@ - set=%w( Br Bl Ch Cl Cr Dr Fr Fl Gh Gl Gr Ph Pl Pr Sc Sh Sk Sl - Sm Sn Sp St Sw Th Tr Tw Wh Wr ) - name+=set[rand(set.length)] - when "E" # two-letter "blends" at end - set=%w( CK CH DD FF BB GG GH LD LL MM ND NT NG PH PT PS SK SH SP - SS TT RD RN RP RM RK NS BS FT ) + set=%w( br bl ch cl cr dr fr fl gh gl gr ph pl pr sc sh sk sl + sm sn sp st sw th tr tw wh wr ) @@ -418,0 +424,18 @@ + when "1" + set=%w( b c d f g h j k l m n p q r s t v w x z ) + name+=set[rand(set.length)] + when "2" + set=%w( c f g k l p r s t ) + name+=set[rand(set.length)] + when "3" + set=%w( h k l s t ) + name+=set[rand(set.length)] + when "4" + set=%w( a e i o u ) + name+=set[rand(set.length)] + when "5" + set=%w( e e o o o u u ) + name+=set[rand(set.length)] + when "6" + set=%w( a a a i i i e ) + name+=set[rand(set.length)] @@ -420,0 +444,7 @@ +case upper + when 0 + name=name.upcase + when 1 + name[0,1]=name[0,1].upcase +end +$game_variables[variable]=name if variable @@ -421,0 +452,18 @@ +end + +def getRandomName(*formats) + return getRandomNameEx(2,nil,nil,formats) +end + +def pbGetTrainerTypeGender(trainertype) + ret=2 + pbRgssOpen("Data/trainernames.dat","rb"){|f| + trainernames=Marshal.load(f) + if !trainernames[trainertype] + ret=2 + else + ret=trainernames[trainertype][7] + ret=2 if !ret + end + } + return ret @@ -425,0 +474,2 @@ + trainertype=pbGetPlayerTrainerType + gender=pbGetTrainerTypeGender(trainertype) @@ -426,3 +477,3 @@ - trname=getRandomName - end - $Trainer=PokeBattle_Trainer.new(trname,pbGetPlayerTrainerType) + trname=getRandomNameEx(gender,nil,1) + end + $Trainer=PokeBattle_Trainer.new(trname,trainertype) @@ -630,0 +681,49 @@ +def pbMoveTutorAnnotations(move,movelist) + ret=[] + for i in 0...6 + ret[i]=nil + next if i>=$Trainer.party.length + found=false + for j in 0...4 + if !$Trainer.party[i].egg? && $Trainer.party[i].moves[j].id==move + ret[i]=_INTL("LEARNED") + found=true + end + end + next if found + species=$Trainer.party[i].species + if !$Trainer.party[i].egg? && movelist.any?{|j| j==species } + ret[i]=_INTL("ABLE") + else + ret[i]=_INTL("NOT ABLE") + end + end + return ret +end + +def pbMoveTutorChoose(move,movelist) + ret=false + pbFadeOutIn(99999){ + scene=PokemonScreen_Scene.new + movename=PBMoves.getName(move) + screen=PokemonScreen.new(scene,$Trainer.party) + annot=pbMoveTutorAnnotations(move,movelist) + screen.pbStartScene(_INTL("Teach which Pokemon?"),false,annot) + chosen=screen.pbChoosePokemon + if chosen>=0 + pokemon=$Trainer.party[chosen] + if pokemon.egg? + Kernel.pbMessage(_INTL("{1} can't be taught to an Egg.",movename)) + elsif !movelist.any?{|j| j==pokemon.species } + Kernel.pbMessage(_INTL("{1} is not compatible with {2}.",pokemon.name,movename)) + Kernel.pbMessage(_INTL("{1} can't be learned.",movename)) + else + if pbLearnMove(pokemon,move) + ret=true + end + end + end + screen.pbEndScene + } + return ret +end Changed: PokemonRegionMap @@ -11,1 +11,1 @@ - self.y=288 + self.y=Graphics.height-32 @@ -44,2 +44,2 @@ - [@mapdetails,240,0,2,Color.new(248,248,248),Color.new(0,0,0)], - [@maplocation,480,0,1,Color.new(248,248,248),Color.new(0,0,0)] + [@mapdetails,Graphics.width/2,0,2,Color.new(248,248,248),Color.new(0,0,0)], + [@maplocation,Graphics.width,0,1,Color.new(248,248,248),Color.new(0,0,0)] @@ -54,1 +54,1 @@ - @viewport=Viewport.new(0,0,480,320) + @viewport=Viewport.new(0,0,Graphics.width,Graphics.height) @@ -72,0 +72,4 @@ + if !@map + Kernel.pbMessage(_INTL("The map data cannot be found.")) + return false + end @@ -82,0 +86,1 @@ + return true Changed: PokemonBag @@ -1,63 +1,0 @@ - -$PokemonFirstMachine=0x121 - -$PokemonMachines=[ -264,# TM01 108, FOCUS PUNCH */ -337,# TM02 151, DRAGON CLAW */ -352,# TM03 160, WATER PULSE */ -347,# TM04 15B, CALM MIND */ -46,# TM05 2E, ROAR */ -92,# TM06 5C, TOXIC */ -258,# TM07 102, HAIL */ -339,# TM08 153, BULK UP */ -331,# TM09 14B, BULLET SEED */ -237,# TM10 ED, HIDDEN POWER */ -241,# TM11 F1, SUNNY DAY */ -269,# TM12 10D, TAUNT */ -58,# TM13 3A, ICE BEAM */ -59,# TM14 3B, BLIZZARD */ -63,# TM15 3F, HYPER BEAM */ -113,# TM16 71, LIGHT SCREEN */ -182,# TM17 B6, PROTECT */ -240,# TM18 F0, RAIN DANCE */ -202,# TM19 CA, GIGA DRAIN */ -219,# TM20 DB, SAFEGUARD */ -218,# TM21 DA, FRUSTRATION */ -76,# TM22 4C, SOLARBEAM */ -231,# TM23 E7, IRON TAIL */ -85,# TM24 55, THUNDERBOLT */ -87,# TM25 57, THUNDER */ -89,# TM26 59, EARTHQUAKE */ -216,# TM27 D8, RETURN */ -91,# TM28 5B, DIG */ -94,# TM29 5E, PSYCHIC */ -247,# TM30 F7, SHADOW BALL */ -280,# TM31 118, BRICK BREAK */ -104,# TM32 68, DOUBLE TEAM */ -115,# TM33 73, REFLECT */ -351,# TM34 15F, SHOCK WAVE */ -53,# TM35 35, FLAMETHROWER */ -188,# TM36 BC, SLUDGE BOMB */ -201,# TM37 C9, SANDSTORM */ -126,# TM38 7E, FIRE BLAST */ -317,# TM39 13D, ROCK TOMB */ -332,# TM40 14C, AERIAL ACE */ -259,# TM41 103, TORMENT */ -263,# TM42 107, FACADE */ -290,# TM43 122, SECRET POWER */ -156,# TM44 9C, REST */ -213,# TM45 D5, ATTRACT */ -168,# TM46 A8, THIEF */ -211,# TM47 D3, STEEL WING */ -285,# TM48 11D, SKILL SWAP */ -289,# TM49 121, SNATCH */ -315,# TM50 13B, OVERHEAT */ -15,# HM01 0F, CUT */ -19,# HM02 13, FLY */ -57,# HM03 39, SURF */ -70,# HM04 46, STRENGTH */ -148,# HM05 94, FLASH */ -249,# HM06 F9, ROCK SMASH */ -127,# HM07 7F, WATERFALL */ -291# HM08 123, DIVE */ -] @@ -73,0 +10,1 @@ +ITEMMACHINE=8 @@ -172,1 +110,1 @@ - machine=$PokemonMachines[item-$PokemonFirstMachine] + machine=$ItemData[item][ITEMMACHINE] @@ -277,1 +215,1 @@ - machine=$PokemonMachines[item-$PokemonFirstMachine] + machine=$ItemData[item][ITEMMACHINE] @@ -611,1 +549,5 @@ -class WithdrawItemScene +class ItemStorageScene + +def initialize(title) + @title=title +end @@ -656,1 +598,1 @@ - drawTextEx(bm,0,0,bm.width,2,_INTL("WITHDRAW\nITEM"), + drawTextEx(bm,0,0,bm.width,2,@title, @@ -723,17 +665,12 @@ -class TossItemScene < WithdrawItemScene -def pbRefresh - bm=@sprites["pocketwindow"].bitmap - drawTextEx(bm,0,0,bm.width,2,_INTL("TOSS\nITEM"), - Color.new(31*8,31*8,31*8), - Color.new(12*8,12*8,12*8) - ) - itemwindow=@sprites["itemwindow"] - filename=sprintf("Graphics/Icons/item%03d.png",itemwindow.item) - @sprites["icon"].setBitmap(filename) - @sprites["itemtextwindow"].text=(itemwindow.item==0) ? _INTL("Close storage.") : - pbGetMessage(MessageTypes::ItemDescriptions,itemwindow.item) - itemwindow.refresh -end - - -end +class WithdrawItemScene < ItemStorageScene + def initialize + super(_INTL("WITHDRAW\nITEM")) + end +end + +class TossItemScene < ItemStorageScene + def initialize + super(_INTL("TOSS\nITEM")) + end +end + @@ -883,3 +820,0 @@ -def pbIsMail?(item) - return ($ItemData[item][ITEMTYPE]==1 || $ItemData[item][ITEMTYPE]==2) -end Changed: PokemonItems @@ -4,9 +4,5 @@ - return (item==PBItems::HM01|| - item==PBItems::HM02|| - item==PBItems::HM02|| - item==PBItems::HM03|| - item==PBItems::HM04|| - item==PBItems::HM05|| - item==PBItems::HM06|| - item==PBItems::HM07|| - item==PBItems::HM08) + return $ItemData[item] && ($ItemData[item][ITEMUSE]==4) +end + +def pbIsMail?(item) + return $ItemData[item] && ($ItemData[item][ITEMTYPE]==1 || $ItemData[item][ITEMTYPE]==2) @@ -410,1 +406,1 @@ -def pbSpeciesCompatible?(species,machine) +def pbSpeciesCompatibleOld?(species,machine) @@ -421,0 +417,9 @@ + +def pbSpeciesCompatible?(species,move) + ret=false + return false if species<=0 + data=load_data("Data/tm.dat") + return false if !data[move] + return data[move].any? {|item| item==species } +end + @@ -431,1 +436,1 @@ -def pbMachineAnnotations(machineindex) +def pbMachineAnnotations(move) @@ -433,1 +438,0 @@ - move=$PokemonMachines[machineindex] @@ -439,1 +443,1 @@ - if $Trainer.party[i].moves[j].id==move + if !$Trainer.party[i].egg? && $Trainer.party[i].moves[j].id==move @@ -446,1 +450,1 @@ - pbSpeciesCompatible?($Trainer.party[i].species,machineindex) + pbSpeciesCompatible?($Trainer.party[i].species,move) @@ -496,2 +500,1 @@ - machineindex=item-$PokemonFirstMachine - machine=$PokemonMachines[machineindex] + machine=$ItemData[item][ITEMMACHINE] @@ -505,1 +508,1 @@ - if machineindex>=50 + if pbIsHiddenMachine?(item) @@ -518,1 +521,1 @@ - annot=pbMachineAnnotations(machineindex) + annot=pbMachineAnnotations(machine) @@ -525,1 +528,1 @@ - elsif !pbSpeciesCompatible?(pokemon.species,machineindex) + elsif !pbSpeciesCompatible?(pokemon.species,machine) @@ -531,1 +534,1 @@ - bag.pbDeleteItem(item) if machineindex<50 + bag.pbDeleteItem(item) if !pbIsHiddenMachine?(item) Changed: PokemonScreen @@ -539,1 +539,1 @@ - helpwindow.resizeHeightToFit(helptext,480-cmdwindow.width) + helpwindow.resizeHeightToFit(helptext,Graphics.width-cmdwindow.width) @@ -674,0 +674,24 @@ + +def pbHardRefresh + oldtext=[] + lastselected=-1 + for i in 0...6 + oldtext.push(@sprites["pokemon#{i}"].text) + lastselected=i if @sprites["pokemon#{i}"].selected + @sprites["pokemon#{i}"].dispose + end + lastselected=@party.length-1 if lastselected>=@party.length + lastselected=0 if lastselected<0 + for i in 0...6 + if @party[i] + @sprites["pokemon#{i}"]=PokeSelectionSprite.new( + @party[i],i,@doublebattle,@viewport) + else + @sprites["pokemon#{i}"]=PokeSelectionPlaceholderSprite.new( + @party[i],i,@doublebattle,@viewport) + end + @sprites["pokemon#{i}"].text=oldtext[i] + end + pbSelect(lastselected) +end + @@ -677,0 +701,1 @@ + @@ -1164,2 +1189,1 @@ - cmdValues=-1 - cmdCodes=-1 + cmdDebug=-1 @@ -1169,2 +1193,1 @@ - commands[cmdValues=commands.length]=_INTL("SHOW VALUES") - commands[cmdCodes=commands.length]=_INTL("CHEAT CODES") + commands[cmdDebug=commands.length]=_INTL("DEBUG") @@ -1256,8 +1279,105 @@ - elsif cmdValues>=0 && command==cmdValues - pbDisplay(_INTL("Individual Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.iv[0],pkmn.iv[1],pkmn.iv[2],pkmn.iv[3],pkmn.iv[4],pkmn.iv[5])) - pbDisplay(_INTL("Effort Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.ev[0],pkmn.ev[1],pkmn.ev[2],pkmn.ev[3],pkmn.ev[4],pkmn.ev[5])) - persid=sprintf("0x%08X",pkmn.personalID) - pbDisplay(_INTL("Personal ID: {1}\r\nHappiness: {2}",persid,pkmn.happiness)) - elsif cmdCodes>=0 && command==cmdCodes - pkmn.genCodes("codes.txt") - pbDisplay(_INTL("Codes for this Pokemon were saved in codes.txt.")) + elsif cmdDebug>=0 && command==cmdDebug + command=@scene.pbShowCommands(_INTL("Do what with {1}?",pkmn.name),[ + _INTL("SHOW VALUES"), + _INTL("CHEAT CODES"), + _INTL("SET LEVEL"), + _INTL("SET SPECIES"), + _INTL("SET NATURE"), + _INTL("SET GENDER"), + _INTL("DUPLICATE"), + _INTL("DELETE"), + _INTL("CANCEL") + ]) + case command + when 0 + pbDisplay(_INTL("Individual Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.iv[0],pkmn.iv[1],pkmn.iv[2],pkmn.iv[3],pkmn.iv[4],pkmn.iv[5])) + pbDisplay(_INTL("Effort Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.ev[0],pkmn.ev[1],pkmn.ev[2],pkmn.ev[3],pkmn.ev[4],pkmn.ev[5])) + persid=sprintf("0x%08X",pkmn.personalID) + pbDisplay(_INTL("Personal ID: {1}\r\nHappiness: {2}",persid,pkmn.happiness)) + when 1 + pkmn.genCodes("codes.txt") + pbDisplay(_INTL("Codes for this Pokemon were saved in codes.txt.")) + when 2 + level=Kernel.pbMessageChooseNumber( + _INTL("Set the Pokemon's level."),pkmn.level,3,nil,100) + if level!=pkmn.level + pkmn.level=level + pkmn.calcStats + pbDisplay(_INTL("{1}'s level was set to {2}.",pkmn.name,pkmn.level)) + end + when 3 + species=pbChooseSpecies(pkmn.species) + if species!=0 + oldspeciesname=PBSpecies.getName(pkmn.species) + pkmn.species=species + pkmn.calcStats + oldname=pkmn.name + pkmn.name=PBSpecies.getName(pkmn.species) if pkmn.name==oldspeciesname + pbDisplay(_INTL("{1}'s species was changed to {2}.",oldname,PBSpecies.getName(pkmn.species))) + end + when 4 + commands=[] + 25.times do |i| + commands.push(PBNatures.getName(i)) + end + command=@scene.pbShowCommands(_INTL("Choose a nature."),commands) + if command>=0 + oldgender=pkmn.gender + 2000.times do + pkmn.personalID&=0xFFFF0000 + pkmn.personalID|=rand(65536) + pkmn.personalID-=pkmn.personalID%25 + pkmn.personalID+=command + break if pkmn.gender==oldgender + end + pkmn.calcStats + if pkmn.nature!=command + pbDisplay(_INTL("The Pokemon's nature couldn't be changed.")) + else + pbDisplay(_INTL("The Pokemon's nature was changed.")) + end + end + when 5 + if pkmn.gender==2 + pbDisplay(_INTL("This Pokemon's gender can't be set.")) + elsif pkmn.gender==0 + if pbConfirm(_INTL("Make this Pokemon female?")) + oldnature=pkmn.nature + 2000.times do + pkmn.setGender(true) + break if pkmn.nature==oldnature + end + if pkmn.gender==0 + pbDisplay(_INTL("The Pokemon's gender couldn't be changed.")) + else + pbDisplay(_INTL("The Pokemon's gender was changed.")) + end + end + elsif pkmn.gender==1 + if pbConfirm(_INTL("Make this Pokemon male?")) + oldnature=pkmn.nature + 2000.times do + pkmn.setGender(false) + break if pkmn.nature==oldnature + end + if pkmn.gender==1 + pbDisplay(_INTL("The Pokemon's gender couldn't be changed.")) + else + pbDisplay(_INTL("The Pokemon's gender was changed.")) + end + end + end + when 6 + clonedpkmn=pkmn.clone + clonedpkmn.iv=pkmn.iv.clone + clonedpkmn.ev=pkmn.ev.clone + pbStorePokemon(clonedpkmn) + @scene.pbHardRefresh + when 7 + if pbConfirm(_INTL("Are you sure you want to delete this Pokemon?")) + @party[pkmnid]=nil + @party.compact! + pbDisplay(_INTL("The Pokemon was deleted.")) + @scene.pbHardRefresh + end + end Changed: PokemonStorage @@ -202,0 +202,1 @@ + pkmnname=pokemon.name @@ -203,2 +204,0 @@ - pbDisplay(_INTL("{1} was released.",pokemon.name)) - pbDisplay(_INTL("Bye-bye, {1}!",pokemon.name)) @@ -211,0 +210,2 @@ + pbDisplay(_INTL("{1} was released.",pkmnname)) + pbDisplay(_INTL("Bye-bye, {1}!",pkmnname)) @@ -558,2 +559,1 @@ - commands.push(_INTL("SHOW VALUES")) - commands.push(_INTL("CHEAT CODES")) + commands.push(_INTL("DEBUG")) @@ -602,8 +602,73 @@ - if $DEBUG - pkmn=@heldpkmn ? @heldpkmn : pokemon - if pkmn - pbDisplay(_INTL("Individual Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.iv[0],pkmn.iv[1],pkmn.iv[2],pkmn.iv[3],pkmn.iv[4],pkmn.iv[5])) - pbDisplay(_INTL("Effort Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.ev[0],pkmn.ev[1],pkmn.ev[2],pkmn.ev[3],pkmn.ev[4],pkmn.ev[5])) - persid=sprintf("0x%08X",pkmn.personalID) - pbDisplay(_INTL("Personal ID: {1}\r\nHappiness: {2}",persid,pkmn.happiness)) - end + pkmn=@heldpkmn ? @heldpkmn : pokemon + command=@scene.pbShowCommands(_INTL("{1} is selected.",pkmn.name),[ + _INTL("SHOW VALUES"), + _INTL("CHEAT CODES"), + _INTL("SET LEVEL"), + _INTL("SET SPECIES"), + _INTL("SET NATURE"), + _INTL("SET GENDER"), + _INTL("DUPLICATE"), + _INTL("DELETE"), + _INTL("CANCEL") + ]) + case command + when 0 + pbDisplay(_INTL("Individual Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.iv[0],pkmn.iv[1],pkmn.iv[2],pkmn.iv[3],pkmn.iv[4],pkmn.iv[5])) + pbDisplay(_INTL("Effort Values (Sp.Def last):\r\n{1}, {2}, {3}, {4}, {5}, {6}",pkmn.ev[0],pkmn.ev[1],pkmn.ev[2],pkmn.ev[3],pkmn.ev[4],pkmn.ev[5])) + persid=sprintf("0x%08X",pkmn.personalID) + pbDisplay(_INTL("Personal ID: {1}\r\nHappiness: {2}",persid,pkmn.happiness)) + when 1 + pkmn.genCodes("codes.txt") + pbDisplay(_INTL("Codes for this Pokemon were saved in codes.txt.")) + when 2 + level=Kernel.pbMessageChooseNumber( + _INTL("Set the Pokemon's level."),pkmn.level,3,nil,100) + if level!=pkmn.level + pkmn.level=level + pkmn.calcStats + pbDisplay(_INTL("{1}'s level was set to {2}.",pkmn.name,pkmn.level)) + end + @scene.pbHardRefresh + when 3 + species=pbChooseSpecies(pkmn.species) + if species!=0 + oldspeciesname=PBSpecies.getName(pkmn.species) + pkmn.species=species + pkmn.calcStats + oldname=pkmn.name + pkmn.name=PBSpecies.getName(pkmn.species) if pkmn.name==oldspeciesname + pbDisplay(_INTL("{1}'s species was changed to {2}.",oldname,PBSpecies.getName(pkmn.species))) + end + @scene.pbHardRefresh + when 4 + commands=[] + 25.times do |i| + commands.push(PBNatures.getName(i)) + end + command=pbShowCommands(_INTL("Choose a nature."),commands) + if command>=0 + oldgender=pkmn.gender + 2000.times do + pkmn.personalID&=0xFFFF0000 + pkmn.personalID|=rand(65536) + pkmn.personalID-=pkmn.personalID%25 + pkmn.personalID+=command + break if pkmn.gender==oldgender + end + pkmn.calcStats + if pkmn.nature!=command + pbDisplay(_INTL("The Pokemon's nature couldn't be changed.")) + else + pbDisplay(_INTL("The Pokemon's nature was changed.")) + end + end + @scene.pbHardRefresh + when 5 + if pkmn.gender==2 + pbDisplay(_INTL("This Pokemon's gender can't be set.")) + elsif pkmn.gender==0 + if pbConfirm(_INTL("Make this Pokemon female?")) + oldnature=pkmn.nature + 2000.times do + pkmn.setGender(true) + break if pkmn.nature==oldnature @@ -611,7 +676,4 @@ - when 7 - if $DEBUG - pkmn=@heldpkmn ? @heldpkmn : pokemon - if pkmn - pkmn.genCodes("codes.txt") - pbDisplay(_INTL("Codes for this Pokemon were saved in codes.txt.")) - end + if pkmn.gender==0 + pbDisplay(_INTL("The Pokemon's gender couldn't be changed.")) + else + pbDisplay(_INTL("The Pokemon's gender was changed.")) @@ -619,0 +681,48 @@ + end + elsif pkmn.gender==1 + if pbConfirm(_INTL("Make this Pokemon male?")) + oldnature=pkmn.nature + 2000.times do + pkmn.setGender(false) + break if pkmn.nature==oldnature + end + if pkmn.gender==1 + pbDisplay(_INTL("The Pokemon's gender couldn't be changed.")) + else + pbDisplay(_INTL("The Pokemon's gender was changed.")) + end + end + @scene.pbHardRefresh + end + when 6 + clonedpkmn=pkmn.clone + clonedpkmn.iv=pkmn.iv.clone + clonedpkmn.ev=pkmn.ev.clone + if @storage.pbMoveCaughtToParty(clonedpkmn) + if selected[0]!=-1 + pbDisplay(_INTL("The duplicated Pokemon was moved to your party.")) + end + else + oldbox=@storage.currentBox + newbox=@storage.pbStoreCaught(clonedpkmn) + if newbox<0 + pbDisplay(_INTL("All boxes are full.")) + elsif newbox!=oldbox + pbDisplay(_INTL("The duplicated Pokemon was moved to box \"{1}.\"", + @storage[newbox].name)) + @storage.currentBox=oldbox + end + end + @scene.pbHardRefresh + when 7 + if pbConfirm(_INTL("Are you sure you want to delete this Pokemon?")) + @scene.pbRelease(selected,heldpoke) + if heldpoke + @heldpkmn=nil + else + @storage.pbDelete(selected[0],selected[1]) + end + @scene.pbRefresh + pbDisplay(_INTL("The Pokemon was deleted.")) + end + end @@ -1180,1 +1290,1 @@ - @boxviewport.z=100000 + @boxviewport.z=99999 @@ -1182,1 +1292,1 @@ - @boxsidesviewport.z=100001 + @boxsidesviewport.z=99999 @@ -1184,1 +1294,1 @@ - @arrowviewport.z=100002 + @arrowviewport.z=99999 @@ -1186,1 +1296,1 @@ - @viewport.z=100003 + @viewport.z=99999 @@ -1213,1 +1323,0 @@ - @@ -1705,0 +1814,8 @@ +end +def pbHardRefresh + oldPartyY=@sprites["boxparty"].y + @sprites["box"].dispose + @sprites["boxparty"].dispose + @sprites["box"]=PokemonBoxSprite.new(@storage,@storage.currentBox,@boxviewport) + @sprites["boxparty"]=PokemonBoxPartySprite.new($Trainer.party,@boxsidesviewport) + @sprites["boxparty"].y=oldPartyY Changed: PokemonDebug @@ -535,1 +535,1 @@ - nickname+=(value>=0) ? value.chr : "?" + nickname+=(value>0) ? sprintf("%c",value) : "?" @@ -540,1 +540,1 @@ - otname+=(value>=0) ? value.chr : "?" + otname+=(value>0) ? sprintf("%c",value) : "?" @@ -567,0 +567,2 @@ + happiness=0 + isegg=false @@ -579,1 +581,1 @@ - pokemon.happiness=data[4] + happiness=data[4] @@ -600,0 +602,12 @@ + if (data[0]&0xF0)>0 + pokemon.pokerus=2 + elsif (data[0]&0x0F)>0 + pokemon.pokerus=1 + pokemon.pokerusTime=Time.now.to_i + end + if (data[3]>>3)>0 + toballused=[0,4,3,1,0,2,5,6,7,8,9,10,11] + ball=(data[3]>>3) + ballused=toballused[ball] + pokemon.ballused=ballused ? ballused : 0 + end @@ -606,0 +620,2 @@ + isegg=(((data[4]>>30)&1)==1) + pokemon.abilityflag=(data[4]>>31)&1 @@ -608,0 +624,5 @@ + end + if isegg + pokemon.eggsteps=(happiness<<8)+255 + else + pokemon.happiness=happiness @@ -701,1 +722,4 @@ - _INTL("CLEAR BAG") + _INTL("CLEAR BAG"), + _INTL("QUICK HATCH"), + _INTL("TRAINER TYPES"), + _INTL("ADD POKéMON") @@ -907,35 +931,1 @@ - # No dependencies - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling town map data"),nil,0) - pbCompileTownMap - # No dependencies - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling map connection data"),nil,0) - pbCompileConnections - # No dependencies - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling move data"),nil,0) - pbCompileMoves - # No dependencies - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling ability data"),nil,0) - pbCompileAbilities - # No dependencies - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling item data"),nil,0) - pbCompileItems - # Depends on PBMoves, PBSpecies, PBItems, PBAbilities - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling Pokemon data"),nil,0) - pbCompilePokemonData - # Depends on PBSpecies, PBItems, PBMoves - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling Trainer data"),nil,0) - pbCompileTrainers - # Depends on PBTrainers - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling phone data"),nil,0) - pbCompilePhoneData - # Depends on PBTrainers - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling metadata"),nil,0) - pbCompileMetadata - # Depends on PBSpecies - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling encounter data"),nil,0) - pbCompileEncounters - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Compiling messages"),nil,0) - pbCompileAnimations - pbCompileTrainerEvents - pbSetTextMessages - MessageTypes.saveMessages + pbCompileAllData(true) {|msg| Kernel.pbDisplayMessageFancy(msgwindow,msg,nil,0) } @@ -952,0 +942,14 @@ + elsif ret==19 + for pokemon in $Trainer.party + pokemon.eggsteps=1 if pokemon.egg? + end + Kernel.pbMessage(_INTL("All eggs on your party now require one step to hatch.")) + elsif ret==20 + pbFadeOutIn(99999) { pbTrainerTypeEditor } + elsif ret==21 + species=pbChooseSpeciesOrdered(1) + if species!=0 + level=Kernel.pbMessageChooseNumber( + _INTL("Set the Pokemon's level."),5,3,nil,100) + pbAddPokemon(species,level) + end Changed: Sprite_Timer @@ -19,1 +19,2 @@ - @timer=Window_SimpleTextPokemon.newWithSize("",360,0,120,64) + @timer=Window_SimpleTextPokemon.newWithSize("", + Graphics.width-120,0,120,64) Changed: Particle Engine Changed: PokeBattle_Pokemon Changed: PokemonDayCare Changed: PokemonPokedex Changed: PokemonAnimEditor Changed: PokemonMenu Changed: PBIntl Changed: Scene_Map Changed: AnimationSprite Changed: Interpreter Changed: Pokegear Changed: Resolution* Changed: PerspectiveTilemap Changed: PokemonField Changed: PokemonSave Changed: PokemonNetwork Changed: PokemonMart Changed: PokemonTrainers Changed: SpriteResizer Changed: PokemonLoad Changed: Main Changed: PokeBattle_AI Changed: WindowAndTilemap Changed: PokemonWeather Changed: Game_Event* Changed: Game_System Changed: Compiler Changed: Game_Player* Changed: PokemonEvolution Changed: Spriteset_Map Changed: PokemonEditor Changed: PBAbilities Changed: PokemonMessages Changed: SpriteWindow Changed: PokemonSystem Changed: PokemonSummary Changed: PokemonUtilities Changed: PokemonRegionMap Changed: PokemonBag Changed: PokemonItems Changed: PokemonScreen Changed: PokemonStorage Changed: PokemonDebug Changed: Sprite_Timer