LI2 Roguelite
state.h
Go to the documentation of this file.
1 #ifndef _STATE_H_
2 #define _STATE_H_
3 
4 #define DEFAULT_MODE VISION_MODE
5 #define NORMAL_MODE 0
6 #define DISTANCE_MODE 1
7 #define VISION_MODE 2 // default mode
8 // #define CAVERN_MODE 3 // TODO: implement cavern mode
9 #define EXIT_MODE -1
10 #define QUIT_MODE -2 // When the player quits the game
11 
19 #define EXIT_COST 500 // gold
20 
21 typedef struct map Map;
22 typedef struct player Player;
23 typedef struct monster Monster;
24 
38 typedef struct state {
39  unsigned long int turn;
40  int mode;
41 
42  Map *map;
45  int wall_prob;
46 
49  int nMonsters;
51 
52 State *initState(int width, int height);
53 void freeState(void *p);
54 void updateState(State *st, int input_key);
55 void drawState(State *st);
56 void calculateState(State *st, int input_key);
57 
58 #endif
void updateState(State *st, int input_key)
Update the game state. Used in the main loop.
Definition: state.c:127
struct state State
Sructure of the game state.
State * initState(int width, int height)
Initialize a new game state.
Definition: state.c:24
void freeState(void *p)
Free the game state.
Definition: state.c:81
void drawState(State *st)
Draw the game state.
Definition: state.c:98
void calculateState(State *st, int input_key)
Calulates the state based on the input key.
Definition: state.c:176
Structure that represents a map in the game.
Definition: map.h:26
Structure of a monster.
Definition: monster.h:28
Structure of a player.
Definition: player.h:53
Sructure of the game state.
Definition: state.h:38
int first_pass
Definition: state.h:43
int wall_prob
Definition: state.h:45
Player * player
Definition: state.h:47
Map * map
Definition: state.h:42
int second_pass
Definition: state.h:44
int nMonsters
Definition: state.h:49
Monster ** monsters
Definition: state.h:48
int mode
Definition: state.h:40
unsigned long int turn
Definition: state.h:39