Exemple #1
0
//	An q1svc_signonnum has been received, perform a client side setup
void CLQ1_SignonReply() {
	char str[ 8192 ];

	common->DPrintf( "CLQ1_SignonReply: %i\n", clc.qh_signon );

	switch ( clc.qh_signon ) {
	case 1:
		CL_AddReliableCommand( "prespawn" );
		break;

	case 2:
		CL_AddReliableCommand( va( "name \"%s\"\n", clqh_name->string ) );
		CL_AddReliableCommand( va( "color %i %i\n", clqh_color->integer >> 4, clqh_color->integer & 15 ) );
		sprintf( str, "spawn %s", cls.qh_spawnparms );
		CL_AddReliableCommand( str );
		break;

	case 3:
		CL_AddReliableCommand( "begin" );
		break;

	case 4:
		SCR_EndLoadingPlaque();		// allow normal screen updates
		break;
	}
}
/*
================
Host_Error

This shuts down both the client and server
================
*/
void Host_Error (char *error, ...)
{
    va_list		 argptr;
    char		 string[MAX_PRINTMSG]; //1024
    static	qboolean inerror = false;

    if (inerror)
#ifdef NOISE
        Con_Printf ("Host_Error: recursively entered\n");
#else
        Sys_Error ("Host_Error: recursively entered");
#endif
    inerror = true;

    SCR_EndLoadingPlaque ();		// reenable screen updates

    va_start (argptr,error);
    COM_vsnprintf ("Host_Error", string, sizeof(string) - 1, error, argptr);
    va_end (argptr);
    Con_Printf ("Host_Error: %s\n",string);

    if (sv.active)
        Host_ShutdownServer (false);

    if (cls.state == ca_dedicated)
        Sys_Error ("Host_Error: %s\n",string);	// dedicated servers exit

    CL_Disconnect ();
    cls.demonum = -1;

    inerror = false;

    longjmp (host_abortserver, 1);
}
Exemple #3
0
/*
================
Host_Error

This shuts down both the client and server
================
*/
void
Host_Error(const char *error, ...)
{
    va_list argptr;
    char string[MAX_PRINTMSG];
    static qboolean inerror = false;

    if (inerror)
	Sys_Error("%s: recursively entered", __func__);
    inerror = true;

    SCR_EndLoadingPlaque();	// reenable screen updates

    va_start(argptr, error);
    vsnprintf(string, sizeof(string), error, argptr);
    va_end(argptr);
    Con_Printf("%s: %s\n", __func__, string);

    if (sv.active)
	Host_ShutdownServer(false);

    if (cls.state == ca_dedicated)
	Sys_Error("%s: %s", __func__, string); // dedicated servers exit

    CL_Disconnect();
    cls.demonum = -1;

    inerror = false;

    longjmp(host_abort, 1);
}
Exemple #4
0
/*
=====================
CL_Disconnect

Goes from a connected state to full screen console state
Sends a disconnect message to the server
This is also called on Host_Error, so it shouldn't cause any errors
=====================
*/
void CL_Disconnect( void )
{
	if( cls.state == ca_disconnected )
		return;

	cls.connect_time = 0;
	cls.changedemo = false;
	CL_Stop_f();

	// send a disconnect message to the server
	CL_SendDisconnectMessage();
	CL_ClearState ();

	S_StopBackgroundTrack ();
	SCR_EndLoadingPlaque (); // get rid of loading plaque

	// clear the network channel, too.
	Netchan_Clear( &cls.netchan );

	cls.state = ca_disconnected;

	// restore gamefolder here (in case client was connected to another game)
	CL_ChangeGame( GI->gamefolder, true );

	// back to menu if developer mode set to "player" or "mapper"
	if( host.developer > 2 ) return;
	UI_SetActiveMenu( true );
}
Exemple #5
0
/* <36123> ../engine/host.c:255 */
void __declspec(noreturn) Host_Error(const char *error, ...)
{
	va_list argptr;
	char string[1024];
	static qboolean inerror = FALSE;

	va_start(argptr, error);

	if (inerror)
		Sys_Error("Host_Error: recursively entered");

	inerror = TRUE;
	SCR_EndLoadingPlaque();
	Q_vsnprintf(string, sizeof(string), error, argptr);
	va_end(argptr);

	if (g_psv.active && developer.value != 0.0 )
		CL_WriteMessageHistory(0, 0);

	Con_Printf("Host_Error: %s\n", string);
	if (g_psv.active)
		Host_ShutdownServer(FALSE);

	if (g_pcls.state)
	{
		CL_Disconnect();
		g_pcls.demonum = -1;
		inerror = FALSE;
		longjmp(host_abortserver, 1);
	}
	Sys_Error("Host_Error: %s\n", string);
}
Exemple #6
0
/**
 * An svc_signonnum has been received, perform a client side setup
 */
void CL_SignonReply(void) {
	char str[8192];

	Con_DPrintf("CL_SignonReply: %i\n", cls.signon);

	switch (cls.signon) {
		case 1:
			MSG_WriteByte(&cls.message, clc_stringcmd);
			MSG_WriteString(&cls.message, "prespawn");
			break;

		case 2:
			MSG_WriteByte(&cls.message, clc_stringcmd);
			MSG_WriteString(&cls.message, va("name \"%s\"\n", cl_name.getString()));

			MSG_WriteByte(&cls.message, clc_stringcmd);
			MSG_WriteString(&cls.message, va("color %i %i\n", cl_color.getInt() >> 4, cl_color.getInt()&15));

			MSG_WriteByte(&cls.message, clc_stringcmd);
			sprintf(str, "spawn %s", cls.spawnparms);
			MSG_WriteString(&cls.message, str);
			break;

		case 3:
			MSG_WriteByte(&cls.message, clc_stringcmd);
			MSG_WriteString(&cls.message, "begin");
			MemoryObj::Report(); // print remaining memory
			break;

		case 4:
			SCR_EndLoadingPlaque(); // allow normal screen updates
			break;
	}
}
void CClientState::ConnectionClosing( const char * reason )
{
	// if connected, shut down host
	if ( m_nSignonState > SIGNONSTATE_NONE )
	{
		ConMsg( "Disconnect: %s.\n", reason );
		if ( !Q_stricmp( reason, INVALID_STEAM_TICKET ) )
		{
			g_eSteamLoginFailure = STEAMLOGINFAILURE_BADTICKET;
		}
		else if ( !Q_stricmp( reason, INVALID_STEAM_LOGON ) )
		{
			g_eSteamLoginFailure = STEAMLOGINFAILURE_NOSTEAMLOGIN;
		}
		else if ( !Q_stricmp( reason, INVALID_STEAM_LOGGED_IN_ELSEWHERE ) )
		{
			g_eSteamLoginFailure = STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE;
		}
		else if ( !Q_stricmp( reason, INVALID_STEAM_VACBANSTATE ) )
		{
			g_eSteamLoginFailure = STEAMLOGINFAILURE_VACBANNED;
		}
		else
		{
			g_eSteamLoginFailure = STEAMLOGINFAILURE_NONE;
		}
		COM_ExplainDisconnection( true, "Disconnect: %s.\n", reason );
		SCR_EndLoadingPlaque();
		Host_Disconnect(true);
	}
}
Exemple #8
0
/*
================
Host_Error

This shuts down both the client and server
================
*/
void Host_Error (const char *error, ...)
{
	va_list		argptr;
	char		string[1024];
	static	qboolean inerror = false;

	if (inerror)
		Sys_Error ("Host_Error: recursively entered");
	inerror = true;

	SCR_EndLoadingPlaque ();		// reenable screen updates

	va_start (argptr,error);
	q_vsnprintf (string, sizeof(string), error, argptr);
	va_end (argptr);
	Con_Printf ("Host_Error: %s\n",string);

	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_Error: %s\n",string);	// dedicated servers exit

	CL_Disconnect ();
	cls.demonum = -1;
	cl.intermission = 0; //johnfitz -- for errors during intermissions (changelevel with no map found, etc.)

	inerror = false;

	longjmp (host_abortserver, 1);
}
Exemple #9
0
/*
================
Host_Error

This shuts down both the client and server
================
*/
void Host_Error (char *error, ...)
{
	va_list		argptr;
	char		string[1024];
	static	qboolean inerror = false;
	
	if (inerror)
		Sys_Error ("Host_Error: recursively entered");
	inerror = true;
	
	SCR_EndLoadingPlaque ();		// reenable screen updates

	va_start (argptr,error);
	vsprintf (string,error,argptr);
	va_end (argptr);
	Con_Printf ("Host_Error: %s\n",string);
	
	if (sv.active)
		Host_ShutdownServer (false);

	if (cls.state == ca_dedicated)
		Sys_Error ("Host_Error: %s\n",string);	// dedicated servers exit

	CL_Disconnect ();
	cls.demonum = -1;
	
	Clear_LoadingFill ();

	inerror = false;

	longjmp (host_abortserver, 1);
}
Exemple #10
0
/*
* SCR_PlayCinematic
*/
static void SCR_PlayCinematic( const char *arg, int flags )
{
	struct cinematics_s *cin;

	CL_SoundModule_Clear();

	cin = CIN_Open( arg, 0, qfalse, qtrue );
	if( !cin )
	{
		Com_Printf( "SCR_PlayCinematic: couldn't find %s\n", arg );
		return;
	}

	CL_Disconnect( NULL );

	cl.cin.h = cin;
	cl.cin.keepRatio = (flags & 1) ? qfalse : qtrue;
	cl.cin.allowConsole = (flags & 2) ? qfalse : qtrue;
	cl.cin.paused = qfalse;
	cl.cin.absStartTime = cl.cin.absCurrentTime = cl.cin.absPrevTime = SCR_CinematicTime();
	cl.cin.currentTime = 0;

	CL_SetClientState( CA_CINEMATIC );

	CL_SoundModule_StopAllSounds();

	SCR_EndLoadingPlaque();

	SCR_ReadNextCinematicFrame();
}
Exemple #11
0
/**
 * @brief Ensures the right menu cvars are set after error drop or map change
 * @note E.g. called after an ERR_DROP was thrown
 * @sa CL_Disconnect
 * @sa SV_Map
 */
void CL_Drop (void)
{
	CL_Disconnect();

	/* drop loading plaque */
	SCR_EndLoadingPlaque();

	GAME_Drop();
}
Exemple #12
0
/*
* SCR_PlayCinematic
*/
static void SCR_PlayCinematic( const char *arg, int flags )
{
	struct cinematics_s *cin;
	bool has_ogg;
	bool yuv;
	float framerate;
	size_t name_size = strlen( "video/" ) + strlen( arg ) + 1;
	char *name = alloca( name_size );

	if( strstr( arg, "/" ) == NULL && strstr( arg, "\\" ) == NULL ) {
		Q_snprintfz( name, name_size, "video/%s", arg );
	} else {
		Q_snprintfz( name, name_size, "%s", arg );
	}

	cin = CIN_Open( name, 0, 0, &yuv, &framerate );
	if( !cin )
	{
		Com_Printf( "SCR_PlayCinematic: couldn't find %s\n", name );
		return;
	}

	has_ogg = CIN_HasOggAudio( cin );

	CIN_Close( cin );

	SCR_FinishCinematic();

	CL_SoundModule_StopAllSounds( true, true );

	cin = CIN_Open( name, 0, has_ogg ? CIN_NOAUDIO : 0, &yuv, &framerate );
	if( !cin )
	{
		Com_Printf( "SCR_PlayCinematic: (FIXME) couldn't find %s\n", name );
		return;
	}

	if( has_ogg ) {
		CL_SoundModule_StartBackgroundTrack( CIN_FileName( cin ), NULL, 4 );
	}

	cl.cin.h = cin;
	cl.cin.keepRatio = (flags & 1) ? false : true;
	cl.cin.allowConsole = (flags & 2) ? false : true;
	cl.cin.startTime = SCR_CinematicTime();
	cl.cin.paused = false;
	cl.cin.pause_cnt = 0;
	cl.cin.yuv = yuv;
	cl.cin.framerate = framerate;

	CL_SetClientState( CA_CINEMATIC );

	SCR_EndLoadingPlaque();

	SCR_RunCinematic();
}
void CClientState::ConnectionCrashed( const char * reason )
{
	// if connected, shut down host
	if ( m_nSignonState > SIGNONSTATE_NONE )
	{
		COM_ExplainDisconnection( true, "Disconnect: %s.\n", reason );
		SCR_EndLoadingPlaque();
		Host_EndGame ( true, reason );
	}
}
Exemple #14
0
/*
================
Host_EndGame
================
*/
void Host_EndGame (void)
{
	SCR_EndLoadingPlaque ();

	SV_Shutdown ("Server was killed");
	CL_Disconnect ();

	// clear disconnect messages from loopback
	NET_ClearLoopback ();
}
Exemple #15
0
static void set_active_state(void)
{
    cls.state = ca_active;

    cl.serverdelta = Q_align(cl.frame.number, CL_FRAMEDIV);
    cl.time = cl.servertime = 0; // set time, needed for demos
#if USE_FPS
    cl.keytime = cl.keyservertime = 0;
    cl.keyframe = cl.frame; // initialize keyframe to make sure it's valid
#endif

    // initialize oldframe so lerping doesn't hurt anything
    cl.oldframe.valid = false;
    cl.oldframe.ps = cl.frame.ps;
#if USE_FPS
    cl.oldkeyframe.valid = false;
    cl.oldkeyframe.ps = cl.keyframe.ps;
#endif

    cl.frameflags = 0;

    if (cls.netchan) {
        cl.initialSeq = cls.netchan->outgoing_sequence;
    }

    if (cls.demo.playback) {
        // init some demo things
        CL_FirstDemoFrame();
    } else {
        // set initial cl.predicted_origin and cl.predicted_angles
        VectorScale(cl.frame.ps.pmove.origin, 0.125f, cl.predicted_origin);
        VectorScale(cl.frame.ps.pmove.velocity, 0.125f, cl.predicted_velocity);
        if (cl.frame.ps.pmove.pm_type < PM_DEAD &&
            cls.serverProtocol > PROTOCOL_VERSION_DEFAULT) {
            // enhanced servers don't send viewangles
            CL_PredictAngles();
        } else {
            // just use what server provided
            VectorCopy(cl.frame.ps.viewangles, cl.predicted_angles);
        }
    }

    SCR_EndLoadingPlaque();     // get rid of loading plaque
    SCR_LagClear();
    Con_Close(false);           // get rid of connection screen

    CL_CheckForPause();

    CL_UpdateFrameTimes();

    if (!cls.demo.playback) {
        EXEC_TRIGGER(cl_beginmapcmd);
        Cmd_ExecTrigger("#cl_enterlevel");
    }
}
void CClientState::Disconnect(bool bShowMainMenu)
{
	CBaseClientState::Disconnect(bShowMainMenu);

	// stop any demo activities
#ifndef _XBOX
	demoplayer->StopPlayback();
	demorecorder->StopRecording();
#endif
	S_StopAllSounds( true );
	
	R_DecalTermAll();

	if ( m_nMaxClients > 1 )
	{
		if ( EngineVGui()->IsConsoleVisible() == false )
		{
			// start progress bar immediately for multiplayer level transitions
			EngineVGui()->EnabledProgressBarForNextLoad();
		}
	}

	CL_ClearState();
#ifndef _XBOX
	// End any in-progress downloads
	CL_HTTPStop_f();
#endif

	// stop loading progress bar 
	if (bShowMainMenu)
	{
		SCR_EndLoadingPlaque();
	}

	// notify game ui dll of out-of-in-game status
	EngineVGui()->NotifyOfServerDisconnect();

	if (bShowMainMenu && !engineClient->IsDrawingLoadingImage() && (cl.demonum == -1))
	{
		// we're not in the middle of loading something, so show the UI
		if ( EngineVGui() )
		{
			EngineVGui()->ActivateGameUI();
		}
	}

	HostState_OnClientDisconnected();

	// if we played a demo from the startdemos list, play next one
	if (cl.demonum != -1)
	{
		CL_NextDemo();
	}
}
Exemple #17
0
/*
================
CL_Drop

Called after an ERR_DROP was thrown
================
*/
void CL_Drop (void)
{
	if (cls.state == ca_uninitialized)
		return;
	if (cls.state == ca_disconnected)
		return;

	CL_Disconnect ();

	// drop loading plaque unless this is the initial game start
	if (cls.disable_servercount != -1)
		SCR_EndLoadingPlaque ();	// get rid of loading plaque
}
Exemple #18
0
/*
================
CL_Drop

Called after an ERR_DROP was thrown
================
*/
void CL_Drop (void)
{
	if (cls.state == ca_uninitialized)
		return;

	// if an error occurs during initial load
	// or during game start, drop loading plaque
	if ( (cls.disable_servercount != -1) || (cls.key_dest == key_game) )
		SCR_EndLoadingPlaque ();	// get rid of loading plaque

	if (cls.state == ca_disconnected)
		return;

	CL_Disconnect ();
}
Exemple #19
0
/*
* SCR_PlayCinematic
*/
static void SCR_PlayCinematic( char *arg )
{
	int len;
	size_t name_size;
	static cinematics_t clientCin;
	cinematics_t *cin = cl.cin = &clientCin;
	roq_chunk_t *chunk = &cin->chunk;

	name_size = strlen( "video/" ) + strlen( arg ) + strlen( ".roq" ) + 1;
	cin->name = Mem_ZoneMalloc( name_size );
	Q_snprintfz( cin->name, name_size, "video/%s", arg );
	COM_DefaultExtension( cin->name, ".roq", name_size );

	// nasty hack
	cin->s_rate = 22050;
	cin->s_width = 2;
	cin->width = cin->height = 0;

	cin->frame = 0;
	len = FS_FOpenFile( cin->name, &cin->file, FS_READ );
	if( !cin->file || len < 1 )
	{
		Com_Printf( "Couldn't find %s\n", cin->name );
		SCR_StopCinematic();
		return;
	}

	// read header
	RoQ_ReadChunk( cin );

	if( chunk->id != RoQ_HEADER1 || chunk->size != RoQ_HEADER2 || chunk->argument != RoQ_HEADER3 )
	{
		Com_Printf( "Invalid video file %s\n", cin->name );
		SCR_StopCinematic();
		return;
	}

	SCR_EndLoadingPlaque();

	cin->headerlen = FS_Tell( cin->file );
	cin->frame = 0;
	cin->pic = cin->pic_pending = SCR_ReadNextCinematicFrame();
	cin->time = cls.realtime + 1; // add 1 msec so SCR_GetCinematicTime is also valid for early commands

	CL_SetClientState( CA_ACTIVE );

	CL_SoundModule_StopAllSounds();
}
Exemple #20
0
/*
=====================
CL_Spawn

=====================
*/
void CL_Spawn (void)
{		
	// first update is the final signon stage
	cls.state = ca_active;

	if (cls.demoplayback)
		host_skipframe = true;

	if (!cls.demoplayback)
		VID_SetCaption (va(PROGRAM ": %s", cls.servername));

	Con_ClearNotify ();
	SCR_EndLoadingPlaque ();

	TP_ExecTrigger ("f_spawn");
}
Exemple #21
0
/*
 * Called after an ERR_DROP was thrown
 */
void CL_Drop(void)
{
  if (cls.state == ca_uninitialized) {
    return;
  }

  if (cls.state == ca_disconnected) {
    return;
  }

  CL_Disconnect();

  /* drop loading plaque unless this is the initial game start */
  if (cls.disable_servercount != -1) {
    SCR_EndLoadingPlaque(); /* get rid of loading plaque */
  }
}
Exemple #22
0
/*
================
Host_Error

This shuts down both the client and server
================
*/
void Host_Error (char *error, ...)
{
	va_list		argptr;
	char		string[1024];
	static qbool inerror = false;
	
	if (inerror)
		Sys_Error ("Host_Error: recursively entered");
	inerror = true;

	Com_EndRedirect ();

	SCR_EndLoadingPlaque ();

	va_start (argptr,error);
#ifdef _WIN32
	_vsnprintf (string, sizeof(string) - 1, error, argptr);
	string[sizeof(string) - 1] = '\0';
#else
	vsnprintf (string, sizeof(string), error, argptr);
#endif // _WIN32
	va_end (argptr);

	Com_Printf ("\n===========================\n");
	Com_Printf ("Host_Error: %s\n",string);
	Com_Printf ("===========================\n\n");
	
	SV_Shutdown (va("server crashed: %s\n", string));
	CL_Disconnect ();
	CL_HandleHostError ();		// stop demo loop

	if (dedicated)
	{
		NET_Shutdown ();
		COM_Shutdown ();
		Sys_Error ("%s", string);
	}

	if (!host_initialized)
		Sys_Error ("Host_Error: %s", string);

	inerror = false;

	Host_Abort ();
}
Exemple #23
0
/*
=====================
CL_SignonReply

An svc_signonnum has been received, perform a client side setup
=====================
*/
void
CL_SignonReply(void)
{
    char str[8192];

    Con_DPrintf("CL_SignonReply: %i\n", cls.signon);

    switch (cls.signon) {
    case 1:
	MSG_WriteByte(&cls.message, clc_stringcmd);
	MSG_WriteString(&cls.message, "prespawn");
	break;

    case 2:
	MSG_WriteByte(&cls.message, clc_stringcmd);
	MSG_WriteString(&cls.message, va("name \"%s\"\n", cl_name.string));

	MSG_WriteByte(&cls.message, clc_stringcmd);
	MSG_WriteString(&cls.message, va("color %i %i\n",
					 ((int)cl_color.value) >> 4,
					 ((int)cl_color.value) & 15));

	MSG_WriteByte(&cls.message, clc_stringcmd);
	sprintf(str, "spawn %s", cls.spawnparms);
	MSG_WriteString(&cls.message, str);
	break;

    case 3:
	MSG_WriteByte(&cls.message, clc_stringcmd);
	MSG_WriteString(&cls.message, "begin");
	Cache_Report();		// print remaining memory

	// FIXME - this the right place for it?
	cls.state = ca_firstupdate;
	break;

    case 4:
	SCR_EndLoadingPlaque();	// allow normal screen updates

	// FIXME - this the right place for it?
	cls.state = ca_active;
	break;
    }
}
Exemple #24
0
/*
* Con_ToggleConsole_f
*/
void Con_ToggleConsole_f( void )
{
    SCR_EndLoadingPlaque(); // get rid of loading plaque

    if( cls.state == CA_GETTING_TICKET || cls.state == CA_CONNECTING || cls.state == CA_CONNECTED )
        return;

    Con_ClearTyping();
    Con_ClearNotify();

    if( cls.key_dest == key_console )
    {
        // close console
        CL_SetKeyDest( cls.old_key_dest );
    }
    else
    {
        // open console
        CL_SetOldKeyDest( cls.key_dest );
        CL_SetKeyDest( key_console );
    }
}
Exemple #25
0
/*
==================
CL_ParsePacketEntities

An svc_packetentities has just been parsed, deal with the
rest of the data stream.
==================
*/
void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
{
	frame_t		*newframe, *oldframe;
	int		oldindex, newnum, oldnum;
	int		oldpacket, newpacket;
	cl_entity_t	*player;
	entity_state_t	*oldent;
	int		i, count;

	// save first uncompressed packet as timestamp
	if( cls.changelevel && !delta && cls.demorecording )
		CL_WriteDemoJumpTime();

	// first, allocate packet for new frame
	count = BF_ReadWord( msg );

	newpacket = cl.parsecountmod;
	newframe = &cl.frames[newpacket];

	// allocate parse entities
	newframe->first_entity = cls.next_client_entities;
	newframe->num_entities = 0;
	newframe->valid = true; // assume valid

	if( delta )
	{
		int	subtracted;

		oldpacket = BF_ReadByte( msg );
		subtracted = ((( cls.netchan.incoming_sequence & 0xFF ) - oldpacket ) & 0xFF );

		if( subtracted == 0 )
		{
			Host_Error( "CL_DeltaPacketEntities: update too old, connection dropped.\n" );
			return;
		}

		if( subtracted >= CL_UPDATE_MASK )
		{	
			// we can't use this, it is too old
			Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
			CL_FlushEntityPacket( msg );
			return;
		}

		oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];

		if(( cls.next_client_entities - oldframe->first_entity ) > ( cls.num_client_entities - 128 ))
		{
			Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
			CL_FlushEntityPacket( msg );
			return;
		}
	}
	else
	{
		// this is a full update that we can start delta compressing from now
		oldframe = NULL;
		oldpacket = -1;		// delta too old or is initial message
		cl.force_send_usercmd = true;	// send reply
		cls.demowaiting = false;	// we can start recording now
	}

	// mark current delta state
	cl.validsequence = cls.netchan.incoming_sequence;

	oldent = NULL;
	oldindex = 0;

	if( !oldframe )
	{
		oldnum = MAX_ENTNUMBER;
	}
	else
	{
		if( oldindex >= oldframe->num_entities )
		{
			oldnum = MAX_ENTNUMBER;
		}
		else
		{
			oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
			oldnum = oldent->number;
		}
	}

	while( 1 )
	{
		newnum = BF_ReadWord( msg );
		if( !newnum ) break; // end of packet entities

		if( BF_CheckOverflow( msg ))
			Host_Error( "CL_ParsePacketEntities: read overflow\n" );

		while( oldnum < newnum )
		{	
			// one or more entities from the old packet are unchanged
			CL_DeltaEntity( msg, newframe, oldnum, oldent, true );
			
			oldindex++;

			if( oldindex >= oldframe->num_entities )
			{
				oldnum = MAX_ENTNUMBER;
			}
			else
			{
				oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
				oldnum = oldent->number;
			}
		}

		if( oldnum == newnum )
		{	
			// delta from previous state
			CL_DeltaEntity( msg, newframe, newnum, oldent, false );
			oldindex++;

			if( oldindex >= oldframe->num_entities )
			{
				oldnum = MAX_ENTNUMBER;
			}
			else
			{
				oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
				oldnum = oldent->number;
			}
			continue;
		}

		if( oldnum > newnum )
		{	
			// delta from baseline ?
			CL_DeltaEntity( msg, newframe, newnum, NULL, false );
			continue;
		}
	}

	// any remaining entities in the old frame are copied over
	while( oldnum != MAX_ENTNUMBER )
	{	
		// one or more entities from the old packet are unchanged
		CL_DeltaEntity( msg, newframe, oldnum, oldent, true );
		oldindex++;

		if( oldindex >= oldframe->num_entities )
		{
			oldnum = MAX_ENTNUMBER;
		}
		else
		{
			oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
			oldnum = oldent->number;
		}
	}

	cl.frame = *newframe;

	if( !cl.frame.valid ) return;

	player = CL_GetLocalPlayer();
		
	if( cls.state != ca_active )
	{
		// client entered the game
		cls.state = ca_active;
		cl.force_refdef = true;
		cls.changelevel = false;		// changelevel is done
		cls.changedemo = false;		// changedemo is done

		SCR_MakeLevelShot();		// make levelshot if needs
		Cvar_SetFloat( "scr_loading", 0.0f );	// reset progress bar	

		if(( cls.demoplayback || cls.disable_servercount != cl.servercount ) && cl.video_prepped )
			SCR_EndLoadingPlaque(); // get rid of loading plaque
	}

	// update local player states
	clgame.dllFuncs.pfnTxferLocalOverrides( &player->curstate, &newframe->local.client );

	// update state for all players
	for( i = 0; i < cl.maxclients; i++ )
	{
		cl_entity_t *ent = CL_GetEntityByIndex( i + 1 );
		if( !ent ) continue;
		clgame.dllFuncs.pfnProcessPlayerState( &newframe->playerstate[i], &ent->curstate );
		newframe->playerstate[i].number = ent->index;
	}

	cl.frame = *newframe;
}
Exemple #26
0
/*
* Qcommon_Init
*/
void Qcommon_Init( int argc, char **argv )
{
	if( setjmp( abortframe ) )
		Sys_Error( "Error during initialization: %s", com_errormsg );

	QThreads_Init();

	com_print_mutex = QMutex_Create();

	// initialize memory manager
	Memory_Init();

	// prepare enough of the subsystems to handle
	// cvar and command buffer management
	COM_InitArgv( argc, argv );

	Cbuf_Init();

	// initialize cmd/cvar/dynvar tries
	Cmd_PreInit();
	Cvar_PreInit();
	Dynvar_PreInit();

	// create basic commands and cvars
	Cmd_Init();
	Cvar_Init();
	Dynvar_Init();
	dynvars_initialized = qtrue;

	wswcurl_init();

	Key_Init();

	// we need to add the early commands twice, because
	// a basepath or cdpath needs to be set before execing
	// config files, but we want other parms to override
	// the settings of the config files
	Cbuf_AddEarlyCommands( qfalse );
	Cbuf_Execute();

	// wsw : aiwa : create dynvars (needs to be completed before .cfg scripts are executed)
	Dynvar_Create( "sys_uptime", qtrue, Com_Sys_Uptime_f, DYNVAR_READONLY );
	Dynvar_Create( "frametick", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY );
	Dynvar_Create( "quit", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY );
	Dynvar_Create( "irc_connected", qfalse, Irc_GetConnected_f, Irc_SetConnected_f );

	Sys_InitDynvars();
	CL_InitDynvars();

#ifdef TV_SERVER_ONLY
	tv_server = Cvar_Get( "tv_server", "1", CVAR_NOSET );
	Cvar_ForceSet( "tv_server", "1" );
#else
	tv_server = Cvar_Get( "tv_server", "0", CVAR_NOSET );
#endif

#ifdef DEDICATED_ONLY
	dedicated =	    Cvar_Get( "dedicated", "1", CVAR_NOSET );
	Cvar_ForceSet( "dedicated", "1" );
#else
	dedicated =	    Cvar_Get( "dedicated", "0", CVAR_NOSET );
#endif

#ifdef MATCHMAKER
	mm_server =	    Cvar_Get( "mm_server", "1", CVAR_READONLY );
	Cvar_ForceSet( "mm_server", "1" );
#else
	mm_server =	    Cvar_Get( "mm_server", "0", CVAR_READONLY );
#endif

	FS_Init();

	Cbuf_AddText( "exec default.cfg\n" );
	if( !dedicated->integer )
	{
		Cbuf_AddText( "exec config.cfg\n" );
		Cbuf_AddText( "exec autoexec.cfg\n" );
	}
	else if( mm_server->integer )
	{
		Cbuf_AddText( "exec mmaker_autoexec.cfg\n" );
	}
	else if( tv_server->integer )
	{
		Cbuf_AddText( "exec tvserver_autoexec.cfg\n" );
	}
	else
	{
		Cbuf_AddText( "exec dedicated_autoexec.cfg\n" );
	}

	Cbuf_AddEarlyCommands( qtrue );
	Cbuf_Execute();

	//
	// init commands and vars
	//
	Memory_InitCommands();

	Qcommon_InitCommands();

	host_speeds =	    Cvar_Get( "host_speeds", "0", 0 );
	log_stats =	    Cvar_Get( "log_stats", "0", 0 );
	developer =	    Cvar_Get( "developer", "0", 0 );
	timescale =	    Cvar_Get( "timescale", "1.0", CVAR_CHEAT );
	fixedtime =	    Cvar_Get( "fixedtime", "0", CVAR_CHEAT );
	if( tv_server->integer )
		logconsole =	    Cvar_Get( "logconsole", "tvconsole.log", CVAR_ARCHIVE );
	else if( dedicated->integer )
		logconsole =	    Cvar_Get( "logconsole", "wswconsole.log", CVAR_ARCHIVE );
	else
		logconsole =	    Cvar_Get( "logconsole", "", CVAR_ARCHIVE );
	logconsole_append = Cvar_Get( "logconsole_append", "1", CVAR_ARCHIVE );
	logconsole_flush =  Cvar_Get( "logconsole_flush", "0", CVAR_ARCHIVE );
	logconsole_timestamp =	Cvar_Get( "logconsole_timestamp", "0", CVAR_ARCHIVE );

	com_showtrace =	    Cvar_Get( "com_showtrace", "0", 0 );
	com_introPlayed3 =   Cvar_Get( "com_introPlayed3", "0", CVAR_ARCHIVE );

	Cvar_Get( "irc_server", "irc.quakenet.org", CVAR_ARCHIVE );
	Cvar_Get( "irc_port", "6667", CVAR_ARCHIVE );
	Cvar_Get( "irc_nick", APPLICATION "Player", CVAR_ARCHIVE );
	Cvar_Get( "irc_user", APPLICATION "User", CVAR_ARCHIVE );
	Cvar_Get( "irc_password", "", CVAR_ARCHIVE );

	Cvar_Get( "gamename", APPLICATION, CVAR_READONLY );
	versioncvar = Cvar_Get( "version", APP_VERSION_STR " " CPUSTRING " " __DATE__ " " BUILDSTRING, CVAR_SERVERINFO|CVAR_READONLY );
	revisioncvar = Cvar_Get( "revision", SVN_RevString(), CVAR_READONLY );

	Sys_Init();

	NET_Init();
	Netchan_Init();

	CM_Init();

	Steam_LoadLibrary();

	Com_ScriptModule_Init();

	MM_Init();

	SV_Init();
	CL_Init();

	SCR_EndLoadingPlaque();

	if( !dedicated->integer )
	{
		Cbuf_AddText( "exec stuffcmds.cfg\n" );
	}
	else if( mm_server->integer )
	{
		Cbuf_AddText( "exec mmaker_stuffcmds.cfg\n" );
	}
	else if( tv_server->integer )
	{
		Cbuf_AddText( "exec tvserver_stuffcmds.cfg\n" );
	}
	else
	{
		Cbuf_AddText( "exec dedicated_stuffcmds.cfg\n" );
	}

	// add + commands from command line
	if( !Cbuf_AddLateCommands() )
	{
		// if the user didn't give any commands, run default action

		if( !dedicated->integer )
		{
			// only play the introduction sequence once
			if( !com_introPlayed3->integer )
			{
				Cvar_ForceSet( com_introPlayed3->name, "1" );
#if !defined(__MACOSX__) && !defined(__ANDROID__)
				Cbuf_AddText( "cinematic intro.roq\n" );
#endif
			}
		}
	}
	else
	{
		// the user asked for something explicit
		// so drop the loading plaque
		SCR_EndLoadingPlaque();
	}

	Com_Printf( "\n====== %s Initialized ======\n", APPLICATION );

	Cbuf_Execute();
}
Exemple #27
0
/*
==================
NQD_ParseUpdate

Parse an entity update message from the server
If an entities model or origin changes from frame to frame, it must be
relinked.  Other attributes can change without relinking.
==================
*/
static void NQD_ParseUpdate (int bits)
{
	int			i;
//	model_t		*model;
	int			modnum;
	qbool		forcelink;
	centity_t	*ent;
	entity_state_t	*state;
	int			num;

	if (nq_signon == NQ_SIGNONS - 1)
	{	// first update is the final signon stage
		nq_signon = NQ_SIGNONS;
		Con_ClearNotify ();
		//TP_ExecTrigger ("f_spawn");
		SCR_EndLoadingPlaque ();
		cls.state = ca_active;
	}

	if (bits & NQ_U_MOREBITS)
	{
		i = MSG_ReadByte ();
		bits |= (i<<8);
	}

	if (bits & NQ_U_LONGENTITY)	
		num = MSG_ReadShort ();
	else
		num = MSG_ReadByte ();

	if (num >= NQ_MAX_EDICTS)
		Host_Error ("NQD_ParseUpdate: ent > MAX_EDICTS");

	NQD_BumpEntityCount (num);

	ent = &cl_entities[num];
	ent->previous = ent->current;
	ent->current = ent->baseline;
	state = &ent->current;
	state->number = num;

	if (ent->lastframe != cl_entframecount-1)
		forcelink = true;	// no previous frame to lerp from
	else
		forcelink = false;

	ent->prevframe = ent->lastframe;
	ent->lastframe = cl_entframecount;
	
	if (bits & NQ_U_MODEL)
	{
		modnum = MSG_ReadByte ();
		if (modnum >= MAX_MODELS)
			Host_Error ("CL_ParseModel: bad modnum");
	}
	else
		modnum = ent->baseline.modelindex;
		
//	model = cl.model_precache[modnum];
	if (modnum != state->modelindex)
	{
		state->modelindex = modnum;
	// automatic animation (torches, etc) can be either all together
	// or randomized
		if (modnum)
		{
			/*if (model->synctype == ST_RAND)
				state->syncbase = (float)(rand()&0x7fff) / 0x7fff;
			else
				state->syncbase = 0.0;
				*/
		}
		else
			forcelink = true;	// hack to make null model players work
	}
	
	if (bits & NQ_U_FRAME)
		state->frame = MSG_ReadByte ();
	else
		state->frame = ent->baseline.frame;

	if (bits & NQ_U_COLORMAP)
		i = MSG_ReadByte();
	else
		i = ent->baseline.colormap;

	state->colormap = i;

	if (bits & NQ_U_SKIN)
		state->skinnum = MSG_ReadByte();
	else
		state->skinnum = ent->baseline.skinnum;

	if (bits & NQ_U_EFFECTS)
		state->effects = MSG_ReadByte();
	else
		state->effects = 0;

	if (bits & NQ_U_ORIGIN1)
		state->s_origin[0] = MSG_ReadShort ();
	else
		state->s_origin[0] = ent->baseline.s_origin[0];
	if (bits & NQ_U_ANGLE1)
		state->s_angles[0] = MSG_ReadChar ();
	else
		state->s_angles[0] = ent->baseline.s_angles[0];

	if (bits & NQ_U_ORIGIN2)
		state->s_origin[1] = MSG_ReadShort ();
	else
		state->s_origin[1] = ent->baseline.s_origin[1];
	if (bits & NQ_U_ANGLE2)
		state->s_angles[1] = MSG_ReadChar ();
	else
		state->s_angles[1] = ent->baseline.s_angles[1];

	if (bits & NQ_U_ORIGIN3)
		state->s_origin[2] = MSG_ReadShort ();
	else
		state->s_origin[2] = ent->baseline.s_origin[2];
	if (bits & NQ_U_ANGLE3)
		state->s_angles[2] = MSG_ReadChar ();
	else
		state->s_angles[2] = ent->baseline.s_angles[2];

	if ( bits & NQ_U_NOLERP )
		forcelink = true;

	if ( forcelink )
	{	// didn't have an update last message
		VectorCopy (state->s_origin, ent->previous.s_origin);
		MSG_UnpackOrigin (state->s_origin, ent->trail_origin);
		VectorCopy (state->s_angles, ent->previous.s_angles);
		//ent->forcelink = true;
	}
}
Exemple #28
0
/*
==================
SCR_PlayCinematic

==================
*/
void SCR_PlayCinematic (char *arg)
{
	int		width, height;
	byte	*palette;
	char	name[MAX_OSPATH], *dot;
	int		old_khz;

	// make sure CD isn't playing music
	CDAudio_Stop();

	cl.cinematicframe = 0;
	dot = strstr (arg, ".");

	if (dot && Q_streq(dot, ".pcx"))
	{	// static pcx image
		Com_sprintf (name, sizeof(name), "pics/%s", arg);
		SCR_LoadPCX (name, &cin.pic, &palette, &cin.width, &cin.height);
		cl.cinematicframe = -1;
		cl.cinematictime = 1;
		SCR_EndLoadingPlaque();
		cls.state = ca_active;
		cl_scores_setinuse_all(false); // jitscores - clear scoreboard

		if (!cin.pic)
		{
			Com_Printf ("%s not found.\n", name);
			cl.cinematictime = 0;
		}
		else
		{
			memcpy (cl.cinematicpalette, palette, sizeof(cl.cinematicpalette));
			Z_Free (palette);
		}

		return;
	}

	Com_sprintf (name, sizeof(name), "video/%s", arg);
	FS_FOpenFile (name, &cl.cinematic_file);

	if (!cl.cinematic_file)
	{
		SCR_FinishCinematic();
		cl.cinematictime = 0;	// done

		return;
	}

	SCR_EndLoadingPlaque();

	cls.state = ca_active;
	cl_scores_setinuse_all(false); // jitscores - clear scoreboard

	FS_Read (&width, 4, cl.cinematic_file);
	FS_Read (&height, 4, cl.cinematic_file);
	cin.width = LittleLong(width);
	cin.height = LittleLong(height);

	FS_Read (&cin.s_rate, 4, cl.cinematic_file);
	cin.s_rate = LittleLong(cin.s_rate);
	FS_Read (&cin.s_width, 4, cl.cinematic_file);
	cin.s_width = LittleLong(cin.s_width);
	FS_Read (&cin.s_channels, 4, cl.cinematic_file);
	cin.s_channels = LittleLong(cin.s_channels);

	Huff1TableInit ();

	// switch up to 22 khz sound if necessary
	old_khz = Cvar_VariableValue ("s_khz");
	if (old_khz != cin.s_rate/1000)
	{
		cin.restart_sound = true;
		Cvar_SetValue ("s_khz", cin.s_rate/1000);
		CL_Snd_Restart_f ();
		Cvar_SetValue ("s_khz", old_khz);
	}

	cl.cinematicframe = 0;
	cin.pic = SCR_ReadNextFrame ();
	cl.cinematictime = Sys_Milliseconds ();
}
Exemple #29
0
void CL_ParseDownload (qboolean dataIsCompressed)
{
	int		size, percent;
	char	name[MAX_OSPATH];

	// read the data
	size = MSG_ReadShort (&net_message);
	percent = MSG_ReadByte (&net_message);

	if (size < 0)
	{
		if (size == -1)
			Com_Printf ("Server does not have this file.\n", LOG_CLIENT);
		else
			Com_Printf ("Bad download data from server.\n", LOG_CLIENT);

		//r1: nuke the temp filename
		cls.downloadtempname[0] = 0;
		cls.downloadname[0] = 0;
		cls.failed_download = true;

		if (cls.download)
		{
			// if here, we tried to resume a file but the server said no
			fclose (cls.download);
			cls.download = NULL;
		}

		cls.downloadpending = false;
		CL_RequestNextDownload ();
		return;
	}

	// open the file if not opened yet
	if (!cls.download)
	{
		if (!cls.downloadtempname[0])
		{
			Com_Printf ("Received download packet without request. Ignored.\n", LOG_CLIENT);
			net_message.readcount += size;
			return;
		}
		CL_DownloadFileName(name, sizeof(name), cls.downloadtempname);

		FS_CreatePath (name);

		cls.download = fopen (name, "wb");
		if (!cls.download)
		{
			net_message.readcount += size;
			Com_Printf ("Failed to open %s\n", LOG_CLIENT, cls.downloadtempname);
			cls.downloadpending = false;
			CL_RequestNextDownload ();
			return;
		}
	}

	//r1: downloading something, drop to console to show status bar
	SCR_EndLoadingPlaque();

	//r1: if we're stuck with udp, may as well make best use of the bandwidth...
	if (dataIsCompressed)
	{
#ifndef NO_ZLIB
		uint16		uncompressedLen;
		byte		uncompressed[0xFFFF];

		uncompressedLen = (uint16)MSG_ReadShort (&net_message);

		if (!uncompressedLen)
			Com_Error (ERR_DROP, "uncompressedLen == 0");

		ZLibDecompress (net_message_buffer + net_message.readcount, size, uncompressed, uncompressedLen, -15);
		fwrite (uncompressed, 1, uncompressedLen, cls.download);
		Com_DPrintf ("svc_zdownload(%s): %d -> %d\n", cls.downloadname, size, uncompressedLen);
#else
		Com_Error (ERR_DROP, "Received a unrequested compressed download");
#endif
	}
	else
	{
		fwrite (net_message_buffer + net_message.readcount, 1, size, cls.download);
	}

	net_message.readcount += size;

	if (percent != 100)
	{
		cls.downloadpercent = percent;

		MSG_WriteByte (clc_stringcmd);
		MSG_Print ("nextdl");
		MSG_EndWriting (&cls.netchan.message);
		send_packet_now = true;
	}
	else
	{
		CL_FinishDownload ();

		// get another file if needed
		CL_RequestNextDownload ();
	}
}
Exemple #30
0
/**
 * @brief Init function
 * @sa Com_ParseScripts
 * @sa Qcommon_Shutdown
 * @sa Sys_Init
 * @sa CL_Init
 */
void Qcommon_Init (int argc, char** argv)
{
	logfile_active = nullptr;
	developer = nullptr;

	Sys_InitSignals();

	/* random seed */
	Com_SetRandomSeed(time(nullptr));

	com_aliasSysPool = Mem_CreatePool("Common: Alias system for commands and enums");
	com_cmdSysPool = Mem_CreatePool("Common: Command system");
	com_cmodelSysPool = Mem_CreatePool("Common: Collision model");
	com_cvarSysPool = Mem_CreatePool("Common: Cvar system");
	com_fileSysPool = Mem_CreatePool("Common: File system");
	com_genericPool = Mem_CreatePool("Generic");
	com_networkPool = Mem_CreatePool("Network");

	try {
		OBJZERO(csi);

		/* prepare enough of the subsystems to handle
		 * cvar and command buffer management */
		Com_InitArgv(argc, argv);

		Swap_Init();
		Cbuf_Init();

		Cmd_Init();
		Cvar_Init();

		uploadcrashdump = Cvar_Get("uploadcrashdump", "1", 0, "upload crashdumps to the developers");

		Key_Init();

		/* we need to add the early commands twice, because
		 * a basedir needs to be set before executing
		 * config files, but we want other parms to override
		 * the settings of the config files */
		Cbuf_AddEarlyCommands(false);
		Cbuf_Execute();

		FS_InitFilesystem(true);

		Cbuf_AddText("exec default.cfg\n");
#ifdef DEDICATED_ONLY
		Cbuf_AddText("exec dedconfig.cfg\n");
#else
		Cbuf_AddText("exec config.cfg\n");
#endif

		Cbuf_AddEarlyCommands(true);
		Cbuf_Execute();

		Com_SetRenderModified(false);
		Com_SetUserinfoModified(false);

		/* init commands and vars */
		Cmd_AddCommand("saveconfig", Com_WriteConfig_f, "Write the configuration to file");
		Cmd_AddCommand("gametypelist", Com_GameTypeList_f, "List all available multiplayer game types");
#ifdef DEBUG
		Cmd_AddCommand("debug_help", Com_DebugHelp_f, "Show some debugging help");
		Cmd_AddCommand("debug_error", Com_DebugError_f, "Just throw a fatal error to test error shutdown procedures");
#endif
		Cmd_AddCommand("setdeveloper", Com_DeveloperSet_f, "Set the developer cvar to only get the debug output you want");

		developer = Cvar_Get("developer", "0", 0, "Activate developer output to logfile and gameconsole");
#ifdef DEBUG
		logfile_active = Cvar_Get("logfile", "2", 0, "0 = deactivate logfile, 1 = write normal logfile, 2 = flush on every new line, 3 = always append to existing file");
#else
		logfile_active = Cvar_Get("logfile", "1", 0, "0 = deactivate logfile, 1 = write normal logfile, 2 = flush on every new line, 3 = always append to existing file");
#endif
		sv_gametype = Cvar_Get("sv_gametype", "fight1on1", CVAR_ARCHIVE | CVAR_SERVERINFO, "Sets the multiplayer gametype - see gametypelist command for a list of all gametypes");
		http_proxy = Cvar_Get("http_proxy", "", CVAR_ARCHIVE, "Use this proxy for http transfers");
		http_timeout = Cvar_Get("http_timeout", "3", CVAR_ARCHIVE, "Http connection and read timeout");
		port = Cvar_Get("port", DOUBLEQUOTE(PORT_SERVER), CVAR_NOSET);
		masterserver_url = Cvar_Get("masterserver_url", MASTER_SERVER, CVAR_ARCHIVE, "URL of UFO:AI masterserver");
#ifdef DEDICATED_ONLY
		sv_dedicated = Cvar_Get("sv_dedicated", "1", CVAR_SERVERINFO | CVAR_NOSET, "Is this a dedicated server?");
		/* don't allow to override this from commandline of config */
		Cvar_ForceSet("sv_dedicated", "1");
#else
		sv_dedicated = Cvar_Get("sv_dedicated", "0", CVAR_SERVERINFO | CVAR_NOSET, "Is this a dedicated server?");

		/* set this to false for client - otherwise Qcommon_Frame would set the initial values to multiplayer */
		sv_gametype->modified = false;

		s_language = Cvar_Get("s_language", "", CVAR_ARCHIVE, "Game language - full language string e.g. en_EN.UTF-8");
		s_language->modified = false;
		cl_maxfps = Cvar_Get("cl_maxfps", "50", CVAR_ARCHIVE);
		Cvar_SetCheckFunction("cl_maxfps", Com_CvarCheckMaxFPS);
#endif

		// 5 is an i7 with a medium gfx-card
		// 3 dual core with 2 GB
		// 2 EeePc with 1 GB
		// 1 smartphone
		const char* hwclassVal = "5";
#ifdef __ANDROID__
		/** get the hardware class of the machine we are running on. */
		hwclassVal = "1";
#endif
		hwclass = Cvar_Get("hwclass", hwclassVal, 0, "Defines the hardware class of this machine. 1 is the lowest, 5 is the highest.");

		const char* s = va("UFO: Alien Invasion %s %s %s %s", UFO_VERSION, CPUSTRING, __DATE__, BUILDSTRING);
		Cvar_Get("version", s, CVAR_NOSET, "Full version string");
		Cvar_Get("ver", UFO_VERSION, CVAR_SERVERINFO | CVAR_NOSET, "Version number");

		if (sv_dedicated->integer)
			Cmd_AddCommand("quit", Com_Quit, "Quits the game");

		Mem_Init();
		Sys_Init();

		NET_Init();

#ifndef NO_HTTP
		curl_global_init(CURL_GLOBAL_NOTHING);
		Com_Printf("%s initialized.\n", curl_version());
#endif

		SV_Init();

		/* e.g. init the client hunk that is used in script parsing */
		CL_Init();

		Com_ParseScripts(sv_dedicated->integer);
#ifndef DEDICATED_ONLY
		Cbuf_AddText("exec keys.cfg\n");
#endif

		if (!sv_dedicated->integer)
			Cbuf_AddText("init\n");
		else
			Cbuf_AddText("dedicated_start\n");
		Cbuf_Execute();

		FS_ExecAutoexec();

		/* add + commands from command line
		 * if the user didn't give any commands, run default action */
		if (Cbuf_AddLateCommands()) {
			/* the user asked for something explicit
			 * so drop the loading plaque */
			SCR_EndLoadingPlaque();
		}

		const cvar_t* com_pipefile = Cvar_Get("com_pipefile", "", CVAR_ARCHIVE, "Filename of the pipe that is used to send commands to the game");
		if (com_pipefile->string[0] != '\0') {
			FS_CreateOpenPipeFile(com_pipefile->string, &pipefile);
		}

		CL_InitAfter();

		/* Check memory integrity */
		Mem_CheckGlobalIntegrity();

#ifndef DEDICATED_ONLY
		if (!sv_dedicated->integer) {
			Schedule_Timer(cl_maxfps, &CL_Frame, nullptr, nullptr);
			Schedule_Timer(Cvar_Get("cl_slowfreq", "10", 0, nullptr), &CL_SlowFrame, nullptr, nullptr);

			/* now hide the console */
			Sys_ShowConsole(false);
		}
#endif

		Schedule_Timer(Cvar_Get("sv_freq", "10", CVAR_NOSET, nullptr), &SV_Frame, nullptr, nullptr);

		/** @todo This line wants to be removed */
		Schedule_Timer(Cvar_Get("cbuf_freq", "10", 0, nullptr), &Cbuf_Execute_timer, nullptr, nullptr);

		Com_Printf("====== UFO Initialized ======\n");
		Com_Printf("=============================\n");
	} catch (comDrop_t const&) {
		Sys_Error("Error during initialization");
	}
}