shithub: pokecrystal

Download patch

ref: 3735185ec24dd73de6863c58be4ddd4fc86ba00c
parent: 11b5c4c4851752fef66c075697b201dbf0c7aa1f
author: yenatch <yenatch@gmail.com>
date: Wed Feb 11 08:14:56 EST 2015

Use PartyMon labels in GetPartyParamLocation arguments.

--- a/battle/core.asm
+++ b/battle/core.asm
@@ -7366,7 +7366,7 @@
 .asm_3ee89
 	push hl
 	push bc
-	ld a, $1c
+	ld a, PartyMon1PokerusStatus - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
 	and a
@@ -7673,7 +7673,7 @@
 	cp b
 	jr z, .asm_3f0d1
 	ld [CurPartyMon], a
-	ld a, $0
+	ld a, PartyMon1Species - PartyMon1
 	call GetPartyParamLocation
 	ld b, h
 	ld c, l
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -1380,7 +1380,7 @@
 	callba Function50e47
 
 	pop de
-	ld a, $8
+	ld a, PartyMon1Exp - PartyMon1
 	call GetPartyParamLocation
 
 	ld a, [hMultiplicand]
@@ -1390,7 +1390,7 @@
 	ld a, [$ffb6]
 	ld [hl], a
 
-	ld a, $24
+	ld a, PartyMon1MaxHP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld b, a
@@ -1398,7 +1398,7 @@
 	push bc
 	call Functionee8c
 
-	ld a, $25
+	ld a, PartyMon1MaxHP + 1 - PartyMon1
 	call GetPartyParamLocation
 
 	pop bc
@@ -1498,7 +1498,7 @@
 	ld a, $1
 	ret z
 	call Functionf058
-	ld a, $20
+	ld a, PartyMon1Status - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
 	and c
@@ -1537,7 +1537,7 @@
 Functionf01e: ; f01e (3:701e)
 	call Functionf2a6
 	ret nc
-	ld a, $22
+	ld a, PartyMon1HP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld [BattleMonHP], a
@@ -1955,7 +1955,7 @@
 Functionf2c3: ; f2c3 (3:72c3)
 	call Functionf36f
 asm_f2c6: ; f2c6 (3:72c6)
-	ld a, $22
+	ld a, PartyMon1HP - PartyMon1
 	call GetPartyParamLocation
 	ld [hl], d
 	inc hl
@@ -1963,7 +1963,7 @@
 	jp Functionf328
 
 Functionf2d1: ; f2d1 (3:72d1)
-	ld a, $23
+	ld a, PartyMon1HP + 1 - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
 	add e
@@ -1973,11 +1973,11 @@
 	ld [hl], a
 	jr c, .asm_f2f5
 	call Functionf328
-	ld a, $23
+	ld a, PartyMon1HP + 1 - PartyMon1
 	call GetPartyParamLocation
 	ld d, h
 	ld e, l
-	ld a, $25
+	ld a, PartyMon1MaxHP + 1 - PartyMon1
 	call GetPartyParamLocation
 	ld a, [de]
 	sub [hl]
@@ -1992,7 +1992,7 @@
 	ret
 
 Functionf2f9: ; f2f9 (3:72f9)
-	ld a, $23
+	ld a, PartyMon1HP + 1 - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
 	sub e
@@ -2030,7 +2030,7 @@
 	ret
 
 Functionf328: ; f328 (3:7328)
-	ld a, $22
+	ld a, PartyMon1HP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld [wd1ef], a
@@ -2056,7 +2056,7 @@
 ; f348
 
 Functionf348: ; f348 (3:7348)
-	ld a, $22
+	ld a, PartyMon1HP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld [wd1ed], a
@@ -2073,7 +2073,7 @@
 
 Functionf35f: ; f35f (3:735f)
 	push hl
-	ld a, $24
+	ld a, PartyMon1MaxHP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld [Buffer2], a
--- a/main.asm
+++ b/main.asm
@@ -13615,26 +13615,26 @@
 ; e134
 
 Functione134: ; e134
-	ld a, $1f
+	ld a, PartyMon1Level - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
-	ld [$001f], a ; wow
-	ld a, $0
+	ld [PartyMon1Level - PartyMon1], a ; wow
+	ld a, PartyMon1Species - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
 	ld [CurSpecies], a
 	call GetBaseData
-	ld a, $24
+	ld a, PartyMon1MaxHP - PartyMon1
 	call GetPartyParamLocation
 	ld d, h
 	ld e, l
 	push de
-	ld a, $a
+	ld a, PartyMon1Exp + 2 - PartyMon1
 	call GetPartyParamLocation
 	ld b, $1
 	call Functione167
 	pop de
-	ld a, $22
+	ld a, PartyMon1HP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [de]
 	inc de
@@ -20301,7 +20301,7 @@
 ; 0x12f05
 
 Function12f05: ; 12f05
-	ld a, $24
+	ld a, PartyMon1MaxHP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld [hProduct], a
@@ -20311,7 +20311,7 @@
 	ld [hMultiplier], a
 	ld b, $2
 	call Divide
-	ld a, $23
+	ld a, PartyMon1HP + 1 - PartyMon1
 	call GetPartyParamLocation
 	ld a, [$ffb6]
 	sub [hl]
@@ -33120,11 +33120,11 @@
 	ld a, [InLinkBattle]
 	and a
 	jr nz, .asm_24e03
-	ld a, $2
+	ld a, PartyMon1Moves - PartyMon1
 	call GetPartyParamLocation
 	ld d, h
 	ld e, l
-	ld c, $4
+	ld c, NUM_MOVES
 .asm_24ded
 	push bc
 	push de
@@ -33155,7 +33155,7 @@
 	and a
 	jr nz, .asm_24e2f
 	push hl
-	ld a, $1
+	ld a, PartyMon1Item - PartyMon1
 	call GetPartyParamLocation
 	ld d, [hl]
 	callba ItemIsMail
@@ -37974,17 +37974,17 @@
 	ld b, $1
 	pop af
 	ld c, a
-	cp $97
+	cp MEW
 	jr z, .asm_28e49
 	ld a, [CurPartySpecies]
-	cp $97
+	cp MEW
 	jr z, .asm_28e49
 	ld b, $2
 	ld a, c
-	cp $fb
+	cp CELEBI
 	jr z, .asm_28e49
 	ld a, [CurPartySpecies]
-	cp $fb
+	cp CELEBI
 	jr z, .asm_28e49
 	ld b, $0
 
@@ -47620,7 +47620,7 @@
 
 
 Function4456e: ; 4456e
-	ld a, $1
+	ld a, PartyMon1Item - PartyMon1
 	call GetPartyParamLocation
 	ld d, [hl]
 	callba ItemIsMail
@@ -47646,7 +47646,7 @@
 	xor a
 	ld bc, $002f
 	call ByteFill
-	ld a, $1
+	ld a, PartyMon1Item - PartyMon1
 	call GetPartyParamLocation
 	ld [hl], $0
 	ld hl, $a834
@@ -58745,34 +58745,39 @@
 ; 5062e
 
 Function5062e: ; 5062e
-	ld a, $20
+	ld a, PartyMon1Status - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hl]
-	and $8
+	and 1 << PSN
 	ret z
-	ld a, $22
+
+	ld a, PartyMon1HP - PartyMon1
 	call GetPartyParamLocation
 	ld a, [hli]
 	ld b, a
 	ld c, [hl]
+
 	or c
 	ret z
+
 	dec bc
 	ld [hl], c
 	dec hl
 	ld [hl], b
+
 	ld a, b
 	or c
-	jr nz, .asm_50654
-	ld a, $20
+	jr nz, .not_fainted
+
+	ld a, PartyMon1Status - PartyMon1
 	call GetPartyParamLocation
-	ld [hl], $0
-	ld c, $2
+	ld [hl], 0
+	ld c, 2
 	scf
 	ret
 
-.asm_50654
-	ld c, $1
+.not_fainted
+	ld c, 1
 	scf
 	ret
 ; 50658
@@ -70785,7 +70790,7 @@
 	dec a
 	ld [CurPartyMon], a
 	push bc
-	ld a, $1
+	ld a, PartyMon1Item - PartyMon1
 	call GetPartyParamLocation
 	pop bc
 	ld a, [hl]