Changeset 4010 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- May 2, 2005, 3:14:57 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/player.cc
r4000 r4010 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 31 29 32 30 using namespace std; 31 32 CREATE_FACTORY(Player); 33 33 34 34 /** … … 74 74 } 75 75 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 */ 82 Player::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 } 76 140 77 141 /** -
orxonox/trunk/src/world_entities/player.h
r3873 r4010 22 22 public: 23 23 Player(); 24 Player(TiXmlElement* root); 24 25 virtual ~Player(); 25 26 -
orxonox/trunk/src/world_entities/skybox.cc
r3913 r4010 28 28 29 29 #include "skybox.h" 30 30 31 #include "stdincl.h" 32 #include "factory.h" 31 33 32 34 #include "material.h" … … 36 38 //#include "world_entity.h" 37 39 40 CREATE_FACTORY(SkyBox); 38 41 39 42 using namespace std; … … 44 47 */ 45 48 SkyBox::SkyBox(char* fileName) 49 { 50 this->init(); 51 } 52 53 SkyBox::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 77 void SkyBox::init(void) 46 78 { 47 79 this->setClassName("SkyBox"); -
orxonox/trunk/src/world_entities/skybox.h
r3807 r4010 22 22 public: 23 23 SkyBox(char* fileName = NULL); 24 SkyBox(TiXmlElement* root); 25 24 26 virtual ~SkyBox(); 27 28 void init(void); 25 29 26 30 void setSize(float size); -
orxonox/trunk/src/world_entities/world_entity.cc
r3832 r4010 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/trunk/src/world_entities/world_entity.h
r3799 r4010 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.