1 /** @file h2def.h 2 * 3 * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net> 5 * @authors Copyright © 1999 Activision 6 * 7 * @par License 8 * GPL: http://www.gnu.org/licenses/gpl.html 9 * 10 * <small>This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by the 12 * Free Software Foundation; either version 2 of the License, or (at your 13 * option) any later version. This program is distributed in the hope that it 14 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 16 * Public License for more details. You should have received a copy of the GNU 17 * General Public License along with this program; if not, write to the Free 18 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 * 02110-1301 USA</small> 20 */ 21 22 #ifndef __H2DEF_H__ 23 #define __H2DEF_H__ 24 25 #ifndef __JHEXEN__ 26 # error "Using jHexen headers without __JHEXEN__" 27 #endif 28 29 #include <stdio.h> 30 #include <string.h> 31 32 #ifdef WIN32 33 # ifdef MSVC 34 # pragma warning(disable:4244) 35 # endif 36 # define stricmp _stricmp 37 # define strnicmp _strnicmp 38 # define strlwr _strlwr 39 # define strupr _strupr 40 #endif 41 42 #include <de/c_wrapper.h> 43 #include <de/fixedpoint.h> 44 #include <de/input/ddkey.h> 45 #include <gamefw/libgamefw.h> 46 #include "doomsday.h" 47 #include "version.h" 48 #include "info.h" 49 50 // Predefined with some OS. 51 #ifdef UNIX 52 53 #include <limits.h> 54 55 #define MAXCHAR SCHAR_MAX 56 #define MAXSHORT SHRT_MAX 57 #define MAXINT INT_MAX 58 #define MAXLONG LONG_MAX 59 60 #define MINCHAR SCHAR_MIN 61 #define MINSHORT SHRT_MIN 62 #define MININT INT_MIN 63 #define MINLONG LONG_MIN 64 65 #else /* not UNIX */ 66 67 #define MAXCHAR ((char)0x7f) 68 #define MAXSHORT ((short)0x7fff) 69 70 // Max pos 32-bit int. 71 #define MAXINT ((int)0x7fffffff) 72 #define MAXLONG ((long)0x7fffffff) 73 #define MINCHAR ((char)0x80) 74 #define MINSHORT ((short)0x8000) 75 76 // Max negative 32-bit integer. 77 #define MININT ((int)0x80000000) 78 #define MINLONG ((long)0x80000000) 79 #endif 80 81 #define Set DD_SetInteger 82 #define Get DD_GetInteger 83 84 // 85 // Global parameters/defines. 86 // 87 88 #define MOBJINFO (*_api_InternalData.mobjInfo) 89 #define STATES (*_api_InternalData.states) 90 #define VALIDCOUNT (*_api_InternalData.validCount) 91 92 typedef enum { 93 hexen_demo, 94 hexen, 95 hexen_deathkings, 96 hexen_betademo, // hexen_demo with some bugs 97 hexen_v10, // Hexen release 1.0 98 NUM_GAME_MODES 99 } gamemode_t; 100 101 // Game mode bits for the above. 102 #define GM_HEXEN_DEMO 0x1 103 #define GM_HEXEN 0x2 104 #define GM_HEXEN_DEATHKINGS 0x4 105 #define GM_HEXEN_BETA 0x8 106 #define GM_HEXEN_V10 0x10 107 108 #define GM_ANY (GM_HEXEN_DEMO|GM_HEXEN|GM_HEXEN_DEATHKINGS|GM_HEXEN_BETA|GM_HEXEN_V10) 109 110 #define SCREENWIDTH 320 111 #define SCREENHEIGHT 200 112 #define SCREEN_MUL 1 113 114 #define MAXPLAYERS 8 115 #define NUMPLAYERCOLORS 8 116 117 #define NUMTEAMS 8 // Color = team. 118 119 // Playsim, core timing rate in cycles per second. 120 #define TICRATE 35 121 #define TICSPERSEC 35 122 123 /** 124 * Difficulty/skill settings/filters. 125 */ 126 typedef enum { 127 SM_NOTHINGS = -1, 128 SM_BABY = 0, 129 SM_EASY, 130 SM_MEDIUM, 131 SM_HARD, 132 SM_NIGHTMARE, 133 NUM_SKILL_MODES 134 } skillmode_t; 135 136 /** 137 * Armor types. 138 */ 139 typedef enum { 140 ARMOR_FIRST, 141 ARMOR_ARMOR = ARMOR_FIRST, 142 ARMOR_SHIELD, 143 ARMOR_HELMET, 144 ARMOR_AMULET, 145 NUMARMOR 146 } armortype_t; 147 148 /** 149 * Player weapon types: 150 */ 151 typedef enum { 152 WT_FIRST, 153 WT_SECOND, 154 WT_THIRD, 155 WT_FOURTH, 156 NUM_WEAPON_TYPES, 157 158 WT_NOCHANGE ///< No pending change. 159 } weapontype_t; 160 161 #define VALID_WEAPONTYPE(val) ((val) >= WT_FIRST && (val) < WT_FIRST + NUM_WEAPON_TYPES) 162 163 // Total number of weapon power levels. 164 #define NUMWEAPLEVELS ( 1 ) 165 166 // Total number of pieces for the fourth weapon. 167 #define WEAPON_FOURTH_PIECE_COUNT ( 3 ) 168 169 // All fourth-weapon pieces in bits. 170 #define WEAPON_FOURTH_COMPLETE ((WEAPON_FOURTH_PIECE_COUNT << 1) + 1) 171 172 /** 173 * Player Classes 174 */ 175 typedef enum { 176 PCLASS_NONE = -1, 177 PCLASS_FIRST = 0, 178 PCLASS_FIGHTER = PCLASS_FIRST, 179 PCLASS_CLERIC, 180 PCLASS_MAGE, 181 PCLASS_PIG, 182 NUM_PLAYER_CLASSES 183 } playerclass_t; 184 185 #define VALID_PLAYER_CLASS(c) ((c) >= PCLASS_FIRST && (c) < NUM_PLAYER_CLASSES) 186 187 #define PCLASS_INFO(plrClass) (&classInfo[plrClass]) 188 189 typedef struct classinfo_s 190 { 191 playerclass_t plrClass; 192 char const *niceName; 193 dd_bool userSelectable; 194 mobjtype_t mobjType; 195 int normalState; 196 int runState; 197 int attackState; 198 int attackEndState; 199 int maxArmor; 200 int autoArmorSave; 201 fixed_t maxMove; 202 fixed_t forwardMove[2]; ///< walk, run. 203 fixed_t sideMove[2]; ///< walk, run. 204 int moveMul; ///< multiplier for above. 205 int turnSpeed[3]; ///< [normal, speed, initial]. 206 int jumpTics; ///< wait inbetween jumps. 207 int failUseSound; ///< sound played when a use fails. 208 int armorIncrement[NUMARMOR]; 209 textenum_t skillModeName[NUM_SKILL_MODES]; 210 struct weaponpiecedata_s 211 { 212 Point2Raw offset; 213 char const *patchName; 214 } fourthWeaponPiece[WEAPON_FOURTH_PIECE_COUNT]; 215 char const *fourthWeaponCompletePatchName; 216 } classinfo_t; 217 218 DENG_EXTERN_C classinfo_t classInfo[NUM_PLAYER_CLASSES]; 219 220 /** 221 * Game state (hi-level). 222 * 223 * The current state of the game: whether we are playing, gazing at the 224 * intermission screen, the game final animation, or a demo. 225 */ 226 typedef enum { 227 GS_MAP, 228 GS_INTERMISSION, 229 GS_FINALE, 230 GS_STARTUP, 231 GS_WAITING, 232 GS_INFINE, 233 NUM_GAME_STATES 234 } gamestate_t; 235 236 /** 237 * Keys (as in, keys to lockables). 238 */ 239 typedef enum { 240 KT_FIRST, 241 KT_KEY1 = KT_FIRST, 242 KT_KEY2, 243 KT_KEY3, 244 KT_KEY4, 245 KT_KEY5, 246 KT_KEY6, 247 KT_KEY7, 248 KT_KEY8, 249 KT_KEY9, 250 KT_KEYA, 251 KT_KEYB, 252 NUM_KEY_TYPES 253 } keytype_t; 254 255 /** 256 * Ammunition types. 257 */ 258 typedef enum { 259 AT_FIRST, 260 AT_BLUEMANA = AT_FIRST, 261 AT_GREENMANA, 262 NUM_AMMO_TYPES, 263 264 AT_NOAMMO // Takes no ammo, used for staff, gauntlets. 265 } ammotype_t; 266 267 #define MAX_MANA 200 268 269 /** 270 * Powers, bestowable upon players only. 271 */ 272 typedef enum { 273 PT_NONE, 274 PT_FIRST, 275 PT_INVULNERABILITY = PT_FIRST, 276 PT_ALLMAP, 277 PT_INFRARED, 278 PT_FLIGHT, 279 PT_SHIELD, 280 PT_HEALTH2, 281 PT_SPEED, 282 PT_MINOTAUR, 283 NUM_POWER_TYPES 284 } powertype_t; 285 286 #define INVULNTICS (30*TICRATE) 287 #define INVISTICS (60*TICRATE) 288 #define INFRATICS (120*TICRATE) 289 #define IRONTICS (60*TICRATE) 290 #define WPNLEV2TICS (40*TICRATE) 291 #define FLIGHTTICS (60*TICRATE) 292 #define SPEEDTICS (45*TICRATE) 293 #define MORPHTICS (40*TICRATE) 294 //#define MAULATORTICS (25*TICRATE) 295 296 /** 297 * Inventory Item Types: 298 */ 299 typedef enum { 300 IIT_NONE = 0, 301 IIT_FIRST = 1, 302 IIT_INVULNERABILITY = IIT_FIRST, 303 IIT_HEALTH, 304 IIT_SUPERHEALTH, 305 IIT_HEALINGRADIUS, 306 IIT_SUMMON, 307 IIT_TORCH, 308 IIT_EGG, 309 IIT_FLY, 310 IIT_BLASTRADIUS, 311 IIT_POISONBAG, 312 IIT_TELEPORTOTHER, 313 IIT_SPEED, 314 IIT_BOOSTMANA, 315 IIT_BOOSTARMOR, 316 IIT_TELEPORT, 317 // Puzzle items: 318 IIT_FIRSTPUZZITEM, 319 IIT_PUZZSKULL = IIT_FIRSTPUZZITEM, 320 IIT_PUZZGEMBIG, 321 IIT_PUZZGEMRED, 322 IIT_PUZZGEMGREEN1, 323 IIT_PUZZGEMGREEN2, 324 IIT_PUZZGEMBLUE1, 325 IIT_PUZZGEMBLUE2, 326 IIT_PUZZBOOK1, 327 IIT_PUZZBOOK2, 328 IIT_PUZZSKULL2, 329 IIT_PUZZFWEAPON, 330 IIT_PUZZCWEAPON, 331 IIT_PUZZMWEAPON, 332 IIT_PUZZGEAR1, 333 IIT_PUZZGEAR2, 334 IIT_PUZZGEAR3, 335 IIT_PUZZGEAR4, 336 NUM_INVENTORYITEM_TYPES 337 } inventoryitemtype_t; 338 339 #define MAXINVITEMCOUNT (25) 340 341 #define BLINKTHRESHOLD (4*TICRATE) 342 343 // Uncomment, to enable all timebomb stuff. 344 #define TIMEBOMB_YEAR (95) // years since 1900 345 #define TIMEBOMB_STARTDATE (268) // initial date (9/26) 346 #define TIMEBOMB_ENDDATE (301) // end date (10/29) 347 348 DENG_EXTERN_C int maulatorSeconds; 349 350 #define MAULATORTICS ((unsigned int) maulatorSeconds * TICSPERSEC) 351 352 // Most damage defined using HITDICE 353 #define HITDICE(a) ((1 + (P_Random() & 7)) * (a)) 354 355 #define SBARHEIGHT (39) // status bar height at bottom of screen 356 357 #define TELEFOGHEIGHT (32) 358 359 #define DEFAULT_PLAYER_VIEWHEIGHT (48) 360 361 DENG_EXTERN_C fixed_t finesine[5 * FINEANGLES / 4]; 362 DENG_EXTERN_C fixed_t *finecosine; 363 364 // Set if homebrew PWAD stuff has been added. 365 DENG_EXTERN_C dd_bool modifiedgame; 366 367 #define MAX_PLAYER_STARTS (8) 368 369 DENG_EXTERN_C int localQuakeHappening[MAXPLAYERS]; 370 DENG_EXTERN_C int localQuakeTimeout[MAXPLAYERS]; // zero for unlimited 371 372 #ifdef __cplusplus 373 extern "C" { 374 #endif 375 376 byte P_Random(void); 377 void M_ResetRandom(void); 378 379 #ifdef __cplusplus 380 } // extern "C" 381 #endif 382 383 #endif // __H2DEF_H__ 384