-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrawli-tts-storage.rb
More file actions
229 lines (220 loc) · 7.21 KB
/
crawli-tts-storage.rb
File metadata and controls
229 lines (220 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
class PokemonStorageScene
def pbSelectPartyInternal(party,depositing)
selection=@selection
pbPartySetArrow(@sprites["arrow"],selection)
pbUpdateOverlay(selection,party)
pbSetMosaic(selection)
lastsel=1
lastread = nil ### MODDED
loop do
Graphics.update
Input.update
key=-1
### MODDED/
if lastread != selection
if selection == 6 # Close Box
tts("Back")
end
lastread = selection
end
### /MODDED
key=Input::DOWN if Input.repeat?(Input::DOWN)
key=Input::RIGHT if Input.repeat?(Input::RIGHT)
key=Input::LEFT if Input.repeat?(Input::LEFT)
key=Input::UP if Input.repeat?(Input::UP)
if key>=0
pbPlayCursorSE()
newselection=pbPartyChangeSelection(key,selection)
if newselection==-1
return -1 if !depositing
elsif newselection==-2
selection=lastsel
else
selection=newselection
end
pbPartySetArrow(@sprites["arrow"],selection)
lastsel=selection if selection>0
pbUpdateOverlay(selection,party)
pbSetMosaic(selection)
end
pbUpdateSpriteHash(@sprites)
if Input.trigger?(Input::A) && @command==0 # Organize only
pbPlayDecisionSE
pbSetQuickSwap(!@quickswap)
elsif Input.trigger?(Input::C)
if selection>=0 && selection<6
@selection=selection
return selection
elsif selection==6 # Close Box
@selection=selection
return (depositing) ? -3 : -1
end
elsif Input.trigger?(Input::B)
@selection=selection
return -1
end
end
end
def pbUpdateOverlay(selection,party=nil)
overlay=@sprites["overlay"].bitmap
overlay.clear
pokemon=nil
if @screen.pbHeldPokemon
pokemon=@screen.pbHeldPokemon
elsif selection>=0
pokemon=(party) ? party[selection] : @storage[@storage.currentBox,selection]
end
if !pokemon
@sprites["pokemon"].visible=false
return
end
@sprites["pokemon"].visible=true
speciesname=getMonName(pokemon.species)
itemname="No item"
if !pokemon.item.nil?
itemname=getItemName(pokemon.item)
end
abilityname="No ability"
if !pokemon.ability.nil?
abilityname=getAbilityName(pokemon.ability)
end
base=Color.new(88,88,80)
shadow=Color.new(168,184,184)
pokename=pokemon.name
textstrings=[
[pokename,10,8,false,base,shadow]
]
if !pokemon.isEgg?
if pokemon.isMale?
textstrings.push([_INTL("♂"),148,8,false,Color.new(24,112,216),Color.new(136,168,208)])
elsif pokemon.isFemale?
textstrings.push([_INTL("♀"),148,8,false,Color.new(248,56,32),Color.new(224,152,144)])
end
textstrings.push([_INTL("{1}",pokemon.level),36,234,false,base,shadow])
textstrings.push([_INTL("{1}",abilityname),85,306,2,base,shadow])
textstrings.push([_INTL("{1}",itemname),85,342,2,base,shadow])
end
pbSetSystemFont(overlay)
pbDrawTextPositions(overlay,textstrings)
textstrings.clear
if !pokemon.isEgg?
textstrings.push([_INTL("Lv."),10,242,false,base,shadow])
end
pbSetSmallFont(overlay)
pbDrawTextPositions(overlay,textstrings)
if !pokemon.isEgg?
if pokemon.isShiny?
imagepos=[(["Graphics/Pictures/shiny",156,198,0,0,-1,-1])]
pbDrawImagePositions(overlay,imagepos)
end
typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
imagepos=[]
if pokemon.type2.nil?
imagepos.push([sprintf("Graphics/Icons/type%s",pokemon.type1),52,272,0,0,64,28])
else
imagepos.push([sprintf("Graphics/Icons/type%s",pokemon.type1),18,272,0,0,64,28])
imagepos.push([sprintf("Graphics/Icons/type%s",pokemon.type2),88,272,0,0,64,28])
end
pbDrawImagePositions(overlay,imagepos)
#type1rect=Rect.new(0,pokemon.type1*28,64,28)
# type2rect=Rect.new(0,pokemon.type2*28,64,28)
# if pokemon.type1==pokemon.type2
# overlay.blt(52,272,typebitmap.bitmap,type1rect)
# else
# overlay.blt(18,272,typebitmap.bitmap,type1rect)
# overlay.blt(88,272,typebitmap.bitmap,type2rect)
# end
end
drawMarkings(overlay,66,240,128,20,pokemon.markings)
@sprites["pokemon"].setPokemonBitmap(pokemon)
if pokemon.species == :EXEGGUTOR && pokemon.form == 1
pbPositionPokemonSprite(@sprites["pokemon"],26,70-97)
else
pbPositionPokemonSprite(@sprites["pokemon"],26,64)
end
tts(pbPokemonString(pokemon)) ### MODDED
end
def pbSelectBoxInternal(party)
selection=@selection
pbSetArrow(@sprites["arrow"],selection)
pbUpdateOverlay(selection)
pbSetMosaic(selection)
lastread = selection ### MODDED
loop do
Graphics.update
Input.update
### MODDED/
if lastread != selection
if selection == -1 # Box name
tts(@storage[@storage.currentBox].name)
elsif selection == -2 # Party Pokémon
tts("Party Pokémon")
elsif selection == -3 # Close Box
tts("Close box")
end
lastread = selection
end
### /MODDED
key=-1
key=Input::DOWN if Input.repeat?(Input::DOWN)
key=Input::RIGHT if Input.repeat?(Input::RIGHT)
key=Input::LEFT if Input.repeat?(Input::LEFT)
key=Input::UP if Input.repeat?(Input::UP)
if key>=0
pbPlayCursorSE()
selection=pbChangeSelection(key,selection)
pbSetArrow(@sprites["arrow"],selection)
nextbox=-1
if selection==-4
nextbox=(@storage.currentBox==0) ? @storage.maxBoxes-1 : @storage.currentBox-1
pbSwitchBoxToLeft(nextbox)
@storage.currentBox=nextbox
tts(@storage[@storage.currentBox].name) ### MODDED
selection=-1
elsif selection==-5
nextbox=(@storage.currentBox==@storage.maxBoxes-1) ? 0 : @storage.currentBox+1
pbSwitchBoxToRight(nextbox)
@storage.currentBox=nextbox
tts(@storage[@storage.currentBox].name) ### MODDED
selection=-1
end
selection=-1 if selection==-4 || selection==-5
pbUpdateOverlay(selection)
pbSetMosaic(selection)
end
pbUpdateSpriteHash(@sprites)
if Input.trigger?(Input::A) && @command==0 # Organize only
pbPlayDecisionSE
pbSetQuickSwap(!@quickswap)
elsif Input.trigger?(Input::C)
if selection>=0
@selection=selection
return [@storage.currentBox,selection]
elsif selection==-1 # Box name
@selection=selection
return [-4,-1]
elsif selection==-2 # Party Pokémon
@selection=selection
return [-2,-1]
elsif selection==-3 # Close Box
@selection=selection
return [-3,-1]
end
end
if Input.trigger?(Input::B)
@selection=selection
return nil
end
end
end
alias :crawlittsstorage_old_pbShowCommands :pbShowCommands
def pbShowCommands(message,commands,index=0)
tts(message)
return crawlittsstorage_old_pbShowCommands(message,commands,index)
end
alias :crawlittsstorage_old_pbDisplay :pbDisplay
def pbDisplay(message)
tts(message)
return crawlittsstorage_old_pbDisplay(message)
end
end