Changeset 4002 in orxonox.OLD for orxonox/branches/ll2trunktemp
- Timestamp:
- Apr 28, 2005, 1:06:09 AM (20 years ago)
- Location:
- orxonox/branches/ll2trunktemp/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/ll2trunktemp/src/world_entities/player.cc
r3998 r4002 82 82 \todo add more parameters to load 83 83 */ 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>(); 84 Player::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>(); 119 120 this->activeWeapon = NULL; 120 121 /* -
orxonox/branches/ll2trunktemp/src/world_entities/world_entity.cc
r3832 r4002 38 38 class. So if you want to create a new entity at any time, call World::spawn(). It will handle everything that is necessary. 39 39 */ 40 WorldEntity::WorldEntity ( bool isFree) : bFree(isFree)40 WorldEntity::WorldEntity () 41 41 { 42 42 this->setClassName ("WorldEntity"); … … 46 46 } 47 47 48 WorldEntity::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 48 86 /** 49 87 \brief standard destructor … … 73 111 {} 74 112 75 76 /**77 \brief query whether the WorldEntity in question is free78 \return true if the WorldEntity is free or false if it isn't79 */80 bool WorldEntity::isFree ()81 {82 return bFree;83 }84 113 85 114 /** -
orxonox/branches/ll2trunktemp/src/world_entities/world_entity.h
r3799 r4002 23 23 24 24 public: 25 WorldEntity (bool isFree = false); 25 WorldEntity (void); 26 WorldEntity(TiXmlElement* root); 26 27 virtual ~WorldEntity (); 27 28 … … 32 33 //void removeAbility(Ability* ability); 33 34 void setDrawable (bool bDraw); 34 bool isFree ();35 35 void setCharacterAttributes(CharacterAttributes* charAttr); 36 36 CharacterAttributes* getCharacterAttributes(); … … 52 52 53 53 private: 54 const bool bFree; //!< If the entity is free.55 54 bool bCollide; //!< If it should be considered for the collisiontest. 56 55 bool bDraw; //!< If it should be visible.
Note: See TracChangeset
for help on using the changeset viewer.