| 639 | // |
| 640 | |
| 641 | ThiefStrategy::ThiefStrategy(ShotPath* _path) |
| 642 | : SegmentedShotStrategy(_path, false) |
| 643 | , cummTime(0.0f) { |
| 644 | // speed up shell and decrease lifetime |
| 645 | FiringInfo& f = getFiringInfo(_path); |
| 646 | f.lifetime *= BZDB.eval(BZDBNAMES.THIEFADLIFE); |
| 647 | float thiefAdVel = BZDB.eval(BZDBNAMES.THIEFADSHOTVEL); |
| 648 | f.shot.vel *= thiefAdVel; |
| 649 | setReloadTime(_path->getReloadTime() |
| 650 | / BZDB.eval(BZDBNAMES.THIEFADRATE)); |
| 651 | |
| 652 | // make segments |
| 653 | makeSegments(Stop); |
| 654 | setCurrentTime(getLastTime()); |
| 655 | endTime = f.lifetime; |
| 656 | |
| 657 | // make thief scene nodes |
| 658 | const int numSegments = (const int)(getSegments().size()); |
| 659 | thiefNodes = new LaserSceneNode*[numSegments]; |
| 660 | |
| 661 | TextureManager& tm = TextureManager::instance(); |
| 662 | int texture = tm.getTextureID("thief"); |
| 663 | |
| 664 | for (int i = 0; i < numSegments; i++) { |
| 665 | const ShotPathSegment& segm = getSegments()[i]; |
| 666 | const float t = float(segm.end - segm.start); |
| 667 | const Ray& ray = segm.ray; |
| 668 | const fvec3& rawdir = ray.getDirection(); |
| 669 | const fvec3 dir = t * rawdir; |
| 670 | thiefNodes[i] = new LaserSceneNode(ray.getOrigin(), dir); |
| 671 | if (texture >= 0) { |
| 672 | thiefNodes[i]->setTexture(texture); |
| 673 | } |
| 674 | |
| 675 | if (i == 0) { |
| 676 | thiefNodes[i]->setFirst(); |
| 677 | } |
| 678 | |
| 679 | thiefNodes[i]->setColor(0, 1, 1); |
| 680 | thiefNodes[i]->setCenterColor(0, 0, 0); |
| 681 | } |
| 682 | setCurrentSegment(numSegments - 1); |
| 683 | } |
| 684 | |
| 685 | |
| 686 | ThiefStrategy::~ThiefStrategy() { |
nothing calls this directly
no test coverage detected