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:: _GreedyBastardText::
text "Better not get" text "Better not get"
line "greedy..." line "greedy..."
done done
_CantUsePCHere::
text "You cannot use"
line "this here!"
prompt

View file

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

View file

@ -835,3 +835,28 @@ SwitchPartyMon_InitVarOrSwapData:
pop de pop de
pop hl pop hl
ret 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) ; rst vectors (unused)
SECTION "rst0", ROM0[$0000] SECTION "rst0", ROM0[$0000]
rst $38 _Bankswitch::
jp Bankswitch
ds $08 - @, 0 ; unused ds $08 - @, 0 ; unused

View file

@ -25,9 +25,10 @@ RedisplayStartMenu::
jr nz, .loop jr nz, .loop
; if the player pressed tried to go past the top item, wrap around to the bottom ; if the player pressed tried to go past the top item, wrap around to the bottom
CheckEvent EVENT_GOT_POKEDEX 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 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 .wrapMenuItemId
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
call EraseMenuCursor call EraseMenuCursor
@ -38,9 +39,10 @@ RedisplayStartMenu::
; if the player pressed tried to go past the bottom item, wrap around to the top ; if the player pressed tried to go past the bottom item, wrap around to the top
CheckEvent EVENT_GOT_POKEDEX CheckEvent EVENT_GOT_POKEDEX
ld a, [wCurrentMenuItem] 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 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 .checkIfPastBottom
cp c cp c
jr nz, .loop jr nz, .loop
@ -74,6 +76,8 @@ RedisplayStartMenu::
jp z, StartMenu_SaveReset jp z, StartMenu_SaveReset
cp 5 cp 5
jp z, StartMenu_Option jp z, StartMenu_Option
cp 6
jp z, StartMenu_PortablePC
; EXIT falls through to here ; EXIT falls through to here
CloseStartMenu:: CloseStartMenu::

View file

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