aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/SilphCoElevator.asm
blob: ffdf101eea17ecfd4d0ef9cdb65fe19b5d225ab5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
SilphCoElevator_Script:
	ld hl, wCurrentMapScriptFlags
	bit BIT_CUR_MAP_LOADED_1, [hl]
	res BIT_CUR_MAP_LOADED_1, [hl]
	push hl
	call nz, SilphCoElevatorStoreWarpEntriesScript
	pop hl
	bit BIT_CUR_MAP_USED_ELEVATOR, [hl]
	res BIT_CUR_MAP_USED_ELEVATOR, [hl]
	call nz, SilphCoElevatorShakeScript
	xor a
	ld [wAutoTextBoxDrawingControl], a
	inc a
	ld [wDoNotWaitForButtonPressAfterDisplayingText], a
	ret

SilphCoElevatorStoreWarpEntriesScript:
	ld hl, wWarpEntries
	ld a, [wWarpedFromWhichWarp]
	ld b, a
	ld a, [wWarpedFromWhichMap]
	ld c, a
	call .StoreWarpEntry
	; fallthrough
.StoreWarpEntry:
	inc hl
	inc hl
	ld a, b
	ld [hli], a
	ld a, c
	ld [hli], a
	ret

SilphCoElevatorCopyWarpMapsScript:
	ld hl, SilphCoElevatorFloors
	call LoadItemList
	ld hl, SilphCoElevatorWarpMaps
	ld de, wElevatorWarpMaps
	ld bc, SilphCoElevatorWarpMaps.End - SilphCoElevatorWarpMaps
	call CopyData
	ret

SilphCoElevatorFloors:
	db 11 ; #
	db FLOOR_1F
	db FLOOR_2F
	db FLOOR_3F
	db FLOOR_4F
	db FLOOR_5F
	db FLOOR_6F
	db FLOOR_7F
	db FLOOR_8F
	db FLOOR_9F
	db FLOOR_10F
	db FLOOR_11F
	db -1 ; end

; These specify where the player goes after getting out of the elevator.
SilphCoElevatorWarpMaps:
	; warp number, map id
	db 3, SILPH_CO_1F
	db 2, SILPH_CO_2F
	db 2, SILPH_CO_3F
	db 2, SILPH_CO_4F
	db 2, SILPH_CO_5F
	db 2, SILPH_CO_6F
	db 2, SILPH_CO_7F
	db 2, SILPH_CO_8F
	db 2, SILPH_CO_9F
	db 2, SILPH_CO_10F
	db 1, SILPH_CO_11F
.End:

SilphCoElevatorShakeScript:
	call Delay3
	farcall ShakeElevator
	ret

SilphCoElevator_TextPointers:
	def_text_pointers
	dw_const SilphCoElevatorElevatorText, TEXT_SILPHCOELEVATOR_ELEVATOR

SilphCoElevatorElevatorText:
	text_asm
	call SilphCoElevatorCopyWarpMapsScript
	ld hl, SilphCoElevatorWarpMaps
	predef DisplayElevatorFloorMenu
	jp TextScriptEnd