[Orxonox-commit 479] r3053 - in trunk: . src/orxonox src/orxonox/objects src/orxonox/objects/controllers src/orxonox/objects/weaponsystem src/orxonox/objects/weaponsystem/munitions src/orxonox/objects/weaponsystem/projectiles src/orxonox/objects/weaponsystem/weaponmodes src/orxonox/objects/worldentities src/orxonox/objects/worldentities/pawns
landauf at orxonox.net
landauf at orxonox.net
Mon May 25 04:19:15 CEST 2009
Author: landauf
Date: 2009-05-25 04:19:14 +0200 (Mon, 25 May 2009)
New Revision: 3053
Added:
trunk/src/orxonox/objects/weaponsystem/
trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc
trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h
trunk/src/orxonox/objects/weaponsystem/Munition.cc
trunk/src/orxonox/objects/weaponsystem/Munition.h
trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h
trunk/src/orxonox/objects/weaponsystem/Weapon.cc
trunk/src/orxonox/objects/weaponsystem/Weapon.h
trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc
trunk/src/orxonox/objects/weaponsystem/WeaponMode.h
trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc
trunk/src/orxonox/objects/weaponsystem/WeaponPack.h
trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSet.h
trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h
trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
trunk/src/orxonox/objects/weaponsystem/munitions/
trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc
trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h
trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc
trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h
trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc
trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h
trunk/src/orxonox/objects/weaponsystem/projectiles/
trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h
trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h
trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/
trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
Removed:
trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc
trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h
trunk/src/orxonox/objects/weaponsystem/Munition.cc
trunk/src/orxonox/objects/weaponsystem/Munition.h
trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h
trunk/src/orxonox/objects/weaponsystem/Weapon.cc
trunk/src/orxonox/objects/weaponsystem/Weapon.h
trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc
trunk/src/orxonox/objects/weaponsystem/WeaponMode.h
trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc
trunk/src/orxonox/objects/weaponsystem/WeaponPack.h
trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSet.h
trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h
trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc
trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
trunk/src/orxonox/objects/weaponsystem/munitions/
trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc
trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h
trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc
trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h
trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc
trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h
trunk/src/orxonox/objects/weaponsystem/projectiles/
trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h
trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h
trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc
trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/
trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
Modified:
trunk/
trunk/src/orxonox/OrxonoxPrereqs.h
trunk/src/orxonox/objects/CMakeLists.txt
trunk/src/orxonox/objects/controllers/AIController.cc
trunk/src/orxonox/objects/controllers/HumanController.cc
trunk/src/orxonox/objects/controllers/HumanController.h
trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc
trunk/src/orxonox/objects/worldentities/Billboard.cc
trunk/src/orxonox/objects/worldentities/Billboard.h
trunk/src/orxonox/objects/worldentities/ControllableEntity.h
trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
trunk/src/orxonox/objects/worldentities/pawns/Spectator.h
Log:
merged weapons branch back to trunk
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/buildsystem:1875-2277,2279-2401
/branches/buildsystem2:2507-2659
/branches/buildsystem3:2663-2709
/branches/ceguilua:1803-1809
/branches/core3:1573-1740
/branches/gametypes:2827-3032
/branches/gcc43:1581
/branches/gui:1636-1724,2796-2895
/branches/input:1630-1637
/branches/lodfinal:2373-2412
/branches/miniprojects:2755-2825
/branches/network:2357
/branches/network64:2211-2356
/branches/objecthierarchy:1912-2086,2101,2111-2170
/branches/objecthierarchy2:2172-2480
/branches/overlay:2118-2386
/branches/physics:1913-2056,2108-2440
/branches/physics_merge:2437-2458
/branches/pickups:1927-2087,2128
/branches/pickups2:2108-2498
/branches/presentation:2370-2653,2655-2661
/branches/questsystem:1895-2089
/branches/questsystem2:2108-2260
/branches/questsystem5:2777-2906
/branches/script_trigger:1296-1954,1956
/branches/weapon:1926-2095
/branches/weapon2:2108-2489
/branches/weaponsystem:2743-2891
+ /branches/buildsystem:1875-2277,2279-2401
/branches/buildsystem2:2507-2659
/branches/buildsystem3:2663-2709
/branches/ceguilua:1803-1809
/branches/core3:1573-1740
/branches/gametypes:2827-3032
/branches/gcc43:1581
/branches/gui:1636-1724,2796-2895
/branches/input:1630-1637
/branches/lodfinal:2373-2412
/branches/miniprojects:2755-2825
/branches/network:2357
/branches/network64:2211-2356
/branches/objecthierarchy:1912-2086,2101,2111-2170
/branches/objecthierarchy2:2172-2480
/branches/overlay:2118-2386
/branches/physics:1913-2056,2108-2440
/branches/physics_merge:2437-2458
/branches/pickups:1927-2087,2128
/branches/pickups2:2108-2498
/branches/presentation:2370-2653,2655-2661
/branches/questsystem:1895-2089
/branches/questsystem2:2108-2260
/branches/questsystem5:2777-2906
/branches/script_trigger:1296-1954,1956
/branches/weapon:1926-2095
/branches/weapon2:2108-2489
/branches/weapons:2898-3052
/branches/weaponsystem:2743-2891
Modified: trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- trunk/src/orxonox/OrxonoxPrereqs.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/OrxonoxPrereqs.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -73,26 +73,6 @@
};
}
- //put here all existing munitionTypes
- namespace MunitionType
- {
- enum Enum
- { laserGunMunition };
- }
-
- //put here all weapon fire modes.
- //they have to be added to Pawn and HumanController, too.
- namespace WeaponMode
- {
- enum Enum
- {
- fire = 0x1,
- altFire = 0x2,
- altFire2 = 0x4
- };
- }
-
-
class GraphicsManager;
class OgreWindowEventListener;
class Settings;
@@ -181,11 +161,26 @@
class WeaponSlot;
class WeaponPack;
class Weapon;
+ class WeaponMode;
+ class DefaultWeaponmodeLink;
+ class MuzzleFlash;
+
+ class LaserFire;
+ class FusionFire;
+ class HsW01;
+ class LightningGun;
+ class EnergyDrink;
+
+ class ReplenishingMunition;
class Munition;
- class LaserGun;
- class LaserGunMunition;
+ class LaserMunition;
class FusionMunition;
+ class Projectile;
+ class BillboardProjectile;
+ class ParticleProjectile;
+ class LightningGunProjectile;
+
class EventListener;
class EventDispatcher;
class EventTarget;
Modified: trunk/src/orxonox/objects/CMakeLists.txt
===================================================================
--- trunk/src/orxonox/objects/CMakeLists.txt 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -21,6 +21,6 @@
ADD_SUBDIRECTORY(items)
ADD_SUBDIRECTORY(pickup)
ADD_SUBDIRECTORY(quest)
-ADD_SUBDIRECTORY(weaponSystem)
+ADD_SUBDIRECTORY(weaponsystem)
ADD_SUBDIRECTORY(worldentities)
Modified: trunk/src/orxonox/objects/controllers/AIController.cc
===================================================================
--- trunk/src/orxonox/objects/controllers/AIController.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/controllers/AIController.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -110,7 +110,7 @@
this->moveToTargetPosition();
if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
- this->getControllableEntity()->fire(WeaponMode::fire);
+ this->getControllableEntity()->fire(0);
SUPER(AIController, tick, dt);
}
Modified: trunk/src/orxonox/objects/controllers/HumanController.cc
===================================================================
--- trunk/src/orxonox/objects/controllers/HumanController.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/controllers/HumanController.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -45,7 +45,7 @@
SetConsoleCommand(HumanController, rotatePitch, true).setAsInputCommand();
SetConsoleCommand(HumanController, rotateRoll, true).setAsInputCommand();
SetConsoleCommand(HumanController, fire, true).keybindMode(KeybindMode::OnHold);
- SetConsoleCommand(HumanController, altFire, true).keybindMode(KeybindMode::OnHold);
+ SetConsoleCommand(HumanController, reload, true);
SetConsoleCommand(HumanController, boost, true).keybindMode(KeybindMode::OnHold);
SetConsoleCommand(HumanController, greet, true);
SetConsoleCommand(HumanController, use, true);
@@ -108,16 +108,16 @@
HumanController::localController_s->controllableEntity_->rotateRoll(value);
}
- void HumanController::fire()
+ void HumanController::fire(unsigned int firemode)
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
- HumanController::localController_s->controllableEntity_->fire(WeaponMode::fire);
+ HumanController::localController_s->controllableEntity_->fire(firemode);
}
- void HumanController::altFire()
+ void HumanController::reload()
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
- HumanController::localController_s->controllableEntity_->fire(WeaponMode::altFire);
+ HumanController::localController_s->controllableEntity_->reload();
}
void HumanController::boost()
Modified: trunk/src/orxonox/objects/controllers/HumanController.h
===================================================================
--- trunk/src/orxonox/objects/controllers/HumanController.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/controllers/HumanController.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -50,8 +50,8 @@
static void rotatePitch(const Vector2& value);
static void rotateRoll(const Vector2& value);
- static void fire();
- static void altFire();
+ static void fire(unsigned int firemode);
+ static void reload();
static void boost();
static void greet();
Modified: trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc
===================================================================
--- trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -67,7 +67,7 @@
this->moveToTargetPosition();
if (this->getControllableEntity() && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
- this->getControllableEntity()->fire(WeaponMode::fire);
+ this->getControllableEntity()->fire(0);
}
else
{
Deleted: trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/CMakeLists.txt 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,15 +0,0 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- Munition.cc
- Weapon.cc
- WeaponMode.cc
- WeaponPack.cc
- WeaponSet.cc
- WeaponSlot.cc
- WeaponSystem.cc
- DefaultWeaponmodeLink.cc
- MuzzleFlash.cc
-)
-
-ADD_SUBDIRECTORY(munitions)
-ADD_SUBDIRECTORY(projectiles)
-ADD_SUBDIRECTORY(weaponmodes)
Copied: trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/CMakeLists.txt)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,15 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ Munition.cc
+ Weapon.cc
+ WeaponMode.cc
+ WeaponPack.cc
+ WeaponSet.cc
+ WeaponSlot.cc
+ WeaponSystem.cc
+ DefaultWeaponmodeLink.cc
+ MuzzleFlash.cc
+)
+
+ADD_SUBDIRECTORY(munitions)
+ADD_SUBDIRECTORY(projectiles)
+ADD_SUBDIRECTORY(weaponmodes)
Deleted: trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,60 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "DefaultWeaponmodeLink.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(DefaultWeaponmodeLink);
-
- DefaultWeaponmodeLink::DefaultWeaponmodeLink(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(DefaultWeaponmodeLink);
-
- this->firemode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
- this->weaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
- }
-
- DefaultWeaponmodeLink::~DefaultWeaponmodeLink()
- {
- }
-
- void DefaultWeaponmodeLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(DefaultWeaponmodeLink, XMLPort, xmlelement, mode);
-
- XMLPortParam(DefaultWeaponmodeLink, "firemode", setFiremode, getFiremode, xmlelement, mode);
- XMLPortParam(DefaultWeaponmodeLink, "weaponmode", setWeaponmode, getWeaponmode, xmlelement, mode);
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,60 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "DefaultWeaponmodeLink.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(DefaultWeaponmodeLink);
+
+ DefaultWeaponmodeLink::DefaultWeaponmodeLink(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(DefaultWeaponmodeLink);
+
+ this->firemode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
+ this->weaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
+ }
+
+ DefaultWeaponmodeLink::~DefaultWeaponmodeLink()
+ {
+ }
+
+ void DefaultWeaponmodeLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(DefaultWeaponmodeLink, XMLPort, xmlelement, mode);
+
+ XMLPortParam(DefaultWeaponmodeLink, "firemode", setFiremode, getFiremode, xmlelement, mode);
+ XMLPortParam(DefaultWeaponmodeLink, "weaponmode", setWeaponmode, getWeaponmode, xmlelement, mode);
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,62 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef _DefaultWeaponmodeLink_H__
-#define _DefaultWeaponmodeLink_H__
-
-#include "OrxonoxPrereqs.h"
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
- class _OrxonoxExport DefaultWeaponmodeLink : public BaseObject
- {
- public:
- DefaultWeaponmodeLink(BaseObject* creator);
- virtual ~DefaultWeaponmodeLink();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- inline void setFiremode(const unsigned int firemode)
- { this->firemode_ = firemode; }
- inline unsigned int getFiremode() const
- { return this->firemode_; }
-
- inline void setWeaponmode(const unsigned int weaponmode)
- { this->weaponmode_ = weaponmode; }
- inline unsigned int getWeaponmode() const
- { return this->weaponmode_; }
-
- private:
- unsigned int firemode_;
- unsigned int weaponmode_;
- };
-}
-
-#endif /* _DefaultWeaponmodeLink_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/DefaultWeaponmodeLink.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _DefaultWeaponmodeLink_H__
+#define _DefaultWeaponmodeLink_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport DefaultWeaponmodeLink : public BaseObject
+ {
+ public:
+ DefaultWeaponmodeLink(BaseObject* creator);
+ virtual ~DefaultWeaponmodeLink();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ inline void setFiremode(const unsigned int firemode)
+ { this->firemode_ = firemode; }
+ inline unsigned int getFiremode() const
+ { return this->firemode_; }
+
+ inline void setWeaponmode(const unsigned int weaponmode)
+ { this->weaponmode_ = weaponmode; }
+ inline unsigned int getWeaponmode() const
+ { return this->weaponmode_; }
+
+ private:
+ unsigned int firemode_;
+ unsigned int weaponmode_;
+ };
+}
+
+#endif /* _DefaultWeaponmodeLink_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/Munition.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/Munition.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/Munition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,477 +0,0 @@
-/*
- * 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.
- *
- * Authors:
- * Martin Polak
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Munition.h"
-
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- CreateFactory(Munition);
-
- Munition::Munition(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(Munition);
-
- this->maxMunitionPerMagazine_ = 10;
- this->maxMagazines_ = 10;
- this->magazines_ = 10;
-
- this->bUseSeparateMagazines_ = false;
- this->bStackMunition_ = true;
- this->bAllowMunitionRefilling_ = true;
- this->bAllowMultiMunitionRemovementUnderflow_ = true;
-
- this->reloadTime_ = 0;
- }
-
- Munition::~Munition()
- {
- for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
- delete it->second;
- }
-
- Munition::Magazine* Munition::getMagazine(WeaponMode* user) const
- {
- if (this->bUseSeparateMagazines_)
- {
- // For separated magazines we definitively need a given user
- if (!user)
- return 0;
-
- // Use the map to get the magazine assigned to the given user
- std::map<WeaponMode*, Magazine*>::const_iterator it = this->currentMagazines_.find(user);
- if (it != this->currentMagazines_.end())
- return it->second;
- }
- else
- {
- // We don't use separate magazines for each user, so just take the first magazine
- if (this->currentMagazines_.size() > 0)
- return this->currentMagazines_.begin()->second;
- }
-
- return 0;
- }
-
- unsigned int Munition::getNumMunition(WeaponMode* user) const
- {
- Magazine* magazine = this->getMagazine(user);
- if (magazine)
- {
- if (this->bStackMunition_)
- // With stacked munition every magazine contributes to the total amount
- return this->maxMunitionPerMagazine_ * this->magazines_ + magazine->munition_;
- else
- // Wihtout stacked munition we just consider the current magazine
- return magazine->munition_;
- }
- return 0;
- }
-
- unsigned int Munition::getNumMunitionInCurrentMagazine(WeaponMode* user) const
- {
- // In contrast to getNumMunition() we really just consider the current magazine, even if we're stacking munition
- Magazine* magazine = this->getMagazine(user);
- if (magazine)
- return magazine->munition_;
- else
- return 0;
- }
-
- unsigned int Munition::getNumMagazines() const
- {
- if (this->bStackMunition_)
- {
- // If we stack munition and the current magazine is still full, it counts too
- Magazine* magazine = this->getMagazine(0);
- if (magazine && magazine->munition_ == this->maxMunitionPerMagazine_)
- return this->magazines_ + 1;
- }
-
- return this->magazines_;
- }
-
- unsigned int Munition::getMaxMunition() const
- {
- if (this->bStackMunition_)
- return this->maxMunitionPerMagazine_ * this->maxMagazines_;
- else
- return this->maxMunitionPerMagazine_;
- }
-
- bool Munition::canTakeMunition(unsigned int amount, WeaponMode* user) const
- {
- Magazine* magazine = this->getMagazine(user);
- if (magazine && magazine->bLoaded_)
- {
- unsigned int munition = magazine->munition_;
-
- // If we stack munition, we con't care about the current magazine - we just need enough munition in total
- if (this->bStackMunition_)
- munition += this->maxMunitionPerMagazine_ * this->magazines_;
-
- if (munition == 0)
- // Absolutely no munition - no chance to take munition
- return false;
- else if (this->bAllowMultiMunitionRemovementUnderflow_)
- // We're not empty AND we allow underflow, so this will always work
- return true;
- else
- // We don't allow underflow, so we have to check the amount
- return (munition >= amount);
- }
- return false;
- }
-
- bool Munition::takeMunition(unsigned int amount, WeaponMode* user)
- {
- if (!this->canTakeMunition(amount, user))
- return false;
-
- Magazine* magazine = this->getMagazine(user);
- if (magazine && magazine->bLoaded_)
- {
- if (magazine->munition_ >= amount)
- {
- // Enough munition
- magazine->munition_ -= amount;
- return true;
- }
- else
- {
- // Not enough munition
- if (this->bStackMunition_)
- {
- // We stack munition, so just take what we can and then load the next magazine
- amount -= magazine->munition_;
- magazine->munition_ = 0;
-
- if (this->reload(0))
- // Successfully reloaded, continue recursively
- return this->takeMunition(amount, 0);
- else
- // We don't have more magazines, so let's just hope we allow underflow
- return this->bAllowMultiMunitionRemovementUnderflow_;
- }
- else
- {
- // We don't stack, so we can only take munition if this is allowed
- if (magazine->munition_ > 0 && this->bAllowMultiMunitionRemovementUnderflow_)
- {
- magazine->munition_ -= 0;
- return true;
- }
- }
- }
- }
- return false;
- }
-
- bool Munition::canReload() const
- {
- // As long as we have enough magazines (and don't stack munition) we can reload
- return (this->magazines_ > 0 && !this->bStackMunition_);
- }
-
- bool Munition::needReload(WeaponMode* user) const
- {
- Magazine* magazine = this->getMagazine(user);
- if (magazine)
- {
- if (this->bStackMunition_)
- // With stacked munition, we never have to reload
- return false;
- else
- // We need to reload if an already loaded magazine is empty
- return (magazine->bLoaded_ && magazine->munition_ == 0);
- }
- else
- // No magazine - we definitively need to reload
- return true;
- }
-
- bool Munition::reload(WeaponMode* user, bool bUseReloadTime)
- {
- // Don't reload if we're already reloading
- Magazine* magazine = this->getMagazine(user);
- if (magazine && !magazine->bLoaded_)
- return false;
-
- // Check if we actually can reload
- if (this->magazines_ == 0)
- return false;
-
- // If we use separate magazines for each user, we definitively need a user given
- if (this->bUseSeparateMagazines_ && !user)
- return false;
-
- // If we don't use separate magazines, set user to 0
- if (!this->bUseSeparateMagazines_)
- user = 0;
-
- // Remove the current magazine for the given user
- std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.find(user);
- if (it != this->currentMagazines_.end())
- {
- delete it->second;
- this->currentMagazines_.erase(it);
- }
-
- // Load a new magazine
- this->currentMagazines_[user] = new Magazine(this, bUseReloadTime);
- this->magazines_--;
-
- return true;
- }
-
- bool Munition::canAddMunition(unsigned int amount) const
- {
- if (!this->bAllowMunitionRefilling_)
- return false;
-
- if (this->bStackMunition_)
- {
- // If we stack munition, we can always add munition until we reach the limit
- return (this->getNumMunition(0) < this->getMaxMunition());
- }
- else
- {
- // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition)
- for (std::map<WeaponMode*, Magazine*>::const_iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
- if (it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
- return true;
- }
-
- return false;
- }
-
- bool Munition::addMunition(unsigned int amount)
- {
- if (!this->canAddMunition(amount))
- return false;
-
- if (this->bStackMunition_)
- {
- // Stacking munition means, if a magazine gets full, the munition adds to a new magazine
- Magazine* magazine = this->getMagazine(0);
- if (magazine)
- {
- // Add the whole amount
- magazine->munition_ += amount;
-
- // Add new magazines if the current magazine is overfull
- while (magazine->munition_ > this->maxMunitionPerMagazine_)
- {
- magazine->munition_ -= this->maxMunitionPerMagazine_;
- this->magazines_++;
- }
-
- // If we reached the limit, reduze both magazines and munition to the maximum
- if (this->magazines_ >= this->maxMagazines_)
- {
- this->magazines_ = this->maxMagazines_ - 1;
- magazine->munition_ = this->maxMunitionPerMagazine_;
- }
-
- return true;
- }
-
- // Something went wrong
- return false;
- }
- else
- {
- // Share the munition equally to the current magazines
- while (amount > 0)
- {
- bool change = false;
- for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
- {
- // Add munition if the magazine isn't full (but only to loaded magazines)
- if (amount > 0 && it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
- {
- it->second->munition_++;
- amount--;
- change = true;
- }
- }
-
- // If there was no change in a loop, all magazines are full (or locked due to loading)
- if (!change)
- break;
- }
-
- return true;
- }
- }
-
- bool Munition::canAddMagazines(unsigned int amount) const
- {
- if (this->bStackMunition_)
- // If we stack munition, we can always add new magazines because they contribute directly to the munition
- return (this->getNumMunition(0) < this->getMaxMunition());
- else
- // If we don't stack munition, we're more limited
- return ((this->currentMagazines_.size() + this->magazines_) < this->maxMagazines_);
- }
-
- bool Munition::addMagazines(unsigned int amount)
- {
- if (!this->canAddMagazines(amount))
- return false;
-
- // Calculate how many magazines are needed
- int needed_magazines = this->maxMagazines_ - this->magazines_ - this->currentMagazines_.size();
-
- // If zero or less magazines are needed, we definitively don't need more magazines (unless we stack munition - then a magazine contributes directly to the munition)
- if (needed_magazines <= 0 && !this->bStackMunition_)
- return false;
-
- if (amount <= needed_magazines)
- {
- // We need more magazines than we get, so just add them
- this->magazines_ += amount;
- }
- else
- {
- // We get more magazines than we need, so just add the needed amount
- this->magazines_ += needed_magazines;
- if (this->bStackMunition_)
- {
- // We stack munition, so the additional amount contributes directly to the munition of the current magazine
- Magazine* magazine = this->getMagazine(0);
- if (magazine)
- magazine->munition_ = this->maxMunitionPerMagazine_;
- }
- }
-
- return true;
- }
-
- bool Munition::canRemoveMagazines(unsigned int amount) const
- {
- if (this->bStackMunition_)
- {
- if (this->magazines_ >= amount)
- {
- // We have enough magazines
- return true;
- }
- else if (this->magazines_ == amount - 1)
- {
- // We lack one magazine, check if the current magazine is still full, if yes we're fine
- Magazine* magazine = this->getMagazine(0);
- if (magazine && magazine->munition_ == this->maxMunitionPerMagazine_)
- return true;
- }
- else
- {
- // We don't have enough magazines
- return false;
- }
- }
- else
- {
- // In case we're not stacking munition, just check the number of magazines
- return (this->magazines_ >= amount);
- }
- }
-
- bool Munition::removeMagazines(unsigned int amount)
- {
- if (!this->canRemoveMagazines(amount))
- return false;
-
- if (this->magazines_ >= amount)
- {
- // We have enough magazines, just remove the amount
- this->magazines_ -= amount;
- }
- else if (this->bStackMunition_)
- {
- // We don't have enough magazines, but we're stacking munition, so additionally remove the bullets from the current magazine
- this->magazines_ = 0;
- Magazine* magazine = this->getMagazine(0);
- if (magazine)
- magazine->munition_ = 0;
- }
-
- return true;
- }
-
- bool Munition::dropMagazine(WeaponMode* user)
- {
- // If we use separate magazines, we need a user
- if (this->bUseSeparateMagazines_ && !user)
- return false;
-
- // If we don't use separate magazines, set user to 0
- if (!this->bUseSeparateMagazines_)
- user = 0;
-
- // Remove the current magazine for the given user
- std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.find(user);
- if (it != this->currentMagazines_.end())
- {
- delete it->second;
- this->currentMagazines_.erase(it);
- return true;
- }
-
- return false;
- }
-
-
- /////////////////////
- // Magazine struct //
- /////////////////////
- Munition::Magazine::Magazine(Munition* munition, bool bUseReloadTime)
- {
- this->munition_ = 0;
- this->bLoaded_ = false;
-
- if (bUseReloadTime && (munition->reloadTime_ > 0 || munition->bStackMunition_))
- {
- ExecutorMember<Magazine>* executor = createExecutor(createFunctor(&Magazine::loaded));
- executor->setDefaultValues(munition);
-
- this->loadTimer_.setTimer(munition->reloadTime_, false, this, executor);
- }
- else
- this->loaded(munition);
- }
-
- void Munition::Magazine::loaded(Munition* munition)
- {
- this->bLoaded_ = true;
- this->munition_ = munition->maxMunitionPerMagazine_;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/Munition.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/Munition.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/Munition.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/Munition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,479 @@
+/*
+ * 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.
+ *
+ * Authors:
+ * Martin Polak
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Munition.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(Munition);
+
+ Munition::Munition(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(Munition);
+
+ this->maxMunitionPerMagazine_ = 10;
+ this->maxMagazines_ = 10;
+ this->magazines_ = 10;
+
+ this->bUseSeparateMagazines_ = false;
+ this->bStackMunition_ = true;
+ this->bAllowMunitionRefilling_ = true;
+ this->bAllowMultiMunitionRemovementUnderflow_ = true;
+
+ this->reloadTime_ = 0;
+ }
+
+ Munition::~Munition()
+ {
+ for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
+ delete it->second;
+ }
+
+ Munition::Magazine* Munition::getMagazine(WeaponMode* user) const
+ {
+ if (this->bUseSeparateMagazines_)
+ {
+ // For separated magazines we definitively need a given user
+ if (!user)
+ return 0;
+
+ // Use the map to get the magazine assigned to the given user
+ std::map<WeaponMode*, Magazine*>::const_iterator it = this->currentMagazines_.find(user);
+ if (it != this->currentMagazines_.end())
+ return it->second;
+ }
+ else
+ {
+ // We don't use separate magazines for each user, so just take the first magazine
+ if (this->currentMagazines_.size() > 0)
+ return this->currentMagazines_.begin()->second;
+ }
+
+ return 0;
+ }
+
+ unsigned int Munition::getNumMunition(WeaponMode* user) const
+ {
+ Magazine* magazine = this->getMagazine(user);
+ if (magazine)
+ {
+ if (this->bStackMunition_)
+ // With stacked munition every magazine contributes to the total amount
+ return this->maxMunitionPerMagazine_ * this->magazines_ + magazine->munition_;
+ else
+ // Wihtout stacked munition we just consider the current magazine
+ return magazine->munition_;
+ }
+ return 0;
+ }
+
+ unsigned int Munition::getNumMunitionInCurrentMagazine(WeaponMode* user) const
+ {
+ // In contrast to getNumMunition() we really just consider the current magazine, even if we're stacking munition
+ Magazine* magazine = this->getMagazine(user);
+ if (magazine)
+ return magazine->munition_;
+ else
+ return 0;
+ }
+
+ unsigned int Munition::getNumMagazines() const
+ {
+ if (this->bStackMunition_)
+ {
+ // If we stack munition and the current magazine is still full, it counts too
+ Magazine* magazine = this->getMagazine(0);
+ if (magazine && magazine->munition_ == this->maxMunitionPerMagazine_)
+ return this->magazines_ + 1;
+ }
+
+ return this->magazines_;
+ }
+
+ unsigned int Munition::getMaxMunition() const
+ {
+ if (this->bStackMunition_)
+ return this->maxMunitionPerMagazine_ * this->maxMagazines_;
+ else
+ return this->maxMunitionPerMagazine_;
+ }
+
+ bool Munition::canTakeMunition(unsigned int amount, WeaponMode* user) const
+ {
+ Magazine* magazine = this->getMagazine(user);
+ if (magazine && magazine->bLoaded_)
+ {
+ unsigned int munition = magazine->munition_;
+
+ // If we stack munition, we con't care about the current magazine - we just need enough munition in total
+ if (this->bStackMunition_)
+ munition += this->maxMunitionPerMagazine_ * this->magazines_;
+
+ if (munition == 0)
+ // Absolutely no munition - no chance to take munition
+ return false;
+ else if (this->bAllowMultiMunitionRemovementUnderflow_)
+ // We're not empty AND we allow underflow, so this will always work
+ return true;
+ else
+ // We don't allow underflow, so we have to check the amount
+ return (munition >= amount);
+ }
+ return false;
+ }
+
+ bool Munition::takeMunition(unsigned int amount, WeaponMode* user)
+ {
+ if (!this->canTakeMunition(amount, user))
+ return false;
+
+ Magazine* magazine = this->getMagazine(user);
+ if (magazine && magazine->bLoaded_)
+ {
+ if (magazine->munition_ >= amount)
+ {
+ // Enough munition
+ magazine->munition_ -= amount;
+ return true;
+ }
+ else
+ {
+ // Not enough munition
+ if (this->bStackMunition_)
+ {
+ // We stack munition, so just take what we can and then load the next magazine
+ amount -= magazine->munition_;
+ magazine->munition_ = 0;
+
+ if (this->reload(0))
+ // Successfully reloaded, continue recursively
+ return this->takeMunition(amount, 0);
+ else
+ // We don't have more magazines, so let's just hope we allow underflow
+ return this->bAllowMultiMunitionRemovementUnderflow_;
+ }
+ else
+ {
+ // We don't stack, so we can only take munition if this is allowed
+ if (magazine->munition_ > 0 && this->bAllowMultiMunitionRemovementUnderflow_)
+ {
+ magazine->munition_ -= 0;
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ bool Munition::canReload() const
+ {
+ // As long as we have enough magazines (and don't stack munition) we can reload
+ return (this->magazines_ > 0 && !this->bStackMunition_);
+ }
+
+ bool Munition::needReload(WeaponMode* user) const
+ {
+ Magazine* magazine = this->getMagazine(user);
+ if (magazine)
+ {
+ if (this->bStackMunition_)
+ // With stacked munition, we never have to reload
+ return false;
+ else
+ // We need to reload if an already loaded magazine is empty
+ return (magazine->bLoaded_ && magazine->munition_ == 0);
+ }
+ else
+ // No magazine - we definitively need to reload
+ return true;
+ }
+
+ bool Munition::reload(WeaponMode* user, bool bUseReloadTime)
+ {
+ // Don't reload if we're already reloading
+ Magazine* magazine = this->getMagazine(user);
+ if (magazine && !magazine->bLoaded_)
+ return false;
+
+ // Check if we actually can reload
+ if (this->magazines_ == 0)
+ return false;
+
+ // If we use separate magazines for each user, we definitively need a user given
+ if (this->bUseSeparateMagazines_ && !user)
+ return false;
+
+ // If we don't use separate magazines, set user to 0
+ if (!this->bUseSeparateMagazines_)
+ user = 0;
+
+ // Remove the current magazine for the given user
+ std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.find(user);
+ if (it != this->currentMagazines_.end())
+ {
+ delete it->second;
+ this->currentMagazines_.erase(it);
+ }
+
+ // Load a new magazine
+ this->currentMagazines_[user] = new Magazine(this, bUseReloadTime);
+ this->magazines_--;
+
+ return true;
+ }
+
+ bool Munition::canAddMunition(unsigned int amount) const
+ {
+ if (!this->bAllowMunitionRefilling_)
+ return false;
+
+ if (this->bStackMunition_)
+ {
+ // If we stack munition, we can always add munition until we reach the limit
+ return (this->getNumMunition(0) < this->getMaxMunition());
+ }
+ else
+ {
+ // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition)
+ for (std::map<WeaponMode*, Magazine*>::const_iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
+ if (it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
+ return true;
+ }
+
+ return false;
+ }
+
+ bool Munition::addMunition(unsigned int amount)
+ {
+ if (!this->canAddMunition(amount))
+ return false;
+
+ if (this->bStackMunition_)
+ {
+ // Stacking munition means, if a magazine gets full, the munition adds to a new magazine
+ Magazine* magazine = this->getMagazine(0);
+ if (magazine)
+ {
+ // Add the whole amount
+ magazine->munition_ += amount;
+
+ // Add new magazines if the current magazine is overfull
+ while (magazine->munition_ > this->maxMunitionPerMagazine_)
+ {
+ magazine->munition_ -= this->maxMunitionPerMagazine_;
+ this->magazines_++;
+ }
+
+ // If we reached the limit, reduze both magazines and munition to the maximum
+ if (this->magazines_ >= this->maxMagazines_)
+ {
+ this->magazines_ = this->maxMagazines_ - 1;
+ magazine->munition_ = this->maxMunitionPerMagazine_;
+ }
+
+ return true;
+ }
+
+ // Something went wrong
+ return false;
+ }
+ else
+ {
+ // Share the munition equally to the current magazines
+ while (amount > 0)
+ {
+ bool change = false;
+ for (std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.begin(); it != this->currentMagazines_.end(); ++it)
+ {
+ // Add munition if the magazine isn't full (but only to loaded magazines)
+ if (amount > 0 && it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)
+ {
+ it->second->munition_++;
+ amount--;
+ change = true;
+ }
+ }
+
+ // If there was no change in a loop, all magazines are full (or locked due to loading)
+ if (!change)
+ break;
+ }
+
+ return true;
+ }
+ }
+
+ bool Munition::canAddMagazines(unsigned int amount) const
+ {
+ if (this->bStackMunition_)
+ // If we stack munition, we can always add new magazines because they contribute directly to the munition
+ return (this->getNumMunition(0) < this->getMaxMunition());
+ else
+ // If we don't stack munition, we're more limited
+ return ((this->currentMagazines_.size() + this->magazines_) < this->maxMagazines_);
+ }
+
+ bool Munition::addMagazines(unsigned int amount)
+ {
+ if (!this->canAddMagazines(amount))
+ return false;
+
+ // Calculate how many magazines are needed
+ int needed_magazines = this->maxMagazines_ - this->magazines_ - this->currentMagazines_.size();
+
+ // If zero or less magazines are needed, we definitively don't need more magazines (unless we stack munition - then a magazine contributes directly to the munition)
+ if (needed_magazines <= 0 && !this->bStackMunition_)
+ return false;
+
+ if (amount <= needed_magazines)
+ {
+ // We need more magazines than we get, so just add them
+ this->magazines_ += amount;
+ }
+ else
+ {
+ // We get more magazines than we need, so just add the needed amount
+ this->magazines_ += needed_magazines;
+ if (this->bStackMunition_)
+ {
+ // We stack munition, so the additional amount contributes directly to the munition of the current magazine
+ Magazine* magazine = this->getMagazine(0);
+ if (magazine)
+ magazine->munition_ = this->maxMunitionPerMagazine_;
+ }
+ }
+
+ return true;
+ }
+
+ bool Munition::canRemoveMagazines(unsigned int amount) const
+ {
+ if (this->bStackMunition_)
+ {
+ if (this->magazines_ >= amount)
+ {
+ // We have enough magazines
+ return true;
+ }
+ else if (this->magazines_ == amount - 1)
+ {
+ // We lack one magazine, check if the current magazine is still full, if yes we're fine
+ Magazine* magazine = this->getMagazine(0);
+ if (magazine && magazine->munition_ == this->maxMunitionPerMagazine_)
+ return true;
+ }
+ else
+ {
+ // We don't have enough magazines
+ return false;
+ }
+ }
+ else
+ {
+ // In case we're not stacking munition, just check the number of magazines
+ return (this->magazines_ >= amount);
+ }
+
+ return false;
+ }
+
+ bool Munition::removeMagazines(unsigned int amount)
+ {
+ if (!this->canRemoveMagazines(amount))
+ return false;
+
+ if (this->magazines_ >= amount)
+ {
+ // We have enough magazines, just remove the amount
+ this->magazines_ -= amount;
+ }
+ else if (this->bStackMunition_)
+ {
+ // We don't have enough magazines, but we're stacking munition, so additionally remove the bullets from the current magazine
+ this->magazines_ = 0;
+ Magazine* magazine = this->getMagazine(0);
+ if (magazine)
+ magazine->munition_ = 0;
+ }
+
+ return true;
+ }
+
+ bool Munition::dropMagazine(WeaponMode* user)
+ {
+ // If we use separate magazines, we need a user
+ if (this->bUseSeparateMagazines_ && !user)
+ return false;
+
+ // If we don't use separate magazines, set user to 0
+ if (!this->bUseSeparateMagazines_)
+ user = 0;
+
+ // Remove the current magazine for the given user
+ std::map<WeaponMode*, Magazine*>::iterator it = this->currentMagazines_.find(user);
+ if (it != this->currentMagazines_.end())
+ {
+ delete it->second;
+ this->currentMagazines_.erase(it);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ /////////////////////
+ // Magazine struct //
+ /////////////////////
+ Munition::Magazine::Magazine(Munition* munition, bool bUseReloadTime)
+ {
+ this->munition_ = 0;
+ this->bLoaded_ = false;
+
+ if (bUseReloadTime && (munition->reloadTime_ > 0 || munition->bStackMunition_))
+ {
+ ExecutorMember<Magazine>* executor = createExecutor(createFunctor(&Magazine::loaded));
+ executor->setDefaultValues(munition);
+
+ this->loadTimer_.setTimer(munition->reloadTime_, false, this, executor);
+ }
+ else
+ this->loaded(munition);
+ }
+
+ void Munition::Magazine::loaded(Munition* munition)
+ {
+ this->bLoaded_ = true;
+ this->munition_ = munition->maxMunitionPerMagazine_;
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/Munition.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/Munition.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/Munition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,109 +0,0 @@
-/*
- * 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.
- *
- * Authors:
- * Martin Polak
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Munition_H__
-#define _Munition_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <map>
-
-#include "core/BaseObject.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Munition : public BaseObject
- {
- struct Magazine
- {
- public:
- Magazine(Munition* munition, bool bUseReloadTime = true);
-
- unsigned int munition_;
- Timer<Magazine> loadTimer_;
- bool bLoaded_;
-
- private:
- void loaded(Munition* munition);
- };
-
- public:
- Munition(BaseObject* creator);
- virtual ~Munition();
-
- unsigned int getNumMunition(WeaponMode* user) const;
- unsigned int getNumMunitionInCurrentMagazine(WeaponMode* user) const;
- unsigned int getNumMagazines() const;
-
- unsigned int getMaxMunition() const;
- inline unsigned int getMaxMagazines() const
- { return this->maxMagazines_; }
- inline unsigned int getMaxMunitionPerMagazine() const
- { return this->maxMunitionPerMagazine_; }
-
- bool canTakeMunition(unsigned int amount, WeaponMode* user) const;
- bool takeMunition(unsigned int amount, WeaponMode* user);
-
- bool canReload() const;
- bool needReload(WeaponMode* user) const;
- bool reload(WeaponMode* user, bool bUseReloadTime = true);
- inline float getReloadTime() const
- { return this->reloadTime_; }
-
- bool canAddMunition(unsigned int amount) const;
- bool addMunition(unsigned int amount);
-
- bool canAddMagazines(unsigned int amount) const;
- bool addMagazines(unsigned int amount);
-
- bool canRemoveMagazines(unsigned int amount) const;
- bool removeMagazines(unsigned int amount);
-
- bool dropMagazine(WeaponMode* user);
-
- protected:
- unsigned int maxMunitionPerMagazine_;
- unsigned int maxMagazines_;
- unsigned int magazines_;
- std::map<WeaponMode*, Magazine*> currentMagazines_;
-
- bool bUseSeparateMagazines_;
- bool bStackMunition_;
- bool bAllowMunitionRefilling_;
- bool bAllowMultiMunitionRemovementUnderflow_;
-
- float reloadTime_;
-
- private:
- Magazine* getMagazine(WeaponMode* user) const;
- };
-}
-
-#endif /* _Munition_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/Munition.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/Munition.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/Munition.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/Munition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ *
+ * Authors:
+ * Martin Polak
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Munition_H__
+#define _Munition_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <map>
+
+#include "core/BaseObject.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Munition : public BaseObject
+ {
+ struct Magazine
+ {
+ public:
+ Magazine(Munition* munition, bool bUseReloadTime = true);
+
+ unsigned int munition_;
+ Timer<Magazine> loadTimer_;
+ bool bLoaded_;
+
+ private:
+ void loaded(Munition* munition);
+ };
+
+ public:
+ Munition(BaseObject* creator);
+ virtual ~Munition();
+
+ unsigned int getNumMunition(WeaponMode* user) const;
+ unsigned int getNumMunitionInCurrentMagazine(WeaponMode* user) const;
+ unsigned int getNumMagazines() const;
+
+ unsigned int getMaxMunition() const;
+ inline unsigned int getMaxMagazines() const
+ { return this->maxMagazines_; }
+ inline unsigned int getMaxMunitionPerMagazine() const
+ { return this->maxMunitionPerMagazine_; }
+
+ bool canTakeMunition(unsigned int amount, WeaponMode* user) const;
+ bool takeMunition(unsigned int amount, WeaponMode* user);
+
+ bool canReload() const;
+ bool needReload(WeaponMode* user) const;
+ bool reload(WeaponMode* user, bool bUseReloadTime = true);
+ inline float getReloadTime() const
+ { return this->reloadTime_; }
+
+ bool canAddMunition(unsigned int amount) const;
+ bool addMunition(unsigned int amount);
+
+ bool canAddMagazines(unsigned int amount) const;
+ bool addMagazines(unsigned int amount);
+
+ bool canRemoveMagazines(unsigned int amount) const;
+ bool removeMagazines(unsigned int amount);
+
+ bool dropMagazine(WeaponMode* user);
+
+ protected:
+ unsigned int maxMunitionPerMagazine_;
+ unsigned int maxMagazines_;
+ unsigned int magazines_;
+ std::map<WeaponMode*, Magazine*> currentMagazines_;
+
+ bool bUseSeparateMagazines_;
+ bool bStackMunition_;
+ bool bAllowMunitionRefilling_;
+ bool bAllowMultiMunitionRemovementUnderflow_;
+
+ float reloadTime_;
+
+ private:
+ Magazine* getMagazine(WeaponMode* user) const;
+ };
+}
+
+#endif /* _Munition_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,56 +0,0 @@
-/*
- * 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:
- * Hagen Seifert
- * Co-authors:
- * Ich
- * Dini Mueter
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "MuzzleFlash.h"
-
-#include "core/GameMode.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
- CreateFactory(MuzzleFlash);
-
- MuzzleFlash::MuzzleFlash(BaseObject* creator) : Billboard(creator)
- {
- RegisterObject(MuzzleFlash);
- this->setScale(0.1);
-
- this->delayTimer_.setTimer(0.1f, false, this, createExecutor(createFunctor(&MuzzleFlash::destroy)));
-
- }
-
- void MuzzleFlash::destroy()
- {
- delete this;
- }
-
-}
Copied: trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * Ich
+ * Dini Mueter
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "MuzzleFlash.h"
+
+#include "core/GameMode.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ CreateFactory(MuzzleFlash);
+
+ MuzzleFlash::MuzzleFlash(BaseObject* creator) : Billboard(creator)
+ {
+ RegisterObject(MuzzleFlash);
+ this->setScale(0.1);
+
+ this->delayTimer_.setTimer(0.1f, false, this, createExecutor(createFunctor(&MuzzleFlash::destroy)));
+
+ }
+
+ void MuzzleFlash::destroy()
+ {
+ delete this;
+ }
+
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,54 +0,0 @@
-/*
- * 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:
- * Hagen Seifert
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _MuzzleFlash_H__
-#define _MuzzleFlash_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/worldentities/Billboard.h"
-#include "tools/Timer.h"
-
-
-namespace orxonox
-{
- class _OrxonoxExport MuzzleFlash : public Billboard
- {
- public:
- MuzzleFlash(BaseObject* creator);
- virtual ~MuzzleFlash() {}
-
-
-
- private:
- void destroy();
- Timer<MuzzleFlash> delayTimer_;
-
- };
-}
-
-#endif /* _MuzzleFlash_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/MuzzleFlash.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _MuzzleFlash_H__
+#define _MuzzleFlash_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/worldentities/Billboard.h"
+#include "tools/Timer.h"
+
+
+namespace orxonox
+{
+ class _OrxonoxExport MuzzleFlash : public Billboard
+ {
+ public:
+ MuzzleFlash(BaseObject* creator);
+ virtual ~MuzzleFlash() {}
+
+
+
+ private:
+ void destroy();
+ Timer<MuzzleFlash> delayTimer_;
+
+ };
+}
+
+#endif /* _MuzzleFlash_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/Weapon.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/Weapon.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/Weapon.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,150 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Weapon.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "WeaponMode.h"
-#include "WeaponPack.h"
-#include "WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(Weapon);
-
- Weapon::Weapon(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Weapon);
-
- this->weaponPack_ = 0;
- this->weaponSlot_ = 0;
- this->bReloading_ = false;
- this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
-
- this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&Weapon::reloaded)));
- this->reloadTimer_.stopTimer();
- }
-
- Weapon::~Weapon()
- {
- if (this->isInitialized())
- {
- if (this->weaponPack_)
- this->weaponPack_->removeWeapon(this);
-
- for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
- delete it->second;
- }
- }
-
- void Weapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Weapon, XMLPort, xmlelement, mode);
-
- XMLPortObject(Weapon, WeaponMode, "", addWeaponmode, getWeaponmode, xmlelement, mode);
- }
-
- void Weapon::addWeaponmode(WeaponMode* weaponmode)
- {
- if (!weaponmode)
- return;
-
- this->weaponmodes_.insert(std::pair<unsigned int, WeaponMode*>(weaponmode->getMode(), weaponmode));
- weaponmode->setWeapon(this);
- }
-
- WeaponMode* Weapon::getWeaponmode(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
- {
- if (i == index)
- return it->second;
-
- ++i;
- }
- return 0;
- }
-
- void Weapon::fire(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.
- //
- // Example:
- // WeaponMode A -> mode 0
- // WeaponMode B -> mode 0
- // WeaponMode C -> mode 1
- //
- // -> A and B can fire at the same time, but C has to wait until both (A and B) have reloaded
- // -> If C fires, A and B have to wait until C has reloaded
- //
- // Note: The reloading of each WeaponMode is internally handled by each A, B and C.
- // The reloading of the weapon is only performed to avoid firing with different modes at the same time.
- if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
- return;
-
- std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode);
- std::multimap<unsigned int, WeaponMode*>::iterator end = this->weaponmodes_.upper_bound(mode);
-
- for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it)
- {
- float reloading_time = 0;
- if (it->second->fire(&reloading_time))
- {
- this->bReloading_ = true;
- this->reloadingWeaponmode_ = mode;
-
- this->reloadTimer_.setInterval(reloading_time);
- this->reloadTimer_.startTimer();
- }
- }
- }
-
- void Weapon::reload()
- {
- for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
- it->second->reload();
- }
-
- void Weapon::reloaded()
- {
- this->bReloading_ = false;
- this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
- }
-
- void Weapon::notifyWeaponModes()
- {
- for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
- it->second->setWeapon(this);
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/Weapon.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/Weapon.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/Weapon.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/Weapon.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,150 @@
+/*
+ * 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:
+ * Martin Polak
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Weapon.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "WeaponMode.h"
+#include "WeaponPack.h"
+#include "WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(Weapon);
+
+ Weapon::Weapon(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Weapon);
+
+ this->weaponPack_ = 0;
+ this->weaponSlot_ = 0;
+ this->bReloading_ = false;
+ this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
+
+ this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&Weapon::reloaded)));
+ this->reloadTimer_.stopTimer();
+ }
+
+ Weapon::~Weapon()
+ {
+ if (this->isInitialized())
+ {
+ if (this->weaponPack_)
+ this->weaponPack_->removeWeapon(this);
+
+ for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
+ delete it->second;
+ }
+ }
+
+ void Weapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Weapon, XMLPort, xmlelement, mode);
+
+ XMLPortObject(Weapon, WeaponMode, "", addWeaponmode, getWeaponmode, xmlelement, mode);
+ }
+
+ void Weapon::addWeaponmode(WeaponMode* weaponmode)
+ {
+ if (!weaponmode)
+ return;
+
+ this->weaponmodes_.insert(std::pair<unsigned int, WeaponMode*>(weaponmode->getMode(), weaponmode));
+ weaponmode->setWeapon(this);
+ }
+
+ WeaponMode* Weapon::getWeaponmode(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
+ {
+ if (i == index)
+ return it->second;
+
+ ++i;
+ }
+ return 0;
+ }
+
+ void Weapon::fire(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.
+ //
+ // Example:
+ // WeaponMode A -> mode 0
+ // WeaponMode B -> mode 0
+ // WeaponMode C -> mode 1
+ //
+ // -> A and B can fire at the same time, but C has to wait until both (A and B) have reloaded
+ // -> If C fires, A and B have to wait until C has reloaded
+ //
+ // Note: The reloading of each WeaponMode is internally handled by each A, B and C.
+ // The reloading of the weapon is only performed to avoid firing with different modes at the same time.
+ if (this->bReloading_ && this->reloadingWeaponmode_ != mode)
+ return;
+
+ std::multimap<unsigned int, WeaponMode*>::iterator start = this->weaponmodes_.lower_bound(mode);
+ std::multimap<unsigned int, WeaponMode*>::iterator end = this->weaponmodes_.upper_bound(mode);
+
+ for (std::multimap<unsigned int, WeaponMode*>::iterator it = start; it != end; ++it)
+ {
+ float reloading_time = 0;
+ if (it->second->fire(&reloading_time))
+ {
+ this->bReloading_ = true;
+ this->reloadingWeaponmode_ = mode;
+
+ this->reloadTimer_.setInterval(reloading_time);
+ this->reloadTimer_.startTimer();
+ }
+ }
+ }
+
+ void Weapon::reload()
+ {
+ for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
+ it->second->reload();
+ }
+
+ void Weapon::reloaded()
+ {
+ this->bReloading_ = false;
+ this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
+ }
+
+ void Weapon::notifyWeaponModes()
+ {
+ for (std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)
+ it->second->setWeapon(this);
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/Weapon.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/Weapon.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/Weapon.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,78 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Weapon_H__
-#define _Weapon_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/worldentities/StaticEntity.h"
-
-#include "tools/Timer.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Weapon : public StaticEntity
- {
- public:
- Weapon(BaseObject* creator);
- virtual ~Weapon();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void fire(unsigned int mode);
- void reload();
-
- void addWeaponmode(WeaponMode* weaponmode);
- WeaponMode* getWeaponmode(unsigned int index) const;
-
- inline void setWeaponPack(WeaponPack * weaponPack)
- { this->weaponPack_ = weaponPack; this->notifyWeaponModes(); }
- inline WeaponPack * getWeaponPack() const
- { return this->weaponPack_; }
-
- inline void setWeaponSlot(WeaponSlot * wSlot)
- { this->weaponSlot_ = wSlot; }
- inline WeaponSlot * getWeaponSlot() const
- { return this->weaponSlot_; }
-
- private:
- void reloaded();
- void notifyWeaponModes();
-
- WeaponPack* weaponPack_;
- WeaponSlot* weaponSlot_;
- std::multimap<unsigned int, WeaponMode*> weaponmodes_;
-
- Timer<Weapon> reloadTimer_;
- bool bReloading_;
- unsigned int reloadingWeaponmode_;
- };
-}
-
-#endif /* _Weapon_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/Weapon.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/Weapon.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/Weapon.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/Weapon.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ * Martin Polak
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Weapon_H__
+#define _Weapon_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/worldentities/StaticEntity.h"
+
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Weapon : public StaticEntity
+ {
+ public:
+ Weapon(BaseObject* creator);
+ virtual ~Weapon();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void fire(unsigned int mode);
+ void reload();
+
+ void addWeaponmode(WeaponMode* weaponmode);
+ WeaponMode* getWeaponmode(unsigned int index) const;
+
+ inline void setWeaponPack(WeaponPack * weaponPack)
+ { this->weaponPack_ = weaponPack; this->notifyWeaponModes(); }
+ inline WeaponPack * getWeaponPack() const
+ { return this->weaponPack_; }
+
+ inline void setWeaponSlot(WeaponSlot * wSlot)
+ { this->weaponSlot_ = wSlot; }
+ inline WeaponSlot * getWeaponSlot() const
+ { return this->weaponSlot_; }
+
+ private:
+ void reloaded();
+ void notifyWeaponModes();
+
+ WeaponPack* weaponPack_;
+ WeaponSlot* weaponSlot_;
+ std::multimap<unsigned int, WeaponMode*> weaponmodes_;
+
+ Timer<Weapon> reloadTimer_;
+ bool bReloading_;
+ unsigned int reloadingWeaponmode_;
+ };
+}
+
+#endif /* _Weapon_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponMode.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,220 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "WeaponMode.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "Munition.h"
-#include "Weapon.h"
-#include "WeaponPack.h"
-#include "WeaponSystem.h"
-
-namespace orxonox
-{
- WeaponMode::WeaponMode(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(WeaponMode);
-
- this->weapon_ = 0;
- this->mode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
-
- this->munition_ = 0;
- this->initialMunition_ = 0;
- this->initialMagazines_ = 0;
- this->munitionPerShot_ = 1;
-
- this->reloadTime_ = 0.25;
- this->bReloading_ = false;
- this->bAutoReload_ = true;
- this->bParallelReload_ = true;
-
- this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&WeaponMode::reloaded)));
- this->reloadTimer_.stopTimer();
-
- this->damage_ = 0;
- this->muzzleOffset_ = Vector3::ZERO;
- }
-
- WeaponMode::~WeaponMode()
- {
- }
-
- void WeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(WeaponMode, XMLPort, xmlelement, mode);
-
- XMLPortParam(WeaponMode, "mode", setMode, getMode, xmlelement, mode);
-
- XMLPortParam(WeaponMode, "munitiontype", setMunitionName, getMunitionName, xmlelement, mode);
- XMLPortParam(WeaponMode, "initialmunition", setInitialMunition, getInitialMunition, xmlelement, mode);
- XMLPortParam(WeaponMode, "initialmagazines", setInitialMagazines, getInitialMagazines, xmlelement, mode);
- XMLPortParam(WeaponMode, "munitionpershot", setMunitionPerShot, getMunitionPerShot, xmlelement, mode);
-
- XMLPortParam(WeaponMode, "reloadtime", setReloadTime, getReloadTime, xmlelement, mode);
- XMLPortParam(WeaponMode, "autoreload", setAutoReload, getAutoReload, xmlelement, mode).description("If true, the weapon reloads the magazine automatically");
- 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);
- XMLPortParam(WeaponMode, "muzzleoffset", setMuzzleOffset, getMuzzleOffset, xmlelement, mode);
- }
-
- bool WeaponMode::fire(float* reloadTime)
- {
- (*reloadTime) = this->reloadTime_;
-
- if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
- {
- float reloadtime = this->reloadTime_;
-
- if (this->bAutoReload_ && this->munition_->needReload(this))
- {
- if (this->munition_->reload(this))
- {
- if (!this->bParallelReload_)
- reloadtime += this->munition_->getReloadTime();
- }
- }
-
- this->bReloading_ = true;
- this->reloadTimer_.setInterval(reloadtime);
- this->reloadTimer_.startTimer();
-
- this->fire();
-
- return true;
- }
- else
- {
- return false;
- }
- }
-
- bool WeaponMode::reload()
- {
- if (this->munition_ && this->munition_->reload(this))
- {
- if (!this->bParallelReload_)
- {
- this->bReloading_ = true;
- this->reloadTimer_.setInterval(this->reloadTime_ + this->munition_->getReloadTime());
- this->reloadTimer_.startTimer();
- }
-
- return true;
- }
-
- return false;
- }
-
- void WeaponMode::setMunitionType(Identifier* identifier)
- {
- this->munitionname_ = identifier->getName();
- this->munitiontype_ = identifier;
- this->updateMunition();
- }
-
- void WeaponMode::setMunitionName(const std::string& munitionname)
- {
- this->munitionname_ = munitionname;
- this->munitiontype_ = ClassByString(this->munitionname_);
- this->updateMunition();
- }
-
- void WeaponMode::updateMunition()
- {
- if (this->munitiontype_ && this->weapon_ && this->weapon_->getWeaponPack() && this->weapon_->getWeaponPack()->getWeaponSystem())
- {
- this->munition_ = this->weapon_->getWeaponPack()->getWeaponSystem()->getMunition(&this->munitiontype_);
-
- if (this->munition_)
- {
- // Add the initial magazines
- this->munition_->addMagazines(this->initialMagazines_);
-
- // Maybe we have to reload (if this munition is used the first time or if there weren't any magazines available before)
- if (this->munition_->needReload(this))
- this->munition_->reload(this, false);
-
- // Add the initial munition
- if (this->initialMunition_ > 0 && this->munition_->getNumMunitionInCurrentMagazine(this) == this->munition_->getMaxMunitionPerMagazine())
- {
- // The current magazine is still full, so let's just add another magazine to
- // the stack and reduce the current magazine to the given amount of munition
-
- unsigned int initialmunition = this->initialMunition_;
- if (initialmunition > this->munition_->getMaxMunitionPerMagazine())
- initialmunition = this->munition_->getMaxMunitionPerMagazine();
-
- this->munition_->takeMunition(this->munition_->getMaxMunitionPerMagazine() - initialmunition, this);
- this->munition_->addMagazines(1);
- }
- else
- {
- // The current magazine isn't full, add the munition directly
-
- this->munition_->addMunition(this->initialMunition_);
- }
- }
- }
- else
- this->munition_ = 0;
- }
-
- void WeaponMode::reloaded()
- {
- this->bReloading_ = false;
- }
-
- Vector3 WeaponMode::getMuzzlePosition() const
- {
- if (this->weapon_)
- return (this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_);
- else
- return this->muzzleOffset_;
- }
-
- const Quaternion& WeaponMode::getMuzzleOrientation() const
- {
- if (this->weapon_)
- return this->weapon_->getWorldOrientation();
- else
- return Quaternion::IDENTITY;
- }
-
- Vector3 WeaponMode::getMuzzleDirection() const
- {
- if (this->weapon_)
- return (this->weapon_->getWorldOrientation() * WorldEntity::FRONT);
- else
- return WorldEntity::FRONT;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponMode.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponMode.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,220 @@
+/*
+ * 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:
+ * Martin Polak
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WeaponMode.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "Munition.h"
+#include "Weapon.h"
+#include "WeaponPack.h"
+#include "WeaponSystem.h"
+
+namespace orxonox
+{
+ WeaponMode::WeaponMode(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(WeaponMode);
+
+ this->weapon_ = 0;
+ this->mode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED;
+
+ this->munition_ = 0;
+ this->initialMunition_ = 0;
+ this->initialMagazines_ = 0;
+ this->munitionPerShot_ = 1;
+
+ this->reloadTime_ = 0.25;
+ this->bReloading_ = false;
+ this->bAutoReload_ = true;
+ this->bParallelReload_ = true;
+
+ this->reloadTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&WeaponMode::reloaded)));
+ this->reloadTimer_.stopTimer();
+
+ this->damage_ = 0;
+ this->muzzleOffset_ = Vector3::ZERO;
+ }
+
+ WeaponMode::~WeaponMode()
+ {
+ }
+
+ void WeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(WeaponMode, XMLPort, xmlelement, mode);
+
+ XMLPortParam(WeaponMode, "mode", setMode, getMode, xmlelement, mode);
+
+ XMLPortParam(WeaponMode, "munitiontype", setMunitionName, getMunitionName, xmlelement, mode);
+ XMLPortParam(WeaponMode, "initialmunition", setInitialMunition, getInitialMunition, xmlelement, mode);
+ XMLPortParam(WeaponMode, "initialmagazines", setInitialMagazines, getInitialMagazines, xmlelement, mode);
+ XMLPortParam(WeaponMode, "munitionpershot", setMunitionPerShot, getMunitionPerShot, xmlelement, mode);
+
+ XMLPortParam(WeaponMode, "reloadtime", setReloadTime, getReloadTime, xmlelement, mode);
+ XMLPortParam(WeaponMode, "autoreload", setAutoReload, getAutoReload, xmlelement, mode).description("If true, the weapon reloads the magazine automatically");
+ 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);
+ XMLPortParam(WeaponMode, "muzzleoffset", setMuzzleOffset, getMuzzleOffset, xmlelement, mode);
+ }
+
+ bool WeaponMode::fire(float* reloadTime)
+ {
+ (*reloadTime) = this->reloadTime_;
+
+ if (!this->bReloading_ && this->munition_ && this->munition_->takeMunition(this->munitionPerShot_, this))
+ {
+ float reloadtime = this->reloadTime_;
+
+ if (this->bAutoReload_ && this->munition_->needReload(this))
+ {
+ if (this->munition_->reload(this))
+ {
+ if (!this->bParallelReload_)
+ reloadtime += this->munition_->getReloadTime();
+ }
+ }
+
+ this->bReloading_ = true;
+ this->reloadTimer_.setInterval(reloadtime);
+ this->reloadTimer_.startTimer();
+
+ this->fire();
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ bool WeaponMode::reload()
+ {
+ if (this->munition_ && this->munition_->reload(this))
+ {
+ if (!this->bParallelReload_)
+ {
+ this->bReloading_ = true;
+ this->reloadTimer_.setInterval(this->reloadTime_ + this->munition_->getReloadTime());
+ this->reloadTimer_.startTimer();
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void WeaponMode::setMunitionType(Identifier* identifier)
+ {
+ this->munitionname_ = identifier->getName();
+ this->munitiontype_ = identifier;
+ this->updateMunition();
+ }
+
+ void WeaponMode::setMunitionName(const std::string& munitionname)
+ {
+ this->munitionname_ = munitionname;
+ this->munitiontype_ = ClassByString(this->munitionname_);
+ this->updateMunition();
+ }
+
+ void WeaponMode::updateMunition()
+ {
+ if (this->munitiontype_ && this->weapon_ && this->weapon_->getWeaponPack() && this->weapon_->getWeaponPack()->getWeaponSystem())
+ {
+ this->munition_ = this->weapon_->getWeaponPack()->getWeaponSystem()->getMunition(&this->munitiontype_);
+
+ if (this->munition_)
+ {
+ // Add the initial magazines
+ this->munition_->addMagazines(this->initialMagazines_);
+
+ // Maybe we have to reload (if this munition is used the first time or if there weren't any magazines available before)
+ if (this->munition_->needReload(this))
+ this->munition_->reload(this, false);
+
+ // Add the initial munition
+ if (this->initialMunition_ > 0 && this->munition_->getNumMunitionInCurrentMagazine(this) == this->munition_->getMaxMunitionPerMagazine())
+ {
+ // The current magazine is still full, so let's just add another magazine to
+ // the stack and reduce the current magazine to the given amount of munition
+
+ unsigned int initialmunition = this->initialMunition_;
+ if (initialmunition > this->munition_->getMaxMunitionPerMagazine())
+ initialmunition = this->munition_->getMaxMunitionPerMagazine();
+
+ this->munition_->takeMunition(this->munition_->getMaxMunitionPerMagazine() - initialmunition, this);
+ this->munition_->addMagazines(1);
+ }
+ else
+ {
+ // The current magazine isn't full, add the munition directly
+
+ this->munition_->addMunition(this->initialMunition_);
+ }
+ }
+ }
+ else
+ this->munition_ = 0;
+ }
+
+ void WeaponMode::reloaded()
+ {
+ this->bReloading_ = false;
+ }
+
+ Vector3 WeaponMode::getMuzzlePosition() const
+ {
+ if (this->weapon_)
+ return (this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_);
+ else
+ return this->muzzleOffset_;
+ }
+
+ const Quaternion& WeaponMode::getMuzzleOrientation() const
+ {
+ if (this->weapon_)
+ return this->weapon_->getWorldOrientation();
+ else
+ return Quaternion::IDENTITY;
+ }
+
+ Vector3 WeaponMode::getMuzzleDirection() const
+ {
+ if (this->weapon_)
+ return (this->weapon_->getWorldOrientation() * WorldEntity::FRONT);
+ else
+ return WorldEntity::FRONT;
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponMode.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponMode.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponMode.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,156 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _WeaponMode_H__
-#define _WeaponMode_H__
-
-#include "OrxonoxPrereqs.h"
-#include "core/BaseObject.h"
-
-#include "tools/Timer.h"
-#include "core/Identifier.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
- class _OrxonoxExport WeaponMode : public BaseObject
- {
- public:
- WeaponMode(BaseObject* creator);
- virtual ~WeaponMode();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- bool fire(float* reloadTime);
- bool reload();
-
-
- // Munition
- inline Munition* getMunition() const
- { return this->munition_; }
-
- void setMunitionType(Identifier* identifier);
- inline Identifier* getMunitionType() const
- { return this->munitiontype_; }
-
- void setMunitionName(const std::string& munitionname);
- inline const std::string& getMunitionName() const
- { return this->munitionname_; }
-
- inline void setInitialMunition(unsigned int amount)
- { this->initialMunition_ = amount; }
- inline unsigned int getInitialMunition() const
- { return this->initialMunition_; }
-
- inline void setInitialMagazines(unsigned int amount)
- { this->initialMagazines_ = amount; }
- inline unsigned int getInitialMagazines() const
- { return this->initialMagazines_; }
-
- inline void setMunitionPerShot(unsigned int amount)
- { this->munitionPerShot_ = amount; }
- inline unsigned int getMunitionPerShot() const
- { return this->munitionPerShot_; }
-
-
- // Reloading
- inline void setReloadTime(float time)
- { this->reloadTime_ = time; }
- inline float getReloadTime() const
- { return this->reloadTime_; }
-
- inline void setAutoReload(bool autoreload)
- { this->bAutoReload_ = autoreload; }
- inline bool getAutoReload() const
- { return this->bAutoReload_; }
-
- inline void setParallelReload(bool parallelreload)
- { this->bParallelReload_ = parallelreload; }
- inline bool getParallelReload() const
- { return this->bParallelReload_; }
-
-
- // Fire
- inline void setDamage(float damage)
- { this->damage_ = damage; }
- inline float getDamage() const
- { return this->damage_; }
-
- inline void setMuzzleOffset(const Vector3& offset)
- { this->muzzleOffset_ = offset; }
- inline const Vector3& getMuzzleOffset() const
- { return this->muzzleOffset_; }
-
- Vector3 getMuzzlePosition() const;
- const Quaternion& getMuzzleOrientation() const;
- Vector3 getMuzzleDirection() const;
-
-
- // Weapon
- inline void setWeapon(Weapon* weapon)
- { this->weapon_ = weapon; this->updateMunition(); }
- inline Weapon* getWeapon() const
- { return this->weapon_; }
-
- inline void setMode(unsigned int mode)
- { this->mode_ = mode; }
- inline unsigned int getMode() const
- { return this->mode_; }
-
- protected:
- virtual void fire() = 0;
-
- unsigned int initialMunition_;
- unsigned int initialMagazines_;
- unsigned int munitionPerShot_;
-
- float reloadTime_;
- bool bAutoReload_;
- bool bParallelReload_;
-
- float damage_;
- Vector3 muzzleOffset_;
-
- private:
- void updateMunition();
- void reloaded();
-
- Weapon* weapon_;
- unsigned int mode_;
-
- Munition* munition_;
- SubclassIdentifier<Munition> munitiontype_;
- std::string munitionname_;
-
- Timer<WeaponMode> reloadTimer_;
- bool bReloading_;
- };
-}
-
-#endif /* _WeaponMode_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponMode.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponMode.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponMode.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponMode.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,156 @@
+/*
+ * 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:
+ * Martin Polak
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _WeaponMode_H__
+#define _WeaponMode_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/BaseObject.h"
+
+#include "tools/Timer.h"
+#include "core/Identifier.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport WeaponMode : public BaseObject
+ {
+ public:
+ WeaponMode(BaseObject* creator);
+ virtual ~WeaponMode();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ bool fire(float* reloadTime);
+ bool reload();
+
+
+ // Munition
+ inline Munition* getMunition() const
+ { return this->munition_; }
+
+ void setMunitionType(Identifier* identifier);
+ inline Identifier* getMunitionType() const
+ { return this->munitiontype_; }
+
+ void setMunitionName(const std::string& munitionname);
+ inline const std::string& getMunitionName() const
+ { return this->munitionname_; }
+
+ inline void setInitialMunition(unsigned int amount)
+ { this->initialMunition_ = amount; }
+ inline unsigned int getInitialMunition() const
+ { return this->initialMunition_; }
+
+ inline void setInitialMagazines(unsigned int amount)
+ { this->initialMagazines_ = amount; }
+ inline unsigned int getInitialMagazines() const
+ { return this->initialMagazines_; }
+
+ inline void setMunitionPerShot(unsigned int amount)
+ { this->munitionPerShot_ = amount; }
+ inline unsigned int getMunitionPerShot() const
+ { return this->munitionPerShot_; }
+
+
+ // Reloading
+ inline void setReloadTime(float time)
+ { this->reloadTime_ = time; }
+ inline float getReloadTime() const
+ { return this->reloadTime_; }
+
+ inline void setAutoReload(bool autoreload)
+ { this->bAutoReload_ = autoreload; }
+ inline bool getAutoReload() const
+ { return this->bAutoReload_; }
+
+ inline void setParallelReload(bool parallelreload)
+ { this->bParallelReload_ = parallelreload; }
+ inline bool getParallelReload() const
+ { return this->bParallelReload_; }
+
+
+ // Fire
+ inline void setDamage(float damage)
+ { this->damage_ = damage; }
+ inline float getDamage() const
+ { return this->damage_; }
+
+ inline void setMuzzleOffset(const Vector3& offset)
+ { this->muzzleOffset_ = offset; }
+ inline const Vector3& getMuzzleOffset() const
+ { return this->muzzleOffset_; }
+
+ Vector3 getMuzzlePosition() const;
+ const Quaternion& getMuzzleOrientation() const;
+ Vector3 getMuzzleDirection() const;
+
+
+ // Weapon
+ inline void setWeapon(Weapon* weapon)
+ { this->weapon_ = weapon; this->updateMunition(); }
+ inline Weapon* getWeapon() const
+ { return this->weapon_; }
+
+ inline void setMode(unsigned int mode)
+ { this->mode_ = mode; }
+ inline unsigned int getMode() const
+ { return this->mode_; }
+
+ protected:
+ virtual void fire() = 0;
+
+ unsigned int initialMunition_;
+ unsigned int initialMagazines_;
+ unsigned int munitionPerShot_;
+
+ float reloadTime_;
+ bool bAutoReload_;
+ bool bParallelReload_;
+
+ float damage_;
+ Vector3 muzzleOffset_;
+
+ private:
+ void updateMunition();
+ void reloaded();
+
+ Weapon* weapon_;
+ unsigned int mode_;
+
+ Munition* munition_;
+ SubclassIdentifier<Munition> munitiontype_;
+ std::string munitionname_;
+
+ Timer<WeaponMode> reloadTimer_;
+ bool bReloading_;
+ };
+}
+
+#endif /* _WeaponMode_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponPack.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,150 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "WeaponPack.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/worldentities/pawns/Pawn.h"
-
-#include "Weapon.h"
-#include "WeaponSlot.h"
-#include "WeaponSystem.h"
-#include "DefaultWeaponmodeLink.h"
-
-namespace orxonox
-{
- CreateFactory(WeaponPack);
-
- WeaponPack::WeaponPack(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(WeaponPack);
-
- this->weaponSystem_ = 0;
- }
-
- WeaponPack::~WeaponPack()
- {
- if (this->isInitialized() && this->weaponSystem_)
- {
- this->weaponSystem_->removeWeaponPack(this);
-
- while (!this->weapons_.empty())
- delete (*this->weapons_.begin());
-
- for (std::set<DefaultWeaponmodeLink*>::iterator it = this->links_.begin(); it != this->links_.end(); )
- delete (*(it++));
- }
- }
-
- void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(WeaponPack, XMLPort, xmlelement, mode);
-
- XMLPortObjectExtended(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode, false, false);
- XMLPortObject(WeaponPack, DefaultWeaponmodeLink, "links", addDefaultWeaponmodeLink, getDefaultWeaponmodeLink, xmlelement, mode);
- }
-
- void WeaponPack::fire(unsigned int weaponmode)
- {
- for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
- (*it)->fire(weaponmode);
- }
-
- void WeaponPack::reload()
- {
- for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
- (*it)->reload();
- }
-
- void WeaponPack::addWeapon(Weapon * weapon)
- {
- if (!weapon)
- return;
-
- this->weapons_.insert(weapon);
- weapon->setWeaponPack(this);
- }
-
- void WeaponPack::removeWeapon(Weapon * weapon)
- {
- if (!weapon)
- return;
-
- this->weapons_.erase(weapon);
- weapon->setWeaponPack(0);
- }
-
- Weapon * WeaponPack::getWeapon(unsigned int index) const
- {
- unsigned int i = 0;
-
- for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
- {
- if (i == index)
- return (*it);
- ++i;
- }
-
- return 0;
- }
-
- void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link)
- {
- this->links_.insert(link);
- }
-
- DefaultWeaponmodeLink* WeaponPack::getDefaultWeaponmodeLink(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
- {
- if (i == index)
- return (*it);
-
- ++i;
- }
- return 0;
- }
-
- unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
- {
- for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
- if ((*it)->getFiremode() == firemode)
- return (*it)->getWeaponmode();
-
- return WeaponSystem::WEAPON_MODE_UNASSIGNED;
- }
-
- void WeaponPack::notifyWeapons()
- {
- for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
- (*it)->setWeaponPack(this);
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponPack.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponPack.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,150 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WeaponPack.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+#include "Weapon.h"
+#include "WeaponSlot.h"
+#include "WeaponSystem.h"
+#include "DefaultWeaponmodeLink.h"
+
+namespace orxonox
+{
+ CreateFactory(WeaponPack);
+
+ WeaponPack::WeaponPack(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(WeaponPack);
+
+ this->weaponSystem_ = 0;
+ }
+
+ WeaponPack::~WeaponPack()
+ {
+ if (this->isInitialized() && this->weaponSystem_)
+ {
+ this->weaponSystem_->removeWeaponPack(this);
+
+ while (!this->weapons_.empty())
+ delete (*this->weapons_.begin());
+
+ for (std::set<DefaultWeaponmodeLink*>::iterator it = this->links_.begin(); it != this->links_.end(); )
+ delete (*(it++));
+ }
+ }
+
+ void WeaponPack::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(WeaponPack, XMLPort, xmlelement, mode);
+
+ XMLPortObjectExtended(WeaponPack, Weapon, "", addWeapon, getWeapon, xmlelement, mode, false, false);
+ XMLPortObject(WeaponPack, DefaultWeaponmodeLink, "links", addDefaultWeaponmodeLink, getDefaultWeaponmodeLink, xmlelement, mode);
+ }
+
+ void WeaponPack::fire(unsigned int weaponmode)
+ {
+ for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ (*it)->fire(weaponmode);
+ }
+
+ void WeaponPack::reload()
+ {
+ for (std::set<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ (*it)->reload();
+ }
+
+ void WeaponPack::addWeapon(Weapon * weapon)
+ {
+ if (!weapon)
+ return;
+
+ this->weapons_.insert(weapon);
+ weapon->setWeaponPack(this);
+ }
+
+ void WeaponPack::removeWeapon(Weapon * weapon)
+ {
+ if (!weapon)
+ return;
+
+ this->weapons_.erase(weapon);
+ weapon->setWeaponPack(0);
+ }
+
+ Weapon * WeaponPack::getWeapon(unsigned int index) const
+ {
+ unsigned int i = 0;
+
+ for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ {
+ if (i == index)
+ return (*it);
+ ++i;
+ }
+
+ return 0;
+ }
+
+ void WeaponPack::addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link)
+ {
+ this->links_.insert(link);
+ }
+
+ DefaultWeaponmodeLink* WeaponPack::getDefaultWeaponmodeLink(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
+ {
+ if (i == index)
+ return (*it);
+
+ ++i;
+ }
+ return 0;
+ }
+
+ unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const
+ {
+ for (std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)
+ if ((*it)->getFiremode() == firemode)
+ return (*it)->getWeaponmode();
+
+ return WeaponSystem::WEAPON_MODE_UNASSIGNED;
+ }
+
+ void WeaponPack::notifyWeapons()
+ {
+ for (std::set<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)
+ (*it)->setWeaponPack(this);
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponPack.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponPack.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponPack.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,78 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef _WeaponPack_H__
-#define _WeaponPack_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <set>
-
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
- class _OrxonoxExport WeaponPack : public BaseObject
- {
- public:
- WeaponPack(BaseObject* creator);
- virtual ~WeaponPack();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void fire(unsigned int weaponmode);
- void reload();
-
- void addWeapon(Weapon * weapon);
- void removeWeapon(Weapon * weapon);
- Weapon * getWeapon(unsigned int index) const;
-
- inline size_t getNumWeapons() const
- { return this->weapons_.size(); }
-
- void addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link);
- DefaultWeaponmodeLink* getDefaultWeaponmodeLink(unsigned int index) const;
-
- unsigned int getDesiredWeaponmode(unsigned int firemode) const;
-
- inline void setWeaponSystem(WeaponSystem * weaponSystem)
- { this->weaponSystem_ = weaponSystem; this->notifyWeapons(); }
- inline WeaponSystem * getWeaponSystem() const
- { return this->weaponSystem_; }
-
- private:
- void notifyWeapons();
-
- std::set<Weapon *> weapons_;
- std::set<DefaultWeaponmodeLink *> links_;
- WeaponSystem * weaponSystem_;
- };
-}
-
-#endif /* _WeaponPack_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponPack.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponPack.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponPack.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponPack.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _WeaponPack_H__
+#define _WeaponPack_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <set>
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport WeaponPack : public BaseObject
+ {
+ public:
+ WeaponPack(BaseObject* creator);
+ virtual ~WeaponPack();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void fire(unsigned int weaponmode);
+ void reload();
+
+ void addWeapon(Weapon * weapon);
+ void removeWeapon(Weapon * weapon);
+ Weapon * getWeapon(unsigned int index) const;
+
+ inline size_t getNumWeapons() const
+ { return this->weapons_.size(); }
+
+ void addDefaultWeaponmodeLink(DefaultWeaponmodeLink* link);
+ DefaultWeaponmodeLink* getDefaultWeaponmodeLink(unsigned int index) const;
+
+ unsigned int getDesiredWeaponmode(unsigned int firemode) const;
+
+ inline void setWeaponSystem(WeaponSystem * weaponSystem)
+ { this->weaponSystem_ = weaponSystem; this->notifyWeapons(); }
+ inline WeaponSystem * getWeaponSystem() const
+ { return this->weaponSystem_; }
+
+ private:
+ void notifyWeapons();
+
+ std::set<Weapon *> weapons_;
+ std::set<DefaultWeaponmodeLink *> links_;
+ WeaponSystem * weaponSystem_;
+ };
+}
+
+#endif /* _WeaponPack_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponSet.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,96 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "WeaponSet.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "WeaponSystem.h"
-#include "WeaponPack.h"
-
-namespace orxonox
-{
- CreateFactory(WeaponSet);
-
- WeaponSet::WeaponSet(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(WeaponSet);
-
- this->weaponSystem_ = 0;
- this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
- }
-
- WeaponSet::~WeaponSet()
- {
- if (this->isInitialized() && this->weaponSystem_)
- this->weaponSystem_->removeWeaponSet(this);
- }
-
- void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(WeaponSet, XMLPort, xmlelement, mode);
-
- XMLPortParam(WeaponSet, "firemode", setDesiredFiremode, getDesiredFiremode, xmlelement, mode);
- }
-
- void WeaponSet::fire()
- {
- // fire all WeaponPacks with their defined weaponmode
- for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
- if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
- it->first->fire(it->second);
- }
-
- void WeaponSet::reload()
- {
- // fire all WeaponPacks with their defined weaponmode
- for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
- it->first->reload();
- }
-
- void WeaponSet::setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode)
- {
- this->weaponpacks_[weaponpack] = weaponmode;
- }
-
- void WeaponSet::removeWeaponmodeLink(WeaponPack* weaponpack)
- {
- this->weaponpacks_.erase(weaponpack);
- }
-
- unsigned int WeaponSet::getWeaponmodeLink(WeaponPack* weaponpack)
- {
- std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.find(weaponpack);
- if (it != this->weaponpacks_.end())
- return it->second;
- else
- return WeaponSystem::WEAPON_MODE_UNASSIGNED;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponSet.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSet.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,96 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WeaponSet.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "WeaponSystem.h"
+#include "WeaponPack.h"
+
+namespace orxonox
+{
+ CreateFactory(WeaponSet);
+
+ WeaponSet::WeaponSet(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(WeaponSet);
+
+ this->weaponSystem_ = 0;
+ this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED;
+ }
+
+ WeaponSet::~WeaponSet()
+ {
+ if (this->isInitialized() && this->weaponSystem_)
+ this->weaponSystem_->removeWeaponSet(this);
+ }
+
+ void WeaponSet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(WeaponSet, XMLPort, xmlelement, mode);
+
+ XMLPortParam(WeaponSet, "firemode", setDesiredFiremode, getDesiredFiremode, xmlelement, mode);
+ }
+
+ void WeaponSet::fire()
+ {
+ // fire all WeaponPacks with their defined weaponmode
+ for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
+ if (it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)
+ it->first->fire(it->second);
+ }
+
+ void WeaponSet::reload()
+ {
+ // fire all WeaponPacks with their defined weaponmode
+ for (std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)
+ it->first->reload();
+ }
+
+ void WeaponSet::setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode)
+ {
+ this->weaponpacks_[weaponpack] = weaponmode;
+ }
+
+ void WeaponSet::removeWeaponmodeLink(WeaponPack* weaponpack)
+ {
+ this->weaponpacks_.erase(weaponpack);
+ }
+
+ unsigned int WeaponSet::getWeaponmodeLink(WeaponPack* weaponpack)
+ {
+ std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.find(weaponpack);
+ if (it != this->weaponpacks_.end())
+ return it->second;
+ else
+ return WeaponSystem::WEAPON_MODE_UNASSIGNED;
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponSet.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponSet.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSet.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,73 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef _WeaponSet_H__
-#define _WeaponSet_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <map>
-
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
- class _OrxonoxExport WeaponSet : public BaseObject
- {
- public:
- WeaponSet(BaseObject* creator);
- virtual ~WeaponSet();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void fire();
- void reload();
-
- void setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode);
- void removeWeaponmodeLink(WeaponPack* weaponpack);
- unsigned int getWeaponmodeLink(WeaponPack* weaponpack);
-
- inline void setDesiredFiremode(const unsigned int firemode)
- { this->desiredFiremode_ = firemode; }
- inline unsigned int getDesiredFiremode() const
- { return this->desiredFiremode_; }
-
- inline void setWeaponSystem(WeaponSystem *weaponSystem)
- { this->weaponSystem_ = weaponSystem; }
- inline WeaponSystem * getWeaponSystem() const
- { return this->weaponSystem_; }
-
- private:
- WeaponSystem * weaponSystem_;
- unsigned int desiredFiremode_;
- std::map<WeaponPack*, unsigned int> weaponpacks_;
- };
-}
-
-#endif /* _WeaponSet_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponSet.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponSet.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSet.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSet.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,73 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _WeaponSet_H__
+#define _WeaponSet_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <map>
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport WeaponSet : public BaseObject
+ {
+ public:
+ WeaponSet(BaseObject* creator);
+ virtual ~WeaponSet();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void fire();
+ void reload();
+
+ void setWeaponmodeLink(WeaponPack* weaponpack, unsigned int weaponmode);
+ void removeWeaponmodeLink(WeaponPack* weaponpack);
+ unsigned int getWeaponmodeLink(WeaponPack* weaponpack);
+
+ inline void setDesiredFiremode(const unsigned int firemode)
+ { this->desiredFiremode_ = firemode; }
+ inline unsigned int getDesiredFiremode() const
+ { return this->desiredFiremode_; }
+
+ inline void setWeaponSystem(WeaponSystem *weaponSystem)
+ { this->weaponSystem_ = weaponSystem; }
+ inline WeaponSystem * getWeaponSystem() const
+ { return this->weaponSystem_; }
+
+ private:
+ WeaponSystem * weaponSystem_;
+ unsigned int desiredFiremode_;
+ std::map<WeaponPack*, unsigned int> weaponpacks_;
+ };
+}
+
+#endif /* _WeaponSet_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponSlot.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,87 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "WeaponSlot.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "Weapon.h"
-#include "WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(WeaponSlot);
-
- WeaponSlot::WeaponSlot(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(WeaponSlot);
-
- this->weaponSystem_ = 0;
- this->weapon_ = 0;
-
- this->setObjectMode(0x0);
- }
-
- WeaponSlot::~WeaponSlot()
- {
- if (this->isInitialized() && this->weaponSystem_)
- this->weaponSystem_->removeWeaponSlot(this);
- }
-
- void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(WeaponSlot, XMLPort, xmlelement, mode);
-
- // In the future, there might be parameters like allowed weapon types or max size of the weapon
- }
-
- void WeaponSlot::attachWeapon(Weapon *weapon)
- {
- if (this->weapon_)
- this->removeWeapon();
-
- this->weapon_ = weapon;
-
- if (this->weapon_)
- {
- this->weapon_->setWeaponSlot(this);
- this->weapon_->setPosition(this->getPosition());
- }
- }
-
- void WeaponSlot::removeWeapon()
- {
- if (this->weapon_)
- {
- this->weapon_->setWeaponSlot(0);
- this->weapon_ = 0;
- }
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponSlot.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSlot.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,87 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WeaponSlot.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "Weapon.h"
+#include "WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(WeaponSlot);
+
+ WeaponSlot::WeaponSlot(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(WeaponSlot);
+
+ this->weaponSystem_ = 0;
+ this->weapon_ = 0;
+
+ this->setObjectMode(0x0);
+ }
+
+ WeaponSlot::~WeaponSlot()
+ {
+ if (this->isInitialized() && this->weaponSystem_)
+ this->weaponSystem_->removeWeaponSlot(this);
+ }
+
+ void WeaponSlot::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(WeaponSlot, XMLPort, xmlelement, mode);
+
+ // In the future, there might be parameters like allowed weapon types or max size of the weapon
+ }
+
+ void WeaponSlot::attachWeapon(Weapon *weapon)
+ {
+ if (this->weapon_)
+ this->removeWeapon();
+
+ this->weapon_ = weapon;
+
+ if (this->weapon_)
+ {
+ this->weapon_->setWeaponSlot(this);
+ this->weapon_->setPosition(this->getPosition());
+ }
+ }
+
+ void WeaponSlot::removeWeapon()
+ {
+ if (this->weapon_)
+ {
+ this->weapon_->setWeaponSlot(0);
+ this->weapon_ = 0;
+ }
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponSlot.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,65 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _WeaponSlot_H__
-#define _WeaponSlot_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport WeaponSlot : public StaticEntity
- {
- public:
- WeaponSlot(BaseObject* creator);
- virtual ~WeaponSlot();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void attachWeapon(Weapon * weapon);
- void removeWeapon();
- Weapon * getWeapon() const
- { return this->weapon_; }
-
- inline bool isOccupied() const
- { return (this->weapon_ != 0); }
-
- inline void setWeaponSystem(WeaponSystem * weaponSystem)
- { this->weaponSystem_ = weaponSystem; }
- inline WeaponSystem * getWeaponSystem() const
- { return this->weaponSystem_; }
-
-
- private:
- WeaponSystem * weaponSystem_;
- Weapon * weapon_;
- };
-}
-
-#endif /* _WeaponSlot_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponSlot.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSlot.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _WeaponSlot_H__
+#define _WeaponSlot_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport WeaponSlot : public StaticEntity
+ {
+ public:
+ WeaponSlot(BaseObject* creator);
+ virtual ~WeaponSlot();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void attachWeapon(Weapon * weapon);
+ void removeWeapon();
+ Weapon * getWeapon() const
+ { return this->weapon_; }
+
+ inline bool isOccupied() const
+ { return (this->weapon_ != 0); }
+
+ inline void setWeaponSystem(WeaponSystem * weaponSystem)
+ { this->weaponSystem_ = weaponSystem; }
+ inline WeaponSystem * getWeaponSystem() const
+ { return this->weaponSystem_; }
+
+
+ private:
+ WeaponSystem * weaponSystem_;
+ Weapon * weapon_;
+ };
+}
+
+#endif /* _WeaponSlot_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponSystem.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,316 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "WeaponSystem.h"
-
-#include "core/CoreIncludes.h"
-#include "objects/worldentities/pawns/Pawn.h"
-
-#include "WeaponSlot.h"
-#include "WeaponPack.h"
-#include "WeaponSet.h"
-#include "Weapon.h"
-#include "Munition.h"
-
-/* WeaponSystem
- *
- * www.orxonox.net/wiki/WeaponSystem
- */
-
-namespace orxonox
-{
- CreateFactory(WeaponSystem);
-
- WeaponSystem::WeaponSystem(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(WeaponSystem);
-
- this->pawn_ = 0;
- }
-
- WeaponSystem::~WeaponSystem()
- {
- if (this->isInitialized())
- {
- if (this->pawn_)
- this->pawn_->setWeaponSystem(0);
-
- while (!this->weaponSets_.empty())
- delete (this->weaponSets_.begin()->second);
-
- while (!this->weaponPacks_.empty())
- delete (*this->weaponPacks_.begin());
-
- while (!this->weaponSlots_.empty())
- delete (*this->weaponSlots_.begin());
-
- while (!this->munitions_.empty())
- { delete (this->munitions_.begin()->second); this->munitions_.erase(this->munitions_.begin()); }
- }
- }
-
- void WeaponSystem::addWeaponSlot(WeaponSlot * wSlot)
- {
- if (!wSlot)
- return;
-
- this->weaponSlots_.push_back(wSlot);
- wSlot->setWeaponSystem(this);
- }
-
- void WeaponSystem::removeWeaponSlot(WeaponSlot * wSlot)
- {
- if (!wSlot)
- return;
-
- if (wSlot->getWeapon())
- this->removeWeaponPack(wSlot->getWeapon()->getWeaponPack());
-
- for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
- {
- if ((*it) == wSlot)
- {
- this->weaponSlots_.erase(it);
- break;
- }
- }
- }
-
- WeaponSlot * WeaponSystem::getWeaponSlot(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
- {
- ++i;
- if (i > index)
- return (*it);
- }
- return 0;
- }
-
- bool WeaponSystem::addWeaponSet(WeaponSet * wSet)
- {
- if (wSet)
- return this->addWeaponSet(wSet, wSet->getDesiredFiremode());
- else
- return false;
- }
-
- bool WeaponSystem::addWeaponSet(WeaponSet * wSet, unsigned int firemode)
- {
- if (!wSet || firemode >= WeaponSystem::MAX_FIRE_MODES)
- return false;
-
- std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.find(firemode);
- if (it == this->weaponSets_.end())
- {
- this->weaponSets_[firemode] = wSet;
- wSet->setWeaponSystem(this);
- return true;
- }
-
- return false;
- }
-
- void WeaponSystem::removeWeaponSet(WeaponSet * wSet)
- {
- for (std::map<unsigned int, WeaponSet*>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); )
- {
- if (it->second == wSet)
- this->weaponSets_.erase(it++);
- else
- ++it;
- }
- }
-
- WeaponSet * WeaponSystem::getWeaponSet(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
- {
- ++i;
- if (i > index)
- return it->second;
- }
- return 0;
- }
-
- bool WeaponSystem::canAddWeaponPack(WeaponPack * wPack)
- {
- if (!wPack)
- return false;
-
- unsigned int freeSlots = 0;
- for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
- {
- if (!(*it)->isOccupied())
- ++freeSlots;
- }
-
- return (freeSlots >= wPack->getNumWeapons());
- }
-
- bool WeaponSystem::addWeaponPack(WeaponPack * wPack)
- {
- if (!this->canAddWeaponPack(wPack))
- return false;
-
- // Attach all weapons to the first free slots (and to the Pawn)
- unsigned int i = 0;
- for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
- {
- if (!(*it)->isOccupied() && i < wPack->getNumWeapons())
- {
- Weapon* weapon = wPack->getWeapon(i);
- (*it)->attachWeapon(weapon);
- this->getPawn()->attach(weapon);
- ++i;
- }
- }
-
- // Assign the desired weaponmode to the firemodes
- for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
- {
- unsigned int weaponmode = wPack->getDesiredWeaponmode(it->first);
- if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
- it->second->setWeaponmodeLink(wPack, weaponmode);
- }
-
- this->weaponPacks_.insert(wPack);
- wPack->setWeaponSystem(this);
-
- return true;
- }
-
- void WeaponSystem::removeWeaponPack(WeaponPack * wPack)
- {
- // Remove all weapons from their WeaponSlot
- unsigned int i = 0;
- Weapon* weapon = 0;
- while (weapon = wPack->getWeapon(i++))
- weapon->getWeaponSlot()->removeWeapon();
-
- // Remove all added links from the WeaponSets
- for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
- it->second->removeWeaponmodeLink(wPack);
-
- // Remove the WeaponPack from the WeaponSystem
- this->weaponPacks_.erase(wPack);
- }
-
- WeaponPack * WeaponSystem::getWeaponPack(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
- {
- ++i;
- if (i > index)
- return (*it);
- }
- return 0;
- }
-
- bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
- {
- if (!wSlot1 || !wSlot2)
- return false;
-
- Weapon* weapon1 = wSlot1->getWeapon();
- Weapon* weapon2 = wSlot2->getWeapon();
-
- wSlot1->attachWeapon(weapon2);
- wSlot2->attachWeapon(weapon1);
-
- return true;
- // In the future, certain weapons might not fit to some slots. Swapping would then be
- // impossible and the returnvalue would be false.
- }
-
- void WeaponSystem::changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode)
- {
- if (!wPack || !wSet)
- return;
-
- // Check if the WeaponPack belongs to this WeaponSystem
- std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
- if (it1 == this->weaponPacks_.end())
- return;
-
- // Check if the WeaponSet belongs to this WeaponSystem
- bool foundWeaponSet = false;
- for (std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)
- {
- if (it2->second == wSet)
- {
- foundWeaponSet = true;
- break;
- }
- }
- if (!foundWeaponSet)
- return;
-
- // Finally set the link between firemode and weaponmode
- wSet->setWeaponmodeLink(wPack, weaponmode);
- }
-
- void WeaponSystem::fire(unsigned int firemode)
- {
- std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
- if (it != this->weaponSets_.end() && it->second)
- it->second->fire();
- }
-
- void WeaponSystem::reload()
- {
- for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
- it->second->reload();
- }
-
- Munition * WeaponSystem::getMunition(SubclassIdentifier<Munition> * identifier)
- {
- if (!identifier || !identifier->getIdentifier())
- return 0;
-
- std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier());
- if (it != this->munitions_.end())
- {
- return it->second;
- }
- else if (identifier->getIdentifier()->isA(Class(Munition)))
- {
- Munition* munition = identifier->fabricate(this);
- this->munitions_[identifier->getIdentifier()] = munition;
- return munition;
- }
- else
- {
- return 0;
- }
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponSystem.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,316 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "WeaponSystem.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/worldentities/pawns/Pawn.h"
+
+#include "WeaponSlot.h"
+#include "WeaponPack.h"
+#include "WeaponSet.h"
+#include "Weapon.h"
+#include "Munition.h"
+
+/* WeaponSystem
+ *
+ * www.orxonox.net/wiki/WeaponSystem
+ */
+
+namespace orxonox
+{
+ CreateFactory(WeaponSystem);
+
+ WeaponSystem::WeaponSystem(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(WeaponSystem);
+
+ this->pawn_ = 0;
+ }
+
+ WeaponSystem::~WeaponSystem()
+ {
+ if (this->isInitialized())
+ {
+ if (this->pawn_)
+ this->pawn_->setWeaponSystem(0);
+
+ while (!this->weaponSets_.empty())
+ delete (this->weaponSets_.begin()->second);
+
+ while (!this->weaponPacks_.empty())
+ delete (*this->weaponPacks_.begin());
+
+ while (!this->weaponSlots_.empty())
+ delete (*this->weaponSlots_.begin());
+
+ while (!this->munitions_.empty())
+ { delete (this->munitions_.begin()->second); this->munitions_.erase(this->munitions_.begin()); }
+ }
+ }
+
+ void WeaponSystem::addWeaponSlot(WeaponSlot * wSlot)
+ {
+ if (!wSlot)
+ return;
+
+ this->weaponSlots_.push_back(wSlot);
+ wSlot->setWeaponSystem(this);
+ }
+
+ void WeaponSystem::removeWeaponSlot(WeaponSlot * wSlot)
+ {
+ if (!wSlot)
+ return;
+
+ if (wSlot->getWeapon())
+ this->removeWeaponPack(wSlot->getWeapon()->getWeaponPack());
+
+ for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+ {
+ if ((*it) == wSlot)
+ {
+ this->weaponSlots_.erase(it);
+ break;
+ }
+ }
+ }
+
+ WeaponSlot * WeaponSystem::getWeaponSlot(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+ {
+ ++i;
+ if (i > index)
+ return (*it);
+ }
+ return 0;
+ }
+
+ bool WeaponSystem::addWeaponSet(WeaponSet * wSet)
+ {
+ if (wSet)
+ return this->addWeaponSet(wSet, wSet->getDesiredFiremode());
+ else
+ return false;
+ }
+
+ bool WeaponSystem::addWeaponSet(WeaponSet * wSet, unsigned int firemode)
+ {
+ if (!wSet || firemode >= WeaponSystem::MAX_FIRE_MODES)
+ return false;
+
+ std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.find(firemode);
+ if (it == this->weaponSets_.end())
+ {
+ this->weaponSets_[firemode] = wSet;
+ wSet->setWeaponSystem(this);
+ return true;
+ }
+
+ return false;
+ }
+
+ void WeaponSystem::removeWeaponSet(WeaponSet * wSet)
+ {
+ for (std::map<unsigned int, WeaponSet*>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); )
+ {
+ if (it->second == wSet)
+ this->weaponSets_.erase(it++);
+ else
+ ++it;
+ }
+ }
+
+ WeaponSet * WeaponSystem::getWeaponSet(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+ {
+ ++i;
+ if (i > index)
+ return it->second;
+ }
+ return 0;
+ }
+
+ bool WeaponSystem::canAddWeaponPack(WeaponPack * wPack)
+ {
+ if (!wPack)
+ return false;
+
+ unsigned int freeSlots = 0;
+ for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+ {
+ if (!(*it)->isOccupied())
+ ++freeSlots;
+ }
+
+ return (freeSlots >= wPack->getNumWeapons());
+ }
+
+ bool WeaponSystem::addWeaponPack(WeaponPack * wPack)
+ {
+ if (!this->canAddWeaponPack(wPack))
+ return false;
+
+ // Attach all weapons to the first free slots (and to the Pawn)
+ unsigned int i = 0;
+ for (std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)
+ {
+ if (!(*it)->isOccupied() && i < wPack->getNumWeapons())
+ {
+ Weapon* weapon = wPack->getWeapon(i);
+ (*it)->attachWeapon(weapon);
+ this->getPawn()->attach(weapon);
+ ++i;
+ }
+ }
+
+ // Assign the desired weaponmode to the firemodes
+ for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+ {
+ unsigned int weaponmode = wPack->getDesiredWeaponmode(it->first);
+ if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED)
+ it->second->setWeaponmodeLink(wPack, weaponmode);
+ }
+
+ this->weaponPacks_.insert(wPack);
+ wPack->setWeaponSystem(this);
+
+ return true;
+ }
+
+ void WeaponSystem::removeWeaponPack(WeaponPack * wPack)
+ {
+ // Remove all weapons from their WeaponSlot
+ unsigned int i = 0;
+ Weapon* weapon = 0;
+ while (weapon = wPack->getWeapon(i++))
+ weapon->getWeaponSlot()->removeWeapon();
+
+ // Remove all added links from the WeaponSets
+ for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+ it->second->removeWeaponmodeLink(wPack);
+
+ // Remove the WeaponPack from the WeaponSystem
+ this->weaponPacks_.erase(wPack);
+ }
+
+ WeaponPack * WeaponSystem::getWeaponPack(unsigned int index) const
+ {
+ unsigned int i = 0;
+ for (std::set<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)
+ {
+ ++i;
+ if (i > index)
+ return (*it);
+ }
+ return 0;
+ }
+
+ bool WeaponSystem::swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2)
+ {
+ if (!wSlot1 || !wSlot2)
+ return false;
+
+ Weapon* weapon1 = wSlot1->getWeapon();
+ Weapon* weapon2 = wSlot2->getWeapon();
+
+ wSlot1->attachWeapon(weapon2);
+ wSlot2->attachWeapon(weapon1);
+
+ return true;
+ // In the future, certain weapons might not fit to some slots. Swapping would then be
+ // impossible and the returnvalue would be false.
+ }
+
+ void WeaponSystem::changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode)
+ {
+ if (!wPack || !wSet)
+ return;
+
+ // Check if the WeaponPack belongs to this WeaponSystem
+ std::set<WeaponPack *>::iterator it1 = this->weaponPacks_.find(wPack);
+ if (it1 == this->weaponPacks_.end())
+ return;
+
+ // Check if the WeaponSet belongs to this WeaponSystem
+ bool foundWeaponSet = false;
+ for (std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)
+ {
+ if (it2->second == wSet)
+ {
+ foundWeaponSet = true;
+ break;
+ }
+ }
+ if (!foundWeaponSet)
+ return;
+
+ // Finally set the link between firemode and weaponmode
+ wSet->setWeaponmodeLink(wPack, weaponmode);
+ }
+
+ void WeaponSystem::fire(unsigned int firemode)
+ {
+ std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.find(firemode);
+ if (it != this->weaponSets_.end() && it->second)
+ it->second->fire();
+ }
+
+ void WeaponSystem::reload()
+ {
+ for (std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)
+ it->second->reload();
+ }
+
+ Munition * WeaponSystem::getMunition(SubclassIdentifier<Munition> * identifier)
+ {
+ if (!identifier || !identifier->getIdentifier())
+ return 0;
+
+ std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier());
+ if (it != this->munitions_.end())
+ {
+ return it->second;
+ }
+ else if (identifier->getIdentifier()->isA(Class(Munition)))
+ {
+ Munition* munition = identifier->fabricate(this);
+ this->munitions_[identifier->getIdentifier()] = munition;
+ return munition;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/WeaponSystem.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,101 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef _WeaponSystem_H__
-#define _WeaponSystem_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <set>
-#include <map>
-#include <vector>
-
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
- class _OrxonoxExport WeaponSystem : public BaseObject
- {
- public:
- WeaponSystem(BaseObject* creator);
- virtual ~WeaponSystem();
-
- // adding and removing WeaponSlots
- void addWeaponSlot(WeaponSlot * wSlot);
- void removeWeaponSlot(WeaponSlot * wSlot);
- WeaponSlot * getWeaponSlot(unsigned int index) const;
-
- // adding and removing WeaponSets
- bool addWeaponSet(WeaponSet * wSet);
- bool addWeaponSet(WeaponSet * wSet, unsigned int firemode);
- void removeWeaponSet(WeaponSet * wSet);
- WeaponSet * getWeaponSet(unsigned int index) const;
-
- // adding and removing WeaponPacks
- bool canAddWeaponPack(WeaponPack * wPack);
- bool addWeaponPack(WeaponPack * wPack);
- void removeWeaponPack(WeaponPack * wPack);
- WeaponPack * getWeaponPack(unsigned int index) const;
-
- // configure slots and firemodes
- bool swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2);
- void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
-
- void fire(unsigned int firemode);
- void reload();
-
- Munition * getMunition(SubclassIdentifier<Munition> * identifier);
-
- inline void setPawn(Pawn * pawn)
- { this->pawn_ = pawn; }
- inline Pawn * getPawn() const
- { return this->pawn_; }
-
- inline int getWeaponSlotSize() const
- { return this->weaponSlots_.size(); }
-
- static inline unsigned int getFiremodeMask(unsigned int firemode)
- { return (0x1 << firemode); }
-
- static const unsigned int MAX_FIRE_MODES = 8;
- static const unsigned int FIRE_MODE_UNASSIGNED = (unsigned int)-1;
-
- static const unsigned int MAX_WEAPON_MODES = 8;
- static const unsigned int WEAPON_MODE_UNASSIGNED = (unsigned int)-1;
-
- private:
- std::map<unsigned int, WeaponSet *> weaponSets_;
- std::vector<WeaponSlot *> weaponSlots_;
- std::set<WeaponPack *> weaponPacks_;
- std::map<Identifier *, Munition *> munitions_;
- Pawn * pawn_;
- };
-}
-
-#endif /* _WeaponSystem_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/WeaponSystem.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,101 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef _WeaponSystem_H__
+#define _WeaponSystem_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <set>
+#include <map>
+#include <vector>
+
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport WeaponSystem : public BaseObject
+ {
+ public:
+ WeaponSystem(BaseObject* creator);
+ virtual ~WeaponSystem();
+
+ // adding and removing WeaponSlots
+ void addWeaponSlot(WeaponSlot * wSlot);
+ void removeWeaponSlot(WeaponSlot * wSlot);
+ WeaponSlot * getWeaponSlot(unsigned int index) const;
+
+ // adding and removing WeaponSets
+ bool addWeaponSet(WeaponSet * wSet);
+ bool addWeaponSet(WeaponSet * wSet, unsigned int firemode);
+ void removeWeaponSet(WeaponSet * wSet);
+ WeaponSet * getWeaponSet(unsigned int index) const;
+
+ // adding and removing WeaponPacks
+ bool canAddWeaponPack(WeaponPack * wPack);
+ bool addWeaponPack(WeaponPack * wPack);
+ void removeWeaponPack(WeaponPack * wPack);
+ WeaponPack * getWeaponPack(unsigned int index) const;
+
+ // configure slots and firemodes
+ bool swapWeaponSlots(WeaponSlot * wSlot1, WeaponSlot * wSlot2);
+ void changeWeaponmode(WeaponPack * wPack, WeaponSet * wSet, unsigned int weaponmode);
+
+ void fire(unsigned int firemode);
+ void reload();
+
+ Munition * getMunition(SubclassIdentifier<Munition> * identifier);
+
+ inline void setPawn(Pawn * pawn)
+ { this->pawn_ = pawn; }
+ inline Pawn * getPawn() const
+ { return this->pawn_; }
+
+ inline int getWeaponSlotSize() const
+ { return this->weaponSlots_.size(); }
+
+ static inline unsigned int getFiremodeMask(unsigned int firemode)
+ { return (0x1 << firemode); }
+
+ static const unsigned int MAX_FIRE_MODES = 8;
+ static const unsigned int FIRE_MODE_UNASSIGNED = (unsigned int)-1;
+
+ static const unsigned int MAX_WEAPON_MODES = 8;
+ static const unsigned int WEAPON_MODE_UNASSIGNED = (unsigned int)-1;
+
+ private:
+ std::map<unsigned int, WeaponSet *> weaponSets_;
+ std::vector<WeaponSlot *> weaponSlots_;
+ std::set<WeaponPack *> weaponPacks_;
+ std::map<Identifier *, Munition *> munitions_;
+ Pawn * pawn_;
+ };
+}
+
+#endif /* _WeaponSystem_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,5 +0,0 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- ReplenishingMunition.cc
- LaserMunition.cc
- FusionMunition.cc
-)
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,5 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ ReplenishingMunition.cc
+ LaserMunition.cc
+ FusionMunition.cc
+)
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,53 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "FusionMunition.h"
-
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- CreateFactory(FusionMunition);
-
- FusionMunition::FusionMunition(BaseObject* creator) : Munition(creator)
- {
- RegisterObject(FusionMunition);
-
- this->maxMunitionPerMagazine_ = 10;
- this->maxMagazines_ = 10;
- this->magazines_ = 10;
-
- this->bUseSeparateMagazines_ = true;
- this->bStackMunition_ = false;
- this->reloadTime_ = 1.0f;
-
- this->bAllowMunitionRefilling_ = true;
- this->bAllowMultiMunitionRemovementUnderflow_ = true;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "FusionMunition.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(FusionMunition);
+
+ FusionMunition::FusionMunition(BaseObject* creator) : Munition(creator)
+ {
+ RegisterObject(FusionMunition);
+
+ this->maxMunitionPerMagazine_ = 10;
+ this->maxMagazines_ = 10;
+ this->magazines_ = 10;
+
+ this->bUseSeparateMagazines_ = true;
+ this->bStackMunition_ = false;
+ this->reloadTime_ = 1.0f;
+
+ this->bAllowMunitionRefilling_ = true;
+ this->bAllowMultiMunitionRemovementUnderflow_ = true;
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,45 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _FusionMunition_H__
-#define _FusionMunition_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/weaponsystem/Munition.h"
-
-namespace orxonox
-{
- class _OrxonoxExport FusionMunition : public Munition
- {
- public:
- FusionMunition(BaseObject* creator);
- virtual ~FusionMunition() {}
- };
-}
-
-#endif /* _FusionMunition_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/FusionMunition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,45 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _FusionMunition_H__
+#define _FusionMunition_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/Munition.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport FusionMunition : public Munition
+ {
+ public:
+ FusionMunition(BaseObject* creator);
+ virtual ~FusionMunition() {}
+ };
+}
+
+#endif /* _FusionMunition_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,55 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "LaserMunition.h"
-
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- CreateFactory(LaserMunition);
-
- LaserMunition::LaserMunition(BaseObject* creator) : ReplenishingMunition(creator)
- {
- RegisterObject(LaserMunition);
-
- this->maxMunitionPerMagazine_ = 20;
- this->maxMagazines_ = 1;
- this->magazines_ = 1;
-
- this->bUseSeparateMagazines_ = false;
- this->bStackMunition_ = true;
-
- this->bAllowMunitionRefilling_ = true;
- this->bAllowMultiMunitionRemovementUnderflow_ = true;
-
- this->replenishIntervall_ = 0.5f;
- this->replenishMunitionAmount_ = 1;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "LaserMunition.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(LaserMunition);
+
+ LaserMunition::LaserMunition(BaseObject* creator) : ReplenishingMunition(creator)
+ {
+ RegisterObject(LaserMunition);
+
+ this->maxMunitionPerMagazine_ = 20;
+ this->maxMagazines_ = 1;
+ this->magazines_ = 1;
+
+ this->bUseSeparateMagazines_ = false;
+ this->bStackMunition_ = true;
+
+ this->bAllowMunitionRefilling_ = true;
+ this->bAllowMultiMunitionRemovementUnderflow_ = true;
+
+ this->replenishIntervall_ = 0.5f;
+ this->replenishMunitionAmount_ = 1;
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,45 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _LaserMunition_H__
-#define _LaserMunition_H__
-
-#include "OrxonoxPrereqs.h"
-#include "ReplenishingMunition.h"
-
-namespace orxonox
-{
- class _OrxonoxExport LaserMunition : public ReplenishingMunition
- {
- public:
- LaserMunition(BaseObject* creator);
- virtual ~LaserMunition() {}
- };
-}
-
-#endif /* _LaserMunition_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,45 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _LaserMunition_H__
+#define _LaserMunition_H__
+
+#include "OrxonoxPrereqs.h"
+#include "ReplenishingMunition.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport LaserMunition : public ReplenishingMunition
+ {
+ public:
+ LaserMunition(BaseObject* creator);
+ virtual ~LaserMunition() {}
+ };
+}
+
+#endif /* _LaserMunition_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/munitions/LaserMunition.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,70 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "ReplenishingMunition.h"
-
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- CreateFactory(ReplenishingMunition);
-
- ReplenishingMunition::ReplenishingMunition(BaseObject* creator) : Munition(creator)
- {
- RegisterObject(ReplenishingMunition);
-
- this->replenishIntervall_ = 1.0f;
- this->replenishMunitionAmount_ = 1;
-
- // Use the timer to initialize itself after the first tick (because the real values for
- // replenishIntervall_ and replenishMunitionAmount_ will be set in the constructor of the
- // inheriting class, which comes after this constructor)
- this->replenishingTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&ReplenishingMunition::initializeTimer)));
- }
-
- void ReplenishingMunition::initializeTimer()
- {
- // Initialize the timer
- this->replenishingTimer_.setTimer(this->replenishIntervall_, true, this, createExecutor(createFunctor(&ReplenishingMunition::replenish)));
- }
-
- void ReplenishingMunition::replenish()
- {
- // Make a temporary copy of bAllowMunitionRefilling_, because this might be disallowed in every
- // case except the internal munition replenishing
- bool temp = this->bAllowMunitionRefilling_;
- this->bAllowMunitionRefilling_ = true;
-
- // Replenish munition
- this->addMunition(this->replenishMunitionAmount_);
-
- // Write back the temporary value
- this->bAllowMunitionRefilling_ = temp;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,70 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "ReplenishingMunition.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(ReplenishingMunition);
+
+ ReplenishingMunition::ReplenishingMunition(BaseObject* creator) : Munition(creator)
+ {
+ RegisterObject(ReplenishingMunition);
+
+ this->replenishIntervall_ = 1.0f;
+ this->replenishMunitionAmount_ = 1;
+
+ // Use the timer to initialize itself after the first tick (because the real values for
+ // replenishIntervall_ and replenishMunitionAmount_ will be set in the constructor of the
+ // inheriting class, which comes after this constructor)
+ this->replenishingTimer_.setTimer(0.0f, false, this, createExecutor(createFunctor(&ReplenishingMunition::initializeTimer)));
+ }
+
+ void ReplenishingMunition::initializeTimer()
+ {
+ // Initialize the timer
+ this->replenishingTimer_.setTimer(this->replenishIntervall_, true, this, createExecutor(createFunctor(&ReplenishingMunition::replenish)));
+ }
+
+ void ReplenishingMunition::replenish()
+ {
+ // Make a temporary copy of bAllowMunitionRefilling_, because this might be disallowed in every
+ // case except the internal munition replenishing
+ bool temp = this->bAllowMunitionRefilling_;
+ this->bAllowMunitionRefilling_ = true;
+
+ // Replenish munition
+ this->addMunition(this->replenishMunitionAmount_);
+
+ // Write back the temporary value
+ this->bAllowMunitionRefilling_ = temp;
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,56 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ReplenishingMunition_H__
-#define _ReplenishingMunition_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/weaponsystem/Munition.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ReplenishingMunition : public Munition
- {
- public:
- ReplenishingMunition(BaseObject* creator);
- virtual ~ReplenishingMunition() {}
-
- protected:
- float replenishIntervall_;
- unsigned int replenishMunitionAmount_;
-
- private:
- void replenish();
- void initializeTimer();
-
- Timer<ReplenishingMunition> replenishingTimer_;
- };
-}
-
-#endif /* _ReplenishingMunition_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/munitions/ReplenishingMunition.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ReplenishingMunition_H__
+#define _ReplenishingMunition_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/Munition.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ReplenishingMunition : public Munition
+ {
+ public:
+ ReplenishingMunition(BaseObject* creator);
+ virtual ~ReplenishingMunition() {}
+
+ protected:
+ float replenishIntervall_;
+ unsigned int replenishMunitionAmount_;
+
+ private:
+ void replenish();
+ void initializeTimer();
+
+ Timer<ReplenishingMunition> replenishingTimer_;
+ };
+}
+
+#endif /* _ReplenishingMunition_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,78 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "BillboardProjectile.h"
-
-#include <OgreBillboardSet.h>
-
-#include "core/GameMode.h"
-#include "core/CoreIncludes.h"
-#include "objects/Scene.h"
-
-namespace orxonox
-{
- CreateFactory(BillboardProjectile);
-
- BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator)
- {
- RegisterObject(BillboardProjectile);
-
- if (GameMode::showsGraphics())
- {
- assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
- this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1);
- this->attachOgreObject(this->billboard_.getBillboardSet());
- }
-
- this->setScale(0.2);
- }
-
- BillboardProjectile::~BillboardProjectile()
- {
- if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet())
- this->detachOgreObject(this->billboard_.getBillboardSet());
- }
-
- void BillboardProjectile::setColour(const ColourValue& colour)
- {
- this->billboard_.setColour(colour);
- }
-
- void BillboardProjectile::setMaterial(const std::string& material)
- {
- this->billboard_.setMaterial(material);
- }
-
- void BillboardProjectile::changedVisibility()
- {
- SUPER(BillboardProjectile, changedVisibility);
-
- this->billboard_.setVisible(this->isVisible());
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "BillboardProjectile.h"
+
+#include <OgreBillboardSet.h>
+
+#include "core/GameMode.h"
+#include "core/CoreIncludes.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(BillboardProjectile);
+
+ BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator)
+ {
+ RegisterObject(BillboardProjectile);
+
+ if (GameMode::showsGraphics())
+ {
+ assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
+ this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5, 0.5, 0.7, 0.8), 1);
+ this->attachOgreObject(this->billboard_.getBillboardSet());
+ }
+
+ this->setScale(0.2);
+ }
+
+ BillboardProjectile::~BillboardProjectile()
+ {
+ if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet())
+ this->detachOgreObject(this->billboard_.getBillboardSet());
+ }
+
+ void BillboardProjectile::setColour(const ColourValue& colour)
+ {
+ this->billboard_.setColour(colour);
+ }
+
+ void BillboardProjectile::setMaterial(const std::string& material)
+ {
+ this->billboard_.setMaterial(material);
+ }
+
+ void BillboardProjectile::changedVisibility()
+ {
+ SUPER(BillboardProjectile, changedVisibility);
+
+ this->billboard_.setVisible(this->isVisible());
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,55 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _BillboardProjectile_H__
-#define _BillboardProjectile_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "Projectile.h"
-#include "tools/BillboardSet.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
- class _OrxonoxExport BillboardProjectile : public Projectile
- {
- public:
- BillboardProjectile(BaseObject* creator);
- virtual ~BillboardProjectile();
-
- virtual void setColour(const ColourValue& colour);
- virtual void setMaterial(const std::string& material);
- virtual void changedVisibility();
-
- private:
- BillboardSet billboard_;
- };
-}
-
-#endif /* _BillboardProjectile_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/BillboardProjectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _BillboardProjectile_H__
+#define _BillboardProjectile_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Projectile.h"
+#include "tools/BillboardSet.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport BillboardProjectile : public Projectile
+ {
+ public:
+ BillboardProjectile(BaseObject* creator);
+ virtual ~BillboardProjectile();
+
+ virtual void setColour(const ColourValue& colour);
+ virtual void setMaterial(const std::string& material);
+ virtual void changedVisibility();
+
+ private:
+ BillboardSet billboard_;
+ };
+}
+
+#endif /* _BillboardProjectile_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,6 +0,0 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- BillboardProjectile.cc
- ParticleProjectile.cc
- Projectile.cc
- LightningGunProjectile.cc
-)
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,6 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ BillboardProjectile.cc
+ ParticleProjectile.cc
+ Projectile.cc
+ LightningGunProjectile.cc
+)
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,67 +0,0 @@
-/*
- * 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_);
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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_);
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,57 +0,0 @@
-/*
- * 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__ */
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,76 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "ParticleProjectile.h"
-
-#include <OgreParticleSystem.h>
-#include <OgreParticleEmitter.h>
-
-#include "core/GameMode.h"
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "objects/Scene.h"
-
-namespace orxonox
-{
- CreateFactory(ParticleProjectile);
-
- ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator)
- {
- RegisterObject(ParticleProjectile);
-
- if (GameMode::showsGraphics())
- {
- this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
- this->attachOgreObject(this->particles_->getParticleSystem());
- this->particles_->setKeepParticlesInLocalSpace(0);
-
- this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT);
- }
- else
- this->particles_ = 0;
- }
-
- ParticleProjectile::~ParticleProjectile()
- {
- if (this->isInitialized() && this->particles_)
- {
- this->detachOgreObject(this->particles_->getParticleSystem());
- delete this->particles_;
- }
- }
-
- void ParticleProjectile::changedVisibility()
- {
- SUPER(ParticleProjectile, changedVisibility);
-
- if (this->particles_)
- this->particles_->setEnabled(this->isVisible());
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "ParticleProjectile.h"
+
+#include <OgreParticleSystem.h>
+#include <OgreParticleEmitter.h>
+
+#include "core/GameMode.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "objects/Scene.h"
+
+namespace orxonox
+{
+ CreateFactory(ParticleProjectile);
+
+ ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator)
+ {
+ RegisterObject(ParticleProjectile);
+
+ if (GameMode::showsGraphics())
+ {
+ this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
+ this->attachOgreObject(this->particles_->getParticleSystem());
+ this->particles_->setKeepParticlesInLocalSpace(0);
+
+ this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT);
+ }
+ else
+ this->particles_ = 0;
+ }
+
+ ParticleProjectile::~ParticleProjectile()
+ {
+ if (this->isInitialized() && this->particles_)
+ {
+ this->detachOgreObject(this->particles_->getParticleSystem());
+ delete this->particles_;
+ }
+ }
+
+ void ParticleProjectile::changedVisibility()
+ {
+ SUPER(ParticleProjectile, changedVisibility);
+
+ if (this->particles_)
+ this->particles_->setEnabled(this->isVisible());
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,52 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ParticleProjectile_H__
-#define _ParticleProjectile_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "BillboardProjectile.h"
-#include "tools/ParticleInterface.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ParticleProjectile : public BillboardProjectile
- {
- public:
- ParticleProjectile(BaseObject* creator);
- virtual ~ParticleProjectile();
- virtual void changedVisibility();
-
- private:
- ParticleInterface* particles_;
- };
-}
-
-#endif /* _ParticleProjectile_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,52 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ParticleProjectile_H__
+#define _ParticleProjectile_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "BillboardProjectile.h"
+#include "tools/ParticleInterface.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ParticleProjectile : public BillboardProjectile
+ {
+ public:
+ ParticleProjectile(BaseObject* creator);
+ virtual ~ParticleProjectile();
+ virtual void changedVisibility();
+
+ private:
+ ParticleInterface* particles_;
+ };
+}
+
+#endif /* _ParticleProjectile_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,140 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "Projectile.h"
-
-#include <OgreBillboard.h>
-
-#include "core/CoreIncludes.h"
-#include "core/Executor.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/Iterator.h"
-#include "tools/ParticleInterface.h"
-
-#include "objects/worldentities/Model.h"
-#include "objects/worldentities/ParticleSpawner.h"
-#include "objects/collisionshapes/SphereCollisionShape.h"
-#include "core/GameMode.h"
-
-namespace orxonox
-{
- Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
- {
- RegisterObject(Projectile);
-
- this->setConfigValues();
- this->bDestroy_ = false;
- this->owner_ = 0;
-
- // Get notification about collisions
-
- if (GameMode::isMaster())
- {
- this->enableCollisionCallback();
-
- this->setCollisionType(Kinematic);
-
- SphereCollisionShape* shape = new SphereCollisionShape(this);
- shape->setRadius(10);
- this->attachCollisionShape(shape);
-
- this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
- }
- }
-
- Projectile::~Projectile()
- {
- }
-
- void Projectile::setConfigValues()
- {
- SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
- SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
- }
-
-
- void Projectile::tick(float dt)
- {
- SUPER(Projectile, tick, dt);
-
- if (!this->isActive())
- return;
-
- if (this->bDestroy_)
- delete this;
- }
-
- void Projectile::destroyObject()
- {
- if (GameMode::isMaster())
- delete this;
- }
-
- bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
- {
- if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return true;
-
- 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/explosion3");
- 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 = dynamic_cast<Pawn*>(otherObject);
- if (victim)
- victim->damage(this->damage_, this->owner_);
- }
- return false;
- }
-
- void Projectile::destroyedPawn(Pawn* pawn)
- {
- if (this->owner_ == pawn)
- this->owner_ = 0;
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,140 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Projectile.h"
+
+#include <OgreBillboard.h>
+
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/Iterator.h"
+#include "tools/ParticleInterface.h"
+
+#include "objects/worldentities/Model.h"
+#include "objects/worldentities/ParticleSpawner.h"
+#include "objects/collisionshapes/SphereCollisionShape.h"
+#include "core/GameMode.h"
+
+namespace orxonox
+{
+ Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
+ {
+ RegisterObject(Projectile);
+
+ this->setConfigValues();
+ this->bDestroy_ = false;
+ this->owner_ = 0;
+
+ // Get notification about collisions
+
+ if (GameMode::isMaster())
+ {
+ this->enableCollisionCallback();
+
+ this->setCollisionType(Kinematic);
+
+ SphereCollisionShape* shape = new SphereCollisionShape(this);
+ shape->setRadius(10);
+ this->attachCollisionShape(shape);
+
+ this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
+ }
+ }
+
+ Projectile::~Projectile()
+ {
+ }
+
+ void Projectile::setConfigValues()
+ {
+ SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");
+ SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive");
+ }
+
+
+ void Projectile::tick(float dt)
+ {
+ SUPER(Projectile, tick, dt);
+
+ if (!this->isActive())
+ return;
+
+ if (this->bDestroy_)
+ delete this;
+ }
+
+ void Projectile::destroyObject()
+ {
+ if (GameMode::isMaster())
+ delete this;
+ }
+
+ bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ {
+ if (!this->bDestroy_ && GameMode::isMaster())
+ {
+ if (otherObject == this->owner_)
+ return true;
+
+ 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/explosion3");
+ 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 = dynamic_cast<Pawn*>(otherObject);
+ if (victim)
+ victim->damage(this->damage_, this->owner_);
+ }
+ return false;
+ }
+
+ void Projectile::destroyedPawn(Pawn* pawn)
+ {
+ if (this->owner_ == pawn)
+ this->owner_ = 0;
+ }
+}
Deleted: trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/projectiles/Projectile.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,72 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Projectile_H__
-#define _Projectile_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "objects/worldentities/MovableEntity.h"
-#include "objects/worldentities/pawns/Pawn.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Projectile : public MovableEntity, public PawnListener
- {
- public:
- Projectile(BaseObject* creator);
- virtual ~Projectile();
-
- void setConfigValues();
- void destroyObject();
-
- virtual void tick(float dt);
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- virtual void destroyedPawn(Pawn* pawn);
-
- inline void setDamage(float damage)
- { this->damage_ = damage; }
- inline float getDamage() const
- { return this->damage_; }
-
- inline void setOwner(Pawn* owner)
- { this->owner_ = owner; }
- inline Pawn* getOwner() const
- { return this->owner_; }
-
- private:
- Pawn* owner_;
- float lifetime_;
- float damage_;
- bool bDestroy_;
- Timer<Projectile> destroyTimer_;
- };
-}
-
-#endif /* _Projectile_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/projectiles/Projectile.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/projectiles/Projectile.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,72 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Projectile_H__
+#define _Projectile_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "objects/worldentities/MovableEntity.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport Projectile : public MovableEntity, public PawnListener
+ {
+ public:
+ Projectile(BaseObject* creator);
+ virtual ~Projectile();
+
+ void setConfigValues();
+ void destroyObject();
+
+ virtual void tick(float dt);
+ virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual void destroyedPawn(Pawn* pawn);
+
+ inline void setDamage(float damage)
+ { this->damage_ = damage; }
+ inline float getDamage() const
+ { return this->damage_; }
+
+ inline void setOwner(Pawn* owner)
+ { this->owner_ = owner; }
+ inline Pawn* getOwner() const
+ { return this->owner_; }
+
+ private:
+ Pawn* owner_;
+ float lifetime_;
+ float damage_;
+ bool bDestroy_;
+ Timer<Projectile> destroyTimer_;
+ };
+}
+
+#endif /* _Projectile_H__ */
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,7 +0,0 @@
-ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- EnergyDrink.cc
- FusionFire.cc
- LaserFire.cc
- HsW01.cc
- LightningGun.cc
-)
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/CMakeLists.txt 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,7 @@
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
+ EnergyDrink.cc
+ FusionFire.cc
+ LaserFire.cc
+ HsW01.cc
+ LightningGun.cc
+)
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,121 +0,0 @@
-/*
- * 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:
- * Hagen Seifert
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "EnergyDrink.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
-#include "objects/worldentities/Model.h"
-#include "objects/weaponsystem/MuzzleFlash.h"
-
-#include "objects/weaponsystem/Weapon.h"
-#include "objects/weaponsystem/WeaponPack.h"
-#include "objects/weaponsystem/WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(EnergyDrink);
-
- EnergyDrink::EnergyDrink(BaseObject* creator) : WeaponMode(creator)
- {
- RegisterObject(EnergyDrink);
-
- this->reloadTime_ = 0.25;
- this->damage_ = 15;
- this->speed_ = 2500;
- this->delay_ = 0;
- this->setMunitionName("EnergyDrink");
-
- this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot)));
- this->delayTimer_.stopTimer();
- }
-
- void EnergyDrink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(EnergyDrink, XMLPort, xmlelement, mode);
-
- XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode);
- XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode);
-
- }
-
- void EnergyDrink::setMaterial(const std::string& material)
- {
- this->material_ = material;
- }
-
- std::string& EnergyDrink::getMaterial()
- {
- return this->material_;
- }
-
- void EnergyDrink::setDelay(float d)
- {
- this->delay_ = d;
- this->delayTimer_.setInterval(this->delay_);
- }
-
- float EnergyDrink::getDelay() const
- {
- return this->delay_;
- }
-
- void EnergyDrink::fire()
- {
- this->delayTimer_.startTimer();
- }
-
- void EnergyDrink::muendungsfeuer()
- {
- MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
- this->getWeapon()->attach(muzzleFlash);
- muzzleFlash->setPosition(this->getMuzzleOffset());
- muzzleFlash->setMaterial(this->material_);
- }
-
- void EnergyDrink::shot()
- {
- Projectile* projectile = new Projectile(this);
- Model* model = new Model(projectile);
- model->setMeshSource("can.mesh");
- model->setCastShadows(false);
- projectile->attach(model);
- model->setScale(5);
-
- projectile->setOrientation(this->getMuzzleOrientation());
- projectile->setPosition(this->getMuzzlePosition());
- projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
-
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
- projectile->setDamage(this->getDamage());
-
- EnergyDrink::muendungsfeuer();
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "EnergyDrink.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
+#include "objects/worldentities/Model.h"
+#include "objects/weaponsystem/MuzzleFlash.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(EnergyDrink);
+
+ EnergyDrink::EnergyDrink(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(EnergyDrink);
+
+ this->reloadTime_ = 0.25;
+ this->damage_ = 15;
+ this->speed_ = 2500;
+ this->delay_ = 0;
+ this->setMunitionName("FusionMunition");
+
+ this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot)));
+ this->delayTimer_.stopTimer();
+ }
+
+ void EnergyDrink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(EnergyDrink, XMLPort, xmlelement, mode);
+
+ XMLPortParam(EnergyDrink, "delay", setDelay, getDelay, xmlelement, mode);
+ XMLPortParam(EnergyDrink, "material", setMaterial, getMaterial, xmlelement, mode);
+
+ }
+
+ void EnergyDrink::setMaterial(const std::string& material)
+ {
+ this->material_ = material;
+ }
+
+ std::string& EnergyDrink::getMaterial()
+ {
+ return this->material_;
+ }
+
+ void EnergyDrink::setDelay(float d)
+ {
+ this->delay_ = d;
+ this->delayTimer_.setInterval(this->delay_);
+ }
+
+ float EnergyDrink::getDelay() const
+ {
+ return this->delay_;
+ }
+
+ void EnergyDrink::fire()
+ {
+ this->delayTimer_.startTimer();
+ }
+
+ void EnergyDrink::muendungsfeuer()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
+
+ void EnergyDrink::shot()
+ {
+ Projectile* projectile = new Projectile(this);
+ Model* model = new Model(projectile);
+ model->setMeshSource("can.mesh");
+ model->setCastShadows(false);
+ projectile->attach(model);
+ model->setScale(5);
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+
+ EnergyDrink::muendungsfeuer();
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,62 +0,0 @@
-/*
- * 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:
- * Hagen Seifert
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _EnergyDrink_H__
-#define _EnergyDrink_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/weaponsystem/WeaponMode.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
- class _OrxonoxExport EnergyDrink : public WeaponMode
- {
- public:
- EnergyDrink(BaseObject* creator);
- virtual ~EnergyDrink() {}
-
- virtual void fire();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- private:
- void setMaterial(const std::string& material);
- std::string& getMaterial();
- void setDelay(float d);
- float getDelay() const;
- void shot();
- void muendungsfeuer();
-
- std::string material_;
- float speed_;
- float delay_;
- Timer<EnergyDrink> delayTimer_;
- };
-}
-
-#endif /* _EnergyDrink_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _EnergyDrink_H__
+#define _EnergyDrink_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport EnergyDrink : public WeaponMode
+ {
+ public:
+ EnergyDrink(BaseObject* creator);
+ virtual ~EnergyDrink() {}
+
+ virtual void fire();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ private:
+ void setMaterial(const std::string& material);
+ std::string& getMaterial();
+ void setDelay(float d);
+ float getDelay() const;
+ void shot();
+ void muendungsfeuer();
+
+ std::string material_;
+ float speed_;
+ float delay_;
+ Timer<EnergyDrink> delayTimer_;
+ };
+}
+
+#endif /* _EnergyDrink_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,68 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "FusionFire.h"
-
-#include "core/CoreIncludes.h"
-#include "objects/weaponsystem/projectiles/BillboardProjectile.h"
-
-#include "objects/weaponsystem/Weapon.h"
-#include "objects/weaponsystem/WeaponPack.h"
-#include "objects/weaponsystem/WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(FusionFire);
-
- FusionFire::FusionFire(BaseObject* creator) : WeaponMode(creator)
- {
- RegisterObject(FusionFire);
-
- this->reloadTime_ = 1.0;
- this->bParallelReload_ = false;
- this->damage_ = 40;
- this->speed_ = 1250;
-
- this->setMunitionName("FusionMunition");
- }
-
- void FusionFire::fire()
- {
- BillboardProjectile* projectile = new BillboardProjectile(this);
-
- 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());
- projectile->setColour(ColourValue(1.0f, 0.7f, 0.3f, 1.0f));
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "FusionFire.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/weaponsystem/projectiles/BillboardProjectile.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(FusionFire);
+
+ FusionFire::FusionFire(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(FusionFire);
+
+ this->reloadTime_ = 1.0;
+ this->bParallelReload_ = false;
+ this->damage_ = 40;
+ this->speed_ = 1250;
+
+ this->setMunitionName("FusionMunition");
+ }
+
+ void FusionFire::fire()
+ {
+ BillboardProjectile* projectile = new BillboardProjectile(this);
+
+ 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());
+ projectile->setColour(ColourValue(1.0f, 0.7f, 0.3f, 1.0f));
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,50 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _FusionFire_H__
-#define _FusionFire_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/weaponsystem/WeaponMode.h"
-
-namespace orxonox
-{
- class _OrxonoxExport FusionFire : public WeaponMode
- {
- public:
- FusionFire(BaseObject* creator);
- virtual ~FusionFire() {}
-
- virtual void fire();
-
- private:
- float speed_;
- };
-}
-
-#endif /* _FusionFire_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,50 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _FusionFire_H__
+#define _FusionFire_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport FusionFire : public WeaponMode
+ {
+ public:
+ FusionFire(BaseObject* creator);
+ virtual ~FusionFire() {}
+
+ virtual void fire();
+
+ private:
+ float speed_;
+ };
+}
+
+#endif /* _FusionFire_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,121 +0,0 @@
-/*
- * 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:
- * Hagen Seifert
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "HsW01.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
-#include "objects/worldentities/Model.h"
-#include "objects/weaponsystem/MuzzleFlash.h"
-
-#include "objects/weaponsystem/Weapon.h"
-#include "objects/weaponsystem/WeaponPack.h"
-#include "objects/weaponsystem/WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(HsW01);
-
- HsW01::HsW01(BaseObject* creator) : WeaponMode(creator)
- {
- RegisterObject(HsW01);
-
- this->reloadTime_ = 0.25;
- this->damage_ = 15;
- this->speed_ = 2500;
- this->delay_ = 0;
- this->setMunitionName("HsW01");
-
- this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&HsW01::shot)));
- this->delayTimer_.stopTimer();
- }
-
- void HsW01::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(HsW01, XMLPort, xmlelement, mode);
-
- XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode);
- XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode);
-
- }
-
- void HsW01::setMaterial(const std::string& material)
- {
- this->material_ = material;
- }
-
- std::string& HsW01::getMaterial()
- {
- return this->material_;
- }
-
- void HsW01::setDelay(float d)
- {
- this->delay_ = d;
- this->delayTimer_.setInterval(this->delay_);
- }
-
- float HsW01::getDelay() const
- {
- return this->delay_;
- }
-
- void HsW01::fire()
- {
- this->delayTimer_.startTimer();
- }
-
- void HsW01::muendungsfeuer()
- {
- MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
- this->getWeapon()->attach(muzzleFlash);
- muzzleFlash->setPosition(this->getMuzzleOffset());
- muzzleFlash->setMaterial(this->material_);
- }
-
- void HsW01::shot()
- {
- Projectile* projectile = new Projectile(this);
- Model* model = new Model(projectile);
- model->setMeshSource("laserbeam.mesh");
- model->setCastShadows(false);
- projectile->attach(model);
- model->setScale(5);
-
- projectile->setOrientation(this->getMuzzleOrientation());
- projectile->setPosition(this->getMuzzlePosition());
- projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
-
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
- projectile->setDamage(this->getDamage());
-
- HsW01::muendungsfeuer();
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "HsW01.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
+#include "objects/worldentities/Model.h"
+#include "objects/weaponsystem/MuzzleFlash.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(HsW01);
+
+ HsW01::HsW01(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(HsW01);
+
+ this->reloadTime_ = 0.25;
+ this->damage_ = 15;
+ this->speed_ = 2500;
+ this->delay_ = 0;
+ this->setMunitionName("LaserMunition");
+
+ this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&HsW01::shot)));
+ this->delayTimer_.stopTimer();
+ }
+
+ void HsW01::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(HsW01, XMLPort, xmlelement, mode);
+
+ XMLPortParam(HsW01, "delay", setDelay, getDelay, xmlelement, mode);
+ XMLPortParam(HsW01, "material", setMaterial, getMaterial, xmlelement, mode);
+
+ }
+
+ void HsW01::setMaterial(const std::string& material)
+ {
+ this->material_ = material;
+ }
+
+ std::string& HsW01::getMaterial()
+ {
+ return this->material_;
+ }
+
+ void HsW01::setDelay(float d)
+ {
+ this->delay_ = d;
+ this->delayTimer_.setInterval(this->delay_);
+ }
+
+ float HsW01::getDelay() const
+ {
+ return this->delay_;
+ }
+
+ void HsW01::fire()
+ {
+ this->delayTimer_.startTimer();
+ }
+
+ void HsW01::muendungsfeuer()
+ {
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ this->getWeapon()->attach(muzzleFlash);
+ muzzleFlash->setPosition(this->getMuzzleOffset());
+ muzzleFlash->setMaterial(this->material_);
+ }
+
+ void HsW01::shot()
+ {
+ Projectile* projectile = new Projectile(this);
+ Model* model = new Model(projectile);
+ model->setMeshSource("laserbeam.mesh");
+ model->setCastShadows(false);
+ projectile->attach(model);
+ model->setScale(5);
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+
+ HsW01::muendungsfeuer();
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,62 +0,0 @@
-/*
- * 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:
- * Hagen Seifert
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _HsW01_H__
-#define _HsW01_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/weaponsystem/WeaponMode.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
- class _OrxonoxExport HsW01 : public WeaponMode
- {
- public:
- HsW01(BaseObject* creator);
- virtual ~HsW01() {}
-
- virtual void fire();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- private:
- void setMaterial(const std::string& material);
- std::string& getMaterial();
- void setDelay(float d);
- float getDelay() const;
- void shot();
- void muendungsfeuer();
-
- std::string material_;
- float speed_;
- float delay_;
- Timer<HsW01> delayTimer_;
- };
-}
-
-#endif /* _HsW01_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Hagen Seifert
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _HsW01_H__
+#define _HsW01_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport HsW01 : public WeaponMode
+ {
+ public:
+ HsW01(BaseObject* creator);
+ virtual ~HsW01() {}
+
+ virtual void fire();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ private:
+ void setMaterial(const std::string& material);
+ std::string& getMaterial();
+ void setDelay(float d);
+ float getDelay() const;
+ void shot();
+ void muendungsfeuer();
+
+ std::string material_;
+ float speed_;
+ float delay_;
+ Timer<HsW01> delayTimer_;
+ };
+}
+
+#endif /* _HsW01_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,65 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "LaserFire.h"
-
-#include "core/CoreIncludes.h"
-#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
-
-#include "objects/weaponsystem/Weapon.h"
-#include "objects/weaponsystem/WeaponPack.h"
-#include "objects/weaponsystem/WeaponSystem.h"
-
-namespace orxonox
-{
- CreateFactory(LaserFire);
-
- LaserFire::LaserFire(BaseObject* creator) : WeaponMode(creator)
- {
- RegisterObject(LaserFire);
-
- this->reloadTime_ = 0.25;
- this->damage_ = 15;
- this->speed_ = 1250;
-
- this->setMunitionName("LaserMunition");
- }
-
- void LaserFire::fire()
- {
- ParticleProjectile* projectile = new ParticleProjectile(this);
-
- projectile->setOrientation(this->getMuzzleOrientation());
- projectile->setPosition(this->getMuzzlePosition());
- projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
-
- projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
- projectile->setDamage(this->getDamage());
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "LaserFire.h"
+
+#include "core/CoreIncludes.h"
+#include "objects/weaponsystem/projectiles/ParticleProjectile.h"
+
+#include "objects/weaponsystem/Weapon.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+
+namespace orxonox
+{
+ CreateFactory(LaserFire);
+
+ LaserFire::LaserFire(BaseObject* creator) : WeaponMode(creator)
+ {
+ RegisterObject(LaserFire);
+
+ this->reloadTime_ = 0.25;
+ this->damage_ = 15;
+ this->speed_ = 1250;
+
+ this->setMunitionName("LaserMunition");
+ }
+
+ void LaserFire::fire()
+ {
+ ParticleProjectile* projectile = new ParticleProjectile(this);
+
+ projectile->setOrientation(this->getMuzzleOrientation());
+ projectile->setPosition(this->getMuzzlePosition());
+ projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
+
+ projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+ projectile->setDamage(this->getDamage());
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,50 +0,0 @@
-/*
- * 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:
- * Martin Polak
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _LaserFire_H__
-#define _LaserFire_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/weaponsystem/WeaponMode.h"
-
-namespace orxonox
-{
- class _OrxonoxExport LaserFire : public WeaponMode
- {
- public:
- LaserFire(BaseObject* creator);
- virtual ~LaserFire() {}
-
- virtual void fire();
-
- private:
- float speed_;
- };
-}
-
-#endif /* _LaserFire_H__ */
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -0,0 +1,50 @@
+/*
+ * 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:
+ * Martin Polak
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _LaserFire_H__
+#define _LaserFire_H__
+
+#include "OrxonoxPrereqs.h"
+#include "objects/weaponsystem/WeaponMode.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport LaserFire : public WeaponMode
+ {
+ public:
+ LaserFire(BaseObject* creator);
+ virtual ~LaserFire() {}
+
+ virtual void fire();
+
+ private:
+ float speed_;
+ };
+}
+
+#endif /* _LaserFire_H__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,76 +0,0 @@
-/*
- * 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());
- }
-}
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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());
+ }
+}
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Deleted: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
===================================================================
--- branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -1,49 +0,0 @@
-/*
- * 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__ */
Copied: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h (from rev 3052, branches/weapons/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h)
===================================================================
--- trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h (rev 0)
+++ trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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__ */
Property changes on: trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/Billboard.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/Billboard.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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: trunk/src/orxonox/objects/worldentities/Billboard.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/Billboard.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/Billboard.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -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_;
};
}
Modified: trunk/src/orxonox/objects/worldentities/ControllableEntity.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/ControllableEntity.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/ControllableEntity.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -30,9 +30,7 @@
#define _ControllableEntity_H__
#include "OrxonoxPrereqs.h"
-
#include "MobileEntity.h"
-#include "objects/weaponSystem/WeaponSystem.h"
namespace orxonox
{
@@ -81,8 +79,8 @@
inline void rotateRoll(float value)
{ this->rotateRoll(Vector2(value, 0)); }
- virtual void fire(WeaponMode::Enum fireMode) {}
- virtual void altFire(WeaponMode::Enum fireMode) {}
+ virtual void fire(unsigned int firemode) {}
+ virtual void reload() {}
virtual void boost() {}
virtual void greet() {}
Modified: trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -38,6 +38,10 @@
#include "objects/gametypes/Gametype.h"
#include "objects/worldentities/ParticleSpawner.h"
#include "objects/worldentities/ExplosionChunk.h"
+#include "objects/weaponsystem/WeaponSystem.h"
+#include "objects/weaponsystem/WeaponSlot.h"
+#include "objects/weaponsystem/WeaponPack.h"
+#include "objects/weaponsystem/WeaponSet.h"
namespace orxonox
{
@@ -51,6 +55,7 @@
this->bAlive_ = true;
this->fire_ = 0x0;
this->firehack_ = 0x0;
+ this->bReload_ = false;
this->health_ = 0;
this->maxHealth_ = 0;
@@ -65,7 +70,7 @@
if (GameMode::isMaster())
{
this->weaponSystem_ = new WeaponSystem(this);
- this->weaponSystem_->setParentPawn(this);
+ this->weaponSystem_->setPawn(this);
}
else
this->weaponSystem_ = 0;
@@ -99,9 +104,9 @@
XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
- XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode);
- XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode);
- XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode);
+ XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
+ XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
+ XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
}
void Pawn::registerVariables()
@@ -110,23 +115,26 @@
registerVariable(this->health_, variableDirection::toclient);
registerVariable(this->initialHealth_, variableDirection::toclient);
registerVariable(this->fire_, variableDirection::toserver);
+ registerVariable(this->bReload_, variableDirection::toserver);
}
void Pawn::tick(float dt)
{
SUPER(Pawn, tick, dt);
- if (this->weaponSystem_)
+ if (this->weaponSystem_ && GameMode::isMaster())
{
- if (this->fire_ & WeaponMode::fire)
- this->weaponSystem_->fire(WeaponMode::fire);
- if (this->fire_ & WeaponMode::altFire)
- this->weaponSystem_->fire(WeaponMode::altFire);
- if (this->fire_ & WeaponMode::altFire2)
- this->weaponSystem_->fire(WeaponMode::altFire2);
+ for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
+ if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
+ this->weaponSystem_->fire(firemode);
+
+ if (this->bReload_)
+ this->weaponSystem_->reload();
}
+
this->fire_ = this->firehack_;
this->firehack_ = 0x0;
+ this->bReload_ = false;
if (this->health_ <= 0)
this->death();
@@ -250,11 +258,16 @@
}
}
- void Pawn::fire(WeaponMode::Enum fireMode)
+ void Pawn::fire(unsigned int firemode)
{
- this->firehack_ |= fireMode;
+ this->firehack_ |= WeaponSystem::getFiremodeMask(firemode);
}
+ void Pawn::reload()
+ {
+ this->bReload_ = true;
+ }
+
void Pawn::postSpawn()
{
this->setHealth(this->initialHealth_);
@@ -273,50 +286,45 @@
* with setWeaponPack you can not just load a Pack from XML but if a Pack already exists anywhere, you can attach it.
* --> e.g. Pickup-Items
*/
- void Pawn::setWeaponSlot(WeaponSlot * wSlot)
+ void Pawn::addWeaponSlot(WeaponSlot * wSlot)
{
this->attach(wSlot);
if (this->weaponSystem_)
- this->weaponSystem_->attachWeaponSlot(wSlot);
+ this->weaponSystem_->addWeaponSlot(wSlot);
}
WeaponSlot * Pawn::getWeaponSlot(unsigned int index) const
{
if (this->weaponSystem_)
- return this->weaponSystem_->getWeaponSlotPointer(index);
+ return this->weaponSystem_->getWeaponSlot(index);
else
return 0;
}
- void Pawn::setWeaponPack(WeaponPack * wPack)
+ void Pawn::addWeaponSet(WeaponSet * wSet)
{
if (this->weaponSystem_)
- {
- wPack->setParentWeaponSystem(this->weaponSystem_);
- wPack->setParentWeaponSystemToAllWeapons(this->weaponSystem_);
- this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() );
- wPack->attachNeededMunitionToAllWeapons();
- }
+ this->weaponSystem_->addWeaponSet(wSet);
}
- WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const
+ WeaponSet * Pawn::getWeaponSet(unsigned int index) const
{
if (this->weaponSystem_)
- return this->weaponSystem_->getWeaponPackPointer(firemode);
+ return this->weaponSystem_->getWeaponSet(index);
else
return 0;
}
- void Pawn::setWeaponSet(WeaponSet * wSet)
+ void Pawn::addWeaponPack(WeaponPack * wPack)
{
if (this->weaponSystem_)
- this->weaponSystem_->attachWeaponSet(wSet);
+ this->weaponSystem_->addWeaponPack(wPack);
}
- WeaponSet * Pawn::getWeaponSet(unsigned int index) const
+ WeaponPack * Pawn::getWeaponPack(unsigned int index) const
{
if (this->weaponSystem_)
- return this->weaponSystem_->getWeaponSetPointer(index);
+ return this->weaponSystem_->getWeaponPack(index);
else
return 0;
}
Modified: trunk/src/orxonox/objects/worldentities/pawns/Pawn.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Pawn.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/pawns/Pawn.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -33,12 +33,13 @@
#include "objects/pickup/ShipEquipment.h"
#include "objects/worldentities/ControllableEntity.h"
#include "objects/RadarViewable.h"
-#include "objects/weaponSystem/WeaponSystem.h"
namespace orxonox
{
class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
{
+ friend class WeaponSystem;
+
public:
Pawn(BaseObject* creator);
virtual ~Pawn();
@@ -75,15 +76,16 @@
virtual void hit(Pawn* originator, const Vector3& force, float damage);
virtual void kill();
- virtual void fire(WeaponMode::Enum fireMode);
+ virtual void fire(unsigned int firemode);
+ virtual void reload();
virtual void postSpawn();
- void setWeaponSlot(WeaponSlot * wSlot);
+ void addWeaponSlot(WeaponSlot * wSlot);
WeaponSlot * getWeaponSlot(unsigned int index) const;
- void setWeaponPack(WeaponPack * wPack);
- WeaponPack * getWeaponPack(unsigned int firemode) const;
- void setWeaponSet(WeaponSet * wSet);
+ void addWeaponSet(WeaponSet * wSet);
WeaponSet * getWeaponSet(unsigned int index) const;
+ void addWeaponPack(WeaponPack * wPack);
+ WeaponPack * getWeaponPack(unsigned int index) const;
inline const WorldEntity* getWorldEntity() const
{ return const_cast<Pawn*>(this); }
@@ -129,10 +131,15 @@
WeaponSystem* weaponSystem_;
unsigned int fire_;
unsigned int firehack_;
+ bool bReload_;
std::string spawnparticlesource_;
float spawnparticleduration_;
unsigned int numexplosionchunks_;
+
+ private:
+ inline void setWeaponSystem(WeaponSystem* weaponsystem)
+ { this->weaponSystem_ = weaponsystem; }
};
class _OrxonoxExport PawnListener : virtual public OrxonoxClass
Modified: trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc 2009-05-25 02:19:14 UTC (rev 3053)
@@ -195,7 +195,7 @@
ControllableEntity::rotateRoll(value);
}
- void Spectator::fire(WeaponMode::Enum fireMode)
+ void Spectator::fire(unsigned int firemode)
{
if (this->getPlayer())
this->getPlayer()->setReadyToSpawn(true);
Modified: trunk/src/orxonox/objects/worldentities/pawns/Spectator.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Spectator.h 2009-05-25 01:45:05 UTC (rev 3052)
+++ trunk/src/orxonox/objects/worldentities/pawns/Spectator.h 2009-05-25 02:19:14 UTC (rev 3053)
@@ -53,7 +53,7 @@
virtual void rotatePitch(const Vector2& value);
virtual void rotateRoll(const Vector2& value);
- virtual void fire(WeaponMode::Enum fireMode);
+ virtual void fire(unsigned int firemode);
virtual void greet();
protected:
More information about the Orxonox-commit
mailing list