Advertisement
Yankas

Radial Menu v1.1

Nov 9th, 2017
1,991
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 17.53 KB | None | 0 0
  1. ########################### Yankas' Radial Menu Script ##############################
  2. ########## VERSION 1.0
  3. #####################################################################################
  4.  
  5. #######
  6. ####### ICONS FOR THE MENU'S ENTRIES
  7. #######
  8. ICON_POKEMON = "Graphics/Icons/item267"
  9. ICON_POKEGEAR = "Graphics/Icons/itemPokegear"
  10. ICON_POKEDEX = "Graphics/Icons/item509"
  11. ICON_BAG = "Graphics/Icons/item513"
  12. ICON_OPTIONS = "Graphics/Icons/item207"
  13. ICON_EXITSAFARI = "Graphics/Icons/item009"
  14. ICON_DEBUG = "Graphics/Icons/item000"
  15. ICON_SAVE = "Graphics/Icons/item204"
  16. ICON_EXITGAME = "Graphics/Icons/itemBack"
  17.  
  18. #######
  19. ####### APPEARANCE
  20. #######
  21. # Distance of menu icons from the center / player character
  22. MENU_DISTANCE = 110
  23. ICON_WIDTH = 48 # The width of the menu icon FILE ### NOT TESTED
  24. ICON_HEIGHT = 48 # The height of menu icon FILE ### NOT TESTED
  25. ACTIVE_SCALE = 1.5 # Resize factor of the currently active icon.
  26. ACTIVE_OPACITY = 255 # Transparency of active icon; 0=fully transparent, 255=fully solid
  27. ACTIVE_TONE = Tone.new(0,0,0,0) # Tone (Red, Green, Blue, Grey) shift applied to active icon.
  28. INACTIVE_OPACITY = 150 # Transparency of inactive icons; 0=fully, 255=fully solid
  29. INACTIVE_TONE = Tone.new(0,0,0,0) # Tone (Red, Green, Blue, Grey) shift applied to inactive icon.
  30. MENU_TEXTCOLOR=Color.new(244,244,244) # The text color of the menu icon's name/description.
  31. MENU_TEXTOUTLINE=Color.new(30,30,30) # The highlight (outline) color of the text.
  32. MENU_OPEN_SOUND = "GUI menu open" # When menu opens, play the following sound.
  33. BACKGROUND_TINT = Tone.new(0,0,0,150) # Tone (Red, Green, Blue, Grey) applied to the background/map.
  34.  
  35. #######
  36. ####### BEHAVIOR
  37. #######
  38. # Determines the position of the "active/selected" item. You can set
  39. # any angle you like (in Radians), or use one of the 4 presets here.
  40. # TOP (default)     = -(Math::PI/2)
  41. # RIGHT             = 0
  42. # LEFT              = Math::PI
  43. # BOTTOM            = Math::PI/2
  44. BASE_ANGLE = -(Math::PI/2)
  45. FORCE_PLAYER_LOOK_DOWN = false # Option to look the player to face downwards during the menu.
  46. BUTTON_COUNTERCLOCKWISE = Input::LEFT # Button used to turn the menu counterclockwise, default=Input::LEFT
  47. BUTTON_CLOCKWISE = Input::RIGHT # Button used to turn the menu clockwise, default=Input::Right
  48.  
  49. #######
  50. ######## ANIMATIONS  
  51. #######
  52. # How long the animation for changing menu selection lasts in frames. (20 frames = 1 second); 1 = instant
  53. # DO NOT SET TO 0 OR LESS
  54. ANIM_TURN_LENGTH = 10
  55. # How long the animation for changing entries takes frames. (20 frames = 1 second); 1 = instant
  56. # DO NOT SET TO 0 OR LESS
  57. ANIM_START_LENGTH = 8
  58. # The Sound used when changing your selection in the menu, don't add file extension.
  59. ANIM_TURN_SOUND = "GUI sel cursor"
  60.  
  61. #######
  62. ######## CLOCK  
  63. #######
  64. # Set to false to disable the clock.
  65. ENABLE_CLOCK = true # enable the clock, for clock configuration, CTRL+F: "class Clock"
  66. # Determines the way time is displayed.
  67. # Substitute with any valid formatting code
  68. # FORMAT        => EXAMPLE ######
  69. # "%I:%M %p"        => 07:08 pm
  70. # "%I:%M:%S %p"     => 07:08:20 pm
  71. # "%H:%M:%S"        => 19:08:20
  72. # "%H:%M            => 19:08
  73. CLOCK_TIME_FORMAT = "%I:%M %p"
  74. # Color of the clock's text
  75. CLOCK_TEXTCOLOR = Color.new(244,244,244)
  76. # Color of the clock's text outline
  77. CLOCK_HIGHLIGHTCOLOR = Color.new(30,30,30)
  78.  
  79.  
  80. #####################################################################################
  81.  
  82. class MenuEntry
  83.     attr_accessor :angle
  84.     attr_reader :name
  85.     attr_reader :icon
  86. end
  87.  
  88. class MenuEntryPokemon < MenuEntry
  89.     def initialize
  90.         @icon = ICON_POKEMON
  91.         @name = "Pokémon"
  92.     end
  93.     def selected(menu)
  94.         hiddenmove = nil
  95.         pbFadeOutIn(99999){
  96.             sscene = PokemonParty_Scene.new
  97.             sscreen = PokemonPartyScreen.new(sscene,$Trainer.party)
  98.             hiddenmove = sscreen.pbPokemonScreen
  99.             return (hiddenmove)
  100.         }
  101.         if hiddenmove
  102.             $game_temp.in_menu = false
  103.             Kernel.pbUseHiddenMove(hiddenmove[0],hiddenmove[1])
  104.             return
  105.         end
  106.     end
  107. end
  108.  
  109. class MenuEntryPokedex < MenuEntry
  110.     def initialize
  111.         @icon = ICON_POKEDEX
  112.         @name = "Pokédex"
  113.     end
  114.     def selected(menu)
  115.         if $PokemonGlobal.pokedexViable.length==1
  116.             $PokemonGlobal.pokedexDex = $PokemonGlobal.pokedexViable[0]
  117.             $PokemonGlobal.pokedexDex = -1 if $PokemonGlobal.pokedexDex==$PokemonGlobal.pokedexUnlocked.length-1
  118.             pbFadeOutIn(99999){
  119.                   scene = PokemonPokedex_Scene.new
  120.                   screen = PokemonPokedexScreen.new(scene)
  121.                   screen.pbStartScreen
  122.             }
  123.         else
  124.             pbFadeOutIn(99999){
  125.                 scene = PokemonPokedexMenu_Scene.new
  126.                 screen = PokemonPokedexMenuScreen.new(scene)
  127.                 screen.pbStartScreen
  128.             }
  129.         end
  130.         return false
  131.     end
  132. end
  133.  
  134. class MenuEntryBag < MenuEntry
  135.     def initialize
  136.         @icon = ICON_BAG
  137.         @name = "Bag"
  138.     end
  139.     def selected(menu)
  140.         item = 0
  141.         pbFadeOutIn(99999){
  142.             scene = PokemonBag_Scene.new
  143.             screen = PokemonBagScreen.new(scene,$PokemonBag)
  144.             item = screen.pbStartScreen
  145.             return (item>0)
  146.         }
  147.         if item>0
  148.           Kernel.pbUseKeyItemInField(item)
  149.           return true
  150.         end
  151.     end
  152. end
  153.  
  154. class MenuEntryTrainer < MenuEntry
  155.     def initialize
  156.         @icon = "Graphics/Icons/item520"
  157.         @name = $Trainer.name
  158.     end
  159.     def selected(menu)
  160.         pbFadeOutIn(99999){
  161.             scene = PokemonTrainerCard_Scene.new
  162.             screen = PokemonTrainerCardScreen.new(scene)
  163.             screen.pbStartScreen
  164.             return false
  165.         }
  166.     end
  167. end
  168.  
  169. class MenuEntrySave < MenuEntry
  170.     def initialize
  171.         @icon = ICON_SAVE
  172.         @name = "Save"
  173.     end
  174.     def selected(menu)
  175.         menu.pbHideMenu(true)
  176.         scene = PokemonSave_Scene.new
  177.         screen = PokemonSaveScreen.new(scene)
  178.         if screen.pbSaveScreen
  179.           return true  
  180.         end
  181.         menu.pbHideMenu(false)
  182.     end
  183. end
  184.  
  185. class MenuEntryQuit < MenuEntry
  186.     def initialize
  187.         @icon = ICON_EXITGAME
  188.         @name = "Exit Game"
  189.     end
  190.     def selected(menu)
  191.         menu.pbHideMenu(true)
  192.         if Kernel.pbConfirmMessage(_INTL("Are you sure you want to quit the game?"))
  193.             scene = PokemonSave_Scene.new
  194.             screen = PokemonSaveScreen.new(scene)
  195.             if screen.pbSaveScreen
  196.                 return false
  197.             end
  198.             $scene = nil
  199.             return true
  200.         end
  201.         menu.pbHideMenu(false)
  202.     end
  203. end
  204.  
  205. class MenuEntryPokegear < MenuEntry
  206.     def initialize
  207.         @icon = ICON_POKEGEAR
  208.         @name = "Pokégear"
  209.     end
  210.     def selected(menu)
  211.         pbFadeOutIn(99999){
  212.             scene = PokemonPokegear_Scene.new
  213.             screen = PokemonPokegearScreen.new(scene)
  214.             screen.pbStartScreen
  215.             return false
  216.         }
  217.     end
  218. end
  219.  
  220. class MenuEntryOption < MenuEntry
  221.     def initialize
  222.         @icon = ICON_OPTIONS
  223.         @name = "Options"
  224.     end
  225.     def selected(menu)
  226.         pbFadeOutIn(99999){
  227.             scene = PokemonOption_Scene.new
  228.             screen = PokemonOptionScreen.new(scene)
  229.             screen.pbStartScreen
  230.             return false
  231.         }
  232.     end
  233. end
  234.  
  235. class MenuEntryDebug < MenuEntry
  236.     def initialize
  237.         @icon = ICON_DEBUG
  238.         @name = "Debug"
  239.     end
  240.     def selected(menu)
  241.         pbFadeOutIn(99999){
  242.           pbDebugMenu
  243.           return false
  244.         }
  245.     end
  246. end
  247.  
  248. class MenuEntryExitSafari < MenuEntry
  249.     def initialize
  250.         @icon = ICON_EXITSAFARI
  251.         @name = "Quit Safari"
  252.     end
  253.     def selected(menu)
  254.         if pbInSafari?
  255.           if Kernel.pbConfirmMessage(_INTL("Would you like to leave the Safari Game right now?"))
  256.                 menu.pbEndScene
  257.                 pbSafariState.decision = 1
  258.                 pbSafariState.pbGoToStart
  259.                 return false
  260.             end
  261.             return false # Since we already exited the scene, we shouldn't return an exit command.
  262.         end
  263.     end
  264. end
  265.  
  266. class MenuEntryExitBugContest < MenuEntry
  267.     def initialize
  268.         @icon = ICON_EXITSAFARI
  269.         @name = "Quit Contest"
  270.     end
  271.     def selected(menu)
  272.         if pbInBugContest?
  273.             if Kernel.pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
  274.                 menu.pbEndScene
  275.                 pbBugContestState.pbStartJudging
  276.             end
  277.             return false # Since we already exited the scene, we shouldn't return an exit command.
  278.         end
  279.     end
  280. end
  281.  
  282. class Component
  283.     attr_accessor :viewport
  284.     attr_accessor :sprites
  285.    
  286.     def initialize(viewport, spritehash)
  287.         @viewport = viewport
  288.         @sprites = spritehash
  289.     end
  290.    
  291.     def dispose
  292.         @sprites = nil
  293.     end
  294. end
  295.  
  296. class Clock < Component
  297.     def initialize(viewport, spritehash, format)
  298.         super(viewport, spritehash)
  299.         @time = pbGetTimeNow
  300.         @sprites["clock"] = BitmapSprite.new(256,64,viewport)
  301.         @sprites["clock"].x = 380
  302.         @sprites["clock"].y = (pbInBugContest?) ? (Graphics.height - 64) : 10
  303.     end
  304.    
  305.  
  306.     def update
  307.         @time = pbGetTimeNow
  308.         text = @time.strftime(CLOCK_TIME_FORMAT)
  309.         textDay = @time.strftime("%A")
  310.         @sprites["clock"].bitmap.clear
  311.         pbSetSystemFont(@sprites["clock"].bitmap)
  312.         pbDrawTextPositions(@sprites["clock"].bitmap,[[text,0,0,0,CLOCK_TEXTCOLOR,CLOCK_HIGHLIGHTCOLOR],[textDay,0,32,0,CLOCK_TEXTCOLOR,CLOCK_HIGHLIGHTCOLOR]])
  313.     end
  314. end
  315.  
  316.  
  317. class SafariHud < Component
  318.     def initialize(viewport, spritehash)
  319.         super
  320.         @sprites["safari"] = BitmapSprite.new(256,64,viewport)
  321.         @sprites["safari"].x = 10
  322.         @sprites["safari"].y = 10
  323.         @textcolor = Color.new(244,244,244)
  324.         @highlightColor = Color.new(30,30,30)
  325.         @oldText
  326.         @oldText2
  327.     end
  328.    
  329.     def update
  330.         text = _INTL("Balls: {1}",pbSafariState.ballcount)
  331.         text2 = (SAFARISTEPS>0) ? _INTL("Steps: {1}/{2}", pbSafariState.steps,SAFARISTEPS) : ""
  332.        
  333.         if(@oldText != text || @oldText2 != text2)
  334.             @oldText = text
  335.             @oldText2 = text2
  336.             @sprites["safari"].bitmap.clear
  337.             pbSetSystemFont(@sprites["safari"].bitmap)
  338.             pbDrawTextPositions(@sprites["safari"].bitmap,[[text,0,0,0,@textcolor,@highlightColor],[text2,0,32,0,@textcolor,@highlightColor]])
  339.         end
  340.     end
  341. end
  342.  
  343. class BugContestHud < Component
  344.     def initialize(viewport, spritehash)
  345.         super
  346.         @sprites["safari"] = BitmapSprite.new(256,96,viewport)
  347.         @sprites["safari"].x = 10
  348.         @sprites["safari"].y = 10
  349.         @textcolor = Color.new(244,244,244)
  350.         @highlightColor = Color.new(30,30,30)
  351.         @oldText = ""
  352.         @oldText2 = ""
  353.         @oldText3 = ""
  354.     end
  355.    
  356.     def update 
  357.         if(pbBugContestState.lastPokemon)
  358.             text =  _INTL("Caught: {1}", PBSpecies.getName(pbBugContestState.lastPokemon.species))
  359.             text2 =  _INTL("Level: {1}", pbBugContestState.lastPokemon.level)
  360.             text3 =  _INTL("Balls: {1}", pbBugContestState.ballcount)
  361.         else
  362.             text = "Caught: None"
  363.             text2 = _INTL("Balls: {1}",pbBugContestState.ballcount)
  364.             text3 = ""
  365.         end
  366.        
  367.         if(@oldText != text || @oldText2 != text2 || @oldText3 != text3)
  368.             @oldText = text
  369.             @oldText2 = text2
  370.             @oldText3 = text3
  371.             @sprites["safari"].bitmap.clear
  372.             pbSetSystemFont(@sprites["safari"].bitmap)
  373.             pbDrawTextPositions(@sprites["safari"].bitmap,[[text,0,0,0,@textcolor,@highlightColor],[text2,0,32,0,@textcolor,@highlightColor],[text3,0,64,0,@textcolor,@highlightColor]])
  374.         end
  375.     end
  376. end
  377.  
  378. class RadialMenu < Component   
  379.     def initialize(viewport, spritehash, menu)
  380.         super(viewport, spritehash)
  381.         @menu = menu
  382.        
  383.         @entries = []
  384.         @originX = Graphics.width / 2 - ICON_WIDTH / 2
  385.         @originY = Graphics.height / 2 - ICON_HEIGHT / 2 - 8
  386.         @animationCounter = (ANIM_START_LENGTH > 0) ? ANIM_START_LENGTH : 1
  387.         @currentSelection = 0 # The current selection, used as index for @entries
  388.         @angleSize = 0
  389.         @frameAngleShift = 0 # How many frames it takes to turn one time.
  390.        
  391.         # SAFARI    = Bag       Trainer     PokeGear    Quit    Options     Debug       Exit Game
  392.         # BCONTEST  = Pokemon   Trainer     PokeGear    Quit    Options     Debug       Exit Game
  393.         addMenuEntry(MenuEntryPokemon.new) if $Trainer.party.length>0
  394.         addMenuEntry(MenuEntryPokedex.new) if $Trainer.pokedex && $PokemonGlobal.pokedexViable.length>0
  395.         addMenuEntry(MenuEntryBag.new)  if !pbInBugContest?
  396.         addMenuEntry(MenuEntryExitBugContest.new) if pbInBugContest?
  397.         addMenuEntry(MenuEntryExitSafari.new) if pbInSafari?
  398.         addMenuEntry(MenuEntryOption.new)
  399.         addMenuEntry(MenuEntrySave.new)  if !pbInBugContest? && $game_system && !$game_system.save_disabled && !pbInSafari?
  400.         addMenuEntry(MenuEntryQuit.new)
  401.         addMenuEntry(MenuEntryDebug.new)if $DEBUG
  402.         addMenuEntry(MenuEntryTrainer.new)
  403.         addMenuEntry(MenuEntryPokegear.new) if $Trainer.pokegear
  404.        
  405.         @sprites["entrytext"] = BitmapSprite.new(256,32,@viewport)
  406.         @sprites["entrytext"].y = @originY + 48
  407.         @doingStartup = true
  408.         refreshMenuText
  409.     end
  410.    
  411.     def addMenuEntry(entry)
  412.         @entries << entry
  413.         @sprites[entry.name] = IconSprite.new(0,0,@viewport)
  414.         @sprites[entry.name].visible = false
  415.         @sprites[entry.name].setBitmap(entry.icon)
  416.         @sprites[entry.name].tone = INACTIVE_TONE
  417.         @sprites[entry.name].opacity = INACTIVE_OPACITY
  418.     end
  419.    
  420.     def update
  421.         exit = false # should the menu-loop continue
  422.         if(Input.trigger?(Input::B))
  423.                 @menu.shouldExit = true
  424.                 return
  425.         end
  426.         if(@animationCounter > 0)
  427.             if(@doingStartup)
  428.                 @distance = 24 + (ANIM_START_LENGTH - @animationCounter) * ((MENU_DISTANCE - 24) / ANIM_START_LENGTH)
  429.                 positionMenuEntries
  430.                 @menu.pbHideMenu(false) if(ANIM_START_LENGTH== @animationCounter) # If it's the first frame
  431.                 transformIcon(@sprites[@entries[0].name], ACTIVE_SCALE, ACTIVE_TONE, ACTIVE_OPACITY)
  432.                 @animationCounter -= 1
  433.                 @doingStartup = false if (@animationCounter < 1)
  434.             else
  435.                 updateAnimation
  436.                 refreshMenuText
  437.             end
  438.         else
  439.             if Input.trigger?(BUTTON_COUNTERCLOCKWISE)
  440.                 startAnimation(1)
  441.             elsif Input.trigger?(BUTTON_CLOCKWISE)
  442.                 startAnimation(-1)
  443.             elsif Input.trigger?(Input::C)
  444.                 exit = @entries[@currentSelection].selected(@menu) # trigger selected entry.               
  445.             end    
  446.         end
  447.         @menu.shouldExit = exit
  448.     end
  449.  
  450.    
  451.     # direction is either 1 (clockwise) or -1 (counterclockwise)
  452.     def startAnimation(direction)
  453.         @currentSelection =  (@currentSelection - direction) % @entries.length # keep selection within array bounds
  454.         @currentAngle = BASE_ANGLE
  455.         @frameAngleShift = direction * @angleSize / ANIM_TURN_LENGTH # in radians
  456.         @frameScaleShift = ((ACTIVE_SCALE-1) / ANIM_TURN_LENGTH)
  457.         @animationCounter = ANIM_TURN_LENGTH
  458.         pbSEPlay(ANIM_TURN_SOUND)
  459.     end
  460.    
  461.     def updateAnimation
  462.         @animationCounter -= 1
  463.         @entries.each do |entry|
  464.             entry.angle += @frameAngleShift
  465.             repositionSprite(@sprites[entry.name], entry.angle)
  466.         end
  467.         # Transition properties of selected/deselected entries
  468.         newActive = @sprites[@entries[@currentSelection].name]
  469.         if(@frameAngleShift > 0)
  470.             oldActive = @sprites[@entries[(@currentSelection + 1) % @entries.length].name]
  471.         else
  472.             oldActive = @sprites[@entries[(@currentSelection - 1) % @entries.length].name]
  473.         end
  474.         scaleNew = 1 + @frameScaleShift * (ANIM_TURN_LENGTH - @animationCounter)
  475.         scaleOld = 1 + @frameScaleShift * @animationCounter
  476.         transformIcon(newActive, scaleNew, ACTIVE_TONE, ACTIVE_OPACITY)
  477.         transformIcon(oldActive, scaleOld, INACTIVE_TONE, INACTIVE_OPACITY)
  478.     end
  479.    
  480.     def refreshMenuText
  481.         @sprites["entrytext"].bitmap.clear
  482.         text = @entries[@currentSelection].name
  483.         @sprites["entrytext"].x = @originX + 24 - text.length * 5.5 # rough guesstimate for centering
  484.         pbSetSystemFont(@sprites["entrytext"].bitmap)
  485.         pbDrawTextPositions(@sprites["entrytext"].bitmap,[[text,0,0,0,MENU_TEXTCOLOR,MENU_TEXTOUTLINE]])
  486.     end
  487.        
  488.     def positionMenuEntries
  489.         @currentAngle = BASE_ANGLE
  490.         @angleSize = (2*Math::PI) / @entries.length
  491.         @entries.each do |entry|
  492.             entry.angle = @currentAngle
  493.             repositionSprite(@sprites[entry.name], entry.angle)
  494.             @currentAngle += @angleSize        
  495.         end
  496.     end
  497.    
  498.     def repositionSprite(sprite, theta)
  499.         sprite.y = (@distance * Math.sin(theta)) + @originY
  500.         sprite.x = (@distance * Math.cos(theta)) + @originX
  501.     end
  502.    
  503.     def transformIcon(sprite, scale, tone, opacity)
  504.         width = sprite.bitmap.width
  505.         height = sprite.bitmap.height
  506.         sprite.zoom_x = scale
  507.         sprite.zoom_y = scale
  508.         sprite.x = sprite.x - (width*scale-width)/2        
  509.         sprite.y = sprite.y - (height*scale-height)/2  
  510.         sprite.tone = tone
  511.         sprite.opacity = opacity
  512.     end
  513. end
  514.  
  515.  
  516. class PokemonPauseMenu_Scene
  517.     attr_accessor :shouldExit
  518.    
  519.     def initialize
  520.         @background = Viewport.new(0,0,Graphics.width,Graphics.height)
  521.         @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
  522.         @entries = []
  523.         @sprites = {}
  524.         @shouldExit = false    
  525.     end
  526.  
  527.     def pbStartScene
  528.         @viewport.z = 99999
  529.         @background.z = 99998
  530.         @background.tone = BACKGROUND_TINT
  531.         @clock = (ENABLE_CLOCK) ? Clock.new(@viewport, @sprites, CLOCK_TIME_FORMAT) : nil
  532.         @safari = SafariHud.new(@viewport, @sprites) if (pbInSafari?)
  533.         @safari = BugContestHud.new(@viewport, @sprites) if (pbInBugContest?)
  534.         @radialMenu = RadialMenu.new(@viewport, @sprites, self)
  535.     end
  536.    
  537.     def pbHideMenu(hide)
  538.         @sprites.each do |_,sprite|
  539.             sprite.visible = !hide
  540.         end
  541.     end
  542.    
  543.     def update
  544.         @hasTerminated = false
  545.         pbSEPlay(MENU_OPEN_SOUND)
  546.          # face downward
  547.         loop do
  548.             if($game_player.direction != 2 && FORCE_PLAYER_LOOK_DOWN)
  549.                 @playerOldDirection = $game_player.direction
  550.                 $game_player.turn_down
  551.                 Graphics.update
  552.                 Input.update
  553.                 pbUpdateSceneMap
  554.                 next
  555.             end
  556.             Graphics.update
  557.             Input.update
  558.             @clock.update if ENABLE_CLOCK
  559.             @safari.update if defined?(@safari)
  560.             @radialMenu.update
  561.             if(@hasTerminated)
  562.                 return # If pbEndScene was already called, don't call it again.
  563.             end
  564.             pbUpdateSceneMap
  565.             if(shouldExit)
  566.                 pbEndScene
  567.                 break
  568.             end
  569.         end
  570.         pbUpdateSpriteHash(@sprites)
  571.     end
  572.    
  573.     def pbRefresh ; end
  574.     def pbShowMenu ; end
  575.    
  576.     def closeNow
  577.         @pbEndScene
  578.         @hasTerminated = true
  579.     end
  580.    
  581.     def pbEndScene
  582.         @hasTerminated = true
  583.         @background.dispose
  584.         @radialMenu.dispose
  585.         @safari.dispose if defined?(@safari)
  586.         @clock.dispose if @clockEnabled
  587.         pbDisposeSpriteHash(@sprites)
  588.         @viewport.dispose
  589.         $game_player.turnGeneric(@playerOldDirection) if defined?(@playerOldDirection)
  590.     end
  591. end
  592.  
  593.  
  594. class PokemonPauseMenu
  595.     def initialize(scene)
  596.         @scene = scene
  597.        
  598.     end
  599.    
  600.     def pbShowMenu
  601.         @scene.pbRefresh
  602.         @scene.pbShowMenu  
  603.     end
  604.    
  605.     def pbStartPokemonMenu
  606.         pbSetViableDexes # ?? called in original script
  607.         @scene.pbStartScene
  608.         @scene.update
  609.     end
  610. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement