コード例 #1
0
ファイル: a_radio.c プロジェクト: DusteDdk/aq2-tng-bk
void Cmd_Radio_power_f (edict_t * ent)
{
	if (!teamplay->value)
	{
		if (!((int) (dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
			return;			// don't allow in a non-team setup...
	}

	ent->client->resp.radio_power_off = !ent->client->resp.radio_power_off;

	if (ent->client->resp.radio_power_off)
	{
		gi.centerprintf (ent, "Radio switched off");
		unicastSound(ent, globalRadio[RADIO_CLICK].sndIndex, 1.0);
	}
	else
	{
		gi.centerprintf (ent, "Radio switched on");
		unicastSound(ent, globalRadio[RADIO_CLICK].sndIndex, 1.0);
	}
}
コード例 #2
0
ファイル: a_radio.c プロジェクト: Raptor007/aq2-tng
void Cmd_Radio_power_f (edict_t * ent)
{
	radio_t *radio;

	if (!teamplay->value)
	{
		if (!DMFLAGS( (DF_MODELTEAMS | DF_SKINTEAMS) ))
			return;			// don't allow in a non-team setup...
	}

	radio = &ent->client->resp.radio;

	radio->power_off = !radio->power_off;



	gi.centerprintf(ent, "Radio switched %s", (radio->power_off) ? "off" : "on");

	unicastSound(ent, globalRadio[RADIO_CLICK].sndIndex, 1.0);
}
コード例 #3
0
ファイル: a_dom.c プロジェクト: Raptor007/aq2-tng
void DomFlagThink( edict_t *flag )
{
	// If the flag was touched this frame, make it owned by that team.
	if( flag->owner && flag->owner->client && flag->owner->client->resp.team )
	{
		unsigned int effect = dom_team_effect[ flag->owner->client->resp.team ];
		if( flag->s.effects != effect )
		{
			edict_t *ent = NULL;
			int prev_owner = DomFlagOwner( flag );
			if( prev_owner != NOTEAM )
				dom_team_flags[ prev_owner ] --;

			flag->s.effects = effect;
			flag->s.renderfx = dom_team_fx[ flag->owner->client->resp.team ];
			dom_team_flags[ flag->owner->client->resp.team ] ++;

			if( flag->owner->client->resp.team == TEAM1 )
				flag->s.modelindex = dom_red_flag;
			else
				flag->s.modelindex = dom_blue_flag;

			// Get flag location if possible.
			char location[ 128 ] = "(";
			qboolean has_loc = GetPlayerLocation( flag, location + 1 );
			if( has_loc )
				strcat( location, ") " );
			else
				location[0] = '\0';

			gi.bprintf( PRINT_HIGH, "%s secured %s flag %sfor %s!\n",
				flag->owner->client->pers.netname,
				(dom_flag_count == 1) ? "the" : "a",
				location,
				teams[ flag->owner->client->resp.team ].name );

			if( (dom_team_flags[ flag->owner->client->resp.team ] == dom_flag_count) && (dom_flag_count > 1) )
				gi.bprintf( PRINT_HIGH, "%s TEAM IS DOMINATING!\n",
				teams[ flag->owner->client->resp.team ].name );

			gi.sound( flag, CHAN_ITEM, gi.soundindex("tng/flagret.wav"), 0.75, 0.125, 0 );

			for( ent = g_edicts + 1; ent <= g_edicts + game.maxclients; ent ++ )
			{
				if( ! (ent->inuse && ent->client && ent->client->resp.team) )
					continue;
				else if( ent == flag->owner )
					unicastSound( ent, gi.soundindex("tng/flagcap.wav"), 0.75 );
				else if( ent->client->resp.team != flag->owner->client->resp.team )
					unicastSound( ent, gi.soundindex("tng/flagtk.wav"), 0.75 );
			}
		}
	}

	// Reset so the flag can be touched again.
	flag->owner = NULL;

	// Animate the flag waving.
	int prev = flag->s.frame;
	flag->s.frame = 173 + (((flag->s.frame - 173) + 1) % 16);

	// Blink between red and blue if it's unclaimed.
	if( (flag->s.frame < prev) && (flag->s.effects == dom_team_effect[ NOTEAM ]) )
		flag->s.modelindex = (flag->s.modelindex == dom_blue_flag) ? dom_red_flag : dom_blue_flag;

	flag->nextthink = level.framenum + FRAMEDIV;
}
コード例 #4
0
ファイル: a_radio.c プロジェクト: DusteDdk/aq2-tng-bk
// RadioThink should be called once on each player per server frame.
void RadioThink (edict_t * ent)
{
	// Try to clean things up, a bit....
	if (ent->client->resp.radio_partner)
	{
		if (!ent->client->resp.radio_partner->inuse ||
			ent->client->resp.radio_partner->client->resp.radio_partner != ent)
		{
			ent->client->resp.radio_partner = NULL;
		}
	}
	if (ent->client->resp.partner_last_offered_to)
	{
		if (!ent->client->resp.partner_last_offered_to->inuse ||
			ent->client->resp.partner_last_offered_to->solid == SOLID_NOT)
		{
			ent->client->resp.partner_last_offered_to = NULL;
		}
	}
	if (ent->client->resp.partner_last_denied_from)
	{
		if (!ent->client->resp.partner_last_denied_from->inuse ||
			ent->client->resp.partner_last_denied_from->solid == SOLID_NOT)
		{
			ent->client->resp.partner_last_denied_from = NULL;
		}
	}
	// ................................

	if (ent->client->resp.radio_power_off)
	{
		ent->client->resp.radio_queue_size = 0;
		return;
	}

	if (ent->client->resp.radio_delay > 0)
	{
		ent->client->resp.radio_delay--;
		if(ent->client->resp.radio_delay)
			return;
	}


	if (ent->client->resp.radio_queue_size)
	{
		edict_t *from;
		int check;

		from = ent->client->resp.radio_queue[0].from_player;

		if (!ent->client->resp.radio_queue[0].click &&
			(!from->inuse || from->solid == SOLID_NOT
			|| from->deadflag == DEAD_DEAD))
		{
			if (ent->client->resp.radio_queue[0].from_gender)
			{
				ent->client->resp.radio_queue[0].sndIndex = globalRadio[RADIO_DEATH_FEMALE].sndIndex;
				ent->client->resp.radio_queue[0].length = globalRadio[RADIO_DEATH_FEMALE].length;
			}
			else
			{
				ent->client->resp.radio_queue[0].sndIndex = globalRadio[RADIO_DEATH_MALE].sndIndex;
				ent->client->resp.radio_queue[0].length = globalRadio[RADIO_DEATH_MALE].length;
			}

			for (check = 1; check < ent->client->resp.radio_queue_size; check++)
			{
				if (!ent->client->resp.radio_queue[check].click && ent->client->resp.radio_queue[check].from_player == from)
				{
					DeleteRadioQueueEntry (ent, check);
					check--;
				}
			}
		}

		unicastSound(ent, ent->client->resp.radio_queue[0].sndIndex, 1.0);
		ent->client->resp.radio_delay = ent->client->resp.radio_queue[0].length;
		DeleteRadioQueueEntry (ent, 0); //We can remove it here?
	}
}
コード例 #5
0
ファイル: a_radio.c プロジェクト: Raptor007/aq2-tng
// RadioThink should be called once on each player per server frame.
void RadioThink (edict_t * ent)
{
	radio_t *radio = &ent->client->resp.radio;

	// Try to clean things up, a bit....
	if (radio->partner)
	{
		if (!radio->partner->inuse ||
			radio->partner->client->resp.radio.partner != ent)
		{
			radio->partner = NULL;
		}
	}
	if (radio->partner_last_offered_to)
	{
		if (!radio->partner_last_offered_to->inuse ||
			radio->partner_last_offered_to->solid == SOLID_NOT)
		{
			radio->partner_last_offered_to = NULL;
		}
	}
	if (radio->partner_last_denied_from)
	{
		if (!radio->partner_last_denied_from->inuse ||
			radio->partner_last_denied_from->solid == SOLID_NOT)
		{
			radio->partner_last_denied_from = NULL;
		}
	}
	// ................................

	if (radio->power_off)
	{
		radio->queue_size = 0;
		return;
	}

	if (radio->delay > 0)
	{
		radio->delay--;
		if (radio->delay)
			return;
	}


	if (radio->queue_size)
	{
		edict_t *from;
		int check;

		from = radio->queue[0].from_player;

		if (!radio->queue[0].click && (!from->inuse || !IS_ALIVE(from)))
		{
			if (radio->queue[0].from_gender)
			{
				radio->queue[0].sndIndex = globalRadio[RADIO_DEATH_FEMALE].sndIndex;
				radio->queue[0].length = globalRadio[RADIO_DEATH_FEMALE].length;
			}
			else
			{
				radio->queue[0].sndIndex = globalRadio[RADIO_DEATH_MALE].sndIndex;
				radio->queue[0].length = globalRadio[RADIO_DEATH_MALE].length;
			}

			for (check = 1; check < radio->queue_size; check++)
			{
				if (!radio->queue[check].click && radio->queue[check].from_player == from)
				{
					DeleteRadioQueueEntry( radio, check );
					check--;
				}
			}
		}

		if( ! IsInIgnoreList( ent, from ) )
		{
			unicastSound( ent, radio->queue[0].sndIndex, 1.0 );
			radio->delay = radio->queue[0].length;
		}
		DeleteRadioQueueEntry( radio, 0 ); //We can remove it here?
	}
}