- Timestamp:
- Jul 3, 2006, 6:30:42 PM (18 years ago)
- Location:
- trunk/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/network/message_manager.cc
r8708 r9059 58 58 59 59 messageQueue.clear(); 60 61 this->messageHandlerMap.clear(); 62 63 MessageManager::singletonRef = NULL; 60 64 } 61 65 -
trunk/src/lib/network/network_game_manager.cc
r9008 r9059 77 77 78 78 PlayerStats::deleteAllPlayerStats(); 79 80 NetworkGameManager::singletonRef = NULL; 79 81 } 80 82 … … 274 276 if ( State::getPlayer()->getPlayable() != *it ) 275 277 { 276 PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() ); 277 std::list<Playable*>::iterator delit = it; 278 it++; 279 delete *delit; 280 playablesToDelete.erase( delit ); 281 continue; 278 const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE ); 279 280 if ( list && std::find( list->begin(), list->end(), *it ) != list->end() ) 281 { 282 PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() ); 283 std::list<Playable*>::iterator delit = it; 284 it++; 285 delete *delit; 286 playablesToDelete.erase( delit ); 287 continue; 288 } 282 289 } 283 290 it++; -
trunk/src/lib/network/network_manager.cc
r8708 r9059 52 52 /* initialize the references */ 53 53 this->networkStream = NULL; 54 this->sharedNetworkData = SharedNetworkData::getInstance();55 54 this->elapsedTime = 0.0f; 56 55 … … 70 69 NetworkManager::~NetworkManager() 71 70 { 71 PRINTF(0)("NetworkManager destructor\n"); 72 72 if ( this->networkStream ) 73 73 { … … 75 75 this->networkStream = NULL; 76 76 } 77 78 NetworkManager::singletonRef = NULL; 77 79 } 78 80 … … 103 105 { 104 106 this->networkStream = new NetworkStream( name, port ); 105 this->sharedNetworkData->setDefaultSyncStream(this->networkStream);107 SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream); 106 108 this->networkStream->startHandshake(); 107 109 return 1; … … 115 117 int NetworkManager::createServer(unsigned int port) 116 118 { 117 this->sharedNetworkData->setHostID(0);118 this->sharedNetworkData->setGameServer(true);119 SharedNetworkData::getInstance()->setHostID(0); 120 SharedNetworkData::getInstance()->setGameServer(true); 119 121 this->networkStream = new NetworkStream(port); 120 this->sharedNetworkData->setDefaultSyncStream(this->networkStream);122 SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream); 121 123 this->networkStream->createNetworkGameManager(); 122 124 PRINTF(0)("CREATE SERVER\n"); … … 144 146 this->elapsedTime = 0.0f; 145 147 146 // if ( networkStream->isActive())148 if ( networkStream ) 147 149 networkStream->processData(); 148 150 -
trunk/src/lib/network/network_manager.h
r8228 r9059 40 40 41 41 /** Returns the hostID @return The hostID of the object */ 42 inline int getHostID() { return this->sharedNetworkData->getHostID(); }43 inline bool isGameServer() { return this->sharedNetworkData->isGameServer(); }42 inline int getHostID() { return SharedNetworkData::getInstance()->getHostID(); } 43 inline bool isGameServer() { return SharedNetworkData::getInstance()->isGameServer(); } 44 44 45 45 … … 58 58 NetworkStream* networkStream; //!< pointer to network stream 59 59 60 SharedNetworkData* sharedNetworkData; //!< reference to the shared data61 60 float elapsedTime; //!< elapsed time since the last network update 62 61 }; -
trunk/src/lib/network/network_stream.cc
r8623 r9059 111 111 serverSocket = NULL; 112 112 } 113 114 113 for ( PeerList::iterator i = peers.begin(); i!=peers.end(); i++) 115 114 { … … 133 132 } 134 133 } 135 136 134 for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ ) 137 135 (*it)->setNetworkStream( NULL ); -
trunk/src/story_entities/menu/game_menu.cc
r9015 r9059 36 36 #include "glgui.h" 37 37 #include "menu/glgui_imagebutton.h" 38 39 #include "glgui_text.h" 40 41 #include "network_manager.h" 38 42 39 43 //! This creates a Factory to fabricate a GameMenu … … 122 126 this->levelsBox = NULL; 123 127 this->networkBox = NULL; 128 129 this->clientNetworkBox = NULL; 130 this->serverNetworkBox = NULL; 124 131 125 132 this->optionsBox = NULL; … … 233 240 OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client"); 234 241 networkBox->pack(clientButton); 242 clientButton->connect(SIGNAL(clientButton, released), this, SLOT(GameMenu, showClientMenu)); 235 243 236 244 OrxGui::GLGuiButton* serverButton = new OrxGui::GLGuiPushButton("Server"); 237 245 networkBox->pack(serverButton); 246 serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu)); 238 247 239 248 … … 495 504 } 496 505 497 498 506 /** 507 * show controls to join network game 508 */ 509 void GameMenu::showClientMenu( ) 510 { 511 if ( this->serverNetworkBox ) 512 { 513 delete this->serverNetworkBox; 514 this->serverNetworkBox = NULL; 515 } 516 517 if ( !this->clientNetworkBox ) 518 { 519 this->clientNetworkBox = new OrxGui::GLGuiBox(); 520 { 521 OrxGui::GLGuiText * text = new OrxGui::GLGuiText(); 522 text->setText( "Host:" ); 523 this->clientNetworkBox->pack( text ); 524 525 this->ipInputLine = new OrxGui::GLGuiInputLine( ); 526 this->ipInputLine->setText( "tardis-d08" ); 527 this->clientNetworkBox->pack( this->ipInputLine ); 528 this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer)); 529 this->ipInputLine->select(); 530 531 OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect"); 532 clientNetworkBox->pack(connectButton); 533 connectButton->connect(SIGNAL(connectButton, released), this, SLOT(GameMenu, connectToServer)); 534 } 535 } 536 537 this->clientNetworkBox->showAll(); 538 539 this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 540 } 541 542 /** 543 * show controls to create new network game 544 */ 545 void GameMenu::showServerMenu( ) 546 { 547 if ( this->clientNetworkBox ) 548 { 549 delete this->clientNetworkBox; 550 this->clientNetworkBox = NULL; 551 } 552 553 if ( !this->serverNetworkBox ) 554 { 555 this->serverNetworkBox = new OrxGui::GLGuiBox(); 556 { 557 OrxGui::GLGuiText * text = new OrxGui::GLGuiText(); 558 text->setText( "Map:" ); 559 this->serverNetworkBox->pack( text ); 560 561 OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText(); 562 text2->setText( "Multiplayer TeamDeathMatch Arena" ); 563 this->serverNetworkBox->pack( text2 ); 564 565 OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server"); 566 serverNetworkBox->pack(createButton); 567 createButton->connect(SIGNAL(createButton, released), this, SLOT(GameMenu, createServer)); 568 } 569 } 570 571 this->serverNetworkBox->showAll(); 572 573 this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 574 } 575 576 /** 577 * connect to host 578 */ 579 void GameMenu::connectToServer( ) 580 { 581 PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() ); 582 583 State::setOnline(true); 584 NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 ); 585 586 this->startLevel( 5 ); 587 } 588 589 void GameMenu::createServer( ) 590 { 591 PRINTF(0)("Create server\n" ); 592 593 State::setOnline(true); 594 NetworkManager::getInstance()->createServer( 9999 ); 595 596 this->startLevel( 5 ); 597 } 598 599 600 -
trunk/src/story_entities/menu/game_menu.h
r8717 r9059 45 45 void showMultiPlayer(); 46 46 void showOptionsMenu(); 47 48 void showClientMenu(); 49 void connectToServer(); 50 51 void showServerMenu(); 52 void createServer(); 47 53 48 54 … … 63 69 void setSelectorSound(const std::string& selectorSound); 64 70 71 72 65 73 66 74 private: … … 68 76 OrxGui::GLGuiBox* levelsBox; 69 77 OrxGui::GLGuiBox* networkBox; 78 79 OrxGui::GLGuiBox* clientNetworkBox; 80 OrxGui::GLGuiInputLine* ipInputLine; 81 82 OrxGui::GLGuiBox* serverNetworkBox; 70 83 71 84 OrxGui::GLGuiBox* optionsBox; -
trunk/src/story_entities/multi_player_world.cc
r9008 r9059 27 27 #include "network_manager.h" 28 28 #include "network_game_manager.h" 29 30 #include "state.h" 29 31 30 32 … … 150 152 delete NetworkGameManager::getInstance(); 151 153 154 State::setOnline( false ); 155 152 156 return ErrorMessage(); 153 157 } -
trunk/src/util/multiplayer_team_deathmatch.cc
r9008 r9059 83 83 subscribeEvent( ES_GAME, SDLK_TAB ); 84 84 subscribeEvent( ES_GAME, SDLK_F1 ); 85 subscribeEvent( ES_MENU, SDLK_F1 );86 85 subscribeEvent( ES_MENU, KeyMapper::PEV_FIRE1 ); 87 86 88 this->notifier = new OrxGui::GLGuiNotifier();89 this->notifier->show();90 this->notifier->setAbsCoor2D(5, 30);91 this->notifier->setFadeAge( 6.0 );92 this->notifier->setHideAge( 8.0 );93 87 this->input = new OrxGui::GLGuiInputLine(); 94 88 this->input->setAbsCoor2D(180, 5); … … 104 98 unsubscribeEvent( ES_GAME, SDLK_TAB ); 105 99 unsubscribeEvent( ES_GAME, SDLK_F1 ); 106 unsubscribeEvent( ES_MENU, SDLK_F1 );107 100 unsubscribeEvent( ES_MENU, KeyMapper::PEV_FIRE1 ); 108 109 if ( this->notifier )110 {111 delete this->notifier;112 this->notifier = NULL;113 }114 101 115 102 if ( this->input ) … … 308 295 309 296 if ( team == 0 || team == 1 ) 310 return CL_ SPACE_SHIP;297 return CL_FPS_PLAYER; 311 298 312 299 assert( false ); … … 316 303 { 317 304 if ( team == 0 ) 318 return "models/ ships/reap_#.obj";305 return "models/creatures/doom_guy.md2"; 319 306 else if ( team == 1 ) 320 return "models/ ships/fighter.obj";307 return "models/creatures/doom_guy.md2"; 321 308 else 322 309 return ""; … … 545 532 } else if ( event.type == SDLK_F1 ) 546 533 { 534 if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed ) 535 { 536 PRINTF(0)("hide stats\n"); 537 this->hideStats(); 538 } 547 539 if ( !this->statsBox && event.bPressed ) 548 540 { 549 541 PRINTF(0)("show stats\n"); 550 542 this->showStats(); 551 }552 if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed && this->table->rowCount() != 0 && this->table->columnCount() != 0 )553 {554 PRINTF(0)("hide stats\n");555 this->hideStats();556 543 } 557 544 } … … 597 584 598 585 PRINTF(0)("CHATMESSAGE %s (%d): %s\n", name.c_str(), userId, message.c_str() ); 599 notifier->pushNotifyMessage(name + ": " + message);586 State::getPlayer()->hud().notifyUser(name + ": " + message); 600 587 } 601 588 … … 624 611 void MultiplayerTeamDeathmatch::showStats( ) 625 612 { 626 EventHandler::getInstance()->pushState( ES_MENU );627 613 statsBox = new OrxGui::GLGuiBox(); 628 614 statsBox->setAbsCoor2D( 300, 100 ); 629 615 630 this->table = new OrxGui::GLGuiTable( 0,0);616 this->table = new OrxGui::GLGuiTable(5,5); 631 617 632 618 statsBox->pack( this->table ); … … 645 631 statsBox = NULL; 646 632 } 647 648 EventHandler::getInstance()->popState();649 633 } 650 634 -
trunk/src/util/multiplayer_team_deathmatch.h
r9008 r9059 83 83 OrxGui::GLGuiBox* box; 84 84 85 OrxGui::GLGuiNotifier* notifier;86 85 OrxGui::GLGuiInputLine* input; 87 86 -
trunk/src/world_entities/bsp_entity.cc
r9003 r9059 53 53 54 54 this->bspManager = NULL; 55 /** 56 * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) 57 */ 55 56 this->name_handle = registerVarId( new SynchronizeableString( &this->name, &this->name_write, "name" ) ); 57 58 this->setSynchronized( true ); 58 59 } 59 60 … … 62 63 { 63 64 PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str()); 65 66 this->name = name; 64 67 65 68 // Check wether file exists.... … … 130 133 void BspEntity::collidesWith (WorldEntity* entity, const Vector& location) 131 134 {} 135 136 void BspEntity::varChangeHandler( std::list< int > & id ) 137 { 138 if ( std::find( id.begin(), id.end(), this->name_handle ) != id.end() ) 139 { 140 this->setName( this->name_write ); 141 } 142 } -
trunk/src/world_entities/bsp_entity.h
r8490 r9059 28 28 29 29 void init(); 30 31 virtual void varChangeHandler( std::list<int> & id ); 30 32 31 33 virtual void draw() const; … … 38 40 private: 39 41 BspManager* bspManager; 42 43 std::string name; //!< store name 44 std::string name_write; //!< temp variable to store name 45 int name_handle; //!< handle for name 40 46 41 47 }; -
trunk/src/world_entities/player.h
r9019 r9059 31 31 bool eject(); 32 32 inline Playable* getPlayable() const { return this->playable; }; 33 33 34 34 35 inline Hud& hud() { return this->_hud; }; -
trunk/src/world_entities/world_entity.cc
r9008 r9059 738 738 this->decreaseHealth(damage); 739 739 740 PRINTF( 5)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax());740 PRINTF(0)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax()); 741 741 742 742 if( this->getHealth() > 0)
Note: See TracChangeset
for help on using the changeset viewer.