File: mainVars.inc

package info (click to toggle)
blockattack 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 9,992 kB
  • sloc: cpp: 26,060; pascal: 351; sh: 172; makefile: 15
file content (208 lines) | stat: -rw-r--r-- 6,777 bytes parent folder | download
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*
===========================================================================
blockattack - Block Attack - Rise of the Blocks
Copyright (C) 2005-2012 Poul Sander

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/

Source information and contacts persons can be found at
http://blockattack.net
===========================================================================
*/

//Make sure it is only included once
#ifndef _MAINVARS_HPP
#define	_MAINVARS_HPP

#include "sago/SagoSprite.hpp"
#include "BlockGame.hpp"
#include "sago/SagoTextField.hpp"
#include "sago/SagoTextBox.hpp"


//main variables and constants


//Animation lengths:
#define READYTIME 500
#define BOMBTIME 200
#define CURSORTIME 200

#ifndef SHAREDIR
#define SHAREDIR "."
#endif

const char sharedir[] = SHAREDIR;

//All graphic in the game:
sago::SagoSprite backgroundImage; //Stores the background image
sago::SagoSprite bExit;
static sago::SagoSprite backBoard;     //Stores the background to the board
static sago::SagoSprite bForward;      //The "forward" button
#if NETWORK
//static sago::SagoSprite bNetwork;
//static sago::SagoSprite bConnect;
//static sago::SagoSprite bHost;
#endif
static sago::SagoSprite blackLine;		//The seperator in stage clear
static sago::SagoSprite stageBobble;	//The bobble instage clear
SDL_Renderer *screen;        //The whole screen;
static sago::SagoTextBox tbGameOver;
static sago::SagoTextBox tbWinner;
static sago::SagoTextBox tbDraw;
static sago::SagoSprite iChainFrame;
//Animations:
static sago::SagoSprite cursor;    //The animated cursor
static sago::SagoSprite bomb;
static sago::SagoSprite ready;      //Before the blocks fall
static sago::SagoSprite explosion[4];   //Then a block explodes
//Animations end
static sago::SagoSprite counter[3];    //Counts down from 3
sago::SagoSprite bricks[7];     //The bricks, saved in an array of pointers
static sago::SagoSprite crossover;     //Cross the bricks that will be cleared soon
static sago::SagoSprite balls[7];      //The balls (the small ones that jump around)

static sago::SagoSprite boardBackBack;
static sago::SagoSprite garbageTL;			//the Garbage Blocks
static sago::SagoSprite garbageT;
static sago::SagoSprite garbageTR;
static sago::SagoSprite garbageR;
static sago::SagoSprite garbageBR;
static sago::SagoSprite garbageB;
static sago::SagoSprite garbageBL;
static sago::SagoSprite garbageL;
static sago::SagoSprite garbageFill;
static sago::SagoSprite garbageM;
static sago::SagoSprite garbageML;
static sago::SagoSprite garbageMR;
static sago::SagoSprite smiley[4];
static sago::SagoSprite garbageGM;
static sago::SagoSprite garbageGML;
static sago::SagoSprite garbageGMR;
static sago::SagoSprite transCover;        //The transperant block, covers the upcomming
static sago::SagoSprite bSkip;
static sago::SagoSprite bRetry;
const int bExitSize = 100;  //height and width of the exit button
const int bExitOffset = 140; //pixels from the buttom right corner to the top left of the exit button

static sago::MusicHandler bgMusic;         //backgroundMusic
static sago::MusicHandler highbeatMusic;   //Background music with higher beat
static sago::SoundHandler boing;           //boing sound when clearing
static sago::SoundHandler applause;        //Applause, then the player is good
static sago::SoundHandler photoClick;      //clickSound
static sago::SoundHandler counterChunk;         //When counting down
static sago::SoundHandler counterFinalChunk;

static bool bMouseUp;              //true if the mouse(1) is unpressed
static bool bMouseUp2;             //true if the mouse(2) is unpressed
#if NETWORK
static bool bNetworkOpen;			//Show the network menu
#endif
static bool bNearDeathPrev;                    //Near death status last time checked.
static bool puzzleLoaded;          //true if the puzzle levels have been loaded
static bool drawBalls;             //if true balls are drawed to the screen, this might lower framerate too much



//global settings (reset everytime the game starts)
static Uint8 player1Speed=0;
static Uint8 player2Speed=0;
static bool player1AI=false;		//Is AI enabled?
static bool player2AI=false;		//Is AI enabled for player 2 (opponent in single player)
static Uint8 player1AIlevel=3;		//What level is AI? 0 min, 6 max
static Uint8 player2AIlevel=3;
static const Uint8 AIlevels=7;		//7 possible levels: 0..6
static Uint8 player1handicap=0;
static Uint8 player2handicap=0;

unsigned long int currentTime;      //contains the current time, so we don't call SDL_GetTickets() too often...

bool twoPlayers;    //True if two players are playing

//Old Stage Clear Buble
static int oldBubleX, oldBubleY;

//Allows starting the game with just a single puzzle. Mainly to be able to open a puzzle directly from the level editor
static bool singlePuzzle = false; 
static int singlePuzzleNr = 0;
static std::string singlePuzzleFile;

#if DEBUG
//frame counter (fps)
unsigned long int Frames, Ticks;
char FPS[10];
#endif


//keySetup
const int player1keys = 0;
const int player2keys = 2;

//Stores the controls
struct control
{
	SDL_Keycode up;
	SDL_Keycode down;
	SDL_Keycode left;
	SDL_Keycode right;
	SDL_Keycode change;
	SDL_Keycode push;
};

control keySettings[3];	//array to hold the controls (default and two custom)

#define KEYMENU_MAXWITH 4
#define KEYMENU_MAXDEPTH 7


static const int buttonXsize = 120;
static const int buttonYsize = 40;

struct ButtonCords
{
	int x;
	int y;
	int xsize;
	int ysize;
};

ButtonCords cordNextButton =
{
	cordNextButton.x = 3*bsize+(3*bsize-buttonXsize)/2,
	cordNextButton.y = 10*bsize,
	cordNextButton.xsize = buttonXsize,
	cordNextButton.ysize = buttonYsize
};

ButtonCords cordRetryButton =
{
	cordRetryButton.x = (3*bsize-buttonXsize)/2,
	cordRetryButton.y = 10*bsize,
	cordRetryButton.xsize = buttonXsize,
	cordRetryButton.ysize = buttonYsize
};

static sago::SagoTextField player1name;
static sago::SagoTextField player2name;
static sago::SagoTextField player1time;
static sago::SagoTextField player2time;
static sago::SagoTextField player1score;
static sago::SagoTextField player2score;
static sago::SagoTextField player1chain;
static sago::SagoTextField player2chain;
static sago::SagoTextField player1speed;
static sago::SagoTextField player2speed;


#endif