[10689] | 1 | /* |
---|
| 2 | * file bsp_weapon.h |
---|
| 3 | * A weapon that shoots both at player and environment (pnode and bsp). |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _BSP_WEAPON_H |
---|
| 7 | #define _BSP_WEAPON_H |
---|
| 8 | |
---|
| 9 | #include "world_entity.h" |
---|
| 10 | #include "aiming_system.h" |
---|
[10690] | 11 | #include "effects/explosion.h" |
---|
[10689] | 12 | |
---|
[10694] | 13 | #include <list> |
---|
| 14 | |
---|
| 15 | #include "particles/box_emitter.h" |
---|
| 16 | #include "particles/sprite_particles.h" |
---|
| 17 | |
---|
| 18 | class MuzzleFlash : public WorldEntity |
---|
| 19 | { |
---|
| 20 | ObjectListDeclaration(MuzzleFlash); |
---|
| 21 | public: |
---|
| 22 | void explode (float lifetime); |
---|
| 23 | |
---|
| 24 | MuzzleFlash (); |
---|
| 25 | virtual ~MuzzleFlash (); |
---|
| 26 | |
---|
| 27 | virtual void activate(); |
---|
| 28 | virtual void deactivate(); |
---|
| 29 | |
---|
| 30 | virtual void tick (float time); |
---|
| 31 | virtual void draw() const; |
---|
| 32 | |
---|
| 33 | void setLifeTime( float lifeTime ){ this->lifeTime = lifeTime; } |
---|
| 34 | |
---|
| 35 | void drawParticles(){ if (explosionParticles) explosionParticles->draw(); } |
---|
| 36 | |
---|
| 37 | protected: |
---|
| 38 | //static FastFactory* fastFactory; |
---|
| 39 | |
---|
| 40 | float lifeTime; |
---|
| 41 | float lifeCycle; |
---|
| 42 | |
---|
| 43 | SpriteParticles* explosionParticles; |
---|
| 44 | BoxEmitter* emitter; |
---|
| 45 | |
---|
| 46 | }; |
---|
| 47 | |
---|
| 48 | |
---|
[10689] | 49 | class BspWeapon : public WorldEntity |
---|
| 50 | { |
---|
| 51 | ObjectListDeclaration(BspWeapon); |
---|
| 52 | public: |
---|
[10704] | 53 | BspWeapon ( OM_LIST list ); |
---|
[10689] | 54 | BspWeapon (const TiXmlElement* root); |
---|
| 55 | virtual ~BspWeapon(); |
---|
| 56 | |
---|
[10704] | 57 | void init( OM_LIST list ); |
---|
[10689] | 58 | void loadParams(const TiXmlElement* root); |
---|
[10704] | 59 | void fire(bool fire){ this->bFire = fire; } |
---|
[10689] | 60 | virtual void tick(float dt); |
---|
| 61 | virtual void draw() const; |
---|
| 62 | |
---|
[10704] | 63 | void setAlwaysHits( bool r ){ this->alwaysHits = r; } |
---|
| 64 | void setDamage( float d ){ this->damage = d; } |
---|
[10689] | 65 | private: |
---|
| 66 | |
---|
| 67 | void shoot(); |
---|
| 68 | float range; |
---|
| 69 | void setRange( float r ){ this->range = r; } |
---|
| 70 | float damage; |
---|
| 71 | float fireRate; |
---|
| 72 | void setFireRate( float r ){ this->fireRate = r; } |
---|
| 73 | bool alwaysHits; |
---|
[10690] | 74 | void addPoint(float x, float y, float z); |
---|
[10712] | 75 | |
---|
| 76 | OrxSound::SoundSource soundSource_shoot; |
---|
| 77 | OrxSound::SoundBuffer soundBuffer_shoot;; |
---|
[10694] | 78 | |
---|
| 79 | std::list<MuzzleFlash*> gunFire; |
---|
[10689] | 80 | |
---|
| 81 | float bRate; |
---|
| 82 | bool bFire; |
---|
[10713] | 83 | #ifdef DEBUG_AIMING |
---|
| 84 | float debugDist; |
---|
| 85 | #endif |
---|
[10689] | 86 | |
---|
| 87 | AimingSystem* aimingSystem; |
---|
| 88 | }; |
---|
| 89 | |
---|
| 90 | #endif |
---|