mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-14 17:10:53 +00:00
const correctness changes.
git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@300 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
f83fdf425b
commit
69938ba29c
62 changed files with 515 additions and 542 deletions
|
@ -62,7 +62,7 @@ int in_impulse;
|
|||
void KeyDown (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
char *c;
|
||||
const char *c;
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
if (c[0])
|
||||
|
@ -91,7 +91,7 @@ void KeyDown (kbutton_t *b)
|
|||
void KeyUp (kbutton_t *b)
|
||||
{
|
||||
int k;
|
||||
char *c;
|
||||
const char *c;
|
||||
|
||||
c = Cmd_Argv(1);
|
||||
if (c[0])
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
char *svc_strings[] =
|
||||
const char *svc_strings[] =
|
||||
{
|
||||
"svc_bad",
|
||||
"svc_nop",
|
||||
|
@ -251,7 +251,7 @@ CL_ParseServerInfo
|
|||
*/
|
||||
void CL_ParseServerInfo (void)
|
||||
{
|
||||
char *str;
|
||||
const char *str;
|
||||
int i;
|
||||
int nummodels, numsounds;
|
||||
char model_precache[MAX_MODELS][MAX_QPATH];
|
||||
|
@ -915,7 +915,7 @@ void CL_ParseServerMessage (void)
|
|||
{
|
||||
int cmd;
|
||||
int i;
|
||||
char *str; //johnfitz
|
||||
const char *str; //johnfitz
|
||||
int total, j, lastcmd; //johnfitz
|
||||
|
||||
//
|
||||
|
|
|
@ -335,7 +335,7 @@ void CL_BaseMove (usercmd_t *cmd);
|
|||
|
||||
|
||||
float CL_KeyState (kbutton_t *key);
|
||||
char *Key_KeynumToString (int keynum);
|
||||
const char *Key_KeynumToString (int keynum);
|
||||
|
||||
//
|
||||
// cl_demo.c
|
||||
|
|
|
@ -38,9 +38,6 @@ typedef struct cmdalias_s
|
|||
|
||||
cmdalias_t *cmd_alias;
|
||||
|
||||
int trashtest;
|
||||
int *trashspot;
|
||||
|
||||
qboolean cmd_wait;
|
||||
|
||||
//=============================================================================
|
||||
|
@ -87,7 +84,7 @@ Cbuf_AddText
|
|||
Adds command text at the end of the buffer
|
||||
============
|
||||
*/
|
||||
void Cbuf_AddText (char *text)
|
||||
void Cbuf_AddText (const char *text)
|
||||
{
|
||||
int l;
|
||||
|
||||
|
@ -112,7 +109,7 @@ Adds a \n to the text
|
|||
FIXME: actually change the command buffer to do less copying
|
||||
============
|
||||
*/
|
||||
void Cbuf_InsertText (char *text)
|
||||
void Cbuf_InsertText (const char *text)
|
||||
{
|
||||
char *temp;
|
||||
int templen;
|
||||
|
@ -291,15 +288,6 @@ void Cmd_Echo_f (void)
|
|||
Con_Printf ("\n");
|
||||
}
|
||||
|
||||
char *CopyString (char *in)
|
||||
{
|
||||
char *out;
|
||||
|
||||
out = (char *) Z_Malloc (strlen(in)+1);
|
||||
strcpy (out, in);
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Cmd_Alias_f -- johnfitz -- rewritten
|
||||
|
@ -312,7 +300,7 @@ void Cmd_Alias_f (void)
|
|||
cmdalias_t *a;
|
||||
char cmd[1024];
|
||||
int i, c;
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
|
||||
switch (Cmd_Argc())
|
||||
|
@ -367,7 +355,8 @@ void Cmd_Alias_f (void)
|
|||
}
|
||||
strcat (cmd, "\n");
|
||||
|
||||
a->value = CopyString (cmd);
|
||||
a->value = (char *) Z_Malloc (strlen(cmd)+1);
|
||||
strcpy (a->value, cmd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -433,8 +422,8 @@ void Cmd_Unaliasall_f (void)
|
|||
typedef struct cmd_function_s
|
||||
{
|
||||
struct cmd_function_s *next;
|
||||
char *name;
|
||||
xcommand_t function;
|
||||
const char *name;
|
||||
xcommand_t function;
|
||||
} cmd_function_t;
|
||||
|
||||
|
||||
|
@ -442,8 +431,8 @@ typedef struct cmd_function_s
|
|||
|
||||
static int cmd_argc;
|
||||
static char *cmd_argv[MAX_ARGS];
|
||||
static char *cmd_null_string = "";
|
||||
static char *cmd_args = NULL;
|
||||
static char cmd_null_string[] = "";
|
||||
static const char *cmd_args = NULL;
|
||||
|
||||
cmd_source_t cmd_source;
|
||||
|
||||
|
@ -460,8 +449,8 @@ Cmd_List_f -- johnfitz
|
|||
void Cmd_List_f (void)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
char *partial;
|
||||
int len, count;
|
||||
const char *partial;
|
||||
int len, count;
|
||||
|
||||
if (Cmd_Argc() > 1)
|
||||
{
|
||||
|
@ -517,7 +506,7 @@ void Cmd_Init (void)
|
|||
Cmd_Argc
|
||||
============
|
||||
*/
|
||||
int Cmd_Argc (void)
|
||||
int Cmd_Argc (void)
|
||||
{
|
||||
return cmd_argc;
|
||||
}
|
||||
|
@ -527,7 +516,7 @@ int Cmd_Argc (void)
|
|||
Cmd_Argv
|
||||
============
|
||||
*/
|
||||
char *Cmd_Argv (int arg)
|
||||
const char *Cmd_Argv (int arg)
|
||||
{
|
||||
if ( (unsigned)arg >= cmd_argc )
|
||||
return cmd_null_string;
|
||||
|
@ -539,7 +528,7 @@ char *Cmd_Argv (int arg)
|
|||
Cmd_Args
|
||||
============
|
||||
*/
|
||||
char *Cmd_Args (void)
|
||||
const char *Cmd_Args (void)
|
||||
{
|
||||
return cmd_args;
|
||||
}
|
||||
|
@ -552,7 +541,7 @@ Cmd_TokenizeString
|
|||
Parses the given string into command line tokens.
|
||||
============
|
||||
*/
|
||||
void Cmd_TokenizeString (char *text)
|
||||
void Cmd_TokenizeString (const char *text)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -602,7 +591,7 @@ void Cmd_TokenizeString (char *text)
|
|||
Cmd_AddCommand
|
||||
============
|
||||
*/
|
||||
void Cmd_AddCommand (char *cmd_name, xcommand_t function)
|
||||
void Cmd_AddCommand (const char *cmd_name, xcommand_t function)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
cmd_function_t *cursor,*prev; //johnfitz -- sorted list insert
|
||||
|
@ -632,23 +621,23 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function)
|
|||
cmd->function = function;
|
||||
|
||||
//johnfitz -- insert each entry in alphabetical order
|
||||
if (cmd_functions == NULL || strcmp(cmd->name, cmd_functions->name) < 0) //insert at front
|
||||
if (cmd_functions == NULL || strcmp(cmd->name, cmd_functions->name) < 0) //insert at front
|
||||
{
|
||||
cmd->next = cmd_functions;
|
||||
cmd_functions = cmd;
|
||||
}
|
||||
else //insert later
|
||||
cmd->next = cmd_functions;
|
||||
cmd_functions = cmd;
|
||||
}
|
||||
else //insert later
|
||||
{
|
||||
prev = cmd_functions;
|
||||
cursor = cmd_functions->next;
|
||||
while ((cursor != NULL) && (strcmp(cmd->name, cursor->name) > 0))
|
||||
prev = cmd_functions;
|
||||
cursor = cmd_functions->next;
|
||||
while ((cursor != NULL) && (strcmp(cmd->name, cursor->name) > 0))
|
||||
{
|
||||
prev = cursor;
|
||||
cursor = cursor->next;
|
||||
}
|
||||
cmd->next = prev->next;
|
||||
prev->next = cmd;
|
||||
}
|
||||
prev = cursor;
|
||||
cursor = cursor->next;
|
||||
}
|
||||
cmd->next = prev->next;
|
||||
prev->next = cmd;
|
||||
}
|
||||
//johnfitz
|
||||
}
|
||||
|
||||
|
@ -657,7 +646,7 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function)
|
|||
Cmd_Exists
|
||||
============
|
||||
*/
|
||||
qboolean Cmd_Exists (char *cmd_name)
|
||||
qboolean Cmd_Exists (const char *cmd_name)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
|
||||
|
@ -677,10 +666,10 @@ qboolean Cmd_Exists (char *cmd_name)
|
|||
Cmd_CompleteCommand
|
||||
============
|
||||
*/
|
||||
char *Cmd_CompleteCommand (char *partial)
|
||||
const char *Cmd_CompleteCommand (const char *partial)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
int len;
|
||||
int len;
|
||||
|
||||
len = Q_strlen(partial);
|
||||
|
||||
|
@ -703,7 +692,7 @@ A complete command line has been parsed, so try to execute it
|
|||
FIXME: lookupnoadd the token to speed search?
|
||||
============
|
||||
*/
|
||||
void Cmd_ExecuteString (char *text, cmd_source_t src)
|
||||
void Cmd_ExecuteString (const char *text, cmd_source_t src)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
cmdalias_t *a;
|
||||
|
@ -782,7 +771,7 @@ where the given parameter apears, or 0 if not present
|
|||
================
|
||||
*/
|
||||
|
||||
int Cmd_CheckParm (char *parm)
|
||||
int Cmd_CheckParm (const char *parm)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -795,3 +784,4 @@ int Cmd_CheckParm (char *parm)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute ();
|
|||
void Cbuf_Init (void);
|
||||
// allocates an initial text buffer that will grow as needed
|
||||
|
||||
void Cbuf_AddText (char *text);
|
||||
void Cbuf_AddText (const char *text);
|
||||
// as new commands are generated from the console or keybindings,
|
||||
// the text is added to the end of the command buffer.
|
||||
|
||||
void Cbuf_InsertText (char *text);
|
||||
void Cbuf_InsertText (const char *text);
|
||||
// when a command wants to issue other commands immediately, the text is
|
||||
// inserted at the beginning of the buffer, before any remaining unexecuted
|
||||
// commands.
|
||||
|
@ -82,34 +82,34 @@ extern cmd_source_t cmd_source;
|
|||
|
||||
void Cmd_Init (void);
|
||||
|
||||
void Cmd_AddCommand (char *cmd_name, xcommand_t function);
|
||||
void Cmd_AddCommand (const char *cmd_name, xcommand_t function);
|
||||
// called by the init functions of other parts of the program to
|
||||
// register commands and functions to call for them.
|
||||
// The cmd_name is referenced later, so it should not be in temp memory
|
||||
|
||||
qboolean Cmd_Exists (char *cmd_name);
|
||||
qboolean Cmd_Exists (const char *cmd_name);
|
||||
// used by the cvar code to check for cvar / command name overlap
|
||||
|
||||
char *Cmd_CompleteCommand (char *partial);
|
||||
const char *Cmd_CompleteCommand (const char *partial);
|
||||
// attempts to match a partial command for automatic command line completion
|
||||
// returns NULL if nothing fits
|
||||
|
||||
int Cmd_Argc (void);
|
||||
char *Cmd_Argv (int arg);
|
||||
char *Cmd_Args (void);
|
||||
const char *Cmd_Argv (int arg);
|
||||
const char *Cmd_Args (void);
|
||||
// The functions that execute commands get their parameters with these
|
||||
// functions. Cmd_Argv () will return an empty string, not a NULL
|
||||
// if arg > argc, so string operations are allways safe.
|
||||
|
||||
int Cmd_CheckParm (char *parm);
|
||||
int Cmd_CheckParm (const char *parm);
|
||||
// Returns the position (1 to argc-1) in the command's argument list
|
||||
// where the given parameter apears, or 0 if not present
|
||||
|
||||
void Cmd_TokenizeString (char *text);
|
||||
void Cmd_TokenizeString (const char *text);
|
||||
// Takes a null terminated string. Does not need to be /n terminated.
|
||||
// breaks the string up into arg tokens.
|
||||
|
||||
void Cmd_ExecuteString (char *text, cmd_source_t src);
|
||||
void Cmd_ExecuteString (const char *text, cmd_source_t src);
|
||||
// Parses a single line of text into arguments and tries to execute it.
|
||||
// The text can come from the command buffer, a remote client, or stdin.
|
||||
|
||||
|
@ -118,7 +118,7 @@ void Cmd_ForwardToServer (void);
|
|||
// things like godmode, noclip, etc, are commands directed to the server,
|
||||
// so when they are typed in at the console, they will need to be forwarded.
|
||||
|
||||
void Cmd_Print (char *text);
|
||||
void Cmd_Print (const char *text);
|
||||
// used by command functions to send output to either the graphics console or
|
||||
// passed as a print message to the client
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ void MSG_WriteFloat (sizebuf_t *sb, float f)
|
|||
SZ_Write (sb, &dat.l, 4);
|
||||
}
|
||||
|
||||
void MSG_WriteString (sizebuf_t *sb, char *s)
|
||||
void MSG_WriteString (sizebuf_t *sb, const char *s)
|
||||
{
|
||||
if (!s)
|
||||
SZ_Write (sb, "", 1);
|
||||
|
@ -738,7 +738,7 @@ float MSG_ReadFloat (void)
|
|||
return dat.f;
|
||||
}
|
||||
|
||||
char *MSG_ReadString (void)
|
||||
const char *MSG_ReadString (void)
|
||||
{
|
||||
static char string[2048];
|
||||
int l,c;
|
||||
|
@ -843,12 +843,12 @@ void *SZ_GetSpace (sizebuf_t *buf, int length)
|
|||
return data;
|
||||
}
|
||||
|
||||
void SZ_Write (sizebuf_t *buf, void *data, int length)
|
||||
void SZ_Write (sizebuf_t *buf, const void *data, int length)
|
||||
{
|
||||
Q_memcpy (SZ_GetSpace(buf,length),data,length);
|
||||
}
|
||||
|
||||
void SZ_Print (sizebuf_t *buf, char *data)
|
||||
void SZ_Print (sizebuf_t *buf, const char *data)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
@ -870,9 +870,9 @@ void SZ_Print (sizebuf_t *buf, char *data)
|
|||
COM_SkipPath
|
||||
============
|
||||
*/
|
||||
char *COM_SkipPath (char *pathname)
|
||||
const char *COM_SkipPath (const char *pathname)
|
||||
{
|
||||
char *last;
|
||||
const char *last;
|
||||
|
||||
last = pathname;
|
||||
while (*pathname)
|
||||
|
@ -889,7 +889,7 @@ char *COM_SkipPath (char *pathname)
|
|||
COM_StripExtension
|
||||
============
|
||||
*/
|
||||
void COM_StripExtension (char *in, char *out)
|
||||
void COM_StripExtension (const char *in, char *out)
|
||||
{
|
||||
while (*in && *in != '.')
|
||||
*out++ = *in++;
|
||||
|
@ -901,7 +901,7 @@ void COM_StripExtension (char *in, char *out)
|
|||
COM_FileExtension
|
||||
============
|
||||
*/
|
||||
char *COM_FileExtension (char *in)
|
||||
const char *COM_FileExtension (const char *in)
|
||||
{
|
||||
static char exten[8];
|
||||
int i;
|
||||
|
@ -922,9 +922,9 @@ char *COM_FileExtension (char *in)
|
|||
COM_FileBase
|
||||
============
|
||||
*/
|
||||
void COM_FileBase (char *in, char *out)
|
||||
void COM_FileBase (const char *in, char *out)
|
||||
{
|
||||
char *s, *s2;
|
||||
const char *s, *s2;
|
||||
|
||||
s = in + strlen(in) - 1;
|
||||
|
||||
|
@ -950,7 +950,7 @@ void COM_FileBase (char *in, char *out)
|
|||
COM_DefaultExtension
|
||||
==================
|
||||
*/
|
||||
void COM_DefaultExtension (char *path, char *extension)
|
||||
void COM_DefaultExtension (char *path, const char *extension)
|
||||
{
|
||||
char *src;
|
||||
//
|
||||
|
@ -977,7 +977,7 @@ COM_Parse
|
|||
Parse a token out of a string
|
||||
==============
|
||||
*/
|
||||
char *COM_Parse (char *data)
|
||||
const char *COM_Parse (const char *data)
|
||||
{
|
||||
int c;
|
||||
int len;
|
||||
|
@ -1057,7 +1057,7 @@ Returns the position (1 to argc-1) in the program's argument list
|
|||
where the given parameter apears, or 0 if not present
|
||||
================
|
||||
*/
|
||||
int COM_CheckParm (char *parm)
|
||||
int COM_CheckParm (const char *parm)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ static void FitzTest_f (void)
|
|||
COM_Init
|
||||
================
|
||||
*/
|
||||
void COM_Init (char *basedir)
|
||||
void COM_Init (const char *basedir)
|
||||
{
|
||||
int i = 0x12345678;
|
||||
/* U N I X */
|
||||
|
@ -1393,7 +1393,7 @@ COM_WriteFile
|
|||
The filename will be prefixed by the current game directory
|
||||
============
|
||||
*/
|
||||
void COM_WriteFile (char *filename, void *data, int len)
|
||||
void COM_WriteFile (const char *filename, const void *data, int len)
|
||||
{
|
||||
int handle;
|
||||
char name[MAX_OSPATH];
|
||||
|
@ -1442,14 +1442,15 @@ Copies a file over from the net to the local cache, creating any directories
|
|||
needed. This is for the convenience of developers using ISDN from home.
|
||||
===========
|
||||
*/
|
||||
void COM_CopyFile (char *netpath, char *cachepath)
|
||||
void COM_CopyFile (const char *netpath, const char *cachepath)
|
||||
{
|
||||
int in, out;
|
||||
int remaining, count;
|
||||
char buf[4096];
|
||||
|
||||
remaining = Sys_FileOpenRead (netpath, &in);
|
||||
COM_CreatePath (cachepath); // create directories up to the cache file
|
||||
Q_strcpy (buf, cachepath);
|
||||
COM_CreatePath (buf); // create directories up to the cache file
|
||||
out = Sys_FileOpenWrite (cachepath);
|
||||
|
||||
while (remaining)
|
||||
|
@ -1475,7 +1476,7 @@ Finds the file in the search path.
|
|||
Sets com_filesize and one of handle or file
|
||||
===========
|
||||
*/
|
||||
int COM_FindFile (char *filename, int *handle, FILE **file)
|
||||
int COM_FindFile (const char *filename, int *handle, FILE **file)
|
||||
{
|
||||
searchpath_t *search;
|
||||
char netpath[MAX_OSPATH];
|
||||
|
@ -1573,7 +1574,7 @@ returns a handle and a length
|
|||
it may actually be inside a pak file
|
||||
===========
|
||||
*/
|
||||
int COM_OpenFile (char *filename, int *handle)
|
||||
int COM_OpenFile (const char *filename, int *handle)
|
||||
{
|
||||
return COM_FindFile (filename, handle, NULL);
|
||||
}
|
||||
|
@ -1586,7 +1587,7 @@ If the requested file is inside a packfile, a new FILE * will be opened
|
|||
into the file.
|
||||
===========
|
||||
*/
|
||||
int COM_FOpenFile (char *filename, FILE **file)
|
||||
int COM_FOpenFile (const char *filename, FILE **file)
|
||||
{
|
||||
return COM_FindFile (filename, NULL, file);
|
||||
}
|
||||
|
@ -1621,7 +1622,7 @@ Allways appends a 0 byte.
|
|||
cache_user_t *loadcache;
|
||||
byte *loadbuf;
|
||||
int loadsize;
|
||||
byte *COM_LoadFile (char *path, int usehunk)
|
||||
byte *COM_LoadFile (const char *path, int usehunk)
|
||||
{
|
||||
int h;
|
||||
byte *buf;
|
||||
|
@ -1670,24 +1671,24 @@ byte *COM_LoadFile (char *path, int usehunk)
|
|||
return buf;
|
||||
}
|
||||
|
||||
byte *COM_LoadHunkFile (char *path)
|
||||
byte *COM_LoadHunkFile (const char *path)
|
||||
{
|
||||
return COM_LoadFile (path, 1);
|
||||
}
|
||||
|
||||
byte *COM_LoadTempFile (char *path)
|
||||
byte *COM_LoadTempFile (const char *path)
|
||||
{
|
||||
return COM_LoadFile (path, 2);
|
||||
}
|
||||
|
||||
void COM_LoadCacheFile (char *path, struct cache_user_s *cu)
|
||||
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu)
|
||||
{
|
||||
loadcache = cu;
|
||||
COM_LoadFile (path, 3);
|
||||
}
|
||||
|
||||
// uses temp hunk if larger than bufsize
|
||||
byte *COM_LoadStackFile (char *path, void *buffer, int bufsize)
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
|
@ -1708,7 +1709,7 @@ Loads the header and directory, adding the files at the beginning
|
|||
of the list so they override previous pack files.
|
||||
=================
|
||||
*/
|
||||
pack_t *COM_LoadPackFile (char *packfile)
|
||||
pack_t *COM_LoadPackFile (const char *packfile)
|
||||
{
|
||||
dpackheader_t header;
|
||||
int i;
|
||||
|
@ -1777,7 +1778,7 @@ pack_t *COM_LoadPackFile (char *packfile)
|
|||
COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial
|
||||
=================
|
||||
*/
|
||||
void COM_AddGameDirectory (char *dir)
|
||||
void COM_AddGameDirectory (const char *dir)
|
||||
{
|
||||
int i;
|
||||
searchpath_t *search;
|
||||
|
@ -1915,4 +1916,3 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
|
|||
proghack = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef struct sizebuf_s
|
|||
{
|
||||
qboolean allowoverflow; // if false, do a Sys_Error
|
||||
qboolean overflowed; // set to true if the buffer size failed
|
||||
byte *data;
|
||||
byte *data;
|
||||
int maxsize;
|
||||
int cursize;
|
||||
} sizebuf_t;
|
||||
|
@ -62,8 +62,8 @@ void SZ_Alloc (sizebuf_t *buf, int startsize);
|
|||
void SZ_Free (sizebuf_t *buf);
|
||||
void SZ_Clear (sizebuf_t *buf);
|
||||
void *SZ_GetSpace (sizebuf_t *buf, int length);
|
||||
void SZ_Write (sizebuf_t *buf, void *data, int length);
|
||||
void SZ_Print (sizebuf_t *buf, char *data); // strcats onto the sizebuf
|
||||
void SZ_Write (sizebuf_t *buf, const void *data, int length);
|
||||
void SZ_Print (sizebuf_t *buf, const char *data); // strcats onto the sizebuf
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
@ -101,7 +101,7 @@ 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_WriteString (sizebuf_t *sb, const 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); //johnfitz
|
||||
|
@ -115,7 +115,7 @@ int MSG_ReadByte (void);
|
|||
int MSG_ReadShort (void);
|
||||
int MSG_ReadLong (void);
|
||||
float MSG_ReadFloat (void);
|
||||
char *MSG_ReadString (void);
|
||||
const char *MSG_ReadString (void);
|
||||
|
||||
float MSG_ReadCoord (void);
|
||||
float MSG_ReadAngle (void);
|
||||
|
@ -143,20 +143,20 @@ float Q_atof (const char *str);
|
|||
extern char com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
|
||||
char *COM_Parse (char *data);
|
||||
const char *COM_Parse (const char *data);
|
||||
|
||||
|
||||
extern int com_argc;
|
||||
extern char **com_argv;
|
||||
|
||||
int COM_CheckParm (char *parm);
|
||||
void COM_Init (char *path);
|
||||
int COM_CheckParm (const char *parm);
|
||||
void COM_Init (const 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);
|
||||
const char *COM_SkipPath (const char *pathname);
|
||||
void COM_StripExtension (const char *in, char *out);
|
||||
void COM_FileBase (const char *in, char *out);
|
||||
void COM_DefaultExtension (char *path, const char *extension);
|
||||
void COM_CreatePath (char *path);
|
||||
|
||||
char *va (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
|
||||
|
@ -171,15 +171,15 @@ struct cache_user_s;
|
|||
extern char com_basedir[MAX_OSPATH];
|
||||
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_WriteFile (const char *filename, const void *data, int len);
|
||||
int COM_OpenFile (const char *filename, int *hndl);
|
||||
int COM_FOpenFile (const 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);
|
||||
byte *COM_LoadStackFile (const char *path, void *buffer, int bufsize);
|
||||
byte *COM_LoadTempFile (const char *path);
|
||||
byte *COM_LoadHunkFile (const char *path);
|
||||
void COM_LoadCacheFile (const char *path, struct cache_user_s *cu);
|
||||
|
||||
|
||||
extern struct cvar_s registered;
|
||||
|
|
|
@ -45,7 +45,7 @@ int con_totallines; // total lines in console scrollback
|
|||
int con_backscroll; // lines up from bottom to display
|
||||
int con_current; // where next message will be printed
|
||||
int con_x; // offset in current line for next print
|
||||
char *con_text=0;
|
||||
char *con_text = NULL;
|
||||
|
||||
cvar_t con_notifytime = {"con_notifytime","3"}; //seconds
|
||||
cvar_t con_logcenterprint = {"con_logcenterprint", "1"}; //johnfitz
|
||||
|
@ -75,7 +75,7 @@ Con_Quakebar -- johnfitz -- returns a bar of the desired length, but never wider
|
|||
includes a newline, unless len >= con_linewidth.
|
||||
================
|
||||
*/
|
||||
char *Con_Quakebar (int len)
|
||||
const char *Con_Quakebar (int len)
|
||||
{
|
||||
static char bar[42];
|
||||
int i;
|
||||
|
@ -154,7 +154,7 @@ Con_Dump_f -- johnfitz -- adapted from quake2 source
|
|||
void Con_Dump_f (void)
|
||||
{
|
||||
int l, x;
|
||||
char *line;
|
||||
const char *line;
|
||||
FILE *f;
|
||||
char buffer[1024];
|
||||
char name[MAX_OSPATH];
|
||||
|
@ -703,8 +703,8 @@ void Con_LogCenterPrint (const char *str)
|
|||
char key_tabpartial[MAXCMDLINE];
|
||||
typedef struct tab_s
|
||||
{
|
||||
char *name;
|
||||
char *type;
|
||||
const char *name;
|
||||
const char *type;
|
||||
struct tab_s *next;
|
||||
struct tab_s *prev;
|
||||
} tab_t;
|
||||
|
@ -715,8 +715,8 @@ extern qboolean keydown[256];
|
|||
typedef struct cmd_function_s
|
||||
{
|
||||
struct cmd_function_s *next;
|
||||
char *name;
|
||||
xcommand_t function;
|
||||
const char *name;
|
||||
xcommand_t function;
|
||||
} cmd_function_t;
|
||||
extern cmd_function_t *cmd_functions;
|
||||
#define MAX_ALIAS_NAME 32
|
||||
|
@ -742,10 +742,11 @@ static char bash_partial[80];
|
|||
static qboolean bash_singlematch;
|
||||
static qboolean map_singlematch;
|
||||
|
||||
void AddToTabList (char *name, char *type)
|
||||
void AddToTabList (const char *name, const char *type)
|
||||
{
|
||||
tab_t *t,*insert;
|
||||
char *i_bash, *i_name;
|
||||
char *i_bash;
|
||||
const char *i_name;
|
||||
|
||||
if (!*bash_partial)
|
||||
{
|
||||
|
@ -804,7 +805,7 @@ void AddToTabList (char *name, char *type)
|
|||
// This is redefined from host_cmd.c
|
||||
typedef struct extralevel_s
|
||||
{
|
||||
char name[32];
|
||||
char name[32];
|
||||
struct extralevel_s *next;
|
||||
} extralevel_t;
|
||||
|
||||
|
@ -815,7 +816,7 @@ extern extralevel_t *extralevels;
|
|||
BuildMap -- stevenaaus
|
||||
============
|
||||
*/
|
||||
char *BuildMapList (char *partial)
|
||||
const char *BuildMapList (const char *partial)
|
||||
{
|
||||
static char matched[80];
|
||||
char *i_matched, *i_name;
|
||||
|
@ -871,11 +872,11 @@ char *BuildMapList (char *partial)
|
|||
BuildTabList -- johnfitz
|
||||
============
|
||||
*/
|
||||
void BuildTabList (char *partial)
|
||||
void BuildTabList (const char *partial)
|
||||
{
|
||||
cmdalias_t *alias;
|
||||
cvar_t *cvar;
|
||||
cmd_function_t *cmd;
|
||||
cmd_function_t *cmd;
|
||||
int len;
|
||||
|
||||
tablist = NULL;
|
||||
|
@ -905,7 +906,7 @@ Con_TabComplete -- johnfitz
|
|||
void Con_TabComplete (void)
|
||||
{
|
||||
char partial[MAXCMDLINE];
|
||||
char *match;
|
||||
const char *match;
|
||||
static char *c;
|
||||
tab_t *t;
|
||||
int mark, i;
|
||||
|
@ -932,7 +933,7 @@ void Con_TabComplete (void)
|
|||
if (!strncmp (key_lines[edit_line] + 1, "map ",4) ||
|
||||
!strncmp (key_lines[edit_line] + 1, "changelevel ", 12))
|
||||
{
|
||||
char *matched_map = BuildMapList(partial);
|
||||
const char *matched_map = BuildMapList(partial);
|
||||
if (!*matched_map)
|
||||
return;
|
||||
Q_strcpy (partial, matched_map);
|
||||
|
@ -1073,12 +1074,12 @@ void Con_DrawNotify (void)
|
|||
scr_tileclear_updates = 0; //johnfitz
|
||||
}
|
||||
|
||||
|
||||
if (key_dest == key_message)
|
||||
{
|
||||
// modified by S.A to support longer lines
|
||||
|
||||
char c[MAXCMDLINE+1], *say_prompt; // extra space == +1
|
||||
char c[MAXCMDLINE+1]; // extra space == +1
|
||||
const char *say_prompt;
|
||||
int say_length, len;
|
||||
|
||||
clearnotify = 0;
|
||||
|
|
|
@ -55,7 +55,7 @@ void Con_NotifyBox (const char *text); // during startup for sound / cd warnings
|
|||
void Con_Show (void);
|
||||
void Con_Hide (void);
|
||||
|
||||
char *Con_Quakebar (int len);
|
||||
const char *Con_Quakebar (int len);
|
||||
void Con_TabComplete (void);
|
||||
void Con_LogCenterPrint (const char *str);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "quakedef.h"
|
||||
|
||||
cvar_t *cvar_vars;
|
||||
char *cvar_null_string = "";
|
||||
static char cvar_null_string[] = "";
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
|
@ -31,7 +31,7 @@ char *cvar_null_string = "";
|
|||
//
|
||||
//==============================================================================
|
||||
|
||||
void Cvar_Reset (char *name); //johnfitz
|
||||
void Cvar_Reset (const char *name); //johnfitz
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -41,7 +41,7 @@ Cvar_List_f -- johnfitz
|
|||
void Cvar_List_f (void)
|
||||
{
|
||||
cvar_t *cvar;
|
||||
char *partial;
|
||||
const char *partial;
|
||||
int len, count;
|
||||
|
||||
if (Cmd_Argc() > 1)
|
||||
|
@ -231,7 +231,7 @@ void Cvar_Init (void)
|
|||
Cvar_FindVar
|
||||
============
|
||||
*/
|
||||
cvar_t *Cvar_FindVar (char *var_name)
|
||||
cvar_t *Cvar_FindVar (const char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
@ -247,7 +247,7 @@ cvar_t *Cvar_FindVar (char *var_name)
|
|||
Cvar_VariableValue
|
||||
============
|
||||
*/
|
||||
float Cvar_VariableValue (char *var_name)
|
||||
float Cvar_VariableValue (const char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
@ -263,7 +263,7 @@ float Cvar_VariableValue (char *var_name)
|
|||
Cvar_VariableString
|
||||
============
|
||||
*/
|
||||
char *Cvar_VariableString (char *var_name)
|
||||
const char *Cvar_VariableString (const char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
@ -279,7 +279,7 @@ char *Cvar_VariableString (char *var_name)
|
|||
Cvar_CompleteVariable
|
||||
============
|
||||
*/
|
||||
char *Cvar_CompleteVariable (char *partial)
|
||||
const char *Cvar_CompleteVariable (const char *partial)
|
||||
{
|
||||
cvar_t *cvar;
|
||||
int len;
|
||||
|
@ -302,7 +302,7 @@ char *Cvar_CompleteVariable (char *partial)
|
|||
Cvar_Reset -- johnfitz
|
||||
============
|
||||
*/
|
||||
void Cvar_Reset (char *name)
|
||||
void Cvar_Reset (const char *name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
@ -318,7 +318,7 @@ void Cvar_Reset (char *name)
|
|||
Cvar_Set
|
||||
============
|
||||
*/
|
||||
void Cvar_Set (char *var_name, char *value)
|
||||
void Cvar_Set (const char *var_name, const char *value)
|
||||
{
|
||||
cvar_t *var;
|
||||
qboolean changed;
|
||||
|
@ -332,18 +332,16 @@ void Cvar_Set (char *var_name, char *value)
|
|||
|
||||
changed = Q_strcmp(var->string, value);
|
||||
|
||||
Z_Free (var->string); // free the old value string
|
||||
Z_Free ((void *)var->string); // free the old value string
|
||||
|
||||
var->string = (char *) Z_Malloc (Q_strlen(value)+1);
|
||||
Q_strcpy (var->string, value);
|
||||
var->string = (const char *) Z_Strdup (value);
|
||||
var->value = Q_atof (var->string);
|
||||
|
||||
//johnfitz -- during initialization, update default too
|
||||
if (!host_initialized)
|
||||
{
|
||||
Z_Free (var->default_string);
|
||||
var->default_string = (char *) Z_Malloc (Q_strlen(value)+1);
|
||||
Q_strcpy (var->default_string, value);
|
||||
Z_Free ((void *)var->default_string);
|
||||
var->default_string = (const char *) Z_Strdup (value);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
|
@ -364,7 +362,7 @@ void Cvar_Set (char *var_name, char *value)
|
|||
Cvar_SetValue
|
||||
============
|
||||
*/
|
||||
void Cvar_SetValue (char *var_name, float value)
|
||||
void Cvar_SetValue (const char *var_name, const float value)
|
||||
{
|
||||
char val[32];
|
||||
|
||||
|
@ -381,7 +379,6 @@ Adds a freestanding variable to the variable list.
|
|||
*/
|
||||
void Cvar_RegisterVariable (cvar_t *variable, cvarcallback_t function)
|
||||
{
|
||||
char *oldstr;
|
||||
cvar_t *cursor,*prev; //johnfitz -- sorted list insert
|
||||
|
||||
// first check to see if it has allready been defined
|
||||
|
@ -399,36 +396,33 @@ void Cvar_RegisterVariable (cvar_t *variable, cvarcallback_t function)
|
|||
}
|
||||
|
||||
// copy the value off, because future sets will Z_Free it
|
||||
oldstr = variable->string;
|
||||
variable->string = (char *) Z_Malloc (Q_strlen(variable->string)+1);
|
||||
Q_strcpy (variable->string, oldstr);
|
||||
variable->string = (const char *) Z_Strdup (variable->string);
|
||||
variable->value = Q_atof (variable->string);
|
||||
|
||||
//johnfitz -- save initial value for "reset" command
|
||||
variable->default_string = (char *) Z_Malloc (Q_strlen(variable->string)+1);
|
||||
Q_strcpy (variable->default_string, oldstr);
|
||||
variable->default_string = (const char *) Z_Strdup (variable->string);
|
||||
//johnfitz
|
||||
|
||||
// link the variable in
|
||||
|
||||
//johnfitz -- insert each entry in alphabetical order
|
||||
if (cvar_vars == NULL || strcmp(variable->name, cvar_vars->name) < 0) //insert at front
|
||||
if (cvar_vars == NULL || strcmp(variable->name, cvar_vars->name) < 0) //insert at front
|
||||
{
|
||||
variable->next = cvar_vars;
|
||||
cvar_vars = variable;
|
||||
}
|
||||
else //insert later
|
||||
variable->next = cvar_vars;
|
||||
cvar_vars = variable;
|
||||
}
|
||||
else //insert later
|
||||
{
|
||||
prev = cvar_vars;
|
||||
cursor = cvar_vars->next;
|
||||
while (cursor && (strcmp(variable->name, cursor->name) > 0))
|
||||
prev = cvar_vars;
|
||||
cursor = cvar_vars->next;
|
||||
while (cursor && (strcmp(variable->name, cursor->name) > 0))
|
||||
{
|
||||
prev = cursor;
|
||||
cursor = cursor->next;
|
||||
}
|
||||
variable->next = prev->next;
|
||||
prev->next = variable;
|
||||
}
|
||||
prev = cursor;
|
||||
cursor = cursor->next;
|
||||
}
|
||||
variable->next = prev->next;
|
||||
prev->next = variable;
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
variable->callback = function; //johnfitz
|
||||
|
|
|
@ -62,13 +62,13 @@ typedef void (*cvarcallback_t) (void);
|
|||
|
||||
typedef struct cvar_s
|
||||
{
|
||||
char *name;
|
||||
char *string;
|
||||
const char *name;
|
||||
const char *string;
|
||||
qboolean archive; // set to true to cause it to be saved to vars.rc
|
||||
qboolean server; // notifies players when changed
|
||||
float value;
|
||||
struct cvar_s *next;
|
||||
char *default_string; //johnfitz -- remember defaults for reset function
|
||||
const char *default_string; //johnfitz -- remember defaults for reset function
|
||||
cvarcallback_t callback; //johnfitz
|
||||
} cvar_t;
|
||||
|
||||
|
@ -76,19 +76,19 @@ void Cvar_RegisterVariable (cvar_t *variable, cvarcallback_t function); //johnf
|
|||
// registers a cvar that allready has the name, string, and optionally the
|
||||
// archive elements set.
|
||||
|
||||
void Cvar_Set (char *var_name, char *value);
|
||||
void Cvar_Set (const char *var_name, const char *value);
|
||||
// equivelant to "<name> <variable>" typed at the console
|
||||
|
||||
void Cvar_SetValue (char *var_name, float value);
|
||||
void Cvar_SetValue (const char *var_name, const float value);
|
||||
// expands value to a string and calls Cvar_Set
|
||||
|
||||
float Cvar_VariableValue (char *var_name);
|
||||
float Cvar_VariableValue (const char *var_name);
|
||||
// returns 0 if not defined or non numeric
|
||||
|
||||
char *Cvar_VariableString (char *var_name);
|
||||
const char *Cvar_VariableString (const char *var_name);
|
||||
// returns an empty string if not defined
|
||||
|
||||
char *Cvar_CompleteVariable (char *partial);
|
||||
const char *Cvar_CompleteVariable (const char *partial);
|
||||
// attempts to match a partial variable name for command line completion
|
||||
// returns NULL if nothing fits
|
||||
|
||||
|
@ -101,7 +101,7 @@ void Cvar_WriteVariables (FILE *f);
|
|||
// Writes lines containing "set variable value" for all variables
|
||||
// with the archive flag set to true.
|
||||
|
||||
cvar_t *Cvar_FindVar (char *var_name);
|
||||
cvar_t *Cvar_FindVar (const char *var_name);
|
||||
|
||||
void Cvar_Init (void);
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ void Draw_BeginDisc (void);
|
|||
void Draw_TileClear (int x, int y, int w, int h);
|
||||
void Draw_Fill (int x, int y, int w, int h, int c, float alpha); //johnfitz -- added alpha
|
||||
void Draw_FadeScreen (void);
|
||||
void Draw_String (int x, int y, char *str);
|
||||
qpic_t *Draw_PicFromWad (char *name);
|
||||
qpic_t *Draw_CachePic (char *path);
|
||||
void Draw_String (int x, int y, const char *str);
|
||||
qpic_t *Draw_PicFromWad (const char *name);
|
||||
qpic_t *Draw_CachePic (const char *path);
|
||||
void Draw_NewGame (void);
|
||||
|
||||
void GL_SetCanvas (canvastype newcanvas); //johnfitz
|
||||
|
|
|
@ -212,7 +212,7 @@ void Scrap_Upload (void)
|
|||
Draw_PicFromWad
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_PicFromWad (char *name)
|
||||
qpic_t *Draw_PicFromWad (const char *name)
|
||||
{
|
||||
qpic_t *p;
|
||||
glpic_t gl;
|
||||
|
@ -268,7 +268,7 @@ qpic_t *Draw_PicFromWad (char *name)
|
|||
Draw_CachePic
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_CachePic (char *path)
|
||||
qpic_t *Draw_CachePic (const char *path)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
@ -371,7 +371,7 @@ qpic_t *Draw_ConbackPic (void)
|
|||
Draw_MakePic -- johnfitz -- generate pics from internal data
|
||||
================
|
||||
*/
|
||||
qpic_t *Draw_MakePic (char *name, int width, int height, byte *data)
|
||||
qpic_t *Draw_MakePic (const char *name, int width, int height, byte *data)
|
||||
{
|
||||
int flags = TEXPREF_NEAREST | TEXPREF_ALPHA | TEXPREF_PERSIST | TEXPREF_NOPICMIP | TEXPREF_PAD;
|
||||
qpic_t *pic;
|
||||
|
@ -531,7 +531,7 @@ void Draw_Character (int x, int y, int num)
|
|||
Draw_String -- johnfitz -- modified to call Draw_CharacterQuad
|
||||
================
|
||||
*/
|
||||
void Draw_String (int x, int y, char *str)
|
||||
void Draw_String (int x, int y, const char *str)
|
||||
{
|
||||
if (y <= -8)
|
||||
return; // totally off screen
|
||||
|
|
|
@ -172,7 +172,7 @@ called at map load
|
|||
void Fog_ParseWorldspawn (void)
|
||||
{
|
||||
char key[128], value[4096];
|
||||
char *data;
|
||||
const char *data;
|
||||
|
||||
//initially no fog
|
||||
fog_density = 0.0;
|
||||
|
|
|
@ -196,7 +196,7 @@ Mod_FindName
|
|||
|
||||
==================
|
||||
*/
|
||||
model_t *Mod_FindName (char *name)
|
||||
model_t *Mod_FindName (const char *name)
|
||||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
@ -229,7 +229,7 @@ Mod_TouchModel
|
|||
|
||||
==================
|
||||
*/
|
||||
void Mod_TouchModel (char *name)
|
||||
void Mod_TouchModel (const char *name)
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
|
@ -325,7 +325,7 @@ Mod_ForName
|
|||
Loads in a model for the given name
|
||||
==================
|
||||
*/
|
||||
model_t *Mod_ForName (char *name, qboolean crash)
|
||||
model_t *Mod_ForName (const char *name, qboolean crash)
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
|
@ -1969,7 +1969,7 @@ Mod_SetExtraFlags -- johnfitz -- set up extra flags that aren't in the mdl
|
|||
void Mod_SetExtraFlags (model_t *mod)
|
||||
{
|
||||
extern cvar_t r_nolerp_list;
|
||||
char *s;
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if (!mod || !mod->name || mod->type != mod_alias)
|
||||
|
|
|
@ -444,9 +444,9 @@ typedef struct model_s
|
|||
|
||||
void Mod_Init (void);
|
||||
void Mod_ClearAll (void);
|
||||
model_t *Mod_ForName (char *name, qboolean crash);
|
||||
model_t *Mod_ForName (const char *name, qboolean crash);
|
||||
void *Mod_Extradata (model_t *mod); // handles caching
|
||||
void Mod_TouchModel (char *name);
|
||||
void Mod_TouchModel (const char *name);
|
||||
|
||||
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
|
||||
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
|
||||
|
|
|
@ -147,7 +147,7 @@ Called for important messages that should stay in the center of the screen
|
|||
for a few moments
|
||||
==============
|
||||
*/
|
||||
void SCR_CenterPrint (char *str) //update centerprint data
|
||||
void SCR_CenterPrint (const char *str) //update centerprint data
|
||||
{
|
||||
strncpy (scr_centerstring, str, sizeof(scr_centerstring)-1);
|
||||
scr_centertime_off = scr_centertime.value;
|
||||
|
@ -809,12 +809,12 @@ void SCR_EndLoadingPlaque (void)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
char *scr_notifystring;
|
||||
const char *scr_notifystring;
|
||||
qboolean scr_drawdialog;
|
||||
|
||||
void SCR_DrawNotifyString (void)
|
||||
{
|
||||
char *start;
|
||||
const char *start;
|
||||
int l;
|
||||
int j;
|
||||
int x, y;
|
||||
|
@ -854,7 +854,7 @@ Displays a text string in the center of the screen and waits for a Y or N
|
|||
keypress.
|
||||
==================
|
||||
*/
|
||||
int SCR_ModalMessage (char *text, float timeout) //johnfitz -- timeout
|
||||
int SCR_ModalMessage (const char *text, float timeout) //johnfitz -- timeout
|
||||
{
|
||||
double time1, time2; //johnfitz -- timeout
|
||||
|
||||
|
|
|
@ -145,8 +145,8 @@ void Sky_LoadTexture (texture_t *mt)
|
|||
Sky_LoadSkyBox
|
||||
==================
|
||||
*/
|
||||
char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
||||
void Sky_LoadSkyBox (char *name)
|
||||
const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
||||
void Sky_LoadSkyBox (const char *name)
|
||||
{
|
||||
int i, mark, width, height;
|
||||
char filename[MAX_OSPATH];
|
||||
|
@ -213,7 +213,7 @@ Sky_NewMap
|
|||
void Sky_NewMap (void)
|
||||
{
|
||||
char key[128], value[4096];
|
||||
char *data;
|
||||
const char *data;
|
||||
int i;
|
||||
|
||||
//
|
||||
|
|
|
@ -55,8 +55,8 @@ unsigned int d_8to24table_pants[256];
|
|||
typedef struct
|
||||
{
|
||||
int magfilter;
|
||||
int minfilter;
|
||||
char *name;
|
||||
int minfilter;
|
||||
const char *name;
|
||||
} glmode_t;
|
||||
glmode_t modes[] = {
|
||||
{GL_NEAREST, GL_NEAREST, "GL_NEAREST"},
|
||||
|
@ -125,7 +125,7 @@ TexMgr_TextureMode_f
|
|||
void TexMgr_TextureMode_f (void)
|
||||
{
|
||||
gltexture_t *glt;
|
||||
char *arg;
|
||||
const char *arg;
|
||||
int i;
|
||||
|
||||
switch (Cmd_Argc())
|
||||
|
@ -299,7 +299,7 @@ float TexMgr_FrameUsage (void)
|
|||
TexMgr_FindTexture
|
||||
================
|
||||
*/
|
||||
gltexture_t *TexMgr_FindTexture (model_t *owner, char *name)
|
||||
gltexture_t *TexMgr_FindTexture (model_t *owner, const char *name)
|
||||
{
|
||||
gltexture_t *glt;
|
||||
|
||||
|
@ -1126,8 +1126,8 @@ void TexMgr_LoadLightmap (gltexture_t *glt, byte *data)
|
|||
TexMgr_LoadImage -- the one entry point for loading all textures
|
||||
================
|
||||
*/
|
||||
gltexture_t *TexMgr_LoadImage (model_t *owner, char *name, int width, int height, enum srcformat format,
|
||||
byte *data, char *source_file, src_offset_t source_offset, unsigned flags)
|
||||
gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int height, enum srcformat format,
|
||||
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags)
|
||||
{
|
||||
extern int lightmap_bytes;
|
||||
unsigned short crc;
|
||||
|
|
|
@ -76,7 +76,7 @@ extern unsigned int d_8to24table_pants[256];
|
|||
// TEXTURE MANAGER
|
||||
|
||||
float TexMgr_FrameUsage (void);
|
||||
gltexture_t *TexMgr_FindTexture (model_t *owner, char *name);
|
||||
gltexture_t *TexMgr_FindTexture (model_t *owner, const char *name);
|
||||
gltexture_t *TexMgr_NewTexture (void);
|
||||
void TexMgr_FreeTexture (gltexture_t *kill);
|
||||
void TexMgr_FreeTextures (int flags, int mask);
|
||||
|
@ -85,8 +85,8 @@ void TexMgr_NewGame (void);
|
|||
void TexMgr_Init (void);
|
||||
|
||||
// IMAGE LOADING
|
||||
gltexture_t *TexMgr_LoadImage (model_t *owner, char *name, int width, int height, enum srcformat format,
|
||||
byte *data, char *source_file, src_offset_t source_offset, unsigned flags);
|
||||
gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int height, enum srcformat format,
|
||||
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags);
|
||||
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants);
|
||||
void TexMgr_ReloadImages (void);
|
||||
void TexMgr_ReloadNobrightImages (void);
|
||||
|
|
|
@ -119,7 +119,7 @@ void VID_MenuKey (int key);
|
|||
|
||||
LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
void AppActivate(BOOL fActive, BOOL minimize);
|
||||
char *VID_GetModeDescription (int mode);
|
||||
const char *VID_GetModeDescription (int mode);
|
||||
void ClearAllStates (void);
|
||||
void VID_UpdateWindowStatus (void);
|
||||
void GL_Init (void);
|
||||
|
@ -930,8 +930,7 @@ char *GL_MakeNiceExtensionsList (const char *in)
|
|||
out = Z_Malloc (strlen(in) + count*3 + 1); //usually about 1-2k
|
||||
out[0] = 0;
|
||||
|
||||
copy = Z_Malloc(strlen(in) + 1);
|
||||
strcpy(copy, in);
|
||||
copy = (char *) Z_Strdup(in);
|
||||
|
||||
for (token = strtok(copy, " "); token; token = strtok(NULL, " "))
|
||||
{
|
||||
|
@ -1727,9 +1726,9 @@ vmode_t *VID_GetModePtr (int modenum)
|
|||
VID_GetModeDescription
|
||||
=================
|
||||
*/
|
||||
char *VID_GetModeDescription (int mode)
|
||||
const char *VID_GetModeDescription (int mode)
|
||||
{
|
||||
char *pinfo;
|
||||
const char *pinfo;
|
||||
vmode_t *pv;
|
||||
static char temp[100];
|
||||
|
||||
|
@ -1759,7 +1758,7 @@ char *VID_GetModeDescription (int mode)
|
|||
VID_GetExtModeDescription
|
||||
=================
|
||||
*/
|
||||
char *VID_GetExtModeDescription (int mode)
|
||||
const char *VID_GetExtModeDescription (int mode)
|
||||
{
|
||||
static char pinfo[40];
|
||||
vmode_t *pv;
|
||||
|
@ -1811,7 +1810,6 @@ VID_DescribeModes_f -- johnfitz -- changed formatting, and added refresh rates a
|
|||
void VID_DescribeModes_f (void)
|
||||
{
|
||||
int i, lnummodes, t;
|
||||
char *pinfo;
|
||||
vmode_t *pv;
|
||||
int lastwidth=0, lastheight=0, lastbpp=0, count=0;
|
||||
|
||||
|
@ -2356,16 +2354,6 @@ void VID_SyncCvars (void)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
extern void M_Menu_Options_f (void);
|
||||
extern void M_Print (int cx, int cy, char *str);
|
||||
extern void M_PrintWhite (int cx, int cy, char *str);
|
||||
extern void M_DrawCharacter (int cx, int line, int num);
|
||||
extern void M_DrawTransPic (int x, int y, qpic_t *pic);
|
||||
extern void M_DrawPic (int x, int y, qpic_t *pic);
|
||||
extern void M_DrawCheckbox (int x, int y, int on);
|
||||
|
||||
extern qboolean m_entersound;
|
||||
|
||||
#define VIDEO_OPTIONS_ITEMS 6
|
||||
int video_cursor_table[] = {48, 56, 64, 72, 88, 96};
|
||||
int video_options_cursor = 0;
|
||||
|
@ -2769,7 +2757,7 @@ void VID_MenuDraw (void)
|
|||
{
|
||||
int i = 0;
|
||||
qpic_t *p;
|
||||
char *title;
|
||||
const char *title;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ void VID_Menu_f (void); //johnfitz
|
|||
void VID_MenuDraw (void);
|
||||
void VID_MenuKey (int key);
|
||||
|
||||
char *VID_GetModeDescription (int mode);
|
||||
const char *VID_GetModeDescription (int mode);
|
||||
void ClearAllStates (void);
|
||||
void VID_UpdateWindowStatus (void);
|
||||
void GL_Init (void);
|
||||
|
@ -316,7 +316,7 @@ int VID_SetMode (int modenum)
|
|||
|
||||
//kristian -- set window caption
|
||||
sprintf(caption, "QuakeSpasm %1.2f.%d", (float)FITZQUAKE_VERSION, QUAKESPASM_VER_PATCH);
|
||||
SDL_WM_SetCaption((const char* )&caption, (const char*)&caption);
|
||||
SDL_WM_SetCaption(caption, caption);
|
||||
|
||||
vid.width = modelist[modenum].width;
|
||||
vid.height = modelist[modenum].height;
|
||||
|
@ -530,8 +530,7 @@ char *GL_MakeNiceExtensionsList (const char *in)
|
|||
out = (char *) Z_Malloc (strlen(in) + count*3 + 1); //usually about 1-2k
|
||||
out[0] = 0;
|
||||
|
||||
copy = (char *) Z_Malloc(strlen(in) + 1);
|
||||
strcpy(copy, in);
|
||||
copy = (char *) Z_Strdup(in);
|
||||
|
||||
for (token = strtok(copy, " "); token; token = strtok(NULL, " "))
|
||||
{
|
||||
|
@ -929,9 +928,9 @@ vmode_t *VID_GetModePtr (int modenum)
|
|||
VID_GetModeDescription
|
||||
=================
|
||||
*/
|
||||
char *VID_GetModeDescription (int mode)
|
||||
const char *VID_GetModeDescription (int mode)
|
||||
{
|
||||
char *pinfo;
|
||||
const char *pinfo;
|
||||
vmode_t *pv;
|
||||
static char temp[100];
|
||||
|
||||
|
@ -961,7 +960,7 @@ char *VID_GetModeDescription (int mode)
|
|||
VID_GetExtModeDescription
|
||||
=================
|
||||
*/
|
||||
char *VID_GetExtModeDescription (int mode)
|
||||
const char *VID_GetExtModeDescription (int mode)
|
||||
{
|
||||
static char pinfo[40];
|
||||
vmode_t *pv;
|
||||
|
@ -1472,16 +1471,6 @@ void VID_SyncCvars (void)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
extern void M_Menu_Options_f (void);
|
||||
extern void M_Print (int cx, int cy, char *str);
|
||||
extern void M_PrintWhite (int cx, int cy, char *str);
|
||||
extern void M_DrawCharacter (int cx, int line, int num);
|
||||
extern void M_DrawTransPic (int x, int y, qpic_t *pic);
|
||||
extern void M_DrawPic (int x, int y, qpic_t *pic);
|
||||
extern void M_DrawCheckbox (int x, int y, int on);
|
||||
|
||||
extern qboolean m_entersound;
|
||||
|
||||
#define VIDEO_OPTIONS_ITEMS 7
|
||||
int video_cursor_table[] = {48, 56, 64, 72, 80, 96, 104};
|
||||
int video_options_cursor = 0;
|
||||
|
@ -1811,7 +1800,7 @@ void VID_MenuDraw (void)
|
|||
{
|
||||
int i = 0;
|
||||
qpic_t *p;
|
||||
char *title;
|
||||
const char *title;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ void Sky_Init (void);
|
|||
void Sky_DrawSky (void);
|
||||
void Sky_NewMap (void);
|
||||
void Sky_LoadTexture (texture_t *mt);
|
||||
void Sky_LoadSkyBox (char *name);
|
||||
void Sky_LoadSkyBox (const char *name);
|
||||
|
||||
void TexMgr_RecalcWarpImageSize (void);
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@ Host_Quit_f
|
|||
==================
|
||||
*/
|
||||
|
||||
extern void M_Menu_Quit_f (void);
|
||||
|
||||
void Host_Quit_f (void)
|
||||
{
|
||||
if (key_dest != key_console && cls.state != ca_dedicated)
|
||||
|
@ -84,7 +82,7 @@ typedef struct searchpath_s
|
|||
|
||||
extern qboolean com_modified;
|
||||
extern searchpath_t *com_searchpaths;
|
||||
pack_t *COM_LoadPackFile (char *packfile);
|
||||
pack_t *COM_LoadPackFile (const char *packfile);
|
||||
|
||||
// Kill all the search packs until the game path is found. Kill it, then return
|
||||
// the next path to it.
|
||||
|
@ -222,7 +220,7 @@ typedef struct extralevel_s
|
|||
|
||||
extralevel_t *extralevels;
|
||||
|
||||
void ExtraMaps_Add (char *name)
|
||||
void ExtraMaps_Add (const char *name)
|
||||
{
|
||||
extralevel_t *level,*cursor,*prev;
|
||||
|
||||
|
@ -358,7 +356,7 @@ typedef struct mod_s
|
|||
|
||||
mod_t *modlist;
|
||||
|
||||
void Modlist_Add (char *name)
|
||||
void Modlist_Add (const char *name)
|
||||
{
|
||||
mod_t *mod,*cursor,*prev;
|
||||
|
||||
|
@ -1096,7 +1094,8 @@ void Host_Loadgame_f (void)
|
|||
FILE *f;
|
||||
char mapname[MAX_QPATH];
|
||||
float time, tfloat;
|
||||
char str[32768], *start;
|
||||
char str[32768];
|
||||
const char *start;
|
||||
int i, r;
|
||||
edict_t *ent;
|
||||
int entnum;
|
||||
|
@ -1164,8 +1163,7 @@ void Host_Loadgame_f (void)
|
|||
for (i = 0; i < MAX_LIGHTSTYLES; i++)
|
||||
{
|
||||
fscanf (f, "%s\n", str);
|
||||
sv.lightstyles[i] = (char *) Hunk_Alloc (strlen(str)+1);
|
||||
strcpy (sv.lightstyles[i], str);
|
||||
sv.lightstyles[i] = (const char *)Hunk_Strdup (str, "lightstyles");
|
||||
}
|
||||
|
||||
// load the edicts out of the savegame file
|
||||
|
@ -1238,7 +1236,7 @@ Host_Name_f
|
|||
*/
|
||||
void Host_Name_f (void)
|
||||
{
|
||||
char *newName;
|
||||
char newName[32];
|
||||
|
||||
if (Cmd_Argc () == 1)
|
||||
{
|
||||
|
@ -1246,9 +1244,9 @@ void Host_Name_f (void)
|
|||
return;
|
||||
}
|
||||
if (Cmd_Argc () == 2)
|
||||
newName = Cmd_Argv(1);
|
||||
Q_strncpy(newName, Cmd_Argv(1), sizeof(newName)-1);
|
||||
else
|
||||
newName = Cmd_Args();
|
||||
Q_strncpy(newName, Cmd_Args(), sizeof(newName)-1);
|
||||
newName[15] = 0;
|
||||
|
||||
if (cmd_source == src_command)
|
||||
|
@ -1288,8 +1286,8 @@ void Host_Say(qboolean teamonly)
|
|||
{
|
||||
client_t *client;
|
||||
client_t *save;
|
||||
int j;
|
||||
char *p;
|
||||
int j, remquot = 0;
|
||||
const char *p;
|
||||
// removed unsigned keyword -- kristian
|
||||
char text[MAXCMDLINE];
|
||||
qboolean fromServer = false;
|
||||
|
@ -1318,7 +1316,7 @@ void Host_Say(qboolean teamonly)
|
|||
if (*p == '"')
|
||||
{
|
||||
p++;
|
||||
p[Q_strlen(p)-1] = 0;
|
||||
remquot = 1;
|
||||
}
|
||||
|
||||
// turn on color set 1
|
||||
|
@ -1328,10 +1326,9 @@ void Host_Say(qboolean teamonly)
|
|||
sprintf (text, "%c<%s> ", 1, hostname.string);
|
||||
|
||||
j = sizeof(text) - 2 - Q_strlen(text); // -2 for /n and null terminator
|
||||
if (Q_strlen(p) > j)
|
||||
p[j] = 0;
|
||||
|
||||
strcat (text, p);
|
||||
strncat (text, p, j);
|
||||
if (remquot)
|
||||
text[Q_strlen(text) - 1] = '\0';
|
||||
strcat (text, "\n");
|
||||
|
||||
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
|
||||
|
@ -1365,8 +1362,8 @@ void Host_Tell_f(void)
|
|||
{
|
||||
client_t *client;
|
||||
client_t *save;
|
||||
int j;
|
||||
char *p;
|
||||
int j, remquot = 0;
|
||||
const char *p;
|
||||
char text[MAXCMDLINE];
|
||||
|
||||
if (cmd_source == src_command)
|
||||
|
@ -1387,15 +1384,14 @@ void Host_Tell_f(void)
|
|||
if (*p == '"')
|
||||
{
|
||||
p++;
|
||||
p[Q_strlen(p)-1] = 0;
|
||||
remquot = 1;
|
||||
}
|
||||
|
||||
// check length & truncate if necessary
|
||||
j = sizeof(text) - 2 - Q_strlen(text); // -2 for /n and null terminator
|
||||
if (Q_strlen(p) > j)
|
||||
p[j] = 0;
|
||||
|
||||
strcat (text, p);
|
||||
strncat (text, p, j);
|
||||
if (remquot)
|
||||
text[Q_strlen(text) - 1] = '\0';
|
||||
strcat (text, "\n");
|
||||
|
||||
save = host_client;
|
||||
|
@ -1703,8 +1699,8 @@ Kicks a user off of the server
|
|||
*/
|
||||
void Host_Kick_f (void)
|
||||
{
|
||||
char *who;
|
||||
char *message = NULL;
|
||||
const char *who;
|
||||
const char *message = NULL;
|
||||
client_t *save;
|
||||
int i;
|
||||
qboolean byNumber = false;
|
||||
|
@ -1795,7 +1791,7 @@ Host_Give_f
|
|||
*/
|
||||
void Host_Give_f (void)
|
||||
{
|
||||
char *t;
|
||||
const char *t;
|
||||
int v;
|
||||
eval_t *val;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ qboolean repeatkeys[256]; //johnfitz -- if true, autorepeat is enabled for this
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
int keynum;
|
||||
} keyname_t;
|
||||
|
||||
|
@ -480,7 +480,7 @@ the given string. Single ascii characters return themselves, while
|
|||
the K_* names are matched up.
|
||||
===================
|
||||
*/
|
||||
int Key_StringToKeynum (char *str)
|
||||
int Key_StringToKeynum (const char *str)
|
||||
{
|
||||
keyname_t *kn;
|
||||
|
||||
|
@ -506,7 +506,7 @@ given keynum.
|
|||
FIXME: handle quote special (general escape sequence?)
|
||||
===================
|
||||
*/
|
||||
char *Key_KeynumToString (int keynum)
|
||||
const char *Key_KeynumToString (int keynum)
|
||||
{
|
||||
keyname_t *kn;
|
||||
static char tinystr[2];
|
||||
|
@ -533,7 +533,7 @@ char *Key_KeynumToString (int keynum)
|
|||
Key_SetBinding
|
||||
===================
|
||||
*/
|
||||
void Key_SetBinding (int keynum, char *binding)
|
||||
void Key_SetBinding (int keynum, const char *binding)
|
||||
{
|
||||
char *new_binding;
|
||||
int l;
|
||||
|
|
|
@ -153,7 +153,7 @@ extern int key_lastpress;
|
|||
void Key_Event (int key, qboolean down);
|
||||
void Key_Init (void);
|
||||
void Key_WriteBindings (FILE *f);
|
||||
void Key_SetBinding (int keynum, char *binding);
|
||||
void Key_SetBinding (int keynum, const char *binding);
|
||||
void Key_ClearStates (void);
|
||||
|
||||
void History_Init (void);
|
||||
|
|
|
@ -109,7 +109,7 @@ void M_DrawCharacter (int cx, int line, int num)
|
|||
Draw_Character (cx, line, num);
|
||||
}
|
||||
|
||||
void M_Print (int cx, int cy, char *str)
|
||||
void M_Print (int cx, int cy, const char *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ void M_Print (int cx, int cy, char *str)
|
|||
}
|
||||
}
|
||||
|
||||
void M_PrintWhite (int cx, int cy, char *str)
|
||||
void M_PrintWhite (int cx, int cy, const char *str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
|
@ -842,7 +842,7 @@ forward:
|
|||
int m_net_cursor;
|
||||
int m_net_items;
|
||||
|
||||
char *net_helpMessage [] =
|
||||
const char *net_helpMessage [] =
|
||||
{
|
||||
/* .........1.........2.... */
|
||||
" Novell network LANs ",
|
||||
|
@ -1252,7 +1252,7 @@ void M_Options_Key (int k)
|
|||
//=============================================================================
|
||||
/* KEYS MENU */
|
||||
|
||||
char *bindnames[][2] =
|
||||
const char *bindnames[][2] =
|
||||
{
|
||||
{"+attack", "attack"},
|
||||
{"impulse 10", "next weapon"},
|
||||
|
@ -1289,7 +1289,7 @@ void M_Menu_Keys_f (void)
|
|||
}
|
||||
|
||||
|
||||
void M_FindKeysForCommand (char *command, int *twokeys)
|
||||
void M_FindKeysForCommand (const char *command, int *twokeys)
|
||||
{
|
||||
int count;
|
||||
int j;
|
||||
|
@ -1315,7 +1315,7 @@ void M_FindKeysForCommand (char *command, int *twokeys)
|
|||
}
|
||||
}
|
||||
|
||||
void M_UnbindCommand (char *command)
|
||||
void M_UnbindCommand (const char *command)
|
||||
{
|
||||
int j;
|
||||
int l;
|
||||
|
@ -1338,7 +1338,7 @@ void M_Keys_Draw (void)
|
|||
{
|
||||
int i, l;
|
||||
int keys[2];
|
||||
char *name;
|
||||
const char *name;
|
||||
int x, y;
|
||||
qpic_t *p;
|
||||
|
||||
|
@ -1634,8 +1634,8 @@ void M_LanConfig_Draw (void)
|
|||
{
|
||||
qpic_t *p;
|
||||
int basex;
|
||||
char *startJoin;
|
||||
char *protocol;
|
||||
const char *startJoin;
|
||||
const char *protocol;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp");
|
||||
|
@ -1807,8 +1807,8 @@ void M_LanConfig_Key (int key)
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
char *description;
|
||||
const char *name;
|
||||
const char *description;
|
||||
} level_t;
|
||||
|
||||
level_t levels[] =
|
||||
|
@ -1912,7 +1912,7 @@ level_t roguelevels[] =
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *description;
|
||||
const char *description;
|
||||
int firstLevel;
|
||||
int levels;
|
||||
} episode_t;
|
||||
|
@ -1996,7 +1996,7 @@ void M_GameOptions_Draw (void)
|
|||
M_Print (0, 72, " Teamplay");
|
||||
if (rogue)
|
||||
{
|
||||
char *msg;
|
||||
const char *msg;
|
||||
|
||||
switch((int)teamplay.value)
|
||||
{
|
||||
|
@ -2012,7 +2012,7 @@ void M_GameOptions_Draw (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
char *msg;
|
||||
const char *msg;
|
||||
|
||||
switch((int)teamplay.value)
|
||||
{
|
||||
|
|
|
@ -54,15 +54,25 @@ enum m_state_e {
|
|||
extern enum m_state_e m_state;
|
||||
extern enum m_state_e m_return_state;
|
||||
|
||||
extern qboolean m_entersound;
|
||||
|
||||
//
|
||||
// menus
|
||||
//
|
||||
void M_Init (void);
|
||||
void M_Keydown (int key);
|
||||
void M_Draw (void);
|
||||
void M_ToggleMenu_f (void);
|
||||
|
||||
void M_Print (int cx, int cy, char *str);
|
||||
void M_ToggleMenu_f (void);
|
||||
void M_Menu_Options_f (void);
|
||||
void M_Menu_Quit_f (void);
|
||||
|
||||
void M_Print (int cx, int cy, const char *str);
|
||||
void M_PrintWhite (int cx, int cy, const char *str);
|
||||
void M_DrawCharacter (int cx, int line, int num);
|
||||
void M_DrawTransPic (int x, int y, qpic_t *pic);
|
||||
void M_DrawPic (int x, int y, qpic_t *pic);
|
||||
void M_DrawCheckbox (int x, int y, int on);
|
||||
|
||||
#endif /* _QUAKE_MENU_H */
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void NET_Shutdown (void);
|
|||
struct qsocket_s *NET_CheckNewConnections (void);
|
||||
// returns a new connection number if there is one pending, else -1
|
||||
|
||||
struct qsocket_s *NET_Connect (char *host);
|
||||
struct qsocket_s *NET_Connect (const char *host);
|
||||
// called by client to connect to a host. Returns -1 if not able to
|
||||
|
||||
qboolean NET_CanSendMessage (struct qsocket_s *sock);
|
||||
|
|
|
@ -169,7 +169,7 @@ extern int net_numsockets;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
qboolean initialized;
|
||||
sys_socket_t controlSock;
|
||||
sys_socket_t (*Init) (void);
|
||||
|
@ -182,11 +182,11 @@ typedef struct
|
|||
int (*Read) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int (*Write) (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int (*Broadcast) (sys_socket_t socketid, byte *buf, int len);
|
||||
char * (*AddrToString) (struct qsockaddr *addr);
|
||||
int (*StringToAddr) (char *string, struct qsockaddr *addr);
|
||||
const char * (*AddrToString) (struct qsockaddr *addr);
|
||||
int (*StringToAddr) (const char *string, struct qsockaddr *addr);
|
||||
int (*GetSocketAddr) (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
int (*GetNameFromAddr) (struct qsockaddr *addr, char *name);
|
||||
int (*GetAddrFromName) (char *name, struct qsockaddr *addr);
|
||||
int (*GetAddrFromName) (const char *name, struct qsockaddr *addr);
|
||||
int (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int (*GetSocketPort) (struct qsockaddr *addr);
|
||||
int (*SetSocketPort) (struct qsockaddr *addr, int port);
|
||||
|
@ -198,12 +198,12 @@ extern int net_numlandrivers;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
qboolean initialized;
|
||||
int (*Init) (void);
|
||||
void (*Listen) (qboolean state);
|
||||
void (*SearchForHosts) (qboolean xmit);
|
||||
qsocket_t *(*Connect) (char *host);
|
||||
qsocket_t *(*Connect) (const char *host);
|
||||
qsocket_t *(*CheckNewConnections) (void);
|
||||
int (*QGetMessage) (qsocket_t *sock);
|
||||
int (*QSendMessage) (qsocket_t *sock, sizebuf_t *data);
|
||||
|
|
|
@ -497,7 +497,7 @@ static void NET_Stats_f (void)
|
|||
|
||||
|
||||
// recognize ip:port (based on ProQuake)
|
||||
static char *Strip_Port (char *host)
|
||||
static const char *Strip_Port (const char *host)
|
||||
{
|
||||
static char noport[MAX_QPATH];
|
||||
/* array size as in Host_Connect_f() */
|
||||
|
@ -586,7 +586,7 @@ static void Test_Poll (void *unused)
|
|||
|
||||
static void Test_f (void)
|
||||
{
|
||||
char *host;
|
||||
const char *host;
|
||||
int n;
|
||||
int maxusers = MAX_SCOREBOARD;
|
||||
struct qsockaddr sendaddr;
|
||||
|
@ -721,7 +721,7 @@ Done:
|
|||
|
||||
static void Test2_f (void)
|
||||
{
|
||||
char *host;
|
||||
const char *host;
|
||||
int n;
|
||||
struct qsockaddr sendaddr;
|
||||
|
||||
|
@ -958,7 +958,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
|
||||
if (command == CCREQ_RULE_INFO)
|
||||
{
|
||||
char *prevCvarName;
|
||||
const char *prevCvarName;
|
||||
cvar_t *var;
|
||||
|
||||
// find the search start location
|
||||
|
@ -1251,7 +1251,7 @@ void Datagram_SearchForHosts (qboolean xmit)
|
|||
}
|
||||
|
||||
|
||||
static qsocket_t *_Datagram_Connect (char *host)
|
||||
static qsocket_t *_Datagram_Connect (const char *host)
|
||||
{
|
||||
struct qsockaddr sendaddr;
|
||||
struct qsockaddr readaddr;
|
||||
|
@ -1261,7 +1261,7 @@ static qsocket_t *_Datagram_Connect (char *host)
|
|||
int reps;
|
||||
double start_time;
|
||||
int control;
|
||||
char *reason;
|
||||
const char *reason;
|
||||
|
||||
// see if we can resolve the host name
|
||||
if (dfunc.GetAddrFromName(host, &sendaddr) == -1)
|
||||
|
@ -1426,7 +1426,7 @@ ErrorReturn2:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
qsocket_t *Datagram_Connect (char *host)
|
||||
qsocket_t *Datagram_Connect (const char *host)
|
||||
{
|
||||
qsocket_t *ret = NULL;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
int Datagram_Init (void);
|
||||
void Datagram_Listen (qboolean state);
|
||||
void Datagram_SearchForHosts (qboolean xmit);
|
||||
qsocket_t *Datagram_Connect (char *host);
|
||||
qsocket_t *Datagram_Connect (const char *host);
|
||||
qsocket_t *Datagram_CheckNewConnections (void);
|
||||
int Datagram_GetMessage (qsocket_t *sock);
|
||||
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
|
|
|
@ -68,7 +68,7 @@ void Loop_SearchForHosts (qboolean xmit)
|
|||
}
|
||||
|
||||
|
||||
qsocket_t *Loop_Connect (char *host)
|
||||
qsocket_t *Loop_Connect (const char *host)
|
||||
{
|
||||
if (Q_strcmp(host,"local") != 0)
|
||||
return NULL;
|
||||
|
|
|
@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
int Loop_Init (void);
|
||||
void Loop_Listen (qboolean state);
|
||||
void Loop_SearchForHosts (qboolean xmit);
|
||||
qsocket_t *Loop_Connect (char *host);
|
||||
qsocket_t *Loop_Connect (const char *host);
|
||||
qsocket_t *Loop_CheckNewConnections (void);
|
||||
int Loop_GetMessage (qsocket_t *sock);
|
||||
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
|
|
|
@ -360,7 +360,7 @@ NET_Connect
|
|||
int hostCacheCount = 0;
|
||||
hostcache_t hostcache[HOSTCACHESIZE];
|
||||
|
||||
qsocket_t *NET_Connect (char *host)
|
||||
qsocket_t *NET_Connect (const char *host)
|
||||
{
|
||||
qsocket_t *ret;
|
||||
int n;
|
||||
|
|
|
@ -63,7 +63,7 @@ static int socket_id (UDPsocket socket_p)
|
|||
return idx;
|
||||
}
|
||||
|
||||
static char *_AddrToString (int ip, int port)
|
||||
static const char *_AddrToString (int ip, int port)
|
||||
{
|
||||
static char buffer[22];
|
||||
|
||||
|
@ -72,7 +72,7 @@ static char *_AddrToString (int ip, int port)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
static char *_IPAddrToString (IPaddress *address)
|
||||
static const char *_IPAddrToString (IPaddress *address)
|
||||
{
|
||||
int ip;
|
||||
int port;
|
||||
|
@ -321,7 +321,7 @@ int SDLN_Broadcast (int socketid, byte *buf, int len)
|
|||
return SDLN_Write(socketid, buf, len, &broadcastaddr);
|
||||
}
|
||||
|
||||
char *SDLN_AddrToString (struct qsockaddr *addr)
|
||||
const char *SDLN_AddrToString (struct qsockaddr *addr)
|
||||
{
|
||||
int ip;
|
||||
int port;
|
||||
|
@ -335,7 +335,7 @@ char *SDLN_AddrToString (struct qsockaddr *addr)
|
|||
return _AddrToString(ip, port);
|
||||
}
|
||||
|
||||
int SDLN_StringToAddr (char *string, struct qsockaddr *addr)
|
||||
int SDLN_StringToAddr (const char *string, struct qsockaddr *addr)
|
||||
{
|
||||
int ha1, ha2, ha3, ha4, hp;
|
||||
int hostaddr;
|
||||
|
@ -388,12 +388,12 @@ int SDLN_GetSocketAddr (int socketid, struct qsockaddr *addr)
|
|||
|
||||
int SDLN_GetNameFromAddr (struct qsockaddr *addr, char *name)
|
||||
{
|
||||
char *buf;
|
||||
const char *buf;
|
||||
IPaddress *ipaddress;
|
||||
|
||||
ipaddress = (IPaddress *)&(addr->qsa_data);
|
||||
|
||||
buf = (char *)SDLNet_ResolveIP(ipaddress);
|
||||
buf = SDLNet_ResolveIP(ipaddress);
|
||||
if (buf != NULL)
|
||||
{
|
||||
Q_strncpy(name, buf, NET_NAMELEN - 1);
|
||||
|
@ -413,7 +413,7 @@ this lets you type only as much of the net address as required, using
|
|||
the local network components to fill in the rest
|
||||
============
|
||||
*/
|
||||
static int PartialIPAddress (char *in, struct qsockaddr *hostaddr)
|
||||
static int PartialIPAddress (const char *in, struct qsockaddr *hostaddr)
|
||||
{
|
||||
char buff[256];
|
||||
char *b;
|
||||
|
@ -469,7 +469,7 @@ static int PartialIPAddress (char *in, struct qsockaddr *hostaddr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SDLN_GetAddrFromName (char *name, struct qsockaddr *addr)
|
||||
int SDLN_GetAddrFromName (const char *name, struct qsockaddr *addr)
|
||||
{
|
||||
IPaddress *ipaddress;
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ int SDLN_CheckNewConnections (void);
|
|||
int SDLN_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int SDLN_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int SDLN_Broadcast (int socket, byte *buf, int len);
|
||||
char *SDLN_AddrToString (struct qsockaddr *addr);
|
||||
int SDLN_StringToAddr (char *string, struct qsockaddr *addr);
|
||||
const char *SDLN_AddrToString (struct qsockaddr *addr);
|
||||
int SDLN_StringToAddr (const char *string, struct qsockaddr *addr);
|
||||
int SDLN_GetSocketAddr (int socket, struct qsockaddr *addr);
|
||||
int SDLN_GetNameFromAddr (struct qsockaddr *addr, char *name);
|
||||
int SDLN_GetAddrFromName (char *name, struct qsockaddr *addr);
|
||||
int SDLN_GetAddrFromName (const char *name, struct qsockaddr *addr);
|
||||
int SDLN_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int SDLN_GetSocketPort (struct qsockaddr *addr);
|
||||
int SDLN_SetSocketPort (struct qsockaddr *addr, int port);
|
||||
|
|
|
@ -174,7 +174,7 @@ this lets you type only as much of the net address as required, using
|
|||
the local network components to fill in the rest
|
||||
============
|
||||
*/
|
||||
static int PartialIPAddress (char *in, struct qsockaddr *hostaddr)
|
||||
static int PartialIPAddress (const char *in, struct qsockaddr *hostaddr)
|
||||
{
|
||||
char buff[256];
|
||||
char *b;
|
||||
|
@ -328,7 +328,7 @@ int UDP_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr
|
|||
|
||||
//=============================================================================
|
||||
|
||||
char *UDP_AddrToString (struct qsockaddr *addr)
|
||||
const char *UDP_AddrToString (struct qsockaddr *addr)
|
||||
{
|
||||
static char buffer[22];
|
||||
int haddr;
|
||||
|
@ -342,7 +342,7 @@ char *UDP_AddrToString (struct qsockaddr *addr)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int UDP_StringToAddr (char *string, struct qsockaddr *addr)
|
||||
int UDP_StringToAddr (const char *string, struct qsockaddr *addr)
|
||||
{
|
||||
int ha1, ha2, ha3, ha4, hp, ipaddr;
|
||||
|
||||
|
@ -393,7 +393,7 @@ int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int UDP_GetAddrFromName (char *name, struct qsockaddr *addr)
|
||||
int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr)
|
||||
{
|
||||
struct hostent *hostentry;
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ sys_socket_t UDP_CheckNewConnections (void);
|
|||
int UDP_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int UDP_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int UDP_Broadcast (sys_socket_t socketid, byte *buf, int len);
|
||||
char *UDP_AddrToString (struct qsockaddr *addr);
|
||||
int UDP_StringToAddr (char *string, struct qsockaddr *addr);
|
||||
const char *UDP_AddrToString (struct qsockaddr *addr);
|
||||
int UDP_StringToAddr (const char *string, struct qsockaddr *addr);
|
||||
int UDP_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name);
|
||||
int UDP_GetAddrFromName (char *name, struct qsockaddr *addr);
|
||||
int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr);
|
||||
int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int UDP_GetSocketPort (struct qsockaddr *addr);
|
||||
int UDP_SetSocketPort (struct qsockaddr *addr, int port);
|
||||
|
|
|
@ -273,7 +273,7 @@ this lets you type only as much of the net address as required, using
|
|||
the local network components to fill in the rest
|
||||
============
|
||||
*/
|
||||
static int PartialIPAddress (char *in, struct qsockaddr *hostaddr)
|
||||
static int PartialIPAddress (const char *in, struct qsockaddr *hostaddr)
|
||||
{
|
||||
char buff[256];
|
||||
char *b;
|
||||
|
@ -422,7 +422,7 @@ int WINS_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *add
|
|||
|
||||
//=============================================================================
|
||||
|
||||
char *WINS_AddrToString (struct qsockaddr *addr)
|
||||
const char *WINS_AddrToString (struct qsockaddr *addr)
|
||||
{
|
||||
static char buffer[22];
|
||||
int haddr;
|
||||
|
@ -436,7 +436,7 @@ char *WINS_AddrToString (struct qsockaddr *addr)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int WINS_StringToAddr (char *string, struct qsockaddr *addr)
|
||||
int WINS_StringToAddr (const char *string, struct qsockaddr *addr)
|
||||
{
|
||||
int ha1, ha2, ha3, ha4, hp, ipaddr;
|
||||
|
||||
|
@ -486,7 +486,7 @@ int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int WINS_GetAddrFromName (char *name, struct qsockaddr *addr)
|
||||
int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr)
|
||||
{
|
||||
struct hostent *hostentry;
|
||||
|
||||
|
|
|
@ -34,11 +34,11 @@ sys_socket_t WINS_CheckNewConnections (void);
|
|||
int WINS_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int WINS_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int WINS_Broadcast (sys_socket_t socketid, byte *buf, int len);
|
||||
char *WINS_AddrToString (struct qsockaddr *addr);
|
||||
int WINS_StringToAddr (char *string, struct qsockaddr *addr);
|
||||
const char *WINS_AddrToString (struct qsockaddr *addr);
|
||||
int WINS_StringToAddr (const char *string, struct qsockaddr *addr);
|
||||
int WINS_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name);
|
||||
int WINS_GetAddrFromName (char *name, struct qsockaddr *addr);
|
||||
int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr);
|
||||
int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int WINS_GetSocketPort (struct qsockaddr *addr);
|
||||
int WINS_SetSocketPort (struct qsockaddr *addr, int port);
|
||||
|
|
|
@ -300,7 +300,7 @@ int WIPX_Write (sys_socket_t handle, byte *buf, int len, struct qsockaddr *addr)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
char *WIPX_AddrToString (struct qsockaddr *addr)
|
||||
const char *WIPX_AddrToString (struct qsockaddr *addr)
|
||||
{
|
||||
static char buf[28];
|
||||
|
||||
|
@ -322,7 +322,7 @@ char *WIPX_AddrToString (struct qsockaddr *addr)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int WIPX_StringToAddr (char *string, struct qsockaddr *addr)
|
||||
int WIPX_StringToAddr (const char *string, struct qsockaddr *addr)
|
||||
{
|
||||
int val;
|
||||
char buf[3];
|
||||
|
@ -385,7 +385,7 @@ int WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int WIPX_GetAddrFromName (char *name, struct qsockaddr *addr)
|
||||
int WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr)
|
||||
{
|
||||
int n;
|
||||
char buf[32];
|
||||
|
|
|
@ -34,11 +34,11 @@ sys_socket_t WIPX_CheckNewConnections (void);
|
|||
int WIPX_Read (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int WIPX_Write (sys_socket_t socketid, byte *buf, int len, struct qsockaddr *addr);
|
||||
int WIPX_Broadcast (sys_socket_t socketid, byte *buf, int len);
|
||||
char *WIPX_AddrToString (struct qsockaddr *addr);
|
||||
int WIPX_StringToAddr (char *string, struct qsockaddr *addr);
|
||||
const char *WIPX_AddrToString (struct qsockaddr *addr);
|
||||
int WIPX_StringToAddr (const char *string, struct qsockaddr *addr);
|
||||
int WIPX_GetSocketAddr (sys_socket_t socketid, struct qsockaddr *addr);
|
||||
int WIPX_GetNameFromAddr (struct qsockaddr *addr, char *name);
|
||||
int WIPX_GetAddrFromName (char *name, struct qsockaddr *addr);
|
||||
int WIPX_GetAddrFromName (const char *name, struct qsockaddr *addr);
|
||||
int WIPX_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int WIPX_GetSocketPort (struct qsockaddr *addr);
|
||||
int WIPX_SetSocketPort (struct qsockaddr *addr, int port);
|
||||
|
|
|
@ -245,9 +245,9 @@ setmodel(entity, model)
|
|||
*/
|
||||
void PF_setmodel (void)
|
||||
{
|
||||
edict_t *e;
|
||||
char *m, **check;
|
||||
model_t *mod;
|
||||
edict_t *e;
|
||||
const char *m, **check;
|
||||
model_t *mod;
|
||||
int i;
|
||||
|
||||
e = G_EDICT(OFS_PARM0);
|
||||
|
@ -523,8 +523,7 @@ PF_ambientsound
|
|||
*/
|
||||
void PF_ambientsound (void)
|
||||
{
|
||||
char **check;
|
||||
char *samp;
|
||||
const char *samp, **check;
|
||||
float *pos;
|
||||
float vol, attenuation;
|
||||
int i, soundnum;
|
||||
|
@ -597,7 +596,7 @@ Larger attenuations will drop off.
|
|||
*/
|
||||
void PF_sound (void)
|
||||
{
|
||||
char *sample;
|
||||
const char *sample;
|
||||
int channel;
|
||||
edict_t *entity;
|
||||
int volume;
|
||||
|
@ -826,7 +825,7 @@ stuffcmd (clientent, value)
|
|||
void PF_stuffcmd (void)
|
||||
{
|
||||
int entnum;
|
||||
char *str;
|
||||
const char *str;
|
||||
client_t *old;
|
||||
|
||||
entnum = G_EDICTNUM(OFS_PARM0);
|
||||
|
@ -851,7 +850,7 @@ localcmd (string)
|
|||
*/
|
||||
void PF_localcmd (void)
|
||||
{
|
||||
char *str;
|
||||
const char *str;
|
||||
|
||||
str = G_STRING(OFS_PARM0);
|
||||
Cbuf_AddText (str);
|
||||
|
@ -866,7 +865,7 @@ float cvar (string)
|
|||
*/
|
||||
void PF_cvar (void)
|
||||
{
|
||||
char *str;
|
||||
const char *str;
|
||||
|
||||
str = G_STRING(OFS_PARM0);
|
||||
|
||||
|
@ -882,7 +881,7 @@ float cvar (string)
|
|||
*/
|
||||
void PF_cvar_set (void)
|
||||
{
|
||||
char *var, *val;
|
||||
const char *var, *val;
|
||||
|
||||
var = G_STRING(OFS_PARM0);
|
||||
val = G_STRING(OFS_PARM1);
|
||||
|
@ -993,7 +992,7 @@ void PF_Find (void)
|
|||
{
|
||||
int e;
|
||||
int f;
|
||||
char *s, *t;
|
||||
const char *s, *t;
|
||||
edict_t *ed;
|
||||
|
||||
e = G_EDICTNUM(OFS_PARM0);
|
||||
|
@ -1020,7 +1019,7 @@ void PF_Find (void)
|
|||
RETURN_EDICT(sv.edicts);
|
||||
}
|
||||
|
||||
void PR_CheckEmptyString (char *s)
|
||||
void PR_CheckEmptyString (const char *s)
|
||||
{
|
||||
if (s[0] <= ' ')
|
||||
PR_RunError ("Bad string");
|
||||
|
@ -1033,7 +1032,7 @@ void PF_precache_file (void)
|
|||
|
||||
void PF_precache_sound (void)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if (sv.state != ss_loading)
|
||||
|
@ -1058,7 +1057,7 @@ void PF_precache_sound (void)
|
|||
|
||||
void PF_precache_model (void)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if (sv.state != ss_loading)
|
||||
|
@ -1188,7 +1187,7 @@ void(float style, string value) lightstyle
|
|||
void PF_lightstyle (void)
|
||||
{
|
||||
int style;
|
||||
char *val;
|
||||
const char *val;
|
||||
client_t *client;
|
||||
int j;
|
||||
|
||||
|
@ -1502,8 +1501,6 @@ void PF_WriteEntity (void)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
int SV_ModelIndex (char *name);
|
||||
|
||||
void PF_makestatic (void)
|
||||
{
|
||||
edict_t *ent;
|
||||
|
@ -1606,7 +1603,7 @@ PF_changelevel
|
|||
*/
|
||||
void PF_changelevel (void)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
// make sure we don't issue two changelevels
|
||||
if (svs.changelevel_issued)
|
||||
|
|
|
@ -33,7 +33,7 @@ int pr_edict_size; // in bytes
|
|||
|
||||
static char *pr_strings;
|
||||
static int pr_stringssize;
|
||||
static char **pr_knownstrings;
|
||||
static const char **pr_knownstrings;
|
||||
static int pr_maxknownstrings;
|
||||
static int pr_numknownstrings;
|
||||
static ddef_t *pr_fielddefs;
|
||||
|
@ -53,7 +53,7 @@ int type_size[8] = {
|
|||
};
|
||||
|
||||
ddef_t *ED_FieldAtOfs (int ofs);
|
||||
qboolean ED_ParseEpair (void *base, ddef_t *key, char *s);
|
||||
qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s);
|
||||
|
||||
cvar_t nomonsters = {"nomonsters", "0"};
|
||||
cvar_t gamecfg = {"gamecfg", "0"};
|
||||
|
@ -201,7 +201,7 @@ ddef_t *ED_FieldAtOfs (int ofs)
|
|||
ED_FindField
|
||||
============
|
||||
*/
|
||||
ddef_t *ED_FindField (char *name)
|
||||
ddef_t *ED_FindField (const char *name)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
|
@ -221,7 +221,7 @@ ddef_t *ED_FindField (char *name)
|
|||
ED_FindGlobal
|
||||
============
|
||||
*/
|
||||
ddef_t *ED_FindGlobal (char *name)
|
||||
ddef_t *ED_FindGlobal (const char *name)
|
||||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
|
@ -241,7 +241,7 @@ ddef_t *ED_FindGlobal (char *name)
|
|||
ED_FindFunction
|
||||
============
|
||||
*/
|
||||
dfunction_t *ED_FindFunction (char *name)
|
||||
dfunction_t *ED_FindFunction (const char *name)
|
||||
{
|
||||
dfunction_t *func;
|
||||
int i;
|
||||
|
@ -260,7 +260,7 @@ dfunction_t *ED_FindFunction (char *name)
|
|||
GetEdictFieldValue
|
||||
============
|
||||
*/
|
||||
eval_t *GetEdictFieldValue(edict_t *ed, char *field)
|
||||
eval_t *GetEdictFieldValue(edict_t *ed, const char *field)
|
||||
{
|
||||
ddef_t *def = NULL;
|
||||
int i;
|
||||
|
@ -299,7 +299,7 @@ PR_ValueString
|
|||
Returns a string describing *data in a type specific manner
|
||||
=============
|
||||
*/
|
||||
char *PR_ValueString (etype_t type, eval_t *val)
|
||||
const char *PR_ValueString (etype_t type, eval_t *val)
|
||||
{
|
||||
static char line[256];
|
||||
ddef_t *def;
|
||||
|
@ -351,7 +351,7 @@ Returns a string describing *data in a type specific manner
|
|||
Easier to parse than PR_ValueString
|
||||
=============
|
||||
*/
|
||||
char *PR_UglyValueString (etype_t type, eval_t *val)
|
||||
const char *PR_UglyValueString (etype_t type, eval_t *val)
|
||||
{
|
||||
static char line[256];
|
||||
ddef_t *def;
|
||||
|
@ -400,9 +400,9 @@ Returns a string with a description and the contents of a global,
|
|||
padded to 20 field width
|
||||
============
|
||||
*/
|
||||
char *PR_GlobalString (int ofs)
|
||||
const char *PR_GlobalString (int ofs)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
int i;
|
||||
ddef_t *def;
|
||||
void *val;
|
||||
|
@ -426,7 +426,7 @@ char *PR_GlobalString (int ofs)
|
|||
return line;
|
||||
}
|
||||
|
||||
char *PR_GlobalStringNoContents (int ofs)
|
||||
const char *PR_GlobalStringNoContents (int ofs)
|
||||
{
|
||||
int i;
|
||||
ddef_t *def;
|
||||
|
@ -459,7 +459,7 @@ void ED_Print (edict_t *ed)
|
|||
ddef_t *d;
|
||||
int *v;
|
||||
int i, j, l;
|
||||
char *name;
|
||||
const char *name;
|
||||
int type;
|
||||
|
||||
if (ed->free)
|
||||
|
@ -508,7 +508,7 @@ void ED_Write (FILE *f, edict_t *ed)
|
|||
ddef_t *d;
|
||||
int *v;
|
||||
int i, j;
|
||||
char *name;
|
||||
const char *name;
|
||||
int type;
|
||||
|
||||
fprintf (f, "{\n");
|
||||
|
@ -644,7 +644,7 @@ void ED_WriteGlobals (FILE *f)
|
|||
{
|
||||
ddef_t *def;
|
||||
int i;
|
||||
char *name;
|
||||
const char *name;
|
||||
int type;
|
||||
|
||||
fprintf (f,"{\n");
|
||||
|
@ -656,9 +656,7 @@ void ED_WriteGlobals (FILE *f)
|
|||
continue;
|
||||
type &= ~DEF_SAVEGLOBAL;
|
||||
|
||||
if (type != ev_string
|
||||
&& type != ev_float
|
||||
&& type != ev_entity)
|
||||
if (type != ev_string && type != ev_float && type != ev_entity)
|
||||
continue;
|
||||
|
||||
name = PR_GetString(def->s_name);
|
||||
|
@ -673,7 +671,7 @@ void ED_WriteGlobals (FILE *f)
|
|||
ED_ParseGlobals
|
||||
=============
|
||||
*/
|
||||
void ED_ParseGlobals (char *data)
|
||||
void ED_ParseGlobals (const char *data)
|
||||
{
|
||||
char keyname[64];
|
||||
ddef_t *key;
|
||||
|
@ -752,7 +750,7 @@ Can parse either fields or globals
|
|||
returns false if error
|
||||
=============
|
||||
*/
|
||||
qboolean ED_ParseEpair (void *base, ddef_t *key, char *s)
|
||||
qboolean ED_ParseEpair (void *base, ddef_t *key, const char *s)
|
||||
{
|
||||
int i;
|
||||
char string[128];
|
||||
|
@ -828,7 +826,7 @@ ed should be a properly initialized empty edict.
|
|||
Used for initial level load and for savegames.
|
||||
====================
|
||||
*/
|
||||
char *ED_ParseEdict (char *data, edict_t *ent)
|
||||
const char *ED_ParseEdict (const char *data, edict_t *ent)
|
||||
{
|
||||
ddef_t *key;
|
||||
qboolean anglehack;
|
||||
|
@ -938,7 +936,7 @@ Used for both fresh maps and savegame loads. A fresh map would also need
|
|||
to call ED_CallSpawnFunctions () to let the objects initialize themselves.
|
||||
================
|
||||
*/
|
||||
void ED_LoadFromFile (char *data)
|
||||
void ED_LoadFromFile (const char *data)
|
||||
{
|
||||
edict_t *ent = NULL;
|
||||
int inhibit = 0;
|
||||
|
@ -1168,10 +1166,10 @@ static void PR_AllocStringSlots (void)
|
|||
{
|
||||
pr_maxknownstrings += PR_STRING_ALLOCSLOTS;
|
||||
Con_DPrintf("PR_AllocStringSlots: realloc'ing for %d slots\n", pr_maxknownstrings);
|
||||
pr_knownstrings = (char **) Z_Realloc (pr_knownstrings, pr_maxknownstrings * sizeof(char *));
|
||||
pr_knownstrings = (const char **) Z_Realloc ((void *)pr_knownstrings, pr_maxknownstrings * sizeof(char *));
|
||||
}
|
||||
|
||||
char *PR_GetString (int num)
|
||||
const char *PR_GetString (int num)
|
||||
{
|
||||
if (num >= 0 && num < pr_stringssize)
|
||||
return pr_strings + num;
|
||||
|
@ -1191,7 +1189,7 @@ char *PR_GetString (int num)
|
|||
}
|
||||
}
|
||||
|
||||
int PR_SetEngineString (char *s)
|
||||
int PR_SetEngineString (const char *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1247,7 +1245,7 @@ int PR_AllocString (int size, char **ptr)
|
|||
// }
|
||||
pr_knownstrings[i] = (char *)Hunk_AllocName(size, "string");
|
||||
if (ptr)
|
||||
*ptr = pr_knownstrings[i];
|
||||
*ptr = (char *) pr_knownstrings[i];
|
||||
return -1 - i;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ int pr_xstatement;
|
|||
|
||||
int pr_argc;
|
||||
|
||||
char *pr_opnames[] =
|
||||
const char *pr_opnames[] =
|
||||
{
|
||||
"DONE",
|
||||
|
||||
|
@ -137,8 +137,8 @@ char *pr_opnames[] =
|
|||
"BITOR"
|
||||
};
|
||||
|
||||
char *PR_GlobalString (int ofs);
|
||||
char *PR_GlobalStringNoContents (int ofs);
|
||||
const char *PR_GlobalString (int ofs);
|
||||
const char *PR_GlobalStringNoContents (int ofs);
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -70,8 +70,8 @@ void PR_LoadProgs (void);
|
|||
|
||||
void PR_Profile_f (void);
|
||||
|
||||
char *PR_GetString (int num);
|
||||
int PR_SetEngineString (char *s);
|
||||
const char *PR_GetString (int num);
|
||||
int PR_SetEngineString (const char *s);
|
||||
int PR_AllocString (int bufferlength, char **ptr);
|
||||
|
||||
edict_t *ED_Alloc (void);
|
||||
|
@ -79,12 +79,12 @@ void ED_Free (edict_t *ed);
|
|||
|
||||
void ED_Print (edict_t *ed);
|
||||
void ED_Write (FILE *f, edict_t *ed);
|
||||
char *ED_ParseEdict (char *data, edict_t *ent);
|
||||
const char *ED_ParseEdict (const char *data, edict_t *ent);
|
||||
|
||||
void ED_WriteGlobals (FILE *f);
|
||||
void ED_ParseGlobals (char *data);
|
||||
void ED_ParseGlobals (const char *data);
|
||||
|
||||
void ED_LoadFromFile (char *data);
|
||||
void ED_LoadFromFile (const char *data);
|
||||
|
||||
//define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
|
||||
//define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts)/pr_edict_size)
|
||||
|
@ -131,7 +131,7 @@ void PR_RunError (const char *error, ...) __attribute__((__format__(__printf__,1
|
|||
void ED_PrintEdicts (void);
|
||||
void ED_PrintNum (int ent);
|
||||
|
||||
eval_t *GetEdictFieldValue(edict_t *ed, char *field);
|
||||
eval_t *GetEdictFieldValue(edict_t *ed, const char *field);
|
||||
|
||||
#endif /* _QUAKE_PROGS_H */
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ void Sbar_DrawCharacter (int x, int y, int num)
|
|||
Sbar_DrawString -- johnfitz -- rewritten now that GL_SetCanvas is doing the work
|
||||
================
|
||||
*/
|
||||
void Sbar_DrawString (int x, int y, char *str)
|
||||
void Sbar_DrawString (int x, int y, const char *str)
|
||||
{
|
||||
Draw_String (x, y + 24, str);
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ Sbar_DrawScrollString -- johnfitz
|
|||
scroll the string inside a glscissor region
|
||||
===============
|
||||
*/
|
||||
void Sbar_DrawScrollString (int x, int y, int width, char* str)
|
||||
void Sbar_DrawScrollString (int x, int y, int width, const char *str)
|
||||
{
|
||||
float scale;
|
||||
int len, ofs, left;
|
||||
|
|
|
@ -33,12 +33,12 @@ void SCR_UpdateScreen (void);
|
|||
void SCR_SizeUp (void);
|
||||
void SCR_SizeDown (void);
|
||||
void SCR_BringDownConsole (void);
|
||||
void SCR_CenterPrint (char *str);
|
||||
void SCR_CenterPrint (const char *str);
|
||||
|
||||
void SCR_BeginLoadingPlaque (void);
|
||||
void SCR_EndLoadingPlaque (void);
|
||||
|
||||
int SCR_ModalMessage (char *text, float timeout); //johnfitz -- added timeout
|
||||
int SCR_ModalMessage (const char *text, float timeout); //johnfitz -- added timeout
|
||||
|
||||
extern float scr_con_current;
|
||||
extern float scr_conlines; // lines of console to display
|
||||
|
|
|
@ -52,10 +52,10 @@ typedef struct
|
|||
char name[64]; // map name
|
||||
char modelname[64]; // maps/<name>.bsp, for model_precache[0]
|
||||
struct model_s *worldmodel;
|
||||
char *model_precache[MAX_MODELS]; // NULL terminated
|
||||
const char *model_precache[MAX_MODELS]; // NULL terminated
|
||||
struct model_s *models[MAX_MODELS];
|
||||
char *sound_precache[MAX_SOUNDS]; // NULL terminated
|
||||
char *lightstyles[MAX_LIGHTSTYLES];
|
||||
const char *sound_precache[MAX_SOUNDS]; // NULL terminated
|
||||
const char *lightstyles[MAX_LIGHTSTYLES];
|
||||
int num_edicts;
|
||||
int max_edicts;
|
||||
edict_t *edicts; // can NOT be array indexed, because
|
||||
|
@ -195,7 +195,7 @@ extern edict_t *sv_player;
|
|||
void SV_Init (void);
|
||||
|
||||
void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count);
|
||||
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
|
||||
void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
|
||||
float attenuation);
|
||||
|
||||
void SV_DropClient (qboolean crash);
|
||||
|
@ -203,7 +203,7 @@ void SV_DropClient (qboolean crash);
|
|||
void SV_SendClientMessages (void);
|
||||
void SV_ClearDatagram (void);
|
||||
|
||||
int SV_ModelIndex (char *name);
|
||||
int SV_ModelIndex (const char *name);
|
||||
|
||||
void SV_SetIdealPitch (void);
|
||||
|
||||
|
@ -227,7 +227,7 @@ void SV_MoveToGoal (void);
|
|||
void SV_CheckForNewClients (void);
|
||||
void SV_RunClients (void);
|
||||
void SV_SaveSpawnparms ();
|
||||
void SV_SpawnServer (char *server);
|
||||
void SV_SpawnServer (const char *server);
|
||||
|
||||
#endif /* _QUAKE_SERVER_H */
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ S_FindName
|
|||
|
||||
==================
|
||||
*/
|
||||
sfx_t *S_FindName (char *name)
|
||||
sfx_t *S_FindName (const char *name)
|
||||
{
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
|
@ -257,7 +257,7 @@ S_TouchSound
|
|||
|
||||
==================
|
||||
*/
|
||||
void S_TouchSound (char *name)
|
||||
void S_TouchSound (const char *name)
|
||||
{
|
||||
sfx_t *sfx;
|
||||
|
||||
|
@ -274,7 +274,7 @@ S_PrecacheSound
|
|||
|
||||
==================
|
||||
*/
|
||||
sfx_t *S_PrecacheSound (char *name)
|
||||
sfx_t *S_PrecacheSound (const char *name)
|
||||
{
|
||||
sfx_t *sfx;
|
||||
|
||||
|
@ -903,7 +903,7 @@ void S_SoundList (void)
|
|||
}
|
||||
|
||||
|
||||
void S_LocalSound (char *name)
|
||||
void S_LocalSound (const char *name)
|
||||
{
|
||||
sfx_t *sfx;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ S_LoadSound
|
|||
*/
|
||||
sfxcache_t *S_LoadSound (sfx_t *s)
|
||||
{
|
||||
char namebuffer[256];
|
||||
char namebuffer[256];
|
||||
byte *data;
|
||||
wavinfo_t info;
|
||||
int len;
|
||||
|
@ -190,7 +190,7 @@ int GetLittleLong(void)
|
|||
return val;
|
||||
}
|
||||
|
||||
void FindNextChunk(char *name)
|
||||
void FindNextChunk(const char *name)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ void FindNextChunk(char *name)
|
|||
}
|
||||
}
|
||||
|
||||
void FindChunk(char *name)
|
||||
void FindChunk(const char *name)
|
||||
{
|
||||
last_chunk = iff_data;
|
||||
FindNextChunk (name);
|
||||
|
@ -246,7 +246,7 @@ void DumpChunks(void)
|
|||
GetWavinfo
|
||||
============
|
||||
*/
|
||||
wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength)
|
||||
wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength)
|
||||
{
|
||||
wavinfo_t info;
|
||||
int i;
|
||||
|
|
|
@ -105,8 +105,8 @@ void S_ExtraUpdate (void);
|
|||
void S_BlockSound (void);
|
||||
void S_UnblockSound (void);
|
||||
|
||||
sfx_t *S_PrecacheSound (char *sample);
|
||||
void S_TouchSound (char *sample);
|
||||
sfx_t *S_PrecacheSound (const char *sample);
|
||||
void S_TouchSound (const char *sample);
|
||||
void S_ClearPrecache (void);
|
||||
void S_BeginPrecaching (void);
|
||||
void S_EndPrecaching (void);
|
||||
|
@ -180,10 +180,10 @@ extern qboolean snd_initialized;
|
|||
|
||||
extern int snd_blocked;
|
||||
|
||||
void S_LocalSound (char *s);
|
||||
void S_LocalSound (const char *s);
|
||||
sfxcache_t *S_LoadSound (sfx_t *s);
|
||||
|
||||
wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength);
|
||||
wavinfo_t GetWavinfo (const char *name, byte *wav, int wavlength);
|
||||
|
||||
void SND_InitScaletable (void);
|
||||
|
||||
|
|
|
@ -158,13 +158,10 @@ Larger attenuations will drop off. (max 4 attenuation)
|
|||
|
||||
==================
|
||||
*/
|
||||
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
|
||||
float attenuation)
|
||||
void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, float attenuation)
|
||||
{
|
||||
int sound_num;
|
||||
int field_mask;
|
||||
int i;
|
||||
int ent;
|
||||
int sound_num, ent;
|
||||
int i, field_mask;
|
||||
|
||||
if (volume < 0 || volume > 255)
|
||||
Sys_Error ("SV_StartSound: volume = %i", volume);
|
||||
|
@ -179,16 +176,17 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
|
|||
return;
|
||||
|
||||
// find precache number for sound
|
||||
for (sound_num=1 ; sound_num<MAX_SOUNDS
|
||||
&& sv.sound_precache[sound_num] ; sound_num++)
|
||||
if (!strcmp(sample, sv.sound_precache[sound_num]))
|
||||
break;
|
||||
for (sound_num = 1; sound_num < MAX_SOUNDS && sv.sound_precache[sound_num]; sound_num++)
|
||||
{
|
||||
if (!strcmp(sample, sv.sound_precache[sound_num]))
|
||||
break;
|
||||
}
|
||||
|
||||
if ( sound_num == MAX_SOUNDS || !sv.sound_precache[sound_num] )
|
||||
{
|
||||
Con_Printf ("SV_StartSound: %s not precacheed\n", sample);
|
||||
return;
|
||||
}
|
||||
if (sound_num == MAX_SOUNDS || !sv.sound_precache[sound_num])
|
||||
{
|
||||
Con_Printf ("SV_StartSound: %s not precacheed\n", sample);
|
||||
return;
|
||||
}
|
||||
|
||||
ent = NUM_FOR_EDICT(entity);
|
||||
|
||||
|
@ -237,7 +235,7 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
|
|||
MSG_WriteByte (&sv.datagram, sound_num);
|
||||
//johnfitz
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
MSG_WriteCoord (&sv.datagram, entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]));
|
||||
}
|
||||
|
||||
|
@ -259,7 +257,7 @@ This will be sent on the initial connection and upon each server load.
|
|||
*/
|
||||
void SV_SendServerinfo (client_t *client)
|
||||
{
|
||||
char **s;
|
||||
const char **s;
|
||||
char message[2048];
|
||||
int i; //johnfitz
|
||||
|
||||
|
@ -1095,7 +1093,7 @@ SV_ModelIndex
|
|||
|
||||
================
|
||||
*/
|
||||
int SV_ModelIndex (char *name)
|
||||
int SV_ModelIndex (const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1276,7 +1274,7 @@ This is called at the start of each level
|
|||
================
|
||||
*/
|
||||
extern float scr_centertime_off;
|
||||
void SV_SpawnServer (char *server)
|
||||
void SV_SpawnServer (const char *server)
|
||||
{
|
||||
static char dummy[8] = { 0,0,0,0,0,0,0,0 };
|
||||
edict_t *ent;
|
||||
|
|
|
@ -485,7 +485,7 @@ qboolean SV_ReadClientMessage (void)
|
|||
{
|
||||
int ret;
|
||||
int ccmd;
|
||||
char *s;
|
||||
const char *s;
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
@ -33,15 +33,15 @@ void Sys_Init (void);
|
|||
// returns the file size
|
||||
// return -1 if file is not present
|
||||
// the file should be in BINARY mode for stupid OSs that care
|
||||
int Sys_FileOpenRead (char *path, int *hndl);
|
||||
int Sys_FileOpenRead (const char *path, int *hndl);
|
||||
|
||||
int Sys_FileOpenWrite (char *path);
|
||||
int Sys_FileOpenWrite (const char *path);
|
||||
void Sys_FileClose (int handle);
|
||||
void Sys_FileSeek (int handle, int position);
|
||||
int Sys_FileRead (int handle, void *dest, int count);
|
||||
int Sys_FileWrite (int handle, void *data, int count);
|
||||
int Sys_FileTime (char *path);
|
||||
void Sys_mkdir (char *path);
|
||||
int Sys_FileWrite (int handle,const void *data, int count);
|
||||
int Sys_FileTime (const char *path);
|
||||
void Sys_mkdir (const char *path);
|
||||
|
||||
//
|
||||
// system IO
|
||||
|
|
|
@ -65,7 +65,7 @@ int Sys_filelength (FILE *f)
|
|||
return end;
|
||||
}
|
||||
|
||||
int Sys_FileOpenRead (char *path, int *hndl)
|
||||
int Sys_FileOpenRead (const char *path, int *hndl)
|
||||
{
|
||||
FILE *f;
|
||||
int i, retval;
|
||||
|
@ -88,7 +88,7 @@ int Sys_FileOpenRead (char *path, int *hndl)
|
|||
return retval;
|
||||
}
|
||||
|
||||
int Sys_FileOpenWrite (char *path)
|
||||
int Sys_FileOpenWrite (const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
|
@ -119,12 +119,12 @@ int Sys_FileRead (int handle, void *dest, int count)
|
|||
return fread (dest, 1, count, sys_handles[handle]);
|
||||
}
|
||||
|
||||
int Sys_FileWrite (int handle, void *data, int count)
|
||||
int Sys_FileWrite (int handle, const void *data, int count)
|
||||
{
|
||||
return fwrite (data, 1, count, sys_handles[handle]);
|
||||
}
|
||||
|
||||
int Sys_FileTime (char *path)
|
||||
int Sys_FileTime (const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
|
@ -143,7 +143,7 @@ void Sys_Init (void)
|
|||
{
|
||||
}
|
||||
|
||||
void Sys_mkdir (char *path)
|
||||
void Sys_mkdir (const char *path)
|
||||
{
|
||||
int rc = mkdir (path, 0777);
|
||||
if (rc != 0 && errno != EEXIST)
|
||||
|
|
|
@ -69,7 +69,7 @@ int Sys_filelength (FILE *f)
|
|||
return end;
|
||||
}
|
||||
|
||||
int Sys_FileOpenRead (char *path, int *hndl)
|
||||
int Sys_FileOpenRead (const char *path, int *hndl)
|
||||
{
|
||||
FILE *f;
|
||||
int i, retval;
|
||||
|
@ -92,7 +92,7 @@ int Sys_FileOpenRead (char *path, int *hndl)
|
|||
return retval;
|
||||
}
|
||||
|
||||
int Sys_FileOpenWrite (char *path)
|
||||
int Sys_FileOpenWrite (const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
int i;
|
||||
|
@ -123,12 +123,12 @@ int Sys_FileRead (int handle, void *dest, int count)
|
|||
return fread (dest, 1, count, sys_handles[handle]);
|
||||
}
|
||||
|
||||
int Sys_FileWrite (int handle, void *data, int count)
|
||||
int Sys_FileWrite (int handle, const void *data, int count)
|
||||
{
|
||||
return fwrite (data, 1, count, sys_handles[handle]);
|
||||
}
|
||||
|
||||
int Sys_FileTime (char *path)
|
||||
int Sys_FileTime (const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
|
@ -158,7 +158,7 @@ void Sys_Init (void)
|
|||
}
|
||||
}
|
||||
|
||||
void Sys_mkdir (char *path)
|
||||
void Sys_mkdir (const char *path)
|
||||
{
|
||||
int rc = _mkdir (path);
|
||||
if (rc != 0 && errno != EEXIST)
|
||||
|
|
|
@ -39,7 +39,7 @@ Space padding is so names can be printed nicely in tables.
|
|||
Can safely be performed in place.
|
||||
==================
|
||||
*/
|
||||
void W_CleanupName (char *in, char *out)
|
||||
void W_CleanupName (const char *in, char *out)
|
||||
{
|
||||
int i;
|
||||
int c;
|
||||
|
@ -70,7 +70,7 @@ void W_LoadWadFile (void) //johnfitz -- filename is now hard-coded for honesty
|
|||
wadinfo_t *header;
|
||||
unsigned i;
|
||||
int infotableofs;
|
||||
char *filename = WADFILENAME;
|
||||
const char *filename = WADFILENAME;
|
||||
|
||||
//johnfitz -- modified to use malloc
|
||||
//TODO: use cache_alloc
|
||||
|
@ -100,7 +100,7 @@ void W_LoadWadFile (void) //johnfitz -- filename is now hard-coded for honesty
|
|||
{
|
||||
lump_p->filepos = LittleLong(lump_p->filepos);
|
||||
lump_p->size = LittleLong(lump_p->size);
|
||||
W_CleanupName (lump_p->name, lump_p->name);
|
||||
W_CleanupName (lump_p->name, lump_p->name); // CAUTION: in-place editing!!!
|
||||
if (lump_p->type == TYP_QPIC)
|
||||
SwapPic ( (qpic_t *)(wad_base + lump_p->filepos));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void W_LoadWadFile (void) //johnfitz -- filename is now hard-coded for honesty
|
|||
W_GetLumpinfo
|
||||
=============
|
||||
*/
|
||||
lumpinfo_t *W_GetLumpinfo (char *name)
|
||||
lumpinfo_t *W_GetLumpinfo (const char *name)
|
||||
{
|
||||
int i;
|
||||
lumpinfo_t *lump_p;
|
||||
|
@ -130,7 +130,7 @@ lumpinfo_t *W_GetLumpinfo (char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void *W_GetLumpName (char *name)
|
||||
void *W_GetLumpName (const char *name)
|
||||
{
|
||||
lumpinfo_t *lump;
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ extern lumpinfo_t *wad_lumps;
|
|||
extern byte *wad_base;
|
||||
|
||||
void W_LoadWadFile (void); //johnfitz -- filename is now hard-coded for honesty
|
||||
void W_CleanupName (char *in, char *out);
|
||||
lumpinfo_t *W_GetLumpinfo (char *name);
|
||||
void *W_GetLumpName (char *name);
|
||||
void W_CleanupName (const char *in, char *out);
|
||||
lumpinfo_t *W_GetLumpinfo (const char *name);
|
||||
void *W_GetLumpName (const char *name);
|
||||
void *W_GetLumpNum (int num);
|
||||
|
||||
void SwapPic (qpic_t *pic);
|
||||
|
|
|
@ -108,61 +108,7 @@ void Z_Free (void *ptr)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
Z_Malloc
|
||||
========================
|
||||
*/
|
||||
void *Z_Malloc (int size)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
Z_CheckHeap (); // DEBUG
|
||||
buf = Z_TagMalloc (size, 1);
|
||||
if (!buf)
|
||||
Sys_Error ("Z_Malloc: failed on allocation of %i bytes",size);
|
||||
Q_memset (buf, 0, size);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Z_Realloc
|
||||
========================
|
||||
*/
|
||||
void *Z_Realloc(void *ptr, int size)
|
||||
{
|
||||
int old_size;
|
||||
void *old_ptr;
|
||||
memblock_t *block;
|
||||
|
||||
if (!ptr)
|
||||
return Z_Malloc (size);
|
||||
|
||||
block = (memblock_t *) ((byte *) ptr - sizeof (memblock_t));
|
||||
if (block->id != ZONEID)
|
||||
Sys_Error ("Z_Realloc: realloced a pointer without ZONEID");
|
||||
if (block->tag == 0)
|
||||
Sys_Error ("Z_Realloc: realloced a freed pointer");
|
||||
|
||||
old_size = block->size;
|
||||
old_size -= (4 + (int)sizeof(memblock_t)); /* see Z_TagMalloc() */
|
||||
old_ptr = ptr;
|
||||
|
||||
Z_Free (ptr);
|
||||
ptr = Z_TagMalloc (size, 1);
|
||||
if (!ptr)
|
||||
Sys_Error ("Z_Realloc: failed on allocation of %i bytes", size);
|
||||
|
||||
if (ptr != old_ptr)
|
||||
memmove (ptr, old_ptr, min (old_size, size));
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
void *Z_TagMalloc (int size, int tag)
|
||||
static void *Z_TagMalloc (int size, int tag)
|
||||
{
|
||||
int extra;
|
||||
memblock_t *start, *rover, *newblock, *base;
|
||||
|
@ -220,6 +166,89 @@ void *Z_TagMalloc (int size, int tag)
|
|||
return (void *) ((byte *)base + sizeof(memblock_t));
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Z_CheckHeap
|
||||
========================
|
||||
*/
|
||||
static void Z_CheckHeap (void)
|
||||
{
|
||||
memblock_t *block;
|
||||
|
||||
for (block = mainzone->blocklist.next ; ; block = block->next)
|
||||
{
|
||||
if (block->next == &mainzone->blocklist)
|
||||
break; // all blocks have been hit
|
||||
if ( (byte *)block + block->size != (byte *)block->next)
|
||||
Sys_Error ("Z_CheckHeap: block size does not touch the next block\n");
|
||||
if ( block->next->prev != block)
|
||||
Sys_Error ("Z_CheckHeap: next block doesn't have proper back link\n");
|
||||
if (!block->tag && !block->next->tag)
|
||||
Sys_Error ("Z_CheckHeap: two consecutive free blocks\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
Z_Malloc
|
||||
========================
|
||||
*/
|
||||
void *Z_Malloc (int size)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
Z_CheckHeap (); // DEBUG
|
||||
buf = Z_TagMalloc (size, 1);
|
||||
if (!buf)
|
||||
Sys_Error ("Z_Malloc: failed on allocation of %i bytes",size);
|
||||
Q_memset (buf, 0, size);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Z_Realloc
|
||||
========================
|
||||
*/
|
||||
void *Z_Realloc(void *ptr, int size)
|
||||
{
|
||||
int old_size;
|
||||
void *old_ptr;
|
||||
memblock_t *block;
|
||||
|
||||
if (!ptr)
|
||||
return Z_Malloc (size);
|
||||
|
||||
block = (memblock_t *) ((byte *) ptr - sizeof (memblock_t));
|
||||
if (block->id != ZONEID)
|
||||
Sys_Error ("Z_Realloc: realloced a pointer without ZONEID");
|
||||
if (block->tag == 0)
|
||||
Sys_Error ("Z_Realloc: realloced a freed pointer");
|
||||
|
||||
old_size = block->size;
|
||||
old_size -= (4 + (int)sizeof(memblock_t)); /* see Z_TagMalloc() */
|
||||
old_ptr = ptr;
|
||||
|
||||
Z_Free (ptr);
|
||||
ptr = Z_TagMalloc (size, 1);
|
||||
if (!ptr)
|
||||
Sys_Error ("Z_Realloc: failed on allocation of %i bytes", size);
|
||||
|
||||
if (ptr != old_ptr)
|
||||
memmove (ptr, old_ptr, min (old_size, size));
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
char *Z_Strdup (const char *s)
|
||||
{
|
||||
char *ptr = (char *) Z_Malloc (strlen(s) + 1);
|
||||
strcpy (ptr, s);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
|
@ -249,28 +278,6 @@ void Z_Print (memzone_t *zone)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
Z_CheckHeap
|
||||
========================
|
||||
*/
|
||||
void Z_CheckHeap (void)
|
||||
{
|
||||
memblock_t *block;
|
||||
|
||||
for (block = mainzone->blocklist.next ; ; block = block->next)
|
||||
{
|
||||
if (block->next == &mainzone->blocklist)
|
||||
break; // all blocks have been hit
|
||||
if ( (byte *)block + block->size != (byte *)block->next)
|
||||
Sys_Error ("Z_CheckHeap: block size does not touch the next block\n");
|
||||
if ( block->next->prev != block)
|
||||
Sys_Error ("Z_CheckHeap: next block doesn't have proper back link\n");
|
||||
if (!block->tag && !block->next->tag)
|
||||
Sys_Error ("Z_CheckHeap: two consecutive free blocks\n");
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
#define HUNK_SENTINAL 0x1df001ed
|
||||
|
@ -417,7 +424,7 @@ void Hunk_Print_f (void)
|
|||
Hunk_AllocName
|
||||
===================
|
||||
*/
|
||||
void *Hunk_AllocName (int size, char *name)
|
||||
void *Hunk_AllocName (int size, const char *name)
|
||||
{
|
||||
hunk_t *h;
|
||||
|
||||
|
@ -500,7 +507,7 @@ void Hunk_FreeToHighMark (int mark)
|
|||
Hunk_HighAllocName
|
||||
===================
|
||||
*/
|
||||
void *Hunk_HighAllocName (int size, char *name)
|
||||
void *Hunk_HighAllocName (int size, const char *name)
|
||||
{
|
||||
hunk_t *h;
|
||||
|
||||
|
@ -567,6 +574,13 @@ void *Hunk_TempAlloc (int size)
|
|||
return buf;
|
||||
}
|
||||
|
||||
char *Hunk_Strdup (const char *s, const char *name)
|
||||
{
|
||||
char *ptr = (char *) Hunk_AllocName (strlen(s) + 1, name);
|
||||
strcpy (ptr, s);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
@ -896,7 +910,7 @@ void *Cache_Check (cache_user_t *c)
|
|||
Cache_Alloc
|
||||
==============
|
||||
*/
|
||||
void *Cache_Alloc (cache_user_t *c, int size, char *name)
|
||||
void *Cache_Alloc (cache_user_t *c, int size, const char *name)
|
||||
{
|
||||
cache_system_t *cs;
|
||||
|
||||
|
|
|
@ -93,14 +93,12 @@ void Memory_Init (void *buf, int size);
|
|||
void Z_Free (void *ptr);
|
||||
void *Z_Malloc (int size); // returns 0 filled memory
|
||||
void *Z_Realloc (void *ptr, int size);
|
||||
void *Z_TagMalloc (int size, int tag);
|
||||
|
||||
void Z_CheckHeap (void);
|
||||
char *Z_Strdup (const char *s);
|
||||
|
||||
void *Hunk_Alloc (int size); // returns 0 filled memory
|
||||
void *Hunk_AllocName (int size, char *name);
|
||||
|
||||
void *Hunk_HighAllocName (int size, char *name);
|
||||
void *Hunk_AllocName (int size, const char *name);
|
||||
void *Hunk_HighAllocName (int size, const char *name);
|
||||
char *Hunk_Strdup (const char *s, const char *name);
|
||||
|
||||
int Hunk_LowMark (void);
|
||||
void Hunk_FreeToLowMark (int mark);
|
||||
|
@ -125,7 +123,7 @@ void *Cache_Check (cache_user_t *c);
|
|||
|
||||
void Cache_Free (cache_user_t *c, qboolean freetextures); //johnfitz -- added second argument
|
||||
|
||||
void *Cache_Alloc (cache_user_t *c, int size, char *name);
|
||||
void *Cache_Alloc (cache_user_t *c, int size, const char *name);
|
||||
// Returns NULL if all purgable data was tossed and there still
|
||||
// wasn't enough room.
|
||||
|
||||
|
|
Loading…
Reference in a new issue