forked from NotAShelf/rogged
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia1e0a503dba03e5df7b863b97db962e36a6a6964
39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
#ifndef PLAYER_H
|
|
#define PLAYER_H
|
|
|
|
#include "common.h"
|
|
|
|
// 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);
|
|
|
|
// Player attacks enemy (deal damage)
|
|
void player_attack(Player *p, Enemy *e);
|
|
|
|
// Get item at floor position (x, y), returns NULL if none
|
|
Item *get_item_at_floor(Item *items, int count, int x, int y);
|
|
|
|
// Pick up item, return 1 if successful, 0 if failed (full/invalid)
|
|
int player_pickup(Player *p, Item *i);
|
|
|
|
// Use item (potions only - weapons/armor are equipped)
|
|
void player_use_item(Player *p, Item *i);
|
|
|
|
// Use first available potion in inventory, return 1 if used
|
|
int player_use_first_item(Player *p);
|
|
|
|
// Get item at inventory index, returns NULL if invalid
|
|
Item *player_get_inventory_item(Player *p, int index);
|
|
|
|
// Remove item from inventory at index (shifts remaining items)
|
|
void player_remove_inventory_item(Player *p, int index);
|
|
|
|
// Equip weapon/armor from inventory, return 1 if successful
|
|
int player_equip_item(Player *p, int inv_index);
|
|
|
|
// Drop item from inventory at index (returns it to floor), return 1 if successful
|
|
int player_drop_item(Player *p, int inv_index, Item *items, int item_count);
|
|
|
|
#endif // PLAYER_H
|