fix a crash with crylink when only using 1 shot; fix fade_rate networking
authorRudolf Polzer <divverent@alientrap.org>
Thu, 11 Nov 2010 22:07:29 +0000 (23:07 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 11 Nov 2010 22:07:29 +0000 (23:07 +0100)
qcsrc/server/csqcprojectile.qc
qcsrc/server/w_crylink.qc

index d250d39..31e5b77 100644 (file)
@@ -13,7 +13,7 @@ float CSQCProjectile_SendEntity(entity to, float sf)
        if(self.flags & FL_ONGROUND)
                sf |= 0x40;
 
        if(self.flags & FL_ONGROUND)
                sf |= 0x40;
 
-       if(self.fade_time != 0 && self.fade_rate != 0)
+       if(self.fade_time != 0 || self.fade_rate != 0)
        {
                ft = (self.fade_time - time) / sys_frametime;
                fr = (1 / self.fade_rate) / sys_frametime;
        {
                ft = (self.fade_time - time) / sys_frametime;
                fr = (1 / self.fade_rate) / sys_frametime;
index 5925827..b783f5b 100644 (file)
@@ -284,7 +284,11 @@ void W_Crylink_Attack (void)
                proj.classname = "spike";
                proj.bot_dodge = TRUE;
                proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
                proj.classname = "spike";
                proj.bot_dodge = TRUE;
                proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
-               if(counter == 0) { // first projectile, store in firstproj for now
+               if(shots == 1) {
+                       proj.queuenext = proj;
+                       proj.queueprev = proj;
+               }
+               else if(counter == 0) { // first projectile, store in firstproj for now
                        firstproj = proj;
                }
                else if(counter == shots - 1) { // last projectile, link up with first projectile
                        firstproj = proj;
                }
                else if(counter == shots - 1) { // last projectile, link up with first projectile
@@ -326,13 +330,13 @@ void W_Crylink_Attack (void)
                if(counter == 0)
                {
                        proj.fade_time = time + cvar("g_balance_crylink_primary_middle_lifetime");
                if(counter == 0)
                {
                        proj.fade_time = time + cvar("g_balance_crylink_primary_middle_lifetime");
-                       self.fade_rate = 1 / cvar("g_balance_crylink_primary_middle_fadetime");
+                       proj.fade_rate = 1 / cvar("g_balance_crylink_primary_middle_fadetime");
                        proj.nextthink = time + cvar("g_balance_crylink_primary_middle_lifetime") + cvar("g_balance_crylink_primary_middle_fadetime");
                }
                else
                {
                        proj.fade_time = time + cvar("g_balance_crylink_primary_other_lifetime");
                        proj.nextthink = time + cvar("g_balance_crylink_primary_middle_lifetime") + cvar("g_balance_crylink_primary_middle_fadetime");
                }
                else
                {
                        proj.fade_time = time + cvar("g_balance_crylink_primary_other_lifetime");
-                       self.fade_rate = 1 / cvar("g_balance_crylink_primary_other_fadetime");
+                       proj.fade_rate = 1 / cvar("g_balance_crylink_primary_other_fadetime");
                        proj.nextthink = time + cvar("g_balance_crylink_primary_other_lifetime") + cvar("g_balance_crylink_primary_other_fadetime");
                }
                proj.cnt = cvar("g_balance_crylink_primary_bounces");
                        proj.nextthink = time + cvar("g_balance_crylink_primary_other_lifetime") + cvar("g_balance_crylink_primary_other_fadetime");
                }
                proj.cnt = cvar("g_balance_crylink_primary_bounces");
@@ -373,7 +377,11 @@ void W_Crylink_Attack2 (void)
                proj.classname = "spike";
                proj.bot_dodge = TRUE;
                proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
                proj.classname = "spike";
                proj.bot_dodge = TRUE;
                proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
-               if(counter == 0) { // first projectile, store in firstproj for now
+               if(shots == 1) {
+                       proj.queuenext = proj;
+                       proj.queueprev = proj;
+               }
+               else if(counter == 0) { // first projectile, store in firstproj for now
                        firstproj = proj;
                }
                else if(counter == shots - 1) { // last projectile, link up with first projectile
                        firstproj = proj;
                }
                else if(counter == shots - 1) { // last projectile, link up with first projectile
@@ -403,13 +411,13 @@ void W_Crylink_Attack2 (void)
                if(counter == (shots - 1) / 2)
                {
                        proj.fade_time = time + cvar("g_balance_crylink_secondary_middle_lifetime");
                if(counter == (shots - 1) / 2)
                {
                        proj.fade_time = time + cvar("g_balance_crylink_secondary_middle_lifetime");
-                       self.fade_rate = 1 / cvar("g_balance_crylink_secondary_middle_fadetime");
+                       proj.fade_rate = 1 / cvar("g_balance_crylink_secondary_middle_fadetime");
                        proj.nextthink = time + cvar("g_balance_crylink_secondary_middle_lifetime") + cvar("g_balance_crylink_secondary_middle_fadetime");
                }
                else
                {
                        proj.fade_time = time + cvar("g_balance_crylink_secondary_line_lifetime");
                        proj.nextthink = time + cvar("g_balance_crylink_secondary_middle_lifetime") + cvar("g_balance_crylink_secondary_middle_fadetime");
                }
                else
                {
                        proj.fade_time = time + cvar("g_balance_crylink_secondary_line_lifetime");
-                       self.fade_rate = 1 / cvar("g_balance_crylink_secondary_line_fadetime");
+                       proj.fade_rate = 1 / cvar("g_balance_crylink_secondary_line_fadetime");
                        proj.nextthink = time + cvar("g_balance_crylink_secondary_line_lifetime") + cvar("g_balance_crylink_secondary_line_fadetime");
                }
                proj.cnt = cvar("g_balance_crylink_secondary_bounces");
                        proj.nextthink = time + cvar("g_balance_crylink_secondary_line_lifetime") + cvar("g_balance_crylink_secondary_line_fadetime");
                }
                proj.cnt = cvar("g_balance_crylink_secondary_bounces");