2015-11-11 21:11:08 +00:00
|
|
|
Elevator:: ; 1342d
|
2015-12-17 22:51:32 +00:00
|
|
|
call .LoadPointer
|
|
|
|
call .FindCurrentFloor
|
|
|
|
jr c, .quit
|
|
|
|
ld [wElevatorOriginFloor], a
|
|
|
|
call Elevator_AskWhichFloor
|
|
|
|
jr c, .quit
|
|
|
|
ld hl, wElevatorOriginFloor
|
2015-11-11 21:11:08 +00:00
|
|
|
cp [hl]
|
2015-12-17 22:51:32 +00:00
|
|
|
jr z, .quit
|
|
|
|
call Elevator_GoToFloor
|
2015-11-11 21:11:08 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.quit
|
2015-11-11 21:11:08 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 1344a
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.LoadPointer: ; 1344a
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, b
|
2015-12-17 22:51:32 +00:00
|
|
|
ld [wElevatorPointerBank], a
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, e
|
2017-12-10 03:24:43 +00:00
|
|
|
ld [wElevatorPointer], a
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, d
|
2017-12-10 03:24:43 +00:00
|
|
|
ld [wElevatorPointer + 1], a
|
2015-12-17 22:51:32 +00:00
|
|
|
call .LoadFloors
|
2015-11-11 21:11:08 +00:00
|
|
|
ret
|
|
|
|
; 1345a
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.LoadFloors: ; 1345a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wCurElevator
|
2015-11-11 21:11:08 +00:00
|
|
|
ld bc, 4
|
2017-12-10 03:24:43 +00:00
|
|
|
ld hl, wElevatorPointer
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-17 22:51:32 +00:00
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-17 22:51:32 +00:00
|
|
|
.loop
|
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
call GetFarByte
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
add hl, bc
|
2015-12-17 22:51:32 +00:00
|
|
|
cp -1
|
|
|
|
jr nz, .loop
|
2015-11-11 21:11:08 +00:00
|
|
|
ret
|
|
|
|
; 1347d
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.FindCurrentFloor: ; 1347d
|
2017-12-10 03:24:43 +00:00
|
|
|
ld hl, wElevatorPointer
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-12-17 22:51:32 +00:00
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
call GetFarByte
|
|
|
|
ld c, a
|
|
|
|
inc hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBackupMapGroup]
|
2015-11-11 21:11:08 +00:00
|
|
|
ld d, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wBackupMapNumber]
|
2015-11-11 21:11:08 +00:00
|
|
|
ld e, a
|
2015-12-17 22:51:32 +00:00
|
|
|
ld b, 0
|
|
|
|
.loop2
|
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
call GetFarByte
|
2015-12-17 22:51:32 +00:00
|
|
|
cp -1
|
|
|
|
jr z, .fail
|
2015-11-11 21:11:08 +00:00
|
|
|
inc hl
|
2016-05-04 15:46:23 +00:00
|
|
|
inc hl
|
2015-12-17 22:51:32 +00:00
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
|
|
|
cp d
|
2015-12-17 22:51:32 +00:00
|
|
|
jr nz, .next1
|
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
call GetFarByte
|
|
|
|
inc hl
|
|
|
|
cp e
|
2015-12-17 22:51:32 +00:00
|
|
|
jr nz, .next2
|
|
|
|
jr .done
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.next1
|
2015-11-11 21:11:08 +00:00
|
|
|
inc hl
|
2015-12-17 22:51:32 +00:00
|
|
|
.next2
|
2015-11-11 21:11:08 +00:00
|
|
|
inc b
|
2015-12-17 22:51:32 +00:00
|
|
|
jr .loop2
|
2015-11-11 21:11:08 +00:00
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.done
|
2015-11-11 21:11:08 +00:00
|
|
|
xor a
|
|
|
|
ld a, b
|
|
|
|
ret
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.fail
|
2015-11-11 21:11:08 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 134c0
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
Elevator_GoToFloor: ; 134c0
|
2015-11-11 21:11:08 +00:00
|
|
|
push af
|
2017-12-10 03:24:43 +00:00
|
|
|
ld hl, wElevatorPointer
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
pop af
|
|
|
|
ld bc, 4
|
|
|
|
call AddNTimes
|
|
|
|
inc hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wBackupWarpNumber
|
2015-12-17 22:51:32 +00:00
|
|
|
ld a, [wElevatorPointerBank]
|
2015-11-11 21:11:08 +00:00
|
|
|
ld bc, 3
|
|
|
|
call FarCopyBytes
|
|
|
|
ret
|
|
|
|
; 134dd
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
Elevator_AskWhichFloor: ; 134dd
|
2015-11-11 21:11:08 +00:00
|
|
|
call LoadStandardMenuDataHeader
|
|
|
|
ld hl, Elevator_WhichFloorText
|
|
|
|
call PrintText
|
|
|
|
call Elevator_GetCurrentFloorText
|
|
|
|
ld hl, Elevator_MenuDataHeader
|
|
|
|
call CopyMenuDataHeader
|
2015-11-17 20:54:03 +00:00
|
|
|
call InitScrollingMenu
|
2015-11-11 21:11:08 +00:00
|
|
|
call UpdateSprites
|
|
|
|
xor a
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wMenuScrollPosition], a
|
2015-12-18 03:31:16 +00:00
|
|
|
call ScrollingMenu
|
2015-12-25 03:58:42 +00:00
|
|
|
call CloseWindow
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuJoypad]
|
2015-12-17 22:51:32 +00:00
|
|
|
cp B_BUTTON
|
|
|
|
jr z, .cancel
|
2015-11-11 21:11:08 +00:00
|
|
|
xor a
|
2015-12-17 22:51:32 +00:00
|
|
|
ld a, [wScrollingMenuCursorPosition]
|
2015-11-11 21:11:08 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-17 22:51:32 +00:00
|
|
|
.cancel
|
2015-11-11 21:11:08 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 1350d
|
|
|
|
|
|
|
|
Elevator_WhichFloorText: ; 0x1350d
|
|
|
|
; Which floor?
|
|
|
|
text_jump UnknownText_0x1bd2bc
|
|
|
|
db "@"
|
|
|
|
; 0x13512
|
|
|
|
|
|
|
|
|
|
|
|
Elevator_GetCurrentFloorText: ; 13512
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOptions
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
set NO_TEXT_SCROLL, [hl]
|
|
|
|
hlcoord 0, 0
|
|
|
|
ld b, 4
|
|
|
|
ld c, 8
|
|
|
|
call TextBox
|
|
|
|
hlcoord 1, 2
|
|
|
|
ld de, Elevator_CurrentFloorText
|
|
|
|
call PlaceString
|
|
|
|
hlcoord 4, 4
|
|
|
|
call Elevator_GetCurrentFloorString
|
|
|
|
pop af
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wOptions], a
|
2015-11-11 21:11:08 +00:00
|
|
|
ret
|
|
|
|
; 13537
|
|
|
|
|
|
|
|
Elevator_CurrentFloorText: ; 13537
|
|
|
|
db "Now on:@"
|
|
|
|
; 1353f
|
|
|
|
|
|
|
|
|
|
|
|
Elevator_GetCurrentFloorString: ; 1353f
|
|
|
|
push hl
|
2015-12-17 22:51:32 +00:00
|
|
|
ld a, [wElevatorOriginFloor]
|
2015-11-11 21:11:08 +00:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wCurElevatorFloors
|
2015-11-11 21:11:08 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
pop de
|
|
|
|
call GetFloorString
|
|
|
|
ret
|
|
|
|
; 13550
|
|
|
|
|
|
|
|
Elevator_MenuDataHeader: ; 0x13550
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 12, 1, 18, 9
|
2015-11-11 21:11:08 +00:00
|
|
|
dw Elevator_MenuData2
|
|
|
|
db 1 ; default option
|
|
|
|
; 0x13558
|
|
|
|
|
|
|
|
Elevator_MenuData2: ; 0x13558
|
2018-01-14 10:59:56 +00:00
|
|
|
db SCROLLINGMENU_DISPLAY_ARROWS ; flags
|
2015-11-11 21:11:08 +00:00
|
|
|
db 4, 0 ; rows, columns
|
|
|
|
db 1 ; horizontal spacing
|
2018-01-23 22:39:09 +00:00
|
|
|
dbw 0, wCurElevator
|
2018-01-11 06:45:27 +00:00
|
|
|
dba GetElevatorFloorStrings
|
2015-11-11 21:11:08 +00:00
|
|
|
dba NULL
|
|
|
|
dba NULL
|
|
|
|
; 13568
|
|
|
|
|
2018-01-11 06:45:27 +00:00
|
|
|
GetElevatorFloorStrings: ; 13568
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-11 21:11:08 +00:00
|
|
|
GetFloorString: ; 1356b
|
|
|
|
push de
|
|
|
|
call FloorToString
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
jp PlaceString
|
|
|
|
; 13575
|
|
|
|
|
|
|
|
FloorToString: ; 13575
|
|
|
|
push de
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2018-01-11 06:45:27 +00:00
|
|
|
ld hl, ElevatorFloorNames
|
2015-11-11 21:11:08 +00:00
|
|
|
add hl, de
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, de
|
2015-11-11 21:11:08 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
; 13583
|
|
|
|
|
2018-01-11 06:45:27 +00:00
|
|
|
INCLUDE "data/elevator_floors.asm"
|