mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
pull the game specific stuff out of quakefs.c in preparation for merging it
This commit is contained in:
parent
1d9791553f
commit
b432d0ea17
10 changed files with 162 additions and 76 deletions
|
@ -73,5 +73,6 @@ void COM_Filesystem_Init (void);
|
|||
void COM_Filesystem_Init_Cvars (void);
|
||||
void COM_Path_f (void);
|
||||
void COM_Maplist_f (void);
|
||||
void COM_CreateGameDirectory (char *gamename);
|
||||
|
||||
#endif // __quakefs_h
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "game.h"
|
||||
|
||||
qboolean standard_quake = false;
|
||||
|
@ -42,6 +43,18 @@ qboolean standard_quake = false;
|
|||
void
|
||||
Game_Init (void)
|
||||
{
|
||||
// This used to have the -hipnotic and -rogue checks, but they've been
|
||||
// moved to quakefs.c for the time being..
|
||||
int i;
|
||||
// FIXME: make this dependant on QF metadata in the mission packs
|
||||
standard_quake = true;
|
||||
if ((i = COM_CheckParm ("-hipnotic"))) {
|
||||
COM_CreateGameDirectory ("hipnotic");
|
||||
standard_quake = false;
|
||||
}
|
||||
if ((i = COM_CheckParm ("-rogue"))) {
|
||||
COM_CreateGameDirectory ("rogue");
|
||||
standard_quake = false;
|
||||
}
|
||||
if ((i = COM_CheckParm ("-abyss"))) {
|
||||
COM_CreateGameDirectory ("abyss");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,17 +65,15 @@
|
|||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "draw.h"
|
||||
#include "QF/hash.h"
|
||||
#include "host.h"
|
||||
#include "QF/info.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "server.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#ifndef HAVE_FNMATCH_PROTO
|
||||
int fnmatch (const char *__pattern, const char *__string, int __flags);
|
||||
|
@ -679,10 +677,8 @@ COM_LoadFile (char *path, int usehunk)
|
|||
Sys_Error ("COM_LoadFile: not enough space for %s", path);
|
||||
|
||||
((byte *) buf)[len] = 0;
|
||||
Draw_BeginDisc ();
|
||||
Qread (h, buf, len);
|
||||
Qclose (h);
|
||||
Draw_EndDisc ();
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -941,12 +937,6 @@ COM_AddDirectory (char *dir)
|
|||
void
|
||||
COM_AddGameDirectory (char *dir)
|
||||
{
|
||||
// FIXME: make this dependant on QF metadata in the mission packs
|
||||
if (strequal (dir, "hipnotic") || strequal (dir, "rogue"))
|
||||
standard_quake = false;
|
||||
else
|
||||
standard_quake = true;
|
||||
|
||||
Con_DPrintf ("COM_AddGameDirectory (\"%s/%s\")\n",
|
||||
fs_sharepath->string, dir);
|
||||
|
||||
|
@ -1031,15 +1021,6 @@ COM_Filesystem_Init (void)
|
|||
}
|
||||
free (gamedirs);
|
||||
}
|
||||
if ((i = COM_CheckParm ("-hipnotic"))) {
|
||||
COM_CreateGameDirectory ("hipnotic");
|
||||
}
|
||||
if ((i = COM_CheckParm ("-rogue"))) {
|
||||
COM_CreateGameDirectory ("rogue");
|
||||
}
|
||||
if ((i = COM_CheckParm ("-abyss"))) {
|
||||
COM_CreateGameDirectory ("abyss");
|
||||
}
|
||||
// any set gamedirs will be freed up to here
|
||||
com_base_searchpaths = com_searchpaths;
|
||||
}
|
||||
|
|
42
qw/include/game.h
Normal file
42
qw/include/game.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
game.h
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
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
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef __game_h
|
||||
#define __game_h
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qdefs.h"
|
||||
|
||||
extern cvar_t *registered;
|
||||
|
||||
void Game_Init (void);
|
||||
|
||||
#endif // __game_h
|
|
@ -50,7 +50,7 @@ if ASM_ARCH
|
|||
math_ASM = sys_x86.S
|
||||
endif
|
||||
common_SOURCES= buildnum.c com.c \
|
||||
model.c model_brush.c msg_ucmd.c \
|
||||
game.c model.c model_brush.c msg_ucmd.c \
|
||||
pmove.c pmovetst.c quakefs.c \
|
||||
$(math_ASM) $(packetlogger)
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "draw.h"
|
||||
#include "game.h"
|
||||
#include "host.h"
|
||||
#include "input.h"
|
||||
#include "QF/keys.h"
|
||||
|
@ -1602,6 +1603,8 @@ Host_Init (void)
|
|||
|
||||
cl_Cmd_Init ();
|
||||
V_Init ();
|
||||
COM_Filesystem_Init ();
|
||||
Game_Init ();
|
||||
COM_Init ();
|
||||
|
||||
NET_Init (PORT_CLIENT);
|
||||
|
|
|
@ -87,7 +87,6 @@ COM_Init (void)
|
|||
{
|
||||
Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using");
|
||||
|
||||
COM_Filesystem_Init ();
|
||||
COM_CheckRegistered ();
|
||||
}
|
||||
|
||||
|
|
96
qw/source/game.c
Normal file
96
qw/source/game.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
game.c
|
||||
|
||||
game specific support
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
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
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/info.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "game.h"
|
||||
#include "server.h"
|
||||
|
||||
extern qboolean is_server;
|
||||
|
||||
/*
|
||||
SV_Gamedir_f
|
||||
|
||||
Sets the gamedir and path to a different directory.
|
||||
*/
|
||||
|
||||
void
|
||||
SV_Gamedir_f (void)
|
||||
{
|
||||
char *dir;
|
||||
|
||||
if (Cmd_Argc () == 1) {
|
||||
Con_Printf ("Current gamedir: %s\n", gamedirfile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc () != 2) {
|
||||
Con_Printf ("Usage: gamedir <newdir>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dir = Cmd_Argv (1);
|
||||
|
||||
if (strstr (dir, "..") || strstr (dir, "/")
|
||||
|| strstr (dir, "\\") || strstr (dir, ":")) {
|
||||
Con_Printf ("Gamedir should be a single filename, not a path\n");
|
||||
return;
|
||||
}
|
||||
|
||||
COM_Gamedir (dir);
|
||||
|
||||
if (is_server) {
|
||||
Info_SetValueForStarKey (svs_info, "*gamedir", dir,
|
||||
MAX_SERVERINFO_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Game_Init
|
||||
*/
|
||||
void
|
||||
Game_Init (void)
|
||||
{
|
||||
Cmd_AddCommand ("gamedir", SV_Gamedir_f,
|
||||
"Specifies the directory to be used while playing.");
|
||||
}
|
|
@ -62,29 +62,24 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "commdef.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "draw.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/info.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "server.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#ifndef HAVE_FNMATCH_PROTO
|
||||
int fnmatch (const char *__pattern, const char *__string, int __flags);
|
||||
#endif
|
||||
|
||||
|
||||
extern qboolean is_server;
|
||||
|
||||
|
||||
/*
|
||||
All of Quake's data access is through a hierchical file system, but the
|
||||
contents of the file system can be transparently merged from several
|
||||
|
@ -683,14 +678,8 @@ COM_LoadFile (char *path, int usehunk)
|
|||
Sys_Error ("COM_LoadFile: not enough space for %s", path);
|
||||
|
||||
((byte *) buf)[len] = 0;
|
||||
if (!is_server) {
|
||||
Draw_BeginDisc ();
|
||||
}
|
||||
Qread (h, buf, len);
|
||||
Qclose (h);
|
||||
if (!is_server) {
|
||||
Draw_EndDisc ();
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -1002,43 +991,6 @@ COM_Gamedir (char *dir)
|
|||
COM_AddGameDirectory (dir);
|
||||
}
|
||||
|
||||
/*
|
||||
SV_Gamedir_f
|
||||
|
||||
Sets the gamedir and path to a different directory.
|
||||
*/
|
||||
|
||||
void
|
||||
COM_Gamedir_f (void)
|
||||
{
|
||||
char *dir;
|
||||
|
||||
if (Cmd_Argc () == 1) {
|
||||
Con_Printf ("Current gamedir: %s\n", gamedirfile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc () != 2) {
|
||||
Con_Printf ("Usage: gamedir <newdir>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
dir = Cmd_Argv (1);
|
||||
|
||||
if (strstr (dir, "..") || strstr (dir, "/")
|
||||
|| strstr (dir, "\\") || strstr (dir, ":")) {
|
||||
Con_Printf ("Gamedir should be a single filename, not a path\n");
|
||||
return;
|
||||
}
|
||||
|
||||
COM_Gamedir (dir);
|
||||
|
||||
if (is_server) {
|
||||
Info_SetValueForStarKey (svs_info, "*gamedir", dir,
|
||||
MAX_SERVERINFO_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
COM_CreateGameDirectory
|
||||
*/
|
||||
|
@ -1058,9 +1010,6 @@ COM_Filesystem_Init (void)
|
|||
{
|
||||
int i;
|
||||
|
||||
Cmd_AddCommand ("gamedir", COM_Gamedir_f,
|
||||
"Specifies the directory to be used while playing.");
|
||||
|
||||
// start up with basegame->string by default
|
||||
COM_CreateGameDirectory (fs_basegame->string);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "buildnum.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "game.h"
|
||||
#include "model.h"
|
||||
#include "net.h"
|
||||
#include "QF/msg.h"
|
||||
|
@ -1926,6 +1927,7 @@ SV_Init (void)
|
|||
Cmd_StuffCmds_f ();
|
||||
Cbuf_Execute_Sets ();
|
||||
|
||||
COM_Filesystem_Init ();
|
||||
COM_Init ();
|
||||
|
||||
PR_Init ();
|
||||
|
|
Loading…
Reference in a new issue