[Orxonox-commit 1993] r6710 - in code/trunk: . data/levels data/levels/includes data/levels/templates src/modules/pickup src/modules/pickup/items src/orxonox/interfaces
dafrick at orxonox.net
dafrick at orxonox.net
Tue Apr 13 09:50:11 CEST 2010
Author: dafrick
Date: 2010-04-13 09:50:11 +0200 (Tue, 13 Apr 2010)
New Revision: 6710
Added:
code/trunk/data/levels/includes/pickups_invisible.oxi
code/trunk/data/levels/pickup_pps_invi.oxw
code/trunk/data/levels/templates/pickup_representation_templates_invisible.oxt
code/trunk/src/modules/pickup/items/InvisiblePickup.cc
code/trunk/src/modules/pickup/items/InvisiblePickup.h
Modified:
code/trunk/
code/trunk/src/modules/pickup/PickupPrereqs.h
code/trunk/src/modules/pickup/items/CMakeLists.txt
code/trunk/src/orxonox/interfaces/PickupCarrier.h
Log:
Merged ppspickups2 branch into trunk.
Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6440
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/script_trigger:1295-1953,1955
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6440
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/script_trigger:1295-1953,1955
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Copied: code/trunk/data/levels/includes/pickups_invisible.oxi (from rev 6709, code/branches/ppspickups2/data/levels/includes/pickups_invisible.oxi)
===================================================================
--- code/trunk/data/levels/includes/pickups_invisible.oxi (rev 0)
+++ code/trunk/data/levels/includes/pickups_invisible.oxi 2010-04-13 07:50:11 UTC (rev 6710)
@@ -0,0 +1,29 @@
+<PickupRepresentation
+ name = "small Invisibility"
+ description = "Makes you invisible for 5 seconds."
+ spawnerTemplate = "smallinvisiblepickupRepresentation"
+>
+ <pickup>
+ <InvisiblePickup template=smallinvisiblepickup />
+ </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+ name = "medium Invisibility"
+ description = "Makes you invisible for 10 seconds."
+ spawnerTemplate = "mediuminvisiblepickupRepresentation"
+>
+ <pickup>
+ <InvisiblePickup template=mediuminvisiblepickup />
+ </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+ name = "hunge Invisibility"
+ description = "Makes you invisible for 20 seconds."
+ spawnerTemplate = "hugeinvisiblepickupRepresentation"
+>
+ <pickup>
+ <InvisiblePickup template=hugeinvisiblepickup />
+ </pickup>
+</PickupRepresentation>
\ No newline at end of file
Copied: code/trunk/data/levels/pickup_pps_invi.oxw (from rev 6709, code/branches/ppspickups2/data/levels/pickup_pps_invi.oxw)
===================================================================
--- code/trunk/data/levels/pickup_pps_invi.oxw (rev 0)
+++ code/trunk/data/levels/pickup_pps_invi.oxw 2010-04-13 07:50:11 UTC (rev 6710)
@@ -0,0 +1,46 @@
+<?lua
+ include("stats.oxo")
+ include("hudtemplates3.oxo")
+?>
+
+<?lua
+ include("templates/spaceship_assff.oxt")
+ include("templates/spaceship_pirate.oxt")
+ include("templates/pickup_representation_templates_invisible.oxt")
+?>
+
+<Level
+ name = "Sample"
+ description = "Just a few tests"
+>
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+<?lua
+ include("includes/pickups_invisible.oxi")
+?>
+
+ <PickupSpawner position="-75,0,-100" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
+ <pickup>
+ <InvisiblePickup template=smallinvisiblepickup />
+ </pickup>
+ </PickupSpawner>
+
+ <PickupSpawner position="-50,0,-100" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
+ <pickup>
+ <InvisiblePickup template=mediuminvisiblepickup />
+ </pickup>
+ </PickupSpawner>
+
+ <PickupSpawner position="-25,0,-100" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
+ <pickup>
+ <InvisiblePickup template=hugeinvisiblepickup />
+ </pickup>
+ </PickupSpawner>
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+ <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ </Scene>
+</Level>
Copied: code/trunk/data/levels/templates/pickup_representation_templates_invisible.oxt (from rev 6709, code/branches/ppspickups2/data/levels/templates/pickup_representation_templates_invisible.oxt)
===================================================================
--- code/trunk/data/levels/templates/pickup_representation_templates_invisible.oxt (rev 0)
+++ code/trunk/data/levels/templates/pickup_representation_templates_invisible.oxt 2010-04-13 07:50:11 UTC (rev 6710)
@@ -0,0 +1,72 @@
+<Template name=smallinvisiblepickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="0.22,0.32,0.86" material="Sphere2" scale=0.1>
+ <attached>
+ <Billboard position="0,0,0" colour="0.06,0.14,0.63" material="Eye" scale=0.5 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=smallinvisiblepickup>
+ <InvisiblePickup
+ duration = 5.0
+ activaionType = "immediate"
+ durationType = "once"
+ />
+</Template>
+
+<Template name=mediuminvisiblepickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="0.22,0.32,0.86" material="Sphere2" scale=0.1>
+ <attached>
+ <Billboard position="0,0,0" colour="0.06,0.14,0.63" material="Eye" scale=0.7 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=mediuminvisiblepickup>
+ <InvisiblePickup
+ duration = 10.0
+ activaionType = "immediate"
+ durationType = "once"
+ />
+</Template>
+
+<Template name=hugeinvisiblepickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="0.22,0.32,0.86" material="Sphere2" scale=0.1>
+ <attached>
+ <Billboard position="0,0,0" colour="0.06,0.14,0.63" material="Eye" scale=0.9 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=hugeinvisiblepickup>
+ <InvisiblePickup
+ duration = 20.0
+ activaionType = "immediate"
+ durationType = "once"
+ />
+</Template>
+
Modified: code/trunk/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/trunk/src/modules/pickup/PickupPrereqs.h 2010-04-13 07:32:08 UTC (rev 6709)
+++ code/trunk/src/modules/pickup/PickupPrereqs.h 2010-04-13 07:50:11 UTC (rev 6710)
@@ -75,6 +75,7 @@
//items
class HealthPickup;
+ class InvisiblePickup;
class MetaPickup;
class SpeedPickup;
Modified: code/trunk/src/modules/pickup/items/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/pickup/items/CMakeLists.txt 2010-04-13 07:32:08 UTC (rev 6709)
+++ code/trunk/src/modules/pickup/items/CMakeLists.txt 2010-04-13 07:50:11 UTC (rev 6710)
@@ -1,8 +1,6 @@
ADD_SOURCE_FILES(PICKUP_SRC_FILES
-
HealthPickup.cc
-
- SpeedPickup.cc
+ InvisiblePickup.cc
MetaPickup.cc
-
+ SpeedPickup.cc
)
Copied: code/trunk/src/modules/pickup/items/InvisiblePickup.cc (from rev 6709, code/branches/ppspickups2/src/modules/pickup/items/InvisiblePickup.cc)
===================================================================
--- code/trunk/src/modules/pickup/items/InvisiblePickup.cc (rev 0)
+++ code/trunk/src/modules/pickup/items/InvisiblePickup.cc 2010-04-13 07:50:11 UTC (rev 6710)
@@ -0,0 +1,202 @@
+/*
+ * 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:
+ * Benedict Simlinger
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvisiblePickup.cc
+ @brief Implementation of the InvisiblePickup class.
+*/
+
+#include "InvisiblePickup.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/StringUtils.h"
+
+#include "worldentities/pawns/Pawn.h"
+#include "pickup/PickupIdentifier.h"
+
+#include <sstream>
+
+namespace orxonox
+{
+
+ CreateFactory(InvisiblePickup);
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes the member variables.
+ */
+ InvisiblePickup::InvisiblePickup(BaseObject* creator) : Pickup(creator)
+ {
+ RegisterObject(InvisiblePickup);
+ //! Defines who is allowed to pick up the pickup.
+ this->initialize();
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ InvisiblePickup::~InvisiblePickup()
+ {
+ }
+
+
+ void InvisiblePickup::initializeIdentifier(void)
+ {
+ std::stringstream stream;
+ stream << this->getDuration();
+ std::string type1 = "duration";
+ std::string val1 = stream.str();
+ this->pickupIdentifier_->addParameter(type1, val1);
+ }
+
+ /**
+ @brief
+ Initializes the member variables.
+ */
+ void InvisiblePickup::initialize(void)
+ {
+ this->duration_ = 0.0f;
+ this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
+ }
+
+ /**
+ @brief
+ Method for creating a HealthPickup object through XML.
+ */
+ void InvisiblePickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
+ {
+ SUPER(InvisiblePickup, XMLPort, xmlelement, mode);
+ XMLPortParam(InvisiblePickup, "duration", setDuration, getDuration, xmlelement, mode);
+
+ this->initializeIdentifier();
+ }
+
+ /**
+ @brief
+ Is called when the pickup has transited from used to unused or the other way around.
+ */
+ void InvisiblePickup::changedUsed(void)
+ {
+ SUPER(InvisiblePickup, changedUsed);
+
+ //! If the pickup is not picked up nothing must be done.
+ if(!this->isPickedUp())
+ return;
+
+ if (this->isUsed())
+ {
+ this->startPickupTimer(this->getDuration());
+ this->setInvisible(true);
+ }
+ else
+ {
+ this->setInvisible(false);
+ this->destroy();
+ }
+
+ }
+
+ /**
+ @brief
+ Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+ @return
+ A pointer to the Pawn, or NULL if the conversion failed.
+ */
+ Pawn* InvisiblePickup::carrierToPawnHelper(void)
+ {
+ PickupCarrier* carrier = this->getCarrier();
+ Pawn* pawn = dynamic_cast<Pawn*>(carrier);
+
+ if(pawn == NULL)
+ {
+ COUT(1) << "Invalid PickupCarrier in InvisiblePickup." << std::endl;
+ }
+ return pawn;
+ }
+
+ /**
+ @brief
+ Creates a duplicate of the input OrxonoxClass.
+ @param item
+ A pointer to the Orxonox class.
+ */
+ void InvisiblePickup::clone(OrxonoxClass*& item)
+ {
+ if(item == NULL)
+ item = new InvisiblePickup(this);
+
+ SUPER(InvisiblePickup, clone, item);
+
+ InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item);
+ pickup->setDuration(this->getDuration());
+ pickup->initializeIdentifier();
+ }
+
+ /**
+ @brief
+ Sets the invisibility.
+ @param invisibility
+ The invisibility.
+ */
+ bool InvisiblePickup::setInvisible(bool invisibility)
+ {
+ Pawn* pawn = this->carrierToPawnHelper();
+ if(pawn == NULL)
+ return false;
+
+ pawn->setVisible(!invisibility);
+ return true;
+ }
+
+ /**
+ @brief
+ Sets the duration.
+ @param duration
+ The duration
+ */
+ void InvisiblePickup::setDuration(float duration)
+ {
+ if(duration >= 0.0f)
+ {
+ this->duration_ = duration;
+ }
+ else
+ {
+ COUT(1) << "Invalid duration in InvisiblePickup." << std::endl;
+ this->duration_ = 0.0f;
+ }
+ }
+
+ void InvisiblePickup::pickupTimerCallback(void)
+ {
+ this->setUsed(false);
+ }
+
+}
Copied: code/trunk/src/modules/pickup/items/InvisiblePickup.h (from rev 6709, code/branches/ppspickups2/src/modules/pickup/items/InvisiblePickup.h)
===================================================================
--- code/trunk/src/modules/pickup/items/InvisiblePickup.h (rev 0)
+++ code/trunk/src/modules/pickup/items/InvisiblePickup.h 2010-04-13 07:50:11 UTC (rev 6710)
@@ -0,0 +1,89 @@
+/*
+ * 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:
+ * Benedict Simlinger
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file InvisiblePickup.h
+ @brief Declaration of the InvisiblePickup class.
+*/
+
+#ifndef _InvisiblePickup_H__
+#define _InvisiblePickup_H__
+
+#include "pickup/PickupPrereqs.h"
+
+#include <string>
+#include <worldentities/pawns/Pawn.h>
+#include "worldentities/StaticEntity.h"
+
+#include "pickup/Pickup.h"
+
+namespace orxonox {
+
+ /**
+ @brief
+ A pickup that makes the Pawn invisible.
+ There are 2 parameters that can be chosen:
+ 1) The activation type: It can be chosen to be either 'immediate' or 'onUse'. The activation type essentially (as indicated by the name) defines when the Pawn will be invisible, either immediately after being picked up or only after the player uses it.
+ 2) The duration type: It can be chosen how long the Pawn will be invisibel.
+ @author
+ Benedict Simlinger
+ */
+ class _PickupExport InvisiblePickup : public Pickup
+ {
+ public:
+
+ InvisiblePickup(BaseObject* creator); //!< Constructor.
+ virtual ~InvisiblePickup(); //!< Destructor.
+ virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
+ virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
+ virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
+
+ /**
+ @brief Checks whether the Pawn is invisible.
+ @return Returns if the Pawn is invisible.
+ */
+ inline bool getInvisibility(bool)
+ { return this->invisible_; }
+ inline float getDuration()
+ { return this->duration_; }
+
+ protected:
+ bool setInvisible(bool invisibility); //!< Set the Pawn to be invisible or visible again.
+ void setDuration(float duration);
+ void initializeIdentifier(void);
+ virtual void pickupTimerCallback(void); //!< Function that gets called when the timer ends.
+
+ private:
+ void initialize(void); //!< Initializes the member variables.
+ Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+ bool invisible_; //!< Helper to remember wether the Pawn is invisible.
+ float duration_; //! Duration of invisibility.
+ };
+}
+
+#endif // _InvisiblePickup_H__
Modified: code/trunk/src/orxonox/interfaces/PickupCarrier.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupCarrier.h 2010-04-13 07:32:08 UTC (rev 6709)
+++ code/trunk/src/orxonox/interfaces/PickupCarrier.h 2010-04-13 07:50:11 UTC (rev 6710)
@@ -45,13 +45,15 @@
#include "core/OrxonoxClass.h"
namespace orxonox
-{
- class Pickupable;
- class Pickup;
- class HealthPickup;
- class MetaPickup;
- class SpeedPickup;
+{
+ //! Forward-declarations.
+ class Pickup;
+ class HealthPickup;
+ class InvisiblePickup;
+ class MetaPickup;
+ class SpeedPickup;
+
/**
@brief
The PickupCarrier interface provides the means, for any class implementing it, to possess Pickupables.
@@ -65,7 +67,8 @@
friend class Pickupable;
friend class Pickup;
friend class HealthPickup;
- friend class MetaPickup;
+ friend class InvisiblePickup;
+ friend class MetaPickup;
friend class SpeedPickup;
public:
More information about the Orxonox-commit
mailing list