summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2021-10-06 17:44:34 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2021-10-06 17:44:34 -0400
commitbd45cfd5fdad3d019e752836ec88ac930bb6572b (patch)
tree73d7985d97025c4da22cbd1c7ccfeea863258292
parentbe7a5e09b5e54676a9c239682707331be1229828 (diff)
Add `assert PokemonPicPointers == UnownPicPointers` in `GetFrontpicPointer`
-rw-r--r--docs/design_flaws.md39
-rw-r--r--engine/gfx/load_pics.asm6
2 files changed, 12 insertions, 33 deletions
diff --git a/docs/design_flaws.md b/docs/design_flaws.md
index aa7c1fa79..7a80698f5 100644
--- a/docs/design_flaws.md
+++ b/docs/design_flaws.md
@@ -49,28 +49,7 @@ GLOBAL PICS_FIX
.PicsBanks:
db BANK("Pics 1") ; BANK("Pics 1") + 0
- db BANK("Pics 2") ; BANK("Pics 1") + 1
- db BANK("Pics 3") ; BANK("Pics 1") + 2
- db BANK("Pics 4") ; BANK("Pics 1") + 3
- db BANK("Pics 5") ; BANK("Pics 1") + 4
- db BANK("Pics 6") ; BANK("Pics 1") + 5
- db BANK("Pics 7") ; BANK("Pics 1") + 6
- db BANK("Pics 8") ; BANK("Pics 1") + 7
- db BANK("Pics 9") ; BANK("Pics 1") + 8
- db BANK("Pics 10") ; BANK("Pics 1") + 9
- db BANK("Pics 11") ; BANK("Pics 1") + 10
- db BANK("Pics 12") ; BANK("Pics 1") + 11
- db BANK("Pics 13") ; BANK("Pics 1") + 12
- db BANK("Pics 14") ; BANK("Pics 1") + 13
- db BANK("Pics 15") ; BANK("Pics 1") + 14
- db BANK("Pics 16") ; BANK("Pics 1") + 15
- db BANK("Pics 17") ; BANK("Pics 1") + 16
- db BANK("Pics 18") ; BANK("Pics 1") + 17
- db BANK("Pics 19") ; BANK("Pics 1") + 18
- db BANK("Pics 20") ; BANK("Pics 1") + 19
- db BANK("Pics 21") ; BANK("Pics 1") + 20
- db BANK("Pics 22") ; BANK("Pics 1") + 21
- db BANK("Pics 23") ; BANK("Pics 1") + 22
+ ...
db BANK("Pics 24") ; BANK("Pics 1") + 23
```
@@ -121,18 +100,18 @@ Edit `GetFrontpicPointer`:
ld a, [wCurPartySpecies]
cp UNOWN
jr z, .unown
- ld a, [wCurPartySpecies]
+ ld hl, PokemonPicPointers
+ ld a, [wCurPartySpecies]
ld d, BANK(PokemonPicPointers)
jr .ok
-
.unown
- ld a, [wUnownLetter]
+ ld hl, UnownPicPointers
+ ld a, [wUnownLetter]
ld d, BANK(UnownPicPointers)
-
.ok
-- ld hl, PokemonPicPointers ; UnownPicPointers
+- ; These are assumed to be at the same address in their respective banks.
+- assert PokemonPicPointers == UnownPicPointers
+- ld hl, PokemonPicPointers
dec a
ld bc, 6
call AddNTimes
@@ -142,14 +121,14 @@ And `GetMonBackpic`:
```diff
- ; These are assumed to be at the same address in their respective banks.
-- ld hl, PokemonPicPointers ; UnownPicPointers
+- assert PokemonPicPointers == UnownPicPointers
+ ld hl, PokemonPicPointers
ld a, b
-+ ld hl, PokemonPicPointers
ld d, BANK(PokemonPicPointers)
cp UNOWN
jr nz, .ok
- ld a, c
+ ld hl, UnownPicPointers
+ ld a, c
ld d, BANK(UnownPicPointers)
.ok
dec a
diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm
index 23b0f606d..4e42db48d 100644
--- a/engine/gfx/load_pics.asm
+++ b/engine/gfx/load_pics.asm
@@ -109,13 +109,13 @@ GetFrontpicPointer:
ld a, [wCurPartySpecies]
ld d, BANK(PokemonPicPointers)
jr .ok
-
.unown
ld a, [wUnownLetter]
ld d, BANK(UnownPicPointers)
-
.ok
- ld hl, PokemonPicPointers ; UnownPicPointers
+ ; These are assumed to be at the same address in their respective banks.
+ assert PokemonPicPointers == UnownPicPointers
+ ld hl, PokemonPicPointers
dec a
ld bc, 6
call AddNTimes