+.entity accuracy;
+.float accuracy_frags[WEP_MAXCOUNT];
+
float weaponstats_buffer;
void WeaponStats_Init()
if(sound_allowed(MSG_BROADCAST, attacker))
{
if (save > 10)
- sound (self, CHAN_PROJECTILE, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM);
else if (take > 30)
- sound (self, CHAN_PROJECTILE, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM);
else if (take > 10)
- sound (self, CHAN_PROJECTILE, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM);
}
if (take > 50)
float valid_damage_for_weaponstats;
float excess;
- if((g_arena && numspawned < 2) || (g_ca && ca_players < required_ca_players) && !inWarmupStage)
+ if((g_arena && numspawned < 2) || (g_ca && !ca_teams_ok) && !inWarmupStage)
return;
dh = max(self.health, 0);
if(sound_allowed(MSG_BROADCAST, attacker))
{
if (save > 10)
- sound (self, CHAN_PROJECTILE, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM);
else if (take > 30)
- sound (self, CHAN_PROJECTILE, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM);
else if (take > 10)
- sound (self, CHAN_PROJECTILE, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); // FIXME possibly remove them?
+ sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); // FIXME possibly remove them?
}
if (take > 50)
// exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
{
if(deathtype == DEATH_FALL)
- PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
else if(self.health > 75) // TODO make a "gentle" version?
- PlayerSound(playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
else if(self.health > 50)
- PlayerSound(playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
else if(self.health > 25)
- PlayerSound(playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND);
else
- PlayerSound(playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND);
}
}
// escape a lava pit or similar
//self.pushltime = 0;
}
- else if(attacker.classname == "player" || attacker.classname == "gib")
+ else if(attacker.classname == "player")
{
self.pusher = attacker;
self.pushltime = time + autocvar_g_maxpushtime;
awep = DEATH_WEAPONOF(deathtype);
valid_damage_for_weaponstats = 1;
}
-
+
if(valid_damage_for_weaponstats)
{
dh = dh - max(self.health, 0);
if(sound_allowed(MSG_BROADCAST, attacker))
{
if(deathtype == DEATH_DROWN)
- PlayerSound(playersound_drown, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND);
else
- PlayerSound(playersound_death, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND);
}
// get rid of kill indicator
{
// become fully visible
self.alpha = 1;
- // clear selected player display
- ClearSelectedPlayer();
// throw a weapon
SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);
}
race_PreDie();
DropAllRunes(self);
+ // increment frag counter for used weapon type
+ float w;
+ w = DEATH_WEAPONOF(deathtype);
+ if(WEP_VALID(w))
+ if(self.classname == "player")
+ if(self != attacker)
+ attacker.accuracy.(accuracy_frags[w-1]) += 1;
+
if(deathtype == DEATH_HURTTRIGGER && g_freezetag)
{
PutClientInServer();
frag_inflictor = inflictor;
frag_target = self;
MUTATOR_CALLHOOK(PlayerDies);
+ weapon_action(self.weapon, WR_PLAYERDEATH);
if(self.flagcarried)
{
- if(attacker.classname != "player" && attacker.classname != "gib")
+ if(attacker.classname != "player")
DropFlag(self.flagcarried, self, attacker); // penalty for flag loss by suicide
else if(attacker.team == self.team)
DropFlag(self.flagcarried, attacker, attacker); // penalty for flag loss by suicide/teamkill
}
}
-float UpdateSelectedPlayer_countvalue(float v)
-{
- return max(0, (v - 1.0) / 0.5);
-}
-
-// returns: -2 if no hit, otherwise cos of the angle
-// uses the global v_angle
-float UpdateSelectedPlayer_canSee(entity p, float mincosangle, float maxdist)
-{
- vector so, d;
- float c;
-
- if(p == self)
- return -2;
-
- if(p.deadflag)
- return -2;
-
- so = self.origin + self.view_ofs;
- d = p.origin - so;
-
- // misaimed?
- if(dist_point_line(d, '0 0 0', v_forward) > maxdist)
- return -2;
-
- // now find the cos of the angle...
- c = normalize(d) * v_forward;
-
- if(c <= mincosangle)
- return -2;
-
- // not visible in any way? forget it
- if(!checkpvs(so, p))
- return -2;
-
- traceline(so, p.origin, MOVE_NOMONSTERS, self);
- if(trace_fraction < 1)
- return -2;
-
- return c;
-}
-
-void ClearSelectedPlayer()
-{
- if(self.selected_player)
- {
- centerprint_expire(self, CENTERPRIO_POINT);
- self.selected_player = world;
- self.selected_player_display_needs_update = FALSE;
- }
-}
-
-void UpdateSelectedPlayer()
-{
- entity selected;
- float selected_score;
- selected = world;
- selected_score = 0.95; // 18 degrees
-
- if(!autocvar_sv_allow_shownames)
- return;
-
- if(clienttype(self) != CLIENTTYPE_REAL)
- return;
-
- if(self.cvar_cl_shownames == 0)
- return;
-
- if(self.cvar_cl_shownames == 1 && !teams_matter)
- return;
-
- makevectors(self.v_angle); // sets v_forward
-
- // 1. cursor trace is always right
- WarpZone_crosshair_trace(self);
- if(trace_ent && trace_ent.classname == "player" && !trace_ent.deadflag)
- {
- selected = trace_ent;
- }
- else
- {
- // 2. if we don't have a cursor trace, find the player which is least
- // mis-aimed at
- entity p;
- FOR_EACH_PLAYER(p)
- {
- float c;
- c = UpdateSelectedPlayer_canSee(p, selected_score, 100); // 100 = 2.5 meters
- if(c >= -1)
- {
- selected = p;
- selected_score = c;
- }
- }
- }
-
- if(selected)
- {
- self.selected_player_display_timeout = time + self.cvar_scr_centertime;
- }
- else
- {
- if(time < self.selected_player_display_timeout)
- if(UpdateSelectedPlayer_canSee(self.selected_player, 0.7, 200) >= -1) // 5 meters, 45 degrees
- selected = self.selected_player;
- }
-
- if(selected)
- {
- if(selected == self.selected_player)
- {
- float save;
- save = UpdateSelectedPlayer_countvalue(self.selected_player_count);
- self.selected_player_count = self.selected_player_count + frametime;
- if(save != UpdateSelectedPlayer_countvalue(self.selected_player_count))
- {
- string namestr, healthstr;
- namestr = playername(selected);
- if(teams_matter)
- {
- healthstr = ftos(floor(selected.health));
- if(self.team == selected.team)
- {
- namestr = strcat(namestr, " (", healthstr, "%)");
- self.selected_player_display_needs_update = TRUE;
- }
- }
- centerprint_atprio(self, CENTERPRIO_POINT, namestr);
- }
- }
- else
- {
- ClearSelectedPlayer();
- self.selected_player = selected;
- self.selected_player_time = time;
- self.selected_player_count = 0;
- self.selected_player_display_needs_update = FALSE;
- }
- }
- else
- {
- ClearSelectedPlayer();
- }
-
- if(self.selected_player)
- self.last_selected_player = self.selected_player;
-}
-
.float muted; // to be used by prvm_edictset server playernumber muted 1
float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol)
// message "": do not say, just test flood control
if(source.classname != "player")
colorstr = "^0"; // black for spectators
- else if(teams_matter)
+ else if(teamplay)
colorstr = Team_ColorCode(source.team);
else
teamsay = FALSE;
self.skinindex_for_playersound = self.skinindex;
ClearPlayerSounds();
LoadPlayerSounds("sound/player/default.sounds", 1);
- if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skinindex, "sounds"), 0))
- LoadPlayerSounds(get_model_datafilename(self.model, 0, "sounds"), 0);
+ if(!autocvar_g_debug_defaultsounds)
+ if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skinindex, "sounds"), 0))
+ LoadPlayerSounds(get_model_datafilename(self.model, 0, "sounds"), 0);
}
void FakeGlobalSound(string sample, float chan, float voicetype)
break;
case VOICETYPE_TEAMRADIO:
FOR_EACH_REALCLIENT(msg_entity)
- if(!teams_matter || msg_entity.team == self.team)
+ if(!teamplay || msg_entity.team == self.team)
{
if(msg_entity.cvar_cl_voice_directional == 1)
soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);
flood = Say(self, ownteam, world, msg, 1);
if (flood > 0)
- GlobalSound(self.sample, CHAN_VOICE, voicetype);
+ GlobalSound(self.sample, CH_VOICE, voicetype);
else if (flood < 0)
- FakeGlobalSound(self.sample, CHAN_VOICE, voicetype);
+ FakeGlobalSound(self.sample, CH_VOICE, voicetype);
}
void MoveToTeam(entity client, float team_colour, float type, float show_message)