WorldEditor.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. // WorldEditor.h : main header file for the WORLDEDITOR application
  13. //
  14. #ifndef WORLDEDITOR_H
  15. #define WORLDEDITOR_H 1
  16. #ifndef __AFXWIN_H__
  17. #error include 'stdafx.h' before including this file for PCH
  18. #endif
  19. #include "resource.h" // main symbols
  20. #include "Viewers.h"
  21. #define CHILD_CONFIGURATION_VER "V012"
  22. #define VIEW_PREFERENCES_VER "V012"
  23. #define VIEW_PREFERENCES_CT 10
  24. #define CHILD_CONFIGURATIONS_CT 10
  25. extern FLOAT _fLastMipBrushingOptionUsed;
  26. extern INDEX wed_iMaxFPSActive;
  27. extern struct GameGUI_interface *_pGameGUI;
  28. extern UINT _uiMessengerMsg;
  29. extern UINT _uiMessengerForcePopup;
  30. extern FLOAT _fFlyModeSpeedMultiplier;
  31. class CWorldEditorDoc;
  32. class CWorldEditorView;
  33. class CVirtualTreeNode;
  34. extern CEntity *GetTerrainEntity(void);
  35. extern CTerrain *GetTerrain(void);
  36. extern CTerrainLayer *GetLayer(void);
  37. extern void SelectLayer(INDEX iLayer);
  38. extern INDEX GetLayerIndex(void);
  39. extern CTerrainLayer *GetLayer(INDEX iLayer);
  40. #define ALLOW_TERRAINS 1
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CWorldEditorApp:
  43. // See WorldEditor.cpp for the implementation of this class
  44. //
  45. enum PrimitiveType {
  46. PT_NONE =0,
  47. PT_CONUS,
  48. PT_TORUS,
  49. PT_STAIRCASES,
  50. PT_SPHERE,
  51. PT_TERRAIN,
  52. };
  53. enum TriangularisationType {
  54. TT_NONE=0,
  55. TT_CENTER_VERTEX,
  56. TT_FROM_VTX00,
  57. TT_FROM_VTX01,
  58. TT_FROM_VTX02,
  59. TT_FROM_VTX03,
  60. TT_FROM_VTX04,
  61. TT_FROM_VTX05,
  62. TT_FROM_VTX06,
  63. TT_FROM_VTX07,
  64. TT_FROM_VTX08,
  65. TT_FROM_VTX09,
  66. TT_FROM_VTX10,
  67. TT_FROM_VTX11,
  68. TT_FROM_VTX12,
  69. TT_FROM_VTX13,
  70. TT_FROM_VTX14,
  71. TT_FROM_VTX15,
  72. };
  73. #define VALUES_FOR_PRIMITIVE_VERSION2 "VFP2"
  74. #define VALUES_FOR_PRIMITIVE_VERSION3 "VFP3"
  75. // values for primitive
  76. class CValuesForPrimitive
  77. {
  78. public:
  79. enum CSGType vfp_csgtCSGOperation;
  80. // global parameters
  81. enum PrimitiveType vfp_ptPrimitiveType;
  82. CStaticArray<DOUBLE3D> vfp_avVerticesOnBaseOfPrimitive;
  83. CObject3D vfp_o3dPrimitive;
  84. CPlacement3D vfp_plPrimitive;
  85. enum TriangularisationType vfp_ttTriangularisationType;
  86. BOOL vfp_bClosed;
  87. BOOL vfp_bDummy;
  88. BOOL vfp_bAutoCreateMipBrushes;
  89. COLOR vfp_colSectorsColor;
  90. COLOR vfp_colPolygonsColor;
  91. // parameters for *Conus* primitives
  92. FLOAT vfp_fXMin;
  93. FLOAT vfp_fXMax;
  94. FLOAT vfp_fYMin;
  95. FLOAT vfp_fYMax;
  96. FLOAT vfp_fZMin;
  97. FLOAT vfp_fZMax;
  98. FLOAT vfp_fShearX;
  99. FLOAT vfp_fShearZ;
  100. FLOAT vfp_fStretchX;
  101. FLOAT vfp_fStretchY;
  102. BOOL vfp_bLinearStaircases;
  103. BOOL vfp_bOuter;
  104. INDEX vfp_iSlicesIn360;
  105. INDEX vfp_iNoOfSlices;
  106. FLOAT vfp_fRadius;
  107. INDEX vfp_iMeridians;
  108. INDEX vfp_iParalels;
  109. INDEX vfp_iSlicesPerWidth;
  110. INDEX vfp_iSlicesPerHeight;
  111. INDEX vfp_iTopShape;
  112. INDEX vfp_iBottomShape;
  113. FLOAT vfp_fAmplitude;
  114. FLOAT vfp_fMipStart;
  115. FLOAT vfp_fMipStep;
  116. CTFileName vfp_fnDisplacement;
  117. CValuesForPrimitive();
  118. inline CValuesForPrimitive (CValuesForPrimitive &vfpToCopy)
  119. {
  120. vfp_avVerticesOnBaseOfPrimitive = vfpToCopy.vfp_avVerticesOnBaseOfPrimitive;
  121. vfp_ptPrimitiveType = vfpToCopy.vfp_ptPrimitiveType;
  122. vfp_o3dPrimitive = vfpToCopy.vfp_o3dPrimitive;
  123. vfp_plPrimitive = vfpToCopy.vfp_plPrimitive;
  124. vfp_ttTriangularisationType = vfpToCopy.vfp_ttTriangularisationType;
  125. vfp_bDummy = vfpToCopy.vfp_bDummy;
  126. vfp_ptPrimitiveType = vfpToCopy.vfp_ptPrimitiveType;
  127. vfp_bAutoCreateMipBrushes = vfpToCopy.vfp_bAutoCreateMipBrushes;
  128. vfp_colSectorsColor = vfpToCopy.vfp_colSectorsColor;
  129. vfp_colPolygonsColor = vfpToCopy.vfp_colPolygonsColor;
  130. vfp_fXMin = vfpToCopy.vfp_fXMin;
  131. vfp_fXMax = vfpToCopy.vfp_fXMax;
  132. vfp_fYMin = vfpToCopy.vfp_fYMin;
  133. vfp_fYMax = vfpToCopy.vfp_fYMax;
  134. vfp_fZMin = vfpToCopy.vfp_fZMin;
  135. vfp_fZMax = vfpToCopy.vfp_fZMax;
  136. vfp_fShearX = vfpToCopy.vfp_fShearX;
  137. vfp_fShearZ = vfpToCopy.vfp_fShearZ;
  138. vfp_fStretchX = vfpToCopy.vfp_fStretchX;
  139. vfp_fStretchY = vfpToCopy.vfp_fStretchY;
  140. vfp_bClosed = vfpToCopy.vfp_bClosed;
  141. vfp_bLinearStaircases = vfpToCopy.vfp_bLinearStaircases;
  142. vfp_bOuter = vfpToCopy.vfp_bOuter;
  143. vfp_iSlicesIn360 = vfpToCopy.vfp_iSlicesIn360;
  144. vfp_iNoOfSlices = vfpToCopy.vfp_iNoOfSlices;
  145. vfp_fRadius = vfpToCopy.vfp_fRadius;
  146. vfp_iMeridians = vfpToCopy.vfp_iMeridians;
  147. vfp_iParalels = vfpToCopy.vfp_iParalels;
  148. vfp_iSlicesPerWidth = vfpToCopy.vfp_iSlicesPerWidth;
  149. vfp_iSlicesPerHeight = vfpToCopy.vfp_iSlicesPerHeight;
  150. vfp_iTopShape = vfpToCopy.vfp_iTopShape;
  151. vfp_iBottomShape = vfpToCopy.vfp_iBottomShape;
  152. vfp_fAmplitude = vfpToCopy.vfp_fAmplitude;
  153. vfp_fnDisplacement = vfpToCopy.vfp_fnDisplacement;
  154. vfp_fMipStart = vfpToCopy.vfp_fMipStart;
  155. vfp_fMipStep = vfpToCopy.vfp_fMipStep;
  156. };
  157. inline BOOL operator==(const CValuesForPrimitive &vfpToCompare);
  158. inline CValuesForPrimitive operator+(const CValuesForPrimitive &vfpToAdd);
  159. inline CValuesForPrimitive &operator+=(const CValuesForPrimitive &vfpToAdd);
  160. inline CValuesForPrimitive operator-(const CValuesForPrimitive &vfpToSub);
  161. inline CValuesForPrimitive &operator-=(const CValuesForPrimitive &vfpToSub);
  162. void CalculatePrimitiveBase(void);
  163. inline void CorrectInvalidValues(void);
  164. void ReadFromIniFile(CTString strPrimitiveType);
  165. void WriteToIniFile(CTString strPrimitiveType);
  166. void Read_t(CTStream &strmFile);
  167. void Write_t(CTStream &strmFile);
  168. };
  169. // for linking of primitive into primitive history list
  170. class CPrimitiveInHistoryBuffer {
  171. public:
  172. CListNode pihb_lnNode;
  173. CValuesForPrimitive pihb_vfpPrimitive;
  174. };
  175. // Class used for holding global modeler's preferences
  176. class CAppPrefs
  177. {
  178. public:
  179. ~CAppPrefs();
  180. BOOL ap_CopyExistingWindowPrefs;
  181. BOOL ap_AutoMaximizeWindow;
  182. BOOL ap_SetDefaultColors;
  183. BOOL ap_AutomaticInfo;
  184. BOOL ap_BinaryGrid;
  185. BOOL ap_UpdateAllways;
  186. BOOL ap_bSaveUndoForDelete;
  187. BOOL ap_bAutoColorize;
  188. BOOL ap_bShowAllOnOpen;
  189. BOOL ap_bHideShadowsOnOpen;
  190. BOOL ap_bAutoUpdateDisplaceMap;
  191. INDEX ap_iUndoLevels;
  192. INDEX ap_iStartupWindowSetup;
  193. COLOR ap_DefaultInkColor;
  194. COLOR ap_DefaultPaperColor;
  195. COLOR ap_DefaultSelectionColor;
  196. COLOR ap_DefaultGridColor;
  197. CTString ap_strSourceSafeProject;
  198. FLOAT ap_fDefaultFlyModeSpeed;
  199. INDEX ap_iTerrainSelectionVisible;
  200. INDEX ap_iTerrainSelectionHidden;
  201. INDEX ap_iMemoryForTerrainUndo;
  202. BOOL ap_bAutoUpdateTerrainDistribution;
  203. void ReadFromIniFile();
  204. void WriteToIniFile();
  205. };
  206. // Class for holding view preferences
  207. class CViewPrefs
  208. {
  209. public:
  210. // default constructor
  211. CViewPrefs(void);
  212. // set default values
  213. void SetDefaultValues(void);
  214. void ClearInvalidConfigPointers(void);
  215. // world's rendering preferences
  216. CWorldRenderPrefs m_wrpWorldRenderPrefs;
  217. // model's rendering preferences
  218. CModelRenderPrefs m_mrpModelRenderPrefs;
  219. // automatic rendering range
  220. BOOL m_bAutoRenderingRange;
  221. // rendering range if not automatic
  222. FLOAT m_fRenderingRange;
  223. // color for background paper (if not picture)
  224. COLOR m_PaperColor;
  225. // selection color
  226. COLOR m_SelectionColor;
  227. // if this view contains measurement tape
  228. BOOL m_bMeasurementTape;
  229. // grid color
  230. COLOR m_GridColor;
  231. // reserved for background texture
  232. char m_achrBcgPicture[256];
  233. };
  234. // Class for holding view configurations
  235. class CChildConfiguration
  236. {
  237. public:
  238. // set default values
  239. void SetDefaultValues(void);
  240. void ClearInvalidConfigPointers(void);
  241. // numbers of horizontal splitters
  242. INDEX m_iHorizontalSplitters;
  243. // numbers of vertical splitters
  244. INDEX m_iVerticalSplitters;
  245. // percentage of left splitter window
  246. FLOAT m_fPercentageLeft;
  247. // percentage of top splitter window
  248. FLOAT m_fPercentageTop;
  249. // grid on/off flag
  250. BOOL m_bGridOn;
  251. // view prefs
  252. CViewPrefs m_vpViewPrefs[4];
  253. // type of projection
  254. enum CSlaveViewer::ProjectionType m_ptProjectionType[ 4];
  255. };
  256. enum CopyType {
  257. CT_NONE = 0,
  258. CT_POLYGON_PROPERTIES,
  259. CT_POLYGON_PROPERTIES_ALTERNATIVE,
  260. CT_ENTITY,
  261. CT_SECTOR,
  262. CT_WORLD,
  263. };
  264. typedef void TTCFunction_type(void *pView, char *pToolTipText);
  265. class CCustomToolTip {
  266. public:
  267. HWND cct_hwndCaller;
  268. TTCFunction_type *cct_pCallback;
  269. void *cct_pThis;
  270. void ManualUpdate(void);
  271. void ManualOn( PIX pixManualX, PIX pixManualY,
  272. TTCFunction_type *pCallBack, void *pThis);
  273. void ManualOff( void);
  274. void MouseMoveNotify( HWND hwndCaller, ULONG ulTime, TTCFunction_type *pCallBack, void *pThis);
  275. };
  276. class CWorldEditorApp : public CWinApp
  277. {
  278. private:
  279. CWorldEditorDoc *m_pLastActivatedDocument;
  280. public:
  281. // Atributes
  282. FLOAT3D m_vLastTerrainHit;
  283. CEntity *m_penLastTerrainHit;
  284. FLOAT m_fCurrentTerrainBrush;
  285. FLOAT m_fTerrainBrushPressure;
  286. FLOAT m_iTerrainEditMode;
  287. FLOAT m_iTerrainBrushMode;
  288. FLOAT m_fTerrainBrushPressureEnum;
  289. CTFileName m_fnDistributionNoiseTexture;
  290. CTFileName m_fnContinousNoiseTexture;
  291. INDEX m_iFBMOctaves;
  292. FLOAT m_fFBMHighFrequencyStep;
  293. FLOAT m_fFBMStepFactor;
  294. FLOAT m_fFBMMaxAmplitude;
  295. FLOAT m_fFBMfAmplitudeDecreaser;
  296. BOOL m_bFBMAddNegativeValues;
  297. BOOL m_bFBMRandomOffset;
  298. UWORD m_uwEditAltitude;
  299. FLOAT m_fPaintPower;
  300. FLOAT m_fSmoothPower;
  301. INDEX m_iFilter;
  302. FLOAT m_fFilterPower;
  303. FLOAT m_fPosterizeStep;
  304. FLOAT m_fNoiseAltitude;
  305. INDEX m_iRNDSubdivideAndDisplaceItterations;
  306. INDEX m_iTerrainGenerationMethod;
  307. INDEX m_iApi;
  308. CCustomToolTip m_cttToolTips;
  309. int m_iLastClassSortAplied;
  310. BOOL m_bInvertClassSort;
  311. FLOAT m_tmStartStatusLineInfo;
  312. CPlacement3D m_plClipboard1;
  313. CPlacement3D m_plClipboard2;
  314. CBrushPolygon *m_pbpoClipboardPolygon;
  315. CBrushPolygon *m_pbpoPolygonWithDeafultValues;
  316. CTFileName m_fnClassForDropMarker;
  317. // flag is set while changing display mode
  318. BOOL m_bChangeDisplayModeInProgress;
  319. // flag is set while adding/removing property pages
  320. BOOL m_bDisableDataExchange;
  321. // curently opened virtual directory path
  322. CTString m_strOpenedVTDirectory;
  323. // sector ambient color is stored here on copy paste ambient
  324. COLOR m_colSectorAmbientClipboard;
  325. CMappingDefinition m_mdMapping;
  326. CMappingDefinition m_mdMapping1;
  327. CMappingDefinition m_mdMapping2;
  328. CMappingDefinition m_mdMapping3;
  329. FLOATplane3D m_plMapping;
  330. FLOATplane3D m_plMapping1;
  331. FLOATplane3D m_plMapping2;
  332. FLOATplane3D m_plMapping3;
  333. FLOAT m_fTerrainSwitchStart;
  334. FLOAT m_fTerrainSwitchStep;
  335. // last copy operation type
  336. enum CopyType m_ctLastCopyType;
  337. CTString m_strCSGAndShadowStatistics;
  338. // if should display status info
  339. BOOL m_bShowStatusInfo;
  340. // visivility for texture layers
  341. BOOL m_bTexture1;
  342. BOOL m_bTexture2;
  343. BOOL m_bTexture3;
  344. // if CSG report is enabled
  345. BOOL m_bCSGReportEnabled;
  346. // false if undo remembering is disabled
  347. BOOL m_bRememberUndo;
  348. // if we are currently in measure mode
  349. BOOL m_bMeasureModeOn;
  350. // if we are currently in cut mode
  351. BOOL m_bCutModeOn;
  352. // if WED started for the fitst time
  353. BOOL m_bFirstTimeStarted;
  354. // show tip of the day on startup
  355. BOOL m_bShowTipOfTheDay;
  356. INDEX m_iCurrentTipOfTheDay;
  357. // rendering preferences for single view
  358. CViewPrefs m_vpViewPrefs[ VIEW_PREFERENCES_CT+1];
  359. // child-view configurations remembered
  360. // pre-last buffer is for full screen
  361. // last buffer is for maximizing view
  362. CChildConfiguration m_ccChildConfigurations[ CHILD_CONFIGURATIONS_CT+2];
  363. // object to hold our document template
  364. CMultiDocTemplate* m_pDocTemplate;
  365. // Only instance of CAppPrefs holding preferences
  366. class CAppPrefs m_Preferences;
  367. // List head for holding available modes/resolutions
  368. CListHead m_AvailableModes;
  369. // error texture
  370. CTextureData *m_ptdError;
  371. CTextureObject *m_ptoError;
  372. // icons tray texture
  373. CTextureData *m_ptdIconsTray;
  374. // default texture for primitives
  375. CTextureData *m_ptdActiveTexture;
  376. // view icons texture
  377. CTextureData *m_pViewIconsTD;
  378. // window background texture
  379. CTFileName m_fnWinBcgTexture;
  380. // application font
  381. CFontData *m_pfntSystem;
  382. // application's windows font
  383. CFont m_Font;
  384. CFont m_FixedFont;
  385. // for holding entity selection marker model
  386. CTextureData *m_ptdEntityMarkerTexture;
  387. CModelData *m_pEntityMarkerModelData;
  388. CModelObject *m_pEntityMarkerModelObject;
  389. // for holding portal selection marker model
  390. CTextureData *m_ptdPortalMarkerTexture;
  391. CModelData *m_pPortalMarkerModelData;
  392. CModelObject *m_pPortalMarkerModelObject;
  393. // for holding empty brush model
  394. CTextureData *m_ptdEmptyBrushTexture;
  395. CModelData *m_pEmptyBrushModelData;
  396. CModelObject *m_pEmptyBrushModelObject;
  397. // for holding range sphere model
  398. CTextureData *m_ptdRangeSphereTexture;
  399. CModelData *m_pRangeSphereModelData;
  400. CModelObject *m_pRangeSphereModelObject;
  401. // for holding angle3D model
  402. CTextureData *m_ptdAngle3DTexture;
  403. CModelData *m_pAngle3DModelData;
  404. CModelObject *m_pAngle3DModelObject;
  405. // for holding bounding box model
  406. CTextureData *m_ptdBoundingBoxTexture;
  407. CModelData *m_pBoundingBoxModelData;
  408. CModelObject *m_pBoundingBoxModelObject;
  409. // variables for full screen display mode
  410. CDisplayMode m_dmFullScreen;
  411. GfxAPIType m_gatFullScreen;
  412. // index of color last used for auto primitive colorization
  413. INDEX m_iLastAutoColorizeColor;
  414. // flag telling function GetActiveDocument() to return NULL (during document chg situation)
  415. BOOL m_bDocumentChangeOn;
  416. // flag telling which type of grid is curently on
  417. BOOL m_bDecadicGrid;
  418. // current values for primitive
  419. CValuesForPrimitive m_vfpCurrent;
  420. // and values for last primitive (for wizard)
  421. CValuesForPrimitive m_vfpLast;
  422. // and values for pre last primitive (for wizard)
  423. CValuesForPrimitive m_vfpPreLast;
  424. // and delta values for last primitive (for wizard)
  425. CValuesForPrimitive m_vfpDelta;
  426. // default values for conus primitives
  427. CValuesForPrimitive m_vfpConus;
  428. // default values for torus primitives
  429. CValuesForPrimitive m_vfpTorus;
  430. // default values for staircase primitives
  431. CValuesForPrimitive m_vfpStaircases;
  432. // default values for sphere primitives
  433. CValuesForPrimitive m_vfpSphere;
  434. // default values for terrain primitives
  435. CValuesForPrimitive m_vfpTerrain;
  436. // for linking primitives
  437. CListHead m_lhPrimitiveHistory;
  438. // obtain currently active view
  439. CWorldEditorDoc *GetActiveDocument(void);
  440. // obtain currently active view
  441. CWorldEditorView *GetActiveView(void);
  442. CChangeableRT m_ctTerrainPage;
  443. CChangeableRT m_ctTerrainPageCanvas;
  444. // Operations
  445. CWorldEditorApp();
  446. ~CWorldEditorApp();
  447. void MyParseCommandLine(void);
  448. BOOL SubInitInstance(void);
  449. void OnFileNew();
  450. CEntity *CreateWorldBaseEntity(CWorld &woWorld, BOOL bZoning, CPlacement3D pl=CPlacement3D(FLOAT3D(0,0,0),ANGLE3D(0,0,0)));
  451. BOOL Add3DObject(CWorldEditorDoc *pDoc, CEntity *penwb, CTFileName fnFile, BOOL bAdd);
  452. INDEX Insert3DObjects(CWorldEditorDoc *pDoc);
  453. CDisplayMode *GetStartModePtr( CTString strStartMode);
  454. CWorldEditorDoc *GetLastActivatedDocument(void);
  455. void ActivateDocument(CWorldEditorDoc *pDocToActivate);
  456. void RefreshAllDocuments( void);
  457. // load world and model rendering preferences
  458. BOOL LoadRenderingPreferences(void);
  459. // save world and model rendering preferences
  460. void SaveRenderingPreferences(void);
  461. // load child configurations
  462. BOOL LoadChildConfigurations(void);
  463. // save child configurations
  464. void SaveChildConfigurations(void);
  465. // clear possibly invalid pointers in view configurations
  466. void ClearInvalidConfigPointers(void);
  467. // reads ini data that can be loaded many times
  468. void ReadFromIniFile(void);
  469. // writes ini data that can be saved many times
  470. void WriteToIniFile(void);
  471. // store/restore application ini variables
  472. void WriteToIniFileOnEnd(void);
  473. void ReadFromIniFileOnInit(void);
  474. // store/restore default polygon properties
  475. void WriteDefaultPolygonValues(void);
  476. void ReadDefaultPolygonValues(void);
  477. // sets new active texture for primitive's default material
  478. void SetNewActiveTexture( CTFileName fnFullTexName);
  479. // tries to find given item in browser
  480. void FindItemInBrowser( CTFileName fnItemFileName);
  481. // texturize selection
  482. void TexturizeSelection(void);
  483. // gets curently active document ptr
  484. CWorldEditorDoc *GetDocument();
  485. // gets name for given virtual tree node
  486. CTString GetNameForVirtualTreeNode( CVirtualTreeNode *pvtnNode);
  487. void DisplayHelp(const CTFileName &fnHlk, UINT uCommand, DWORD dwData);
  488. void ApplyTerrainEditing(CCastRay &crRayHit);
  489. // Overrides
  490. // ClassWizard generated virtual function overrides
  491. //{{AFX_VIRTUAL(CWorldEditorApp)
  492. public:
  493. virtual BOOL InitInstance();
  494. virtual BOOL SaveAllModified();
  495. virtual int ExitInstance();
  496. virtual BOOL OnIdle(LONG lCount);
  497. virtual int Run();
  498. virtual BOOL PreTranslateMessage(MSG* pMsg);
  499. virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
  500. //}}AFX_VIRTUAL
  501. // Implementation
  502. //{{AFX_MSG(CWorldEditorApp)
  503. afx_msg void OnAppAbout();
  504. afx_msg void OnFilePreferences();
  505. afx_msg void OnFileOpen();
  506. afx_msg void OnImport3DObject();
  507. afx_msg void OnDecadicGrid();
  508. afx_msg void OnUpdateDecadicGrid(CCmdUI* pCmdUI);
  509. afx_msg void OnConvertWorlds();
  510. afx_msg void OnSetAsDefault();
  511. afx_msg void OnHelpShowTipOfTheDay();
  512. //}}AFX_MSG
  513. DECLARE_MESSAGE_MAP()
  514. };
  515. /////////////////////////////////////////////////////////////////////////////
  516. // Inline functions
  517. inline BOOL CValuesForPrimitive::operator==(const CValuesForPrimitive &vfpToCompare)
  518. {
  519. return (
  520. (vfp_avVerticesOnBaseOfPrimitive.Count() == vfpToCompare.vfp_avVerticesOnBaseOfPrimitive.Count() ) &&
  521. (vfp_ptPrimitiveType == vfpToCompare.vfp_ptPrimitiveType) &&
  522. (vfp_plPrimitive == vfpToCompare.vfp_plPrimitive) &&
  523. (vfp_ttTriangularisationType == vfpToCompare.vfp_ttTriangularisationType) &&
  524. (vfp_bDummy == vfpToCompare.vfp_bDummy) &&
  525. (vfp_bAutoCreateMipBrushes == vfpToCompare.vfp_bAutoCreateMipBrushes) &&
  526. (vfp_colSectorsColor == vfpToCompare.vfp_colSectorsColor) &&
  527. (vfp_colPolygonsColor == vfpToCompare.vfp_colPolygonsColor) &&
  528. (vfp_fXMin == vfpToCompare.vfp_fXMin) &&
  529. (vfp_fXMax == vfpToCompare.vfp_fXMax) &&
  530. (vfp_fYMin == vfpToCompare.vfp_fYMin) &&
  531. (vfp_fYMax == vfpToCompare.vfp_fYMax) &&
  532. (vfp_fZMin == vfpToCompare.vfp_fZMin) &&
  533. (vfp_fZMax == vfpToCompare.vfp_fZMax) &&
  534. (vfp_fShearX == vfpToCompare.vfp_fShearX) &&
  535. (vfp_fShearZ == vfpToCompare.vfp_fShearZ) &&
  536. (vfp_fStretchX == vfpToCompare.vfp_fStretchX) &&
  537. (vfp_fStretchY == vfpToCompare.vfp_fStretchY) &&
  538. (vfp_bClosed == vfpToCompare.vfp_bClosed) &&
  539. (vfp_bLinearStaircases == vfpToCompare.vfp_bLinearStaircases) &&
  540. (vfp_bOuter == vfpToCompare.vfp_bOuter) &&
  541. (vfp_iSlicesIn360 == vfpToCompare.vfp_iSlicesIn360) &&
  542. (vfp_iNoOfSlices == vfpToCompare.vfp_iNoOfSlices) &&
  543. (vfp_fRadius == vfpToCompare.vfp_fRadius) &&
  544. (vfp_iMeridians == vfpToCompare.vfp_iMeridians) &&
  545. (vfp_iParalels == vfpToCompare.vfp_iParalels) &&
  546. (vfp_iSlicesPerWidth == vfpToCompare.vfp_iSlicesPerWidth) &&
  547. (vfp_iSlicesPerHeight == vfpToCompare.vfp_iSlicesPerHeight) &&
  548. (vfp_iTopShape == vfpToCompare.vfp_iTopShape) &&
  549. (vfp_iBottomShape == vfpToCompare.vfp_iBottomShape) &&
  550. (vfp_fAmplitude == vfpToCompare.vfp_fAmplitude) &&
  551. (vfp_fMipStart == vfpToCompare.vfp_fMipStart) &&
  552. (vfp_fMipStep == vfpToCompare.vfp_fMipStep) &&
  553. (vfp_fnDisplacement == vfpToCompare.vfp_fnDisplacement)
  554. );
  555. }
  556. inline CValuesForPrimitive &CValuesForPrimitive::operator+=(const
  557. CValuesForPrimitive &vfpToAdd)
  558. {
  559. // add member by member
  560. vfp_fXMin += vfpToAdd.vfp_fXMin;
  561. vfp_fXMax += vfpToAdd.vfp_fXMax;
  562. vfp_fYMin += vfpToAdd.vfp_fYMin;
  563. vfp_fYMax += vfpToAdd.vfp_fYMax;
  564. vfp_fZMin += vfpToAdd.vfp_fZMin;
  565. vfp_fZMax += vfpToAdd.vfp_fZMax;
  566. vfp_fShearX += vfpToAdd.vfp_fShearX;
  567. vfp_fShearZ += vfpToAdd.vfp_fShearZ;
  568. vfp_fStretchX += vfpToAdd.vfp_fStretchX;
  569. vfp_fStretchY += vfpToAdd.vfp_fStretchY;
  570. return *this;
  571. }
  572. inline CValuesForPrimitive CValuesForPrimitive::operator+(const
  573. CValuesForPrimitive &vfpToAdd)
  574. {
  575. return CValuesForPrimitive(*this) += vfpToAdd;
  576. }
  577. inline CValuesForPrimitive &CValuesForPrimitive::operator-=(const
  578. CValuesForPrimitive &vfpToSub)
  579. {
  580. // sub member by member
  581. vfp_fXMin -= vfpToSub.vfp_fXMin;
  582. vfp_fXMax -= vfpToSub.vfp_fXMax;
  583. vfp_fYMin -= vfpToSub.vfp_fYMin;
  584. vfp_fYMax -= vfpToSub.vfp_fYMax;
  585. vfp_fZMin -= vfpToSub.vfp_fZMin;
  586. vfp_fZMax -= vfpToSub.vfp_fZMax;
  587. vfp_fShearX -= vfpToSub.vfp_fShearX;
  588. vfp_fShearZ -= vfpToSub.vfp_fShearZ;
  589. vfp_fStretchX -= vfpToSub.vfp_fStretchX;
  590. vfp_fStretchY -= vfpToSub.vfp_fStretchY;
  591. return *this;
  592. }
  593. inline CValuesForPrimitive CValuesForPrimitive::operator-(const
  594. CValuesForPrimitive &vfpToSub)
  595. {
  596. return CValuesForPrimitive(*this) -= vfpToSub;
  597. }
  598. #define SNAP_FLOAT_GRID 0.25f
  599. inline void CValuesForPrimitive::CorrectInvalidValues(void)
  600. {
  601. // some values must be valid, so if they are not, coorect them
  602. if( vfp_fXMax < vfp_fXMin) vfp_fXMax = vfp_fXMin+SNAP_FLOAT_GRID;
  603. if( vfp_fYMax < vfp_fYMin) vfp_fYMax = vfp_fYMin+SNAP_FLOAT_GRID;
  604. if( vfp_fZMax < vfp_fZMin) vfp_fZMax = vfp_fZMin+SNAP_FLOAT_GRID;
  605. }
  606. /////////////////////////////////////////////////////////////////////////////
  607. extern CWorldEditorApp theApp;
  608. #include "CtrlEnumCombo.h"
  609. #include "CtrlEditString.h"
  610. #include "CtrlEditFloat.h"
  611. #include "CtrlEditBoolean.h"
  612. #include "CtrlBrowseFile.h"
  613. #include "CtrlAxisRadio.h"
  614. #include "WndAnimationFrames.h"
  615. #include "WndTestAnimation.h"
  616. #include "WndDisplayTexture.h"
  617. #include "PrimitiveHistoryCombo.h"
  618. #include "EntitySelectionListBox.h"
  619. #include "CSGDesitnationCombo.h"
  620. #include "TriangularisationCombo.h"
  621. #include "EditMipSwitchDistance.h"
  622. #include "ActiveTextureWnd.h"
  623. #include "BrushPaletteWnd.h"
  624. #include "CustomComboWnd.h"
  625. #include "TerrainInterface.h"
  626. #include "TerrainEditing.h"
  627. #include "WndTerrainTilePalette.h"
  628. #include "ViewTexture.h"
  629. #include "ColorPaletteWnd.h"
  630. #include "ToolTipWnd.h"
  631. #include "ColoredButton.h"
  632. #include "CtrlEditFlags.h"
  633. #include "DlgEditFloat.h"
  634. #include "DlgStretchChildOffset.h"
  635. #include "DlgFilterPolygonSelection.h"
  636. #include "DlgFilterVertexSelection.h"
  637. #include "DlgAllignVertices.h"
  638. #include "DlgSnapVertex.h"
  639. #include "DlgWorldSettings.h"
  640. #include "DlgDisplaceMapSize.h"
  641. #include "DlgSelectByName.h"
  642. #include "DlgRenderingPreferences.h"
  643. #include "DlgPgGlobal.h"
  644. #include "DlgPgTerrain.h"
  645. #include "DlgPgPosition.h"
  646. #include "DlgPgPrimitive.h"
  647. #include "DlgPgPolygon.h"
  648. #include "DlgPgShadow.h"
  649. #include "DlgPgSector.h"
  650. #include "DlgPgTexture.h"
  651. #include "DlgPgRenderingStatistics.h"
  652. #include "DlgAutoDeltaCSG.h"
  653. #include "DlgProgress.h"
  654. #include "DlgLightAnimationEditor.h"
  655. #include "DlgTreeShortcuts.h"
  656. #include "DlgBrowseByClass.h"
  657. #include "DlgNumericAlpha.h"
  658. #include "DlgMirrorAndStretch.h"
  659. #include "DlgComment.h"
  660. #include "DlgAutTexturize.h"
  661. #include "DlgEditTerrainBrush.h"
  662. #include "DlgEditTerrainLayer.h"
  663. #include "DlgTEOperationSettings.h"
  664. #include "DlgTerrainProperties.h"
  665. #include "DlgGenerateFBM.h"
  666. #include "InfoSheet.h"
  667. #include "VirtualTreeCtrl.h"
  668. #include "DlgCreateVirtualDirectory.h"
  669. #include "VirtualTreeNode.h"
  670. #include "BrowseWindow.h"
  671. #include "Browser.h"
  672. #include "InfoFrame.h"
  673. #include "PropertyComboBox.h"
  674. #include "PropertyComboBar.h"
  675. #include "DlgPreferences.h"
  676. #include "DlgLinkTree.h"
  677. #include "MainFrm.h"
  678. #include "ChildFrm.h"
  679. #include "WorldEditorDoc.h"
  680. #include "WorldEditorView.h"
  681. #include "SkyFloat.h"
  682. #endif // WORLDEDITOR_H