]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/machinegun.qc
Merge branch 'master' into terencehill/tooltips_cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / machinegun.qc
index a0bad57faa3abc7e5cf7a77a71b98be98c2f6ec3..e9a50ab4393d34c6eb976ea1dbae2c77bb211f8c 100644 (file)
@@ -55,8 +55,8 @@ MACHINEGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #ifdef IMPLEMENTATION
 #ifdef SVQC
 
-void spawnfunc_weapon_machinegun(void)
-{SELFPARAM();
+spawnfunc(weapon_machinegun)
+{
        if(autocvar_sv_q3acompat_machineshotgunswap)
        if(self.classname != "droppedweapon")
        {
@@ -65,7 +65,7 @@ void spawnfunc_weapon_machinegun(void)
        }
        weapon_defaultspawnfunc(WEP_MACHINEGUN.m_id);
 }
-void spawnfunc_weapon_uzi(void) { spawnfunc_weapon_machinegun(); }
+spawnfunc(weapon_uzi) { spawnfunc_weapon_machinegun(this); }
 
 void W_MachineGun_MuzzleFlash_Think(void)
 {SELFPARAM();
@@ -90,7 +90,7 @@ void W_MachineGun_MuzzleFlash(void)
                self.muzzle_flash = spawn();
 
        // muzzle flash for 1st person view
-       setmodel(self.muzzle_flash, "models/uziflash.md3"); // precision set below
+       setmodel(self.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below
 
        self.muzzle_flash.scale = 0.75;
        self.muzzle_flash.think = W_MachineGun_MuzzleFlash_Think;
@@ -104,7 +104,7 @@ void W_MachineGun_MuzzleFlash(void)
 
 void W_MachineGun_Attack(int deathtype)
 {SELFPARAM();
-       W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
+       W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -180,7 +180,7 @@ void W_MachineGun_Attack_Auto(void)
 
        W_DecreaseAmmo(WEP_CVAR(machinegun, sustained_ammo));
 
-       W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+       W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -206,7 +206,7 @@ void W_MachineGun_Attack_Auto(void)
 
 void W_MachineGun_Attack_Burst(void)
 {SELFPARAM();
-       W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+       W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
        if(!autocvar_g_norecoil)
        {
                self.punchangle_x = random() - 0.5;
@@ -304,11 +304,6 @@ bool W_MachineGun(int req)
                }
                case WR_INIT:
                {
-                       precache_model("models/uziflash.md3");
-                       precache_model(W_Model("g_uzi.md3"));
-                       precache_model(W_Model("v_uzi.md3"));
-                       precache_model(W_Model("h_uzi.iqm"));
-                       precache_sound(W_Sound("uzi_fire"));
                        MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
                        return true;
                }
@@ -351,7 +346,7 @@ bool W_MachineGun(int req)
                }
                case WR_RELOAD:
                {
-                       W_Reload(min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), W_Sound("reload"));
+                       W_Reload(min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
                        return true;
                }
                case WR_SUICIDEMESSAGE:
@@ -381,19 +376,16 @@ bool W_MachineGun(int req)
                        pointparticles(particleeffectnum(EFFECT_MACHINEGUN_IMPACT), org2, w_backoff * 1000, 1);
                        if(!w_issilent)
                                if(w_random < 0.05)
-                                       sound(self, CH_SHOTS, W_Sound("ric1"), VOL_BASE, ATTN_NORM);
+                                       sound(self, CH_SHOTS, SND_RIC1, VOL_BASE, ATTN_NORM);
                                else if(w_random < 0.1)
-                                       sound(self, CH_SHOTS, W_Sound("ric2"), VOL_BASE, ATTN_NORM);
+                                       sound(self, CH_SHOTS, SND_RIC2, VOL_BASE, ATTN_NORM);
                                else if(w_random < 0.2)
-                                       sound(self, CH_SHOTS, W_Sound("ric3"), VOL_BASE, ATTN_NORM);
+                                       sound(self, CH_SHOTS, SND_RIC3, VOL_BASE, ATTN_NORM);
 
                        return true;
                }
                case WR_INIT:
                {
-                       precache_sound(W_Sound("ric1"));
-                       precache_sound(W_Sound("ric2"));
-                       precache_sound(W_Sound("ric3"));
                        return true;
                }
                case WR_ZOOMRETICLE: