- Timestamp:
- Feb 7, 2006, 1:13:58 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/sound/sound_source.h
r6981 r7065 33 33 /** @returns true, if the Source is Playing */ 34 34 inline bool isPlaying() const { return this->bPlay; }; 35 /** @param sourceNode the Source this is attached to. */ 36 inline void setSourceNode(const PNode* sourceNode) { this->sourceNode = sourceNode;}; 35 37 /** @returns the SoundBuffer of this Source */ 36 38 inline const SoundBuffer* getBuffer() const { return this->buffer; } -
trunk/src/world_entities/power_ups/param_power_up.cc
r6815 r7065 38 38 }; 39 39 40 ParamPowerUp::ParamPowerUp () : PowerUp(0.0, 1.0, 0.0)41 {42 this->init();43 }44 45 40 ParamPowerUp::ParamPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0) 46 41 { 47 42 this->init(); 43 this->loadPickupSound("sound/powerups/power_up_6.wav"); 48 44 if( root != NULL) 49 45 this->loadParams(root); -
trunk/src/world_entities/power_ups/param_power_up.h
r6547 r7065 22 22 23 23 public: 24 ParamPowerUp(); 25 ParamPowerUp(const TiXmlElement* root); 24 ParamPowerUp(const TiXmlElement* root = NULL); 26 25 virtual ~ParamPowerUp (); 27 26 -
trunk/src/world_entities/power_ups/power_up.cc
r6973 r7065 21 21 #include "primitive_model.h" 22 22 23 #include "resource_manager.h" 23 24 #include "load_param.h" 24 25 … … 42 43 this->sphereMaterial->setDiffuse(r, g, b); 43 44 this->toList(OM_COMMON); 45 46 this->soundSource.setSourceNode(this); 47 this->soundBuffer = NULL; 44 48 } 45 49 … … 47 51 { 48 52 delete this->sphereMaterial; 53 if (this->soundBuffer != NULL) 54 ResourceManager::getInstance()->unload(this->soundBuffer); 49 55 } 50 56 … … 53 59 { 54 60 WorldEntity::loadParams(root); 61 55 62 LoadParam(root, "respawnType", this, PowerUp, setRespawnType); 63 56 64 LoadParam(root, "respawnTime", this, PowerUp, setRespawnTime); 65 66 LoadParam(root, "pickup-sound", this, PowerUp, loadPickupSound); 57 67 } 58 68 69 70 void PowerUp::loadPickupSound(const char* pickupSound) 71 { 72 if (this->soundBuffer != NULL) 73 ResourceManager::getInstance()->unload(this->soundBuffer); 74 75 else if (pickupSound != NULL) 76 { 77 this->soundBuffer = (SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV); 78 if (this->soundBuffer != NULL) 79 { 80 PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound, this->getName()); 81 } 82 else 83 { 84 PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound, this->getName()); 85 } 86 } 87 else 88 this->soundBuffer = NULL; 89 } 59 90 60 91 void PowerUp::collidesWith (WorldEntity* entity, const Vector& location) … … 64 95 if(dynamic_cast<Extendable*>(entity)->pickup(this)) 65 96 { 97 if(soundBuffer != NULL) 98 this->soundSource.play(this->soundBuffer); 99 66 100 switch(respawnType) { 67 101 case RESPAWN_NONE: -
trunk/src/world_entities/power_ups/power_up.h
r6973 r7065 8 8 9 9 #include "world_entity.h" 10 11 #include "sound_buffer.h" 12 #include "sound_source.h" 10 13 11 14 class Material; … … 23 26 void collidesWith (WorldEntity* entity, const Vector& location); 24 27 28 void loadPickupSound(const char* pickupSound); 29 25 30 virtual void draw () const; 26 31 virtual void tick(float dt); … … 37 42 38 43 private: 44 SoundSource soundSource; 45 SoundBuffer* soundBuffer; 39 46 Material* sphereMaterial; 40 47 PowerUpRespawn respawnType; -
trunk/src/world_entities/power_ups/turret_power_up.cc
r6815 r7065 26 26 27 27 CREATE_FACTORY(TurretPowerUp, CL_TURRET_POWER_UP); 28 29 TurretPowerUp::TurretPowerUp () : PowerUp(0.0, 1.0, 0.0)30 {31 this->init();32 }33 28 34 29 TurretPowerUp::TurretPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0) -
trunk/src/world_entities/power_ups/turret_power_up.h
r6512 r7065 15 15 16 16 public: 17 TurretPowerUp(); 18 TurretPowerUp(const TiXmlElement* root); 17 TurretPowerUp(const TiXmlElement* root = NULL); 19 18 virtual ~TurretPowerUp (); 20 19 -
trunk/src/world_entities/power_ups/weapon_power_up.cc
r6973 r7065 31 31 CREATE_FACTORY(WeaponPowerUp, CL_WEAPON_POWER_UP); 32 32 33 WeaponPowerUp::WeaponPowerUp () : PowerUp(1.0, 1.0, 0.0)34 {35 this->init();36 }37 38 33 WeaponPowerUp::WeaponPowerUp(const TiXmlElement* root) : PowerUp(1.0, 1.0, 0.0) 39 34 { 40 35 this->init(); 36 this->loadPickupSound("sound/powerups/whats this2.wav"); 41 37 if( root != NULL) 42 38 this->loadParams(root); -
trunk/src/world_entities/power_ups/weapon_power_up.h
r6973 r7065 16 16 17 17 public: 18 WeaponPowerUp(); 19 WeaponPowerUp(const TiXmlElement* root); 18 WeaponPowerUp(const TiXmlElement* root = NULL); 20 19 virtual ~WeaponPowerUp (); 21 20
Note: See TracChangeset
for help on using the changeset viewer.