Changeset 7127 for code/branches/presentation3/src
- Timestamp:
- Jun 9, 2010, 9:32:58 PM (14 years ago)
- Location:
- code/branches/presentation3/src
- Files:
-
- 104 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation3/src/libraries/core/BaseObject.cc
r7105 r7127 105 105 } 106 106 } 107 107 108 108 /** @brief Adds an object which listens to the events of this object. */ 109 109 void BaseObject::registerEventListener(BaseObject* object) … … 125 125 XMLPortParam(BaseObject, "mainstate", setMainStateName, getMainStateName, xmlelement, mode); 126 126 XMLPortParamTemplate(BaseObject, "template", addTemplate, getSingleTemplate, xmlelement, mode, const std::string&); 127 127 128 128 XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*); 129 129 XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode); … … 372 372 { 373 373 this->registerEventStates(); 374 374 375 375 COUT(4) << this->getIdentifier()->getName() << " (&" << this << ") processing event. originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << "), activate: " << event.activate_ << ", name: " << event.name_ << ", statename: " << event.statename_ << "." << std::endl; 376 376 -
code/branches/presentation3/src/libraries/core/BaseObject.h
r7105 r7127 154 154 inline Gametype* getOldGametype() const { return this->oldGametype_; } 155 155 virtual void changedGametype() {} 156 156 157 157 inline void setLevel(const SmartPtr<Level>& level) 158 158 { -
code/branches/presentation3/src/libraries/core/Event.cc
r6859 r7127 60 60 61 61 COUT(4) << "Processing event (EventState) : originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << "), activate: " << event.activate_ << ", name: " << event.name_ << ", statename: " << event.statename_ << ", object: " << object->getIdentifier()->getName() << " (&" << object << ")" << "." << std::endl; 62 62 63 63 // check if the originator is an instance of the requested class 64 64 if (event.originator_->isA(this->subclass_)) -
code/branches/presentation3/src/libraries/core/EventIncludes.h
r6800 r7127 52 52 } \ 53 53 XMLPortEventStateIntern(xmlportevent##function, classname, statename, xmlelement, mode) 54 54 55 55 #define XMLPortEventSink(classname, subclassname, statename, function, xmlelement, mode) \ 56 56 orxonox::EventState* containername##function = this->getEventState(statename); \ -
code/branches/presentation3/src/libraries/core/GUIManager.h
r7072 r7127 103 103 104 104 static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export 105 105 106 106 private: 107 107 GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class) 108 108 void executeCode(const std::string& str); 109 109 110 110 template <typename FunctionType> 111 111 bool protectedCall(FunctionType function); -
code/branches/presentation3/src/libraries/core/OrxonoxClass.h
r7008 r7127 108 108 bool isParentOf(const OrxonoxClass* object); 109 109 bool isDirectParentOf(const OrxonoxClass* object); 110 110 111 111 virtual void clone(OrxonoxClass*& item) {} 112 112 … … 172 172 std::vector<std::pair<unsigned int, void*> > objectPointers_; 173 173 }; 174 174 175 175 SUPER_FUNCTION(11, OrxonoxClass, clone, false); 176 176 177 177 } 178 178 -
code/branches/presentation3/src/libraries/core/Super.h
r6524 r7127 267 267 #define SUPER_changedGametype(classname, functionname, ...) \ 268 268 SUPER_NOARGS(classname, functionname) 269 269 270 270 #define SUPER_changedUsed(classname, functionname, ...) \ 271 271 SUPER_NOARGS(classname, functionname) 272 272 273 273 #define SUPER_clone(classname, functionname, ...) \ 274 274 SUPER_ARGS(classname, functionname, __VA_ARGS__) 275 275 276 276 #define SUPER_changedCarrier(classname, functionname, ...) \ 277 277 SUPER_NOARGS(classname, functionname) 278 278 279 279 #define SUPER_changedPickedUp(classname, functionname, ...) \ 280 280 SUPER_NOARGS(classname, functionname) 281 281 282 282 // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- 283 283 … … 530 530 () 531 531 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 532 532 533 533 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false) 534 534 () … … 538 538 (item) 539 539 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 540 540 541 541 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedCarrier, false) 542 542 () 543 543 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 544 544 545 545 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(13, changedPickedUp, false) 546 546 () -
code/branches/presentation3/src/libraries/core/Template.cc
r6938 r7127 107 107 { 108 108 this->bLoadDefaults_ = temp->bLoadDefaults_; 109 109 110 110 if (!temp->bIsReturningXMLElement_) 111 111 { -
code/branches/presentation3/src/libraries/network/packet/Chat.cc
r6928 r7127 60 60 *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_; 61 61 62 /* cast the hell out of the message string, and copy it into the 63 * data buffer. 62 /* cast the hell out of the message string, and copy it into the 63 * data buffer. 64 64 */ 65 65 memcpy( data_+_MESSAGE, static_cast<void*>(const_cast<char*>(message.c_str())), messageLength_ ); -
code/branches/presentation3/src/libraries/network/synchronisable/Synchronisable.h
r7105 r7127 183 183 } 184 184 } 185 185 186 186 template <class T> void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) 187 187 { -
code/branches/presentation3/src/libraries/util/Serialise.h
r7105 r7127 636 636 return checkEquality( (unsigned char&)((mbool&)variable).getMemory(), mem ); 637 637 } 638 638 639 639 // =========== std::set 640 640 641 641 template <class T> inline uint32_t returnSize( const std::set<T>& variable ) 642 642 { 643 643 uint32_t tempsize = sizeof(uint32_t); // for the number of entries 644 644 for( typename std::set<T>::iterator it=((std::set<T>*)(&variable))->begin(); it!=((std::set<T>*)(&variable))->end(); ++it) 645 tempsize += returnSize( *it ); 646 return tempsize; 647 } 648 645 tempsize += returnSize( *it ); 646 return tempsize; 647 } 648 649 649 template <class T> inline void saveAndIncrease( const std::set<T>& variable, uint8_t*& mem ) 650 650 { … … 654 654 saveAndIncrease( *it, mem ); 655 655 } 656 656 657 657 template <class T> inline void loadAndIncrease( const std::set<T>& variable, uint8_t*& mem ) 658 658 { … … 675 675 } 676 676 } 677 677 678 678 template <class T> inline bool checkEquality( const std::set<T>& variable, uint8_t* mem ) 679 679 { -
code/branches/presentation3/src/modules/designtools/CreateStars.h
r7028 r7127 32 32 #include "util/Math.h" 33 33 #include "core/BaseObject.h" 34 34 35 35 namespace orxonox 36 36 { … … 61 61 } 62 62 63 void setColour(const orxonox::ColourValue& colour) { 63 void setColour(const orxonox::ColourValue& colour) { 64 64 this->colour_ = colour; 65 65 } 66 66 67 const ColourValue& getColour() const { 67 const ColourValue& getColour() const { 68 68 return this->colour_; 69 69 } … … 109 109 return this->radius_; 110 110 } 111 111 112 112 Vector3 PolarToCartesian(float alpha, float beta, float radius); 113 113 … … 119 119 unsigned int radius_; 120 120 float alpha_; 121 float colourDiff_; 121 float colourDiff_; 122 122 float alphaDiff_; 123 123 float radiusDiff_; 124 124 125 125 }; 126 126 } -
code/branches/presentation3/src/modules/designtools/SkyboxGenerator.cc
r7039 r7127 46 46 47 47 48 48 49 49 namespace orxonox 50 50 { … … 68 68 } 69 69 70 void SkyboxGenerator::setConfigValues( ) 70 void SkyboxGenerator::setConfigValues( ) 71 71 { 72 72 SetConfigValue(skyboxPrefix_, "SkyboxFile_"); … … 83 83 return; 84 84 } 85 85 86 86 ControllableEntity* ce = HumanController::getLocalControllerSingleton()->getControllableEntity(); 87 87 Camera* camera = ce->getCamera(); 88 88 assert(ce); 89 89 90 90 Ogre::RenderWindow* w = GraphicsManager::getInstance().getRenderWindow(); 91 91 92 92 93 switch (iterateOverDirections_) 93 switch (iterateOverDirections_) 94 94 { 95 95 case 0 : … … 105 105 iterateOverDirections_++; 106 106 break; 107 107 108 108 case 2 : 109 109 w->writeContentsToFile(skyboxPrefix_+"lf.png"); 110 ce->yaw(Degree(90)); 110 ce->yaw(Degree(90)); 111 111 iterateOverDirections_++; 112 112 break; … … 114 114 case 3 : 115 115 w->writeContentsToFile(skyboxPrefix_+"bk.png"); 116 ce->yaw(Degree(90)); 116 ce->yaw(Degree(90)); 117 117 iterateOverDirections_++; 118 118 break; … … 120 120 case 4 : 121 121 w->writeContentsToFile(skyboxPrefix_+"rt.png"); 122 ce->yaw(Degree(90)); 123 ce->pitch(Degree(90)); 122 ce->yaw(Degree(90)); 123 ce->pitch(Degree(90)); 124 124 iterateOverDirections_++; 125 125 break; … … 127 127 case 5 : 128 128 w->writeContentsToFile(skyboxPrefix_+"up.png"); 129 ce->pitch(Degree(180)); 129 ce->pitch(Degree(180)); 130 130 iterateOverDirections_++; 131 131 break; … … 136 136 iterateOverDirections_++; 137 137 break; 138 138 139 139 case 7 : 140 140 camera->getOgreCamera()->setAspectRatio(aspectRatio_); … … 152 152 } 153 153 154 void SkyboxGenerator::createSkybox( ) 154 void SkyboxGenerator::createSkybox( ) 155 155 { 156 156 SkyboxGenerator::getInstance().takeScreenshot_ = true; -
code/branches/presentation3/src/modules/designtools/SkyboxGenerator.h
r6994 r7127 32 32 #include "tools/interfaces/Tickable.h" 33 33 #include <OgreMath.h> 34 35 34 35 36 36 namespace orxonox 37 37 { … … 39 39 { 40 40 friend class Singleton<SkyboxGenerator>; 41 41 42 42 public: 43 43 SkyboxGenerator(); … … 49 49 private: 50 50 static SkyboxGenerator* singletonPtr_s; 51 std::string skyboxPrefix_; 51 std::string skyboxPrefix_; 52 52 bool takeScreenshot_; 53 53 int iterateOverDirections_; -
code/branches/presentation3/src/modules/objects/Planet.cc
r7104 r7127 105 105 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 106 106 this->mesh_.setVisible(this->isVisible()); 107 107 108 108 float scaleFactor = this->getScale(); 109 109 110 110 #if OGRE_VERSION >= 0x010700 111 111 Ogre::Mesh::LodValueList distList; … … 113 113 Ogre::Mesh::LodDistanceList distList; 114 114 #endif 115 115 116 116 distList.push_back(10.0f*scaleFactor); 117 117 distList.push_back(19.0f*scaleFactor); … … 124 124 distList.push_back(54.0f*scaleFactor); 125 125 distList.push_back(55.0f*scaleFactor); 126 126 127 127 float reductionValue = 0.2f; 128 128 129 129 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue); 130 130 billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0)); 131 131 132 132 this->attachOgreObject(this->billboard_.getBillboardSet()); 133 133 this->billboard_.getBillboardSet()->setUseAccurateFacing(true); -
code/branches/presentation3/src/modules/objects/eventsystem/EventListener.cc
r6856 r7127 61 61 return; 62 62 } 63 63 64 64 COUT(4) << "EventListener, processing event: originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << ")" << ", activate: " << event.activate_ << ", name: " << event.name_ << std::endl; 65 65 -
code/branches/presentation3/src/modules/objects/triggers/CheckPoint.cc
r7045 r7127 38 38 CreateFactory(CheckPoint); 39 39 40 CheckPoint::CheckPoint(BaseObject* creator) 40 CheckPoint::CheckPoint(BaseObject* creator) 41 41 : DistanceTrigger(creator) 42 42 , RadarViewable(creator, static_cast<WorldEntity*>(this)) -
code/branches/presentation3/src/modules/objects/triggers/DistanceMultiTrigger.cc
r6906 r7127 40 40 namespace orxonox 41 41 { 42 42 43 43 CreateFactory(DistanceMultiTrigger); 44 44 45 45 /** 46 46 @brief 47 Default Constructor. Registers the object and initializes default values. 47 Default Constructor. Registers the object and initializes default values. 48 48 */ 49 49 DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator) 50 50 { 51 51 RegisterObject(DistanceMultiTrigger); 52 52 53 53 this->distance_ = 100.0f; 54 54 this->targetName_ = BLANKSTRING; … … 98 98 continue; 99 99 } 100 100 101 101 Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition(); 102 102 // If the object is no longer in range. … … 154 154 if(this->singleTargetMode_) 155 155 entity = entity->getParent(); 156 156 157 157 // If no queue has been created, yet. 158 158 if(queue == NULL) … … 166 166 } 167 167 } 168 168 169 169 return queue; 170 170 } 171 171 172 172 } -
code/branches/presentation3/src/modules/objects/triggers/DistanceMultiTrigger.h
r6906 r7127 56 56 class _ObjectsExport DistanceMultiTrigger : public MultiTrigger 57 57 { 58 58 59 59 public: 60 60 DistanceMultiTrigger(BaseObject* creator); //!< Default Constructor. Registers the object and initializes default values. 61 61 ~DistanceMultiTrigger(); //!< Destructor. 62 62 63 63 void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a DistanceMultiTrigger object through XML. 64 64 … … 75 75 inline const std::string& getTargetName(void) 76 76 { return this->targetName_; } 77 77 78 78 /** 79 79 @brief Set the distance at which the DistanceMultiTrigger triggers. … … 88 88 inline float getDistance() const 89 89 { return this->distance_; } 90 90 91 91 protected: 92 92 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. … … 106 106 inline bool removeFromRange(WorldEntity* entity) 107 107 { WeakPtr<WorldEntity>* weakptr = this->range_.find(entity)->second; bool erased = this->range_.erase(entity) > 0; if(erased) delete weakptr; return erased; } 108 108 109 109 private: 110 110 float distance_; //!< The distance at which the DistanceMultiTrigger triggers. 111 111 std::string targetName_; //!< The target name, used in singleTargetMode. 112 112 bool singleTargetMode_; //!< To indicate whe the MultiDistanceTrigger is in single-target-mode. 113 113 114 114 std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger. 115 115 116 116 }; 117 117 118 118 } 119 119 -
code/branches/presentation3/src/modules/objects/triggers/DistanceTrigger.cc
r6935 r7127 136 136 continue; 137 137 } 138 138 139 139 Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition(); 140 140 if (distanceVec.length() < this->distance_) -
code/branches/presentation3/src/modules/objects/triggers/DistanceTriggerBeacon.cc
r6906 r7127 35 35 36 36 CreateFactory(DistanceTriggerBeacon); 37 37 38 38 DistanceTriggerBeacon::DistanceTriggerBeacon(BaseObject* creator) : StaticEntity(creator) 39 39 { 40 40 RegisterObject(DistanceTriggerBeacon); 41 41 } 42 42 43 43 } -
code/branches/presentation3/src/modules/objects/triggers/DistanceTriggerBeacon.h
r6906 r7127 39 39 class _ObjectsExport DistanceTriggerBeacon : public StaticEntity 40 40 { 41 41 42 42 public: 43 43 -
code/branches/presentation3/src/modules/objects/triggers/EventMultiTrigger.cc
r6864 r7127 52 52 EventMultiTrigger::~EventMultiTrigger() 53 53 { 54 54 55 55 } 56 56 … … 61 61 this->setBroadcast(true); 62 62 } 63 63 64 64 void EventMultiTrigger::XMLEventPort(Element& xmlelement, XMLPort::Mode mode) 65 65 { -
code/branches/presentation3/src/modules/objects/triggers/EventMultiTrigger.h
r6864 r7127 44 44 class _ObjectsExport EventMultiTrigger : public MultiTrigger 45 45 { 46 46 47 47 public: 48 48 EventMultiTrigger(BaseObject* creator); -
code/branches/presentation3/src/modules/objects/triggers/MultiTrigger.cc
r6864 r7127 47 47 /*static*/ const std::string MultiTrigger::or_s = "or"; 48 48 /*static*/ const std::string MultiTrigger::xor_s = "xor"; 49 49 50 50 CreateFactory(MultiTrigger); 51 51 … … 65 65 this->bSwitch_ = false; 66 66 this->bStayActive_ = false; 67 67 68 68 this->remainingActivations_ = INF_s; 69 69 this->maxNumSimultaniousTriggerers_ = INF_s; … … 75 75 76 76 this->parentTrigger_ = NULL; 77 77 78 78 this->targetMask_.exclude(Class(BaseObject)); 79 79 80 80 this->setSyncMode(0x0); 81 81 } 82 82 83 83 /** 84 84 @brief … … 95 95 } 96 96 } 97 97 98 98 /** 99 99 @brief … … 117 117 //TODO: Maybe nicer with explicit subgroup, e.g. triggers 118 118 XMLPortObject(MultiTrigger, MultiTrigger, "", addTrigger, getTrigger, xmlelement, mode); 119 119 120 120 COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") created." << std::endl; 121 121 } 122 122 123 123 124 124 /** … … 131 131 { 132 132 // If this is the first tick. 133 //TODO: Determine need for this, else kick it out. 133 //TODO: Determine need for this, else kick it out. 134 134 if(this->bFirstTick_) 135 135 { … … 174 174 delete state; 175 175 } 176 176 177 177 queue->pop(); 178 178 } … … 185 185 MultiTriggerState* state; 186 186 float timeRemaining; 187 187 188 188 // Go through all pending states. 189 189 for(int size = this->stateQueue_.size(); size >= 1; size--) … … 212 212 this->triggered_.erase(state->originator); 213 213 } 214 214 215 215 bStateChanged = true; 216 216 } … … 229 229 230 230 bool bFire = true; 231 231 232 232 // Add the originator to the objects activating this MultiTrigger. 233 233 if(bActive == true) … … 266 266 else 267 267 this->fire(bActive, state->originator); 268 268 269 269 bStateChanged = true; 270 270 } … … 289 289 } 290 290 } 291 291 292 292 // Remove the state from the state queue. 293 293 this->stateQueue_.pop_front(); … … 509 509 return returnVal; 510 510 } 511 511 512 512 return true; 513 513 } 514 514 515 515 /** 516 516 @brief … … 547 547 return; 548 548 } 549 549 550 550 MultiTriggerContainer* container = new MultiTriggerContainer(this, this, originator); 551 551 this->fireEvent(status, container); … … 563 563 { 564 564 ClassTreeMask& targetMask = this->getTargetMask(); 565 565 566 566 for(ClassTreeMaskObjectIterator it = targetMask.begin(); it != targetMask.end(); ++it) 567 567 { … … 580 580 { 581 581 assert(state); 582 582 583 583 // If the originator is no target of this MultiTrigger. 584 584 if(!this->isTarget(state->originator)) 585 585 return false; 586 586 587 587 // Add it ot the state queue. 588 588 this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->delay_, state)); -
code/branches/presentation3/src/modules/objects/triggers/MultiTrigger.h
r6864 r7127 94 94 MultiTrigger(BaseObject* creator); //!< Constructor. Registers the objects and initializes default values. 95 95 ~MultiTrigger(); //!< Destructor. 96 96 97 97 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a MultiTrigger object through XML. 98 98 virtual void tick(float dt); //!< A method that is executed each tick. 99 99 100 100 bool isActive(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is active for a given object. 101 101 … … 215 215 void addTargets(const std::string& targets); //!< Add some target to the MultiTrigger. 216 216 void removeTargets(const std::string& targets); //!< Remove some target from the MultiTrigger. 217 217 218 218 void addTrigger(MultiTrigger* trigger); //!< Adds a MultiTrigger as a sub-trigger to the trigger. 219 219 const MultiTrigger* getTrigger(unsigned int index) const; //!< Get the sub-trigger of this MultiTrigger at the given index. 220 220 221 221 protected: 222 222 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. 223 223 224 224 void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator. 225 225 226 226 bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whetherx the MultiTrigger is triggered concerning it's sub-triggers. 227 227 bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object. … … 236 236 inline void addParentTrigger(MultiTrigger* parent) 237 237 { this->parentTrigger_ = parent; } 238 238 239 239 /** 240 240 @brief Get the target mask used to identify the targets of this MultiTrigger. … … 248 248 //TODO: Check if something mus be done here. 249 249 virtual void notifyMaskUpdate(void) {} 250 250 251 251 private: 252 252 static const int INF_s; //!< Magic number for infinity. … … 257 257 258 258 void subTrigggerActivityChanged(BaseObject* originator); //!< This method is called by any sub-trigger to advertise changes in it's state to it's parent-trigger. 259 259 260 260 bool addState(MultiTriggerState* state); //!< Helper method. Adds a state to the state queue, where the state will wait to become active. 261 261 262 262 bool checkAnd(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'and' mode for a given object. 263 263 bool checkOr(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'or' mode for a given object. … … 276 276 bool bSwitch_; //!< Bool for the switch-mode, if true the MultiTrigger behaves like a switch. 277 277 bool bStayActive_; //!< Bool for the stay-active-mode, if true the MultiTrigger stays active after its last activation.; 278 278 279 279 int remainingActivations_; //!< The remaining activations of this MultiTrigger. 280 280 int maxNumSimultaniousTriggerers_; //!< The maximum number of objects simultaniously trigggering this MultiTrigger. … … 287 287 MultiTrigger* parentTrigger_; 288 288 std::set<MultiTrigger*> subTriggers_; //!< The sub-triggers of this MultiTrigger. 289 289 290 290 std::set<BaseObject*> active_; //!< The set of all objects the MultiTrigger is active for. 291 291 std::set<BaseObject*> triggered_; //!< The set of all objects the MultiTrigger is triggered for. 292 292 293 293 std::deque< std::pair<float, MultiTriggerState*> > stateQueue_; //!< The queue of states waiting to become active. 294 294 295 295 ClassTreeMask targetMask_; //!< The target mask, masking all objects that can trigger this MultiTrigger. 296 296 297 297 }; 298 298 -
code/branches/presentation3/src/modules/objects/triggers/MultiTriggerContainer.cc
r6859 r7127 40 40 41 41 CreateUnloadableFactory(MultiTriggerContainer); 42 42 43 43 /** 44 44 @brief … … 73 73 MultiTriggerContainer::~MultiTriggerContainer() 74 74 { 75 75 76 76 } 77 77 -
code/branches/presentation3/src/modules/objects/triggers/MultiTriggerContainer.h
r6856 r7127 50 50 class _ObjectsExport MultiTriggerContainer : public BaseObject 51 51 { 52 52 53 53 public: 54 54 MultiTriggerContainer(BaseObject* creator); //!< Default constructor. Registers the object and creates an empty container. … … 68 68 inline BaseObject* getData(void) 69 69 { return this->data_; } 70 70 71 71 private: 72 72 MultiTrigger* originator_; //!< The originator. 73 73 BaseObject* data_; //!< The data. 74 74 }; 75 75 76 76 } 77 77 -
code/branches/presentation3/src/modules/overlays/hud/GametypeFadingMessage.h
r7031 r7127 46 46 47 47 void fadingmessage(const GametypeInfo* gtinfo, const std::string& message); 48 48 49 49 private: 50 50 PlayerInfo* owner_; -
code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.cc
r7062 r7127 37 37 { 38 38 CreateFactory(GametypeStaticMessage); 39 40 39 40 41 41 GametypeStaticMessage::GametypeStaticMessage(BaseObject* creator) : OverlayText(creator) 42 42 { -
code/branches/presentation3/src/modules/overlays/hud/GametypeStaticMessage.h
r7062 r7127 49 49 50 50 void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour); 51 51 52 52 private: 53 53 PlayerInfo* owner_; -
code/branches/presentation3/src/modules/overlays/hud/GametypeStatus.cc
r6994 r7127 39 39 namespace orxonox 40 40 { 41 CreateFactory(GametypeStatus); 41 CreateFactory(GametypeStatus); 42 42 43 /*static*/ bool GametypeStatus::noCaption_s = false; 43 /*static*/ bool GametypeStatus::noCaption_s = false; 44 44 SetConsoleCommand(GametypeStatus, setGametypeStatus, true); 45 45 … … 109 109 GametypeStatus::noCaption_s = !bValue; 110 110 } 111 111 112 112 } -
code/branches/presentation3/src/modules/overlays/hud/GametypeStatus.h
r6994 r7127 51 51 PlayerInfo* owner_; 52 52 static bool noCaption_s; 53 53 54 54 }; 55 55 } -
code/branches/presentation3/src/modules/overlays/hud/HUDNavigation.cc
r7109 r7127 402 402 void HUDNavigation::changedOwner() 403 403 { 404 404 405 405 const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 406 406 for ( std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it ) -
code/branches/presentation3/src/modules/overlays/hud/HUDNavigation.h
r7051 r7127 50 50 51 51 void setConfigValues(); 52 52 53 53 virtual void XMLPort ( Element& xmlElement, XMLPort::Mode mode ); 54 54 virtual void tick ( float dt ); … … 76 76 77 77 }; 78 78 79 79 bool showObject( RadarViewable* rv ); 80 80 -
code/branches/presentation3/src/modules/overlays/hud/HUDRadar.cc
r6984 r7127 45 45 namespace orxonox 46 46 { 47 CreateFactory(HUDRadar); 47 CreateFactory(HUDRadar); 48 48 49 49 HUDRadar::HUDRadar(BaseObject* creator) -
code/branches/presentation3/src/modules/overlays/hud/HUDRadar.h
r6942 r7127 69 69 virtual void objectChanged( RadarViewable* rv ); 70 70 void radarTick(float dt); 71 71 72 72 void gatherObjects(); 73 73 -
code/branches/presentation3/src/modules/pickup/DroppedPickup.cc
r6540 r7127 41 41 namespace orxonox 42 42 { 43 43 44 44 CreateFactory(DroppedPickup); 45 45 46 46 /** 47 47 @brief … … 51 51 { 52 52 RegisterObject(DroppedPickup); 53 53 54 54 } 55 55 … … 67 67 */ 68 68 DroppedPickup::DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) : PickupSpawner(creator, pickup, triggerDistance, 5, 1) 69 { 69 { 70 70 RegisterObject(DroppedPickup); 71 71 72 72 this->setPosition(carrier->getCarrierPosition()); 73 73 this->setActive(false); 74 74 75 75 //TODO: Do more elegantly. 76 76 this->startRespawnTimer(); -
code/branches/presentation3/src/modules/pickup/DroppedPickup.h
r6540 r7127 41 41 namespace orxonox 42 42 { 43 43 44 44 /** 45 45 @brief -
code/branches/presentation3/src/modules/pickup/Pickup.h
r7008 r7127 165 165 private: 166 166 void initialize(void); //!< Initializes the member variables. 167 167 168 168 //TODO: Problems, when there are more Timers needed? Solutions? 169 169 Timer durationTimer_; //!< Timer at the disposal of each Class implementing Pickup. -
code/branches/presentation3/src/modules/pickup/PickupCollection.cc
r7094 r7127 42 42 namespace orxonox 43 43 { 44 44 45 45 CreateFactory(PickupCollection); 46 46 … … 52 52 { 53 53 RegisterObject(PickupCollection); 54 54 55 55 this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier(this); 56 56 } 57 57 58 58 /** 59 59 @brief … … 69 69 } 70 70 } 71 71 72 72 /** 73 73 @brief … … 77 77 { 78 78 SUPER(PickupCollection, XMLPort, xmlelement, mode); 79 79 80 80 XMLPortObject(PickupCollection, Pickupable, "pickupables", addPickupable, getPickupable, xmlelement, mode); 81 81 82 82 this->initializeIdentifier(); 83 83 } 84 84 85 85 /** 86 86 @brief … … 94 94 } 95 95 } 96 96 97 97 /** 98 98 @brief … … 103 103 { 104 104 SUPER(PickupCollection, changedUsed); 105 105 106 106 //! Change used for all Pickupables this PickupCollection consists of. 107 107 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) … … 110 110 } 111 111 } 112 112 113 113 /** 114 114 @brief … … 119 119 { 120 120 SUPER(PickupCollection, changedCarrier); 121 121 122 122 //! Change the PickupCarrier for all Pickupables this PickupCollection consists of. 123 123 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) … … 126 126 } 127 127 } 128 128 129 129 /** 130 130 @brief … … 135 135 { 136 136 SUPER(PickupCollection, changedPickedUp); 137 137 138 138 //! Change the pickedUp status for all Pickupables this PickupCollection consists of. 139 139 for(std::vector<WeakPtr<Pickupable> >::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++) … … 142 142 } 143 143 } 144 144 145 145 /** 146 146 @brief … … 154 154 if(item == NULL) 155 155 item = new PickupCollection(this); 156 156 157 157 SUPER(PickupCollection, clone, item); 158 158 159 159 PickupCollection* pickup = dynamic_cast<PickupCollection*>(item); 160 160 //! Clone all Pickupables this PickupCollection consist of. … … 167 167 pickup->initializeIdentifier(); 168 168 } 169 169 170 170 /** 171 171 @brief … … 183 183 return false; 184 184 } 185 185 186 186 return true; 187 187 } 188 188 189 189 /** 190 190 @brief … … 198 198 return this->pickupCollectionIdentifier_; 199 199 } 200 200 201 201 /** 202 202 @brief … … 211 211 if(pickup == NULL) 212 212 return false; 213 213 214 214 WeakPtr<Pickupable> ptr = pickup; //!< Create a weak pointer to be able to test in the constructor if the Pointer is still valid. 215 215 this->pickups_.push_back(ptr); 216 216 return true; 217 217 } 218 218 219 219 /** 220 220 @brief … … 229 229 return this->pickups_[index].get(); 230 230 } 231 231 232 232 /** 233 233 @brief … … 245 245 return true; 246 246 } 247 247 248 248 } -
code/branches/presentation3/src/modules/pickup/PickupCollection.h
r6731 r7127 53 53 class _PickupExport PickupCollection : public Pickupable, public BaseObject 54 54 { 55 55 56 56 public: 57 57 58 58 PickupCollection(BaseObject* creator); //!< Default Constructor. 59 59 virtual ~PickupCollection(); //!< Destructor. 60 60 61 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates an instance of this Class through XML. 62 62 … … 64 64 virtual void changedCarrier(void); //!< Is called when the pickup has changed its PickupCarrier. 65 65 virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around. 66 66 67 67 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 68 68 69 69 virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 70 70 71 71 virtual const PickupIdentifier* getPickupIdentifier(void); //!< Get the PickupIdentifier of this PickupCollection. 72 72 73 73 bool addPickupable(Pickupable* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection. 74 74 const Pickupable* getPickupable(unsigned int index); //!< Get the Pickupable at the given index. 75 75 76 76 protected: 77 77 void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup. 78 78 79 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. 82 82 83 83 private: 84 84 85 85 std::vector<WeakPtr<Pickupable> > pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 86 86 87 87 }; 88 88 89 89 } 90 90 -
code/branches/presentation3/src/modules/pickup/PickupCollectionIdentifier.cc
r6538 r7127 38 38 namespace orxonox 39 39 { 40 40 41 41 /** 42 42 @brief … … 47 47 RegisterObject(PickupCollectionIdentifier); 48 48 } 49 49 50 50 /** 51 51 @brief … … 54 54 PickupCollectionIdentifier::~PickupCollectionIdentifier() 55 55 { 56 56 57 57 } 58 58 … … 70 70 PickupIdentifier* temp = const_cast<PickupIdentifier*>(identifier); 71 71 const PickupCollectionIdentifier* collectionIdentifier = dynamic_cast<PickupCollectionIdentifier*>(temp); 72 72 73 73 //! If the input PickupIdentifier 'identifier' is no PickupCollectionIdentifier then just the two PickupIdentifiers are compared. 74 74 if(collectionIdentifier == NULL) … … 76 76 return this->PickupIdentifier::compare(identifier); 77 77 } 78 78 79 79 //! If the number of Pickupables each of the two PickupCollectionIdentifiers contain differ, the one with less is considered smaller. 80 80 if(this->identifiers_.size() != collectionIdentifier->identifiers_.size()) 81 81 return this->identifiers_.size()-collectionIdentifier->identifiers_.size(); 82 82 83 83 //! Compare the Pickupables of the two PickupCollectionIdentifiers one after the other. the one with the first 'smaller' one is considered smaller. 84 84 std::set<const PickupIdentifier*, PickupIdentifierCompare>::const_iterator it2 = collectionIdentifier->identifiers_.begin(); 85 85 for(std::set<const PickupIdentifier*, PickupIdentifierCompare>::const_iterator it = this->identifiers_.begin(); it != this->identifiers_.end(); it++) 86 86 { 87 87 88 88 if((*it)->compare(*it2) < 0) 89 89 return -1; … … 91 91 return 1; 92 92 } 93 93 94 94 //! Means they are equal. 95 95 return 0; 96 96 } 97 97 98 98 /** 99 99 @brief … … 106 106 this->identifiers_.insert(identifier); 107 107 } 108 108 109 109 } 110 110 -
code/branches/presentation3/src/modules/pickup/PickupCollectionIdentifier.h
r6538 r7127 54 54 class _PickupExport PickupCollectionIdentifier : public PickupIdentifier 55 55 { 56 56 57 57 public: 58 58 PickupCollectionIdentifier(Pickupable* pickup); //!< Constructor. 59 59 ~PickupCollectionIdentifier(); //!< Destructor. 60 60 61 61 virtual int compare(const PickupIdentifier* identifier) const; //!< Compares a PickupCollectionIdentifier with a PickupIdentifier. 62 62 63 63 void addPickup(const PickupIdentifier* identifier); //!< Add a Pickupable to the PickupCollectionIdentifier. 64 64 65 65 private: 66 66 std::set<const PickupIdentifier*, PickupIdentifierCompare> identifiers_; //!< The set of PickupIdentifiers of the Pickupables the PickupCollection with this PickupCollectionIdentifier consists of, ordered by the rule set by PickupIdentifierCompare. 67 67 68 68 }; 69 69 70 70 } 71 71 -
code/branches/presentation3/src/modules/pickup/PickupManager.cc
r7110 r7127 51 51 // Register tolua_open function when loading the library 52 52 DeclareToluaInterface(Pickup); 53 53 54 54 ManageScopedSingleton(PickupManager, ScopeID::Root, false); 55 55 56 56 /*static*/ const std::string PickupManager::guiName_s = "PickupInventory"; 57 57 58 58 /** 59 59 @brief … … 69 69 } 70 70 this->defaultRepresentation_ = new PickupRepresentation(); 71 71 72 72 COUT(3) << "PickupManager created." << std::endl; 73 73 } 74 74 75 75 /** 76 76 @brief … … 82 82 if(this->defaultRepresentation_ != NULL) 83 83 this->defaultRepresentation_->destroy(); 84 84 85 85 this->representations_.clear(); 86 86 87 87 COUT(3) << "PickupManager destroyed." << std::endl; 88 88 } 89 89 90 90 /** 91 91 @brief … … 100 100 */ 101 101 bool PickupManager::registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation) 102 { 102 { 103 103 if(identifier == NULL || representation == NULL || this->representations_.find(identifier) != this->representations_.end()) //!< If the Pickupable already has a Representation registered. 104 104 return false; 105 105 106 106 this->representations_[identifier] = representation; 107 107 108 108 COUT(4) << "PickupRepresentation " << representation << " registered with the PickupManager." << std::endl; 109 109 return true; 110 110 } 111 111 112 112 /** 113 113 @brief … … 121 121 */ 122 122 bool PickupManager::unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation) 123 { 123 { 124 124 if(identifier == NULL || representation == NULL) 125 125 return false; 126 126 127 127 std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare>::iterator it = this->representations_.find(identifier); 128 128 if(it == this->representations_.end()) //!< If the Pickupable is not registered in the first place. 129 129 return false; 130 130 131 131 this->representations_.erase(it); 132 132 133 133 COUT(4) << "PickupRepresentation " << representation << " unregistered with the PickupManager." << std::endl; 134 134 return true; 135 135 } 136 136 137 137 /** 138 138 @brief … … 151 151 return this->defaultRepresentation_; 152 152 } 153 153 154 154 return it->second; 155 155 } … … 158 158 { 159 159 this->pickupsList_.clear(); 160 160 161 161 PlayerInfo* player = GUIManager::getInstance().getPlayer(PickupManager::guiName_s); 162 162 PickupCarrier* carrier = NULL; … … 221 221 if(pickup == NULL || it == this->pickupsList_.end() || it->second.get() == NULL) 222 222 return; 223 223 224 224 if(!pickup->isPickedUp()) 225 225 return; … … 229 229 pickup->setUsed(use); 230 230 } 231 231 232 232 } -
code/branches/presentation3/src/modules/pickup/PickupManager.h
r6996 r7127 60 60 { // tolua_export 61 61 friend class Singleton<PickupManager>; 62 62 63 63 public: 64 64 PickupManager(); 65 65 virtual ~PickupManager(); 66 66 67 67 static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); } // tolua_export 68 68 69 69 bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents. 70 70 bool unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents. 71 71 PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier. 72 72 73 73 // tolua_begin 74 74 int getNumPickups(void); … … 80 80 bool isValidPickup(orxonox::Pickupable* pickup) { std::map<Pickupable*, WeakPtr<Pickupable> >::iterator it = this->pickupsList_.find(pickup); if(it == this->pickupsList_.end()) return false; return it->second.get() != NULL; } 81 81 // tolua_end 82 82 83 83 private: 84 84 static PickupManager* singletonPtr_s; 85 85 static const std::string guiName_s; 86 86 87 87 PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation. 88 88 std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types if Pickupables) and PickupRepresentations. … … 92 92 93 93 std::vector<PickupCarrier*>* getAllCarriers(PickupCarrier* carrier); 94 94 95 95 }; // tolua_export 96 96 97 97 } // tolua_export 98 98 -
code/branches/presentation3/src/modules/pickup/PickupPrereqs.h
r7034 r7127 65 65 namespace orxonox 66 66 { 67 67 68 68 class DroppedPickup; 69 69 class Pickup; -
code/branches/presentation3/src/modules/pickup/PickupRepresentation.cc
r6725 r7127 41 41 namespace orxonox 42 42 { 43 43 44 44 CreateFactory(PickupRepresentation); 45 45 46 46 /** 47 47 @brief … … 52 52 { 53 53 RegisterObject(PickupRepresentation); 54 54 55 55 this->initialize(); 56 56 } 57 57 58 58 /** 59 59 @brief … … 63 63 { 64 64 RegisterObject(PickupRepresentation); 65 65 66 66 this->initialize(); 67 67 } 68 68 69 69 /** 70 70 @brief … … 75 75 if(this->spawnerRepresentation_ != NULL) 76 76 this->spawnerRepresentation_->destroy(); 77 77 78 78 if(this->pickup_ != NULL) 79 79 PickupManager::getInstance().unregisterRepresentation(this->pickup_->getPickupIdentifier(), this); 80 80 } 81 81 82 82 /** 83 83 @brief … … 91 91 this->inventoryRepresentation_ = "Default"; 92 92 } 93 93 94 94 /** 95 95 @brief … … 99 99 { 100 100 SUPER(PickupRepresentation, XMLPort, xmlelement, mode); 101 101 102 102 XMLPortParam(PickupRepresentation, "pickupName", setPickupName, getPickupName, xmlelement, mode); 103 103 XMLPortParam(PickupRepresentation, "pickupDescription", setPickupDescription, getPickupDescription, xmlelement, mode); … … 106 106 XMLPortObject(PickupRepresentation, Pickupable, "pickup", setPickup, getPickup, xmlelement, mode); 107 107 XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode); 108 108 109 109 PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this); //!< Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents. 110 110 111 111 if(this->spawnerRepresentation_ != NULL) 112 112 this->spawnerRepresentation_->setVisible(false); 113 113 114 114 COUT(4) << "PickupRepresentation created: name: '" << this->name_ << "', description: '" << this->description_ << "', spawnerTemplate: '" << this->spawnerTemplate_ << "'." << std::endl; 115 115 } 116 116 117 117 /** 118 118 @brief … … 136 136 this->addTemplate(this->spawnerTemplate_); 137 137 } 138 138 139 139 StaticEntity* representation = this->spawnerRepresentation_; 140 140 representation->setVisible(true); 141 141 142 142 this->addTemplate(this->spawnerTemplate_); 143 143 this->spawnerRepresentation_->setVisible(false); 144 144 145 145 return representation; 146 146 } 147 147 148 148 /** 149 149 @brief … … 171 171 return representation; 172 172 } 173 173 174 174 } -
code/branches/presentation3/src/modules/pickup/PickupRepresentation.h
r6711 r7127 56 56 : public BaseObject 57 57 { // tolua_export 58 58 59 59 public: 60 60 PickupRepresentation(); //!< Constructor 61 61 PickupRepresentation(BaseObject* creator); //!< Default constructor. 62 62 virtual ~PickupRepresentation(); //!< Destructor. 63 63 64 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 65 65 66 66 /** 67 67 @brief Set the name of the Pickupable represented by this PickupRepresentation. … … 102 102 inline void setPickup(Pickupable* pickup) 103 103 { this->pickup_ = pickup; } 104 104 105 105 /** 106 106 @brief Get the name of the Pickupable represented by this PickupRepresentation. … … 138 138 inline const Pickupable* getPickup(unsigned int index) 139 139 { if(index == 0) return this->pickup_; return NULL; } 140 140 141 141 StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner. 142 142 143 143 private: 144 144 void initialize(void); //!< Initializes the member variables of this PickupRepresentation. 145 145 StaticEntity* getDefaultSpawnerRepresentation(PickupSpawner* spawner); //!< Get the default spawnerRepresentation for a specific PickupSpawner. 146 146 147 147 std::string name_; //!< The name of the Pickupable represented by this PickupRepresentation. 148 148 std::string description_; //!< The description of the Pickupable represented by this PickupRepresentation. … … 150 150 StaticEntity* spawnerRepresentation_; //!< The spawnerRepresentation of this PickupRepresentation. 151 151 std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory. TODO: Exact format and placement of image? 152 152 153 153 Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation. 154 154 155 155 }; // tolua_export 156 156 157 157 } // tolua_export 158 158 159 159 #endif // _PickupRepresentation_H__ -
code/branches/presentation3/src/modules/pickup/PickupSpawner.cc
r7086 r7127 55 55 { 56 56 RegisterObject(PickupSpawner); 57 57 58 58 this->initialize(); 59 59 } … … 76 76 { 77 77 RegisterObject(PickupSpawner); 78 78 79 79 this->initialize(); 80 80 81 81 this->pickup_ = pickup; 82 82 … … 84 84 this->respawnTime_ = respawnTime; 85 85 this->setMaxSpawnedItems(maxSpawnedItems); 86 86 87 87 if(this->pickup_ == NULL) 88 88 { … … 132 132 133 133 XMLPortObject(PickupSpawner, Pickupable, "pickup", setPickupable, getPickupable, xmlelement, mode); 134 134 135 135 XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode); 136 136 XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode); 137 137 XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode); 138 138 139 139 if(this->pickup_ == NULL) 140 140 { … … 150 150 } 151 151 } 152 152 153 153 /** 154 154 @brief … … 161 161 this->setVisible(this->isActive()); 162 162 } 163 163 164 164 /** 165 165 @brief … … 172 172 { 173 173 SUPER(PickupSpawner, tick, dt); 174 174 175 175 //! If the PickupSpawner is active. 176 176 if (this->isActive()) 177 177 { 178 178 SmartPtr<PickupSpawner> temp = this; // create a smart pointer to keep the PickupSpawner alive until we iterated through all Pawns (in case a Pawn takes the last pickup) 179 179 180 180 //! Iterate trough all Pawns. 181 181 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) … … 191 191 } 192 192 } 193 193 194 194 /** 195 195 @brief … … 203 203 this->spawnsRemaining_ = items; 204 204 } 205 205 206 206 /** 207 207 @brief … … 230 230 } 231 231 } 232 232 233 233 /** 234 234 @brief … … 239 239 this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this))); 240 240 } 241 241 242 242 /** 243 243 @brief … … 258 258 return; 259 259 } 260 260 261 261 this->pickup_ = pickup; 262 262 } 263 263 264 264 /** 265 265 @brief … … 285 285 { 286 286 COUT(4) << "PickupSpawner (&" << this << ") triggered and active." << std::endl; 287 287 288 288 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn); 289 289 if(carrier == NULL) … … 292 292 return; 293 293 } 294 294 295 295 if(!carrier->isTarget(this->pickup_)) 296 296 { … … 298 298 return; 299 299 } 300 300 301 301 PickupCarrier* target = carrier->getTarget(this->pickup_); 302 302 Pickupable* pickup = this->getPickup(); 303 303 304 304 if(target != NULL && pickup != NULL) 305 305 { … … 317 317 if(target == NULL) 318 318 COUT(1) << "PickupSpawner (&" << this << "): Pickupable has no target." << std::endl; 319 319 320 320 if(pickup == NULL) 321 321 { … … 335 335 @return 336 336 The Pickupable created. 337 */ 337 */ 338 338 Pickupable* PickupSpawner::getPickup(void) 339 339 { … … 343 343 return NULL; 344 344 } 345 345 346 346 Pickupable* pickup = this->pickup_->clone(); 347 347 return pickup; -
code/branches/presentation3/src/modules/pickup/PickupSpawner.h
r6540 r7127 101 101 protected: 102 102 void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns. 103 103 104 104 void startRespawnTimer(void); 105 105 106 106 virtual Pickupable* getPickup(void); //!< Creates a new Pickupable. 107 107 108 108 void setPickupable(Pickupable* pickup); //!< Sets a Pickupable for the PickupSpawner to spawn. 109 109 const Pickupable* getPickupable(void); //!< Get the Pickupable that is spawned by this PickupSpawner. 110 110 111 111 Pickupable* pickup_; //!< The pickup to be spawned. 112 112 113 113 private: 114 114 void initialize(void); 115 115 116 116 void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough. 117 117 void respawnTimerCallback(); //!< Method called when the timer runs out. -
code/branches/presentation3/src/modules/pickup/items/DronePickup.cc
r7034 r7127 49 49 50 50 CreateFactory(DronePickup); 51 51 52 52 /** 53 53 @brief … … 57 57 { 58 58 RegisterObject(DronePickup); 59 59 60 60 this->initialize(); 61 61 } 62 62 63 63 /** 64 64 @brief … … 67 67 DronePickup::~DronePickup() 68 68 { 69 69 70 70 } 71 71 72 72 /** 73 @brief 73 @brief 74 74 Initializes the member variables. 75 75 */ … … 80 80 this->droneTemplate_ = ""; 81 81 } 82 82 83 83 /** 84 84 @brief … … 91 91 this->pickupIdentifier_->addParameter(type, val); 92 92 } 93 93 94 94 /** 95 95 @brief … … 100 100 SUPER(DronePickup, XMLPort, xmlelement, mode); 101 101 XMLPortParam(DronePickup, "droneTemplate", setDroneTemplate, getDroneTemplate, xmlelement, mode); 102 102 103 103 this->initializeIdentifier(); 104 104 } 105 105 106 106 void DronePickup::setDroneTemplate(std::string templatename){ 107 107 droneTemplate_ = templatename; 108 } 109 108 } 109 110 110 const std::string& DronePickup::getDroneTemplate() const 111 111 { … … 120 120 { 121 121 SUPER(DronePickup, changedUsed); 122 122 123 123 //! If the pickup is not picked up nothing must be done. 124 124 if(!this->isPickedUp()) 125 125 return; 126 126 127 127 //! If the pickup has transited to used. 128 128 if(this->isUsed()) … … 132 132 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 133 133 this->destroy(); 134 134 135 135 //Attach to pawn 136 136 Drone* drone = new Drone(pawn->getCreator()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something) … … 143 143 droneController->setOwner(pawn); 144 144 } 145 145 146 146 Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30); 147 147 drone->setPosition(spawnPosition); 148 148 149 149 //! The pickup has been used up. 150 150 this->setUsed(false); … … 159 159 } 160 160 } 161 161 162 162 /** 163 163 @brief … … 170 170 PickupCarrier* carrier = this->getCarrier(); 171 171 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 172 172 173 173 if(pawn == NULL) 174 174 { 175 175 COUT(1) << "Invalid PickupCarrier in DronePickup." << std::endl; 176 176 } 177 177 178 178 return pawn; 179 179 } 180 180 181 181 /** 182 182 @brief … … 189 189 if(item == NULL) 190 190 item = new DronePickup(this); 191 191 192 192 SUPER(DronePickup, clone, item); 193 193 194 194 DronePickup* pickup = dynamic_cast<DronePickup*>(item); 195 195 pickup->setDroneTemplate(this->getDroneTemplate()); 196 196 197 197 pickup->initializeIdentifier(); 198 198 } -
code/branches/presentation3/src/modules/pickup/items/DronePickup.h
r7034 r7127 47 47 48 48 namespace orxonox { 49 49 50 50 51 51 class _PickupExport DronePickup : public Pickup, public Tickable 52 52 { 53 53 public: 54 54 55 55 DronePickup(BaseObject* creator); //!< Constructor. 56 56 virtual ~DronePickup(); //!< Destructor. 57 57 58 58 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DronePickup object through XML. 59 59 60 60 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 61 61 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 62 62 63 63 void setDroneTemplate(std::string templatename); 64 const std::string& getDroneTemplate() const; 65 64 const std::string& getDroneTemplate() const; 65 66 66 protected: 67 67 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 68 68 69 69 private: 70 70 void initialize(void); //!< Initializes the member variables. 71 71 std::string droneTemplate_; 72 72 Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 73 74 73 75 74 75 76 76 }; 77 77 } -
code/branches/presentation3/src/modules/pickup/items/HealthPickup.cc
r7008 r7127 45 45 namespace orxonox 46 46 { 47 47 48 48 /*static*/ const std::string HealthPickup::healthTypeLimited_s = "limited"; 49 49 /*static*/ const std::string HealthPickup::healthTypeTemporary_s = "temporary"; 50 50 /*static*/ const std::string HealthPickup::healthTypePermanent_s = "permanent"; 51 51 52 52 CreateFactory(HealthPickup); 53 53 54 54 /** 55 55 @brief … … 59 59 { 60 60 RegisterObject(HealthPickup); 61 61 62 62 this->initialize(); 63 63 } 64 64 65 65 /** 66 66 @brief … … 69 69 HealthPickup::~HealthPickup() 70 70 { 71 72 } 73 74 /** 75 @brief 71 72 } 73 74 /** 75 @brief 76 76 Initializes the member variables. 77 77 */ 78 78 void HealthPickup::initialize(void) 79 { 79 { 80 80 this->health_ = 0; 81 81 this->healthRate_ = 0; … … 83 83 this->maxHealthSave_ = 0; 84 84 this->maxHealthOverwrite_ = 0; 85 85 86 86 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 87 87 } 88 88 89 89 /** 90 90 @brief … … 98 98 std::string val1 = stream.str(); 99 99 this->pickupIdentifier_->addParameter(type1, val1); 100 100 101 101 std::string val2 = this->getHealthType(); 102 102 std::string type2 = "healthType"; 103 103 this->pickupIdentifier_->addParameter(type2, val2); 104 104 105 105 stream.clear(); 106 106 stream << this->getHealthRate(); … … 109 109 this->pickupIdentifier_->addParameter(type3, val3); 110 110 } 111 111 112 112 /** 113 113 @brief … … 117 117 { 118 118 SUPER(HealthPickup, XMLPort, xmlelement, mode); 119 119 120 120 XMLPortParam(HealthPickup, "health", setHealth, getHealth, xmlelement, mode); 121 121 XMLPortParam(HealthPickup, "healthRate", setHealthRate, getHealthRate, xmlelement, mode); 122 122 XMLPortParam(HealthPickup, "healthType", setHealthType, getHealthType, xmlelement, mode); 123 123 124 124 if(!this->isContinuous()) 125 125 this->healthRate_ = 0.0; 126 126 127 127 this->initializeIdentifier(); 128 128 } 129 129 130 130 /** 131 131 @brief … … 138 138 { 139 139 SUPER(HealthPickup, tick, dt); 140 140 141 141 if(this->isContinuous() && this->isUsed()) 142 142 { … … 144 144 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 145 145 this->destroy(); 146 146 147 147 //! Calculate the health that is added this tick. 148 148 float health = dt*this->getHealthRate(); … … 152 152 float fullHealth = pawn->getHealth() + health; 153 153 this->setHealth(this->getHealth()-health); 154 154 155 155 switch(this->getHealthTypeDirect()) 156 156 { … … 173 173 COUT(1) << "Invalid healthType in HealthPickup." << std::endl; 174 174 } 175 175 176 176 //! If all health has been transfered. 177 177 if(this->getHealth() == 0) … … 181 181 } 182 182 } 183 183 184 184 /** 185 185 @brief … … 193 193 if(!this->isPickedUp()) 194 194 return; 195 195 196 196 //! If the pickup has transited to used. 197 197 if(this->isUsed()) … … 202 202 if(pawn == NULL) //!< If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 203 203 this->destroy(); 204 204 205 205 float health = 0; 206 206 switch(this->getHealthTypeDirect()) … … 226 226 COUT(1) << "Invalid healthType in HealthPickup." << std::endl; 227 227 } 228 228 229 229 //! The pickup has been used up. 230 230 this->setUsed(false); … … 237 237 PickupCarrier* carrier = this->getCarrier(); 238 238 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 239 239 240 240 if(pawn == NULL) 241 241 { … … 244 244 return; 245 245 } 246 246 247 247 if(pawn->getMaxHealth() == this->maxHealthOverwrite_) 248 248 { … … 252 252 } 253 253 } 254 254 255 255 //! If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused. 256 256 if(this->isOnce() || (this->isContinuous() && this->getHealth() == 0)) … … 260 260 } 261 261 } 262 262 263 263 /** 264 264 @brief … … 271 271 PickupCarrier* carrier = this->getCarrier(); 272 272 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 273 273 274 274 if(pawn == NULL) 275 275 { 276 276 COUT(1) << "Invalid PickupCarrier in HealthPickup." << std::endl; 277 277 } 278 278 279 279 return pawn; 280 280 } 281 281 282 282 /** 283 283 @brief … … 297 297 pickup->setHealthRate(this->getHealthRate()); 298 298 pickup->setHealthTypeDirect(this->getHealthTypeDirect()); 299 299 300 300 pickup->initializeIdentifier(); 301 301 } 302 302 303 303 /** 304 304 @brief … … 322 322 } 323 323 } 324 324 325 325 /** 326 326 @brief … … 341 341 } 342 342 } 343 343 344 344 /** 345 345 @brief … … 356 356 else 357 357 { 358 COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl; 359 } 360 } 361 358 COUT(1) << "Invalid healthSpeed in HealthPickup." << std::endl; 359 } 360 } 361 362 362 /** 363 363 @brief -
code/branches/presentation3/src/modules/pickup/items/HealthPickup.h
r6709 r7127 45 45 46 46 namespace orxonox { 47 47 48 48 //! Enum for the type of the HealthPickup 49 49 namespace pickupHealthType … … 56 56 }; 57 57 } 58 58 59 59 /** 60 60 @brief … … 71 71 { 72 72 public: 73 73 74 74 HealthPickup(BaseObject* creator); //!< Constructor. 75 75 virtual ~HealthPickup(); //!< Destructor. 76 76 77 77 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML. 78 78 virtual void tick(float dt); //!< Is called every tick. 79 79 80 80 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 81 81 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 82 82 83 83 /** 84 84 @brief Get the health that is transfered to the Pawn upon usage of this pickup. … … 93 93 inline float getHealthRate(void) 94 94 { return this->healthRate_; } 95 95 96 96 /** 97 97 @brief Get the type of HealthPickup, this pickup is. 98 @return Returns the health type as an enum. 98 @return Returns the health type as an enum. 99 99 */ 100 100 inline pickupHealthType::Value getHealthTypeDirect(void) 101 101 { return this->healthType_; } 102 102 const std::string& getHealthType(void); //!< Get the health type of this pickup. 103 103 104 104 protected: 105 105 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. … … 107 107 void setHealth(float health); //!< Sets the health. 108 108 void setHealthRate(float speed); //!< Set the rate at which health is transferred if the pickup is continuous. 109 109 110 110 /** 111 111 @brief Set the health type of this pickup. … … 115 115 { this->healthType_ = type; } 116 116 void setHealthType(std::string type); //!< Set the type of the HealthPickup. 117 117 118 118 private: 119 119 void initialize(void); //!< Initializes the member variables. 120 120 Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 121 121 122 122 float health_; //!< The health that is transferred to the Pawn. 123 123 float healthRate_; //!< The rate at which the health is transferred. … … 125 125 float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well. 126 126 pickupHealthType::Value healthType_; //!< The type of the HealthPickup. 127 127 128 128 //! Strings for the health types. 129 129 static const std::string healthTypeLimited_s; 130 130 static const std::string healthTypeTemporary_s; 131 131 static const std::string healthTypePermanent_s; 132 132 133 133 }; 134 134 } -
code/branches/presentation3/src/modules/pickup/items/InvisiblePickup.h
r7112 r7127 44 44 45 45 namespace orxonox { 46 46 47 47 /** 48 48 @brief … … 57 57 { 58 58 public: 59 59 60 60 InvisiblePickup(BaseObject* creator); //!< Constructor. 61 61 virtual ~InvisiblePickup(); //!< Destructor. … … 63 63 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 64 64 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 65 65 66 66 /** 67 67 @brief Checks whether the Pawn is invisible. … … 72 72 inline float getDuration() 73 73 { return this->duration_; } 74 74 75 75 protected: 76 76 bool setInvisible(bool invisibility); //!< Set the Pawn to be invisible or visible again. … … 78 78 void initializeIdentifier(void); 79 79 virtual void pickupTimerCallback(void); //!< Function that gets called when the timer ends. 80 80 81 81 private: 82 82 void initialize(void); //!< Initializes the member variables. -
code/branches/presentation3/src/modules/pickup/items/MetaPickup.cc
r6709 r7127 40 40 41 41 namespace orxonox { 42 42 43 43 CreateFactory(MetaPickup); 44 44 45 45 //! Setting the static variables to their values. 46 46 /*static*/ const std::string MetaPickup::metaTypeNone_s = "none"; 47 47 /*static*/ const std::string MetaPickup::metaTypeUse_s = "use"; 48 48 /*static*/ const std::string MetaPickup::metaTypeDrop_s = "drop"; 49 49 50 50 /** 51 51 @brief … … 55 55 { 56 56 RegisterObject(MetaPickup); 57 57 58 58 this->initialize(); 59 59 } 60 60 61 61 /** 62 62 @brief … … 65 65 MetaPickup::~MetaPickup() 66 66 { 67 68 } 69 67 68 } 69 70 70 /** 71 71 @brief … … 75 75 { 76 76 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 77 77 78 78 this->setActivationTypeDirect(pickupActivationType::immediate); 79 79 this->setDurationTypeDirect(pickupDurationType::once); 80 80 this->metaType_ = pickupMetaType::none; 81 81 } 82 82 83 83 /** 84 84 @brief … … 91 91 this->pickupIdentifier_->addParameter(type, val); 92 92 } 93 93 94 94 /** 95 95 @brief … … 99 99 { 100 100 SUPER(MetaPickup, XMLPort, xmlelement, mode); 101 101 102 102 XMLPortParam(MetaPickup, "metaType", setMetaType, getMetaType, xmlelement, mode); 103 103 104 104 this->initializeIdentifier(); 105 105 } 106 106 107 107 /** 108 108 @brief … … 113 113 { 114 114 SUPER(MetaPickup, changedUsed); 115 115 116 116 //! If the MetaPickup transited to used. 117 117 if(this->isUsed()) … … 144 144 } 145 145 } 146 146 147 147 /** 148 148 @brief … … 155 155 if(item == NULL) 156 156 item = new MetaPickup(this); 157 157 158 158 SUPER(MetaPickup, clone, item); 159 159 160 160 MetaPickup* pickup = dynamic_cast<MetaPickup*>(item); 161 161 pickup->setMetaTypeDirect(this->getMetaTypeDirect()); 162 162 163 163 pickup->initializeIdentifier(); 164 164 } 165 165 166 166 /** 167 167 @brief … … 184 184 } 185 185 } 186 186 187 187 /** 188 188 @brief … … 206 206 } 207 207 } 208 208 209 209 } -
code/branches/presentation3/src/modules/pickup/items/MetaPickup.h
r6709 r7127 51 51 }; 52 52 } 53 53 54 54 /** 55 55 @brief … … 60 60 class _PickupExport MetaPickup : public Pickup 61 61 { 62 62 63 63 public: 64 64 MetaPickup(BaseObject* creator); //!< Constructor. Registers and initializes the object. 65 65 virtual ~MetaPickup(); //!< Destructor. 66 66 67 67 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML. 68 68 69 69 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 70 70 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 71 71 72 72 /** 73 73 @brief Returns the meta type of the MetaPickup. … … 77 77 { return this->metaType_; } 78 78 const std::string& getMetaType(void); //!< Get the meta type of this MetaPickup. 79 79 80 80 protected: 81 81 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 82 82 83 83 /** 84 84 @brief Set the meta type of the MetaPickup. … … 88 88 { this->metaType_ = type; } 89 89 void setMetaType(const std::string& type); //!< Set the meta type of this MetaPickup. 90 90 91 91 private: 92 92 void initialize(void); //!< Initializes the member variables. 93 93 94 94 pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. 95 95 96 96 //! Static strings for the meta types. 97 97 static const std::string metaTypeNone_s; 98 98 static const std::string metaTypeUse_s; 99 99 static const std::string metaTypeDrop_s; 100 101 100 101 102 102 }; 103 103 -
code/branches/presentation3/src/modules/pickup/items/ShieldPickup.cc
r6998 r7127 79 79 PickupCarrier* carrier = this->getCarrier(); 80 80 Pawn* pawn = dynamic_cast<Pawn*>(carrier); 81 81 82 82 if(pawn == NULL) 83 83 { … … 86 86 return pawn; 87 87 } 88 88 89 89 /** 90 90 @brief … … 117 117 std::string val2 = stream.str(); 118 118 this->pickupIdentifier_->addParameter(type2, val2); 119 119 120 120 stream.clear(); 121 121 stream << this->getShieldAbsorption(); … … 269 269 270 270 void ShieldPickup::pickupTimerCallback(void) 271 { 271 { 272 272 this->setUsed(false); 273 273 } -
code/branches/presentation3/src/modules/pickup/items/SpeedPickup.cc
r6755 r7127 137 137 if(engine == NULL) //!< If the PickupCarrier is no Engine, then this pickup is useless and therefore is destroyed. 138 138 this->destroy(); 139 139 140 140 //! If the pickup has transited to used. 141 141 if(this->isUsed()) … … 156 156 engine->setSpeedAdd(0.0f); 157 157 engine->setSpeedMultiply(1.0f); 158 158 159 159 if(this->isOnce()) 160 160 { … … 186 186 COUT(1) << "Invalid PickupCarrier in SpeedPickup." << std::endl; 187 187 } 188 188 189 189 return engine; 190 190 } … … 269 269 270 270 void SpeedPickup::pickupTimerCallback(void) 271 { 271 { 272 272 this->setUsed(false); 273 273 } -
code/branches/presentation3/src/modules/pickup/items/SpeedPickup.h
r6709 r7127 78 78 protected: 79 79 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 80 80 81 81 virtual void pickupTimerCallback(void); //!< Function that gets called when timer ends. 82 82 -
code/branches/presentation3/src/modules/questsystem/Quest.h
r7072 r7127 105 105 virtual bool fail(PlayerInfo* player); //!< Fails the Quest. 106 106 virtual bool complete(PlayerInfo* player); //!< Completes the Quest. 107 107 108 108 bool addListener(QuestListener* listener); //!< Adds a QuestListener to the list of QuestListeners listening to this Quest. 109 109 -
code/branches/presentation3/src/modules/questsystem/QuestEffectBeacon.cc
r6945 r7127 112 112 MultiTriggerContainer* mTrigger = orxonox_cast<MultiTriggerContainer*>(trigger); 113 113 Pawn* pawn = NULL; 114 114 115 115 //! If the trigger is neither a Playertrigger nor a MultiTrigger (i.e. a MultitriggerContainer) we can do anything with it. 116 116 if(pTrigger == NULL && mTrigger == NULL) 117 117 return false; 118 119 // If the trigger is a PlayerTrigger. 118 119 // If the trigger is a PlayerTrigger. 120 120 if(pTrigger != NULL) 121 121 { … … 125 125 pawn = pTrigger->getTriggeringPlayer(); 126 126 } 127 127 128 128 // If the trigger is a MultiTrigger (i.e. a MultiTriggerContainer) 129 129 if(mTrigger != NULL) -
code/branches/presentation3/src/modules/questsystem/QuestItem.cc
r6945 r7127 42 42 43 43 CreateUnloadableFactory(QuestItem); 44 44 45 45 /** 46 46 @brief … … 50 50 { 51 51 this->registered_ = false; 52 52 53 53 RegisterObject(QuestItem); 54 54 } -
code/branches/presentation3/src/modules/questsystem/QuestManager.cc
r7072 r7127 74 74 QuestManager::~QuestManager() 75 75 { 76 76 77 77 } 78 78 … … 250 250 return numQuests; 251 251 } 252 252 253 253 Quest* QuestManager::getParentQuest(PlayerInfo* player, int index) 254 254 { … … 272 272 return numQuests; 273 273 } 274 274 275 275 Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index) 276 276 { … … 295 295 return numHints; 296 296 } 297 297 298 298 QuestHint* QuestManager::getHints(Quest* quest, PlayerInfo* player, int index) 299 299 { -
code/branches/presentation3/src/modules/questsystem/QuestNotification.cc
r6945 r7127 35 35 36 36 CreateUnloadableFactory(QuestNotification); 37 37 38 38 /** 39 39 @brief -
code/branches/presentation3/src/modules/questsystem/notifications/Notification.cc
r6945 r7127 41 41 42 42 CreateUnloadableFactory(Notification); 43 43 44 44 /** 45 45 @brief … … 69 69 Notification::~Notification() 70 70 { 71 71 72 72 } 73 73 -
code/branches/presentation3/src/modules/questsystem/notifications/NotificationManager.cc
r6945 r7127 66 66 NotificationManager::~NotificationManager() 67 67 { 68 68 69 69 } 70 70 … … 227 227 int identifier = this->listenerList_.find(listener)->second; 228 228 std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second; 229 229 230 230 // Make sure all Notifications are removed. 231 231 std::multimap<std::time_t, Notification*>::iterator it = map->begin(); -
code/branches/presentation3/src/modules/questsystem/notifications/NotificationQueue.cc
r6945 r7127 57 57 { 58 58 this->registered_ = false; 59 59 60 60 RegisterObject(NotificationQueue); 61 61 this->initialize(); … … 431 431 // Unregister the NotificationQueue with the NotificationManager. 432 432 NotificationManager::getInstance().unregisterNotification(container->notification, this); 433 433 434 434 this->removeElement(container->overlay); 435 435 this->containers_.erase(container); -
code/branches/presentation3/src/modules/weapons/RocketController.cc
r7021 r7127 28 28 29 29 #include "RocketController.h" 30 #include "projectiles/SimpleRocket.h" 30 #include "projectiles/SimpleRocket.h" 31 31 #include "util/Math.h" 32 32 #include "weapons/projectiles/SimpleRocket.h" … … 66 66 this->moveToTargetPosition(); 67 67 } 68 69 68 69 70 70 } 71 71 … … 102 102 103 103 104 if (distance > 1000 && this->rocket_->getVelocity().squaredLength()<160000) 104 if (distance > 1000 && this->rocket_->getVelocity().squaredLength()<160000) 105 105 this->rocket_->setAcceleration(this->rocket_->getOrientation()*Vector3(-20,-20,-20)); 106 106 if (distance <1000) this->rocket_->setAcceleration(0,0,0); -
code/branches/presentation3/src/modules/weapons/RocketController.h
r7039 r7127 50 50 RocketController(BaseObject* creator); 51 51 virtual ~RocketController(); 52 52 53 53 virtual void tick(float dt); 54 54 SimpleRocket* getRocket() const … … 64 64 Vector3 targetPosition_; 65 65 WeakPtr<PlayerInfo> player_; 66 66 67 67 WeakPtr<WorldEntity> target_; 68 68 -
code/branches/presentation3/src/modules/weapons/projectiles/Rocket.cc
r7018 r7127 167 167 this->localAngularVelocity_ = 0; 168 168 } 169 169 170 170 if( GameMode::isMaster() ) 171 171 { 172 172 if( this->bDestroy_ ) 173 173 this->destroy(); 174 174 175 175 } 176 176 } -
code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.cc
r7025 r7127 71 71 this->fire_ = new ParticleEmitter(this); 72 72 this->attach(this->fire_); 73 73 74 74 this->fire_->setOrientation(this->getOrientation()); 75 75 this->fire_->setSource("Orxonox/simplerocketfire"); … … 90 90 91 91 92 92 93 93 /** 94 94 * @brief updates state of rocket, disables fire if no fuel … … 107 107 this->localAngularVelocity_ = 0; 108 108 109 109 110 110 if (this->fuel_) 111 111 { 112 if (this->destroyTimer_.getRemainingTime()< (static_cast<float>(this->FUEL_PERCENTAGE)/100) *this->lifetime_ ) 112 if (this->destroyTimer_.getRemainingTime()< (static_cast<float>(this->FUEL_PERCENTAGE)/100) *this->lifetime_ ) 113 113 this->fuel_=false; 114 114 } else 115 115 this->disableFire(); 116 116 117 if( this->bDestroy_ ) 117 if( this->bDestroy_ ) 118 118 this->destroy(); 119 119 } 120 120 121 121 } 122 122 … … 127 127 void SimpleRocket::disableFire() 128 128 { 129 this->setAcceleration(0,0,0); 129 this->setAcceleration(0,0,0); 130 130 this->fire_->detachFromParent(); 131 131 } … … 137 137 SimpleRocket::~SimpleRocket() 138 138 { 139 if (this->isInitialized()) 139 if (this->isInitialized()) 140 140 { 141 141 if( GameMode::isMaster() ) -
code/branches/presentation3/src/modules/weapons/projectiles/SimpleRocket.h
r7095 r7127 98 98 */ 99 99 inline void rotatePitch(float value) 100 { 100 { 101 101 this->rotatePitch(Vector2(value, 0)); } 102 102 /** … … 105 105 */ 106 106 inline void rotateRoll(float value) 107 { 107 { 108 108 this->rotateRoll(Vector2(value, 0)); } 109 109 … … 124 124 Vector3 localAngularVelocity_; 125 125 float damage_; 126 bool bDestroy_; 126 bool bDestroy_; 127 127 bool fuel_; //!< Bool is true while the rocket "has fuel" 128 128 -
code/branches/presentation3/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
r7095 r7127 54 54 55 55 this->setMunitionName("TargetSeeking Rockets"); 56 this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.4); 56 this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.4); 57 57 // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning) 58 58 } -
code/branches/presentation3/src/orxonox/ChatHistory.cc
r6928 r7127 39 39 /* constructor */ 40 40 #ifndef CHATTEST 41 //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator) 42 ChatHistory::ChatHistory() 41 //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator) 42 ChatHistory::ChatHistory() 43 43 #else 44 44 ChatHistory::ChatHistory() … … 68 68 { 69 69 chat_hist_closelog(); 70 70 71 71 /* clear list */ 72 72 this->hist_buffer.clear(); … … 74 74 75 75 /* react to incoming chat */ 76 void ChatHistory::incomingChat(const std::string& message, 76 void ChatHistory::incomingChat(const std::string& message, 77 77 unsigned int senderID) 78 78 { … … 104 104 /* add the line to the log */ 105 105 this->chat_hist_logline( text ); 106 } 106 } 107 107 108 108 /* Synchronize logfile onto the hard drive */ /* MARK MARK */ … … 128 128 /* log a line to a logfile */ 129 129 int ChatHistory::chat_hist_logline( const std::string& toadd ) 130 { 130 { 131 131 /* output the line to the file if logging is enabled */ 132 132 if( this->hist_log_enabled ) … … 138 138 int ChatHistory::chat_hist_openlog() 139 139 { 140 /* TODO: find out the name of the file to log to via settings 140 /* TODO: find out the name of the file to log to via settings 141 141 * and set the this->hist_logfile_path variable to it 142 142 */ … … 167 167 /* see if we've actually got a logfile */ 168 168 if( this->hist_logfile ) 169 { 169 { 170 170 /* yes, we've got one, add a line that shows we're closing it */ 171 171 this->chat_hist_logline( "--- Logfile closed ---" ); -
code/branches/presentation3/src/orxonox/ChatHistory.h
r6928 r7127 34 34 35 35 /* define this if you're unit testing */ 36 //#define CHATTEST 36 //#define CHATTEST 37 37 38 38 #ifndef CHATTEST … … 62 62 63 63 #else 64 class ChatHistory 64 class ChatHistory 65 65 #endif 66 66 { … … 75 75 virtual ~ChatHistory(); 76 76 77 77 78 78 //protected: 79 /** what to do with incoming chat 80 * 81 * \param message The incoming message 79 /** what to do with incoming chat 80 * 81 * \param message The incoming message 82 82 * \param senderID Identification number of the sender 83 83 */ 84 virtual void incomingChat(const std::string& message, 84 virtual void incomingChat(const std::string& message, 85 85 unsigned int senderID); 86 87 /** Synchronize logfile onto the hard drive 86 87 /** Synchronize logfile onto the hard drive 88 88 * 89 89 * \return 0 for success, other for error … … 93 93 /** debug-print: output the whole history to stdout */ 94 94 void debug_printhist(); 95 95 96 96 private: 97 97 /* FIELDS */ -
code/branches/presentation3/src/orxonox/ChatInputHandler.cc
r7049 r7127 40 40 #include <string> 41 41 42 namespace orxonox 42 namespace orxonox 43 43 { 44 44 /* singleton */ … … 48 48 SetConsoleCommandAlias( ChatInputHandler, activate_static, "startchat", 49 49 true ); 50 SetConsoleCommandAlias( ChatInputHandler, activate_small_static, 50 SetConsoleCommandAlias( ChatInputHandler, activate_small_static, 51 51 "startchat_small", true ); 52 52 … … 111 111 112 112 /* cast it to a listbox */ 113 lb_history = dynamic_cast<CEGUI::Listbox*>(history); 113 lb_history = dynamic_cast<CEGUI::Listbox*>(history); 114 114 115 115 /* assert wee */ … … 140 140 } 141 141 142 // blues 142 // blues 143 143 red = 0.5, green = 0.5, blue = 1; 144 144 for( ; i < NumberOfColors; ++i ) … … 171 171 } 172 172 173 void ChatInputHandler::deactivate() 173 void ChatInputHandler::deactivate() 174 174 { 175 175 /* stop listening */ … … 202 202 203 203 /* handle incoming chat */ 204 void ChatInputHandler::incomingChat(const std::string& message, 204 void ChatInputHandler::incomingChat(const std::string& message, 205 205 unsigned int senderID) 206 206 { … … 210 210 /* setup player name info */ 211 211 if (senderID != CLIENTID_UNKNOWN) 212 { 212 { 213 213 PlayerInfo* player = PlayerManager::getInstance().getClient(senderID); 214 214 if (player) … … 227 227 /* now add */ 228 228 this->lb_history->addItem( dynamic_cast<CEGUI::ListboxItem*>(toadd) ); 229 this->lb_history->ensureItemIsVisible( 229 this->lb_history->ensureItemIsVisible( 230 230 dynamic_cast<CEGUI::ListboxItem*>(toadd) ); 231 231 232 232 /* make sure the history handles it */ 233 233 this->lb_history->handleUpdatedItemData(); 234 } 234 } 235 235 236 236 237 237 /* sub for inputchanged */ 238 void ChatInputHandler::sub_adjust_dispoffset( int maxlen, 239 int cursorpos, 238 void ChatInputHandler::sub_adjust_dispoffset( int maxlen, 239 int cursorpos, 240 240 int inplen ) 241 241 { 242 242 /* already start offsetting 5 characters before end */ 243 243 if( cursorpos+5 > maxlen ) 244 { 244 { 245 245 /* always stay 5 characters ahead of end, looks better */ 246 246 ((disp_offset = cursorpos-maxlen+5) >= 0) ? 1 : disp_offset = 0; … … 249 249 (disp_offset > cursorpos ) ? disp_offset = 0 : 1; 250 250 } 251 251 252 252 /* make sure we don't die at substr */ 253 253 if( inplen <= disp_offset ) disp_offset = 0; … … 260 260 std::string raw = this->inpbuf->get(); 261 261 int cursorpos = this->inpbuf->getCursorPosition(); 262 262 263 263 /* get string before cursor */ 264 264 std::string left = raw.substr( 0, cursorpos ); … … 268 268 if( raw.length() >= left.length()+1 ) 269 269 right = raw.substr( cursorpos ); 270 270 271 271 /* set the text */ 272 272 std::string assembled = "$ " + left + "|" + right; 273 273 274 274 if( this->fullchat ) 275 { 275 { 276 276 /* adjust curser position - magic number 5 for font width */ 277 sub_adjust_dispoffset( (this->input->getUnclippedInnerRect().getWidth()/6), 277 sub_adjust_dispoffset( (this->input->getUnclippedInnerRect().getWidth()/6), 278 278 cursorpos, assembled.length() ); 279 279 this->input->setProperty( "Text", assembled.substr( disp_offset ) ); … … 282 282 { 283 283 /* adjust curser position - magic number 5 for font width */ 284 sub_adjust_dispoffset( (this->inputonly->getUnclippedInnerRect().getWidth()/6), 284 sub_adjust_dispoffset( (this->inputonly->getUnclippedInnerRect().getWidth()/6), 285 285 cursorpos, assembled.length() ); 286 286 this->inputonly->setProperty( "Text", assembled.substr( disp_offset) ); … … 323 323 void ChatInputHandler::cursorRight() 324 324 { this->inpbuf->increaseCursor(); } 325 325 326 326 void ChatInputHandler::cursorLeft() 327 327 { this->inpbuf->decreaseCursor(); } 328 328 329 329 void ChatInputHandler::cursorEnd() 330 330 { this->inpbuf->setCursorToEnd(); } -
code/branches/presentation3/src/orxonox/ChatInputHandler.h
r7043 r7127 62 62 private: 63 63 /** Input buffer, to be used to catch input from the 64 * keyboard 64 * keyboard 65 65 */ 66 66 InputBuffer *inpbuf; … … 126 126 * history window of the full chat window) 127 127 */ 128 void incomingChat( const std::string& message, 128 void incomingChat( const std::string& message, 129 129 unsigned int senderID ); 130 130 131 131 /** \param full true means show full chat window with history, 132 132 false means show only an input line 133 * 134 * Show the chat window and redirect the game's keyboard input 133 * 134 * Show the chat window and redirect the game's keyboard input 135 135 * into it. 136 136 */ -
code/branches/presentation3/src/orxonox/Level.cc
r7105 r7127 49 49 RegisterObject(Level); 50 50 51 51 52 52 this->registerVariables(); 53 53 this->xmlfilename_ = this->getFilename(); … … 73 73 XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode); 74 74 XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype"); 75 75 76 76 XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode); 77 77 XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); … … 99 99 Loader::open(this->xmlfile_); 100 100 } 101 101 102 102 void Level::networkCallbackTemplatesChanged() 103 103 { … … 151 151 return 0; 152 152 } 153 153 154 154 void Level::addLodInfo(MeshLodInformation* lodInformation) 155 155 { … … 165 165 if(this->lodInformation_.find(meshName)!=this->lodInformation_.end()) 166 166 return this->lodInformation_.find(meshName)->second; 167 167 168 168 return 0; 169 169 } -
code/branches/presentation3/src/orxonox/MoodManager.cc
r7121 r7127 45 45 RegisterRootObject(MoodManager); 46 46 this->setConfigValues(); 47 47 48 48 // Checking for the existence of the folder for the default mood 49 49 /* Note: Currently Resource::exists(path) will always return false when the path field points to a folder. -
code/branches/presentation3/src/orxonox/OrxonoxPrereqs.h
r7034 r7127 137 137 class OrxonoxOverlay; 138 138 class OverlayGroup; 139 139 140 140 // pickup 141 141 class PickupIdentifier; -
code/branches/presentation3/src/orxonox/Radar.cc
r6942 r7127 87 87 } 88 88 } 89 89 90 90 void Radar::removeRadarObject(RadarViewable* rv) 91 91 { … … 203 203 } 204 204 } 205 205 206 206 void Radar::radarObjectChanged(RadarViewable* rv) 207 207 { -
code/branches/presentation3/src/orxonox/controllers/AIController.cc
r7090 r7127 112 112 random = rnd(maxrand); 113 113 if (random < 25 && (this->bShooting_)) 114 this->bShooting_ = false; 114 this->bShooting_ = false; 115 115 116 116 } … … 127 127 this->commandSlaves(); 128 128 129 if (this->specificMasterAction_ != NONE) 129 if (this->specificMasterAction_ != NONE) 130 130 this->specificMasterActionHold(); 131 131 … … 149 149 // lose master status (only if less than 4 slaves in formation) 150 150 random = rnd(maxrand); 151 if(random < 15/(this->slaves_.size()+1) && this->slaves_.size() < 4 ) 151 if(random < 15/(this->slaves_.size()+1) && this->slaves_.size() < 4 ) 152 152 this->loseMasterState(); 153 153 -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.cc
r7107 r7127 91 91 { 92 92 this->removeFromFormation(); 93 93 94 94 for (ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it; ++it) 95 95 { … … 101 101 it->myMaster_ = 0; 102 102 } 103 103 104 104 while (true) 105 105 { … … 139 139 { 140 140 Controller* controller = 0; 141 141 142 142 if (it->getController()) 143 143 controller = it->getController(); 144 144 else if (it->getXMLController()) 145 145 controller = it->getXMLController(); 146 146 147 147 if (!controller) 148 148 continue; … … 162 162 163 163 /** 164 @brief Get all masters to do a "specific master action" 164 @brief Get all masters to do a "specific master action" 165 165 @param action which action to perform (integer, so it can be called with a console command (tmp solution)) 166 166 */ … … 170 170 { 171 171 Controller* controller = 0; 172 172 173 173 if (it->getController()) 174 174 controller = it->getController(); 175 175 else if (it->getXMLController()) 176 176 controller = it->getXMLController(); 177 177 178 178 if (!controller) 179 179 continue; … … 204 204 { 205 205 Controller* controller = 0; 206 206 207 207 if (it->getController()) 208 208 controller = it->getController(); 209 209 else if (it->getXMLController()) 210 210 controller = it->getXMLController(); 211 211 212 212 if (!controller) 213 213 continue; … … 252 252 { 253 253 Controller* controller = 0; 254 254 255 255 if (it->getController()) 256 256 controller = it->getController(); 257 257 else if (it->getXMLController()) 258 258 controller = it->getXMLController(); 259 259 260 260 if (!controller) 261 261 continue; … … 280 280 { 281 281 Controller* controller = 0; 282 282 283 283 if (it->getController()) 284 284 controller = it->getController(); 285 285 else if (it->getXMLController()) 286 286 controller = it->getXMLController(); 287 287 288 288 if (!controller) 289 289 continue; … … 303 303 void ArtificialController::changedControllableEntity() 304 304 { 305 if (!this->getControllableEntity()) 305 if (!this->getControllableEntity()) 306 306 this->removeFromFormation(); 307 307 } … … 400 400 this->myMaster_->slaves_.erase(it); 401 401 } 402 402 403 403 this->myMaster_ = 0; 404 404 this->state_ = FREE; … … 423 423 //has it an ArtificialController? 424 424 Controller* controller = 0; 425 425 426 426 if (it->getController()) 427 427 controller = it->getController(); 428 428 else if (it->getXMLController()) 429 429 controller = it->getXMLController(); 430 430 431 431 if (!controller) 432 432 continue; … … 476 476 @brief Commands the slaves of a master into a formation. Sufficiently fast not to be called within tick. Initiated by a master. 477 477 */ 478 void ArtificialController::commandSlaves() 478 void ArtificialController::commandSlaves() 479 479 { 480 480 if(this->state_ != MASTER) return; … … 489 489 this->slaves_.front()->setTargetPosition(dest); 490 490 } 491 else 491 else 492 492 { 493 493 dest += 1.0f*orient*WorldEntity::BACK; … … 592 592 bool ArtificialController::forcedFree() 593 593 { 594 if(this->freedomCount_ > 0) 594 if(this->freedomCount_ > 0) 595 595 { 596 596 this->freedomCount_--; … … 606 606 if(this->state_ != MASTER) return; 607 607 608 if (specificMasterActionHoldCount_ == 0) 608 if (specificMasterActionHoldCount_ == 0) 609 609 { 610 610 this->specificMasterAction_ = NONE; … … 677 677 if (!always) 678 678 this->specificMasterActionHoldCount_ = secondsToFollow; 679 else 679 else 680 680 this->specificMasterActionHoldCount_ = INT_MAX; //for now... 681 681 … … 698 698 699 699 currentHumanController = orxonox_cast<NewHumanController*>(it->getController()); 700 if(currentHumanController) 700 if(currentHumanController) 701 701 { 702 702 if (!ArtificialController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue; -
code/branches/presentation3/src/orxonox/controllers/ArtificialController.h
r7107 r7127 64 64 inline int getFormationSize() const 65 65 { return this->maxFormationSize_; } 66 66 67 67 inline void setPassive(bool passive) 68 68 { this->passive_ = passive; } -
code/branches/presentation3/src/orxonox/controllers/DroneController.h
r7034 r7127 52 52 DroneController(BaseObject* creator); 53 53 virtual ~DroneController(); 54 54 55 55 virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick. 56 56 -
code/branches/presentation3/src/orxonox/gametypes/Gametype.cc
r6996 r7127 330 330 if (index == randomspawn) 331 331 return (*it); 332 332 333 333 ++index; 334 334 } -
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
r7039 r7127 40 40 CreateFactory(MeshLodInformation); 41 41 42 MeshLodInformation::MeshLodInformation(BaseObject* creator) 42 MeshLodInformation::MeshLodInformation(BaseObject* creator) 43 43 : BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15) 44 44 { … … 59 59 XMLPortParam(MeshLodInformation, "reductionRate", setReductionRate, getReductionRate, xmlelement, mode); 60 60 } 61 61 62 62 std::string MeshLodInformation::getMeshName() 63 63 { 64 64 return MeshLodInformation::getMeshSource(); 65 65 } 66 66 67 67 void MeshLodInformation::setLodLevel(float lodLevel) 68 68 { … … 73 73 { 74 74 return lodLevel_; 75 } 75 } 76 76 void MeshLodInformation::setMeshSource(std::string meshSource) 77 77 { … … 82 82 return meshSource_; 83 83 } 84 84 85 85 } -
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h
r7036 r7127 43 43 MeshLodInformation(BaseObject* creator); 44 44 virtual ~MeshLodInformation(); 45 45 46 46 float getLodLevel(); 47 47 std::string getMeshName(); … … 49 49 unsigned int getNumLevels(){ return this->numLevels_; } 50 50 float getReductionRate(){ return this->reductionRate_; } 51 51 52 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 53 53 -
code/branches/presentation3/src/orxonox/graphics/Model.cc
r7111 r7127 42 42 CreateFactory(Model); 43 43 44 Model::Model(BaseObject* creator) : 44 Model::Model(BaseObject* creator) : 45 45 StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15) 46 46 { … … 59 59 { 60 60 SUPER(Model, XMLPort, xmlelement, mode); 61 61 62 62 XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode); 63 63 64 64 XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode); 65 65 XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true); … … 81 81 return scaleFactor; 82 82 } 83 83 84 84 void Model::changedMesh() 85 85 { … … 88 88 if (this->mesh_.getEntity()) 89 89 this->detachOgreObject(this->mesh_.getEntity()); 90 90 91 91 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); 92 92 … … 96 96 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 97 97 this->mesh_.setVisible(this->isVisible()); 98 99 98 99 100 100 //LOD 101 101 if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 ) 102 102 { 103 103 Level* level = this->getLevel(); 104 104 105 105 assert( level != 0 ); 106 106 107 107 MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_); 108 108 if( lodInfo ) … … 122 122 float volume = this->mesh_.getEntity()->getBoundingBox().volume(); 123 123 // float scaleFactor = 1; 124 124 125 125 // BaseObject* creatorPtr = this; 126 // 126 // 127 127 // while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr)) 128 128 // { … … 131 131 // } 132 132 // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl; 133 133 134 134 COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl; 135 135 … … 144 144 // float factor = scaleFactor*5/lodLevel_; 145 145 float factor = pow(volume, 2.0f / 3.0f) * 15.0f / lodLevel_; 146 146 147 147 COUT(4) << "LodLevel set with factor: " << factor << endl; 148 148 … … 160 160 distList.pop_back(); 161 161 162 162 163 163 //Generiert LOD-Levels 164 164 this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_); … … 171 171 else 172 172 what = "<0"; 173 173 174 174 COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl; 175 175 } -
code/branches/presentation3/src/orxonox/graphics/Model.h
r7036 r7127 61 61 inline bool getCastShadows() const 62 62 { return this->bCastShadows_; } 63 63 64 64 protected: 65 65 void changedMesh(); 66 66 void changedShadows(); 67 67 68 68 //LoD 69 69 inline void setLodLevel(float lodLevel) … … 76 76 Mesh mesh_; 77 77 bool bCastShadows_; 78 78 79 79 //LoD 80 80 float lodLevel_; … … 82 82 unsigned int numLodLevels_; 83 83 float lodReductionRate_; 84 84 85 85 }; 86 86 } -
code/branches/presentation3/src/orxonox/infos/GametypeInfo.cc
r7062 r7127 157 157 it->staticmessage(this, message, colour); 158 158 } 159 159 160 160 void GametypeInfo::dispatchFadingMessage(const std::string& message) 161 161 { -
code/branches/presentation3/src/orxonox/interfaces/InterfaceCompilation.cc
r7096 r7127 52 52 RegisterRootObject(GametypeMessageListener); 53 53 } 54 54 55 55 //---------------------------- 56 56 // PickupCarrier … … 59 59 { 60 60 RegisterRootObject(PickupCarrier); 61 61 62 62 this->setCarrierName("PickupCarrier"); 63 63 } 64 64 65 65 PickupCarrier::~PickupCarrier() 66 66 { … … 85 85 this->isForPlayer_ = true; 86 86 } 87 87 88 88 //---------------------------- 89 89 // RadarListener -
code/branches/presentation3/src/orxonox/interfaces/PickupCarrier.h
r7034 r7127 68 68 friend class Pickupable; 69 69 friend class PickupManager; 70 //! Friends. 70 //! Friends. 71 71 friend class Pickup; 72 72 friend class HealthPickup; … … 170 170 */ 171 171 virtual const Vector3& getCarrierPosition(void) = 0; 172 172 173 173 /** 174 174 @brief Get the name of this PickupCarrier. … … 176 176 */ 177 177 const std::string& getCarrierName(void) { return this->carrierName_; } // tolua_export 178 179 protected: 178 179 protected: 180 180 /** 181 181 @brief Get all direct children of this PickupSpawner. … … 198 198 std::set<Pickupable*>& getPickups(void) 199 199 { return this->pickups_; } 200 200 201 201 /** 202 202 @brief Set the name of this PickupCarrier. … … 206 206 void setCarrierName(const std::string& name) 207 207 { this->carrierName_ = name; } 208 208 209 209 private: 210 210 std::set<Pickupable*> pickups_; //!< The list of Pickupables carried by this PickupCarrier. 211 211 std::string carrierName_; //!< The name of the PickupCarrier, as displayed in the PickupInventory. 212 212 213 213 /** 214 214 @brief Get the number of carrier children this PickupCarrier has. … … 222 222 return size; 223 223 } 224 224 225 225 /** 226 226 @brief Get the index-th child of this PickupCarrier. … … 237 237 return carrier; 238 238 } 239 239 240 240 /** 241 241 @brief Get the number of Pickupables this PickupCarrier carries. … … 244 244 unsigned int getNumPickups(void) 245 245 { return this->pickups_.size(); } 246 246 247 247 /** 248 248 @brief Get the index-th Pickupable of this PickupCarrier. … … 259 259 return *it; 260 260 } 261 261 262 262 }; 263 263 } -
code/branches/presentation3/src/orxonox/interfaces/Pickupable.cc
r7094 r7127 46 46 namespace orxonox 47 47 { 48 48 49 49 /** 50 50 @brief … … 52 52 */ 53 53 Pickupable::Pickupable() : pickupIdentifier_(NULL), used_(false), pickedUp_(false) 54 { 54 { 55 55 RegisterRootObject(Pickupable); 56 56 57 57 this->carrier_ = NULL; 58 58 59 59 this->pickupIdentifier_ = new PickupIdentifier(this); 60 60 } 61 62 /** 63 @brief 64 Destructor. 61 62 /** 63 @brief 64 Destructor. 65 65 */ 66 66 Pickupable::~Pickupable() … … 68 68 if(this->isUsed()) 69 69 this->setUsed(false); 70 70 71 71 if(this->isPickedUp() && this->getCarrier() != NULL) 72 72 { … … 74 74 this->setCarrier(NULL); 75 75 } 76 76 77 77 if(this->pickupIdentifier_ != NULL) 78 78 this->pickupIdentifier_->destroy(); 79 79 } 80 80 81 81 /** 82 82 @brief … … 91 91 if(this->used_ == used) 92 92 return false; 93 93 94 94 COUT(4) << "Pickupable (&" << this << ") set to used " << used << "." << std::endl; 95 95 96 96 this->used_ = used; 97 97 this->changedUsed(); … … 100 100 return true; 101 101 } 102 102 103 103 /** 104 104 @brief … … 115 115 return this->isTarget(carrier->getIdentifier()); 116 116 } 117 117 118 118 /** 119 119 @brief … … 134 134 return false; 135 135 } 136 136 137 137 /** 138 138 @brief … … 147 147 return this->addTarget(target->getIdentifier()); 148 148 } 149 149 150 150 /** 151 151 @brief … … 160 160 if(this->isTarget(target)) //!< If the input target is already present in the list of targets. 161 161 return false; 162 162 163 163 COUT(4) << "Target " << target->getName() << " added to Pickupable (&" << this << ")." << std::endl; 164 164 this->targets_.push_back(target); 165 165 return true; 166 166 } 167 168 /** 169 @brief 167 168 /** 169 @brief 170 170 Sets the Pickupable to picked up. 171 171 This method will be called by the PickupCarrier picking the Pickupable up. … … 179 179 if(this->isPickedUp()) //!< If the Pickupable is already picked up. 180 180 return false; 181 181 182 182 COUT(4) << "Pickupable (&" << this << ") got picked up by a PickupCarrier (&" << carrier << ")." << std::endl; 183 183 this->setCarrier(carrier); … … 185 185 return true; 186 186 } 187 187 188 188 /** 189 189 @brief … … 198 198 if(this->pickedUp_ == pickedUp) 199 199 return false; 200 200 201 201 COUT(4) << "Pickupable (&" << this << ") set to pickedUp " << pickedUp << "." << std::endl; 202 202 203 203 this->pickedUp_ = pickedUp; 204 204 this->changedPickedUp(); … … 206 206 return true; 207 207 } 208 208 209 209 /** 210 210 @brief … … 217 217 if(this->carrier_ == carrier) 218 218 return false; 219 219 220 220 COUT(4) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << std::endl; 221 221 222 222 this->carrier_ = carrier; 223 223 this->changedCarrier(); … … 226 226 return true; 227 227 } 228 229 /** 230 @brief 228 229 /** 230 @brief 231 231 Sets the Pickupable to not picked up or dropped. 232 232 This method will be called by the PickupCarrier dropping the Pickupable. … … 238 238 if(!this->isPickedUp()) //!< If the Pickupable is not picked up. 239 239 return false; 240 240 241 241 COUT(4) << "Pickupable (&" << this << ") got dropped up by a PickupCarrier (&" << this->getCarrier() << ")." << std::endl; 242 242 this->setUsed(false); 243 243 this->setPickedUp(false); 244 244 245 245 bool created = this->createSpawner(); 246 246 247 247 this->setCarrier(NULL); 248 248 249 249 if(!created) 250 250 { 251 251 this->destroy(); 252 252 } 253 254 return true; 255 } 256 253 254 return true; 255 } 256 257 257 /** 258 258 @brief … … 265 265 OrxonoxClass* item = NULL; 266 266 this->clone(item); 267 267 268 268 Pickupable* pickup = dynamic_cast<Pickupable*>(item); 269 269 270 270 COUT(4) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << std::endl; 271 271 return pickup; 272 272 } 273 273 274 274 /** 275 275 @brief … … 299 299 return carrier->pickup(this); 300 300 } 301 301 302 302 } -
code/branches/presentation3/src/orxonox/interfaces/Pickupable.h
r7094 r7127 45 45 namespace orxonox // tolua_export 46 46 { // tolua_export 47 47 48 48 /** 49 49 @brief … … 57 57 protected: 58 58 Pickupable(); //!< Default constructor. 59 59 60 60 public: 61 61 virtual ~Pickupable(); //!< Default destructor. 62 62 63 63 /** 64 64 @brief Get whether the pickup is currently in use or not. … … 71 71 */ 72 72 virtual void changedUsed(void) {} 73 73 74 74 /** 75 75 @brief Get the carrier of the pickup. … … 83 83 */ 84 84 virtual void changedCarrier(void) {} 85 85 86 86 /** 87 87 @brief Returns whether the Pickupable is currently picked up. … … 94 94 */ 95 95 virtual void changedPickedUp(void) {} 96 96 97 97 bool pickedUp(PickupCarrier* carrier); //!< Sets the Pickupable to picked up. 98 98 bool dropped(void); //!< Sets the Pickupable to not picked up or dropped. 99 99 100 100 virtual bool isTarget(PickupCarrier* carrier) const; //!< Get whether the given PickupCarrier is a target of this pickup. 101 101 bool isTarget(const Identifier* identifier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this Pickupable. 102 102 bool addTarget(PickupCarrier* target); //!< Add a PickupCarrier as target of this pickup. 103 103 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this pickup. 104 104 105 105 Pickupable* clone(void); //!< Creates a duplicate of the Pickupable. 106 106 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass. 107 107 108 108 /** 109 109 @brief Get the PickupIdentifier of this Pickupable. … … 112 112 virtual const PickupIdentifier* getPickupIdentifier(void) 113 113 { return this->pickupIdentifier_; } 114 114 115 115 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 116 116 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. 117 117 bool setCarrier(PickupCarrier* carrier, bool tell = false); //!< Sets the carrier of the pickup. 118 118 119 119 protected: 120 120 /** … … 122 122 */ 123 123 void initializeIdentifier(void) {} 124 124 125 125 /** 126 126 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. … … 131 131 */ 132 132 virtual bool createSpawner(void) = 0; 133 133 134 134 PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable. 135 135 136 136 private: 137 137 138 138 bool used_; //!< Whether the pickup is currently in use or not. 139 139 bool pickedUp_; //!< Whether the pickup is currently picked up or not. 140 140 141 141 PickupCarrier* carrier_; //!< The carrier of the pickup. 142 142 std::list<Identifier*> targets_; //!< The possible targets of this pickup. … … 147 147 148 148 }; // tolua_export 149 149 150 150 SUPER_FUNCTION(10, Pickupable, changedUsed, false); 151 151 SUPER_FUNCTION(12, Pickupable, changedCarrier, false); -
code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc
r7045 r7127 65 65 RadarViewable::~RadarViewable() 66 66 { 67 67 68 68 if( this->bInitialized_ ) 69 69 { … … 109 109 } 110 110 } 111 111 112 112 void RadarViewable::settingsChanged() 113 113 { -
code/branches/presentation3/src/orxonox/interfaces/RadarViewable.h
r7045 r7127 88 88 89 89 inline void setRadarVisibility(bool b) 90 { 90 { 91 91 if(b!=this->bVisibility_) 92 92 { -
code/branches/presentation3/src/orxonox/pickup/PickupIdentifier.cc
r6725 r7127 39 39 namespace orxonox 40 40 { 41 41 42 42 /** 43 43 @brief … … 47 47 { 48 48 RegisterRootObject(PickupIdentifier); 49 49 50 50 if(pickup == NULL) 51 51 COUT(1) << "Error, PickupIdentifier was created without a valid Pickupable." << std::endl; 52 52 53 53 this->pickup_ = pickup; 54 54 } 55 55 56 56 PickupIdentifier::~PickupIdentifier() 57 57 { 58 58 59 59 } 60 60 61 61 /** 62 62 @brief … … 74 74 COUT(1) << "Error in PickupIdentifier::compare: Input Identifier is NULL." << std::endl; 75 75 } 76 76 77 77 if(identifier->pickup_ == NULL && this->pickup_ == NULL) 78 78 { … … 80 80 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 81 81 } 82 82 83 83 if(identifier->pickup_ == NULL) 84 84 { … … 86 86 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 87 87 } 88 88 89 89 if(this->pickup_ == NULL) 90 90 { … … 92 92 COUT(1) << "Error in PickupIdentifier::compare: Pickup stored by Identifier is NULL." << std::endl; 93 93 } 94 94 95 95 //! If the classIdentifiers are not the same (meaning the PickupIdentifiers identify different classes), the obviously the two Pickupables identified by the PickupIdentifiers cannot be the same. An ordering is established through the alphabetical ordering of the respective classnames. 96 96 if(!identifier->pickup_->getIdentifier()->isExactlyA(this->pickup_->getIdentifier())) 97 97 return this->pickup_->getIdentifier()->getName().compare(identifier->pickup_->getIdentifier()->getName()); 98 98 99 99 //! If the class is the same for both PickupIdentifiers we go on to check the parameters of the class. 100 100 //! If the two have a different number of parameters then obviusly something is very wrong. … … 104 104 return this->parameters_.size()-identifier->parameters_.size(); 105 105 } 106 106 107 107 //! We iterate through all parameters and compar their values (which are strings). The first parameter is the most significant. The ordering is once again established by the alphabetical comparison of the two value strings. 108 108 for(std::map<std::string, std::string>::const_iterator it = this->parameters_.begin(); it != this->parameters_.end(); it++) … … 117 117 return it->second.compare(identifier->parameters_.find(it->first)->second); 118 118 } 119 119 120 120 return 0; 121 121 } 122 122 123 123 /** 124 124 @brief … … 134 134 { 135 135 COUT(4) << "PickupIdentifier " << name << ", " << value << std::endl; 136 136 137 137 if(!(this->parameters_.find(name) == this->parameters_.end())) 138 138 { … … 140 140 return false; 141 141 } 142 142 143 143 this->parameters_[name] = value; 144 144 145 145 return true; 146 146 } 147 147 148 148 } -
code/branches/presentation3/src/orxonox/pickup/PickupIdentifier.h
r6540 r7127 41 41 #include "core/Identifier.h" 42 42 43 #include "core/OrxonoxClass.h" 43 #include "core/OrxonoxClass.h" 44 44 45 45 namespace orxonox 46 46 { 47 47 48 48 /** 49 49 @brief … … 57 57 class _OrxonoxExport PickupIdentifier : virtual public OrxonoxClass 58 58 { 59 59 60 60 public: 61 61 PickupIdentifier(Pickupable* pickup); //!< Constructor. 62 62 ~PickupIdentifier(); //!< Destructor. 63 63 64 64 virtual int compare(const PickupIdentifier* identifier) const; //!< Compares two PickupIdentifiers and returns 0 if a == b, <0 if a < b and >0 if a > b for a.compare(b). 65 65 66 66 bool addParameter(std::string & name, std::string & value); //!< Add a parameter to the PickupIdentifier. 67 67 68 68 private: 69 69 Pickupable* pickup_; //!< The Pickupable the PickupIdentififer is for. 70 70 std::map<std::string, std::string> parameters_; //!< The parameters identifying the type of the pickup beyond the class. 71 71 72 72 }; 73 73 74 74 /** 75 75 @brief … … 81 81 { return lhs->compare(rhs) < 0; } 82 82 }; 83 83 84 84 } 85 85 -
code/branches/presentation3/src/orxonox/worldentities/Drone.h
r7060 r7127 53 53 virtual void tick(float dt); //!< Defines which actions the Drone has to take in each tick. 54 54 55 55 56 56 virtual void moveFrontBack(const Vector2& value); 57 57 virtual void moveRightLeft(const Vector2& value); … … 61 61 virtual void rotatePitch(const Vector2& value); 62 62 virtual void rotateRoll(const Vector2& value); 63 63 64 64 /** 65 65 @brief Moves the Drone in the Front/Back-direction by the specifed amount. … … 80 80 inline void moveUpDown(float value) 81 81 { this->moveUpDown(Vector2(value, 0)); } 82 82 83 83 /** 84 84 @brief Rotates the Drone around the y-axis by the specifed amount. … … 99 99 inline void rotateRoll(float value) 100 100 { this->rotateRoll(Vector2(value, 0)); } 101 101 102 102 /** 103 103 @brief Sets the primary thrust to the input amount. … … 105 105 */ 106 106 inline void setPrimaryThrust( float thrust ) 107 { this->primaryThrust_=thrust; } 107 { this->primaryThrust_=thrust; } 108 108 inline void setAuxilaryThrust( float thrust ) 109 { this->auxilaryThrust_=thrust; } 109 { this->auxilaryThrust_=thrust; } 110 110 inline void setRotationThrust( float thrust ) 111 { this->rotationThrust_=thrust; } 111 { this->rotationThrust_=thrust; } 112 112 inline void setMaxDistanceToOwner( float distance) 113 113 { this->maxDistanceToOwner_=distance; } … … 117 117 { this->maxShootingRange_=distance; } 118 118 119 119 120 120 /** 121 121 @brief Gets the primary thrust to the input amount. … … 134 134 inline float getMaxShootingRange() 135 135 { return this->maxShootingRange_; } 136 136 137 137 private: 138 138 DroneController *myController_; //!< The controller of the Drone. 139 139 140 140 btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the Drone the next tick. 141 141 btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the Drone the next tick. 142 float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward. 142 float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward. 143 143 float auxilaryThrust_; //!< The amount of auxilary thrust. Used for all other movements (except for rotations). 144 144 float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only. -
code/branches/presentation3/src/orxonox/worldentities/WorldEntity.cc
r6524 r7127 81 81 this->node_->setPosition(Vector3::ZERO); 82 82 this->node_->setOrientation(Quaternion::IDENTITY); 83 83 84 84 // Activity and visibility memory. 85 85 this->bActiveMem_ = true; … … 205 205 registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged)); 206 206 } 207 207 208 208 /** 209 209 @brief … … 213 213 { 214 214 SUPER(WorldEntity, changedActivity); 215 215 216 216 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 217 217 { … … 227 227 } 228 228 } 229 229 230 230 /** 231 231 @brief … … 235 235 { 236 236 SUPER(WorldEntity, changedVisibility); 237 237 238 238 for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) 239 239 { -
code/branches/presentation3/src/orxonox/worldentities/WorldEntity.h
r6524 r7127 105 105 static const Vector3 DOWN; 106 106 static const Vector3 UP; 107 107 108 108 virtual void changedActivity(void); 109 109 virtual void changedVisibility(void); … … 234 234 std::set<WorldEntity*> children_; 235 235 bool bDeleteWithParent_; 236 236 237 237 bool bActiveMem_; 238 238 bool bVisibleMem_;
Note: See TracChangeset
for help on using the changeset viewer.