UDATA.CPP (69509B)
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/UDATA.CPP 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 : UDATA.CPP * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : September 10, 1993 * 28 * * 29 * Last Update : July 19, 1996 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * UnitTypeClass::As_Reference -- Fetches a reference to the unit type class specified. * 34 * UnitTypeClass::Create_And_Place -- Creates and places a unit object onto the map. * 35 * UnitTypeClass::Create_One_Of -- Creates a unit in limbo. * 36 * UnitTypeClass::Dimensions -- Determines the unit's pixel dimensions. * 37 * UnitTypeClass::Display -- Displays a generic unit shape. * 38 * UnitTypeClass::From_Name -- Fetch class pointer from specified name. * 39 * UnitTypeClass::Init_Heap -- Initialize the unit type class heap. * 40 * UnitTypeClass::Max_Pips -- Fetches the maximum pips allowed for this unit. * 41 * UnitTypeClass::One_Time -- Performs one time processing for unit type class objects. * 42 * UnitTypeClass::Prep_For_Add -- Prepares scenario editor to add unit. * 43 * UnitTypeClass::Read_INI -- Fetch the unit type data from the INI database. * 44 * UnitTypeClass::Turret_Adjust -- Turret adjustment routine for MLRS and MSAM units. * 45 * UnitTypeClass::UnitTypeClass -- Constructor for unit types. * 46 * UnitTypeClass::operator delete -- Return a unit type class object back to the pool. * 47 * UnitTypeClass::operator new -- Allocates an object from the unit type class heap. * 48 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 49 50 #include "function.h" 51 52 /* 53 ** This is the list of animation stages to use when the harvester 54 ** is to dump its load into the refinery. The offsets are based from the 55 ** start of the dump animation. 56 */ 57 const int UnitTypeClass::Harvester_Dump_List[22] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,6,5,4,3,2,1,0}; 58 const int UnitTypeClass::Harvester_Load_List[9] = {0, 1, 2, 3, 4, 5, 6, 7, 0}; 59 const int UnitTypeClass::Harvester_Load_Count = 8; 60 61 62 // V2 rocket launcher 63 static UnitTypeClass const UnitV2Launcher( 64 UNIT_V2_LAUNCHER, 65 TXT_V2_LAUNCHER, // NAME: Text name of this unit type. 66 "V2RL", // NAME: Text name of this unit type. 67 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 68 REMAP_NORMAL, // Sidebar remap logic. 69 0x0000, // Vertical offset. 70 0x0000, // Primary weapon offset along turret centerline. 71 0x0000, // Primary weapon lateral offset along turret centerline. 72 0x0000, // Secondary weapon offset along turret centerline. 73 0x0000, // Secondary weapon lateral offset along turret centerling. 74 true, // Can this be a goodie surprise from a crate? 75 false, // Always use the given name for the vehicle? 76 true, // Can this unit squash infantry? 77 false, // Does this unit harvest Tiberium? 78 false, // Is invisible to radar? 79 false, // Is it insignificant (won't be announced)? 80 false, // Is it equipped with a combat turret? 81 false, // Does it have a rotating radar dish? 82 false, // Is there an associated firing animation? 83 false, // Must the turret be in a locked down position while moving? 84 true, // Is this a gigundo-rotund-enormous unit? 85 false, // Does the unit have a constant animation? 86 false, // Is the unit capable of jamming radar? 87 false, // Is the unit a mobile gap generator? 88 32, // Rotation stages. 89 0, // Turret center offset along body centerline. 90 MISSION_HUNT // ORDERS: Default order to give new unit. 91 ); 92 93 // Light tank 94 static UnitTypeClass const UnitLTank( 95 UNIT_LTANK, 96 TXT_LTANK, // NAME: Text name of this unit type. 97 "1TNK", // NAME: Text name of this unit type. 98 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 99 REMAP_NORMAL, // Sidebar remap logic. 100 0x0020, // Vertical offset. 101 0x00C0, // Primary weapon offset along turret centerline. 102 0x0000, // Primary weapon lateral offset along turret centerline. 103 0x0000, // Secondary weapon offset along turret centerline. 104 0x0000, // Secondary weapon lateral offset along turret centerling. 105 true, // Can this be a goodie surprise from a crate? 106 false, // Always use the given name for the vehicle? 107 true, // Can this unit squash infantry? 108 false, // Does this unit harvest Tiberium? 109 false, // Is invisible to radar? 110 false, // Is it insignificant (won't be announced)? 111 true, // Is it equipped with a combat turret? 112 false, // Does it have a rotating radar dish? 113 false, // Is there an associated firing animation? 114 false, // Must the turret be in a locked down position while moving? 115 false, // Is this a gigundo-rotund-enormous unit? 116 false, // Does the unit have a constant animation? 117 false, // Is the unit capable of jamming radar? 118 false, // Is the unit a mobile gap generator? 119 32, // Rotation stages. 120 0, // Turret center offset along body centerline. 121 MISSION_HUNT // ORDERS: Default order to give new unit. 122 ); 123 124 // Heavy tank 125 static UnitTypeClass const UnitMTank( 126 UNIT_MTANK, 127 TXT_MTANK, // NAME: Text name of this unit type. 128 "3TNK", // NAME: Text name of this unit type. 129 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 130 REMAP_NORMAL, // Sidebar remap logic. 131 0x0040, // Vertical offset. 132 0x0080, // Primary weapon offset along turret centerline. 133 0x0018, // Primary weapon lateral offset along turret centerline. 134 0x0080, // Secondary weapon offset along turret centerline. 135 0x0018, // Secondary weapon lateral offset along turret centerling. 136 true, // Can this be a goodie surprise from a crate? 137 false, // Always use the given name for the vehicle? 138 true, // Can this unit squash infantry? 139 false, // Does this unit harvest Tiberium? 140 false, // Is invisible to radar? 141 false, // Is it insignificant (won't be announced)? 142 true, // Is it equipped with a combat turret? 143 false, // Does it have a rotating radar dish? 144 false, // Is there an associated firing animation? 145 false, // Must the turret be in a locked down position while moving? 146 true, // Is this a gigundo-rotund-enormous unit? 147 false, // Does the unit have a constant animation? 148 false, // Is the unit capable of jamming radar? 149 false, // Is the unit a mobile gap generator? 150 32, // Rotation stages. 151 0, // Turret center offset along body centerline. 152 MISSION_HUNT // ORDERS: Default order to give new unit. 153 ); 154 155 // Medium tank 156 static UnitTypeClass const UnitMTank2( 157 UNIT_MTANK2, 158 TXT_MTANK2, // NAME: Text name of this unit type. 159 "2TNK", // NAME: Text name of this unit type. 160 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 161 REMAP_NORMAL, // Sidebar remap logic. 162 0x0030, // Vertical offset. 163 0x00C0, // Primary weapon offset along turret centerline. 164 0x0000, // Primary weapon lateral offset along turret centerline. 165 0x00C0, // Secondary weapon offset along turret centerline. 166 0x0000, // Secondary weapon lateral offset along turret centerling. 167 true, // Can this be a goodie surprise from a crate? 168 false, // Always use the given name for the vehicle? 169 true, // Can this unit squash infantry? 170 false, // Does this unit harvest Tiberium? 171 false, // Is invisible to radar? 172 false, // Is it insignificant (won't be announced)? 173 true, // Is it equipped with a combat turret? 174 false, // Does it have a rotating radar dish? 175 false, // Is there an associated firing animation? 176 false, // Must the turret be in a locked down position while moving? 177 true, // Is this a gigundo-rotund-enormous unit? 178 false, // Does the unit have a constant animation? 179 false, // Is the unit capable of jamming radar? 180 false, // Is the unit a mobile gap generator? 181 32, // Rotation stages. 182 0, // Turret center offset along body centerline. 183 MISSION_HUNT // ORDERS: Default order to give new unit. 184 ); 185 186 // Mastadon tank 187 static UnitTypeClass const UnitHTank( 188 UNIT_HTANK, 189 TXT_HTANK, // NAME: Text name of this unit type. 190 "4TNK", // NAME: Text name of this unit type. 191 ANIM_ART_EXP1, // EXPLOSION: Type of explosion when destroyed. 192 REMAP_NORMAL, // Sidebar remap logic. 193 0x0020, // Vertical offset. 194 0x00C0, // Primary weapon offset along turret centerline. 195 0x0028, // Primary weapon lateral offset along turret centerline. 196 0x0008, // Secondary weapon offset along turret centerline. 197 0x0040, // Secondary weapon lateral offset along turret centerling. 198 true, // Can this be a goodie surprise from a crate? 199 false, // Always use the given name for the vehicle? 200 true, // Can this unit squash infantry? 201 false, // Does this unit harvest Tiberium? 202 false, // Is invisible to radar? 203 false, // Is it insignificant (won't be announced)? 204 true, // Is it equipped with a combat turret? 205 false, // Does it have a rotating radar dish? 206 false, // Is there an associated firing animation? 207 false, // Must the turret be in a locked down position while moving? 208 true, // Is this a gigundo-rotund-enormous unit? 209 false, // Does the unit have a constant animation? 210 false, // Is the unit capable of jamming radar? 211 false, // Is the unit a mobile gap generator? 212 32, // Rotation stages. 213 0, // Turret center offset along body centerline. 214 MISSION_HUNT // ORDERS: Default order to give new unit. 215 ); 216 217 // Mobile Radar Jammer 218 static UnitTypeClass const UnitMRJammer( 219 UNIT_MRJ, 220 TXT_MRJ, // NAME: Text name of this unit type. 221 "MRJ", // NAME: Text name of this unit type. 222 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 223 REMAP_NORMAL, // Sidebar remap logic. 224 0x0000, // Vertical offset. 225 0x0000, // Primary weapon offset along turret centerline. 226 0x0000, // Primary weapon lateral offset along turret centerline. 227 0x0000, // Secondary weapon offset along turret centerline. 228 0x0000, // Secondary weapon lateral offset along turret centerling. 229 false, // Can this be a goodie surprise from a crate? 230 false, // Always use the given name for the vehicle? 231 true, // Can this unit squash infantry? 232 false, // Does this unit harvest Tiberium? 233 true, // Is invisible to radar? 234 false, // Is it insignificant (won't be announced)? 235 false, // Is it equipped with a combat turret? 236 true, // Does it have a rotating radar dish? 237 false, // Is there an associated firing animation? 238 false, // Must the turret be in a locked down position while moving? 239 false, // Is this a gigundo-rotund-enormous unit? 240 false, // Does the unit have a constant animation? 241 true, // Is the unit capable of jamming radar? 242 false, // Is the unit a mobile gap generator? 243 32, // Rotation stages. 244 0, // Turret center offset along body centerline. 245 MISSION_HUNT // ORDERS: Default order to give new unit. 246 ); 247 248 // Mobile Gap Generator 249 static UnitTypeClass const UnitMGG( 250 UNIT_MGG, 251 TXT_MGG, // NAME: Text name of this unit type. 252 "MGG", // NAME: Text name of this unit type. 253 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 254 REMAP_NORMAL, // Sidebar remap logic. 255 0x0000, // Vertical offset. 256 0x0000, // Primary weapon offset along turret centerline. 257 0x0000, // Primary weapon lateral offset along turret centerline. 258 0x0000, // Secondary weapon offset along turret centerline. 259 0x0000, // Secondary weapon lateral offset along turret centerling. 260 false, // Can this be a goodie surprise from a crate? 261 false, // Always use the given name for the vehicle? 262 true, // Can this unit squash infantry? 263 false, // Does this unit harvest Tiberium? 264 false, // Is invisible to radar? 265 false, // Is it insignificant (won't be announced)? 266 false, // Is it equipped with a combat turret? 267 true, // Does it have a rotating radar dish? 268 false, // Is there an associated firing animation? 269 false, // Must the turret be in a locked down position while moving? 270 true, // Is this a gigundo-rotund-enormous unit? 271 false, // Does the unit have a constant animation? 272 false, // Is the unit capable of jamming radar? 273 true, // Is the unit a mobile gap generator? 274 32, // Rotation stages. 275 0, // Turret center offset along body centerline. 276 MISSION_HUNT // ORDERS: Default order to give new unit. 277 ); 278 279 // Artillery 280 static UnitTypeClass const UnitArty( 281 UNIT_ARTY, 282 TXT_ARTY, // NAME: Text name of this unit type. 283 "ARTY", // NAME: Text name of this unit type. 284 ANIM_ART_EXP1, // EXPLOSION: Type of explosion when destroyed. 285 REMAP_NORMAL, // Sidebar remap logic. 286 0x0040, // Vertical offset. 287 0x0060, // Primary weapon offset along turret centerline. 288 0x0000, // Primary weapon lateral offset along turret centerline. 289 0x0000, // Secondary weapon offset along turret centerline. 290 0x0000, // Secondary weapon lateral offset along turret centerling. 291 true, // Can this be a goodie surprise from a crate? 292 false, // Always use the given name for the vehicle? 293 false, // Can this unit squash infantry? 294 false, // Does this unit harvest Tiberium? 295 false, // Is invisible to radar? 296 false, // Is it insignificant (won't be announced)? 297 false, // Is it equipped with a combat turret? 298 false, // Does it have a rotating radar dish? 299 false, // Is there an associated firing animation? 300 false, // Must the turret be in a locked down position while moving? 301 false, // Is this a gigundo-rotund-enormous unit? 302 false, // Does the unit have a constant animation? 303 false, // Is the unit capable of jamming radar? 304 false, // Is the unit a mobile gap generator? 305 32, // Rotation stages. 306 0, // Turret center offset along body centerline. 307 MISSION_HUNT // ORDERS: Default order to give new unit. 308 ); 309 310 // Harvester 311 static UnitTypeClass const UnitHarvester( 312 UNIT_HARVESTER, 313 TXT_HARVESTER, // NAME: Text name of this unit type. 314 "HARV", // NAME: Text name of this unit type. 315 ANIM_FBALL1, // EXPLOSION: Type of explosion when destroyed. 316 REMAP_ALTERNATE, // Sidebar remap logic. 317 0x0000, // Vertical offset. 318 0x0000, // Primary weapon offset along turret centerline. 319 0x0000, // Primary weapon lateral offset along turret centerline. 320 0x0000, // Secondary weapon offset along turret centerline. 321 0x0000, // Secondary weapon lateral offset along turret centerling. 322 true, // Can this be a goodie surprise from a crate? 323 true, // Always use the given name for the vehicle? 324 true, // Can this unit squash infantry? 325 true, // Does this unit harvest Tiberium? 326 false, // Is invisible to radar? 327 false, // Is it insignificant (won't be announced)? 328 false, // Is it equipped with a combat turret? 329 false, // Does it have a rotating radar dish? 330 false, // Is there an associated firing animation? 331 false, // Must the turret be in a locked down position while moving? 332 true, // Is this a gigundo-rotund-enormous unit? 333 false, // Does the unit have a constant animation? 334 false, // Is the unit capable of jamming radar? 335 false, // Is the unit a mobile gap generator? 336 32, // Rotation stages. 337 0, // Turret center offset along body centerline. 338 MISSION_HARVEST // ORDERS: Default order to give new unit. 339 ); 340 341 // Mobile construction vehicle 342 static UnitTypeClass const UnitMCV( 343 UNIT_MCV, 344 TXT_MCV, // NAME: Text name of this unit type. 345 "MCV", // NAME: Text name of this unit type. 346 ANIM_FBALL1, // EXPLOSION: Type of explosion when destroyed. 347 REMAP_ALTERNATE, // Sidebar remap logic. 348 0x0000, // Vertical offset. 349 0x0000, // Primary weapon offset along turret centerline. 350 0x0000, // Primary weapon lateral offset along turret centerline. 351 0x0000, // Secondary weapon offset along turret centerline. 352 0x0000, // Secondary weapon lateral offset along turret centerling. 353 true, // Can this be a goodie surprise from a crate? 354 false, // Always use the given name for the vehicle? 355 true, // Can this unit squash infantry? 356 false, // Does this unit harvest Tiberium? 357 false, // Is invisible to radar? 358 false, // Is it insignificant (won't be announced)? 359 false, // Is it equipped with a combat turret? 360 false, // Does it have a rotating radar dish? 361 false, // Is there an associated firing animation? 362 false, // Must the turret be in a locked down position while moving? 363 true, // Is this a gigundo-rotund-enormous unit? 364 false, // Does the unit have a constant animation? 365 false, // Is the unit capable of jamming radar? 366 false, // Is the unit a mobile gap generator? 367 32, // Rotation stages. 368 0, // Turret center offset along body centerline. 369 MISSION_HUNT // ORDERS: Default order to give new unit. 370 ); 371 372 // Jeep (hummer) 373 static UnitTypeClass const UnitJeep( 374 UNIT_JEEP, 375 TXT_JEEP, // NAME: Text name of this unit type. 376 "JEEP", // NAME: Text name of this unit type. 377 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 378 REMAP_NORMAL, // Sidebar remap logic. 379 0x0030, // Vertical offset. 380 0x0030, // Primary weapon offset along turret centerline. 381 0x0000, // Primary weapon lateral offset along turret centerline. 382 0x0030, // Secondary weapon offset along turret centerline. 383 0x0000, // Secondary weapon lateral offset along turret centerling. 384 true, // Can this be a goodie surprise from a crate? 385 false, // Always use the given name for the vehicle? 386 false, // Can this unit squash infantry? 387 false, // Does this unit harvest Tiberium? 388 false, // Is invisible to radar? 389 false, // Is it insignificant (won't be announced)? 390 true, // Is it equipped with a combat turret? 391 false, // Does it have a rotating radar dish? 392 false, // Is there an associated firing animation? 393 false, // Must the turret be in a locked down position while moving? 394 false, // Is this a gigundo-rotund-enormous unit? 395 false, // Does the unit have a constant animation? 396 false, // Is the unit capable of jamming radar? 397 false, // Is the unit a mobile gap generator? 398 32, // Rotation stages. 399 0, // Turret center offset along body centerline. 400 MISSION_HUNT // ORDERS: Default order to give new unit. 401 ); 402 403 // Armored personnel carrier 404 static UnitTypeClass const UnitAPC( 405 UNIT_APC, 406 TXT_APC, // NAME: Text name of this unit type. 407 "APC", // NAME: Text name of this unit type. 408 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 409 REMAP_NORMAL, // Sidebar remap logic. 410 0x0030, // Vertical offset. 411 0x0030, // Primary weapon offset along turret centerline. 412 0x0000, // Primary weapon lateral offset along turret centerline. 413 0x0030, // Secondary weapon offset along turret centerline. 414 0x0000, // Secondary weapon lateral offset along turret centerling. 415 true, // Can this be a goodie surprise from a crate? 416 false, // Always use the given name for the vehicle? 417 true, // Can this unit squash infantry? 418 false, // Does this unit harvest Tiberium? 419 false, // Is invisible to radar? 420 false, // Is it insignificant (won't be announced)? 421 false, // Is it equipped with a combat turret? 422 false, // Does it have a rotating radar dish? 423 false, // Is there an associated firing animation? 424 false, // Must the turret be in a locked down position while moving? 425 false, // Is this a gigundo-rotund-enormous unit? 426 false, // Does the unit have a constant animation? 427 false, // Is the unit capable of jamming radar? 428 false, // Is the unit a mobile gap generator? 429 32, // Rotation stages. 430 0, // Turret center offset along body centerline. 431 MISSION_HUNT // ORDERS: Default order to give new unit. 432 ); 433 434 // Mine laying truck 435 static UnitTypeClass const UnitMineLayer( 436 UNIT_MINELAYER, 437 TXT_MINE_LAYER, // NAME: Text name of this unit type. 438 "MNLY", // NAME: Text name of this unit type. 439 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 440 REMAP_NORMAL, // Sidebar remap logic. 441 0x0000, // Vertical offset. 442 0x0000, // Primary weapon offset along turret centerline. 443 0x0000, // Primary weapon lateral offset along turret centerline. 444 0x0000, // Secondary weapon offset along turret centerline. 445 0x0000, // Secondary weapon lateral offset along turret centerling. 446 true, // Can this be a goodie surprise from a crate? 447 false, // Always use the given name for the vehicle? 448 true, // Can this unit squash infantry? 449 false, // Does this unit harvest Tiberium? 450 false, // Is invisible to radar? 451 false, // Is it insignificant (won't be announced)? 452 false, // Is it equipped with a combat turret? 453 false, // Does it have a rotating radar dish? 454 false, // Is there an associated firing animation? 455 false, // Must the turret be in a locked down position while moving? 456 false, // Is this a gigundo-rotund-enormous unit? 457 false, // Does the unit have a constant animation? 458 false, // Is the unit capable of jamming radar? 459 false, // Is the unit a mobile gap generator? 460 32, // Rotation stages. 461 0, // Turret center offset along body centerline. 462 MISSION_HUNT // ORDERS: Default order to give new unit. 463 ); 464 465 // Convoy Truck 466 static UnitTypeClass const UnitConvoyTruck( 467 UNIT_TRUCK, 468 TXT_TRUCK, // NAME: Text name of this unit type. 469 "TRUK", // NAME: Text name of this unit type. 470 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 471 REMAP_NORMAL, // Sidebar remap logic. 472 0x0000, // Vertical offset. 473 0x0000, // Primary weapon offset along turret centerline. 474 0x0000, // Primary weapon lateral offset along turret centerline. 475 0x0000, // Secondary weapon offset along turret centerline. 476 0x0000, // Secondary weapon lateral offset along turret centerling. 477 false, // Can this be a goodie surprise from a crate? 478 false, // Always use the given name for the vehicle? 479 false, // Can this unit squash infantry? 480 false, // Does this unit harvest Tiberium? 481 false, // Is invisible to radar? 482 false, // Is it insignificant (won't be announced)? 483 false, // Is it equipped with a combat turret? 484 false, // Does it have a rotating radar dish? 485 false, // Is there an associated firing animation? 486 false, // Must the turret be in a locked down position while moving? 487 false, // Is this a gigundo-rotund-enormous unit? 488 false, // Does the unit have a constant animation? 489 false, // Is the unit capable of jamming radar? 490 false, // Is the unit a mobile gap generator? 491 32, // Rotation stages. 492 0, // Turret center offset along body centerline. 493 MISSION_GUARD // ORDERS: Default order to give new unit. 494 ); 495 496 #ifdef FIXIT_ANTS 497 /* 498 [ANT] 499 Name=Warrior Ant 500 Primary=Mandible 501 Strength=150 502 Armor=light 503 TechLevel=-1 504 Sight=2 505 Speed=5 506 Cost=700 507 Points=40 508 ROT=5 509 Tracked=yes 510 Crewed=no 511 NoMovingFire=yes 512 513 ; Ant mandible 514 [Mandible] 515 Damage=50 516 ROF=5 517 Range=1.5 518 Projectile=Invisible 519 Speed=100 520 Warhead=HollowPoint 521 Report=none 522 523 524 */ 525 526 // Warrior ant 527 static UnitTypeClass const UnitAnt1( 528 UNIT_ANT1, 529 TXT_NONE, // NAME: Text name of this unit type. 530 "ANT1", // NAME: Text name of this unit type. 531 ANIM_ANT1_DEATH, // EXPLOSION: Type of explosion when destroyed. 532 REMAP_NORMAL, // Sidebar remap logic. 533 0x0000, // Vertical offset. 534 0x0000, // Primary weapon offset along turret centerline. 535 0x0000, // Primary weapon lateral offset along turret centerline. 536 0x0000, // Secondary weapon offset along turret centerline. 537 0x0000, // Secondary weapon lateral offset along turret centerling. 538 false, // Can this be a goodie surprise from a crate? 539 true, // Always use the given name for the vehicle? 540 false, // Can this unit squash infantry? 541 false, // Does this unit harvest Tiberium? 542 false, // Is invisible to radar? 543 true, // Is it insignificant (won't be announced)? 544 false, // Is it equipped with a combat turret? 545 false, // Does it have a rotating radar dish? 546 false, // Is there an associated firing animation? 547 false, // Must the turret be in a locked down position while moving? 548 true, // Is this a gigundo-rotund-enormous unit? 549 false, // Does the unit have a constant animation? 550 false, // Is the unit capable of jamming radar? 551 false, // Is the unit a mobile gap generator? 552 8, // Rotation stages. 553 0, // Turret center offset along body centerline. 554 MISSION_HUNT // ORDERS: Default order to give new unit. 555 ); 556 static UnitTypeClass const UnitAnt2( 557 UNIT_ANT2, 558 TXT_NONE, // NAME: Text name of this unit type. 559 "ANT2", // NAME: Text name of this unit type. 560 ANIM_ANT2_DEATH, // EXPLOSION: Type of explosion when destroyed. 561 REMAP_NORMAL, // Sidebar remap logic. 562 0x0000, // Vertical offset. 563 0x0000, // Primary weapon offset along turret centerline. 564 0x0000, // Primary weapon lateral offset along turret centerline. 565 0x0000, // Secondary weapon offset along turret centerline. 566 0x0000, // Secondary weapon lateral offset along turret centerling. 567 false, // Can this be a goodie surprise from a crate? 568 true, // Always use the given name for the vehicle? 569 false, // Can this unit squash infantry? 570 false, // Does this unit harvest Tiberium? 571 false, // Is invisible to radar? 572 true, // Is it insignificant (won't be announced)? 573 false, // Is it equipped with a combat turret? 574 false, // Does it have a rotating radar dish? 575 false, // Is there an associated firing animation? 576 false, // Must the turret be in a locked down position while moving? 577 true, // Is this a gigundo-rotund-enormous unit? 578 false, // Does the unit have a constant animation? 579 false, // Is the unit capable of jamming radar? 580 false, // Is the unit a mobile gap generator? 581 8, // Rotation stages. 582 0, // Turret center offset along body centerline. 583 MISSION_HUNT // ORDERS: Default order to give new unit. 584 ); 585 static UnitTypeClass const UnitAnt3( 586 UNIT_ANT3, 587 TXT_NONE, // NAME: Text name of this unit type. 588 "ANT3", // NAME: Text name of this unit type. 589 ANIM_ANT3_DEATH, // EXPLOSION: Type of explosion when destroyed. 590 REMAP_NORMAL, // Sidebar remap logic. 591 0x0000, // Vertical offset. 592 0x0000, // Primary weapon offset along turret centerline. 593 0x0000, // Primary weapon lateral offset along turret centerline. 594 0x0000, // Secondary weapon offset along turret centerline. 595 0x0000, // Secondary weapon lateral offset along turret centerling. 596 false, // Can this be a goodie surprise from a crate? 597 true, // Always use the given name for the vehicle? 598 false, // Can this unit squash infantry? 599 false, // Does this unit harvest Tiberium? 600 false, // Is invisible to radar? 601 true, // Is it insignificant (won't be announced)? 602 false, // Is it equipped with a combat turret? 603 false, // Does it have a rotating radar dish? 604 false, // Is there an associated firing animation? 605 false, // Must the turret be in a locked down position while moving? 606 true, // Is this a gigundo-rotund-enormous unit? 607 false, // Does the unit have a constant animation? 608 false, // Is the unit capable of jamming radar? 609 false, // Is the unit a mobile gap generator? 610 8, // Rotation stages. 611 0, // Turret center offset along body centerline. 612 MISSION_HUNT // ORDERS: Default order to give new unit. 613 ); 614 #endif 615 616 #ifdef FIXIT_CSII // checked - ajw 9/28/98 617 // Chrono Tank 618 static UnitTypeClass const UnitChrono( 619 UNIT_CHRONOTANK, 620 TXT_CHRONOTANK, // NAME: Text name of this unit type. 621 "CTNK", // NAME: Text name of this unit type. 622 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 623 REMAP_NORMAL, // Sidebar remap logic. 624 0x0000, // Vertical offset. 625 0x0000, // Primary weapon offset along turret centerline. 626 0x0000, // Primary weapon lateral offset along turret centerline. 627 0x0000, // Secondary weapon offset along turret centerline. 628 0x0000, // Secondary weapon lateral offset along turret centerling. 629 false, // Can this be a goodie surprise from a crate? 630 false, // Always use the given name for the vehicle? 631 true, // Can this unit squash infantry? 632 false, // Does this unit harvest Tiberium? 633 false, // Is invisible to radar? 634 false, // Is it insignificant (won't be announced)? 635 false, // Is it equipped with a combat turret? 636 false, // Does it have a rotating radar dish? 637 false, // Is there an associated firing animation? 638 false, // Must the turret be in a locked down position while moving? 639 true, // Is this a gigundo-rotund-enormous unit? 640 false, // Does the unit have a constant animation? 641 false, // Is the unit capable of jamming radar? 642 false, // Is the unit a mobile gap generator? 643 32, // Rotation stages. 644 0, // Turret center offset along body centerline. 645 MISSION_HUNT // ORDERS: Default order to give new unit. 646 ); 647 648 // Tesla Tank 649 static UnitTypeClass const UnitTesla( 650 UNIT_TESLATANK, 651 TXT_TESLATANK, // NAME: Text name of this unit type. 652 "TTNK", // NAME: Text name of this unit type. 653 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 654 REMAP_NORMAL, // Sidebar remap logic. 655 0x0000, // Vertical offset. 656 0x0000, // Primary weapon offset along turret centerline. 657 0x0000, // Primary weapon lateral offset along turret centerline. 658 0x0000, // Secondary weapon offset along turret centerline. 659 0x0000, // Secondary weapon lateral offset along turret centerling. 660 false, // Can this be a goodie surprise from a crate? 661 false, // Always use the given name for the vehicle? 662 true, // Can this unit squash infantry? 663 false, // Does this unit harvest Tiberium? 664 true, // Is invisible to radar? 665 false, // Is it insignificant (won't be announced)? 666 false, // Is it equipped with a combat turret? 667 true, // Does it have a rotating radar dish? 668 false, // Is there an associated firing animation? 669 false, // Must the turret be in a locked down position while moving? 670 true, // Is this a gigundo-rotund-enormous unit? 671 false, // Does the unit have a constant animation? 672 true, // Is the unit capable of jamming radar? 673 false, // Is the unit a mobile gap generator? 674 32, // Rotation stages. 675 0, // Turret center offset along body centerline. 676 MISSION_HUNT // ORDERS: Default order to give new unit. 677 ); 678 679 // M.A.D. Tank 680 static UnitTypeClass const UnitMAD( 681 UNIT_MAD, 682 TXT_MAD, // NAME: Text name of this unit type. 683 "QTNK", // NAME: Text name of this unit type. 684 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 685 REMAP_NORMAL, // Sidebar remap logic. 686 0x0000, // Vertical offset. 687 0x0000, // Primary weapon offset along turret centerline. 688 0x0000, // Primary weapon lateral offset along turret centerline. 689 0x0000, // Secondary weapon offset along turret centerline. 690 0x0000, // Secondary weapon lateral offset along turret centerling. 691 false, // Can this be a goodie surprise from a crate? 692 false, // Always use the given name for the vehicle? 693 true, // Can this unit squash infantry? 694 false, // Does this unit harvest Tiberium? 695 false, // Is invisible to radar? 696 false, // Is it insignificant (won't be announced)? 697 false, // Is it equipped with a combat turret? 698 false, // Does it have a rotating radar dish? 699 false, // Is there an associated firing animation? 700 false, // Must the turret be in a locked down position while moving? 701 true, // Is this a gigundo-rotund-enormous unit? 702 false, // Does the unit have a constant animation? 703 false, // Is the unit capable of jamming radar? 704 false, // Is the unit a mobile gap generator? 705 32, // Rotation stages. 706 0, // Turret center offset along body centerline. 707 MISSION_HUNT // ORDERS: Default order to give new unit. 708 ); 709 710 711 // Demolition Truck 712 static UnitTypeClass const UnitDemoTruck( 713 UNIT_DEMOTRUCK, 714 TXT_DEMOTRUCK, // NAME: Text name of this unit type. 715 "DTRK", // NAME: Text name of this unit type. 716 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 717 REMAP_NORMAL, // Sidebar remap logic. 718 0x0000, // Vertical offset. 719 0x0000, // Primary weapon offset along turret centerline. 720 0x0000, // Primary weapon lateral offset along turret centerline. 721 0x0000, // Secondary weapon offset along turret centerline. 722 0x0000, // Secondary weapon lateral offset along turret centerling. 723 false, // Can this be a goodie surprise from a crate? 724 false, // Always use the given name for the vehicle? 725 false, // Can this unit squash infantry? 726 false, // Does this unit harvest Tiberium? 727 false, // Is invisible to radar? 728 false, // Is it insignificant (won't be announced)? 729 false, // Is it equipped with a combat turret? 730 false, // Does it have a rotating radar dish? 731 false, // Is there an associated firing animation? 732 false, // Must the turret be in a locked down position while moving? 733 false, // Is this a gigundo-rotund-enormous unit? 734 false, // Does the unit have a constant animation? 735 false, // Is the unit capable of jamming radar? 736 false, // Is the unit a mobile gap generator? 737 32, // Rotation stages. 738 0, // Turret center offset along body centerline. 739 MISSION_GUARD // ORDERS: Default order to give new unit. 740 ); 741 #ifdef FIXIT_PHASETRANSPORT // checked - ajw 9/28/98 742 static UnitTypeClass const UnitPhase( 743 UNIT_PHASE, 744 TXT_PHASETRANSPORT, // NAME: Text name of this unit type. 745 "STNK", // NAME: Text name of this unit type. 746 ANIM_FRAG1, // EXPLOSION: Type of explosion when destroyed. 747 REMAP_NORMAL, // Sidebar remap logic. 748 0x0030, // Vertical offset. 749 0x0030, // Primary weapon offset along turret centerline. 750 0x0000, // Primary weapon lateral offset along turret centerline. 751 0x0030, // Secondary weapon offset along turret centerline. 752 0x0000, // Secondary weapon lateral offset along turret centerling. 753 false, // Can this be a goodie surprise from a crate? 754 false, // Always use the given name for the vehicle? 755 true, // Can this unit squash infantry? 756 false, // Does this unit harvest Tiberium? 757 false, // Is invisible to radar? 758 false, // Is it insignificant (won't be announced)? 759 true, // Is it equipped with a combat turret? 760 false, // Does it have a rotating radar dish? 761 false, // Is there an associated firing animation? 762 false, // Must the turret be in a locked down position while moving? 763 true,// false, // Is this a gigundo-rotund-enormous unit? 764 false, // Does the unit have a constant animation? 765 false, // Is the unit capable of jamming radar? 766 false, // Is the unit a mobile gap generator? 767 32, // Rotation stages. 768 0, // Turret center offset along body centerline. 769 MISSION_HUNT // ORDERS: Default order to give new unit. 770 ); 771 772 #endif 773 #endif 774 775 /*********************************************************************************************** 776 * UnitTypeClass::UnitTypeClass -- Constructor for unit types. * 777 * * 778 * This is the constructor for the unit types. It is used to initialize the unit type class * 779 * structure. The unit type class is used to control the behavior of the various types * 780 * of units in the game. This constructor is called for every unique unit type as it * 781 * exists in the array of unit types. * 782 * * 783 * INPUT: bla bla bla... see below * 784 * * 785 * OUTPUT: none * 786 * * 787 * WARNINGS: none * 788 * * 789 * HISTORY: * 790 * 06/20/1994 JLB : Created. * 791 *=============================================================================================*/ 792 UnitTypeClass::UnitTypeClass( 793 UnitType type, 794 int name, 795 char const * ininame, 796 AnimType exp, 797 RemapType remap, 798 int verticaloffset, 799 int primaryoffset, 800 int primarylateral, 801 int secondaryoffset, 802 int secondarylateral, 803 bool is_goodie, 804 bool is_nominal, 805 bool is_crusher, 806 bool is_harvest, 807 bool is_stealthy, 808 bool is_insignificant, 809 bool is_turret_equipped, 810 bool is_radar_equipped, 811 bool is_fire_anim, 812 bool is_lock_turret, 813 bool is_gigundo, 814 bool is_animating, 815 bool is_jammer, 816 bool is_gapper, 817 int rotation, 818 int toffset, 819 MissionType order) : 820 TechnoTypeClass(RTTI_UNITTYPE, 821 int(type), 822 name, 823 ininame, 824 remap, 825 verticaloffset, 826 primaryoffset, 827 primarylateral, 828 secondaryoffset, 829 secondarylateral, 830 is_nominal, 831 is_stealthy, 832 true, 833 true, 834 is_insignificant, 835 false, 836 false, 837 is_turret_equipped, 838 true, 839 true, 840 rotation, 841 SPEED_TRACK), 842 IsCrateGoodie(is_goodie), 843 IsCrusher(is_crusher), 844 IsToHarvest(is_harvest), 845 IsRadarEquipped(is_radar_equipped), 846 IsFireAnim(is_fire_anim), 847 IsLockTurret(is_lock_turret), 848 IsGigundo(is_gigundo), 849 IsAnimating(is_animating), 850 IsJammer(is_jammer), 851 IsGapper(is_gapper), 852 IsNoFireWhileMoving(false), 853 Type(type), 854 TurretOffset(toffset), 855 Mission(order), 856 Explosion(exp), 857 MaxSize(0) 858 { 859 /* 860 ** Forced unit overrides form the default. 861 */ 862 Speed = SPEED_WHEEL; 863 } 864 865 866 /*********************************************************************************************** 867 * UnitTypeClass::operator new -- Allocates an object from the unit type class heap. * 868 * * 869 * Use this routine to allocate a unit type class object from the special heap that is * 870 * maintained for this purpose. * 871 * * 872 * INPUT: none * 873 * * 874 * OUTPUT: Returns with a pointer to the newly allocated unit type class object. If there is * 875 * no more room to allocate another unit type class object, then NULL will be * 876 * returned. * 877 * * 878 * WARNINGS: none * 879 * * 880 * HISTORY: * 881 * 07/09/1996 JLB : Created. * 882 *=============================================================================================*/ 883 void * UnitTypeClass::operator new(size_t) 884 { 885 return(UnitTypes.Alloc()); 886 } 887 888 889 /*********************************************************************************************** 890 * UnitTypeClass::operator delete -- Return a unit type class object back to the pool. * 891 * * 892 * This will return a previously allocated unit to the memory pool from whence it came. * 893 * * 894 * INPUT: pointer -- A Pointer to the unit type class object to return to the memory pool. * 895 * * 896 * OUTPUT: none * 897 * * 898 * WARNINGS: none * 899 * * 900 * HISTORY: * 901 * 07/09/1996 JLB : Created. * 902 *=============================================================================================*/ 903 void UnitTypeClass::operator delete(void * pointer) 904 { 905 UnitTypes.Free((UnitTypeClass *)pointer); 906 } 907 908 909 /*********************************************************************************************** 910 * UnitTypeClass::Init_Heap -- Initialize the unit type class heap. * 911 * * 912 * This initializes the unit type class heap by pre-allocated all the known unit types. * 913 * * 914 * INPUT: none * 915 * * 916 * OUTPUT: none * 917 * * 918 * WARNINGS: Only call this once and call it before processing the rules.ini file. * 919 * * 920 * HISTORY: * 921 * 07/09/1996 JLB : Created. * 922 *=============================================================================================*/ 923 void UnitTypeClass::Init_Heap(void) 924 { 925 /* 926 ** These unit type class objects must be allocated in the exact order that they 927 ** are specified in the UnitType enumeration. This is necessary because the heap 928 ** allocation block index serves double duty as the type number index. 929 */ 930 new UnitTypeClass(UnitHTank); // UNIT_HTANK 931 new UnitTypeClass(UnitMTank); // UNIT_MTANK 932 new UnitTypeClass(UnitMTank2); // UNIT_MTANK2 933 new UnitTypeClass(UnitLTank); // UNIT_LTANK 934 new UnitTypeClass(UnitAPC); // UNIT_APC 935 new UnitTypeClass(UnitMineLayer); // UNIT_MINELAYER 936 new UnitTypeClass(UnitJeep); // UNIT_JEEP 937 new UnitTypeClass(UnitHarvester); // UNIT_HARVESTER 938 new UnitTypeClass(UnitArty); // UNIT_ARTY 939 new UnitTypeClass(UnitMRJammer); // UNIT_MRJ 940 new UnitTypeClass(UnitMGG); // UNIT_MGG 941 new UnitTypeClass(UnitMCV); // UNIT_MCV 942 new UnitTypeClass(UnitV2Launcher); // UNIT_V2_LAUNCHER 943 new UnitTypeClass(UnitConvoyTruck); // UNIT_TRUCK 944 #ifdef FIXIT_ANTS 945 new UnitTypeClass(UnitAnt1); // UNIT_ANT1 946 new UnitTypeClass(UnitAnt2); // UNIT_ANT2 947 new UnitTypeClass(UnitAnt3); // UNIT_ANT3 948 #endif 949 950 #ifdef FIXIT_CSII // checked - ajw 9/28/98 951 new UnitTypeClass(UnitChrono); // UNIT_CHRONOTANK 952 new UnitTypeClass(UnitTesla); // UNIT_TESLATANK 953 new UnitTypeClass(UnitMAD); // UNIT_MAD 954 new UnitTypeClass(UnitDemoTruck); // UNIT_DEMOTRUCK 955 #ifdef FIXIT_PHASETRANSPORT // checked - ajw 9/28/98 956 new UnitTypeClass(UnitPhase); // UNIT_PHASETRANSPORT 957 #endif 958 #endif 959 960 } 961 962 963 /*********************************************************************************************** 964 * UnitTypeClass::From_Name -- Fetch class pointer from specified name. * 965 * * 966 * This routine converts an ASCII representation of a unit class and * 967 * converts it into a real unit class number. * 968 * * 969 * INPUT: name -- ASCII name representing a unit class. * 970 * * 971 * OUTPUT: Returns with the actual unit class number that the string * 972 * represents. * 973 * * 974 * WARNINGS: none * 975 * * 976 * HISTORY: * 977 * 10/07/1992 JLB : Created. * 978 * 05/02/1994 JLB : Converted to member function. * 979 *=============================================================================================*/ 980 UnitType UnitTypeClass::From_Name(char const * name) 981 { 982 if (name != NULL) { 983 for (UnitType classid = UNIT_FIRST; classid < UNIT_COUNT; classid++) { 984 if (stricmp(As_Reference(classid).IniName, name) == 0) { 985 return(classid); 986 } 987 } 988 } 989 return(UNIT_NONE); 990 } 991 992 993 #ifdef SCENARIO_EDITOR 994 /*********************************************************************************************** 995 * UnitTypeClass::Display -- Displays a generic unit shape. * 996 * * 997 * This routine displays a generic representation of a unit of this * 998 * type. Typically, it is used when adding objects to the game map. * 999 * * 1000 * INPUT: x,y -- Coordinate to render the unit shape. * 1001 * * 1002 * window-- Window to render within. * 1003 * * 1004 * house -- House to render the unit colors. * 1005 * * 1006 * OUTPUT: none * 1007 * * 1008 * WARNINGS: none * 1009 * * 1010 * HISTORY: * 1011 * 05/14/1994 JLB : Created. * 1012 * 11/08/1994 JLB : Handles chunky type vehicles now. * 1013 *=============================================================================================*/ 1014 void UnitTypeClass::Display(int x, int y, WindowNumberType window, HousesType ) const 1015 { 1016 int shape = 0; 1017 void const * ptr = Get_Cameo_Data(); 1018 if (ptr == NULL) { 1019 ptr = Get_Image_Data(); 1020 shape = Rotation/6; 1021 } 1022 CC_Draw_Shape(ptr, shape, x, y, window, SHAPE_CENTER|SHAPE_WIN_REL); 1023 } 1024 1025 1026 /*********************************************************************************************** 1027 * UnitTypeClass::Prep_For_Add -- Prepares scenario editor to add unit. * 1028 * * 1029 * This routine is used to prepare the generic object adder dialog * 1030 * box so that it will be able to add a unit object. * 1031 * * 1032 * INPUT: none * 1033 * * 1034 * OUTPUT: none * 1035 * * 1036 * WARNINGS: none * 1037 * * 1038 * HISTORY: * 1039 * 05/23/1994 JLB : Created. * 1040 * 06/04/1994 JLB : Uses map editing interface functions. * 1041 *=============================================================================================*/ 1042 void UnitTypeClass::Prep_For_Add(void) 1043 { 1044 for (UnitType index = UNIT_FIRST; index < UNIT_COUNT; index++) { 1045 if (As_Reference(index).Get_Image_Data() != NULL) { 1046 Map.Add_To_List(&As_Reference(index)); 1047 } 1048 } 1049 } 1050 #endif 1051 1052 1053 /*********************************************************************************************** 1054 * UnitTypeClass::One_Time -- Performs one time processing for unit type class objects. * 1055 * * 1056 * This routine is used to perform the action necessary only once for the unit type class. * 1057 * It loads unit shapes and brain files. This routine should only be called once. * 1058 * * 1059 * INPUT: none * 1060 * * 1061 * OUTPUT: none * 1062 * * 1063 * WARNINGS: Only call this routine once. * 1064 * * 1065 * HISTORY: * 1066 * 05/28/1994 JLB : Created. * 1067 *=============================================================================================*/ 1068 void UnitTypeClass::One_Time(void) 1069 { 1070 for (UnitType index = UNIT_FIRST; index < UNIT_COUNT; index++) { 1071 char fullname[_MAX_FNAME+_MAX_EXT]; 1072 char buffer[_MAX_FNAME]; 1073 UnitTypeClass const & uclass = As_Reference(index); 1074 CCFileClass file; 1075 1076 void const * ptr; // Shape pointer and set pointer. 1077 1078 int largest = 0; 1079 // if (uclass.Level != -1) { 1080 // if (uclass.IsBuildable) { 1081 1082 /* 1083 ** Fetch the supporting data files for the unit. 1084 */ 1085 sprintf(buffer, "%sICON", uclass.Graphic_Name()); 1086 _makepath(fullname, NULL, NULL, buffer, ".SHP"); 1087 #ifndef NDEBUG 1088 RawFileClass datafile(fullname); 1089 if (datafile.Is_Available()) { 1090 ((void const *&)uclass.CameoData) = Load_Alloc_Data(datafile); 1091 } else { 1092 ((void const *&)uclass.CameoData) = MFCD::Retrieve(fullname); 1093 } 1094 #else 1095 ((void const *&)uclass.CameoData) = MFCD::Retrieve(fullname); 1096 #endif 1097 // } 1098 1099 /* 1100 ** Fetch a pointer to the unit's shape data. 1101 */ 1102 _makepath(fullname, NULL, NULL, uclass.Graphic_Name(), ".SHP"); 1103 #ifndef NDEBUG 1104 RawFileClass shpfile(fullname); 1105 if (shpfile.Is_Available()) { 1106 ptr = Load_Alloc_Data(shpfile); 1107 } else { 1108 ptr = MFCD::Retrieve(fullname); 1109 } 1110 #else 1111 ptr = MFCD::Retrieve(fullname); 1112 #endif 1113 1114 ((void const *&)uclass.ImageData) = ptr; 1115 if (ptr != NULL) { 1116 1117 largest = max(largest, (int)Get_Build_Frame_Width(ptr)); 1118 largest = max(largest, (int)Get_Build_Frame_Height(ptr)); 1119 } 1120 1121 ((int &)uclass.MaxSize) = max(largest, 8); 1122 } 1123 1124 /* 1125 ** Load any custom shapes at this time. 1126 */ 1127 if (WakeShapes == NULL) { 1128 WakeShapes = MFCD::Retrieve("WAKE.SHP"); 1129 } 1130 if (TurretShapes == NULL) { 1131 TurretShapes = MFCD::Retrieve("TURR.SHP"); 1132 } 1133 if (SamShapes == NULL) { 1134 SamShapes = MFCD::Retrieve("SSAM.SHP"); 1135 } 1136 if (MGunShapes == NULL) { 1137 MGunShapes = MFCD::Retrieve("MGUN.SHP"); 1138 } 1139 } 1140 1141 1142 /*********************************************************************************************** 1143 * UnitTypeClass::Create_And_Place -- Creates and places a unit object onto the map. * 1144 * * 1145 * This routine is used by the scenario editor to create and place a unit object of this * 1146 * type onto the map. * 1147 * * 1148 * INPUT: cell -- The cell that the unit is to be placed into. * 1149 * * 1150 * house -- The house that the unit belongs to. * 1151 * * 1152 * OUTPUT: bool; Was the unit created and placed successfully? * 1153 * * 1154 * WARNINGS: none * 1155 * * 1156 * HISTORY: * 1157 * 05/28/1994 JLB : Created. * 1158 *=============================================================================================*/ 1159 bool UnitTypeClass::Create_And_Place(CELL cell, HousesType house) const 1160 { 1161 UnitClass * unit = new UnitClass(Type, house); 1162 if (unit != NULL) { 1163 return(unit->Unlimbo(Cell_Coord(cell), Random_Pick(DIR_N, DIR_MAX))); 1164 } 1165 return(false); 1166 } 1167 1168 1169 /*********************************************************************************************** 1170 * UnitTypeClass::Create_One_Of -- Creates a unit in limbo. * 1171 * * 1172 * This function creates a unit of this type and keeps it in limbo. A pointer to the * 1173 * created unit object is returned. It is presumed that this object will later be * 1174 * unlimboed at the correct time and place. * 1175 * * 1176 * INPUT: house -- Pointer to the house that is to own the unit. * 1177 * * 1178 * OUTPUT: Returns with a pointer to the created unit object. If the unit object * 1179 * could not be created, then NULL is returned. * 1180 * * 1181 * WARNINGS: none * 1182 * * 1183 * HISTORY: * 1184 * 06/07/1994 JLB : Created. * 1185 *=============================================================================================*/ 1186 ObjectClass * UnitTypeClass::Create_One_Of(HouseClass * house) const 1187 { 1188 return(new UnitClass(Type, house->Class->House)); 1189 } 1190 1191 1192 /*********************************************************************************************** 1193 * UnitTypeClass::As_Reference -- Fetches a reference to the unit type class specified. * 1194 * * 1195 * Use this routine to return a reference to the UnitTypeClass object as indicated by * 1196 * the unit type number specified. * 1197 * * 1198 * INPUT: type -- The unit type number to convert into a UnitTypeClass object reference. * 1199 * * 1200 * OUTPUT: Returns with a reference to the unit type class object specified. * 1201 * * 1202 * WARNINGS: none * 1203 * * 1204 * HISTORY: * 1205 * 01/23/1995 JLB : Created. * 1206 *=============================================================================================*/ 1207 UnitTypeClass & UnitTypeClass::As_Reference(UnitType type) 1208 { 1209 return(*UnitTypes.Ptr(type)); 1210 } 1211 1212 1213 /*********************************************************************************************** 1214 * UnitTypeClass::Dimensions -- Determines the unit's pixel dimensions. * 1215 * * 1216 * This routine will fill in the width and height for this unit type. This width and * 1217 * height are used to render the selection rectangle and the positioning of the health * 1218 * bargraph. * 1219 * * 1220 * INPUT: width -- Reference to the width of the unit (to be filled in). * 1221 * * 1222 * height -- Reference to the height of the unit (to be filled in). * 1223 * * 1224 * OUTPUT: none * 1225 * * 1226 * WARNINGS: none * 1227 * * 1228 * HISTORY: * 1229 * 01/23/1995 JLB : Created. * 1230 *=============================================================================================*/ 1231 void UnitTypeClass::Dimensions(int &width, int &height) const 1232 { 1233 width = MaxSize-(MaxSize/4); 1234 width = min(width, 48); 1235 height = MaxSize-(MaxSize/4); 1236 height = min(height, 48); 1237 } 1238 1239 1240 /*********************************************************************************************** 1241 * UnitTypeClass::Max_Pips -- Fetches the maximum pips allowed for this unit. * 1242 * * 1243 * This routine will determine the number of pips (maximum) allowed for this unit type. * 1244 * Typically, this is the number of passengers allowed, but for harvesters, it is the * 1245 * number of credits it holds divided by 100. * 1246 * * 1247 * INPUT: none * 1248 * * 1249 * OUTPUT: Returns with the maximum number of pips allowed for this unit type. * 1250 * * 1251 * WARNINGS: none * 1252 * * 1253 * HISTORY: * 1254 * 06/26/1995 JLB : Created. * 1255 *=============================================================================================*/ 1256 int UnitTypeClass::Max_Pips(void) const 1257 { 1258 if (Type == UNIT_HARVESTER) { 1259 return(7); 1260 } 1261 1262 if (Type == UNIT_MINELAYER) { 1263 return(MaxAmmo); 1264 } 1265 return(Max_Passengers()); 1266 } 1267 1268 1269 /*********************************************************************************************** 1270 * UnitTypeClass::Turret_Adjust -- Turret adjustment routine for MLRS and MSAM units. * 1271 * * 1272 * This routine adjusts the pixel coordinates specified to account for the displacement of * 1273 * the turret on the MLRS and MSAM vehicles. * 1274 * * 1275 * INPUT: dir -- The direction of the body of the vehicle. * 1276 * * 1277 * x,y -- References to the turret center pixel position. These will be modified as * 1278 * necessary. * 1279 * * 1280 * OUTPUT: none * 1281 * * 1282 * WARNINGS: none * 1283 * * 1284 * HISTORY: * 1285 * 05/08/1995 JLB : Created. * 1286 *=============================================================================================*/ 1287 void UnitTypeClass::Turret_Adjust(DirType dir, int &x, int &y) const 1288 { 1289 static struct { 1290 signed char X,Y; 1291 } _adjust[32] = { 1292 {1,2}, // N 1293 {-1,1}, 1294 {-2,0}, 1295 {-3,0}, 1296 {-3,1}, // NW 1297 {-4,-1}, 1298 {-4,-1}, 1299 {-5,-2}, 1300 {-5,-3}, // W 1301 {-5,-3}, 1302 {-3,-3}, 1303 {-3,-4}, 1304 {-3,-4}, // SW 1305 {-3,-5}, 1306 {-2,-5}, 1307 {-1,-5}, 1308 {0,-5}, // S 1309 {1,-6}, 1310 {2,-5}, 1311 {3,-5}, 1312 {4,-5}, // SE 1313 {6,-4}, 1314 {6,-3}, 1315 {6,-3}, 1316 {6,-3}, // E 1317 {5,-1}, 1318 {5,-1}, 1319 {4,0}, 1320 {3,0}, // NE 1321 {2,0}, 1322 {2,1}, 1323 {1,2} 1324 }; 1325 1326 int index = 0; 1327 switch (Type) { 1328 case UNIT_JEEP: 1329 y -= 4; 1330 break; 1331 1332 case UNIT_MGG: 1333 index = Dir_To_32(dir); 1334 x += _adjust[index].X; 1335 y += _adjust[index].Y; 1336 break; 1337 1338 default: 1339 break; 1340 } 1341 } 1342 1343 1344 /*********************************************************************************************** 1345 * UnitTypeClass::Read_INI -- Fetch the unit type data from the INI database. * 1346 * * 1347 * This routine will find the section in the INI database for this unit type object and * 1348 * then fill in the override values specified. * 1349 * * 1350 * INPUT: ini -- Reference to the INI database that will be examined. * 1351 * * 1352 * OUTPUT: bool; Was the section for this unit found in the database and the data extracted? * 1353 * * 1354 * WARNINGS: none * 1355 * * 1356 * HISTORY: * 1357 * 07/19/1996 JLB : Created. * 1358 *=============================================================================================*/ 1359 bool UnitTypeClass::Read_INI(CCINIClass & ini) 1360 { 1361 if (TechnoTypeClass::Read_INI(ini)) { 1362 IsNoFireWhileMoving = ini.Get_Bool(IniName, "NoMovingFire", IsNoFireWhileMoving); 1363 Speed = ini.Get_Bool(IniName, "Tracked", (Speed == SPEED_TRACK)) ? SPEED_TRACK : SPEED_WHEEL; 1364 1365 /* 1366 ** If this unit can drive over walls, then mark it as recognizing the crusher zone. 1367 */ 1368 if (MZone < MZONE_CRUSHER && IsCrusher) { 1369 MZone = MZONE_CRUSHER; 1370 } 1371 return(true); 1372 } 1373 return(false); 1374 }