Пример #1
0
	void SaveFields (CFile &File)
	{
		IBounceProjectile::SaveFields (File);
		ITouchableEntity::SaveFields (File);
		IHurtableEntity::SaveFields (File);
		IThinkableEntity::SaveFields (File);

		File.Write<EProxThinkType> (ThinkType);
		File.Write<sint32> ((Field != NULL && Field->GetInUse()) ? Field->State.GetNumber() : -1);
		File.Write<sint32> ((Firer != NULL && Firer->GetInUse()) ? Firer->State.GetNumber() : -1);
		File.Write<int> (Damage);
		File.Write<FrameNumber> (Wait);
	};
Пример #2
0
//
// this is the smarts for the rocket launcher in coop
//
// if there is a player behind/below the carrier, and we can shoot, and we can trace a LOS to them ..
// pick one of the group, and let it rip
void CCarrier::CoopCheck ()
{
	// no more than 4 players in coop, so..
	static std::vector<CPlayerEntity*> targets;
	targets.clear();

	// if we're not in coop, this is a noop
	if (!(Game.GameMode & GAME_COOPERATIVE))
		return;
	// if we are, and we have recently fired, bail
	if (RefireWait > Level.Frame)
		return;

	// cycle through players
	for (int player = 1; player <= Game.MaxClients; player++)
	{
		CPlayerEntity *ent = entity_cast<CPlayerEntity>(Game.Entities[player].Entity);

		if (!ent->GetInUse())
			continue;
		
		if (IsInBack(Entity, ent) || IsBelow(Entity, ent))
		{
			CTrace tr (Entity->State.GetOrigin(), ent->State.GetOrigin(), Entity, CONTENTS_MASK_SOLID);
		
			if (tr.Fraction == 1.0)
				targets.push_back (ent);
		}
	}

	if (targets.empty())
		return;

	int target = irandom(targets.size());

	// make sure to prevent rapid fire rockets
	RefireWait = Level.Frame + CARRIER_ROCKET_TIME;

	// save off the real enemy
	IBaseEntity *OldEnemy = *Entity->Enemy;
	// set the new guy as temporary enemy
	Entity->Enemy = targets[target];
	Rocket ();
	// put the real enemy back
	Entity->Enemy = OldEnemy;

	// we're done
	return;
}
Пример #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;
			}
		}
	}
}