Object Types.
More...
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
#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 |
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. |
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.
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.
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 |
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
ObjTypeGetHealth retreives the health value for the object type.
- Parameters
-
objTypeInst | – object type instance to set script of |
- Returns
- health value
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
ObjTypeGetMoveFlags retreives the movement flags associated with the given type instance.
- Parameters
-
objTypeInst | – object type instance to set script of |
- Returns
- health value
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
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
ObjTypeGetScript gets the script associated with the given object type instance.
- Parameters
-
objTypeInst | – object type instance to get script of |
- Returns
- object script
ObjTypeGetStance gets the current stance of the object.
- Parameters
-
objTypeInst | – object type instance to set stance of |
- Returns
- object stance
ObjTypeGetHealth retreives the weight value for the object type.
- Parameters
-
objTypeInst | – object type instance to set script of |
- Returns
- health value
ObjTypeGetHealth retreives the weight value for the object type.
- Parameters
-
objTypeInst | – object type instance to set script of |
- Returns
- health value
ObjTypePrint is a utility routine to print out the instance for a type of object.
- Parameters
-
fp | – output device |
objTypeInst | – instance to dispaly |
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 |
ObjTypeGetScript sets the script associated for the given object type instance.
- Parameters
-
objTypeInst | – object type instance to set script of |
script | – object script |
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.
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)
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) |