(WeaponSoundMessage mzzl)
| 256 | * ============== |
| 257 | */ |
| 258 | static void ParseMuzzleFlash(WeaponSoundMessage mzzl) { |
| 259 | float volume; |
| 260 | String soundname; |
| 261 | |
| 262 | int i = mzzl.entityIndex; |
| 263 | if (i < 1 || i >= Defines.MAX_EDICTS) |
| 264 | Com.Error(Defines.ERR_DROP, "CL_ParseMuzzleFlash: bad entity"); |
| 265 | |
| 266 | int weapon = mzzl.type; |
| 267 | int silenced = weapon & Defines.MZ_SILENCED; |
| 268 | weapon &= ~Defines.MZ_SILENCED; |
| 269 | |
| 270 | centity_t pl = ClientGlobals.cl_entities[i]; |
| 271 | |
| 272 | cdlight_t dl = AllocDlight(i); |
| 273 | Math3D.VectorCopy(pl.current.origin, dl.origin); |
| 274 | Math3D.AngleVectors(pl.current.angles, fv, rv, null); |
| 275 | Math3D.VectorMA(dl.origin, 18, fv, dl.origin); |
| 276 | Math3D.VectorMA(dl.origin, 16, rv, dl.origin); |
| 277 | if (silenced != 0) |
| 278 | dl.radius = 100 + (Globals.rnd.nextInt() & 31); |
| 279 | else |
| 280 | dl.radius = 200 + (Globals.rnd.nextInt() & 31); |
| 281 | dl.minlight = 32; |
| 282 | dl.die = ClientGlobals.cl.time; // + 0.1; |
| 283 | |
| 284 | if (silenced != 0) |
| 285 | volume = 0.2f; |
| 286 | else |
| 287 | volume = 1; |
| 288 | |
| 289 | switch (weapon) { |
| 290 | case Defines.MZ_BLASTER: |
| 291 | dl.color[0] = 1; |
| 292 | dl.color[1] = 1; |
| 293 | dl.color[2] = 0; |
| 294 | S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/blastf1a.wav"), volume, Defines.ATTN_NORM, 0); |
| 295 | break; |
| 296 | case Defines.MZ_BLUEHYPERBLASTER: |
| 297 | dl.color[0] = 0; |
| 298 | dl.color[1] = 0; |
| 299 | dl.color[2] = 1; |
| 300 | S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/hyprbf1a.wav"), volume, Defines.ATTN_NORM, 0); |
| 301 | break; |
| 302 | case Defines.MZ_HYPERBLASTER: |
| 303 | dl.color[0] = 1; |
| 304 | dl.color[1] = 1; |
| 305 | dl.color[2] = 0; |
| 306 | S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound("weapons/hyprbf1a.wav"), volume, Defines.ATTN_NORM, 0); |
| 307 | break; |
| 308 | case Defines.MZ_MACHINEGUN: |
| 309 | dl.color[0] = 1; |
| 310 | dl.color[1] = 1; |
| 311 | dl.color[2] = 0; |
| 312 | //Com_sprintf(soundname, sizeof(soundname), |
| 313 | // "weapons/machgf%ib.wav", (rand() % 5) + 1); |
| 314 | soundname = "weapons/machgf" + ((Globals.rnd.nextInt(5)) + 1) + "b.wav"; |
| 315 | S.StartSound(null, i, Defines.CHAN_WEAPON, S.RegisterSound(soundname), volume, Defines.ATTN_NORM, 0); |
no test coverage detected