*/
#include "quakedef.h"
+#include "sv_demo.h"
+#include "image.h"
int current_skill;
cvar_t sv_cheats = {0, "sv_cheats", "0", "enables cheat commands in any game, and cheat impulses in dpmod"};
cvar_t team = {CVAR_USERINFO | CVAR_SAVE, "team", "none", "QW team (4 character limit, example: blue)"};
cvar_t skin = {CVAR_USERINFO | CVAR_SAVE, "skin", "", "QW player skin name (example: base)"};
cvar_t noaim = {CVAR_USERINFO | CVAR_SAVE, "noaim", "1", "QW option to disable vertical autoaim"};
+cvar_t r_fixtrans_auto = {0, "r_fixtrans_auto", "0", "automatically fixtrans textures (when set to 2, it also saves the fixed versions to a fixtrans directory)"};
qboolean allowcheats = false;
extern qboolean host_shuttingdown;
return;
}
+ // GAME_DELUXEQUAKE - clear warpmark (used by QC)
+ if (gamemode == GAME_DELUXEQUAKE)
+ Cvar_Set("warpmark", "");
+
cls.demonum = -1; // stop demo loop in case this fails
CL_Disconnect ();
Con_Printf("Loading game from %s...\n", filename);
+ // stop playing demos
+ if (cls.demoplayback)
+ CL_Disconnect ();
+
+ // remove menu
+ key_dest = key_game;
+
cls.demonum = -1; // stop demo loop in case this fails
t = text = (char *)FS_LoadFile (filename, tempmempool, false, NULL);
}
// version
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
version = atoi(com_token);
if (version != SAVEGAME_VERSION)
{
}
// description
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
for (i = 0;i < NUM_SPAWN_PARMS;i++)
{
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
spawn_parms[i] = atof(com_token);
}
// skill
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
// this silliness is so we can load 1.06 save files, which have float skill values
current_skill = (int)(atof(com_token) + 0.5);
Cvar_SetValue ("skill", (float)current_skill);
// mapname
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
strlcpy (mapname, com_token, sizeof(mapname));
// time
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
time = atof(com_token);
allowcheats = sv_cheats.integer != 0;
{
// light style
oldt = t;
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
// if this is a 64 lightstyle savegame produced by Quake, stop now
// we have to check this because darkplaces saves 256 lightstyle savegames
if (com_token[0] == '{')
for(;;)
{
oldt = t;
- COM_ParseToken_Simple(&t, false);
+ COM_ParseToken_Simple(&t, false, false);
if (com_token[0] == '{')
{
t = oldt;
for (;;)
{
start = t;
- while (COM_ParseToken_Simple(&t, false))
+ while (COM_ParseToken_Simple(&t, false, false))
if (!strcmp(com_token, "}"))
break;
- if (!COM_ParseToken_Simple(&start, false))
+ if (!COM_ParseToken_Simple(&start, false, false))
{
// end of file
break;
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
+ SV_WriteNetnameIntoDemo(host_client);
}
}
if (sv.loadgame)
{
// loaded games are fully initialized already
- // if this is the last client to be connected, unpause
- sv.paused = false;
-
if (prog->funcoffsets.RestoreGame)
{
Con_DPrint("Calling RestoreGame\n");
prog->globals.server->self = PRVM_EDICT_TO_PROG(host_client->edict);
PRVM_ExecuteProgram (prog->globals.server->ClientConnect, "QC function ClientConnect is missing");
- if (svs.maxclients > 1 || cls.state == ca_dedicated)
- Con_Printf("%s entered the game\n", host_client->name);
+ if (cls.state == ca_dedicated)
+ Con_Printf("%s connected\n", host_client->name);
PRVM_ExecuteProgram (prog->globals.server->PutClientInServer, "QC function PutClientInServer is missing");
}
MSG_WriteAngle (&host_client->netconnection->message, host_client->edict->fields.server->v_angle[0], sv.protocol);
MSG_WriteAngle (&host_client->netconnection->message, host_client->edict->fields.server->v_angle[1], sv.protocol);
MSG_WriteAngle (&host_client->netconnection->message, 0, sv.protocol);
- sv.loadgame = false; // we're basically done with loading now
}
else
{
void Host_Begin_f (void)
{
host_client->spawned = true;
+
+ // LordHavoc: note: this code also exists in SV_DropClient
+ if (sv.loadgame)
+ {
+ int i;
+ for (i = 0;i < svs.maxclients;i++)
+ if (svs.clients[i].active && !svs.clients[i].spawned)
+ break;
+ if (i == svs.maxclients)
+ {
+ Con_Printf("Loaded game, everyone rejoined - unpausing\n");
+ sv.paused = sv.loadgame = false; // we're basically done with loading now
+ }
+ }
}
//===========================================================================
if (Cmd_Argc() > 2)
{
message = Cmd_Args();
- COM_ParseToken_Simple(&message, false);
+ COM_ParseToken_Simple(&message, false, false);
if (byNumber)
{
message++; // skip the #
Cmd_AddCommand_WithClientCommand ("pings", NULL, Host_Pings_f, "command sent by clients to request updated ping and packetloss of players on scoreboard (originally from QW, but also used on NQ servers)");
Cmd_AddCommand ("pingplreport", Host_PingPLReport_f, "command sent by server containing client ping and packet loss values for scoreboard, triggered by pings command from client (not used by QW servers)");
+ Cmd_AddCommand ("fixtrans", Image_FixTransparentPixels_f, "change alpha-zero pixels in an image file to sensible values, and write out a new TGA (warning: SLOW)");
+ Cvar_RegisterVariable (&r_fixtrans_auto);
+
Cvar_RegisterVariable (&team);
Cvar_RegisterVariable (&skin);
Cvar_RegisterVariable (&noaim);