2019-01-01 20:06:23 +00:00
|
|
|
LancesRoom_Script:
|
2015-12-19 03:14:42 +00:00
|
|
|
call LanceShowOrHideEntranceBlocks
|
2014-05-18 18:19:10 +00:00
|
|
|
call EnableAutoTextBoxDrawing
|
2016-07-20 05:40:04 +00:00
|
|
|
ld hl, LanceTrainerHeader0
|
2019-01-01 20:06:23 +00:00
|
|
|
ld de, LancesRoom_ScriptPointers
|
|
|
|
ld a, [wLancesRoomCurScript]
|
2014-05-18 18:19:10 +00:00
|
|
|
call ExecuteCurMapScriptInTable
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wLancesRoomCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceShowOrHideEntranceBlocks:
|
2016-01-03 19:17:10 +00:00
|
|
|
ld hl, wCurrentMapScriptFlags
|
2014-05-18 18:19:10 +00:00
|
|
|
bit 5, [hl]
|
|
|
|
res 5, [hl]
|
|
|
|
ret z
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckEvent EVENT_LANCES_ROOM_LOCK_DOOR
|
2015-12-19 03:14:42 +00:00
|
|
|
jr nz, .closeEntrance
|
|
|
|
; open entrance
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $31
|
|
|
|
ld b, $32
|
2015-12-19 03:14:42 +00:00
|
|
|
jp LanceSetEntranceBlocks
|
|
|
|
.closeEntrance
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $72
|
|
|
|
ld b, $73
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceSetEntranceBlocks:
|
2015-12-19 03:14:42 +00:00
|
|
|
; Replaces the tile blocks so the player can't leave.
|
2014-05-18 18:19:10 +00:00
|
|
|
push bc
|
2015-07-24 21:39:45 +00:00
|
|
|
ld [wNewTileBlockID], a
|
2015-08-05 21:20:29 +00:00
|
|
|
lb bc, 6, 2
|
2015-12-19 03:14:42 +00:00
|
|
|
call LanceSetEntranceBlock
|
2014-05-18 18:19:10 +00:00
|
|
|
pop bc
|
|
|
|
ld a, b
|
2015-07-24 21:39:45 +00:00
|
|
|
ld [wNewTileBlockID], a
|
2015-08-05 21:20:29 +00:00
|
|
|
lb bc, 6, 3
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceSetEntranceBlock:
|
2014-09-14 18:29:18 +00:00
|
|
|
predef_jump ReplaceTileBlock
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
ResetLanceScript:
|
2014-05-18 18:19:10 +00:00
|
|
|
xor a
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wLancesRoomCurScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
LancesRoom_ScriptPointers:
|
2014-05-18 18:19:10 +00:00
|
|
|
dw LanceScript0
|
2014-09-14 18:29:18 +00:00
|
|
|
dw DisplayEnemyTrainerTextAndStartBattle
|
2014-05-18 18:19:10 +00:00
|
|
|
dw LanceScript2
|
|
|
|
dw LanceScript3
|
|
|
|
dw LanceScript4
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceScript4:
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceScript0:
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckEvent EVENT_BEAT_LANCE
|
2014-05-18 18:19:10 +00:00
|
|
|
ret nz
|
2015-12-19 03:14:42 +00:00
|
|
|
ld hl, LanceTriggerMovementCoords
|
2014-05-18 18:19:10 +00:00
|
|
|
call ArePlayerCoordsInArray
|
|
|
|
jp nc, CheckFightingMapTrainers
|
|
|
|
xor a
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [hJoyHeld], a
|
2015-07-19 03:49:52 +00:00
|
|
|
ld a, [wCoordIndex]
|
2015-12-19 03:14:42 +00:00
|
|
|
cp $3 ; Is player standing next to Lance's sprite?
|
|
|
|
jr nc, .notStandingNextToLance
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $1
|
2015-07-18 15:17:29 +00:00
|
|
|
ld [hSpriteIndexOrTextID], a
|
2014-05-18 18:19:10 +00:00
|
|
|
jp DisplayTextID
|
2015-12-19 03:14:42 +00:00
|
|
|
.notStandingNextToLance
|
|
|
|
cp $5 ; Is player standing on the entrance staircase?
|
|
|
|
jr z, WalkToLance
|
2015-07-21 17:36:03 +00:00
|
|
|
CheckAndSetEvent EVENT_LANCES_ROOM_LOCK_DOOR
|
2014-05-18 18:19:10 +00:00
|
|
|
ret nz
|
2016-01-03 19:17:10 +00:00
|
|
|
ld hl, wCurrentMapScriptFlags
|
2014-05-18 18:19:10 +00:00
|
|
|
set 5, [hl]
|
2015-07-19 08:46:12 +00:00
|
|
|
ld a, SFX_GO_INSIDE
|
2014-05-18 18:19:10 +00:00
|
|
|
call PlaySound
|
2015-12-19 03:14:42 +00:00
|
|
|
jp LanceShowOrHideEntranceBlocks
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceTriggerMovementCoords:
|
2014-05-18 18:19:10 +00:00
|
|
|
db $01,$05
|
|
|
|
db $02,$06
|
|
|
|
db $0B,$05
|
|
|
|
db $0B,$06
|
|
|
|
db $10,$18
|
|
|
|
db $FF
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceScript2:
|
2014-05-18 18:19:10 +00:00
|
|
|
call EndTrainerBattle
|
2015-08-31 02:38:41 +00:00
|
|
|
ld a, [wIsInBattle]
|
2014-05-18 18:19:10 +00:00
|
|
|
cp $ff
|
2015-12-19 03:14:42 +00:00
|
|
|
jp z, ResetLanceScript
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $1
|
2015-07-18 15:17:29 +00:00
|
|
|
ld [hSpriteIndexOrTextID], a
|
2014-05-18 18:19:10 +00:00
|
|
|
jp DisplayTextID
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
WalkToLance:
|
2015-12-19 03:14:42 +00:00
|
|
|
; Moves the player down the hallway to Lance's room.
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $ff
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2014-09-10 03:55:19 +00:00
|
|
|
ld hl, wSimulatedJoypadStatesEnd
|
2015-12-19 03:14:42 +00:00
|
|
|
ld de, WalkToLance_RLEList
|
2014-05-18 18:19:10 +00:00
|
|
|
call DecodeRLEList
|
|
|
|
dec a
|
2014-09-10 03:55:19 +00:00
|
|
|
ld [wSimulatedJoypadStatesIndex], a
|
|
|
|
call StartSimulatingJoypadStates
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $3
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wLancesRoomCurScript], a
|
2015-08-31 02:38:41 +00:00
|
|
|
ld [wCurMapScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
WalkToLance_RLEList:
|
2015-07-17 07:52:25 +00:00
|
|
|
db D_UP, $0C
|
|
|
|
db D_LEFT, $0C
|
|
|
|
db D_DOWN, $07
|
|
|
|
db D_LEFT, $06
|
2014-05-18 18:19:10 +00:00
|
|
|
db $FF
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceScript3:
|
2014-09-10 03:55:19 +00:00
|
|
|
ld a, [wSimulatedJoypadStatesIndex]
|
2014-05-18 18:19:10 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
call Delay3
|
|
|
|
xor a
|
2014-05-25 17:51:53 +00:00
|
|
|
ld [wJoyIgnore], a
|
2019-01-01 20:06:23 +00:00
|
|
|
ld [wLancesRoomCurScript], a
|
2015-08-31 02:38:41 +00:00
|
|
|
ld [wCurMapScript], a
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2019-01-01 20:06:23 +00:00
|
|
|
LancesRoom_TextPointers:
|
2014-05-18 18:19:10 +00:00
|
|
|
dw LanceText1
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceTrainerHeader0:
|
2015-07-21 01:32:02 +00:00
|
|
|
dbEventFlagBit EVENT_BEAT_LANCES_ROOM_TRAINER_0
|
2014-05-18 18:19:10 +00:00
|
|
|
db ($0 << 4) ; trainer's view range
|
2015-07-21 01:32:02 +00:00
|
|
|
dwEventFlagAddress EVENT_BEAT_LANCES_ROOM_TRAINER_0
|
2015-07-03 19:38:12 +00:00
|
|
|
dw LanceBeforeBattleText ; TextBeforeBattle
|
|
|
|
dw LanceAfterBattleText ; TextAfterBattle
|
|
|
|
dw LanceEndBattleText ; TextEndBattle
|
|
|
|
dw LanceEndBattleText ; TextEndBattle
|
2014-05-18 18:19:10 +00:00
|
|
|
|
|
|
|
db $ff
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceText1:
|
2015-07-03 19:58:50 +00:00
|
|
|
TX_ASM
|
2014-05-18 18:19:10 +00:00
|
|
|
ld hl, LanceTrainerHeader0
|
|
|
|
call TalkToTrainer
|
|
|
|
jp TextScriptEnd
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceBeforeBattleText:
|
2014-05-18 18:19:10 +00:00
|
|
|
TX_FAR _LanceBeforeBattleText
|
|
|
|
db "@"
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceEndBattleText:
|
2014-05-18 18:19:10 +00:00
|
|
|
TX_FAR _LanceEndBattleText
|
|
|
|
db "@"
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceAfterBattleText:
|
2014-05-18 18:19:10 +00:00
|
|
|
TX_FAR _LanceAfterBattleText
|
2015-07-03 19:58:50 +00:00
|
|
|
TX_ASM
|
2015-07-21 17:36:03 +00:00
|
|
|
SetEvent EVENT_BEAT_LANCE
|
2014-05-18 18:19:10 +00:00
|
|
|
jp TextScriptEnd
|