// CGfxEnv - [2020-04-13 11:57:46]
#ifndef _CGFXENV_H_
#define _CGFXENV_H_

#include "CFTTModel.h"
#include "CFTTFrustum32.h"
#include "CFTTXmlWriterNode.h"
#include "CFTTXmlReaderNode.h"
#include "CFTTAABB32.h"
#include "CStageManager.h"

/*
001A9034 CGfxEnv::CGfxEnv()
001A9036 CGfxEnv::~CGfxEnv()
001A9038 CGfxEnv::Init(TEnvConfig const&,int,bool)
001A90D4 CGfxEnv::ProcessSlicedLoad(int)
001A9264 CGfxEnv::EnableSlicedLoad()
001A9274 CGfxEnv::ScanStadiumModelsDirectory()
001A96C8 CGfxEnv::CreateStadiumDressingTextures(int)
001A9C2C CGfxEnv::StadiumAdd(TEnvConfigStadium const*,int)
001A9D94 CGfxEnv::EditSeatsTexture(uint)
001A9ED8 CGfxEnv::ObjectsAdd(TEnvConfig const*,int)
001A9FA4 CGfxEnv::SetupCrowd(EStadiumSection,int)
001AA084 CGfxEnv::GetStadiumCapacity(TEnvConfig *)
001AA0C0 CGfxEnv::FindModelInfoDescription(char *)
001AA0F4 CGfxEnv::GetSectionCapacity(EStadiumSection)
001AA100 CGfxEnv::GetSectionMatrix(EStadiumSection,bool)
001AA17C CGfxEnv::GetStadiumModelInfo(EStadiumSection,char const*)
001AA1F0 CGfxEnv::UpdateStadiumSection(TEnvConfig const*,EStadiumSection)
001AA24C CGfxEnv::ModelGet(char const*,bool,int,EStadiumSection)
001AA3F4 CGfxEnv::GetAvailableIndexFromModelIndex(EStadiumSection)
001AA458 CGfxEnv::CalculateSectionCapacity(EStadiumSection)
001AA45C CGfxEnv::LoadSectionTextures(TEnvModel *,int)
001AA478 CGfxEnv::UpdateStadiumFloodlights()
001AA4CC CGfxEnv::GetSectionTypeFromSection(EStadiumSection)
001AA4E4 CGfxEnv::GetSectionTypeInfo(EStadiumSectionType)
001AA4F8 CGfxEnv::Init(char *,int,bool)
001AA588 CGfxEnv::EnvConfigLoad(TEnvConfig *,CFTTXmlReaderNode)
001AA5B4 CGfxEnv::GetSectionTypeFromFileName(char const*)
001AA624 CGfxEnv::InsertionSortStadiumModelInfo(TEnvStadiumModelInfo *,int)
001AA6FC CGfxEnv::GetSectionSubTypeInfo(EStadiumSectionType,char)
001AA73C CGfxEnv::GetTierSubSectionInfo(EStadiumSectionType,char,int)
001AA76C CGfxEnv::StadiumConfigLoad(TEnvConfig *,CFTTXmlReaderNode *)
001AA970 CGfxEnv::ObjectsConfigLoad(TEnvConfig *,CFTTXmlReaderNode *)
001AABA8 CGfxEnv::ModelExists(char const*)
001AABF4 CGfxEnv::StrToPos(char const*)
001AACB2 CGfxEnv::EnvConfigSave(TEnvConfig *,CFTTXmlWriterNode)
001AACCC CGfxEnv::StadiumConfigSave(TEnvConfig *,CFTTXmlWriterNode *)
001AAE50 CGfxEnv::ObjectsConfigSave(TEnvConfig *,CFTTXmlWriterNode *)
001AAFD0 CGfxEnv::Process(float)
001AB004 CGfxEnv::ObjectUpdate(TEnvObject *)
001AB08C CGfxEnv::ProcessSectionUpgradeAnimation()
001AB1C4 CGfxEnv::RenderObjStaticShadows()
001AB1FC CGfxEnv::ObjectShadowRender(TEnvObject *,bool)
001AB324 CGfxEnv::RenderObjDynamicShadows()
001AB35C CGfxEnv::RenderObjDynamicShadowsHQ(uint,CFTTModel *&,CFTTMatrix32 &)
001AB384 CGfxEnv::GetShadowInfo(TEnvObject *,CFTTModel *&,CFTTMatrix32 &)
001AB478 CGfxEnv::RenderOpaque()
001AB4CC CGfxEnv::ObjectRender(TEnvObject *)
001AB604 CGfxEnv::StadiumVisibilityCheck()
001AB640 CGfxEnv::StadiumElementRender(int)
001AB884 CGfxEnv::RenderDecal()
001AB8A8 CGfxEnv::StadiumElementRenderDecal(int)
001AB97C CGfxEnv::RenderAlpha()
001AB9A0 CGfxEnv::StadiumElementRenderAlpha(int)
001ABA08 CGfxEnv::SetStadiumSectionCustomColour(EStadiumSection,uint)
001ABA2C CGfxEnv::ResetSelectedStadiumElement(EStadiumSection)
001ABA40 CGfxEnv::GetAnimationInfo(EStadiumSection)
001ABA54 CGfxEnv::ResetUpgradeAnimationInfo()
001ABA80 CGfxEnv::InitialiseSectionUpgradeAnimation(EStadiumSection,ESectionUpgradeAnimType,void (*)(EStadiumSection),void (*)(EStadiumSection))
001ABAE0 CGfxEnv::GetSectionModel(EStadiumSection)
001ABB04 CGfxEnv::GetOrientedSectionFromSection(EStadiumSection,int)
001ABB3C CGfxEnv::Shutdown()
001ABBF0 CGfxEnv::FreeStadiumDressingTextures()
001ABC1C CGfxEnv::GetNumObjects()
001ABC2C CGfxEnv::ObjectsReset()
001ABC3C CGfxEnv::UseShadowMapOnStadium()
001ABCB4 CGfxEnv::SetupCommon(EStadiumSection)
001AC058 CGfxEnv::StadiumElementShadowRender(int)
001AC260 CGfxEnv::GetObjectModel(int)
001AC274 CGfxEnv::SetSectionConstructing(TEnvConfig &,EStadiumSection)
001AC2A8 CGfxEnv::SetFrontendExterior(TEnvConfig &)
001AC2BC CGfxEnv::ObjectAdd(char *,TPoint3D,int,int,float)
001AC318 CGfxEnv::ObjectUpdateLive(int,TEnvConfigObject *)
001AC374 CGfxEnv::InitCameraFlashes()
001AC378 CGfxEnv::SetStadiumName(wchar_t *)
001AC484 CGfxEnv::CreateStadiumDressingBackground(int,int,int,int,int,uint &,uint &,bool,CFTTTexture *)
001AC6F8 CGfxEnv::PrintStadiumDressingText(wchar_t *,int,int,uint,uint,int)
001AC848 CGfxEnv::GenerateTrainingEnvConfig(TEnvConfig &,int)
001AC94C CGfxEnv::GenerateNewStadium(TEnvConfig &,int)
001AC978 CGfxEnv::GetTotalAABB()
001ACA28 CGfxEnv::StadiumElementShadowMapRender(int,CFTTFrustum32 const&)
001E6944 CGfxEnv::SetMatrix(CFTTMatrix32)
*/

/*0x60*/
struct TEnvObject {
  int field_0;
  TPoint3D pt_4;
  int field_10;
  int field_14;
  float field_18;
  int field_1C;
  CFTTMatrix32 matrix_20;
};

enum EStadiumSection {
  EStadiumSection_0,
  EStadiumSection_1,
  EStadiumSection_2,
  EStadiumSection_3,
  EStadiumSection_4,
  EStadiumSection_5,
};

enum EStadiumSectionType {
  EStadiumSectionType_0,
  EStadiumSectionType_1,
  EStadiumSectionType_2,
  EStadiumSectionType_3,
  EStadiumSectionType_4,
  EStadiumSectionType_5,
};

//<0x48>
class TEnvModel {
public:
  void GetBounds(EStadiumSection, CFTTVector32 &, CFTTVector32 &, bool);  // 001ABE2E
  CFTTVector32 GetCentre(EStadiumSection, bool);                          // 001AC94E
  CFTTModel *model_0;
  float field_4;
  float field_8;
  float field_C;
  char text_10[0x20];
  int field_30;
  int field_34[2];
  CFTTVector32 vector_3C;
};

//<0x54>
struct TModelInfoDescription {
  int field_0;
  char text_4[0x40];
  int field_44;
  int height_48;
  uint8 field_4C;
  uint8 field_4D;
  uint8 field_4E;
  uint8 field_4F;
  int field_50;
};
//<0x28>
struct TEnvStadiumModelInfo {
  char text_0[32];
  int height_20;
  TModelInfoDescription *desc_24;
};

struct TEnvConfigObject {
  int un_0;
};

//<0x18>
struct TModelItem {
  int field_0;
  int count_4;
  char field_8[0x10];
};

//<0x188>
struct TAvailableModelEntry {
  char field_0 __attribute__((aligned(4)));
  int ItemCount_4;
  TModelItem Item_8[16];
};

//<0x2c90>
struct TAvailableModel {
  TEnvStadiumModelInfo ModelInfo_0[0x80];
  int InfoCount_1400;
  int EntryCount_1404;
  TAvailableModelEntry Entry_1408[16];

  int field_2C88;
  int field_2C8C;
};

//<0x28>
struct TSectionUpgradeAnimInfo {
  int field_0[3];
  float field_C;
  int field_10[6];
};

enum ESectionUpgradeAnimType {
  ESectionUpgradeAnimType_0,
  ESectionUpgradeAnimType_1,
  ESectionUpgradeAnimType_2,
  ESectionUpgradeAnimType_3,
  ESectionUpgradeAnimType_4,
  ESectionUpgradeAnimType_5,
};

class CGfxEnv {
public:
  CGfxEnv();                                                                  // 001A9034
  ~CGfxEnv();                                                                 // 001A9036
  static void Init(TEnvConfig const &, int, bool);                            // 001A9038
  static void ProcessSlicedLoad(int);                                         // 001A90D4
  static void EnableSlicedLoad();                                             // 001A9264
  static void ScanStadiumModelsDirectory();                                   // 001A9274
  static void CreateStadiumDressingTextures(int);                             // 001A96C8
  static void StadiumAdd(TEnvConfigStadium const *, int);                     // 001A9C2C
  static void EditSeatsTexture(uint);                                         // 001A9D94
  static void ObjectsAdd(TEnvConfig const *, int);                            // 001A9ED8
  static void SetupCrowd(EStadiumSection, int);                               // 001A9FA4
  static void GetStadiumCapacity(TEnvConfig *);                               // 001AA084
  static TModelInfoDescription *FindModelInfoDescription(char *);             // 001AA0C0
  void GetSectionCapacity(EStadiumSection);                                   // 001AA0F4
  static CFTTMatrix32 GetSectionMatrix(EStadiumSection, bool);                // 001AA100
  void GetStadiumModelInfo(EStadiumSection, char const *);                    // 001AA17C
  void UpdateStadiumSection(TEnvConfig const *, EStadiumSection);             // 001AA1F0
  static int ModelGet(char const *, bool, int, EStadiumSection);              // 001AA24C
  static int GetAvailableIndexFromModelIndex(EStadiumSection);                // 001AA3F4
  void CalculateSectionCapacity(EStadiumSection);                             // 001AA458
  static void LoadSectionTextures(TEnvModel *, int);                          // 001AA45C
  static void UpdateStadiumFloodlights();                                     // 001AA478
  static int GetSectionTypeFromSection(EStadiumSection);                      // 001AA4CC
  void GetSectionTypeInfo(EStadiumSectionType);                               // 001AA4E4
  void Init(char *, int, bool);                                               // 001AA4F8
  void EnvConfigLoad(TEnvConfig *, CFTTXmlReaderNode);                        // 001AA588
  static int GetSectionTypeFromFileName(char const *);                        // 001AA5B4
  static void InsertionSortStadiumModelInfo(TEnvStadiumModelInfo *, int);     // 001AA624
  void GetSectionSubTypeInfo(EStadiumSectionType, char);                      // 001AA6FC
  void GetTierSubSectionInfo(EStadiumSectionType, char, int);                 // 001AA73C
  void StadiumConfigLoad(TEnvConfig *, CFTTXmlReaderNode *);                  // 001AA76C
  void ObjectsConfigLoad(TEnvConfig *, CFTTXmlReaderNode *);                  // 001AA970
  static bool ModelExists(char const *);                                      // 001AABA8
  void StrToPos(char const *);                                                // 001AABF4
  void EnvConfigSave(TEnvConfig *, CFTTXmlWriterNode);                        // 001AACB2
  void StadiumConfigSave(TEnvConfig *, CFTTXmlWriterNode *);                  // 001AACCC
  void ObjectsConfigSave(TEnvConfig *, CFTTXmlWriterNode *);                  // 001AAE50
  void Process(float);                                                        // 001AAFD0
  void ObjectUpdate(TEnvObject *);                                            // 001AB004
  void ProcessSectionUpgradeAnimation();                                      // 001AB08C
  void RenderObjStaticShadows();                                              // 001AB1C4
  static void ObjectShadowRender(TEnvObject *, bool);                         // 001AB1FC
  static void RenderObjDynamicShadows();                                      // 001AB324
  static bool RenderObjDynamicShadowsHQ(uint, CFTTModel *&, CFTTMatrix32 &);  // 001AB35C
  static void GetShadowInfo(TEnvObject *, CFTTModel *&, CFTTMatrix32 &);      // 001AB384
  static void RenderOpaque();                                                 // 001AB478
  static void ObjectRender(TEnvObject *);                                     // 001AB4CC
  static bool StadiumVisibilityCheck();                                       // 001AB604
  static void StadiumElementRender(int);                                      // 001AB640
  static void RenderDecal();                                                  // 001AB884
  static void StadiumElementRenderDecal(int);                                 // 001AB8A8
  static void RenderAlpha();                                                  // 001AB97C
  static void StadiumElementRenderAlpha(int);                                 // 001AB9A0
  void SetStadiumSectionCustomColour(EStadiumSection, uint);                  // 001ABA08
  void ResetSelectedStadiumElement(EStadiumSection);                          // 001ABA2C
  void GetAnimationInfo(EStadiumSection);                                     // 001ABA40
  void ResetUpgradeAnimationInfo();                                           // 001ABA54
  void InitialiseSectionUpgradeAnimation(EStadiumSection,
                                         ESectionUpgradeAnimType,
                                         void (*)(EStadiumSection),
                                         void (*)(EStadiumSection));  // 001ABA80
  void GetSectionModel(EStadiumSection);                              // 001ABAE0
  void GetOrientedSectionFromSection(EStadiumSection, int);           // 001ABB04
  static void Shutdown();                                             // 001ABB3C
  static void FreeStadiumDressingTextures();                          // 001ABBF0
  int GetNumObjects();                                                // 001ABC1C
  void ObjectsReset();                                                // 001ABC2C
  static bool UseShadowMapOnStadium();                                // 001ABC3C
  static CFTTMatrix32 SetupCommon(EStadiumSection);                   // 001ABCB4
  static void StadiumElementShadowRender(int);                        // 001AC058
  void GetObjectModel(int);                                           // 001AC260
  void SetSectionConstructing(TEnvConfig &, EStadiumSection);         // 001AC274
  void SetFrontendExterior(TEnvConfig &);                             // 001AC2A8
  static void ObjectAdd(char *, TPoint3D, int, int, float);           // 001AC2BC
  void ObjectUpdateLive(int, TEnvConfigObject *);                     // 001AC318
  void InitCameraFlashes();                                           // 001AC374
  void SetStadiumName(wchar_t *);                                     // 001AC378
  static void CreateStadiumDressingBackground(int,
                                              int,
                                              int,
                                              int,
                                              int,
                                              uint &,
                                              uint &,
                                              bool,
                                              CFTTTexture *);                  // 001AC484
  static void PrintStadiumDressingText(wchar_t *, int, int, uint, uint, int);  // 001AC6F8
  void GenerateTrainingEnvConfig(TEnvConfig &, int);                           // 001AC848
  void GenerateNewStadium(TEnvConfig &, int);                                  // 001AC94C

  static CFTTAABB32 GetTotalAABB();                                       // 001AC978
  static void StadiumElementShadowMapRender(int, CFTTFrustum32 const &);  // 001ACA28
  static void SetMatrix(CFTTMatrix32);                                    // 001E6944

  static CFTTMatrix32 ms_mMatrix;
  static TEnvModel ms_tModel[14];
  static int ms_iModelCount;
  static CFTTTexture *ms_pStadiumDressingTexture[4];
  static TEnvConfig *ms_pSlicedLoadConfig;
  static TEnvObject ms_tObject[64];
  static int ms_iObjectCount;
  static int ms_tStadium[20];
  static int ms_iBlackRenderingMat;
  static bool ms_bNextLoadSliced;
  static bool ms_bSlicedLoadCrowd;
  static int ms_iSlicedLoadHomeTeamOverride;
  static bool ms_bSectionVisibilityResult[10];
  static TAvailableModel ms_tAvailableModels[6];
  static TSectionUpgradeAnimInfo ms_tSectionUpgradeAnimInfo[8];
  static int ms_iStadiumSeatTexture;
  static wchar_t ms_sStadiumName[24];
  static TModelInfoDescription *ms_pConstructionModels[6];
  static uint ms_uCustomSectionColour[8];
  static int ms_iStadiumSectionIndices[10];
  static bool ms_bDirectoriesScanned;
};

#endif  //_CGFXENV_H_