Vendily

shiny pokedex

Jan 20th, 2019
180
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def pbFindEncounter(encounter,species)
  2.   return false if !encounter
  3.   for i in 0...encounter.length
  4.     next if !encounter[i]
  5.     for j in 0...encounter[i].length
  6.       return true if encounter[i][j][0]==species
  7.     end
  8.   end
  9.   return false
  10. end
  11.  
  12.  
  13.  
  14. class PokemonPokedexInfo_Scene
  15.   def pbStartScene(dexlist,index,region)
  16.     @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
  17.     @viewport.z = 99999
  18.     @dexlist = dexlist
  19.     @index   = index
  20.     @region  = region
  21.     @page = 1
  22.     @typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
  23.     @sprites = {}
  24.     @sprites["background"] = IconSprite.new(0,0,@viewport)
  25.     @sprites["infosprite"] = PokemonSprite.new(@viewport)
  26.     @sprites["infosprite"].setOffset(PictureOrigin::Center)
  27.     @sprites["infosprite"].x = 104
  28.     @sprites["infosprite"].y = 136
  29.     pbRgssOpen("Data/townmap.dat","rb"){|f|
  30.        @mapdata = Marshal.load(f)
  31.     }
  32.     mappos = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MetadataMapPosition)
  33.     if @region<0                                   # Use player's current region
  34.       @region = (mappos) ? mappos[0] : 0                      # Region 0 default
  35.     end
  36.     @sprites["areamap"] = IconSprite.new(0,0,@viewport)
  37.     @sprites["areamap"].setBitmap("Graphics/Pictures/#{@mapdata[@region][1]}")
  38.     @sprites["areamap"].x += (Graphics.width-@sprites["areamap"].bitmap.width)/2
  39.     @sprites["areamap"].y += (Graphics.height+32-@sprites["areamap"].bitmap.height)/2
  40.     for hidden in REGIONMAPEXTRAS
  41.       if hidden[0]==@region && hidden[1]>0 && $game_switches[hidden[1]]
  42.         pbDrawImagePositions(@sprites["areamap"].bitmap,[
  43.            ["Graphics/Pictures/#{hidden[4]}",
  44.               hidden[2]*PokemonRegionMap_Scene::SQUAREWIDTH,
  45.               hidden[3]*PokemonRegionMap_Scene::SQUAREHEIGHT,0,0,-1,-1]
  46.         ])
  47.       end
  48.     end
  49.     @sprites["areahighlight"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  50.     @sprites["areaoverlay"] = IconSprite.new(0,0,@viewport)
  51.     @sprites["areaoverlay"].setBitmap("Graphics/Pictures/Pokedex/overlay_area")
  52.     @sprites["formfront"] = PokemonSprite.new(@viewport)
  53.     @sprites["formfront"].setOffset(PictureOrigin::Center)
  54.     @sprites["formfront"].x = 130
  55.     @sprites["formfront"].y = 158
  56.     @sprites["formback"] = PokemonSprite.new(@viewport)
  57.     @sprites["formback"].setOffset(PictureOrigin::Bottom)
  58.     @sprites["formback"].x = 382 # y is set below as it depends on metrics
  59.     @sprites["formicon"] = PokemonSpeciesIconSprite.new(0,@viewport)
  60.     @sprites["formicon"].x = 50
  61.     @sprites["formicon"].y = 288
  62.     @sprites["shinystar"]= IconSprite.new(0,0,@viewport)
  63.     @sprites["shinystar"].setBitmap("Graphics/Pictures/shiny")
  64.     @sprites["shinystar"].visible = !!@shiny
  65.     @sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow",8,28,40,2,@viewport)
  66.     @sprites["uparrow"].x = 242
  67.     @sprites["uparrow"].y = 268
  68.     @sprites["uparrow"].play
  69.     @sprites["uparrow"].visible = false
  70.     @sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow",8,28,40,2,@viewport)
  71.     @sprites["downarrow"].x = 242
  72.     @sprites["downarrow"].y = 348
  73.     @sprites["downarrow"].play
  74.     @sprites["downarrow"].visible = false
  75.     @sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  76.     pbSetSystemFont(@sprites["overlay"].bitmap)
  77.     pbUpdateDummyPokemon
  78.     @available = pbGetAvailableForms
  79.     drawPage(@page)
  80.     pbFadeInAndShow(@sprites) { pbUpdate }
  81.   end
  82.  
  83.   def pbStartSceneBrief(species)  # For standalone access, shows first page only
  84.     @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
  85.     @viewport.z = 99999
  86. #    @region = 0
  87.     dexnum = species
  88.     dexnumshift = false
  89.     if $PokemonGlobal.pokedexUnlocked[$PokemonGlobal.pokedexUnlocked.length-1]
  90.       dexnumshift = true if DEXINDEXOFFSETS.include?(-1)
  91.     else
  92.       dexnum = 0
  93.       for i in 0...$PokemonGlobal.pokedexUnlocked.length-1
  94.         if $PokemonGlobal.pokedexUnlocked[i]
  95.           num = pbGetRegionalNumber(i,species)
  96.           if num>0
  97.             dexnum = num
  98.             dexnumshift = true if DEXINDEXOFFSETS.include?(i)
  99. #            @region = pbDexNames[i][1] if pbDexNames[i].is_a?(Array)
  100.             break
  101.           end
  102.         end
  103.       end
  104.     end
  105.     @dexlist = [[species,"",0,0,dexnum,dexnumshift]]
  106.     @index   = 0
  107.     @page = 1
  108.     @brief = true
  109.     @typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
  110.     @sprites = {}
  111.     @sprites["background"] = IconSprite.new(0,0,@viewport)
  112.     @sprites["infosprite"] = PokemonSprite.new(@viewport)
  113.     @sprites["infosprite"].setOffset(PictureOrigin::Center)
  114.     @sprites["infosprite"].x = 104
  115.     @sprites["infosprite"].y = 136
  116.     @sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
  117.     pbSetSystemFont(@sprites["overlay"].bitmap)
  118.     pbUpdateDummyPokemon
  119.     drawPage(@page)
  120.     pbFadeInAndShow(@sprites) { pbUpdate }
  121.   end
  122.  
  123.   def pbEndScene
  124.     pbFadeOutAndHide(@sprites) { pbUpdate }
  125.     pbDisposeSpriteHash(@sprites)
  126.     @typebitmap.dispose
  127.     @viewport.dispose
  128.   end
  129.  
  130.   def pbUpdate
  131.     if @page==2
  132.       intensity = (Graphics.frame_count%40)*12
  133.       intensity = 480-intensity if intensity>240
  134.       @sprites["areahighlight"].opacity = intensity
  135.     end
  136.     pbUpdateSpriteHash(@sprites)
  137.   end
  138.  
  139.   def pbUpdateDummyPokemon
  140.     @species = @dexlist[@index][0]
  141.     @gender  = ($Trainer.formlastseen[@species][0] rescue 0)
  142.     @form    = ($Trainer.formlastseen[@species][1] rescue 0)
  143.     @sprites["infosprite"].setSpeciesBitmap(@species,(@gender==1),@form,@shiny)
  144.     if @sprites["formfront"]
  145.       @sprites["formfront"].setSpeciesBitmap(@species,(@gender==1),@form,@shiny)
  146.     end
  147.     if @sprites["formback"]
  148.       @sprites["formback"].setSpeciesBitmap(@species,(@gender==1),@form,@shiny,false,true)
  149.       @sprites["formback"].y = 256+getBattleSpriteMetricOffset(@species,0)
  150.     end
  151.     if @sprites["formicon"]
  152.       @sprites["formicon"].pbSetParams(@species,@gender,@form)
  153.     end
  154.     @sprites["shinystar"].visible = !!@shiny
  155.   end
  156.  
  157.   def pbGetAvailableForms
  158.     available = [] # [name, gender, form]
  159.     formdata = pbLoadFormsData
  160.     possibleforms = []
  161.     multiforms = false
  162.     if formdata[@species]
  163.       for i in 0...formdata[@species].length
  164.         fSpecies = pbGetFSpeciesFromForm(@species,i)
  165.         formname = pbGetMessage(MessageTypes::FormNames,fSpecies)
  166.         dexdata = pbOpenDexData
  167.         pbDexDataOffset(dexdata,@species,18)
  168.         genderbyte = dexdata.fgetb
  169.         dexdata.close
  170.         if i==0 || (formname && formname!="")
  171.           multiforms = true if i>0
  172.           case genderbyte
  173.           when 0, 254, 255 # Male only, female only, genderless
  174.             gendertopush = (genderbyte==254) ? 1 : 0
  175.             if $Trainer.formseen[@species][gendertopush][i] || ALWAYSSHOWALLFORMS
  176.               gendertopush = 2 if genderbyte==255
  177.               possibleforms.push([i,gendertopush,formname])
  178.             end
  179.           else # Both male and female
  180.             for g in 0...2
  181.               if $Trainer.formseen[@species][g][i] || ALWAYSSHOWALLFORMS
  182.                 possibleforms.push([i,g,formname])
  183.                 break if (formname && formname!="")
  184.               end
  185.             end
  186.           end
  187.         end
  188.       end
  189.     end
  190.     for thisform in possibleforms
  191.       if thisform[2] && thisform[2]!="" # Has a form name
  192.         thisformname = thisform[2]
  193.       else # Necessarily applies only to form 0
  194.         case thisform[1]
  195.         when 0; thisformname = _INTL("Male")
  196.         when 1; thisformname = _INTL("Female")
  197.         else
  198.           thisformname = (multiforms) ? _INTL("One Form") : _INTL("Genderless")
  199.         end
  200.       end
  201.       # Push to available array
  202.       gendertopush = (thisform[1]==2) ? 0 : thisform[1]
  203.       available.push([thisformname,gendertopush,thisform[0]])
  204.     end
  205.     return available
  206.   end
  207.  
  208.   def drawPage(page)
  209.     overlay = @sprites["overlay"].bitmap
  210.     overlay.clear
  211.     # Make certain sprites visible
  212.     @sprites["infosprite"].visible    = (@page==1)
  213.     @sprites["areamap"].visible       = (@page==2) if @sprites["areamap"]
  214.     @sprites["areahighlight"].visible = (@page==2) if @sprites["areahighlight"]
  215.     @sprites["areaoverlay"].visible   = (@page==2) if @sprites["areaoverlay"]
  216.     @sprites["formfront"].visible     = (@page==3) if @sprites["formfront"]
  217.     @sprites["formback"].visible      = (@page==3) if @sprites["formback"]
  218.     @sprites["formicon"].visible      = (@page==3) if @sprites["formicon"]
  219.     @sprites["shinystar"].visible      = (@page!=2)&& @shiny if @sprites["shinystar"]
  220.     # Draw page-specific information
  221.     case page
  222.     when 1; drawPageInfo
  223.     when 2; drawPageArea
  224.     when 3; drawPageForms
  225.     end
  226.   end
  227.  
  228.   def drawPageInfo
  229.     @sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_info"))
  230.     overlay = @sprites["overlay"].bitmap
  231.     base   = Color.new(88,88,80)
  232.     shadow = Color.new(168,184,184)
  233.     imagepos = []
  234.     if @brief
  235.       imagepos.push([_INTL("Graphics/Pictures/Pokedex/overlay_info"),0,0,0,0,-1,-1])
  236.     end
  237.     # Write various bits of text
  238.     indexText = "???"
  239.     if @dexlist[@index][4]>0
  240.       indexNumber = @dexlist[@index][4]
  241.       indexNumber -= 1 if @dexlist[@index][5]
  242.       indexText = sprintf("%03d",indexNumber)
  243.     end
  244.     textpos = [
  245.        [_INTL("{1}{2} {3}",indexText," ",PBSpecies.getName(@species)),
  246.           246,42,0,Color.new(248,248,248),Color.new(0,0,0)],
  247.        [_INTL("Height"),314,158,0,base,shadow],
  248.        [_INTL("Weight"),314,190,0,base,shadow]
  249.     ]
  250.     if $Trainer.owned[@species]
  251.       fSpecies = pbGetFSpeciesFromForm(@species,@form)
  252.       dexdata = pbOpenDexData
  253.       # Write the kind
  254.       kind = pbGetMessage(MessageTypes::Kinds,fSpecies)
  255.       kind = pbGetMessage(MessageTypes::Kinds,@species) if !kind || kind==""
  256.       textpos.push([_INTL("{1} Pokémon",kind),246,74,0,base,shadow])
  257.       # Write the height and weight
  258.       pbDexDataOffset(dexdata,fSpecies,33)
  259.       height = dexdata.fgetw
  260.       weight = dexdata.fgetw
  261.       if pbGetCountry==0xF4   # If the user is in the United States
  262.         inches = (height/0.254).round
  263.         pounds = (weight/0.45359).round
  264.         textpos.push([_ISPRINTF("{1:d}'{2:02d}\"",inches/12,inches%12),460,158,1,base,shadow])
  265.         textpos.push([_ISPRINTF("{1:4.1f} lbs.",pounds/10.0),494,190,1,base,shadow])
  266.       else
  267.         textpos.push([_ISPRINTF("{1:.1f} m",height/10.0),470,158,1,base,shadow])
  268.         textpos.push([_ISPRINTF("{1:.1f} kg",weight/10.0),482,190,1,base,shadow])
  269.       end
  270.       # Draw the Pokédex entry text
  271.       entry = pbGetMessage(MessageTypes::Entries,fSpecies)
  272.       entry = pbGetMessage(MessageTypes::Entries,@species) if !entry || entry==""
  273.       drawTextEx(overlay,40,240,Graphics.width-(40*2),4,entry,base,shadow)
  274.       # Draw the footprint
  275.       footprintfile = pbPokemonFootprintFile(@species,@form)
  276.       if footprintfile
  277.         footprint = BitmapCache.load_bitmap(footprintfile)
  278.         overlay.blt(226,138,footprint,footprint.rect)
  279.         footprint.dispose
  280.       end
  281.       # Show the owned icon
  282.       imagepos.push(["Graphics/Pictures/Pokedex/icon_own",212,44,0,0,-1,-1])
  283.       # Draw the type icon(s)
  284.       pbDexDataOffset(dexdata,fSpecies,8)
  285.       type1 = dexdata.fgetb
  286.       type2 = dexdata.fgetb
  287.       type1rect = Rect.new(0,type1*32,96,32)
  288.       type2rect = Rect.new(0,type2*32,96,32)
  289.       overlay.blt(296,120,@typebitmap.bitmap,type1rect)
  290.       overlay.blt(396,120,@typebitmap.bitmap,type2rect) if type1!=type2
  291.       dexdata.close
  292.     else
  293.       # Write the kind
  294.       textpos.push([_INTL("????? Pokémon"),246,74,0,base,shadow])
  295.       # Write the height and weight
  296.       if pbGetCountry()==0xF4 # If the user is in the United States
  297.         textpos.push([_INTL("???'??\""),460,158,1,base,shadow])
  298.         textpos.push([_INTL("????.? lbs."),494,190,1,base,shadow])
  299.       else
  300.         textpos.push([_INTL("????.? m"),470,158,1,base,shadow])
  301.         textpos.push([_INTL("????.? kg"),482,190,1,base,shadow])
  302.       end
  303.     end
  304.     # Draw all text
  305.     pbDrawTextPositions(@sprites["overlay"].bitmap,textpos)
  306.     # Draw all images
  307.     pbDrawImagePositions(overlay,imagepos)
  308.   end
  309.  
  310.   def drawPageArea
  311.     @sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_area"))
  312.     overlay = @sprites["overlay"].bitmap
  313.     base   = Color.new(88,88,80)
  314.     shadow = Color.new(168,184,184)
  315.     @sprites["areahighlight"].bitmap.clear
  316.     # Fill the array "points" with all squares of the region map in which the
  317.     # species can be found
  318.     points = []
  319.     mapwidth = 1+PokemonRegionMap_Scene::RIGHT-PokemonRegionMap_Scene::LEFT
  320.     encdata = load_data("Data/encounters.dat")
  321.     for enc in encdata.keys
  322.       enctypes = encdata[enc][1]
  323.       if pbFindEncounter(enctypes,@species)
  324.         mappos = pbGetMetadata(enc,MetadataMapPosition)
  325.         if mappos && mappos[0]==@region
  326.           showpoint = true
  327.           for loc in @mapdata[@region][2]
  328.             showpoint = false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
  329.                                  loc[7] && !$game_switches[loc[7]]
  330.           end
  331.           if showpoint
  332.             mapsize = pbGetMetadata(enc,MetadataMapSize)
  333.             if mapsize && mapsize[0] && mapsize[0]>0
  334.               sqwidth  = mapsize[0]
  335.               sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
  336.               for i in 0...sqwidth
  337.                 for j in 0...sqheight
  338.                   if mapsize[1][i+j*sqwidth,1].to_i>0
  339.                     points[mappos[1]+i+(mappos[2]+j)*mapwidth] = true
  340.                   end
  341.                 end
  342.               end
  343.             else
  344.               points[mappos[1]+mappos[2]*mapwidth] = true
  345.             end
  346.           end
  347.         end
  348.       end
  349.     end
  350.     # Draw coloured squares on each square of the region map with a nest
  351.     pointcolor   = Color.new(0,248,248)
  352.     pointcolorhl = Color.new(192,248,248)
  353.     sqwidth = PokemonRegionMap_Scene::SQUAREWIDTH
  354.     sqheight = PokemonRegionMap_Scene::SQUAREHEIGHT
  355.     for j in 0...points.length
  356.       if points[j]
  357.         x = (j%mapwidth)*sqwidth
  358.         x += (Graphics.width-@sprites["areamap"].bitmap.width)/2
  359.         y = (j/mapwidth)*sqheight
  360.         y += (Graphics.height+32-@sprites["areamap"].bitmap.height)/2
  361.         @sprites["areahighlight"].bitmap.fill_rect(x,y,sqwidth,sqheight,pointcolor)
  362.         if j-mapwidth<0 || !points[j-mapwidth]
  363.           @sprites["areahighlight"].bitmap.fill_rect(x,y-2,sqwidth,2,pointcolorhl)
  364.         end
  365.         if j+mapwidth>=points.length || !points[j+mapwidth]
  366.           @sprites["areahighlight"].bitmap.fill_rect(x,y+sqheight,sqwidth,2,pointcolorhl)
  367.         end
  368.         if j%mapwidth==0 || !points[j-1]
  369.           @sprites["areahighlight"].bitmap.fill_rect(x-2,y,2,sqheight,pointcolorhl)
  370.         end
  371.         if (j+1)%mapwidth==0 || !points[j+1]
  372.           @sprites["areahighlight"].bitmap.fill_rect(x+sqwidth,y,2,sqheight,pointcolorhl)
  373.         end
  374.       end
  375.     end
  376.     # Set the text
  377.     textpos = []
  378.     if points.length==0
  379.       pbDrawImagePositions(overlay,[
  380.          [sprintf("Graphics/Pictures/Pokedex/overlay_areanone"),108,188,0,0,-1,-1]
  381.       ])
  382.       textpos.push([_INTL("Area unknown"),Graphics.width/2,Graphics.height/2,2,base,shadow])
  383.     end
  384.     textpos.push([pbGetMessage(MessageTypes::RegionNames,@region),414,44,2,base,shadow])
  385.     textpos.push([_INTL("{1}'s area",PBSpecies.getName(@species)),
  386.        Graphics.width/2,352,2,base,shadow])
  387.     pbDrawTextPositions(overlay,textpos)
  388.   end
  389.  
  390.   def drawPageForms
  391.     @sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms"))
  392.     overlay = @sprites["overlay"].bitmap
  393.     base   = Color.new(88,88,80)
  394.     shadow = Color.new(168,184,184)
  395.     # Write species and form name
  396.     formname = ""
  397.     for i in @available
  398.       if i[1]==@gender && i[2]==@form
  399.         formname = i[0]; break
  400.       end
  401.     end
  402.     textpos = [
  403.        [PBSpecies.getName(@species),Graphics.width/2,Graphics.height-88,2,base,shadow],
  404.        [formname,Graphics.width/2,Graphics.height-56,2,base,shadow],
  405.     ]
  406.     # Draw all text
  407.     pbDrawTextPositions(overlay,textpos)
  408.   end
  409.  
  410.   def pbGoToPrevious
  411.     newindex = @index
  412.     while newindex>0
  413.       newindex -= 1
  414.       if $Trainer.seen[@dexlist[newindex][0]]
  415.         @index = newindex
  416.         break
  417.       end
  418.     end
  419.   end
  420.  
  421.   def pbGoToNext
  422.     newindex = @index
  423.     while newindex<@dexlist.length-1
  424.       newindex += 1
  425.       if $Trainer.seen[@dexlist[newindex][0]]
  426.         @index = newindex
  427.         break
  428.       end
  429.     end
  430.   end
  431.  
  432.   def pbChooseForm
  433.     index = 0
  434.     for i in 0...@available.length
  435.       if @available[i][1]==@gender && @available[i][2]==@form
  436.         index = i
  437.         break
  438.       end
  439.     end
  440.     oldindex = -1
  441.     loop do
  442.       if oldindex!=index
  443.         $Trainer.formlastseen[@species][0] = @available[index][1]
  444.         $Trainer.formlastseen[@species][1] = @available[index][2]
  445.         pbUpdateDummyPokemon
  446.         drawPage(@page)
  447.         @sprites["uparrow"].visible   = (index>0)
  448.         @sprites["downarrow"].visible = (index<@available.length-1)
  449.         oldindex = index
  450.       end
  451.       Graphics.update
  452.       Input.update
  453.       pbUpdate
  454.       if Input.trigger?(Input::UP)
  455.         pbPlayCursorSE
  456.         index = (index+@available.length-1)%@available.length
  457.       elsif Input.trigger?(Input::DOWN)
  458.         pbPlayCursorSE
  459.         index = (index+1)%@available.length
  460.       elsif Input.trigger?(Input::B)
  461.         pbPlayCancelSE
  462.         break
  463.       elsif Input.trigger?(Input::C)
  464.         pbPlayDecisionSE
  465.         break
  466.       end
  467.     end
  468.     @sprites["uparrow"].visible   = false
  469.     @sprites["downarrow"].visible = false
  470.   end
  471.  
  472.   def pbScene
  473.     pbPlayCrySpecies(@species,@form)
  474.     loop do
  475.       Graphics.update
  476.       Input.update
  477.       pbUpdate
  478.       dorefresh = false
  479.       if Input.trigger?(Input::A)
  480.         pbSEStop; pbPlayCrySpecies(@species,@form) if @page==1
  481.       elsif Input.trigger?(Input::B)
  482.         pbPlayCancelSE
  483.         break
  484.       elsif Input.trigger?(Input::C)
  485.         if @page==2   # Area
  486. #          dorefresh = true
  487.         elsif @page==3   # Forms
  488.           if @available.length>1
  489.             pbPlayDecisionSE
  490.             pbChooseForm
  491.             dorefresh = true
  492.           end
  493.         end
  494.       elsif Input.trigger?(Input::CTRL)
  495.         if  @page==3
  496.           @shiny^=true
  497.           pbUpdateDummyPokemon
  498.           dorefresh = true
  499.         end
  500.       elsif Input.trigger?(Input::UP)
  501.         oldindex = @index
  502.         pbGoToPrevious
  503.         if @index!=oldindex
  504.           pbUpdateDummyPokemon
  505.           @available = pbGetAvailableForms
  506.           pbSEStop
  507.           (@page==1) ? pbPlayCrySpecies(@species,@form) : pbPlayCursorSE
  508.           dorefresh = true
  509.         end
  510.       elsif Input.trigger?(Input::DOWN)
  511.         oldindex = @index
  512.         pbGoToNext
  513.         if @index!=oldindex
  514.           pbUpdateDummyPokemon
  515.           @available = pbGetAvailableForms
  516.           pbSEStop
  517.           (@page==1) ? pbPlayCrySpecies(@species,@form) : pbPlayCursorSE
  518.           dorefresh = true
  519.         end
  520.       elsif Input.trigger?(Input::LEFT)
  521.         oldpage = @page
  522.         @page -= 1
  523.         @page = 1 if @page<1
  524.         @page = 3 if @page>3
  525.         if @page!=oldpage
  526.           pbPlayCursorSE
  527.           dorefresh = true
  528.         end
  529.       elsif Input.trigger?(Input::RIGHT)
  530.         oldpage = @page
  531.         @page += 1
  532.         @page = 1 if @page<1
  533.         @page = 3 if @page>3
  534.         if @page!=oldpage
  535.           pbPlayCursorSE
  536.           dorefresh = true
  537.         end
  538.       end
  539.       if dorefresh
  540.         drawPage(@page)
  541.       end
  542.     end
  543.     return @index
  544.   end
  545.  
  546.   def pbSceneBrief
  547.     pbPlayCrySpecies(@species,@form)
  548.     loop do
  549.       Graphics.update
  550.       Input.update
  551.       pbUpdate
  552.       if Input.trigger?(Input::A)
  553.         pbSEStop; pbPlayCrySpecies(@species,@form)
  554.       elsif Input.trigger?(Input::B)
  555.         pbPlayCancelSE
  556.         break
  557.       elsif Input.trigger?(Input::C)
  558.         pbPlayDecisionSE
  559.         break
  560.       end
  561.     end
  562.   end
  563. end
  564.  
  565.  
  566.  
  567. class PokemonPokedexInfoScreen
  568.   def initialize(scene)
  569.     @scene = scene
  570.   end
  571.  
  572.   def pbStartScreen(dexlist,index,region)
  573.     @scene.pbStartScene(dexlist,index,region)
  574.     ret = @scene.pbScene
  575.     @scene.pbEndScene
  576.     return ret   # Index of last species viewed in dexlist
  577.   end
  578.  
  579.   def pbStartSceneSingle(species)   # For use from a Pokémon's summary screen
  580.     region = -1
  581.     if DEXDEPENDSONLOCATION
  582.       region = pbGetCurrentRegion
  583.       region = -1 if region>=$PokemonGlobal.pokedexUnlocked.length-1
  584.     else
  585.       region = $PokemonGlobal.pokedexDex # National Dex -1, regional dexes 0 etc.
  586.     end
  587.     dexnum = pbGetRegionalNumber(region,species)
  588.     dexnumshift = DEXINDEXOFFSETS.include?(region)
  589.     dexlist = [[species,PBSpecies.getName(species),0,0,dexnum,dexnumshift]]
  590.     @scene.pbStartScene(dexlist,0,region)
  591.     @scene.pbScene
  592.     @scene.pbEndScene
  593.   end
  594.  
  595.   def pbDexEntry(species)   # For use when capturing a new species
  596.     @scene.pbStartSceneBrief(species)
  597.     @scene.pbSceneBrief
  598.     @scene.pbEndScene
  599.   end
  600. end
RAW Paste Data