From 0d850bb8e8c71206150aac86a0ca374853c60143 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 26 Sep 2025 07:13:35 +0200 Subject: [PATCH] player: wip weapon types --- src/actor.s | 2 +- src/defs.s | 7 ++++++- src/player.s | 7 ++++--- src/wram.s | 15 ++++++++------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/actor.s b/src/actor.s index 672e66a..9f8545d 100644 --- a/src/actor.s +++ b/src/actor.s @@ -226,7 +226,7 @@ actor_test_movement: jp nz, @rect_test_loop pop de - ld b, ACTS_MAX + ld b, ACTS_MAX + 1 ; +1 to include player ; start at player actor ld hl, player diff --git a/src/defs.s b/src/defs.s index 5a722cc..f262314 100644 --- a/src/defs.s +++ b/src/defs.s @@ -13,7 +13,7 @@ #define NULL 0 -#define ACTS_MAX 12 +#define ACTS_MAX 32 #define MAP_OBJ_MAX 32 #define RECT_MAX 12 @@ -139,3 +139,8 @@ .de GPF_NO_SCROLL, 1 ; scroll a row up next vblank .de GPF_SCROLL, 2 + + ; weapon type for player +.se 0 +.de WT_PISTOL, 1 +.de WT_RIFLE, 1 diff --git a/src/player.s b/src/player.s index 74c44ae..5fc83b9 100644 --- a/src/player.s +++ b/src/player.s @@ -14,9 +14,6 @@ player_init: ; updates the special player actor player_update: - ld a, [player_direction_proc] - xor a, 1 - ld [player_direction_proc], a ld b, BTNUP input_held @@ -242,6 +239,10 @@ player_draw: call actor_draw ret + ; shoots the player's current weapon +player_shoot: + ret + ; combination of update and draw call player_update_and_draw: call player_draw diff --git a/src/wram.s b/src/wram.s index a8ab6cb..41420f9 100644 --- a/src/wram.s +++ b/src/wram.s @@ -63,19 +63,20 @@ srand: .adv 2 ; advance if possible player_next_scroll_y: .adv 1 -; either 0 or 1 -; if 0 up/down are handeled this frame -; if 1 left/right are handeled -; this is done because the player tends to be -; colliding with most objects on screen and each direction -; performs the checks -player_direction_proc: .adv 1 + ; y/x sub pixel movement for player player_sub_pixel_y: .adv 1 player_sub_pixel_x: .adv 1 + + ; current player weapon +player_curr_weapon: .adv 1 + player: .adv act_size +; actor table should follow player! actors: .adv act_size * ACTS_MAX + map_objs: .adv mo_size * MAP_OBJ_MAX + rectangles: .adv r_size * RECT_MAX ; temporary rectangle used for collision checks -- 2.30.2