Suicide Class Reference

#include <suicide.h>

Inheritance diagram for Suicide:

Inheritance graph
[legend]
Collaboration diagram for Suicide:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Suicide ()
ExplosiveWeaponConfigcfg ()

Protected Member Functions

bool p_Shoot ()
void p_Select ()
void Refresh ()

Private Attributes

int sound_channel
bool is_dying

Detailed Description

Definition at line 28 of file suicide.h.


Constructor & Destructor Documentation

Suicide::Suicide (  ) 

Definition at line 31 of file suicide.cpp.

00031                  : Weapon(WEAPON_SUICIDE, "suicide", new ExplosiveWeaponConfig())
00032 {
00033   m_name = _("Commit Suicide");
00034   sound_channel = -1;
00035 }


Member Function Documentation

ExplosiveWeaponConfig & Suicide::cfg (  ) 

Definition at line 71 of file suicide.cpp.

00072 { return static_cast<ExplosiveWeaponConfig&>(*extra_params); }

Here is the caller graph for this function:

void Suicide::p_Select (  )  [protected, virtual]

Reimplemented from Weapon.

Definition at line 37 of file suicide.cpp.

00038 {
00039   is_dying = false;
00040 }

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

Implements Weapon.

Definition at line 42 of file suicide.cpp.

00043 {
00044   sound_channel = jukebox.Play ("share", "weapon/suicide");
00045 
00046   GameLoop::GetInstance()->interaction_enabled=false;
00047   is_dying = true;
00048 
00049   return true;
00050 }

Here is the call graph for this function:

void Suicide::Refresh (  )  [protected, virtual]

Implements Weapon.

Definition at line 52 of file suicide.cpp.

00053 {
00054   if (!is_dying) return;
00055 
00056   m_is_active = sound_channel != -1 && Mix_Playing(sound_channel);
00057 
00058   if(!m_is_active && !ActiveCharacter().IsDead())
00059   {
00060     ActiveCharacter().DisableDeathExplosion();
00061     ActiveCharacter().body->MakeParticles(ActiveCharacter().GetPosition());
00062     Action* a = new Action(Action::ACTION_SET_CHARACTER_ENERGY);
00063     a->Push((int)ActiveCharacter().GetTeamIndex());
00064     a->Push((int)ActiveCharacter().GetCharacterIndex());
00065     a->Push(0); // Set energy to 0 => death
00066     ActionHandler::GetInstance()->NewAction(a);
00067     ApplyExplosion(ActiveCharacter().GetCenter(),cfg());
00068   }
00069 }

Here is the call graph for this function:


Member Data Documentation

bool Suicide::is_dying [private]

Definition at line 32 of file suicide.h.

int Suicide::sound_channel [private]

Definition at line 31 of file suicide.h.


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