]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_crylink.qc
s/WEP_(ID)/WEP_$1.m_id/
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_crylink.qc
index 70efdc0e24d3c2e385642dff4aea590109aa0119..b5e50553a2b53b51706c14dbc65bba3c329c04cd 100644 (file)
@@ -1,4 +1,4 @@
-#ifdef REGISTER_WEAPON
+#ifndef IMPLEMENTATION
 REGISTER_WEAPON(
 /* WEP_##id  */ CRYLINK,
 /* function  */ W_Crylink,
@@ -9,7 +9,7 @@ REGISTER_WEAPON(
 /* color     */ '1 0.5 1',
 /* modelname */ "crylink",
 /* simplemdl */ "foobar",
-/* crosshair */ "gfx/crosshaircrylink 0.4",
+/* crosshair */ "gfx/crosshaircrylink 0.5",
 /* wepimg    */ "weaponcrylink",
 /* refname   */ "crylink",
 /* wepname   */ _("Crylink")
@@ -61,9 +61,10 @@ CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity queuenext;
 .entity queueprev;
 #endif
-#else
+#endif
+#ifdef IMPLEMENTATION
 #ifdef SVQC
-void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK); }
+void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
 
 void W_Crylink_CheckLinks(entity e)
 {
@@ -123,9 +124,9 @@ void W_Crylink_LinkExplode(entity e, entity e2)
 
        if(e == e.realowner.crylink_lastgroup)
                e.realowner.crylink_lastgroup = world;
-               
+
        float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY);
-               
+
        RadiusDamage(e, e.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * a, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * a, WEP_CVAR_BOTH(crylink, isprimary, radius), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * a, e.projectiledeathtype, other);
 
        W_Crylink_LinkExplode(e.queuenext, e2);
@@ -241,7 +242,7 @@ void W_Crylink_LinkJoinEffect_Think(void)
                if(n >= 2)
                {
                        float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY);
-                       
+
                        if(WEP_CVAR_BOTH(crylink, isprimary, joinexplode))
                        {
                                n /= WEP_CVAR_BOTH(crylink, isprimary, shots);
@@ -279,7 +280,7 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad)
                        else
                                ++hit_enemy;
                }
-                       
+
                head = head.chain;
        }
 
@@ -306,7 +307,7 @@ void W_Crylink_Touch(void)
                f *= a;
 
        float totaldamage = RadiusDamage(self, self.realowner, WEP_CVAR_BOTH(crylink, isprimary, damage) * f, WEP_CVAR_BOTH(crylink, isprimary, edgedamage) * f, WEP_CVAR_BOTH(crylink, isprimary, radius), world, world, WEP_CVAR_BOTH(crylink, isprimary, force) * f, self.projectiledeathtype, other);
-               
+
        if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(self, WEP_CVAR_BOTH(crylink, isprimary, radius)))))
        {
                if(self == self.realowner.crylink_lastgroup)
@@ -391,7 +392,7 @@ void W_Crylink_Attack(void)
 
                proj.movetype = MOVETYPE_BOUNCEMISSILE;
                PROJECTILE_MAKETRIGGER(proj);
-               proj.projectiledeathtype = WEP_CRYLINK;
+               proj.projectiledeathtype = WEP_CRYLINK.m_id;
                //proj.gravity = 0.001;
 
                setorigin(proj, w_shotorg);
@@ -404,8 +405,8 @@ void W_Crylink_Attack(void)
                else
                {
                        makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
-                       s_y = v_forward.x;
-                       s_z = v_forward.y;
+                       s.y = v_forward.x;
+                       s.z = v_forward.y;
                }
                s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
                W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
@@ -434,7 +435,7 @@ void W_Crylink_Attack(void)
 
                proj.flags = FL_PROJECTILE;
                proj.missile_flags = MIF_SPLASH;
-    
+
                CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
@@ -500,7 +501,7 @@ void W_Crylink_Attack2(void)
 
                proj.movetype = MOVETYPE_BOUNCEMISSILE;
                PROJECTILE_MAKETRIGGER(proj);
-               proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
+               proj.projectiledeathtype = WEP_CRYLINK.m_id | HITTYPE_SECONDARY;
                //proj.gravity = 0.001;
 
                setorigin(proj, w_shotorg);
@@ -514,8 +515,8 @@ void W_Crylink_Attack2(void)
                        else
                        {
                                makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
-                               s_y = v_forward.x;
-                               s_z = v_forward.y;
+                               s.y = v_forward.x;
+                               s.z = v_forward.y;
                        }
                        s = s * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor;
                        s = w_shotdir + right * s.y + up * s.z;
@@ -550,7 +551,7 @@ void W_Crylink_Attack2(void)
 
                proj.flags = FL_PROJECTILE;
         proj.missile_flags = MIF_SPLASH;
-        
+
                CSQCProjectile(proj, true, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), true);
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
@@ -563,7 +564,7 @@ void W_Crylink_Attack2(void)
        }
 }
 
-float W_Crylink(float req)
+bool W_Crylink(int req)
 {
        float ammo_amount;
        switch(req)
@@ -574,7 +575,7 @@ float W_Crylink(float req)
                                self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
                        else
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
-                               
+
                        return true;
                }
                case WR_THINK:
@@ -612,7 +613,7 @@ float W_Crylink(float req)
                                                vector pos;
                                                entity linkjoineffect;
                                                float isprimary = (self.crylink_waitrelease == 1);
-                                               
+
                                                pos = W_Crylink_LinkJoin(self.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
 
                                                linkjoineffect = spawn();
@@ -627,12 +628,12 @@ float W_Crylink(float req)
                                        if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                // ran out of ammo!
-                                               self.cnt = WEP_CRYLINK;
+                                               self.cnt = WEP_CRYLINK.m_id;
                                                self.switchweapon = w_getbestweapon(self);
                                        }
                                }
                        }
-                       
+
                        return true;
                }
                case WR_INIT:
@@ -643,7 +644,7 @@ float W_Crylink(float req)
                        precache_sound("weapons/crylink_fire.wav");
                        precache_sound("weapons/crylink_fire2.wav");
                        precache_sound("weapons/crylink_linkjoin.wav");
-                       CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
+                       CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
                        return true;
                }
                case WR_CHECKAMMO1:
@@ -653,7 +654,7 @@ float W_Crylink(float req)
                                return true;
 
                        ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
-                       ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_PRI(crylink, ammo);
+                       ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
                        return ammo_amount;
                }
                case WR_CHECKAMMO2:
@@ -663,12 +664,12 @@ float W_Crylink(float req)
                                return true;
 
                        ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
-                       ammo_amount += self.(weapon_load[WEP_CRYLINK]) >= WEP_CVAR_SEC(crylink, ammo);
+                       ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
                        return ammo_amount;
                }
                case WR_CONFIG:
                {
-                       CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
+                       CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
                        return true;
                }
                case WR_RELOAD:
@@ -689,7 +690,7 @@ float W_Crylink(float req)
 }
 #endif
 #ifdef CSQC
-float W_Crylink(float req)
+bool W_Crylink(int req)
 {
        switch(req)
        {
@@ -709,7 +710,7 @@ float W_Crylink(float req)
                                if(!w_issilent)
                                        sound(self, CH_SHOTS, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
                        }
-                       
+
                        return true;
                }
                case WR_INIT: