//CFTTMaterialManager - [2020-04-13 11:57:46]
#ifndef _CFTTMATERIALMANAGER_H_
#define _CFTTMATERIALMANAGER_H_

#include "common.h"
#include "FTTMutex.h"
#include "CFTTMaterial.h"
#include "CFTTMemPool_Static.h"
#include "CFTTMatSetupData.h"
#include "sh_struct.h"

/*
00200CB2  CFTTMaterialManager::CFTTMaterialManager(ushort)
00200D2A  CFTTMaterialManager::~CFTTMaterialManager()
00189AFE  CFTTMaterialManager::OverrideAll(ushort,CFTTMaterial *,void *)
00200D70  CFTTMaterialManager::ReleaseMaterials()
00200DA6  CFTTMaterialManager::SetMaterialSwitchCallback(ushort (*)(ushort,CFTTMaterial *,void *),void *)
00200DAC  CFTTMaterialManager::GetMaterialSwitchCallback()
00200DB0  CFTTMaterialManager::SetMaterialCreateCallback(ushort (*)(TMaterial const&,uint,CFTTMatSetupData const&,void *),void *)
00200DB8  CFTTMaterialManager::AllocateMaterial()
00200E00  CFTTMaterialManager::CreateMaterial(TMaterial const&,uint,CFTTMatSetupData const&)
002010A0  CFTTMaterialManager::CopyMaterial(CFTTMaterial *)
002010D6  CFTTMaterialManager::CompareMaterials(ushort,ushort)
0020112C  CFTTMaterialManager::GetMaterialID(char const*)
00201156  CFTTMaterialManager::ReleaseMaterial(ushort)
002011A4  CFTTMaterialManager::SetupMaterialStates(ushort)
002011EC  CFTTMaterialManager::RestoreMaterialStates(ushort)
00201214  CFTTMaterialManager::LockMutex()
0020121A  CFTTMaterialManager::UnlockMutex()
00201220  CFTTMaterialManager::PerformMatSwitchCallback(ushort)

0x44
*/

//ushort (*)(ushort, CFTTMaterial *, void *)
typedef ushort (*pfunc_SwitchCallback)(ushort, CFTTMaterial *, void *);
typedef ushort (*pfunc_CreateCallback)(TMaterial const &, uint, CFTTMatSetupData const &, void *);

class CFTTMaterialManager {
public:
  CFTTMaterialManager(ushort);  //00200CB2
  ~CFTTMaterialManager();       //00200D2A

  //00189AFE
  static ushort OverrideAll(ushort, CFTTMaterial *, void *);

  //00200D70
  void ReleaseMaterials();

  //00200DA6
  void SetMaterialSwitchCallback(ushort (*)(ushort, CFTTMaterial *, void *), void *);

  //00200DAC
  pfunc_SwitchCallback GetMaterialSwitchCallback();

  //00200DB0
  void SetMaterialCreateCallback(ushort (*)(TMaterial const &, uint, CFTTMatSetupData const &, void *), void *);

  //00200DB8
  ushort AllocateMaterial();

  //00200E00
  int CreateMaterial(TMaterial const &, uint, CFTTMatSetupData const &);

  //002010A0
  short CopyMaterial(CFTTMaterial *);

  //002010D6
  bool CompareMaterials(ushort, ushort);

  //0020112C
  int GetMaterialID(char const *);

  //00201156
  void ReleaseMaterial(ushort);

  //002011A4
  bool SetupMaterialStates(ushort);

  //002011EC
  void RestoreMaterialStates(ushort);

  //00201214
  void LockMutex();

  //0020121A
  void UnlockMutex();

  //00201220
  ushort PerformMatSwitchCallback(ushort);

  ushort dCount_0;
  ushort dAllocCount_2;
  CFTTMemPool_Static *pCFTTMemPool_Static_4;
  CFTTMaterial *list_CFTTMaterial_8;
  pfunc_SwitchCallback pfunc_SwitchCallback_C;
  void *arg_SwitchCallback_10;
  pfunc_CreateCallback pfunc_CreateCallback_14;
  void *arg_CreateCallback_18;
  FTTMutex Mutex_1C;
  int dLastmaterialIndex_40;
};

extern CFTTMaterialManager *FTT_pMtlL;

#endif  //_CFTTMATERIALMANAGER_H_