Odamex
Setting the Standard in Multiplayer Doom
common/doomdef.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*-
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: doomdef.h 1788 2010-08-24 04:42:57Z russellrice $
00005 //
00006 // Copyright (C) 1993-1996 by id Software, Inc.
00007 // Copyright (C) 2006-2010 by The Odamex Team.
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // DESCRIPTION:
00020 //  Internally used data structures for virtually everything,
00021 //   key definitions, lots of other stuff.
00022 //
00023 //-----------------------------------------------------------------------------
00024 
00025 
00026 #ifndef __DOOMDEF_H__
00027 #define __DOOMDEF_H__
00028 
00029 #include <stdio.h>
00030 #include <string.h>
00031 
00032 // GhostlyDeath -- Can't stand the warnings
00033 #if _MSC_VER == 1200
00034 #pragma warning(disable:4786)
00035 #endif
00036 
00037 // GhostlyDeath -- MSVC++ 8+, remove "deprecated" warnings
00038 #if _MSC_VER >= 1400
00039 #pragma warning(disable : 4996)
00040 #endif
00041 
00042 //
00043 // The packed attribute forces structures to be packed into the minimum
00044 // space necessary.  If this is not done, the compiler may align structure
00045 // fields differently to optimise memory access, inflating the overall
00046 // structure size.  It is important to use the packed attribute on certain
00047 // structures where alignment is important, particularly data read/written
00048 // to disk.
00049 //
00050 
00051 #ifdef __GNUC__
00052 #define PACKEDATTR __attribute__((packed))
00053 #else
00054 #define PACKEDATTR
00055 #endif
00056 
00057 
00058 #include "farchive.h"
00059 
00060 //
00061 // denis
00062 //
00063 // if(clientside) { do visual effects, sounds, etc }
00064 // if(serverside) { spawn/destroy things, change maps, etc }
00065 //
00066 extern bool clientside, serverside;
00067 
00068 // [Nes] - Determines which program the user is running.
00069 enum baseapp_t
00070 {
00071         client,         // Odamex.exe
00072         server          // Odasrv.exe
00073 };
00074 
00075 extern baseapp_t baseapp;
00076 
00077 //
00078 // Global parameters/defines.
00079 //
00080 
00081 // Game mode handling - identify IWAD version
00082 //      to handle IWAD dependend animations etc.
00083 enum GameMode_t
00084 {
00085   shareware,    // DOOM 1 shareware, E1, M9
00086   registered,   // DOOM 1 registered, E3, M27
00087   commercial,   // DOOM 2 retail, E1 M34
00088   // DOOM 2 german edition not handled
00089   retail,               // DOOM 1 retail, E4, M36
00090   retail_chex,  // Chex Quest
00091   undetermined  // Well, no IWAD found.
00092 
00093 };
00094 
00095 
00096 // Mission packs - might be useful for TC stuff?
00097 enum GameMission_t
00098 {
00099   doom,                 // DOOM 1
00100   doom2,                // DOOM 2
00101   pack_tnt,     // TNT mission pack
00102   pack_plut,    // Plutonia pack
00103   chex,                 // Chex Quest
00104   none
00105 };
00106 
00107 
00108 // Identify language to use, software localization.
00109 enum Language_t
00110 {
00111   english,
00112   french,
00113   german,
00114   unknown
00115 };
00116 
00117 
00118 // If rangecheck is undefined,
00119 // most parameter validation debugging code will not be compiled
00120 #define RANGECHECK
00121 
00122 // The maximum number of players, multiplayer/networking.
00123 #define MAXPLAYERS                              255
00124 #define MAXPLAYERS_VANILLA              4
00125 
00126 // State updates, number of tics / second.
00127 #define TICRATE                 35
00128 
00129 // The current state of the game: whether we are
00130 // playing, gazing at the intermission screen,
00131 // the game final animation, or a demo.
00132 enum gamestate_t
00133 {
00134         GS_LEVEL,
00135         GS_INTERMISSION,
00136         GS_FINALE,
00137         GS_DEMOSCREEN,
00138         GS_FULLCONSOLE,         // [RH] Fullscreen console
00139         GS_HIDECONSOLE,         // [RH] The menu just did something that should hide fs console
00140         GS_STARTUP,                     // [RH] Console is fullscreen, and game is just starting
00141         GS_DOWNLOAD,            // denis - wad downloading
00142         GS_CONNECTING,          // denis - replace the old global "tryingtoconnect"
00143 
00144         GS_FORCEWIPE = -1
00145 };
00146 
00147 //
00148 // Difficulty/skill settings/filters.
00149 //
00150 
00151 // Skill flags.
00152 #define MTF_EASY                                1
00153 #define MTF_NORMAL                              2
00154 #define MTF_HARD                                4
00155 
00156 // Deaf monsters/do not react to sound.
00157 #define MTF_AMBUSH                              8
00158 
00159 // Gravity
00160 #define GRAVITY         FRACUNIT
00161 
00162 enum skill_t
00163 {
00164         sk_baby = 1,
00165         sk_easy,
00166         sk_medium,
00167         sk_hard,
00168         sk_nightmare
00169 };
00170 
00171 //
00172 // Key cards.
00173 //
00174 enum card_t
00175 {
00176         it_bluecard,
00177         it_yellowcard,
00178         it_redcard,
00179         it_blueskull,
00180         it_yellowskull,
00181         it_redskull,
00182 
00183         NUMCARDS,
00184 
00185                 // GhostlyDeath <August 31, 2008> -- Before this was not = 0 and when
00186                 // the map is loaded the value is just bitshifted so that the values
00187                 // that were here were incorrect, keyed generalized doors work now
00188         NoKey = 0,
00189         RCard,
00190         BCard,
00191         YCard,
00192         RSkull,
00193         BSkull,
00194         YSkull,
00195 
00196         AnyKey = 100,
00197         AllKeys = 101,
00198 
00199         CardIsSkull = 128
00200 };
00201 
00202 //
00203 //      [Toke - CTF] CTF Flags
00204 //
00205 enum flag_t
00206 {
00207         it_blueflag,
00208         it_redflag,
00209 
00210         NUMFLAGS
00211 };
00212 
00213 inline FArchive &operator<< (FArchive &arc, card_t i)
00214 {
00215         return arc << (BYTE)i;
00216 }
00217 inline FArchive &operator>> (FArchive &arc, card_t &i)
00218 {
00219         BYTE in; arc >> in; i = (card_t)in; return arc;
00220 }
00221 
00222 
00223 // The defined weapons,
00224 //      including a marker indicating
00225 //      user has not changed weapon.
00226 enum weapontype_t
00227 {
00228         wp_fist,
00229         wp_pistol,
00230         wp_shotgun,
00231         wp_chaingun,
00232         wp_missile,
00233         wp_plasma,
00234         wp_bfg,
00235         wp_chainsaw,
00236         wp_supershotgun,
00237 
00238         NUMWEAPONS,
00239 
00240         // No pending weapon change.
00241         wp_nochange
00242 
00243 };
00244 
00245 inline FArchive &operator<< (FArchive &arc, weapontype_t i)
00246 {
00247         return arc << (BYTE)i;
00248 }
00249 inline FArchive &operator>> (FArchive &arc, weapontype_t &i)
00250 {
00251         BYTE in; arc >> in; i = (weapontype_t)in; return arc;
00252 }
00253 
00254 
00255 // Ammunition types defined.
00256 enum ammotype_t
00257 {
00258         am_clip,        // Pistol / chaingun ammo.
00259         am_shell,       // Shotgun / double barreled shotgun.
00260         am_cell,        // Plasma rifle, BFG.
00261         am_misl,        // Missile launcher.
00262         NUMAMMO,
00263         am_noammo       // Unlimited for chainsaw / fist.
00264 
00265 };
00266 
00267 inline FArchive &operator<< (FArchive &arc, ammotype_t i)
00268 {
00269         return arc << (BYTE)i;
00270 }
00271 inline FArchive &operator>> (FArchive &arc, ammotype_t &i)
00272 {
00273         BYTE in; arc >> in; i = (ammotype_t)in; return arc;
00274 }
00275 
00276 
00277 // Power up artifacts.
00278 enum powertype_t
00279 {
00280         pw_invulnerability,
00281         pw_strength,
00282         pw_invisibility,
00283         pw_ironfeet,
00284         pw_allmap,
00285         pw_infrared,
00286         NUMPOWERS
00287 };
00288 
00289 inline FArchive &operator<< (FArchive &arc, powertype_t i)
00290 {
00291         return arc << (BYTE)i;
00292 }
00293 inline FArchive &operator>> (FArchive &arc, powertype_t &i)
00294 {
00295         BYTE in; arc >> in; i = (powertype_t)in; return arc;
00296 }
00297 
00298 
00299 //
00300 // Power up durations, how many tics till expiration.
00301 //
00302 #define INVULNTICS      (30*TICRATE)
00303 #define INVISTICS       (60*TICRATE)
00304 #define INFRATICS       (120*TICRATE)
00305 #define IRONTICS        (60*TICRATE)
00306 
00307 // [ML] 1/5/10: Move input defs to doomkeys.h
00308 #include "doomkeys.h"
00309 
00310 // phares 3/20/98:
00311 //
00312 // Player friction is variable, based on controlling
00313 // linedefs. More friction can create mud, sludge,
00314 // magnetized floors, etc. Less friction can create ice.
00315 
00316 #define MORE_FRICTION_MOMENTUM  15000   // mud factor based on momentum
00317 #define ORIG_FRICTION                   0xE800  // original value
00318 #define ORIG_FRICTION_FACTOR    2048    // original value
00319 #define FRICTION_FLY                    0xeb00
00320 
00321 #endif  // __DOOMDEF_H__
00322 
00323 
00324 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends