Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10712 in orxonox.OLD


Ignore:
Timestamp:
Jun 18, 2007, 9:27:34 AM (17 years ago)
Author:
rennerc
Message:

AdmWeapon sound, ActionboxEnemy weapons

Location:
branches/presentation/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/npcs/actionbox_enemy.cc

    r10698 r10712  
    2424#include "playable.h"
    2525
     26#include "particles/dot_emitter.h"
     27#include "particles/emitter_node.h"
     28#include "particles/sprite_particles.h"
     29
    2630#include "actionbox_enemy.h"
    2731
     
    3034
    3135ActionboxEnemy::ActionboxEnemy(const TiXmlElement* root)
     36  :weaponMan(this)
    3237{
    3338  PRINTF(0)("ActionboxEnemy\n");
     
    4954  if ( root )
    5055    this->loadParams( root );
     56 
     57 
     58    this->weaponMan.setParentEntity( this);
     59  //weapons:
     60
     61  this->weaponMan.setParentEntity( this);
     62
     63  this->weaponMan.setSlotCount(8);
     64
     65  this->weaponMan.createWeaponSlot(0, 3.270, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     66  this->weaponMan.createWeaponSlot(1, 3.270, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     67  this->weaponMan.createWeaponSlot(2, 4.385, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     68  this->weaponMan.createWeaponSlot(3, 4.385, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     69  this->weaponMan.createWeaponSlot(4, 1.635, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     70  this->weaponMan.createWeaponSlot(5, 1.536, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     71  this->weaponMan.createWeaponSlot(6, 1.536, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     72  this->weaponMan.createWeaponSlot(7, 1.536, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     73
     74
     75  this->weaponMan.addWeaponToSlot(0, 0, "RFCannon");
     76  this->weaponMan.addWeaponToSlot(0, 1, "RFCannon");
     77  this->weaponMan.addWeaponToSlot(0, 2, "RFCannon");
     78  this->weaponMan.addWeaponToSlot(0, 3, "RFCannon");
     79  this->weaponMan.addWeaponToSlot(1, 0, "RFCannon");
     80  this->weaponMan.addWeaponToSlot(1, 1, "RFCannon");
     81  this->weaponMan.addWeaponToSlot(1, 2, "RFCannon");
     82  this->weaponMan.addWeaponToSlot(1, 3, "RFCannon");
     83
     84  this->weaponMan.addWeaponToSlot(0, 4, "NadionLaser");
     85  this->weaponMan.addWeaponToSlot(0, 5, "NadionLaser");
     86  this->weaponMan.addWeaponToSlot(2, 4, "NadionLaser");
     87  this->weaponMan.addWeaponToSlot(2, 5, "NadionLaser");
     88
     89  this->weaponMan.addWeaponToSlot(0, 6, "Disruptor");
     90  this->weaponMan.addWeaponToSlot(0, 7, "Disruptor");
     91  this->weaponMan.addWeaponToSlot(3, 6, "Disruptor");
     92  this->weaponMan.addWeaponToSlot(3, 7, "Disruptor");
     93 
     94  this->weaponMan.changeWeaponConfig(0);
     95 
     96  this->weaponMan.getFixedTarget()->setParent(this);
     97  this->weaponMan.getFixedTarget()->setRelCoor(100000,0,0);
     98  this->weaponMan.hideCrosshair();
    5199}
    52100
     
    62110void ActionboxEnemy::tick( float dt )
    63111{
     112  weaponMan.tick( dt );
    64113  this->bFire = false;
    65114 
     
    123172    {
    124173      this->bFire = true;
    125       PRINTF(0)("FIRE\n");
     174      weaponMan.fire();
    126175    }
    127176  }
     
    263312  WorldEntity::draw();
    264313}
     314
     315void ActionboxEnemy::destroy( WorldEntity * killer )
     316{
     317  EmitterNode* node  = NULL;
     318  DotEmitter* emitter = NULL;
     319  SpriteParticles*  explosionParticles  = NULL;
     320
     321  explosionParticles = new SpriteParticles(200);
     322  explosionParticles->setName("SpaceShipExplosionParticles");
     323  explosionParticles->setLifeSpan(.2, .3);
     324  explosionParticles->setRadius(0.0, 10.0);
     325  explosionParticles->setRadius(.5, 6.0);
     326  explosionParticles->setRadius(1.0, 3.0);
     327  explosionParticles->setColor(0.0, 1,1,1,.9);
     328  explosionParticles->setColor(0.1,  1,1,0,.9);
     329  explosionParticles->setColor(0.5, .8,.4,0,.5);
     330  explosionParticles->setColor(1.0, .2,.2,.2,.5);
     331
     332
     333  emitter = new DotEmitter( 2000, 70, 360);
     334  emitter->setEmissionRate( 200.0);
     335
     336  node  = new EmitterNode( .1f);
     337  node->setupParticle( emitter, explosionParticles);
     338  node->setAbsDir( this->getAbsDir());
     339  node->setVelocity( this->getVelocity() * .9f);
     340  node->setAbsCoor( this->getAbsCoor());
     341  if( !node->start())
     342    PRINTF(0)("Explosion node not correctly started!");
     343 
     344  this->setAbsCoor( this->getAbsCoor() + Vector(100,0,0) + Vector(1,0,0) * VECTOR_RAND(150).dot(Vector(1,0,0)));
     345}
  • branches/presentation/src/world_entities/npcs/actionbox_enemy.h

    r10698 r10712  
    1919
    2020    virtual void loadParams(const TiXmlElement* root);
     21   
     22    virtual void destroy( WorldEntity* killer );
    2123   
    2224  private:
     
    4143    void moveTowardsBox( ActionBox* box, float dt );
    4244    void moveTowards( Vector targetPos, Vector targetDir, float dt );
     45   
     46    WeaponManager         weaponMan;      //!< the weapon manager: managing a list of energy weapons to wepaon-slot mapping
    4347};
    4448
  • branches/presentation/src/world_entities/weapons/bsp_weapon.cc

    r10711 r10712  
    2222#include "environments/bsp_entity.h"
    2323#include "loading/fast_factory.h"
     24#include "sound_engine.h"
    2425
    2526ObjectListDefinition(BspWeapon);
     
    4142BspWeapon::~BspWeapon ()
    4243{
    43           // will be deleted
     44  if ( soundSource_shoot.isPlaying() )
     45    soundSource_shoot.stop();
    4446}
    4547
     
    125127        this->aimingSystem->setParent( this );
    126128        this->aimingSystem->toList(list);
     129       
     130        this->soundSource_shoot.setSourceNode(this);
     131        this->soundBuffer_shoot = OrxSound::ResourceSoundBuffer("sounds/explosions/doulette.wav");
    127132       
    128133}
     
    130135void BspWeapon::shoot()
    131136{
    132         //gunFirExpl.explode(gunFire1,Vector(2,2,2));
    133         //gunFirExpl.explode(gunFire2,Vector(2,2,2));
    134 
     137
     138  soundSource_shoot.play( soundBuffer_shoot, OrxSound::SoundEngine::getInstance()->getEffectsVolume(), 0.5);
     139 
    135140for ( std::list<MuzzleFlash*>::iterator it = gunFire.begin(); it!=gunFire.end(); it++)
    136141{
  • branches/presentation/src/world_entities/weapons/bsp_weapon.h

    r10704 r10712  
    7373                bool alwaysHits;
    7474                void addPoint(float x, float y, float z);
     75               
     76                OrxSound::SoundSource       soundSource_shoot;
     77                OrxSound::SoundBuffer       soundBuffer_shoot;;
    7578               
    7679    std::list<MuzzleFlash*> gunFire;
Note: See TracChangeset for help on using the changeset viewer.