-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathdraw_badges.asm
119 lines (100 loc) · 1.92 KB
/
draw_badges.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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, NUM_BADGES
call CopyData
; Booleans for each badge.
ld hl, wTempObtainedBadgesBooleans
ld bc, NUM_BADGES
xor a
call FillMemory
; Alter these based on owned badges.
ld de, wTempObtainedBadgesBooleans
ld hl, wBadgeOrFaceTiles
ld a, [wObtainedBadges]
ld b, a
ld c, NUM_BADGES
.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
hlcoord 2, 11
ld de, wTempObtainedBadgesBooleans
call .DrawBadgeRow
hlcoord 2, 14
ld de, wTempObtainedBadgesBooleans + 4
; fallthrough
.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, NUM_BADGES
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/trainer_card/badges.2bpp"