refactor: split player_move and decompose handle_input

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iaac0cda778dd541eb34980f3e902ca726a6a6964
This commit is contained in:
raf 2026-04-05 20:11:37 +03:00
commit ee116ef33f
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 228 additions and 230 deletions

View file

@ -6,8 +6,11 @@
// Initialize player at position
void player_init(Player *p, int x, int y);
// Move player, return 1 if moved/attacked, 0 if blocked
int player_move(Player *p, int dx, int dy, Map *map, Enemy *enemies, int enemy_count);
// Move player to (x+dx, y+dy); returns 1 if moved, 0 if blocked
int player_move(Player *p, int dx, int dy, Map *map);
// Find a living enemy at tile (x, y); returns NULL if none
Enemy *player_find_enemy_at(Enemy *enemies, int count, int x, int y);
// Player attacks enemy (deal damage)
void player_attack(Player *p, Enemy *e);