Browse Source

Fix vertical scrolling controls

master
Forest Belton 2 years ago
parent
commit
26abbfc32d
2 changed files with 23 additions and 63 deletions
  1. +23
    -0
      src/main.s
  2. +0
    -63
      src/map.s

+ 23
- 0
src/main.s View File

@ -76,7 +76,19 @@ start:
.update_up:
ld hl, rSCY
dec [hl]
ld a, [hl]
and %111
cp %111
jr nz, .update_up_map
ld a, [CURRENT_CAMERA_Y]
dec a
ld [CURRENT_CAMERA_Y], a
.update_up_map:
call Map_Scroll
jr .vbl
.down:
ld a, [keys]
@ -98,7 +110,18 @@ start:
.update_down:
ld hl, rSCY
inc [hl]
ld a, [hl]
and %111
jr nz, .update_down_map
ld a, [CURRENT_CAMERA_Y]
inc a
ld [CURRENT_CAMERA_Y], a
.update_down_map:
call Map_Scroll
jr .vbl
.right:
ld a, [keys]

+ 0
- 63
src/map.s View File

@ -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)

Loading…
Cancel
Save