Changeset 6387 for code/branches/presentation2/src
- Timestamp:
- Dec 21, 2009, 1:18:36 PM (15 years ago)
- Location:
- code/branches/presentation2/src
- Files:
-
- 130 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/external/ceguilua/CMakeLists.txt
r5929 r6387 45 45 BREAK() # _version > CEGUI_VERSION 46 46 ENDIF() 47 47 48 48 ADD_SUBDIRECTORY(ceguilua-${_version}) # Sets parent scope variable _package_files 49 49 FOREACH(_file ${_package_files}) -
code/branches/presentation2/src/external/ceguilua/ceguilua-0.5.0/CMakeLists.txt
r5781 r6387 20 20 elements/TabButton.pkg elements/TabControl.pkg elements/Thumb.pkg 21 21 elements/Titlebar.pkg elements/Tooltip.pkg 22 22 23 23 falagard/Dimension.pkg falagard/Enums.pkg falagard/FalagardComponentBase.pkg 24 24 falagard/FrameComponent.pkg falagard/ImageryComponent.pkg -
code/branches/presentation2/src/libraries/core/BaseObject.cc
r5929 r6387 119 119 XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*); 120 120 XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode); 121 121 122 122 Element* events = 0; 123 123 if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject) … … 139 139 XMLPortEventState(BaseObject, BaseObject, "visibility", setVisible, xmlelement, mode); 140 140 XMLPortEventState(BaseObject, BaseObject, "mainstate", setMainState, xmlelement, mode); 141 141 142 142 this->bRegisteredEventStates_ = true; 143 143 } … … 236 236 if (it->second != state) 237 237 continue; 238 238 239 239 if (i == index) 240 240 return it->first; … … 252 252 listener->addEventSource(this, "mainstate"); 253 253 } 254 254 255 255 /** 256 256 @brief Returns an event listener with a given index. … … 344 344 { 345 345 this->registerEventStates(); 346 346 347 347 std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_); 348 348 if (it != this->eventStates_.end()) … … 356 356 /** 357 357 @brief Sets the main state of the object to a given boolean value. 358 358 359 359 Note: The main state of an object can be set with the @ref setMainStateName function. 360 360 It's part of the eventsystem and used for event forwarding (when the target object can't specify a specific state, … … 389 389 { 390 390 this->registerEventStates(); 391 391 392 392 std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_); 393 393 if (it != this->eventStates_.end() && it->second->getFunctor()) … … 402 402 } 403 403 } 404 404 405 405 /** 406 406 @brief Calls XMLEventPort with an empty XML-element to register the event states if necessary. … … 414 414 } 415 415 } 416 416 417 417 /** 418 418 @brief Manually loads all event states, even if the class doesn't officially support them. This is needed by some classes like @ref EventDispatcher or @ref EventTarget. -
code/branches/presentation2/src/libraries/core/BaseObject.h
r5929 r6387 157 157 void removeEventSource(BaseObject* source); 158 158 BaseObject* getEventSource(unsigned int index, const std::string& state) const; 159 159 160 160 void addEventListener(BaseObject* listener); 161 161 BaseObject* getEventListener(unsigned int index) const; … … 172 172 /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */ 173 173 inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; } 174 174 175 175 static void loadAllEventStates(Element& xmlelement, XMLPort::Mode mode, BaseObject* object, Identifier* identifier); 176 176 … … 210 210 Gametype* oldGametype_; 211 211 std::set<Template*> templates_; 212 212 213 213 std::map<BaseObject*, std::string> eventSources_; //!< List of objects which send events to this object, mapped to the state which they affect 214 214 std::set<BaseObject*> eventListeners_; //!< List of objects which listen to the events of this object -
code/branches/presentation2/src/libraries/core/ConfigFileManager.cc
r6197 r6387 57 57 return false; 58 58 } 59 59 60 60 std::string getConfig(const std::string& classname, const std::string& varname) 61 61 { -
code/branches/presentation2/src/libraries/core/Event.cc
r5929 r6387 45 45 /** 46 46 @brief Processes an event (calls the set-function if the necessary conditions are met). 47 47 48 48 @param event The fired event 49 49 @param object The object whose state is affected by the event (only needed for debug output) -
code/branches/presentation2/src/libraries/core/Event.h
r5929 r6387 50 50 /** 51 51 @brief The EventState contains information about an event state. 52 52 53 53 An event state is a state of an object, which can be changed by events. 54 54 Event states are changed through functions. Possible functions headers for set event states are: … … 56 56 - boolean state: function(bool state) 57 57 - individual state: function(bool state, SomeClass originator) 58 58 59 59 Note that SomeClass may be any class deriving from BaseObject. You will not receive events from originators of other classes. 60 60 The actual class for SomeClass must be specified as the second argument of the XMLPortEventState macro. 61 61 62 62 The this pointer of the affected object is hidden in the functors, because the events are processed in the BaseObject, but some 63 63 statefunctions may be from child-classes. … … 70 70 71 71 void process(const Event& event, BaseObject* object); 72 72 73 73 Functor* getFunctor() const 74 74 { return this->statefunction_; } -
code/branches/presentation2/src/libraries/core/EventIncludes.h
r5929 r6387 36 36 /** 37 37 @brief Defines a new event state (a state of the object which can be changed by events). 38 38 39 39 @param classname The name of this class 40 40 @param subclassname Usually BaseObject - if different, only instances of this class can send events to this object … … 69 69 static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \ 70 70 XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true) 71 71 72 72 73 73 /** 74 74 @brief Defines a new event name for a class. Named events can only have names which were defined with this macro. 75 75 76 76 @param classname The name of the class 77 77 @param name The name of the event … … 85 85 #define FireEventName(classname, name) \ 86 86 eventname##classname##name 87 87 88 88 #endif /* _EventIncludes_H__ */ -
code/branches/presentation2/src/libraries/core/GUIManager.cc
r6367 r6387 66 66 { GUIManager::getInstance().keyESC(); } 67 67 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC"); 68 68 69 69 class CEGUILogger : public CEGUI::DefaultLogger 70 70 { … … 246 246 this->executeCode("keyESC()"); 247 247 } 248 248 249 249 void GUIManager::setBackground(const std::string& name) 250 250 { -
code/branches/presentation2/src/libraries/core/OrxonoxClass.h
r6348 r6387 149 149 this->destroy(); 150 150 } 151 151 152 152 /** @brief Register a weak pointer which points to this object. */ 153 153 template <class T> -
code/branches/presentation2/src/libraries/core/SmartPtr.h
r5929 r6387 84 84 this->base_->decrementReferenceCount(); 85 85 } 86 86 87 87 inline const SmartPtr& operator=(int) 88 88 { -
code/branches/presentation2/src/libraries/core/Thread.cc
r5738 r6387 41 41 { 42 42 boost::posix_time::millisec THREAD_WAIT_BEFORE_DETACH(1000); 43 44 43 44 45 45 Thread::Thread(): 46 46 executor_(0), … … 53 53 this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) ); 54 54 } 55 55 56 56 Thread::~Thread() 57 57 { … … 66 66 delete this->isWorkingMutex_; 67 67 } 68 68 69 69 bool Thread::isWorking() 70 70 { … … 74 74 return isWorking; 75 75 } 76 76 77 77 bool Thread::evaluateExecutor( Executor* executor ) 78 78 { … … 85 85 return true; 86 86 } 87 87 88 88 void Thread::threadLoop() 89 89 { … … 114 114 } 115 115 } 116 116 117 117 void Thread::waitUntilFinished() 118 118 { -
code/branches/presentation2/src/libraries/core/Thread.h
r5738 r6387 50 50 private: 51 51 void threadLoop(); 52 52 53 53 Executor* executor_; 54 54 bool isWorking_; -
code/branches/presentation2/src/libraries/core/ThreadPool.cc
r5738 r6387 37 37 { 38 38 } 39 39 40 40 ThreadPool::~ThreadPool() 41 41 { … … 43 43 assert(a == 0); 44 44 } 45 45 46 46 void ThreadPool::addThreads( unsigned int nr ) 47 47 { … … 80 80 } 81 81 } 82 82 83 83 bool ThreadPool::passFunction( Executor* executor, bool addThread ) 84 84 { … … 103 103 return false; 104 104 } 105 105 106 106 void ThreadPool::synchronise() 107 107 { -
code/branches/presentation2/src/libraries/core/ThreadPool.h
r5738 r6387 41 41 ThreadPool(); 42 42 virtual ~ThreadPool(); 43 43 44 44 void addThreads( unsigned int nr ); 45 45 unsigned int removeThreads( unsigned int nr ); 46 46 unsigned int setNrOfThreads( unsigned int nr ); 47 47 48 48 bool passFunction( Executor* executor, bool addThread=false ); 49 49 void synchronise(); 50 50 51 51 private: 52 52 std::vector<Thread*> threadPool_; 53 53 54 54 }; 55 55 } -
code/branches/presentation2/src/libraries/core/WeakPtr.h
r5929 r6387 44 44 { 45 45 friend class OrxonoxClass; 46 46 47 47 public: 48 48 inline WeakPtr() : pointer_(0), base_(0), callback_(0) … … 79 79 if (this->callback_) 80 80 delete this->callback_; 81 82 } 83 81 82 } 83 84 84 inline const WeakPtr& operator=(int) 85 85 { … … 145 145 if (other.base_) 146 146 other.base_->unregisterWeakPtr(&other); 147 147 148 148 { 149 149 T* temp = this->pointer_; … … 167 167 WeakPtr().swap(*this); 168 168 } 169 169 170 170 inline void setCallback(Functor* callback) 171 171 { 172 172 this->callback_ = callback; 173 173 } 174 174 175 175 inline Functor* getFunctor() const 176 176 { … … 186 186 (*this->callback_)(); 187 187 } 188 188 189 189 T* pointer_; 190 190 OrxonoxClass* base_; -
code/branches/presentation2/src/libraries/core/input/InputManager.h
r6278 r6387 83 83 @brief 84 84 Loads the devices and initialises the KeyDetector and the Calibrator. 85 85 86 86 If either the OIS input system and/or the keyboard could not be created, 87 87 the constructor fails with an std::exception. … … 170 170 OIS::InputManager* getOISInputManager() { return this->oisInputManager_; } 171 171 std::pair<int, int> getMousePosition() const; 172 172 173 173 static InputManager& getInstance() { return Singleton<InputManager>::getInstance(); } // tolua_export 174 174 -
code/branches/presentation2/src/libraries/core/input/InputPrereqs.h
r5781 r6387 202 202 MediaSelect = OIS::KC_MEDIASELECT // Media Select 203 203 }; 204 204 205 205 //! Key codes as strings 206 206 const char* const ByString[] = -
code/branches/presentation2/src/libraries/core/input/InputState.cc
r5929 r6387 102 102 if (enterFunctor_) 103 103 (*enterFunctor_)(); 104 104 105 105 } 106 106 -
code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
r6360 r6387 283 283 } 284 284 } 285 285 286 286 void KeyBinder::addButtonToCommand(std::string command, Button* button) 287 287 { 288 288 std::ostringstream stream; 289 289 stream << button->groupName_ << "." << button->name_; 290 290 291 291 std::vector<std::string>& oldKeynames = this->allCommands_[button->bindingString_]; 292 292 std::vector<std::string>::iterator it = std::find(oldKeynames.begin(), oldKeynames.end(), stream.str()); … … 295 295 oldKeynames.erase(it); 296 296 } 297 297 298 298 if(command != "") 299 299 { … … 305 305 } 306 306 } 307 307 308 308 /** 309 309 @brief … … 317 317 return keynames.front(); 318 318 } 319 319 320 320 return ""; 321 321 } 322 322 323 323 /** 324 324 @brief … … 338 338 return keynames[index]; 339 339 } 340 340 341 341 return ""; 342 342 } 343 343 344 344 return ""; 345 345 } 346 346 347 347 /** 348 348 @brief … … 358 358 return keynames.size(); 359 359 } 360 360 361 361 return 0; 362 362 } -
code/branches/presentation2/src/libraries/core/input/KeyBinder.h
r6311 r6387 69 69 std::string getBinding(std::string commandName, unsigned int index); //tolua_export 70 70 unsigned int getNumberOfBindings(std::string commandName); //tolua_export 71 71 72 72 const std::string& getBindingsFilename() 73 73 { return this->filename_; } … … 161 161 private: 162 162 void addButtonToCommand(std::string command, Button* button); 163 163 164 164 //##### ConfigValues ##### 165 165 //! Whether to filter small value analog input -
code/branches/presentation2/src/libraries/core/input/KeyBinderManager.cc
r6367 r6387 92 92 this->bDefaultFileLoaded_ = false; 93 93 } 94 94 95 95 inline void KeyBinderManager::unbind(const std::string& binding) 96 96 { 97 97 this->currentBinder_->setBinding("", binding, false); 98 98 } 99 99 100 100 inline void KeyBinderManager::tunbind(const std::string& binding) 101 101 { -
code/branches/presentation2/src/libraries/network/Client.cc
r6134 r6387 113 113 return true; 114 114 } 115 115 116 116 void Client::printRTT(){ 117 117 COUT(0) << "Round trip time to server is " << ClientConnection::getRTT() << " ms" << endl; … … 155 155 } 156 156 sendPackets(); // flush the enet queue 157 157 158 158 Connection::processQueue(); 159 159 if(gamestate.processGamestates()) … … 167 167 return; 168 168 } 169 169 170 170 void Client::connectionClosed() 171 171 { -
code/branches/presentation2/src/libraries/network/ClientConnection.cc
r5965 r6387 69 69 { 70 70 ENetEvent event; 71 71 72 72 this->host_ = enet_host_create(NULL, NETWORK_CLIENT_MAX_CONNECTIONS, 0, 0); 73 73 if ( this->host_ == NULL ) … … 99 99 bool ClientConnection::closeConnection() { 100 100 ENetEvent event; 101 101 102 102 if ( !this->established_ ) 103 103 return true; … … 146 146 this->connectionClosed(); 147 147 } 148 148 149 149 uint32_t ClientConnection::getRTT() 150 150 { -
code/branches/presentation2/src/libraries/network/ClientConnection.h
r5961 r6387 26 26 * 27 27 */ 28 28 29 29 #ifndef _ClientConnection_H__ 30 30 #define _ClientConnection_H__ … … 40 40 ClientConnection(); 41 41 virtual ~ClientConnection(); 42 42 43 43 void setServerAddress( const std::string& serverAddress ); 44 44 void setPort( unsigned int port ); 45 45 46 46 ENetEvent *getEvent(); 47 47 // check wheter the packet queue is empty … … 59 59 virtual void addPeer(ENetEvent* event); 60 60 virtual void removePeer(ENetEvent* event); 61 61 62 62 bool disconnectConnection(); 63 63 // enet stuff -
code/branches/presentation2/src/libraries/network/ClientConnectionListener.cc
r5929 r6387 45 45 it->clientConnected(clientID); 46 46 } 47 47 48 48 void ClientConnectionListener::broadcastClientDisconnected(unsigned int clientID) 49 49 { -
code/branches/presentation2/src/libraries/network/ClientConnectionListener.h
r5929 r6387 40 40 ClientConnectionListener(); 41 41 virtual ~ClientConnectionListener() {} 42 42 43 43 static void broadcastClientConnected(unsigned int clientID); 44 44 static void broadcastClientDisconnected(unsigned int clientID); -
code/branches/presentation2/src/libraries/network/ClientInformation.cc
r5961 r6387 46 46 namespace orxonox 47 47 { 48 48 49 49 50 50 ClientInformation *ClientInformation::head_=0; -
code/branches/presentation2/src/libraries/network/Connection.cc
r5929 r6387 75 75 void Connection::processQueue() { 76 76 ENetEvent event; 77 77 78 78 assert(this->host_); 79 79 -
code/branches/presentation2/src/libraries/network/Connection.h
r5929 r6387 54 54 public: 55 55 virtual ~Connection(); 56 56 57 57 static bool addPacket(ENetPacket *packet, ENetPeer *peer); 58 58 bool sendPackets(); … … 62 62 Connection(); 63 63 static Connection* getInstance(){ return Connection::instance_; } 64 64 65 65 int service(ENetEvent* event); 66 66 virtual void disconnectPeer(ENetPeer *peer); 67 67 68 68 void processQueue(); 69 69 virtual void addPeer(ENetEvent* event)=0; 70 70 virtual void removePeer(ENetEvent* event)=0; 71 71 virtual bool processPacket(ENetEvent* event); 72 72 73 73 ENetHost *host_; 74 74 private: -
code/branches/presentation2/src/libraries/network/FunctionCallManager.cc
r6073 r6387 31 31 32 32 namespace orxonox { 33 33 34 34 std::map<uint32_t, packet::FunctionCalls*> FunctionCallManager::clientMap_; 35 35 -
code/branches/presentation2/src/libraries/network/FunctionCallManager.h
r6073 r6387 49 49 static void addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4); 50 50 static void addCallStatic(uint32_t functionID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5); 51 51 52 52 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID); 53 53 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1); … … 56 56 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4); 57 57 static void addCallMember(uint32_t functionID, uint32_t objectID, uint32_t clientID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5); 58 58 59 59 static void sendCalls(); 60 60 61 61 static std::map<uint32_t, packet::FunctionCalls*> clientMap_; 62 62 protected: -
code/branches/presentation2/src/libraries/network/GamestateClient.cc
r5929 r6387 81 81 packet::Gamestate *processed = processGamestate(tempGamestate_); 82 82 assert(processed); 83 83 84 84 //now call the queued callbacks 85 85 NetworkCallbackManager::callCallbacks(); 86 86 87 87 if (!processed){ 88 88 sendAck(0); -
code/branches/presentation2/src/libraries/network/GamestateHandler.cc
r5781 r6387 33 33 34 34 GamestateHandler *GamestateHandler::instance_=0; 35 35 36 36 GamestateHandler::GamestateHandler() 37 37 { -
code/branches/presentation2/src/libraries/network/GamestateManager.cc
r5929 r6387 126 126 return true; 127 127 } 128 128 129 129 void GamestateManager::sendGamestates() 130 130 { … … 142 142 COUT(5) << "Server: doing gamestate gamestate preparation" << std::endl; 143 143 int cid = temp->getID(); //get client id 144 144 145 145 unsigned int gID = temp->getGamestateID(); 146 146 if(!reference) 147 147 return; 148 148 149 149 packet::Gamestate *client=0; 150 150 if(gID != GAMESTATEID_INITIAL){ … … 156 156 } 157 157 } 158 158 159 159 clientGamestates.push(0); 160 160 finishGamestate( cid, &clientGamestates.back(), client, reference ); … … 165 165 // this->threadPool_->passFunction( executor, true ); 166 166 // (*functor)( cid, &(clientGamestates.back()), client, reference ); 167 167 168 168 temp = temp->next(); 169 169 } 170 170 171 171 // threadPool_->synchronise(); 172 172 173 173 while( !clientGamestates.empty() ) 174 174 { … … 185 185 // save the (undiffed) gamestate in the clients gamestate map 186 186 //chose wheather the next gamestate is the first or not 187 187 188 188 packet::Gamestate *gs = gamestate->doSelection(clientID, 20000); 189 189 // packet::Gamestate *gs = new packet::Gamestate(*gamestate); … … 193 193 gamestateMap_[clientID][gamestate->getID()]=gs; 194 194 // this->threadMutex_->unlock(); 195 195 196 196 if(base) 197 197 { 198 198 199 199 // COUT(3) << "diffing" << std::endl; 200 200 // packet::Gamestate* gs1 = gs; … … 210 210 gs = new packet::Gamestate(*gs); 211 211 } 212 213 212 213 214 214 bool b = gs->compressData(); 215 215 assert(b); -
code/branches/presentation2/src/libraries/network/NetworkFunction.cc
r6160 r6387 33 33 { 34 34 std::map<uint32_t, bool> NetworkFunctionBase::isStaticMap_; 35 35 36 36 std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_; 37 37 std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_; … … 40 40 { 41 41 RegisterRootObject(NetworkFunctionBase); 42 42 43 43 static uint32_t networkID = 0; 44 44 this->networkID_ = networkID++; 45 45 46 46 this->name_ = name; 47 47 NetworkFunctionBase::getNameMap()[name] = this; … … 50 50 { 51 51 } 52 53 52 53 54 54 void NetworkFunctionBase::destroyAllNetworkFunctions() 55 55 { … … 59 59 it->second->destroy(); 60 60 } 61 62 61 62 63 63 /*static*/ std::map<std::string, NetworkFunctionBase*>& NetworkFunctionBase::getNameMap() 64 64 { … … 66 66 return nameMap_; 67 67 } 68 69 68 69 70 70 NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p): 71 71 NetworkFunctionBase(name) 72 72 { 73 73 RegisterObject(NetworkFunctionStatic); 74 74 75 75 this->functor_ = functor; 76 76 NetworkFunctionStatic::getFunctorMap()[p] = this; 77 77 NetworkFunctionStatic::getIdMap()[ this->getNetworkID() ] = this; 78 78 } 79 79 80 80 NetworkFunctionStatic::~NetworkFunctionStatic() 81 81 { 82 82 delete this->functor_; 83 83 } 84 84 85 85 /*static*/ std::map<NetworkFunctionPointer, NetworkFunctionStatic*>& NetworkFunctionStatic::getFunctorMap() 86 86 { … … 88 88 return functorMap_; 89 89 } 90 90 91 91 /*static*/ std::map<uint32_t, NetworkFunctionStatic*>& NetworkFunctionStatic::getIdMap() 92 92 { … … 94 94 return idMap_; 95 95 } 96 97 96 97 98 98 NetworkMemberFunctionBase::NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p): 99 99 NetworkFunctionBase(name) 100 100 { 101 101 RegisterObject(NetworkMemberFunctionBase); 102 102 103 103 this->functorMap_[p] = this; 104 104 this->idMap_[ this->getNetworkID() ] = this; 105 105 } 106 106 107 107 NetworkMemberFunctionBase::~NetworkMemberFunctionBase() 108 108 { 109 109 } 110 110 111 111 112 112 } -
code/branches/presentation2/src/libraries/network/NetworkFunction.h
r6160 r6387 74 74 NetworkFunctionBase(const std::string& name); 75 75 ~NetworkFunctionBase(); 76 76 77 77 virtual void setNetworkID(uint32_t id) { this->networkID_ = id; } 78 78 inline uint32_t getNetworkID() const { return this->networkID_; } 79 79 inline const std::string& getName() const { return name_; } 80 80 static inline bool isStatic( uint32_t networkID ) { return isStaticMap_[networkID]; } 81 81 82 82 static inline void setNetworkID(const std::string& name, uint32_t id) 83 83 { … … 86 86 map[name]->setNetworkID(id); 87 87 } 88 88 89 89 static void destroyAllNetworkFunctions(); 90 90 91 91 protected: 92 92 static std::map<uint32_t, bool> isStaticMap_; 93 93 94 94 private: 95 95 static std::map<std::string, NetworkFunctionBase*>& getNameMap(); 96 96 uint32_t networkID_; 97 97 std::string name_; 98 98 99 99 }; 100 100 … … 104 104 NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p); 105 105 ~NetworkFunctionStatic(); 106 106 107 107 inline void call(){ (*this->functor_)(); } 108 108 inline void call(const MultiType& mt1){ (*this->functor_)(mt1); } … … 111 111 inline void call(const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4){ (*this->functor_)(mt1, mt2, mt3, mt4); } 112 112 inline void call(const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5){ (*this->functor_)(mt1, mt2, mt3, mt4, mt5); } 113 113 114 114 virtual void setNetworkID( uint32_t id ) 115 115 { NetworkFunctionBase::setNetworkID( id ); NetworkFunctionStatic::getIdMap()[id] = this; } … … 120 120 static NetworkFunctionStatic* getFunction( const NetworkFunctionPointer& p ) 121 121 { assert( NetworkFunctionStatic::getFunctorMap().find(p) != NetworkFunctionStatic::getFunctorMap().end() ); return NetworkFunctionStatic::getFunctorMap()[p]; } 122 122 123 123 private: 124 124 static std::map<NetworkFunctionPointer, NetworkFunctionStatic*>& getFunctorMap(); 125 125 static std::map<uint32_t, NetworkFunctionStatic*>& getIdMap(); 126 126 FunctorStatic* functor_; 127 127 128 128 }; 129 129 … … 133 133 NetworkMemberFunctionBase(const std::string& name, const NetworkFunctionPointer& p); 134 134 ~NetworkMemberFunctionBase(); 135 135 136 136 virtual void setNetworkID( uint32_t id ){ NetworkFunctionBase::setNetworkID( id ); idMap_[id] = this; } 137 137 static inline NetworkMemberFunctionBase* getNetworkFunction( uint32_t id){ assert( idMap_.find(id)!=idMap_.end() ); return idMap_[id]; } 138 138 static NetworkMemberFunctionBase* getFunction( uint32_t id ){ assert( idMap_.find(id) != idMap_.end() ); return idMap_[id]; } 139 139 static NetworkMemberFunctionBase* getFunction( const NetworkFunctionPointer& p ){ assert( functorMap_.find(p) != functorMap_.end() ); return functorMap_[p]; } 140 140 141 141 // 142 142 virtual void call(uint32_t objectID)=0; … … 146 146 virtual void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4)=0; 147 147 virtual void call(uint32_t objectID, const MultiType& mt1, const MultiType& mt2, const MultiType& mt3, const MultiType& mt4, const MultiType& mt5)=0; 148 148 149 149 private: 150 150 static std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> functorMap_; … … 157 157 NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p); 158 158 ~NetworkMemberFunction(); 159 159 160 160 inline void call(uint32_t objectID) 161 161 { … … 188 188 (*this->functor_)(orxonox_cast<T*>(Synchronisable::getSynchronisable(objectID)), mt1, mt2, mt3, mt4, mt5); 189 189 } 190 190 191 191 private: 192 192 FunctorMember<T>* functor_; -
code/branches/presentation2/src/libraries/network/Server.cc
r5961 r6387 137 137 // receive incoming packets 138 138 Connection::processQueue(); 139 139 140 140 if ( ClientInformation::hasClients() ) 141 141 { 142 142 // process incoming gamestates 143 143 GamestateManager::processGamestates(); 144 144 145 145 // send function calls to clients 146 146 FunctionCallManager::sendCalls(); 147 147 148 148 //this steers our network frequency 149 149 timeSinceLastUpdate_+=time.getDeltaTime(); … … 160 160 return ServerConnection::addPacket(packet, clientID); 161 161 } 162 162 163 163 /** 164 164 * @brief: returns ping time to client in milliseconds … … 168 168 return ClientInformation::findClient(clientID)->getRTT(); 169 169 } 170 170 171 171 void Server::printRTT() 172 172 { … … 317 317 } 318 318 COUT(5) << "Con.Man: creating client id: " << temp->getID() << std::endl; 319 319 320 320 // synchronise class ids 321 321 syncClassid(temp->getID()); 322 322 323 323 // now synchronise functionIDs 324 324 packet::FunctionIDs *fIDs = new packet::FunctionIDs(); … … 326 326 bool b = fIDs->send(); 327 327 assert(b); 328 328 329 329 temp->setSynched(true); 330 330 COUT(4) << "sending welcome" << std::endl; … … 344 344 return true; 345 345 } 346 346 347 347 void Server::disconnectClient( ClientInformation *client ){ 348 348 ServerConnection::disconnectClient( client ); -
code/branches/presentation2/src/libraries/network/Server.h
r5961 r6387 66 66 unsigned int shipID(){return 0;} 67 67 unsigned int playerID(){return 0;} 68 68 69 69 void addPeer(ENetEvent *event); 70 70 void removePeer(ENetEvent *event); 71 71 72 72 bool createClient(int clientID); 73 73 void disconnectClient( ClientInformation *client); -
code/branches/presentation2/src/libraries/network/ServerConnection.cc
r5929 r6387 99 99 return true; 100 100 } 101 101 102 102 void ServerConnection::disconnectClient(ClientInformation *client) 103 103 { 104 104 Connection::disconnectPeer( client->getPeer() ); 105 105 } 106 106 107 107 void ServerConnection::disconnectClient(int clientID){ 108 108 ClientInformation *client = ClientInformation::findClient(clientID); -
code/branches/presentation2/src/libraries/network/ServerConnection.h
r5929 r6387 50 50 public: 51 51 ~ServerConnection(); 52 52 53 53 void setBindAddress( const std::string& bindAddress ); 54 54 void setPort( unsigned int port ); 55 55 56 56 bool openListener(); 57 57 bool closeListener(); -
code/branches/presentation2/src/libraries/network/TrafficControl.cc
r6073 r6387 145 145 assert(clientListPerm_.find(clientID) != clientListPerm_.end() ); 146 146 assert( clientListTemp_[clientID].find(gamestateID) != clientListTemp_[clientID].end() ); 147 147 148 148 // shortcut for maps 149 149 std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID]; … … 236 236 //if listToProcess contains new Objects, add them to clientListPerm 237 237 std::list<obj>::iterator itvec; 238 238 239 239 std::map<unsigned int, objInfo >& objectListPerm = clientListPerm_[clientID]; 240 240 241 241 for( itvec=list.begin(); itvec != list.end(); itvec++) 242 242 { … … 256 256 } 257 257 //end compare listToProcess vs clientListPerm 258 258 259 259 //sort copied list according to priorities 260 260 // use boost bind here because we need to pass a memberfunction to stl sort 261 261 // sort( list.begin(), list.end(), boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) ); 262 262 list.sort( boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) ); 263 263 264 264 // list.sort(boost::bind(&TrafficControl::prioritySort, this, clientID, _1, _2) ); 265 265 … … 277 277 // sort(list.begin(), list.end(), boost::bind(&TrafficControl::dataSort, this, _1, _2) ); 278 278 list.sort( boost::bind(&TrafficControl::dataSort, this, _1, _2) ); 279 279 280 280 //diese Funktion updateClientList muss noch gemacht werden 281 281 updateClientListTemp(list); -
code/branches/presentation2/src/libraries/network/TrafficControl.h
r6073 r6387 69 69 obj( uint32_t ID, uint32_t creatorID, uint32_t size, uint32_t offset ); 70 70 }; 71 71 72 72 73 73 … … 97 97 unsigned int targetSize; 98 98 bool bActive_; 99 99 100 100 void insertinClientListPerm(unsigned int clientID, obj objinf); 101 101 102 102 void cut(std::list<obj>& list, unsigned int targetsize); 103 103 void updateClientListTemp(std::list<obj>& list);//done … … 107 107 void evaluateList(unsigned int clientID, std::list<obj>& list);//done 108 108 void ack(unsigned int clientID, unsigned int gamestateID); // this function gets called when the server receives an ack from the client 109 109 110 110 //ClientConnectionListener functions 111 111 virtual void clientConnected(unsigned int clientID){}; 112 112 virtual void clientDisconnected(unsigned int clientID); 113 113 114 114 115 115 protected: 116 116 static TrafficControl *instance_; … … 131 131 { return instance_->ack(clientID, gamestateID); } 132 132 void deleteObject(unsigned int objectID); // this function gets called when an object has been deleted (in order to clean up lists and maps) 133 133 134 134 bool prioritySort(uint32_t clientID, obj i, obj j); 135 135 bool dataSort(obj i, obj j); -
code/branches/presentation2/src/libraries/network/packet/Acknowledgement.cc
r5781 r6387 38 38 #define _PACKETID 0 39 39 #define _ACKID _PACKETID + sizeof(packet::Type::Value) 40 40 41 41 Acknowledgement::Acknowledgement( unsigned int id, unsigned int clientID ) 42 42 : Packet() -
code/branches/presentation2/src/libraries/network/packet/Chat.cc
r5781 r6387 35 35 namespace orxonox { 36 36 namespace packet { 37 37 38 38 #define PACKET_FLAGS_CHAT PacketFlag::Reliable 39 39 #define _PACKETID 0 -
code/branches/presentation2/src/libraries/network/packet/ClassID.h
r6073 r6387 36 36 namespace packet { 37 37 38 38 39 39 /** 40 40 @author -
code/branches/presentation2/src/libraries/network/packet/DeleteObjects.cc
r6192 r6387 41 41 #define _QUANTITY _PACKETID + sizeof(Type::Value) 42 42 #define _OBJECTIDS _QUANTITY + sizeof(uint32_t) 43 43 44 44 DeleteObjects::DeleteObjects() 45 45 : Packet() -
code/branches/presentation2/src/libraries/network/packet/FunctionCalls.cc
r5781 r6387 36 36 namespace orxonox { 37 37 namespace packet { 38 38 39 39 #define PACKET_FLAGS_FUNCTIONCALLS PacketFlag::Reliable 40 40 #define _PACKETID 0 41 41 const unsigned int FUNCTIONCALLS_MEM_ALLOCATION = 1000; 42 42 43 43 FunctionCalls::FunctionCalls() 44 44 : Packet() … … 171 171 void FunctionCalls::addCallStatic( uint32_t networkID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){ 172 172 assert(!isDataENetAllocated()); 173 173 174 174 // first determine the size that has to be reserved for this call 175 175 uint32_t callsize = 2*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and for bool isStatic … … 200 200 } 201 201 } 202 202 203 203 // now allocated mem if neccessary 204 204 if( currentSize_ + callsize > currentMemBlocks_*FUNCTIONCALLS_MEM_ALLOCATION ) … … 210 210 data_ = temp; 211 211 } 212 212 213 213 // now serialise the mt values and copy the function id and isStatic 214 214 uint8_t* temp = data_+currentSize_; … … 240 240 //currentSize_ += callsize; 241 241 currentSize_ = temp-data_; 242 242 243 243 } 244 244 245 245 void FunctionCalls::addCallMember( uint32_t networkID, uint32_t objectID, const MultiType* mt1, const MultiType* mt2, const MultiType* mt3, const MultiType* mt4, const MultiType* mt5){ 246 246 assert(!isDataENetAllocated()); 247 247 248 248 // first determine the size that has to be reserved for this call 249 249 uint32_t callsize = 3*sizeof(uint32_t)+sizeof(uint8_t); //size for network-function-id and nrOfArguments and the objectID … … 274 274 } 275 275 } 276 276 277 277 // now allocated mem if neccessary 278 278 if( currentSize_ + callsize > currentMemBlocks_*FUNCTIONCALLS_MEM_ALLOCATION ) … … 284 284 data_ = temp; 285 285 } 286 286 287 287 // now serialise the mt values and copy the function id 288 288 uint8_t* temp = data_+currentSize_; … … 314 314 } 315 315 currentSize_ += callsize; 316 316 317 317 } 318 318 -
code/branches/presentation2/src/libraries/network/packet/FunctionIDs.cc
r5781 r6387 53 53 flags_ = flags_ | PACKET_FLAGS_FUNCTIONIDS; 54 54 std::queue<std::pair<uint32_t, std::string> > tempQueue; 55 55 56 56 //calculate total needed size (for all strings and integers) 57 57 ObjectList<NetworkFunctionBase>::iterator it; … … 64 64 packetSize += (functionname.size()+1)+sizeof(uint32_t)+sizeof(uint32_t); // reserver size for the functionname string, the functionname length and the networkID 65 65 } 66 66 67 67 this->data_=new uint8_t[ packetSize ]; 68 68 //set the appropriate packet id 69 69 assert(this->data_); 70 70 *(Type::Value *)(this->data_ + _PACKETID ) = Type::FunctionIDs; 71 71 72 72 uint8_t *temp=data_+sizeof(uint32_t); 73 73 // save the number of all classes 74 74 *(uint32_t*)temp = nrOfFunctions; 75 75 temp += sizeof(uint32_t); 76 76 77 77 // now save all classids and classnames 78 78 std::pair<uint32_t, std::string> tempPair; … … 85 85 temp+=2*sizeof(uint32_t)+tempPair.second.size()+1; 86 86 } 87 87 88 88 COUT(5) << "FunctionIDs packetSize is " << packetSize << endl; 89 89 90 90 } 91 91 … … 106 106 temp += sizeof(uint32_t); 107 107 totalsize += sizeof(uint32_t); // storage size for nr of all classes 108 108 109 109 for(unsigned int i=0; i<nrOfFunctions; i++){ 110 110 totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t)); // for each network function add size for id, sizeof(string) and length of string itself to totalsize … … 121 121 uint32_t stringsize; 122 122 unsigned char *functionname; 123 123 124 124 COUT(4) << "=== processing functionids: " << endl; 125 125 std::pair<uint32_t, std::string> tempPair; … … 127 127 nrOfFunctions = *(uint32_t*)temp; 128 128 temp += sizeof(uint32_t); 129 129 130 130 for( int i=0; i<nrOfFunctions; i++){ 131 131 networkID = *(uint32_t*)temp; -
code/branches/presentation2/src/libraries/network/packet/FunctionIDs.h
r6073 r6387 36 36 namespace packet { 37 37 38 38 39 39 /** 40 40 @author -
code/branches/presentation2/src/libraries/network/packet/Gamestate.cc
r5929 r6387 95 95 return false; 96 96 } 97 97 98 98 // create the header object 99 99 assert( header_ == 0 ); … … 105 105 ObjectList<Synchronisable>::iterator it; 106 106 for(it = ObjectList<Synchronisable>::begin(); it; ++it){ 107 107 108 108 // tempsize=it->getSize(id, mode); 109 109 … … 111 111 if ( tempsize != 0 ) 112 112 dataVector_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) ); 113 113 114 114 #ifndef NDEBUG 115 115 if(currentsize+tempsize > size){ … … 362 362 assert(!header_->isCompressed() && !base->header_->isCompressed()); 363 363 assert(!header_->isDiffed()); 364 364 365 365 uint8_t *basep = GAMESTATE_START(base->data_); 366 366 uint8_t *gs = GAMESTATE_START(this->data_); 367 367 uint32_t dest_length = header_->getDataSize(); 368 368 369 369 if(dest_length==0) 370 370 return NULL; 371 371 372 372 uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()]; 373 373 uint8_t *dest = GAMESTATE_START(ndata); 374 374 375 375 rawDiff( dest, gs, basep, header_->getDataSize(), base->header_->getDataSize() ); 376 376 #ifndef NDEBUG … … 398 398 assert(!header_->isCompressed() && !base->header_->isCompressed()); 399 399 assert(header_->isDiffed()); 400 400 401 401 uint8_t *basep = GAMESTATE_START(base->data_); 402 402 uint8_t *gs = GAMESTATE_START(this->data_); 403 403 uint32_t dest_length = header_->getDataSize(); 404 404 405 405 if(dest_length==0) 406 406 return NULL; 407 407 408 408 uint8_t *ndata = new uint8_t[dest_length*sizeof(uint8_t)+GamestateHeader::getSize()]; 409 409 uint8_t *dest = ndata + GamestateHeader::getSize(); 410 410 411 411 rawDiff( dest, gs, basep, header_->getDataSize(), base->header_->getDataSize() ); 412 412 413 413 Gamestate *g = new Gamestate(ndata, getClientID()); 414 414 assert(g->header_); … … 481 481 uint64_t* bd = (uint64_t*)basedata; 482 482 uint64_t* nd = (uint64_t*)newdata; 483 483 484 484 unsigned int i; 485 485 for( i=0; i<datalength/8; i++ ) -
code/branches/presentation2/src/libraries/network/packet/Packet.cc
r6105 r6387 101 101 @brief 102 102 Destroys a packet completely. 103 103 104 104 That also means destroying the ENetPacket if one exists. There 105 105 */ -
code/branches/presentation2/src/libraries/network/synchronisable/NetworkCallback.h
r6192 r6387 36 36 37 37 namespace orxonox{ 38 38 39 39 struct EmptyType{}; 40 40 41 41 class _NetworkExport NetworkCallbackBase 42 42 { … … 60 60 void (T::*function_) (void); 61 61 }; 62 62 63 63 template <class T, class U> 64 64 class NetworkCallbackNotify: public NetworkCallbackBase -
code/branches/presentation2/src/libraries/network/synchronisable/NetworkCallbackManager.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 #include "NetworkCallbackManager.h" 30 30 #include "NetworkCallback.h" 31 31 32 32 namespace orxonox{ 33 33 34 34 std::set<NetworkCallbackBase*> NetworkCallbackManager::callbackSet_; 35 35 std::queue<NetworkCallbackBase*> NetworkCallbackManager::triggeredCallbacks_; 36 36 37 37 void NetworkCallbackManager::registerCallback(NetworkCallbackBase *cb) 38 38 { … … 48 48 } 49 49 } 50 50 51 51 void NetworkCallbackManager::triggerCallback(NetworkCallbackBase *cb) 52 52 { -
code/branches/presentation2/src/libraries/network/synchronisable/NetworkCallbackManager.h
r5781 r6387 37 37 38 38 namespace orxonox{ 39 39 40 40 class _NetworkExport NetworkCallbackManager{ 41 41 public: … … 48 48 static std::queue<NetworkCallbackBase*> triggeredCallbacks_; 49 49 }; 50 50 51 51 52 52 } -
code/branches/presentation2/src/libraries/network/synchronisable/Synchronisable.cc
r6192 r6387 62 62 } 63 63 classID_ = static_cast<uint32_t>(-1); 64 64 65 65 // set dataSize to 0 66 66 this->dataSize_ = 0; … … 277 277 //tempsize += (*i)->getSize( mode ); 278 278 } 279 279 280 280 tempsize += SynchronisableHeader::getSize(); 281 281 header.setObjectID( this->objectID_ ); … … 284 284 header.setDataAvailable( true ); 285 285 header.setDataSize( tempsize ); 286 286 287 287 #ifndef NDEBUG 288 288 uint32_t size; -
code/branches/presentation2/src/libraries/network/synchronisable/Synchronisable.h
r6193 r6387 132 132 inline unsigned int getPriority() const { return this->objectFrequency_;} 133 133 inline uint8_t getSyncMode() const { return this->objectMode_; } 134 134 135 135 void setSyncMode(uint8_t mode); 136 136 … … 138 138 Synchronisable(BaseObject* creator); 139 139 template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false); 140 140 141 141 void setPriority(unsigned int freq){ objectFrequency_ = freq; } 142 142 … … 148 148 bool isMyData(uint8_t* mem); 149 149 bool doSync(int32_t id, uint8_t mode=0x0); 150 150 151 151 inline void setObjectID(uint32_t id){ this->objectID_ = id; objectMap_[this->objectID_] = this; } 152 152 inline void setClassID(uint32_t id){ this->classID_ = id; } … … 181 181 } 182 182 } 183 183 184 184 template <> _NetworkExport void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional); 185 185 186 186 187 187 } 188 188 -
code/branches/presentation2/src/libraries/network/synchronisable/SynchronisableVariable.h
r6192 r6387 41 41 42 42 namespace orxonox{ 43 43 44 44 namespace VariableDirection{ 45 45 enum Value{ … … 54 54 }; 55 55 } 56 56 57 57 class _NetworkExport SynchronisableVariableBase 58 58 { … … 85 85 NetworkCallbackBase *callback_; 86 86 }; 87 87 88 88 template <class T> 89 89 class SynchronisableVariableBidirectional: public SynchronisableVariable<T> … … 92 92 SynchronisableVariableBidirectional(T& variable, uint8_t master=Bidirectionality::ServerMaster, NetworkCallbackBase *cb=0); 93 93 virtual ~SynchronisableVariableBidirectional(); 94 94 95 95 virtual inline uint8_t getMode(){ return 0x3; } //this basically is a hack ^^ 96 96 virtual inline uint32_t getData(uint8_t*& mem, uint8_t mode); … … 112 112 } 113 113 } 114 114 115 115 template <class T> SynchronisableVariable<T>::~SynchronisableVariable() 116 116 { … … 253 253 return returnSize( this->variable_ ) + sizeof(varReference_); 254 254 } 255 255 256 256 257 257 } -
code/branches/presentation2/src/libraries/tools/Timer.cc
r5929 r6387 112 112 this->deleteExecutor(); 113 113 } 114 114 115 115 /** 116 116 @brief Initializes the Timer -
code/branches/presentation2/src/libraries/tools/Timer.h
r5929 r6387 140 140 private: 141 141 void init(); 142 142 143 143 Executor* executor_; //!< The executor of the function that should be called when the time expires 144 144 -
code/branches/presentation2/src/libraries/tools/interfaces/TimeFactorListener.h
r6160 r6387 40 40 TimeFactorListener(); 41 41 virtual ~TimeFactorListener() {} 42 42 43 43 static void setTimeFactor( float factor ); 44 44 static void setTimeFactorInternal( float factor ); -
code/branches/presentation2/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
r6160 r6387 46 46 //---------------------------- 47 47 registerStaticNetworkFunction( &TimeFactorListener::setTimeFactorInternal ); 48 48 49 49 float TimeFactorListener::timefactor_s = 1.0f; 50 50 … … 60 60 TimeFactorListener::setTimeFactorInternal(factor); 61 61 } 62 62 63 63 /*static*/ void TimeFactorListener::setTimeFactorInternal( float factor ) 64 64 { -
code/branches/presentation2/src/libraries/util/Clock.cc
r6319 r6387 44 44 delete timer_; 45 45 } 46 46 47 47 /** 48 48 @remarks -
code/branches/presentation2/src/libraries/util/Math.cc
r6137 r6387 138 138 return orxonox::Vector2(0, 1); 139 139 } 140 140 141 141 float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1); 142 142 float sin_value = sqrt( 1 - cos_value*cos_value ); 143 143 144 144 if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0) 145 145 return orxonox::Vector2( sin_value, cos_value ); … … 179 179 } 180 180 //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1)); 181 181 182 182 float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1); 183 183 float sin_value = sqrt( 1 - cos_value*cos_value ); -
code/branches/presentation2/src/libraries/util/MultiType.h
r5738 r6387 232 232 233 233 virtual void toString(std::ostream& outstream) const = 0; 234 234 235 235 virtual void importData( uint8_t*& mem )=0; 236 236 virtual void exportData( uint8_t*& mem ) const=0; … … 339 339 template <typename T> inline bool isType() const { return false; } // Only works for specialized values - see below 340 340 std::string getTypename() const; 341 341 342 342 /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */ 343 343 inline void exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); } -
code/branches/presentation2/src/libraries/util/MultiTypeValue.h
r5738 r6387 150 150 /** @brief Puts the current value on the stream */ 151 151 inline void toString(std::ostream& outstream) const { outstream << this->value_; } 152 152 153 153 /** @brief loads data from the bytestream (mem) into the MT and increases the bytestream pointer by the size of the data */ 154 154 inline void importData( uint8_t*& mem ) { loadAndIncrease( /*(const T&)*/this->value_, mem ); } … … 160 160 T value_; //!< The stored value 161 161 }; 162 162 163 163 // Import / Export specialisation 164 164 // ColourValue -
code/branches/presentation2/src/libraries/util/Serialise.h
r6320 r6387 40 40 41 41 namespace orxonox{ 42 42 43 43 /** @brief returns the size of the variable in a datastream */ 44 44 template <class T> inline uint32_t returnSize( const T& variable ); … … 202 202 return sizeof(uint32_t); 203 203 } 204 204 205 205 template <> inline void loadAndIncrease( const unsigned int& variable, uint8_t*& mem ) 206 206 { … … 470 470 return variable==Degree(*r); 471 471 } 472 472 473 473 // =========== Vector2 474 474 … … 494 494 return checkEquality(variable.x, mem) && checkEquality(variable.y, mem+returnSize(variable.x)); 495 495 } 496 496 497 497 // =========== Vector3 498 498 … … 521 521 checkEquality(variable.z, mem+returnSize(variable.x)+returnSize(variable.y)); 522 522 } 523 523 524 524 // =========== Vector4 525 525 … … 551 551 checkEquality(variable.z, mem+returnSize(variable.w)+returnSize(variable.x)+returnSize(variable.y)); 552 552 } 553 553 554 554 // =========== Quaternion 555 555 … … 581 581 checkEquality(variable.z, mem+returnSize(variable.w)+returnSize(variable.x)+returnSize(variable.y)); 582 582 } 583 583 584 584 // =========== ColourValue 585 585 … … 611 611 checkEquality(variable.a, mem+returnSize(variable.r)+returnSize(variable.g)+returnSize(variable.b)); 612 612 } 613 613 614 614 // =========== mbool 615 615 -
code/branches/presentation2/src/libraries/util/mbool.h
r5738 r6387 67 67 inline bool operator!() const 68 68 { return (!this->value_.bool_); } 69 69 70 70 inline unsigned char& getMemory(){ return value_.memory_; } 71 71 -
code/branches/presentation2/src/modules/objects/eventsystem/EventTarget.cc
r5929 r6387 45 45 { 46 46 } 47 47 48 48 void EventTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode) 49 49 { … … 72 72 { 73 73 this->target_ = name; 74 74 75 75 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it) 76 76 if (it->getName() == this->target_) -
code/branches/presentation2/src/modules/objects/eventsystem/EventTarget.h
r5929 r6387 42 42 EventTarget(BaseObject* creator); 43 43 virtual ~EventTarget(); 44 44 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 47 47 virtual void processEvent(Event& event); 48 48 … … 54 54 virtual void loadedNewXMLName(BaseObject* object); 55 55 void addEventTarget(BaseObject* object); 56 56 57 57 std::string target_; 58 58 bool bActive_; -
code/branches/presentation2/src/modules/overlays/GUIOverlay.cc
r6150 r6387 62 62 { 63 63 SUPER(GUIOverlay, changedVisibility); 64 64 65 65 //Setting player now. 66 66 if( this->getOwner() ) -
code/branches/presentation2/src/modules/overlays/hud/UnderAttackHealthBar.cc
r6054 r6387 94 94 } 95 95 } 96 96 97 97 void UnderAttackHealthBar::changedOverlayGroup() 98 98 { 99 99 SUPER(UnderAttackHealthBar, changedOverlayGroup); 100 100 101 101 this->getOverlayGroup()->addElement(this->text_.get()); 102 102 } -
code/branches/presentation2/src/modules/overlays/stats/CreateLines.cc
r5980 r6387 94 94 this->background_->changedVisibility(); 95 95 } 96 96 97 97 void CreateLines::setOverlayGroup( OverlayGroup* group ) 98 98 { -
code/branches/presentation2/src/modules/pong/Pong.cc
r5929 r6387 42 42 CreateEventName(PongCenterpoint, right); 43 43 CreateEventName(PongCenterpoint, left); 44 44 45 45 CreateUnloadableFactory(Pong); 46 46 … … 164 164 else if (player == this->getLeftPlayer()) 165 165 this->center_->fireEvent(FireEventName(PongCenterpoint, left)); 166 166 167 167 if (player) 168 168 this->gtinfo_->sendAnnounceMessage(player->getName() + " scored"); -
code/branches/presentation2/src/modules/pong/PongAI.cc
r5929 r6387 131 131 this->bOscillationAvoidanceActive_ = false; 132 132 } 133 133 134 134 // If the ball is close enough, calculate another random offset to accelerate the ball 135 135 if (!this->bChangedRandomOffset_) … … 206 206 // calculate the time until the ball reaches the other side 207 207 float totaltime = (-position.x + dimension.x / 2 * sgn(velocity.x)) / velocity.x; 208 208 209 209 // calculate wall bounce position (four possible solutions of the equation: pos.z + vel.z*t + acc.z/2*t^2 = +/- dim.z/2) 210 210 float bouncetime = totaltime; 211 211 bool bUpperWall = false; 212 212 213 213 if (acceleration.z == 0) 214 214 { … … 270 270 // ball bounces after <bouncetime> seconds, update the position and continue 271 271 velocity.z = velocity.z + acceleration.z * bouncetime; 272 272 273 273 if (bUpperWall) 274 274 { … … 281 281 velocity.z = fabs(velocity.z) - fabs(randomErrorZ); 282 282 } 283 283 284 284 position.x = position.x + velocity.x * bouncetime + randomErrorX; 285 285 this->ballEndPosition_ = position.z; -
code/branches/presentation2/src/modules/pong/PongBall.cc
r5929 r6387 105 105 velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_; 106 106 acceleration = this->bat_[1]->getVelocity() * this->accelerationFactor_ * -1; 107 107 108 108 this->fireEvent(); 109 109 } -
code/branches/presentation2/src/modules/questsystem/AddQuestHint.cc
r5781 r6387 71 71 72 72 XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode); 73 73 74 74 COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl; 75 75 } … … 90 90 return false; 91 91 } 92 92 93 93 this->hintId_ = id; 94 94 return true; -
code/branches/presentation2/src/modules/questsystem/AddReward.cc
r5781 r6387 67 67 68 68 XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode); 69 69 70 70 COUT(3) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl; 71 71 } … … 104 104 { 105 105 COUT(3) << "AddReward on player: " << player << " ." << std::endl; 106 106 107 107 bool check = true; 108 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward ) … … 110 110 check = check && (*reward)->reward(player); 111 111 } 112 112 113 113 COUT(3) << "Rewardable successfully added to player." << player << " ." << std::endl; 114 114 -
code/branches/presentation2/src/modules/questsystem/ChangeQuestStatus.cc
r5781 r6387 83 83 return false; 84 84 } 85 85 86 86 this->questId_ = id; 87 87 return true; -
code/branches/presentation2/src/modules/questsystem/CompleteQuest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 67 67 { 68 68 SUPER(CompleteQuest, XMLPort, xmlelement, mode); 69 69 70 70 COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } -
code/branches/presentation2/src/modules/questsystem/FailQuest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 67 67 { 68 68 SUPER(FailQuest, XMLPort, xmlelement, mode); 69 69 70 70 COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } … … 103 103 return false; 104 104 } 105 105 106 106 COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl; 107 107 return true; -
code/branches/presentation2/src/modules/questsystem/GlobalQuest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 59 59 60 60 } 61 61 62 62 /** 63 63 @brief … … 67 67 { 68 68 SUPER(GlobalQuest, XMLPort, xmlelement, mode); 69 69 70 70 XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode); 71 71 72 72 COUT(3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl; 73 73 } 74 74 75 75 /** 76 76 @brief … … 89 89 return false; 90 90 } 91 91 92 92 Quest::fail(player); 93 93 94 94 //! Iterate through all players possessing this Quest. 95 95 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) … … 118 118 return false; 119 119 } 120 120 121 121 //! Iterate through all players possessing the Quest. 122 122 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) … … 124 124 QuestEffect::invokeEffects(*it, this->getCompleteEffectList()); 125 125 } 126 126 127 127 Quest::complete(player); 128 128 129 129 QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest. 130 130 return true; … … 230 230 this->players_.insert(player); //!< Add the player to the set. 231 231 } 232 232 233 233 this->status_ = status; //!< Set the status, which is global, remember...? 234 234 return true; 235 235 } 236 236 237 237 /** 238 238 @brief … … 256 256 return true; 257 257 } 258 258 259 259 /** 260 260 @brief -
code/branches/presentation2/src/modules/questsystem/LocalQuest.cc
r5781 r6387 87 87 return false; 88 88 } 89 89 90 90 Quest::fail(player); 91 91 92 92 QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects. 93 93 return true; … … 110 110 return false; 111 111 } 112 112 113 113 Quest::complete(player); 114 114 115 115 QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects. 116 116 return true; … … 188 188 return it->second; 189 189 } 190 190 191 191 return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'. 192 192 } … … 209 209 return false; 210 210 } 211 211 212 212 this->playerStatus_[player] = status; 213 213 return true; -
code/branches/presentation2/src/modules/questsystem/Quest.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 204 204 { 205 205 int i = index; 206 206 207 207 //! Iterate through all subquests. 208 208 for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest) … … 214 214 i--; 215 215 } 216 216 217 217 return NULL; //!< If the index is greater than the number of elements in the list. 218 218 } … … 229 229 { 230 230 int i = index; 231 231 232 232 //! Iterate through all QuestHints. 233 233 for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint) … … 253 253 { 254 254 int i = index; 255 255 256 256 //! Iterate through all fail QuestEffects. 257 257 for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect) … … 277 277 { 278 278 int i = index; 279 279 280 280 //! Iterate through all complete QuestEffects. 281 281 for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect) … … 350 350 return this->getStatus(player) == QuestStatus::Completed; 351 351 } 352 352 353 353 /** 354 354 @brief … … 363 363 QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed. 364 364 this->setStatus(player, QuestStatus::Failed); 365 365 366 366 COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl; 367 367 368 368 this->getDescription()->sendFailQuestNotification(); 369 369 return true; 370 370 } 371 371 372 372 /** 373 373 @brief … … 382 382 QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed. 383 383 this->setStatus(player, QuestStatus::Completed); 384 384 385 385 COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl; 386 386 387 387 this->getDescription()->sendCompleteQuestNotification(); 388 388 return true; … … 404 404 return false; 405 405 } 406 406 407 407 COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl; 408 408 409 409 QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active. 410 410 411 411 this->setStatus(player, QuestStatus::Active); 412 412 413 413 this->getDescription()->sendAddQuestNotification(); 414 414 return true; 415 415 } 416 416 417 417 /** 418 418 @brief … … 430 430 return false; 431 431 } 432 432 433 433 this->listeners_.push_back(listener); 434 434 return true; -
code/branches/presentation2/src/modules/questsystem/QuestDescription.cc
r5781 r6387 50 50 { 51 51 RegisterObject(QuestDescription); 52 52 53 53 this->title_ = ""; 54 54 this->description_ = ""; … … 79 79 COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl; 80 80 } 81 81 82 82 /** 83 83 @brief … … 124 124 return false; 125 125 } 126 126 127 127 QuestNotification* notification = new QuestNotification(message); 128 128 notification->send(); -
code/branches/presentation2/src/modules/questsystem/QuestEffect.cc
r5781 r6387 69 69 { 70 70 bool check = true; 71 71 72 72 COUT(4) << "Invoking QuestEffects on player: " << player << " ." << std::endl; 73 73 -
code/branches/presentation2/src/modules/questsystem/QuestGUI.cc
r5929 r6387 77 77 } 78 78 this->windows_.clear(); 79 79 80 80 if(this->root_ != NULL) 81 81 this->root_->destroy(); … … 104 104 105 105 this->clear(); //!< Clear the GUI. 106 106 107 107 int depth = 0; 108 108 int index = 0; … … 235 235 236 236 this->nodes_.insert(std::pair<CEGUI::Window*, QuestGUINode*>(node->getWindow(),node)); //!< Insert the node and its window in the nodes_ map. 237 237 238 238 index++; 239 239 -
code/branches/presentation2/src/modules/questsystem/QuestGUI.h
r5781 r6387 56 56 57 57 public: 58 58 59 59 QuestGUI(PlayerInfo* player); 60 60 virtual ~QuestGUI(); … … 86 86 inline PlayerInfo* getPlayer(void) 87 87 { return this->player_; } 88 88 89 89 private: 90 90 91 91 int createNode(QuestGUINode* parent, QuestItem* item, int depth, int index); //!< Recursive method to create Nodes for all Quests an Hints the given Quest is a parent to. 92 92 -
code/branches/presentation2/src/modules/questsystem/QuestGUINode.cc
r5781 r6387 119 119 void QuestGUINode::toggleVisibility(void) 120 120 { 121 121 122 122 } 123 123 … … 209 209 offset += height; 210 210 } 211 211 212 212 //! Create title pane for the description. 213 213 stream.str(""); … … 282 282 { 283 283 COUT(3) << "Open QuestItem..." << std::endl; 284 284 285 285 //CEGUI::Window* window = this->gui_->getRootWindow(); 286 286 CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background"); … … 344 344 //! Set the height to the window. 345 345 window->setHeight(CEGUI::UDim(0, height)); 346 346 347 347 //Debug 348 348 const CEGUI::Rect newArea = getStaticTextArea(window); … … 368 368 { 369 369 Quest* quest = dynamic_cast<Quest*>(this->item_); 370 370 371 371 this->window_ = this->gui_->getWindow(); 372 372 std::ostringstream stream; … … 377 377 } 378 378 stream << this->index_; 379 379 380 380 this->window_->rename(stream.str()); 381 381 this->window_->setText(this->item_->getDescription()->getTitle()); -
code/branches/presentation2/src/modules/questsystem/QuestGUINode.h
r5781 r6387 44 44 45 45 public: 46 46 47 47 QuestGUINode(void); 48 48 QuestGUINode(QuestGUI* gui, QuestGUINode* parent, QuestItem* item, int depth, int index); 49 49 virtual ~QuestGUINode(void); 50 50 51 51 void toggleVisibility(void); 52 52 -
code/branches/presentation2/src/modules/questsystem/QuestHint.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 71 71 72 72 QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager. 73 73 74 74 COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl; 75 75 } … … 100 100 return it->second; 101 101 } 102 102 103 103 return QuestStatus::Inactive; 104 104 } … … 119 119 { 120 120 this->playerStatus_[player] = QuestHintStatus::Active; 121 121 122 122 this->getDescription()->sendAddHintNotification(); 123 123 return true; … … 129 129 } 130 130 } 131 131 132 132 COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl; 133 133 return false; -
code/branches/presentation2/src/modules/questsystem/QuestItem.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 86 86 return; 87 87 } 88 88 89 89 this->id_ = id; 90 90 } -
code/branches/presentation2/src/modules/questsystem/QuestListener.cc
r5781 r6387 50 50 { 51 51 RegisterObject(QuestListener); 52 52 53 53 this->mode_ = QuestListenerMode::All; 54 54 this->quest_ = NULL; 55 55 } 56 56 57 57 /** 58 58 @brief … … 62 62 { 63 63 } 64 64 65 65 /** 66 66 @brief … … 75 75 76 76 this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners. 77 77 78 78 COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl; 79 79 } 80 80 81 81 /** 82 82 @brief … … 98 98 } 99 99 } 100 100 101 101 /** 102 102 @brief … … 110 110 { 111 111 this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId. 112 112 113 113 if(this->quest_ == NULL) //!< If there is no such Quest. 114 114 { … … 116 116 return false; 117 117 } 118 118 119 119 return true; 120 120 } 121 121 122 122 /** 123 123 @brief … … 152 152 return false; 153 153 } 154 154 155 155 return true; 156 156 } 157 157 158 158 /** 159 159 @brief -
code/branches/presentation2/src/modules/questsystem/QuestNotification.cc
r5781 r6387 38 38 this->initialize(); 39 39 } 40 40 41 41 QuestNotification::QuestNotification(const std::string & message) : Notification(message) 42 42 { 43 43 this->initialize(); 44 44 } 45 45 46 46 QuestNotification::~QuestNotification() 47 47 { 48 48 49 49 } 50 50 -
code/branches/presentation2/src/modules/questsystem/notifications/Notification.cc
r5781 r6387 49 49 this->initialize(); 50 50 } 51 51 52 52 /** 53 53 @brief … … 60 60 this->message_ = message; 61 61 } 62 62 63 63 /** 64 64 @brief … … 68 68 { 69 69 } 70 70 71 71 /** 72 72 @brief … … 79 79 this->sent_ = false; 80 80 } 81 81 82 82 /** 83 83 @brief … … 90 90 return this->send(NotificationManager::NONE); 91 91 } 92 92 93 93 /** 94 94 @brief … … 106 106 return false; 107 107 this->sent_ = true; 108 108 109 109 COUT(3) << "Notification \"" << this->getMessage() << "\" sent." << std::endl; 110 110 111 111 return true; 112 112 } 113 113 114 114 /** 115 115 @brief -
code/branches/presentation2/src/modules/weapons/projectiles/LightningGunProjectile.cc
r5929 r6387 43 43 this->maxTextureIndex_ = 8; 44 44 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); 45 45 46 46 registerVariables(); 47 47 } 48 48 49 49 void LightningGunProjectile::registerVariables() 50 50 { 51 51 registerVariable(this->materialBase_); 52 52 } 53 53 54 54 void LightningGunProjectile::setMaterial(const std::string& material) 55 55 { 56 56 this->materialBase_ = material; 57 57 58 58 BillboardProjectile::setMaterial(material + multi_cast<std::string>(this->textureIndex_)); 59 59 } … … 64 64 if (this->textureIndex_ > this->maxTextureIndex_) 65 65 this->textureIndex_ = 1; 66 66 67 67 this->setMaterial(this->materialBase_); 68 68 } -
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
r6383 r6387 58 58 this->bDestroy_ = false; 59 59 this->lifetime_ = 100; 60 60 61 61 if (GameMode::isMaster()) 62 62 { 63 63 this->setCollisionType(WorldEntity::Kinematic); 64 64 this->setVelocity(0,0,-100); 65 65 66 66 Model* model = new Model(this); 67 67 model->setMeshSource("rocket.mesh"); … … 72 72 fire->setOrientation(this->getOrientation()); 73 73 fire->setSource("Orxonox/rocketfire"); 74 74 75 75 this->enableCollisionCallback(); 76 76 this->setCollisionResponse(false); … … 83 83 84 84 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this))); 85 85 86 86 this->defSndWpnEngine_ = new WorldSound(this); 87 87 this->defSndWpnEngine_->setLooping(true); … … 99 99 this->defSndWpnLaunch_ = 0; 100 100 } 101 101 102 102 CameraPosition* camPosition = new CameraPosition(this); 103 103 camPosition->setPosition(0,4,15); … … 134 134 SUPER(Rocket, XMLPort, xmlelement, mode); 135 135 } 136 136 137 137 void Rocket::setOwner(Pawn* owner) 138 138 { … … 158 158 { 159 159 SUPER(Rocket, tick, dt); 160 160 161 161 if( this->hasLocalController() ) 162 162 { … … 164 164 this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() ); 165 165 this->localAngularVelocity_ = 0; 166 166 167 167 if( this->bDestroy_ ) 168 168 this->destroy(); 169 169 } 170 170 } 171 171 172 172 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 173 173 { … … 176 176 if (otherObject == this->owner_) 177 177 return false; 178 178 179 179 this->bDestroy_ = true; 180 180 … … 211 211 return false; 212 212 } 213 213 214 214 void Rocket::destroyObject() 215 215 { … … 223 223 } 224 224 } 225 225 226 226 void Rocket::fired(unsigned int firemode) 227 227 { … … 258 258 { 259 259 ControllableEntity::rotateYaw(value); 260 260 261 261 if( !this->isInMouseLook() ) 262 262 this->localAngularVelocity_.y += value.x; … … 272 272 { 273 273 ControllableEntity::rotatePitch(value); 274 274 275 275 if( !this->isInMouseLook() ) 276 276 this->localAngularVelocity_.x += value.x; … … 286 286 { 287 287 ControllableEntity::rotateRoll(value); 288 288 289 289 if( !this->isInMouseLook() ) 290 290 this->localAngularVelocity_.z += value.x; 291 291 } 292 292 293 293 } -
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.h
r6378 r6387 54 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Rocket through XML. 55 55 virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick. 56 56 57 57 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); 58 58 void destroyObject(); 59 59 60 60 virtual void moveFrontBack(const Vector2& value){} 61 61 virtual void moveRightLeft(const Vector2& value){} … … 65 65 virtual void rotatePitch(const Vector2& value); 66 66 virtual void rotateRoll(const Vector2& value); 67 67 68 68 /** 69 69 @brief Moves the Rocket in the Front/Back-direction by the specifed amount. … … 84 84 inline void moveUpDown(float value) 85 85 { this->moveUpDown(Vector2(value, 0)); } 86 86 87 87 /** 88 88 @brief Rotates the Rocket around the y-axis by the specifed amount. … … 103 103 inline void rotateRoll(float value) 104 104 { this->rotateRoll(Vector2(value, 0)); } 105 105 106 106 void setOwner(Pawn* owner); 107 107 inline Pawn* getOwner() const 108 108 { return this->owner_; } 109 109 110 110 inline void setDamage(float damage) 111 111 { this->damage_ = damage; } … … 113 113 { return this->damage_; } 114 114 virtual void fired(unsigned int firemode); 115 115 116 116 private: 117 117 WeakPtr<Pawn> owner_; … … 120 120 bool bDestroy_; 121 121 ControllableEntity* originalControllableEntity_; 122 122 123 123 WeakPtr<PlayerInfo> player_; 124 124 Timer destroyTimer_; -
code/branches/presentation2/src/orxonox/MoodManager.cc
r6370 r6387 64 64 ModifyConfigValue(mood_, set, mood); 65 65 } 66 66 67 67 //! Gets the current mood 68 68 const std::string& MoodManager::getMood() -
code/branches/presentation2/src/orxonox/PlayerManager.cc
r6182 r6387 90 90 } 91 91 } 92 92 93 93 void PlayerManager::disconnectAllClients() 94 94 { -
code/branches/presentation2/src/orxonox/Scene.h
r6372 r6387 78 78 inline Radar* getRadar() 79 79 { return this->radar_; } 80 80 81 81 inline virtual uint32_t getSceneID() const { return this->getObjectID(); } 82 82 -
code/branches/presentation2/src/orxonox/Test.h
r6123 r6387 75 75 void checkS3(); 76 76 void checkS4(); 77 77 78 78 void printPointer(); 79 79 … … 95 95 TYPE s3; 96 96 TYPE s4; 97 97 98 98 Test* pointer_; 99 99 -
code/branches/presentation2/src/orxonox/controllers/ArtificialController.cc
r6164 r6387 46 46 this->bHasTargetPosition_ = false; 47 47 this->targetPosition_ = Vector3::ZERO; 48 48 49 49 this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this)); 50 50 } … … 143 143 this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity()); 144 144 this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO); 145 145 146 146 Pawn* pawn = dynamic_cast<Pawn*>(this->getControllableEntity()); 147 147 if (pawn) -
code/branches/presentation2/src/orxonox/controllers/ArtificialController.h
r5929 r6387 42 42 ArtificialController(BaseObject* creator); 43 43 virtual ~ArtificialController(); 44 44 45 45 void abandonTarget(Pawn* target); 46 46 -
code/branches/presentation2/src/orxonox/controllers/Controller.h
r6356 r6387 51 51 52 52 virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {}; 53 53 54 54 void setGodMode( bool mode ){ this->bGodMode_ = mode; } 55 55 bool getGodMode(){ return this->bGodMode_; } -
code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
r6377 r6387 140 140 arrowsOverlay1_->setPosition(Vector2(0.5, 0.5)); 141 141 arrowsOverlay1_->hide(); 142 142 143 143 arrowsOverlay2_ = new OrxonoxOverlay(this); 144 144 arrowsOverlay2_->setBackgroundMaterial("Orxonox/DirectionArrows2"); … … 147 147 arrowsOverlay2_->setPosition(Vector2(0.5, 0.5)); 148 148 arrowsOverlay2_->hide(); 149 149 150 150 arrowsOverlay3_ = new OrxonoxOverlay(this); 151 151 arrowsOverlay3_->setBackgroundMaterial("Orxonox/DirectionArrows3"); … … 154 154 arrowsOverlay3_->setPosition(Vector2(0.5, 0.5)); 155 155 arrowsOverlay3_->hide(); 156 156 157 157 arrowsOverlay4_ = new OrxonoxOverlay(this); 158 158 arrowsOverlay4_->setBackgroundMaterial("Orxonox/DirectionArrows4"); … … 502 502 { 503 503 hideArrows(); 504 504 505 505 float distance = sqrt(pow(static_cast<float>(this->currentYaw_)/2*-1,2) + pow(static_cast<float>(this->currentPitch_)/2*-1,2)); 506 506 507 507 if (distance > 0.04 && distance <= 0.59 * arrowsSize_ / 2.0 ) 508 508 { -
code/branches/presentation2/src/orxonox/gamestates/GSGraphics.cc
r6150 r6387 64 64 void GSGraphics::activate() 65 65 { 66 66 67 67 } 68 68 -
code/branches/presentation2/src/orxonox/gamestates/GSLevel.cc
r6150 r6387 90 90 // level is loaded: we can start capturing the input 91 91 InputManager::getInstance().enterState("game"); 92 92 93 93 // connect the HumanPlayer to the game 94 94 PlayerManager::getInstance().clientConnected(0); … … 105 105 InputManager::getInstance().leaveState("game"); 106 106 } 107 107 108 108 // disconnect all HumanPlayers 109 109 PlayerManager::getInstance().disconnectAllClients(); … … 135 135 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it) 136 136 this->staticObjects_.insert(*it); 137 137 138 138 // call the loader 139 139 COUT(0) << "Loading level..." << std::endl; -
code/branches/presentation2/src/orxonox/gamestates/GSMainMenu.cc
r6378 r6387 96 96 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startDedicated), "startDedicated")); 97 97 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu")); 98 98 99 99 // create command to change sound path 100 100 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath")); -
code/branches/presentation2/src/orxonox/gamestates/GSRoot.cc
r6378 r6387 55 55 NetworkFunctionBase::destroyAllNetworkFunctions(); 56 56 } 57 57 58 58 void GSRoot::printObjects() 59 59 { -
code/branches/presentation2/src/orxonox/gametypes/Gametype.cc
r5929 r6387 51 51 { 52 52 RegisterObject(Gametype); 53 53 54 54 this->gtinfo_ = new GametypeInfo(creator); 55 55 … … 79 79 else 80 80 this->scoreboard_ = 0; 81 81 82 82 /* HACK HACK HACK */ 83 83 this->hackAddBots_ = createConsoleCommand( createFunctor(&Gametype::addBots, this), "hackAddBots"); … … 87 87 /* HACK HACK HACK */ 88 88 } 89 89 90 90 Gametype::~Gametype() 91 91 { -
code/branches/presentation2/src/orxonox/gametypes/Gametype.h
r5929 r6387 184 184 // Config Values 185 185 std::string scoreboardTemplate_; 186 186 187 187 /* HACK HACK HACK */ 188 188 ConsoleCommand* hackAddBots_; -
code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc
r6192 r6387 171 171 this->changedControllableEntity(); 172 172 } 173 173 174 174 void PlayerInfo::startTemporaryControl(ControllableEntity* entity) 175 175 { 176 176 if (!entity) 177 177 return; 178 178 179 179 // assert( this->temporaryControllableEntity_==0 ); 180 180 … … 195 195 if ( this->oldControllableEntity_ ) 196 196 this->stopTemporaryControl(); 197 197 198 198 ControllableEntity* entity = this->controllableEntity_; 199 199 … … 213 213 this->changedControllableEntity(); 214 214 } 215 215 216 216 void PlayerInfo::stopTemporaryControl() 217 217 { … … 231 231 if ( GameMode::isMaster() ) 232 232 entity->removePlayer(); 233 234 this->changedControllableEntity(); 235 } 236 233 234 this->changedControllableEntity(); 235 } 236 237 237 void PlayerInfo::networkcallback_changedcontrollableentityID() 238 238 { -
code/branches/presentation2/src/orxonox/interfaces/Rewardable.h
r5781 r6387 43 43 @brief 44 44 Rewardable is an Interface, that can be implemented by any object to enable it to be given as reward to a player through QuestEffects. (With the AddReward effect.) 45 45 46 46 It just needs to inherit form Rewardable, and implement the reward() method. 47 47 @author -
code/branches/presentation2/src/orxonox/items/MultiStateEngine.h
r6329 r6387 64 64 void addEffectContainer(EffectContainer* effect); 65 65 EffectContainer* getEffectContainer(unsigned int index) const; 66 66 67 67 void setDefEngSndNormal(const std::string& engineSound); 68 68 const std::string& getDefEngSndNormal(); -
code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.cc
r6310 r6387 171 171 { 172 172 SUPER( OrxonoxOverlay, changedVisibility ); 173 173 174 174 if (!this->overlay_) 175 175 return; -
code/branches/presentation2/src/orxonox/overlays/OverlayGroup.cc
r6054 r6387 144 144 { 145 145 SUPER( OverlayGroup, changedVisibility ); 146 146 147 147 for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it) 148 148 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed -
code/branches/presentation2/src/orxonox/pickup/ModifierPickup.h
r5929 r6387 129 129 130 130 void timerCallback(Pawn* pawn); //!< Method called when the timer runs out. 131 131 132 132 private: 133 133 float getAdditiveModifier(ModifierType::Value type) const; //!< Get the additive modifier for a given ModifierType. -
code/branches/presentation2/src/orxonox/pickup/UsableItem.cc
r5781 r6387 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file -
code/branches/presentation2/src/orxonox/sound/AmbientSound.cc
r6382 r6387 61 61 } 62 62 } 63 63 64 64 void AmbientSound::registerVariables() 65 65 { … … 101 101 SoundManager::getInstance().pauseAmbientSound(this); 102 102 } 103 103 104 104 float AmbientSound::getRealVolume() 105 105 { -
code/branches/presentation2/src/orxonox/sound/BaseSound.cc
r6383 r6387 150 150 this->updateVolume(); 151 151 } 152 152 153 153 void BaseSound::updateVolume() 154 154 { … … 252 252 } 253 253 } 254 254 255 255 void BaseSound::stateChanged() 256 256 { -
code/branches/presentation2/src/orxonox/sound/SoundManager.cc
r6383 r6387 134 134 else 135 135 COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl; 136 136 137 137 this->mute_[SoundType::All] = 1.0f; 138 138 this->mute_[SoundType::Music] = 1.0f; … … 431 431 void SoundManager::processCrossFading(float dt) 432 432 { 433 433 434 434 // Hacky solution to the fade delay while loading a level. 435 435 if(dt > 0.2) … … 437 437 return; 438 438 } 439 439 440 440 // FADE IN 441 441 for (std::list<SmartPtr<AmbientSound> >::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); ) -
code/branches/presentation2/src/orxonox/sound/SoundManager.h
r6383 r6387 75 75 void preUpdate(const Clock& time); 76 76 void setConfigValues(); 77 77 78 78 // tolua_begin 79 79 static SoundManager& getInstance() { return Singleton<SoundManager>::getInstance(); } -
code/branches/presentation2/src/orxonox/sound/WorldSound.cc
r6382 r6387 51 51 this->registerVariables(); 52 52 } 53 53 54 54 void WorldSound::registerVariables() 55 55 { -
code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc
r6381 r6387 67 67 68 68 this->damage_ = 0; 69 69 70 70 this->muzzleOffset_ = Vector3::ZERO; 71 71 this->muzzlePosition_ = Vector3::ZERO; … … 141 141 this->defSndWpnFire_->play(); 142 142 } 143 143 144 144 this->fire(); 145 145 -
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc
r6325 r6387 238 238 this->cameraPositionRootNode_->roll(Radian(value.y * this->mouseLookSpeed_), Ogre::Node::TS_LOCAL); 239 239 } 240 240 241 241 void ControllableEntity::fire(unsigned int firemode) 242 242 { … … 250 250 } 251 251 } 252 252 253 253 void ControllableEntity::setTarget( WorldEntity* target ) 254 254 { … … 266 266 } 267 267 } 268 268 269 269 void ControllableEntity::setTargetInternal( uint32_t targetID ) 270 270 { -
code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h
r6325 r6387 145 145 inline void setController(Controller* val) 146 146 { this->controller_ = val; } 147 147 148 148 virtual void setTarget( WorldEntity* target ); 149 149 virtual WorldEntity* getTarget() -
code/branches/presentation2/src/orxonox/worldentities/StaticEntity.cc
r5781 r6387 42 42 { 43 43 RegisterObject(StaticEntity); 44 44 45 45 this->setPriority(Priority::VeryLow); 46 46 -
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.cc
r6356 r6387 68 68 69 69 this->spawnparticleduration_ = 3.0f; 70 70 71 71 this->aimPosition_ = Vector3::ZERO; 72 72 -
code/branches/presentation2/src/orxonox/worldentities/pawns/Pawn.h
r6295 r6387 116 116 117 117 virtual void startLocalHumanControl(); 118 118 119 119 void setAimPosition( Vector3 position ) 120 120 { this->aimPosition_ = position; } … … 153 153 inline void setWeaponSystem(WeaponSystem* weaponsystem) 154 154 { this->weaponSystem_ = weaponsystem; } 155 155 156 156 Vector3 aimPosition_; 157 157 };
Note: See TracChangeset
for help on using the changeset viewer.