#include <Lightning.h>

Public Member Functions | |
| Lightning (WeaponLightning *weapon, WeaponFireContext &weaponContext, FixedVector &position, FixedVector &velocity) | |
| virtual | ~Lightning () |
| virtual void | draw () |
| virtual void | init () |
| virtual void | simulate (fixed frameTime, bool &remove) |
| virtual std::string | getActionDetails () |
Protected Member Functions | |
| void | damageTargets (FixedVector &position, std::map< unsigned int, fixed > &hurtMap) |
| void | dispaceDirection (FixedVector &direction, FixedVector &originalDirection, fixed angle) |
| void | generateLightning (int id, int depth, fixed size, FixedVector &originalPosition, FixedVector &originalDirection, FixedVector &position, FixedVector &direction, std::map< unsigned int, fixed > &hurtMap) |
Protected Attributes | |
| bool | firstTime_ |
| fixed | totalTime_ |
| std::list< Segment > | segments_ |
| GLTexture * | texture_ |
| WeaponLightning * | weapon_ |
| FixedVector | position_ |
| FixedVector | velocity_ |
| WeaponFireContext | weaponContext_ |
Classes | |
| struct | Segment |
Definition at line 30 of file Lightning.h.
| Lightning::Lightning | ( | WeaponLightning * | weapon, | |
| WeaponFireContext & | weaponContext, | |||
| FixedVector & | position, | |||
| FixedVector & | velocity | |||
| ) |
Definition at line 39 of file Lightning.cpp.
| Lightning::~Lightning | ( | ) | [virtual] |
Definition at line 51 of file Lightning.cpp.
| void Lightning::draw | ( | ) | [virtual] |
Reimplemented from Action.
Definition at line 116 of file Lightning.cpp.
References fixed::asFloat(), FixedVector::asVector(), GLState::BLEND_ON, Action::context_, Lightning::Segment::direction, GLTexture::draw(), Lightning::Segment::end, Lightning::Segment::endsegment, GLCamera::getCurrentCamera(), GLCamera::getCurrentPos(), S3D::getDataFile(), ScorchedContext::getServerMode(), WeaponLightning::getTexture(), WeaponLightning::getTotalTime(), GL_FALSE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_QUAD_STRIP, GL_SRC_ALPHA, GL_TRUE, glBegin(), glBlendFunc(), glColor4f(), glDepthMask(), glEnd(), glTexCoord2f(), glVertex3fv(), TextureStore::instance(), TextureStore::loadTexture(), segments_, Lightning::Segment::size, Lightning::Segment::start, texture_, GLState::TEXTURE_ON, totalTime_, and weapon_.
| void Lightning::init | ( | ) | [virtual] |
Implements Action.
Definition at line 55 of file Lightning.cpp.
References Action::context_, TargetDamageCalc::damageTarget(), generateLightning(), WeaponLightning::getSize(), TargetContainer::getTargetById(), ScorchedContext::getTargetContainer(), FixedVector::Normalize(), position_, velocity_, weapon_, and weaponContext_.
| void Lightning::simulate | ( | fixed | frameTime, | |
| bool & | remove | |||
| ) | [virtual] |
Reimplemented from Action.
Definition at line 90 of file Lightning.cpp.
References FixedVector::asVector(), Action::context_, VirtualSoundPriority::eAction, Sound::fetchOrCreateBuffer(), firstTime_, S3D::getDataFile(), ScorchedContext::getServerMode(), WeaponLightning::getSound(), WeaponLightning::getTotalTime(), Sound::instance(), SoundUtils::playAbsoluteSound(), position_, Action::simulate(), LangStringUtil::strcmp(), totalTime_, and weapon_.
| std::string Lightning::getActionDetails | ( | ) | [virtual] |
Reimplemented from Action.
Definition at line 82 of file Lightning.cpp.
References S3D::formatStringBuffer(), Accessory::getName(), AccessoryPart::getParent(), position_, velocity_, and weapon_.
| void Lightning::damageTargets | ( | FixedVector & | position, | |
| std::map< unsigned int, fixed > & | hurtMap | |||
| ) | [protected] |
Definition at line 284 of file Lightning.cpp.
References Action::context_, Target::getAlive(), TargetSpace::getCollisionSet(), Target::getLife(), WeaponFireContext::getPlayerId(), Target::getPlayerId(), WeaponLightning::getSegHurt(), WeaponLightning::getSegHurtRadius(), TargetLife::getSize(), TargetLife::getTargetPosition(), ScorchedContext::getTargetSpace(), MAX, weapon_, and weaponContext_.
Referenced by generateLightning().
| void Lightning::dispaceDirection | ( | FixedVector & | direction, | |
| FixedVector & | originalDirection, | |||
| fixed | angle | |||
| ) | [protected] |
Definition at line 182 of file Lightning.cpp.
References Action::context_, ScorchedContext::getActionController(), WeaponLightning::getDerivAngle(), RandomGenerator::getRandFixed(), ActionController::getRandom(), FixedVector::StoreNormalize(), and weapon_.
Referenced by generateLightning().
| void Lightning::generateLightning | ( | int | id, | |
| int | depth, | |||
| fixed | size, | |||
| FixedVector & | originalPosition, | |||
| FixedVector & | originalDirection, | |||
| FixedVector & | position, | |||
| FixedVector & | direction, | |||
| std::map< unsigned int, fixed > & | hurtMap | |||
| ) | [protected] |
Definition at line 213 of file Lightning.cpp.
References Action::context_, damageTargets(), Lightning::Segment::direction, dispaceDirection(), Lightning::Segment::end, Lightning::Segment::endsegment, ScorchedContext::getActionController(), WeaponLightning::getAngleVar(), WeaponLightning::getConeLength(), WeaponLightning::getDeathProb(), WeaponLightning::getMinSize(), RandomGenerator::getRandFixed(), ActionController::getRandom(), WeaponLightning::getSegLength(), WeaponLightning::getSegVar(), WeaponLightning::getSizeVar(), WeaponLightning::getSplitProb(), WeaponLightning::getSplitVar(), segments_, Lightning::Segment::size, Lightning::Segment::start, and weapon_.
Referenced by init().
bool Lightning::firstTime_ [protected] |
fixed Lightning::totalTime_ [protected] |
std::list<Segment> Lightning::segments_ [protected] |
GLTexture* Lightning::texture_ [protected] |
WeaponLightning* Lightning::weapon_ [protected] |
Definition at line 57 of file Lightning.h.
Referenced by damageTargets(), dispaceDirection(), draw(), generateLightning(), getActionDetails(), init(), and simulate().
FixedVector Lightning::position_ [protected] |
Definition at line 58 of file Lightning.h.
Referenced by getActionDetails(), init(), and simulate().
FixedVector Lightning::velocity_ [protected] |
WeaponFireContext Lightning::weaponContext_ [protected] |
1.5.3