MAPEDIT.H (11090B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/MAPEDIT.H 1 3/03/97 10:25a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : MAPEDIT.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : May 14, 1994 * 28 * * 29 * Last Update : May 14, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * This class is derived from the normal display map class. It exists * 33 * only to allow editing and adding items to the map. * 34 *---------------------------------------------------------------------------------------------* 35 * House-setting functions: The editor contains several house maintenance routines: * 36 * Verify_House: tells if the given ObjectType can be owned by the given HousesType * 37 * Cycle_House: Finds the next valid house for the given ObjectType; used when a new object * 38 * can't be owned by the current editor HousesType. * 39 * Change_House: attempts to change the owner of the currently-selected object * 40 * Toggle_House: cycles the HousesType of a pending placement object * 41 * Set_House_Buttons: sets house buttons in accordance with the given HousesType * 42 *---------------------------------------------------------------------------------------------* 43 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 44 45 #ifndef MAPEDIT_H 46 #define MAPEDIT_H 47 48 #include "function.h" 49 50 /* 51 ** This is the maximum # of ObjectTypeClasses the editor has to deal with. 52 */ 53 enum MapEdit1Enum { 54 MAX_EDIT_OBJECTS = // max # of ObjectTypeClasses allowed 55 (int)TEMPLATE_COUNT + 56 (int)OVERLAY_COUNT + 57 (int)SMUDGE_COUNT + 58 (int)TERRAIN_COUNT + 59 (int)UNIT_COUNT + 60 (int)INFANTRY_COUNT + 61 (int)VESSEL_COUNT + 62 (int)STRUCT_COUNT, 63 64 MAX_TEAM_CLASSES = // max # ObjectTypeClasses for a team 65 (int)UNIT_COUNT + 66 (int)INFANTRY_COUNT + 67 (int)AIRCRAFT_COUNT, 68 69 // NUM_EDIT_MISSIONS = 6, // # missions that can be assigned an object 70 71 NUM_EDIT_CLASSES = 9, // # different classes (templates, terrain, etc) 72 73 MAX_MAIN_MENU_NUM = 8, 74 MAX_MAIN_MENU_LEN = 20, 75 76 MAX_AI_MENU_NUM = 6, 77 MAX_AI_MENU_LEN = 20, 78 79 POPUP_HOUSE_X=10, 80 POPUP_HOUSE_Y=100, 81 POPUP_HOUSE_W=60, 82 POPUP_HOUSE_H=(190-100), 83 84 // POPUP_GDI_W = 50, 85 // POPUP_GDI_H = 9, 86 // POPUP_GDI_X = 10, 87 // POPUP_GDI_Y = 160, 88 89 // POPUP_NOD_W = 50, 90 // POPUP_NOD_H = 9, 91 // POPUP_NOD_X = 10, 92 // POPUP_NOD_Y = 169, 93 94 // POPUP_NEUTRAL_W = 50, 95 // POPUP_NEUTRAL_H = 9, 96 // POPUP_NEUTRAL_X = 10, 97 // POPUP_NEUTRAL_Y = 178, 98 99 // POPUP_MULTI1_W = 25, 100 // POPUP_MULTI1_H = 9, 101 // POPUP_MULTI1_X = 10, 102 // POPUP_MULTI1_Y = 160, 103 104 // POPUP_MULTI2_W = 25, 105 // POPUP_MULTI2_H = 9, 106 // POPUP_MULTI2_X = 35, 107 // POPUP_MULTI2_Y = 160, 108 109 // POPUP_MULTI3_W = 25, 110 // POPUP_MULTI3_H = 9, 111 // POPUP_MULTI3_X = 10, 112 // POPUP_MULTI3_Y = 169, 113 114 // POPUP_MULTI4_W = 25, 115 // POPUP_MULTI4_H = 9, 116 // POPUP_MULTI4_X = 35, 117 // POPUP_MULTI4_Y = 169, 118 119 POPUP_MISSION_W = 80, 120 POPUP_MISSION_H = 40, 121 POPUP_MISSION_X = 70, 122 POPUP_MISSION_Y = 150, 123 124 POPUP_FACEBOX_W = 30, 125 POPUP_FACEBOX_H = 30, 126 POPUP_FACEBOX_X = 160, 127 POPUP_FACEBOX_Y = 160, 128 129 POPUP_HEALTH_W = 50, 130 POPUP_HEALTH_H = 10, 131 POPUP_HEALTH_X = 200, 132 POPUP_HEALTH_Y = 170, 133 134 POPUP_BASE_W = 50, 135 POPUP_BASE_H = 8, 136 POPUP_BASE_X = 300 - 50, 137 POPUP_BASE_Y = 0 138 }; 139 140 /* 141 ** These are the button ID's for the pop-up object-editing gizmos. 142 ** The house button ID's must be sequential, with a 1-to-1 correspondence to 143 ** the HousesType values. 144 */ 145 enum MapEditButtonIDEnum{ 146 POPUP_SPAIN=500, 147 POPUP_FIRST=POPUP_SPAIN, 148 POPUP_GREECE, 149 POPUP_USSR, 150 POPUP_ENGLAND, 151 POPUP_ITALY, 152 POPUP_GERMANY, 153 POPUP_FRANCE, 154 POPUP_TURKEY, 155 POPUP_HOUSELIST, // House selection list. 156 POPUP_SELLABLE, // Allowed to sell. 157 POPUP_REBUILDABLE, // Allowed to rebuild. 158 POPUP_MISSIONLIST, // list box for missions 159 POPUP_HEALTHGAUGE, // health of object 160 POPUP_FACINGDIAL, // object's facing 161 POPUP_BASEPERCENT, // Base's percent-built slider 162 MAP_AREA, // map as a click-able thingy 163 BUTTON_FLAG=0x8000 164 }; 165 166 167 class TeamTypeClass; 168 169 class MapEditClass : public MouseClass 170 { 171 /* 172 ** Public Interface 173 */ 174 public: 175 176 /* 177 ** mapedit.cpp 178 */ 179 MapEditClass(void); 180 MapEditClass(NoInitClass const & x) : MouseClass(x) {}; 181 bool Get_Waypoint_Name(char wayptname[]); 182 void Update_Waypoint(int waypt_index); 183 184 virtual void One_Time(void); // One-time init 185 virtual void Init_IO(void); // Inits button list 186 virtual void AI(KeyNumType &input, int x, int y); 187 virtual void Draw_It(bool forced = true); 188 virtual bool Scroll_Map(DirType facing, int & distance, bool really=true); 189 virtual void Read_INI(CCINIClass & ini); 190 virtual void Write_INI(CCINIClass & ini); 191 virtual void Detach(ObjectClass * object); 192 void Detach(TARGET target, bool all=true) {MouseClass::Detach(target, all);} 193 void Clear_List(void); 194 bool Add_To_List(ObjectTypeClass const *object); 195 void Main_Menu(void); 196 void AI_Menu(void); 197 bool Mouse_Moved(void); 198 bool Verify_House(HousesType house, ObjectTypeClass const * objtype); 199 HousesType Cycle_House(HousesType curhouse, ObjectTypeClass const * objtype); 200 // int Trigger_Needs_Team(TriggerClass *trigger); 201 void Fatal(int txt); 202 203 /* 204 ** mapeddlg.cpp 205 */ 206 int New_Scenario(void); 207 int Load_Scenario(void); 208 int Save_Scenario(void); 209 int Pick_Scenario(char const * caption, int & scen_nump, ScenarioPlayerType & playerp, ScenarioDirType & dirp, ScenarioVarType & varp); 210 int Size_Map(int x, int y, int w, int h); 211 int Scenario_Dialog(void); 212 void Handle_Triggers(void); 213 int Select_Trigger(void); 214 215 /* 216 ** mapedplc.cpp 217 */ 218 int Placement_Dialog(void); 219 void Start_Placement(void); 220 int Place_Object(void); 221 void Cancel_Placement(void); 222 void Place_Next(void); 223 void Place_Prev(void); 224 void Place_Next_Category(void); 225 void Place_Prev_Category(void); 226 void Place_Home(void); 227 void Toggle_House(void); 228 void Set_House_Buttons(HousesType house, GadgetClass *btnlist, int base_id); 229 void Start_Trigger_Placement(void); 230 void Stop_Trigger_Placement(void); 231 void Place_Trigger(void); 232 void Start_Base_Building(void); 233 void Cancel_Base_Building(void); 234 void Build_Base_To(int percent); 235 236 /* 237 ** mapedsel.cpp 238 */ 239 int Select_Object(void); 240 void Select_Next(void); 241 void Popup_Controls(void); 242 void Grab_Object(void); 243 int Move_Grabbed_Object(void); 244 bool Change_House(HousesType newhouse); 245 246 /* 247 ** mapedtm.cpp 248 */ 249 void Draw_Member(TechnoTypeClass const * ptr, int index, int quant, HousesType house); 250 void Handle_Teams(char const * caption); 251 int Select_Team(char const * caption); 252 int Team_Members(HousesType house); 253 254 /* 255 ** Private Interface 256 */ 257 private: 258 /* 259 ** This is the last-requested variation of a loaded/saved/new scenario. 260 */ 261 // ScenarioVarType ScenVar; 262 263 /* 264 ** Array of all TypeClasses the user can add to the map; cleared by 265 ** Clear_List(), added to by Add_To_List() 266 */ 267 ObjectTypeClass const * Objects[MAX_EDIT_OBJECTS]; 268 int ObjCount; // # of objects in the Objects array 269 270 /* 271 ** Last-selected object to place, and last-selected house of object 272 */ 273 int LastChoice; // index of item user picked last 274 HousesType LastHouse; // house of last item picked 275 276 /* 277 ** Variables for grabbing/moving objects 278 */ 279 ObjectClass * GrabbedObject; // object "grabbed" with mouse 280 CELL GrabOffset; // offset to grabbed obj's upper-left 281 unsigned long LastClickTime; // time of last LMOUSE click 282 283 /* 284 ** Number of each type of object in Objects, so we can switch categories 285 */ 286 int NumType[NUM_EDIT_CLASSES]; // # of each type of class: 287 // 0 = Template 288 // 1 = Overlay 289 // 2 = Smudge 290 // 3 = Terrain 291 // 4 = Unit 292 // 5 = Infantry 293 // 6 = Vessels 294 // 7 = Building 295 // 8 = Aircraft 296 297 /* 298 ** The offset of each type of object within the Objects[] array 299 */ 300 int TypeOffset[NUM_EDIT_CLASSES]; // offsets within Objects[] 301 302 /* 303 ** The "current" trigger for point-and-click trigger setting 304 */ 305 TriggerTypeClass * CurTrigger; // current trigger 306 307 /* 308 ** The "current" team type for editing & associating with a trigger 309 */ 310 TeamTypeClass * CurTeam; // current team 311 312 /* 313 ** Bitfields for flags & such 314 */ 315 unsigned Changed : 1; // 1 = changes are unsaved 316 unsigned LMouseDown : 1; // 1 = left mouse is held down 317 unsigned BaseBuilding : 1; // 1 = we're in base-building mode 318 319 /* 320 ** Variables for pre-building a base 321 */ 322 // int BasePercent; // Percentage the base will be built 323 324 /* 325 ** Variables for supporting the object-editing controls at screen bottom 326 */ 327 ListClass * HouseList; 328 ListClass * MissionList; 329 TriColorGaugeClass *HealthGauge; 330 Dial8Class *FacingDial; 331 ControlClass *MapArea; 332 TextLabelClass *HealthText; 333 TextButtonClass * Sellable; 334 TextButtonClass * Rebuildable; 335 static char HealthBuf[20]; 336 GaugeClass *BaseGauge; 337 TextLabelClass *BaseLabel; 338 static MissionType MapEditMissions[]; 339 }; 340 341 #endif