Example #1
0
/*
* G_RunEntities
* treat each object in turn
* even the world and clients get a chance to think
*/
static void G_RunEntities( void )
{
	edict_t	*ent;

	for( ent = &game.edicts[0]; ENTNUM( ent ) < game.numentities; ent++ )
	{
		if( !ent->r.inuse )
			continue;
		if( ISEVENTENTITY( &ent->s ) )
			continue; // events do not think

		level.current_entity = ent;

		// backup oldstate ( for world frame ).
		ent->olds = ent->s;

		// if the ground entity moved, make sure we are still on it
		if( !ent->r.client )
		{
			if( ( ent->groundentity ) && ( ent->groundentity->linkcount != ent->groundentity_linkcount ) )
				G_CheckGround( ent );
		}

		G_RunEntity( ent );

		if( ent->takedamage )
			ent->s.effects |= EF_TAKEDAMAGE;
		else
			ent->s.effects &= ~EF_TAKEDAMAGE;
	}
}
Example #2
0
/*
 * G_Frame
 *
 * The main game module "think" function, called once per server frame.
 * Nothing would happen in Quake land if this weren't called.
 */
static void G_Frame(void) {
	int i;
	g_edict_t *ent;

	g_level.frame_num++;
	g_level.time = g_level.frame_num * gi.server_frame;

	// check for level change after running intermission
	if (g_level.intermission_time) {
		if (g_level.time > g_level.intermission_time + INTERMISSION) {
			G_ExitLevel();
			return;
		}
	}

	// treat each object in turn
	// even the world gets a chance to think
	ent = &g_game.edicts[0];
	for (i = 0; i < ge.num_edicts; i++, ent++) {

		if (!ent->in_use)
			continue;

		g_level.current_entity = ent;

		// update old origin for interpolation
		if (!(ent->s.effects & EF_LIGHTNING))
			VectorCopy(ent->s.origin, ent->s.old_origin);

		if (ent->ground_entity) {

			// check for ground entities going away
			if (ent->ground_entity->link_count != ent->ground_entity_link_count)
				ent->ground_entity = NULL;
		}

		if (i > 0 && i <= sv_max_clients->integer)
			G_ClientBeginFrame(ent);
		else
			G_RunEntity(ent);
	}

	// see if a vote has passed
	G_CheckVote();

	// inspect and enforce gameplay rules
	G_CheckRules();

	// see if a match should end
	G_CheckMatchEnd();

	// see if an arena round should start
	G_CheckRoundStart();

	// see if an arena round should end
	G_CheckRoundEnd();

	// build the player_state_t structures for all players
	G_EndClientFrames();
}
Example #3
0
/*
================
G_RunFrame

Advances the world by 0.1 seconds
================
*/
void G_RunFrame (void)
{
	int		i;
	edict_t	*ent;

	level.framenum++;
	level.time = level.framenum*FRAMETIME;

	// choose a client for monsters to target this frame
	AI_SetSightClient ();

	// exit intermissions

	if (level.exitintermission)
	{
		ExitLevel ();
		return;
	}

	//
	// treat each object in turn
	// even the world gets a chance to think
	//
	ent = &g_edicts[0];
	for (i=0 ; i<globals.num_edicts ; i++, ent++)
	{
		if (!ent->inuse)
			continue;

		level.current_entity = ent;

		VectorCopy (ent->s.origin, ent->s.old_origin);

		// if the ground entity moved, make sure we are still on it
		if ((ent->groundentity) && (ent->groundentity->linkcount != ent->groundentity_linkcount))
		{
			ent->groundentity = NULL;
			if ( !(ent->flags & (FL_SWIM|FL_FLY)) && (ent->svflags & SVF_MONSTER) )
			{
				M_CheckGround (ent);
			}
		}

		if (i > 0 && i <= maxclients->value)
		{
			ClientBeginServerFrame (ent);
			continue;
		}

		G_RunEntity (ent);
	}

	// see if it is time to end a deathmatch
	CheckDMRules ();

	// build the playerstate_t structures for all players
	ClientEndServerFrames ();
}
Example #4
0
void G_RunFrame(void)
{
	// Knightmare- dm pause
	if (paused && deathmatch->value)
		return;

	if (level.freeze)
	{
		level.freezeframes++;
		if (level.freezeframes >= sk_stasis_time->value * 10)
			level.freeze = false;
	}
	else
	{
		level.framenum++;
	}

	level.time = level.framenum*FRAMETIME;

	// choose a client for monsters to target this frame
	AI_SetSightClient();

	// exit intermissions
	if (level.exitintermission)
	{
		ExitLevel();
		return;
	}

	if (use_techs->value || (ctf->value && !((int)dmflags->value & DF_CTF_NO_TECH)) )
		CheckNumTechs();

	//
	// treat each object in turn
	// even the world gets a chance to think
	//
	edict_t *ent = &g_edicts[0];
	for (int i = 0; i < globals.num_edicts; i++, ent++)
	{
		if (!ent->inuse)
			continue;

		level.current_entity = ent;

		VectorCopy(ent->s.origin, ent->s.old_origin);

		// if the ground entity moved, make sure we are still on it
		if (ent->groundentity && ent->groundentity->linkcount != ent->groundentity_linkcount)
		{
			ent->groundentity = NULL;
			if (!(ent->flags & (FL_SWIM | FL_FLY)) && (ent->svflags & SVF_MONSTER))
				M_CheckGround(ent);
		}

		if (i > 0 && i <= maxclients->value)
		{
			ClientBeginServerFrame(ent);
// ACEBOT_ADD
			if (!ent->is_bot) // Bots need G_RunEntity called
				continue;
// ACEBOT_END
		}

		G_RunEntity(ent);
	}

	// see if it is time to end a deathmatch
	CheckDMRules();

	// see if needpass needs updated
	CheckNeedPass();

	// build the playerstate_t structures for all players
	ClientEndServerFrames();
}
Example #5
0
File: g_main.c Project: ZwS/qudos
/*
 * ================ G_RunFrame
 *
 * Advances the world by 0.1 seconds ================
 */
void
G_RunFrame(void)
{
	int		i;
	edict_t        *ent;

#ifdef GAME_MOD
	Blinky_BeginRunFrame();
#endif

	level.framenum++;
	level.time = level.framenum * FRAMETIME;

	/* choose a client for monsters to target this frame */
	AI_SetSightClient();

	/* exit intermissions */

	if (level.exitintermission) {
		ExitLevel();
		return;
	}
	//
	/* treat each object in turn */
	/* even the world gets a chance to think */
	    //
	    ent = &g_edicts[0];
	for (i = 0; i < globals.num_edicts; i++, ent++) {
		if (!ent->inuse)
			continue;

		level.current_entity = ent;

		VectorCopy(ent->s.origin, ent->s.old_origin);

		/* if the ground entity moved, make sure we are still on it */
		if ((ent->groundentity) && (ent->groundentity->linkcount != ent->groundentity_linkcount)) {
			ent->groundentity = NULL;
			if (!(ent->flags & (FL_SWIM | FL_FLY)) && (ent->svflags & SVF_MONSTER)) {
				M_CheckGround(ent);
			}
		}
		if (i > 0 && i <= maxclients->value) {
			ClientBeginServerFrame(ent);
#ifdef WITH_ACEBOT
			/* continue; */
#else
			continue;
#endif
		}
		G_RunEntity(ent);
	}

	/* see if it is time to end a deathmatch */
	CheckDMRules();

	/* see if needpass needs updated */
	CheckNeedPass();

	/* build the playerstate_t structures for all players */
	ClientEndServerFrames();
}