MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / ShockWaveStrategy

Method ShockWaveStrategy

src/clientbase/ShockWaveStrategy.cpp:26–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26ShockWaveStrategy::ShockWaveStrategy(ShotPath* _path) :
27 ShotStrategy(_path),
28 radius(BZDB.eval(BZDBNAMES.SHOCKINRADIUS)),
29 radius2(radius* radius) {
30 // setup shot
31 FiringInfo& f = getFiringInfo(_path);
32 f.lifetime *= BZDB.eval(BZDBNAMES.SHOCKADLIFE);
33
34 // make scene node
35 const fvec3& pos = _path->getPosition();
36 if (RENDERER.useQuality() >= _HIGH_QUALITY) {
37 shockNode = new SphereLodSceneNode(pos, radius);
38 shockNode->setShockWave(true);
39 }
40 else {
41 shockNode = new SphereBspSceneNode(pos, radius);
42 }
43
44 // get team
45 if (_path->getPlayer() == ServerPlayer) {
46 TeamColor tmpTeam = _path->getFiringInfo().shot.team;
47 team = (tmpTeam < RogueTeam) ? RogueTeam :
48 (tmpTeam > HunterTeam) ? RogueTeam : tmpTeam;
49 }
50 else {
51 Player* p = lookupPlayer(_path->getPlayer());
52 team = p ? p->getTeam() : RogueTeam;
53 }
54
55 const fvec4& c = Team::getRadarColor(team);
56 if (RENDERER.useQuality() >= _HIGH_QUALITY) {
57 shockNode->setColor(c[0], c[1], c[2], 0.5f);
58 }
59 else {
60 shockNode->setColor(c[0], c[1], c[2], 0.75f);
61 }
62}
63
64
65ShockWaveStrategy::~ShockWaveStrategy() {

Callers

nothing calls this directly

Calls 8

evalMethod · 0.80
useQualityMethod · 0.80
getPlayerMethod · 0.80
lookupPlayerFunction · 0.70
getPositionMethod · 0.45
setShockWaveMethod · 0.45
getTeamMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected