Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9179 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 5, 2006, 12:27:18 AM (18 years ago)
Author:
bensch
Message:

orxonox/presentation: radar shows scattered Mines.
Collision-Lists

Location:
branches/presentation/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/story_entities/game_world.cc

    r9110 r9179  
    6262#include "game_rules.h"
    6363
    64 using namespace std;
    65 
    6664#include "script_class.h"
    6765CREATE_SCRIPTABLE_CLASS(GameWorld, CL_GAME_WORLD,
    6866                        addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode))
     67                        ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack))
    6968                       );
    7069
     
    158157
    159158  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();
    162161
    163162  if( getLoadFile().empty())
     
    233232
    234233
     234void 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
    235244/**
    236245 *  starts the GameWorld
     
    312321    /* update the state */
    313322    //this->update (); /// LESS REDUNDANCY.
    314 //      PNode::getNullParent()->updateNode(this->dtS);
     323    //      PNode::getNullParent()->updateNode(this->dtS);
    315324    PNode::getNullParent()->updateNode(this->dtS);
    316325
     
    460469      this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ));
    461470  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
    463478
    464479  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
     
    536551void GameWorld::renderPassReflection()
    537552{
    538     // clear buffer
     553  // clear buffer
    539554  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    540 //  glLoadIdentity();
     555  //  glLoadIdentity();
    541556
    542557  const std::list<BaseObject*>* reflectedWaters;
     
    562577      // draw everything to be included in the reflection
    563578      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]));
    566581
    567582      // clean up from reflection rendering
     
    578593void GameWorld::renderPassRefraction()
    579594{
    580     // clear buffer
     595  // clear buffer
    581596  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    582597  //glLoadIdentity();
     
    602617      // draw everything to be included in the reflection
    603618      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]));
    606621
    607622      // clean up from reflection rendering
  • branches/presentation/src/story_entities/game_world.h

    r8740 r9179  
    3131class GameWorld : public StoryEntity
    3232{
    33   public:
    34     GameWorld ();
    35     virtual ~GameWorld ();
     33public:
     34  GameWorld ();
     35  virtual ~GameWorld ();
    3636
    37     virtual void loadParams(const TiXmlElement* root);
     37  virtual void loadParams(const TiXmlElement* root);
    3838
    39     /* functions from story-entity */
    40     virtual ErrorMessage init();
    41     virtual ErrorMessage loadData();
    42     virtual ErrorMessage unloadData();
     39  /* functions from story-entity */
     40  virtual ErrorMessage init();
     41  virtual ErrorMessage loadData();
     42  virtual ErrorMessage unloadData();
    4343
    44     virtual bool start();
    45     virtual bool stop();
    46     virtual bool pause();
    47     virtual bool resume();
    48     virtual void run();
     44  virtual bool start();
     45  virtual bool stop();
     46  virtual bool pause();
     47  virtual bool resume();
     48  virtual void run();
    4949
    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 */
    6257
    6358
    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);
    7462
    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; }
    8064
    8165
    82     virtual void display();
     66protected:
     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();
    8382
    8483
    85   private:
    86     void displayLoadScreen();
    87     void releaseLoadScreen();
     84  virtual void display();
    8885
    8986
    90   protected:
    91     GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
    92     TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
     87private:
     88  void displayLoadScreen();
     89  void releaseLoadScreen();
    9390
    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 volumes
    9791
    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.
     92protected:
     93  GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
     94  TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
    10595
    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
    10799
    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
     110private:
     111  /* external modules interfaces */
     112  ScriptManager       scriptManager;
     113  OrxShell::Shell*    shell;
    112114};
    113115
  • branches/presentation/src/story_entities/game_world_data.cc

    r9149 r9179  
    249249  this->tickLists.push_back(OM_GROUP_01);
    250250  this->tickLists.push_back(OM_GROUP_01_PROJ);
     251  this->tickLists.push_back(OM_GROUP_02);
    251252
    252253  this->drawLists.push_back(OM_ENVIRON_NOTICK);
    253254  this->drawLists.push_back(OM_ENVIRON);
    254   this->drawLists.push_back(OM_COMMON);
    255255  this->drawLists.push_back(OM_GROUP_00);
    256256  this->drawLists.push_back(OM_GROUP_00_PROJ);
    257257  this->drawLists.push_back(OM_GROUP_01);
    258258  this->drawLists.push_back(OM_GROUP_01_PROJ);
     259  this->drawLists.push_back(OM_GROUP_02);
     260  this->drawLists.push_back(OM_COMMON);
    259261
    260262  /* init the pnode tree */
     
    390392    std::string oggFile = ResourceManager::getFullName(name);
    391393    this->music = new OrxSound::OggPlayer(oggFile);
     394    this->music->debug();
    392395    if (this->localPlayer != NULL)
    393396      this->localPlayer->hud().notifyUser(std::string("Playing SoundTrack: ") + this->music->artist() + " - " + this->music->title());
  • branches/presentation/src/util/hud.cc

    r9014 r9179  
    187187    this->_radar->setCenterNode(State::getPlayer()->getPlayable());
    188188    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));
    189190    this->_radar->setAbsCoor2D(0.8 * this->resX, 0.01 * this->resY);
    190191    this->_radar->setWidgetSize(0.2 * this->resX, 0.2 * this->resY);
  • branches/presentation/src/world_entities/npcs/attractor_mine.cc

    r9178 r9179  
    5151{
    5252  this->setClassID(CL_ATTRACTOR_MINE, "AttractorMine");
     53
     54  this->toList(OM_GROUP_02);
    5355
    5456  if ((float)rand()/RAND_MAX > .5f)
  • branches/presentation/src/world_entities/npcs/npc.cc

    r9161 r9179  
    1919
    2020#include "npc.h"
    21 
    22 
    23 using namespace std;
    2421
    2522
Note: See TracChangeset for help on using the changeset viewer.