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
|
2024-09-24 15:39:44 +00:00
|
|
|
bit BIT_CUR_MAP_LOADED_1, [hl]
|
|
|
|
res BIT_CUR_MAP_LOADED_1, [hl]
|
2014-05-18 18:19:10 +00:00
|
|
|
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:
|
2023-07-14 01:27:56 +00:00
|
|
|
xor a ; SCRIPT_LANCESROOM_DEFAULT
|
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:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_script_pointers
|
|
|
|
dw_const LancesRoomDefaultScript, SCRIPT_LANCESROOM_DEFAULT
|
|
|
|
dw_const DisplayEnemyTrainerTextAndStartBattle, SCRIPT_LANCESROOM_LANCE_START_BATTLE
|
|
|
|
dw_const LancesRoomLanceEndBattleScript, SCRIPT_LANCESROOM_LANCE_END_BATTLE
|
|
|
|
dw_const LancesRoomPlayerIsMovingScript, SCRIPT_LANCESROOM_PLAYER_IS_MOVING
|
|
|
|
dw_const LancesRoomNoopScript, SCRIPT_LANCESROOM_NOOP
|
|
|
|
|
|
|
|
LancesRoomNoopScript:
|
2014-05-18 18:19:10 +00:00
|
|
|
ret
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomDefaultScript:
|
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
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, TEXT_LANCESROOM_LANCE
|
2024-09-19 01:01:18 +00:00
|
|
|
ldh [hTextID], 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
|
2024-09-24 15:39:44 +00:00
|
|
|
set BIT_CUR_MAP_LOADED_1, [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
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomLanceEndBattleScript:
|
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
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, TEXT_LANCESROOM_LANCE
|
2024-09-19 01:01:18 +00:00
|
|
|
ldh [hTextID], 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.
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, A_BUTTON | B_BUTTON | SELECT | START | D_RIGHT | D_LEFT | D_UP | D_DOWN
|
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
|
2023-07-14 01:27:56 +00:00
|
|
|
ld a, SCRIPT_LANCESROOM_PLAYER_IS_MOVING
|
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
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomPlayerIsMovingScript:
|
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
|
2023-07-14 01:27:56 +00:00
|
|
|
xor a ; SCRIPT_LANCESROOM_DEFAULT
|
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:
|
2023-07-14 01:27:56 +00:00
|
|
|
def_text_pointers
|
|
|
|
dw_const LancesRoomLanceText, TEXT_LANCESROOM_LANCE
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2021-04-13 22:24:37 +00:00
|
|
|
LancesRoomTrainerHeaders:
|
|
|
|
def_trainers
|
|
|
|
LancesRoomTrainerHeader0:
|
2023-07-14 01:27:56 +00:00
|
|
|
trainer EVENT_BEAT_LANCES_ROOM_TRAINER_0, 0, LancesRoomLanceBeforeBattleText, LancesRoomLanceEndBattleText, LancesRoomLanceAfterBattleText
|
2020-07-14 19:45:36 +00:00
|
|
|
db -1 ; end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomLanceText:
|
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
|
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomLanceBeforeBattleText:
|
|
|
|
text_far _LancesRoomLanceBeforeBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomLanceEndBattleText:
|
|
|
|
text_far _LancesRoomLanceEndBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_end
|
2014-05-18 18:19:10 +00:00
|
|
|
|
2023-07-14 01:27:56 +00:00
|
|
|
LancesRoomLanceAfterBattleText:
|
|
|
|
text_far _LancesRoomLanceAfterBattleText
|
2020-07-04 21:09:35 +00:00
|
|
|
text_asm
|
2015-07-21 17:36:03 +00:00
|
|
|
SetEvent EVENT_BEAT_LANCE
|
2014-05-18 18:19:10 +00:00
|
|
|
jp TextScriptEnd
|