Changeset 6540 for code/trunk/src/modules
- Timestamp:
- Mar 16, 2010, 9:35:11 PM (15 years ago)
- Location:
- code/trunk/src/modules
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pickup/DroppedPickup.cc
r6524 r6540 28 28 29 29 /** 30 @file 30 @file DroppedPickup.cc 31 31 @brief Implementation of the DroppedPickup class. 32 32 */ … … 36 36 #include "core/CoreIncludes.h" 37 37 #include "interfaces/Pickupable.h" 38 #include "interfaces/PickupCarrier.h" 38 39 #include "graphics/Model.h" 39 40 … … 65 66 The distance at which the PickupSpawner triggers. Default is 10. 66 67 */ 67 DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 10, 1)68 DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 5, 1) 68 69 { 69 70 RegisterObject(DroppedPickup); 70 71 71 this->setPosition( position);72 this->setPosition(carrier->getCarrierPosition()); 72 73 this->setActive(false); 74 75 //TODO: Do more elegantly. 73 76 this->startRespawnTimer(); 74 77 } -
code/trunk/src/modules/pickup/DroppedPickup.h
r6524 r6540 28 28 29 29 /** 30 @file 30 @file DroppedPickup.h 31 31 @brief Definition of the DroppedPickup class. 32 32 */ … … 53 53 public: 54 54 DroppedPickup(BaseObject* creator); //!< Default constructor. 55 DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position, float triggerDistance = 10.0); //!< Constructor.55 DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0); //!< Constructor. 56 56 virtual ~DroppedPickup(); //!< Destructor. 57 57 -
code/trunk/src/modules/pickup/Pickup.cc
r6533 r6540 27 27 */ 28 28 29 /** 30 @file Pickup.cc 31 @brief Implementation of the Pickup class. 32 */ 33 29 34 #include "Pickup.h" 30 35 … … 41 46 /*static*/ const std::string Pickup::durationTypeOnce_s = "once"; 42 47 /*static*/ const std::string Pickup::durationTypeContinuous_s = "continuous"; 43 44 //TODO: Should this be here? Does it work without?45 CreateFactory(Pickup);46 48 47 49 Pickup::Pickup(BaseObject* creator) : BaseObject(creator) … … 224 226 Returns true if a spawner was created, false if not. 225 227 */ 226 bool Pickup::createSpawner( const Vector3& position)227 { 228 new DroppedPickup(this, this, position);228 bool Pickup::createSpawner(void) 229 { 230 new DroppedPickup(this, this, this->getCarrier()); 229 231 return true; 230 232 } -
code/trunk/src/modules/pickup/Pickup.h
r6524 r6540 25 25 * ... 26 26 * 27 */ 28 29 /** 30 @file Pickup.h 31 @brief Declaration of the Pickup class. 27 32 */ 28 33 … … 70 75 { 71 76 77 protected: 78 Pickup(BaseObject* creator); //!< Constructor. 79 72 80 public: 73 Pickup(BaseObject* creator); //!< Constructor.74 81 virtual ~Pickup(); //!< Destructor. 75 82 … … 124 131 void initializeIdentifier(void); 125 132 126 virtual bool createSpawner( const Vector3& position); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.133 virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 127 134 128 135 /** -
code/trunk/src/modules/pickup/PickupCollection.cc
r6538 r6540 158 158 159 159 PickupCollection* pickup = dynamic_cast<PickupCollection*>(item); 160 //! Clone all Pickupables this PickupCollection consist of.160 //! Clone all Pickupables this PickupCollection consist of. 161 161 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) 162 162 { … … 240 240 Returns true if a spawner was created, false if not. 241 241 */ 242 bool PickupCollection::createSpawner( const Vector3& position)243 { 244 new DroppedPickup(this, this, position);242 bool PickupCollection::createSpawner(void) 243 { 244 new DroppedPickup(this, this, this->getCarrier()); 245 245 return true; 246 246 } -
code/trunk/src/modules/pickup/PickupCollection.h
r6538 r6540 77 77 void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup. 78 78 79 virtual bool createSpawner( const Vector3& position); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.79 virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 80 80 81 81 PickupCollectionIdentifier* pickupCollectionIdentifier_; //!< The PickupCollectionIdentifier of this PickupCollection. Is used to distinguish different PickupCollections amongst themselves. -
code/trunk/src/modules/pickup/PickupManager.cc
r6524 r6540 28 28 29 29 /** 30 @file 30 @file PickupManager.cc 31 31 @brief Implementation of the PickupManager class. 32 32 */ … … 50 50 Constructor. Registers the PickupManager and creates the default PickupRepresentation. 51 51 */ 52 PickupManager::PickupManager() 52 PickupManager::PickupManager() : defaultRepresentation_(NULL) 53 53 { 54 this->defaultRepresentation_ = NULL;55 this->pickupCarrierStructure_ = NULL;56 54 RegisterRootObject(PickupManager); 57 55 … … 68 66 if(this->defaultRepresentation_ != NULL) 69 67 this->defaultRepresentation_->destroy(); 70 71 if(this->pickupCarrierStructure_ != NULL)72 delete this->pickupCarrierStructure_;73 68 } 74 69 … … 84 79 Returns true if successful and false if not. 85 80 */ 86 //TODO: Make sure that either the PickupRepresentation is destroyed upon destruction of the PickupManager if the representation wasn't created with XMLPort.87 81 bool PickupManager::registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation) 88 82 { -
code/trunk/src/modules/pickup/PickupManager.h
r6524 r6540 28 28 29 29 /** 30 @file 30 @file PickupManager.h 31 31 @brief Definition of the PickupManager class. 32 32 */ … … 46 46 namespace orxonox 47 47 { 48 //TODO: Actually utilize this.49 struct PickupCarrierNode50 {51 Identifier* identifier;52 std::set<PickupCarrierNode*> children;53 };54 48 55 49 /** … … 74 68 PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier. 75 69 76 //TODO: Delete or utilitze this.77 //bool registerCarrier(Identifier* parent, )78 79 70 private: 80 71 static PickupManager* singletonPtr_s; … … 82 73 PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation. 83 74 std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations. 84 85 //TODO: Delete or utilize this.86 PickupCarrierNode* pickupCarrierStructure_;87 75 88 76 }; -
code/trunk/src/modules/pickup/PickupRepresentation.cc
r6524 r6540 27 27 */ 28 28 29 /** 30 @file PickupRepresentation.cc 31 @brief Implementation of the PickupRepresentation class. 32 */ 33 29 34 #include "PickupRepresentation.h" 30 35 … … 44 49 This is primarily for use of the PickupManager in creating a default PickupRepresentation. 45 50 */ 46 //TODO: Not this as creator!!! 47 PickupRepresentation::PickupRepresentation() : BaseObject(this) 51 PickupRepresentation::PickupRepresentation() : BaseObject(NULL), spawnerRepresentation_(NULL) 48 52 { 49 this->spawnerRepresentation_ = NULL;50 51 53 RegisterObject(PickupRepresentation); 52 54 … … 58 60 Default Constructor. Registers the object and initializes its member variables. 59 61 */ 60 PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator) 62 PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator), spawnerRepresentation_(NULL) 61 63 { 62 this->spawnerRepresentation_ = NULL;63 64 64 RegisterObject(PickupRepresentation); 65 65 … … 151 151 Returns a pointer to the StaticEntity. 152 152 */ 153 //TODO: Think of more elegant solution.153 //TODO: Possibility to define default representation through XML. 154 154 StaticEntity* PickupRepresentation::getDefaultSpawnerRepresentation(PickupSpawner* spawner) 155 155 { -
code/trunk/src/modules/pickup/PickupRepresentation.h
r6524 r6540 25 25 * ... 26 26 * 27 */ 28 29 /** 30 @file PickupRepresentation.h 31 @brief Definition of the PickupRepresentation class. 27 32 */ 28 33 -
code/trunk/src/modules/pickup/PickupSpawner.cc
r6524 r6540 28 28 29 29 /** 30 @file 31 @brief Implementation of PickupSpawner.30 @file PickupSpawner.cc 31 @brief Implementation of the PickupSpawner class. 32 32 */ 33 33 … … 52 52 Pointer to the object which created this item. 53 53 */ 54 PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator) 55 { 54 PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator), pickup_(NULL) 55 { 56 RegisterObject(PickupSpawner); 57 56 58 this->initialize(); 57 58 RegisterObject(PickupSpawner);59 59 } 60 60 … … 73 73 The maximum number of items spawned by this PickupSpawner. 74 74 */ 75 PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator) 75 PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator), pickup_(NULL) 76 76 { 77 77 RegisterObject(PickupSpawner); … … 103 103 void PickupSpawner::initialize(void) 104 104 { 105 this->pickup_ = NULL;106 107 105 this->triggerDistance_ = 20; 108 106 this->respawnTime_ = 0; … … 170 168 Time since last tick. 171 169 */ 172 //TODO: Replace this with a real DistanceTrigger? Or better with collisions?170 //TODO: Replace with collisions. 173 171 void PickupSpawner::tick(float dt) 174 172 { 173 SUPER(PickupSpawner, tick, dt); 174 175 175 //! If the PickupSpawner is active. 176 176 if (this->isActive()) … … 215 215 if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0) 216 216 { 217 //TODO: Nicer? Does this even work?218 217 this->startRespawnTimer(); 219 218 … … 278 277 Pawn which triggered the PickupSpawner. 279 278 */ 280 //TODO: Make more generic -> without pawn.281 279 void PickupSpawner::trigger(Pawn* pawn) 282 280 { … … 314 312 else 315 313 { 316 //TODO: Really that severe?317 314 if(target == NULL) 318 315 COUT(1) << "PickupSpawner: Pickupable has no target." << std::endl; -
code/trunk/src/modules/pickup/PickupSpawner.h
r6524 r6540 28 28 29 29 /** 30 @file 31 @brief Definition of PickupSpawner.30 @file PickupSpawner.h 31 @brief Definition of the PickupSpawner class. 32 32 */ 33 33 -
code/trunk/src/modules/pickup/items/HealthPickup.cc
r6524 r6540 26 26 * 27 27 */ 28 29 /** 30 @file HealthPickup.cc 31 @brief Implementation of the HealthPickup class. 32 */ 28 33 29 34 #include "HealthPickup.h" … … 94 99 this->pickupIdentifier_->addParameter(type1, val1); 95 100 96 //TODO: Does this work, is val valid outside the function scope?97 101 std::string val2 = this->getHealthType(); 98 102 std::string type2 = "healthType"; … … 133 137 void HealthPickup::tick(float dt) 134 138 { 139 SUPER(HealthPickup, tick, dt); 140 135 141 if(this->isContinuous() && this->isUsed()) 136 142 { -
code/trunk/src/modules/pickup/items/HealthPickup.h
r6524 r6540 26 26 * 27 27 */ 28 29 /** 30 @file HealthPickup.h 31 @brief Declaration of the HealthPickup class. 32 */ 28 33 29 34 #ifndef _HealthPickup_H__ -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r6524 r6540 123 123 } 124 124 125 float dmg = this->damage_;126 //TODO: Remove.127 // if (this->owner_)128 // dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);129 130 125 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 131 126 if (victim) 132 victim->hit(this->owner_, contactPoint, dmg);127 victim->hit(this->owner_, contactPoint, this->damage_); 133 128 } 134 129 return false; -
code/trunk/src/modules/weapons/projectiles/Rocket.cc
r6524 r6540 200 200 } 201 201 202 float dmg = this->damage_;203 //TODO: This souldn't be necessary here.204 //if (this->owner_)205 // dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);206 207 202 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 208 203 if (victim) 209 victim->hit(this->owner_, contactPoint, dmg);204 victim->hit(this->owner_, contactPoint, this->damage_); 210 205 // this->destroy(); 211 206 }
Note: See TracChangeset
for help on using the changeset viewer.