123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- LanceScript:
- call LanceShowOrHideEntranceBlocks
- call EnableAutoTextBoxDrawing
- ld hl, LanceTrainerHeader0
- ld de, LanceScriptPointers
- ld a, [wLanceCurScript]
- call ExecuteCurMapScriptInTable
- ld [wLanceCurScript], a
- ret
- LanceShowOrHideEntranceBlocks:
- ld hl, wCurrentMapScriptFlags
- bit 5, [hl]
- res 5, [hl]
- ret z
- CheckEvent EVENT_LANCES_ROOM_LOCK_DOOR
- jr nz, .closeEntrance
- ; open entrance
- ld a, $31
- ld b, $32
- jp LanceSetEntranceBlocks
- .closeEntrance
- ld a, $72
- ld b, $73
- LanceSetEntranceBlocks:
- ; Replaces the tile blocks so the player can't leave.
- push bc
- ld [wNewTileBlockID], a
- lb bc, 6, 2
- call LanceSetEntranceBlock
- pop bc
- ld a, b
- ld [wNewTileBlockID], a
- lb bc, 6, 3
- LanceSetEntranceBlock:
- predef_jump ReplaceTileBlock
- ResetLanceScript:
- xor a
- ld [wLanceCurScript], a
- ret
- LanceScriptPointers:
- dw LanceScript0
- dw DisplayEnemyTrainerTextAndStartBattle
- dw LanceScript2
- dw LanceScript3
- dw LanceScript4
- LanceScript4:
- ret
- LanceScript0:
- CheckEvent EVENT_BEAT_LANCE
- ret nz
- ld hl, LanceTriggerMovementCoords
- call ArePlayerCoordsInArray
- jp nc, CheckFightingMapTrainers
- xor a
- ld [hJoyHeld], a
- ld a, [wCoordIndex]
- cp $3 ; Is player standing next to Lance's sprite?
- jr nc, .notStandingNextToLance
- ld a, $1
- ld [hSpriteIndexOrTextID], a
- jp DisplayTextID
- .notStandingNextToLance
- cp $5 ; Is player standing on the entrance staircase?
- jr z, WalkToLance
- CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR
- ret nz
- ld hl, wCurrentMapScriptFlags
- set 5, [hl]
- ld a, SFX_GO_INSIDE
- call PlaySound
- jp LanceShowOrHideEntranceBlocks
- LanceTriggerMovementCoords:
- db $01,$05
- db $02,$06
- db $0B,$05
- db $0B,$06
- db $10,$18
- db $FF
- LanceScript2:
- call EndTrainerBattle
- ld a, [wIsInBattle]
- cp $ff
- jp z, ResetLanceScript
- ld a, $1
- ld [hSpriteIndexOrTextID], a
- jp DisplayTextID
- WalkToLance:
- ; Moves the player down the hallway to Lance's room.
- ld a, $ff
- ld [wJoyIgnore], a
- ld hl, wSimulatedJoypadStatesEnd
- ld de, WalkToLance_RLEList
- call DecodeRLEList
- dec a
- ld [wSimulatedJoypadStatesIndex], a
- call StartSimulatingJoypadStates
- ld a, $3
- ld [wLanceCurScript], a
- ld [wCurMapScript], a
- ret
- WalkToLance_RLEList:
- db D_UP, $0C
- db D_LEFT, $0C
- db D_DOWN, $07
- db D_LEFT, $06
- db $FF
- LanceScript3:
- ld a, [wSimulatedJoypadStatesIndex]
- and a
- ret nz
- call Delay3
- xor a
- ld [wJoyIgnore], a
- ld [wLanceCurScript], a
- ld [wCurMapScript], a
- ret
- LanceTextPointers:
- dw LanceText1
- LanceTrainerHeader0:
- dbEventFlagBit EVENT_BEAT_LANCES_ROOM_TRAINER_0
- db ($0 << 4) ; trainer's view range
- dwEventFlagAddress EVENT_BEAT_LANCES_ROOM_TRAINER_0
- dw LanceBeforeBattleText ; TextBeforeBattle
- dw LanceAfterBattleText ; TextAfterBattle
- dw LanceEndBattleText ; TextEndBattle
- dw LanceEndBattleText ; TextEndBattle
- db $ff
- LanceText1:
- TX_ASM
- ld hl, LanceTrainerHeader0
- call TalkToTrainer
- jp TextScriptEnd
- LanceBeforeBattleText:
- TX_FAR _LanceBeforeBattleText
- db "@"
- LanceEndBattleText:
- TX_FAR _LanceEndBattleText
- db "@"
- LanceAfterBattleText:
- TX_FAR _LanceAfterBattleText
- TX_ASM
- SetEvent EVENT_BEAT_LANCE
- jp TextScriptEnd
|