diff options
author | libjet <libj3t@gmail.com> | 2020-05-21 16:00:49 +0100 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-05-21 16:00:49 +0100 |
commit | eb88ad0d1917b6e2b4ab8ed6b4544fd7cd7da570 (patch) | |
tree | c2018b4183f468b988e643f07ff45ef14ffce83d /engine | |
parent | 76b9e5b98267c027b70a863e7f3df2dc86d8f705 (diff) |
Add engine/pokemon/types.asm
Diffstat (limited to 'engine')
-rwxr-xr-x | engine/pokemon/types.asm | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/engine/pokemon/types.asm b/engine/pokemon/types.asm new file mode 100755 index 00000000..3c9d28cd --- /dev/null +++ b/engine/pokemon/types.asm @@ -0,0 +1,92 @@ +PrintMonTypes: +; Print one or both types of [wCurSpecies] +; on the stats screen at hl. + + push hl + call GetBaseData + pop hl + + push hl + ld a, [wBaseType1] + call .Print + + ; Single-typed monsters really + ; have two of the same type. + ld a, [wBaseType1] + ld b, a + ld a, [wBaseType2] + cp b + pop hl + jr z, .hide_type_2 + + ld bc, $28 + add hl, bc + +.Print: + ld b, a + jr PrintType + +.hide_type_2 + ; Erase any type name that was here before. + ; Seems to be pointless in localized versions. + ld a, " " + ld bc, SCREEN_WIDTH - 3 + add hl, bc + ld [hl], a + inc bc + add hl, bc + ld bc, NAME_LENGTH_JAPANESE - 1 + jp ByteFill + +PrintMoveType: +; Print the type of move b at hl. + + push hl + ld a, b + dec a + ld bc, MOVE_LENGTH + ld hl, Moves + call AddNTimes + ld de, wStringBuffer1 + ld a, BANK(Moves) + call FarCopyBytes + ld a, [wStringBuffer1 + MOVE_TYPE] + pop hl + + ld b, a + +PrintType: +; Print type b at hl. + + ld a, b + + push hl + add a + ld hl, TypeNames + ld e, a + ld d, 0 + add hl, de + ld a, [hli] + ld e, a + ld d, [hl] + pop hl + + jp PlaceString + +GetTypeName: +; Copy the name of type [wNamedObjectIndexBuffer] to wStringBuffer1. + + ld a, [wNamedObjectIndexBuffer] + ld hl, TypeNames + ld e, a + ld d, 0 + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld de, wStringBuffer1 + ld bc, MOVE_NAME_LENGTH + jp CopyBytes + +INCLUDE "data/types/names.asm" |