Ejemplo n.º 1
0
void VX_TrackerTK_XvsY(int player, int killer, int weapon, int p_count, int p_icount, int k_count, int k_icount)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
	{
		if (cl_useimagesinfraglog.integer)
		{
			snprintf(outstring, sizeof(outstring), "&c%s%s&r %s &c%s%s&r", TKColor(player), VX_Name(killer), GetWeaponName(weapon), TKColor(player), VX_Name(player));
			Q_normalizetext(outstring);
		}
		else
		{
			snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r %s", VX_Name(killer), TKColor(player), GetWeaponName(weapon), VX_Name(player));
		}
	}
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
	{
		snprintf(outstring, sizeof(outstring), "&c380Teammate&r %s &c900killed you\nTimes: %i\nTotal Teamkills: %i", cl.players[killer].name, p_icount, p_count);
	}
	else if (cl.playernum == killer || (killer == Cam_TrackNum() && cl.spectator))
	{
		snprintf(outstring, sizeof(outstring), "&c900You killed &c380teammate&r %s\nTimes: %i\nTotal Teamkills: %i", cl.players[player].name, k_icount, k_count);
	}

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 2
0
void VX_TrackerStreakEnd(int player, int killer, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";
	killing_streak_t *streak = VX_GetStreak(count);
	if (!streak)
		return;

	if (player == killer) // streak ends due to suicide
	{
		if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
			snprintf(outstring, sizeof(outstring), "&c940You were looking good until you killed yourself (%i kills)", count);
		else if (!strcmp(Info_ValueForKey(cl.players[player].userinfo, "g") , "female") || !strcmp(Info_ValueForKey(cl.players[player].userinfo, "g") , "1") || !strcmp(Info_ValueForKey(cl.players[player].userinfo, "gender") , "female") || !strcmp(Info_ValueForKey(cl.players[player].userinfo, "gender") , "1"))
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good until she killed herself (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else if (!strcmp(Info_ValueForKey(cl.players[player].userinfo, "g") , "none") || !strcmp(Info_ValueForKey(cl.players[player].userinfo, "g") , "2") || !strcmp(Info_ValueForKey(cl.players[player].userinfo, "none") , "female") || !strcmp(Info_ValueForKey(cl.players[player].userinfo, "gender") , "2"))
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good until it killed itself (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good until he killed himself (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
	}
	else // non suicide
	{
		if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
			snprintf(outstring, sizeof(outstring), "&c940Your streak was ended by &r%s&c940 (%i kills)", Info_ValueForKey(cl.players[killer].userinfo, "name"), count);
		else if (cl.playernum == killer || (killer == Cam_TrackNum() && cl.spectator))
			snprintf(outstring, sizeof(outstring), "&r%s&c940's streak was ended by you (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else
			snprintf(outstring, sizeof(outstring), "&r%s&c940's streak was ended by &r%s&c940 (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), Info_ValueForKey(cl.players[killer].userinfo, "name"), count);
	}
	VX_TrackerAddText(outstring, tt_streak);
}
Ejemplo n.º 3
0
void VX_TrackerFragXvsY(int player, int killer, int weapon, int player_wcount, int killer_wcount)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
	{
		if (cl_useimagesinfraglog.integer)
		{
			snprintf(outstring, sizeof(outstring), "&c%s%s&r %s &c%s%s&r", XvsYColor(player, killer), VX_Name(killer), GetWeaponName(weapon), XvsYColor(killer, player), VX_Name(player));
			Q_normalizetext(outstring);
		}
		else
		{
			snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r %s", VX_Name(killer), XvsYColor(player, killer), GetWeaponName(weapon), VX_Name(player));
		}
	}
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&r%s &c900killed you&r\n%s deaths: %i", cl.players[killer].name, GetWeaponName(weapon), player_wcount);
	else if (cl.playernum == killer || (killer == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c900You killed &r%s\n%s kills: %i", cl.players[player].name, GetWeaponName(weapon), killer_wcount);

	if (cl.playernum == killer || (killer == Cam_TrackNum() && cl.spectator))
		VX_OwnFragNew(cl.players[player].name);

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 4
0
void VX_TrackerStreakEnd(int player, int killer, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";
	killing_streak_t *streak = VX_GetStreak(count);
	if (!streak)
		return;

	if (player == killer) // streak ends due to suicide
	{
		char* userinfo_gender = Info_ValueForKey(cl.players[player].userinfo, "gender");
		char gender;
		if (! *userinfo_gender)
			userinfo_gender = Info_ValueForKey(cl.players[player].userinfo, "g");

		gender = userinfo_gender[0];
		if (gender == '0' || gender == 'M')
			gender = 'm';
		else if (gender == '1' || gender == 'F')
			gender = 'f';
		else if (gender == '2' || gender == 'N')
			gender = 'n';

		if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
			snprintf(outstring, sizeof(outstring), "&c940You were looking good until you killed yourself (%i kills)", count);
		else if (gender == 'm')
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good until he killed himself (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else if (gender == 'f')
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good until she killed herself (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else if (gender == 'n')
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good until it killed itself (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else
			snprintf(outstring, sizeof(outstring), "&r%s&c940 was looking good, then committed suicide (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
	}
	else // non suicide
	{
		if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
			snprintf(outstring, sizeof(outstring), "&c940Your streak was ended by &r%s&c940 (%i kills)", Info_ValueForKey(cl.players[killer].userinfo, "name"), count);
		else if (cl.playernum == killer || (killer == Cam_TrackNum() && cl.spectator))
			snprintf(outstring, sizeof(outstring), "&r%s&c940's streak was ended by you (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);
		else
			snprintf(outstring, sizeof(outstring), "&r%s&c940's streak was ended by &r%s&c940 (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), Info_ValueForKey(cl.players[killer].userinfo, "name"), count);
	}
	VX_TrackerAddText(outstring, tt_streak);
}
Ejemplo n.º 5
0
// return true if player enemy comparing to u, handle spectator mode
qbool VX_TrackerIsEnemy(int player)
{
	int selfnum;

	if (!cl.teamplay) // non teamplay mode, so player is enemy if not u 
		return !(cl.playernum == player || (player == Cam_TrackNum() && cl.spectator));

	// ok, below is teamplay

	if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		return false;

	selfnum = (cl.spectator ? Cam_TrackNum() : cl.playernum);

	if (selfnum == -1)
		return true; // well, seems u r spec, but tracking noone

	return strncmp(cl.players[player].team, cl.players[selfnum].team, sizeof(cl.players[0].team)-1);
}
Ejemplo n.º 6
0
void VX_TrackerOddTeamkilled(int player, int weapon)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
		snprintf(outstring, sizeof(outstring), "&rteammate &c%s%s&r %s", TKColor(player), GetWeaponName(weapon), cl.players[player].name);
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))	
		snprintf(outstring, sizeof(outstring), "&c380Teammate &c900killed you&r");

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 7
0
void VX_TrackerOddTeamkill(int player, int weapon, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
		snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r teammate", cl.players[player].name, TKColor(player), GetWeaponName(weapon));
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c900You killed &c380a teammate&r\nTotal Teamkills: %i", count);

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 8
0
void VX_TrackerSuicide(int player, int weapon, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
		snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r%s", cl.players[player].name, SuiColor(player), GetWeaponName(weapon), amf_tracker_string_suicides.string);
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c960You killed yourself&r\n%s suicides: %i", GetWeaponName(weapon), count);

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 9
0
void VX_TrackerOddFrag(int player, int weapon, int wcount)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
		snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r enemy", cl.players[player].name, OddFragColor(player), GetWeaponName(weapon));
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c900You killed&r an enemy\n%s kills: %i", GetWeaponName(weapon), wcount);

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 10
0
void VX_TrackerStreakEndOddTeamkilled(int player, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";
	killing_streak_t *streak = VX_GetStreak(count);
	if (!streak)
		return;

	if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c940Your streak was ended by teammate (%i kills)", count);
	else
		snprintf(outstring, sizeof(outstring), "&r%s&c940's streak was ended by teammate (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), count);

	VX_TrackerAddText(outstring, tt_streak);
}
Ejemplo n.º 11
0
void VX_TrackerStreak (int player, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";
	killing_streak_t *streak = VX_GetStreak(count);
	if (!streak)
		return;
	if (count != streak->frags)
		return;

	if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c940You are %s (%i kills)", streak->spreestring, count);
	else
		snprintf(outstring, sizeof(outstring), "&r%s &c940is %s (%i kills)", Info_ValueForKey(cl.players[player].userinfo, "name"), streak->spreestring, count);
	VX_TrackerAddText(outstring, tt_streak);
}
Ejemplo n.º 12
0
void StatsGrid_ValidateTeamColors()
{
	// This is needed to handle when a user switches the player being tracked
	// and has "teamcolor" and "enemycolor" set. When you switch to a player
	// that has another team than the one you tracked at match start, the team
	// colors saved on the stats grid will not match the team color of the actual
	// players on the level.

	int player_color;
	player_info_t *player_info;
	int tracked = Cam_TrackNum();

	if (tracked < 0)
	{
		return;
	}

	// Get the tracked player.
	player_info = &cl.players[tracked];

	// Get the team color of the tracked player.
	player_color = Sbar_BottomColor(player_info);

	if (!stats_important_ents || !stats_grid)
	{
		return;
	}

	// If the player being tracked is a member of team 1 for instance but has a
	// team color that doesn't match the one saved for team 1 in the
	// stats grid, then swap the team colors in the stats grid.
	if (!strncmp(stats_grid->teams[STATS_TEAM1].name, player_info->team, sizeof(stats_grid->teams[STATS_TEAM1].name))
		&& stats_grid->teams[STATS_TEAM1].color != player_color)
	{
		int old_team1_color = stats_grid->teams[STATS_TEAM1].color;
		stats_grid->teams[STATS_TEAM1].color = stats_important_ents->teams[STATS_TEAM1].color = player_color;
		stats_grid->teams[STATS_TEAM2].color = stats_important_ents->teams[STATS_TEAM2].color = old_team1_color;
	}
	else if (!strncmp(stats_grid->teams[STATS_TEAM2].name, player_info->team, sizeof(stats_grid->teams[STATS_TEAM2].name))
		&& stats_grid->teams[STATS_TEAM2].color != player_color)
	{
		int old_team2_color = stats_grid->teams[STATS_TEAM2].color;
		stats_grid->teams[STATS_TEAM2].color = stats_important_ents->teams[STATS_TEAM2].color = player_color;
		stats_grid->teams[STATS_TEAM1].color = stats_important_ents->teams[STATS_TEAM1].color = old_team2_color;
	}
}
Ejemplo n.º 13
0
void VX_TrackerOddFrag(int player, int weapon, int wcount)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
	{
		if (cl_useimagesinfraglog.integer)
		{
			snprintf(outstring, sizeof(outstring), "&c%s%s&r %s &c%s%s&r", OddFragColor(player), VX_Name(player), GetWeaponName(weapon), EnemyColor(), amf_tracker_string_enemy.string);
			Q_normalizetext(outstring);
		}
		else
		{
			snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r %s", VX_Name(player), OddFragColor(player), GetWeaponName(weapon), amf_tracker_string_enemy.string);
		}
	}
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
		snprintf(outstring, sizeof(outstring), "&c900You killed&r an enemy\n%s kills: %i", GetWeaponName(weapon), wcount);

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 14
0
void CL_Track_f(void) {	
	int slot;
	char *arg;

	if (cls.state < ca_connected) {
		Com_Printf("You must be connected to track\n");
		return;
	}
	if (!cl.spectator) {
		Com_Printf("You can only track in spectator mode\n");
		return;
	}
	if (Cmd_Argc() != 2) {
		Com_Printf("Usage: %s <name | userid>\n", Cmd_Argv(0));
		return;
	}

	slot = Player_GetSlot(arg = Cmd_Argv(1));

	if (slot == PLAYER_NAME_NOMATCH) {
		Com_Printf("%s : no such player %s\n", Cmd_Argv(0), arg);
		return;
	} else if (slot == PLAYER_ID_NOMATCH) {
		Com_Printf("%s : no player with userid %d\n", Cmd_Argv(0), Q_atoi(arg));
		return;
	} else if (slot < 0 || slot >= MAX_CLIENTS) {	//PLAYER_NUM_MISMATCH covered by this
		Com_Printf("%s : no such player\n", Cmd_Argv(0));
		return;
	}

	if (cl.players[slot].spectator) {
		Com_Printf("You cannot track a spectator\n");
	} else if (Cam_TrackNum() != slot) {
		autocam = CAM_TRACK;
		Cam_Lock(slot);
		ideal_track = slot;
		locked = true;
	}
}
Ejemplo n.º 15
0
void MVD_ParseUserCommand (const char* s)
{
	float time;
	int command;
	int i;
	int plr;

	if (Cam_TrackNum() == -1) {
		return;
	}

	Cmd_TokenizeString( (char*)s );

	if (Cmd_Argc () < 2) {
		return;
	}

	time = atof( Cmd_Argv( 0 ) );
	command = atoi( Cmd_Argv( 1 ) );
	plr = Cmd_Argc() >= 3 ? atoi( Cmd_Argv( 2 ) ) : 0;

	if (plr != 0 && spec_track != plr - 1) {
		return;
	}

	if (! cl.mvd_time_offset) {
		cl.mvd_time_offset = time - cls.demotime;
	}

	MVD_FlushUserCommands ();
	for (i = 0; i < sizeof (cl.mvd_user_cmd) / sizeof (cl.mvd_user_cmd[0]); ++i) {
		if (cl.mvd_user_cmd_time[i] == 0) {
			cl.mvd_user_cmd_time[i] = time;
			cl.mvd_user_cmd[i] = command;
			break;
		}
	}
}
Ejemplo n.º 16
0
void VX_TrackerOddTeamkilled(int player, int weapon)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
	{
		if (cl_useimagesinfraglog.integer)
		{
			snprintf(outstring, sizeof(outstring), "&c%s%s&r %s &c%s%s&r", TKColor(player), amf_tracker_string_teammate.string, GetWeaponName(weapon), TKColor(player), VX_Name(player));
			Q_normalizetext(outstring);
		}
		else
		{
			snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r %s", amf_tracker_string_teammate.string, TKColor(player), GetWeaponName(weapon), VX_Name(player));
		}
	}
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
	{
		snprintf(outstring, sizeof(outstring), "&c380Teammate &c900killed you&r");
	}

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 17
0
void VX_TrackerSuicide(int player, int weapon, int count)
{
	char outstring[MAX_TRACKER_MSG_LEN]="";

	if (amf_tracker_frags.value == 2)
	{
		if (cl_useimagesinfraglog.integer)
		{
			snprintf(outstring, sizeof(outstring), "&c%s%s&r %s&c%s%s&r", SuiColor(player), VX_Name(player), GetWeaponName(weapon), SuiColor(player), amf_tracker_string_suicides.string);
			Q_normalizetext(outstring);
		}
		else
		{
			snprintf(outstring, sizeof(outstring), "&r%s &c%s%s&r%s", VX_Name(player), SuiColor(player), GetWeaponName(weapon), amf_tracker_string_suicides.string);
		}
	}
	else if (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator))
	{
		snprintf(outstring, sizeof(outstring), "&c960You killed yourself&r\n%s suicides: %i", GetWeaponName(weapon), count);
	}

	VX_TrackerAddText(outstring, tt_death);
}
Ejemplo n.º 18
0
void IN_JumpDown(void)
{
	qbool up;
	int pmt;

	if (cls.state != ca_active || !cl_smartjump.value)
		up = false;
	else if (cls.demoplayback && !cls.mvdplayback)
		up = false; // use jump instead of up in demos unless its MVD and I have no idea why QWD have this restriction.
	else if (cl.spectator)
		up = (Cam_TrackNum() == -1); // NOTE: cl.spectator is non false during MVD playback, so this code executed.
	else if (cl.stats[STAT_HEALTH] <= 0)
		up = false;
	else if (cl.validsequence && (
	((pmt = cl.frames[cl.validsequence & UPDATE_MASK].playerstate[cl.playernum].pm_type) == PM_FLY)
	|| pmt == PM_SPECTATOR || pmt == PM_OLD_SPECTATOR))
		up = true;
	else if (cl.waterlevel >= 2 && !(cl.teamfortress && (in_forward.state & 1)))
		up = true;
	else
		up = false;

	KeyDown(up ? &in_up : &in_jump);
}
Ejemplo n.º 19
0
//
// Change what player we are tracking.
//
// trackview:
// - Should be < 0 if we're in normal mode.
// - Between 0-3 if we're in multiview.
//
void CL_Track (int trackview)
{
	int slot;
	char *arg;

	if (cls.state < ca_connected) 
	{
		Com_Printf("You must be connected to track\n", Cmd_Argv(0));
		return;
	}

	if (!cl.spectator) 
	{
		Com_Printf("You can only track in spectator mode\n", Cmd_Argv(0));
		return;
	}

	// Don't go outside of the mv_trackslots array bounds.
	trackview = min(trackview, 3);

	// Allow resetting to default tracking for multiview.
	if (trackview >= 0 && !strcmp(Cmd_Args(), "off")) 
	{
		Com_Printf("Track %d resetting to default\n", trackview);
		mv_trackslots[trackview] = -1;
		return;
	}

	if (Cmd_Argc() != 2) 
	{
		if (trackview < 0)
		{
			// Normal track.
			Com_Printf("Usage: %s <name | userid>\n", Cmd_Argv(0));
		}
		else
		{
			// Multiview track.
			Com_Printf("Usage: %s <name | userid | off>\n", Cmd_Argv(0));
		}
		return;
	}

	slot = Player_GetSlot(arg = Cmd_Argv(1));

	//
	// The specified player wasn't found.
	//
	if (slot == PLAYER_NAME_NOMATCH) 
	{
		Com_Printf("%s : no such player %s\n", Cmd_Argv(0), arg);
		return;
	} 
	else if (slot == PLAYER_ID_NOMATCH) 
	{
		Com_Printf("%s : no player with userid %d\n", Cmd_Argv(0), Q_atoi(arg));
		return;
	} 
	else if (slot < 0 || slot >= MAX_CLIENTS) 
	{	
		// PLAYER_NUM_MISMATCH covered by this
		Com_Printf("%s : no such player\n", Cmd_Argv(0));
		return;
	}

	// A player has been found that we want to track.
	if (cl.players[slot].spectator) 
	{
		Com_Printf("You cannot track a spectator\n", Cmd_Argv(0));
	} 
	else if (Cam_TrackNum() != slot || trackview >= 0) 
	{
		// If we're not already tracking the found slot
		// set the camera to track mode and lock it to the selected slot.
		// (Locked as in "not free flying", not "cannot change tracked player")
		autocam = CAM_TRACK;
		Cam_Lock(slot);
		ideal_track = slot;
		
		// Multiview tracking:
		// Set the specified track view to track the specified player.
		if(trackview >= 0)
		{
			mv_trackslots[trackview] = slot;
		}

		locked = true;

		if (cls.mvdplayback && cl.teamfortress)
		{
			V_TF_ClearGrenadeEffects();
		}
	}
}
Ejemplo n.º 20
0
// is this player you, or you track him in case of spec
static qbool its_you(int player)
{
	return (cl.playernum == player || (player == Cam_TrackNum() && cl.spectator));
}