- Timestamp:
- Jul 5, 2006, 12:27:18 AM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/story_entities/game_world.cc
r9110 r9179 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 … … 460 469 this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ)); 461 470 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00), 462 this->dataTank->objectManager->getObjectList(OM_GROUP_01)); 471 this->dataTank->objectManager->getObjectList(OM_GROUP_01)); 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 -
branches/presentation/src/story_entities/game_world.h
r8740 r9179 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 -
branches/presentation/src/story_entities/game_world_data.cc
r9149 r9179 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 */ … … 390 392 std::string oggFile = ResourceManager::getFullName(name); 391 393 this->music = new OrxSound::OggPlayer(oggFile); 394 this->music->debug(); 392 395 if (this->localPlayer != NULL) 393 396 this->localPlayer->hud().notifyUser(std::string("Playing SoundTrack: ") + this->music->artist() + " - " + this->music->title()); -
branches/presentation/src/util/hud.cc
r9014 r9179 187 187 this->_radar->setCenterNode(State::getPlayer()->getPlayable()); 188 188 this->_radar->addEntityList(&State::getObjectManager()->getObjectList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0)); 189 this->_radar->addEntityList(&State::getObjectManager()->getObjectList(OM_GROUP_02), Color(1.0, .2, .2)); 189 190 this->_radar->setAbsCoor2D(0.8 * this->resX, 0.01 * this->resY); 190 191 this->_radar->setWidgetSize(0.2 * this->resX, 0.2 * this->resY); -
branches/presentation/src/world_entities/npcs/attractor_mine.cc
r9178 r9179 51 51 { 52 52 this->setClassID(CL_ATTRACTOR_MINE, "AttractorMine"); 53 54 this->toList(OM_GROUP_02); 53 55 54 56 if ((float)rand()/RAND_MAX > .5f) -
branches/presentation/src/world_entities/npcs/npc.cc
r9161 r9179 19 19 20 20 #include "npc.h" 21 22 23 using namespace std;24 21 25 22
Note: See TracChangeset
for help on using the changeset viewer.