diff options
Diffstat (limited to 'event')
42 files changed, 1551 insertions, 489 deletions
diff --git a/event/basement_key.asm b/event/basement_key.asm index 8fa47df5f..b15288d09 100755 --- a/event/basement_key.asm +++ b/event/basement_key.asm @@ -1,11 +1,11 @@ _BasementKey: ; 507b4 ; Are we even in the right map to use this? ld a, [MapGroup] - cp GROUP_WAREHOUSE_ENTRANCE + cp GROUP_GOLDENROD_UNDERGROUND jr nz, .nope ld a, [MapNumber] - cp MAP_WAREHOUSE_ENTRANCE + cp MAP_GOLDENROD_UNDERGROUND jr nz, .nope ; Are we on the tile in front of the door? call GetFacingTileCoord diff --git a/event/buena.asm b/event/buena.asm index 4802943f9..1227593eb 100644 --- a/event/buena.asm +++ b/event/buena.asm @@ -5,14 +5,14 @@ SpecialBuenasPassword: ; 8af6b call CopyMenuDataHeader ld a, [wBuenasPassword] ld c, a - callba GetBuenasPassword + farcall GetBuenasPassword ld a, [wMenuBorderLeftCoord] add c add $2 ld [wMenuBorderRightCoord], a call PushWindow call DoNthMenu ; menu - callba Buena_ExitMenu + farcall Buena_ExitMenu ld b, $0 ld a, [MenuSelection] ld c, a @@ -58,7 +58,7 @@ SpecialBuenasPassword: ; 8af6b ld a, [MenuSelection] add c ld c, a - callba GetBuenasPassword + farcall GetBuenasPassword pop hl call PlaceString ret @@ -288,9 +288,15 @@ Buena_PrizeMenu: ; 8b0e2 dba .prizepoints ; 8b129 +NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItemsEnd - BuenaPrizeItems) / 2) + .indices ; 8b129 - db 9 - db 1, 2, 3, 4, 5, 6, 7, 8, 9 + db NUM_BUENA_PRIZES +x = 1 +rept NUM_BUENA_PRIZES + db x +x = x + 1 +endr db -1 ; 8b134 @@ -319,7 +325,7 @@ Buena_PrizeMenu: ; 8b0e2 Buena_getprize: ; 8b154 dec a - ld hl, .prizes + ld hl, BuenaPrizeItems ld b, 0 ld c, a add hl, bc @@ -327,14 +333,4 @@ Buena_getprize: ; 8b154 ret ; 8b15e -.prizes ; 8b15e - db ULTRA_BALL, 2 - db FULL_RESTORE, 2 - db NUGGET, 3 - db RARE_CANDY, 3 - db PROTEIN, 5 - db IRON, 5 - db CARBOS, 5 - db CALCIUM, 5 - db HP_UP, 5 -; 8b170 +INCLUDE "data/items/buena_prizes.asm" diff --git a/event/buena_menu.asm b/event/buena_menu.asm new file mode 100644 index 000000000..b453da783 --- /dev/null +++ b/event/buena_menu.asm @@ -0,0 +1,58 @@ +AskRememberPassword: ; 4ae12 + call .DoMenu + ld a, $0 + jr c, .okay + ld a, $1 + +.okay + ld [ScriptVar], a + ret + +.DoMenu: ; 4ae1f + lb bc, 14, 7 + push bc + ld hl, YesNoMenuDataHeader + call CopyMenuDataHeader + pop bc + ld a, b + ld [wMenuBorderLeftCoord], a + add $5 + ld [wMenuBorderRightCoord], a + ld a, c + ld [wMenuBorderTopCoord], a + add $4 + ld [wMenuBorderBottomCoord], a + call PushWindow + call VerticalMenu + push af + ld c, 15 + call DelayFrames + call Buena_ExitMenu + pop af + jr c, .refused + ld a, [wMenuCursorY] + cp $2 + jr z, .refused + and a + ret + +.refused + ld a, $2 + ld [wMenuCursorY], a + scf + ret + +Buena_ExitMenu: ; 4ae5e + ld a, [hOAMUpdate] + push af + call ExitMenu + call UpdateSprites + xor a + ld [hOAMUpdate], a + call DelayFrame + ld a, $1 + ld [hOAMUpdate], a + call ApplyTilemap + pop af + ld [hOAMUpdate], a + ret diff --git a/event/bug_contest/caught_mon.asm b/event/bug_contest/caught_mon.asm new file mode 100644 index 000000000..5d423f466 --- /dev/null +++ b/event/bug_contest/caught_mon.asm @@ -0,0 +1,38 @@ +BugContest_SetCaughtContestMon: ; e6ce + ld a, [wContestMon] + and a + jr z, .firstcatch + ld [wd265], a + farcall DisplayAlreadyCaughtText + farcall DisplayCaughtContestMonStats + lb bc, 14, 7 + call PlaceYesNoBox + ret c + +.firstcatch + call .generatestats + ld a, [TempEnemyMonSpecies] + ld [wd265], a + call GetPokemonName + ld hl, .caughttext + call PrintText + ret + +.generatestats ; e6fd + ld a, [TempEnemyMonSpecies] + ld [CurSpecies], a + ld [CurPartySpecies], a + call GetBaseData + xor a + ld bc, PARTYMON_STRUCT_LENGTH + ld hl, wContestMon + call ByteFill + xor a + ld [MonType], a + ld hl, wContestMon + jp GeneratePartyMonStats + +.caughttext ; 0xe71d + ; Caught @ ! + text_jump UnknownText_0x1c10c0 + db "@" diff --git a/event/bug_contest/contest.asm b/event/bug_contest/contest.asm new file mode 100644 index 000000000..ba561abf2 --- /dev/null +++ b/event/bug_contest/contest.asm @@ -0,0 +1,43 @@ +Special_GiveParkBalls: ; 135db + xor a + ld [wContestMon], a + ld a, 20 + ld [wParkBallsRemaining], a + farcall StartBugContestTimer + ret + +BugCatchingContestBattleScript:: ; 0x135eb + writecode VAR_BATTLETYPE, BATTLETYPE_CONTEST + randomwildmon + startbattle + reloadmapafterbattle + copybytetovar wParkBallsRemaining + iffalse BugCatchingContestOutOfBallsScript + end + +BugCatchingContestOverScript:: ; 0x135f8 + playsound SFX_ELEVATOR_END + opentext + writetext BugCatchingContestText_BeeepTimesUp + waitbutton + jump BugCatchingContestReturnToGateScript + +BugCatchingContestOutOfBallsScript: ; 0x13603 + playsound SFX_ELEVATOR_END + opentext + writetext BugCatchingContestText_ContestIsOver + waitbutton + +BugCatchingContestReturnToGateScript: ; 0x1360b + closetext + jumpstd bugcontestresultswarp + +BugCatchingContestText_BeeepTimesUp: ; 0x1360f + ; ANNOUNCER: BEEEP! Time's up! + text_jump UnknownText_0x1bd2ca + db "@" + +BugCatchingContestText_ContestIsOver: ; 0x13614 + ; ANNOUNCER: The Contest is over! + text_jump UnknownText_0x1bd2e7 + db "@" diff --git a/event/bug_contest_2.asm b/event/bug_contest/contest_2.asm index 493c69d0c..493c69d0c 100755 --- a/event/bug_contest_2.asm +++ b/event/bug_contest/contest_2.asm diff --git a/event/bug_contest/display_stats.asm b/event/bug_contest/display_stats.asm new file mode 100644 index 000000000..d6ad3997e --- /dev/null +++ b/event/bug_contest/display_stats.asm @@ -0,0 +1,107 @@ +DisplayCaughtContestMonStats: ; cc000 + call ClearBGPalettes + call ClearTileMap + call ClearSprites + call LoadFontsBattleExtra + + ld hl, Options + ld a, [hl] + push af + set 4, [hl] + + hlcoord 0, 0 + ld b, 4 + ld c, 13 + call TextBox + + hlcoord 0, 6 + ld b, 4 + ld c, 13 + call TextBox + + hlcoord 2, 0 + ld de, .Stock + call PlaceString + + hlcoord 2, 6 + ld de, .This + call PlaceString + + hlcoord 5, 4 + ld de, .Health + call PlaceString + + hlcoord 5, 10 + ld de, .Health + call PlaceString + + ld a, [wContestMon] + ld [wd265], a + call GetPokemonName + ld de, StringBuffer1 + hlcoord 1, 2 + call PlaceString + + ld h, b + ld l, c + ld a, [wContestMonLevel] + ld [TempMonLevel], a + call PrintLevel + + ld de, EnemyMonNick + hlcoord 1, 8 + call PlaceString + + ld h, b + ld l, c + ld a, [EnemyMonLevel] + ld [TempMonLevel], a + call PrintLevel + + hlcoord 11, 4 + ld de, wContestMonMaxHP + lb bc, 2, 3 + call PrintNum + + hlcoord 11, 10 + ld de, EnemyMonMaxHP + call PrintNum + + ld hl, SwitchMonText + call PrintText + + pop af + ld [Options], a + + call WaitBGMap + ld b, SCGB_DIPLOMA + call GetSGBLayout + call SetPalettes + ret + +.Health: + db "HEALTH@" +.Stock: + db " STOCK ", $4a, " @" +.This: + db " THIS ", $4a, " @" + +SwitchMonText: ; cc0c2 + ; Switch #MON? + text_jump UnknownText_0x1c10cf + db "@" + +DisplayAlreadyCaughtText: ; cc0c7 + call GetPokemonName + ld hl, .AlreadyCaughtText + jp PrintText + +.AlreadyCaughtText: ; 0xcc0d0 + ; You already caught a @ . + text_jump UnknownText_0x1c10dd + db "@" + +Predef2F: +Predef38: +Predef39: ; cc0d5 + ret diff --git a/event/bug_contest_judging.asm b/event/bug_contest/judging.asm index 0d400bb39..901ae88fa 100755 --- a/event/bug_contest_judging.asm +++ b/event/bug_contest/judging.asm @@ -1,22 +1,22 @@ _BugContestJudging: ; 1369d call ContestScore - callba TrainerRankings_BugContestScore + farcall TrainerRankings_BugContestScore call BugContest_JudgeContestants - ld a, [wBugContestThirdPlacePersonID] + ld a, [wBugContestThirdPlaceWinnerID] call LoadContestantName ld a, [wBugContestThirdPlaceMon] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, BugContest_ThirdPlaceText call PrintText - ld a, [wBugContestSecondPlacePersonID] + ld a, [wBugContestSecondPlaceWinnerID] call LoadContestantName ld a, [wBugContestSecondPlaceMon] ld [wNamedObjectIndexBuffer], a call GetPokemonName ld hl, BugContest_SecondPlaceText call PrintText - ld a, [wBugContestFirstPlacePersonID] + ld a, [wBugContestFirstPlaceWinnerID] call LoadContestantName ld a, [wBugContestFirstPlaceMon] ld [wNamedObjectIndexBuffer], a @@ -97,7 +97,7 @@ LoadContestantName: ; 13730 push hl push bc ; Get the Trainer Class name and copy it into wBugContestWinnerName. - callab GetTrainerClassName + callfar GetTrainerClassName ld hl, StringBuffer1 ld de, wBugContestWinnerName ld bc, TRAINER_CLASS_NAME_LENGTH @@ -120,7 +120,7 @@ LoadContestantName: ; 13730 ; Get the name of the trainer with class c and ID b. ld a, [hl] ld b, a - callab GetTrainerName + callfar GetTrainerName ; Append the name to wBugContestWinnerName. ld hl, StringBuffer1 pop de @@ -134,83 +134,13 @@ LoadContestantName: ; 13730 jp CopyBytes ; 13783 -BugContestantPointers: ; 13783 - dw BugContestant_BugCatcherDon ; This reverts back to the player - dw BugContestant_BugCatcherDon - dw BugContestant_BugCatcherEd - dw BugContestant_CooltrainerMNick - dw BugContestant_PokefanMWilliam - dw BugContestant_BugCatcherBenny - dw BugContestant_CamperBarry - dw BugContestant_PicnickerCindy - dw BugContestant_BugCatcherJosh - dw BugContestant_YoungsterSamuel - dw BugContestant_SchoolboyKipp -; 13799 - -BugContestant_BugCatcherDon: - db BUG_CATCHER, DON - dbw KAKUNA, 300 - dbw METAPOD, 285 - dbw CATERPIE, 226 - -BugContestant_BugCatcherEd: - db BUG_CATCHER, ED - dbw BUTTERFREE, 286 - dbw BUTTERFREE, 251 - dbw CATERPIE, 237 - -BugContestant_CooltrainerMNick: - db COOLTRAINERM, NICK - dbw SCYTHER, 357 - dbw BUTTERFREE, 349 - dbw PINSIR, 368 - -BugContestant_PokefanMWilliam: - db POKEFANM, WILLIAM - dbw PINSIR, 332 - dbw BUTTERFREE, 324 - dbw VENONAT, 321 - -BugContestant_BugCatcherBenny: - db BUG_CATCHER, BUG_CATCHER_BENNY - dbw BUTTERFREE, 318 - dbw WEEDLE, 295 - dbw CATERPIE, 285 - -BugContestant_CamperBarry: - db CAMPER, BARRY - dbw PINSIR, 366 - dbw VENONAT, 329 - dbw KAKUNA, 314 - -BugContestant_PicnickerCindy: - db PICNICKER, CINDY - dbw BUTTERFREE, 341 - dbw METAPOD, 301 - dbw CATERPIE, 264 - -BugContestant_BugCatcherJosh: - db BUG_CATCHER, JOSH - dbw SCYTHER, 326 - dbw BUTTERFREE, 292 - dbw METAPOD, 282 - -BugContestant_YoungsterSamuel: - db YOUNGSTER, SAMUEL - dbw WEEDLE, 270 - dbw PINSIR, 282 - dbw CATERPIE, 251 - -BugContestant_SchoolboyKipp: - db SCHOOLBOY, KIPP - dbw VENONAT, 267 - dbw PARAS, 254 - dbw KAKUNA, 259 + +INCLUDE "data/bug_contest_winners.asm" ; 13807 + BugContest_GetPlayersResult: ; 13807 - ld hl, wBugContestThirdPlacePersonID + ld hl, wBugContestThirdPlaceWinnerID ld de, -4 ld b, 3 .loop @@ -228,7 +158,7 @@ BugContest_GetPlayersResult: ; 13807 BugContest_JudgeContestants: ; 13819 call ClearContestResults call ComputeAIContestantScores - ld hl, wBugContestTempPersonID + ld hl, wBugContestTempWinnerID ld a, 1 ; Player ld [hli], a ld a, [wContestMon] @@ -258,15 +188,15 @@ DetermineContestWinners: ; 1383e ld c, 2 call StringCmp jr c, .not_first_place - ld hl, wBugContestSecondPlacePersonID - ld de, wBugContestThirdPlacePersonID + ld hl, wBugContestSecondPlaceWinnerID + ld de, wBugContestThirdPlaceWinnerID ld bc, 4 call CopyBytes - ld hl, wBugContestFirstPlacePersonID - ld de, wBugContestSecondPlacePersonID + ld hl, wBugContestFirstPlaceWinnerID + ld de, wBugContestSecondPlaceWinnerID ld bc, 4 call CopyBytes - ld hl, wBugContestFirstPlacePersonID + ld hl, wBugContestFirstPlaceWinnerID call CopyTempContestant jr .done @@ -276,11 +206,11 @@ DetermineContestWinners: ; 1383e ld c, 2 call StringCmp jr c, .not_second_place - ld hl, wBugContestSecondPlacePersonID - ld de, wBugContestThirdPlacePersonID + ld hl, wBugContestSecondPlaceWinnerID + ld de, wBugContestThirdPlaceWinnerID ld bc, 4 call CopyBytes - ld hl, wBugContestSecondPlacePersonID + ld hl, wBugContestSecondPlaceWinnerID call CopyTempContestant jr .done @@ -290,7 +220,7 @@ DetermineContestWinners: ; 1383e ld c, 2 call StringCmp jr c, .done - ld hl, wBugContestThirdPlacePersonID + ld hl, wBugContestThirdPlaceWinnerID call CopyTempContestant .done @@ -299,7 +229,7 @@ DetermineContestWinners: ; 1383e CopyTempContestant: ; 138a0 ; Could've just called CopyBytes. - ld de, wBugContestTempPersonID + ld de, wBugContestTempWinnerID rept 3 ld a, [de] inc de @@ -321,7 +251,7 @@ ComputeAIContestantScores: ; 138b0 ld a, e inc a inc a - ld [wBugContestTempPersonID], a + ld [wBugContestTempWinnerID], a dec a ld c, a ld b, 0 diff --git a/event/catch_tutorial.asm b/event/catch_tutorial.asm new file mode 100644 index 000000000..b9352ccd6 --- /dev/null +++ b/event/catch_tutorial.asm @@ -0,0 +1,81 @@ +CatchTutorial:: ; 4e554 + ld a, [BattleType] + dec a + ld c, a + ld hl, .dw + ld b, 0 + add hl, bc + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.dw ; 4e564 (13:6564) + dw .DudeTutorial + dw .DudeTutorial + dw .DudeTutorial + +.DudeTutorial: ; 4e56a (13:656a) +; Back up your name to your Mom's name. + ld hl, PlayerName + ld de, MomsName + ld bc, NAME_LENGTH + call CopyBytes +; Copy Dude's name to your name + ld hl, .Dude + ld de, PlayerName + ld bc, NAME_LENGTH + call CopyBytes + + call .LoadDudeData + + xor a + ld [hJoyDown], a + ld [hJoyPressed], a + ld a, [Options] + push af + and $f8 + add $3 + ld [Options], a + ld hl, .AutoInput + ld a, BANK(.AutoInput) + call StartAutoInput + callfar StartBattle + call StopAutoInput + pop af + + ld [Options], a + ld hl, MomsName + ld de, PlayerName + ld bc, NAME_LENGTH + call CopyBytes + ret + +.LoadDudeData: ; 4e5b7 (13:65b7) + ld hl, wDudeNumItems + ld [hl], 1 + inc hl + ld [hl], POTION + inc hl + ld [hl], 1 + inc hl + ld [hl], -1 + ld hl, wDudeNumKeyItems + ld [hl], 0 + inc hl + ld [hl], -1 + ld hl, wDudeNumBalls + ld a, 1 + ld [hli], a + ld a, POKE_BALL ; 5 + ld [hli], a + ld [hli], a + ld [hl], -1 + ret + +.Dude: ; 4e5da + db "DUDE@" + +.AutoInput: ; 4e5df + db NO_INPUT, $ff ; end diff --git a/event/catch_tutorial_input.asm b/event/catch_tutorial_input.asm new file mode 100644 index 000000000..9d2a03db2 --- /dev/null +++ b/event/catch_tutorial_input.asm @@ -0,0 +1,43 @@ +_DudeAutoInput_A:: ; 1de28a + ld hl, DudeAutoInput_A + jr _DudeAutoInput + +_DudeAutoInput_RightA: ; 1de28f + ld hl, DudeAutoInput_RightA + jr _DudeAutoInput + +_DudeAutoInput_DownA: ; 1de294 + ld hl, DudeAutoInput_DownA + jr _DudeAutoInput + +_DudeAutoInput: ; 1de299 + ld a, BANK(DudeAutoInputs) + call StartAutoInput + ret + +DudeAutoInputs: + +DudeAutoInput_A: ; 1de29f + db NO_INPUT, $50 + db A_BUTTON, $00 + db NO_INPUT, $ff ; end + +DudeAutoInput_RightA: ; 1de2a5 + db NO_INPUT, $08 + db D_RIGHT, $00 + db NO_INPUT, $08 + db A_BUTTON, $00 + db NO_INPUT, $ff ; end + +DudeAutoInput_DownA: ; 1de2af + db NO_INPUT, $fe + db NO_INPUT, $fe + db NO_INPUT, $fe + db NO_INPUT, $fe + db D_DOWN, $00 + db NO_INPUT, $fe + db NO_INPUT, $fe + db NO_INPUT, $fe + db NO_INPUT, $fe + db A_BUTTON, $00 + db NO_INPUT, $ff ; end diff --git a/event/celebi.asm b/event/celebi.asm index 7c8646ec7..b7bf95145 100755 --- a/event/celebi.asm +++ b/event/celebi.asm @@ -6,14 +6,14 @@ Special_CelebiShrineEvent: ; 4989a ld [VramState], a call LoadCelebiGFX depixel 0, 10, 7, 0 - ld a, SPRITE_ANIM_INDEX_2C + ld a, SPRITE_ANIM_INDEX_CELEBI call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc ld [hl], $84 ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID add hl, bc - ld [hl], SPRITE_ANIM_SEQ_1F + ld [hl], SPRITE_ANIM_SEQ_CELEBI ld hl, SPRITEANIMSTRUCT_0F add hl, bc ld a, $80 @@ -31,7 +31,7 @@ Special_CelebiShrineEvent: ; 4989a push de ld a, $90 ld [wCurrSpriteOAMAddr], a - callba DoNextFrameForAllSprites + farcall DoNextFrameForAllSprites call CelebiEvent_CountDown ld c, 2 call DelayFrames @@ -70,7 +70,7 @@ Special_CelebiShrineEvent: ; 4989a ; 49912 LoadCelebiGFX: ; 49912 - callba ClearSpriteAnims + farcall ClearSpriteAnims ld de, SpecialCelebiLeafGFX ld hl, VTiles1 lb bc, BANK(SpecialCelebiLeafGFX), 4 @@ -124,12 +124,13 @@ CelebiEvent_SpawnLeaf: ; 49944 ; 49962 SpecialCelebiLeafGFX: ; 49962 -INCBIN "gfx/special/celebi/leaf.2bpp" +INCBIN "gfx/overworld/cut_grass.2bpp" + SpecialCelebiGFX: ; 499a2 -INCBIN "gfx/special/celebi/1.2bpp" -INCBIN "gfx/special/celebi/2.2bpp" -INCBIN "gfx/special/celebi/3.2bpp" -INCBIN "gfx/special/celebi/4.2bpp" +INCBIN "gfx/overworld/celebi/1.2bpp" +INCBIN "gfx/overworld/celebi/2.2bpp" +INCBIN "gfx/overworld/celebi/3.2bpp" +INCBIN "gfx/overworld/celebi/4.2bpp" UpdateCelebiPosition: ; 49aa2 (12:5aa2) diff --git a/event/daycare.asm b/event/daycare.asm index b521deeff..6395a40fb 100755 --- a/event/daycare.asm +++ b/event/daycare.asm @@ -21,31 +21,31 @@ const DAYCARETEXT_13 Special_DayCareMan: ; 166d6 - ld hl, wDaycareMan + ld hl, wDayCareMan bit 0, [hl] jr nz, .AskWithdrawMon - ld hl, wDaycareMan + ld hl, wDayCareMan ld a, DAYCARETEXT_MAN_INTRO call DayCareManIntroText jr c, .cancel call DayCareAskDepositPokemon jr c, .print_text - callba DepositMonWithDaycareMan - ld hl, wDaycareMan + farcall DepositMonWithDayCareMan + ld hl, wDayCareMan set 0, [hl] call DayCare_DepositPokemonText call DayCare_InitBreeding ret .AskWithdrawMon: - callba GetBreedMon1LevelGrowth + farcall GetBreedMon1LevelGrowth ld hl, wBreedMon1Nick call GetPriceToRetrieveBreedmon call DayCare_AskWithdrawBreedMon jr c, .print_text - callba RetrievePokemonFromDaycareMan + farcall RetrievePokemonFromDayCareMan call DayCare_TakeMoney_PlayCry - ld hl, wDaycareMan + ld hl, wDayCareMan res 0, [hl] res 5, [hl] jr .cancel @@ -60,33 +60,33 @@ Special_DayCareMan: ; 166d6 ; 1672a Special_DayCareLady: ; 1672a - ld hl, wDaycareLady + ld hl, wDayCareLady bit 0, [hl] jr nz, .AskWithdrawMon - ld hl, wDaycareLady + ld hl, wDayCareLady ld a, DAYCARETEXT_LADY_INTRO call DayCareLadyIntroText jr c, .cancel call DayCareAskDepositPokemon jr c, .print_text - callba DepositMonWithDaycareLady - ld hl, wDaycareLady + farcall DepositMonWithDayCareLady + ld hl, wDayCareLady set 0, [hl] call DayCare_DepositPokemonText call DayCare_InitBreeding ret .AskWithdrawMon: - callba GetBreedMon2LevelGrowth + farcall GetBreedMon2LevelGrowth ld hl, wBreedMon2Nick call GetPriceToRetrieveBreedmon call DayCare_AskWithdrawBreedMon jr c, .print_text - callba RetrievePokemonFromDaycareLady + farcall RetrievePokemonFromDayCareLady call DayCare_TakeMoney_PlayCry - ld hl, wDaycareLady + ld hl, wDayCareLady res 0, [hl] - ld hl, wDaycareMan + ld hl, wDayCareMan res 5, [hl] jr .cancel @@ -124,19 +124,19 @@ DayCareAskDepositPokemon: ; 16798 ld a, DAYCARETEXT_WHICH_ONE call PrintDayCareText ld b, PARTYMENUACTION_GIVE_MON - callba SelectTradeOrDaycareMon + farcall SelectTradeOrDayCareMon jr c, .Declined ld a, [CurPartySpecies] cp EGG jr z, .Egg - callba CheckCurPartyMonFainted + farcall CheckCurPartyMonFainted jr c, .OutOfUsableMons ld hl, PartyMon1Item ld bc, PARTYMON_STRUCT_LENGTH ld a, [CurPartyMon] call AddNTimes ld d, [hl] - callba ItemIsMail + farcall ItemIsMail jr c, .HoldingMail ld hl, PartyMonNicknames ld a, [CurPartyMon] @@ -209,7 +209,7 @@ DayCare_AskWithdrawBreedMon: ; 16807 .check_money ld de, Money ld bc, StringBuffer2 + 2 - callba CompareMoney + farcall CompareMoney jr c, .not_enough_money ld a, [PartyCount] cp PARTY_LENGTH @@ -236,7 +236,7 @@ DayCare_AskWithdrawBreedMon: ; 16807 DayCare_TakeMoney_PlayCry: ; 16850 ld bc, StringBuffer2 + 2 ld de, Money - callba TakeMoney + farcall TakeMoney ld a, DAYCARETEXT_WITHDRAW call PrintDayCareText ld a, [CurPartySpecies] @@ -426,7 +426,7 @@ PrintDayCareText: ; 1689b ; 0x16936 Special_DayCareManOutside: ; 16936 - ld hl, wDaycareMan + ld hl, wDayCareMan bit 6, [hl] jr nz, .AskGiveEgg ld hl, .NotYet @@ -448,12 +448,12 @@ Special_DayCareManOutside: ; 16936 cp PARTY_LENGTH jr nc, .PartyFull call DayCare_GiveEgg - ld hl, wDaycareMan + ld hl, wDayCareMan res 6, [hl] call DayCare_InitBreeding ld hl, .GotEggText call PrintText - ld de, SFX_GET_EGG_FROM_DAYCARE_LADY + ld de, SFX_GET_EGG_FROM_DAY_CARE_LADY call PlaySFX ld c, 120 call DelayFrames @@ -590,19 +590,19 @@ DayCare_GetCurrentPartyMember: ; 16a31 ; 16a3b DayCare_InitBreeding: ; 16a3b - ld a, [wDaycareLady] + ld a, [wDayCareLady] bit 0, a ret z - ld a, [wDaycareMan] + ld a, [wDayCareMan] bit 0, a ret z - callab CheckBreedmonCompatibility + callfar CheckBreedmonCompatibility ld a, [wd265] and a ret z inc a ret z - ld hl, wDaycareMan + ld hl, wDayCareMan set 5, [hl] .loop call Random @@ -639,7 +639,7 @@ DayCare_InitBreeding: ; 16a3b cp DITTO ld a, $0 jr z, .LoadWhichBreedmonIsTheMother - callba GetGender + farcall GetGender ld a, $0 jr z, .LoadWhichBreedmonIsTheMother inc a @@ -653,8 +653,8 @@ DayCare_InitBreeding: ; 16a3b .GotMother: ld [CurPartySpecies], a - callab GetPreEvolution - callab GetPreEvolution + callfar GetPreEvolution + callfar GetPreEvolution ld a, EGG_LEVEL ld [CurPartyLevel], a @@ -685,7 +685,7 @@ DayCare_InitBreeding: ; 16a3b xor a ld [Buffer1], a predef FillMoves - callba InitEggMoves + farcall InitEggMoves ld hl, wEggMonID ld a, [PlayerID] ld [hli], a @@ -693,7 +693,7 @@ DayCare_InitBreeding: ; 16a3b ld [hl], a ld a, [CurPartyLevel] ld d, a - callab CalcExpAtLevel + callfar CalcExpAtLevel ld hl, wEggMonExp ld a, [hMultiplicand] ld [hli], a @@ -726,7 +726,7 @@ DayCare_InitBreeding: ; 16a3b ld a, TEMPMON ld [MonType], a push hl - callba GetGender + farcall GetGender pop hl ld de, wBreedMon1DVs ld bc, wBreedMon2DVs diff --git a/event/elevator.asm b/event/elevator.asm index 7626989b3..9170b642d 100755 --- a/event/elevator.asm +++ b/event/elevator.asm @@ -21,9 +21,9 @@ Elevator:: ; 1342d ld a, b ld [wElevatorPointerBank], a ld a, e - ld [wElevatorPointerLo], a + ld [wElevatorPointer], a ld a, d - ld [wElevatorPointerHi], a + ld [wElevatorPointer + 1], a call .LoadFloors ret ; 1345a @@ -31,7 +31,7 @@ Elevator:: ; 1342d .LoadFloors: ; 1345a ld de, CurElevator ld bc, 4 - ld hl, wElevatorPointerLo + ld hl, wElevatorPointer ld a, [hli] ld h, [hl] ld l, a @@ -52,7 +52,7 @@ Elevator:: ; 1342d ; 1347d .FindCurrentFloor: ; 1347d - ld hl, wElevatorPointerLo + ld hl, wElevatorPointer ld a, [hli] ld h, [hl] ld l, a @@ -102,7 +102,7 @@ Elevator:: ; 1342d Elevator_GoToFloor: ; 134c0 push af - ld hl, wElevatorPointerLo + ld hl, wElevatorPointer ld a, [hli] ld h, [hl] ld l, a diff --git a/event/field_moves.asm b/event/field_moves.asm index 82bc6d3f8..1c21f4995 100755 --- a/event/field_moves.asm +++ b/event/field_moves.asm @@ -7,20 +7,20 @@ PlayWhirlpoolSound: ; 8c7d4 ; 8c7e1 BlindingFlash: ; 8c7e1 - callba FadeOutPalettes + farcall FadeOutPalettes ld hl, StatusFlags set 2, [hl] ; Flash - callba ReplaceTimeOfDayPals - callba UpdateTimeOfDayPal + farcall ReplaceTimeOfDayPals + farcall UpdateTimeOfDayPal ld b, SCGB_MAPPALS call GetSGBLayout - callba LoadOW_BGPal7 - callba FadeInPalettes + farcall LoadOW_BGPal7 + farcall FadeInPalettes ret ; 8c80a ShakeHeadbuttTree: ; 8c80a - callba ClearSpriteAnims + farcall ClearSpriteAnims ld de, CutGrassGFX ld hl, VTiles1 lb bc, BANK(CutGrassGFX), 4 @@ -30,14 +30,14 @@ ShakeHeadbuttTree: ; 8c80a lb bc, BANK(HeadbuttTreeGFX), 8 call Request2bpp call Cut_Headbutt_GetPixelFacing - ld a, SPRITE_ANIM_INDEX_1B + ld a, SPRITE_ANIM_INDEX_HEADBUTT call _InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc ld [hl], $84 ld a, 36 * 4 ld [wCurrSpriteOAMAddr], a - callba DoNextFrameForAllSprites + farcall DoNextFrameForAllSprites call HideHeadbuttTree ld a, $20 ld [wcf64], a @@ -52,7 +52,7 @@ ShakeHeadbuttTree: ; 8c80a dec [hl] ld a, 36 * 4 ld [wCurrSpriteOAMAddr], a - callba DoNextFrameForAllSprites + farcall DoNextFrameForAllSprites call DelayFrame jr .loop @@ -61,7 +61,7 @@ ShakeHeadbuttTree: ; 8c80a call WaitBGMap xor a ld [hBGMapMode], a - callba ClearSpriteAnims + farcall ClearSpriteAnims ld hl, Sprites + 36 * 4 ld bc, SpritesEnd - (Sprites + 36 * 4) xor a @@ -129,7 +129,7 @@ OWCutAnimation: ; 8c940 jr nz, .finish ld a, 36 * 4 ld [wCurrSpriteOAMAddr], a - callab DoNextFrameForAllSprites + callfar DoNextFrameForAllSprites call OWCutJumptable call DelayFrame jr .loop @@ -139,7 +139,7 @@ OWCutAnimation: ; 8c940 ; 8c96d .LoadCutGFX: ; 8c96d - callab ClearSpriteAnims ; pointless to farcall + callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX ld hl, VTiles1 lb bc, BANK(CutGrassGFX), 4 @@ -152,11 +152,11 @@ OWCutAnimation: ; 8c940 ; 8c98c CutTreeGFX: ; c898c -INCBIN "gfx/misc/cut_tree.2bpp" +INCBIN "gfx/overworld/cut_tree.2bpp" ; c89cc CutGrassGFX: ; 8c9cc -INCBIN "gfx/misc/cut_grass.2bpp" +INCBIN "gfx/overworld/cut_grass.2bpp" ; 8ca0c OWCutJumptable: ; 8ca0c @@ -343,7 +343,7 @@ FlyFromAnim: ; 8caed jr nz, .exit ld a, 0 * 4 ld [wCurrSpriteOAMAddr], a - callab DoNextFrameForAllSprites + callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer call DelayFrame jr .loop @@ -381,7 +381,7 @@ FlyToAnim: ; 8cb33 jr nz, .exit ld a, 0 * 4 ld [wCurrSpriteOAMAddr], a - callab DoNextFrameForAllSprites + callfar DoNextFrameForAllSprites call FlyFunction_FrameTimer call DelayFrame jr .loop @@ -411,7 +411,7 @@ FlyToAnim: ; 8cb33 ret FlyFunction_InitGFX: ; 8cb9b (23:4b9b) - callab ClearSpriteAnims + callfar ClearSpriteAnims ld de, CutGrassGFX ld hl, VTiles1 tile $00 lb bc, BANK(CutGrassGFX), 4 @@ -424,7 +424,7 @@ FlyFunction_InitGFX: ; 8cb9b (23:4b9b) ld a, [hl] ld [wd265], a ld e, $84 - callba FlyFunction_GetMonIcon + farcall FlyFunction_GetMonIcon xor a ld [wJumptableIndex], a ret diff --git a/event/halloffame.asm b/event/halloffame.asm index 8d542addb..3fadb233a 100755 --- a/event/halloffame.asm +++ b/event/halloffame.asm @@ -1,3 +1,5 @@ +HALLOFFAME_COLON EQU $63 + HallOfFame:: ; 0x8640e call HallOfFame_FadeOutMusic ld a, [StatusFlags] @@ -12,7 +14,7 @@ HallOfFame:: ; 0x8640e ld hl, StatusFlags set 6, [hl] ; hall of fame - callba HallOfFame_InitSaveIfNeeded + farcall HallOfFame_InitSaveIfNeeded ld hl, wHallOfFameCount ld a, [hl] @@ -20,31 +22,31 @@ HallOfFame:: ; 0x8640e jr nc, .ok inc [hl] .ok - callba SaveGameData + farcall SaveGameData call GetHallOfFameParty - callba AddHallOfFameEntry + farcall AddHallOfFameEntry xor a ld [wGameLogicPaused], a call AnimateHallOfFame pop af ld b, a - callba Credits + farcall Credits ret ; 0x86455 RedCredits:: ; 86455 ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, 10 ld [MusicFade], a - callba FadeOutPalettes + farcall FadeOutPalettes xor a ld [VramState], a ld [hMapAnims], a - callba InitDisplayForRedCredits + farcall InitDisplayForRedCredits ld c, 8 call DelayFrames call DisableSpriteUpdates @@ -52,22 +54,22 @@ RedCredits:: ; 86455 ld [wSpawnAfterChampion], a ld a, [StatusFlags] ld b, a - callba Credits + farcall Credits ret ; 8648e HallOfFame_FadeOutMusic: ; 8648e ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, 10 ld [MusicFade], a - callba FadeOutPalettes + farcall FadeOutPalettes xor a ld [VramState], a ld [hMapAnims], a - callba InitDisplayForHallOfFame + farcall InitDisplayForHallOfFame ld c, 100 jp DelayFrames ; 864b4 @@ -230,7 +232,7 @@ GetHallOfFameParty: ; 8653f AnimateHOFMonEntrance: ; 865b5 push hl call ClearBGPalettes - callba ResetDisplayBetweenHallOfFameMons + farcall ResetDisplayBetweenHallOfFameMons pop hl ld a, [hli] ld [TempMonSpecies], a @@ -248,7 +250,7 @@ AnimateHOFMonEntrance: ; 865b5 ld a, " " call ByteFill ld de, VTiles2 tile $31 - predef GetBackpic + predef GetMonBackpic ld a, $31 ld [hGraphicStartTile], a hlcoord 6, 6 @@ -487,7 +489,7 @@ DisplayHOFMon: ; 86748 hlcoord 1, 13 ld a, "№" ld [hli], a - ld [hl], "·" + ld [hl], "<DOT>" hlcoord 3, 13 ld de, wd265 lb bc, PRINTNUM_LEADINGZEROS | 1, 3 @@ -497,7 +499,7 @@ DisplayHOFMon: ; 86748 call PlaceString ld a, TEMPMON ld [MonType], a - callba GetGender + farcall GetGender ld a, " " jr c, .got_gender ld a, "♂" @@ -531,15 +533,15 @@ DisplayHOFMon: ; 86748 HOF_AnimatePlayerPic: ; 86810 call ClearBGPalettes - ld hl, VTiles2 tile $63 - ld de, FontExtra + 13 tiles + ld hl, VTiles2 tile HALLOFFAME_COLON + ld de, FontExtra + 13 tiles ; "<COLON>" lb bc, BANK(FontExtra), 1 call Request2bpp hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill - callba GetPlayerBackpic + farcall GetPlayerBackpic ld a, $31 ld [hGraphicStartTile], a hlcoord 6, 6 @@ -563,7 +565,7 @@ HOF_AnimatePlayerPic: ; 86810 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill - callba HOF_LoadTrainerFrontpic + farcall HOF_LoadTrainerFrontpic xor a ld [hGraphicStartTile], a hlcoord 12, 5 @@ -604,13 +606,13 @@ HOF_AnimatePlayerPic: ; 86810 ld de, GameTimeHours lb bc, 2, 3 call PrintNum - ld [hl], 99 + ld [hl], HALLOFFAME_COLON inc hl ld de, GameTimeMinutes lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum call WaitBGMap - callba ProfOaksPCRating + farcall ProfOaksPCRating ret ; 868ed diff --git a/event/happiness_egg.asm b/event/happiness_egg.asm index e7eece7c8..0c9b5a4df 100755 --- a/event/happiness_egg.asm +++ b/event/happiness_egg.asm @@ -55,25 +55,25 @@ ChangeHappiness: ; 71c2 push de ld a, [de] - cp 100 + cp HAPPINESS_THRESHOLD_1 ld e, 0 jr c, .ok inc e - cp 200 + cp HAPPINESS_THRESHOLD_2 jr c, .ok inc e .ok dec c ld b, 0 - ld hl, .Actions + ld hl, HappinessChanges add hl, bc add hl, bc add hl, bc ld d, 0 add hl, de ld a, [hl] - cp 100 + cp $64 ; $80? pop de ld a, [de] @@ -102,26 +102,9 @@ ChangeHappiness: ; 71c2 ld [BattleMonHappiness], a ret -.Actions: - db +5, +3, +2 ; Gained a level - db +5, +3, +2 ; Vitamin - db +1, +1, +0 ; X Item - db +3, +2, +1 ; Battled a Gym Leader - db +1, +1, +0 ; Learned a move - db -1, -1, -1 ; Lost to an enemy - db -5, -5, -10 ; Fainted due to poison - db -5, -5, -10 ; Lost to a much stronger enemy - db +1, +1, +1 ; Haircut (Y1) - db +3, +3, +1 ; Haircut (Y2) - db +5, +5, +2 ; Haircut (Y3) - db +1, +1, +1 ; Haircut (O1) - db +3, +3, +1 ; Haircut (O2) - db +10, +10, +4 ; Haircut (O3) - db -5, -5, -10 ; Used Heal Powder or Energypowder (bitter) - db -10, -10, -15 ; Used Energy Root (bitter) - db -15, -15, -20 ; Used Revival Herb (bitter) - db +3, +3, +1 ; Grooming - db +10, +6, +4 ; Gained a level in the place where it was caught + +INCLUDE "data/happiness_changes.asm" + StepHappiness:: ; 725a ; Raise the party's happiness by 1 point every other step cycle. @@ -158,36 +141,36 @@ StepHappiness:: ; 725a jr nz, .loop ret -DaycareStep:: ; 7282 +DayCareStep:: ; 7282 - ld a, [wDaycareMan] + ld a, [wDayCareMan] bit 0, a - jr z, .daycare_lady + jr z, .day_care_lady ld a, [wBreedMon1Level] ; level - cp 100 - jr nc, .daycare_lady + cp MAX_LEVEL + jr nc, .day_care_lady ld hl, wBreedMon1Exp + 2 ; exp inc [hl] - jr nz, .daycare_lady + jr nz, .day_care_lady dec hl inc [hl] - jr nz, .daycare_lady + jr nz, .day_care_lady dec hl inc [hl] ld a, [hl] cp 5242880 / $10000 - jr c, .daycare_lady + jr c, .day_care_lady ld a, 5242880 / $10000 ld [hl], a -.daycare_lady - ld a, [wDaycareLady] +.day_care_lady + ld a, [wDayCareLady] bit 0, a jr z, .check_egg ld a, [wBreedMon2Level] ; level - cp 100 + cp MAX_LEVEL jr nc, .check_egg ld hl, wBreedMon2Exp + 2 ; exp inc [hl] @@ -204,7 +187,7 @@ DaycareStep:: ; 7282 ld [hl], a .check_egg - ld hl, wDaycareMan + ld hl, wDayCareMan bit 5, [hl] ; egg ret z ld hl, wStepsToEgg @@ -213,7 +196,7 @@ DaycareStep:: ; 7282 call Random ld [hl], a - callab CheckBreedmonCompatibility + callfar CheckBreedmonCompatibility ld a, [wd265] cp 230 ld b, -1 + 32 percent @@ -232,7 +215,7 @@ DaycareStep:: ; 7282 call Random cp b ret nc - ld hl, wDaycareMan + ld hl, wDayCareMan res 5, [hl] set 6, [hl] ret diff --git a/event/heal_machine_anim.asm b/event/heal_machine_anim.asm new file mode 100755 index 000000000..4f543c0b3 --- /dev/null +++ b/event/heal_machine_anim.asm @@ -0,0 +1,265 @@ +HealMachineAnim: ; 12324 + ; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon. + ld a, [PartyCount] + and a + ret z + ; The location of the healing machine relative to the player is stored in ScriptVar. + ; 0: Up and left (Pokemon Center) + ; 1: Left (Elm's Lab) + ; 2: Up (Hall of Fame) + ld a, [ScriptVar] + ld [Buffer1], a + ld a, [rOBP1] + ld [Buffer2], a + call .DoJumptableFunctions + ld a, [Buffer2] + call DmgToCgbObjPal1 + ret +; 1233e + +.DoJumptableFunctions: ; 1233e + xor a + ld [Buffer3], a +.jumpable_loop + ld a, [Buffer1] + ld e, a + ld d, 0 + ld hl, .Pointers + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + ld a, [Buffer3] + ld e, a + inc a + ld [Buffer3], a + add hl, de + ld a, [hl] + cp 5 + jr z, .finish + ld hl, .Jumptable + rst JumpTable + jr .jumpable_loop + +.finish + ret +; 12365 + +.Pointers: ; 12365 + dw .Pokecenter + dw .ElmLab + dw .HallOfFame +; 1236b + +.Pokecenter: ; 1236b + db 0, 1, 3, 5 +.ElmLab: ; 1236f + db 0, 1, 3, 5 +.HallOfFame: ; 12373 + db 0, 2, 4, 5 +; 12377 + +.Jumptable: ; 12377 + dw .LoadGFX + dw .PC_LoadBallsOntoMachine + dw .HOF_LoadBallsOntoMachine + dw .PlayHealMusic + dw .HOF_PlaySFX + dw .dummy_5 ; never encountered +; 12383 + +.LoadGFX: ; 12383 + call .LoadPalettes + ld de, .HealMachineGFX + ld hl, VTiles0 tile $7c + lb bc, BANK(.HealMachineGFX), $2 + call Request2bpp + ret +; 12393 + +.PC_LoadBallsOntoMachine: ; 12393 + ld hl, Sprites + $80 + ld de, .PC_ElmsLab_OAM + call .PlaceHealingMachineTile + call .PlaceHealingMachineTile + jr .LoadBallsOntoMachine + +.HOF_LoadBallsOntoMachine: ; 123a1 + ld hl, Sprites + $80 + ld de, .HOF_OAM + +.LoadBallsOntoMachine: ; 123a7 + ld a, [PartyCount] + ld b, a +.party_loop + call .PlaceHealingMachineTile + push de + ld de, SFX_SECOND_PART_OF_ITEMFINDER + call PlaySFX + pop de + ld c, 30 + call DelayFrames + dec b + jr nz, .party_loop + ret +; 123bf + +.PlayHealMusic: ; 123bf + ld de, MUSIC_HEAL + call PlayMusic + jp .FlashPalettes8Times +; 123c8 + +.HOF_PlaySFX: ; 123c8 + ld de, SFX_GAME_FREAK_LOGO_GS + call PlaySFX + call .FlashPalettes8Times + call WaitSFX + ld de, SFX_BOOT_PC + call PlaySFX + ret +; 123db + +.dummy_5 ; 123db + ret +; 123dc + +.PC_ElmsLab_OAM: ; 123dc + dsprite 4, 0, 4, 2, $7c, $16 + dsprite 4, 0, 4, 6, $7c, $16 + dsprite 4, 6, 4, 0, $7d, $16 + dsprite 4, 6, 5, 0, $7d, $36 ; xflip + dsprite 5, 3, 4, 0, $7d, $16 + dsprite 5, 3, 5, 0, $7d, $36 ; xflip + dsprite 6, 0, 4, 0, $7d, $16 + dsprite 6, 0, 5, 0, $7d, $36 ; xflip +; 123fc + +.HealMachineGFX: ; 123fc +INCBIN "gfx/overworld/heal_machine.2bpp" +; 1241c + +.HOF_OAM: ; 1241c + dsprite 7, 4, 10, 1, $7d, $16 + dsprite 7, 4, 10, 6, $7d, $16 + dsprite 7, 3, 9, 5, $7d, $16 + dsprite 7, 3, 11, 2, $7d, $16 + dsprite 7, 1, 9, 1, $7d, $16 + dsprite 7, 1, 11, 5, $7d, $16 +; 12434 + +.LoadPalettes: ; 12434 + call IsCGB + jr nz, .cgb + ld a, %11100000 + ld [rOBP1], a + ret + +.cgb + ld hl, .palettes + ld de, OBPals + 8 * 6 + ld bc, 8 + ld a, $5 + call FarCopyWRAM + ld a, $1 + ld [hCGBPalUpdate], a + ret +; 12451 + +.palettes ; 12451 + RGB 31, 31, 31 + RGB 31, 19, 10 + RGB 31, 07, 01 + RGB 00, 00, 00 +; 12459 + +.FlashPalettes8Times: ; 12459 + ld c, $8 +.palette_loop + push bc + call .FlashPalettes + ld c, 10 + call DelayFrames + pop bc + dec c + jr nz, .palette_loop + ret +; 12469 + +.FlashPalettes: ; 12469 + call IsCGB + jr nz, .go + ld a, [rOBP1] + xor %00101000 + ld [rOBP1], a + ret + +.go + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + + ld hl, OBPals + 8 * 6 + ld a, [hli] + ld e, a + ld a, [hli] + ld d, a + push de + ld c, $3 +.palette_loop_2 + ld a, [hli] + ld e, a + ld a, [hld] + ld d, a + dec hl + ld a, d + ld [hld], a + ld a, e + ld [hli], a + inc hl + inc hl + inc hl + dec c + jr nz, .palette_loop_2 + pop de + dec hl + ld a, d + ld [hld], a + ld a, e + ld [hl], a + + pop af + ld [rSVBK], a + ld a, $1 + ld [hCGBPalUpdate], a + ret +; 124a3 + +.PlaceHealingMachineTile: ; 124a3 + push bc + ld a, [Buffer1] + bcpixel 2, 4 + cp $1 ; ElmsLab + jr z, .okay + bcpixel 0, 0 + +.okay + ld a, [de] + add c + inc de + ld [hli], a + ld a, [de] + add b + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + pop bc + ret +; 124c1 diff --git a/event/itemfinder.asm b/event/itemfinder.asm index 5356a1f86..71aaa5b69 100755 --- a/event/itemfinder.asm +++ b/event/itemfinder.asm @@ -1,5 +1,5 @@ ItemFinder: ; 12580 - callba CheckForHiddenItems + farcall CheckForHiddenItems jr c, .found_something ld hl, .Script_FoundNothing jr .resume diff --git a/event/kurt.asm b/event/kurt.asm index e1fff12c0..9bc06a613 100644 --- a/event/kurt.asm +++ b/event/kurt.asm @@ -57,7 +57,7 @@ Special_SelectApricornForKurt: ; 88018 ; 88055 Kurt_SelectApricorn: ; 88055 - callba FindApricornsInBag + farcall FindApricornsInBag jr c, .nope ld hl, .MenuDataHeader call CopyMenuDataHeader @@ -106,7 +106,7 @@ Kurt_SelectApricorn: ; 88055 ld a, [MenuSelection] and a ret z - callba PlaceMenuItemName + farcall PlaceMenuItemName ret ; 880ab @@ -117,7 +117,7 @@ Kurt_SelectApricorn: ; 88055 ret z ld a, [wItemQuantityChangeBuffer] ld [MenuSelectionQuantity], a - callba PlaceMenuItemQuantity + farcall PlaceMenuItemQuantity ret ; 880c2 @@ -140,7 +140,7 @@ Kurt_SelectQuantity: ; 880c2 call .PlaceApricornName call PlaceApricornQuantity call ApplyTilemap - callba Kurt_SelectQuantity_InterpretJoypad + farcall Kurt_SelectQuantity_InterpretJoypad jr nc, .loop push bc @@ -171,7 +171,7 @@ Kurt_SelectQuantity: ; 880c2 add hl, de ld d, h ld e, l - callba PlaceMenuItemName + farcall PlaceMenuItemName ret ; 88126 diff --git a/event/lucky_number.asm b/event/lucky_number.asm new file mode 100644 index 000000000..4488cfcc9 --- /dev/null +++ b/event/lucky_number.asm @@ -0,0 +1,226 @@ +Special_CheckForLuckyNumberWinners: ; 4d87a + xor a + ld [ScriptVar], a + ld [wFoundMatchingIDInParty], a + ld a, [PartyCount] + and a + ret z + ld d, a + ld hl, PartyMon1ID + ld bc, PartySpecies +.PartyLoop: + ld a, [bc] + inc bc + cp EGG + call nz, .CompareLuckyNumberToMonID + push bc + ld bc, PARTYMON_STRUCT_LENGTH + add hl, bc + pop bc + dec d + jr nz, .PartyLoop + ld a, BANK(sBox) + call GetSRAMBank + ld a, [sBoxCount] + and a + jr z, .SkipOpenBox + ld d, a + ld hl, sBoxMon1ID + ld bc, sBoxSpecies +.OpenBoxLoop: + ld a, [bc] + inc bc + cp EGG + jr z, .SkipOpenBoxMon + call .CompareLuckyNumberToMonID + jr nc, .SkipOpenBoxMon + ld a, 1 + ld [wFoundMatchingIDInParty], a + +.SkipOpenBoxMon: + push bc + ld bc, BOXMON_STRUCT_LENGTH + add hl, bc + pop bc + dec d + jr nz, .OpenBoxLoop + +.SkipOpenBox: + call CloseSRAM + ld c, $0 +.BoxesLoop: + ld a, [wCurBox] + and $f + cp c + jr z, .SkipBox + ld hl, .BoxBankAddresses + ld b, 0 + add hl, bc + add hl, bc + add hl, bc + ld a, [hli] + call GetSRAMBank + ld a, [hli] + ld h, [hl] + ld l, a ; hl now contains the address of the loaded box in SRAM + ld a, [hl] + and a + jr z, .SkipBox ; no mons in this box + push bc + ld b, h + ld c, l + inc bc + ld de, sBoxMon1ID - sBox + add hl, de + ld d, a +.BoxNLoop: + ld a, [bc] + inc bc + cp EGG + jr z, .SkipBoxMon + + call .CompareLuckyNumberToMonID ; sets ScriptVar and CurPartySpecies appropriately + jr nc, .SkipBoxMon + ld a, 1 + ld [wFoundMatchingIDInParty], a + +.SkipBoxMon: + push bc + ld bc, BOXMON_STRUCT_LENGTH + add hl, bc + pop bc + dec d + jr nz, .BoxNLoop + pop bc + +.SkipBox: + inc c + ld a, c + cp NUM_BOXES + jr c, .BoxesLoop + + call CloseSRAM + ld a, [ScriptVar] + and a + ret z ; found nothing + farcall TrainerRankings_LuckyNumberShow + ld a, [wFoundMatchingIDInParty] + and a + push af + ld a, [CurPartySpecies] + ld [wNamedObjectIndexBuffer], a + call GetPokemonName + ld hl, .FoundPartymonText + pop af + jr z, .print + ld hl, .FoundBoxmonText + +.print + jp PrintText + +.CompareLuckyNumberToMonID: ; 4d939 + push bc + push de + push hl + ld d, h + ld e, l + ld hl, Buffer1 + lb bc, PRINTNUM_LEADINGZEROS | 2, 5 + call PrintNum + ld hl, LuckyNumberDigit1Buffer + ld de, wLuckyIDNumber + lb bc, PRINTNUM_LEADINGZEROS | 2, 5 + call PrintNum + ld b, 5 + ld c, 0 + ld hl, LuckyNumberDigit5Buffer + ld de, Buffer5 +.loop + ld a, [de] + cp [hl] + jr nz, .done + dec de + dec hl + inc c + dec b + jr nz, .loop + +.done + pop hl + push hl + ld de, -6 + add hl, de + ld a, [hl] + pop hl + pop de + push af + ld a, c + ld b, 1 + cp 5 + jr z, .okay + ld b, 2 + cp 3 + jr nc, .okay + ld b, 3 + cp 2 + jr nz, .nomatch + +.okay + inc b + ld a, [ScriptVar] + and a + jr z, .bettermatch + cp b + jr c, .nomatch + +.bettermatch + dec b + ld a, b + ld [ScriptVar], a + pop bc + ld a, b + ld [CurPartySpecies], a + pop bc + scf + ret + +.nomatch + pop bc + pop bc + and a + ret + +.BoxBankAddresses: ; 4d99f + dba sBox1 + dba sBox2 + dba sBox3 + dba sBox4 + dba sBox5 + dba sBox6 + dba sBox7 + dba sBox8 + dba sBox9 + dba sBox10 + dba sBox11 + dba sBox12 + dba sBox13 + dba sBox14 + +.FoundPartymonText: ; 0x4d9c9 + ; Congratulations! We have a match with the ID number of @ in your party. + text_jump UnknownText_0x1c1261 + db "@" + +.FoundBoxmonText: ; 0x4d9ce + ; Congratulations! We have a match with the ID number of @ in your PC BOX. + text_jump UnknownText_0x1c12ae + db "@" + +Special_PrintTodaysLuckyNumber: ; 4d9d3 + ld hl, StringBuffer3 + ld de, wLuckyIDNumber + lb bc, PRINTNUM_LEADINGZEROS | 2, 5 + call PrintNum + ld a, "@" + ld [StringBuffer3 + 5], a + ret diff --git a/event/magikarp.asm b/event/magikarp.asm index f926196cd..4dab89816 100644 --- a/event/magikarp.asm +++ b/event/magikarp.asm @@ -5,7 +5,7 @@ Special_CheckMagikarpLength: ; fbb32 ; Returns 0 if the Pokemon you select is not a Magikarp. ; Let's start by selecting a Magikarp. - callba SelectMonFromParty + farcall SelectMonFromParty jr c, .declined ld a, [CurPartySpecies] cp MAGIKARP @@ -28,19 +28,19 @@ Special_CheckMagikarpLength: ; fbb32 ld c, l call CalcMagikarpLength call PrintMagikarpLength - callba TrainerRankings_MagikarpLength + farcall TrainerRankings_MagikarpLength ld hl, .MeasureItText call PrintText ; Did we beat the record? - ld hl, Buffer1 + ld hl, wMagikarpLength ld de, wBestMagikarpLengthFeet ld c, 2 call StringCmp jr nc, .not_long_enough ; NEW RECORD!!! Let's save that. - ld hl, Buffer1 + ld hl, wMagikarpLength ld de, wBestMagikarpLengthFeet ld a, [hli] ld [de], a @@ -79,7 +79,7 @@ Special_CheckMagikarpLength: ; fbb32 ; 0xfbbae Magikarp_LoadFeetInchesChars: ; fbbae - ld hl, VTiles2 tile "′" + ld hl, VTiles2 tile "′" ; $6e ld de, .feetinchchars lb bc, BANK(.feetinchchars), 2 call Request2bpp @@ -87,18 +87,18 @@ Magikarp_LoadFeetInchesChars: ; fbbae ; fbbbb .feetinchchars ; fbbb -INCBIN "gfx/unknown/0fbbbb.2bpp" +INCBIN "gfx/font/feet_inches.2bpp" ; fbbdb PrintMagikarpLength: ; fbbdb call Magikarp_LoadFeetInchesChars ld hl, StringBuffer1 - ld de, Buffer1 + ld de, wMagikarpLength lb bc, PRINTNUM_RIGHTALIGN | 1, 2 call PrintNum ld [hl], "′" inc hl - ld de, Buffer2 + ld de, wMagikarpLength + 1 lb bc, PRINTNUM_RIGHTALIGN | 1, 2 call PrintNum ld [hl], "″" @@ -108,7 +108,7 @@ PrintMagikarpLength: ; fbbdb ; fbbfc CalcMagikarpLength: ; fbbfc -; Return Magikarp's length (in mm) at MagikarpLength (big endian). +; Return Magikarp's length (in mm) at wMagikarpLength (big endian). ; ; input: ; de: EnemyMonDVs @@ -125,9 +125,9 @@ CalcMagikarpLength: ; fbbfc ; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id) -; if bc < 10: [MagikarpLength] = c + 190 -; if bc ≥ $ff00: [MagikarpLength] = c + 1370 -; else: [MagikarpLength] = z × 100 + (bc − x) / y +; if bc < 10: [wMagikarpLength] = c + 190 +; if bc ≥ $ff00: [wMagikarpLength] = c + 1370 +; else: [wMagikarpLength] = z × 100 + (bc − x) / y ; X, Y, and Z depend on the value of b as follows: @@ -274,7 +274,7 @@ CalcMagikarpLength: ; fbbfc .ok ld e, a - ld hl, MagikarpLength + ld hl, wMagikarpLength ld [hl], d inc hl ld [hl], e @@ -326,9 +326,9 @@ CalcMagikarpLength: ; fbbfc Special_MagikarpHouseSign: ; fbcd2 ld a, [wBestMagikarpLengthFeet] - ld [Buffer1], a + ld [wMagikarpLength], a ld a, [wBestMagikarpLengthInches] - ld [Buffer2], a + ld [wMagikarpLength + 1], a call PrintMagikarpLength ld hl, .CurrentRecordtext call PrintText diff --git a/event/magnet_train.asm b/event/magnet_train.asm index 75bd12cd7..3a2f902c2 100755 --- a/event/magnet_train.asm +++ b/event/magnet_train.asm @@ -45,7 +45,7 @@ Special_MagnetTrain: ; 8cc04 jr z, .initialize bit 7, a jr nz, .done - callab PlaySpriteAnimations + callfar PlaySpriteAnimations call MagnetTrain_Jumptable call MagnetTrain_UpdateLYOverrides call PushLYOverrides @@ -117,7 +117,7 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 call ClearBGPalettes call ClearSprites call DisableLCD - callab ClearSpriteAnims + callfar ClearSpriteAnims call SetMagnetTrainPals call DrawMagnetTrain ld a, $90 @@ -131,7 +131,7 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 push af ld a, $1 ld [rSVBK], a - callba GetPlayerIcon + farcall GetPlayerIcon pop af ld [rSVBK], a ld hl, VTiles0 @@ -323,7 +323,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ld d, 10 * 8 + 5 ld a, [wMagnetTrainPlayerSpriteInitX] ld e, a - ld b, SPRITE_ANIM_INDEX_15 + ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED ld a, [rSVBK] push af ld a, $1 @@ -331,7 +331,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ld a, [PlayerGender] bit 0, a jr z, .got_gender - ld b, SPRITE_ANIM_INDEX_1F + ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE .got_gender pop af @@ -423,7 +423,7 @@ MagnetTrain_Jumptable: ; 8cdf7 ; 8ceae MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae - callba PlaySpriteAnimations + farcall PlaySpriteAnimations call MagnetTrain_Jumptable call MagnetTrain_UpdateLYOverrides call PushLYOverrides @@ -434,13 +434,13 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld [rSVBK], a ld a, [TimeOfDayPal] push af - ld a, [wPermission] + ld a, [wEnvironment] push af ld a, [TimeOfDay] and $3 ld [TimeOfDayPal], a ld a, $1 - ld [wPermission], a + ld [wEnvironment], a ld b, SCGB_MAPPALS call GetSGBLayout call UpdateTimePals @@ -451,7 +451,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae ld a, [rOBP1] ld [wOBP1], a pop af - ld [wPermission], a + ld [wEnvironment], a pop af ld [TimeOfDayPal], a pop af diff --git a/event/itemball.asm b/event/misc_scripts.asm index ed0c6a9e0..97372a57a 100755 --- a/event/itemball.asm +++ b/event/misc_scripts.asm @@ -1,3 +1,11 @@ +Script_AbortBugContest: ; 0x122c1 + checkflag ENGINE_BUG_CONTEST_TIMER + iffalse .finish + setflag ENGINE_DAILY_BUG_CONTEST + special ContestReturnMons +.finish + end + FindItemInBallScript:: ; 0x122ce callasm .TryReceiveItem iffalse .no_room diff --git a/event/misc_scripts_2.asm b/event/misc_scripts_2.asm new file mode 100644 index 000000000..c4c51d5e6 --- /dev/null +++ b/event/misc_scripts_2.asm @@ -0,0 +1,51 @@ +RepelWoreOffScript:: ; 0x13619 + opentext + writetext .text + waitbutton + closetext + end + +.text ; 0x13620 + ; REPEL's effect wore off. + text_jump UnknownText_0x1bd308 + db "@" + +HiddenItemScript:: ; 0x13625 + opentext + copybytetovar EngineBuffer3 + itemtotext 0, 0 + writetext .found_text + giveitem ITEM_FROM_MEM + iffalse .bag_full + callasm SetMemEvent + specialsound + itemnotify + jump .finish + +.bag_full ; 0x1363e + buttonsound + writetext .no_room_text + waitbutton + +.finish ; 13643 + closetext + end + +.found_text ; 0x13645 + ; found @ ! + text_jump UnknownText_0x1bd321 + db "@" + +.no_room_text ; 0x1364a + ; But has no space left… + text_jump UnknownText_0x1bd331 + db "@" + +SetMemEvent: ; 1364f + ld hl, EngineBuffer1 + ld a, [hli] + ld d, [hl] + ld e, a + ld b, SET_FLAG + call EventFlagAction + ret diff --git a/event/mom.asm b/event/mom.asm index 80513e5fb..6e3c7b320 100644 --- a/event/mom.asm +++ b/event/mom.asm @@ -161,7 +161,7 @@ Special_BankOfMom: ; 16218 jr z, .CancelDeposit ld de, Money ld bc, StringBuffer2 - callba CompareMoney + farcall CompareMoney jr c, .DontHaveThatMuchToDeposit ld hl, StringBuffer2 ld de, StringBuffer2 + 3 @@ -169,11 +169,11 @@ Special_BankOfMom: ; 16218 call CopyBytes ld bc, wMomsMoney ld de, StringBuffer2 - callba GiveMoney + farcall GiveMoney jr c, .CantDepositThatMuch ld bc, StringBuffer2 + 3 ld de, Money - callba TakeMoney + farcall TakeMoney ld hl, StringBuffer2 ld de, wMomsMoney ld bc, 3 @@ -232,15 +232,15 @@ Special_BankOfMom: ; 16218 call CopyBytes ld de, wMomsMoney ld bc, StringBuffer2 - callba CompareMoney + farcall CompareMoney jr c, .InsufficientFundsInBank ld bc, Money ld de, StringBuffer2 - callba GiveMoney + farcall GiveMoney jr c, .NotEnoughRoomInWallet ld bc, StringBuffer2 + 3 ld de, wMomsMoney - callba TakeMoney + farcall TakeMoney ld hl, StringBuffer2 ld de, Money ld bc, 3 @@ -476,7 +476,7 @@ Mom_ContinueMenuSetup: ; 1651a lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6 call PrintNum call UpdateSprites - call CGBOnly_LoadEDTile + call CGBOnly_CopyTilemapAtOnce ret ; 1656b @@ -568,7 +568,7 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 ld c, l ld b, h ld de, StringBuffer2 - callba GiveMoney + farcall GiveMoney ret .decrementdigit @@ -577,7 +577,7 @@ Mom_WithdrawDepositMenuJoypad: ; 16571 ld c, l ld b, h ld de, StringBuffer2 - callba TakeMoney + farcall TakeMoney ret .getdigitquantity diff --git a/event/mom_phone.asm b/event/mom_phone.asm index f689745f1..35021dd42 100755 --- a/event/mom_phone.asm +++ b/event/mom_phone.asm @@ -1,3 +1,10 @@ +NUM_MOM_ITEMS_1 EQUS "((MomItems_1End - MomItems_1) / 8)" +NUM_MOM_ITEMS_2 EQUS "((MomItems_2End - MomItems_2) / 8)" + +const_value = 1 + const MOM_ITEM + const MOM_DOLL + MomTriesToBuySomething:: ; fcfec ld a, [wMapReentryScriptQueueFlag] and a @@ -13,7 +20,7 @@ MomTriesToBuySomething:: ; fcfec ret nc ld b, BANK(.Script) ld de, .Script - callba LoadScriptBDE + farcall LoadScriptBDE scf ret ; fd00f @@ -53,7 +60,7 @@ MomTriesToBuySomething:: ; fcfec CheckBalance_MomItem2: ; fd044 ld a, [wWhichMomItem] - cp 10 + cp NUM_MOM_ITEMS_2 jr nc, .nope call GetItemFromMom ld a, [hli] @@ -64,7 +71,7 @@ CheckBalance_MomItem2: ; fd044 ld [hMoneyTemp + 2], a ld de, wMomsMoney ld bc, hMoneyTemp - callba CompareMoney + farcall CompareMoney jr nc, .have_enough_money .nope @@ -76,15 +83,15 @@ CheckBalance_MomItem2: ; fd044 .check_have_2300 ld hl, hMoneyTemp - ld [hl], (2300 / $10000) ; $00 + ld [hl], MOM_MONEY / $10000 inc hl - ld [hl], ((2300 % $10000) / $100) ; $08 + ld [hl], MOM_MONEY / $100 % $100 inc hl - ld [hl], (2300 % $100) ; $fc + ld [hl], MOM_MONEY % $100 .loop ld de, MomItemTriggerBalance ld bc, wMomsMoney - callba CompareMoney + farcall CompareMoney jr z, .exact jr nc, .less_than call .AddMoney @@ -96,7 +103,7 @@ CheckBalance_MomItem2: ; fd044 .exact call .AddMoney - ld a, 5 + ld a, NUM_MOM_ITEMS_1 call RandomRange inc a ld [wWhichMomItemSet], a @@ -106,7 +113,7 @@ CheckBalance_MomItem2: ; fd044 .AddMoney: ld de, MomItemTriggerBalance ld bc, hMoneyTemp - callba AddMoney + farcall AddMoney ret ; fd0a6 @@ -123,7 +130,7 @@ MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6) ld [hMoneyTemp + 2], a ld de, wMomsMoney ld bc, hMoneyTemp - callba TakeMoney + farcall TakeMoney ret @@ -137,7 +144,7 @@ Mom_GiveItemOrDoll: ; fd0c3 ld a, [hl] ld c, a ld b, 1 - callba DecorationFlagAction_c + farcall DecorationFlagAction_c scf ret @@ -191,7 +198,7 @@ GetItemFromMom: ; fd117 .zero ld a, [wWhichMomItem] - cp 10 ; length of MomItems_2 + cp NUM_MOM_ITEMS_2 jr c, .ok xor a @@ -208,32 +215,7 @@ endr ret ; fd136 -momitem: macro -; money to trigger, cost, kind, item - dt \1 - dt \2 - db \3, \4 -ENDM - - -MomItems_1: ; fd136 - momitem 0, 600, MOM_ITEM, SUPER_POTION - momitem 0, 90, MOM_ITEM, ANTIDOTE - momitem 0, 180, MOM_ITEM, POKE_BALL - momitem 0, 450, MOM_ITEM, ESCAPE_ROPE - momitem 0, 500, MOM_ITEM, GREAT_BALL -MomItems_2: ; fd15e - momitem 900, 600, MOM_ITEM, SUPER_POTION - momitem 4000, 270, MOM_ITEM, REPEL - momitem 7000, 600, MOM_ITEM, SUPER_POTION - momitem 10000, 1800, MOM_DOLL, DECO_CHARMANDER_DOLL - momitem 15000, 3000, MOM_ITEM, MOON_STONE - momitem 19000, 600, MOM_ITEM, SUPER_POTION - momitem 30000, 4800, MOM_DOLL, DECO_CLEFAIRY_DOLL - momitem 40000, 900, MOM_ITEM, HYPER_POTION - momitem 50000, 8000, MOM_DOLL, DECO_PIKACHU_DOLL - momitem 100000, 22800, MOM_DOLL, DECO_BIG_SNORLAX_DOLL -; fd1ae +INCLUDE "data/items/mom_phone.asm" db 0, 0, 0 ; XXX diff --git a/event/move_deleter.asm b/event/move_deleter.asm index aa8a1e915..95fc0f1d8 100644 --- a/event/move_deleter.asm +++ b/event/move_deleter.asm @@ -5,7 +5,7 @@ MoveDeletion: jr c, .declined ld hl, .AskWhichMonText call PrintText - callba SelectMonFromParty + farcall SelectMonFromParty jr c, .declined ld a, [CurPartySpecies] cp EGG @@ -20,7 +20,7 @@ MoveDeletion: ld hl, .AskWhichMoveText call PrintText call LoadStandardMenuDataHeader - callba ChooseMoveToDelete + farcall ChooseMoveToDelete push af call ReturnToMapWithSpeechTextbox pop af diff --git a/event/move_tutor.asm b/event/move_tutor.asm new file mode 100644 index 000000000..a15ecaf93 --- /dev/null +++ b/event/move_tutor.asm @@ -0,0 +1,103 @@ +Special_MoveTutor: ; 4925b + call FadeToMenu + call ClearBGPalettes + call ClearScreen + call DelayFrame + ld b, SCGB_PACKPALS + call GetSGBLayout + xor a + ld [wItemAttributeParamBuffer], a + call .GetMoveTutorMove + ld [wd265], a + ld [wPutativeTMHMMove], a + call GetMoveName + call CopyName1 + farcall ChooseMonToLearnTMHM + jr c, .cancel + jr .enter_loop + +.loop + farcall ChooseMonToLearnTMHM_NoRefresh + jr c, .cancel +.enter_loop + call CheckCanLearnMoveTutorMove + jr nc, .loop + xor a + ld [ScriptVar], a + jr .quit + +.cancel + ld a, -1 + ld [ScriptVar], a +.quit + call CloseSubmenu + ret + +.GetMoveTutorMove: ; 492a5 + ld a, [ScriptVar] + cp 1 + jr z, .flamethrower + cp 2 + jr z, .thunderbolt + ld a, ICE_BEAM + ret + +.flamethrower + ld a, FLAMETHROWER + ret + +.thunderbolt + ld a, THUNDERBOLT + ret + +CheckCanLearnMoveTutorMove: ; 492b9 + ld hl, .MenuDataHeader + call LoadMenuDataHeader + + predef CanLearnTMHMMove + + push bc + ld a, [CurPartyMon] + ld hl, PartyMonNicknames + call GetNick + pop bc + + ld a, c + and a + jr nz, .can_learn + push de + ld de, SFX_WRONG + call PlaySFX + pop de + ld a, BANK(Text_TMHMNotCompatible) + ld hl, Text_TMHMNotCompatible + call FarPrintText + jr .didnt_learn + +.can_learn + callfar KnowsMove + jr c, .didnt_learn + + predef LearnMove + ld a, b + and a + jr z, .didnt_learn + + ld c, HAPPINESS_LEARNMOVE + callfar ChangeHappiness + jr .learned + +.didnt_learn + call ExitMenu + and a + ret + +.learned + call ExitMenu + scf + ret + +.MenuDataHeader: ; 0x4930a + db $40 ; flags + db 12, 00 ; start coords + db 17, 19 ; end coords diff --git a/event/name_rater.asm b/event/name_rater.asm index 96d0ee363..771c5090a 100644 --- a/event/name_rater.asm +++ b/event/name_rater.asm @@ -7,7 +7,7 @@ NameRater: ; fb6ed ; Select a Pokemon from your party ld hl, NameRaterWhichMonText call PrintText - callba SelectMonFromParty + farcall SelectMonFromParty jr c, .cancel ; He can't rename an egg... ld a, [CurPartySpecies] @@ -34,7 +34,7 @@ NameRater: ; fb6ed call GetBaseData ld b, 0 ld de, StringBuffer2 - callba _NamingScreen + farcall _NamingScreen ; If the new name is empty, treat it as unchanged. call IsNewNameEmpty ld hl, NameRaterSameAsBeforeText diff --git a/event/overworld.asm b/event/overworld.asm index 156ef389f..370162fa9 100755 --- a/event/overworld.asm +++ b/event/overworld.asm @@ -37,7 +37,7 @@ CheckEngineFlag: ; c721 ; Check engine flag de ; Return carry if flag is not set ld b, CHECK_FLAG - callba EngineFlagAction + farcall EngineFlagAction ld a, c and a jr nz, .isset @@ -77,9 +77,9 @@ CheckPartyMove: ; c742 ld a, [hl] and a jr z, .no - cp a, -1 + cp -1 jr z, .no - cp a, EGG + cp EGG jr z, .next ld bc, PARTYMON_STRUCT_LENGTH @@ -177,7 +177,7 @@ CheckMapForSomethingToCut: ; c7ce call GetFacingTileCoord ld c, a push de - callba CheckCutCollision + farcall CheckCutCollision pop de jr nc, .fail ; Get the location of the current block in OverworldMap. @@ -233,7 +233,7 @@ CutDownTreeOrGrass: ; c810 call DelayFrame ld a, [Buffer6] ; Animation type ld e, a - callba OWCutAnimation + farcall OWCutAnimation call BufferScreen call GetMovementPermissions call UpdateSprites @@ -277,53 +277,9 @@ CheckOverworldTileArrays: ; c840 xor a ret -CutTreeBlockPointers: ; c862 -; Which tileset are we in? - dbw TILESET_JOHTO_1, .johto1 - dbw TILESET_JOHTO_2, .johto2 - dbw TILESET_KANTO, .kanto - dbw TILESET_PARK, .park - dbw TILESET_ILEX_FOREST, .ilex - db -1 - -.johto1 ; Johto OW -; Which meta tile are we facing, which should we replace it with, and which animation? - db $03, $02, $01 ; grass - db $5b, $3c, $00 ; tree - db $5f, $3d, $00 ; tree - db $63, $3f, $00 ; tree - db $67, $3e, $00 ; tree - db -1 - -.johto2 ; Goldenrod area - db $03, $02, $01 ; grass - db -1 - -.kanto ; Kanto OW - db $0b, $0a, $01 ; grass - db $32, $6d, $00 ; tree - db $33, $6c, $00 ; tree - db $34, $6f, $00 ; tree - db $35, $4c, $00 ; tree - db $60, $6e, $00 ; tree - db -1 - -.park ; National Park - db $13, $03, $01 ; grass - db $03, $04, $01 ; grass - db -1 - -.ilex ; Ilex Forest - db $0f, $17, $00 - db -1 - -WhirlpoolBlockPointers: ; c8a4 - dbw TILESET_JOHTO_1, .johto - db -1 - -.johto ; c8a8 - db $07, $36, $00 - db -1 + +INCLUDE "data/field_move_blocks.asm" + OWFlash: ; c8ac call .CheckUseFlash @@ -334,10 +290,10 @@ OWFlash: ; c8ac .CheckUseFlash: ; c8b5 ; Flash ld de, ENGINE_ZEPHYRBADGE - callba CheckBadge + farcall CheckBadge jr c, .nozephyrbadge push hl - callba SpecialAerodactylChamber + farcall SpecialAerodactylChamber pop hl jr c, .useflash ld a, [wTimeOfDayPalset] @@ -416,7 +372,7 @@ SurfFunction: ; c909 jr nz, .cannotsurf call CheckDirection jr c, .cannotsurf - callba CheckFacingObject + farcall CheckFacingObject jr c, .cannotsurf ld a, $1 ret @@ -432,7 +388,7 @@ SurfFunction: ; c909 .DoSurf: ; c95f (3:495f) call GetSurfType - ld [Buffer2], a ; wd1eb (aliases: MovementType) + ld [Buffer2], a call GetPartyNick ld hl, SurfFromMenuScript call QueueScript @@ -472,7 +428,7 @@ UsedSurfScript: ; c986 end .empty_fn ; c9a2 - callba TrainerRankings_Surf + farcall TrainerRankings_Surf ret UsedSurfText: ; c9a9 @@ -510,7 +466,7 @@ CheckDirection: ; c9cb ; Get player direction ld a, [PlayerDirection] - and a, %00001100 ; bits 2 and 3 contain direction + and %00001100 ; bits 2 and 3 contain direction rrca rrca ld e, a @@ -569,7 +525,7 @@ TrySurfOW:: ; c9e7 jr nz, .quit call GetSurfType - ld [MovementType], a + ld [Buffer2], a call GetPartyNick ld a, BANK(AskSurfScript) @@ -615,7 +571,7 @@ FlyFunction: ; ca3b ld de, ENGINE_STORMBADGE call CheckBadge jr c, .nostormbadge - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .outdoors jr .indoors @@ -625,14 +581,14 @@ FlyFunction: ; ca3b ld [hMapAnims], a call LoadStandardMenuDataHeader call ClearSprites - callba _FlyMap + farcall _FlyMap ld a, e cp -1 jr z, .illegal cp NUM_SPAWNS jr nc, .illegal - ld [wd001], a + ld [DefaultSpawnpoint], a call CloseWindow ld a, $1 ret @@ -678,10 +634,10 @@ FlyFunction: ; ca3b end .ReturnFromFly: ; cacb - callba Function561d + farcall Function561d call DelayFrame call ReplaceKrisSprite - callba LoadOverworldFont + farcall LoadOverworldFont ret WaterfallFunction: ; cade @@ -693,7 +649,7 @@ WaterfallFunction: ; cade .TryWaterfall: ; cae7 ; Waterfall ld de, ENGINE_RISINGBADGE - callba CheckBadge + farcall CheckBadge ld a, $80 ret c call CheckMapCanWaterfall @@ -745,7 +701,7 @@ Script_UsedWaterfall: ; 0xcb20 ld a, [PlayerStandingTile] call CheckWaterfallTile ret z - callba TrainerRankings_Waterfall + farcall TrainerRankings_Waterfall ld a, $1 ld [ScriptVar], a ret @@ -827,7 +783,7 @@ dig_incave dw .FailDig .CheckCanDig: ; cbb8 - call GetMapPermission + call GetMapEnvironment cp CAVE jr z, .incave cp DUNGEON @@ -837,7 +793,7 @@ dig_incave ret .incave - ld hl, wDigWarp + ld hl, wDigWarpNumber ld a, [hli] and a jr z, .fail @@ -851,7 +807,7 @@ dig_incave ret .DoDig: ; cbd8 - ld hl, wDigWarp + ld hl, wDigWarpNumber ld de, wNextWarp ld bc, 3 call CopyBytes @@ -865,7 +821,7 @@ dig_incave ret .escaperope - callba SpecialKabutoChamber + farcall SpecialKabutoChamber ld hl, .UsedEscapeRopeScript call QueueScript ld a, $81 @@ -925,11 +881,11 @@ dig_incave .DigOut: ; 0xcc59 step_dig 32 - hide_person + hide_object step_end .DigReturn: ; 0xcc5d - show_person + show_object return_dig 32 step_end @@ -949,7 +905,7 @@ TeleportFunction: ; cc61 dw .FailTeleport .TryTeleport: ; cc78 - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .CheckIfSpawnPoint jr .nope @@ -959,10 +915,10 @@ TeleportFunction: ; cc61 ld d, a ld a, [wLastSpawnMapNumber] ld e, a - callba IsSpawnPoint + farcall IsSpawnPoint jr nc, .nope ld a, c - ld [wd001], a + ld [DefaultSpawnpoint], a ld a, $1 ret @@ -1250,7 +1206,7 @@ DisappearWhirlpool: ; ce1d call OverworldTextModeSwitch ld a, [Buffer6] ld e, a - callba PlayWhirlpoolSound + farcall PlayWhirlpoolSound call BufferScreen call GetMovementPermissions ret @@ -1404,7 +1360,7 @@ TryRockSmashFromMenu: ; cef4 ret GetFacingObject: ; cf0d - callba CheckFacingObject + farcall CheckFacingObject jr nc, .fail ld a, [hObjectStructIndexBuffer] @@ -1539,7 +1495,7 @@ FishFunction: ; cf8e ld d, a ld a, [Buffer2] ld e, a - callba Fish + farcall Fish ld a, d and a jr z, .nonibble @@ -1758,7 +1714,7 @@ BikeFunction: ; d0b3 ret .CheckEnvironment: ; d121 - call GetMapPermission + call GetMapEnvironment call CheckOutdoorMap jr z, .ok cp CAVE diff --git a/event/poisonstep.asm b/event/poisonstep.asm index 1e81e188f..00c7477bc 100755 --- a/event/poisonstep.asm +++ b/event/poisonstep.asm @@ -132,8 +132,8 @@ DoPoisonStep:: ; 505da and %10 jr z, .mon_not_fainted ld c, HAPPINESS_POISONFAINT - callba ChangeHappiness - callba GetPartyNick + farcall ChangeHappiness + farcall GetPartyNick ld hl, .PoisonFaintText call PrintText diff --git a/event/poisonstep_pals.asm b/event/poisonstep_pals.asm new file mode 100644 index 000000000..8930d4c5d --- /dev/null +++ b/event/poisonstep_pals.asm @@ -0,0 +1,48 @@ +LoadPoisonBGPals: ; cbcdd + call .LoadPals + ld a, [hCGB] + and a + ret nz + ret ; ???? + +.LoadPals: ; cbce5 + ld a, [hCGB] + and a + jr nz, .cgb + ld a, [TimeOfDayPal] + and $3 + cp $3 + ld a, %00000000 + jr z, .convert_pals + ld a, %10101010 + +.convert_pals + call DmgToCgbBGPals + ld c, 4 + call DelayFrames + farcall _UpdateTimePals + ret + +.cgb + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + ld hl, BGPals + ld c, $20 +.loop +; RGB 28, 21, 31 + ld a, (palred 28 + palgreen 21 + palblue 31) % $100 + ld [hli], a + ld a, (palred 28 + palgreen 21 + palblue 31) / $100 + ld [hli], a + dec c + jr nz, .loop + pop af + ld [rSVBK], a + ld a, $1 + ld [hCGBPalUpdate], a + ld c, 4 + call DelayFrames + farcall _UpdateTimePals + ret diff --git a/event/poke_seer.asm b/event/poke_seer.asm index 5e93acc5d..d6e335298 100644 --- a/event/poke_seer.asm +++ b/event/poke_seer.asm @@ -21,7 +21,7 @@ SpecialPokeSeer: ; 4f0bc call JoyWaitAorB ld b, $6 - callba SelectMonFromParty + farcall SelectMonFromParty jr c, .cancel ld a, [CurPartySpecies] @@ -240,7 +240,7 @@ GetCaughtLocation: ; 4f20a cp $7e jr z, .fail ld e, a - callba GetLandmarkName + farcall GetLandmarkName ld hl, StringBuffer1 ld de, wSeerCaughtLocation ld bc, 17 diff --git a/event/print_photo.asm b/event/print_photo.asm new file mode 100755 index 000000000..06b01bbcf --- /dev/null +++ b/event/print_photo.asm @@ -0,0 +1,61 @@ +PhotoStudio: ; 16dc7 + ld hl, .Text_AskWhichMon + call PrintText + farcall SelectMonFromParty + jr c, .cancel + ld a, [CurPartySpecies] + cp EGG + jr z, .egg + + ld hl, .Text_HoldStill + call PrintText + call DisableSpriteUpdates + farcall PrintPartymon + call ReturnToMapWithSpeechTextbox + ld a, [hPrinter] + and a + jr nz, .cancel + ld hl, .Text_Presto + jr .print_text + +.cancel + ld hl, .Text_NoPicture + jr .print_text + +.egg + ld hl, .Text_Egg + +.print_text + call PrintText + ret +; 16e04 + +.Text_AskWhichMon: ; 0x16e04 + ; Which #MON should I photo- graph? + text_jump UnknownText_0x1be024 + db "@" +; 0x16e09 + +.Text_HoldStill: ; 0x16e09 + ; All righty. Hold still for a bit. + text_jump UnknownText_0x1be047 + db "@" +; 0x16e0e + +.Text_Presto: ; 0x16e0e + ; Presto! All done. Come again, OK? + text_jump UnknownText_0x1be06a + db "@" +; 0x16e13 + +.Text_NoPicture: ; 0x16e13 + ; Oh, no picture? Come again, OK? + text_jump UnknownText_0x1c0000 + db "@" +; 0x16e18 + +.Text_Egg: ; 0x16e18 + ; An EGG? My talent is worth more… + text_jump UnknownText_0x1c0021 + db "@" +; 0x16e1d diff --git a/event/photo.asm b/event/print_unown.asm index c47445fc5..7841a688b 100755..100644 --- a/event/photo.asm +++ b/event/print_unown.asm @@ -81,7 +81,7 @@ UnownPrinter: ; 16be4 .pressed_a ld a, [wJumptableIndex] push af - callba PrintUnownStamp + farcall PrintUnownStamp call RestartMapMusic pop af ld [wJumptableIndex], a @@ -140,7 +140,7 @@ UnownPrinter: ; 16be4 xor a ld [wBoxAlignment], a ld de, VTiles2 - predef GetFrontpic + predef GetMonFrontpic call .Load2bppToSRAM hlcoord 1, 6 xor a @@ -148,7 +148,7 @@ UnownPrinter: ; 16be4 lb bc, 7, 7 predef PlaceGraphic ld de, VTiles2 tile $31 - callba RotateUnownFrontpic + farcall RotateUnownFrontpic ret .Load2bppToSRAM: ; 16cff @@ -214,9 +214,9 @@ UnownDexVacantString: ; 16d9c UnownDexATile: ; 16d9c -INCBIN "gfx/unknown/016d9c.1bpp" +INCBIN "gfx/printer/bold_a.1bpp" UnownDexBTile: ; 16da4 -INCBIN "gfx/unknown/016da4.1bpp" +INCBIN "gfx/printer/bold_b.1bpp" ; 16dac PlaceUnownPrinterFrontpic: ; 16dac @@ -231,65 +231,3 @@ PlaceUnownPrinterFrontpic: ; 16dac predef PlaceGraphic ret ; 16dc7 - -PhotoStudio: ; 16dc7 - ld hl, .Text_AskWhichMon - call PrintText - callba SelectMonFromParty - jr c, .cancel - ld a, [CurPartySpecies] - cp EGG - jr z, .egg - - ld hl, .Text_HoldStill - call PrintText - call DisableSpriteUpdates - callba PrintPartymon - call ReturnToMapWithSpeechTextbox - ld a, [hPrinter] - and a - jr nz, .cancel - ld hl, .Text_Presto - jr .print_text - -.cancel - ld hl, .Text_NoPicture - jr .print_text - -.egg - ld hl, .Text_Egg - -.print_text - call PrintText - ret -; 16e04 - -.Text_AskWhichMon: ; 0x16e04 - ; Which #MON should I photo- graph? - text_jump UnknownText_0x1be024 - db "@" -; 0x16e09 - -.Text_HoldStill: ; 0x16e09 - ; All righty. Hold still for a bit. - text_jump UnknownText_0x1be047 - db "@" -; 0x16e0e - -.Text_Presto: ; 0x16e0e - ; Presto! All done. Come again, OK? - text_jump UnknownText_0x1be06a - db "@" -; 0x16e13 - -.Text_NoPicture: ; 0x16e13 - ; Oh, no picture? Come again, OK? - text_jump UnknownText_0x1c0000 - db "@" -; 0x16e18 - -.Text_Egg: ; 0x16e18 - ; An EGG? My talent is worth more… - text_jump UnknownText_0x1c0021 - db "@" -; 0x16e1d diff --git a/event/print_unown_2.asm b/event/print_unown_2.asm new file mode 100644 index 000000000..057db5176 --- /dev/null +++ b/event/print_unown_2.asm @@ -0,0 +1,111 @@ +RotateUnownFrontpic: ; e0000 +; something to do with Unown printer + push de + xor a + call GetSRAMBank + ld hl, sScratch + ld bc, 0 +.loop + push bc + push hl + push bc + ld de, wd002 + call .Copy + call .Rotate + ld hl, UnownPrinter_OverworldMapRectangle + pop bc + add hl, bc + add hl, bc + ld a, [hli] + ld e, a + ld d, [hl] + ld hl, wd012 + call .Copy + pop hl + ld bc, $10 + add hl, bc + pop bc + inc c + ld a, c + cp 7 * 7 + jr c, .loop + + ld hl, OverworldMap + ld de, sScratch + ld bc, 7 * 7 tiles + call CopyBytes + pop hl + ld de, sScratch + ld c, 7 * 7 + ld a, [hROMBank] + ld b, a + call Get2bpp + call CloseSRAM + ret + +.Copy: ; e004e + ld c, $10 +.loop_copy + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop_copy + ret + +.Rotate: ; e0057 + ld hl, wd012 + ld e, %10000000 + ld d, 8 +.loop_decompress + push hl + ld hl, wd002 + call .CountSetBit + pop hl + ld a, b + ld [hli], a + push hl + ld hl, wd003 + call .CountSetBit + pop hl + ld a, b + ld [hli], a + srl e + dec d + jr nz, .loop_decompress + ret + +.CountSetBit: ; e0078 + ld b, 0 + ld c, 8 +.loop_count + ld a, [hli] + and e + jr z, .clear + scf + jr .apply + +.clear + and a + +.apply + rr b + inc hl + dec c + jr nz, .loop_count + ret + +overworldmaprect: MACRO +y = 0 +rept \1 +x = \1 * (\2 +- 1) + y +rept \2 + dw OverworldMap tile x +x = x +- \2 +endr +y = y + 1 +endr +endm + +UnownPrinter_OverworldMapRectangle: ; e008b + overworldmaprect 7, 7 diff --git a/event/special.asm b/event/special.asm index f1228abc6..8937698f5 100755 --- a/event/special.asm +++ b/event/special.asm @@ -15,7 +15,7 @@ SpecialGiveShuckle: ; 7305 ; Caught data. ld b, 0 - callba SetGiftPartyMonCaughtData + farcall SetGiftPartyMonCaughtData ; Holding a Berry. ld bc, PARTYMON_STRUCT_LENGTH @@ -71,7 +71,7 @@ SpecialShuckleNick: db "SHUCKIE@" SpecialReturnShuckle: ; 737e - callba SelectMonFromParty + farcall SelectMonFromParty jr c, .refused ld a, [CurPartySpecies] @@ -107,7 +107,7 @@ SpecialReturnShuckle: ; 737e jr .CheckOT .done - callba CheckCurPartyMonFainted + farcall CheckCurPartyMonFainted jr c, .fainted ld a, [CurPartyMon] ld hl, PartyMon1Happiness @@ -119,7 +119,7 @@ SpecialReturnShuckle: ; 737e jr nc, .HappyToStayWithYou xor a ; take from pc ld [wPokemonWithdrawDepositParameter], a - callab RemoveMonFromPartyOrBox + callfar RemoveMonFromPartyOrBox ld a, $2 .HappyToStayWithYou: ld [ScriptVar], a @@ -141,7 +141,7 @@ SpecialReturnShuckle: ; 737e ret Special_BillsGrandfather: ; 73f7 - callba SelectMonFromParty + farcall SelectMonFromParty jr c, .cancel ld a, [CurPartySpecies] ld [ScriptVar], a @@ -167,7 +167,7 @@ Special_DaisyMassage: ; 741d MassageOrHaircut: ; 7420 push hl - callba SelectMonFromParty + farcall SelectMonFromParty pop hl jr c, .nope ld a, [CurPartySpecies] @@ -229,3 +229,7 @@ CopyPokemonName_Buffer1_Buffer3: ; 746e ld de, StringBuffer3 ld bc, PKMN_NAME_LENGTH jp CopyBytes + +Predef1: ; 747a +; not used + ret diff --git a/event/squirtbottle.asm b/event/squirtbottle.asm index 7b47a96f6..1134f1bb0 100755 --- a/event/squirtbottle.asm +++ b/event/squirtbottle.asm @@ -29,7 +29,7 @@ _Squirtbottle: ; 50730 cp MAP_ROUTE_36 jr nz, .nope - callba GetFacingObject + farcall GetFacingObject jr c, .nope ld a, d diff --git a/event/std_collision.asm b/event/std_collision.asm new file mode 100644 index 000000000..79dbc71f1 --- /dev/null +++ b/event/std_collision.asm @@ -0,0 +1,29 @@ +CheckFacingTileForStdScript:: ; 1365b +; Checks to see if the tile you're facing has a std script associated with it. If so, executes the script and returns carry. + ld a, c + ld de, 3 + ld hl, TileCollisionStdScripts + call IsInArray + jr nc, .notintable + + ld a, jumpstd_command + ld [wJumpStdScriptBuffer], a + inc hl + ld a, [hli] + ld [wJumpStdScriptBuffer + 1], a + ld a, [hli] + ld [wJumpStdScriptBuffer + 2], a + ld a, BANK(Script_JumpStdFromRAM) + ld hl, Script_JumpStdFromRAM + call CallScript + scf + ret + +.notintable + xor a + ret + +INCLUDE "data/collision_stdscripts.asm" + +Script_JumpStdFromRAM: ; 0x1369a + jump wJumpStdScriptBuffer diff --git a/event/sweet_scent.asm b/event/sweet_scent.asm index 63eec9922..77567488c 100755 --- a/event/sweet_scent.asm +++ b/event/sweet_scent.asm @@ -34,21 +34,21 @@ SweetScentNothing: ; 0x506e9 ; 0x506ef SweetScentEncounter: ; 506ef - callba CanUseSweetScent + farcall CanUseSweetScent jr nc, .no_battle ld hl, StatusFlags2 bit 2, [hl] jr nz, .not_in_bug_contest - callba GetMapEncounterRate + farcall GetMapEncounterRate ld a, b and a jr z, .no_battle - callba ChooseWildEncounter + farcall ChooseWildEncounter jr nz, .no_battle jr .start_battle .not_in_bug_contest - callba ChooseWildEncounter_BugContest + farcall ChooseWildEncounter_BugContest .start_battle ld a, $1 diff --git a/event/unown.asm b/event/unown.asm index 6b65877f9..1be858bd6 100644 --- a/event/unown.asm +++ b/event/unown.asm @@ -1,5 +1,3 @@ - - SpecialHoOhChamber: ; 0x8addb ld hl, PartySpecies ld a, [hl] @@ -61,10 +59,10 @@ SpecialAerodactylChamber: ; 8ae30 call GetSecondaryMapHeaderPointer ld a, h - cp RuinsofAlphAerodactylChamber_SecondMapHeader / $100 + cp RuinsOfAlphAerodactylChamber_SecondMapHeader / $100 jr nz, .nope ld a, l - cp RuinsofAlphAerodactylChamber_SecondMapHeader % $100 + cp RuinsOfAlphAerodactylChamber_SecondMapHeader % $100 jr nz, .nope ld de, EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER @@ -89,10 +87,10 @@ SpecialKabutoChamber: ; 8ae4e call GetSecondaryMapHeaderPointer ld a, h - cp RuinsofAlphKabutoChamber_SecondMapHeader / $100 + cp RuinsOfAlphKabutoChamber_SecondMapHeader / $100 jr nz, .done ld a, l - cp RuinsofAlphKabutoChamber_SecondMapHeader % $100 + cp RuinsOfAlphKabutoChamber_SecondMapHeader % $100 jr nz, .done ld de, EVENT_WALL_OPENED_IN_KABUTO_CHAMBER @@ -222,7 +220,7 @@ endm cp $ff ret z cp $60 - ld a, (1 << 3) | PAL_BG_BROWN + ld a, VRAM_BANK_1 | PAL_BG_BROWN jr c, .got_pal ld a, PAL_BG_BROWN diff --git a/event/whiteout.asm b/event/whiteout.asm index 38049b3b5..a9d6f900e 100755 --- a/event/whiteout.asm +++ b/event/whiteout.asm @@ -49,7 +49,7 @@ BattleBGMap: ; 1250a ; 12513 HalveMoney: ; 12513 - callba TrainerRankings_WhiteOuts + farcall TrainerRankings_WhiteOuts ; Halve the player's money. ld hl, Money @@ -71,12 +71,12 @@ GetWhiteoutSpawn: ; 12527 ld d, a ld a, [wLastSpawnMapNumber] ld e, a - callba IsSpawnPoint + farcall IsSpawnPoint ld a, c jr c, .yes xor a ; SPAWN_HOME .yes - ld [wd001], a + ld [DefaultSpawnpoint], a ret ; 1253d |