ref: 1347023128e141dc4cfc71ee6bc689f909e96919
parent: 72bbaed99f725b2b8b0d2653968042ce1625354c
author: YamaArashi <shadow962@live.com>
date: Sat Feb 7 19:17:03 EST 2015
move-related things
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -2533,14 +2533,14 @@
jr .regularmenu
.loadmoves
- ld de, wd0dc
- ld bc, $4
+ ld de, wMoves
+ ld bc, NUM_MOVES
call CopyData
- callab Func_39b87
+ callab FormatMovesString
ret
.writemoves
- ld de, wd0e1
+ ld de, wMovesString
ld a, [hFlags_0xFFF6]
set 2, a
ld [hFlags_0xFFF6], a
--- a/engine/battle/e.asm
+++ b/engine/battle/e.asm
@@ -577,14 +577,15 @@
INCLUDE "text/trainer_names.asm"
-Func_39b87: ; 39b87 (e:5b87)
- ld hl, wd0dc
- ld de, wd0e1
+; formats a string at wMovesString that lists the moves at wMoves
+FormatMovesString: ; 39b87 (e:5b87)
+ ld hl, wMoves
+ ld de, wMovesString
ld b, $0
-.asm_39b8f
+.printMoveNameLoop
ld a, [hli]
- and a
- jr z, .asm_39bc1
+ and a ; end of move list?
+ jr z, .printDashLoop ; print dashes when no moves are left
push hl
ld [wd0b5], a
ld a, BANK(MoveNames)
@@ -593,38 +594,38 @@
ld [W_LISTTYPE], a
call GetName
ld hl, wcd6d
-.asm_39ba7
+.copyNameLoop
ld a, [hli]
cp $50
- jr z, .asm_39bb0
+ jr z, .doneCopyingName
ld [de], a
inc de
- jr .asm_39ba7
-.asm_39bb0
+ jr .copyNameLoop
+.doneCopyingName
ld a, b
ld [wcd6c], a
inc b
- ld a, $4e
+ ld a, $4e ; line break
ld [de], a
inc de
pop hl
ld a, b
- cp $4
- jr z, .asm_39bd1
- jr .asm_39b8f
-.asm_39bc1
+ cp NUM_MOVES
+ jr z, .done
+ jr .printMoveNameLoop
+.printDashLoop
ld a, "-"
ld [de], a
inc de
inc b
ld a, b
- cp $4
- jr z, .asm_39bd1
- ld a, $4e
+ cp NUM_MOVES
+ jr z, .done
+ ld a, $4e ; line break
ld [de], a
inc de
- jr .asm_39bc1
-.asm_39bd1
+ jr .printDashLoop
+.done
ld a, "@"
ld [de], a
ret
--- a/engine/evos_moves.asm
+++ b/engine/evos_moves.asm
@@ -364,7 +364,7 @@
dec b
jr nz, .checkCurrentMovesLoop
ld a, d
- ld [wd0e0], a
+ ld [wMoveNum], a
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B
--- a/engine/items/items.asm
+++ b/engine/items/items.asm
@@ -2084,7 +2084,7 @@
ld [wd11e],a
predef TMToMove ; get move ID from TM/HM ID
ld a,[wd11e]
- ld [wd0e0],a
+ ld [wMoveNum],a
call GetMoveName
call CopyStringToCF4B ; copy name to wcf4b
pop af
--- a/engine/items/tmhm.asm
+++ b/engine/items/tmhm.asm
@@ -1,12 +1,12 @@
-; checks if the mon in wWhichPokemon already knows the move in wd0e0
+; checks if the mon in [wWhichPokemon] already knows the move in [wMoveNum]
CheckIfMoveIsKnown: ; 2fe18 (b:7e18)
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
- ld bc, $2c
+ ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
- ld a, [wd0e0]
+ ld a, [wMoveNum]
ld b, a
- ld c, $4 ; nubmer of moves
+ ld c, NUM_MOVES
.loop
ld a, [hli]
cp b
--- a/engine/items/tms.asm
+++ b/engine/items/tms.asm
@@ -1,4 +1,4 @@
-; tests if mon [wcf91] can learn move [wd0e0]
+; tests if mon [wcf91] can learn move [wMoveNum]
CanLearnTM: ; 1373e (4:773e)
ld a, [wcf91]
ld [wd0b5], a
@@ -5,7 +5,7 @@
call GetMonHeader
ld hl, W_MONHLEARNSET
push hl
- ld a, [wd0e0]
+ ld a, [wMoveNum]
ld b, a
ld c, $0
ld hl, TechnicalMachines
--- a/engine/learn_move.asm
+++ b/engine/learn_move.asm
@@ -36,7 +36,7 @@
pop de
pop hl
.asm_6e8b
- ld a, [wd0e0]
+ ld a, [wMoveNum]
ld [hl], a
ld bc, $15
add hl, bc
@@ -64,7 +64,7 @@
ld h, d
ld l, e
ld de, wBattleMonMoves
- ld bc, $4
+ ld bc, NUM_MOVES
call CopyData
ld bc, $11
add hl, bc
@@ -111,10 +111,10 @@
ld bc, $fffc
add hl, bc
push hl
- ld de, wd0dc
- ld bc, $4
+ ld de, wMoves
+ ld bc, NUM_MOVES
call CopyData
- callab Func_39b87
+ callab FormatMovesString
pop hl
.asm_6f39
push hl
@@ -125,7 +125,7 @@
ld c, $e
call TextBoxBorder
hlCoord 6, 8
- ld de, wd0e1
+ ld de, wMovesString
ld a, [hFlags_0xFFF6]
set 2, a
ld [hFlags_0xFFF6], a
--- a/engine/menu/status_screen.asm
+++ b/engine/menu/status_screen.asm
@@ -233,13 +233,13 @@
ld [hTilesetType], a
ld [$ffba], a
ld bc, $0005
- ld hl, wd0dc
+ ld hl, wMoves
call FillMemory
ld hl, wLoadedMonMoves
- ld de, wd0dc
- ld bc, $0004
+ ld de, wMoves
+ ld bc, NUM_MOVES
call CopyData
- callab Func_39b87
+ callab FormatMovesString
hlCoord 9, 2
ld bc, $050a
call ClearScreenArea ; Clear under name
@@ -250,7 +250,7 @@
ld c, $12
call TextBoxBorder ; Draw move container
hlCoord 2, 9
- ld de, wd0e1
+ ld de, wMovesString
call PlaceString ; Print moves
ld a, [wcd6c]
inc a
--- a/home.asm
+++ b/home.asm
@@ -259,8 +259,8 @@
Func_137a:: ; 137a (0:137a)
-; Write c to [wd0dc + b]. Unused.
- ld hl, wd0dc
+; Write c to [wMoves + b]. Unused.
+ ld hl, wMoves
ld e, b
ld d, 0
add hl, de
@@ -546,7 +546,7 @@
Func_152e:: ; 152e (0:152e)
; Unused.
- ld hl,wd0dc
+ ld hl,wMoves
ld c,a
ld b,0
add hl,bc
--- a/wram.asm
+++ b/wram.asm
@@ -1275,10 +1275,17 @@
wRepelRemainingSteps:: ; wd0db
ds 1
-
-wd0dc:: ds 4
-wd0e0:: ds 1
-wd0e1:: ds 56
+
+wMoves:: ; wd0dc
+; list of moves for FormatMovesString
+ ds 4
+
+wMoveNum:: ; d0e0
+ ds 1
+
+wMovesString:: ; d0e1
+ ds 56
+
wd119:: ds 1
wWalkBikeSurfStateCopy:: ; d11a