summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconstants/sprite_constants.asm67
-rwxr-xr-xdata/mapObjects/celadonmart3.asm6
-rwxr-xr-xdata/mapObjects/route2house.asm2
-rwxr-xr-xdata/mon_party_sprites.asm152
-rwxr-xr-xdata/sprite_sets.asm104
-rwxr-xr-xengine/load_pokedex_tiles.asm4
-rwxr-xr-xengine/overworld/map_sprites.asm594
-rw-r--r--home.asm2
-rw-r--r--home/overworld.asm2
-rw-r--r--replace.sh2
-rwxr-xr-xwram.asm4
-rwxr-xr-xyellow/main.asm8
12 files changed, 458 insertions, 489 deletions
diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm
index 68fb8488..ae0c9dfa 100755
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -1,17 +1,17 @@
; pokemon's overworld sprites
const_value = 0
- const SPRITE_MON ; $0
- const SPRITE_BALL_M ; $1
- const SPRITE_HELIX ; $2
- const SPRITE_FAIRY ; $3
- const SPRITE_BIRD_M ; $4
- const SPRITE_WATER ; $5
- const SPRITE_BUG ; $6
- const SPRITE_GRASS ; $7
- const SPRITE_SNAKE ; $8
- const SPRITE_QUADRUPED ; $9
- const SPRITE_PIKACHU ; $A
+ const SPRITE_MON ; $0
+ const SPRITE_BALL_M ; $1
+ const SPRITE_HELIX ; $2
+ const SPRITE_FAIRY ; $3
+ const SPRITE_BIRD_M ; $4
+ const SPRITE_WATER ; $5
+ const SPRITE_BUG ; $6
+ const SPRITE_GRASS ; $7
+ const SPRITE_SNAKE ; $8
+ const SPRITE_QUADRUPED ; $9
+ const SPRITE_PIKACHU_FAMILY ; $A
; overworld sprites
const_value = 1
@@ -45,7 +45,7 @@ const_value = 1
const SPRITE_MOM_GEISHA ; $1c
const SPRITE_BRUNETTE_GIRL ; $1d
const SPRITE_LANCE ; $1e
- const SPRITE_OAK_SCIENTIST_AIDE ; $1f
+ const SPRITE_UNUSED_1 ; $1f
const SPRITE_OAK_AIDE ; $20
const SPRITE_ROCKER ; $21
const SPRITE_SWIMMER ; $22
@@ -64,32 +64,39 @@ const_value = 1
const SPRITE_FISHER2 ; $2f
const SPRITE_BLACKBELT ; $30
const SPRITE_GUARD ; $31
- const SPRITE_COP_GUARD ; $32
+ const SPRITE_UNUSED_2 ; $32
const SPRITE_MOM ; $33
const SPRITE_BALDING_GUY ; $34
const SPRITE_YOUNG_BOY ; $35
- const SPRITE_GAMEBOY_KID ; $36
- const SPRITE_GAMEBOY_KID_COPY ; $37
+ const SPRITE_UNUSED_3 ; $36
+ const SPRITE_GAMEBOY_KID ; $37
const SPRITE_CLEFAIRY ; $38
const SPRITE_AGATHA ; $39
const SPRITE_BRUNO ; $3a
const SPRITE_LORELEI ; $3b
const SPRITE_SEEL ; $3c
- const SPRITE_BALL ; $3d
- const SPRITE_OMANYTE ; $3e
- const SPRITE_BOULDER ; $3f
- const SPRITE_PAPER_SHEET ; $40
- const SPRITE_BOOK_MAP_DEX ; $41
- const SPRITE_CLIPBOARD ; $42
- const SPRITE_SNORLAX ; $43
- const SPRITE_OLD_AMBER_COPY ; $44
- const SPRITE_OLD_AMBER ; $45
- const SPRITE_LYING_OLD_MAN_UNUSED_1 ; $46
- const SPRITE_LYING_OLD_MAN_UNUSED_2 ; $47
- const SPRITE_LYING_OLD_MAN ; $48
-
-SPRITE_JESSIE EQU $45
-SPRITE_JAMES EQU $46
+ const SPRITE_PIKACHU ; $3d
+ const SPRITE_OFFICER_JENNY ; $3e
+ const SPRITE_SANDSHREW ; $3f
+ const SPRITE_ODDISH ; $40
+ const SPRITE_BULBASAUR ; $41
+ const SPRITE_JIGGLYPUFF ; $42
+ const SPRITE_CLEFAIRY_2 ; $43
+ const SPRITE_CHANSEY ; $44
+ const SPRITE_JESSIE ; $45
+ const SPRITE_JAMES ; $46
+ const SPRITE_BALL ; $47
+ const SPRITE_OMANYTE ; $48
+ const SPRITE_BOULDER ; $49
+ const SPRITE_PAPER_SHEET ; $4a
+ const SPRITE_BOOK_MAP_DEX ; $4b
+ const SPRITE_CLIPBOARD ; $4c
+ const SPRITE_SNORLAX ; $4d
+ const SPRITE_OLD_AMBER_COPY ; $4e
+ const SPRITE_OLD_AMBER ; $4f
+ const SPRITE_LYING_OLD_MAN_UNUSED_1 ; $50
+ const SPRITE_LYING_OLD_MAN_UNUSED_2 ; $51
+ const SPRITE_LYING_OLD_MAN ; $52
; different kinds of people events
ITEM EQU $80
diff --git a/data/mapObjects/celadonmart3.asm b/data/mapObjects/celadonmart3.asm
index 5e11a62c..36760d25 100755
--- a/data/mapObjects/celadonmart3.asm
+++ b/data/mapObjects/celadonmart3.asm
@@ -22,9 +22,9 @@ CeladonMart3Object: ; 0x482c4 (size=94)
db $5 ; objects
object SPRITE_MART_GUY, $10, $5, STAY, NONE, $1 ; person
- object SPRITE_GAMEBOY_KID_COPY, $b, $6, STAY, RIGHT, $2 ; person
- object SPRITE_GAMEBOY_KID_COPY, $7, $2, STAY, DOWN, $3 ; person
- object SPRITE_GAMEBOY_KID_COPY, $8, $2, STAY, DOWN, $4 ; person
+ object SPRITE_GAMEBOY_KID, $b, $6, STAY, RIGHT, $2 ; person
+ object SPRITE_GAMEBOY_KID, $7, $2, STAY, DOWN, $3 ; person
+ object SPRITE_GAMEBOY_KID, $8, $2, STAY, DOWN, $4 ; person
object SPRITE_YOUNG_BOY, $2, $5, STAY, UP, $5 ; person
; warp-to
diff --git a/data/mapObjects/route2house.asm b/data/mapObjects/route2house.asm
index b8d6d20f..463d9a1a 100755
--- a/data/mapObjects/route2house.asm
+++ b/data/mapObjects/route2house.asm
@@ -9,7 +9,7 @@ Route2HouseObject: ; 0x1df07 (size=32)
db $2 ; objects
object SPRITE_OAK_AIDE, $2, $4, STAY, RIGHT, $1 ; person
- object SPRITE_GAMEBOY_KID_COPY, $4, $1, STAY, DOWN, $2 ; person
+ object SPRITE_GAMEBOY_KID, $4, $1, STAY, DOWN, $2 ; person
; warp-to
EVENT_DISP ROUTE_2_HOUSE_WIDTH, $7, $2
diff --git a/data/mon_party_sprites.asm b/data/mon_party_sprites.asm
index dde8cdb4..017c8d7c 100755
--- a/data/mon_party_sprites.asm
+++ b/data/mon_party_sprites.asm
@@ -10,79 +10,79 @@ MonPartyData: ; 719ba (1c:59ba)
; SNAKE = 8
; QUADRUPED = 9
; PIKACHU = A
- dn SPRITE_GRASS, SPRITE_GRASS ;Bulbasaur/Ivysaur
- dn SPRITE_GRASS, SPRITE_MON ;Venusaur/Charmander
- dn SPRITE_MON, SPRITE_MON ;Charmeleon/Charizard
- dn SPRITE_WATER, SPRITE_WATER ;Squirtle/Wartortle
- dn SPRITE_WATER, SPRITE_BUG ;Blastoise/Caterpie
- dn SPRITE_BUG, SPRITE_BUG ;Metapod/Butterfree
- dn SPRITE_BUG, SPRITE_BUG ;Weedle/Kakuna
- dn SPRITE_BUG, SPRITE_BIRD_M ;Beedrill/Pidgey
- dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Pidgeotto/Pidgeot
- dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Rattata/Raticate
- dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Spearow/Fearow
- dn SPRITE_SNAKE, SPRITE_SNAKE ;Ekans/Arbok
- dn SPRITE_PIKACHU, SPRITE_PIKACHU ;Pikachu/Raichu
- dn SPRITE_MON, SPRITE_MON ;Sandshrew/Sandslash
- dn SPRITE_MON, SPRITE_MON ;NidoranF/Nidorina
- dn SPRITE_MON, SPRITE_MON ;Nidoqueen/NidoranM
- dn SPRITE_MON, SPRITE_MON ;Nidorino/Nidoking
- dn SPRITE_FAIRY, SPRITE_FAIRY ;Clefairy/Clefable
- dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Vulpix/Ninetales
- dn SPRITE_FAIRY, SPRITE_FAIRY ;Jigglypuff/Wigglytuff
- dn SPRITE_MON, SPRITE_MON ;Zubat/Golbat
- dn SPRITE_GRASS, SPRITE_GRASS ;Oddish/Gloom
- dn SPRITE_GRASS, SPRITE_BUG ;Vileplume/Paras
- dn SPRITE_BUG, SPRITE_BUG ;Parasect/Venonat
- dn SPRITE_BUG, SPRITE_MON ;Venomoth/Diglett
- dn SPRITE_MON, SPRITE_MON ;Dugtrio/Meowth
- dn SPRITE_MON, SPRITE_MON ;Persian/Psyduck
- dn SPRITE_MON, SPRITE_MON ;Golduck/Mankey
- dn SPRITE_MON, SPRITE_QUADRUPED ;Primeape/Growlithe
- dn SPRITE_QUADRUPED, SPRITE_MON ;Arcanine/Poliwag
- dn SPRITE_MON, SPRITE_MON ;Poliwhirl/Poliwrath
- dn SPRITE_MON, SPRITE_MON ;Abra/Kadabra
- dn SPRITE_MON, SPRITE_MON ;Alakazam/Machop
- dn SPRITE_MON, SPRITE_MON ;Machoke/Machamp
- dn SPRITE_GRASS, SPRITE_GRASS ;Bellsprout/Weepinbell
- dn SPRITE_GRASS, SPRITE_WATER ;Victreebel/Tentacool
- dn SPRITE_WATER, SPRITE_MON ;Tentacruel/Geodude
- dn SPRITE_MON, SPRITE_MON ;Graveler/Golem
- dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Ponyta/Rapidash
- dn SPRITE_QUADRUPED, SPRITE_MON ;Slowpoke/Slowbro
- dn SPRITE_BALL_M, SPRITE_BALL_M ;Magnemite/Magneton
- dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Farfetch'd/Doduo
- dn SPRITE_BIRD_M, SPRITE_WATER ;Dodrio/Seel
- dn SPRITE_WATER, SPRITE_MON ;Dewgong/Grimer
- dn SPRITE_MON, SPRITE_HELIX ;Muk/Shellder
- dn SPRITE_HELIX, SPRITE_MON ;Cloyster/Gastly
- dn SPRITE_MON, SPRITE_MON ;Haunter/Gengar
- dn SPRITE_SNAKE, SPRITE_MON ;Onix/Drowzee
- dn SPRITE_MON, SPRITE_WATER ;Hypno/Krabby
- dn SPRITE_WATER, SPRITE_BALL_M ;Kingler/Voltorb
- dn SPRITE_BALL_M, SPRITE_GRASS ;Electrode/Exeggcute
- dn SPRITE_GRASS, SPRITE_MON ;Exeggutor/Cubone
- dn SPRITE_MON, SPRITE_MON ;Marowak/Hitmonlee
- dn SPRITE_MON, SPRITE_MON ;Hitmonchan/Lickitung
- dn SPRITE_MON, SPRITE_MON ;Koffing/Weezing
- dn SPRITE_QUADRUPED, SPRITE_MON ;Rhyhorn/Rhydon
- dn SPRITE_FAIRY, SPRITE_GRASS ;Chansey/Tangela
- dn SPRITE_MON, SPRITE_WATER ;Kangaskhan/Horsea
- dn SPRITE_WATER, SPRITE_WATER ;Seadra/Goldeen
- dn SPRITE_WATER, SPRITE_HELIX ;Seaking/Staryu
- dn SPRITE_HELIX, SPRITE_MON ;Starmie/Mr.Mime
- dn SPRITE_BUG, SPRITE_MON ;Scyther/Jynx
- dn SPRITE_MON, SPRITE_MON ;Electabuzz/Magmar
- dn SPRITE_BUG, SPRITE_QUADRUPED ;Pinsir/Tauros
- dn SPRITE_WATER, SPRITE_SNAKE ;Magikarp/Gyarados
- dn SPRITE_WATER, SPRITE_MON ;Lapras/Ditto
- dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Eevee/Vaporeon
- dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Jolteon/Flareon
- dn SPRITE_MON, SPRITE_HELIX ;Porygon/Omanyte
- dn SPRITE_HELIX, SPRITE_HELIX ;Omastar/Kabuto
- dn SPRITE_HELIX, SPRITE_BIRD_M ;Kabutops/Aerodactyl
- dn SPRITE_MON, SPRITE_BIRD_M ;Snorlax/Articuno
- dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Zapdos/Moltres
- dn SPRITE_SNAKE, SPRITE_SNAKE ;Dratini/Dragonair
- dn SPRITE_SNAKE, SPRITE_MON ;Dragonite/Mewtwo
- dn SPRITE_MON, 0 ;Mew/Padding
+ dn SPRITE_GRASS, SPRITE_GRASS ;Bulbasaur/Ivysaur
+ dn SPRITE_GRASS, SPRITE_MON ;Venusaur/Charmander
+ dn SPRITE_MON, SPRITE_MON ;Charmeleon/Charizard
+ dn SPRITE_WATER, SPRITE_WATER ;Squirtle/Wartortle
+ dn SPRITE_WATER, SPRITE_BUG ;Blastoise/Caterpie
+ dn SPRITE_BUG, SPRITE_BUG ;Metapod/Butterfree
+ dn SPRITE_BUG, SPRITE_BUG ;Weedle/Kakuna
+ dn SPRITE_BUG, SPRITE_BIRD_M ;Beedrill/Pidgey
+ dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Pidgeotto/Pidgeot
+ dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Rattata/Raticate
+ dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Spearow/Fearow
+ dn SPRITE_SNAKE, SPRITE_SNAKE ;Ekans/Arbok
+ dn SPRITE_PIKACHU_FAMILY, SPRITE_PIKACHU_FAMILY ;Pikachu/Raichu
+ dn SPRITE_MON, SPRITE_MON ;Sandshrew/Sandslash
+ dn SPRITE_MON, SPRITE_MON ;NidoranF/Nidorina
+ dn SPRITE_MON, SPRITE_MON ;Nidoqueen/NidoranM
+ dn SPRITE_MON, SPRITE_MON ;Nidorino/Nidoking
+ dn SPRITE_FAIRY, SPRITE_FAIRY ;Clefairy/Clefable
+ dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Vulpix/Ninetales
+ dn SPRITE_FAIRY, SPRITE_FAIRY ;Jigglypuff/Wigglytuff
+ dn SPRITE_MON, SPRITE_MON ;Zubat/Golbat
+ dn SPRITE_GRASS, SPRITE_GRASS ;Oddish/Gloom
+ dn SPRITE_GRASS, SPRITE_BUG ;Vileplume/Paras
+ dn SPRITE_BUG, SPRITE_BUG ;Parasect/Venonat
+ dn SPRITE_BUG, SPRITE_MON ;Venomoth/Diglett
+ dn SPRITE_MON, SPRITE_MON ;Dugtrio/Meowth
+ dn SPRITE_MON, SPRITE_MON ;Persian/Psyduck
+ dn SPRITE_MON, SPRITE_MON ;Golduck/Mankey
+ dn SPRITE_MON, SPRITE_QUADRUPED ;Primeape/Growlithe
+ dn SPRITE_QUADRUPED, SPRITE_MON ;Arcanine/Poliwag
+ dn SPRITE_MON, SPRITE_MON ;Poliwhirl/Poliwrath
+ dn SPRITE_MON, SPRITE_MON ;Abra/Kadabra
+ dn SPRITE_MON, SPRITE_MON ;Alakazam/Machop
+ dn SPRITE_MON, SPRITE_MON ;Machoke/Machamp
+ dn SPRITE_GRASS, SPRITE_GRASS ;Bellsprout/Weepinbell
+ dn SPRITE_GRASS, SPRITE_WATER ;Victreebel/Tentacool
+ dn SPRITE_WATER, SPRITE_MON ;Tentacruel/Geodude
+ dn SPRITE_MON, SPRITE_MON ;Graveler/Golem
+ dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Ponyta/Rapidash
+ dn SPRITE_QUADRUPED, SPRITE_MON ;Slowpoke/Slowbro
+ dn SPRITE_BALL_M, SPRITE_BALL_M ;Magnemite/Magneton
+ dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Farfetch'd/Doduo
+ dn SPRITE_BIRD_M, SPRITE_WATER ;Dodrio/Seel
+ dn SPRITE_WATER, SPRITE_MON ;Dewgong/Grimer
+ dn SPRITE_MON, SPRITE_HELIX ;Muk/Shellder
+ dn SPRITE_HELIX, SPRITE_MON ;Cloyster/Gastly
+ dn SPRITE_MON, SPRITE_MON ;Haunter/Gengar
+ dn SPRITE_SNAKE, SPRITE_MON ;Onix/Drowzee
+ dn SPRITE_MON, SPRITE_WATER ;Hypno/Krabby
+ dn SPRITE_WATER, SPRITE_BALL_M ;Kingler/Voltorb
+ dn SPRITE_BALL_M, SPRITE_GRASS ;Electrode/Exeggcute
+ dn SPRITE_GRASS, SPRITE_MON ;Exeggutor/Cubone
+ dn SPRITE_MON, SPRITE_MON ;Marowak/Hitmonlee
+ dn SPRITE_MON, SPRITE_MON ;Hitmonchan/Lickitung
+ dn SPRITE_MON, SPRITE_MON ;Koffing/Weezing
+ dn SPRITE_QUADRUPED, SPRITE_MON ;Rhyhorn/Rhydon
+ dn SPRITE_FAIRY, SPRITE_GRASS ;Chansey/Tangela
+ dn SPRITE_MON, SPRITE_WATER ;Kangaskhan/Horsea
+ dn SPRITE_WATER, SPRITE_WATER ;Seadra/Goldeen
+ dn SPRITE_WATER, SPRITE_HELIX ;Seaking/Staryu
+ dn SPRITE_HELIX, SPRITE_MON ;Starmie/Mr.Mime
+ dn SPRITE_BUG, SPRITE_MON ;Scyther/Jynx
+ dn SPRITE_MON, SPRITE_MON ;Electabuzz/Magmar
+ dn SPRITE_BUG, SPRITE_QUADRUPED ;Pinsir/Tauros
+ dn SPRITE_WATER, SPRITE_SNAKE ;Magikarp/Gyarados
+ dn SPRITE_WATER, SPRITE_MON ;Lapras/Ditto
+ dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Eevee/Vaporeon
+ dn SPRITE_QUADRUPED, SPRITE_QUADRUPED ;Jolteon/Flareon
+ dn SPRITE_MON, SPRITE_HELIX ;Porygon/Omanyte
+ dn SPRITE_HELIX, SPRITE_HELIX ;Omastar/Kabuto
+ dn SPRITE_HELIX, SPRITE_BIRD_M ;Kabutops/Aerodactyl
+ dn SPRITE_MON, SPRITE_BIRD_M ;Snorlax/Articuno
+ dn SPRITE_BIRD_M, SPRITE_BIRD_M ;Zapdos/Moltres
+ dn SPRITE_SNAKE, SPRITE_SNAKE ;Dratini/Dragonair
+ dn SPRITE_SNAKE, SPRITE_MON ;Dragonite/Mewtwo
+ dn SPRITE_MON, 0 ;Mew/Padding \ No newline at end of file
diff --git a/data/sprite_sets.asm b/data/sprite_sets.asm
index c5e2d29e..e529b506 100755
--- a/data/sprite_sets.asm
+++ b/data/sprite_sets.asm
@@ -1,4 +1,4 @@
-MapSpriteSets: ; 17a64 (5:7a64)
+MapSpriteSets: ; 141e6 (5:41e6)
db $01 ; PALLET_TOWN
db $01 ; VIRIDIAN_CITY
db $02 ; PEWTER_CITY
@@ -44,7 +44,7 @@ MapSpriteSets: ; 17a64 (5:7a64)
; 01: coordinate of dividing line
; 02: sprite set ID if in the West or North side
; 03: sprite set ID if in the East or South side
-SplitMapSpriteSets: ; 17a89 (5:7a89)
+SplitMapSpriteSets: ; 1402b (5:420b)
db $02,$25,$02,$01 ; $f1
db $02,$32,$02,$03 ; $f2
db $01,$39,$04,$08 ; $f3
@@ -58,34 +58,35 @@ SplitMapSpriteSets: ; 17a89 (5:7a89)
db $01,$11,$05,$07 ; $fb
db $01,$03,$07,$03 ; $fc
-SpriteSets: ; 17ab9 (5:7ab9)
+SpriteSets: ; 1423d (5:423d)
; sprite set $01
+ db SPRITE_PIKACHU
db SPRITE_BLUE
db SPRITE_BUG_CATCHER
db SPRITE_GIRL
db SPRITE_FISHER2
db SPRITE_BLACK_HAIR_BOY_1
db SPRITE_GAMBLER
- db SPRITE_SEEL
db SPRITE_OAK
db SPRITE_SWIMMER
db SPRITE_BALL
db SPRITE_LYING_OLD_MAN
; sprite set $02
+ db SPRITE_PIKACHU
db SPRITE_BUG_CATCHER
db SPRITE_ROCKET
db SPRITE_BLACK_HAIR_BOY_2
db SPRITE_HIKER
- db SPRITE_SLOWBRO
db SPRITE_BLUE
- db SPRITE_GUARD
+ db SPRITE_OFFICER_JENNY
db SPRITE_LASS
db SPRITE_BLACK_HAIR_BOY_1
db SPRITE_BALL
db SPRITE_LYING_OLD_MAN_UNUSED_2
; sprite set $03
+ db SPRITE_PIKACHU
db SPRITE_LITTLE_GIRL
db SPRITE_GIRL
db SPRITE_BLACK_HAIR_BOY_2
@@ -94,17 +95,16 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_SLOWBRO
db SPRITE_LASS
db SPRITE_BLACK_HAIR_BOY_1
- db SPRITE_GUARD
db SPRITE_BALL
db SPRITE_LYING_OLD_MAN_UNUSED_2
; sprite set $04
- db SPRITE_FOULARD_WOMAN
+ db SPRITE_PIKACHU
+ db SPRITE_OFFICER_JENNY
db SPRITE_BLACK_HAIR_BOY_2
db SPRITE_BUG_CATCHER
db SPRITE_GAMBLER
db SPRITE_SLOWBRO
- db SPRITE_GUARD
db SPRITE_SAILOR
db SPRITE_LASS
db SPRITE_BLACK_HAIR_BOY_1
@@ -112,6 +112,7 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_LYING_OLD_MAN_UNUSED_2
; sprite set $05
+ db SPRITE_PIKACHU
db SPRITE_LITTLE_GIRL
db SPRITE_YOUNG_BOY
db SPRITE_GIRL
@@ -119,13 +120,12 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_FAT_BALD_GUY
db SPRITE_OLD_PERSON
db SPRITE_SLOWBRO
- db SPRITE_GUARD
db SPRITE_ROCKET
db SPRITE_BALL
db SPRITE_SNORLAX
; sprite set $06
- db SPRITE_BUG_CATCHER
+ db SPRITE_PIKACHU
db SPRITE_GYM_HELPER
db SPRITE_SLOWBRO
db SPRITE_BLUE
@@ -138,6 +138,7 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_LYING_OLD_MAN_UNUSED_2
; sprite set $07
+ db SPRITE_PIKACHU
db SPRITE_ROCKET
db SPRITE_OAK_AIDE
db SPRITE_LAPRAS_GIVER
@@ -146,11 +147,11 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_BIRD
db SPRITE_ROCKER
db SPRITE_BLACK_HAIR_BOY_1
- db SPRITE_SLOWBRO
db SPRITE_BALL
db SPRITE_LYING_OLD_MAN_UNUSED_2
; sprite set $08
+ db SPRITE_PIKACHU
db SPRITE_BIKER
db SPRITE_BLACK_HAIR_BOY_2
db SPRITE_FAT_BALD_GUY
@@ -159,11 +160,11 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_FOULARD_WOMAN
db SPRITE_FISHER2
db SPRITE_ROCKER
- db SPRITE_SLOWBRO
db SPRITE_BALL
db SPRITE_SNORLAX
; sprite set $09
+ db SPRITE_PIKACHU
db SPRITE_BIKER
db SPRITE_BLACK_HAIR_BOY_1
db SPRITE_LAPRAS_GIVER
@@ -172,14 +173,13 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_HIKER
db SPRITE_GAMBLER
db SPRITE_FAT_BALD_GUY
- db SPRITE_BLACK_HAIR_BOY_2
db SPRITE_BALL
db SPRITE_SNORLAX
; sprite set $0a
- db SPRITE_BIRD
+ db SPRITE_PIKACHU
db SPRITE_BLACK_HAIR_BOY_1
- db SPRITE_CLEFAIRY
+ db SPRITE_CHANSEY
db SPRITE_FISHER2
db SPRITE_GAMBLER
db SPRITE_SLOWBRO
@@ -189,7 +189,7 @@ SpriteSets: ; 17ab9 (5:7ab9)
db SPRITE_BALL
db SPRITE_OMANYTE
-SpriteSheetPointerTable: ; 17b27 (5:7b27)
+SpriteSheetPointerTable: ; 142a9 (5:42a9)
; SPRITE_RED
dw RedSprite
db $c0 ; byte count
@@ -340,10 +340,10 @@ SpriteSheetPointerTable: ; 17b27 (5:7b27)
db $c0 ; byte count
db BANK(LanceSprite)
- ; SPRITE_OAK_SCIENTIST_AIDE
- dw OakAideSprite
+ ; SPRITE_UNUSED_1
+ dw RedSprite
db $c0 ; byte count
- db BANK(OakAideSprite)
+ db BANK(RedSprite)
; SPRITE_OAK_AIDE
dw OakAideSprite
@@ -435,10 +435,10 @@ SpriteSheetPointerTable: ; 17b27 (5:7b27)
db $c0 ; byte count
db BANK(GuardSprite)
- ; $32
- dw GuardSprite
+ ; SPRITE_UNUSED_2
+ dw RedSprite
db $c0 ; byte count
- db BANK(GuardSprite)
+ db BANK(RedSprite)
; SPRITE_MOM
dw MomSprite
@@ -455,12 +455,12 @@ SpriteSheetPointerTable: ; 17b27 (5:7b27)
db $c0 ; byte count
db BANK(YoungBoySprite)
- ; SPRITE_GAMEBOY_KID
- dw GameboyKidSprite
+ ; SPRITE_UNUSED_3
+ dw RedSprite
db $c0 ; byte count
- db BANK(GameboyKidSprite)
+ db BANK(RedSprite)
- ; SPRITE_GAMEBOY_KID_COPY
+ ; SPRITE_GAMEBOY_KID
dw GameboyKidSprite
db $c0 ; byte count
db BANK(GameboyKidSprite)
@@ -490,6 +490,56 @@ SpriteSheetPointerTable: ; 17b27 (5:7b27)
db $c0 ; byte count
db BANK(SeelSprite)
+ ; SPRITE_PIKACHU
+ dw PikachuSprite
+ db $c0
+ db BANK(PikachuSprite)
+
+ ; SPRITE_OFFICER_JENNY
+ dw OfficerJennySprite
+ db $c0
+ db BANK(OfficerJennySprite)
+
+ ; SPRITE_SANDSHREW
+ dw SandshrewSprite
+ db $c0
+ db BANK(SandshrewSprite)
+
+ ; SPRITE_ODDISH
+ dw OddishSprite
+ db $c0
+ db BANK(OddishSprite)
+
+ ; SPRITE_BULBASAUR
+ dw BulbasaurSprite
+ db $c0
+ db BANK(BulbasaurSprite)
+
+ ; SPRITE_JIGGLYPUFF
+ dw JigglypuffSprite
+ db $c0
+ db BANK(JigglypuffSprite)
+
+ ; SPRITE_CLEFAIRY_2
+ dw Clefairy2Sprite
+ db $c0
+ db BANK(Clefairy2Sprite)
+
+ ; SPRITE_CHANSEY
+ dw ChanseySprite
+ db $c0
+ db BANK(ChanseySprite)
+
+ ; SPRITE_JESSIE
+ dw JessieSprite
+ db $c0
+ db BANK(JessieSprite)
+
+ ; SPRITE_JAMES
+ dw JamesSprite
+ db $c0
+ db BANK(JamesSprite)
+
; SPRITE_BALL
dw BallSprite
db $40 ; byte count
diff --git a/engine/load_pokedex_tiles.asm b/engine/load_pokedex_tiles.asm
index 1189d2f0..43d87f09 100755
--- a/engine/load_pokedex_tiles.asm
+++ b/engine/load_pokedex_tiles.asm
@@ -1,5 +1,5 @@
; Loads tile patterns for tiles used in the pokedex.
-LoadPokedexTilePatterns: ; 17840 (5:7840)
+LoadPokedexTilePatterns: ; 14000 (5:4000)
call LoadHpBarAndStatusTilePatterns
ld de,PokedexTileGraphics
ld hl,vChars2 + $600
@@ -8,4 +8,4 @@ LoadPokedexTilePatterns: ; 17840 (5:7840)
ld de,PokeballTileGraphics
ld hl,vChars2 + $720
lb bc, BANK(PokeballTileGraphics), $01
- jp CopyVideoData ; load pokeball tile for marking caught mons
+ jp CopyVideoData ; load pokeball tile for marking caught mons \ No newline at end of file
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index c5658dc0..07425a1b 100755
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -8,337 +8,49 @@
; fields, respectively, within loops. The X is the loop index.
; If there is an inner loop, Y is the inner loop index, i.e. $C1Y* and $C2Y*
; denote fields of the sprite slots interated over in the inner loop.
-_InitMapSprites: ; 1785b (5:785b)
+_InitMapSprites: ; 1401b (5:401b)
call InitOutsideMapSprites
ret c ; return if the map is an outside map (already handled by above call)
; if the map is an inside map (i.e. mapID >= $25)
- ld hl,wSpriteStateData1
- ld de,wSpriteStateData2 + $0d
-; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns.
-.copyPictureIDLoop
- ld a,[hl] ; $C1X0 (picture ID)
- ld [de],a ; $C2XD
- ld a,$10
- add e
- ld e,a
- ld a,$10
- add l
- ld l,a
- jr nz,.copyPictureIDLoop
-
-; This is used for both inside and outside maps, since it is called by
-; InitOutsideMapSprites.
-; Loads tile pattern data for sprites into VRAM.
-LoadMapSpriteTilePatterns: ; 17871 (5:7871)
- ld a,[wNumSprites]
- and a ; are there any sprites?
- jr nz,.spritesExist
+ call Func_14061
+ call Func_140b7
+ call Func_14150
ret
-.spritesExist
- ld c,a ; c = [wNumSprites]
- ld b,$10 ; number of sprite slots
- ld hl,wSpriteStateData2 + $0d
- xor a
- ld [hFourTileSpriteCount],a
-.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE
- ld a,[hli] ; $C2XD (sprite picture ID)
- ld [hld],a ; $C2XE
- ld a,l
- add a,$10
- ld l,a
- dec b
- jr nz,.copyPictureIDLoop
- ld hl,wSpriteStateData2 + $1e
-.loadTilePatternLoop
- ld de,wSpriteStateData2 + $1d
-; Check if the current picture ID has already had its tile patterns loaded.
-; This done by looping through the previous sprite slots and seeing if any of
-; their picture ID's match that of the current sprite slot.
-.checkIfAlreadyLoadedLoop
- ld a,e
- and a,$f0
- ld b,a ; b = offset of the wSpriteStateData2 sprite slot being checked against
- ld a,l
- and a,$f0 ; a = offset of current wSpriteStateData2 sprite slot
- cp b ; done checking all previous sprite slots?
- jr z,.notAlreadyLoaded
- ld a,[de] ; picture ID of the wSpriteStateData2 sprite slot being checked against
- cp [hl] ; do the picture ID's match?
- jp z,.alreadyLoaded
- ld a,e
- add a,$10
- ld e,a
- jr .checkIfAlreadyLoadedLoop
-.notAlreadyLoaded
- ld de,wSpriteStateData2 + $0e
- ld b,$01
-; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot
-; this is done in order to find the first free VRAM slot available
-.findNextVRAMSlotLoop
- ld a,e
- add a,$10
- ld e,a
- ld a,l
- cp e ; reached current slot?
- jr z,.foundNextVRAMSlot
- ld a,[de] ; $C2YE (VRAM slot)
- cp a,11 ; is it one of the first 10 slots?
- jr nc,.findNextVRAMSlotLoop
- cp b ; compare the slot being checked to the current max
- jr c,.findNextVRAMSlotLoop ; if the slot being checked is less than the current max
-; if the slot being checked is greater than or equal to the current max
- ld b,a ; store new max VRAM slot
- jr .findNextVRAMSlotLoop
-.foundNextVRAMSlot
- inc b ; increment previous max value to get next VRAM tile pattern slot
- ld a,b ; a = next VRAM tile pattern slot
- push af
- ld a,[hl] ; $C2XE (sprite picture ID)
- ld b,a ; b = current sprite picture ID
- cp a,SPRITE_BALL ; is it a 4-tile sprite?
- jr c,.notFourTileSprite
- pop af
- ld a,[hFourTileSpriteCount]
- add a,11
- jr .storeVRAMSlot
-.notFourTileSprite
- pop af
-.storeVRAMSlot
- ld [hl],a ; store VRAM slot at $C2XE
- ld [hVRAMSlot],a ; used to determine if it's 4-tile sprite later
- ld a,b ; a = current sprite picture ID
- dec a
- add a
- add a
- push bc
- push hl
- ld hl,SpriteSheetPointerTable
- jr nc,.noCarry
- inc h
-.noCarry
- add l
- ld l,a
- jr nc,.noCarry2
- inc h
-.noCarry2
- push hl
- call ReadSpriteSheetData
- push af
- push de
- push bc
- ld hl,vNPCSprites ; VRAM base address
- ld bc,$c0 ; number of bytes per VRAM slot
- ld a,[hVRAMSlot]
- cp a,11 ; is it a 4-tile sprite?
- jr nc,.fourTileSpriteVRAMAddr
- ld d,a
- dec d
-; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM
-; slot and adding the result to $8000 (the VRAM base address).
-.calculateVRAMAddrLoop
- add hl,bc
- dec d
- jr nz,.calculateVRAMAddrLoop
- jr .loadStillTilePattern
-.fourTileSpriteVRAMAddr
- ld hl,vSprites + $7c0 ; address for second 4-tile sprite
- ld a,[hFourTileSpriteCount]
- and a
- jr nz,.loadStillTilePattern
-; if it's the first 4-tile sprite
- ld hl,vSprites + $780 ; address for first 4-tile sprite
- inc a
- ld [hFourTileSpriteCount],a
-.loadStillTilePattern
- pop bc
- pop de
- pop af
- push hl
- push hl
- ld h,d
- ld l,e
- pop de
- ld b,a
- ld a,[wFontLoaded]
- bit 0,a ; reloading upper half of tile patterns after displaying text?
- jr nz,.skipFirstLoad ; if so, skip loading data into the lower half
- ld a,b
- ld b,0
- call FarCopyData ; load tile pattern data for sprite when standing still
-.skipFirstLoad
- pop de
- pop hl
- ld a,[hVRAMSlot]
- cp a,11 ; is it a 4-tile sprite?
- jr nc,.skipSecondLoad ; if so, there is no second block
- push de
- call ReadSpriteSheetData
- push af
- ld a,$c0
- add e
- ld e,a
- jr nc,.noCarry3
- inc d
-.noCarry3
- ld a,[wFontLoaded]
- bit 0,a ; reloading upper half of tile patterns after displaying text?
- jr nz,.loadWhileLCDOn
- pop af
- pop hl
- set 3,h ; add $800 to hl
- push hl
- ld h,d
- ld l,e
- pop de
- call FarCopyData ; load tile pattern data for sprite when walking
- jr .skipSecondLoad
-; When reloading the upper half of tile patterns after diplaying text, the LCD
-; will be on, so CopyVideoData (which writes to VRAM only during V-blank) must
-; be used instead of FarCopyData.
-.loadWhileLCDOn
- pop af
- pop hl
- set 3,h ; add $800 to hl
- ld b,a
- swap c
- call CopyVideoData ; load tile pattern data for sprite when walking
-.skipSecondLoad
- pop hl
- pop bc
- jr .nextSpriteSlot
-.alreadyLoaded ; if the current picture ID has already had its tile patterns loaded
- inc de
- ld a,[de] ; a = VRAM slot for the current picture ID (from $C2YE)
- ld [hl],a ; store VRAM slot in current wSpriteStateData2 sprite slot (at $C2XE)
-.nextSpriteSlot
- ld a,l
- add a,$10
- ld l,a
- dec c
- jp nz,.loadTilePatternLoop
- ld hl,wSpriteStateData2 + $0d
- ld b,$10
-; the pictures ID's stored at $C2XD are no longer needed, so zero them
-.zeroStoredPictureIDLoop
- xor a
- ld [hl],a ; $C2XD
- ld a,$10
- add l
- ld l,a
- dec b
- jr nz,.zeroStoredPictureIDLoop
- ret
-
-; reads data from SpriteSheetPointerTable
-; INPUT:
-; hl = address of sprite sheet entry
-; OUTPUT:
-; de = pointer to sprite sheet
-; bc = length in bytes
-; a = ROM bank
-ReadSpriteSheetData: ; 17971 (5:7971)
- ld a,[hli]
- ld e,a
- ld a,[hli]
- ld d,a
- ld a,[hli]
- ld c,a
- xor a
- ld b,a
- ld a,[hli]
- ret
-
+
; Loads sprite set for outside maps (cities and routes) and sets VRAM slots.
; sets carry if the map is a city or route, unsets carry if not
-InitOutsideMapSprites: ; 1797b (5:797b)
+InitOutsideMapSprites: ; 14029 (5:4029)
ld a,[wCurMap]
cp a,REDS_HOUSE_1F ; is the map a city or a route (map ID less than $25)?
ret nc ; if not, return
- ld hl,MapSpriteSets
- add l
- ld l,a
- jr nc,.noCarry
- inc h
-.noCarry
- ld a,[hl] ; a = spriteSetID
- cp a,$f0 ; does the map have 2 sprite sets?
- call nc,GetSplitMapSpriteSetID ; if so, choose the appropriate one
+ call GetSplitMapSpriteSetID
+; if so, choose the appropriate one
ld b,a ; b = spriteSetID
ld a,[wFontLoaded]
bit 0,a ; reloading upper half of tile patterns after displaying text?
jr nz,.loadSpriteSet ; if so, forcibly reload the sprite set
- ld a,[W_SPRITESETID]
+ ld a,[wSpriteSetID]
cp b ; has the sprite set ID changed?
jr z,.skipLoadingSpriteSet ; if not, don't load it again
.loadSpriteSet
ld a,b
- ld [W_SPRITESETID],a
+ ld [wSpriteSetID],a
dec a
- ld b,a
- sla a
ld c,a
- sla a
- sla a
- add c
- add b ; a = (spriteSetID - 1) * 11
- ld de,SpriteSets
-; add a to de to get offset of sprite set
- add e
- ld e,a
- jr nc,.noCarry2
- inc d
-.noCarry2
- ld hl,wSpriteStateData2 + $0d
- ld a,SPRITE_RED
- ld [hl],a
- ld bc,W_SPRITESET
-; Load the sprite set into RAM.
-; This loop also fills $C2XD (sprite picture ID) where X is from $0 to $A
-; with picture ID's. This is done so that LoadMapSpriteTilePatterns will
-; load tile patterns for all sprite pictures in the sprite set.
-.loadSpriteSetLoop
- ld a,$10
- add l
- ld l,a
- ld a,[de] ; sprite picture ID from sprite set
- ld [hl],a ; $C2XD (sprite picture ID)
- ld [bc],a
- inc de
- inc bc
- ld a,l
- cp a,$bd ; reached 11th sprite slot?
- jr nz,.loadSpriteSetLoop
- ld b,4 ; 4 remaining sprite slots
-.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
- ld a,$10
- add l
- ld l,a
- xor a
- ld [hl],a ; $C2XD (sprite picture ID)
- dec b
- jr nz,.zeroRemainingSlotsLoop
- ld a,[wNumSprites]
- push af ; save number of sprites
- ld a,11 ; 11 sprites in sprite set
- ld [wNumSprites],a
- call LoadMapSpriteTilePatterns
- pop af
- ld [wNumSprites],a ; restore number of sprites
- ld hl,wSpriteStateData2 + $1e
- ld b,$0f
-; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
-; order of the map's sprite set, not the order of the actual sprites loaded
-; for the current map. So, they are not needed and are zeroed by this loop.
-.zeroVRAMSlotsLoop
- xor a
- ld [hl],a ; $C2XE (VRAM slot)
- ld a,$10
- add l
- ld l,a
- dec b
- jr nz,.zeroVRAMSlotsLoop
+ ld b,0
+ ld a, (wSpriteSetID - wSpriteSet)
+ ld hl,SpriteSets
+ call AddNTimes ; get sprite set offset
+ ld de, wSpriteSet
+ ld bc, (wSpriteSetID - wSpriteSet)
+ call CopyData ; copy it to wSpriteSet
+ call Func_140b7
.skipLoadingSpriteSet
- ld hl,wSpriteStateData1 + $10
+ call Func_14150
+ scf
+ ret
+
+Func_14061: ; 14061 (5:4061)
; This loop stores the correct VRAM tile pattern slots according the sprite
; data from the map's header. Since the VRAM tile pattern slots are filled in
; the order of the sprite set, in order to find the VRAM tile pattern slot
@@ -346,48 +58,250 @@ InitOutsideMapSprites: ; 1797b (5:797b)
; sprite set. The index of the picture ID within the sprite set plus one
; (since the Red sprite always has the first VRAM tile pattern slot) is the
; VRAM tile pattern slot.
+ ld hl, wSpriteSet
+ ld bc, (wSpriteSetID - wSpriteSet)
+ xor a
+ call FillMemory
+ ld a, SPRITE_PIKACHU
+ ld [wSpriteSet], a
+ ld hl,wSpriteStateData1 + $10
+ ld a,$0e
.storeVRAMSlotsLoop
- ld c,0
- ld a,[hl] ; $C1X0 (picture ID) (zero if sprite slot is not used)
+ push af
+ ld a, [hl] ; $C1X0 (picture ID) (zero if sprite slot is not used)
and a ; is the sprite slot used?
- jr z,.skipGettingPictureIndex ; if the sprite slot is not used
- ld b,a ; b = picture ID
- ld de,W_SPRITESET
-; Loop to find the index of the sprite's picture ID within the sprite set.
-.getPictureIndexLoop
- inc c
- ld a,[de]
+ jr z,.continue ; if the sprite slot is not used
+ ld c, a
+ call CheckForNewYellowSprite
+ jr nc, .asm_1408a
+ ld de, wSpriteSet + 9
+ ld b, 2
+ call Func_1409b
+ jr .continue
+.asm_1408a
+ ld de, wSpriteSet
+ ld b, 9
+ call Func_1409b
+.continue
+ ld de, $10
+ add hl, de
+ pop af
+ dec a
+ jr nz, .storeVRAMSlotsLoop
+ ret
+
+Func_1409b: ; 1409b (5:409b)
+ ld a, [de]
+ and a
+ jr z, .asm_140a7
+ cp c
+ ret z
+ dec b
+ jr z, .asm_140aa
inc de
- cp b ; does the picture ID match?
- jr nz,.getPictureIndexLoop
- inc c
-.skipGettingPictureIndex
- push hl
- inc h
- ld a,$0e
- add l
- ld l,a
- ld a,c ; a = VRAM slot (zero if sprite slot is not used)
- ld [hl],a ; $C2XE (VRAM slot)
- pop hl
- ld a,$10
- add l
- ld l,a
+ jr Func_1409b
+.asm_140a7
+ ld a, c
+ ld [de], a
+ ret
+.asm_140aa
+ scf
+ ret
+
+CheckForNewYellowSprite: ; 140ac (5:40ac)
+; Checks for a sprite added in yellow
+; Returns z flag if it is SPRITE_PIKACHU
+; Else, returns carry if not a yellow sprite and vice versa
+ cp SPRITE_PIKACHU ; is this the Pikachu Sprite?
+ ret z ; return if yes
+ cp SPRITE_BALL ; is this a yellow sprite?
+ jr nc, .notYellowSprite
+ and a
+ ret
+.notYellowSprite
+ scf
+ ret
+
+Func_140b7: ; 140b7 (5:40b7)
+ ld a, $0
+.loop
+ ld [hVRAMSlot], a
+ cp 9
+ jr nc, .fourTileSprite
+ call LoadStillTilePattern
+ call LoadWalkingTilePattern
+ jr .continue
+.fourTileSprite
+ call LoadStillTilePattern
+.continue
+ ld a, [hVRAMSlot]
+ inc a
+ cp 11
+ jr nz, .loop
+ ret
+
+Func_140d2: ; 140d2 (5:40d2)
+ xor a
+.loop
+ ld [hVRAMSlot], a
+ cp 9
+ jr nc, .asm_140dc
+ call LoadWalkingTilePattern
+.asm_140dc
+ ld a, [hVRAMSlot]
+ inc a
+ cp 11
+ jr nz, .loop
+ ret
+
+LoadStillTilePattern: ; 140e4 (5:40e4)
+ ld a, [wFontLoaded]
+ bit 0, a ; reloading upper half of tile patterns after displaying text?
+ ret nz ; if so, skip loading data into the lower half
+ call ReadSpriteSheetData
+ ret nc
+ call GetSpriteVRAMAddress
+ call CopyVideoDataAlternate ; new yellow function
+ ret
+
+LoadWalkingTilePattern: ; 140f5 (5:40f5)
+ call ReadSpriteSheetData
+ ret nc
+ ld hl, $c0
+ add hl, de
+ ld d, h
+ ld e, l
+ call GetSpriteVRAMAddress
+ set 3, h ; add $800 to hl
+ call CopyVideoDataAlternate
+ ret
+
+GetSpriteVRAMAddress: ; 14018 (5:4108)
+ push bc
+ ld a, [hVRAMSlot]
+ ld c, a
+ ld b, 0
+ ld hl, SpriteVRAMAddresses
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ pop bc
+ ret
+
+SpriteVRAMAddresses: ; 14118 (5:4118)
+; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM
+; slot and adding the result to $8000 (the VRAM base address).
+ dw vChars0 + $c0
+ dw vChars0 + $180
+ dw vChars0 + $240
+ dw vChars0 + $300
+ dw vChars0 + $3c0
+ dw vChars0 + $480
+ dw vChars0 + $540
+ dw vChars0 + $600
+ dw vChars0 + $6c0
+ dw vChars0 + $780
+ dw vChars0 + $7c0
+
+ReadSpriteSheetData: ; 1412e (5:412e)
+ ld a, [hVRAMSlot]
+ ld e, a
+ ld d, 0
+ ld hl, wSpriteSet
+ add hl, de
+ ld a, [hl]
and a
- jr nz,.storeVRAMSlotsLoop
+ ret z
+
+ dec a
+ ld l, a
+ ld h, 0
+ add hl, hl
+ add hl, hl
+ ld de, SpriteSheetPointerTable
+ add hl, de
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ inc hl
+ ld c, [hl]
+ swap c ; get the number of tiles, not the raw byte length
+ ; this is because of the use of CopyVideoDataAlternate
+ inc hl
+ ld b, [hl]
+ inc hl
scf
ret
+
+Func_14150: ; 14150 (5:4150)
+ ld a, $1
+ ld [wSpriteStateData2 + $e], a
+ ld a, $2
+ ld [wSpriteStateData2 + $fe], a
+ ld a, $e
+ ld hl, wSpriteStateData1 + $10
+.loop
+ ld [hVRAMSlot], a
+ ld a, [hl]
+ and a
+ jr z, .asm_1416f
+ call Func_14179
+ push hl
+ ld de, $10e
+ add hl, de
+ ld [hl], a
+ pop hl
+.asm_1416f
+ ld de, $10
+ add hl, de
+ ld a, [hVRAMSlot]
+ dec a
+ jr nz, .loop
+ ret
+
+Func_14179: ; 14179 (5:4179)
+ push de
+ push bc
+ ld c, a
+ ld b, 11
+ ld de, wSpriteSet
+.asm_14181
+ ld a, [de]
+ cp c
+ jr z, .asm_1418d
+ inc de
+ dec b
+ jr nz, .asm_14181
+ ld a, $1
+ jr .done
+.asm_1418d
+ ld a, $d
+ sub b
+.done
+ pop bc
+ pop de
+ ret
+GetSplitMapSpriteSetID: ; 14193 (5:4193)
+ ld e, a
+ ld d, 0
+ ld hl,MapSpriteSets
+ add hl, de
+ ld a,[hl] ; a = spriteSetID
+ cp a,$f0 ; does the map have 2 sprite sets?
+ ret c
+; GetSplitMapSpriteSetID
; Chooses the correct sprite set ID depending on the player's position within
; the map for maps with two sprite sets.
-GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
cp a,$f8
jr z,.route20
ld hl,SplitMapSpriteSets
and a,$0f
dec a
- sla a
- sla a
+ add a
+ add a
add l
ld l,a
jr nc,.noCarry
@@ -437,4 +351,4 @@ GetSplitMapSpriteSetID: ; 17a1a (5:7a1a)
ld a,$01
ret
-INCLUDE "data/sprite_sets.asm"
+INCLUDE "data/sprite_sets.asm" \ No newline at end of file
diff --git a/home.asm b/home.asm
index 70053c47..22555ff4 100644
--- a/home.asm
+++ b/home.asm
@@ -4820,7 +4820,7 @@ ReloadMapSpriteTilePatterns:: ; 3e1e (0:3e1e)
res 0, [hl]
push hl
xor a
- ld [W_SPRITESETID], a
+ ld [wSpriteSetID], a
call DisableLCD
call InitMapSprites
call EnableLCD
diff --git a/home/overworld.asm b/home/overworld.asm
index 9d9b804a..f08ef86a 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -2044,7 +2044,7 @@ ResetMapVariables:: ; 0f56 (0:0f56)
ld [hSCX],a
ld [wWalkCounter],a
ld [wUnusedD119],a
- ld [W_SPRITESETID],a
+ ld [wSpriteSetID],a
ld [wWalkBikeSurfStateCopy],a
ret
diff --git a/replace.sh b/replace.sh
index 7648423a..49badda1 100644
--- a/replace.sh
+++ b/replace.sh
@@ -1,3 +1,3 @@
-sed -i 's/\<'$1'\>/'$2'/' $(git grep -l $1)
+sed -i 's/\<'$1'\>/'$2'/' $(git grep -l $1 -- "*.asm")
# $1: phrase to find
# $2: phrase to replace $1 \ No newline at end of file
diff --git a/wram.asm b/wram.asm
index 1e3a00cb..ae605e84 100755
--- a/wram.asm
+++ b/wram.asm
@@ -2468,11 +2468,11 @@ wEastConnectedMapXAlignment:: ; d39a
wEastConnectedMapViewPointer:: ; d39b
ds 2
-W_SPRITESET:: ; d39d
+wSpriteSet:: ; d39d
; sprite set for the current map (11 sprite picture ID's)
ds 11
-W_SPRITESETID:: ; d3a8
+wSpriteSetID:: ; d3a8
; sprite set ID for the current map
ds 1
diff --git a/yellow/main.asm b/yellow/main.asm
index b0e5ce7e..1915cf7b 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -3522,6 +3522,7 @@ NineTile: INCBIN "gfx/9_tile.2bpp"
TextBoxGraphics: INCBIN "gfx/text_box.2bpp"
TextBoxGraphicsEnd:
PokedexTileGraphics: INCBIN "gfx/pokedex.2bpp"
+PokedexTileGraphicsEnd:
WorldMapTileGraphics: INCBIN "gfx/town_map.2bpp"
WorldMapTileGraphicsEnd:
PlayerCharacterTitleGraphics: INCBIN "gfx/player_title.2bpp"
@@ -3576,11 +3577,8 @@ INCLUDE "engine/battle/moveEffects/haze_effect.asm"
SECTION "NPC Sprites 2", ROMX, BANK[NPC_SPRITES_2]
- dr $14000,$1401b
-_InitMapSprites: ; 1401b (5:401b)
- dr $1401b,$140d2
-Func_140d2: ; 140d2 (5:40d2)
- dr $140d2,$143f1
+INCLUDE "engine/load_pokedex_tiles.asm"
+INCLUDE "engine/overworld/map_sprites.asm"
RedCyclingSprite: INCBIN "gfx/sprites/cycling.2bpp"
RedSprite: INCBIN "gfx/sprites/red.2bpp"