Changeset 3620 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Mar 21, 2005, 5:37:58 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/player.cc
r3618 r3620 20 20 #include "player.h" 21 21 22 #include "track_manager.h" 23 #include "objModel.h" 24 #include "weapon.h" 25 #include "test_gun.h" 26 #include "world.h" 27 28 #include "list.h" 22 29 #include "stdincl.h" 23 //#include "collision.h"24 #include "objModel.h"25 #include "list.h"26 #include "weapon.h"27 #include "track_manager.h"28 30 29 31 using namespace std; … … 33 35 \param isFree if the player is free 34 36 */ 35 Player::Player(bool isFree) : WorldEntity(isFree) 36 { 37 this->model = new OBJModel("../data/models/reaplow.obj"); 37 Player::Player() : WorldEntity() 38 { 38 39 this->weapons = new tList<Weapon>(); 39 40 this->activeWeapon = NULL; 40 41 /* 42 this is the debug player - actualy we would have to make a new 43 class derivated from Player for each player. for now, we just use 44 the player.cc for debug also 45 */ 46 this->model = new OBJModel("../data/models/reaplow.obj"); 41 47 travelSpeed = 15.0; 42 48 velocity = new Vector(); … … 44 50 bFire = false; 45 51 acceleration = 10.0; 52 //weapons: 53 Weapon* wp = new TestGun(); 54 this->weapons->add(wp); 55 this->activeWeapon = wp; 46 56 } 47 57 … … 51 61 Player::~Player () 52 62 { 53 Weapon* w = this->weapons->enumerate(); 54 while( w != NULL) 55 { 56 delete w; 57 w = this->weapons->nextElement(); 58 } 63 /* do not delete the weapons, they are contained in the pnode tree 64 and will be deleted there. 65 this only frees the memory allocated to save the list. 66 */ 59 67 delete this->weapons; 60 61 //delete this->velocity;62 68 } 63 69 … … 150 156 { 151 157 // player controlled movement 152 this->move 158 this->move(time); 153 159 // weapon system manipulation 154 this-> fire();160 this->weapon(); 155 161 } 156 162 … … 190 196 \brief weapon manipulation by the player 191 197 */ 192 void Player:: fire()198 void Player::weapon() 193 199 { 194 200 if( this->bFire) -
orxonox/trunk/src/world_entities/player.h
r3608 r3620 13 13 class Weapon; 14 14 class Vector; 15 class World; 15 16 16 17 //! Basic controllable WorldEntity … … 20 21 21 22 public: 22 Player( bool isFree = false);23 Player(); 23 24 virtual ~Player(); 24 25 … … 48 49 tList<Weapon>* weapons;//!< a list of weapon 49 50 Weapon* activeWeapon; //!< the weapon that is currenty activated 51 World* myWorld; //!< reference to the world object 50 52 51 53 Vector* velocity; //!< the velocity of the player. … … 54 56 55 57 void move(float time); 56 void fire(void);58 void weapon(void); 57 59 58 60 }; -
orxonox/trunk/src/world_entities/test_gun.cc
r3618 r3620 75 75 */ 76 76 void TestGun::fire() 77 {} 77 { 78 printf("TestGun::fire() - firing weapon now ---------------------------\n"); 79 //this->myWorld; 80 } 78 81 79 82 -
orxonox/trunk/src/world_entities/weapon.cc
r3583 r3620 23 23 #include "objModel.h" 24 24 #include "projectile.h" 25 #include "list.h" 26 #include "world.h" 25 27 26 28 using namespace std; … … 33 35 */ 34 36 Weapon::Weapon () : WorldEntity() 35 {} 37 { 38 WorldInterface* wi = WorldInterface::getInstance(); 39 this->worldEntities = wi->getEntityList(); 40 } 36 41 37 42 … … 174 179 */ 175 180 void Weapon::fire() 176 {} 181 { 182 183 } 177 184 178 185 -
orxonox/trunk/src/world_entities/weapon.h
r3618 r3620 76 76 Projectile* projectile; 77 77 //WeaponSound sound; 78 tList<WorldEntity>* worldEntities; 78 79 79 80 };
Note: See TracChangeset
for help on using the changeset viewer.