mirror of
https://github.com/pret/pokered.git
synced 2024-10-24 07:25:21 +00:00
121 lines
1.9 KiB
NASM
121 lines
1.9 KiB
NASM
|
DrawBadges:
|
||
|
; Draw 4x2 gym leader faces, with the faces replaced by
|
||
|
; badges if they are owned. Used in the player status screen.
|
||
|
|
||
|
; In Japanese versions, names are displayed above faces.
|
||
|
; Instead of removing relevant code, the name graphics were erased.
|
||
|
|
||
|
; Tile ids for face/badge graphics.
|
||
|
ld de, wBadgeOrFaceTiles
|
||
|
ld hl, .FaceBadgeTiles
|
||
|
ld bc, 8
|
||
|
call CopyData
|
||
|
|
||
|
; Booleans for each badge.
|
||
|
ld hl, wTempObtainedBadgesBooleans
|
||
|
ld bc, 8
|
||
|
xor a
|
||
|
call FillMemory
|
||
|
|
||
|
; Alter these based on owned badges.
|
||
|
ld de, wTempObtainedBadgesBooleans
|
||
|
ld hl, wBadgeOrFaceTiles
|
||
|
ld a, [wObtainedBadges]
|
||
|
ld b, a
|
||
|
ld c, 8
|
||
|
.CheckBadge
|
||
|
srl b
|
||
|
jr nc, .NextBadge
|
||
|
ld a, [hl]
|
||
|
add 4 ; Badge graphics are after each face
|
||
|
ld [hl], a
|
||
|
ld a, 1
|
||
|
ld [de], a
|
||
|
.NextBadge
|
||
|
inc hl
|
||
|
inc de
|
||
|
dec c
|
||
|
jr nz, .CheckBadge
|
||
|
|
||
|
; Draw two rows of badges.
|
||
|
ld hl, wBadgeNumberTile
|
||
|
ld a, $d8 ; [1]
|
||
|
ld [hli], a
|
||
|
ld [hl], $60 ; First name
|
||
|
|
||
|
coord hl, 2, 11
|
||
|
ld de, wTempObtainedBadgesBooleans
|
||
|
call .DrawBadgeRow
|
||
|
|
||
|
coord hl, 2, 14
|
||
|
ld de, wTempObtainedBadgesBooleans + 4
|
||
|
; call .DrawBadgeRow
|
||
|
; ret
|
||
|
|
||
|
.DrawBadgeRow
|
||
|
; Draw 4 badges.
|
||
|
|
||
|
ld c, 4
|
||
|
.DrawBadge
|
||
|
push de
|
||
|
push hl
|
||
|
|
||
|
; Badge no.
|
||
|
ld a, [wBadgeNumberTile]
|
||
|
ld [hli], a
|
||
|
inc a
|
||
|
ld [wBadgeNumberTile], a
|
||
|
|
||
|
; Names aren't printed if the badge is owned.
|
||
|
ld a, [de]
|
||
|
and a
|
||
|
ld a, [wBadgeNameTile]
|
||
|
jr nz, .SkipName
|
||
|
call .PlaceTiles
|
||
|
jr .PlaceBadge
|
||
|
|
||
|
.SkipName
|
||
|
inc a
|
||
|
inc a
|
||
|
inc hl
|
||
|
|
||
|
.PlaceBadge
|
||
|
ld [wBadgeNameTile], a
|
||
|
ld de, SCREEN_WIDTH - 1
|
||
|
add hl, de
|
||
|
ld a, [wBadgeOrFaceTiles]
|
||
|
call .PlaceTiles
|
||
|
add hl, de
|
||
|
call .PlaceTiles
|
||
|
|
||
|
; Shift badge array back one byte.
|
||
|
push bc
|
||
|
ld hl, wBadgeOrFaceTiles + 1
|
||
|
ld de, wBadgeOrFaceTiles
|
||
|
ld bc, 8
|
||
|
call CopyData
|
||
|
pop bc
|
||
|
|
||
|
pop hl
|
||
|
ld de, 4
|
||
|
add hl, de
|
||
|
|
||
|
pop de
|
||
|
inc de
|
||
|
dec c
|
||
|
jr nz, .DrawBadge
|
||
|
ret
|
||
|
|
||
|
.PlaceTiles
|
||
|
ld [hli], a
|
||
|
inc a
|
||
|
ld [hl], a
|
||
|
inc a
|
||
|
ret
|
||
|
|
||
|
.FaceBadgeTiles
|
||
|
db $20, $28, $30, $38, $40, $48, $50, $58
|
||
|
|
||
|
GymLeaderFaceAndBadgeTileGraphics:
|
||
|
INCBIN "gfx/badges.2bpp"
|