[Orxonox-commit 362] r2969 - in branches/weapons/src/orxonox/objects: weaponsystem/projectiles weaponsystem/weaponmodes worldentities
jsmely at orxonox.net
jsmely at orxonox.net
Mon May 11 15:58:38 CEST 2009
Author: jsmely
Date: 2009-05-11 15:58:38 +0200 (Mon, 11 May 2009)
New Revision: 2969
Added:
branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
Modified:
branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc
branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h
branches/weapons/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt
branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
branches/weapons/src/orxonox/objects/worldentities/Billboard.cc
branches/weapons/src/orxonox/objects/worldentities/Billboard.h
Log:
weapon updated
Modified: branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc 2009-05-11 13:37:19 UTC (rev 2968)
+++ branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc 2009-05-11 13:58:38 UTC (rev 2969)
@@ -63,6 +63,11 @@
{
this->billboard_.setColour(colour);
}
+
+ void BillboardProjectile::setMaterial(const std::string& material)
+ {
+ this->billboard_.setMaterial(material);
+ }
void BillboardProjectile::changedVisibility()
{
Modified: branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h 2009-05-11 13:37:19 UTC (rev 2968)
+++ branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h 2009-05-11 13:58:38 UTC (rev 2969)
@@ -44,6 +44,7 @@
virtual ~BillboardProjectile();
virtual void setColour(const ColourValue& colour);
+ virtual void setMaterial(const std::string& material);
virtual void changedVisibility();
private:
Modified: branches/weapons/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt 2009-05-11 13:37:19 UTC (rev 2968)
+++ branches/weapons/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt 2009-05-11 13:58:38 UTC (rev 2969)
@@ -2,4 +2,5 @@
BillboardProjectile.cc
ParticleProjectile.cc
Projectile.cc
+ LightningGunProjectile.cc
)
Added: branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc 2009-05-11 13:58:38 UTC (rev 2969)
@@ -0,0 +1,67 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Joel Smely
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "LightningGunProjectile.h"
+
+#include <OgreBillboardSet.h>
+
+#include "core/GameMode.h"
+#include "core/CoreIncludes.h"
+#include "objects/Scene.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ CreateFactory(LightningGunProjectile);
+
+ LightningGunProjectile::LightningGunProjectile(BaseObject* creator) : BillboardProjectile(creator)
+ {
+ RegisterObject(LightningGunProjectile);
+
+ this->textureIndex_ = 1;
+ this->maxTextureIndex_ = 8;
+ this->textureTimer_.setTimer(0.01, true, this, createExecutor(createFunctor(&LightningGunProjectile::changeTexture)));
+ }
+
+ void LightningGunProjectile::setMaterial(const std::string& material)
+ {
+ this->materialBase_ = material;
+
+ BillboardProjectile::setMaterial(material + convertToString(this->textureIndex_));
+ }
+
+ void LightningGunProjectile::changeTexture()
+ {
+ this->textureIndex_++;
+ if (this->textureIndex_ > this->maxTextureIndex_)
+ this->textureIndex_ = 1;
+
+ this->setMaterial(this->materialBase_);
+ }
+}
Added: branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h 2009-05-11 13:58:38 UTC (rev 2969)
@@ -0,0 +1,57 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Joel Smely
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _LightningGunProjectile_H__
+#define _LightningGunProjectile_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "tools/Timer.h"
+
+#include "BillboardProjectile.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport LightningGunProjectile : public BillboardProjectile
+ {
+ public:
+ LightningGunProjectile(BaseObject* creator);
+ virtual ~LightningGunProjectile() {}
+
+ virtual void setMaterial(const std::string& material);
+
+ protected:
+ void changeTexture();
+ unsigned int textureIndex_;
+ unsigned int maxTextureIndex_;
+ Timer<LightningGunProjectile> textureTimer_;
+ std::string materialBase_;
+ };
+}
+
+#endif /* _LightningGunProjectile_H__ */
Modified: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-11 13:37:19 UTC (rev 2968)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-11 13:58:38 UTC (rev 2969)
@@ -1,4 +1,5 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
FusionFire.cc
LaserFire.cc
+ LightningGun.cc
)
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc 2009-05-11 13:58:38 UTC (rev 2969)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Joel Smely
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "LightningGun.h"
+
+#include "core/CoreIncludes.h"
+
+#include "objects/worldentities/Billboard.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+#include "objects/weaponsystem/projectiles/LightningGunProjectile.h"
+
+#include "util/Math.h"
+
+namespace orxonox
+{
+ CreateFactory(LightningGun);
+
+ LightningGun::LightningGun(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(LightningGun);
+
+ this->reloadTime_ = 1;
+ this->damage_ = 100;
+ this->speed_ = 150;
+
+ this->setMunitionName("LaserMunition");
+ }
+
+ LightningGun::~LightningGun()
+ {
+ }
+
+ void LightningGun::fire()
+ {
+ LightningGunProjectile* projectile = new LightningGunProjectile(this);
+ projectile->setMaterial("Flares/LightningBall_");
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+ projectile->setAcceleration(this->getMuzzleDirection() * 1000);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+ }
+}
Added: branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h (rev 0)
+++ branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h 2009-05-11 13:58:38 UTC (rev 2969)
@@ -0,0 +1,49 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Joel Smely
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _LightningGun_H__
+#define _LightningGun_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport LightningGun : public WeaponMode
+ {
+ public:
+ LightningGun(BaseObject* creator);
+ virtual ~LightningGun();
+
+ virtual void fire();
+ private:
+ float speed_;
+ };
+}
+
+#endif /* _LightningGun_H__ */
Modified: branches/weapons/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- branches/weapons/src/orxonox/objects/worldentities/Billboard.cc 2009-05-11 13:37:19 UTC (rev 2968)
+++ branches/weapons/src/orxonox/objects/worldentities/Billboard.cc 2009-05-11 13:58:38 UTC (rev 2969)
@@ -46,6 +46,7 @@
this->material_ = "";
this->colour_ = ColourValue::White;
+// this->rotation_ = 0;
this->registerVariables();
}
@@ -65,12 +66,14 @@
XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
XMLPortParam(Billboard, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White);
+// XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
}
void Billboard::registerVariables()
{
registerVariable(this->material_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
registerVariable(this->colour_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
+// registerVariable(this->rotation_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
}
void Billboard::changedMaterial()
@@ -86,6 +89,7 @@
if (this->billboard_.getBillboardSet())
this->attachOgreObject(this->billboard_.getBillboardSet());
this->billboard_.setVisible(this->isVisible());
+// this->changedRotation();
}
}
else
@@ -109,6 +113,14 @@
else
this->billboard_.setColour(this->colour_);
}
+
+/*
+ void Billboard::changedRotation()
+ {
+ if (this->billboard_.getBillboardSet())
+ this->billboard_.getBillboardSet()->setRotation(this->rotation_);
+ }
+*/
void Billboard::changedVisibility()
{
Modified: branches/weapons/src/orxonox/objects/worldentities/Billboard.h
===================================================================
--- branches/weapons/src/orxonox/objects/worldentities/Billboard.h 2009-05-11 13:37:19 UTC (rev 2968)
+++ branches/weapons/src/orxonox/objects/worldentities/Billboard.h 2009-05-11 13:58:38 UTC (rev 2969)
@@ -60,7 +60,12 @@
{ this->colour_ = colour; this->changedColour(); }
inline const ColourValue& getColour() const
{ return this->colour_; }
-
+/*
+ inline void setRotation(const Radian& rotation)
+ { this->rotation_ = rotation; this->changedRotation(); }
+ inline const Radian& getRotation() const
+ { return this->rotation_; }
+*/
virtual void setTeamColour(const ColourValue& colour)
{ this->setColour(colour); }
@@ -72,10 +77,12 @@
private:
void changedMaterial();
+// void changedRotation();
BillboardSet billboard_;
std::string material_;
ColourValue colour_;
+// Radian rotation_;
};
}
More information about the Orxonox-commit
mailing list