-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
88 lines (67 loc) · 1.73 KB
/
main.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once
#include <jo/jo.h>
#include "state.h"
#include "constants.h"
#include "util.h"
#define VERSION "v0.9"
// supported game types
typedef enum _GAME_MODE
{
GAME_MODE_PRACTICE = 0, // unlimited lives
GAME_MODE_NORMAL = 1, // 3 lives
GAME_MODE_HARDCORE = 2, // 1 life
GAME_MODE_TIME_ATTACK = 3, // only one team can move at a time.
GAME_MODE_MAX,
} GAME_MODE;
// supported game difficulty
typedef enum _GAME_DIFFICULTY
{
GAME_DIFFICULTY_EASY = 0,
GAME_DIFFICULTY_MEDIUM = 1,
GAME_DIFFICULTY_HARD = 2,
GAME_DIFFICULTY_MAX,
} GAME_DIFFICULTY;
// records whether or not an input has been pressed that frame
typedef struct _inputCache{
bool pressedUp;
bool pressedDown;
bool pressedLeft;
bool pressedRight;
bool pressedAC;
bool pressedB;
bool pressedX;
bool pressedY;
bool pressedZ;
bool pressedStart;
bool pressedLT;
bool pressedRT;
int prev_mouse_x;
int prev_mouse_y;
} INPUTCACHE, *PINPUTCACHE;
// represents game state
typedef struct _GAME
{
// current game state
GAME_STATE gameState;
// practice, normal, hardcore, or time attack
GAME_MODE gameMode;
// easy, medium, hard
// affects how many mines are in the game
GAME_DIFFICULTY gameDifficulty;
// debug level
int debug;
// number of lives (1, 3, 6, 9)
int numLives;
// is the game is paused
bool isPaused;
// is the game finished?
bool isGameOver;
// how many frames since all players were dead
int gameOverFrames;
// hack to cache controller inputs
// used for menus by player 1
INPUTCACHE input;
} GAME, *PGAME;
// globals
extern GAME g_Game;
void cacheInputDirection(bool* up, bool* down, bool* left, bool *right);