diff options
author | Daniel Harding <33dannye@gmail.com> | 2021-11-15 13:31:15 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-15 13:31:15 -0600 |
commit | f516a91f5fa02a741631c77b9097598f466d1328 (patch) | |
tree | bac2ee5e3fad02983b061580f5c085baecb5439a /src/engine/overworld | |
parent | 15e986d374fdd11ed0f412fbdc9b858d4c4b9f50 (diff) | |
parent | 1fd16cd27fcd4f432bfc09fc5b7a262798b72430 (diff) |
Some more bank splitting
Diffstat (limited to 'src/engine/overworld')
-rw-r--r-- | src/engine/overworld/npcs.asm | 195 | ||||
-rw-r--r-- | src/engine/overworld/overworld.asm | 25 | ||||
-rw-r--r-- | src/engine/overworld/scripting.asm | 10 |
3 files changed, 213 insertions, 17 deletions
diff --git a/src/engine/overworld/npcs.asm b/src/engine/overworld/npcs.asm new file mode 100644 index 0000000..6528714 --- /dev/null +++ b/src/engine/overworld/npcs.asm @@ -0,0 +1,195 @@ +; loads a pointer into hl found on NPCHeaderPointers +GetNPCHeaderPointer: + rlca + add LOW(NPCHeaderPointers) + ld l, a + ld a, HIGH(NPCHeaderPointers) + adc 0 + ld h, a + ld a, [hli] + ld h, [hl] + ld l, a + ret + +LoadNPCSpriteData: + push hl + push bc + call GetNPCHeaderPointer + ld a, [hli] + ld [wTempNPC], a + ld a, [hli] + ld [wNPCSpriteID], a + ld a, [hli] + ld [wNPCAnim], a + ld a, [hli] + push af + ld a, [hli] + ld [wNPCAnimFlags], a + pop bc + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .not_cgb + ld a, b + ld [wNPCAnim], a +.not_cgb + pop bc + pop hl + ret + +; Loads Name into wCurrentNPCNameTx and gets Script ptr into bc +GetNPCNameAndScript: + push hl + call GetNPCHeaderPointer + ld bc, NPC_DATA_SCRIPT_PTR + add hl, bc + ld c, [hl] + inc hl + ld b, [hl] + inc hl + ld a, [hli] + ld [wCurrentNPCNameTx], a + ld a, [hli] + ld [wCurrentNPCNameTx + 1], a + pop hl + ret + +; Sets Dialog Box title to the name of the npc in 'a' +SetNPCDialogName: + push hl + push bc + call GetNPCHeaderPointer + ld bc, NPC_DATA_NAME_TEXT + add hl, bc + ld a, [hli] + ld [wCurrentNPCNameTx], a + ld a, [hli] + ld [wCurrentNPCNameTx + 1], a + pop bc + pop hl + ret + +; set the opponent name and portrait for the NPC id in register a +SetNPCOpponentNameAndPortrait: + push hl + push bc + call GetNPCHeaderPointer + ld bc, NPC_DATA_NAME_TEXT + add hl, bc + ld a, [hli] + ld [wOpponentName], a + ld a, [hli] + ld [wOpponentName + 1], a + ld a, [hli] + ld [wOpponentPortrait], a + pop bc + pop hl + ret + +; set the deck id and duel theme for the NPC id in register a +SetNPCDeckIDAndDuelTheme: + push hl + push bc + call GetNPCHeaderPointer + ld bc, NPC_DATA_DECK_ID + add hl, bc + ld a, [hli] + ld [wNPCDuelDeckID], a + ld a, [hli] + ld [wDuelTheme], a + pop bc + pop hl + ret + +; set the start theme for the NPC id in register a +SetNPCMatchStartTheme: + push hl + push bc + push af + call GetNPCHeaderPointer + ld bc, NPC_DATA_MATCH_START_ID + add hl, bc + ld a, [hli] + ld [wMatchStartTheme], a + pop af + cp NPC_RONALD1 + jr nz, .not_ronald_final_duel + ld a, [wCurMap] + cp POKEMON_DOME + jr nz, .not_ronald_final_duel + ld a, MUSIC_MATCH_START_3 + ld [wMatchStartTheme], a + +.not_ronald_final_duel + pop bc + pop hl + ret + +INCLUDE "data/npcs.asm" + +_GetNPCDuelConfigurations: + push hl + push bc + push de + ld a, [wNPCDuelDeckID] + ld e, a + ld bc, 9 ; size of struct - 1 + ld hl, DeckIDDuelConfigurations +.loop_deck_ids + ld a, [hli] + cp -1 ; end of list? + jr z, .done + cp e + jr nz, .next_deck_id + ld a, [hli] + ld [wOpponentPortrait], a + ld a, [hli] + ld [wOpponentName], a + ld a, [hli] + ld [wOpponentName + 1], a + ld a, [hl] + ld [wNPCDuelPrizes], a + scf + jr .done +.next_deck_id + add hl, bc + jr .loop_deck_ids +.done + pop de + pop bc + pop hl + ret + +_GetChallengeMachineDuelConfigurations: + push bc + push de + ld a, [wNPCDuelDeckID] + ld e, a + ld bc, 9 ; size of struct - 1 + ld hl, DeckIDDuelConfigurations +.loop_deck_ids + ld a, [hli] + cp -1 ; end of list? + jr z, .done + cp e + jr nz, .next_deck_id + push hl + ld a, [hli] + ld [wOpponentPortrait], a + ld a, [hli] + ld [wOpponentName], a + ld a, [hli] + ld [wOpponentName + 1], a + inc hl + ld a, [hli] + ld [wDuelTheme], a + pop hl + dec hl + scf + jr .done +.next_deck_id + add hl, bc + jr .loop_deck_ids +.done + pop de + pop bc + ret diff --git a/src/engine/overworld/overworld.asm b/src/engine/overworld/overworld.asm index 273f275..a3c6ec8 100644 --- a/src/engine/overworld/overworld.asm +++ b/src/engine/overworld/overworld.asm @@ -21,7 +21,7 @@ LoadMap: xor a ld [wd291], a .warp - farcall Func_10ab4 + farcall FadeScreenToWhite call WhiteOutDMGPals call Func_c241 call EmptyScreen @@ -48,7 +48,7 @@ LoadMap: ld [wOverworldTransition], a ld [wOverworldNPCFlags], a call PlayDefaultSong - farcall Func_10af9 + farcall FadeScreenFromWhite call Func_c141 call Func_c17a .overworld_loop @@ -68,7 +68,7 @@ LoadMap: call PlaySFX jp .warp .no_warp - farcall Func_10ab4 + farcall FadeScreenToWhite call Func_c1a0 ld a, [wMatchStartTheme] or a @@ -273,7 +273,7 @@ Func_c1f8: ld a, [sTextSpeed] ld [wTextSpeed], a call DisableSRAM - farcall Func_10756 + farcall InitPCPacks ret BackupPlayerPosition: @@ -365,7 +365,7 @@ Func_c2a3: push bc push de call BackupObjectPalettes - farcall Func_10ab4 + farcall FadeScreenToWhite ld a, 1 << HIDE_ALL_NPC_SPRITES call SetOverworldNPCFlags lb de, $30, $7f @@ -422,7 +422,7 @@ ReturnToOverworld: ld h, a call CallHL2 .no_callback - farcall Func_10af9 + farcall FadeScreenFromWhite pop de pop bc pop hl @@ -536,6 +536,7 @@ DecompressPermissionMap: pop hl ret +; de = coordinates Func_c3ca: push hl push bc @@ -1149,7 +1150,7 @@ PauseMenu: DisplayPauseMenu: ld a, [wSelectedPauseMenuItem] ld hl, Unknown_10d98 - farcall InitAndPrintPauseMenu + farcall InitAndPrintMenu ret PauseMenuPointerTable: @@ -1173,7 +1174,7 @@ PauseMenu_Deck: ldh [hSCX], a ldh [hSCY], a call Set_OBJ_8x16 - farcall Func_1288c + farcall SetDefaultPalettes farcall DeckSelectionMenu call Set_OBJ_8x8 ret @@ -1183,7 +1184,7 @@ PauseMenu_Card: ldh [hSCX], a ldh [hSCY], a call Set_OBJ_8x16 - farcall Func_1288c + farcall SetDefaultPalettes farcall HandlePlayersCardsScreen call Set_OBJ_8x8 ret @@ -1246,7 +1247,7 @@ PointerTable_c846: DisplayPCMenu: ld a, [wSelectedPCMenuItem] ld hl, Unknown_10da9 - farcall InitAndPrintPauseMenu + farcall InitAndPrintMenu ret PCMenu_CardAlbum: @@ -1254,7 +1255,7 @@ PCMenu_CardAlbum: ldh [hSCX], a ldh [hSCY], a call Set_OBJ_8x16 - farcall Func_1288c + farcall SetDefaultPalettes farcall HandleCardAlbumScreen call Set_OBJ_8x8 ret @@ -1272,7 +1273,7 @@ PCMenu_Print: ldh [hSCX], a ldh [hSCY], a call Set_OBJ_8x16 - farcall Func_1288c + farcall SetDefaultPalettes farcall HandlePrinterMenu call Set_OBJ_8x8 call WhiteOutDMGPals diff --git a/src/engine/overworld/scripting.asm b/src/engine/overworld/scripting.asm index 442bb7b..22239df 100644 --- a/src/engine/overworld/scripting.asm +++ b/src/engine/overworld/scripting.asm @@ -996,7 +996,7 @@ ScriptCommand_ShowCardReceivedScreen: .show_card push af - farcall Func_10000 + farcall InitMenuScreen farcall FlashWhiteScreen pop af bank1call ShowPromotionalCardScreen @@ -1646,7 +1646,7 @@ ShowMultichoiceTextbox: ld h, [hl] ld l, a ld a, [wd416] - farcall InitAndPrintPauseMenu + farcall InitAndPrintMenu pop hl inc hl ld a, [hli] @@ -1738,7 +1738,7 @@ ScriptCommand_OpenDeckMachine: xor a ldh [hSCX], a ldh [hSCY], a - farcall Func_1288c + farcall SetDefaultPalettes call EnableLCD pop bc ld a, c @@ -1776,7 +1776,7 @@ ScriptCommand_EnterMap: jp IncreaseScriptPointerBy6 ScriptCommand_FlashScreen: - farcall Func_10c96 + farcall FlashScreenToWhite jp IncreaseScriptPointerBy2 ScriptCommand_SaveGame: @@ -1788,7 +1788,7 @@ ScriptCommand_GiftCenter: or a jr nz, .load_gift_center ; show menu - farcall Func_10dba + farcall GiftCenterMenu ld c, a set_event_value EVENT_GIFT_CENTER_MENU_CHOICE jr .done |