Add cvars for bouncefactor/bouncestop of GL secondary
authorJānis Rūcis <parasti@gmail.com>
Thu, 6 May 2010 14:55:55 +0000 (17:55 +0300)
committerJānis Rūcis <parasti@gmail.com>
Thu, 6 May 2010 14:55:55 +0000 (17:55 +0300)
balance.cfg
balance25.cfg
balanceNexrun.cfg
balanceSamual.cfg
qcsrc/client/projectile.qc
qcsrc/server/csqcprojectile.qc
qcsrc/server/w_grenadelauncher.qc

index 37a36e8..6bed581 100644 (file)
@@ -309,6 +309,8 @@ set g_balance_grenadelauncher_secondary_animtime 0.3
 set g_balance_grenadelauncher_secondary_ammo 2
 set g_balance_grenadelauncher_secondary_health 70
 set g_balance_grenadelauncher_secondary_damageforcescale 4
+set g_balance_grenadelauncher_secondary_bouncefactor 0.5
+set g_balance_grenadelauncher_secondary_bouncestop 0.075
 // }}}
 // {{{ electro
 set g_balance_electro_lightning 0
index 11cc3a4..e3e7b76 100644 (file)
@@ -309,6 +309,8 @@ set g_balance_grenadelauncher_secondary_animtime 0.3
 set g_balance_grenadelauncher_secondary_ammo 2
 set g_balance_grenadelauncher_secondary_health 10
 set g_balance_grenadelauncher_secondary_damageforcescale 4
+set g_balance_grenadelauncher_secondary_bouncefactor 0.5
+set g_balance_grenadelauncher_secondary_bouncestop 0.075
 // }}}
 // {{{ electro
 set g_balance_electro_lightning 0
index a23e9b4..384f457 100644 (file)
@@ -309,6 +309,8 @@ set g_balance_grenadelauncher_secondary_animtime 0.5
 set g_balance_grenadelauncher_secondary_ammo 2
 set g_balance_grenadelauncher_secondary_health 0
 set g_balance_grenadelauncher_secondary_damageforcescale 0
+set g_balance_grenadelauncher_secondary_bouncefactor 0.5
+set g_balance_grenadelauncher_secondary_bouncestop 0.075
 // }}}
 // {{{ electro
 set g_balance_electro_lightning 1
index 19f7896..2357d8b 100644 (file)
@@ -309,6 +309,8 @@ set g_balance_grenadelauncher_secondary_animtime 0.3
 set g_balance_grenadelauncher_secondary_ammo 2
 set g_balance_grenadelauncher_secondary_health 70
 set g_balance_grenadelauncher_secondary_damageforcescale 4
+set g_balance_grenadelauncher_secondary_bouncefactor 0.5
+set g_balance_grenadelauncher_secondary_bouncestop 0.075
 // }}}
 // {{{ electro
 set g_balance_electro_lightning 0
index 2730a32..b22a5b9 100644 (file)
@@ -158,9 +158,11 @@ void Ent_RemoveProjectile()
        }
 }
 
+.float bouncefactor;
+.float bouncestop;
 void Ent_Projectile()
 {
-       float f;
+       float f, s;
 
        // projectile properties:
        //   kind (interpolated, or clientside)
@@ -215,8 +217,18 @@ void Ent_Projectile()
                        self.velocity_z = ReadCoord();
                        self.gravity = ReadCoord();
 
+                       s = ReadByte();
+
+                       if (s & 1)
+                       {
+                               self.bouncefactor = ReadCoord();
+                               self.bouncestop = ReadCoord();
+                       }
+
                        self.move_origin = self.origin;
                        self.move_velocity = self.velocity;
+                       self.move_bounce_factor = self.bouncefactor;
+                       self.move_bounce_stopspeed = self.bouncestop;
                }
 
                if(time == self.spawntime || (self.count & 0x80) || (f & 0x10))
index e585b1e..aecdcf7 100644 (file)
@@ -3,6 +3,7 @@
 float CSQCProjectile_SendEntity(entity to, float sf)
 {
        float ft, fr;
+       float s;
 
        // note: flag 0x10 = no trail please
        sf = sf & 0x1F;
@@ -21,6 +22,13 @@ float CSQCProjectile_SendEntity(entity to, float sf)
                        sf |= 0x20;
        }
 
+       // HACK: subflags for sendflags = 0x80
+
+       s = 0;
+
+       if (self.movetype == MOVETYPE_BOUNCEMISSILE || self.movetype == MOVETYPE_BOUNCE)
+               s |= 1;
+
        WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE);
        WriteByte(MSG_ENTITY, sf);
 
@@ -36,6 +44,14 @@ float CSQCProjectile_SendEntity(entity to, float sf)
                        WriteCoord(MSG_ENTITY, self.velocity_y);
                        WriteCoord(MSG_ENTITY, self.velocity_z);
                        WriteCoord(MSG_ENTITY, self.gravity);
+
+                       WriteByte(MSG_ENTITY, s);
+
+                       if (s & 1)
+                       {
+                               WriteCoord(MSG_ENTITY, self.bouncefactor);
+                               WriteCoord(MSG_ENTITY, self.bouncestop);
+                       }
                }
 
                if(sf & 0x20)
index 80b7020..559ced3 100644 (file)
@@ -127,6 +127,8 @@ void W_Grenade_Attack2 (void)
        gren.bot_dodge = TRUE;
        gren.bot_dodgerating = cvar("g_balance_grenadelauncher_secondary_damage");
        gren.movetype = MOVETYPE_BOUNCE;
+       gren.bouncefactor = cvar("g_balance_grenadelauncher_secondary_bouncefactor");
+       gren.bouncestop = cvar("g_balance_grenadelauncher_secondary_bouncestop");
        PROJECTILE_MAKETRIGGER(gren);
        gren.projectiledeathtype = WEP_GRENADE_LAUNCHER | HITTYPE_SECONDARY;
        setsize(gren, '0 0 -3', '0 0 -3');