shithub: pokecrystal

Download patch

ref: 32a5f21cc7c35b2580ae2c5f3709676dd8ca8405
parent: 6fee80528af6be1c22fee42e2560023823f7da8f
author: yenatch <[email protected]>
date: Mon Jun 23 08:45:30 EDT 2014

More PartyMon labels for relative addressing.

--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -1523,13 +1523,13 @@
 	ld b, a
 	ld c, 0
 	ld hl, OTPartyMon1HP
-	ld de, $0030
+	ld de, OTPartyMon2 - OTPartyMon1
 
-.asm_38d2c
+.loop
 	push hl
 	ld a, [hli]
 	or [hl]
-	jr z, .asm_38d37
+	jr z, .next
 
 	dec hl
 	dec hl
@@ -1538,34 +1538,31 @@
 	or c
 	ld c, a
 
-.asm_38d37
+.next
 	pop hl
 	add hl, de
 	dec b
-	jr nz, .asm_38d2c
+	jr nz, .loop
 
 	pop hl
 	ld a, c
 	and a
-	jr z, .asm_38d52
+	jr z, .no_status
 
 	ld a, [EnemyMonStatus]
 	and a
-	jr z, .asm_38d48
-
+	jr z, .ok
 	dec [hl]
-
-.asm_38d48
-	and $27
+.ok
+	and 1 << FRZ | SLP
 	ret z
 	call Function39527
-
 	ret c
 	dec [hl]
 	dec [hl]
 	ret
 
-.asm_38d52
+.no_status
 	ld a, [EnemyMonStatus]
 	and a
 	ret nz
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2395,7 +2395,7 @@
 
 Function3cf4a: ; 3cf4a
 	ld hl, EnemyHPPal
-	ld e, $30
+	ld e, HP_BAR_LENGTH_PX
 	call Function3e12e
 	call WaitBGMap
 	callba Function2c012
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -5092,7 +5092,7 @@
 	ld a, [AttackMissed]
 	and a
 	jp nz, .asm_35c91
-	ld bc, $0030
+	ld bc, PartyMon2 - PartyMon1 ; ????
 	ld hl, EnemyMonMoves
 	ld a, [hBattleTurn]
 	and a
@@ -5106,7 +5106,7 @@
 	cp STRUGGLE
 	jr z, .asm_35c91
 	ld b, a
-	ld c, $ff
+	ld c, -1
 .asm_35c33
 	inc c
 	ld a, [hli]
@@ -5114,9 +5114,9 @@
 	jr nz, .asm_35c33
 	ld [$d265], a
 	dec hl
-	ld b, $0
+	ld b, 0
 	push bc
-	ld c, $6
+	ld c, BattleMonPP - BattleMonMoves
 	add hl, bc
 	pop bc
 	ld a, [hl]
@@ -7380,7 +7380,7 @@
 	ld a, [PartyCount]
 	ld d, a
 	ld e, 0
-	ld bc, $30
+	ld bc, PartyMon2 - PartyMon1
 .asm_3699d
 	ld a, [CurBattleMon]
 	cp e
--- a/data/battle_tower.asm
+++ b/data/battle_tower.asm
@@ -70,9 +70,11 @@
 
 Function1f8081: ; 1f8081
 	ld c, $3
+.loop
 	push bc
 	ld a, $1
 	call GetSRAMBank
+
 .asm_1f8089
 	ld a, [$d800]
 	dec a
@@ -150,7 +152,7 @@
 	ld h, d
 	ld l, e
 	pop de
-	ld bc, $000b
+	ld bc, PKMN_NAME_LENGTH
 	call CopyBytes
 	pop de
 	pop af
@@ -157,7 +159,8 @@
 	ld [$d265], a
 	pop bc
 	dec c
-	jp nz, $4083
+	jp nz, .loop
+
 	ld a, [$be51]
 	ld [$be54], a
 	ld a, [$be52]
--- a/home.asm
+++ b/home.asm
@@ -1696,7 +1696,8 @@
 Function378b:: ; 378b
 	ld a, [CurPartySpecies]
 	call IsAPokemon
-	jr c, .asm_37ad
+	jr c, .not_pokemon
+
 	push hl
 	ld de, VTiles2
 	predef GetFrontpic
@@ -1703,13 +1704,13 @@
 	pop hl
 	xor a
 	ld [$ffad], a
-	ld bc, $0707
+	lb bc, 7, 7
 	predef FillBox
 	xor a
 	ld [$c2c6], a
 	ret
 
-.asm_37ad
+.not_pokemon
 	xor a
 	ld [$c2c6], a
 	inc a
--- a/items/item_effects.asm
+++ b/items/item_effects.asm
@@ -2356,10 +2356,10 @@
 ; f504
 
 Tablef504: ; f504
-	db X_ATTACK,  0
-	db X_DEFEND,  1
-	db X_SPEED,   2
-	db X_SPECIAL, 3
+	db X_ATTACK,  ATTACK
+	db X_DEFEND,  DEFENSE
+	db X_SPEED,   SPEED
+	db X_SPECIAL, SP_ATTACK
 ; f50c
 
 
@@ -2367,21 +2367,23 @@
 	ld a, [IsInBattle]
 	and a
 	jr nz, .asm_f512
-
 .asm_f512
+
 	xor a
 	ld [$d002], a
-	ld b, $f8
+
+	ld b, $ff ^ SLP
+
 	ld hl, PartyMon1Status
-	call .asm_f554
+	call .Functionf554
 
 	ld a, [IsInBattle]
-	cp $1
+	cp WILD_BATTLE
 	jr z, .asm_f52b
 	ld hl, OTPartyMon1Status
-	call .asm_f554
-
+	call .Functionf554
 .asm_f52b
+
 	ld hl, BattleMonStatus
 	ld a, [hl]
 	and b
@@ -2390,6 +2392,7 @@
 	ld a, [hl]
 	and b
 	ld [hl], a
+
 	ld a, [$d002]
 	and a
 	ld hl, UnknownText_0xf56c
@@ -2400,24 +2403,22 @@
 	ld a, [Danger]
 	and $80
 	jr nz, .asm_f54e
-
 .asm_f54e
 	ld hl, UnknownText_0xf571
 	jp PrintText
 
 
-.asm_f554
-	ld de, $0030
-	ld c, $6
+.Functionf554
+	ld de, PartyMon2 - PartyMon1
+	ld c, PARTY_LENGTH
 
-.asm_f559
+.loop
 	ld a, [hl]
 	push af
-	and $7
+	and SLP
 	jr z, .asm_f564
-	ld a, $1
+	ld a, 1
 	ld [$d002], a
-
 .asm_f564
 	pop af
 	and b
@@ -2424,7 +2425,7 @@
 	ld [hl], a
 	add hl, de
 	dec c
-	jr nz, .asm_f559
+	jr nz, .loop
 	ret
 ; f56c
 
--- a/main.asm
+++ b/main.asm
@@ -54741,9 +54741,9 @@
 
 .asm_4d170
 	ld de, TileMap
-	ld b, $12
+	ld b, SCREEN_HEIGHT
 .asm_4d175
-	ld c, $14
+	ld c, SCREEN_WIDTH
 .asm_4d177
 	ld a, [hli]
 	ld [de], a
@@ -93036,7 +93036,7 @@
 ; e16e2
 
 Functione16e2: ; e16e2
-	ld bc, $0404
+	lb bc, 4, 4
 .asm_e16e5
 	push bc
 .asm_e16e6
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -611,7 +611,7 @@
 
 .asm_91f5
 	ld hl, PartyMon1DVs
-	ld bc, $0030
+	ld bc, PartyMon2 - PartyMon1
 	ld a, [CurPartyMon]
 	call AddNTimes
 	ld c, l