[Orxonox-commit 271] r2919 - in branches/weapons/src/orxonox/objects/weaponSystem: . weapons
landauf at orxonox.net
landauf at orxonox.net
Sat Apr 18 18:41:00 CEST 2009
Author: landauf
Date: 2009-04-18 18:41:00 +0200 (Sat, 18 Apr 2009)
New Revision: 2919
Modified:
branches/weapons/src/orxonox/objects/weaponSystem/DefaultWeaponmodeLink.cc
branches/weapons/src/orxonox/objects/weaponSystem/Munition.cc
branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc
branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.cc
branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.h
branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc
branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc
branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc
branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc
branches/weapons/src/orxonox/objects/weaponSystem/weapons/FusionFire.cc
Log:
removed some debug output, cleanup in WeaponMode
Modified: branches/weapons/src/orxonox/objects/weaponSystem/DefaultWeaponmodeLink.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/DefaultWeaponmodeLink.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/DefaultWeaponmodeLink.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -44,13 +44,10 @@
this->firemode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
this->weaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
-
-COUT(0) << "+DefaultWeaponmodeLink" << std::endl;
}
DefaultWeaponmodeLink::~DefaultWeaponmodeLink()
{
-COUT(0) << "~DefaultWeaponmodeLink" << std::endl;
}
void DefaultWeaponmodeLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
Modified: branches/weapons/src/orxonox/objects/weaponSystem/Munition.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/Munition.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/Munition.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -50,16 +50,12 @@
this->bAllowMultiMunitionRemovementUnderflow_ = true;
this->reloadTime_ = 0;
-
-COUT(0) << "+Munition" << std::endl;
}
Munition::~Munition()
{
for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
delete it->second;
-
-COUT(0) << "~Munition" << std::endl;
}
Munition::Magazine* Munition::getMagazine(WeaponMode* user) const
Modified: branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/Weapon.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -52,14 +52,10 @@
this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&Weapon::reloaded)));
this->reloadTimer_.stopTimer();
-
-COUT(0) << "+Weapon" << std::endl;
}
Weapon::~Weapon()
{
-COUT(0) << "~Weapon" << std::endl;
-
if (this->isInitialized())
{
if (this->weaponPack_)
Modified: branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -62,13 +62,10 @@
this->damage_ = 0;
this->muzzleOffset_ = Vector3::ZERO;
-
-COUT(0) << "+WeaponMode" << std::endl;
}
WeaponMode::~WeaponMode()
{
-COUT(0) << "~WeaponMode" << std::endl;
}
void WeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -220,153 +217,4 @@
else
return WorldEntity::FRONT;
}
-
-/*
- WeaponMode::WeaponMode(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(WeaponMode);
-
- this->bulletReadyToShoot_ = true;
- this->magazineReadyToShoot_ = true;
- this->weaponSystem_ = 0;
- this->weaponPack_ = 0;
- this->weaponSlot_ = 0;
- this->bulletLoadingTime_ = 0;
- this->magazineLoadingTime_ = 0;
- this->bReloading_ = false;
- this->bulletAmount_= 0;
- this->magazineAmount_ = 0;
- this->munition_ = 0;
- this->unlimitedMunition_ = false;
- this->setObjectMode(0x0);
-COUT(0) << "+WeaponMode" << std::endl;
- }
-
- WeaponMode::~WeaponMode()
- {
-COUT(0) << "~WeaponMode" << std::endl;
- if (this->isInitialized() && this->weaponPack_)
- this->weaponPack_->removeWeapon(this);
- }
-
- void WeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(WeaponMode, XMLPort, xmlelement, mode);
-
- XMLPortParam(WeaponMode, "munitionType", setMunitionType, getMunitionType, xmlelement, mode);
- XMLPortParam(WeaponMode, "bulletLoadingTime", setBulletLoadingTime, getBulletLoadingTime, xmlelement, mode);
- XMLPortParam(WeaponMode, "magazineLoadingTime", setMagazineLoadingTime, getMagazineLoadingTime, xmlelement, mode);
- XMLPortParam(WeaponMode, "bullets", setBulletAmount, getBulletAmount, xmlelement, mode);
- XMLPortParam(WeaponMode, "magazines", setMagazineAmount, getMagazineAmount, xmlelement, mode);
- XMLPortParam(WeaponMode, "unlimitedMunition", setUnlimitedMunition, getUnlimitedMunition, xmlelement, mode);
- }
-
- void WeaponMode::setWeapon()
- {
- this->munition_->fillBullets();
- this->munition_->fillMagazines();
- }
-
- void WeaponMode::setMunition()
- {
- this->munition_->setMaxBullets(this->bulletAmount_);
- this->munition_->setMaxMagazines(this->magazineAmount_);
- }
-
- void WeaponMode::fire()
- {
- if ( this->bulletReadyToShoot_ && this->magazineReadyToShoot_ && !this->bReloading_)
- {
- this->bulletReadyToShoot_ = false;
- if ( this->unlimitedMunition_== true )
- {
- //shoot
- this->reloadBullet();
- this->createProjectile();
- }
- else
- {
- if ( this->munition_->bullets() > 0)
- {
- //shoot and reload
- this->takeBullets();
- this->reloadBullet();
- this->createProjectile();
- }
- //if there are no bullets, but magazines
- else if ( this->munition_->magazines() > 0 && this->munition_->bullets() == 0 )
- {
- //reload magazine
- this->takeMagazines();
- this->reloadMagazine();
- }
- else
- {
- //no magazines
- }
- }
- }
- else
- {
- //weapon not reloaded
- }
- }
-
-
- //weapon reloading
- void WeaponMode::bulletTimer(float bulletLoadingTime)
- {
- this->bReloading_ = true;
- this->bulletReloadTimer_.setTimer( bulletLoadingTime , false , this , createExecutor(createFunctor(&WeaponMode::bulletReloaded)));
- }
- void WeaponMode::magazineTimer(float magazineLoadingTime)
- {
- this->bReloading_ = true;
- this->magazineReloadTimer_.setTimer( magazineLoadingTime , false , this , createExecutor(createFunctor(&WeaponMode::magazineReloaded)));
- }
-
- void WeaponMode::bulletReloaded()
- {
- this->bReloading_ = false;
- this->bulletReadyToShoot_ = true;
- }
-
- void WeaponMode::magazineReloaded()
- {
- this->bReloading_ = false;
- this->munition_->fillBullets();
- }
-
-
-
- void WeaponMode::attachNeededMunition(const std::string& munitionName)
- {
- // if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
- if (this->weaponSystem_)
- {
- //getMunitionType returns 0 if there is no such munitionType
- Munition* munition = this->weaponSystem_->getMunitionType(munitionName);
- if ( munition )
- {
- this->munition_ = munition;
- this->setMunition();
- }
- else
- {
- //create new munition with identifier because there is no such munitionType
- this->munitionIdentifier_ = ClassByString(munitionName);
- this->munition_ = this->munitionIdentifier_.fabricate(this);
- this->weaponSystem_->setNewMunition(munitionName, this->munition_);
- this->setMunition();
- }
- }
- }
-
-
- Munition * WeaponMode::getAttachedMunition(const std::string& munitionType)
- {
- this->munition_ = this->weaponSystem_->getMunitionType(munitionType);
- return this->munition_;
- }
-*/
}
Modified: branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.h 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/WeaponMode.h 2009-04-18 16:41:00 UTC (rev 2919)
@@ -150,96 +150,6 @@
Timer<WeaponMode> reloadTimer_;
bool bReloading_;
-/*
- virtual void fire();
- void attachNeededMunition(const std::string& munitionType);
- Munition * getAttachedMunition(const std::string& munitiontype);
-
- //reloading
- void bulletTimer(float bulletLoadingTime);
- void magazineTimer(float magazineLoadingTime);
- void bulletReloaded();
- void magazineReloaded();
-
- //get and set functions for XMLPort
- void setMunitionType(const std::string& munitionType)
- { this->munitionType_ = munitionType; }
- std::string& getMunitionType() const
- { return this->munitionType_; }
-
- void setBulletLoadingTime(float loadingTime)
- { this->bulletLoadingTime_ = loadingTime; }
- float getBulletLoadingTime() const
- { return this->bulletLoadingTime_; }
-
- void setMagazineLoadingTime(float loadingTime)
- { this->magazineLoadingTime_ = loadingTime; }
- float getMagazineLoadingTime() const
- { return this->magazineLoadingTime_; }
-
- void setBulletAmount(unsigned int amount)
- { this->bulletAmount_ = amount; }
- unsigned int getBulletAmount() const
- { return this->bulletAmount_; }
-
- void setMagazineAmount(unsigned int amount)
- { this->magazineAmount_ = amount; }
- unsigned int getMagazineAmount() const
- { return this->magazineAmount_; }
-
- void setUnlimitedMunition(bool unlimitedMunition)
- { this->unlimitedMunition_ = unlimitedMunition; }
- bool getUnlimitedMunition() const
- { return this->unlimitedMunition_; }
-
- //weapon actions
- //these function are defined in the weapon classes
- virtual void takeBullets() {}
- virtual void takeMagazines() {}
- virtual void createProjectile() {}
- virtual void reloadBullet() {}
- virtual void reloadMagazine() {}
-
- //manually set or reset
- virtual void setWeapon();
- virtual void setMunition();
-
- inline void setWeaponSystem(WeaponSystem *weaponSystem)
- { this->weaponSystem_ = weaponSystem; };
- inline WeaponSystem * getWeaponSystem() const
- { return this->weaponSystem_; };
-
- inline void setWeaponPack(WeaponPack *weaponPack)
- { this->weaponPack_ = weaponPack; };
- inline WeaponPack * getWeaponPack() const
- { return this->weaponPack_; };
-
- inline void setWeaponSlot(WeaponSlot * wSlot)
- { this->weaponSlot_ = wSlot; }
- inline WeaponSlot * getWeaponSlot() const
- { return this->weaponSlot_; }
-
- protected:
- bool bReloading_;
- bool bulletReadyToShoot_;
- bool magazineReadyToShoot_;
- bool unlimitedMunition_;
- float bulletLoadingTime_;
- float magazineLoadingTime_;
- unsigned int bulletAmount_;
- unsigned int magazineAmount_;
- std::string munitionType_;
-
- WeaponSlot * weaponSlot_;
- Munition * munition_;
- WeaponSystem * weaponSystem_;
- WeaponPack* weaponPack_;
-
- SubclassIdentifier<Munition> munitionIdentifier_;
-
- Timer<WeaponMode> bulletReloadTimer_;
- Timer<WeaponMode> magazineReloadTimer_;
-*/
};
}
Modified: branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/WeaponPack.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -47,14 +47,10 @@
RegisterObject(WeaponPack);
this->weaponSystem_ = 0;
-
-COUT(0) << "+WeaponPack" << std::endl;
}
WeaponPack::~WeaponPack()
{
-COUT(0) << "~WeaponPack" << std::endl;
-
if (this->isInitialized() && this->weaponSystem_)
{
this->weaponSystem_->removeWeaponPack(this);
Modified: branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/WeaponSet.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -45,14 +45,10 @@
this->weaponSystem_ = 0;
this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
-
-COUT(0) << "+WeaponSet" << std::endl;
}
WeaponSet::~WeaponSet()
{
-COUT(0) << "~WeaponSet" << std::endl;
-
if (this->isInitialized() && this->weaponSystem_)
this->weaponSystem_->removeWeaponSet(this);
}
Modified: branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/WeaponSlot.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -47,14 +47,10 @@
this->weapon_ = 0;
this->setObjectMode(0x0);
-
-COUT(0) << "+WeaponSlot" << std::endl;
}
WeaponSlot::~WeaponSlot()
{
-COUT(0) << "~WeaponSlot" << std::endl;
-
if (this->isInitialized() && this->weaponSystem_)
this->weaponSystem_->removeWeaponSlot(this);
}
Modified: branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/WeaponSystem.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -52,12 +52,10 @@
RegisterObject(WeaponSystem);
this->pawn_ = 0;
-COUT(0) << "+WeaponSystem" << std::endl;
}
WeaponSystem::~WeaponSystem()
{
-COUT(0) << "~WeaponSystem" << std::endl;
if (this->isInitialized())
{
if (this->pawn_)
Modified: branches/weapons/src/orxonox/objects/weaponSystem/weapons/FusionFire.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponSystem/weapons/FusionFire.cc 2009-04-18 16:14:52 UTC (rev 2918)
+++ branches/weapons/src/orxonox/objects/weaponSystem/weapons/FusionFire.cc 2009-04-18 16:41:00 UTC (rev 2919)
@@ -59,6 +59,7 @@
projectile->setOrientation(this->getMuzzleOrientation());
projectile->setPosition(this->getMuzzlePosition());
projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+ projectile->scale(5);
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
More information about the Orxonox-commit
mailing list