Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2398 for code/branches


Ignore:
Timestamp:
Dec 10, 2008, 9:20:39 PM (16 years ago)
Author:
polakma
Message:

altfire now available

Location:
code/branches/weapon2
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon2/bin/def_keybindings.ini

    r2103 r2398  
    247247MouseLeft="fire"
    248248MouseMiddle=
    249 MouseRight=
     249MouseRight="altfire"
    250250MouseWheel1Down=
    251251MouseWheel1Up=
  • code/branches/weapon2/src/orxonox/CMakeLists.txt

    r2288 r2398  
    9292  objects/weaponSystem/Munition.cc
    9393  objects/weaponSystem/weapons/LaserGun.cc
     94  objects/weaponSystem/weapons/Fusion.cc
    9495  objects/weaponSystem/munitions/LaserGunMunition.cc
    9596  objects/weaponSystem/projectiles/BillboardProjectile.cc
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc

    r2393 r2398  
    4545        this->magazineReadyToShoot_ = true;
    4646        this->parentWeaponSystem_ = 0;
    47         this->parentWeaponSlot_ = 0;
     47        this->attachedToWeaponSlot_ = 0;
    4848        this->munition_ = 0;
    4949        this->bulletLoadingTime_ = 0;
     
    6161        SUPER(Weapon, XMLPort, xmlelement, mode);
    6262        XMLPortParam(Weapon, "munitionType", setMunitionType, getMunitionType, xmlelement, mode);
     63        XMLPortParam(Weapon, "bulletLoadingTime", setBulletLoadingTime, getBulletLoadingTime, xmlelement, mode);
     64        XMLPortParam(Weapon, "magazineLoadingTime", setMagazineLoadingTime, getMagazineLoadingTime, xmlelement, mode);
    6365    }
    6466
    6567    void Weapon::setWeapon()
    6668    {
    67 COUT(0) << "LaserGun::setWeapon" << std::endl;
    68         this->bulletLoadingTime_ = 0.5;
    69         this->magazineLoadingTime_ = 3.0;
    70         this->munition_->setMaxMagazines(100);
    71         this->munition_->setMaxBullets(6);
    7269        this->munition_->fillBullets();
    7370        this->munition_->fillMagazines();
     
    165162
    166163    void Weapon::setMunitionType(std::string munitionType)
    167     {   
    168 COUT(0) << "Weapon::setMunitionType (XMLPort) "<< munitionType << std::endl;
    169 this->munitionType_ = munitionType; }
     164    {   this->munitionType_ = munitionType; }
    170165
    171166    const std::string Weapon::getMunitionType()
    172167    {   return this->munitionType_;  }
     168
     169    void Weapon::setBulletLoadingTime(float loadingTime)
     170    {   this->bulletLoadingTime_ = loadingTime; }
     171
     172    const float Weapon::getBulletLoadingTime()
     173    {   return this->bulletLoadingTime_;  }
     174
     175    void Weapon::setMagazineLoadingTime(float loadingTime)
     176    {   this->magazineLoadingTime_ = loadingTime; }
     177
     178    const float Weapon::getMagazineLoadingTime()
     179    {   return this->magazineLoadingTime_;  }
     180
    173181
    174182    Munition * Weapon::getAttachedMunition(std::string munitionType)
     
    179187return this->munition_; }
    180188
    181 
    182 
    183     void Weapon::setBulletLoadingTime(float loadingTime)
    184     {   this->bulletLoadingTime_ = loadingTime;   }
    185 
    186     float Weapon::getBulletLoadingTime()
    187     {   return this->bulletLoadingTime_;  }
    188 
    189     void Weapon::setMagazineLoadingTime(float loadingTime)
    190     {   this->magazineLoadingTime_ = loadingTime;   }
    191 
    192     float Weapon::getMagazineLoadingTime()
    193     {   return this->magazineLoadingTime_;  }
    194 
    195 
    196     Timer<Weapon> * Weapon::getBulletTimer()
    197     {   return &this->bulletReloadTimer_;   }
    198 
    199     Timer<Weapon> * Weapon::getMagazineTimer()
    200     {   return &this->magazineReloadTimer_;   }
    201 
    202189    void Weapon::takeBullets() { };
    203190    void Weapon::createProjectile() { };
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.h

    r2391 r2398  
    6161            void bulletReloaded();
    6262            void magazineReloaded();
    63             void setBulletLoadingTime(float loadingTime);
    64             float getBulletLoadingTime();
    65             void setMagazineLoadingTime(float loadingTime);
    66             float getMagazineLoadingTime();
    67             Timer<Weapon> *getBulletTimer();
    68             Timer<Weapon> *getMagazineTimer();
    6963
    7064            virtual void setMunitionType(std::string munitionType);
    7165            virtual const std::string getMunitionType();
     66            virtual void setBulletLoadingTime(float loadingTime);
     67            virtual const float getBulletLoadingTime();
     68            virtual void setMagazineLoadingTime(float loadingTime);
     69            virtual const float getMagazineLoadingTime();
    7270
    7371            virtual void takeBullets();
     
    7573            virtual void createProjectile();
    7674
    77             inline void setParentWeaponSlot(WeaponSlot *parentWeaponSlot)
    78                 { this->parentWeaponSlot_=parentWeaponSlot; };
    79             inline WeaponSlot * getParentWeaponSlot()
    80                 { return this->parentWeaponSlot_; };
    8175            inline void setParentWeaponSystem(WeaponSystem *parentWeaponSystem)
    8276                { this->parentWeaponSystem_=parentWeaponSystem; };
     
    8478                { return this->parentWeaponSystem_; };
    8579
    86             //in future by XMLPort
     80            inline void setAttachedToWeaponSlot(WeaponSlot * wSlot)
     81                { this->attachedToWeaponSlot_ = wSlot; }
     82            inline WeaponSlot * getAttachedToWeaponSlot()
     83                { return this->attachedToWeaponSlot_; }
     84
    8785            virtual void setWeapon();
    8886
     
    9088
    9189        protected:
     90            bool bReloading_;
    9291            bool bulletReadyToShoot_;
    9392            bool magazineReadyToShoot_;
    9493            float bulletLoadingTime_;
    9594            float magazineLoadingTime_;
    96             bool bReloading_;
    97 
    98             Munition *munition_;
    9995            std::string munitionType_;
    10096
    101             WeaponSlot *parentWeaponSlot_;
    102             WeaponSystem *parentWeaponSystem_;
     97            WeaponSlot * attachedToWeaponSlot_;
     98            Munition * munition_;
     99            WeaponSystem * parentWeaponSystem_;
     100
    103101            SubclassIdentifier<Munition> munitionIdentifier_;
     102
    104103            Timer<Weapon> bulletReloadTimer_;
    105104            Timer<Weapon> magazineReloadTimer_;
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponPack.cc

    r2391 r2398  
    6464        {
    6565COUT(0) << "WeaponPack::fire (attached from WeaponSet)  from Weapon: "<< i << std::endl;
    66             this->weapons_[i]->fire();
     66            this->weapons_[i]->getAttachedToWeaponSlot()->fire();
    6767        }
    6868    }
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSet.cc

    r2391 r2398  
    6868            {
    6969                //at the moment this function only works for one weaponPack in the entire WeaponSystem...
    70                 if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 ) //if slot not full
     70                if ( this->parentWeaponSystem_->getWeaponSlotPointer(i)->getAttachedWeapon() == 0 && this->parentWeaponSystem_->getWeaponSlotPointer(i) != 0) //if slot not full
    7171                {
     72COUT(0) << "WeaponSet::attachWeaponPack attaching Weapon" << std::endl;
    7273                    this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(i) );
    7374                    this->parentWeaponSystem_->getWeaponSlotPointer(i)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
    7475                    wPackWeapon++;
     76                }
     77                else
     78                {
     79                    for (int k=0; k < this->parentWeaponSystem_->getWeaponSlotSize(); k++)
     80                    {
     81                        if ( this->parentWeaponSystem_->getWeaponSlotPointer(k)->getAttachedWeapon() == 0 )
     82                        {
     83COUT(0) << "WeaponSet::attachWeaponPack mode 2 k="<< k << std::endl;
     84                            this->setWeaponSlots_.push_back( this->parentWeaponSystem_->getWeaponSlotPointer(k) );
     85                            this->parentWeaponSystem_->getWeaponSlotPointer(k)->attachWeapon( wPack->getWeaponPointer(wPackWeapon) );
     86                            wPackWeapon++;
     87                        }
     88                    }
    7589                }
    7690            }
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/WeaponSlot.cc

    r2391 r2398  
    6666    void WeaponSlot::fire()
    6767    {
     68        if ( this->attachedWeapon_ )
    6869COUT(0) << "WeaponSlot::fire" << std::endl;
    6970        this->attachedWeapon_->fire();
     
    7980    {
    8081        this->attachedWeapon_ = weapon;
     82        weapon->setAttachedToWeaponSlot(this);
    8183        this->attach(weapon);
    8284COUT(0) << "WeaponSlot::attachWeapon position=" << this->getWorldPosition() << std::endl;
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/munitions/LaserGunMunition.cc

    r2337 r2398  
    4242    {
    4343        RegisterObject(LaserGunMunition);
     44
     45        this->maxBullets_ = 40;
     46        this->maxMagazines_ = 100;
    4447    }
    4548
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc

    r2391 r2398  
    4343        RegisterObject(ParticleProjectile);
    4444
    45         this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot2_small", LODParticle::normal);
     45        this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
    4646        this->particles_->addToSceneNode(this->getNode());
    47         //this->particles_->setKeepParticlesInLocalSpace(true);
     47        this->particles_->setKeepParticlesInLocalSpace(0);
    4848
    4949        this->particles_->getAllEmitters()->setDirection(-WorldEntity::FRONT);
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.cc

    r2391 r2398  
    4444    {
    4545        RegisterObject(LaserGun);
    46 
    47         //in future XMLPort
    48         this->speed_ = 250;
     46       
     47        this->speed_ = 1250;
    4948
    5049    }
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/weapons/LaserGun.h

    r2379 r2398  
    4747            LaserGun(BaseObject* creator);
    4848            virtual ~LaserGun();
    49            
     49
    5050            virtual void takeBullets();
    5151            virtual void takeMagazines();
  • code/branches/weapon2/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2391 r2398  
    137137    void Pawn::fire(WeaponMode::Enum fireMode)
    138138    {
    139 COUT(0) << "Pawn::fire" << std::endl;
     139COUT(0) << "Pawn::fire" << fireMode << std::endl;
    140140        if (this->weaponSystem_)
    141141            this->weaponSystem_->fire(fireMode);
     
    152152    void Pawn::setWeaponSlot(WeaponSlot * wSlot)
    153153    {   
    154 COUT(0) << "Pawn::setWeaponSlot" << std::endl;
     154COUT(0) << "Pawn::setWeaponSlot" << wSlot << std::endl;
    155155        this->attach(wSlot);
    156156        this->weaponSystem_->attachWeaponSlot(wSlot);   }
Note: See TracChangeset for help on using the changeset viewer.