This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
globals.c
144 lines (114 loc) · 2.67 KB
/
globals.c
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
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#include "defs.h"
/*
* Global Variables
*/
// Game version
float gGameVersion = 1.0;
// Main loop flag
int quit = 0;
// Pause variable
int gPause;
int gSound;
int gMusic;
// Define game screen
int gameScreen = 0;
int gScreen = 0;
int gGameMode = 1;
int gPhysics = 1;
int can_music_play = 1;
//Power up
int gPowerUp;
int gPowerUpId = 5;
int powerup_x;
int powerup_y;
int controlInverter = 0;
int bigracket = 0;
int smallracket = 0;
// Bonus time
int gTime;
int bonus;
// The window to render to
SDL_Window* gWindow = NULL;
// The ball
NPC ball[LEN];
BLOCK brick[COLUMNS][LINES];
RACKET player;
// The surface contained by the window
SDL_Surface* gScreenSurface = NULL;
// The ball image
SDL_Surface* gBall = NULL;
// Current displayed PNG image
SDL_Surface* gBRICKSurface = NULL;
// Current displayed PNG image (racket)
SDL_Surface* gPLAYERSurface = NULL;
SDL_Surface* gPLAYERSMALLSurface = NULL;
SDL_Surface* gPLAYERLARGESurface = NULL;
// Icon image
SDL_Surface* gIcon = NULL;
// Image for buttons
SDL_Surface* buttonnew = NULL;
SDL_Surface* buttonoptions = NULL;
SDL_Surface* buttonrankings = NULL;
SDL_Surface* buttonhome = NULL;
SDL_Surface* buttonendless = NULL;
SDL_Surface* buttoncampaign = NULL;
SDL_Surface* buttonclassic = NULL;
SDL_Surface* buttonalternate = NULL;
SDL_Surface* buttonplay = NULL;
SDL_Surface* breakout = NULL;
SDL_Surface* config = NULL;
SDL_Surface* optionsback = NULL;
SDL_Surface* optionsback1 = NULL;
SDL_Surface* optionsback2 = NULL;
SDL_Surface* rankback = NULL;
SDL_Surface* pause = NULL;
SDL_Surface* buttonquit = NULL;
SDL_Surface* arrow_right = NULL;
SDL_Surface* arrow_left = NULL;
SDL_Surface* minus = NULL;
SDL_Surface* plus = NULL;
//Image for power up
SDL_Surface* power_up = NULL;
// Image for side_bar
SDL_Surface* side_bar = NULL;
//Image for sound icon
SDL_Surface* sound = NULL;
// Control variable for optimal FPS handling
Uint32 next_time;
// Check Level Clearance
int levelClear = COLUMNS*LINES;
int level = 0;
// Check if ball is in game
int ball_in_game;
// Average block resistance
int avg_resist;
// Brick breaking sound
Mix_Chunk* gBrickWAV;
// Racket collision sound
Mix_Chunk* gRacketWAV;
// Game music
Mix_Music* gMusicWAV;
// Volume
int soundVolume = 128;
// Game font
TTF_Font* gFont;
// Check if ttf needs to update
int contalevel = 1;
int contascore = 0;
int contalives = 3;
int contabonus = 600;
int contapower = 5;
int blocklevel = 0;
int blockscore = 0;
int blocklives = 0;
int blockbonus = 0;
int blockpower = 0;
// Global ranking
RANKED gRankedVector[5];
RANKED gRankedVector2[5];
RANKED gRankedVector3[5];
RANKED gRankedVector4[5];