quakedef.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. // quakedef.h -- primary header for client
  16. //#define GLTEST // experimental stuff
  17. #define QUAKE_GAME // as opposed to utilities
  18. #define VERSION 1.09
  19. #define GLQUAKE_VERSION 1.00
  20. #define D3DQUAKE_VERSION 0.01
  21. #define WINQUAKE_VERSION 0.996
  22. #define LINUX_VERSION 1.30
  23. #define X11_VERSION 1.10
  24. //define PARANOID // speed sapping error checking
  25. #ifdef QUAKE2
  26. #define GAMENAME "id1" // directory to look in by default
  27. #else
  28. #define GAMENAME "id1"
  29. #endif
  30. #include <math.h>
  31. #include <string.h>
  32. #include <stdarg.h>
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include <setjmp.h>
  36. #if defined(_WIN32) && !defined(WINDED)
  37. #if defined(_M_IX86)
  38. #define __i386__ 1
  39. #endif
  40. void VID_LockBuffer (void);
  41. void VID_UnlockBuffer (void);
  42. #else
  43. #define VID_LockBuffer()
  44. #define VID_UnlockBuffer()
  45. #endif
  46. #if defined __i386__ // && !defined __sun__
  47. #define id386 1
  48. #else
  49. #define id386 0
  50. #endif
  51. #if id386
  52. #define UNALIGNED_OK 1 // set to 0 if unaligned accesses are not supported
  53. #else
  54. #define UNALIGNED_OK 0
  55. #endif
  56. // !!! if this is changed, it must be changed in d_ifacea.h too !!!
  57. #define CACHE_SIZE 32 // used to align key data structures
  58. #define UNUSED(x) (x = x) // for pesky compiler / lint warnings
  59. #define MINIMUM_MEMORY 0x550000
  60. #define MINIMUM_MEMORY_LEVELPAK (MINIMUM_MEMORY + 0x100000)
  61. #define MAX_NUM_ARGVS 50
  62. // up / down
  63. #define PITCH 0
  64. // left / right
  65. #define YAW 1
  66. // fall over
  67. #define ROLL 2
  68. #define MAX_QPATH 64 // max length of a quake game pathname
  69. #define MAX_OSPATH 128 // max length of a filesystem pathname
  70. #define ON_EPSILON 0.1 // point on plane side epsilon
  71. #define MAX_MSGLEN 8000 // max length of a reliable message
  72. #define MAX_DATAGRAM 1024 // max length of unreliable message
  73. //
  74. // per-level limits
  75. //
  76. #define MAX_EDICTS 600 // FIXME: ouch! ouch! ouch!
  77. #define MAX_LIGHTSTYLES 64
  78. #define MAX_MODELS 256 // these are sent over the net as bytes
  79. #define MAX_SOUNDS 256 // so they cannot be blindly increased
  80. #define SAVEGAME_COMMENT_LENGTH 39
  81. #define MAX_STYLESTRING 64
  82. //
  83. // stats are integers communicated to the client by the server
  84. //
  85. #define MAX_CL_STATS 32
  86. #define STAT_HEALTH 0
  87. #define STAT_FRAGS 1
  88. #define STAT_WEAPON 2
  89. #define STAT_AMMO 3
  90. #define STAT_ARMOR 4
  91. #define STAT_WEAPONFRAME 5
  92. #define STAT_SHELLS 6
  93. #define STAT_NAILS 7
  94. #define STAT_ROCKETS 8
  95. #define STAT_CELLS 9
  96. #define STAT_ACTIVEWEAPON 10
  97. #define STAT_TOTALSECRETS 11
  98. #define STAT_TOTALMONSTERS 12
  99. #define STAT_SECRETS 13 // bumped on client side by svc_foundsecret
  100. #define STAT_MONSTERS 14 // bumped by svc_killedmonster
  101. // stock defines
  102. #define IT_SHOTGUN 1
  103. #define IT_SUPER_SHOTGUN 2
  104. #define IT_NAILGUN 4
  105. #define IT_SUPER_NAILGUN 8
  106. #define IT_GRENADE_LAUNCHER 16
  107. #define IT_ROCKET_LAUNCHER 32
  108. #define IT_LIGHTNING 64
  109. #define IT_SUPER_LIGHTNING 128
  110. #define IT_SHELLS 256
  111. #define IT_NAILS 512
  112. #define IT_ROCKETS 1024
  113. #define IT_CELLS 2048
  114. #define IT_AXE 4096
  115. #define IT_ARMOR1 8192
  116. #define IT_ARMOR2 16384
  117. #define IT_ARMOR3 32768
  118. #define IT_SUPERHEALTH 65536
  119. #define IT_KEY1 131072
  120. #define IT_KEY2 262144
  121. #define IT_INVISIBILITY 524288
  122. #define IT_INVULNERABILITY 1048576
  123. #define IT_SUIT 2097152
  124. #define IT_QUAD 4194304
  125. #define IT_SIGIL1 (1<<28)
  126. #define IT_SIGIL2 (1<<29)
  127. #define IT_SIGIL3 (1<<30)
  128. #define IT_SIGIL4 (1<<31)
  129. //===========================================
  130. //rogue changed and added defines
  131. #define RIT_SHELLS 128
  132. #define RIT_NAILS 256
  133. #define RIT_ROCKETS 512
  134. #define RIT_CELLS 1024
  135. #define RIT_AXE 2048
  136. #define RIT_LAVA_NAILGUN 4096
  137. #define RIT_LAVA_SUPER_NAILGUN 8192
  138. #define RIT_MULTI_GRENADE 16384
  139. #define RIT_MULTI_ROCKET 32768
  140. #define RIT_PLASMA_GUN 65536
  141. #define RIT_ARMOR1 8388608
  142. #define RIT_ARMOR2 16777216
  143. #define RIT_ARMOR3 33554432
  144. #define RIT_LAVA_NAILS 67108864
  145. #define RIT_PLASMA_AMMO 134217728
  146. #define RIT_MULTI_ROCKETS 268435456
  147. #define RIT_SHIELD 536870912
  148. #define RIT_ANTIGRAV 1073741824
  149. #define RIT_SUPERHEALTH 2147483648
  150. //MED 01/04/97 added hipnotic defines
  151. //===========================================
  152. //hipnotic added defines
  153. #define HIT_PROXIMITY_GUN_BIT 16
  154. #define HIT_MJOLNIR_BIT 7
  155. #define HIT_LASER_CANNON_BIT 23
  156. #define HIT_PROXIMITY_GUN (1<<HIT_PROXIMITY_GUN_BIT)
  157. #define HIT_MJOLNIR (1<<HIT_MJOLNIR_BIT)
  158. #define HIT_LASER_CANNON (1<<HIT_LASER_CANNON_BIT)
  159. #define HIT_WETSUIT (1<<(23+2))
  160. #define HIT_EMPATHY_SHIELDS (1<<(23+3))
  161. //===========================================
  162. #define MAX_SCOREBOARD 16
  163. #define MAX_SCOREBOARDNAME 32
  164. #define SOUND_CHANNELS 8
  165. // This makes anyone on id's net privileged
  166. // Use for multiplayer testing only - VERY dangerous!!!
  167. // #define IDGODS
  168. #include "common.h"
  169. #include "bspfile.h"
  170. #include "vid.h"
  171. #include "sys.h"
  172. #include "zone.h"
  173. #include "mathlib.h"
  174. typedef struct
  175. {
  176. vec3_t origin;
  177. vec3_t angles;
  178. int modelindex;
  179. int frame;
  180. int colormap;
  181. int skin;
  182. int effects;
  183. } entity_state_t;
  184. #include "wad.h"
  185. #include "draw.h"
  186. #include "cvar.h"
  187. #include "screen.h"
  188. #include "net.h"
  189. #include "protocol.h"
  190. #include "cmd.h"
  191. #include "sbar.h"
  192. #include "sound.h"
  193. #include "render.h"
  194. #include "client.h"
  195. #include "progs.h"
  196. #include "server.h"
  197. #ifdef GLQUAKE
  198. #include "gl_model.h"
  199. #else
  200. #include "model.h"
  201. #include "d_iface.h"
  202. #endif
  203. #include "input.h"
  204. #include "world.h"
  205. #include "keys.h"
  206. #include "console.h"
  207. #include "view.h"
  208. #include "menu.h"
  209. #include "crc.h"
  210. #include "cdaudio.h"
  211. #ifdef GLQUAKE
  212. #include "glquake.h"
  213. #endif
  214. //=============================================================================
  215. // the host system specifies the base of the directory tree, the
  216. // command line parms passed to the program, and the amount of memory
  217. // available for the program to use
  218. typedef struct
  219. {
  220. char *basedir;
  221. char *cachedir; // for development over ISDN lines
  222. int argc;
  223. char **argv;
  224. void *membase;
  225. int memsize;
  226. } quakeparms_t;
  227. //=============================================================================
  228. extern qboolean noclip_anglehack;
  229. //
  230. // host
  231. //
  232. extern quakeparms_t host_parms;
  233. extern cvar_t sys_ticrate;
  234. extern cvar_t sys_nostdout;
  235. extern cvar_t developer;
  236. extern qboolean host_initialized; // true if into command execution
  237. extern double host_frametime;
  238. extern byte *host_basepal;
  239. extern byte *host_colormap;
  240. extern int host_framecount; // incremented every frame, never reset
  241. extern double realtime; // not bounded in any way, changed at
  242. // start of every frame, never reset
  243. void Host_ClearMemory (void);
  244. void Host_ServerFrame (void);
  245. void Host_InitCommands (void);
  246. void Host_Init (quakeparms_t *parms);
  247. void Host_Shutdown(void);
  248. void Host_Error (char *error, ...);
  249. void Host_EndGame (char *message, ...);
  250. void Host_Frame (float time);
  251. void Host_Quit_f (void);
  252. void Host_ClientCommands (char *fmt, ...);
  253. void Host_ShutdownServer (qboolean crash);
  254. extern qboolean msg_suppress_1; // suppresses resolution and cache size console output
  255. // an fullscreen DIB focus gain/loss
  256. extern int current_skill; // skill level for currently loaded level (in case
  257. // the user changes the cvar while the level is
  258. // running, this reflects the level actually in use)
  259. extern qboolean isDedicated;
  260. extern int minimum_memory;
  261. //
  262. // chase
  263. //
  264. extern cvar_t chase_active;
  265. void Chase_Init (void);
  266. void Chase_Reset (void);
  267. void Chase_Update (void);