[Orxonox-commit 6533] r11174 - in code/branches/sagerjFS16/src: modules/weapons/weaponmodes orxonox/controllers orxonox/weaponsystem orxonox/worldentities orxonox/worldentities/pawns
sagerj at orxonox.net
sagerj at orxonox.net
Thu Apr 21 16:47:39 CEST 2016
Author: sagerj
Date: 2016-04-21 16:47:39 +0200 (Thu, 21 Apr 2016)
New Revision: 11174
Modified:
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc
code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h
code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc
code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h
code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc
code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h
code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc
code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.h
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.h
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.h
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc
code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h
code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc
code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.h
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h
Log:
everything beneath weaponmode changed to push/release - wm modified only need to implement timer/ticker
Modified: code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc
===================================================================
--- code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -53,7 +53,7 @@
this->reloadTime_ = 0.23f;
this->damage_ = 90.01f;
this->speed_ = 90.01f;
- this->charges_ = 0;
+ this->chargeable_ = 0;
this->setMunitionName("LaserMunition");
this->setFireSound("sounds/Weapon_LaserFire.ogg");
@@ -64,13 +64,7 @@
void Discharger::fire()
{
- charges_ += 1;
- orxout() << "c = " << charges_ << endl;
- }
-
- void Discharger::release()
- {
- orxout() << "release c = " << charges_ << endl;
+ orxout() << "release" << cTime_ << endl;
BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
Modified: code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h
===================================================================
--- code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/modules/weapons/weaponmodes/Discharger.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -47,6 +47,7 @@
Johannes Sager
@ingroup WeaponsWeaponModes
*/
+
class _WeaponsExport Discharger : public WeaponMode
{
public:
@@ -54,11 +55,11 @@
virtual ~Discharger() {}
virtual void fire() override;
- virtual void release() override;
private:
- float speed_; // The speed of the fired projectile.
- unsigned int charges_; // An indicator of how much you charged up.
+ bool chargeable_; // An indicator that this weapon type is chargeable.
+ float speed_; // The speed of the fired projectile.
+ float ctime_; // time the weapon has charged.
};
}
Modified: code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/controllers/HumanController.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -39,7 +39,7 @@
namespace orxonox
{
- extern const std::string __CC_fire_name = "fire";
+ extern const std::string __CC_push_name = "push";
extern const std::string __CC_suicide_name = "suicide";
extern const std::string __CC_release_name = "release";
@@ -51,7 +51,7 @@
SetConsoleCommand("HumanController", "rotateRoll", &HumanController::rotateRoll ).addShortcut().setAsInputCommand();
SetConsoleCommand("HumanController", "toggleFormationFlight", &HumanController::toggleFormationFlight).addShortcut().keybindMode(KeybindMode::OnPress);
SetConsoleCommand("HumanController", "FFChangeMode", &HumanController::FFChangeMode).addShortcut().keybindMode(KeybindMode::OnPress);
- SetConsoleCommand("HumanController", __CC_fire_name, &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);
+ SetConsoleCommand("HumanController", __CC_push_name, &HumanController::push ).addShortcut().keybindMode(KeybindMode::OnHold);
SetConsoleCommand("HumanController", __CC_release_name, &HumanController::release ).addShortcut().keybindMode(KeybindMode::OnRelease);
SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut();
SetConsoleCommand("HumanController", "boost", &HumanController::boost ).addShortcut().setAsInputCommand().keybindMode(KeybindMode::OnPressAndRelease);
@@ -156,17 +156,17 @@
HumanController::localController_s->controllableEntity_->rotateRoll(value);
}
- void HumanController::fire(unsigned int firemode)
+ void HumanController::push(unsigned int firemode)
{
if (HumanController::localController_s)
- HumanController::localController_s->doFire(firemode);
+ HumanController::localController_s->doPush(firemode);
}
- void HumanController::doFire(unsigned int firemode)
+ void HumanController::doPush(unsigned int firemode)
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
{
- HumanController::localController_s->controllableEntity_->fire(firemode);
+ HumanController::localController_s->controllableEntity_->push(firemode);
//if human fires, set slaves free. See FormationController::forceFreeSlaves()
if (HumanController::localController_s->state_==MASTER && HumanController::localController_s->formationMode_ == NORMAL)
{
Modified: code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/controllers/HumanController.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -60,8 +60,8 @@
virtual void yaw(const Vector2& value);
virtual void pitch(const Vector2& value);
- static void fire(unsigned int firemode);
- virtual void doFire(unsigned int firemode);
+ static void push(unsigned int firemode);
+ virtual void doPush(unsigned int firemode);
static void release(unsigned int firemode);
virtual void doRelease(unsigned int firemode);
static void reload();
Modified: code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -275,7 +275,7 @@
HumanController::tick(dt);
}
- void NewHumanController::doFire(unsigned int firemode)
+ void NewHumanController::doPush(unsigned int firemode)
{
if (!this->controllableEntity_)
return;
@@ -290,7 +290,7 @@
}
else
{
- HumanController::doFire(firemode); //call for formationflight
+ HumanController::doPush(firemode); //call for formationflight
}
}
Modified: code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/controllers/NewHumanController.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -53,7 +53,7 @@
static void accelerate();
static void decelerate();
- virtual void doFire(unsigned int firemode) override;
+ virtual void doPush(unsigned int firemode) override;
virtual void doRelease(unsigned int firemode) override;
virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override;
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -98,7 +98,7 @@
@brief
Fire this Weapon with the the WeaponMode defined by @param mode
*/
- void Weapon::fire(unsigned int mode)
+ void Weapon::push(unsigned int mode)
{
// To avoid firing with more than one mode at the same time, we lock the weapon (reloading) for
// all modes except the one which is currently reloading.
@@ -124,7 +124,7 @@
for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it)
{
float reloading_time = 0;
- if (it->second->fire(&reloading_time))
+ if (it->second->push(&reloading_time))
{
this->bReloading_ = true;
this->reloadingWeaponmode_ = mode;
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/Weapon.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -51,7 +51,7 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
- void fire(unsigned int mode);
+ void push(unsigned int mode);
void release(unsigned int mode);
void reload();
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -167,10 +167,24 @@
}
}
+ bool WeaponMode::push(float* reloadTime)
+ {
+ if( this->chargeable_)
+ {
+ // setting up a timer for knowing how long the weapon was charged
+ // and passes the value to this->cTime_
+ } else {
+ return fire(reloadTime);
+ }
+
+ }
+
bool WeaponMode::release(float* reloadTime)
{
- this->release();
- return false;
+ if( this->chargeable_)
+ {
+ return fire(reloadTime);
+ }
}
bool WeaponMode::reload()
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponMode.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -56,8 +56,9 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ virtual bool push(float* reloadTime);
+ virtual bool release(float* reloadTime);
virtual bool fire(float* reloadTime);
- virtual bool release(float* reloadTime);
bool reload();
// Munition
@@ -164,7 +165,6 @@
void playReloadSound();
virtual void fire() = 0;
- virtual void release() {};
unsigned int initialMunition_;
unsigned int initialMagazines_;
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -73,10 +73,10 @@
@brief
Fire all weapons in this WeaponSet with the defined weaponmode.
*/
- void WeaponPack::fire(unsigned int weaponmode)
+ void WeaponPack::push(unsigned int weaponmode)
{
for (Weapon* weapon : this->weapons_)
- weapon->fire(weaponmode);
+ weapon->push(weaponmode);
}
void WeaponPack::release(unsigned int weaponmode)
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponPack.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -45,7 +45,7 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
- void fire(unsigned int weaponmode);
+ void push(unsigned int weaponmode);
void release(unsigned int weaponmode);
void reload();
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -59,12 +59,12 @@
XMLPortParam(WeaponSet, "firemode", setDesiredFiremode, getDesiredFiremode, xmlelement, mode);
}
- void WeaponSet::fire()
+ void WeaponSet::push()
{
// Fire all WeaponPacks with their defined weaponmode
for (const auto& mapEntry : this->weaponpacks_)
if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
- mapEntry.first->fire(mapEntry.second);
+ mapEntry.first->push(mapEntry.second);
}
void WeaponSet::release()
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSet.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -45,7 +45,7 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
- void fire();
+ void push();
void release();
void reload();
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -286,11 +286,11 @@
@brief
Fires the @ref orxonox::WeaponSet with the specified firemode.
*/
- void WeaponSystem::fire(unsigned int firemode)
+ void WeaponSystem::push(unsigned int firemode)
{
std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
if (it != this->weaponSets_.end() && it->second)
- it->second->fire();
+ it->second->push();
}
void WeaponSystem::release(unsigned int firemode)
Modified: code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/weaponsystem/WeaponSystem.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -73,7 +73,7 @@
bool swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2);
void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
- void fire(unsigned int firemode);
+ void push(unsigned int firemode);
void release(unsigned int firemode);
void reload();
Modified: code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -298,11 +298,11 @@
this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL);
}
- void ControllableEntity::fire(unsigned int firemode)
+ void ControllableEntity::push(unsigned int firemode)
{
if(GameMode::isMaster())
{
- this->fired(firemode);
+ this->pushed(firemode);
}
else
{
Modified: code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/worldentities/ControllableEntity.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -95,9 +95,9 @@
inline void rotateRoll(float value)
{ this->rotateRoll(Vector2(value, 0)); }
- void fire(unsigned int firemode);
+ void push(unsigned int firemode);
void release(unsigned int firemode);
- virtual void fired(unsigned int firemode) {}
+ virtual void pushed(unsigned int firemode) {}
virtual void released(unsigned int firemode) {}
virtual void reload() {}
Modified: code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.cc 2016-04-21 14:47:39 UTC (rev 11174)
@@ -427,10 +427,10 @@
Check whether the Pawn has a @ref orxonox::WeaponSystem and fire it with the specified firemode if it has one.
*/
- void Pawn::fired(unsigned int firemode)
+ void Pawn::pushed(unsigned int firemode)
{
if (this->weaponSystem_)
- this->weaponSystem_->fire(firemode);
+ this->weaponSystem_->push(firemode);
}
void Pawn::released(unsigned int firemode)
Modified: code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h 2016-04-21 14:05:15 UTC (rev 11173)
+++ code/branches/sagerjFS16/src/orxonox/worldentities/pawns/Pawn.h 2016-04-21 14:47:39 UTC (rev 11174)
@@ -156,7 +156,7 @@
virtual void kill();
- virtual void fired(unsigned int firemode) override;
+ virtual void pushed(unsigned int firemode) override;
virtual void released(unsigned int firemode) override;
virtual void postSpawn();
More information about the Orxonox-commit
mailing list