Objects in World.
More...
|
T_void | ObjectAdd (T_3dObject *p_obj) |
|
T_void | ObjectAddAttributesToPiecewise (T_3dObject *p_obj, T_word16 attr) |
|
T_void | ObjectAddWithoutHistory (T_3dObject *p_obj) |
|
T_void * | ObjectAllocExtraData (T_3dObject *p_obj, T_word32 sizeData) |
|
T_void | ObjectChainingOff (T_void) |
|
T_void | ObjectChainingOn (T_void) |
|
E_Boolean | ObjectCheckCollide (T_3dObject *p_obj, T_sword16 x, T_sword16 y, T_sword16 height) |
|
E_Boolean | ObjectCheckCollideAny (T_3dObject *p_obj, T_sword16 x, T_sword16 y, T_sword16 height) |
|
E_Boolean | ObjectCheckIfCollide (T_3dObject *p_obj, T_sword32 x, T_sword32 y, T_sword32 z) |
|
T_3dObject * | ObjectCreate (T_void) |
|
T_3dObject * | ObjectCreateFake (T_void) |
|
T_void | ObjectDeclareMoveable (T_3dObject *p_obj, T_word16 mapX, T_word16 mapY) |
|
T_void | ObjectDeclareStatic (T_3dObject *p_obj, T_sword16 mapX, T_sword16 mapY) |
|
T_void | ObjectDestroy (T_3dObject *p_obj) |
|
T_void | ObjectDrawFrontScaled (T_3dObject *p_obj, T_sword16 x, T_sword16 y, T_word16 width, T_word16 height) |
|
T_3dObject * | ObjectDuplicate (T_3dObject *p_obj) |
|
T_3dObject * | ObjectFind (T_word16 id) |
|
T_3dObject * | ObjectFindBodyPartHead (T_3dObject *p_part) |
|
T_void | ObjectFreeExtraData (T_3dObject *p_obj) |
|
T_void | ObjectGetAngularPosition (T_3dObject *p_obj, T_word16 angle, T_sword16 dist, T_sword32 *p_x, T_sword32 *p_y) |
|
T_bitmap * | ObjectGetBitmap (T_3dObject *p_obj) |
|
T_word16 | ObjectGetBodyPartType (T_3dObject *p_obj, T_bodyPartLocation location) |
|
T_void | ObjectGetForwardPosition (T_3dObject *p_obj, T_word16 dist, T_sword32 *p_x, T_sword32 *p_y) |
|
T_sword16 | ObjectGetMiddleHeight (T_3dObject *p_obj) |
|
T_word32 | ObjectGetNextId (T_void) |
|
T_byte8 * | ObjectGetPicture (T_3dObject *p_obj) |
|
T_word16 | ObjectGetPictureHeight (T_3dObject *p_obj) |
|
T_word16 | ObjectGetPictureWidth (T_3dObject *p_obj) |
|
T_word16 | ObjectGetValue (T_3dObject *p_obj) |
|
T_word16 | ObjectGetWeight (T_3dObject *p_obj) |
|
E_Boolean | ObjectIsAtXY (T_3dObject *p_obj, T_sword16 x, T_sword16 y) |
|
E_Boolean | ObjectIsBeingCrushed (T_3dObject *p_obj) |
|
T_void | ObjectMakeImpassable (T_3dObject *p_obj) |
|
T_void | ObjectMakePassable (T_3dObject *p_obj) |
|
T_void | ObjectMarkForDestroy (T_3dObject *p_obj) |
|
T_void | ObjectPrint (FILE *fp, T_3dObject *p_obj) |
|
T_void | ObjectRemove (T_3dObject *p_obj) |
|
T_void | ObjectRemoveAttributesFromPiecewise (T_3dObject *p_obj, T_word16 attr) |
|
T_void | ObjectRemoveScript (T_3dObject *p_obj) |
|
T_word32 | ObjectsCountBasicType (T_word16 objectType) |
|
T_word32 | ObjectsCountType (T_word16 objectType) |
|
T_void | ObjectsDoToAll (T_objectDoToAllCallback p_callback, T_word32 data) |
|
T_void | ObjectsDoToAllAtXY (T_sword16 x, T_sword16 y, T_objectDoToAllCallback p_callback, T_word32 data) |
|
T_void | ObjectsDoToAllAtXYRadius (T_sword16 x, T_sword16 y, T_word16 radius, T_objectDoToAllCallback p_callback, T_word32 data) |
|
T_void | ObjectsDoToAllAtXYZRadius (T_sword16 x, T_sword16 y, T_sword16 z, T_word16 radius, T_objectDoToAllCallback p_callback, T_word32 data) |
|
T_void | ObjectSetAngle (T_3dObject *p_obj, T_word16 angle) |
|
T_void | ObjectSetBodyPartType (T_3dObject *p_obj, T_bodyPartLocation location, T_word16 objType) |
|
T_void | ObjectSetStance (T_3dObject *p_obj, T_word16 stance) |
|
T_void | ObjectSetType (T_3dObject *p_obj, T_word16 type) |
|
T_void | ObjectSetTypeSimple (T_3dObject *p_obj, T_word16 type) |
|
T_void | ObjectSetUpSectors (T_3dObject *p_obj) |
|
T_void | ObjectsFinish (T_void) |
|
T_word32 | ObjectsGetNumMarkedForDestroy (T_void) |
|
T_void | ObjectsInitialize (T_void) |
|
T_void | ObjectsMakeTemporarilyPassableAtXYRadius (T_sword16 x, T_sword16 y, T_word16 radius, T_sword16 zBottom, T_sword16 zTop) |
|
T_void | ObjectsRemoveExtra (T_void) |
|
T_void | ObjectsResetIds (T_void) |
|
T_void | ObjectsUnload (T_void) |
|
T_void | ObjectsUpdateAnimation (T_word32 currentTime) |
|
T_void | ObjectsUpdateMovement (T_word32 delta) |
|
T_void | ObjectsUpdateMovementForFake (T_word32 delta) |
|
T_void | ObjectTeleport (T_3dObject *p_obj, T_sword16 x, T_sword16 y) |
|
T_void | ObjectTeleportAlways (T_3dObject *p_obj, T_sword16 x, T_sword16 y) |
|
T_void | ObjectUnlinkCollisionLink (T_3dObject *p_obj) |
|
T_void | ObjectUpdateAnimation (T_3dObject *p_obj, T_word32 currentTime) |
|
T_void | ObjectUpdateCollisionLink (T_3dObject *p_obj) |
|
Objects in World.
The Object system is a layer on top of the 3D_IO objects in the renderer. It tracks all the fluffy information that is needed more than what the object is. It handles object types, motion/acceleration, size, graphics, animation, etc. There is also object to object collision code here.
- See Also
- http://www.amuletsandarmor.com/AALicense.txt
#define OBJECT_HASH_TABLE_SIZE 2048 |
ObjectAdd attaches a new object to the list of objects in the 3d world.
NOTE: You MUST have the object server Id defined in the object before calling this routine. If you don't calls to ObjectFind may not work.
- Parameters
-
p_obj | – Object to bring into world. |
ObjectAddWithoutHistory is the same as ObjectAdd, except it does not put the addition into the history hash tables (which are needed to save the game's state).
NOTE: You MUST have the object server Id defined in the object before calling this routine. If you don't calls to ObjectFind may not work.
- Parameters
-
p_obj | – Object to bring into world. |
ObjectAllocExtraData allocates memory onto an object for whatever use is needed by the caller.
- Parameters
-
p_obj | – Object to add memory to |
sizeData | – Amount of memory needed. |
- Returns
- POinter to memory
ObjectCheckCollide sees if the position given for an object will cause it to collide with any of the other objects.
- Parameters
-
p_obj | – object to check for object collision |
x | – X position to check for collision |
y | – Y position to check for collision |
height | – New height to check for |
ObjectCheckCollideAny sees if the position given for an object will cause it to collide with any of the other objects, passible or not.
- Parameters
-
p_obj | – object to check for object collision |
x | – X position to check for collision |
y | – Y position to check for collision |
height | – New height to check for |
- Returns
- TRUE = collided, else FALSE
ObjectCheckIfCollide checks to see if an object will fit at the given location and not collide with anything else.
- Parameters
-
p_obj | – Object to test for |
x | – new X position |
y | – new Y position |
z | – new Z position |
- Returns
- TRUE if blocked, FALSE if not.
Figure out which sector on the map the x-y coords point to
Is the sector okay?
Yes.
X,Y coordinates point to invalid sector.
ObjectCreate allocates a new object into the 3D engine and returns the pointer to that object.
- Returns
- Pointer to newly created object, or NULL.
Keep the client and server on different ID spaces.
ObjectDeclareMoveable takes a previously created object (by ObjectCreate) and fills out the information necessary to make it a moveable object on the map. It uses the given x, y, and picture number to initialize it.
- Parameters
-
p_obj | – Number of object to declare |
mapX | – X accurate location on map |
mapY | – Y accurate location on map |
ObjectDeclareStatic takes a previously created object (by ObjectCreate) and fills out the information necessary to make it a static object on the map. It uses the given x, y, and picture number to initialize it.
- Parameters
-
p_obj | – Pointer to object to declare |
mapX | – X coordinate on map |
mapY | – Y coordinate on map |
ObjectDestroy frees up an object in memory given the object pointer.
- Parameters
-
p_obj | – Pointer to object to destroy. |
ObjectDuplicate takes one object and make a copy of it.
- Parameters
-
p_obj | – Object to duplicate |
- Returns
- Duplicate object, else NULL
ObjectFind searches through the object lists for a matching object of the given id.
- Parameters
-
id | – Id of object to find. |
- Returns
- Pointer to found object, or NULL
ObjectFreeExtraData frees preivous allocated memory attached to a given object.
NOTE: This routine checks to see if there IS memory to free first and doesn't mind being called with no extra data.
- Parameters
-
p_obj | – Object to free memory from. |
ObjectGetAngularPosition determines what the x and y coordinate is in a given direction and distance from a given object
- Parameters
-
p_obj | – Object to find position in front of |
angle | – Angle from the object |
dist | – Distance in front of object |
p_x | – X and Y pointers for found location. |
p_y | – X and Y pointers for found location. |
ObjectGetBitmap returns a pointer to the picture of the object in bitmap format. It also grabs the front view.
- Parameters
-
p_obj | – Object to get height of |
- Returns
- Pointer to picture
ObjectGetBodyPartType gets the body part on an object.
- Parameters
-
p_obj | – Object to get body part of |
location | – Location of body part |
- Returns
- type of part, or 0
ObjectGetForwardPosition determines what the x and y coordinate is in front of an object by a given distance.
- Parameters
-
p_obj | – Object to find position in front of |
dist | – Distance in front of object |
p_x | – X and Y pointers for found location. |
p_y | – X and Y pointers for found location. |
ObjectGetMiddleHeight calculates the height of the mid section of an object.
- Parameters
-
p_obj | – Object to get middle height of |
- Returns
- middle height of object.
ObjectGetPicture returns the pointer to the exact picture information used for the object.
NOTE: Warning! Picture may change as the object animates.
- Parameters
-
p_obj | – Object to get height of |
- Returns
- Pointer to picture
ObjectGetPictureHeight returns how tall the current picture for the given object is.
NOTE: Warning! Height may change as the object animates.
- Parameters
-
p_obj | – Object to get height of |
- Returns
- Height
ObjectGetPictureWidth returns how wide the current picture for the given object is.
NOTE: Warning! Width may change as the object animates.
- Parameters
-
p_obj | – Object to get width of |
- Returns
- Width
ObjectIsAtXY checks to see if an object is at the given x, y location.
- Parameters
-
p_obj | – Object to test for |
x | – X Position to test |
y | – Y Position to test |
- Returns
- TRUE if ther, FALSE if not.
ObjectIsBeingCrushed checks to see if the given object has a bigger height than the height it is in.
- Parameters
-
p_obj | – Object to check if being crushed |
- Returns
- TRUE=yes, crushed, else FALSE
ObjectMakeImpassable clears the passibility bit in the object.
- Parameters
-
ObjectMakePassable sets the passibility bit in the object.
- Parameters
-
ObjectMarkForDestroy declares an object needs to be destroyed by outside routines. The object system does not automatically destroy.
- Parameters
-
p_obj | – Object to mark for destruction |
ObjectPrint dumps out the given object information to the given output io port.
- Parameters
-
fp | – File to output object |
p_obj | – Object to print |
ObjectRemove detaches an object from the list of objects in the 3d world.
- Parameters
-
p_obj | – Object to bring into world. |
ObjectRemoveScript checks to see if an object has a script, and if it does, turns off and removes that script.
- Parameters
-
p_obj | – Object to remove script from. |
ObjectsCountBasicType goes through the list of objects in the map and counts how many have the same basic type.
- Parameters
-
objectType | – Type to count |
- Returns
- Number found
!!! AMT FOR DEBUGGING PURPOSES ONLY ObjectsCountType goes through the list of objects in the map and counts how many have the same type.
- Parameters
-
objectType | – Type to count |
- Returns
- Number found
ObjectsDoToAll is a general routine to go through the list of objects and call a callback for each object in the list. In addition, if the callback returns a TRUE, the loop stops.
- Parameters
-
p_callback | – routine called for each object. If routine returns TRUE, the loop stops. Any other values (FALSE) continues. |
data | – data to pass on to the callback. |
To allow objects to destroy themselves in the callback,
I'll make a copy of each next ptr before calling it.
ObjectsDoToAllXY is just like ObjectDoToAll, except it only calls the callback routine if there is an object at the given location.
- Parameters
-
x | – X Position to test for object |
y | – Y Position to test for object |
p_callback | – routine called for each object. If routine returns TRUE, the loop stops. Any other values (FALSE) continues. |
data | – data to pass on to the callback. |
To allow objects to destroy themselves in the callback,
I'll make a copy of each next ptr before calling it.
ObjectsDoToAllXYRadius is similar to ObjectsDoToAllXY, but allows a "radius of effect."
- Parameters
-
x | – X Position to test for object |
y | – Y Position to test for object |
radius | – Radius around the point to check. |
p_callback | – routine called for each object. If routine returns TRUE, the loop stops. Any other values (FALSE) continues. |
data | – data to pass on to the callback. |
To allow objects to destroy themselves in the callback,
I'll make a copy of each next ptr before calling it.
ObjectsDoToAllAtXYZRadius is similar to DoToALLAtXYRadius, except it takes into consideration the z vector.
- Parameters
-
x | – X Center point to test for object |
y | – Y Center point to test for object |
z | – Z Center point to test for object |
radius | – Spherical radius to go around. |
p_callback | – routine called for each object. If routine returns TRUE, the loop stops. Any other values (FALSE) continues. |
data | – data to pass on to the callback. |
To allow objects to destroy themselves in the callback,
I'll make a copy of each next ptr before calling it.
ObjectSetAngle changes the angle and notes that the object has moved.
- Parameters
-
p_obj | – Object to set angle on |
angle | – Angle of object |
ObjectSetBodyPartType changes the body part on an object.
- Parameters
-
p_obj | – Object to change body part on |
location | – Location of body part |
objType | – Type of new body part |
ObjectsSetStance declares the stance that the object should now become.
- Parameters
-
p_obj | – Object to change stance of |
stance | – Numberical stance to change to |
ObjectSetType changes the object type that is used for this object.
NOTE: ALL objects MUST have it's type set at some type to ensure that a picture be used with the object. Otherwise, it doesn't have a pic.
- Parameters
-
p_obj | – Object to set type of |
type | – Type of object to become |
Store the object type number in the structure.
ObjectSetTypeSimple changes the object type that is used for this object.
NOTE: ALL objects MUST have it's type set at some type to ensure that a picture be used with the object. Otherwise, it doesn't have a pic.
- Parameters
-
p_obj | – Object to set type of |
type | – Type of object to become |
Store the object type number in the structure.
ObjectSetUpSectors determines the sectors that the object is over and transfers this information into the object.
- Parameters
-
p_obj | – Object to set up the sector |
ObjectsFinish cleans up after itself.
ObjectsGetNumMarkedForDestroy returns the number of objects that have set their MARK_FOR_DESTROY attribute.
ObjectsInitialize starts up any object info that is needed by this Object Module.
This routine is called when a group of objects touching a circular area needs to be make passable until they move again without touching anything.
- Parameters
-
x | – X Center location of circular area |
y | – Y Center location of circular area |
radius | – Radius of circular area |
zBottom | – Low Z position to check |
zTop | – High Z position to check |
ObjectsRemoveExtra removes and destroys any extra objects that are not in use on this level. This is useful to get rid of extra monsters that are turned off.
ObjectsUpdateAnimation goes through all the objects and updates their animation structures.
- Parameters
-
currentTime | – The current time for the animation or 0 if you just want to update angles |
ObjectsUpdateMovement goes through all the objects and updates their object move structures and does the appropriate movement actions.
- Parameters
-
delta | – Delta of time since last update |
What if delta is too big?
I'll break it up into pieces.
Only valid for a client+server build.
ObjectsUpdateMovementForFake is just like ObjectsUpdateMovement but it only updates fake objects.
- Parameters
-
delta | – Delta of time since last update |
What if delta is too big?
I'll break it up into pieces.
Only valid for a client+server build.
ObjectTeleport is one of the key players in getting things to work. This nice routine moves any object (even static ones) to the new location. Note that if you move a static object, it becomes a movable object (and is no longer static). If you want to move a static object without changing its type, use two calls to ViewChangeObject – one to erase the old object, one to add an object.
- Parameters
-
p_obj | – Number of object to affect. |
x | – Accurate map X position to move to. |
y | – Accurate map Y position to move to. |
ObjectTeleportAlways is just like ObjectTeleport, but the object goes to the position no matter if there is another object there.
- Parameters
-
p_obj | – Number of object to affect. |
x | – Accurate map X position to move to. |
y | – Accurate map Y position to move to. |
ObjectsUpdateAnimation goes through all the objects and updates their animation structures.
- Parameters
-
p_obj | – Object to update animation upon |
currentTime | – The current time for the animation |