portable pc

This commit is contained in:
Thorn Avery 2024-01-29 16:43:33 +13:00
parent 031bee1627
commit 94ef32cb10
6 changed files with 53 additions and 10 deletions

View file

@ -1866,4 +1866,9 @@ _BirdBattleText:: ; This is defined in many places and can just be farcalled her
_GreedyBastardText::
text "Better not get"
line "greedy..."
done
done
_CantUsePCHere::
text "You cannot use"
line "this here!"
prompt

View file

@ -3,7 +3,7 @@ DrawStartMenu::
CheckEvent EVENT_GOT_POKEDEX
; menu with pokedex
hlcoord 10, 0
ld b, $0e
ld b, $10
ld c, $08
jr nz, .drawTextBoxBorder
; shorter menu if the player doesn't have the pokedex
@ -33,7 +33,7 @@ DrawStartMenu::
; case for having pokedex
ld de, StartMenuPokedexText
call PrintStartMenuItem
ld a, $07
ld a, $08
.storeMenuItemCount
ld [wMaxMenuItem], a ; number of menu items
ld de, StartMenuPokemonText
@ -53,6 +53,11 @@ DrawStartMenu::
call PrintStartMenuItem
ld de, StartMenuOptionText
call PrintStartMenuItem
CheckEvent EVENT_GOT_POKEDEX
jr z, .dontPrintPortablePC
ld de, StartMenuPortablePCText
call PrintStartMenuItem
.dontPrintPortablePC
ld de, StartMenuExitText
call PlaceString
ld hl, wd730
@ -80,6 +85,9 @@ StartMenuExitText:
StartMenuOptionText:
db "OPTION@"
StartMenuPortablePCText:
db "PORT.PC@"
PrintStartMenuItem:
push hl
call PlaceString

View file

@ -835,3 +835,28 @@ SwitchPartyMon_InitVarOrSwapData:
pop de
pop hl
ret
StartMenu_PortablePC::
ld a, [wCurMap]
cp LORELEIS_ROOM
jr z, .cantUseItHere
cp BRUNOS_ROOM
jr z, .cantUseItHere
cp AGATHAS_ROOM
jr z, .cantUseItHere
cp LANCES_ROOM
jr z, .cantUseItHere
callfar ActivatePC
jr .done
.cantUseItHere
ld hl, CantUsePCHere
call PrintText
.done
call LoadScreenTilesFromBuffer2
call LoadTextBoxTilePatterns
call UpdateSprites
jp RedisplayStartMenu
CantUsePCHere:
text_far _CantUsePCHere
text_end

View file

@ -1,7 +1,8 @@
; rst vectors (unused)
SECTION "rst0", ROM0[$0000]
rst $38
_Bankswitch::
jp Bankswitch
ds $08 - @, 0 ; unused

View file

@ -25,9 +25,10 @@ RedisplayStartMenu::
jr nz, .loop
; if the player pressed tried to go past the top item, wrap around to the bottom
CheckEvent EVENT_GOT_POKEDEX
ld a, 6 ; there are 7 menu items with the pokedex, so the max index is 6
ld a, 7 ; there are 8 menu items with the pokedex and pc, so the max index is 7
jr nz, .wrapMenuItemId
dec a ; there are only 6 menu items without the pokedex
;dec a ; there are only 6 menu items without the pokedex
ld a, 5
.wrapMenuItemId
ld [wCurrentMenuItem], a
call EraseMenuCursor
@ -38,9 +39,10 @@ RedisplayStartMenu::
; if the player pressed tried to go past the bottom item, wrap around to the top
CheckEvent EVENT_GOT_POKEDEX
ld a, [wCurrentMenuItem]
ld c, 7 ; there are 7 menu items with the pokedex
ld c, 8 ; there are 8 menu items with the pokedex and pc
jr nz, .checkIfPastBottom
dec c ; there are only 6 menu items without the pokedex
;dec c ; there are only 6 menu items without the pokedex
ld c, 6
.checkIfPastBottom
cp c
jr nz, .loop
@ -74,6 +76,8 @@ RedisplayStartMenu::
jp z, StartMenu_SaveReset
cp 5
jp z, StartMenu_Option
cp 6
jp z, StartMenu_PortablePC
; EXIT falls through to here
CloseStartMenu::

View file

@ -1,13 +1,13 @@
MACRO farcall
ld b, BANK(\1)
ld hl, \1
call Bankswitch
rst _Bankswitch
ENDM
MACRO callfar
ld hl, \1
ld b, BANK(\1)
call Bankswitch
rst _Bankswitch
ENDM
MACRO farjp