Created and implemented GameData::Type

This commit is contained in:
Maruno17
2020-12-12 21:26:46 +00:00
parent c8790bafc9
commit bc13517cb7
50 changed files with 698 additions and 784 deletions

View File

@@ -328,7 +328,7 @@ class PokemonPokedex_Scene
form = $Trainer.formlastseen[nationalSpecies][1] || 0
fspecies = pbGetFSpeciesFromForm(nationalSpecies,form)
color = speciesData[fspecies][SpeciesData::COLOR] || 0
type1 = speciesData[fspecies][SpeciesData::TYPE1] || 0
type1 = speciesData[fspecies][SpeciesData::TYPE1]
type2 = speciesData[fspecies][SpeciesData::TYPE2] || type1
shape = speciesData[fspecies][SpeciesData::SHAPE] || 0
height = speciesData[fspecies][SpeciesData::HEIGHT] || 1
@@ -466,13 +466,15 @@ class PokemonPokedex_Scene
textpos.push([(params[8]<0) ? "----" : @colorCommands[params[8]],444,118,2,base,shadow,1])
# Draw type icons
if params[2]>=0
typerect = Rect.new(0,@typeCommands[params[2]]*32,96,32)
type_number = @typeCommands[params[2]].id_number
typerect = Rect.new(0,type_number*32,96,32)
overlay.blt(128,168,@typebitmap.bitmap,typerect)
else
textpos.push(["----",176,170,2,base,shadow,1])
end
if params[3]>=0
typerect = Rect.new(0,@typeCommands[params[3]]*32,96,32)
type_number = @typeCommands[params[3]].id_number
typerect = Rect.new(0,type_number*32,96,32)
overlay.blt(256,168,@typebitmap.bitmap,typerect)
else
textpos.push(["----",304,170,2,base,shadow,1])
@@ -562,7 +564,8 @@ class PokemonPokedex_Scene
if !sel[i] || sel[i]<0
textpos.push(["----",298+128*i,58,2,base,shadow,1])
else
typerect = Rect.new(0,@typeCommands[sel[i]]*32,96,32)
type_number = @typeCommands[sel[i]].id_number
typerect = Rect.new(0,type_number*32,96,32)
overlay.blt(250+128*i,58,@typebitmap.bitmap,typerect)
end
end
@@ -658,7 +661,7 @@ class PokemonPokedex_Scene
when 2 # Type
typerect = Rect.new(0,0,96,32)
for i in 0...cmds.length
typerect.y = @typeCommands[i]*32
typerect.y = @typeCommands[i].id_number*32
overlay.blt(xstart+14+(i%cols)*xgap,ystart+6+(i/cols).floor*ygap,@typebitmap.bitmap,typerect)
end
textpos.push(["----",
@@ -694,19 +697,19 @@ class PokemonPokedex_Scene
end
# Filter by type
if params[2]>=0 || params[3]>=0
stype1 = (params[2]>=0) ? @typeCommands[params[2]] : -1
stype2 = (params[3]>=0) ? @typeCommands[params[3]] : -1
stype1 = (params[2]>=0) ? @typeCommands[params[2]].id : nil
stype2 = (params[3]>=0) ? @typeCommands[params[3]].id : nil
dexlist = dexlist.find_all { |item|
next false if !$Trainer.owned[item[0]]
type1 = item[6]
type2 = item[7]
if stype1>=0 && stype2>=0
if stype1 && stype2
# Find species that match both types
next (type1==stype1 && type2==stype2) || (type1==stype2 && type2==stype1)
elsif stype1>=0
elsif stype1
# Find species that match first type entered
next type1==stype1 || type2==stype1
elsif stype2>=0
elsif stype2
# Find species that match second type entered
next type1==stype2 || type2==stype2
else
@@ -1000,9 +1003,8 @@ class PokemonPokedex_Scene
_INTL("U"),_INTL("V"),_INTL("W"),_INTL("X"),_INTL("Y"),
_INTL("Z")]
@typeCommands = []
for i in 0..PBTypes.maxValue
@typeCommands.push(i) if !PBTypes.isPseudoType?(i)
end
GameData::Type.each { |t| @typeCommands.push(t) if !t.pseudo_type }
@typeCommands.sort! { |a, b| a.id_number <=> b.id_number }
@heightCommands = [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,30,35,40,45,50,