| 1 | #ifndef GAME_CLIENT_SKIN_H |
|---|---|
| 2 | #define GAME_CLIENT_SKIN_H |
| 3 | |
| 4 | #include <base/color.h> |
| 5 | |
| 6 | #include <engine/graphics.h> |
| 7 | #include <engine/shared/protocol.h> |
| 8 | |
| 9 | // do this better and nicer |
| 10 | class CSkin |
| 11 | { |
| 12 | char m_aName[MAX_SKIN_LENGTH]; |
| 13 | |
| 14 | public: |
| 15 | class CSkinTextures |
| 16 | { |
| 17 | public: |
| 18 | IGraphics::CTextureHandle m_Body; |
| 19 | IGraphics::CTextureHandle m_BodyOutline; |
| 20 | |
| 21 | IGraphics::CTextureHandle m_Feet; |
| 22 | IGraphics::CTextureHandle m_FeetOutline; |
| 23 | |
| 24 | IGraphics::CTextureHandle m_Hands; |
| 25 | IGraphics::CTextureHandle m_HandsOutline; |
| 26 | |
| 27 | IGraphics::CTextureHandle m_aEyes[6]; |
| 28 | |
| 29 | void Reset(); |
| 30 | void Unload(IGraphics *pGraphics); |
| 31 | }; |
| 32 | |
| 33 | CSkinTextures m_OriginalSkin; |
| 34 | CSkinTextures m_ColorableSkin; |
| 35 | ColorRGBA m_BloodColor; |
| 36 | |
| 37 | class CSkinMetricVariableInt |
| 38 | { |
| 39 | public: |
| 40 | int m_Value; |
| 41 | |
| 42 | operator int() const; |
| 43 | CSkinMetricVariableInt &operator=(int NewVal); |
| 44 | CSkinMetricVariableInt(); |
| 45 | void Reset(); |
| 46 | }; |
| 47 | |
| 48 | class CSkinMetricVariableSize |
| 49 | { |
| 50 | public: |
| 51 | int m_Value; |
| 52 | |
| 53 | operator int() const; |
| 54 | CSkinMetricVariableSize &operator=(int NewVal); |
| 55 | CSkinMetricVariableSize(); |
| 56 | void Reset(); |
| 57 | }; |
| 58 | |
| 59 | class CSkinMetricVariable |
| 60 | { |
| 61 | public: |
| 62 | CSkinMetricVariableSize m_Width; |
| 63 | CSkinMetricVariableSize m_Height; |
| 64 | CSkinMetricVariableInt m_OffsetX; |
| 65 | CSkinMetricVariableInt m_OffsetY; |
| 66 | |
| 67 | // these can be used to normalize the metrics |
| 68 | CSkinMetricVariableSize m_MaxWidth; |
| 69 | CSkinMetricVariableSize m_MaxHeight; |
| 70 | |
| 71 | float WidthNormalized() const; |
| 72 | float HeightNormalized() const; |
| 73 | float OffsetXNormalized() const; |
| 74 | float OffsetYNormalized() const; |
| 75 | void Reset(); |
| 76 | }; |
| 77 | |
| 78 | class CSkinMetrics |
| 79 | { |
| 80 | public: |
| 81 | CSkinMetricVariable m_Body; |
| 82 | CSkinMetricVariable m_Feet; |
| 83 | |
| 84 | CSkinMetrics(); |
| 85 | void Reset(); |
| 86 | }; |
| 87 | CSkinMetrics m_Metrics; |
| 88 | |
| 89 | bool operator<(const CSkin &Other) const; |
| 90 | bool operator==(const CSkin &Other) const; |
| 91 | |
| 92 | CSkin(const char *pName); |
| 93 | CSkin(CSkin &&) = default; |
| 94 | CSkin &operator=(CSkin &&) = default; |
| 95 | |
| 96 | const char *GetName() const { return m_aName; } |
| 97 | |
| 98 | static bool IsValidName(const char *pName); |
| 99 | static const char m_aSkinNameRestrictions[]; |
| 100 | }; |
| 101 | |
| 102 | #endif |
| 103 |