Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

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