Changed: TilemapXP @@ -116,1 +116,0 @@ - #echoln "changing tone" @@ -128,1 +127,0 @@ - #echoln "changing color" @@ -139,1 +137,0 @@ -# echoln @autosprites.length+@tiles.length @@ -157,1 +154,1 @@ - !@viewport.oy!=@oldViewportOy + @viewport.oy!=@oldViewportOy @@ -625,1 +622,1 @@ - bitmap.fill_rect(xpos,ypos,0,0,trans) if overallcount<=2000 + bitmap.fill_rect(xpos,ypos,twidth,theight,trans) if overallcount<=2000 @@ -686,1 +683,1 @@ - bitmap.fill_rect(xpos,ypos,0,0,trans) + bitmap.fill_rect(xpos,ypos,twidth,theight,trans) Changed: PokemonMap @@ -426,0 +426,2 @@ + MetadataSurfBGM=12 + MetadataBicycleBGM=13 @@ -449,1 +451,3 @@ - $data_tilesets=load_data("Data/Tilesets.rxdata") + if FileTest.exist?("Data/Tilesets.rxdata") + $data_tilesets=load_data("Data/Tilesets.rxdata") + end @@ -523,1 +527,1 @@ - map = load_data(sprintf("Data/Map%03d.rxdata", id)) + map = pbLoadRxData(sprintf("Data/Map%03d", id)) @@ -776,1 +780,1 @@ - $game_map.autoplayAsCue + pbAutoplayOnTransition Changed: PokemonMenu @@ -51,1 +51,1 @@ - @sprites["infowindow"]=Window_FormattedTextPokemon.newWithSize("",0,0,32,32,@viewport) + @sprites["infowindow"]=Window_ColoredTextPokemon.newWithSize("",0,0,32,32,@viewport) @@ -53,1 +53,1 @@ - @sprites["helpwindow"]=Window_FormattedTextPokemon.newWithSize("",0,0,32,32,@viewport) + @sprites["helpwindow"]=Window_ColoredTextPokemon.newWithSize("",0,0,32,32,@viewport) Changed: DrawText @@ -1,1 +1,1 @@ - def getLineBrokenTextEx(bitmap,value,width,numlines,dims,escaped=false) + def getLineBrokenChunks(bitmap,value,width,dims,plain=false) @@ -3,1 +3,3 @@ - ret="" + y=0 + textheight=0 + ret=[] @@ -8,0 +10,2 @@ + re=/]+)>/ + reNoMatch=/]+>/ @@ -11,0 +15,1 @@ + color=Font.default_color @@ -14,3 +19,0 @@ - if escaped - ccheck=c.gsub(/\\\[[^\]]*\]/,"") - end @@ -19,3 +21,2 @@ - lines+=1 - ret+="\1" if lines>=numlines # "\1" means to pause the message - ret+="\n" + y+=(textheight==0) ? bitmap.text_size("X").height : textheight + textheight=0 @@ -24,17 +25,29 @@ - textwidth=bitmap.text_size(ccheck).width - a=x+textwidth - b=width-2 - if x>0 && x+textwidth>=width-2 # minus window trim minus shadow - x=0 - lines+=1 - ret+="\1" if lines>=numlines - ret+="\n" - end - ret+=c - x+=textwidth - dims[0]=x if dims && dims[0]0 && x+textwidth>=width-2 + x=0 + y+=32 # (textheight==0) ? bitmap.text_size("X").height : textheight + textheight=0 + end + textheight=32 # [textheight,textSize.height].max + ret.push([word,x,y,textwidth,textheight,color]) + x+=textwidth + dims[0]=x if dims && dims[0]0 && y>=maxlines - x = 0 - next - end - width=bitmap.text_size(textchars[i]).width - textx=x+xDst - texty=(32*y)+yDst - if shadowColor - bitmap.font.color=shadowColor - bitmap.draw_text(textx+2,texty,width+2,32,textchars[i]) - bitmap.draw_text(textx,texty+2,width+2,32,textchars[i]) - bitmap.draw_text(textx+2,texty+2,width+2,32,textchars[i]) - end - bitmap.font.color=baseColor - bitmap.draw_text(textx,texty,width+2,32,textchars[i]) - totalwidth+=width - x+=width - end - end - + def renderLineBrokenChunks(bitmap,xDst,yDst,normtext,maxheight=0) + for i in 0...normtext.length + width=normtext[i][3] + textx=normtext[i][1]+xDst + texty=normtext[i][2]+yDst + if maxheight==0 || texty]*))?>/ +FORMATREGEXP=/<(\/?)([Cc]|[Cc][2]|[Ff][Nn]|[Bb][Rr]|[Ff][Ss]|[Ii]|[Bb]|[Uu]|[Ss]|[Ii][Cc][Oo][Nn]|[Ii][Mm][Gg]|[Aa][Cc]|[Aa][Rr]|[Aa][Ll]|[Rr])(\s*\=\s*([^>]*))?>/ @@ -428,2 +464,6 @@ - fontname=bitmap.font.name.clone - fontsize=bitmap.font.size + defaultfontname=bitmap.font.name.clone + defaultfontsize=bitmap.font.size + fontname=defaultfontname + fontsize=defaultfontsize + fontnamestack=[] + fontsizestack=[] @@ -431,2 +471,2 @@ - if fontname.is_a?(Array) - fontname.push("Arial") + if defaultfontname.is_a?(Array) + defaultfontname.push("Arial") @@ -434,1 +474,1 @@ - fontname=[fontname,"Arial"] + defaultfontname=[defaultfontname,"Arial"] @@ -444,0 +484,5 @@ + graphicX=0 + graphicY=0 + graphicWidth=nil + graphicHeight=nil + graphicRect=nil @@ -477,1 +522,6 @@ - fontsize=param.sub(/\s+$/,"").to_i + if endtag + fontsizestack.pop + else + fontsizestack.push(param.sub(/\s+$/,"").to_i) + end + fontsize=getLastParam(fontsizestack,defaultfontsize) @@ -480,1 +530,6 @@ - fontname=[param.sub(/\s+$/,""),"Arial"] + if endtag + fontnamestack.pop + else + fontnamestack.push([param.sub(/\s+$/,""),"Arial"]) + end + fontname=getLastParam(fontnamestack,defaultfontname) @@ -510,0 +565,16 @@ + controls[i]=nil + break + end + elsif control=="img" # Icon + if !endtag + param=param.sub(/\s+$/,"") + param=param.split("|") + graphic=param[0] + if param.length>1 + graphicX=param[1].to_i + graphicY=param[2].to_i + graphicWidth=param[3].to_i + graphicHeight=param[4].to_i + end + controls[i]=nil + break @@ -527,2 +598,7 @@ - tempgraphic=Bitmap.new(graphic) - width=tempgraphic.width+8 + if !graphicWidth + tempgraphic=Bitmap.new(graphic) + graphicWidth=tempgraphic.width + graphicHeight=tempgraphic.height + tempgraphic.dispose + end + width=graphicWidth+8 @@ -530,2 +606,2 @@ - yStart=[(lineheight/2)-(tempgraphic.height/2),0].max - tempgraphic.dispose + yStart=[(lineheight/2)-(graphicHeight/2),0].max + graphicRect=Rect.new(graphicX,graphicY,graphicWidth,graphicHeight) @@ -545,1 +621,1 @@ - false,false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position]) + false,false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil]) @@ -559,1 +635,1 @@ - false,false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position]) + false,false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil]) @@ -599,1 +675,1 @@ - (underlinecount>0),(strikecount>0),fontname,fontsize,position]) + (underlinecount>0),(strikecount>0),fontname,fontsize,position,graphicRect]) @@ -607,1 +683,1 @@ - false,false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position]) + false,false,false,defaultcolors[0],defaultcolors[1],false,false,"",8,position,nil]) @@ -653,3 +729,0 @@ - if characters.length!=charactersInternal.length - p characters.length,charactersInternal.length - end @@ -723,1 +796,2 @@ - bitmap.blt(ch[1], ch[2], graphic,graphic.rect,ch[8].alpha) + graphicRect=ch[15] + bitmap.blt(ch[1], ch[2], graphic,graphicRect,ch[8].alpha) @@ -725,1 +799,1 @@ - elsif ch[0]!="\n" && !isWaitChar(ch[0]) + else @@ -729,1 +803,1 @@ - if !ch[0][/\s\x01/] + if ch[0]!="\n" && ch[0]!="\r" && ch[0]!=" " && !isWaitChar(ch[0]) @@ -794,2 +868,2 @@ - normtext=getLineBrokenTextEx(bitmap,text,width,numlines,nil) - renderLineBrokenText(bitmap,x,y,normtext,baseColor,shadowColor,numlines) + normtext=getLineBrokenChunks(bitmap,text,width,nil,true) + renderLineBrokenChunksWithShadow(bitmap,x,y,normtext,numlines*32,baseColor,shadowColor) Changed: PokemonPhone @@ -130,1 +130,1 @@ - $PokemonGlobal.phoneTime=15000+rand(10000) + $PokemonGlobal.phoneTime=15000+rand(40000) @@ -138,1 +138,0 @@ -# $PokemonGlobal.phoneTime=100 if $PokemonGlobal.phoneTime>100 Changed: PerspectiveTilemap @@ -124,3 +124,3 @@ - StripSize = 8 - Curve = false - Pitch = 5 + StripSize = 16 + Curve = true + Pitch = 3 @@ -221,2 +221,2 @@ - sprite.tone=@tone - sprite.color=@color + # sprite.tone=@tone + # sprite.color=@color Changed: PokemonField @@ -111,0 +111,1 @@ + Graphics.frame_reset @@ -494,1 +495,3 @@ - decision=battle.pbStartBattle + pbSceneStandby { + decision=battle.pbStartBattle + } @@ -971,0 +974,1 @@ + @@ -1084,1 +1088,3 @@ - $game_system.bgm_play($PokemonTemp.cueBGM) + if $game_system.getPlayingBGM==nil + $game_system.bgm_play($PokemonTemp.cueBGM) + end @@ -1106,0 +1112,22 @@ + +def pbAutoplayOnTransition + surfbgm=pbGetMetadata(0,MetadataSurfBGM) + bikebgm=pbGetMetadata(0,MetadataBicycleBGM) + if $PokemonGlobal.surfing && surfbgm + $game_system.bgm_play(surfbgm) + else + $game_map.autoplayAsCue + end +end + +def pbAutoplayOnSave + surfbgm=pbGetMetadata(0,MetadataSurfBGM) + bikebgm=pbGetMetadata(0,MetadataBicycleBGM) + if $PokemonGlobal.surfing && surfbgm + $game_system.bgm_play(surfbgm) + elsif $PokemonGlobal.bicycle && bikebgm + $game_system.bgm_play(bikebgm) + else + $game_map.autoplay + end +end @@ -1126,0 +1154,4 @@ + surfbgm=pbGetMetadata(0,MetadataBicycleBGM) + if surfbgm + pbCueBGM(surfbgm,0.5) + end @@ -1132,0 +1164,1 @@ + $game_map.autoplayAsCue @@ -1677,0 +1710,4 @@ + surfbgm=pbGetMetadata(0,MetadataSurfBGM) + if surfbgm + pbCueBGM(surfbgm,0.5) + end @@ -1718,1 +1755,6 @@ - $game_map.autoplay + surfbgm=pbGetMetadata(0,MetadataSurfBGM) + if surfbgm + $game_system.bgm_play(surfbgm) + else + $game_map.autoplayAsCue + end @@ -1857,0 +1899,1 @@ + $game_map.autoplayAsCue Changed: PokemonSave @@ -12,6 +12,6 @@ - loctext=_INTL("{1}
",mapname) - loctext+=_INTL("PLAYER: {1}
",$Trainer.name) - loctext+=_INTL("BADGES: {1}
",$Trainer.numbadges) - loctext+=_INTL("POKéDEX: {1}
",$Trainer.pokedexOwned) - loctext+=_INTL("TIME: {1}",_ISPRINTF("{1:02d}:{2:02d}",hour,min)) - @sprites["locwindow"]=Window_FormattedTextPokemon.new(loctext) + loctext=_INTL("{1}
",mapname) + loctext+=_INTL("PLAYER: {1}
",$Trainer.name) + loctext+=_INTL("BADGES: {1}
",$Trainer.numbadges) + loctext+=_INTL("POKéDEX: {1}
",$Trainer.pokedexOwned) + loctext+=_ISPRINTF("TIME: {1:02d}:{2:02d}",hour,min) + @sprites["locwindow"]=Window_AdvancedTextPokemon.new(loctext) @@ -37,1 +37,5 @@ - $game_system.magic_number = $data_system.magic_number + if $data_system.respond_to?("magic_number") + $game_system.magic_number = $data_system.magic_number + else + $game_system.magic_number = $data_system.version_id + end Changed: PokeBattle_ActualScene @@ -280,1 +280,1 @@ - @info=Window_FormattedTextPokemon.newWithSize( + @info=Window_AdvancedTextPokemon.newWithSize( @@ -578,2 +578,6 @@ - self.bitmap.fill_rect(@spritebaseX+78,@spritebaseY+34,hpgauge,2,hpcolors[hpzone*2]) - self.bitmap.fill_rect(@spritebaseX+78,@spritebaseY+36,hpgauge,2,hpcolors[hpzone*2+1]) + hpGaugeX=PokeBattle_Scene::HPGAUGE_X + hpGaugeY=PokeBattle_Scene::HPGAUGE_Y + expGaugeX=PokeBattle_Scene::EXPGAUGE_X + expGaugeY=PokeBattle_Scene::EXPGAUGE_Y + self.bitmap.fill_rect(@spritebaseX+hpGaugeX,@spritebaseY+hpGaugeY,hpgauge,2,hpcolors[hpzone*2]) + self.bitmap.fill_rect(@spritebaseX+hpGaugeX,@spritebaseY+hpGaugeY+2,hpgauge,2,hpcolors[hpzone*2+1]) @@ -581,2 +585,2 @@ - self.bitmap.fill_rect(@spritebaseX+78+hpgauge,@spritebaseY+34,96-hpgauge,2,PokeBattle_Scene::HPCOLORSHADOW4) - self.bitmap.fill_rect(@spritebaseX+78+hpgauge,@spritebaseY+36,96-hpgauge,2,PokeBattle_Scene::HPCOLORBASE4) + self.bitmap.fill_rect(@spritebaseX+hpGaugeX+hpgauge,@spritebaseY+hpGaugeY,96-hpgauge,2,PokeBattle_Scene::HPCOLORSHADOW4) + self.bitmap.fill_rect(@spritebaseX+hpGaugeX+hpgauge,@spritebaseY+hpGaugeY+2,96-hpgauge,2,PokeBattle_Scene::HPCOLORBASE4) @@ -585,1 +589,1 @@ - self.bitmap.fill_rect(@spritebaseX+46,@spritebaseY+66,self.exp,4,PokeBattle_Scene::EXPCOLOR) + self.bitmap.fill_rect(@spritebaseX+expGaugeX,@spritebaseY+expGaugeY,self.exp,4,PokeBattle_Scene::EXPCOLOR) @@ -1026,0 +1030,6 @@ +# Position of HP gauge +HPGAUGE_X=78 +HPGAUGE_Y=34 +# Position of EXP gauge +EXPGAUGE_X=46 +EXPGAUGE_Y=66 Changed: PokemonTrainers @@ -250,7 +250,0 @@ - combinedParty2=[] - if trainer1[2].length>3 - raise _INTL("Opponent 1's party has more than three Pokemon, which is not allowed") - end - if trainer2[2].length>3 - raise _INTL("Opponent 2's party has more than three Pokemon, which is not allowed") - end @@ -261,4 +254,1 @@ - combinedParty[3+i]=trainer2[2][i] - end - for i in 0...6 - combinedParty2[i]=combinedParty[i].clone if combinedParty[i] + combinedParty[6+i]=trainer2[2][i] @@ -275,0 +265,1 @@ + battle.fullparty2=true @@ -399,15 +390,24 @@ - combinedParty2=[] - if $PokemonTemp.waitingTrainer[0][2].length>3 - raise _INTL("Opponent 1's party has more than three Pokemon, which is not allowed") - end - if trainer[2].length>3 - raise _INTL("Opponent 2's party has more than three Pokemon, which is not allowed") - end - for i in 0...$PokemonTemp.waitingTrainer[0][2].length - combinedParty[i]=$PokemonTemp.waitingTrainer[0][2][i] - end - for i in 0...trainer[2].length - combinedParty[3+i]=trainer[2][i] - end - for i in 0...6 - combinedParty2[i]=combinedParty[i].clone if combinedParty[i] + fullparty2=false + if false + if $PokemonTemp.waitingTrainer[0][2].length>3 + raise _INTL("Opponent 1's party has more than three Pokemon, which is not allowed") + end + if trainer[2].length>3 + raise _INTL("Opponent 2's party has more than three Pokemon, which is not allowed") + end + elsif $PokemonTemp.waitingTrainer[0][2].length>3 || trainer[2].length>3 + for i in 0...$PokemonTemp.waitingTrainer[0][2].length + combinedParty[i]=$PokemonTemp.waitingTrainer[0][2][i] + end + for i in 0...trainer[2].length + combinedParty[6+i]=trainer[2][i] + end + fullparty2=true + else + for i in 0...$PokemonTemp.waitingTrainer[0][2].length + combinedParty[i]=$PokemonTemp.waitingTrainer[0][2][i] + end + for i in 0...trainer[2].length + combinedParty[3+i]=trainer[2][i] + end + fullparty2=false @@ -426,0 +426,1 @@ + battle.fullparty2=fullparty2 Changed: PokemonDuel @@ -4,1 +4,1 @@ -class DuelWindow < Window_FormattedTextPokemon +class DuelWindow < Window_AdvancedTextPokemon Changed: PokemonLoad @@ -9,1 +9,1 @@ - @sprites["locwindow"]=Window_FormattedTextPokemon.new("") + @sprites["locwindow"]=Window_AdvancedTextPokemon.new("") @@ -83,1 +83,7 @@ - Dest = ENV['SystemRoot'] + '\\Fonts\\' + if ENV['SystemRoot'] + Dest = ENV['SystemRoot'] + '\\Fonts\\' + elsif ENV['windir'] + Dest = ENV['windir'] + '\\Fonts\\' + else + Dest = '\\Windows\\Fonts\\' + end @@ -206,4 +212,4 @@ - loctext+=_INTL("PLAYER: {1}
",fmtescape(trainer.name)) - loctext+=_INTL("BADGES: {1}
",trainer.numbadges) - loctext+=_INTL("POKéDEX: {1}
",trainer.pokedexOwned) - loctext+=_INTL("TIME: ")+_ISPRINTF("{1:02d}:{2:02d}",hour,min) + loctext+=_INTL("PLAYER: {1}
",fmtescape(trainer.name)) + loctext+=_INTL("BADGES: {1}
",trainer.numbadges) + loctext+=_INTL("POKéDEX: {1}
",trainer.pokedexOwned) + loctext+=_ISPRINTF("TIME: {1:02d}:{2:02d}",hour,min) @@ -216,1 +222,1 @@ - File.delete("Game.rxdata") + File.delete(savefile) @@ -252,1 +258,1 @@ - $data_system = load_data("Data/System.rxdata") + $data_system = pbLoadRxData("Data/System") @@ -283,1 +289,7 @@ - if $game_system.magic_number != $data_system.magic_number || $PokemonGlobal.safesave + magicNumberMatches=false + if $data_system.respond_to?("magic_number") + magicNumberMatches=($game_system.magic_number==$data_system.magic_number) + else + magicNumberMatches=($game_system.magic_number==$data_system.version_id) + end + if !magicNumberMatches || $PokemonGlobal.safesave @@ -296,1 +308,1 @@ - $game_map.autoplay + pbAutoplayOnSave Changed: Main @@ -22,1 +22,12 @@ - return pbCriticalCode { + if $DEBUG + pbCriticalCode { mainFunctionDebug } + else + mainFunctionDebug + end + return 1 +end + +def mainFunctionDebug + getCurrentThread=Win32API.new("kernel32.dll","GetCurrentThread","","l") + setThreadPriority=Win32API.new("kernel32.dll","SetThreadPriority",%w(l i),"") + setThreadPriority.call(getCurrentThread.call(),2) @@ -36,1 +47,0 @@ - } Changed: PokemonEntry @@ -28,0 +28,9 @@ + def self.updateKeyState(i) + if !@stateUpdated[i] + newstate=self.getstate(i) + @triggerstate[i]=(newstate&&@keystate[i]==0) + @releasestate[i]=(!newstate&&@keystate[i]>0) + @keystate[i]=newstate ? @keystate[i]+1 : 0 + @stateUpdated[i]=true + end + end @@ -31,4 +40,8 @@ - @newstate=self.getstate(i) - @triggerstate[i]=(@newstate&&@keystate[i]==0) - @releasestate[i]=(!@newstate&&@keystate[i]>0) - @keystate[i]=@newstate ? @keystate[i]+1 : 0 + # just noting that the state should be updated + # instead of thunking to Win32 256 times + @stateUpdated[i]=false + if @keystate[i] > 0 + # If there is a repeat count, update anyway + # (will normally apply only to a very few keys) + updateKeyState(i) + end @@ -37,0 +50,1 @@ + @stateUpdated=[] @@ -41,0 +55,1 @@ + @stateUpdated[i]=true @@ -177,0 +192,1 @@ + updateKeyState(key) @@ -181,0 +197,1 @@ + updateKeyState(key) @@ -185,0 +202,1 @@ + updateKeyState(key) @@ -189,0 +207,1 @@ + updateKeyState(key) @@ -205,2 +224,0 @@ - @baseColor=Color.new(12<<3,12<<3,12<<3) - @shadowColor=Color.new(26<<3,26<<3,26<<3) @@ -398,2 +415,0 @@ - @baseColor=Color.new(12<<3,12<<3,12<<3) - @shadowColor=Color.new(26<<3,26<<3,26<<3) Changed: Compiler @@ -608,1 +608,3 @@ - "TextSkin"=>[11,"s"] + "TextSkin"=>[11,"s"], + "SurfBGM"=>[12,"s"], + "BicycleBGM"=>[13,"s"] @@ -2508,0 +2510,9 @@ +def safequote2(x) + x=x.gsub(/\"\#\'\\/){|a| "\\"+a } + x=x.gsub(/\t/,"\\t") + x=x.gsub(/\r/,"\\r") + x=x.gsub(/\n/," ") + return x +end + + @@ -2520,1 +2531,1 @@ - mapinfos=load_data("Data/MapInfos.rxdata") + mapinfos=pbLoadRxData("Data/MapInfos") @@ -2524,2 +2535,2 @@ - filename=sprintf("Data/map%03d.rxdata",id) - map=load_data(filename) + filename=sprintf("Data/map%03d",id) + map=pbLoadRxData(filename) @@ -2625,1 +2636,1 @@ - sprintf("pbTrainerBattle(%s,_I(\"%s\"),false,%d)",safetrcombo,safequote(espeech),battleid) + sprintf("pbTrainerBattle(%s,_I(\"%s\"),false,%d)",safetrcombo,safequote2(espeech),battleid) @@ -2673,1 +2684,1 @@ - safetrcombo,safequote(espeech),i),1 + safetrcombo,safequote2(espeech),i),1 Changed: RGSS2Compatibility @@ -1,0 +1,51 @@ +=begin +class Win32API + class << self + unless defined?(debug_new) + alias debug_new new + end + def new(*args) + File.open("winapi.txt","ab"){|f| f.write("new(#{args[0]},#{args[1]})\r\n") } + b=debug_new(*args) + b.setDllName(args[0],args[1]) + return b + end + end + unless defined?(debug_call) + alias debug_call call + end + def setDllName(a,b) + @w32dll=a + @w32name=b + end + def call(*args) + if @w32name!="GetAsyncKeyState" + File.open("winapi.txt","ab"){|f| + f.write("call(#{@w32dll},#{@w32name},#{args.inspect})\r\n") + } + end + debug_call(*args) + end +end +class Bitmap + class << self + unless defined?(debug_new) + alias debug_new new + end + def new(*args) + if args.length==1 + File.open("winapib.txt","ab"){|f| f.write("new(#{args[0]})\r\n") } + end + debug_new(*args) + end + end +end + +alias debug_load_data load_data +def load_data(*args) + File.open("winapif.txt","ab"){|f| f.write("load(#{args[0]})\r\n") } + debug_load_data(*args) +end +=end + + Changed: PokemonMessages @@ -414,3 +414,13 @@ - text=@list[@index].parameters[0] - text+=" " if text[text.length-1,1]!=" " - message+=text + text="" + if @list[@index].parameters.length==1 + text+=@list[@index].parameters[0] + text+=" " if text[text.length-1,1]!=" " + message+=text + else + facename=@list[@index].parameters[0] + faceindex=@list[@index].parameters[1] + if facename && facename!="" + text+="\\ff[#{facename},#{faceindex}]" + message+=text + end + end @@ -624,1 +634,3 @@ - cmdwindow.height=height + if cmdwindow.height!=height + cmdwindow.height=height + end @@ -683,1 +695,1 @@ - map = load_data("Data/MapInfos.rxdata") + map = pbLoadRxData("Data/MapInfos") @@ -827,0 +839,1 @@ + msgwindow.back_opacity=MessageConfig::WindowOpacity @@ -924,0 +937,58 @@ +def itemIconTag(item) + return "" if !item + if item.respond_to?("icon_name") + return sprintf("",item.icon_name) + else + ix=item.icon_index % 16 * 24 + iy=item.icon_index / 16 * 24 + return sprintf("",ix,iy) + end +end + +def getDefaultTextColors(windowskin) + if !windowskin || windowskin.disposed? || + windowskin.width!=128 || windowskin.height!=128 + if isDarkWindowskin(windowskin) + return [Color.new(31*8,31*8,31*8), + Color.new(23*8,23*8,23*8)] # White + else + return [Color.new(12*8,12*8,12*8), + Color.new(26*8,26*8,25*8)] # Dark gray + end + else # VX windowskin + color=windowskin.get_pixel(64, 96) + shadow=nil + isdark=(color.red+color.green+color.blue)/3 < 128 + if isdark + shadow=Color.new(color.red+64,color.green+64,color.blue+64) + else + shadow=Color.new(color.red-64,color.green-64,color.blue-64) + end + return [color,shadow] + end +end + +def getSkinColor(windowskin,color,isDarkSkin) + if !windowskin || windowskin.disposed? || + windowskin.width!=128 || windowskin.height!=128 + textcolors=[ + isDarkSkin ? "" : "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + color=0 if color>textcolors.length + return textcolors[color] + else # VX windowskin + color=0 if color>=32 + x = 64 + (color % 8) * 8 + y = 96 + (color / 8) * 8 + pixel=windowskin.get_pixel(x, y) + return shadowctagFromColor(pixel) + end +end @@ -961,13 +1032,3 @@ - textcolors=[ - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - if isDarkWindowskin(msgwindow.windowskin) || - ($game_message && $game_message.background>0) || + colortag="" + isDarkSkin=isDarkWindowskin(msgwindow.windowskin) + if ($game_message && $game_message.background>0) || @@ -976,4 +1037,5 @@ - textcolors[0]="" - text=""+text - end - text.gsub!(/\\[Cc]\[([0-8])\]/){ + colortag=getSkinColor(msgwindow.windowskin,0,true) + else + colortag=getSkinColor(msgwindow.windowskin,0,isDarkSkin) + end + text.gsub!(/\\[Cc]\[([0-9]+)\]/){ @@ -981,1 +1043,1 @@ - next textcolors[m] + next getSkinColor(msgwindow.windowskin,m,isDarkSkin) @@ -994,0 +1056,1 @@ + text=colortag+text @@ -997,1 +1060,1 @@ - while text[/(?:\\([WwFf]|[Ff][Ff]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Ww][Dd]|[Ww][Mm]|[Ww][Uu])())/i] + while text[/(?:\\([WwFf]|[Ff][Ff]|[Mm][Ee]|[Ss][Ee]|[Ww][Tt]|[Ww][Tt][Nn][Pp]|[Cc][Hh])\[([^\]]*)\]|\\([Gg]|[Ww][Dd]|[Ww][Mm]|[Ww][Uu]|[\.]|[\|]|[\!]|[\x5E])())/i] @@ -1013,1 +1076,1 @@ - if control=="wt" || control=="wtnp" + if control=="wt" || control=="wtnp" || control=="." || control=="|" @@ -1015,0 +1078,2 @@ + elsif control=="!" + textchunks[i]+="\1" @@ -1037,1 +1102,1 @@ - elsif control=="wtnp" + elsif control=="wtnp" || control=="^" @@ -1085,1 +1150,1 @@ - Graphics.frame_reset if Graphics.frame_count>40 + Graphics.frame_reset if Graphics.frame_rate>40 @@ -1137,0 +1202,4 @@ + elsif control=="." + waitcount+=Graphics.frame_rate/4 + elsif control=="|" + waitcount+=Graphics.frame_rate @@ -1146,0 +1215,2 @@ + elsif control=="^" # Wait, no pause + autoresume=true Changed: SpriteWindow @@ -10,0 +10,1 @@ + WindowOpacity=255 @@ -949,1 +950,0 @@ - p @skinrect, @trim @@ -1213,0 +1213,1 @@ +=begin @@ -1220,0 +1221,1 @@ +=end @@ -1573,1 +1575,1 @@ - self.cursor_rect.empty +# self.cursor_rect.empty @@ -1589,1 +1591,1 @@ - self.cursor_rect.set(x, y, cursor_width, 32) +# self.cursor_rect.set(x, y, cursor_width, 32) @@ -1627,2 +1629,3 @@ - @baseColor=Color.new(12*8,12*8,12*8) - @shadowColor=Color.new(26*8,26*8,25*8) + colors=getDefaultTextColors(self.windowskin) + @baseColor=colors[0] + @shadowColor=colors[1] @@ -1759,2 +1762,3 @@ - @baseColor=Color.new(12*8,12*8,12*8) - @shadowColor=Color.new(26*8,26*8,25*8) + colors=getDefaultTextColors(self.windowskin) + @baseColor=colors[0] + @shadowColor=colors[1] @@ -1852,1 +1856,1 @@ -class Window_FormattedTextPokemonOld < SpriteWindow_Base +class Window_ColoredTextPokemon < SpriteWindow_Base @@ -1854,0 +1858,3 @@ + attr_reader :baseColor + attr_reader :shadowColor + attr_accessor :letterbyletter @@ -1857,-1 +1864,7 @@ + end + def baseColor=(value) + @baseColor=value + refresh + end + def shadowColor=(value) + @shadowColor=value @@ -1862,0 +1877,5 @@ + @text=text + @letterbyletter=false # Not supported in this class + colors=getDefaultTextColors(self.windowskin) + @baseColor=colors[0] + @shadowColor=colors[1] @@ -1863,2 +1883,0 @@ - @text=text - refresh @@ -1873,0 +1891,1 @@ + ret.refresh @@ -1878,5 +1897,1 @@ - chars=getFormattedText(self.contents,0,0,cwidth,-1,text,32) - for ch in chars - dims[0]=[dims[0],ch[1]+ch[3]].max - dims[1]=[dims[1],ch[2]+ch[4]].max - end + getLineBrokenChunks(self.contents,text,cwidth,dims,true) @@ -1889,0 +1904,1 @@ + refresh @@ -1894,0 +1910,1 @@ + refresh @@ -1898,3 +1915,1 @@ - chars=getFormattedText(self.contents,0,0, - self.contents.width,self.contents.height,""+@text,32) - drawFormattedChars(self.contents,chars) + drawTextEx(self.contents,0,0,self.contents.width,0,@text,@baseColor,@shadowColor) @@ -1911,0 +1926,6 @@ + end + def textspeed + @frameskip + end + def textspeed=(value) + @frameskip=value @@ -2031,2 +2052,3 @@ - @baseColor=Color.new(12*8,12*8,12*8) - @shadowColor=Color.new(26*8,26*8,25*8) + colors=getDefaultTextColors(self.windowskin) + @baseColor=colors[0] + @shadowColor=colors[1] @@ -2169,1 +2191,1 @@ - if @realframes==@frameskip || @frameskip<0 + if @realframes>=@frameskip || @frameskip<0 @@ -2182,1 +2204,1 @@ - if @realframes==@frameskip || @frameskip<0 + if @realframes>=@frameskip || @frameskip<0 @@ -2191,1 +2213,1 @@ - if @realframes==@frameskip || @frameskip<0 + if @realframes>=@frameskip || @frameskip<0 @@ -2199,1 +2221,1 @@ - if @realframes==@frameskip || @frameskip<0 + if @realframes>=@frameskip || @frameskip<0 @@ -2247,3 +2269,0 @@ -class Window_FormattedTextPokemon < Window_AdvancedTextPokemon -end - @@ -2253,6 +2272,0 @@ - end -end - -class Window_ColoredTextPokemon < Window_AdvancedTextPokemon - def text=(value) - super(coloredToFormattedText(value)) @@ -2271,2 +2284,3 @@ - @baseColor=Color.new(12<<3,12<<3,12<<3) - @shadowColor=Color.new(26<<3,26<<3,26<<3) + colors=getDefaultTextColors(self.windowskin) + @baseColor=colors[0] + @shadowColor=colors[1] Changed: PokemonSystem @@ -8,-1 +8,9 @@ +def pbLoadRxData(file) + if $RPGVX + return load_data(file+".rvdata") + else + return load_data(file+".rxdata") + end +end + + Changed: PokemonUtilities @@ -4,4 +4,4 @@ - Tone.new(-187,-119,-17,68), - Tone.new(-187,-119,-17,68), - Tone.new(-187,-119,-17,68), - Tone.new(-187,-119,-17,68), + Tone.new(-142.5,-142.5,-22.5,68), + Tone.new(-135.5,-135.5,-24,68), + Tone.new(-127.5,-127.5,-25.5,68), + Tone.new(-127.5,-127.5,-25.5,68), @@ -24,4 +24,4 @@ - Tone.new(-127.5,-127.5,-25.5,34), - Tone.new(-187,-119,-17,68), - Tone.new(-187,-119,-17,68), - Tone.new(-187,-119,-17,68) + Tone.new(-88.5,-133,-31,34), + Tone.new(-108.5,-129,-28,68), + Tone.new(-127.5,-127.5,-25.5,68), + Tone.new(-142.5,-142.5,-22.5,68) Changed: PokemonBag @@ -263,1 +263,1 @@ - using(numwindow=Window_SimpleTextPokemon.new(_INTL("x000"))){ + using(numwindow=Window_ColoredTextPokemon.new(_INTL("x000"))){ @@ -266,2 +266,0 @@ - numwindow.baseColor=Color.new(72,72,72) - numwindow.shadowColor=Color.new(208,208,208) @@ -319,0 +317,1 @@ + cw.visible=false @@ -322,0 +321,1 @@ + cw.visible=false @@ -340,0 +340,1 @@ + cw.visible=false @@ -366,0 +367,1 @@ + dw.visible=false @@ -369,0 +371,1 @@ + cwIndex=cw.index @@ -370,1 +373,2 @@ - return (cw.index==0)?true:false + dw.visible=false + return (cwIndex==0)?true:false @@ -438,1 +442,1 @@ - @sprites["itemtextwindow"]=Window_SimpleTextPokemon.new("") + @sprites["itemtextwindow"]=Window_ColoredTextPokemon.new("") @@ -448,1 +452,1 @@ - @sprites["helpwindow"]=Window_SimpleTextPokemon.new("") + @sprites["helpwindow"]=Window_ColoredTextPokemon.new("") @@ -451,2 +455,3 @@ - @sprites["helpwindow"].baseColor=Color.new(72,72,72) - @sprites["helpwindow"].shadowColor=Color.new(208,208,208) + @sprites["msgwindow"]=Window_AdvancedTextPokemon.new("") + @sprites["msgwindow"].visible=false + @sprites["msgwindow"].viewport=@viewport @@ -471,1 +476,1 @@ - @sprites["helpwindow"],msg,brief) + @sprites["msgwindow"],msg,brief) @@ -476,1 +481,1 @@ - @sprites["helpwindow"],msg) + @sprites["msgwindow"],msg) @@ -481,1 +486,1 @@ - @sprites["helpwindow"],msg) + @sprites["msgwindow"],msg) @@ -613,1 +618,1 @@ - @sprites["itemtextwindow"]=Window_SimpleTextPokemon.newWithSize("",64,208,480-64,128,@viewport) + @sprites["itemtextwindow"]=Window_ColoredTextPokemon.newWithSize("",64,208,480-64,128,@viewport) @@ -617,1 +622,1 @@ - @sprites["helpwindow"]=Window_SimpleTextPokemon.new("") + @sprites["helpwindow"]=Window_ColoredTextPokemon.new("") @@ -620,2 +625,3 @@ - @sprites["helpwindow"].baseColor=Color.new(72,72,72) - @sprites["helpwindow"].shadowColor=Color.new(208,208,208) + @sprites["msgwindow"]=Window_AdvancedTextPokemon.new("") + @sprites["msgwindow"].visible=false + @sprites["msgwindow"].viewport=@viewport @@ -680,1 +686,1 @@ - @sprites["helpwindow"],msg,brief) + @sprites["msgwindow"],msg,brief) @@ -685,1 +691,1 @@ - @sprites["helpwindow"],msg) + @sprites["msgwindow"],msg) @@ -690,1 +696,1 @@ - @sprites["helpwindow"],msg) + @sprites["msgwindow"],msg) @@ -1116,0 +1122,1 @@ +begin @@ -1162,0 +1169,3 @@ +rescue + p $!.message, $!.backtrace +end Changed: PokemonScreen @@ -401,2 +401,4 @@ - @preselected=value - refresh + if value!=@preselected + @preselected=value + refresh + end @@ -429,2 +431,2 @@ - end - pbSetSmallFont(self.bitmap) + pbSetSmallFont(self.bitmap) + end @@ -445,4 +447,6 @@ - @itemsprite.bitmap=(@pokemon.mail) ? @mailbitmap : @itembitmap - @itemsprite.x=self.x+@itemXOffset - @itemsprite.y=self.y+@itemYOffset - @itemsprite.color=self.color + if @itemsprite.visible + @itemsprite.bitmap=(@pokemon.mail) ? @mailbitmap : @itembitmap + @itemsprite.x=self.x+@itemXOffset + @itemsprite.y=self.y+@itemYOffset + @itemsprite.color=self.color + end @@ -485,0 +489,1 @@ + pbSetSmallFont(self.bitmap) @@ -562,1 +567,0 @@ - pbRefresh @@ -577,1 +581,2 @@ - +# @sprites["messagebox"].baseColor=Color.new(72,72,72) +# @sprites["messagebox"].shadowColor=Color.new(208,208,208) @@ -588,1 +593,1 @@ - @sprites["helpwindow"]=Window_FormattedTextPokemon.new(starthelptext) + @sprites["helpwindow"]=Window_ColoredTextPokemon.new(starthelptext) @@ -592,2 +597,0 @@ - @sprites["messagebox"].baseColor=Color.new(72,72,72) - @sprites["messagebox"].shadowColor=Color.new(208,208,208) @@ -680,0 +683,11 @@ +def pbRefreshSingle(i) + sprite=@sprites["pokemon#{i}"] + if sprite + if sprite.is_a?(PokeSelectionSprite) + sprite.pokemon=sprite.pokemon + else + sprite.refresh + end + end +end + @@ -709,1 +723,0 @@ - pbRefresh @@ -771,1 +784,0 @@ - pbRefresh @@ -827,1 +839,0 @@ - pbRefresh @@ -871,0 +882,4 @@ +end + +def pbRefreshSingle(i) + @scene.pbRefreshSingle(i) @@ -1008,1 +1023,1 @@ - pbRefresh + pbRefreshSingle(pkmnid) @@ -1149,0 +1164,1 @@ + pbRefreshSingle(pkmnid) @@ -1152,0 +1168,1 @@ + pbRefreshSingle(pkmnid) @@ -1256,0 +1273,1 @@ + pbRefresh @@ -1316,0 +1334,1 @@ + pbRefreshSingle(pkmnid) @@ -1326,0 +1345,1 @@ + pbRefreshSingle(pkmnid) @@ -1347,0 +1367,1 @@ + pbRefreshSingle(pkmnid) @@ -1363,0 +1384,1 @@ + pbRefreshSingle(pkmnid) @@ -1376,0 +1398,1 @@ + pbRefreshSingle(pkmnid) @@ -1396,0 +1419,1 @@ + pbRefreshSingle(pkmnid) @@ -1407,0 +1431,1 @@ + pbRefreshSingle(pkmnid) @@ -1415,0 +1440,1 @@ + pbRefreshSingle(pkmnid) @@ -1418,0 +1444,1 @@ + pbRefreshSingle(pkmnid) Changed: PokemonStorage @@ -1960,1 +1960,4 @@ - if !$PokemonGlobal.pcItemStorage || $PokemonGlobal.pcItemStorage.empty? + if !$PokemonGlobal.pcItemStorage + $PokemonGlobal.pcItemStorage=PCItemStorage.new + end + if $PokemonGlobal.pcItemStorage.empty? @@ -1976,1 +1979,4 @@ - if !$PokemonGlobal.pcItemStorage || $PokemonGlobal.pcItemStorage.empty? + if !$PokemonGlobal.pcItemStorage + $PokemonGlobal.pcItemStorage=PCItemStorage.new + end + if $PokemonGlobal.pcItemStorage.empty? Changed: Sprite_Timer @@ -19,1 +19,1 @@ - @timer=Window_SimpleTextPokemon.newWithSize("", + @timer=Window_AdvancedTextPokemon.newWithSize("", @@ -30,1 +30,1 @@ - @timer.text = _ISPRINTF("{1:02d}:{2:02d}", min, sec) + @timer.text = _ISPRINTF("{1:02d}:{2:02d}", min, sec) Changed: PokemonBugContest @@ -290,1 +290,1 @@ - @timer=Window_SimpleTextPokemon.newWithSize("",360,0,120,64) + @timer=Window_AdvancedTextPokemon.newWithSize("",360,0,120,64) @@ -311,1 +311,1 @@ - @timer.text = _ISPRINTF("{1:02d}:{2:02d}", min, sec) + @timer.text = _ISPRINTF("{1:02d}:{2:02d}", min, sec) Changed: TilemapXP Changed: PokemonMap Changed: PokemonMenu Changed: DrawText Changed: PokemonPhone Changed: PerspectiveTilemap Changed: PokemonField Changed: PokemonSave Changed: PokeBattle_ActualScene Changed: PokemonTrainers Changed: PokemonDuel Changed: PokemonLoad Changed: Main Changed: PokemonEntry Changed: Compiler Changed: RGSS2Compatibility Changed: PokemonMessages Changed: SpriteWindow Changed: PokemonSystem Changed: PokemonUtilities Changed: PokemonBag Changed: PokemonScreen Changed: PokemonStorage Changed: Sprite_Timer Changed: PokemonBugContest