Changeset 6419
- Timestamp:
- Dec 25, 2009, 11:07:09 PM (15 years ago)
- Location:
- code/branches/pickup3
- Files:
-
- 2 deleted
- 30 edited
- 12 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup3
- Property svn:mergeinfo changed
/code/branches/pickup2 (added) merged: 5942,5947,5953,6405
- Property svn:mergeinfo changed
-
code/branches/pickup3/src/libraries/core/Super.h
r5929 r6419 267 267 #define SUPER_changedGametype(classname, functionname, ...) \ 268 268 SUPER_NOARGS(classname, functionname) 269 270 #define SUPER_changedUsed(classname, functionname, ...) \ 271 SUPER_NOARGS(classname, functionname) 269 272 // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- 270 273 … … 515 518 516 519 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false) 520 () 521 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 522 523 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false) 517 524 () 518 525 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; … … 570 577 SUPER_INTRUSIVE_DECLARATION(changedName); 571 578 SUPER_INTRUSIVE_DECLARATION(changedGametype); 579 SUPER_INTRUSIVE_DECLARATION(changedUsed); 572 580 // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- 573 581 -
code/branches/pickup3/src/modules/CMakeLists.txt
r5929 r6419 29 29 ADD_SUBDIRECTORY(objects) 30 30 ADD_SUBDIRECTORY(overlays) 31 ADD_SUBDIRECTORY(pickup) 31 32 ADD_SUBDIRECTORY(pong) 32 33 ADD_SUBDIRECTORY(questsystem) -
code/branches/pickup3/src/modules/pickup/DroppedItem.cc
r6405 r6419 97 97 droppedItem->attach(billboard); 98 98 99 COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << "," << position.y << ","<< position.z << ")." << std::endl;99 COUT(3) << "Created DroppedItem for '" << item->getPickupIdentifier() << "' at (" << position.x << ',' << position.y << ',' << position.z << ")." << std::endl; 100 100 101 101 return droppedItem; -
code/branches/pickup3/src/modules/pickup/PickupSpawner.cc
r6405 r6419 128 128 // & load the GUI itself too, along with some empty windows 129 129 // = even less delays 130 // GUIManager:: getInstance().showGUI("PickupInventory");131 // GUIManager:: getInstance().executeCode("hideGUI(\"PickupInventory\")");130 // GUIManager::showGUI("PickupInventory"); 131 // GUIManager::hideGUI("PickupInventory"); 132 132 // PickupInventory::getSingleton(); 133 133 } -
code/branches/pickup3/src/modules/weapons/projectiles/Projectile.cc
r6417 r6419 124 124 125 125 float dmg = this->damage_; 126 if (this->owner_) 127 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false); 126 //TODO: Remove. 127 // if (this->owner_) 128 // dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false); 128 129 129 130 Pawn* victim = orxonox_cast<Pawn*>(otherObject); -
code/branches/pickup3/src/orxonox/CMakeLists.txt
r6417 r6419 47 47 ADD_SUBDIRECTORY(items) 48 48 ADD_SUBDIRECTORY(overlays) 49 ADD_SUBDIRECTORY(pickup)50 49 ADD_SUBDIRECTORY(sound) 51 50 ADD_SUBDIRECTORY(weaponsystem) … … 58 57 MoodManager.h 59 58 controllers/HumanController.h 60 pickup/BaseItem.h61 pickup/PickupInventory.h62 59 sound/SoundManager.h 63 60 DEFINE_SYMBOL -
code/branches/pickup3/src/orxonox/OrxonoxPrereqs.h
r6417 r6419 117 117 class GametypeMessageListener; 118 118 class NotificationListener; 119 class Pickupable; 120 class PickupCarrier; 119 121 class PlayerTrigger; 120 122 class RadarListener; … … 133 135 class OrxonoxOverlay; 134 136 class OverlayGroup; 135 136 // pickup137 class BaseItem;138 class DroppedItem;139 class EquipmentItem;140 class ModifierPickup;141 class PassiveItem;142 class PickupCollection;143 class PickupInventory;144 class PickupSpawner;145 class UsableItem;146 // pickup, items147 class HealthImmediate;148 class HealthUsable;149 class Jump;150 137 151 138 //sound -
code/branches/pickup3/src/orxonox/interfaces/InterfaceCompilation.cc
r5929 r6419 34 34 35 35 #include "GametypeMessageListener.h" 36 #include "Pickupable.h" 37 #include "PickupCarrier.h" 36 38 #include "PlayerTrigger.h" 37 39 #include "RadarListener.h" … … 51 53 RegisterRootObject(GametypeMessageListener); 52 54 } 55 56 //---------------------------- 57 // Pickupable 58 //---------------------------- 59 Pickupable::Pickupable() 60 { 61 RegisterRootObject(Pickupable); 53 62 63 this->used_ = false; 64 this->owner_ = NULL; 65 } 66 67 //---------------------------- 68 // PickupCarrier 69 //---------------------------- 70 PickupCarrier::PickupCarrier() 71 { 72 RegisterRootObject(PickupCarrier); 73 } 74 75 //---------------------------- 76 // PlayerTrigger 77 //---------------------------- 78 PlayerTrigger::PlayerTrigger() 79 { 80 RegisterRootObject(PlayerTrigger); 81 82 this->player_ = NULL; 83 this->isForPlayer_ = true; 84 } 85 54 86 //---------------------------- 55 87 // RadarListener … … 83 115 RegisterRootObject(NotificationListener); 84 116 } 85 86 //----------------------------87 // PlayerTrigger88 //----------------------------89 PlayerTrigger::PlayerTrigger()90 {91 RegisterRootObject(PlayerTrigger);92 93 this->player_ = NULL;94 this->isForPlayer_ = true;95 }96 117 } -
code/branches/pickup3/src/orxonox/items/Engine.cc
r5929 r6419 35 35 #include "Scene.h" 36 36 #include "worldentities/pawns/SpaceShip.h" 37 #include "pickup/ModifierType.h" 37 //TODO: Remove. 38 //#include "pickup/ModifierType.h" 38 39 #include "tools/Shader.h" 39 40 … … 193 194 } 194 195 195 this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false)); 196 //TODO: Remove. 197 //this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false)); 196 198 197 199 if (!this->ship_->getPermanentBoost()) -
code/branches/pickup3/src/orxonox/pickup/BaseItem.cc
r5781 r6419 41 41 { 42 42 /** 43 44 43 @brief Constructor. Registers the BaseItem. 44 @param creator Pointer to the object which created this item. 45 45 */ 46 46 BaseItem::BaseItem(BaseObject* creator) : BaseObject(creator) … … 59 59 60 60 /** 61 62 63 61 @brief XMLPort for BaseItem. 62 @param xmlelement Element of the XML-file. 63 @param mode XMLPort mode to use. 64 64 */ 65 65 void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 72 72 73 73 /** 74 75 76 74 @brief Method to add the item to a pawn. 75 @param pawn Pawn to which the item should get added. 76 @return Returns whether the pawn's PickupCollection accepted the item. 77 77 */ 78 78 bool BaseItem::addTo(Pawn* pawn) … … 80 80 this->setOwner(pawn); 81 81 82 if (pawn->getPickups().add(this)) 82 if (pawn->getPickups().add(this)) //TODO: Does the pawn store his pickups? 83 83 { 84 84 COUT(3) << "Added '" << this->getPickupIdentifier() << "' item." << std::endl; -
code/branches/pickup3/src/orxonox/pickup/BaseItem.h
r5781 r6419 44 44 { 45 45 /** 46 47 46 @brief 47 Base class for all items/pickups. 48 48 49 50 51 49 Provides common methods to be used in derived classes. 50 @author 51 Daniel 'Huty' Haggenmueller 52 52 */ 53 53 class _OrxonoxExport BaseItem : public BaseObject 54 54 { 55 55 // tolua_end 56 public:57 BaseItem(BaseObject* creator);58 virtual ~BaseItem();56 public: 57 BaseItem(BaseObject* creator); 58 virtual ~BaseItem(); 59 59 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort 61 61 62 /**62 /** 63 63 @brief Checks how many instances of this item can be carried at a time. 64 64 @return How many of this item can be carried. 65 */66 virtual int getMaxCarryAmount() const67 { return 1; }65 */ 66 virtual int getMaxCarryAmount() const //TODO: Maybe, better to just be virtual. 67 { return BaseItem::MAX_CARRY_AMOUNT; } 68 68 69 bool addTo(Pawn* pawn); //!< Add the item to a pawn. 70 bool removeFrom(Pawn* pawn); //!< Removes the item from a pawn. 71 /** 69 //TODO: Need to be public? 70 bool addTo(Pawn* pawn); //!< Add the item to a pawn. 71 bool removeFrom(Pawn* pawn); //!< Removes the item from a pawn. 72 /** 72 73 @brief 73 74 Method invoked when the item gets picked up. … … 78 79 @param pawn Pawn who picks up the item. 79 80 @return Returns whether the pawn was able to pick up the item. 80 */81 virtual bool pickedUp(Pawn* pawn)82 { return false; }83 /**81 */ 82 virtual bool pickedUp(Pawn* pawn) //TODO: Maybe better to be just virtual. 83 { return false; } 84 /** 84 85 @brief 85 86 Method invoked when the item is dropped from a player. … … 90 91 @param pawn Pawn which dropped the item. 91 92 @return Returns whether the item was able to get dropped by the pawn. 92 */93 virtual bool dropped(Pawn* pawn)94 { return false; }93 */ 94 virtual bool dropped(Pawn* pawn) 95 { return false; } 95 96 96 /**97 /** 97 98 @brief Gets the current owner of the pickup. 98 99 @return Returns the current owner. 99 */100 inline Pawn* getOwner() const101 { return this->owner_; }102 /**100 */ 101 inline Pawn* getOwner() const 102 { return this->owner_; } 103 /** 103 104 @brief Sets the owner of the pickup. 104 105 @param owner New owner for the pickup. 105 */106 inline void setOwner(Pawn* owner)107 { this->owner_ = owner; }106 */ 107 inline void setOwner(Pawn* owner) 108 { this->owner_ = owner; } 108 109 109 /**110 /** 110 111 @brief Gets the pickupIdentifier of the item. 111 112 @return Returns the pickupIdentifier of the item. 112 113 @see pickupIdentifier_ 113 */114 inline const std::string& getPickupIdentifier() const115 { return this->pickupIdentifier_; }116 /**114 */ 115 inline const std::string& getPickupIdentifier() const 116 { return this->pickupIdentifier_; } 117 /** 117 118 @brief Sets the pickupIdentifier for the item. 118 119 @param identifier New pickupIdentifier for the item. 119 120 @see pickupIdentifier_ 120 */ 121 inline void setPickupIdentifier(const std::string& identifier) 122 { this->pickupIdentifier_ = identifier; } 121 */ 122 //TODO: Needs to be public? 123 inline void setPickupIdentifier(const std::string& identifier) 124 { this->pickupIdentifier_ = identifier; } 123 125 124 // GUI stuff 125 virtual const std::string& getGUIText() const; // tolua_export 126 inline void setGUIText(const std::string& text) 127 { this->guiText_ = text; } 126 // GUI stuff 127 //TODO: Comment. Maybe seperate GUI from Pickup, e.g. ItemDescription... 128 virtual const std::string& getGUIText() const; // tolua_export 129 inline void setGUIText(const std::string& text) 130 { this->guiText_ = text; } 128 131 129 virtual const std::string& getGUIImage() const130 { return this->guiImage_; }131 inline void setGUIImage(const std::string& image)132 { this->guiImage_ = image; }133 private:134 Pawn* owner_; //!< The current owner of the item.132 virtual const std::string& getGUIImage() const 133 { return this->guiImage_; } 134 inline void setGUIImage(const std::string& image) 135 { this->guiImage_ = image; } 136 private: 137 static const int MAX_CARRY_AMOUNT = 1; 135 138 136 /** 139 Pawn* owner_; //!< The current owner of the item. 140 141 /** 137 142 @brief 138 143 The pickupIdentifier of the item.. … … 140 145 Usually set to the template name used by a PickupSpawner, 141 146 used to index items in the PickupCollection. 142 */143 std::string pickupIdentifier_;147 */ 148 std::string pickupIdentifier_; //TODO: Remove, when always just this->getName(). 144 149 145 std::string guiText_; 146 std::string guiImage_; 150 //TODO: Comment. 151 std::string guiText_; 152 std::string guiImage_; 147 153 }; // tolua_export 148 154 } // tolua_export -
code/branches/pickup3/src/orxonox/pickup/CMakeLists.txt
r5781 r6419 1 1 ADD_SOURCE_FILES(ORXONOX_SRC_FILES 2 2 BaseItem.cc 3 DroppedItem.cc4 3 EquipmentItem.cc 5 4 ModifierPickup.cc … … 7 6 PickupCollection.cc 8 7 PickupInventory.cc 9 PickupSpawner.cc10 8 UsableItem.cc 11 9 ) -
code/branches/pickup3/src/orxonox/pickup/EquipmentItem.cc
r5781 r6419 38 38 { 39 39 /** 40 41 40 @brief Constructor. Registers the EquipmentItem. 41 @param creator Pointer to the object which created this item. 42 42 */ 43 43 EquipmentItem::EquipmentItem(BaseObject* creator) : BaseItem(creator) -
code/branches/pickup3/src/orxonox/pickup/EquipmentItem.h
r5781 r6419 41 41 { 42 42 /** 43 44 43 @brief Base class for all equipment-type items. 44 @author Daniel 'Huty' Haggenmueller 45 45 */ 46 46 class _OrxonoxExport EquipmentItem : public BaseItem 47 47 { 48 public: 49 EquipmentItem(BaseObject* creator); 50 virtual ~EquipmentItem() {} 48 //TODO: What is this class for? 49 //Probably falls under UsableItem or PassiveItem 50 public: 51 EquipmentItem(BaseObject* creator); 52 virtual ~EquipmentItem() {} 53 54 55 51 56 }; 52 57 } -
code/branches/pickup3/src/orxonox/pickup/ModifierPickup.cc
r6417 r6419 43 43 44 44 /** 45 @brief Constructor. Registers the ModifierPickup. 46 @param creator Pointer to the object which created this item. 45 @brief 46 Constructor. Registers the ModifierPickup. 47 @param creator 48 Pointer to the object which created this item. 47 49 */ 48 50 ModifierPickup::ModifierPickup(BaseObject* creator) : PassiveItem(creator) … … 52 54 this->duration_ = 0.0f; 53 55 } 54 //! Deconstructor. 56 57 /** 58 @brief 59 Destructor. 60 */ 55 61 ModifierPickup::~ModifierPickup() 56 62 { 57 } 58 /** 59 @brief Method for loading information from a level file. 60 @param element XMLElement from which to read the data. 61 @param mode XMLPort mode to use. 62 */ 63 64 } 65 66 /** 67 @brief 68 Method for loading information from a level file. 69 @param element 70 XMLElement from which to read the data. 71 @param mode 72 XMLPort mode to use. 73 */ 74 //TODO: Comments: params can probably be ommitted. 63 75 void ModifierPickup::XMLPort(Element& element, XMLPort::Mode mode) 64 76 { … … 73 85 XMLPortParamTemplate(ModifierPickup, "accelerationMulti", setMultiplicativeAcceleration, getMultiplicativeAcceleration, element, mode, float); 74 86 } 75 /** 76 @brief 77 Invoked when a pawn picks up the pickup. 78 79 Adds the modifiers to the pawn and sets a timer (if effect is limited) 80 if the pickup could be added to the pawn's PickupCollection. 81 82 @param pawn Pawn which picked up the pickup. 83 @return Returns whether the pickup was able to be added to the pawn. 87 88 /** 89 @brief 90 Invoked when a pawn picks up the pickup. 91 92 Adds the modifiers to the pawn and sets a timer (if effect is limited) 93 if the pickup could be added to the pawn's PickupCollection. 94 95 @param pawn 96 Pawn which picked up the pickup. 97 @return 98 Returns whether the pickup was able to be added to the pawn. 84 99 */ 85 100 bool ModifierPickup::pickedUp(Pawn* pawn) … … 110 125 return false; 111 126 } 112 /** 113 @brief 114 Invoked when a pawn drops the pickup. 115 116 Removes the modifiers from the pawn if the pickup 117 was successfully removed from it's PickupCollection. 118 119 @param pawn Pawn which dropped the pickup. 120 @return Returns whether the pickup could be removed. 127 128 /** 129 @brief 130 Invoked when a pawn drops the pickup. 131 132 Removes the modifiers from the pawn if the pickup 133 was successfully removed from it's PickupCollection. 134 135 @param pawn 136 Pawn which dropped the pickup. 137 @return 138 Returns whether the pickup could be removed. 121 139 */ 122 140 bool ModifierPickup::dropped(Pawn* pawn) … … 145 163 return false; 146 164 } 147 /** 148 @brief Invoked when the timer finished, calls dropped(). 149 */ 165 166 /** 167 @brief Invoked when the timer finished, calls dropped(). 168 */ 169 //TODO: Other name for function? 150 170 void ModifierPickup::timerCallback(Pawn* pawn) 151 171 { … … 153 173 COUT(2) << "Failed to remove modifier pickup after the timer ran out!" << std::endl; 154 174 } 155 /** 156 @brief Gets the additive modifier of a given type. 157 @param type ModifierType for which to return the modifier. 158 @return Returns the additive modifier for type (or 0 if not exists). 175 176 /** 177 @brief 178 Gets the additive modifier of a given type. 179 @param type 180 ModifierType for which to return the modifier. 181 @return 182 Returns the additive modifier for type (or 0 if not exists). 159 183 */ 160 184 float ModifierPickup::getAdditiveModifier(ModifierType::Value type) const … … 166 190 return 0.0f; 167 191 } 168 /** 169 @brief Gets the multiplicative modifier of a given type. 170 @param type ModifierType for which to return the modifier. 171 @return Returns the multiplicative modifier for type (or 1 if not exists). 192 193 /** 194 @brief 195 Gets the multiplicative modifier of a given type. 196 @param type 197 ModifierType for which to return the modifier. 198 @return 199 Returns the multiplicative modifier for type (or 1 if not exists). 172 200 */ 173 201 float ModifierPickup::getMultiplicativeModifier(ModifierType::Value type) const … … 179 207 return 1.0f; 180 208 } 181 /** 182 @brief Gets the additive modifier of a given type. 183 @param type ModifierType for which to return the modifier. 184 @param value The new additive modifier for type. 209 210 /** 211 @brief 212 Gets the additive modifier of a given type. 213 @param type 214 ModifierType for which to return the modifier. 215 @param value 216 The new additive modifier for type. 185 217 */ 186 218 void ModifierPickup::setAdditiveModifier(ModifierType::Value type, float value) … … 191 223 this->additiveModifiers_[type] = value; 192 224 } 193 /** 194 @brief Gets the multiplicative modifier of a given type. 195 @param type ModifierType for which to return the modifier. 196 @param value The new multiplicative modifier for type. 225 226 /** 227 @brief 228 Gets the multiplicative modifier of a given type. 229 @param type 230 ModifierType for which to return the modifier. 231 @param value 232 The new multiplicative modifier for type. 197 233 */ 198 234 void ModifierPickup::setMultiplicativeModifier(ModifierType::Value type, float value) … … 203 239 this->multiplicativeModifiers_[type] = value; 204 240 } 241 205 242 } -
code/branches/pickup3/src/orxonox/pickup/ModifierPickup.h
r6417 r6419 47 47 { 48 48 /** 49 50 49 @brief Class for a (temporary) modifier effect. 50 @author Daniel 'Huty' Haggenmueller 51 51 */ 52 //TODO: More elaborate comments. 52 53 class _OrxonoxExport ModifierPickup : public PassiveItem 53 54 { 54 public: 55 ModifierPickup(BaseObject* creator); 56 virtual ~ModifierPickup(); 55 //TODO: What does being derived from PassiveItem add exactly? Probably better to kill PassiveItem and just derive from BaseItem. 56 //Include ModifierType here, no additional header file needed for that, imo. 57 public: 58 ModifierPickup(BaseObject* creator); 59 virtual ~ModifierPickup(); 57 60 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);//!< To create a ModifierPickup through the level file.61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< To create a ModifierPickup through the level file. 59 62 60 virtual bool pickedUp(Pawn* pawn);//!< Override of the BaseItem::pickedUp() method.61 virtual bool dropped(Pawn* pawn);//!< Override of the BaseItem::dropped() method63 virtual bool pickedUp(Pawn* pawn); //!< Override of the BaseItem::pickedUp() method. 64 virtual bool dropped(Pawn* pawn); //!< Override of the BaseItem::dropped() method 62 65 63 virtual int getMaxCarryAmount(){ return INT_MAX; } //!< Allow the player to carry infinite ModPickups 66 //TODO: Where does this INT_MAX come from? Comment. 67 virtual int getMaxCarryAmount() //!< Allow the player to carry infinite ModPickups 68 { return INT_MAX; } 64 69 65 /**70 /** 66 71 @brief Get the duration of this pickup. 67 72 @return Returns how long the effect holds on. 68 */69 inline float getDuration() const70 { return this->duration_; }71 /**73 */ 74 inline float getDuration() const 75 { return this->duration_; } 76 /** 72 77 @brief Set the duration of this pickup. 73 78 @param duration How long the effect should hold. 74 */ 75 inline void setDuration(float duration) 76 { this->duration_ = duration; } 79 */ 80 //TODO: Better be private? 81 inline void setDuration(float duration) 82 { this->duration_ = duration; } 77 83 78 /** 84 //TODO: Shouldn't these all be seperate pickup items? But, then, would this class really be needed? What does it actually add? 85 //Duration! Thus create two virtual functions addEffect() and removeEffect(). 86 //Export the ideas here into seperate, individual subclasses. 87 //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? 88 //Specify what ModifierItem should do exactly. If the limited duration is the core functionality, another name would probably more fitting. 89 //Perhaps, limited effect duration could also just be another feature of BaseItem... 90 /** 79 91 @brief Get the amount of damage this pickup adds. 80 92 @return Returns how much damage this pickup adds. 81 */82 inline float getAdditiveDamage() const83 { return this->getAdditiveModifier(ModifierType::Damage); }84 /**93 */ 94 inline float getAdditiveDamage() const 95 { return this->getAdditiveModifier(ModifierType::Damage); } 96 /** 85 97 @brief Get the factor by which this pickup multiplies the damage. 86 98 @return Returns the factor by which to multiply damage. 87 */88 inline float getMultiplicativeDamage() const89 { return this->getMultiplicativeModifier(ModifierType::Damage); }99 */ 100 inline float getMultiplicativeDamage() const 101 { return this->getMultiplicativeModifier(ModifierType::Damage); } 90 102 91 /**103 /** 92 104 @brief Set the amount of damage this pickup adds. 93 105 @param value How much damage this pickup adds. 94 */95 inline void setAdditiveDamage(float value)96 { this->setAdditiveModifier(ModifierType::Damage, value); }97 /**106 */ 107 inline void setAdditiveDamage(float value) 108 { this->setAdditiveModifier(ModifierType::Damage, value); } 109 /** 98 110 @brief Set the factor by which this pickup multiplies the damage. 99 111 @param value Factor by which to multiply damage. 100 */101 inline void setMultiplicativeDamage(float value)102 { this->setMultiplicativeModifier(ModifierType::Damage, value); }112 */ 113 inline void setMultiplicativeDamage(float value) 114 { this->setMultiplicativeModifier(ModifierType::Damage, value); } 103 115 104 /**116 /** 105 117 @brief Get the amount of acceleration this pickup adds. 106 118 @return Returns how much acceleration this pickup adds. 107 */108 inline float getAdditiveAcceleration() const109 { return this->getAdditiveModifier(ModifierType::Acceleration); }110 /**119 */ 120 inline float getAdditiveAcceleration() const 121 { return this->getAdditiveModifier(ModifierType::Acceleration); } 122 /** 111 123 @brief Get the factor by which this pickup multiplies the acceleration. 112 124 @return Returns the factor by which to multiply acceleration. 113 */114 inline float getMultiplicativeAcceleration() const115 { return this->getMultiplicativeModifier(ModifierType::Acceleration); }125 */ 126 inline float getMultiplicativeAcceleration() const 127 { return this->getMultiplicativeModifier(ModifierType::Acceleration); } 116 128 117 /**129 /** 118 130 @brief Set the amount of acceleration this pickup adds. 119 131 @param value How much acceleration this pickup adds. 120 */121 inline void setAdditiveAcceleration(float value)122 { this->setAdditiveModifier(ModifierType::Acceleration, value); }123 /**132 */ 133 inline void setAdditiveAcceleration(float value) 134 { this->setAdditiveModifier(ModifierType::Acceleration, value); } 135 /** 124 136 @brief Set the factor by which this pickup multiplies the acceleration. 125 137 @param value Factor by which to multiply acceleration. 126 */127 inline void setMultiplicativeAcceleration(float value)128 { this->setMultiplicativeModifier(ModifierType::Acceleration, value); }138 */ 139 inline void setMultiplicativeAcceleration(float value) 140 { this->setMultiplicativeModifier(ModifierType::Acceleration, value); } 129 141 130 void timerCallback(Pawn* pawn); //!< Method called when the timer runs out. 142 //TODO: Make private? 143 void timerCallback(Pawn* pawn); //!< Method called when the timer runs out. 131 144 132 private:133 float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType.134 float getMultiplicativeModifier(ModifierType::Value type) const; //!< Get the multiplicative modifier for a given ModifierType.135 void setAdditiveModifier(ModifierType::Value type, float value); //!< Set the additive modifier for a given ModifierType.136 void setMultiplicativeModifier(ModifierType::Value type, float value); //!< Set the multiplicative modifier for a given ModifierType145 private: 146 float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType. 147 float getMultiplicativeModifier(ModifierType::Value type) const; //!< Get the multiplicative modifier for a given ModifierType. 148 void setAdditiveModifier(ModifierType::Value type, float value); //!< Set the additive modifier for a given ModifierType. 149 void setMultiplicativeModifier(ModifierType::Value type, float value); //!< Set the multiplicative modifier for a given ModifierType 137 150 138 std::map<ModifierType::Value, float> additiveModifiers_; //!< Map of additive modifiers, indexed by ModifierType.139 std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType.151 std::map<ModifierType::Value, float> additiveModifiers_; //!< Map of additive modifiers, indexed by ModifierType. 152 std::map<ModifierType::Value, float> multiplicativeModifiers_; //!< Map of multiplicative modifiers, indexed by ModifierType. 140 153 141 float duration_; //!< Duration of this pickup's effect (0 for unlimited).142 Timer timer_; //!< Timer used if the pickup's effect has a time limit.154 float duration_; //!< Duration of this pickup's effect (0 for unlimited). 155 Timer timer_; //!< Timer used if the pickup's effect has a time limit. 143 156 }; 144 157 } -
code/branches/pickup3/src/orxonox/pickup/ModifierType.h
r5781 r6419 39 39 namespace orxonox 40 40 { 41 //TODO: Merge with ModifierPickup. 41 42 namespace ModifierType 42 43 { -
code/branches/pickup3/src/orxonox/pickup/PassiveItem.cc
r5781 r6419 33 33 { 34 34 /** 35 36 35 @brief Constructor. Registers the PassiveItem. 36 @param creator Pointer to the object which created this item. 37 37 */ 38 38 PassiveItem::PassiveItem(BaseObject* creator) : BaseItem(creator) -
code/branches/pickup3/src/orxonox/pickup/PassiveItem.h
r5781 r6419 41 41 { 42 42 /** 43 44 43 @brief Base class for all passive items. 44 @author Daniel 'Huty' Haggenmueller 45 45 */ 46 46 class _OrxonoxExport PassiveItem : public BaseItem 47 47 { 48 public: 49 PassiveItem(BaseObject* creator); 50 virtual ~PassiveItem() {} 48 //TODO: What is this Class for. Where is ActiveItem? 49 //Rename it InstantItem? 50 public: 51 PassiveItem(BaseObject* creator); 52 virtual ~PassiveItem() {} 53 51 54 }; 52 55 } -
code/branches/pickup3/src/orxonox/pickup/PickupCollection.cc
r6417 r6419 52 52 53 53 /** 54 @brief 55 Add an item to the collection. 56 57 Only adds the item if there's a free slot for it. 58 59 @param item Item to add to the collection. 60 @return Returns whether the item has been added to the collection. 54 @brief 55 Add an item to the collection. 56 57 Only adds the item if there's a free slot for it. 58 59 @param item 60 Item to add to the collection. 61 @return 62 Returns whether the item has been added to the collection. 61 63 */ 62 64 bool PickupCollection::add(BaseItem* item) -
code/branches/pickup3/src/orxonox/pickup/PickupCollection.h
r5781 r6419 47 47 { 48 48 /** 49 50 49 @brief PickupCollection for organising items. 50 @author Daniel 'Huty' Haggenmueller 51 51 */ 52 class _OrxonoxExport PickupCollection 52 class _OrxonoxExport PickupCollection : public orxonox::OrxonoxClass 53 53 { 54 public:55 PickupCollection();54 public: 55 PickupCollection(); 56 56 57 bool add(BaseItem* item); //!< Add an item to the collection.57 bool add(BaseItem* item); //!< Add an item to the collection. 58 58 59 bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item.59 bool checkSlot(BaseItem* item); //!< Check if there's a free slot in the collection for an item. 60 60 61 void clear(); //!< Empty the collection62 bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item.61 void clear(); //!< Empty the collection 62 bool contains(BaseItem* item, bool anyOfType = false); //!< Check if the collection contains an item. 63 63 64 void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection.64 void remove(BaseItem* item, bool removeAllOfType = false); //!< Remove an item from the collection. 65 65 66 void useItem(); //!< Use the first usable item. 67 void useItem(UsableItem* item); //!< Use a usable item. 66 //TODO: Hmm... probably should stay... 67 void useItem(); //!< Use the first usable item. 68 void useItem(UsableItem* item); //!< Use a usable item. 68 69 69 void addAdditiveModifier(ModifierType::Value type, float value); //!< Add an additive modifier. 70 void addMultiplicativeModifier(ModifierType::Value type, float value); //!< Add a multiplicative modifier. 70 /** 71 @brief Get the owner of the PickupCollection. 72 @return Returns the pawn which owns the PickupCollection. 73 */ 74 inline Pawn* getOwner() const 75 { return this->owner_; } 76 /** 77 @brief Set the owner of the PickupCollection. 78 @param owner The new Pawn which owns the PickupCollection. 79 */ 80 inline void setOwner(Pawn* owner) 81 { this->owner_ = owner; } 71 82 72 float getAdditiveModifier(ModifierType::Value type); //!< Get total additive modifier. 73 float getMultiplicativeModifier(ModifierType::Value type); //!< Get total multiplicative modifier. 83 inline UsableItem* getCurrentUsable() 84 { return this->currentUsable_; }; 85 inline void setCurrentUsable(UsableItem* usable) 86 { this->currentUsable_ = usable; } 74 87 75 void removeAdditiveModifier(ModifierType::Value type, float value); //!< Remove an additive modifier. 76 void removeMultiplicativeModifier(ModifierType::Value type, float value); //!< Remove a multiplicative modifier. 88 std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items. 89 std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items. 90 std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items. 77 91 78 float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false); //!< Apply the modifiers to a float. 79 Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false); //!< Apply the modifiers to a Vector3. 92 private: 93 Pawn* owner_; //!< The owner of the PickupCollection. 94 UsableItem* currentUsable_; 95 int slots_; 80 96 81 /** 82 @brief Get the map of contained items. 83 @return The map of items. 84 */ 85 std::multimap<std::string, BaseItem*> getItems() const 86 { return this->items_; } 87 88 /** 89 @brief Get the owner of the PickupCollection. 90 @return Returns the pawn which owns the PickupCollection. 91 */ 92 inline Pawn* getOwner() const 93 { return this->owner_; } 94 /** 95 @brief Set the owner of the PickupCollection. 96 @param owner The new Pawn which owns the PickupCollection. 97 */ 98 inline void setOwner(Pawn* owner) 99 { this->owner_ = owner; } 100 101 inline UsableItem* getCurrentUsable() 102 { return this->currentUsable_; }; 103 inline void setCurrentUsable(UsableItem* usable) 104 { this->currentUsable_ = usable; } 105 106 std::deque<EquipmentItem*> getEquipmentItems(); //!< Get a list of equipment-type items. 107 std::deque<PassiveItem*> getPassiveItems(); //!< Get a list of passive items. 108 std::deque<UsableItem*> getUsableItems(); //!< Get a list of usable items. 109 private: 110 Pawn* owner_; //!< The owner of the PickupCollection. 111 UsableItem* currentUsable_; 112 113 bool bBlockRemovals_; //!< Whether to block direct removals through remove(). 114 115 std::multimap<ModifierType::Value, float> additiveModifiers_; //!< Contains additive modifiers (indexed by ModifierType). 116 std::multimap<ModifierType::Value, float> multiplicativeModifiers_; //!< Contains multiplicative modifiers (indexed by ModifierType). 117 118 std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items). 97 std::multimap<std::string, BaseItem*> items_; //!< Map of items in the collection (indexed by pickupIdentifier of the items). 119 98 }; 120 99 } -
code/branches/pickup3/src/orxonox/pickup/PickupInventory.cc
r6417 r6419 52 52 53 53 PickupInventory* PickupInventory::pickupInventory_s = NULL; 54 55 //TODO: Comment. 56 57 /** 58 @brief 59 Get a Pointer to the PickupInventory Singleton. 60 @return 61 A Pointer to the PickupInventory. 62 */ 63 //TODO: Make SingeltonPtr? 54 64 PickupInventory* PickupInventory::getSingleton() 55 65 { … … 60 70 } 61 71 72 /** 73 @brief 74 Constructor. 75 */ 62 76 PickupInventory::PickupInventory() 63 77 { 64 this->bInventoryVisible_ = false; 65 this->visibleEquipmentWindows_ = this->visibleUsableWIndows_ = 0; 78 //TODO: Maybe some abstraction for the usableWindows, e.g. push and pop... 79 //RegisterObject() ? In some other Class, too. Which? 80 this->bInventoryVisible_ = false; //TODO: If OrxonoxClass, this should already be there... 81 this->visibleEquipmentWindows_ = this->visibleUsableWindows_ = 0; 66 82 67 83 // Create some windows to avoid creating them while playing … … 77 93 this->createdEquipmentWindows_ = this->createdUsableWindows_ = 10; 78 94 } 95 96 /** 97 @brief 98 Destructor. 99 */ 100 //TODO: Destroy something? 79 101 PickupInventory::~PickupInventory() 80 102 { 81 103 } 82 104 83 84 85 void PickupInventory::toggleInventory() 105 /** 106 @brief 107 Toggles the visibility of the inventory. 108 */ 109 /*static*/ void PickupInventory::toggleInventory() 86 110 { 87 111 if(PickupInventory::getSingleton()->isVisible()) { … … 95 119 } 96 120 121 /** 122 @brief 123 124 */ 97 125 unsigned int PickupInventory::getCurrentUsableIndex() 98 126 { … … 111 139 return 0; 112 140 } 141 113 142 bool PickupInventory::isCurrentUsable(const BaseItem* item) 114 143 { … … 119 148 return false; 120 149 } 150 121 151 void PickupInventory::selectUsable(unsigned int i) 122 152 { … … 138 168 return 0; 139 169 } 170 140 171 unsigned int PickupInventory::getUsableCount() 141 172 { … … 146 177 return 0; 147 178 } 179 148 180 unsigned int PickupInventory::getPassiveCount() 149 181 { … … 154 186 return 0; 155 187 } 188 156 189 BaseItem* PickupInventory::getEquipmentItem(unsigned int i) 157 190 { … … 166 199 return NULL; 167 200 } 201 168 202 BaseItem* PickupInventory::getUsableItem(unsigned int i) 169 203 { … … 178 212 return NULL; 179 213 } 214 180 215 BaseItem* PickupInventory::getPassiveItem(unsigned int i) 181 216 { … … 221 256 equipPane->removeChildWindow("orxonox/Inventory/Items/equ/" + id.str());*/ 222 257 } 223 for(unsigned int i = 0; i < this->visibleUsableW Indows_; i++)258 for(unsigned int i = 0; i < this->visibleUsableWindows_; i++) 224 259 { 225 260 std::ostringstream id; … … 235 270 } 236 271 } 272 237 273 void PickupInventory::updateTabs(CEGUI::WindowManager *winMgr, CEGUI::Window *equipWindow, CEGUI::Window *usableWindow) 238 274 { … … 265 301 } 266 302 } 303 267 304 void PickupInventory::updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target) 268 305 { … … 292 329 PickupInventory::setWindowProperties(winMgr, target, id.str(), item, colour); 293 330 } 294 this->visibleUsableW Indows_ = items.size();331 this->visibleUsableWindows_ = items.size(); 295 332 } 296 333 } … … 322 359 btn->setVisible(false); 323 360 } 361 324 362 void PickupInventory::setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour) 325 363 { … … 346 384 target->addChildWindow(btn); 347 385 } 386 348 387 } -
code/branches/pickup3/src/orxonox/pickup/PickupInventory.h
r5781 r6419 44 44 { 45 45 /** 46 47 46 @brief Static class for the inventory GUI window. 47 @author Daniel 'Huty' Haggenmueller 48 48 */ 49 49 class _OrxonoxExport PickupInventory 50 50 { 51 51 // tolua_end 52 public: 53 PickupInventory(); 54 virtual ~PickupInventory(); 52 public: 53 //TODO: Be derived from OrxonoxClass and ScopedSingleton. 54 //Make some methods private? 55 PickupInventory(); 56 virtual ~PickupInventory(); 55 57 56 static PickupInventory* getSingleton(); // tolua_export58 static PickupInventory* getSingleton(); // tolua_export 57 59 58 static void toggleInventory(); // tolua_export60 static void toggleInventory(); // tolua_export 59 61 60 static unsigned int getEquipmentCount(); // tolua_export61 static unsigned int getUsableCount(); // tolua_export62 static unsigned int getPassiveCount(); // tolua_export62 static unsigned int getEquipmentCount(); // tolua_export 63 static unsigned int getUsableCount(); // tolua_export 64 static unsigned int getPassiveCount(); // tolua_export 63 65 64 static unsigned int getCurrentUsableIndex(); // tolua_export65 static bool isCurrentUsable(const BaseItem* item); // tolua_export66 static void selectUsable(unsigned int i); // tolua_export66 static unsigned int getCurrentUsableIndex(); // tolua_export 67 static bool isCurrentUsable(const BaseItem* item); // tolua_export 68 static void selectUsable(unsigned int i); // tolua_export 67 69 68 static BaseItem* getEquipmentItem(unsigned int i); // tolua_export69 static BaseItem* getUsableItem(unsigned int i); // tolua_export70 static BaseItem* getPassiveItem(unsigned int i); // tolua_export70 static BaseItem* getEquipmentItem(unsigned int i); // tolua_export 71 static BaseItem* getUsableItem(unsigned int i); // tolua_export 72 static BaseItem* getPassiveItem(unsigned int i); // tolua_export 71 73 72 static std::string getImageForItem(const BaseItem* item); // tolua_export74 static std::string getImageForItem(const BaseItem* item); // tolua_export 73 75 74 void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export75 void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export76 void clearInventory(CEGUI::WindowManager* winMgr, CEGUI::Window* equipPane, CEGUI::Window* usablePane); // tolua_export 77 void updateTabs(CEGUI::WindowManager* winMgr, CEGUI::Window* equipWindow, CEGUI::Window* usableWindow); // tolua_export 76 78 77 void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target);78 void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target);79 void updateEquipment(CEGUI::WindowManager* winMgr, CEGUI::Window* target); 80 void updateUsable(CEGUI::WindowManager* winMgr, CEGUI::Window* target); 79 81 80 static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y);81 static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour);82 static void createItemWindows(CEGUI::WindowManager* winMgr, const std::string& id, int x, int y); 83 static void setWindowProperties(CEGUI::WindowManager* winMgr, CEGUI::Window* target, const std::string& id, const BaseItem* item, const std::string& textColour); 82 84 83 const bool isVisible() const84 { return this->bInventoryVisible_; }85 void setVisible(bool visible)86 { this->bInventoryVisible_ = visible; }87 private:88 bool bInventoryVisible_;89 unsigned int createdEquipmentWindows_;90 unsigned int createdUsableWindows_;91 unsigned int visibleEquipmentWindows_;92 unsigned int visibleUsableWIndows_;85 const bool isVisible() const 86 { return this->bInventoryVisible_; } 87 void setVisible(bool visible) 88 { this->bInventoryVisible_ = visible; } 89 private: 90 bool bInventoryVisible_; 91 unsigned int createdEquipmentWindows_; 92 unsigned int createdUsableWindows_; 93 unsigned int visibleEquipmentWindows_; 94 unsigned int visibleUsableWindows_; 93 95 94 static PickupInventory* pickupInventory_s;96 static PickupInventory* pickupInventory_s; 95 97 }; // tolua_export 96 98 } // tolua_export -
code/branches/pickup3/src/orxonox/pickup/UsableItem.cc
r6417 r6419 38 38 { 39 39 /** 40 41 40 @brief Constructor. Registers the UsableItem. 41 @param creator Pointer to the object which created this item. 42 42 */ 43 43 UsableItem::UsableItem(BaseObject* creator) : BaseItem(creator) -
code/branches/pickup3/src/orxonox/pickup/UsableItem.h
r5781 r6419 46 46 class _OrxonoxExport UsableItem : public BaseItem 47 47 { 48 public: 49 UsableItem(BaseObject* creator); 50 virtual ~UsableItem() { } 48 //TODO: What is this exactly? 49 public: 50 UsableItem(BaseObject* creator); 51 virtual ~UsableItem() { } 51 52 52 /**53 @brief Method invoked when the item is being used.54 @param pawn Pawn which is using the item.55 */56 virtual void used(Pawn* pawn) { }53 /** 54 @brief Method invoked when the item is being used. 55 @param pawn Pawn which is using the item. 56 */ 57 virtual void used(Pawn* pawn) { } 57 58 }; 58 59 } -
code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.cc
r5929 r6419 59 59 } 60 60 61 //TODO: Should be destroyed anyways... 61 62 bool HealthImmediate::pickedUp(Pawn* pawn) 62 63 { -
code/branches/pickup3/src/orxonox/pickup/items/HealthImmediate.h
r5781 r6419 45 45 class _OrxonoxExport HealthImmediate : public PassiveItem 46 46 { 47 public: 48 HealthImmediate(BaseObject* creator); 49 virtual ~HealthImmediate(); 47 //TODO: Comment. 48 //Does this get destroyed, when the healt is delivered? It seems to me it doesn't. 49 public: 50 HealthImmediate(BaseObject* creator); 51 virtual ~HealthImmediate(); 50 52 51 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 52 54 53 virtual bool pickedUp(Pawn* pawn);55 virtual bool pickedUp(Pawn* pawn); 54 56 55 inline float getRecoveredHealth() const56 { return this->recoveredHealth_; }57 inline void setRecoveredHealth(float recovery)58 { this->recoveredHealth_ = recovery; }57 inline float getRecoveredHealth() const 58 { return this->recoveredHealth_; } 59 inline void setRecoveredHealth(float recovery) 60 { this->recoveredHealth_ = recovery; } 59 61 60 private:61 float recoveredHealth_;62 private: 63 float recoveredHealth_; 62 64 }; 63 65 } -
code/branches/pickup3/src/orxonox/pickup/items/HealthUsable.cc
r5929 r6419 45 45 46 46 /** 47 48 47 @brief Constructor 48 @param creator Object that created this item. 49 49 */ 50 50 HealthUsable::HealthUsable(BaseObject* creator) : UsableItem(creator) … … 54 54 this->recoveredHealth_ = 0; 55 55 } 56 56 57 //! Deconstructor 57 58 HealthUsable::~HealthUsable() 58 59 { 59 60 } 61 60 62 /** 61 62 63 63 @brief XMLPort for Jump. 64 @param xmlelement Element of the XML-file. 65 @param mode XMLPort mode to use. 64 66 */ 65 67 void HealthUsable::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 69 71 XMLPortParam(HealthUsable, "recoveredHealth", setRecoveredHealth, getRecoveredHealth, xmlelement, mode); 70 72 } 73 71 74 /** 72 73 75 @brief Called when the item is used, makes the user "jump". 76 @param pawn Pawn which used te item. 74 77 */ 78 //TODO: Jump? Nope! => Comment. 79 //Should be destroyed anyways. 75 80 void HealthUsable::used(Pawn* pawn) 76 81 { … … 85 90 } 86 91 } 92 87 93 /** 88 89 94 @brief Called when the item is picked up. 95 @param pawn Pawn which picked up the item. 90 96 */ 91 97 bool HealthUsable::pickedUp(Pawn* pawn) … … 93 99 return this->addTo(pawn); 94 100 } 101 95 102 /** 96 97 103 @brief Called when the item is dropped, creates a DroppedItem behind the pawn. 104 @param pawn Pawn which dropped the item. 98 105 */ 99 106 bool HealthUsable::dropped(Pawn* pawn) -
code/branches/pickup3/src/orxonox/pickup/items/Jump.h
r5781 r6419 50 50 class _OrxonoxExport Jump : public UsableItem 51 51 { 52 public: 53 Jump(BaseObject* creator); //!< Constructor 54 virtual ~Jump(); //!< Deconstructor 52 public: 53 //TODO: Comment. a.s.o. 54 Jump(BaseObject* creator); //!< Constructor 55 virtual ~Jump(); //!< Deconstructor 55 56 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< XMLPort 57 58 58 virtual int getMaxCarryAmount() const59 { return INT_MAX; }59 virtual int getMaxCarryAmount() const 60 { return INT_MAX; } 60 61 61 virtual void used(Pawn* pawn); //!< Called when the item is used.62 virtual void used(Pawn* pawn); //!< Called when the item is used. 62 63 63 virtual bool pickedUp(Pawn* pawn); //!< Called when the item is picked up.64 virtual bool dropped(Pawn* pawn); //!< Called when the item is dropped.64 virtual bool pickedUp(Pawn* pawn); //!< Called when the item is picked up. 65 virtual bool dropped(Pawn* pawn); //!< Called when the item is dropped. 65 66 66 /**67 @brief Get the velocity added when the item is used.68 @return Returns the added velocity (relative to the Pawn).69 */70 inline const Vector3& getVelocity() const71 { return this->velocity_; }72 /**73 @brief Set the velocity added when the item is used.74 @param velocity New added velocity (relative to Pawn).75 */76 inline void setVelocity(const Vector3& velocity)77 { this->velocity_ = velocity; }78 /**79 @brief Get the amount of jumps available.80 @return Returns how many times the item can be used.81 */82 inline int getJumpsAvailable() const83 { return this->jumpsAvailable_; }84 /**85 @brief Set the amount of jumps available.86 @param num New number of available jumps.87 */88 inline void setJumpsAvailable(int num)89 { this->jumpsAvailable_ = num; }90 private:91 Vector3 velocity_; //!< The velocity added when the item is used.92 int jumpsAvailable_; //!< Amount of jumps still available.67 /** 68 @brief Get the velocity added when the item is used. 69 @return Returns the added velocity (relative to the Pawn). 70 */ 71 inline const Vector3& getVelocity() const 72 { return this->velocity_; } 73 /** 74 @brief Set the velocity added when the item is used. 75 @param velocity New added velocity (relative to Pawn). 76 */ 77 inline void setVelocity(const Vector3& velocity) 78 { this->velocity_ = velocity; } 79 /** 80 @brief Get the amount of jumps available. 81 @return Returns how many times the item can be used. 82 */ 83 inline int getJumpsAvailable() const 84 { return this->jumpsAvailable_; } 85 /** 86 @brief Set the amount of jumps available. 87 @param num New number of available jumps. 88 */ 89 inline void setJumpsAvailable(int num) 90 { this->jumpsAvailable_ = num; } 91 private: 92 Vector3 velocity_; //!< The velocity added when the item is used. 93 int jumpsAvailable_; //!< Amount of jumps still available. 93 94 }; 94 95 } -
code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.cc
r6417 r6419 71 71 this->aimPosition_ = Vector3::ZERO; 72 72 73 this->getPickups().setOwner(this); 73 //TODO: Remove. 74 //this->getPickups().setOwner(this); 74 75 75 76 if (GameMode::isMaster()) … … 296 297 } 297 298 298 void Pawn::dropItems() 299 { 300 this->getPickups().clear(); 301 } 299 //TODO: Remove. 300 // void Pawn::dropItems() 301 // { 302 // this->getPickups().clear(); 303 // } 302 304 303 305 -
code/branches/pickup3/src/orxonox/worldentities/pawns/Pawn.h
r6417 r6419 35 35 #include "interfaces/RadarViewable.h" 36 36 #include "worldentities/ControllableEntity.h" 37 #include "pickup/PickupCollection.h" 37 //TODO: Remove. 38 //#include "pickup/PickupCollection.h" 38 39 39 40 namespace orxonox … … 109 110 { return this->numexplosionchunks_; } 110 111 111 virtual void dropItems(); 112 inline PickupCollection& getPickups() 113 { return this->pickups_; } 114 virtual void useItem() 115 { this->pickups_.useItem(); } 112 //TODO: Remove. 113 // virtual void dropItems(); 114 // inline PickupCollection& getPickups() 115 // { return this->pickups_; } 116 // virtual void useItem() 117 // { this->pickups_.useItem(); } 116 118 117 119 virtual void startLocalHumanControl(); … … 135 137 bool bAlive_; 136 138 137 PickupCollection pickups_; 139 //TODO: Remove. 140 //PickupCollection pickups_; 138 141 139 142 float health_;
Note: See TracChangeset
for help on using the changeset viewer.