From 62439a95a1a7efed07f7189216ce3f9011200f32 Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Sat, 9 Jun 2018 23:27:47 +0100 Subject: [PATCH] Convert code samples in design_flaws.md to diffs --- docs/design_flaws.md | 54 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/docs/design_flaws.md b/docs/design_flaws.md index 6b015a56a..a7100fc7f 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -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