SubMachineGun Class Reference

#include <submachine_gun.h>

Inheritance diagram for SubMachineGun:

Inheritance graph
[legend]
Collaboration diagram for SubMachineGun:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SubMachineGun ()
void HandleKeyEvent (Action::Action_t action, Keyboard::Key_Event_t event_type)

Protected Member Functions

WeaponProjectileGetProjectileInstance ()
void IncMissedShots ()
bool p_Shoot ()

Private Member Functions

void RepeatShoot ()

Private Attributes

ParticleEngine particle

Detailed Description

Definition at line 42 of file submachine_gun.h.


Constructor & Destructor Documentation

SubMachineGun::SubMachineGun (  ) 

Definition at line 59 of file submachine_gun.cpp.

00059                              : WeaponLauncher(WEAPON_SUBMACHINE_GUN, "m16", new ExplosiveWeaponConfig())
00060 {
00061   m_name = _("Submachine Gun");
00062 
00063   override_keys = true ;
00064   ignore_collision_signal = true;
00065   ignore_explosion_signal = true;
00066   ignore_ghost_state_signal = true;
00067   ignore_drowning_signal = true;
00068   announce_missed_shots = false;
00069 
00070   m_weapon_fire = new Sprite(resource_manager.LoadImage(weapons_res_profile,m_id+"_fire"));
00071   m_weapon_fire->EnableRotationCache(32);
00072 
00073   ReloadLauncher();
00074 }

Here is the call graph for this function:


Member Function Documentation

WeaponProjectile * SubMachineGun::GetProjectileInstance (  )  [protected, virtual]

Implements WeaponLauncher.

Definition at line 77 of file submachine_gun.cpp.

00078 {
00079   return dynamic_cast<WeaponProjectile *>
00080       (new SubMachineGunBullet(cfg(),dynamic_cast<WeaponLauncher *>(this)));
00081 }

Here is the call graph for this function:

void SubMachineGun::HandleKeyEvent ( Action::Action_t  action,
Keyboard::Key_Event_t  event_type 
) [virtual]

Reimplemented from WeaponLauncher.

Definition at line 128 of file submachine_gun.cpp.

00129 {
00130   switch (action) {
00131     case Action::ACTION_SHOOT:
00132       if (event_type == Keyboard::KEY_REFRESH)
00133         m_is_active = true;
00134       if (event_type ==  Keyboard::KEY_RELEASED)
00135         m_is_active = false;
00136       if (m_is_active) RepeatShoot();
00137       break;
00138     default:
00139       break;
00140   };
00141 }

Here is the call graph for this function:

void SubMachineGun::IncMissedShots (  )  [protected, virtual]

Reimplemented from WeaponLauncher.

Definition at line 83 of file submachine_gun.cpp.

00084 {
00085   if(missed_shots + 1 == ReadInitialNbUnit())
00086     announce_missed_shots = true;
00087   WeaponLauncher::IncMissedShots();
00088 }

Here is the call graph for this function:

bool SubMachineGun::p_Shoot (  )  [protected, virtual]

Reimplemented from WeaponLauncher.

Definition at line 90 of file submachine_gun.cpp.

00091 {
00092   if (m_is_active)
00093     return false;
00094 
00095   projectile->Shoot(SUBMACHINE_BULLET_SPEED);
00096   projectile = NULL;
00097   ReloadLauncher();
00098 
00099   Point2i pos = ActiveCharacter().GetHandPosition();
00100   double angle =  - M_PI_2 - ActiveCharacter().GetDirection()
00101                 * (float)(Time::GetInstance()->Read() % 100) * M_PI_4 / 100.0;
00102   particle.AddNow(pos, 1, particle_BULLET, true, angle,
00103                            5.0 + (Time::GetInstance()->Read() % 6));
00104 
00105   m_is_active = true;
00106   announce_missed_shots = false;
00107   return true;
00108 }

Here is the call graph for this function:

void SubMachineGun::RepeatShoot (  )  [private]

Definition at line 111 of file submachine_gun.cpp.

00112 {
00113   if ( m_is_active )
00114   {
00115     uint tmp = Time::GetInstance()->Read();
00116     uint time = tmp - m_last_fire_time;
00117 
00118     if (time >= SUBMACHINE_TIME_BETWEEN_SHOOT)
00119     {
00120       m_is_active = false;
00121       NewActionShoot();
00122       m_last_fire_time = tmp;
00123     }
00124   }
00125 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

ParticleEngine SubMachineGun::particle [private]

Definition at line 44 of file submachine_gun.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 14:18:50 2007 for Wormux by  doxygen 1.4.7