Advertisement
Vendily

Edits Nest Form Color-Time

Feb 15th, 2017
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. #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)
  2. module EncounterTypes #edit
  3. EnctypeDay=[LandMorning,LandDay]
  4. EnctypeNight=[LandNight]
  5. EnctypeBoth=[Land,Cave,Water,RockSmash,OldRod,GoodRod,SuperRod,HeadbuttLow,HeadbuttHigh,BugContest]
  6. end
  7.  
  8. def pbTimeEncounter(encounter,species)
  9. ret = 0
  10. return ret if !encounter
  11. allEnc=[]
  12. for i in 0...encounter.length
  13. next if !encounter[i]
  14. for j in 0...encounter[i].length
  15. allEnc.push(i) if encounter[i][j][0]==species
  16. end
  17. end
  18. allEnc|=[]
  19. allEnc.each{|enc|
  20. if !EncounterTypes::EnctypeBoth.include?(enc)
  21. if EncounterTypes::EnctypeDay.include?(enc)
  22. ret|=1
  23. end
  24. if EncounterTypes::EnctypeNight.include?(enc)
  25. ret|=2
  26. end
  27. else
  28. ret|=3
  29. end
  30. }
  31. return ret #3 is both, 2 is night, 1 is day
  32. end #edit end
  33.  
  34.  
  35. ################################################################################
  36. # Shows the "Nest" page of the Pokédex entry screen.
  37. ################################################################################
  38. class PokemonNestMapScene
  39. def pbStartScene(species,regionmap=-1)
  40. @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  41. @viewport.z=99999
  42. @sprites={}
  43. pbRgssOpen("Data/townmap.dat","rb"){|f|
  44. @mapdata=Marshal.load(f)
  45. }
  46. mappos=!$game_map ? nil : pbGetMetadata($game_map.map_id,MetadataMapPosition)
  47. region=regionmap
  48. if region<0 # Use player's current region
  49. region=mappos ? mappos[0] : 0 # Region 0 default
  50. end
  51. @sprites["background"]=IconSprite.new(0,0,@viewport)
  52. @sprites["background"].setBitmap(_INTL("Graphics/Pictures/pokedexNest"))
  53. @sprites["map"]=IconSprite.new(0,0,@viewport)
  54. @sprites["map"].setBitmap("Graphics/Pictures/#{@mapdata[region][1]}")
  55. @sprites["map"].x+=(Graphics.width-@sprites["map"].bitmap.width)/2
  56. @sprites["map"].y+=(Graphics.height-@sprites["map"].bitmap.height)/2
  57. for hidden in REGIONMAPEXTRAS
  58. if hidden[0]==region && hidden[1]>0 && $game_switches[hidden[1]]
  59. if !@sprites["map2"]
  60. @sprites["map2"]=BitmapSprite.new(480,320,@viewport)
  61. @sprites["map2"].x=@sprites["map"].x; @sprites["map2"].y=@sprites["map"].y
  62. end
  63. pbDrawImagePositions(@sprites["map2"].bitmap,[
  64. ["Graphics/Pictures/#{hidden[4]}",
  65. hidden[2]*PokemonRegionMapScene::SQUAREWIDTH,
  66. hidden[3]*PokemonRegionMapScene::SQUAREHEIGHT,0,0,-1,-1]
  67. ])
  68. end
  69. end
  70. @point=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
  71. PokemonRegionMapScene::SQUAREHEIGHT+4)
  72. @point.fill_rect(0,0,
  73. PokemonRegionMapScene::SQUAREWIDTH+4,
  74. PokemonRegionMapScene::SQUAREHEIGHT+4,Color.new(255,0,0))
  75. @point2=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
  76. PokemonRegionMapScene::SQUAREHEIGHT+4)
  77. @point2.fill_rect(4,0,
  78. PokemonRegionMapScene::SQUAREWIDTH,
  79. PokemonRegionMapScene::SQUAREHEIGHT+4,Color.new(255,0,0))
  80. @point3=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
  81. PokemonRegionMapScene::SQUAREHEIGHT+4)
  82. @point3.fill_rect(0,4,
  83. PokemonRegionMapScene::SQUAREWIDTH+4,
  84. PokemonRegionMapScene::SQUAREHEIGHT,Color.new(255,0,0))
  85. @point4=BitmapWrapper.new(PokemonRegionMapScene::SQUAREWIDTH+4,
  86. PokemonRegionMapScene::SQUAREHEIGHT+4)
  87. @point4.fill_rect(4,4,
  88. PokemonRegionMapScene::SQUAREWIDTH,
  89. PokemonRegionMapScene::SQUAREHEIGHT,Color.new(255,0,0))
  90. encdata=load_data("Data/encounters.dat")
  91. points=[]
  92. mapwidth=1+PokemonRegionMapScene::RIGHT-PokemonRegionMapScene::LEFT
  93. for enc in encdata.keys
  94. enctypes=encdata[enc][1]
  95. if pbFindEncounter(enctypes,species)
  96. mappos=pbGetMetadata(enc,MetadataMapPosition)
  97. mapcolor=[0,0,0] #edit
  98. case pbTimeEncounter(enctypes,species)
  99. when 1
  100. mapcolor=[255,0,0]
  101. when 2
  102. mapcolor=[0,255,0]
  103. when 3
  104. mapcolor=[0,0,255]
  105. end #edit end
  106. if mappos && mappos[0]==region
  107. showpoint=true
  108. for loc in @mapdata[region][2]
  109. showpoint=false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
  110. loc[7] && !$game_switches[loc[7]]
  111. end
  112. if showpoint
  113. mapsize=pbGetMetadata(enc,MetadataMapSize)
  114. if mapsize && mapsize[0] && mapsize[0]>0
  115. sqwidth=mapsize[0]
  116. sqheight=(mapsize[1].length*1.0/mapsize[0]).ceil
  117. for i in 0...sqwidth
  118. for j in 0...sqheight
  119. if mapsize[1][i+j*sqwidth,1].to_i>0
  120. points[mappos[1]+i+(mappos[2]+j)*mapwidth]=[true,mapcolor] #edit
  121. end
  122. end
  123. end
  124. else
  125. points[mappos[1]+mappos[2]*mapwidth]=[true,mapcolor] #edit
  126. end
  127. end
  128. end
  129. end
  130. end
  131. i=0
  132. for j in 0...points.length
  133. if points[j] && points[j][0] #edit
  134. s=SpriteWrapper.new(@viewport)
  135. s.x=(j%mapwidth)*PokemonRegionMapScene::SQUAREWIDTH-2
  136. s.x+=(Graphics.width-@sprites["map"].bitmap.width)/2
  137. s.y=(j/mapwidth)*PokemonRegionMapScene::SQUAREHEIGHT-2
  138. s.y+=(Graphics.height-@sprites["map"].bitmap.height)/2
  139. if j>=1 && points[j-1] && points[j-1][0] #edit
  140. if j>=mapwidth && points[j-mapwidth] && points[j-mapwidth][0] #edit
  141. s.bitmap=@point4
  142. else
  143. s.bitmap=@point2
  144. end
  145. else
  146. if j>=mapwidth && points[j-mapwidth] && points[j-mapwidth][0] #edit
  147. s.bitmap=@point3
  148. else
  149. s.bitmap=@point
  150. end
  151. end
  152. for x in 0 .. s.bitmap.width #edit
  153. for y in 0 .. s.bitmap.height
  154. color=s.bitmap.get_pixel(x,y)
  155. color.red=points[j][1][0]
  156. color.green=points[j][1][1]
  157. color.blue=points[j][1][2]
  158. s.bitmap.set_pixel(x,y,color)
  159. end
  160. end #edit end
  161. @sprites["point#{i}"]=s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement