Cavestory Mod API
Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
CaveNet::DataStructures::NetPlayer Class Reference

A networking player. More...

#include <CaveNet_ExportedTypes.h>

Public Member Functions

 NetPlayer (NetClient *client)
 
void ClearPredictionFrames ()
 Clear all prediction frames.
 
void AddPredictionFrame ()
 Remember the current playerstate for movement prediction.
 
bool ApplyClosestPredictionFrame (unsigned long long int iGlobalTime, int iClientX, int iClientY)
 Apply the closest frame to the given global timestamp. More...
 
NetPlayerFrameInfoFindClosestPredictionFrame (unsigned long long int iGlobalTime, int iClientX, int iClientY)
 Get the closest movement frame to the given timestamp. More...
 
void EndAnimation ()
 End the current animation.
 
bool BeginFishing ()
 Begin fishing. More...
 
bool Tackle (int level)
 Begin tackling. More...
 
bool TeleportIn ()
 Teleports the player in. More...
 
bool TeleportOut ()
 Teleports the player out. More...
 
bool BecomeDead ()
 Death animation. More...
 
bool BecomeCarried (CaveNet::DataStructures::NetClient *pClient)
 Become a carried NPC. More...
 
bool IsAnimating ()
 Check to see if this player is currently being animated. More...
 
void Damage (int iDamage, bool bExactDamage=false, PlayerDeathType iDamageType=PlayerDeathType::DEATHTYPE_UNKNOWN, CaveNet::DataStructures::NetClient *pKillerClient=NULL, NPCHAR *pKillerNpc=NULL)
 Deal damage to this player. More...
 
void Act_Camera (bool bKey)
 Process the camera. More...
 
void AirProcess ()
 Process underwater air.
 
int GetPlayerState ()
 Get the playerstate for this player. More...
 
unsigned long long int GetPlayerStateFlags ()
 Get the playerstate flags for this player. More...
 
PlayerStateAnimator_OutputType GetPlayerStateAnimatorType ()
 Returns the animator type for this player. More...
 
bool IsPlayerState (int iStateType)
 Check to see if this player is in the specified state. More...
 
unsigned long long int GetPlayerStateFlagsFromCarrier ()
 Get the playerstate flags from the player we're being carried by. More...
 
bool IsMaxExp ()
 Check to see if this player has max EXP in their held weapon. More...
 
bool CanBeRevived ()
 Check to see if this player can be revived right now. More...
 
int CanShoot ()
 Check to see if this player can shoot. More...
 
void GetTrg ()
 Update this client's gameKey, gameKeyTrg, key and keyTrg.
 
void Act (bool bKey)
 Tick this player's movement logic.
 
void AddExp (int x)
 
void AddLife (int x)
 
void SetLife (int x)
 
void AddMaxLife (int x)
 
void SetMaxLife (int x)
 
void SetPosition (int x, int y)
 
void ShowMyChar (bool val)
 Show/hide this player. More...
 
void Animate (bool bKey)
 
void Revive (bool restoreControl, int health=1, NetClient *pSavior=NULL, bool bAnnounce=true)
 Revive this player. More...
 
void Kill (bool bResetVelocity=true, PlayerDeathType iDeathType=PlayerDeathType::DEATHTYPE_UNKNOWN, NPCHAR *pKillerNpc=NULL, CaveNet::DataStructures::NetClient *pKillerClient=NULL)
 Kill this player. More...
 
void ResetFlag ()
 Reset the collision flags for this player.
 
void HitMyCharMapNoclip ()
 Player collision checking against map tiles whilst in noclip mode.
 
void HitMyCharMap ()
 Player collision checking against map tiles.
 
void HitMyCharNpChar ()
 Player collision checking against NPCs.
 
void HitMyCharBullet ()
 Player collision checking against bullets.
 
void HitMyCharBoss ()
 Player collision checking against bosses.
 
void Put (int fx, int fy)
 Draw this player. More...
 
void StartAI ()
 Start AI routine (if this is a bot).
 
void EndAI ()
 End AI routine (if this is a bot).
 
void ProcessAI ()
 loop
 
NetClientGetClient ()
 Get the client that owns this player. More...
 

Public Attributes

NetPlayerFrameInfomMoveHistory
 Movement prediction information.
 
unsigned int mMoveHistoryCount
 Stores how many movement frames are stored in mMoveHistory.
 
struct {
   AI_Brain *   brain
 AI Brain.
 
   bool   enabled
 AI enabled.
 
m_Ai
 Player data.
 
struct {
   MYCHAR   npc
 This player's MYCHAR representation.
 
   bool   dead
 Whether this client is dead or not.
 
m_Player
 

Protected Attributes

NetClientmClient
 

Friends

class AI_Brain
 
class AI_ActionBase
 
class NetClient
 

Detailed Description

A networking player.

Handles a client's player object.

Member Function Documentation

◆ Act_Camera()

void CaveNet::DataStructures::NetPlayer::Act_Camera ( bool  bKey)

Process the camera.

Parameters
bKeyWhether input is allowed or not

◆ AddExp()

void CaveNet::DataStructures::NetPlayer::AddExp ( int  x)
Parameters
x

◆ AddLife()

void CaveNet::DataStructures::NetPlayer::AddLife ( int  x)
Parameters
x

◆ AddMaxLife()

void CaveNet::DataStructures::NetPlayer::AddMaxLife ( int  x)
Parameters
x

◆ Animate()

void CaveNet::DataStructures::NetPlayer::Animate ( bool  bKey)
Parameters
bKeyAllow control

◆ ApplyClosestPredictionFrame()

bool CaveNet::DataStructures::NetPlayer::ApplyClosestPredictionFrame ( unsigned long long int  iGlobalTime,
int  iClientX,
int  iClientY 
)

Apply the closest frame to the given global timestamp.

Parameters
iGlobalTimeThe time that the frame should be the closest to.
iClientXThe client's X position.
iClientYThe client's Y position.
Returns
Returns true on success, false otherwise.

◆ BecomeCarried()

bool CaveNet::DataStructures::NetPlayer::BecomeCarried ( CaveNet::DataStructures::NetClient pClient)

Become a carried NPC.

Returns
Returns true if the playerstate was successfully set, otherwise returns false.

◆ BecomeDead()

bool CaveNet::DataStructures::NetPlayer::BecomeDead ( )

Death animation.

Returns
Returns true if the playerstate was successfully set, otherwise returns false.

◆ BeginFishing()

bool CaveNet::DataStructures::NetPlayer::BeginFishing ( )

Begin fishing.

Returns
Returns true if the playerstate was successfully set, otherwise returns false.

◆ CanBeRevived()

bool CaveNet::DataStructures::NetPlayer::CanBeRevived ( )

Check to see if this player can be revived right now.

Returns
Returns true if we can be revived

◆ CanShoot()

int CaveNet::DataStructures::NetPlayer::CanShoot ( )

Check to see if this player can shoot.

Returns
Returns true if we can shoot

◆ Damage()

void CaveNet::DataStructures::NetPlayer::Damage ( int  iDamage,
bool  bExactDamage = false,
PlayerDeathType  iDamageType = PlayerDeathType::DEATHTYPE_UNKNOWN,
CaveNet::DataStructures::NetClient pKillerClient = NULL,
NPCHAR pKillerNpc = NULL 
)

Deal damage to this player.

This method can kill the player.

Parameters
damageThe amount of damage to deal.
bExactDamageIf set to true, then the damage dealt is not run through any modifier settings.
iDamageTypeThe type of damage done.
pKillerClientThe client who is damaging us.
pKillerNpcThe NPC who is damaging us.

◆ FindClosestPredictionFrame()

NetPlayerFrameInfo* CaveNet::DataStructures::NetPlayer::FindClosestPredictionFrame ( unsigned long long int  iGlobalTime,
int  iClientX,
int  iClientY 
)

Get the closest movement frame to the given timestamp.

Parameters
iGlobalTimeThe time that the frame should be the closest to.
iClientXThe client's X position.
iClientYThe client's Y position.
Returns
Returns the frame closest to the given time, otherwise returns NULL if no frames are cached.

◆ GetClient()

NetClient* CaveNet::DataStructures::NetPlayer::GetClient ( )
inline

Get the client that owns this player.

Returns

◆ GetPlayerState()

int CaveNet::DataStructures::NetPlayer::GetPlayerState ( )

Get the playerstate for this player.

Returns
Returns the index of the state.

◆ GetPlayerStateAnimatorType()

PlayerStateAnimator_OutputType CaveNet::DataStructures::NetPlayer::GetPlayerStateAnimatorType ( )

Returns the animator type for this player.

Returns
Returns the animator output type for this player's current state.

◆ GetPlayerStateFlags()

unsigned long long int CaveNet::DataStructures::NetPlayer::GetPlayerStateFlags ( )

Get the playerstate flags for this player.

Returns
Returns the flags of this player's current state.
See also
PLAYER_STATE_FLAGS

◆ GetPlayerStateFlagsFromCarrier()

unsigned long long int CaveNet::DataStructures::NetPlayer::GetPlayerStateFlagsFromCarrier ( )

Get the playerstate flags from the player we're being carried by.

Returns
Returns the flags.
See also
PLAYER_STATE_FLAGS

◆ IsAnimating()

bool CaveNet::DataStructures::NetPlayer::IsAnimating ( )
inline

Check to see if this player is currently being animated.

Returns
Returns true if we're being controlled by an animation NPC.

◆ IsMaxExp()

bool CaveNet::DataStructures::NetPlayer::IsMaxExp ( )

Check to see if this player has max EXP in their held weapon.

Returns
Returns true if we have max EXP and level for the held weapon

◆ IsPlayerState()

bool CaveNet::DataStructures::NetPlayer::IsPlayerState ( int  iStateType)
inline

Check to see if this player is in the specified state.

Parameters
iStateTypeThe state to check.
Returns
Returns the player state.

◆ Kill()

void CaveNet::DataStructures::NetPlayer::Kill ( bool  bResetVelocity = true,
PlayerDeathType  iDeathType = PlayerDeathType::DEATHTYPE_UNKNOWN,
NPCHAR pKillerNpc = NULL,
CaveNet::DataStructures::NetClient pKillerClient = NULL 
)

Kill this player.

Parameters
bResetVelocityReset the player's velocity to zero.

◆ Put()

void CaveNet::DataStructures::NetPlayer::Put ( int  fx,
int  fy 
)

Draw this player.

Parameters
fxCamera X
fyCamera Y

◆ Revive()

void CaveNet::DataStructures::NetPlayer::Revive ( bool  restoreControl,
int  health = 1,
NetClient pSavior = NULL,
bool  bAnnounce = true 
)

Revive this player.

Parameters
restoreControlRestore control after revival.
healthHow much health to revive them with.
pSaviorOur saviour. Can be NULL.
bAnnounceAnnounce this revival to everyone on the server.

◆ SetLife()

void CaveNet::DataStructures::NetPlayer::SetLife ( int  x)
Parameters
x

◆ SetMaxLife()

void CaveNet::DataStructures::NetPlayer::SetMaxLife ( int  x)
Parameters
x

◆ SetPosition()

void CaveNet::DataStructures::NetPlayer::SetPosition ( int  x,
int  y 
)
Parameters
x
y

◆ ShowMyChar()

void CaveNet::DataStructures::NetPlayer::ShowMyChar ( bool  val)

Show/hide this player.

Parameters
valBoolean

◆ Tackle()

bool CaveNet::DataStructures::NetPlayer::Tackle ( int  level)

Begin tackling.

Returns
Returns true if the playerstate was successfully set, otherwise returns false.

◆ TeleportIn()

bool CaveNet::DataStructures::NetPlayer::TeleportIn ( )

Teleports the player in.

Returns
Returns true if the playerstate was successfully set, otherwise returns false.

◆ TeleportOut()

bool CaveNet::DataStructures::NetPlayer::TeleportOut ( )

Teleports the player out.

Returns
Returns true if the playerstate was successfully set, otherwise returns false.

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