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

Object Types. More...

Data Structures

struct  T_compressionEntry
 
struct  T_objectFrame
 
struct  T_objectPic
 
struct  T_objectStance
 
struct  T_objectType
 
struct  T_objTypeInstanceStruct
 

Macros

#define INTERNAL_OBJECT_TYPE_COPIED_RESOURCE   0xFFFF0000
 
#define OBJECT_ANIMATE_BOUNCE   1
 
#define OBJECT_ANIMATE_ORDERED   0
 
#define OBJECT_ANIMATE_RANDOM   2
 
#define OBJECT_ANIMATE_UNKNOWN   3
 
#define OBJECT_TYPE_PICTURE_IS_COPY   0x1000
 
#define OBJECT_TYPE_PICTURE_IS_ORIGINAL   0x2000
 
#define OBJECT_TYPE_PICTURE_NEED_DRAW   0x4000
 

Typedefs

typedef T_word16 E_objectAnimateType
 
typedef T_sword16 T_bodyParts [MAX_BODY_PARTS]
 

Functions

E_Boolean ObjTypeAnimate (T_objTypeInstance objTypeInst, T_word32 currentTime)
 
T_objTypeInstance ObjTypeCreate (T_word16 objTypeNum, T_3dObject *p_obj)
 
T_void ObjTypeDeclareSomewhatLowOnMemory (T_void)
 
T_void ObjTypeDestroy (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetAnimData (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetAttributes (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetFrame (T_objTypeInstance objTypeInst)
 
T_voidObjTypeGetFrontFirstPicture (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetHealth (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetHeight (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetMoveFlags (T_objTypeInstance objTypeInst)
 
T_word32 ObjTypeGetNextAnimationTime (T_objTypeInstance objTypeInst)
 
T_voidObjTypeGetPicture (T_objTypeInstance objTypeInst, T_word16 angle, T_orientation *p_orient)
 
T_word16 ObjTypeGetRadius (T_objTypeInstance objTypeInst)
 
T_word32 ObjTypeGetScript (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetStance (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetValue (T_objTypeInstance objTypeInst)
 
T_word16 ObjTypeGetWeight (T_objTypeInstance objTypeInst)
 
E_Boolean ObjTypeIsActive (T_objTypeInstance objTypeInst)
 
E_Boolean ObjTypeIsLowPiecewiseRes (T_void)
 
T_void ObjTypePrint (FILE *fp, T_objTypeInstance objTypeInst)
 
T_void ObjTypeRebuildPieces (T_objTypeInstance objTypeInst)
 
T_void ObjTypeSetAnimData (T_objTypeInstance objTypeInst, T_word16 data)
 
T_void ObjTypeSetNextAnimationTime (T_objTypeInstance objTypeInst, T_word32 time)
 
T_void ObjTypeSetScript (T_objTypeInstance objTypeInst, T_word32 script)
 
T_void ObjTypeSetStance (T_objTypeInstance objTypeInst, T_word16 stance)
 
T_word16 ObjTypesGetResolution (T_void)
 
T_void ObjTypesSetResolution (T_word16 resolution)
 

Detailed Description

Object Types.

This would probably be better called "Object Animation System". ObjType is the code that handles animations of objects as they step through pre-determined animation types. So, you can have a creature with a multi-step death scene yell and fall to the ground using this. Objects have "Info" file resources that have all the animation information compiled into them.

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

Macro Definition Documentation

#define INTERNAL_OBJECT_TYPE_COPIED_RESOURCE   0xFFFF0000
#define OBJECT_ANIMATE_BOUNCE   1
#define OBJECT_ANIMATE_ORDERED   0
#define OBJECT_ANIMATE_RANDOM   2
#define OBJECT_ANIMATE_UNKNOWN   3
#define OBJECT_TYPE_PICTURE_IS_COPY   0x1000
#define OBJECT_TYPE_PICTURE_IS_ORIGINAL   0x2000
#define OBJECT_TYPE_PICTURE_NEED_DRAW   0x4000

Typedef Documentation

E_objectAnimateType declares the type of animation "movement" that an animate object undergoes. Below is the different types.

Parameters
ORDERED– 1, 2, 3, 4, 1, 2, 3, 4, etc.
BOUNCE– 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, etc.
RANDOM– Like it says, bro. 1423424242E43144231123123!!! Apparently, GNU CC does not allow you to specify the storage type for an enum! It doesn't issue a warning, it just makes all enums into ints, which in our world are T_word32's. Thus the structure no longer works with the same res file. For now, I just redefined things as follows, to get it to work.
typedef T_sword16 T_bodyParts[MAX_BODY_PARTS]

Function Documentation

E_Boolean ObjTypeAnimate ( T_objTypeInstance  objTypeInst,
T_word32  currentTime 
)

ObjTypeAnimate updates the animation state for the object. However, an object must call ObjTypeGetPicture followed with a call to ObjectSetPicture to get the image to update. This routine is ONLY to change the state.

Parameters
objTypeInst– Handle to the instance to update
currentTime– current time to update for
Returns
TRUE if there is a change

Now that we've updated the stances, we need to take care of

the sounds and attributes associated with the current frame.

Check to see if any change occurred in the stance or frame.

Yes. Let's see if any attributes or sounds are attached.

T_objTypeInstance ObjTypeCreate ( T_word16  objTypeNum,
T_3dObject p_obj 
)

ObjTypeCreate instantiates a structure for the given object type number. In addition, all pictures are locked into memory as needed.

Parameters
objTypeNum– Type of object to instantiate
p_obj– Pointer to 3D Object to link.
Returns
Handle to created object instance, or OBJECT_TYPE_INSTANCE_BAD

Clear out the current sound handle.

And, finally, set the object pointer.

T_void ObjTypeDeclareSomewhatLowOnMemory ( T_void  )
T_void ObjTypeDestroy ( T_objTypeInstance  objTypeInst)

ObjTypeDestroy removes all references to the object type of an object and, if necessary, unlocks all the pictures attached to it.

Parameters
objTypeInst– Type of object to destroy
T_word16 ObjTypeGetAnimData ( T_objTypeInstance  objTypeInst)
T_word16 ObjTypeGetAttributes ( T_objTypeInstance  objTypeInst)

ObjTypeGetAttributes returns the set of predefined characteristic flags defined for this object type.

Parameters
objTypeInst– Handle to the instance to update
Returns
Attributes of object type
T_word16 ObjTypeGetFrame ( T_objTypeInstance  objTypeInst)
T_void* ObjTypeGetFrontFirstPicture ( T_objTypeInstance  objTypeInst)
T_word16 ObjTypeGetHealth ( T_objTypeInstance  objTypeInst)

ObjTypeGetHealth retreives the health value for the object type.

Parameters
objTypeInst– object type instance to set script of
Returns
health value
T_word16 ObjTypeGetHeight ( T_objTypeInstance  objTypeInst)

ObjTypeGetHeight looks at the first frame of the first stance and determines the picture's height.

Parameters
objTypeInst– instance to find height of
Returns
height
T_word16 ObjTypeGetMoveFlags ( T_objTypeInstance  objTypeInst)

ObjTypeGetMoveFlags retreives the movement flags associated with the given type instance.

Parameters
objTypeInst– object type instance to set script of
Returns
health value
T_word32 ObjTypeGetNextAnimationTime ( T_objTypeInstance  objTypeInst)
T_void* ObjTypeGetPicture ( T_objTypeInstance  objTypeInst,
T_word16  angle,
T_orientation p_orient 
)

ObjTypeGetPicture returns the pointer to a picture that is appropriate for the current stance, frame, and angle.

Parameters
objTypeInst– Handle to the instance to update
angle– Angle that object is facing relative to the view.
p_orient– Pointer to picture orientation
Returns
Attributes of object type
T_word16 ObjTypeGetRadius ( T_objTypeInstance  objTypeInst)

ObjTypeGetRadius returns the defined radius for the given object type's instance data.

Parameters
objTypeInst– Handle to the instance to update
Returns
Radius of object type
T_word32 ObjTypeGetScript ( T_objTypeInstance  objTypeInst)

ObjTypeGetScript gets the script associated with the given object type instance.

Parameters
objTypeInst– object type instance to get script of
Returns
object script
T_word16 ObjTypeGetStance ( T_objTypeInstance  objTypeInst)

ObjTypeGetStance gets the current stance of the object.

Parameters
objTypeInst– object type instance to set stance of
Returns
object stance
T_word16 ObjTypeGetValue ( T_objTypeInstance  objTypeInst)

ObjTypeGetHealth retreives the weight value for the object type.

Parameters
objTypeInst– object type instance to set script of
Returns
health value
T_word16 ObjTypeGetWeight ( T_objTypeInstance  objTypeInst)

ObjTypeGetHealth retreives the weight value for the object type.

Parameters
objTypeInst– object type instance to set script of
Returns
health value
E_Boolean ObjTypeIsActive ( T_objTypeInstance  objTypeInst)
E_Boolean ObjTypeIsLowPiecewiseRes ( T_void  )
T_void ObjTypePrint ( FILE *  fp,
T_objTypeInstance  objTypeInst 
)

ObjTypePrint is a utility routine to print out the instance for a type of object.

Parameters
fp– output device
objTypeInst– instance to dispaly
T_void ObjTypeRebuildPieces ( T_objTypeInstance  objTypeInst)

ObjTypeRebuildPiecewise goes through all the frames in an object type and builds the appropriate picture out of parts as based on this instance of the object.

Parameters
objTypeInst– Pointer to object type to lock
T_void ObjTypeSetAnimData ( T_objTypeInstance  objTypeInst,
T_word16  data 
)
T_void ObjTypeSetNextAnimationTime ( T_objTypeInstance  objTypeInst,
T_word32  time 
)
T_void ObjTypeSetScript ( T_objTypeInstance  objTypeInst,
T_word32  script 
)

ObjTypeGetScript sets the script associated for the given object type instance.

Parameters
objTypeInst– object type instance to set script of
script– object script
T_void ObjTypeSetStance ( T_objTypeInstance  objTypeInst,
T_word16  stance 
)

ObjTypeSetStance changes the stance of the given object type instance to new declare stance. The frame of the stance is set to zero.

Parameters
objTypeInst– object type instance to set stance of
stance– Stance to be

Create sounds/change attributes/whatever.

T_word16 ObjTypesGetResolution ( T_void  )

ObjTypesGetResolution retruns what power of two to cut out pictures from animation frames.

Returns
Power of 2 loss (0 = none, 1=half, 2=fourth, 3=eighth)
T_void ObjTypesSetResolution ( T_word16  resolution)

ObjTypesSetResolution declares what power of two to cut out pictures from animation frames.

Parameters
resolution– Power of 2 loss (0 = none, 1=half, 2=fourth, 3=eighth)