Loading.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. FinalSun/FinalAlert 2 Mission Editor
  3. Copyright (C) 1999-2024 Electronic Arts, Inc.
  4. Authored by Matthias Wagner
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. #if !defined(AFX_LOADING_H__5D5C3284_8962_11D3_B63B_AAA51FD322E3__INCLUDED_)
  17. #define AFX_LOADING_H__5D5C3284_8962_11D3_B63B_AAA51FD322E3__INCLUDED_
  18. #include "FinalSunDlg.h"
  19. #include "MissionEditorPackLib.h"
  20. #include <memory>
  21. #include <optional>
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25. // Loading.h : header file
  26. //
  27. class VoxelNormalTables;
  28. struct EXPANDMIX
  29. {
  30. HMIXFILE hExpand; // NULL if expansion mix does not exist
  31. HMIXFILE hECache; // NULL if no ECache
  32. HMIXFILE hConquer; // NULL if no Conquer
  33. HMIXFILE hLocal;
  34. HMIXFILE hIsoSnow; // NULL if no IsoSnow
  35. HMIXFILE hIsoTemp; // NULL if no IsoTemp
  36. HMIXFILE hIsoUrb;
  37. HMIXFILE hIsoGen;
  38. HMIXFILE hIsoLun;
  39. HMIXFILE hIsoDes;
  40. HMIXFILE hIsoUbn;
  41. HMIXFILE hIsoGenMd;
  42. HMIXFILE hIsoLunMd;
  43. HMIXFILE hIsoDesMd;
  44. HMIXFILE hIsoUbnMd;
  45. HMIXFILE hTemperat; // NULL if no Temperat
  46. HMIXFILE hSnow;
  47. HMIXFILE hUrban;
  48. HMIXFILE hLunar;
  49. HMIXFILE hUrbanN;
  50. HMIXFILE hDesert;
  51. HMIXFILE hGeneric;
  52. HMIXFILE hTem;
  53. HMIXFILE hSno;
  54. HMIXFILE hUrb;
  55. HMIXFILE hLun;
  56. HMIXFILE hDes;
  57. HMIXFILE hUbn;
  58. HMIXFILE hBuildings;
  59. HMIXFILE hMarble;
  60. EXPANDMIX() {memset(this, 0, sizeof(EXPANDMIX));};
  61. };
  62. class CFinalSunDlg;
  63. /////////////////////////////////////////////////////////////////////////////
  64. // dialog field CLoading
  65. struct FindShpResult
  66. {
  67. FindShpResult(HMIXFILE mixfile_, TheaterChar mixfile_theater_, CString filename_, TheaterChar theat_, HTSPALETTE palette_): mixfile(mixfile_), mixfile_theater(mixfile_theater_), filename(filename_), theat(theat_), palette(palette_) { }
  68. HMIXFILE mixfile;
  69. TheaterChar mixfile_theater;
  70. CString filename;
  71. TheaterChar theat;
  72. HTSPALETTE palette;
  73. };
  74. class CLoading : public CDialog
  75. {
  76. // Construction
  77. public:
  78. void CreateConvTable(RGBTRIPLE* pal, int* iPal);
  79. void FetchPalettes();
  80. void PrepareUnitGraphic(LPCSTR lpUnittype);
  81. void LoadStrings();
  82. void FreeAll();
  83. void FreeTileSet();
  84. BOOL InitDirectDraw();
  85. void InitTMPs(CProgressCtrl* prog=NULL);
  86. void InitPalettes();
  87. ~CLoading();
  88. void Unload();
  89. BOOL InitMixFiles();
  90. void InitSHPs(CProgressCtrl* prog=NULL);
  91. void LoadTSIni(LPCTSTR lpFilename, CIniFile* lpIniFile, BOOL bIsExpansion, BOOL bCheckEditorDir = FALSE);
  92. void CreateINI();
  93. CLoading(CWnd* pParent = NULL); // Standardconstructor
  94. void InitPics(CProgressCtrl* prog=NULL);
  95. void Load();
  96. BOOL LoadUnitGraphic(LPCTSTR lpUnittype);
  97. void LoadBuildingSubGraphic(const CString& subkey, const CIniFileSection& artSection, BOOL bAlwaysSetChar, char theat, HMIXFILE hShpMix, SHPHEADER& shp_h, BYTE*& shp);
  98. void LoadOverlayGraphic(LPCTSTR lpOvrlName, int iOvrlNum);
  99. void InitVoxelNormalTables();
  100. HTSPALETTE GetIsoPalette(char theat);
  101. HTSPALETTE GetUnitPalette(char theat);
  102. std::optional<FindShpResult> FindUnitShp(const CString& image, char preferred_theat, const CIniFileSection& artSection);
  103. char cur_theat;
  104. // Dialog data
  105. //{{AFX_DATA(CLoading)
  106. enum { IDD = IDD_LOADING };
  107. CStatic m_Version;
  108. CStatic m_BuiltBy;
  109. CStatic m_cap;
  110. CProgressCtrl m_progress;
  111. //}}AFX_DATA
  112. // Overwriteables
  113. // class wizard generated overwriteables
  114. //{{AFX_VIRTUAL(CLoading)
  115. protected:
  116. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV-support
  117. virtual void PostNcDestroy();
  118. //}}AFX_VIRTUAL
  119. // Implementation
  120. protected:
  121. void PrepareBuildingTheaters();
  122. // generated message handlers
  123. //{{AFX_MSG(CLoading)
  124. virtual BOOL OnInitDialog();
  125. afx_msg void OnDestroy();
  126. afx_msg void OnPaint();
  127. //}}AFX_MSG
  128. DECLARE_MESSAGE_MAP()
  129. private:
  130. void HackRules();
  131. void PrepareHouses(void);
  132. void CalcPicCount();
  133. int m_pic_count;
  134. int m_bmp_count;
  135. BOOL LoadTile(LPCSTR lpFilename, HMIXFILE hOwner, HTSPALETTE hPalette, DWORD dwID, BOOL bReplacement);
  136. HTSPALETTE m_hPalIsoTemp;
  137. HTSPALETTE m_hPalIsoSnow;
  138. HTSPALETTE m_hPalIsoUrb;
  139. HTSPALETTE m_hPalUnitTemp;
  140. HTSPALETTE m_hPalUnitSnow;
  141. HTSPALETTE m_hPalUnitUrb;
  142. HTSPALETTE m_hPalTemp;
  143. HTSPALETTE m_hPalSnow;
  144. HTSPALETTE m_hPalUrb;
  145. HTSPALETTE m_hPalLib;
  146. // YR pals:
  147. HTSPALETTE m_hPalLun;
  148. HTSPALETTE m_hPalDes;
  149. HTSPALETTE m_hPalUbn;
  150. HTSPALETTE m_hPalIsoLun;
  151. HTSPALETTE m_hPalIsoDes;
  152. HTSPALETTE m_hPalIsoUbn;
  153. HTSPALETTE m_hPalUnitLun;
  154. HTSPALETTE m_hPalUnitDes;
  155. HTSPALETTE m_hPalUnitUbn;
  156. HMIXFILE FindFileInMix(LPCTSTR lpFilename, TheaterChar* pTheaterChar=NULL);
  157. HMIXFILE m_hLocal;
  158. HMIXFILE m_hSno;
  159. HMIXFILE m_hTem;
  160. HMIXFILE m_hUrb;
  161. HMIXFILE m_hLun;
  162. HMIXFILE m_hDes;
  163. HMIXFILE m_hUbn;
  164. HMIXFILE m_hTibSun;
  165. HMIXFILE m_hBuildings;
  166. EXPANDMIX m_hExpand[101]; // 1 added for ra2md.mix
  167. HMIXFILE m_hECache[100];
  168. HMIXFILE m_hIsoSnow;
  169. HMIXFILE m_hIsoTemp;
  170. HMIXFILE m_hIsoUrb;
  171. HMIXFILE m_hIsoGen;
  172. HMIXFILE m_hIsoLun;
  173. HMIXFILE m_hIsoDes;
  174. HMIXFILE m_hIsoUbn;
  175. HMIXFILE m_hTemperat;
  176. HMIXFILE m_hSnow;
  177. HMIXFILE m_hUrban;
  178. HMIXFILE m_hUrbanN;
  179. HMIXFILE m_hLunar;
  180. HMIXFILE m_hDesert;
  181. HMIXFILE m_hCache;
  182. HMIXFILE m_hConquer;
  183. HMIXFILE m_hLanguage;
  184. HMIXFILE m_hLangMD;
  185. HMIXFILE m_hMarble;
  186. BOOL loaded;
  187. std::unique_ptr<VoxelNormalTables> m_voxelNormalTables;
  188. };
  189. //{{AFX_INSERT_LOCATION}}
  190. // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
  191. #endif // AFX_LOADING_H__5D5C3284_8962_11D3_B63B_AAA51FD322E3__INCLUDED_