Example #1
0
File: timer.c Project: qbism/tmg
void ResetItems (void)
{
	int i;
	edict_t *ent;

	ent = &g_edicts[1];
	for (i=1; i < globals.num_edicts; i++, ent++)
	{
		if (!ent->inuse || ent->client || !ent->item)
			continue;

		if (ent->spawnflags & (DROPPED_ITEM | DROPPED_PLAYER_ITEM)) // Remove any dropped items
		{
			ent->nextthink = level.time;
			ent->think = G_FreeEdict;
		}
		else if (Q_stricmp(ent->classname, "item_flag_team1") == 0 || Q_stricmp(ent->classname, "item_flag_team2") == 0)
		{
			if (!(ent->spawnflags & DROPPED_ITEM))
			{
				ent->flags |= FL_RESPAWN;
				ent->svflags |= SVF_NOCLIENT;
				ent->solid = SOLID_NOT;
			}
		}
		else
			SetRespawn (ent, 0);
	}
	CTFCheckRules();
	CTFResetFlags();
}
Example #2
0
/*
=================
CheckDMRules
=================
*/
void CheckDMRules (void)
{
	int			i;
	gclient_t	*cl;

	if (level.intermissiontime)
		return;

	if (!deathmatch->value)
		return;

//ZOID
	if (ctf->value && CTFCheckRules()) {
		EndDMLevel ();
		return;
	}
	if (CTFInMatch())
		return; // no checking in match mode
//ZOID

	if (timelimit->value)
	{
		if (level.time >= timelimit->value*60)
		{
			gi.bprintf (PRINT_HIGH, "Timelimit hit.\n");
			EndDMLevel ();
			return;
		}
	}

	if (fraglimit->value)
		for (i=0 ; i<maxclients->value ; i++)
		{
			cl = game.clients + i;
			if (!g_edicts[i+1].inuse)
				continue;

			if (cl->resp.score >= fraglimit->value)
			{
				gi.bprintf (PRINT_HIGH, "Fraglimit hit.\n");
				EndDMLevel ();
				return;
			}
		}
}
Example #3
0
/*
=================
CheckDMRules
=================
*/
void CheckDMRules ()
{
	if (Level.Intermission.Time)
		return;

	if (!(Game.GameMode & GAME_DEATHMATCH))
		return;

#if CLEANCTF_ENABLED
//ZOID
	if ((Game.GameMode & GAME_CTF) && CTFCheckRules())
	{
		EndDMLevel ();
		return;
	}
//ZOID
#endif

	if (CvarList[CV_TIME_LIMIT].Float())
	{
		if (Level.Frame >= ((CvarList[CV_TIME_LIMIT].Float()*60)*10))
		{
			BroadcastPrint (PRINT_HIGH, "Timelimit hit.\n");
			EndDMLevel ();
			return;
		}
	}

	if (CvarList[CV_FRAG_LIMIT].Integer())
	{
		for (uint8 i = 0; i < Game.MaxClients; i++)
		{
			CPlayerEntity *cl = entity_cast<CPlayerEntity>(Game.Entities[i+1].Entity);
			if (!cl->GetInUse())
				continue;

			if (cl->Client.Respawn.Score >= CvarList[CV_FRAG_LIMIT].Integer())
			{
				BroadcastPrint (PRINT_HIGH, "Fraglimit hit.\n");
				EndDMLevel ();
				return;
			}
		}
	}
}