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

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

View file

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