/* $Id: grenade.hpp,v 1.11.4.1 2006/01/20 11:33:52 chfreund Exp $ */ #ifndef _GRENADE_HPP_ #define _GRENADE_HPP_ /**********************************************************/ #include #include "global.hpp" #include "constants.hpp" #include "collidableobject.hpp" #include "audio.hpp" #include "vector.hpp" #include "counter.hpp" /**********************************************************/ class Grenade : public CollidableObject { friend class WeaponGrenade; public: enum { TIME_TRIGGERED = 1 << 0, CONTACT_TRIGGERED = 1 << 1, SHRAPNELS = 1 << 2, DIRT = 1 << 3 }; Grenade(); bool initialize( const Vector& pos, const Vector& vel, const Uint8 owner, const Uint32 type, const real ttl, const Sint32 nShrapnels, const Sint32 damage ); virtual Sint32 getID() const { return GRENADE; } virtual void update(); virtual bool collidedWithObstacle( const Sint32 colX, const Sint32 colY ); void explode( void ); virtual int applyDamage( const Particles::ParticleData& p ); virtual void serialize( Uint8*& bufferPointer ) const; virtual void deserialize( Uint8*& bufferPointer ); virtual Uint32 getSerializeBufferSize() const; virtual void dump( std::ostream& out ) const; protected: Uint8 m_owner; Uint32 m_type; // Uint32 m_ttl; Counter m_ttl; Sint32 m_nShrapnels; Sint32 m_damage; static Mix_Chunk *m_explodeSample, *m_bounceSample, *m_damageSample; }; /**********************************************************/ #endif /* _GRENADE_HPP_ */