Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10698 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Jun 14, 2007, 5:33:43 PM (18 years ago)
Author:
snellen
Message:

merged adm, hud, vs-enhancements : beni's responsible for this commit. blame him!

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  
    112112void AimingSystem::hit(float damage, WorldEntity* killer)
    113113{
    114   if( this->owner != killer)
     114  if( this->owner != killer && killer != this && !killer->isA( AimingSystem::staticClassID() ) )
    115115  {
    116116    //PRINTF(0)("real hit: %s\n", killer->getClassCName());
     
    127127void AimingSystem::tick(float dt)
    128128{
    129 
    130 
    131129}
    132130
  • trunk/src/world_entities/weapons/heavy_blaster.cc

    r10618 r10698  
    9898//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    9999
    100   this->loadModel("models/guns/frag_cannon.obj", .4);
     100  this->loadModel("models/guns/frag_cannon2.obj", .4);
    101101
    102102
     
    131131    this->objComp[i] = new PNode* [this->getSegs()];
    132132    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 Projectiles
     133    this->emissionPoint[i]->setParent(this);      //Parenting emissionPoint to Weapons
    134134    this->emissionPoint[i]->setName("EmissionPoint");
    135135    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     
    156156
    157157
    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 
    173158  for (int i = 0; i < this->getBarrels(); i++){
    174     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.05, ANIM_LINEAR, ANIM_NULL);
     159    this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    175160    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.55, 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);
    179164    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.25, ANIM_LINEAR, ANIM_NULL);
     165    this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    181166  }
    182167
     
    186171  animation2->setInfinity(ANIM_INF_CONSTANT);
    187172  animation3->setInfinity(ANIM_INF_CONSTANT);
    188 
    189 //   this->setEmissionPoint(3.8, 1.2, 0, 0);
    190173
    191174  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     
    207190  pj->setParent(PNode::getNullParent());
    208191
    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));
    211192  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*130 + VECTOR_RAND(1));
    212193
    213194  pj->setAbsCoor(this->emissionPoint[this->activeBarrel]->getAbsCoor());
    214 //   pj->setAbsCoor(this->getEmissionPoint(0));
    215195  pj->setAbsDir(this->getAbsDir());
    216 //   pj->toList(OM_GROUP_01_PROJ);
    217196  pj->activate();
    218197
  • trunk/src/world_entities/weapons/laser_cannon.cc

    r10415 r10698  
    5555  this->registerObject(this, LaserCannon::_objectList);
    5656
    57 //  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);
     57  this->setScaling (5);
    5858
    59   this->loadModel("models/guns/lasercannon.obj", 5.0f);
     59  this->loadModel("models/guns/lasercannon.obj", this->getScaling());
    6060
    6161  this->setStateDuration(WS_SHOOTING, .1);
     
    7575  this->setProjectileTypeC("RailProjectile");
    7676  this->prepareProjectiles(100);
    77   this->setEmissionPoint(Vector(2.8,0,0) * 5.0);
     77  this->setEmissionPoint(Vector(2.8,0,0) * this->getScaling());
    7878}
    7979
  • trunk/src/world_entities/weapons/light_blaster.cc

    r10618 r10698  
    9090  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    9191  this->setProjectileTypeC("LBolt");
    92   this->prepareProjectiles(100);
     92  this->prepareProjectiles(25);
    9393
    9494  this->setBarrels(3);
     
    106106    this->emissionPoint[i]->setName("EmissionPoint");
    107107    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    108 //     this->shootAnim[i] = new Animation3D* [this->getSegs()];
    109108    for(int j = 0; j < this->getSegs(); j++)
    110109    {
     
    114113    }
    115114  }
    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));*/
    120115
    121116  this->emissionPoint[0]->setRelCoor(Vector(2.2, 0.0, 0.1));
     
    130125  animation2->setInfinity(ANIM_INF_CONSTANT);
    131126  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 //   }
    139127
    140128
  • trunk/src/world_entities/weapons/medium_blaster.cc

    r10618 r10698  
    6969void MediumBlaster::init()
    7070{
    71   this->loadModel("models/guns/blaster.obj", .33);
     71  this->setScaling(.3333);
     72
     73  this->loadModel("models/guns/blaster.obj", this->getScaling());
    7274
    7375  this->setStateDuration(WS_SHOOTING, 0.2);   // 5 Schuss pro Sekunde
     
    8284
    8385  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");
    8587  this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav");
    8688
    8789  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    88   this->setProjectileTypeC("MBolt");   // FIXME temp project type until the blaste class exist
    89   this->prepareProjectiles(100);
     90  this->setProjectileTypeC("MBolt");
     91  this->prepareProjectiles(10);
    9092
    9193
     
    9597
    9698  this->objComp = new PNode**[this->getBarrels()];
     99  this->emissionPoint = new PNode*[this->getBarrels()];
    97100  this->shootAnim = new Animation3D**[this->getBarrels()];
    98101  for (int i = 0; i < this->getBarrels(); i++)
    99102  {
    100103    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);
    101108    this->shootAnim[i] = new Animation3D* [this->getSegs()];
    102109    for(int j = 0; j < this->getSegs(); j++)
     
    109116
    110117  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);
    118125  }
    119126
     
    124131  animation3->setInfinity(ANIM_INF_CONSTANT);
    125132
    126 
    127   this->setEmissionPoint(1.3, 0, 0);
     133  this->emissionPoint[0]->setRelCoor(Vector(3.9, 0.0, 0.0) * this->getScaling());
    128134
    129135  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  
    3333    PNode*** objComp;
    3434    Animation3D*** shootAnim;
     35    PNode** emissionPoint;
    3536
    3637    int activeBarrel;
  • trunk/src/world_entities/weapons/weapon.cc

    r10529 r10698  
    134134  for(int i = 0; i < this->barrels; i++){
    135135    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 Projectiles
     136    this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapons
    137137    this->emissionPoint[i]->setName("EmissionPoint");
    138138    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     
    158158  // set this object to be synchronized over network
    159159  //this->setSynchronized(true);
    160 }
    161 
    162 /**
    163  * needed, if there are more than one barrel or segments
    164  */
    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 Projectiles
    180     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 init2
    188  */
    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;
    200160}
    201161
  • trunk/src/world_entities/weapons/weapon.h

    r10516 r10698  
    124124    Projectile* getProjectile();
    125125
     126    inline void setScaling(float scaling) { this->scaling = scaling; };
     127    inline float getScaling() { return this->scaling; };
    126128
    127129    // EMISSION
     
    181183    inline void setSegs(int segs) { this->segs = segs; };
    182184
    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();
    187189    void deconstr();
    188190
     
    248250    PNode*               defaultTarget;                    //!< A target for targeting Weapons.
    249251
     252    float                scaling;                          //!< Local scaling factor. any scaling will be done through this vector.
     253
    250254    ////////////
    251255    // PHASES //
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r10544 r10698  
    1 
    21/*
    32   orxonox - the future of 3D-vertical-scrollers
     
    3635/**
    3736 * @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)
    3938 */
    4039WeaponManager::WeaponManager(WorldEntity* parent)
     
    146145  BaseObject::loadParams(root);
    147146
    148   LoadParam(root, "slot-count", this, WeaponManager, setSlotCount)
     147  LoadParam(root, "slotCount", this, WeaponManager, setSlotCount)
    149148  .describe("how many slots(cannons) the WeaponManager can handle");
     149
    150150
    151151  LOAD_PARAM_START_CYCLE(root, element);
     
    156156  }
    157157  LOAD_PARAM_END_CYCLE(element);
     158
     159
    158160}
    159161
     
    357359 * @param slotCapability the capability @see WeaponSlotCapability
    358360 */
    359 void WeaponManager::setSlotCapability(int slot, long slotCapability)
     361void WeaponManager::setSlotCapability(int slot, unsigned long slotCapability)
    360362{
    361363  if (slot > slotCount)
  • trunk/src/world_entities/weapons/weapon_manager.h

    r10437 r10698  
    6060    // setting up the WeaponManager with the following functions
    6161    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));};
    6263    void setSlotDirection(int slot, const Quaternion& rotation);
    6364    /** @param slot the slot to get the relative position from @returns the relative position of the Carrier to the Slot */
    6465    const Vector& getSlotPosition(int slot) const;
    65     void setSlotCapability(int slot, long slotCapability);
     66    void setSlotCapability(int slot, unsigned long slotCapability);
    6667    /** @param slot the slot to get the capabilities from @returns the capabilies */
    6768    long getSlotCapability(int slot) const;
     
    7677    bool addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
    7778    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
    7887
    7988    Weapon* getWeapon(int slotID) const;
  • trunk/src/world_entities/weapons/weapon_slot.cc

    r10534 r10698  
    4242
    4343WeaponSlot::~WeaponSlot()
    44 {}
     44{
     45}
    4546
    4647
     
    5556
    5657  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");
    5865}
    5966
     
    6370void WeaponSlot::setWeaponClass()
    6471{
    65 
    6672}
    6773
  • trunk/src/world_entities/weapons/weapon_slot.h

    r10534 r10698  
    88
    99#include "p_node.h"
    10 
     10#include "weapon.h"
    1111
    1212class Weapon;
     
    3636  inline void setNextWeapon(Weapon* weapon) { this->nextWeapon = weapon; }
    3737
     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
    3841
    3942  inline void setWeaponConfig(int slot, int side) { this->weaponSlot = slot; this->weaponSide = side; }
Note: See TracChangeset for help on using the changeset viewer.