Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4002 in orxonox.OLD for orxonox/branches/ll2trunktemp/src


Ignore:
Timestamp:
Apr 28, 2005, 1:06:09 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/ll2trunktemp: now WorldEntity loads model property

Location:
orxonox/branches/ll2trunktemp/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/ll2trunktemp/src/world_entities/player.cc

    r3998 r4002  
    8282   \todo add more parameters to load
    8383*/
    84 Player::Player(TiXmlElement* root)
    85 {
    86         char* temp;
    87         const char* string;
    88         string = grabParameter( root, "name");
    89         if( string == NULL)
    90         {
    91                 PRINTF0("Player is missing a proper 'name'\n");
    92                 string = "Unknown";
    93                 temp = new char[strlen(string + 2)];
    94                 strcpy( temp, string);
    95                 this->setName( temp);
    96         }
    97         else
    98         {
    99                 temp = new char[strlen(string + 2)];
    100                 strcpy( temp, string);
    101                 this->setName( temp);
    102         }
    103        
    104         this->model = NULL;
    105         string = grabParameter( root, "model");
    106         if( string != NULL)
    107         this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
    108         else
    109         {
    110                 PRINTF0("Player is missing a proper 'model'\n");
    111         this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
    112         }
    113         if( this->model == NULL)
    114         {
    115                 PRINTF0("Player model '%s' could not be loaded\n", string);
    116         }
    117        
    118         this->weapons = new tList<Weapon>();
     84Player::Player(TiXmlElement* root) : WorldEntity(root)
     85{
     86  /*
     87    char* temp;
     88    const char* string;
     89    string = grabParameter( root, "name");
     90    if( string == NULL)
     91    {
     92    PRINTF0("Player is missing a proper 'name'\n");
     93    string = "Unknown";
     94    temp = new char[strlen(string + 2)];
     95    strcpy( temp, string);
     96    this->setName( temp);
     97    }
     98    else
     99    {
     100    temp = new char[strlen(string + 2)];
     101    strcpy( temp, string);
     102    this->setName( temp);
     103    }
     104   
     105    this->model = NULL;
     106    string = grabParameter( root, "model");
     107    if( string != NULL)
     108    this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
     109    else
     110    {
     111    PRINTF0("Player is missing a proper 'model'\n");
     112    this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
     113    }
     114    if( this->model == NULL)
     115    {
     116    PRINTF0("Player model '%s' could not be loaded\n", string);
     117    }
     118  */
     119  this->weapons = new tList<Weapon>();
    119120  this->activeWeapon = NULL;
    120121  /*
  • orxonox/branches/ll2trunktemp/src/world_entities/world_entity.cc

    r3832 r4002  
    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/branches/ll2trunktemp/src/world_entities/world_entity.h

    r3799 r4002  
    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.