1 /* 2 Copyright (C) 2004-2011 Parallel Realities 3 Copyright (C) 2011-2015 Perpendicular Dimensions 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License 7 as published by the Free Software Foundation; either version 2 8 of the License, or (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 14 See the GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 20 */ 21 22 // Read in the define list used by the map data also 23 #include "defines.h" 24 25 #define min(a, b) ((a) < (b) ? (a) : (b)) 26 #define max(a, b) ((a) > (b) ? (a) : (b)) 27 28 #define PI 3.14159265359 29 30 /* ############## errors ########### */ 31 32 #define ERR_FILE "A required file (%s) was not found in PAK file" 33 #define ERR_LOCALE "Locale information missing for section '%s' (contains only partial translation)" 34 35 /* ########### maximums ############ */ 36 37 #define MAX_SOUNDS 75 38 #define MAX_TILES 256 39 #define MAX_WEAPONS 25 40 #define MAX_ITEMS 25 41 #define MAX_ENEMIES 25 42 43 #define MAX_HEALTH 10 44 45 #define MAX_FPS 62 46 47 /* ########### dead flags ############ */ 48 49 #define DEAD_ALIVE 0 50 #define DEAD_DYING 1 51 #define DEAD_DEAD 2 52 53 /* ########### game sections ######## */ 54 55 #define SECTION_INTRO 0 56 #define SECTION_TITLE 1 57 #define SECTION_HUB 2 58 #define SECTION_GAME 3 59 #define SECTION_GAMEOVER 4 60 #define SECTION_CREDITS 5 61 #define SECTION_EASYOVER 6 62 63 /* ############ sounds ############ */ 64 65 66 67 enum { 68 69 SND_WATERIN, 70 SND_WATEROUT, 71 SND_ITEM, 72 SND_PISTOL, 73 SND_RICO1, 74 SND_RICO2, 75 SND_MACHINEGUN, 76 SND_DEATH1, 77 SND_DEATH2, 78 SND_DEATH3, 79 SND_GRENADE, 80 SND_ROCKET, 81 SND_FIREBALL, 82 SND_HIT, 83 SND_SPLAT, 84 SND_TELEPORT1, 85 SND_TELEPORT2, 86 SND_TELEPORT3, 87 SND_GETWEAPON, 88 SND_LASER, 89 SND_ELECDEATH1, 90 SND_ELECDEATH2, 91 SND_ELECDEATH3, 92 SND_LOCKEDDOOR, 93 SND_OPENDOOR, 94 SND_SWITCH1, 95 SND_SWITCH2, 96 SND_DROWNING, 97 SND_AMBIANCE, 98 SND_GULP, 99 SND_EAT, 100 SND_THROW, 101 SND_GRBOUNCE, 102 SND_DOOROPENED, 103 SND_SPREADGUN, 104 SND_ELECTRICITY1, 105 SND_ELECTRICITY2, 106 SND_ELECTRICITY3, 107 SND_CLANG, 108 SND_FIRECRACKLE, 109 SND_CLOCK, 110 SND_BOSSCUSTOM1, 111 SND_BOSSCUSTOM2, 112 SND_BOSSCUSTOM3, 113 SND_BOSSCUSTOM4, 114 SND_BOSSCUSTOM5, 115 SND_POP, 116 SND_STONEBREAK, 117 SND_CHEAT = MAX_SOUNDS - 3, 118 SND_HIGHLIGHT = MAX_SOUNDS - 2, 119 SND_SELECT = MAX_SOUNDS - 1 120 121 }; 122 123 /* ########### channels ########### */ 124 125 #define CH_ANY -1 126 #define CH_WEAPON 0 127 #define CH_ITEM 1 128 #define CH_EXPLODE 3 129 #define CH_DEATH 4 130 #define CH_TOUCH 5 131 #define CH_AMBIANCE 6 132 #define CH_SPAWN 7 133 134 /* ########## keyboard ############# */ 135 136 struct CONTROL 137 { 138 enum TYPE 139 { 140 UP, 141 DOWN, 142 LEFT, 143 RIGHT, 144 FIRE, 145 JUMP, 146 MAP, 147 PAUSE, 148 JETPACK, 149 MAX 150 }; 151 }; 152 153 /* ############ replay ############ */ 154 155 struct REPLAY_MODE 156 { 157 enum TYPE 158 { 159 NONE, 160 RECORD, 161 PLAYBACK 162 }; 163 }; 164 165 /* ########### widgets ############ */ 166 167 const char widgetName[][25] = { 168 169 "BUTTON", 170 "RADIO", 171 "SMOOTH_SLIDER", 172 "SLIDER", 173 "LABEL", 174 "KEYBOARD", 175 "JOYPAD", 176 "-1" 177 178 }; 179 180 #define WG_BUTTON 0 181 #define WG_RADIO 1 182 #define WG_SMOOTH_SLIDER 2 183 #define WG_SLIDER 3 184 #define WG_LABEL 4 185 #define WG_KEYBOARD 5 186 #define WG_JOYPAD 6 187 188 /* ############## skill ############# */ 189 190 const char skill[][10] = { 191 192 "Easy", 193 "Normal", 194 "Hard", 195 "Extreme" 196 197 }; 198 199 /* ############## text ############## */ 200 201 #define TXT_LEFT 0 202 #define TXT_CENTERED 1 203 #define TXT_RIGHT 2 204 205 #define INFO_NORMAL 0 206 #define INFO_OBJECTIVE 1 207 #define INFO_HINT 2 208 #define INFO_ACTIVATE 3 209 #define INFO_BAD 4 210 211 /* ########## weapons ############# */ 212 213 #define WP_PISTOL 0 214 #define WP_MACHINEGUN 1 215 #define WP_LASER 2 216 #define WP_GRENADES 3 217 #define WP_SPREAD 4 218 219 #define WP_ROCKETS 5 220 #define WP_PLASMARIFLE 6 221 #define WP_FLAMETHROWER 7 222 #define WP_ICEGUN 8 223 #define WP_LAVABALL1 9 224 #define WP_LAVABALL2 10 225 #define WP_AIMEDPISTOL 11 226 #define WP_ALIENSPREAD 12 227 #define WP_SHELLS 13 228 #define WP_ROCK1 14 229 #define WP_STALAGTITE 15 230 #define WP_BOMB 16 231 #define WP_ALIENLASER 17 232 #define WP_ALIENGRENADE 18 233 #define WP_AIMEDMACHINE 19 234 235 /* ########### entity defs ######### */ 236 237 #define OBJ_UP 0 238 #define OBJ_DOWN 1 239 #define OBJ_LEFT 2 240 #define OBJ_RIGHT 3 241 242 #define ENV_AIR 0 243 #define ENV_WATER 1 244 #define ENV_SLIME 2 245 #define ENV_LAVA 3 246 247 #define PLAYER_WALK_SPEED 4 248 #define PLAYER_FLY_SPEED 8 249 #define PLAYER_JUMP_SPEED -10.25 250 251 /* ######### paticle flags ########### */ 252 253 #define PAR_WEIGHTLESS 1 254 #define PAR_COLLIDES 2 255 #define PAR_LIQUID 4 256 257 /* ######### effect flags ########### */ 258 259 #define EFF_BLEEDS 1 260 #define EFF_TRAILSFIRE 2 261 #define EFF_SMOKES 4 262 #define EFF_WEIGHTLESS 8 263 #define EFF_COLORED 16 264 265 /* ########## item defs ############ */ 266 267 enum { 268 269 ITEM_PISTOL, 270 ITEM_MACHINEGUN, 271 ITEM_LASER, 272 ITEM_GRENADES, 273 ITEM_SPREAD, 274 ITEM_CHERRY, 275 ITEM_DOUBLECHERRY, 276 ITEM_TRIPLECHERRY, 277 ITEM_POINTS, 278 ITEM_POINTS2, 279 ITEM_POINTS3, 280 ITEM_POINTS4, 281 ITEM_POINTS5, 282 ITEM_POINTS6, 283 ITEM_POINTS7, 284 ITEM_MISC = 100, 285 ITEM_MISC_NOSHOW, 286 ITEM_MISC_INVISIBLE 287 288 }; 289 290 /* ########### map ############ */ 291 292 #define MAPWIDTH 400 293 #define MAPHEIGHT 300 294 #define BRICKSIZE 32 295 #define BRICKSHIFT 5 296 297 #define OFFSETX 320 298 #define OFFSETY 240 299 300 #define MAP_AIR 0 301 #define MAP_WATER 1 302 #define MAP_SLIME 2 303 #define MAP_LAVA 3 304 #define MAP_BREAKABLE 4 305 #define MAP_BREAKABLE2 8 306 #define MAP_SOLID 9 307 #define MAP_NORESET 115 308 #define MAP_DECORATION 120 309 #define MAP_EXITSIGN 196 310 #define MAP_WATERANIM 200 311 #define MAP_SLIMEANIM 207 312 #define MAP_LAVAANIM 214 313 #define MAP_TOPLAYER 221 314 315 #define MAP_AIR_WALL_1 127 316 #define MAP_AIR_WALL_2 129 317 #define MAP_AIR_CEILING_1 242 318 #define MAP_AIR_WALL_3 243 319 #define MAP_AIR_WALL_4 244 320 #define MAP_AIR_CEILING_2 247 321 322 #define MAP_WATER_WALL 246 323 324 #define MAP_SHAKEAMOUNT 2 325 326 /* ########### mia stuff ############## */ 327 328 #define MIAPERCENT 0.70 329 330 /* ########### mission stuff ############ */ 331 332 #define MIS_INPROGRESS 0 333 #define MIS_COMPLETE 1 334 #define MIS_PLAYEROUT 2 335 #define MIS_PLAYERDEAD 3 336 #define MIS_PLAYERQUIT 4 337 #define MIS_PLAYERESCAPE 5 338 #define MIS_GAMECOMPLETE 6 339 #define MIS_TIMEUP 7 340 #define MIS_PLAYERRESTART 8 341 342 /* ########### pak file stuff ######## */ 343 344 #define PAK_MAX_FILENAME 60 345 346 #ifndef USEPAK 347 #define USEPAK 1 348 #endif 349 #ifndef PAKLOCATION 350 #define PAKLOCATION "" 351 #endif 352 #ifndef PAKNAME 353 #define PAKNAME "blobwars.pak" 354 #endif 355 #ifndef PAKFULLPATH 356 #define PAKFULLPATH PAKLOCATION PAKNAME 357 #endif 358 #ifndef PATH_MAX 359 #define PATH_MAX 4096 360 #endif 361 #ifndef GAMEPLAYMANUAL 362 #define GAMEPLAYMANUAL "manual.html" 363 #endif 364 #ifndef MEDAL_SERVER_HOST 365 #define MEDAL_SERVER_HOST "localhost" 366 #endif 367 #ifndef MEDAL_SERVER_PORT 368 #define MEDAL_SERVER_PORT 80 369 #endif 370 371 enum { 372 373 PAK_IMG, 374 PAK_SOUND, 375 PAK_MUSIC, 376 PAK_DATA, 377 PAK_FONT, 378 PAK_TAGS 379 }; 380 381 /* ######### miscellaneous ############## */ 382 383 #define DIR_X 1 384 #define DIR_Y 2 385 #define DIR_XY 3 386 387 /* ############# debug ################## */ 388 389 #if DEBUG 390 #define debug(x) {printf("*** DEBUG: "); printf x;} 391 #else 392 #define debug(x) {} 393 #endif 394 395 #ifndef IGNORE_FLAGTOKEN_ERRORS 396 #define IGNORE_FLAGTOKEN_ERRORS 0 397 #endif 398 399