- Timestamp:
- Jun 8, 2006, 11:19:08 AM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/event/event_handler.cc
r8148 r8228 353 353 else 354 354 { 355 //SDL_WM_GrabInput(SDL_GRAB_ON);355 SDL_WM_GrabInput(SDL_GRAB_ON); 356 356 SDL_ShowCursor(SDL_DISABLE); 357 357 } -
trunk/src/lib/network/message_manager.cc
r8068 r8228 17 17 18 18 #include "message_manager.h" 19 20 #include "network_stream.h" 19 21 20 22 using namespace std; … … 312 314 recieverType == RT_ALL_NOT_ME || 313 315 recieverType == RT_USER && it->first == reciever || 314 recieverType == RT_NOT_USER && it->first != reciever 316 recieverType == RT_NOT_USER && it->first != reciever || 317 recieverType == RT_SERVER && getNetworkStream()->isUserServer( it->first ) 315 318 ) 316 319 { -
trunk/src/lib/network/message_manager.h
r8147 r8228 30 30 TESTMESSAGEID = 1, 31 31 MSGID_DELETESYNCHRONIZEABLE, 32 MSGID_PREFEREDTEAM 32 MSGID_PREFEREDTEAM, 33 MSGID_CHANGEPLAYERNAME 33 34 }; 34 35 … … 40 41 RT_ALL_ME, //!< message is sent to all users 41 42 RT_USER, //!< message is only sent to reciever 42 RT_NOT_USER //!< message is sent to all but reciever 43 RT_NOT_USER, //!< message is sent to all but reciever 44 RT_SERVER //!< message is sent to server only 43 45 }; 44 46 -
trunk/src/lib/network/network_game_manager.cc
r8147 r8228 112 112 stats->setPlayableUniqueId( playable.getUniqueID() ); 113 113 stats->setModelFileName( playableModel ); 114 115 return true; 114 116 } 115 117 … … 122 124 bool NetworkGameManager::signalLeftPlayer(int userID) 123 125 { 124 delete PlayerStats::getStats( userID )->getPlayable(); 125 delete PlayerStats::getStats( userID ); 126 if ( PlayerStats::getStats( userID ) ) 127 { 128 if ( PlayerStats::getStats( userID )->getPlayable() ) 129 delete PlayerStats::getStats( userID )->getPlayable(); 130 delete PlayerStats::getStats( userID ); 131 } 132 133 return true; 126 134 } 127 135 … … 165 173 return true; 166 174 } 167 175 168 176 delete dynamic_cast<Synchronizeable*>(*it); 169 177 return true; 170 178 } 171 179 } 180 181 return true; 172 182 } 173 183 … … 210 220 211 221 NetworkGameManager::getInstance()->setPreferedTeam( userId, teamId ); 222 223 return true; 212 224 } 213 225 … … 220 232 221 233 stats.setPreferedTeamId( teamId ); 222 223 234 } 224 235 -
trunk/src/lib/network/network_manager.cc
r8147 r8228 51 51 52 52 /* initialize the references */ 53 this->netStreamList = NULL; 54 this->syncList = NULL; 55 this->defaultSyncStream = NULL; 53 this->networkStream = NULL; 56 54 this->sharedNetworkData = SharedNetworkData::getInstance(); 57 55 this->elapsedTime = 0.0f; … … 71 69 */ 72 70 NetworkManager::~NetworkManager() 73 {} 71 { 72 if ( this->networkStream ) 73 { 74 delete this->networkStream; 75 this->networkStream = NULL; 76 } 77 } 74 78 75 79 … … 79 83 void NetworkManager::initialize() 80 84 { 81 /* get the synchronizeable list from the class list */82 this->netStreamList = ClassList::getList(CL_SYNCHRONIZEABLE);83 85 PRINTF(0)("NetworkManager initzalized\n"); 84 85 86 } 86 87 … … 101 102 int NetworkManager::establishConnection(const std::string & name, unsigned int port) 102 103 { 103 this-> defaultSyncStream = new NetworkStream( name, port );104 this->sharedNetworkData->setDefaultSyncStream(this-> defaultSyncStream);105 this-> defaultSyncStream->startHandshake();104 this->networkStream = new NetworkStream( name, port ); 105 this->sharedNetworkData->setDefaultSyncStream(this->networkStream); 106 this->networkStream->startHandshake(); 106 107 return 1; 107 108 } … … 116 117 this->sharedNetworkData->setHostID(0); 117 118 this->sharedNetworkData->setGameServer(true); 118 this-> defaultSyncStream = new NetworkStream(port);119 this->sharedNetworkData->setDefaultSyncStream(this-> defaultSyncStream);120 this-> defaultSyncStream->createNetworkGameManager();119 this->networkStream = new NetworkStream(port); 120 this->sharedNetworkData->setDefaultSyncStream(this->networkStream); 121 this->networkStream->createNetworkGameManager(); 121 122 PRINTF(0)("CREATE SERVER\n"); 122 123 SDL_Delay(20); … … 127 128 void NetworkManager::connectSynchronizeable(Synchronizeable& sync) 128 129 { 129 if( this-> defaultSyncStream)130 this-> defaultSyncStream->connectSynchronizeable(sync);130 if( this->networkStream) 131 this->networkStream->connectSynchronizeable(sync); 131 132 } 132 133 … … 143 144 this->elapsedTime = 0.0f; 144 145 145 if (this->netStreamList != NULL || (this->netStreamList = ClassList::getList(CL_NETWORK_STREAM)) != NULL) 146 { 147 std::list<BaseObject*>::const_iterator stream; 148 for (stream = this->netStreamList->begin(); stream != this->netStreamList->end(); ++stream) 149 if( static_cast<NetworkStream*>(*stream)->isActive()) 150 static_cast<NetworkStream*>(*stream)->processData(); 151 } 146 if ( networkStream->isActive() ) 147 networkStream->processData(); 152 148 153 149 NetworkGameManager::getInstance()->tick( this->elapsedTime ); … … 162 158 { 163 159 PRINT(0)("=================Network::debug()=========\n"); 164 this-> defaultSyncStream->debug();160 this->networkStream->debug(); 165 161 PRINT(0)("===========================================\n"); 166 162 } -
trunk/src/lib/network/network_manager.h
r7954 r8228 55 55 56 56 private: 57 const std::list<BaseObject*>* netStreamList; // list with refs to all network streams58 const std::list<BaseObject*>* syncList; // list of synchronizeables59 57 static NetworkManager* singletonRef; //!< Pointer to the only instance of this Class 60 NetworkStream* defaultSyncStream; //!< FIXME: this is only for testing purposes58 NetworkStream* networkStream; //!< pointer to network stream 61 59 62 60 SharedNetworkData* sharedNetworkData; //!< reference to the shared data -
trunk/src/lib/network/network_stream.cc
r8068 r8228 105 105 serverSocket->close(); 106 106 delete serverSocket; 107 serverSocket = NULL; 107 108 } 108 109 … … 123 124 } 124 125 125 if ( serverSocket ) 126 { 127 delete serverSocket; 128 serverSocket = NULL; 129 } 130 126 for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ ) 127 (*it)->setNetworkStream( NULL ); 131 128 } 132 129 … … 264 261 265 262 //check if connections are ok else remove them 266 for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++)263 for ( PeerList::iterator it = peers.begin(); it != peers.end(); ) 267 264 { 268 265 if ( … … 297 294 298 295 freeSocketSlots.push_back( it->second.userId ); 299 300 } 296 297 PeerList::iterator delit = it; 298 it++; 299 300 peers.erase( delit ); 301 302 continue; 303 } 304 305 it++; 301 306 } 302 307 … … 651 656 } 652 657 } 658 653 659 654 660 int n = sync->setStateDiff( peer->second.userId, buf+offset, syncDataLength, state, fromState ); … … 664 670 } 665 671 666 //TODO REMOVE THIS667 int saveOffset = offset;668 672 669 673 for ( SynchronizeableList::iterator it = synchronizeables.begin(); it != synchronizeables.end(); it++ ) … … 682 686 assert( peer->second.lastRecvedState < state ); 683 687 peer->second.lastRecvedState = state; 684 685 assert( saveOffset == offset ); 686 688 687 689 } 688 690 -
trunk/src/lib/network/player_stats.cc
r8147 r8228 21 21 #include "player.h" 22 22 #include "state.h" 23 #include "shared_network_data.h" 23 24 24 25 … … 85 86 this->setPlayableUniqueId( this->playableUniqueId ); 86 87 87 PRINTF(0)("uniqueID changed %d %d \n", userId, getHostID());88 PRINTF(0)("uniqueID changed %d %d %d\n", userId, getHostID(), getUniqueID()); 88 89 } 89 90 } … … 99 100 100 101 if ( !list ) 102 { 101 103 return NULL; 104 } 102 105 103 106 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) … … 108 111 } 109 112 } 110 111 //TODO maybe we should create an object here112 113 113 114 return NULL; … … 133 134 { 134 135 this->playable = dynamic_cast<Playable*>(*it); 136 //TODO when OM_PLAYERS is ticked add line: 137 //this->playable->toList( OM_PLAYERS ); 135 138 break; 136 139 } … … 138 141 139 142 if ( this->playable && userId == getHostID() ) 143 { 140 144 State::getPlayer()->setPlayable( this->playable ); 145 } 141 146 142 147 this->playableUniqueId = uniqueId; -
trunk/src/lib/network/synchronizeable.cc
r8147 r8228 369 369 void Synchronizeable::cleanUpUser( int userId ) 370 370 { 371 for ( UserStateHistory::iterator it = sentStates.begin(); it != sentStates.end(); it++ ) 372 { 373 for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ ) 374 { 375 if ( (*it2)->data ) 376 delete [] (*it2)->data; 377 (*it2)->data = NULL; 378 379 delete *it2; 380 } 381 } 382 383 sentStates.clear(); 384 385 for ( UserStateHistory::iterator it = recvStates.begin(); it != recvStates.end(); it++ ) 386 { 387 for ( StateHistory::iterator it2 = it->begin(); it2 != it->end(); it2++ ) 388 { 389 if ( (*it2)->data ) 390 delete [] (*it2)->data; 391 (*it2)->data = NULL; 392 393 delete *it2; 394 } 395 } 396 397 recvStates.clear(); 371 if ( recvStates.size() > userId ) 372 { 373 for ( std::list<StateHistoryEntry*>::iterator it = recvStates[userId].begin(); it != recvStates[userId].end(); it++ ) 374 { 375 if ( (*it)->data ) 376 delete [] (*it)->data; 377 (*it)->data = NULL; 378 379 delete *it; 380 } 381 recvStates[userId].clear(); 382 } 383 384 if ( sentStates.size() > userId ) 385 { 386 387 for ( std::list<StateHistoryEntry*>::iterator it = sentStates[userId].begin(); it != sentStates[userId].end(); it++ ) 388 { 389 if ( (*it)->data ) 390 delete [] (*it)->data; 391 (*it)->data = NULL; 392 393 delete *it; 394 } 395 sentStates[userId].clear(); 396 } 398 397 } 399 398 -
trunk/src/lib/network/udp_server_socket.cc
r7954 r8228 44 44 UdpServerSocket::~UdpServerSocket( ) 45 45 { 46 for ( int i = 0; i < packetBuffer.size(); i++ )46 for ( int i = 0; i < (int)packetBuffer.size(); i++ ) 47 47 removeUserPackets( i ); 48 48 … … 99 99 { 100 100 101 for ( int i = 0; i < packetBuffer.size(); i++ )101 for ( int i = 0; i < (int)packetBuffer.size(); i++ ) 102 102 removeUserPackets( i ); 103 103 … … 115 115 void UdpServerSocket::removeUserPackets( int userId ) 116 116 { 117 if ( userId >= packetBuffer.size() )117 if ( userId >= (int)packetBuffer.size() ) 118 118 return; 119 119 … … 141 141 res.length = 0; 142 142 143 if ( packetBuffer.size() > userId &&packetBuffer[userId].size() > 0 )143 if ( (int)packetBuffer.size() > userId && (int)packetBuffer[userId].size() > 0 ) 144 144 { 145 145 res.data = packetBuffer[userId].front().data; 146 146 res.length = packetBuffer[userId].front().length; 147 147 packetBuffer[userId].pop_front(); 148 149 if ( res.length == 0 ) 150 res.length = -1; 148 151 } 149 152 … … 158 161 int UdpServerSocket::getPacketCount( int userId ) 159 162 { 160 if ( userId >= packetBuffer.size() )163 if ( userId >= (int)packetBuffer.size() ) 161 164 return -1; 162 165 … … 179 182 } 180 183 181 if ( userId < packetBuffer.size() )184 if ( userId < (int)packetBuffer.size() ) 182 185 removeUserPackets( userId ); 183 186 184 if ( packetBuffer.size() <= userId )187 if ( (int)packetBuffer.size() <= userId ) 185 188 packetBuffer.resize( userId + 1 ); 186 189 187 if ( userList.size() <= userId )190 if ( (int)userList.size() <= userId ) 188 191 userList.resize( userId + 1 ); 189 192 … … 199 202 removeUserPackets( userId ); 200 203 201 if ( userId >= userList.size() )204 if ( userId >= (int)userList.size() ) 202 205 return; 203 206 … … 244 247 bool isNewConnection = false; 245 248 246 for ( userId =0; userId < userList.size(); userId++ )249 for ( userId =0; userId < (int)userList.size(); userId++ ) 247 250 if ( userList[userId].host == packet->address.host && userList[userId].port == packet->address.port ) 248 251 break; 249 252 250 if ( userId >= userList.size() )253 if ( userId >= (int)userList.size() ) 251 254 { 252 255 … … 260 263 } 261 264 262 for ( userId =0; userId < userList.size(); userId++ )265 for ( userId =0; userId < (int)userList.size(); userId++ ) 263 266 if ( userList[userId].host == 0 && userList[userId].port == 0 ) 264 267 break; … … 281 284 else 282 285 { 283 if ( isNewConnection )284 continue;285 286 286 networkPacket.data = NULL; 287 287 } -
trunk/src/lib/network/udp_socket.cc
r7954 r8228 81 81 UdpSocket::~UdpSocket( ) 82 82 { 83 this->disconnectServer(); 84 83 85 if ( serverSocket ) 84 86 serverSocket->removeUser( userId ); 85 86 disconnectServer(); 87 87 88 88 if ( this->packet ) 89 89 SDLNet_FreePacket( this->packet ); … … 128 128 return; 129 129 } 130 130 } 131 132 /** 133 * disconnect from server 134 */ 135 void UdpSocket::disconnectServer( ) 136 { 137 PRINTF(0)("disconnect\n"); 131 138 writePacket( NULL, 0 ); 132 }133 134 /**135 * disconnect from server136 */137 void UdpSocket::disconnectServer( )138 {139 139 SDLNet_UDP_Unbind( socket, -1 ); 140 140 SDLNet_UDP_Close( socket ); … … 171 171 packet->len = length; 172 172 173 if ( SDLNet_UDP_Send( socket, 1, packet) == 0 )173 if ( socket && SDLNet_UDP_Send( socket, 1, packet) == 0 ) 174 174 { 175 175 PRINTF(1)("SDLNet_UDP_Send: %s\n", SDLNet_GetError()); … … 196 196 NetworkPacket networkPacket = serverSocket->getPacket( this->userId ); 197 197 198 if ( networkPacket.length == -1 ) 199 { 200 this->disconnectServer(); 201 return 0; 202 } 203 198 204 if ( networkPacket.length > 0 ) 199 205 { … … 218 224 assert( packet->len <= maxLength ); 219 225 226 if ( packet->len == 0 ) 227 { 228 this->disconnectServer(); 229 return 0; 230 } 231 220 232 memcpy( data, packet->data, packet->len ); 221 233 return packet->len; -
trunk/src/story_entities/multi_player_world.cc
r8068 r8228 26 26 27 27 #include "network_manager.h" 28 #include "network_game_manager.h" 28 29 29 30 … … 119 120 ((MultiPlayerWorldData*)this->dataTank)->debug(); 120 121 } 122 123 /** 124 * cleanup 125 * @return 126 */ 127 ErrorMessage MultiPlayerWorld::unloadData( ) 128 { 129 130 GameWorld::unloadData(); 131 132 delete NetworkManager::getInstance(); 133 delete NetworkGameManager::getInstance(); 134 135 } -
trunk/src/story_entities/multi_player_world.h
r8068 r8228 26 26 27 27 virtual void loadParams(const TiXmlElement* root); 28 29 virtual ErrorMessage unloadData(); 28 30 29 31 void debug(); -
trunk/src/util/signal_handler.cc
r8068 r8228 17 17 #include <assert.h> 18 18 19 SignalHandler * SignalHandler::singletonRef = NULL; 20 19 21 #ifndef __WIN32__ 20 21 SignalHandler * SignalHandler::singletonRef = NULL;22 22 23 23 SignalHandler::SignalHandler() … … 59 59 void SignalHandler::sigHandler( int sig ) 60 60 { 61 for ( SignalCallbackList::iterator it = SignalHandler::getInstance()->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++ ) 62 { 63 (*(it->cb))( it->someData ); 64 } 65 61 66 std::string sigName = "UNKNOWN"; 62 67 … … 113 118 } 114 119 120 void SignalHandler::registerCallback( SignalCallback cb, void * someData ) 121 { 122 SignalCallbackRec rec; 123 rec.cb = cb; 124 rec.someData = someData; 125 126 callbackList.push_back(rec); 127 } 128 115 129 #endif /* __WIN32__ */ -
trunk/src/util/signal_handler.h
r7440 r8228 17 17 }; 18 18 19 typedef bool (*SignalCallback)( void * someData ); 19 20 20 21 #ifndef __WIN32__ … … 27 28 }; 28 29 30 struct SignalCallbackRec 31 { 32 SignalCallback cb; 33 void * someData; 34 }; 35 29 36 30 37 typedef std::list<SignalRec> SignalRecList; 38 typedef std::list<SignalCallbackRec> SignalCallbackList; 31 39 32 40 class SignalHandler … … 35 43 SignalHandler(); 36 44 public: 37 inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); 38 return SignalHandler::singletonRef; } 45 inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; } 46 47 void registerCallback( SignalCallback cb, void * someData ); 39 48 40 49 void doCatch( std::string appName, GdbRunType type = GDB_RUN_WRITE_TO_FILE ); … … 46 55 void catchSignal( int sig ); 47 56 SignalRecList sigRecList; 57 58 SignalCallbackList callbackList; 48 59 49 60 static SignalHandler * singletonRef; … … 58 69 { 59 70 public: 60 inline static SignalHandler* getInstance() {};71 inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }; 61 72 void doCatch( std::string appName, GdbRunType type = GDB_RUN_WRITE_TO_FILE ) {}; 62 73 void dontCatch() {}; 74 void registerCallback( SignalCallback cb, void * someData ) {}; 63 75 }; 64 76 #endif -
trunk/src/world_entities/space_ships/space_ship.cc
r7954 r8228 305 305 } 306 306 } 307 //PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);307 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 308 308 } 309 309 -
trunk/src/world_entities/spectator.cc
r8147 r8228 24 24 25 25 26 /** 27 * constructor 28 */ 29 Spectator::Spectator( const TiXmlElement * root ) 30 { 26 using namespace std; 27 28 29 /** 30 * destructs the Spectator, deletes alocated memory 31 */ 32 Spectator::~Spectator () 33 { 34 this->setPlayer(NULL); 35 } 36 37 38 /** 39 * creates a new Spectator from Xml Data 40 * @param root the xml element containing Spectator data 41 42 @todo add more parameters to load 43 */ 44 Spectator::Spectator(const TiXmlElement* root) 45 { 46 this->init(); 47 if (root != NULL) 48 this->loadParams(root); 49 50 } 51 52 53 /** 54 * initializes a Spectator 55 */ 56 void Spectator::init() 57 { 58 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 31 59 this->setClassID(CL_SPECTATOR, "Spectator"); 32 33 bool bLeft; 34 bool bRight; 35 bool bForward; 36 bool bBackward; 37 38 float xMouse; //!< mouse moved in x-Direction 39 float yMouse; //!< mouse moved in y-Direction 60 61 this->getWeaponManager().changeWeaponConfig(1); 40 62 41 63 this->bLeft = false; … … 45 67 this->xMouse = 0.0f; 46 68 this->yMouse = 0.0f; 47 69 70 this->setHealthMax(100); 71 this->setHealth(80); 72 73 this->mouseDir = this->getAbsDir(); 74 75 //add events to the eventlist 48 76 registerEvent(KeyMapper::PEV_FORWARD); 49 77 registerEvent(KeyMapper::PEV_BACKWARD); … … 52 80 registerEvent(KeyMapper::PEV_FIRE1); 53 81 registerEvent(EV_MOUSE_MOTION); 54 82 83 this->getWeaponManager().setSlotCount(0); 84 85 this->getWeaponManager().getFixedTarget()->setParent(this); 86 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); 87 88 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 89 90 55 91 registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) ); 56 92 registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) ); … … 60 96 } 61 97 62 /** 63 * destructor 64 */ 65 Spectator::~Spectator( ) 66 { 67 this->setPlayer(NULL); 68 } 69 70 void Spectator::setPlayDirection( const Quaternion & rot, float speed ) 71 { 72 this->mouseDir = rot; 73 this->angleY = rot.getHeading(); 74 this->angleX = rot.getAttitude(); 75 } 76 77 void Spectator::enter( ) 78 { 98 99 /** 100 * loads the Settings of a Spectator from an XML-element. 101 * @param root the XML-element to load the Spaceship's properties from 102 */ 103 void Spectator::loadParams(const TiXmlElement* root) 104 { 105 Playable::loadParams(root); 106 } 107 108 void Spectator::setPlayDirection(const Quaternion& quat, float speed) 109 { 110 this->mouseDir = quat; 111 this->angleY = quat.getHeading(); 112 this->angleX = quat.getAttitude(); 113 } 114 115 116 void Spectator::reset() 117 { 118 this->bLeft = false; 119 this->bRight = false; 120 this->bForward = false; 121 this->bBackward = false; 122 this->xMouse = 0.0f; 123 this->yMouse = 0.0f; 124 125 this->setHealth(80); 126 } 127 128 129 void Spectator::enter() 130 { 131 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false ); 79 132 this->attachCamera(); 80 133 } 81 134 82 void Spectator::leave( ) 83 { 135 void Spectator::leave() 136 { 137 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 84 138 this->detachCamera(); 85 139 } 86 140 87 /** 88 * collision handling 89 * @param entity other entity 90 * @param location 91 * @todo dont allow spectator to go through walls 92 */ 93 void Spectator::collidesWith( WorldEntity * entity, const Vector & location ) 94 { 95 } 96 97 void Spectator::tick( float time ) 141 142 /** 143 * this function is called, when two entities collide 144 * @param entity: the world entity with whom it collides 145 * 146 * Implement behaviour like damage application or other miscellaneous collision stuff in this function 147 * @todo dont let Spectator fly through walls 148 */ 149 void Spectator::collidesWith(WorldEntity* entity, const Vector& location) 150 { 151 } 152 153 154 155 /** 156 * the function called for each passing timeSnap 157 * @param time The timespan passed since last update 158 */ 159 void Spectator::tick (float time) 98 160 { 99 161 Playable::tick( time ); … … 147 209 } 148 210 149 void Spectator::process( const Event & event ) 211 /** 212 * @todo switch statement ?? 213 */ 214 void Spectator::process(const Event &event) 150 215 { 151 216 Playable::process(event); … … 165 230 } 166 231 } 232 233 234 235 -
trunk/src/world_entities/spectator.h
r8147 r8228 11 11 class Spectator : public Playable 12 12 { 13 13 14 public: 14 Spectator( const TiXmlElement* root = NULL);15 Spectator(const TiXmlElement* root = NULL); 15 16 virtual ~Spectator(); 16 17 18 virtual void loadParams(const TiXmlElement* root); 19 17 20 virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); 18 21 19 22 virtual void enter(); 20 23 virtual void leave(); 21 24 25 virtual void reset(); 26 22 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 23 28 virtual void tick(float time); 24 29 25 30 virtual void process(const Event &event); 26 31 27 32 private: 33 void init(); 34 28 35 bool bLeft; 29 36 bool bRight; … … 35 42 Quaternion mouseDir; //!< the direction where the player wants to fly 36 43 37 //Quaternion rotY;38 //Quaternion rotAxis;39 44 float angleX; 40 45 float angleY; 46 41 47 }; 42 48
Note: See TracChangeset
for help on using the changeset viewer.