Player Class Reference

A Player is a spriteObject that responds to input events on the DS. More...

#include <player.h>

Inherits massObject.

Inheritance diagram for Player:

Inheritance graph
[legend]
Collaboration diagram for Player:

Collaboration graph
[legend]
List of all members.

Public Types

enum  collisionState {
  CS_NONE, CS_BASICHIT, CS_INVISPLAYER, CS_TNTFALL,
  CS_GRENFALL, CS_WARPEDPLAYER, CS_SHIELDPLAYER, CS_BOOMERANG
}
 The state a Player was in when they last left the ground. More...

Public Member Functions

 Player (gameManager *newgm)
 Initialise a new Player and assign it to the gameManager that will manage it.
virtual ~Player ()
 Upon deletion, disable the Player sprite's rotation set for when the sprite OAM id is reused and destroy any Weapon they may be carrying.
void setControls (u8 nplayerNum)
 set the input system for this Player.
u8 getPlayerNum ()
 return this Players game ID, which also determines which controls they are using
void checkPad ()
 Check the DS's buttons for input and work out this Player's movement.
void basicInput (bool hr, bool hl, bool hu, bool hd, bool nr, bool nl, bool nu, bool nd, bool hf, bool nf)
 Perform basic button input on this Player.
void resetPlayer ()
 move this Player back to their spawning position and halt their movement
void freezePlayer ()
 TOTALLY FREEZE the Player, so that they cannot move at all.
void disableControls ()
 HALT INPUT, but retain motion and animation updates.
bool isDisabled ()
 check if this Player is frozen
bool readyForVictory ()
 Check if this Player is in a safe place and ready to do their victory dance animation.
virtual void updateSprite ()
 Every tick this Player must call the weapon::weaponTick() event of their current Weapon (if present).
void setStartPos (s16 x, s16 y)
 Set the round starting position for this player.
void setStartFlipped (bool f)
 Set whether or not this Player starts off flipped horizontally.
virtual void collidingWith (spriteObject *other)
 Perform high-level game logic when this Player collides with a variety of game-relevant objects.
virtual bool isColliding (const spriteObject *other, bool checkReverse=true)
 Collision check with another spriteObject.
void collideNormally (Player *o)
 Collide normally with another Player, flinging both Players away in equal and opposite directions.
bool jump (bool bootsJump=false)
 The Player attempted to jump normally, by pressing their 'up' key.
bool crouch ()
 The Player attempted to crouch normally, by pressing their 'down' key.
void bounce (bool pushedForwards=false)
 Force the Player to be pushed away from something (usually another Player) and become unstable.
bool roll (bool backwards=false)
 Force the Player to roll, for example when landing whilst unstable.
void uncrouch (bool hr, bool hl)
 Make this Player stand up after crouching.
void climbRope (bool hd)
 The Player has attempted to grab hold of a Rope.
void justlanded (bool hr, bool hl)
 A notification event that is fired when the Player lands on the ground.
void justfell ()
 The Player has just run off the edge of a baseable spriteObject.
void setUnstable (bool unst)
bool isUnstable ()
void playIdle ()
 play our idle animation when we're just standing still
void playRunning ()
 play a running animation loop when the Player is moving
void playCrouching ()
 Play the crouch animation and freeze on the last frame.
void playRolling ()
 play the rolling animation and stop on the last frame, which leaves us at crouching
void playRollingBack ()
 play the backwards roll animation and stop at a crouching position
void playJumpedStanding ()
 Play the animation for jumping straight up in the air.
void playJumpedMoving ()
 play the animation for jumping whilst running
void playFalling ()
 play an animation for falling straight down
void playPushedForward ()
 play an animation for falling when unstable and leaning forwards
void playPushedBackward ()
 play an animation for falling when unstable and leaning backwards
void playClimbingUp ()
 play an animation cycle for climbing up a Rope. Must be arbitrary animation since it freezes mid-cycle
void playClimbingDown ()
 play an animation cycle for climbing down a Rope. Must be arbitrary animation since it freezes mid-cycle
void playVictory ()
 Play a victory dance animation. This is extremely important for the game to be awesome! EXTREMELY.
void playInvis ()
 make this Player invisible but retain all collision etc
void playSkulled ()
 Play the hit by skull sound and animation.
void playDisintegrated ()
 play the animation for being obliterated
void playWarpEffect ()
 Play the spawning sound effect and green-smokey singleFireSprite.
void playSplashEffect ()
 Play a splash sound effect and marshmallow-spray singleFireSprite.
void play1000VHitEffect ()
 play a zap sound effect and electricity singleFireSprite, and fly dramatically offscreen
void playMineHitEffect ()
 explode upwards off the top of the screen
WeapongetWeapon ()
void setWeapon (Weapon *w)
void setInputInterrupt (u8 frames)
 tells the Player to stay still until this ticker expires.
void updateAnimation ()
 forces an animation update on the Player. Useful for releasing a Weapon and making the player find whatever animation it needs for the current situation.
void weaponDestroyed ()
 Weapon calls this to break the reference and record statistics when deleted.
void clearWeapon ()
 delete the Player's current Weapon
void weaponChange ()
 log the time spent holding the current Weapon when Weapons change
bool isCrouched ()
 check if this Player is low to the ground
bool isOnRope ()
 check if this Player is currently climbing on a Rope
bool justTouchingRope ()
 Check if the Player was touching a rope in the tick just before this one This can be used to check for Ropes in spriteManager::gameTick(), since Player::touchingRope is always NULL there.
virtual void setPallete (u8 id)
 Change the pallete ID of this Player.
void handleNetted (bool upPressed)
 Handle the Player's movement whilst they are stuck in a net (after being hit by a wp_net_proj).
void startNetted ()
 called immediately after this Player is hit by a wp_net_proj to put them in a net.
void stopNetted ()
 called when this Player frees themself from a net, to stop sprite rotation and refresh their bounds etc
bool isNetted ()
 Check if the Player is currently captured in a net and unable to move properly.
bool has1000V ()
 quickly check if this Player is holding the 1000 Volts pickup
bool usingChut ()
 quickly check if this Player is using the parachut to break their fall
bool hasShield ()
 quickly check if this Player is holding a shield
bool hasBoomerang ()
 quickly check if this Player is holding a boomerang
bool usingMagnet ()
 quickly check if this Player is using a magnet to pull Pickups in
bool usingInvis ()
 quickly check if this Player is currently invisible via use of the invisibility Weapon
void groundDeleted (collisionState newCollState=CS_NONE)
 Called when the ground under this Player is suddenly destroyed.
void justWarped ()
 set by warp when used, so that warp stats can be recorded for kills if they magically fluke to happen

Public Attributes

gameManagergm
 another pointer to spriteObject::sm, since we will be using a lot of gameManager functions.
u8 defaultPalleteID
 1000V needs a default pallete to be sure to return us to the right one
collisionState lastCollision
 the state of this player when they last left the ground. Reset to CS_NONE when they land again.

Static Public Attributes

static const u16 WALKSPEED = 256
 walking speed - 1 pixel per frame in fixed point format
static const u16 CLIMBSPEED = 256
 climbing speed - 1 pixel per frame in fixed point format
static const short JUMPIMPULSE = -640
 amount of instantaneous yvel to give when jump happens in fixed point format
static const s16 POWERHITSPEED = 2048
 speed the Player is flung out of the screen at when killed, in fixed point format

Protected Attributes

s8 playerNum
 this Player's game ID, which also determines their controls
bool bCrouching
 true if this Player is crouched
bool bRolling
 true if this Player is rolling
bool bUnstable
 if true, the Player must roll when landing
bool justJumped
 true when leaving the ground by normal means, to prevent Player::justFell() from executing
bool bIgnoreInput
 if true, no keypresses will have an effect (used for round end)
s16 startx
s16 starty
bool startFlipped
RopetouchingRope
 the PARENT Rope being climbed - NULL when not climbing
RopewasTouchingRope
 same as Player::touchingRope, but this can be checked against in the spriteManager::gameTick() cycle
bool bClimbingRope
 true if the Player is touching a Rope as well as climbing it
WeaponcurrWeapon
 the current Weapon this Player has equipped
u8 inputInterrupt
 this is the numer of ticks until the Player can move again
bool forceAnimUpdate
 force the Player to restart potentially old animations, to kill weapon anims
u32 lastWeaponChangeTime
 time that the last Weapon change happened
bool weaponJustCleared
 Player::currWeapon was just cleared - stops a double check when deleting old weapon.
u8 nettedStrength
 how many clicks are still needed to break free from net (if 0, not netted)
bool bJustUnwarped
 true if warp was used and haven't touched the ground yet

Static Protected Attributes

static const s8 standingBounds []
 the bounding box for a Player when they are standing upright
static const s8 fallingBounds []
 the bounding box for a Player when they are in midair
static const s8 crouchingBounds []
 the bounding box for a Player when they are crouching
static const s8 NETJUMPIMPULSE = -100
 barely a jump, just something to let the player know they pressed it.
static const s8 NETSPINSPEED = -20
 relation between sprite rotation and movement velocity whilst in the net
static const u8 NETROLLDECEL = 2
 x-axis deceleration to be applied every tick whilst in the net

Detailed Description

A Player is a spriteObject that responds to input events on the DS.

Players can run, jump, crouch, roll, bounce into each other, trip over, climb ropes, use Weapons and die. Oh yes, they can die in quite a plethora of ways.

Once a Player dies, a round is over. The winning Player must wait until it comes to rest before scores are allocated however, so ties can easily happen.

When in the air, Players have two distinct behaviours - stable and unstable. Stable Players land on their feet nicely and don't go anywhere. Unstable Players however, flail around wildly in the air and roll upon landing. Pushing another Player by running into them the right way makes them unstable.

Author:
pospi

Definition at line 52 of file player.h.


Member Enumeration Documentation

enum Player::collisionState

The state a Player was in when they last left the ground.

A Player's collision state is very important for statistics recording, so that the last thing that happened to them before they drowned can be recorded.

Enumerator:
CS_NONE 
CS_BASICHIT 
CS_INVISPLAYER 
CS_TNTFALL 
CS_GRENFALL 
CS_WARPEDPLAYER 
CS_SHIELDPLAYER 
CS_BOOMERANG 

Definition at line 227 of file player.h.


Constructor & Destructor Documentation

Player::Player ( gameManager newgm  ) 

Initialise a new Player and assign it to the gameManager that will manage it.

Parameters:
newgm the gameManager to handle this Player

Definition at line 64 of file player.cpp.

References spriteObject::COL_SOLID, gm, lastWeaponChangeTime, spriteObject::setBounds(), spriteObject::setCheckCollision(), spriteObject::setCollision(), spriteObject::setLayer(), standingBounds, and gameManager::statTimerID.

Here is the call graph for this function:

Player::~Player (  )  [virtual]

Upon deletion, disable the Player sprite's rotation set for when the sprite OAM id is reused and destroy any Weapon they may be carrying.

Definition at line 88 of file player.cpp.

References clearWeapon(), gm, spriteManager::screen, and spriteObject::spriteID.

Here is the call graph for this function:


Member Function Documentation

void Player::setControls ( u8  nplayerNum  ) 

set the input system for this Player.

Parameters:
playerNum the type of controls for this Player:
  • -1 = disabled (for pausing input)
  • 0 = singleplayer (dpad and A button)
  • 1 = hotseat, p1 (dpad and L)
  • 2 = hotseat, p2 (ABXY and R)
  • 3 TODO: will eventually be a remote player

Definition at line 112 of file player.cpp.

References playerNum.

Referenced by gameManager::resetGame().

u8 Player::getPlayerNum (  )  [inline]

return this Players game ID, which also determines which controls they are using

Definition at line 61 of file player.h.

References playerNum.

void Player::checkPad (  ) 

Check the DS's buttons for input and work out this Player's movement.

Definition at line 124 of file player.cpp.

References basicInput(), HA, HB, HD, HL, HLT, HR, HRT, HU, HX, HY, inputInterrupt, NA, NB, ND, NL, NLT, NR, NRT, NU, NX, NY, playerNum, touchingRope, and wasTouchingRope.

Referenced by gameManager::gameTick().

Here is the call graph for this function:

void Player::basicInput ( bool  hr,
bool  hl,
bool  hu,
bool  hd,
bool  nr,
bool  nl,
bool  nu,
bool  nd,
bool  hf,
bool  nf 
)

Perform basic button input on this Player.

This handles all logic on how the Player should move and control.

Parameters:
hr whether or not the 'right' button is being held
hl whether or not the 'left' button is being held
hu whether or not the 'up' button is being held
hd whether or not the 'down' button is being held
nr whether or not the 'right' button is newly pressed
nl whether or not the 'left' button is newly pressed
nu whether or not the 'up' button is newly pressed
nd whether or not the 'down' button is newly pressed
hf whether or not the 'fire' button is being held
nf whether or not the 'fire' button is newly pressed

Definition at line 166 of file player.cpp.

References spriteObject::arbitraryAnim, bClimbingRope, bCrouching, bJustUnwarped, bounce(), bRolling, bUnstable, Rope::childRopes, climbRope(), CLIMBSPEED, crouch(), CS_NONE, currWeapon, Weapon::fire(), spriteObject::flippedh, forceAnimUpdate, spriteObject::frame, spriteObject::getBottom(), spriteObject::getFlippedv(), spriteObject::getLeft(), spriteObject::getRight(), spriteObject::getTop(), handleNetted(), inputInterrupt, Weapon::isFiring(), massObject::isOnGround(), isOnRope(), jump(), justfell(), justJumped, justlanded(), lastCollision, nettedStrength, playClimbingDown(), playClimbingUp(), playFalling(), playIdle(), playPushedForward(), playRunning(), spriteObject::setFlipped(), spriteObject::setFrame(), Weapon::stopFiring(), touchingRope, uncrouch(), usingChut(), spriteObject::vx, spriteObject::vy, WALKSPEED, and massObject::wasOnGround().

Referenced by checkPad().

Here is the call graph for this function:

void Player::resetPlayer (  )  [inline]

move this Player back to their spawning position and halt their movement

Definition at line 67 of file player.h.

References playIdle(), spriteObject::setBasePos(), spriteObject::setFlipped(), spriteObject::setPos(), spriteObject::setSpeed(), startFlipped, startx, and starty.

Here is the call graph for this function:

void Player::freezePlayer (  )  [inline]

TOTALLY FREEZE the Player, so that they cannot move at all.

Definition at line 70 of file player.h.

References massObject::bStasis, spriteObject::COL_NONE, playerNum, spriteObject::setCheckCollision(), spriteObject::setCollision(), spriteObject::vx, and spriteObject::vy.

Referenced by gameManager::playerDied(), and playVictory().

Here is the call graph for this function:

void Player::disableControls (  )  [inline]

HALT INPUT, but retain motion and animation updates.

Definition at line 73 of file player.h.

References bIgnoreInput.

Referenced by gameManager::playerDied().

bool Player::isDisabled (  )  [inline]

check if this Player is frozen

Returns:
true if the Player cannot be moved, false otherwise

Definition at line 79 of file player.h.

References massObject::bStasis, and playerNum.

Referenced by gameManager::gameTick(), wp_boomerang_proj::returnTick(), and wp_boomerang_proj::updateSprite().

bool Player::readyForVictory (  ) 

Check if this Player is in a safe place and ready to do their victory dance animation.

Returns:
true if the Player is ready for a bit of a dance, false otherwise.

Definition at line 835 of file player.cpp.

References bClimbingRope, bCrouching, bRolling, massObject::bStasis, bUnstable, inputInterrupt, and massObject::isOnGround().

Referenced by gameManager::gameTick().

Here is the call graph for this function:

void Player::updateSprite (  )  [virtual]

Every tick this Player must call the weapon::weaponTick() event of their current Weapon (if present).

Additionally checks if the Player is outside the screen and dead, and in such a case stops them from moving to prevent their sprite from wrapping the DS's screen. If the player has fallen off the bottom of the screen, notify their gameManager that they sank.

Reimplemented from massObject.

Definition at line 625 of file player.cpp.

References massObject::bStasis, currWeapon, spriteObject::getx(), spriteObject::gety(), gm, gameManager::playerSank(), spriteObject::SCREENH, spriteObject::SCREENW, spriteObject::setvx(), spriteObject::setvy(), massObject::updateSprite(), Weapon::weaponTick(), and spriteObject::y.

Here is the call graph for this function:

void Player::setStartPos ( s16  x,
s16  y 
) [inline]

Set the round starting position for this player.

The Player will move to this position every time a new round begins.

Parameters:
x the x screen position (in pixels) where this Player will spawn
y the y screen position (in pixels) where this Player's BASE (feet) will be

Definition at line 91 of file player.h.

References spriteObject::setBasePos(), spriteObject::setPos(), startx, and starty.

Referenced by gameManager::resetGame().

Here is the call graph for this function:

void Player::setStartFlipped ( bool  f  )  [inline]

Set whether or not this Player starts off flipped horizontally.

Parameters:
f true if the Player should start flipped, false otherwise

Definition at line 97 of file player.h.

References spriteObject::setFlipped(), and startFlipped.

Referenced by gameManager::resetGame().

Here is the call graph for this function:

void Player::collidingWith ( spriteObject other  )  [virtual]

Perform high-level game logic when this Player collides with a variety of game-relevant objects.

Handles Player pushing, Pickup collisions, Rope climbing and deaths by lethal objects.

Parameters:
other a reference to a spriteObject that this Player is colliding with

Reimplemented from massObject.

Definition at line 375 of file player.cpp.

References bClimbingRope, bCrouching, bJustUnwarped, wp_boomerang::boomerangReturned(), bounce(), bRolling, clearWeapon(), collideNormally(), massObject::collidingWith(), CS_BASICHIT, CS_BOOMERANG, CS_INVISPLAYER, CS_SHIELDPLAYER, CS_WARPEDPLAYER, currWeapon, spriteObject::destroy(), Rope::getParent(), Pickup::getType(), spriteObject::getvx(), spriteObject::getx(), gm, gameManager::gotPickup, has1000V(), hasBoomerang(), hasShield(), spriteObject::ignoreUntilUntouched, spriteObject::isFacing(), Weapon::isFiring(), JUMPIMPULSE, lastCollision, wp_boomerang_proj::owner, gameManager::playerLightningd(), gameManager::playerMined(), Pickup::playerTouchAction(), gameManager::playerWeaseled(), spriteObject::playSound(), Pickup::PT_TNT, wp_boomerang_proj::returnToPlayer(), Rope::ROPETOLERANCE, spriteObject::setvx(), startNetted(), Weapon::stopFiring(), spriteObject::stopSound(), touchingRope, usingInvis(), spriteObject::vx, spriteObject::vy, massObject::wasOnGround(), and wp_boomerang_proj::weapon.

Here is the call graph for this function:

bool Player::isColliding ( const spriteObject other,
bool  checkReverse = true 
) [virtual]

Collision check with another spriteObject.

The Player cannot be colliding with a Pickup of type Pickup::PT_TNT, so in this case the collision always returns false.

Parameters:
other the spriteObject to compare with
checkReverse whether or not to compute collision for the complementary spriteObject
Returns:
true if this spriteObject is colliding with other, false otherwise.

Definition at line 595 of file player.cpp.

References Pickup::getType(), spriteObject::isColliding(), and Pickup::PT_TNT.

Here is the call graph for this function:

void Player::collideNormally ( Player o  ) 

Collide normally with another Player, flinging both Players away in equal and opposite directions.

Parameters:
o a reference to the Player who bumped into this one

Definition at line 609 of file player.cpp.

References bClimbingRope, bounce(), spriteObject::flippedh, spriteObject::getx(), spriteObject::gety(), JUMPIMPULSE, and spriteObject::vy.

Referenced by collidingWith().

Here is the call graph for this function:

bool Player::jump ( bool  bootsJump = false  ) 

The Player attempted to jump normally, by pressing their 'up' key.

Parameters:
bootsJump true if the Player has fired their boots, in which case they will jump much higher
Returns:
true if the Player was able to jump, false otherwise (not on the ground etc)

Definition at line 656 of file player.cpp.

References bCrouching, bRolling, fallingBounds, massObject::isOnGround(), JUMPIMPULSE, justJumped, playJumpedMoving(), playJumpedStanding(), spriteObject::setBounds(), spriteObject::vx, and spriteObject::vy.

Referenced by basicInput(), and wp_boot::weaponFireAction().

Here is the call graph for this function:

bool Player::crouch (  ) 

The Player attempted to crouch normally, by pressing their 'down' key.

Returns:
true if the Player was able to crouch, false otherwise (not on the ground etc)

Definition at line 679 of file player.cpp.

References bCrouching, bUnstable, crouchingBounds, massObject::isOnGround(), playCrouching(), roll(), spriteObject::setBounds(), and spriteObject::vx.

Referenced by basicInput().

Here is the call graph for this function:

void Player::bounce ( bool  pushedForwards = false  ) 

Force the Player to be pushed away from something (usually another Player) and become unstable.

Parameters:
pushedForwards true if the Player has 'tripped' and fallen forwards instead of backwards

Definition at line 717 of file player.cpp.

References bClimbingRope, bCrouching, bRolling, bUnstable, currWeapon, fallingBounds, spriteObject::flippedh, Weapon::isFiring(), massObject::isOnGround(), JUMPIMPULSE, justJumped, playPushedBackward(), playPushedForward(), spriteObject::setBounds(), Weapon::stopFiring(), spriteObject::vx, spriteObject::vy, and WALKSPEED.

Referenced by basicInput(), collideNormally(), and collidingWith().

Here is the call graph for this function:

bool Player::roll ( bool  backwards = false  ) 

Force the Player to roll, for example when landing whilst unstable.

Returns:
true if the Player was able to roll, false otherwise (not on the ground etc)

Definition at line 697 of file player.cpp.

References bCrouching, bRolling, bUnstable, crouchingBounds, massObject::isOnGround(), playRolling(), playRollingBack(), and spriteObject::setBounds().

Referenced by crouch(), and justlanded().

Here is the call graph for this function:

void Player::uncrouch ( bool  hr,
bool  hl 
)

Make this Player stand up after crouching.

Resets bounds and animations and flips them based on the direction keys being pressed.

Parameters:
hr whether or not the Player's right input key is being held at the time of uncrouching
hl whether or not the Player's left input key is being held at the time of uncrouching

Definition at line 747 of file player.cpp.

References bCrouching, spriteObject::flippedh, spriteObject::flippedv, spriteObject::ignoreUntilUntouched, playRunning(), spriteObject::setBounds(), spriteObject::setFlipped(), and standingBounds.

Referenced by basicInput().

Here is the call graph for this function:

void Player::climbRope ( bool  hd  ) 

The Player has attempted to grab hold of a Rope.

Make them climb it!

Parameters:
hd true if the Player's down input key is held. This determines the animation to play.

Definition at line 763 of file player.cpp.

References bClimbingRope, spriteObject::getx(), spriteObject::gety(), playClimbingDown(), playClimbingUp(), spriteObject::setPos(), touchingRope, and wasTouchingRope.

Referenced by basicInput(), and wp_hook::weaponFireAction().

Here is the call graph for this function:

void Player::justlanded ( bool  hr,
bool  hl 
)

A notification event that is fired when the Player lands on the ground.

If the Player is unstable, make them roll. Otherwise return them to a normal running state.

Parameters:
hr whether or not the Player's right input key is being held at the time of landing
hl whether or not the Player's left input key is being held at the time of landing

Definition at line 782 of file player.cpp.

References bJustUnwarped, bUnstable, CS_NONE, spriteObject::flippedh, spriteObject::flippedv, lastCollision, playRunning(), roll(), spriteObject::setBounds(), spriteObject::setFlipped(), standingBounds, and spriteObject::vx.

Referenced by basicInput().

Here is the call graph for this function:

void Player::justfell (  ) 

The Player has just run off the edge of a baseable spriteObject.

Make them lose control of their x velocity, play a falling animation and set their bounds to Player::fallingBounds.

Definition at line 801 of file player.cpp.

References bCrouching, bRolling, bUnstable, fallingBounds, spriteObject::flippedh, playFalling(), playPushedBackward(), playPushedForward(), and spriteObject::setBounds().

Referenced by basicInput(), and groundDeleted().

Here is the call graph for this function:

void Player::setUnstable ( bool  unst  )  [inline]

Definition at line 113 of file player.h.

References bUnstable.

Referenced by wp_chut::stopFiring(), and wp_chut::weaponFireAction().

bool Player::isUnstable (  )  [inline]

Definition at line 114 of file player.h.

References bUnstable.

void Player::playIdle (  )  [inline]

play our idle animation when we're just standing still

Definition at line 118 of file player.h.

References spriteObject::setFrame().

Referenced by basicInput(), and resetPlayer().

Here is the call graph for this function:

void Player::playRunning (  )  [inline]

play a running animation loop when the Player is moving

Definition at line 120 of file player.h.

References spriteObject::ANIMSPEED, and spriteObject::setAnim().

Referenced by basicInput(), justlanded(), uncrouch(), and wp_invis::~wp_invis().

Here is the call graph for this function:

void Player::playCrouching (  ) 

Play the crouch animation and freeze on the last frame.

Definition at line 868 of file player.cpp.

References spriteObject::setArbitraryAnim().

Referenced by crouch().

Here is the call graph for this function:

void Player::playRolling (  ) 

play the rolling animation and stop on the last frame, which leaves us at crouching

Definition at line 892 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by roll().

Here is the call graph for this function:

void Player::playRollingBack (  ) 

play the backwards roll animation and stop at a crouching position

Definition at line 900 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by roll().

Here is the call graph for this function:

void Player::playJumpedStanding (  ) 

Play the animation for jumping straight up in the air.

Definition at line 876 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by jump().

Here is the call graph for this function:

void Player::playJumpedMoving (  ) 

play the animation for jumping whilst running

Definition at line 884 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by jump().

Here is the call graph for this function:

void Player::playFalling (  )  [inline]

play an animation for falling straight down

Definition at line 127 of file player.h.

References spriteObject::setFrame().

Referenced by basicInput(), and justfell().

Here is the call graph for this function:

void Player::playPushedForward (  )  [inline]

play an animation for falling when unstable and leaning forwards

Definition at line 129 of file player.h.

References spriteObject::ANIMSPEED, and spriteObject::setAnim().

Referenced by basicInput(), bounce(), and justfell().

Here is the call graph for this function:

void Player::playPushedBackward (  )  [inline]

play an animation for falling when unstable and leaning backwards

Definition at line 131 of file player.h.

References spriteObject::ANIMSPEED, and spriteObject::setAnim().

Referenced by bounce(), and justfell().

Here is the call graph for this function:

void Player::playClimbingUp (  ) 

play an animation cycle for climbing up a Rope. Must be arbitrary animation since it freezes mid-cycle

Definition at line 916 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by basicInput(), and climbRope().

Here is the call graph for this function:

void Player::playClimbingDown (  ) 

play an animation cycle for climbing down a Rope. Must be arbitrary animation since it freezes mid-cycle

Definition at line 908 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by basicInput(), and climbRope().

Here is the call graph for this function:

void Player::playVictory (  ) 

Play a victory dance animation. This is extremely important for the game to be awesome! EXTREMELY.

Definition at line 844 of file player.cpp.

References bClimbingRope, menuBottom::dieWhileDancing, freezePlayer(), gm, gameManager::menuBase, and spriteObject::setArbitraryAnim().

Referenced by gameManager::gameTick().

Here is the call graph for this function:

void Player::playInvis (  )  [inline]

make this Player invisible but retain all collision etc

Definition at line 137 of file player.h.

References spriteObject::setFrame().

Referenced by gameManager::playerDiedSilently(), and wp_invis::weaponTick().

Here is the call graph for this function:

void Player::playSkulled (  ) 

Play the hit by skull sound and animation.

Definition at line 1025 of file player.cpp.

References gm, spriteObject::playSound(), spriteObject::setArbitraryAnim(), gameManager::skullPickup, and spriteObject::TICKSPERFRAME.

Referenced by gameManager::playerSkulled().

Here is the call graph for this function:

void Player::playDisintegrated (  ) 

play the animation for being obliterated

Definition at line 1036 of file player.cpp.

References spriteObject::setArbitraryAnim(), and spriteObject::TICKSPERFRAME.

Referenced by gameManager::playerDisintegrated(), and gameManager::playerWeaseled().

Here is the call graph for this function:

void Player::playWarpEffect (  ) 

Play the spawning sound effect and green-smokey singleFireSprite.

Definition at line 1003 of file player.cpp.

References spriteManager::createSingleFireSprite(), gameManager::FXSprite, spriteObject::getx(), spriteObject::gety(), gm, gameManager::player1, spriteObject::playSound(), gameManager::spawnGFX, gameManager::teleport, and spriteObject::TICKSPERFRAME.

Referenced by wp_warp::weaponFireAction().

Here is the call graph for this function:

void Player::playSplashEffect (  ) 

Play a splash sound effect and marshmallow-spray singleFireSprite.

Definition at line 1014 of file player.cpp.

References gameManager::bigSplash, spriteManager::createSingleFireSprite(), gameManager::FXSprite, spriteObject::getx(), gm, gameManager::MALLOWYPOS, gameManager::player1, spriteObject::playSound(), gameManager::spawnGFX, and spriteObject::TICKSPERFRAME.

Referenced by gameManager::playerSank().

Here is the call graph for this function:

void Player::play1000VHitEffect (  ) 

play a zap sound effect and electricity singleFireSprite, and fly dramatically offscreen

Definition at line 1044 of file player.cpp.

References spriteManager::createSingleFireSprite(), gameManager::FXSprite, spriteObject::getx(), spriteObject::gety(), gm, JUMPIMPULSE, gameManager::lightningHit, gameManager::player1, gameManager::player2, spriteObject::playSound(), POWERHITSPEED, spriteObject::setFrame(), gameManager::spawnGFX, spriteObject::TICKSPERFRAME, spriteObject::vx, and spriteObject::vy.

Referenced by gameManager::playerLightningd().

Here is the call graph for this function:

void Player::playMineHitEffect (  ) 

explode upwards off the top of the screen

Definition at line 1062 of file player.cpp.

References POWERHITSPEED, spriteObject::setFrame(), and spriteObject::vy.

Referenced by gameManager::playerMined(), and gameManager::playerPucked().

Here is the call graph for this function:

Weapon* Player::getWeapon (  )  [inline]

Definition at line 146 of file player.h.

References currWeapon.

Referenced by wp_magnet::popOutPawnWeapon(), wp_magnet::weaponFireAction(), and wp_gun::weaponFireAction().

void Player::setWeapon ( Weapon w  )  [inline]

Definition at line 147 of file player.h.

References clearWeapon(), and currWeapon.

Here is the call graph for this function:

void Player::setInputInterrupt ( u8  frames  )  [inline]

tells the Player to stay still until this ticker expires.

Mostly used by Weapons to play firing animations and keep the Player fixed until they have performed whatever action it is.

Parameters:
frames the number of frames the Player should stay still for

Definition at line 155 of file player.h.

References forceAnimUpdate, and inputInterrupt.

Referenced by Weapon::handleMovementAndAmmo(), wp_magnet::weaponFireAction(), and wp_gun::weaponFireAction().

void Player::updateAnimation (  )  [inline]

forces an animation update on the Player. Useful for releasing a Weapon and making the player find whatever animation it needs for the current situation.

Definition at line 157 of file player.h.

References forceAnimUpdate.

Referenced by gameManager::gameTick(), wp_magnet::weaponTick(), wp_hook::weaponTick(), wp_chut::weaponTick(), wp_chut::~wp_chut(), wp_hook::~wp_hook(), wp_magnet::~wp_magnet(), wp_mine::~wp_mine(), and wp_weasel::~wp_weasel().

void Player::weaponDestroyed (  )  [inline]

Weapon calls this to break the reference and record statistics when deleted.

Definition at line 160 of file player.h.

References currWeapon, weaponChange(), and weaponJustCleared.

Referenced by Weapon::~Weapon().

Here is the call graph for this function:

void Player::clearWeapon (  ) 

delete the Player's current Weapon

Definition at line 927 of file player.cpp.

References currWeapon, weaponChange(), and weaponJustCleared.

Referenced by collidingWith(), gameManager::gameTick(), wp_magnet::popOutPawnWeapon(), setWeapon(), and ~Player().

Here is the call graph for this function:

void Player::weaponChange (  ) 

log the time spent holding the current Weapon when Weapons change

Definition at line 940 of file player.cpp.

References currWeapon, Weapon::getType(), gm, gameManager::isGamePaused(), lastWeaponChangeTime, gameManager::menuBase, gameManager::player1, menuBottom::player1id, menuBottom::player2id, menuBottom::scoreTime(), and gameManager::statTimerID.

Referenced by clearWeapon(), and weaponDestroyed().

Here is the call graph for this function:

bool Player::isCrouched (  )  [inline]

check if this Player is low to the ground

Returns:
true if crouching or rolling, false otherwise

Definition at line 170 of file player.h.

References bCrouching, and bRolling.

Referenced by Weapon::fire(), and wp_magnet::weaponTick().

bool Player::isOnRope (  )  [inline]

check if this Player is currently climbing on a Rope

Returns:
true if currently on a Rope, false otherwise

Definition at line 175 of file player.h.

References bClimbingRope.

Referenced by basicInput(), Weapon::fire(), wp_shield::weaponTick(), and wp_hook::weaponTick().

bool Player::justTouchingRope (  )  [inline]

Check if the Player was touching a rope in the tick just before this one This can be used to check for Ropes in spriteManager::gameTick(), since Player::touchingRope is always NULL there.

Returns:
true if just touching a rope, false otherwise

Definition at line 182 of file player.h.

References wasTouchingRope.

Referenced by wp_hook::weaponFireAction().

virtual void Player::setPallete ( u8  id  )  [inline, virtual]

Change the pallete ID of this Player.

To be used by the 1000 Volts pickup.

Parameters:
id the spriteManager preloaded ID of the new pallete

Reimplemented from spriteObject.

Definition at line 200 of file player.h.

References defaultPalleteID, and spriteObject::palleteID.

Referenced by gameManager::resetGame().

void Player::handleNetted ( bool  upPressed  ) 

Handle the Player's movement whilst they are stuck in a net (after being hit by a wp_net_proj).

Parameters:
upPressed true if the Player's controller just tapped the jump key

Definition at line 321 of file player.cpp.

References spriteObject::getx(), massObject::isOnGround(), NETJUMPIMPULSE, NETROLLDECEL, NETSPINSPEED, nettedStrength, spriteObject::setFrame(), spriteObject::setRotation(), stopNetted(), spriteObject::vx, and spriteObject::vy.

Referenced by basicInput().

Here is the call graph for this function:

void Player::startNetted (  ) 

called immediately after this Player is hit by a wp_net_proj to put them in a net.

Whilst in a net, the Player roll around and has no control over their sideways movement and can only jump a little bit. Each jump weakens the net and they will eventually break free after a few presses.

Definition at line 348 of file player.cpp.

References bClimbingRope, crouchingBounds, spriteObject::enableRotation(), nettedStrength, and spriteObject::setBounds().

Referenced by collidingWith().

Here is the call graph for this function:

void Player::stopNetted (  ) 

called when this Player frees themself from a net, to stop sprite rotation and refresh their bounds etc

Definition at line 359 of file player.cpp.

References spriteObject::disableRotation(), spriteObject::flippedh, nettedStrength, spriteObject::setBounds(), spriteObject::setFlipped(), and standingBounds.

Referenced by handleNetted(), and gameManager::playerDied().

Here is the call graph for this function:

bool Player::isNetted (  )  [inline]

Check if the Player is currently captured in a net and unable to move properly.

Returns:
true if netted, false otherwise

Definition at line 212 of file player.h.

References nettedStrength.

Referenced by gameManager::playerSank().

bool Player::has1000V (  ) 

quickly check if this Player is holding the 1000 Volts pickup

Definition at line 963 of file player.cpp.

References currWeapon.

Referenced by collidingWith().

bool Player::usingChut (  ) 

quickly check if this Player is using the parachut to break their fall

Definition at line 976 of file player.cpp.

References currWeapon, and Weapon::isFiring().

Referenced by basicInput().

Here is the call graph for this function:

bool Player::hasShield (  ) 

quickly check if this Player is holding a shield

Definition at line 969 of file player.cpp.

References bClimbingRope, and currWeapon.

Referenced by wp_puck_proj::collidingWith(), and collidingWith().

bool Player::hasBoomerang (  ) 

quickly check if this Player is holding a boomerang

Definition at line 982 of file player.cpp.

References currWeapon.

Referenced by collidingWith(), wp_boomerang_proj::returnTick(), and wp_boomerang_proj::updateSprite().

bool Player::usingMagnet (  ) 

quickly check if this Player is using a magnet to pull Pickups in

Definition at line 988 of file player.cpp.

References currWeapon, and Weapon::isFiring().

Referenced by gameManager::playerSkulled().

Here is the call graph for this function:

bool Player::usingInvis (  ) 

quickly check if this Player is currently invisible via use of the invisibility Weapon

Definition at line 994 of file player.cpp.

References currWeapon, and Weapon::getAmmo().

Referenced by collidingWith().

Here is the call graph for this function:

void Player::groundDeleted ( collisionState  newCollState = CS_NONE  ) 

Called when the ground under this Player is suddenly destroyed.

Mainly used to determine their cause of death if they should drown.

Parameters:
newCollState the collision state to set this Player to when they start falling

Definition at line 822 of file player.cpp.

References spriteObject::getx(), spriteObject::gety(), justfell(), lastCollision, and spriteObject::setPos().

Referenced by Pickup::collidingWith(), and wp_gren_proj::updateSprite().

Here is the call graph for this function:

void Player::justWarped (  )  [inline]

set by warp when used, so that warp stats can be recorded for kills if they magically fluke to happen

Definition at line 238 of file player.h.

References bJustUnwarped.


Member Data Documentation

gameManager* Player::gm

another pointer to spriteObject::sm, since we will be using a lot of gameManager functions.

Definition at line 185 of file player.h.

Referenced by wp_puck_proj::collidingWith(), collidingWith(), wp_shield::equipAction(), wp_dunce::equipAction(), wp_boot::equipAction(), play1000VHitEffect(), Player(), playSkulled(), playSplashEffect(), playVictory(), playWarpEffect(), wp_magnet::popOutPawnWeapon(), wp_chut::stopFiring(), wp_weasel_proj::updateSprite(), wp_puck_proj::updateSprite(), wp_gren_proj::updateSprite(), wp_boomerang_proj::updateSprite(), updateSprite(), weaponChange(), wp_weasel::weaponFireAction(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_mine::weaponFireAction(), wp_magnet::weaponFireAction(), wp_invis::weaponFireAction(), wp_hook::weaponFireAction(), wp_gun::weaponFireAction(), wp_gren::weaponFireAction(), wp_chut::weaponFireAction(), wp_boot::weaponFireAction(), wp_boomerang::weaponFireAction(), wp_1000V::weaponTick(), ~Player(), wp_gren_proj::~wp_gren_proj(), and wp_puck_proj::~wp_puck_proj().

const u16 Player::WALKSPEED = 256 [static]

walking speed - 1 pixel per frame in fixed point format

Definition at line 188 of file player.h.

Referenced by basicInput(), bounce(), wp_magnet::popOutPawnWeapon(), wp_puck::weaponFireAction(), wp_net::weaponFireAction(), wp_gren::weaponFireAction(), and wp_boomerang::weaponFireAction().

const u16 Player::CLIMBSPEED = 256 [static]

climbing speed - 1 pixel per frame in fixed point format

Definition at line 190 of file player.h.

Referenced by basicInput().

const short Player::JUMPIMPULSE = -640 [static]

amount of instantaneous yvel to give when jump happens in fixed point format

Definition at line 192 of file player.h.

Referenced by bounce(), collideNormally(), collidingWith(), jump(), play1000VHitEffect(), wp_hook::weaponFireAction(), and wp_gren::weaponFireAction().

const s16 Player::POWERHITSPEED = 2048 [static]

speed the Player is flung out of the screen at when killed, in fixed point format

Definition at line 194 of file player.h.

Referenced by play1000VHitEffect(), and playMineHitEffect().

u8 Player::defaultPalleteID

1000V needs a default pallete to be sure to return us to the right one

Definition at line 202 of file player.h.

Referenced by setPallete(), and wp_1000V::wp_1000V().

collisionState Player::lastCollision

the state of this player when they last left the ground. Reset to CS_NONE when they land again.

Definition at line 232 of file player.h.

Referenced by basicInput(), collidingWith(), groundDeleted(), justlanded(), gameManager::playerSank(), and gameManager::playerSkulled().

const s8 Player::standingBounds [static, protected]

the bounding box for a Player when they are standing upright

Definition at line 240 of file player.h.

Referenced by justlanded(), Player(), stopNetted(), and uncrouch().

const s8 Player::fallingBounds [static, protected]

the bounding box for a Player when they are in midair

Definition at line 241 of file player.h.

Referenced by bounce(), jump(), and justfell().

const s8 Player::crouchingBounds [static, protected]

the bounding box for a Player when they are crouching

Definition at line 242 of file player.h.

Referenced by crouch(), roll(), and startNetted().

s8 Player::playerNum [protected]

this Player's game ID, which also determines their controls

Definition at line 245 of file player.h.

Referenced by checkPad(), freezePlayer(), getPlayerNum(), isDisabled(), and setControls().

bool Player::bCrouching [protected]

true if this Player is crouched

Definition at line 248 of file player.h.

Referenced by basicInput(), bounce(), collidingWith(), crouch(), isCrouched(), jump(), justfell(), readyForVictory(), roll(), and uncrouch().

bool Player::bRolling [protected]

true if this Player is rolling

Definition at line 250 of file player.h.

Referenced by basicInput(), bounce(), collidingWith(), isCrouched(), jump(), justfell(), readyForVictory(), and roll().

bool Player::bUnstable [protected]

if true, the Player must roll when landing

Definition at line 252 of file player.h.

Referenced by basicInput(), bounce(), crouch(), isUnstable(), justfell(), justlanded(), readyForVictory(), roll(), and setUnstable().

bool Player::justJumped [protected]

true when leaving the ground by normal means, to prevent Player::justFell() from executing

Definition at line 254 of file player.h.

Referenced by basicInput(), bounce(), and jump().

bool Player::bIgnoreInput [protected]

if true, no keypresses will have an effect (used for round end)

Definition at line 257 of file player.h.

Referenced by disableControls().

s16 Player::startx [protected]

Definition at line 259 of file player.h.

Referenced by resetPlayer(), and setStartPos().

s16 Player::starty [protected]

Definition at line 259 of file player.h.

Referenced by resetPlayer(), and setStartPos().

bool Player::startFlipped [protected]

Definition at line 260 of file player.h.

Referenced by resetPlayer(), and setStartFlipped().

Rope* Player::touchingRope [protected]

the PARENT Rope being climbed - NULL when not climbing

Definition at line 263 of file player.h.

Referenced by basicInput(), checkPad(), climbRope(), and collidingWith().

Rope* Player::wasTouchingRope [protected]

same as Player::touchingRope, but this can be checked against in the spriteManager::gameTick() cycle

Definition at line 265 of file player.h.

Referenced by checkPad(), climbRope(), and justTouchingRope().

bool Player::bClimbingRope [protected]

true if the Player is touching a Rope as well as climbing it

Definition at line 267 of file player.h.

Referenced by basicInput(), bounce(), climbRope(), collideNormally(), collidingWith(), hasShield(), isOnRope(), playVictory(), readyForVictory(), and startNetted().

Weapon* Player::currWeapon [protected]

the current Weapon this Player has equipped

Definition at line 270 of file player.h.

Referenced by basicInput(), bounce(), clearWeapon(), collidingWith(), getWeapon(), has1000V(), hasBoomerang(), hasShield(), setWeapon(), updateSprite(), usingChut(), usingInvis(), usingMagnet(), weaponChange(), and weaponDestroyed().

u8 Player::inputInterrupt [protected]

this is the numer of ticks until the Player can move again

Definition at line 274 of file player.h.

Referenced by basicInput(), checkPad(), readyForVictory(), and setInputInterrupt().

bool Player::forceAnimUpdate [protected]

force the Player to restart potentially old animations, to kill weapon anims

Definition at line 276 of file player.h.

Referenced by basicInput(), setInputInterrupt(), and updateAnimation().

u32 Player::lastWeaponChangeTime [protected]

time that the last Weapon change happened

Definition at line 279 of file player.h.

Referenced by Player(), and weaponChange().

bool Player::weaponJustCleared [protected]

Player::currWeapon was just cleared - stops a double check when deleting old weapon.

Definition at line 281 of file player.h.

Referenced by clearWeapon(), and weaponDestroyed().

u8 Player::nettedStrength [protected]

how many clicks are still needed to break free from net (if 0, not netted)

Definition at line 285 of file player.h.

Referenced by basicInput(), handleNetted(), isNetted(), startNetted(), and stopNetted().

bool Player::bJustUnwarped [protected]

true if warp was used and haven't touched the ground yet

Definition at line 287 of file player.h.

Referenced by basicInput(), collidingWith(), justlanded(), and justWarped().

const s8 Player::NETJUMPIMPULSE = -100 [static, protected]

barely a jump, just something to let the player know they pressed it.

Definition at line 290 of file player.h.

Referenced by handleNetted().

const s8 Player::NETSPINSPEED = -20 [static, protected]

relation between sprite rotation and movement velocity whilst in the net

Definition at line 292 of file player.h.

Referenced by handleNetted().

const u8 Player::NETROLLDECEL = 2 [static, protected]

x-axis deceleration to be applied every tick whilst in the net

Definition at line 294 of file player.h.

Referenced by handleNetted().


The documentation for this class was generated from the following files:
Generated on Tue Mar 13 23:27:55 2007 for MDuel DS by  doxygen 1.5.1-p1