#include <disco_grenade.h>
Inheritance diagram for DiscoGrenade:
Public Member Functions | |
DiscoGrenade (ExplosiveWeaponConfig &cfg, WeaponLauncher *p_launcher) | |
void | Refresh () |
Protected Member Functions | |
void | Explosion () |
void | SignalOutOfMap () |
Protected Attributes | |
bool | have_played_music |
ParticleEngine | smoke_engine |
Definition at line 33 of file disco_grenade.h.
DiscoGrenade::DiscoGrenade | ( | ExplosiveWeaponConfig & | cfg, | |
WeaponLauncher * | p_launcher | |||
) |
Definition at line 34 of file disco_grenade.cpp.
00035 : 00036 WeaponProjectile ("disco_grenade", cfg, p_launcher), 00037 smoke_engine(40) 00038 { 00039 m_rebound_sound = "weapon/disco_grenade_bounce"; 00040 have_played_music = false; 00041 explode_with_collision = false; 00042 }
void DiscoGrenade::Explosion | ( | ) | [protected, virtual] |
Reimplemented from WeaponProjectile.
Definition at line 44 of file disco_grenade.cpp.
00045 { 00046 const uint star_nbr = 9; 00047 const float cos_angle[] = {1.000000, 0.766044, 0.173648, -0.500000, -0.939693, -0.939693, -0.500000, 0.173648, 0.766044}; 00048 const float sin_angle[] = {0.000000, 0.642788, 0.984808, 0.866025, 0.342020, -0.342020, -0.866025, -0.984808, -0.642788}; 00049 00050 for(uint i=0;i < star_nbr;i++) 00051 { 00052 double angle = 2.0*(double)i*M_PI/(double)star_nbr; 00053 // cos_angle[i] = cos(angle); 00054 // sin_angle[i] = sin(angle); 00055 smoke_engine.AddNow(Point2i(GetX()+(int)(cos_angle[i]*(float)cfg.explosion_range), 00056 GetY()+(int)(sin_angle[i]*(float)cfg.explosion_range)), 00057 1,particle_MAGIC_STAR,false,angle,2.5); 00058 } 00059 WeaponProjectile::Explosion(); 00060 }
Here is the call graph for this function:
void DiscoGrenade::Refresh | ( | ) | [virtual] |
Reimplemented from WeaponProjectile.
Definition at line 62 of file disco_grenade.cpp.
00063 { 00064 WeaponProjectile::Refresh(); 00065 00066 #ifdef HAVE_A_REALLY_BIG_CPU 00067 if(IsMoving()) 00068 { 00069 double norme,angle; 00070 GetSpeed(norme,angle); 00071 for(int i = -3; i<4 ; i++) 00072 smoke_engine.AddNow(GetPosition(), 1,particle_MAGIC_STAR, false,angle+(i*M_PI_4/3.0)+M_PI_2,2.0); 00073 } 00074 else 00075 { 00076 smoke_engine.AddNow(GetPosition(), 1,particle_MAGIC_STAR, false,((float)(Time::GetInstance()->Read()%500)-250.0) * M_PI / 250.0,3.0); 00077 } 00078 #else // :-P 00079 smoke_engine.AddPeriodic(GetPosition(), particle_MAGIC_STAR, false); 00080 #endif //HAVE_A_REALLY_BIG_CPU 00081 00082 double tmp = Time::GetInstance()->Read() - begin_time; 00083 // Ah ! Ah ! Ah ! Staying Alive, staying alive ... 00084 if (GetTotalTimeout() >= 2 && tmp > (1000 * GetTotalTimeout() - 2000) && !have_played_music) { 00085 jukebox.Play("share","weapon/alleluia") ; 00086 have_played_music = true; 00087 } 00088 image->SetRotation_rad(GetSpeedAngle()); 00089 }
Here is the call graph for this function:
void DiscoGrenade::SignalOutOfMap | ( | ) | [protected, virtual] |
Reimplemented from WeaponProjectile.
Definition at line 91 of file disco_grenade.cpp.
00092 { 00093 GameMessages::GetInstance()->Add (_("The disco grenade has left the dance floor before exploding")); 00094 WeaponProjectile::SignalOutOfMap(); 00095 }
Here is the call graph for this function:
bool DiscoGrenade::have_played_music [protected] |
Definition at line 36 of file disco_grenade.h.
ParticleEngine DiscoGrenade::smoke_engine [protected] |
Definition at line 38 of file disco_grenade.h.