prelim header changes. doesn't build yet

This commit is contained in:
Bill Currie 2000-08-21 03:52:28 +00:00
parent 0a132a2933
commit 2718705414
30 changed files with 305 additions and 351 deletions

View file

@ -26,7 +26,10 @@
$Id$ $Id$
*/ */
#ifndef __bspfile_h
#define __bspfile_h
#include "qtypes.h"
// upper design bounds // upper design bounds
@ -299,7 +302,7 @@ void PrintBSPFileSizes (void);
//=============== //===============
/*
typedef struct epair_s typedef struct epair_s
{ {
struct epair_s *next; struct epair_s *next;
@ -329,5 +332,7 @@ vec_t FloatForKey (entity_t *ent, char *key);
void GetVectorForKey (entity_t *ent, char *key, vec3_t vec); void GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
epair_t *ParseEpair (void); epair_t *ParseEpair (void);
*/
#endif #endif
#endif // __bspfile_h

View file

@ -1,7 +1,7 @@
/* /*
cdaudio.h cdaudio.h
@description@ Redbook CD Audio function prototypes
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
@ -26,6 +26,9 @@
$Id$ $Id$
*/ */
#ifndef __cdaudio_h
#define __cdaudio_h
int CDAudio_Init(void); int CDAudio_Init(void);
void CDAudio_Play(byte track, qboolean looping); void CDAudio_Play(byte track, qboolean looping);
@ -35,4 +38,4 @@ void CDAudio_Resume(void);
void CDAudio_Shutdown(void); void CDAudio_Shutdown(void);
void CDAudio_Update(void); void CDAudio_Update(void);
extern cvar_t *bgmvolume; #endif // __cdaudio_h

View file

@ -26,6 +26,20 @@
$Id$ $Id$
*/ */
#ifndef __client_h
#define __client_h
#include <stdio.h>
#include "info.h"
#include "mathlib.h"
#include "protocol.h"
#include "net.h"
#include "model.h"
#include "sound.h"
#include "render.h"
#include "cvar.h"
#include "quakefs.h"
typedef struct typedef struct
{ {
@ -382,3 +396,5 @@ void V_SetContentsColor (int contents);
// //
void CL_InitTEnts (void); void CL_InitTEnts (void);
void CL_SignonReply (void); void CL_SignonReply (void);
#endif // __client_h

View file

@ -29,6 +29,8 @@
#ifndef __cmd_h #ifndef __cmd_h
#define __cmd_h #define __cmd_h
#include "qtypes.h"
//=========================================================================== //===========================================================================
/* /*

View file

@ -1,5 +1,5 @@
/* /*
common.h sizebuf.h
@description@ @description@
@ -26,18 +26,8 @@
$Id$ $Id$
*/ */
#ifndef __sizebuf_h
#if !defined BYTE_DEFINED #define __sizebuf_h
typedef unsigned char byte;
#define BYTE_DEFINED 1
#endif
#undef true
#undef false
typedef enum {false, true} qboolean;
//============================================================================
typedef struct sizebuf_s typedef struct sizebuf_s
{ {
@ -55,137 +45,4 @@ void *SZ_GetSpace (sizebuf_t *buf, int length);
void SZ_Write (sizebuf_t *buf, void *data, int length); void SZ_Write (sizebuf_t *buf, void *data, int length);
void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf
//============================================================================ #endif // __sizebuf_h
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);
//============================================================================
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);
extern int msg_readcount;
extern qboolean msg_badread; // set if a read goes beyond end of message
void MSG_BeginReading (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);
float MSG_ReadCoord (void);
float MSG_ReadAngle (void);
//============================================================================
void Q_memset (void *dest, int fill, int count);
void Q_memcpy (void *dest, void *src, int count);
int Q_memcmp (void *m1, void *m2, int count);
void Q_strcpy (char *dest, char *src);
void Q_strncpy (char *dest, char *src, int count);
int Q_strlen (char *str);
char *Q_strrchr (char *s, char c);
void Q_strcat (char *dest, char *src);
int Q_strcmp (char *s1, char *s2);
int Q_strncmp (char *s1, char *s2, int count);
int Q_strcasecmp (char *s1, char *s2);
int Q_strncasecmp (char *s1, char *s2, int n);
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_Init (char *path);
void COM_InitArgv (int argc, char **argv);
char *COM_SkipPath (char *pathname);
void COM_StripExtension (char *in, char *out);
void COM_FileBase (char *in, char *out);
void COM_DefaultExtension (char *path, char *extension);
char *va(char *format, ...);
// does a varargs printf into a temp buffer
//============================================================================
extern int com_filesize;
struct cache_user_s;
extern char com_gamedir[MAX_OSPATH];
void COM_WriteFile (char *filename, void *data, int len);
int COM_OpenFile (char *filename, int *hndl);
int COM_FOpenFile (char *filename, FILE **file);
void COM_CloseFile (int 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);
extern struct cvar_s *registered;
extern qboolean standard_quake, rogue, hipnotic;

View file

@ -26,14 +26,11 @@
$Id$ $Id$
*/ */
#ifndef __mathlib_h
#define __mathlib_h
typedef float vec_t; #include <math.h>
typedef vec_t vec3_t[3]; #include "qtypes.h"
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
@ -95,3 +92,5 @@ float anglemod(float a);
) \ ) \
: \ : \
BoxOnPlaneSide( (emins), (emaxs), (p))) BoxOnPlaneSide( (emins), (emaxs), (p)))
#endif // __mathlib_h

View file

@ -27,11 +27,15 @@
*/ */
#ifndef __MODEL__ #ifndef __model_h
#define __MODEL__ #define __model_h
#include "modelgen.h" #include "qtypes.h"
#include "render.h"
#include "bspfile.h"
#include "spritegn.h" #include "spritegn.h"
#include "modelgen.h"
#include "zone.h"
/* /*
@ -388,4 +392,4 @@ void Mod_TouchModel (char *name);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model); mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model); byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
#endif // __MODEL__ #endif // __model_h

View file

@ -26,6 +26,12 @@
$Id$ $Id$
*/ */
#ifndef __net_h
#define __net_h
#include "gcc_attr.h"
#include "sizebuf.h"
#include "cvar.h"
struct qsockaddr struct qsockaddr
{ {
@ -352,3 +358,5 @@ extern cvar_t *config_modem_clear;
extern cvar_t *config_modem_init; extern cvar_t *config_modem_init;
extern cvar_t *config_modem_hangup; extern cvar_t *config_modem_hangup;
extern cvar_t *hostname; extern cvar_t *hostname;
#endif // __net_h

View file

@ -26,6 +26,10 @@
$Id$ $Id$
*/ */
#ifndef __net_udp_h
#define __net_udp_h
#include "qtypes.h"
int UDP_Init (void); int UDP_Init (void);
void UDP_Shutdown (void); void UDP_Shutdown (void);
@ -45,3 +49,5 @@ int UDP_GetAddrFromName (char *name, struct qsockaddr *addr);
int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2); int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
int UDP_GetSocketPort (struct qsockaddr *addr); int UDP_GetSocketPort (struct qsockaddr *addr);
int UDP_SetSocketPort (struct qsockaddr *addr, int port); int UDP_SetSocketPort (struct qsockaddr *addr, int port);
#endif // __net_udp_h

View file

@ -29,9 +29,6 @@
// this file is shared by quake and qcc // this file is shared by quake and qcc
typedef int func_t;
typedef int string_t;
typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t; typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;

View file

@ -26,9 +26,15 @@
$Id$ $Id$
*/ */
#ifndef __progs_h
#define __progs_h
#include "gcc_attr.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
{ {
@ -141,3 +147,4 @@ void ED_PrintNum (int ent);
eval_t *GetEdictFieldValue(edict_t *ed, char *field); eval_t *GetEdictFieldValue(edict_t *ed, char *field);
#endif // __progs_h

View file

@ -26,6 +26,8 @@
$Id$ $Id$
*/ */
#ifndef __protocol_h
#define __protocol_h
#define PROTOCOL_VERSION 15 #define PROTOCOL_VERSION 15
@ -173,3 +175,16 @@
#define TE_IMPLOSION 14 #define TE_IMPLOSION 14
#define TE_RAILTRAIL 15 #define TE_RAILTRAIL 15
#endif #endif
typedef struct entity_state_s
{
vec3_t origin;
vec3_t angles;
int modelindex;
int frame;
int colormap;
int skin;
int effects;
} entity_state_t;
#endif // __protocol_h

View file

@ -204,25 +204,13 @@ void VID_UnlockBuffer (void);
// Use for multiplayer testing only - VERY dangerous!!! // Use for multiplayer testing only - VERY dangerous!!!
// #define IDGODS // #define IDGODS
#include "common.h" //#include "common.h"
#include "bspfile.h" #include "bspfile.h"
#include "vid.h" #include "vid.h"
#include "sys.h" #include "sys.h"
#include "zone.h" #include "zone.h"
#include "mathlib.h" #include "mathlib.h"
typedef struct
{
vec3_t origin;
vec3_t angles;
int modelindex;
int frame;
int colormap;
int skin;
int effects;
} entity_state_t;
#include "wad.h" #include "wad.h"
#include "draw.h" #include "draw.h"
#include "cvar.h" #include "cvar.h"
@ -257,27 +245,6 @@ typedef struct
#include "glquake.h" #include "glquake.h"
#endif #endif
//=============================================================================
// the host system specifies the base of the directory tree, the
// command line parms passed to the program, and the amount of memory
// available for the program to use
typedef struct
{
char *basedir;
char *cachedir; // for development over ISDN lines
int argc;
char **argv;
void *membase;
int memsize;
} quakeparms_t;
//=============================================================================
extern qboolean noclip_anglehack; extern qboolean noclip_anglehack;

View file

@ -26,6 +26,12 @@
$Id$ $Id$
*/ */
#ifndef __render_h
#define __render_h
#include "mathlib.h"
#include "cvar.h"
#include "vid.h"
#define MAXCLIPPLANES 11 #define MAXCLIPPLANES 11
@ -163,3 +169,4 @@ void D_DeleteSurfaceCache (void);
void D_InitCaches (void *buffer, int size); void D_InitCaches (void *buffer, int size);
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj); void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
#endif // __render_h

View file

@ -26,6 +26,22 @@
$Id$ $Id$
*/ */
#ifndef __server_h
#define __server_h
#include <setjmp.h>
#include "gcc_attr.h"
#include "commdef.h"
#include "net.h"
#include "cvar.h"
#include "protocol.h"
#include "model.h"
#include "progs.h"
#include "sizebuf.h"
#include "info.h"
#include "quakeio.h"
#include "client.h"
typedef struct typedef struct
{ {
@ -277,3 +293,5 @@ void SV_SpawnServer (char *server, char *startspot);
#else #else
void SV_SpawnServer (char *server); void SV_SpawnServer (char *server);
#endif #endif
#endif // __server_h

View file

@ -27,8 +27,12 @@
*/ */
#ifndef __SOUND__ #ifndef __sound_h
#define __SOUND__ #define __sound_h
#include "mathlib.h"
#include "cvar.h"
#include "zone.h"
#define DEFAULT_SOUND_PACKET_VOLUME 255 #define DEFAULT_SOUND_PACKET_VOLUME 255
#define DEFAULT_SOUND_PACKET_ATTENUATION 1.0 #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0
@ -183,4 +187,4 @@ void SNDDMA_Submit(void);
void S_AmbientOff (void); void S_AmbientOff (void);
void S_AmbientOn (void); void S_AmbientOn (void);
#endif #endif // __sound_h

View file

@ -26,13 +26,12 @@
$Id$ $Id$
*/ */
#ifndef __vid_h
#define __vid_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;
@ -92,3 +91,4 @@ int VID_SetMode (int modenum, unsigned char *palette);
void VID_HandlePause (qboolean pause); void VID_HandlePause (qboolean pause);
// called only on Win32, when pause happens, so the mouse can be released // called only on Win32, when pause happens, so the mouse can be released
#endif // __vid_h

View file

@ -26,6 +26,9 @@
$Id$ $Id$
*/ */
#ifndef __zone_h
#define __zone_h
/* /*
memory allocation memory allocation
@ -136,5 +139,4 @@ void *Cache_Alloc (cache_user_t *c, int size, char *name);
void Cache_Report (void); void Cache_Report (void);
#endif // __zone_h

View file

@ -48,7 +48,7 @@ sound_ASM= snd_mixa.S
common_ASM= sys_ia32.S worlda.S $(math_ASM) common_ASM= sys_ia32.S worlda.S $(math_ASM)
#endif #endif
common_SOURCES= crc.c common.c cvar.c cmd.c mathlib.c wad.c world.c \ common_SOURCES= crc.c cvar.c cmd.c mathlib.c wad.c world.c \
zone.c $(common_ASM) zone.c $(common_ASM)
# #

View file

@ -43,7 +43,12 @@
#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"
#include "client.h"
static qboolean cdValid = false; static qboolean cdValid = false;
static qboolean playing = false; static qboolean playing = false;
@ -228,13 +233,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();
@ -242,7 +247,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)
@ -253,7 +258,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)
@ -264,11 +269,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;
@ -284,37 +289,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();
@ -323,7 +328,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

@ -30,7 +30,18 @@
# include "config.h" # include "config.h"
#endif #endif
#include "quakedef.h" #include <string.h>
#include "cmd.h"
#include "client.h"
#include "msg.h"
#include "quakefs.h"
#include "qargs.h"
#include "zone.h"
#include "console.h"
#include "sys.h"
#include "sizebuf.h"
#include "cvar.h"
void Cmd_ForwardToServer (void); void Cmd_ForwardToServer (void);
@ -98,7 +109,7 @@ 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)
{ {
@ -106,7 +117,7 @@ void Cbuf_AddText (char *text)
return; return;
} }
SZ_Write (&cmd_text, text, Q_strlen (text)); SZ_Write (&cmd_text, text, strlen (text));
} }
@ -129,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
@ -188,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
@ -239,7 +250,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;
@ -250,9 +261,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
@ -271,8 +282,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;
} }
@ -526,8 +537,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++;
} }
} }
@ -557,7 +568,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;
@ -582,7 +593,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;
} }
@ -601,14 +612,14 @@ char *Cmd_CompleteCommand (char *partial)
cmd_function_t *cmd; cmd_function_t *cmd;
int len; int len;
len = Q_strlen(partial); len = strlen(partial);
if (!len) if (!len)
return NULL; return NULL;
// check functions // check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next) for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
if (!Q_strncmp (partial,cmd->name, len)) if (!strncmp (partial,cmd->name, len))
return cmd->name; return cmd->name;
return NULL; return NULL;
@ -637,7 +648,7 @@ void Cmd_ExecuteString (char *text, cmd_source_t src)
// 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))
{ {
cmd->function (); cmd->function ();
return; return;
@ -647,7 +658,7 @@ void Cmd_ExecuteString (char *text, cmd_source_t src)
// 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;
@ -680,7 +691,7 @@ void Cmd_ForwardToServer (void)
return; // not really connected return; // not really connected
MSG_WriteByte (&cls.message, clc_stringcmd); MSG_WriteByte (&cls.message, clc_stringcmd);
if (Q_strcasecmp(Cmd_Argv(0), "cmd") != 0) if (strcasecmp(Cmd_Argv(0), "cmd") != 0)
{ {
SZ_Print (&cls.message, Cmd_Argv(0)); SZ_Print (&cls.message, Cmd_Argv(0));
SZ_Print (&cls.message, " "); SZ_Print (&cls.message, " ");
@ -709,7 +720,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;

View file

@ -30,6 +30,10 @@
# include "config.h" # include "config.h"
#endif #endif
#include "qendian.h"
#include "msg.h"
#include "qargs.h"
// This is enables a simple IP banning mechanism // This is enables a simple IP banning mechanism
#define BAN_TEST #define BAN_TEST
@ -140,8 +144,8 @@ void NET_Ban_f (void)
case 1: case 1:
if (((struct in_addr *)&banAddr)->s_addr) if (((struct in_addr *)&banAddr)->s_addr)
{ {
Q_strcpy(addrStr, inet_ntoa(*(struct in_addr *)&banAddr)); strcpy(addrStr, inet_ntoa(*(struct in_addr *)&banAddr));
Q_strcpy(maskStr, inet_ntoa(*(struct in_addr *)&banMask)); strcpy(maskStr, inet_ntoa(*(struct in_addr *)&banMask));
print("Banning %s [%s]\n", addrStr, maskStr); print("Banning %s [%s]\n", addrStr, maskStr);
} }
else else
@ -149,7 +153,7 @@ void NET_Ban_f (void)
break; break;
case 2: case 2:
if (Q_strcasecmp(Cmd_Argv(1), "off") == 0) if (strcasecmp(Cmd_Argv(1), "off") == 0)
banAddr = 0x00000000; banAddr = 0x00000000;
else else
banAddr = inet_addr(Cmd_Argv(1)); banAddr = inet_addr(Cmd_Argv(1));
@ -186,7 +190,7 @@ int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data)
Sys_Error("SendMessage: called with canSend == false\n"); Sys_Error("SendMessage: called with canSend == false\n");
#endif #endif
Q_memcpy(sock->sendMessage, data->data, data->cursize); memcpy(sock->sendMessage, data->data, data->cursize);
sock->sendMessageLength = data->cursize; sock->sendMessageLength = data->cursize;
if (data->cursize <= MAX_DATAGRAM) if (data->cursize <= MAX_DATAGRAM)
@ -203,7 +207,7 @@ int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data)
packetBuffer.length = BigLong(packetLen | (NETFLAG_DATA | eom)); packetBuffer.length = BigLong(packetLen | (NETFLAG_DATA | eom));
packetBuffer.sequence = BigLong(sock->sendSequence++); packetBuffer.sequence = BigLong(sock->sendSequence++);
Q_memcpy (packetBuffer.data, sock->sendMessage, dataLen); memcpy (packetBuffer.data, sock->sendMessage, dataLen);
sock->canSend = false; sock->canSend = false;
@ -236,7 +240,7 @@ int SendMessageNext (qsocket_t *sock)
packetBuffer.length = BigLong(packetLen | (NETFLAG_DATA | eom)); packetBuffer.length = BigLong(packetLen | (NETFLAG_DATA | eom));
packetBuffer.sequence = BigLong(sock->sendSequence++); packetBuffer.sequence = BigLong(sock->sendSequence++);
Q_memcpy (packetBuffer.data, sock->sendMessage, dataLen); memcpy (packetBuffer.data, sock->sendMessage, dataLen);
sock->sendNext = false; sock->sendNext = false;
@ -269,7 +273,7 @@ int ReSendMessage (qsocket_t *sock)
packetBuffer.length = BigLong(packetLen | (NETFLAG_DATA | eom)); packetBuffer.length = BigLong(packetLen | (NETFLAG_DATA | eom));
packetBuffer.sequence = BigLong(sock->sendSequence - 1); packetBuffer.sequence = BigLong(sock->sendSequence - 1);
Q_memcpy (packetBuffer.data, sock->sendMessage, dataLen); memcpy (packetBuffer.data, sock->sendMessage, dataLen);
sock->sendNext = false; sock->sendNext = false;
@ -313,7 +317,7 @@ int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
packetBuffer.length = BigLong(packetLen | NETFLAG_UNRELIABLE); packetBuffer.length = BigLong(packetLen | NETFLAG_UNRELIABLE);
packetBuffer.sequence = BigLong(sock->unreliableSendSequence++); packetBuffer.sequence = BigLong(sock->unreliableSendSequence++);
Q_memcpy (packetBuffer.data, data->data, data->cursize); memcpy (packetBuffer.data, data->data, data->cursize);
if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1) if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1)
return -1; return -1;
@ -424,7 +428,7 @@ int Datagram_GetMessage (qsocket_t *sock)
sock->sendMessageLength -= MAX_DATAGRAM; sock->sendMessageLength -= MAX_DATAGRAM;
if (sock->sendMessageLength > 0) if (sock->sendMessageLength > 0)
{ {
Q_memcpy(sock->sendMessage, sock->sendMessage+MAX_DATAGRAM, sock->sendMessageLength); memcpy(sock->sendMessage, sock->sendMessage+MAX_DATAGRAM, sock->sendMessageLength);
sock->sendNext = true; sock->sendNext = true;
} }
else else
@ -461,7 +465,7 @@ int Datagram_GetMessage (qsocket_t *sock)
break; break;
} }
Q_memcpy(sock->receiveMessage + sock->receiveMessageLength, packetBuffer.data, length); memcpy(sock->receiveMessage + sock->receiveMessageLength, packetBuffer.data, length);
sock->receiveMessageLength += length; sock->receiveMessageLength += length;
continue; continue;
} }
@ -499,7 +503,7 @@ void NET_Stats_f (void)
Con_Printf("shortPacketCount = %i\n", shortPacketCount); Con_Printf("shortPacketCount = %i\n", shortPacketCount);
Con_Printf("droppedDatagrams = %i\n", droppedDatagrams); Con_Printf("droppedDatagrams = %i\n", droppedDatagrams);
} }
else if (Q_strcmp(Cmd_Argv(1), "*") == 0) else if (strcmp(Cmd_Argv(1), "*") == 0)
{ {
for (s = net_activeSockets; s; s = s->next) for (s = net_activeSockets; s; s = s->next)
PrintStats(s); PrintStats(s);
@ -509,11 +513,11 @@ void NET_Stats_f (void)
else else
{ {
for (s = net_activeSockets; s; s = s->next) for (s = net_activeSockets; s; s = s->next)
if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0) if (strcasecmp(Cmd_Argv(1), s->address) == 0)
break; break;
if (s == NULL) if (s == NULL)
for (s = net_freeSockets; s; s = s->next) for (s = net_freeSockets; s; s = s->next)
if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0) if (strcasecmp(Cmd_Argv(1), s->address) == 0)
break; break;
if (s == NULL) if (s == NULL)
return; return;
@ -566,11 +570,11 @@ static void Test_Poll(void)
Sys_Error("Unexpected repsonse to Player Info request\n"); Sys_Error("Unexpected repsonse to Player Info request\n");
playerNumber = MSG_ReadByte(); playerNumber = MSG_ReadByte();
Q_strcpy(name, MSG_ReadString()); strcpy(name, MSG_ReadString());
colors = MSG_ReadLong(); colors = MSG_ReadLong();
frags = MSG_ReadLong(); frags = MSG_ReadLong();
connectTime = MSG_ReadLong(); connectTime = MSG_ReadLong();
Q_strcpy(address, MSG_ReadString()); strcpy(address, MSG_ReadString());
Con_Printf("%s\n frags:%3i colors:%u %u time:%u\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address); Con_Printf("%s\n frags:%3i colors:%u %u time:%u\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address);
} }
@ -602,13 +606,13 @@ static void Test_f (void)
if (host && hostCacheCount) if (host && hostCacheCount)
{ {
for (n = 0; n < hostCacheCount; n++) for (n = 0; n < hostCacheCount; n++)
if (Q_strcasecmp (host, hostcache[n].name) == 0) if (strcasecmp (host, hostcache[n].name) == 0)
{ {
if (hostcache[n].driver != myDriverLevel) if (hostcache[n].driver != myDriverLevel)
continue; continue;
net_landriverlevel = hostcache[n].ldriver; net_landriverlevel = hostcache[n].ldriver;
max = hostcache[n].maxusers; max = hostcache[n].maxusers;
Q_memcpy(&sendaddr, &hostcache[n].addr, sizeof(struct qsockaddr)); memcpy(&sendaddr, &hostcache[n].addr, sizeof(struct qsockaddr));
break; break;
} }
if (n < hostCacheCount) if (n < hostCacheCount)
@ -688,10 +692,10 @@ static void Test2_Poll(void)
if (MSG_ReadByte() != CCREP_RULE_INFO) if (MSG_ReadByte() != CCREP_RULE_INFO)
goto Error; goto Error;
Q_strcpy(name, MSG_ReadString()); strcpy(name, MSG_ReadString());
if (name[0] == 0) if (name[0] == 0)
goto Done; goto Done;
Q_strcpy(value, MSG_ReadString()); strcpy(value, MSG_ReadString());
Con_Printf("%-16.16s %-16.16s\n", name, value); Con_Printf("%-16.16s %-16.16s\n", name, value);
@ -730,12 +734,12 @@ static void Test2_f (void)
if (host && hostCacheCount) if (host && hostCacheCount)
{ {
for (n = 0; n < hostCacheCount; n++) for (n = 0; n < hostCacheCount; n++)
if (Q_strcasecmp (host, hostcache[n].name) == 0) if (strcasecmp (host, hostcache[n].name) == 0)
{ {
if (hostcache[n].driver != myDriverLevel) if (hostcache[n].driver != myDriverLevel)
continue; continue;
net_landriverlevel = hostcache[n].ldriver; net_landriverlevel = hostcache[n].ldriver;
Q_memcpy(&sendaddr, &hostcache[n].addr, sizeof(struct qsockaddr)); memcpy(&sendaddr, &hostcache[n].addr, sizeof(struct qsockaddr));
break; break;
} }
if (n < hostCacheCount) if (n < hostCacheCount)
@ -875,7 +879,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
command = MSG_ReadByte(); command = MSG_ReadByte();
if (command == CCREQ_SERVER_INFO) if (command == CCREQ_SERVER_INFO)
{ {
if (Q_strcmp(MSG_ReadString(), "QUAKE") != 0) if (strcmp(MSG_ReadString(), "QUAKE") != 0)
return NULL; return NULL;
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -979,7 +983,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
if (command != CCREQ_CONNECT) if (command != CCREQ_CONNECT)
return NULL; return NULL;
if (Q_strcmp(MSG_ReadString(), "QUAKE") != 0) if (strcmp(MSG_ReadString(), "QUAKE") != 0)
return NULL; return NULL;
if (MSG_ReadByte() != NET_PROTOCOL_VERSION) if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
@ -1082,7 +1086,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
sock->socket = newsock; sock->socket = newsock;
sock->landriver = net_landriverlevel; sock->landriver = net_landriverlevel;
sock->addr = clientaddr; sock->addr = clientaddr;
Q_strcpy(sock->address, dfunc.AddrToString(&clientaddr)); strcpy(sock->address, dfunc.AddrToString(&clientaddr));
// send him back the info about the server connection he has been allocated // send him back the info about the server connection he has been allocated
SZ_Clear(&net_message); SZ_Clear(&net_message);
@ -1173,30 +1177,30 @@ static void _Datagram_SearchForHosts (qboolean xmit)
// add it // add it
hostCacheCount++; hostCacheCount++;
Q_strcpy(hostcache[n].name, MSG_ReadString()); strcpy(hostcache[n].name, MSG_ReadString());
Q_strcpy(hostcache[n].map, MSG_ReadString()); strcpy(hostcache[n].map, MSG_ReadString());
hostcache[n].users = MSG_ReadByte(); hostcache[n].users = MSG_ReadByte();
hostcache[n].maxusers = MSG_ReadByte(); hostcache[n].maxusers = MSG_ReadByte();
if (MSG_ReadByte() != NET_PROTOCOL_VERSION) if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
{ {
Q_strcpy(hostcache[n].cname, hostcache[n].name); strcpy(hostcache[n].cname, hostcache[n].name);
hostcache[n].cname[14] = 0; hostcache[n].cname[14] = 0;
Q_strcpy(hostcache[n].name, "*"); strcpy(hostcache[n].name, "*");
Q_strcat(hostcache[n].name, hostcache[n].cname); strcat(hostcache[n].name, hostcache[n].cname);
} }
Q_memcpy(&hostcache[n].addr, &readaddr, sizeof(struct qsockaddr)); memcpy(&hostcache[n].addr, &readaddr, sizeof(struct qsockaddr));
hostcache[n].driver = net_driverlevel; hostcache[n].driver = net_driverlevel;
hostcache[n].ldriver = net_landriverlevel; hostcache[n].ldriver = net_landriverlevel;
Q_strcpy(hostcache[n].cname, dfunc.AddrToString(&readaddr)); strcpy(hostcache[n].cname, dfunc.AddrToString(&readaddr));
// check for a name conflict // check for a name conflict
for (i = 0; i < hostCacheCount; i++) for (i = 0; i < hostCacheCount; i++)
{ {
if (i == n) if (i == n)
continue; continue;
if (Q_strcasecmp (hostcache[n].name, hostcache[i].name) == 0) if (strcasecmp (hostcache[n].name, hostcache[i].name) == 0)
{ {
i = Q_strlen(hostcache[n].name); i = strlen(hostcache[n].name);
if (i < 15 && hostcache[n].name[i-1] > '8') if (i < 15 && hostcache[n].name[i-1] > '8')
{ {
hostcache[n].name[i] = '0'; hostcache[n].name[i] = '0';
@ -1325,7 +1329,7 @@ static qsocket_t *_Datagram_Connect (char *host)
{ {
reason = "No Response"; reason = "No Response";
Con_Printf("%s\n", reason); Con_Printf("%s\n", reason);
Q_strcpy(m_return_reason, reason); strcpy(m_return_reason, reason);
goto ErrorReturn; goto ErrorReturn;
} }
@ -1333,7 +1337,7 @@ static qsocket_t *_Datagram_Connect (char *host)
{ {
reason = "Network Error"; reason = "Network Error";
Con_Printf("%s\n", reason); Con_Printf("%s\n", reason);
Q_strcpy(m_return_reason, reason); strcpy(m_return_reason, reason);
goto ErrorReturn; goto ErrorReturn;
} }
@ -1342,20 +1346,20 @@ static qsocket_t *_Datagram_Connect (char *host)
{ {
reason = MSG_ReadString(); reason = MSG_ReadString();
Con_Printf(reason); Con_Printf(reason);
Q_strncpy(m_return_reason, reason, 31); strncpy(m_return_reason, reason, 31);
goto ErrorReturn; goto ErrorReturn;
} }
if (ret == CCREP_ACCEPT) if (ret == CCREP_ACCEPT)
{ {
Q_memcpy(&sock->addr, &sendaddr, sizeof(struct qsockaddr)); memcpy(&sock->addr, &sendaddr, sizeof(struct qsockaddr));
dfunc.SetSocketPort (&sock->addr, MSG_ReadLong()); dfunc.SetSocketPort (&sock->addr, MSG_ReadLong());
} }
else else
{ {
reason = "Bad Response"; reason = "Bad Response";
Con_Printf("%s\n", reason); Con_Printf("%s\n", reason);
Q_strcpy(m_return_reason, reason); strcpy(m_return_reason, reason);
goto ErrorReturn; goto ErrorReturn;
} }
@ -1369,7 +1373,7 @@ static qsocket_t *_Datagram_Connect (char *host)
{ {
reason = "Connect to Game failed"; reason = "Connect to Game failed";
Con_Printf("%s\n", reason); Con_Printf("%s\n", reason);
Q_strcpy(m_return_reason, reason); strcpy(m_return_reason, reason);
goto ErrorReturn; goto ErrorReturn;
} }

View file

@ -61,21 +61,21 @@ void Loop_SearchForHosts (qboolean xmit)
return; return;
hostCacheCount = 1; hostCacheCount = 1;
if (Q_strcmp(hostname->string, "UNNAMED") == 0) if (strcmp(hostname->string, "UNNAMED") == 0)
Q_strcpy(hostcache[0].name, "local"); strcpy(hostcache[0].name, "local");
else else
Q_strcpy(hostcache[0].name, hostname->string); strcpy(hostcache[0].name, hostname->string);
Q_strcpy(hostcache[0].map, sv.name); strcpy(hostcache[0].map, sv.name);
hostcache[0].users = net_activeconnections; hostcache[0].users = net_activeconnections;
hostcache[0].maxusers = svs.maxclients; hostcache[0].maxusers = svs.maxclients;
hostcache[0].driver = net_driverlevel; hostcache[0].driver = net_driverlevel;
Q_strcpy(hostcache[0].cname, "local"); strcpy(hostcache[0].cname, "local");
} }
qsocket_t *Loop_Connect (char *host) qsocket_t *Loop_Connect (char *host)
{ {
if (Q_strcmp(host,"local") != 0) if (strcmp(host,"local") != 0)
return NULL; return NULL;
localconnectpending = true; localconnectpending = true;
@ -87,7 +87,7 @@ qsocket_t *Loop_Connect (char *host)
Con_Printf("Loop_Connect: no qsocket available\n"); Con_Printf("Loop_Connect: no qsocket available\n");
return NULL; return NULL;
} }
Q_strcpy (loop_client->address, "localhost"); strcpy (loop_client->address, "localhost");
} }
loop_client->receiveMessageLength = 0; loop_client->receiveMessageLength = 0;
loop_client->sendMessageLength = 0; loop_client->sendMessageLength = 0;
@ -100,7 +100,7 @@ qsocket_t *Loop_Connect (char *host)
Con_Printf("Loop_Connect: no qsocket available\n"); Con_Printf("Loop_Connect: no qsocket available\n");
return NULL; return NULL;
} }
Q_strcpy (loop_server->address, "LOCAL"); strcpy (loop_server->address, "LOCAL");
} }
loop_server->receiveMessageLength = 0; loop_server->receiveMessageLength = 0;
loop_server->sendMessageLength = 0; loop_server->sendMessageLength = 0;
@ -153,7 +153,7 @@ int Loop_GetMessage (qsocket_t *sock)
sock->receiveMessageLength -= length; sock->receiveMessageLength -= length;
if (sock->receiveMessageLength) if (sock->receiveMessageLength)
Q_memcpy(sock->receiveMessage, &sock->receiveMessage[length], sock->receiveMessageLength); memcpy(sock->receiveMessage, &sock->receiveMessage[length], sock->receiveMessageLength);
if (sock->driverdata && ret == 1) if (sock->driverdata && ret == 1)
((qsocket_t *)sock->driverdata)->canSend = true; ((qsocket_t *)sock->driverdata)->canSend = true;
@ -188,7 +188,7 @@ int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
buffer++; buffer++;
// message // message
Q_memcpy(buffer, data->data, data->cursize); memcpy(buffer, data->data, data->cursize);
*bufferLength = IntAlign(*bufferLength + data->cursize + 4); *bufferLength = IntAlign(*bufferLength + data->cursize + 4);
sock->canSend = false; sock->canSend = false;
@ -222,7 +222,7 @@ int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
buffer++; buffer++;
// message // message
Q_memcpy(buffer, data->data, data->cursize); memcpy(buffer, data->data, data->cursize);
*bufferLength = IntAlign(*bufferLength + data->cursize + 4); *bufferLength = IntAlign(*bufferLength + data->cursize + 4);
return 1; return 1;
} }

View file

@ -32,6 +32,8 @@
#include "quakedef.h" #include "quakedef.h"
#include "net_vcr.h" #include "net_vcr.h"
#include "qargs.h"
#include "sizebuf.h"
qsocket_t *net_activeSockets = NULL; qsocket_t *net_activeSockets = NULL;
qsocket_t *net_freeSockets = NULL; qsocket_t *net_freeSockets = NULL;
@ -138,7 +140,7 @@ qsocket_t *NET_NewQSocket (void)
sock->disconnected = false; sock->disconnected = false;
sock->connecttime = net_time; sock->connecttime = net_time;
Q_strcpy (sock->address,"UNSET ADDRESS"); strcpy (sock->address,"UNSET ADDRESS");
sock->driver = net_driverlevel; sock->driver = net_driverlevel;
sock->socket = 0; sock->socket = 0;
sock->driverdata = NULL; sock->driverdata = NULL;
@ -191,7 +193,7 @@ static void NET_Listen_f (void)
return; return;
} }
listening = Q_atoi(Cmd_Argv(1)) ? true : false; listening = atoi(Cmd_Argv(1)) ? true : false;
for (net_driverlevel=0 ; net_driverlevel<net_numdrivers; net_driverlevel++) for (net_driverlevel=0 ; net_driverlevel<net_numdrivers; net_driverlevel++)
{ {
@ -218,7 +220,7 @@ static void MaxPlayers_f (void)
return; return;
} }
n = Q_atoi(Cmd_Argv(1)); n = atoi(Cmd_Argv(1));
if (n < 1) if (n < 1)
n = 1; n = 1;
if (n > svs.maxclientslimit) if (n > svs.maxclientslimit)
@ -251,7 +253,7 @@ static void NET_Port_f (void)
return; return;
} }
n = Q_atoi(Cmd_Argv(1)); n = atoi(Cmd_Argv(1));
if (n < 1 || n > 65534) if (n < 1 || n > 65534)
{ {
Con_Printf ("Bad value, must be between 1 and 65534\n"); Con_Printf ("Bad value, must be between 1 and 65534\n");
@ -389,7 +391,7 @@ qsocket_t *NET_Connect (char *host)
if (host) if (host)
{ {
if (Q_strcasecmp (host, "local") == 0) if (strcasecmp (host, "local") == 0)
{ {
numdrivers = 1; numdrivers = 1;
goto JustDoIt; goto JustDoIt;
@ -398,7 +400,7 @@ qsocket_t *NET_Connect (char *host)
if (hostCacheCount) if (hostCacheCount)
{ {
for (n = 0; n < hostCacheCount; n++) for (n = 0; n < hostCacheCount; n++)
if (Q_strcasecmp (host, hostcache[n].name) == 0) if (strcasecmp (host, hostcache[n].name) == 0)
{ {
host = hostcache[n].cname; host = hostcache[n].cname;
break; break;
@ -424,7 +426,7 @@ qsocket_t *NET_Connect (char *host)
if (hostCacheCount) if (hostCacheCount)
for (n = 0; n < hostCacheCount; n++) for (n = 0; n < hostCacheCount; n++)
if (Q_strcasecmp (host, hostcache[n].name) == 0) if (strcasecmp (host, hostcache[n].name) == 0)
{ {
host = hostcache[n].cname; host = hostcache[n].cname;
break; break;
@ -836,7 +838,7 @@ void NET_Init (void)
if (i) if (i)
{ {
if (i < com_argc-1) if (i < com_argc-1)
DEFAULTnet_hostport = Q_atoi (com_argv[i+1]); DEFAULTnet_hostport = atoi (com_argv[i+1]);
else else
Sys_Error ("NET_Init: you must specify a number after -port"); Sys_Error ("NET_Init: you must specify a number after -port");
} }

View file

@ -30,8 +30,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include "quakedef.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -40,6 +38,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#ifdef __sun__ #ifdef __sun__
#include <sys/filio.h> #include <sys/filio.h>
@ -49,6 +48,11 @@
#include <libc.h> #include <libc.h>
#endif #endif
#include "net.h"
#include "qargs.h"
#include "sys.h"
#include "console.h"
extern int gethostname (char *, int); extern int gethostname (char *, int);
extern int close (int); extern int close (int);
@ -79,7 +83,7 @@ int UDP_Init (void)
myAddr = *(int *)local->h_addr_list[0]; myAddr = *(int *)local->h_addr_list[0];
// if the quake hostname isn't set, set it to the machine name // if the quake hostname isn't set, set it to the machine name
if (Q_strcmp(hostname->string, "UNNAMED") == 0) if (strcmp(hostname->string, "UNNAMED") == 0)
{ {
buff[15] = 0; buff[15] = 0;
Cvar_Set(hostname, buff); Cvar_Set(hostname, buff);
@ -93,8 +97,8 @@ int UDP_Init (void)
((struct sockaddr_in *)&broadcastaddr)->sin_port = htons(net_hostport); ((struct sockaddr_in *)&broadcastaddr)->sin_port = htons(net_hostport);
UDP_GetSocketAddr (net_controlsocket, &addr); UDP_GetSocketAddr (net_controlsocket, &addr);
Q_strcpy(my_tcpip_address, UDP_AddrToString (&addr)); strcpy(my_tcpip_address, UDP_AddrToString (&addr));
colon = Q_strrchr (my_tcpip_address, ':'); colon = strrchr (my_tcpip_address, ':');
if (colon) if (colon)
*colon = 0; *colon = 0;
@ -217,7 +221,7 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr)
} }
if (*b++ == ':') if (*b++ == ':')
port = Q_atoi(b); port = atoi(b);
else else
port = net_hostport; port = net_hostport;
@ -345,7 +349,7 @@ int UDP_GetSocketAddr (int socket, struct qsockaddr *addr)
int addrlen = sizeof(struct qsockaddr); int addrlen = sizeof(struct qsockaddr);
unsigned int a; unsigned int a;
Q_memset(addr, 0, sizeof(struct qsockaddr)); memset(addr, 0, sizeof(struct qsockaddr));
getsockname(socket, (struct sockaddr *)addr, &addrlen); getsockname(socket, (struct sockaddr *)addr, &addrlen);
a = ((struct sockaddr_in *)addr)->sin_addr.s_addr; a = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
if (a == 0 || a == inet_addr("127.0.0.1")) if (a == 0 || a == inet_addr("127.0.0.1"))
@ -363,11 +367,11 @@ int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET); hostentry = gethostbyaddr ((char *)&((struct sockaddr_in *)addr)->sin_addr, sizeof(struct in_addr), AF_INET);
if (hostentry) if (hostentry)
{ {
Q_strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1); strncpy (name, (char *)hostentry->h_name, NET_NAMELEN - 1);
return 0; return 0;
} }
Q_strcpy (name, UDP_AddrToString (addr)); strcpy (name, UDP_AddrToString (addr));
return 0; return 0;
} }

View file

@ -31,10 +31,9 @@
# include <config.h> # include <config.h>
#endif #endif
#include <quakedef.h> #include <qtypes.h>
//#include <qtypes.h>
#include <sound.h> #include <sound.h>
//#include <qargs.h> #include <qargs.h>
#include <console.h> #include <console.h>
#include <stdio.h> #include <stdio.h>

View file

@ -30,6 +30,15 @@
# include "config.h" # include "config.h"
#endif #endif
#include <string.h>
#include <stdlib.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
@ -293,12 +302,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];
} }
@ -556,7 +565,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 ();
@ -610,7 +619,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);
@ -618,7 +627,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);
} }
} }
@ -930,13 +939,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++;
@ -954,15 +963,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

@ -30,7 +30,13 @@
# include "config.h" # include "config.h"
#endif #endif
#include "quakedef.h" #include <string.h>
#include "sys.h"
#include "sound.h"
#include "qendian.h"
#include "quakefs.h"
#include "console.h"
int cache_full_cycle; int cache_full_cycle;
@ -122,8 +128,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);
@ -223,7 +229,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;
} }
} }
@ -273,7 +279,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

@ -285,7 +285,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;

View file

@ -31,27 +31,24 @@
# include "config.h" # include "config.h"
#endif #endif
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <sys/ipc.h> #include <stdlib.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <errno.h> #include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <signal.h>
#include "sys.h"
#include "qargs.h"
#include "cvar.h"
#include "server.h"
#include "quakedef.h" #include "quakedef.h"
qboolean isDedicated; qboolean isDedicated;
int nostdout = 0; int nostdout = 0;
@ -437,7 +434,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);
parms.basedir = basedir; parms.basedir = basedir;