From: Lukas Krickl Date: Thu, 27 Mar 2025 10:16:09 +0000 (+0100) Subject: cursor: the cursor can no longer wrap X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=4f901cf1f00701ad9c1792ffc3928114cb1bea98;p=gbrg%2F.git cursor: the cursor can no longer wrap Scroll also stops when getting to the edge. --- diff --git a/src/defs.s b/src/defs.s index 5b79f65..cc23cb1 100644 --- a/src/defs.s +++ b/src/defs.s @@ -66,6 +66,6 @@ ; defines end of scroll location #define CURSOR_MIN_X 0 -#define CURSOR_MAX_X 0 +#define CURSOR_MAX_X 0xF8 #define CURSOR_MIN_Y 0 -#define CURSOR_MAX_Y 0 +#define CURSOR_MAX_Y 0xB8 diff --git a/src/player.s b/src/player.s index 9e89a25..d7fb393 100644 --- a/src/player.s +++ b/src/player.s @@ -58,6 +58,9 @@ player_update: handle_inputs: input_held BTNDOWN jr z, @notdown REL + + call try_abort_move_down + ret z cursor_move_direction cursor_move_y, cursor_move_x, 1 @@ -102,6 +105,9 @@ handle_inputs: input_held BTNRIGHT jr z, @notright REL + call try_abort_move_right + ret z + cursor_move_direction cursor_move_x, cursor_move_y, 1 ; adjust scroll @@ -143,11 +149,20 @@ try_abort_move_left: ld hl, cursor_x jp try_abort_move_at +try_abort_move_right: + ld b, CURSOR_MAX_X + ld hl, cursor_x + jp try_abort_move_at + try_abort_move_up: ld b, CURSOR_MIN_Y ld hl, cursor_y jp try_abort_move_at +try_abort_move_down: + ld b, CURSOR_MAX_Y + ld hl, cursor_y + jp try_abort_move_at ; aborts a move direciton ; inputs: