Changeset 9235 in orxonox.OLD for trunk/src/story_entities
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (19 years ago)
- Location:
- trunk/src/story_entities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/game_world.cc
r9110 r9235 62 62 #include "game_rules.h" 63 63 64 using namespace std;65 66 64 #include "script_class.h" 67 65 CREATE_SCRIPTABLE_CLASS(GameWorld, CL_GAME_WORLD, 68 66 addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode)) 67 ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack)) 69 68 ); 70 69 … … 158 157 159 158 PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str()); 160 // TiXmlElement* element;161 // GameLoader* loader = GameLoader::getInstance();159 // TiXmlElement* element; 160 // GameLoader* loader = GameLoader::getInstance(); 162 161 163 162 if( getLoadFile().empty()) … … 233 232 234 233 234 void GameWorld::setSoundtrack(const std::string& soundTrack) 235 { 236 if (this->dataTank != NULL) 237 { 238 this->dataTank->setSoundTrack(soundTrack); 239 this->dataTank->music->play(); 240 } 241 } 242 243 235 244 /** 236 245 * starts the GameWorld … … 312 321 /* update the state */ 313 322 //this->update (); /// LESS REDUNDANCY. 314 // PNode::getNullParent()->updateNode(this->dtS);323 // PNode::getNullParent()->updateNode(this->dtS); 315 324 PNode::getNullParent()->updateNode(this->dtS); 316 325 … … 459 468 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01), 460 469 this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ)); 461 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00), 462 this->dataTank->objectManager->getObjectList(OM_GROUP_01)); 470 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01), 471 this->dataTank->objectManager->getObjectList(OM_GROUP_00)); 472 473 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01), 474 this->dataTank->objectManager->getObjectList(OM_GROUP_02)); 475 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_02), 476 this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ)); 477 463 478 464 479 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00), … … 536 551 void GameWorld::renderPassReflection() 537 552 { 538 553 // clear buffer 539 554 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 540 // glLoadIdentity();555 // glLoadIdentity(); 541 556 542 557 const std::list<BaseObject*>* reflectedWaters; … … 562 577 // draw everything to be included in the reflection 563 578 this->drawEntityList(State::getObjectManager()->getReflectionList()); 564 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)565 // this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));579 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 580 // this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i])); 566 581 567 582 // clean up from reflection rendering … … 578 593 void GameWorld::renderPassRefraction() 579 594 { 580 595 // clear buffer 581 596 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 582 597 //glLoadIdentity(); … … 602 617 // draw everything to be included in the reflection 603 618 this->drawEntityList(State::getObjectManager()->getReflectionList()); 604 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)605 // this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));619 // for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i) 620 // this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i])); 606 621 607 622 // clean up from reflection rendering -
trunk/src/story_entities/game_world.h
r8740 r9235 31 31 class GameWorld : public StoryEntity 32 32 { 33 34 35 33 public: 34 GameWorld (); 35 virtual ~GameWorld (); 36 36 37 37 virtual void loadParams(const TiXmlElement* root); 38 38 39 40 41 42 39 /* functions from story-entity */ 40 virtual ErrorMessage init(); 41 virtual ErrorMessage loadData(); 42 virtual ErrorMessage unloadData(); 43 43 44 45 46 47 48 44 virtual bool start(); 45 virtual bool stop(); 46 virtual bool pause(); 47 virtual bool resume(); 48 virtual void run(); 49 49 50 void setPlaymode(Playable::Playmode playmode); 51 void setPlaymode(const std::string& playmode); 52 /** this returns the current game time @returns elapsed game time */ 53 inline double getGameTime() { return this->gameTime; } 54 /** sets the game speed @param speed speed of the Game */ 55 inline void setSpeed(float speed) { this->speed = speed; }; 56 /** returns the track path of this world @returns the track path */ 57 58 void togglePNodeVisibility(); 59 void toggleBVVisibility(int level); 60 61 inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; } 50 void setPlaymode(Playable::Playmode playmode); 51 void setPlaymode(const std::string& playmode); 52 /** this returns the current game time @returns elapsed game time */ 53 inline double getGameTime() { return this->gameTime; } 54 /** sets the game speed @param speed speed of the Game */ 55 inline void setSpeed(float speed) { this->speed = speed; }; 56 /** returns the track path of this world @returns the track path */ 62 57 63 58 64 protected: 65 /* world - running functions */ 66 virtual void synchronize(); 67 virtual void handleInput(); 68 virtual void tick(ObjectManager::EntityList worldEntity, float dt); 69 virtual void tick(); 70 virtual void update(); 71 virtual void checkGameRules(); 72 virtual void collisionDetection(); 73 virtual void collisionReaction(); 59 void setSoundtrack(const std::string& soundTrack); 60 void togglePNodeVisibility(); 61 void toggleBVVisibility(int level); 74 62 75 void applyCameraSettings(); 76 void drawEntityList(const ObjectManager::EntityList& drawList ) const; 77 virtual void renderPassReflection(); 78 virtual void renderPassRefraction(); 79 virtual void renderPassAll(); 63 inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; } 80 64 81 65 82 virtual void display(); 66 protected: 67 /* world - running functions */ 68 virtual void synchronize(); 69 virtual void handleInput(); 70 virtual void tick(ObjectManager::EntityList worldEntity, float dt); 71 virtual void tick(); 72 virtual void update(); 73 virtual void checkGameRules(); 74 virtual void collisionDetection(); 75 virtual void collisionReaction(); 76 77 void applyCameraSettings(); 78 void drawEntityList(const ObjectManager::EntityList& drawList ) const; 79 virtual void renderPassReflection(); 80 virtual void renderPassRefraction(); 81 virtual void renderPassAll(); 83 82 84 83 85 private: 86 void displayLoadScreen(); 87 void releaseLoadScreen(); 84 virtual void display(); 88 85 89 86 90 protected:91 GameWorldData* dataTank; //!< reference to the GameWorld Data Tank92 TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with.87 private: 88 void displayLoadScreen(); 89 void releaseLoadScreen(); 93 90 94 bool showPNodes; //!< if the PNodes should be visible.95 bool showBV; //!< if the Bounding Volumes should be visible.96 int showBVLevel; //!< the depth level of the displayed bounding volumes97 91 98 /* world timing */ 99 double lastFrame; //!< last time of frame (in MiliSeconds) 100 Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) 101 float dtS; //!< The time needed for caluculations in seconds 102 float speed; //!< how fast the game flows 103 double gameTime; //!< this is where the game time is saved 104 double frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames. 92 protected: 93 GameWorldData* dataTank; //!< reference to the GameWorld Data Tank 94 TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with. 105 95 106 GameRules* gameRules; //!< Pointer to the data structure containig the game rules 96 bool showPNodes; //!< if the PNodes should be visible. 97 bool showBV; //!< if the Bounding Volumes should be visible. 98 int showBVLevel; //!< the depth level of the displayed bounding volumes 107 99 108 private: 109 /* external modules interfaces */ 110 ScriptManager scriptManager; 111 OrxShell::Shell* shell; 100 /* world timing */ 101 double lastFrame; //!< last time of frame (in MiliSeconds) 102 Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) 103 float dtS; //!< The time needed for caluculations in seconds 104 float speed; //!< how fast the game flows 105 double gameTime; //!< this is where the game time is saved 106 double frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames. 107 108 GameRules* gameRules; //!< Pointer to the data structure containig the game rules 109 110 private: 111 /* external modules interfaces */ 112 ScriptManager scriptManager; 113 OrxShell::Shell* shell; 112 114 }; 113 115 -
trunk/src/story_entities/game_world_data.cc
r9019 r9235 249 249 this->tickLists.push_back(OM_GROUP_01); 250 250 this->tickLists.push_back(OM_GROUP_01_PROJ); 251 this->tickLists.push_back(OM_GROUP_02); 251 252 252 253 this->drawLists.push_back(OM_ENVIRON_NOTICK); 253 254 this->drawLists.push_back(OM_ENVIRON); 254 this->drawLists.push_back(OM_COMMON);255 255 this->drawLists.push_back(OM_GROUP_00); 256 256 this->drawLists.push_back(OM_GROUP_00_PROJ); 257 257 this->drawLists.push_back(OM_GROUP_01); 258 258 this->drawLists.push_back(OM_GROUP_01_PROJ); 259 this->drawLists.push_back(OM_GROUP_02); 260 this->drawLists.push_back(OM_COMMON); 259 261 260 262 /* init the pnode tree */ … … 343 345 LoadParamXML(root, "GameRule", this, GameWorldData, loadGameRule); 344 346 347 LoadParam(root, "clip-region", this->localCamera, Camera, setClipRegion); 348 345 349 346 350 //LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams); 347 351 //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams); 348 352 349 this->localCamera->setClipRegion(1, 10000.0);350 353 if( this->sky != NULL) 351 354 this->localCamera->addChild(this->sky); -
trunk/src/story_entities/menu/game_menu.cc
r9110 r9235 40 40 41 41 #include "network_manager.h" 42 43 #include "preferences.h" 42 44 43 45 //! This creates a Factory to fabricate a GameMenu … … 126 128 this->levelsBox = NULL; 127 129 this->networkBox = NULL; 128 130 129 131 this->clientNetworkBox = NULL; 130 132 this->serverNetworkBox = NULL; … … 239 241 { 240 242 OrxGui::GLGuiBox * box = new OrxGui::GLGuiBox(); 241 243 242 244 OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client"); 243 245 box->pack(clientButton); … … 247 249 box->pack(serverButton); 248 250 serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu)); 249 251 250 252 networkBox->pack( box ); 251 253 } … … 340 342 OrxGui::GLGuiHandler::getInstance()->activateCursor(); 341 343 OrxGui::GLGuiHandler::getInstance()->activate(); 342 OrxGui::GLGuiHandler::getInstance()->cursor()->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);343 344 344 345 /* now call the underlying*/ … … 518 519 //this->serverNetworkBox = NULL; 519 520 } 520 521 521 522 if ( !this->clientNetworkBox ) 522 523 { … … 526 527 text->setText( "Host:" ); 527 528 this->clientNetworkBox->pack( text ); 528 529 529 530 this->ipInputLine = new OrxGui::GLGuiInputLine( ); 530 this->ipInputLine->setText( "tardis-d08");531 this->ipInputLine->setText( Preferences::getInstance()->getString( "multiplayer", "lastVisitedServer", "localhost" ) ); 531 532 this->clientNetworkBox->pack( this->ipInputLine ); 532 533 this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer)); 533 534 this->ipInputLine->select(); 534 535 535 536 OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect"); 536 537 clientNetworkBox->pack(connectButton); … … 538 539 } 539 540 } 540 541 541 542 this->networkBox->pack( this->clientNetworkBox ); 542 543 543 544 this->clientNetworkBox->showAll(); 544 545 545 546 //this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 546 547 } … … 558 559 //this->clientNetworkBox = NULL; 559 560 } 560 561 561 562 if ( !this->serverNetworkBox ) 562 563 { … … 566 567 text->setText( "Map:" ); 567 568 this->serverNetworkBox->pack( text ); 568 569 569 570 OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText(); 570 571 text2->setText( "Multiplayer TeamDeathMatch Arena" ); 571 572 this->serverNetworkBox->pack( text2 ); 572 573 573 574 OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server"); 574 575 serverNetworkBox->pack(createButton); … … 576 577 } 577 578 } 578 579 579 580 this->networkBox->pack( this->serverNetworkBox ); 580 581 581 582 this->serverNetworkBox->showAll(); 582 583 583 584 //this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 584 585 } … … 590 591 { 591 592 PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() ); 592 593 593 594 State::setOnline(true); 594 595 NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 ); 595 596 597 Preferences::getInstance()->setString( "multiplayer", "lastVisitedServer", this->ipInputLine->_getText() ); 598 596 599 this->startLevel( 5 ); 597 600 } … … 600 603 { 601 604 PRINTF(0)("Create server\n" ); 602 605 603 606 State::setOnline(true); 604 607 NetworkManager::getInstance()->createServer( 9999 ); 605 608 606 609 this->startLevel( 5 ); 607 610 } -
trunk/src/story_entities/multi_player_world.cc
r9110 r9235 97 97 //CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), this->dataTank->objectManager->getObjectList(OM_PLAYERS)); 98 98 99 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_PLAYERS_PROJ\n\n");100 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS_PROJ),101 this->dataTank->objectManager->getObjectList(OM_PLAYERS));102 99 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_GROUP_01_PROJ\n\n"); 103 100 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), … … 106 103 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), 107 104 this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ)); 105 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_PLAYERS_PROJ\n\n"); 108 106 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), 109 this->dataTank->objectManager->getObjectList(OM_GROUP_00)); 110 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), 111 this->dataTank->objectManager->getObjectList(OM_GROUP_01)); 107 this->dataTank->objectManager->getObjectList(OM_PLAYERS_PROJ)); 108 109 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00), 110 this->dataTank->objectManager->getObjectList(OM_PLAYERS)); 111 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01), 112 this->dataTank->objectManager->getObjectList(OM_PLAYERS)); 112 113 113 114 -
trunk/src/story_entities/multi_player_world_data.cc
r9008 r9235 109 109 ErrorMessage MultiPlayerWorldData::loadWorldEntities(const TiXmlElement* root) 110 110 { 111 /* load the spawning points */ 112 const TiXmlElement* element = root->FirstChildElement("SpawningPoints"); 113 if( element == NULL) 114 { 115 PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n"); 116 } 117 else 118 { 119 element = element->FirstChildElement(); 120 // load Players/Objects/Whatever 121 PRINTF(4)("Loading Spawning Points\n"); 122 while( element != NULL) 123 { 124 BaseObject* created = Factory::fabricate(element); 125 if( created != NULL ) 126 printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName()); 127 128 element = element->NextSiblingElement(); 129 glmis->step(); 130 } 131 PRINTF(4)("Done loading Spawning Points\n"); 111 const TiXmlElement* element = NULL; 112 113 if( NetworkManager::getInstance()->isGameServer() ) 114 { 115 /* load the spawning points */ 116 element = root->FirstChildElement("SpawningPoints"); 117 if( element == NULL) 118 { 119 PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n"); 120 } 121 else 122 { 123 element = element->FirstChildElement(); 124 // load Players/Objects/Whatever 125 PRINTF(4)("Loading Spawning Points\n"); 126 while( element != NULL) 127 { 128 BaseObject* created = Factory::fabricate(element); 129 if( created != NULL ) 130 printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName()); 131 132 element = element->NextSiblingElement(); 133 glmis->step(); 134 } 135 PRINTF(4)("Done loading Spawning Points\n"); 136 } 132 137 } 133 138
Note: See TracChangeset
for help on using the changeset viewer.