From 812976cee6ba39d50583921273ad85195e77be37 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 20 Nov 2015 11:47:52 -0500 Subject: [PATCH] bgcoord --- battle/core.asm | 4 +- constants/deco_constants.asm | 3 + engine/battle_start.asm | 2 +- engine/color.asm | 6 +- engine/crystal_intro.asm | 40 +- engine/decorations.asm | 1 + engine/evolution_animation.asm | 6 +- engine/intro_menu.asm | 1427 +++++++++++++++++ engine/link.asm | 10 +- engine/main_menu.asm | 6 +- engine/map_setup.asm | 12 +- engine/phone.asm | 4 +- engine/pokegear.asm | 10 +- engine/save.asm | 6 +- engine/slot_machine.asm | 2 +- engine/specials.asm | 10 +- engine/time_capsule/conversion.asm | 2 +- engine/timeofdaypals.asm | 6 +- engine/timeset.asm | 4 +- engine/title.asm | 54 +- event/field_moves.asm | 4 +- event/halloffame.asm | 6 +- event/magnet_train.asm | 24 +- event/sacred_ash.asm | 12 +- event/whiteout.asm | 4 +- home.asm | 8 +- home/audio.asm | 4 +- home/fade.asm | 61 +- home/map.asm | 4 +- home/time.asm | 28 +- items/item_effects.asm | 4 +- macros.asm | 13 + macros/charmap.asm | 1 + main.asm | 1483 +----------------- maps/AzaleaTown.asm | 4 +- maps/BattleTowerBattleRoom.asm | 10 +- maps/BluesHouse.asm | 4 +- maps/BurnedTower1F.asm | 4 +- maps/CherrygroveCity.asm | 2 +- maps/CianwoodCity.asm | 2 +- maps/DragonShrine.asm | 2 +- maps/DragonsDenB1F.asm | 2 +- maps/EcruteakGym.asm | 2 +- maps/FastShip1F.asm | 4 +- maps/FastShipCabins_SE_SSE_CaptainsCabin.asm | 2 +- maps/FastShipCabins_SW_SSW_NW.asm | 2 +- maps/IlexForest.asm | 2 +- maps/IndigoPlateauPokeCenter1F.asm | 6 +- maps/KurtsHouse.asm | 4 +- maps/LancesRoom.asm | 6 +- maps/MobileBattleRoom.asm | 4 +- maps/MountMoon.asm | 2 +- maps/MrPokemonsHouse.asm | 2 +- maps/OlivineCity.asm | 4 +- maps/OlivineLighthouse6F.asm | 12 +- maps/OlivinePort.asm | 2 +- maps/RadioTower2F.asm | 6 +- maps/RadioTower5F.asm | 2 +- maps/Route24.asm | 4 +- maps/Route26HealSpeechHouse.asm | 2 +- maps/Route35NationalParkgate.asm | 4 +- maps/Route36NationalParkgate.asm | 6 +- maps/SilverCaveRoom3.asm | 6 +- maps/SlowpokeWellB1F.asm | 4 +- maps/SproutTower3F.asm | 4 +- maps/TeamRocketBaseB1F.asm | 12 +- maps/TeamRocketBaseB2F.asm | 6 +- maps/TeamRocketBaseB3F.asm | 2 +- maps/TinTower1F.asm | 2 +- maps/UndergroundPathSwitchRoomEntrances.asm | 4 +- maps/VermilionPort.asm | 2 +- maps/VictoryRoad.asm | 4 +- maps/WarehouseEntrance.asm | 8 +- misc/mobile_12.asm | 2 +- misc/mobile_40.asm | 4 +- misc/mobile_42.asm | 12 +- misc/mobile_45.asm | 2 +- misc/mobile_5b.asm | 36 +- misc/mobile_5f.asm | 4 +- misc/unused_title.asm | 2 +- sram.asm | 10 +- 81 files changed, 1765 insertions(+), 1740 deletions(-) create mode 100755 engine/intro_menu.asm diff --git a/battle/core.asm b/battle/core.asm index 5ebd8517c..008535576 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -8569,7 +8569,7 @@ BackUpVBGMap2: ; 3f568 ld a, $1 ld [rVBK], a ld de, w6_d000 - ld hl, VBGMap0 ; VBGMap2 + hlbgcoord 0, 0 ; VBGMap2 lb bc, BANK(BackUpVBGMap2), $40 call Request2bpp pop af @@ -9460,7 +9460,7 @@ InitBattleDisplay: ; 3fb6c call ByteFill ld de, w6_d000 - ld hl, VBGMap0 + hlbgcoord 0, 0 lb bc, BANK(.BlankBGMap), $40 call Request2bpp diff --git a/constants/deco_constants.asm b/constants/deco_constants.asm index d48f0b997..cb5b6d00a 100644 --- a/constants/deco_constants.asm +++ b/constants/deco_constants.asm @@ -104,3 +104,6 @@ const_value = 1 const DECO_TENTACOOL_DOLL ; 32 const DECO_GOLD_TROPHY_DOLL ; 33 const DECO_SILVER_TROPHY_DOLL ; 34 + +NUM_NON_TROPHY_DECOS EQU $2b +NUM_DECOS EQU $2d diff --git a/engine/battle_start.asm b/engine/battle_start.asm index 5bcaad99c..2b32e41b9 100644 --- a/engine/battle_start.asm +++ b/engine/battle_start.asm @@ -84,7 +84,7 @@ endr Function8c2a0: ; 8c2a0 call LoadTrainerBattlePokeballTiles - ld hl, VBGMap0 + hlbgcoord 0, 0 call Function8c2cf ret ; 8c2aa diff --git a/engine/color.asm b/engine/color.asm index c44b296d4..bf428f51c 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -319,7 +319,7 @@ Function8bec: ; 8bec ld a, [EnemySafeguardCount] and $3 call FillBoxCGB - call LoadDETile + call LoadEDTile ret ; 8c1d @@ -702,7 +702,7 @@ Function96b3: ; 96b3 .asm_96d0 hlcoord 0, 0, AttrMap - ld de, VBGMap0 + debgcoord 0, 0 ld b, $12 ld a, $1 ld [rVBK], a @@ -1293,7 +1293,7 @@ ClearBytes: ; 0x9a5b DrawDefaultTiles: ; 0x9a64 ; Draw 240 tiles (2/3 of the screen) from tiles in VRAM - ld hl, VBGMap0 ; BG Map 0 + hlbgcoord 0, 0 ; BG Map 0 ld de, 32 - 20 ld a, $80 ; starting tile ld c, 12 + 1 diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 7849a9f48..0ed427de4 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -506,7 +506,7 @@ IntroScene1: ; e495b (39:495b) ld a, $1 ld [rVBK], a ld hl, IntroTilemap001 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -517,7 +517,7 @@ IntroScene1: ; e495b (39:495b) ld de, VTiles0 tile $00 call Functione54c2 ld hl, IntroTilemap002 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -582,7 +582,7 @@ IntroScene3: ; e49fd (39:49fd) ld a, $1 ld [rVBK], a ld hl, IntroTilemap003 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -590,7 +590,7 @@ IntroScene3: ; e49fd (39:49fd) ld de, VTiles2 tile $00 call Functione54c2 ld hl, IntroTilemap004 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -644,7 +644,7 @@ IntroScene5: ; e4a7a (39:4a7a) ld a, $1 ld [rVBK], a ld hl, IntroTilemap005 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -655,7 +655,7 @@ IntroScene5: ; e4a7a (39:4a7a) ld de, VTiles0 tile $00 call Functione54c2 ld hl, IntroTilemap006 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -738,7 +738,7 @@ IntroScene7: ; e4b3f (39:4b3f) ld a, $1 ld [rVBK], a ld hl, IntroTilemap003 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld hl, IntroPichuWooperGFX ld de, VTiles0 tile $00 @@ -752,7 +752,7 @@ IntroScene7: ; e4b3f (39:4b3f) ld de, VTiles2 tile $00 call Functione54c2 ld hl, IntroTilemap004 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -894,7 +894,7 @@ IntroScene11: ; e4c86 (39:4c86) ld a, $1 ld [rVBK], a ld hl, IntroTilemap007 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -902,7 +902,7 @@ IntroScene11: ; e4c86 (39:4c86) ld de, VTiles2 tile $00 call Functione54c2 ld hl, IntroTilemap008 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -1016,7 +1016,7 @@ IntroScene13: ; e4d6d (39:4d6d) ld a, $1 ld [rVBK], a ld hl, IntroTilemap003 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -1027,7 +1027,7 @@ IntroScene13: ; e4d6d (39:4d6d) ld de, VTiles2 tile $00 call Functione54c2 ld hl, IntroTilemap004 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -1120,7 +1120,7 @@ IntroScene15: ; e4e40 (39:4e40) ld a, $1 ld [rVBK], a ld hl, IntroTilemap009 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -1135,7 +1135,7 @@ IntroScene15: ; e4e40 (39:4e40) lb bc, BANK(GFX_e7a5d), 1 call Request2bpp ld hl, IntroTilemap010 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa call Functione541b ld a, [rSVBK] @@ -1202,7 +1202,7 @@ IntroScene17: ; e4ef5 (39:4ef5) ld a, $1 ld [rVBK], a ld hl, IntroTilemap011 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -1210,7 +1210,7 @@ IntroScene17: ; e4ef5 (39:4ef5) ld de, VTiles1 tile $00 call Functione54de ld hl, IntroTilemap012 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af @@ -1268,7 +1268,7 @@ IntroScene19: ; e4f7e (39:4f7e) ld a, $1 ld [rVBK], a ld hl, IntroTilemap013 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -1283,7 +1283,7 @@ IntroScene19: ; e4f7e (39:4f7e) lb bc, BANK(GFX_e7a5d), 1 call Request2bpp ld hl, IntroTilemap014 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa call Functione541b ld a, [rSVBK] @@ -1444,7 +1444,7 @@ IntroScene26: ; e50bb (39:50bb) ld a, $1 ld [rVBK], a ld hl, IntroTilemap015 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, $0 ld [rVBK], a @@ -1452,7 +1452,7 @@ IntroScene26: ; e50bb (39:50bb) ld de, VTiles2 tile $00 call Functione54c2 ld hl, IntroTilemap017 - ld de, VBGMap0 tile $00 + debgcoord 0, 0 call Functione54fa ld a, [rSVBK] push af diff --git a/engine/decorations.asm b/engine/decorations.asm index a46d359a5..519f88d7c 100755 --- a/engine/decorations.asm +++ b/engine/decorations.asm @@ -1195,6 +1195,7 @@ DecorationIDs: ; 26f2b db DECO_BIG_SNORLAX_DOLL ; 1a db DECO_BIG_ONIX_DOLL ; 1b db DECO_BIG_LAPRAS_DOLL ; 1c +Trophys: db DECO_GOLD_TROPHY_DOLL ; 33 db DECO_SILVER_TROPHY_DOLL ; 34 db -1 diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index ce7dbd7f5..8e0a4af6d 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -378,7 +378,7 @@ Function4e881: ; 4e881 call DisableLCD call LoadStandardFont call LoadFontsBattleExtra - ld hl, VBGMap0 + hlbgcoord 0, 0 ld bc, VBGMap1 - VBGMap0 ld a, " " call ByteFill @@ -411,7 +411,7 @@ Function4e8c2: ; 4e8c2 call DisableLCD call LoadStandardFont call LoadFontsBattleExtra - ld hl, VBGMap0 + hlbgcoord 0, 0 ld bc, VBGMap1 - VBGMap0 ld a, " " call ByteFill @@ -446,7 +446,7 @@ Function4e906: ; 4e906 ld bc, w6_d400 - w6_d000 ld a, " " call ByteFill - ld hl, VBGMap0 + hlbgcoord 0, 0 ld de, w6_d000 ld b, $0 ld c, $40 diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm new file mode 100755 index 000000000..cf5bcf8a0 --- /dev/null +++ b/engine/intro_menu.asm @@ -0,0 +1,1427 @@ +_MainMenu: ; 5ae8 + ld de, MUSIC_NONE + call PlayMusic + call DelayFrame + ld de, MUSIC_MAIN_MENU + ld a, e + ld [wMapMusic], a + call PlayMusic + callba MainMenu + jp Function6219 +; 5b04 + +; unreferenced + ret +; 5b05 + +PrintDayOfWeek: ; 5b05 + push de + ld hl, .Days + ld a, b + call GetNthString + ld d, h + ld e, l + pop hl + call PlaceString + ld h, b + ld l, c + ld de, .Day + call PlaceString + ret +; 5b1c + +.Days ; 5b1c + db "SUN@" + db "MON@" + db "TUES@" + db "WEDNES@" + db "THURS@" + db "FRI@" + db "SATUR@" +; 5b40 + +.Day ; 5b40 + db "DAY@" +; 5b44 + +NewGame_ClearTileMapEtc: ; 5b44 + xor a + ld [hMapAnims], a + call ClearTileMap + call LoadFontsExtra + call LoadStandardFont + call ResetTextRelatedRAM + ret +; 5b54 + +MysteryGift: ; 5b54 + call UpdateTime + callba DoMysteryGiftIfDayHasPassed + callba DoMysteryGift + ret +; 5b64 + +OptionsMenu: ; 5b64 + callba _OptionsMenu + ret +; 5b6b + +NewGame: ; 5b6b + xor a + ld [wc2cc], a + call ResetWRAM + call NewGame_ClearTileMapEtc + call AreYouABoyOrAreYouAGirl + call OakSpeech + call InitializeWorld + ld a, 1 + ld [wPreviousLandmark], a + + ld a, SPAWN_HOME + ld [DefaultSpawnpoint], a + + ld a, MAPSETUP_WARP + ld [hMapEntryMethod], a + jp FinishContinueFunction +; 5b8f + +AreYouABoyOrAreYouAGirl: ; 5b8f + callba Function10632f ; some mobile stuff + jr c, .ok + callba InitGender + ret + +.ok + ld c, 0 + callba InitMobileProfile ; mobile + ret +; 5ba7 + +ResetWRAM: ; 5ba7 + xor a + ld [hBGMapMode], a + call _ResetWRAM + ret +; 5bae + +_ResetWRAM: ; 5bae + + ld hl, Sprites + ld bc, Options - Sprites + xor a + call ByteFill + + ld hl, wd000 + ld bc, wGameData - wd000 + xor a + call ByteFill + + ld hl, wGameData + ld bc, wGameDataEnd - wGameData + xor a + call ByteFill + + ld a, [rLY] + ld [hSecondsBackup], a + call DelayFrame + ld a, [hRandomSub] + ld [PlayerID], a + + ld a, [rLY] + ld [hSecondsBackup], a + call DelayFrame + ld a, [hRandomAdd] + ld [PlayerID + 1], a + + call Random + ld [wSecretID], a + call DelayFrame + call Random + ld [wSecretID + 1], a + + ld hl, PartyCount + call InitList + + xor a + ld [wCurBox], a + ld [wSavedAtLeastOnce], a + + call SetDefaultBoxNames + + ld a, BANK(sBoxCount) + call GetSRAMBank + ld hl, sBoxCount + call InitList + call CloseSRAM + + ld hl, NumItems + call InitList + + ld hl, NumKeyItems + call InitList + + ld hl, NumBalls + call InitList + + ld hl, PCItems + call InitList + + xor a + ld [wRoamMon1Species], a + ld [wRoamMon2Species], a + ld [wRoamMon3Species], a + ld a, -1 + ld [wRoamMon1MapGroup], a + ld [wRoamMon2MapGroup], a + ld [wRoamMon3MapGroup], a + ld [wRoamMon1MapNumber], a + ld [wRoamMon2MapNumber], a + ld [wRoamMon3MapNumber], a + + ld a, BANK(sMysteryGiftItem) + call GetSRAMBank + ld hl, sMysteryGiftItem + xor a + ld [hli], a + dec a + ld [hl], a + call CloseSRAM + + call LoadOrRegenerateLuckyIDNumber + call InitializeMagikarpHouse + + xor a + ld [MonType], a + + ld [JohtoBadges], a + ld [KantoBadges], a + + ld [Coins], a + ld [Coins + 1], a + +START_MONEY EQU 3000 + +IF START_MONEY / $10000 + ld a, START_MONEY / $10000 +ENDC + ld [Money], a + ld a, START_MONEY / $100 % $100 + ld [Money + 1], a + ld a, START_MONEY % $100 + ld [Money + 2], a + + xor a + ld [wdc17], a + + ld hl, wdc19 + ld [hl], 2300 / $10000 + inc hl + ld [hl], 2300 / $100 % $100 + inc hl + ld [hl], 2300 % $100 + + call InitializeNPCNames + + callba InitDecorations + + callba DeletePartyMonMail + + callba DeleteMobileEventIndex + + call ResetGameTime + ret +; 5ca1 + +InitList: ; 5ca1 +; Loads 0 in the count and -1 in the first item or mon slot. + xor a + ld [hli], a + dec a + ld [hl], a + ret +; 5ca6 + +SetDefaultBoxNames: ; 5ca6 + ld hl, wBoxNames + ld c, 0 +.loop + push hl + ld de, .Box + call CopyName2 + dec hl + ld a, c + inc a + cp 10 + jr c, .less + sub 10 + ld [hl], "1" + inc hl + +.less + add "0" + ld [hli], a + ld [hl], "@" + pop hl + ld de, 9 + add hl, de + inc c + ld a, c + cp NUM_BOXES + jr c, .loop + ret + +.Box + db "BOX@" +; 5cd3 + +InitializeMagikarpHouse: ; 5cd3 + ld hl, wBestMagikarpLengthFeet + ld a, $3 + ld [hli], a + ld a, $6 + ld [hli], a + ld de, .Ralph + call CopyName2 + ret +; 5ce3 + +.Ralph ; 5ce3 + db "RALPH@" +; 5ce9 + +InitializeNPCNames: ; 5ce9 + ld hl, .Rival + ld de, RivalName + call .Copy + + ld hl, .Mom + ld de, MomsName + call .Copy + + ld hl, .Red + ld de, RedsName + call .Copy + + ld hl, .Green + ld de, GreensName + +.Copy + ld bc, NAME_LENGTH + call CopyBytes + ret + +.Rival db "???@" +.Red db "RED@" +.Green db "GREEN@" +.Mom db "MOM@" +; 5d23 + +InitializeWorld: ; 5d23 + call ShrinkPlayer + callba GetSpawnCoord + callba _InitializeStartDay + ret +; 5d33 + +LoadOrRegenerateLuckyIDNumber: ; 5d33 + ld a, BANK(sLuckyIDNumber) + call GetSRAMBank + ld a, [CurDay] + inc a + ld b, a + ld a, [sLuckyNumberDay] + cp b + ld a, [sLuckyIDNumber + 1] + ld c, a + ld a, [sLuckyIDNumber] + jr z, .skip + ld a, b + ld [sLuckyNumberDay], a + call Random + ld c, a + call Random + +.skip + ld [wLuckyIDNumber], a + ld [sLuckyIDNumber], a + ld a, c + ld [wLuckyIDNumber + 1], a + ld [sLuckyIDNumber + 1], a + jp CloseSRAM +; 5d65 + +Continue: ; 5d65 + callba TryLoadSaveFile + jr c, .FailToLoad + callba Function150b9 + call LoadStandardMenuDataHeader + call DisplaySaveInfoOnContinue + ld a, $1 + ld [hBGMapMode], a + ld c, 20 + call DelayFrames + call ConfirmContinue + jr nc, .Check1Pass + call WriteBackup + jr .FailToLoad + +.Check1Pass + call Continue_CheckRTC_RestartClock + jr nc, .Check2Pass + call WriteBackup + jr .FailToLoad + +.Check2Pass + ld a, $8 + ld [MusicFade], a + ld a, MUSIC_NONE % $100 + ld [MusicFadeIDLo], a + ld a, MUSIC_NONE / $100 + ld [MusicFadeIDHi], a + call ClearBGPalettes + call Continue_MobileAdapterMenu + call WriteBackup + call ClearTileMap + ld c, 20 + call DelayFrames + callba JumpRoamMons + callba Function105091 ; Mystery Gift + callba Function140ae ; time-related + ld a, [wSpawnAfterChampion] + cp SPAWN_LANCE + jr z, .SpawnAfterE4 + ld a, MAPSETUP_CONTINUE + ld [hMapEntryMethod], a + jp FinishContinueFunction + +.FailToLoad + ret + +.SpawnAfterE4 + ld a, SPAWN_NEW_BARK + ld [wd001], a + call PostCreditsSpawn + jp FinishContinueFunction +; 5de2 + +SpawnAfterRed: ; 5de2 + ld a, SPAWN_MT_SILVER + ld [wd001], a +; 5de7 + +PostCreditsSpawn: ; 5de7 + xor a + ld [wSpawnAfterChampion], a + ld a, MAPSETUP_WARP + ld [hMapEntryMethod], a + ret +; 5df0 + +Continue_MobileAdapterMenu: ; 5df0 + callba Function10632f ; mobile check + ret nc + ld hl, wd479 + bit 1, [hl] + ret nz + ld a, 5 + ld [MusicFade], a + ld a, MUSIC_MOBILE_ADAPTER_MENU % $100 + ld [MusicFadeIDLo], a + ld a, MUSIC_MOBILE_ADAPTER_MENU / $100 + ld [MusicFadeIDHi], a + ld c, 20 + call DelayFrames + ld c, $1 + callba InitMobileProfile ; mobile + callba _SaveData + ld a, 8 + ld [MusicFade], a + ld a, MUSIC_NONE % $100 + ld [MusicFadeIDLo], a + ld a, MUSIC_NONE / $100 + ld [MusicFadeIDHi], a + ld c, 35 + call DelayFrames + ret +; 5e34 + +ConfirmContinue: ; 5e34 +.loop + call DelayFrame + call GetJoypad + ld hl, hJoyPressed + bit 0, [hl] + jr nz, .PressA + bit 1, [hl] + jr z, .loop + scf + ret + +.PressA + ret +; 5e48 + +Continue_CheckRTC_RestartClock: ; 5e48 + call CheckRTCStatus + and %10000000 ; Day count exceeded 16383 + jr z, .pass + callba RestartClock + ld a, c + and a + jr z, .pass + scf + ret + +.pass + xor a + ret +; 5e5d + +FinishContinueFunction: ; 5e5d +.loop + xor a + ld [wc2c1], a + ld [wLinkMode], a + ld hl, GameTimerPause + set 0, [hl] + res 7, [hl] + ld hl, wEnteredMapFromContinue + set 1, [hl] + callba OverworldLoop + ld a, [wSpawnAfterChampion] + cp SPAWN_RED + jr z, .AfterRed + jp Reset + +.AfterRed + call SpawnAfterRed + jr .loop +; 5e85 + +DisplaySaveInfoOnContinue: ; 5e85 + call CheckRTCStatus + and %10000000 + jr z, .clock_ok + lb de, 4, 8 + call DisplayContinueDataWithRTCError + ret + +.clock_ok + lb de, 4, 8 + call DisplayNormalContinueData + ret +; 5e9a + +DisplaySaveInfoOnSave: ; 5e9a + lb de, 4, 0 + jr DisplayNormalContinueData +; 5e9f + +DisplayNormalContinueData: ; 5e9f + call Continue_LoadMenuHeader + call Continue_DisplayBadgesDexPlayerName + call Continue_PrintGameTime + call LoadFontsExtra + call UpdateSprites + ret +; 5eaf + +DisplayContinueDataWithRTCError: ; 5eaf + call Continue_LoadMenuHeader + call Continue_DisplayBadgesDexPlayerName + call Continue_UnknownGameTime + call LoadFontsExtra + call UpdateSprites + ret +; 5ebf + +Continue_LoadMenuHeader: ; 5ebf + xor a + ld [hBGMapMode], a + ld hl, .MenuDataHeader_Dex + ld a, [StatusFlags] + bit 0, a ; pokedex + jr nz, .pokedex_header + ld hl, .MenuDataHeader_NoDex + +.pokedex_header + call Function1e35 + call MenuBox + call Function1c89 + ret +; 5ed9 + +.MenuDataHeader_Dex: ; 5ed9 + db $40 ; flags + db 00, 00 ; start coords + db 09, 15 ; end coords + dw .MenuData2_Dex + db 1 ; default option +; 5ee1 + +.MenuData2_Dex: ; 5ee1 + db $00 ; flags + db 4 ; items + db "PLAYER@" + db "BADGES@" + db "#DEX@" + db "TIME@" +; 5efb + +.MenuDataHeader_NoDex: ; 5efb + db $40 ; flags + db 00, 00 ; start coords + db 09, 15 ; end coords + dw .MenuData2_NoDex + db 1 ; default option +; 5f03 + +.MenuData2_NoDex: ; 5f03 + db $00 ; flags + db 4 ; items + db "PLAYER @" + db "BADGES@" + db " @" + db "TIME@" +; 5f1c + + +Continue_DisplayBadgesDexPlayerName: ; 5f1c + call MenuBoxCoord2Tile + push hl + decoord 13, 4, 0 + add hl, de + call Continue_DisplayBadgeCount + pop hl + push hl + decoord 12, 6, 0 + add hl, de + call Continue_DisplayPokedexNumCaught + pop hl + push hl + decoord 8, 2, 0 + add hl, de + ld de, .Player + call PlaceString + pop hl + ret + +.Player + db "@" +; 5f40 + +Continue_PrintGameTime: ; 5f40 + decoord 9, 8, 0 + add hl, de + call Continue_DisplayGameTime + ret +; 5f48 + +Continue_UnknownGameTime: ; 5f48 + decoord 9, 8, 0 + add hl, de + ld de, .three_question_marks + call PlaceString + ret + +.three_question_marks + db " ???@" +; 5f58 + +Continue_DisplayBadgeCount: ; 5f58 + push hl + ld hl, JohtoBadges + ld b, 2 + call CountSetBits + pop hl + ld de, wd265 + lb bc, 1, 2 + jp PrintNum +; 5f6b + +Continue_DisplayPokedexNumCaught: ; 5f6b + ld a, [StatusFlags] + bit 0, a + ret z + push hl + ld hl, PokedexCaught +IF NUM_POKEMON % 8 + ld b, NUM_POKEMON / 8 + 1 +ELSE + ld b, NUM_POKEMON / 8 +ENDC + call CountSetBits + pop hl + ld de, wd265 + lb bc, 1, 3 + jp PrintNum +; 5f84 + +Continue_DisplayGameTime: ; 5f84 + ld de, GameTimeHours + lb bc, 2, 3 + call PrintNum + ld [hl], "" + inc hl + ld de, GameTimeMinutes + lb bc, PRINTNUM_LEADINGZEROS | 1, 2 + jp PrintNum +; 5f99 + + +OakSpeech: ; 0x5f99 + callba InitClock + call RotateFourPalettesLeft + call ClearTileMap + + ld de, MUSIC_ROUTE_30 + call PlayMusic + + call RotateFourPalettesRight + call RotateThreePalettesRight + xor a + ld [CurPartySpecies], a + ld a, POKEMON_PROF + ld [TrainerClass], a + call Intro_PrepTrainerPic + + ld b, SCGB_1C + call GetSGBLayout + call Intro_RotatePalettesLeftFrontpic + + ld hl, OakText1 + call PrintText + call RotateThreePalettesRight + call ClearTileMap + + ld a, WOOPER + ld [CurSpecies], a + ld [CurPartySpecies], a + call GetBaseData + + hlcoord 6, 4 + call PrepMonFrontpic + + xor a + ld [TempMonDVs], a + ld [TempMonDVs + 1], a + + ld b, SCGB_1C + call GetSGBLayout + call Intro_WipeInFrontpic + + ld hl, OakText2 + call PrintText + ld hl, OakText4 + call PrintText + call RotateThreePalettesRight + call ClearTileMap + + xor a + ld [CurPartySpecies], a + ld a, POKEMON_PROF + ld [TrainerClass], a + call Intro_PrepTrainerPic + + ld b, SCGB_1C + call GetSGBLayout + call Intro_RotatePalettesLeftFrontpic + + ld hl, OakText5 + call PrintText + call RotateThreePalettesRight + call ClearTileMap + + xor a + ld [CurPartySpecies], a + callba DrawIntroPlayerPic + + ld b, SCGB_1C + call GetSGBLayout + call Intro_RotatePalettesLeftFrontpic + + ld hl, OakText6 + call PrintText + call NamePlayer + ld hl, OakText7 + call PrintText + ret + +OakText1: ; 0x6045 + text_jump _OakText1 + db "@" + +OakText2: ; 0x604a + text_jump _OakText2 + start_asm + ld a, WOOPER + call PlayCry + call WaitSFX + ld hl, OakText3 + ret + +OakText3: ; 0x605b + text_jump _OakText3 + db "@" + +OakText4: ; 0x6060 + text_jump _OakText4 + db "@" + +OakText5: ; 0x6065 + text_jump _OakText5 + db "@" + +OakText6: ; 0x606a + text_jump _OakText6 + db "@" + +OakText7: ; 0x606f + text_jump _OakText7 + db "@" + +NamePlayer: ; 0x6074 + callba MovePlayerPicRight + callba ShowPlayerNamingChoices + ld a, [MenuSelection2] + dec a + jr z, .NewName + call StorePlayerName + callba Function8c1d + callba MovePlayerPicLeft + ret + +.NewName + ld b, 1 + ld de, PlayerName + callba NamingScreen + + call RotateThreePalettesRight + call ClearTileMap + + call LoadFontsExtra + call WaitBGMap + + xor a + ld [CurPartySpecies], a + callba DrawIntroPlayerPic + + ld b, SCGB_1C + call GetSGBLayout + call RotateThreePalettesLeft + + ld hl, PlayerName + ld de, .Chris + ld a, [PlayerGender] + bit 0, a + jr z, .Male + ld de, .Kris +.Male + call InitName + ret + +.Chris + db "CHRIS@@@@@@" +.Kris + db "KRIS@@@@@@@" +; 60e9 + +Function60e9: ; Unreferenced + call LoadMenuDataHeader + call InterpretMenu2 + ld a, [MenuSelection2] + dec a + call CopyNameFromMenu + call WriteBackup + ret +; 60fa + +StorePlayerName: ; 60fa + ld a, "@" + ld bc, NAME_LENGTH + ld hl, PlayerName + call ByteFill + ld hl, PlayerName + ld de, StringBuffer2 + call CopyName2 + ret +; 610f + +ShrinkPlayer: ; 610f + + ld a, [hROMBank] + push af + + 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 PlaySFX + pop af + rst Bankswitch + + ld c, 8 + call DelayFrames + + ld hl, Shrink1Pic + ld b, BANK(Shrink1Pic) + call ShrinkFrame + + ld c, 8 + call DelayFrames + + ld hl, Shrink2Pic + ld b, BANK(Shrink2Pic) + call ShrinkFrame + + ld c, 8 + call DelayFrames + + hlcoord 6, 5 + ld b, 7 + ld c, 7 + call ClearBox + + ld c, 3 + call DelayFrames + + call Intro_PlacePlayerSprite + call LoadFontsExtra + + ld c, 50 + call DelayFrames + + call RotateThreePalettesRight + call ClearTileMap + ret +; 616a + +Intro_RotatePalettesLeftFrontpic: ; 616a + ld hl, IntroFadePalettes + ld b, IntroFadePalettesEnd - IntroFadePalettes +.loop + ld a, [hli] + call DmgToCgbBGPals + ld c, 10 + call DelayFrames + dec b + jr nz, .loop + ret +; 617c + +IntroFadePalettes: ; 0x617c + db %01010100 + db %10101000 + db %11111100 + db %11111000 + db %11110100 + db %11100100 +IntroFadePalettesEnd +; 6182 + +Intro_WipeInFrontpic: ; 6182 + ld a, $77 + ld [hWX], a + call DelayFrame + ld a, %11100100 + call DmgToCgbBGPals +.loop + call DelayFrame + ld a, [hWX] + sub $8 + cp -1 + ret z + ld [hWX], a + jr .loop +; 619c + +Intro_PrepTrainerPic: ; 619c + ld de, VTiles2 + callba GetTrainerPic + xor a + ld [hFillBox], a + hlcoord 6, 4 + lb bc, 7, 7 + predef FillBox + ret +; 61b4 + +ShrinkFrame: ; 61b4 + ld de, VTiles2 + ld c, $31 + predef DecompressPredef + xor a + ld [hFillBox], a + hlcoord 6, 4 + lb bc, 7, 7 + predef FillBox + ret +; 61cd + +Intro_PlacePlayerSprite: ; 61cd + + callba GetPlayerIcon + ld c, $c + ld hl, VTiles0 + call Request2bpp + + ld hl, Sprites + ld de, .sprites + ld a, [de] + inc de + + ld c, a +.loop + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + + ld b, 0 + ld a, [PlayerGender] + bit 0, a + jr z, .male + ld b, 1 +.male + ld a, b + + ld [hli], a + dec c + jr nz, .loop + ret +; 61fe + +.sprites ; 61fe + db 4 + db $4c, $48, 0 + db $4c, $50, 1 + db $54, $48, 2 + db $54, $50, 3 +; 620b + + +Function620b: ; 620b + callab Functione4579 + jr c, Function6219 + callba CrystalIntro + +Function6219: ; 6219 + ld a, [rSVBK] + push af + ld a, $5 + ld [rSVBK], a + + call .TitleScreen + call DelayFrame +.loop + call Function627b + jr nc, .loop + + call ClearSprites + call ClearBGPalettes + + pop af + ld [rSVBK], a + + ld hl, rLCDC + res 2, [hl] + call ClearScreen + call Function3200 + xor a + ld [hLCDStatCustom], a + ld [hSCX], a + ld [hSCY], a + ld a, $7 + ld [hWX], a + ld a, $90 + ld [hWY], a + ld b, SCGB_08 + call GetSGBLayout + call UpdateTimePals + ld a, [wcf64] + cp $5 + jr c, .ok + xor a +.ok + ld e, a + ld d, 0 + ld hl, .jumptable +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 626a + +.jumptable + dw _MainMenu + dw Function6389 + dw Function620b + dw Function620b + dw ResetClock +; 6274 + + +.TitleScreen: ; 6274 + callba _TitleScreen + ret +; 627b + +Function627b: ; 627b + ld a, [wJumptableIndex] + bit 7, a + jr nz, .done_title + call TitleScreenScene + callba SuicuneFrameIterator + call DelayFrame + and a + ret + +.done_title + scf + ret +; 6292 + +Function6292: ; 6292 ; unreferenced + ld a, [hVBlankCounter] + and $7 + ret nz + ld hl, LYOverrides + $5f + ld a, [hl] + dec a + ld bc, 2 * SCREEN_WIDTH + call ByteFill + ret +; 62a3 + +TitleScreenScene: ; 62a3 + ld e, a + ld d, 0 + ld hl, .scenes +rept 2 + add hl, de +endr + ld a, [hli] + ld h, [hl] + ld l, a + jp [hl] +; 62af + +.scenes + dw TitleScreenEntrance + dw TitleScreenTimer + dw TitleScreenMain + dw TitleScreenEnd +; 62b7 + +Function62b7: ; Unreferenced + ld hl, wJumptableIndex + inc [hl] + ret +; 62bc + + +TitleScreenEntrance: ; 62bc + +; Animate the logo: +; Move each line by 4 pixels until our count hits 0. + ld a, [hSCX] + and a + jr z, .done + sub 4 + ld [hSCX], a + +; Lay out a base (all lines scrolling together). + ld e, a + ld hl, LYOverrides + ld bc, 8 * 10 ; logo height + call ByteFill + +; Reversed signage for every other line's position. +; This is responsible for the interlaced effect. + ld a, e + xor -1 + inc a + + ld b, 8 * 10 / 2 ; logo height / 2 + ld hl, LYOverrides + 1 +.loop + ld [hli], a + inc hl + dec b + jr nz, .loop + + callba AnimateTitleCrystal + ret + +.done +; Next scene + ld hl, wJumptableIndex + inc [hl] + xor a + ld [hLCDStatCustom], a + +; Play the title screen music. + ld de, MUSIC_TITLE + call PlayMusic + + ld a, $88 + ld [hWY], a + ret +; 62f6 + + +TitleScreenTimer: ; 62f6 + +; Next scene + ld hl, wJumptableIndex + inc [hl] + +; Start a timer + ld hl, wcf65 + ld de, $1140 ; 73.6 seconds + ld [hl], e + inc hl + ld [hl], d + ret +; 6304 + +TitleScreenMain: ; 6304 + +; Run the timer down. + ld hl, wcf65 + ld e, [hl] + inc hl + ld d, [hl] + ld a, e + or d + jr z, .end + + dec de + ld [hl], d + dec hl + ld [hl], e + +; Save data can be deleted by pressing Up + B + Select. + call GetJoypad + ld hl, hJoyDown + ld a, [hl] + and D_UP + B_BUTTON + SELECT + cp D_UP + B_BUTTON + SELECT + jr z, .delete_save_data + +; To bring up the clock reset dialog: + +; Hold Down + B + Select to initiate the sequence. + ld a, [$ffeb] + cp $34 + jr z, .check_clock_reset + + ld a, [hl] + and D_DOWN + B_BUTTON + SELECT + cp D_DOWN + B_BUTTON + SELECT + jr nz, .check_start + + ld a, $34 + ld [$ffeb], a + jr .check_start + +; Keep Select pressed, and hold Left + Up. +; Then let go of Select. +.check_clock_reset + bit 2, [hl] ; SELECT + jr nz, .check_start + + xor a + ld [$ffeb], a + + ld a, [hl] + and D_LEFT + D_UP + cp D_LEFT + D_UP + jr z, .clock_reset + +; Press Start or A to start the game. +.check_start + ld a, [hl] + and START | A_BUTTON + jr nz, .incave + ret + +.incave + ld a, 0 + jr .done + +.delete_save_data + ld a, 1 + +.done + ld [wcf64], a + +; Return to the intro sequence. + ld hl, wJumptableIndex + set 7, [hl] + ret + +.end +; Next scene + ld hl, wJumptableIndex + inc [hl] + +; Fade out the title screen music + xor a + ld [MusicFadeIDLo], a + ld [MusicFadeIDHi], a + ld hl, MusicFade + ld [hl], 8 ; 1 second + + ld hl, wcf65 + inc [hl] + ret + +.clock_reset + ld a, 4 + ld [wcf64], a + +; Return to the intro sequence. + ld hl, wJumptableIndex + set 7, [hl] + ret +; 6375 + +TitleScreenEnd: ; 6375 + +; Wait until the music is done fading. + + ld hl, wcf65 + inc [hl] + + ld a, [MusicFade] + and a + ret nz + + ld a, 2 + ld [wcf64], a + +; Back to the intro. + ld hl, wJumptableIndex + set 7, [hl] + ret +; 6389 + +Function6389: ; 6389 + callba Function4d54c + jp Init +; 6392 + +ResetClock: ; 6392 + callba _ResetClock + jp Init +; 639b + +Function639b: ; unreferenced + ; If bit 0 or 1 of [wcf65] is set, we don't need to be here. + ld a, [wcf65] + and $3 + ret nz + ld bc, SpriteAnim10 + ld hl, SpriteAnim10FrameIndex - SpriteAnim10 + add hl, bc ; over-the-top compicated way to load wc3ae into hl + ld l, [hl] + ld h, 0 +rept 2 + add hl, hl +endr + ld de, Data63ca + add hl, de + ; If bit 2 of [wcf65] is set, get the second dw; else, get the first dw + ld a, [wcf65] + and %00000100 +rept 2 + srl a +endr + ld e, a + ld d, 0 +rept 2 + add hl, de +endr + ld a, [hli] + and a + ret z + ld e, a + ld d, [hl] + ld a, SPRITE_ANIM_INDEX_01 + call _InitSpriteAnimStruct + ret +; 63ca + +Data63ca: ; 63ca +; frame 0 y, x; frame 1 y, x + db $5c, $50, $00, $00 + db $5c, $68, $5c, $58 + db $5c, $68, $5c, $78 + db $5c, $88, $5c, $78 + db $00, $00, $5c, $78 + db $00, $00, $5c, $58 +; 63e2 + +Copyright: ; 63e2 + call ClearTileMap + call LoadFontsExtra + ld de, CopyrightGFX + ld hl, VTiles2 tile $60 + lb bc, BANK(CopyrightGFX), $1d + call Request2bpp + hlcoord 2, 7 + ld de, CopyrightString + jp PlaceString +; 63fd + +CopyrightString: ; 63fd + ; ©1995-2001 Nintendo + db $60, $61, $62, $63, $64, $65, $66 + db $67, $68, $69, $6a, $6b, $6c + + db $4e + + ; ©1995-2001 Creatures inc. + db $60, $61, $62, $63, $64, $65, $66, $6d + db $6e, $6f, $70, $71, $72, $7a, $7b, $7c + + db $4e + + ; ©1995-2001 GAME FREAK inc. + db $60, $61, $62, $63, $64, $65, $66, $73, $74 + db $75, $76, $77, $78, $79, $7a, $7b, $7c + + db "@" +; 642e + +GameInit:: ; 642e + callba TryLoadSaveData + call ResetTextRelatedRAM + call ClearBGPalettes + call ClearTileMap + ld a, VBGMap0 / $100 + ld [hBGMapAddress + 1], a + xor a + ld [hBGMapAddress], a + ld [hJoyDown], a + ld [hSCX], a + ld [hSCY], a + ld a, $90 + ld [hWY], a + call WaitBGMap + jp Function620b +; 6454 diff --git a/engine/link.asm b/engine/link.asm index afdbd218a..feb4b5023 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -493,7 +493,7 @@ Function283b2: ; 283b2 pop hl bccoord 1, 14 call PlaceWholeStringInBoxAtOnce - call FadeToWhite + call RotateThreePalettesRight call ClearScreen ld b, $8 call GetSGBLayout @@ -1583,7 +1583,7 @@ Function28ade: ; 28ade jr nz, .asm_28ade Function28b22: ; 28b22 - call FadeToWhite + call RotateThreePalettesRight call ClearScreen ld b, $8 call GetSGBLayout @@ -2191,7 +2191,7 @@ Function28fdb: ; 28fdb ld [rVBK], a .asm_2900b - ld hl, VBGMap0 + hlbgcoord 0, 0 ld bc, sScratch - VBGMap0 ld a, " " call ByteFill @@ -2372,7 +2372,7 @@ Function2914e: ; 2914e push af call DisableLCD callab Function8cf53 - ld hl, $9874 + hlbgcoord 20, 3 ld bc, $c ld a, $60 call ByteFill @@ -2500,7 +2500,7 @@ Function29229: ; 29229 call ClearSprites call DisableLCD callab Function8cf53 - ld hl, VBGMap0 + hlbgcoord 0, 0 ld bc, sScratch - VBGMap0 ld a, " " call ByteFill diff --git a/engine/main_menu.asm b/engine/main_menu.asm index 6e0ab56e5..428858a74 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -240,7 +240,7 @@ Function49e09: ; 49e09 Function49e27: ; 49e27 - call Function6e3 + call CheckRTCStatus and $80 jr nz, .asm_49e39 hlcoord 0, 14 @@ -259,7 +259,7 @@ Function49e3d: ; 49e3d ld a, [wSaveFileExists] and a ret z - call Function6e3 + call CheckRTCStatus and $80 jp nz, Function49e75 call UpdateTime @@ -560,7 +560,7 @@ Function4a0c2: ; 4a0c2 (12:60c2) ld c, 2 call DelayFrames ld c, $1 - call Function4802f + call InitMobileProfile push af call ClearBGPalettes pop af diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 7e0bfd3c1..ef1ad715e 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -249,10 +249,10 @@ MapSetupCommands: ; 15440 dba PlayMapMusic ; 03 dba RestartMapMusic ; 04 dba FadeToMapMusic ; 05 - dba FadeOutMapAndMusic ; 06 + dba RotatePalettesRightMapAndMusic ; 06 dba EnterMapMusic ; 07 dba ForceMapMusic ; 08 - dba FadeInMusic ; 09 + dba RotatePalettesLeftMusic ; 09 dba LoadBlockData ; 0a dba LoadNeighboringBlockData ; 0b dba SaveScreen ; 0c @@ -272,8 +272,8 @@ MapSetupCommands: ; 15440 dba LoadMapAttributes ; 1a dba LoadMapAttributes_SkipPeople ; 1b dba ClearBGPalettes ; 1c - dba FadeOutPalettes ; 1d - dba FadeInPalettes ; 1e + dba RotatePalettesRightPalettes ; 1d + dba RotatePalettesLeftPalettes ; 1e dba GetCoordOfUpperLeftCorner ; 1f dba RestoreFacingAfterWarp ; 20 dba SpawnInFacingDown ; 21 @@ -417,14 +417,14 @@ RetainOldPalettes: ; 1556d callba _UpdateTimePals ret -FadeOutMapAndMusic: ; 15574 +RotatePalettesRightMapAndMusic: ; 15574 ld e, 0 ld a, [MusicFadeIDLo] ld d, 0 ld a, [MusicFadeIDHi] ld a, $4 ld [MusicFade], a - call FadeToWhite + call RotateThreePalettesRight ret ; 15587 diff --git a/engine/phone.asm b/engine/phone.asm index 32481deaa..ab0ecb84a 100644 --- a/engine/phone.asm +++ b/engine/phone.asm @@ -604,7 +604,7 @@ Phone_StartRinging: ; 9033f call PlaySFX call Phone_CallerTextbox call UpdateSprites - callba Function4d188 + callba PhoneRing_LoadEDTile ret ; 90355 @@ -614,7 +614,7 @@ HangUp_Wait20Frames: ; 90355 Phone_Wait20Frames ld c, 20 call DelayFrames - callba Function4d188 + callba PhoneRing_LoadEDTile ret ; 90363 diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 3954f5384..2aaf0d74e 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -2332,7 +2332,7 @@ FlyMap: ; 91c90 call TownMapBubble call TownMapPals - ld hl, VBGMap0 ; BG Map 0 + hlbgcoord 0, 0 ; BG Map 0 call TownMapBGUpdate call TownMapMon @@ -2371,12 +2371,12 @@ Function91d11: ; 91d11 call FillKantoMap call Function91de9 call TownMapPals - ld hl, VBGMap1 + hlbgcoord 0, 0, VBGMap1 call TownMapBGUpdate call FillJohtoMap call Function91de9 call TownMapPals - ld hl, VBGMap0 + hlbgcoord 0, 0 call TownMapBGUpdate ld b, $2 call GetSGBLayout @@ -2875,12 +2875,12 @@ Function92311: ; unreferenced call FillKantoMap call TownMapBubble call TownMapPals - ld hl, VBGMap1 + hlbgcoord 0, 0, VBGMap1 call TownMapBGUpdate call FillJohtoMap call TownMapBubble call TownMapPals - ld hl, VBGMap0 + hlbgcoord 0, 0 call TownMapBGUpdate call TownMapMon ld a, c diff --git a/engine/save.asm b/engine/save.asm index f314cd4b5..68189b7d1 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -1,9 +1,9 @@ SaveMenu: ; 14a1a call LoadStandardMenuDataHeader - callba Function5e9a + callba DisplaySaveInfoOnSave call SpeechTextBox call UpdateSprites - callba SaveMenu_LoadDETile + callba SaveMenu_LoadEDTile ld hl, UnknownText_0x15283 call SaveTheGame_yesorno jr nz, .refused @@ -19,7 +19,7 @@ SaveMenu: ; 14a1a .refused call ExitMenu call Functiond90 - callba SaveMenu_LoadDETile + callba SaveMenu_LoadEDTile scf ret diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 6f53bb6b3..dab0e2361 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -26,7 +26,7 @@ Function926f7: ; 926f7 (24:66f7) call PlayMusic call DelayFrame call DisableLCD - ld hl, VBGMap0 tile $00 + hlbgcoord 0, 0 lb bc, 4, 0 ld a, $7f call ByteFill diff --git a/engine/specials.asm b/engine/specials.asm index 29c4da492..e2b4e6195 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -66,11 +66,11 @@ SpecialsPointers:: ; c029 add_special Special_CardFlip add_special Special_DummyNonfunctionalGameCornerGame add_special Special_ClearBGPalettesBufferScreen - add_special FadeOutPalettes + add_special RotatePalettesRightPalettes add_special Special_BattleTowerFade add_special Special_FadeBlackQuickly - add_special FadeInPalettes - add_special Special_FadeInQuickly + add_special RotatePalettesLeftPalettes + add_special Special_RotatePalettesLeftQuickly add_special Special_ReloadSpritesNoPalettes add_special ClearBGPalettes add_special UpdateTimePals @@ -126,7 +126,7 @@ SpecialsPointers:: ; c029 add_special SpecialTrainerHouse add_special PhotoStudio add_special InitRoamMons - add_special Special_FadeOutMusic + add_special Special_RotatePalettesRightMusic add_special Diploma add_special PrintDiploma @@ -616,7 +616,7 @@ SpecialGameboyCheck: ; c478 ret -Special_FadeOutMusic: ; c48f +Special_RotatePalettesRightMusic: ; c48f ld a, MUSIC_NONE % $100 ld [MusicFadeIDLo], a ld a, MUSIC_NONE / $100 diff --git a/engine/time_capsule/conversion.asm b/engine/time_capsule/conversion.asm index 4b5b1ef83..10f7ab5f3 100755 --- a/engine/time_capsule/conversion.asm +++ b/engine/time_capsule/conversion.asm @@ -364,7 +364,7 @@ NewPokedexEntry: ; fb877 pop af ld [wPokedexStatus], a call MaxVolume - call FadeToWhite + call RotateThreePalettesRight ld a, [hSCX] add $fb ld [hSCX], a diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 6ebb2a421..fac580f41 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -116,7 +116,7 @@ _UpdateTimePals:: ; 8c070 ret ; 8c079 -FadeInPalettes:: ; 8c079 +RotatePalettesLeftPalettes:: ; 8c079 ld c, $12 call GetTimePalFade ld b, $4 @@ -124,7 +124,7 @@ FadeInPalettes:: ; 8c079 ret ; 8c084 -FadeOutPalettes:: ; 8c084 +RotatePalettesRightPalettes:: ; 8c084 call Function8c0c1 ld c, $9 call GetTimePalFade @@ -150,7 +150,7 @@ endr ret ; 8c0ab -Special_FadeInQuickly: ; 8c0ab +Special_RotatePalettesLeftQuickly: ; 8c0ab ld c, $0 call GetTimePalFade ld b, $4 diff --git a/engine/timeset.asm b/engine/timeset.asm index 00cdf9cac..0b0f12718 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -15,7 +15,7 @@ InitClock: ; 90672 (24:4672) ld [MusicFadeIDHi], a ld c, 8 call DelayFrames - call Function4dd + call RotateFourPalettesLeft call ClearTileMap call ClearSprites ld b, SCGB_08 @@ -37,7 +37,7 @@ InitClock: ; 90672 (24:4672) call Request1bpp call .ClearScreen call WaitBGMap - call Function4a3 + call RotateFourPalettesRight ld hl, UnknownText_0x90874 call PrintText ld hl, wc608 diff --git a/engine/title.asm b/engine/title.asm index 0fbf8b42d..fc8dfa0e4 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -31,8 +31,8 @@ _TitleScreen: ; 10ed67 ; Clear screen palettes - ld hl, VBGMap0 - ld bc, $0280 + hlbgcoord 0, 0 + ld bc, 20 bgrows xor a call ByteFill @@ -42,8 +42,8 @@ _TitleScreen: ; 10ed67 ; BG Map 1: ; line 0 (copyright) - ld hl, VBGMap1 - ld bc, $0020 ; one row + hlbgcoord 0, 0, VBGMap1 + ld bc, 1 bgrows ld a, 7 ; palette call ByteFill @@ -53,41 +53,41 @@ _TitleScreen: ; 10ed67 ; Apply logo gradient: ; lines 3-4 - ld hl, VBGMap0 tile $06 ; (0,3) - ld bc, $0040 ; 2 rows + hlbgcoord 0, 3 + ld bc, 2 bgrows ld a, 2 call ByteFill ; line 5 - ld hl, VBGMap0 tile $0a ; (0,5) - ld bc, $0020 ; 1 row + hlbgcoord 0, 5 + ld bc, 1 bgrows ld a, 3 call ByteFill ; line 6 - ld hl, VBGMap0 tile $0c ; (0,6) - ld bc, $0020 ; 1 row + hlbgcoord 0, 6 + ld bc, 1 bgrows ld a, 4 call ByteFill ; line 7 - ld hl, VBGMap0 tile $0e ; (0,7) - ld bc, $0020 ; 1 row + hlbgcoord 0, 7 + ld bc, 1 bgrows ld a, 5 call ByteFill ; lines 8-9 - ld hl, VBGMap0 tile $10 ; (0,8) - ld bc, $0040 ; 2 rows + hlbgcoord 0, 8 + ld bc, 2 bgrows ld a, 6 call ByteFill ; 'CRYSTAL VERSION' - ld hl, $9925 ; (5,9) - ld bc, $000b ; length of version text + hlbgcoord 5, 9 + ld bc, NAME_LENGTH ; length of version text ld a, 1 call ByteFill ; Suicune gfx - ld hl, VBGMap0 tile $18 ; (0,12) - ld bc, $00c0 ; the rest of the screen + hlbgcoord 0, 12 + ld bc, 6 bgrows ; the rest of the screen ld a, 8 call ByteFill @@ -109,9 +109,9 @@ _TitleScreen: ; 10ed67 ; Clear screen tiles - ld hl, VBGMap0 - ld bc, $0800 - ld a, $7f + hlbgcoord 0, 0 + ld bc, 64 bgrows + ld a, " " call ByteFill ; Draw Pokemon logo @@ -122,7 +122,7 @@ _TitleScreen: ; 10ed67 call DrawTitleGraphic ; Draw copyright text - ld hl, $9c03 ; BGMap1(3,0) + hlbgcoord 3, 0, VBGMap1 lb bc, 1, 13 ld d, $c ld e, $10 @@ -270,7 +270,7 @@ SuicuneFrameIterator: ; 10eea7 LoadSuicuneFrame: ; 10eed2 hlcoord 6, 12 ld b, 6 -.row +.bgrows ld c, 8 .col ld a, d @@ -288,7 +288,7 @@ LoadSuicuneFrame: ; 10eed2 add d ld d, a dec b - jr nz, .row + jr nz, .bgrows ret ; 10eeef @@ -298,8 +298,8 @@ DrawTitleGraphic: ; 10eeef ; b: height ; c: width ; d: tile to start drawing from -; e: number of tiles to advance for each row -.row +; e: number of tiles to advance for each bgrows +.bgrows push de push bc push hl @@ -318,7 +318,7 @@ DrawTitleGraphic: ; 10eeef add d ld d, a dec b - jr nz, .row + jr nz, .bgrows ret ; 10ef06 diff --git a/event/field_moves.asm b/event/field_moves.asm index d6fa4a0bb..e12709b1e 100755 --- a/event/field_moves.asm +++ b/event/field_moves.asm @@ -7,7 +7,7 @@ PlayWhirlpoolSound: ; 8c7d4 ; 8c7e1 BlindingFlash: ; 8c7e1 - callba FadeOutPalettes + callba RotatePalettesRightPalettes ld hl, StatusFlags set 2, [hl] callba Function8c0e5 @@ -15,7 +15,7 @@ BlindingFlash: ; 8c7e1 ld b, SCGB_09 call GetSGBLayout callba Function49409 - callba FadeInPalettes + callba RotatePalettesLeftPalettes ret ; 8c80a diff --git a/event/halloffame.asm b/event/halloffame.asm index c4c901229..9aa088495 100755 --- a/event/halloffame.asm +++ b/event/halloffame.asm @@ -40,7 +40,7 @@ RedCredits:: ; 86455 ld [MusicFadeIDHi], a ld a, $a ld [MusicFade], a - callba FadeOutPalettes + callba RotatePalettesRightPalettes xor a ld [VramState], a ld [hMapAnims], a @@ -63,7 +63,7 @@ Function8648e: ; 8648e ld [MusicFadeIDHi], a ld a, 10 ld [MusicFade], a - callba FadeOutPalettes + callba RotatePalettesRightPalettes xor a ld [VramState], a ld [hMapAnims], a @@ -114,7 +114,7 @@ Function864c3: ; 864c3 call Function86810 ld a, $4 ld [MusicFade], a - call FadeToWhite + call RotateThreePalettesRight ld c, 8 call DelayFrames ret diff --git a/event/magnet_train.asm b/event/magnet_train.asm index 2c215ee63..d9c1a3ae9 100755 --- a/event/magnet_train.asm +++ b/event/magnet_train.asm @@ -158,7 +158,7 @@ endr ; 8cd27 DrawMagnetTrain: ; 8cd27 - ld hl, VBGMap0 + hlbgcoord 0, 0 xor a .asm_8cd2b call GetMagnetTrainBGTiles @@ -167,19 +167,19 @@ DrawMagnetTrain: ; 8cd27 inc a cp $12 jr c, .asm_8cd2b - ld hl, VBGMap0 tile $0c + hlbgcoord 0, 6 ld de, MagnetTrainTilemap1 ld c, 20 call .FillLine - ld hl, VBGMap0 tile $0e + hlbgcoord 0, 7 ld de, MagnetTrainTilemap2 ld c, 20 call .FillLine - ld hl, VBGMap0 tile $10 + hlbgcoord 0, 8 ld de, MagnetTrainTilemap3 ld c, 20 call .FillLine - ld hl, VBGMap0 tile $12 + hlbgcoord 0, 9 ld de, MagnetTrainTilemap4 ld c, 20 call .FillLine @@ -262,25 +262,25 @@ SetMagnetTrainPals: ; 8cdc3 ld [rVBK], a ; bushes - ld hl, VBGMap0 - ld bc, 8 tiles + hlbgcoord 0, 0 + ld bc, 4 bgrows ld a, $2 call ByteFill ; train - ld hl, VBGMap0 tile $08 - ld bc, 20 tiles + hlbgcoord 0, 4 + ld bc, 10 bgrows xor a call ByteFill ; more bushes - ld hl, VBGMap0 tile $1c - ld bc, 8 tiles + hlbgcoord 0, 14 + ld bc, 4 bgrows ld a, $2 call ByteFill ; train window - ld hl, VBGMap0 tile $10 + 7 + hlbgcoord 7, 8 ld bc, 6 ld a, $4 call ByteFill diff --git a/event/sacred_ash.asm b/event/sacred_ash.asm index 00b80bb46..1b0a4e244 100755 --- a/event/sacred_ash.asm +++ b/event/sacred_ash.asm @@ -52,12 +52,12 @@ SacredAshScript: ; 0x50821 special HealParty reloadmappart playsound SFX_WARP_TO - special FadeOutPalettes - special FadeInPalettes - special FadeOutPalettes - special FadeInPalettes - special FadeOutPalettes - special FadeInPalettes + special RotatePalettesRightPalettes + special RotatePalettesLeftPalettes + special RotatePalettesRightPalettes + special RotatePalettesLeftPalettes + special RotatePalettesRightPalettes + special RotatePalettesLeftPalettes waitbutton writetext UnknownText_0x50845 playsound SFX_CAUGHT_MON diff --git a/event/whiteout.asm b/event/whiteout.asm index 5cc0a07f9..405c6d530 100755 --- a/event/whiteout.asm +++ b/event/whiteout.asm @@ -10,7 +10,7 @@ Script_OverworldWhiteout:: ; 0x124c8 Script_Whiteout: ; 0x124ce writetext .WhitedOutText closetext - special FadeOutPalettes + special RotatePalettesRightPalettes pause 40 special HealParty checkflag ENGINE_BUG_CONTEST_TIMER @@ -37,7 +37,7 @@ OverworldBGMap: ; 124fa call ClearScreen call Function3200 call HideSprites - call Function4f0 + call RotateThreePalettesLeft ret ; 1250a diff --git a/home.asm b/home.asm index 95ca0549d..cb605bf2c 100644 --- a/home.asm +++ b/home.asm @@ -579,7 +579,7 @@ Function321c:: ; 321c ld a, 1 ld [hBGMapMode], a - jr LoadDETile + jr LoadEDTile .dmg ; WaitBGMap @@ -595,8 +595,8 @@ Function3238:: ; 3238 and a jr z, WaitBGMap -LoadDETile:: ; 323d - jr .LoadDETile +LoadEDTile:: ; 323d + jr .LoadEDTile ; 323f .unreferenced_323f ; 323f @@ -604,7 +604,7 @@ LoadDETile:: ; 323d ret ; 3246 -.LoadDETile ; 3246 +.LoadEDTile ; 3246 ld a, [hBGMapMode] push af xor a diff --git a/home/audio.asm b/home/audio.asm index 191366d0d..490f076a0 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -312,13 +312,13 @@ VolumeOff:: ; 3ca3 ret ; 3ca8 -Unused_FadeOutMusic:: ; 3ca8 +Unused_RotatePalettesRightMusic:: ; 3ca8 ld a, 4 ld [MusicFade], a ret ; 3cae -FadeInMusic:: ; 3cae +RotatePalettesLeftMusic:: ; 3cae ld a, 4 | 1 << 7 ld [MusicFade], a ret diff --git a/home/fade.asm b/home/fade.asm index 2559a0eb7..579a4125a 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -8,10 +8,10 @@ Function48c:: ; 48c ld a, l sub b ld l, a - jr nc, .asm_499 + jr nc, .okay dec h -.asm_499 +.okay ld a, [hli] ld [rBGP], a ld a, [hli] @@ -22,34 +22,34 @@ Function48c:: ; 48c ; 4a3 -Function4a3:: ; 4a3 +RotateFourPalettesRight:: ; 4a3 ld a, [hCGB] and a - jr z, .asm_4af + jr z, .dmg ld hl, IncGradGBPalTable_00 ld b, 4 - jr FadeOut + jr RotatePalettesRight -.asm_4af +.dmg ld hl, IncGradGBPalTable_08 ld b, 4 - jr FadeOut + jr RotatePalettesRight ; 4b6 -FadeToWhite:: ; 4b6 +RotateThreePalettesRight:: ; 4b6 ld a, [hCGB] and a - jr z, .asm_4c2 + jr z, .dmg ld hl, IncGradGBPalTable_05 ld b, 3 - jr FadeOut + jr RotatePalettesRight -.asm_4c2 +.dmg ld hl, IncGradGBPalTable_13 ld b, 3 -; 4c7 - -FadeOut:: ; 4c7 +RotatePalettesRight:: ; 4c7 +; Rotate palettes to the right and fill with loaded colors from the left +; If we're already at the leftmost color, fill with the leftmost color push de ld a, [hli] call DmgToCgbBGPals @@ -62,39 +62,38 @@ FadeOut:: ; 4c7 call DelayFrames pop de dec b - jr nz, FadeOut + jr nz, RotatePalettesRight ret ; 4dd -Function4dd:: ; 4dd +RotateFourPalettesLeft:: ; 4dd ld a, [hCGB] and a - jr z, .asm_4e9 + jr z, .dmg ld hl, IncGradGBPalTable_04 - 1 ld b, 4 - jr FadeIn + jr RotatePalettesLeft -.asm_4e9 +.dmg ld hl, IncGradGBPalTable_12 - 1 ld b, 4 - jr FadeIn + jr RotatePalettesLeft ; 4f0 -Function4f0:: ; 4f0 +RotateThreePalettesLeft:: ; 4f0 ld a, [hCGB] and a - jr z, .asm_4fc + jr z, .dmg ld hl, IncGradGBPalTable_07 - 1 ld b, 3 - jr FadeIn + jr RotatePalettesLeft -.asm_4fc +.dmg ld hl, IncGradGBPalTable_15 - 1 ld b, 3 - ; fallthrough -; 501 - -FadeIn:: ; 501 +RotatePalettesLeft:: ; 501 +; Rotate palettes to the left and fill with loaded colors from the right +; If we're already at the rightmost color, fill with the rightmost color push de ld a, [hld] ld d, a @@ -107,7 +106,7 @@ FadeIn:: ; 501 call DelayFrames pop de dec b - jr nz, FadeIn + jr nz, RotatePalettesLeft ret ; 517 @@ -117,17 +116,21 @@ IncGradGBPalTable_00:: db %11111111, %11111111, %11111111 IncGradGBPalTable_01:: db %11111110, %11111110, %11111110 IncGradGBPalTable_02:: db %11111001, %11111001, %11111001 IncGradGBPalTable_03:: db %11100100, %11100100, %11100100 + IncGradGBPalTable_04:: db %11100100, %11100100, %11100100 IncGradGBPalTable_05:: db %10010000, %10010000, %10010000 IncGradGBPalTable_06:: db %01000000, %01000000, %01000000 + IncGradGBPalTable_07:: db %00000000, %00000000, %00000000 ; bgp obp1 obp2 IncGradGBPalTable_08:: db %11111111, %11111111, %11111111 IncGradGBPalTable_09:: db %11111110, %11111110, %11111000 IncGradGBPalTable_10:: db %11111001, %11100100, %11100100 IncGradGBPalTable_11:: db %11100100, %11010000, %11100000 + IncGradGBPalTable_12:: db %11100100, %11010000, %11100000 IncGradGBPalTable_13:: db %10010000, %10000000, %10010000 IncGradGBPalTable_14:: db %01000000, %01000000, %01000000 + IncGradGBPalTable_15:: db %00000000, %00000000, %00000000 ; 547 diff --git a/home/map.asm b/home/map.asm index 193f58bc6..07341674f 100644 --- a/home/map.asm +++ b/home/map.asm @@ -2007,7 +2007,7 @@ FadeToMenu:: ; 2b29 xor a ld [hBGMapMode], a call LoadStandardMenuDataHeader - callba FadeOutPalettes + callba RotatePalettesRightPalettes call ClearSprites call DisableSpriteUpdates ret @@ -2036,7 +2036,7 @@ Function2b5c:: ; 2b5c call GetSGBLayout callba Function49409 call Function3200 - callba FadeInPalettes + callba RotatePalettesLeftPalettes call EnableSpriteUpdates ret ; 2b74 diff --git a/home/time.asm b/home/time.asm index d7010278e..7fb24028a 100644 --- a/home/time.asm +++ b/home/time.asm @@ -101,7 +101,7 @@ FixDays:: ; 5e8 ; update dl ld [hRTCDayLo], a ; DL -; flag for s0_ac60 +; flag for sRTCStatusFlags ld a, %01000000 jr .set @@ -120,7 +120,7 @@ FixDays:: ; 5e8 ; update dl ld [hRTCDayLo], a ; DL -; flag for s0_ac60 +; flag for sRTCStatusFlags ld a, %00100000 .set @@ -277,23 +277,23 @@ SetClock:: ; 691 ; 6c4 -Function6c4:: ; 6c4 -; clear s0_ac60 +ClearRTCStatus:: ; 6c4 +; clear sRTCStatusFlags xor a push af - ld a, BANK(s0_ac60) + ld a, BANK(sRTCStatusFlags) call GetSRAMBank pop af - ld [s0_ac60], a + ld [sRTCStatusFlags], a call CloseSRAM ret ; 6d3 -Function6d3:: ; 6d3 -; append flags to s0_ac60 - ld hl, s0_ac60 +RecordRTCStatus:: ; 6d3 +; append flags to sRTCStatusFlags + ld hl, sRTCStatusFlags push af - ld a, BANK(s0_ac60) + ld a, BANK(sRTCStatusFlags) call GetSRAMBank pop af or [hl] @@ -302,11 +302,11 @@ Function6d3:: ; 6d3 ret ; 6e3 -Function6e3:: ; 6e3 -; check s0_ac60 - ld a, BANK(s0_ac60) +CheckRTCStatus:: ; 6e3 +; check sRTCStatusFlags + ld a, BANK(sRTCStatusFlags) call GetSRAMBank - ld a, [s0_ac60] + ld a, [sRTCStatusFlags] call CloseSRAM ret ; 6ef diff --git a/items/item_effects.asm b/items/item_effects.asm index e97423fbd..6ab6f6c14 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -605,7 +605,7 @@ endr ld b, 0 callba NamingScreen - call FadeToWhite + call RotateThreePalettesRight call LoadStandardFont @@ -686,7 +686,7 @@ endr ld hl, Text_SentToBillsPC call PrintText - call FadeToWhite + call RotateThreePalettesRight call LoadStandardFont jr .return_from_capture diff --git a/macros.asm b/macros.asm index 5129e2960..4f736ffeb 100644 --- a/macros.asm +++ b/macros.asm @@ -221,3 +221,16 @@ endc endm depixel EQUS "ldpixel de," + +bgcoord: MACRO +IF _NARG == 4 + ld \1, \3 * $20 + \2 + \4 +ELSE + ld \1, \3 * $20 + \2 + VBGMap0 +ENDC +ENDM + +hlbgcoord EQUS "bgcoord hl," +debgcoord EQUS "bgcoord de," +bcbgcoord EQUS "bgcoord bc," +bgrows EQUS "* $20" diff --git a/macros/charmap.asm b/macros/charmap.asm index 73446d8e7..9eee57a0e 100644 --- a/macros/charmap.asm +++ b/macros/charmap.asm @@ -35,6 +35,7 @@ ; Actual characters charmap "▲", $61 charmap "_", $62 + charmap "", $6d ; necessary because ":" is already used charmap "′", $6e charmap "", $6e charmap "″", $6f diff --git a/main.asm b/main.asm index a185662ab..044f5fd42 100644 --- a/main.asm +++ b/main.asm @@ -14,12 +14,12 @@ Function4000:: ; 4000 jr z, .notinbattle call TextBox - jr .incave + jr .proceed .notinbattle predef Function28eef -.incave +.proceed hlcoord 4, 11 ld de, .Waiting call PlaceString @@ -58,1430 +58,7 @@ PushOAMEnd INCLUDE "engine/map_objects.asm" - -Function5ae8: ; 5ae8 - ld de, MUSIC_NONE - call PlayMusic - call DelayFrame - ld de, MUSIC_MAIN_MENU - ld a, e - ld [wMapMusic], a - call PlayMusic - callba MainMenu - jp Function6219 -; 5b04 - -; unreferenced - ret -; 5b05 - -PrintDayOfWeek: ; 5b05 - push de - ld hl, .Days - ld a, b - call GetNthString - ld d, h - ld e, l - pop hl - call PlaceString - ld h, b - ld l, c - ld de, .Day - call PlaceString - ret -; 5b1c - -.Days ; 5b1c - db "SUN@" - db "MON@" - db "TUES@" - db "WEDNES@" - db "THURS@" - db "FRI@" - db "SATUR@" -; 5b40 - -.Day ; 5b40 - db "DAY@" -; 5b44 - -NewGame_ClearTileMapEtc: ; 5b44 - xor a - ld [hMapAnims], a - call ClearTileMap - call LoadFontsExtra - call LoadStandardFont - call ResetTextRelatedRAM - ret -; 5b54 - -MysteryGift: ; 5b54 - call UpdateTime - callba DoMysteryGiftIfDayHasPassed - callba DoMysteryGift - ret -; 5b64 - -OptionsMenu: ; 5b64 - callba _OptionsMenu - ret -; 5b6b - -NewGame: ; 5b6b - xor a - ld [wc2cc], a - call ResetWRAM - call NewGame_ClearTileMapEtc - call AreYouABoyOrAreYouAGirl - call OakSpeech - call InitializeWorld - ld a, 1 - ld [wPreviousLandmark], a - - ld a, SPAWN_HOME - ld [DefaultSpawnpoint], a - - ld a, MAPSETUP_WARP - ld [hMapEntryMethod], a - jp FinishContinueFunction -; 5b8f - -AreYouABoyOrAreYouAGirl: ; 5b8f - callba Function10632f ; some mobile stuff - jr c, .ok - callba InitGender - ret - -.ok - ld c, 0 - callba Function4802f - ret -; 5ba7 - -ResetWRAM: ; 5ba7 - xor a - ld [hBGMapMode], a - call _ResetWRAM - ret -; 5bae - -_ResetWRAM: ; 5bae - - ld hl, Sprites - ld bc, Options - Sprites - xor a - call ByteFill - - ld hl, wd000 - ld bc, wGameData - wd000 - xor a - call ByteFill - - ld hl, wGameData - ld bc, wGameDataEnd - wGameData - xor a - call ByteFill - - ld a, [rLY] - ld [hSecondsBackup], a - call DelayFrame - ld a, [hRandomSub] - ld [PlayerID], a - - ld a, [rLY] - ld [hSecondsBackup], a - call DelayFrame - ld a, [hRandomAdd] - ld [PlayerID + 1], a - - call Random - ld [wSecretID], a - call DelayFrame - call Random - ld [wSecretID + 1], a - - ld hl, PartyCount - call InitList - - xor a - ld [wCurBox], a - ld [wSavedAtLeastOnce], a - - call SetDefaultBoxNames - - ld a, BANK(sBoxCount) - call GetSRAMBank - ld hl, sBoxCount - call InitList - call CloseSRAM - - ld hl, NumItems - call InitList - - ld hl, NumKeyItems - call InitList - - ld hl, NumBalls - call InitList - - ld hl, PCItems - call InitList - - xor a - ld [wRoamMon1Species], a - ld [wRoamMon2Species], a - ld [wRoamMon3Species], a - ld a, -1 - ld [wRoamMon1MapGroup], a - ld [wRoamMon2MapGroup], a - ld [wRoamMon3MapGroup], a - ld [wRoamMon1MapNumber], a - ld [wRoamMon2MapNumber], a - ld [wRoamMon3MapNumber], a - - ld a, BANK(sMysteryGiftItem) - call GetSRAMBank - ld hl, sMysteryGiftItem - xor a - ld [hli], a - dec a - ld [hl], a - call CloseSRAM - - call LoadOrRegenerateLuckyIDNumber - call InitializeMagikarpHouse - - xor a - ld [MonType], a - - ld [JohtoBadges], a - ld [KantoBadges], a - - ld [Coins], a - ld [Coins + 1], a - -START_MONEY EQU 3000 - -IF START_MONEY / $10000 - ld a, START_MONEY / $10000 -ENDC - ld [Money], a - ld a, START_MONEY / $100 % $100 - ld [Money + 1], a - ld a, START_MONEY % $100 - ld [Money + 2], a - - xor a - ld [wdc17], a - - ld hl, wdc19 - ld [hl], 2300 / $10000 - inc hl - ld [hl], 2300 / $100 % $100 - inc hl - ld [hl], 2300 % $100 - - call InitializeNPCNames - - callba InitDecorations - - callba DeletePartyMonMail - - callba DeleteMobileEventIndex - - call ResetGameTime - ret -; 5ca1 - -InitList: ; 5ca1 -; Loads 0 in the count and -1 in the first item or mon slot. - xor a - ld [hli], a - dec a - ld [hl], a - ret -; 5ca6 - -SetDefaultBoxNames: ; 5ca6 - ld hl, wBoxNames - ld c, 0 -.loop - push hl - ld de, .Box - call CopyName2 - dec hl - ld a, c - inc a - cp 10 - jr c, .less - sub 10 - ld [hl], "1" - inc hl - -.less - add "0" - ld [hli], a - ld [hl], "@" - pop hl - ld de, 9 - add hl, de - inc c - ld a, c - cp NUM_BOXES - jr c, .loop - ret - -.Box - db "BOX@" -; 5cd3 - -InitializeMagikarpHouse: ; 5cd3 - ld hl, wBestMagikarpLengthFeet - ld a, $3 - ld [hli], a - ld a, $6 - ld [hli], a - ld de, .Ralph - call CopyName2 - ret -; 5ce3 - -.Ralph ; 5ce3 - db "RALPH@" -; 5ce9 - -InitializeNPCNames: ; 5ce9 - ld hl, .Rival - ld de, RivalName - call .Copy - - ld hl, .Mom - ld de, MomsName - call .Copy - - ld hl, .Red - ld de, RedsName - call .Copy - - ld hl, .Green - ld de, GreensName - -.Copy - ld bc, NAME_LENGTH - call CopyBytes - ret - -.Rival db "???@" -.Red db "RED@" -.Green db "GREEN@" -.Mom db "MOM@" -; 5d23 - -InitializeWorld: ; 5d23 - call ShrinkPlayer - callba GetSpawnCoord - callba _InitializeStartDay - ret -; 5d33 - -LoadOrRegenerateLuckyIDNumber: ; 5d33 - ld a, BANK(sLuckyIDNumber) - call GetSRAMBank - ld a, [CurDay] - inc a - ld b, a - ld a, [sLuckyNumberDay] - cp b - ld a, [sLuckyIDNumber + 1] - ld c, a - ld a, [sLuckyIDNumber] - jr z, .skip - ld a, b - ld [sLuckyNumberDay], a - call Random - ld c, a - call Random - -.skip - ld [wLuckyIDNumber], a - ld [sLuckyIDNumber], a - ld a, c - ld [wLuckyIDNumber + 1], a - ld [sLuckyIDNumber + 1], a - jp CloseSRAM -; 5d65 - -Continue: ; 5d65 - callba TryLoadSaveFile - jr c, .FailToLoad - callba Function150b9 - call LoadStandardMenuDataHeader - call Function5e85 - ld a, $1 - ld [hBGMapMode], a - ld c, 20 - call DelayFrames - call ConfirmContinue - jr nc, .Check1Pass - call WriteBackup - jr .FailToLoad - -.Check1Pass - call Function5e48 - jr nc, .Check2Pass - call WriteBackup - jr .FailToLoad - -.Check2Pass - ld a, $8 - ld [MusicFade], a - ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a - ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a - call ClearBGPalettes - call Function5df0 - call WriteBackup - call ClearTileMap - ld c, 20 - call DelayFrames - callba JumpRoamMons - callba Function105091 - callba Function140ae ; time-related - ld a, [wSpawnAfterChampion] - cp SPAWN_LANCE - jr z, .SpawnAfterE4 - ld a, MAPSETUP_CONTINUE - ld [hMapEntryMethod], a - jp FinishContinueFunction - -.FailToLoad - ret - -.SpawnAfterE4 - ld a, SPAWN_NEW_BARK - ld [wd001], a - call PostCreditsSpawn - jp FinishContinueFunction -; 5de2 - -SpawnAfterRed: ; 5de2 - ld a, SPAWN_MT_SILVER - ld [wd001], a -; 5de7 - -PostCreditsSpawn: ; 5de7 - xor a - ld [wSpawnAfterChampion], a - ld a, MAPSETUP_WARP - ld [hMapEntryMethod], a - ret -; 5df0 - -Function5df0: ; 5df0 - callba Function10632f - ret nc - ld hl, wd479 - bit 1, [hl] - ret nz - ld a, $5 - ld [MusicFade], a - ld a, MUSIC_MOBILE_ADAPTER_MENU % $100 - ld [MusicFadeIDLo], a - ld a, MUSIC_MOBILE_ADAPTER_MENU / $100 - ld [MusicFadeIDHi], a - ld c, 20 - call DelayFrames - ld c, $1 - callba Function4802f - callba _SaveData - ld a, $8 - ld [MusicFade], a - ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a - ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a - ld c, 35 - call DelayFrames - ret -; 5e34 - -ConfirmContinue: ; 5e34 -.loop - call DelayFrame - call GetJoypad - ld hl, hJoyPressed - bit 0, [hl] - jr nz, .PressA - bit 1, [hl] - jr z, .loop - scf - ret - -.PressA - ret -; 5e48 - -Function5e48: ; 5e48 - call Function6e3 - and %10000000 ; Day count exceeded 16383 - jr z, .pass - callba RestartClock - ld a, c - and a - jr z, .pass - scf - ret - -.pass - xor a - ret -; 5e5d - -FinishContinueFunction: ; 5e5d -.loop - xor a - ld [wc2c1], a - ld [wLinkMode], a - ld hl, GameTimerPause - set 0, [hl] - res 7, [hl] - ld hl, wEnteredMapFromContinue - set 1, [hl] - callba OverworldLoop - ld a, [wSpawnAfterChampion] - cp SPAWN_RED - jr z, .AfterRed - jp Reset - -.AfterRed - call SpawnAfterRed - jr .loop -; 5e85 - -Function5e85: ; 5e85 - call Function6e3 - and $80 - jr z, .asm_5e93 - lb de, 4, 8 - call Function5eaf - ret - -.asm_5e93 - lb de, 4, 8 - call Function5e9f - ret -; 5e9a - -Function5e9a: ; 5e9a - lb de, 4, 0 - jr Function5e9f -; 5e9f - -Function5e9f: ; 5e9f - call Function5ebf - call Function5f1c - call Function5f40 - call LoadFontsExtra - call UpdateSprites - ret -; 5eaf - -Function5eaf: ; 5eaf - call Function5ebf - call Function5f1c - call Function5f48 - call LoadFontsExtra - call UpdateSprites - ret -; 5ebf - -Function5ebf: ; 5ebf - xor a - ld [hBGMapMode], a - ld hl, MenuDataHeader_0x5ed9 - ld a, [StatusFlags] - bit 0, a ; pokedex - jr nz, .asm_5ecf - ld hl, MenuDataHeader_0x5efb - -.asm_5ecf - call Function1e35 - call MenuBox - call Function1c89 - ret -; 5ed9 - -MenuDataHeader_0x5ed9: ; 5ed9 - db $40 ; flags - db 00, 00 ; start coords - db 09, 15 ; end coords - dw MenuData2_0x5ee1 - db 1 ; default option -; 5ee1 - -MenuData2_0x5ee1: ; 5ee1 - db $00 ; flags - db 4 ; items - db "PLAYER@" - db "BADGES@" - db "#DEX@" - db "TIME@" -; 5efb - -MenuDataHeader_0x5efb: ; 5efb - db $40 ; flags - db 00, 00 ; start coords - db 09, 15 ; end coords - dw MenuData2_0x5f03 - db 1 ; default option -; 5f03 - -MenuData2_0x5f03: ; 5f03 - db $00 ; flags - db 4 ; items - db "PLAYER @" - db "BADGES@" - db " @" - db "TIME@" -; 5f1c - - -Function5f1c: ; 5f1c - call MenuBoxCoord2Tile - push hl - ld de, $5d - add hl, de - call DisplayBadgeCount - pop hl - push hl - ld de, $84 - add hl, de - call DisplayPokedexNumCaught - pop hl - push hl - ld de, $30 - add hl, de - ld de, .Player - call PlaceString - pop hl - ret - -.Player - db "@" -; 5f40 - -Function5f40: ; 5f40 - ld de, $a9 - add hl, de - call DisplayGameTime - ret -; 5f48 - -Function5f48: ; 5f48 - ld de, $a9 - add hl, de - ld de, .text_5f53 - call PlaceString - ret - -.text_5f53 - db " ???@" -; 5f58 - -DisplayBadgeCount: ; 5f58 - push hl - ld hl, JohtoBadges - ld b, $2 - call CountSetBits - pop hl - ld de, wd265 - lb bc, 1, 2 - jp PrintNum -; 5f6b - -DisplayPokedexNumCaught: ; 5f6b - ld a, [StatusFlags] - bit 0, a - ret z - push hl - ld hl, PokedexCaught - ld b, $20 - call CountSetBits - pop hl - ld de, wd265 - lb bc, 1, 3 - jp PrintNum -; 5f84 - -DisplayGameTime: ; 5f84 - ld de, GameTimeHours - lb bc, 2, 3 - call PrintNum - ld [hl], $6d - inc hl - ld de, GameTimeMinutes - lb bc, PRINTNUM_LEADINGZEROS | 1, 2 - jp PrintNum -; 5f99 - - -OakSpeech: ; 0x5f99 - callba InitClock - call Function4dd - call ClearTileMap - - ld de, MUSIC_ROUTE_30 - call PlayMusic - - call Function4a3 - call FadeToWhite - xor a - ld [CurPartySpecies], a - ld a, POKEMON_PROF - ld [TrainerClass], a - call Intro_PrepTrainerPic - - ld b, SCGB_1C - call GetSGBLayout - call Intro_FadeInFrontpic - - ld hl, OakText1 - call PrintText - call FadeToWhite - call ClearTileMap - - ld a, WOOPER - ld [CurSpecies], a - ld [CurPartySpecies], a - call GetBaseData - - hlcoord 6, 4 - call PrepMonFrontpic - - xor a - ld [TempMonDVs], a - ld [TempMonDVs + 1], a - - ld b, SCGB_1C - call GetSGBLayout - call Intro_WipeInFrontpic - - ld hl, OakText2 - call PrintText - ld hl, OakText4 - call PrintText - call FadeToWhite - call ClearTileMap - - xor a - ld [CurPartySpecies], a - ld a, POKEMON_PROF - ld [TrainerClass], a - call Intro_PrepTrainerPic - - ld b, SCGB_1C - call GetSGBLayout - call Intro_FadeInFrontpic - - ld hl, OakText5 - call PrintText - call FadeToWhite - call ClearTileMap - - xor a - ld [CurPartySpecies], a - callba DrawIntroPlayerPic - - ld b, SCGB_1C - call GetSGBLayout - call Intro_FadeInFrontpic - - ld hl, OakText6 - call PrintText - call NamePlayer - ld hl, OakText7 - call PrintText - ret - -OakText1: ; 0x6045 - text_jump _OakText1 - db "@" - -OakText2: ; 0x604a - text_jump _OakText2 - start_asm - ld a, WOOPER - call PlayCry - call WaitSFX - ld hl, OakText3 - ret - -OakText3: ; 0x605b - text_jump _OakText3 - db "@" - -OakText4: ; 0x6060 - text_jump _OakText4 - db "@" - -OakText5: ; 0x6065 - text_jump _OakText5 - db "@" - -OakText6: ; 0x606a - text_jump _OakText6 - db "@" - -OakText7: ; 0x606f - text_jump _OakText7 - db "@" - -NamePlayer: ; 0x6074 - callba MovePlayerPicRight - callba ShowPlayerNamingChoices - ld a, [MenuSelection2] - dec a - jr z, .NewName - call StorePlayerName - callba Function8c1d - callba MovePlayerPicLeft - ret - -.NewName - ld b, 1 - ld de, PlayerName - callba NamingScreen - - call FadeToWhite - call ClearTileMap - - call LoadFontsExtra - call WaitBGMap - - xor a - ld [CurPartySpecies], a - callba DrawIntroPlayerPic - - ld b, SCGB_1C - call GetSGBLayout - call Function4f0 - - ld hl, PlayerName - ld de, .Chris - ld a, [PlayerGender] - bit 0, a - jr z, .Male - ld de, .Kris -.Male - call InitName - ret - -.Chris - db "CHRIS@@@@@@" -.Kris - db "KRIS@@@@@@@" -; 60e9 - -Function60e9: ; Unreferenced - call LoadMenuDataHeader - call InterpretMenu2 - ld a, [MenuSelection2] - dec a - call CopyNameFromMenu - call WriteBackup - ret -; 60fa - -StorePlayerName: ; 60fa - ld a, "@" - ld bc, NAME_LENGTH - ld hl, PlayerName - call ByteFill - ld hl, PlayerName - ld de, StringBuffer2 - call CopyName2 - ret -; 610f - -ShrinkPlayer: ; 610f - - ld a, [hROMBank] - push af - - 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 PlaySFX - pop af - rst Bankswitch - - ld c, 8 - call DelayFrames - - ld hl, Shrink1Pic - ld b, BANK(Shrink1Pic) - call ShrinkFrame - - ld c, 8 - call DelayFrames - - ld hl, Shrink2Pic - ld b, BANK(Shrink2Pic) - call ShrinkFrame - - ld c, 8 - call DelayFrames - - hlcoord 6, 5 - ld b, 7 - ld c, 7 - call ClearBox - - ld c, 3 - call DelayFrames - - call Intro_PlacePlayerSprite - call LoadFontsExtra - - ld c, 50 - call DelayFrames - - call FadeToWhite - call ClearTileMap - ret -; 616a - -Intro_FadeInFrontpic: ; 616a - ld hl, IntroFadePalettes - ld b, IntroFadePalettesEnd - IntroFadePalettes -.loop - ld a, [hli] - call DmgToCgbBGPals - ld c, 10 - call DelayFrames - dec b - jr nz, .loop - ret -; 617c - -IntroFadePalettes: ; 0x617c - db %01010100 - db %10101000 - db %11111100 - db %11111000 - db %11110100 - db %11100100 -IntroFadePalettesEnd -; 6182 - -Intro_WipeInFrontpic: ; 6182 - ld a, $77 - ld [hWX], a - call DelayFrame - ld a, %11100100 - call DmgToCgbBGPals -.loop - call DelayFrame - ld a, [hWX] - sub $8 - cp -1 - ret z - ld [hWX], a - jr .loop -; 619c - -Intro_PrepTrainerPic: ; 619c - ld de, VTiles2 - callba GetTrainerPic - xor a - ld [hFillBox], a - hlcoord 6, 4 - lb bc, 7, 7 - predef FillBox - ret -; 61b4 - -ShrinkFrame: ; 61b4 - ld de, VTiles2 - ld c, $31 - predef DecompressPredef - xor a - ld [hFillBox], a - hlcoord 6, 4 - lb bc, 7, 7 - predef FillBox - ret -; 61cd - -Intro_PlacePlayerSprite: ; 61cd - - callba GetPlayerIcon - ld c, $c - ld hl, VTiles0 - call Request2bpp - - ld hl, Sprites - ld de, .sprites - ld a, [de] - inc de - - ld c, a -.loop - ld a, [de] - inc de - ld [hli], a - ld a, [de] - inc de - ld [hli], a - ld a, [de] - inc de - ld [hli], a - - ld b, 0 - ld a, [PlayerGender] - bit 0, a - jr z, .male - ld b, 1 -.male - ld a, b - - ld [hli], a - dec c - jr nz, .loop - ret -; 61fe - -.sprites ; 61fe - db 4 - db $4c, $48, 0 - db $4c, $50, 1 - db $54, $48, 2 - db $54, $50, 3 -; 620b - - -Function620b: ; 620b - callab Functione4579 - jr c, Function6219 - callba CrystalIntro - -Function6219: ; 6219 - ld a, [rSVBK] - push af - ld a, $5 - ld [rSVBK], a - - call TitleScreen - call DelayFrame -.loop - call Function627b - jr nc, .loop - - call ClearSprites - call ClearBGPalettes - - pop af - ld [rSVBK], a - - ld hl, rLCDC - res 2, [hl] - call ClearScreen - call Function3200 - xor a - ld [hLCDStatCustom], a - ld [hSCX], a - ld [hSCY], a - ld a, $7 - ld [hWX], a - ld a, $90 - ld [hWY], a - ld b, SCGB_08 - call GetSGBLayout - call UpdateTimePals - ld a, [wcf64] - cp $5 - jr c, .ok - xor a -.ok - ld e, a - ld d, 0 - ld hl, .jumptable_626a -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 626a - -.jumptable_626a - dw Function5ae8 - dw Function6389 - dw Function620b - dw Function620b - dw ResetClock -; 6274 - - -TitleScreen: ; 6274 - callba _TitleScreen - ret -; 627b - -Function627b: ; 627b - ld a, [wJumptableIndex] - bit 7, a - jr nz, .done_title - call TitleScreenScene - callba SuicuneFrameIterator - call DelayFrame - and a - ret - -.done_title - scf - ret -; 6292 - -Function6292: ; 6292 ; unreferenced - ld a, [hVBlankCounter] - and $7 - ret nz - ld hl, LYOverrides + $5f - ld a, [hl] - dec a - ld bc, 2 * SCREEN_WIDTH - call ByteFill - ret -; 62a3 - -TitleScreenScene: ; 62a3 - ld e, a - ld d, 0 - ld hl, .scenes -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; 62af - -.scenes - dw TitleScreenEntrance - dw TitleScreenTimer - dw TitleScreenMain - dw TitleScreenEnd -; 62b7 - -Function62b7: ; Unreferenced - ld hl, wJumptableIndex - inc [hl] - ret -; 62bc - - -TitleScreenEntrance: ; 62bc - -; Animate the logo: -; Move each line by 4 pixels until our count hits 0. - ld a, [hSCX] - and a - jr z, .done - sub 4 - ld [hSCX], a - -; Lay out a base (all lines scrolling together). - ld e, a - ld hl, LYOverrides - ld bc, 8 * 10 ; logo height - call ByteFill - -; Reversed signage for every other line's position. -; This is responsible for the interlaced effect. - ld a, e - xor -1 - inc a - - ld b, 8 * 10 / 2 ; logo height / 2 - ld hl, LYOverrides + 1 -.loop - ld [hli], a - inc hl - dec b - jr nz, .loop - - callba AnimateTitleCrystal - ret - -.done -; Next scene - ld hl, wJumptableIndex - inc [hl] - xor a - ld [hLCDStatCustom], a - -; Play the title screen music. - ld de, MUSIC_TITLE - call PlayMusic - - ld a, $88 - ld [hWY], a - ret -; 62f6 - - -TitleScreenTimer: ; 62f6 - -; Next scene - ld hl, wJumptableIndex - inc [hl] - -; Start a timer - ld hl, wcf65 - ld de, $1140 ; 73.6 seconds - ld [hl], e - inc hl - ld [hl], d - ret -; 6304 - -TitleScreenMain: ; 6304 - -; Run the timer down. - ld hl, wcf65 - ld e, [hl] - inc hl - ld d, [hl] - ld a, e - or d - jr z, .end - - dec de - ld [hl], d - dec hl - ld [hl], e - -; Save data can be deleted by pressing Up + B + Select. - call GetJoypad - ld hl, hJoyDown - ld a, [hl] - and D_UP + B_BUTTON + SELECT - cp D_UP + B_BUTTON + SELECT - jr z, .delete_save_data - -; To bring up the clock reset dialog: - -; Hold Down + B + Select to initiate the sequence. - ld a, [$ffeb] - cp $34 - jr z, .check_clock_reset - - ld a, [hl] - and D_DOWN + B_BUTTON + SELECT - cp D_DOWN + B_BUTTON + SELECT - jr nz, .check_start - - ld a, $34 - ld [$ffeb], a - jr .check_start - -; Keep Select pressed, and hold Left + Up. -; Then let go of Select. -.check_clock_reset - bit 2, [hl] ; SELECT - jr nz, .check_start - - xor a - ld [$ffeb], a - - ld a, [hl] - and D_LEFT + D_UP - cp D_LEFT + D_UP - jr z, .clock_reset - -; Press Start or A to start the game. -.check_start - ld a, [hl] - and START | A_BUTTON - jr nz, .incave - ret - -.incave - ld a, 0 - jr .done - -.delete_save_data - ld a, 1 - -.done - ld [wcf64], a - -; Return to the intro sequence. - ld hl, wJumptableIndex - set 7, [hl] - ret - -.end -; Next scene - ld hl, wJumptableIndex - inc [hl] - -; Fade out the title screen music - xor a - ld [MusicFadeIDLo], a - ld [MusicFadeIDHi], a - ld hl, MusicFade - ld [hl], 8 ; 1 second - - ld hl, wcf65 - inc [hl] - ret - -.clock_reset - ld a, 4 - ld [wcf64], a - -; Return to the intro sequence. - ld hl, wJumptableIndex - set 7, [hl] - ret -; 6375 - -TitleScreenEnd: ; 6375 - -; Wait until the music is done fading. - - ld hl, wcf65 - inc [hl] - - ld a, [MusicFade] - and a - ret nz - - ld a, 2 - ld [wcf64], a - -; Back to the intro. - ld hl, wJumptableIndex - set 7, [hl] - ret -; 6389 - -Function6389: ; 6389 - callba Function4d54c - jp Init -; 6392 - -ResetClock: ; 6392 - callba _ResetClock - jp Init -; 639b - -Function639b: ; unreferenced - ; If bit 0 or 1 of [wcf65] is set, we don't need to be here. - ld a, [wcf65] - and $3 - ret nz - ld bc, SpriteAnim10 - ld hl, SpriteAnim10FrameIndex - SpriteAnim10 - add hl, bc ; over-the-top compicated way to load wc3ae into hl - ld l, [hl] - ld h, 0 -rept 2 - add hl, hl -endr - ld de, Data63ca - add hl, de - ; If bit 2 of [wcf65] is set, get the second dw; else, get the first dw - ld a, [wcf65] - and %00000100 -rept 2 - srl a -endr - ld e, a - ld d, 0 -rept 2 - add hl, de -endr - ld a, [hli] - and a - ret z - ld e, a - ld d, [hl] - ld a, SPRITE_ANIM_INDEX_01 - call _InitSpriteAnimStruct - ret -; 63ca - -Data63ca: ; 63ca -; frame 0 y, x; frame 1 y, x - db $5c, $50, $00, $00 - db $5c, $68, $5c, $58 - db $5c, $68, $5c, $78 - db $5c, $88, $5c, $78 - db $00, $00, $5c, $78 - db $00, $00, $5c, $58 -; 63e2 - -Copyright: ; 63e2 - call ClearTileMap - call LoadFontsExtra - ld de, CopyrightGFX - ld hl, VTiles2 tile $60 - lb bc, BANK(CopyrightGFX), $1d - call Request2bpp - hlcoord 2, 7 - ld de, CopyrightString - jp PlaceString -; 63fd - -CopyrightString: ; 63fd - ; ©1995-2001 Nintendo - db $60, $61, $62, $63, $64, $65, $66 - db $67, $68, $69, $6a, $6b, $6c - - db $4e - - ; ©1995-2001 Creatures inc. - db $60, $61, $62, $63, $64, $65, $66, $6d - db $6e, $6f, $70, $71, $72, $7a, $7b, $7c - - db $4e - - ; ©1995-2001 GAME FREAK inc. - db $60, $61, $62, $63, $64, $65, $66, $73, $74 - db $75, $76, $77, $78, $79, $7a, $7b, $7c - - db "@" -; 642e - -GameInit:: ; 642e - callba TryLoadSaveData - call ResetTextRelatedRAM - call ClearBGPalettes - call ClearTileMap - ld a, VBGMap0 / $100 - ld [hBGMapAddress + 1], a - xor a - ld [hBGMapAddress], a - ld [hJoyDown], a - ld [hSCX], a - ld [hSCY], a - ld a, $90 - ld [hWY], a - call WaitBGMap - jp Function620b -; 6454 +INCLUDE "engine/intro_menu.asm" Function6454:: ; 6454 call DelayFrame @@ -10745,10 +9322,10 @@ SaveRTC: ; 1406a ld a, $c ld [MBC3SRamBank], a res 7, [hl] - ld a, BANK(s0_ac60) + ld a, BANK(sRTCStatusFlags) ld [MBC3SRamBank], a xor a - ld [s0_ac60], a + ld [sRTCStatusFlags], a call CloseSRAM ret ; 14089 @@ -10762,7 +9339,7 @@ StartClock:: ; 14089 jr nc, .skip_set ; bit 5: Day count exceeds 139 ; bit 6: Day count exceeds 255 - call Function6d3 ; set flag on s0_ac60 + call RecordRTCStatus ; set flag on sRTCStatusFlags .skip_set call StartRTC @@ -10781,12 +9358,12 @@ Function1409b: ; 1409b .set_bit_7 ; Day count exceeds 16383 ld a, %10000000 - call Function6d3 ; set bit 7 on s0_ac60 + call RecordRTCStatus ; set bit 7 on sRTCStatusFlags ret ; 140ae Function140ae: ; 140ae - call Function6e3 + call CheckRTCStatus ld c, a and %11000000 ; Day count exceeded 255 or 16383 jr nz, .time_overflow @@ -19105,7 +17682,7 @@ EmptyAllSRAMBanks: ; 4cf1f ; 4cf45 -SaveMenu_LoadDETile: ; 4cf45 (13:4f45) +SaveMenu_LoadEDTile: ; 4cf45 (13:4f45) ld a, [hCGB] and a jp z, WaitBGMap @@ -19249,7 +17826,7 @@ endr ret ; 4d188 -Function4d188: ; 4d188 +PhoneRing_LoadEDTile: ; 4d188 ld a, [hCGB] and a jp z, WaitBGMap @@ -19275,11 +17852,11 @@ Function4d188: ; 4d188 ld a, 1 ; BANK(VBGMap2) ld [rVBK], a hlcoord 0, 0, AttrMap - call Function4d1cb + call .LoadEDTile ld a, 0 ; BANK(VBGMap0) ld [rVBK], a hlcoord 0, 0 - call Function4d1cb + call .LoadEDTile .wait2 ld a, [rLY] cp $8f @@ -19293,7 +17870,7 @@ Function4d188: ; 4d188 ret ; 4d1cb -Function4d1cb: ; 4d1cb +.LoadEDTile: ; 4d1cb ld [hSPBuffer], sp ld sp, hl ld a, [hBGMapAddress + 1] @@ -19458,10 +18035,10 @@ _ResetClock: ; 4d3b1 ret z call ClockResetPassword jr c, .wrongpassword - ld a, BANK(s0_ac60) + ld a, BANK(sRTCStatusFlags) call GetSRAMBank ld a, $80 - ld [s0_ac60], a + ld [sRTCStatusFlags], a call CloseSRAM ld hl, .text_okay call PrintText @@ -19680,7 +18257,7 @@ ClockResetPassword: ; 4d41e ld c, $2 call .ComponentFromNumber ld hl, sPlayerData + (PlayerName - wPlayerData) - ld c, $5 + ld c, $5 ; PLAYER_NAME_LENGTH_J call .ComponentFromString ld hl, sPlayerData + (Money - wPlayerData) ld c, $3 @@ -25211,13 +23788,13 @@ Function104309: ld [rVBK], a ld c, $8 ld hl, w6_d000 + $80 - ld de, VBGMap1 tile $00 + debgcoord 0, 0, VBGMap1 call Function104209 ld a, $0 ld [rVBK], a ld c, $8 ld hl, w6_d000 - ld de, VBGMap1 tile $00 + debgcoord 0, 0, VBGMap1 call Function104209 ret @@ -25515,13 +24092,13 @@ Function104770: ; 104770 (41:4770) ld [rVBK], a xor a lb bc, 4, 0 - ld hl, VBGMap0 tile $00 + hlbgcoord 0, 0 call ByteFill pop af ld [rVBK], a ld a, $60 lb bc, 4, 0 - ld hl, VBGMap0 tile $00 + hlbgcoord 0, 0 call ByteFill ret @@ -25536,7 +24113,7 @@ Function1047a3: ; 1047a3 (41:47a3) ld [rVBK], a Function1047b4: ; 1047b4 (41:47b4) - ld hl, VBGMap0 tile $00 + hlbgcoord 0, 0 ld c, $14 ld b, $12 .asm_1047bb @@ -26788,7 +25365,7 @@ Function105069: ; 105069 (41:5069) call GetMysteryGiftBank ld d, $0 ld b, $2 - ld hl, s0_abf0 + ld hl, sMysteryGiftDecorationsReceived predef_id FlagPredef push hl push bc @@ -26809,29 +25386,29 @@ Function105069: ; 105069 (41:5069) Function105091: ; 105091 (41:5091) call GetMysteryGiftBank ld c, $0 -.asm_105096 +.loop push bc ld d, $0 - ld b, $2 - ld hl, s0_abf0 + ld b, CHECK_FLAG + ld hl, sMysteryGiftDecorationsReceived predef FlagPredef ld a, c and a pop bc - jr z, .asm_1050b0 + jr z, .skip push bc callab SetSpecificDecorationFlag pop bc -.asm_1050b0 +.skip inc c ld a, c - cp $2a + 1 - jr c, .asm_105096 + cp Trophys - DecorationIDs + jr c, .loop jp CloseSRAM Special_UnlockMysteryGift: ; 1050b9 call GetMysteryGiftBank - ld hl, s0_abe3 + ld hl, sMysteryGiftUnlocked ld a, [hl] inc a jr nz, .ok diff --git a/maps/AzaleaTown.asm b/maps/AzaleaTown.asm index 95bd0b522..e3261b0a5 100644 --- a/maps/AzaleaTown.asm +++ b/maps/AzaleaTown.asm @@ -30,7 +30,7 @@ UnknownScript_0x198018: moveperson $b, $b, $b spriteface PLAYER, RIGHT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 appear $b applymovement $b, MovementData_0x198134 @@ -40,7 +40,7 @@ UnknownScript_0x198018: UnknownScript_0x198034: spriteface PLAYER, RIGHT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 appear $b applymovement $b, MovementData_0x19813c diff --git a/maps/BattleTowerBattleRoom.asm b/maps/BattleTowerBattleRoom.asm index 858b51fb0..07e0b8016 100644 --- a/maps/BattleTowerBattleRoom.asm +++ b/maps/BattleTowerBattleRoom.asm @@ -31,7 +31,7 @@ Script_BattleRoomLoop: ; 0x9f425 keeptextopen loadmovesprites special BattleTowerBattle ; calls predef startbattle - special FadeOutPalettes + special RotatePalettesRightPalettes reloadmap if_not_equal $0, Script_FailedBattleTowerChallenge copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64 @@ -46,10 +46,10 @@ Script_BattleRoomLoop: ; 0x9f425 closetext loadmovesprites playmusic MUSIC_HEAL - special FadeOutPalettes + special RotatePalettesRightPalettes special LoadMapPalettes pause 60 - special FadeInPalettes + special RotatePalettesLeftPalettes special RestartMapMusic loadfont writetext Text_NextUpOpponentNo @@ -73,7 +73,7 @@ Script_DontBattleNextOpponent: ; 0x9f483 special BattleTowerAction playsound SFX_SAVE waitbutton - special FadeOutPalettes + special RotatePalettesRightPalettes special Reset Script_DontSaveAndEndTheSession: ; 0x9f4a3 writetext Text_CancelYourBattleRoomChallenge @@ -84,7 +84,7 @@ Script_DontSaveAndEndTheSession: ; 0x9f4a3 writebyte BATTLE_TOWER_ACTION_06 special BattleTowerAction loadmovesprites - special FadeOutPalettes + special RotatePalettesRightPalettes warpfacing UP, BATTLE_TOWER_1F, $7, $7 loadfont jump UnknownScript_0x9e4b0 diff --git a/maps/BluesHouse.asm b/maps/BluesHouse.asm index 36d06b943..f15cbd1f3 100644 --- a/maps/BluesHouse.asm +++ b/maps/BluesHouse.asm @@ -30,10 +30,10 @@ UnknownScript_0x19b0de: writetext UnknownText_0x19b266 closetext loadmovesprites - special FadeOutPalettes + special RotatePalettesRightPalettes playmusic MUSIC_HEAL pause 60 - special FadeInPalettes + special RotatePalettesLeftPalettes special RestartMapMusic loadfont writetext UnknownText_0x19b296 diff --git a/maps/BurnedTower1F.asm b/maps/BurnedTower1F.asm index 2b78c59c9..414502613 100644 --- a/maps/BurnedTower1F.asm +++ b/maps/BurnedTower1F.asm @@ -49,7 +49,7 @@ UnknownScript_0x185c0d: UnknownScript_0x185c25: showemote EMOTE_SHOCK, $4, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 spriteface $4, RIGHT pause 15 @@ -98,7 +98,7 @@ UnknownScript_0x185c80: loadmovesprites dotrigger $2 setevent EVENT_RIVAL_BURNED_TOWER - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 earthquake 50 showemote EMOTE_SHOCK, PLAYER, 15 diff --git a/maps/CherrygroveCity.asm b/maps/CherrygroveCity.asm index 2731b774b..6da66fd62 100644 --- a/maps/CherrygroveCity.asm +++ b/maps/CherrygroveCity.asm @@ -103,7 +103,7 @@ UnknownScript_0x19c0aa: UnknownScript_0x19c0ae: spriteface PLAYER, RIGHT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 appear $3 applymovement $3, MovementData_0x19c1ce diff --git a/maps/CianwoodCity.asm b/maps/CianwoodCity.asm index 878369731..6bb1daada 100644 --- a/maps/CianwoodCity.asm +++ b/maps/CianwoodCity.asm @@ -66,7 +66,7 @@ UnknownScript_0x1a001e: applymovement $c, MovementData_0x1a00ec disappear $c pause 20 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic playmapmusic pause 10 .Done diff --git a/maps/DragonShrine.asm b/maps/DragonShrine.asm index cc89ac754..62fcf4acb 100644 --- a/maps/DragonShrine.asm +++ b/maps/DragonShrine.asm @@ -130,7 +130,7 @@ DragonShrineTestScript: writetext UnknownText_0x18d916 closetext loadmovesprites - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic applymovement $5, MovementData_0x18d2da loadfont writetext UnknownText_0x18d974 diff --git a/maps/DragonsDenB1F.asm b/maps/DragonsDenB1F.asm index e47ea7516..afeb0769a 100644 --- a/maps/DragonsDenB1F.asm +++ b/maps/DragonsDenB1F.asm @@ -70,7 +70,7 @@ UnknownScript_0x18c8f4: loadmovesprites UnknownScript_0x18c8f9: applymovement $3, MovementData_0x18c9b3 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 30 special RestartMapMusic disappear $3 diff --git a/maps/EcruteakGym.asm b/maps/EcruteakGym.asm index f3e136c9d..2e205fa8a 100644 --- a/maps/EcruteakGym.asm +++ b/maps/EcruteakGym.asm @@ -84,7 +84,7 @@ UnknownScript_0x99dc6: follow PLAYER, $8 applymovement PLAYER, MovementData_0x99e5f stopfollow - special FadeOutPalettes + special RotatePalettesRightPalettes playsound SFX_ENTER_DOOR waitbutton warp ECRUTEAK_CITY, $6, $1b diff --git a/maps/FastShip1F.asm b/maps/FastShip1F.asm index be1675a1b..ec41829db 100644 --- a/maps/FastShip1F.asm +++ b/maps/FastShip1F.asm @@ -64,7 +64,7 @@ SailorScript_0x75160: loadmovesprites scall .LetThePlayerOut playsound SFX_EXIT_BUILDING - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton setevent EVENT_VERMILION_PORT_SAILOR_AT_GANGWAY domaptrigger VERMILION_PORT, $1 @@ -77,7 +77,7 @@ SailorScript_0x75160: loadmovesprites scall .LetThePlayerOut playsound SFX_EXIT_BUILDING - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton setevent EVENT_OLIVINE_PORT_SAILOR_AT_GANGWAY domaptrigger OLIVINE_PORT, $1 diff --git a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm index 70759c740..69a499841 100644 --- a/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm +++ b/maps/FastShipCabins_SE_SSE_CaptainsCabin.asm @@ -43,7 +43,7 @@ TwinScript_0x75ebb: appear $4 spriteface PLAYER, UP spriteface $4, UP - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly spriteface $3, DOWN showemote EMOTE_SHOCK, $3, 15 applymovement $4, MovementData_0x7600c diff --git a/maps/FastShipCabins_SW_SSW_NW.asm b/maps/FastShipCabins_SW_SSW_NW.asm index 493ee070e..c459b1e7e 100644 --- a/maps/FastShipCabins_SW_SSW_NW.asm +++ b/maps/FastShipCabins_SW_SSW_NW.asm @@ -70,7 +70,7 @@ FastShipBed: playmusic MUSIC_HEAL pause 60 special RestartMapMusic - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly loadfont writetext FastShipBedText2 closetext diff --git a/maps/IlexForest.asm b/maps/IlexForest.asm index b87a3a179..851f50399 100644 --- a/maps/IlexForest.asm +++ b/maps/IlexForest.asm @@ -449,7 +449,7 @@ UnknownScript_0x6ee42: loadmovesprites pause 20 showemote EMOTE_SHOCK, PLAYER, 20 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic applymovement PLAYER, MovementData_0x6ef58 pause 30 spriteface PLAYER, DOWN diff --git a/maps/IndigoPlateauPokeCenter1F.asm b/maps/IndigoPlateauPokeCenter1F.asm index cefc1c2bb..5cce7f36c 100644 --- a/maps/IndigoPlateauPokeCenter1F.asm +++ b/maps/IndigoPlateauPokeCenter1F.asm @@ -55,7 +55,7 @@ UnknownScript_0x180053: appear $5 spriteface PLAYER, DOWN showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 applymovement $5, MovementData_0x180164 playmusic MUSIC_RIVAL_ENCOUNTER @@ -76,7 +76,7 @@ UnknownScript_0x180094: appear $5 spriteface PLAYER, DOWN showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 applymovement $5, MovementData_0x18016b playmusic MUSIC_RIVAL_ENCOUNTER @@ -154,7 +154,7 @@ TeleportGuyScript: closetext loadmovesprites playsound SFX_WARP_TO - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton warp NEW_BARK_TOWN, $d, $6 end diff --git a/maps/KurtsHouse.asm b/maps/KurtsHouse.asm index f8fa0721a..4a24daf72 100644 --- a/maps/KurtsHouse.asm +++ b/maps/KurtsHouse.asm @@ -40,7 +40,7 @@ KurtScript_0x18e178: writetext UnknownText_0x18e473 closetext loadmovesprites - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic setevent EVENT_AZALEA_TOWN_SLOWPOKETAIL_ROCKET checkcode VAR_FACING if_equal UP, .RunAround @@ -287,7 +287,7 @@ KurtScript_0x18e178: setevent EVENT_FOREST_IS_RESTLESS clearevent EVENT_CAN_GIVE_GS_BALL_TO_KURT clearevent EVENT_GAVE_GS_BALL_TO_KURT - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 20 showemote EMOTE_SHOCK, $2, 30 checkcode VAR_FACING diff --git a/maps/LancesRoom.asm b/maps/LancesRoom.asm index f9f03054f..549baf320 100644 --- a/maps/LancesRoom.asm +++ b/maps/LancesRoom.asm @@ -44,12 +44,12 @@ UnknownScript_0x180e53: end UnknownScript_0x180e6a: - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic applymovement PLAYER, MovementData_0x180f38 jump LanceScript_0x180e7b UnknownScript_0x180e74: - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic applymovement PLAYER, MovementData_0x180f3c LanceScript_0x180e7b: spriteface $2, LEFT @@ -125,7 +125,7 @@ LanceScript_0x180e7b: pause 30 loadmovesprites applymovement $3, MovementData_0x180f5b - special FadeOutPalettes + special RotatePalettesRightPalettes pause 15 warpfacing UP, HALL_OF_FAME, $4, $d end diff --git a/maps/MobileBattleRoom.asm b/maps/MobileBattleRoom.asm index c672c3b69..44ee3a5b1 100644 --- a/maps/MobileBattleRoom.asm +++ b/maps/MobileBattleRoom.asm @@ -35,11 +35,11 @@ MapMobileBattleRoomSignpost0Script: writetext MobileBattleRoom_HealText pause 20 loadmovesprites - special FadeOutPalettes + special RotatePalettesRightPalettes playmusic MUSIC_HEAL special LoadMapPalettes pause 60 - special FadeInPalettes + special RotatePalettesLeftPalettes special RestartMapMusic refreshscreen $0 .two_: diff --git a/maps/MountMoon.asm b/maps/MountMoon.asm index 09173be29..066fabf8a 100644 --- a/maps/MountMoon.asm +++ b/maps/MountMoon.asm @@ -19,7 +19,7 @@ UnknownScript_0x7408d: UnknownScript_0x7408e: spriteface PLAYER, RIGHT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 applymovement $2, MovementData_0x740f9 playmusic MUSIC_RIVAL_ENCOUNTER diff --git a/maps/MrPokemonsHouse.asm b/maps/MrPokemonsHouse.asm index aeac05928..cc1f22f21 100644 --- a/maps/MrPokemonsHouse.asm +++ b/maps/MrPokemonsHouse.asm @@ -114,7 +114,7 @@ UnknownScript_0x196ec9: special Mobile_HealParty special HealParty pause 60 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly special RestartMapMusic loadfont writetext UnknownText_0x197134 diff --git a/maps/OlivineCity.asm b/maps/OlivineCity.asm index 4c42e9dd5..ed89b3f1f 100644 --- a/maps/OlivineCity.asm +++ b/maps/OlivineCity.asm @@ -25,7 +25,7 @@ OlivineCity_MapScriptHeader: UnknownScript_0x1a8833: spriteface PLAYER, LEFT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 playsound SFX_ENTER_DOOR appear $5 @@ -49,7 +49,7 @@ UnknownScript_0x1a8833: UnknownScript_0x1a886b: spriteface PLAYER, LEFT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 playsound SFX_ENTER_DOOR appear $5 diff --git a/maps/OlivineLighthouse6F.asm b/maps/OlivineLighthouse6F.asm index aae5ed42e..b8986bad8 100644 --- a/maps/OlivineLighthouse6F.asm +++ b/maps/OlivineLighthouse6F.asm @@ -42,9 +42,9 @@ UnknownScript_0x60bab: loadmovesprites special RestartMapMusic cry AMPHAROS - special FadeOutPalettes + special RotatePalettesRightPalettes pause 10 - special FadeInPalettes + special RotatePalettesLeftPalettes loadfont writetext UnknownText_0x60f3d closetext @@ -116,10 +116,10 @@ UnknownScript_0x60c51: cry AMPHAROS closetext loadmovesprites - special FadeOutPalettes - special FadeInPalettes - special FadeOutPalettes - special FadeInPalettes + special RotatePalettesRightPalettes + special RotatePalettesLeftPalettes + special RotatePalettesRightPalettes + special RotatePalettesLeftPalettes end ItemFragment_0x60c66: diff --git a/maps/OlivinePort.asm b/maps/OlivinePort.asm index 38941d295..39d77694f 100644 --- a/maps/OlivinePort.asm +++ b/maps/OlivinePort.asm @@ -39,7 +39,7 @@ SailorScript_0x748c0: waitbutton applymovement PLAYER, MovementData_0x74a30 playsound SFX_EXIT_BUILDING - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton checkevent EVENT_FAST_SHIP_FIRST_TIME iffalse UnknownScript_0x7490a diff --git a/maps/RadioTower2F.asm b/maps/RadioTower2F.asm index 22619d10c..b4f5117ac 100644 --- a/maps/RadioTower2F.asm +++ b/maps/RadioTower2F.asm @@ -140,7 +140,7 @@ UnknownScript_0x5d7be: writetext UnknownText_0x5e054 closetext loadmovesprites - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 20 special RestartMapMusic checkcode VAR_BLUECARDBALANCE @@ -169,7 +169,7 @@ UnknownScript_0x5d81e: closetext loadmovesprites spriteface $b, RIGHT - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 20 special RestartMapMusic end @@ -200,7 +200,7 @@ UnknownScript_0x5d845: closetext loadmovesprites spriteface $b, RIGHT - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 20 special RestartMapMusic end diff --git a/maps/RadioTower5F.asm b/maps/RadioTower5F.asm index 32a363e55..3f1b16882 100644 --- a/maps/RadioTower5F.asm +++ b/maps/RadioTower5F.asm @@ -95,7 +95,7 @@ UnknownScript_0x6006e: disappear $3 disappear $4 pause 15 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly setevent EVENT_BEAT_ROCKET_EXECUTIVEM_1 setevent EVENT_CLEARED_RADIO_TOWER clearflag ENGINE_ROCKETS_IN_RADIO_TOWER diff --git a/maps/Route24.asm b/maps/Route24.asm index f8f24209f..0e6467288 100644 --- a/maps/Route24.asm +++ b/maps/Route24.asm @@ -21,7 +21,7 @@ RocketScript_0x1adbfa: loadfont writetext UnknownText_0x1addc0 keeptextopen - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic writetext UnknownText_0x1adee1 closetext loadmovesprites @@ -29,7 +29,7 @@ RocketScript_0x1adbfa: special Special_ReloadSpritesNoPalettes disappear $2 pause 25 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly playmapmusic end diff --git a/maps/Route26HealSpeechHouse.asm b/maps/Route26HealSpeechHouse.asm index 785daaeb2..e187b09d4 100644 --- a/maps/Route26HealSpeechHouse.asm +++ b/maps/Route26HealSpeechHouse.asm @@ -17,7 +17,7 @@ TeacherScript_0x7b125: playmusic MUSIC_HEAL special HealParty pause 60 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly special RestartMapMusic loadfont writetext UnknownText_0x7b18b diff --git a/maps/Route35NationalParkgate.asm b/maps/Route35NationalParkgate.asm index ba5c3516a..005b1f1fd 100644 --- a/maps/Route35NationalParkgate.asm +++ b/maps/Route35NationalParkgate.asm @@ -75,7 +75,7 @@ Route35NationalParkgate_GoBackIn: loadmovesprites scall Route35NationalParkgate_EnterContest playsound SFX_ENTER_DOOR - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton warpfacing UP, NATIONAL_PARK_BUG_CONTEST, $a, $2f end @@ -112,7 +112,7 @@ Route35NationalParkgate_OkayToProceed: special Special_GiveParkBalls scall Route35NationalParkgate_EnterContest playsound SFX_ENTER_DOOR - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton special Special_SelectRandomBugContestContestants warpfacing UP, NATIONAL_PARK_BUG_CONTEST, $a, $2f diff --git a/maps/Route36NationalParkgate.asm b/maps/Route36NationalParkgate.asm index 03c8c2474..495ef1856 100644 --- a/maps/Route36NationalParkgate.asm +++ b/maps/Route36NationalParkgate.asm @@ -74,7 +74,7 @@ Route36NationalParkgate_MapScriptHeader: appear $d applymovement PLAYER, MovementData_0x6add1 pause 15 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly jumpstd bugcontestresults .GoBackToContest: @@ -83,7 +83,7 @@ Route36NationalParkgate_MapScriptHeader: loadmovesprites spriteface PLAYER, LEFT playsound SFX_EXIT_BUILDING - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton warpfacing LEFT, NATIONAL_PARK_BUG_CONTEST, $21, $12 end @@ -166,7 +166,7 @@ Route36OfficerScriptContest: special Special_GiveParkBalls spriteface PLAYER, LEFT playsound SFX_EXIT_BUILDING - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton special Special_SelectRandomBugContestContestants warpfacing LEFT, NATIONAL_PARK_BUG_CONTEST, $21, $12 diff --git a/maps/SilverCaveRoom3.asm b/maps/SilverCaveRoom3.asm index 6c637f77c..b01588ba6 100644 --- a/maps/SilverCaveRoom3.asm +++ b/maps/SilverCaveRoom3.asm @@ -6,7 +6,7 @@ SilverCaveRoom3_MapScriptHeader: db 0 RedScript_0x18c603: - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic faceplayer loadfont writetext UnknownText_0x18c637 @@ -17,7 +17,7 @@ RedScript_0x18c603: startbattle reloadmapmusic returnafterbattle - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic loadfont writetext UnknownText_0x18c63f closetext @@ -26,7 +26,7 @@ RedScript_0x18c603: special Special_ReloadSpritesNoPalettes disappear $2 pause 15 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly pause 30 special HealParty refreshscreen $0 diff --git a/maps/SlowpokeWellB1F.asm b/maps/SlowpokeWellB1F.asm index 27b397543..1d98bf807 100644 --- a/maps/SlowpokeWellB1F.asm +++ b/maps/SlowpokeWellB1F.asm @@ -34,7 +34,7 @@ GruntM1Script: disappear $4 disappear $5 pause 15 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly disappear $8 moveperson $8, $b, $6 appear $8 @@ -56,7 +56,7 @@ GruntM1Script: clearevent EVENT_AZALEA_TOWN_SLOWPOKES clearevent EVENT_KURTS_HOUSE_SLOWPOKE clearevent EVENT_KURTS_HOUSE_KURT_1 - special FadeOutPalettes + special RotatePalettesRightPalettes special HealParty pause 15 warp KURTS_HOUSE, $3, $3 diff --git a/maps/SproutTower3F.asm b/maps/SproutTower3F.asm index 6b82aa611..06c85c22b 100644 --- a/maps/SproutTower3F.asm +++ b/maps/SproutTower3F.asm @@ -18,7 +18,7 @@ UnknownScript_0x184946: UnknownScript_0x184947: spriteface PLAYER, UP showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic playsound SFX_TACKLE playsound SFX_ELEVATOR earthquake 79 @@ -51,7 +51,7 @@ UnknownScript_0x184947: special Special_ReloadSpritesNoPalettes disappear $8 waitbutton - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly dotrigger $1 special RestartMapMusic end diff --git a/maps/TeamRocketBaseB1F.asm b/maps/TeamRocketBaseB1F.asm index e9e68a97d..5bd666972 100644 --- a/maps/TeamRocketBaseB1F.asm +++ b/maps/TeamRocketBaseB1F.asm @@ -445,9 +445,9 @@ ExplodingTrap22: end VoltorbExplodingTrap: - special FadeOutPalettes + special RotatePalettesRightPalettes cry VOLTORB - special FadeInPalettes + special RotatePalettesLeftPalettes setlasttalked $ff writecode VAR_BATTLETYPE, BATTLETYPE_TRAP loadpokedata VOLTORB, 23 @@ -455,9 +455,9 @@ VoltorbExplodingTrap: end GeodudeExplodingTrap: - special FadeOutPalettes + special RotatePalettesRightPalettes cry GEODUDE - special FadeInPalettes + special RotatePalettesLeftPalettes setlasttalked $ff writecode VAR_BATTLETYPE, BATTLETYPE_TRAP loadpokedata GEODUDE, 21 @@ -465,9 +465,9 @@ GeodudeExplodingTrap: end KoffingExplodingTrap: - special FadeOutPalettes + special RotatePalettesRightPalettes cry KOFFING - special FadeInPalettes + special RotatePalettesLeftPalettes setlasttalked $ff writecode VAR_BATTLETYPE, BATTLETYPE_TRAP loadpokedata KOFFING, 21 diff --git a/maps/TeamRocketBaseB2F.asm b/maps/TeamRocketBaseB2F.asm index 2a44c4652..39b8ea4fc 100644 --- a/maps/TeamRocketBaseB2F.asm +++ b/maps/TeamRocketBaseB2F.asm @@ -106,7 +106,7 @@ UnknownScript_0x6cfac: disappear $d disappear $e pause 15 - special Special_FadeInQuickly + special Special_RotatePalettesLeftQuickly dotrigger $2 clearevent EVENT_TEAM_ROCKET_BASE_B2F_LANCE spriteface $4, DOWN @@ -155,11 +155,11 @@ UnknownScript_0x6d091: writetext UnknownText_0x6da97 closetext loadmovesprites - special FadeOutPalettes + special RotatePalettesRightPalettes special Mobile_HealParty playsound SFX_FULL_HEAL special HealParty - special FadeInPalettes + special RotatePalettesLeftPalettes loadfont writetext UnknownText_0x6daf7 closetext diff --git a/maps/TeamRocketBaseB3F.asm b/maps/TeamRocketBaseB3F.asm index 39e2b2f67..76cd16b73 100644 --- a/maps/TeamRocketBaseB3F.asm +++ b/maps/TeamRocketBaseB3F.asm @@ -55,7 +55,7 @@ LanceScript_0x6dffc: UnknownScript_0x6e019: spriteface PLAYER, LEFT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic appear $a applymovement $a, MovementData_0x6e164 spriteface PLAYER, LEFT diff --git a/maps/TinTower1F.asm b/maps/TinTower1F.asm index ca4d0c1ff..5ac0f1665 100644 --- a/maps/TinTower1F.asm +++ b/maps/TinTower1F.asm @@ -158,7 +158,7 @@ UnknownScript_0x1850d7: playsound SFX_EXIT_BUILDING disappear $5 waitbutton - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 20 playmapmusic end diff --git a/maps/UndergroundPathSwitchRoomEntrances.asm b/maps/UndergroundPathSwitchRoomEntrances.asm index 82abe2e4a..f9cd1222f 100644 --- a/maps/UndergroundPathSwitchRoomEntrances.asm +++ b/maps/UndergroundPathSwitchRoomEntrances.asm @@ -80,7 +80,7 @@ TeacherScript_0x7ca7d: UnknownScript_0x7ca80: spriteface PLAYER, RIGHT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 playsound SFX_EXIT_BUILDING appear $c @@ -99,7 +99,7 @@ UnknownScript_0x7ca80: UnknownScript_0x7caaa: spriteface PLAYER, RIGHT showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 playsound SFX_EXIT_BUILDING appear $c diff --git a/maps/VermilionPort.asm b/maps/VermilionPort.asm index c9cb32207..fd48206eb 100644 --- a/maps/VermilionPort.asm +++ b/maps/VermilionPort.asm @@ -51,7 +51,7 @@ SailorScript_0x74dc4: waitbutton applymovement PLAYER, MovementData_0x74ef1 playsound SFX_EXIT_BUILDING - special FadeOutPalettes + special RotatePalettesRightPalettes waitbutton setevent EVENT_FAST_SHIP_PASSENGERS_EASTBOUND clearevent EVENT_FAST_SHIP_PASSENGERS_WESTBOUND diff --git a/maps/VictoryRoad.asm b/maps/VictoryRoad.asm index 056b30854..25f58022e 100644 --- a/maps/VictoryRoad.asm +++ b/maps/VictoryRoad.asm @@ -19,7 +19,7 @@ UnknownScript_0x74492: moveperson $2, $12, $b spriteface PLAYER, DOWN showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 appear $2 applymovement $2, MovementData_0x74539 @@ -33,7 +33,7 @@ UnknownScript_0x74492: UnknownScript_0x744b5: spriteface PLAYER, DOWN showemote EMOTE_SHOCK, PLAYER, 15 - special Special_FadeOutMusic + special Special_RotatePalettesRightMusic pause 15 appear $2 applymovement $2, MovementData_0x74542 diff --git a/maps/WarehouseEntrance.asm b/maps/WarehouseEntrance.asm index 2ef14fcc0..12b9ae2d6 100644 --- a/maps/WarehouseEntrance.asm +++ b/maps/WarehouseEntrance.asm @@ -226,10 +226,10 @@ OlderHaircutBrotherScript: writetext UnknownText_0x7c6b8 closetext loadmovesprites - special FadeOutPalettes + special RotatePalettesRightPalettes playmusic MUSIC_HEAL pause 60 - special FadeInPalettes + special RotatePalettesLeftPalettes special RestartMapMusic loadfont writetext UnknownText_0x7c6d8 @@ -309,10 +309,10 @@ YoungerHaircutBrotherScript: writetext UnknownText_0x7c80e closetext loadmovesprites - special FadeOutPalettes + special RotatePalettesRightPalettes playmusic MUSIC_HEAL pause 60 - special FadeInPalettes + special RotatePalettesLeftPalettes special RestartMapMusic loadfont writetext UnknownText_0x7c82a diff --git a/misc/mobile_12.asm b/misc/mobile_12.asm index 4e4eeec80..5f864ead2 100755 --- a/misc/mobile_12.asm +++ b/misc/mobile_12.asm @@ -1,4 +1,4 @@ -Function4802f: ; 4802f (12:402f) +InitMobileProfile: ; 4802f (12:402f) xor a set 6, a ld [wd002], a diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index 128fdf2b1..e0894795b 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -312,7 +312,7 @@ Function10016f: ; 10016f Function10020b: ; 10020b xor a ld [wc303], a - callba FadeOutPalettes + callba RotatePalettesRightPalettes callba Function106464 call HideSprites call DelayFrame @@ -1591,7 +1591,7 @@ Function1009d2: ; 1009d2 ld [rVBK], a ld hl, w3_d800 - ld de, VBGMap0 + debgcoord 0, 0 lb bc, $3, $24 call Get2bpp diff --git a/misc/mobile_42.asm b/misc/mobile_42.asm index 0253d4c1c..6bfdeae02 100644 --- a/misc/mobile_42.asm +++ b/misc/mobile_42.asm @@ -241,13 +241,13 @@ Function1081ad: ; 1081ad Function1081ca: ; 1081ca ld a, $1 ld [rVBK], a - ld hl, VBGMap0 + hlbgcoord 0, 0 ld bc, $0800 ld a, $0 call ByteFill ld a, $0 ld [rVBK], a - ld hl, VBGMap0 + hlbgcoord 0, 0 ld bc, $0800 ld a, $7f call ByteFill @@ -1669,10 +1669,10 @@ UnknownText_0x108c68: ; 0x108c68 Function108c6d: ; 108c6d ld hl, LZ_108fe7 - ld de, VBGMap0 + debgcoord 0, 0 call Decompress ld hl, LZ_108fe7 - ld de, VBGMap1 + debgcoord 0, 0, VBGMap1 call Decompress ret ; 108c80 @@ -1681,10 +1681,10 @@ Function108c80: ; 108c80 ld a, $1 ld [rVBK], a ld hl, LZ_1090a7 - ld de, VBGMap0 + debgcoord 0, 0 call Decompress ld hl, LZ_1090a7 - ld de, VBGMap1 + debgcoord 0, 0, VBGMap1 call Decompress ld a, $0 ld [rVBK], a diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm index f4df98c06..410f3c502 100644 --- a/misc/mobile_45.asm +++ b/misc/mobile_45.asm @@ -8407,7 +8407,7 @@ Function117c4a: add hl, de dec c jr nz, .asm_117c71 ; 0x117c7b $f4 - call FadeToWhite + call RotateThreePalettesRight pop af ld [rSVBK], a ld a, $80 diff --git a/misc/mobile_5b.asm b/misc/mobile_5b.asm index 3e26aa9ea..70b1aab93 100755 --- a/misc/mobile_5b.asm +++ b/misc/mobile_5b.asm @@ -169,7 +169,7 @@ Function16c108: ; 16c108 call Function16c130 call Function16c145 call Function16c15c - ld hl, VBGMap0 + hlbgcoord 0, 0 call Function16cc73 call Function16cc02 xor a @@ -795,7 +795,7 @@ Function16cc62: ; 16cc62 ; 16cc6e Function16cc6e: ; 16cc6e - ld hl, VBGMap1 + hlbgcoord 0, 0, VBGMap1 jr Function16cc73 Function16cc73: @@ -925,19 +925,19 @@ rept 2 inc c endr ld a, $7 -.asm_16d630 +.loop push bc push hl -.asm_16d632 +.loop2 ld [hli], a dec c - jr nz, .asm_16d632 + jr nz, .loop2 pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de pop bc dec b - jr nz, .asm_16d630 + jr nz, .loop ret ; 16d640 @@ -950,20 +950,20 @@ Function16d640: ; 16d640 inc a ld [hl], a pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de -.asm_16d64f +.loop push hl ld a, $33 ld [hli], a - ld a, $7f + ld a, " " call Function16d66d ld [hl], $34 pop hl - ld de, $0014 + ld de, SCREEN_WIDTH add hl, de dec b - jr nz, .asm_16d64f + jr nz, .loop ld a, $35 ld [hli], a ld a, $36 @@ -974,10 +974,10 @@ Function16d640: ; 16d640 Function16d66d: ; 16d66d ld d, c -.asm_16d66e +.loop ld [hli], a dec d - jr nz, .asm_16d66e + jr nz, .loop ret ; 16d673 @@ -1044,11 +1044,11 @@ Function16d6ce: ; 16d6ce Function16d6e1: ; 16d6e1 hlcoord 4, 10 - ld b, $1 - ld c, $a + ld b, 1 + ld c, 10 predef Function28eef hlcoord 5, 11 - ld de, String_16d701 + ld de, .Waiting call PlaceString call WaitBGMap call Function3200 @@ -1056,7 +1056,7 @@ Function16d6e1: ; 16d6e1 jp DelayFrames ; 16d701 -String_16d701: ; 16d701 +.Waiting: ; 16d701 db "WAITING..!@" ; 16d70c diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 3f35d8346..52080187f 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -1973,7 +1973,7 @@ MenuData2_17dc96: Function17dc9f: ; 17dc9f call Function17e415 call Function17e41e - call Function4dd + call RotateFourPalettesLeft ret ; 17dca9 @@ -1997,7 +1997,7 @@ Function17dcaf: add hl, de dec c jr nz, .asm_17dcbb - call FadeToWhite + call RotateThreePalettesRight ld a, $4 ld [rSVBK], a ret diff --git a/misc/unused_title.asm b/misc/unused_title.asm index 143994d9a..6a3349634 100644 --- a/misc/unused_title.asm +++ b/misc/unused_title.asm @@ -31,7 +31,7 @@ endr call CopyBytes ld hl, UnusedTitleBG_Tilemap - ld de, VBGMap0 + debgcoord 0, 0 ld bc, 32 * 32 .copy ld a, 0 diff --git a/sram.asm b/sram.asm index 5437f63de..f5be2fb5f 100644 --- a/sram.asm +++ b/sram.asm @@ -57,11 +57,12 @@ sMailbox10Backup:: mailmsg sMailbox10Backup ; abe2 sMysteryGiftItem:: ds 1 -s0_abe3:: ds 1 +sMysteryGiftUnlocked:: ds 1 sBackupMysteryGiftItem:: ds 1 s0_abe5:: ds 1 s0_abe6:: ds 10 -s0_abf0:: ds 10 +sMysteryGiftDecorationsReceived:: flag_array NUM_NON_TROPHY_DECOS + ds 4 sMysteryGiftTimer:: ds 1 sMysteryGiftTimerStartDay:: ds 1 ds 1 @@ -73,12 +74,11 @@ sBackupMysteryGiftItemEnd:: ds $30 -s0_ac60:: ds 8 +sRTCStatusFlags:: ds 8 sLuckyNumberDay:: ds 1 sLuckyIDNumber:: ds 2 - ds $b200 - $ac6b - +SECTION "Backup Save", SRAM [$b200], BANK [0] sBackupOptions:: ds OptionsEnd - Options s0_b208:: ds 1