port in some improvements from OT (namely fs_basepath, etc, though commandline parsing isn't finished yet)

split up the headerfiles and such. common.[ch] and qwsvdef.h no longer exist. More work still needs to be done (esp for windows) but this should be a major improvement.
This commit is contained in:
Bill Currie 2000-05-21 08:24:45 +00:00
parent e471c785d8
commit af032b8d55
121 changed files with 1055 additions and 3086 deletions

View file

@ -36,14 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MINIMUM_MEMORY 0x550000 #define MINIMUM_MEMORY 0x550000
// up / down
#define PITCH 0
// left / right
#define YAW 1
// fall over
#define ROLL 2
#define MAX_SCOREBOARD 16 // max numbers of players #define MAX_SCOREBOARD 16 // max numbers of players
@ -143,4 +135,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PRINT_HIGH 2 // critical messages #define PRINT_HIGH 2 // critical messages
#define PRINT_CHAT 3 // chat messages #define PRINT_CHAT 3 // chat messages
#endif // _BOTHDEFS_H #endif // _BOTHDEFS_H

View file

@ -21,7 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _BSPFILE_H #ifndef _BSPFILE_H
#define _BSPFILE_H #define _BSPFILE_H
#include "common.h" #include "qtypes.h"
// upper design bounds // upper design bounds

View file

@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CDAUDIO_H #ifndef _CDAUDIO_H
#define _CDAUDIO_H #define _CDAUDIO_H
#include "common.h"
int CDAudio_Init(void); int CDAudio_Init(void);
void CDAudio_Play(byte track, qboolean looping); void CDAudio_Play(byte track, qboolean looping);
@ -31,4 +30,4 @@ void CDAudio_Resume(void);
void CDAudio_Shutdown(void); void CDAudio_Shutdown(void);
void CDAudio_Update(void); void CDAudio_Update(void);
#endif // _CDAUDIO_H #endif // _CDAUDIO_H

View file

@ -29,7 +29,7 @@
$Id$ $Id$
*/ */
#include <stdio.h> #include "quakeio.h"
#define MAX_SERVER_LIST 256 #define MAX_SERVER_LIST 256
typedef struct { typedef struct {
@ -47,7 +47,7 @@ int Server_List_Reset_NoFree(int i);
int Server_List_Reset(int i); int Server_List_Reset(int i);
void Server_List_Switch(int a,int b); void Server_List_Switch(int a,int b);
int Server_List_Len(void); int Server_List_Len(void);
int Server_List_Load(FILE *f); int Server_List_Load(QFile *f);
int Server_List_Save(FILE *f); int Server_List_Save(QFile *f);
char *gettokstart (char *str, int req, char delim); char *gettokstart (char *str, int req, char delim);
int gettoklen(char *str, int req, char delim); int gettoklen(char *str, int req, char delim);

View file

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h> #include <stdio.h>
#include "common.h" #include "info.h"
#include "mathlib.h" #include "mathlib.h"
#include "protocol.h" #include "protocol.h"
#include "zone.h" #include "zone.h"
@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sound.h" #include "sound.h"
#include "render.h" #include "render.h"
#include "cvar.h" #include "cvar.h"
#include "quakefs.h"
typedef struct typedef struct
{ {
@ -191,7 +192,7 @@ typedef struct
int qport; int qport;
FILE *download; // file transfer from server QFile *download; // file transfer from server
char downloadtempname[MAX_OSPATH]; char downloadtempname[MAX_OSPATH];
char downloadname[MAX_OSPATH]; char downloadname[MAX_OSPATH];
int downloadnumber; int downloadnumber;
@ -207,7 +208,7 @@ typedef struct
qboolean demorecording; qboolean demorecording;
qboolean demoplayback; qboolean demoplayback;
qboolean timedemo; qboolean timedemo;
FILE *demofile; QFile *demofile;
float td_lastframe; // to meter out one message a frame float td_lastframe; // to meter out one message a frame
int td_startframe; // host_framecount at start int td_startframe; // host_framecount at start
float td_starttime; // realtime at second frame of timedemo float td_starttime; // realtime at second frame of timedemo

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CMD_H #ifndef _CMD_H
#define _CMD_H #define _CMD_H
#include "qtypes.h"
//=========================================================================== //===========================================================================
/* /*
@ -110,4 +112,7 @@ void Cmd_ForwardToServer (void);
void Cmd_StuffCmds_f (void); void Cmd_StuffCmds_f (void);
extern char com_token[1024];
char *COM_Parse (char *data);
#endif // _CMD_H #endif // _CMD_H

View file

@ -29,8 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include "config.h" # include "config.h"
#endif #endif
#include "common.h" #include "cvar.h"
//#include "var.h"
/* The host system specifies the base of the directory tree, the /* The host system specifies the base of the directory tree, the
command line parms passed to the program, and the amount of memory command line parms passed to the program, and the amount of memory
@ -57,5 +56,9 @@ extern qboolean host_initialized; /* True if into command execution. */
extern double host_frametime; extern double host_frametime;
extern double realtime; /* Not bounded in any way, changed at extern double realtime; /* Not bounded in any way, changed at
start of every frame, never reset */ start of every frame, never reset */
extern qboolean standard_quake, rogue, hipnotic;
char *va(char *format, ...);
// does a varargs printf into a temp buffer
#endif /* __QF_COMMDEF_H */ #endif /* __QF_COMMDEF_H */

View file

@ -1,231 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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.h -- general definitions
#ifndef _COMMON_H
#define _COMMON_H
//#include "protocol.h" // for struct usercmd_s
#ifndef _DEF_BYTE_
# define _DEF_BYTE_
typedef unsigned char byte;
#endif
// 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_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)))
//============================================================================
#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 qboolean bigendien;
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);
//============================================================================
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
#ifdef __BORLANDC__
#define Q_strcasecmp(s1, s2) stricmp((s1), (s2))
#define Q_strncasecmp(s1, s2, n) strnicmp((s1), (s2), (n))
#else
#define Q_strcasecmp(s1, s2) _stricmp((s1), (s2))
#define Q_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
#endif
#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);
void COM_AddParm (char *parm);
void COM_Init (void);
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_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);
extern struct cvar_s *registered;
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);
int build_number( void );
#endif // _COMMON_H

View file

@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// console // console
// //
#include "qtypes.h"
#define CON_TEXTSIZE 16384 #define CON_TEXTSIZE 16384
typedef struct typedef struct
{ {

View file

@ -22,9 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _CRC_H #ifndef _CRC_H
#define _CRC_H #define _CRC_H
#include "qtypes.h"
void CRC_Init(unsigned short *crcvalue); void CRC_Init(unsigned short *crcvalue);
void CRC_ProcessByte(unsigned short *crcvalue, byte data); void CRC_ProcessByte(unsigned short *crcvalue, byte data);
unsigned short CRC_Value(unsigned short crcvalue); unsigned short CRC_Value(unsigned short crcvalue);
unsigned short CRC_Block (byte *start, int count); unsigned short CRC_Block (byte *start, int count);
#endif // _CRC_H #endif // _CRC_H

View file

@ -31,6 +31,9 @@
#ifndef _CVAR_H #ifndef _CVAR_H
#define _CVAR_H #define _CVAR_H
#include "qtypes.h"
#include "quakeio.h"
typedef struct cvar_s typedef struct cvar_s
{ {
char *name; char *name;
@ -99,7 +102,7 @@ qboolean Cvar_Command (void);
// command. Returns true if the command was a variable reference that // command. Returns true if the command was a variable reference that
// was handled. (print or change) // was handled. (print or change)
void Cvar_WriteVariables (FILE *f); void Cvar_WriteVariables (QFile *f);
// Writes lines containing "set variable value" for all variables // Writes lines containing "set variable value" for all variables
// with the archive flag set to true. // with the archive flag set to true.

View file

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _D_IFACE_H #ifndef _D_IFACE_H
#define _D_IFACE_H #define _D_IFACE_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "model.h" #include "model.h"
#include "cvar.h" #include "cvar.h"

View file

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// d_local.h: private rasterization driver defs // d_local.h: private rasterization driver defs
#ifndef __d_local_h
#define __d_local_h
#include "r_shared.h" #include "r_shared.h"
// //
@ -111,3 +114,4 @@ extern float d_scalemip[3];
extern void (*d_drawspans) (espan_t *pspan); extern void (*d_drawspans) (espan_t *pspan);
#endif

View file

@ -35,10 +35,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#include "common.h"
#include "model.h" #include "model.h"
#include "render.h" #include "render.h"
#include "cvar.h" #include "cvar.h"
#include "wad.h"
#include "client.h"
// Ender: HackHackHack // Ender: HackHackHack
#ifndef GLAPIENTRY #ifndef GLAPIENTRY
@ -352,4 +353,4 @@ void GL_BuildLightmaps (void);
// //
void R_NetGraph (void); void R_NetGraph (void);
#endif // _GLQUAKE_H #endif // _GLQUAKE_H

View file

@ -28,7 +28,6 @@
#ifndef _IN_WIN_H #ifndef _IN_WIN_H
#define _IN_WIN_H #define _IN_WIN_H
#include "common.h"
#include "protocol.h" #include "protocol.h"
extern qboolean mouseactive; extern qboolean mouseactive;

View file

@ -21,8 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _KEYS_H #ifndef _KEYS_H
#define _KEYS_H #define _KEYS_H
#include <stdio.h> #include "quakeio.h"
#include "common.h"
// these are the key numbers that should be passed to Key_Event // these are the key numbers that should be passed to Key_Event
@ -167,7 +166,7 @@ extern qboolean chat_team;
void Key_Event (int key, qboolean down); void Key_Event (int key, qboolean down);
void Key_Init (void); void Key_Init (void);
void Key_WriteBindings (FILE *f); void Key_WriteBindings (QFile *f);
void Key_SetBinding (int keynum, char *binding); void Key_SetBinding (int keynum, char *binding);
void Key_ClearStates (void); void Key_ClearStates (void);

View file

@ -22,15 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _MATHLIB_H #ifndef _MATHLIB_H
#define _MATHLIB_H #define _MATHLIB_H
//#include "model.h" #include "qtypes.h"
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;
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
@ -48,6 +40,13 @@ 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 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];} #define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
// up / down
#define PITCH 0
// left / right
#define YAW 1
// fall over
#define ROLL 2
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2); vec_t _DotProduct (vec3_t v1, vec3_t v2);

View file

@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _MODEL_H #ifndef _MODEL_H
#define _MODEL_H #define _MODEL_H
#include "common.h" #include "qtypes.h"
#include "mathlib.h"
#include "render.h" #include "render.h"
#include "bspfile.h" #include "bspfile.h"
#include "modelgen.h"
#include "spritegn.h" #include "spritegn.h"
#include "modelgen.h"
#include "zone.h"
/* /*
@ -70,7 +70,6 @@ typedef struct
#define SIDE_BACK 1 #define SIDE_BACK 1
#define SIDE_ON 2 #define SIDE_ON 2
// plane_t structure // plane_t structure
// !!! if this is changed, it must be changed in asm_i386.h too !!! // !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct mplane_s typedef struct mplane_s

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _NET_H #ifndef _NET_H
#define _NET_H #define _NET_H
#include "common.h" #include "sizebuf.h"
#include "cvar.h" #include "cvar.h"
#define PORT_ANY -1 #define PORT_ANY -1
@ -38,8 +38,6 @@ extern netadr_t net_local_adr;
extern netadr_t net_from; // address of who sent the packet extern netadr_t net_from; // address of who sent the packet
extern sizebuf_t net_message; extern sizebuf_t net_message;
/* extern cvar_t hostname;
CVAR_FIXME */
extern cvar_t *hostname; extern cvar_t *hostname;
extern int net_socket; extern int net_socket;

View file

@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _PMOVE_H #ifndef _PMOVE_H
#define _PMOVE_H #define _PMOVE_H
#include "common.h"
#include "protocol.h" #include "protocol.h"
#include "mathlib.h" #include "mathlib.h"
#include "model.h" #include "model.h"

View file

@ -23,8 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _PR_COMP_H #ifndef _PR_COMP_H
#define _PR_COMP_H #define _PR_COMP_H
typedef int func_t; #include "qtypes.h"
typedef int string_t;
typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t; typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;

View file

@ -21,10 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _PROGS_H #ifndef _PROGS_H
#define _PROGS_H #define _PROGS_H
#include "common.h"
#include "protocol.h" #include "protocol.h"
#include "pr_comp.h" // defs shared with qcc #include "pr_comp.h" // defs shared with qcc
#include "progdefs.h" // generated by program cdefs #include "progdefs.h" // generated by program cdefs
#include "link.h"
typedef union eval_s typedef union eval_s
{ {

View file

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _PROTOCOL_H #ifndef _PROTOCOL_H
#define _PROTOCOL_H #define _PROTOCOL_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#define PROTOCOL_VERSION 28 #define PROTOCOL_VERSION 28

View file

@ -40,39 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <setjmp.h> #include <setjmp.h>
#include <time.h> #include <time.h>
#include "bothdefs.h" #include "qtypes.h"
#include "common.h"
#include "bspfile.h"
#include "vid.h"
//#include "sys.h"
#include "zone.h"
#include "mathlib.h"
#include "wad.h"
#include "draw.h"
#include "cvar.h" #include "cvar.h"
#include "screen.h"
#include "net.h"
#include "protocol.h"
#include "cmd.h"
#include "sbar.h"
#include "sound.h"
#include "render.h"
#include "client.h"
#include "model.h"
#include "d_iface.h"
#include "input.h"
#include "keys.h"
#include "console.h"
#include "view.h"
#include "menu.h"
#include "crc.h"
#include "cdaudio.h"
#include "pmove.h"
#include "compat.h"
#include "commdef.h" #include "commdef.h"
#define MAX_NUM_ARGVS 50 #define MAX_NUM_ARGVS 50

View file

@ -1,74 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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.
*/
// qwsvdef.h -- primary header for server
#ifndef _QWSVDEF_H
#define _QWSVDEF_H
#define QUAKE_GAME // as opposed to utilities
//define PARANOID // speed sapping error checking
#if defined(_WIN32) && !defined(__GNUC__)
#pragma warning( disable : 4244 4127 4201 4214 4514 4305 4115 4018)
#endif
// FIXME: clean those includes -- yan
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <ctype.h>
#include "bothdefs.h"
#include "common.h"
#include "bspfile.h"
#include "sys.h"
#include "zone.h"
#include "mathlib.h"
#include "cvar.h"
#include "net.h"
#include "protocol.h"
#include "cmd.h"
#include "vid.h"
#include "render.h"
#include "model.h"
#include "crc.h"
#include "progs.h"
#include "server.h"
#include "world.h"
#include "pmove.h"
#include "compat.h"
#include "commdef.h"
void SV_Error (char *error, ...);
void SV_Init (quakeparms_t *parms);
void Con_Printf (char *fmt, ...);
void Con_DPrintf (char *fmt, ...);
#endif

View file

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _R_LOCAL_H #ifndef _R_LOCAL_H
#define _R_LOCAL_H #define _R_LOCAL_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "cvar.h" #include "cvar.h"
#include "vid.h" #include "vid.h"

View file

@ -26,10 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _R_SHARED_H #ifndef _R_SHARED_H
#define _R_SHARED_H #define _R_SHARED_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "cvar.h" #include "cvar.h"
#include "model.h" #include "model.h"
#include "d_iface.h"
#define MAXVERTS 16 // max points in a surface polygon #define MAXVERTS 16 // max points in a surface polygon
#define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate #define MAXWORKINGVERTS (MAXVERTS+4) // max points in an intermediate

View file

@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _RENDER_H #ifndef _RENDER_H
#define _RENDER_H #define _RENDER_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "cvar.h" #include "cvar.h"
#include "vid.h" #include "vid.h"

View file

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _SCREEN_H #ifndef _SCREEN_H
#define _SCREEN_H #define _SCREEN_H
#include "common.h"
#include "cvar.h" #include "cvar.h"
void SCR_InitCvars (void); void SCR_InitCvars (void);

View file

@ -22,11 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _SERVER_H #ifndef _SERVER_H
#define _SERVER_H #define _SERVER_H
#include "common.h" #include "commdef.h"
#include "net.h"
#include "cvar.h" #include "cvar.h"
#include "protocol.h" #include "protocol.h"
#include "model.h" #include "model.h"
#include "progs.h" #include "progs.h"
#include "sizebuf.h"
#include "info.h"
#include "quakeio.h"
#define QW_SERVER #define QW_SERVER
@ -175,7 +179,7 @@ typedef struct client_s
client_frame_t frames[UPDATE_BACKUP]; // updates can be deltad from here client_frame_t frames[UPDATE_BACKUP]; // updates can be deltad from here
FILE *download; // file being downloaded QFile *download; // file being downloaded
int downloadsize; // total bytes int downloadsize; // total bytes
int downloadcount; // bytes sent int downloadcount; // bytes sent
@ -187,7 +191,7 @@ typedef struct client_s
qboolean upgradewarn; // did we warn him? qboolean upgradewarn; // did we warn him?
FILE *upload; QFile *upload;
char uploadfn[MAX_QPATH]; char uploadfn[MAX_QPATH];
netadr_t snap_from; netadr_t snap_from;
qboolean remote_snap; qboolean remote_snap;
@ -351,12 +355,18 @@ extern char localmodels[MAX_MODELS][5]; // inline model names for precache
extern char localinfo[MAX_LOCALINFO_STRING+1]; extern char localinfo[MAX_LOCALINFO_STRING+1];
extern int host_hunklevel; extern int host_hunklevel;
extern FILE *sv_logfile; extern QFile *sv_logfile;
extern FILE *sv_fraglogfile; extern QFile *sv_fraglogfile;
//=========================================================== //===========================================================
// FIXME: declare exported functions in their own relevant .h // FIXME: declare exported functions in their own relevant .h
void SV_Error (char *error, ...);
void SV_Init (quakeparms_t *parms);
void Con_Printf (char *fmt, ...);
void Con_DPrintf (char *fmt, ...);
// //
// sv_main.c // sv_main.c
// //
@ -364,7 +374,6 @@ void SV_Shutdown (void);
void SV_Frame (float time); void SV_Frame (float time);
void SV_FinalMessage (char *message); void SV_FinalMessage (char *message);
void SV_DropClient (client_t *drop); void SV_DropClient (client_t *drop);
int SV_CalcPing (client_t *cl); int SV_CalcPing (client_t *cl);
void SV_FullClientUpdate (client_t *client, sizebuf_t *buf); void SV_FullClientUpdate (client_t *client, sizebuf_t *buf);

View file

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _SOUND_H #ifndef _SOUND_H
#define _SOUND_H #define _SOUND_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "zone.h" #include "zone.h"
#include "cvar.h" #include "cvar.h"

View file

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

View file

@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _WAD_H #ifndef _WAD_H
#define _WAD_H #define _WAD_H
#include "qtypes.h"
//=============== //===============
// TYPES // TYPES
//=============== //===============

View file

@ -36,7 +36,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include <mgraph.h> # include <mgraph.h>
#endif #endif
#include "common.h"
#ifndef WM_MOUSEWHEEL #ifndef WM_MOUSEWHEEL
# define WM_MOUSEWHEEL 0x020A # define WM_MOUSEWHEEL 0x020A

View file

@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef _WORLD_H #ifndef _WORLD_H
#define _WORLD_H #define _WORLD_H
#include "common.h"
#include "mathlib.h" #include "mathlib.h"
#include "model.h" #include "model.h"
#include "progs.h" #include "progs.h"

View file

@ -43,7 +43,9 @@ endif
EXTRA_libqfcd_a_SOURCES = cd_win.c cd_linux.c cd_null.c EXTRA_libqfcd_a_SOURCES = cd_win.c cd_linux.c cd_null.c
common_SOURCES= net_chan.c net_com.c net_udp.c pmove.c pmovetst.c zone.c \ common_SOURCES= net_chan.c net_com.c net_udp.c pmove.c pmovetst.c zone.c \
mdfour.c mathlib.c math.S cvar.c crc.c common.c model.c cmd.c mdfour.c mathlib.c math.S cvar.c crc.c model.c cmd.c \
qargs.c qendian.c quakefs.c quakeio.c msg.c sizebuf.c info.c \
checksum.c link.c build.c va.c com.c
server_SOURCES= pr_cmds.c pr_edict.c pr_exec.c sv_init.c sv_main.c sv_misc.c \ server_SOURCES= pr_cmds.c pr_edict.c pr_exec.c sv_init.c sv_main.c sv_misc.c \
sv_model.c sv_nchan.c sv_ents.c sv_send.c sv_move.c sv_phys.c \ sv_model.c sv_nchan.c sv_ents.c sv_send.c sv_move.c sv_phys.c \
sv_user.c sv_ccmds.c world.c worlda.S sv_cvar.c sv_user.c sv_ccmds.c world.c worlda.S sv_cvar.c

View file

@ -42,7 +42,11 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include "quakedef.h" #include "qargs.h"
#include "cmd.h"
#include "cdaudio.h"
#include "console.h"
#include "sound.h"
static qboolean cdValid = false; static qboolean cdValid = false;
static qboolean playing = false; static qboolean playing = false;
@ -227,13 +231,13 @@ static void CD_f (void)
command = Cmd_Argv (1); command = Cmd_Argv (1);
if (Q_strcasecmp(command, "on") == 0) if (strcasecmp(command, "on") == 0)
{ {
enabled = true; enabled = true;
return; return;
} }
if (Q_strcasecmp(command, "off") == 0) if (strcasecmp(command, "off") == 0)
{ {
if (playing) if (playing)
CDAudio_Stop(); CDAudio_Stop();
@ -241,7 +245,7 @@ static void CD_f (void)
return; return;
} }
if (Q_strcasecmp(command, "reset") == 0) if (strcasecmp(command, "reset") == 0)
{ {
enabled = true; enabled = true;
if (playing) if (playing)
@ -252,7 +256,7 @@ static void CD_f (void)
return; return;
} }
if (Q_strcasecmp(command, "remap") == 0) if (strcasecmp(command, "remap") == 0)
{ {
ret = Cmd_Argc() - 2; ret = Cmd_Argc() - 2;
if (ret <= 0) if (ret <= 0)
@ -263,11 +267,11 @@ static void CD_f (void)
return; return;
} }
for (n = 1; n <= ret; n++) for (n = 1; n <= ret; n++)
remap[n] = Q_atoi(Cmd_Argv (n+1)); remap[n] = atoi(Cmd_Argv (n+1));
return; return;
} }
if (Q_strcasecmp(command, "close") == 0) if (strcasecmp(command, "close") == 0)
{ {
CDAudio_CloseDoor(); CDAudio_CloseDoor();
return; return;
@ -283,37 +287,37 @@ static void CD_f (void)
} }
} }
if (Q_strcasecmp(command, "play") == 0) if (strcasecmp(command, "play") == 0)
{ {
CDAudio_Play((byte)Q_atoi(Cmd_Argv (2)), false); CDAudio_Play((byte)atoi(Cmd_Argv (2)), false);
return; return;
} }
if (Q_strcasecmp(command, "loop") == 0) if (strcasecmp(command, "loop") == 0)
{ {
CDAudio_Play((byte)Q_atoi(Cmd_Argv (2)), true); CDAudio_Play((byte)atoi(Cmd_Argv (2)), true);
return; return;
} }
if (Q_strcasecmp(command, "stop") == 0) if (strcasecmp(command, "stop") == 0)
{ {
CDAudio_Stop(); CDAudio_Stop();
return; return;
} }
if (Q_strcasecmp(command, "pause") == 0) if (strcasecmp(command, "pause") == 0)
{ {
CDAudio_Pause(); CDAudio_Pause();
return; return;
} }
if (Q_strcasecmp(command, "resume") == 0) if (strcasecmp(command, "resume") == 0)
{ {
CDAudio_Resume(); CDAudio_Resume();
return; return;
} }
if (Q_strcasecmp(command, "eject") == 0) if (strcasecmp(command, "eject") == 0)
{ {
if (playing) if (playing)
CDAudio_Stop(); CDAudio_Stop();
@ -322,7 +326,7 @@ static void CD_f (void)
return; return;
} }
if (Q_strcasecmp(command, "info") == 0) if (strcasecmp(command, "info") == 0)
{ {
Con_Printf("%u tracks\n", maxTrack); Con_Printf("%u tracks\n", maxTrack);
if (playing) if (playing)

View file

@ -37,8 +37,15 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "cvar.h"
#include "winquake.h" #include "client.h"
#include "pmove.h"
#include "msg.h"
#include "sbar.h"
#include "console.h"
#include "commdef.h"
#include <math.h>
#define PM_SPECTATORMAXSPEED 500 #define PM_SPECTATORMAXSPEED 500
#define PM_STOPSPEED 100 #define PM_STOPSPEED 100

View file

@ -31,7 +31,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "client.h"
#include "console.h"
#include "cmd.h"
#include "msg.h"
#include <string.h>
/* /*
=================== ===================
@ -71,7 +76,7 @@ void Cmd_ForwardToServer_f (void)
return; return;
} }
if (Q_strcasecmp(Cmd_Argv(1), "snap") == 0) { if (strcasecmp(Cmd_Argv(1), "snap") == 0) {
Cbuf_InsertText ("snap\n"); Cbuf_InsertText ("snap\n");
return; return;
} }

View file

@ -29,18 +29,20 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "cvar.h"
#include "sizebuf.h"
#include "msg.h"
#include "client.h"
#include "commdef.h"
void void
Cvar_Info(cvar_t *var) Cvar_Info(cvar_t *var)
{ {
if (var->flags & CVAR_USERINFO) if (var->flags & CVAR_USERINFO) {
{ Info_SetValueForKey (cls.userinfo, var->name, var->string, MAX_INFO_STRING);
Info_SetValueForKey (cls.userinfo, var->name, var->string, MAX_INFO_STRING); if (cls.state >= ca_connected) {
if (cls.state >= ca_connected) MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
{ SZ_Print (&cls.netchan.message, va("setinfo \"%s\" \"%s\"\n", var->name, var->string));
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); }
SZ_Print (&cls.netchan.message, va("setinfo \"%s\" \"%s\"\n", var->name, var->string)); }
}
}
} }

View file

@ -30,7 +30,17 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "cvar.h"
#include "sizebuf.h"
#include "msg.h"
#include "client.h"
#include "commdef.h"
#include "cmd.h"
#include "console.h"
#include "qendian.h"
#include "quakefs.h"
#include "quakedef.h" #include "quakedef.h"
#include "pmove.h"
void CL_FinishTimeDemo (void); void CL_FinishTimeDemo (void);
@ -59,7 +69,7 @@ void CL_StopPlayback (void)
if (!cls.demoplayback) if (!cls.demoplayback)
return; return;
fclose (cls.demofile); Qclose (cls.demofile);
cls.demofile = NULL; cls.demofile = NULL;
cls.state = ca_disconnected; cls.state = ca_disconnected;
cls.demoplayback = 0; cls.demoplayback = 0;
@ -89,10 +99,10 @@ void CL_WriteDemoCmd (usercmd_t *pcmd)
//Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime); //Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
fl = LittleFloat((float)realtime); fl = LittleFloat((float)realtime);
fwrite (&fl, sizeof(fl), 1, cls.demofile); Qwrite (cls.demofile, &fl, sizeof(fl));
c = dem_cmd; c = dem_cmd;
fwrite (&c, sizeof(c), 1, cls.demofile); Qwrite (cls.demofile, &c, sizeof(c));
// correct for byte order, bytes don't matter // correct for byte order, bytes don't matter
cmd = *pcmd; cmd = *pcmd;
@ -103,15 +113,15 @@ void CL_WriteDemoCmd (usercmd_t *pcmd)
cmd.sidemove = LittleShort(cmd.sidemove); cmd.sidemove = LittleShort(cmd.sidemove);
cmd.upmove = LittleShort(cmd.upmove); cmd.upmove = LittleShort(cmd.upmove);
fwrite(&cmd, sizeof(cmd), 1, cls.demofile); Qwrite(cls.demofile, &cmd, sizeof(cmd));
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
fl = LittleFloat (cl.viewangles[i]); fl = LittleFloat (cl.viewangles[i]);
fwrite (&fl, 4, 1, cls.demofile); Qwrite (cls.demofile, &fl, 4);
} }
fflush (cls.demofile); Qflush (cls.demofile);
} }
/* /*
@ -133,16 +143,16 @@ void CL_WriteDemoMessage (sizebuf_t *msg)
return; return;
fl = LittleFloat((float)realtime); fl = LittleFloat((float)realtime);
fwrite (&fl, sizeof(fl), 1, cls.demofile); Qwrite (cls.demofile, &fl, sizeof(fl));
c = dem_read; c = dem_read;
fwrite (&c, sizeof(c), 1, cls.demofile); Qwrite (cls.demofile, &c, sizeof(c));
len = LittleLong (msg->cursize); len = LittleLong (msg->cursize);
fwrite (&len, 4, 1, cls.demofile); Qwrite (cls.demofile, &len, 4);
fwrite (msg->data, msg->cursize, 1, cls.demofile); Qwrite (cls.demofile, msg->data, msg->cursize);
fflush (cls.demofile); Qflush (cls.demofile);
} }
/* /*
@ -161,7 +171,7 @@ qboolean CL_GetDemoMessage (void)
usercmd_t *pcmd; usercmd_t *pcmd;
// read the time from the packet // read the time from the packet
fread(&demotime, sizeof(demotime), 1, cls.demofile); Qread(cls.demofile, &demotime, sizeof(demotime));
demotime = LittleFloat(demotime); demotime = LittleFloat(demotime);
// decide if it is time to grab the next message // decide if it is time to grab the next message
@ -171,7 +181,7 @@ qboolean CL_GetDemoMessage (void)
else if (demotime > cls.td_lastframe) { else if (demotime > cls.td_lastframe) {
cls.td_lastframe = demotime; cls.td_lastframe = demotime;
// rewind back to time // rewind back to time
fseek(cls.demofile, ftell(cls.demofile) - sizeof(demotime), Qseek(cls.demofile, Qtell(cls.demofile) - sizeof(demotime),
SEEK_SET); SEEK_SET);
return 0; // allready read this frame's message return 0; // allready read this frame's message
} }
@ -185,12 +195,12 @@ qboolean CL_GetDemoMessage (void)
// too far back // too far back
realtime = demotime - 1.0; realtime = demotime - 1.0;
// rewind back to time // rewind back to time
fseek(cls.demofile, ftell(cls.demofile) - sizeof(demotime), Qseek(cls.demofile, Qtell(cls.demofile) - sizeof(demotime),
SEEK_SET); SEEK_SET);
return 0; return 0;
} else if (realtime < demotime) { } else if (realtime < demotime) {
// rewind back to time // rewind back to time
fseek(cls.demofile, ftell(cls.demofile) - sizeof(demotime), Qseek(cls.demofile, Qtell(cls.demofile) - sizeof(demotime),
SEEK_SET); SEEK_SET);
return 0; // don't need another message yet return 0; // don't need another message yet
} }
@ -201,14 +211,14 @@ qboolean CL_GetDemoMessage (void)
Host_Error ("CL_GetDemoMessage: cls.state != ca_active"); Host_Error ("CL_GetDemoMessage: cls.state != ca_active");
// get the msg type // get the msg type
fread (&c, sizeof(c), 1, cls.demofile); Qread (cls.demofile, &c, sizeof(c));
switch (c) { switch (c) {
case dem_cmd : case dem_cmd :
// user sent input // user sent input
i = cls.netchan.outgoing_sequence & UPDATE_MASK; i = cls.netchan.outgoing_sequence & UPDATE_MASK;
pcmd = &cl.frames[i].cmd; pcmd = &cl.frames[i].cmd;
r = fread (pcmd, sizeof(*pcmd), 1, cls.demofile); r = Qread (cls.demofile, pcmd, sizeof(*pcmd));
if (r != 1) if (r != 1)
{ {
CL_StopPlayback (); CL_StopPlayback ();
@ -225,19 +235,19 @@ qboolean CL_GetDemoMessage (void)
cls.netchan.outgoing_sequence++; cls.netchan.outgoing_sequence++;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
r = fread (&f, 4, 1, cls.demofile); r = Qread (cls.demofile, &f, 4);
cl.viewangles[i] = LittleFloat (f); cl.viewangles[i] = LittleFloat (f);
} }
break; break;
case dem_read: case dem_read:
// get the next message // get the next message
fread (&net_message.cursize, 4, 1, cls.demofile); Qread (cls.demofile, &net_message.cursize, 4);
net_message.cursize = LittleLong (net_message.cursize); net_message.cursize = LittleLong (net_message.cursize);
//Con_Printf("read: %ld bytes\n", net_message.cursize); //Con_Printf("read: %ld bytes\n", net_message.cursize);
if (net_message.cursize > MAX_MSGLEN) if (net_message.cursize > MAX_MSGLEN)
Sys_Error ("Demo message > MAX_MSGLEN"); Sys_Error ("Demo message > MAX_MSGLEN");
r = fread (net_message.data, net_message.cursize, 1, cls.demofile); r = Qread (cls.demofile, net_message.data, net_message.cursize);
if (r != 1) if (r != 1)
{ {
CL_StopPlayback (); CL_StopPlayback ();
@ -246,9 +256,9 @@ qboolean CL_GetDemoMessage (void)
break; break;
case dem_set : case dem_set :
fread (&i, 4, 1, cls.demofile); Qread (cls.demofile, &i, 4);
cls.netchan.outgoing_sequence = LittleLong(i); cls.netchan.outgoing_sequence = LittleLong(i);
fread (&i, 4, 1, cls.demofile); Qread (cls.demofile, &i, 4);
cls.netchan.incoming_sequence = LittleLong(i); cls.netchan.incoming_sequence = LittleLong(i);
break; break;
@ -305,7 +315,7 @@ void CL_Stop_f (void)
CL_WriteDemoMessage (&net_message); CL_WriteDemoMessage (&net_message);
// finish up // finish up
fclose (cls.demofile); Qclose (cls.demofile);
cls.demofile = NULL; cls.demofile = NULL;
cls.demorecording = false; cls.demorecording = false;
Con_Printf ("Completed demo\n"); Con_Printf ("Completed demo\n");
@ -332,21 +342,21 @@ void CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq)
return; return;
fl = LittleFloat((float)realtime); fl = LittleFloat((float)realtime);
fwrite (&fl, sizeof(fl), 1, cls.demofile); Qwrite (cls.demofile, &fl, sizeof(fl));
c = dem_read; c = dem_read;
fwrite (&c, sizeof(c), 1, cls.demofile); Qwrite (cls.demofile, &c, sizeof(c));
len = LittleLong (msg->cursize + 8); len = LittleLong (msg->cursize + 8);
fwrite (&len, 4, 1, cls.demofile); Qwrite (cls.demofile, &len, 4);
i = LittleLong(seq); i = LittleLong(seq);
fwrite (&i, 4, 1, cls.demofile); Qwrite (cls.demofile, &i, 4);
fwrite (&i, 4, 1, cls.demofile); Qwrite (cls.demofile, &i, 4);
fwrite (msg->data, msg->cursize, 1, cls.demofile); Qwrite (cls.demofile, msg->data, msg->cursize);
fflush (cls.demofile); Qflush (cls.demofile);
} }
@ -362,17 +372,17 @@ void CL_WriteSetDemoMessage (void)
return; return;
fl = LittleFloat((float)realtime); fl = LittleFloat((float)realtime);
fwrite (&fl, sizeof(fl), 1, cls.demofile); Qwrite (cls.demofile, &fl, sizeof(fl));
c = dem_set; c = dem_set;
fwrite (&c, sizeof(c), 1, cls.demofile); Qwrite (cls.demofile, &c, sizeof(c));
len = LittleLong(cls.netchan.outgoing_sequence); len = LittleLong(cls.netchan.outgoing_sequence);
fwrite (&len, 4, 1, cls.demofile); Qwrite (cls.demofile, &len, 4);
len = LittleLong(cls.netchan.incoming_sequence); len = LittleLong(cls.netchan.incoming_sequence);
fwrite (&len, 4, 1, cls.demofile); Qwrite (cls.demofile, &len, 4);
fflush (cls.demofile); Qflush (cls.demofile);
} }
@ -421,7 +431,7 @@ void CL_Record_f (void)
// //
COM_DefaultExtension (name, ".qwd"); COM_DefaultExtension (name, ".qwd");
cls.demofile = fopen (name, "wb"); cls.demofile = Qopen (name, "wb");
if (!cls.demofile) if (!cls.demofile)
{ {
Con_Printf ("ERROR: couldn't open.\n"); Con_Printf ("ERROR: couldn't open.\n");
@ -707,7 +717,7 @@ void CL_ReRecord_f (void)
// //
COM_DefaultExtension (name, ".qwd"); COM_DefaultExtension (name, ".qwd");
cls.demofile = fopen (name, "wb"); cls.demofile = Qopen (name, "wb");
if (!cls.demofile) if (!cls.demofile)
{ {
Con_Printf ("ERROR: couldn't open.\n"); Con_Printf ("ERROR: couldn't open.\n");

View file

@ -31,7 +31,19 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "sys.h"
#include "cvar.h"
#include "sizebuf.h"
#include "msg.h"
#include "client.h"
#include "commdef.h"
#include "cmd.h"
#include "console.h"
#include "qendian.h"
#include "quakefs.h"
#include "quakedef.h" #include "quakedef.h"
#include "pmove.h"
#include "view.h"
/* extern cvar_t cl_predict_players; /* extern cvar_t cl_predict_players;
CVAR_FIXME */ CVAR_FIXME */

View file

@ -30,8 +30,22 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h"
#include "in_win.h" #include "in_win.h"
#include "sys.h"
#include "sys.h"
#include "cvar.h"
#include "sizebuf.h"
#include "msg.h"
#include "client.h"
#include "commdef.h"
#include "cmd.h"
#include "console.h"
#include "qendian.h"
#include "quakefs.h"
#include "quakedef.h"
#include "pmove.h"
#include "view.h"
#include "checksum.h"
/* cvar_t cl_nodelta = {"cl_nodelta","0"}; /* cvar_t cl_nodelta = {"cl_nodelta","0"};
CVAR_FIXME */ CVAR_FIXME */
@ -171,7 +185,7 @@ void IN_UseUp (void) {KeyUp(&in_use);}
void IN_JumpDown (void) {KeyDown(&in_jump);} void IN_JumpDown (void) {KeyDown(&in_jump);}
void IN_JumpUp (void) {KeyUp(&in_jump);} void IN_JumpUp (void) {KeyUp(&in_jump);}
void IN_Impulse (void) {in_impulse=Q_atoi(Cmd_Argv(1));} void IN_Impulse (void) {in_impulse=atoi(Cmd_Argv(1));}
/* /*
=============== ===============

View file

@ -31,10 +31,33 @@
# include "config.h" # include "config.h"
#endif #endif
#include <ctype.h> #include <ctype.h>
#include "bothdefs.h"
#include "in_win.h"
#include "sys.h" #include "sys.h"
#include "sys.h"
#include "cvar.h"
#include "sizebuf.h"
#include "msg.h"
#include "client.h"
#include "commdef.h"
#include "cmd.h"
#include "console.h"
#include "qendian.h"
#include "quakefs.h"
#include "quakedef.h" #include "quakedef.h"
#include "pmove.h"
#include "view.h"
#include "checksum.h"
#include "sys.h"
#include "menu.h"
#include "compat.h"
#include "build.h"
#include "keys.h"
#include "screen.h"
#include "sbar.h"
#include "draw.h"
#include "qargs.h"
#include "cdaudio.h"
#ifdef _WIN32 #ifdef _WIN32
#include "winquake.h" #include "winquake.h"
#include "winsock.h" #include "winsock.h"
@ -522,7 +545,7 @@ void CL_Disconnect (void)
Cam_Reset(); Cam_Reset();
if (cls.download) { if (cls.download) {
fclose(cls.download); Qclose(cls.download);
cls.download = NULL; cls.download = NULL;
} }
@ -1132,7 +1155,7 @@ void CL_Download_f (void)
} }
strncpy (cls.downloadtempname, cls.downloadname, sizeof(cls.downloadtempname)); strncpy (cls.downloadtempname, cls.downloadname, sizeof(cls.downloadtempname));
cls.download = fopen (cls.downloadname, "wb"); cls.download = Qopen (cls.downloadname, "wb");
cls.downloadtype = dl_single; cls.downloadtype = dl_single;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
@ -1161,7 +1184,7 @@ CL_Init
*/ */
void CL_Init (void) void CL_Init (void)
{ {
FILE *servlist; QFile *servlist;
char st[80]; char st[80];
cls.state = ca_disconnected; cls.state = ca_disconnected;
@ -1182,9 +1205,9 @@ void CL_Init (void)
Pmove_Init (); Pmove_Init ();
Server_List_Init (); //Init server list Server_List_Init (); //Init server list
if ((servlist = fopen("./servers.txt","r"))) { if ((servlist = Qopen("./servers.txt","r"))) {
Server_List_Load(servlist); Server_List_Load(servlist);
fclose(servlist); Qclose(servlist);
} }
@ -1459,11 +1482,11 @@ Writes key bindings and archived cvars to config.cfg
*/ */
void Host_WriteConfiguration (void) void Host_WriteConfiguration (void)
{ {
FILE *f; QFile *f;
if (host_initialized) if (host_initialized)
{ {
f = fopen (va("%s/config.cfg",com_gamedir), "w"); f = Qopen (va("%s/config.cfg",com_gamedir), "w");
if (!f) if (!f)
{ {
Con_Printf ("Couldn't write config.cfg.\n"); Con_Printf ("Couldn't write config.cfg.\n");
@ -1473,7 +1496,7 @@ void Host_WriteConfiguration (void)
Key_WriteBindings (f); Key_WriteBindings (f);
Cvar_WriteVariables (f); Cvar_WriteVariables (f);
fclose (f); Qclose (f);
} }
} }

View file

@ -33,7 +33,11 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "model.h"
#include "crc.h"
#include "msg.h"
#include "console.h"
#include "qendian.h"
#include "r_local.h" #include "r_local.h"
void SV_Error (char *error, ...); void SV_Error (char *error, ...);
@ -239,7 +243,7 @@ void * Mod_LoadAliasSkin (void * pin, int *pskinindex, int skinsize,
if (r_pixbytes == 1) if (r_pixbytes == 1)
{ {
Q_memcpy (pskin, pinskin, skinsize); memcpy (pskin, pinskin, skinsize);
} }
else if (r_pixbytes == 2) else if (r_pixbytes == 2)
{ {
@ -590,7 +594,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe)
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size*r_pixbytes, pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t) + size*r_pixbytes,
loadname); loadname);
Q_memset (pspriteframe, 0, sizeof (mspriteframe_t) + size); memset (pspriteframe, 0, sizeof (mspriteframe_t) + size);
*ppframe = pspriteframe; *ppframe = pspriteframe;
pspriteframe->width = width; pspriteframe->width = width;
@ -605,7 +609,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe)
if (r_pixbytes == 1) if (r_pixbytes == 1)
{ {
Q_memcpy (&pspriteframe->pixels[0], (byte *)(pinframe + 1), size); memcpy (&pspriteframe->pixels[0], (byte *)(pinframe + 1), size);
} }
else if (r_pixbytes == 2) else if (r_pixbytes == 2)
{ {

View file

@ -31,7 +31,16 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "client.h"
#include "cmd.h"
#include "screen.h"
#include "cdaudio.h"
#include "quakedef.h" #include "quakedef.h"
#include "bothdefs.h"
#include "console.h"
#include "msg.h"
#include "pmove.h"
#include "sbar.h"
/* extern cvar_t gl_flashblend; /* extern cvar_t gl_flashblend;
CVAR_FIXME */ CVAR_FIXME */
@ -170,7 +179,7 @@ to start a download from the server.
*/ */
qboolean CL_CheckOrDownloadFile (char *filename) qboolean CL_CheckOrDownloadFile (char *filename)
{ {
FILE *f; QFile *f;
if (strstr (filename, "..")) if (strstr (filename, ".."))
{ {
@ -181,7 +190,7 @@ qboolean CL_CheckOrDownloadFile (char *filename)
COM_FOpenFile (filename, &f); COM_FOpenFile (filename, &f);
if (f) if (f)
{ // it exists, no need to download { // it exists, no need to download
fclose (f); Qclose (f);
return true; return true;
} }
@ -369,7 +378,7 @@ void CL_ParseDownload (void)
if (cls.download) if (cls.download)
{ {
Con_Printf ("cls.download shouldn't have been set\n"); Con_Printf ("cls.download shouldn't have been set\n");
fclose (cls.download); Qclose (cls.download);
cls.download = NULL; cls.download = NULL;
} }
CL_RequestNextDownload (); CL_RequestNextDownload ();
@ -386,7 +395,7 @@ void CL_ParseDownload (void)
COM_CreatePath (name); COM_CreatePath (name);
cls.download = fopen (name, "wb"); cls.download = Qopen (name, "wb");
if (!cls.download) if (!cls.download)
{ {
msg_readcount += size; msg_readcount += size;
@ -396,7 +405,7 @@ void CL_ParseDownload (void)
} }
} }
fwrite (net_message.data + msg_readcount, 1, size, cls.download); Qwrite (cls.download, net_message.data + msg_readcount, size);
msg_readcount += size; msg_readcount += size;
if (percent != 100) if (percent != 100)
@ -425,7 +434,7 @@ void CL_ParseDownload (void)
Con_Printf ("100%%\n"); Con_Printf ("100%%\n");
#endif #endif
fclose (cls.download); Qclose (cls.download);
// rename the temp file to it's final name // rename the temp file to it's final name
if (strcmp(cls.downloadtempname, cls.downloadname)) { if (strcmp(cls.downloadtempname, cls.downloadname)) {
@ -540,7 +549,7 @@ CL_ParseServerData
void CL_ParseServerData (void) void CL_ParseServerData (void)
{ {
char *str; char *str;
FILE *f; QFile *f;
char fn[MAX_OSPATH]; char fn[MAX_OSPATH];
qboolean cflag = false; qboolean cflag = false;
extern char gamedirfile[MAX_OSPATH]; extern char gamedirfile[MAX_OSPATH];
@ -576,8 +585,8 @@ void CL_ParseServerData (void)
//if it exists //if it exists
if (cflag) { if (cflag) {
snprintf (fn, sizeof(fn), "%s/%s", com_gamedir, "config.cfg"); snprintf (fn, sizeof(fn), "%s/%s", com_gamedir, "config.cfg");
if ((f = fopen(fn, "r")) != NULL) { if ((f = Qopen(fn, "r")) != NULL) {
fclose(f); Qclose(f);
Cbuf_AddText ("cl_warncmd 0\n"); Cbuf_AddText ("cl_warncmd 0\n");
Cbuf_AddText("exec config.cfg\n"); Cbuf_AddText("exec config.cfg\n");
Cbuf_AddText("exec frontend.cfg\n"); Cbuf_AddText("exec frontend.cfg\n");
@ -1152,8 +1161,8 @@ void CL_ParseServerMessage (void)
i = MSG_ReadByte (); i = MSG_ReadByte ();
if (i >= MAX_LIGHTSTYLES) if (i >= MAX_LIGHTSTYLES)
Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
Q_strcpy (cl_lightstyle[i].map, MSG_ReadString()); strcpy (cl_lightstyle[i].map, MSG_ReadString());
cl_lightstyle[i].length = Q_strlen(cl_lightstyle[i].map); cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
break; break;
case svc_sound: case svc_sound:

View file

@ -29,8 +29,14 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "cvar.h"
#include "winquake.h" #include "client.h"
#include "pmove.h"
#include "bothdefs.h"
#include "console.h"
#include "commdef.h"
#include <math.h>
/* cvar_t cl_nopred = {"cl_nopred","0"}; /* cvar_t cl_nopred = {"cl_nopred","0"};
CVAR_FIXME */ CVAR_FIXME */

View file

@ -30,13 +30,16 @@
$Id$ $Id$
*/ */
#include <cl_slist.h> #ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cl_slist.h"
#include "bothdefs.h"
#include "console.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <bothdefs.h>
#include <common.h>
#include <console.h>
//Better watch out for buffer overflows //Better watch out for buffer overflows
server_entry_t slist[MAX_SERVER_LIST]; server_entry_t slist[MAX_SERVER_LIST];
@ -53,13 +56,13 @@ void Server_List_Init(void) { // Do this or everything else will sig11
void Server_List_Shutdown(void) { // I am the liberator of memory. void Server_List_Shutdown(void) { // I am the liberator of memory.
int i; int i;
FILE *f; QFile *f;
if (!(f = fopen("./servers.txt","w"))) { if (!(f = Qopen("./servers.txt","w"))) {
Con_Printf("Couldn't open servers.txt.\n"); Con_Printf("Couldn't open servers.txt.\n");
return; return;
} }
Server_List_Save(f); Server_List_Save(f);
fclose(f); Qclose(f);
for(i=0;i < MAX_SERVER_LIST;i++) { for(i=0;i < MAX_SERVER_LIST;i++) {
if (slist[i].server) if (slist[i].server)
free(slist[i].server); free(slist[i].server);
@ -123,7 +126,7 @@ int Server_List_Len (void) {
return i; return i;
} }
int Server_List_Load (FILE *f) { // This could get messy int Server_List_Load (QFile *f) { // This could get messy
int serv = 0; int serv = 0;
char line[256]; /* Long lines get truncated. */ char line[256]; /* Long lines get truncated. */
int c = ' '; /* int so it can be compared to EOF properly*/ int c = ' '; /* int so it can be compared to EOF properly*/
@ -140,7 +143,7 @@ int Server_List_Load (FILE *f) { // This could get messy
i = 0; i = 0;
c = ' '; c = ' ';
while (c != '\n' && c != EOF) { while (c != '\n' && c != EOF) {
c = getc(f); c = Qgetc(f);
if (i < 255) { if (i < 255) {
line[i] = c; line[i] = c;
i++; i++;
@ -166,11 +169,11 @@ int Server_List_Load (FILE *f) { // This could get messy
return 0; return 0;
} }
int Server_List_Save(FILE *f) { int Server_List_Save(QFile *f) {
int i; int i;
for(i=0;i < MAX_SERVER_LIST;i++) { for(i=0;i < MAX_SERVER_LIST;i++) {
if (slist[i].server) if (slist[i].server)
fprintf(f,"%s %s\n", Qprintf(f,"%s %s\n",
slist[i].server, slist[i].server,
slist[i].description); slist[i].description);
} }

View file

@ -45,6 +45,7 @@
#include <sys/mman.h> #include <sys/mman.h>
#include "sys.h" #include "sys.h"
#include "qargs.h"
#include "quakedef.h" #include "quakedef.h"
int noconinput = 0; int noconinput = 0;
@ -233,7 +234,7 @@ int main (int c, char **v)
j = COM_CheckParm("-mem"); j = COM_CheckParm("-mem");
if (j) if (j)
parms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024); parms.memsize = (int) (atof(com_argv[j+1]) * 1024 * 1024);
parms.membase = malloc (parms.memsize); parms.membase = malloc (parms.memsize);
if (!parms.membase) { if (!parms.membase) {
printf("Can't allocate memroy for zone.\n"); printf("Can't allocate memroy for zone.\n");

View file

@ -31,8 +31,15 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "ctype.h"
#include "render.h"
#include "protocol.h"
#include "client.h"
#include "msg.h"
#include "console.h"
#include <math.h>
#include <stdlib.h>
#define MAX_BEAMS 8 #define MAX_BEAMS 8
typedef struct typedef struct

View file

@ -31,7 +31,10 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "vid.h"
#include "client.h"
#include <string.h>
/* /*
===================== =====================

View file

@ -31,7 +31,16 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "cmd.h"
#include "cvar.h"
#include "sizebuf.h"
#include "zone.h"
#include "console.h"
#include "qargs.h"
#include "quakefs.h"
#include "commdef.h"
#include <string.h>
void Cmd_ForwardToServer (void); void Cmd_ForwardToServer (void);
@ -101,14 +110,14 @@ void Cbuf_AddText (char *text)
{ {
int l; int l;
l = Q_strlen (text); l = strlen (text);
if (cmd_text.cursize + l >= cmd_text.maxsize) if (cmd_text.cursize + l >= cmd_text.maxsize)
{ {
Con_Printf ("Cbuf_AddText: overflow\n"); Con_Printf ("Cbuf_AddText: overflow\n");
return; return;
} }
SZ_Write (&cmd_text, text, Q_strlen (text)); SZ_Write (&cmd_text, text, strlen (text));
} }
@ -131,7 +140,7 @@ void Cbuf_InsertText (char *text)
if (templen) if (templen)
{ {
temp = Z_Malloc (templen); temp = Z_Malloc (templen);
Q_memcpy (temp, cmd_text.data, templen); memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text); SZ_Clear (&cmd_text);
} }
else else
@ -190,7 +199,7 @@ void Cbuf_Execute (void)
{ {
i++; i++;
cmd_text.cursize -= i; cmd_text.cursize -= i;
Q_memcpy (text, text+i, cmd_text.cursize); memcpy (text, text+i, cmd_text.cursize);
} }
// execute the command line // execute the command line
@ -235,7 +244,7 @@ void Cmd_StuffCmds_f (void)
{ {
if (!com_argv[i]) if (!com_argv[i])
continue; // NEXTSTEP nulls out -NXHost continue; // NEXTSTEP nulls out -NXHost
s += Q_strlen (com_argv[i]) + 1; s += strlen (com_argv[i]) + 1;
} }
if (!s) if (!s)
return; return;
@ -246,9 +255,9 @@ void Cmd_StuffCmds_f (void)
{ {
if (!com_argv[i]) if (!com_argv[i])
continue; // NEXTSTEP nulls out -NXHost continue; // NEXTSTEP nulls out -NXHost
Q_strcat (text,com_argv[i]); strcat (text,com_argv[i]);
if (i != com_argc-1) if (i != com_argc-1)
Q_strcat (text, " "); strcat (text, " ");
} }
// pull out the commands // pull out the commands
@ -267,8 +276,8 @@ void Cmd_StuffCmds_f (void)
c = text[j]; c = text[j];
text[j] = 0; text[j] = 0;
Q_strcat (build, text+i); strcat (build, text+i);
Q_strcat (build, "\n"); strcat (build, "\n");
text[j] = c; text[j] = c;
i = j-1; i = j-1;
} }
@ -511,8 +520,8 @@ void Cmd_TokenizeString (char *text)
if (cmd_argc < MAX_ARGS) if (cmd_argc < MAX_ARGS)
{ {
cmd_argv[cmd_argc] = Z_Malloc (Q_strlen(com_token)+1); cmd_argv[cmd_argc] = Z_Malloc (strlen(com_token)+1);
Q_strcpy (cmd_argv[cmd_argc], com_token); strcpy (cmd_argv[cmd_argc], com_token);
cmd_argc++; cmd_argc++;
} }
} }
@ -542,7 +551,7 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function)
// fail if the command already exists // fail if the command already exists
for (cmd=cmd_functions ; cmd ; cmd=cmd->next) for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{ {
if (!Q_strcmp (cmd_name, cmd->name)) if (!strcmp (cmd_name, cmd->name))
{ {
Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name); Con_Printf ("Cmd_AddCommand: %s already defined\n", cmd_name);
return; return;
@ -567,7 +576,7 @@ qboolean Cmd_Exists (char *cmd_name)
for (cmd=cmd_functions ; cmd ; cmd=cmd->next) for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{ {
if (!Q_strcmp (cmd_name,cmd->name)) if (!strcmp (cmd_name,cmd->name))
return true; return true;
} }
@ -587,7 +596,7 @@ char *Cmd_CompleteCommand (char *partial)
int len; int len;
cmdalias_t *a; cmdalias_t *a;
len = Q_strlen(partial); len = strlen(partial);
if (!len) if (!len)
return NULL; return NULL;
@ -633,7 +642,7 @@ void Cmd_ExecuteString (char *text)
// check functions // check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next) for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{ {
if (!Q_strcasecmp (cmd_argv[0],cmd->name)) if (!strcasecmp (cmd_argv[0],cmd->name))
{ {
if (!cmd->function) if (!cmd->function)
Cmd_ForwardToServer (); Cmd_ForwardToServer ();
@ -646,7 +655,7 @@ void Cmd_ExecuteString (char *text)
// check alias // check alias
for (a=cmd_alias ; a ; a=a->next) for (a=cmd_alias ; a ; a=a->next)
{ {
if (!Q_strcasecmp (cmd_argv[0], a->name)) if (!strcasecmp (cmd_argv[0], a->name))
{ {
Cbuf_InsertText (a->value); Cbuf_InsertText (a->value);
return; return;
@ -679,7 +688,7 @@ int Cmd_CheckParm (char *parm)
Sys_Error ("Cmd_CheckParm: NULL"); Sys_Error ("Cmd_CheckParm: NULL");
for (i = 1; i < Cmd_Argc (); i++) for (i = 1; i < Cmd_Argc (); i++)
if (! Q_strcasecmp (parm, Cmd_Argv (i))) if (! strcasecmp (parm, Cmd_Argv (i)))
return i; return i;
return 0; return 0;
@ -716,3 +725,71 @@ void Cmd_Init (void)
Cmd_AddCommand ("cmdlist", Cmd_CmdList_f); Cmd_AddCommand ("cmdlist", Cmd_CmdList_f);
} }
char com_token[1024];
/*
==============
COM_Parse
Parse a token out of a string
==============
*/
char *COM_Parse (char *data)
{
int c;
int len;
len = 0;
com_token[0] = 0;
if (!data)
return NULL;
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
{
if (c == 0)
return NULL; // end of file;
data++;
}
// skip // comments
if (c=='/' && data[1] == '/')
{
while (*data && *data != '\n')
data++;
goto skipwhite;
}
// handle quoted strings specially
if (c == '\"')
{
data++;
while (1)
{
c = *data++;
if (c=='\"' || !c)
{
com_token[len] = 0;
return data;
}
com_token[len] = c;
len++;
}
}
// parse a regular word
do
{
com_token[len] = c;
data++;
len++;
c = *data;
} while (c>32);
com_token[len] = 0;
return data;
}

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,17 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "console.h"
#include "keys.h"
#include "client.h"
#include "draw.h"
#include "commdef.h"
#include "qargs.h"
#include "cmd.h"
#include "screen.h"
#include <stdarg.h>
#include <string.h>
int con_ormask; int con_ormask;
console_t con_main; console_t con_main;
@ -118,8 +128,8 @@ Con_Clear_f
*/ */
void Con_Clear_f (void) void Con_Clear_f (void)
{ {
Q_memset (con_main.text, ' ', CON_TEXTSIZE); memset (con_main.text, ' ', CON_TEXTSIZE);
Q_memset (con_chat.text, ' ', CON_TEXTSIZE); memset (con_chat.text, ' ', CON_TEXTSIZE);
} }
@ -180,7 +190,7 @@ void Con_Resize (console_t *con)
width = 38; width = 38;
con_linewidth = width; con_linewidth = width;
con_totallines = CON_TEXTSIZE / con_linewidth; con_totallines = CON_TEXTSIZE / con_linewidth;
Q_memset (con->text, ' ', CON_TEXTSIZE); memset (con->text, ' ', CON_TEXTSIZE);
} }
else else
{ {
@ -198,8 +208,8 @@ void Con_Resize (console_t *con)
if (con_linewidth < numchars) if (con_linewidth < numchars)
numchars = con_linewidth; numchars = con_linewidth;
Q_memcpy (tbuf, con->text, CON_TEXTSIZE); memcpy (tbuf, con->text, CON_TEXTSIZE);
Q_memset (con->text, ' ', CON_TEXTSIZE); memset (con->text, ' ', CON_TEXTSIZE);
for (i=0 ; i<numlines ; i++) for (i=0 ; i<numlines ; i++)
{ {
@ -275,7 +285,7 @@ void Con_Linefeed (void)
if (con->display == con->current) if (con->display == con->current)
con->display++; con->display++;
con->current++; con->current++;
Q_memset (&con->text[(con->current%con_totallines)*con_linewidth] memset (&con->text[(con->current%con_totallines)*con_linewidth]
, ' ', con_linewidth); , ' ', con_linewidth);
} }

View file

@ -29,7 +29,6 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h"
#include "crc.h" #include "crc.h"
// this is a 16 bit, non-reflected CRC using the polynomial 0x1021 // this is a 16 bit, non-reflected CRC using the polynomial 0x1021

View file

@ -32,7 +32,15 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "cvar.h"
#include "zone.h"
#include "console.h"
#include "qargs.h"
#include "cmd.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
cvar_t *cvar_vars; cvar_t *cvar_vars;
char *cvar_null_string = ""; char *cvar_null_string = "";
@ -49,7 +57,7 @@ cvar_t *Cvar_FindVar (char *var_name)
cvar_t *var; cvar_t *var;
for (var=cvar_vars ; var ; var=var->next) for (var=cvar_vars ; var ; var=var->next)
if (!Q_strcmp (var_name, var->name)) if (!strcmp (var_name, var->name))
return var; return var;
return NULL; return NULL;
@ -60,7 +68,7 @@ cvar_t *Cvar_FindAlias (char *alias_name)
cvar_alias_t *alias; cvar_alias_t *alias;
for (alias = calias_vars ; alias ; alias=alias->next) for (alias = calias_vars ; alias ; alias=alias->next)
if (!Q_strcmp (alias_name, alias->name)) if (!strcmp (alias_name, alias->name))
return alias->cvar; return alias->cvar;
return NULL; return NULL;
} }
@ -105,7 +113,7 @@ float Cvar_VariableValue (char *var_name)
var = Cvar_FindAlias(var_name); var = Cvar_FindAlias(var_name);
if (!var) if (!var)
return 0; return 0;
return Q_atof (var->string); return atof (var->string);
} }
@ -138,7 +146,7 @@ char *Cvar_CompleteVariable (char *partial)
cvar_alias_t *alias; cvar_alias_t *alias;
int len; int len;
len = Q_strlen(partial); len = strlen(partial);
if (!len) if (!len)
return NULL; return NULL;
@ -155,12 +163,12 @@ char *Cvar_CompleteVariable (char *partial)
// check partial match // check partial match
for (cvar=cvar_vars ; cvar ; cvar=cvar->next) for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
if (!Q_strncmp (partial,cvar->name, len)) if (!strncmp (partial,cvar->name, len))
return cvar->name; return cvar->name;
// check aliases too :) // check aliases too :)
for (alias=calias_vars ; alias ; alias=alias->next) for (alias=calias_vars ; alias ; alias=alias->next)
if (!Q_strncmp (partial, alias->name, len)) if (!strncmp (partial, alias->name, len))
return alias->name; return alias->name;
return NULL; return NULL;
@ -181,9 +189,9 @@ void Cvar_Set (cvar_t *var, char *value)
Z_Free (var->string); // free the old value string Z_Free (var->string); // free the old value string
var->string = Z_Malloc (Q_strlen(value)+1); var->string = Z_Malloc (strlen(value)+1);
Q_strcpy (var->string, value); strcpy (var->string, value);
var->value = Q_atof (var->string); var->value = atof (var->string);
Cvar_Info(var); Cvar_Info(var);
} }
@ -239,13 +247,13 @@ Writes lines containing "set variable value" for all variables
with the archive flag set to true. with the archive flag set to true.
============ ============
*/ */
void Cvar_WriteVariables (FILE *f) void Cvar_WriteVariables (QFile *f)
{ {
cvar_t *var; cvar_t *var;
for (var = cvar_vars ; var ; var = var->next) for (var = cvar_vars ; var ; var = var->next)
if (var->flags&CVAR_ARCHIVE) if (var->flags&CVAR_ARCHIVE)
fprintf (f, "%s \"%s\"\n", var->name, var->string); Qprintf (f, "%s \"%s\"\n", var->name, var->string);
} }
void Cvar_Set_f(void) void Cvar_Set_f(void)
@ -388,18 +396,18 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description)
v->next = cvar_vars; v->next = cvar_vars;
cvar_vars = v; cvar_vars = v;
v->name = strdup(name); v->name = strdup(name);
v->string = Z_Malloc (Q_strlen(string)+1); v->string = Z_Malloc (strlen(string)+1);
Q_strcpy (v->string, string); strcpy (v->string, string);
v->flags = cvarflags; v->flags = cvarflags;
v->description = strdup(description); v->description = strdup(description);
v->value = Q_atof (v->string); v->value = atof (v->string);
return v; return v;
} }
// Cvar does exist, so we update the flags and return. // Cvar does exist, so we update the flags and return.
v->flags ^= CVAR_USER_CREATED; v->flags ^= CVAR_USER_CREATED;
v->flags ^= CVAR_HEAP; v->flags ^= CVAR_HEAP;
v->flags |= cvarflags; v->flags |= cvarflags;
if (!Q_strcmp (v->description,"User created cvar")) if (!strcmp (v->description,"User created cvar"))
{ {
// Set with the real description // Set with the real description
free(v->description); free(v->description);

View file

@ -30,7 +30,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "d_iface.h"
/* /*

View file

@ -30,7 +30,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "bothdefs.h"
#include "d_local.h" #include "d_local.h"
#define NUM_MIPS 4 #define NUM_MIPS 4

View file

@ -31,10 +31,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "qargs.h"
#include "d_local.h" #include "d_local.h"
#include "r_local.h" #include "r_local.h"
#include <stdlib.h>
float surfscale; float surfscale;
qboolean r_cache_thrash; // set if surface cache is thrashing qboolean r_cache_thrash; // set if surface cache is thrashing
@ -50,7 +52,7 @@ int D_SurfaceCacheForRes (int width, int height)
if (COM_CheckParm ("-surfcachesize")) if (COM_CheckParm ("-surfcachesize"))
{ {
size = Q_atoi(com_argv[COM_CheckParm("-surfcachesize")+1]) * 1024; size = atoi(com_argv[COM_CheckParm("-surfcachesize")+1]) * 1024;
return size; return size;
} }

View file

@ -32,7 +32,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "draw.h"
#include "vid.h"
#include "d_iface.h"
#include "console.h"
#include "quakefs.h"
#include "sound.h"
typedef struct { typedef struct {
vrect_t rect; vrect_t rect;
@ -398,7 +403,7 @@ void Draw_Pic (int x, int y, qpic_t *pic)
for (v=0 ; v<pic->height ; v++) for (v=0 ; v<pic->height ; v++)
{ {
Q_memcpy (dest, source, pic->width); memcpy (dest, source, pic->width);
dest += vid.rowbytes; dest += vid.rowbytes;
source += pic->width; source += pic->width;
} }
@ -449,7 +454,7 @@ void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int h
for (v=0 ; v<height ; v++) for (v=0 ; v<height ; v++)
{ {
Q_memcpy (dest, source, width); memcpy (dest, source, width);
dest += vid.rowbytes; dest += vid.rowbytes;
source += pic->width; source += pic->width;
} }

View file

@ -34,7 +34,6 @@
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
@ -388,7 +387,7 @@ void Draw_TextureMode_f (void)
for (i=0 ; i< 6 ; i++) for (i=0 ; i< 6 ; i++)
{ {
if (!Q_strcasecmp (modes[i].name, Cmd_Argv(1) ) ) if (!strcasecmp (modes[i].name, Cmd_Argv(1) ) )
break; break;
} }
if (i == 6) if (i == 6)
@ -441,8 +440,8 @@ void Draw_Init (void)
cl_verstring = Cvar_Get("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, "None"); cl_verstring = Cvar_Get("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, "None");
// 3dfx can only handle 256 wide textures // 3dfx can only handle 256 wide textures
if (!Q_strncasecmp ((char *)gl_renderer, "3dfx",4) || if (!strncasecmp ((char *)gl_renderer, "3dfx",4) ||
!Q_strncasecmp ((char *)gl_renderer, "Mesa",4)) !strncasecmp ((char *)gl_renderer, "Mesa",4))
Cvar_Set (gl_max_size, "256"); Cvar_Set (gl_max_size, "256");
Cmd_AddCommand ("gl_texturemode", &Draw_TextureMode_f); Cmd_AddCommand ("gl_texturemode", &Draw_TextureMode_f);

View file

@ -33,8 +33,8 @@
#include <stdio.h> #include <stdio.h>
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "qendian.h"
#include "common.h" #include "quakefs.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
@ -320,7 +320,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
int *cmds; int *cmds;
trivertx_t *verts; trivertx_t *verts;
char cache[MAX_QPATH], fullpath[MAX_OSPATH]; char cache[MAX_QPATH], fullpath[MAX_OSPATH];
FILE *f; QFile *f;
aliasmodel = m; aliasmodel = m;
paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m); paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m);
@ -335,11 +335,11 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
COM_FOpenFile (cache, &f); COM_FOpenFile (cache, &f);
if (f) if (f)
{ {
fread (&numcommands, 4, 1, f); Qread (f, &numcommands, 4);
fread (&numorder, 4, 1, f); Qread (f, &numorder, 4);
fread (&commands, numcommands * sizeof(commands[0]), 1, f); Qread (f, &commands, numcommands * sizeof(commands[0]));
fread (&vertexorder, numorder * sizeof(vertexorder[0]), 1, f); Qread (f, &vertexorder, numorder * sizeof(vertexorder[0]));
fclose (f); Qclose (f);
} }
else else
{ {
@ -354,22 +354,22 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
// save out the cached version // save out the cached version
// //
snprintf (fullpath, sizeof(fullpath), "%s/%s", com_gamedir, cache); snprintf (fullpath, sizeof(fullpath), "%s/%s", com_gamedir, cache);
f = fopen (fullpath, "wb"); f = Qopen (fullpath, "wb");
if (!f) { if (!f) {
char gldir[MAX_OSPATH]; char gldir[MAX_OSPATH];
snprintf (gldir, sizeof(gldir), "%s/glquake", com_gamedir); snprintf (gldir, sizeof(gldir), "%s/glquake", com_gamedir);
Sys_mkdir (gldir); Sys_mkdir (gldir);
f = fopen (fullpath, "wb"); f = Qopen (fullpath, "wb");
} }
if (f) if (f)
{ {
fwrite (&numcommands, 4, 1, f); Qwrite (f, &numcommands, 4);
fwrite (&numorder, 4, 1, f); Qwrite (f, &numorder, 4);
fwrite (&commands, numcommands * sizeof(commands[0]), 1, f); Qwrite (f, &commands, numcommands * sizeof(commands[0]));
fwrite (&vertexorder, numorder * sizeof(vertexorder[0]), 1, f); Qwrite (f, &vertexorder, numorder * sizeof(vertexorder[0]));
fclose (f); Qclose (f);
} }
} }

View file

@ -37,8 +37,8 @@
#include <stdio.h> #include <stdio.h>
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "qendian.h"
#include "common.h" #include "msg.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
@ -584,7 +584,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t),loadname); pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t),loadname);
Q_memset (pspriteframe, 0, sizeof (mspriteframe_t)); memset (pspriteframe, 0, sizeof (mspriteframe_t));
*ppframe = pspriteframe; *ppframe = pspriteframe;

View file

@ -33,7 +33,6 @@
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"

View file

@ -29,8 +29,32 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "qargs.h"
#include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "d_iface.h"
#include "bspfile.h" // needed by: glquake.h
#include "vid.h"
#include "sys.h"
#include "zone.h" // needed by: client.h, gl_model.h
#include "mathlib.h" // needed by: protocol.h, render.h, client.h,
// modelgen.h, glmodel.h
#include "wad.h"
#include "draw.h"
#include "cvar.h"
#include "menu.h"
#include "net.h" // needed by: client.h
#include "protocol.h" // needed by: client.h
#include "cmd.h"
#include "sbar.h"
#include "render.h" // needed by: client.h, gl_model.h, glquake.h
#include "client.h" // need cls in this file
#include "model.h" // needed by: glquake.h
#include "console.h"
#include "glquake.h" #include "glquake.h"
#include "quakefs.h"
#include "quakedef.h"
#include <stdlib.h>
#define MAX_PARTICLES 2048 // default max # of particles at one #define MAX_PARTICLES 2048 // default max # of particles at one
// time // time
@ -62,7 +86,7 @@ void R_InitParticles (void)
if (i) if (i)
{ {
r_numparticles = (int)(Q_atoi(com_argv[i+1])); r_numparticles = (int)(atoi(com_argv[i+1]));
if (r_numparticles < ABSOLUTE_MIN_PARTICLES) if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES; r_numparticles = ABSOLUTE_MIN_PARTICLES;
} }
@ -96,13 +120,14 @@ void R_ClearParticles (void)
void R_ReadPointFile_f (void) void R_ReadPointFile_f (void)
{ {
FILE *f; QFile *f;
vec3_t org; vec3_t org;
int r; int r;
int c; int c;
particle_t *p; particle_t *p;
char name[MAX_OSPATH]; char name[MAX_OSPATH];
char buf[256];
// FIXME sprintf (name,"maps/%s.pts", sv.name); // FIXME sprintf (name,"maps/%s.pts", sv.name);
COM_FOpenFile (name, &f); COM_FOpenFile (name, &f);
@ -116,7 +141,9 @@ void R_ReadPointFile_f (void)
c = 0; c = 0;
for ( ;; ) for ( ;; )
{ {
r = fscanf (f,"%f %f %f\n", &org[0], &org[1], &org[2]); if (!Qgets(f,buf,sizeof(buf)))
break;
r = sscanf (buf,"%f %f %f\n", &org[0], &org[1], &org[2]);
if (r != 3) if (r != 3)
break; break;
c++; c++;
@ -138,7 +165,7 @@ void R_ReadPointFile_f (void)
VectorCopy (org, p->org); VectorCopy (org, p->org);
} }
fclose (f); Qclose (f);
Con_Printf ("%i points read\n", c); Con_Printf ("%i points read\n", c);
} }

View file

@ -30,6 +30,29 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "qargs.h"
#include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "d_iface.h"
#include "bspfile.h" // needed by: glquake.h
#include "vid.h"
#include "sys.h"
#include "zone.h" // needed by: client.h, gl_model.h
#include "mathlib.h" // needed by: protocol.h, render.h, client.h,
// modelgen.h, glmodel.h
#include "wad.h"
#include "draw.h"
#include "cvar.h"
#include "menu.h"
#include "net.h" // needed by: client.h
#include "protocol.h" // needed by: client.h
#include "cmd.h"
#include "sbar.h"
#include "render.h" // needed by: client.h, gl_model.h, glquake.h
#include "client.h" // need cls in this file
#include "model.h" // needed by: glquake.h
#include "console.h"
#include "glquake.h"
#include "quakefs.h"
#include "quakedef.h" #include "quakedef.h"
mnode_t *r_pefragtopnode; mnode_t *r_pefragtopnode;

View file

@ -34,7 +34,6 @@
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"

View file

@ -35,7 +35,6 @@
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"

View file

@ -33,7 +33,6 @@
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
@ -537,9 +536,9 @@ void R_NewMap (void)
{ {
if (!cl.worldmodel->textures[i]) if (!cl.worldmodel->textures[i])
continue; continue;
if (!Q_strncmp(cl.worldmodel->textures[i]->name,"sky",3) ) if (!strncmp(cl.worldmodel->textures[i]->name,"sky",3) )
skytexturenum = i; skytexturenum = i;
if (!Q_strncmp(cl.worldmodel->textures[i]->name,"window02_1",10) ) if (!strncmp(cl.worldmodel->textures[i]->name,"window02_1",10) )
mirrortexturenum = i; mirrortexturenum = i;
cl.worldmodel->textures[i]->texturechain = NULL; cl.worldmodel->textures[i]->texturechain = NULL;
} }

View file

@ -34,8 +34,7 @@
#include <math.h> #include <math.h>
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "qargs.h"
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"

View file

@ -36,8 +36,7 @@
#include <time.h> #include <time.h>
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "qendian.h"
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
@ -810,11 +809,11 @@ void WritePCXfile (char *filename, byte *data, int width, int height,
pcx->ymax = LittleShort((short)(height-1)); pcx->ymax = LittleShort((short)(height-1));
pcx->hres = LittleShort((short)width); pcx->hres = LittleShort((short)width);
pcx->vres = LittleShort((short)height); pcx->vres = LittleShort((short)height);
Q_memset (pcx->palette,0,sizeof(pcx->palette)); memset (pcx->palette,0,sizeof(pcx->palette));
pcx->color_planes = 1; // chunky image pcx->color_planes = 1; // chunky image
pcx->bytes_per_line = LittleShort((short)width); pcx->bytes_per_line = LittleShort((short)width);
pcx->palette_type = LittleShort(2); // not a grey scale pcx->palette_type = LittleShort(2); // not a grey scale
Q_memset (pcx->filler,0,sizeof(pcx->filler)); memset (pcx->filler,0,sizeof(pcx->filler));
// pack the image // pack the image
pack = &pcx->data; pack = &pcx->data;

View file

@ -32,6 +32,7 @@
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "quakedef.h"
#include "protocol.h"
#include "glquake.h" #include "glquake.h"
/* /*

View file

@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"

View file

@ -35,8 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "bothdefs.h" // needed by: common.h, net.h, client.h #include "bothdefs.h" // needed by: common.h, net.h, client.h
#include "quakefs.h"
#include "common.h"
#include "bspfile.h" // needed by: glquake.h #include "bspfile.h" // needed by: glquake.h
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
@ -358,7 +357,7 @@ byte *pcx_rgb;
LoadPCX LoadPCX
============ ============
*/ */
void LoadPCX (FILE *f) void LoadPCX (QFile *f)
{ {
pcx_t *pcx, pcxbuf; pcx_t *pcx, pcxbuf;
byte palette[768]; byte palette[768];
@ -370,7 +369,7 @@ void LoadPCX (FILE *f)
// //
// parse the PCX file // parse the PCX file
// //
fread (&pcxbuf, 1, sizeof(pcxbuf), f); Qread (f, &pcxbuf, sizeof(pcxbuf));
pcx = &pcxbuf; pcx = &pcxbuf;
@ -386,10 +385,10 @@ void LoadPCX (FILE *f)
} }
// seek to palette // seek to palette
fseek (f, -768, SEEK_END); Qseek (f, -768, SEEK_END);
fread (palette, 1, 768, f); Qread (f, palette, 768);
fseek (f, sizeof(pcxbuf) - 4, SEEK_SET); Qseek (f, sizeof(pcxbuf) - 4, SEEK_SET);
count = (pcx->xmax+1) * (pcx->ymax+1); count = (pcx->xmax+1) * (pcx->ymax+1);
pcx_rgb = malloc( count * 4); pcx_rgb = malloc( count * 4);
@ -399,12 +398,12 @@ void LoadPCX (FILE *f)
pix = pcx_rgb + 4*y*(pcx->xmax+1); pix = pcx_rgb + 4*y*(pcx->xmax+1);
for (x=0 ; x<=pcx->ymax ; ) for (x=0 ; x<=pcx->ymax ; )
{ {
dataByte = fgetc(f); dataByte = Qgetc(f);
if((dataByte & 0xC0) == 0xC0) if((dataByte & 0xC0) == 0xC0)
{ {
runLength = dataByte & 0x3F; runLength = dataByte & 0x3F;
dataByte = fgetc(f); dataByte = Qgetc(f);
} }
else else
runLength = 1; runLength = 1;
@ -442,24 +441,24 @@ typedef struct _TargaHeader {
TargaHeader targa_header; TargaHeader targa_header;
byte *targa_rgba; byte *targa_rgba;
int fgetLittleShort (FILE *f) int fgetLittleShort (QFile *f)
{ {
byte b1, b2; byte b1, b2;
b1 = fgetc(f); b1 = Qgetc(f);
b2 = fgetc(f); b2 = Qgetc(f);
return (short)(b1 + b2*256); return (short)(b1 + b2*256);
} }
int fgetLittleLong (FILE *f) int fgetLittleLong (QFile *f)
{ {
byte b1, b2, b3, b4; byte b1, b2, b3, b4;
b1 = fgetc(f); b1 = Qgetc(f);
b2 = fgetc(f); b2 = Qgetc(f);
b3 = fgetc(f); b3 = Qgetc(f);
b4 = fgetc(f); b4 = Qgetc(f);
return b1 + (b2<<8) + (b3<<16) + (b4<<24); return b1 + (b2<<8) + (b3<<16) + (b4<<24);
} }
@ -470,26 +469,26 @@ int fgetLittleLong (FILE *f)
LoadTGA LoadTGA
============= =============
*/ */
void LoadTGA (FILE *fin) void LoadTGA (QFile *fin)
{ {
int columns, rows, numPixels; int columns, rows, numPixels;
byte *pixbuf; byte *pixbuf;
int row, column; int row, column;
unsigned char red = 0, green = 0, blue = 0, alphabyte = 0; unsigned char red = 0, green = 0, blue = 0, alphabyte = 0;
targa_header.id_length = fgetc(fin); targa_header.id_length = Qgetc(fin);
targa_header.colormap_type = fgetc(fin); targa_header.colormap_type = Qgetc(fin);
targa_header.image_type = fgetc(fin); targa_header.image_type = Qgetc(fin);
targa_header.colormap_index = fgetLittleShort(fin); targa_header.colormap_index = fgetLittleShort(fin);
targa_header.colormap_length = fgetLittleShort(fin); targa_header.colormap_length = fgetLittleShort(fin);
targa_header.colormap_size = fgetc(fin); targa_header.colormap_size = Qgetc(fin);
targa_header.x_origin = fgetLittleShort(fin); targa_header.x_origin = fgetLittleShort(fin);
targa_header.y_origin = fgetLittleShort(fin); targa_header.y_origin = fgetLittleShort(fin);
targa_header.width = fgetLittleShort(fin); targa_header.width = fgetLittleShort(fin);
targa_header.height = fgetLittleShort(fin); targa_header.height = fgetLittleShort(fin);
targa_header.pixel_size = fgetc(fin); targa_header.pixel_size = Qgetc(fin);
targa_header.attributes = fgetc(fin); targa_header.attributes = Qgetc(fin);
if (targa_header.image_type!=2 if (targa_header.image_type!=2
&& targa_header.image_type!=10) && targa_header.image_type!=10)
@ -506,7 +505,7 @@ void LoadTGA (FILE *fin)
targa_rgba = malloc (numPixels*4); targa_rgba = malloc (numPixels*4);
if (targa_header.id_length != 0) if (targa_header.id_length != 0)
fseek(fin, targa_header.id_length, SEEK_CUR); // skip TARGA image comment Qseek(fin, targa_header.id_length, SEEK_CUR); // skip TARGA image comment
if (targa_header.image_type==2) { // Uncompressed, RGB images if (targa_header.image_type==2) { // Uncompressed, RGB images
for(row=rows-1; row>=0; row--) { for(row=rows-1; row>=0; row--) {
@ -515,19 +514,19 @@ void LoadTGA (FILE *fin)
switch (targa_header.pixel_size) { switch (targa_header.pixel_size) {
case 24: case 24:
blue = getc(fin); blue = Qgetc(fin);
green = getc(fin); green = Qgetc(fin);
red = getc(fin); red = Qgetc(fin);
*pixbuf++ = red; *pixbuf++ = red;
*pixbuf++ = green; *pixbuf++ = green;
*pixbuf++ = blue; *pixbuf++ = blue;
*pixbuf++ = 255; *pixbuf++ = 255;
break; break;
case 32: case 32:
blue = getc(fin); blue = Qgetc(fin);
green = getc(fin); green = Qgetc(fin);
red = getc(fin); red = Qgetc(fin);
alphabyte = getc(fin); alphabyte = Qgetc(fin);
*pixbuf++ = red; *pixbuf++ = red;
*pixbuf++ = green; *pixbuf++ = green;
*pixbuf++ = blue; *pixbuf++ = blue;
@ -542,21 +541,21 @@ void LoadTGA (FILE *fin)
for(row=rows-1; row>=0; row--) { for(row=rows-1; row>=0; row--) {
pixbuf = targa_rgba + row*columns*4; pixbuf = targa_rgba + row*columns*4;
for(column=0; column<columns; ) { for(column=0; column<columns; ) {
packetHeader=getc(fin); packetHeader=Qgetc(fin);
packetSize = 1 + (packetHeader & 0x7f); packetSize = 1 + (packetHeader & 0x7f);
if (packetHeader & 0x80) { // run-length packet if (packetHeader & 0x80) { // run-length packet
switch (targa_header.pixel_size) { switch (targa_header.pixel_size) {
case 24: case 24:
blue = getc(fin); blue = Qgetc(fin);
green = getc(fin); green = Qgetc(fin);
red = getc(fin); red = Qgetc(fin);
alphabyte = 255; alphabyte = 255;
break; break;
case 32: case 32:
blue = getc(fin); blue = Qgetc(fin);
green = getc(fin); green = Qgetc(fin);
red = getc(fin); red = Qgetc(fin);
alphabyte = getc(fin); alphabyte = Qgetc(fin);
break; break;
} }
@ -580,19 +579,19 @@ void LoadTGA (FILE *fin)
for(j=0;j<packetSize;j++) { for(j=0;j<packetSize;j++) {
switch (targa_header.pixel_size) { switch (targa_header.pixel_size) {
case 24: case 24:
blue = getc(fin); blue = Qgetc(fin);
green = getc(fin); green = Qgetc(fin);
red = getc(fin); red = Qgetc(fin);
*pixbuf++ = red; *pixbuf++ = red;
*pixbuf++ = green; *pixbuf++ = green;
*pixbuf++ = blue; *pixbuf++ = blue;
*pixbuf++ = 255; *pixbuf++ = 255;
break; break;
case 32: case 32:
blue = getc(fin); blue = Qgetc(fin);
green = getc(fin); green = Qgetc(fin);
red = getc(fin); red = Qgetc(fin);
alphabyte = getc(fin); alphabyte = Qgetc(fin);
*pixbuf++ = red; *pixbuf++ = red;
*pixbuf++ = green; *pixbuf++ = green;
*pixbuf++ = blue; *pixbuf++ = blue;
@ -615,7 +614,7 @@ void LoadTGA (FILE *fin)
} }
} }
fclose(fin); Qclose(fin);
} }
/* /*
@ -627,7 +626,7 @@ char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
void R_LoadSkys (char * skyname) void R_LoadSkys (char * skyname)
{ {
int i; int i;
FILE *f; QFile *f;
char name[64]; char name[64];
if (stricmp (skyname, "none") == 0) if (stricmp (skyname, "none") == 0)

View file

@ -33,8 +33,18 @@
#include <windows.h> #include <windows.h>
#endif #endif
#include "qtypes.h"
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "keys.h"
#include "menu.h"
#include "cmd.h"
#include "zone.h"
#include "console.h"
#include "cvar.h"
#include "screen.h"
#include "client.h"
#include <string.h>
/* /*
@ -235,8 +245,8 @@ void CompleteCommand (void)
if (cmd) if (cmd)
{ {
key_lines[edit_line][1] = '/'; key_lines[edit_line][1] = '/';
Q_strcpy (key_lines[edit_line]+2, cmd); strcpy (key_lines[edit_line]+2, cmd);
key_linepos = Q_strlen(cmd)+2; key_linepos = strlen(cmd)+2;
key_lines[edit_line][key_linepos] = ' '; key_lines[edit_line][key_linepos] = ' ';
key_linepos++; key_linepos++;
key_lines[edit_line][key_linepos] = 0; key_lines[edit_line][key_linepos] = 0;
@ -307,8 +317,8 @@ void Key_Console (int key)
&& !key_lines[history_line][1]); && !key_lines[history_line][1]);
if (history_line == edit_line) if (history_line == edit_line)
history_line = (edit_line+1)&31; history_line = (edit_line+1)&31;
Q_strcpy(key_lines[edit_line], key_lines[history_line]); strcpy(key_lines[edit_line], key_lines[history_line]);
key_linepos = Q_strlen(key_lines[edit_line]); key_linepos = strlen(key_lines[edit_line]);
return; return;
} }
@ -328,8 +338,8 @@ void Key_Console (int key)
} }
else else
{ {
Q_strcpy(key_lines[edit_line], key_lines[history_line]); strcpy(key_lines[edit_line], key_lines[history_line]);
key_linepos = Q_strlen(key_lines[edit_line]); key_linepos = strlen(key_lines[edit_line]);
} }
return; return;
} }
@ -475,7 +485,7 @@ int Key_StringToKeynum (char *str)
for (kn=keynames ; kn->name ; kn++) for (kn=keynames ; kn->name ; kn++)
{ {
if (!Q_strcasecmp(str,kn->name)) if (!strcasecmp(str,kn->name))
return kn->keynum; return kn->keynum;
} }
return -1; return -1;
@ -533,9 +543,9 @@ void Key_SetBinding (int keynum, char *binding)
} }
// allocate memory for new binding // allocate memory for new binding
l = Q_strlen (binding); l = strlen (binding);
new = Z_Malloc (l+1); new = Z_Malloc (l+1);
Q_strcpy (new, binding); strcpy (new, binding);
new[l] = 0; new[l] = 0;
keybindings[keynum] = new; keybindings[keynum] = new;
} }
@ -627,13 +637,13 @@ Key_WriteBindings
Writes lines containing "bind key value" Writes lines containing "bind key value"
============ ============
*/ */
void Key_WriteBindings (FILE *f) void Key_WriteBindings (QFile *f)
{ {
int i; int i;
for (i=0 ; i<256 ; i++) for (i=0 ; i<256 ; i++)
if (keybindings[i]) if (keybindings[i])
fprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]); Qprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
} }

View file

@ -31,7 +31,8 @@
# include <config.h> # include <config.h>
#endif #endif
#include <math.h> #include <math.h>
#include "quakedef.h" #include "qtypes.h"
#include "mathlib.h"
void Sys_Error (char *error, ...); void Sys_Error (char *error, ...);

View file

@ -34,7 +34,16 @@
#ifdef _WIN32 #ifdef _WIN32
#include "winquake.h" #include "winquake.h"
#endif #endif
#include <cl_slist.h> #include "cl_slist.h"
#include "keys.h"
#include "menu.h"
#include "vid.h"
#include "draw.h"
#include "cmd.h"
#include "screen.h"
#include "client.h"
#include "console.h"
#include "view.h"
void (*vid_menudrawfn)(void); void (*vid_menudrawfn)(void);
void (*vid_menukeyfn)(int key); void (*vid_menukeyfn)(int key);

View file

@ -33,7 +33,15 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "qwsvdef.h" #include "model.h"
#include "quakefs.h"
#include "qendian.h"
#include "checksum.h"
#include <math.h>
#include <string.h>
void SV_Error (char *error, ...);
extern int texture_mode; extern int texture_mode;
@ -355,7 +363,7 @@ void Mod_LoadTextures (lump_t *l)
// the pixels immediately follow the structures // the pixels immediately follow the structures
memcpy ( tx+1, mt+1, pixels); memcpy ( tx+1, mt+1, pixels);
if (!Q_strncmp(mt->name,"sky",3)) if (!strncmp(mt->name,"sky",3))
R_InitSky (tx); R_InitSky (tx);
else else
{ {
@ -766,7 +774,7 @@ void Mod_LoadFaces (lump_t *l)
// set the drawing flags flag // set the drawing flags flag
if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky if (!strncmp(out->texinfo->texture->name,"sky",3)) // sky
{ {
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
#ifndef QUAKE2 #ifndef QUAKE2
@ -775,7 +783,7 @@ void Mod_LoadFaces (lump_t *l)
continue; continue;
} }
if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent if (!strncmp(out->texinfo->texture->name,"*",1)) // turbulent
{ {
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED); out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
for (i=0 ; i<2 ; i++) for (i=0 ; i<2 ; i++)

View file

@ -28,14 +28,24 @@
#ifndef _WIN32 #ifndef _WIN32
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include "config.h"
#endif #endif
# include <unistd.h> # include <unistd.h>
#else #else
# include <windows.h> # include <windows.h>
#endif #endif
#include "quakedef.h" #include <time.h>
#include <stdarg.h>
#include "qtypes.h"
#include "console.h"
#include "msg.h"
#include "sizebuf.h"
#include "cvar.h"
#include "net.h"
#include "client.h"
#include "commdef.h"
#define PACKET_HEADER 8 #define PACKET_HEADER 8
@ -89,14 +99,8 @@ to the new value before sending out any replies.
*/ */
int net_drop; int net_drop;
/* cvar_t showpackets = {"showpackets", "0"};
CVAR_FIXME */
cvar_t *showpackets; cvar_t *showpackets;
/* cvar_t showdrop = {"showdrop", "0"};
CVAR_FIXME */
cvar_t *showdrop; cvar_t *showdrop;
/* cvar_t qport = {"qport", "0"};
CVAR_FIXME */
cvar_t *qport; cvar_t *qport;
extern qboolean is_server; extern qboolean is_server;
@ -117,14 +121,8 @@ void Netchan_Init (void)
port = ((int)(getpid()+getuid()*1000) * time(NULL)) & 0xffff; port = ((int)(getpid()+getuid()*1000) * time(NULL)) & 0xffff;
#endif #endif
/* Cvar_RegisterVariable (&showpackets);
CVAR_FIXME */
showpackets = Cvar_Get("showpackets", "0", CVAR_NONE, "None"); showpackets = Cvar_Get("showpackets", "0", CVAR_NONE, "None");
/* Cvar_RegisterVariable (&showdrop);
CVAR_FIXME */
showdrop = Cvar_Get("showdrop", "0", CVAR_NONE, "None"); showdrop = Cvar_Get("showdrop", "0", CVAR_NONE, "None");
/* Cvar_RegisterVariable (&qport);
CVAR_FIXME */
qport = Cvar_Get("qport", "0", CVAR_NONE, "None"); qport = Cvar_Get("qport", "0", CVAR_NONE, "None");
qport->value = port; qport->value = port;
} }
@ -331,8 +329,6 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data)
if (ServerPaused()) if (ServerPaused())
chan->cleartime = realtime; chan->cleartime = realtime;
/* if (showpackets.value)
CVAR_FIXME */
if (showpackets->value) if (showpackets->value)
Con_Printf ("--> s=%i(%i) a=%i(%i) %i\n" Con_Printf ("--> s=%i(%i) a=%i(%i) %i\n"
, chan->outgoing_sequence , chan->outgoing_sequence
@ -384,8 +380,6 @@ qboolean Netchan_Process (netchan_t *chan)
sequence &= ~(1<<31); sequence &= ~(1<<31);
sequence_ack &= ~(1<<31); sequence_ack &= ~(1<<31);
/* if (showpackets.value)
CVAR_FIXME */
if (showpackets->value) if (showpackets->value)
Con_Printf ("<-- s=%i(%i) a=%i(%i) %i\n" Con_Printf ("<-- s=%i(%i) a=%i(%i) %i\n"
, sequence , sequence
@ -429,8 +423,6 @@ qboolean Netchan_Process (netchan_t *chan)
// //
if (sequence <= (unsigned)chan->incoming_sequence) if (sequence <= (unsigned)chan->incoming_sequence)
{ {
/* if (showdrop.value)
CVAR_FIXME */
if (showdrop->value) if (showdrop->value)
Con_Printf ("%s:Out of order packet %i at %i\n" Con_Printf ("%s:Out of order packet %i at %i\n"
, NET_AdrToString (chan->remote_address) , NET_AdrToString (chan->remote_address)
@ -447,8 +439,6 @@ qboolean Netchan_Process (netchan_t *chan)
{ {
chan->drop_count += 1; chan->drop_count += 1;
/* if (showdrop.value)
CVAR_FIXME */
if (showdrop->value) if (showdrop->value)
Con_Printf ("%s:Dropped %i packets at %i\n" Con_Printf ("%s:Dropped %i packets at %i\n"
, NET_AdrToString (chan->remote_address) , NET_AdrToString (chan->remote_address)

View file

@ -31,8 +31,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "net.h"
#include "qargs.h"
#include "console.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>

View file

@ -29,7 +29,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "compat.h"
#include "qtypes.h"
#include "client.h"
#include "pmove.h"
#include <math.h>
movevars_t movevars; movevars_t movevars;

View file

@ -30,7 +30,10 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "qtypes.h"
#include "pmove.h"
#include "model.h"
#include "console.h"
static hull_t box_hull; static hull_t box_hull;
static dclipnode_t box_clipnodes[6]; static dclipnode_t box_clipnodes[6];

View file

@ -29,7 +29,21 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "qwsvdef.h" #include "pr_comp.h"
#include "progs.h"
#include "console.h"
#include "server.h"
#include "world.h"
#include "msg.h"
#include "cmd.h"
#include "commdef.h"
#include "info.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
void SV_Error (char *error, ...);
#define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e)) #define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
#define RETURN_STRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(s)) #define RETURN_STRING(s) (((int *)pr_globals)[OFS_RETURN] = PR_SetString(s))
@ -1562,8 +1576,8 @@ void PF_logfrag (void)
SZ_Print (&svs.log[svs.logsequence&1], s); SZ_Print (&svs.log[svs.logsequence&1], s);
if (sv_fraglogfile) { if (sv_fraglogfile) {
fprintf (sv_fraglogfile, s); Qprintf (sv_fraglogfile, s);
fflush (sv_fraglogfile); Qflush (sv_fraglogfile);
} }
} }

View file

@ -30,7 +30,23 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "qwsvdef.h" #include "pr_comp.h"
#include "progs.h"
#include "console.h"
#include "server.h"
#include "world.h"
#include "msg.h"
#include "cmd.h"
#include "commdef.h"
#include "crc.h"
#include "qendian.h"
#include "quakefs.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
void SV_Error (char *error, ...);
dprograms_t *progs; dprograms_t *progs;
dfunction_t *pr_functions; dfunction_t *pr_functions;
@ -561,7 +577,7 @@ void ED_PrintEdict_f (void)
{ {
int i; int i;
i = Q_atoi (Cmd_Argv(1)); i = atoi (Cmd_Argv(1));
Con_Printf ("\n EDICT %i:\n",i); Con_Printf ("\n EDICT %i:\n",i);
ED_PrintNum (i); ED_PrintNum (i);
} }

View file

@ -29,8 +29,22 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "qwsvdef.h" #include "pr_comp.h"
#include "progs.h"
#include "console.h"
#include "server.h"
#include "world.h"
#include "msg.h"
#include "cmd.h"
#include "commdef.h"
#include "sys.h"
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void SV_Error (char *error, ...);
/* /*

View file

@ -31,7 +31,8 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "console.h"
#include "d_ifacea.h"
#include "r_local.h" #include "r_local.h"
#include "d_local.h" // FIXME: shouldn't be needed (is needed for patch #include "d_local.h" // FIXME: shouldn't be needed (is needed for patch
// right now, but that should move) // right now, but that should move)

View file

@ -30,9 +30,11 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "console.h"
#include "r_local.h" #include "r_local.h"
#include <math.h>
// //
// current entity info // current entity info
// //

View file

@ -29,7 +29,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "d_ifacea.h"
#include "r_local.h" #include "r_local.h"
#if 0 #if 0

View file

@ -30,7 +30,8 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "console.h"
#include "bothdefs.h"
#include "r_local.h" #include "r_local.h"
mnode_t *r_pefragtopnode; mnode_t *r_pefragtopnode;

View file

@ -30,9 +30,14 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "cmd.h"
#include "bothdefs.h"
#include "screen.h"
#include "console.h"
#include "r_local.h" #include "r_local.h"
#include <math.h>
//define PASSAGES //define PASSAGES
void *colormap; void *colormap;

View file

@ -30,8 +30,13 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "console.h"
#include "cmd.h"
#include "sbar.h"
#include "r_local.h" #include "r_local.h"
#include "draw.h"
#include "menu.h"
#include "quakedef.h"
qboolean allowskybox; // whether or not to allow skyboxes --KB qboolean allowskybox; // whether or not to allow skyboxes --KB

View file

@ -29,8 +29,13 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "qargs.h"
#include "r_local.h" #include "r_local.h"
#include "console.h"
#include "quakefs.h"
#include "quakedef.h"
#include <stdlib.h>
#define MAX_PARTICLES 2048 // default max # of particles at one #define MAX_PARTICLES 2048 // default max # of particles at one
// time // time
@ -62,7 +67,7 @@ void R_InitParticles (void)
if (i) if (i)
{ {
r_numparticles = (int)(Q_atoi(com_argv[i+1])); r_numparticles = (int)(atoi(com_argv[i+1]));
if (r_numparticles < ABSOLUTE_MIN_PARTICLES) if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
r_numparticles = ABSOLUTE_MIN_PARTICLES; r_numparticles = ABSOLUTE_MIN_PARTICLES;
} }
@ -96,12 +101,13 @@ void R_ClearParticles (void)
void R_ReadPointFile_f (void) void R_ReadPointFile_f (void)
{ {
FILE *f; QFile *f;
vec3_t org; vec3_t org;
int r; int r;
int c; int c;
particle_t *p; particle_t *p;
char name[MAX_OSPATH]; char name[MAX_OSPATH];
char buf[256];
// FIXME sprintf (name,"maps/%s.pts", sv.name); // FIXME sprintf (name,"maps/%s.pts", sv.name);
@ -116,7 +122,9 @@ void R_ReadPointFile_f (void)
c = 0; c = 0;
for ( ;; ) for ( ;; )
{ {
r = fscanf (f,"%f %f %f\n", &org[0], &org[1], &org[2]); if (!Qgets(f,buf,sizeof(buf)))
break;
r = sscanf (buf,"%f %f %f\n", &org[0], &org[1], &org[2]);
if (r != 3) if (r != 3)
break; break;
c++; c++;
@ -138,7 +146,7 @@ void R_ReadPointFile_f (void)
VectorCopy (org, p->org); VectorCopy (org, p->org);
} }
fclose (f); Qclose (f);
Con_Printf ("%i points read\n", c); Con_Printf ("%i points read\n", c);
} }

View file

@ -30,9 +30,11 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "console.h"
#include "r_local.h" #include "r_local.h"
#include <math.h>
static int clip_current; static int clip_current;
static vec5_t clip_verts[2][MAXWORKINGVERTS]; static vec5_t clip_verts[2][MAXWORKINGVERTS];
static int sprite_width, sprite_height; static int sprite_width, sprite_height;
@ -98,7 +100,7 @@ int R_ClipSpriteFace (int nump, clipplane_t *pclipplane)
// handle wraparound case // handle wraparound case
dists[nump] = dists[0]; dists[nump] = dists[0];
Q_memcpy (instep, in, sizeof (vec5_t)); memcpy (instep, in, sizeof (vec5_t));
// clip the winding // clip the winding
@ -109,7 +111,7 @@ int R_ClipSpriteFace (int nump, clipplane_t *pclipplane)
{ {
if (dists[i] >= 0) if (dists[i] >= 0)
{ {
Q_memcpy (outstep, instep, sizeof (vec5_t)); memcpy (outstep, instep, sizeof (vec5_t));
outstep += sizeof (vec5_t) / sizeof (float); outstep += sizeof (vec5_t) / sizeof (float);
outcount++; outcount++;
} }

View file

@ -30,8 +30,16 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "view.h"
#include "bothdefs.h"
#include "screen.h"
#include "cmd.h"
#include "r_local.h" #include "r_local.h"
#include "msg.h"
#include "commdef.h"
#include <stdlib.h>
#include <math.h>
/* /*

View file

@ -30,8 +30,19 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "sbar.h"
#include "screen.h"
#include "vid.h"
#include "wad.h"
#include "commdef.h"
#include "draw.h"
#include "cmd.h"
#include "client.h"
#include "bothdefs.h"
#include "msg.h"
#include <stdlib.h>
#include <string.h>
int sb_updates; // if >= vid.numpages, no update needed int sb_updates; // if >= vid.numpages, no update needed

View file

@ -31,10 +31,22 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "screen.h"
#include "r_local.h" #include "r_local.h"
#include "wad.h"
#include "compat.h"
#include "draw.h"
#include "quakedef.h"
#include "keys.h"
#include "console.h"
#include "msg.h"
#include "sbar.h"
#include "menu.h"
#include "qendian.h"
#include "cmd.h"
#include <time.h> #include <time.h>
#include <string.h>
/* /*
@ -700,11 +712,11 @@ void WritePCXfile (char *filename, byte *data, int width, int height,
pcx->ymax = LittleShort((short)(height-1)); pcx->ymax = LittleShort((short)(height-1));
pcx->hres = LittleShort((short)width); pcx->hres = LittleShort((short)width);
pcx->vres = LittleShort((short)height); pcx->vres = LittleShort((short)height);
Q_memset (pcx->palette,0,sizeof(pcx->palette)); memset (pcx->palette,0,sizeof(pcx->palette));
pcx->color_planes = 1; // chunky image pcx->color_planes = 1; // chunky image
pcx->bytes_per_line = LittleShort((short)width); pcx->bytes_per_line = LittleShort((short)width);
pcx->palette_type = LittleShort(2); // not a grey scale pcx->palette_type = LittleShort(2); // not a grey scale
Q_memset (pcx->filler,0,sizeof(pcx->filler)); memset (pcx->filler,0,sizeof(pcx->filler));
// pack the image // pack the image
pack = &pcx->data; pack = &pcx->data;

View file

@ -30,7 +30,13 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "cmd.h"
#include "msg.h"
#include "client.h"
#include "console.h"
#include "commdef.h"
#include <string.h>
/* cvar_t baseskin = {"baseskin", "base"}; /* cvar_t baseskin = {"baseskin", "base"};
CVAR_FIXME */ CVAR_FIXME */

View file

@ -31,6 +31,11 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "sound.h"
#include "cmd.h"
#include "console.h"
#include "client.h"
#include "qargs.h"
#include "quakedef.h" #include "quakedef.h"
#ifdef _WIN32 #ifdef _WIN32
@ -38,6 +43,9 @@
#include "in_win.h" #include "in_win.h"
#endif #endif
#include <string.h>
#include <stdlib.h>
void S_Play(void); void S_Play(void);
void S_PlayVol(void); void S_PlayVol(void);
void S_SoundList(void); void S_SoundList(void);
@ -320,12 +328,12 @@ sfx_t *S_FindName (char *name)
if (!name) if (!name)
Sys_Error ("S_FindName: NULL\n"); Sys_Error ("S_FindName: NULL\n");
if (Q_strlen(name) >= MAX_QPATH) if (strlen(name) >= MAX_QPATH)
Sys_Error ("Sound name too long: %s", name); Sys_Error ("Sound name too long: %s", name);
// see if already loaded // see if already loaded
for (i=0 ; i < num_sfx ; i++) for (i=0 ; i < num_sfx ; i++)
if (!Q_strcmp(known_sfx[i].name, name)) if (!strcmp(known_sfx[i].name, name))
{ {
return &known_sfx[i]; return &known_sfx[i];
} }
@ -589,7 +597,7 @@ void S_StopAllSounds(qboolean clear)
if (channels[i].sfx) if (channels[i].sfx)
channels[i].sfx = NULL; channels[i].sfx = NULL;
Q_memset(channels, 0, MAX_CHANNELS * sizeof(channel_t)); memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
if (clear) if (clear)
S_ClearBuffer (); S_ClearBuffer ();
@ -645,7 +653,7 @@ void S_ClearBuffer (void)
} }
} }
Q_memset(pData, clear, shm->samples * shm->samplebits/8); memset(pData, clear, shm->samples * shm->samplebits/8);
pDSBuf->lpVtbl->Unlock(pDSBuf, pData, dwSize, NULL, 0); pDSBuf->lpVtbl->Unlock(pDSBuf, pData, dwSize, NULL, 0);
@ -653,7 +661,7 @@ void S_ClearBuffer (void)
else else
#endif #endif
{ {
Q_memset(shm->buffer, clear, shm->samples * shm->samplebits/8); memset(shm->buffer, clear, shm->samples * shm->samplebits/8);
} }
} }
@ -976,13 +984,13 @@ void S_Play(void)
i = 1; i = 1;
while (i<Cmd_Argc()) while (i<Cmd_Argc())
{ {
if (!Q_strrchr(Cmd_Argv(i), '.')) if (!strrchr(Cmd_Argv(i), '.'))
{ {
Q_strcpy(name, Cmd_Argv(i)); strcpy(name, Cmd_Argv(i));
Q_strcat(name, ".wav"); strcat(name, ".wav");
} }
else else
Q_strcpy(name, Cmd_Argv(i)); strcpy(name, Cmd_Argv(i));
sfx = S_PrecacheSound(name); sfx = S_PrecacheSound(name);
S_StartSound(hash++, 0, sfx, listener_origin, 1.0, 1.0); S_StartSound(hash++, 0, sfx, listener_origin, 1.0, 1.0);
i++; i++;
@ -1000,15 +1008,15 @@ void S_PlayVol(void)
i = 1; i = 1;
while (i<Cmd_Argc()) while (i<Cmd_Argc())
{ {
if (!Q_strrchr(Cmd_Argv(i), '.')) if (!strrchr(Cmd_Argv(i), '.'))
{ {
Q_strcpy(name, Cmd_Argv(i)); strcpy(name, Cmd_Argv(i));
Q_strcat(name, ".wav"); strcat(name, ".wav");
} }
else else
Q_strcpy(name, Cmd_Argv(i)); strcpy(name, Cmd_Argv(i));
sfx = S_PrecacheSound(name); sfx = S_PrecacheSound(name);
vol = Q_atof(Cmd_Argv(i+1)); vol = atof(Cmd_Argv(i+1));
S_StartSound(hash++, 0, sfx, listener_origin, vol, 1.0); S_StartSound(hash++, 0, sfx, listener_origin, vol, 1.0);
i+=2; i+=2;
} }

View file

@ -31,7 +31,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include "sys.h" #include "sys.h"
#include "quakedef.h" #include "sound.h"
#include "qendian.h"
#include "quakefs.h"
#include "console.h"
#include <string.h>
int cache_full_cycle; int cache_full_cycle;
@ -125,8 +130,8 @@ sfxcache_t *S_LoadSound (sfx_t *s)
//Con_Printf ("S_LoadSound: %x\n", (int)stackbuf); //Con_Printf ("S_LoadSound: %x\n", (int)stackbuf);
// load it in // load it in
Q_strcpy(namebuffer, "sound/"); strcpy(namebuffer, "sound/");
Q_strcat(namebuffer, s->name); strcat(namebuffer, s->name);
// Con_Printf ("loading %s\n",namebuffer); // Con_Printf ("loading %s\n",namebuffer);
@ -226,7 +231,7 @@ void FindNextChunk(char *name)
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); // Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8; data_p -= 8;
last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 ); last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 );
if (!Q_strncmp(data_p, name, 4)) if (!strncmp(data_p, name, 4))
return; return;
} }
} }
@ -278,7 +283,7 @@ wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength)
// find "RIFF" chunk // find "RIFF" chunk
FindChunk("RIFF"); FindChunk("RIFF");
if (!(data_p && !Q_strncmp(data_p+8, "WAVE", 4))) if (!(data_p && !strncmp(data_p+8, "WAVE", 4)))
{ {
Con_Printf("Missing RIFF/WAVE chunks\n"); Con_Printf("Missing RIFF/WAVE chunks\n");
return info; return info;

View file

@ -30,7 +30,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
#endif #endif
#include "quakedef.h" #include "sound.h"
#ifdef _WIN32 #ifdef _WIN32
#include "winquake.h" #include "winquake.h"
@ -289,7 +289,7 @@ void S_PaintChannels(int endtime)
end = paintedtime + PAINTBUFFER_SIZE; end = paintedtime + PAINTBUFFER_SIZE;
// clear the paint buffer // clear the paint buffer
Q_memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t)); memset(paintbuffer, 0, (end - paintedtime) * sizeof(portable_samplepair_t));
// paint in the channels. // paint in the channels.
ch = channels; ch = channels;

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