Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

puppet.h

Go to the documentation of this file.
00001 #ifndef __STAGE_PUPPET__
00002 #define __STAGE_PUPPET__
00003 
00013 /*******************************************/
00014 /* Defines & Includes                      */
00015 /*******************************************/
00016 
00017 /* Parsing code for XML files. *************/
00018 /*******************************************/
00019 #include "ssf.h"
00020 #include "vpm.h"
00021 
00022 /* Knowledge of the engine and joint types */
00023 /*******************************************/
00024 #include "engineAbstract.h"
00025 #include "joint.h"
00026 
00027 /* Hard Size Limits ************************/
00028 /*******************************************/
00029 
00037 #define ACTION_MAX 64
00038 
00039 /* Puppet Type Identifiers *****************/
00040 /*******************************************/
00041 
00048 #define PUPPET_NUM 0x0001
00049 
00056 #define MODELPUPPET_NUM 0x0002
00057 
00064 #define LIGHTPUPPET_NUM 0x0004
00065 
00072 #define PSYSTEMPUPPET_NUM 0x0008
00073 
00074 /* Puppet-Related Error Codes **************/
00075 /*******************************************/
00076 
00084 #define PUPPET_NULL -101
00085 
00091 #define PUPPET_ALREADY_EXISTS -102
00092 
00099 #define NO_ACTION -103
00100 
00101 /*******************************************/
00102 /* Classes                                 */
00103 /*******************************************/
00104 
00111 class Puppet
00112 {
00113  protected:
00120   JointPtr *actionArray;
00124   uint16 actionArrayMax;
00131   string modelName;
00132  public:
00140   HANDLE_TYPE myHandle;
00141  protected:
00147   VECTOR_TYPE position;
00153   VECTOR_TYPE scale;
00162   VECTOR_TYPE orientation;
00163 
00164  public:
00170   Puppet::Puppet( void );
00171 
00175   Puppet::~Puppet( void );
00176 
00185   virtual void ActOnJoint( uint16 jointEntry, float value );
00186 
00201   virtual RESULT_TYPE AddNodeJoint( uint16 actionArrayLoc, uint16 actionCode, uint16 actionNode, float valMax, float valMin, string &name, VECTOR_TYPE supplementalData );
00202 
00216   virtual RESULT_TYPE AddParticleJoint( uint16 actionArrayLoc, PuppetProperty aP, VECTOR_TYPE vBegin, VECTOR_TYPE vEnd, string &n, VECTOR_TYPE sup );
00217 
00232   virtual RESULT_TYPE AddPropertyJoint( uint16 actionArrayLoc, PuppetProperty aP, VECTOR_TYPE vBegin, VECTOR_TYPE vEnd, string &n, VECTOR_TYPE sup, HANDLE_TYPE pH);
00233 
00242   virtual RESULT_TYPE DeleteJoint( uint16 actionArrayLoc );
00243 
00253   void FillCommon(vpmVPM *vpmPuppetInfo, ssfPuppet *ssfPuppetInfo, VPM *vpmFileInfo,  ObjectCreateStruct &createstruct);
00260   VECTOR_TYPE GetPosition( void );
00261 
00268   VECTOR_TYPE GetScale( void );
00269 
00279   virtual void KeyframeAnimation( uint16 anim ) = 0;
00280 
00311   RESULT_TYPE ModifyJoint( uint16 actionArrayLoc, JointPart part, float mVal );
00312   RESULT_TYPE ModifyJoint( uint16 actionArrayLoc, JointPart part, string &mVal );
00313   RESULT_TYPE ModifyJoint( uint16 actionArrayLoc, JointPart part, uint16 mVal );
00314   RESULT_TYPE ModifyJoint( uint16 actionArrayLoc, JointPart part, VECTOR_TYPE mVal );
00315 
00322   virtual uint16 PuppetType( void );
00323 
00328   void SetPosition( VECTOR_TYPE newPosition );
00329 
00334   void SetScale( VECTOR_TYPE newScale );
00335 
00343   virtual void UpdateTick( void ) = 0;
00344 };
00345 
00353 class ModelPuppet : public Puppet
00354 {
00355  private:
00364   string modelFile;
00373   string textureFile;
00374  public:
00383   ModelPuppet( vpmVPM *vpmPuppetInfo, ssfPuppet *ssfPuppetInfo, VPM *vpmFileInfo );
00393   void KeyframeAnimation( uint16 anim );
00394 #ifdef __ENGINE_LITHTECH__
00395 
00407   void NodeControlFunc( HOBJECT hObj, HMODELNODE hNode, LTMatrix *pGlobalMat );
00408 #endif
00409 
00415   uint16 PuppetType( void );
00423   void UpdateTick( void );
00424 };
00425 
00432 class LightPuppet : public Puppet
00433 {
00434  public:
00443   LightPuppet( vpmVPM *vpmPuppetInfo, ssfPuppet *ssfPuppetInfo, VPM *vpmFileInfo );
00451   void KeyframeAnimation( uint16 anim );
00456   uint16 PuppetType( void );
00464   void UpdateTick( void );
00465 };
00466 
00476 class PSystemPuppet : public Puppet
00477 {
00478  private:
00479   VECTOR_TYPE psys_color;
00480   float psys_gravity;
00481   float psys_lifetime;
00482   uint16 psys_spawn_rate;
00491   string textureFile;
00492 
00493  public:
00502   PSystemPuppet( vpmVPM *vpmPuppetInfo, ssfPuppet *ssfPuppetInfo, VPM *vpmFileInfo );
00509   void KeyframeAnimation( uint16 anim );
00514   uint16 PuppetType( void );
00522   void UpdateTick( void );
00523 
00524   friend class ParticleJoint;
00525 };
00526 
00530 typedef Puppet *PuppetPtr;
00531 
00532 /*******************************************/
00533 /* External Functions                      */
00534 /*******************************************/
00535 
00536 #ifdef __ENGINE_LITHTECH__
00537 
00548 void PuppetNodeControlFunc( HOBJECT hObj, HMODELNODE hNode, LTMatrix *pGlobalMat, void *pUserData);
00549 #endif
00550 
00562 void StringToActionType( char *the_string, uint16 &joint_type, uint16 &action_type );
00573 void StringToObjectType( char *the_string, uint16 &object_type );
00574 
00575 /*******************************************/
00576 /* Externed Globals                        */
00577 /*******************************************/
00578 
00579 #endif

Generated on Tue Oct 16 13:42:10 2001 for The Stage by doxygen1.2.11 written by Dimitri van Heesch, © 1997-2001