class PokephoneButton < SpriteWrapper
attr_reader :index
attr_reader :name
attr_accessor :selected
def initialize(x,y,name="",index=0,viewport=nil)
super(viewport)
@index=index
@name=name
@selected=false
fembutton=pbResolveBitmap(sprintf("Graphics/Pictures/pokephoneButtonf"))
if $Trainer.isFemale? && fembutton
@button=AnimatedBitmap.new("Graphics/Pictures/pokephoneButtonf")
else
@button=AnimatedBitmap.new("Graphics/Pictures/pokephoneButton")
end
@contents=BitmapWrapper.new(@button.width,@button.height)
self.bitmap=@contents
self.x=x
self.y=y
refresh
update
end
def dispose
@button.dispose
@contents.dispose
super
end
def refresh
self.bitmap.clear
self.bitmap.blt(0,0,@button.bitmap,Rect.new(0,0,@button.width,@button.height))
pbSetSystemFont(self.bitmap)
textpos=[ # Name is written on both unselected and selected buttons
[@name,self.bitmap.width/2,10,2,Color.new(248,248,248),Color.new(40,40,40)],
[@name,self.bitmap.width/2,62,2,Color.new(248,248,248),Color.new(40,40,40)]
]
pbDrawTextPositions(self.bitmap,textpos)
icon=sprintf("Graphics/Pictures/pokegear"+@name)
imagepos=[ # Icon is put on both unselected and selected buttons
[icon,18,10,0,0,-1,-1],
[icon,18,62,0,0,-1,-1]
]
pbDrawImagePositions(self.bitmap,imagepos)
end
def update
if self.selected
self.src_rect.set(0,self.bitmap.height/2,self.bitmap.width,self.bitmap.height/2)
else
self.src_rect.set(0,0,self.bitmap.width,self.bitmap.height/2)
end
super
end
end
#===============================================================================
# - Scene_Pokegear
#-------------------------------------------------------------------------------
# Modified By Harshboy
# Modified by Peter O.
# Also Modified By OblivionMew
# Overhauled by Maruno
#===============================================================================
class Scene_Pokephone
#-----------------------------------------------------------------------------
# initialize
#-----------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#-----------------------------------------------------------------------------
# main
#-----------------------------------------------------------------------------
def main
commands=[]
# OPTIONS - If you change these, you should also change update_command below.
@cmdMap=-1
@cmdContacts=-1
@cmdStorage=-1
@cmdJukebox=-1
@cmdGames=-1
@cmdHudskins=-1
@cmdGuideBook=-1
@cmdVSHunter=-1
@cmdLandmarks=-1
@cmdSightings=-1
@cmdHistory=-1
@cmdCases=-1
@cmdBack=-1
commands[@cmdMap=commands.length]=_INTL("Map") if !$game_switches[340]
commands[@cmdPhone=commands.length]=_INTL("Contacts") if $PokemonGlobal.phoneNumbers &&
$PokemonGlobal.phoneNumbers.length>0 &&
!$game_switches[340]
commands[@cmdStorage=commands.length]=_INTL("Storage") if !$game_switches[340]
commands[@cmdJukebox=commands.length]=_INTL("Jukebox") if !$game_switches[340]
commands[@cmdGames=commands.length]=_INTL("Games") if !$game_switches[340]
commands[@cmdHudskins=commands.length]=_INTL("Hudskins") if !$game_switches[340]
commands[@cmdGuideBook=commands.length]=_INTL("Guide Book") if !$game_switches[340]
commands[@cmdVSHunter=commands.length]=_INTL("VS Hunter") if !$game_switches[340] && $game_switches[491]
commands[@cmdLandmarks=commands.length]=_INTL("Landmarks") if $game_switches[340]
commands[@cmdSightings=commands.length]=_INTL("Sightings") if $game_switches[340]
commands[@cmdHistory=commands.length]=_INTL("History") if $game_switches[340]
commands[@cmdCases=commands.length]=_INTL("Yancy Cases") if $game_switches[340] && $game_switches[403]
commands[@cmdBack=commands.length]=_INTL("Back") if $game_switches[340]
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@button=AnimatedBitmap.new("Graphics/Pictures/pokephoneButton")
@sprites={}
@sprites["background"] = IconSprite.new(0,0)
femback=pbResolveBitmap(sprintf("Graphics/Pictures/pokephonebgf"))
if $Trainer.isFemale? && femback
@sprites["background"].setBitmap("Graphics/Pictures/pokephonebgf")
else
@sprites["background"].setBitmap("Graphics/Pictures/pokephonebgm")
end
@sprites["command_window"] = Window_CommandPokemon.new(commands,160)
@sprites["command_window"].visible = false
@sprites["command_window"].index = @menu_index
for i in 0...commands.length
x=220 - (commands.length*24) + (i*84) #if commands<=3
y=60 #- (commands.length*24) + (i*48)
@sprites["button#{i}"]=PokephoneButton.new(x,y,commands[i],i,@viewport)
@sprites["button#{i}"].selected=(i==@sprites["command_window"].index)
@sprites["button#{i}"].update
end
@sprites["overlay"]=BitmapSprite.new(
Graphics.width,Graphics.height,@viewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
@dateString=""
updateDateIfNecessary
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
pbDisposeSpriteHash(@sprites)
end
#-----------------------------------------------------------------------------
# update the date display if necessary
#-----------------------------------------------------------------------------
def updateDateIfNecessary
showSeconds = true # Make it false to won't show the seconds
newDate = pbGetTimeNow.strftime(showSeconds ? "%I:%M:%S %p" : "%I:%M %p")
return false if @dateString==newDate
@dateString=newDate
overlay=@sprites["overlay"].bitmap
overlay.clear
baseColor=Color.new(248,248,248)
shadowColor=Color.new(106,106,106)
textPositions=[
[@dateString,Graphics.width/2,-2,2,baseColor,shadowColor]]
pbDrawTextPositions(overlay,textPositions)
return true
end
#-----------------------------------------------------------------------------
# update the scene
#-----------------------------------------------------------------------------
def update
updateDateIfNecessary
for i in 0...@sprites["command_window"].commands.length
sprite=@sprites["button#{i}"]
sprite.selected=(i==@sprites["command_window"].index) ? true : false
end
pbUpdateSpriteHash(@sprites)
#update command window and the info if it's active
if @sprites["command_window"].active
update_command
return
end
end
#-----------------------------------------------------------------------------
# update the command window
#-----------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
pbPlayCancelSE()
$scene = Scene_Map.new
$game_switches[340] = false
return
end
if Input.trigger?(Input::C)
if @cmdMap>=0 && @sprites["command_window"].index==@cmdMap
pbPlayDecisionSE()
pbShowMap(-1,false)
end
if @cmdPhone>=0 && @sprites["command_window"].index==@cmdContacts
pbPlayDecisionSE()
pbFadeOutIn(99999) {
PokemonPhoneScene.new.start
}
end
if @cmdStorage>=0 && @sprites["command_window"].index==@cmdStorage
pbFadeOutIn(99999){
scene=PokemonStorageScene.new
screen=PokemonStorageScreen.new(scene,$PokemonStorage,false) # 3 parameters
screen.pbStartScreen(2)
}
end
if @cmdGames>=0 && @sprites["command_window"].index==@cmdGames
command=[]
list=[
_INTL("Voltorb Flip"),
_INTL("Slots"),
_INTL("Roulette"),
_INTL("Lucky Wheel"),
_INTL("Cancel")
]
command=Kernel.pbMessage(_INTL("What game do you want to play?"),list,0)
if command==0
pbFadeOutIn(99999) {
pbVoltorbFlip
}
elsif command==1
pbFadeOutIn(99999) {
pbSlotMachine(1)
}
elsif command==2
pbFadeOutIn(99999) {
pbRoulette(10)
}
elsif command==3
if rand(2)==0
pbFadeOutIn(99999) {
pbLuckyWheel(0)
}
else
if rand(2)==1
pbFadeOutIn(99999) {
pbLuckyWheel(1)
}
else
if rand(2)==2
pbFadeOutIn(99999) {
pbLuckyWheel(2)
}
else
pbFadeOutIn(99999) {
pbLuckyWheel(0)
}
end
end
end
elsif command==4
return
break
end
end
if @cmdJukebox>=0 && @sprites["command_window"].index==@cmdJukebox
pbPlayDecisionSE()
$scene = Scene_Jukebox.new
end
if @cmdGuideBook>=0 && @sprites["command_window"].index==@cmdGuideBook
$game_switches[340] = true
$scene = Scene_Pokegear.new
end
if @cmdLandmarks>=0 && @sprites["command_window"].index==@cmdLandmarks
pbPlayDecisionSE()
pbFadeOutIn(99999) {
LandmarksScene.new.start
}
end
if @cmdSightings>=0 && @sprites["command_window"].index==@cmdSightings
pbPlayDecisionSE()
pbFadeOutIn(99999) {
SightingsScene.new.start
}
end
if @cmdCases>=0 && @sprites["command_window"].index==@cmdCases
pbPlayDecisionSE()
pbFadeOutIn(99999) {
CasesScene.new.start
}
end
if @cmdBack>=0 && @sprites["command_window"].index==@cmdBack
$game_switches[340] = false
$scene = Scene_Pokegear.new
end
if @cmdVSHunter>=0 && @sprites["command_window"].index==@cmdVSHunter
pbPlayDecisionSE()
pbFadeOutIn(99999) {
pbWait(20)
break
}
$scene = Scene_Map.new
pbVSSeeker
end
if @cmdHudskins>=0 && @sprites["command_window"].index==@cmdHudskins #gearmod
if $game_switches[70] && $game_switches[460] && $game_switches[330]
command=[]
list=[
_INTL("Silver Version"),
_INTL("Gold Version"),
_INTL("Christmas Version"),
_INTL("Halloween Version"),
_INTL("Turn On"),
_INTL("Turn Off"),
_INTL("Cancel")
]
command=Kernel.pbMessage(_INTL("choose your HUD skin."),list,0)
if command==0
$game_variables[98]=0
elsif command==1
$game_variables[98]=1
elsif command==2
$game_variables[98]=2
elsif command==3
$game_variables[98]=3
elsif command==4
$game_switches[364]=true
elsif command==5
$game_switches[364]=false
elsif command==6
return
break
refreshPartyIcons
end
elsif $game_switches[70] && $game_switches[460]
command=[]
list=[
_INTL("Silver Version"),
_INTL("Gold Version"),
_INTL("Halloween Version"),
_INTL("Turn On"),
_INTL("Turn Off"),
_INTL("Cancel")
]
command=Kernel.pbMessage(_INTL("choose your HUD skin."),list,0)
if command==0
$game_variables[98]=0
elsif command==1
$game_variables[98]=1
elsif command==2
$game_variables[98]=3
elsif command==3
$game_switches[364]=true
elsif command==4
$game_switches[364]=false
elsif command==5
return
break
refreshPartyIcons
end
elsif $game_switches[70] && $game_switches[330]
command=[]
list=[
_INTL("Silver Version"),
_INTL("Gold Version"),
_INTL("Christmas Version"),
_INTL("Turn On"),
_INTL("Turn Off"),
_INTL("Cancel")
]
command=Kernel.pbMessage(_INTL("choose your HUD skin."),list,0)
if command==0
$game_variables[98]=0
elsif command==1
$game_variables[98]=1
elsif command==2
$game_variables[98]=2
elsif command==3
$game_switches[364]=true
elsif command==4
$game_switches[364]=false
elsif command==5
return
break
refreshPartyIcons
end
elsif $game_switches[70]
command=[]
list=[
_INTL("Silver Version"),
_INTL("Gold Version"),
_INTL("Turn On"),
_INTL("Turn Off"),
_INTL("Cancel")
]
command=Kernel.pbMessage(_INTL("choose your HUD skin."),list,0)
if command==0
$game_variables[98]=0
elsif command==1
$game_variables[98]=1
elsif command==2
$game_switches[364]=true
elsif command==3
$game_switches[364]=false
elsif command==4
return
break
refreshPartyIcons
end
else
end
$scene = Scene_Map.new
end
return
end
end
end