From 0e1148fb2c754c579284b609c4edbfd676c8d044 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 12 Jan 2018 03:15:58 -0500 Subject: [PATCH] Move code out of data/ --- data/items/descriptions.asm | 33 ------------------------ engine/routines/printitemdescription.asm | 31 ++++++++++++++++++++++ main.asm | 1 + 3 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 engine/routines/printitemdescription.asm diff --git a/data/items/descriptions.asm b/data/items/descriptions.asm index e5b01e8fd04..20542b9e034 100644 --- a/data/items/descriptions.asm +++ b/data/items/descriptions.asm @@ -1,36 +1,3 @@ -PrintItemDescription: ; 0x1c8955 -; Print the description for item [CurSpecies] at de. - - ld a, [CurSpecies] - cp TM01 - jr c, .not_a_tm - - ld [CurItem], a - push de - farcall GetTMHMItemMove - pop hl - ld a, [wd265] - ld [CurSpecies], a - predef PrintMoveDesc - ret - -.not_a_tm - push de - ld hl, ItemDescriptions - ld a, [CurSpecies] - dec a - ld c, a - ld b, 0 - add hl, bc - add hl, bc - ld e, [hl] - inc hl - ld d, [hl] - pop hl - jp PlaceString -; 0x1c8987 - - ItemDescriptions: dw MasterBallDesc dw UltraBallDesc diff --git a/engine/routines/printitemdescription.asm b/engine/routines/printitemdescription.asm new file mode 100644 index 00000000000..e6d087dae8b --- /dev/null +++ b/engine/routines/printitemdescription.asm @@ -0,0 +1,31 @@ +PrintItemDescription: ; 0x1c8955 +; Print the description for item [CurSpecies] at de. + + ld a, [CurSpecies] + cp TM01 + jr c, .not_a_tm + + ld [CurItem], a + push de + farcall GetTMHMItemMove + pop hl + ld a, [wd265] + ld [CurSpecies], a + predef PrintMoveDesc + ret + +.not_a_tm + push de + ld hl, ItemDescriptions + ld a, [CurSpecies] + dec a + ld c, a + ld b, 0 + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + pop hl + jp PlaceString +; 0x1c8987 diff --git a/main.asm b/main.asm index da9405cca0f..c5e49c54aca 100644 --- a/main.asm +++ b/main.asm @@ -596,6 +596,7 @@ INCLUDE "data/phone/text/trainers1.asm" SECTION "Miscellaneous Text", ROMX INCLUDE "data/items/names.asm" +INCLUDE "engine/routines/printitemdescription.asm" INCLUDE "data/items/descriptions.asm" INCLUDE "data/moves/names.asm" INCLUDE "engine/landmarks.asm"