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
|
|
|
|
ld de, CurElevator
|
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
|
|
|
|
ld a, [BackupMapGroup]
|
|
|
|
ld d, a
|
|
|
|
ld a, [BackupMapNumber]
|
|
|
|
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
|
2015-11-12 16:10:19 +00:00
|
|
|
ld de, BackupWarpNumber
|
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
|
|
|
|
ld hl, Options
|
|
|
|
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
|
|
|
|
ld [Options], a
|
|
|
|
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
|
2015-12-17 22:51:32 +00:00
|
|
|
ld hl, CurElevatorFloors
|
2015-11-11 21:11:08 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
pop de
|
|
|
|
call GetFloorString
|
|
|
|
ret
|
|
|
|
; 13550
|
|
|
|
|
|
|
|
Elevator_MenuDataHeader: ; 0x13550
|
|
|
|
db $40 ; flags
|
|
|
|
db 01, 12 ; start coords
|
|
|
|
db 09, 18 ; end coords
|
|
|
|
dw Elevator_MenuData2
|
|
|
|
db 1 ; default option
|
|
|
|
; 0x13558
|
|
|
|
|
|
|
|
Elevator_MenuData2: ; 0x13558
|
|
|
|
db $10 ; flags
|
|
|
|
db 4, 0 ; rows, columns
|
|
|
|
db 1 ; horizontal spacing
|
2015-12-17 22:51:32 +00:00
|
|
|
dbw 0, CurElevator
|
2015-11-11 21:11:08 +00:00
|
|
|
dba GetElevatorFlorStrings
|
|
|
|
dba NULL
|
|
|
|
dba NULL
|
|
|
|
; 13568
|
|
|
|
|
|
|
|
GetElevatorFlorStrings: ; 13568
|
|
|
|
ld a, [MenuSelection]
|
|
|
|
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
|
|
|
|
ld hl, .floors
|
|
|
|
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
|
|
|
|
|
|
|
|
.floors
|
|
|
|
dw .b4f
|
|
|
|
dw .b3f
|
|
|
|
dw .b2f
|
|
|
|
dw .b1f
|
|
|
|
dw ._1f
|
|
|
|
dw ._2f
|
|
|
|
dw ._3f
|
|
|
|
dw ._4f
|
|
|
|
dw ._5f
|
|
|
|
dw ._6f
|
|
|
|
dw ._7f
|
|
|
|
dw ._8f
|
|
|
|
dw ._9f
|
|
|
|
dw ._10f
|
|
|
|
dw ._11f
|
|
|
|
dw .roof
|
|
|
|
|
|
|
|
.b4f
|
|
|
|
db "B4F@"
|
|
|
|
.b3f
|
|
|
|
db "B3F@"
|
|
|
|
.b2f
|
|
|
|
db "B2F@"
|
|
|
|
.b1f
|
|
|
|
db "B1F@"
|
|
|
|
._1f
|
|
|
|
db "1F@"
|
|
|
|
._2f
|
|
|
|
db "2F@"
|
|
|
|
._3f
|
|
|
|
db "3F@"
|
|
|
|
._4f
|
|
|
|
db "4F@"
|
|
|
|
._5f
|
|
|
|
db "5F@"
|
|
|
|
._6f
|
|
|
|
db "6F@"
|
|
|
|
._7f
|
|
|
|
db "7F@"
|
|
|
|
._8f
|
|
|
|
db "8F@"
|
|
|
|
._9f
|
|
|
|
db "9F@"
|
|
|
|
._10f
|
|
|
|
db "10F@"
|
|
|
|
._11f
|
|
|
|
db "11F@"
|
|
|
|
.roof
|
|
|
|
db "ROOF@"
|
|
|
|
; 135db
|