Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/battle/misc.asm
1271 views
1
; formats a string at wMovesString that lists the moves at wMoves
2
FormatMovesString:
3
ld hl, wMoves
4
ld de, wMovesString
5
ld b, $0
6
.printMoveNameLoop
7
ld a, [hli]
8
and a ; end of move list?
9
jr z, .printDashLoop ; print dashes when no moves are left
10
push hl
11
ld [wNameListIndex], a
12
ld a, BANK(MoveNames)
13
ld [wPredefBank], a
14
ld a, MOVE_NAME
15
ld [wNameListType], a
16
call GetName
17
ld hl, wNameBuffer
18
.copyNameLoop
19
ld a, [hli]
20
cp "@"
21
jr z, .doneCopyingName
22
ld [de], a
23
inc de
24
jr .copyNameLoop
25
.doneCopyingName
26
ld a, b
27
ld [wNumMovesMinusOne], a
28
inc b
29
ld a, "<NEXT>"
30
ld [de], a
31
inc de
32
pop hl
33
ld a, b
34
cp NUM_MOVES
35
jr z, .done
36
jr .printMoveNameLoop
37
.printDashLoop
38
ld a, "-"
39
ld [de], a
40
inc de
41
inc b
42
ld a, b
43
cp NUM_MOVES
44
jr z, .done
45
ld a, "<NEXT>"
46
ld [de], a
47
inc de
48
jr .printDashLoop
49
.done
50
ld a, "@"
51
ld [de], a
52
ret
53
54
; XXX this is called in a few places, but it doesn't appear to do anything useful
55
InitList:
56
ld a, [wInitListType]
57
cp INIT_ENEMYOT_LIST
58
jr nz, .notEnemy
59
ld hl, wEnemyPartyCount
60
ld de, wEnemyMonOT
61
ld a, ENEMYOT_NAME
62
jr .done
63
.notEnemy
64
cp INIT_PLAYEROT_LIST
65
jr nz, .notPlayer
66
ld hl, wPartyCount
67
ld de, wPartyMonOT
68
ld a, PLAYEROT_NAME
69
jr .done
70
.notPlayer
71
cp INIT_MON_LIST
72
jr nz, .notMonster
73
ld hl, wItemList
74
ld de, MonsterNames
75
ld a, MONSTER_NAME
76
jr .done
77
.notMonster
78
cp INIT_BAG_ITEM_LIST
79
jr nz, .notBag
80
ld hl, wNumBagItems
81
ld de, ItemNames
82
ld a, ITEM_NAME
83
jr .done
84
.notBag
85
ld hl, wItemList
86
ld de, ItemNames
87
ld a, ITEM_NAME
88
.done
89
ld [wNameListType], a
90
ld a, l
91
ld [wListPointer], a
92
ld a, h
93
ld [wListPointer + 1], a
94
ld a, e
95
ld [wUnusedNamePointer], a
96
ld a, d
97
ld [wUnusedNamePointer + 1], a
98
ld bc, ItemPrices
99
ld a, c
100
ld [wItemPrices], a
101
ld a, b
102
ld [wItemPrices + 1], a
103
ret
104
105
; get species of mon e in list [wMonDataLocation] for LoadMonData
106
GetMonSpecies:
107
ld hl, wPartySpecies
108
ld a, [wMonDataLocation]
109
and a
110
jr z, .getSpecies
111
dec a
112
jr z, .enemyParty
113
ld hl, wBoxSpecies
114
jr .getSpecies
115
.enemyParty
116
ld hl, wEnemyPartySpecies
117
.getSpecies
118
ld d, 0
119
add hl, de
120
ld a, [hl]
121
ld [wCurPartySpecies], a
122
ret
123
124