ref: 20444d2f63ffc1545d5fda81fd3883235be92a4c
parent: 99fbe3147bfb73ec02c0886dd6c16b6f94e0ebda
author: yenatch <[email protected]>
date: Tue Jun 3 10:07:10 EDT 2014
More MAX_LEVEL use.
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -7296,6 +7296,7 @@
Function3ee3b: ; 3ee3b
+; Give experience.
ld a, [InLinkBattle]
and a
ret nz
@@ -7329,7 +7330,7 @@
add hl, bc
ld d, h
ld e, l
- ld hl, EnemyMonType2
+ ld hl, EnemyMonBaseStats - 1
push bc
ld c, $5
.asm_3ee7c
@@ -7403,7 +7404,7 @@
jr z, .asm_3eee2
.asm_3eedd
- call Function3f106
+ call DoubleExp
ld a, $1
.asm_3eee2
@@ -7410,13 +7411,13 @@
ld [$d088], a
ld a, [IsInBattle]
dec a
- call nz, Function3f106
+ call nz, DoubleExp
push bc
- ld a, $1
+ ld a, PartyMon1Item - PartyMon1
call GetPartyParamLocation
ld a, [hl]
- cp $7e
- call z, Function3f106
+ cp LUCKY_EGG
+ call z, DoubleExp
ld a, [$ffb6]
ld [$d087], a
ld a, [$ffb5]
@@ -7464,7 +7465,7 @@
ld [CurSpecies], a
call GetBaseData
push bc
- ld d, $64
+ ld d, MAX_LEVEL
callab Function50e47
pop bc
ld hl, $000a
@@ -7497,10 +7498,10 @@
call Predef
callab Function50e1b
pop bc
- ld hl, $001f
+ ld hl, PartyMon1Level - PartyMon1
add hl, bc
ld a, [hl]
- cp $64
+ cp MAX_LEVEL
jp nc, .asm_3f0b9
cp d
jp z, .asm_3f0b9
@@ -7510,7 +7511,7 @@
ld a, d
ld [CurPartyLevel], a
ld [hl], a
- ld hl, $0000
+ ld hl, PartyMon1Species - PartyMon1
add hl, bc
ld a, [hl]
ld [CurSpecies], a
@@ -7704,7 +7705,7 @@
ret
; 3f106
-Function3f106: ; 3f106
+DoubleExp: ; 3f106
push bc
ld a, [$ffb5]
ld b, a
@@ -7791,7 +7792,7 @@
ld [hl], a
.asm_3f186
- ld d, $64
+ ld d, MAX_LEVEL
callab Function50e47
ld a, [hMultiplicand]
ld b, a
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -1,8 +1,10 @@
-; name length
+; strings
PLAYER_NAME_LENGTH EQU 8
PKMN_NAME_LENGTH EQU 11
NAME_LENGTH EQU 11
+LV_CHAR EQU $6e
+
; boxes
NUM_BOXES EQU 14
--- a/home.asm
+++ b/home.asm
@@ -1829,7 +1829,7 @@
; Print TempMonLevel at hl
ld a, [TempMonLevel]
- ld [hl], $6e ; ":L"
+ ld [hl], LV_CHAR
inc hl
; How many digits?
@@ -1845,7 +1845,7 @@
Function383d:: ; 383d
; Print :L and all 3 digits
- ld [hl], $6e
+ ld [hl], LV_CHAR
inc hl
ld c, 3
; 3842
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -1352,7 +1352,7 @@
call GetPartyParamLocation
ld a, [hl]
- cp 100
+ cp MAX_LEVEL
jp nc, Functionee83
inc a
--- a/main.asm
+++ b/main.asm
@@ -22210,15 +22210,15 @@
ld a, [hl]
and a
ret z
- cp $7
+ cp 6 + 1
jr c, .asm_13a54
- ld a, $6
+ ld a, 6
ld [hl], a
.asm_13a54
inc hl
ld b, a
- ld c, $0
+ ld c, 0
.asm_13a58
ld a, [hl]
and a
@@ -22229,13 +22229,13 @@
jr c, .asm_13a73
.asm_13a64
- ld [hl], $eb
+ ld [hl], SMEARGLE
push hl
push bc
ld a, c
- ld hl, PartyMon1
+ ld hl, PartyMon1Species
call GetPartyLocation
- ld [hl], $eb
+ ld [hl], SMEARGLE
pop bc
pop hl
@@ -22248,7 +22248,7 @@
ld hl, PartyMon1
ld a, [PartyCount]
ld d, a
- ld e, $0
+ ld e, 0
.asm_13a83
push de
push hl
@@ -22261,35 +22261,34 @@
jr c, .asm_13a9c
.asm_13a8f
- ld [hl], $eb
+ ld [hl], SMEARGLE
push de
- ld d, $0
+ ld d, 0
ld hl, PartySpecies
add hl, de
pop de
- ld a, $eb
+ ld a, SMEARGLE
ld [hl], a
.asm_13a9c
ld [CurSpecies], a
call GetBaseData
- ld hl, $001f
+ ld hl, PartyMon1Level - PartyMon1
add hl, bc
ld a, [hl]
- cp $2
- ld a, $2
+ cp 2
+ ld a, 2
jr c, .asm_13ab4
ld a, [hl]
- cp $64
+ cp MAX_LEVEL
jr c, .asm_13ab5
- ld a, $64
-
+ ld a, MAX_LEVEL
.asm_13ab4
ld [hl], a
-
.asm_13ab5
ld [CurPartyLevel], a
- ld hl, $0024
+
+ ld hl, PartyMon1MaxHP - PartyMon1
add hl, bc
ld d, h
ld e, l
@@ -22299,16 +22298,16 @@
ld a, $c
call Predef
pop hl
- ld bc, $0030
+ ld bc, PartyMon2 - PartyMon1
add hl, bc
pop de
inc e
dec d
jr nz, .asm_13a83
- ld de, $de41
+ ld de, PartyMonNicknames
ld a, [PartyCount]
ld b, a
- ld c, $0
+ ld c, 0
.asm_13adc
push bc
call Function13b71
@@ -22321,11 +22320,11 @@
push hl
ld hl, PartySpecies
push bc
- ld b, $0
+ ld b, 0
add hl, bc
pop bc
ld a, [hl]
- cp $fd
+ cp EGG
ld hl, String_13b6b
jr z, .asm_13b06
ld [$d265], a
@@ -22342,10 +22341,10 @@
inc c
dec b
jr nz, .asm_13adc
- ld de, $ddff
+ ld de, PartyMonOT
ld a, [PartyCount]
ld b, a
- ld c, $0
+ ld c, 0
.asm_13b1b
push bc
call Function13b71
@@ -22364,12 +22363,13 @@
inc c
dec b
jr nz, .asm_13b1b
- ld hl, $dce1
+
+ ld hl, PartyMon1Moves
ld a, [PartyCount]
ld b, a
.asm_13b40
push hl
- ld c, $4
+ ld c, NUM_MOVES
ld a, [hl]
and a
jr z, .asm_13b4b
@@ -22377,13 +22377,13 @@
jr c, .asm_13b4d
.asm_13b4b
- ld [hl], $1
+ ld [hl], POUND
.asm_13b4d
ld a, [hl]
and a
jr z, .asm_13b55
- cp $fc
+ cp NUM_ATTACKS + 1
jr c, .asm_13b5c
.asm_13b55
@@ -22401,7 +22401,7 @@
.asm_13b60
pop hl
push bc
- ld bc, $0030
+ ld bc, PartyMon2 - PartyMon1
add hl, bc
pop bc
dec b
@@ -22415,11 +22415,11 @@
Function13b71: ; 13b71
push de
- ld c, $1
- ld b, $6
+ ld c, 1
+ ld b, 6
.asm_13b76
ld a, [de]
- cp $50
+ cp "@"
jr z, .asm_13b85
inc de
inc c
@@ -22427,7 +22427,7 @@
jr nz, .asm_13b76
dec c
dec de
- ld a, $50
+ ld a, "@"
ld [de], a
.asm_13b85
@@ -59239,8 +59239,8 @@
and a
ret z
ld c, a
- ld b, $0
- ld hl, $c4d0
+ ld b, 0
+ hlcoord 8, 2
.asm_50181
push bc
push hl
@@ -59248,7 +59248,7 @@
jr z, .asm_501a7
push hl
ld a, b
- ld bc, $0030
+ ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Level
call AddNTimes
ld e, l
@@ -59255,12 +59255,11 @@
ld d, h
pop hl
ld a, [de]
- cp $64
+ cp 100 ; This is distinct from MAX_LEVEL.
jr nc, .asm_501a1
- ld a, $6e
+ ld a, LV_CHAR
ld [hli], a
ld bc, $4102
-
.asm_501a1
ld bc, $4103
call PrintNum
@@ -59267,7 +59266,7 @@
.asm_501a7
pop hl
- ld de, $0028
+ ld de, SCREEN_WIDTH * 2
add hl, de
pop bc
inc b
@@ -59281,7 +59280,7 @@
and a
ret z
ld c, a
- ld b, $0
+ ld b, 0
ld hl, $c4cd
.asm_501bd
push bc
@@ -59290,7 +59289,7 @@
jr z, .asm_501d5
push hl
ld a, b
- ld bc, $0030
+ ld bc, PartyMon2 - PartyMon1
ld hl, PartyMon1Status
call AddNTimes
ld e, l
@@ -59300,7 +59299,7 @@
.asm_501d5
pop hl
- ld de, $0028
+ ld de, SCREEN_WIDTH * 2
add hl, de
pop bc
inc b
@@ -59314,7 +59313,7 @@
and a
ret z
ld c, a
- ld b, $0
+ ld b, 0
ld hl, $c4d4
.asm_501eb
push bc
@@ -59324,7 +59323,7 @@
push hl
ld hl, PartySpecies
ld e, b
- ld d, $0
+ ld d, 0
add hl, de
ld a, [hl]
ld [CurPartySpecies], a
@@ -59336,7 +59335,7 @@
.asm_5020a
pop hl
- ld de, $0028
+ ld de, SCREEN_WIDTH * 2
add hl, de
pop bc
inc b