1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
19*/
20// quakedef.h -- primary header for client
21
22#define	QUAKE_GAME			// as opposed to utilities
23
24//define	PARANOID			// speed sapping error checking
25
26#ifdef _WIN32
27#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
28#endif
29
30#define GLQUAKE
31#define USE_OPENGLES
32#define id386 0
33
34#include <ctype.h>
35#include <math.h>
36#include <string.h>
37#include <stdarg.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <setjmp.h>
41#include <time.h>
42#include <unistd.h>
43
44#include "bothdefs.h"
45
46#include "common.h"
47#include "bspfile.h"
48#include "vid.h"
49#include "sys.h"
50#include "zone.h"
51#include "mathlib.h"
52#include "wad.h"
53#include "draw.h"
54#include "cvar.h"
55#include "screen.h"
56#include "net.h"
57#include "protocol.h"
58#include "cmd.h"
59#include "sbar.h"
60#include "sound.h"
61#include "render.h"
62#include "client.h"
63
64#ifdef GLQUAKE
65#include "gl_model.h"
66#else
67#include "model.h"
68#include "d_iface.h"
69#endif
70
71#include "input.h"
72#include "keys.h"
73#include "console.h"
74#include "view.h"
75#include "menu.h"
76#include "crc.h"
77#include "cdaudio.h"
78#include "pmove.h"
79
80#ifdef GLQUAKE
81#include "glquake.h"
82#endif
83
84#ifndef max
85#define max(a,b) ((a) > (b) ? (a) : (b))
86#define min(a,b) ((a) < (b) ? (a) : (b))
87#endif
88
89//=============================================================================
90
91// the host system specifies the base of the directory tree, the
92// command line parms passed to the program, and the amount of memory
93// available for the program to use
94
95typedef struct
96{
97	char	*basedir;
98	char	*cachedir;		// for development over ISDN lines
99	int		argc;
100	char	**argv;
101	void	*membase;
102	int		memsize;
103} quakeparms_t;
104
105
106//=============================================================================
107
108#define MAX_NUM_ARGVS	50
109
110
111extern qboolean noclip_anglehack;
112
113
114//
115// host
116//
117extern	quakeparms_t host_parms;
118
119extern	cvar_t		sys_ticrate;
120extern	cvar_t		sys_nostdout;
121extern	cvar_t		developer;
122
123extern	cvar_t	password;
124
125extern	qboolean	host_initialized;		// true if into command execution
126extern	double		host_frametime;
127extern	byte		*host_basepal;
128extern	byte		*host_colormap;
129extern	int			host_framecount;	// incremented every frame, never reset
130extern	double		realtime;			// not bounded in any way, changed at
131										// start of every frame, never reset
132
133void Host_ServerFrame (void);
134void Host_InitCommands (void);
135void Host_Init (quakeparms_t *parms);
136void Host_Shutdown(void);
137void Host_Error (char *error, ...);
138void Host_EndGame (char *message, ...);
139qboolean Host_SimulationTime(float time);
140void Host_Frame (float time);
141void Host_Quit_f (void);
142void Host_ClientCommands (char *fmt, ...);
143void Host_ShutdownServer (qboolean crash);
144
145extern qboolean		msg_suppress_1;		// suppresses resolution and cache size console output
146										//  an fullscreen DIB focus gain/loss
147
148
149// Linux versions of msdos CRT functions
150#define stricmp strcasecmp
151
152// Helper functions for OpenGL ES
153void DrawQuad_NoTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h);
154void DrawQuad(GLfloat x, GLfloat y, GLfloat w, GLfloat h, GLfloat u, GLfloat v, GLfloat uw, GLfloat vh);
155
156void shadowLoadIdentity( GLfloat* m);
157void shadowRotatef( GLfloat* m, GLfloat a, GLfloat x, GLfloat y, GLfloat z);
158void shadowTranslatef( GLfloat* m, GLfloat x, GLfloat y, GLfloat z);
159
160#ifdef USE_OPENGLES
161// Reimplementation of OpenGL functions that are missing in OpenGL ES
162
163#define GL_INTENSITY				0x8049
164
165void glColor3f(GLfloat r, GLfloat g, GLfloat b);
166void glColor4fv(GLfloat* pColor);
167void glColor4ubv(unsigned char* pColor);
168
169
170#endif
171
172