git repos / blockattack-game

blame: source/code/mainVars.hpp

normal view · raw

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