Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4010 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
May 2, 2005, 3:14:57 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the levelloader from lltrunktemp to the trunk. Big thanks to fuzzy to make this so easy for us, and for implementing it in the first place.

Location:
orxonox/trunk/src/world_entities
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/player.cc

    r4000 r4010  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    3129
    3230using namespace std;
     31
     32CREATE_FACTORY(Player);
    3333
    3434/**
     
    7474}
    7575
     76/**
     77   \brief creates a new Player from Xml Data
     78   \param root the xml element containing player data
     79   
     80   \todo add more parameters to load
     81*/
     82Player::Player(TiXmlElement* root) : WorldEntity(root)
     83{
     84  /*
     85    char* temp;
     86    const char* string;
     87    string = grabParameter( root, "name");
     88    if( string == NULL)
     89    {
     90    PRINTF0("Player is missing a proper 'name'\n");
     91    string = "Unknown";
     92    temp = new char[strlen(string + 2)];
     93    strcpy( temp, string);
     94    this->setName( temp);
     95    }
     96    else
     97    {
     98    temp = new char[strlen(string + 2)];
     99    strcpy( temp, string);
     100    this->setName( temp);
     101    }
     102   
     103    this->model = NULL;
     104    string = grabParameter( root, "model");
     105    if( string != NULL)
     106    this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
     107    else
     108    {
     109    PRINTF0("Player is missing a proper 'model'\n");
     110    this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
     111    }
     112    if( this->model == NULL)
     113    {
     114    PRINTF0("Player model '%s' could not be loaded\n", string);
     115    }
     116  */
     117  this->weapons = new tList<Weapon>();
     118  this->activeWeapon = NULL;
     119  /*
     120    this is the debug player - actualy we would have to make a new
     121     class derivated from Player for each player. for now, we just use
     122     the player.cc for debug also
     123  */
     124  travelSpeed = 15.0;
     125  velocity = new Vector();
     126  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
     127  bFire = false;
     128  this->bWeaponChange = false;
     129  acceleration = 10.0;
     130  //weapons:
     131  this->weaponMan = new WeaponManager();
     132  Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
     133  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
     134 
     135  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
     136  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
     137  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
     138  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
     139}
    76140
    77141/**
  • orxonox/trunk/src/world_entities/player.h

    r3873 r4010  
    2222 public:
    2323  Player();
     24  Player(TiXmlElement* root);
    2425  virtual ~Player();
    2526
  • orxonox/trunk/src/world_entities/skybox.cc

    r3913 r4010  
    2828
    2929#include "skybox.h"
     30
    3031#include "stdincl.h"
     32#include "factory.h"
    3133
    3234#include "material.h"
     
    3638//#include "world_entity.h"
    3739
     40CREATE_FACTORY(SkyBox);
    3841
    3942using namespace std;
     
    4447*/
    4548SkyBox::SkyBox(char* fileName)
     49{
     50  this->init();
     51}
     52
     53SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root)
     54{
     55  this->init();
     56
     57  // Name Setup
     58  char* temp;
     59  const char* string;
     60
     61  // Model Loading     
     62  this->model = NULL;
     63  string = grabParameter( root, "materialset");
     64  if( string != NULL)
     65    this->setTexture(string, "jpg");
     66  else
     67    {
     68      PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n");
     69      this->model = (Model*)ResourceManager::getInstance()->load("cube", OBJ, RP_CAMPAIGN);
     70    }
     71  if( this->model == NULL)
     72    {
     73      PRINTF(0)("SkyBox model '%s' could not be loaded\n", string);
     74    }
     75}
     76
     77void SkyBox::init(void)
    4678{
    4779  this->setClassName("SkyBox");
  • orxonox/trunk/src/world_entities/skybox.h

    r3807 r4010  
    2222 public:
    2323  SkyBox(char* fileName = NULL);
     24  SkyBox(TiXmlElement* root);
     25
    2426  virtual ~SkyBox();
     27
     28  void init(void);
    2529
    2630  void setSize(float size);
  • orxonox/trunk/src/world_entities/world_entity.cc

    r3832 r4010  
    3838   class. So if you want to create a new entity at any time, call World::spawn(). It will handle everything that is necessary.
    3939*/
    40 WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
     40WorldEntity::WorldEntity ()
    4141{
    4242  this->setClassName ("WorldEntity");
     
    4646}
    4747
     48WorldEntity::WorldEntity(TiXmlElement* root)
     49{
     50  // Name Setup
     51  char* temp;
     52  const char* string;
     53  string = grabParameter( root, "name");
     54  if( string == NULL)
     55    {
     56      PRINTF(0)("WorldEntity is missing a proper 'name'\n");
     57      string = "Unknown";
     58      temp = new char[strlen(string + 2)];
     59      strcpy( temp, string);
     60      this->setName( temp);
     61    }
     62  else
     63    {
     64      temp = new char[strlen(string + 2)];
     65      strcpy( temp, string);
     66      this->setName( temp);
     67    }
     68  // Model Loading     
     69  this->model = NULL;
     70  string = grabParameter( root, "model");
     71  if( string != NULL)
     72    this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
     73  else
     74    {
     75      PRINTF(0)("WorldEntity is missing a proper 'model'\n");
     76      this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
     77    }
     78  if( this->model == NULL)
     79    {
     80      PRINTF(0)("WorldEntity model '%s' could not be loaded\n", string);
     81    }
     82
     83  this->bDraw = true;
     84}
     85
    4886/**
    4987   \brief standard destructor
     
    73111{}
    74112
    75 
    76 /**
    77    \brief query whether the WorldEntity in question is free
    78    \return true if the WorldEntity is free or false if it isn't
    79 */
    80 bool WorldEntity::isFree ()
    81 {
    82   return bFree;
    83 }
    84113
    85114/**
  • orxonox/trunk/src/world_entities/world_entity.h

    r3799 r4010  
    2323
    2424 public:
    25   WorldEntity (bool isFree = false);
     25  WorldEntity (void);
     26  WorldEntity(TiXmlElement* root);
    2627  virtual ~WorldEntity ();
    2728
     
    3233  //void removeAbility(Ability* ability);
    3334  void setDrawable (bool bDraw); 
    34   bool isFree ();
    3535  void setCharacterAttributes(CharacterAttributes* charAttr);
    3636  CharacterAttributes* getCharacterAttributes();
     
    5252 
    5353 private:
    54   const bool bFree;                   //!< If the entity is free.
    5554  bool bCollide;                      //!< If it should be considered for the collisiontest.
    5655  bool bDraw;                         //!< If it should be visible.
Note: See TracChangeset for help on using the changeset viewer.