]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_crylink.qc
Merge remote-tracking branch 'origin/debugger/dualscreenresolution'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_crylink.qc
index b2472df2ae0fa5798f7cc3e80de744210cf88827..80af85acf34a3af5a65c631803aec4e2174aa70f 100644 (file)
@@ -1,5 +1,15 @@
 #ifdef REGISTER_WEAPON
-REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", _("Crylink"));
+REGISTER_WEAPON(
+/* WEP_##id  */ CRYLINK,
+/* function  */ w_crylink,
+/* ammotype  */ IT_CELLS,
+/* impulse   */ 6,
+/* flags     */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH,
+/* rating    */ BOT_PICKUP_RATING_MID,
+/* model     */ "crylink",
+/* shortname */ "crylink",
+/* fullname  */ _("Crylink")
+);
 #else
 #ifdef SVQC
 .float gravity;
@@ -84,10 +94,9 @@ void W_Crylink_LinkExplode (entity e, entity e2)
 // stored in w_crylink_linkjoin_time.
 // could possibly network this origin and time, and display a special particle
 // effect when projectiles meet there :P
-// jspeed: MINIMUM jing speed
-// jtime: MAXIMUM jing time (0: none)
+// jspeed: joining speed (calculate this as join spread * initial speed)
 float w_crylink_linkjoin_time;
-vector W_Crylink_LinkJoin(entity e, float jspeed, float jtime)
+vector W_Crylink_LinkJoin(entity e, float jspeed)
 {
        vector avg_origin, avg_velocity;
        vector targ_origin;
@@ -124,7 +133,7 @@ vector W_Crylink_LinkJoin(entity e, float jspeed, float jtime)
        if(avg_dist == 0)
                return avg_origin; // no change needed
 
-       if(jspeed == 0 && jtime == 0)
+       if(jspeed == 0)
        {
                e.velocity = avg_velocity;
                UpdateCSQCProjectile(e);
@@ -137,14 +146,6 @@ vector W_Crylink_LinkJoin(entity e, float jspeed, float jtime)
        }
        else
        {
-               if(jtime)
-               {
-                       if(jspeed)
-                               w_crylink_linkjoin_time = min(jtime, avg_dist / jspeed);
-                       else
-                               w_crylink_linkjoin_time = jtime;
-               }
-               else
                        w_crylink_linkjoin_time = avg_dist / jspeed;
                targ_origin = avg_origin + w_crylink_linkjoin_time * avg_velocity;
 
@@ -235,10 +236,10 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
        {
                if((head.takedamage != DAMAGE_NO) && (head.deadflag == DEAD_NO))
                {
-                       if(IsDifferentTeam(head, projectile.realowner))
-                               ++hit_enemy;
-                       else
+                       if(SAME_TEAM(head, projectile.realowner))
                                ++hit_friendly;
+                       else
+                               ++hit_enemy;
                }
                        
                head = head.chain;
@@ -443,7 +444,7 @@ void W_Crylink_Attack (void)
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
        }
-       if(autocvar_g_balance_crylink_primary_joinspread != 0 || autocvar_g_balance_crylink_primary_jointime != 0)
+       if(autocvar_g_balance_crylink_primary_joinspread != 0)
        {
                self.crylink_lastgroup = proj;
                W_Crylink_CheckLinks(proj);
@@ -559,7 +560,7 @@ void W_Crylink_Attack2 (void)
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
        }
-       if(autocvar_g_balance_crylink_secondary_joinspread != 0 || autocvar_g_balance_crylink_secondary_jointime != 0)
+       if(autocvar_g_balance_crylink_secondary_joinspread != 0)
        {
                self.crylink_lastgroup = proj;
                W_Crylink_CheckLinks(proj);
@@ -619,12 +620,12 @@ float w_crylink(float req)
 
                                        if(self.crylink_waitrelease == 1)
                                        {
-                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_primary_joinspread * autocvar_g_balance_crylink_primary_speed, autocvar_g_balance_crylink_primary_jointime);
+                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_primary_joinspread * autocvar_g_balance_crylink_primary_speed);
 
                                        }
                                        else
                                        {
-                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_secondary_joinspread * autocvar_g_balance_crylink_secondary_speed, autocvar_g_balance_crylink_secondary_jointime);
+                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, autocvar_g_balance_crylink_secondary_joinspread * autocvar_g_balance_crylink_secondary_speed);
                                        }
 
                                        linkjoineffect = spawn();
@@ -706,13 +707,13 @@ float w_crylink(float req)
                {
                        pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
                        if(!w_issilent)
-                               sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/crylink_impact2.wav", VOL_BASE, ATTEN_NORM);
                }
                else
                {
                        pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
                        if(!w_issilent)
-                               sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
+                               sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTEN_NORM);
                }
        }
        else if(req == WR_PRECACHE)