diff --git a/battle/core.asm b/battle/core.asm index 9df143842..d7341fb8c 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -58,7 +58,7 @@ Function3c000: ; 3c000 ld a, [BattleType] cp $2 jp z, Function3c0e2 - cp $3 + cp BATTLETYPE_TUTORIAL jp z, Function3c0e2 xor a ld [CurPartyMon], a @@ -2459,7 +2459,7 @@ Function3cfa4: ; 3cfa4 ld c, $28 call DelayFrames ld a, [BattleType] - cp $1 + cp BATTLETYPE_CANLOSE jr nz, .asm_3cfe8 ld a, $2 call Predef @@ -3717,13 +3717,13 @@ Function3d7c7: ; 3d7c7 ld [$cfca], a ld [$c689], a call SetEnemyTurn - ld de, $0101 + ld de, ANIM_SEND_OUT_MON call Function3ee17 call Function3da79 jr nc, .asm_3d800 ld a, $1 ld [$c689], a - ld de, $0101 + ld de, ANIM_SEND_OUT_MON call Function3ee17 .asm_3d800 @@ -3773,7 +3773,7 @@ NewEnemyMonStatus: ; 3d834 ld [$c731], a ld [EnemyTurnsTaken], a ld hl, PlayerSubStatus5 - res 7, [hl] + res SUBSTATUS_CANT_RUN, [hl] ret ; 3d867 @@ -3793,7 +3793,7 @@ Function3d873: ; 3d873 ld e, a xor a ld hl, PartyMon1HP - ld bc, $002f + ld bc, PartyMon2 - (PartyMon1 + 1) .asm_3d87e or [hl] inc hl @@ -3842,13 +3842,13 @@ Function3d8b3: ; 3d8b3 jp z, .asm_3d9a2 cp $6 jp z, .asm_3d9a2 - cp $9 + cp BATTLETYPE_TRAP jp z, .asm_3d98d - cp $b + cp BATTLETYPE_CELEBI jp z, .asm_3d98d - cp $7 + cp BATTLETYPE_SHINY jp z, .asm_3d98d - cp $c + cp BATTLETYPE_SUICUNE jp z, .asm_3d98d ld a, [InLinkBattle] @@ -3860,7 +3860,7 @@ Function3d8b3: ; 3d8b3 jp nz, .asm_3d992 ld a, [EnemySubStatus5] - bit 7, a + bit SUBSTATUS_CANT_RUN, a jp nz, .asm_3d98d ld a, [$c730] @@ -5093,7 +5093,7 @@ Function3e139: ; 3e139 ld a, [BattleType] cp $2 jr z, .asm_3e156 - cp $3 + cp BATTLETYPE_TUTORIAL jr z, .asm_3e156 call EmptyBattleTextBox call UpdateBattleHuds @@ -5173,7 +5173,7 @@ Function3e1c7: ; 3e1c7 jp nz, Function3e22b call Function1d6e ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL jr z, .asm_3e1f1 cp $6 jr z, .asm_3e201 @@ -5234,7 +5234,7 @@ Function3e234: ; 3e234 call Function3ed9f call ClearSprites ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL jr z, .asm_3e25d call Function3f43d @@ -9527,8 +9527,8 @@ BattleStartMessage: ; 3fc8b ld hl, PokemonFellFromTreeText cp BATTLETYPE_TREE jr z, .asm_3fd0e - ld hl, WildPokemonAppearedText2 - cp $b + ld hl, WildCelebiAppearedText + cp BATTLETYPE_CELEBI jr z, .asm_3fd0e ld hl, WildPokemonAppearedText diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index a2332d2bf..25e2e8da4 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -7083,7 +7083,7 @@ BattleCommanda0: ; 36778 jr z, .asm_367b9 cp $9 jr z, .asm_367b9 - cp $b + cp BATTLETYPE_CELEBI jr z, .asm_367b9 cp BATTLETYPE_SUICUNE jr z, .asm_367b9 @@ -7175,7 +7175,7 @@ BattleCommand23: ; 3680f jp z, .asm_36969 cp $9 jp z, .asm_36969 - cp $b + cp BATTLETYPE_CELEBI jp z, .asm_36969 cp BATTLETYPE_SUICUNE jp z, .asm_36969 diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 88a2fd27d..289731c1b 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -48,7 +48,9 @@ BATTLETYPE_FISH EQU $04 BATTLETYPE_ROAMING EQU $05 BATTLETYPE_SHINY EQU $07 BATTLETYPE_TREE EQU $08 +BATTLETYPE_TRAP EQU $09 BATTLETYPE_FORCEITEM EQU $0a +BATTLETYPE_CELEBI EQU $0b BATTLETYPE_SUICUNE EQU $0c ; battle variables diff --git a/home.asm b/home.asm index 5132351e1..ec106886c 100644 --- a/home.asm +++ b/home.asm @@ -1583,7 +1583,7 @@ Function36f5:: ; 36f5 Function3718:: ; 3718 ld a, [BattleType] - cp $1 + cp BATTLETYPE_CANLOSE jr .asm_3724 ld hl, WalkingTile diff --git a/items/item_effects.asm b/items/item_effects.asm index 61ff2033e..820d18399 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -238,10 +238,10 @@ ParkBall: ; e8a2 ld a, [EnemyMonCatchRate] ld b, a ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL jp z, .asm_e99c ld a, [CurItem] - cp $1 + cp MASTER_BALL jp z, .asm_e99c ld a, [CurItem] ld c, a diff --git a/main.asm b/main.asm index 93d1efd30..967147833 100644 --- a/main.asm +++ b/main.asm @@ -10585,7 +10585,7 @@ Functioncfaf: ; cfaf ld [$d22e], a ld a, e ld [CurPartyLevel], a - ld a, $4 + ld a, BATTLETYPE_FISH ld [BattleType], a ld a, $2 ret @@ -16003,7 +16003,7 @@ Function1089d: ; 1089d ld e, a ld d, $0 ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL jr z, .asm_108b3 ld a, [PlayerGender] bit 0, a @@ -16127,7 +16127,7 @@ Function10955: ; 10955 ld a, $24 call ByteFill hlcoord 5, 1 - ld bc, $0b0f + lb bc, 11, 15 call ClearBox ld hl, TileMap ld a, $28 @@ -16140,7 +16140,7 @@ Function10955: ; 10955 call Function109bb call Function109a5 hlcoord 0, 12 - ld bc, $0412 + lb bc, 4, 18 call TextBox call EnableLCD call Function1089d @@ -36142,7 +36142,7 @@ Function2715c: ; 2715c call WhiteBGMap call ClearTileMap ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL jr z, .asm_27171 callba Function3f43d jr .asm_27177 @@ -40583,7 +40583,7 @@ Function2a0e7:: ; 2a0e7 ret .asm_2a0f8 - xor a + xor a ; BATTLETYPE_NORMAL ld [$d22e], a ld [BattleType], a ld a, 1 @@ -40984,6 +40984,7 @@ Function2a2ce: ; 2a2ce ld [CurPartyLevel], a ld a, BATTLETYPE_ROAMING ld [BattleType], a + pop hl scf ret @@ -42840,9 +42841,10 @@ Function2c9b1: ; 2c9b1 (b:49b1) ; known jump sources: 2c8d6 (b:48d6), 2c915 (b:4915), 2c9bf (b:49bf), 2c9dc (b:49dc) Function2c9e2: ; 2c9e2 (b:49e2) - ld a, [BattleType] ; $d230 - cp $3 + ld a, [BattleType] + cp BATTLETYPE_TUTORIAL jp z, Function2caca + hlcoord 5, 2 ld bc, $a0f ld a, $7f @@ -52591,7 +52593,7 @@ Function49bed: ; 49bed ; 49bf3 Function49bf3: ; 49bf3 - ld a, $b + ld a, BATTLETYPE_CELEBI ld [BattleType], a ret ; 49bf9 @@ -58218,11 +58220,11 @@ Jumptable_4e564: ; 4e564 (13:6564) Function4e56a: ; 4e56a (13:656a) ld hl, PlayerName ; $d47d ld de, MomsName ; $d488 - ld bc, $b + ld bc, NAME_LENGTH call CopyBytes ld hl, String_4e5da ld de, PlayerName ; $d47d - ld bc, $b + ld bc, NAME_LENGTH call CopyBytes call Function4e5b7 xor a @@ -58242,7 +58244,7 @@ Function4e56a: ; 4e56a (13:656a) ld [Options], a ; $cfcc ld hl, MomsName ; $d488 ld de, PlayerName ; $d47d - ld bc, $b + ld bc, NAME_LENGTH call CopyBytes ret @@ -63190,7 +63192,7 @@ Unknown_80671: ; 80671 Function806c5: ; 806c5 ; Caught mons. ld hl, PokedexCaught - ld b, $20 + ld b, EndPokedexCaught - PokedexCaught call CountSetBits ld a, [$d265] jp Function8066c @@ -63199,7 +63201,7 @@ Function806c5: ; 806c5 Function806d3: ; 806d3 ; Seen mons. ld hl, PokedexSeen - ld b, $20 + ld b, EndPokedexSeen - PokedexSeen call CountSetBits ld a, [$d265] jp Function8066c @@ -63207,7 +63209,7 @@ Function806d3: ; 806d3 Function806e1: ; 806e1 ; Number of owned badges. - ld hl, JohtoBadges ; $d857 + ld hl, Badges ; $d857 ld b, 2 call CountSetBits ld a, [$d265] @@ -87330,7 +87332,7 @@ Functionb81ea: ; b81ea jr nc, .asm_b8214 call Functionb83e5 jr nc, .asm_b8214 - ld a, $8 + ld a, BATTLETYPE_TREE ld [BattleType], a ld a, $1 ld [ScriptVar], a @@ -108250,7 +108252,7 @@ Function106050: ; 106050 Function106051: ; 106051 ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL ret z ld hl, $a01b jp Function10611d @@ -108263,7 +108265,7 @@ Function10605d: ; 10605d Function10605e: ; 10605e ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL ret z ld hl, $a01e jp Function10611d diff --git a/maps/CherrygroveCity.asm b/maps/CherrygroveCity.asm index f2573913b..cdcacbd1b 100644 --- a/maps/CherrygroveCity.asm +++ b/maps/CherrygroveCity.asm @@ -130,7 +130,7 @@ UnknownScript_0x19c0ae: ; 0x19c0ae winlosstext UnknownText_0x19c57f, UnknownText_0x19c5e6 setlasttalked $3 loadtrainer RIVAL1, RIVAL1_3 - writecode $3, $1 + writecode $3, BATTLETYPE_CANLOSE startbattle reloadmapmusic reloadmap @@ -142,7 +142,7 @@ UnknownScript_0x19c0ee: ; 0x19c0ee winlosstext UnknownText_0x19c57f, UnknownText_0x19c5e6 setlasttalked $3 loadtrainer RIVAL1, RIVAL1_1 - writecode $3, $1 + writecode $3, BATTLETYPE_CANLOSE startbattle reloadmapmusic reloadmap @@ -154,7 +154,7 @@ UnknownScript_0x19c104: ; 0x19c104 winlosstext UnknownText_0x19c57f, UnknownText_0x19c5e6 setlasttalked $3 loadtrainer RIVAL1, RIVAL1_2 - writecode $3, $1 + writecode $3, BATTLETYPE_CANLOSE startbattle reloadmapmusic reloadmap diff --git a/maps/LakeofRage.asm b/maps/LakeofRage.asm index 46cdf948f..fcd052968 100644 --- a/maps/LakeofRage.asm +++ b/maps/LakeofRage.asm @@ -88,7 +88,7 @@ GyaradosScript_0x70063: ; 0x70063 cry GYARADOS loadmovesprites loadpokedata GYARADOS, 30 - writecode $3, $7 + writecode $3, BATTLETYPE_SHINY startbattle if_equal $1, UnknownScript_0x7007a disappear $a diff --git a/maps/TeamRocketBaseB1F.asm b/maps/TeamRocketBaseB1F.asm index 7c8b2f50b..d0aa17c29 100644 --- a/maps/TeamRocketBaseB1F.asm +++ b/maps/TeamRocketBaseB1F.asm @@ -464,7 +464,7 @@ VoltorbExplodingTrap: ; 0x6ca34 cry VOLTORB special $0031 setlasttalked $ff - writecode $3, $9 + writecode $3, BATTLETYPE_TRAP loadpokedata VOLTORB, 23 startbattle end @@ -474,7 +474,7 @@ GeodudeExplodingTrap: ; 0x6ca47 cry GEODUDE special $0031 setlasttalked $ff - writecode $3, $9 + writecode $3, BATTLETYPE_TRAP loadpokedata GEODUDE, 21 startbattle end @@ -484,7 +484,7 @@ KoffingExplodingTrap: ; 0x6ca5a cry KOFFING special $0031 setlasttalked $ff - writecode $3, $9 + writecode $3, BATTLETYPE_TRAP loadpokedata KOFFING, 21 startbattle end diff --git a/maps/TinTower1F.asm b/maps/TinTower1F.asm index 4e4d93d04..d9a1fe044 100644 --- a/maps/TinTower1F.asm +++ b/maps/TinTower1F.asm @@ -122,7 +122,7 @@ UnknownScript_0x1850d7: ; 0x1850d7 cry SUICUNE pause 20 loadpokedata SUICUNE, 40 - writecode $3, $c + writecode $3, BATTLETYPE_SUICUNE startbattle reloadmapmusic disappear $2 diff --git a/maps/TinTowerRoof.asm b/maps/TinTowerRoof.asm index 27ed801c5..5e3aa8bea 100644 --- a/maps/TinTowerRoof.asm +++ b/maps/TinTowerRoof.asm @@ -36,7 +36,7 @@ HoOhScript_0x77244: ; 0x77244 pause 15 loadmovesprites setevent EVENT_FOUGHT_HO_OH - writecode $3, $a + writecode $3, BATTLETYPE_FORCEITEM loadpokedata HO_OH, 60 startbattle disappear $2 diff --git a/maps/VermilionCity.asm b/maps/VermilionCity.asm index a1e1123db..d69a9546f 100644 --- a/maps/VermilionCity.asm +++ b/maps/VermilionCity.asm @@ -56,7 +56,7 @@ UnknownScript_0x1aa9ab: ; 0x1aa9ab pause 15 cry SNORLAX loadmovesprites - writecode $3, $a + writecode $3, BATTLETYPE_FORCEITEM loadpokedata SNORLAX, 50 startbattle disappear $6 diff --git a/maps/WhirlIslandLugiaChamber.asm b/maps/WhirlIslandLugiaChamber.asm index 05adf2ced..ff95c239d 100644 --- a/maps/WhirlIslandLugiaChamber.asm +++ b/maps/WhirlIslandLugiaChamber.asm @@ -36,7 +36,7 @@ LugiaScript_0x18c518: ; 0x18c518 pause 15 loadmovesprites setevent EVENT_FOUGHT_LUGIA - writecode $3, $a + writecode $3, BATTLETYPE_FORCEITEM loadpokedata LUGIA, 60 startbattle disappear $2 diff --git a/predef/cgb.asm b/predef/cgb.asm index 8d59b2326..38f4e146d 100644 --- a/predef/cgb.asm +++ b/predef/cgb.asm @@ -840,11 +840,13 @@ Function93ba: ; 93ba Function93d3: ; 93d3 ld a, [BattleType] - cp $3 + cp BATTLETYPE_TUTORIAL jr z, .asm_93e6 + ld a, [PlayerGender] bit 0, a jr z, .asm_93e6 + ld hl, Palettes_9469 jr .asm_93e9 diff --git a/text/battle.asm b/text/battle.asm index b850c9661..834ec3c71 100644 --- a/text/battle.asm +++ b/text/battle.asm @@ -30,7 +30,7 @@ PokemonFellFromTreeText: ; 0x80778 prompt ; 0x80793 -WildPokemonAppearedText2: ; 0x80793 +WildCelebiAppearedText: ; 0x80793 text "Wild @" text_from_ram $c616 db $0 diff --git a/wram.asm b/wram.asm index 3c7520fce..49746cff6 100644 --- a/wram.asm +++ b/wram.asm @@ -1375,9 +1375,9 @@ Coins:: ; d855 Badges:: JohtoBadges:: ; d857 - ds 1 + flag_array 8 KantoBadges:: ; d858 - ds 1 + flag_array 8 SECTION "Items",WRAMX[$d859],BANK[1] TMsHMs:: ; d859