WorldBuilder.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  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. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // WorldBuilder.h : main header file for the WORLDBUILDER application
  19. //
  20. #if !defined(AFX_WORLDBUILDER_H__FBA41345_2826_11D5_8CE0_00010297BBAC__INCLUDED_)
  21. #define AFX_WORLDBUILDER_H__FBA41345_2826_11D5_8CE0_00010297BBAC__INCLUDED_
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25. #ifndef __AFXWIN_H__
  26. #error include 'stdafx.h' before including this file for PCH
  27. #endif
  28. #include "resource.h" // main symbols
  29. #include "Common/STLTypedefs.h"
  30. #include "BrushTool.h"
  31. #include "TileTool.h"
  32. #include "FeatherTool.h"
  33. #include "AutoEdgeOutTool.h"
  34. #include "FloodFillTool.h"
  35. #include "MoundTool.h"
  36. #include "EyedropperTool.h"
  37. #include "ObjectTool.h"
  38. #include "FenceTool.h"
  39. #include "PointerTool.h"
  40. #include "BlendEdgeTool.h"
  41. #include "BorderTool.h"
  42. #include "GroveTool.h"
  43. #include "HandScrollTool.h"
  44. #include "RoadTool.h"
  45. #include "MeshMoldTool.h"
  46. #include "WaypointTool.h"
  47. #include "PolygonTool.h"
  48. #include "WaterTool.h"
  49. #include "BuildListTool.h"
  50. #include "RampTool.h"
  51. #include "ScorchTool.h"
  52. #include "Common/Debug.h"
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CWorldBuilderApp:
  55. // See WorldBuilder.cpp for the implementation of this class
  56. //
  57. // Force maps into a directory structure.
  58. #define DO_MAPS_IN_DIRECTORIES 1
  59. #define NONE_STRING "<none>"
  60. enum {THREE_D_VIEW_WIDTH=800, THREE_D_VIEW_HEIGHT=600};
  61. enum {MAX_OBJECTS_IN_MAP = 3000};
  62. class CWorldBuilderApp : public CWinApp
  63. {
  64. public:
  65. CWorldBuilderApp();
  66. ~CWorldBuilderApp();
  67. // Overrides
  68. // ClassWizard generated virtual function overrides
  69. //{{AFX_VIRTUAL(CWorldBuilderApp)
  70. public:
  71. virtual BOOL InitInstance();
  72. virtual int ExitInstance();
  73. //}}AFX_VIRTUAL
  74. // Implementation
  75. //{{AFX_MSG(CWorldBuilderApp)
  76. afx_msg void OnAppAbout();
  77. afx_msg void OnResetWindows();
  78. afx_msg void OnFileOpen();
  79. afx_msg void OnTexturesizingMapclifftextures();
  80. afx_msg void OnUpdateTexturesizingMapclifftextures(CCmdUI* pCmdUI);
  81. //}}AFX_MSG
  82. DECLARE_MESSAGE_MAP()
  83. protected:
  84. enum {NUM_VIEW_TOOLS=24};
  85. Tool *m_tools[NUM_VIEW_TOOLS]; ///< array of tool pointers.
  86. Tool *m_curTool; ///< Currently active tool.
  87. Tool *m_selTool; ///< Normal tool. If we hit alt, curTool turns to eyedropper.
  88. BrushTool m_brushTool; ///< Height brush tool.
  89. TileTool m_tileTool; ///< Single texture tile tool.
  90. BigTileTool m_bigTileTool; ///< Wide texture tile tool.
  91. FeatherTool m_featherTool; ///< Feather the height values tool.
  92. AutoEdgeOutTool m_autoEdgeOutTool; ///< Auto blend texture edges out tool.
  93. FloodFillTool m_floodFillTool; ///< Flood fill tool.
  94. MoundTool m_moundTool; ///< Add height to height values tool.
  95. DigTool m_digTool; ///< Remove height from height values tool.
  96. EyedropperTool m_eyedropperTool; ///< Eyedropper tool.
  97. ObjectTool m_objectTool; ///< Add and orient object tool.
  98. PointerTool m_pointerTool; ///< Select and move/rotate tool.
  99. BlendEdgeTool m_blendEdgeTool; ///< Blend a single edge tool.
  100. GroveTool m_groveTool; ///< Plant a grove of trees tool.
  101. HandScrollTool m_handScrollTool; ///< Scroll tool.
  102. RoadTool m_roadTool; ///< Road tool.
  103. MeshMoldTool m_meshMoldTool; ///< Mesh shaping mold tool.
  104. WaypointTool m_waypointTool; ///< Waypoint tool.
  105. PolygonTool m_polygonTool; ///< Polygon tool.
  106. WaterTool m_waterTool; ///< Water tool.
  107. BuildListTool m_buildListTool; ///< Build List tool.
  108. FenceTool m_fenceTool; ///< Fence tool.
  109. RampTool m_rampTool; ///< Ramp tool.
  110. ScorchTool m_scorchTool; ///< Scorch tool.
  111. BorderTool m_borderTool; ///< Border tool.
  112. Int m_lockCurTool;
  113. AsciiString m_currentDirectory; ///< Current directory for open file.
  114. CDocTemplate *m_3dtemplate;
  115. MapObject *m_pasteMapObjList; ///< List of copied/cut map objects.
  116. protected:
  117. void deletePasteObjList(void)
  118. {
  119. if (m_pasteMapObjList)
  120. m_pasteMapObjList->deleteInstance();
  121. m_pasteMapObjList = NULL;
  122. };
  123. public:
  124. CDocTemplate *Get3dTemplate() { return m_3dtemplate; }
  125. /// Set the brush tool as the active tool.
  126. void selectBrushTool(void) { setActiveTool(&m_brushTool); }
  127. /// Set the pointer tool as the active tool.
  128. void selectPointerTool(void);
  129. /// Set the hand tool as the cur tool (but not active tool)
  130. void selectHandToolTemp(void) { m_curTool = &m_handScrollTool; }
  131. /// Set the tool that will be active.
  132. void setActiveTool(Tool *newTool);
  133. /// Sets the current directry for file opens.
  134. void setCurrentDirectory(AsciiString dir) {m_currentDirectory = dir;};
  135. Tool *getCurTool() { return m_curTool; }
  136. /// Check to see if any keyboard overrides are changing the current tool.
  137. void updateCurTool(Bool forceHand);
  138. /// Switch to the poly tool if we aren't already.
  139. void setPolyTool(void){ setActiveTool(&m_polygonTool); };
  140. /// Return true if the hand scroll tool is active.
  141. Bool isHandScroll(void) {return m_curTool == &m_handScrollTool; }
  142. void lockCurTool() { DEBUG_ASSERTCRASH(!m_lockCurTool,("already locked")); m_lockCurTool = 1; }
  143. void unlockCurTool() { m_lockCurTool = 0; }
  144. Bool isCurToolLocked() { return m_lockCurTool != 0; }
  145. /// Note - read only data - make yourself a copy.
  146. MapObject *getMapObjPasteList(void) { return(m_pasteMapObjList);};
  147. /// Note - the app owns this, and will delete it on close.
  148. void setMapObjPasteList(MapObject *list) { deletePasteObjList(); m_pasteMapObjList = list; };
  149. /// Handles command messages.
  150. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  151. AFX_CMDHANDLERINFO* pHandlerInfo);
  152. };
  153. inline CWorldBuilderApp *WbApp() { return (CWorldBuilderApp*)::AfxGetApp(); }
  154. /////////////////////////////////////////////////////////////////////////////
  155. //{{AFX_INSERT_LOCATION}}
  156. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  157. #endif // !defined(AFX_WORLDBUILDER_H__FBA41345_2826_11D5_8CE0_00010297BBAC__INCLUDED_)