2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-06-01 13:21:54 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
// quakedef.h -- primary header for client
|
|
|
|
|
2005-12-15 19:15:39 +00:00
|
|
|
#ifndef __QUAKEDEF_H__
|
|
|
|
#define __QUAKEDEF_H__
|
|
|
|
|
2004-12-29 03:06:27 +00:00
|
|
|
#include "bothdefs.h" //first thing included by ALL files.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2011-10-27 15:46:36 +00:00
|
|
|
//for msvc #pragma message lines
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define MSVC_LINE __FILE__"("STRINGIFY(__LINE__)"):"
|
|
|
|
#define warningmsg(s) message(MSVC_LINE s)
|
|
|
|
#elif __GNUC__ >=4
|
|
|
|
#define warningmsg(s) message(s)
|
|
|
|
#endif
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef MSVCDISABLEWARNINGS
|
|
|
|
//#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
|
|
|
|
/*#pragma warning( disable : 4244) //conversion from const double to float
|
|
|
|
#pragma warning( disable : 4305) //truncation from const double to float
|
|
|
|
#pragma warning( disable : 4018) //signed/unsigned mismatch... fix these?
|
|
|
|
#pragma warning( disable : 4706) //assignment within conditional expression - watch for these in GCC where they can be fixed but still functional.
|
|
|
|
#pragma warning( disable : 4100) //unreferenced formal parameter
|
|
|
|
#pragma warning( disable : 4201) //nonstandard extension used : nameless struct/union
|
|
|
|
#pragma warning( disable : 4213) //nonstandard extension used : cast on l-value
|
|
|
|
#pragma warning( disable : 4127) //conditional expression is constant - fixme?
|
|
|
|
*/
|
|
|
|
#pragma warning( 4 : 4244) //conversion from const double to float
|
|
|
|
#pragma warning( 4 : 4305) //truncation from const double to float
|
|
|
|
#pragma warning( 4 : 4018) //truncation from const double to float
|
|
|
|
|
|
|
|
#pragma warning( 2 : 4701)
|
|
|
|
#pragma warning(2:4132 4268)// const object not initialized
|
|
|
|
|
|
|
|
#pragma warning(2:4032) // function arg has different type from declaration
|
|
|
|
#pragma warning(2:4092) // 'sizeof' value too big
|
|
|
|
#pragma warning(2:4132 4268)// const object not initialized
|
|
|
|
//#pragma warning(2:4152) // pointer conversion between function and data
|
|
|
|
#pragma warning(2:4239) // standard doesn't allow this conversion
|
|
|
|
#pragma warning(2:4701) // local variable used without being initialized
|
|
|
|
//#pragma warning(2:4706) // if (a=b) instead of (if a==b)
|
|
|
|
#pragma warning(2:4709) // comma in array subscript
|
|
|
|
#pragma warning(3:4061) // not all enum values tested in switch statement
|
|
|
|
#pragma warning(3:4710) // inline function was not inlined
|
|
|
|
#pragma warning(3:4121) // space added for structure alignment
|
|
|
|
#pragma warning(3:4505) // unreferenced local function removed
|
|
|
|
#pragma warning(3:4019) // empty statement at global scope
|
|
|
|
//#pragma warning(3:4057) // pointers refer to different base types
|
|
|
|
#pragma warning(3:4125) // decimal digit terminates octal escape
|
2006-01-28 02:35:40 +00:00
|
|
|
#pragma warning(2:4131) // old-style function declarator
|
2004-08-23 00:15:46 +00:00
|
|
|
#pragma warning(3:4211) // extern redefined as static
|
|
|
|
//#pragma warning(3:4213) // cast on left side of = is non-standard
|
|
|
|
#pragma warning(3:4222) // member function at file scope shouldn't be static
|
|
|
|
#pragma warning(3:4234 4235)// keyword not supported or reserved for future
|
|
|
|
#pragma warning(3:4504) // type ambiguous; simplify code
|
|
|
|
#pragma warning(3:4507) // explicit linkage specified after default linkage
|
|
|
|
#pragma warning(3:4515) // namespace uses itself
|
|
|
|
#pragma warning(3:4516 4517)// access declarations are deprecated
|
|
|
|
#pragma warning(3:4670) // base class of thrown object is inaccessible
|
|
|
|
#pragma warning(3:4671) // copy ctor of thrown object is inaccessible
|
|
|
|
#pragma warning(3:4673) // thrown object cannot be handled in catch block
|
|
|
|
#pragma warning(3:4674) // dtor of thrown object is inaccessible
|
|
|
|
#pragma warning(3:4705) // statement has no effect (example: a+1;)
|
2005-02-28 07:16:19 +00:00
|
|
|
|
2006-02-11 14:51:36 +00:00
|
|
|
#pragma warning(3:4013) // function undefined, assuming extern returning int
|
2005-11-30 01:20:53 +00:00
|
|
|
|
2005-02-28 07:16:19 +00:00
|
|
|
|
|
|
|
#pragma warning( 4 : 4267) //truncation from const double to float
|
2013-03-12 22:53:23 +00:00
|
|
|
#pragma warning( 4 : 4710) //function not inlined
|
2009-04-06 00:34:32 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
#pragma warning( error : 4020)
|
2009-04-06 00:34:32 +00:00
|
|
|
|
2009-11-04 21:16:50 +00:00
|
|
|
#pragma warning(error:4013)
|
2010-10-02 02:25:39 +00:00
|
|
|
|
|
|
|
//msvc... shut the fuck up.
|
|
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
|
|
#define _CRT_NONSTDC_NO_DEPRECATE
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define QUAKEDEF_H__
|
|
|
|
|
2005-01-28 04:22:51 +00:00
|
|
|
#ifdef SERVERONLY
|
2004-08-23 00:15:46 +00:00
|
|
|
#define isDedicated true
|
|
|
|
#endif
|
2005-02-28 07:16:19 +00:00
|
|
|
#ifdef CLIENTONLY
|
|
|
|
#define isDedicated false
|
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
#define PNG_SUCKS_WITH_SETJMP //cos it does.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define QUAKE_GAME // as opposed to utilities
|
|
|
|
//define PARANOID // speed sapping error checking
|
|
|
|
|
2007-08-07 00:30:25 +00:00
|
|
|
#include <float.h>
|
2004-08-23 00:15:46 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2006-02-11 02:09:43 +00:00
|
|
|
#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) && !defined(SERVERONLY)
|
2011-06-01 13:21:54 +00:00
|
|
|
#if defined(MINGW)
|
|
|
|
#include "./mingw-libs/png.h"
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
#include "png.h"
|
|
|
|
#else
|
|
|
|
#include <png.h>
|
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
#else
|
2013-04-02 05:18:17 +00:00
|
|
|
#ifdef FTE_TARGET_WEB
|
|
|
|
#define setjmp(x) 0
|
|
|
|
#define longjmp(b,r) abort()
|
|
|
|
typedef int jmp_buf;
|
|
|
|
#else
|
|
|
|
#include <setjmp.h>
|
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
|
|
|
#include <time.h>
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "translate.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "bspfile.h"
|
|
|
|
#include "vid.h"
|
|
|
|
#include "sys.h"
|
|
|
|
#include "zone.h"
|
|
|
|
#include "mathlib.h"
|
|
|
|
#include "cvar.h"
|
|
|
|
#include "net.h"
|
|
|
|
#include "protocol.h"
|
|
|
|
#include "cmd.h"
|
2009-04-01 22:03:56 +00:00
|
|
|
#include "wad.h"
|
|
|
|
#include "screen.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "sbar.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "merged.h"
|
|
|
|
#include "render.h"
|
|
|
|
#include "client.h"
|
2010-11-11 18:22:49 +00:00
|
|
|
#include "gl_model.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
#include "vm.h"
|
|
|
|
|
|
|
|
#include "input.h"
|
|
|
|
#include "keys.h"
|
|
|
|
#include "console.h"
|
|
|
|
#include "view.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "crc.h"
|
|
|
|
#include "cdaudio.h"
|
|
|
|
#include "pmove.h"
|
|
|
|
|
2009-11-05 03:07:52 +00:00
|
|
|
#include "progtype.h"
|
|
|
|
#include "progdefs.h"
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifndef CLIENTONLY
|
|
|
|
#include "progs.h"
|
2004-11-29 01:21:00 +00:00
|
|
|
#endif
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "world.h"
|
2004-11-23 01:10:10 +00:00
|
|
|
#include "q2game.h"
|
2010-11-06 23:11:42 +00:00
|
|
|
#include "../http/iweb.h"
|
2009-04-01 22:03:56 +00:00
|
|
|
#ifndef CLIENTONLY
|
2004-08-23 00:15:46 +00:00
|
|
|
#include "server.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef max
|
|
|
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
|
|
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
2012-07-05 19:42:36 +00:00
|
|
|
#ifdef USE_MSVCRT_DEBUG
|
|
|
|
#define _CRTDBG_MAP_ALLOC
|
|
|
|
#include <crtdbg.h>
|
|
|
|
#endif
|
2006-03-06 01:41:09 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2006-03-06 03:15:34 +00:00
|
|
|
#if (_MSC_VER >= 1400)
|
|
|
|
//with MSVC 8, use MS extensions
|
2006-05-18 02:54:22 +00:00
|
|
|
#define snprintf linuxlike_snprintf_vc8
|
2009-11-04 21:16:50 +00:00
|
|
|
int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
2006-03-06 03:15:34 +00:00
|
|
|
#define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
|
|
|
|
#else
|
2006-03-06 01:41:09 +00:00
|
|
|
//msvc crap
|
|
|
|
#define snprintf linuxlike_snprintf
|
2009-11-04 21:16:50 +00:00
|
|
|
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...) LIKEPRINTF(3);
|
2006-03-06 01:41:09 +00:00
|
|
|
#define vsnprintf linuxlike_vsnprintf
|
|
|
|
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
|
2006-03-06 03:15:34 +00:00
|
|
|
#endif
|
|
|
|
|
2006-10-05 21:59:43 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
//these are provided so we don't use them
|
|
|
|
//but mingw has some defines elsewhere and makes gcc moan
|
2006-03-06 01:41:09 +00:00
|
|
|
#define _vsnprintf unsafe_vsnprintf
|
|
|
|
#define _snprintf unsafe_snprintf
|
|
|
|
#endif
|
2006-10-05 21:59:43 +00:00
|
|
|
#endif
|
2006-03-06 01:41:09 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
// the host system specifies the base of the directory tree, the
|
|
|
|
// command line parms passed to the program, and the amount of memory
|
|
|
|
// available for the program to use
|
|
|
|
|
|
|
|
typedef struct quakeparms_s
|
|
|
|
{
|
2012-11-27 03:23:19 +00:00
|
|
|
char *basedir; //working directory
|
|
|
|
char *binarydir; //exe directory
|
2004-08-23 00:15:46 +00:00
|
|
|
int argc;
|
2009-04-01 22:03:56 +00:00
|
|
|
const char **argv;
|
2004-08-23 00:15:46 +00:00
|
|
|
void *membase;
|
2005-03-23 22:14:08 +00:00
|
|
|
unsigned int memsize;
|
2004-08-23 00:15:46 +00:00
|
|
|
} quakeparms_t;
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#define MAX_NUM_ARGVS 128
|
|
|
|
|
|
|
|
|
|
|
|
extern qboolean noclip_anglehack;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// host
|
|
|
|
//
|
|
|
|
extern quakeparms_t host_parms;
|
|
|
|
|
2011-07-30 14:14:56 +00:00
|
|
|
extern cvar_t fs_gamename;
|
2013-06-23 02:17:02 +00:00
|
|
|
extern cvar_t fs_gamemanifest;
|
2011-07-30 14:14:56 +00:00
|
|
|
extern cvar_t com_protocolname;
|
2009-04-01 22:03:56 +00:00
|
|
|
extern cvar_t com_modname;
|
2013-05-11 14:02:55 +00:00
|
|
|
extern cvar_t com_nogamedirnativecode;
|
|
|
|
extern cvar_t com_parseutf8;
|
2004-08-23 00:15:46 +00:00
|
|
|
extern cvar_t sys_ticrate;
|
|
|
|
extern cvar_t sys_nostdout;
|
|
|
|
extern cvar_t developer;
|
|
|
|
|
|
|
|
extern cvar_t password;
|
|
|
|
|
|
|
|
extern qboolean host_initialized; // true if into command execution
|
|
|
|
extern double host_frametime;
|
|
|
|
extern qbyte *host_basepal;
|
2010-08-28 17:14:38 +00:00
|
|
|
extern qbyte *h2playertranslations;
|
2004-08-23 00:15:46 +00:00
|
|
|
extern int host_framecount; // incremented every frame, never reset
|
|
|
|
extern double realtime; // not bounded in any way, changed at
|
|
|
|
// start of every frame, never reset
|
|
|
|
|
|
|
|
void Host_ServerFrame (void);
|
|
|
|
void Host_InitCommands (void);
|
|
|
|
void Host_Init (quakeparms_t *parms);
|
2010-02-06 01:25:04 +00:00
|
|
|
void Host_FinishInit(void);
|
2004-08-23 00:15:46 +00:00
|
|
|
void Host_Shutdown(void);
|
2009-11-04 21:16:50 +00:00
|
|
|
NORETURN void VARGS Host_Error (char *error, ...) LIKEPRINTF(1);
|
|
|
|
NORETURN void VARGS Host_EndGame (char *message, ...) LIKEPRINTF(1);
|
2004-08-23 00:15:46 +00:00
|
|
|
qboolean Host_SimulationTime(float time);
|
2011-07-06 01:01:13 +00:00
|
|
|
double Host_Frame (double time);
|
2013-06-23 02:17:02 +00:00
|
|
|
qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file);
|
2004-08-23 00:15:46 +00:00
|
|
|
void Host_Quit_f (void);
|
2009-11-04 21:16:50 +00:00
|
|
|
void VARGS Host_ClientCommands (char *fmt, ...) LIKEPRINTF(1);
|
2004-08-23 00:15:46 +00:00
|
|
|
void Host_ShutdownServer (qboolean crash);
|
|
|
|
|
|
|
|
extern qboolean msg_suppress_1; // suppresses resolution and cache size console output
|
|
|
|
// an fullscreen DIB focus gain/loss
|
|
|
|
|
|
|
|
|
|
|
|
#if !defined(SERVERONLY) && !defined(CLIENTONLY)
|
|
|
|
extern qboolean isDedicated;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-12-15 19:15:39 +00:00
|
|
|
#endif //__QUAKEDEF_H__
|