Exemple #1
0
/*
==================
Host_ClientFrame

==================
*/
void Host_ClientFrame( void )
{
	// if client is not active, do nothing
	if( !cls.initialized ) return;

	// decide the simulation time
	cl.oldtime = cl.time;
	cl.time += host.frametime;

	if( menu.hInstance )
	{
		// menu time (not paused, not clamped)
		menu.globals->time = host.realtime;
		menu.globals->frametime = host.realframetime;
		menu.globals->demoplayback = cls.demoplayback;
		menu.globals->demorecording = cls.demorecording;
	}

	// if in the debugger last frame, don't timeout
	if( host.frametime > 5.0f ) cls.netchan.last_received = Sys_DoubleTime();

	VGui_RunFrame ();

	clgame.dllFuncs.pfnFrame( host.frametime );

	// fetch results from server
	CL_ReadPackets();

	VID_CheckChanges();

	// allow sound and video DLL change
	if( cls.state == ca_active )
	{
		if( !cl.video_prepped ) CL_PrepVideo();
		if( !cl.audio_prepped ) CL_PrepSound();
	}

	// update the screen
	SCR_UpdateScreen ();

	// update audio
	S_RenderFrame( &cl.refdef );

	// send a new command message to the server
	CL_SendCommand();

	// predict all unacknowledged movements
	CL_PredictMovement();

	// decay dynamic lights
	CL_DecayLights ();

	SCR_RunCinematic();
	Con_RunConsole();

	cls.framecount++;
}
Exemple #2
0
/*
==================
Host_Frame

Runs all active servers
==================
*/
void _Host_Frame (float time)
{
	static double		time1 = 0;
	static double		time2 = 0;
	static double		time3 = 0;
	int			pass1, pass2, pass3;

	if (setjmp (host_abortserver) )
		return;			// something bad happened, or the server disconnected

// keep the random time dependent
	rand ();
	
// decide the simulation time
	if (!Host_FilterTime (time))
		return;			// don't run too fast, or packets will flood out
		
// get new key events
	Sys_SendKeyEvents ();

// allow mice or other external controllers to add commands
	IN_Commands ();

// process console commands
	Cbuf_Execute ();

	NET_Poll();

// if running the server locally, make intentions now
	if (sv.active)
		CL_SendCmd ();
	
//-------------------
//
// server operations
//
//-------------------

// check for commands typed to the host
	Host_GetConsoleCommands ();
	
	if (sv.active)
		Host_ServerFrame ();

//-------------------
//
// client operations
//
//-------------------

// if running the server remotely, send intentions now after
// the incoming messages have been read
	if (!sv.active)
		CL_SendCmd ();

	host_time += host_frametime;

// fetch results from server
	if (cls.state == ca_connected)
	{
		CL_ReadFromServer ();
	}

// update video
	if (host_speeds.value)
		time1 = Sys_FloatTime ();
		
	SCR_UpdateScreen ();

	if (host_speeds.value)
		time2 = Sys_FloatTime ();
		
// update audio
	if (cls.signon == SIGNONS)
	{
		S_Update (r_origin, vpn, vright, vup);
		CL_DecayLights ();
	}
	else
		S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
	
	// jkrige - fmod sound system (music)
	//CDAudio_Update();
	FMOD_MusicUpdate();
	// jkrige - fmod sound system (music)

	if (host_speeds.value)
	{
		pass1 = (time1 - time3)*1000;
		time3 = Sys_FloatTime ();
		pass2 = (time2 - time1)*1000;
		pass3 = (time3 - time2)*1000;
		Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n",	pass1+pass2+pass3, pass1, pass2, pass3);
	}
	
	host_framecount++;

	fps_count++; // jkrige - fps counter
}
/*
==================
Host_Frame

Runs all active servers
==================
*/
void _Host_Frame (double time)
{
	static double		time1 = 0;
	static double		time2 = 0;
	static double		time3 = 0;
	int			pass1, pass2, pass3;

	if (setjmp (host_abortserver) )
		return;			// something bad happened, or the server disconnected

// keep the random time dependent
	rand ();

// decide the simulation time
	if (!Host_FilterTime (time))
	{
#ifdef PROQUAKE_EXTENSION
		// JPG - if we're not doing a frame, still check for lagged moves to send
		if (!sv.active && (cl.movemessages > 2))
			CL_SendLagMove();
#endif
		return;			// don't run too fast, or packets will flood out

	}

// get new key events
#if !defined(MACOSX)
	Sys_SendKeyEvents ();
#endif // This is done in Windows and Linux.  Confirmed from pq350src

// allow mice or other external controllers to add commands
	IN_Commands (); // Baker: This is ONLY joystick

// process console commands
	Cbuf_Execute ();

	NET_Poll();

// if running the server locally, make intentions now
	if (sv.active)
		CL_SendCmd ();  // This is where mouse input is read
#ifdef WINDOWS_SCROLLWHEEL_PEEK
	else if (con_forcedup && key_dest == key_game) // Allows console scrolling when con_forcedup
		IN_MouseWheel ();	// Grab mouse wheel input
#endif

//-------------------
//
// server operations
//
//-------------------

// check for commands typed to the host
	Host_GetConsoleCommands ();

	if (sv.active)
		Host_ServerFrame ();

//-------------------
//
// client operations
//
//-------------------

// if running the server remotely, send intentions now after
// the incoming messages have been read
	if (!sv.active)
		CL_SendCmd ();

	host_time += host_frametime;

// fetch results from server
	if (cls.state == ca_connected)
		CL_ReadFromServer ();

	if (host_speeds.value)
		time1 = Sys_DoubleTime ();

// update video
	SCR_UpdateScreen ();

	if (host_speeds.value)
		time2 = Sys_DoubleTime ();

	if (cls.signon == SIGNONS)
	{
		// update audio
		S_Update (r_origin, vpn, vright, vup);
		CL_DecayLights ();
	}
	else
	{
		S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
	}

#ifdef PSP_MP3_SUPPORT
	if (bmg_type_changed == true)
	{
#endif
		CDAudio_Update();
#ifdef PSP_MP3_SUPPORT
		bmg_type_changed = false;
	}
#endif

	if (host_speeds.value)
	{
		pass1 = (time1 - time3)*1000;
		time3 = Sys_DoubleTime ();
		pass2 = (time2 - time1)*1000;
		pass3 = (time3 - time2)*1000;
		Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n", pass1+pass2+pass3, pass1, pass2, pass3);
	}

#ifdef SUPPORTS_DEMO_CONTROLS
	if (!cls.demoplayback && cl_demorewind.value)
	{
		Cvar_SetValueByRef (&cl_demorewind, 0);
		Con_Printf ("Demorewind is only enabled during playback\n");
	}
#endif

	host_framecount++;
	//frame speed counter
	fps_count++;//muff
}