Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6152 in orxonox.OLD for trunk


Ignore:
Timestamp:
Dec 17, 2005, 6:52:57 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: some work in the loading process of worlds

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/campaign.cc

    r6139 r6152  
    117117    {
    118118      PRINTF(0)("Starting new StoryEntity Nr:%i\n", se->getStoryID());
    119       se->displayLoadScreen();
    120119      se->preLoad();
    121120      se->load();
    122       se->init();
    123       se->releaseLoadScreen();
     121      se->postLoad();
     122
     123      se->preStart();
    124124      se->start();
    125125      se->destroy();
  • trunk/src/story_entities/story_entity.cc

    r4836 r6152  
    7373  return this->nextStoryID;
    7474}
    75 
    76 
    77 /**
    78  *  stuff that will have to be initialized before load
    79 
    80    this gives all storyentities the possibility to init stuff before the
    81    load function, where all the stuff is been made ready for start
    82 */
    83 ErrorMessage StoryEntity::preLoad()
    84 {}
    85 
    86 /**
    87   *  loads the current entity
    88 
    89     this is here to enable you loading maps into the entities. for all other actions you
    90     should take the init() function.
    91     load() is exec before init()
    92 */
    93 ErrorMessage StoryEntity::load()
    94 {}
    95 
    96 
    97 /**
    98   *  initialize the entity before use.
    99   * @returns an error code if not able to apply.
    100 
    101     After execution of this function, the Entity is ready to be played/executed,
    102     this shifts the initialisation work before the execution - very important...
    103     init() is exec shortly before start()
    104 */
    105 ErrorMessage StoryEntity::init()
    106 {}
    107 
    108 
    109 /**
    110   *  starts the entity with the choosen id. only for entities with lists.
    111   * @param story id
    112   * @returns error code if this action has caused a error
    113 
    114     this simply starts the story with the id storyID. the story with the choosen id has
    115     to be part of the current entity else, this doesn't make sense. this is used for
    116     campaigns or the GameLoader, they have lists of Campaigns/Worlds with their own
    117     storyID.
    118 */
    119 ErrorMessage StoryEntity::start(int storyID)
    120 {}
    121 
    122 
    123 /**
    124   *  starts the current entity
    125   * @returns error code if this action has caused a error
    126 */
    127 ErrorMessage StoryEntity::start()
    128 {}
    129 
    130 
    131 /**
    132   *  pause the current entity
    133   * @returns error code if this action has caused a error
    134 
    135     this pauses the current entity or passes this call forth to the running entity.
    136 */
    137 ErrorMessage StoryEntity::pause()
    138 {}
    139 
    140 
    141 /**
    142   *  resumes a pause
    143   * @returns error code if this action has caused a error
    144 
    145     this resumess the current entity or passes this call forth to the running entity.
    146 */
    147 ErrorMessage StoryEntity::resume()
    148 {}
    149 
    150 
    151 /**
    152   *  stops the current entity
    153   * @returns error code if this action has caused a error
    154 
    155     ATTENTION: this function shouldn't call other functions, or if so, they must return
    156     after finishing. If you ignore or forget to do so, the current entity is not able to
    157     terminate and it will run in the background or the ressources can't be freed or even
    158     worse: are freed and the program will end in a segmentation fault!
    159     hehehe, all seen... :)
    160 */
    161 ErrorMessage StoryEntity::stop()
    162 {}
    163 
    164 
    165 /**
    166   *  destroys and cleans up the current entity.
    167 
    168     this cleans up ressources before the deconstructor is called. for terminating
    169     the entity please use the stop() function.
    170 */
    171 ErrorMessage StoryEntity::destroy()
    172 {}
    173 
    174 
    175 /**
    176   *  this displays the load screen
    177 
    178     it will need some time to load maps or things like that. to inform the user about
    179     progress and to just show him/her something for the eyes, put here this stuff
    180 */
    181 void StoryEntity::displayLoadScreen()
    182 {}
    183 
    184 
    185 /**
    186   *  undisplay the load screen
    187 
    188     the load process has terminated, you now can release the load screen and start this
    189     entity.
    190 */
    191 void StoryEntity::releaseLoadScreen()
    192 {}
  • trunk/src/story_entities/story_entity.h

    r5039 r6152  
    1919  virtual ~StoryEntity ();
    2020
    21   bool isInit;  //! if the entity is initialized, this has to be true
    22   bool isPaused; //! is true if the entity is paused
    2321
    24   virtual ErrorMessage preLoad();
    25   virtual ErrorMessage load();
    26   virtual ErrorMessage init();
    27   virtual ErrorMessage start(int storyID);
    28   virtual ErrorMessage start();
    29   virtual ErrorMessage pause();
    30   virtual ErrorMessage resume();
    31   virtual ErrorMessage stop();
    32   virtual ErrorMessage destroy();
     22  // INIT AND LOAD //
     23  virtual ErrorMessage preLoad() {};
     24  virtual ErrorMessage load() {};
     25  virtual ErrorMessage postLoad() {};
     26  virtual ErrorMessage check() {};
    3327
    34 
    35   virtual void displayLoadScreen();
    36   virtual void releaseLoadScreen();
     28  // RUNNING //
     29  virtual ErrorMessage preStart() {};
     30  virtual ErrorMessage start() = 0;
     31  virtual ErrorMessage pause() = 0;
     32  virtual ErrorMessage rewind() {};
     33  virtual ErrorMessage suspend() {};
     34  virtual ErrorMessage resume() = 0;
     35  virtual ErrorMessage stop() = 0;
     36  virtual ErrorMessage destroy() {};
    3737
    3838  void setStoryID(int storyID);
     
    4242  int getNextStoryID();
    4343
     44  protected:
     45    bool isInit;         //!< if the entity is initialized, this has to be true.
     46    bool readyToRun;     //!< If the entity is ready to run -> post-check.
     47    bool isPaused;       //!< is true if the entity is paused
     48    bool isSuspended;    //!< if the Entity is suspended.
    4449
    4550 private:
    46   int storyID; //! this is the number of this entity, identifying it in a list/tree...
    47   int nextStoryID; //! if this entity has finished, this entity shall be called
     51  int storyID;           //!< this is the number of this entity, identifying it in a list/tree...
     52  int nextStoryID;       //!< if this entity has finished, this entity shall be called
    4853};
    4954
  • trunk/src/story_entities/world.cc

    r6151 r6152  
    201201
    202202  GraphicsEngine::getInstance()->displayFPS(true);
     203  this->displayLoadScreen();
    203204}
    204205
     
    384385}
    385386
     387ErrorMessage World::postLoad()
     388{
     389  this->releaseLoadScreen();
     390}
     391
    386392
    387393/**
     
    391397 * started
    392398*/
    393 ErrorMessage World::init()
     399ErrorMessage World::preStart()
    394400{
    395401  this->bPause = false;
  • trunk/src/story_entities/world.h

    r6151 r6152  
    3939  virtual ErrorMessage preLoad();
    4040  virtual ErrorMessage load ();
    41   virtual ErrorMessage init ();
     41  virtual ErrorMessage postLoad();
     42
     43  virtual ErrorMessage preStart();
    4244  virtual ErrorMessage start ();
    4345  virtual ErrorMessage stop ();
     
    4648  virtual ErrorMessage destroy ();
    4749
    48   virtual void displayLoadScreen();
    49   virtual void releaseLoadScreen();
     50  void displayLoadScreen();
     51  void releaseLoadScreen();
    5052
    5153  /* interface to world */
  • trunk/src/util/loading/game_loader.cc

    r6151 r6152  
    1919
    2020#include "game_loader.h"
     21#include "load_param.h"
    2122
    2223#include "shell_command.h"
    2324#include "campaign.h"
    24 #include "world.h"
    25 #include "orxonox.h"
    26 #include "camera.h"
    27 #include "vector.h"
     25
    2826#include "resource_manager.h"
    29 #include "factory.h"
    30 #include "event.h"
     27
    3128#include "event_handler.h"
    32 #include <string.h>
    3329
    3430
  • trunk/src/util/loading/game_loader.h

    r6139 r6152  
    2727//! The GameLoader
    2828/**
    29    The game loader loads all game date. this is performed in the following way:
    30    1. Read the structure of campaings and worlds
    31    2. Create the instances of the tree: here _ALL_ StoryEntities are created
    32       also if they are not yet used. the worlds should load their data in
    33       the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
    34       Elsewhere, all the data will be allocated at the beginning... mess...
    35    3. StoryEntities are load() and init() before they start
    36    4. once the gamloader starts the game there will be a campaing starting a
    37       world. this is done by callaing those StoryEntity::start()
     29 *  The game loader loads all game date. this is performed in the following way:
     30 * 1. Read the structure of campaings and worlds
     31 * 2. Create the instances of the tree: here _ALL_ StoryEntities are created
     32 *    also if they are not yet used. the worlds should load their data in
     33 *    the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
     34 *    Elsewhere, all the data will be allocated at the beginning... mess...
     35 * 3. StoryEntities are load() and init() before they start
     36 * 4. once the gamloader starts the game there will be a campaing starting a
     37 *    world. this is done by callaing those StoryEntity::start()
    3838*/
    3939class GameLoader : public EventListener
    4040{
    41 
    42 
    4341 public:
    4442  ~GameLoader ();
Note: See TracChangeset for help on using the changeset viewer.