From: Lukas Krickl Date: Wed, 26 Mar 2025 16:48:05 +0000 (+0100) Subject: working on canceling scrolls when camera cannot move X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=524db5938c663a144416aba9c534a0226e85ef0f;p=gbrg%2F.git working on canceling scrolls when camera cannot move --- diff --git a/src/player.s b/src/player.s index b06eff9..bd45c11 100644 --- a/src/player.s +++ b/src/player.s @@ -123,6 +123,7 @@ cursor_move: ; if timer is 0 apply movement ; and jump to next tile call try_abort_move + jp z, @done ld a, [cursor_y] ld b, a @@ -149,15 +150,19 @@ try_abort_move: ld hl, cursor_x ld de, cursor_move_x call try_abort_move_at + ret z + ; TODO check other directions here ret + ; aborts a move direciton ; inputs: ; b: compare variable (e.g. min or max value) ; c: move direction compare value (e.g. move + or -) ; hl: position ptr ; de: move variable to set to 0 + ; returns: z == 0 if move was aborted try_abort_move_at: ; do not abort if position is wrong ld a, [hl] @@ -172,4 +177,5 @@ try_abort_move_at: xor a, a ld [de], a + ; z = 0 due to xor a, a ret