// CGfxCharacter - [2020-04-13 11:57:46]
#ifndef _CGFXCHARACTER_H_
#define _CGFXCHARACTER_H_

#include "CFTTModel.h"
#include "CPlayer.h"
#include "SAT.h"
#include "TUV.h"
#include "CAnimLib.h"
#include "CFTTRenderToTexture.h"

/*
0017D450 CGfxCharacter::CGfxCharacter(int,int,int,TPlayerInfo *,CPlayer *,int,int)
0017D688 CGfxCharacter::SetAnimation(int,float,int)
0017D69C CGfxCharacter::SetupPlayer(TPlayerInfo *,bool,int,int)
0017DC4C CGfxCharacter::~CGfxCharacter()
0017DD78 CGfxCharacter::SetTeamID(int)
0017DD80 CGfxCharacter::Init()
0017DDC0 CGfxCharacter::SetMegaAtlasDims(int,int,int,int)
0017DEF4 CGfxCharacter::LoadDefaultModels()
0017E5EC CGfxCharacter::Shutdown()
0017E640 CGfxCharacter::DeleteDefaultModels()
0017E8DC CGfxCharacter::SetLOD(int,int,int)
0017E8E6 CGfxCharacter::SetKit(int)
0017E8EC CGfxCharacter::SetBootsColour(EPlayerBoots)
0017E904 CGfxCharacter::SetFaceType(int)
0017E906 CGfxCharacter::SetSkinColour(EPlayerSkinColour,int)
0017E910 CGfxCharacter::SetFacialHair(EPlayerFacialHair,EPlayerHairColour)
0017E960 CGfxCharacter::SetHairColour(EPlayerHairColour)
0017E968 CGfxCharacter::GetOfficialSkinHair()
0017E984 CGfxCharacter::UpdateUVs()
0017E9C0 CGfxCharacter::CreateAtlasTextures(TPlayerInfo *,int,int,int,int)
0017F3D4 CGfxCharacter::SetBodyXTexture(TPlayerInfo *)
0017F530 CGfxCharacter::SetAnimationBlend(int,int,float,float,float,float,int,int)
0017F564 CGfxCharacter::SetVerts(CFTTModel *)
0017F5B4 CGfxCharacter::GenerateSamples(TSATFrameSample *,TCharAnimSpec *)
0017F7D8 CGfxCharacter::GetHeadRot()
0017F864 CGfxCharacter::UpdateMatrix(CFTTMatrix32 *)
0017F91C CGfxCharacter::UpdateMatrices(CFTTMatrix32 *)
0017FA70 CGfxCharacter::SkinShadow()
0017FA76 CGfxCharacter::SkinModels()
0017FAB8 CGfxCharacter::RenderBatch(ESHADOWMAP_SAMPLING,int)
00180860 CGfxCharacter::GetMegaTexture()
001808AC CGfxCharacter::RenderShadowBatch(int)
001809C8 CGfxCharacter::CreateMippedMegaTexture()
00180A30 CGfxCharacter::SkinProp()
00180A64 CGfxCharacter::RenderProp(CFTTMatrix32 &)
00180B20 CGfxCharacter::RenderShadow(CFTTMatrix32 *)
00180B70 CGfxCharacter::GetInfo(CFTTModel *&,CFTTMatrix32 &)
00180BD4 CGfxCharacter::ResetShadowMatrix()
00180BF0 CGfxCharacter::LockVertexBuffers()
00180C00 CGfxCharacter::UnlockVertexBuffers()
00180C0C CGfxCharacter::UpdateAnimation(bool)
00180E00 CGfxCharacter::GetUVScale(TBinUVScale *,int)
00180F28 CGfxCharacter::UpdateUVs(CFTTModel **,int,TUV **)
00181148 CGfxCharacter::SetPlayerIsKeeper(bool)
0018114E CGfxCharacter::UpdateBlinking()
00181188 CGfxCharacter::Blink(bool)
00181374 CGfxCharacter::GetHeadInfo(int,CFTTModel *&,CFTTModel *&,TUV *&,TUV *&,int &,EPlayerSkinColour &)

0xC44
*/

enum EPlayerHairColour {
  EPlayerHairColour_0,
  EPlayerHairColour_1,
  EPlayerHairColour_2,
  EPlayerHairColour_3,
  EPlayerHairColour_4,
  EPlayerHairColour_5,
  EPlayerHairColour_6,
  EPlayerHairColour_7,
};

// 0x18
struct OfficialSkinHair_st {
  int filed_0;
  int filed_4;
  int filed_8;
  int filed_C;
  int filed_10;
  int filed_14;
};

enum EPlayerSkinColour {
  EPlayerSkinColour_0,
  EPlayerSkinColour_1,
  EPlayerSkinColour_2,
  EPlayerSkinColour_3,
  EPlayerSkinColour_4,
  EPlayerSkinColour_5,
  EPlayerSkinColour_6,
};

enum EPlayerFacialHair {
  EPlayerFacialHair_0,
  EPlayerFacialHair_1,
  EPlayerFacialHair_2,
  EPlayerFacialHair_3,
  EPlayerFacialHair_4,
  EPlayerFacialHair_5,
  EPlayerFacialHair_6,
  EPlayerFacialHair_7,
};

enum ESHADOWMAP_SAMPLING {
  ESHADOWMAP_SAMPLING_0,
  ESHADOWMAP_SAMPLING_1,
  ESHADOWMAP_SAMPLING_2,
  ESHADOWMAP_SAMPLING_3,
  ESHADOWMAP_SAMPLING_4,
  ESHADOWMAP_SAMPLING_5,
  ESHADOWMAP_SAMPLING_6,
  ESHADOWMAP_SAMPLING_7,
};

enum EPlayerBoots {
  EPlayerBoots_0,
  EPlayerBoots_1,
  EPlayerBoots_2,
  EPlayerBoots_3,
  EPlayerBoots_4,
  EPlayerBoots_5,
};

struct TBinUVScale {
  float field_0;
  float field_4;
  float field_8;
  float field_c;
};

struct LOD {
  uint m_lod1;
  uint m_lod2;
  uint m_lod3;
  uint m_lod4;
};

struct TCharAnimSpec {
  int v_1;
  float v_2;
  int v_3;
  int v_4;
};

// TSATFrameSample 0x498

class CGfxCharacter {
public:
  CGfxCharacter(int, int, int, TPlayerInfo *, CPlayer *, int, int);                               // 0017D450
  ~CGfxCharacter();                                                                               // 0017DC4C
  void SetAnimation(int, float, int);                                                             // 0017D688
  void SetupPlayer(TPlayerInfo *, bool, int, int);                                                // 0017D69C
  void SetTeamID(int);                                                                            // 0017DD78
  static void Init();                                                                             // 0017DD80
  static void SetMegaAtlasDims(int, int, int, int);                                               // 0017DDC0
  static void LoadDefaultModels();                                                                // 0017DEF4
  static void Shutdown();                                                                         // 0017E5EC
  void DeleteDefaultModels();                                                                     // 0017E640
  void SetLOD(int, int, int);                                                                     // 0017E8DC
  void SetKit(int);                                                                               // 0017E8E6
  void SetBootsColour(EPlayerBoots);                                                              // 0017E8EC
  void SetFaceType(int);                                                                          // 0017E904
  void SetSkinColour(EPlayerSkinColour, int);                                                     // 0017E906
  void SetFacialHair(EPlayerFacialHair, EPlayerHairColour);                                       // 0017E910
  void SetHairColour(EPlayerHairColour);                                                          // 0017E960
  OfficialSkinHair_st *GetOfficialSkinHair();                                                     // 0017E968
  void UpdateUVs();                                                                               // 0017E984
  void CreateAtlasTextures(TPlayerInfo *, int, int, int, int);                                    // 0017E9C0
  void SetBodyXTexture(TPlayerInfo *);                                                            // 0017F3D4
  void SetAnimationBlend(int, int, float, float, float, float, int, int);                         // 0017F530
  void SetVerts(CFTTModel *);                                                                     // 0017F564
  void GenerateSamples(TSATFrameSample *, TCharAnimSpec *);                                       // 0017F5B4
  uint32 GetHeadRot();                                                                            // 0017F7D8
  void UpdateMatrix(CFTTMatrix32 *);                                                              // 0017F864
  void UpdateMatrices(CFTTMatrix32 *);                                                            // 0017F91C
  void SkinShadow();                                                                              // 0017FA70
  void SkinModels();                                                                              // 0017FA76
  void RenderBatch(ESHADOWMAP_SAMPLING, int);                                                     // 0017FAB8
  static CFTTTexture *GetMegaTexture();                                                           // 00180860
  void RenderShadowBatch(int);                                                                    // 001808AC
  static void CreateMippedMegaTexture();                                                          // 001809C8
  void SkinProp();                                                                                // 00180A30
  void RenderProp(CFTTMatrix32 &);                                                                // 00180A64
  void RenderShadow(CFTTMatrix32 *);                                                              // 00180B20
  void GetInfo(CFTTModel *&, CFTTMatrix32 &);                                                     // 00180B70
  void ResetShadowMatrix();                                                                       // 00180BD4
  void LockVertexBuffers();                                                                       // 00180BF0
  void UnlockVertexBuffers();                                                                     // 00180C00
  int UpdateAnimation(bool);                                                                      // 00180C0C
  int GetUVScale(TBinUVScale *, int);                                                             // 00180E00
  void UpdateUVs(CFTTModel **, int, TUV **);                                                      // 00180F28
  void SetPlayerIsKeeper(bool);                                                                   // 00181148
  void UpdateBlinking();                                                                          // 0018114E
  void Blink(bool);                                                                               // 00181188
  void GetHeadInfo(int, CFTTModel *&, CFTTModel *&, TUV *&, TUV *&, int &, EPlayerSkinColour &);  // 00181374

  CFTTModel *m_ShadowModle_0;
  CFTTModel *m_BodyModles_4[5];
  CFTTModel *m_HairModeles_18[5];
  CFTTModel *m_HeaderModles_2c[5];

  // CFTTModel *m_ShadowModle_0[15];
  TUV *m_BodyUV_40[5];
  TUV *m_HairUV_54[5];
  TUV *m_HeaderUV_68[5];
  LOD m_lod_7c;
  int m_Count_8c;
  int m_TeamID_90;
  int m_TeamIndex_94;
  int m_PlayerIndex_98;  //第0，11是守门员
  CPlayer *m_Player_9C;
  int m_AtlasCount_A0;
  int m_UnknowType_A4;  //某种类型， 默认是0， 但是当m_PlayerIndex_98是14的时候， 会有1，2，3，4这几个值. 大部分的时候跟躯干相关, 控制2996/BB4
  bool m_IsKeeper_A8;
  bool m_UnknowType_A9;   //当m_PlayerIndex_98是14的时候是1， 否则是0
  uchar m_UnknowType_AA;  //当m_PlayerIndex_98大于14的时候是1， 其它情况是0
  char m_UnknowType_AB;   //未知
  int m_Unknow_AC;        //一个随机值， 不知道干嘛的
  int m_Unknow_B0;
  int m_IsJudgment_B4;  //是否是裁判
  float m_ScaleMatrixFlag_B8;
  TCharAnimSpec m_UnknowAnimation_BC;  // SetAnimation
  TCharAnimSpec m_UnknowAnimation_CC;  // SetAnimationBlend
  float m_Rotate_DC;
  float m_Blend_E0;
  CFTTMatrix32 m_SalMatrix_E4[42];
  int m_Unknow_B64;
  int m_Unknow_B68;
  int m_Unknow_B6C;
  int m_Unknow_B70;
  int m_Unknow_B74;
  int m_Unknow_B78;
  int m_Unknow_B7C;
  int m_Unknow_B80;
  int m_Unknow_B84;
  int m_Unknow_B88;
  int m_Skincolor1_B8C;
  int m_Skincolor2_B90;
  int m_KitTextureID_B94;
  int m_AtlasAmbientTexture_B98;
  int m_FacialHairTexture_B9C;
  int m_HairMixColColour_BA0;
  EPlayerHairColour m_HairColour_BA4;
  int m_BootsTextureIndex_BA8;
  int m_BootsTexture_BAC;
  int m_GloveTexture_BB0;
  int m_UnknowTexture_BB4;  // m_UnknowType_A4是4的时候是torso，其它时候是DiffuseTexture
  int m_BodyModleIndex_BB8;
  int m_HairModleIndex_BBC;
  int m_HeaderModleIndex_BC0;
  uchar m_UnknowBuf_BC4[0x60];
  int m_Materials_C24[8];

  static bool s_bDefaultModelsLoaded;          // 003A4ABC
  static CFTTModel *s_pDefaultShadowModel[2];  // 003A4AC0
  static CFTTModel *s_pDefaultBodyModel[50];   // 003A4AC8
  static CFTTModel *s_pDefaultHairModel[100];  // 003A4B90
  static CFTTModel *s_pDefaultHeadModel[40];   // 003A4D20
  static CFTTModel *s_pPropModel[12];          // 003A4DC0
  static CAnimLib *s_pAnimLib;                 // 003A4DF0
  static int s_iAtlasAmbientTextures[10];      // 003A4DF4

  static int s_iSkinTextures[12];          // 003A4E1C
  static int s_iFacialHairTextures[7];     // 003A4E4C
  static int s_iHairMegaTexture;           // 003A4E68
  static int s_iHairSpecularTexture;       // 003A4E6C
  static int s_iHairNormalTexture;         // 003A4E70
  static int s_iGlovesTextures[5];         // 003A4E74
  static int s_iBootsTextures[12];         // 003A4E88
  static float s_fAtlasDiscardAlpha;       // 003A4EB8
  static int s_iCount;                     // 003A4EBC
  static int s_iAtlasCount;                // 003A4EC0
  static int CHAR_MEGA_W;                  // 003A4EC4
  static int CHAR_MEGA_H;                  // 003A4EC8
  static CFTTRenderToTexture *s_pMegaRTT;  // 003A4ECC
  static CFTTTexture *s_pMegaMippedTex;    // 003A4ED0

  static int s_iWalkDirectionAnimLookUp[8];  // 0033EC28
  static int s_iManagerDiffuseTextures[12];  // 0033EC48
  static int s_iManagerSpecularTextures[3];  // 0033EC78
  static int s_iManagerNormalTextures[3];    // 0033EC84
  static int s_iManagerAmbientTextures[3];   // 0033EC90
  static int s_iTorsoSpecularTexture;        // 0033EC9C
  static int s_iTorsoNormalTexture;          // 0033ECA0
  static int s_iKitSpecularTexture;          // 0033ECA4
  static int s_iKitDynamicNormalTexture;     // 0033ECA8
  static int s_iKitDynamicAmbientTexture;    // 0033ECAC
  static int s_iAtlasSpecularTexture;        // 0033ECB0
  static int s_iAtlasNormalTexture;          // 0033ECB4
  static int CHAR_ATLAS_W;                   // 0033ECB8
  static int CHAR_ATLAS_H;                   // 0033ECBC
  static int CHAR_MEGA_NUM_X;                // 0033ECC0
  static int CHAR_MEGA_NUM_Y;                // 0033ECC4
};

#endif  //_CGFXCHARACTER_H_