Convert code samples in design_flaws.md to diffs

This commit is contained in:
Thomas Winwood 2018-06-09 23:27:47 +01:00 committed by GitHub
parent 6130fc5cd6
commit 62439a95a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,21 +151,22 @@ Don't enforce `org $4000` in pokecrystal.link.
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 @@ Modify `GetFrontpicPointer`:
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 @@ INCBIN "gfx/footprints/wartortle.1bpp"
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 @@ Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data.
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 @@ GetTMHMNumber:: ; d407
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