git repos / blockattack-game

blame: source/code/mainVars.hpp

normal view · raw

89c4a3a6 sago007 2008-08-29 14:32 1
/*
c53e6443 sago007 2012-04-17 11:04 2
===========================================================================
c53e6443 sago007 2012-04-17 11:04 3
blockattack - Block Attack - Rise of the Blocks
c53e6443 sago007 2012-04-17 11:04 4
Copyright (C) 2005-2012 Poul Sander
c53e6443 sago007 2012-04-17 11:04 5
c53e6443 sago007 2012-04-17 11:04 6
This program is free software: you can redistribute it and/or modify
c53e6443 sago007 2012-04-17 11:04 7
it under the terms of the GNU General Public License as published by
c53e6443 sago007 2012-04-17 11:04 8
the Free Software Foundation, either version 2 of the License, or
c53e6443 sago007 2012-04-17 11:04 9
(at your option) any later version.
c53e6443 sago007 2012-04-17 11:04 10
c53e6443 sago007 2012-04-17 11:04 11
This program is distributed in the hope that it will be useful,
c53e6443 sago007 2012-04-17 11:04 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
c53e6443 sago007 2012-04-17 11:04 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c53e6443 sago007 2012-04-17 11:04 14
GNU General Public License for more details.
c53e6443 sago007 2012-04-17 11:04 15
c53e6443 sago007 2012-04-17 11:04 16
You should have received a copy of the GNU General Public License
c53e6443 sago007 2012-04-17 11:04 17
along with this program.  If not, see http://www.gnu.org/licenses/
c53e6443 sago007 2012-04-17 11:04 18
c53e6443 sago007 2012-04-17 11:04 19
Source information and contacts persons can be found at
c53e6443 sago007 2012-04-17 11:04 20
http://blockattack.sf.net
c53e6443 sago007 2012-04-17 11:04 21
===========================================================================
89c4a3a6 sago007 2008-08-29 14:32 22
*/
89c4a3a6 sago007 2008-08-29 14:32 23
6d48320c sago007 2009-03-28 17:06 24
//Make sure it is only included once
6d48320c sago007 2009-03-28 17:06 25
#ifndef _MAINVARS_HPP
6d48320c sago007 2009-03-28 17:06 26
#define	_MAINVARS_HPP
6d48320c sago007 2009-03-28 17:06 27
89c4a3a6 sago007 2008-08-29 14:32 28
//main variables and constants
89c4a3a6 sago007 2008-08-29 14:32 29
89c4a3a6 sago007 2008-08-29 14:32 30
89c4a3a6 sago007 2008-08-29 14:32 31
//Animation lengths:
89c4a3a6 sago007 2008-08-29 14:32 32
#define READYTIME 500
89c4a3a6 sago007 2008-08-29 14:32 33
#define BOMBTIME 200
89c4a3a6 sago007 2008-08-29 14:32 34
#define CURSORTIME 200
89c4a3a6 sago007 2008-08-29 14:32 35
89c4a3a6 sago007 2008-08-29 14:32 36
89c4a3a6 sago007 2008-08-29 14:32 37
using namespace std;	//remove it if you dare...
89c4a3a6 sago007 2008-08-29 14:32 38
char sharedir[] = SHAREDIR;
89c4a3a6 sago007 2008-08-29 14:32 39
89c4a3a6 sago007 2008-08-29 14:32 40
//All graphic in the game (as pointers):
30f910dd sago007 2010-11-10 21:02 41
static SDL_Surface *background;    //Stores background
b7590374 sago007 2011-05-19 16:15 42
SDL_Surface *backgroundImage; //Stores the background image
30f910dd sago007 2010-11-10 21:02 43
static int backgroundImageW, backgroundImageH; //size of background image
30f910dd sago007 2010-11-10 21:02 44
static SDL_Surface *backBoard;     //Stores the background to the board
69d650b4 sago007 2011-07-20 15:24 45
//static SDL_Surface *b1player;
69d650b4 sago007 2011-07-20 15:24 46
//static SDL_Surface *b2players;
69d650b4 sago007 2011-07-20 15:24 47
//static SDL_Surface *bVsMode;
69d650b4 sago007 2011-07-20 15:24 48
//static SDL_Surface *bVsModeConfig; //Added in 1.4.0
69d650b4 sago007 2011-07-20 15:24 49
//static SDL_Surface *bStageClear;
69d650b4 sago007 2011-07-20 15:24 50
//static SDL_Surface *bPuzzle;
43611709 sago007 2011-04-23 17:18 51
static CppSdl::CppSdlImageHolder bNewGame;      //The New Game botton
69d650b4 sago007 2011-07-20 15:24 52
//static SDL_Surface *bEndless;      //Endless button (sub to new)
69d650b4 sago007 2011-07-20 15:24 53
//static SDL_Surface *bTimeTrial;    //Time trial button (sub to new)
30f910dd sago007 2010-11-10 21:02 54
static SDL_Surface *bOptions;      //The Options botton
89c4a3a6 sago007 2008-08-29 14:32 55
//new in 1.1.1
30f910dd sago007 2010-11-10 21:02 56
static SDL_Surface *bConfigure;    //The configure button
30f910dd sago007 2010-11-10 21:02 57
static SDL_Surface *bSelectPuzzle; //The Select Puzzle Button
30f910dd sago007 2010-11-10 21:02 58
static SDL_Surface *bBack;         //The "Back" button
30f910dd sago007 2010-11-10 21:02 59
static SDL_Surface *bForward;      //The "forward" button
89c4a3a6 sago007 2008-08-29 14:32 60
//new in 1.1.1 end
89c4a3a6 sago007 2008-08-29 14:32 61
//new in 1.1.2
30f910dd sago007 2010-11-10 21:02 62
static SDL_Surface *iChainBack;
89c4a3a6 sago007 2008-08-29 14:32 63
//new in 1.1.2 end (nota that iSmallFont has also been added)
89c4a3a6 sago007 2008-08-29 14:32 64
//new in 1.2.0
69d650b4 sago007 2011-07-20 15:24 65
//static SDL_Surface *bReplay;
69d650b4 sago007 2011-07-20 15:24 66
//static SDL_Surface *bSave;
69d650b4 sago007 2011-07-20 15:24 67
//static SDL_Surface *bLoad;
2f30c381 sago007 2008-09-14 13:08 68
#if NETWORK
69d650b4 sago007 2011-07-20 15:24 69
//static SDL_Surface *bNetwork;
69d650b4 sago007 2011-07-20 15:24 70
//static SDL_Surface *bConnect;
69d650b4 sago007 2011-07-20 15:24 71
//static SDL_Surface *bHost;
89c4a3a6 sago007 2008-08-29 14:32 72
#endif
89c4a3a6 sago007 2008-08-29 14:32 73
//new in 1.2.0 end
30f910dd sago007 2010-11-10 21:02 74
static SDL_Surface *bHighScore;    //The High Score botton
69d650b4 sago007 2011-07-20 15:24 75
//static SDL_Surface *bExit;         //The Exit botton
30f910dd sago007 2010-11-10 21:02 76
static SDL_Surface *blackLine;		//The seperator in stage clear
30f910dd sago007 2010-11-10 21:02 77
static SDL_Surface *stageBobble;	//The bobble instage clear
26ddb424 sago007 2011-06-09 20:06 78
SDL_Surface *screen;        //The whole screen;
30f910dd sago007 2010-11-10 21:02 79
static SDL_Surface *iGameOver;     //The gameOver image
30f910dd sago007 2010-11-10 21:02 80
static SDL_Surface *iWinner;		//the "winner" image
30f910dd sago007 2010-11-10 21:02 81
static SDL_Surface *iDraw;			//the "draw" image
30f910dd sago007 2010-11-10 21:02 82
static SDL_Surface *iLoser;		//the "loser" image
89c4a3a6 sago007 2008-08-29 14:32 83
//Animations:
30f910dd sago007 2010-11-10 21:02 84
static SDL_Surface *cursor[2];    //The animated cursor
30f910dd sago007 2010-11-10 21:02 85
static SDL_Surface *bomb[2];       //Bomb then the bricks should blow
30f910dd sago007 2010-11-10 21:02 86
static SDL_Surface *ready[2];      //Before the blocks fall
30f910dd sago007 2010-11-10 21:02 87
static SDL_Surface *explosion[4];   //Then a block explodes
89c4a3a6 sago007 2008-08-29 14:32 88
//Animations end
30f910dd sago007 2010-11-10 21:02 89
static SDL_Surface *counter[3];    //Counts down from 3
30f910dd sago007 2010-11-10 21:02 90
static SDL_Surface *bricks[7];     //The bricks, saved in an array of pointers
30f910dd sago007 2010-11-10 21:02 91
static SDL_Surface *crossover;     //Cross the bricks that will be cleared soon
30f910dd sago007 2010-11-10 21:02 92
static SDL_Surface *balls[7];      //The balls (the small ones that jump around)
925b7e58 sago007 2011-04-25 16:35 93
//static SDL_Surface *iBlueFont;      //Contains the blue font used
925b7e58 sago007 2011-04-25 16:35 94
//static SDL_Surface *iSmallFont;	//Small font used for the chain text
14e13624 sago007 2011-07-20 17:14 95
//static SDL_Surface *optionsBack;
30f910dd sago007 2010-11-10 21:02 96
static SDL_Surface *changeButtonsBack;
30f910dd sago007 2010-11-10 21:02 97
static SDL_Surface *dialogBox;
89c4a3a6 sago007 2008-08-29 14:32 98
//SDL_Surface *fileDialogBox;  //Manual entering of filename, new in 1.1.1, obsolute in 1.1.2
30f910dd sago007 2010-11-10 21:02 99
static SDL_Surface *bOn;
30f910dd sago007 2010-11-10 21:02 100
static SDL_Surface *bOff;
14e13624 sago007 2011-07-20 17:14 101
//static SDL_Surface *bChange;
30f910dd sago007 2010-11-10 21:02 102
static SDL_Surface *b1024;
30f910dd sago007 2010-11-10 21:02 103
static SDL_Surface *iLevelCheck;		//To the level select screen
30f910dd sago007 2010-11-10 21:02 104
static SDL_Surface *iLevelCheckBox;
cc6724c9 sago007 2012-04-16 21:11 105
static SDL_Surface *iLevelCheckBoxMarked;
30f910dd sago007 2010-11-10 21:02 106
static SDL_Surface *iCheckBoxArea;
30f910dd sago007 2010-11-10 21:02 107
static SDL_Surface *boardBackBack;
30f910dd sago007 2010-11-10 21:02 108
static SDL_Surface *garbageTL;			//the Garbage Blocks
30f910dd sago007 2010-11-10 21:02 109
static SDL_Surface *garbageT;
30f910dd sago007 2010-11-10 21:02 110
static SDL_Surface *garbageTR;
30f910dd sago007 2010-11-10 21:02 111
static SDL_Surface *garbageR;
30f910dd sago007 2010-11-10 21:02 112
static SDL_Surface *garbageBR;
30f910dd sago007 2010-11-10 21:02 113
static SDL_Surface *garbageB;
30f910dd sago007 2010-11-10 21:02 114
static SDL_Surface *garbageBL;
30f910dd sago007 2010-11-10 21:02 115
static SDL_Surface *garbageL;
30f910dd sago007 2010-11-10 21:02 116
static SDL_Surface *garbageFill;
30f910dd sago007 2010-11-10 21:02 117
static SDL_Surface *garbageM;
30f910dd sago007 2010-11-10 21:02 118
static SDL_Surface *garbageML;
30f910dd sago007 2010-11-10 21:02 119
static SDL_Surface *garbageMR;
30f910dd sago007 2010-11-10 21:02 120
static SDL_Surface *smiley[4];
30f910dd sago007 2010-11-10 21:02 121
static SDL_Surface *garbageGM;
30f910dd sago007 2010-11-10 21:02 122
static SDL_Surface *garbageGML;
30f910dd sago007 2010-11-10 21:02 123
static SDL_Surface *garbageGMR;
30f910dd sago007 2010-11-10 21:02 124
static SDL_Surface *transCover;        //The transperant block, covers the upcomming
1572de2b sago007 2008-09-11 18:15 125
#if LEVELEDITOR
30f910dd sago007 2010-11-10 21:02 126
static SDL_Surface *bCreateFile;
30f910dd sago007 2010-11-10 21:02 127
static SDL_Surface *bDeletePuzzle;
30f910dd sago007 2010-11-10 21:02 128
static SDL_Surface *bLoadFile;
30f910dd sago007 2010-11-10 21:02 129
static SDL_Surface *bMoveBack;
30f910dd sago007 2010-11-10 21:02 130
static SDL_Surface *bMoveDown;
30f910dd sago007 2010-11-10 21:02 131
static SDL_Surface *bMoveForward;
30f910dd sago007 2010-11-10 21:02 132
static SDL_Surface *bMoveLeft;
30f910dd sago007 2010-11-10 21:02 133
static SDL_Surface *bMoveRight;
30f910dd sago007 2010-11-10 21:02 134
static SDL_Surface *bMoveUp;
30f910dd sago007 2010-11-10 21:02 135
static SDL_Surface *bNewPuzzle;
30f910dd sago007 2010-11-10 21:02 136
static SDL_Surface *bSaveFileAs;
30f910dd sago007 2010-11-10 21:02 137
static SDL_Surface *bSavePuzzle;
30f910dd sago007 2010-11-10 21:02 138
static SDL_Surface *bSaveToFile;
30f910dd sago007 2010-11-10 21:02 139
static SDL_Surface *bTestPuzzle;
1572de2b sago007 2008-09-11 18:15 140
#endif
30f910dd sago007 2010-11-10 21:02 141
static SDL_Surface *bSkip;
30f910dd sago007 2010-11-10 21:02 142
static SDL_Surface *bRetry;
30f910dd sago007 2010-11-10 21:02 143
static SDL_Surface *bNext;
78d03b38 sago007 2008-11-13 19:56 144
b7590374 sago007 2011-05-19 16:15 145
CppSdl::CppSdlImageHolder menuMarked;
b7590374 sago007 2011-05-19 16:15 146
CppSdl::CppSdlImageHolder menuUnmarked;
89c4a3a6 sago007 2008-08-29 14:32 147
//end new in 1.4.0
8d488d32 sago007 2011-04-17 13:02 148
//static SDL_Surface *mouse;				//The mouse cursor
b7590374 sago007 2011-05-19 16:15 149
CppSdl::CppSdlImageHolder mouse;
89c4a3a6 sago007 2008-08-29 14:32 150
89c4a3a6 sago007 2008-08-29 14:32 151
30f910dd sago007 2010-11-10 21:02 152
static SDL_Surface *tmp;				//a temporary surface to use DisplayFormat
89c4a3a6 sago007 2008-08-29 14:32 153
89c4a3a6 sago007 2008-08-29 14:32 154
925b7e58 sago007 2011-04-25 16:35 155
//static SFont_Font *fBlueFont;      //Stores the blue font (SFont)
925b7e58 sago007 2011-04-25 16:35 156
//static SFont_Font *fSmallFont;		//Stores the small font (SFont)
89c4a3a6 sago007 2008-08-29 14:32 157
//TTFont ttfont;           //Stores the TTF font (TTFSDL)
925b7e58 sago007 2011-04-25 16:35 158
static NFont nf_button_font;        //Font used for buttons!
26ddb424 sago007 2011-06-09 20:06 159
NFont nf_scoreboard_font;
925b7e58 sago007 2011-04-25 16:35 160
static NFont nf_standard_blue_font;      //Font used instead of the old blue SFont
925b7e58 sago007 2011-04-25 16:35 161
static NFont nf_standard_small_font;
89c4a3a6 sago007 2008-08-29 14:32 162
30f910dd sago007 2010-11-10 21:02 163
static Mix_Music *bgMusic;         //backgroundMusic
30f910dd sago007 2010-11-10 21:02 164
static Mix_Music *highbeatMusic;   //Background music with higher beat
30f910dd sago007 2010-11-10 21:02 165
static Mix_Chunk *boing;           //boing sound when clearing
30f910dd sago007 2010-11-10 21:02 166
static Mix_Chunk *applause;        //Applause, then the player is good
30f910dd sago007 2010-11-10 21:02 167
static Mix_Chunk *photoClick;      //clickSound
30f910dd sago007 2010-11-10 21:02 168
static Mix_Chunk *typingChunk;          //When writing
30f910dd sago007 2010-11-10 21:02 169
static Mix_Chunk *counterChunk;         //When counting down
30f910dd sago007 2010-11-10 21:02 170
static Mix_Chunk *counterFinalChunk;
89c4a3a6 sago007 2008-08-29 14:32 171
89c4a3a6 sago007 2008-08-29 14:32 172
Highscore theTopScoresEndless;      //Stores highscores for endless
89c4a3a6 sago007 2008-08-29 14:32 173
Highscore theTopScoresTimeTrial;    //Stores highscores for timetrial
89c4a3a6 sago007 2008-08-29 14:32 174
30f910dd sago007 2010-11-10 21:02 175
static bool bMouseUp;              //true if the mouse(1) is unpressed
30f910dd sago007 2010-11-10 21:02 176
static bool bMouseUp2;             //true if the mouse(2) is unpressed
30f910dd sago007 2010-11-10 21:02 177
static bool bNewGameOpen;          //show sub menues
30f910dd sago007 2010-11-10 21:02 178
static bool bOptionsOpen;          //Show OptionsMenu (Configure and Select Puzzle)
30f910dd sago007 2010-11-10 21:02 179
static bool b1playerOpen;			//show submenu
30f910dd sago007 2010-11-10 21:02 180
static bool b2playersOpen;			//show submenu
30f910dd sago007 2010-11-10 21:02 181
static bool bReplayOpen;			//Show replay menu
2f30c381 sago007 2008-09-14 13:08 182
#if NETWORK
30f910dd sago007 2010-11-10 21:02 183
static bool bNetworkOpen;			//Show the network menu
89c4a3a6 sago007 2008-08-29 14:32 184
#endif
30f910dd sago007 2010-11-10 21:02 185
static bool showGame;              //the game is active don't show highscores/options
30f910dd sago007 2010-11-10 21:02 186
static bool showOptions;           //true if options is open
30f910dd sago007 2010-11-10 21:02 187
static bool bScreenLocked;			//Don't take input or allow any mouse interaction! Used for dialogbox and warningbox
30f910dd sago007 2010-11-10 21:02 188
static bool showDialog;
30f910dd sago007 2010-11-10 21:02 189
static bool NoSound;				//if true, absolutely no sound will be played, can be set from the commandline
89c4a3a6 sago007 2008-08-29 14:32 190
//prevents crash on systems without a soundcard
26ddb424 sago007 2011-06-09 20:06 191
bool MusicEnabled;			//true if background music is enabled
26ddb424 sago007 2011-06-09 20:06 192
bool SoundEnabled;			//true if sound effects is enabled
30f910dd sago007 2010-11-10 21:02 193
static bool bNearDeath;                        //Play music faster or louder while tru
30f910dd sago007 2010-11-10 21:02 194
static bool bNearDeathPrev;                    //Near death status last time checked.
26ddb424 sago007 2011-06-09 20:06 195
bool bFullscreen;			//true if game is running fullscreen
30f910dd sago007 2010-11-10 21:02 196
static bool puzzleLoaded;          //true if the puzzle levels have been loaded
30f910dd sago007 2010-11-10 21:02 197
static bool drawBalls;             //if true balls are drawed to the screen, this might lower framerate too much
30f910dd sago007 2010-11-10 21:02 198
static bool standardBackground;
b7590374 sago007 2011-05-19 16:15 199
bool highPriority;
30f910dd sago007 2010-11-10 21:02 200
30f910dd sago007 2010-11-10 21:02 201
static bool editorMode = false;
30f910dd sago007 2010-11-10 21:02 202
static bool editorModeTest = false;
89c4a3a6 sago007 2008-08-29 14:32 203
89c4a3a6 sago007 2008-08-29 14:32 204
//Things for network play:
2f30c381 sago007 2008-09-14 13:08 205
#if NETWORK
30f910dd sago007 2010-11-10 21:02 206
static bool networkPlay;
30f910dd sago007 2010-11-10 21:02 207
static bool networkActive;
30f910dd sago007 2010-11-10 21:02 208
static Uint8 nrOfNetworkPlayers;  //Up to 4 players (inkl. self)
30f910dd sago007 2010-11-10 21:02 209
static bool playerAlive[4];
89c4a3a6 sago007 2008-08-29 14:32 210
//sockets here
89c4a3a6 sago007 2008-08-29 14:32 211
#define SERVERPORT 41780
89c4a3a6 sago007 2008-08-29 14:32 212
#define CLIENTPORT 41781
89c4a3a6 sago007 2008-08-29 14:32 213
2f30c381 sago007 2008-09-14 13:08 214
30f910dd sago007 2010-11-10 21:02 215
static char serverAddress[30];
89c4a3a6 sago007 2008-08-29 14:32 216
#endif
89c4a3a6 sago007 2008-08-29 14:32 217
89c4a3a6 sago007 2008-08-29 14:32 218
//should be automatically disabled if framerate to low (isn't implemented and wont be soon/ever):
1572de2b sago007 2008-09-11 18:15 219
//const int ballsFpsEnable = 30;     //If framerate higher -> enable balls
1572de2b sago007 2008-09-11 18:15 220
//const int ballsFpsDisable = 10;    //If framerate lower -> disable balls
89c4a3a6 sago007 2008-08-29 14:32 221
89c4a3a6 sago007 2008-08-29 14:32 222
//other ball constants:
30f910dd sago007 2010-11-10 21:02 223
static const double gravity = 200.8; //acceleration
30f910dd sago007 2010-11-10 21:02 224
static const double startVelocityY = 50.0;
30f910dd sago007 2010-11-10 21:02 225
static const double VelocityX = 50.0;
30f910dd sago007 2010-11-10 21:02 226
static const int ballSize = 16;
30f910dd sago007 2010-11-10 21:02 227
static const double minVelocity = 200.0;
89c4a3a6 sago007 2008-08-29 14:32 228
89c4a3a6 sago007 2008-08-29 14:32 229
//global settings (reset everytime the game starts)
30f910dd sago007 2010-11-10 21:02 230
static Uint8 player1Speed=0;
30f910dd sago007 2010-11-10 21:02 231
static Uint8 player2Speed=0;
30f910dd sago007 2010-11-10 21:02 232
static bool player1AI=false;		//Is AI enabled?
30f910dd sago007 2010-11-10 21:02 233
static bool player2AI=false;		//Is AI enabled for player 2 (opponent in single player)
30f910dd sago007 2010-11-10 21:02 234
static Uint8 player1AIlevel=3;		//What level is AI? 0 min, 6 max
30f910dd sago007 2010-11-10 21:02 235
static Uint8 player2AIlevel=3;
30f910dd sago007 2010-11-10 21:02 236
static const Uint8 AIlevels=7;		//7 possible levels: 0..6
30f910dd sago007 2010-11-10 21:02 237
static Uint8 player1handicap=0;
30f910dd sago007 2010-11-10 21:02 238
static Uint8 player2handicap=0;
89c4a3a6 sago007 2008-08-29 14:32 239
89c4a3a6 sago007 2008-08-29 14:32 240
unsigned long int currentTime;      //contains the current time, so we don't call SDL_GetTickets() too often...
89c4a3a6 sago007 2008-08-29 14:32 241
30f910dd sago007 2010-11-10 21:02 242
static int xsize = 1024;
30f910dd sago007 2010-11-10 21:02 243
static int ysize = 768;
30f910dd sago007 2010-11-10 21:02 244
static int bsize = 50;
89c4a3a6 sago007 2008-08-29 14:32 245
89c4a3a6 sago007 2008-08-29 14:32 246
//Stores the players names (way to long, but at least no buffer overflows (max length is 16 for display reasons))
26ddb424 sago007 2011-06-09 20:06 247
char player1name[30];
26ddb424 sago007 2011-06-09 20:06 248
char player2name[30];
89c4a3a6 sago007 2008-08-29 14:32 249
89c4a3a6 sago007 2008-08-29 14:32 250
//paths
30f910dd sago007 2010-11-10 21:02 251
static string stageClearSavePath;
30f910dd sago007 2010-11-10 21:02 252
static string puzzleSavePath;
30f910dd sago007 2010-11-10 21:02 253
static string puzzleName;              //The filename of
89c4a3a6 sago007 2008-08-29 14:32 254
30f910dd sago007 2010-11-10 21:02 255
static const int nrOfStageLevels = 50;		//number of stages in stage Clear
30f910dd sago007 2010-11-10 21:02 256
static const int maxNrOfPuzzleStages = 50; //Maximum number of puzzle stages
89c4a3a6 sago007 2008-08-29 14:32 257
vector<bool> stageCleared(nrOfStageLevels);		//vector that tells if a stage is cleared
89c4a3a6 sago007 2008-08-29 14:32 258
vector<Uint32> stageTimes(nrOfStageLevels);             //For statistical puposes
89c4a3a6 sago007 2008-08-29 14:32 259
vector<Uint32> stageScores(nrOfStageLevels);            //--||--
89c4a3a6 sago007 2008-08-29 14:32 260
vector<bool> puzzleCleared(maxNrOfPuzzleStages); //vector that tells if puzzle cleared
89c4a3a6 sago007 2008-08-29 14:32 261
vector<int> nrOfMovesAllowed(maxNrOfPuzzleStages);  //Moves to clear
89c4a3a6 sago007 2008-08-29 14:32 262
int puzzleLevels[maxNrOfPuzzleStages][6][12]; //Contains board layout;
89c4a3a6 sago007 2008-08-29 14:32 263
int nrOfPuzzles;    //How many are there actually?
f72abf8b sago007 2010-01-16 20:00 264
bool twoPlayers;    //True if two players are playing
89c4a3a6 sago007 2008-08-29 14:32 265
89c4a3a6 sago007 2008-08-29 14:32 266
//Old mouse position:
30f910dd sago007 2010-11-10 21:02 267
static int oldMousex, oldMousey;
89c4a3a6 sago007 2008-08-29 14:32 268
//Old Stage Clear Buble
30f910dd sago007 2010-11-10 21:02 269
static int oldBubleX, oldBubleY;
89c4a3a6 sago007 2008-08-29 14:32 270
89c4a3a6 sago007 2008-08-29 14:32 271
//bool doublebuf = false; //if true, screen is double buffered
30f910dd sago007 2010-11-10 21:02 272
static char forceredraw; //If 1: always redraw, if 2: rarely redraw
89c4a3a6 sago007 2008-08-29 14:32 273
30f910dd sago007 2010-11-10 21:02 274
static bool singlePuzzle = false; //if true we are just in a little 300x600 window
30f910dd sago007 2010-11-10 21:02 275
static int singlePuzzleNr = 0;
30f910dd sago007 2010-11-10 21:02 276
static string singlePuzzleFile;
89c4a3a6 sago007 2008-08-29 14:32 277
1572de2b sago007 2008-09-11 18:15 278
#if DEBUG
89c4a3a6 sago007 2008-08-29 14:32 279
//frame counter (fps)
89c4a3a6 sago007 2008-08-29 14:32 280
unsigned long int Frames, Ticks;
89c4a3a6 sago007 2008-08-29 14:32 281
char FPS[10];
89c4a3a6 sago007 2008-08-29 14:32 282
#endif
89c4a3a6 sago007 2008-08-29 14:32 283
89c4a3a6 sago007 2008-08-29 14:32 284
int lastNrOfPlayers; //1 if 1 player and 2 if vs. mode
89c4a3a6 sago007 2008-08-29 14:32 285
89c4a3a6 sago007 2008-08-29 14:32 286
//keySetup
89c4a3a6 sago007 2008-08-29 14:32 287
int player1keys, player2keys;
89c4a3a6 sago007 2008-08-29 14:32 288
bool mouseplay1=false;  //The mouse works on the play field
89c4a3a6 sago007 2008-08-29 14:32 289
bool mouseplay2=false;  //Same for player2
89c4a3a6 sago007 2008-08-29 14:32 290
bool joyplay1=false;    //Player one uses the joypad
89c4a3a6 sago007 2008-08-29 14:32 291
bool joyplay2=false;    //Player two uses the joypad
89c4a3a6 sago007 2008-08-29 14:32 292
89c4a3a6 sago007 2008-08-29 14:32 293
//Stores the controls
89c4a3a6 sago007 2008-08-29 14:32 294
struct control
89c4a3a6 sago007 2008-08-29 14:32 295
{
c53e6443 sago007 2012-04-17 11:04 296
	SDLKey up;
c53e6443 sago007 2012-04-17 11:04 297
	SDLKey down;
c53e6443 sago007 2012-04-17 11:04 298
	SDLKey left;
c53e6443 sago007 2012-04-17 11:04 299
	SDLKey right;
c53e6443 sago007 2012-04-17 11:04 300
	SDLKey change;
c53e6443 sago007 2012-04-17 11:04 301
	SDLKey push;
89c4a3a6 sago007 2008-08-29 14:32 302
};
89c4a3a6 sago007 2008-08-29 14:32 303
593aeae4 sago007 2011-06-25 22:42 304
control keySettings[3];	//array to hold the controls (default and two custom)
89c4a3a6 sago007 2008-08-29 14:32 305
95bc02ff sago007 2009-03-15 02:46 306
#define KEYMENU_MAXWITH 4
95bc02ff sago007 2009-03-15 02:46 307
#define KEYMENU_MAXDEPTH 7
95bc02ff sago007 2009-03-15 02:46 308
c53e6443 sago007 2012-04-17 11:04 309
//The following struct holds variables relevant to selecting menu items with
95bc02ff sago007 2009-03-15 02:46 310
//keyboard/joypad.
b7590374 sago007 2011-05-19 16:15 311
/*struct KeyMenu_t
95bc02ff sago007 2009-03-15 02:46 312
{
95bc02ff sago007 2009-03-15 02:46 313
    unsigned long canBeActivatedTime; //Time that the KeyMenu can be activated by pressing a button
95bc02ff sago007 2009-03-15 02:46 314
    bool activated; //The keymenu is activated
95bc02ff sago007 2009-03-15 02:46 315
    //Here comes the coordinates to the key we are howering.
95bc02ff sago007 2009-03-15 02:46 316
    int x;
95bc02ff sago007 2009-03-15 02:46 317
    int y;
95bc02ff sago007 2009-03-15 02:46 318
    bool menumap[KEYMENU_MAXWITH][KEYMENU_MAXDEPTH];
95bc02ff sago007 2009-03-15 02:46 319
};
95bc02ff sago007 2009-03-15 02:46 320
b7590374 sago007 2011-05-19 16:15 321
static KeyMenu_t keymenu;*/
95bc02ff sago007 2009-03-15 02:46 322
89c4a3a6 sago007 2008-08-29 14:32 323
enum stageButton {SBdontShow, SBstageClear, SBpuzzleMode};
89c4a3a6 sago007 2008-08-29 14:32 324
30f910dd sago007 2010-11-10 21:02 325
static stageButton stageButtonStatus = SBdontShow;
89c4a3a6 sago007 2008-08-29 14:32 326
30f910dd sago007 2010-11-10 21:02 327
static const int buttonXsize = 120;
30f910dd sago007 2010-11-10 21:02 328
static const int buttonYsize = 40;
9050a50a sago007 2008-12-09 13:35 329
89c4a3a6 sago007 2008-08-29 14:32 330
struct ButtonCords
89c4a3a6 sago007 2008-08-29 14:32 331
{
c53e6443 sago007 2012-04-17 11:04 332
	int x;
c53e6443 sago007 2012-04-17 11:04 333
	int y;
c53e6443 sago007 2012-04-17 11:04 334
	int xsize;
c53e6443 sago007 2012-04-17 11:04 335
	int ysize;
89c4a3a6 sago007 2008-08-29 14:32 336
};
89c4a3a6 sago007 2008-08-29 14:32 337
c53e6443 sago007 2012-04-17 11:04 338
ButtonCords cordNextButton =
c53e6443 sago007 2012-04-17 11:04 339
{
c53e6443 sago007 2012-04-17 11:04 340
	cordNextButton.x = 3*bsize+(3*bsize-buttonXsize)/2,
c53e6443 sago007 2012-04-17 11:04 341
	cordNextButton.y = 10*bsize,
c53e6443 sago007 2012-04-17 11:04 342
	cordNextButton.xsize = buttonXsize,
c53e6443 sago007 2012-04-17 11:04 343
	cordNextButton.ysize = buttonYsize
6d48320c sago007 2009-03-28 17:06 344
};
89c4a3a6 sago007 2008-08-29 14:32 345
c53e6443 sago007 2012-04-17 11:04 346
ButtonCords cordRetryButton =
c53e6443 sago007 2012-04-17 11:04 347
{
c53e6443 sago007 2012-04-17 11:04 348
	cordRetryButton.x = (3*bsize-buttonXsize)/2,
c53e6443 sago007 2012-04-17 11:04 349
	cordRetryButton.y = 10*bsize,
c53e6443 sago007 2012-04-17 11:04 350
	cordRetryButton.xsize = buttonXsize,
c53e6443 sago007 2012-04-17 11:04 351
	cordRetryButton.ysize = buttonYsize
89c4a3a6 sago007 2008-08-29 14:32 352
};
6d48320c sago007 2009-03-28 17:06 353
eec83b7d sago007 2009-03-29 15:46 354
#endif
1970-01-01 00:00 355