- Timestamp:
- Jun 10, 2005, 7:17:22 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/defs/class_list.h
r4591 r4592 27 27 28 28 29 #define ClassDefinition(CLASS_DEFINITION, CLASS_VALUE, CLASS_NAME) \ 30 CLASS_DEFINITION 31 29 32 //! list of all classes to be loadable in via the ObjectManager 30 33 /** … … 45 48 CL_MASK_SUPERCLASS = 0xff000000, 46 49 CL_BASE_OBJECT = 0x01000000, 50 47 51 CL_PARENT_NODE = 0x02000000, 48 52 CL_WORLD_ENTITY = 0x04000000, 53 49 54 CL_STORY_ENTITY = 0x08000000, 50 55 56 CL_PHYSICS_INTERFACE = 0x10000000, 57 58 CL_EVENT_LISTENER = 0x20000000, 59 51 60 // subsuper-classes 61 CL_MASK_SUBCLASS = 0x00fff000, 52 62 CL_PLAYER = 0x00001000, 53 63 CL_NPC = 0x00002000, … … 57 67 CL_WEAPON = 0x00020000, 58 68 59 69 // lowest level classes 70 CL_MASK_LOWLEVEL_CLASS = 0x00000fff, 60 71 // singleton classes (range from 0x00000001 to 0x000000ff) 61 72 CL_MASK_SINGLETON = 0x0000003f, … … 118 129 119 130 CL_EVENT, 120 CL_EVENT_LISTENER,121 131 CL_KEY_MAPPER, 122 132 -
orxonox/trunk/src/lib/coord/p_node.cc
r4575 r4592 101 101 void PNode::init(PNode* parent) 102 102 { 103 this->setClassID(CL_PARENT_NODE); 103 104 this->children = new tList<PNode>(); 104 105 this->bRelCoorChanged = true; -
orxonox/trunk/src/lib/lang/base_object.cc
r4591 r4592 78 78 void BaseObject::setClassID (long classID) 79 79 { 80 this->classID = classID;80 this->classID |= classID; 81 81 } 82 82 … … 91 91 } 92 92 93 94 /*95 \brief sets the class identifiers96 \param a number for the class from class_list.h enumeration97 \param the class name98 99 bool BaseObject::isA (char* className)100 {101 if( this->className == className)102 return false;103 return true;104 }105 */106 107 93 /** 108 94 \brief set the name of the Object 109 95 */ 110 void BaseObject::setName (const char* objectName)96 void BaseObject::setName (const char* objectName) 111 97 { 112 98 if (this->objectName) 113 99 delete []this->objectName; 114 100 if (objectName) 115 116 117 118 101 { 102 this->objectName = new char[strlen(objectName)+1]; 103 strcpy(this->objectName, objectName); 104 } 119 105 else 120 106 this->objectName = NULL; 121 107 } 108 109 110 /** 111 \brief checks if the class is a classID 112 \param classID the Identifier to check for 113 \returns true if it is, false otherwise 114 */ 115 bool BaseObject::isA (ClassID classID) 116 { 117 if( this->classID & classID) 118 return true; 119 return false; 120 } 121 122 /** 123 * @brief displays everything this class is 124 */ 125 void BaseObject::whatIs(void) const 126 { 127 PRINT(0)("object %s: ", this->getName() ); 128 if (this->classID & CL_MASK_SUPERCLASS) 129 { 130 PRINT(0)("is a derived Class from: \n"); 131 if (this->classID & CL_BASE_OBJECT) 132 PRINT(0)("BaseObject, "); 133 if (this->classID & CL_PARENT_NODE) 134 PRINT(0)("ParentNode, "); 135 if (this->classID & CL_WORLD_ENTITY) 136 PRINT(0)("WorldEntity, "); 137 if (this->classID & CL_PHYSICS_INTERFACE) 138 PRINT(0)("PhysicsInterface, "); 139 if (this->classID & CL_EVENT_LISTENER) 140 PRINT(0)("EventListener, "); 141 if (this->classID & CL_STORY_ENTITY) 142 PRINT(0)("StoryEntity, "); 143 } 144 printf("\n"); 145 } -
orxonox/trunk/src/lib/lang/base_object.h
r4591 r4592 37 37 inline int getClassID(void) const { return this->classID; } 38 38 39 // bool isA (char* className); 39 bool isA (ClassID classID); 40 void whatIs(void) const; 40 41 41 42 /** \returns if the object is finalized */ -
orxonox/trunk/src/story_entities/story_entity.cc
r3629 r4592 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: 15 co-programmer: 16 16 */ 17 17 … … 24 24 25 25 26 StoryEntity::StoryEntity () {} 26 StoryEntity::StoryEntity () 27 { 28 this->setClassID(CL_STORY_ENTITY); 29 } 27 30 StoryEntity::~StoryEntity () {} 28 31 29 32 30 /** 33 /** 31 34 \brief sets the story ID 32 35 33 sets the story id of the current entity, this enables it to be identified in a 36 sets the story id of the current entity, this enables it to be identified in a 34 37 global context. 35 38 */ … … 40 43 41 44 42 /** 45 /** 43 46 \brief this reads the story id of the current entity 44 47 \returns the story entity id … … 50 53 51 54 52 /** 55 /** 53 56 \brief sets the id of the next story entity 54 57 55 58 StoryEntities can choose their following entity themselfs. the entity id defined here 56 59 will be startet after this entity ends. this can be convenient if you want to have a … … 62 65 } 63 66 64 /** 67 /** 65 68 \brief gets the story id of the current entity 66 69 \returns story id … … 81 84 {} 82 85 83 /** 86 /** 84 87 \brief loads the current entity 85 88 … … 92 95 93 96 94 /** 95 \brief initialize the entity before use. 97 /** 98 \brief initialize the entity before use. 96 99 \returns an error code if not able to apply. 97 100 98 After execution of this function, the Entity is ready to be played/executed, 101 After execution of this function, the Entity is ready to be played/executed, 99 102 this shifts the initialisation work before the execution - very important... 100 103 init() is exec shortly before start() … … 104 107 105 108 106 /** 109 /** 107 110 \brief starts the entity with the choosen id. only for entities with lists. 108 111 \param story id … … 118 121 119 122 120 /** 123 /** 121 124 \brief starts the current entity 122 \returns error code if this action has caused a error 125 \returns error code if this action has caused a error 123 126 */ 124 127 ErrorMessage StoryEntity::start() … … 126 129 127 130 128 /** 131 /** 129 132 \brief pause the current entity 130 133 \returns error code if this action has caused a error … … 136 139 137 140 138 /** 141 /** 139 142 \brief resumes a pause 140 143 \returns error code if this action has caused a error … … 146 149 147 150 148 /** 151 /** 149 152 \brief stops the current entity 150 153 \returns error code if this action has caused a error … … 160 163 161 164 162 /** 163 \brief destroys and cleans up the current entity. 165 /** 166 \brief destroys and cleans up the current entity. 164 167 165 this cleans up ressources before the deconstructor is called. for terminating 168 this cleans up ressources before the deconstructor is called. for terminating 166 169 the entity please use the stop() function. 167 170 */ … … 170 173 171 174 172 /** 175 /** 173 176 \brief this displays the load screen 174 177 175 it will need some time to load maps or things like that. to inform the user about 178 it will need some time to load maps or things like that. to inform the user about 176 179 progress and to just show him/her something for the eyes, put here this stuff 177 180 */ … … 180 183 181 184 182 /** 185 /** 183 186 \brief undisplay the load screen 184 187 -
orxonox/trunk/src/story_entities/world.cc
r4574 r4592 520 520 new PhysicsConnection(testEntity, gravity); 521 521 522 522 // printing out some debug stuff 523 523 NullParent::getInstance()->debug(0); 524 this->localPlayer->whatIs(); 525 this->whatIs(); 524 526 } 525 527 -
orxonox/trunk/src/util/garbage_collector.cc
r4519 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 33 33 \brief standard constructor 34 34 */ 35 GarbageCollector::GarbageCollector () 35 GarbageCollector::GarbageCollector () 36 36 { 37 37 this->setClassID(CL_GARBAGE_COLLECTOR, "GarbageCollector"); … … 44 44 \brief standard deconstructor 45 45 */ 46 GarbageCollector::~GarbageCollector () 46 GarbageCollector::~GarbageCollector () 47 47 { 48 48 // delete what has to be deleted here … … 52 52 \brief this sets the collection delay 53 53 \param delay: the delay 54 54 55 55 after this delay, the garbage collector starts its work and begins to collect unused object 56 56 to delete them afterwards. only objects in the worldentity list from the world object are lookded 57 at. 57 at. 58 58 */ 59 59 void GarbageCollector::setCollectionDelay(float delay) … … 107 107 tIterator<WorldEntity>* iterator = list->getIterator(); 108 108 WorldEntity* entity = iterator->nextElement(); 109 while( entity != NULL) 110 { 109 while( entity != NULL) 110 { 111 111 if( entity->isFinalized()) 112 113 114 115 116 117 118 119 120 121 122 ObjectManager::getInstance()->addToDeadList(entity->getClassID(), entity);123 112 { 113 PRINTF(4)("= finalizing object\n"); 114 ++counter; 115 116 /* first remove out of entity list */ 117 list->remove(entity); 118 /* second remove out of pnode tree */ 119 entity->remove(); 120 /* then finaly delete reference */ 121 //delete entity; 122 ObjectManager::getInstance()->addToDeadList(entity->getClassID() & CL_MASK_LOWLEVEL_CLASS, entity); 123 } 124 124 entity = iterator->nextElement(); 125 125 } -
orxonox/trunk/src/util/loading/load_param.h
r4501 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 14 14 */ 15 15 16 /*! 16 /*! 17 17 \file load_param.h 18 18 \brief A Class and macro-functions, that makes our lives easy to load-in parameters … … 74 74 #define LoadParam1(type1) \ 75 75 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE), bool multi = false) \ 76 : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME) 77 { \ 78 if (loadString != NULL && root != NULL) \ 79 80 else \ 81 76 : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME) \ 77 { \ 78 if (loadString != NULL && root != NULL) \ 79 (*pt2Object.*function)(type1##_FUNC(loadString)); \ 80 else \ 81 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 82 82 } 83 83 … … 94 94 { \ 95 95 if (loadString != NULL && root != NULL) \ 96 97 98 99 100 101 102 103 104 else \ 105 96 { \ 97 SubString subLoads(loadString); \ 98 if (subLoads.getCount() == 2) \ 99 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1))); \ 100 else \ 101 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 102 paramName, pt2Object->getClassName(), 2, subLoads.getCount()); \ 103 } \ 104 else \ 105 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 106 106 } 107 107 … … 119 119 { \ 120 120 if (loadString != NULL && root != NULL) \ 121 122 123 124 125 126 127 128 129 else \ 130 121 { \ 122 SubString subLoads(loadString); \ 123 if (subLoads.getCount() == 3) \ 124 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2))); \ 125 else \ 126 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 127 paramName, pt2Object->getClassName(), 3, subLoads.getCount()); \ 128 } \ 129 else \ 130 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 131 131 } 132 132 … … 145 145 { \ 146 146 if (loadString != NULL && root != NULL) \ 147 148 149 150 151 152 153 154 155 else \ 156 147 { \ 148 SubString subLoads(loadString); \ 149 if (subLoads.getCount() == 4) \ 150 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3))); \ 151 else \ 152 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 153 paramName, pt2Object->getClassName(), 4, subLoads.getCount()); \ 154 } \ 155 else \ 156 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 157 157 } 158 158 … … 172 172 { \ 173 173 if (loadString != NULL && root != NULL) \ 174 175 176 177 178 179 180 181 182 else \ 183 174 { \ 175 SubString subLoads(loadString); \ 176 if (subLoads.getCount() == 5) \ 177 (*pt2Object.*function)(type1##_FUNC(subLoads.getString(0)), type2##_FUNC(subLoads.getString(1)), type3##_FUNC(subLoads.getString(2)), type4##_FUNC(subLoads.getString(3)), type5##_FUNC(subLoads.getString(4))); \ 178 else \ 179 PRINTF(2)("Not loaded Parameter %s of %s, because wrong count of arguments.\n -> Should have %d but have %d\n", \ 180 paramName, pt2Object->getClassName(), 5, subLoads.getCount()); \ 181 } \ 182 else \ 183 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \ 184 184 } 185 185 … … 216 216 static LoadClassDescription* addClass(const char* className); 217 217 LoadParamDescription* addParam(const char* paramName); 218 218 219 219 220 220 static void printAll(const char* fileName = NULL); … … 249 249 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(), bool multi = false) 250 250 : BaseLoadParam(root, pt2Object, paramName, 0, multi, "") 251 { 251 { 252 252 if (loadString != NULL && root != NULL) 253 (*pt2Object.*function)(); 254 else 255 253 (*pt2Object.*function)(); 254 else 255 PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); 256 256 } 257 257 -
orxonox/trunk/src/util/object_manager.cc
r4519 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 26 26 \brief standard constructor 27 27 */ 28 ObjectManager::ObjectManager () 28 ObjectManager::ObjectManager () 29 29 { 30 30 this->setClassID(CL_OBJECT_MANAGER, "ObjectManager"); 31 31 32 32 this->managedObjectList = new tList<BaseObject>*[CL_NUMBER]; 33 33 for(int i = 0; i < CL_NUMBER; ++i) … … 48 48 \brief standard deconstructor 49 49 */ 50 ObjectManager::~ObjectManager () 50 ObjectManager::~ObjectManager () 51 51 { 52 52 ObjectManager::singletonRef = NULL; … … 80 80 this->managedObjectList[index]->remove(obj); 81 81 if( unlikely(obj == NULL)) 82 83 84 82 { 83 PRINTF(0)("Critical: there was no object anymore in the dead list! This could result in Segfaults\n"); 84 } 85 85 return obj; 86 86 } … … 96 96 { 97 97 PRINT(0)("\n==========================| ObjectManager::debug() |===\n"); 98 PRINT(0)("= Number of registerable classes: %i\n", CL_NUMBER ); 98 PRINT(0)("= Number of registerable classes: %i\n", CL_NUMBER ); 99 99 PRINT(0)("= Currently cached objects: \n"); 100 100 for(int i = 0; i < CL_NUMBER; ++i) 101 101 { 102 102 if( this->managedObjectList[i] != NULL) 103 103 PRINT(0)("= o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize()); 104 104 else 105 105 PRINT(0)("= o Class Nr. %i has cached 0 object(s)\n", i); 106 106 } 107 107 PRINT(0)("=======================================================\n"); -
orxonox/trunk/src/world_entities/camera.h
r4490 r4592 1 /*! 1 /*! 2 2 \file camera.h 3 3 \brief Viewpoint controlling class definitions 4 */ 4 */ 5 5 6 6 #ifndef _CAMERA_H … … 16 16 17 17 //! an enumerator for different types of view 18 typedef enum ViewMode{ VIEW_NORMAL, 19 VIEW_BEHIND, 20 VIEW_FRONT, 21 VIEW_LEFT, 22 VIEW_RIGHT, 23 VIEW_TOP }; 18 typedef enum ViewMode 19 { 20 VIEW_NORMAL, 21 VIEW_BEHIND, 22 VIEW_FRONT, 23 VIEW_LEFT, 24 VIEW_RIGHT, 25 VIEW_TOP 26 }; 24 27 25 28 //! Camera … … 59 62 60 63 //! A CameraTarget is where the Camera is looking at. 61 class CameraTarget : public PNode 64 class CameraTarget : public PNode 62 65 { 63 66 friend class Camera; //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it. 64 67 65 68 private: 66 69 CameraTarget(void); 67 70 68 71 public: 69 72 virtual ~CameraTarget(void); -
orxonox/trunk/src/world_entities/player.cc
r4414 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 48 48 the player.cc for debug also 49 49 */ 50 this->setClass Name("Player");50 this->setClassID(CL_PLAYER, "Player"); 51 51 this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 52 52 travelSpeed = 15.0; … … 60 60 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 61 61 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 62 62 63 63 this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0); 64 64 this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1); … … 84 84 \brief creates a new Player from Xml Data 85 85 \param root the xml element containing player data 86 86 87 87 \todo add more parameters to load 88 88 */ 89 89 Player::Player(const TiXmlElement* root) : WorldEntity(root), PhysicsInterface(this) 90 90 { 91 this->setClass Name("Player");91 this->setClassID(CL_PLAYER, "Player"); 92 92 this->weapons = new tList<Weapon>(); 93 93 this->activeWeapon = NULL; … … 107 107 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 108 108 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 109 109 110 110 this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0); 111 111 this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1); … … 162 162 163 163 164 /** 164 /** 165 165 \brief Collision with another Entity has this effect 166 166 \param other the other colider … … 177 177 */ 178 178 void Player::draw () 179 { 179 { 180 180 glMatrixMode(GL_MODELVIEW); 181 181 glPushMatrix(); 182 182 float matrix[4][4]; 183 183 184 184 /* translate */ 185 glTranslatef (this->getAbsCoor ().x, 186 this->getAbsCoor ().y, 187 185 glTranslatef (this->getAbsCoor ().x, 186 this->getAbsCoor ().y, 187 this->getAbsCoor ().z); 188 188 /* rotate */ 189 189 this->getAbsDir ().matrix (matrix); 190 190 glMultMatrixf((float*)matrix); 191 191 192 192 this->model->draw(); 193 193 glPopMatrix(); … … 205 205 //printf("%p\n", this); 206 206 //this->getRelCoor().debug(); 207 207 208 208 /* link tick to weapon */ 209 209 //this->activeWeapon->tick(time); … … 236 236 accel = accel -(direction*acceleration); 237 237 if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2) 238 accel = accel - (orthDirection*acceleration); 238 accel = accel - (orthDirection*acceleration); 239 239 if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2) 240 240 accel = accel + (orthDirection*acceleration); -
orxonox/trunk/src/world_entities/test_gun.cc
r4504 r4592 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 13 13 ### File Specific 14 14 main-programmer: Patrick Boenzli 15 co-programmer: 15 co-programmer: 16 16 17 17 … … 43 43 creates a new weapon 44 44 */ 45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 46 : Weapon (parent, coordinate, direction) 45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 46 : Weapon (parent, coordinate, direction) 47 47 { 48 48 this->setClassID(CL_TEST_GUN, "TestGun"); … … 65 65 this->projectileOffset = Vector(1.0, 0.0, -0.35); 66 66 67 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 67 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 68 68 this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 69 69 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 70 70 71 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 71 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 72 72 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 73 73 74 74 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 75 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 75 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 76 76 } 77 77 else if( this->leftRight == W_RIGHT) … … 80 80 81 81 this->objectComponent1->setRelCoor(Vector(0,0,0.35)); 82 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 82 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 83 83 this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 84 84 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 85 85 86 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 86 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 87 87 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 88 88 89 89 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 90 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 90 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 91 91 } 92 92 93 93 this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV); 94 94 this->weaponSource = new SoundSource(this->fireSound, this); … … 103 103 \brief standard deconstructor 104 104 */ 105 TestGun::~TestGun () 105 TestGun::~TestGun () 106 106 { 107 107 // model will be deleted from WorldEntity-destructor … … 112 112 \brief this activates the weapon 113 113 114 This is needed, since there can be more than one weapon on a ship. the 115 activation can be connected with an animation. for example the weapon is 116 been armed out. 114 This is needed, since there can be more than one weapon on a ship. the 115 activation can be connected with an animation. for example the weapon is 116 been armed out. 117 117 */ 118 118 void TestGun::activate() … … 125 125 \brief this deactivates the weapon 126 126 127 This is needed, since there can be more than one weapon on a ship. the 128 activation can be connected with an animation. for example the weapon is 127 This is needed, since there can be more than one weapon on a ship. the 128 activation can be connected with an animation. for example the weapon is 129 129 been armed out. 130 130 */ … … 137 137 /** 138 138 \brief fires the weapon 139 139 140 140 this is called from the player.cc, when fire-button is been pushed 141 141 \todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent … … 149 149 } 150 150 151 Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET ));151 Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS)); 152 152 weaponSource->play(); 153 153 … … 157 157 this->worldEntities->add(pj); 158 158 this->localTime = 0; 159 159 160 160 this->animation1->replay(); 161 161 } … … 170 170 can destroy the weapons of enemies or vice versa. 171 171 */ 172 void TestGun::hit (WorldEntity* entity, Vector* position) 172 void TestGun::hit (WorldEntity* entity, Vector* position) 173 173 {} 174 174 … … 180 180 hit, it can also be destoryed. 181 181 */ 182 void TestGun::destroy () 182 void TestGun::destroy () 183 183 {} 184 184 … … 187 187 \brief tick signal for time dependent/driven stuff 188 188 */ 189 void TestGun::tick (float time) 189 void TestGun::tick (float time) 190 190 { 191 191 this->localTime += time; … … 203 203 \brief this will draw the weapon 204 204 */ 205 void TestGun::draw () 205 void TestGun::draw () 206 206 { 207 207 /* draw gun body */ … … 209 209 glPushMatrix(); 210 210 float matrix[4][4]; 211 glTranslatef (this->getAbsCoor ().x, 212 this->getAbsCoor ().y, 213 this->getAbsCoor ().z); 211 glTranslatef (this->getAbsCoor ().x, 212 this->getAbsCoor ().y, 213 this->getAbsCoor ().z); 214 214 this->getAbsDir ().matrix (matrix); 215 215 glMultMatrixf((float*)matrix); … … 222 222 glMatrixMode(GL_MODELVIEW); 223 223 glPushMatrix(); 224 glTranslatef (this->objectComponent1->getAbsCoor ().x, 225 this->objectComponent1->getAbsCoor ().y, 226 224 glTranslatef (this->objectComponent1->getAbsCoor ().x, 225 this->objectComponent1->getAbsCoor ().y, 226 this->objectComponent1->getAbsCoor ().z); 227 227 this->objectComponent1->getAbsDir ().matrix (matrix); 228 228 glMultMatrixf((float*)matrix);
Note: See TracChangeset
for help on using the changeset viewer.