ref: 7996f5b1ab310c0f587347b23148a4be515d4a53
parent: ca58bd215cc462a950dc889f9d7f0f9e8ecd1b02
author: yenatch <yenatch@gmail.com>
date: Tue Sep 30 07:19:33 EDT 2014
Miscellaneous formatting cleanup.
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -2123,11 +2123,10 @@
Unknown_976c0: ; 0x976c0
call GetScriptByte
- cp $3
- jr c, .asm_976c8
+ cp 3
+ jr c, .ok
xor a
-.asm_976c8
-; 976c8
+.ok
Function976c8: ; 976c8
ld hl, StringBuffer3
--- a/home.asm
+++ b/home.asm
@@ -649,14 +649,14 @@
ld sp, hl
ld a, [$ffd7]
ld h, a
- ld l, $0
- ld a, $12
+ ld l, 0
+ ld a, 18
ld [$ffd3], a
- ld b, $2
- ld c, $41
+ ld b, 1 << 1 ; not in v/hblank
+ ld c, rSTAT % $100
.loop
-rept 10
+rept 20 / 2
pop de
.loop\@
ld a, [$ff00+c]
@@ -668,7 +668,7 @@
inc l
endr
- ld de, $000c
+ ld de, 32 - 20
add hl, de
ld a, [$ffd3]
dec a
@@ -848,13 +848,13 @@
push de
ld a, [$cf61]
- cp 1 ; Pokemon names
+ cp PKMN_NAME
jr nz, .NotPokeName
ld a, [CurSpecies]
ld [$d265], a
call GetPokemonName
- ld hl, 11
+ ld hl, PKMN_NAME_LENGTH
add hl, de
ld e, l
ld d, h
@@ -995,7 +995,7 @@
jr nc, .TM
ld [CurSpecies], a
- ld a, 4 ; Item names
+ ld a, ITEM_NAME
ld [$cf61], a
call GetName
jr .Copied
@@ -1047,9 +1047,9 @@
ld a, c
jr c, .asm_34b9
sub NUM_TMS
+.asm_34b9
; Divide and mod by 10 to get the top and bottom digits respectively
-.asm_34b9
ld b, "0"
.mod10
sub 10
@@ -1123,15 +1123,16 @@
GetMoveName:: ; 34f8
push hl
-; move name
- ld a, $2 ; move names
+
+ ld a, MOVE_NAME
ld [$cf61], a
-; move id
- ld a, [$d265]
+
+ ld a, [$d265] ; move id
ld [CurSpecies], a
call GetName
ld de, StringBuffer1
+
pop hl
ret
; 350c
@@ -1141,12 +1142,14 @@
call Function1c66
ld a, [hROMBank]
push af
- ld a, $9
+
+ ld a, BANK(Function245af)
rst Bankswitch
call Function245af
call Function3524
call Function245cb
+
pop af
rst Bankswitch
@@ -1182,6 +1185,7 @@
Function354b:: ; 354b
call DelayFrame
+
ld a, [$ffaa]
push af
ld a, $1
@@ -1189,11 +1193,12 @@
call Functiona57
pop af
ld [$ffaa], a
+
ld a, [$ffa9]
- and $f0
+ and D_RIGHT + D_LEFT + D_UP + D_DOWN
ld c, a
ld a, [hJoyPressed]
- and $f
+ and A_BUTTON + B_BUTTON + SELECT + START
or c
ld c, a
ret
@@ -1203,12 +1208,13 @@
Function3567:: ; 3567
ld a, [hROMBank]
push af
+
call Function2c52
call Function3574
+
pop bc
ld a, b
rst Bankswitch
-
ret
; 3574
@@ -1218,6 +1224,7 @@
ld a, [hl]
cp $ff
jr z, .asm_3597
+
ld l, a
push hl
call Function3599
@@ -1239,6 +1246,7 @@
Function3599:: ; 3599
push de
+
ld hl, $0010
add hl, de
ld a, [hl]
@@ -1245,12 +1253,14 @@
ld hl, $0011
add hl, de
ld e, [hl]
- sub $4
+
+ sub 4
ld d, a
ld a, e
- sub $4
+ sub 4
ld e, a
call Function35b0
+
pop de
ret
; 35b0
@@ -1263,7 +1273,8 @@
ld a, [$dbfb]
and a
jr z, .asm_35d3
-.asm_35bc
+
+.loop
push af
ld a, [hl]
cp e
@@ -1280,11 +1291,11 @@
ld l, a
jr nc, .asm_35cf
inc h
-
.asm_35cf
+
pop af
dec a
- jr nz, .asm_35bc
+ jr nz, .loop
.asm_35d3
and a
@@ -1343,8 +1354,8 @@
ld a, [hROMBank]
push af
- call Function2c52
+ call Function2c52
call CheckTrainerBattle
pop bc
@@ -1442,7 +1453,7 @@
ld a, b
ld [$d03f], a
ld a, c
- ld [MartPointer], a
+ ld [$d040], a
jr Function367e
; 3674
@@ -1450,7 +1461,7 @@
ld a, $1
ld [$d03f], a
ld a, $ff
- ld [MartPointer], a
+ ld [$d040], a
Function367e:: ; 367e
call GetMapScriptHeaderBank
@@ -1585,12 +1596,12 @@
cp BATTLETYPE_CANLOSE
jr .asm_3724
- ld hl, WalkingTile
+ ld hl, $d047
jr .asm_3731
.asm_3724
ld a, [$d0ee]
- ld hl, WalkingTile
+ ld hl, $d047
and $f
jr z, .asm_3731
ld hl, $d049
@@ -1750,7 +1761,7 @@
Function3842:: ; 3842
ld [$d265], a
ld de, $d265
- ld b, %01000001 ; flags
+ ld b, 1 << 6 + 1
jp PrintNum
; 384d
@@ -1758,7 +1769,7 @@
Function384d:: ; 384d
ld hl, $d25e
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
ld a, [hl]
ret
@@ -2105,8 +2116,8 @@
Function3efd:: ; 3efd
push hl
hlcoord 0, 12
- ld b, $4
- ld c, $12
+ ld b, 4
+ ld c, 18
call Function3f0d
pop hl
call PrintTextBoxText
--- a/main.asm
+++ b/main.asm
@@ -31170,7 +31170,7 @@
call Function24329
.asm_241d8
call Function2431a
- call $402d ; This call jumps to the middle of an instruction.
+ call Function10402d ; BUG: This function is in a different bank.
call Function241fa
jr nc, .asm_241f9
call Function24270
@@ -38661,7 +38661,7 @@
ld de, $c736
call PlaceString
ld hl, $c741
- ld de, NULL
+ ld de, 0
.asm_2931e
ld a, [hli]
cp $50
@@ -94686,7 +94686,7 @@
pop hl
ld a, [wCurBox]
push af
- ld bc, NULL
+ ld bc, 0
ld a, [$cb31]
and a
jr nz, .asm_e3215