1 /* 2 Copyright (C) 2009-2021 Parallel Realities 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 */ 19 20 #define SCREEN_WIDTH 640 21 #define SCREEN_HEIGHT 480 22 23 #define MAX_MAP_X 1200 24 #define MAX_MAP_Y 600 25 26 #define GRID_SIZE 15 27 28 #define GRID_MAX_X 80 29 #define GRID_MAX_Y 40 30 31 #define TILE_SIZE 32 32 33 #define PI 3.14159265 34 35 #define GRAVITY_SPEED 0.75 36 37 #define MAX_AIR_SPEED 15 38 39 #define MAX_WATER_SPEED 0.5 40 41 #define JUMP_HEIGHT 12 42 43 #define MAX_ANIMATIONS 1024 44 45 #define MAX_ENTITIES 1024 46 47 #define MAX_DIALOG_WIDTH 480 48 49 #define MAX_SCRIPT_WIDTH 380 50 51 #define TEXTURE_CACHE_TIME 18000 52 53 #define BLANK_TILE 0 54 55 #define SOLID_TILE_START 1 56 57 #define SOLID_TILE_END 99 58 59 #define SLOPE_UP_START 100 60 61 #define SLOPE_UP_END 104 62 63 #define SLOPE_DOWN_START 105 64 65 #define SLOPE_DOWN_END 109 66 67 #define JUMP_THROUGH_TILE_START 110 68 69 #define JUMP_THROUGH_TILE_END 119 70 71 #define BACKGROUND_TILE_START 120 72 73 #define BACKGROUND_TILE_END 300 74 75 #define FOREGROUND_TILE_START 301 76 77 #define WATER_TILE_START 496 78 79 #define WATER_TILE_END 503 80 81 #define LAVA_TILE_START 504 82 83 #define LAVA_TILE_END 511 84 85 #define SLIME_TILE_START 512 86 87 #define SLIME_TILE_END 519 88 89 #define SLIME_TILE_BLEND 520 90 91 #define SLIME_TILE_BLEND_REVERSE 521 92 93 #define MAX_TILES 522 94 95 #define MAX_LINE_LENGTH 1024 96 97 #define MAX_PATH_LENGTH 1024 98 99 #define MAX_FILE_LENGTH 256 100 101 #define MAX_MESSAGE_LENGTH 256 102 103 #define MAX_DROPS 256 104 105 #define MAX_SPRITES 4096 106 107 #define MAX_PROPS_ENTRIES 20 108 109 #define MAX_PROPS_FILES 256 110 111 #define MAX_CUSTOM_ACTIONS 8 112 113 #define MAX_AMBIENT_SOUNDS 10 114 115 #define MAX_TARGETS 255 116 117 #define MAX_HUD_MESSAGES 5 118 119 #define MAX_VALUE_LENGTH 80 120 121 #define MAX_OBJECTIVES 25 122 123 #define MAX_INPUTS 256 124 125 #define MAX_SAVE_SLOTS 10 126 127 #define MAX_STACKABLES 20 128 129 #define TELEPORT_SPEED 10 130 131 #define SPAWNED_IN_TIME 18000 132 133 #ifdef _WIN32 134 #define strcmpignorecase(x, y) stricmp(x, y) 135 #else 136 #define strcmpignorecase(x, y) strcasecmp(x, y) 137 #endif 138 139 #define INVENTORY_BOX_SIZE 42 140 141 #define INVENTORY_ROW_COUNT 5 142 143 #define INVENTORY_COLUMN_COUNT 6 144 145 #define MAX_INVENTORY_ITEMS 30 146 147 #define MAX_TRIGGERS MAX_INVENTORY_ITEMS 148 149 #define DEG_TO_RAD(x) ((x) * PI / 180) 150 151 #define TOTAL_SECRETS 26 152 153 #define STRNCPY(dest, src, n) strncpy(dest, src, n); dest[n - 1] = '\0' 154 155 #define SNPRINTF(dest, size, format, ...) if (snprintf(dest, size, format, __VA_ARGS__) > size) printf("Warning: Buffer too small for %s\n", dest) 156 157 #define SWORD_MAX_CHARGE 50 158 159 #if DEV == 1 160 #ifdef INSTALL_PATH 161 #undef INSTALL_PATH 162 #endif 163 164 #ifdef LOCALE_DIR 165 #undef LOCALE_DIR 166 #endif 167 168 #ifdef PAK_FILE 169 #undef PAK_FILE 170 #endif 171 172 #define INSTALL_PATH "" 173 174 #define LOCALE_DIR "locale/" 175 176 #define PAK_FILE "data.pak" 177 #elif DEV != 0 178 #error "DEV must be 0 or 1" 179 #endif 180 181 #if SDL_BYTEORDER == SDL_LIL_ENDIAN 182 #define SWAP16(X) (X) 183 #define SWAP32(X) (X) 184 #define SWAP64(X) (X) 185 #else 186 #define SWAP16(X) SDL_Swap16(X) 187 #define SWAP32(X) SDL_Swap32(X) 188 #define SWAP64(X) SDL_Swap64(X) 189 #endif 190 191 #define MAX_SOUNDS 256 192 193 #define ITEM_JUMP_HEIGHT -6 194 195 #define _(string) getTranslatedString(string) 196 197 #define SCREENSHOT_KEY SDLK_F10 198 199 #define FULLSCREEN_KEY SDLK_F12 200 201 #define VOLUME_STEPS 12.8 202 203 #define SIGN(x) ((x) > 0 ? 1 : ((x) == 0 ? 0 : (-1))) 204 205 #define MAX_CHANNELS 16 206 207 #define NORMAL_FONT_SIZE 14 208 209 #define LARGE_FONT_SIZE 26 210 211 #define MAX(a, b) (((a) > (b)) ? (a) : (b)) 212 213 #define MIN(a, b) (((a) < (b)) ? (a) : (b)) 214 215 #define HIT_INVULNERABLE_TIME 20 216 217 #define MENU_CODE "fasterthanthespeedoflove" 218 219 #define MAX_ANIMATION_TYPES 50 220 221 #define rand() USE_PRAND_INSTEAD_OF_RAND() 222 223 #define BORDER_PADDING 5 224 225 #define BUTTON_PADDING 20 226 227 #define TABLE_SIZE 255 228 229 #define YEAR 2021 230 231 #ifdef TRUE 232 #undef TRUE 233 #endif 234 235 #ifdef FALSE 236 #undef FALSE 237 #endif 238 239 enum 240 { 241 LEFT, 242 RIGHT 243 }; 244 245 enum 246 { 247 FALSE, 248 TRUE 249 }; 250 251 enum 252 { 253 ON_GROUND = 1, 254 NO_DRAW = 2, 255 PUSHABLE = 4, 256 HELPLESS = 8, 257 INVULNERABLE = 16, 258 FLY = 32, 259 ATTACKING = 64, 260 BLOCKING = 128, 261 DO_NOT_PERSIST = 256, 262 GRABBING = 512, 263 ATTACK_SUCCESS = 1024, 264 STACKABLE = 2048, 265 OBSTACLE = 4096, 266 FLOATS = 8192, 267 FLASH = 16384, 268 UNBLOCKABLE = 32768, 269 BOUNCES = 65536, 270 GRABBED = 131072, 271 PLAYER_TOUCH_ONLY = 262144, 272 TELEPORTING = 524288, 273 NO_END_TELEPORT_SOUND = 1048576, 274 ATTRACTED = 2097152, 275 SPAWNED_IN = 4194304, 276 WRAPPED = 8388608, 277 LIMIT_TO_SCREEN = 16777216, 278 WAS_STANDING_ON = 33554432, 279 GROUNDED = 67108864, 280 FRICTIONLESS = 134217728, 281 CONFUSED = 268435456 282 }; 283 284 enum 285 { 286 NO_ELEMENT, 287 FIRE, 288 ICE, 289 LIGHTNING, 290 PHANTASMAL, 291 DRAGON_FIRE 292 }; 293 294 enum 295 { 296 PLAYER, 297 WEAPON, 298 ITEM, 299 KEY_ITEM, 300 ENEMY, 301 HEALTH, 302 SHIELD, 303 AUTO_LIFT, 304 MANUAL_LIFT, 305 TARGET, 306 SPAWNER, 307 PRESSURE_PLATE, 308 MANUAL_DOOR, 309 AUTO_DOOR, 310 WEAK_WALL, 311 SWITCH, 312 LINE_DEF, 313 LEVEL_EXIT, 314 PROJECTILE, 315 SAVE_POINT, 316 TEMP_ITEM, 317 NPC, 318 ACTION_POINT, 319 SCRIPT_LINE_DEF, 320 FALLING_PLATFORM, 321 TRAP_DOOR, 322 CONVEYOR_BELT, 323 TELEPORTER, 324 VANISHING_PLATFORM, 325 ANTI_GRAVITY, 326 EXPLOSION 327 }; 328 329 enum 330 { 331 TILES, 332 ENTITIES 333 }; 334 335 enum 336 { 337 NO_WEATHER, 338 LIGHT_RAIN, 339 HEAVY_RAIN, 340 STORMY, 341 SNOW, 342 MAX_WEATHER_TYPES 343 }; 344 345 enum 346 { 347 EDGAR_CHANNEL, 348 BOSS_CHANNEL 349 }; 350 351 enum 352 { 353 LIGHT = 1, 354 MEDIUM, 355 STRONG 356 }; 357 358 enum 359 { 360 UPDATE_OBJECTIVE = 1, 361 ACTIVATE_ENTITY, 362 RUN_SCRIPT, 363 UPDATE_TRIGGER, 364 KILL_ENTITY, 365 REMOVE_INVENTORY_ITEM, 366 DEACTIVATE_ENTITY, 367 UPDATE_EXIT 368 }; 369 370 enum 371 { 372 NORMAL, 373 RECORDING, 374 REPLAYING 375 }; 376 377 enum 378 { 379 WIPE_OUT_LEFT_TO_RIGHT, 380 WIPE_OUT_RIGHT_TO_LEFT, 381 WIPE_OUT_CIRCLE_TO_LARGE, 382 WIPE_OUT_CIRCLE_TO_SMALL, 383 MAX_OUT_TRANSITIONS 384 }; 385 386 enum 387 { 388 WIPE_IN_LEFT_TO_RIGHT, 389 WIPE_IN_RIGHT_TO_LEFT, 390 WIPE_IN_CIRCLE_TO_LARGE, 391 WIPE_IN_CIRCLE_TO_SMALL, 392 MAX_IN_TRANSITIONS 393 }; 394 395 enum 396 { 397 TRANSITION_IN, 398 TRANSITION_OUT 399 }; 400 401 enum 402 { 403 AIR, 404 WATER, 405 LAVA, 406 SLIME 407 }; 408 409 enum 410 { 411 PLAYER_INVENTORY, 412 ENTITY_DATA 413 }; 414 415 enum 416 { 417 CONTROL_LEFT, 418 CONTROL_RIGHT, 419 CONTROL_UP, 420 CONTROL_DOWN, 421 CONTROL_JUMP, 422 CONTROL_ADD, 423 CONTROL_NEXT, 424 CONTROL_PREVIOUS, 425 CONTROL_SAVE, 426 CONTROL_LOAD, 427 CONTROL_TOGGLE, 428 CONTROL_DROP, 429 CONTROL_ACTIVATE, 430 CONTROL_CUT, 431 CONTROL_ATTACK, 432 CONTROL_SNAP, 433 CONTROL_INTERACT, 434 CONTROL_GRABBING, 435 CONTROL_PAUSE, 436 CONTROL_BLOCK, 437 CONTROL_INVENTORY, 438 MAX_CONTROLS 439 }; 440 441 enum 442 { 443 IN_TITLE, 444 IN_MENU, 445 IN_GAME, 446 IN_INVENTORY, 447 IN_EDITOR, 448 IN_ERROR, 449 IN_CREDITS 450 }; 451 452 enum 453 { 454 BACKGROUND_LAYER, 455 MID_GROUND_LAYER, 456 FOREGROUND_LAYER, 457 MAX_LAYERS 458 }; 459