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