[Orxonox-commit 3868] r8542 - in code/branches/gameimmersion/src/modules/weapons: projectiles weaponmodes
simonmie at orxonox.net
simonmie at orxonox.net
Mon May 23 15:54:40 CEST 2011
Author: simonmie
Date: 2011-05-23 15:54:40 +0200 (Mon, 23 May 2011)
New Revision: 8542
Modified:
code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.cc
code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.h
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h
code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.cc
code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.h
code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.cc
code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.h
code/branches/gameimmersion/src/modules/weapons/weaponmodes/EnergyDrink.cc
code/branches/gameimmersion/src/modules/weapons/weaponmodes/FusionFire.cc
code/branches/gameimmersion/src/modules/weapons/weaponmodes/HsW01.cc
code/branches/gameimmersion/src/modules/weapons/weaponmodes/LaserFire.cc
code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc
code/branches/gameimmersion/src/modules/weapons/weaponmodes/RocketFire.cc
Log:
comments added, unused parts removed, some spam messages removed
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -58,15 +58,19 @@
{
}
+ /* The function called when a projectile hits another thing.
+ * calls the hit-function, starts the reload countdown, displays visual effects
+ * hit is defined in src/orxonox/worldentities/pawns/pawn.cc
+ */
bool BasicProjectile::basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_)
{
if (!this_->getBDestroy() && GameMode::isMaster())
{
- if (otherObject == /*this->*/owner/*_*/) //prevents you from shooting yourself
+ if (otherObject == owner) //prevents you from shooting yourself
return false;
- this_->setBDestroy(true); //if something is hit, the object is destroyed and can't hit something else
-// instead of returning false, bDestroy is returned
+ this_->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else.
+ // The projectile is destroyed by its tick()-function (in the following tick).
Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
@@ -77,17 +81,17 @@
// if visual effects after destruction cause problems, put this block below the effects code block
if (victim)
{
- victim->hit(/*this->*/owner/*_*/, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
+ victim->hit(owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
victim->startReloadCountdown();
}
// visual effects for being hit, depending on whether the shield is hit or not
- if (/*this->*/owner/*_*/) //if the owner does not exist (anymore??), no effects are displayed.
+ if (owner) //if the owner does not exist (anymore?), no effects are displayed.
{
- if (!victim || (victim && !victim->hasShield())) //same like below
+ if (!victim || (victim && !victim->hasShield()))
{
{
- ParticleSpawner* effect = new ParticleSpawner(/*this->*/owner/*_*/->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
@@ -96,7 +100,7 @@
}
// second effect with same condition
{
- ParticleSpawner* effect = new ParticleSpawner(/*this->*/owner/*_*/->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
@@ -104,10 +108,11 @@
effect->setLifetime(3.0f);
}
}
- // victim->isAlive() is not false until the next tick, so getHealth() is used instead
+
+ // victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead
if (victim && victim->hasShield() && (this_->getDamage() > 0 || this_->getShieldDamage() > 0) && victim->getHealth() > 0)
{
- ParticleSpawner* effect = new ParticleSpawner(/*this->*/owner/*_*/->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
@@ -116,19 +121,7 @@
}
}
-// if (victim)
-// {
-// victim->hit(/*this->*/owner/*_*/, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
-// victim->startReloadCountdown();
-// }
}
return false;
}
-
-/* void BasicProjectile::destroyObject()
- {
- if (GameMode::isMaster())
- this->destroy();
- }
-*/
}
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.h 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/BasicProjectile.h 2011-05-23 13:54:40 UTC (rev 8542)
@@ -77,7 +77,6 @@
float shielddamage_;
bool bDestroy_;
-// Timer destroyTimer_;
};
}
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -45,16 +45,9 @@
RegisterObject(Projectile);
this->setConfigValues();
-// this->bDestroy_ = false;
-// this->owner_ = 0;
-// this->damage_ = 115;
-///////////////////me
-// this->healthdamage_ = 0;
-// this->shielddamage_ = 0;
-///////////////////end me
+ this->owner_ = 0;
// Get notification about collisions
-
if (GameMode::isMaster())
{
this->setMass(1.0);
@@ -97,64 +90,13 @@
this->destroy();
}
+ /* Calls the collidesAgainst function of BasicProjectile
+ */
bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
}
-//////////////////////////me edit
-/* bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
- {
- if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
-
- if (this->owner_)
- {
- if (!victim || (victim && !victim->hasShield())) //same like below
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion3");
- effect->setLifetime(2.0f);
- }
- if (!victim || (victim && !victim->hasShield())) //same like above
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- if (victim && victim->hasShield())
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/engineglow");
- effect->setLifetime(0.5f);
- }
- }
-
- if (victim)
- {
- victim->hit(this->owner_, contactPoint, this->damage_, this->healthdamage_, this->shielddamage_);
- victim->startReloadCountdown();
- }
- }
- return false;
- }
-//////////////////////////////////////////////////////////////////////end edit
-*/
void Projectile::setOwner(Pawn* owner)
{
this->owner_ = owner;
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -50,42 +50,15 @@
virtual void tick(float dt);
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
-/* inline void setDamage(float damage)
- { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION WIRD AUFGERUFEN" << endl; }
- inline float getDamage() const
- { return this->damage_; }
-*/
-
-
void setOwner(Pawn* owner);
inline Pawn* getOwner() const
{ return this->owner_; }
-/*///////////////////me
- inline void setHealthDamage(float healthdamage)
- { this->healthdamage_ = healthdamage; }
- inline float getHealthDamage() const
- { return this->healthdamage_; }
-
- inline void setShieldDamage(float shielddamage)
- { this->shielddamage_ = shielddamage; COUT(3) << "SHIELDDAMAGE SET TO " << shielddamage << endl; } //ShieldDamage wird korrekt gesettet vom XML-File
- inline float getShieldDamage() const
- { return this->shielddamage_; }
-
-///////////////////end me
-*/
-
private:
WeakPtr<Pawn> owner_;
float lifetime_;
-/* float damage_;
-///////me
- float healthdamage_;
- float shielddamage_;
-///////end me
- bool bDestroy_;
-*/ Timer destroyTimer_;
+ Timer destroyTimer_;
};
}
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -42,8 +42,6 @@
#include "sound/WorldSound.h"
#include "Scene.h"
-#include "BasicProjectile.h"
-
namespace orxonox
{
CreateFactory(Rocket);
@@ -58,7 +56,6 @@
RegisterObject(Rocket);// - register the Rocket class to the core
this->localAngularVelocity_ = 0;
-// this->bDestroy_ = false;
this->lifetime_ = 100;
if (GameMode::isMaster())
@@ -182,44 +179,11 @@
}
}
+ /* Calls the collidesAgainst function of BasicProjectile
+ */
bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
-
-/* * / if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion4");
- effect->setLifetime(2.0f);
- }
-
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- }
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject);
- if (victim)
- victim->hit(this->owner_, contactPoint, this->damage_);
-// this->destroy();
- }
-/ * */ return false;
}
void Rocket::destroyObject()
@@ -236,10 +200,7 @@
void Rocket::fired(unsigned int firemode)
{
-// if (this->owner_)
-// {
- this->destroy();
-// }
+ this->destroy();
}
void Rocket::destructionEffect()
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.h 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Rocket.h 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -115,8 +115,6 @@
private:
WeakPtr<Pawn> owner_;
Vector3 localAngularVelocity_;
-// float damage_;
-// bool bDestroy_;
WeakPtr<PlayerInfo> player_;
Timer destroyTimer_;
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -52,11 +52,10 @@
RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
this->localAngularVelocity_ = 0;
-// this->bDestroy_ = false;
this->lifetime_ = 120;
this->setMass(15);
- COUT(4) << "simplerocket constructed\n";
+// COUT(4) << "simplerocket constructed\n";
if (GameMode::isMaster())
{
@@ -162,49 +161,11 @@
}
-
-
+ /* Calls the collidesAgainst function of BasicProjectile
+ */
bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
-/* if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion4");
- effect->setLifetime(2.0f);
- }
-
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- }
-
- float dmg = this->damage_;
-// if (this->owner_)
-// dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject);
- if (victim)
- victim->hit(this->owner_, contactPoint, dmg);
- }
- return false;
-*/
}
void SimpleRocket::destroyObject()
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.h 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/SimpleRocket.h 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -120,8 +120,6 @@
private:
WeakPtr<Pawn> owner_;
Vector3 localAngularVelocity_;
-// float damage_;
-// bool bDestroy_;
bool fuel_; //!< Bool is true while the rocket "has fuel"
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/EnergyDrink.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/EnergyDrink.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/EnergyDrink.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Hagen Seifert
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -96,6 +96,8 @@
muzzleFlash->setMaterial(this->material_);
}
+ /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer()
+ */
void EnergyDrink::shot()
{
Projectile* projectile = new Projectile(this);
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/FusionFire.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/FusionFire.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/FusionFire.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Martin Polak
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -53,6 +53,8 @@
this->setMunitionName("FusionMunition");
}
+ /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties
+ */
void FusionFire::fire()
{
BillboardProjectile* projectile = new BillboardProjectile(this);
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/HsW01.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/HsW01.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/HsW01.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Hagen Seifert
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -108,6 +108,8 @@
muzzleFlash->setMaterial(this->material_);
}
+ /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer()
+ */
void HsW01::shot()
{
assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/LaserFire.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/LaserFire.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/LaserFire.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Martin Polak
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -50,6 +50,8 @@
this->setMunitionName("LaserMunition");
}
+ /* Creates the projectile object, sets its properties to the LaserFire properties
+ */
void LaserFire::fire()
{
ParticleProjectile* projectile = new ParticleProjectile(this);
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Joel Smely
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -55,6 +55,8 @@
{
}
+ /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties
+ */
void LightningGun::fire()
{
LightningGunProjectile* projectile = new LightningGunProjectile(this);
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/RocketFire.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/RocketFire.cc 2011-05-23 13:50:13 UTC (rev 8541)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/RocketFire.cc 2011-05-23 13:54:40 UTC (rev 8542)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -58,6 +58,8 @@
{
}
+ /* Creates the Rocket object, sets its properties to the RocketFire properties
+ */
void RocketFire::fire()
{
Rocket* rocket = new Rocket(this);
@@ -70,7 +72,7 @@
rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
rocket->setDamage(this->getDamage());
-// rocket->setShieldDamage(this->getShieldDamage());
+// rocket->setShieldDamage(this->getShieldDamage()); //correct this!
// rocket->setHealthDamage(this->getHealthDamage());
}
}
More information about the Orxonox-commit
mailing list