86 lines
2.0 KiB
C
86 lines
2.0 KiB
C
#ifndef CONSTS_H
|
|
#define CONSTS_H
|
|
|
|
// ------------------------------------------------------------------------ //
|
|
// SDL-related struct
|
|
|
|
typedef struct imgs {
|
|
int len;
|
|
SDL_Texture** arr;
|
|
} imgs;
|
|
|
|
// ------------------------------------------------------------------------ //
|
|
// car shenanigans
|
|
typedef struct pt_t {int ix; int iy;} pt;
|
|
|
|
typedef struct ptf_t {double fx; double fy;} ptf;
|
|
|
|
typedef struct car_t car;
|
|
|
|
// unused for now
|
|
typedef struct item_t {
|
|
const char* name;
|
|
void (*onCollect)(car* user);
|
|
void (*onUse)(car* user);
|
|
} item;
|
|
|
|
typedef struct car_t {
|
|
ptf pos; // remains in [0, ROOM_SIZE[
|
|
ptf vel;
|
|
int nCoins;
|
|
item* itm; // either NULL or a pointer to an item
|
|
} car;
|
|
|
|
// ------------------------------------------------------------------------ //
|
|
// (take a) map
|
|
typedef struct color_t {
|
|
uint8_t red;
|
|
uint8_t green;
|
|
uint8_t blue;
|
|
} color;
|
|
|
|
// one chunk
|
|
typedef enum road_t {NONE, START, END, STR_V, STR_H, TURN_NE, TURN_SE, TURN_SW, TURN_NW} road;
|
|
|
|
typedef struct level_t {
|
|
pt start;
|
|
pt end;
|
|
int lines;
|
|
int cols;
|
|
road** map;
|
|
} level;
|
|
|
|
// global car data
|
|
typedef struct carData_t {
|
|
car* c;
|
|
color rgb;
|
|
int chx;
|
|
int chy;
|
|
} carData;
|
|
|
|
// ------------------------------------------------------------------------ //
|
|
extern imgs* digits; // SDL data
|
|
extern imgs* letters; // SDL data
|
|
|
|
extern int currentTurn; // name explains
|
|
|
|
extern carData* players; // contains each player and its corresponding data
|
|
extern int nPlayers; // size of players
|
|
// ------------------------------------------------------------------------ //
|
|
// constants
|
|
extern const int WIDTH;
|
|
extern const int HEIGHT;
|
|
|
|
extern const int ROOM_SIZE;
|
|
extern const int MAX_SPEED;
|
|
|
|
extern const double DIST_EDGE;
|
|
extern const double START_EDGE;
|
|
extern const int BARRIERS;
|
|
extern const int RESTITUTION_WALL;
|
|
extern const int RESTITUTION_PLAYER;
|
|
|
|
extern const double FRICTION;
|
|
extern const double DV;
|
|
|
|
#endif |