Beispiel #1
0
/*
==================
Host_Frame

Runs all active servers
==================
*/
void
_Host_Frame(float time)
{
   /* something bad happened, or the server disconnected */
   if (setjmp(host_abort))
      return;

   /* keep the random time dependent */
   rand();

   /*
    * Decide the simulation time. Don't run too fast, or packets will flood
    * out.
    */
   if (!Host_FilterTime(time))
      return;

   /* 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();

   SCR_UpdateScreen();
   CL_RunParticles();

   host_framecount++;
   fps_count++;
}
Beispiel #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
	Key_UpdateForDest ();
	IN_UpdateInputMode ();
	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 ();

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

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

	SCR_UpdateScreen ();

	CL_RunParticles (); //johnfitz -- seperated from rendering

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

// update audio
	BGM_Update();	// adds music raw samples and/or advances midi driver
	if (cls.signon == SIGNONS)
	{
		S_Update (r_origin, vpn, vright, vup);
		CL_DecayLights ();
	}
	else
		S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);

	CDAudio_Update();

	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);
	}

	host_framecount++;

}