]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/divVerent/ballistic2'
authorRudolf Polzer <divverent@xonotic.org>
Wed, 1 Jan 2014 10:14:00 +0000 (11:14 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 1 Jan 2014 10:14:00 +0000 (11:14 +0100)
* origin/divVerent/ballistic2:
  Oops. Fix rifle config.
  We DO need to detect double-hits, due to the weird engine tracing that happens sometimes at low angles.
  Always show DamageInfo, even when hitting the same player twice.
  Fix use of "self".
  fix some bugs
  Kill some cvars I forgot.
  cvar cleanup
  Kill zcurveparticles due to 0 users.
  Simplify a LOT.
  work on restructuring fireBallisticBullet

23 files changed:
balance25.cfg
balanceFruitieX.cfg
balanceXDF.cfg
balanceXPM.cfg
balanceXonotic.cfg
defaultXonotic.cfg
mutator_new_toys.cfg
qcsrc/client/Main.qc
qcsrc/client/particles.qc
qcsrc/common/constants.qh
qcsrc/server/autocvars.qh
qcsrc/server/command/radarmap.qc
qcsrc/server/defs.qh
qcsrc/server/g_subs.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/tturrets/units/unit_machinegun.qc
qcsrc/server/tturrets/units/unit_walker.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/w_common.qc
qcsrc/server/w_rifle.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_uzi.qc
vehicle_spiderbot.cfg

index 9451d377d99757107948b7e805e8b63c2eeacfdc..f0cc7d73b40baa7681349b3f7943015408f09ef0 100644 (file)
@@ -271,8 +271,7 @@ set g_balance_shotgun_primary_spread 0.07
 set g_balance_shotgun_primary_refire 0.5
 set g_balance_shotgun_primary_animtime 0.2
 set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 12000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
 set g_balance_shotgun_secondary 1
 set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
 set g_balance_shotgun_secondary_melee_range 120
@@ -320,8 +319,7 @@ set g_balance_uzi_sustained_spread 0.05
 set g_balance_uzi_sustained_refire 0.1
 set g_balance_uzi_sustained_ammo 1
 
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
 
 set g_balance_uzi_switchdelay_drop 0.15
 set g_balance_uzi_switchdelay_raise 0.15
index f985659f9c6549ea4c337004c5804e9d7d83e38b..948d7e4b9eb6de3124259bdd18a4134d3a00c6d6 100644 (file)
@@ -271,8 +271,7 @@ set g_balance_shotgun_primary_spread 0.16 // LOG: changed from 0.18 -> 0.16 to c
 set g_balance_shotgun_primary_refire 1
 set g_balance_shotgun_primary_animtime 0.3
 set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 12000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
 set g_balance_shotgun_secondary 1
 set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
 set g_balance_shotgun_secondary_melee_range 120
@@ -320,8 +319,7 @@ set g_balance_uzi_sustained_spread 0.06
 set g_balance_uzi_sustained_refire 0.1
 set g_balance_uzi_sustained_ammo 1
 
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
 
 set g_balance_uzi_switchdelay_drop 0.15
 set g_balance_uzi_switchdelay_raise 0.15
index 4e0631523882e1ae1a045afef1598862eeba5ad2..b7d3e02656caf0f73c842e6d1d955aace507d0ce 100644 (file)
@@ -271,8 +271,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_primary_refire 0.75
 set g_balance_shotgun_primary_animtime 0.2
 set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 8000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
 set g_balance_shotgun_secondary 1
 set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
 set g_balance_shotgun_secondary_melee_range 120
@@ -320,8 +319,7 @@ set g_balance_uzi_sustained_spread 0
 set g_balance_uzi_sustained_refire 0.1
 set g_balance_uzi_sustained_ammo 1
 
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
 
 set g_balance_uzi_switchdelay_drop 0
 set g_balance_uzi_switchdelay_raise 0
index 8c171476a1e126114ea1df373d399fe125741c21..843e16a8357fbeae5fbb5a170919cd4e2f154f0c 100644 (file)
@@ -271,8 +271,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_primary_refire 0.75
 set g_balance_shotgun_primary_animtime 0.2
 set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 8000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
 set g_balance_shotgun_secondary 1
 set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
 set g_balance_shotgun_secondary_melee_range 120
@@ -320,8 +319,7 @@ set g_balance_uzi_sustained_spread 0.03
 set g_balance_uzi_sustained_refire 0.1
 set g_balance_uzi_sustained_ammo 1
 
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
 
 set g_balance_uzi_switchdelay_drop 0.2
 set g_balance_uzi_switchdelay_raise 0.2
index cdf3f201354aaebeb4351ee1d83f4af9f6d44490..de865fa68087ba37804aeaa36aac0b3f0091d80a 100644 (file)
@@ -271,8 +271,7 @@ set g_balance_shotgun_primary_spread 0.12
 set g_balance_shotgun_primary_refire 0.75
 set g_balance_shotgun_primary_animtime 0.2
 set g_balance_shotgun_primary_ammo 1
-set g_balance_shotgun_primary_speed 8000
-set g_balance_shotgun_primary_bulletconstant 75 // 3.8qu
+set g_balance_shotgun_primary_solidpenetration 3.8
 set g_balance_shotgun_secondary 1
 set g_balance_shotgun_secondary_melee_delay 0.25 // 0.35 was too slow
 set g_balance_shotgun_secondary_melee_range 120
@@ -320,8 +319,7 @@ set g_balance_uzi_sustained_spread 0.03
 set g_balance_uzi_sustained_refire 0.1
 set g_balance_uzi_sustained_ammo 1
 
-set g_balance_uzi_speed 18000
-set g_balance_uzi_bulletconstant 115 // 13.1qu
+set g_balance_uzi_solidpenetration 13.1
 
 set g_balance_uzi_switchdelay_drop 0.2
 set g_balance_uzi_switchdelay_raise 0.2
index 25e2a284be05289cf34171f86f950f4ee90ae66e..6f2eb2b14910e0eaa5359f8aaf94f8eb138bd43f 100644 (file)
@@ -1193,32 +1193,9 @@ set g_showweaponspawns 1 "display sprites for weapon spawns found on the map whe
 //   Quake-Joule:  1 qJ  = 1 qN * 1 qu
 //   Quake-Pascal: 1 qPa = 1 qN / 1 qu^2
 
-set g_ballistics_materialconstant 1414213562
-set g_ballistics_mindistance 16
+set g_ballistics_mindistance 2 // enable ballistics starting from 2 qu
 set g_ballistics_density_player 0.50 // players are 2x as easy to pass as walls
 set g_ballistics_density_corpse 0.10 // corpses are 10x as easy to pass as walls
-// unit: qJ / qu^3 (energy needed per volume unit of solid to push/burn away
-// parameter: bullet constant: mass / area in g/qu^2
-// = mass / (pi/4 * caliber^2)
-// with caliber in inches, mass in grams:
-// = 1.273239544735163 * mass / caliber^2
-// with caliber in inches, mass in grains:
-// = 0.082633246453312 * mass / caliber^2
-
-// bullet max travel distance inside solid:
-//   0.5 * v^2 * bulletconstant / g_ballistics_materialconstant
-
-// some bullet constants:
-//   http://hypertextbook.com/facts/2000/ShantayArmstrong.shtml
-//     second bullet: caliber .45, mass 16.2g, bullet constant 101.859163578813
-//     third bullet: caliber .338, mass 16.2g, bullet constant 180.5476053421592
-//     fourth bullet: caliber .25, mass 2.3g, bullet constant 46.85521524625399
-//   http://en.wikipedia.org/wiki/.50_BMG
-//     caliber .5, 360 grains, bullet constant 118.9918748927693
-//   AK-47:
-//     caliber .3, 62 grains, bullet constant 56.92512533450383
-//   .3 winchester magnum:
-//     caliber .3, 150 grains, bullet constant 137.7220774221867
 
 set cl_stripcolorcodes 0       "experimental feature (notes: strips ALL color codes from messages!)"
 
index 327cdd1a2aa2029548b651bc4daf28548bf6fe7c..9835f41ddbcf157823668587d557f82359cdeb23 100644 (file)
@@ -84,12 +84,10 @@ set g_balance_rifle_primary_shots 1
 set g_balance_rifle_primary_damage 80
 set g_balance_rifle_primary_spread 0
 set g_balance_rifle_primary_force 100
-set g_balance_rifle_primary_speed 40000
-set g_balance_rifle_primary_lifetime 5
 set g_balance_rifle_primary_refire 1.2
 set g_balance_rifle_primary_animtime 0.4
 set g_balance_rifle_primary_ammo 10
-set g_balance_rifle_primary_bulletconstant 110 // 62.2qu
+set g_balance_rifle_primary_solidpenetration 62.2
 set g_balance_rifle_primary_burstcost 0
 set g_balance_rifle_primary_bullethail 0 // empty magazine on shot
 set g_balance_rifle_secondary 1
@@ -99,12 +97,10 @@ set g_balance_rifle_secondary_shots 4
 set g_balance_rifle_secondary_damage 20
 set g_balance_rifle_secondary_spread 0.04
 set g_balance_rifle_secondary_force 50
-set g_balance_rifle_secondary_speed 20000
-set g_balance_rifle_secondary_lifetime 5
 set g_balance_rifle_secondary_refire 0.9
 set g_balance_rifle_secondary_animtime 0.3
 set g_balance_rifle_secondary_ammo 10
-set g_balance_rifle_secondary_bulletconstant 110 // 15.5qu
+set g_balance_rifle_secondary_solidpenetration 15.5
 set g_balance_rifle_secondary_burstcost 0
 set g_balance_rifle_secondary_bullethail 0 // empty magazine on shot
 set g_balance_rifle_switchdelay_drop 0.2
index 23e8203f488ff1c9d155a8ce4407fb158d985ccb..3206e923c37bd2a1d284bb337db11420905cbac8 100644 (file)
@@ -1218,10 +1218,6 @@ float CSQC_Parse_TempEntity()
                        Net_ReadRace();
                        bHandled = true;
                        break;
-               case TE_CSQC_ZCURVEPARTICLES:
-                       Net_ReadZCurveParticles();
-                       bHandled = true;
-                       break;
                case TE_CSQC_NEXGUNBEAMPARTICLE:
                        Net_ReadNexgunBeamParticle();
                        bHandled = true;
index ce8b6dd7f9ecbe612a0aeb52d87650633d6228e7..8751cc0c5535c107d2e4de8b43d2f033c232e408 100644 (file)
@@ -225,64 +225,6 @@ void Ent_RainOrSnow()
                self.draw = Draw_Snow;
 }
 
-entity zcurve;
-void zcurveparticles(float effectnum, vector start, vector end, float end_dz, float speed, float depth)
-{
-       // end_dz:
-       //   IF IT WERE A STRAIGHT LINE, it'd end end_dz above end
-
-       vector mid;
-       mid = (start + end) * 0.5;
-
-       end_dz *= 0.25;
-       mid_z += end_dz;
-
-       --depth;
-       if(depth < 0 || normalize(mid - start) * normalize(end - start) > 0.999999)
-       // TODO make this a variable threshold
-       // currently: 0.081 degrees
-       // 0.99999 would be 0.256 degrees and is visible
-       {
-               zcurve.velocity = speed * normalize(end - start);
-               trailparticles(zcurve, effectnum, start, end);
-       }
-       else
-       {
-               zcurveparticles(effectnum, start, mid, end_dz, speed, depth);
-               zcurveparticles(effectnum, mid, end, end_dz, speed, depth);
-       }
-}
-
-void Net_ReadZCurveParticles()
-{
-       vector start, end;
-       float end_dz;
-       float effectnum, speed;
-
-       if(!zcurve)
-       {
-               zcurve = spawn();
-               zcurve.classname = "zcurve";
-       }
-
-       effectnum = ReadShort();
-
-       start_x = ReadCoord();
-       start_y = ReadCoord();
-       start_z = ReadCoord();
-
-       do
-       {
-               end_x = ReadCoord();
-               end_y = ReadCoord();
-               end_z = ReadCoord();
-               end_dz = ReadCoord();
-               speed = ReadShort();
-               zcurveparticles(effectnum, start, end, end_dz, 16 * (speed & 0x7FFF), 5); // at most 32 segments
-       }
-       while(!(speed & 0x8000));
-}
-
 void Net_ReadNexgunBeamParticle()
 {
        vector shotorg, endpos;
index 55d16953f6a04d4a5e4f9bc8c289b5981654704e..8ae465e54dab91f32187850029b5ffdd0fde0797 100644 (file)
@@ -30,7 +30,6 @@ const float AS_FLOAT = 8;
 
 const float TE_CSQC_PICTURE = 100;
 const float TE_CSQC_RACE = 101;
-const float TE_CSQC_ZCURVEPARTICLES = 102;
 const float TE_CSQC_NEXGUNBEAMPARTICLE = 103;
 const float TE_CSQC_LIGHTNINGARC = 104;
 const float TE_CSQC_TEAMNAGGER = 105;
index 19187a39deeab1c16cab1a8b05834d997dcb35d0..ada0d4bda9b5eb23619f9d45841839ebafb7fe5b 100644 (file)
@@ -83,30 +83,26 @@ float autocvar_g_balance_armor_start;
 float autocvar_g_balance_rifle_bursttime;
 float autocvar_g_balance_rifle_primary_ammo;
 float autocvar_g_balance_rifle_primary_animtime;
-float autocvar_g_balance_rifle_primary_bulletconstant;
 float autocvar_g_balance_rifle_primary_bullethail;
 float autocvar_g_balance_rifle_primary_burstcost;
 float autocvar_g_balance_rifle_primary_damage;
 float autocvar_g_balance_rifle_primary_force;
-float autocvar_g_balance_rifle_primary_lifetime;
 float autocvar_g_balance_rifle_primary_refire;
 float autocvar_g_balance_rifle_primary_shots;
-float autocvar_g_balance_rifle_primary_speed;
+float autocvar_g_balance_rifle_primary_solidpenetration;
 float autocvar_g_balance_rifle_primary_spread;
 float autocvar_g_balance_rifle_primary_tracer;
 float autocvar_g_balance_rifle_secondary;
 float autocvar_g_balance_rifle_secondary_ammo;
 float autocvar_g_balance_rifle_secondary_animtime;
-float autocvar_g_balance_rifle_secondary_bulletconstant;
 float autocvar_g_balance_rifle_secondary_bullethail;
 float autocvar_g_balance_rifle_secondary_burstcost;
 float autocvar_g_balance_rifle_secondary_damage;
 float autocvar_g_balance_rifle_secondary_force;
-float autocvar_g_balance_rifle_secondary_lifetime;
 float autocvar_g_balance_rifle_secondary_reload;
 float autocvar_g_balance_rifle_secondary_refire;
 float autocvar_g_balance_rifle_secondary_shots;
-float autocvar_g_balance_rifle_secondary_speed;
+float autocvar_g_balance_rifle_secondary_solidpenetration;
 float autocvar_g_balance_rifle_secondary_spread;
 float autocvar_g_balance_rifle_secondary_tracer;
 float autocvar_g_balance_rifle_reload_ammo;
@@ -621,12 +617,11 @@ float autocvar_g_balance_seeker_reload_time;
 float autocvar_g_balance_selfdamagepercent;
 float autocvar_g_balance_shotgun_primary_ammo;
 float autocvar_g_balance_shotgun_primary_animtime;
-float autocvar_g_balance_shotgun_primary_bulletconstant;
 float autocvar_g_balance_shotgun_primary_bullets;
 float autocvar_g_balance_shotgun_primary_damage;
 float autocvar_g_balance_shotgun_primary_force;
 float autocvar_g_balance_shotgun_primary_refire;
-float autocvar_g_balance_shotgun_primary_speed;
+float autocvar_g_balance_shotgun_primary_solidpenetration;
 float autocvar_g_balance_shotgun_primary_spread;
 float autocvar_g_balance_shotgun_secondary;
 float autocvar_g_balance_shotgun_secondary_animtime;
@@ -654,7 +649,6 @@ float autocvar_g_balance_tuba_edgedamage;
 float autocvar_g_balance_tuba_force;
 float autocvar_g_balance_tuba_radius;
 float autocvar_g_balance_tuba_refire;
-float autocvar_g_balance_uzi_bulletconstant;
 float autocvar_g_balance_uzi_burst;
 float autocvar_g_balance_uzi_burst_ammo;
 float autocvar_g_balance_uzi_burst_animtime;
@@ -668,7 +662,7 @@ float autocvar_g_balance_uzi_first_force;
 float autocvar_g_balance_uzi_first_refire;
 float autocvar_g_balance_uzi_first_spread;
 float autocvar_g_balance_uzi_mode;
-float autocvar_g_balance_uzi_speed;
+float autocvar_g_balance_uzi_solidpenetration;
 float autocvar_g_balance_uzi_spread_add;
 float autocvar_g_balance_uzi_spread_max;
 float autocvar_g_balance_uzi_spread_min;
@@ -681,7 +675,6 @@ float autocvar_g_balance_uzi_reload_ammo;
 float autocvar_g_balance_uzi_reload_time;
 float autocvar_g_ballistics_density_corpse;
 float autocvar_g_ballistics_density_player;
-float autocvar_g_ballistics_materialconstant;
 float autocvar_g_ballistics_mindistance;
 float autocvar_g_ban_default_bantime;
 float autocvar_g_ban_default_masksize;
index 331f5f95f404484f5a79bffc624e4b8fbb434444..f2205b68d5a5a8c8b26706c94364df72de9233b8 100644 (file)
@@ -28,7 +28,7 @@ float FullTraceFraction(vector a, vector mi, vector ma, vector b)
                        c = trace_endpos;
                }
 
-               n += tracebox_inverted(c, mi, ma, b, MOVE_WORLDONLY, world, FALSE);
+               n += tracebox_inverted(c, mi, ma, b, MOVE_WORLDONLY, world, FALSE, world);
 
                white += vlen(trace_endpos - c);
                c = trace_endpos;
index 72f4457d61d9fe99dff84bc1c2e728b2dcacab62..536dee3ed1fb464479bd11620f38fea1e06103e7 100644 (file)
@@ -459,7 +459,6 @@ void W_Porto_Remove (entity p);
 
 .string message2;
 
-vector railgun_start, railgun_end; // filled by FireRailgunBullet, used by damage code for head shot
 .float stat_allow_oldnexbeam;
 
 // reset to 0 on weapon switch
index 834bb47116551b4a4e013d58189c78a37dc32838..3d6d2cfc218171ce5092947762fce13e69f488c2 100644 (file)
@@ -534,7 +534,7 @@ void WarpZone_tracebox_antilag (entity source, vector v1, vector mi, vector ma,
        tracebox_antilag_force_wz(source, v1, mi, ma, v2, nomonst, forent, lag, TRUE);
 }
 
-float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity) // returns the number of traces done, for benchmarking
+float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity) // returns the number of traces done, for benchmarking
 {
        vector pos, dir, t;
        float nudge;
@@ -552,7 +552,7 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
 
        for(;;)
        {
-               if((pos - v1) * dir >= (v2 - v1) * dir)
+               if(pos * dir >= v2 * dir)
                {
                        // went too far
                        trace_fraction = 1;
@@ -587,7 +587,7 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
                                pos = t + dir * nudge;
 
                                // but if we hit an entity, stop RIGHT before it
-                               if(stopatentity && stopentity)
+                               if(stopatentity && stopentity && stopentity != ignorestopatentity)
                                {
                                        trace_ent = stopentity;
                                        trace_endpos = t;
@@ -612,9 +612,9 @@ float tracebox_inverted (vector v1, vector mi, vector ma, vector v2, float nomon
        }
 }
 
-void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity)
+void traceline_inverted (vector v1, vector v2, float nomonsters, entity forent, float stopatentity, entity ignorestopatentity)
 {
-       tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity);
+       tracebox_inverted(v1, '0 0 0', '0 0 0', v2, nomonsters, forent, stopatentity, ignorestopatentity);
 }
 
 /*
index 722bc40d4539c42bfdccf6f4e56c3a2cbf030506..3f312a203a459622e9a38e958ee5f2f7e012ddc1 100644 (file)
@@ -2011,65 +2011,6 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
         return FALSE;
 }
 
-float zcurveparticles_effectno;
-vector zcurveparticles_start;
-float zcurveparticles_spd;
-
-void endzcurveparticles()
-{
-       if(zcurveparticles_effectno)
-       {
-               // terminator
-               WriteShort(MSG_BROADCAST, zcurveparticles_spd | 0x8000);
-       }
-       zcurveparticles_effectno = 0;
-}
-
-void zcurveparticles(float effectno, vector start, vector end, float end_dz, float spd)
-{
-       spd = bound(0, floor(spd / 16), 32767);
-       if(effectno != zcurveparticles_effectno || start != zcurveparticles_start)
-       {
-               endzcurveparticles();
-               WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
-               WriteByte(MSG_BROADCAST, TE_CSQC_ZCURVEPARTICLES);
-               WriteShort(MSG_BROADCAST, effectno);
-               WriteCoord(MSG_BROADCAST, start_x);
-               WriteCoord(MSG_BROADCAST, start_y);
-               WriteCoord(MSG_BROADCAST, start_z);
-               zcurveparticles_effectno = effectno;
-               zcurveparticles_start = start;
-       }
-       else
-               WriteShort(MSG_BROADCAST, zcurveparticles_spd);
-       WriteCoord(MSG_BROADCAST, end_x);
-       WriteCoord(MSG_BROADCAST, end_y);
-       WriteCoord(MSG_BROADCAST, end_z);
-       WriteCoord(MSG_BROADCAST, end_dz);
-       zcurveparticles_spd = spd;
-}
-
-void zcurveparticles_from_tracetoss(float effectno, vector start, vector end, vector vel)
-{
-       float end_dz;
-       vector vecxy, velxy;
-
-       vecxy = end - start;
-       vecxy_z = 0;
-       velxy = vel;
-       velxy_z = 0;
-
-       if (vlen(velxy) < 0.000001 * fabs(vel_z))
-       {
-               endzcurveparticles();
-               trailparticles(world, effectno, start, end);
-               return;
-       }
-
-       end_dz = vlen(vecxy) / vlen(velxy) * vel_z - (end_z - start_z);
-       zcurveparticles(effectno, start, end, end_dz, vlen(vel));
-}
-
 void write_recordmarker(entity pl, float tstart, float dt)
 {
     GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));
index 46c46d7f8f04068e7dba48f4b5f1e59320388385..eccc37f03f1ad1c8e56db6f2effde36f6b6aada4 100644 (file)
@@ -5,8 +5,7 @@ void turret_machinegun_attack();
 //.float bulletcounter;
 void turret_machinegun_attack()
 {
-    fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0, autocvar_g_balance_uzi_bulletconstant);
-    endFireBallisticBullet();
+    fireBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0);
 
     UziFlash();
     setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
index 1ce59dd278bfb4e3bc2c5d84a9584bde94b212b2..2eeb08b8fda73978203dbac137b578d5e96e3e58 100644 (file)
@@ -515,8 +515,7 @@ void walker_postthink()
 void walker_attack()
 {
     sound (self, CH_WEAPON_A, "weapons/uzi_fire.wav", VOL_BASE, ATTEN_NORM);
-    fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, self.shot_speed, 5, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0, autocvar_g_balance_uzi_bulletconstant);
-    endFireBallisticBullet();
+    fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
     pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
 }
 
index bdbcb828870829577254ea87fe569ad792acd51a..a73997fda5be350ca8469496fcd56033691ae9f7 100644 (file)
@@ -43,8 +43,7 @@ float autocvar_g_vehicle_spiderbot_minigun_ammo_max;
 float autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
 float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
 float autocvar_g_vehicle_spiderbot_minigun_force;
-float autocvar_g_vehicle_spiderbot_minigun_speed;
-float autocvar_g_vehicle_spiderbot_minigun_bulletconstant;
+float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
 
 float autocvar_g_vehicle_spiderbot_rocket_damage;
 float autocvar_g_vehicle_spiderbot_rocket_force;
@@ -495,12 +494,8 @@ float spiderbot_frame()
             v_forward = normalize(v_forward);
             v += v_forward * 50;
 
-//void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float bulletconstant)
-
-            fireBallisticBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_speed,
-                                5, autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0, autocvar_g_vehicle_spiderbot_minigun_bulletconstant);
-
-            endFireBallisticBullet();
+            fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+                                autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0);
 
 //            fireBullet (v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_damage,
 //                autocvar_g_vehicle_spiderbot_minigun_spread, DEATH_VH_SPID_MINIGUN, 0);
index 72cac7985797445909ff04409d554f63b01ea8ff..f51db6dd5dc48708f8c7477804fea7179b30d811 100644 (file)
@@ -35,9 +35,6 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
 
        pseudoprojectile = world;
 
-       railgun_start = start;
-       railgun_end = end;
-
        dir = normalize(end - start);
        length = vlen(end - start);
        force = dir * bforce;
@@ -165,328 +162,64 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        trace_dphitq3surfaceflags = endq3surfaceflags;
 }
 
-.float dmg_force;
-.float dmg_radius;
-.float dmg_total;
-//.float last_yoda;
-void W_BallisticBullet_Hit (void)
-{
-       float f, q, g;
-
-       f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
-       q = 1 + self.dmg_edge / self.dmg;
-
-       if(other.solid == SOLID_BSP || other.solid == SOLID_SLIDEBOX)
-               Damage_DamageInfo(self.origin, self.dmg * f, 0, 0, max(1, self.dmg_force) * normalize(self.velocity) * f, self.projectiledeathtype, other.species, self);
-
-       if(other && other != self.enemy)
-       {
-               endzcurveparticles();
-
-               yoda = 0;
-               railgun_start = self.origin - 2 * frametime * self.velocity;
-               railgun_end = self.origin + 2 * frametime * self.velocity;
-               g = accuracy_isgooddamage(self.realowner, other);
-               Damage(other, self, self.realowner, self.dmg * f, self.projectiledeathtype, self.origin, self.dmg_force * normalize(self.velocity) * f);
-
-               /*if(yoda && (time > (self.last_yoda + 5)))
-               {
-                       Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
-                       self.last_yoda = time;
-               }*/
-
-               // calculate hits for ballistic weapons
-               if(g)
-               {
-                       // do not exceed 100%
-                       q = min(self.dmg * q, self.dmg_total + f * self.dmg) - self.dmg_total;
-                       self.dmg_total += f * self.dmg;
-                       accuracy_add(self.realowner, self.realowner.weapon, 0, q);
-               }
-       }
-
-       self.enemy = other; // don't hit the same player twice with the same bullet
-}
-
-.void(void) W_BallisticBullet_LeaveSolid_think_save;
-.float W_BallisticBullet_LeaveSolid_nextthink_save;
-.vector W_BallisticBullet_LeaveSolid_origin;
-.vector W_BallisticBullet_LeaveSolid_velocity;
-
-void W_BallisticBullet_LeaveSolid_think()
+float fireBullet_trace_callback_eff;
+entity fireBullet_last_hit;
+void fireBullet_trace_callback(vector start, vector hit, vector end)
 {
-       setorigin(self, self.W_BallisticBullet_LeaveSolid_origin);
-       self.velocity = self.W_BallisticBullet_LeaveSolid_velocity;
-
-       self.think = self.W_BallisticBullet_LeaveSolid_think_save;
-       self.nextthink = max(time, self.W_BallisticBullet_LeaveSolid_nextthink_save);
-       self.W_BallisticBullet_LeaveSolid_think_save = func_null;
-
-       self.flags &= ~FL_ONGROUND;
-
-       if(self.enemy.solid == SOLID_BSP)
-       {
-               float f;
-               f = pow(bound(0, vlen(self.velocity) / vlen(self.oldvelocity), 1), 2); // energy multiplier
-               Damage_DamageInfo(self.origin, 0, 0, 0, max(1, self.dmg_force) * normalize(self.velocity) * -f, self.projectiledeathtype, 0, self);
-       }
-
-       UpdateCSQCProjectile(self);
-}
-
-float W_BallisticBullet_LeaveSolid(float eff)
-{
-       // move the entity along its velocity until it's out of solid, then let it resume
-       vector vel = self.velocity;
-       float dt, dst, velfactor, v0, vs;
-       float maxdist;
-       float E0_m, Es_m;
-       float constant = self.dmg_radius * (other.ballistics_density ? other.ballistics_density : 1);
-
-       // outside the world? forget it
-       if(self.origin_x > world.maxs_x || self.origin_y > world.maxs_y || self.origin_z > world.maxs_z || self.origin_x < world.mins_x || self.origin_y < world.mins_y || self.origin_z < world.mins_z)
-               return 0;
-
-       // special case for zero density and zero bullet constant:
-
-       if(self.dmg_radius == 0)
-       {
-               if(other.ballistics_density < 0)
-                       constant = 0; // infinite travel distance
-               else
-                       return 0; // no penetration
-       }
-       else
-       {
-               if(other.ballistics_density < 0)
-                       constant = 0; // infinite travel distance
-               else if(other.ballistics_density == 0)
-                       constant = self.dmg_radius;
-               else
-                       constant = self.dmg_radius * other.ballistics_density;
-       }
-
-       // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
-       v0 = vlen(vel);
-
-       E0_m = 0.5 * v0 * v0;
-
-       if(constant)
-       {
-               maxdist = E0_m / constant;
-               // maxdist = 0.5 * v0 * v0 / constant
-               // dprint("max dist = ", ftos(maxdist), "\n");
-
-               if(maxdist <= autocvar_g_ballistics_mindistance)
-                       return 0;
-       }
-       else
-       {
-               maxdist = vlen(other.maxs - other.mins) + 1; // any distance, as long as we leave the entity
-       }
-
-       traceline_inverted (self.origin, self.origin + normalize(vel) * maxdist, MOVE_NORMAL, self, TRUE);
-       if(trace_fraction == 1) // 1: we never got out of solid
-               return 0;
-
-       self.W_BallisticBullet_LeaveSolid_origin = trace_endpos;
-
-       dst = max(autocvar_g_ballistics_mindistance, vlen(trace_endpos - self.origin));
-       // E(s) = E0 - constant * s, constant = area of bullet circle * material constant / mass
-       Es_m = E0_m - constant * dst;
-       if(Es_m <= 0)
-       {
-               // roundoff errors got us
-               return 0;
-       }
-       vs = sqrt(2 * Es_m);
-       velfactor = vs / v0;
-
-       dt = dst / (0.5 * (v0 + vs));
-       // this is not correct, but the differential equations have no analytic
-       // solution - and these times are very small anyway
-       //print("dt = ", ftos(dt), "\n");
-
-       self.W_BallisticBullet_LeaveSolid_think_save = self.think;
-       self.W_BallisticBullet_LeaveSolid_nextthink_save = self.nextthink;
-       self.think = W_BallisticBullet_LeaveSolid_think;
-       self.nextthink = time + dt;
-
-       vel = vel * velfactor;
-
-       self.velocity = '0 0 0';
-       self.flags |= FL_ONGROUND; // prevent moving
-       self.W_BallisticBullet_LeaveSolid_velocity = vel;
-
-       if(eff >= 0)
-               if(vlen(trace_endpos - self.origin) > 4)
-               {
-                       endzcurveparticles();
-                       trailparticles(self, eff, self.origin, trace_endpos);
-               }
-
-       return 1;
-}
-
-void W_BallisticBullet_Touch (void)
-{
-       //float density;
-
-       if(self.think == W_BallisticBullet_LeaveSolid_think) // skip this!
-               return;
-
-       PROJECTILE_TOUCH;
-       W_BallisticBullet_Hit ();
-
-       if(self.dmg_radius < 0) // these NEVER penetrate solid
-       {
-               remove(self);
-               return;
-       }
-
-       // if we hit "weapclip", bail out
-       //
-       // rationale of this check:
-       //
-       // any shader that is solid, nodraw AND trans is meant to clip weapon
-       // shots and players, but has no other effect!
-       //
-       // if it is not trans, it is caulk and should not have this side effect
-       //
-       // matching shaders:
-       //   common/weapclip (intended)
-       //   common/noimpact (is supposed to eat projectiles, but is erased farther above)
-       if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
-       if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
-       if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
-       {
-               remove(self);
-               return;
-       }
-
-       // go through solid!
-       if(!W_BallisticBullet_LeaveSolid(-1))
-       {
-               remove(self);
-               return;
-       }
-
-       self.projectiledeathtype |= HITTYPE_BOUNCE;
-}
-
-void endFireBallisticBullet()
-{
-       endzcurveparticles();
-}
-
-entity fireBallisticBullet_trace_callback_ent;
-float fireBallisticBullet_trace_callback_eff;
-void fireBallisticBullet_trace_callback(vector start, vector hit, vector end)
-{
-       if(vlen(trace_endpos - fireBallisticBullet_trace_callback_ent.origin) > 16)
-               zcurveparticles_from_tracetoss(fireBallisticBullet_trace_callback_eff, fireBallisticBullet_trace_callback_ent.origin, trace_endpos, fireBallisticBullet_trace_callback_ent.velocity);
+       if(vlen(hit - start) > 16)
+               trailparticles(world, fireBullet_trace_callback_eff, start, hit);
        WarpZone_trace_forent = world;
-       self.owner = world;
+       fireBullet_last_hit = world;
 }
 
-void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float bulletconstant)
+void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, float tracereffects)
 {
-       float lag, dt, savetime; //, density;
-       entity pl, oldself;
-
-       entity proj;
-       proj = spawn();
-       proj.classname = "bullet";
-       proj.owner = proj.realowner = self;
-       PROJECTILE_MAKETRIGGER(proj);
-       proj.movetype = MOVETYPE_FLY;
-       proj.think = SUB_Remove;
-       proj.nextthink = time + lifetime; // min(pLifetime, vlen(world.maxs - world.mins) / pSpeed);
-       W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread, TRUE);
-       proj.angles = vectoangles(proj.velocity);
-       if(bulletconstant > 0)
-               proj.dmg_radius = autocvar_g_ballistics_materialconstant / bulletconstant;
-       else if(bulletconstant == 0)
-               proj.dmg_radius = 0;
-       else
-               proj.dmg_radius = -1;
-       // so: bulletconstant = bullet mass / area of bullet circle
-       setorigin(proj, start);
-       proj.flags = FL_PROJECTILE;
-
-       proj.touch = W_BallisticBullet_Touch;
-       proj.dmg = damage;
-       proj.dmg_force = force;
-       proj.projectiledeathtype = dtype;
-
-       proj.oldvelocity = proj.velocity;
+       // TODO antilag takeback
+       vector  end;
 
-       other = proj; MUTATOR_CALLHOOK(EditProjectile);
+       dir = normalize(dir + randomvec() * spread);
+       end = start + dir * MAX_SHOT_DISTANCE;
 
-       float eff;
+       entity pl;
+       fireBullet_last_hit = world;
+       float solid_penetration_left = 1;
+       float total_damage = 0;
 
        if(tracereffects & EF_RED)
-               eff = particleeffectnum("tr_rifle");
+               fireBullet_trace_callback_eff = particleeffectnum("tr_rifle");
        else if(tracereffects & EF_BLUE)
-               eff = particleeffectnum("tr_rifle_weak");
+               fireBullet_trace_callback_eff = particleeffectnum("tr_rifle_weak");
        else
-               eff = particleeffectnum("tr_bullet");
+               fireBullet_trace_callback_eff = particleeffectnum("tr_bullet");
 
-       // NOTE: this may severely throw off weapon balance
-       lag = ANTILAG_LATENCY(self);
+       float lag = ANTILAG_LATENCY(self);
        if(lag < 0.001)
                lag = 0;
        if (!IS_REAL_CLIENT(self))
                lag = 0;
        if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
                lag = 0; // only do hitscan, but no antilag
-
        if(lag)
                FOR_EACH_PLAYER(pl)
                        if(pl != self)
                                antilag_takeback(pl, time - lag);
 
-       oldself = self;
-       self = proj;
-
-       savetime = frametime;
-       frametime = 0.05;
+       WarpZone_trace_forent = self;
 
-       for(;;)
+       for (;;)
        {
-               // DP tracetoss is stupid and always traces in 0.05s
-               // ticks. This makes it trace in 0.05*0.125s ticks
-               // instead.
-               vector v0;
-               v0 = self.velocity;
-               self.velocity = self.velocity * 0.125;
-               trace_fraction = 0;
-               fireBallisticBullet_trace_callback_ent = self;
-               fireBallisticBullet_trace_callback_eff = eff;
-               WarpZone_TraceToss_ThroughZone(self, self.owner, world, fireBallisticBullet_trace_callback);
-               self.velocity = v0;
-
-               if(trace_fraction == 1)
+               // TODO also show effect while tracing
+               WarpZone_TraceBox_ThroughZone(start, '0 0 0', '0 0 0', end, FALSE, WarpZone_trace_forent, world, fireBullet_trace_callback);
+               dir = WarpZone_TransformVelocity(WarpZone_trace_transform, dir);
+               end = WarpZone_TransformOrigin(WarpZone_trace_transform, end);
+               start = trace_endpos;
+               entity hit = trace_ent;
+
+               // When hitting sky, stop.
+               if (pointcontents(start) == CONTENT_SKY)
                        break;
-                       // won't hit anything anytime soon (DP's
-                       // tracetoss does 200 tics of, here,
-                       // 0.05*0.125s, that is, 1.25 seconds
-
-               other = trace_ent;
-               dt = WarpZone_tracetoss_time * 0.125; // this is only approximate!
-               setorigin(self, trace_endpos);
-               self.velocity = WarpZone_tracetoss_velocity * (1 / 0.125);
-
-               if(!SUB_OwnerCheck())
-               {
-                       if(SUB_NoImpactCheck())
-                               break;
-
-                       // hit the player
-                       W_BallisticBullet_Hit();
-               }
 
-               if(proj.dmg_radius < 0) // these NEVER penetrate solid
+               if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
                        break;
 
                // if we hit "weapclip", bail out
@@ -500,54 +233,79 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                //
                // matching shaders:
                //   common/weapclip (intended)
-               //   common/noimpact (is supposed to eat projectiles, but is erased farther above)
+               //   common/noimpact (is supposed to eat projectiles, but is erased anyway)
+               float is_weapclip = 0;
                if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
                if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
                if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
-                       break;
+                       is_weapclip = 1;
 
-               // go through solid!
-               if(!W_BallisticBullet_LeaveSolid((other && (other.solid != SOLID_BSP)) ? eff : -1))
-                       break;
+               if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
+                       Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
 
-               W_BallisticBullet_LeaveSolid_think();
+               if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit)  // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
+               {
+                       fireBullet_last_hit = hit;
+                       yoda = 0;
+                       float g = accuracy_isgooddamage(self, hit);
+                       Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+                       // calculate hits for ballistic weapons
+                       if(g)
+                       {
+                               // do not exceed 100%
+                               float added_damage = min(damage - total_damage, damage * solid_penetration_left);
+                               total_damage += damage * solid_penetration_left;
+                               accuracy_add(self, self.weapon, 0, added_damage);
+                       }
+               }
 
-               self.projectiledeathtype |= HITTYPE_BOUNCE;
-       }
-       frametime = savetime;
-       self = oldself;
+               if (is_weapclip)
+                       break;
 
-       if(lag)
-               FOR_EACH_PLAYER(pl)
-                       if(pl != self)
-                               antilag_restore(pl);
+               // go through solid!
+               // outside the world? forget it
+               if(start_x > world.maxs_x || start_y > world.maxs_y || start_z > world.maxs_z || start_x < world.mins_x || start_y < world.mins_y || start_z < world.mins_z)
+                       break;
 
-       remove(proj);
+               float maxdist;
+               if(max_solid_penetration < 0)
+                       break;
+               else if(hit.ballistics_density < -1)
+                       break; // -2: no solid penetration, ever
+               else if(hit.ballistics_density < 0)
+                       maxdist = vlen(hit.maxs - hit.mins) + 1; // -1: infinite travel distance
+               else if(hit.ballistics_density == 0)
+                       maxdist = max_solid_penetration * solid_penetration_left;
+               else
+                       maxdist = max_solid_penetration * solid_penetration_left * hit.ballistics_density;
 
-       return;
-}
+               if(maxdist <= autocvar_g_ballistics_mindistance)
+                       break;
 
-void fireBullet (vector start, vector dir, float spread, float damage, float force, float dtype, float tracer)
-{
-       vector  end;
+               // move the entity along its velocity until it's out of solid, then let it resume
+               // The previously hit entity is ignored here!
+               traceline_inverted (start, start + dir * maxdist, MOVE_NORMAL, WarpZone_trace_forent, TRUE, hit);
+               if(trace_fraction == 1) // 1: we never got out of solid
+                       break;
 
-       dir = normalize(dir + randomvec() * spread);
-       end = start + dir * MAX_SHOT_DISTANCE;
-       if(self.antilag_debug)
-               traceline_antilag (self, start, end, FALSE, self, self.antilag_debug);
-       else
-               traceline_antilag (self, start, end, FALSE, self, ANTILAG_LATENCY(self));
+               float dist_taken = max(autocvar_g_ballistics_mindistance, vlen(trace_endpos - start));
+               solid_penetration_left *= (dist_taken / maxdist);
 
-       end = trace_endpos;
+               // Only show effect when going through a player (invisible otherwise)
+               if (hit && (hit.solid != SOLID_BSP))
+                       if(vlen(trace_endpos - start) > 4)
+                               trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
 
-       if (pointcontents (trace_endpos) != CONTENT_SKY)
-       {
-               if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
-                       Damage_DamageInfo(trace_endpos, damage, 0, 0, dir * max(1, force), dtype, trace_ent.species, self);
+               start = trace_endpos;
 
-               Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * force);
+               if(hit.solid == SOLID_BSP)
+                       Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
        }
-       trace_endpos = end;
+
+       if(lag)
+               FOR_EACH_PLAYER(pl)
+                       if(pl != self)
+                               antilag_restore(pl);
 }
 
 float W_CheckProjectileDamage(entity inflictor, entity projowner, float deathtype, float exception)
index 90db2ad75c4aa7007409257c5d320a883fb7d888..0e3a5c0b02efed14c2c0eac782edf1a8a532b04a 100644 (file)
@@ -15,7 +15,7 @@ REGISTER_WEAPON(
 
 .float rifle_accumulator;
 
-void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant, float pTracer, float pShots, string pSound)
+void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, float deathtype, float pTracer, float pShots, string pSound)
 {
        float i;
 
@@ -32,8 +32,7 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed
        }
 
        for(i = 0; i < pShots; ++i)
-               fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE), pBulletConstant);
-       endFireBallisticBullet();
+               fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
 
        if (autocvar_g_casings >= 2)
                SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
@@ -41,12 +40,12 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed
 
 void W_Rifle_Attack()
 {
-       W_Rifle_FireBullet(autocvar_g_balance_rifle_primary_spread, autocvar_g_balance_rifle_primary_damage, autocvar_g_balance_rifle_primary_force, autocvar_g_balance_rifle_primary_speed, autocvar_g_balance_rifle_primary_lifetime, autocvar_g_balance_rifle_primary_ammo, WEP_RIFLE, autocvar_g_balance_rifle_primary_bulletconstant, autocvar_g_balance_rifle_primary_tracer, autocvar_g_balance_rifle_primary_shots, "weapons/campingrifle_fire.wav");
+       W_Rifle_FireBullet(autocvar_g_balance_rifle_primary_spread, autocvar_g_balance_rifle_primary_damage, autocvar_g_balance_rifle_primary_force, autocvar_g_balance_rifle_primary_solidpenetration, autocvar_g_balance_rifle_primary_ammo, WEP_RIFLE, autocvar_g_balance_rifle_primary_tracer, autocvar_g_balance_rifle_primary_shots, "weapons/campingrifle_fire.wav");
 }
 
 void W_Rifle_Attack2()
 {
-       W_Rifle_FireBullet(autocvar_g_balance_rifle_secondary_spread, autocvar_g_balance_rifle_secondary_damage, autocvar_g_balance_rifle_secondary_force, autocvar_g_balance_rifle_secondary_speed, autocvar_g_balance_rifle_secondary_lifetime, autocvar_g_balance_rifle_secondary_ammo, WEP_RIFLE | HITTYPE_SECONDARY, autocvar_g_balance_rifle_secondary_bulletconstant, autocvar_g_balance_rifle_secondary_tracer, autocvar_g_balance_rifle_secondary_shots, "weapons/campingrifle_fire2.wav");
+       W_Rifle_FireBullet(autocvar_g_balance_rifle_secondary_spread, autocvar_g_balance_rifle_secondary_damage, autocvar_g_balance_rifle_secondary_force, autocvar_g_balance_rifle_secondary_solidpenetration, autocvar_g_balance_rifle_secondary_ammo, WEP_RIFLE | HITTYPE_SECONDARY, autocvar_g_balance_rifle_secondary_tracer, autocvar_g_balance_rifle_secondary_shots, "weapons/campingrifle_fire2.wav");
 }
 
 void spawnfunc_weapon_rifle (void)
@@ -126,7 +125,7 @@ float w_rifle(float req)
                        self.bot_secondary_riflemooth = 0;
                if(self.bot_secondary_riflemooth == 0)
                {
-                       if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, FALSE))
+                       if(bot_aim(1000000, 0, 0.001, FALSE))
                        {
                                self.BUTTON_ATCK = TRUE;
                                if(random() < 0.01) self.bot_secondary_riflemooth = 1;
@@ -134,7 +133,7 @@ float w_rifle(float req)
                }
                else
                {
-                       if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, FALSE))
+                       if(bot_aim(1000000, 0, 0.001, FALSE))
                        {
                                self.BUTTON_ATCK2 = TRUE;
                                if(random() < 0.03) self.bot_secondary_riflemooth = 0;
index 2fb6214017c0f1de374817fc596b44d9d3f66104..6ac38747526568f66579eefe6580d95ea1555e94 100644 (file)
@@ -21,8 +21,7 @@ void W_Shotgun_Attack (void)
        float   d;
        float   f;
        float   spread;
-       float   bulletspeed;
-       float   bulletconstant;
+       float   solidpenetration;
        entity flash;
 
        ammoamount = autocvar_g_balance_shotgun_primary_ammo;
@@ -30,15 +29,13 @@ void W_Shotgun_Attack (void)
        d = autocvar_g_balance_shotgun_primary_damage;
        f = autocvar_g_balance_shotgun_primary_force;
        spread = autocvar_g_balance_shotgun_primary_spread;
-       bulletspeed = autocvar_g_balance_shotgun_primary_speed;
-       bulletconstant = autocvar_g_balance_shotgun_primary_bulletconstant;
+       solidpenetration = autocvar_g_balance_shotgun_primary_solidpenetration;
 
        W_DecreaseAmmo(ammo_shells, ammoamount, autocvar_g_balance_shotgun_reload_ammo);
 
        W_SetupShot (self, TRUE, 5, "weapons/shotgun_fire.wav", CH_WEAPON_A, d * bullets);
        for (sc = 0;sc < bullets;sc = sc + 1)
-               fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, f, WEP_SHOTGUN, 0, bulletconstant);
-       endFireBallisticBullet();
+               fireBullet(w_shotorg, w_shotdir, spread, solidpenetration, d, f, WEP_SHOTGUN, 0);
 
        pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, autocvar_g_balance_shotgun_primary_ammo);
 
index 5fd890a0b7c600124db484093997aefcb62c4bf4..4fb6047430c77e7671cca794854c7182c13f3cbd 100644 (file)
@@ -62,10 +62,9 @@ void W_UZI_Attack (float deathtype)
        ATTACK_FINISHED(self) = time + autocvar_g_balance_uzi_first_refire * W_WeaponRateFactor();
 
        if (self.misc_bulletcounter == 1)
-               fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_first_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_first_damage, autocvar_g_balance_uzi_first_force, deathtype, 0, autocvar_g_balance_uzi_bulletconstant);
+               fireBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_first_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_first_damage, autocvar_g_balance_uzi_first_force, deathtype, 0);
        else
-               fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_sustained_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, deathtype, 0, autocvar_g_balance_uzi_bulletconstant);
-       endFireBallisticBullet();
+               fireBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_sustained_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, deathtype, 0);
 
        pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
@@ -136,8 +135,7 @@ void uzi_mode1_fire_auto()
        }
 
        uzi_spread = bound(autocvar_g_balance_uzi_spread_min, autocvar_g_balance_uzi_spread_min + (autocvar_g_balance_uzi_spread_add * self.misc_bulletcounter), autocvar_g_balance_uzi_spread_max);
-       fireBallisticBullet(w_shotorg, w_shotdir, uzi_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0, autocvar_g_balance_uzi_bulletconstant);
-       endFireBallisticBullet();
+       fireBullet(w_shotorg, w_shotdir, uzi_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0);
 
        self.misc_bulletcounter = self.misc_bulletcounter + 1;
 
@@ -162,9 +160,7 @@ void uzi_mode1_fire_burst()
                self.punchangle_y = random () - 0.5;
        }
 
-       fireBallisticBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_burst_spread, autocvar_g_balance_uzi_speed, 5, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0, autocvar_g_balance_uzi_bulletconstant);
-       endFireBallisticBullet();
-
+       fireBullet(w_shotorg, w_shotdir, autocvar_g_balance_uzi_burst_spread, autocvar_g_balance_uzi_solidpenetration, autocvar_g_balance_uzi_sustained_damage, autocvar_g_balance_uzi_sustained_force, WEP_UZI, 0);
 
        pointparticles(particleeffectnum("uzi_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
 
index 88fba2714dbebda0df79d0d27a1150123b6023ff..253ed31662c94c71e101955e66bab079547ac470 100644 (file)
@@ -30,8 +30,7 @@ set g_vehicle_spiderbot_minigun_damage          24       // 400 (x2) DPS
 set g_vehicle_spiderbot_minigun_refire          0.06
 set g_vehicle_spiderbot_minigun_force           9
 set g_vehicle_spiderbot_minigun_spread          0.015
-set g_vehicle_spiderbot_minigun_speed           45000  // ~ 32QU
-set g_vehicle_spiderbot_minigun_bulletconstant  110
+set g_vehicle_spiderbot_minigun_solidpenetration 32
 set g_vehicle_spiderbot_minigun_ammo_cost       1
 set g_vehicle_spiderbot_minigun_ammo_max        100
 set g_vehicle_spiderbot_minigun_ammo_regen      40