-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcommon.h
62 lines (52 loc) · 1.37 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _COMMON_H_
#define _COMMON_H_
#define SCREEN_WIDTH 512
#define SCREEN_HEIGHT 480
#define SCREEN_MODE MODE_NTSC
#define rnd(max) ((rand()*(max))/(32768)+1)
#define rnd_rng(min,max) (rand()%(max-min))+min
#define MAX(a,b) ((a) > (b) ? a : b)
#define MIN(a,b) ((a) < (b) ? a : b)
// Reason to LOCK the game and rem a life
enum err_codes
{
ERR_NONE, // nothing bad happened
ERR_BEER_0, // beer reached beginning of table
ERR_BEER_1, // empty beer reached end of table
ERR_DRUNKARD // drunkard reached end of table
};
struct err_condition
{
int err_table; // where the condition happen
int err_code; // error code
};
struct err_condition *err_cond;
struct table_coords
{
int x_start;
int x_finish;
int y;
};
struct Frame
{
int x;
int y;
};
struct GAME_PARAMS
{
char *name; // difficulty level label
int drunkard_gen_time; // waiting time before a new drunkard appearance
int drunkard_speed; // advance/retreat (in pixels) between animation frames
int drunkard_weight; // retreat (in pixels) when catching a beer
int drunkard_drinking_time; // waiting time while drinking a beer
int avail_lives; // available lives
};
// error message severity
enum MESSAGE_SEVERITY
{
ERR = 0,
WARN,
DBG
};
void fail(int severity, char *msg); // output on stdout ERR,WARN,DBG messages
#endif /* _COMMON_H_ */