From 674229228f1be67da568bfb734bacae76bfcc429 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 17:48:59 -0400 Subject: [PATCH 01/13] Coins wram label --- wram.asm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wram.asm b/wram.asm index e4e0af723..14fb8d5a3 100644 --- a/wram.asm +++ b/wram.asm @@ -1712,7 +1712,10 @@ StatusFlags2: ; d84d Money: ; d84e ds 3 - ds 6 + ds 4 + +Coins: ; d855 + ds 2 Badges: JohtoBadges: ; d857 From 7cc320e835497fbf7f7a66d47cc6351b571c32e7 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 17:50:08 -0400 Subject: [PATCH 02/13] Coins in main.asm --- engine/scripting.asm | 2 +- main.asm | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/scripting.asm b/engine/scripting.asm index 3bd652ea0..61ebae935 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2217,7 +2217,7 @@ Script_readcoins: ; 0x97747 call Unknown_0x97771 ld hl, StringBuffer1 - ld de, $d855 + ld de, Coins ld bc, $4206 call PrintNum ld de, StringBuffer1 diff --git a/main.asm b/main.asm index 9b39ebcc7..cb3a047bd 100644 --- a/main.asm +++ b/main.asm @@ -13314,8 +13314,8 @@ Function5bae: ; 5bae ld [JohtoBadges], a ld [KantoBadges], a - ld [$d855], a - ld [$d856], a + ld [Coins], a + ld [Coins + 1], a ld [Money], a ld a, 3000 >> 8 @@ -29656,7 +29656,7 @@ Function16053: ; 16053 Function1606f: ; 1606f ld a, $2 - ld de, $d855 + ld de, Coins call $6055 ld a, $2 ld bc, $608d @@ -29681,7 +29681,7 @@ INCBIN "baserom.gbc", $1608d, $1608f - $1608d Function1608f: ; 1608f ld a, $2 - ld de, $d855 + ld de, Coins call $6037 jr nc, .asm_1609f xor a @@ -29698,7 +29698,7 @@ Function1608f: ; 1608f Function160a1: ; 160a1 ld a, $2 - ld de, $d855 + ld de, Coins jp $600d ; 160a9 @@ -32087,7 +32087,7 @@ Function24b25: ; 24b25 ld hl, $c4c5 ld de, String24b8e call PlaceString - ld de, $d855 + ld de, Coins ld bc, $0204 ld hl, $c4c1 call PrintNum @@ -32110,7 +32110,7 @@ Function24b4e: ; 24b4e ld de, CoinString call PlaceString ld hl, $c4eb - ld de, $d855 + ld de, Coins ld bc, $0204 call PrintNum ret From 4983c46a26ff2c165c67a78cebc0c686a23f9cda Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 18:57:31 -0400 Subject: [PATCH 03/13] use callab/callba macros for known FarCalls --- main.asm | 100 ++++++++++++++++++------------------------------------- 1 file changed, 33 insertions(+), 67 deletions(-) diff --git a/main.asm b/main.asm index cb3a047bd..ab5dc4f19 100644 --- a/main.asm +++ b/main.asm @@ -1574,9 +1574,7 @@ Function1c07: ; 0x1c07 ret Function1c10: ; 0x1c10 - ld hl, $446d - ld a, $9 - rst $8 + callab Function2446d ret Function1c17: ; 0x1c17 @@ -4630,9 +4628,7 @@ Function2b74: ; 0x2b74 call Function3200 ld b, $9 call GetSGBLayout - ld a, $12 - ld hl, $5409 - rst $8 + callba Function49409 call Function485 call DelayFrame ld a, $1 @@ -19499,7 +19495,7 @@ Functioncbd8: ; cbd8 ld a, [Buffer2] cp $2 jr nz, .asm_cbf7 - ld hl, $4c35 + ld hl, UnknownScript_0xcc35 call Function31cd ld a, $81 ret @@ -23576,9 +23572,7 @@ StartMenu: ; 125cd call .DrawBugContestStatusBox call Function2e31 call Function2e20 - ld a, $1 - ld hl, $64bf - rst $8 + callba Function64bf call .DrawBugContestStatus call Function485 jr .Select @@ -28453,9 +28447,7 @@ Function157e9: ; 0x157e9 .askquantity ld hl, .HowManyText call Function1d4f - ld a, $9 - ld hl, $4fbf - rst $8 + callba Function24fbf call Function1c07 call Function1c07 jr c, .done @@ -28550,20 +28542,14 @@ KrisDepositItemMenu: ; 0x1588b jr c, .asm_158b6 call Function2ed3 call Function1d6e - ld a, $4 - ld hl, $46a5 - rst $8 + callba Function106a5 .asm_1589c - ld a, $4 - ld hl, $46be - rst $8 + callba Function106be ld a, [$cf66] and a jr z, .asm_158b3 call Function158cc - ld a, $4 - ld hl, CheckRegisteredItem - rst $8 + callba CheckRegisteredItem jr .asm_1589c .asm_158b3 @@ -28595,9 +28581,7 @@ Function158cc: ; 0x158cc push af ld a, $0 ld [$c2ce], a - ld a, $3 - ld hl, $5453 - rst $8 + callba CheckItemMenu ld a, [$d142] ld hl, JumpTable158e7 rst JumpTable @@ -28631,9 +28615,7 @@ JumpTable158e7: ; 0x158e7 ; 0x1590a Function1590a: ; 0x1590a - ld a, $3 - ld hl, $5427 - rst $8 + callba _CheckTossableItem ld a, [$d142] and a jr z, .asm_1591d @@ -28644,9 +28626,7 @@ Function1590a: ; 0x1590a .asm_1591d ld hl, .HowManyText call Function1d4f - ld a, $9 - ld hl, $4fbf - rst $8 + callba Function24fbf push af call Function1c07 call Function1c07 @@ -28698,9 +28678,7 @@ Function1590a: ; 0x1590a KrisMailBoxMenu: ; 0x1597d - ld a, $11 - ld hl, $47a0 - rst $8 + callba _KrisMailBoxMenu xor a ret ; 0x15985 @@ -47638,27 +47616,15 @@ Function4484a: ; 0x4484a ld [PartyMenuActionText], a call WhiteBGMap .asm_448dc - ld a, $14 - ld hl, $404f - rst $8 - ld a, $14 - ld hl, $4405 - rst $8 - ld a, $14 - ld hl, $43e0 - rst $8 - ld a, $14 - ld hl, PickedFruitTree - rst $8 - ld a, $14 - ld hl, $449a - rst $8 + callba Function5004f + callba Function50405 + callba Function503e0 + callba WritePartyMenuTilemap + callba PrintPartyMenuText call WaitBGMap call Function32f9 call DelayFrame - ld a, $14 - ld hl, $4457 - rst $8 + callba PartyMenuSelect jr c, .asm_44939 ld a, [CurPartySpecies] cp $fd @@ -56192,7 +56158,7 @@ GetTimePalFade: ; 8c17c Function8c20f: ; 8c20f - call $426d + call Function8c26d ld a, [rBGP] ld [$cfc7], a ld a, [rOBP0] @@ -56208,7 +56174,7 @@ Function8c20f: ; 8c20f ld a, [$cf63] bit 7, a jr nz, .asm_8c23a - call $4314 + call Function8c314 call DelayFrame jr .asm_8c22b @@ -56247,12 +56213,12 @@ Function8c26d: ; 8c26d callba Function6454 call Function1ad2 call DelayFrame - call $42a0 - call $4f4f + call Function8c2a0 + call Function8cf4f jr .asm_8c28b .asm_8c288 - call $42aa + call Function8c2aa .asm_8c28b ld a, $90 @@ -56265,14 +56231,14 @@ Function8c26d: ; 8c26d ld [hli], a ld [hli], a ld [hl], a - call $46d8 + call Function8c6d8 ret ; 8c2a0 Function8c2a0: ; 8c2a0 - call $42aa + call Function8c2aa ld hl, VBGMap0 - call $42cf + call Function8c2cf ret ; 8c2aa @@ -56344,9 +56310,9 @@ Function8c6d8: ; 8c6d8 ld a, $5 ld [rSVBK], a ld hl, $d100 - call $46ef + call Function8c6ef ld hl, $d200 - call $46ef + call Function8c6ef pop af ld [rSVBK], a ret @@ -56378,7 +56344,7 @@ Function8c940: ; 8c940 ld a, e and $1 ld [$cf63], a - call $496d + call Function8c96d call WaitSFX ld de, $001e call StartSFX @@ -56388,10 +56354,10 @@ Function8c940: ; 8c940 jr nz, .asm_8c96c ld a, $90 ld [$c3b5], a - ld hl, $4f7a + ld hl, Function8cf7a ld a, $23 rst FarCall - call $4a0c + call Function8ca0c call DelayFrame jr .asm_8c952 @@ -56400,7 +56366,7 @@ Function8c940: ; 8c940 ; 8c96d Function8c96d: ; 8c96d - ld hl, $4f53 + ld hl, Function8cf53 ld a, $23 rst FarCall ld de, $49cc @@ -64197,7 +64163,7 @@ Options_Sound: ; e43dd Options_Print: ; e4424 - call $4491 + call Functione4491 ld a, [hJoyPressed] bit 5, a jr nz, .asm_e443c From f4572ecd4dc8effb26c2a14de30f0ba58c317078 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 19:14:04 -0400 Subject: [PATCH 04/13] use more egg constants in main --- main.asm | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/main.asm b/main.asm index ab5dc4f19..fc1aaee33 100644 --- a/main.asm +++ b/main.asm @@ -7377,7 +7377,7 @@ Function3718: ; 3718 Function3741: ; 3741 and a jr z, .asm_374c - cp $fd + cp EGG jr z, .asm_374e cp $fc jr c, .asm_374e @@ -24912,7 +24912,7 @@ INCBIN "baserom.gbc", $12f5b, $12fba - $12f5b Function12fba: ; 12fba ld a, [CurPartySpecies] - cp $fd + cp EGG jr z, .asm_12fd2 ld hl, Options ld a, [hl] @@ -25025,13 +25025,13 @@ Function1308f: ; 1308f inc a ld [CurPartyMon], a ld c, a - ld b, $0 + ld b, 0 ld hl, PartySpecies add hl, bc ld a, [hl] cp $ff jr z, .asm_130a7 - cp $fd + cp EGG ret nz jr .asm_1308f @@ -25044,11 +25044,11 @@ Function1308f: ; 1308f dec a ld [CurPartyMon], a ld c, a - ld b, $0 + ld b, 0 ld hl, PartySpecies add hl, bc ld a, [hl] - cp $fd + cp EGG ret nz ld a, [CurPartyMon] and a @@ -25302,14 +25302,14 @@ Function132da: ; 132da ret z ld c, a ld e, a - ld d, $0 + ld d, 0 ld hl, PartyCount add hl, de .asm_132e7 ld a, [hl] and a jr z, .asm_132f3 - cp $fd + cp EGG jr z, .asm_132f3 cp $fc jr c, .asm_132f8 @@ -25334,7 +25334,7 @@ Function132fe: ; 132fe cp c ret z ld e, c - ld d, $0 + ld d, 0 ld hl, PartySpecies add hl, de .asm_1330f @@ -25343,7 +25343,7 @@ Function132fe: ; 132fe ret z and a jr z, .asm_1331e - cp $fd + cp EGG jr z, .asm_1331e cp $fc jr c, .asm_13321 @@ -25353,8 +25353,8 @@ Function132fe: ; 132fe jr .asm_1330f .asm_13321 - ld hl, $c4b2 - ld [hl], $ed + hlcoord 18, 0 + ld [hl], "▶" ret ; 13327 @@ -34860,7 +34860,7 @@ Function2c7fb: ; 2c7fb callba PartyMenuSelect push af ld a, [CurPartySpecies] - cp $fd + cp EGG pop bc jr z, .asm_2c854 push bc @@ -39983,10 +39983,10 @@ Function3d887: ; 3d887 ld hl, PartySpecies ld a, [CurPartyMon] ld c, a - ld b, $0 + ld b, 0 add hl, bc ld a, [hl] - cp $fd + cp EGG ld hl, BattleText_0x80b26 jr z, .asm_3d8ae ld hl, BattleText_0x80b0b @@ -47627,9 +47627,9 @@ Function4484a: ; 0x4484a callba PartyMenuSelect jr c, .asm_44939 ld a, [CurPartySpecies] - cp $fd + cp EGG jr z, .asm_44923 - ld a, $1 + ld a, PartyMon1Item - PartyMon1 call GetPartyParamLocation ld a, [hl] and a @@ -51404,14 +51404,14 @@ INCBIN "baserom.gbc", $5036b, $50389 - $5036b Function50389: ; 50389 - ld a, $d8 + ld a, PartySpecies & $ff add b ld e, a - ld a, $dc - adc $0 + ld a, PartySpecies >> 8 + adc 0 ld d, a ld a, [de] - cp $fd + cp EGG ret ; 50396 @@ -51422,7 +51422,7 @@ Function50396: ; 50396 ld a, [PartyMenuActionText] and $f ld e, a - ld d, $0 + ld d, 0 ld hl, $43b2 add hl, de add hl, de @@ -54798,12 +54798,12 @@ Function8653f: ; 8653f ld [de], a inc de ld hl, PartySpecies - ld c, $0 + ld c, 0 .asm_86556 ld a, [hli] cp $ff jr z, .asm_865b1 - cp $fd + cp EGG jr nz, .asm_86562 inc c jr .asm_86556 @@ -55021,7 +55021,7 @@ Function86748: ; 86748 ld hl, $c50a call Function378b ld a, [CurPartySpecies] - cp $fd + cp EGG jr z, .asm_867f8 ld hl, $c5a5 ld a, $74 From 17f25691db80b7bd577d401a53eecb913a0b8860 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 19:17:32 -0400 Subject: [PATCH 05/13] Function378b is IsAPokemon --- main.asm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.asm b/main.asm index fc1aaee33..d506d9854 100644 --- a/main.asm +++ b/main.asm @@ -7374,19 +7374,20 @@ Function3718: ; 3718 -Function3741: ; 3741 +IsAPokemon: ; 3741 +; Return carry if species a is not a Pokemon. and a - jr z, .asm_374c + jr z, .NotAPokemon cp EGG - jr z, .asm_374e + jr z, .Pokemon cp $fc - jr c, .asm_374e + jr c, .Pokemon -.asm_374c +.NotAPokemon scf ret -.asm_374e +.Pokemon and a ret ; 3750 @@ -7460,7 +7461,7 @@ Function3786: ; 3786 Function378b: ; 378b ld a, [CurPartySpecies] - call Function3741 + call IsAPokemon jr c, .asm_37ad push hl ld de, VTiles2 From 5342f8d6300898faa312d9b5dec248cfe0cfb757 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 22:07:37 -0400 Subject: [PATCH 06/13] NUM_POKEMON constant before we were just using CELEBI, but there's no way that's gonna pan out --- constants/pokemon_constants.asm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index 40b450b85..29739ed46 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -1,3 +1,5 @@ +NUM_POKEMON EQU 251 + BULBASAUR EQU 1 IVYSAUR EQU 2 VENUSAUR EQU 3 From 21248effe489af1624d3b43cc2abbe3c7849865a Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 22:25:50 -0400 Subject: [PATCH 07/13] NUM_POKEMON in main.asm --- main.asm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.asm b/main.asm index d506d9854..ed9fe4464 100644 --- a/main.asm +++ b/main.asm @@ -7380,7 +7380,7 @@ IsAPokemon: ; 3741 jr z, .NotAPokemon cp EGG jr z, .Pokemon - cp $fc + cp NUM_POKEMON + 1 jr c, .Pokemon .NotAPokemon @@ -25312,7 +25312,7 @@ Function132da: ; 132da jr z, .asm_132f3 cp EGG jr z, .asm_132f3 - cp $fc + cp NUM_POKEMON + 1 jr c, .asm_132f8 .asm_132f3 @@ -25346,7 +25346,7 @@ Function132fe: ; 132fe jr z, .asm_1331e cp EGG jr z, .asm_1331e - cp $fc + cp NUM_POKEMON + 1 jr c, .asm_13321 .asm_1331e @@ -46769,7 +46769,7 @@ GetPreEvolution: ; 42581 .asm_425a2 inc c ld a, c - cp CELEBI + cp NUM_POKEMON jr c, .asm_42583 and a ret @@ -56572,9 +56572,9 @@ INCBIN "baserom.gbc", $8d03d, $8d04c - $8d03d Function8d04c: ; 8d04c call Function8d0ec call Function8d132 - cp $fd + cp EGG jr z, .asm_8d0b9 - cp $fc + cp NUM_POKEMON + 1 jr z, .asm_8d0b6 call Function8d1a2 ld a, [$c3ba] @@ -63320,9 +63320,9 @@ INCBIN "baserom.gbc", $cc9c4, $cca09 - $cc9c4 Functioncca09: ; cca09 call Functionccaaa call Functionce7d1 - cp $fd + cp EGG jp z, $4aa5 - cp $fc + cp NUM_POKEMON + 1 jp z, $4aa2 push af ld hl, $d419 From 523abc2d0e72891a216cb61d7de5edaabff34b00 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 22:46:28 -0400 Subject: [PATCH 08/13] formatting in oak speech --- main.asm | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/main.asm b/main.asm index ed9fe4464..2b8a67311 100644 --- a/main.asm +++ b/main.asm @@ -13993,42 +13993,54 @@ Function60fa: ; 60fa ; 610f Function610f: ; 610f + ld a, [hROMBank] push af - ld a, $20 + + ld a, 0 << 7 | 32 ; fade out ld [MusicFade], a ld de, MUSIC_NONE ld a, e ld [MusicFadeIDLo], a ld a, d ld [MusicFadeIDHi], a + ld de, SFX_ESCAPE_ROPE call StartSFX pop af rst Bankswitch - ld c, $8 + ld c, 8 call DelayFrames + ld hl, $5249 ld b, $13 call Function61b4 - ld c, $8 + + ld c, 8 call DelayFrames + ld hl, $52d9 ld b, $13 call Function61b4 - ld c, $8 + + ld c, 8 call DelayFrames + ld hl, $c50a - ld b, $7 - ld c, $7 + ld b, 7 + ld c, 7 call ClearBox - ld c, $3 + + ld c, 3 call DelayFrames + call Function61cd call Functione5f - ld c, $32 + + ld c, 50 call DelayFrames + call Function4b6 call ClearTileMap ret @@ -14036,11 +14048,11 @@ Function610f: ; 610f Function616a: ; 616a ld hl, IntroFadePalettes - ld b, $6 + ld b, IntroFadePalettesEnd - IntroFadePalettes .asm_616f ld a, [hli] call DmgToCgbBGPals - ld c, $a + ld c, 10 call DelayFrames dec b jr nz, .asm_616f @@ -14054,6 +14066,7 @@ IntroFadePalettes: ; 0x617c db %11111000 db %11110100 db %11100100 +IntroFadePalettesEnd ; 6182 Function6182: ; 6182 @@ -14099,14 +14112,17 @@ Function61b4: ; 61b4 ; 61cd Function61cd: ; 61cd + callba GetPlayerIcon ld c, $c ld hl, VTiles0 call Request2bpp + ld hl, Sprites ld de, .data_61fe ld a, [de] inc de + ld c, a .asm_61e4 ld a, [de] @@ -14118,14 +14134,15 @@ Function61cd: ; 61cd ld a, [de] inc de ld [hli], a - ld b, $0 + + ld b, 0 ld a, [PlayerGender] bit 0, a jr z, .asm_61f8 - ld b, $1 - + ld b, 1 .asm_61f8 ld a, b + ld [hli], a dec c jr nz, .asm_61e4 @@ -14183,7 +14200,6 @@ Function620b: ; 620b cp $5 jr c, .asm_625e xor a - .asm_625e ld e, a ld d, 0 From 70ecde3f78dc9885a04eb002f68681d03cc2d212 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 22:47:20 -0400 Subject: [PATCH 09/13] StartTitleScreen -> TitleScreen also undo "far" naming scheme --- main.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.asm b/main.asm index 2b8a67311..18d94ab21 100644 --- a/main.asm +++ b/main.asm @@ -14172,7 +14172,7 @@ Function620b: ; 620b push af ld a, $5 ld [rSVBK], a - call FarStartTitleScreen + call TitleScreen call DelayFrame .asm_6226 call Function627b @@ -14221,8 +14221,8 @@ Function620b: ; 620b ; 6274 -FarStartTitleScreen: ; 6274 - callba StartTitleScreen +TitleScreen: ; 6274 + callba _TitleScreen ret ; 627b @@ -69682,7 +69682,7 @@ SECTION "bank43",ROMX,BANK[$43] INCBIN "baserom.gbc", $10c000, $10ed67 - $10c000 -StartTitleScreen: ; 10ed67 +_TitleScreen: ; 10ed67 call WhiteBGMap call ClearSprites From c9d3881a2ffa4e3bdb5e5c12d98c20c0bba1e400 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 22:59:40 -0400 Subject: [PATCH 10/13] rename RNG to Random also fix 'Far' naming scheme for BattleRandom this was a long time coming --- battle/ai/scoring.asm | 76 ++++++++-------- battle/effect_commands.asm | 98 ++++++++++---------- engine/scripting.asm | 4 +- items/item_effects.asm | 2 +- main.asm | 177 +++++++++++++++++++------------------ stats/battle_tower.asm | 4 +- stats/odd_eggs.asm | 2 +- stats/wild/fish.asm | 4 +- 8 files changed, 184 insertions(+), 183 deletions(-) diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index b48e04bc6..3ad219851 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -129,7 +129,7 @@ AIScoring_RedStatMods: ; 385e0 jr .checkmove .discourage - call RNG + call Random cp 30 jr c, .checkmove inc [hl] @@ -430,7 +430,7 @@ AIScoring_LeechHit: ; 387f7 ret .asm_38815 - call RNG + call Random cp $64 ret c @@ -575,7 +575,7 @@ AIScoring_Explosion: ; 388a6 call AICheckEnemyQuarterHP ret nc - call RNG + call Random cp 20 ret c @@ -588,7 +588,7 @@ AIScoring_Explosion: ; 388a6 AIScoring_DreamEater: ; 388ca - call RNG + call Random cp $19 ret c @@ -612,7 +612,7 @@ AIScoring_EvasionUp: ; 388d4 bit 0, a jr nz, .asm_388ef - call RNG + call Random cp $b2 jr nc, .asm_38911 @@ -628,7 +628,7 @@ AIScoring_EvasionUp: ; 388d4 jr nc, .asm_3890f - call RNG + call Random cp $a jr c, .asm_388ef @@ -683,7 +683,7 @@ AIScoring_EvasionUp: ; 388d4 ret .asm_38938 - call RNG + call Random cp $50 ret c dec [hl] @@ -744,7 +744,7 @@ AIScoring_MirrorMove: ; 3895b call AICompareSpeed ret nc - call RNG + call Random cp $19 ret c @@ -766,7 +766,7 @@ AIScoring_AccuracyDown: ; 38985 bit 0, a jr nz, .asm_3899d - call RNG + call Random cp $b2 jr nc, .asm_389bf @@ -782,7 +782,7 @@ AIScoring_AccuracyDown: ; 38985 jr nc, .asm_389bd - call RNG + call Random cp $a jr c, .asm_3899d @@ -837,7 +837,7 @@ AIScoring_AccuracyDown: ; 38985 ret .asm_389e6 - call RNG + call Random cp $50 ret c dec [hl] @@ -878,7 +878,7 @@ AIScoring_Haze: ; 389f5 .asm_38a12 pop hl - call RNG + call Random cp $28 ret c dec [hl] @@ -894,7 +894,7 @@ AIScoring_Haze: ; 389f5 AIScoring_Bide: ; 38a1e call AICheckEnemyMaxHP ret c - call RNG + call Random cp $19 ret c inc [hl] @@ -926,7 +926,7 @@ AIScoring_Moonlight: ; 38a3a ret .asm_38a45 - call RNG + call Random cp $19 ret c dec [hl] @@ -948,7 +948,7 @@ AIScoring_LightScreen: AIScoring_Reflect: ; 38a54 call AICheckEnemyMaxHP ret c - call RNG + call Random cp $14 ret c inc [hl] @@ -1041,7 +1041,7 @@ AIScoring_Unused2B: ; 38a9c ret c .asm_38acd - call RNG + call Random cp $c8 ret c @@ -1061,7 +1061,7 @@ AIScoring_Unused2B: ; 38a9c AIScoring_Confuse: ; 38adb call AICheckPlayerHalfHP ret c - call RNG + call Random cp $19 jr c, .asm_38ae7 inc [hl] @@ -1156,7 +1156,7 @@ AIScoring_SpeedDownHit: ; 38b40 ret nz call AICompareSpeed ret c - call RNG + call Random cp 30 ret c dec [hl] @@ -1183,7 +1183,7 @@ AIScoring_HyperBeam: ; 38b63 ret .asm_38b72 - call RNG + call Random cp 40 ret c inc [hl] @@ -1334,7 +1334,7 @@ AIScoring_Counter: ; 38bf1 .asm_38c30 - call RNG + call Random cp $64 jr c, .asm_38c38 @@ -1388,7 +1388,7 @@ AIScoring_Encore: ; 38c3b jr nc, .asm_38c81 .asm_38c78 - call RNG + call Random cp $46 ret c dec [hl] @@ -1527,7 +1527,7 @@ AIScoring_Spite: ; 38cd5 cp $f jr nc, .asm_38d0b - call RNG + call Random cp $64 ret nc @@ -1536,7 +1536,7 @@ AIScoring_Spite: ; 38cd5 ret .asm_38d0d - call RNG + call Random cp $64 ret c dec [hl] @@ -1700,7 +1700,7 @@ AIScoring_Conversion2: ; 38d98 ret .asm_38dc9 - call RNG + call Random cp $19 ret c @@ -1722,7 +1722,7 @@ AIScoring_Disable: ; 38dd1 pop hl jr nc, .asm_38dee - call RNG + call Random cp 100 ret c dec [hl] @@ -1734,7 +1734,7 @@ AIScoring_Disable: ; 38dd1 ret nz .asm_38df3 - call RNG + call Random cp 20 ret c inc [hl] @@ -1961,7 +1961,7 @@ AIScoring_Protect: ; 38ed2 inc [hl] .asm_38f14 - call RNG + call Random cp 20 ret c inc [hl] @@ -1985,14 +1985,14 @@ AIScoring_Foresight: ; 38f1d cp GHOST jr z, .asm_38f41 - call RNG + call Random cp 20 ret c inc [hl] ret .asm_38f41 - call RNG + call Random cp 100 ret c dec [hl] @@ -2169,7 +2169,7 @@ AIScoring_Rollout: ; 38fef cp 8 jr nc, .asm_39020 - call RNG + call Random cp 200 ret nc dec [hl] @@ -2196,7 +2196,7 @@ AIScoring_Attract: ; 39026 ret .asm_39032 - call RNG + call Random cp 200 ret nc dec [hl] @@ -2558,7 +2558,7 @@ AIScoring_MirrorCoat: ; 3918b .asm_391ca - call RNG + call Random cp 100 jr c, .asm_391d2 dec [hl] @@ -2634,7 +2634,7 @@ AIScoring_Solarbeam: ; 3920b cp WEATHER_RAIN ret nz - call RNG + call Random cp 25 ; 1/10 ret c @@ -2657,7 +2657,7 @@ AIScoring_Thunder: ; 39225 cp WEATHER_SUN ret nz - call RNG + call Random cp 25 ; 1/10 ret c @@ -3150,7 +3150,7 @@ AIScoring_Cautious: ; 39418 pop hl jr nc, .asm_39425 - call RNG + call Random cp 230 ret nc @@ -3274,7 +3274,7 @@ AIScoring_Risky: ; 394a9 call AICheckEnemyMaxHP jr c, .nextmove - call RNG + call Random cp 200 ; 1/5 jr c, .nextmove @@ -3347,14 +3347,14 @@ AIGetEnemyMove: ; 39508 Function_0x39521: ; 39521 - call RNG + call Random cp 50 ; 1/5 ret ; 39527 Function_0x39527: ; 39527 - call RNG + call Random cp $80 ; 1/2 ret ; 3952d diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index afe822a16..62c715d40 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -288,7 +288,7 @@ CheckPlayerTurn: call FarPlayBattleAnimation ; 50% chance of hitting itself - call FarBattleRNG + call BattleRandom cp $80 jr nc, .CheckAttract @@ -319,7 +319,7 @@ CheckPlayerTurn: call FarPlayBattleAnimation ; 50% chance of infatuation - call FarBattleRNG + call BattleRandom cp $80 jr c, .CheckDisabledMove @@ -353,7 +353,7 @@ CheckPlayerTurn: ret z ; 25% chance to be fully paralyzed - call FarBattleRNG + call BattleRandom cp $3f ret nc @@ -544,7 +544,7 @@ CheckEnemyTurn: ; 3421f call FarPlayBattleAnimation ; 50% chance of hitting itself - call FarBattleRNG + call BattleRandom cp $80 jr nc, .CheckAttract @@ -598,7 +598,7 @@ CheckEnemyTurn: ; 3421f call FarPlayBattleAnimation ; 50% chance of infatuation - call FarBattleRNG + call BattleRandom cp $80 jr c, .CheckDisabledMove @@ -633,7 +633,7 @@ CheckEnemyTurn: ; 3421f ret z ; 25% chance to be fully paralyzed - call FarBattleRNG + call BattleRandom cp $3f ret nc @@ -808,7 +808,7 @@ BattleCommand02: ; 343db ; Random number from 0 to obedience level + monster level .rand1 - call FarBattleRNG + call BattleRandom swap a cp b jr nc, .rand1 @@ -826,7 +826,7 @@ BattleCommand02: ; 343db ; Another random number from 0 to obedience level + monster level .rand2 - call FarBattleRNG + call BattleRandom cp b jr nc, .rand2 @@ -843,7 +843,7 @@ BattleCommand02: ; 343db ld b, a ; The chance of napping is the difference out of 256. - call FarBattleRNG + call BattleRandom swap a sub b jr c, .Nap @@ -862,7 +862,7 @@ BattleCommand02: ; 343db .Nap - call FarBattleRNG + call BattleRandom add a swap a and 7 @@ -876,7 +876,7 @@ BattleCommand02: ; 343db .DoNothing - call FarBattleRNG + call BattleRandom and 3 ; 'loafing around!' @@ -964,7 +964,7 @@ BattleCommand02: ; 343db .RandomMove - call FarBattleRNG + call BattleRandom and 3 cp b @@ -1324,7 +1324,7 @@ BattleCommand05: ; 34631 ld hl, .Chances ld b, 0 add hl, bc - call FarBattleRNG + call BattleRandom cp [hl] ret nc ld a, 1 @@ -2338,7 +2338,7 @@ BattleCommand08: ; 34cfd ; Multiply by 85-100%... .loop - call FarBattleRNG + call BattleRandom rrca cp $d9 ; 85% jr c, .loop @@ -2423,7 +2423,7 @@ BattleCommand09: ; 34d32 cp $ff jr z, .Hit - call FarBattleRNG + call BattleRandom cp b jr nc, .Miss @@ -2701,7 +2701,7 @@ BattleCommand90: ; 34ecc ld hl, EnemyMoveEffectChance .asm_34ee1 - call FarBattleRNG + call BattleRandom cp [hl] pop hl ret c @@ -2986,7 +2986,7 @@ BattleCommand0e: ; 3505e cp HELD_FOCUS_BAND ld b, $0 jr nz, .asm_3508b ; 3507a $f - call FarBattleRNG + call BattleRandom cp c jr nc, .asm_3508b ; 35080 $9 call BattleCommand4b @@ -4332,7 +4332,7 @@ BattleCommand3f: ; 35726 add b ld b, a .asm_3575d - call FarBattleRNG + call BattleRandom and a jr z, .asm_3575d ; 35761 $fa cp b @@ -4555,7 +4555,7 @@ BattleCommand41: ; 35864 bit 4, [hl] jp nz, Function0x35923 set 4, [hl] - call FarBattleRNG + call BattleRandom and $3 inc a inc a @@ -4782,7 +4782,7 @@ BattleCommand44: ; 359e6 call SwitchTurn .asm_35a13 - call FarBattleRNG + call BattleRandom and $1f cp $a jr c, .asm_35a24 ; 35a1a $8 @@ -5005,7 +5005,7 @@ BattleCommand48: ; 35b33 dec hl .asm_35b62 push hl - call FarBattleRNG + call BattleRandom and $3 ld c, a ld b, $0 @@ -5173,7 +5173,7 @@ BattleCommand4a: ; 35c0f jr z, .asm_35c91 ; 35c46 $49 push bc call GetMoveName - call FarBattleRNG + call BattleRandom and $3 inc a inc a @@ -5576,7 +5576,7 @@ BattleCommand14: ; 35e5c ld b, $3 .asm_35ea4 - call FarBattleRNG + call BattleRandom and b jr z, .asm_35ea4 cp 7 @@ -5625,7 +5625,7 @@ Function0x35ece: ; 35ece bit 5, a jr nz, .asm_35eec - call FarBattleRNG + call BattleRandom cp $40 ret c @@ -5715,7 +5715,7 @@ BattleCommand2f: ; 35f2c ld a, [PlayerSubStatus5] bit 5, a jr nz, .asm_35f89 ; 35f80 $7 - call FarBattleRNG + call BattleRandom cp $40 jr c, .asm_35fb8 ; 35f87 $2f .asm_35f89 @@ -6375,7 +6375,7 @@ BattleCommand1d: ; 362e3 cp EFFECT_ACCURACY_DOWN_HIT jr z, .DidntMiss - call FarBattleRNG + call BattleRandom cp $40 jr c, .Failed @@ -6789,7 +6789,7 @@ BattleCommandac: ; 3658f ; 1/3 chance of each status .loop - call FarBattleRNG + call BattleRandom swap a and 3 jr z, .loop @@ -7043,7 +7043,7 @@ BattleCommand22: ; 366e5 ld [de], a ld [PlayerMoveEffect], a ld [EnemyMoveEffect], a - call FarBattleRNG + call BattleRandom and $1 inc a inc a @@ -7080,7 +7080,7 @@ BattleCommand3e: ; 3671a pop af jr nz, .asm_3674c ; 3673f $b set 7, [hl] - call FarBattleRNG + call BattleRandom and $1 inc a inc a @@ -7110,7 +7110,7 @@ BattleCommand3d: ; 36751 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVarPair set 1, [hl] - call FarBattleRNG + call BattleRandom and $1 inc a ld [de], a @@ -7152,7 +7152,7 @@ BattleCommanda0: ; 36778 ld c, a inc c .asm_367ac - call FarBattleRNG + call BattleRandom cp c jr nc, .asm_367ac ; 367b0 $fa srl b @@ -7177,7 +7177,7 @@ BattleCommanda0: ; 36778 ld c, a inc c .asm_367d2 - call FarBattleRNG + call BattleRandom cp c jr nc, .asm_367d2 ; 367d6 $fa srl b @@ -7242,7 +7242,7 @@ BattleCommand23: ; 3680f ld c, a inc c .asm_36845 - call FarBattleRNG + call BattleRandom cp c jr nc, .asm_36845 ; 36849 $fa srl b @@ -7282,7 +7282,7 @@ BattleCommand23: ; 3680f ld a, [CurOTMon] ld c, a .asm_3689a - call FarBattleRNG + call BattleRandom and $7 cp b jr nc, .asm_3689a ; 368a0 $f8 @@ -7332,7 +7332,7 @@ BattleCommand23: ; 3680f ld c, a inc c .asm_368e6 - call FarBattleRNG + call BattleRandom cp c jr nc, .asm_368e6 @@ -7378,7 +7378,7 @@ BattleCommand23: ; 3680f ld a, [CurBattleMon] ld c, a .asm_3693a - call FarBattleRNG + call BattleRandom and $7 cp b jr nc, .asm_3693a @@ -7496,7 +7496,7 @@ BattleCommand24: ; 369b6 cp EFFECT_TRIPLE_KICK jr nz, .asm_36a2b .asm_369ec - call FarBattleRNG + call BattleRandom and $3 jr z, .asm_369ec dec a @@ -7530,11 +7530,11 @@ BattleCommand24: ; 369b6 call BattleCommanda8 jp EndMoveEffect .asm_36a2b - call FarBattleRNG + call BattleRandom and $3 cp $2 jr c, .asm_36a39 ; 36a32 $5 - call FarBattleRNG + call BattleRandom and $3 .asm_36a39 inc a @@ -7670,7 +7670,7 @@ BattleCommand4d: ; 36ac9 ld d, h ld e, l call GetUserItem - call FarBattleRNG + call BattleRandom cp c ret nc call EndRechargeOpp @@ -7917,7 +7917,7 @@ BattleCommand3b: ; 36c2d call CleanGetBattleVarPair bit 4, a ret nz - call FarBattleRNG + call BattleRandom and 3 inc a inc a @@ -8116,7 +8116,7 @@ Function0x36d70: ; 36d70 .asm_36d7b set 7, [hl] - call FarBattleRNG + call BattleRandom and 3 inc a inc a @@ -8196,7 +8196,7 @@ BattleCommand30: ; 36dc7 ld a, [PlayerSubStatus5] bit 5, a jr nz, .asm_36e0e ; 36e05 $7 - call FarBattleRNG + call BattleRandom cp $40 jr c, .asm_36e52 ; 36e0c $44 .asm_36e0e @@ -8558,7 +8558,7 @@ BattleCommand37: ; 36fed and a jr z, .asm_37059 ; 3702c $2b .asm_3702e - call FarBattleRNG + call BattleRandom and $7 jr z, .asm_3702e ; 37033 $f9 inc a @@ -8677,7 +8677,7 @@ BattleCommand1f: ; 3707f call Function0x37e77 jp PrintButItFailed .asm_370d9 - call FarBattleRNG + call BattleRandom and $3 ld c, a ld b, $0 @@ -9235,7 +9235,7 @@ BattleCommand34: ; 37418 call Function0x37e36 .GetMove - call FarBattleRNG + call BattleRandom ; No invalid moves. cp BEAT_UP + 1 @@ -9596,7 +9596,7 @@ Function0x3762c: ; 3762c jr .asm_37665 .asm_37656 - call FarBattleRNG + call BattleRandom and a jr z, .asm_37656 @@ -10029,7 +10029,7 @@ BattleCommand61: ; 37874 and a jp nz, Function0x37e77 push bc - call FarBattleRNG + call BattleRandom ld b, a ld hl, .table_37907 ld c, 0 @@ -10186,7 +10186,7 @@ BattleCommand66: ; 37991 ; getmagnitude push bc - call FarBattleRNG + call BattleRandom ld b, a ld hl, .Magnitudes .asm_37999 diff --git a/engine/scripting.asm b/engine/scripting.asm index 61ebae935..d497f9a4e 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -1988,7 +1988,7 @@ Script_random: ; 0x97640 ld b, a .asm_97653 push bc - call RNG + call Random pop bc ld a, [$ffe1] cp b @@ -1996,7 +1996,7 @@ Script_random: ; 0x97640 jr .asm_97666 ; 0x9765d $7 .asm_9765f push bc - call RNG + call Random pop bc ld a, [$ffe1] .asm_97666 diff --git a/items/item_effects.asm b/items/item_effects.asm index cdca23be0..b060914db 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -166,7 +166,7 @@ ParkBall: ; e8a2 .asm_e98e ld b, a ld [MagikarpLength], a - call RNG + call Random cp b ld a, $0 diff --git a/main.asm b/main.asm index 18d94ab21..dfa5ed172 100644 --- a/main.asm +++ b/main.asm @@ -5570,49 +5570,50 @@ Function2f79: ; 2f79 ; 2f8c -RNG: ; 2f8c +Random: ; 2f8c +; A simple hardware-based random number generator (RNG). + ; Two random numbers are generated by adding and subtracting ; the divider to the respective values every time it's called. -; The divider is a value that increments at a rate of 16384Hz. +; The divider is a register that increments at a rate of 16384Hz. ; For comparison, the Game Boy operates at a clock speed of 4.2MHz. -; Additionally, an equivalent function is called every frame. +; Additionally, an equivalent function is executed in VBlank. -; output: -; a: rand2 -; ffe1: rand1 -; ffe2: rand2 +; This leaves a with the value in hRandomSub. push bc -; Added value + ld a, [rDIV] ld b, a ld a, [hRandomAdd] adc b ld [hRandomAdd], a -; Subtracted value + ld a, [rDIV] ld b, a ld a, [hRandomSub] sbc b ld [hRandomSub], a + pop bc ret ; 2f9f -FarBattleRNG: ; 2f9f -; BattleRNG lives in another bank. -; It handles all RNG calls in the battle engine, -; allowing link battles to remain in sync using a shared PRNG. +BattleRandom: ; 2f9f +; _BattleRandom lives in another bank. + +; It handles all RNG calls in the battle engine, allowing +; link battles to remain in sync using a shared PRNG. ; Save bank ld a, [hROMBank] ; bank push af ; Bankswitch - ld a, BANK(BattleRNG) + ld a, BANK(_BattleRandom) rst Bankswitch - call BattleRNG + call _BattleRandom ; Restore bank ld [$cfb6], a pop af @@ -5634,7 +5635,7 @@ Function2fb1: ; 2fb1 ld b, a push bc .asm_2fbb - call RNG + call Random ld a, [hRandomAdd] ld c, a add b @@ -10416,14 +10417,14 @@ Function4821: ; 4821 ; 4822 Function4822: ; 4822 - call RNG + call Random ld a, [hRandomAdd] and 1 jp Function4af0 ; 482c Function482c: ; 482c - call RNG + call Random ld a, [hRandomAdd] and 1 or 2 @@ -10431,14 +10432,14 @@ Function482c: ; 482c ; 4838 Function4838: ; 4838 - call RNG + call Random ld a, [hRandomAdd] and 3 jp Function4af0 ; 4842 Function4842: ; 4842 - call RNG + call Random ld a, [hRandomAdd] and $c ld hl, $0008 @@ -10453,7 +10454,7 @@ Function4851: ; 4851 ld a, [hl] and $c ld d, a - call RNG + call Random ld a, [hRandomAdd] and $c cp d @@ -10956,14 +10957,14 @@ Function4b17: ; 4b17 ; 4b1d Function4b1d: ; 4b1d - call RNG + call Random ld a, [hRandomAdd] and $7f jr Function4b2d ; 4b26 Function4b26: ; 4b26 - call RNG + call Random ld a, [hRandomAdd] and $1f ; fallthrough @@ -13248,10 +13249,10 @@ Function5bae: ; 5bae ld a, [hRandomAdd] ld [PlayerID + 1], a - call RNG + call Random ld [$d84a], a call DelayFrame - call RNG + call Random ld [$d84b], a ld hl, PartyCount @@ -13460,9 +13461,9 @@ Function5d33: ; 5d33 jr z, .asm_5d55 ld a, b ld [$ac68], a - call RNG + call Random ld c, a - call RNG + call Random .asm_5d55 ld [$dc9f], a @@ -15963,7 +15964,7 @@ DaycareStep: ; 7282 dec [hl] ret nz - call RNG + call Random ld [hl], a ld hl, $6e1d ld a, $5 @@ -15983,7 +15984,7 @@ DaycareStep: ; 7282 ld b, $a .asm_72f8 - call RNG + call Random cp b ret nc ld hl, DaycareMan @@ -16180,7 +16181,7 @@ Function7420: ; 7420 call GetCurNick call Function746e pop hl - call RNG + call Random .next sub [hl] jr c, .asm_7444 @@ -20995,9 +20996,9 @@ Functiond88c: ; d88c ld a, [IsInBattle] and a jr nz, .asm_d9f3 - call RNG + call Random ld b, a - call RNG + call Random ld c, a .asm_d9b5 @@ -22024,9 +22025,9 @@ Functione277: ; e277 call GetFarByte ld b, a ld hl, $ad2c - call RNG + call Random ld [hli], a - call RNG + call Random ld [hl], a call CloseSRAM ld a, $13 @@ -33725,7 +33726,7 @@ Function2a103: ; 2a103 call Function2a111 call Function2a124 call Function2a138 - call RNG + call Random cp b ret ; 2a111 @@ -33804,7 +33805,7 @@ Function2a14f: ; 2a14f .asm_2a174 push hl .asm_2a175 - call RNG + call Random cp 100 jr nc, .asm_2a175 inc a @@ -33828,7 +33829,7 @@ Function2a14f: ; 2a14f call Function1852 jr nz, .asm_2a1aa - call RNG + call Random cp 89 jr c, .asm_2a1aa inc b @@ -34073,7 +34074,7 @@ Function2a2ce: ; 2a2ce call Function1852 jr z, .asm_2a30a call Function2a27f - call RNG + call Random cp 100 jr nc, .asm_2a30a and 3 @@ -34182,7 +34183,7 @@ Function2a355: ; 2a355 .asm_2a36e ld h, d ld l, e - call RNG + call Random and $1f jr z, .asm_2a3cd and $3 @@ -34243,7 +34244,7 @@ Function2a355: ; 2a355 .asm_2a3cd ld hl, $640f .asm_2a3d0 - call RNG + call Random and $f cp $10 jr nc, .asm_2a3d0 @@ -34944,7 +34945,7 @@ Function2ed44: ; 2ed44 ld hl, StatusFlags2 bit 6, [hl] ret z - call RNG + call Random ld a, [hRandomAdd] and a ret nz @@ -34954,7 +34955,7 @@ Function2ed44: ; 2ed44 ld a, [PartyCount] ld b, a .asm_2ed70 - call RNG + call Random and $7 cp b jr nc, .asm_2ed70 @@ -34964,7 +34965,7 @@ Function2ed44: ; 2ed44 and $f0 ret nz .asm_2ed82 - call RNG + call Random and a jr z, .asm_2ed82 ld b, a @@ -34984,7 +34985,7 @@ Function2ed44: ; 2ed44 ret .asm_2ed9a - call RNG + call Random cp $55 ret nc ld a, [PartyCount] @@ -34994,7 +34995,7 @@ Function2ed44: ; 2ed44 ld a, b cp $2 jr c, .asm_2edc3 - call RNG + call Random cp $80 jr c, .asm_2edc3 .asm_2edb3 @@ -35047,7 +35048,7 @@ Function2ede6: ; 2ede6 ld hl, StatusFlags2 bit 6, [hl] ret z - call RNG + call Random cp $10 ret nc ld hl, PartyMons @@ -35505,7 +35506,7 @@ Function38045: ; 38045 jp z, Function38041 cp $10 jr nz, .asm_38061 - call RNG + call Random cp $80 jr c, .asm_38077 jp Function38041 @@ -35513,13 +35514,13 @@ Function38045: ; 38045 .asm_38061 cp $20 jr nz, .asm_3806f - call RNG + call Random cp $c8 jr c, .asm_38077 jp Function38041 .asm_3806f - call RNG + call Random cp $a jp c, Function38041 @@ -35538,7 +35539,7 @@ Function38083: ; 38083 jp z, Function38041 cp $10 jr nz, .asm_3809f - call RNG + call Random cp $14 jr c, .asm_380b5 jp Function38041 @@ -35546,13 +35547,13 @@ Function38083: ; 38083 .asm_3809f cp $20 jr nz, .asm_380ad - call RNG + call Random cp $1e jr c, .asm_380b5 jp Function38041 .asm_380ad - call RNG + call Random cp $c8 jp c, Function38041 @@ -35571,7 +35572,7 @@ Function380c1: ; 380c1 jp z, Function38041 cp $10 jr nz, .asm_380dd - call RNG + call Random cp $32 jr c, .asm_380f3 jp Function38041 @@ -35579,13 +35580,13 @@ Function380c1: ; 380c1 .asm_380dd cp $20 jr nz, .asm_380eb - call RNG + call Random cp $80 jr c, .asm_380f3 jp Function38041 .asm_380eb - call RNG + call Random cp $32 jp c, Function38041 @@ -36673,13 +36674,13 @@ Function3c314: ; 3c314 ld a, [$ffcb] cp $2 jr z, .asm_3c341 - call FarBattleRNG + call BattleRandom cp $80 jp c, $43f1 jp Function3c3f3 .asm_3c341 - call FarBattleRNG + call BattleRandom cp $80 jp c, Function3c3f3 jp $43f1 @@ -36711,7 +36712,7 @@ Function3c314: ; 3c314 ld a, b cp $4a jr z, .asm_3c39f - call FarBattleRNG + call BattleRandom cp e jr nc, .asm_3c3c5 jp $43f1 @@ -36720,7 +36721,7 @@ Function3c314: ; 3c314 ld a, b cp $4a jr nz, .asm_3c3c5 - call FarBattleRNG + call BattleRandom cp c jr nc, .asm_3c3c5 jp Function3c3f3 @@ -36729,19 +36730,19 @@ Function3c314: ; 3c314 ld a, [$ffcb] cp $2 jr z, .asm_3c3b5 - call FarBattleRNG + call BattleRandom cp c jp c, Function3c3f3 - call FarBattleRNG + call BattleRandom cp e jp c, $43f1 jr .asm_3c3c5 .asm_3c3b5 - call FarBattleRNG + call BattleRandom cp e jp c, $43f1 - call FarBattleRNG + call BattleRandom cp c jp c, Function3c3f3 jr .asm_3c3c5 @@ -36759,13 +36760,13 @@ Function3c314: ; 3c314 ld a, [$ffcb] cp $2 jr z, .asm_3c3e9 - call FarBattleRNG + call BattleRandom cp $80 jp c, $43f1 jp Function3c3f3 .asm_3c3e9 - call FarBattleRNG + call BattleRandom cp $80 jp c, Function3c3f3 scf @@ -36996,7 +36997,7 @@ Function3c543: ; 3c543 call IsInArray jr c, .Flee - call FarBattleRNG + call BattleRandom ld b, a cp $80 jr nc, .Stay @@ -37772,7 +37773,7 @@ Function3ca8f: ; 3ca8f ld a, [$c73f] and a ret nz - call FarBattleRNG + call BattleRandom cp $19 ret nc xor a @@ -37793,7 +37794,7 @@ Function3ca8f: ; 3ca8f ld a, [$c740] and a ret nz - call FarBattleRNG + call BattleRandom cp $19 ret nc xor a @@ -39731,7 +39732,7 @@ Function3d672: ; 3d672 .asm_3d6a7 ld a, [OTPartyCount] ld b, a - call FarBattleRNG + call BattleRandom and $7 cp b jr nc, .asm_3d6a7 @@ -40122,7 +40123,7 @@ Function3d8b3: ; 3d8b3 jr .asm_3d96c .asm_3d97a - call FarBattleRNG + call BattleRandom ld b, a ld a, [$ffb6] cp b @@ -42258,7 +42259,7 @@ Function3e7c1: ; 3e7c1 jr nz, .asm_3e882 .asm_3e855 ld hl, EnemyMonMove1 - call FarBattleRNG + call BattleRandom and $3 ld c, a ld b, $0 @@ -42360,7 +42361,7 @@ LoadEnemyMon: ; 3e8eb ; To do this we pull the species from TempEnemyMonSpecies ; Notes: -; FarBattleRNG is used to ensure sync between Game Boys +; BattleRandom is used to ensure sync between Game Boys ; Clear the whole EnemyMon struct xor a @@ -42419,13 +42420,13 @@ LoadEnemyMon: ; 3e8eb ; 2% Item2 ; 25% chance of getting an item - call FarBattleRNG + call BattleRandom cp a, $c0 ld a, NO_ITEM jr c, .UpdateItem ; From there, an 8% chance for Item2 - call FarBattleRNG + call BattleRandom cp a, $14 ; 8% of 25% = 2% Item2 ld a, [BaseItems] jr nc, .UpdateItem @@ -42505,10 +42506,10 @@ LoadEnemyMon: ; 3e8eb ; (HP is initialized at the end of the battle) call GetRoamMonDVs inc hl - call FarBattleRNG + call BattleRandom ld [hld], a ld c, a - call FarBattleRNG + call BattleRandom ld [hl], a ld b, a ; We're done with DVs @@ -42529,9 +42530,9 @@ LoadEnemyMon: ; 3e8eb .GenerateDVs ; Generate new random DVs - call FarBattleRNG + call BattleRandom ld b, a - call FarBattleRNG + call BattleRandom ld c, a .UpdateDVs @@ -42584,7 +42585,7 @@ LoadEnemyMon: ; 3e8eb jr nz, .CheckMagikarpArea ; 5% chance of skipping size checks - call RNG + call Random cp a, $0c ; / $100 jr c, .CheckMagikarpArea ; Try again if > 1614 @@ -42593,7 +42594,7 @@ LoadEnemyMon: ; 3e8eb jr nc, .GenerateDVs ; 20% chance of skipping this check - call RNG + call Random cp a, $32 ; / $100 jr c, .CheckMagikarpArea ; Try again if > 1598 @@ -42618,7 +42619,7 @@ LoadEnemyMon: ; 3e8eb cp a, MAP_LAKE_OF_RAGE jr z, .Happiness ; 40% chance of not flooring - call RNG + call Random cp a, $64 ; / $100 jr c, .Happiness ; Floor at length 1024 @@ -43389,14 +43390,14 @@ EmptyBattleTextBox: ; 3edd1 ; 3edd8 -BattleRNG: ; 3edd8 +_BattleRandom: ; 3edd8 ; If the normal RNG is used in a link battle it'll desync. ; To circumvent this a shared PRNG is used instead. ; But if we're in a non-link battle we're safe to use it ld a, [InLinkBattle] and a - jp z, RNG + jp z, Random ; The PRNG operates in streams of 10 values. @@ -45208,7 +45209,7 @@ Function3f998: ; 3f998 ret .asm_3f9c4 - call FarBattleRNG + call BattleRandom and $f ret nz @@ -47147,7 +47148,7 @@ AIChooseMove: ; 440ce .asm_44197 ld hl, Buffer1 - call RNG + call Random and 3 ld c, a ld b, 0 @@ -59827,7 +59828,7 @@ Function97d23: ; 97d23 Function97d31: ; 97d31 .asm_97d31 - call RNG + call Random cp 100 << 1 jr nc, .asm_97d31 srl a @@ -59854,7 +59855,7 @@ Function97d31: ; 97d31 .asm_97d54 ld c, a inc c - call RNG + call Random ld a, [hRandomAdd] call SimpleDivide add d @@ -59879,7 +59880,7 @@ Function97d64: ; 97d64 ld a, $a ld hl, $6138 rst FarCall - call RNG + call Random ld a, [hRandomAdd] cp b ret c diff --git a/stats/battle_tower.asm b/stats/battle_tower.asm index cda7195da..044f351f8 100644 --- a/stats/battle_tower.asm +++ b/stats/battle_tower.asm @@ -15,7 +15,7 @@ Function1f8000: ; 1f8000 ld a, [hRandomAdd] ld b, a .asm_1f8022 - call RNG + call Random ld a, [hRandomAdd] add b ld b, a @@ -83,7 +83,7 @@ Function1f8081: ; 1f8081 ld a, [hRandomAdd] ld b, a .asm_1f8099 - call RNG + call Random ld a, [hRandomAdd] add b ld b, a diff --git a/stats/odd_eggs.asm b/stats/odd_eggs.asm index 243f77434..6922a2de7 100644 --- a/stats/odd_eggs.asm +++ b/stats/odd_eggs.asm @@ -1,7 +1,7 @@ GiveOddEgg: ; 1fb4b6 ; Figure out which egg to give. - call RNG + call Random ld hl, .Probabilities ld c, 0 ld b, c diff --git a/stats/wild/fish.asm b/stats/wild/fish.asm index 75f49d6c4..44a30a0b2 100644 --- a/stats/wild/fish.asm +++ b/stats/wild/fish.asm @@ -39,7 +39,7 @@ Fish: ; 9241a ; Fish for monsters with rod b from encounter data in FishGroup at hl. ; Return monster e at level d. - call RNG + call Random ; Got a bite? cp [hl] @@ -59,7 +59,7 @@ Fish: ; 9241a ld l, a ; Encounter chance for this monster: - call RNG + call Random .CheckEncounter cp [hl] From c402a16def99bad3df047d570120d1f1da1abbc3 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 23:03:15 -0400 Subject: [PATCH 11/13] undo overcommenting in BattleRandom these comments made sense before hram and rst constants were established --- main.asm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.asm b/main.asm index dfa5ed172..64ec02a0c 100644 --- a/main.asm +++ b/main.asm @@ -5607,14 +5607,13 @@ BattleRandom: ; 2f9f ; It handles all RNG calls in the battle engine, allowing ; link battles to remain in sync using a shared PRNG. -; Save bank - ld a, [hROMBank] ; bank + ld a, [hROMBank] push af -; Bankswitch ld a, BANK(_BattleRandom) rst Bankswitch + call _BattleRandom -; Restore bank + ld [$cfb6], a pop af rst Bankswitch From b333b18dbde658cd7e4299f8206d1d52c532b87a Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 30 Aug 2013 23:07:08 -0400 Subject: [PATCH 12/13] Function2f79 is PickUpItem --- engine/scripting.asm | 2 +- main.asm | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/scripting.asm b/engine/scripting.asm index d497f9a4e..5d44d1a8e 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2363,7 +2363,7 @@ Script_checkitem: ; 0x97812 call GetScriptByte ld [$d106], a ld hl, $d892 - call Function2f79 + call PickUpItem ret nc ld a, $1 ld [$c2dd], a diff --git a/main.asm b/main.asm index 64ec02a0c..0b848c4e0 100644 --- a/main.asm +++ b/main.asm @@ -5549,20 +5549,20 @@ Function2f66: ; 2f66 ret ; 2f79 -Function2f79: ; 2f79 +PickUpItem: ; 2f79 push hl push de push bc ld a, [hROMBank] push af - ld a, BANK(Functiond244) + ld a, BANK(_PickUpItem) rst Bankswitch - call Functiond244 + call _PickUpItem + pop bc ld a, b rst Bankswitch - pop bc pop de pop hl @@ -20275,7 +20275,7 @@ Functiond20d: ; d20d jp Functiond2ff ; d244 -Functiond244: ; d244 +_PickUpItem: ; d244 call Functiond27b jr nz, .asm_d278 push hl @@ -32235,7 +32235,7 @@ Function24c64: ; 24c64 push hl ld [CurItem], a ld hl, NumItems - call Function2f79 + call PickUpItem pop hl jr nc, .asm_24c89 ld a, [hl] @@ -55485,7 +55485,7 @@ Function8adef: ; 8adef ld a, WATER_STONE ld [CurItem], a ld hl, NumItems - call Function2f79 + call PickUpItem jr c, .asm_8ae24 ld a, [PartyCount] From 2acccc3ea5d5ebdd54cddc6cb7a3c888428be286 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 31 Aug 2013 03:54:02 -0400 Subject: [PATCH 13/13] rename FarBattleTextBox to StdBattleTextBox that's it for bad Far usage --- battle/effect_commands.asm | 260 ++++++++++++++++++------------------- items/item_effects.asm | 2 +- main.asm | 118 ++++++++--------- 3 files changed, 191 insertions(+), 189 deletions(-) diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index 62c715d40..94b54c0bd 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -154,7 +154,7 @@ CheckPlayerTurn: ; 'must recharge!' ld hl, MustRechargeText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -179,7 +179,7 @@ CheckPlayerTurn: .WokeUp ; 'woke up!' ld hl, WokeUpText - call FarBattleTextBox + call StdBattleTextBox call CantMove call UpdateBattleMonInParty @@ -195,7 +195,7 @@ CheckPlayerTurn: .FastAsleep ; 'fast asleep!' ld hl, FastAsleepText - call FarBattleTextBox + call StdBattleTextBox ; Snore and Sleep Talk bypass sleep. ld a, [CurPlayerMove] @@ -221,7 +221,7 @@ CheckPlayerTurn: ; 'frozen solid!' ld hl, FrozenSolidText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -236,7 +236,7 @@ CheckPlayerTurn: ; 'flinched!' ld hl, FlinchedText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -256,7 +256,7 @@ CheckPlayerTurn: ; 'disabled no more!' ld hl, DisabledNoMoreText - call FarBattleTextBox + call StdBattleTextBox .CheckConfused @@ -272,7 +272,7 @@ CheckPlayerTurn: ; 'confused no more!' ld hl, ConfusedNoMoreText - call FarBattleTextBox + call StdBattleTextBox jr .CheckAttract @@ -280,7 +280,7 @@ CheckPlayerTurn: .Confused ; 'confused!' ld hl, IsConfusedText - call FarBattleTextBox + call StdBattleTextBox xor a ld [$cfca], a @@ -310,7 +310,7 @@ CheckPlayerTurn: ; 'in love with' ld hl, InLoveWithText - call FarBattleTextBox + call StdBattleTextBox xor a ld [$cfca], a @@ -325,7 +325,7 @@ CheckPlayerTurn: ; 'infatuation kept it from attacking!' ld hl, InfatuationText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -359,7 +359,7 @@ CheckPlayerTurn: ; 'fully paralyzed!' ld hl, FullyParalyzedText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 ; 341f0 @@ -412,7 +412,7 @@ CheckEnemyTurn: ; 3421f ; 'must recharge!' ld hl, MustRechargeText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -429,7 +429,7 @@ CheckEnemyTurn: ; 3421f ; 'fast asleep!' ld hl, FastAsleepText - call FarBattleTextBox + call StdBattleTextBox xor a ld [$cfca], a ld de, ANIM_SLEEP @@ -440,7 +440,7 @@ CheckEnemyTurn: ; 3421f .WokeUp ; 'woke up!' ld hl, WokeUpText - call FarBattleTextBox + call StdBattleTextBox call CantMove call UpdateEnemyMonInParty ld hl, $6036 @@ -475,7 +475,7 @@ CheckEnemyTurn: ; 3421f ; 'frozen solid!' ld hl, FrozenSolidText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -489,7 +489,7 @@ CheckEnemyTurn: ; 3421f ; 'flinched!' ld hl, FlinchedText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -511,7 +511,7 @@ CheckEnemyTurn: ; 3421f ; 'disabled no more!' ld hl, DisabledNoMoreText - call FarBattleTextBox + call StdBattleTextBox .CheckConfused @@ -528,7 +528,7 @@ CheckEnemyTurn: ; 3421f ; 'confused no more!' ld hl, ConfusedNoMoreText - call FarBattleTextBox + call StdBattleTextBox jr .CheckAttract @@ -536,7 +536,7 @@ CheckEnemyTurn: ; 3421f .Confused ; 'confused!' ld hl, IsConfusedText - call FarBattleTextBox + call StdBattleTextBox xor a ld [$cfca], a @@ -555,7 +555,7 @@ CheckEnemyTurn: ; 3421f ; 'hurt itself in its confusion!' ld hl, HurtItselfText - call FarBattleTextBox + call StdBattleTextBox call Function0x355dd @@ -589,7 +589,7 @@ CheckEnemyTurn: ; 3421f ; 'in love with' ld hl, InLoveWithText - call FarBattleTextBox + call StdBattleTextBox xor a ld [$cfca], a @@ -604,7 +604,7 @@ CheckEnemyTurn: ; 3421f ; 'infatuation kept it from attacking!' ld hl, InfatuationText - call FarBattleTextBox + call StdBattleTextBox call CantMove jp Function0x34385 @@ -639,7 +639,7 @@ CheckEnemyTurn: ; 3421f ; 'fully paralyzed!' ld hl, FullyParalyzedText - call FarBattleTextBox + call StdBattleTextBox call CantMove @@ -668,7 +668,7 @@ MoveDisabled: ; 3438d ; 'disabled!' ld hl, DisabledMoveText - jp FarBattleTextBox + jp StdBattleTextBox ; 343a5 @@ -676,7 +676,7 @@ HitConfusion: ; 343a5 ; 'hurt itself in its confusion!' ld hl, HurtItselfText - call FarBattleTextBox + call StdBattleTextBox xor a ld [CriticalHit], a @@ -854,7 +854,7 @@ BattleCommand02: ; 343db ; 'won't obey!' ld hl, WontObeyText - call FarBattleTextBox + call StdBattleTextBox call HitConfusion @@ -898,7 +898,7 @@ BattleCommand02: ; 343db ld hl, IgnoredOrdersText .Print - call FarBattleTextBox + call StdBattleTextBox jp Function0x3450c @@ -1043,7 +1043,7 @@ IgnoreSleepOnly: ; 3451f ; 'ignored orders…sleeping!' ld hl, IgnoredSleepingText - call FarBattleTextBox + call StdBattleTextBox call EndMoveEffect @@ -1192,7 +1192,7 @@ BattleCommand04: ; 34555 ; 'but no pp is left for the move' ld hl, NoPPLeftText .print - call FarBattleTextBox + call StdBattleTextBox ld b, 1 ret ; 34602 @@ -2471,7 +2471,7 @@ BattleCommand09: ; 34d32 ; 'protecting itself!' ld hl, ProtectingItselfText - call FarBattleTextBox + call StdBattleTextBox ld c, 40 call DelayFrames @@ -3014,7 +3014,7 @@ BattleCommand0e: ; 3505e dec a jr nz, .asm_350ab ; 350a3 $6 ld hl, EnduredText - jp FarBattleTextBox + jp StdBattleTextBox .asm_350ab call GetOpponentItem @@ -3023,7 +3023,7 @@ BattleCommand0e: ; 3505e call GetItemName ld hl, HungOnText - jp FarBattleTextBox + jp StdBattleTextBox .asm_50bb ld a, BATTLE_VARS_SUBSTATUS4_OPP @@ -3105,7 +3105,7 @@ Function0x350e4: ; 350e4 ld [hl], a .asm_3513e ld hl, CrashedText - call FarBattleTextBox + call StdBattleTextBox ld a, $1 ld [$c689], a call Function0x37e36 @@ -3123,7 +3123,7 @@ Function0x35157: ; 35157 ld h, d ld l, e .asm_35162 - jp FarBattleTextBox + jp StdBattleTextBox ; 35165 @@ -3157,7 +3157,7 @@ BattleCommand0f: ; 35175 ld a, [hli] ld h, [hl] ld l, a - call FarBattleTextBox + call StdBattleTextBox xor a ld [CriticalHit], a @@ -3211,7 +3211,7 @@ BattleCommand10: ; 351ad jr nc, .print ld hl, NotVeryEffectiveText ; 'not very effective' .print - jp FarBattleTextBox + jp StdBattleTextBox ; 351c0 @@ -3237,7 +3237,7 @@ BattleCommand11: ; 351c0 jr z, .asm_35231 ld hl, TookDownWithItText - call FarBattleTextBox + call StdBattleTextBox ld a, [hBattleTurn] and a @@ -3332,7 +3332,7 @@ BattleCommand12: ; 35250 call SwitchTurn ld hl, RageBuildingText - call FarBattleTextBox + call StdBattleTextBox jp SwitchTurn ; 3527b @@ -3822,7 +3822,7 @@ BattleCommanda1: ; 35461 ld a, $1 ld [$c72d], a ld hl, BeatUpAttackText - call FarBattleTextBox + call StdBattleTextBox ld a, [EnemyMonSpecies] ld [CurSpecies], a call $3856 @@ -3923,11 +3923,11 @@ BattleCommanda1: ; 35461 ld [$d265], a call $343b ld hl, BeatUpAttackText - call FarBattleTextBox + call StdBattleTextBox jp EnemyAttackDamage .asm_3557d ld hl, BeatUpAttackText - call FarBattleTextBox + call StdBattleTextBox ld a, [BattleMonSpecies] ld [CurSpecies], a call GetBaseData @@ -4626,7 +4626,7 @@ BattleCommand41: ; 35864 call Function0x37e01 ld hl, GotAnEncoreText - jp FarBattleTextBox + jp StdBattleTextBox ; 35923 @@ -4673,7 +4673,7 @@ BattleCommand42: ; 35926 rst FarCall ld hl, SharedPainText - jp FarBattleTextBox + jp StdBattleTextBox .asm_3597d ld a, [hld] @@ -4815,7 +4815,7 @@ BattleCommand44: ; 359e6 ld a, $29 call Predef ld hl, $5452 - jp FarBattleTextBox + jp StdBattleTextBox .asm_35a50 jp Function0x37354 ; 35a53 @@ -4835,7 +4835,7 @@ BattleCommand45: ; 35a53 call Function0x37e01 ld hl, TookAimText - jp FarBattleTextBox + jp StdBattleTextBox .asm_35a6e call Function0x37e77 @@ -4938,7 +4938,7 @@ BattleCommand46: ; 35a74 call Function0x37e01 ld hl, SketchedText - jp FarBattleTextBox + jp StdBattleTextBox .asm_35b10 call Function0x37e77 @@ -5131,7 +5131,7 @@ BattleCommand49: ; 35bff set 6, [hl] call Function0x37e01 ld hl, DestinyBondEffectText - jp FarBattleTextBox + jp StdBattleTextBox ; 35c0f @@ -5216,7 +5216,7 @@ BattleCommand4a: ; 35c0f ld a, d ld [$d265], a ld hl, SpiteEffectText - jp FarBattleTextBox + jp StdBattleTextBox .asm_35c91 jp PrintDidntAffect2 ; 35c94 @@ -5294,7 +5294,7 @@ BattleCommand4c: ; 35cc9 call Function0x37e01 ld hl, BellChimedText - call FarBattleTextBox + call StdBattleTextBox ld a, [hBattleTurn] and a @@ -5452,7 +5452,7 @@ Function0x35d7e: ; 35d7e Function0x35de0: ; 35de0 ld hl, SubTookDamageText - call FarBattleTextBox + call StdBattleTextBox ld de, $c6e0 ld a, [hBattleTurn] @@ -5479,7 +5479,7 @@ Function0x35de0: ; 35de0 res 4, [hl] ld hl, SubFadedText - call FarBattleTextBox + call StdBattleTextBox call SwitchTurn call BattleCommanda7 @@ -5587,7 +5587,7 @@ BattleCommand14: ; 35e5c call RefreshBattleHuds ld hl, FellAsleepText - call FarBattleTextBox + call StdBattleTextBox ld a, $f ld hl, $5de9 @@ -5600,7 +5600,7 @@ BattleCommand14: ; 35e5c push hl call Function0x37e77 pop hl - jp FarBattleTextBox + jp StdBattleTextBox ; 35ece @@ -5664,7 +5664,7 @@ BattleCommand13: ; 35eee call RefreshBattleHuds ld hl, WasPoisonedText - call FarBattleTextBox + call StdBattleTextBox ld a, $f ld hl, $5de9 @@ -5729,7 +5729,7 @@ BattleCommand2f: ; 35f2c call Function0x35fc0 ld hl, WasPoisonedText - call FarBattleTextBox + call StdBattleTextBox jr .asm_35fb1 ; 35fa2 $d .asm_35fa4 @@ -5739,7 +5739,7 @@ BattleCommand2f: ; 35f2c call Function0x35fc0 ld hl, BadlyPoisonedText - call FarBattleTextBox + call StdBattleTextBox .asm_35fb1 ld a, $f @@ -5751,7 +5751,7 @@ BattleCommand2f: ; 35f2c push hl call Function0x37e77 pop hl - jp FarBattleTextBox + jp StdBattleTextBox ; 35fc0 @@ -5807,7 +5807,7 @@ BattleCommand15: ; 35fff ; draintarget call Function0x36011 ld hl, SuckedHealthText - jp FarBattleTextBox + jp StdBattleTextBox ; 36008 @@ -5815,7 +5815,7 @@ BattleCommand16: ; 36008 ; eatdream call Function0x36011 ld hl, DreamEatenText - jp FarBattleTextBox + jp StdBattleTextBox ; 36011 @@ -5938,7 +5938,7 @@ BattleCommand17: ; 3608c call RefreshBattleHuds ld hl, WasBurnedText - call FarBattleTextBox + call StdBattleTextBox ld a, $f ld hl, $5de9 @@ -5970,7 +5970,7 @@ Defrost: ; 360dd call UpdateOpponentInParty ld hl, DefrostedOpponentText - jp FarBattleTextBox + jp StdBattleTextBox ; 36102 @@ -6011,7 +6011,7 @@ BattleCommand18: ; 36102 call RefreshBattleHuds ld hl, WasFrozenText - call FarBattleTextBox + call StdBattleTextBox ld a, $f ld hl, $5de9 @@ -6596,7 +6596,7 @@ BattleCommand8e: ; 3644c inc b call GetStatName ld hl, WontRiseAnymoreText - jp FarBattleTextBox + jp StdBattleTextBox ; 3646a @@ -6612,14 +6612,14 @@ BattleCommand8f: ; 3646a jp z, TryPrintButItFailed dec a ld hl, ProtectedByMistText - jp z, FarBattleTextBox + jp z, StdBattleTextBox ld a, [LoweredStat] and $f ld b, a inc b call GetStatName ld hl, WontDropAnymoreText - jp FarBattleTextBox + jp StdBattleTextBox ; 3648f @@ -6972,7 +6972,7 @@ BattleCommand21: ; 36671 res 0, [hl] ld hl, UnleashedEnergyText - call FarBattleTextBox + call StdBattleTextBox ld a, BATTLE_VARS_MOVE_POWER call GetBattleVarPair @@ -7018,7 +7018,7 @@ BattleCommand21: ; 36671 .asm_366dc ld hl, StoringEnergyText - call FarBattleTextBox + call StdBattleTextBox jp EndMoveEffect ; 366e5 @@ -7199,7 +7199,7 @@ BattleCommanda0: ; 36778 call Function0x36804 ld hl, FledFromBattleText - jp FarBattleTextBox + jp StdBattleTextBox ; 36804 @@ -7305,7 +7305,7 @@ BattleCommand23: ; 3680f rst FarCall ld hl, DraggedOutText - call FarBattleTextBox + call StdBattleTextBox ld hl, $5c23 jp CallBankF @@ -7402,7 +7402,7 @@ BattleCommand23: ; 3680f call CallBankF ld hl, DraggedOutText - call FarBattleTextBox + call StdBattleTextBox ld hl, $5c23 jp CallBankF @@ -7428,7 +7428,7 @@ BattleCommand23: ; 3680f jr z, .asm_36991 ld hl, BlownAwayText .asm_36991 - jp FarBattleTextBox + jp StdBattleTextBox ; 36994 @@ -7569,7 +7569,7 @@ BattleCommand24: ; 369b6 call CleanGetBattleVarPair cp EFFECT_BEAT_UP jr z, .asm_36a67 - call FarBattleTextBox + call StdBattleTextBox .asm_36a67 pop bc @@ -7767,7 +7767,7 @@ BattleCommand39: ; 36b4d ld hl, IgnoredOrders2Text ld a, [AlreadyDisobeyed] and a - call nz, FarBattleTextBox + call nz, StdBattleTextBox call BattleCommand0a xor a @@ -7941,7 +7941,7 @@ BattleCommand3b: ; 36c2d ld a, [hli] ld h, [hl] ld l, a - jp FarBattleTextBox + jp StdBattleTextBox .Traps dbw BIND, UsedBindText ; 'used BIND on' @@ -7962,7 +7962,7 @@ BattleCommand28: ; 36c7e set 1, [hl] call Function0x37e01 ld hl, MistText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36c92 call Function0x37e77 jp PrintButItFailed @@ -7979,7 +7979,7 @@ BattleCommand29: ; 36c98 set 2, [hl] call Function0x37e01 ld hl, GettingPumpedText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36cac call Function0x37e77 jp PrintButItFailed @@ -8048,7 +8048,7 @@ BattleCommand27: ; 36cb2 call Predef call RefreshBattleHuds ld hl, RecoilText - jp FarBattleTextBox + jp StdBattleTextBox ; 36d1d @@ -8085,7 +8085,7 @@ BattleCommand2a: ; 36d3b call GetItemName call Function0x37e77 ld hl, ProtectedByText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36d53 ld a, BATTLE_VARS_SUBSTATUS3_OPP @@ -8094,7 +8094,7 @@ BattleCommand2a: ; 36d3b jr z, .asm_36d65 call Function0x37e77 ld hl, AlreadyConfusedText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36d65 call CheckSubstituteOpp @@ -8137,7 +8137,7 @@ Function0x36d70: ; 36d70 call Function0x37e54 ld hl, BecameConfusedText - call FarBattleTextBox + call StdBattleTextBox call GetOpponentItem ld a, b @@ -8182,7 +8182,7 @@ BattleCommand30: ; 36dc7 call GetItemName call Function0x37e77 ld hl, ProtectedByText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36def ld a, [hBattleTurn] and a @@ -8227,7 +8227,7 @@ BattleCommand30: ; 36dc7 .asm_36e49 call Function0x37e77 ld hl, AlreadyParalyzedText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36e52 jp PrintDidntAffect2 .asm_36e55 @@ -8338,7 +8338,7 @@ BattleCommand31: ; 36e7c call BattleCommanda6 .asm_36eeb ld hl, MadeSubstituteText - call FarBattleTextBox + call StdBattleTextBox jp RefreshBattleHuds .asm_36ef4 call Function0x34548 @@ -8350,7 +8350,7 @@ BattleCommand31: ; 36e7c call nz, BattleCommand0c ld hl, TooWeakSubText .asm_36f08 - jp FarBattleTextBox + jp StdBattleTextBox ; 36f0b BattleCommand32: ; 36f0b @@ -8463,7 +8463,7 @@ BattleCommand33: ; 36f46 call GetMoveName call Function0x37e01 ld hl, LearnedMoveText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36f9a jp Function0x37357 ; 36f9d @@ -8496,14 +8496,14 @@ BattleCommand35: ; 36f9d set 7, [hl] call Function0x37e01 ld hl, WasSeededText - jp FarBattleTextBox + jp StdBattleTextBox .asm_36fd2 call Function0x37e77 jp PrintDoesntAffect .asm_36fd8 call Function0x37e77 ld hl, EvadedText - jp FarBattleTextBox + jp StdBattleTextBox ; 36fe1 @@ -8579,7 +8579,7 @@ BattleCommand37: ; 36fed ld [$d265], a call GetMoveName ld hl, WasDisabledText - jp FarBattleTextBox + jp StdBattleTextBox .asm_37059 jp Function0x37354 ; 3705c @@ -8608,7 +8608,7 @@ BattleCommand1e: ; 3705c inc [hl] .asm_37079 ld hl, CoinsScatteredText - jp FarBattleTextBox + jp StdBattleTextBox ; 3707f @@ -8706,7 +8706,7 @@ BattleCommand1f: ; 3707f rst FarCall call Function0x37e01 ld hl, TransformedTypeText - jp FarBattleTextBox + jp StdBattleTextBox ; 3710e @@ -8733,7 +8733,7 @@ BattleCommand20: ; 3710e call Function0x37e01 ld hl, EliminatedStatsText - jp FarBattleTextBox + jp StdBattleTextBox .Fill ld b, PlayerStatLevelsEnd - PlayerStatLevels @@ -8787,7 +8787,7 @@ BattleCommand2c: ; 3713e jr z, .asm_37186 ; 37181 $3 ld hl, RestedText .asm_37186 - call FarBattleTextBox + call StdBattleTextBox ld a, [hBattleTurn] and a jr nz, .asm_37193 ; 3718c $5 @@ -8816,12 +8816,12 @@ BattleCommand2c: ; 3713e call UpdateUserInParty call RefreshBattleHuds ld hl, RegainedHealthText - jp FarBattleTextBox + jp StdBattleTextBox .asm_371c4 call Function0x37e77 ld hl, HPIsFullText - jp FarBattleTextBox + jp StdBattleTextBox ; 371cd @@ -8958,7 +8958,7 @@ BattleCommand2d: ; 371cd ld a, $a4 call nz, Function0x37e44 ld hl, TransformedText - jp FarBattleTextBox + jp StdBattleTextBox ; 372c6 @@ -9056,7 +9056,7 @@ BattleCommand2e: ; 372fc .asm_37331 call Function0x37e01 - jp FarBattleTextBox + jp StdBattleTextBox .asm_37337 call Function0x37e77 @@ -9067,14 +9067,14 @@ BattleCommand2e: ; 372fc PrintDoesntAffect: ; 3733d ; 'it doesn't affect' ld hl, DoesntAffectText - jp FarBattleTextBox + jp StdBattleTextBox ; 37343 PrintNothingHappened: ; 37343 ; 'but nothing happened!' ld hl, NothingHappenedText - jp FarBattleTextBox + jp StdBattleTextBox ; 37349 @@ -9090,7 +9090,7 @@ TryPrintButItFailed: ; 37349 PrintButItFailed: ; 3734e ; 'but it failed!' ld hl, ButItFailedText - jp FarBattleTextBox + jp StdBattleTextBox ; 37354 @@ -9109,7 +9109,7 @@ Function0x37357: ; 37357 PrintDidntAffect: ; 37360 ; 'it didn't affect' ld hl, DidntAffect1Text - jp FarBattleTextBox + jp StdBattleTextBox ; 37366 @@ -9124,7 +9124,7 @@ PrintDidntAffect2: ; 37366 PrintParalyze: ; 37372 ; 'paralyzed! maybe it can't attack!' ld hl, ParalyzedText - jp FarBattleTextBox + jp StdBattleTextBox ; 37378 @@ -9189,7 +9189,7 @@ BattleCommand1b: ; 373c9 .asm_373de call Function0x37e77 ld hl, MirrorMoveFailedText - call FarBattleTextBox + call StdBattleTextBox jp EndMoveEffect .asm_373ea ld a, b @@ -9391,7 +9391,7 @@ BattleCommand50: ; 37492 .asm_374f8 call GetItemName ld hl, StoleText - jp FarBattleTextBox + jp StdBattleTextBox .asm_37501 ld a, 1 @@ -9422,7 +9422,7 @@ BattleCommand51: ; 37517 set 7, [hl] call Function0x37e01 ld hl, CantEscapeNowText - jp FarBattleTextBox + jp StdBattleTextBox .asm_37530 call Function0x37e77 jp PrintButItFailed @@ -9447,7 +9447,7 @@ BattleCommand52: ; 37536 set 0, [hl] call Function0x37e01 ld hl, StartedNightmareText - jp FarBattleTextBox + jp StdBattleTextBox .asm_3755d call Function0x37e77 jp PrintButItFailed @@ -9475,7 +9475,7 @@ BattleCommand53: ; 37563 .asm_3757f call RefreshBattleHuds ld hl, WasDefrostedText - jp FarBattleTextBox + jp StdBattleTextBox ; 37588 @@ -9536,7 +9536,7 @@ BattleCommand54: ; 37588 call CallBankF call UpdateUserInParty ld hl, PutACurseText - jp FarBattleTextBox + jp StdBattleTextBox .asm_37604 call Function0x37e77 jp PrintButItFailed @@ -9545,7 +9545,7 @@ BattleCommand54: ; 37588 call GetStatName call Function0x37e77 ld hl, WontRiseAnymoreText - jp FarBattleTextBox + jp StdBattleTextBox ; 37618 @@ -9559,7 +9559,7 @@ BattleCommand55: ; 37618 set 2, [hl] call Function0x37e01 ld hl, ProtectedItselfText - jp FarBattleTextBox + jp StdBattleTextBox ; 3762c @@ -9631,7 +9631,7 @@ BattleCommand5a: ; 3766f set SUBSTATUS_ENDURE, [hl] call Function0x37e01 ld hl, BracedItselfText - jp FarBattleTextBox + jp StdBattleTextBox ; 37683 @@ -9651,7 +9651,7 @@ BattleCommand56: ; 37683 set 0, [hl] call Function0x37e01 ld hl, SpikesText - jp FarBattleTextBox + jp StdBattleTextBox .failed jp Function0x37354 @@ -9673,7 +9673,7 @@ BattleCommand57: ; 376a0 set SUBSTATUS_IDENTIFIED, [hl] call Function0x37e01 ld hl, IdentifiedText - jp FarBattleTextBox + jp StdBattleTextBox .asm_376bf jp Function0x37354 ; 376c2 @@ -9706,7 +9706,7 @@ BattleCommand58: ; 376c2 .asm_376e9 call Function0x37e01 ld hl, StartPerishText - jp FarBattleTextBox + jp StdBattleTextBox .asm_376f2 call Function0x37e77 jp PrintButItFailed @@ -9725,7 +9725,7 @@ BattleCommand59: ; 376f8 ld [WeatherCount], a call Function0x37e01 ld hl, SandstormBrewedText - jp FarBattleTextBox + jp StdBattleTextBox .asm_37712 call Function0x37e77 jp PrintButItFailed @@ -9911,7 +9911,7 @@ BattleCommand5f: ; 377ce ; 'fell in love!' ld hl, FellInLoveText - jp FarBattleTextBox + jp StdBattleTextBox .asm_377f2 jp Function0x37354 @@ -10071,7 +10071,7 @@ BattleCommand61: ; 37874 call CallBankF call SwitchTurn ld hl, RegainedHealthText - call FarBattleTextBox + call StdBattleTextBox call SwitchTurn call UpdateOpponentInParty jr .asm_37904 ; 378f1 $11 @@ -10081,7 +10081,7 @@ BattleCommand61: ; 37874 jr nc, .asm_37904 ; 378f9 $9 call Function0x37e77 ld hl, RefusedGiftText - call FarBattleTextBox + call StdBattleTextBox .asm_37904 jp EndMoveEffect @@ -10141,7 +10141,7 @@ BattleCommand64: ; 37939 ld [de], a call Function0x37e01 ld hl, CoveredByVeilText - jp FarBattleTextBox + jp StdBattleTextBox .asm_3795c call Function0x37e77 jp PrintButItFailed @@ -10177,7 +10177,7 @@ BattleCommand65: ; 37972 ld [AttackMissed], a call BattleCommandaa ld hl, SafeguardProtectText - call FarBattleTextBox + call StdBattleTextBox jp EndMoveEffect ; 37991 @@ -10204,7 +10204,7 @@ BattleCommand66: ; 37991 ld [$d265], a call BattleCommandaa ld hl, MagnitudeText - call FarBattleTextBox + call StdBattleTextBox pop de pop bc ret @@ -10485,7 +10485,7 @@ BattleCommand69: ; 37b39 jr z, .asm_37b4a ; 37b40 $8 res 7, [hl] ld hl, ShedLeechSeedText - call FarBattleTextBox + call StdBattleTextBox .asm_37b4a ld hl, PlayerScreens ld de, $c730 @@ -10500,7 +10500,7 @@ BattleCommand69: ; 37b39 res 0, [hl] ld hl, BlewSpikesText push de - call FarBattleTextBox + call StdBattleTextBox pop de .asm_37b69 ld a, [de] @@ -10509,7 +10509,7 @@ BattleCommand69: ; 37b39 xor a ld [de], a ld hl, ReleasedByText - jp FarBattleTextBox + jp StdBattleTextBox ; 37b74 @@ -10600,14 +10600,14 @@ BattleCommand6a6c: ; 37b7e ; 'regained health!' ld hl, RegainedHealthText - jp FarBattleTextBox + jp StdBattleTextBox .Full call Function0x37e77 ; 'hp is full!' ld hl, HPIsFullText - jp FarBattleTextBox + jp StdBattleTextBox .Multipliers dw GetEighthMaxHP @@ -10636,7 +10636,7 @@ BattleCommand6e: ; 37bf4 ld [WeatherCount], a call Function0x37e01 ld hl, DownpourText - jp FarBattleTextBox + jp StdBattleTextBox ; 37c07 @@ -10648,7 +10648,7 @@ BattleCommand6f: ; 37c07 ld [WeatherCount], a call Function0x37e01 ld hl, SunGotBrightText - jp FarBattleTextBox + jp StdBattleTextBox ; 37c1a @@ -10685,7 +10685,7 @@ BattleCommand95: ; 37c1a jr nz, .asm_37c41 ; 37c47 $f8 ld hl, BellyDrumText - jp FarBattleTextBox + jp StdBattleTextBox .asm_37c4f call Function0x37e77 jp PrintButItFailed @@ -10735,7 +10735,7 @@ BattleCommand96: ; 37c55 .asm_37c8c call Function0x37e01 ld hl, CopiedStatsText - jp FarBattleTextBox + jp StdBattleTextBox ; 37c95 @@ -10884,7 +10884,7 @@ BattleCommand9c: ; 37d34 call BattleCommand0a call BattleCommandaa ld hl, ForesawAttackText - call FarBattleTextBox + call StdBattleTextBox call BattleCommand0c ld de, $c727 ld a, [hBattleTurn] diff --git a/items/item_effects.asm b/items/item_effects.asm index b060914db..342f61926 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -1212,7 +1212,7 @@ BitterBerry: ; f16a call $7789 ld hl, $4d81 - call FarBattleTextBox + call StdBattleTextBox ld a, $0 diff --git a/main.asm b/main.asm index 0b848c4e0..077205a37 100644 --- a/main.asm +++ b/main.asm @@ -8178,24 +8178,25 @@ MobileTextBorder: ; 3ab2 BattleTextBox: ; 3ac3 +; Open a textbox and print text at hl. push hl call SpeechTextBox call MobileTextBorder - call Function1ad2 ; UpdateSprites - call Function321c ; refresh? + call Function1ad2 + call Function321c pop hl call PrintTextBoxText ret ; 3ad5 -FarBattleTextBox: ; 3ad5 -; Open a textbox and print text at 20:hl. +StdBattleTextBox: ; 3ad5 +; Open a textbox and print battle text at 20:hl. ld a, [hROMBank] push af - ld a, $20 + ld a, BANK(BattleText) rst Bankswitch call BattleTextBox @@ -36361,7 +36362,7 @@ Function3c0e5: ; 3c0e5 ld hl, $5863 .asm_3c115 - call FarBattleTextBox + call StdBattleTextBox .asm_3c118 call Function3ceec @@ -36624,7 +36625,7 @@ Function3c27c: ; 3c27c ld [hl], a call GetItemName ld hl, $4bde - call FarBattleTextBox + call StdBattleTextBox callab BattleCommand8c pop af bit 7, a @@ -36635,7 +36636,7 @@ Function3c27c: ; 3c27c call Function3ee0f call Function3c8e4 ld hl, $4d97 - jp FarBattleTextBox + jp StdBattleTextBox ; 3c300 Function3c300: ; 3c300 @@ -36945,7 +36946,7 @@ Function3c4df: ; 3c4df res 4, [hl] call SetEnemyTurn ld hl, $4c8a - jp FarBattleTextBox + jp StdBattleTextBox .asm_3c518 ld hl, EnemySubStatus5 @@ -36969,7 +36970,7 @@ Function3c4df: ; 3c4df res 4, [hl] call SetPlayerTurn ld hl, $4c8a - jp FarBattleTextBox + jp StdBattleTextBox ; 3c543 @@ -37278,7 +37279,7 @@ Function3c716: ; 3c716 .asm_3c733 push de - call FarBattleTextBox + call StdBattleTextBox pop de xor a ld [$cfca], a @@ -37332,7 +37333,7 @@ Function3c716: ; 3c716 ld [hBGMapMode], a call Function3ccef ld hl, $480e - call FarBattleTextBox + call StdBattleTextBox .asm_3c7a1 call Function3c706 @@ -37348,7 +37349,7 @@ Function3c716: ; 3c716 call GetQuarterMaxHP call Function3cc3f ld hl, $4822 - call FarBattleTextBox + call StdBattleTextBox .asm_3c7c5 call Function3c706 @@ -37364,7 +37365,7 @@ Function3c716: ; 3c716 call GetQuarterMaxHP call Function3cc3f ld hl, $4836 - call FarBattleTextBox + call StdBattleTextBox .asm_3c7e9 ld hl, BattleMonHP @@ -37415,7 +37416,7 @@ Function3c801: ; 3c801 ld [$d265], a push af ld hl, $4864 - call FarBattleTextBox + call StdBattleTextBox pop af ret nz ld a, $0 @@ -37510,7 +37511,7 @@ Function3c874: ; 3c874 ld hl, $4df5 .asm_3c8e1 - jp FarBattleTextBox + jp StdBattleTextBox ; 3c8e4 Function3c8e4: ; 3c8e4 @@ -37563,7 +37564,7 @@ Function3c8eb: ; 3c8eb call Function3c8e4 call Function3ccef ld hl, $4880 - jp FarBattleTextBox + jp StdBattleTextBox ; 3c93c Function3c93c: ; 3c93c @@ -37702,7 +37703,7 @@ Function3c93c: ; 3c93c call Function3ddc8 call Function3c8e4 ld hl, $4899 - jp FarBattleTextBox + jp StdBattleTextBox ; 3ca26 Function3ca26: ; 3ca26 @@ -37733,7 +37734,7 @@ Function3ca26: ; 3ca26 cp $1 ret nz ld hl, $48b6 - call FarBattleTextBox + call StdBattleTextBox ld a, $10 call GetBattleVarPair push af @@ -37784,7 +37785,7 @@ Function3ca8f: ; 3ca8f call UpdateBattleHuds call SetEnemyTurn ld hl, $524b - jp FarBattleTextBox + jp StdBattleTextBox .asm_3cac9 ld a, [EnemyMonStatus] @@ -37810,7 +37811,7 @@ Function3ca8f: ; 3ca8f call UpdateBattleHuds call SetPlayerTurn ld hl, $524b - jp FarBattleTextBox + jp StdBattleTextBox ; 3cafb Function3cafb: ; 3cafb @@ -37847,7 +37848,7 @@ Function3cafb: ; 3cafb .asm_3cb2e ld [hBattleTurn], a ld hl, $48d2 - jp FarBattleTextBox + jp StdBattleTextBox ; 3cb36 @@ -37904,7 +37905,7 @@ FadeLightScreen: ; 3cb80 push hl push de ld hl, BattleText_0x808e7 - call FarBattleTextBox + call StdBattleTextBox pop de pop hl ret @@ -37918,7 +37919,7 @@ FadeReflect: ; 3cb91 ret nz res SCREENS_REFLECT, [hl] ld hl, BattleText_0x80905 - jp FarBattleTextBox + jp StdBattleTextBox ; 3cb9e HandleWeather: ; 3cb9e @@ -37991,7 +37992,7 @@ HandleWeather: ; 3cb9e call Function3cc3f ld hl, BattleText_0x8084d - jp FarBattleTextBox + jp StdBattleTextBox .asm_3cc13 ld hl, .WeatherEndedMessages @@ -38010,7 +38011,7 @@ HandleWeather: ; 3cb9e ld a, [hli] ld h, [hl] ld l, a - jp FarBattleTextBox + jp StdBattleTextBox ; 3cc2d .WeatherMessages @@ -38521,7 +38522,7 @@ Function3cef1: ; 3cef1 ld bc, $050b call ClearBox ld hl, BattleText_0x80a75 - jp FarBattleTextBox + jp StdBattleTextBox ; 3cf14 Function3cf14: ; 3cf14 @@ -38535,7 +38536,7 @@ Function3cf14: ; 3cf14 ld bc, $040a call ClearBox ld hl, BattleText_0x809a8 - jp FarBattleTextBox + jp StdBattleTextBox ; 3cf35 Function3cf35: ; 3cf35 @@ -38620,7 +38621,7 @@ Function3cfa4: ; 3cfa4 call z, Function3d0ea callab Function39939 ld hl, BattleText_0x809da - call FarBattleTextBox + call StdBattleTextBox call Function3d2f1 jr z, .asm_3cff5 ld a, [InLinkBattle] @@ -38729,11 +38730,11 @@ Function3d02b: ; 3d02b ld a, [hli] ld h, [hl] ld l, a - jp FarBattleTextBox + jp StdBattleTextBox .asm_3d07b ld hl, BattleText_0x809be - jp FarBattleTextBox + jp StdBattleTextBox ; 3d081 Function3d081: ; 3d081 @@ -39013,7 +39014,7 @@ Function3d1f8: ; 3d1f8 dec a ret nz ld hl, BattleText_0x80a83 - call FarBattleTextBox + call StdBattleTextBox .asm_3d20a ld bc, $0107 call Function1dd2 @@ -39188,7 +39189,7 @@ Function3d34f: ; 3d34f cp [hl] jr nz, .asm_3d360 ld hl, BattleText_0x80c0d - call FarBattleTextBox + call StdBattleTextBox scf ret @@ -39309,7 +39310,7 @@ LostBattle: ; 3d38e jr z, .asm_3d417 .asm_3d412 - call FarBattleTextBox + call StdBattleTextBox .end scf @@ -39827,7 +39828,7 @@ Function3d74b: ; 3d74b push af callab Function39939 ld hl, BattleText_0x80aca - call FarBattleTextBox + call StdBattleTextBox ld bc, $0107 call Function1dd2 ld a, [$cfa9] @@ -39878,7 +39879,7 @@ Function3d7a0: ; 3d7a0 Function3d7b8: ; 3d7b8 callab Function39939 ld hl, BattleText_0x80af8 - call FarBattleTextBox + call StdBattleTextBox jp WaitBGMap ; 3d7c7 @@ -40009,7 +40010,7 @@ Function3d887: ; 3d887 ld hl, BattleText_0x80b0b .asm_3d8ae - call FarBattleTextBox + call StdBattleTextBox .asm_3d8b1 xor a @@ -40063,7 +40064,7 @@ Function3d8b3: ; 3d8b3 call SetPlayerTurn call GetItemName ld hl, BattleText_0x80b89 - call FarBattleTextBox + call StdBattleTextBox jp .asm_3d9a2 .asm_3d916 @@ -40140,7 +40141,7 @@ Function3d8b3: ; 3d8b3 ld hl, BattleText_0x80b49 .asm_3d995 - call FarBattleTextBox + call StdBattleTextBox ld a, $1 ld [$d266], a call Function309d @@ -40183,7 +40184,7 @@ Function3d8b3: ; 3d8b3 pop de call WaitSFX ld hl, BattleText_0x80b77 - call FarBattleTextBox + call StdBattleTextBox call WaitSFX call Function309d scf @@ -40195,7 +40196,7 @@ Function3d8b3: ; 3d8b3 bit 4, [hl] jr nz, .asm_3da05 ld hl, BattleText_0x81863 - call FarBattleTextBox + call StdBattleTextBox .asm_3da05 call WaitSFX @@ -40488,7 +40489,7 @@ Function3dc23: ; 3dc23 ret z push bc ld hl, BattleText_0x80bae - call FarBattleTextBox + call StdBattleTextBox call GetEighthMaxHP call Function3cc39 pop hl @@ -40565,7 +40566,7 @@ Function3dc5b: ; 3dc5b ld hl, BattleText_0x809a8 .asm_3dcdf - call FarBattleTextBox + call StdBattleTextBox scf ret @@ -40701,7 +40702,7 @@ Function3dd2f: ; 3dd2f ld a, $9 rst FarCall ld hl, RecoveredUsingText - jp FarBattleTextBox + jp StdBattleTextBox ; 3ddc8 @@ -40812,7 +40813,7 @@ Function3de51: ; 3de51 call GetItemName call Function3ddc8 ld hl, BattleText_0x80dab - call FarBattleTextBox + call StdBattleTextBox ld a, [hBattleTurn] and a jr nz, .asm_3de90 @@ -40892,7 +40893,7 @@ Function3deb1: ; 3deb1 ld [de], a call GetItemName ld hl, BattleText_0x80bde - call FarBattleTextBox + call StdBattleTextBox callab BattleCommand8c ret @@ -41328,7 +41329,7 @@ Function3e19b: ; 3e19b bit 4, [hl] jr nz, .asm_3e1c5 ld hl, $5863 - call FarBattleTextBox + call StdBattleTextBox ld c, $3c call DelayFrames @@ -41391,7 +41392,7 @@ Function3e1c7: ; 3e1c7 Function3e22b: ; 3e22b ld hl, BattleText_0x80bf3 - call FarBattleTextBox + call StdBattleTextBox jp Function3e139 ; 3e234 @@ -41546,7 +41547,7 @@ Function3e358: ; 3e358 cp d jr nz, .asm_3e36b ld hl, BattleText_0x80c0d - call FarBattleTextBox + call StdBattleTextBox jp $6299 .asm_3e36b @@ -41559,7 +41560,7 @@ Function3e358: ; 3e358 .asm_3e378 ld hl, BattleText_0x80c22 - call FarBattleTextBox + call StdBattleTextBox jp $6299 .asm_3e381 @@ -41919,7 +41920,7 @@ Function3e4bc: ; 3e4bc ld hl, Function3cc39 .asm_3e613 - call FarBattleTextBox + call StdBattleTextBox call Function30b4 jp Function3e4bc ; 3e61c @@ -42168,7 +42169,7 @@ Function3e786: ; 3e786 .asm_3e7b4 ld hl, BattleText_0x80c72 - call FarBattleTextBox + call StdBattleTextBox ld c, $3c call DelayFrames xor a @@ -43811,7 +43812,7 @@ Function3ee3b: ; 3ee3b call StartSFX call WaitSFX ld hl, BattleText_0x80c9c - call FarBattleTextBox + call StdBattleTextBox call Function309d .asm_3f057 @@ -44064,7 +44065,7 @@ Function3f136: ; 3f136 rst FarCall call WaitSFX ld hl, BattleText_0x80c9c - call FarBattleTextBox + call StdBattleTextBox pop de inc e ld b, $0 @@ -44353,7 +44354,7 @@ Function3f360: ; 3f360 push hl call Function30b4 pop hl - jp FarBattleTextBox + jp StdBattleTextBox ; 3f390 @@ -44912,7 +44913,7 @@ Function3f71d: ; 3f71d ld de, $d850 call Function3d0be ld hl, BattleText_0x80730 - call FarBattleTextBox + call StdBattleTextBox ld a, [$cfc0] bit 0, a ret z @@ -45752,7 +45753,7 @@ BattleStartMessage: ; 3fc8b ld hl, $4000 rst FarCall pop hl - call FarBattleTextBox + call StdBattleTextBox call Function3f830 ret nz @@ -54111,6 +54112,7 @@ INCLUDE "engine/engine_flags.asm" INCBIN "baserom.gbc", $80648, $80730-$80648 +BattleText: INCLUDE "text/battle.asm" INCBIN "baserom.gbc", $818ac, $81fe3-$818ac @@ -68010,7 +68012,7 @@ Function100bc2: ; 100bc2 ld hl, $4c39 .asm_100c6b - call FarBattleTextBox + call StdBattleTextBox call Function30b4 jp Function100bc2 ; 100c74