mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-06-01 09:32:36 +00:00
Moved compability macros and declarations into compat.h
Moved some common stuff from quakedef.h and qwsvdef.h into commdef.h
This commit is contained in:
parent
1d1726fd46
commit
46e80702d3
4 changed files with 129 additions and 96 deletions
59
include/commdef.h
Normal file
59
include/commdef.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
commdef.h - Definitions common to client and server.
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
Copyright (C) 2000 Marcus Sundberg <mackan@stacken.kth.se>
|
||||||
|
|
||||||
|
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
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __QF_COMMDEF_H
|
||||||
|
#define __QF_COMMDEF_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
{
|
||||||
|
char *basedir;
|
||||||
|
char *cachedir; /* for development over ISDN lines */
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
void *membase;
|
||||||
|
int memsize;
|
||||||
|
} quakeparms_t;
|
||||||
|
|
||||||
|
/* Host */
|
||||||
|
extern quakeparms_t host_parms;
|
||||||
|
|
||||||
|
extern cvar_t *sys_nostdout;
|
||||||
|
extern cvar_t *developer;
|
||||||
|
|
||||||
|
extern qboolean host_initialized; /* True if into command execution. */
|
||||||
|
extern double host_frametime;
|
||||||
|
extern double realtime; /* Not bounded in any way, changed at
|
||||||
|
start of every frame, never reset */
|
||||||
|
|
||||||
|
#endif /* __QF_COMMDEF_H */
|
63
include/compat.h
Normal file
63
include/compat.h
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
compat.h - Misc compability stuff
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
Copyright (C) 2000 Marcus Sundberg <mackan@stacken.kth.se>
|
||||||
|
|
||||||
|
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
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __QF_COMPAT_H
|
||||||
|
#define __QF_COMPAT_H
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef max
|
||||||
|
# define max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
#ifndef min
|
||||||
|
# define min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This fixes warnings when compiling with -pedantic */
|
||||||
|
#if defined(__GNUC__) && !defined(inline)
|
||||||
|
# define inline __inline__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These may be underscored... */
|
||||||
|
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
|
||||||
|
# define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
#endif
|
||||||
|
#if defined(_WIN32) && !defined(__BORLANDC__)
|
||||||
|
# define kbhit _kbhit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If we don't have them in the C-library we declare them to avoid warnings */
|
||||||
|
#if ! (defined(HAVE_SNPRINTF) || defined(HAVE__SNPRINTF))
|
||||||
|
extern int snprintf(char * s, size_t maxlen, const char *format, ...);
|
||||||
|
#endif
|
||||||
|
#if ! (defined(HAVE_VSNPRINTF) || defined(HAVE__VSNPRINTF))
|
||||||
|
extern int vsnprintf(char *s, size_t maxlen, const char *format, va_list arg);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __QF_COMPAT_H */
|
|
@ -69,37 +69,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "cdaudio.h"
|
#include "cdaudio.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
|
|
||||||
|
#include "compat.h"
|
||||||
|
#include "commdef.h"
|
||||||
|
|
||||||
#ifndef max
|
|
||||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
// 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
|
|
||||||
{
|
|
||||||
char *basedir;
|
|
||||||
char *cachedir; // for development over ISDN lines
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
void *membase;
|
|
||||||
int memsize;
|
|
||||||
} quakeparms_t;
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
#define MAX_NUM_ARGVS 50
|
#define MAX_NUM_ARGVS 50
|
||||||
|
|
||||||
|
@ -107,32 +79,17 @@ typedef struct
|
||||||
extern qboolean noclip_anglehack;
|
extern qboolean noclip_anglehack;
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// host
|
|
||||||
//
|
|
||||||
extern quakeparms_t host_parms;
|
|
||||||
|
|
||||||
/* extern cvar_t sys_ticrate;
|
/* extern cvar_t sys_ticrate;
|
||||||
CVAR_FIXME */
|
CVAR_FIXME */
|
||||||
extern cvar_t *sys_ticrate;
|
extern cvar_t *sys_ticrate;
|
||||||
/* extern cvar_t sys_nostdout;
|
|
||||||
CVAR_FIXME */
|
|
||||||
extern cvar_t *sys_nostdout;
|
|
||||||
/* extern cvar_t developer;
|
|
||||||
CVAR_FIXME */
|
|
||||||
extern cvar_t *developer;
|
|
||||||
|
|
||||||
/* extern cvar_t password;
|
/* extern cvar_t password;
|
||||||
CVAR_FIXME */
|
CVAR_FIXME */
|
||||||
extern cvar_t *password;
|
extern cvar_t *password;
|
||||||
|
|
||||||
extern qboolean host_initialized; // true if into command execution
|
|
||||||
extern double host_frametime;
|
|
||||||
extern byte *host_basepal;
|
extern byte *host_basepal;
|
||||||
extern byte *host_colormap;
|
extern byte *host_colormap;
|
||||||
extern int host_framecount; // incremented every frame, never reset
|
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_ServerFrame (void);
|
||||||
void Host_InitCommands (void);
|
void Host_InitCommands (void);
|
||||||
|
@ -146,6 +103,6 @@ void Host_Quit_f (void);
|
||||||
void Host_ClientCommands (char *fmt, ...);
|
void Host_ClientCommands (char *fmt, ...);
|
||||||
void Host_ShutdownServer (qboolean crash);
|
void Host_ShutdownServer (qboolean crash);
|
||||||
|
|
||||||
extern qboolean msg_suppress_1; // suppresses resolution and cache size console output
|
extern qboolean msg_suppress_1; /* Suppresses resolution and cache
|
||||||
// an fullscreen DIB focus gain/loss
|
size console output and
|
||||||
|
fullscreen DIB focus gain/loss */
|
||||||
|
|
|
@ -57,58 +57,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
|
|
||||||
#ifndef max
|
#include "compat.h"
|
||||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
#include "commdef.h"
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#define kbhit _kbhit
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
// 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
|
|
||||||
{
|
|
||||||
char *basedir;
|
|
||||||
char *cachedir; // for development over ISDN lines
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
void *membase;
|
|
||||||
int memsize;
|
|
||||||
} quakeparms_t;
|
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
//
|
|
||||||
// host
|
|
||||||
//
|
|
||||||
extern quakeparms_t host_parms;
|
|
||||||
|
|
||||||
/* extern cvar_t sys_nostdout;
|
|
||||||
CVAR_FIXME */
|
|
||||||
extern cvar_t *sys_nostdout;
|
|
||||||
/* extern cvar_t developer;
|
|
||||||
CVAR_FIXME */
|
|
||||||
extern cvar_t *developer;
|
|
||||||
|
|
||||||
extern qboolean host_initialized; // true if into command execution
|
|
||||||
extern double host_frametime;
|
|
||||||
extern double realtime; // not bounded in any way, changed at
|
|
||||||
// start of every frame, never reset
|
|
||||||
|
|
||||||
void SV_Error (char *error, ...);
|
void SV_Error (char *error, ...);
|
||||||
void SV_Init (quakeparms_t *parms);
|
void SV_Init (quakeparms_t *parms);
|
||||||
|
|
||||||
void Con_Printf (char *fmt, ...);
|
void Con_Printf (char *fmt, ...);
|
||||||
void Con_DPrintf (char *fmt, ...);
|
void Con_DPrintf (char *fmt, ...);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue