TargetLife Class Reference

#include <TargetLife.h>

List of all members.

Public Member Functions

 TargetLife (ScorchedContext &context, unsigned int playerId)
virtual ~TargetLife ()
void newGame ()
void setTargetPositionAndRotation (FixedVector &position, fixed rotation)
void setTargetPosition (FixedVector &position)
FixedVectorgetTargetPosition ()
FixedVectorgetCenterPosition ()
void setSize (FixedVector &size)
FixedVectorgetSize ()
FixedVector4getQuaternion ()
FixedVectorgetAabbSize ()
void setRotation (fixed rotation)
FixedVectorgetVelocity ()
void setVelocity (FixedVector &velocity)
void setTarget (Target *target)
void setBoundingSphere (bool sphereGeom)
bool getBoundingSphere ()
TargetSpaceContainmentgetSpaceContainment ()
VectorgetFloatPosition ()
VectorgetFloatAabbSize ()
float * getFloatRotMatrix ()
float getFloatBoundingSize ()
VectorgetFloatCenterPosition ()
fixed collisionDistance (FixedVector &position)
bool collision (FixedVector &position)
fixed getLife ()
void setLife (fixed life)
fixed getMaxLife ()
void setMaxLife (fixed life)
bool writeMessage (NetBuffer &buffer)
bool readMessage (NetBufferReader &reader)

Protected Member Functions

void updateSpace ()
void updateAABB ()

Protected Attributes

ScorchedContextcontext_
TargetSpaceContainment spaceContainment_
Targettarget_
FixedVector4 quaternion_
FixedVector targetPosition_
FixedVector velocity_
FixedVector aabbSize_
FixedVector size_
Vector floatPosition_
Vector floatAabbSize_
float floatRotMatrix_ [16]
float floatBoundingSize_
fixed life_
fixed maxLife_
bool sphereGeom_


Detailed Description

Definition at line 31 of file TargetLife.h.


Constructor & Destructor Documentation

TargetLife::TargetLife ( ScorchedContext context,
unsigned int  playerId 
)

Definition at line 34 of file TargetLife.cpp.

TargetLife::~TargetLife (  )  [virtual]

Definition at line 41 of file TargetLife.cpp.

References life_, and updateSpace().


Member Function Documentation

void TargetLife::newGame (  ) 

Definition at line 47 of file TargetLife.cpp.

References maxLife_, and setLife().

Referenced by Target::newGame().

void TargetLife::setTargetPositionAndRotation ( FixedVector position,
fixed  rotation 
)

Definition at line 78 of file TargetLife.cpp.

References FixedVector::asVector(), context_, floatPosition_, floatRotMatrix_, FixedVector4::getOpenGLRotationMatrix(), ScorchedContext::getServerMode(), quaternion_, FixedVector4::setQuatFromAxisAndAngle(), targetPosition_, updateAABB(), updateSpace(), and fixed::XPI.

Referenced by TargetMovementEntrySpline::simulate(), TargetMovementEntryShips::simulate(), and Boid2::update().

void TargetLife::setTargetPosition ( FixedVector position  ) 

Definition at line 91 of file TargetLife.cpp.

References FixedVector::asVector(), context_, floatPosition_, ScorchedContext::getServerMode(), targetPosition_, and updateSpace().

Referenced by TankFalling::collision(), TankDefinition::createTank(), TargetDefinition::createTarget(), PlacementTankPosition::flattenTankPositions(), TankMovement::moveTank(), readMessage(), Teleport::simulate(), and Resurrection::simulate().

FixedVector& TargetLife::getTargetPosition (  )  [inline]

Definition at line 42 of file TargetLife.h.

References targetPosition_.

Referenced by TankDamage::calculateDamage(), TankDamage::calculateDeath(), PlacementType::checkCloseness(), TankFalling::collision(), Lightning::damageTargets(), WeaponTankPosition::fireWeapon(), WeaponRoller::fireWeapon(), WeaponGroupSelect::fireWeapon(), getCenterPosition(), TargetSpace::getCollision(), TargetGroup::getPosition(), Boid2::getPosition(), PhysicsParticleObject::getShieldCollision(), TargetSpace::getSquares(), TankPosition::getTankPosition(), TankMovement::init(), TankFalling::init(), TankDamage::init(), MovementMap::inShield(), TargetCamera::mouseUp(), TargetRendererImpl::moved(), TankMovement::moveTank(), TankWeapon::setCurrentWeapon(), ShotState::setup(), Laser::simulate(), TankMovement::simulationMove(), tankTargetCloseness(), Boid2::update(), and ServerShotHolder::validateFiredMessage().

FixedVector & TargetLife::getCenterPosition (  ) 

Definition at line 109 of file TargetLife.cpp.

References getSize(), and getTargetPosition().

Referenced by addTank(), collision(), collisionDistance(), TargetDamageCalc::explosion(), TargetSpace::getCollisionSet(), PhysicsParticleObject::getTargetBounceCollision(), and PhysicsParticleObject::getTargetCollision().

void TargetLife::setSize ( FixedVector size  ) 

Definition at line 70 of file TargetLife.cpp.

References size_, updateAABB(), and updateSpace().

Referenced by TankDefinition::createTank(), TargetDefinition::createTarget(), and readMessage().

FixedVector& TargetLife::getSize (  )  [inline]

Definition at line 45 of file TargetLife.h.

References size_.

Referenced by PlacementObjectTarget::createObject(), Lightning::damageTargets(), RenderGeoms::drawCollisionGeoms(), getCenterPosition(), TargetRendererImplTarget::render(), TargetRendererImplTank::render(), and Laser::simulate().

FixedVector4& TargetLife::getQuaternion (  )  [inline]

Definition at line 46 of file TargetLife.h.

References quaternion_.

Referenced by RenderGeoms::drawCollisionGeoms().

FixedVector& TargetLife::getAabbSize (  )  [inline]

Definition at line 47 of file TargetLife.h.

References aabbSize_.

Referenced by RenderGeoms::drawCollisionBounds(), and TargetSpace::getSquares().

void TargetLife::setRotation ( fixed  rotation  ) 

Definition at line 99 of file TargetLife.cpp.

References context_, floatRotMatrix_, FixedVector4::getOpenGLRotationMatrix(), ScorchedContext::getServerMode(), quaternion_, FixedVector4::setQuatFromAxisAndAngle(), updateAABB(), updateSpace(), and fixed::XPI.

Referenced by TargetDefinition::createTarget(), TankMovement::moveTank(), setLife(), and TankMovement::simulationMove().

FixedVector& TargetLife::getVelocity (  )  [inline]

Definition at line 49 of file TargetLife.h.

References velocity_.

Referenced by WeaponGroupSelect::fireWeapon(), Boid2::getVelocity(), LandscapeSoundPositionSet::setPosition(), ShotState::setup(), and Boid2::update().

void TargetLife::setVelocity ( FixedVector velocity  )  [inline]

Definition at line 50 of file TargetLife.h.

References velocity_.

Referenced by TargetDefinition::createTarget(), TargetMovementEntrySpline::simulate(), and Boid2::update().

void TargetLife::setTarget ( Target target  )  [inline]

Definition at line 52 of file TargetLife.h.

References target_.

Referenced by Target::Target().

void TargetLife::setBoundingSphere ( bool  sphereGeom  ) 

Definition at line 237 of file TargetLife.cpp.

References sphereGeom_, updateAABB(), and updateSpace().

Referenced by TankDefinition::createTank(), TargetDefinition::createTarget(), and Target::Target().

bool TargetLife::getBoundingSphere (  )  [inline]

Definition at line 54 of file TargetLife.h.

References sphereGeom_.

Referenced by collisionDistance(), and RenderGeoms::drawCollisionGeoms().

TargetSpaceContainment& TargetLife::getSpaceContainment (  )  [inline]

Definition at line 55 of file TargetLife.h.

References spaceContainment_.

Referenced by TargetSpace::removeTarget(), and TargetSpace::updateTarget().

Vector& TargetLife::getFloatPosition (  )  [inline]

Definition at line 58 of file TargetLife.h.

References floatPosition_.

Referenced by TankDamage::calculateDamage(), TargetSpace::draw(), RenderGeoms::drawCollisionBounds(), RenderGeoms::drawCollisionGeoms(), TargetRendererImplTank::drawInfo(), TargetRendererImpl::drawParachute(), TargetRendererImpl::drawShield(), getFloatCenterPosition(), TargetRendererImplTarget::render(), TargetRendererImplTank::render(), TargetRendererImplTarget::renderShadow(), TargetRendererImplTank::renderShadow(), TargetParticleRenderer::simulateParticle(), and TankMovement::simulationMove().

Vector& TargetLife::getFloatAabbSize (  )  [inline]

Definition at line 59 of file TargetLife.h.

References floatAabbSize_.

Referenced by getFloatCenterPosition().

float* TargetLife::getFloatRotMatrix (  )  [inline]

Definition at line 60 of file TargetLife.h.

References floatRotMatrix_.

Referenced by TargetRendererImplTarget::render(), TargetRendererImplTank::render(), TargetRendererImplTarget::renderShadow(), and TargetRendererImplTank::renderShadow().

float TargetLife::getFloatBoundingSize (  )  [inline]

Definition at line 61 of file TargetLife.h.

References floatBoundingSize_.

Referenced by TargetRendererImpl::getTargetSize(), and TargetRendererImpl::setMovedPatch().

Vector & TargetLife::getFloatCenterPosition (  ) 

Definition at line 117 of file TargetLife.cpp.

References getFloatAabbSize(), and getFloatPosition().

Referenced by TargetRendererImpl::storeTarget2DPos().

fixed TargetLife::collisionDistance ( FixedVector position  ) 

Definition at line 125 of file TargetLife.cpp.

References getBoundingSphere(), getCenterPosition(), FixedVector4::getRelativeVector(), FixedVector::Magnitude(), MAX, quaternion_, and size_.

Referenced by TargetDamageCalc::explosion(), TargetSpace::getCollisionSet(), and PhysicsParticleObject::getTargetBounceCollision().

bool TargetLife::collision ( FixedVector position  ) 

Definition at line 189 of file TargetLife.cpp.

References aabbSize_, getCenterPosition(), FixedVector4::getRelativeVector(), FixedVector::Magnitude(), MAX, quaternion_, size_, and sphereGeom_.

Referenced by TargetSpace::getCollision(), PhysicsParticleObject::getTargetBounceCollision(), and PhysicsParticleObject::getTargetCollision().

fixed TargetLife::getLife (  )  [inline]

Definition at line 69 of file TargetLife.h.

References life_.

Referenced by TankAccessories::activate(), TankDamage::calculateDamage(), TankPosition::changePower(), TankFalling::collision(), GLWScorchedInfo::draw(), TargetRendererImplTank::drawLife(), generateTargetTip(), Target::getAlive(), TankState::getStateString(), TankAICurrentTarget::getTargets(), TankBatteryTip::itemSelected(), TankKeyboardControlUtil::keyboardCheck(), TankMovement::moveTank(), TankAICurrentMove::playMove(), TankHealthTip::populate(), ServerDefenseHandler::processDefenseMessage(), ClientDefenseHandler::processMessage(), PlayShots::processResignMessage(), TankState::setState(), ShotState::setup(), TargetRendererImplTank::simulate(), ServerAdminCommon::slapPlayer(), TankAICurrentMove::useAvailableBatteries(), and WeaponGiveLife::weaponCallback().

void TargetLife::setLife ( fixed  life  ) 

Definition at line 52 of file TargetLife.cpp.

References Target::getGroup(), life_, maxLife_, TargetGroup::removeFromAllGroups(), setRotation(), target_, updateAABB(), and updateSpace().

Referenced by TankDamage::calculateDamage(), newGame(), ServerDefenseHandler::processDefenseMessage(), ClientDefenseHandler::processMessage(), readMessage(), ComsSyncCheckMessage::readMessage(), Tank::rezTank(), TankState::setState(), ServerAdminCommon::slapPlayer(), WeaponGiveLife::weaponCallback(), and Target::~Target().

fixed TargetLife::getMaxLife (  )  [inline]

Definition at line 71 of file TargetLife.h.

References maxLife_.

Referenced by TankAccessories::activate(), TankPosition::changePower(), TargetRendererImplTank::drawLife(), generateTargetTip(), TankAICurrentTarget::getTargets(), TankBatteryTip::itemSelected(), TankKeyboardControlUtil::keyboardCheck(), TankAICurrentMove::playMove(), TankHealthTip::populate(), PlayShots::processResignMessage(), TargetRendererImplTank::simulate(), TankAICurrentMove::useAvailableBatteries(), and WeaponGiveLife::weaponCallback().

void TargetLife::setMaxLife ( fixed  life  )  [inline]

Definition at line 72 of file TargetLife.h.

References maxLife_.

Referenced by TankDefinition::createTank(), TargetDefinition::createTarget(), Tank::newGame(), and WeaponGiveLife::weaponCallback().

bool TargetLife::writeMessage ( NetBuffer buffer  ) 

Definition at line 251 of file TargetLife.cpp.

References NetBuffer::addToBuffer(), life_, maxLife_, quaternion_, size_, targetPosition_, and velocity_.

Referenced by Target::writeMessage().

bool TargetLife::readMessage ( NetBufferReader reader  ) 

Definition at line 262 of file TargetLife.cpp.

References NetBufferReader::getFromBuffer(), life_, Logger::log(), maxLife_, quaternion_, setLife(), setSize(), setTargetPosition(), and velocity_.

Referenced by Target::readMessage().

void TargetLife::updateSpace (  )  [protected]

Definition at line 245 of file TargetLife.cpp.

References context_, Target::getRenderer(), ScorchedContext::getTargetSpace(), TargetRenderer::moved(), target_, and TargetSpace::updateTarget().

Referenced by setBoundingSphere(), setLife(), setRotation(), setSize(), setTargetPosition(), setTargetPositionAndRotation(), and ~TargetLife().

void TargetLife::updateAABB (  )  [protected]

Definition at line 312 of file TargetLife.cpp.

References aabbSize_, FixedVector::asVector(), context_, floatAabbSize_, floatBoundingSize_, FixedVector4::getRelativeVector(), ScorchedContext::getServerMode(), Vector::Max(), MAX, quaternion_, size_, and sphereGeom_.

Referenced by setBoundingSphere(), setLife(), setRotation(), setSize(), and setTargetPositionAndRotation().


Member Data Documentation

ScorchedContext& TargetLife::context_ [protected]

Definition at line 79 of file TargetLife.h.

Referenced by setRotation(), setTargetPosition(), setTargetPositionAndRotation(), updateAABB(), and updateSpace().

TargetSpaceContainment TargetLife::spaceContainment_ [protected]

Definition at line 80 of file TargetLife.h.

Referenced by getSpaceContainment().

Target* TargetLife::target_ [protected]

Definition at line 81 of file TargetLife.h.

Referenced by setLife(), setTarget(), and updateSpace().

FixedVector4 TargetLife::quaternion_ [protected]

Definition at line 82 of file TargetLife.h.

Referenced by collision(), collisionDistance(), getQuaternion(), readMessage(), setRotation(), setTargetPositionAndRotation(), updateAABB(), and writeMessage().

FixedVector TargetLife::targetPosition_ [protected]

Definition at line 83 of file TargetLife.h.

Referenced by getTargetPosition(), setTargetPosition(), setTargetPositionAndRotation(), and writeMessage().

FixedVector TargetLife::velocity_ [protected]

Definition at line 84 of file TargetLife.h.

Referenced by getVelocity(), readMessage(), setVelocity(), and writeMessage().

FixedVector TargetLife::aabbSize_ [protected]

Definition at line 85 of file TargetLife.h.

Referenced by collision(), getAabbSize(), and updateAABB().

FixedVector TargetLife::size_ [protected]

Definition at line 86 of file TargetLife.h.

Referenced by collision(), collisionDistance(), getSize(), setSize(), updateAABB(), and writeMessage().

Vector TargetLife::floatPosition_ [protected]

Definition at line 87 of file TargetLife.h.

Referenced by getFloatPosition(), setTargetPosition(), and setTargetPositionAndRotation().

Vector TargetLife::floatAabbSize_ [protected]

Definition at line 88 of file TargetLife.h.

Referenced by getFloatAabbSize(), and updateAABB().

float TargetLife::floatRotMatrix_[16] [protected]

Definition at line 89 of file TargetLife.h.

Referenced by getFloatRotMatrix(), setRotation(), and setTargetPositionAndRotation().

float TargetLife::floatBoundingSize_ [protected]

Definition at line 89 of file TargetLife.h.

Referenced by getFloatBoundingSize(), and updateAABB().

fixed TargetLife::life_ [protected]

Definition at line 90 of file TargetLife.h.

Referenced by getLife(), readMessage(), setLife(), writeMessage(), and ~TargetLife().

fixed TargetLife::maxLife_ [protected]

Definition at line 91 of file TargetLife.h.

Referenced by getMaxLife(), newGame(), readMessage(), setLife(), setMaxLife(), and writeMessage().

bool TargetLife::sphereGeom_ [protected]

Definition at line 92 of file TargetLife.h.

Referenced by collision(), getBoundingSphere(), setBoundingSphere(), and updateAABB().


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