CBomb Class Reference

An element in the arena which represents a bomb. More...

#include <CBomb.h>

Inheritance diagram for CBomb:

Inheritance graph
[legend]
Collaboration diagram for CBomb:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CBomb (void)
 Constructor (initialize the base class).
virtual ~CBomb (void)
 Destructor (uninitialize the base class).
void Create (int BlockX, int BlockY, int FlameSize, float TimeLeft, int OwnerPlayer)
 Initialize the bomb.
void Destroy (void)
 Uninitialize the bomb.
bool Update (float DeltaTime)
 Update the bomb (make it tick, move if needed...). Return whether the element should be deleted by the arena.
void Display (void)
 Display the bomb.
void OnWriteSnapshot (CArenaSnapshot &Snapshot)
void OnReadSnapshot (CArenaSnapshot &Snapshot)
void Crush (void)
 Make the bomb react when it is crushed by a falling wall.
void Burn (void)
 Make the bomb react when it is burnt by an explosion.
void StartMoving (EBombKick BombKick, int KickerPlayer)
 Trigger a bomb kick in the specified direction, by the specified player.
void StopMoving (void)
 Tell the bomb to stop moving as soon as possible.
void StartFlying (EBombFly BombFly, EBombFlightType FlightType)
 Tell the bomb to be pushed in a direction and to fly in that direction. Current pixel/block position is the start.
void SetBeingLifted (void)
 Tell the bomb that a bomber is lifting it.
void SetBeingHeld (void)
 Tell the bomb that a bomber is holding it.
void SetBeingPunched (void)
 Tell the bomb that a bomber is punching it.
void SetPosition (int X, int Y)
 Set the pixel position of the bomb.
void SetBlock (int BlockX, int BlockY)
 Set the block position of the bomb.
void SetChecked (void)
 Called by the bomber. Tell the bomb the owner bomber noticed it is dead.
int GetOwnerPlayer (void)
 Return the number of the player that dropped this bomb.
int GetKickerPlayer (void)
 Return the number of the player that just kicked this bomb. The bomb must be still moving.
bool IsDead (void)
 Return whether the bomb is dead.
int GetBlockX (void)
 Return the block position X of the bomb.
int GetBlockY (void)
 Return the block position Y of the bomb.
float GetTimeLeft (void)
 Return the time left before the bomb will explode (unless the explosion is triggered earlier).
float GetElapsedTime (void)
 Return the time since the bomb was created.
int GetFlameSize (void)
 Return the size of the flames (in blocks) when the bomb will explode.
bool IsOnFloor (void)
 Return whether the bomb is on the floor (not in the air).
bool IsRemote (void)
 Return whether the bomb is a remote bomb.
bool IsBeingPunched (void)
 Return whether the bomb is punched.

Private Member Functions

void ManageMove (float DeltaTime)
 Manage the movement of the bomb if needed. Uses TryMove().
bool TryMove (float fPixels)
 Try to move the bomb in the current EBombKick direction by fPixels pixels.
bool IsObstacle (int BlockX, int BlockY)
 Return whether there is an obstacle (bomb, wall, bomber) on the specified block.
void Explode (void)
 Trigger the explosion of the bomb : create an explosion, make the bomb die.
void ManageFlight (float DeltaTime)
 Make the bomb move, bounce, land, etc if it is currently flying.
void CrushItem (int BlockX, int BlockY)
 Find an item that is on the same block as this bomb, and kill it.
void Bounce (float DeltaTime)
 Make the bomb bounce, play a bounce sound, make a bomber stunt if bouncing on a bomber.
void CenterOnBlock (void)
 Position the bomb so that it is exactly on the current block.
void AbortKick (void)
 Brutally abort any bomb kicking. This method is to be used when a bomber is going to lift or punch a bomb that can be currently moving because a bomber kicked it.

Private Attributes

int m_iX
 Integer position X (in pixels) in the arena.
int m_iY
 Integer position Y (in pixels) in the arena.
float m_X
 Float position X (in pixels) in the arena.
float m_Y
 Float position Y (in pixels) in the arena.
int m_BlockX
 Position X (in blocks) in the arena grid.
int m_BlockY
 Position Y (in blocks) in the arena grid.
int m_Sprite
 Current sprite to use when displaying the bomb.
float m_Timer
 Time counter for animation.
EBombKick m_BombKick
 Is the bomb moving and in which direction?
bool m_HasToStopMoving
 Does the bomb have to stop moving?
int m_OwnerPlayer
 Number of the player that owns the bomb.
int m_KickerPlayer
 Number of the player that just kicked the bomb (until the bomb stops moving).
bool m_Checked
 Was the dead bomb noticed by the owner bomber?
bool m_Dead
 Is the bomb dead?
int m_FlameSize
 Size of the flames (in blocks) when exploding.
float m_ElapsedTime
 Total elapsed time since bomb was created.
float m_TimeLeft
 Time left (in seconds) before the bomb explodes.
float m_AnimationTimes [4]
 Animation times of the bomb, depending on the time left before the bomb explodes that is specified on bomb's creation.
bool m_BeingHeld
 Is a bomber holding the bomb?
bool m_BeingLifted
 Is a bomber lifting the bomb?
bool m_BeingPunched
 Is a bomber punching the bomb?
EBombFly m_BombFly
 Is the bomb flying and in which direction?
float m_FlightTimer
 Movement timer when the bomb is flying, used to determine the current flight frame for this bomb.
int m_FlightFrame
 Index in the corresponding flight position arrays, used to know the bomb's position.
EBombFlightType m_FlightType
 Cause of the flight, used to make the flight movement different according to the cause.
bool m_Warping
 Is the bomb currently moving from one side of the arena and coming out from the opposite side? (up/down or left/right).
bool m_Remote
 Is the bomb a remote controled bomb ?

Static Private Attributes

static int m_ThrowMoveX [NUMBER_OF_BOMBFLY_DIRECTIONS][6]
 Offset to apply to the bomb's X position for each "frame" of the flight, according to the direction of the flight. When bomb was thrown.
static int m_ThrowMoveY [NUMBER_OF_BOMBFLY_DIRECTIONS][6]
 Offset to apply to the bomb's Y position for each "frame" of the flight, according to the direction of the flight. When bomb was thrown.
static int m_PunchMoveX [NUMBER_OF_BOMBFLY_DIRECTIONS][6]
 Offset to apply to the bomb's X position for each "frame" of the flight, according to the direction of the flight. When bomb was punched.
static int m_PunchMoveY [NUMBER_OF_BOMBFLY_DIRECTIONS][6]
 Offset to apply to the bomb's Y position for each "frame" of the flight, according to the direction of the flight. When bomb was punched.
static int m_BounceMoveX [NUMBER_OF_BOMBFLY_DIRECTIONS][3]
 Offset to apply to the bomb's X position for each "frame" of the flight, according to the direction of the flight. When bomb has bounced.
static int m_BounceMoveY [NUMBER_OF_BOMBFLY_DIRECTIONS][3]
 Offset to apply to the bomb's Y position for each "frame" of the flight, according to the direction of the flight. When bomb has bounced.


Detailed Description

An element in the arena which represents a bomb.

Constructor & Destructor Documentation

CBomb::CBomb ( void   ) 

Constructor (initialize the base class).

CBomb::~CBomb ( void   )  [virtual]

Destructor (uninitialize the base class).


Member Function Documentation

void CBomb::ManageMove ( float  DeltaTime  )  [private]

Manage the movement of the bomb if needed. Uses TryMove().

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBomb::TryMove ( float  fPixels  )  [private]

Try to move the bomb in the current EBombKick direction by fPixels pixels.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBomb::IsObstacle ( int  BlockX,
int  BlockY 
) [private]

Return whether there is an obstacle (bomb, wall, bomber) on the specified block.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::Explode ( void   )  [private]

Trigger the explosion of the bomb : create an explosion, make the bomb die.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::ManageFlight ( float  DeltaTime  )  [private]

Make the bomb move, bounce, land, etc if it is currently flying.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::CrushItem ( int  BlockX,
int  BlockY 
) [private]

Find an item that is on the same block as this bomb, and kill it.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::Bounce ( float  DeltaTime  )  [private]

Make the bomb bounce, play a bounce sound, make a bomber stunt if bouncing on a bomber.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::CenterOnBlock ( void   )  [private]

Position the bomb so that it is exactly on the current block.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::AbortKick ( void   )  [inline, private]

Brutally abort any bomb kicking. This method is to be used when a bomber is going to lift or punch a bomb that can be currently moving because a bomber kicked it.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::Create ( int  BlockX,
int  BlockY,
int  FlameSize,
float  TimeLeft,
int  OwnerPlayer 
)

Initialize the bomb.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::Destroy ( void   ) 

Uninitialize the bomb.

Reimplemented from CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBomb::Update ( float  DeltaTime  )  [virtual]

Update the bomb (make it tick, move if needed...). Return whether the element should be deleted by the arena.

Implements CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::Display ( void   )  [virtual]

Display the bomb.

Implements CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::OnWriteSnapshot ( CArenaSnapshot Snapshot  )  [virtual]

Implements CElement.

Here is the call graph for this function:

void CBomb::OnReadSnapshot ( CArenaSnapshot Snapshot  )  [virtual]

Implements CElement.

Here is the call graph for this function:

void CBomb::Crush ( void   ) 

Make the bomb react when it is crushed by a falling wall.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::Burn ( void   ) 

Make the bomb react when it is burnt by an explosion.

Here is the caller graph for this function:

void CBomb::StartMoving ( EBombKick  BombKick,
int  KickerPlayer 
)

Trigger a bomb kick in the specified direction, by the specified player.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::StopMoving ( void   ) 

Tell the bomb to stop moving as soon as possible.

Here is the caller graph for this function:

void CBomb::StartFlying ( EBombFly  BombFly,
EBombFlightType  FlightType 
)

Tell the bomb to be pushed in a direction and to fly in that direction. Current pixel/block position is the start.

Here is the caller graph for this function:

void CBomb::SetBeingLifted ( void   )  [inline]

Tell the bomb that a bomber is lifting it.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::SetBeingHeld ( void   )  [inline]

Tell the bomb that a bomber is holding it.

Here is the caller graph for this function:

void CBomb::SetBeingPunched ( void   )  [inline]

Tell the bomb that a bomber is punching it.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomb::SetPosition ( int  X,
int  Y 
) [inline]

Set the pixel position of the bomb.

Here is the caller graph for this function:

void CBomb::SetBlock ( int  BlockX,
int  BlockY 
) [inline]

Set the block position of the bomb.

Here is the caller graph for this function:

void CBomb::SetChecked ( void   )  [inline]

Called by the bomber. Tell the bomb the owner bomber noticed it is dead.

Here is the caller graph for this function:

int CBomb::GetOwnerPlayer ( void   )  [inline]

Return the number of the player that dropped this bomb.

Here is the caller graph for this function:

int CBomb::GetKickerPlayer ( void   )  [inline]

Return the number of the player that just kicked this bomb. The bomb must be still moving.

Here is the caller graph for this function:

bool CBomb::IsDead ( void   )  [inline]

Return whether the bomb is dead.

Here is the caller graph for this function:

int CBomb::GetBlockX ( void   )  [inline]

Return the block position X of the bomb.

Here is the caller graph for this function:

int CBomb::GetBlockY ( void   )  [inline]

Return the block position Y of the bomb.

Here is the caller graph for this function:

float CBomb::GetTimeLeft ( void   )  [inline]

Return the time left before the bomb will explode (unless the explosion is triggered earlier).

Here is the caller graph for this function:

float CBomb::GetElapsedTime ( void   )  [inline]

Return the time since the bomb was created.

Here is the caller graph for this function:

int CBomb::GetFlameSize ( void   )  [inline]

Return the size of the flames (in blocks) when the bomb will explode.

Here is the caller graph for this function:

bool CBomb::IsOnFloor ( void   )  [inline]

Return whether the bomb is on the floor (not in the air).

Here is the caller graph for this function:

bool CBomb::IsRemote ( void   )  [inline]

Return whether the bomb is a remote bomb.

Here is the caller graph for this function:

bool CBomb::IsBeingPunched ( void   )  [inline]

Return whether the bomb is punched.

Here is the caller graph for this function:


Member Data Documentation

int CBomb::m_iX [private]

Integer position X (in pixels) in the arena.

int CBomb::m_iY [private]

Integer position Y (in pixels) in the arena.

float CBomb::m_X [private]

Float position X (in pixels) in the arena.

float CBomb::m_Y [private]

Float position Y (in pixels) in the arena.

int CBomb::m_BlockX [private]

Position X (in blocks) in the arena grid.

int CBomb::m_BlockY [private]

Position Y (in blocks) in the arena grid.

int CBomb::m_Sprite [private]

Current sprite to use when displaying the bomb.

float CBomb::m_Timer [private]

Time counter for animation.

Is the bomb moving and in which direction?

bool CBomb::m_HasToStopMoving [private]

Does the bomb have to stop moving?

int CBomb::m_OwnerPlayer [private]

Number of the player that owns the bomb.

int CBomb::m_KickerPlayer [private]

Number of the player that just kicked the bomb (until the bomb stops moving).

bool CBomb::m_Checked [private]

Was the dead bomb noticed by the owner bomber?

bool CBomb::m_Dead [private]

Is the bomb dead?

int CBomb::m_FlameSize [private]

Size of the flames (in blocks) when exploding.

float CBomb::m_ElapsedTime [private]

Total elapsed time since bomb was created.

float CBomb::m_TimeLeft [private]

Time left (in seconds) before the bomb explodes.

float CBomb::m_AnimationTimes[4] [private]

Animation times of the bomb, depending on the time left before the bomb explodes that is specified on bomb's creation.

bool CBomb::m_BeingHeld [private]

Is a bomber holding the bomb?

bool CBomb::m_BeingLifted [private]

Is a bomber lifting the bomb?

bool CBomb::m_BeingPunched [private]

Is a bomber punching the bomb?

Is the bomb flying and in which direction?

float CBomb::m_FlightTimer [private]

Movement timer when the bomb is flying, used to determine the current flight frame for this bomb.

int CBomb::m_FlightFrame [private]

Index in the corresponding flight position arrays, used to know the bomb's position.

Cause of the flight, used to make the flight movement different according to the cause.

bool CBomb::m_Warping [private]

Is the bomb currently moving from one side of the arena and coming out from the opposite side? (up/down or left/right).

bool CBomb::m_Remote [private]

Is the bomb a remote controled bomb ?

int CBomb::m_ThrowMoveX [static, private]

Initial value:

 
    {
        {   0,   0,   0,   0,   0,   0 }, 
        {   0,   0,   0,   0,   0,   0 }, 
        {   0,   0,   0,   0,   0,   0 }, 
        { -10, -11,  -9,  -7,  -7,  -4 }, 
        {  10,  11,   9,   7,   7,   4 }, 
    }
Offset to apply to the bomb's X position for each "frame" of the flight, according to the direction of the flight. When bomb was thrown.

int CBomb::m_ThrowMoveY [static, private]

Initial value:

 
    {
        {   0,   0,   0,   0,   0,   0 }, 
        {  -5,  -7,  -8,  -8,  -5,  -5 }, 
        {   7,   9,  14,  15,  11,   9 }, 
        {  -4,  -1,   2,   4,   6,  10 }, 
        {  -4,  -1,   2,   4,   6,  10 }, 
    }
Offset to apply to the bomb's Y position for each "frame" of the flight, according to the direction of the flight. When bomb was thrown.

int CBomb::m_PunchMoveX [static, private]

Initial value:

 
    {
        {   0,   0,   0,   0,   0,   0 }, 
        {   0,   0,   0,   0,   0,   0 }, 
        {   0,   0,   0,   0,   0,   0 }, 
        {  -8, -10,  -9,  -9,  -6,  -6 }, 
        {   8,  10,   9,   9,   6,   6 }, 
    }
Offset to apply to the bomb's X position for each "frame" of the flight, according to the direction of the flight. When bomb was punched.

int CBomb::m_PunchMoveY [static, private]

Initial value:

 
    {
        {   0,   0,   0,   0,   0,   0 }, 
        {  -6,  -8, -10, -10,  -8,  -6 }, 
        {   6,   8,  10,  10,   8,   6 }, 
        {  -9,  -5,   0,   3,   4,   7 }, 
        {  -9,  -5,   0,   3,   4,   7 }, 
    }
Offset to apply to the bomb's Y position for each "frame" of the flight, according to the direction of the flight. When bomb was punched.

int CBomb::m_BounceMoveX [static, private]

Initial value:

 
    {
        {   0,   0,   0 }, 
        {   0,   0,   0 }, 
        {   0,   0,   0 }, 
        {  -5,  -6,  -5 }, 
        {   5,   6,   5 }, 
    }
Offset to apply to the bomb's X position for each "frame" of the flight, according to the direction of the flight. When bomb has bounced.

int CBomb::m_BounceMoveY [static, private]

Initial value:

 
    {
        {   0,   0,   0 }, 
        {  -5,  -7,  -4 }, 
        {   4,   7,   5 }, 
        {  -4,   0,   4 }, 
        {  -4,   0,   4 }, 
    }
Offset to apply to the bomb's Y position for each "frame" of the flight, according to the direction of the flight. When bomb has bounced.


The documentation for this class was generated from the following files:

Generated on Sat Oct 18 12:26:42 2008 for Bombermaaan by  doxygen 1.5.5
Visit the Bombermaaan project page
SourceForge.net Logo