Player
Classes:
Client interpolation/warp data.
Animation threads & data
Transforms
setTransform(const MatrixF & mat)
Sets the Object -> World transform.
getEyeTransform(MatrixF * mat)
Returns the eye transform of this shape, IE the eyes of a player.
getEyeBaseTransform(MatrixF * mat, bool includeBank)
Returns the eye transform of this shape without including mounted images, IE the eyes of a player.
getRenderEyeTransform(MatrixF * mat)
getRenderEyeBaseTransform(MatrixF * mat, bool includeBank)
DisplayPose
calcCameraDeltaPose(GameConnection * con, const DisplayPose & inPose)
Calculates a delta camera angle and view position based on inPose.
getCameraParameters(F32 * min, F32 * max, Point3F * offset, MatrixF * rot)
Gets the minimum viewing distance, maximum viewing distance, camera offsetand rotation for this object, if the world were to be viewed through its eyes.
getMuzzleTransform(U32 imageSlot, MatrixF * mat)
Muzzle transform of mounted object in world space.
getRenderMuzzleTransform(U32 imageSlot, MatrixF * mat)
getMuzzleVector(U32 imageSlot, VectorF * vec)
Gets the muzzle vector of a specified slot.
Mounted objects
Water
Update the splash effect.
updateFroth(F32 dt)
Update any froth.
updateWaterSounds(F32 dt)
Update water sounds.
createSplash(Point3F & pos, F32 speed)
Creates a splash.
bool
collidingWithWater(Point3F & waterHeight)
Are we colliding with water?
Public Types
Pose { StandPose = 0 SprintPose CrouchPose PronePose SwimPose NumPoseBits = 3 }
Protected Types
ActionState { NullState MoveState RecoverState NumStateBits = 3 }
Main player state.
MaskBits { ActionMask = Parent::NextFreeMask << 0 MoveMask = Parent::NextFreeMask << 1 ImpactMask = Parent::NextFreeMask << 2 NextFreeMask = Parent::NextFreeMask << 3 }
Bit masks for different types of events.
Private Types
Parent
Public Static Attributes
The ExtendedMove position/rotation index used for head movements.
Protected Attributes
Used for interpolation on the client.
bool
bool
bool
bool
bool
bool
Pos compression anchor.
struct Player::ContactInfo
Ticks since last contact.
Controlling object.
MMmmmmm...datablock...
struct Player::Death
bool
Falling in mid-air?
bool
Are we in the mission area?
bool
Is true if WaterCoverage is greater than zero.
bool
Delay till next jump
How long it's been since the player landed (ticks)
Normal of the surface the player last jumped on.
Stores that last absolute pitch value as passed in by ExtendedMove.
Stores that last absolute roll value as passed in by ExtendedMove.
Stores that last absolute yaw value as passed in by ExtendedMove.
Same as mLastPos, but for water.
mMountPending suppresses tickDelay countdown so players will sit until their mount, or another animation, comes through (or 13 seconds elapses).
Sound for moving bubbles.
Number of ticks to predict.
When bypassing the legacy recover system and only using the land sequence, this is how long the player will be in the land sequence.
same as recoverTicks in the player datablock
TSThread *
mShapeFPAmbientThread [ShapeBase::MaxMountedImages]
TSThread *
mShapeFPAnimThread [ShapeBase::MaxMountedImages]
TSThread *
mShapeFPFlashThread [ShapeBase::MaxMountedImages]
mShapeFPInstance [ShapeBase::MaxMountedImages]
TSThread *
mShapeFPSpinThread [ShapeBase::MaxMountedImages]
TSThread *
mShapeFPVisThread [ShapeBase::MaxMountedImages]
mSplashEmitter [PlayerData::NUM_SPLASH_EMITTERS]
What is the player doing?
bool
Is true if WaterCoverage is above the swimming threshold.
bool
Including mHead.z in transform calculations.
Sound for underwater breath.
Amount to slide the weapon back (if it's up against something)
Public Attributes
Public Functions
Player()
~Player()
advanceTime(F32 dt)
Advances simulation time for animations.
allowCrouching(bool state)
allowJetJumping(bool state)
allowJumping(bool state)
allowProne(bool state)
allowSprinting(bool state)
allowSwimming(bool state)
applyImpulse(const Point3F & pos, const VectorF & vec)
Apply an impulse at the given point, with magnitude/direction of vec.
buildConvex(const Box3F & box, Convex * convex)
Builds a convex hull for this object.
bool
buildPolyList(PolyListContext context, AbstractPolyList * polyList, const Box3F & box, const SphereF & sphere)
Builds a list of polygons which intersect a bounding volume.
bool
bool
Can the player jet?
bool
canJump()
Can the player jump?
bool
canProne()
bool
bool
canStand()
bool
canSwim()
Can the player swim?
bool
bool
checkDismountPosition(const MatrixF & oldPos, const MatrixF & newPos)
Is it safe to dismount here?
bool
displaceObject(const Point3F & displaceVector)
Displaces this object by a vector.
Returns the object this is controlling.
Get the rotation of the head of the player.
Returns the momentum of this object.
getMuzzlePointAI(U32 imageSlot, Point3F * point)
const char *
Get the rotation of the player.
const char *
Gets the velocity of the object.
bool
Is it in contact with something.
interpolateTick(F32 delta)
Interpolates between tick events.
bool
bool
Returns true if this object allows itself to be displaced.
bool
onAdd()
Called when the object is added to the sim.
onCameraScopeQuery(NetConnection * cr, CameraScopeQuery * camInfo)
Queries the object about information used to determine scope.
bool
onNewDataBlock(GameBaseData * dptr, bool reload)
Called when a new datablock is set.
Called when the size of the object changes.
packUpdate(NetConnection * conn, U32 mask, BitStream * stream)
Instructs this object to pack its state for transfer over the network.
prepRenderImage(SceneRenderState * state)
processTick(const Move * move)
Processes a move event and updates object state once every 32 milliseconds.
readPacketData(GameConnection * conn, BitStream * stream)
Read data written with writePacketData() and update the object state.
renderConvex(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)
renderMountedImage(U32 imageSlot, TSRenderState & rstate, SceneRenderState * state)
Virtualize this so other classes may override it for custom reasons.
bool
setActionThread(const char * sequence, bool hold, bool wait, bool fsp)
bool
setArmThread(const char * sequence)
setControlObject(ShapeBase * obj)
sets the object this is controlling
setMomentum(const Point3F & momentum)
Sets the momentum of this object.
setVelocity(const VectorF & vel)
Sets the velocity of this object.
unpackUpdate(NetConnection * conn, BitStream * stream)
Instructs this object to read state data previously packed with packUpdate.
writePacketData(GameConnection * conn, BitStream * stream)
Write state information necessary to perform client side prediction of an object.
Protected Functions
_doCollisionImpact(const Collision * collision, bool fallingCollision)
_findContact(SceneObject ** contactObject, VectorF * contactNormal, Vector< SceneObject * > * outOverlapObjects)
_handleCollision(const Collision & collision)
buildImagePrefixPaths(String * prefixPaths)
Preprender logic.
See if the player is still in the mission area.
convertActionToImagePrefix(U32 action)
deathDelta(Point3F & delta)
findContact(bool * run, bool * jump, VectorF * contactNormal)
findPrefixSequence(String * prefixPaths, const String & baseSeq)
const char *
getImageAnimPrefix(U32 imageSlot, S32 imageShapeIndex)
Get the animation prefix for the image.
bool
Are we in the process of dying?
bool
onImageAnimThreadChange(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData * lastState, const char * anim, F32 pos, F32 timeScale, bool reset)
onImageAnimThreadUpdate(U32 imageSlot, S32 imageShapeIndex, F32 dt)
onImageRecoil(U32 imageSlot, ShapeBaseImageData::StateData::RecoilState )
onImageStateAnimation(U32 imageSlot, const char * seqName, bool direction, bool scaleToState, F32 stateTimeOutValue)
pickBestMoveAction(U32 startAnim, U32 endAnim, U32 * action, bool * forward)
playFootstepSound(bool triggeredLeft, Material * contactMaterial, SceneObject * contactObject)
Play sound for foot contact.
Play an impact sound.
setActionThread(U32 action, bool forward, bool hold, bool wait, bool fsp, bool forceSet)
bool
setArmThread(U32 action)
setControllingClient(GameConnection * client)
Set which client is controlling this player.
setState(ActionState state, U32 ticks)
updateAnimation(F32 dt)
Update other animations.
updateAnimationTree(bool firstPerson)
Update head animation.
updateMove(const Move * move)
Update the movement.
Public Static Functions
Detailed Description
Animation threads & data
struct Player::ActionAnimation mActionAnimation
struct Player::ArmAnimation mArmAnimation
TSThread * mArmThread
TSThread * mHeadVThread
TSThread * mHeadHThread
TSThread * mRecoilThread
TSThread * mImageStateThread
Transforms
setTransform(const MatrixF & mat)
Reimplemented from: SceneObject
getEyeTransform(MatrixF * mat)
Reimplemented from: ShapeBase
getEyeBaseTransform(MatrixF * mat, bool includeBank)
Reimplemented from: ShapeBase
getRenderEyeTransform(MatrixF * mat)
Reimplemented from: ShapeBase
getRenderEyeBaseTransform(MatrixF * mat, bool includeBank)
Reimplemented from: ShapeBase
calcCameraDeltaPose(GameConnection * con, const DisplayPose & inPose)
Reimplemented from: ShapeBase
getCameraParameters(F32 * min, F32 * max, Point3F * offset, MatrixF * rot)
Reimplemented from: ShapeBase
getMuzzleTransform(U32 imageSlot, MatrixF * mat)
Reimplemented from: ShapeBase
getRenderMuzzleTransform(U32 imageSlot, MatrixF * mat)
Reimplemented from: ShapeBase
getMuzzleVector(U32 imageSlot, VectorF * vec)
Reimplemented from: ShapeBase
Reimplemented by: AIPlayer
Mounted objects
onUnmount(ShapeBase * obj, S32 node)
unmount()
Reimplemented from: SceneObject
Water
updateSplash()
Update the splash effect.
updateFroth(F32 dt)
Update any froth.
updateWaterSounds(F32 dt)
Update water sounds.
createSplash(Point3F & pos, F32 speed)
Creates a splash.
collidingWithWater(Point3F & waterHeight)
Are we colliding with water?
Public Types
Pose
Enumerator
- StandPose = 0
- SprintPose
- CrouchPose
- PronePose
- SwimPose
- NumPoseBits = 3
Protected Types
ActionState
Enumerator
- NullState
- MoveState
- RecoverState
- NumStateBits = 3
Main player state.
MaskBits
Enumerator
- ActionMask = Parent::NextFreeMask << 0
- MoveMask = Parent::NextFreeMask << 1
- ImpactMask = Parent::NextFreeMask << 2
- NextFreeMask = Parent::NextFreeMask << 3
Bit masks for different types of events.
Private Types
typedef ShapeBase Parent
Public Static Attributes
S32 smExtendedMoveHeadPosRotIndex
The ExtendedMove position/rotation index used for head movements.
Protected Attributes
StateDelta delta
Used for interpolation on the client.
bool mAllowCrouching
bool mAllowJetJumping
bool mAllowJumping
bool mAllowProne
bool mAllowSprinting
bool mAllowSwimming
Point3F mAnchorPoint
Pos compression anchor.
F32 mBubbleEmitterTime
struct Player::ContactInfo mContactInfo
S32 mContactTimer
Ticks since last contact.
SimObjectPtr< ShapeBase > mControlObject
Controlling object.
PlayerData * mDataBlock
MMmmmmm...datablock...
struct Player::Death mDeath
bool mFalling
Falling in mid-air?
Point3F mHead
Head rotation, uses only x & z.
S32 mImpactSound
bool mInMissionArea
Are we in the mission area?
bool mInWater
Is true if WaterCoverage is greater than zero.
bool mJetting
S32 mJumpDelay
Delay till next jump
U32 mJumpSurfaceLastContact
How long it's been since the player landed (ticks)
Point3F mJumpSurfaceNormal
Normal of the surface the player last jumped on.
F32 mLastAbsolutePitch
Stores that last absolute pitch value as passed in by ExtendedMove.
F32 mLastAbsoluteRoll
Stores that last absolute roll value as passed in by ExtendedMove.
F32 mLastAbsoluteYaw
Stores that last absolute yaw value as passed in by ExtendedMove.
Point3F mLastPos
Holds the last position for physics updates.
Point3F mLastWaterPos
Same as mLastPos, but for water.
S32 mMountPending
mMountPending suppresses tickDelay countdown so players will sit until their mount, or another animation, comes through (or 13 seconds elapses).
SFXSource * mMoveBubbleSound
Sound for moving bubbles.
PhysicsPlayer * mPhysicsRep
Pose mPose
S32 mPredictionCount
Number of ticks to predict.
F32 mRecoverDelay
When bypassing the legacy recover system and only using the land sequence, this is how long the player will be in the land sequence.
S32 mRecoverTicks
same as recoverTicks in the player datablock
U32 mReversePending
Point3F mRot
Body rotation, uses only z.
TSThread * mShapeFPAmbientThread [ShapeBase::MaxMountedImages]
TSThread * mShapeFPAnimThread [ShapeBase::MaxMountedImages]
TSThread * mShapeFPFlashThread [ShapeBase::MaxMountedImages]
TSShapeInstance * mShapeFPInstance [ShapeBase::MaxMountedImages]
TSThread * mShapeFPSpinThread [ShapeBase::MaxMountedImages]
TSThread * mShapeFPVisThread [ShapeBase::MaxMountedImages]
SimObjectPtr< ParticleEmitter > mSplashEmitter [PlayerData::NUM_SPLASH_EMITTERS]
ActionState mState
What is the player doing?
bool mSwimming
Is true if WaterCoverage is above the swimming threshold.
bool mUseHeadZCalc
Including mHead.z in transform calculations.
VectorF mVelocity
Velocity.
SFXSource * mWaterBreathSound
Sound for underwater breath.
F32 mWeaponBackFraction
Amount to slide the weapon back (if it's up against something)
Protected Static Attributes
F32 mGravity
Gravity.
Public Attributes
OrthoBoxConvex mConvex
Box3F mScaledBox
Box3F mWorkingQueryBox
Public Functions
Player()
~Player()
advanceTime(F32 dt)
Reimplemented from: ProcessObject
allowAllPoses()
allowCrouching(bool state)
allowJetJumping(bool state)
allowJumping(bool state)
allowProne(bool state)
allowSprinting(bool state)
allowSwimming(bool state)
applyImpulse(const Point3F & pos, const VectorF & vec)
Reimplemented from: ShapeBase
buildConvex(const Box3F & box, Convex * convex)
Reimplemented from: SceneObject
buildPolyList(PolyListContext context, AbstractPolyList * polyList, const Box3F & box, const SphereF & sphere)
Reimplemented from: SceneObject
canCrouch()
canJetJump()
Can the player jet?
canJump()
Can the player jump?
canProne()
canSprint()
canStand()
canSwim()
Can the player swim?
castRay(const Point3F & start, const Point3F & end, RayInfo * info)
Reimplemented from: SceneObject
checkDismountPosition(const MatrixF & oldPos, const MatrixF & newPos)
Is it safe to dismount here?
DECLARE_CONOBJECT(Player )
displaceObject(const Point3F & displaceVector)
Reimplemented from: SceneObject
getAIMove(Move * )
Reimplemented by: AIPlayer
getArmThread()
getControlObject()
Reimplemented from: ShapeBase
getDamageLocation(const Point3F & in_rPos, const char *& out_rpVert, const char *& out_rpQuad)
getHeadRotation()
Get the rotation of the head of the player.
getMaxForwardVelocity()
getMomentum()
Reimplemented from: SceneObject
getMuzzlePointAI(U32 imageSlot, Point3F * point)
getPhysicsRep()
getPose()
Standing / Crouched / Prone or Swimming
getPoseName()
getRotation()
Get the rotation of the player.
getSpeed()
getStateName()
getVelocity()
Reimplemented from: SceneObject
haveContact()
Is it in contact with something.
interpolateTick(F32 delta)
Reimplemented from: ProcessObject
isControlObject()
isDisplacable()
Reimplemented from: SceneObject
onAdd()
Reimplemented from: GameBase
onCameraScopeQuery(NetConnection * cr, CameraScopeQuery * camInfo)
Reimplemented from: SceneObject
onNewDataBlock(GameBaseData * dptr, bool reload)
Reimplemented from: GameBase
onRemove()
Reimplemented from: GameBase
onScaleChanged()
Reimplemented from: SceneObject
packUpdate(NetConnection * conn, U32 mask, BitStream * stream)
Reimplemented from: GameBase
prepRenderImage(SceneRenderState * state)
Reimplemented from: ShapeBase
processTick(const Move * move)
Reimplemented from: GameBase
readPacketData(GameConnection * conn, BitStream * stream)
Reimplemented from: GameBase
renderConvex(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)
renderMountedImage(U32 imageSlot, TSRenderState & rstate, SceneRenderState * state)
Reimplemented from: ShapeBase
setActionThread(const char * sequence, bool hold, bool wait, bool fsp)
setArmThread(const char * sequence)
setControlObject(ShapeBase * obj)
Reimplemented from: ShapeBase
setMomentum(const Point3F & momentum)
Reimplemented from: SceneObject
setPose(Pose pose)
Setting this from script directly might not actually work, This is really just a helper for the player class so that its bounding box will get resized appropriately when the pose changes.
setVelocity(const VectorF & vel)
Reimplemented from: ShapeBase
unpackUpdate(NetConnection * conn, BitStream * stream)
Reimplemented from: GameBase
updateWorkingCollisionSet()
writePacketData(GameConnection * conn, BitStream * stream)
Reimplemented from: GameBase
Protected Functions
_doCollisionImpact(const Collision * collision, bool fallingCollision)
_findContact(SceneObject ** contactObject, VectorF * contactNormal, Vector< SceneObject * > * outOverlapObjects)
_handleCollision(const Collision & collision)
_move(const F32 travelTime, Collision * outCol)
Interpolate movement.
buildImagePrefixPaths(String * prefixPaths)
calcClassRenderData()
Reimplemented from: ShapeBase
checkMissionArea()
See if the player is still in the mission area.
convertActionToImagePrefix(U32 action)
deathDelta(Point3F & delta)
disableHeadZCalc()
enableHeadZCalc()
findContact(bool * run, bool * jump, VectorF * contactNormal)
findPrefixSequence(String * prefixPaths, const String & baseSeq)
getArmAction()
getImageAnimPrefix(U32 imageSlot, S32 imageShapeIndex)
Reimplemented from: ShapeBase
inDeathAnim()
Are we in the process of dying?
inSittingAnim()
onImage(U32 imageSlot, bool unmount)
Reimplemented from: ShapeBase
onImageAnimThreadChange(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData * lastState, const char * anim, F32 pos, F32 timeScale, bool reset)
Reimplemented from: ShapeBase
onImageAnimThreadUpdate(U32 imageSlot, S32 imageShapeIndex, F32 dt)
Reimplemented from: ShapeBase
onImageRecoil(U32 imageSlot, ShapeBaseImageData::StateData::RecoilState )
Reimplemented from: ShapeBase
onImageStateAnimation(U32 imageSlot, const char * seqName, bool direction, bool scaleToState, F32 stateTimeOutValue)
Reimplemented from: ShapeBase
pickActionAnimation()
pickBestMoveAction(U32 startAnim, U32 endAnim, U32 * action, bool * forward)
playFootstepSound(bool triggeredLeft, Material * contactMaterial, SceneObject * contactObject)
Play sound for foot contact.
Parameters:
| triggeredLeft | If true, left foot hit; right otherwise. |
| contactMaterial | Material onto which the player stepped; may be NULL. |
| contactObject | Object onto which the player stepped; may be NULL. |
playImpactSound()
Play an impact sound.
reSkin()
Reimplemented from: ShapeBase
setActionThread(U32 action, bool forward, bool hold, bool wait, bool fsp, bool forceSet)
setArmThread(U32 action)
setControllingClient(GameConnection * client)
Reimplemented from: ShapeBase
setPosition(const Point3F & pos, const Point3F & viewRot)
setRenderPosition(const Point3F & pos, const Point3F & viewRot, F32 dt)
setState(ActionState state, U32 ticks)
step(Point3F * pos, F32 * maxStep, F32 time)
updateActionThread()
updateAnimation(F32 dt)
Update other animations.
updateAnimationTree(bool firstPerson)
updateDamageLevel()
Reimplemented from: ShapeBase
updateDamageState()
Reimplemented from: ShapeBase
updateDeathOffsets()
updateLookAnimation(F32 dT)
Update head animation.
updateMove(const Move * move)
Update the movement.
Reimplemented by: AIPlayer
updatePos(const F32 travelTime)
updateState()
