Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3629 in orxonox.OLD


Ignore:
Timestamp:
Mar 22, 2005, 11:15:54 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: some changes in the storyentity framework: added a preLoad() function, since there is some stuff to be initialized before load(). written some comments to level loading doxygen stuff. now the worldinterface works

Location:
orxonox/trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/game_loader.cc

    r3433 r3629  
    8686  switch(campaignID)
    8787    {
    88       // Debug Level 0: Debug level used to test the base frame work.
     88      /*
     89         Debug Level 0: Debug level used to test the base frame work.
     90         As you can see, all storyentity data is allocated before game
     91         start. the storyentity will load themselfs shortly before start
     92         through the StoryEntity::init() funtion.
     93      */
    8994    case DEBUG_CAMPAIGN_0:
    9095      {
  • orxonox/trunk/src/game_loader.h

    r3608 r3629  
     1/*!
     2    \file game_loader.h
     3    \brief loads campaigns, worlds and all other story_entities
     4*/
     5
    16#ifndef _GAME_LOADER_H
    27#define _GAME_LOADER_H
     
    1419class CammandNode;
    1520
     21//! The GameLoader
     22/**
     23   The game loader loads all game date. this is performed in the following way:
     24   1. Read the structure of campaings and worlds
     25   2. Create the instances of the tree: here _ALL_ StoryEntities are created
     26      also if they are not yet used. the worlds should load their data in
     27      the StoryEntity::load() and StoryEntity::init() functions! NOWHERE ELSE!
     28      Elsewhere, all the data will be allocated at the beginning... mess...
     29   3. StoryEntities are load() and init() before they start
     30   4. once the gamloader starts the game there will be a campaing starting a
     31      world. this is done by callaing those StoryEntity::start()
     32*/
    1633class GameLoader
    1734{
  • orxonox/trunk/src/story_entities/campaign.cc

    r3608 r3629  
    1818
    1919#include "campaign.h"
     20
     21#include "story_entity.h"
     22
    2023#include "world.h"
    2124#include "camera.h"
    22 //#include "story_entity.h"
     25
    2326#include "list.h"
    2427
     
    3134  this->isInit = false;
    3235}
     36
    3337
    3438Campaign::~Campaign () {}
     
    5963    {
    6064      se->displayLoadScreen();
     65      se->preLoad();
    6166      se->load();
    6267      se->init();
  • orxonox/trunk/src/story_entities/story_entity.cc

    r3472 r3629  
    7272
    7373
     74/**
     75   \brief stuff that will have to be initialized before load
     76
     77   this gives all storyentities the possibility to init stuff before the
     78   load function, where all the stuff is been made ready for start
     79*/
     80ErrorMessage StoryEntity::preLoad()
     81{}
     82
     83/**
     84    \brief loads the current entity
     85
     86    this is here to enable you loading maps into the entities. for all other actions you
     87    should take the init() function.
     88    load() is exec before init()
     89*/
     90ErrorMessage StoryEntity::load()
     91{}
     92
     93
    7494/**
    7595    \brief initialize the entity before use.
     
    7898    After execution of this function, the Entity is ready to be played/executed,
    7999    this shifts the initialisation work before the execution - very important...
     100    init() is exec shortly before start()
    80101*/
    81102ErrorMessage StoryEntity::init()
    82103{}
    83104
    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 */
    91 ErrorMessage StoryEntity::load()
    92 {}
    93105
    94106/**
  • orxonox/trunk/src/story_entities/story_entity.h

    r3608 r3629  
    2323  bool isPaused; //! is true if the entity is paused
    2424
     25  virtual ErrorMessage preLoad();
    2526  virtual ErrorMessage load();
    2627  virtual ErrorMessage init();
  • orxonox/trunk/src/story_entities/world.cc

    r3621 r3629  
    8989{
    9090  this->worldReference = world;
    91   if( world!= NULL)
     91  if( world != NULL)
    9292    {
    9393      this->worldIsInitialized = true;
     
    128128World::World (int worldID)
    129129{
     130  printf(">>>>>>>>>>>>>>>>>WORLD::WORLD called NEW WORLD created\n");
    130131  this->init(NULL, worldID);
    131132}
     
    153154
    154155/**
    155    \brief initializes a new World
     156   \brief initializes the world.
     157
     158   set all stuff here that is world generic and does not use to much memory
     159   because the real init() function StoryEntity::init() will be called
     160   shortly before start of the game. 
     161   since all worlds are initiated/referenced before they will be started.
     162   NO LEVEL LOADING HERE - NEVER!
    156163*/
    157164void World::init(char* name, int worldID)
     
    159166  this->setClassName ("World");
    160167
    161 
    162   this->worldName = name;
     168  this->worldName = "Just a test level";
    163169  this->debugWorldNr = worldID;
    164170  this->entities = new tList<WorldEntity>();
    165 
     171}
     172
     173
     174/**
     175   \brief this is executed before load
     176
     177   since the load function sometimes needs data, that has been init before
     178   the load and after the proceeding storyentity has finished
     179*/
     180ErrorMessage World::preLoad()
     181{
    166182  /* init the world interface */
    167183  WorldInterface* wi = WorldInterface::getInstance();
     
    391407}
    392408
    393 /**
    394    \brief initializes a new World
     409
     410/**
     411   \brief initializes a new World shortly before start
     412
     413   this is the function, that will be loaded shortly before the world is
     414   started
    395415*/
    396416ErrorMessage World::init()
     
    400420  cn->addToWorld(this);
    401421  cn->enable(true);
    402 
    403422}
    404423
  • orxonox/trunk/src/story_entities/world.h

    r3620 r3629  
    6262
    6363  /* classes from story-entity */
     64  virtual ErrorMessage preLoad();
    6465  virtual ErrorMessage load ();
    6566  virtual ErrorMessage init ();
  • orxonox/trunk/src/world_entities/projectile.cc

    r3618 r3629  
    4242Projectile::~Projectile ()
    4343{
    44 
     44  /*
     45     do not delete the test projectModel, since it is pnode
     46     and will be cleaned out by world
     47  */
     48  //delete this->projectileModel;
    4549}
    4650
     
    7882  this->getAbsDir().matrix (matrix);
    7983  glMultMatrixf((float*)matrix); 
    80   this->model->draw();
     84  //this->model->draw();
     85  PRINTF(1)("draw draw draw draw draw draw \n");
     86  this->projectileModel->draw();
    8187
    8288  glPopMatrix();
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3620 r3629  
    2525
    2626#include "vector.h"
     27#include "list.h"
    2728
    2829using namespace std;
     
    7778{
    7879  printf("TestGun::fire() - firing weapon now ---------------------------\n");
    79   //this->myWorld;
     80  //WorldEntity* pj = new Projectile();
     81  //this->worldEntities->add(pj);
    8082}
    8183
  • orxonox/trunk/src/world_entities/weapon.h

    r3620 r3629  
    6969  virtual void draw(void);
    7070
     71 protected:
     72  tList<WorldEntity>* worldEntities;
    7173
    7274 private:
     
    7678  Projectile* projectile;
    7779  //WeaponSound sound;
    78   tList<WorldEntity>* worldEntities;
    79 
    8080};
    8181
Note: See TracChangeset for help on using the changeset viewer.