CBomber Class Reference

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

#include <CBomber.h>

Inheritance diagram for CBomber:

Inheritance graph
[legend]
Collaboration diagram for CBomber:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CBomber (void)
 Constructor (initialize the base class).
virtual ~CBomber (void)
 Destructor (uninitialize the base class).
void SetArena (CArena *pArena)
 Redefinition of the inherited method.
void Create (int BlockX, int BlockY, int Player, COptions *options)
 Initialize the bomber.
void Destroy (void)
 Uninitialize the bomber.
bool Update (float DeltaTime)
 Update the bomber. Return whether the element should be deleted by the arena.
void Display (void)
 Draw the bomber sprite in the right layer.
void OnWriteSnapshot (CArenaSnapshot &Snapshot)
void OnReadSnapshot (CArenaSnapshot &Snapshot)
void Command (EBomberMove BomberMove, EBomberAction BomberAction)
 Give a move and action order to the bomber for next update.
void Victorious (void)
 Tell the bomber he has won the current battle he is playing in.
void Burn (void)
 Make the bomber react when he is burnt by an explosion.
void Crush (void)
 Make the bomber react when he is crushed by a wall.
void Stunt (void)
 Make the bomber react when a bomb bounces on his head.
void ItemEffect (EItemType Type)
 Apply the effects of the specified item type on the bomber.
void TryKickBomb (int BlockX, int BlockY, EBombKick BombKick)
 Kick a bomb if there is one on the specified block.
int GetFlameSize (void)
 Get the current flame size of the bombs dropped by the bomber. Depends on its current sickness.
int GetPixelsPerSecond (void)
 Return the speed (in pixels per second) the bomber can walk.
bool IsObstacle (int BlockX, int BlockY)
 Return whether there is a wall or a bomb on the specified block.
bool IsAlive (void)
 Return whether the bomber is alive (not dead and not dying).
bool IsDying (void)
 Return whether the bomber is dying.
bool IsDead (void)
 Return whether the bomber is dead (but not dying).
bool IsActor (void)
 Return whether the bomber can currently do something (i.e. execute commands).
int GetBlockX (void)
 Return the block position X of the bomber.
int GetBlockY (void)
 Return the block position Y of the bomber.
int GetPlayer (void)
 Return the number of the player who controls this bomber.
int GetSickness (void)
 Return the bomber's sickness value.
bool CanKickBombs (void)
 Return whether the bomber is able to kick bombs.
bool CanThrowBombs (void)
 Return whether the bomber is able to throw bombs.
bool CanPunchBombs (void)
 Return whether the bomber is able to punch bombs.
bool CanRemoteFuseBombs (void)
 Return whether the bomber is able to remote fuse bombs.
int GetUsedBombsCount (void)
 Return how many bombs the bomber are currently ticking in the arena.
int GetBombItemsCount (void)
 Return how many bomb items the bomber has picked up.
int GetFlameItemsCount (void)
 Return how many flame items the bomber has picked up.
int GetRollerItemsCount (void)
 Return how many roller items the bomber has picked up.
int GetTotalBombs (void)
 Return how many bombs the bomber can currently drop.
EBomberState GetState (void)
 Return the state of the bomber.
int GetBombIndex (void)
 Return the index of the bomb the bomber is possibly holding, lifting, or punching (if the bomber is throwing, this index is -1).
bool HasExisted (void)
 Return the has existed status variable.
void ResetHasExisted (void)
 Reset the existed status variable to false.

Protected Member Functions

void SetSickness (ESick Sickness)
 Set the current sickness of the bomber.
int GetX (void)
 Get the integer X position (in pixels) of the bomber in the arena.
int GetY (void)
 Get the integer Y position (in pixels) of the bomber in the arena.

Private Member Functions

void Animate (float DeltaTime)
void ReturnItems (float DeltaTime)
 Manage the return of the items this bomber owns if he is dead.
void Action (void)
 Make the bomber perform the bomber action he was ordered.
void Contamination (void)
 Manage sickness contamination (contaminate if sick), update contamination members.
void UsedBombs (void)
 Update the number of bombs the bomber is currently using.
void Heal (void)
 Remove the bomber sickness if he is sick.
bool TryMove (float fPixels)
 Make the bomber move in the current direction (bomber move) and return if he could move.
void Die (void)
 Make the bomber start dying.
float GetBombTime (void)
 Get the current bomb time, i.e. the time left before a bomb this bomber drops will explode. It depends on current sickness.
void MakeBombFly (EBombFlightType FlightType)
 Makes the bomber's bomb fly now.

Private Attributes

CBomberMove m_BomberMove
 Bomber movement manager object.
EBomberAction m_BomberAction
 Describes the action that the owner player currently wants the bomber to perform.
EBomberAction m_LastBomberAction
 Action from last game update.
int m_Sprite
 Current bomber's sprite to display.
int m_AnimationSprites [5]
 Sprite numbers for animations, their values depend on bomber direction.
int m_Page
 Current sprite page number to use when displaying.
float m_Timer
 Time counter for general use (walk and death animation, delay...).
float m_SickTimer
 Time counter for sickness flashing animation.
int m_TotalBombs
 Number of bombs the bomber can drop together.
int m_UsedBombs
 Current number of its bombs ticking in the arena.
int m_FlameSize
 Size of the flames when one of his bombs explodes.
int m_Speed
 Current speed of the bomber in pixels per second (when not sick).
ESick m_Sickness
 Type of current sickness.
int m_NumberOfBombItems
 Number of picked up bomb items.
int m_NumberOfFlameItems
 Number of picked up flame items.
int m_NumberOfRollerItems
 Number of picked up roller items.
int m_NumberOfKickItems
 Number of picked up kick items.
int m_NumberOfThrowItems
 Number of picked up throw items.
int m_NumberOfPunchItems
 Number of picked up punch items.
int m_NumberOfRemoteItems
 Number of picked up remote controler items.
bool m_ReturnedItems
 Did the bomber return the items he picked up to the arena?
int m_Player
 Number of the player represented by the bomber.
EDead m_Dead
 Dead state : alive, dying or dead.
bool m_Victorious
 Has the bomber won the current match he is playing in?
bool m_Neighbours [MAX_PLAYERS]
 Bombers who are on the same block as this bomber.
bool m_JustGotSick
 True if the bomber just got sick.
float m_LiftingTimeElapsed
 How many seconds have elapsed since we started lifting a bomb?
float m_ThrowingTimeElapsed
 How many seconds have elapsed since we started throwing a bomb?
float m_PunchingTimeElapsed
 How many seconds have elapsed since we started punching a bomb?
float m_StuntTimeElapsed
 How many seconds have elapsed since we got stunt?
EBomberState m_BomberState
 State of the bomber, describes what he is currently doing.
int m_BombIndex
 Index of the bomb the bomber is either holding, lifting or punching (when the bomber is throwing, this index is -1).
bool m_MakeInvisible
 If true, the bomber isn't visible in the arena (used for contamination).
bool m_HasExisted
 If true, this bomber exists or has existed in this match (m_Exist is set to false after the bomber' death).
EBomberAction m_CountBomberActionDuration
float m_BomberActionDuration
bool m_dropMassBombPossible

Static Private Attributes

static SBomberSpriteTable m_BomberSpriteTables [MAX_NUMBER_OF_STATES]
 Information about the sprite table to use for each bomber state.


Detailed Description

An element in the arena which represents a bomber.

Constructor & Destructor Documentation

CBomber::CBomber ( void   ) 

Constructor (initialize the base class).

CBomber::~CBomber ( void   )  [virtual]

Destructor (uninitialize the base class).


Member Function Documentation

void CBomber::Animate ( float  DeltaTime  )  [private]

Updates the sprite to display. This function prepares the sprite table, updates stunt times, handles the punch/throw/kick animations and updates the bomber state.

See also:
m_BomberState, MakeBombFly(), Display()

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::ReturnItems ( float  DeltaTime  )  [private]

Manage the return of the items this bomber owns if he is dead.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Action ( void   )  [private]

Make the bomber perform the bomber action he was ordered.

Here is the caller graph for this function:

void CBomber::Contamination ( void   )  [private]

Manage sickness contamination (contaminate if sick), update contamination members.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::UsedBombs ( void   )  [private]

Update the number of bombs the bomber is currently using.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Heal ( void   )  [private]

Remove the bomber sickness if he is sick.

Make the bomber not sick anymore and reset the sick timer.

See also:
m_Sickness, m_SickTimer

Here is the caller graph for this function:

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

Make the bomber move in the current direction (bomber move) and return if he could move.

void CBomber::Die ( void   )  [private]

Make the bomber start dying.

Todo:
check if another else assert(0) makes sense since we still have a bomb (m_BombIndex != -1)

Here is the call graph for this function:

Here is the caller graph for this function:

float CBomber::GetBombTime ( void   )  [private]

Get the current bomb time, i.e. the time left before a bomb this bomber drops will explode. It depends on current sickness.

Get the time a bomb will tick before it will explode. The time depends on the bomber's sickness. If the bomber has the LONGBOMB or SHORTBOMB sickness, the time is adjusted.

See also:
m_Sickness

Here is the caller graph for this function:

void CBomber::MakeBombFly ( EBombFlightType  FlightType  )  [private]

Makes the bomber's bomb fly now.

Tells the bomber's bomb that it should fly now. The bomb is forced to fly to the direction the bomber is looking into (in which direction he last moved). Resets m_BombIndex so the bomber has no bomb from this time.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::SetSickness ( ESick  Sickness  )  [inline, protected]

Set the current sickness of the bomber.

Here is the caller graph for this function:

int CBomber::GetX ( void   )  [inline, protected]

Get the integer X position (in pixels) of the bomber in the arena.

Here is the call graph for this function:

Here is the caller graph for this function:

int CBomber::GetY ( void   )  [inline, protected]

Get the integer Y position (in pixels) of the bomber in the arena.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::SetArena ( CArena pArena  )  [inline, virtual]

Redefinition of the inherited method.

Reimplemented from CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Create ( int  BlockX,
int  BlockY,
int  Player,
COptions options 
)

Initialize the bomber.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Destroy ( void   ) 

Uninitialize the bomber.

Reimplemented from CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Update the bomber. Return whether the element should be deleted by the arena.

Update the bomber according to the last frametime.

Manage the bomber's movement by calling CBomberMove::Update()

Update sub-components

  • Update the number of used bombs by calling UsedBombs().

  • Drop a bomb or stop a bomb he kicked if needed by calling Action().

  • Animation (update sprite and sprite table) by calling Animate().

  • Return the items the bomber picked up if he's dead by calling ReturnItems().

The bomber can only be deleted by the arena:

  • if he's dead and
  • if he has returned the items he has picked up and
  • if all of his bombs exploded

Implements CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Display ( void   )  [virtual]

Draw the bomber sprite in the right layer.

The sprite table is prepared by Animate().

Implements CElement.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements CElement.

Here is the call graph for this function:

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

Implements CElement.

Here is the call graph for this function:

void CBomber::Command ( EBomberMove  BomberMove,
EBomberAction  BomberAction 
)

Give a move and action order to the bomber for next update.

Give orders to the bomber. The bomber stores these orders as is if he's not sick. However, a sickness makes him not understand the orders correctly, so they are modified then stored.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Victorious ( void   ) 

Tell the bomber he has won the current battle he is playing in.

Here is the caller graph for this function:

void CBomber::Burn ( void   ) 

Make the bomber react when he is burnt by an explosion.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Crush ( void   ) 

Make the bomber react when he is crushed by a wall.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::Stunt ( void   ) 

Make the bomber react when a bomb bounces on his head.

The bomber will lose one item if it has at least one. The descending order is:

  • remote control
  • punch
  • throw
  • kick
  • bomb
  • flame
  • roller The item (if any) taken from the bomber is populated to the arena so everyone can catch it.

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::ItemEffect ( EItemType  Type  ) 

Apply the effects of the specified item type on the bomber.

If the bomber is sick and picks up an item, he will now be healthy again, and the bad, bad skull item escapes from within the bomber to fly somewhere else.

If the bomber has picked up a skull item he gets sick.

See also:
m_Sickness

Here is the call graph for this function:

Here is the caller graph for this function:

void CBomber::TryKickBomb ( int  BlockX,
int  BlockY,
EBombKick  BombKick 
)

Kick a bomb if there is one on the specified block.

Here is the call graph for this function:

Here is the caller graph for this function:

int CBomber::GetFlameSize ( void   ) 

Get the current flame size of the bombs dropped by the bomber. Depends on its current sickness.

Get the current flame size of the bomber. It depends on sicknesses. If the bomber has the SMALLFLAME sickness, the bomb will have a limited falme size.

See also:
m_Sickness, m_FlameSize

Here is the caller graph for this function:

int CBomber::GetPixelsPerSecond ( void   ) 

Return the speed (in pixels per second) the bomber can walk.

Here is the caller graph for this function:

bool CBomber::IsObstacle ( int  BlockX,
int  BlockY 
)

Return whether there is a wall or a bomb on the specified block.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CBomber::IsAlive ( void   )  [inline]

Return whether the bomber is alive (not dead and not dying).

Here is the caller graph for this function:

bool CBomber::IsDying ( void   )  [inline]

Return whether the bomber is dying.

Here is the caller graph for this function:

bool CBomber::IsDead ( void   )  [inline]

Return whether the bomber is dead (but not dying).

Here is the caller graph for this function:

bool CBomber::IsActor ( void   )  [inline]

Return whether the bomber can currently do something (i.e. execute commands).

int CBomber::GetBlockX ( void   )  [inline]

Return the block position X of the bomber.

Here is the call graph for this function:

Here is the caller graph for this function:

int CBomber::GetBlockY ( void   )  [inline]

Return the block position Y of the bomber.

Here is the call graph for this function:

Here is the caller graph for this function:

int CBomber::GetPlayer ( void   )  [inline]

Return the number of the player who controls this bomber.

int CBomber::GetSickness ( void   )  [inline]

Return the bomber's sickness value.

Here is the caller graph for this function:

bool CBomber::CanKickBombs ( void   )  [inline]

Return whether the bomber is able to kick bombs.

Here is the caller graph for this function:

bool CBomber::CanThrowBombs ( void   )  [inline]

Return whether the bomber is able to throw bombs.

Here is the caller graph for this function:

bool CBomber::CanPunchBombs ( void   )  [inline]

Return whether the bomber is able to punch bombs.

Here is the caller graph for this function:

bool CBomber::CanRemoteFuseBombs ( void   )  [inline]

Return whether the bomber is able to remote fuse bombs.

The bomber can remote fuse bombs, if all of these conditions are met:

  • he has at least one remote item
  • he doesn't have one of these sicknesses: long ticking bomb, short ticking bomb, colic

If he can't remote fuse bombs, the dropped bombs will tick normally and explode after its time is up.

Here is the caller graph for this function:

int CBomber::GetUsedBombsCount ( void   )  [inline]

Return how many bombs the bomber are currently ticking in the arena.

Here is the caller graph for this function:

int CBomber::GetBombItemsCount ( void   )  [inline]

Return how many bomb items the bomber has picked up.

int CBomber::GetFlameItemsCount ( void   )  [inline]

Return how many flame items the bomber has picked up.

int CBomber::GetRollerItemsCount ( void   )  [inline]

Return how many roller items the bomber has picked up.

int CBomber::GetTotalBombs ( void   )  [inline]

Return how many bombs the bomber can currently drop.

Here is the caller graph for this function:

EBomberState CBomber::GetState ( void   )  [inline]

Return the state of the bomber.

Here is the caller graph for this function:

int CBomber::GetBombIndex ( void   )  [inline]

Return the index of the bomb the bomber is possibly holding, lifting, or punching (if the bomber is throwing, this index is -1).

Here is the caller graph for this function:

bool CBomber::HasExisted ( void   )  [inline]

Return the has existed status variable.

Here is the caller graph for this function:

void CBomber::ResetHasExisted ( void   )  [inline]

Reset the existed status variable to false.

Here is the caller graph for this function:


Member Data Documentation

Bomber movement manager object.

Describes the action that the owner player currently wants the bomber to perform.

Action from last game update.

int CBomber::m_Sprite [private]

Current bomber's sprite to display.

int CBomber::m_AnimationSprites[5] [private]

Sprite numbers for animations, their values depend on bomber direction.

int CBomber::m_Page [private]

Current sprite page number to use when displaying.

float CBomber::m_Timer [private]

Time counter for general use (walk and death animation, delay...).

float CBomber::m_SickTimer [private]

Time counter for sickness flashing animation.

int CBomber::m_TotalBombs [private]

Number of bombs the bomber can drop together.

int CBomber::m_UsedBombs [private]

Current number of its bombs ticking in the arena.

int CBomber::m_FlameSize [private]

Size of the flames when one of his bombs explodes.

int CBomber::m_Speed [private]

Current speed of the bomber in pixels per second (when not sick).

Type of current sickness.

Number of picked up bomb items.

Number of picked up flame items.

Number of picked up roller items.

Number of picked up kick items.

Number of picked up throw items.

Number of picked up punch items.

Number of picked up remote controler items.

bool CBomber::m_ReturnedItems [private]

Did the bomber return the items he picked up to the arena?

int CBomber::m_Player [private]

Number of the player represented by the bomber.

Dead state : alive, dying or dead.

bool CBomber::m_Victorious [private]

Has the bomber won the current match he is playing in?

bool CBomber::m_Neighbours[MAX_PLAYERS] [private]

Bombers who are on the same block as this bomber.

bool CBomber::m_JustGotSick [private]

True if the bomber just got sick.

How many seconds have elapsed since we started lifting a bomb?

How many seconds have elapsed since we started throwing a bomb?

How many seconds have elapsed since we started punching a bomb?

float CBomber::m_StuntTimeElapsed [private]

How many seconds have elapsed since we got stunt?

State of the bomber, describes what he is currently doing.

int CBomber::m_BombIndex [private]

Index of the bomb the bomber is either holding, lifting or punching (when the bomber is throwing, this index is -1).

Initial value:

    {
        {  5, 12 }, 
        {  7, 12 }, 
        { 58,  7 }, 
        { 59, 12 }, 
        { 60, 20 }, 
        { 61,  8 }, 
        { 62,  4 }  
    }
Information about the sprite table to use for each bomber state.

bool CBomber::m_MakeInvisible [private]

If true, the bomber isn't visible in the arena (used for contamination).

bool CBomber::m_HasExisted [private]

If true, this bomber exists or has existed in this match (m_Exist is set to false after the bomber' death).


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