示例#1
0
/*
 * 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();

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

  /* build the playerstate_t structures for all players */
  ClientEndServerFrames();
}
示例#2
0
文件: g_main.cpp 项目: yason/ufoai
/**
 * @sa SV_RunGameFrame
 * @sa G_MatchEndTrigger
 * @sa AI_Run
 * @return true if game reaches its end - false otherwise
 */
static bool G_RunFrame (void)
{
	level.framenum++;
	/* server is running at 10 fps */
	level.time = level.framenum * SERVER_FRAME_SECONDS;

	/* this doesn't belong here, but it works */
	if (!level.routed) {
		level.routed = true;
		G_CompleteRecalcRouting();
	}

	/* still waiting for other players */
	if (!G_MatchIsRunning()) {
		if (sv_maxteams->modified) {
			/* inform the client */
			gi.ConfigString(CS_MAXTEAMS, "%i", sv_maxteams->integer);
			sv_maxteams->modified = false;
		}
	}

	if (G_IsMultiPlayer()) {
		if (sv_roundtimelimit->modified) {
			/* some played around here - restart the count down */
			level.roundstartTime = level.time;
			/* don't allow smaller values here */
			if (sv_roundtimelimit->integer < 30 && sv_roundtimelimit->integer > 0) {
				gi.DPrintf("The minimum value for sv_roundtimelimit is 30\n");
				gi.Cvar_Set("sv_roundtimelimit", "30");
			}
			sv_roundtimelimit->modified = false;
		}
		G_CheckForceEndRound();
	}

	/* end this game? */
	if (G_MatchDoEnd())
		return true;

	CheckNeedPass();

	/* run ai */
	AI_Run();

	/* not all teams are spawned or game has already ended */
	if (G_MatchIsRunning())
		G_EdictsThink();

	G_SendBoundingBoxes();

	return false;
}
示例#3
0
文件: g_main.c 项目: lambda/wxQuake2
/*
================
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);
	}

#ifdef IML_Q2_EXTENSIONS
    // find out what the players are looking at
    CheckPlayerLookTargets();
#endif // IML_Q2_EXTENSIONS

	// 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 ();
}
示例#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();
}