Changeset 8542 for code/branches/gameimmersion
- Timestamp:
- May 23, 2011, 3:54:40 PM (13 years ago)
- Location:
- code/branches/gameimmersion/src/modules/weapons
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.cc
r8538 r8542 59 59 } 60 60 61 /* The function called when a projectile hits another thing. 62 * calls the hit-function, starts the reload countdown, displays visual effects 63 * hit is defined in src/orxonox/worldentities/pawns/pawn.cc 64 */ 61 65 bool BasicProjectile::basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_) 62 66 { 63 67 if (!this_->getBDestroy() && GameMode::isMaster()) 64 68 { 65 if (otherObject == /*this->*/owner/*_*/) //prevents you from shooting yourself69 if (otherObject == owner) //prevents you from shooting yourself 66 70 return false; 67 71 68 this_->setBDestroy(true); // if something is hit, the object is destroyed and can't hit something else69 // instead of returning false, bDestroy is returned 72 this_->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else. 73 // The projectile is destroyed by its tick()-function (in the following tick). 70 74 71 75 Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL … … 78 82 if (victim) 79 83 { 80 victim->hit( /*this->*/owner/*_*/, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());84 victim->hit(owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage()); 81 85 victim->startReloadCountdown(); 82 86 } 83 87 84 88 // visual effects for being hit, depending on whether the shield is hit or not 85 if ( /*this->*/owner/*_*/) //if the owner does not exist (anymore??), no effects are displayed.89 if (owner) //if the owner does not exist (anymore?), no effects are displayed. 86 90 { 87 if (!victim || (victim && !victim->hasShield())) //same like below91 if (!victim || (victim && !victim->hasShield())) 88 92 { 89 93 { 90 ParticleSpawner* effect = new ParticleSpawner( /*this->*/owner/*_*/->getCreator());94 ParticleSpawner* effect = new ParticleSpawner(owner->getCreator()); 91 95 effect->setPosition(entity->getPosition()); 92 96 effect->setOrientation(entity->getOrientation()); … … 97 101 // second effect with same condition 98 102 { 99 ParticleSpawner* effect = new ParticleSpawner( /*this->*/owner/*_*/->getCreator());103 ParticleSpawner* effect = new ParticleSpawner(owner->getCreator()); 100 104 effect->setPosition(entity->getPosition()); 101 105 effect->setOrientation(entity->getOrientation()); … … 105 109 } 106 110 } 107 // victim->isAlive() is not false until the next tick, so getHealth() is used instead 111 112 // victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead 108 113 if (victim && victim->hasShield() && (this_->getDamage() > 0 || this_->getShieldDamage() > 0) && victim->getHealth() > 0) 109 114 { 110 ParticleSpawner* effect = new ParticleSpawner( /*this->*/owner/*_*/->getCreator());115 ParticleSpawner* effect = new ParticleSpawner(owner->getCreator()); 111 116 effect->setPosition(entity->getPosition()); 112 117 effect->setOrientation(entity->getOrientation()); … … 117 122 } 118 123 119 // if (victim)120 // {121 // victim->hit(/*this->*/owner/*_*/, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());122 // victim->startReloadCountdown();123 // }124 124 } 125 125 return false; 126 126 } 127 128 /* void BasicProjectile::destroyObject()129 {130 if (GameMode::isMaster())131 this->destroy();132 }133 */134 127 } -
code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.h
r8538 r8542 78 78 79 79 bool bDestroy_; 80 // Timer destroyTimer_;81 80 }; 82 81 } -
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
r8538 r8542 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 46 46 47 47 this->setConfigValues(); 48 // this->bDestroy_ = false; 49 // this->owner_ = 0; 50 // this->damage_ = 115; 51 ///////////////////me 52 // this->healthdamage_ = 0; 53 // this->shielddamage_ = 0; 54 ///////////////////end me 48 this->owner_ = 0; 55 49 56 50 // Get notification about collisions 57 58 51 if (GameMode::isMaster()) 59 52 { … … 98 91 } 99 92 93 /* Calls the collidesAgainst function of BasicProjectile 94 */ 100 95 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 101 96 { … … 103 98 } 104 99 105 //////////////////////////me edit106 /* bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)107 {108 if (!this->bDestroy_ && GameMode::isMaster())109 {110 if (otherObject == this->owner_)111 return false;112 113 this->bDestroy_ = true;114 115 Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL116 117 if (this->owner_)118 {119 if (!victim || (victim && !victim->hasShield())) //same like below120 {121 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());122 effect->setPosition(this->getPosition());123 effect->setOrientation(this->getOrientation());124 effect->setDestroyAfterLife(true);125 effect->setSource("Orxonox/explosion3");126 effect->setLifetime(2.0f);127 }128 if (!victim || (victim && !victim->hasShield())) //same like above129 {130 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());131 effect->setPosition(this->getPosition());132 effect->setOrientation(this->getOrientation());133 effect->setDestroyAfterLife(true);134 effect->setSource("Orxonox/smoke4");135 effect->setLifetime(3.0f);136 }137 if (victim && victim->hasShield())138 {139 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());140 effect->setPosition(this->getPosition());141 effect->setOrientation(this->getOrientation());142 effect->setDestroyAfterLife(true);143 effect->setSource("Orxonox/engineglow");144 effect->setLifetime(0.5f);145 }146 }147 148 if (victim)149 {150 victim->hit(this->owner_, contactPoint, this->damage_, this->healthdamage_, this->shielddamage_);151 victim->startReloadCountdown();152 }153 }154 return false;155 }156 //////////////////////////////////////////////////////////////////////end edit157 */158 100 void Projectile::setOwner(Pawn* owner) 159 101 { -
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h
r8538 r8542 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 51 51 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 52 52 53 /* inline void setDamage(float damage)54 { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION WIRD AUFGERUFEN" << endl; }55 inline float getDamage() const56 { return this->damage_; }57 */58 59 60 53 void setOwner(Pawn* owner); 61 54 inline Pawn* getOwner() const 62 55 { return this->owner_; } 63 56 64 /*///////////////////me65 66 inline void setHealthDamage(float healthdamage)67 { this->healthdamage_ = healthdamage; }68 inline float getHealthDamage() const69 { return this->healthdamage_; }70 71 inline void setShieldDamage(float shielddamage)72 { this->shielddamage_ = shielddamage; COUT(3) << "SHIELDDAMAGE SET TO " << shielddamage << endl; } //ShieldDamage wird korrekt gesettet vom XML-File73 inline float getShieldDamage() const74 { return this->shielddamage_; }75 76 ///////////////////end me77 */78 57 79 58 private: 80 59 WeakPtr<Pawn> owner_; 81 60 float lifetime_; 82 /* float damage_; 83 ///////me 84 float healthdamage_; 85 float shielddamage_; 86 ///////end me 87 bool bDestroy_; 88 */ Timer destroyTimer_; 61 Timer destroyTimer_; 89 62 }; 90 63 } -
code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.cc
r8538 r8542 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 43 43 #include "Scene.h" 44 44 45 #include "BasicProjectile.h"46 47 45 namespace orxonox 48 46 { … … 59 57 60 58 this->localAngularVelocity_ = 0; 61 // this->bDestroy_ = false;62 59 this->lifetime_ = 100; 63 60 … … 183 180 } 184 181 182 /* Calls the collidesAgainst function of BasicProjectile 183 */ 185 184 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 186 185 { 187 186 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 188 189 /* * / if (!this->bDestroy_ && GameMode::isMaster())190 {191 if (otherObject == this->owner_)192 return false;193 194 this->bDestroy_ = true;195 196 if (this->owner_)197 {198 {199 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());200 effect->setPosition(this->getPosition());201 effect->setOrientation(this->getOrientation());202 effect->setDestroyAfterLife(true);203 effect->setSource("Orxonox/explosion4");204 effect->setLifetime(2.0f);205 }206 207 {208 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());209 effect->setPosition(this->getPosition());210 effect->setOrientation(this->getOrientation());211 effect->setDestroyAfterLife(true);212 effect->setSource("Orxonox/smoke4");213 effect->setLifetime(3.0f);214 }215 }216 217 Pawn* victim = orxonox_cast<Pawn*>(otherObject);218 if (victim)219 victim->hit(this->owner_, contactPoint, this->damage_);220 // this->destroy();221 }222 / * */ return false;223 187 } 224 188 … … 237 201 void Rocket::fired(unsigned int firemode) 238 202 { 239 // if (this->owner_) 240 // { 241 this->destroy(); 242 // } 203 this->destroy(); 243 204 } 244 205 -
code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.h
r8538 r8542 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 116 116 WeakPtr<Pawn> owner_; 117 117 Vector3 localAngularVelocity_; 118 // float damage_;119 // bool bDestroy_;120 118 121 119 WeakPtr<PlayerInfo> player_; -
code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.cc
r8538 r8542 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 53 53 54 54 this->localAngularVelocity_ = 0; 55 // this->bDestroy_ = false;56 55 this->lifetime_ = 120; 57 56 58 57 this->setMass(15); 59 COUT(4) << "simplerocket constructed\n";58 // COUT(4) << "simplerocket constructed\n"; 60 59 61 60 if (GameMode::isMaster()) … … 163 162 164 163 165 166 164 /* Calls the collidesAgainst function of BasicProjectile 165 */ 167 166 bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 168 167 { 169 168 return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this); 170 /* if (!this->bDestroy_ && GameMode::isMaster())171 {172 if (otherObject == this->owner_)173 return false;174 175 this->bDestroy_ = true;176 177 if (this->owner_)178 {179 {180 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());181 effect->setPosition(this->getPosition());182 effect->setOrientation(this->getOrientation());183 effect->setDestroyAfterLife(true);184 effect->setSource("Orxonox/explosion4");185 effect->setLifetime(2.0f);186 }187 188 {189 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());190 effect->setPosition(this->getPosition());191 effect->setOrientation(this->getOrientation());192 effect->setDestroyAfterLife(true);193 effect->setSource("Orxonox/smoke4");194 effect->setLifetime(3.0f);195 }196 }197 198 float dmg = this->damage_;199 // if (this->owner_)200 // dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);201 202 Pawn* victim = orxonox_cast<Pawn*>(otherObject);203 if (victim)204 victim->hit(this->owner_, contactPoint, dmg);205 }206 return false;207 */208 169 } 209 170 -
code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.h
r8538 r8542 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 121 121 WeakPtr<Pawn> owner_; 122 122 Vector3 localAngularVelocity_; 123 // float damage_;124 // bool bDestroy_;125 123 bool fuel_; //!< Bool is true while the rocket "has fuel" 126 124 -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/EnergyDrink.cc
r8492 r8542 23 23 * Hagen Seifert 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 97 97 } 98 98 99 /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer() 100 */ 99 101 void EnergyDrink::shot() 100 102 { -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/FusionFire.cc
r8492 r8542 23 23 * Martin Polak 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 54 54 } 55 55 56 /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties 57 */ 56 58 void FusionFire::fire() 57 59 { -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/HsW01.cc
r8492 r8542 23 23 * Hagen Seifert 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 109 109 } 110 110 111 /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer() 112 */ 111 113 void HsW01::shot() 112 114 { -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/LaserFire.cc
r8492 r8542 23 23 * Martin Polak 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 51 51 } 52 52 53 /* Creates the projectile object, sets its properties to the LaserFire properties 54 */ 53 55 void LaserFire::fire() 54 56 { -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc
r8492 r8542 23 23 * Joel Smely 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 56 56 } 57 57 58 /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties 59 */ 58 60 void LightningGun::fire() 59 61 { -
code/branches/gameimmersion/src/modules/weapons/weaponmodes/RocketFire.cc
r8492 r8542 23 23 * Oliver Scheuss 24 24 * Co-authors: 25 * ...25 * simonmie 26 26 * 27 27 */ … … 59 59 } 60 60 61 /* Creates the Rocket object, sets its properties to the RocketFire properties 62 */ 61 63 void RocketFire::fire() 62 64 { … … 71 73 rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); 72 74 rocket->setDamage(this->getDamage()); 73 // rocket->setShieldDamage(this->getShieldDamage()); 75 // rocket->setShieldDamage(this->getShieldDamage()); //correct this! 74 76 // rocket->setHealthDamage(this->getHealthDamage()); 75 77 }
Note: See TracChangeset
for help on using the changeset viewer.