ref: 0b45e2e846c8b2feb7d2c4c4ebb854db07cf06fd
parent: 3c7ba37de72795e46c76f791b50b4a3d89ba0c2c
author: luckytyphlosion <[email protected]>
date: Tue Jan 30 09:52:46 EST 2018
Fix wVirtualOAM labels, part 2.
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -9327,7 +9327,7 @@
; 3fc5b
.LoadTrainerBackpicAsOAM: ; 3fc5b
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
xor a
ld [hMapObjectIndexBuffer], a
ld b, 6
--- a/engine/battle/sliding_intro.asm
+++ b/engine/battle/sliding_intro.asm
@@ -60,7 +60,7 @@
; 4e9d6
.subfunction3 ; 4e9d6
- ld hl, wSprite01XCoord
+ ld hl, wVirtualOAMSprite00XCoord
ld c, $12 ; 18
ld de, SPRITEOAMSTRUCT_LENGTH
.loop3
--- a/engine/battle/trainer_huds.asm
+++ b/engine/battle/trainer_huds.asm
@@ -28,7 +28,7 @@
ld [hl], a
ld a, 8
ld [wPlaceBallsDirection], a
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
jp LoadTrainerHudOAM
; 2c03a
@@ -44,7 +44,7 @@
ld [hl], 4 * 8
ld a, -8
ld [wPlaceBallsDirection], a
- ld hl, wSprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
+ ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
jp LoadTrainerHudOAM
; 2c059
@@ -193,7 +193,7 @@
ld [hl], 8 * 8
ld a, $8
ld [wPlaceBallsDirection], a
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
call LoadTrainerHudOAM
ld hl, wOTPartyMon1HP
@@ -203,7 +203,7 @@
ld a, 10 * 8
ld [hli], a
ld [hl], 13 * 8
- ld hl, wSprite01 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
+ ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
jp LoadTrainerHudOAM
; 2c143
--- a/engine/battle_anims/anim_commands.asm
+++ b/engine/battle_anims/anim_commands.asm
@@ -257,7 +257,7 @@
bit 3, a
jr z, .delete
- ld hl, wSprite01Attributes
+ ld hl, wVirtualOAMSprite00Attributes
ld c, NUM_SPRITE_OAM_STRUCTS
.loop
ld a, [hl]
--- a/engine/billspc.asm
+++ b/engine/billspc.asm
@@ -1498,7 +1498,7 @@
.place_cursor
ld hl, .OAM
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.loop
ld a, [hl]
cp -1
@@ -1548,7 +1548,7 @@
BillsPC_UpdateInsertCursor: ; e2e8c
ld hl, .OAM
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.loop
ld a, [hl]
cp -1
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -601,7 +601,7 @@
; e0509 (38:4509)
CardFlip_CopyOAM: ; e0509
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
ld a, [hli]
.loop
push af
--- a/engine/events/celebi.asm
+++ b/engine/events/celebi.asm
@@ -52,7 +52,7 @@
; 498f9
.RestorePlayerSprite_DespawnLeaves: ; 498f9
- ld hl, wSprite01TileID
+ ld hl, wVirtualOAMSprite00TileID
xor a
ld c, 4
.OAMloop:
@@ -63,8 +63,8 @@
inc a
dec c
jr nz, .OAMloop
- ld hl, wSprite05
- ld bc, wSpritesEnd - wSprite05
+ ld hl, wVirtualOAMSprite04
+ ld bc, wSpritesEnd - wVirtualOAMSprite04
xor a
call ByteFill
ret
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -62,8 +62,8 @@
xor a
ld [hBGMapMode], a
farcall ClearSpriteAnims
- ld hl, wSprite37
- ld bc, wSpritesEnd - wSprite37
+ ld hl, wVirtualOAMSprite36
+ ld bc, wSpritesEnd - wVirtualOAMSprite36
xor a
call ByteFill
ld de, Font
@@ -393,7 +393,7 @@
ret
.RestorePlayerSprite_DespawnLeaves: ; 8cb82 (23:4b82)
- ld hl, wSprite01TileID
+ ld hl, wVirtualOAMSprite00TileID
xor a
ld c, 4
.OAMloop
@@ -404,8 +404,8 @@
inc a
dec c
jr nz, .OAMloop
- ld hl, wSprite05
- ld bc, wSpritesEnd - wSprite05
+ ld hl, wVirtualOAMSprite04
+ ld bc, wSpritesEnd - wVirtualOAMSprite04
xor a
call ByteFill
ret
--- a/engine/events/heal_machine_anim.asm
+++ b/engine/events/heal_machine_anim.asm
@@ -97,7 +97,7 @@
; 12393
.PC_LoadBallsOntoMachine: ; 12393
- ld hl, wSprite33
+ ld hl, wVirtualOAMSprite32
ld de, .PC_ElmsLab_OAM
call .PlaceHealingMachineTile
call .PlaceHealingMachineTile
@@ -104,7 +104,7 @@
jr .LoadBallsOntoMachine
.HOF_LoadBallsOntoMachine: ; 123a1
- ld hl, wSprite33
+ ld hl, wVirtualOAMSprite32
ld de, .HOF_OAM
.LoadBallsOntoMachine: ; 123a7
--- a/engine/evolution_animation.asm
+++ b/engine/evolution_animation.asm
@@ -346,7 +346,7 @@
inc a
and $7
ld b, a
- ld hl, wSprite01Attributes
+ ld hl, wVirtualOAMSprite00Attributes
ld c, NUM_SPRITE_OAM_STRUCTS
.loop6
ld a, [hl]
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -969,7 +969,7 @@
ld hl, vTiles0
call Request2bpp
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
ld de, .sprites
ld a, [de]
inc de
--- a/engine/mystery_gift.asm
+++ b/engine/mystery_gift.asm
@@ -1458,7 +1458,7 @@
Function1056eb: ; 1056eb (41:56eb)
ld c, 16
.loop
- ld hl, wSprite01YCoord
+ ld hl, wVirtualOAMSprite00YCoord
ld b, 8
.dec_y_loop
dec [hl]
@@ -1467,7 +1467,7 @@
endr
dec b
jr nz, .dec_y_loop
- ld hl, wSprite09YCoord
+ ld hl, wVirtualOAMSprite08YCoord
ld b, 8
.inc_y_loop
inc [hl]
@@ -1656,7 +1656,7 @@
ld [hl], $3c
hlcoord 17, 15
ld [hl], $3e
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
ld hl, .OAM_data
ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
call CopyBytes
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -2117,7 +2117,7 @@
db -1
Pokedex_LoadCursorOAM: ; 412f1 (10:52f1)
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.loop
ld a, [hl]
cp -1
--- a/engine/pokedex/pokedex_2.asm
+++ b/engine/pokedex/pokedex_2.asm
@@ -41,7 +41,7 @@
DoDexSearchSlowpokeFrame: ; 44207
ld a, [wDexSearchSlowpokeFrame]
ld hl, .SlowpokeSpriteData
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.loop
ld a, [hli]
cp -1
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -2627,7 +2627,7 @@
ld e, a
farcall FindNest ; load nest landmarks into wTileMap[0,0]
decoord 0, 0
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
.nestloop
ld a, [de]
and a
@@ -2671,7 +2671,7 @@
ld c, e
ld b, d
ld de, .PlayerOAM
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
.ShowPlayerLoop:
ld a, [de]
cp $80
@@ -2700,8 +2700,8 @@
jr .ShowPlayerLoop
.clear_oam
- ld hl, wSprite05
- ld bc, wSpritesEnd - wSprite05
+ ld hl, wVirtualOAMSprite04
+ ld bc, wSpritesEnd - wVirtualOAMSprite04
xor a
call ByteFill
ret
--- a/engine/routines/switchpartymons.asm
+++ b/engine/routines/switchpartymons.asm
@@ -25,7 +25,7 @@
ld a, " "
call ByteFill
pop af
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
ld bc, 4 * SPRITEOAMSTRUCT_LENGTH
call AddNTimes
ld de, SPRITEOAMSTRUCT_LENGTH
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -261,7 +261,7 @@
inc [hl]
and $7
ret nz
- ld hl, wSprite17TileID
+ ld hl, wVirtualOAMSprite16TileID
ld c, NUM_SPRITE_OAM_STRUCTS - 16
.loop
ld a, [hl]
@@ -671,7 +671,7 @@
ld bc, wReel1
ld hl, REEL_OAM_ADDR
add hl, bc
- ld de, wSprite17
+ ld de, wVirtualOAMSprite16
ld [hl], e
inc hl
ld [hl], d
@@ -689,7 +689,7 @@
ld bc, wReel2
ld hl, REEL_OAM_ADDR
add hl, bc
- ld de, wSprite25
+ ld de, wVirtualOAMSprite24
ld [hl], e
inc hl
ld [hl], d
@@ -707,7 +707,7 @@
ld bc, wReel3
ld hl, REEL_OAM_ADDR
add hl, bc
- ld de, wSprite33
+ ld de, wVirtualOAMSprite32
ld [hl], e
inc hl
ld [hl], d
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -100,11 +100,11 @@
ld a, [wCurrSpriteOAMAddr]
ld l, a
- ld h, HIGH(wSprite17)
+ ld h, HIGH(wVirtualOAMSprite16)
.loop2 ; Clear (wVirtualOAM + [wCurrSpriteOAMAddr] --> Sprites + $40)
ld a, l
- cp LOW(wSprite17)
+ cp LOW(wVirtualOAMSprite16)
jr nc, .done
xor a
ld [hli], a
@@ -649,7 +649,7 @@
; 8e7c6
.AnimateFrame: ; 8e7c6
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
ld c, 8 ; number of animated circles
.anim_loop
ld a, c
--- a/engine/title.asm
+++ b/engine/title.asm
@@ -323,7 +323,7 @@
; 10ef06
InitializeBackground: ; 10ef06
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
ld d, -$22
ld e, $0
ld c, 5
@@ -366,7 +366,7 @@
; Stop at y=6
; y is really from the bottom of the sprite, which is two tiles high
- ld hl, wSprite01YCoord
+ ld hl, wVirtualOAMSprite00YCoord
ld a, [hl]
cp 6 + 2 * TILE_WIDTH
ret z
--- a/engine/trainer_card.asm
+++ b/engine/trainer_card.asm
@@ -479,7 +479,7 @@
ld d, a
ld a, [de]
ld c, a
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
ld b, NUM_JOHTO_BADGES
.loop
srl c
--- a/engine/unown_puzzle.asm
+++ b/engine/unown_puzzle.asm
@@ -549,7 +549,7 @@
ld hl, .OAM_NotHoldingPiece
.load
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.loop
ld a, [hli]
cp -1
--- a/engine/unused_title.asm
+++ b/engine/unused_title.asm
@@ -49,7 +49,7 @@
jr nz, .copy
ld hl, UnusedTitleFG_OAM
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
ld bc, SPRITEOAMSTRUCT_LENGTH * NUM_SPRITE_OAM_STRUCTS
call CopyBytes
--- a/home.asm
+++ b/home.asm
@@ -181,7 +181,7 @@
HideSprites:: ; 3016
; Set all OAM y-positions to 160 to hide them offscreen
- ld hl, wSprite01YCoord
+ ld hl, wVirtualOAMSprite00YCoord
ld de, SPRITEOAMSTRUCT_LENGTH
ld b, NUM_SPRITE_OAM_STRUCTS
ld a, SCREEN_WIDTH_PX
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -506,15 +506,15 @@
; Places a BCD number at the
; upper center of the screen.
ld a, 4 * TILE_WIDTH
- ld [wSprite39YCoord], a
- ld [wSprite40YCoord], a
+ ld [wVirtualOAMSprite38YCoord], a
+ ld [wVirtualOAMSprite39YCoord], a
ld a, 10 * TILE_WIDTH
- ld [wSprite39XCoord], a
+ ld [wVirtualOAMSprite38XCoord], a
ld a, 11 * TILE_WIDTH
- ld [wSprite40XCoord], a
+ ld [wVirtualOAMSprite39XCoord], a
xor a
- ld [wSprite39Attributes], a
- ld [wSprite40Attributes], a
+ ld [wVirtualOAMSprite38Attributes], a
+ ld [wVirtualOAMSprite39Attributes], a
ld a, [wc296]
cp 100
jr nc, .max
@@ -524,17 +524,17 @@
swap a
and $f
add "0"
- ld [wSprite39TileID], a
+ ld [wVirtualOAMSprite38TileID], a
ld a, b
and $f
add "0"
- ld [wSprite40TileID], a
+ ld [wVirtualOAMSprite39TileID], a
ret
.max
ld a, "9"
- ld [wSprite39TileID], a
- ld [wSprite40TileID], a
+ ld [wVirtualOAMSprite38TileID], a
+ ld [wVirtualOAMSprite39TileID], a
ret
; 3dde
--- a/mobile/mobile_22.asm
+++ b/mobile/mobile_22.asm
@@ -1923,7 +1923,7 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.asm_89bb4
ld a, [hli]
cp $ff
@@ -2013,7 +2013,7 @@
pop de
ret
.asm_89c4f
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
push de
ld a, b
ld [hli], a ; y
@@ -2123,7 +2123,7 @@
ld c, a
ld e, $2
ld a, $2
- ld hl, wSprite01
+ ld hl, wVirtualOAMSprite00
.asm_89cee
push af
push bc
--- a/mobile/mobile_45_sprite_engine.asm
+++ b/mobile/mobile_45_sprite_engine.asm
@@ -22,7 +22,7 @@
xor a
ld [wc305], a
ld a, $a0
- ld hl, wSprite32
+ ld hl, wVirtualOAMSprite31
ld bc, 8 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
ret
@@ -34,7 +34,7 @@
and a
ret z
ld a, $a0
- ld hl, wSprite32
+ ld hl, wVirtualOAMSprite31
ld bc, 8 * SPRITEOAMSTRUCT_LENGTH
call ByteFill
call Function115e22
@@ -50,7 +50,7 @@
ld d, a
push de
pop hl
- ld de, wSprite32
+ ld de, wVirtualOAMSprite31
ld a, [wc307]
ld c, a
ld a, [wc308]
@@ -585,7 +585,7 @@
ld e, a
ld a, [hli]
sub e
- ld de, wSprite10
+ ld de, wVirtualOAMSprite09
.asm_116321
push af
ld a, [hli]
@@ -626,7 +626,7 @@
ld e, a
ld a, [hli]
sub e
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.asm_11635a
push af
ld a, [hli]
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -6921,7 +6921,7 @@
db $39 ; 13
Function11b397: ; 11b397
- ld de, wSprite01
+ ld de, wVirtualOAMSprite00
.loop
ld a, [hl]
cp $ff
@@ -6979,7 +6979,7 @@
; 11b3d9
Function11b3d9: ; 11b3d9
- ld de, wSprite29
+ ld de, wVirtualOAMSprite28
push de
ld a, [wc7d2]
dec a
--- /dev/null
+++ b/replace.sh
@@ -1,0 +1,1 @@
+sed -i 's/\<'$1'\>/'$2'/' $(grep -lwr --include="*.asm" --exclude-dir=".git" --exclude-dir="tools" --exclude-dir="extras" --exclude-dir="crowdmap" $1)
\ No newline at end of file
--- a/wram.asm
+++ b/wram.asm
@@ -303,46 +303,46 @@
SECTION "Sprites", WRAM0
wVirtualOAM:: ; c400
-wSprite01:: sprite_oam_struct wSprite01
-wSprite02:: sprite_oam_struct wSprite02
-wSprite03:: sprite_oam_struct wSprite03
-wSprite04:: sprite_oam_struct wSprite04
-wSprite05:: sprite_oam_struct wSprite05
-wSprite06:: sprite_oam_struct wSprite06
-wSprite07:: sprite_oam_struct wSprite07
-wSprite08:: sprite_oam_struct wSprite08
-wSprite09:: sprite_oam_struct wSprite09
-wSprite10:: sprite_oam_struct wSprite10
-wSprite11:: sprite_oam_struct wSprite11
-wSprite12:: sprite_oam_struct wSprite12
-wSprite13:: sprite_oam_struct wSprite13
-wSprite14:: sprite_oam_struct wSprite14
-wSprite15:: sprite_oam_struct wSprite15
-wSprite16:: sprite_oam_struct wSprite16
-wSprite17:: sprite_oam_struct wSprite17
-wSprite18:: sprite_oam_struct wSprite18
-wSprite19:: sprite_oam_struct wSprite19
-wSprite20:: sprite_oam_struct wSprite20
-wSprite21:: sprite_oam_struct wSprite21
-wSprite22:: sprite_oam_struct wSprite22
-wSprite23:: sprite_oam_struct wSprite23
-wSprite24:: sprite_oam_struct wSprite24
-wSprite25:: sprite_oam_struct wSprite25
-wSprite26:: sprite_oam_struct wSprite26
-wSprite27:: sprite_oam_struct wSprite27
-wSprite28:: sprite_oam_struct wSprite28
-wSprite29:: sprite_oam_struct wSprite29
-wSprite30:: sprite_oam_struct wSprite30
-wSprite31:: sprite_oam_struct wSprite31
-wSprite32:: sprite_oam_struct wSprite32
-wSprite33:: sprite_oam_struct wSprite33
-wSprite34:: sprite_oam_struct wSprite34
-wSprite35:: sprite_oam_struct wSprite35
-wSprite36:: sprite_oam_struct wSprite36
-wSprite37:: sprite_oam_struct wSprite37
-wSprite38:: sprite_oam_struct wSprite38
-wSprite39:: sprite_oam_struct wSprite39
-wSprite40:: sprite_oam_struct wSprite40
+wVirtualOAMSprite00:: sprite_oam_struct wVirtualOAMSprite00
+wVirtualOAMSprite01:: sprite_oam_struct wVirtualOAMSprite01
+wVirtualOAMSprite02:: sprite_oam_struct wVirtualOAMSprite02
+wVirtualOAMSprite03:: sprite_oam_struct wVirtualOAMSprite03
+wVirtualOAMSprite04:: sprite_oam_struct wVirtualOAMSprite04
+wVirtualOAMSprite05:: sprite_oam_struct wVirtualOAMSprite05
+wVirtualOAMSprite06:: sprite_oam_struct wVirtualOAMSprite06
+wVirtualOAMSprite07:: sprite_oam_struct wVirtualOAMSprite07
+wVirtualOAMSprite08:: sprite_oam_struct wVirtualOAMSprite08
+wVirtualOAMSprite09:: sprite_oam_struct wVirtualOAMSprite09
+wVirtualOAMSprite10:: sprite_oam_struct wVirtualOAMSprite10
+wVirtualOAMSprite11:: sprite_oam_struct wVirtualOAMSprite11
+wVirtualOAMSprite12:: sprite_oam_struct wVirtualOAMSprite12
+wVirtualOAMSprite13:: sprite_oam_struct wVirtualOAMSprite13
+wVirtualOAMSprite14:: sprite_oam_struct wVirtualOAMSprite14
+wVirtualOAMSprite15:: sprite_oam_struct wVirtualOAMSprite15
+wVirtualOAMSprite16:: sprite_oam_struct wVirtualOAMSprite16
+wVirtualOAMSprite17:: sprite_oam_struct wVirtualOAMSprite17
+wVirtualOAMSprite18:: sprite_oam_struct wVirtualOAMSprite18
+wVirtualOAMSprite19:: sprite_oam_struct wVirtualOAMSprite19
+wVirtualOAMSprite20:: sprite_oam_struct wVirtualOAMSprite20
+wVirtualOAMSprite21:: sprite_oam_struct wVirtualOAMSprite21
+wVirtualOAMSprite22:: sprite_oam_struct wVirtualOAMSprite22
+wVirtualOAMSprite23:: sprite_oam_struct wVirtualOAMSprite23
+wVirtualOAMSprite24:: sprite_oam_struct wVirtualOAMSprite24
+wVirtualOAMSprite25:: sprite_oam_struct wVirtualOAMSprite25
+wVirtualOAMSprite26:: sprite_oam_struct wVirtualOAMSprite26
+wVirtualOAMSprite27:: sprite_oam_struct wVirtualOAMSprite27
+wVirtualOAMSprite28:: sprite_oam_struct wVirtualOAMSprite28
+wVirtualOAMSprite29:: sprite_oam_struct wVirtualOAMSprite29
+wVirtualOAMSprite30:: sprite_oam_struct wVirtualOAMSprite30
+wVirtualOAMSprite31:: sprite_oam_struct wVirtualOAMSprite31
+wVirtualOAMSprite32:: sprite_oam_struct wVirtualOAMSprite32
+wVirtualOAMSprite33:: sprite_oam_struct wVirtualOAMSprite33
+wVirtualOAMSprite34:: sprite_oam_struct wVirtualOAMSprite34
+wVirtualOAMSprite35:: sprite_oam_struct wVirtualOAMSprite35
+wVirtualOAMSprite36:: sprite_oam_struct wVirtualOAMSprite36
+wVirtualOAMSprite37:: sprite_oam_struct wVirtualOAMSprite37
+wVirtualOAMSprite38:: sprite_oam_struct wVirtualOAMSprite38
+wVirtualOAMSprite39:: sprite_oam_struct wVirtualOAMSprite39
wSpritesEnd::