Nuke com.c.

It's contents have been moved into game.c and massaged appropriately.
This commit is contained in:
Bill Currie 2011-09-11 14:55:13 +09:00
parent 6fb73b5ae8
commit f921005a5d
9 changed files with 80 additions and 180 deletions

View file

@ -41,7 +41,7 @@ EXTRA_PROGRAMS= nq-fbdev nq-glx nq-mgl nq-sdl nq-sdl32 nq-sgl nq-svga nq-3dfx \
noinst_LIBRARIES= @nq_libs@
EXTRA_LIBRARIES=libnq_client.a libnq_common.a libnq_sdl.a libnq_server.a
libnq_common_a_SOURCES=game.c world.c com.c
libnq_common_a_SOURCES=game.c world.c
libnq_sdl_a_SOURCES= sys_sdl.c
libnq_sdl_a_CFLAGS= $(SDL_CFLAGS)

View file

@ -1,85 +0,0 @@
/*
com.c
misc functions used in client and server
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/sys.h"
#include "game.h"
#include "server.h"
cvar_t *registered;
cvar_t *cmdline;
int static_registered = 1;
/*
COM_CheckRegistered
Looks for the pop.txt file and verifies it.
Sets the "registered" cvar.
Immediately exits out if an alternate game was attempted to be started
without being registered.
*/
static void
COM_CheckRegistered (void)
{
unsigned short check[128];
QFile *h;
QFS_FOpenFile ("gfx/pop.lmp", &h);
static_registered = 0;
if (h) {
static_registered = 1;
Qread (h, check, sizeof (check));
Qclose (h);
}
if (static_registered) {
Cvar_Set (registered, "1");
Sys_Printf ("Playing registered version.\n");
}
}
void
COM_Init (void)
{
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
"Is the game the registered version. 1 yes 0 no");
cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, Cvar_Info, "None");
COM_CheckRegistered ();
}

View file

@ -30,17 +30,59 @@
# include <config.h>
#endif
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/sys.h"
#include "game.h"
#include "server.h"
qboolean standard_quake = false;
cvar_t *registered;
cvar_t *cmdline;
int static_registered = 1;
/*
Game_CheckRegistered
Looks for the pop.txt file and verifies it.
Sets the "registered" cvar.
Immediately exits out if an alternate game was attempted to be started
without being registered.
*/
static void
Game_CheckRegistered (void)
{
unsigned short check[128];
QFile *h;
QFS_FOpenFile ("gfx/pop.lmp", &h);
static_registered = 0;
if (h) {
static_registered = 1;
Qread (h, check, sizeof (check));
Qclose (h);
}
if (static_registered) {
Cvar_Set (registered, "1");
Sys_Printf ("Playing registered version.\n");
}
}
const char *
Game_Init (void)
{
int i;
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
"Is the game the registered version. 1 yes 0 no");
cmdline = Cvar_Get ("cmdline", "0", CVAR_SERVERINFO, Cvar_Info, "None");
Game_CheckRegistered ();
// FIXME: make this dependant on QF metadata in the mission packs
standard_quake = true;

View file

@ -957,7 +957,6 @@ Host_Init (void)
PR_Init ();
V_Init ();
COM_Init ();
if (isDedicated) {
PI_RegisterPlugins (server_plugin_list);

View file

@ -44,7 +44,7 @@ EXTRA_LIBRARIES=libqw_client.a libqw_common.a libqw_sdl.a libqw_server.a
libqw_common_a_SOURCES=\
com.c game.c map_cfg.c pmove.c pmovetst.c net_packetlog.c
game.c map_cfg.c pmove.c pmovetst.c net_packetlog.c
libqw_sdl_a_SOURCES=cl_sys_sdl.c
libqw_sdl_a_CFLAGS=$(SDL_CFLAGS)

View file

@ -1770,7 +1770,6 @@ Host_Init (void)
CL_Skin_Init_Cvars ();
CL_Init_Cvars ();
CL_Prediction_Init_Cvars ();
COM_Init_Cvars ();
Game_Init_Cvars ();
IN_Init_Cvars ();
Key_Init_Cvars ();
@ -1792,7 +1791,6 @@ Host_Init (void)
CL_Cmd_Init ();
V_Init ();
Game_Init ();
COM_Init ();
PI_RegisterPlugins (client_plugin_list);
Con_Init ("client");

View file

@ -1,88 +0,0 @@
/*
com.c
misc functions used in client and server
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#include <ctype.h>
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/quakefs.h"
#include "QF/sys.h"
cvar_t *registered;
int static_registered = 1; // only for startup check, then set
qboolean com_modified; // set true if using non-id files
/*
COM_CheckRegistered
Looks for the pop.txt file and verifies it.
Sets the "registered" cvar.
Immediately exits out if an alternate game was attempted to be started
without being registered.
*/
static void
COM_CheckRegistered (void)
{
unsigned short check[128];
QFile *h;
QFS_FOpenFile ("gfx/pop.lmp", &h);
static_registered = 0;
if (h) {
static_registered = 1;
Qread (h, check, sizeof (check));
Qclose (h);
}
if (static_registered) {
Cvar_Set (registered, "1");
Sys_Printf ("Playing registered version.\n");
}
}
void
COM_Init (void)
{
COM_CheckRegistered ();
}
void
COM_Init_Cvars (void)
{
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
"Is the game the registered version. 1 yes 0 no");
}

View file

@ -48,6 +48,39 @@
cvar_t *registered;
int static_registered = 1; // only for startup check, then set
qboolean com_modified; // set true if using non-id files
/*
Game_CheckRegistered
Looks for the pop.txt file and verifies it.
Sets the "registered" cvar.
Immediately exits out if an alternate game was attempted to be started
without being registered.
*/
static void
Game_CheckRegistered (void)
{
unsigned short check[128];
QFile *h;
QFS_FOpenFile ("gfx/pop.lmp", &h);
static_registered = 0;
if (h) {
static_registered = 1;
Qread (h, check, sizeof (check));
Qclose (h);
}
if (static_registered) {
Cvar_Set (registered, "1");
Sys_Printf ("Playing registered version.\n");
}
}
/*
SV_Gamedir_f
@ -82,6 +115,9 @@ SV_Gamedir_f (void)
void
Game_Init (void)
{
registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL,
"Is the game the registered version. 1 yes 0 no");
Game_CheckRegistered ();
Cmd_AddCommand ("gamedir", SV_Gamedir_f,
"Specifies the directory to be used while playing.");
}

View file

@ -2556,7 +2556,6 @@ SV_Init (void)
Sys_SetErrPrintf (SV_Error);
Game_Init_Cvars ();
COM_Init_Cvars ();
Mod_Init_Cvars ();
Netchan_Init_Cvars ();
Pmove_Init_Cvars ();
@ -2570,7 +2569,6 @@ SV_Init (void)
SV_Sbar_Init ();
Game_Init ();
COM_Init ();
PR_Init ();
SV_Progs_Init ();