Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Just add/replace the lines with "#edit" ("#edit end" denotes the end of an added section. add the section between that an the previous #edit)
- module EncounterTypes #edit
- EnctypeDay=[LandMorning,LandDay]
- EnctypeNight=[LandNight]
- EnctypeBoth=[Land,Cave,Water,RockSmash,OldRod,GoodRod,SuperRod,HeadbuttLow,HeadbuttHigh,BugContest]
- end
- def pbTimeEncounter(encounter,species)
- ret = 0
- return ret if !encounter
- allEnc=[]
- for i in 0...encounter.length
- next if !encounter[i]
- for j in 0...encounter[i].length
- allEnc.push(i) if encounter[i][j][0]==species
- end
- end
- allEnc|=[]
- allEnc.each{|enc|
- if !EncounterTypes::EnctypeBoth.include?(enc)
- if EncounterTypes::EnctypeDay.include?(enc)
- ret|=1
- end
- if EncounterTypes::EnctypeNight.include?(enc)
- ret|=2
- end
- else
- ret|=3
- end
- }
- return ret #3 is both, 2 is night, 1 is day
- end #edit end
- ################################################################################
- # Shows the "Nest" page of the Pokédex entry screen.
- ################################################################################
- class PokemonNestMapScene
- def pbStartScene(species,regionmap=-1)
- @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- @viewport.z=99999
- @sprites={}
- pbRgssOpen("Data/townmap.dat","rb"){|f|
- @mapdata=Marshal.load(f)
- }
- mappos=!$game_map ? nil : pbGetMetadata($game_map.map_id,MetadataMapPosition)
- region=regionmap
- if region<0 # Use player's current region
- region=mappos ? mappos[0] : 0 # Region 0 default
- end
- @sprites["background"]=IconSprite.new(0,0,@viewport)
- @sprites["background"].setBitmap(_INTL("Graphics/Pictures/pokedexNest"))
- @sprites["map"]=IconSprite.new(0,0,@viewport)
- @sprites["map"].setBitmap("Graphics/Pictures/#{@mapdata[region][1]}")
- @sprites["map"].x+=(Graphics.width-@sprites["map"].bitmap.width)/2
- @sprites["map"].y+=(Graphics.height-@sprites["map"].bitmap.height)/2
- for hidden in REGIONMAPEXTRAS
- if hidden[0]==region && hidden[1]>0 && $game_switches[hidden[1]]
- if !@sprites["map2"]
- @sprites["map2"]=BitmapSprite.new(480,320,@viewport)
- @sprites["map2"].x=@sprites["map"].x; @sprites["map2"].y=@sprites["map"].y
- end
- pbDrawImagePositions(@sprites["map2"].bitmap,[
- ["Graphics/Pictures/#{hidden[4]}",
- hidden[2]*PokemonRegionMapScene::SQUAREWIDTH,
- hidden[3]*PokemonRegionMapScene::SQUAREHEIGHT,0,0,-1,-1]
- ])
- end
- end
- @point=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
- PokemonRegionMapScene::SQUAREHEIGHT+4)
- @point.fill_rect(0,0,
- PokemonRegionMapScene::SQUAREWIDTH+4,
- PokemonRegionMapScene::SQUAREHEIGHT+4,Color.new(255,0,0))
- @point2=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
- PokemonRegionMapScene::SQUAREHEIGHT+4)
- @point2.fill_rect(4,0,
- PokemonRegionMapScene::SQUAREWIDTH,
- PokemonRegionMapScene::SQUAREHEIGHT+4,Color.new(255,0,0))
- @point3=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
- PokemonRegionMapScene::SQUAREHEIGHT+4)
- @point3.fill_rect(0,4,
- PokemonRegionMapScene::SQUAREWIDTH+4,
- PokemonRegionMapScene::SQUAREHEIGHT,Color.new(255,0,0))
- @point4=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
- PokemonRegionMapScene::SQUAREHEIGHT+4)
- @point4.fill_rect(4,4,
- PokemonRegionMapScene::SQUAREWIDTH,
- PokemonRegionMapScene::SQUAREHEIGHT,Color.new(255,0,0))
- encdata=load_data("Data/encounters.dat")
- points=[]
- mapwidth=1+PokemonRegionMapScene::RIGHT-PokemonRegionMapScene::LEFT
- for enc in encdata.keys
- enctypes=encdata[enc][1]
- if pbFindEncounter(enctypes,species)
- mappos=pbGetMetadata(enc,MetadataMapPosition)
- mapcolor=[0,0,0] #edit
- case pbTimeEncounter(enctypes,species)
- when 1
- mapcolor=[255,0,0]
- when 2
- mapcolor=[0,255,0]
- when 3
- mapcolor=[0,0,255]
- end #edit end
- if mappos && mappos[0]==region
- showpoint=true
- for loc in @mapdata[region][2]
- showpoint=false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
- loc[7] && !$game_switches[loc[7]]
- end
- if showpoint
- mapsize=pbGetMetadata(enc,MetadataMapSize)
- if mapsize && mapsize[0] && mapsize[0]>0
- sqwidth=mapsize[0]
- sqheight=(mapsize[1].length*1.0/mapsize[0]).ceil
- for i in 0...sqwidth
- for j in 0...sqheight
- if mapsize[1][i+j*sqwidth,1].to_i>0
- points[mappos[1]+i+(mappos[2]+j)*mapwidth]=[true,mapcolor] #edit
- end
- end
- end
- else
- points[mappos[1]+mappos[2]*mapwidth]=[true,mapcolor] #edit
- end
- end
- end
- end
- end
- i=0
- for j in 0...points.length
- if points[j] && points[j][0] #edit
- s=SpriteWrapper.new(@viewport)
- s.x=(j%mapwidth)*PokemonRegionMapScene::SQUAREWIDTH-2
- s.x+=(Graphics.width-@sprites["map"].bitmap.width)/2
- s.y=(j/mapwidth)*PokemonRegionMapScene::SQUAREHEIGHT-2
- s.y+=(Graphics.height-@sprites["map"].bitmap.height)/2
- if j>=1 && points[j-1] && points[j-1][0] #edit
- if j>=mapwidth && points[j-mapwidth] && points[j-mapwidth][0] #edit
- s.bitmap=@point4
- else
- s.bitmap=@point2
- end
- else
- if j>=mapwidth && points[j-mapwidth] && points[j-mapwidth][0] #edit
- s.bitmap=@point3
- else
- s.bitmap=@point
- end
- end
- for x in 0 .. s.bitmap.width #edit
- for y in 0 .. s.bitmap.height
- color=s.bitmap.get_pixel(x,y)
- color.red=points[j][1][0]
- color.green=points[j][1][1]
- color.blue=points[j][1][2]
- s.bitmap.set_pixel(x,y,color)
- end
- end #edit end
- @sprites["point#{i}"]=s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement