From: Lukas Krickl Date: Sun, 11 May 2025 04:18:34 +0000 (+0200) Subject: cursor: Renamed cursor rotuines to reflect their actual use X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=b8c3cb599ee84260f0de0d309f49951b1d58b086;p=gbrg%2F.git cursor: Renamed cursor rotuines to reflect their actual use This is effectively just a namespace change --- diff --git a/src/main.s b/src/main.s index 6e060c6..ca44f74 100644 --- a/src/main.s +++ b/src/main.s @@ -28,7 +28,7 @@ entry: call lcd_on call vblank_wait - call player_init + call cursor_player_init call enableinterrupts diff --git a/src/player.s b/src/player.s index 9f95c1c..8a13571 100644 --- a/src/player.s +++ b/src/player.s @@ -7,7 +7,7 @@ #define CURSOR_MOVE_SPEED 8 ; init the player -player_init: +cursor_player_init: ld de, st_cursor ld hl, actor_player ld bc, st_size @@ -21,16 +21,16 @@ player_init: ; actor table ; inputs: ; hl: pointer to player memory -player_update: - call handle_inputs +cursor_player_update: + call cursor_handle_inputs push bc - call player_draw_cursor + call cursor_player_draw_cursor pop bc ret ; updates the cursor ; sprites -player_draw_cursor: +cursor_player_draw_cursor: @draw_cursor: ; draw cursor ld a, [scroll_y] @@ -60,7 +60,7 @@ player_draw_cursor: ldnull bc ret -handle_inputs: +cursor_handle_inputs: input_held BTNA jr z, @not_a REL ; TODO: remove demo actor load @@ -74,7 +74,7 @@ handle_inputs: input_held BTNDOWN jr z, @notdown REL - call try_abort_move_down + call cursor_try_abort_move_down jp z, @done cursor_move_direction cursor_move_y, cursor_move_x, 1 @@ -90,7 +90,7 @@ handle_inputs: input_held BTNUP jr z, @notup REL - call try_abort_move_up + call cursor_try_abort_move_up jp z, @done cursor_move_direction cursor_move_y, cursor_move_x, NEGATE @@ -106,7 +106,7 @@ handle_inputs: input_held BTNLEFT jr z, @notleft REL - call try_abort_move_left + call cursor_try_abort_move_left jr z, @done REL cursor_move_direction cursor_move_x, cursor_move_y, NEGATE @@ -122,7 +122,7 @@ handle_inputs: input_held BTNRIGHT jr z, @notright REL - call try_abort_move_right + call cursor_try_abort_move_right jr z, @done REL cursor_move_direction cursor_move_x, cursor_move_y, 1 @@ -164,22 +164,22 @@ cursor_move: call scroll_update ret -try_abort_move_left: +cursor_try_abort_move_left: ld b, CURSOR_MIN_X ld hl, cursor_x jp try_abort_move_at -try_abort_move_right: +cursor_try_abort_move_right: ld b, CURSOR_MAX_X ld hl, cursor_x jp try_abort_move_at -try_abort_move_up: +cursor_try_abort_move_up: ld b, CURSOR_MIN_Y ld hl, cursor_y jp try_abort_move_at -try_abort_move_down: +cursor_try_abort_move_down: ld b, CURSOR_MAX_Y ld hl, cursor_y jp try_abort_move_at diff --git a/src/state.s b/src/state.s index fc6e3cf..a4c47a2 100644 --- a/src/state.s +++ b/src/state.s @@ -29,7 +29,7 @@ st_update: ; de = actor ptr pop de push de - rst 0x08 + call_hl pop hl ; hl = original actor ptr = dst @@ -82,9 +82,9 @@ st_null: st_def 0xFF, st_null_fn, st_null st_cursor: - st_def 0x00, player_update, st_cursor + st_def 0x00, cursor_player_update, st_cursor st_cursor_draw: - st_def 0x00, player_draw_cursor, st_cursor + st_def 0x00, cursor_player_draw_cursor, st_cursor st_cursor_delay: st_def CURSOR_MOVE_TIMER, st_null_fn, st_cursor diff --git a/src/update.s b/src/update.s index 170c2b5..6e73f56 100644 --- a/src/update.s +++ b/src/update.s @@ -28,7 +28,6 @@ update_unit_placement: ret update_pause: - call player_update ldnull bc ret