-void W_MachineGun_MuzzleFlash_Think(entity this)
-{
- this.frame += 2;
- this.scale *= 0.5;
- this.alpha -= 0.25;
- this.nextthink = time + 0.05;
-
- if(this.alpha <= 0)
- {
- setthink(this, SUB_Remove);
- this.nextthink = time;
- this.realowner.muzzle_flash = NULL;
- return;
- }
-
-}
-
-void W_MachineGun_MuzzleFlash(entity actor, .entity weaponentity)
-{
- entity wepent = actor.(weaponentity);
-
- if(wepent.muzzle_flash == NULL)
- wepent.muzzle_flash = spawn();
-
- // muzzle flash for 1st person view
- setmodel(wepent.muzzle_flash, MDL_MACHINEGUN_MUZZLEFLASH); // precision set below
-
- wepent.muzzle_flash.scale = 0.75;
- setthink(wepent.muzzle_flash, W_MachineGun_MuzzleFlash_Think);
- wepent.muzzle_flash.nextthink = time + 0.02;
- wepent.muzzle_flash.frame = 2;
- wepent.muzzle_flash.alpha = 0.75;
- wepent.muzzle_flash.angles_z = random() * 180;
- wepent.muzzle_flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- wepent.muzzle_flash.owner = wepent.muzzle_flash.realowner = wepent;
-}
-