MCPcopy Create free account
hub / github.com/demoth/jake2 / PlayerNoise

Method PlayerNoise

game/src/main/java/jake2/game/PlayerWeapon.java:1446–1498  ·  view source on GitHub ↗
(SubgameEntity who, float[] where, int type, GameExportsImpl gameExports)

Source from the content-addressed store, hash-verified

1444 * ===============
1445 */
1446 static void PlayerNoise(SubgameEntity who, float[] where, int type, GameExportsImpl gameExports) {
1447
1448 if (type == GameDefines.PNOISE_WEAPON) {
1449 gclient_t client = who.getClient();
1450 if (client.silencer_shots > 0) {
1451 client.silencer_shots--;
1452 return;
1453 }
1454 }
1455
1456 if (gameExports.gameCvars.deathmatch.value != 0)
1457 return;
1458
1459 if ((who.flags & GameDefines.FL_NOTARGET) != 0)
1460 return;
1461
1462 SubgameEntity noise;
1463 if (who.mynoise == null) {
1464 noise = gameExports.G_Spawn();
1465 noise.classname = "player_noise";
1466 Math3D.VectorSet(noise.mins, -8, -8, -8);
1467 Math3D.VectorSet(noise.maxs, 8, 8, 8);
1468 noise.setOwner(who);
1469 noise.svflags = Defines.SVF_NOCLIENT;
1470 who.mynoise = noise;
1471
1472 noise = gameExports.G_Spawn();
1473 noise.classname = "player_noise";
1474 Math3D.VectorSet(noise.mins, -8, -8, -8);
1475 Math3D.VectorSet(noise.maxs, 8, 8, 8);
1476 noise.setOwner(who);
1477 noise.svflags = Defines.SVF_NOCLIENT;
1478 who.mynoise2 = noise;
1479 }
1480
1481 if (type == GameDefines.PNOISE_SELF || type == GameDefines.PNOISE_WEAPON) {
1482 noise = who.mynoise;
1483 gameExports.level.sound_entity = noise;
1484 gameExports.level.sound_entity_framenum = gameExports.level.framenum;
1485 }
1486 else // type == PNOISE_IMPACT
1487 {
1488 noise = who.mynoise2;
1489 gameExports.level.sound2_entity = noise;
1490 gameExports.level.sound2_entity_framenum = gameExports.level.framenum;
1491 }
1492
1493 Math3D.VectorCopy(where, noise.s.origin);
1494 Math3D.VectorSubtract(where, noise.maxs, noise.absmin);
1495 Math3D.VectorAdd(where, noise.maxs, noise.absmax);
1496 noise.teleport_time = gameExports.level.time;
1497 gameExports.gameImports.linkentity(noise);
1498 }
1499}

Callers 8

thinkMethod · 0.95
Blaster_FireMethod · 0.95
ClientThinkMethod · 0.95
P_WorldEffectsMethod · 0.95
touchMethod · 0.95
thinkMethod · 0.95
fire_leadMethod · 0.95
fire_railMethod · 0.95

Calls 8

VectorSetMethod · 0.95
setOwnerMethod · 0.95
VectorCopyMethod · 0.95
VectorSubtractMethod · 0.95
VectorAddMethod · 0.95
G_SpawnMethod · 0.80
linkentityMethod · 0.65
getClientMethod · 0.45

Tested by

no test coverage detected