{
Con_Printf("Initializing client\n");
+ Cvar_SetValueQuick(&host_isclient, 1);
+
R_Modules_Init();
Palette_Init();
#ifdef CONFIG_MENU
cvar_t sessionid = {CF_CLIENT | CF_SERVER | CF_READONLY, "sessionid", "", "ID of the current session (use the -sessionid parameter to set it); this is always either empty or begins with a dot (.)"};
cvar_t locksession = {CF_CLIENT | CF_SERVER, "locksession", "0", "Lock the session? 0 = no, 1 = yes and abort on failure, 2 = yes and continue on failure"};
+cvar_t host_isclient = {CF_SHARED | CF_READONLY, "_host_isclient", "0", "If 1, clientside is active."};
+
/*
================
Host_AbortCurrentFrame
Cvar_RegisterCallback (&host_framerate, Host_Framerate_c);
Cvar_RegisterVariable (&host_speeds);
Cvar_RegisterVariable (&host_maxwait);
+ Cvar_RegisterVariable (&host_isclient);
Cvar_RegisterVariable (&developer);
Cvar_RegisterVariable (&developer_extra);
*/
void VM_coredump(prvm_prog_t *prog)
{
- cmd_state_t *cmd = cls.state == ca_dedicated ? &cmd_server : &cmd_client;
+ cmd_state_t *cmd = !host_isclient.integer ? &cmd_server : &cmd_client;
VM_SAFEPARMCOUNT(0,VM_coredump);
Cbuf_AddText(cmd, "prvm_edicts ");
} host_t;
extern host_t host;
+extern cvar_t host_isclient;
void Host_InitCommands(void);
void Host_Main(void);
void SV_ApplyClientMove (void);
void SV_SaveSpawnparms (void);
+
+qbool SV_IsLocalServer(void);
void SV_SpawnServer (const char *map);
void SV_CheckVelocity (prvm_edict_t *ent);
else
print = SV_ClientPrintf;
- if (!pausable.integer)
+ if (!pausable.integer && cmd->source == src_client && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) != LHNETADDRESSTYPE_LOOP)
{
- if (cmd->source == src_client)
- {
- if(cls.state == ca_dedicated || host_client != &svs.clients[0]) // non-admin
- {
- print("Pause not allowed.\n");
- return;
- }
- }
+ print("Pause not allowed.\n");
+ return;
}
sv.paused ^= 1;
SV_ClientPrint(text);
host_client = save;
- if (cls.state == ca_dedicated)
+ if(!host_isclient.integer)
Con_Print(&text[1]);
}
{
if (cmd->source == src_local)
{
- if (cls.state == ca_dedicated)
+ if(!host_isclient.integer)
who = "Console";
else
who = cl_name.string;
cvarname = Cmd_Argv(cmd, 1);
old = host_client;
- if (cls.state != ca_dedicated)
+ if(host_isclient.integer)
i = 1;
else
i = 0;
}
}
+qbool SV_IsLocalServer(void)
+{
+ if(host_isclient.integer && host_client && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) == LHNETADDRESSTYPE_LOOP)
+ return true;
+ return false;
+}
+
/*
================
SV_SpawnServer
// SV_LockThreadMutex();
- if(cls.state == ca_dedicated)
+ if(!host_isclient.integer)
Sys_MakeProcessNice();
-
- if (cls.state != ca_dedicated)
+ else
{
SCR_BeginLoadingPlaque(false);
S_StopAllSounds();
{
Con_Printf("Couldn't load map %s\n", modelname);
- if(cls.state == ca_dedicated)
+ if(!host_isclient.integer)
Sys_MakeProcessMean();
// SV_UnlockThreadMutex();
// Once all init frames have been run, we consider svqc code fully initialized.
prog->inittime = host.realtime;
- if (cls.state == ca_dedicated)
+ if(!host_isclient.integer)
Mod_PurgeUnused();
// create a baseline for more efficient communications
Con_Printf("Server spawned.\n");
NetConn_Heartbeat (2);
- if(cls.state == ca_dedicated)
+ if(!host_isclient.integer)
Sys_MakeProcessMean();
// SV_UnlockThreadMutex();
Con_Printf("SV_Loadgame_f: finished\n");
// make sure we're connected to loopback
- if (sv.active && cls.state == ca_disconnected)
- CL_EstablishConnection("local:1", -2);
+ if(sv.active && host.hook.ConnectLocal)
+ host.hook.ConnectLocal();
}
}
}
- if (sv_echobprint.integer && cls.state == ca_dedicated)
+ if (sv_echobprint.integer && !host_isclient.integer)
Con_Print(msg);
}
PRVM_serverglobaledict(self) = PRVM_EDICT_TO_PROG(host_client->edict);
prog->ExecuteProgram(prog, PRVM_serverfunction(ClientConnect), "QC function ClientConnect is missing");
- if (cls.state == ca_dedicated)
- Con_Printf("%s connected\n", host_client->name);
+ Con_Printf("%s connected\n", host_client->name);
PRVM_serverglobalfloat(time) = sv.time;
prog->ExecuteProgram(prog, PRVM_serverfunction(PutClientInServer), "QC function PutClientInServer is missing");