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

Object Movement Subsystem. More...

Macros

#define OBJ_MOVE_STANDARD_MAX_VELOCITY   24
 

Functions

T_void IObjMoveClipVelocity (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMoveAccelFlat (T_objMoveStruct *ObjMoveStruct, T_sword32 amount, T_sword32 angle)
 
T_void ObjMoveAccelXYZ (T_objMoveStruct *ObjMoveStruct, T_sword32 XACC, T_sword32 YACC, T_sword32 ZACC)
 
T_void ObjMoveAddAngle (T_objMoveStruct *ObjMoveStruct, T_word16 addAngle)
 
T_void ObjMoveAddExternalVelocity (T_objMoveStruct *ObjMoveStruct, T_sword32 dVX, T_sword32 dVY, T_sword32 dVZ)
 
T_void ObjMoveAddX (T_objMoveStruct *ObjMoveStruct, T_sword32 addx)
 
T_void ObjMoveAddY (T_objMoveStruct *ObjMoveStruct, T_sword32 addy)
 
T_void ObjMoveAddZ (T_objMoveStruct *ObjMoveStruct, T_sword32 addz)
 
T_3dObjectObjMoveFindHighestObject (T_objMoveStruct *ObjMoveStruct)
 
T_3dObjectObjMoveFindLowestObject (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetAngle (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetAreaCeilingSector (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetAreaSector (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetCenterSector (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetFlags (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetFriction (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetHeight (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetMaxVelocity (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetNthAreaSector (T_objMoveStruct *ObjMoveStruct, T_word16 n)
 
T_word16 ObjMoveGetNumAreaSectors (T_objMoveStruct *ObjMoveStruct)
 
T_word16 ObjMoveGetRadius (T_objMoveStruct *ObjMoveStruct)
 
T_sword32 ObjMoveGetX (T_objMoveStruct *ObjMoveStruct)
 
T_sword32 ObjMoveGetXVel (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMoveGetXYZ (T_objMoveStruct *ObjMoveStruct, T_sword32 *xval, T_sword32 *yval, T_sword32 *zval)
 
T_sword32 ObjMoveGetY (T_objMoveStruct *ObjMoveStruct)
 
T_sword32 ObjMoveGetYVel (T_objMoveStruct *ObjMoveStruct)
 
T_sword32 ObjMoveGetZ (T_objMoveStruct *ObjMoveStruct)
 
T_sword32 ObjMoveGetZVel (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMoveInit (T_objMoveStruct *ObjMoveStruct)
 
E_Boolean ObjMoveIsAboveGround (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMovePrint (FILE *fp, T_objMoveStruct *p_om)
 
T_void ObjMoveSetAngle (T_objMoveStruct *ObjMoveStruct, T_word16 newAngle)
 
T_void ObjMoveSetAngularVelocity (T_objMoveStruct *p_objM, T_word16 angle, T_sword16 magnitude)
 
T_void ObjMoveSetFlags (T_objMoveStruct *ObjMoveStruct, T_word16 newflags)
 
T_void ObjMoveSetHeight (T_objMoveStruct *ObjMoveStruct, T_sword32 newHeight)
 
T_void ObjMoveSetMaxVelocity (T_objMoveStruct *ObjMoveStruct, T_word16 maxVelocity)
 
T_void ObjMoveSetMovedFlag (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMoveSetRadius (T_objMoveStruct *ObjMoveStruct, T_word16 newRadius)
 
T_void ObjMoveSetUpSectors (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMoveSetX (T_objMoveStruct *ObjMoveStruct, T_sword32 newx)
 
T_void ObjMoveSetXYZ (T_objMoveStruct *ObjMoveStruct, T_sword32 newx, T_sword32 newy, T_sword32 newz)
 
T_void ObjMoveSetY (T_objMoveStruct *ObjMoveStruct, T_sword32 newy)
 
T_void ObjMoveSetZ (T_objMoveStruct *ObjMoveStruct, T_sword32 newz)
 
T_void ObjMoveStopMoving (T_objMoveStruct *ObjMoveStruct)
 
T_void ObjMoveUpdate (T_objMoveStruct *ObjMoveStruct, T_sword32 delta)
 
T_void ObjMoveUpdateZVel (T_objMoveStruct *ObjMoveStruct, T_word32 delta)
 

Detailed Description

Object Movement Subsystem.

The Object Movement subsystem is where all the handling of objects occurs. You can think of it as "object physics". It handles objects sliding against walls and other objects. It does the actual movement of objects in the world. It even determines what sector(s) an object is on/in.

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

Macro Definition Documentation

#define OBJ_MOVE_STANDARD_MAX_VELOCITY   24

Function Documentation

T_void IObjMoveClipVelocity ( T_objMoveStruct ObjMoveStruct)

ObjMoveSetMaxVelocity changes the maximum velocity that the given object is allowed to move.

Parameters
ObjMoveStruct– object to set velocity of
T_void ObjMoveAccelFlat ( T_objMoveStruct ObjMoveStruct,
T_sword32  amount,
T_sword32  angle 
)
T_void ObjMoveAccelXYZ ( T_objMoveStruct ObjMoveStruct,
T_sword32  XACC,
T_sword32  YACC,
T_sword32  ZACC 
)
T_void ObjMoveAddAngle ( T_objMoveStruct ObjMoveStruct,
T_word16  addAngle 
)
T_void ObjMoveAddExternalVelocity ( T_objMoveStruct ObjMoveStruct,
T_sword32  dVX,
T_sword32  dVY,
T_sword32  dVZ 
)

ObjMoveAddExternalVelocity pushes an object in a direction with a constant velocity. Unlike normal velocity, external velocity is not clipped by the maximum velocity.

Parameters
ObjMoveStruct– Current obj's move structure
dVX– 32 bit delta X velocity
dVY– 32 bit delta Y velocity
dVZ– 32 bit delta Z velocity
T_void ObjMoveAddX ( T_objMoveStruct ObjMoveStruct,
T_sword32  addx 
)

ObjMoveAddX is a quick routine to transpose the position along the X direction.

Parameters
ObjMoveStruct– object to transpose
addx– amount to add
T_void ObjMoveAddY ( T_objMoveStruct ObjMoveStruct,
T_sword32  addy 
)

ObjMoveAddY is a quick routine to transpose the position along the Y direction.

Parameters
ObjMoveStruct– object to transpose
addy– amount to add
T_void ObjMoveAddZ ( T_objMoveStruct ObjMoveStruct,
T_sword32  addz 
)

ObjMoveAddZ is a quick routine to transpose the position along the Z direction.

Parameters
ObjMoveStruct– object to transpose
addz– amount to add
T_3dObject * ObjMoveFindHighestObject ( T_objMoveStruct ObjMoveStruct)
T_3dObject * ObjMoveFindLowestObject ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetAngle ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetAreaCeilingSector ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetAreaSector ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetCenterSector ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetFlags ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetFriction ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetHeight ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetMaxVelocity ( T_objMoveStruct ObjMoveStruct)

ObjMoveGetMaxVelocity returns the maximum velocity that the given object is allowed to move.

Parameters
ObjMoveStruct– object to get velocity of
T_word16 ObjMoveGetNthAreaSector ( T_objMoveStruct ObjMoveStruct,
T_word16  n 
)
T_word16 ObjMoveGetNumAreaSectors ( T_objMoveStruct ObjMoveStruct)
T_word16 ObjMoveGetRadius ( T_objMoveStruct ObjMoveStruct)
T_sword32 ObjMoveGetX ( T_objMoveStruct ObjMoveStruct)
T_sword32 ObjMoveGetXVel ( T_objMoveStruct ObjMoveStruct)
T_void ObjMoveGetXYZ ( T_objMoveStruct ObjMoveStruct,
T_sword32 xval,
T_sword32 yval,
T_sword32 zval 
)
T_sword32 ObjMoveGetY ( T_objMoveStruct ObjMoveStruct)
T_sword32 ObjMoveGetYVel ( T_objMoveStruct ObjMoveStruct)
T_sword32 ObjMoveGetZ ( T_objMoveStruct ObjMoveStruct)
T_sword32 ObjMoveGetZVel ( T_objMoveStruct ObjMoveStruct)
T_void ObjMoveInit ( T_objMoveStruct ObjMoveStruct)

ObjMoveInit is used to initialize an object's movement information.

Parameters
ObjMoveStruct– Pointer to object move info to init
E_Boolean ObjMoveIsAboveGround ( T_objMoveStruct ObjMoveStruct)
T_void ObjMovePrint ( FILE *  fp,
T_objMoveStruct p_om 
)

ObjMovePrint dumps out the given object move information to the given file/output.

Parameters
fp– File to output object move info
p_om– Object move struct to print
T_void ObjMoveSetAngle ( T_objMoveStruct ObjMoveStruct,
T_word16  newAngle 
)
T_void ObjMoveSetAngularVelocity ( T_objMoveStruct p_objM,
T_word16  angle,
T_sword16  magnitude 
)

ObjMoveSetAngularVelocity declares the direction and magnitude that the object is to take. Any other velocity that the object had was lost. Object acceleration is still the same.

Parameters
p_objM– ObjMove to set angular velocity of
angle– Angle to move toward
magnitude– How fast to go.
T_void ObjMoveSetFlags ( T_objMoveStruct ObjMoveStruct,
T_word16  newflags 
)
T_void ObjMoveSetHeight ( T_objMoveStruct ObjMoveStruct,
T_sword32  newHeight 
)
T_void ObjMoveSetMaxVelocity ( T_objMoveStruct ObjMoveStruct,
T_word16  maxVelocity 
)

ObjMoveSetMaxVelocity changes the maximum velocity that the given object is allowed to move.

Parameters
ObjMoveStruct– object to set velocity of
maxVelocity– new maximum velocity
T_void ObjMoveSetMovedFlag ( T_objMoveStruct ObjMoveStruct)

ObjMoveSetMovedFlag notes that an object has been moved and ever moved.

Parameters
ObjMoveStruct– object that moved
T_void ObjMoveSetRadius ( T_objMoveStruct ObjMoveStruct,
T_word16  newRadius 
)
T_void ObjMoveSetUpSectors ( T_objMoveStruct ObjMoveStruct)

ObjMoveSetUpSectors performs all the calculations necessary to update the sector information in an obj move structure.

Parameters
ObjMoveStruct– object to fix up sectors

If we are a client+server build...

If I don't sink, my feet are on the visible floor. If I do,

they are on the "real" (i.e. underwater) floor.

If I don't sink, my feet are on the visible floor. If I do,

they are on the "real" (i.e. underwater) floor.

T_void ObjMoveSetX ( T_objMoveStruct ObjMoveStruct,
T_sword32  newx 
)
T_void ObjMoveSetXYZ ( T_objMoveStruct ObjMoveStruct,
T_sword32  newx,
T_sword32  newy,
T_sword32  newz 
)
T_void ObjMoveSetY ( T_objMoveStruct ObjMoveStruct,
T_sword32  newy 
)
T_void ObjMoveSetZ ( T_objMoveStruct ObjMoveStruct,
T_sword32  newz 
)
T_void ObjMoveStopMoving ( T_objMoveStruct ObjMoveStruct)
T_void ObjMoveUpdate ( T_objMoveStruct ObjMoveStruct,
T_sword32  delta 
)

ObjMoveUpdate is called on objects to update any movement that they might have due to accelerations in any X, Y, or Z direction. Since all moveable items in the engine are objects (monsters, players, & items), this routine should handle ALL movement in the game. Note that if you are not using this routine, you are doing it wrong.

NOTE: 6/14/95 Still using Stats variables for all objects.

Parameters
ObjMoveStruct– Pointer to object to move
delta– Delta in time
T_void ObjMoveUpdateZVel ( T_objMoveStruct ObjMoveStruct,
T_word32  delta 
)