cursor: the cursor can no longer wrap
authorLukas Krickl <lukas@krickl.dev>
Thu, 27 Mar 2025 10:16:09 +0000 (11:16 +0100)
committerLukas Krickl <lukas@krickl.dev>
Thu, 27 Mar 2025 10:16:09 +0000 (11:16 +0100)
Scroll also stops when getting to the edge.

src/defs.s
src/player.s

index 5b79f6554a2375ae1cba2d07bafa5d22cbd56b42..cc23cb16ebcb39b34ffd18a23449e23671dab0ca 100644 (file)
@@ -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 
index 9e89a25deff86e63fb5d1c8c869d1470dde1a7df..d7fb393e47ce3dc811a5c0b7cbc855bc50a42fff 100644 (file)
@@ -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: