Changeset 10698 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Jun 14, 2007, 5:33:43 PM (18 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 12 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/aiming_system.cc
r10013 r10698 112 112 void AimingSystem::hit(float damage, WorldEntity* killer) 113 113 { 114 if( this->owner != killer )114 if( this->owner != killer && killer != this && !killer->isA( AimingSystem::staticClassID() ) ) 115 115 { 116 116 //PRINTF(0)("real hit: %s\n", killer->getClassCName()); … … 127 127 void AimingSystem::tick(float dt) 128 128 { 129 130 131 129 } 132 130 -
trunk/src/world_entities/weapons/heavy_blaster.cc
r10618 r10698 98 98 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); 99 99 100 this->loadModel("models/guns/frag_cannon .obj", .4);100 this->loadModel("models/guns/frag_cannon2.obj", .4); 101 101 102 102 … … 131 131 this->objComp[i] = new PNode* [this->getSegs()]; 132 132 this->emissionPoint[i] = new PNode; 133 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles133 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapons 134 134 this->emissionPoint[i]->setName("EmissionPoint"); 135 135 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); … … 156 156 157 157 158 // Animation3D* animB0Shoot = this->getAnimation(WS_SHOOTING0, this->objComp[0][0]);159 // Animation3D* animB1Shoot = this->getAnimation(WS_SHOOTING1, this->objComp2);160 // Animation3D* animB2Shoot = this->getAnimation(WS_SHOOTING2, this->objComp3);161 // Animation3D* animT0Shoot = this->getAnimation(WS_SHOOTING3, this->objComp[0][1]);162 // Animation3D* animT1Shoot = this->getAnimation(WS_SHOOTING4, this->objComp5);163 // Animation3D* animT2Shoot = this->getAnimation(WS_SHOOTING5, this->objComp6);164 165 166 // this->shootAnim[0][0]->setInfinity(ANIM_INF_CONSTANT);167 // animB1Shoot->setInfinity(ANIM_INF_CONSTANT);168 // animB2Shoot->setInfinity(ANIM_INF_CONSTANT);169 // animT0Shoot->setInfinity(ANIM_INF_CONSTANT);170 // animT1Shoot->setInfinity(ANIM_INF_CONSTANT);171 // animT2Shoot->setInfinity(ANIM_INF_CONSTANT);172 173 158 for (int i = 0; i < this->getBarrels(); i++){ 174 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0 5, ANIM_LINEAR, ANIM_NULL);159 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 175 160 this->shootAnim[i][0]->addKeyFrame(Vector(-0.3, 0.0, 0.0), Quaternion(), 0.9, ANIM_LINEAR, ANIM_NULL); 176 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.5 5, ANIM_LINEAR, ANIM_NULL);177 178 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0. 05, ANIM_LINEAR, ANIM_NULL);161 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.5, ANIM_LINEAR, ANIM_NULL); 162 163 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 179 164 this->shootAnim[i][1]->addKeyFrame(Vector(-0.4, 0.0, 0.0), Quaternion(), 1.2, ANIM_LINEAR, ANIM_NULL); 180 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.2 5, ANIM_LINEAR, ANIM_NULL);165 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL); 181 166 } 182 167 … … 186 171 animation2->setInfinity(ANIM_INF_CONSTANT); 187 172 animation3->setInfinity(ANIM_INF_CONSTANT); 188 189 // this->setEmissionPoint(3.8, 1.2, 0, 0);190 173 191 174 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 207 190 pj->setParent(PNode::getNullParent()); 208 191 209 // pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));210 // pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*130 + VECTOR_RAND(1));211 192 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*130 + VECTOR_RAND(1)); 212 193 213 194 pj->setAbsCoor(this->emissionPoint[this->activeBarrel]->getAbsCoor()); 214 // pj->setAbsCoor(this->getEmissionPoint(0));215 195 pj->setAbsDir(this->getAbsDir()); 216 // pj->toList(OM_GROUP_01_PROJ);217 196 pj->activate(); 218 197 -
trunk/src/world_entities/weapons/laser_cannon.cc
r10415 r10698 55 55 this->registerObject(this, LaserCannon::_objectList); 56 56 57 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);57 this->setScaling (5); 58 58 59 this->loadModel("models/guns/lasercannon.obj", 5.0f);59 this->loadModel("models/guns/lasercannon.obj", this->getScaling()); 60 60 61 61 this->setStateDuration(WS_SHOOTING, .1); … … 75 75 this->setProjectileTypeC("RailProjectile"); 76 76 this->prepareProjectiles(100); 77 this->setEmissionPoint(Vector(2.8,0,0) * 5.0);77 this->setEmissionPoint(Vector(2.8,0,0) * this->getScaling()); 78 78 } 79 79 -
trunk/src/world_entities/weapons/light_blaster.cc
r10618 r10698 90 90 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT); 91 91 this->setProjectileTypeC("LBolt"); 92 this->prepareProjectiles( 100);92 this->prepareProjectiles(25); 93 93 94 94 this->setBarrels(3); … … 106 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 108 // this->shootAnim[i] = new Animation3D* [this->getSegs()];109 108 for(int j = 0; j < this->getSegs(); j++) 110 109 { … … 114 113 } 115 114 } 116 /*117 this->emissionPoint[0]->setRelCoor(Vector(1.19, 0.0, 0.1));118 this->emissionPoint[1]->setRelCoor(Vector(1.19, -0.07, -0.05));119 this->emissionPoint[2]->setRelCoor(Vector(1.19, 0.07, -0.05));*/120 115 121 116 this->emissionPoint[0]->setRelCoor(Vector(2.2, 0.0, 0.1)); … … 130 125 animation2->setInfinity(ANIM_INF_CONSTANT); 131 126 animation3->setInfinity(ANIM_INF_CONSTANT); 132 133 // this->setEmissionPoint(3.8, 1.2, 0);134 135 // for (int i = 0; i < this->getBarrels(); i++){136 // this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion(i * 120, Vector(1.0, 0.0, 0.0)), 0.049, ANIM_NULL, ANIM_LINEAR);137 // this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion((i+1)*120, Vector(1.0, 0.0, 0.0)), 0.001, ANIM_NULL, ANIM_LINEAR);138 // }139 127 140 128 -
trunk/src/world_entities/weapons/medium_blaster.cc
r10618 r10698 69 69 void MediumBlaster::init() 70 70 { 71 this->loadModel("models/guns/blaster.obj", .33); 71 this->setScaling(.3333); 72 73 this->loadModel("models/guns/blaster.obj", this->getScaling()); 72 74 73 75 this->setStateDuration(WS_SHOOTING, 0.2); // 5 Schuss pro Sekunde … … 82 84 83 85 this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav"); 84 this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");86 // this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav"); 85 87 this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav"); 86 88 87 89 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT); 88 this->setProjectileTypeC("MBolt"); // FIXME temp project type until the blaste class exist89 this->prepareProjectiles(10 0);90 this->setProjectileTypeC("MBolt"); 91 this->prepareProjectiles(10); 90 92 91 93 … … 95 97 96 98 this->objComp = new PNode**[this->getBarrels()]; 99 this->emissionPoint = new PNode*[this->getBarrels()]; 97 100 this->shootAnim = new Animation3D**[this->getBarrels()]; 98 101 for (int i = 0; i < this->getBarrels(); i++) 99 102 { 100 103 this->objComp[i] = new PNode* [this->getSegs()]; 104 this->emissionPoint[i] = new PNode; 105 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 101 108 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 102 109 for(int j = 0; j < this->getSegs(); j++) … … 109 116 110 117 for (int i = 0; i < this->getBarrels(); i++){ 111 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);112 this->shootAnim[i][0]->addKeyFrame(Vector(- 0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);113 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);114 115 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);116 this->shootAnim[i][1]->addKeyFrame(Vector(. 166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);117 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);118 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 119 this->shootAnim[i][0]->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 120 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 121 122 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 123 this->shootAnim[i][1]->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 124 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 118 125 } 119 126 … … 124 131 animation3->setInfinity(ANIM_INF_CONSTANT); 125 132 126 127 this->setEmissionPoint(1.3, 0, 0); 133 this->emissionPoint[0]->setRelCoor(Vector(3.9, 0.0, 0.0) * this->getScaling()); 128 134 129 135 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); -
trunk/src/world_entities/weapons/medium_blaster.h
r10516 r10698 33 33 PNode*** objComp; 34 34 Animation3D*** shootAnim; 35 PNode** emissionPoint; 35 36 36 37 int activeBarrel; -
trunk/src/world_entities/weapons/weapon.cc
r10529 r10698 134 134 for(int i = 0; i < this->barrels; i++){ 135 135 this->emissionPoint[i] = new PNode; 136 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles136 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapons 137 137 this->emissionPoint[i]->setName("EmissionPoint"); 138 138 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); … … 158 158 // set this object to be synchronized over network 159 159 //this->setSynchronized(true); 160 }161 162 /**163 * needed, if there are more than one barrel or segments164 */165 void Weapon::init2()166 {167 if (this->barrels == 1 && this->segs == 1)168 return;169 170 delete this->emissionPoint[0];171 delete this->emissionPoint;172 delete this->shootAnim[0];173 delete this->shootAnim;174 175 this->shootAnim = new Animation3D**[this->barrels];176 this->emissionPoint = new PNode*[this->barrels];177 for(int i = 0; i < this->barrels; i++){178 this->emissionPoint[i] = new PNode;179 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles180 this->emissionPoint[i]->setName("EmissionPoint");181 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);182 this->shootAnim[i] = new Animation3D* [this->segs];183 }184 }185 186 /**187 * deconstructor for init2188 */189 void Weapon::deconstr()190 {191 for(int i = 0; i < this->barrels; i++) {192 delete this->emissionPoint[i];193 for (int j = 0; j < this->segs; j++)194 delete this->shootAnim[i][j];195 delete this->shootAnim[i];196 }197 198 delete this->emissionPoint;199 delete this->shootAnim;200 160 } 201 161 -
trunk/src/world_entities/weapons/weapon.h
r10516 r10698 124 124 Projectile* getProjectile(); 125 125 126 inline void setScaling(float scaling) { this->scaling = scaling; }; 127 inline float getScaling() { return this->scaling; }; 126 128 127 129 // EMISSION … … 181 183 inline void setSegs(int segs) { this->segs = segs; }; 182 184 183 inline Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; };184 inline void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); };185 186 void init2();185 // inline Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; }; 186 // inline void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); }; 187 188 // void init2(); 187 189 void deconstr(); 188 190 … … 248 250 PNode* defaultTarget; //!< A target for targeting Weapons. 249 251 252 float scaling; //!< Local scaling factor. any scaling will be done through this vector. 253 250 254 //////////// 251 255 // PHASES // -
trunk/src/world_entities/weapons/weapon_manager.cc
r10544 r10698 1 2 1 /* 3 2 orxonox - the future of 3D-vertical-scrollers … … 36 35 /** 37 36 * @brief this initializes the weaponManager for a given nnumber of weapon slots 38 * @param number of weapon slots of the model/ship <= 8(limitied)37 * @param number of weapon slots of the model/ship <= 10 (limitied) 39 38 */ 40 39 WeaponManager::WeaponManager(WorldEntity* parent) … … 146 145 BaseObject::loadParams(root); 147 146 148 LoadParam(root, "slot -count", this, WeaponManager, setSlotCount)147 LoadParam(root, "slotCount", this, WeaponManager, setSlotCount) 149 148 .describe("how many slots(cannons) the WeaponManager can handle"); 149 150 150 151 151 LOAD_PARAM_START_CYCLE(root, element); … … 156 156 } 157 157 LOAD_PARAM_END_CYCLE(element); 158 159 158 160 } 159 161 … … 357 359 * @param slotCapability the capability @see WeaponSlotCapability 358 360 */ 359 void WeaponManager::setSlotCapability(int slot, long slotCapability)361 void WeaponManager::setSlotCapability(int slot, unsigned long slotCapability) 360 362 { 361 363 if (slot > slotCount) -
trunk/src/world_entities/weapons/weapon_manager.h
r10437 r10698 60 60 // setting up the WeaponManager with the following functions 61 61 void setSlotPosition(int slot, const Vector& position, PNode* parent = NULL); 62 // inline void setSlotPosition(float slot, float x, float y,float z) {setSlotPosition((int)slot, Vector(x,y,z));}; 62 63 void setSlotDirection(int slot, const Quaternion& rotation); 63 64 /** @param slot the slot to get the relative position from @returns the relative position of the Carrier to the Slot */ 64 65 const Vector& getSlotPosition(int slot) const; 65 void setSlotCapability(int slot, long slotCapability);66 void setSlotCapability(int slot, unsigned long slotCapability); 66 67 /** @param slot the slot to get the capabilities from @returns the capabilies */ 67 68 long getSlotCapability(int slot) const; … … 76 77 bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1); 77 78 void removeWeapon(Weapon* weapon, int configID = -1); 79 80 inline void createWeaponSlot(int slot, float x, float y, float z, long capability) { 81 this->setSlotPosition(slot, Vector( x, y, z)); 82 this->setSlotCapability(slot, capability); }; 83 84 inline void addWeaponToSlot(int config, int slot, const std::string& weaponName){ 85 this->addWeapon( Weapon::createWeapon( weaponName ), config, slot); }; 86 78 87 79 88 Weapon* getWeapon(int slotID) const; -
trunk/src/world_entities/weapons/weapon_slot.cc
r10534 r10698 42 42 43 43 WeaponSlot::~WeaponSlot() 44 {} 44 { 45 } 45 46 46 47 … … 55 56 56 57 LoadParam(root, "slot", this, WeaponSlot, setWeaponConfig) 57 .describe("sets the weapon slot"); 58 .describe("sets the weapon slot"); 59 60 LoadParam(root, "currentWeapon", this, WeaponSlot, setCurrentWeapon) 61 .describe("creates and set next weapon"); 62 63 LoadParam(root, "nextWeapon", this, WeaponSlot, setNextWeapon) 64 .describe("creates and set next weapon"); 58 65 } 59 66 … … 63 70 void WeaponSlot::setWeaponClass() 64 71 { 65 66 72 } 67 73 -
trunk/src/world_entities/weapons/weapon_slot.h
r10534 r10698 8 8 9 9 #include "p_node.h" 10 10 #include "weapon.h" 11 11 12 12 class Weapon; … … 36 36 inline void setNextWeapon(Weapon* weapon) { this->nextWeapon = weapon; } 37 37 38 inline void setNextWeapon(const std::string& weaponName){this->nextWeapon = Weapon::createWeapon(weaponName); }; 39 inline void setCurrentWeapon(const std::string& weaponName){ this->currentWeapon = Weapon::createWeapon(weaponName); }; 40 38 41 39 42 inline void setWeaponConfig(int slot, int side) { this->weaponSlot = slot; this->weaponSide = side; }
Note: See TracChangeset
for help on using the changeset viewer.