[Orxonox-commit 1701] r6419 - in code/branches/pickup3: . src/libraries/core src/modules src/modules/pickup src/modules/weapons/projectiles src/orxonox src/orxonox/interfaces src/orxonox/items src/orxonox/pickup src/orxonox/pickup/items src/orxonox/worldentities/pawns
rgrieder at orxonox.net
rgrieder at orxonox.net
Fri Dec 25 23:07:10 CET 2009
Author: rgrieder
Date: 2009-12-25 23:07:09 +0100 (Fri, 25 Dec 2009)
New Revision: 6419
Added:
code/branches/pickup3/src/modules/pickup/
code/branches/pickup3/src/modules/pickup/CMakeLists.txt
code/branches/pickup3/src/modules/pickup/DroppedItem.cc
code/branches/pickup3/src/modules/pickup/DroppedItem.h
code/branches/pickup3/src/modules/pickup/PickupCollection.cc
code/branches/pickup3/src/modules/pickup/PickupCollection.h
code/branches/pickup3/src/modules/pickup/PickupPrecompiledHeaders.h
code/branches/pickup3/src/modules/pickup/PickupPrereqs.h
code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
code/branches/pickup3/src/modules/pickup/PickupSpawner.h
code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h
code/branches/pickup3/src/orxonox/interfaces/Pickupable.h
Removed:
code/branches/pickup3/src/modules/pickup/CMakeLists.txt
code/branches/pickup3/src/modules/pickup/DroppedItem.cc
code/branches/pickup3/src/modules/pickup/DroppedItem.h
code/branches/pickup3/src/modules/pickup/PickupCollection.cc
code/branches/pickup3/src/modules/pickup/PickupCollection.h
code/branches/pickup3/src/modules/pickup/PickupPrecompiledHeaders.h
code/branches/pickup3/src/modules/pickup/PickupPrereqs.h
code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
code/branches/pickup3/src/modules/pickup/PickupSpawner.h
code/branches/pickup3/src/orxonox/pickup/DroppedItem.h
code/branches/pickup3/src/orxonox/pickup/PickupSpawner.h
Modified:
code/branches/pickup3/
code/branches/pickup3/src/libraries/core/Super.h
code/branches/pickup3/src/modules/CMakeLists.txt
code/branches/pickup3/src/modules/weapons/projectiles/Projectile.cc
code/branches/pickup3/src/orxonox/CMakeLists.txt
code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h
code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc
code/branches/pickup3/src/orxonox/items/Engine.cc
code/branches/pickup3/src/orxonox/pickup/BaseItem.cc
code/branches/pickup3/src/orxonox/pickup/BaseItem.h
code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt
code/branches/pickup3/src/orxonox/pickup/EquipmentItem.cc
code/branches/pickup3/src/orxonox/pickup/EquipmentItem.h
code/branches/pickup3/src/orxonox/pickup/ModifierPickup.cc
code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h
code/branches/pickup3/src/orxonox/pickup/ModifierType.h
code/branches/pickup3/src/orxonox/pickup/PassiveItem.cc
code/branches/pickup3/src/orxonox/pickup/PassiveItem.h
code/branches/pickup3/src/orxonox/pickup/PickupCollection.cc
code/branches/pickup3/src/orxonox/pickup/PickupCollection.h
code/branches/pickup3/src/orxonox/pickup/PickupInventory.cc
code/branches/pickup3/src/orxonox/pickup/PickupInventory.h
code/branches/pickup3/src/orxonox/pickup/UsableItem.cc
code/branches/pickup3/src/orxonox/pickup/UsableItem.h
code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.cc
code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.h
code/branches/pickup3/src/orxonox/pickup/items/HealthUsable.cc
code/branches/pickup3/src/orxonox/pickup/items/Jump.h
code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h
Log:
Merged pickup2 into pickup3.
Property changes on: code/branches/pickup3
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/ingamemenu:6000-6023
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/menu:5941-6146,6148
/code/branches/particles2:6050-6106,6109
/code/branches/presentation2:6106-6416
/code/branches/resource2:3372-5694
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
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/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
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/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
+ /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/ingamemenu:6000-6023
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/menu:5941-6146,6148
/code/branches/particles2:6050-6106,6109
/code/branches/pickup2:5942-6405
/code/branches/presentation2:6106-6416
/code/branches/resource2:3372-5694
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
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/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
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/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
Modified: code/branches/pickup3/src/libraries/core/Super.h
===================================================================
--- code/branches/pickup3/src/libraries/core/Super.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/libraries/core/Super.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -266,6 +266,9 @@
#define SUPER_changedGametype(classname, functionname, ...) \
SUPER_NOARGS(classname, functionname)
+
+ #define SUPER_changedUsed(classname, functionname, ...) \
+ SUPER_NOARGS(classname, functionname)
// (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
@@ -516,6 +519,10 @@
SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false)
()
SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
+
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
+ ()
+ SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
// (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
}
@@ -569,6 +576,7 @@
SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup);
SUPER_INTRUSIVE_DECLARATION(changedName);
SUPER_INTRUSIVE_DECLARATION(changedGametype);
+ SUPER_INTRUSIVE_DECLARATION(changedUsed);
// (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
Modified: code/branches/pickup3/src/modules/CMakeLists.txt
===================================================================
--- code/branches/pickup3/src/modules/CMakeLists.txt 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/modules/CMakeLists.txt 2009-12-25 22:07:09 UTC (rev 6419)
@@ -28,6 +28,7 @@
ADD_SUBDIRECTORY(objects)
ADD_SUBDIRECTORY(overlays)
+ADD_SUBDIRECTORY(pickup)
ADD_SUBDIRECTORY(pong)
ADD_SUBDIRECTORY(questsystem)
ADD_SUBDIRECTORY(weapons)
Deleted: code/branches/pickup3/src/modules/pickup/CMakeLists.txt
===================================================================
--- code/branches/pickup2/src/modules/pickup/CMakeLists.txt 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/CMakeLists.txt 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,18 +0,0 @@
-SET_SOURCE_FILES(PICKUP_SRC_FILES
- PickupCollection.cc
- PickupSpawner.cc
-)
-
-ORXONOX_ADD_LIBRARY(pickup
- MODULE
- FIND_HEADER_FILES
- TOLUA_FILES
- DEFINE_SYMBOL
- "PICKUP_SHARED_BUILD"
- PCH_FILE
- PickupPrecompiledHeaders.h
- LINK_LIBRARIES
- orxonox
- SOURCE_FILES ${PICKUP_SRC_FILES}
-)
-
Copied: code/branches/pickup3/src/modules/pickup/CMakeLists.txt (from rev 6405, code/branches/pickup2/src/modules/pickup/CMakeLists.txt)
===================================================================
--- code/branches/pickup3/src/modules/pickup/CMakeLists.txt (rev 0)
+++ code/branches/pickup3/src/modules/pickup/CMakeLists.txt 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,18 @@
+SET_SOURCE_FILES(PICKUP_SRC_FILES
+ PickupCollection.cc
+ PickupSpawner.cc
+)
+
+ORXONOX_ADD_LIBRARY(pickup
+ MODULE
+ FIND_HEADER_FILES
+ TOLUA_FILES
+ DEFINE_SYMBOL
+ "PICKUP_SHARED_BUILD"
+ PCH_FILE
+ PickupPrecompiledHeaders.h
+ LINK_LIBRARIES
+ orxonox
+ SOURCE_FILES ${PICKUP_SRC_FILES}
+)
+
Deleted: code/branches/pickup3/src/modules/pickup/DroppedItem.cc
===================================================================
--- code/branches/pickup2/src/modules/pickup/DroppedItem.cc 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/DroppedItem.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,114 +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:
- * Daniel 'Huty' Haggenmueller
- * Co-authors:
- * ...
- *
- */
-
-#include "DroppedItem.h"
-
-#include "util/Math.h"
-#include "core/CoreIncludes.h"
-#include "core/Executor.h"
-#include "BaseItem.h"
-#include "graphics/Billboard.h"
-#include "graphics/Model.h"
-#include "worldentities/pawns/Pawn.h"
-
-namespace orxonox
-{
- CreateFactory(DroppedItem); //TODO: This isn't needed, is it?
-
- /**
- @brief
- Constructor. Registers object and sets default values.
- */
- DroppedItem::DroppedItem(BaseObject* creator) : PickupSpawner(creator)
- {
- RegisterObject(DroppedItem);
- }
-
- DroppedItem::DroppedItem(BaseObject* creator, BaseItem* item, float triggerDistance, float respawnTime, int maxSpawnedItems) : PickupSpawner(creator, item, triggerDistance, respawnTime, maxSpawnedItems)
- {
- RegisterObject(DroppedItem);
- this->item_ = item;
- }
-
- /**
- @brief
- Default destructor.
- */
- DroppedItem::~DroppedItem()
- {
-
- }
-
- BaseItem* DroppedItem::getItem(void)
- {
- return this->item_;
- }
-
- /**
- @brief
-
- */
- //TODO: Comment.
- //Each pickup should have a XML template where the Model and Billboard, and so on, is specified.
- /*static*/ DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour, float timeToLive)
- {
- //TODO: triggerDistance?
- float triggerDistance = 20.0;
- DroppedItem* droppedItem = new DroppedItem(item, item, triggerDistance, 0, 1);
-
- //TODO: Do this somehwere else?
- Model* model = new Model(item);
- Billboard* billboard = new Billboard(item);
-
- model->setMeshSource("sphere.mesh");
- model->setScale(3.0f);
-
- billboard->setMaterial("Examples/Flare");
- billboard->setColour(flareColour);
- billboard->setScale(0.5f);
-
- droppedItem->setPosition(position);
- droppedItem->attach(model);
- droppedItem->attach(billboard);
-
- COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << "," << position.y << "," << position.z << ")." << std::endl;
-
- return droppedItem;
- }
-
- /**
- @brief
-
- */
- //TODO: See one function above.
- DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour, float timeToLive)
- {
- Vector3 after = pawn->getPosition() + pawn->getOrientation() * Vector3(0.0f, 0.0f, 50.0f);
- return DroppedItem::createDefaultDrop(item, after, flareColour, timeToLive);
- }
-}
Copied: code/branches/pickup3/src/modules/pickup/DroppedItem.cc (from rev 6405, code/branches/pickup2/src/modules/pickup/DroppedItem.cc)
===================================================================
--- code/branches/pickup3/src/modules/pickup/DroppedItem.cc (rev 0)
+++ code/branches/pickup3/src/modules/pickup/DroppedItem.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,114 @@
+/*
+ * 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:
+ * Daniel 'Huty' Haggenmueller
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "DroppedItem.h"
+
+#include "util/Math.h"
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "BaseItem.h"
+#include "graphics/Billboard.h"
+#include "graphics/Model.h"
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+ CreateFactory(DroppedItem); //TODO: This isn't needed, is it?
+
+ /**
+ @brief
+ Constructor. Registers object and sets default values.
+ */
+ DroppedItem::DroppedItem(BaseObject* creator) : PickupSpawner(creator)
+ {
+ RegisterObject(DroppedItem);
+ }
+
+ DroppedItem::DroppedItem(BaseObject* creator, BaseItem* item, float triggerDistance, float respawnTime, int maxSpawnedItems) : PickupSpawner(creator, item, triggerDistance, respawnTime, maxSpawnedItems)
+ {
+ RegisterObject(DroppedItem);
+ this->item_ = item;
+ }
+
+ /**
+ @brief
+ Default destructor.
+ */
+ DroppedItem::~DroppedItem()
+ {
+
+ }
+
+ BaseItem* DroppedItem::getItem(void)
+ {
+ return this->item_;
+ }
+
+ /**
+ @brief
+
+ */
+ //TODO: Comment.
+ //Each pickup should have a XML template where the Model and Billboard, and so on, is specified.
+ /*static*/ DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour, float timeToLive)
+ {
+ //TODO: triggerDistance?
+ float triggerDistance = 20.0;
+ DroppedItem* droppedItem = new DroppedItem(item, item, triggerDistance, 0, 1);
+
+ //TODO: Do this somehwere else?
+ Model* model = new Model(item);
+ Billboard* billboard = new Billboard(item);
+
+ model->setMeshSource("sphere.mesh");
+ model->setScale(3.0f);
+
+ billboard->setMaterial("Examples/Flare");
+ billboard->setColour(flareColour);
+ billboard->setScale(0.5f);
+
+ droppedItem->setPosition(position);
+ droppedItem->attach(model);
+ droppedItem->attach(billboard);
+
+ COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << ',' << position.y << ',' << position.z << ")." << std::endl;
+
+ return droppedItem;
+ }
+
+ /**
+ @brief
+
+ */
+ //TODO: See one function above.
+ DroppedItem* DroppedItem::createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour, float timeToLive)
+ {
+ Vector3 after = pawn->getPosition() + pawn->getOrientation() * Vector3(0.0f, 0.0f, 50.0f);
+ return DroppedItem::createDefaultDrop(item, after, flareColour, timeToLive);
+ }
+}
Deleted: code/branches/pickup3/src/modules/pickup/DroppedItem.h
===================================================================
--- code/branches/pickup2/src/modules/pickup/DroppedItem.h 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/DroppedItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,63 +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:
- * Daniel 'Huty' Haggenmueller
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of DroppedItem
-*/
-
-#ifndef _DroppedItem_H__
-#define _DroppedItem_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "PickupSpawner.h"
-
-namespace orxonox
-{
- class _OrxonoxExport DroppedItem : public PickupSpawner
- {
- public:
- DroppedItem(BaseObject* creator);
- DroppedItem(BaseObject* creator, BaseItem* item, float triggerDistance, float respawnTime, int maxSpawnedItems);
- virtual ~DroppedItem();
-
- static DroppedItem* createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
- static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
-
- protected:
- virtual BaseItem* getItem(void);
-
- private:
-
- BaseItem* item_; //!< The dropped item.
-
- };
-}
-
-#endif /* _DroppedItem_H__ */
Copied: code/branches/pickup3/src/modules/pickup/DroppedItem.h (from rev 6405, code/branches/pickup2/src/modules/pickup/DroppedItem.h)
===================================================================
--- code/branches/pickup3/src/modules/pickup/DroppedItem.h (rev 0)
+++ code/branches/pickup3/src/modules/pickup/DroppedItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ * Daniel 'Huty' Haggenmueller
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of DroppedItem
+*/
+
+#ifndef _DroppedItem_H__
+#define _DroppedItem_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "PickupSpawner.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport DroppedItem : public PickupSpawner
+ {
+ public:
+ DroppedItem(BaseObject* creator);
+ DroppedItem(BaseObject* creator, BaseItem* item, float triggerDistance, float respawnTime, int maxSpawnedItems);
+ virtual ~DroppedItem();
+
+ static DroppedItem* createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
+ static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
+
+ protected:
+ virtual BaseItem* getItem(void);
+
+ private:
+
+ BaseItem* item_; //!< The dropped item.
+
+ };
+}
+
+#endif /* _DroppedItem_H__ */
Deleted: code/branches/pickup3/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/branches/pickup2/src/modules/pickup/PickupCollection.cc 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,231 +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:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of PickupCollection.
-*/
-
-#include "PickupCollection.h"
-
-#include "core/CoreIncludes.h"
-#include "core/Template.h"
-#include "core/XMLPort.h"
-#include "interfaces/PickupCarrier.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Default Constructor.
- */
- PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(PickupCollection);
- }
-
- /**
- @brief
- Destructor.
- */
- PickupCollection::~PickupCollection()
- {
- //! Destroy all Pickupables constructing this PickupCollection.
- for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
- {
- delete *it;
- }
- }
-
- /**
- @brief
- Creates an instance of this Class through XML.
- */
- void PickupCollection::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PickupCollection, XMLPort, xmlelement, mode);
-
- //TODO: Does this work? Problem could be, that Pickupable itself cannot be instantiated through XML...
- XMLPortObject(PickupCollection, PickupCollection, "pickupables", addPickupable, getPickupable, xmlelement, mode);
- }
-
- /**
- @brief
- Add the input Pickupable to list of Pickupables combined by this PickupCollection.
- @param pickup
- The Pickupable to be added.
- @return
- Returns true if successful,
- */
- bool PickupCollection::addPickupable(Pickupable* pickup)
- {
- if(pickup == NULL)
- return false;
-
- this->pickups_.insert(pickup);
- return true;
- }
-
- /**
- @brief
- Get the Pickupable at the given index.
- @param index
- The index the Pickupable is fetched from.
- @return
- Returns a pointer to the Pickupable at the index given by index.
- */
- Pickupable* PickupCollection::getPickupable(unsigned int index)
- {
- return this->pickups_[index]; //TODO. Does this work?
- }
-
- //TODO: Steal description from Pickupable.
- void PickupCollection::changedUsed(void)
- {
- SUPER(PickupCollection, changedUsed);
-
- //! Change used for all Pickupables this PickupCollection consists of.
- for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
- {
- (*it)->changedUsed();
- }
- }
-
- /**
- @brief
- Puts the PickupCollection in use.
- @return
- Returns true if successful.
- */
- //TODO: Revert if one fails? (same for unused)
- bool PickupCollection::use(void)
- {
- if(this->isUsed())
- return false;
-
- bool success = true;
- //! Set all Pickupables to used.
- for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
- {
- if(!(*it)->use())
- {
- success = false;
- }
- }
-
- this->changedUsed();
-
- return success;
- }
-
- /**
- @brief
- Puts the PickupCollection out of use.
- @return
- Returns true if successful.
- */
- bool PickupCollection::unuse(void)
- {
- if(!this->isUsed())
- return false;
-
- bool success = true;
- //! Set all Pickupables to unused.
- for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
- {
- if(!(*it)->unuse())
- {
- success = false;
- }
- }
-
- this->changedUsed();
-
- return success;
- }
-
- /**
- @brief
- Is invoked when the pickup is picked up.
- @param carrier
- The PickupCarrier that is picking up this pickup.
- @return
- Returns true if successful.
- */
- //TODO: Something should happen in the carrier as well, maybe just in the carrier. Owner might not be correct if the carrier hands the pickup down or up. Maybe even a Pawn as input instead fo a carrier. Or do this in Spawner?
- bool PickupCollection::pickup(PickupCarrier* carrier)
- {
- if(this->getOwner() != NULL)
- {
- COUT(2) << "Pickup wanted to get picked up by a new carrier, but it already has a carrier." << std::endl;
- return false;
- }
- for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
- {
- (*it)->setOwner(carrier);
- }
-
- this->setOwner(carrier);
-
- return true;
- }
-
- /**
- @brief
- Drop the pickup.
- @return
- Return true if successful.
- */
- bool PickupCollection::drop(void)
- {
- this->unuse();
- this->setOwner(NULL);
-
- //TODO: Create new Pickupspawner/DroppedPickup
- return true;
- }
-
- //TODO: Steal description from Pickupable.
- Pickupable* PickupCollection::clone()
- {
- Template* collectionTemplate = Template::getTemplate(this->getIdentifier()->getName());
- BaseObject* newObject = collectionTemplate->getBaseclassIdentifier()->fabricate(this);
-
- PickupCollection* newCollection = dynamic_cast<PickupCollection*>(newObject);
- for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
- {
- Pickupable* newPickup = (*it)->clone();
- newCollection->pickups_.push_back(newPickup);
- }
-
- Pickupable* pickup = dynamic_cast<Pickupable*>(newCollection);
- return pickup;
- }
-
-}
\ No newline at end of file
Copied: code/branches/pickup3/src/modules/pickup/PickupCollection.cc (from rev 6405, code/branches/pickup2/src/modules/pickup/PickupCollection.cc)
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollection.cc (rev 0)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,231 @@
+/*
+ * 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:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of PickupCollection.
+*/
+
+#include "PickupCollection.h"
+
+#include "core/CoreIncludes.h"
+#include "core/Template.h"
+#include "core/XMLPort.h"
+#include "interfaces/PickupCarrier.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Default Constructor.
+ */
+ PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(PickupCollection);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ PickupCollection::~PickupCollection()
+ {
+ //! Destroy all Pickupables constructing this PickupCollection.
+ for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ delete *it;
+ }
+ }
+
+ /**
+ @brief
+ Creates an instance of this Class through XML.
+ */
+ void PickupCollection::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PickupCollection, XMLPort, xmlelement, mode);
+
+ //TODO: Does this work? Problem could be, that Pickupable itself cannot be instantiated through XML...
+ XMLPortObject(PickupCollection, PickupCollection, "pickupables", addPickupable, getPickupable, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Add the input Pickupable to list of Pickupables combined by this PickupCollection.
+ @param pickup
+ The Pickupable to be added.
+ @return
+ Returns true if successful,
+ */
+ bool PickupCollection::addPickupable(Pickupable* pickup)
+ {
+ if(pickup == NULL)
+ return false;
+
+ this->pickups_.insert(pickup);
+ return true;
+ }
+
+ /**
+ @brief
+ Get the Pickupable at the given index.
+ @param index
+ The index the Pickupable is fetched from.
+ @return
+ Returns a pointer to the Pickupable at the index given by index.
+ */
+ Pickupable* PickupCollection::getPickupable(unsigned int index)
+ {
+ return this->pickups_[index]; //TODO. Does this work?
+ }
+
+ //TODO: Steal description from Pickupable.
+ void PickupCollection::changedUsed(void)
+ {
+ SUPER(PickupCollection, changedUsed);
+
+ //! Change used for all Pickupables this PickupCollection consists of.
+ for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ (*it)->changedUsed();
+ }
+ }
+
+ /**
+ @brief
+ Puts the PickupCollection in use.
+ @return
+ Returns true if successful.
+ */
+ //TODO: Revert if one fails? (same for unused)
+ bool PickupCollection::use(void)
+ {
+ if(this->isUsed())
+ return false;
+
+ bool success = true;
+ //! Set all Pickupables to used.
+ for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ if(!(*it)->use())
+ {
+ success = false;
+ }
+ }
+
+ this->changedUsed();
+
+ return success;
+ }
+
+ /**
+ @brief
+ Puts the PickupCollection out of use.
+ @return
+ Returns true if successful.
+ */
+ bool PickupCollection::unuse(void)
+ {
+ if(!this->isUsed())
+ return false;
+
+ bool success = true;
+ //! Set all Pickupables to unused.
+ for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ if(!(*it)->unuse())
+ {
+ success = false;
+ }
+ }
+
+ this->changedUsed();
+
+ return success;
+ }
+
+ /**
+ @brief
+ Is invoked when the pickup is picked up.
+ @param carrier
+ The PickupCarrier that is picking up this pickup.
+ @return
+ Returns true if successful.
+ */
+ //TODO: Something should happen in the carrier as well, maybe just in the carrier. Owner might not be correct if the carrier hands the pickup down or up. Maybe even a Pawn as input instead fo a carrier. Or do this in Spawner?
+ bool PickupCollection::pickup(PickupCarrier* carrier)
+ {
+ if(this->getOwner() != NULL)
+ {
+ COUT(2) << "Pickup wanted to get picked up by a new carrier, but it already has a carrier." << std::endl;
+ return false;
+ }
+ for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ (*it)->setOwner(carrier);
+ }
+
+ this->setOwner(carrier);
+
+ return true;
+ }
+
+ /**
+ @brief
+ Drop the pickup.
+ @return
+ Return true if successful.
+ */
+ bool PickupCollection::drop(void)
+ {
+ this->unuse();
+ this->setOwner(NULL);
+
+ //TODO: Create new Pickupspawner/DroppedPickup
+ return true;
+ }
+
+ //TODO: Steal description from Pickupable.
+ Pickupable* PickupCollection::clone()
+ {
+ Template* collectionTemplate = Template::getTemplate(this->getIdentifier()->getName());
+ BaseObject* newObject = collectionTemplate->getBaseclassIdentifier()->fabricate(this);
+
+ PickupCollection* newCollection = dynamic_cast<PickupCollection*>(newObject);
+ for(std::list<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
+ {
+ Pickupable* newPickup = (*it)->clone();
+ newCollection->pickups_.push_back(newPickup);
+ }
+
+ Pickupable* pickup = dynamic_cast<Pickupable*>(newCollection);
+ return pickup;
+ }
+
+}
\ No newline at end of file
Deleted: code/branches/pickup3/src/modules/pickup/PickupCollection.h
===================================================================
--- code/branches/pickup2/src/modules/pickup/PickupCollection.h 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,81 +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:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PickupCollection_H__
-#define _PickupCollection_H__
-
-#include "pickup/PickupPrereqs.h"
-
-#include "interfaces/Pickupable.h"
-#include "core/BaseObject.h"
-#include "core/XMLPort.h"
-
-#include <list>
-
-namespace orxonox
-{
-
- /**
- @brief
- The PickupCollection combines different Pickupables to a coherent, single pickup and makes the seem (from the outside looking in) just as if they were just one Pickupable.
- @author
- Damian 'Mozork' Frick
- */
- //TODO: Isn't private inheritance sufficient?
- class _PickupExport PickupCollection : public Pickupable, public BaseObject
- {
-
- public:
-
- PickupCollection(BaseObject* creator);
- virtual ~PickupCollection();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void changedUsed(void);
-
- virtual bool use(void);
- virtual bool unuse(void);
-
- virtual bool pickup(PickupCarrier* carrier);
- virtual bool drop(void);
-
- virtual Pickupable* clone(void);
-
- bool addPickupable(Pickupable* pickup);
- Pickupable* getPickupable(unsigned int index);
-
- private:
-
- std::list<Pickupable*> pickups_;
-
- };
-
-}
-
-#endif /* _PickupCollection_H__ */
\ No newline at end of file
Copied: code/branches/pickup3/src/modules/pickup/PickupCollection.h (from rev 6405, code/branches/pickup2/src/modules/pickup/PickupCollection.h)
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupCollection.h (rev 0)
+++ code/branches/pickup3/src/modules/pickup/PickupCollection.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,81 @@
+/*
+ * 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:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PickupCollection_H__
+#define _PickupCollection_H__
+
+#include "pickup/PickupPrereqs.h"
+
+#include "interfaces/Pickupable.h"
+#include "core/BaseObject.h"
+#include "core/XMLPort.h"
+
+#include <list>
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ The PickupCollection combines different Pickupables to a coherent, single pickup and makes the seem (from the outside looking in) just as if they were just one Pickupable.
+ @author
+ Damian 'Mozork' Frick
+ */
+ //TODO: Isn't private inheritance sufficient?
+ class _PickupExport PickupCollection : public Pickupable, public BaseObject
+ {
+
+ public:
+
+ PickupCollection(BaseObject* creator);
+ virtual ~PickupCollection();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void changedUsed(void);
+
+ virtual bool use(void);
+ virtual bool unuse(void);
+
+ virtual bool pickup(PickupCarrier* carrier);
+ virtual bool drop(void);
+
+ virtual Pickupable* clone(void);
+
+ bool addPickupable(Pickupable* pickup);
+ Pickupable* getPickupable(unsigned int index);
+
+ private:
+
+ std::list<Pickupable*> pickups_;
+
+ };
+
+}
+
+#endif /* _PickupCollection_H__ */
\ No newline at end of file
Deleted: code/branches/pickup3/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/branches/pickup2/src/modules/pickup/PickupPrereqs.h 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/PickupPrereqs.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -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:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
- Shared library macros, enums, constants and forward declarations for the questsystem module
-*/
-
-#ifndef _PickupPrereqs_H__
-#define _PickupPrereqs_H__
-
-#include "OrxonoxConfig.h"
-#include "OrxonoxPrereqs.h"
-
-//-----------------------------------------------------------------------
-// Shared library settings
-//-----------------------------------------------------------------------
-
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
-# ifdef QUESTSYSTEM_SHARED_BUILD
-# define _PickupExport __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define _PickupExport
-# else
-# define _PickupExport __declspec(dllimport)
-# endif
-# endif
-#elif defined ( ORXONOX_GCC_VISIBILITY )
-# define _PickupExport __attribute__ ((visibility("default")))
-#else
-# define _PickupExport
-#endif
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
-
- class PickupCollection;
- class PickupSpawner;
-
-}
-
-#endif /* _PickupPrereqs_H__ */
Copied: code/branches/pickup3/src/modules/pickup/PickupPrereqs.h (from rev 6405, code/branches/pickup2/src/modules/pickup/PickupPrereqs.h)
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupPrereqs.h (rev 0)
+++ code/branches/pickup3/src/modules/pickup/PickupPrereqs.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -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:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _PickupPrereqs_H__
+#define _PickupPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+# ifdef QUESTSYSTEM_SHARED_BUILD
+# define _PickupExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _PickupExport
+# else
+# define _PickupExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _PickupExport __attribute__ ((visibility("default")))
+#else
+# define _PickupExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+
+ class PickupCollection;
+ class PickupSpawner;
+
+}
+
+#endif /* _PickupPrereqs_H__ */
Deleted: code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/pickup2/src/modules/pickup/PickupSpawner.cc 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,295 +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:
- * Daniel 'Huty' Haggenmueller
- * Co-authors:
- * Damian 'Mozork' Frick
- *
- */
-
-/**
- @file
- @brief Implementation of PickupSpawner.
-*/
-
-#include "PickupSpawner.h"
-
-#include "core/CoreIncludes.h"
-//#include "core/GUIManager.h" // HACK; see below
-#include "core/Template.h"
-#include "core/XMLPort.h"
-#include "worldentities/pawns/Pawn.h"
-//#include "PickupInventory.h" // HACK; Only for hack, remove later
-
-
-namespace orxonox
-{
-
-// const float PickupSpawner::bounceSpeed_s = 6.0f;
-// const float PickupSpawner::rotationSpeed_s = 1.0f;
-// const float PickupSpawner::bounceDistance_s = 4.0f;
-
- CreateFactory(PickupSpawner);
-
- /**
- @brief
- Constructor. Registers the PickupSpawner.
- @param creator
- Pointer to the object which created this item.
- */
- PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
- {
- this->initialize();
- }
-
- PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator)
- {
- this->initialize();
-
- this->pickup_ = pickup;
-
- this->triggerDistance_ = triggerDistance;
- this->respawnTime_ = respawnTime;
- this->setMaxSpawnedItems(maxSpawnedItems);
- }
-
- void PickupSpawner::initialize(void)
- {
- RegisterObject(PickupSpawner);
-
- this->pickup_ = NULL;
-
- this->triggerDistance_ = 20;
- this->respawnTime_ = 0;
- this->tickSum_ = 0;
- this->maxSpawnedItems_ = INF;
- this->spawnsRemaining_ = INF;
- }
-
- /**
- @brief
- Destructor.
- */
- PickupSpawner::~PickupSpawner()
- {
-
- }
-
- /**
- @brief
- Method for creating a PickupSpawner through XML.
- @param xmlelement
- XML element which contains the PickupSpawner.
- @param mode
- XMLPort mode.
- */
- void PickupSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PickupSpawner, XMLPort, xmlelement, mode);
-
- XMLPortObject(PickupSpawner, Pickupable, "pickup", addPickupable, getPickupable, xmlelement, mode);
-
- XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode);
- XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode);
- XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode);
-
- //TODO: Kill hack.
- // HACKs
- // Load the GUI image as soon as the PickupSpawner gets loaded
- // = less delays while running
-// BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this);
-// BaseItem* asItem = orxonox_cast<BaseItem*>(newObject);
-// if (asItem)
-// {
-// asItem->addTemplate(this->itemTemplate_);
-// PickupInventory::getImageForItem(asItem);
-// newObject->destroy();
-// }
-
- // & load the GUI itself too, along with some empty windows
- // = even less delays
-// GUIManager::getInstance().showGUI("PickupInventory");
-// GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
-// PickupInventory::getSingleton();
- }
-
- void PickupSpawner::addPickupable(Pickupable* pickup)
- {
- if(this->pickup_ != NULL)
- {
- COUT(1) << "addPickupable called, with this->pickup_ already set." << std::endl;
- return;
- }
- if(pickup == NULL)
- {
- COUT(1) << "Argument of addPickupable is NULL." << std::endl;
- return;
- }
-
- this->pickup_ = pickup;
- }
-
- Pickupable* PickupSpawner::getPickupable(void)
- {
- return this->pickup_;
- }
-
- /**
- @brief
- Invoked when the activity has changed. Sets visibility of attached objects.
- */
-// void PickupSpawner::changedActivity()
-// {
-// SUPER(PickupSpawner, changedActivity);
-//
-// for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
-// (*it)->setVisible(this->isActive());
-// }
-
- void PickupSpawner::setMaxSpawnedItems(int items)
- {
- this->maxSpawnedItems_ = items;
- this->spawnsRemaining_ = items;
- }
-
- /**
- @brief
- Tick, checks if any Pawn is close enough to trigger.
- @param dt
- Time since last tick.
- */
- //TODO: Replace this with a real DistanceTrigger?
- void PickupSpawner::tick(float dt)
- {
- //! If the PickupSpawner is active.
- if (this->isActive())
- {
- //! Iterate trough all Pawns.
- for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
- {
- Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
- //! If a Pawn, that fits the target-range of the item spawned by this Pickup, is in trigger-distance.
- if (distance.length() < this->triggerDistance_ && this->pickup_->isTarget(*it))
- {
- this->trigger(*it);
- }
- }
-
- //! Animation.
-// this->yaw(Radian(rotationSpeed_s*dt));
-// this->tickSum_ += bounceSpeed_s*dt;
-// this->translate(Vector3(0,bounceDistance_s*dt*sin(this->tickSum_),0));
-// if (this->tickSum_ > 2*Ogre::Math::PI)
-// this->tickSum_ -= 2*Ogre::Math::PI;
- }
- }
-
- /**
- @brief
- Trigger the PickupSpawner.
-
- Adds the pickup to the Pawn that triggered,
- sets the timer to re-activate and deactives the PickupSpawner.
-
- @param pawn
- Pawn which triggered the PickupSpawner.
- */
- void PickupSpawner::trigger(Pawn* pawn)
- {
- //TODO: If private, isActive doesn't need to be tested anymore.
- if (this->isActive()) //!< Checks whether PickupItem is active.
- {
- Pickupable* pickup = this->getPickup();
- if (pickup != NULL) //!< If everything went ok, and pickup is not NULL.
- {
- PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
- if(carrier == NULL)
- {
- COUT(1) << "This is bad. Pawn isn't PickupCarrier." << std::endl;
- return;
- }
-
- if(pickup->pickup(carrier))
- {
- COUT(3) << "Pickup got picked up." << std::endl;
-
- this->decrementSpawnsRemaining();
- }
- else
- {
- pickup->destroy();
- }
- }
- }
- }
-
- void PickupSpawner::decrementSpawnsRemaining(void)
- {
- if(this->spawnsRemaining_ != INF)
- {
- this->spawnsRemaining_--;
- }
- if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0)
- {
- //TODO: Nicer?
- this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
-
- this->setActive(false);
- this->fireEvent();
- }
- else
- {
- COUT(3) << "PickupSpawner empty, selfdistruct initialized." << std::endl;
- this->setActive(false);
- this->destroy(); //TODO: Implement destroy().
- }
- }
-
- /**
- @brief
- Creates a new Pickupable.
- @return
- The Pickupable created.
- */
- Pickupable* PickupSpawner::getPickup(void)
- {
- if(this->spawnsRemaining_ == 0)
- {
- COUT(1) << "Massive Error: PickupSpawner still alive until having spawned last item." << std::endl;
- return NULL;
- }
-
- Pickupable* pickup = this->pickup_->clone();
- return pickup;
- }
-
- /**
- @brief
- Invoked by the timer, re-activates the PickupSpawner.
- */
- void PickupSpawner::respawnTimerCallback()
- {
- COUT(3) << "PickupSpawner reactivated." << std::endl;
-
- this->setActive(true);
- }
-}
Copied: code/branches/pickup3/src/modules/pickup/PickupSpawner.cc (from rev 6405, code/branches/pickup2/src/modules/pickup/PickupSpawner.cc)
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupSpawner.cc (rev 0)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,295 @@
+/*
+ * 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:
+ * Daniel 'Huty' Haggenmueller
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+/**
+ @file
+ @brief Implementation of PickupSpawner.
+*/
+
+#include "PickupSpawner.h"
+
+#include "core/CoreIncludes.h"
+//#include "core/GUIManager.h" // HACK; see below
+#include "core/Template.h"
+#include "core/XMLPort.h"
+#include "worldentities/pawns/Pawn.h"
+//#include "PickupInventory.h" // HACK; Only for hack, remove later
+
+
+namespace orxonox
+{
+
+// const float PickupSpawner::bounceSpeed_s = 6.0f;
+// const float PickupSpawner::rotationSpeed_s = 1.0f;
+// const float PickupSpawner::bounceDistance_s = 4.0f;
+
+ CreateFactory(PickupSpawner);
+
+ /**
+ @brief
+ Constructor. Registers the PickupSpawner.
+ @param creator
+ Pointer to the object which created this item.
+ */
+ PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
+ {
+ this->initialize();
+ }
+
+ PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator)
+ {
+ this->initialize();
+
+ this->pickup_ = pickup;
+
+ this->triggerDistance_ = triggerDistance;
+ this->respawnTime_ = respawnTime;
+ this->setMaxSpawnedItems(maxSpawnedItems);
+ }
+
+ void PickupSpawner::initialize(void)
+ {
+ RegisterObject(PickupSpawner);
+
+ this->pickup_ = NULL;
+
+ this->triggerDistance_ = 20;
+ this->respawnTime_ = 0;
+ this->tickSum_ = 0;
+ this->maxSpawnedItems_ = INF;
+ this->spawnsRemaining_ = INF;
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ PickupSpawner::~PickupSpawner()
+ {
+
+ }
+
+ /**
+ @brief
+ Method for creating a PickupSpawner through XML.
+ @param xmlelement
+ XML element which contains the PickupSpawner.
+ @param mode
+ XMLPort mode.
+ */
+ void PickupSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PickupSpawner, XMLPort, xmlelement, mode);
+
+ XMLPortObject(PickupSpawner, Pickupable, "pickup", addPickupable, getPickupable, xmlelement, mode);
+
+ XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode);
+ XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode);
+ XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode);
+
+ //TODO: Kill hack.
+ // HACKs
+ // Load the GUI image as soon as the PickupSpawner gets loaded
+ // = less delays while running
+// BaseObject* newObject = this->itemTemplate_->getBaseclassIdentifier()->fabricate(this);
+// BaseItem* asItem = orxonox_cast<BaseItem*>(newObject);
+// if (asItem)
+// {
+// asItem->addTemplate(this->itemTemplate_);
+// PickupInventory::getImageForItem(asItem);
+// newObject->destroy();
+// }
+
+ // & load the GUI itself too, along with some empty windows
+ // = even less delays
+// GUIManager::showGUI("PickupInventory");
+// GUIManager::hideGUI("PickupInventory");
+// PickupInventory::getSingleton();
+ }
+
+ void PickupSpawner::addPickupable(Pickupable* pickup)
+ {
+ if(this->pickup_ != NULL)
+ {
+ COUT(1) << "addPickupable called, with this->pickup_ already set." << std::endl;
+ return;
+ }
+ if(pickup == NULL)
+ {
+ COUT(1) << "Argument of addPickupable is NULL." << std::endl;
+ return;
+ }
+
+ this->pickup_ = pickup;
+ }
+
+ Pickupable* PickupSpawner::getPickupable(void)
+ {
+ return this->pickup_;
+ }
+
+ /**
+ @brief
+ Invoked when the activity has changed. Sets visibility of attached objects.
+ */
+// void PickupSpawner::changedActivity()
+// {
+// SUPER(PickupSpawner, changedActivity);
+//
+// for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
+// (*it)->setVisible(this->isActive());
+// }
+
+ void PickupSpawner::setMaxSpawnedItems(int items)
+ {
+ this->maxSpawnedItems_ = items;
+ this->spawnsRemaining_ = items;
+ }
+
+ /**
+ @brief
+ Tick, checks if any Pawn is close enough to trigger.
+ @param dt
+ Time since last tick.
+ */
+ //TODO: Replace this with a real DistanceTrigger?
+ void PickupSpawner::tick(float dt)
+ {
+ //! If the PickupSpawner is active.
+ if (this->isActive())
+ {
+ //! Iterate trough all Pawns.
+ for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
+ {
+ Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
+ //! If a Pawn, that fits the target-range of the item spawned by this Pickup, is in trigger-distance.
+ if (distance.length() < this->triggerDistance_ && this->pickup_->isTarget(*it))
+ {
+ this->trigger(*it);
+ }
+ }
+
+ //! Animation.
+// this->yaw(Radian(rotationSpeed_s*dt));
+// this->tickSum_ += bounceSpeed_s*dt;
+// this->translate(Vector3(0,bounceDistance_s*dt*sin(this->tickSum_),0));
+// if (this->tickSum_ > 2*Ogre::Math::PI)
+// this->tickSum_ -= 2*Ogre::Math::PI;
+ }
+ }
+
+ /**
+ @brief
+ Trigger the PickupSpawner.
+
+ Adds the pickup to the Pawn that triggered,
+ sets the timer to re-activate and deactives the PickupSpawner.
+
+ @param pawn
+ Pawn which triggered the PickupSpawner.
+ */
+ void PickupSpawner::trigger(Pawn* pawn)
+ {
+ //TODO: If private, isActive doesn't need to be tested anymore.
+ if (this->isActive()) //!< Checks whether PickupItem is active.
+ {
+ Pickupable* pickup = this->getPickup();
+ if (pickup != NULL) //!< If everything went ok, and pickup is not NULL.
+ {
+ PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);
+ if(carrier == NULL)
+ {
+ COUT(1) << "This is bad. Pawn isn't PickupCarrier." << std::endl;
+ return;
+ }
+
+ if(pickup->pickup(carrier))
+ {
+ COUT(3) << "Pickup got picked up." << std::endl;
+
+ this->decrementSpawnsRemaining();
+ }
+ else
+ {
+ pickup->destroy();
+ }
+ }
+ }
+ }
+
+ void PickupSpawner::decrementSpawnsRemaining(void)
+ {
+ if(this->spawnsRemaining_ != INF)
+ {
+ this->spawnsRemaining_--;
+ }
+ if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0)
+ {
+ //TODO: Nicer?
+ this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this)));
+
+ this->setActive(false);
+ this->fireEvent();
+ }
+ else
+ {
+ COUT(3) << "PickupSpawner empty, selfdistruct initialized." << std::endl;
+ this->setActive(false);
+ this->destroy(); //TODO: Implement destroy().
+ }
+ }
+
+ /**
+ @brief
+ Creates a new Pickupable.
+ @return
+ The Pickupable created.
+ */
+ Pickupable* PickupSpawner::getPickup(void)
+ {
+ if(this->spawnsRemaining_ == 0)
+ {
+ COUT(1) << "Massive Error: PickupSpawner still alive until having spawned last item." << std::endl;
+ return NULL;
+ }
+
+ Pickupable* pickup = this->pickup_->clone();
+ return pickup;
+ }
+
+ /**
+ @brief
+ Invoked by the timer, re-activates the PickupSpawner.
+ */
+ void PickupSpawner::respawnTimerCallback()
+ {
+ COUT(3) << "PickupSpawner reactivated." << std::endl;
+
+ this->setActive(true);
+ }
+}
Deleted: code/branches/pickup3/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/branches/pickup2/src/modules/pickup/PickupSpawner.h 2009-12-23 19:27:17 UTC (rev 6405)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,129 +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:
- * Daniel 'Huty' Haggenmueller
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of PickupSpawner.
-*/
-
-#ifndef _PickupSpawner_H__
-#define _PickupSpawner_H__
-
-#include "pickup/PickupPrereqs.h"
-
-#include <string>
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-#include "worldentities/StaticEntity.h"
-#include "interfaces/Pickupable.h"
-
-namespace orxonox
-{
- /**
- @brief PickupSpawner.
- @author Daniel 'Huty' Haggenmueller
- */
- class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
- {
- public:
- //TODO: Add limit of items spawned here.
- PickupSpawner(BaseObject* creator);
- PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems);
- virtual ~PickupSpawner();
-
- virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty).
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML.
- virtual void tick(float dt);
-
- /**
- @brief Get the distance in which to trigger.
- @return Returns the distance in which this gets triggered.
- */
- inline float getTriggerDistance() const
- { return this->triggerDistance_; }
- /**
- @brief Set the distance in which to trigger.
- @param value The new distance in which to trigger.
- */
- inline void setTriggerDistance(float value)
- { this->triggerDistance_ = value; }
-
- /**
- @brief Get the time to respawn.
- @returns Returns the time after which this gets re-actived.
- */
- inline float getRespawnTime() const
- { return this->respawnTime_; }
- /**
- @brief Set the time to respawn.
- @param time New time after which this gets re-actived.
- */
- inline void setRespawnTime(float time)
- { this->respawnTime_ = time; }
-
-
- inline int getMaxSpawnedItems(void)
- { return this->maxSpawnedItems_; }
- void setMaxSpawnedItems(int items);
-
- protected:
- virtual Pickupable* getPickup(void);
-
- void addPickupable(Pickupable* pickup);
- Pickupable* getPickupable(void);
-
- void decrementSpawnsRemaining(void);
-
- private:
- void initialize(void);
-
- void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough.
- void respawnTimerCallback(); //!< Method called when the timer runs out.
-
-
- Pickupable* pickup_;
-
- int maxSpawnedItems_; //!< Maximum number of items spawned by this PickupSpawner.
- int spawnsRemaining_; //!< Number of items that can be spawned by this PickupSpawner until it selfdestructs.
-
- float triggerDistance_; //!< Distance in which this gets triggered.
-
- /* Pickup animation */
- float tickSum_; //!< Adds up tick to use in sine movement
- static const float bounceSpeed_s; //!< Speed of pickup to bounce up and down
- static const float bounceDistance_s; //!< Distance the pickup bounces up and down
- static const float rotationSpeed_s; //!< Rotation speed of pickup
-
- float respawnTime_; //!< Time after which this gets re-actived.
- Timer respawnTimer_; //!< Timer used for re-activating.
-
- static const int INF = -1; //!< Constant for infinity.
- };
-}
-
-#endif /* _PickupSpawner_H__ */
Copied: code/branches/pickup3/src/modules/pickup/PickupSpawner.h (from rev 6405, code/branches/pickup2/src/modules/pickup/PickupSpawner.h)
===================================================================
--- code/branches/pickup3/src/modules/pickup/PickupSpawner.h (rev 0)
+++ code/branches/pickup3/src/modules/pickup/PickupSpawner.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,129 @@
+/*
+ * 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:
+ * Daniel 'Huty' Haggenmueller
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of PickupSpawner.
+*/
+
+#ifndef _PickupSpawner_H__
+#define _PickupSpawner_H__
+
+#include "pickup/PickupPrereqs.h"
+
+#include <string>
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/StaticEntity.h"
+#include "interfaces/Pickupable.h"
+
+namespace orxonox
+{
+ /**
+ @brief PickupSpawner.
+ @author Daniel 'Huty' Haggenmueller
+ */
+ class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
+ {
+ public:
+ //TODO: Add limit of items spawned here.
+ PickupSpawner(BaseObject* creator);
+ PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems);
+ virtual ~PickupSpawner();
+
+ virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty).
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML.
+ virtual void tick(float dt);
+
+ /**
+ @brief Get the distance in which to trigger.
+ @return Returns the distance in which this gets triggered.
+ */
+ inline float getTriggerDistance() const
+ { return this->triggerDistance_; }
+ /**
+ @brief Set the distance in which to trigger.
+ @param value The new distance in which to trigger.
+ */
+ inline void setTriggerDistance(float value)
+ { this->triggerDistance_ = value; }
+
+ /**
+ @brief Get the time to respawn.
+ @returns Returns the time after which this gets re-actived.
+ */
+ inline float getRespawnTime() const
+ { return this->respawnTime_; }
+ /**
+ @brief Set the time to respawn.
+ @param time New time after which this gets re-actived.
+ */
+ inline void setRespawnTime(float time)
+ { this->respawnTime_ = time; }
+
+
+ inline int getMaxSpawnedItems(void)
+ { return this->maxSpawnedItems_; }
+ void setMaxSpawnedItems(int items);
+
+ protected:
+ virtual Pickupable* getPickup(void);
+
+ void addPickupable(Pickupable* pickup);
+ Pickupable* getPickupable(void);
+
+ void decrementSpawnsRemaining(void);
+
+ private:
+ void initialize(void);
+
+ void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough.
+ void respawnTimerCallback(); //!< Method called when the timer runs out.
+
+
+ Pickupable* pickup_;
+
+ int maxSpawnedItems_; //!< Maximum number of items spawned by this PickupSpawner.
+ int spawnsRemaining_; //!< Number of items that can be spawned by this PickupSpawner until it selfdestructs.
+
+ float triggerDistance_; //!< Distance in which this gets triggered.
+
+ /* Pickup animation */
+ float tickSum_; //!< Adds up tick to use in sine movement
+ static const float bounceSpeed_s; //!< Speed of pickup to bounce up and down
+ static const float bounceDistance_s; //!< Distance the pickup bounces up and down
+ static const float rotationSpeed_s; //!< Rotation speed of pickup
+
+ float respawnTime_; //!< Time after which this gets re-actived.
+ Timer respawnTimer_; //!< Timer used for re-activating.
+
+ static const int INF = -1; //!< Constant for infinity.
+ };
+}
+
+#endif /* _PickupSpawner_H__ */
Modified: code/branches/pickup3/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/branches/pickup3/src/modules/weapons/projectiles/Projectile.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/modules/weapons/projectiles/Projectile.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -123,8 +123,9 @@
}
float dmg = this->damage_;
- if (this->owner_)
- dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
+ //TODO: Remove.
+// if (this->owner_)
+// dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
Pawn* victim = orxonox_cast<Pawn*>(otherObject);
if (victim)
Modified: code/branches/pickup3/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/pickup3/src/orxonox/CMakeLists.txt 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/CMakeLists.txt 2009-12-25 22:07:09 UTC (rev 6419)
@@ -46,7 +46,6 @@
ADD_SUBDIRECTORY(interfaces)
ADD_SUBDIRECTORY(items)
ADD_SUBDIRECTORY(overlays)
-ADD_SUBDIRECTORY(pickup)
ADD_SUBDIRECTORY(sound)
ADD_SUBDIRECTORY(weaponsystem)
ADD_SUBDIRECTORY(worldentities)
@@ -57,8 +56,6 @@
LevelManager.h
MoodManager.h
controllers/HumanController.h
- pickup/BaseItem.h
- pickup/PickupInventory.h
sound/SoundManager.h
DEFINE_SYMBOL
"ORXONOX_SHARED_BUILD"
Modified: code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -116,6 +116,8 @@
// interfaces
class GametypeMessageListener;
class NotificationListener;
+ class Pickupable;
+ class PickupCarrier;
class PlayerTrigger;
class RadarListener;
class RadarViewable;
@@ -133,21 +135,6 @@
class OrxonoxOverlay;
class OverlayGroup;
- // pickup
- class BaseItem;
- class DroppedItem;
- class EquipmentItem;
- class ModifierPickup;
- class PassiveItem;
- class PickupCollection;
- class PickupInventory;
- class PickupSpawner;
- class UsableItem;
- // pickup, items
- class HealthImmediate;
- class HealthUsable;
- class Jump;
-
//sound
class AmbientSound;
class BaseSound;
Modified: code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc
===================================================================
--- code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -33,6 +33,8 @@
*/
#include "GametypeMessageListener.h"
+#include "Pickupable.h"
+#include "PickupCarrier.h"
#include "PlayerTrigger.h"
#include "RadarListener.h"
#include "Rewardable.h"
@@ -50,8 +52,38 @@
{
RegisterRootObject(GametypeMessageListener);
}
+
+ //----------------------------
+ // Pickupable
+ //----------------------------
+ Pickupable::Pickupable()
+ {
+ RegisterRootObject(Pickupable);
+ this->used_ = false;
+ this->owner_ = NULL;
+ }
+
//----------------------------
+ // PickupCarrier
+ //----------------------------
+ PickupCarrier::PickupCarrier()
+ {
+ RegisterRootObject(PickupCarrier);
+ }
+
+ //----------------------------
+ // PlayerTrigger
+ //----------------------------
+ PlayerTrigger::PlayerTrigger()
+ {
+ RegisterRootObject(PlayerTrigger);
+
+ this->player_ = NULL;
+ this->isForPlayer_ = true;
+ }
+
+ //----------------------------
// RadarListener
//----------------------------
RadarListener::RadarListener()
@@ -82,15 +114,4 @@
{
RegisterRootObject(NotificationListener);
}
-
- //----------------------------
- // PlayerTrigger
- //----------------------------
- PlayerTrigger::PlayerTrigger()
- {
- RegisterRootObject(PlayerTrigger);
-
- this->player_ = NULL;
- this->isForPlayer_ = true;
- }
}
Copied: code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h (from rev 6405, code/branches/pickup2/src/orxonox/interfaces/PickupCarrier.h)
===================================================================
--- code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h (rev 0)
+++ code/branches/pickup3/src/orxonox/interfaces/PickupCarrier.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -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:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the PickupCarrier class.
+*/
+
+#ifndef _PickupCarrier_H__
+#define _PickupCarrier_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/OrxonoxClass.h"
+
+#include <set>
+
+namespace orxonox
+{
+
+ class _OrxonoxExport PickupCarrier : public OrxonoxClass
+ {
+
+ public:
+ PickupCarrier();
+ virtual ~PickupCarrier();
+
+ private:
+
+ std::set<Pickupable*> pickups_;
+
+ };
+
+}
+
+#endif /* _PickupCarrier_H__ */
Copied: code/branches/pickup3/src/orxonox/interfaces/Pickupable.h (from rev 6405, code/branches/pickup2/src/orxonox/interfaces/Pickupable.h)
===================================================================
--- code/branches/pickup3/src/orxonox/interfaces/Pickupable.h (rev 0)
+++ code/branches/pickup3/src/orxonox/interfaces/Pickupable.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -0,0 +1,197 @@
+/*
+ * 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:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Definition of the Pickupable class.
+*/
+
+#ifndef _Pickupable_H__
+#define _Pickupable_H__
+
+#include "OrxonoxPrereqs.h"
+#include "core/OrxonoxClass.h"
+
+#include "core/Identifier.h"
+#include "core/Super.h"
+#include "interfaces/PickupCarrier.h"
+#include "worldentities/pawns/Pawn.h"
+#include <list>
+
+namespace orxonox
+{
+
+ //! Enum for the activation type.
+ namespace pickupActivationType
+ {
+ enum Value
+ {
+ immediate,
+ onUse,
+ };
+ }
+
+ //! Enum for the duration tyoe.
+ namespace pickupDurationType
+ {
+ enum Value
+ {
+ once,
+ continuous,
+ };
+ }
+
+ /**
+ @brief
+ An Interface (or more precisely an abstract Class) to model and manage different (all kinds of) pickups.
+ @author
+ Damian 'Mozork' Frick
+ */
+ //TODO: Add stuff like weight/space ?
+ class _OrxonoxExport Pickupable : virtual public OrxonoxClass
+ {
+ public:
+ Pickupable(); //!< Default constructor.
+ virtual ~Pickupable() {} //!< Default destructor.
+
+ /**
+ @brief Get the activation type of the pickup.
+ @return Returns the activation type of the pickup.
+ */
+ inline pickupActivationType::Value getActivationType(void)
+ { return this->activationType_; }
+ /**
+ @brief Get the duration type of the pickup.
+ @return Returns the duration type of the pickup.
+ */
+ inline pickupDurationType::Value getDurationType(void)
+ { return this->durationType_; }
+
+ /**
+ @brief Get the owner of the pickup.
+ @return Returns a pointer to the owner of the pickup.
+ */
+ inline PickupCarrier* getOwner(void)
+ { return this->owner_; }
+
+ /**
+ @brief Get whether the pickup is currently in use or not.
+ @return Returns true if the pickup is currently in use.
+ */
+ inline bool isUsed(void)
+ { return this->used_; }
+
+ /**
+ @brief Get whether the given pawn is a target of this pickup.
+ @param pawn The Pawn of which it has to be determinde whether it is a target of this pickup.
+ @return Retruns true if the given Pawn is a target.
+ */
+ //TODO: Determine whether Pawn includes all possible cases and if PickupCarrier wouldn't be better.
+ inline bool isTarget(Pawn* pawn)
+ {
+ Identifier* identifier = pawn->getIdentifier();
+ for(std::list<Identifier*>::iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
+ {
+ if(identifier->isA(*it))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ @brief Should be called when the pickup has transitetd from used to unused or the other way around.
+ Any Class overwriting this method must call its SUPER function by adding SUPER(Classname, changedUsed); to their changeUsed method.
+ */
+ virtual inline void changedUsed(void)
+ {
+ if(this->isUsed())
+ this->used_ = false;
+ else
+ this->used_ = true;
+ }
+
+ /**
+ @brief Sets the pickup to used and makes sure the effects of the pickup take effect at the right places.
+ This method needs to be implemented by any Class inheriting from Pickupable.
+ @return Returns false if for some reason the method could not take effect, e.g. because it is already in use, or some other circumstance.
+ */
+ virtual bool use(void) = 0;
+ /**
+ @brief Sets the pickup to unused and makes sure the effects of the pickup no longer take effect.
+ This method needs to be implemented by any Class inheriting from Pickupable.
+ @return Returns false if for some reason the method could not take effect, e.g. because the pickup is already unused, or some other circumstance.
+ */
+ virtual bool unuse(void) = 0;
+
+ /**
+ @brief Adds the pickup to the input PickupCarrier.
+ This method needs to be implemented by any Class inheriting from Pickupable.
+ @return Returns false if, for some reason, the pickup could not be picked up.
+ */
+ //TODO: Maybe better in PickupCarrier?
+ virtual bool pickup(PickupCarrier* carrier) = 0;
+ /**
+ @brief Drops the pickup. Creates a PickupSpawner at the place the Pickup has been dropped.
+ This method needs to be implemented by any Class inheriting from Pickupable.
+ @return Returns false if the pickup could not be dropped.
+ */
+ //TODO: Probably could be done here?
+ virtual bool drop(void) = 0;
+
+ /**
+ @brief Creates a duplicate of the pickup.
+ This method needs to e implemented by any Class inheriting from Pickupable.
+ @return Returns the clone of this pickup as a pointer to a Pickupable.
+ */
+ //TODO: Would be nicer if standard case was implemented here.
+ virtual Pickupable* clone(void) = 0;
+
+ /**
+ @brief Sets the owner of the pickup.
+ @param owner Sets the input PickupCarrier as the owner of the pickup.
+ */
+ //TODO: Protected? Check for NULL and return true/false?
+ inline void setOwner(PickupCarrier* owner)
+ { this->owner_ = owner; }
+
+ private:
+
+ pickupActivationType::Value activationType_; //!< The activation type of the Pickup.
+ pickupDurationType::Value durationType_; //!< The duration type of the pickup.
+
+ bool used_; //!< Whether the pickup is currently in use or not.
+
+ PickupCarrier* owner_; //!< The owner of the pickup.
+ std::list<Identifier*> targets_; //!< The possible targets of this pickup.
+
+ };
+
+ SUPER_FUNCTION(10, Pickupable, changedUsed, true)
+}
+
+#endif /* _Pickupable_H__ */
Modified: code/branches/pickup3/src/orxonox/items/Engine.cc
===================================================================
--- code/branches/pickup3/src/orxonox/items/Engine.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/items/Engine.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -34,7 +34,8 @@
#include "core/XMLPort.h"
#include "Scene.h"
#include "worldentities/pawns/SpaceShip.h"
-#include "pickup/ModifierType.h"
+//TODO: Remove.
+//#include "pickup/ModifierType.h"
#include "tools/Shader.h"
namespace orxonox
@@ -192,7 +193,8 @@
acceleration.y = direction.y * this->accelerationUpDown_ * clamp((this->maxSpeedUpDown_ - velocity.y) / this->maxSpeedUpDown_, 0.0f, 1.0f);
}
- this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false));
+ //TODO: Remove.
+ //this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false));
if (!this->ship_->getPermanentBoost())
this->ship_->setBoost(false);
Modified: code/branches/pickup3/src/orxonox/pickup/BaseItem.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/BaseItem.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/BaseItem.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -40,8 +40,8 @@
namespace orxonox
{
/**
- @brief Constructor. Registers the BaseItem.
- @param creator Pointer to the object which created this item.
+ @brief Constructor. Registers the BaseItem.
+ @param creator Pointer to the object which created this item.
*/
BaseItem::BaseItem(BaseObject* creator) : BaseObject(creator)
{
@@ -58,9 +58,9 @@
}
/**
- @brief XMLPort for BaseItem.
- @param xmlelement Element of the XML-file.
- @param mode XMLPort mode to use.
+ @brief XMLPort for BaseItem.
+ @param xmlelement Element of the XML-file.
+ @param mode XMLPort mode to use.
*/
void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
@@ -71,15 +71,15 @@
}
/**
- @brief Method to add the item to a pawn.
- @param pawn Pawn to which the item should get added.
- @return Returns whether the pawn's PickupCollection accepted the item.
+ @brief Method to add the item to a pawn.
+ @param pawn Pawn to which the item should get added.
+ @return Returns whether the pawn's PickupCollection accepted the item.
*/
bool BaseItem::addTo(Pawn* pawn)
{
this->setOwner(pawn);
- if (pawn->getPickups().add(this))
+ if (pawn->getPickups().add(this)) //TODO: Does the pawn store his pickups?
{
COUT(3) << "Added '" << this->getPickupIdentifier() << "' item." << std::endl;
return true;
Modified: code/branches/pickup3/src/orxonox/pickup/BaseItem.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/BaseItem.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/BaseItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -43,32 +43,33 @@
namespace orxonox
{
/**
- @brief
- Base class for all items/pickups.
+ @brief
+ Base class for all items/pickups.
- Provides common methods to be used in derived classes.
- @author
- Daniel 'Huty' Haggenmueller
+ Provides common methods to be used in derived classes.
+ @author
+ Daniel 'Huty' Haggenmueller
*/
class _OrxonoxExport BaseItem : public BaseObject
{
// tolua_end
- public:
- BaseItem(BaseObject* creator);
- virtual ~BaseItem();
+ public:
+ BaseItem(BaseObject* creator);
+ virtual ~BaseItem();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort
- /**
+ /**
@brief Checks how many instances of this item can be carried at a time.
@return How many of this item can be carried.
- */
- virtual int getMaxCarryAmount() const
- { return 1; }
+ */
+ virtual int getMaxCarryAmount() const //TODO: Maybe, better to just be virtual.
+ { return BaseItem::MAX_CARRY_AMOUNT; }
- bool addTo(Pawn* pawn); //!< Add the item to a pawn.
- bool removeFrom(Pawn* pawn); //!< Removes the item from a pawn.
- /**
+ //TODO: Need to be public?
+ bool addTo(Pawn* pawn); //!< Add the item to a pawn.
+ bool removeFrom(Pawn* pawn); //!< Removes the item from a pawn.
+ /**
@brief
Method invoked when the item gets picked up.
@@ -77,10 +78,10 @@
@param pawn Pawn who picks up the item.
@return Returns whether the pawn was able to pick up the item.
- */
- virtual bool pickedUp(Pawn* pawn)
- { return false; }
- /**
+ */
+ virtual bool pickedUp(Pawn* pawn) //TODO: Maybe better to be just virtual.
+ { return false; }
+ /**
@brief
Method invoked when the item is dropped from a player.
@@ -89,61 +90,66 @@
@param pawn Pawn which dropped the item.
@return Returns whether the item was able to get dropped by the pawn.
- */
- virtual bool dropped(Pawn* pawn)
- { return false; }
+ */
+ virtual bool dropped(Pawn* pawn)
+ { return false; }
- /**
+ /**
@brief Gets the current owner of the pickup.
@return Returns the current owner.
- */
- inline Pawn* getOwner() const
- { return this->owner_; }
- /**
+ */
+ inline Pawn* getOwner() const
+ { return this->owner_; }
+ /**
@brief Sets the owner of the pickup.
@param owner New owner for the pickup.
- */
- inline void setOwner(Pawn* owner)
- { this->owner_ = owner; }
+ */
+ inline void setOwner(Pawn* owner)
+ { this->owner_ = owner; }
- /**
+ /**
@brief Gets the pickupIdentifier of the item.
@return Returns the pickupIdentifier of the item.
@see pickupIdentifier_
- */
- inline const std::string& getPickupIdentifier() const
- { return this->pickupIdentifier_; }
- /**
+ */
+ inline const std::string& getPickupIdentifier() const
+ { return this->pickupIdentifier_; }
+ /**
@brief Sets the pickupIdentifier for the item.
@param identifier New pickupIdentifier for the item.
@see pickupIdentifier_
- */
- inline void setPickupIdentifier(const std::string& identifier)
- { this->pickupIdentifier_ = identifier; }
+ */
+ //TODO: Needs to be public?
+ inline void setPickupIdentifier(const std::string& identifier)
+ { this->pickupIdentifier_ = identifier; }
- // GUI stuff
- virtual const std::string& getGUIText() const; // tolua_export
- inline void setGUIText(const std::string& text)
- { this->guiText_ = text; }
+ // GUI stuff
+ //TODO: Comment. Maybe seperate GUI from Pickup, e.g. ItemDescription...
+ virtual const std::string& getGUIText() const; // tolua_export
+ inline void setGUIText(const std::string& text)
+ { this->guiText_ = text; }
- virtual const std::string& getGUIImage() const
- { return this->guiImage_; }
- inline void setGUIImage(const std::string& image)
- { this->guiImage_ = image; }
- private:
- Pawn* owner_; //!< The current owner of the item.
+ virtual const std::string& getGUIImage() const
+ { return this->guiImage_; }
+ inline void setGUIImage(const std::string& image)
+ { this->guiImage_ = image; }
+ private:
+ static const int MAX_CARRY_AMOUNT = 1;
- /**
+ Pawn* owner_; //!< The current owner of the item.
+
+ /**
@brief
The pickupIdentifier of the item..
Usually set to the template name used by a PickupSpawner,
used to index items in the PickupCollection.
- */
- std::string pickupIdentifier_;
+ */
+ std::string pickupIdentifier_; //TODO: Remove, when always just this->getName().
- std::string guiText_;
- std::string guiImage_;
+ //TODO: Comment.
+ std::string guiText_;
+ std::string guiImage_;
}; // tolua_export
} // tolua_export
Modified: code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,12 +1,10 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
BaseItem.cc
- DroppedItem.cc
EquipmentItem.cc
ModifierPickup.cc
PassiveItem.cc
PickupCollection.cc
PickupInventory.cc
- PickupSpawner.cc
UsableItem.cc
)
Deleted: code/branches/pickup3/src/orxonox/pickup/DroppedItem.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/DroppedItem.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/DroppedItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,83 +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:
- * Daniel 'Huty' Haggenmueller
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of DroppedItem
-*/
-
-#ifndef _DroppedItem_H__
-#define _DroppedItem_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-#include "worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport DroppedItem : public StaticEntity, public Tickable
- {
- public:
- DroppedItem(BaseObject* creator);
- virtual ~DroppedItem();
-
- void tick(float dt);
- void trigger(Pawn* pawn);
-
- static DroppedItem* createDefaultDrop(BaseItem* item, const Vector3& position, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
- static DroppedItem* createDefaultDrop(BaseItem* item, Pawn* pawn, const ColourValue& flareColour = ColourValue(0.5f, 1.0f, 0.3f), float timeToLive = 0);
-
- void createTimer();
- void timerCallback();
-
- inline float getTriggerDistance() const
- { return this->triggerDistance_; }
- inline void setTriggerDistance(float distance)
- { this->triggerDistance_ = distance; }
-
- inline BaseItem* getItem() const
- { return this->item_; }
- inline void setItem(BaseItem* item)
- { this->item_ = item; }
-
- inline float getTimeToLive() const
- { return this->timeToLive_; }
- inline void setTimeToLive(float time)
- { this->timeToLive_ = time; }
- private:
- float timeToLive_;
- float triggerDistance_;
- BaseItem* item_;
-
- Timer timer_;
- };
-}
-
-#endif /* _DroppedItem_H__ */
Modified: code/branches/pickup3/src/orxonox/pickup/EquipmentItem.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/EquipmentItem.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/EquipmentItem.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -37,8 +37,8 @@
namespace orxonox
{
/**
- @brief Constructor. Registers the EquipmentItem.
- @param creator Pointer to the object which created this item.
+ @brief Constructor. Registers the EquipmentItem.
+ @param creator Pointer to the object which created this item.
*/
EquipmentItem::EquipmentItem(BaseObject* creator) : BaseItem(creator)
{
Modified: code/branches/pickup3/src/orxonox/pickup/EquipmentItem.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/EquipmentItem.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/EquipmentItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -40,14 +40,19 @@
namespace orxonox
{
/**
- @brief Base class for all equipment-type items.
- @author Daniel 'Huty' Haggenmueller
+ @brief Base class for all equipment-type items.
+ @author Daniel 'Huty' Haggenmueller
*/
class _OrxonoxExport EquipmentItem : public BaseItem
{
- public:
- EquipmentItem(BaseObject* creator);
- virtual ~EquipmentItem() {}
+ //TODO: What is this class for?
+ //Probably falls under UsableItem or PassiveItem
+ public:
+ EquipmentItem(BaseObject* creator);
+ virtual ~EquipmentItem() {}
+
+
+
};
}
Modified: code/branches/pickup3/src/orxonox/pickup/ModifierPickup.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/ModifierPickup.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/ModifierPickup.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -42,8 +42,10 @@
CreateFactory(ModifierPickup);
/**
- @brief Constructor. Registers the ModifierPickup.
- @param creator Pointer to the object which created this item.
+ @brief
+ Constructor. Registers the ModifierPickup.
+ @param creator
+ Pointer to the object which created this item.
*/
ModifierPickup::ModifierPickup(BaseObject* creator) : PassiveItem(creator)
{
@@ -51,15 +53,25 @@
this->duration_ = 0.0f;
}
- //! Deconstructor.
+
+ /**
+ @brief
+ Destructor.
+ */
ModifierPickup::~ModifierPickup()
{
+
}
+
/**
- @brief Method for loading information from a level file.
- @param element XMLElement from which to read the data.
- @param mode XMLPort mode to use.
+ @brief
+ Method for loading information from a level file.
+ @param element
+ XMLElement from which to read the data.
+ @param mode
+ XMLPort mode to use.
*/
+ //TODO: Comments: params can probably be ommitted.
void ModifierPickup::XMLPort(Element& element, XMLPort::Mode mode)
{
SUPER(ModifierPickup, XMLPort, element, mode);
@@ -72,15 +84,18 @@
XMLPortParamTemplate(ModifierPickup, "accelerationAdd", setAdditiveAcceleration, getAdditiveAcceleration, element, mode, float);
XMLPortParamTemplate(ModifierPickup, "accelerationMulti", setMultiplicativeAcceleration, getMultiplicativeAcceleration, element, mode, float);
}
+
/**
- @brief
- Invoked when a pawn picks up the pickup.
+ @brief
+ Invoked when a pawn picks up the pickup.
- Adds the modifiers to the pawn and sets a timer (if effect is limited)
- if the pickup could be added to the pawn's PickupCollection.
+ Adds the modifiers to the pawn and sets a timer (if effect is limited)
+ if the pickup could be added to the pawn's PickupCollection.
- @param pawn Pawn which picked up the pickup.
- @return Returns whether the pickup was able to be added to the pawn.
+ @param pawn
+ Pawn which picked up the pickup.
+ @return
+ Returns whether the pickup was able to be added to the pawn.
*/
bool ModifierPickup::pickedUp(Pawn* pawn)
{
@@ -109,15 +124,18 @@
}
return false;
}
+
/**
- @brief
- Invoked when a pawn drops the pickup.
+ @brief
+ Invoked when a pawn drops the pickup.
- Removes the modifiers from the pawn if the pickup
- was successfully removed from it's PickupCollection.
+ Removes the modifiers from the pawn if the pickup
+ was successfully removed from it's PickupCollection.
- @param pawn Pawn which dropped the pickup.
- @return Returns whether the pickup could be removed.
+ @param pawn
+ Pawn which dropped the pickup.
+ @return
+ Returns whether the pickup could be removed.
*/
bool ModifierPickup::dropped(Pawn* pawn)
{
@@ -144,18 +162,24 @@
}
return false;
}
+
/**
- @brief Invoked when the timer finished, calls dropped().
+ @brief Invoked when the timer finished, calls dropped().
*/
+ //TODO: Other name for function?
void ModifierPickup::timerCallback(Pawn* pawn)
{
if (!this->dropped(pawn))
COUT(2) << "Failed to remove modifier pickup after the timer ran out!" << std::endl;
}
+
/**
- @brief Gets the additive modifier of a given type.
- @param type ModifierType for which to return the modifier.
- @return Returns the additive modifier for type (or 0 if not exists).
+ @brief
+ Gets the additive modifier of a given type.
+ @param type
+ ModifierType for which to return the modifier.
+ @return
+ Returns the additive modifier for type (or 0 if not exists).
*/
float ModifierPickup::getAdditiveModifier(ModifierType::Value type) const
{
@@ -165,10 +189,14 @@
else
return 0.0f;
}
+
/**
- @brief Gets the multiplicative modifier of a given type.
- @param type ModifierType for which to return the modifier.
- @return Returns the multiplicative modifier for type (or 1 if not exists).
+ @brief
+ Gets the multiplicative modifier of a given type.
+ @param type
+ ModifierType for which to return the modifier.
+ @return
+ Returns the multiplicative modifier for type (or 1 if not exists).
*/
float ModifierPickup::getMultiplicativeModifier(ModifierType::Value type) const
{
@@ -178,10 +206,14 @@
else
return 1.0f;
}
+
/**
- @brief Gets the additive modifier of a given type.
- @param type ModifierType for which to return the modifier.
- @param value The new additive modifier for type.
+ @brief
+ Gets the additive modifier of a given type.
+ @param type
+ ModifierType for which to return the modifier.
+ @param value
+ The new additive modifier for type.
*/
void ModifierPickup::setAdditiveModifier(ModifierType::Value type, float value)
{
@@ -190,10 +222,14 @@
else
this->additiveModifiers_[type] = value;
}
+
/**
- @brief Gets the multiplicative modifier of a given type.
- @param type ModifierType for which to return the modifier.
- @param value The new multiplicative modifier for type.
+ @brief
+ Gets the multiplicative modifier of a given type.
+ @param type
+ ModifierType for which to return the modifier.
+ @param value
+ The new multiplicative modifier for type.
*/
void ModifierPickup::setMultiplicativeModifier(ModifierType::Value type, float value)
{
@@ -202,4 +238,5 @@
else
this->multiplicativeModifiers_[type] = value;
}
+
}
Modified: code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -46,100 +46,113 @@
namespace orxonox
{
/**
- @brief Class for a (temporary) modifier effect.
- @author Daniel 'Huty' Haggenmueller
+ @brief Class for a (temporary) modifier effect.
+ @author Daniel 'Huty' Haggenmueller
*/
+ //TODO: More elaborate comments.
class _OrxonoxExport ModifierPickup : public PassiveItem
{
- public:
- ModifierPickup(BaseObject* creator);
- virtual ~ModifierPickup();
+ //TODO: What does being derived from PassiveItem add exactly? Probably better to kill PassiveItem and just derive from BaseItem.
+ //Include ModifierType here, no additional header file needed for that, imo.
+ public:
+ ModifierPickup(BaseObject* creator);
+ virtual ~ModifierPickup();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file.
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file.
- virtual bool pickedUp(Pawn* pawn); //!< Override of the BaseItem::pickedUp() method.
- virtual bool dropped(Pawn* pawn); //!< Override of the BaseItem::dropped() method
+ virtual bool pickedUp(Pawn* pawn); //!< Override of the BaseItem::pickedUp() method.
+ virtual bool dropped(Pawn* pawn); //!< Override of the BaseItem::dropped() method
- virtual int getMaxCarryAmount(){ return INT_MAX; } //!< Allow the player to carry infinite ModPickups
+ //TODO: Where does this INT_MAX come from? Comment.
+ virtual int getMaxCarryAmount() //!< Allow the player to carry infinite ModPickups
+ { return INT_MAX; }
- /**
+ /**
@brief Get the duration of this pickup.
@return Returns how long the effect holds on.
- */
- inline float getDuration() const
- { return this->duration_; }
- /**
+ */
+ inline float getDuration() const
+ { return this->duration_; }
+ /**
@brief Set the duration of this pickup.
@param duration How long the effect should hold.
- */
- inline void setDuration(float duration)
- { this->duration_ = duration; }
+ */
+ //TODO: Better be private?
+ inline void setDuration(float duration)
+ { this->duration_ = duration; }
- /**
+ //TODO: Shouldn't these all be seperate pickup items? But, then, would this class really be needed? What does it actually add?
+ //Duration! Thus create two virtual functions addEffect() and removeEffect().
+ //Export the ideas here into seperate, individual subclasses.
+ //Shouldn't this, as an item be in the items folder? or is it, as merely the equivalent of an abstract class not specific enough?
+ //Specify what ModifierItem should do exactly. If the limited duration is the core functionality, another name would probably more fitting.
+ //Perhaps, limited effect duration could also just be another feature of BaseItem...
+ /**
@brief Get the amount of damage this pickup adds.
@return Returns how much damage this pickup adds.
- */
- inline float getAdditiveDamage() const
- { return this->getAdditiveModifier(ModifierType::Damage); }
- /**
+ */
+ inline float getAdditiveDamage() const
+ { return this->getAdditiveModifier(ModifierType::Damage); }
+ /**
@brief Get the factor by which this pickup multiplies the damage.
@return Returns the factor by which to multiply damage.
- */
- inline float getMultiplicativeDamage() const
- { return this->getMultiplicativeModifier(ModifierType::Damage); }
+ */
+ inline float getMultiplicativeDamage() const
+ { return this->getMultiplicativeModifier(ModifierType::Damage); }
- /**
+ /**
@brief Set the amount of damage this pickup adds.
@param value How much damage this pickup adds.
- */
- inline void setAdditiveDamage(float value)
- { this->setAdditiveModifier(ModifierType::Damage, value); }
- /**
+ */
+ inline void setAdditiveDamage(float value)
+ { this->setAdditiveModifier(ModifierType::Damage, value); }
+ /**
@brief Set the factor by which this pickup multiplies the damage.
@param value Factor by which to multiply damage.
- */
- inline void setMultiplicativeDamage(float value)
- { this->setMultiplicativeModifier(ModifierType::Damage, value); }
+ */
+ inline void setMultiplicativeDamage(float value)
+ { this->setMultiplicativeModifier(ModifierType::Damage, value); }
- /**
+ /**
@brief Get the amount of acceleration this pickup adds.
@return Returns how much acceleration this pickup adds.
- */
- inline float getAdditiveAcceleration() const
- { return this->getAdditiveModifier(ModifierType::Acceleration); }
- /**
+ */
+ inline float getAdditiveAcceleration() const
+ { return this->getAdditiveModifier(ModifierType::Acceleration); }
+ /**
@brief Get the factor by which this pickup multiplies the acceleration.
@return Returns the factor by which to multiply acceleration.
- */
- inline float getMultiplicativeAcceleration() const
- { return this->getMultiplicativeModifier(ModifierType::Acceleration); }
+ */
+ inline float getMultiplicativeAcceleration() const
+ { return this->getMultiplicativeModifier(ModifierType::Acceleration); }
- /**
+ /**
@brief Set the amount of acceleration this pickup adds.
@param value How much acceleration this pickup adds.
- */
- inline void setAdditiveAcceleration(float value)
- { this->setAdditiveModifier(ModifierType::Acceleration, value); }
- /**
+ */
+ inline void setAdditiveAcceleration(float value)
+ { this->setAdditiveModifier(ModifierType::Acceleration, value); }
+ /**
@brief Set the factor by which this pickup multiplies the acceleration.
@param value Factor by which to multiply acceleration.
- */
- inline void setMultiplicativeAcceleration(float value)
- { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }
+ */
+ inline void setMultiplicativeAcceleration(float value)
+ { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }
- void timerCallback(Pawn* pawn); //!< Method called when the timer runs out.
+ //TODO: Make private?
+ void timerCallback(Pawn* pawn); //!< Method called when the timer runs out.
- private:
- float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType.
- float getMultiplicativeModifier(ModifierType::Value type) const; //!< Get the multiplicative modifier for a given ModifierType.
- void setAdditiveModifier(ModifierType::Value type, float value); //!< Set the additive modifier for a given ModifierType.
- void setMultiplicativeModifier(ModifierType::Value type, float value); //!< Set the multiplicative modifier for a given ModifierType
+ private:
+ float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType.
+ float getMultiplicativeModifier(ModifierType::Value type) const; //!< Get the multiplicative modifier for a given ModifierType.
+ void setAdditiveModifier(ModifierType::Value type, float value); //!< Set the additive modifier for a given ModifierType.
+ void setMultiplicativeModifier(ModifierType::Value type, float value); //!< Set the multiplicative modifier for a given ModifierType
- std::map<ModifierType::Value, float> additiveModifiers_; //!< Map of additive modifiers, indexed by ModifierType.
- std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType.
+ std::map<ModifierType::Value, float> additiveModifiers_; //!< Map of additive modifiers, indexed by ModifierType.
+ std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType.
- float duration_; //!< Duration of this pickup's effect (0 for unlimited).
- Timer timer_; //!< Timer used if the pickup's effect has a time limit.
+ float duration_; //!< Duration of this pickup's effect (0 for unlimited).
+ Timer timer_; //!< Timer used if the pickup's effect has a time limit.
};
}
Modified: code/branches/pickup3/src/orxonox/pickup/ModifierType.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/ModifierType.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/ModifierType.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -38,6 +38,7 @@
namespace orxonox
{
+ //TODO: Merge with ModifierPickup.
namespace ModifierType
{
/**
Modified: code/branches/pickup3/src/orxonox/pickup/PassiveItem.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PassiveItem.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PassiveItem.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -32,8 +32,8 @@
namespace orxonox
{
/**
- @brief Constructor. Registers the PassiveItem.
- @param creator Pointer to the object which created this item.
+ @brief Constructor. Registers the PassiveItem.
+ @param creator Pointer to the object which created this item.
*/
PassiveItem::PassiveItem(BaseObject* creator) : BaseItem(creator)
{
Modified: code/branches/pickup3/src/orxonox/pickup/PassiveItem.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PassiveItem.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PassiveItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -40,14 +40,17 @@
namespace orxonox
{
/**
- @brief Base class for all passive items.
- @author Daniel 'Huty' Haggenmueller
+ @brief Base class for all passive items.
+ @author Daniel 'Huty' Haggenmueller
*/
class _OrxonoxExport PassiveItem : public BaseItem
{
- public:
- PassiveItem(BaseObject* creator);
- virtual ~PassiveItem() {}
+ //TODO: What is this Class for. Where is ActiveItem?
+ //Rename it InstantItem?
+ public:
+ PassiveItem(BaseObject* creator);
+ virtual ~PassiveItem() {}
+
};
}
Modified: code/branches/pickup3/src/orxonox/pickup/PickupCollection.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupCollection.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PickupCollection.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -51,13 +51,15 @@
}
/**
- @brief
- Add an item to the collection.
+ @brief
+ Add an item to the collection.
- Only adds the item if there's a free slot for it.
+ Only adds the item if there's a free slot for it.
- @param item Item to add to the collection.
- @return Returns whether the item has been added to the collection.
+ @param item
+ Item to add to the collection.
+ @return
+ Returns whether the item has been added to the collection.
*/
bool PickupCollection::add(BaseItem* item)
{
Modified: code/branches/pickup3/src/orxonox/pickup/PickupCollection.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupCollection.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PickupCollection.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -46,76 +46,55 @@
namespace orxonox
{
/**
- @brief PickupCollection for organising items.
- @author Daniel 'Huty' Haggenmueller
+ @brief PickupCollection for organising items.
+ @author Daniel 'Huty' Haggenmueller
*/
- class _OrxonoxExport PickupCollection
+ class _OrxonoxExport PickupCollection : public orxonox::OrxonoxClass
{
- public:
- PickupCollection();
+ public:
+ PickupCollection();
- bool add(BaseItem* item); //!< Add an item to the collection.
+ bool add(BaseItem* item); //!< Add an item to the collection.
- bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
+ bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.
- void clear(); //!< Empty the collection
- bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item.
+ void clear(); //!< Empty the collection
+ bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item.
- void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection.
+ void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection.
- void useItem(); //!< Use the first usable item.
- void useItem(UsableItem* item); //!< Use a usable item.
+ //TODO: Hmm... probably should stay...
+ void useItem(); //!< Use the first usable item.
+ void useItem(UsableItem* item); //!< Use a usable item.
- void addAdditiveModifier(ModifierType::Value type, float value); //!< Add an additive modifier.
- void addMultiplicativeModifier(ModifierType::Value type, float value); //!< Add a multiplicative modifier.
+ /**
+ @brief Get the owner of the PickupCollection.
+ @return Returns the pawn which owns the PickupCollection.
+ */
+ inline Pawn* getOwner() const
+ { return this->owner_; }
+ /**
+ @brief Set the owner of the PickupCollection.
+ @param owner The new Pawn which owns the PickupCollection.
+ */
+ inline void setOwner(Pawn* owner)
+ { this->owner_ = owner; }
- float getAdditiveModifier(ModifierType::Value type); //!< Get total additive modifier.
- float getMultiplicativeModifier(ModifierType::Value type); //!< Get total multiplicative modifier.
+ inline UsableItem* getCurrentUsable()
+ { return this->currentUsable_; };
+ inline void setCurrentUsable(UsableItem* usable)
+ { this->currentUsable_ = usable; }
- void removeAdditiveModifier(ModifierType::Value type, float value); //!< Remove an additive modifier.
- void removeMultiplicativeModifier(ModifierType::Value type, float value); //!< Remove a multiplicative modifier.
+ std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items.
+ std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items.
+ std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items.
- float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false); //!< Apply the modifiers to a float.
- Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false); //!< Apply the modifiers to a Vector3.
+ private:
+ Pawn* owner_; //!< The owner of the PickupCollection.
+ UsableItem* currentUsable_;
+ int slots_;
- /**
- @brief Get the map of contained items.
- @return The map of items.
- */
- std::multimap<std::string, BaseItem*> getItems() const
- { return this->items_; }
-
- /**
- @brief Get the owner of the PickupCollection.
- @return Returns the pawn which owns the PickupCollection.
- */
- inline Pawn* getOwner() const
- { return this->owner_; }
- /**
- @brief Set the owner of the PickupCollection.
- @param owner The new Pawn which owns the PickupCollection.
- */
- inline void setOwner(Pawn* owner)
- { this->owner_ = owner; }
-
- inline UsableItem* getCurrentUsable()
- { return this->currentUsable_; };
- inline void setCurrentUsable(UsableItem* usable)
- { this->currentUsable_ = usable; }
-
- std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items.
- std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items.
- std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items.
- private:
- Pawn* owner_; //!< The owner of the PickupCollection.
- UsableItem* currentUsable_;
-
- bool bBlockRemovals_; //!< Whether to block direct removals through remove().
-
- std::multimap<ModifierType::Value, float> additiveModifiers_; //!< Contains additive modifiers (indexed by ModifierType).
- std::multimap<ModifierType::Value, float> multiplicativeModifiers_; //!< Contains multiplicative modifiers (indexed by ModifierType).
-
- std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items).
+ std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items).
};
}
Modified: code/branches/pickup3/src/orxonox/pickup/PickupInventory.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupInventory.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PickupInventory.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -51,6 +51,16 @@
SetConsoleCommandShortcut(PickupInventory, toggleInventory);
PickupInventory* PickupInventory::pickupInventory_s = NULL;
+
+ //TODO: Comment.
+
+ /**
+ @brief
+ Get a Pointer to the PickupInventory Singleton.
+ @return
+ A Pointer to the PickupInventory.
+ */
+ //TODO: Make SingeltonPtr?
PickupInventory* PickupInventory::getSingleton()
{
if(!PickupInventory::pickupInventory_s)
@@ -59,10 +69,16 @@
return PickupInventory::pickupInventory_s;
}
+ /**
+ @brief
+ Constructor.
+ */
PickupInventory::PickupInventory()
{
- this->bInventoryVisible_ = false;
- this->visibleEquipmentWindows_ = this->visibleUsableWIndows_ = 0;
+ //TODO: Maybe some abstraction for the usableWindows, e.g. push and pop...
+ //RegisterObject() ? In some other Class, too. Which?
+ this->bInventoryVisible_ = false; //TODO: If OrxonoxClass, this should already be there...
+ this->visibleEquipmentWindows_ = this->visibleUsableWindows_ = 0;
// Create some windows to avoid creating them while playing
CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
@@ -76,13 +92,21 @@
}
this->createdEquipmentWindows_ = this->createdUsableWindows_ = 10;
}
+
+ /**
+ @brief
+ Destructor.
+ */
+ //TODO: Destroy something?
PickupInventory::~PickupInventory()
{
}
-
-
- void PickupInventory::toggleInventory()
+ /**
+ @brief
+ Toggles the visibility of the inventory.
+ */
+ /*static*/ void PickupInventory::toggleInventory()
{
if(PickupInventory::getSingleton()->isVisible()) {
GUIManager::hideGUI("PickupInventory");
@@ -94,6 +118,10 @@
PickupInventory::getSingleton()->setVisible(!PickupInventory::getSingleton()->isVisible());
}
+ /**
+ @brief
+
+ */
unsigned int PickupInventory::getCurrentUsableIndex()
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -110,6 +138,7 @@
return 0;
}
+
bool PickupInventory::isCurrentUsable(const BaseItem* item)
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -118,6 +147,7 @@
else
return false;
}
+
void PickupInventory::selectUsable(unsigned int i)
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -137,6 +167,7 @@
else
return 0;
}
+
unsigned int PickupInventory::getUsableCount()
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -145,6 +176,7 @@
else
return 0;
}
+
unsigned int PickupInventory::getPassiveCount()
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -153,6 +185,7 @@
else
return 0;
}
+
BaseItem* PickupInventory::getEquipmentItem(unsigned int i)
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -165,6 +198,7 @@
else
return NULL;
}
+
BaseItem* PickupInventory::getUsableItem(unsigned int i)
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -177,6 +211,7 @@
else
return NULL;
}
+
BaseItem* PickupInventory::getPassiveItem(unsigned int i)
{
Pawn* pawn = HumanController::getLocalControllerEntityAsPawn();
@@ -220,7 +255,7 @@
equipPane->removeChildWindow("orxonox/Inventory/Title/equ/" + id.str());
equipPane->removeChildWindow("orxonox/Inventory/Items/equ/" + id.str());*/
}
- for(unsigned int i = 0; i < this->visibleUsableWIndows_; i++)
+ for(unsigned int i = 0; i < this->visibleUsableWindows_; i++)
{
std::ostringstream id;
id << i;
@@ -234,6 +269,7 @@
usablePane->removeChildWindow("orxonox/Inventory/Items/use/" + id.str());*/
}
}
+
void PickupInventory::updateTabs(CEGUI::WindowManager *winMgr, CEGUI::Window *equipWindow, CEGUI::Window *usableWindow)
{
this->updateEquipment(winMgr, equipWindow);
@@ -264,6 +300,7 @@
this->visibleEquipmentWindows_ = items.size();
}
}
+
void PickupInventory::updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target)
{
Pawn* pawn;
@@ -291,7 +328,7 @@
PickupInventory::setWindowProperties(winMgr, target, id.str(), item, colour);
}
- this->visibleUsableWIndows_ = items.size();
+ this->visibleUsableWindows_ = items.size();
}
}
@@ -321,6 +358,7 @@
btn->subscribeScriptedEvent("Clicked", "PickupInventory.itemClicked");
btn->setVisible(false);
}
+
void PickupInventory::setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour)
{
CEGUI::Window* txt = winMgr->getWindow("orxonox/Inventory/Title/" + id);
@@ -345,4 +383,5 @@
target->addChildWindow(txt);
target->addChildWindow(btn);
}
+
}
Modified: code/branches/pickup3/src/orxonox/pickup/PickupInventory.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupInventory.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PickupInventory.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -43,55 +43,57 @@
namespace orxonox
{
/**
- @brief Static class for the inventory GUI window.
- @author Daniel 'Huty' Haggenmueller
+ @brief Static class for the inventory GUI window.
+ @author Daniel 'Huty' Haggenmueller
*/
class _OrxonoxExport PickupInventory
{
// tolua_end
- public:
- PickupInventory();
- virtual ~PickupInventory();
+ public:
+ //TODO: Be derived from OrxonoxClass and ScopedSingleton.
+ //Make some methods private?
+ PickupInventory();
+ virtual ~PickupInventory();
- static PickupInventory* getSingleton(); // tolua_export
+ static PickupInventory* getSingleton(); // tolua_export
- static void toggleInventory(); // tolua_export
+ static void toggleInventory(); // tolua_export
- static unsigned int getEquipmentCount(); // tolua_export
- static unsigned int getUsableCount(); // tolua_export
- static unsigned int getPassiveCount(); // tolua_export
+ static unsigned int getEquipmentCount(); // tolua_export
+ static unsigned int getUsableCount(); // tolua_export
+ static unsigned int getPassiveCount(); // tolua_export
- static unsigned int getCurrentUsableIndex(); // tolua_export
- static bool isCurrentUsable(const BaseItem* item); // tolua_export
- static void selectUsable(unsigned int i); // tolua_export
+ static unsigned int getCurrentUsableIndex(); // tolua_export
+ static bool isCurrentUsable(const BaseItem* item); // tolua_export
+ static void selectUsable(unsigned int i); // tolua_export
- static BaseItem* getEquipmentItem(unsigned int i); // tolua_export
- static BaseItem* getUsableItem(unsigned int i); // tolua_export
- static BaseItem* getPassiveItem(unsigned int i); // tolua_export
+ static BaseItem* getEquipmentItem(unsigned int i); // tolua_export
+ static BaseItem* getUsableItem(unsigned int i); // tolua_export
+ static BaseItem* getPassiveItem(unsigned int i); // tolua_export
- static std::string getImageForItem(const BaseItem* item); // tolua_export
+ static std::string getImageForItem(const BaseItem* item); // tolua_export
- void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export
- void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export
+ void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export
+ void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export
- void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
- void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
+ void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
+ void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);
- static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);
- static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);
+ static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);
+ static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);
- const bool isVisible() const
- { return this->bInventoryVisible_; }
- void setVisible(bool visible)
- { this->bInventoryVisible_ = visible; }
- private:
- bool bInventoryVisible_;
- unsigned int createdEquipmentWindows_;
- unsigned int createdUsableWindows_;
- unsigned int visibleEquipmentWindows_;
- unsigned int visibleUsableWIndows_;
+ const bool isVisible() const
+ { return this->bInventoryVisible_; }
+ void setVisible(bool visible)
+ { this->bInventoryVisible_ = visible; }
+ private:
+ bool bInventoryVisible_;
+ unsigned int createdEquipmentWindows_;
+ unsigned int createdUsableWindows_;
+ unsigned int visibleEquipmentWindows_;
+ unsigned int visibleUsableWindows_;
- static PickupInventory* pickupInventory_s;
+ static PickupInventory* pickupInventory_s;
}; // tolua_export
} // tolua_export
Deleted: code/branches/pickup3/src/orxonox/pickup/PickupSpawner.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/PickupSpawner.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/PickupSpawner.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -1,120 +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:
- * Daniel 'Huty' Haggenmueller
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Definition of PickupSpawner.
-*/
-
-#ifndef _PickupSpawner_H__
-#define _PickupSpawner_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-#include "worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- /**
- @brief PickupSpawner.
- @author Daniel 'Huty' Haggenmueller
- */
- class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
- {
- public:
- PickupSpawner(BaseObject* creator);
- virtual ~PickupSpawner();
-
- virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty).
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML.
- virtual void tick(float dt);
-
- void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough.
- void respawnTimerCallback(); //!< Method called when the timer runs out.
-
- /**
- @brief Get the template name for the item to spawn.
- @return Returns the name of the template of the item to spawn.
- */
- inline const std::string& getItemTemplateName() const
- { return this->itemTemplateName_; }
- void setItemTemplateName(const std::string& name); //!< Set the template name of the item to spawn.
-
- /**
- @brief Get the template for the item to spawn.
- @return Returns the template of the item to spawn.
- */
- inline Template* getItemTemplate() const
- { return this->itemTemplate_; }
-
- /**
- @brief Get the distance in which to trigger.
- @return Returns the distance in which this gets triggered.
- */
- inline float getTriggerDistance() const
- { return this->triggerDistance_; }
- /**
- @brief Set the distance in which to trigger.
- @param value The new distance in which to trigger.
- */
- inline void setTriggerDistance(float value)
- { this->triggerDistance_ = value; }
-
- /**
- @brief Get the time to respawn.
- @returns Returns the time after which this gets re-actived.
- */
- inline float getRespawnTime() const
- { return this->respawnTime_; }
- /**
- @brief Set the time to respawn.
- @param time New time after which this gets re-actived.
- */
- inline void setRespawnTime(float time)
- { this->respawnTime_ = time; }
- private:
- std::string itemTemplateName_; //!< Template name of the item to spawn.
- Template* itemTemplate_; //!< Template of the item to spawn.
-
- float triggerDistance_; //!< Distance in which this gets triggered.
-
- /* Pickup animation */
- float tickSum_; //!< Adds up tick to use in sine movement
- static const float bounceSpeed_s; //!< Speed of pickup to bounce up and down
- static const float bounceDistance_s; //!< Distance the pickup bounces up and down
- static const float rotationSpeed_s; //!< Rotation speed of pickup
-
- float respawnTime_; //!< Time after which this gets re-actived.
- Timer respawnTimer_; //!< Timer used for re-activating.
- };
-}
-
-#endif /* _PickupSpawner_H__ */
Modified: code/branches/pickup3/src/orxonox/pickup/UsableItem.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/UsableItem.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/UsableItem.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -37,8 +37,8 @@
namespace orxonox
{
/**
- @brief Constructor. Registers the UsableItem.
- @param creator Pointer to the object which created this item.
+ @brief Constructor. Registers the UsableItem.
+ @param creator Pointer to the object which created this item.
*/
UsableItem::UsableItem(BaseObject* creator) : BaseItem(creator)
{
Modified: code/branches/pickup3/src/orxonox/pickup/UsableItem.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/UsableItem.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/UsableItem.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -45,15 +45,16 @@
*/
class _OrxonoxExport UsableItem : public BaseItem
{
- public:
- UsableItem(BaseObject* creator);
- virtual ~UsableItem() { }
+ //TODO: What is this exactly?
+ public:
+ UsableItem(BaseObject* creator);
+ virtual ~UsableItem() { }
- /**
- @brief Method invoked when the item is being used.
- @param pawn Pawn which is using the item.
- */
- virtual void used(Pawn* pawn) { }
+ /**
+ @brief Method invoked when the item is being used.
+ @param pawn Pawn which is using the item.
+ */
+ virtual void used(Pawn* pawn) { }
};
}
Modified: code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -58,6 +58,7 @@
XMLPortParam(HealthImmediate, "recoveredHealth", setRecoveredHealth, getRecoveredHealth, xmlelement, mode);
}
+ //TODO: Should be destroyed anyways...
bool HealthImmediate::pickedUp(Pawn* pawn)
{
float maxH = pawn->getMaxHealth();
Modified: code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -44,21 +44,23 @@
*/
class _OrxonoxExport HealthImmediate : public PassiveItem
{
- public:
- HealthImmediate(BaseObject* creator);
- virtual ~HealthImmediate();
+ //TODO: Comment.
+ //Does this get destroyed, when the healt is delivered? It seems to me it doesn't.
+ public:
+ HealthImmediate(BaseObject* creator);
+ virtual ~HealthImmediate();
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual bool pickedUp(Pawn* pawn);
+ virtual bool pickedUp(Pawn* pawn);
- inline float getRecoveredHealth() const
- { return this->recoveredHealth_; }
- inline void setRecoveredHealth(float recovery)
- { this->recoveredHealth_ = recovery; }
+ inline float getRecoveredHealth() const
+ { return this->recoveredHealth_; }
+ inline void setRecoveredHealth(float recovery)
+ { this->recoveredHealth_ = recovery; }
- private:
- float recoveredHealth_;
+ private:
+ float recoveredHealth_;
};
}
Modified: code/branches/pickup3/src/orxonox/pickup/items/HealthUsable.cc
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/items/HealthUsable.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/items/HealthUsable.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -44,8 +44,8 @@
CreateFactory(HealthUsable);
/**
- @brief Constructor
- @param creator Object that created this item.
+ @brief Constructor
+ @param creator Object that created this item.
*/
HealthUsable::HealthUsable(BaseObject* creator) : UsableItem(creator)
{
@@ -53,14 +53,16 @@
this->recoveredHealth_ = 0;
}
+
//! Deconstructor
HealthUsable::~HealthUsable()
{
}
+
/**
- @brief XMLPort for Jump.
- @param xmlelement Element of the XML-file.
- @param mode XMLPort mode to use.
+ @brief XMLPort for Jump.
+ @param xmlelement Element of the XML-file.
+ @param mode XMLPort mode to use.
*/
void HealthUsable::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
@@ -68,10 +70,13 @@
XMLPortParam(HealthUsable, "recoveredHealth", setRecoveredHealth, getRecoveredHealth, xmlelement, mode);
}
+
/**
- @brief Called when the item is used, makes the user "jump".
- @param pawn Pawn which used te item.
+ @brief Called when the item is used, makes the user "jump".
+ @param pawn Pawn which used te item.
*/
+ //TODO: Jump? Nope! => Comment.
+ //Should be destroyed anyways.
void HealthUsable::used(Pawn* pawn)
{
float maxH = pawn->getMaxHealth();
@@ -84,17 +89,19 @@
this->destroy();
}
}
+
/**
- @brief Called when the item is picked up.
- @param pawn Pawn which picked up the item.
+ @brief Called when the item is picked up.
+ @param pawn Pawn which picked up the item.
*/
bool HealthUsable::pickedUp(Pawn* pawn)
{
return this->addTo(pawn);
}
+
/**
- @brief Called when the item is dropped, creates a DroppedItem behind the pawn.
- @param pawn Pawn which dropped the item.
+ @brief Called when the item is dropped, creates a DroppedItem behind the pawn.
+ @param pawn Pawn which dropped the item.
*/
bool HealthUsable::dropped(Pawn* pawn)
{
Modified: code/branches/pickup3/src/orxonox/pickup/items/Jump.h
===================================================================
--- code/branches/pickup3/src/orxonox/pickup/items/Jump.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/pickup/items/Jump.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -49,47 +49,48 @@
*/
class _OrxonoxExport Jump : public UsableItem
{
- public:
- Jump(BaseObject* creator); //!< Constructor
- virtual ~Jump(); //!< Deconstructor
+ public:
+ //TODO: Comment. a.s.o.
+ Jump(BaseObject* creator); //!< Constructor
+ virtual ~Jump(); //!< Deconstructor
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort
- virtual int getMaxCarryAmount() const
- { return INT_MAX; }
+ virtual int getMaxCarryAmount() const
+ { return INT_MAX; }
- virtual void used(Pawn* pawn); //!< Called when the item is used.
+ virtual void used(Pawn* pawn); //!< Called when the item is used.
- virtual bool pickedUp(Pawn* pawn); //!< Called when the item is picked up.
- virtual bool dropped(Pawn* pawn); //!< Called when the item is dropped.
+ virtual bool pickedUp(Pawn* pawn); //!< Called when the item is picked up.
+ virtual bool dropped(Pawn* pawn); //!< Called when the item is dropped.
- /**
- @brief Get the velocity added when the item is used.
- @return Returns the added velocity (relative to the Pawn).
- */
- inline const Vector3& getVelocity() const
- { return this->velocity_; }
- /**
- @brief Set the velocity added when the item is used.
- @param velocity New added velocity (relative to Pawn).
- */
- inline void setVelocity(const Vector3& velocity)
- { this->velocity_ = velocity; }
- /**
- @brief Get the amount of jumps available.
- @return Returns how many times the item can be used.
- */
- inline int getJumpsAvailable() const
- { return this->jumpsAvailable_; }
- /**
- @brief Set the amount of jumps available.
- @param num New number of available jumps.
- */
- inline void setJumpsAvailable(int num)
- { this->jumpsAvailable_ = num; }
- private:
- Vector3 velocity_; //!< The velocity added when the item is used.
- int jumpsAvailable_; //!< Amount of jumps still available.
+ /**
+ @brief Get the velocity added when the item is used.
+ @return Returns the added velocity (relative to the Pawn).
+ */
+ inline const Vector3& getVelocity() const
+ { return this->velocity_; }
+ /**
+ @brief Set the velocity added when the item is used.
+ @param velocity New added velocity (relative to Pawn).
+ */
+ inline void setVelocity(const Vector3& velocity)
+ { this->velocity_ = velocity; }
+ /**
+ @brief Get the amount of jumps available.
+ @return Returns how many times the item can be used.
+ */
+ inline int getJumpsAvailable() const
+ { return this->jumpsAvailable_; }
+ /**
+ @brief Set the amount of jumps available.
+ @param num New number of available jumps.
+ */
+ inline void setJumpsAvailable(int num)
+ { this->jumpsAvailable_ = num; }
+ private:
+ Vector3 velocity_; //!< The velocity added when the item is used.
+ int jumpsAvailable_; //!< Amount of jumps still available.
};
}
Modified: code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.cc 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.cc 2009-12-25 22:07:09 UTC (rev 6419)
@@ -70,7 +70,8 @@
this->aimPosition_ = Vector3::ZERO;
- this->getPickups().setOwner(this);
+ //TODO: Remove.
+ //this->getPickups().setOwner(this);
if (GameMode::isMaster())
{
@@ -295,10 +296,11 @@
this->spawneffect();
}
- void Pawn::dropItems()
- {
- this->getPickups().clear();
- }
+//TODO: Remove.
+// void Pawn::dropItems()
+// {
+// this->getPickups().clear();
+// }
/* WeaponSystem:
Modified: code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h 2009-12-25 21:48:10 UTC (rev 6418)
+++ code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h 2009-12-25 22:07:09 UTC (rev 6419)
@@ -34,7 +34,8 @@
#include <string>
#include "interfaces/RadarViewable.h"
#include "worldentities/ControllableEntity.h"
-#include "pickup/PickupCollection.h"
+//TODO: Remove.
+//#include "pickup/PickupCollection.h"
namespace orxonox
{
@@ -108,11 +109,12 @@
inline unsigned int getExplosionChunks() const
{ return this->numexplosionchunks_; }
- virtual void dropItems();
- inline PickupCollection& getPickups()
- { return this->pickups_; }
- virtual void useItem()
- { this->pickups_.useItem(); }
+//TODO: Remove.
+// virtual void dropItems();
+// inline PickupCollection& getPickups()
+// { return this->pickups_; }
+// virtual void useItem()
+// { this->pickups_.useItem(); }
virtual void startLocalHumanControl();
@@ -134,7 +136,8 @@
bool bAlive_;
- PickupCollection pickups_;
+ //TODO: Remove.
+ //PickupCollection pickups_;
float health_;
float maxHealth_;
More information about the Orxonox-commit
mailing list