From f921005a5d1aba667b4ddc5ed2c229b94f8d2007 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 11 Sep 2011 14:55:13 +0900 Subject: [PATCH] Nuke com.c. It's contents have been moved into game.c and massaged appropriately. --- nq/source/Makefile.am | 2 +- nq/source/com.c | 85 ----------------------------------------- nq/source/game.c | 42 +++++++++++++++++++++ nq/source/host.c | 1 - qw/source/Makefile.am | 2 +- qw/source/cl_main.c | 2 - qw/source/com.c | 88 ------------------------------------------- qw/source/game.c | 36 ++++++++++++++++++ qw/source/sv_main.c | 2 - 9 files changed, 80 insertions(+), 180 deletions(-) delete mode 100644 nq/source/com.c delete mode 100644 qw/source/com.c diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index daeb49dc3..d304f6271 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -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) diff --git a/nq/source/com.c b/nq/source/com.c deleted file mode 100644 index efbb6c1e0..000000000 --- a/nq/source/com.c +++ /dev/null @@ -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 (); -} diff --git a/nq/source/game.c b/nq/source/game.c index 969583021..bbbface90 100644 --- a/nq/source/game.c +++ b/nq/source/game.c @@ -30,17 +30,59 @@ # include #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; diff --git a/nq/source/host.c b/nq/source/host.c index d33e4d95e..74d40d40a 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -957,7 +957,6 @@ Host_Init (void) PR_Init (); V_Init (); - COM_Init (); if (isDedicated) { PI_RegisterPlugins (server_plugin_list); diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index 6e081b605..15e4e7155 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -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) diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index b4fbc38b9..a17956306 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -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"); diff --git a/qw/source/com.c b/qw/source/com.c deleted file mode 100644 index b09970225..000000000 --- a/qw/source/com.c +++ /dev/null @@ -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 - -#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"); -} diff --git a/qw/source/game.c b/qw/source/game.c index 83fed6d6a..727bb28fe 100644 --- a/qw/source/game.c +++ b/qw/source/game.c @@ -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."); } diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index b7bd606b0..dc670a072 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -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 ();