diff options
-rwxr-xr-x | data/types/names.asm | 50 | ||||
-rwxr-xr-x | engine/pokemon/types.asm | 92 | ||||
-rw-r--r-- | main.asm | 11 |
3 files changed, 145 insertions, 8 deletions
diff --git a/data/types/names.asm b/data/types/names.asm new file mode 100755 index 00000000..62d8e13b --- /dev/null +++ b/data/types/names.asm @@ -0,0 +1,50 @@ +TypeNames: +; entries correspond to types (see constants/type_constants.asm) + dw Normal + dw Fighting + dw Flying + dw Poison + dw Ground + dw Rock + dw Bird + dw Bug + dw Ghost + dw Steel + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw Normal + dw CurseType + dw Fire + dw Water + dw Grass + dw Electric + dw Psychic + dw Ice + dw Dragon + dw Dark + +Normal: db "NORMAL@" +Fighting: db "FIGHTING@" +Flying: db "FLYING@" +Poison: db "POISON@" +CurseType: db "???@" +Fire: db "FIRE@" +Water: db "WATER@" +Grass: db "GRASS@" +Electric: db "ELECTRIC@" +Psychic: db "PSYCHIC@" +Ice: db "ICE@" +Ground: db "GROUND@" +Rock: db "ROCK@" +Bird: db "BIRD@" +Bug: db "BUG@" +Ghost: db "GHOST@" +Steel: db "STEEL@" +Dragon: db "DRAGON@" +Dark: db "DARK@" 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" @@ -366,15 +366,10 @@ INCLUDE "engine/events/card_key.asm" INCLUDE "engine/events/basement_key.asm" INCLUDE "engine/events/sacred_ash.asm" INCLUDE "engine/pokemon/tempmon.asm" +INCLUDE "engine/pokemon/types.asm" -PrintMonTypes:: - dr $50940, $5096d -PrintMoveType:: - dr $5096d, $50986 -PrintType:: - dr $50986, $50997 -GetTypeName:: - dr $50997, $50b3d +unk_014_4a5b: + dr $50a5b, $50b3d DrawPlayerHP:: dr $50b3d, $50b41 |