]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/vaporizer.qc
Weapons: remove useless weapon return values and implementations
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / vaporizer.qc
index 2f6d94dd7d18852fb428ef92f84a24f68bd31763..bb0283c669e2ad65e917b4cf31ba57aa6329b8d8 100644 (file)
@@ -71,7 +71,7 @@ void W_RocketMinsta_Explosion(vector loc)
        remove(dmgent);
 }
 
-void W_Vaporizer_Attack(void)
+void W_Vaporizer_Attack(Weapon thiswep)
 {SELFPARAM();
        bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
        float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
@@ -105,7 +105,7 @@ void W_Vaporizer_Attack(void)
        if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
                W_RocketMinsta_Explosion(trace_endpos);
 
-       W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
+       W_DecreaseAmmo(thiswep, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
 }
 
 void W_RocketMinsta_Laser_Explode (void)
@@ -237,32 +237,33 @@ void W_RocketMinsta_Attack3 (void)
     }
 }
 
-               METHOD(Vaporizer, wr_aim, bool(entity thiswep))
+               METHOD(Vaporizer, wr_aim, void(entity thiswep))
                {
                        if(self.WEP_AMMO(VAPORIZER) > 0)
                                self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
                        else
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
-
-                       return true;
                }
-               METHOD(Vaporizer, wr_think, bool(entity thiswep))
+               METHOD(Vaporizer, wr_think, void(entity thiswep, bool fire1, bool fire2))
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        // if the laser uses load, we also consider its ammo for reloading
-                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
-                               _WEP_ACTION(self.weapon, WR_RELOAD);
-                       if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
+                       if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       } else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) { // forced reload
+                               Weapon w = get_weaponinfo(self.weapon);
+                               w.wr_reload(w);
+                       }
+                       if(fire1 && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
                        {
-                               if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
+                               if(weapon_prepareattack(false, WEP_CVAR_PRI(vaporizer, refire)))
                                {
-                                       W_Vaporizer_Attack();
+                                       W_Vaporizer_Attack(thiswep);
                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
                                }
                        }
-                       if(self.BUTTON_ATCK2 || (self.BUTTON_ATCK && !self.ammo_cells && autocvar_g_rm))
+                       if(fire2 || (fire1 && !self.ammo_cells && autocvar_g_rm))
                        {
                                if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
                                {
@@ -291,7 +292,7 @@ void W_RocketMinsta_Attack3 (void)
 
                                        // decrease ammo for the laser?
                                        if(WEP_CVAR_SEC(vaporizer, ammo))
-                                               W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
+                                               W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(vaporizer, ammo));
 
                                        // ugly instagib hack to reuse the fire mode of the laser
                                        makevectors(self.v_angle);
@@ -317,20 +318,16 @@ void W_RocketMinsta_Attack3 (void)
                        }
                        else
                                self.held_down = false;
-
-                       return true;
                }
-               METHOD(Vaporizer, wr_init, bool(entity thiswep))
+               METHOD(Vaporizer, wr_init, void(entity thiswep))
                {
                        //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
                        VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
-                       return true;
                }
-               METHOD(Vaporizer, wr_setup, bool(entity thiswep))
+               METHOD(Vaporizer, wr_setup, void(entity thiswep))
                {
                        self.ammo_field = WEP_AMMO(VAPORIZER);
                        self.vaporizer_lasthit = 0;
-                       return true;
                }
                METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
                {
@@ -347,17 +344,15 @@ void W_RocketMinsta_Attack3 (void)
                        ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
                        return ammo_amount;
                }
-               METHOD(Vaporizer, wr_config, bool(entity thiswep))
+               METHOD(Vaporizer, wr_config, void(entity thiswep))
                {
                        VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
-                       return true;
                }
-               METHOD(Vaporizer, wr_resetplayer, bool(entity thiswep))
+               METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
                {
                        self.vaporizer_lasthit = 0;
-                       return true;
                }
-               METHOD(Vaporizer, wr_reload, bool(entity thiswep))
+               METHOD(Vaporizer, wr_reload, void(entity thiswep))
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        float used_ammo;
@@ -367,13 +362,12 @@ void W_RocketMinsta_Attack3 (void)
                                used_ammo = vaporizer_ammo;
 
                        W_Reload(used_ammo, SND(RELOAD));
-                       return true;
                }
-               METHOD(Vaporizer, wr_suicidemessage, bool(entity thiswep))
+               METHOD(Vaporizer, wr_suicidemessage, int(entity thiswep))
                {
                        return WEAPON_THINKING_WITH_PORTALS;
                }
-               METHOD(Vaporizer, wr_killmessage, bool(entity thiswep))
+               METHOD(Vaporizer, wr_killmessage, int(entity thiswep))
                {
                        return WEAPON_VAPORIZER_MURDER;
                }
@@ -381,7 +375,7 @@ void W_RocketMinsta_Attack3 (void)
 #endif
 #ifdef CSQC
 
-               METHOD(Vaporizer, wr_impacteffect, bool(entity thiswep))
+               METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
                {
                        vector org2 = w_org + w_backoff * 6;
                        if(w_deathtype & HITTYPE_SECONDARY)
@@ -394,15 +388,13 @@ void W_RocketMinsta_Attack3 (void)
                                pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
                                if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
                        }
-                       return true;
                }
-               METHOD(Vaporizer, wr_init, bool(entity thiswep))
+               METHOD(Vaporizer, wr_init, void(entity thiswep))
                {
                        if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
                        {
                                precache_pic("gfx/reticle_nex");
                        }
-                       return true;
                }
                METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
                {