Groundwork for new Vermilion Pass system

Alright so this is the start of producing a new and improved pass system - one that actually works.

Long story short: Now there are three dock entrances. One for the S.S. Anne, one for Citrine City, and one for Faraway Island. I don't like it, but the old system literally just would not work, and with the time span in mind, I just want to use this instead.

Here's how it works;
- Usual S.S. Anne trigger is used, but with a new coordinate range.
- When triggered, check the coordinates the player is in; if it's not the usual S.S. Anne one, they're getting kicked to a new script.
- Use that to flag the player as usual.

Glitches:
- Triggering these multiple times causes strange jank, including crashes. I have the player forced into the new maps for now, but even going back can cause issues. I don't understand it.
- Citrine City's warp just...doesn't work, presumably due to a warp limit. However, after chopping off the warps so there's one each, it still happens.

These glitches need fixing before KEP can launch.
This commit is contained in:
Llinos Evans 2023-08-19 22:11:12 +01:00
parent fe45fe99c1
commit 72a372dcde
5 changed files with 335 additions and 172 deletions

View file

@ -10,17 +10,17 @@ VermilionCity_Object:
warp_event 18, 31, VERMILION_DOCK, 1
warp_event 19, 31, VERMILION_DOCK, 1
warp_event 15, 13, VERMILION_TRADE_HOUSE, 1
warp_event 10, 31, CITRINE_CITY, 7
warp_event 11, 31, CITRINE_CITY, 8
warp_event 10, 31, FARAWAY_ISLAND_OUTSIDE, 1
warp_event 26, 31, CITRINE_CITY, 7
def_bg_events
bg_event 27, 3, 9 ; VermilionCityText7
bg_event 37, 13, 10 ; VermilionCityText8
bg_event 24, 13, 11 ; MartSignText
bg_event 12, 3, 12 ; PokeCenterSignText
bg_event 7, 13, 13 ; VermilionCityText11
bg_event 7, 19, 14 ; VermilionCityText12
bg_event 29, 15, 15 ; VermilionCityText13
bg_event 27, 3, 11 ; VermilionCityText7
bg_event 37, 13, 12 ; VermilionCityText8
bg_event 24, 13, 13 ; MartSignText
bg_event 12, 3, 14 ; PokeCenterSignText
bg_event 7, 13, 15 ; VermilionCityText11
bg_event 7, 19, 16 ; VermilionCityText12
bg_event 29, 15, 17 ; VermilionCityText13
def_object_events
object_event 23, 5, SPRITE_BEAUTY, WALK, LEFT_RIGHT, 1 ; person
@ -31,5 +31,7 @@ VermilionCity_Object:
object_event 25, 27, SPRITE_SAILOR, WALK, LEFT_RIGHT, 6 ; person
object_event 19, 8, SPRITE_OFFICER_JENNY, STAY, ANY_DIR, 7 ; squirtle event
object_event 12, 13, SPRITE_BEAUTY, STAY, DOWN, 8 ; arc/pers event
object_event 11, 30, SPRITE_SAILOR, STAY, UP, 9 ; person - Faraway Island
object_event 27, 30, SPRITE_SAILOR, STAY, UP, 10 ; person - Citrine City
def_warps_to VERMILION_CITY

View file

@ -1 +1 @@
CCC ! ! !1 !11111111Ckk7~|r7~17~wVwww111Cd1111111111111111C-111111111IH111CCC-111111DE111CCC !C !11 !111111Cd|~1|~11|swwwwVwCd1111111111111111Cd1 1111 !TCdV21|~edTeCCCCd11111ed111e-T.CCCCd11111e-.CTCdC-.CCCCCCTCdCCCCTTTTTTTTTTTC-gCCCCTxxxTxxxxxxCCCkkkTkTkkkkkkkCCCCCCCCCCCCCCCCCCCCCCCCTCCCTCCCCCCCCCC
CCC ! ! !1 !11111111Ckk7~|r7~17~wVwww111Cd1111111111111111C-111111111IH111CCC-111111DE111CCC !C !11 !111111Cd|~1|~11|swwwwVwCd1111111111111111Cd1 1111 !TCdV21|~edTeCCCCd11111ed111e-T.CCCCd11111e-.CTCdC-.CCCCCCTCdCCCCTTTTTTTTTTTC-gCCCCTxxxTxxxTxxCCCkkkTkTkTkkkCCCCCCCCCCCCTCCCCCCCCCCCTCCCTCCCTCCCCCC

View file

@ -48,7 +48,7 @@ ChiefLetter2:
ld a, $1 ; Load Mom's NPC ID
ldh [hSpriteIndex], a ; Slap it in the index
ld a, SPRITE_FACING_RIGHT ; Get this ready
ldh [hSpriteFacingDirection], a ; Now she'll face right, simulatiung talking to her.
ldh [hSpriteFacingDirection], a ; Now she'll face right, simulating talking to her.
call SetSpriteFacingDirectionAndDelay ; Get this all out.
call DisplayTextID ; Display her text ID, using the same thing from before.
; We did a little tomfoolery with her base text to make this work. Look below if you dare.

View file

@ -56,6 +56,13 @@ VermilionCityScript0:
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .shipHasDeparted
.default
ld hl, OldSeaMapCheckCoords
call ArePlayerCoordsInArray
jp c, MovePlayerVermilion
ld hl, CitrineCityCheckCoords
call ArePlayerCoordsInArray
jp c, MovePlayerVermilion
ld b, S_S_TICKET
predef GetQuantityOfItemInBag
ld a, b
@ -71,10 +78,22 @@ VermilionCityScript0:
ld [wVermilionCityCurScript], a
ret
SSAnneTicketCheckCoords:
dbmapcoord 18, 30
SSAnneTicketCheckCoords: ; Mother coords - use to universally trigger the same event
dbmapcoord 18, 30 ; S. S. Anne
dbmapcoord 10, 30 ; Faraway Island
dbmapcoord 26, 30 ; Citrine City
db -1 ; end
; I know it looks awful but I use the individual ones to launch off the new ticket script.
; We don't need an S.S. Anne one, as I'm using a process of elimination check system.
OldSeaMapCheckCoords:
dbmapcoord 10, 30
db -1
CitrineCityCheckCoords:
dbmapcoord 26, 30
db -1
VermilionCityScript4:
ld hl, SSAnneTicketCheckCoords
call ArePlayerCoordsInArray
@ -117,145 +136,186 @@ VermilionCityScript1:
ld [wVermilionCityCurScript], a
ret
; New Pass script begins here
VermillionCityScript_GetPassesInBag:
; We call these four commands to stop text from autoskipping 4 times, may as well just make this.
TheAutoskipStopinator:
ld a, [wSimulatedJoypadStatesEnd] ; ensuring that the text doesn't autoskip.
and a ; yep, here too.
call z, WaitForTextScrollButtonPress ; and here.
call EnableAutoTextBoxDrawing ; and here.
ret
; So get this: If you check multiple tickets, there's a really janky crash.
; I can't be fucked fixing it, so let's force the player through the warp instead.
; Yes, I'm serious.
MovePlayerVermilion:
ld a, PLAYER_DIR_DOWN
ld [wPlayerMovingDirection], a
call UpdateSprites
ld a, $ff ; Firstly...
ld [wJoyIgnore], a ; No joypad inputs. No funny business. RLE is weird as fuck without it.
ld hl, wSimulatedJoypadStatesEnd
ld de, WalkIntoWarp_RLEMovement
call DecodeRLEList
dec a
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates ; By this point, we're auto-moving.
ld a, $0
ld [wVermilionCityCurScript], a ; safety
ret
WalkIntoWarp_RLEMovement:
db D_DOWN, 2
db -1 ; end
; ================================================================
; THIS IS NO LONGER USED, KEPT IN CASE A BETTER WARP SYSTEM COMES UP.
; Alright, so I'll explain the issue.
; For some reason, all the warp methods that exist do not seem to like this system.
; Faraway Island would load but have botched collision and break when you leave.
; Citrine City would outright crash.
; Bank movements and stuff were tried but nothing seemed to work as desired.
; Instead, we use a triple-harbour method, which makes the city look more lively anyway.
;VermillionCityScript_GetPassesInBag:
; Gets a list of Passes in the player's bag.
; Ripped and modified from the fossil guy
xor a
ld [wFilteredBagItemsCount], a
ld de, wFilteredBagItems
ld hl, PassList
.loop
ld a, [hli]
and a
jr z, .done
push hl
push de
ld [wd11e], a
ld b, a
predef GetQuantityOfItemInBag
pop de
pop hl
ld a, b
and a
jr z, .loop
; xor a
; ld [wFilteredBagItemsCount], a
; ld de, wFilteredBagItems
; ld hl, PassList
;.loop
; ld a, [hli]
; and a
; jr z, .done
; push hl
; push de
; ld [wd11e], a
; ld b, a
; predef GetQuantityOfItemInBag
; pop de
; pop hl
; ld a, b
; and a
; jr z, .loop
; A Pass is in the bag
ld a, [wd11e]
ld [de], a
inc de
push hl
ld hl, wFilteredBagItemsCount
inc [hl]
pop hl
jr .loop
.done
ld a, $ff
ld [de], a
ret
; ; A Pass is in the bag
; ld a, [wd11e]
; ld [de], a
; inc de
; push hl
; ld hl, wFilteredBagItemsCount
; inc [hl]
; pop hl
; jr .loop
;.done
; ld a, $ff
; ld [de], a
; ret
PassList:
db S_S_TICKET
db OLD_SEA_MAP
db CITRINE_PASS
;db RAINBOW_PASS maybe someday
db 0 ; end
;PassList:
; db S_S_TICKET
; db OLD_SEA_MAP
; db CITRINE_PASS
; ;db RAINBOW_PASS I planned this for a while, but the space wasn't there, and the scope was strange.
; db 0 ; end
PrintPassesInBag:
;PrintPassesInBag:
; Prints each pass in the player's bag on a separate line in the menu.
ld hl, wFilteredBagItems
xor a
ldh [hItemCounter], a
.loop
ld a, [hli]
cp $ff
ret z
push hl
ld [wd11e], a
call GetItemName
hlcoord 2, 2
ldh a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
call PlaceString
ld hl, hItemCounter
inc [hl]
pop hl
jr .loop
; ld hl, wFilteredBagItems
; xor a
; ldh [hItemCounter], a
;.loop
; ld a, [hli]
; cp $ff
; ret z
; push hl
; ld [wd11e], a
; call GetItemName
; hlcoord 2, 2
; ldh a, [hItemCounter]
; ld bc, SCREEN_WIDTH * 2
; call AddNTimes
; ld de, wcd6d
; call PlaceString
; ld hl, hItemCounter
; inc [hl]
; pop hl
; jr .loop
PassListings:
ld hl, VermillionCityPassSelectionText
call PrintText
call VermillionCityScript_GetPassesInBag
ld hl, wd730
set 6, [hl]
xor a
ld [wCurrentMenuItem], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, [wFilteredBagItemsCount]
dec a
ld [wMaxMenuItem], a
ld a, 2
ld [wTopMenuItemY], a
ld a, 1
ld [wTopMenuItemX], a
ld a, [wFilteredBagItemsCount]
dec a
ld bc, 2
ld hl, 3
call AddNTimes
dec l
ld b, l
ld c, $d
hlcoord 0, 0
call TextBoxBorder
call UpdateSprites
call PrintPassesInBag
ld hl, wd730
res 6, [hl]
call HandleMenuInput
bit BIT_B_BUTTON, a
jr nz, .cancelledPass
ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
ld d, 0
ld e, a
add hl, de
ld a, [hl]
ldh [hItemToRemoveID], a
cp S_S_TICKET
jp z, VermilionCityText3.playerHasTicket ; Saves time and less risk of bugs
cp OLD_SEA_MAP
jr z, .choseFaraway
cp CITRINE_PASS
jr z, .choseCitrine
;PassListings:
; ld hl, VermillionCityPassSelectionText
; call PrintText
; call VermillionCityScript_GetPassesInBag
; ld hl, wd730
; set 6, [hl]
; xor a
; ld [wCurrentMenuItem], a
; ld a, A_BUTTON | B_BUTTON
; ld [wMenuWatchedKeys], a
; ld a, [wFilteredBagItemsCount]
; dec a
; ld [wMaxMenuItem], a
; ld a, 2
; ld [wTopMenuItemY], a
; ld a, 1
; ld [wTopMenuItemX], a
; ld a, [wFilteredBagItemsCount]
; dec a
; ld bc, 2
; ld hl, 3
; call AddNTimes
; dec l
; ld b, l
; ld c, $d
; hlcoord 0, 0
; call TextBoxBorder
; call UpdateSprites
; call PrintPassesInBag
; ld hl, wd730
; res 6, [hl]
; call HandleMenuInput
; bit BIT_B_BUTTON, a
; jr nz, .cancelledPass
; ld hl, wFilteredBagItems
; ld a, [wCurrentMenuItem]
; ld d, 0
; ld e, a
; add hl, de
; ld a, [hl]
; ldh [hItemToRemoveID], a
; cp S_S_TICKET
; jp z, VermilionCityText3.playerHasTicket ; Saves time and less risk of bugs
; cp OLD_SEA_MAP
; jr z, .choseFaraway
; cp CITRINE_PASS
; jr z, .choseCitrine
; god bless the safari game and pokemon tower 7f for being the few times a forcewarp exists
; For some reason, these aren't working properly...
.choseFaraway
ld hl, EventVermillionCityOldSeaMap
call PrintText
ld a, FARAWAY_ISLAND_OUTSIDE
ld [wDestinationMap], a
ld hl, wd732
set 2, [hl] ; fly warp or dungeon warp
call SpecialWarpIn
jp SpecialEnterMap
.choseCitrine
ld hl, EventVermillionCityCitrinePass
call PrintText
ld a, CITRINE_CITY
ldh [hWarpDestinationMap], a
ld a, $6
ld [wDestinationWarpID], a
call WarpFound2
jr .done
.cancelledPass
ld hl, PassRefuse
call PrintText
.done
ret
;.choseFaraway
; ld hl, EventVermillionCityOldSeaMap
; call PrintText
; ld a, FARAWAY_ISLAND_OUTSIDE
; ld [wDestinationMap], a
; ld hl, wd732
; set 2, [hl] ; fly warp or dungeon warp
; call SpecialWarpIn
; jp SpecialEnterMap
;.choseCitrine
; ld hl, EventVermillionCityCitrinePass
; call PrintText
; ld a, CITRINE_CITY
; ldh [hWarpDestinationMap], a
; ld a, $6
; ld [wDestinationWarpID], a
; call WarpFound2
; jr .done
;.cancelledPass
; ld hl, PassRefuse
; call PrintText
;.done
; ret
;
; ================================================================
VermilionCity_TextPointers:
dw VermilionCityText1
@ -266,6 +326,8 @@ VermilionCity_TextPointers:
dw VermilionCityText6
dw OfficerJennySquirtle
dw VermilionBeauty
dw EventVermillionCityOldSeaMapGreeting
dw EventVermillionCityCitrinePassGreeting
dw VermilionCityText7
dw VermilionCityText8
dw MartSignText
@ -302,25 +364,36 @@ VermilionCityTextSSAnneDeparted:
VermilionCityText3:
text_asm
; If you have either of these, go to Pass List.
; You only access these in the post-game, really, so it works out.
ld b, OLD_SEA_MAP
predef GetQuantityOfItemInBag
ld a, b
and a
jp nz, PassListings
ld b, CITRINE_PASS
predef GetQuantityOfItemInBag
ld a, b
and a
jp nz, PassListings
; Checking the location that the script flagged earlier.
; Instead of using an item checker, this is more effective and easy on memory.
; Also, it doesn't get cross-threaded if you have multiples of the same thing. I had issues working around that one - I ain't a programmer by trade, unfortunately, I'm a TEFL student.
; Anyway, the code kicks you to different versions of the same script; I've had them isolated to call text in a way that's easier architecturally. Otherwise, we're checking the item found every time, and I'm 90% sure that nicks a WRAM entry.
; All in all: Yes, this is suboptimal, but I've been doing this for months. Sue me.
ld hl, OldSeaMapCheckCoords
call ArePlayerCoordsInArray
jr c, HasOldSeaMap
ld hl, CitrineCityCheckCoords
call ArePlayerCoordsInArray
jp c, HasCitrinePass
; If you have neither, this will continue as normal, see?
; This is why we needed the child coords.
; Before the coord system, we used this with the unused pass listing code.
; See where the issues arose? Possibly a neat exercise!
;ld b, OLD_SEA_MAP
;predef GetQuantityOfItemInBag
;ld a, b
;and a
;jp nz, PassListings
;ld b, CITRINE_PASS
;predef GetQuantityOfItemInBag
;ld a, b
;and a
;jp nz, PassListings
ld a, [wObtainedBadges]
bit 5, a ; after obtaining marsh badge the ship returns
jr nz, .default
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .shipHasDeparted
.default
ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_RIGHT
jr z, .greetPlayer
@ -334,6 +407,7 @@ VermilionCityText3:
.greetPlayerAndCheckTicket
ld hl, SSAnneWelcomeText9
call PrintText
call TheAutoskipStopinator ; this actually fixes a bug from vanilla...
ld b, S_S_TICKET
predef GetQuantityOfItemInBag
ld a, b
@ -354,9 +428,13 @@ VermilionCityText3:
.end
jp TextScriptEnd
.inFrontOfOrBehindGuardCoords
dbmapcoord 19, 29 ; in front of guard
dbmapcoord 19, 31 ; behind guard
.inFrontOfOrBehindGuardCoords ; This can be all at once don't worry.
dbmapcoord 19, 29 ; in front of guard - S. S. Anne
dbmapcoord 19, 31 ; behind guard - S. S. Anne
dbmapcoord 11, 29 ; Faraway Island
dbmapcoord 11, 31 ; Faraway Island
dbmapcoord 27, 29 ; Citrine City
dbmapcoord 27, 31 ; Citrine City
db -1 ; end
SSAnneWelcomeText4:
@ -379,6 +457,93 @@ SSAnneNotHereText:
text_far _SSAnneNotHereText
text_end
HasOldSeaMap:
text_asm
ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_RIGHT
jr z, .greetPlayer
ld hl, VermilionCityText3.inFrontOfOrBehindGuardCoords
call ArePlayerCoordsInArray
jr nc, .greetPlayerAndCheckTicket
.greetPlayer
ld hl, EventVermillionCityOldSeaMapGreeting
call PrintText
jr .end
.greetPlayerAndCheckTicket
ld hl, EventVermillionCityOldSeaMapGreeting
call PrintText
call TheAutoskipStopinator
ld b, OLD_SEA_MAP
predef GetQuantityOfItemInBag
ld a, b
and a
jr nz, .playerHasTicket
ld hl, EventVermillionCityOldSeaMapGreetCheck
call PrintText
jr .end
.playerHasTicket
ld hl, EventVermillionCityOldSeaMap
call PrintText
ld a, $4
ld [wVermilionCityCurScript], a
.end
jp TextScriptEnd
EventVermillionCityOldSeaMapGreeting:
text "I am looking for"
line "a certain map..."
done
text_end
EventVermillionCityOldSeaMapGreetCheck:
text "Do you have it?"
done
text_end
HasCitrinePass:
text_asm
ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_RIGHT
jr z, .greetPlayer
ld hl, VermilionCityText3.inFrontOfOrBehindGuardCoords
call ArePlayerCoordsInArray
jr nc, .greetPlayerAndCheckTicket
.greetPlayer
ld hl, EventVermillionCityCitrinePassGreeting
call PrintText
jr .end
.greetPlayerAndCheckTicket
ld hl, EventVermillionCityCitrinePassGreeting
call PrintText
call TheAutoskipStopinator
ld b, CITRINE_PASS
predef GetQuantityOfItemInBag
ld a, b
and a
jr nz, .playerHasTicket
ld hl, EventVermillionCityCitrinePassGreetCheck
call PrintText
jr .end
.playerHasTicket
ld hl, EventVermillionCityCitrinePass
call PrintText
ld a, $4
ld [wVermilionCityCurScript], a
.end
jp TextScriptEnd
EventVermillionCityCitrinePassGreeting:
text "Hah! I only serve"
line "strong TRAINERs!"
done
text_end
EventVermillionCityCitrinePassGreetCheck:
text "Gonna need to see"
line "proof, shrimp!"
done
text_end
VermilionCityText4:
text_far _VermilionCityText4
text_end
@ -581,10 +746,7 @@ VermilionBeauty:
ld hl, BeautyFinish2
.skip2
call PrintText
ld a, [wSimulatedJoypadStatesEnd] ; ensuring that the text doesn't autoskip.
and a ; yep, here too.
call z, WaitForTextScrollButtonPress ; and here.
call EnableAutoTextBoxDrawing ; and here. GivePokemon is very hasty.
call TheAutoskipStopinator
lb bc, PERSIAN, 16 ; because we're elitists, let's see if they chose cats first.
ld a, [wBeautyChoice] ; *sigh*, but if they're dog lovers, let's make sure they actually want Persian.
cp GROWLITHE ; Do they? If yes, skip.
@ -622,7 +784,7 @@ CatsDogsChoice:
jr DisplayCatsDogsChoice
InitCatsDogsTextBoxParameters:
ld a, $2 ; loads the value for the unused SOUTH/EAST choice, that was changed to say CATS/DOGS
ld a, $2 ; loads the value for the unused SOUTH/EAST choice, which was changed to say CATS/DOGS
ld [wTwoOptionMenuID], a
hlcoord 12, 8
lb bc, 10, 13

View file

@ -163,12 +163,11 @@ _VermillionCityCitrinePass::
text "<PLAYER> flashed"
line "the CITRINE PASS!"
para "Ah! You must be"
line "pretty strong to"
cont "have this PASS!"
para "Crikey!"
para "Come on, come"
line "on!"
para "Right this way!"
line "I can't believe"
cont "it..."
done
_VermillionCityHarborRefuse::