From 32a5f21cc7c35b2580ae2c5f3709676dd8ca8405 Mon Sep 17 00:00:00 2001 From: yenatch Date: Mon, 23 Jun 2014 12:45:30 -0700 Subject: [PATCH] More PartyMon labels for relative addressing. --- battle/ai/scoring.asm | 23 ++++++++++------------ battle/core.asm | 2 +- battle/effect_commands.asm | 10 +++++----- data/battle_tower.asm | 7 +++++-- home.asm | 7 ++++--- items/item_effects.asm | 39 +++++++++++++++++++------------------- main.asm | 6 +++--- predef/cgb.asm | 2 +- 8 files changed, 49 insertions(+), 47 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 7ea1ec8fe..e7498886f 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -1523,13 +1523,13 @@ AIScoring_HealBell: ; 38d1f 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 @@ AIScoring_HealBell: ; 38d1f 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 diff --git a/battle/core.asm b/battle/core.asm index 5503d307d..4586d2c9c 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -2395,7 +2395,7 @@ Function3cf35: ; 3cf35 Function3cf4a: ; 3cf4a ld hl, EnemyHPPal - ld e, $30 + ld e, HP_BAR_LENGTH_PX call Function3e12e call WaitBGMap callba Function2c012 diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index dc82b4500..ab1113237 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -5092,7 +5092,7 @@ BattleCommand4a: ; 35c0f 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 @@ BattleCommand4a: ; 35c0f 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 @@ BattleCommand4a: ; 35c0f 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 @@ Function36994: ; 36994 ld a, [PartyCount] ld d, a ld e, 0 - ld bc, $30 + ld bc, PartyMon2 - PartyMon1 .asm_3699d ld a, [CurBattleMon] cp e diff --git a/data/battle_tower.asm b/data/battle_tower.asm index 044f351f8..e4b79c0d4 100644 --- a/data/battle_tower.asm +++ b/data/battle_tower.asm @@ -70,9 +70,11 @@ Function1f8000: ; 1f8000 Function1f8081: ; 1f8081 ld c, $3 +.loop push bc ld a, $1 call GetSRAMBank + .asm_1f8089 ld a, [$d800] dec a @@ -150,14 +152,15 @@ Function1f8081: ; 1f8081 ld h, d ld l, e pop de - ld bc, $000b + ld bc, PKMN_NAME_LENGTH call CopyBytes pop de pop af ld [$d265], a pop bc dec c - jp nz, $4083 + jp nz, .loop + ld a, [$be51] ld [$be54], a ld a, [$be52] diff --git a/home.asm b/home.asm index 42ba751ac..872f14406 100644 --- a/home.asm +++ b/home.asm @@ -1696,20 +1696,21 @@ Function3786:: ; 3786 Function378b:: ; 378b ld a, [CurPartySpecies] call IsAPokemon - jr c, .asm_37ad + jr c, .not_pokemon + push hl ld de, VTiles2 predef GetFrontpic 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 diff --git a/items/item_effects.asm b/items/item_effects.asm index 617fc1618..3ddd8e0e6 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -2356,10 +2356,10 @@ XSpecial: ; f4c5 ; 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 @@ PokeFlute: ; f50c 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 @@ PokeFlute: ; f50c ld a, [hl] and b ld [hl], a + ld a, [$d002] and a ld hl, UnknownText_0xf56c @@ -2400,31 +2403,29 @@ PokeFlute: ; f50c 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 ld [hl], a add hl, de dec c - jr nz, .asm_f559 + jr nz, .loop ret ; f56c diff --git a/main.asm b/main.asm index 914aeb626..f21c68fe3 100644 --- a/main.asm +++ b/main.asm @@ -54741,9 +54741,9 @@ Function4d15b:: ; 4d15b .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 @@ Functione16c7: ; e16c7 ; e16e2 Functione16e2: ; e16e2 - ld bc, $0404 + lb bc, 4, 4 .asm_e16e5 push bc .asm_e16e6 diff --git a/predef/cgb.asm b/predef/cgb.asm index 38f4e146d..cee9c139e 100644 --- a/predef/cgb.asm +++ b/predef/cgb.asm @@ -611,7 +611,7 @@ Function91e4: ; 91e4 .asm_91f5 ld hl, PartyMon1DVs - ld bc, $0030 + ld bc, PartyMon2 - PartyMon1 ld a, [CurPartyMon] call AddNTimes ld c, l