mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-10 09:41:09 +00:00
some common.c cleanup: Made COM_InitFilesystem() public through common.h,
moved its calling from COM_Init() to Host_Init() just after COM_Init(). Moved registration of registered and cmdline cvars and COM_Path_f command and the calling of COM_CheckRegistered() to COM_InitFilesystem(). Removed unused memsearch(). Fixed the stupidity in leading space elimination from com_cmdline. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@573 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
0fd7786162
commit
c96c275334
3 changed files with 23 additions and 29 deletions
|
@ -37,7 +37,7 @@ int com_nummissionpacks; //johnfitz
|
||||||
|
|
||||||
qboolean fitzmode;
|
qboolean fitzmode;
|
||||||
|
|
||||||
void COM_InitFilesystem (void);
|
static void COM_Path_f (void);
|
||||||
|
|
||||||
// if a packfile directory differs from this, it is assumed to be hacked
|
// if a packfile directory differs from this, it is assumed to be hacked
|
||||||
#define PAK0_COUNT 339
|
#define PAK0_COUNT 339
|
||||||
|
@ -127,6 +127,7 @@ void InsertLinkBefore (link_t *l, link_t *before)
|
||||||
l->prev->next = l;
|
l->prev->next = l;
|
||||||
l->next->prev = l;
|
l->next->prev = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertLinkAfter (link_t *l, link_t *after)
|
void InsertLinkAfter (link_t *l, link_t *after)
|
||||||
{
|
{
|
||||||
l->next = after->next;
|
l->next = after->next;
|
||||||
|
@ -814,7 +815,6 @@ float MSG_ReadAngle16 (void)
|
||||||
}
|
}
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void SZ_Alloc (sizebuf_t *buf, int startsize)
|
void SZ_Alloc (sizebuf_t *buf, int startsize)
|
||||||
|
@ -884,7 +884,6 @@ void SZ_Print (sizebuf_t *buf, const char *data)
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
COM_SkipPath
|
COM_SkipPath
|
||||||
|
@ -1146,7 +1145,7 @@ Immediately exits out if an alternate game was attempted to be started without
|
||||||
being registered.
|
being registered.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void COM_CheckRegistered (void)
|
static void COM_CheckRegistered (void)
|
||||||
{
|
{
|
||||||
int h;
|
int h;
|
||||||
unsigned short check[128];
|
unsigned short check[128];
|
||||||
|
@ -1169,18 +1168,23 @@ void COM_CheckRegistered (void)
|
||||||
COM_CloseFile (h);
|
COM_CloseFile (h);
|
||||||
|
|
||||||
for (i = 0; i < 128; i++)
|
for (i = 0; i < 128; i++)
|
||||||
|
{
|
||||||
if (pop[i] != (unsigned short)BigShort (check[i]))
|
if (pop[i] != (unsigned short)BigShort (check[i]))
|
||||||
Sys_Error ("Corrupted data file.");
|
Sys_Error ("Corrupted data file.");
|
||||||
|
}
|
||||||
|
|
||||||
Cvar_SetROM ("cmdline", com_cmdline+1); //johnfitz -- eliminate leading space
|
for (i = 0; com_cmdline[i]; i++)
|
||||||
|
{
|
||||||
|
if (com_cmdline[i]!= ' ')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cvar_SetROM ("cmdline", &com_cmdline[i]);
|
||||||
Cvar_SetROM ("registered", "1");
|
Cvar_SetROM ("registered", "1");
|
||||||
Con_Printf ("Playing registered version.\n");
|
Con_Printf ("Playing registered version.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void COM_Path_f (void);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
COM_InitArgv
|
COM_InitArgv
|
||||||
|
@ -1295,13 +1299,6 @@ void COM_Init (void)
|
||||||
|
|
||||||
if (COM_CheckParm("-fitz"))
|
if (COM_CheckParm("-fitz"))
|
||||||
fitzmode = true;
|
fitzmode = true;
|
||||||
|
|
||||||
Cvar_RegisterVariable (®istered);
|
|
||||||
Cvar_RegisterVariable (&cmdline);
|
|
||||||
Cmd_AddCommand ("path", COM_Path_f);
|
|
||||||
COM_InitFilesystem ();
|
|
||||||
COM_CheckRegistered ();
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Cmd_AddCommand ("fitztest", FitzTest_f); //johnfitz
|
Cmd_AddCommand ("fitztest", FitzTest_f); //johnfitz
|
||||||
#endif
|
#endif
|
||||||
|
@ -1342,18 +1339,6 @@ char *va (const char *format, ...)
|
||||||
return va_buf;
|
return va_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// just for debugging
|
|
||||||
int memsearch (byte *start, int count, int search)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
if (start[i] == search)
|
|
||||||
return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
||||||
|
@ -1422,7 +1407,7 @@ searchpath_t *com_searchpaths;
|
||||||
COM_Path_f
|
COM_Path_f
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void COM_Path_f (void)
|
static void COM_Path_f (void)
|
||||||
{
|
{
|
||||||
searchpath_t *s;
|
searchpath_t *s;
|
||||||
|
|
||||||
|
@ -1860,7 +1845,7 @@ pack_t *COM_LoadPackFile (const char *packfile)
|
||||||
COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial
|
COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void COM_AddGameDirectory (const char *dir)
|
static void COM_AddGameDirectory (const char *dir)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int path_id;
|
unsigned int path_id;
|
||||||
|
@ -1931,6 +1916,10 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
Cvar_RegisterVariable (®istered);
|
||||||
|
Cvar_RegisterVariable (&cmdline);
|
||||||
|
Cmd_AddCommand ("path", COM_Path_f);
|
||||||
|
|
||||||
i = COM_CheckParm ("-basedir");
|
i = COM_CheckParm ("-basedir");
|
||||||
if (i && i < com_argc-1)
|
if (i && i < com_argc-1)
|
||||||
q_strlcpy (com_basedir, com_argv[i + 1], sizeof(com_basedir));
|
q_strlcpy (com_basedir, com_argv[i + 1], sizeof(com_basedir));
|
||||||
|
@ -1981,6 +1970,8 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
|
||||||
com_modified = true;
|
com_modified = true;
|
||||||
COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i + 1]));
|
COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i + 1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COM_CheckRegistered ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -174,8 +174,10 @@ extern int safemode;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int COM_CheckParm (const char *parm);
|
int COM_CheckParm (const char *parm);
|
||||||
|
|
||||||
void COM_Init (void);
|
void COM_Init (void);
|
||||||
void COM_InitArgv (int argc, char **argv);
|
void COM_InitArgv (int argc, char **argv);
|
||||||
|
void COM_InitFilesystem (void);
|
||||||
|
|
||||||
const char *COM_SkipPath (const char *pathname);
|
const char *COM_SkipPath (const char *pathname);
|
||||||
void COM_StripExtension (const char *in, char *out, size_t outsize);
|
void COM_StripExtension (const char *in, char *out, size_t outsize);
|
||||||
|
|
|
@ -841,6 +841,7 @@ void Host_Init (void)
|
||||||
LOG_Init (host_parms);
|
LOG_Init (host_parms);
|
||||||
Cvar_Init (); //johnfitz
|
Cvar_Init (); //johnfitz
|
||||||
COM_Init ();
|
COM_Init ();
|
||||||
|
COM_InitFilesystem ();
|
||||||
Host_InitLocal ();
|
Host_InitLocal ();
|
||||||
W_LoadWadFile (); //johnfitz -- filename is now hard-coded for honesty
|
W_LoadWadFile (); //johnfitz -- filename is now hard-coded for honesty
|
||||||
if (cls.state != ca_dedicated)
|
if (cls.state != ca_dedicated)
|
||||||
|
|
Loading…
Reference in a new issue