|
|
@ -111,69 +111,6 @@ Map_Load:: |
|
|
|
|
|
|
|
; Update map state based on SCX/SCY |
|
|
|
Map_Scroll:: |
|
|
|
; Adjust CURRENT_CAMERA_X |
|
|
|
|
|
|
|
; ; Adjust CURRENT_CAMERA_Y if [LAST_SCY]/8 != [rSCY]/8 |
|
|
|
; ld a, [rSCY] |
|
|
|
; srl a |
|
|
|
; srl a |
|
|
|
; srl a |
|
|
|
|
|
|
|
; ld hl, LAST_SCY |
|
|
|
; ld b, [hl] |
|
|
|
; srl b |
|
|
|
; srl b |
|
|
|
; srl b |
|
|
|
|
|
|
|
; cp b |
|
|
|
; jr c, .cmp |
|
|
|
; jr z, .scroll_up_check |
|
|
|
|
|
|
|
; sub $20 |
|
|
|
|
|
|
|
; .cmp: |
|
|
|
; sub b |
|
|
|
|
|
|
|
; ld hl, CURRENT_CAMERA_Y |
|
|
|
; add [hl] |
|
|
|
; ld [hl], a |
|
|
|
|
|
|
|
; min([LAST_SCY]/8 - [SCY/8], [SCY/8] - [LAST_SCY]/8) |
|
|
|
|
|
|
|
ld a, [LAST_SCY] |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
ld b, a |
|
|
|
|
|
|
|
ld a, [rSCY] |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
|
|
|
|
; c <- scy/8 - last_scy/8 |
|
|
|
sub b |
|
|
|
ld c, a |
|
|
|
|
|
|
|
ld a, [rSCY] |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
ld b, a |
|
|
|
|
|
|
|
ld a, [LAST_SCY] |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
srl a |
|
|
|
sub b |
|
|
|
; a <- last_scy/8 - scy/8 |
|
|
|
|
|
|
|
cp c |
|
|
|
|
|
|
|
.tryit: |
|
|
|
ld [CURRENT_CAMERA_Y], a |
|
|
|
|
|
|
|
.scroll_up_check: |
|
|
|
; If SCY = PAGEY, write map row |
|
|
|
; map coords = CURRENT_CAMERA_X, CURRENT_CAMERA_Y - 2 |
|
|
|
; HL = _SCRN0 + 32 * (32 - page_y/8 - 2) |
|
|
|