Changeset 3940 in orxonox.OLD for orxonox/branches/ll2trunktemp/src/world_entities
- Timestamp:
- Apr 23, 2005, 11:37:25 AM (20 years ago)
- Location:
- orxonox/branches/ll2trunktemp/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/ll2trunktemp/src/world_entities/player.cc
r3881 r3940 31 31 32 32 using namespace std; 33 34 CREATE_FACTORY(Player); 33 35 34 36 /** … … 74 76 } 75 77 78 /** 79 \brief creates a new Player from Xml Data 80 \param root the xml element containing player data 81 82 \todo add more parameters to load 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>(); 119 this->activeWeapon = NULL; 120 /* 121 this is the debug player - actualy we would have to make a new 122 class derivated from Player for each player. for now, we just use 123 the player.cc for debug also 124 */ 125 travelSpeed = 15.0; 126 velocity = new Vector(); 127 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 128 bFire = false; 129 acceleration = 10.0; 130 //weapons: 131 Weapon* wp = new TestGun(this, Vector(-1.1, 0.0, 2.6), Quaternion(), 0); 132 this->weapons->add(wp); 133 this->activeWeapon = wp; 134 } 76 135 77 136 /** -
orxonox/branches/ll2trunktemp/src/world_entities/player.h
r3873 r3940 22 22 public: 23 23 Player(); 24 Player(TiXmlElement* root); 24 25 virtual ~Player(); 25 26
Note: See TracChangeset
for help on using the changeset viewer.