[Orxonox-commit 3706] r8386 - in code/branches/gameimmersion: data/levels src/modules/weapons/projectiles src/modules/weapons/weaponmodes src/orxonox/controllers src/orxonox/weaponsystem src/orxonox/worldentities/pawns
simonmie at orxonox.net
simonmie at orxonox.net
Mon May 2 17:17:21 CEST 2011
Author: simonmie
Date: 2011-05-02 17:17:20 +0200 (Mon, 02 May 2011)
New Revision: 8386
Modified:
code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h
code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc
code/branches/gameimmersion/src/orxonox/controllers/Controller.h
code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.cc
code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.h
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
Log:
New shielddamage implemented, depending functions changed, bugs fixed.
LightningGun ->fire changed
Other weapons still need to be edited
Modified: code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
===================================================================
--- code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw 2011-05-02 15:17:20 UTC (rev 8386)
@@ -1,28 +1,28 @@
<LevelInfo
- name = "shield-test-01"
- description = "LEVELINFO-DESCRIPTION"
+ name = "shield-test-level"
+ description = "A simple Level with one shielded drone to shoot at"
/>
<?lua
include("HUDTemplates3.oxo")
include("stats.oxo")
- include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipImmTest.oxt")
include("templates/lodInformation.oxt")
?>
<Level
- name = "LEVEL-NAME"
+ name = "shieldTL"
description = "LEVEL-DESCRIPTION"
>
- <templates>
- <Template link=lodtemplate_default />
- </templates>
+<templates>
+ <Template link=lodtemplate_default />
+</templates>
- <Scene
+<Scene
ambientlight = "0.8, 0.5, 0.5"
skybox = "Orxonox/Starbox"
- >
+>
@@ -63,7 +63,7 @@
<?lua
for i = 1, 10, 1 do
?>
- <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipimmtest />
<?lua end ?>
<GlobalShader compositor="Bloom" visible=false>
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc 2011-05-02 15:17:20 UTC (rev 8386)
@@ -47,7 +47,11 @@
this->setConfigValues();
this->bDestroy_ = false;
this->owner_ = 0;
- this->damage_ = 15;
+ this->damage_ = 115;
+///////////////////me
+ this->healthdamage_ = 0;
+ this->shielddamage_ = 0;
+///////////////////end me
// Get notification about collisions
@@ -138,7 +142,7 @@
if (victim)
{
- victim->hit(this->owner_, contactPoint, this->damage_);
+ victim->hit(this->owner_, contactPoint, this->damage_, this->healthdamage_, this->shielddamage_);
victim->startReloadCountdown();
}
}
Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h 2011-05-02 15:17:20 UTC (rev 8386)
@@ -49,7 +49,7 @@
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
inline void setDamage(float damage)
- { this->damage_ = damage; }
+ { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION WIRD AUFGERUFEN" << endl; }
inline float getDamage() const
{ return this->damage_; }
@@ -57,10 +57,29 @@
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_;
};
Modified: code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc 2011-05-02 15:17:20 UTC (rev 8386)
@@ -68,5 +68,6 @@
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
}
}
Modified: code/branches/gameimmersion/src/orxonox/controllers/Controller.h
===================================================================
--- code/branches/gameimmersion/src/orxonox/controllers/Controller.h 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/orxonox/controllers/Controller.h 2011-05-02 15:17:20 UTC (rev 8386)
@@ -51,6 +51,12 @@
virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
+/* Override needed for different visual effects (e.g. in "NewHumanController.cc") depending on
+ the DIFFERENT AMOUNT OF DAMAGE done to the shield and to the health of "victim" (see Projectile.cc, Pawn.cc)
+
+// virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) {};
+*/
+
void setGodMode( bool mode ){ this->bGodMode_ = mode; }
bool getGodMode(){ return this->bGodMode_; }
Modified: code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.cc 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.cc 2011-05-02 15:17:20 UTC (rev 8386)
@@ -65,7 +65,10 @@
this->reloadTimer_.stopTimer();
this->damage_ = 0;
-
+///////////////////me
+ this->healthdamage_ = 0;
+ this->shielddamage_ = 0;
+///////////////////end me
this->muzzleOffset_ = Vector3::ZERO;
this->muzzlePosition_ = Vector3::ZERO;
this->muzzleOrientation_ = Quaternion::IDENTITY;
@@ -105,6 +108,10 @@
XMLPortParam(WeaponMode, "parallelreload", setParallelReload, getParallelReload, xmlelement, mode).description("If true, the weapon reloads in parallel to the magazine reloading");
XMLPortParam(WeaponMode, "damage", setDamage, getDamage, xmlelement, mode);
+//////////me
+ XMLPortParam(WeaponMode, "healthdamage", setHealthDamage, getHealthDamage, xmlelement, mode);
+ XMLPortParam(WeaponMode, "shielddamage", setShieldDamage, getShieldDamage, xmlelement, mode);
+/////////end me
XMLPortParam(WeaponMode, "muzzleoffset", setMuzzleOffset, getMuzzleOffset, xmlelement, mode);
}
Modified: code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.h 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.h 2011-05-02 15:17:20 UTC (rev 8386)
@@ -103,10 +103,22 @@
// Fire
inline void setDamage(float damage)
- { this->damage_ = damage; }
+ { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION (WeaponMode) WIRD AUFGERUFEN" << endl;}
inline float getDamage() const
{ return this->damage_; }
+////////////////////me, copied to projectile.cc
+ inline void setHealthDamage(float healthdamage)
+ { this->healthdamage_ = healthdamage; }
+ inline float getHealthDamage() const
+ { return this->healthdamage_; }
+
+ inline void setShieldDamage(float shielddamage)
+ { this->shielddamage_ = shielddamage;} //ShieldDamage wird korrekt gesettet vom XML-File
+ inline float getShieldDamage() const
+ { return this->shielddamage_; }
+
+///////////////////end me
inline void setMuzzleOffset(const Vector3& offset)
{ this->muzzleOffset_ = offset; }
inline const Vector3& getMuzzleOffset() const
@@ -145,6 +157,8 @@
bool bParallelReload_;
float damage_;
+ float healthdamage_;
+ float shielddamage_;
Vector3 muzzleOffset_;
private:
Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc 2011-05-02 15:17:20 UTC (rev 8386)
@@ -264,6 +264,46 @@
}
////////////////////end edit
+
+/////////////////////me override
+ void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
+ {
+ if (shielddamage >= this->getShieldHealth())
+ {
+ this->setShieldHealth(0);
+ this->setHealth(this->health_ - (healthdamage + damage));
+ }
+ else
+ {
+ this->setShieldHealth(this->shieldHealth_ - shielddamage);
+
+ // remove remaining shieldAbsorpton-Part of damage from shield
+ shielddamage = damage * this->shieldAbsorption_;
+ shielddamage = std::min(this->getShieldHealth(),shielddamage);
+ this->setShieldHealth(this->shieldHealth_ - shielddamage);
+
+ // set remaining damage to health
+ this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
+ }
+
+ this->lastHitOriginator_ = originator;
+
+ // play damage effect
+ }
+ COUT(3) << "neue damage-Funktion wurde aufgerufen // " << "Shield:" << this->getShieldHealth() << endl;
+ }
+
+/////////////end me
+
+
+/* HIT-Funktionen
+ Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden!
+
+*/
+
+
void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
@@ -275,6 +315,20 @@
}
}
+/////////////me override
+ void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
+ {
+ COUT(3) << "neue hit-Funktion wurde aufgerufen // " << std::flush;
+ if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
+ {
+ this->damage(damage, healthdamage, shielddamage, originator);
+ this->setVelocity(this->getVelocity() + force);
+
+ // play hit effect
+ }
+ }
+/////////////end me
+
void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
@@ -288,6 +342,22 @@
}
}
+/////////////me override
+ void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
+ {
+ COUT(3) << "neue hit2-Funktion wurde aufgerufen // shielddamage: " << shielddamage << std::flush;
+ if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
+ {
+ this->damage(damage, healthdamage, shielddamage, originator);
+
+ if ( this->getController() )
+ this->getController()->hit(originator, contactpoint, shielddamage);
+
+ // play hit effect
+ }
+ }
+/////////////end me
+
void Pawn::kill()
{
this->damage(this->health_);
Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h 2011-05-02 14:35:08 UTC (rev 8385)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h 2011-05-02 15:17:20 UTC (rev 8386)
@@ -126,6 +126,10 @@
virtual void hit(Pawn* originator, const Vector3& force, float damage);
virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
+/////////me
+ virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage);
+ virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage);
+////////end me
virtual void kill();
virtual void fired(unsigned int firemode);
@@ -182,6 +186,9 @@
virtual void spawneffect();
virtual void damage(float damage, Pawn* originator = 0);
+//////////me
+ virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
+/////////end me
bool bAlive_;
More information about the Orxonox-commit
mailing list