#include "cgamevm.h"
-void Host_PerformSpawnServerAndLoadGame(void);
-
#endif
return; // no tokens
}
-// check functions
- for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
+// check functions (only after host_initialized)
+ if (host_initialized || !strcasecmp(cmd_argv[0], "exec"))
{
- if (!strcasecmp (cmd_argv[0],cmd->name))
+ for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
- cmd->function ();
- cmd_tokenizebufferpos = oldpos;
- return;
+ if (!strcasecmp (cmd_argv[0],cmd->name))
+ {
+ cmd->function ();
+ cmd_tokenizebufferpos = oldpos;
+ return;
+ }
}
}
-// check alias
- for (a=cmd_alias ; a ; a=a->next)
+// check alias (only after host_initialized)
+ if (host_initialized)
{
- if (!strcasecmp (cmd_argv[0], a->name))
+ for (a=cmd_alias ; a ; a=a->next)
{
- Cbuf_InsertText (a->value);
- cmd_tokenizebufferpos = oldpos;
- return;
+ if (!strcasecmp (cmd_argv[0], a->name))
+ {
+ Cbuf_InsertText (a->value);
+ cmd_tokenizebufferpos = oldpos;
+ return;
+ }
}
}
-// check cvars
- if (!Cvar_Command ())
+// check cvars (always)
+ if (!Cvar_Command () && host_initialized)
Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0));
cmd_tokenizebufferpos = oldpos;
// perform a variable print or set
if (Cmd_Argc() == 1)
{
- Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
+ // only print if host_initialized (otherwise it could print twice if this is in a script)
+ if (host_initialized)
+ Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
return true;
}
static char hosterrorstring1[4096];
static char hosterrorstring2[4096];
static qboolean hosterror = false;
-extern char sv_spawnmap[MAX_QPATH];
-extern char sv_loadgame[MAX_OSPATH];
void Host_Error (const char *error, ...)
{
va_list argptr;
strcpy(hosterrorstring2, hosterrorstring1);
- // make sure we don't get in a loading loop
- sv_loadgame[0] = 0;
- sv_spawnmap[0] = 0;
-
CL_Parse_DumpPacket();
PR_Crash();
// process console commands
Cbuf_Execute();
- // LordHavoc: map and load are delayed until video is initialized
- Host_PerformSpawnServerAndLoadGame();
-
// if running the server locally, make intentions now
if (cls.state == ca_connected && sv.active)
CL_SendCmd(&cmd);
CL_Init();
}
- Cbuf_InsertText ("exec quake.rc\n");
- Cbuf_Execute();
- Cbuf_Execute();
- Cbuf_Execute();
+ // only cvars are executed when host_initialized == false
+ Cbuf_InsertText("exec quake.rc\n");
Cbuf_Execute();
host_initialized = true;
SCR_BeginLoadingPlaque();
MR_Init();
}
+
+ // stuff it again so the first host frame will execute it again, this time
+ // in its entirety
+ Cbuf_InsertText("exec quake.rc\n");
+ Cbuf_Execute();
}
#include "quakedef.h"
int current_skill;
-char sv_spawnmap[MAX_QPATH];
-char sv_loadgame[MAX_OSPATH];
-
cvar_t sv_cheats = {0, "sv_cheats", "0"};
qboolean allowcheats = false;
*/
void Host_Map_f (void)
{
+ char level[MAX_QPATH];
+
if (cmd_source != src_command)
return;
key_dest = key_game; // remove console or menu
SCR_BeginLoadingPlaque ();
-
svs.serverflags = 0; // haven't completed an episode yet
- strcpy (sv_spawnmap, Cmd_Argv(1));
- if (host_initialized)
- Host_PerformSpawnServerAndLoadGame();
+ allowcheats = sv_cheats.integer != 0;
+ strcpy(level, Cmd_Argv(1));
+ SV_SpawnServer(level);
+ if (sv.active && cls.state == ca_disconnected)
+ CL_EstablishConnection("local");
}
/*
*/
void Host_Changelevel_f (void)
{
+ char level[MAX_QPATH];
+
if (Cmd_Argc() != 2)
{
Con_Printf ("changelevel <levelname> : continue game on a new level\n");
return;
}
SV_SaveSpawnparms ();
- strcpy (sv_spawnmap, Cmd_Argv(1));
- if (host_initialized)
- Host_PerformSpawnServerAndLoadGame();
+ allowcheats = sv_cheats.integer != 0;
+ strcpy(level, Cmd_Argv(1));
+ SV_SpawnServer(level);
+ if (sv.active && cls.state == ca_disconnected)
+ CL_EstablishConnection("local");
}
/*
*/
void Host_Restart_f (void)
{
+ char mapname[MAX_QPATH];
+
if (cls.demoplayback || !sv.active)
return;
if (cmd_source != src_command)
return;
- strcpy (sv_spawnmap, sv.name);
- if (host_initialized)
- Host_PerformSpawnServerAndLoadGame();
+ allowcheats = sv_cheats.integer != 0;
+ strcpy(mapname, sv.name);
+ SV_SpawnServer(mapname);
+ if (sv.active && cls.state == ca_disconnected)
+ CL_EstablishConnection("local");
}
/*
===============
*/
void Host_Loadgame_f (void)
-{
- if (cmd_source != src_command)
- return;
-
- if (Cmd_Argc() != 2)
- {
- Con_Printf ("load <savename> : load a game\n");
- return;
- }
-
- strcpy (sv_loadgame, Cmd_Argv(1));
- FS_DefaultExtension (sv_loadgame, ".sav", sizeof (sv_loadgame));
-
- Con_Printf ("Loading game from %s...\n", sv_loadgame);
-}
-
-void Host_PerformLoadGame(char *name)
{
qfile_t *f;
+ char filename[MAX_QPATH];
char mapname[MAX_QPATH];
float time, tfloat;
char buf[32768];
int version;
float spawn_parms[NUM_SPAWN_PARMS];
+ if (cmd_source != src_command)
+ return;
+
+ if (Cmd_Argc() != 2)
+ {
+ Con_Printf ("load <savename> : load a game\n");
+ return;
+ }
+
+ strcpy (filename, Cmd_Argv(1));
+ FS_DefaultExtension (filename, ".sav", sizeof (filename));
+
+ Con_Printf ("Loading game from %s...\n", filename);
+
cls.demonum = -1; // stop demo loop in case this fails
- f = FS_Open (name, "r", false);
+ f = FS_Open (filename, "r", false);
if (!f)
{
Con_Printf ("ERROR: couldn't open.\n");
if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
{
- if (!sv.active && !sv_spawnmap[0])
+ if (!sv.active)
{
if (gamemode == GAME_TRANSFUSION)
Cbuf_AddText ("map bb1\n");
CL_Disconnect ();
}
-// LordHavoc: because we don't want to load things before the video starts,
-// we have to delay map and game loads until AFTER video is initialized
-void Host_PerformSpawnServerAndLoadGame(void)
-{
- if (vid_hidden && cls.state != ca_dedicated)
- return;
- if (sv_loadgame[0])
- Host_PerformLoadGame(sv_loadgame);
- else if (sv_spawnmap[0])
- {
- allowcheats = sv_cheats.integer != 0;
- SV_SpawnServer(sv_spawnmap);
- }
- sv_loadgame[0] = 0;
- sv_spawnmap[0] = 0;
- if (sv.active && cls.state == ca_disconnected)
- Cbuf_AddText ("connect local");
-}
-
static void MaxPlayers_f(void)
{
int n;
if (sv.active)
SV_SendReconnect();
else
+ {
+ // make sure cvars have been checked before opening the ports
+ NetConn_ServerFrame();
NetConn_OpenServerPorts(true);
+ }
//
// make cvars consistant
-n darkplaces: server is starting before the "port" cvar is set by commandline and scripts? (yummyluv)
-n darkplaces: typing ip in join game menu should show 'trying' and 'no response' after a while, or 'no network' if networking is not initialized (yummyluv)
-n dpmod: make grapple off-hand (joe hill)
+0 darkplaces: add GL_EXT_stencil_two_side support to shadow rendering (fuh)
0 darkplaces: mini scoreboard (the deathmatch overlay) shows player names multiple times in some cases?
4 darkplaces: add qw protocol support (making darkplaces work as a qwcl client) (tell Fuh)
0 darkplaces: add some cl_explosions_ cvars to control settings - start alpha, end alpha, start size, end size, life time (Supajoe, Mercury)
0 darkplaces: "edict -1" and other invalid numbers cause an error, should just complain (Supajoe)
2 darkplaces: add another TE_TELEPORT effect that spawns particles at a model's vertices (Urre)
0 darkplaces: change sky handling to draw sky even if fog is on (Deej, C0burn)
-3 darkplaces: redesign startup script handling to simply stop execution until video inits, when it encounters certain commands (instead of delaying those commands)
+3 darkplaces: redesign startup script handling to scan scripts for cvars (ignoring commands) and then init video and then run the scripts for real
d darkplaces: physics bug: rotating bmodels stop when the player blocks them instead of pushing the player
d darkplaces: physics bug: fiends can leap through the player (thanks to Tomaz for massive assistance in tracking down this longstanding bug)
-n darkplaces: physics bug: bmodels (doors, etc) hurt player if player pushes against it, and sometimes gets stuck for a frame when falling onto it (Andrew A. Gilevsky)
d darkplaces: add DP_LITSUPPORT extension and document it
0 darkplaces: add DP_SV_ROTATINGBMODEL extension to explain that MOVETYPE_PUSH/SOLID_BSP support rotation in darkplaces and a demonstration of how to use it without qc modifications (Uffe, Supajoe)
0 darkplaces: add Draw2D function to model struct to make it easy to draw models without an entity (Tomaz)
-0 darkplaces: add _reflect textures which filter use of skybox as a cubemap reflection (FrikaC)
+4 darkplaces: add _reflect textures which filter use of skybox as a cubemap reflection (FrikaC)
0 darkplaces: add a .collision_cancollide QC function call to decide if an entity should collide with another, or pass through it (Uffe)
0 darkplaces: add a clipmask thingy to allow QC to mask off collisions as it wishes (Uffe)
-n darkplaces: add a config saving command (Speeds)
-0 darkplaces: add a loading screen (gfx/loadback.tga or the loading plaque if that's not found) before loading commences so that people have something to look at when the engine starts... (SeienAbunae)
+2 darkplaces: add a loading screen (gfx/loadback.tga or the loading plaque if that's not found) before loading commences so that people have something to look at when the engine starts... (SeienAbunae)
-n darkplaces: add a scr_screenshot_jpeg_quality cvar (Electro)
0 darkplaces: add ability to load gfx/particlefont.tga (Vermeulen, frightfan, Error)
0 darkplaces: add automatic binding to whatever address the machine's hostname resolves to (in addition to 0.0.0.0); see original quake code for examples (yummyluv)