From 524db5938c663a144416aba9c534a0226e85ef0f Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Wed, 26 Mar 2025 17:48:05 +0100 Subject: [PATCH] working on canceling scrolls when camera cannot move --- src/player.s | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.30.2