ref: 139a28ff9906d728a6820fe678a2a616eb309421
dir: /scripts/VermilionCity.asm/
VermilionCity_Script: call EnableAutoTextBoxDrawing ld hl, wCurrentMapScriptFlags bit 6, [hl] res 6, [hl] push hl call nz, .initCityScript pop hl bit 5, [hl] res 5, [hl] call nz, .setFirstLockTrashCanIndex ld hl, VermilionCity_ScriptPointers ld a, [wVermilionCityCurScript] jp CallFunctionInTable .setFirstLockTrashCanIndex call Random ld a, [hRandomSub] and $e ld [wFirstLockTrashCanIndex], a ret .initCityScript CheckEventHL EVENT_SS_ANNE_LEFT ret z CheckEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT SetEventReuseHL EVENT_WALKED_PAST_GUARD_AFTER_SS_ANNE_LEFT ret nz ld a, $2 ld [wVermilionCityCurScript], a ret VermilionCity_ScriptPointers: dw VermilionCityScript0 dw VermilionCityScript1 dw VermilionCityScript2 dw VermilionCityScript3 dw VermilionCityScript4 VermilionCityScript0: ld a, [wSpriteStateData1 + 9] and a ; cp SPRITE_FACING_DOWN ret nz ld hl, SSAnneTicketCheckCoords call ArePlayerCoordsInArray ret nc xor a ld [hJoyHeld], a ld [wcf0d], a ld a, $3 ld [hSpriteIndexOrTextID], a call DisplayTextID CheckEvent EVENT_SS_ANNE_LEFT jr nz, .shipHasDeparted ld b, S_S_TICKET predef GetQuantityOfItemInBag ld a, b and a ret nz .shipHasDeparted ld a, D_UP ld [wSimulatedJoypadStatesEnd], a ld a, $1 ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $1 ld [wVermilionCityCurScript], a ret SSAnneTicketCheckCoords: db $1e,$12 ; y, x db $ff VermilionCityScript4: ld hl, SSAnneTicketCheckCoords call ArePlayerCoordsInArray ret c ld a, $0 ld [wVermilionCityCurScript], a ret VermilionCityScript2: ld a, $ff ld [wJoyIgnore], a ld a, D_UP ld [wSimulatedJoypadStatesEnd], a ld [wSimulatedJoypadStatesEnd + 1], a ld a, 2 ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld a, $3 ld [wVermilionCityCurScript], a ret VermilionCityScript3: ld a, [wSimulatedJoypadStatesIndex] and a ret nz xor a ld [wJoyIgnore], a ld [hJoyHeld], a ld a, $0 ld [wVermilionCityCurScript], a ret VermilionCityScript1: ld a, [wSimulatedJoypadStatesIndex] and a ret nz ld c, 10 call DelayFrames ld a, $0 ld [wVermilionCityCurScript], a ret VermilionCity_TextPointers: dw VermilionCityText1 dw VermilionCityText2 dw VermilionCityText3 dw VermilionCityText4 dw VermilionCityText5 dw VermilionCityText6 dw VermilionCityText7 dw VermilionCityText8 dw MartSignText dw PokeCenterSignText dw VermilionCityText11 dw VermilionCityText12 dw VermilionCityText13 VermilionCityText1: text_far _VermilionCityText1 text_end VermilionCityText2: text_asm CheckEvent EVENT_SS_ANNE_LEFT jr nz, .shipHasDeparted ld hl, VermilionCityTextDidYouSee call PrintText jr .end .shipHasDeparted ld hl, VermilionCityTextSSAnneDeparted call PrintText .end jp TextScriptEnd VermilionCityTextDidYouSee: text_far _VermilionCityTextDidYouSee text_end VermilionCityTextSSAnneDeparted: text_far _VermilionCityTextSSAnneDeparted text_end VermilionCityText3: text_asm CheckEvent EVENT_SS_ANNE_LEFT jr nz, .shipHasDeparted ld a, [wSpriteStateData1 + 9] cp SPRITE_FACING_RIGHT jr z, .greetPlayer ld hl, .inFrontOfOrBehindGuardCoords call ArePlayerCoordsInArray jr nc, .greetPlayerAndCheckTicket .greetPlayer ld hl, SSAnneWelcomeText4 call PrintText jr .end .greetPlayerAndCheckTicket ld hl, SSAnneWelcomeText9 call PrintText ld b, S_S_TICKET predef GetQuantityOfItemInBag ld a, b and a jr nz, .playerHasTicket ld hl, SSAnneNoTicketText call PrintText jr .end .playerHasTicket ld hl, SSAnneFlashedTicketText call PrintText ld a, $4 ld [wVermilionCityCurScript], a jr .end .shipHasDeparted ld hl, SSAnneNotHereText call PrintText .end jp TextScriptEnd .inFrontOfOrBehindGuardCoords db $1d,$13 ; y, x of tile in front of guard db $1f,$13 ; y, x of tile behind guard db $ff SSAnneWelcomeText4: text_far _SSAnneWelcomeText4 text_end SSAnneWelcomeText9: text_far _SSAnneWelcomeText9 text_end SSAnneFlashedTicketText: text_far _SSAnneFlashedTicketText text_end SSAnneNoTicketText: text_far _SSAnneNoTicketText text_end SSAnneNotHereText: text_far _SSAnneNotHereText text_end VermilionCityText4: text_far _VermilionCityText4 text_end VermilionCityText5: text_far _VermilionCityText5 text_asm ld a, MACHOP call PlayCry call WaitForSoundToFinish ld hl, VermilionCityText14 ret VermilionCityText14: text_far _VermilionCityText14 text_end VermilionCityText6: text_far _VermilionCityText6 text_end VermilionCityText7: text_far _VermilionCityText7 text_end VermilionCityText8: text_far _VermilionCityText8 text_end VermilionCityText11: text_far _VermilionCityText11 text_end VermilionCityText12: text_far _VermilionCityText12 text_end VermilionCityText13: text_far _VermilionCityText13 text_end