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
|
2021-04-13 22:24:37 +00:00
|
|
|
ld hl, LancesRoomTrainerHeaders
|
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
|
2020-11-06 15:33:58 +00:00
|
|
|
jp .setEntranceBlocks
|
2015-12-19 03:14:42 +00:00
|
|
|
.closeEntrance
|
2014-05-18 18:19:10 +00:00
|
|
|
ld a, $72
|
|
|
|
ld b, $73
|
2020-11-06 15:33:58 +00:00
|
|
|
.setEntranceBlocks
|
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
|
2020-11-06 15:33:58 +00:00
|
|
|
call .SetEntranceBlock
|
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
|
2020-11-06 15:33:58 +00:00
|
|
|
.SetEntranceBlock:
|
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
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [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
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [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:
|
2020-07-16 16:32:19 +00:00
|
|
|
dbmapcoord 5, 1
|
|
|
|
dbmapcoord 6, 2
|
|
|
|
dbmapcoord 5, 11
|
|
|
|
dbmapcoord 6, 11
|
|
|
|
dbmapcoord 24, 16
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
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
|
2020-07-06 23:03:05 +00:00
|
|
|
ldh [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:
|
2020-07-16 16:32:19 +00:00
|
|
|
db D_UP, 12
|
|
|
|
db D_LEFT, 12
|
|
|
|
db D_DOWN, 7
|
|
|
|
db D_LEFT, 6
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceScript3:
|
2020-07-16 16:48:42 +00:00
|
|
|
ld a, [wSimulatedJoypadStatesIndex]
|
|
|
|
and a
|
2014-05-18 18:19:10 +00:00
|
|
|
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
|
|
|
|
|
2021-04-13 22:24:37 +00:00
|
|
|
LancesRoomTrainerHeaders:
|
|
|
|
def_trainers
|
|
|
|
LancesRoomTrainerHeader0:
|
2020-07-14 19:45:36 +00:00
|
|
|
trainer EVENT_BEAT_LANCES_ROOM_TRAINER_0, 0, LanceBeforeBattleText, LanceEndBattleText, LanceAfterBattleText
|
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceText1:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_asm
|
2021-04-13 22:24:37 +00:00
|
|
|
ld hl, LancesRoomTrainerHeader0
|
2014-05-18 18:19:10 +00:00
|
|
|
call TalkToTrainer
|
|
|
|
jp TextScriptEnd
|
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceBeforeBattleText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _LanceBeforeBattleText
|
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceEndBattleText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _LanceEndBattleText
|
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2016-06-12 00:24:04 +00:00
|
|
|
LanceAfterBattleText:
|
2020-07-04 21:09:35 +00:00
|
|
|
text_far _LanceAfterBattleText
|
|
|
|
text_asm
|
2015-07-21 17:36:03 +00:00
|
|
|
SetEvent EVENT_BEAT_LANCE
|
2014-05-18 18:19:10 +00:00
|
|
|
jp TextScriptEnd
|