123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- //---------------------------------------------------------------------------
- //
- // Genactor.h - This file contains the header for the generic 3D appearance class
- //
- // MechCommander 2
- //
- //---------------------------------------------------------------------------//
- // Copyright (C) Microsoft Corporation. All rights reserved. //
- //===========================================================================//
- #ifndef GENACTOR_H
- #define GENACTOR_H
- //---------------------------------------------------------------------------
- // Include files
- #ifndef APPEAR_H
- #include "appear.h"
- #endif
- #ifndef APPRTYPE_H
- #include "apprtype.h"
- #endif
- #ifndef MSL_H
- #include "msl.h"
- #endif
- #ifndef OBJECTAPPEARANCE_H
- #include "ObjectAppearance.h"
- #endif
- //**************************************************************************************
- #ifndef NO_ERR
- #define NO_ERR 0
- #endif
- #define MAX_GEN_ANIMATIONS 5
- //***********************************************************************
- //
- // GenericAppearanceType
- //
- //***********************************************************************
- class GenericAppearanceType : public AppearanceType
- {
- public:
-
- TG_TypeMultiShapePtr genShape;
- TG_TypeMultiShapePtr genDmgShape;
-
- TG_AnimateShapePtr genAnimData[MAX_GEN_ANIMATIONS];
- bool genAnimLoop[MAX_GEN_ANIMATIONS];
- bool genReverse[MAX_GEN_ANIMATIONS];
- bool genRandom[MAX_GEN_ANIMATIONS];
- long genStartF[MAX_GEN_ANIMATIONS];
-
- char rotationalNodeId[TG_NODE_ID];
- char textureName[50];
- DWORD dotRGB;
-
- public:
-
- void init (void)
- {
- genShape = NULL;
- for (long i=0;i<MAX_GEN_ANIMATIONS;i++)
- genAnimData[i] = NULL;
- textureName[0] = 0;
- dotRGB = 0x00ffffff;
- }
-
- GenericAppearanceType (void)
- {
- init();
- }
- ~GenericAppearanceType (void)
- {
- destroy();
- }
- void setAnimation (TG_MultiShapePtr shape, DWORD animationNum);
-
- long getNumFrames (long animationNum)
- {
- if ((animationNum >= 0) && (animationNum < MAX_GEN_ANIMATIONS) && (genAnimData[animationNum]))
- return genAnimData[animationNum]->GetNumFrames();
- return 0.0f;
- }
- float getFrameRate (long animationNum)
- {
- if ((animationNum >= 0) && (animationNum < MAX_GEN_ANIMATIONS) && (genAnimData[animationNum]))
- return genAnimData[animationNum]->GetFrameRate();
- return 0.0f;
- }
- bool isReversed (long animationNum)
- {
- if ((animationNum >= 0) && (animationNum < MAX_GEN_ANIMATIONS) && (genAnimData[animationNum]))
- return genReverse[animationNum];
- return false;
- }
-
- bool isLooped (long animationNum)
- {
- if ((animationNum >= 0) && (animationNum < MAX_GEN_ANIMATIONS) && (genAnimData[animationNum]))
- return genAnimLoop[animationNum];
- return false;
- }
-
- bool isRandom (long animationNum)
- {
- if ((animationNum >= 0) && (animationNum < MAX_GEN_ANIMATIONS) && (genAnimData[animationNum]))
- return genRandom[animationNum];
- return false;
- }
-
- virtual void init (char *fileName);
-
- virtual void destroy (void);
- };
- //***********************************************************************
- //
- // GenericAppearance
- //
- //***********************************************************************
- class GenericAppearance : public ObjectAppearance
- {
- public:
- GenericAppearanceType* appearType;
- TG_MultiShapePtr genShape;
-
- long genAnimationState;
- float currentFrame;
- float genFrameRate;
- bool isReversed;
- bool isLooping;
- bool setFirstFrame;
- bool canTransition;
-
- float hazeFactor;
- float pitch;
-
- long status;
-
- float OBBRadius;
-
- long skyNumber;
-
- public:
- virtual void init (AppearanceTypePtr tree = NULL, GameObjectPtr obj = NULL);
- virtual AppearanceTypePtr getAppearanceType (void)
- {
- return appearType;
- }
- void changeSkyToSkyNum (char *txmName, char *newName);
-
- GenericAppearance (void)
- {
- init();
- }
- virtual long update (bool animate = true);
- virtual long render (long depthFixup = 0);
- virtual long renderShadows (void);
- virtual void destroy (void);
- ~GenericAppearance (void)
- {
- destroy();
- }
- virtual bool recalcBounds (void);
-
- virtual bool getInTransition (void)
- {
- return (canTransition == false);
- }
- virtual void setGesture (unsigned long gestureId);
-
- virtual long getCurrentGestureId (void)
- {
- return genAnimationState;
- }
- virtual unsigned long getAppearanceClass (void)
- {
- return GENERIC_APPR_TYPE;
- }
-
- virtual void setObjectNameId (long objId)
- {
- objectNameId = objId;
- }
- virtual bool isMouseOver (float px, float py);
-
- virtual void setObjectParameters (Stuff::Vector3D &pos, float rot, long selected, long alignment, long homeRelations);
-
- virtual void setMoverParameters (float turretRot, float lArmRot = 0.0f, float rArmRot = 0.0f, bool isAirborne = false);
-
- virtual void setObjStatus (long oStatus);
-
- virtual void markTerrain (_ScenarioMapCellInfo* pInfo, int type, int counter);
-
- virtual void markMoveMap (bool passable);
- virtual void setIsHudElement (void)
- {
- genShape->SetIsHudElement();
- }
-
- virtual void scale (float scaleFactor)
- {
- genShape->ScaleShape(scaleFactor);
- }
-
- virtual Stuff::Point3D getRootNodeCenter (void)
- {
- Stuff::Point3D result = genShape->GetRootNodeCenter();
- return result;
- }
-
- virtual void setSkyNumber (long skyNum);
- };
- //***************************************************************************
- #endif
|