Skip to content

Commit

Permalink
jpIfInLostBattle
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsuki105 committed Sep 21, 2020
1 parent bd539a4 commit c7a3715
Show file tree
Hide file tree
Showing 31 changed files with 40 additions and 100 deletions.
6 changes: 2 additions & 4 deletions home.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3081,10 +3081,8 @@ EndTrainerBattle::
res 7, [hl]
ld hl, wFlags_0xcd60
res 0, [hl] ; player is no longer engaged by any trainer
ld a, [wIsInBattle]
cp $ff
jp z, ResetButtonPressedAndMapScript

jpIfInLostBattle ResetButtonPressedAndMapScript

ld a, $2
call ReadTrainerHeaderInfo
Expand Down
6 changes: 6 additions & 0 deletions macros/item_macros.asm
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,10 @@ jpIfInLostBattle: MACRO
ld a, [wIsInBattle]
cp $ff
jp z, \1
ENDM

jrIfInLostBattle: MACRO
ld a, [wIsInBattle]
cp $ff
jr z, \1
ENDM
4 changes: 1 addition & 3 deletions scripts/AgathasRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ AgathaScript3:

AgathaScript2:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
jp z, ResetAgathaScript
jpIfInLostBattle ResetAgathaScript
ld a, $1
ld [hSpriteIndexOrTextID], a
call DisplayTextID
Expand Down
4 changes: 1 addition & 3 deletions scripts/BrunosRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ BrunoScript3:

BrunoScript2:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
jp z, ResetBrunoScript
jpIfInLostBattle ResetBrunoScript
ld a, $1
ld [hSpriteIndexOrTextID], a
jp DisplayTextID
Expand Down
4 changes: 1 addition & 3 deletions scripts/CeladonGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ CeladonGym_ScriptPointers:
dw CeladonGymScript3

CeladonGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, CeladonGymText_48943
jpIfInLostBattle CeladonGymText_48943
ld a, $f0
ld [wJoyIgnore], a

Expand Down
8 changes: 2 additions & 6 deletions scripts/CeruleanCity.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ CeruleanCity_ScriptPointers:
dw CeruleanCityScript4

CeruleanCityScript4:
ld a, [wIsInBattle]
cp $ff
jp z, CeruleanCityScript_1948c
jpIfInLostBattle CeruleanCityScript_1948c
ld a, $f0
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
Expand Down Expand Up @@ -161,9 +159,7 @@ CeruleanCityScript1:
ret

CeruleanCityScript2:
ld a, [wIsInBattle]
cp $ff
jp z, CeruleanCityScript_1948c
jpIfInLostBattle CeruleanCityScript_1948c
call CeruleanCityScript_1955d
ld a, $f0
ld [wJoyIgnore], a
Expand Down
4 changes: 1 addition & 3 deletions scripts/CeruleanGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ CeruleanGym_ScriptPointers:
dw CeruleanGymScript3

CeruleanGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, CeruleanGymScript_5c6ed
jpIfInLostBattle CeruleanGymScript_5c6ed
ld a, $f0
ld [wJoyIgnore], a

Expand Down
4 changes: 1 addition & 3 deletions scripts/ChampionsRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ GaryScript2:
ret

GaryScript3:
ld a, [wIsInBattle]
cp $ff
jp z, ResetGaryScript
jpIfInLostBattle ResetGaryScript
call UpdateSprites
SetEvent EVENT_BEAT_CHAMPION_RIVAL
ld a, $f0
Expand Down
8 changes: 2 additions & 6 deletions scripts/CinnabarGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ CinnabarGymFlagAction:
predef_jump FlagActionPredef

CinnabarGymScript2:
ld a, [wIsInBattle]
cp $ff
jp z, CinnabarGymScript_75792
jpIfInLostBattle CinnabarGymScript_75792
ld a, [wTrainerHeaderFlagBit]
ld [$ffdb], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
Expand Down Expand Up @@ -134,9 +132,7 @@ CinnabarGymScript2:
ret

CinnabarGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, CinnabarGymScript_75792
jpIfInLostBattle CinnabarGymScript_75792
ld a, $f0
ld [wJoyIgnore], a
CinnabarGymScript3_75857:
Expand Down
4 changes: 1 addition & 3 deletions scripts/FightingDojo.asm
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ FightingDojoScript1:
ret

FightingDojoScript3:
ld a, [wIsInBattle]
cp $ff
jp z, FightingDojoScript_5cd70
jpIfInLostBattle FightingDojoScript_5cd70
ld a, [wcf0d]
and a
jr z, .asm_5cde4
Expand Down
4 changes: 1 addition & 3 deletions scripts/FuchsiaGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ FuchsiaGym_ScriptPointers:
dw FuchsiaGymScript3

FuchsiaGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, FuchsiaGymScript_75477
jpIfInLostBattle FuchsiaGymScript_75477
ld a, $f0
ld [wJoyIgnore], a
FuchsiaGymScript3_75497:
Expand Down
4 changes: 1 addition & 3 deletions scripts/GameCorner.asm
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ CeladonGameCornerScript0:
ret

CeladonGameCornerScript1:
ld a, [wIsInBattle]
cp $ff
jp z, CeladonGameCornerScript_48c07
jpIfInLostBattle CeladonGameCornerScript_48c07
ld a, $f0
ld [wJoyIgnore], a
ld a, $d
Expand Down
4 changes: 1 addition & 3 deletions scripts/LancesRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ LanceTriggerMovementCoords:

LanceScript2:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
jp z, ResetLanceScript
jpIfInLostBattle ResetLanceScript
ld a, $1
ld [hSpriteIndexOrTextID], a
jp DisplayTextID
Expand Down
4 changes: 1 addition & 3 deletions scripts/LoreleisRoom.asm
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ LoreleiScript3:

LoreleiScript2:
call EndTrainerBattle
ld a, [wIsInBattle]
cp $ff
jp z, ResetLoreleiScript
jpIfInLostBattle ResetLoreleiScript
ld a, $1
ld [hSpriteIndexOrTextID], a
jp DisplayTextID
Expand Down
4 changes: 1 addition & 3 deletions scripts/MtMoonB2F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ MtMoon3Script_49d91:
ret

MtMoon3Script3:
ld a, [wIsInBattle]
cp $ff
jp z, MtMoon3Script_49d58
jpIfInLostBattle MtMoon3Script_49d58
call UpdateSprites
call Delay3
SetEvent EVENT_BEAT_MT_MOON_EXIT_SUPER_NERD
Expand Down
4 changes: 1 addition & 3 deletions scripts/PewterGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ PewterGym_ScriptPointers:
dw PewterGymScript3

PewterGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, PewterGymScript_5c3bf
jpIfInLostBattle PewterGymScript_5c3bf
ld a, $f0
ld [wJoyIgnore], a

Expand Down
4 changes: 1 addition & 3 deletions scripts/PokemonTower2F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ CoordsData_6055e:
db $0F ; isn't this supposed to end in $ff?

PokemonTower2Script1:
ld a, [wIsInBattle]
cp $ff
jp z, PokemonTower2Script_604fe
jpIfInLostBattle PokemonTower2Script_604fe
ld a, $f0
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
Expand Down
4 changes: 1 addition & 3 deletions scripts/PokemonTower6F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ CoordsData_60b45:
db $10,$0A,$FF

PokemonTower6Script4:
ld a, [wIsInBattle]
cp $ff
jp z, PokemonTower6Script_60b02
jpIfInLostBattle PokemonTower6Script_60b02
ld a, $ff
ld [wJoyIgnore], a
ld a, [wd72d]
Expand Down
4 changes: 1 addition & 3 deletions scripts/PokemonTower7F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ PokemonTower7F_ScriptPointers:
PokemonTower7Script2:
ld hl, wFlags_0xcd60
res 0, [hl]
ld a, [wIsInBattle]
cp $ff
jp z, PokemonTower7Script_60d18
jpIfInLostBattle PokemonTower7Script_60d18
call EndTrainerBattle
ld a, $f0
ld [wJoyIgnore], a
Expand Down
4 changes: 1 addition & 3 deletions scripts/RocketHideoutB4F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ RocketHideoutB4F_ScriptPointers:
dw RocketHideout4Script3

RocketHideout4Script3:
ld a, [wIsInBattle]
cp $ff
jp z, RocketHideout4Script_454a3
jpIfInLostBattle RocketHideout4Script_454a3
call UpdateSprites
ld a, $f0
ld [wJoyIgnore], a
Expand Down
4 changes: 1 addition & 3 deletions scripts/Route12.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ Route12Script0:
ret

Route12Script3:
ld a, [wIsInBattle]
cp $ff
jr z, Route12Script_59606
jrIfInLostBattle Route12Script_59606
call UpdateSprites
ld a, [wBattleResult]
cp $2
Expand Down
4 changes: 1 addition & 3 deletions scripts/Route16.asm
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ Route16Script0:
ret

Route16Script3:
ld a, [wIsInBattle]
cp $ff
jp z, Route16Script_59946
jpIfInLostBattle Route16Script_59946
call UpdateSprites
ld a, [wBattleResult]
cp $2
Expand Down
8 changes: 2 additions & 6 deletions scripts/Route22.asm
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ StarterMons_50faf:
db STARTER1,$06

Route22Script2:
ld a, [wIsInBattle]
cp $ff
jp z, Route22Script_50ece
jpIfInLostBattle Route22Script_50ece
ld a, [wSpriteStateData1 + 9]
and a ; cp SPRITE_FACING_DOWN
jr nz, .notDown
Expand Down Expand Up @@ -301,9 +299,7 @@ StarterMons_510d9:
db STARTER1,$0c

Route22Script5:
ld a, [wIsInBattle]
cp $ff
jp z, Route22Script_50ece
jpIfInLostBattle Route22Script_50ece
ld a, $2
ld [H_SPRITEINDEX], a
ld a, [wcf0d]
Expand Down
4 changes: 1 addition & 3 deletions scripts/Route24.asm
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ Route24Script4:
ret

Route24Script3:
ld a, [wIsInBattle]
cp $ff
jp z, Route24Script_513c0
jpIfInLostBattle Route24Script_513c0
call UpdateSprites
ld a, $f0
ld [wJoyIgnore], a
Expand Down
4 changes: 1 addition & 3 deletions scripts/SSAnne2F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ SSAnne2Script1:
ret

SSAnne2Script2:
ld a, [wIsInBattle]
cp $ff
jp z, SSAnne2Script_613ab
jpIfInLostBattle SSAnne2Script_613ab
call SSAnne2Script_61416
ld a, $f0
ld [wJoyIgnore], a
Expand Down
4 changes: 1 addition & 3 deletions scripts/SaffronGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ SaffronGym_ScriptPointers:
dw SaffronGymScript3

SaffronGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, SaffronGymText_5d048
jpIfInLostBattle SaffronGymText_5d048
ld a, $f0
ld [wJoyIgnore], a

Expand Down
4 changes: 1 addition & 3 deletions scripts/SeafoamIslandsB4F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ SeafoamIslandsB4F_ScriptPointers:
dw SeafoamIslands5Script4

SeafoamIslands5Script4:
ld a, [wIsInBattle]
cp $ff
jr z, SeafoamIslands5Script_467a5
jrIfInLostBattle SeafoamIslands5Script_467a5
call EndTrainerBattle
ld a, $0
ld [wSeafoamIslandsB4FCurScript], a
Expand Down
4 changes: 1 addition & 3 deletions scripts/SilphCo11F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ SilphCo11Script_6221a:
jp SetSpriteFacingDirectionAndDelay

SilphCo11Script5:
ld a, [wIsInBattle]
cp $ff
jp z, SilphCo11Script_621c4
jpIfInLostBattle SilphCo11Script_621c4
ld a, [wcf0d]
cp $1
jr z, .asm_6223c
Expand Down
4 changes: 1 addition & 3 deletions scripts/SilphCo7F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ SilphCo7Script3:
jp SilphCo7Text_51c10

SilphCo7Script4:
ld a, [wIsInBattle]
cp $ff
jp z, SilphCo7Text_51c0c
jpIfInLostBattle SilphCo7Text_51c0c
ld a, $f0
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_SILPH_CO_RIVAL
Expand Down
4 changes: 1 addition & 3 deletions scripts/VermilionGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ VermilionGym_ScriptPointers:
dw VermilionGymScript3

VermilionGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, VermilionGymScript_5ca8a
jpIfInLostBattle VermilionGymScript_5ca8a
ld a, $f0
ld [wJoyIgnore], a

Expand Down
4 changes: 1 addition & 3 deletions scripts/ViridianGym.asm
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ ViridianGymScript4:
jpba LoadSpinnerArrowTiles

ViridianGymScript3:
ld a, [wIsInBattle]
cp $ff
jp z, ViridianGymScript_748d6
jpIfInLostBattle ViridianGymScript_748d6
ld a, $f0
ld [wJoyIgnore], a
ViridianGymScript3_74995:
Expand Down

0 comments on commit c7a3715

Please sign in to comment.