Changed: PokemonMap @@ -273,0 +273,142 @@ + + +EVOTYPEMASK=0x3F +EVODATAMASK=0xC0 +EVONEXTFORM=0x00 +EVOPREVFORM=0x40 + +module EncounterTypes + Land=0 + Cave=1 + Water=2 + RockSmash=3 + OldRod=4 + GoodRod=5 + SuperRod=6 + HeadbuttLow=7 + HeadbuttHigh=8 + LandMorning=9 + LandDay=10 + LandNight=11 + BugContest=12 + Names=[ + "Land", + "Cave", + "Water", + "RockSmash", + "OldRod", + "GoodRod", + "SuperRod", + "HeadbuttLow", + "HeadbuttHigh", + "LandMorning", + "LandDay", + "LandNight", + "BugContest" + ] + EnctypeChances=[ + [20,20,10,10,10,10,5,5,4,4,1,1], + [20,20,10,10,10,10,5,5,4,4,1,1], + [60,30,5,4,1], + [60,30,5,4,1], + [70,30], + [60,20,20], + [40,40,15,4,1], + [30,25,20,10,5,5,4,1], + [30,25,20,10,5,5,4,1], + [20,20,10,10,10,10,5,5,4,4,1,1], + [20,20,10,10,10,10,5,5,4,4,1,1], + [20,20,10,10,10,10,5,5,4,4,1,1], + [20,20,10,10,10,10,5,5,4,4,1,1] + ] +end + + +module PBNatures +HARDY=0 +LONELY=1 +BRAVE=2 +ADAMANT=3 +NAUGHTY=4 +BOLD=5 +DOCILE=6 +RELAXED=7 +IMPISH=8 +LAX=9 +TIMID=10 +HASTY=11 +SERIOUS=12 +JOLLY=13 +NAIVE=14 +MODEST=15 +MILD=16 +QUIET=17 +BASHFUL=18 +RASH=19 +CALM=20 +GENTLE=21 +SASSY=22 +CAREFUL=23 +QUIRKY=24 + +def PBNatures.getName(id) +names=[ +_INTL("HARDY"), +_INTL("LONELY"), +_INTL("BRAVE"), +_INTL("ADAMANT"), +_INTL("NAUGHTY"), +_INTL("BOLD"), +_INTL("DOCILE"), +_INTL("RELAXED"), +_INTL("IMPISH"), +_INTL("LAX"), +_INTL("TIMID"), +_INTL("HASTY"), +_INTL("SERIOUS"), +_INTL("JOLLY"), +_INTL("NAIVE"), +_INTL("MODEST"), +_INTL("MILD"), +_INTL("QUIET"), +_INTL("BASHFUL"), +_INTL("RASH"), +_INTL("CALM"), +_INTL("GENTLE"), +_INTL("SASSY"), +_INTL("CAREFUL"), +_INTL("QUIRKY") +] +return names[id] +end + +end + +class PhoneDatabase + attr_accessor :generics + attr_accessor :greetings + attr_accessor :greetingsMorning + attr_accessor :greetingsEvening + attr_accessor :battleRequests + attr_accessor :bodies1 + attr_accessor :bodies2 + attr_accessor :trainers + def initialize + @generics=[] + @greetings=[] + @greetingsMorning=[] + @greetingsEvening=[] + @battleRequests=[] + @bodies1=[] + @bodies2=[] + @trainers=[] + end +end + +module PhoneMsgType + Generic=0 + Greeting=1 + Body=2 + BattleRequest=3 +end + Changed: StringIO @@ -1,0 +1,1 @@ +#31931740 Changed: PokemonAnimEditor @@ -1832,0 +1832,49 @@ +def getCubicPoint(src,t) + x0=src[0].x; + y0=src[0].y; + cx0=src[1].x; + cy0=src[1].y; + cx1=src[2].x; + cy1=src[2].y; + x1=src[3].x; + y1=src[3].y; + x1=cx1+(x1-cx1)*t; + y1=cy1+(y1-cy1)*t; + x0=x0+(cx0-x0)*t; + y0=y0+(cy0-y0)*t; + cx0=cx0+(cx1-cx0)*t; + cy0=cy0+(cy1-cy0)*t; + cx1=cx0+(x1-cx0)*t; + cy1=cy0+(y1-cy0)*t; + cx0=x0+(cx0-x0)*t; + cy0=y0+(cy0-y0)*t; + cx=cx0+(cx1-cx0)*t; + cy=cy0+(cy1-cy0)*t; + return [cx,cy] +end + +def getCubicPoint2(src,t) + x0=src[0]; + y0=src[1]; + cx0=src[2]; + cy0=src[3]; + cx1=src[4]; + cy1=src[5]; + x1=src[6]; + y1=src[7]; + x1=cx1+(x1-cx1)*t; + y1=cy1+(y1-cy1)*t; + x0=x0+(cx0-x0)*t; + y0=y0+(cy0-y0)*t; + cx0=cx0+(cx1-cx0)*t; + cy0=cy0+(cy1-cy0)*t; + cx1=cx0+(x1-cx0)*t; + cy1=cy0+(y1-cy0)*t; + cx0=x0+(cx0-x0)*t; + cy0=y0+(cy0-y0)*t; + cx=cx0+(cx1-cx0)*t; + cy=cy0+(cy1-cy0)*t; + return [cx,cy] +end + + @@ -1884,0 +1933,3 @@ + File.open("pointpath.txt","wb"){|f| + f.write(path.inspect) + } @@ -2475,1 +2527,5 @@ - return @points.inspect + p=[] + for point in @points + p.push([point[0].to_i,point[1].to_i]) + end + return p.inspect Added: RTPAndRegistry Changed: PBIntl @@ -198,1 +198,1 @@ - key=section[i] # key is already normalized + key=MessageTypes.denormalizeValue(section[i]) @@ -309,1 +309,1 @@ - if value[/[\r\n\t]/] + if value[/[\r\n\t]|^[\[\]]/] @@ -314,0 +314,2 @@ + ret.gsub!(/\[/,"<<[>>") + ret.gsub!(/\]/,"<<]>>") @@ -319,1 +321,1 @@ - if value[/<<[rnt]>>/] + if value[/<<[rnt\[\]]>>/] @@ -323,0 +325,2 @@ + ret.gsub!(/<<\[>>/,"[") + ret.gsub!(/<<\]>>/,"]") @@ -345,0 +349,1 @@ + valkey=self.normalizeValue(key) @@ -346,1 +351,1 @@ - f.write(key+"\r\n") + f.write(valkey+"\r\n") Deleted: RTP and Registry Changed: PokemonPhone @@ -1,27 +1,1 @@ -class PhoneDatabase - attr_accessor :generics - attr_accessor :greetings - attr_accessor :greetingsMorning - attr_accessor :greetingsEvening - attr_accessor :battleRequests - attr_accessor :bodies1 - attr_accessor :bodies2 - attr_accessor :trainers - def initialize - @generics=[] - @greetings=[] - @greetingsMorning=[] - @greetingsEvening=[] - @battleRequests=[] - @bodies1=[] - @bodies2=[] - @trainers=[] - end -end - -module PhoneMsgType - Generic=0 - Greeting=1 - Body=2 - BattleRequest=3 -end + @@ -125,34 +99,0 @@ -end - -def pbEachSection(f) - lineno=1 - havesection=false - sectionname=nil - lastsection=[] - 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*$/] - if line[/^\s*\[\s*(.+?)\s*\]\s*$/] - if havesection - yield lastsection,sectionname - end - sectionname=$~[1] - lastsection=[] - havesection=true - else - if sectionname==nil - raise _INTL("Expected a section at the beginning of the file (line {1})",lineno) - end - lastsection.push(line.gsub(/^\s+/,"").gsub(/\s+$/,"")) - end - end - lineno+=1 - if lineno%500==0 - Graphics.update - end - } - if havesection - yield lastsection,sectionname - end Changed: EventScene @@ -425,5 +425,5 @@ - LowerRight=5 - Top=6 - Bottom=7 - Left=8 - Right=9 + LowerRight=4 + Top=5 + Bottom=6 + Left=7 + Right=8 Changed: PokeBattle_ActualScene @@ -955,2 +955,2 @@ - @sprites["player"].x-=8 - @sprites["playerB"].x-=8 if @sprites["playerB"] + @sprites["player"].x-=6 + @sprites["playerB"].x-=6 if @sprites["playerB"] @@ -967,2 +967,28 @@ - pawidth=(pa && pa.bitmap && !pa.bitmap.disposed?) ? pa.bitmap.width : 128 - pbwidth=(pb && pb.bitmap && !pb.bitmap.disposed?) ? pb.bitmap.width : 128 + pawidth=128 + pbwidth=128 + if (pa && pa.bitmap && !pa.bitmap.disposed?) + if pa.bitmap.height0 + @sprites["player"].src_rect.x=pawidth*2 if @frame>10 + @sprites["player"].src_rect.x=pawidth*3 if @frame>13 + @sprites["player"].src_rect.width=pawidth + else + pawidth=pa.bitmap.width + @sprites["player"].src_rect.x=0 + @sprites["player"].src_rect.width=pawidth + end + end + if (pb && pb.bitmap && !pb.bitmap.disposed?) + if pb.bitmap.height0 + @sprites["playerB"].src_rect.x=pbwidth*2 if @frame>10 + @sprites["playerB"].src_rect.x=pbwidth*3 if @frame>13 + @sprites["playerB"].src_rect.width=pbwidth + else + pbwidth=pb.bitmap.width + @sprites["playerB"].src_rect.x=0 + @sprites["playerB"].src_rect.width=pbwidth + end + end @@ -1362,0 +1388,12 @@ + if @sprites["player"].bitmap + if @sprites["player"].bitmap.width>@sprites["player"].bitmap.height + @sprites["player"].src_rect.x=0 + @sprites["player"].src_rect.width=@sprites["player"].bitmap.width/4 + end + end + if @sprites["playerB"].bitmap + if @sprites["playerB"].bitmap.width>@sprites["playerB"].bitmap.height + @sprites["playerB"].src_rect.x=0 + @sprites["playerB"].src_rect.width=@sprites["playerB"].bitmap.width/4 + end + end @@ -1365,0 +1403,6 @@ + if @sprites["player"].bitmap + if @sprites["player"].bitmap.width>@sprites["player"].bitmap.height + @sprites["player"].src_rect.x=0 + @sprites["player"].src_rect.width=@sprites["player"].bitmap.width/4 + end + end @@ -1583,0 +1627,26 @@ +balltype=pkmn.ballused +ballbitmap=sprintf("Graphics/Pictures/ball%02d_0.png",balltype) +pictureBall=PictureEx.new(0) +delay=1 +pictureBall.moveVisible(delay,true) +pictureBall.moveName(delay,ballbitmap) +pictureBall.moveOrigin(delay,PictureOrigin::Center) +# Setting the ball's movement path +path=[[111, 164], [112, 156], [114, 148], [116, 140], +[118, 133], [121, 125], [124, 118], [130, 113], +[136, 117], [139, 124], [140, 132], [141, 140], +[142, 147], [143, 155], [144, 163], [144, 171], +[145, 179], [145, 187], [146, 195], [146, 203], +[146, 211], [146, 219], [147, 227], [147, 235], +[147, 243], [147, 251], [147, 251]] +spriteBall=IconSprite.new(0,0,@viewport) +spriteBall.visible=false +angle=0 +for coord in path + delay=pictureBall.totalDuration + pictureBall.moveAngle(0,delay,angle) + pictureBall.moveXY(1,delay,coord[0],coord[1]) + angle+=80 + angle%=360 +end + @sprites["battler#{battlerindex}"].visible=false @@ -1597,2 +1667,3 @@ - frame+=1 - if frame==1 + frame+=1 + if frame>1 && !pictureBall.running? && + !@sprites["battler#{battlerindex}"].appearing @@ -1601,1 +1672,1 @@ - if frame>=3 + if frame>=3 && !pictureBall.running? @@ -1603,0 +1674,4 @@ + end + if (frame>=10 || !fadeanim) && pictureBall.running? + pictureBall.update + setPictureIconSprite(spriteBall,pictureBall) Changed: SpriteResizer @@ -11,2 +11,2 @@ - @width=480 - @height=320 + @@width=480 + @@height=320 @@ -14,1 +14,1 @@ - return @width + return @@width.to_i @@ -17,1 +17,1 @@ - return @height + return @@height.to_i @@ -55,9 +55,14 @@ - if !method_defined?(:oldresizescreen) - begin - alias oldresizescreen resize_screen - @@haveresizescreen=true - rescue - @@haveresizescreen=false - end - else - @@haveresizescreen=false + begin + x=@@haveresizescreen + rescue NameError # If exception is caught, + # the class variable wasn't defined yet + if !method_defined?(:oldresizescreen) + begin + alias oldresizescreen resize_screen + @@haveresizescreen=true + rescue + @@haveresizescreen=false + end + else + @@haveresizescreen=false + end @@ -70,2 +75,2 @@ - @width=w - @height=h + @@width=w + @@height=h @@ -333,0 +338,1 @@ + return if !val @@ -340,0 +346,1 @@ + return if !val @@ -347,4 +354,6 @@ - newRect=NotifiableRect.new(0,0,100,100) - newRect.setNotifyProc(@resizedRectProc) - newRect.set(val.x.to_i,val.y.to_i,val.width.to_i,val.height.to_i) - @resizedRect=newRect + if val + newRect=NotifiableRect.new(0,0,100,100) + newRect.setNotifyProc(@resizedRectProc) + newRect.set(val.x.to_i,val.y.to_i,val.width.to_i,val.height.to_i) + @resizedRect=newRect + end @@ -376,0 +385,1 @@ + return if !val @@ -383,0 +393,1 @@ + return if !val @@ -390,0 +401,1 @@ + return if !val @@ -397,0 +409,1 @@ + return if !val Changed: Transitions @@ -344,1 +344,1 @@ - bands.times { |i| + bands.to_i.times { |i| Changed: WindowAndTilemap @@ -1135,0 +1135,2 @@ + xpos=(x<<5)-@oxLayer0 + ypos=(y<<5)-@oyLayer0 @@ -1138,1 +1140,3 @@ - temprect.set(((id - 384)&7)<<5,((id - 384)>>3)<<5,32,32) + temprect.set(((id - 384)&7)<<5,((id - 384)>>3)<<5,32,32) + xpos=(x<<5)-@oxLayer0 + ypos=(y<<5)-@oyLayer0 @@ -1149,0 +1153,2 @@ + xpos=(x<<5)-@oxLayer0 + ypos=(y<<5)-@oyLayer0 Changed: Compiler @@ -533,1 +533,0 @@ - echo name+"\r\n" @@ -2008,0 +2007,36 @@ +end + + + +def pbEachSection(f) + lineno=1 + havesection=false + sectionname=nil + lastsection=[] + 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*$/] + if line[/^\s*\[\s*(.+?)\s*\]\s*$/] + if havesection + yield lastsection,sectionname + end + sectionname=$~[1] + lastsection=[] + havesection=true + else + if sectionname==nil + raise _INTL("Expected a section at the beginning of the file (line {1})",lineno) + end + lastsection.push(line.gsub(/^\s+/,"").gsub(/\s+$/,"")) + end + end + lineno+=1 + if lineno%500==0 + Graphics.update + end + } + if havesection + yield lastsection,sectionname + end Changed: TileDrawingHelper @@ -1,130 +1,130 @@ -class TileDrawingHelper - Autotiles = [ - [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34], - [27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ], - [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34], - [27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ], - [ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12], - [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ], - [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36], - [39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ], - [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12], - [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ], - [ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44], - [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ] - ] - - # converts neighbors returned from tableNeighbors to tile indexes - NeighborsToTiles=[ - 46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, - 42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, - 46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, - 42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, - 45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29, - 37, 27, 37, 27, 23, 15, 23, 13, 37, 27, 37, 27, 22, 11, 22, 9, - 45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29, - 36, 26, 36, 26, 21, 7, 21, 5, 36, 26, 36, 26, 20, 3, 20, 1, 46, - 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, 42, - 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, 46, - 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, 42, - 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, 45, - 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28, 37, - 25, 37, 25, 23, 14, 23, 12, 37, 25, 37, 25, 22, 10, 22, 8, 45, - 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28, 36, - 24, 36, 24, 21, 6, 21, 4, 36, 24, 36, 24, 20, 2, 20, 0 - ] - def self.tableNeighbors(data,x,y) - return 0 if x>=data.xsize || x<0 - return 0 if y>=data.ysize || y<0 - t=data[x,y] - xp1=[x+1,data.xsize-1].min - yp1=[y+1,data.ysize-1].min - xm1=[x-1,0].max - ym1=[y-1,0].max - i=0 - i|=0x01 if data[x ,ym1]==t # N - i|=0x02 if data[xp1,ym1]==t # NE - i|=0x04 if data[xp1,y ]==t # E - i|=0x08 if data[xp1,yp1]==t # SE - i|=0x10 if data[x ,yp1]==t # S - i|=0x20 if data[xm1,yp1]==t # SW - i|=0x40 if data[xm1,y ]==t # W - i|=0x80 if data[xm1,ym1]==t # NW - return i - end - - -attr_accessor :tileset -attr_accessor :autotiles - -def initialize(tileset,autotiles) - @tileset=tileset - @autotiles=autotiles -end - -def self.fromTileset(tileset) - bmtileset=RPG::Cache.tileset(tileset.tileset_name) - bmautotiles=[] - for i in 0...7 - bmautotiles.push(RPG::Cache.autotile(tileset.autotile_names[i])) - end - return self.new(bmtileset,bmautotiles) -end - -def bltSmallAutotile(bitmap,x,y,cxTile,cyTile,id,frame) - return if frame<0 || !@autotiles || id>=384 - autotile=@autotiles[id/48-1] - return if !autotile || autotile.disposed? - cxTile=[cxTile/2,1].max - cyTile=[cyTile/2,1].max - 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(bitmap,x,y,cxTile,cyTile,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,cxTile,cyTile),@tileset,rect) -end - -def bltSmallTile(bitmap,x,y,cxTile,cyTile,id,frame=0) - if id>=384 - bltSmallRegularTile(bitmap,x,y,cxTile,cyTile,id) - elsif id>0 - bltSmallAutotile(bitmap,x,y,cxTile,cyTile,id,frame) - end -end - -def bltAutotile(bitmap,x,y,id,frame) - bltSmallAutotile(bitmap,x,y,32,32,id,frame) -end - -def bltRegularTile(bitmap,x,y,id) - bltSmallRegularTile(bitmap,x,y,32,32,id) -end - -def bltTile(bitmap,x,y,id,frame=0) - if id>=384 - bltRegularTile(bitmap,x,y,id) - elsif id>0 - bltAutotile(bitmap,x,y,id,frame) - end -end - -end +class TileDrawingHelper + Autotiles = [ + [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34], + [27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ], + [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34], + [27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ], + [ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12], + [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ], + [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36], + [39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ], + [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12], + [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ], + [ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44], + [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ] + ] + + # converts neighbors returned from tableNeighbors to tile indexes + NeighborsToTiles=[ + 46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, + 42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, + 46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, + 42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, + 45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29, + 37, 27, 37, 27, 23, 15, 23, 13, 37, 27, 37, 27, 22, 11, 22, 9, + 45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29, + 36, 26, 36, 26, 21, 7, 21, 5, 36, 26, 36, 26, 20, 3, 20, 1, 46, + 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, 42, + 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, 46, + 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, 42, + 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, 45, + 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28, 37, + 25, 37, 25, 23, 14, 23, 12, 37, 25, 37, 25, 22, 10, 22, 8, 45, + 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28, 36, + 24, 36, 24, 21, 6, 21, 4, 36, 24, 36, 24, 20, 2, 20, 0 + ] + def self.tableNeighbors(data,x,y) + return 0 if x>=data.xsize || x<0 + return 0 if y>=data.ysize || y<0 + t=data[x,y] + xp1=[x+1,data.xsize-1].min + yp1=[y+1,data.ysize-1].min + xm1=[x-1,0].max + ym1=[y-1,0].max + i=0 + i|=0x01 if data[x ,ym1]==t # N + i|=0x02 if data[xp1,ym1]==t # NE + i|=0x04 if data[xp1,y ]==t # E + i|=0x08 if data[xp1,yp1]==t # SE + i|=0x10 if data[x ,yp1]==t # S + i|=0x20 if data[xm1,yp1]==t # SW + i|=0x40 if data[xm1,y ]==t # W + i|=0x80 if data[xm1,ym1]==t # NW + return i + end + + +attr_accessor :tileset +attr_accessor :autotiles + +def initialize(tileset,autotiles) + @tileset=tileset + @autotiles=autotiles +end + +def self.fromTileset(tileset) + bmtileset=RPG::Cache.tileset(tileset.tileset_name) + bmautotiles=[] + for i in 0...7 + bmautotiles.push(RPG::Cache.autotile(tileset.autotile_names[i])) + end + return self.new(bmtileset,bmautotiles) +end + +def bltSmallAutotile(bitmap,x,y,cxTile,cyTile,id,frame) + return if frame<0 || !@autotiles || id>=384 + autotile=@autotiles[id/48-1] + return if !autotile || autotile.disposed? + cxTile=[cxTile/2,1].max + cyTile=[cyTile/2,1].max + 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(bitmap,x,y,cxTile,cyTile,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,cxTile,cyTile),@tileset,rect) +end + +def bltSmallTile(bitmap,x,y,cxTile,cyTile,id,frame=0) + if id>=384 + bltSmallRegularTile(bitmap,x,y,cxTile,cyTile,id) + elsif id>0 + bltSmallAutotile(bitmap,x,y,cxTile,cyTile,id,frame) + end +end + +def bltAutotile(bitmap,x,y,id,frame) + bltSmallAutotile(bitmap,x,y,32,32,id,frame) +end + +def bltRegularTile(bitmap,x,y,id) + bltSmallRegularTile(bitmap,x,y,32,32,id) +end + +def bltTile(bitmap,x,y,id,frame=0) + if id>=384 + bltRegularTile(bitmap,x,y,id) + elsif id>0 + bltAutotile(bitmap,x,y,id,frame) + end +end + +end Changed: PokeBattle_BattlePalace @@ -2,59 +2,0 @@ -module PBNatures -HARDY=0 -LONELY=1 -BRAVE=2 -ADAMANT=3 -NAUGHTY=4 -BOLD=5 -DOCILE=6 -RELAXED=7 -IMPISH=8 -LAX=9 -TIMID=10 -HASTY=11 -SERIOUS=12 -JOLLY=13 -NAIVE=14 -MODEST=15 -MILD=16 -QUIET=17 -BASHFUL=18 -RASH=19 -CALM=20 -GENTLE=21 -SASSY=22 -CAREFUL=23 -QUIRKY=24 - -def PBNatures.getName(id) -names=[ -_INTL("HARDY"), -_INTL("LONELY"), -_INTL("BRAVE"), -_INTL("ADAMANT"), -_INTL("NAUGHTY"), -_INTL("BOLD"), -_INTL("DOCILE"), -_INTL("RELAXED"), -_INTL("IMPISH"), -_INTL("LAX"), -_INTL("TIMID"), -_INTL("HASTY"), -_INTL("SERIOUS"), -_INTL("JOLLY"), -_INTL("NAIVE"), -_INTL("MODEST"), -_INTL("MILD"), -_INTL("QUIET"), -_INTL("BASHFUL"), -_INTL("RASH"), -_INTL("CALM"), -_INTL("GENTLE"), -_INTL("SASSY"), -_INTL("CAREFUL"), -_INTL("QUIRKY") -] -return names[id] -end - -end Changed: PokemonEvolution @@ -565,6 +565,0 @@ - -EVOTYPEMASK=0x3F -EVODATAMASK=0xC0 -EVONEXTFORM=0x00 -EVOPREVFORM=0x40 - Changed: Audio @@ -233,1 +233,1 @@ - AudioState::AudioContextSetVolume.call(AudioState.meContext,0) + AudioState::AudioContextStop.call(AudioState.meContext) Changed: PokemonEditor @@ -428,1 +428,1 @@ - for i in 0...PokemonEncounters::EnctypeChances.length + for i in 0...EncounterTypes::EnctypeChances.length @@ -453,1 +453,1 @@ - for i in 0...PokemonEncounters::EnctypeChances.length + for i in 0...EncounterTypes::EnctypeChances.length @@ -476,1 +476,1 @@ - chances=PokemonEncounters::EnctypeChances[ret] + chances=EncounterTypes::EnctypeChances[ret] @@ -489,1 +489,1 @@ - chances=PokemonEncounters::EnctypeChances[etype] + chances=EncounterTypes::EnctypeChances[etype] @@ -744,0 +744,12 @@ + def getPlayingBGM + $game_system ? $game_system.getPlayingBGM : nil + end + def bgm_play(bgm) + if $game_system && bgm + $game_system.bgm_play(bgm) + elsif bgm + Audio.bgm_play("Audio/BGM/"+bgm) + else + Audio.bgm_stop + end + end @@ -745,1 +757,1 @@ - @oldbgm=$game_system.getPlayingBGM + @oldbgm=getPlayingBGM @@ -777,1 +789,1 @@ - $game_system.bgm_play(@oldbgm) + bgm_play(@oldbgm) @@ -782,1 +794,1 @@ - $game_system.bgm_play(@commands[index]) + bgm_play(@commands[index]) @@ -784,1 +796,1 @@ - $game_system.bgm_play("../../Audio/ME/"+@commands[index]) + bgm_play("../../Audio/ME/"+@commands[index]) @@ -1462,0 +1474,25 @@ +# Returns the maps within _keys_ that are directly +# connected to this map, _map_. +def getDirectConnections(keys,map) + thissprite=getMapSprite(map) + thisdims=MapFactoryHelper.getMapDims(map) + ret=[] + for i in keys + next if i==map + othersprite=getMapSprite(i) + otherdims=MapFactoryHelper.getMapDims(i) + x1=(thissprite.x-othersprite.x)/4 + y1=(thissprite.y-othersprite.y)/4 + if(x1==otherdims[0] || x1==-thisdims[0] || + y1==otherdims[1] || y1==-thisdims[1]) + ret.push(i) + end + end + # If no direct connections, add an indirect connection + if ret.length==0 + key=(map==keys[0]) ? keys[1] : keys[0] + ret.push(key) + end + return ret +end + @@ -1464,0 +1501,1 @@ + # Create a clone of current map connection @@ -1469,0 +1507,2 @@ + # Remove all connections containing + # any sprites on the canvas from the array @@ -1472,0 +1512,1 @@ + # Rebuild connections @@ -1473,11 +1514,13 @@ - refmap=(i==keys[0]) ? keys[1] : keys[0] - othersprite=getMapSprite(i) - refsprite=getMapSprite(refmap) - c1=(refsprite.x-othersprite.x)/4 - c2=(refsprite.y-othersprite.y)/4 - conn=[refmap,0,0,i,c1,c2] - i=0;while i0 + if $game_temp + return $game_temp.fadestate>0 + else + return false + end @@ -1404,1 +1412,1 @@ - return (@item_max + @column_max - 1) / @column_max + return ((@item_max + @column_max - 1) / @column_max).to_i @@ -1407,1 +1415,1 @@ - return @virtualOy / 32 + return (@virtualOy / 32).to_i @@ -1422,1 +1430,1 @@ - return priv_page_row_max + return priv_page_row_max.to_i @@ -1425,1 +1433,1 @@ - return priv_page_item_max + return priv_page_item_max.to_i Changed: PokemonUtilities @@ -1009,0 +1009,1 @@ + @@ -1019,6 +1020,4 @@ -#pbPlayBattleFromFile(filename) -#pbWildBattle(PBSpecies::DUSKULL,20) - -end - -pbTestBattle(0) +pbPlayBattleFromFile(filename) +pbWildBattle(PBSpecies::DUSKULL,20) +end +#pbTestBattle(169) Changed: PokemonRegionMap @@ -53,0 +53,5 @@ +LEFT=0 +TOP=0 +RIGHT=28 +BOTTOM=16 + @@ -64,2 +69,2 @@ - @mapX=0 - @mapY=0 + @mapX=LEFT + @mapY=TOP @@ -163,2 +168,2 @@ - oy=1 if @mapY<=16 - ox=-1 if @mapX>0 + oy=1 if @mapY<=BOTTOM + ox=-1 if @mapX>LEFT @@ -166,1 +171,1 @@ - oy=1 if @mapY<=16 + oy=1 if @mapY<=BOTTOM @@ -168,2 +173,2 @@ - oy=1 if @mapY<=16 - ox=1 if @mapX<=28 + oy=1 if @mapY<=BOTTOM + ox=1 if @mapX<=RIGHT @@ -171,1 +176,1 @@ - ox=-1 if @mapX>0 + ox=-1 if @mapX>LEFT @@ -173,1 +178,1 @@ - ox=1 if @mapX<=28 + ox=1 if @mapX<=RIGHT @@ -175,2 +180,2 @@ - oy=-1 if @mapY>0 - ox=-1 if @mapX>0 + oy=-1 if @mapY>TOP + ox=-1 if @mapX>LEFT @@ -178,1 +183,1 @@ - oy=-1 if @mapY>0 + oy=-1 if @mapY>TOP @@ -180,2 +185,2 @@ - oy=-1 if @mapY>0 - ox=1 if @mapX<=28 + oy=-1 if @mapY>TOP + ox=1 if @mapX<=RIGHT Changed: PokemonEncounters @@ -2,30 +2,0 @@ -module EncounterTypes - Land=0 - Cave=1 - Water=2 - RockSmash=3 - OldRod=4 - GoodRod=5 - SuperRod=6 - HeadbuttLow=7 - HeadbuttHigh=8 - LandMorning=9 - LandDay=10 - LandNight=11 - BugContest=12 - Names=[ - "Land", - "Cave", - "Water", - "RockSmash", - "OldRod", - "GoodRod", - "SuperRod", - "HeadbuttLow", - "HeadbuttHigh", - "LandMorning", - "LandDay", - "LandNight", - "BugContest" - ] -end @@ -34,15 +4,0 @@ - EnctypeChances=[ - [20,20,10,10,10,10,5,5,4,4,1,1], - [20,20,10,10,10,10,5,5,4,4,1,1], - [60,30,5,4,1], - [60,30,5,4,1], - [70,30], - [60,20,20], - [40,40,15,4,1], - [30,25,20,10,5,5,4,1], - [30,25,20,10,5,5,4,1], - [20,20,10,10,10,10,5,5,4,4,1,1], - [20,20,10,10,10,10,5,5,4,4,1,1], - [20,20,10,10,10,10,5,5,4,4,1,1], - [20,20,10,10,10,10,5,5,4,4,1,1] - ] @@ -98,1 +53,1 @@ - if enctype<0 || enctype>EnctypeChances.length + if enctype<0 || enctype>EncounterTypes::EnctypeChances.length @@ -108,1 +63,1 @@ - chances=EnctypeChances[enctype] + chances=EncounterTypes::EnctypeChances[enctype] @@ -124,1 +79,1 @@ - if enctype<0 || enctype>EnctypeChances.length + if enctype<0 || enctype>EncounterTypes::EnctypeChances.length @@ -128,1 +83,1 @@ - chances=EnctypeChances[enctype] + chances=EncounterTypes::EnctypeChances[enctype] @@ -145,1 +100,1 @@ - if enctype<0 || enctype>EnctypeChances.length + if enctype<0 || enctype>EncounterTypes::EnctypeChances.length Changed: PokemonDebug @@ -173,1 +173,1 @@ - for k in 0...PokemonEncounters::EnctypeChances[j].length + for k in 0...EncounterTypes::EnctypeChances[j].length @@ -741,0 +741,29 @@ +end + +def pbExtractText + msgwindow=Kernel.pbCreateMessageWindow + Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Please wait."),-1,0) + MessageTypes.extract("intl.txt") + Kernel.pbDisplayMessageFancy(msgwindow, + _INTL("All text in the game was extracted and saved to intl.txt.\1")) + Kernel.pbDisplayMessageFancy(msgwindow, + _INTL("To localize the text for a particular language, translate every second line in the file.\1")) + Kernel.pbDisplayMessageFancy(msgwindow, + _INTL("After translating, choose \"Compile Text.\"")) + Kernel.pbDisposeMessageWindow(msgwindow) +end + +def pbCompileTextUI + msgwindow=Kernel.pbCreateMessageWindow + Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Please wait."),-1,0) + begin + pbCompileText + Kernel.pbDisplayMessageFancy(msgwindow, + _INTL("Successfully compiled text and saved it to intl.dat.")) + Kernel.pbDisplayMessageFancy(msgwindow, + _INTL("To use the file in a game, add the text \"pbLoadMessages(X)\" to a script in the project, where X is the filename (such as \"intl.dat\").")) + rescue RuntimeError + Kernel.pbDisplayMessageFancy(msgwindow, + _INTL("Failed to compile text: {1}",$!.message)) + end + Kernel.pbDisposeMessageWindow(msgwindow) @@ -902,10 +931,1 @@ - msgwindow=Kernel.pbCreateMessageWindow - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Please wait."),-1,0) - MessageTypes.extract("intl.txt") - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("All text in the game was extracted and saved to intl.txt.\1")) - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("To localize the text for a particular language, translate every second line in the file.\1")) - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("After translating, choose \"Compile Text.\"")) - Kernel.pbDisposeMessageWindow(msgwindow) + pbExtractText @@ -913,13 +933,1 @@ - msgwindow=Kernel.pbCreateMessageWindow - Kernel.pbDisplayMessageFancy(msgwindow,_INTL("Please wait."),-1,0) - begin - pbCompileText - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("Successfully compiled text and saved it to intl.dat.")) - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("To use the file in a game, use pbLoadMessages(X) where X is the filename.")) - rescue RuntimeError - Kernel.pbDisplayMessageFancy(msgwindow, - _INTL("Failed to compile text: {1}",$!.message)) - end - Kernel.pbDisposeMessageWindow(msgwindow) + pbCompileTextUI Changed: RandomMaps @@ -1,131 +1,0 @@ -class TileDrawingHelper - Autotiles = [ - [ [27, 28, 33, 34], [ 5, 28, 33, 34], [27, 6, 33, 34], [ 5, 6, 33, 34], - [27, 28, 33, 12], [ 5, 28, 33, 12], [27, 6, 33, 12], [ 5, 6, 33, 12] ], - [ [27, 28, 11, 34], [ 5, 28, 11, 34], [27, 6, 11, 34], [ 5, 6, 11, 34], - [27, 28, 11, 12], [ 5, 28, 11, 12], [27, 6, 11, 12], [ 5, 6, 11, 12] ], - [ [25, 26, 31, 32], [25, 6, 31, 32], [25, 26, 31, 12], [25, 6, 31, 12], - [15, 16, 21, 22], [15, 16, 21, 12], [15, 16, 11, 22], [15, 16, 11, 12] ], - [ [29, 30, 35, 36], [29, 30, 11, 36], [ 5, 30, 35, 36], [ 5, 30, 11, 36], - [39, 40, 45, 46], [ 5, 40, 45, 46], [39, 6, 45, 46], [ 5, 6, 45, 46] ], - [ [25, 30, 31, 36], [15, 16, 45, 46], [13, 14, 19, 20], [13, 14, 19, 12], - [17, 18, 23, 24], [17, 18, 11, 24], [41, 42, 47, 48], [ 5, 42, 47, 48] ], - [ [37, 38, 43, 44], [37, 6, 43, 44], [13, 18, 19, 24], [13, 14, 43, 44], - [37, 42, 43, 48], [17, 18, 47, 48], [13, 18, 43, 48], [ 1, 2, 7, 8] ] - ] - - # converts neighbors returned from tableNeighbors to tile indexes - NeighborsToTiles=[ - 46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, - 42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, - 46, 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, - 42, 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, - 45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29, - 37, 27, 37, 27, 23, 15, 23, 13, 37, 27, 37, 27, 22, 11, 22, 9, - 45, 39, 45, 39, 33, 31, 33, 29, 45, 39, 45, 39, 33, 31, 33, 29, - 36, 26, 36, 26, 21, 7, 21, 5, 36, 26, 36, 26, 20, 3, 20, 1, 46, - 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, 42, - 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, 46, - 44, 46, 44, 43, 41, 43, 40, 46, 44, 46, 44, 43, 41, 43, 40, 42, - 32, 42, 32, 35, 19, 35, 18, 42, 32, 42, 32, 34, 17, 34, 16, 45, - 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28, 37, - 25, 37, 25, 23, 14, 23, 12, 37, 25, 37, 25, 22, 10, 22, 8, 45, - 38, 45, 38, 33, 30, 33, 28, 45, 38, 45, 38, 33, 30, 33, 28, 36, - 24, 36, 24, 21, 6, 21, 4, 36, 24, 36, 24, 20, 2, 20, 0 - ] - def self.tableNeighbors(data,x,y) - return 0 if x>=data.xsize || x<0 - return 0 if y>=data.ysize || y<0 - t=data[x,y] - xp1=[x+1,data.xsize-1].min - yp1=[y+1,data.ysize-1].min - xm1=[x-1,0].max - ym1=[y-1,0].max - i=0 - i|=0x01 if data[x ,ym1]==t # N - i|=0x02 if data[xp1,ym1]==t # NE - i|=0x04 if data[xp1,y ]==t # E - i|=0x08 if data[xp1,yp1]==t # SE - i|=0x10 if data[x ,yp1]==t # S - i|=0x20 if data[xm1,yp1]==t # SW - i|=0x40 if data[xm1,y ]==t # W - i|=0x80 if data[xm1,ym1]==t # NW - return i - end - - -attr_accessor :tileset -attr_accessor :autotiles - -def initialize(tileset,autotiles) - @tileset=tileset - @autotiles=autotiles -end - -def self.fromTileset(tileset) - bmtileset=RPG::Cache.tileset(tileset.tileset_name) - bmautotiles=[] - for i in 0...7 - bmautotiles.push(RPG::Cache.autotile(tileset.autotile_names[i])) - end - return self.new(bmtileset,bmautotiles) -end - -def bltSmallAutotile(bitmap,x,y,cxTile,cyTile,id,frame) - return if frame<0 || !@autotiles || id>=384 - autotile=@autotiles[id/48-1] - return if !autotile || autotile.disposed? - cxTile=[cxTile/2,1].max - cyTile=[cyTile/2,1].max - 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(bitmap,x,y,cxTile,cyTile,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,cxTile,cyTile),@tileset,rect) -end - -def bltSmallTile(bitmap,x,y,cxTile,cyTile,id,frame=0) - if id>=384 - bltSmallRegularTile(bitmap,x,y,cxTile,cyTile,id) - elsif id>0 - bltSmallAutotile(bitmap,x,y,cxTile,cyTile,id,frame) - end -end - -def bltAutotile(bitmap,x,y,id,frame) - bltSmallAutotile(bitmap,x,y,32,32,id,frame) -end - -def bltRegularTile(bitmap,x,y,id) - bltSmallRegularTile(bitmap,x,y,32,32,id) -end - -def bltTile(bitmap,x,y,id,frame=0) - if id>=384 - bltRegularTile(bitmap,x,y,id) - elsif id>0 - bltAutotile(bitmap,x,y,id,frame) - end -end - -end - Changed: PokemonMap Changed: StringIO Changed: PokemonAnimEditor Added: RTPAndRegistry Changed: PBIntl Deleted: RTP and Registry Changed: PokemonPhone Changed: EventScene Changed: PokeBattle_ActualScene Changed: SpriteResizer Changed: Transitions Changed: WindowAndTilemap Changed: Compiler Changed: TileDrawingHelper Changed: PokeBattle_BattlePalace Changed: PokemonEvolution Changed: Audio Changed: PokemonEditor Changed: PokemonMessages Changed: SpriteWindow Changed: PokemonUtilities Changed: PokemonRegionMap Changed: PokemonEncounters Changed: PokemonDebug Changed: RandomMaps