#include <CBomber.h>
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. |
CBomber::CBomber | ( | void | ) |
Constructor (initialize the base class).
CBomber::~CBomber | ( | void | ) | [virtual] |
Destructor (uninitialize the base class).
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.
void CBomber::ReturnItems | ( | float | DeltaTime | ) | [private] |
Manage the return of the items this bomber owns if he is dead.
void CBomber::Action | ( | void | ) | [private] |
Make the bomber perform the bomber action he was ordered.
void CBomber::Contamination | ( | void | ) | [private] |
Manage sickness contamination (contaminate if sick), update contamination members.
void CBomber::UsedBombs | ( | void | ) | [private] |
Update the number of bombs the bomber is currently using.
void CBomber::Heal | ( | void | ) | [private] |
Remove the bomber sickness if he is sick.
Make the bomber not sick anymore and reset the sick timer.
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.
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.
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.
void CBomber::SetSickness | ( | ESick | Sickness | ) | [inline, protected] |
Set the current sickness of the bomber.
int CBomber::GetX | ( | void | ) | [inline, protected] |
Get the integer X position (in pixels) of the bomber in the arena.
int CBomber::GetY | ( | void | ) | [inline, protected] |
Get the integer Y position (in pixels) of the bomber in the arena.
void CBomber::SetArena | ( | CArena * | pArena | ) | [inline, virtual] |
Redefinition of the inherited method.
Reimplemented from CElement.
void CBomber::Create | ( | int | BlockX, | |
int | BlockY, | |||
int | Player, | |||
COptions * | options | |||
) |
Initialize the bomber.
void CBomber::Destroy | ( | void | ) |
Uninitialize the bomber.
Reimplemented from CElement.
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
The bomber can only be deleted by the arena:
Implements CElement.
void CBomber::Display | ( | void | ) | [virtual] |
void CBomber::OnWriteSnapshot | ( | CArenaSnapshot & | Snapshot | ) | [virtual] |
void CBomber::OnReadSnapshot | ( | CArenaSnapshot & | Snapshot | ) | [virtual] |
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.
void CBomber::Victorious | ( | void | ) |
Tell the bomber he has won the current battle he is playing in.
void CBomber::Burn | ( | void | ) |
Make the bomber react when he is burnt by an explosion.
void CBomber::Crush | ( | void | ) |
Make the bomber react when he is crushed by a wall.
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:
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.
void CBomber::TryKickBomb | ( | int | BlockX, | |
int | BlockY, | |||
EBombKick | BombKick | |||
) |
Kick a bomb if there is one on the specified block.
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.
int CBomber::GetPixelsPerSecond | ( | void | ) |
Return the speed (in pixels per second) the bomber can walk.
bool CBomber::IsObstacle | ( | int | BlockX, | |
int | BlockY | |||
) |
Return whether there is a wall or a bomb on the specified block.
bool CBomber::IsAlive | ( | void | ) | [inline] |
Return whether the bomber is alive (not dead and not dying).
bool CBomber::IsDying | ( | void | ) | [inline] |
Return whether the bomber is dying.
bool CBomber::IsDead | ( | void | ) | [inline] |
Return whether the bomber is dead (but not dying).
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.
int CBomber::GetBlockY | ( | void | ) | [inline] |
Return the block position Y of the bomber.
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.
bool CBomber::CanKickBombs | ( | void | ) | [inline] |
Return whether the bomber is able to kick bombs.
bool CBomber::CanThrowBombs | ( | void | ) | [inline] |
Return whether the bomber is able to throw bombs.
bool CBomber::CanPunchBombs | ( | void | ) | [inline] |
Return whether the bomber is able to punch bombs.
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:
If he can't remote fuse bombs, the dropped bombs will tick normally and explode after its time is up.
int CBomber::GetUsedBombsCount | ( | void | ) | [inline] |
Return how many bombs the bomber are currently ticking in the arena.
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.
EBomberState CBomber::GetState | ( | void | ) | [inline] |
Return the state of the bomber.
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).
bool CBomber::HasExisted | ( | void | ) | [inline] |
Return the has existed status variable.
void CBomber::ResetHasExisted | ( | void | ) | [inline] |
Reset the existed status variable to false.
CBomberMove CBomber::m_BomberMove [private] |
Bomber movement manager object.
EBomberAction CBomber::m_BomberAction [private] |
Describes the action that the owner player currently wants the bomber to perform.
EBomberAction CBomber::m_LastBomberAction [private] |
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).
ESick CBomber::m_Sickness [private] |
Type of current sickness.
int CBomber::m_NumberOfBombItems [private] |
Number of picked up bomb items.
int CBomber::m_NumberOfFlameItems [private] |
Number of picked up flame items.
int CBomber::m_NumberOfRollerItems [private] |
Number of picked up roller items.
int CBomber::m_NumberOfKickItems [private] |
Number of picked up kick items.
int CBomber::m_NumberOfThrowItems [private] |
Number of picked up throw items.
int CBomber::m_NumberOfPunchItems [private] |
Number of picked up punch items.
int CBomber::m_NumberOfRemoteItems [private] |
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.
EDead CBomber::m_Dead [private] |
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.
float CBomber::m_LiftingTimeElapsed [private] |
How many seconds have elapsed since we started lifting a bomb?
float CBomber::m_ThrowingTimeElapsed [private] |
How many seconds have elapsed since we started throwing a bomb?
float CBomber::m_PunchingTimeElapsed [private] |
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?
EBomberState CBomber::m_BomberState [private] |
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).
SBomberSpriteTable CBomber::m_BomberSpriteTables [static, private] |
Initial value:
{ { 5, 12 }, { 7, 12 }, { 58, 7 }, { 59, 12 }, { 60, 20 }, { 61, 8 }, { 62, 4 } }
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).
float CBomber::m_BomberActionDuration [private] |
bool CBomber::m_dropMassBombPossible [private] |