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