shithub: pokecrystal

Download patch

ref: 62439a95a1a7efed07f7189216ce3f9011200f32
parent: 6130fc5cd6b002f827d307c64a432e960629cb9b
author: Thomas Winwood <[email protected]>
date: Sat Jun 9 19:27:47 EDT 2018

Convert code samples in design_flaws.md to diffs

--- a/docs/design_flaws.md
+++ b/docs/design_flaws.md
@@ -151,21 +151,22 @@
 
 Modify `GetFrontpicPointer`:
 
-```asm
+```diff
 	ld a, [wCurPartySpecies]
 	cp UNOWN
 	jr z, .unown
 	ld a, [wCurPartySpecies]
-	ld hl, PokemonPicPointers
++	ld hl, PokemonPicPointers
 	ld d, BANK(PokemonPicPointers)
 	jr .ok
 
 .unown
 	ld a, [wUnownLetter]
-	ld hl, UnownPicPointers
++	ld hl, UnownPicPointers
 	ld d, BANK(UnownPicPointers)
 
 .ok
+-	ld hl, PokemonPicPointers ; UnownPicPointers
 	dec a
 	ld bc, 6
 	call AddNTimes
@@ -174,13 +175,15 @@
 And `GetMonBackpic`:
 
 ```asm
+-	; These are assumed to be at the same address in their respective banks.
+-	ld hl, PokemonPicPointers ; UnownPicPointers
 	ld a, b
-	ld hl, PokemonPicPointers
++	ld hl, PokemonPicPointers
 	ld d, BANK(PokemonPicPointers)
 	cp UNOWN
 	jr nz, .ok
 	ld a, c
-	ld hl, UnownPicPointers
++	ld hl, UnownPicPointers
 	ld d, BANK(UnownPicPointers)
 .ok
 	dec a
@@ -267,11 +270,25 @@
 
 Modify `Pokedex_LoadAnyFootprint`:
 
-```asm
+```diff
+-	push hl
+-	ld e, l
+-	ld d, h
+-	ld hl, vTiles2 tile $62
+-	lb bc, BANK(Footprints), 2
+-	call Request1bpp
+-	pop hl
+-
+-	; Whoever was editing footprints forgot to fix their
+-	; tile editor. Now each bottom half is 8 tiles off.
+-	ld de, 8 tiles
+-	add hl, de
+-
 	ld e, l
 	ld d, h
-	ld hl, vTiles2 tile $62
-	lb bc, BANK(Footprints), 4
+	ld hl, vTiles2 tile $64
+-	lb bc, BANK(Footprints), 2
++	lb bc, BANK(Footprints), 4
 	call Request1bpp
 ```
 
@@ -340,10 +357,19 @@
 
 Modify engine/items/items.asm:
 
-```asm
+```diff
 GetTMHMNumber:: ; d407
 ; Return the number of a TM/HM by item id c.
 	ld a, c
+-; Skip any dummy items.
+-	cp ITEM_C3 ; TM04-05
+-	jr c, .done
+-	cp ITEM_DC ; TM28-29
+-	jr c, .skip
+-	dec a
+-.skip
+-	dec a
+-.done
 	sub TM01
 	inc a
 	ld c, a
@@ -352,6 +378,16 @@
 GetNumberedTMHM: ; d417
 ; Return the item id of a TM/HM by number c.
 	ld a, c
+-; Skip any gaps.
+-	cp ITEM_C3 - (TM01 - 1)
+-	jr c, .done
+-	cp ITEM_DC - (TM01 - 1) - 1
+-	jr c, .skip_one
+-.skip_two
+-	inc a
+-.skip_one
+-	inc a
+-.done
 	add TM01
 	dec a
 	ld c, a