diff_coreshot_chesthitbox.diff

diff - mikeeusa3, 01/01/2012 05:06 pm

Download (2.47 KB)

View differences:

qcsrc/server/g_damage.qc
48 48
float damage_gooddamage;
49 49
float headshot;
50 50
float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after use
51
float coreshot;
52
float damage_coreshotbonus; // bonus multiplier for head shots, set to 0 after use
53

  
51 54

  
52 55
.float dmg_team;
53 56
.float teamkill_complain;
......
93 96
	return '0.5 0 0' * PL_HEAD_x + '0 0.5 0' * PL_HEAD_y + '0 0 1' * targ.maxs_z;
94 97
}
95 98

  
99
vector GetCoreshotMins(entity targ)
100
{
101
	return '-0.5 0 0' * PL_CORE_x + '0 -0.5 0' * PL_CORE_y + '0 0 1' * (targ.maxs_z - PL_HEAD_z - autocvar_sv_player_necklength - PL_CORE_z); //(Minus 5 for neck?)
102
}
103
vector GetCoreshotMaxs(entity targ)
104
{
105
	return '0.5 0 0' * PL_CORE_x + '0 0.5 0' * PL_CORE_y + '0 0 1' * (targ.maxs_z - PL_HEAD_z - autocvar_sv_player_necklength);
106
}
107

  
96 108
void UpdateFrags(entity player, float f)
97 109
{
98 110
	PlayerTeamScore_AddScore(player, f);
......
796 808
		if(targ.takedamage == DAMAGE_AIM)
797 809
		if(targ != attacker)
798 810
		{
811
			//Start Adding coreshot (Heart, vitals, etc)
812
			if(damage_coreshotbonus > 0)
813
			{
814
				if(targ.classname == "player")
815
				{
816
					// CORE SHOT:
817
					// find height of hit on player axis
818
					// if above view_ofs and below maxs, and also in the middle half of the bbox, it is core shot
819
					vector coremins, coremaxs, org;
820
					org = antilag_takebackorigin(targ, time - ANTILAG_LATENCY(attacker));
821
					coremins = org + GetCoreshotMins(targ);
822
					coremaxs = org + GetCoreshotMaxs(targ);
823
					if(trace_hits_box(railgun_start, railgun_end, coremins, coremaxs))
824
					{
825
						deathtype |= HITTYPE_CORESHOT;
826
					}
827
				}
828
				
829
				if(deathtype & HITTYPE_CORESHOT)
830
					damage *= 1 + damage_coreshotbonus;
831
			}
832
			//End Adding coreshot (Heart, vitals, etc). Headshot is more important //so will override deathmessage hopefully
833
			
799 834
			if(damage_headshotbonus > 0)
800 835
			{
801 836
				if(targ.classname == "player")
......
856 891

  
857 892
							if(deathtype & HITTYPE_HEADSHOT)
858 893
								headshot = 1;
894
								
895
							if(deathtype & HITTYPE_CORESHOT)
896
								coreshot = 1;
859 897
						}
860 898
						if(g_ca)
861 899
							PlayerScore_Add(attacker, SP_SCORE, damage * autocvar_g_ca_damage2score_multiplier);