Changeset 11071 for code/trunk/src/modules/weapons/projectiles
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
r11052 r11071 88 88 // The projectile is destroyed by its tick()-function (in the following tick). 89 89 90 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is NULL90 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is nullptr 91 91 92 92 WorldEntity* entity = orxonox_cast<WorldEntity*>(this); … … 146 146 bool BasicProjectile::isObjectRelatedToShooter(WorldEntity* otherObject) 147 147 { 148 for (WorldEntity* shooter = this->getShooter(); shooter != NULL; shooter = shooter->getParent())148 for (WorldEntity* shooter = this->getShooter(); shooter != nullptr; shooter = shooter->getParent()) 149 149 if (otherObject == shooter) 150 150 return true; 151 for (WorldEntity* object = otherObject; object != NULL; object = object->getParent())151 for (WorldEntity* object = otherObject; object != nullptr; object = object->getParent()) 152 152 if (otherObject == this->getShooter()) 153 153 return true; -
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
r10629 r11071 61 61 virtual void setMaterial(const std::string& material); 62 62 virtual const std::string& getMaterial(); 63 virtual void changedVisibility() ;63 virtual void changedVisibility() override; 64 64 65 65 private: -
code/trunk/src/modules/weapons/projectiles/GravityBomb.cc
r10622 r11071 28 28 this->timeToLife_= LIFETIME; 29 29 this->setCollisionResponse(false); 30 this->setCollisionType(WorldEntity:: Dynamic);30 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 31 31 this->enableCollisionCallback(); 32 32 -
code/trunk/src/modules/weapons/projectiles/GravityBomb.h
r10622 r11071 41 41 GravityBomb(Context* context); 42 42 virtual ~GravityBomb(); 43 virtual void tick(float dt) ;43 virtual void tick(float dt) override; 44 44 45 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;45 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 46 46 void detonate(); 47 47 private: -
code/trunk/src/modules/weapons/projectiles/GravityBombField.cc
r11052 r11071 41 41 //Make the Field visible on Radar and minimap. 42 42 this->setRadarObjectColour(ColourValue(1.0, 0.0, 0.2,1)); // Red 43 this->setRadarObjectShape(RadarViewable:: Dot);43 this->setRadarObjectShape(RadarViewable::Shape::Dot); 44 44 this->setRadarObjectScale(1.0f); 45 45 … … 125 125 126 126 //Check if any pawn is inside the shockwave and hit it with dammage proportional to the distance between explosion centre and pawn. Make sure, the same pawn is damaged only once. 127 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)127 for (Pawn* pawn : ObjectList<Pawn>()) 128 128 { 129 Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();129 Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition(); 130 130 //orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl; 131 131 if(distanceVector.length()< forceSphereRadius_) 132 132 { 133 133 //orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length(); 134 if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(), *it) == victimsAlreadyDamaged_.end())134 if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),pawn) == victimsAlreadyDamaged_.end()) 135 135 { 136 136 //orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl; 137 137 float damage = FORCE_FIELD_EXPLOSION_DAMMAGE*(1-distanceVector.length()/EXPLOSION_RADIUS); 138 138 //orxout(debug_output) << "Damage: " << damage << endl; 139 it->hit(shooter_, it->getWorldPosition(), NULL, damage, 0,0);140 victimsAlreadyDamaged_.push_back( *it);139 pawn->hit(shooter_, pawn->getWorldPosition(), nullptr, damage, 0,0); 140 victimsAlreadyDamaged_.push_back(pawn); 141 141 } 142 142 } -
code/trunk/src/modules/weapons/projectiles/GravityBombField.h
r10622 r11071 39 39 GravityBombField(Context* context); 40 40 virtual ~GravityBombField(); 41 virtual void tick(float dt) ;41 virtual void tick(float dt) override; 42 42 virtual void destroy(); 43 43 -
code/trunk/src/modules/weapons/projectiles/IceGunProjectile.cc
r11052 r11071 120 120 Vector3 offset = this->getWorldPosition() - otherObject->getWorldPosition(); 121 121 freezer->setPosition(Vector3(0,0,0)); 122 freezer->translate(offset, WorldEntity:: World);122 freezer->translate(offset, WorldEntity::TransformSpace::World); 123 123 // Start the freezing effect. 124 124 freezer->startFreezing(); -
code/trunk/src/modules/weapons/projectiles/IceGunProjectile.h
r11052 r11071 62 62 63 63 protected: 64 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;64 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 65 65 static const float particleDestructionDelay_; 66 66 private: -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
r10622 r11071 48 48 this->textureIndex_ = 1; 49 49 this->setMass(2); 50 this->setCollisionType( Dynamic);50 this->setCollisionType(CollisionType::Dynamic); 51 51 this->maxTextureIndex_ = 8; 52 52 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
r9667 r11071 58 58 virtual ~LightningGunProjectile() {} 59 59 60 virtual void setMaterial(const std::string& material) ;60 virtual void setMaterial(const std::string& material) override; 61 61 62 62 private: -
code/trunk/src/modules/weapons/projectiles/MineProjectile.cc
r11052 r11071 112 112 modelRing4_->yaw(Degree(270)); 113 113 114 emitter_ = NULL;114 emitter_ = nullptr; 115 115 116 116 if (GameMode::isMaster()) … … 121 121 this->enableCollisionCallback(); 122 122 this->setCollisionResponse(true); 123 this->setCollisionType( Dynamic);123 this->setCollisionType(CollisionType::Dynamic); 124 124 125 125 // Create a sphere collision shape and attach it to the projectile. … … 217 217 { 218 218 // Damage all pawns within the damage radius 219 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)219 for (Pawn* pawn : ObjectList<Pawn>()) 220 220 { 221 Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();221 Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition(); 222 222 if(distanceVector.length()< damageRadius_) 223 223 { 224 it->hit(this->getShooter(), it->getWorldPosition(), NULL, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());224 pawn->hit(this->getShooter(), pawn->getWorldPosition(), nullptr, this->getDamage(), this->getHealthDamage(), this->getShieldDamage()); 225 225 } 226 226 } -
code/trunk/src/modules/weapons/projectiles/MineProjectile.h
r11052 r11071 57 57 virtual ~MineProjectile(); 58 58 59 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;59 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 60 60 61 v irtual void setMaxTimeUntilExplosion(float maxTimeUntilExplosion);62 v irtual void setTimeUntilActivation(float timeUntilActivation);61 void setMaxTimeUntilExplosion(float maxTimeUntilExplosion); 62 void setTimeUntilActivation(float timeUntilActivation); 63 63 protected: 64 64 static const float triggerRadius_; … … 84 84 WeakPtr<DistanceTrigger> distanceTrigger_; 85 85 86 v irtual void destructionEffect();87 v irtual void allowExplosion();88 v irtual void explode();86 void destructionEffect(); 87 void allowExplosion(); 88 void explode(); 89 89 }; 90 90 } -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
r10624 r11071 58 58 } 59 59 else 60 this->particles_ = 0;60 this->particles_ = nullptr; 61 61 } 62 62 -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
r9667 r11071 53 53 ParticleProjectile(Context* context); 54 54 virtual ~ParticleProjectile(); 55 virtual void changedVisibility() ;55 virtual void changedVisibility() override; 56 56 57 57 private: -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r10629 r11071 57 57 this->enableCollisionCallback(); 58 58 this->setCollisionResponse(false); 59 this->setCollisionType( Dynamic);59 this->setCollisionType(CollisionType::Dynamic); 60 60 61 61 // Create a sphere collision shape and attach it to the projectile. … … 94 94 void Projectile::setCollisionShapeRadius(float radius) 95 95 { 96 if (collisionShape_ != NULL&& radius > 0)96 if (collisionShape_ != nullptr && radius > 0) 97 97 { 98 98 collisionShape_->setRadius(radius); -
code/trunk/src/modules/weapons/projectiles/Projectile.h
r11052 r11071 64 64 void setConfigValues(); 65 65 66 virtual void tick(float dt) ;67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;66 virtual void tick(float dt) override; 67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 68 68 69 69 protected: -
code/trunk/src/modules/weapons/projectiles/Rocket.cc
r11052 r11071 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->setVelocity(0,0,-100); 74 74 … … 92 92 this->enableCollisionCallback(); 93 93 this->setCollisionResponse(false); 94 this->setCollisionType( Kinematic);94 this->setCollisionType(CollisionType::Kinematic); 95 95 96 96 // Add collision shape … … 117 117 else 118 118 { 119 this->defSndWpnEngine_ = 0;120 this->defSndWpnLaunch_ = 0;119 this->defSndWpnEngine_ = nullptr; 120 this->defSndWpnLaunch_ = nullptr; 121 121 } 122 122 … … 128 128 129 129 this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange 130 this->setRadarObjectShape(RadarViewable:: Triangle);130 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 131 131 this->setRadarObjectScale(0.5f); 132 132 } -
code/trunk/src/modules/weapons/projectiles/Rocket.h
r11052 r11071 62 62 virtual ~Rocket(); 63 63 64 virtual void tick(float dt) ; //!< Defines which actions the Rocket has to take in each tick.64 virtual void tick(float dt) override; //!< Defines which actions the Rocket has to take in each tick. 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;67 virtual void destroyObject(void) ;66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 67 virtual void destroyObject(void) override; 68 68 void destructionEffect(); 69 69 70 virtual void moveFrontBack(const Vector2& value) {}71 virtual void moveRightLeft(const Vector2& value) {}72 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) override {} 71 virtual void moveRightLeft(const Vector2& value) override {} 72 virtual void moveUpDown(const Vector2& value) override {} 73 73 74 virtual void rotateYaw(const Vector2& value) ;75 virtual void rotatePitch(const Vector2& value) ;76 virtual void rotateRoll(const Vector2& value) ;74 virtual void rotateYaw(const Vector2& value) override; 75 virtual void rotatePitch(const Vector2& value) override; 76 virtual void rotateRoll(const Vector2& value) override; 77 77 78 78 /** … … 114 114 { this->rotateRoll(Vector2(value, 0)); } 115 115 116 virtual void setShooter(Pawn* shooter) ;116 virtual void setShooter(Pawn* shooter) override; 117 117 118 virtual void fired(unsigned int firemode) ;118 virtual void fired(unsigned int firemode) override; 119 119 120 120 /** 121 121 @brief Set the maximum lifetime of the rocket. 122 122 */ 123 v irtual void setMaxFuel(float fuel);123 void setMaxFuel(float fuel); 124 124 /** 125 125 @brief Get the maximum lifetime of the rocket. … … 127 127 inline float getMaxFuel() const 128 128 { return lifetime_; } 129 virtualfloat getFuel() const;129 float getFuel() const; 130 130 131 131 private: -
code/trunk/src/modules/weapons/projectiles/RocketOld.cc
r10622 r11071 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->setVelocity(0,0,-100); 74 74 … … 92 92 this->enableCollisionCallback(); 93 93 this->setCollisionResponse(false); 94 this->setCollisionType( Kinematic);94 this->setCollisionType(CollisionType::Kinematic); 95 95 96 96 // Add collision shape … … 117 117 else 118 118 { 119 this->defSndWpnEngine_ = 0;120 this->defSndWpnLaunch_ = 0;119 this->defSndWpnEngine_ = nullptr; 120 this->defSndWpnLaunch_ = nullptr; 121 121 } 122 122 … … 128 128 129 129 this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange 130 this->setRadarObjectShape(RadarViewable:: Triangle);130 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 131 131 this->setRadarObjectScale(0.5f); 132 132 } -
code/trunk/src/modules/weapons/projectiles/RocketOld.h
r10622 r11071 62 62 virtual ~RocketOld(); 63 63 64 virtual void tick(float dt) ; //!< Defines which actions the RocketOld has to take in each tick.64 virtual void tick(float dt) override; //!< Defines which actions the RocketOld has to take in each tick. 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;67 virtual void destroyObject(void) ;66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 67 virtual void destroyObject(void) override; 68 68 void destructionEffect(); 69 69 70 virtual void moveFrontBack(const Vector2& value) {}71 virtual void moveRightLeft(const Vector2& value) {}72 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) override {} 71 virtual void moveRightLeft(const Vector2& value) override {} 72 virtual void moveUpDown(const Vector2& value) override {} 73 73 74 virtual void rotateYaw(const Vector2& value) ;75 virtual void rotatePitch(const Vector2& value) ;76 virtual void rotateRoll(const Vector2& value) ;74 virtual void rotateYaw(const Vector2& value) override; 75 virtual void rotatePitch(const Vector2& value) override; 76 virtual void rotateRoll(const Vector2& value) override; 77 77 78 78 /** … … 114 114 { this->rotateRoll(Vector2(value, 0)); } 115 115 116 virtual void setShooter(Pawn* shooter) ;116 virtual void setShooter(Pawn* shooter) override; 117 117 118 virtual void fired(unsigned int firemode) ;118 virtual void fired(unsigned int firemode) override; 119 119 120 120 private: -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
r11052 r11071 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->fuel_ = true; 74 74 … … 87 87 this->enableCollisionCallback(); 88 88 this->setCollisionResponse(false); 89 this->setCollisionType( Kinematic);89 this->setCollisionType(CollisionType::Kinematic); 90 90 91 91 // Add collision shape. … … 101 101 102 102 this->setRadarObjectColour(ColourValue(1.0, 1.0, 0.0)); // yellow 103 this->setRadarObjectShape(RadarViewable:: Triangle);103 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 104 104 this->setRadarObjectScale(0.5f); 105 105 } -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
r10216 r11071 62 62 SimpleRocket(Context* context); 63 63 virtual ~SimpleRocket(); 64 virtual void tick(float dt) ;64 virtual void tick(float dt) override; 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 67 67 68 68 void disableFire(); //!< Method to disable the fire and stop all acceleration 69 69 70 virtual void moveFrontBack(const Vector2& value) {}71 virtual void moveRightLeft(const Vector2& value) {}72 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) override{} 71 virtual void moveRightLeft(const Vector2& value) override{} 72 virtual void moveUpDown(const Vector2& value) override{} 73 73 74 virtual void rotateYaw(const Vector2& value) ;75 virtual void rotatePitch(const Vector2& value) ;76 virtual void rotateRoll(const Vector2& value) ;74 virtual void rotateYaw(const Vector2& value) override; 75 virtual void rotatePitch(const Vector2& value) override; 76 virtual void rotateRoll(const Vector2& value) override; 77 77 void setDestroy(); 78 78 … … 115 115 { this->rotateRoll(Vector2(value, 0)); } 116 116 117 virtual void setShooter(Pawn* shooter) ;117 virtual void setShooter(Pawn* shooter) override; 118 118 119 119 inline bool hasFuel() const
Note: See TracChangeset
for help on using the changeset viewer.