Lightning Class Reference

#include <Lightning.h>

Inheritance diagram for Lightning:

ActionReferenced Action

List of all members.

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< Segmentsegments_
GLTexturetexture_
WeaponLightningweapon_
FixedVector position_
FixedVector velocity_
WeaponFireContext weaponContext_

Classes

struct  Segment


Detailed Description

Definition at line 30 of file Lightning.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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().


Member Data Documentation

bool Lightning::firstTime_ [protected]

Definition at line 52 of file Lightning.h.

Referenced by simulate().

fixed Lightning::totalTime_ [protected]

Definition at line 53 of file Lightning.h.

Referenced by draw(), and simulate().

std::list<Segment> Lightning::segments_ [protected]

Definition at line 54 of file Lightning.h.

Referenced by draw(), and generateLightning().

GLTexture* Lightning::texture_ [protected]

Definition at line 56 of file Lightning.h.

Referenced by draw().

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]

Definition at line 59 of file Lightning.h.

Referenced by getActionDetails(), and init().

WeaponFireContext Lightning::weaponContext_ [protected]

Definition at line 60 of file Lightning.h.

Referenced by damageTargets(), and init().


The documentation for this class was generated from the following files:
Generated on Mon Feb 16 15:15:03 2009 for Scorched3D by  doxygen 1.5.3