LI2 Roguelite
player.h
Go to the documentation of this file.
1 #ifndef _PLAYER_H_
2 #define _PLAYER_H_
3 
5 #define PLAYER_SYMBOL '@'
7 #define PLAYER_COLOR COLOR_WHITE
9 #define MAX_HEALTH 100
11 #define PLAYER_STARTING_ATTACK 5
13 #define PLAYER_STARTING_DEFENSE 2
14 
16 #define PLAYER_VISION 10 // cells
18 #define PLAYER_VISION_WIDTH 1 // cells (nr adjacent lines of sight = 2 * PLAYER_VISION_WIDTH)
19 
21 #define PLAYER_EARING_RANGE_CLOSE 10
23 #define PLAYER_EARING_RANGE_FAR 40
25 #define PLAYER_EARING_PROB 30
26 
27 
28 typedef struct inventory Inventory;
29 
53 typedef struct player {
54  unsigned int x;
55  unsigned int y;
56  char symbol;
57  int health;
58  int defense;
59  int attack;
60  int vision;
68  int direction;
69  int color;
72 
73 
74 Player *initPlayer(int x, int y);
75 //void movePlayer(Player *p, int dx, int dy);
77 void drawPlayer(Player *p);
78 void freePlayer(void *p);
79 
80 #endif
void updatePotionEffects(Player *p)
Updates the potion effects of the player.
Definition: player.c:58
void drawPlayer(Player *p)
Draws the player on the screen.
Definition: player.c:43
void freePlayer(void *p)
frees the player. Sets all fields to 0 and frees the memory.
Definition: player.c:92
struct player Player
Structure of a player.
Player * initPlayer(int x, int y)
Initializes a new player. Allocates memory for a new player and initializes its fields.
Definition: player.c:14
Inventory structure represents the player inventory.
Definition: inventory.h:26
Structure of a player.
Definition: player.h:53
int vision
Definition: player.h:60
unsigned int y
Definition: player.h:55
int earing_range_close
Definition: player.h:62
unsigned int x
Definition: player.h:54
int potion_invincibility_turns
Definition: player.h:66
int sensory_potion_turns
Definition: player.h:65
int health
Definition: player.h:57
int defense
Definition: player.h:58
int max_health
Definition: player.h:67
int direction
Definition: player.h:68
int earing_range_far
Definition: player.h:63
int earing_prob
Definition: player.h:64
int attack
Definition: player.h:59
int vision_width
Definition: player.h:61
char symbol
Definition: player.h:56
int color
Definition: player.h:69
Inventory * inventory
Definition: player.h:70