Amulets & Armor  v1.02
Open Source Game
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Functions
PLAYER

Player Object. More...

Macros

#define easyabs(x)   (((-x)<0)?(-(x)):(x))
 
#define G_playerMove   (G_playerObject->objMove)
 

Functions

T_void IPlayerStoppedMakingSound (T_void *p_data)
 
T_void PlayerAccelDirection (T_word16 direction, T_sword16 accel)
 
T_void PlayerAccelXYZ (T_sword32 accelX, T_sword32 accelY, T_sword32 accelZ)
 
T_void PlayerAddExternalVelocity (T_sword32 dx, T_sword32 dy, T_sword32 dz)
 
T_void PlayerDraw (T_word16 x, T_word16 y)
 
T_void PlayerFakeOverwriteCurrent (T_void)
 
T_void PlayerFinish (T_void)
 
T_word16 PlayerGetAngle (T_void)
 
T_word16 PlayerGetAreaSector (T_void)
 
T_word16 PlayerGetBodyPart (T_bodyPartLocation location)
 
T_word16 PlayerGetCenterSector (T_void)
 
T_word16 PlayerGetFriction (T_void)
 
T_word16 PlayerGetLastSector (T_void)
 
T_word16 PlayerGetNthAreaSector (T_word16 n)
 
T_word16 PlayerGetNumAreaSectors (T_void)
 
T_3dObjectPlayerGetObject (T_void)
 
T_word16 PlayerGetStance (T_void)
 
T_word16 PlayerGetTravelDistance (T_void)
 
T_sword32 PlayerGetX (T_void)
 
T_sword32 PlayerGetY (T_void)
 
T_sword32 PlayerGetZ (T_void)
 
E_Boolean PlayerInFakeMode (T_void)
 
T_void PlayerInit (T_3dObject *p_obj)
 
T_void PlayerInitFirst (T_void)
 
E_Boolean PlayerIsAboveGround (T_void)
 
E_Boolean PlayerIsStealthy (T_void)
 
T_void PlayerJump (T_word16 jumpPower)
 
T_void PlayerJumpForward (T_word16 distance)
 
E_Boolean PlayerJustTeleported (T_void)
 
T_void PlayerMakeSoundGlobal (T_word16 soundNum, T_word16 radius)
 
T_void PlayerMakeSoundLocal (T_word16 soundNum)
 
T_void PlayerMoveBackward (T_word16 fraction)
 
T_void PlayerMoveForward (T_word16 fraction)
 
T_void PlayerMoveNone (T_void)
 
T_void PlayerSetAngle (T_word16 angle)
 
T_void PlayerSetBodyPart (T_bodyPartLocation location, T_word16 newPart)
 
T_void PlayerSetCameraView (T_void)
 
T_void PlayerSetFakeMode (T_void)
 
T_void PlayerSetLastSector (T_word16 lastSector)
 
T_void PlayerSetMaxVelocity (T_sword32 maxVelocity)
 
T_void PlayerSetRealMode (T_void)
 
T_void PlayerSetStance (T_word16 stance)
 
T_void PlayerSetX (T_sword32 x)
 
T_void PlayerSetY (T_sword32 y)
 
T_void PlayerSetZ (T_sword32 z)
 
T_void PlayerSlideLeft (T_word16 fraction)
 
T_void PlayerSlideRight (T_word16 fraction)
 
T_void PlayerStopMoving (T_void)
 
T_void PlayerTeleport (T_sword16 x, T_sword16 y, T_word16 angle)
 
T_void PlayerTeleportAlways (T_sword16 x, T_sword16 y, T_word16 angle)
 
T_void PlayerTeleported (T_void)
 
T_void PlayerTurnLeft (T_word16 fraction)
 
T_void PlayerTurnRight (T_word16 fraction)
 
T_void PlayerUpdate (T_word32 delta)
 
T_void PlayerUpdatePosInfo (T_void)
 

Detailed Description

Player Object.

The player is just another object in the game system. These routines handle the movement and animation of that player object.

See Also
http://www.amuletsandarmor.com/AALicense.txt

Macro Definition Documentation

#define easyabs (   x)    (((-x)<0)?(-(x)):(x))
#define G_playerMove   (G_playerObject->objMove)

Function Documentation

T_void IPlayerStoppedMakingSound ( T_void p_data)
T_void PlayerAccelDirection ( T_word16  direction,
T_sword16  accel 
)

PlayerAccelDirection pushes the player in a given facing direction with the given amount of acceleration.

Parameters
direction– Direction to move toward
accel– Acceleration amount
T_void PlayerAccelXYZ ( T_sword32  accelX,
T_sword32  accelY,
T_sword32  accelZ 
)

PlayerAccelXYZ gives the player a push in a given direction.

T_void PlayerAddExternalVelocity ( T_sword32  dx,
T_sword32  dy,
T_sword32  dz 
)

PlayerAddExternalObject moves the player along the x, y, and z dir.

Parameters
dx– X External velocity
dy– Y External velocity
dz– Z External velocity
T_void PlayerDraw ( T_word16  x,
T_word16  y 
)

PlayerDraw draws what the player looks like at the given location on the current screen.

Parameters
x– X Location on the screen
y– Y Location on the screen
T_void PlayerFakeOverwriteCurrent ( T_void  )
T_void PlayerFinish ( T_void  )

PlayerFinish closes out anything that the player position was using.

Set the player object's type to zero to unlock the picture resources.

T_word16 PlayerGetAngle ( T_void  )

PlayerGetAngle gets the facing angle of the current player's location.

Returns
facing angle of player
T_word16 PlayerGetAreaSector ( T_void  )

PlayerGetAreaSector returns the sector that the player is standing on top of.

Returns
sector being stood on.
T_word16 PlayerGetBodyPart ( T_bodyPartLocation  location)

PlayerGetBodyPart reports the type of part for the given body location on the player.

Parameters
location– location of body part
Returns
body type
T_word16 PlayerGetCenterSector ( T_void  )

PlayerGetCenterSector returns the sector that is under the middle of the player.

Returns
sector under center of player.
T_word16 PlayerGetFriction ( T_void  )

PlayerGetFriction returns the friction of the surface under the player.

Returns
Friction under player.
T_word16 PlayerGetLastSector ( T_void  )

PlayerMoveNone cancels all declared movement for this frame.

T_word16 PlayerGetNthAreaSector ( T_word16  n)

PlayerGetNthAreaSecotr gets one of the sectors in the sector list of sectors that they are over.

Returns
Sector in list
T_word16 PlayerGetNumAreaSectors ( T_void  )

PlayerGetNumAreaSectors tells how many area sectors the player is standing over.

Returns
number of area sectors
T_3dObject* PlayerGetObject ( T_void  )

PlayerGetObject tells what the player object is.

T_word16 PlayerGetStance ( T_void  )

PlayerGetStance returns what stance the player is at.

Returns
stance number
T_word16 PlayerGetTravelDistance ( T_void  )

PlayerGetTravelDistance determines how far the player traveled on the last call to PlayerUpdate. Teleportation does not do this.

Returns
distance traveled in unaccurate terms.
T_sword32 PlayerGetX ( T_void  )

PlayerGetX gets the x location of the current player location.

Returns
X location of player
T_sword32 PlayerGetY ( T_void  )

PlayerGetY gets the y location of the current player location.

Returns
Y location of player
T_sword32 PlayerGetZ ( T_void  )

PlayerGetZ gets the z location of the current player location.

Returns
Z location of player
E_Boolean PlayerInFakeMode ( T_void  )
T_void PlayerInit ( T_3dObject p_obj)

PlayerInit sets up the player's position information.

T_void PlayerInitFirst ( T_void  )

PlayerInitFirst sets up the player's basic information that won't change from level to level.

E_Boolean PlayerIsAboveGround ( T_void  )

PlayerIsAboveGround checks to see if the player is above the ground (and probably falling).

E_Boolean PlayerIsStealthy ( T_void  )
T_void PlayerJump ( T_word16  jumpPower)

PlayerJump causes the player to jump by moving the player up a little and accelerating in the up direction.

Parameters
jumpPower– Jump by how much
T_void PlayerJumpForward ( T_word16  distance)

PlayerJumpForward makes the player take a step forward regardless of anything else except for colllisions.

Parameters
distance– How far to jump forward
E_Boolean PlayerJustTeleported ( T_void  )
T_void PlayerMakeSoundGlobal ( T_word16  soundNum,
T_word16  radius 
)
T_void PlayerMakeSoundLocal ( T_word16  soundNum)
T_void PlayerMoveBackward ( T_word16  fraction)

PlayerMoveBackward moves the player backward the given speed.

Parameters
fraction– fractional amount allowed
T_void PlayerMoveForward ( T_word16  fraction)

PlayerMoveForward moves the player forward the given speed.

Parameters
fraction– fractional amount allowed
T_void PlayerMoveNone ( T_void  )

PlayerMoveNone cancels all declared movement for this frame.

T_void PlayerSetAngle ( T_word16  angle)

PlayerSetAngle changes the facing angle of the player.

Parameters
angle– new angle of the player
T_void PlayerSetBodyPart ( T_bodyPartLocation  location,
T_word16  newPart 
)

PlayerSetBodyPart changes a part on the body and sends it to all the other machines.

Parameters
location– location of body part
newPart– Number of new part
T_void PlayerSetCameraView ( T_void  )
T_void PlayerSetFakeMode ( T_void  )
T_void PlayerSetLastSector ( T_word16  lastSector)
T_void PlayerSetMaxVelocity ( T_sword32  maxVelocity)

PlayerSetMaxVelocity sets up the player's movement maximum velocity.

Parameters
maxVelocity– Jump by how much
T_void PlayerSetRealMode ( T_void  )
T_void PlayerSetStance ( T_word16  stance)

PlayerSetStance puts the player in another stance. If the player was hurt recently, it will time out after awhile.

Parameters
stance– stance number
T_void PlayerSetX ( T_sword32  x)

PlayerSetX sets the x location of the current player location.

Parameters
x– new X location of player
T_void PlayerSetY ( T_sword32  y)

PlayerSetY sets the y location of the current player location.

Parameters
y– new Y location of player
T_void PlayerSetZ ( T_sword32  z)

PlayerSetZ sets the z location of the current player location.

Parameters
z– new Z location of player
T_void PlayerSlideLeft ( T_word16  fraction)

PlayerSlideLeft slides the player left the given speed.

Parameters
fraction– fractional amount allowed
T_void PlayerSlideRight ( T_word16  fraction)

PlayerSlideRight slides the player right the given speed.

Parameters
fraction– fractional amount allowed
T_void PlayerStopMoving ( T_void  )

PlayerStopMoving causes the player to come to a complete halt.

T_void PlayerTeleport ( T_sword16  x,
T_sword16  y,
T_word16  angle 
)

PlayerTeleport is the major move all solution to moving the current POV. It moves the POV to the x, y, and angle as passed into the routine.

Parameters
x– Accurate X coordinate on map
y– Accurate Y coordinate on map
angle– Angle to face when moved.
T_void PlayerTeleportAlways ( T_sword16  x,
T_sword16  y,
T_word16  angle 
)

PlayerTeleportAlways is just like PlayerTeleport buts doesn't care if there is something in the way.

Parameters
x– Accurate X coordinate on map
y– Accurate Y coordinate on map
angle– Angle to face when moved.
T_void PlayerTeleported ( T_void  )
T_void PlayerTurnLeft ( T_word16  fraction)

PlayerTurnLeft turns the player left by the given fractional amount.

Parameters
fraction– fractional amount allowed
T_void PlayerTurnRight ( T_word16  fraction)

PlayerTurnRight turns the player right the given fractional speed.

Parameters
fraction– fractional amount allowed
T_void PlayerUpdate ( T_word32  delta)

PlayerUpdate updates all the movement for the player over the given delta of time.

Parameters
delta– Number of timer ticks that have passed.

What if delta is too big?

I'll break it up into pieces.

T_void PlayerUpdatePosInfo ( T_void  )

PlayerUpdatePosInfo forces the player information to update the sector and related sector information (like height).