Advertisement
Guest User

Untitled

a guest
May 28th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.41 KB | None | 0 0
  1. struct studiohdr_t
  2. {
  3.     int                 id;
  4.     int                 version;
  5.  
  6.     int                 checksum;       // this has to be the same in the phy and vtx files to load!
  7.  
  8.     char                name[64];
  9.     int                 length;
  10.  
  11.  
  12.     Vector              eyeposition;    // ideal eye position
  13.  
  14.     Vector              illumposition;  // illumination center
  15.  
  16.     Vector              hull_min;       // ideal movement hull size
  17.     Vector              hull_max;
  18.  
  19.     Vector              view_bbmin;     // clipping bounding box
  20.     Vector              view_bbmax;
  21.  
  22.     int                 flags;
  23.  
  24.     int                 numbones;           // bones
  25.     int                 boneindex;
  26.     int                 RemapSeqBone(int iSequence, int iLocalBone) const;  // maps local sequence bone to global bone
  27.     int                 RemapAnimBone(int iAnim, int iLocalBone) const;     // maps local animations bone to global bone
  28.  
  29.     int                 numbonecontrollers;     // bone controllers
  30.     int                 bonecontrollerindex;
  31.  
  32.     int                 numhitboxsets;
  33.     int                 hitboxsetindex;
  34.  
  35.     // Look up hitbox set by index
  36.     mstudiohitboxset_t  *pHitboxSet(int i) const
  37.     {
  38.         Assert(i >= 0 && i < numhitboxsets);
  39.         return (mstudiohitboxset_t *)(((BYTE *)this) + hitboxsetindex) + i;
  40.     };
  41.  
  42.     // Calls through to hitbox to determine size of specified set
  43.     inline mstudiobbox_t *pHitbox(int i, int set) const
  44.     {
  45.         mstudiohitboxset_t const *s = pHitboxSet(set);
  46.         if (!s)
  47.             return NULL;
  48.  
  49.         return s->pHitbox(i);
  50.     };
  51.  
  52.     // Calls through to set to get hitbox count for set
  53.     inline int          iHitboxCount(int set) const
  54.     {
  55.         mstudiohitboxset_t const *s = pHitboxSet(set);
  56.         if (!s)
  57.             return 0;
  58.  
  59.         return s->numhitboxes;
  60.     };
  61.  
  62.     // file local animations? and sequences
  63.     //private:
  64.     int                 numlocalanim;           // animations/poses
  65.     int                 localanimindex;     // animation descriptions
  66.  
  67.     int                 numlocalseq;                // sequences
  68.     int                 localseqindex;
  69.  
  70.     //public:
  71.     bool                SequencesAvailable() const;
  72.     int                 GetNumSeq() const;
  73.     int                 iRelativeAnim(int baseseq, int relanim) const;  // maps seq local anim reference to global anim index
  74.     int                 iRelativeSeq(int baseseq, int relseq) const;        // maps seq local seq reference to global seq index
  75.  
  76.     //private:
  77.     mutable int         activitylistversion;    // initialization flag - have the sequences been indexed?
  78.     mutable int         eventsindexed;
  79.     //public:
  80.     int                 GetSequenceActivity(int iSequence);
  81.     void                SetSequenceActivity(int iSequence, int iActivity);
  82.     int                 GetActivityListVersion(void);
  83.     void                SetActivityListVersion(int version) const;
  84.     int                 GetEventListVersion(void);
  85.     void                SetEventListVersion(int version);
  86.  
  87.     // raw textures
  88.     int                 numtextures;
  89.     int                 textureindex;
  90.  
  91.  
  92.     // raw textures search paths
  93.     int                 numcdtextures;
  94.     int                 cdtextureindex;
  95.     inline char         *pCdtexture(int i) const { return (((char *)this) + *((int *)(((BYTE *)this) + cdtextureindex) + i)); };
  96.  
  97.     // replaceable textures tables
  98.     int                 numskinref;
  99.     int                 numskinfamilies;
  100.     int                 skinindex;
  101.     inline short        *pSkinref(int i) const { return (short *)(((BYTE *)this) + skinindex) + i; };
  102.  
  103.     int                 numbodyparts;
  104.     int                 bodypartindex;
  105.  
  106.     // queryable attachable points
  107.     //private:
  108.     int                 numlocalattachments;
  109.     int                 localattachmentindex;
  110.     //public:
  111.     int                 GetNumAttachments(void) const;
  112.     int                 GetAttachmentBone(int i);
  113.     // used on my tools in hlmv, not persistant
  114.     void                SetAttachmentBone(int iAttachment, int iBone);
  115.  
  116.     // animation node to animation node transition graph
  117.     //private:
  118.     int                 numlocalnodes;
  119.     int                 localnodeindex;
  120.     int                 localnodenameindex;
  121.     inline char         *pszLocalNodeName(int iNode) const { Assert(iNode >= 0 && iNode < numlocalnodes); return (((char *)this) + *((int *)(((BYTE *)this) + localnodenameindex) + iNode)); }
  122.     inline BYTE         *pLocalTransition(int i) const { Assert(i >= 0 && i < (numlocalnodes * numlocalnodes)); return (BYTE *)(((BYTE *)this) + localnodeindex) + i; };
  123.  
  124.     //public:
  125.     int                 EntryNode(int iSequence);
  126.     int                 ExitNode(int iSequence);
  127.     char                *pszNodeName(int iNode);
  128.     int                 GetTransition(int iFrom, int iTo) const;
  129.  
  130.     int                 numflexdesc;
  131.     int                 flexdescindex;
  132.  
  133.     int                 numflexcontrollers;
  134.     int                 flexcontrollerindex;
  135.  
  136.     int                 numflexrules;
  137.     int                 flexruleindex;
  138.  
  139.     int                 numikchains;
  140.     int                 ikchainindex;
  141.  
  142.     int                 nummouths;
  143.     int                 mouthindex;
  144.  
  145.     //private:
  146.     int                 numlocalposeparameters;
  147.     int                 localposeparamindex;
  148.     //public:
  149.     int                 GetNumPoseParameters(void) const;
  150.     int                 GetSharedPoseParameter(int iSequence, int iLocalPose) const;
  151.  
  152.     int                 surfacepropindex;
  153.     inline char * const pszSurfaceProp(void) const { return ((char *)this) + surfacepropindex; }
  154.  
  155.     // Key values
  156.     int                 keyvalueindex;
  157.     int                 keyvaluesize;
  158.     inline const char * KeyValueText(void) const { return keyvaluesize != 0 ? ((char *)this) + keyvalueindex : NULL; }
  159.  
  160.     int                 numlocalikautoplaylocks;
  161.     int                 localikautoplaylockindex;
  162.  
  163.     int                 GetNumIKAutoplayLocks(void) const;
  164.     int                 CountAutoplaySequences() const;
  165.     int                 CopyAutoplaySequences(unsigned short *pOut, int outCount) const;
  166.     int                 GetAutoplayList(unsigned short **pOut) const;
  167.  
  168.     // The collision model mass that jay wanted
  169.     float               mass;
  170.     int                 contents;
  171.  
  172.     // external animations, models, etc.
  173.     int                 numincludemodels;
  174.     int                 includemodelindex;
  175.     // implementation specific call to get a named model
  176.     const studiohdr_t   *FindModel(void **cache, char const *modelname) const;
  177.  
  178.     // implementation specific back pointer to virtual data
  179.     mutable void        *virtualModel;
  180.     //virtualmodel_t        GetVirtualModel(void) const;
  181.  
  182.     // for demand loaded animation blocks
  183.     int                 szanimblocknameindex;
  184.     inline char * const pszAnimBlockName(void) const { return ((char *)this) + szanimblocknameindex; }
  185.     int                 numanimblocks;
  186.     int                 animblockindex;
  187.     mutable void        *animblockModel;
  188.     BYTE *              GetAnimBlock(int i) const;
  189.  
  190.     int                 bonetablebynameindex;
  191.     inline const BYTE   *GetBoneTableSortedByName() const { return (BYTE *)this + bonetablebynameindex; }
  192.  
  193.     // used by tools only that don't cache, but persist mdl's peer data
  194.     // engine uses virtualModel to back link to cache pointers
  195.     void                *pVertexBase;
  196.     void                *pIndexBase;
  197.  
  198.     // if STUDIOHDR_FLAGS_CONSTANT_DIRECTIONAL_LIGHT_DOT is set,
  199.     // this value is used to calculate directional components of lighting
  200.     // on static props
  201.     BYTE                constdirectionallightdot;
  202.  
  203.     // set during load of mdl data to track *desired* lod configuration (not actual)
  204.     // the *actual* clamped root lod is found in studiohwdata
  205.     // this is stored here as a global store to ensure the staged loading matches the rendering
  206.     BYTE                rootLOD;
  207.  
  208.     // set in the mdl data to specify that lod configuration should only allow first numAllowRootLODs
  209.     // to be set as root LOD:
  210.     //  numAllowedRootLODs = 0  means no restriction, any lod can be set as root lod.
  211.     //  numAllowedRootLODs = N  means that lod0 - lod(N-1) can be set as root lod, but not lodN or lower.
  212.     BYTE                numAllowedRootLODs;
  213.  
  214.     BYTE                unused[1];
  215.  
  216.     int                 unused4; // zero out if version < 47
  217.  
  218.     int                 numflexcontrollerui;
  219.     int                 flexcontrolleruiindex;
  220.     int                 unused3[2];
  221.  
  222.     // FIXME: Remove when we up the model version. Move all fields of studiohdr2_t into studiohdr_t.
  223.     int                 studiohdr2index;
  224.  
  225.  
  226.     // NOTE: No room to add stuff? Up the .mdl file format version
  227.     // [and move all fields in studiohdr2_t into studiohdr_t and kill studiohdr2_t],
  228.     // or add your stuff to studiohdr2_t. See NumSrcBoneTransforms/SrcBoneTransform for the pattern to use.
  229.     int                 unused2[1];
  230.  
  231.     studiohdr_t() {}
  232.  
  233. private:
  234.     // No copy constructors allowed
  235.     studiohdr_t(const studiohdr_t& vOther);
  236.  
  237.     friend struct virtualmodel_t;
  238. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement