Classes | Public Member Functions | Public Attributes

Player Class Reference

This class represents a player. More...

#include <Player.h>

List of all members.

Classes

struct  PlayerGameData
 Player data that needs to be reset every game should go here.
struct  PlayerPowerupData
 Player data used when a powerup is in effect.

Public Member Functions

void IncrementCycle ()
 Rotate the TetriCycle base to the right.
void DecrementCycle ()
 Rotate the TetriCycle base to the left.
void Reset ()
 Reset all state associated with this player.
int GetPowerupQueueSlot ()
 Get an open slot for storing an acquired powerup.
void QueuePowerup (Powerup *powerup, int slot)
 Adds the acquired powerup to the powerup queue.
void RemovePowerup (int slot)
 Removes an acquired powerup from the powerup queue.
int GetEffectQueueSlot ()
 Get an open slot for storing a powerup effect.
bool QueueEffect (Powerup *powerup)
 Adds a powerup to the powerup effect queue.
void QueueEffect (Powerup *powerup, int slot)
 Queue a powerup effect at the specified slot.
bool RemoveEffect (Powerup *powerup)
 Removes a powerup from the powerup effect queue.
void Update ()
 Updates the player state.
void DrawPlayfield ()
 Draw the playfield (all the static tetris pieces).
void DrawPiece (TetrisPiece *cp=NULL, u8 alpha=255)
 Draws a tetris piece.
void DrawPieceShadow ()
 Draw where the current piece will end up if dropped.
void DrawNextPiece ()
 Draw the next piece.
void DrawBase ()
 Draw the base of the TetriCycle.
void RotateCurrentPiece (int rot)
 Rotate the current piece.
bool MovePlayfield (int type)
 Move the playfield.
bool MovePiece (int type, TetrisPiece *cp=NULL)
 Moves the tetris piece in the given direction.
void DoMovement ()
 Move the current piece down automatically.
void DrawBlockAsCube (float x, float y, ColorId colorIdx, u8 alpha=255, GuiImageData *imgData=NULL, bool isGuideDot=false)
 Draw each tetris piece block as a cube.

Public Attributes

PlayerGameData gameData
 the player game data
Profile profile
 the player profile
vector< PowerupIdpowerups
 powerups that are enabled for this player
TetrisPiece currPiece
 the currently falling tetris piece
TetrisPiece nextPiece
 the next tetris piece
float cubeAngle
s16 playfieldDX
s16 playfieldDY
u8 powerupsSize
 the actual size of the powerups array
u8 playfieldWidth
u8 playfieldHeight
u8 playfieldScale
u8 id
u8 rotation
u8 guide
bool isShakeEnabled
bool isPreviewEnabled
bool isHandicapEnabled

Detailed Description

This class represents a player.

Definition at line 59 of file Player.h.


Member Function Documentation

void Player::DrawPiece ( TetrisPiece cp = NULL,
u8  alpha = 255 
)

Draws a tetris piece.

If no piece is specified, then the player's current piece is drawn.

Definition at line 102 of file Player.cpp.

int Player::GetEffectQueueSlot (  )  [inline]

Get an open slot for storing a powerup effect.

Returns:
The index of the first open slot, if one exists; else, -1.

Definition at line 200 of file Player.h.

int Player::GetPowerupQueueSlot (  )  [inline]

Get an open slot for storing an acquired powerup.

Returns:
The index of the first open slot, if one exists; else, -1.

Definition at line 173 of file Player.h.

bool Player::MovePiece ( int  type,
TetrisPiece cp = NULL 
)

Moves the tetris piece in the given direction.

If no piece is specified then the player's current piece is used.

Definition at line 282 of file Player.cpp.

bool Player::QueueEffect ( Powerup powerup  )  [inline]

Adds a powerup to the powerup effect queue.

Returns:
True if the powerup was successfully used on this player; else, false.

Definition at line 215 of file Player.h.

bool Player::RemoveEffect ( Powerup powerup  )  [inline]

Removes a powerup from the powerup effect queue.

Returns:
True if the powerup was successfully removed; else, false.

Definition at line 237 of file Player.h.


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