| 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 |
|
| 56241205 |
sago007 |
2012-08-05 11:15 |
36 |
const char sharedir[] = SHAREDIR; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
37 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
38 |
//All graphic in the game (as pointers): |
| b7590374 |
sago007 |
2011-05-19 16:15 |
39 |
SDL_Surface *backgroundImage; //Stores the background image |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
40 |
static SDL_Surface *backBoard; //Stores the background to the board |
| f3a1637d |
sago007 |
2015-11-14 21:32 |
41 |
static std::shared_ptr<CppSdl::CppSdlImageHolder> bNewGame; //The New Game botton |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
42 |
static SDL_Surface *bOptions; //The Options botton |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
43 |
static SDL_Surface *bConfigure; //The configure button |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
44 |
static SDL_Surface *bSelectPuzzle; //The Select Puzzle Button |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
45 |
static SDL_Surface *bBack; //The "Back" button |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
46 |
static SDL_Surface *bForward; //The "forward" button |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
47 |
static SDL_Surface *iChainBack; |
| 2f30c381 |
sago007 |
2008-09-14 13:08 |
48 |
#if NETWORK |
| 69d650b4 |
sago007 |
2011-07-20 15:24 |
49 |
//static SDL_Surface *bNetwork; |
| 69d650b4 |
sago007 |
2011-07-20 15:24 |
50 |
//static SDL_Surface *bConnect; |
| 69d650b4 |
sago007 |
2011-07-20 15:24 |
51 |
//static SDL_Surface *bHost; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
52 |
#endif |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
53 |
static SDL_Surface *bHighScore; //The High Score botton |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
54 |
static SDL_Surface *blackLine; //The seperator in stage clear |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
55 |
static SDL_Surface *stageBobble; //The bobble instage clear |
| 26ddb424 |
sago007 |
2011-06-09 20:06 |
56 |
SDL_Surface *screen; //The whole screen; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
57 |
static SDL_Surface *iGameOver; //The gameOver image |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
58 |
static SDL_Surface *iWinner; //the "winner" image |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
59 |
static SDL_Surface *iDraw; //the "draw" image |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
60 |
static SDL_Surface *iLoser; //the "loser" image |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
61 |
//Animations: |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
62 |
static SDL_Surface *cursor[2]; //The animated cursor |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
63 |
static SDL_Surface *bomb[2]; //Bomb then the bricks should blow |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
64 |
static SDL_Surface *ready[2]; //Before the blocks fall |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
65 |
static SDL_Surface *explosion[4]; //Then a block explodes |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
66 |
//Animations end |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
67 |
static SDL_Surface *counter[3]; //Counts down from 3 |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
68 |
static SDL_Surface *bricks[7]; //The bricks, saved in an array of pointers |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
69 |
static SDL_Surface *crossover; //Cross the bricks that will be cleared soon |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
70 |
static SDL_Surface *balls[7]; //The balls (the small ones that jump around) |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
71 |
static SDL_Surface *changeButtonsBack; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
72 |
static SDL_Surface *dialogBox; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
73 |
static SDL_Surface *bOn; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
74 |
static SDL_Surface *bOff; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
75 |
static SDL_Surface *b1024; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
76 |
static SDL_Surface *iLevelCheck; //To the level select screen |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
77 |
static SDL_Surface *iLevelCheckBox; |
| cc6724c9 |
sago007 |
2012-04-16 21:11 |
78 |
static SDL_Surface *iLevelCheckBoxMarked; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
79 |
static SDL_Surface *iCheckBoxArea; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
80 |
static SDL_Surface *boardBackBack; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
81 |
static SDL_Surface *garbageTL; //the Garbage Blocks |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
82 |
static SDL_Surface *garbageT; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
83 |
static SDL_Surface *garbageTR; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
84 |
static SDL_Surface *garbageR; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
85 |
static SDL_Surface *garbageBR; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
86 |
static SDL_Surface *garbageB; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
87 |
static SDL_Surface *garbageBL; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
88 |
static SDL_Surface *garbageL; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
89 |
static SDL_Surface *garbageFill; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
90 |
static SDL_Surface *garbageM; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
91 |
static SDL_Surface *garbageML; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
92 |
static SDL_Surface *garbageMR; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
93 |
static SDL_Surface *smiley[4]; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
94 |
static SDL_Surface *garbageGM; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
95 |
static SDL_Surface *garbageGML; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
96 |
static SDL_Surface *garbageGMR; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
97 |
static SDL_Surface *transCover; //The transperant block, covers the upcomming |
| 1572de2b |
sago007 |
2008-09-11 18:15 |
98 |
#if LEVELEDITOR |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
99 |
static SDL_Surface *bCreateFile; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
100 |
static SDL_Surface *bDeletePuzzle; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
101 |
static SDL_Surface *bLoadFile; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
102 |
static SDL_Surface *bMoveBack; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
103 |
static SDL_Surface *bMoveDown; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
104 |
static SDL_Surface *bMoveForward; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
105 |
static SDL_Surface *bMoveLeft; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
106 |
static SDL_Surface *bMoveRight; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
107 |
static SDL_Surface *bMoveUp; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
108 |
static SDL_Surface *bNewPuzzle; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
109 |
static SDL_Surface *bSaveFileAs; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
110 |
static SDL_Surface *bSavePuzzle; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
111 |
static SDL_Surface *bSaveToFile; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
112 |
static SDL_Surface *bTestPuzzle; |
| 1572de2b |
sago007 |
2008-09-11 18:15 |
113 |
#endif |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
114 |
static SDL_Surface *bSkip; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
115 |
static SDL_Surface *bRetry; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
116 |
static SDL_Surface *bNext; |
| 78d03b38 |
sago007 |
2008-11-13 19:56 |
117 |
|
| f3a1637d |
sago007 |
2015-11-14 21:32 |
118 |
std::shared_ptr<CppSdl::CppSdlImageHolder> menuMarked; |
| f3a1637d |
sago007 |
2015-11-14 21:32 |
119 |
std::shared_ptr<CppSdl::CppSdlImageHolder> menuUnmarked; |
| f3a1637d |
sago007 |
2015-11-14 21:32 |
120 |
std::shared_ptr<CppSdl::CppSdlImageHolder> mouse; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
121 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
122 |
static SDL_Surface *tmp; //a temporary surface to use DisplayFormat |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
123 |
|
| 925b7e58 |
sago007 |
2011-04-25 16:35 |
124 |
static NFont nf_button_font; //Font used for buttons! |
| 26ddb424 |
sago007 |
2011-06-09 20:06 |
125 |
NFont nf_scoreboard_font; |
| 925b7e58 |
sago007 |
2011-04-25 16:35 |
126 |
static NFont nf_standard_blue_font; //Font used instead of the old blue SFont |
| 925b7e58 |
sago007 |
2011-04-25 16:35 |
127 |
static NFont nf_standard_small_font; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
128 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
129 |
static Mix_Music *bgMusic; //backgroundMusic |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
130 |
static Mix_Music *highbeatMusic; //Background music with higher beat |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
131 |
static Mix_Chunk *boing; //boing sound when clearing |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
132 |
static Mix_Chunk *applause; //Applause, then the player is good |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
133 |
static Mix_Chunk *photoClick; //clickSound |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
134 |
static Mix_Chunk *typingChunk; //When writing |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
135 |
static Mix_Chunk *counterChunk; //When counting down |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
136 |
static Mix_Chunk *counterFinalChunk; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
137 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
138 |
Highscore theTopScoresEndless; //Stores highscores for endless |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
139 |
Highscore theTopScoresTimeTrial; //Stores highscores for timetrial |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
140 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
141 |
static bool bMouseUp; //true if the mouse(1) is unpressed |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
142 |
static bool bMouseUp2; //true if the mouse(2) is unpressed |
| 2f30c381 |
sago007 |
2008-09-14 13:08 |
143 |
#if NETWORK |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
144 |
static bool bNetworkOpen; //Show the network menu |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
145 |
#endif |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
146 |
static bool bScreenLocked; //Don't take input or allow any mouse interaction! Used for dialogbox and warningbox |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
147 |
static bool showDialog; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
148 |
static bool NoSound; //if true, absolutely no sound will be played, can be set from the commandline |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
149 |
//prevents crash on systems without a soundcard |
| 26ddb424 |
sago007 |
2011-06-09 20:06 |
150 |
bool MusicEnabled; //true if background music is enabled |
| 26ddb424 |
sago007 |
2011-06-09 20:06 |
151 |
bool SoundEnabled; //true if sound effects is enabled |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
152 |
static bool bNearDeathPrev; //Near death status last time checked. |
| 26ddb424 |
sago007 |
2011-06-09 20:06 |
153 |
bool bFullscreen; //true if game is running fullscreen |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
154 |
static bool puzzleLoaded; //true if the puzzle levels have been loaded |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
155 |
static bool drawBalls; //if true balls are drawed to the screen, this might lower framerate too much |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
156 |
static bool standardBackground; |
| b7590374 |
sago007 |
2011-05-19 16:15 |
157 |
bool highPriority; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
158 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
159 |
static bool editorMode = false; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
160 |
static bool editorModeTest = false; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
161 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
162 |
//Things for network play: |
| 2f30c381 |
sago007 |
2008-09-14 13:08 |
163 |
#if NETWORK |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
164 |
static bool networkPlay; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
165 |
static bool networkActive; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
166 |
//sockets here |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
167 |
#define SERVERPORT 41780 |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
168 |
#define CLIENTPORT 41781 |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
169 |
|
| 2f30c381 |
sago007 |
2008-09-14 13:08 |
170 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
171 |
static char serverAddress[30]; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
172 |
#endif |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
173 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
174 |
//other ball constants: |
| b37fa2db |
sago007 |
2015-12-04 20:44 |
175 |
const double gravity = 200.8; //acceleration |
| b37fa2db |
sago007 |
2015-12-04 20:44 |
176 |
const double startVelocityY = 50.0; |
| b37fa2db |
sago007 |
2015-12-04 20:44 |
177 |
const double VelocityX = 50.0; |
| b37fa2db |
sago007 |
2015-12-04 20:44 |
178 |
const int ballSize = 16; |
| b37fa2db |
sago007 |
2015-12-04 20:44 |
179 |
const double minVelocity = 200.0; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
180 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
181 |
//global settings (reset everytime the game starts) |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
182 |
static Uint8 player1Speed=0; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
183 |
static Uint8 player2Speed=0; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
184 |
static bool player1AI=false; //Is AI enabled? |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
185 |
static bool player2AI=false; //Is AI enabled for player 2 (opponent in single player) |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
186 |
static Uint8 player1AIlevel=3; //What level is AI? 0 min, 6 max |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
187 |
static Uint8 player2AIlevel=3; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
188 |
static const Uint8 AIlevels=7; //7 possible levels: 0..6 |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
189 |
static Uint8 player1handicap=0; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
190 |
static Uint8 player2handicap=0; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
191 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
192 |
unsigned long int currentTime; //contains the current time, so we don't call SDL_GetTickets() too often... |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
193 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
194 |
static int xsize = 1024; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
195 |
static int ysize = 768; |
| 970c4ebe |
sago007 |
2015-08-22 18:08 |
196 |
static const int bsize = 50; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
197 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
198 |
//Stores the players names (way to long, but at least no buffer overflows (max length is 16 for display reasons)) |
| f6707482 |
sago007 |
2015-12-04 22:55 |
199 |
std::string player1name; |
| f6707482 |
sago007 |
2015-12-04 22:55 |
200 |
std::string player2name; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
201 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
202 |
//paths |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
203 |
static std::string stageClearSavePath; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
204 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
205 |
static const int nrOfStageLevels = 50; //number of stages in stage Clear |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
206 |
std::vector<bool> stageCleared(nrOfStageLevels); //vector that tells if a stage is cleared |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
207 |
std::vector<Uint32> stageTimes(nrOfStageLevels); //For statistical puposes |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
208 |
std::vector<Uint32> stageScores(nrOfStageLevels); //--||-- |
| f72abf8b |
sago007 |
2010-01-16 20:00 |
209 |
bool twoPlayers; //True if two players are playing |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
210 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
211 |
//Old mouse position: |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
212 |
static int oldMousex, oldMousey; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
213 |
//Old Stage Clear Buble |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
214 |
static int oldBubleX, oldBubleY; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
215 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
216 |
//bool doublebuf = false; //if true, screen is double buffered |
| 571b4d47 |
sago007 |
2015-12-05 16:02 |
217 |
static char forceredraw = 1; //If 1: always redraw, if 2: rarely redraw |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
218 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
219 |
static bool singlePuzzle = false; //if true we are just in a little 300x600 window |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
220 |
static int singlePuzzleNr = 0; |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
221 |
static std::string singlePuzzleFile; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
222 |
|
| 1572de2b |
sago007 |
2008-09-11 18:15 |
223 |
#if DEBUG |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
224 |
//frame counter (fps) |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
225 |
unsigned long int Frames, Ticks; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
226 |
char FPS[10]; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
227 |
#endif |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
228 |
|
| 56241205 |
sago007 |
2012-08-05 11:15 |
229 |
int verboseLevel = 0; |
| 56241205 |
sago007 |
2012-08-05 11:15 |
230 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
231 |
//keySetup |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
232 |
int player1keys, player2keys; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
233 |
bool mouseplay1=false; //The mouse works on the play field |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
234 |
bool mouseplay2=false; //Same for player2 |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
235 |
bool joyplay1=false; //Player one uses the joypad |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
236 |
bool joyplay2=false; //Player two uses the joypad |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
237 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
238 |
//Stores the controls |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
239 |
struct control |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
240 |
{ |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
241 |
SDLKey up; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
242 |
SDLKey down; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
243 |
SDLKey left; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
244 |
SDLKey right; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
245 |
SDLKey change; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
246 |
SDLKey push; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
247 |
}; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
248 |
|
| 593aeae4 |
sago007 |
2011-06-25 22:42 |
249 |
control keySettings[3]; //array to hold the controls (default and two custom) |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
250 |
|
| 95bc02ff |
sago007 |
2009-03-15 02:46 |
251 |
#define KEYMENU_MAXWITH 4 |
| 95bc02ff |
sago007 |
2009-03-15 02:46 |
252 |
#define KEYMENU_MAXDEPTH 7 |
| 95bc02ff |
sago007 |
2009-03-15 02:46 |
253 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
254 |
enum stageButton {SBdontShow, SBstageClear, SBpuzzleMode}; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
255 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
256 |
static stageButton stageButtonStatus = SBdontShow; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
257 |
|
| 30f910dd |
sago007 |
2010-11-10 21:02 |
258 |
static const int buttonXsize = 120; |
| 30f910dd |
sago007 |
2010-11-10 21:02 |
259 |
static const int buttonYsize = 40; |
| 9050a50a |
sago007 |
2008-12-09 13:35 |
260 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
261 |
struct ButtonCords |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
262 |
{ |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
263 |
int x; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
264 |
int y; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
265 |
int xsize; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
266 |
int ysize; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
267 |
}; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
268 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
269 |
ButtonCords cordNextButton = |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
270 |
{ |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
271 |
cordNextButton.x = 3*bsize+(3*bsize-buttonXsize)/2, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
272 |
cordNextButton.y = 10*bsize, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
273 |
cordNextButton.xsize = buttonXsize, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
274 |
cordNextButton.ysize = buttonYsize |
| 6d48320c |
sago007 |
2009-03-28 17:06 |
275 |
}; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
276 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
277 |
ButtonCords cordRetryButton = |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
278 |
{ |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
279 |
cordRetryButton.x = (3*bsize-buttonXsize)/2, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
280 |
cordRetryButton.y = 10*bsize, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
281 |
cordRetryButton.xsize = buttonXsize, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
282 |
cordRetryButton.ysize = buttonYsize |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
283 |
}; |
| 6d48320c |
sago007 |
2009-03-28 17:06 |
284 |
|
| eec83b7d |
sago007 |
2009-03-29 15:46 |
285 |
#endif |
|
|
1970-01-01 00:00 |
286 |
|