Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3459 in orxonox.OLD


Ignore:
Timestamp:
Mar 9, 2005, 1:00:30 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: cleaning up old stuff in world.cc and its relatives. first step…

Location:
orxonox/trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.in

    r3458 r3459  
    324324          esac; \
    325325        done; \
    326         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
     326        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
    327327        cd $(top_srcdir) && \
    328           $(AUTOMAKE) --gnu  src/Makefile
     328          $(AUTOMAKE) --foreign  src/Makefile
    329329.PRECIOUS: Makefile
    330330Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/trunk/src/campaign.cc

    r3231 r3459  
    3939}
    4040
    41 /**
    42     \brief adds an game stroy entity to the campaign
    43 
    44     \param se: The entity
    45     \param storyID: The number that identifies the entity in the campaign. Each ID only used once in a Campaign
    46 
    47     An entity can be a world (playable), a cinematic, a shop, sounds, whatever you
    48     want to queue up in the campaign.
    49 */
    50 void Campaign::addEntity(StoryEntity* se, int storyID)
    51 {
    52   se->setStoryID(storyID);
    53   this->addEntity(se);
    54 }
    55 
    56 void Campaign::addEntity(StoryEntity* se)
    57 {
    58   this->entities->add(se);
    59 }
    60 
    61 
    62 void Campaign::removeEntity(int storyID)
    63 {
    64   this->removeEntity(this->getStoryEntity(storyID));
    65  
    66 }
    67 
    68 
    69 void Campaign::removeEntity(StoryEntity* se)
    70 {
    71   this->entities->remove(se);
    72 }
    73 
    7441
    7542ErrorMessage Campaign::start()
     
    7744  this->start(0);
    7845}
     46
    7947
    8048ErrorMessage Campaign::start(int storyID = 0)
     
    11381}
    11482
     83
     84ErrorMessage Campaign::pause()
     85{
     86  if(this->currentEntity != NULL)
     87    this->isPaused = true;
     88}
     89
     90
     91ErrorMessage Campaign::resume()
     92{
     93  if(this->currentEntity != NULL)
     94    this->isPaused = false;
     95}
     96
     97
    11598ErrorMessage Campaign::stop()
    11699{
     
    124107}
    125108
    126 ErrorMessage Campaign::pause()
    127 {
    128   if(this->currentEntity != NULL)
    129     this->isPaused = true;
    130 }
    131 
    132 
    133 ErrorMessage Campaign::resume()
    134 {
    135   if(this->currentEntity != NULL)
    136     this->isPaused = false;
    137 }
    138 
    139 
    140 void Campaign::destroy()
     109
     110ErrorMessage Campaign::destroy()
    141111{
    142112  if(this->currentEntity != NULL)
     
    147117    }
    148118}
     119
     120
     121/**
     122    \brief adds an game stroy entity to the campaign
     123
     124    \param se: The entity
     125    \param storyID: The number that identifies the entity in the campaign. Each ID only used once in a Campaign
     126
     127    An entity can be a world (playable), a cinematic, a shop, sounds, whatever you
     128    want to queue up in the campaign.
     129*/
     130void Campaign::addEntity(StoryEntity* se, int storyID)
     131{
     132  se->setStoryID(storyID);
     133  this->addEntity(se);
     134}
     135
     136void Campaign::addEntity(StoryEntity* se)
     137{
     138  this->entities->add(se);
     139}
     140
     141
     142void Campaign::removeEntity(int storyID)
     143{
     144  this->removeEntity(this->getStoryEntity(storyID));
     145 
     146}
     147
     148
     149void Campaign::removeEntity(StoryEntity* se)
     150{
     151  this->entities->remove(se);
     152}
     153
    149154
    150155/*
  • orxonox/trunk/src/campaign.h

    r3224 r3459  
    2020  virtual ErrorMessage start();
    2121  virtual ErrorMessage start(int storyID);
    22   virtual ErrorMessage stop();
    2322  virtual ErrorMessage pause();
    2423  virtual ErrorMessage resume();
    25 
    26   virtual void destroy();
     24  virtual ErrorMessage stop();
     25  virtual ErrorMessage destroy();
    2726
    2827  void addEntity(StoryEntity* se, int storyID);
  • orxonox/trunk/src/console/Makefile.in

    r3458 r3459  
    203203          esac; \
    204204        done; \
    205         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/console/Makefile'; \
     205        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/console/Makefile'; \
    206206        cd $(top_srcdir) && \
    207           $(AUTOMAKE) --gnu  src/console/Makefile
     207          $(AUTOMAKE) --foreign  src/console/Makefile
    208208.PRECIOUS: Makefile
    209209Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/trunk/src/gui/Makefile.in

    r3458 r3459  
    234234          esac; \
    235235        done; \
    236         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/gui/Makefile'; \
     236        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/gui/Makefile'; \
    237237        cd $(top_srcdir) && \
    238           $(AUTOMAKE) --gnu  src/gui/Makefile
     238          $(AUTOMAKE) --foreign  src/gui/Makefile
    239239.PRECIOUS: Makefile
    240240Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/trunk/src/importer/Makefile.in

    r3458 r3459  
    215215          esac; \
    216216        done; \
    217         echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/importer/Makefile'; \
     217        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/importer/Makefile'; \
    218218        cd $(top_srcdir) && \
    219           $(AUTOMAKE) --gnu  src/importer/Makefile
     219          $(AUTOMAKE) --foreign  src/importer/Makefile
    220220.PRECIOUS: Makefile
    221221Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • orxonox/trunk/src/story_entity.cc

    r3222 r3459  
    2626StoryEntity::StoryEntity () {}
    2727StoryEntity::~StoryEntity () {}
    28 
    29 
    30 /**
    31     \brief initialize the entity before use.
    32     \returns an error code if not able to apply.
    33 
    34     After execution of this function, the Entity is ready to be played/executed,
    35     this shifts the initialisation work before the execution - very important...
    36 */
    37 ErrorMessage StoryEntity::init()
    38 {}
    3928
    4029
     
    8473
    8574/**
     75    \brief initialize the entity before use.
     76    \returns an error code if not able to apply.
     77
     78    After execution of this function, the Entity is ready to be played/executed,
     79    this shifts the initialisation work before the execution - very important...
     80*/
     81ErrorMessage StoryEntity::init()
     82{}
     83
     84
     85/**
     86    \brief loads the current entity
     87
     88    this is here to enable you loading maps into the entities. for all other actions you
     89    should take the init() function.
     90*/
     91ErrorMessage StoryEntity::load()
     92{}
     93
     94/**
    8695    \brief starts the entity with the choosen id. only for entities with lists.
    8796    \param story id
     
    102111*/
    103112ErrorMessage StoryEntity::start()
    104 {}
    105 
    106 
    107 /**
    108     \brief stops the current entity
    109     \returns error code if this action has caused a error
    110 
    111     ATTENTION: this function shouldn't call other functions, or if so, they must return
    112     after finishing. If you ignore or forget to do so, the current entity is not able to
    113     terminate and it will run in the background or the ressources can't be freed or even
    114     worse: are freed and the program will end in a segmentation fault!
    115     hehehe, all seen... :)
    116 */
    117 ErrorMessage StoryEntity::stop()
    118113{}
    119114
     
    140135
    141136/**
    142     \brief loads the current entity
     137    \brief stops the current entity
     138    \returns error code if this action has caused a error
    143139
    144     this is here to enable you loading maps into the entities. for all other actions you
    145     should take the init() function.
     140    ATTENTION: this function shouldn't call other functions, or if so, they must return
     141    after finishing. If you ignore or forget to do so, the current entity is not able to
     142    terminate and it will run in the background or the ressources can't be freed or even
     143    worse: are freed and the program will end in a segmentation fault!
     144    hehehe, all seen... :)
    146145*/
    147 void StoryEntity::load()
     146ErrorMessage StoryEntity::stop()
    148147{}
    149148
     
    155154    the entity please use the stop() function.
    156155*/
    157 void StoryEntity::destroy()
     156ErrorMessage StoryEntity::destroy()
    158157{}
    159158
  • orxonox/trunk/src/story_entity.h

    r3365 r3459  
    2121  bool isPaused; //! is true if the entity is paused
    2222
     23  virtual ErrorMessage load();
    2324  virtual ErrorMessage init();
    2425  virtual ErrorMessage start(int storyID);
    2526  virtual ErrorMessage start();
    26   virtual ErrorMessage stop();
    2727  virtual ErrorMessage pause();
    2828  virtual ErrorMessage resume();
     29  virtual ErrorMessage stop();
     30  virtual ErrorMessage destroy();
    2931
    30   virtual void load();
    31   virtual void destroy();
    3232
    3333  virtual void displayLoadScreen();
  • orxonox/trunk/src/world.cc

    r3458 r3459  
    7070  cn->unbind(this->localPlayer);
    7171  cn->reset();
     72
    7273  this->localCamera->destroy();
    73 
    74   this->nullParent->destroy();
    75  
     74  this->nullParent->destroy(); 
    7675  delete this->skySphere;
    7776
     
    9796}
    9897
    99 GLfloat ctrlpoints[4][3] = {
    100   {20.0, 10.0, 5.0}, {40.0, -10.0, 0.0},
    101   {60.0, -10.0, 5.0}, {80.0, 10.0, 5.0}};
    102 
    103 /**
    104    \brief initializes a new World
    105 */
    106 ErrorMessage World::init()
    107 {
    108   this->bPause = false;
    109   CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    110   cn->addToWorld(this);
    111   cn->enable(true);
    112 
    113   //glMap1f (GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]);
    114   //glEnable (GL_MAP1_VERTEX_3);
    115  
    116   //theNurb = gluNewNurbsRenderer ();
    117   //gluNurbsProperty (theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR);
    118   //gluNurbsProperty (theNurb, GLU_NURBS_VERTEX, vertexCallback );
    119 
    120 }
    121 
    122 
    123 /**
    124    \brief starts the World
    125 */
    126 ErrorMessage World::start()
    127 {
    128   printf("World::start() - starting current World: nr %i\n", this->debugWorldNr);
    129   this->bQuitOrxonox = false;
    130   this->bQuitCurrentGame = false;
    131   this->mainLoop();
    132 }
    133 
    134 /**
    135    \brief stops the world.
    136 
    137    This happens, when the player decides to end the Level.
    138 */
    139 ErrorMessage World::stop()
    140 {
    141   printf("World::stop() - got stop signal\n");
    142   this->bQuitCurrentGame = true;
    143 }
    144 
    145 /**
    146    \brief pauses the Game
    147 */
    148 ErrorMessage World::pause()
    149 {
    150   this->isPaused = true;
    151 }
    152 
    153 /**
    154    \brief ends the pause Phase
    155 */
    156 ErrorMessage World::resume()
    157 {
    158   this->isPaused = false;
    159 }
    160 
    161 /**
    162    \brief destroys the World
    163 */
    164 void World::destroy()
    165 {
    166   delete trackManager;
    167 }
    168 
    169 /**
    170    \brief shows the loading screen
    171 */
    172 void World::displayLoadScreen ()
    173 {
    174   printf ("World::displayLoadScreen - start\n");
    175  
    176   //GLMenuImageScreen*
    177   this->glmis = GLMenuImageScreen::getInstance();
    178   this->glmis->init();
    179   this->glmis->setMaximum(10);
    180   this->glmis->draw();
    181  
    182   printf ("World::displayLoadScreen - end\n");
    183 }
    184 
    185 /**
    186    \brief removes the loadscreen, and changes over to the game
    187 
    188    \todo take out the delay
    189 */
    190 void World::releaseLoadScreen ()
    191 {
    192   printf ("World::releaseLoadScreen - start\n");
    193   this->glmis->setValue(this->glmis->getMaximum());
    194   SDL_Delay(500);
    195   printf ("World::releaseLoadScreen - end\n");
    196 }
    19798
    19899/**
    199100   \brief loads the World by initializing all resources, and set their default values.
    200101*/
    201 void World::load()
     102ErrorMessage World::load()
    202103{
    203104  //  BezierCurve* tmpCurve = new BezierCurve();
     
    594495}
    595496
     497/**
     498   \brief initializes a new World
     499*/
     500ErrorMessage World::init()
     501{
     502  this->bPause = false;
     503  CommandNode* cn = Orxonox::getInstance()->getLocalInput();
     504  cn->addToWorld(this);
     505  cn->enable(true);
     506
     507  //glMap1f (GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]);
     508  //glEnable (GL_MAP1_VERTEX_3);
     509 
     510  //theNurb = gluNewNurbsRenderer ();
     511  //gluNurbsProperty (theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR);
     512  //gluNurbsProperty (theNurb, GLU_NURBS_VERTEX, vertexCallback );
     513
     514}
     515
     516
     517/**
     518   \brief starts the World
     519*/
     520ErrorMessage World::start()
     521{
     522  printf("World::start() - starting current World: nr %i\n", this->debugWorldNr);
     523  this->bQuitOrxonox = false;
     524  this->bQuitCurrentGame = false;
     525  this->mainLoop();
     526}
     527
     528/**
     529   \brief stops the world.
     530
     531   This happens, when the player decides to end the Level.
     532*/
     533ErrorMessage World::stop()
     534{
     535  printf("World::stop() - got stop signal\n");
     536  this->bQuitCurrentGame = true;
     537}
     538
     539/**
     540   \brief pauses the Game
     541*/
     542ErrorMessage World::pause()
     543{
     544  this->isPaused = true;
     545}
     546
     547/**
     548   \brief ends the pause Phase
     549*/
     550ErrorMessage World::resume()
     551{
     552  this->isPaused = false;
     553}
     554
     555/**
     556   \brief destroys the World
     557*/
     558ErrorMessage World::destroy()
     559{
     560  delete trackManager;
     561}
     562
     563/**
     564   \brief shows the loading screen
     565*/
     566void World::displayLoadScreen ()
     567{
     568  printf ("World::displayLoadScreen - start\n");
     569 
     570  //GLMenuImageScreen*
     571  this->glmis = GLMenuImageScreen::getInstance();
     572  this->glmis->init();
     573  this->glmis->setMaximum(10);
     574  this->glmis->draw();
     575 
     576  printf ("World::displayLoadScreen - end\n");
     577}
     578
     579/**
     580   \brief removes the loadscreen, and changes over to the game
     581
     582   \todo take out the delay
     583*/
     584void World::releaseLoadScreen ()
     585{
     586  printf ("World::releaseLoadScreen - start\n");
     587  this->glmis->setValue(this->glmis->getMaximum());
     588  SDL_Delay(500);
     589  printf ("World::releaseLoadScreen - end\n");
     590}
     591
    596592
    597593/**
     
    722718}
    723719
    724 /**
    725     \brief relays the passed time since the last frame to entities and Track parts
    726     \param deltaT: the time passed since the last frame in milliseconds
    727 */
    728 void World::timeSlice (Uint32 deltaT)
    729 {
    730   //List<WorldEntity> *l;
    731   WorldEntity* entity;
    732   float seconds = deltaT / 1000.0;
    733  
    734   this->nullParent->update (seconds);
    735   //this->nullParent->processTick (seconds);
    736 
    737   entity = entities->enumerate();
    738   while( entity != NULL)
    739     {
    740       entity->tick (seconds);
    741       entity = entities->nextElement();
    742     }
    743 
    744   skySphere->updatePosition(localCamera->absCoordinate);
    745   //for( int i = 0; i < tracklen; i++) track[i].tick (seconds);
    746 }
    747 
    748 /**
    749    \brief removes level data from memory
    750 */
    751 void World::unload()
    752 {
    753 
    754 }
    755 
    756720
    757721/**
     
    848812      this->timeSlice ();
    849813      // Process collision
    850       this->collision ();
     814      this->collide ();
    851815      // Draw
    852816      this->display ();
     
    858822}
    859823
     824
    860825/**
    861826   \brief synchronize local data with remote data
     
    866831  // Update synchronizables
    867832}
     833
    868834
    869835/**
     
    880846  // remoteinput
    881847}
     848
    882849
    883850/**
     
    909876          dt = 10;
    910877        }
    911       this->timeSlice (dt);
     878      //this->timeSlice (dt);
     879     
     880      /* function to let all entities tick (iterate through list) */
     881      WorldEntity* entity;
     882      float seconds = dt / 1000.0;     
     883      this->nullParent->update (seconds);
     884      entity = entities->enumerate();
     885      while( entity != NULL)
     886        {
     887          entity->tick (seconds);
     888          entity = entities->nextElement();
     889        }
     890      skySphere->updatePosition(localCamera->absCoordinate);
     891     
     892      /* update tick the rest */
    912893      this->update ();
    913894      this->localCamera->timeSlice(dt);
     
    915896    }
    916897  this->lastFrame = currentFrame;
    917 }
    918 
    919 
    920 /**
    921    \brief compute collision detection
    922 */
    923 void World::collision ()
    924 {
    925   this->collide ();
    926898}
    927899
  • orxonox/trunk/src/world.h

    r3456 r3459  
    3131  World (int worldID);
    3232  virtual ~World ();
    33  
     33
     34
     35  /* classes from story-entity */
     36  virtual ErrorMessage load ();
    3437  virtual ErrorMessage init ();
    3538  virtual ErrorMessage start ();
     
    3740  virtual ErrorMessage pause ();
    3841  virtual ErrorMessage resume ();
     42  virtual ErrorMessage destroy ();
    3943
    40   virtual void load ();
    41   virtual void destroy ();
     44  virtual void displayLoadScreen();
     45  virtual void releaseLoadScreen();
    4246
    43   //static void vertexCallback (GLfloat* vertex);
    4447
    45   void timeSlice (Uint32 deltaT);
    46   void collide ();
     48  /* main functions for world-looping */
     49
    4750  void draw ();
    4851  void update ();       // maps Locations to Placements
    4952  //void calcCameraPos (Location* loc, Placement* plc);
    5053       
    51   void unload ();
    5254  bool command (Command* cmd);
    53   virtual void displayLoadScreen();
    54   virtual void releaseLoadScreen();
     55
    5556 
    5657  //bool system_command (Command* cmd);
     
    9091  void handleInput ();
    9192  void timeSlice ();
    92   void collision ();
     93  void collide ();
    9394  void display ();
    9495  void debug ();
Note: See TracChangeset for help on using the changeset viewer.