-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeclarations.h
154 lines (137 loc) · 3.73 KB
/
declarations.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// Libraries, header files
#include <stdio.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
#include <time.h>
#include <windows.h>
// Colours
#define PINK al_map_rgb(255, 0, 255)
#define BLACK al_map_rgb(0, 0, 0)
#define SLATEGREY al_map_rgb(112,128,144)
#define RED al_map_rgb(255, 0, 0)
#define WHITE al_map_rgb(255, 255, 255)
// Define Constants
#define NUMBER_OF_ROCKS 20
#define NUMBER_OF_LIVES 5
#define NUMBER_OF_HIGHSCORES 5
#define NUMBER_OF_POWERUPS 2
#define NUMBER_OF_BUTTONS 4
#define NUMBER_OF_MUSIC_SAMPLES 4
#define FPS 30
#define SCREEN_WIDTH 620
#define SCREEN_HEIGHT 800
#define GENERATE_RANGE 570
// Error Code Constants
#define ERROR_DISPLAY -1
#define ERROR_KEYBOARD -2
#define ERROR_CHARACTER_IMG -3
#define ERROR_IMG_ADDON -4
#define ERROR_PRIMATIVE_ADDON -5
#define ERROR_MOUSE_ADDON -6
#define ERROR_FPSTIMER -7
#define ERROR_INVINCIBLE_TIMER -8
#define ERROR_SLOW_MOTION_TIMER -9
#define ERROR_TINY_TIMER -10
#define ERROR_SPEED_INCREASER_TIMER -11
#define ERROR_EVENT_QUEUE -12
#define ERROR_ARIAL_FONT -13
#define ERROR_SMALL_ARIAL_FONT -14
#define ERROR_ROCK_IMG -15
#define ERROR_LIFE_IMG -16
#define ERROR_INVINCIBILITY_IMG -17
#define ERROR_SLOW_MOTION_IMG -18
#define ERROR_MINI_IMG -19
#define ERROR_FONT_ADDON -20
#define ERROR_TTF_ADDON -21
#define ERROR_ALLEGRO -22
#define ERROR_IMAGE_ADDON -23
#define ERROR_INSTALL_AUDIO -24
#define ERROR_ACODEC_ADDON -25
#define ERROR_MUSIC_FILE_COLLISION -26
#define ERROR_MUSIC_FILE_GAMEMUSIC -27
#define ERROR_MUSIC_FILE_BUTTONCLICK -28
#define ERROR_MUSIC_FILE_CHARACTER_DEATH -29
#define ERROR_POWERUP_IMG -30
#define ERROR_MINI_CHARACTER_IMG -31
#define ERROR_HURT_CHARACTER_IMG -32
#define ERROR_LOAD_FPTR -33
#define ERROR_DISPLAY_TIMER -34
// Game Mode Constants
#define START_MENU 1
#define INSTRUCTIONS 2
#define GAME_ON 3
#define CREDITS 4
#define HIGHSCORE 5
#define PAUSED 6
// Object Constants
#define CHARACTER 1
#define ROCKS 2
#define POWER_UPS 3
#define LIVES 4
// Set up structs
struct Character {
ALLEGRO_BITMAP *bitmap;
int characterPositionX;
int characterPositionY;
int bbRight, bbLeft, bbTop, bbBottom;
bool drawCharacterHit;
};
struct Rocks {
ALLEGRO_BITMAP *bitmap;
int rockPositionX;
int rockPositionY;
int bbRight, bbLeft, bbTop, bbBottom;
};
struct Lives {
ALLEGRO_BITMAP *bitmap;
bool usable;
int xCoordinate;
int yCoordinate;
};
struct PowerUp {
ALLEGRO_BITMAP *bitmap;
int powerupXCoordinate;
int powerupYCoordinate;
bool collision;
int bbRight, bbLeft, bbTop, bbBottom;
// Power up Type
bool powerUpMini;
bool powerUpSlowmo;
bool powerUpInvincibility;
};
struct Keyboard {
bool keyUp;
bool keyDown;
bool keyLeft;
bool keyRight;
bool keySpace;
bool keyB;
bool keyR;
bool keyP;
int xCoordinateMovement;
int yCoordinateMovement;
};
struct Button {
int upperLeftXCoordinate, upperLeftYCoordinate, lowerRightXCoordinate, lowerRightYCoordinate;
bool clicked;
bool filled;
};
struct InstructionImages {
ALLEGRO_BITMAP *arrowKeys, *tinyPowerUp, *slowMotionPowerUp, *invinciblePowerUp;
};
struct Paused {
bool slowmoTimer, invincibleTimer, miniTimer, speedIncreaser;
};
struct Application {
ALLEGRO_DISPLAY *display;
ALLEGRO_TIMER *timer, *speedIncreaser, *slowmoTimer, *invincibleTimer, *miniTimer, *displayTimer;
ALLEGRO_FONT *arial, *smallArial;
ALLEGRO_EVENT_QUEUE *event_queue;
ALLEGRO_SAMPLE *gameMusic, *buttonClick, *characterDeath, *collision;
};