HUGE changes..

Basicly, sound_lib.a is built, and is compiled into the clients..
Note, uquake is SERIOUSLY FSCKED..
This commit is contained in:
Zephaniah E. Hull 2000-01-27 17:06:02 +00:00
parent d38c50700e
commit f18b3bcf02
126 changed files with 3957 additions and 6675 deletions

View file

@ -2,9 +2,9 @@ SRC_DIR = @srcdir@
HAVE_UDP = @HAVE_UDP@
ifeq ($(HAVE_UDP),yes)
SUBDIRS = qw_client qw_server uquake
SUBDIRS = common qw_client qw_server uquake
else
SUBDIRS = uquake
SUBDIRS = common uquake
endif
DESTDIR =
@ -67,4 +67,8 @@ qw_server/Makefile: qw_server/Makefile.in configure
uquake/Makefile: uquake/Makefile.in configure
$(SHELL) ./config.status --recheck
$(SHELL) ./config.status
common/Makefile: common/Makefile.in configure
$(SHELL) ./config.status --recheck
$(SHELL) ./config.status
endif

View file

@ -40,3 +40,11 @@
/* Define this to use experimental code */
#undef _EXPERIMENTAL_
@BOTTOM@
#ifdef __i386__
#define id386 1
#else
#define id386 0
#endif

186
common/Makefile.in Normal file
View file

@ -0,0 +1,186 @@
########################################################################
#
# Quake general stuff
#
PROJECT_DIR := @top_srcdir@
PROJECT_ODIR := ..
SRC_DIR := @srcdir@
COMMON_DIR := $(PROJECT_DIR)/common
COMMON_ODIR := $(PROJECT_ODIR)/common
BIN_PREFIX := common
DESTDIR :=
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir := @bindir@
mandir := @mandir@
TARGET_DIR := $(PROJECT_ODIR)/targets
BUILD_DIR := $(TARGET_DIR)/common
OBJ_PATTERN := $(shell echo $(BUILD_DIR)/{sound,common}_lib/%.o)
SOUND_LIB := sound_lib.a
LDFLAGS = @LDFLAGS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
ifneq ($(SRC_DIR),.)
SRC_DIR_INC = -I$(SRC_DIR)
endif
HAS_MGL = @HAS_MGL@
HAS_GGI = @HAS_GGI@
HAS_SVGA = @HAS_SVGA@
HAS_GLIDE = @HAS_GLIDE@
HAS_TDFXGL = @HAS_TDFXGL@
HAS_OGL = @HAS_OGL@
HAS_XIL = @HAS_XIL@
HAS_X11 = @HAS_X11@
HAS_SDL = @HAS_SDL@
MAKE_SURE_DIR = if test -d "$(BUILD_DIR)/$$DIR"; \
then \
true; \
else \
echo "Creating directory $(BUILD_DIR)/$$DIR"; \
mkdir -p $(BUILD_DIR)/$$DIR; \
fi
RELEASE = @RELEASE@
ifeq ($(RELEASE),yes)
OPTFLAGS = @RELEASE_CFLAGS@
else
OPTFLAGS = -g
endif
lib_targets = $(SOUND_LIB) $(CD_LIB) $(COMMON_LIB)
targets = $(lib_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
.PHONY: $(targets) $(CLEAN_TARGETS)
all: $(targets)
########################################################################
#
# Source files
#
ifeq ($(INTEL_ARCH),yes)
# Source file the Intel archictecture only
SOUND_SRC += snd_mixa.s
else
# Source files for non-Intel platforms
endif
# System specific source files
CD_AUDIO_SRC = cd_wrapper.c
# Sound source
SOUND_STYLE = @SOUND_STYLE@
ifeq ($(SOUND_STYLE),ALSA)
SOUND_SRC += snd_dma.c snd_alsa.c
endif
ifeq ($(SOUND_STYLE),OSS)
SOUND_SRC += snd_dma.c snd_oss.c
endif
ifeq ($(SOUND_STYLE),Solaris)
SOUND_SRC += snd_dma.c snd_sun.c
endif
ifeq ($(SOUND_STYLE),MME)
SOUND_SRC += snd_dma.c snd_mme.c
endif
ifeq ($(SOUND_STYLE),Windows)
SOUND_SRC += snd_dma.c snd_win.c
endif
ifeq ($(SOUND_STYLE),NULL)
SOUND_SRC += snd_null.c
endif
SOUND_SRC += snd_mem.c snd_mix.c
# Networking source files
#
# Uncomment the second line to add IPv6 support
QW_NET_SRC = net_udp.c net_com.c mdfour.c
#QW_NET_SRC = net_udp6.c net_com.c mdfour.c
########################################################################
#
# Directory specific stuff
#
DEFS = @DEFS@
CFLAGS = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. \
$(SRC_DIR_INC) -I$(COMMON_ODIR) -I$(COMMON_DIR)
###########################################################################
#
# Compilation rules
#
$(OBJ_PATTERN): $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(OBJ_PATTERN): $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
###########################################################################
#
# Specific target rules
#
# Lib Software targets
SOUND_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/sound_lib/%,$(addsuffix \
.@OBJEXT@, $(basename $(SOUND_SRC) .c .s)))
sound_lib_DIR:
@DIR=sound_lib; $(MAKE_SURE_DIR)
$(SOUND_LIB): sound_lib_DIR $(TARGET_DIR)/sound_lib.a
$(TARGET_DIR)/sound_lib.a: $(SOUND_LIB_OBJS)
#gcc -Wall -shared -o $@ $(SOUND_LIB_OBJS)
ar cru $@ $(SOUND_LIB_OBJS)
ranlib $@
###########################################################################
#
# Misc targets
#
distclean: clean
rm -f Makefile
$(CLEAN_TARGETS):
rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
clean-sound_lib:
rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
clean: clean-sound_lib $(CLEAN_TARGETS)
-rmdir $(BUILD_DIR)
install: $(targets)
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)
for i in $(targets); do \
$(PROJECT_DIR)/install-sh -m 755 $(BUILD_DIR)/../$$i \
$(DESTDIR)/$(bindir)/$$i; \
done
check:
@echo check not implemented

284
common/bspfile.h Normal file
View file

@ -0,0 +1,284 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 _BSPFILE_H
#define _BSPFILE_H
// upper design bounds
#define MAX_MAP_HULLS 4
#define MAX_MAP_MODELS 256
#define MAX_MAP_BRUSHES 4096
#define MAX_MAP_ENTITIES 1024
#define MAX_MAP_ENTSTRING 65536
#define MAX_MAP_PLANES 8192
#define MAX_MAP_NODES 32767 // because negative shorts are contents
#define MAX_MAP_CLIPNODES 32767 //
#define MAX_MAP_LEAFS 32767 //
#define MAX_MAP_VERTS 65535
#define MAX_MAP_FACES 65535
#define MAX_MAP_MARKSURFACES 65535
#define MAX_MAP_TEXINFO 4096
#define MAX_MAP_EDGES 256000
#define MAX_MAP_SURFEDGES 512000
#define MAX_MAP_MIPTEX 0x200000
#define MAX_MAP_LIGHTING 0x100000
#define MAX_MAP_VISIBILITY 0x100000
// key / value pair sizes
#define MAX_KEY 32
#define MAX_VALUE 1024
//=============================================================================
#define BSPVERSION 29
typedef struct
{
int fileofs, filelen;
} lump_t;
#define LUMP_ENTITIES 0
#define LUMP_PLANES 1
#define LUMP_TEXTURES 2
#define LUMP_VERTEXES 3
#define LUMP_VISIBILITY 4
#define LUMP_NODES 5
#define LUMP_TEXINFO 6
#define LUMP_FACES 7
#define LUMP_LIGHTING 8
#define LUMP_CLIPNODES 9
#define LUMP_LEAFS 10
#define LUMP_MARKSURFACES 11
#define LUMP_EDGES 12
#define LUMP_SURFEDGES 13
#define LUMP_MODELS 14
#define HEADER_LUMPS 15
typedef struct
{
float mins[3], maxs[3];
float origin[3];
int headnode[MAX_MAP_HULLS];
int visleafs; // not including the solid leaf 0
int firstface, numfaces;
} dmodel_t;
typedef struct
{
int version;
lump_t lumps[HEADER_LUMPS];
} dheader_t;
typedef struct
{
int nummiptex;
int dataofs[4]; // [nummiptex]
} dmiptexlump_t;
#define MIPLEVELS 4
typedef struct miptex_s
{
char name[16];
unsigned width, height;
unsigned offsets[MIPLEVELS]; // four mip maps stored
} miptex_t;
typedef struct
{
float point[3];
} dvertex_t;
// 0-2 are axial planes
#define PLANE_X 0
#define PLANE_Y 1
#define PLANE_Z 2
// 3-5 are non-axial planes snapped to the nearest
#define PLANE_ANYX 3
#define PLANE_ANYY 4
#define PLANE_ANYZ 5
typedef struct
{
float normal[3];
float dist;
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
} dplane_t;
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
int planenum;
short children[2]; // negative numbers are -(leafs+1), not nodes
short mins[3]; // for sphere culling
short maxs[3];
unsigned short firstface;
unsigned short numfaces; // counting both sides
} dnode_t;
typedef struct
{
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;
typedef struct texinfo_s
{
float vecs[2][4]; // [s/t][xyz offset]
int miptex;
int flags;
} texinfo_t;
#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
// note that edge 0 is never used, because negative edge nums are used for
// counterclockwise use of the edge in a face
typedef struct
{
unsigned short v[2]; // vertex numbers
} dedge_t;
#define MAXLIGHTMAPS 4
typedef struct
{
short planenum;
short side;
int firstedge; // we must support > 64k edges
short numedges;
short texinfo;
// lighting info
byte styles[MAXLIGHTMAPS];
int lightofs; // start of [numstyles*surfsize] samples
} dface_t;
#define AMBIENT_WATER 0
#define AMBIENT_SKY 1
#define AMBIENT_SLIME 2
#define AMBIENT_LAVA 3
#define NUM_AMBIENTS 4 // automatic ambient sounds
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
// all other leafs need visibility info
typedef struct
{
int contents;
int visofs; // -1 = no visibility info
short mins[3]; // for frustum culling
short maxs[3];
unsigned short firstmarksurface;
unsigned short nummarksurfaces;
byte ambient_level[NUM_AMBIENTS];
} dleaf_t;
//============================================================================
#ifndef QUAKE_GAME
// the utilities get to be lazy and just use large static arrays
extern int nummodels;
extern dmodel_t dmodels[MAX_MAP_MODELS];
extern int visdatasize;
extern byte dvisdata[MAX_MAP_VISIBILITY];
extern int lightdatasize;
extern byte dlightdata[MAX_MAP_LIGHTING];
extern int texdatasize;
extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
extern int entdatasize;
extern char dentdata[MAX_MAP_ENTSTRING];
extern int numleafs;
extern dleaf_t dleafs[MAX_MAP_LEAFS];
extern int numplanes;
extern dplane_t dplanes[MAX_MAP_PLANES];
extern int numvertexes;
extern dvertex_t dvertexes[MAX_MAP_VERTS];
extern int numnodes;
extern dnode_t dnodes[MAX_MAP_NODES];
extern int numtexinfo;
extern texinfo_t texinfo[MAX_MAP_TEXINFO];
extern int numfaces;
extern dface_t dfaces[MAX_MAP_FACES];
extern int numclipnodes;
extern dclipnode_t dclipnodes[MAX_MAP_CLIPNODES];
extern int numedges;
extern dedge_t dedges[MAX_MAP_EDGES];
extern int nummarksurfaces;
extern unsigned short dmarksurfaces[MAX_MAP_MARKSURFACES];
extern int numsurfedges;
extern int dsurfedges[MAX_MAP_SURFEDGES];
void LoadBSPFile (char *filename);
void WriteBSPFile (char *filename);
void PrintBSPFileSizes (void);
#endif
#endif // _BSPFILE_H

View file

@ -22,7 +22,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All
// rights reserved.
#include "qtypes.h"
#include "quakedef.h"
#include "console.h"
#include "cdaudio.h"
#include "common.h"
#include "sound.h"
#include "cmd.h"
#include "cvar.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
@ -44,6 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include <sys/cdio.h>
#endif
static qboolean cdValid = false;
static qboolean playing = false;
static qboolean wasPlaying = false;

View file

@ -22,6 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cmd.c -- Quake script command processing module
#include "quakedef.h"
#include "common.h"
#include "cmd.h"
#include "console.h"
#include "cvar.h"
#include "sys.h"
#include "client.h"
void Cmd_ForwardToServer (void);

File diff suppressed because it is too large Load diff

View file

@ -1,247 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// comndef.h -- general definitions
#ifndef _COMMON_H
#define _COMMON_H
#include <bothdefs.h>
#include <register_check.h>
typedef unsigned char byte;
// KJB Undefined true and false defined in SciTech's DEBUG.H header
#undef true
#undef false
typedef enum {false, true} qboolean;
#define MAX_INFO_STRING 196
#define MAX_SERVERINFO_STRING 512
#define MAX_LOCALINFO_STRING 32768
//============================================================================
typedef struct sizebuf_s
{
qboolean allowoverflow; // if false, do a Sys_Error
qboolean overflowed; // set to true if the buffer size failed
byte *data;
int maxsize;
int cursize;
} sizebuf_t;
void SZ_Alloc (sizebuf_t *buf, int startsize);
void SZ_Free (sizebuf_t *buf);
void SZ_Clear (sizebuf_t *buf);
void *SZ_GetSpace (sizebuf_t *buf, int length);
void SZ_Write (sizebuf_t *buf, void *data, int length);
void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf
//============================================================================
typedef struct link_s
{
struct link_s *prev, *next;
} link_t;
void ClearLink (link_t *l);
void RemoveLink (link_t *l);
void InsertLinkBefore (link_t *l, link_t *before);
void InsertLinkAfter (link_t *l, link_t *after);
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
//============================================================================
// Pak 3 loading support:
/*
pack_t *COM_LoadQ3PackFile (char *packfile);
uint_t COM_pak3_getlen(unzFile *pak);
int COM_pak3_open(unzFile *pak, const char *path);
uint_t COM_pak3_readfile(unzFile *pak, const char *path, uint_t bufsize, byte_t *buf);
int COM_pak3_read(unzFile *pak, void *buf, uint_t size, uint_t nmemb);
int COM_pak3_checkfile(unzFile *pak, const char *path);
*/
// End Pak3 support.
//============================================================================
#ifndef NULL
#define NULL ((void *)0)
#endif
#define Q_MAXCHAR ((char)0x7f)
#define Q_MAXSHORT ((short)0x7fff)
#define Q_MAXINT ((int)0x7fffffff)
#define Q_MAXLONG ((int)0x7fffffff)
#define Q_MAXFLOAT ((int)0x7fffffff)
#define Q_MINCHAR ((char)0x80)
#define Q_MINSHORT ((short)0x8000)
#define Q_MININT ((int)0x80000000)
#define Q_MINLONG ((int)0x80000000)
#define Q_MINFLOAT ((int)0x7fffffff)
//============================================================================
extern short (*BigShort) (short l);
extern short (*LittleShort) (short l);
extern int (*BigLong) (int l);
extern int (*LittleLong) (int l);
extern float (*BigFloat) (float l);
extern float (*LittleFloat) (float l);
//============================================================================
struct usercmd_s;
extern struct usercmd_s nullcmd;
void MSG_WriteChar (sizebuf_t *sb, int c);
void MSG_WriteByte (sizebuf_t *sb, int c);
void MSG_WriteShort (sizebuf_t *sb, int c);
void MSG_WriteLong (sizebuf_t *sb, int c);
void MSG_WriteFloat (sizebuf_t *sb, float f);
void MSG_WriteString (sizebuf_t *sb, char *s);
void MSG_WriteCoord (sizebuf_t *sb, float f);
void MSG_WriteAngle (sizebuf_t *sb, float f);
void MSG_WriteAngle16 (sizebuf_t *sb, float f);
void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
extern int msg_readcount;
extern qboolean msg_badread; // set if a read goes beyond end of message
void MSG_BeginReading (void);
int MSG_GetReadCount(void);
int MSG_ReadChar (void);
int MSG_ReadByte (void);
int MSG_ReadShort (void);
int MSG_ReadLong (void);
float MSG_ReadFloat (void);
char *MSG_ReadString (void);
char *MSG_ReadStringLine (void);
float MSG_ReadCoord (void);
float MSG_ReadAngle (void);
float MSG_ReadAngle16 (void);
void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd);
//============================================================================
#define Q_memset(d, f, c) memset((d), (f), (c))
#define Q_memcpy(d, s, c) memcpy((d), (s), (c))
#define Q_memcmp(m1, m2, c) memcmp((m1), (m2), (c))
#define Q_strcpy(d, s) strcpy((d), (s))
#define Q_strncpy(d, s, n) strncpy((d), (s), (n))
#define Q_strlen(s) ((int)strlen(s))
#define Q_strrchr(s, c) strrchr((s), (c))
#define Q_strcat(d, s) strcat((d), (s))
#define Q_strcmp(s1, s2) strcmp((s1), (s2))
#define Q_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
#ifdef _WIN32
#define Q_strcasecmp(s1, s2) _stricmp((s1), (s2))
#define Q_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
#else
#define Q_strcasecmp(s1, s2) strcasecmp((s1), (s2))
#define Q_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
#endif
int Q_atoi (char *str);
float Q_atof (char *str);
//============================================================================
extern char com_token[1024];
extern qboolean com_eof;
char *COM_Parse (char *data);
extern int com_argc;
extern char **com_argv;
int COM_CheckParm (char *parm);
#ifdef QUAKEWORLD
void COM_AddParm (char *parm);
void COM_Init (void);
#else
void COM_Init (char *path);
#endif
void COM_InitArgv (int argc, char **argv);
char *COM_SkipPath (char *pathname);
void COM_StripExtension (char *in, char *out);
void COM_FileBase (char *in, char *out);
void COM_DefaultExtension (char *path, char *extension);
char *va(char *format, ...);
// does a varargs printf into a temp buffer
//============================================================================
extern int com_filesize;
struct cache_user_s;
extern char com_gamedir[MAX_OSPATH];
void COM_WriteFile (char *filename, void *data, int len);
int COM_OpenFile (char *filename, int *hndl);
int COM_FOpenFile (char *filename, FILE **file);
#ifdef QUAKEWORLD
void COM_CloseFile (FILE *h);
#else
void COM_CloseFile (int h);
#endif
byte *COM_LoadStackFile (char *path, void *buffer, int bufsize);
byte *COM_LoadTempFile (char *path);
byte *COM_LoadHunkFile (char *path);
void COM_LoadCacheFile (char *path, struct cache_user_s *cu);
void COM_CreatePath (char *path);
void COM_Gamedir (char *dir);
extern qboolean standard_quake, rogue, hipnotic;
char *Info_ValueForKey (char *s, char *key);
void Info_RemoveKey (char *s, char *key);
void Info_RemovePrefixedKeys (char *start, char prefix);
void Info_SetValueForKey (char *s, char *key, char *value, int maxsize);
void Info_SetValueForStarKey (char *s, char *key, char *value, int maxsize);
void Info_Print (char *s);
unsigned Com_BlockChecksum (void *buffer, int length);
void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned mapchecksum);
byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
#endif // _COMMON_H

View file

@ -44,6 +44,10 @@ void VID_UnlockBuffer (void);
#define VID_UnlockBuffer()
#endif
#include "qtypes.h"
#include "qstructs.h"
/*
#include "common.h"
#include "bspfile.h"
#include "vid.h"
@ -76,6 +80,7 @@ void VID_UnlockBuffer (void);
#include "cdaudio.h"
#include "cvars.h"
*/
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
@ -94,32 +99,6 @@ void VID_UnlockBuffer (void);
#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
# define vsnprintf _vsnprintf
#endif
#if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF)
#ifdef HAVE_VSNPRINTF
# define snprintf vsnprintf
#elif defined(HAVE__VSNPRINTF)
# define snprintf _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

View file

@ -22,6 +22,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cvar.c -- dynamic variable tracking
#include "qtypes.h"
#include "lib_replace.h"
#include "console.h"
#include "common.h"
#include "cmd.h"
#include "client.h"
#ifdef SERVERONLY
#include "qwsvdef.h"
#else

View file

@ -1,5 +1,7 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -19,6 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cvar.h
#ifndef _CVAR_H
#define _CVAR_H
#include "qtypes.h"
#include "qstructs.h"
/*
cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly
@ -52,16 +59,6 @@ Cvars are restricted from having the same names as commands to keep this
interface from being ambiguous.
*/
typedef struct cvar_s
{
char *name;
char *string;
qboolean archive; // set to true to cause it to be saved to vars.rc
qboolean server; // notifies players when changed
float value;
struct cvar_s *next;
} cvar_t;
void Cvar_RegisterVariable (cvar_t *variable);
// registers a cvar that allready has the name, string, and optionally the
// archive elements set.
@ -94,3 +91,4 @@ void Cvar_WriteVariables (FILE *f);
cvar_t *Cvar_FindVar (char *var_name);
extern cvar_t *cvar_vars;
#endif // _CVAR_H

View file

@ -25,4 +25,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern cvar_t gl_flashblend;
// From r_local.h
extern cvar_t r_draworder;
extern cvar_t r_speeds;
extern cvar_t r_timegraph;
extern cvar_t r_graphheight;
extern cvar_t r_clearcolor;
extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
extern cvar_t r_drawentities;
extern cvar_t r_aliasstats;
extern cvar_t r_dspeeds;
extern cvar_t r_drawflat;
extern cvar_t r_ambient;
extern cvar_t r_reportsurfout;
extern cvar_t r_maxsurfs;
extern cvar_t r_numsurfs;
extern cvar_t r_reportedgeout;
extern cvar_t r_maxedges;
extern cvar_t r_numedges;
#endif _CVARS_H

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
#include <cvar.h>
#define NUM_MIPS 4

View file

@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
#include <mathlib.h>
// TODO: put in span spilling to shrink list size
// !!! if this is changed, it must be changed in d_polysa.s too !!!

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
#include <mathlib.h>
#define SKY_SPAN_SHIFT 5
#define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT)

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
#include <mathlib.h>
static int sprite_height;
static int minindex, maxindex;

View file

@ -23,7 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// draw.c -- this is the only file outside the refresh that touches the
// vid buffer
#include "quakedef.h"
#include <qtypes.h>
#include <quakedef.h>
#include <wad.h>
#include <d_iface.h>
#include <sound.h>
typedef struct {
vrect_t rect;

View file

@ -23,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// draw.h -- these are the only functions outside the refresh allowed
// to touch the vid buffer
#include "qtypes.h"
#include "wad.h"
extern qpic_t *draw_disc; // also used on sbar
void Draw_Init (void);

View file

@ -23,8 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// draw.c -- this is the only file outside the refresh that touches the
// vid buffer
#include "qtypes.h"
#include "quakedef.h"
#include "cvar.h"
#include "wad.h"
#include "glquake.h"
#include "console.h"
#include "sbar.h"
extern unsigned char d_15to8table[65536];
extern cvar_t crosshair, cl_crossx, cl_crossy, crosshaircolor;

View file

@ -22,8 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// gl_mesh.c: triangle model functions
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "model.h"
#include "console.h"
#include "common.h"
#include "sys.h"
/*
=================================================================

View file

@ -21,8 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_efrag.c
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "model.h"
#include "console.h"
#include "mathlib.h"
mnode_t *r_pefragtopnode;

View file

@ -27,8 +27,13 @@
Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "mathlib.h"
#include "console.h"
#include "view.h"
#include "sound.h"
entity_t r_worldentity;

View file

@ -21,8 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_misc.c
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "cvar.h"
#include "console.h"
extern void R_InitBubble();

View file

@ -21,8 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_surf.c: surrface-related refresh code
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "mathlib.h"
int skytexturenum;

View file

@ -21,8 +21,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "cvar.h"
#include "console.h"
#include "sound.h"
#include "keys.h"
#include "menu.h"
#ifndef _EXPERIMENTAL_
# undef HAS_DGA

View file

@ -22,7 +22,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "sys.h"
#include "console.h"
#include "cvar.h"
#include "sound.h"
#include <stdio.h>
#include <stdlib.h>

View file

@ -21,9 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// view.c -- player eye positioning
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "r_local.h"
#include "glquake.h"
#include "view.h"
extern int onground;

View file

@ -6,7 +6,7 @@
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
Portions Copyright (C) 1999,2000 Nelson Rush.
Portions Copyright (C) 1999,2000 Nelson Rush.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -27,8 +27,10 @@ Portions Copyright (C) 1999,2000 Nelson Rush.
Boston, MA 02111-1307, USA
*/
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "mathlib.h"
extern model_t *loadmodel;

View file

@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <GL/glu.h>
#include "model.h"
#include "client.h"
#include "wad.h"
void GL_BeginRendering (int *x, int *y, int *width, int *height);
void GL_EndRendering (void);

View file

@ -1,209 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// disable data conversion warnings
#pragma warning(disable : 4244) // MIPS
#pragma warning(disable : 4136) // X86
#pragma warning(disable : 4051) // ALPHA
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
void GL_BeginRendering (int *x, int *y, int *width, int *height);
void GL_EndRendering (void);
// Function prototypes for the Texture Object Extension routines
typedef GLboolean (GLAPIENTRY *ARETEXRESFUNCPTR)(GLsizei, const GLuint *,
const GLboolean *);
typedef void (GLAPIENTRY *BINDTEXFUNCPTR)(GLenum, GLuint);
typedef void (GLAPIENTRY *DELTEXFUNCPTR)(GLsizei, const GLuint *);
typedef void (GLAPIENTRY *GENTEXFUNCPTR)(GLsizei, GLuint *);
typedef GLboolean (GLAPIENTRY *ISTEXFUNCPTR)(GLuint);
typedef void (GLAPIENTRY *PRIORTEXFUNCPTR)(GLsizei, const GLuint *,
const GLclampf *);
typedef void (GLAPIENTRY *TEXSUBIMAGEPTR)(int, int, int, int, int, int, int, int, void *);
extern BINDTEXFUNCPTR bindTexFunc;
extern DELTEXFUNCPTR delTexFunc;
extern TEXSUBIMAGEPTR TexSubImage2DFunc;
extern int texture_extension_number;
extern int texture_mode;
extern float gldepthmin, gldepthmax;
void GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap, qboolean alpha, qboolean modulate);
void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha, qboolean modulate);
int GL_LoadTexture (char *identifier, int width, int height, byte *data, int mipmap, int alpha, int modulate);
int GL_FindTexture (char *identifier);
typedef struct
{
float x, y, z;
float s, t;
float r, g, b;
} glvert_t;
extern glvert_t glv;
extern int glx, gly, glwidth, glheight;
extern PROC glArrayElementEXT;
extern PROC glColorPointerEXT;
extern PROC glTexturePointerEXT;
extern PROC glVertexPointerEXT;
// r_local.h -- private refresh defs
#define MAXALIASVERTS 2000 // TODO: tune this
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
// normalizing factor so player model works out to about
// 1 pixel per triangle
#define MAX_LBM_HEIGHT 480
#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
#define SKYSHIFT 7
#define SKYSIZE (1 << SKYSHIFT)
#define SKYMASK (SKYSIZE - 1)
#define BACKFACE_EPSILON 0.01
void R_TimeRefresh_f (void);
void R_ReadPointFile_f (void);
texture_t *R_TextureAnimation (texture_t *base);
typedef struct surfcache_s
{
struct surfcache_s *next;
struct surfcache_s **owner; // NULL is an empty chunk of memory
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
int dlight;
int size; // including header
unsigned width;
unsigned height; // DEBUG only needed for debug
float mipscale;
struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements
} surfcache_t;
typedef struct
{
pixel_t *surfdat; // destination for generated surface
int rowbytes; // destination logical width in bytes
msurface_t *surf; // description for surface to generate
fixed8_t lightadj[MAXLIGHTMAPS];
// adjust for lightmap levels for dynamic lighting
texture_t *texture; // corrected for animating textures
int surfmip; // mipmapped ratio of surface texels / world pixels
int surfwidth; // in mipmapped texels
int surfheight; // in mipmapped texels
} drawsurf_t;
typedef enum {
pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
} ptype_t;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
// driver-usable fields
vec3_t org;
float color;
// drivers never touch the following fields
struct particle_s *next;
vec3_t vel;
float ramp;
float die;
ptype_t type;
} particle_t;
//====================================================
extern entity_t r_worldentity;
extern qboolean r_cache_thrash; // compatability
extern vec3_t modelorg, r_entorigin;
extern entity_t *currententity;
extern int r_visframecount; // ??? what difs?
extern int r_framecount;
extern mplane_t frustum[4];
extern int c_brush_polys, c_alias_polys;
//
// view origin
//
extern vec3_t vup;
extern vec3_t vpn;
extern vec3_t vright;
extern vec3_t r_origin;
//
// screen size info
//
extern refdef_t r_refdef;
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
extern qboolean envmap;
extern int currenttexture;
extern int particletexture;
extern int playertextures;
extern int skytexturenum; // index in cl.loadmodel, not gl texture object
extern cvar_t r_drawentities;
extern cvar_t r_drawworld;
extern cvar_t r_drawviewmodel;
extern cvar_t r_speeds;
extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
extern cvar_t r_lightmap;
extern cvar_t r_shadows;
extern cvar_t r_dynamic;
extern cvar_t gl_clear;
extern cvar_t gl_cull;
extern cvar_t gl_poly;
extern cvar_t gl_texsort;
extern cvar_t gl_smoothmodels;
extern cvar_t gl_affinemodels;
extern cvar_t gl_fogblend;
extern cvar_t gl_polyblend;
extern cvar_t gl_keeptjunctions;
extern int gl_lightmap_format;
extern int gl_solid_format;
extern int gl_alpha_format;
void R_TranslatePlayerSkin (int playernum);
void GL_Bind (int texnum);

View file

@ -21,7 +21,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "keys.h"
#include "client.h"
#include "sys.h"
#include "console.h"
#include "cvar.h"
#include <stdio.h>
#include <stdlib.h>

View file

@ -21,6 +21,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "qtypes.h"
#include "keys.h"
#include "cmd.h"
#include "cvar.h"
#include "client.h"
#include "lib_replace.h"
#include "console.h"
#include "menu.h"
#include "screen.h"
#ifdef _WIN32
#include <windows.h>
#endif

324
common/lib_replace.c Normal file
View file

@ -0,0 +1,324 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// common.c -- misc functions used in client and server
#include <ctype.h>
/*
============================================================================
LIBRARY REPLACEMENT FUNCTIONS
============================================================================
*/
#if 0
void Q_memset (void *dest, int fill, int count)
{
int i;
if ( (((long)dest | count) & 3) == 0)
{
count >>= 2;
fill = fill | (fill<<8) | (fill<<16) | (fill<<24);
for (i=0 ; i<count ; i++)
((int *)dest)[i] = fill;
}
else
for (i=0 ; i<count ; i++)
((byte *)dest)[i] = fill;
}
void Q_memcpy (void *dest, void *src, int count)
{
int i;
if (( ( (long)dest | (long)src | count) & 3) == 0 )
{
count>>=2;
for (i=0 ; i<count ; i++)
((int *)dest)[i] = ((int *)src)[i];
}
else
for (i=0 ; i<count ; i++)
((byte *)dest)[i] = ((byte *)src)[i];
}
int Q_memcmp (void *m1, void *m2, int count)
{
while(count)
{
count--;
if (((byte *)m1)[count] != ((byte *)m2)[count])
return -1;
}
return 0;
}
void Q_strcpy (char *dest, char *src)
{
while (*src)
{
*dest++ = *src++;
}
*dest++ = 0;
}
void Q_strncpy (char *dest, char *src, int count)
{
while (*src && count--)
{
*dest++ = *src++;
}
if (count)
*dest++ = 0;
}
int Q_strlen (char *str)
{
int count;
count = 0;
while (str[count])
count++;
return count;
}
char *Q_strrchr(char *s, char c)
{
int len = Q_strlen(s);
s += len;
while (len--)
if (*--s == c) return s;
return 0;
}
void Q_strcat (char *dest, char *src)
{
dest += Q_strlen(dest);
Q_strcpy (dest, src);
}
int Q_strcmp (char *s1, char *s2)
{
while (1)
{
if (*s1 != *s2)
return -1; // strings not equal
if (!*s1)
return 0; // strings are equal
s1++;
s2++;
}
return -1;
}
int Q_strncmp (char *s1, char *s2, int count)
{
while (1)
{
if (!count--)
return 0;
if (*s1 != *s2)
return -1; // strings not equal
if (!*s1)
return 0; // strings are equal
s1++;
s2++;
}
return -1;
}
int Q_strncasecmp (char *s1, char *s2, int n)
{
int c1, c2;
while (1)
{
c1 = *s1++;
c2 = *s2++;
if (!n--)
return 0; // strings are equal until end point
if (c1 != c2)
{
if (c1 >= 'a' && c1 <= 'z')
c1 -= ('a' - 'A');
if (c2 >= 'a' && c2 <= 'z')
c2 -= ('a' - 'A');
if (c1 != c2)
return -1; // strings not equal
}
if (!c1)
return 0; // strings are equal
// s1++;
// s2++;
}
return -1;
}
int Q_strcasecmp (char *s1, char *s2)
{
return Q_strncasecmp (s1, s2, 99999);
}
#endif
int Q_atoi (char *str)
{
int val;
int sign;
int c;
if (*str == '-')
{
sign = -1;
str++;
}
else
sign = 1;
val = 0;
//
// check for hex
//
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X') )
{
str += 2;
while (1)
{
c = *str++;
if (c >= '0' && c <= '9')
val = (val<<4) + c - '0';
else if (c >= 'a' && c <= 'f')
val = (val<<4) + c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
val = (val<<4) + c - 'A' + 10;
else
return val*sign;
}
}
//
// check for character
//
if (str[0] == '\'')
{
return sign * str[1];
}
//
// assume decimal
//
while (1)
{
c = *str++;
if (c <'0' || c > '9')
return val*sign;
val = val*10 + c - '0';
}
return 0;
}
float Q_atof (char *str)
{
double val;
int sign;
int c;
int decimal, total;
if (*str == '-')
{
sign = -1;
str++;
}
else
sign = 1;
val = 0;
//
// check for hex
//
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X') )
{
str += 2;
while (1)
{
c = *str++;
if (c >= '0' && c <= '9')
val = (val*16) + c - '0';
else if (c >= 'a' && c <= 'f')
val = (val*16) + c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
val = (val*16) + c - 'A' + 10;
else
return val*sign;
}
}
//
// check for character
//
if (str[0] == '\'')
{
return sign * str[1];
}
//
// assume decimal
//
decimal = -1;
total = 0;
while (1)
{
c = *str++;
if (c == '.')
{
decimal = total;
continue;
}
if (c <'0' || c > '9')
break;
val = val*10 + c - '0';
total++;
}
if (decimal == -1)
return val*sign;
while (total > decimal)
{
val /= 10;
total--;
}
return val*sign;
}

55
common/lib_replace.h Normal file
View file

@ -0,0 +1,55 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// comndef.h -- general definitions
#ifndef _LIB_REPLACE_H
#define _LIB_REPLACE_H
//============================================================================
#define Q_memset(d, f, c) memset((d), (f), (c))
#define Q_memcpy(d, s, c) memcpy((d), (s), (c))
#define Q_memcmp(m1, m2, c) memcmp((m1), (m2), (c))
#define Q_strcpy(d, s) strcpy((d), (s))
#define Q_strncpy(d, s, n) strncpy((d), (s), (n))
#define Q_strlen(s) ((int)strlen(s))
#define Q_strrchr(s, c) strrchr((s), (c))
#define Q_strcat(d, s) strcat((d), (s))
#define Q_strcmp(s1, s2) strcmp((s1), (s2))
#define Q_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
#ifdef _WIN32
#define Q_strcasecmp(s1, s2) _stricmp((s1), (s2))
#define Q_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
#else
#define Q_strcasecmp(s1, s2) strcasecmp((s1), (s2))
#define Q_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
#endif
int Q_atoi (char *str);
float Q_atof (char *str);
#endif // _LIB_REPLACE_H

View file

@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// mathlib.c -- math primitives
#include <math.h>
#include "qtypes.h"
#include "quakedef.h"
#include "mathlib.h"
void Sys_Error (char *error, ...);
@ -34,7 +36,7 @@ int nanmask = 255<<23;
#define DEG2RAD( a ) ( a * M_PI ) / 180.0F
void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
static void ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal)
{
float d;
vec3_t n;
@ -56,7 +58,7 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
/*
** assumes "src" is normalized
*/
void PerpendicularVector( vec3_t dst, const vec3_t src )
static void PerpendicularVector( vec3_t dst, const vec3_t src )
{
int pos;
int i;

View file

@ -23,13 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _MATHLIB_H
#define _MATHLIB_H
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef vec_t vec5_t[5];
#include <stdio.h>
typedef int fixed4_t;
typedef int fixed8_t;
typedef int fixed16_t;
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
@ -38,7 +33,7 @@ typedef int fixed16_t;
struct mplane_s;
extern vec3_t vec3_origin;
extern int nanmask;
extern int nanmask;
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
@ -47,36 +42,28 @@ extern int nanmask;
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2);
void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorCopy (vec3_t in, vec3_t out);
int VectorCompare (vec3_t v1, vec3_t v2);
vec_t Length (vec3_t v);
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
float VectorNormalize (vec3_t v); // returns vector length
void VectorInverse (vec3_t v);
void VectorScale (vec3_t in, vec_t scale, vec3_t out);
int Q_log2(int val);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void FloorDivMod (double numer, double denom, int *quotient,
int *rem);
fixed16_t Invert24To16(fixed16_t val);
fixed16_t Mul16_30(fixed16_t multiplier, fixed16_t multiplicand);
int GreatestCommonDivisor (int i1, int i2);
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
float anglemod(float a);
void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees );
void BOPS_Error (void);
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
int VectorCompare (vec3_t v1, vec3_t v2);
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2);
void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out);
void _VectorCopy (vec3_t in, vec3_t out);
void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross);
vec_t Length (vec3_t v);
float VectorNormalize (vec3_t v); // returns vector length
void VectorInverse (vec3_t v);
void VectorScale (vec3_t in, vec_t scale, vec3_t out);
int Q_log2(int val);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
void FloorDivMod (double numer, double denom, int *quotient, int *rem);
int GreatestCommonDivisor (int i1, int i2);
fixed16_t Invert24To16(fixed16_t val);
#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
(((p)->type < 3)? \

View file

@ -23,9 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __MODEL__
#define __MODEL__
#include "qdefs.h"
#include "qtypes.h"
#include "bspfile.h"
#include "render.h"
#include "modelgen.h"
#include "spritegn.h"
#include "zone.h"
/*

View file

@ -29,6 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// * pass data from one to the other via model files. *
// *********************************************************
#ifndef _MODELGEN_H
#define _MODELGEN_H
#ifdef INCLUDELIBS
#include <stdlib.h>
@ -52,7 +55,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef SYNCTYPE_T
#define SYNCTYPE_T
typedef enum {ST_SYNC=0, ST_RAND } synctype_t;
#endif
#endif // SYNCTYPE_T
typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t;
@ -134,3 +137,4 @@ typedef struct {
#define IDPOLYHEADER (('O'<<24)+('P'<<16)+('D'<<8)+'I')
// little-endian "IDPO"
#endif // _MODELGEN_H

View file

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// net_ser.h
#ifndef _NET_SER_H
#define _NET_SER_H
int Serial_Init (void);
void Serial_Listen (qboolean state);
void Serial_SearchForHosts (qboolean xmit);
@ -31,3 +34,5 @@ qboolean Serial_CanSendMessage (qsocket_t *sock);
qboolean Serial_CanSendUnreliableMessage (qsocket_t *sock);
void Serial_Close (qsocket_t *sock);
void Serial_Shutdown (void);
#endif // _NET_SER_H

View file

@ -22,9 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// this file is shared by quake and qcc
typedef int func_t;
typedef int string_t;
typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;

111
common/qargs.c Normal file
View file

@ -0,0 +1,111 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// common.c -- misc functions used in client and server
#include <ctype.h>
#include <qtypes.h>
#include "common.h"
#include "crc.h"
#include "sys.h"
#include "cmd.h"
#include "console.h"
usercmd_t nullcmd; // guarenteed to be zero
static char *largv[MAX_NUM_ARGVS + NUM_SAFE_ARGVS + 1];
static char *argvdummy = " ";
static char *safeargvs[NUM_SAFE_ARGVS] =
{"-stdvid", "-nolan", "-nosound", "-nocdaudio", "-nojoy", "-nomouse"};
int com_argc;
char **com_argv;
/*
================
COM_CheckParm
Returns the position (1 to argc-1) in the program's argument list
where the given parameter apears, or 0 if not present
================
*/
int COM_CheckParm (char *parm)
{
int i;
for (i=1 ; i<com_argc ; i++)
{
if (!com_argv[i])
continue; // NEXTSTEP sometimes clears appkit vars.
if (!Q_strcmp (parm,com_argv[i]))
return i;
}
return 0;
}
/*
================
COM_InitArgv
================
*/
void COM_InitArgv (int argc, char **argv)
{
qboolean safe;
int i;
safe = false;
for (com_argc=0 ; (com_argc<MAX_NUM_ARGVS) && (com_argc < argc) ;
com_argc++)
{
largv[com_argc] = argv[com_argc];
if (!Q_strcmp ("-safe", argv[com_argc]))
safe = true;
}
if (safe)
{
// force all the safe-mode switches. Note that we reserved extra space in
// case we need to add these, so we don't need an overflow check
for (i=0 ; i<NUM_SAFE_ARGVS ; i++)
{
largv[com_argc] = safeargvs[i];
com_argc++;
}
}
largv[com_argc] = argvdummy;
com_argv = largv;
}
/*
================
COM_AddParm
Adds the given string at the end of the current argument list
================
*/
void COM_AddParm (char *parm)
{
largv[com_argc++] = parm;
}

38
common/qargs.h Normal file
View file

@ -0,0 +1,38 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// comndef.h -- general definitions
#ifndef _COMMON_H
#define _COMMON_H
#include "qtypes.h"
extern int com_argc;
extern char **com_argv;
int COM_CheckParm (char *parm);
void COM_AddParm (char *parm);
void COM_Init (void);
void COM_InitArgv (int argc, char **argv);
#endif // _COMMON_H

37
common/qdefs.h Normal file
View file

@ -0,0 +1,37 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 _QDEFS_H
#define _QDEFS_H
#include <stdio.h>
#include <sys/types.h>
#define MAX_QPATH 64
#define MAX_CL_STATS 32
#define NUM_CSHIFTS 4
#define MAX_MODELS 256
#define MAX_SOUNDS 256
#define MAX_SCOREBOARDNAME 32
#define MAX_NUM_ARGVS 50
#define NUM_SAFE_ARGVS 7
#endif // _QDEFS_H

95
common/qendian.c Normal file
View file

@ -0,0 +1,95 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// common.c -- misc functions used in client and server
#include <ctype.h>
#include "qtypes.h"
/*
============================================================================
BYTE ORDER FUNCTIONS
============================================================================
*/
short (*BigShort) (short l);
short (*LittleShort) (short l);
int (*BigLong) (int l);
int (*LittleLong) (int l);
float (*BigFloat) (float l);
float (*LittleFloat) (float l);
short ShortSwap (short l)
{
byte b1,b2;
b1 = l&255;
b2 = (l>>8)&255;
return (b1<<8) + b2;
}
short ShortNoSwap (short l)
{
return l;
}
int LongSwap (int l)
{
byte b1,b2,b3,b4;
b1 = l&255;
b2 = (l>>8)&255;
b3 = (l>>16)&255;
b4 = (l>>24)&255;
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
}
int LongNoSwap (int l)
{
return l;
}
float FloatSwap (float f)
{
union
{
float f;
byte b[4];
} dat1, dat2;
dat1.f = f;
dat2.b[0] = dat1.b[3];
dat2.b[1] = dat1.b[2];
dat2.b[2] = dat1.b[1];
dat2.b[3] = dat1.b[0];
return dat2.f;
}
float FloatNoSwap (float f)
{
return f;
}

62
common/qendian.h Normal file
View file

@ -0,0 +1,62 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// comndef.h -- general definitions
#ifndef _QENDIAN_H
#define _QENDIAN_H
#ifndef NULL
#define NULL ((void *)0)
#endif
#define Q_MAXCHAR ((char)0x7f)
#define Q_MAXSHORT ((short)0x7fff)
#define Q_MAXINT ((int)0x7fffffff)
#define Q_MAXLONG ((int)0x7fffffff)
#define Q_MAXFLOAT ((int)0x7fffffff)
#define Q_MINCHAR ((char)0x80)
#define Q_MINSHORT ((short)0x8000)
#define Q_MININT ((int)0x80000000)
#define Q_MINLONG ((int)0x80000000)
#define Q_MINFLOAT ((int)0x7fffffff)
//============================================================================
extern short (*BigShort) (short l);
extern short (*LittleShort) (short l);
extern int (*BigLong) (int l);
extern int (*LittleLong) (int l);
extern float (*BigFloat) (float l);
extern float (*LittleFloat) (float l);
short ShortSwap (short l);
short ShortNoSwap (short l);
int LongSwap (int l);
int LongNoSwap (int l);
float FloatSwap (float f);
float FloatNoSwap (float f);
//============================================================================
#endif // _QENDIAN_H

180
common/qstructs.h Normal file
View file

@ -0,0 +1,180 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 _QSTRUCTS_H
#define _QSTRUCTS_H
#include <stdio.h>
#include <sys/types.h>
#include <qtypes.h>
#include <render.h>
//=============================================================================
// 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;
//=============================================================================
typedef struct cvar_s
{
char *name;
char *string;
qboolean archive; // set to true to cause it to be saved to vars.rc
qboolean info; // added to serverinfo or userinfo when changed
float value;
struct cvar_s *next;
} cvar_t;
typedef struct
{
int destcolor[3];
int percent; // 0-256
} cshift_t;
#if defined(QUAKEWORLD) || defined(UQUAKE)
#include "client.h"
#endif
//
// the client_state_t structure is wiped completely at every
// server signon
//
typedef struct
{
int movemessages; // since connecting to this server
// throw out the first couple, so the player
// doesn't accidentally do something the
// first frame
// information for local display
int stats[MAX_CL_STATS]; // health, etc
float item_gettime[32]; //cl.time of aquiring item, for blinking
float faceanimtime; // use anim frame if cl.time < this
cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
// the client maintains its own idea of view angles, which are
// sent to the server each frame. And only reset at level change
// and teleport times
vec3_t viewangles;
// the client simulates or interpolates movement to get these values
double time; // this is the time value that the client
// is rendering at. allways <= realtime
// pitch drifting vars
float pitchvel;
qboolean nodrift;
float driftmove;
double laststop;
qboolean paused; // send over by server
int completed_time; // latched at intermission start
float punchangle; // temporar yview kick from weapon firing
int intermission; // don't change view angle, full screen, etc
//
// information that is static for the entire time connected to a server
//
struct model_s *model_precache[MAX_MODELS];
struct sfx_s *sound_precache[MAX_SOUNDS];
char levelname[40]; // for display on solo scoreboard
// refresh related state
struct model_s *worldmodel; // cl_entitites[0].model
struct efrag_s *free_efrags;
int num_statics; // held in cl_staticentities array
int cdtrack; // cd audio
entity_t viewent; // weapon model
int playernum;
#ifdef QUAKEWORLD
// QW specific!
// all player information
player_info_t players[MAX_CLIENTS];
int servercount; // server identification for prespawns
char serverinfo[MAX_SERVERINFO_STRING];
int parsecount; // server message counter
int validsequence; // this is the sequence number of the last good
// packetentity_t we got. If this is 0, we can't
// render a frame yet
int spectator;
double last_ping_request; // while showing scoreboard
frame_t frames[UPDATE_BACKUP];
vec3_t simorg;
vec3_t simvel;
vec3_t simangles;
//
// information that is static for the entire time connected to a server
//
char model_name[MAX_MODELS][MAX_QPATH];
char sound_name[MAX_SOUNDS][MAX_QPATH];
#elif defined(UQUAKE)
// UQ specific.
int num_entities; // held in cl_entities array
float last_received_message; // (realtime) for net trouble icon
double mtime[2]; // the timestamp of last two messages
double oldtime; // previous cl.time, time-oldtime is used
// to decay light values and smooth step ups
qboolean onground;
float viewheight;
float idealpitch;
int maxclients;
int gametype;
// frag scoreboard
scoreboard_t *scores; // [cl.maxclients]
usercmd_t cmd; // last command sent to the server
int items; // inventory bit flags
vec3_t mviewangles[2]; // during demo playback viewangles is lerped
// between these
vec3_t mvelocity[2]; // update by server, used for lean+bob
// (0 is newest)
vec3_t velocity; // lerped between mvelocity[0] and [1]
#endif
} client_state_t;
extern client_state_t cl;
#endif // _QSTRUCTS_H

61
common/qtypes.h Normal file
View file

@ -0,0 +1,61 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 _QTYPES_H
#define _QTYPES_H
#include <stdio.h>
#include <sys/types.h>
#include <qdefs.h>
#define MAX_QPATH 64
typedef unsigned char byte;
typedef enum {false, true} qboolean;
// From mathlib...
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef vec_t vec5_t[5];
typedef int fixed4_t;
typedef int fixed8_t;
typedef int fixed16_t;
typedef int func_t;
typedef int string_t;
typedef byte pixel_t;
/*
typedef enum {key_game, key_console, key_message, key_menu} keydest_t;
typedef enum { ALIAS_SINGLE=0, ALIAS_GROUP } aliasframetype_t;
typedef enum { ALIAS_SKIN_SINGLE=0, ALIAS_SKIN_GROUP } aliasskintype_t;
typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
typedef void (*builtin_t) (void);
typedef enum {touchessolid, drawnode, nodrawnode} solidstate_t;
typedef enum { ST_SYNC=0, ST_RAND } synctype_t;
typedef enum { SPR_SINGLE=0, SPR_GROUP } spriteframetype_t;
typedef enum {MS_WINDOWED, MS_FULLSCREEN, MS_FULLDIB, MS_UNINIT} modestate_t;
typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
*/
#endif // _QTYPES_H

771
common/quakefs.c Normal file
View file

@ -0,0 +1,771 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// common.c -- misc functions used in client and server
#include <ctype.h>
#include "qtypes.h"
#include "quakefs.h"
#include "sys.h"
#include "console.h"
#include "common_quakedef.h"
#include "zone.h"
#include "common.h"
#include "draw.h"
/*
All of Quake's data access is through a hierchal file system, but the contents of the file system can be transparently merged from several sources.
The "base directory" is the path to the directory holding the quake.exe and all game directories. The sys_* files pass this to host_init in quakeparms_t->basedir. This can be overridden with the "-basedir" command line parm to allow code debugging in a different directory. The base directory is
only used during filesystem initialization.
The "game directory" is the first tree on the search path and directory that all generated files (savegames, screenshots, demos, config files) will be saved to. This can be overridden with the "-game" command line parameter. The game directory can never be changed while quake is executing. This is a precacution against having a malicious server instruct clients to write files over areas they shouldn't.
The "cache directory" is only used during development to save network bandwidth, especially over ISDN / T1 lines. If there is a cache directory
specified, when a file is found by the normal search path, it will be mirrored
into the cache directory, then opened there.
*/
/*
=============================================================================
QUAKE FILESYSTEM
=============================================================================
*/
/* Begin Generations */
#ifdef _EXPERIMENTAL_
#include "unzip.h"
#endif
typedef unsigned char byte_t;
char gamedirfile[MAX_OSPATH];
#ifndef _AIX
typedef unsigned int uint_t;
typedef unsigned short ushort_t;
#endif
/* End Generations */
int com_filesize;
//
// in memory
//
typedef struct
{
char name[MAX_QPATH];
int filepos, filelen;
} packfile_t;
typedef struct pack_s
{
char filename[MAX_OSPATH];
FILE *handle;
int numfiles;
packfile_t *files;
} pack_t;
//
// on disk
//
typedef struct
{
char name[56];
int filepos, filelen;
} dpackfile_t;
typedef struct
{
char id[4];
int dirofs;
int dirlen;
} dpackheader_t;
#define MAX_FILES_IN_PACK 2048
char com_gamedir[MAX_OSPATH];
char com_basedir[MAX_OSPATH];
typedef struct searchpath_s
{
char filename[MAX_OSPATH];
pack_t *pack; // only one of filename / pack will be used
struct searchpath_s *next;
} searchpath_t;
searchpath_t *com_searchpaths;
searchpath_t *com_base_searchpaths; // without gamedirs
/*
================
COM_filelength
================
*/
int COM_filelength (FILE *f)
{
int pos;
int end;
pos = ftell (f);
fseek (f, 0, SEEK_END);
end = ftell (f);
fseek (f, pos, SEEK_SET);
return end;
}
int COM_FileOpenRead (char *path, FILE **hndl)
{
FILE *f;
f = fopen(path, "rb");
if (!f)
{
*hndl = NULL;
return -1;
}
*hndl = f;
return COM_filelength(f);
}
/*
============
COM_Path_f
============
*/
void COM_Path_f (void)
{
searchpath_t *s;
Con_Printf ("Current search path:\n");
for (s=com_searchpaths ; s ; s=s->next)
{
if (s == com_base_searchpaths)
Con_Printf ("----------\n");
if (s->pack)
Con_Printf ("%s (%i files)\n", s->pack->filename, s->pack->numfiles);
else
Con_Printf ("%s\n", s->filename);
}
}
/*
============
COM_WriteFile
The filename will be prefixed by the current game directory
============
*/
void COM_WriteFile (char *filename, void *data, int len)
{
FILE *f;
char name[MAX_OSPATH];
snprintf(name, sizeof(name), "%s/%s", com_gamedir, filename);
f = fopen (name, "wb");
if (!f) {
Sys_mkdir(com_gamedir);
f = fopen (name, "wb");
if (!f)
Sys_Error ("Error opening %s", filename);
}
Sys_Printf ("COM_WriteFile: %s\n", name);
fwrite (data, 1, len, f);
fclose (f);
}
/*
============
COM_CreatePath
Only used for CopyFile and download
============
*/
void COM_CreatePath (char *path)
{
char *ofs;
for (ofs = path+1 ; *ofs ; ofs++)
{
if (*ofs == '/')
{ // create the directory
*ofs = 0;
Sys_mkdir (path);
*ofs = '/';
}
}
}
/*
===========
COM_CopyFile
Copies a file over from the net to the local cache, creating any directories
needed. This is for the convenience of developers using ISDN from home.
===========
*/
void COM_CopyFile (char *netpath, char *cachepath)
{
FILE *in, *out;
int remaining, count;
char buf[4096];
remaining = COM_FileOpenRead (netpath, &in);
COM_CreatePath (cachepath); // create directories up to the cache file
out = fopen(cachepath, "wb");
if (!out)
Sys_Error ("Error opening %s", cachepath);
while (remaining)
{
if (remaining < sizeof(buf))
count = remaining;
else
count = sizeof(buf);
fread (buf, 1, count, in);
fwrite (buf, 1, count, out);
remaining -= count;
}
fclose (in);
fclose (out);
}
/*
===========
COM_FindFile
Finds the file in the search path.
Sets com_filesize and one of handle or file
===========
*/
int file_from_pak; // global indicating file came from pack file ZOID
int COM_FOpenFile (char *filename, FILE **file)
{
searchpath_t *search;
char netpath[MAX_OSPATH];
pack_t *pak;
int i;
int findtime;
file_from_pak = 0;
//
// search through the path, one element at a time
//
for (search = com_searchpaths ; search ; search = search->next)
{
// is the element a pak file?
if (search->pack)
{
// look through all the pak file elements
pak = search->pack;
for (i=0 ; i<pak->numfiles ; i++)
if (!strcmp (pak->files[i].name, filename))
{ // found it!
if(developer.value)
Sys_Printf ("PackFile: %s : %s\n",pak->filename, filename);
// open a new file on the pakfile
*file = fopen (pak->filename, "rb");
if (!*file)
Sys_Error ("Couldn't reopen %s", pak->filename);
fseek (*file, pak->files[i].filepos, SEEK_SET);
com_filesize = pak->files[i].filelen;
file_from_pak = 1;
return com_filesize;
}
}
else
{
// check a file in the directory tree
snprintf(netpath, sizeof(netpath), "%s/%s",search->filename, filename);
findtime = Sys_FileTime (netpath);
if (findtime == -1)
continue;
if(developer.value)
Sys_Printf ("FindFile: %s\n",netpath);
*file = fopen (netpath, "rb");
return COM_filelength (*file);
}
}
Sys_Printf ("FindFile: can't find %s\n", filename);
*file = NULL;
com_filesize = -1;
return -1;
}
/*
============
COM_LoadFile
Filename are reletive to the quake directory.
Allways appends a 0 byte to the loaded data.
============
*/
cache_user_t *loadcache;
byte *loadbuf;
int loadsize;
byte *COM_LoadFile (char *path, int usehunk)
{
FILE *h;
byte *buf;
char base[32];
int len;
buf = NULL; // quiet compiler warning
// look for it in the filesystem or pack files
len = com_filesize = COM_FOpenFile (path, &h);
if (!h)
return NULL;
// extract the filename base name for hunk tag
COM_FileBase (path, base);
if (usehunk == 1)
buf = Hunk_AllocName (len+1, base);
else if (usehunk == 2)
buf = Hunk_TempAlloc (len+1);
else if (usehunk == 0)
buf = Z_Malloc (len+1);
else if (usehunk == 3)
buf = Cache_Alloc (loadcache, len+1, base);
else if (usehunk == 4)
{
if (len+1 > loadsize)
buf = Hunk_TempAlloc (len+1);
else
buf = loadbuf;
}
else
Sys_Error ("COM_LoadFile: bad usehunk");
if (!buf)
Sys_Error ("COM_LoadFile: not enough space for %s", path);
((byte *)buf)[len] = 0;
#ifndef SERVERONLY
Draw_BeginDisc ();
#endif
fread (buf, 1, len, h);
fclose (h);
#ifndef SERVERONLY
Draw_EndDisc ();
#endif
return buf;
}
byte *COM_LoadHunkFile (char *path)
{
return COM_LoadFile (path, 1);
}
byte *COM_LoadTempFile (char *path)
{
return COM_LoadFile (path, 2);
}
void COM_LoadCacheFile (char *path, struct cache_user_s *cu)
{
loadcache = cu;
COM_LoadFile (path, 3);
}
// uses temp hunk if larger than bufsize
byte *COM_LoadStackFile (char *path, void *buffer, int bufsize)
{
byte *buf;
loadbuf = (byte *)buffer;
loadsize = bufsize;
buf = COM_LoadFile (path, 4);
return buf;
}
/*
=================
COM_LoadPackFile
Takes an explicit (not game tree related) path to a pak file.
Loads the header and directory, adding the files at the beginning
of the list so they override previous pack files.
=================
*/
pack_t *COM_LoadPackFile (char *packfile)
{
dpackheader_t header;
int i;
packfile_t *newfiles;
int numpackfiles;
pack_t *pack;
FILE *packhandle;
dpackfile_t info[MAX_FILES_IN_PACK];
if (COM_FileOpenRead (packfile, &packhandle) == -1)
return NULL;
fread (&header, 1, sizeof(header), packhandle);
if (header.id[0] != 'P' || header.id[1] != 'A'
|| header.id[2] != 'C' || header.id[3] != 'K')
Sys_Error ("%s is not a packfile", packfile);
header.dirofs = LittleLong (header.dirofs);
header.dirlen = LittleLong (header.dirlen);
numpackfiles = header.dirlen / sizeof(dpackfile_t);
if (numpackfiles > MAX_FILES_IN_PACK)
Sys_Error ("%s has %i files", packfile, numpackfiles);
newfiles = Z_Malloc (numpackfiles * sizeof(packfile_t));
fseek (packhandle, header.dirofs, SEEK_SET);
fread (info, 1, header.dirlen, packhandle);
// parse the directory
for (i=0 ; i<numpackfiles ; i++)
{
strcpy (newfiles[i].name, info[i].name);
newfiles[i].filepos = LittleLong(info[i].filepos);
newfiles[i].filelen = LittleLong(info[i].filelen);
}
pack = Z_Malloc (sizeof (pack_t));
strcpy (pack->filename, packfile);
pack->handle = packhandle;
pack->numfiles = numpackfiles;
pack->files = newfiles;
Con_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles);
return pack;
}
#ifdef _EXPERIMENTAL_
int
COM_pak3_checkfile(unzFile *pak, const char *path)
{
int status;
status = unzLocateFile(pak, path, 2);
return (status == UNZ_OK);
}
void
COM_pak3_closepak(unzFile *pak)
{
if (pak)
unzClose(pak);
pak = NULL;
}
void
COM_pak3_close(unzFile *pak)
{
unzCloseCurrentFile(pak);
}
int
COM_pak3_read(unzFile *pak, void *buf, uint_t size, uint_t nmemb)
{
int len;
len = unzReadCurrentFile(pak, buf, size * nmemb);
return len / size;
}
int
COM_pak3_open(unzFile *pak, const char *path)
{
if (unzLocateFile(pak, path, 2) != UNZ_OK)
return 0;
if (unzOpenCurrentFile(pak) != UNZ_OK)
return 0;
return 1;
}
uint_t
COM_pak3_getlen(unzFile *pak)
{
unz_file_info info;
if (unzGetCurrentFileInfo(pak, &info, NULL, 0, NULL, 0, NULL, 0)
!= UNZ_OK)
return 0;
return info.uncompressed_size;
}
uint_t
COM_pak3_readfile(unzFile *pak, const char *path, uint_t bufsize, byte_t *buf)
{
uint_t len;
if (!COM_pak3_open(pak,path))
return 0;
if ((len = COM_pak3_getlen(pak)) != 0)
{
if (COM_pak3_read(pak, (void*)buf, 1, len) != len)
len = 0;
}
COM_pak3_close(pak);
return len;
}
#endif
// Todo: Make This work! :)
#if defined _EXPERIMENTAL_ && GENERATIONS
pack_t *COM_LoadQ3PackFile (char *packfile)
{
int i;
packfile_t *newfiles;
float numpackfiles;
unzFile *pak;
pack_t *pack_old;
int status;
// int packhandle;
dpackfile_t info[MAX_FILES_IN_PACK];
// unz_file_info fileInfo;
char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
// int err;
pak = unzOpen(packfile);
// numpackfiles = header.dirlen / sizeof(dpackfile_t);
// numpackfiles = COM_pak3_getlen(*pak)/sizeof(unzFile);
numpackfiles = 0;
//= COM_pak3_getlen(pak)/sizeof(unzFile);
Con_Printf ("Assigned Numpackfiles\n");
if (!pak)
return NULL;
newfiles = Hunk_AllocName (numpackfiles * sizeof(unzFile), "packfile");
status=unzGoToFirstFile(pak);
while(status == UNZ_OK) {
unzGetCurrentFileInfo(pak,NULL,&szCurrentFileName,64,NULL,0,NULL,0);
if(strcmp(newfiles[i].name, szCurrentFileName)==0)
break;
strcpy (newfiles[i].name, szCurrentFileName);
Con_Printf ("strcpy'ed %s into newfiles[%i].name Ok\n",szCurrentFileName, i);
newfiles[i].filepos = LittleLong(unztell(pak));
// newfiles[i].filelen = LittleLong(COM_pak3_readfile(pak,packfile,64,64));
Con_Printf ("Added File\n");
status=unzGoToNextFile(pak);
++numpackfiles;
++i;
}
Con_Printf ("Added files in %s to game data Ok\n", packfile);
pack_old = Hunk_Alloc (sizeof (pack_t));
strcpy (pack_old->filename, packfile);
//pack_old->handle = unzGetLocalExtrafield(packfile, NULL, NULL);
pack_old->numfiles = numpackfiles;
pack_old->files = newfiles;
Con_Printf ("Added packfile %s (%.0f files)\n", packfile, numpackfiles);
COM_pak3_close(pak);
return pack_old;
}
#endif
/*
================
COM_AddGameDirectory
Sets com_gamedir, adds the directory to the head of the path,
then loads and adds pak1.pak pak2.pak ...
================
*/
void COM_AddGameDirectory (char *dir)
{
int i;
searchpath_t *search;
pack_t *pak;
char pakfile[MAX_OSPATH];
char *p;
if ((p = strrchr(dir, '/')) != NULL)
strcpy(gamedirfile, ++p);
else
strcpy(gamedirfile, dir);
strcpy (com_gamedir, dir);
//
// add the directory to the search path
//
search = Hunk_Alloc (sizeof(searchpath_t));
strcpy (search->filename, dir);
search->next = com_searchpaths;
com_searchpaths = search;
//
// add any pak files in the format pak0.pak pak1.pak, ...
//
for (i=0 ; ; i++)
{
snprintf(pakfile, sizeof(pakfile), "%s/pak%i.pak", dir, i);
pak = COM_LoadPackFile (pakfile);
if (!pak)
break;
search = Hunk_Alloc (sizeof(searchpath_t));
search->pack = pak;
search->next = com_searchpaths;
com_searchpaths = search;
}
}
/*
================
COM_Gamedir
Sets the gamedir and path to a different directory.
================
*/
void COM_Gamedir (char *dir)
{
searchpath_t *search, *next;
int i;
pack_t *pak;
char pakfile[MAX_OSPATH];
if (strstr(dir, "..") || strstr(dir, "/")
|| strstr(dir, "\\") || strstr(dir, ":") )
{
Con_Printf ("Gamedir should be a single filename, not a path\n");
return;
}
if (!strcmp(gamedirfile, dir))
return; // still the same
strcpy (gamedirfile, dir);
//
// free up any current game dir info
//
while (com_searchpaths != com_base_searchpaths)
{
if (com_searchpaths->pack)
{
fclose (com_searchpaths->pack->handle);
Z_Free (com_searchpaths->pack->files);
Z_Free (com_searchpaths->pack);
}
next = com_searchpaths->next;
Z_Free (com_searchpaths);
com_searchpaths = next;
}
//
// flush all data, so it will be forced to reload
//
Cache_Flush ();
if (!strcmp(dir, GAMENAME) || !strcmp(dir, "qw"))
return;
snprintf(com_gamedir, sizeof(com_gamedir), "%s/%s", com_basedir, dir);
//
// add the directory to the search path
//
search = Z_Malloc (sizeof(searchpath_t));
strcpy (search->filename, com_gamedir);
search->next = com_searchpaths;
com_searchpaths = search;
//
// add any pak files in the format pak0.pak pak1.pak, ...
//
for (i=0 ; ; i++)
{
snprintf(pakfile, sizeof(pakfile), "%s/pak%i.pak", com_gamedir, i);
pak = COM_LoadPackFile (pakfile);
if (!pak)
break;
search = Z_Malloc (sizeof(searchpath_t));
search->pack = pak;
search->next = com_searchpaths;
com_searchpaths = search;
}
}
/*
================
COM_InitFilesystem
================
*/
void COM_InitFilesystem (void)
{
int i;
//
// -basedir <path>
// Overrides the system supplied base directory
//
i = COM_CheckParm ("-basedir");
if (i && i < com_argc-1)
strcpy (com_basedir, com_argv[i+1]);
else
strcpy (com_basedir, host_parms.basedir);
//
// start up with GAMENAME by default
//
COM_AddGameDirectory (va("%s/" GAMENAME, com_basedir) );
COM_AddGameDirectory (va("%s/qw", com_basedir) );
// any set gamedirs will be freed up to here
com_base_searchpaths = com_searchpaths;
}

48
common/quakefs.h Normal file
View file

@ -0,0 +1,48 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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.
*/
// comndef.h -- general definitions
#ifndef _QUAKEFS_H
#define _QUAKEFS_H
//============================================================================
#define MAX_OSPATH 128 // max length of a filesystem pathname
extern int com_filesize;
struct cache_user_s;
extern char com_gamedir[MAX_OSPATH];
void COM_WriteFile (char *filename, void *data, int len);
int COM_FOpenFile (char *filename, FILE **file);
void COM_CloseFile (FILE *h);
byte *COM_LoadStackFile (char *path, void *buffer, int bufsize);
byte *COM_LoadTempFile (char *path);
byte *COM_LoadHunkFile (char *path);
void COM_LoadCacheFile (char *path, struct cache_user_s *cu);
void COM_CreatePath (char *path);
void COM_Gamedir (char *dir);
#endif // _QUAKEFS_H

View file

@ -23,8 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h" // FIXME: shouldn't be needed (is needed for patch
// right now, but that should move)
#include <mathlib.h>
#define LIGHT_MIN 5 // lowest light value we'll allow, to avoid the
// need for inner-loop light clamping

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <mathlib.h>
//
// current entity info

View file

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h" // FIXME: shouldn't need to include this
#include <mathlib.h>
#define MAXLEFTCLIPEDGES 100

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <mathlib.h>
int r_dlightframecount;

View file

@ -55,24 +55,6 @@ typedef struct {
//===========================================================================
extern cvar_t r_draworder;
extern cvar_t r_speeds;
extern cvar_t r_timegraph;
extern cvar_t r_graphheight;
extern cvar_t r_clearcolor;
extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
extern cvar_t r_drawentities;
extern cvar_t r_aliasstats;
extern cvar_t r_dspeeds;
extern cvar_t r_drawflat;
extern cvar_t r_ambient;
extern cvar_t r_reportsurfout;
extern cvar_t r_maxsurfs;
extern cvar_t r_numsurfs;
extern cvar_t r_reportedgeout;
extern cvar_t r_maxedges;
extern cvar_t r_numedges;
#define XCENTERING (1.0 / 2.0)
#define YCENTERING (1.0 / 2.0)

View file

@ -23,6 +23,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <cvar.h>
#include <mathlib.h>
#include <screen.h>
#include <view.h>
#include <sound.h>
//#define PASSAGES

View file

@ -27,6 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _R_SHARED_H_
#define _R_SHARED_H_
#include "qtypes.h"
#include "d_iface.h"
#define MAXVERTS 16 // max points in a surface polygon
#define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate
// polygon (while processing)

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
#include <mathlib.h>
int iskyspeed = 8;

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <mathlib.h>
#include <cvars.h>
drawsurf_t r_drawsurf;

View file

@ -29,6 +29,8 @@
Boston, MA 02111-1307, USA
*/
#include "cvar.h"
#include "quakefs.h"
#include "quakedef.h"
cvar_t registered = {"registered", "0"};
@ -50,7 +52,6 @@ register_check ( void ) {
if (h) {
Cvar_Set ("registered", "1");
Con_Printf ("Playing registered version.\n");
fclose (h);
fclose (h);
}
}

View file

@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _RENDER_H
#define _RENDER_H
#include "qtypes.h"
#include "vid.h"
#include "model.h"
// refresh.h -- public interface to refresh functions
@ -43,6 +43,21 @@ typedef struct efrag_s
struct efrag_s *entnext;
} efrag_t;
// entity_state_t is the information conveyed from the server
// in an update message
typedef struct
{
int number; // edict index
int flags; // nolerp, etc
vec3_t origin;
vec3_t angles;
int modelindex;
int frame;
int colormap;
int skinnum;
int effects;
} entity_state_t;
typedef struct entity_s
{

View file

@ -23,6 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// sbar.c -- status bar code
#include "quakedef.h"
#include "qtypes.h"
#include "wad.h"
#include "common.h"
#include "client.h"
#include "draw.h"
#include "sbar.h"
#include "screen.h"
int sb_updates; // if >= vid.numpages, no update needed

View file

@ -21,7 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "cvar.h"
#include "client.h"
#include "console.h"
cvar_t baseskin = {"baseskin", "base"};
cvar_t noskins = {"noskins", "0"};

View file

@ -21,8 +21,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// snd_dma.c -- main control for any streaming sound output device
#include "quakedef.h"
#include <string.h>
#include <stdlib.h>
#include "qtypes.h"
#include "sound.h"
#include "mathlib.h"
#include "model.h"
#include "lib_replace.h"
#include "cvar.h"
#include "cmd.h"
#include "sys.h"
#include "common_quakedef.h"
#include "qargs.h"
#ifdef _WIN32
#include "winquake.h"
@ -36,9 +46,7 @@ void S_StopAllSounds(qboolean clear);
void S_StopAllSoundsC(void);
// QuakeWorld hack
#ifdef QUAKEWORLD
#define viewentity playernum+1
#endif // QUAKEWORLD
// =======================================================================
// Internal sound data & structures

View file

@ -21,7 +21,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// snd_mem.c: sound caching
#include "quakedef.h"
#include "qtypes.h"
#include "sound.h"
#include "qendian.h"
#include "lib_replace.h"
#include "string.h"
#include "quakefs.h"
#include "sys.h"
int cache_full_cycle;

View file

@ -21,7 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// snd_mix.c -- portable code to mix sounds for snd_dma.c
#include "quakedef.h"
#include "config.h"
#include "qtypes.h"
#include "sound.h"
#include "lib_replace.h"
#ifdef _WIN32
#include "winquake.h"

View file

@ -22,7 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// snd_null.c -- include this instead of all the other snd_* files to have
// no sound code whatsoever
#include "quakedef.h"
//#include "config.h"
//#include "common_quakedef.h"
#include "qtypes.h"
#include "sound.h"
// =======================================================================
// Various variables also defined in snd_dma.c

View file

@ -19,7 +19,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "config.h"
#include "qtypes.h"
#include "sound.h"
#include "qargs.h"
#include <stdio.h>
#include <stdlib.h>

View file

@ -24,6 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __SOUND__
#define __SOUND__
#include <qtypes.h>
#include <qstructs.h>
#include <qdefs.h>
#include <zone.h>
#define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0

View file

@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "r_local.h"
#include "d_iface.h"
#include "glquake.h"
#include <mathlib.h>
extern particle_t *active_particles, *free_particles;
extern int ramp1[8], ramp2[8], ramp3[8];

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <view.h>
#include <mathlib.h>
extern int onground;

View file

@ -43,6 +43,9 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include "qtypes.h"
#include "sys.h"
#include "common.h"
#ifndef QUAKEWORLD
qboolean isDedicated;

View file

@ -28,8 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VID_GRADES (1 << VID_CBITS)
// a pixel can be one, two, or four bytes
typedef byte pixel_t;
typedef struct vrect_s
{
int x,y,width,height;

View file

@ -31,6 +31,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
#include <sound.h>
#include <keys.h>
#include <cvar.h>
#include <menu.h>
viddef_t vid; // global video state
unsigned short d_8to16table[256];

View file

@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
#include <sound.h>
#include <cvar.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H

View file

@ -45,6 +45,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
#include <sound.h>
#include <keys.h>
#include <cvar.h>
#include <menu.h>
cvar_t _windowed_mouse = {"_windowed_mouse","0", true};
cvar_t m_filter = {"m_filter","0", true};

View file

@ -21,7 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// wad.c
#include "qtypes.h"
#include "quakedef.h"
#include "wad.h"
#include "quakefs.h"
#include "qendian.h"
#include "sys.h"
int wad_numlumps;
lumpinfo_t *wad_lumps;

View file

@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// wad.h
#ifndef _WAD_H
#define _WAD_H
//===============
// TYPES
//===============
@ -75,3 +78,5 @@ void *W_GetLumpName (char *name);
void *W_GetLumpNum (int num);
void SwapPic (qpic_t *pic);
#endif // _WAD_H

View file

@ -21,7 +21,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Z_zone.c
#include "qtypes.h"
#include "quakedef.h"
#include "sys.h"
#include "lib_replace.h"
#include "common.h"
#include "console.h"
#include "cmd.h"
//#define DYNAMIC_SIZE 0xc000
#define DYNAMIC_SIZE 0x20000

View file

@ -3,7 +3,7 @@ AC_PREREQ(2.13)
AC_INIT(common/crc.h)
dnl Version of this release
QF_VERSION=0.1-pre
QF_VERSION=0.1.1-devel
VERSION=2.40
AC_DEFINE_UNQUOTED(QF_VERSION,"$QF_VERSION")
AC_DEFINE_UNQUOTED(VERSION,"$VERSION")
@ -495,11 +495,11 @@ esac
dnl Check for sound libraries
AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes)
SND_LIBS=""
SND_STYLE=""
SOUND_LIBS=""
SOUND_STYLE=""
AC_MSG_CHECKING(for sound support)
if test "x$enable_alsa" = "xyes"; then
if test -z "$SND_STYLE" -a "x$ac_cv_header_sys_asoundlib_h" = "xyes"; then
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_sys_asoundlib_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <sys/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
@ -507,55 +507,55 @@ if test "x$enable_alsa" = "xyes"; then
QF_maGiC_VALUE
#endif
#endif
],[ SND_STYLE="ALSA" SND_LIBS="-lasound"])
],[ SOUND_STYLE="ALSA" SOUND_LIBS="-lasound"])
fi
fi
if test -z "$SND_STYLE" -a "x$ac_cv_header_sys_soundcard_h" = "xyes"; then
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_sys_soundcard_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <sys/soundcard.h>
#ifdef SNDCTL_DSP_SETTRIGGER
QF_maGiC_VALUE
#endif
], SND_STYLE="OSS")
], SOUND_STYLE="OSS")
fi
if test -z "$SND_STYLE" -a "x$ac_cv_header_linux_soundcard_h" = "xyes"; then
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_linux_soundcard_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <linux/soundcard.h>
#ifdef SNDCTL_DSP_SETTRIGGER
QF_maGiC_VALUE
#endif
], SND_STYLE="OSS")
], SOUND_STYLE="OSS")
fi
if test -z "$SND_STYLE" -a "x$ac_cv_header_machine_soundcard_h" = "xyes"; then
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_machine_soundcard_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <machine/soundcard.h>
#ifdef SNDCTL_DSP_SETTRIGGER
QF_maGiC_VALUE
#endif
], SND_STYLE="OSS")
], SOUND_STYLE="OSS")
fi
if test -z "$SND_STYLE" -a "x$ac_cv_header_sys_audioio_h" = "xyes"; then
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_sys_audioio_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <sys/audioio.h>
#ifdef AUDIO_SETINFO
QF_maGiC_VALUE
#endif
], SND_STYLE="Solaris")
], SOUND_STYLE="Solaris")
fi
if test -z "$SND_STYLE" -a "x$ac_cv_header_mme_mmsystem_h" = "xyes" -a \
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_mme_mmsystem_h" = "xyes" -a \
"x$HAVE_LIBMME" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <mme/mmsystem.h>
#ifdef WAVE_OPEN_SHAREABLE
QF_maGiC_VALUE
#endif
], SND_STYLE="MME"
SND_LIBS="-lmme")
], SOUND_STYLE="MME"
SOUND_LIBS="-lmme")
fi
if test -z "$SND_STYLE" -a "x$ac_cv_header_windows_h" = "xyes" -a \
if test -z "$SOUND_STYLE" -a "x$ac_cv_header_windows_h" = "xyes" -a \
"x$ac_cv_header_mmsystem_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <windows.h>
@ -565,14 +565,15 @@ if test -z "$SND_STYLE" -a "x$ac_cv_header_windows_h" = "xyes" -a \
QF_maGiC_VALUE
#endif
#endif
], SND_STYLE="Windows"
SND_LIBS="-lwinmm")
], SOUND_STYLE="Windows"
SOUND_LIBS="-lwinmm")
fi
if test "x$SND_STYLE" = "x"; then
if test "x$SOUND_STYLE" = "x"; then
AC_MSG_RESULT(no)
SOUND_STYLE="NULL"
else
AC_MSG_RESULT(yes ($SND_STYLE style))
AC_MSG_RESULT(yes ($SOUND_STYLE style))
fi
@ -730,8 +731,8 @@ AC_SUBST(TDFXGL_LIBS)
AC_SUBST(HAS_SDL)
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AC_SUBST(SND_STYLE)
AC_SUBST(SND_LIBS)
AC_SUBST(SOUND_STYLE)
AC_SUBST(SOUND_LIBS)
AC_SUBST(DYN_LIBS)
AC_SUBST(INTEL_ARCH)
AC_SUBST(NET_LIBS)
@ -750,6 +751,7 @@ AC_OUTPUT(
qw_client/Makefile
qw_server/Makefile
uquake/Makefile
common/Makefile
Makefile
rpm/quakeforge.spec
rpm/build_rpm

View file

@ -3,24 +3,26 @@
# Quake general stuff
#
PROJECT_DIR = @top_srcdir@
PROJECT_ODIR = ..
SRC_DIR = @srcdir@
QW_COMMON_DIR = $(PROJECT_DIR)/qw_common
COMMON_DIR = $(PROJECT_DIR)/common
COMMON_ODIR = $(PROJECT_ODIR)/common
BIN_PREFIX = qw-client
PROJECT_DIR := @top_srcdir@
PROJECT_ODIR := ..
SRC_DIR := @srcdir@
QW_COMMON_DIR := $(PROJECT_DIR)/qw_common
COMMON_DIR := $(PROJECT_DIR)/common
COMMON_ODIR := $(PROJECT_ODIR)/common
BIN_PREFIX := qw-client
DESTDIR =
DESTDIR :=
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir := @bindir@
mandir := @mandir@
BUILD_DIR = $(PROJECT_ODIR)/targets/qw_client
TARGET_DIR := $(PROJECT_ODIR)/targets
BUILD_DIR := $(TARGET_DIR)/qw_client
OBJ_PATTERN := $(shell echo $(BUILD_DIR)/{gl,soft,common_lib}/%.o)
LDFLAGS = @LDFLAGS@ @SND_LIBS@ @NET_LIBS@ -lm
LDFLAGS = @LDFLAGS@ @NET_LIBS@ -lm
LIBS = @LIBS@
CC = @CC@
INTEL_ARCH = @INTEL_ARCH@
@ -113,7 +115,6 @@ CL_ADDITIONAL_GENERAL_SRC = sys_dosa.s math.s
SWREND_SRC_PLAT = d_draw.s d_draw16.s d_parta.s d_polysa.s d_scana.s \
d_spr8.s d_varsa.s r_aclipa.s r_aliasa.s \
r_drawa.s r_edgea.s r_varsa.s surf16.s surf8.s
XTRA_SND_SRC = snd_mixa.s
else
# Source files for non-Intel platforms
@ -125,29 +126,6 @@ endif
CD_AUDIO_SRC = cd_wrapper.c
# Sound source
SND_STYLE = @SND_STYLE@
SND_SRC = snd_null.c
ifeq ($(SND_STYLE),ALSA)
SND_SRC = snd_dma.c snd_alsa.c
endif
ifeq ($(SND_STYLE),OSS)
SND_SRC = snd_dma.c snd_oss.c
endif
ifeq ($(SND_STYLE),Solaris)
SND_SRC = snd_dma.c snd_sun.c
endif
ifeq ($(SND_STYLE),MME)
SND_SRC = snd_dma.c snd_mme.c
endif
ifeq ($(SND_STYLE),Windows)
SND_SRC = snd_dma.c snd_win.c
endif
SND_SRC += snd_mem.c snd_mix.c $(XTRA_SND_SRC)
SYS_SRC = sys_common.c @QW_CL_SYS_SRC@
# Networking source files
@ -160,7 +138,7 @@ QW_NET_SRC = net_udp.c net_com.c mdfour.c
# Common source files
MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \
wad.c zone.c cvars.c
wad.c zone.c cvars.c qendian.c lib_replace.c quakefs.c qargs.c
# GL renderer source
@ -194,7 +172,7 @@ QW_GENERAL_SRC = pmove.c pmovetst.c
# Source common to QW/UQuake
CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
$(CL_ADDITIONAL_GENERAL_SRC) $(SND_SRC) r_part.c
$(CL_ADDITIONAL_GENERAL_SRC) $(CD_AUDIO_SRC) r_part.c
########################################################################
@ -216,62 +194,31 @@ GENERAL_SRC = $(CL_COMMON_SRC) \
# Compilation rules
#
# Common lib targets.
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.c
$(OBJ_PATTERN): $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.s
$(OBJ_PATTERN): $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(OBJ_PATTERN): $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(OBJ_PATTERN): $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/common_lib/%.o: $(QW_COMMON_DIR)/%.c
$(OBJ_PATTERN): $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
# Software targets
soft_DIR:
@DIR=soft; $(MAKE_SURE_DIR)
$(BUILD_DIR)/soft/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/soft/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/soft/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
# GL targets
gl_DIR:
@DIR=gl; $(MAKE_SURE_DIR)
$(BUILD_DIR)/gl/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
$(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/gl/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
###########################################################################
#
# Specific target rules
@ -286,7 +233,7 @@ common_lib_DIR:
$(COMMON_LIB): common_lib_DIR $(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
$(BUILD_DIR)/common_lib.a: common_lib_DIR $(ALL_COMMON_LIB_OBJS)
ar cru $@ $(ALL_COMMON_LIB_OBJS)
ranlib $@
@ -294,11 +241,11 @@ $(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
ifneq ($(X11QUAKE),)
ALL_X11_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\
ALL_X11_SRC = $(SW_REND_SRC) @X11_VID_SRC@\
model.c
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_X11_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
X11_CFLAGS = -DX11 @X_CFLAGS@
X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@
@ -322,11 +269,11 @@ endif
# SVGALib software target
ifneq ($(SVGAQUAKE),)
ALL_SVGA_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) \
ALL_SVGA_SRC = $(SW_REND_SRC) \
vid_svgalib.c in_svgalib.c d_copy.s model.c
ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SVGA_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
SVGA_CFLAGS = @SVGA_CFLAGS@
SVGA_LDFLAGS = @SVGA_LIBS@
@ -351,11 +298,11 @@ endif
ifneq ($(GGIQUAKE),)
# Map the list of source files into a list of object files
ALL_GGI_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\
ALL_GGI_SRC = $(SW_REND_SRC) vid_ggi.c\
model.c
ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GGI_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
GGI_SRC = vid_ggi.c
GGI_CFLAGS = -DGGI @GGI_CFLAGS@
@ -379,7 +326,7 @@ ALL_SDL_SRC = $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\
model.c
ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SDL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
SDL_CFLAGS = @SDL_CFLAGS@ -DSDL
SDL_LDFLAGS = @SDL_LIBS@
@ -403,11 +350,11 @@ endif
ifneq ($(MGLQUAKE),)
# Map the list of source files into a list of object files
ALL_MGL_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) \
ALL_MGL_SRC = $(SW_REND_SRC) \
vid_win.c in_win.c model.c
ALL_MGL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_MGL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
MGL_CFLAGS = -DMGL @MGL_CFLAGS@
MGL_LDFLAGS = @MGL_LIBS@ -lm
@ -426,11 +373,11 @@ endif
# X11 GL target
ifneq ($(GLQUAKE),)
ALL_GL_SRC = $(CD_AUDIO_SRC) $(GL_REND_SRC) \
ALL_GL_SRC = $(GL_REND_SRC) \
gl_vidglx.c dga_check.c
ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
GL_CFLAGS = @OGL_CFLAGS@
GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ @DYN_LIBS@
@ -453,11 +400,11 @@ endif
# 3Dfx GL MCD target
ifneq ($(TDFXQUAKE),)
ALL_TDFX_SRC = $(CD_AUDIO_SRC) $(GL_REND_SRC) \
ALL_TDFX_SRC = $(GL_REND_SRC) \
gl_vidlinux_3dfx.c in_svgalib.c
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_TDFX_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a $(TARGET_DIR)/sound_lib.a
TDFX_CFLAGS = @OGL_CFLAGS@ @GLIDE_CFLAGS@
TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
@ -494,7 +441,7 @@ clean: clean-soft clean-gl clean-common_lib $(CLEAN_TARGETS)
install: $(targets)
$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)/$(bindir)
for i in $(targets); do \
$(PROJECT_DIR)/install-sh -m 755 $(BUILD_DIR)/../$$i \
$(PROJECT_DIR)/install-sh -m 755 $(TARGET_DIR)/$$i \
$(DESTDIR)/$(bindir)/$$i; \
done

View file

@ -28,8 +28,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Player moves as a spectator, but the camera tracks and enemy player
*/
#include "qtypes.h"
#include "quakedef.h"
#include "winquake.h"
#include "mathlib.h"
#include "client.h"
#include "sbar.h"
#include "cvar.h"
#include "console.h"
#define PM_SPECTATORMAXSPEED 500
#define PM_STOPSPEED 100

View file

@ -23,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "pmove_simple.h"
#include "qtypes.h"
#include "client.h"
#include "console.h"
void CL_FinishTimeDemo (void);

View file

@ -21,7 +21,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_ents.c -- entity parsing and management
#include "qtypes.h"
#include "quakedef.h"
#include "cvar.h"
#include "client.h"
#include "console.h"
#include "mathlib.h"
#include "view.h"
#include "cvars.h"
extern cvar_t cl_predict_players;
extern cvar_t cl_predict_players2;

View file

@ -22,6 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cl.input.c -- builds an intended movement command to send to the server
#include "quakedef.h"
#include "qtypes.h"
#include "client.h"
#include "console.h"
#include "mathlib.h"
#include "cvar.h"
#include "input.h"
cvar_t cl_nodelta = {"cl_nodelta","0"};

View file

@ -27,6 +27,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "winquake.h"
#include "pmove_simple.h"
#include "qtypes.h"
#include "client.h"
#include "menu.h"
#include "console.h"
#include "cvar.h"
#include "mathlib.h"
#include "keys.h"
#include "sound.h"
#include "input.h"
#include "screen.h"
#include "view.h"
#include "sbar.h"
#include "cdaudio.h"
#ifdef __sun
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */

View file

@ -22,9 +22,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_parse.c -- parse a message received from the server
#include "qtypes.h"
#include "quakedef.h"
#include "model.h"
#include "pmove.h"
#include "glquake.h"
#include "console.h"
#include "mathlib.h"
#include "sound.h"
#include "cdaudio.h"
#include "sbar.h"
#include "screen.h"
char *svc_strings[] =
{
@ -1036,7 +1044,6 @@ void CL_ParseServerMessage (void)
int i, j;
received_framecount = host_framecount;
cl.last_servermessage = realtime;
CL_ClearProjectiles ();
//

View file

@ -20,8 +20,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "quakedef.h"
#include "winquake.h"
#include "cvar.h"
#include "client.h"
#include "console.h"
#include "mathlib.h"
cvar_t cl_nopred = {"cl_nopred","0"};
cvar_t cl_pushlatency = {"pushlatency","-999"};

View file

@ -21,8 +21,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_tent.c -- client side temporary entities
#include "qtypes.h"
#include "quakedef.h"
#include "model.h"
#include "sound.h"
#include "client.h"
#include "mathlib.h"
#include "console.h"
#define MAX_BEAMS 8

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "d_local.h"
#include <mathlib.h>
static int miplevel;

View file

@ -25,8 +25,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// models are the only shared resource between a client and server running
// on the same machine.
#include "qtypes.h"
#include "quakedef.h"
#include "cvar.h"
#include "sys.h"
#include "mathlib.h"
#include "glquake.h"
#include "qendian.h"
#include "lib_replace.h"
#include "d_iface.h"
#include "common.h"
#include "crc.h"
#include "console.h"
model_t *loadmodel;
char loadname[32]; // for hunk tags

View file

@ -22,8 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// gl_ngraph.c
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "sbar.h"
#include "menu.h"
#include "draw.h"
extern byte *draw_chars; // 8*8 graphic characters

View file

@ -21,8 +21,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// r_light.c
#include "qtypes.h"
#include "quakedef.h"
#include "glquake.h"
#include "client.h"
#include "mathlib.h"
#include "view.h"
int r_dlightframecount;

View file

@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_iface.h"
#include "glquake.h"
#include "mathlib.h"
extern particle_t *active_particles, *free_particles;
extern int ramp1[8], ramp2[8], ramp3[8];

View file

@ -23,8 +23,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// screen.c -- master for refresh, status bar, console, chat, notify, etc
#include "qtypes.h"
#include "quakedef.h"
#include "client.h"
#include "draw.h"
#include "keys.h"
#include "cvar.h"
#include "glquake.h"
#include "console.h"
#include "screen.h"
#include "sbar.h"
#include "menu.h"
#include "sound.h"
#include <time.h>
/*

View file

@ -23,6 +23,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "winquake.h"
#include "qtypes.h"
#include "draw.h"
#include "keys.h"
#include "console.h"
#include "common.h"
#include "client.h"
#include "screen.h"
#include "cvar.h"
#include "menu.h"
#include "view.h"
#include "sound.h"
enum {m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer, m_setup, m_net, m_options, m_video, m_keys, m_help, m_quit, m_serialconfig, m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist} m_state;

View file

@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "qtypes.h"
#include "draw.h"
//
// the net drivers should just set the apropriate bits in m_activenet,
// instead of having the menu code look through their internal tables

View file

@ -27,6 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <mathlib.h>
#include <common.h>
#include <console.h>
model_t *loadmodel;
char loadname[32]; // for hunk tags

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <cvars.h>
#include <sound.h>
#if 0
// FIXME

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "r_local.h"
#include <mathlib.h>
mnode_t *r_pefragtopnode;

Some files were not shown because too many files have changed in this diff Show more