]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/crylink.qc
Merge branch 'master' into terencehill/tooltips_cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / crylink.qc
index 902bcab4927ea6d10cc1e0c591c99584fd79afef..75d8146de4eb67b1d4fcf18b3241dc7632eaea41 100644 (file)
@@ -66,7 +66,7 @@ CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #ifdef IMPLEMENTATION
 #ifdef SVQC
-void spawnfunc_weapon_crylink(void) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
+spawnfunc(weapon_crylink) { weapon_defaultspawnfunc(WEP_CRYLINK.m_id); }
 
 void W_Crylink_CheckLinks(entity e)
 {
@@ -341,7 +341,7 @@ void W_Crylink_Fadethink(void)
        remove(self);
 }
 
-void W_Crylink_Attack(void)
+void W_Crylink_Attack(Weapon thiswep)
 {SELFPARAM();
        float counter, shots;
        entity proj, prevproj, firstproj;
@@ -349,7 +349,7 @@ void W_Crylink_Attack(void)
        vector forward, right, up;
        float maxdmg;
 
-       W_DecreaseAmmo(WEP_CVAR_PRI(crylink, ammo));
+       W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(crylink, ammo));
 
        maxdmg = WEP_CVAR_PRI(crylink, damage) * WEP_CVAR_PRI(crylink, shots);
        maxdmg *= 1 + WEP_CVAR_PRI(crylink, bouncedamagefactor) * WEP_CVAR_PRI(crylink, bounces);
@@ -450,7 +450,7 @@ void W_Crylink_Attack(void)
        }
 }
 
-void W_Crylink_Attack2(void)
+void W_Crylink_Attack2(Weapon thiswep)
 {SELFPARAM();
        float counter, shots;
        entity proj, prevproj, firstproj;
@@ -458,7 +458,7 @@ void W_Crylink_Attack2(void)
        vector forward, right, up;
        float maxdmg;
 
-       W_DecreaseAmmo(WEP_CVAR_SEC(crylink, ammo));
+       W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(crylink, ammo));
 
        maxdmg = WEP_CVAR_SEC(crylink, damage) * WEP_CVAR_SEC(crylink, shots);
        maxdmg *= 1 + WEP_CVAR_SEC(crylink, bouncedamagefactor) * WEP_CVAR_SEC(crylink, bounces);
@@ -566,79 +566,75 @@ void W_Crylink_Attack2(void)
        }
 }
 
-               METHOD(Crylink, wr_aim, bool(entity thiswep))
+               METHOD(Crylink, wr_aim, void(entity thiswep))
                {
                        SELFPARAM();
                        if(random() < 0.10)
                                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;
                }
-               METHOD(Crylink, wr_think, bool(entity thiswep, bool fire1, bool fire2))
+               METHOD(Crylink, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
                {
-                       SELFPARAM();
-                       if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
+                       if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(actor.weapon);
+                               w.wr_reload(w);
+                       }
 
                        if(fire1)
                        {
-                               if(self.crylink_waitrelease != 1)
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(crylink, refire)))
+                               if(actor.crylink_waitrelease != 1)
+                               if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(crylink, refire)))
                                {
-                                       W_Crylink_Attack();
-                                       weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
+                                       W_Crylink_Attack(thiswep);
+                                       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(crylink, animtime), w_ready);
                                }
                        }
 
                        if(fire2 && autocvar_g_balance_crylink_secondary)
                        {
-                               if(self.crylink_waitrelease != 2)
-                               if(weapon_prepareattack(1, WEP_CVAR_SEC(crylink, refire)))
+                               if(actor.crylink_waitrelease != 2)
+                               if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(crylink, refire)))
                                {
-                                       W_Crylink_Attack2();
-                                       weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
+                                       W_Crylink_Attack2(thiswep);
+                                       weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(crylink, animtime), w_ready);
                                }
                        }
 
-                       if((self.crylink_waitrelease == 1 && !fire1) || (self.crylink_waitrelease == 2 && !fire2))
+                       if((actor.crylink_waitrelease == 1 && !fire1) || (actor.crylink_waitrelease == 2 && !fire2))
                        {
-                               if(!self.crylink_lastgroup || time > self.crylink_lastgroup.teleport_time)
+                               if(!actor.crylink_lastgroup || time > actor.crylink_lastgroup.teleport_time)
                                {
                                        // fired and released now!
-                                       if(self.crylink_lastgroup)
+                                       if(actor.crylink_lastgroup)
                                        {
                                                vector pos;
                                                entity linkjoineffect;
-                                               float isprimary = (self.crylink_waitrelease == 1);
+                                               float isprimary = (actor.crylink_waitrelease == 1);
 
-                                               pos = W_Crylink_LinkJoin(self.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
+                                               pos = W_Crylink_LinkJoin(actor.crylink_lastgroup, WEP_CVAR_BOTH(crylink, isprimary, joinspread) * WEP_CVAR_BOTH(crylink, isprimary, speed));
 
                                                linkjoineffect = spawn();
                                                linkjoineffect.think = W_Crylink_LinkJoinEffect_Think;
                                                linkjoineffect.classname = "linkjoineffect";
                                                linkjoineffect.nextthink = time + w_crylink_linkjoin_time;
-                                               linkjoineffect.owner = self;
+                                               linkjoineffect.owner = actor;
                                                setorigin(linkjoineffect, pos);
                                        }
-                                       self.crylink_waitrelease = 0;
+                                       actor.crylink_waitrelease = 0;
                                        if(!thiswep.wr_checkammo1(thiswep) && !thiswep.wr_checkammo2(thiswep))
-                                       if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+                                       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                                        {
                                                // ran out of ammo!
-                                               self.cnt = WEP_CRYLINK.m_id;
-                                               self.switchweapon = w_getbestweapon(self);
+                                               actor.cnt = WEP_CRYLINK.m_id;
+                                               actor.switchweapon = w_getbestweapon(actor);
                                        }
                                }
                        }
-
-                       return true;
                }
-               METHOD(Crylink, wr_init, bool(entity thiswep))
+               METHOD(Crylink, wr_init, void(entity thiswep))
                {
                        CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-                       return true;
                }
                METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
                {
@@ -662,27 +658,25 @@ void W_Crylink_Attack2(void)
                        ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
                        return ammo_amount;
                }
-               METHOD(Crylink, wr_config, bool(entity thiswep))
+               METHOD(Crylink, wr_config, void(entity thiswep))
                {
                        CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-                       return true;
                }
-               METHOD(Crylink, wr_reload, bool(entity thiswep))
+               METHOD(Crylink, wr_reload, void(entity thiswep))
                {
-                       W_Reload(min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
-                       return true;
+                       W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
                }
-               METHOD(Crylink, wr_suicidemessage, bool(entity thiswep))
+               METHOD(Crylink, wr_suicidemessage, int(entity thiswep))
                {
                        return WEAPON_CRYLINK_SUICIDE;
                }
-               METHOD(Crylink, wr_killmessage, bool(entity thiswep))
+               METHOD(Crylink, wr_killmessage, int(entity thiswep))
                {
                        return WEAPON_CRYLINK_MURDER;
                }
 #endif
 #ifdef CSQC
-               METHOD(Crylink, wr_impacteffect, bool(entity thiswep))
+               METHOD(Crylink, wr_impacteffect, void(entity thiswep))
                {
                        SELFPARAM();
                        vector org2;
@@ -699,17 +693,6 @@ void W_Crylink_Attack2(void)
                                if(!w_issilent)
                                        sound(self, CH_SHOTS, SND_CRYLINK_IMPACT, VOL_BASE, ATTN_NORM);
                        }
-
-                       return true;
-               }
-               METHOD(Crylink, wr_init, bool(entity thiswep))
-               {
-                       return true;
-               }
-               METHOD(Crylink, wr_zoomreticle, bool(entity thiswep))
-               {
-                       // no weapon specific image for this weapon
-                       return false;
                }
 #endif
 #endif