TYPE.H (64573B)
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/TYPE.H 1 3/03/97 10:26a 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 : TYPE.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : April 14, 1994 * 28 * * 29 * Last Update : April 14, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef TYPE_H 36 #define TYPE_H 37 38 #include "mission.h" 39 #include "target.h" 40 41 class MapEditClass; 42 class HouseClass; 43 class WeaponTypeClass; 44 45 46 /*************************************************************************** 47 ** This is the abstract type class. It holds information common to all 48 ** objects that might exist. This contains the name of the object type. 49 */ 50 class AbstractTypeClass 51 { 52 public: 53 54 /* 55 ** This serves to identify the object class. The ID corresponds to the 56 ** variation number (e.g., UNIT_TANK1, UNIT_TANK2, etc.). 57 */ 58 RTTIType RTTI; 59 int ID; 60 61 /* 62 ** This is the internal control name of the object. This name does 63 ** not change regardless of language specified. This is the name 64 ** used in scenario control files and for other text based unique 65 ** identification purposes. 66 */ 67 char IniName[24]; 68 69 /* 70 ** The translated (language specific) text name number of this object. 71 ** This number is used to fetch the object's name from the language 72 ** text file. Whenever the name of the object needs to be displayed, 73 ** this is used to determine the text string. 74 */ 75 int FullName; 76 77 AbstractTypeClass(RTTIType rtti, int id, int name, char const * ini); 78 AbstractTypeClass(NoInitClass const & ) {}; 79 ~AbstractTypeClass(void) {}; 80 81 RTTIType What_Am_I(void) const {return(RTTI);}; 82 TARGET As_Target(void) const {return(Build_Target(RTTI, ID));}; 83 84 virtual COORDINATE Coord_Fixup(COORDINATE coord) const; 85 virtual int Full_Name(void) const; 86 char const * Name(void) const {return(IniName);} 87 void Set_Name(char const * buf) const { 88 strncpy((char *)IniName, buf, sizeof(IniName)); 89 ((char &)IniName[sizeof(IniName)-1]) = '\0'; 90 }; 91 virtual int Get_Ownable(void) const; 92 93 void Code_Pointers(void) {} 94 void Decode_Pointers(void) {} 95 }; 96 97 98 /********************************************************************** 99 ** Each house has certain unalienable characteristics. This structure 100 ** elaborates these. 101 */ 102 class HouseTypeClass : public AbstractTypeClass 103 { 104 public: 105 /* 106 ** This is the house number (enum). This is a unique identification 107 ** number for the house. 108 */ 109 HousesType House; 110 111 /* 112 ** This is the filename suffix to use when creating a house specific 113 ** file name. It is three characters long. 114 */ 115 char Suffix[_MAX_EXT]; 116 117 /* 118 ** This is the "lemon percentage" to use when determining if a particular 119 ** object owned by this house is to be flagged as a "lemon". Objects so 120 ** flagged have a greater break-down chance. The percentage is expressed 121 ** as a fixed point number with 0x000 meaning 0% and 0x100 meaning 100%. 122 */ 123 unsigned Lemon; 124 125 /* 126 ** This points to the default remap table for this house. 127 */ 128 PlayerColorType RemapColor; 129 130 /* 131 ** This is a unique ASCII character used when constructing filenames. It 132 ** serves a similar purpose as the "Suffix" element, but is only one 133 ** character long. 134 */ 135 char Prefix; 136 137 /* 138 ** This controls the various general adjustments to the house owned 139 ** unit and building ratings. The default value for these ratings is 140 ** a fixed point number of 1.0. 141 */ 142 fixed FirepowerBias; 143 fixed GroundspeedBias; 144 fixed AirspeedBias; 145 fixed ArmorBias; 146 fixed ROFBias; 147 fixed CostBias; 148 fixed BuildSpeedBias; 149 150 //------------------------------------------------------------------------ 151 HouseTypeClass(NoInitClass const & x) : AbstractTypeClass(x) {} 152 HouseTypeClass(HousesType house, 153 char const * ini, 154 int fullname, 155 char const * ext, 156 int lemon, 157 PlayerColorType remapcolor, 158 char prefix); 159 160 unsigned char const * Remap_Table(void) const; 161 162 static void * operator new(size_t); 163 static void * operator new(size_t , void * ptr) {return(ptr);}; 164 static void operator delete(void * ptr); 165 166 static HousesType From_Name(char const * name); 167 static HouseTypeClass & As_Reference(HousesType house); 168 static void One_Time(void); 169 static void Init_Heap(void); 170 171 virtual bool Read_INI(CCINIClass & ini); 172 }; 173 174 175 /*************************************************************************** 176 ** This the the common base class of game objects. Since these values 177 ** represent the unchanging object TYPES, this data is initialized at game 178 ** start and not changed during play. It is "const" data. 179 */ 180 class ObjectTypeClass : public AbstractTypeClass 181 { 182 public: 183 /* 184 ** This is the base name of the graphic data associated with this object 185 ** type. If the graphic name is a null string, then there is no graphic 186 ** associated with this object type. 187 */ 188 char GraphicName[_MAX_FNAME]; 189 190 /* 191 ** Is this object squashable by heavy vehicles? If it is, then the vehicle 192 ** can travel over this object and destroy it in the process. 193 */ 194 unsigned IsCrushable:1; 195 196 /* 197 ** Does this object type NOT show up on radar scans? If true, then in any 198 ** radar display, only the underlying ground will be show, not this object. 199 ** Most terrain falls into this category, but only a few special real units/buildings 200 ** do. 201 */ 202 unsigned IsStealthy:1; 203 204 /* 205 ** It is legal to "select" some objects in the game. If it is legal to select this 206 ** object type then this flag will be true. Selected game objects typically display 207 ** a floating health bar and allows special user I/O control. 208 */ 209 unsigned IsSelectable:1; 210 211 /* 212 ** Can this object be the target of an attack or move command? Typically, only objects 213 ** that take damage or can be destroyed are allowed to be a target. 214 */ 215 unsigned IsLegalTarget:1; 216 217 /* 218 ** "Insignificant" objects will not be announced when they are destroyed or when they 219 ** appear. Terrain elements and some lesser vehicles have this characteristic. 220 */ 221 unsigned IsInsignificant:1; 222 223 /* 224 ** Is this object immune to normal combat damage? Rocks and other inert type terrain 225 ** object are typically of this type. 226 */ 227 unsigned IsImmune:1; 228 229 /* 230 ** "Sentient" objects are ones that have logic AI processing performed on them. All 231 ** vehicles, buildings, infantry, and aircraft are so flagged. Terrain elements also 232 ** fall under this category, but only because certain animation effects require this. 233 */ 234 unsigned IsSentient:1; 235 236 /* 237 ** If this object type affects the occupation and collision logic associated with 238 ** cells, then this flag will be true. Typically, this characteristic is limited 239 ** to buildings, units, terrain objects, and landed aircraft. 240 */ 241 unsigned IsFootprint:1; 242 243 /* 244 ** The defense of this object is greatly affected by the type of armor 245 ** it possesses. This value specifies the type of armor. 246 */ 247 ArmorType Armor; 248 249 /* 250 ** This is the maximum strength of this object type. 251 */ 252 unsigned short MaxStrength; 253 254 /* 255 ** These point to the shape imagery for this object type. Since the shape imagery 256 ** exists in a separate file, the data is filled in after this object is constructed. 257 ** The "mutable" keyword allows easy modification to this otherwise const object. 258 */ 259 void const * ImageData; 260 261 /* 262 ** Points to the dimension data for each shape in the image list. By using this 263 ** data, the minimum number of cells will be redrawn when the object changes shape. 264 */ 265 Rect * DimensionData; 266 267 /* 268 ** This points to the radar imagery for this object. 269 */ 270 void const * RadarIcon; 271 272 //-------------------------------------------------------------------- 273 ObjectTypeClass(NoInitClass const & x) : AbstractTypeClass(x) {} 274 ObjectTypeClass( RTTIType rtti, 275 int id, 276 bool is_sentient, 277 bool is_stealthy, 278 bool is_selectable, 279 bool is_legal_target, 280 bool is_insignificant, 281 bool is_immune, 282 bool is_footprint, 283 int fullname, 284 char const * name 285 ); 286 287 static void One_Time(void); 288 289 bool Is_Foot(void) const {return(RTTI == RTTI_INFANTRYTYPE || RTTI == RTTI_UNITTYPE || RTTI == RTTI_VESSELTYPE || RTTI == RTTI_AIRCRAFTTYPE);}; 290 char const * Graphic_Name(void) const {if (GraphicName[0] != '\0') return(GraphicName); return(Name());} 291 virtual int Max_Pips(void) const; 292 virtual void Dimensions(int &width, int &height) const; 293 virtual bool Create_And_Place(CELL , HousesType =HOUSE_NONE) const = 0; 294 virtual int Cost_Of(void) const; 295 virtual int Time_To_Build(HousesType house) const; 296 virtual ObjectClass * Create_One_Of(HouseClass *) const = 0; 297 virtual short const * Occupy_List(bool placement=false) const; 298 virtual short const * Overlap_List(void) const; 299 virtual BuildingClass * Who_Can_Build_Me(bool intheory, bool legal, HousesType house) const; 300 virtual void const * Get_Cameo_Data(void) const; 301 void const * Get_Image_Data(void) const {return ImageData;}; 302 void const * Get_Radar_Data(void) const {return RadarIcon;}; 303 304 #ifdef SCENARIO_EDITOR 305 virtual void Display(int, int, WindowNumberType, HousesType) const {}; 306 #endif 307 308 static void const * SelectShapes; 309 static void const * PipShapes; 310 }; 311 312 313 /*************************************************************************** 314 ** This class is the common data for all objects that can be owned, produced, 315 ** or delivered as reinforcements. These are objects that typically contain 316 ** crews and weapons -- the fighting objects of the game. 317 */ 318 class TechnoTypeClass : public ObjectTypeClass 319 { 320 public: 321 322 /* 323 ** This controls how this object type is remapped when it is displayed 324 ** in the sidebar. 325 */ 326 RemapType Remap; 327 328 /* 329 ** Is this object ownable by all sides in a multiplayer game? There are some 330 ** special case objects that need this override ability. 331 */ 332 unsigned IsDoubleOwned:1; 333 334 /* 335 ** If this object should be completely and always invisible to the enemy, then 336 ** this flag will be true. 337 */ 338 unsigned IsInvisible:1; 339 340 /* 341 ** If this object can serve as a good leader for a group selected 342 ** series of objects, then this flag will be true. Unarmed or 343 ** ability challenged units do not make good leaders. This flag is 344 ** also used to indicate the primary factory when dealing with 345 ** buildings. 346 */ 347 unsigned IsLeader:1; 348 349 /* 350 ** Does this object have the ability to detect the presence of a nearby 351 ** cloaked object? 352 */ 353 unsigned IsScanner:1; 354 355 /* 356 ** If this object is always given its proper name rather than a generic 357 ** name, then this flag will be true. Typically, civilians and Dr. Moebius 358 ** fall under this category. 359 */ 360 unsigned IsNominal:1; 361 362 /* 363 ** If the artwork for this object (only for generics) is theater specific, then 364 ** this flag will be true. Civilian buildings are a good example of this. 365 */ 366 unsigned IsTheater:1; 367 368 /* 369 ** Does this object type contain a rotating turret? Gun emplacements, SAM launchers, 370 ** and many vehicles contain a turret. If a turret is present, special rendering and 371 ** combat logic must be performed. 372 */ 373 unsigned IsTurretEquipped:1; 374 375 /* 376 ** Certain objects can be repaired. For buildings, they repair "in place". For units, 377 ** they must travel to a repair center to be repaired. If this flag is true, then 378 ** allow the player or computer AI to repair the object. 379 */ 380 unsigned IsRepairable:1; 381 382 /* 383 ** Does this object contain a crew? If it does, then when the object is destroyed, there 384 ** is a distinct possibility that infantry will "pop out". Only units with crews can 385 ** become "heros". 386 */ 387 unsigned IsCrew:1; 388 389 /* 390 ** This tells whether this unit should EVER be remapped when it is displayed 391 ** on the tactical map. Normally, the unit is remapped, but for certain civilian 392 ** object, remapping is not to be performed, regardless of owner. 393 */ 394 unsigned IsRemappable:1; 395 396 /* 397 ** Is the unit capable of cloaking? Only Stealth Tank can do so now. 398 */ 399 unsigned IsCloakable:1; 400 401 /* 402 ** Can this object self heal up to half strength? Mammoth tanks from C&C had this 403 ** feature. 404 */ 405 unsigned IsSelfHealing:1; 406 407 /* 408 ** If this object explodes violently when destroyed, then this flag will be true. 409 ** The type of explosion is based on the warhead type and the damage generated 410 ** corresponds to the full strength of the object. 411 */ 412 unsigned IsExploding:1; 413 414 /* 415 ** This specifies the zone that an object of this type should recognize. Zones 416 ** of this type or lower will be considered "possible to travel to". 417 */ 418 MZoneType MZone; 419 420 /* 421 ** When determining threat, the range can be overridden to be the value 422 ** specified here. Otherwise, the range for enemy scan is equal to the 423 ** longest weapon range the object has. If the value is zero, then the 424 ** weapon range is used. 425 */ 426 LEPTON ThreatRange; 427 428 /* 429 ** If this is a transporter object (e.g., hovercraft, chinook, APC), then this 430 ** value specifies the maximum number of passengers it may carry. 431 */ 432 int MaxPassengers; 433 434 /* 435 ** Most objects have the ability to reveal the terrain around themselves. 436 ** This sight range (expressed in cell distance) is specified here. If 437 ** this value is 0, then this unit never reveals terrain. Bullets are 438 ** typically of this nature. 439 */ 440 int SightRange; 441 442 /* 443 ** This is the credit cost to produce this object (presuming production is 444 ** allowed). 445 */ 446 int Cost; 447 448 /* 449 ** The tech level that this object can be produced at. 450 */ 451 unsigned Level; 452 453 /* 454 ** This specifies the building prerequisites required before an object 455 ** of this type can be produced. 456 */ 457 long Prerequisite; 458 459 /* 460 ** The risk and reward values are used to determine targets and paths 461 ** toward targets. When heading toward a target, a path of least 462 ** risk will be followed. When picking a target, the object of 463 ** greatest reward will be selected. The values assigned are 464 ** arbitrary. 465 */ 466 int Risk,Reward; 467 468 /* 469 ** This value indicates the maximum speed that this object can achieve. 470 */ 471 MPHType MaxSpeed; 472 473 /* 474 ** This indicates the speed (locomotion) type for this unit. Through this 475 ** value the movement capabilities are deduced. 476 */ 477 SpeedType Speed; 478 479 /* 480 ** This is the maximum number of ammo shots this object can hold. If 481 ** this number is -1, then this indicates unlimited ammo. 482 */ 483 int MaxAmmo; 484 485 /* 486 ** This is a bit field representing the houses that are allowed to 487 ** own (by normal means) this particular object type. This value is 488 ** typically used in production contexts. It is possible for a side 489 ** to take possession of an object type otherwise not normally allowed. 490 ** This event usually occurs as a result of capture. 491 */ 492 long Ownable; 493 494 /* 495 ** This is the small icon image that is used to display the object in 496 ** the sidebar for construction selection purposes. 497 */ 498 void const * CameoData; 499 500 /* 501 ** The number of animation frames allotted to rotation is specified here. 502 ** For an object that has no rotation, this value will be 1. For normal 503 ** vehicles this value will be 32. There are some special case units that 504 ** have intermediate rotation frames. 505 */ 506 int Rotation; 507 508 /* 509 ** This is the rotational speed of the object. This value represents the 510 ** turret or body rotation speed expresses as 360/256ths rotation steps per 511 ** game tick. 512 */ 513 int ROT; 514 515 /* 516 ** These are the weapons that this techno object is armed with. 517 */ 518 WeaponTypeClass const * PrimaryWeapon; 519 WeaponTypeClass const * SecondaryWeapon; 520 521 /* 522 ** These specify the lepton offsets to locate the exact coordinate of the 523 ** 'tip of the barrel' for the weapon. This is used for generating the bullet 524 ** at the proper location. 525 */ 526 int HorizontalOffset; // Distance to move east (compensates for offsets in animation from center coordinate). 527 int VerticalOffset; // Distance to move north (compensates for perspective). 528 int PrimaryOffset; // Offset along turret centerline and facing. 529 int PrimaryLateral; // Sideways offset from turret centerline and facing. 530 int SecondaryOffset; 531 int SecondaryLateral; 532 533 /* 534 ** Points you're awarded for destroying an object of this type, and 535 ** points you lose if you lose an object of this type. 536 */ 537 int Points; 538 539 //-------------------------------------------------------------------- 540 TechnoTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {} 541 TechnoTypeClass( 542 RTTIType rtti, 543 int id, 544 int name, 545 char const * ininame, 546 RemapType remap, 547 int verticaloffset, 548 int primaryoffset, 549 int primarylateral, 550 int secondaryoffset, 551 int secondarylateral, 552 bool is_nominal, 553 bool is_stealthy, 554 bool is_selectable, 555 bool is_legal_target, 556 bool is_insignificant, 557 bool is_immune, 558 bool is_theater, 559 bool is_turret_equipped, 560 bool is_remappable, 561 bool is_footprint, 562 int rotation, 563 SpeedType speed, 564 int horizontaloffset=0 565 ); 566 567 bool Is_Two_Shooter(void) const; 568 int Legal_Placement(CELL pos) const; 569 virtual int Raw_Cost(void) const; 570 virtual int Max_Passengers(void) const {return(MaxPassengers);} 571 virtual int Repair_Cost(void) const; 572 virtual int Repair_Step(void) const; 573 virtual void const * Get_Cameo_Data(void) const; 574 virtual int Cost_Of(void) const; 575 virtual int Time_To_Build(HousesType house) const; 576 virtual int Get_Ownable(void) const; 577 virtual bool Read_INI(CCINIClass & ini); 578 579 /* 580 ** This is a pointer to the wake shape (as needed by the gunboat). 581 */ 582 static void const * WakeShapes; 583 static void const * TurretShapes; 584 static void const * SamShapes; 585 static void const * MGunShapes; 586 }; 587 588 589 /*************************************************************************** 590 ** Building types need some special information custom to buildings. This 591 ** is a derived class that elaborates these additional data elements. 592 */ 593 class BuildingTypeClass : public TechnoTypeClass { 594 public: 595 /* 596 ** Is this building allowed to be considered for building adjacency 597 ** checking? If false, then building off of (or adjacent to) this building 598 ** is not considered. 599 */ 600 unsigned IsBase:1; 601 602 /* 603 ** If this building is a fake, this flag will be set. 604 */ 605 unsigned IsFake:1; 606 607 /* 608 ** This flag controls whether the building is equiped with a dirt 609 ** bib or not. A building with a bib has a dirt patch automatically 610 ** attached to the structure when it is placed. 611 */ 612 unsigned IsBibbed:1; 613 614 /* 615 ** If this building is a special wall type, such that it exists as a building 616 ** for purposes of construction but transforms into an overlay wall object when 617 ** it is placed on the map, then this flag will be true. 618 */ 619 unsigned IsWall:1; 620 621 /* 622 ** Buildings can have either simple or complex damage stages. If simple, 623 ** then the second to the last frame is the half damage stage, and the last 624 ** frame is the complete damage stage. For non-simple damage, buildings 625 ** have a complete animation set for damaged as well as undamaged condition. 626 ** Turrets, oil pumps, and repair facilities are a few examples. 627 */ 628 unsigned IsSimpleDamage:1; 629 630 /* 631 ** Certain building types can be captures by enemy infantry. For those 632 ** building types, this flag will be true. Typically, military or hardened 633 ** structures such as turrets cannot be captured. 634 */ 635 unsigned IsCaptureable:1; 636 637 /* 638 ** If this building really only has cosmetic idle animation, then this flag will be 639 ** true if this animation should run at a relatively constant rate regardless of game 640 ** speed setting. 641 */ 642 unsigned IsRegulated:1; 643 644 /* 645 ** Does this building require power to function? Usually, this isn't the case. The building 646 ** normally either has no effect by power level or is gradually reduced in effectiveness. This 647 ** flag is for those buildings that completely cease to function when the power drops below 648 ** full. 649 */ 650 unsigned IsPowered:1; 651 652 /* 653 ** If this flag is true, then the building cannot be sold even if it could have been built. This 654 ** is especially useful for mines which can be built but cannot be sold. 655 */ 656 unsigned IsUnsellable:1; 657 658 /* 659 ** This is the direction (from the center cell) of the building in order to find a 660 ** legitimate foundation square. This location will be used for targeting and capture 661 ** move destination purposes. 662 */ 663 FacingType FoundationFace; 664 665 /* 666 ** Adjacent distance for building next to. 667 */ 668 int Adjacent; 669 670 /* 671 ** This flag specifies the type of object this factory building can "produce". For non 672 ** factory buildings, this value will be RTTI_NONE. 673 */ 674 RTTIType ToBuild; 675 676 /* 677 ** For building that produce ground units (infantry and vehicles), there is a default 678 ** exit point defined. This point is where the object is first placed on the map. 679 ** Typically, this is located next to a door. The unit will then travel on to a clear 680 ** terrain area and enter normal game processing. 681 */ 682 COORDINATE ExitCoordinate; 683 684 /* 685 ** When determine which cell to head toward when exiting a building, use the 686 ** list elaborated by this variable. There are directions of exit that are 687 ** more suitable than others. This list is here to inform the system which 688 ** directions those are. 689 */ 690 short const * ExitList; 691 692 /* 693 ** This is the structure type identifier. It can serve as a unique 694 ** identification number for building types. 695 */ 696 StructType Type; 697 698 /* 699 ** This is the starting facing to give this building when it first 700 ** gets constructed. The facing matches the final stage of the 701 ** construction animation. 702 */ 703 DirType StartFace; 704 705 /* 706 ** This is the Tiberium storage capacity of the building. The sum of all 707 ** building's storage capacity is used to determine how much Tiberium can 708 ** be accumulated. 709 */ 710 int Capacity; 711 712 /* 713 ** Each building type produces and consumes power. These values tell how 714 ** much. 715 */ 716 int Power; 717 int Drain; 718 719 /* 720 ** This is the size of the building. This size value is a rough indication 721 ** of the building's "footprint". 722 */ 723 BSizeType Size; 724 725 /********************************************************************** 726 ** For each stage that a building may be in, its animation is controlled 727 ** by this structure. It dictates the starting and length of the animation 728 ** frames needed for the specified state. In addition it specifies how long 729 ** to delay between changes in animation. With this data it is possible to 730 ** control the appearance of all normal buildings. Turrets and SAM sites are 731 ** an exception since their animation is not merely cosmetic. 732 */ 733 typedef struct { 734 int Start; // Starting frame of animation. 735 int Count; // Number of frames in this animation. 736 int Rate; // Number of ticks to delay between each frame. 737 } AnimControlType; 738 AnimControlType Anims[BSTATE_COUNT]; 739 740 /*--------------------------------------------------------------------------- 741 ** This is the building type explicit constructor. 742 */ 743 BuildingTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {} 744 BuildingTypeClass ( 745 StructType type, 746 int name, 747 char const * ininame, 748 FacingType foundation, 749 COORDINATE exitpoint, 750 RemapType remap, 751 int verticaloffset, 752 int primaryoffset, 753 int primarylateral, 754 bool is_fake, 755 bool is_regulated, 756 bool is_nominal, 757 bool is_wall, 758 bool is_simpledamage, 759 bool is_stealthy, 760 bool is_selectable, 761 bool is_legal_target, 762 bool is_insignificant, 763 bool is_theater, 764 bool is_turret_equipped, 765 bool is_remappable, 766 RTTIType tobuild, 767 DirType sframe, 768 BSizeType size, 769 short const * exitlist, 770 short const * sizelist, 771 short const * overlap 772 ); 773 operator StructType(void) const {return(Type);}; 774 775 static void * operator new(size_t); 776 static void * operator new(size_t , void * ptr) {return(ptr);}; 777 static void operator delete(void * ptr); 778 779 static void Init_Heap(void); 780 static BuildingTypeClass & As_Reference(StructType type); 781 static StructType From_Name(char const * name); 782 static void Init(TheaterType theater); 783 static void One_Time(void); 784 static void Prep_For_Add(void); 785 786 int Width(void) const; 787 int Height(bool bib=false) const; 788 789 virtual int Full_Name(void) const; 790 virtual bool Read_INI(CCINIClass & ini); 791 bool Flush_For_Placement(CELL cell, HouseClass * house) const; 792 virtual int Cost_Of(void) const; 793 virtual COORDINATE Coord_Fixup(COORDINATE coord) const; 794 virtual int Max_Pips(void) const; 795 virtual void Dimensions(int &width, int &height) const; 796 virtual bool Create_And_Place(CELL cell, HousesType house) const; 797 virtual ObjectClass * Create_One_Of(HouseClass * house) const; 798 virtual short const * Occupy_List(bool placement=false) const; 799 virtual short const * Overlap_List(void) const; 800 virtual void const * Get_Buildup_Data(void) const {return(BuildupData);}; 801 802 bool Is_Factory(void) const {return(ToBuild != RTTI_NONE);} 803 virtual int Raw_Cost(void) const; 804 bool Bib_And_Offset(SmudgeType & bib, CELL & cell) const; 805 806 #ifdef SCENARIO_EDITOR 807 virtual void Display(int x, int y, WindowNumberType window, HousesType house) const; 808 #endif 809 810 /* 811 ** Special overlay for the weapons factory. 812 */ 813 static void const * WarFactoryOverlay; 814 815 private: 816 817 /* 818 ** This is a pointer to a list of offsets (from the upper left corner) that 819 ** are used to indicate the building's "footprint". This footprint is used 820 ** to determine building placement legality and terrain passibility. 821 */ 822 short const * OccupyList; 823 824 /* 825 ** Buildings can often times overlap a cell but not actually "occupy" it for 826 ** purposes of movement. This points to a list of offsets that indicate which 827 ** cells the building has visual overlap but does not occupy. 828 */ 829 short const * OverlapList; 830 831 /* 832 ** The construction animation graphic data pointer is 833 ** pointed to by this element. 834 */ 835 void const * BuildupData; 836 837 void Init_Anim(BStateType state, int start, int count, int rate) const; 838 }; 839 840 841 /*************************************************************************** 842 ** The various unit types need specific data that is unique to units as 843 ** opposed to buildings. This derived class elaborates these additional 844 ** data types. 845 */ 846 class UnitTypeClass : public TechnoTypeClass 847 { 848 public: 849 /* 850 ** If this unit can appear out of a crate, then this flag will be true. 851 */ 852 unsigned IsCrateGoodie:1; 853 854 /* 855 ** Can this unit squash infantry? If it can then if the player selects 856 ** an (enemy) infantry unit as the movement target, it will ride over and 857 ** squish the infantry unit. 858 */ 859 unsigned IsCrusher:1; 860 861 /* 862 ** Does this unit go into harvesting mode when it stops on a tiberium 863 ** field? Typically, only one unit does this and that is the harvester. 864 */ 865 unsigned IsToHarvest:1; 866 867 /* 868 ** Some units are equipped with a rotating radar dish. These units have special 869 ** animation processing. The rotating radar dish is similar to a turret, but 870 ** always rotates and does not affect combat. 871 */ 872 unsigned IsRadarEquipped:1; 873 874 /* 875 ** If this unit has a firing animation, this flag is true. Infantry and some special 876 ** vehicles are the ones with firing animations. 877 */ 878 unsigned IsFireAnim:1; 879 880 /* 881 ** Many vehicles have a turret with restricted motion. These vehicles must move the 882 ** turret into a locked down position while travelling. Rocket launchers and artillery 883 ** are good examples of this kind of unit. 884 */ 885 unsigned IsLockTurret:1; 886 887 /* 888 ** Is this unit of the humongous size? Harvesters and mobile construction vehicles are 889 ** of this size. If the vehicle is greater than 24 x 24 but less than 48 x 48, it is 890 ** considered "Gigundo". 891 */ 892 unsigned IsGigundo:1; 893 894 /* 895 ** Does this unit have a constant animation (like Visceroid?) 896 */ 897 unsigned IsAnimating:1; 898 899 /* 900 ** Does this unit have the ability to jam radar facilities? 901 */ 902 unsigned IsJammer:1; 903 904 /* 905 ** Is this unit a mobile gap generator? 906 */ 907 unsigned IsGapper:1; 908 909 /* 910 ** If this unit cannot fire while moving, then this flag will be 911 ** true. Such a unit must stop and stabilize for a bit before it 912 ** can fire. 913 */ 914 unsigned IsNoFireWhileMoving:1; 915 916 /* 917 ** This value represents the unit class. It can serve as a unique 918 ** identification number for this unit class. 919 */ 920 UnitType Type; 921 922 /* 923 ** This is the distance along the centerline heading in the direction the body 924 ** is facing used to reach the center point of the turret. This distance is 925 ** in leptons. 926 */ 927 signed char TurretOffset; 928 929 /* 930 ** This value is used to provide the unit with a default mission order when 931 ** first created. Usually, this is a resting or idle type of order. 932 */ 933 MissionType Mission; 934 935 /* 936 ** This is the default explosion to use when this vehicle is destroyed. 937 */ 938 AnimType Explosion; 939 940 /* 941 ** The width or height of the largest dimension for this unit. 942 */ 943 int MaxSize; 944 945 /* 946 ** This is the explicit unit class constructor. 947 */ 948 UnitTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {} 949 UnitTypeClass ( 950 UnitType type, 951 int name, 952 char const * ininame, 953 AnimType exp, 954 RemapType remap, 955 int verticaloffset, 956 int primaryoffset, 957 int primarylateral, 958 int secondaryoffset, 959 int secondarylateral, 960 bool is_goodie, 961 bool is_nominal, 962 bool is_crusher, 963 bool is_harvest, 964 bool is_stealthy, 965 bool is_insignificant, 966 bool is_turret_equipped, 967 bool is_radar_equipped, 968 bool is_fire_anim, 969 bool is_lock_turret, 970 bool is_gigundo, 971 bool is_animating, 972 bool is_jammer, 973 bool is_gapper, 974 int rotation, 975 int toffset, 976 MissionType order 977 ); 978 979 static void * operator new(size_t); 980 static void * operator new(size_t , void * ptr) {return(ptr);}; 981 static void operator delete(void * ptr); 982 983 static void Init_Heap(void); 984 static UnitType From_Name(char const * name); 985 static UnitTypeClass & As_Reference(UnitType type); 986 static void Init(TheaterType ) {}; 987 static void One_Time(void); 988 static void Prep_For_Add(void); 989 990 virtual bool Read_INI(CCINIClass & ini); 991 virtual void Dimensions(int &width, int &height) const; 992 virtual bool Create_And_Place(CELL cell, HousesType house) const; 993 virtual ObjectClass * Create_One_Of(HouseClass * house) const; 994 virtual int Max_Pips(void) const; 995 996 void Turret_Adjust(DirType dir, int & x, int & y) const; 997 998 #ifdef SCENARIO_EDITOR 999 virtual void Display(int x, int y, WindowNumberType window, HousesType house) const; 1000 #endif 1001 1002 /* 1003 ** The animation stage list for harvester dumping into the refinery. 1004 */ 1005 static const int Harvester_Dump_List[22]; 1006 1007 /* 1008 ** The animatino stage list for harvester loading up on ore. 1009 */ 1010 static const int Harvester_Load_List[9]; 1011 1012 /* 1013 ** The number of animation stages when the harvester is loading 1014 ** up on ore in the field. 1015 */ 1016 static const int Harvester_Load_Count; 1017 }; 1018 1019 1020 /*************************************************************************** 1021 ** This specifies the constant attribute data associated with naval 1022 ** vessels. 1023 */ 1024 class VesselTypeClass : public TechnoTypeClass 1025 { 1026 public: 1027 /* 1028 ** Does this unit have only 8 facings? Special test units have limited 1029 ** facings. 1030 */ 1031 unsigned IsPieceOfEight:1; 1032 1033 /* 1034 ** This value represents the unit class. It can serve as a unique 1035 ** identification number for this unit class. 1036 */ 1037 VesselType Type; 1038 1039 /* 1040 ** This is the distance along the centerline heading in the direction the body 1041 ** is facing used to reach the center point of the turret. This distance is 1042 ** in leptons. 1043 */ 1044 signed char TurretOffset; 1045 1046 /* 1047 ** This value is used to provide the unit with a default mission order when 1048 ** first created. Usually, this is a resting or idle type of order. 1049 */ 1050 MissionType Mission; 1051 1052 /* 1053 ** This is the default explosion to use when this vehicle is destroyed. 1054 */ 1055 AnimType Explosion; 1056 1057 /* 1058 ** The width or height of the largest dimension for this unit. 1059 */ 1060 int MaxSize; 1061 1062 /* 1063 ** This is the explicit unit class constructor. 1064 */ 1065 VesselTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {} 1066 VesselTypeClass ( 1067 VesselType type, 1068 int name, 1069 char const * ininame, 1070 AnimType exp, 1071 int verticaloffset, 1072 int primaryoffset, 1073 int primarylateral, 1074 int secondaryoffset, 1075 int secondarylateral, 1076 bool is_eight, 1077 bool is_nominal, 1078 bool is_turret_equipped, 1079 int rotation, 1080 int toffset 1081 ); 1082 1083 static void * operator new(size_t); 1084 static void * operator new(size_t , void * ptr) {return(ptr);}; 1085 static void operator delete(void * ptr); 1086 1087 static void Init_Heap(void); 1088 static VesselType From_Name(char const * name); 1089 static VesselTypeClass & As_Reference(VesselType type); 1090 static void Init(TheaterType ) {}; 1091 static void One_Time(void); 1092 static void Prep_For_Add(void); 1093 1094 virtual void Dimensions(int &width, int &height) const; 1095 virtual bool Create_And_Place(CELL cell, HousesType house) const; 1096 virtual ObjectClass * Create_One_Of(HouseClass * house) const; 1097 virtual int Max_Pips(void) const; 1098 virtual short const * Overlap_List(void) const; 1099 1100 void Turret_Adjust(DirType dir, int & x, int & y) const; 1101 1102 #ifdef SCENARIO_EDITOR 1103 virtual void Display(int x, int y, WindowNumberType window, HousesType house) const; 1104 #endif 1105 }; 1106 1107 1108 /*************************************************************************** 1109 ** The various unit types need specific data that is unique to units as 1110 ** opposed to buildings. This derived class elaborates these additional 1111 ** data types. 1112 */ 1113 class InfantryTypeClass : public TechnoTypeClass 1114 { 1115 public: 1116 1117 /* 1118 ** If this civilian infantry type is female, then this flag 1119 ** will be true. This information is used to get the correct 1120 ** voice response. 1121 */ 1122 unsigned IsFemale:1; 1123 1124 /* 1125 ** Does this infantry unit have crawling animation? If not, then this 1126 ** means that the "crawling" frames are actually running animation frames. 1127 */ 1128 unsigned IsCrawling:1; 1129 1130 /* 1131 ** For those infantry types that can capture buildings, this flag 1132 ** will be set to true. Typically, this is the engineer. 1133 */ 1134 unsigned IsCapture:1; 1135 1136 /* 1137 ** For infantry types that will run away from any damage causing 1138 ** events, this flag will be true. Typically, this is so for all 1139 ** civilians as well as the flame thrower guys. 1140 */ 1141 unsigned IsFraidyCat:1; 1142 1143 /* 1144 ** This flags whether this infantry is actually a civilian. A 1145 ** civilian uses different voice responses, has less ammunition, 1146 ** and runs from danger more often. 1147 */ 1148 unsigned IsCivilian:1; 1149 1150 /* 1151 ** If the infantry unit is equipped with C4 explosives, then this 1152 ** flag will be true. Such infantry can enter and destroy enemy 1153 ** buildings. 1154 */ 1155 unsigned IsBomber:1; 1156 1157 /* 1158 ** This flags whether this infantry is actually a dog. A dog 1159 ** uses different voice responses, has no ammo, and runs instead 1160 ** of walks to attack. 1161 */ 1162 unsigned IsDog:1; 1163 1164 /* 1165 ** This flag specifies whether this infantry type should use the 1166 ** override remap table, instead of the house remap table. This is 1167 ** used to turn the two civilian animations into a veritable smorgasbord 1168 ** of civilian types, for example. 1169 */ 1170 unsigned IsRemapOverride:1; 1171 1172 /* 1173 ** This value represents the unit class. It can serve as a unique 1174 ** identification number for this unit class. 1175 */ 1176 InfantryType Type; 1177 1178 /* 1179 ** When this infantry unit is loaded onto a transport, then this 1180 ** is the pip shape to use. Primarily, this is a color control. 1181 */ 1182 PipEnum Pip; 1183 1184 /* 1185 ** This is an array of the various animation frame data for the actions that 1186 ** the infantry may perform. 1187 */ 1188 DoInfoStruct const * DoControls; 1189 1190 /* 1191 ** Alternate animation info for the 'virtual' window which gets rendered on the GlyphX client. 1192 ** The infantry frames here map to the original TD infantry frames, so a different set is needed depending on whether 1193 ** we are rendering in legacy mode or on the GlyphX client. ST - 9/5/2019 12:17PM 1194 */ 1195 DoInfoStruct const * DoControlsVirtual; 1196 1197 /* 1198 ** There are certain units with special animation sequences built into the 1199 ** shape file. These values tell how many frames are used for the firing animation. 1200 */ 1201 char FireLaunch; 1202 char ProneLaunch; 1203 1204 /* 1205 ** This is a pointer to the special override remap table, which is 1206 ** used only in conjunction with the IsRemapOverride flag, and is 1207 ** primarily used for the civilians. 1208 */ 1209 unsigned char const * OverrideRemap; 1210 1211 /* 1212 ** This is the explicit unit class constructor. 1213 */ 1214 InfantryTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {} 1215 InfantryTypeClass ( 1216 InfantryType type, 1217 int name, 1218 char const * ininame, 1219 int verticaloffset, 1220 int primaryoffset, 1221 bool is_female, 1222 bool is_crawling, 1223 bool is_civilian, 1224 bool is_remap_override, 1225 bool is_nominal, 1226 bool is_theater, 1227 PipEnum pip, 1228 DoInfoStruct const * controls, 1229 DoInfoStruct const * virtual_controls, 1230 int firelaunch, 1231 int pronelaunch, 1232 unsigned char const * override_remap, 1233 int horizontaloffset=0); 1234 1235 static void * operator new(size_t); 1236 static void * operator new(size_t , void * ptr) {return(ptr);}; 1237 static void operator delete(void * ptr); 1238 1239 static void Init_Heap(void); 1240 static InfantryType From_Name(char const * name); 1241 static InfantryTypeClass & As_Reference(InfantryType type); 1242 static void Init(TheaterType ) {}; 1243 static void One_Time(void); 1244 static void Prep_For_Add(void); 1245 1246 virtual bool Read_INI(CCINIClass & ini); 1247 virtual void Dimensions(int & width, int & height) const; 1248 virtual bool Create_And_Place(CELL cell, HousesType house) const; 1249 virtual ObjectClass * Create_One_Of(HouseClass * house) const; 1250 virtual short const * Occupy_List(bool placement=false) const; 1251 virtual int Full_Name(void) const; 1252 1253 #ifdef SCENARIO_EDITOR 1254 virtual void Display(int x, int y, WindowNumberType window, HousesType house) const; 1255 #endif 1256 }; 1257 1258 1259 /**************************************************************************** 1260 ** The various aircraft types are controlled by object types of 1261 ** this class. 1262 */ 1263 class AircraftTypeClass : public TechnoTypeClass 1264 { 1265 public: 1266 1267 /* 1268 ** Fixed wing aircraft (ones that cannot hover) have this flag set to true. 1269 ** Such aircraft will not vary speed while it is flying. 1270 */ 1271 unsigned IsFixedWing:1; 1272 1273 /* 1274 ** Can this aircraft land? If it can land it is presumed to be controllable by the player. 1275 */ 1276 unsigned IsLandable:1; 1277 1278 /* 1279 ** Does this aircraft have a rotor blade (helicopter) type propulsion? 1280 */ 1281 unsigned IsRotorEquipped:1; // Is a rotor attached? 1282 1283 /* 1284 ** Is there a custom rotor animation stage set for each facing of the aircraft? 1285 */ 1286 unsigned IsRotorCustom:1; // Custom rotor sets for each facing? 1287 1288 /* 1289 ** This is the kind of aircraft identifier number. 1290 */ 1291 AircraftType Type; 1292 1293 /* 1294 ** This specifies the default mission order for this aircraft. Some aircraft default 1295 ** to guard mode (e.g., helicopters) while some default to attack mode (e.g., bombers). 1296 */ 1297 MissionType Mission; 1298 1299 /* 1300 ** This is the preferred landing building. The aircraft will try to land at the 1301 ** building of this type. 1302 */ 1303 StructType Building; 1304 1305 /* 1306 ** This is the final approach speed of this aircraft type for landing 1307 ** at an airfield. Most aircraft hit it at full speed, but the MIG is 1308 ** an example of a plane that needs a slower approach speed to hit the 1309 ** airfield. 1310 */ 1311 int LandingSpeed; 1312 1313 AircraftTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {} 1314 AircraftTypeClass( 1315 AircraftType airtype, 1316 int name, 1317 char const * ininame, 1318 int verticaloffset, 1319 int primaryoffset, 1320 int primarylateral, 1321 bool is_fixedwing, 1322 bool is_rotorequipped, 1323 bool is_rotorcustom, 1324 bool is_landable, 1325 bool is_stealthy, 1326 bool is_selectable, 1327 bool is_legal_target, 1328 bool is_insignificant, 1329 bool is_immune, 1330 StructType building, 1331 int landingspeed, 1332 int rotation, 1333 MissionType deforder); 1334 1335 static void * operator new(size_t); 1336 static void * operator new(size_t , void * ptr) {return(ptr);}; 1337 static void operator delete(void * ptr); 1338 1339 static void Init_Heap(void); 1340 static AircraftType From_Name(char const * name); 1341 static AircraftTypeClass & As_Reference(AircraftType a); 1342 static void Init(TheaterType ) {}; 1343 static void One_Time(void); 1344 static void Prep_For_Add(void); 1345 1346 virtual void Dimensions(int &width, int &height) const; 1347 virtual bool Create_And_Place(CELL, HousesType) const; 1348 virtual ObjectClass * Create_One_Of(HouseClass * house) const; 1349 virtual short const * Occupy_List(bool placement=false) const; 1350 virtual short const * Overlap_List(void) const; 1351 virtual int Max_Pips(void) const; 1352 1353 #ifdef SCENARIO_EDITOR 1354 virtual void Display(int x, int y, WindowNumberType window, HousesType house) const; 1355 #endif 1356 1357 static void const * LRotorData; 1358 static void const * RRotorData; 1359 }; 1360 1361 1362 /*************************************************************************** 1363 ** Bullets and other projectiles need some specific information according 1364 ** to their type. 1365 */ 1366 class BulletTypeClass : public ObjectTypeClass 1367 { 1368 public: 1369 1370 /* 1371 ** Does this bullet type fly over walls? 1372 */ 1373 unsigned IsHigh:1; 1374 1375 /* 1376 ** Does this bullet need a shadow drawn under it? Shadowed bullets 1377 ** use the Height value to offset their Y position. 1378 */ 1379 unsigned IsShadow:1; 1380 1381 /* 1382 ** If this projectile is one that ballistically arcs from ground level, up into the air and 1383 ** then back to the ground, where it explodes. Typical uses of this are for grenades and 1384 ** artillery shells. 1385 */ 1386 unsigned IsArcing:1; 1387 1388 /* 1389 ** Certain projectiles do not travel horizontally, but rather, vertically -- they drop 1390 ** from a height. Bombs fall into this category and will have this value set to 1391 ** true. Dropping projectiles do not calculate collision with terrain (such as walls). 1392 */ 1393 unsigned IsDropping:1; 1394 1395 /* 1396 ** Is this projectile invisible? Some bullets and weapon effects are not directly 1397 ** rendered. Small caliber bullets and flame thrower flames are treated like 1398 ** normal projectiles for damage purposes, but are displayed using custom 1399 ** rules. 1400 */ 1401 unsigned IsInvisible:1; 1402 1403 /* 1404 ** Does this bullet explode when near the target? Some bullets only explode if 1405 ** it actually hits the target. Some explode even if nearby. 1406 */ 1407 unsigned IsProximityArmed:1; 1408 1409 /* 1410 ** Does this projectile spew puffs of smoke out its tail while it 1411 ** travels? Missiles are prime examples of this projectile type. 1412 */ 1413 unsigned IsFlameEquipped:1; 1414 1415 /* 1416 ** Should fuel consumption be tracked for this projectile? Rockets are the primary 1417 ** projectile with this characteristic, but even for bullets it should be checked so that 1418 ** bullets don't travel too far. 1419 */ 1420 unsigned IsFueled:1; 1421 1422 /* 1423 ** Is this projectile without different facing visuals? Most plain bullets do not change 1424 ** visual imagery if their facing changes. Rockets, on the other hand, are equipped with 1425 ** the full 32 facing imagery. 1426 */ 1427 unsigned IsFaceless:1; 1428 1429 /* 1430 ** If this is a typically inaccurate projectile, then this flag will be true. Artillery 1431 ** is a prime example of this type. 1432 */ 1433 unsigned IsInaccurate:1; 1434 1435 /* 1436 ** If the bullet contains translucent pixels, then this flag will be true. These 1437 ** translucent pixels really are "shadow" pixels in the same style as the shadow 1438 ** cast by regular ground units. 1439 */ 1440 unsigned IsTranslucent:1; 1441 1442 /* 1443 ** If this bullet can be fired on aircraft, then this flag will be true. 1444 */ 1445 unsigned IsAntiAircraft:1; 1446 1447 /* 1448 ** If this bullet can fire upon ground targets, then this flag will be true. 1449 */ 1450 unsigned IsAntiGround:1; 1451 1452 /* 1453 ** If this bullet can be fired upon submarines (that are submerged), then 1454 ** this flag will be true. 1455 */ 1456 unsigned IsAntiSub:1; 1457 1458 /* 1459 ** If this bullet should lose strength as it travels toward the target, then 1460 ** this flag will be true. 1461 */ 1462 unsigned IsDegenerate:1; 1463 1464 /* 1465 ** Does this projectile travel under the water? If so, then its imagery will be modified 1466 ** to look like it is doing so. 1467 */ 1468 unsigned IsSubSurface:1; 1469 1470 /* 1471 ** If this projectile is equipped with a parachute, then this flag will be set. Parachute 1472 ** bombs are usually the only one with this flag set. 1473 */ 1474 unsigned IsParachuted:1; 1475 1476 /* 1477 ** Is this unit of the humongous size? Certain very large projectiles have 1478 ** this flag set. Typically, they require a special offset list so that the cells 1479 ** they overlap will be properly redrawn. 1480 */ 1481 unsigned IsGigundo:1; 1482 1483 /* 1484 ** This element is a unique identification number for the bullet 1485 ** type. 1486 */ 1487 BulletType Type; 1488 1489 /* 1490 ** This is the rotation speed of the bullet. It only has practical value 1491 ** for those projectiles that performing homing action during flight -- such 1492 ** as with rockets. If the ROT is zero, then no homing is performed. Otherwise 1493 ** the projectile is considered to be a homing type. 1494 */ 1495 unsigned char ROT; 1496 1497 /* 1498 ** Some projectiles have a built in arming distance that must elapse before the 1499 ** projectile may explode. If this value is non-zero, then this override is 1500 ** applied. 1501 */ 1502 int Arming; 1503 1504 /* 1505 ** If this bullet is of the tumbling type, then this is the modulo to factor 1506 ** into the game frame when determining what shape number to use for the 1507 ** imagery. 1508 */ 1509 int Tumble; 1510 1511 //--------------------------------------------------------------------- 1512 BulletTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {} 1513 BulletTypeClass(char const * name); 1514 1515 static void * operator new(size_t); 1516 static void * operator new(size_t , void * ptr) {return(ptr);}; 1517 static void operator delete(void * ptr); 1518 1519 static void Init_Heap(void); 1520 static BulletTypeClass & As_Reference(BulletType type); 1521 static void Init(TheaterType ) {}; 1522 static void One_Time(void); 1523 1524 virtual bool Read_INI(CCINIClass & ini); 1525 virtual bool Create_And_Place(CELL , HousesType =HOUSE_NONE) const {return false;}; 1526 virtual ObjectClass * Create_One_Of(HouseClass *) const {return 0;}; 1527 }; 1528 1529 1530 /**************************************************************************** 1531 ** These are the different TYPES of terrain objects. Every terrain object must 1532 ** be one of these types. 1533 */ 1534 class TerrainTypeClass : public ObjectTypeClass 1535 { 1536 public: 1537 /* 1538 ** Which terrain object does this class type represent. 1539 */ 1540 TerrainType Type; 1541 1542 /* 1543 ** This is the coordinate offset (from upper left) of where the center base 1544 ** position of the terrain object lies. For trees, this would be the base of 1545 ** the trunk. This is used for sorting purposes. 1546 */ 1547 COORDINATE CenterBase; 1548 1549 /* 1550 ** This is the bitfield control that tells which theater this terrain object is 1551 ** valid for. If the bit (1 << TheaterType) is true, then this terrain object 1552 ** is allowed. 1553 */ 1554 int Theater; 1555 1556 /* 1557 ** Does this terrain object get placed on the water instead of the ground? 1558 */ 1559 unsigned IsWaterBased:1; 1560 1561 //---------------------------------------------------------------- 1562 TerrainTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {} 1563 TerrainTypeClass( 1564 TerrainType terrain, 1565 int theater, 1566 COORDINATE centerbase, 1567 bool is_immune, 1568 bool is_water, 1569 char const * ininame, 1570 int fullname, 1571 short const * occupy, 1572 short const * overlap); 1573 1574 static void * operator new(size_t); 1575 static void * operator new(size_t , void * ptr) {return(ptr);}; 1576 static void operator delete(void * ptr); 1577 1578 static void Init_Heap(void); 1579 static TerrainType From_Name(char const * name); 1580 static TerrainTypeClass & As_Reference(TerrainType type); 1581 static void Init(TheaterType theater = THEATER_TEMPERATE); 1582 static void One_Time(void); 1583 static void Prep_For_Add(void); 1584 1585 virtual COORDINATE Coord_Fixup(COORDINATE coord) const; 1586 virtual bool Create_And_Place(CELL cell, HousesType house) const; 1587 virtual ObjectClass * Create_One_Of(HouseClass *) const; 1588 virtual short const * Occupy_List(bool placement=false) const; 1589 virtual short const * Overlap_List(void) const; 1590 1591 #ifdef SCENARIO_EDITOR 1592 virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const; 1593 #endif 1594 1595 private: 1596 short const * Occupy; 1597 short const * Overlap; 1598 }; 1599 1600 1601 /**************************************************************************** 1602 ** The tile type objects are controlled by this class. It specifies the form 1603 ** of the tile set for the specified object as well as other related datum. 1604 ** It is derived from the ObjectTypeClass solely for the purpose of scenario 1605 ** editing and creation. 1606 */ 1607 class TemplateTypeClass: public ObjectTypeClass 1608 { 1609 public: 1610 /* 1611 ** What template is this. 1612 */ 1613 TemplateType Type; 1614 1615 /* 1616 ** A bitfield container that indicates which theaters this template is allowed 1617 ** in. A bit set in the (1<<TheaterType) position indicates the template is legal 1618 ** in that particular theater. 1619 */ 1620 unsigned char Theater; 1621 1622 /* 1623 ** Raw dimensions of this template (in icons). 1624 */ 1625 unsigned char Width,Height; 1626 1627 //---------------------------------------------------------- 1628 TemplateTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}; 1629 TemplateTypeClass( 1630 TemplateType iconset, 1631 int theater, 1632 char const * ininame, 1633 int fullname); 1634 1635 static void * operator new(size_t); 1636 static void * operator new(size_t , void * ptr) {return(ptr);}; 1637 static void operator delete(void * ptr); 1638 1639 static void Init_Heap(void); 1640 static TemplateType From_Name(char const * name); 1641 static TemplateTypeClass & As_Reference(TemplateType type); 1642 static void Init(TheaterType theater); 1643 static void One_Time(void); 1644 static void Prep_For_Add(void); 1645 1646 virtual COORDINATE Coord_Fixup(COORDINATE coord) const; 1647 virtual bool Create_And_Place(CELL cell, HousesType house=HOUSE_NONE) const; 1648 virtual ObjectClass * Create_One_Of(HouseClass *) const; 1649 virtual short const * Occupy_List(bool placement=false) const; 1650 LandType Land_Type(int icon) const; 1651 1652 #ifdef SCENARIO_EDITOR 1653 virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const; 1654 #endif 1655 }; 1656 1657 1658 /**************************************************************************** 1659 ** All the animation objects are controlled by this class. It holds the static 1660 ** data associated with each animation type. 1661 */ 1662 class AnimTypeClass : public ObjectTypeClass 1663 { 1664 public: 1665 1666 /* 1667 ** If this animation should run at a constant apparent rate regardless 1668 ** of game speed setting, then this flag will be set to true. 1669 */ 1670 unsigned IsNormalized:1; 1671 1672 /* 1673 ** If this animation should be rendered and sorted with the other ground 1674 ** units, then this flag is true. Typical of this would be fire and other 1675 ** low altitude animation effects. 1676 */ 1677 unsigned IsGroundLayer:1; 1678 1679 /* 1680 ** If this animation should be rendered in a translucent fashion, this flag 1681 ** will be true. Translucent colors are some of the reds and some of the 1682 ** greys. Typically, smoke and some fire effects have this flag set. 1683 */ 1684 unsigned IsTranslucent:1; 1685 1686 /* 1687 ** If this animation uses the white translucent table, then this flag 1688 ** will be true. 1689 */ 1690 unsigned IsWhiteTrans:1; 1691 1692 /* 1693 ** If this is the special flame thrower animation, then custom affects 1694 ** occur as it is playing. Specifically, scorch marks and little fire 1695 ** pieces appear as the flame jets forth. 1696 */ 1697 unsigned IsFlameThrower:1; 1698 1699 /* 1700 ** Some animations leave a scorch mark behind. Napalm and other flame 1701 ** type explosions are typical of this type. 1702 */ 1703 unsigned IsScorcher:1; 1704 1705 /* 1706 ** Some explosions are of such violence that they leave craters behind. 1707 ** This flag will be true for those types. 1708 */ 1709 unsigned IsCraterForming:1; 1710 1711 /* 1712 ** If this animation should attach itself to any unit that is in the same 1713 ** location as itself, then this flag will be true. Most vehicle impact 1714 ** explosions are of this type. 1715 */ 1716 unsigned IsSticky:1; 1717 1718 /* 1719 ** If this animation is theater specific, then this flag will be 1720 ** set to true. Most animations are not theater specific. 1721 */ 1722 unsigned IsTheater:1; 1723 1724 /* 1725 ** This is the type number for this animation kind. It can be used as 1726 ** a unique identifier for animation types. 1727 */ 1728 AnimType Type; 1729 1730 /* 1731 ** This specified the maximum dimension of the shape (edge to edge). This dimension 1732 ** is used to build the appropriate cell refresh list. Keep this value as small 1733 ** as possible to ensure maximum performance. This is especially critical, since 1734 ** animations always cause the cells under them to be redrawn every frame. 1735 */ 1736 int Size; 1737 1738 /* 1739 ** This is the frame that the animation is biggest. The biggest frame of animation 1740 ** will hide any changes to underlying ground (e.g., craters) that the animation 1741 ** causes, so these effects are delayed until this frame is reached. The end result 1742 ** is to prevent the player from seeing craters "pop" into existence. 1743 */ 1744 int Biggest; 1745 1746 /* 1747 ** Some animations (when attached to another object) damage the object it 1748 ** is in contact with. Fire is a good example of this. This value is a 1749 ** fixed point number of the damage that is applied to the attached object 1750 ** every game tick. The damage is expressed as damage points per game frame. 1751 ** Because it is a fixed point fraction, the damage can be very slight. 1752 */ 1753 fixed Damage; 1754 1755 /* 1756 ** Simple animation delay value between advancing of frames. This can 1757 ** be overridden by the control list. 1758 */ 1759 int Delay; 1760 1761 /* 1762 ** The starting frame number for each animation sequence. Usually this is 1763 ** zero, but can sometimes be different if this animation is a sub sequence 1764 ** of a larger animation file. 1765 */ 1766 int Start; 1767 1768 /* 1769 ** Looping animations might start at a different frame than the initial one. 1770 ** This is true for smoke effects that have a startup sequence followed by a 1771 ** continuous looping sequence. 1772 */ 1773 int LoopStart; 1774 1775 /* 1776 ** For looping animations, this is the frame that will end all the middle loops 1777 ** of the animation. The last loop of the animation will proceed until the Stages 1778 ** has been fully completed. 1779 */ 1780 int LoopEnd; 1781 1782 /* 1783 ** The number of stages that this animation sequence will progress through 1784 ** before it loops or ends. 1785 */ 1786 int Stages; 1787 1788 /* 1789 ** This is the normal loop count for this animation. Usually this is one, but 1790 ** for some animations, it may be larger. 1791 */ 1792 int Loops; 1793 1794 /* 1795 ** This is the sound effect to play when this animation starts. Usually, this 1796 ** applies to explosion animations. 1797 */ 1798 VocType Sound; 1799 1800 /* 1801 ** If the animation is to launch into another animation, then 1802 ** the secondary animation will be defined here. 1803 */ 1804 AnimType ChainTo; 1805 1806 /* 1807 ** The number of virtual animation stages. Keeps the animation alive longer for the purpose 1808 ** of 4K rendering, but is ignored by legacy rendering. 1809 */ 1810 int VirtualStages; 1811 1812 /* 1813 ** The scale of the virtual animation. Allows for higher-resolution art to appear larger. 1814 */ 1815 int VirtualScale; 1816 1817 /* 1818 ** The shape name to used for 4K virtual rendering, overrides the INI name 1819 */ 1820 char const * VirtualName; 1821 1822 /* 1823 ** Animation data to use specifically for virtual rendering (implies this animation only for legacy). 1824 */ 1825 AnimType VirtualAnim; 1826 1827 //--------------------------------------------------------------------------- 1828 AnimTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {} 1829 AnimTypeClass(AnimType anim, 1830 char const * name, 1831 int size, 1832 int biggest, 1833 bool istheater, 1834 bool isnormal, 1835 bool iswhite, 1836 bool isscorcher, 1837 bool iscrater, 1838 bool issticky, 1839 bool ground, 1840 bool istrans, 1841 bool isflame, 1842 fixed damage, 1843 int delaytime, 1844 int start, 1845 int loopstart, 1846 int loopend, 1847 int stages, 1848 int loops, 1849 VocType sound, 1850 AnimType chainto, 1851 int virtualstages=-1, 1852 int virtualscale=0x100, 1853 char const * virtualname=NULL, 1854 AnimType virtualanim=ANIM_NONE); 1855 1856 static void Init_Heap(void); 1857 static void * operator new(size_t); 1858 static void * operator new(size_t , void * ptr) {return(ptr);}; 1859 static void operator delete(void * ptr); 1860 1861 static AnimTypeClass & As_Reference(AnimType type); 1862 static void Init(TheaterType theater); 1863 static void One_Time(void); 1864 1865 virtual bool Create_And_Place(CELL , HousesType =HOUSE_NONE) const {return false;}; 1866 virtual ObjectClass * Create_One_Of(HouseClass *) const {return 0;}; 1867 }; 1868 1869 1870 /**************************************************************************** 1871 ** This controls the overlay object types. These object types include walls 1872 ** and concrete. They are always considered to be one icon in size and 1873 ** are processed on an icon by icon basis. This is different from normal 1874 ** templates which can be an arbitrary size. Other than this they are 1875 ** mostly similar to normal templates but with some characteristics of 1876 ** structures (they can be destroyed). 1877 */ 1878 class OverlayTypeClass: public ObjectTypeClass 1879 { 1880 public: 1881 /* 1882 ** What overlay is this. 1883 */ 1884 OverlayType Type; 1885 1886 /* 1887 ** What type of ground does this make the cell it occupies? 1888 */ 1889 LandType Land; 1890 1891 /* 1892 ** If this overlay is a wall, how many stages of destruction are there 1893 ** for this wall type? i.e. sandbags = 2, concrete = 4, etc. 1894 */ 1895 int DamageLevels; 1896 1897 /* 1898 ** If this overlay is a wall, what amount of damage is necessary 1899 ** before the wall takes damage? 1900 */ 1901 int DamagePoints; 1902 1903 /* 1904 ** Is this overlay graphic theater specific. This means that if there is 1905 ** custom art for this overlay that varies between different theaters, then 1906 ** this flag will be true. 1907 */ 1908 unsigned IsTheater:1; 1909 1910 /* 1911 ** Is this a wall type overlay? Wall types change their shape 1912 ** depending on the existence of adjacent walls of the same type. 1913 */ 1914 unsigned IsWall:1; 1915 1916 /* 1917 ** If this overlay is actually a wall and this wall type is tall enough that 1918 ** normal ground based straight line weapons will be blocked by it, then this 1919 ** flag will be true. Brick fences are typical of this type. 1920 */ 1921 unsigned IsHigh:1; 1922 1923 /* 1924 ** If this overlay represents harvestable tiberium, then this flag 1925 ** will be true. 1926 */ 1927 unsigned IsTiberium:1; 1928 1929 /* 1930 ** If this is a wall that is made of wood, then this flag will be 1931 ** true. Such walls are affected by fire damage. 1932 */ 1933 unsigned IsWooden:1; 1934 1935 /* 1936 ** Is this a crate? If it is, then goodies may come out of it. 1937 */ 1938 unsigned IsCrate:1; 1939 1940 /* 1941 ** If this is true, then the overlay will not show up on the radar map. 1942 */ 1943 unsigned IsRadarVisible:1; 1944 1945 //---------------------------------------------------------- 1946 OverlayTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {} 1947 OverlayTypeClass( 1948 OverlayType iconset, 1949 char const * ininame, 1950 int fullname, 1951 LandType ground, 1952 int damagelevels, 1953 int damagepoints, 1954 bool isradarinvisible, 1955 bool iswooden, 1956 bool istarget, 1957 bool iscrushable, 1958 bool istiberium, 1959 bool high, 1960 bool theater, 1961 bool iswall, 1962 bool iscrate); 1963 1964 static void * operator new(size_t); 1965 static void * operator new(size_t , void * ptr) {return(ptr);}; 1966 static void operator delete(void * ptr); 1967 1968 static void Init_Heap(void); 1969 static OverlayType From_Name(char const * name); 1970 static OverlayTypeClass & As_Reference(OverlayType type); 1971 static void Init(TheaterType); 1972 static void One_Time(void); 1973 static void Prep_For_Add(void); 1974 1975 virtual COORDINATE Coord_Fixup(COORDINATE coord) const; 1976 virtual bool Create_And_Place(CELL cell, HousesType house=HOUSE_NONE) const; 1977 virtual ObjectClass * Create_One_Of(HouseClass *) const; 1978 virtual short const * Occupy_List(bool placement=false) const; 1979 virtual void Draw_It(int x, int y, int data) const; 1980 virtual unsigned char * Radar_Icon(int data) const; 1981 1982 #ifdef SCENARIO_EDITOR 1983 virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const; 1984 #endif 1985 }; 1986 1987 1988 /**************************************************************************** 1989 ** This type elaborates the various "smudge" effects that can occur. Smudges are 1990 ** those elements which are on top off all the ground icons, but below anything 1991 ** that is "above" it. This includes scorch marks, craters, and infantry bodies. 1992 ** Smudges, be definition, contain transparency. The are modifiers to underlying 1993 ** terrain imagery. 1994 */ 1995 class SmudgeTypeClass : public ObjectTypeClass 1996 { 1997 public: 1998 /* 1999 ** What overlay is this. 2000 */ 2001 SmudgeType Type; 2002 2003 /* 2004 ** Some smudges are larger than one cell. If this is the case, then 2005 ** these dimensions specify the number of cells wide and tall the 2006 ** smudge is. 2007 */ 2008 int Width; 2009 int Height; 2010 2011 /* 2012 ** Is this smudge a crater type? If so, then a second crater can be added to 2013 ** this smudge so that a more cratered landscape results. 2014 */ 2015 unsigned IsCrater:1; 2016 2017 /* 2018 ** Is this overlay used as the attached road piece for buildings (bib)? 2019 */ 2020 unsigned IsBib:1; 2021 2022 //---------------------------------------------------------- 2023 SmudgeTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {} 2024 SmudgeTypeClass( 2025 SmudgeType smudge, 2026 char const * ininame, 2027 int fullname, 2028 int width, 2029 int height, 2030 bool isbib, 2031 bool iscrater 2032 ); 2033 2034 static void * operator new(size_t); 2035 static void * operator new(size_t , void * ptr) {return(ptr);}; 2036 static void operator delete(void * ptr); 2037 2038 static void Init_Heap(void); 2039 static SmudgeType From_Name(char const * name); 2040 static SmudgeTypeClass & As_Reference(SmudgeType type); 2041 static void Init(TheaterType); 2042 static void One_Time(void); 2043 static void Prep_For_Add(void); 2044 2045 virtual bool Create_And_Place(CELL cell, HousesType house=HOUSE_NONE) const; 2046 virtual ObjectClass * Create_One_Of(HouseClass *) const; 2047 virtual short const * Occupy_List(bool placement=false) const; 2048 virtual short const * Overlap_List(void) const {return Occupy_List();}; 2049 virtual void Draw_It(int x, int y, int data) const ; 2050 2051 #ifdef SCENARIO_EDITOR 2052 virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const; 2053 #endif 2054 }; 2055 2056 #endif 2057