mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-02 17:41:10 +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_Filesystem_Init_Cvars (void);
|
||||||
void COM_Path_f (void);
|
void COM_Path_f (void);
|
||||||
void COM_Maplist_f (void);
|
void COM_Maplist_f (void);
|
||||||
|
void COM_CreateGameDirectory (char *gamename);
|
||||||
|
|
||||||
#endif // __quakefs_h
|
#endif // __quakefs_h
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
|
#include "QF/quakefs.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
qboolean standard_quake = false;
|
qboolean standard_quake = false;
|
||||||
|
@ -42,6 +43,18 @@ qboolean standard_quake = false;
|
||||||
void
|
void
|
||||||
Game_Init (void)
|
Game_Init (void)
|
||||||
{
|
{
|
||||||
// This used to have the -hipnotic and -rogue checks, but they've been
|
int i;
|
||||||
// moved to quakefs.c for the time being..
|
// 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/compat.h"
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "draw.h"
|
|
||||||
#include "QF/hash.h"
|
#include "QF/hash.h"
|
||||||
#include "host.h"
|
|
||||||
#include "QF/info.h"
|
#include "QF/info.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
#include "QF/qendian.h"
|
#include "QF/qendian.h"
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
#include "QF/quakefs.h"
|
#include "QF/quakefs.h"
|
||||||
#include "server.h"
|
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
#include "QF/zone.h"
|
||||||
|
|
||||||
#ifndef HAVE_FNMATCH_PROTO
|
#ifndef HAVE_FNMATCH_PROTO
|
||||||
int fnmatch (const char *__pattern, const char *__string, int __flags);
|
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);
|
Sys_Error ("COM_LoadFile: not enough space for %s", path);
|
||||||
|
|
||||||
((byte *) buf)[len] = 0;
|
((byte *) buf)[len] = 0;
|
||||||
Draw_BeginDisc ();
|
|
||||||
Qread (h, buf, len);
|
Qread (h, buf, len);
|
||||||
Qclose (h);
|
Qclose (h);
|
||||||
Draw_EndDisc ();
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -941,12 +937,6 @@ COM_AddDirectory (char *dir)
|
||||||
void
|
void
|
||||||
COM_AddGameDirectory (char *dir)
|
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",
|
Con_DPrintf ("COM_AddGameDirectory (\"%s/%s\")\n",
|
||||||
fs_sharepath->string, dir);
|
fs_sharepath->string, dir);
|
||||||
|
|
||||||
|
@ -1031,15 +1021,6 @@ COM_Filesystem_Init (void)
|
||||||
}
|
}
|
||||||
free (gamedirs);
|
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
|
// any set gamedirs will be freed up to here
|
||||||
com_base_searchpaths = com_searchpaths;
|
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
|
math_ASM = sys_x86.S
|
||||||
endif
|
endif
|
||||||
common_SOURCES= buildnum.c com.c \
|
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 \
|
pmove.c pmovetst.c quakefs.c \
|
||||||
$(math_ASM) $(packetlogger)
|
$(math_ASM) $(packetlogger)
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
#include "game.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
|
@ -1602,6 +1603,8 @@ Host_Init (void)
|
||||||
|
|
||||||
cl_Cmd_Init ();
|
cl_Cmd_Init ();
|
||||||
V_Init ();
|
V_Init ();
|
||||||
|
COM_Filesystem_Init ();
|
||||||
|
Game_Init ();
|
||||||
COM_Init ();
|
COM_Init ();
|
||||||
|
|
||||||
NET_Init (PORT_CLIENT);
|
NET_Init (PORT_CLIENT);
|
||||||
|
|
|
@ -87,7 +87,6 @@ COM_Init (void)
|
||||||
{
|
{
|
||||||
Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using");
|
Cmd_AddCommand ("path", COM_Path_f, "Show what paths Quake is using");
|
||||||
|
|
||||||
COM_Filesystem_Init ();
|
|
||||||
COM_CheckRegistered ();
|
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 <limits.h>
|
||||||
|
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "commdef.h"
|
|
||||||
#include "QF/compat.h"
|
#include "QF/compat.h"
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "draw.h"
|
|
||||||
#include "QF/hash.h"
|
#include "QF/hash.h"
|
||||||
#include "QF/info.h"
|
#include "QF/info.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
#include "QF/qendian.h"
|
#include "QF/qendian.h"
|
||||||
#include "QF/qtypes.h"
|
#include "QF/qtypes.h"
|
||||||
#include "QF/quakefs.h"
|
#include "QF/quakefs.h"
|
||||||
#include "server.h"
|
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
#include "QF/zone.h"
|
||||||
|
|
||||||
#ifndef HAVE_FNMATCH_PROTO
|
#ifndef HAVE_FNMATCH_PROTO
|
||||||
int fnmatch (const char *__pattern, const char *__string, int __flags);
|
int fnmatch (const char *__pattern, const char *__string, int __flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern qboolean is_server;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
All of Quake's data access is through a hierchical file system, but the
|
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
|
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);
|
Sys_Error ("COM_LoadFile: not enough space for %s", path);
|
||||||
|
|
||||||
((byte *) buf)[len] = 0;
|
((byte *) buf)[len] = 0;
|
||||||
if (!is_server) {
|
|
||||||
Draw_BeginDisc ();
|
|
||||||
}
|
|
||||||
Qread (h, buf, len);
|
Qread (h, buf, len);
|
||||||
Qclose (h);
|
Qclose (h);
|
||||||
if (!is_server) {
|
|
||||||
Draw_EndDisc ();
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -1002,43 +991,6 @@ COM_Gamedir (char *dir)
|
||||||
COM_AddGameDirectory (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
|
COM_CreateGameDirectory
|
||||||
*/
|
*/
|
||||||
|
@ -1058,9 +1010,6 @@ COM_Filesystem_Init (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Cmd_AddCommand ("gamedir", COM_Gamedir_f,
|
|
||||||
"Specifies the directory to be used while playing.");
|
|
||||||
|
|
||||||
// start up with basegame->string by default
|
// start up with basegame->string by default
|
||||||
COM_CreateGameDirectory (fs_basegame->string);
|
COM_CreateGameDirectory (fs_basegame->string);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "buildnum.h"
|
#include "buildnum.h"
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/compat.h"
|
#include "QF/compat.h"
|
||||||
|
#include "game.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "QF/msg.h"
|
#include "QF/msg.h"
|
||||||
|
@ -1926,6 +1927,7 @@ SV_Init (void)
|
||||||
Cmd_StuffCmds_f ();
|
Cmd_StuffCmds_f ();
|
||||||
Cbuf_Execute_Sets ();
|
Cbuf_Execute_Sets ();
|
||||||
|
|
||||||
|
COM_Filesystem_Init ();
|
||||||
COM_Init ();
|
COM_Init ();
|
||||||
|
|
||||||
PR_Init ();
|
PR_Init ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue