TDATA.CPP (43370B)
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\tdata.cpv 2.16 16 Oct 1995 16:52:04 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 : TDATA.CPP * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : May 2, 1994 * 28 * * 29 * Last Update : May 8, 1995 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * TerrainTypeClass::Prep_For_Add -- Prepares to add terrain object. * 34 * TerrainTypeClass::Display -- Display a generic terrain object. * 35 * TerrainTypeClass::From_Name -- Convert name to terrain type. * 36 * TerrainTypeClass::Init -- Loads terrain object shape files. * 37 * TerrainTypeClass::Create_And_Place -- Creates and places terrain object on map. * 38 * TerrainTypeClass::Create_On_Of -- Creates a terrain object from type. * 39 * TerrainTypeClass::TerrainTypeClass -- The general constructor for the terrain type objects* 40 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 41 42 #include "function.h" 43 #include "terrain.h" 44 #include "type.h" 45 46 47 #define TREE_NORMAL 600 48 #define TREE_WEAK 400 49 #define TREE_STRONG 800 50 51 static short const _List1[] = {0, REFRESH_EOL}; 52 static short const _List000010[] = {MAP_CELL_W+1, REFRESH_EOL}; 53 static short const _List000011101000[] = {MAP_CELL_W, MAP_CELL_W+1, MAP_CELL_W+2, MAP_CELL_W*2, REFRESH_EOL}; 54 static short const _List00001[] = {4, REFRESH_EOL}; 55 static short const _List000110[] = {MAP_CELL_W, MAP_CELL_W+1, REFRESH_EOL}; 56 static short const _List000111[] = {MAP_CELL_W, MAP_CELL_W+1, MAP_CELL_W+2, REFRESH_EOL}; 57 static short const _List001011100110[] = {2, MAP_CELL_W, MAP_CELL_W+1, MAP_CELL_W+2, MAP_CELL_W*2+1, MAP_CELL_W*2+2, REFRESH_EOL}; 58 static short const _List0010[] = {MAP_CELL_W, REFRESH_EOL}; 59 static short const _List0011[] = {MAP_CELL_W, MAP_CELL_W+1, REFRESH_EOL}; 60 static short const _List001[] = {2, REFRESH_EOL}; 61 static short const _List010110[] = {1, MAP_CELL_W, MAP_CELL_W+1, REFRESH_EOL}; 62 static short const _List01[] = {1, REFRESH_EOL}; 63 static short const _List1001[] = {0, MAP_CELL_W+1, REFRESH_EOL}; 64 static short const _List101001[] = {0, 2, MAP_CELL_W+2, REFRESH_EOL}; 65 static short const _List10[] = {0, REFRESH_EOL}; 66 static short const _List110000011001[] = {0, 1, MAP_CELL_W+3, MAP_CELL_W*2, MAP_CELL_W*2+3, REFRESH_EOL}; 67 static short const _List110000[] = {0, 1, REFRESH_EOL}; 68 static short const _List110001[] = {0, 1, MAP_CELL_W+2, REFRESH_EOL}; 69 static short const _List1100[] = {0, 1, REFRESH_EOL}; 70 static short const _List110110[] = {0, 1, MAP_CELL_W, MAP_CELL_W+1, REFRESH_EOL}; 71 static short const _List1101[] = {0, 1, MAP_CELL_W+1, REFRESH_EOL}; 72 static short const _List111000010110[] = {0, 1, 2, MAP_CELL_W+3, MAP_CELL_W*2+1, MAP_CELL_W*2+2, REFRESH_EOL}; 73 static short const _List111001[] = {0, 1, 2, MAP_CELL_W+2, REFRESH_EOL}; 74 static short const _List111101[] = {0, 1, 2, MAP_CELL_W, MAP_CELL_W+2, REFRESH_EOL}; 75 static short const _List11110[] = {0, 1, 2, 3, REFRESH_EOL}; 76 77 78 static TerrainTypeClass const Tree1Class( 79 TERRAIN_TREE1, 80 THEATERF_WINTER|THEATERF_TEMPERATE, 81 XYP_COORD(11,41), // Center base coordinate offset. 82 false, // Spawns Tiberium spontaneously? 83 true, // Does it have destruction animation? 84 false, // Does it have transformation (blossom tree) anim? 85 true, // Does it catch fire? 86 false, // Is this object crushable by heavy vehicles? 87 false, // Can this object be selected by the player? 88 false, // Can it be the target of a move or attack order? 89 true, // Don't make a big deal about it if it gets destroyed? 90 false, // Is it immune to normal combat damage? 91 "T01", 92 TXT_TREE, 93 TREE_NORMAL, 94 ARMOR_WOOD, 95 (short const *)_List0010, 96 (short const *)_List1001 97 ); 98 99 static TerrainTypeClass const Tree2Class( 100 TERRAIN_TREE2, 101 THEATERF_WINTER|THEATERF_TEMPERATE, 102 XYP_COORD(11,44), // Center base coordinate offset. 103 false, // Spawns Tiberium spontaneously? 104 true, // Does it have destruction animation? 105 false, // Does it have transformation (blossom tree) anim? 106 true, // Does it catch fire? 107 false, // Is this object crushable by heavy vehicles? 108 false, // Can this object be selected by the player? 109 false, // Can it be the target of a move or attack order? 110 true, // Don't make a big deal about it if it gets destroyed? 111 false, // Is it immune to normal combat damage? 112 "T02", 113 TXT_TREE, 114 TREE_NORMAL, 115 ARMOR_WOOD, 116 (short const *)_List0010, 117 (short const *)_List1001 118 ); 119 120 static TerrainTypeClass const Tree3Class( 121 TERRAIN_TREE3, 122 THEATERF_WINTER|THEATERF_TEMPERATE, 123 XYP_COORD(12,45), // Center base coordinate offset. 124 false, // Spawns Tiberium spontaneously? 125 true, // Does it have destruction animation? 126 false, // Does it have transformation (blossom tree) anim? 127 true, // Does it catch fire? 128 false, // Is this object crushable by heavy vehicles? 129 false, // Can this object be selected by the player? 130 false, // Can it be the target of a move or attack order? 131 true, // Don't make a big deal about it if it gets destroyed? 132 false, // Is it immune to normal combat damage? 133 "T03", 134 TXT_TREE, 135 TREE_NORMAL, 136 ARMOR_WOOD, 137 (short const *)_List0010, 138 (short const *)_List1001 139 ); 140 141 static TerrainTypeClass const Tree4Class( 142 TERRAIN_TREE4, 143 THEATERF_DESERT, 144 XYP_COORD(8,9), // Center base coordinate offset. 145 false, // Spawns Tiberium spontaneously? 146 true, // Does it have destruction animation? 147 false, // Does it have transformation (blossom tree) anim? 148 true, // Does it catch fire? 149 false, // Is this object crushable by heavy vehicles? 150 false, // Can this object be selected by the player? 151 false, // Can it be the target of a move or attack order? 152 true, // Don't make a big deal about it if it gets destroyed? 153 false, // Is it immune to normal combat damage? 154 "T04", 155 TXT_TREE, 156 TREE_NORMAL, 157 ARMOR_WOOD, 158 (short const *)_List1, 159 NULL 160 ); 161 162 163 static TerrainTypeClass const Tree5Class( 164 TERRAIN_TREE5, 165 THEATERF_WINTER|THEATERF_TEMPERATE, 166 XYP_COORD(15,41), // Center base coordinate offset. 167 false, // Spawns Tiberium spontaneously? 168 true, // Does it have destruction animation? 169 false, // Does it have transformation (blossom tree) anim? 170 true, // Does it catch fire? 171 false, // Is this object crushable by heavy vehicles? 172 false, // Can this object be selected by the player? 173 false, // Can it be the target of a move or attack order? 174 true, // Don't make a big deal about it if it gets destroyed? 175 false, // Is it immune to normal combat damage? 176 "T05", 177 TXT_TREE, 178 TREE_NORMAL, 179 ARMOR_WOOD, 180 (short const *)_List0010, 181 (short const *)_List1001 182 ); 183 184 static TerrainTypeClass const Tree6Class( 185 TERRAIN_TREE6, 186 THEATERF_WINTER|THEATERF_TEMPERATE, 187 XYP_COORD(16,37), // Center base coordinate offset. 188 false, // Spawns Tiberium spontaneously? 189 true, // Does it have destruction animation? 190 false, // Does it have transformation (blossom tree) anim? 191 true, // Does it catch fire? 192 false, // Is this object crushable by heavy vehicles? 193 false, // Can this object be selected by the player? 194 false, // Can it be the target of a move or attack order? 195 true, // Don't make a big deal about it if it gets destroyed? 196 false, // Is it immune to normal combat damage? 197 "T06", 198 TXT_TREE, 199 TREE_NORMAL, 200 ARMOR_WOOD, 201 (short const *)_List0010, 202 (short const *)_List1001 203 ); 204 205 static TerrainTypeClass const Tree7Class( 206 TERRAIN_TREE7, 207 THEATERF_WINTER|THEATERF_TEMPERATE, 208 XYP_COORD(15,41), // Center base coordinate offset. 209 false, // Spawns Tiberium spontaneously? 210 true, // Does it have destruction animation? 211 false, // Does it have transformation (blossom tree) anim? 212 true, // Does it catch fire? 213 false, // Is this object crushable by heavy vehicles? 214 false, // Can this object be selected by the player? 215 false, // Can it be the target of a move or attack order? 216 true, // Don't make a big deal about it if it gets destroyed? 217 false, // Is it immune to normal combat damage? 218 "T07", 219 TXT_TREE, 220 TREE_NORMAL, 221 ARMOR_WOOD, 222 (short const *)_List0010, 223 (short const *)_List1001 224 ); 225 226 static TerrainTypeClass const Tree8Class( 227 TERRAIN_TREE8, 228 THEATERF_WINTER|THEATERF_TEMPERATE|THEATERF_DESERT, 229 XYP_COORD(14,22), // Center base coordinate offset. 230 false, // Spawns Tiberium spontaneously? 231 true, // Does it have destruction animation? 232 false, // Does it have transformation (blossom tree) anim? 233 true, // Does it catch fire? 234 false, // Is this object crushable by heavy vehicles? 235 false, // Can this object be selected by the player? 236 false, // Can it be the target of a move or attack order? 237 true, // Don't make a big deal about it if it gets destroyed? 238 false, // Is it immune to normal combat damage? 239 "T08", 240 TXT_TREE, 241 TREE_NORMAL, 242 ARMOR_WOOD, 243 (short const *)_List10, 244 (short const *)_List01 245 ); 246 247 static TerrainTypeClass const Tree9Class( 248 TERRAIN_TREE9, 249 THEATERF_DESERT, 250 XYP_COORD(11,22), // Center base coordinate offset. 251 false, // Spawns Tiberium spontaneously? 252 true, // Does it have destruction animation? 253 false, // Does it have transformation (blossom tree) anim? 254 true, // Does it catch fire? 255 false, // Is this object crushable by heavy vehicles? 256 false, // Can this object be selected by the player? 257 false, // Can it be the target of a move or attack order? 258 true, // Don't make a big deal about it if it gets destroyed? 259 false, // Is it immune to normal combat damage? 260 "T09", 261 TXT_TREE, 262 TREE_NORMAL, 263 ARMOR_WOOD, 264 (short const *)_List10, 265 (short const *)_List01 266 ); 267 268 static TerrainTypeClass const Tree10Class( 269 TERRAIN_TREE10, 270 THEATERF_WINTER|THEATERF_TEMPERATE, 271 XYP_COORD(25,43), // Center base coordinate offset. 272 false, // Spawns Tiberium spontaneously? 273 true, // Does it have destruction animation? 274 false, // Does it have transformation (blossom tree) anim? 275 true, // Does it catch fire? 276 false, // Is this object crushable by heavy vehicles? 277 false, // Can this object be selected by the player? 278 false, // Can it be the target of a move or attack order? 279 true, // Don't make a big deal about it if it gets destroyed? 280 false, // Is it immune to normal combat damage? 281 "T10", 282 TXT_TREE, 283 TREE_NORMAL, 284 ARMOR_WOOD, 285 (short const *)_List0011, 286 (short const *)_List1100 287 ); 288 289 static TerrainTypeClass const Tree11Class( 290 TERRAIN_TREE11, 291 THEATERF_WINTER|THEATERF_TEMPERATE, 292 XYP_COORD(23,44), // Center base coordinate offset. 293 false, // Spawns Tiberium spontaneously? 294 true, // Does it have destruction animation? 295 false, // Does it have transformation (blossom tree) anim? 296 true, // Does it catch fire? 297 false, // Is this object crushable by heavy vehicles? 298 false, // Can this object be selected by the player? 299 false, // Can it be the target of a move or attack order? 300 true, // Don't make a big deal about it if it gets destroyed? 301 false, // Is it immune to normal combat damage? 302 "T11", 303 TXT_TREE, 304 TREE_NORMAL, 305 ARMOR_WOOD, 306 (short const *)_List0011, 307 (short const *)_List1100 308 ); 309 310 static TerrainTypeClass const Tree12Class( 311 TERRAIN_TREE12, 312 THEATERF_WINTER|THEATERF_TEMPERATE, 313 XYP_COORD(14,36), // Center base coordinate offset. 314 false, // Spawns Tiberium spontaneously? 315 true, // Does it have destruction animation? 316 false, // Does it have transformation (blossom tree) anim? 317 true, // Does it catch fire? 318 false, // Is this object crushable by heavy vehicles? 319 false, // Can this object be selected by the player? 320 false, // Can it be the target of a move or attack order? 321 true, // Don't make a big deal about it if it gets destroyed? 322 false, // Is it immune to normal combat damage? 323 "T12", 324 TXT_TREE, 325 TREE_NORMAL, 326 ARMOR_WOOD, 327 (short const *)_List0010, 328 (short const *)_List1001 329 ); 330 331 static TerrainTypeClass const Tree13Class( 332 TERRAIN_TREE13, 333 THEATERF_WINTER|THEATERF_TEMPERATE, 334 XYP_COORD(19,40), // Center base coordinate offset. 335 false, // Spawns Tiberium spontaneously? 336 true, // Does it have destruction animation? 337 false, // Does it have transformation (blossom tree) anim? 338 true, // Does it catch fire? 339 false, // Is this object crushable by heavy vehicles? 340 false, // Can this object be selected by the player? 341 false, // Can it be the target of a move or attack order? 342 true, // Don't make a big deal about it if it gets destroyed? 343 false, // Is it immune to normal combat damage? 344 "T13", 345 TXT_TREE, 346 TREE_NORMAL, 347 ARMOR_WOOD, 348 (short const *)_List0010, 349 (short const *)_List1101 350 ); 351 352 static TerrainTypeClass const Tree14Class( 353 TERRAIN_TREE14, 354 THEATERF_WINTER|THEATERF_TEMPERATE, 355 XYP_COORD(19,40), // Center base coordinate offset. 356 false, // Spawns Tiberium spontaneously? 357 true, // Does it have destruction animation? 358 false, // Does it have transformation (blossom tree) anim? 359 true, // Does it catch fire? 360 false, // Is this object crushable by heavy vehicles? 361 false, // Can this object be selected by the player? 362 false, // Can it be the target of a move or attack order? 363 true, // Don't make a big deal about it if it gets destroyed? 364 false, // Is it immune to normal combat damage? 365 "T14", 366 TXT_TREE, 367 TREE_NORMAL, 368 ARMOR_WOOD, 369 (short const *)_List0011, 370 (short const *)_List1100 371 ); 372 373 static TerrainTypeClass const Tree15Class( 374 TERRAIN_TREE15, 375 THEATERF_WINTER|THEATERF_TEMPERATE, 376 XYP_COORD(19,40), // Center base coordinate offset. 377 false, // Spawns Tiberium spontaneously? 378 true, // Does it have destruction animation? 379 false, // Does it have transformation (blossom tree) anim? 380 true, // Does it catch fire? 381 false, // Is this object crushable by heavy vehicles? 382 false, // Can this object be selected by the player? 383 false, // Can it be the target of a move or attack order? 384 true, // Don't make a big deal about it if it gets destroyed? 385 false, // Is it immune to normal combat damage? 386 "T15", 387 TXT_TREE, 388 TREE_NORMAL, 389 ARMOR_WOOD, 390 (short const *)_List0011, 391 (short const *)_List1100 392 ); 393 394 static TerrainTypeClass const Tree16Class( 395 TERRAIN_TREE16, 396 THEATERF_WINTER|THEATERF_TEMPERATE, 397 XYP_COORD(13,36), // Center base coordinate offset. 398 false, // Spawns Tiberium spontaneously? 399 true, // Does it have destruction animation? 400 false, // Does it have transformation (blossom tree) anim? 401 true, // Does it catch fire? 402 false, // Is this object crushable by heavy vehicles? 403 false, // Can this object be selected by the player? 404 false, // Can it be the target of a move or attack order? 405 true, // Don't make a big deal about it if it gets destroyed? 406 false, // Is it immune to normal combat damage? 407 "T16", 408 TXT_TREE, 409 TREE_NORMAL, 410 ARMOR_WOOD, 411 (short const *)_List0010, 412 (short const *)_List1001 413 ); 414 415 static TerrainTypeClass const Tree17Class( 416 TERRAIN_TREE17, 417 THEATERF_WINTER|THEATERF_TEMPERATE, 418 XYP_COORD(18,44), // Center base coordinate offset. 419 false, // Spawns Tiberium spontaneously? 420 true, // Does it have destruction animation? 421 false, // Does it have transformation (blossom tree) anim? 422 true, // Does it catch fire? 423 false, // Is this object crushable by heavy vehicles? 424 false, // Can this object be selected by the player? 425 false, // Can it be the target of a move or attack order? 426 true, // Don't make a big deal about it if it gets destroyed? 427 false, // Is it immune to normal combat damage? 428 "T17", 429 TXT_TREE, 430 TREE_NORMAL, 431 ARMOR_WOOD, 432 (short const *)_List0010, 433 (short const *)_List1001 434 ); 435 436 static TerrainTypeClass const Tree18Class( 437 TERRAIN_TREE18, 438 THEATERF_DESERT, 439 XYP_COORD(33,40), // Center base coordinate offset. 440 false, // Spawns Tiberium spontaneously? 441 true, // Does it have destruction animation? 442 false, // Does it have transformation (blossom tree) anim? 443 true, // Does it catch fire? 444 false, // Is this object crushable by heavy vehicles? 445 false, // Can this object be selected by the player? 446 false, // Can it be the target of a move or attack order? 447 true, // Don't make a big deal about it if it gets destroyed? 448 false, // Is it immune to normal combat damage? 449 "T18", 450 TXT_TREE, 451 TREE_NORMAL, 452 ARMOR_WOOD, 453 (short const *)_List000010, 454 (short const *)_List111101 455 ); 456 457 static TerrainTypeClass const Split1Class( 458 TERRAIN_BLOSSOMTREE1, 459 THEATERF_TEMPERATE|THEATERF_WINTER, 460 XYP_COORD(18,44), // Center base coordinate offset. 461 true, // Spawns Tiberium spontaneously? 462 false, // Does it have destruction animation? 463 true, // Does it have transformation (blossom tree) anim? 464 false, // Does it catch fire? 465 false, // Is this object crushable by heavy vehicles? 466 false, // Can this object be selected by the player? 467 false, // Can it be the target of a move or attack order? 468 true, // Don't make a big deal about it if it gets destroyed? 469 true, // Is it immune to normal combat damage? 470 "SPLIT2", 471 TXT_BLOSSOM_TREE, 472 TREE_NORMAL, 473 ARMOR_WOOD, 474 (short const *)_List0010, 475 (short const *)_List1101 476 ); 477 478 static TerrainTypeClass const Split2Class( 479 TERRAIN_BLOSSOMTREE2, 480 THEATERF_TEMPERATE|THEATERF_WINTER|THEATERF_DESERT, 481 XYP_COORD(18,44), // Center base coordinate offset. 482 true, // Spawns Tiberium spontaneously? 483 false, // Does it have destruction animation? 484 true, // Does it have transformation (blossom tree) anim? 485 false, // Does it catch fire? 486 false, // Is this object crushable by heavy vehicles? 487 false, // Can this object be selected by the player? 488 false, // Can it be the target of a move or attack order? 489 true, // Don't make a big deal about it if it gets destroyed? 490 true, // Is it immune to normal combat damage? 491 "SPLIT3", 492 TXT_BLOSSOM_TREE, 493 TREE_NORMAL, 494 ARMOR_WOOD, 495 (short const *)_List0010, 496 (short const *)_List1101 497 ); 498 499 static TerrainTypeClass const Clump1Class( 500 TERRAIN_CLUMP1, 501 THEATERF_WINTER|THEATERF_TEMPERATE, 502 XYP_COORD(28,41), // Center base coordinate offset. 503 false, // Spawns Tiberium spontaneously? 504 false, // Does it have destruction animation? 505 false, // Does it have transformation (blossom tree) anim? 506 false, // Does it catch fire? 507 false, // Is this object crushable by heavy vehicles? 508 false, // Can this object be selected by the player? 509 false, // Can it be the target of a move or attack order? 510 true, // Don't make a big deal about it if it gets destroyed? 511 true, // Is it immune to normal combat damage? 512 "TC01", 513 TXT_TREE, 514 TREE_NORMAL, 515 ARMOR_WOOD, 516 (short const *)_List000110, 517 (short const *)_List110001 518 ); 519 520 static TerrainTypeClass const Clump2Class( 521 TERRAIN_CLUMP2, 522 THEATERF_WINTER|THEATERF_TEMPERATE, 523 XYP_COORD(38,41), // Center base coordinate offset. 524 false, // Spawns Tiberium spontaneously? 525 false, // Does it have destruction animation? 526 false, // Does it have transformation (blossom tree) anim? 527 false, // Does it catch fire? 528 false, // Is this object crushable by heavy vehicles? 529 false, // Can this object be selected by the player? 530 false, // Can it be the target of a move or attack order? 531 true, // Don't make a big deal about it if it gets destroyed? 532 true, // Is it immune to normal combat damage? 533 "TC02", 534 TXT_TREE, 535 TREE_NORMAL, 536 ARMOR_WOOD, 537 (short const *)_List010110, 538 (short const *)_List101001 539 ); 540 541 static TerrainTypeClass const Clump3Class( 542 TERRAIN_CLUMP3, 543 THEATERF_WINTER|THEATERF_TEMPERATE, 544 XYP_COORD(33,35), // Center base coordinate offset. 545 false, // Spawns Tiberium spontaneously? 546 false, // Does it have destruction animation? 547 false, // Does it have transformation (blossom tree) anim? 548 false, // Does it catch fire? 549 false, // Is this object crushable by heavy vehicles? 550 false, // Can this object be selected by the player? 551 false, // Can it be the target of a move or attack order? 552 true, // Don't make a big deal about it if it gets destroyed? 553 true, // Is it immune to normal combat damage? 554 "TC03", 555 TXT_TREE, 556 TREE_NORMAL, 557 ARMOR_WOOD, 558 (short const *)_List110110, 559 (short const *)_List001 560 ); 561 562 static TerrainTypeClass const Clump4Class( 563 TERRAIN_CLUMP4, 564 THEATERF_WINTER|THEATERF_TEMPERATE, 565 XYP_COORD(44,49), // Center base coordinate offset. 566 false, // Spawns Tiberium spontaneously? 567 false, // Does it have destruction animation? 568 false, // Does it have transformation (blossom tree) anim? 569 false, // Does it catch fire? 570 false, // Is this object crushable by heavy vehicles? 571 false, // Can this object be selected by the player? 572 false, // Can it be the target of a move or attack order? 573 true, // Don't make a big deal about it if it gets destroyed? 574 true, // Is it immune to normal combat damage? 575 "TC04", 576 TXT_TREE, 577 TREE_NORMAL, 578 ARMOR_WOOD, 579 (short const *)_List000011101000, 580 (short const *)_List111000010110 581 ); 582 583 static TerrainTypeClass const Clump5Class( 584 TERRAIN_CLUMP5, 585 THEATERF_WINTER|THEATERF_TEMPERATE, 586 XYP_COORD(49,58), // Center base coordinate offset. 587 false, // Spawns Tiberium spontaneously? 588 false, // Does it have destruction animation? 589 false, // Does it have transformation (blossom tree) anim? 590 false, // Does it catch fire? 591 false, // Is this object crushable by heavy vehicles? 592 false, // Can this object be selected by the player? 593 false, // Can it be the target of a move or attack order? 594 true, // Don't make a big deal about it if it gets destroyed? 595 true, // Is it immune to normal combat damage? 596 "TC05", 597 TXT_TREE, 598 TREE_NORMAL, 599 ARMOR_WOOD, 600 (short const *)_List001011100110, 601 (short const *)_List110000011001 602 ); 603 604 static TerrainTypeClass const Rock1Class( 605 TERRAIN_ROCK1, 606 THEATERF_DESERT, 607 XYP_COORD(33,41), // Center base coordinate offset. 608 false, // Spawns Tiberium spontaneously? 609 false, // Does it have destruction animation? 610 false, // Does it have transformation (blossom tree) anim? 611 false, // Does it catch fire? 612 false, // Is this object crushable by heavy vehicles? 613 false, // Can this object be selected by the player? 614 false, // Can it be the target of a move or attack order? 615 true, // Don't make a big deal about it if it gets destroyed? 616 true, // Is it immune to normal combat damage? 617 "ROCK1", 618 TXT_ROCK, 619 1000, 620 ARMOR_STEEL, 621 (short const *)_List0011, 622 (short const *)_List111001 623 ); 624 625 static TerrainTypeClass const Rock2Class( 626 TERRAIN_ROCK2, 627 THEATERF_DESERT, 628 XYP_COORD(24,23), // Center base coordinate offset. 629 false, // Spawns Tiberium spontaneously? 630 false, // Does it have destruction animation? 631 false, // Does it have transformation (blossom tree) anim? 632 false, // Does it catch fire? 633 false, // Is this object crushable by heavy vehicles? 634 false, // Can this object be selected by the player? 635 false, // Can it be the target of a move or attack order? 636 true, // Don't make a big deal about it if it gets destroyed? 637 true, // Is it immune to normal combat damage? 638 "ROCK2", 639 TXT_ROCK, 640 1000, 641 ARMOR_STEEL, 642 (short const *)_List1100, 643 (short const *)_List001 644 ); 645 646 static TerrainTypeClass const Rock3Class( 647 TERRAIN_ROCK3, 648 THEATERF_DESERT, 649 XYP_COORD(20,39), // Center base coordinate offset. 650 false, // Spawns Tiberium spontaneously? 651 false, // Does it have destruction animation? 652 false, // Does it have transformation (blossom tree) anim? 653 false, // Does it catch fire? 654 false, // Is this object crushable by heavy vehicles? 655 false, // Can this object be selected by the player? 656 false, // Can it be the target of a move or attack order? 657 true, // Don't make a big deal about it if it gets destroyed? 658 true, // Is it immune to normal combat damage? 659 "ROCK3", 660 TXT_ROCK, 661 1000, 662 ARMOR_STEEL, 663 (short const *)_List000110, 664 (short const *)_List110001 665 ); 666 667 static TerrainTypeClass const Rock4Class( 668 TERRAIN_ROCK4, 669 THEATERF_DESERT, 670 XYP_COORD(12,20), // Center base coordinate offset. 671 false, // Spawns Tiberium spontaneously? 672 false, // Does it have destruction animation? 673 false, // Does it have transformation (blossom tree) anim? 674 false, // Does it catch fire? 675 false, // Is this object crushable by heavy vehicles? 676 false, // Can this object be selected by the player? 677 false, // Can it be the target of a move or attack order? 678 true, // Don't make a big deal about it if it gets destroyed? 679 true, // Is it immune to normal combat damage? 680 "ROCK4", 681 TXT_ROCK, 682 1000, 683 ARMOR_STEEL, 684 (short const *)_List10, 685 (short const *)_List01 686 ); 687 688 static TerrainTypeClass const Rock5Class( 689 TERRAIN_ROCK5, 690 THEATERF_DESERT, 691 XYP_COORD(17,19), // Center base coordinate offset. 692 false, // Spawns Tiberium spontaneously? 693 false, // Does it have destruction animation? 694 false, // Does it have transformation (blossom tree) anim? 695 false, // Does it catch fire? 696 false, // Is this object crushable by heavy vehicles? 697 false, // Can this object be selected by the player? 698 false, // Can it be the target of a move or attack order? 699 true, // Don't make a big deal about it if it gets destroyed? 700 true, // Is it immune to normal combat damage? 701 "ROCK5", 702 TXT_ROCK, 703 1000, 704 ARMOR_STEEL, 705 (short const *)_List10, 706 (short const *)_List01 707 ); 708 709 static TerrainTypeClass const Rock6Class( 710 TERRAIN_ROCK6, 711 THEATERF_DESERT, 712 XYP_COORD(28,40), // Center base coordinate offset. 713 false, // Spawns Tiberium spontaneously? 714 false, // Does it have destruction animation? 715 false, // Does it have transformation (blossom tree) anim? 716 false, // Does it catch fire? 717 false, // Is this object crushable by heavy vehicles? 718 false, // Can this object be selected by the player? 719 false, // Can it be the target of a move or attack order? 720 true, // Don't make a big deal about it if it gets destroyed? 721 true, // Is it immune to normal combat damage? 722 "ROCK6", 723 TXT_ROCK, 724 1000, 725 ARMOR_STEEL, 726 (short const *)_List000111, 727 (short const *)_List110000 728 ); 729 730 static TerrainTypeClass const Rock7Class( 731 TERRAIN_ROCK7, 732 THEATERF_DESERT, 733 XYP_COORD(57,22), // Center base coordinate offset. 734 false, // Spawns Tiberium spontaneously? 735 false, // Does it have destruction animation? 736 false, // Does it have transformation (blossom tree) anim? 737 false, // Does it catch fire? 738 false, // Is this object crushable by heavy vehicles? 739 false, // Can this object be selected by the player? 740 false, // Can it be the target of a move or attack order? 741 true, // Don't make a big deal about it if it gets destroyed? 742 true, // Is it immune to normal combat damage? 743 "ROCK7", 744 TXT_ROCK, 745 1000, 746 ARMOR_STEEL, 747 (short const *)_List11110, 748 (short const *)_List00001 749 ); 750 751 752 TerrainTypeClass const * const TerrainTypeClass::Pointers[TERRAIN_COUNT] = { 753 &Tree1Class, // TERRAIN_TREE1 754 &Tree2Class, // TERRAIN_TREE2 755 &Tree3Class, // TERRAIN_TREE3 756 &Tree4Class, // TERRAIN_TREE4 757 &Tree5Class, // TERRAIN_TREE5 758 &Tree6Class, // TERRAIN_TREE6 759 &Tree7Class, // TERRAIN_TREE7 760 &Tree8Class, // TERRAIN_TREE8 761 &Tree9Class, // TERRAIN_TREE9 762 &Tree10Class, // TERRAIN_TREE10 763 &Tree11Class, // TERRAIN_TREE11 764 &Tree12Class, // TERRAIN_TREE12 765 &Tree13Class, // TERRAIN_TREE13 766 &Tree14Class, // TERRAIN_TREE14 767 &Tree15Class, // TERRAIN_TREE15 768 &Tree16Class, // TERRAIN_TREE16 769 &Tree17Class, // TERRAIN_TREE17 770 &Tree18Class, // TERRAIN_TREE18 771 &Split1Class, // TERRAIN_BLOSSOMTREE1 772 &Split2Class, // TERRAIN_BLOSSOMTREE2 773 &Clump1Class, // TERRAIN_CLUMP1 774 &Clump2Class, // TERRAIN_CLUMP2 775 &Clump3Class, // TERRAIN_CLUMP3 776 &Clump4Class, // TERRAIN_CLUMP4 777 &Clump5Class, // TERRAIN_CLUMP5 778 &Rock1Class, // TERRAIN_ROCK1 779 &Rock2Class, // TERRAIN_ROCK2 780 &Rock3Class, // TERRAIN_ROCK3 781 &Rock4Class, // TERRAIN_ROCK4 782 &Rock5Class, // TERRAIN_ROCK5 783 &Rock6Class, // TERRAIN_ROCK6 784 &Rock7Class // TERRAIN_ROCK7 785 }; 786 787 788 /*********************************************************************************************** 789 * TerrainTypeClass::TerrainTypeClass -- The general constructor for the terrain type objects. * 790 * * 791 * This is the constructor for terrain type objects. It is only used to construct the * 792 * static (constant) terrain type objects. * 793 * * 794 * INPUT: see below.. * 795 * * 796 * OUTPUT: none * 797 * * 798 * WARNINGS: none * 799 * * 800 * HISTORY: * 801 * 07/19/1994 JLB : Created. * 802 *=============================================================================================*/ 803 TerrainTypeClass::TerrainTypeClass( 804 TerrainType terrain, 805 int theater, 806 COORDINATE centerbase, 807 bool is_spawn, 808 bool is_destroyable, 809 bool is_transformable, 810 bool is_flammable, 811 bool is_crushable, 812 bool is_selectable, 813 bool is_legal_target, 814 bool is_insignificant, 815 bool is_immune, 816 char const *ininame, 817 int fullname, unsigned short strength, ArmorType armor, short const *occupy, short const *overlap) : 818 ObjectTypeClass(true, is_flammable, is_crushable, true, is_selectable, 819 is_legal_target, is_insignificant, is_immune, 820 fullname, ininame, armor, strength) 821 { 822 CenterBase = centerbase; 823 IsTiberiumSpawn = is_spawn; 824 IsDestroyable = is_destroyable; 825 IsTransformable = is_transformable; 826 Theater = theater; 827 Type = terrain; 828 Occupy = occupy; 829 Overlap = overlap; 830 } 831 832 833 /*********************************************************************************************** 834 * TerrainTypeClass::Init -- Loads terrain object shape files. * 835 * * 836 * This routine is used to load up the terrain object shape files. * 837 * The shape files loaded depends on theater. * 838 * * 839 * INPUT: theater -- The theater to load the terrain shape data for. * 840 * * 841 * OUTPUT: none * 842 * * 843 * WARNINGS: none * 844 * * 845 * HISTORY: * 846 * 05/16/1994 JLB : Created. * 847 *=============================================================================================*/ 848 void TerrainTypeClass::Init(TheaterType theater) 849 { 850 if (theater != LastTheater){ 851 for (TerrainType index = TERRAIN_FIRST; index < TERRAIN_COUNT; index++) { 852 TerrainTypeClass const & terrain = As_Reference(index); 853 char fullname[_MAX_FNAME+_MAX_EXT]; 854 855 /* 856 ** Clear any existing shape pointer. All terrain is theater specific, thus if 857 ** it isn't loaded in this routine, it shouldn't exist at all. 858 */ 859 ((void const *&)terrain.ImageData) = NULL; 860 861 if (terrain.Theater & (1 << theater)) { 862 863 /* 864 ** Load in the appropriate object shape data. 865 */ 866 _makepath(fullname, NULL, NULL, terrain.IniName, Theaters[theater].Suffix); 867 ((void const *&)terrain.ImageData) = MixFileClass::Retrieve(fullname); 868 869 IsTheaterShape = true; 870 if (terrain.RadarIcon) delete[] (char *)terrain.RadarIcon; 871 ((void const *&)terrain.RadarIcon) = Get_Radar_Icon(terrain.Get_Image_Data(), 0, 1, 3); 872 IsTheaterShape = false; 873 } 874 } 875 } 876 } 877 878 879 /*********************************************************************************************** 880 * TerrainTypeClass::From_Name -- Convert name to terrain type. * 881 * * 882 * This routine is used to convert a text name into the matching * 883 * terrain type number. This is used during scenario initialization. * 884 * * 885 * INPUT: name -- The name to convert. * 886 * * 887 * OUTPUT: Returns the TerrainType that matches the name specified. If * 888 * no match was found, then TERRAIN_NONE is returned. * 889 * * 890 * WARNINGS: none * 891 * * 892 * HISTORY: * 893 * 05/16/1994 JLB : Created. * 894 *=============================================================================================*/ 895 TerrainType TerrainTypeClass::From_Name(char const * name) 896 { 897 TerrainType index; 898 899 if (name) { 900 for (index = TERRAIN_FIRST; index < TERRAIN_COUNT; index++) { 901 if (stricmp(name, Pointers[index]->IniName) == 0) { 902 return(index); 903 } 904 } 905 } 906 return(TERRAIN_NONE); 907 } 908 909 910 #ifdef SCENARIO_EDITOR 911 /*********************************************************************************************** 912 * TerrainTypeClass::Display -- Display a generic terrain object. * 913 * * 914 * This routine is used to display a generic terrain object. Typical * 915 * use is during scenario editing. * 916 * * 917 * INPUT: x,y -- Pixel coordinates to display object at (centered). * 918 * * 919 * window-- The window to display the object within. * 920 * * 921 * OUTPUT: none * 922 * * 923 * WARNINGS: none * 924 * * 925 * HISTORY: * 926 * 05/16/1994 JLB : Created. * 927 *=============================================================================================*/ 928 void TerrainTypeClass::Display(int x, int y, WindowNumberType window, HousesType) const 929 { 930 CC_Draw_Shape(Get_Image_Data(), 0, x, y, window, SHAPE_NORMAL|SHAPE_CENTER|SHAPE_WIN_REL); 931 } 932 933 934 /*********************************************************************************************** 935 * TerrainTypeClass::Prep_For_Add -- Prepares to add terrain object. * 936 * * 937 * Submits all of the valid terrain objects to the scenario editor for possible selection * 938 * and subsequent placement on the map. All terrain objects, that have a valid shape * 939 * file available, are added. * 940 * * 941 * INPUT: none * 942 * * 943 * OUTPUT: none * 944 * * 945 * WARNINGS: none * 946 * * 947 * HISTORY: * 948 * 05/23/1994 JLB : Created. * 949 *=============================================================================================*/ 950 void TerrainTypeClass::Prep_For_Add(void) 951 { 952 for (TerrainType index = TERRAIN_FIRST; index < TERRAIN_COUNT; index++) { 953 if (As_Reference(index).Get_Image_Data()) { 954 Map.Add_To_List(&As_Reference(index)); 955 } 956 } 957 } 958 #endif 959 960 961 /*********************************************************************************************** 962 * TerrainTypeClass::Create_And_Place -- Creates and places terrain object on map. * 963 * * 964 * This support routine is used by the scenario editor to add a terrain object to the map. * 965 * * 966 * INPUT: cell -- The cell to place the terrain object in. * 967 * * 968 * OUTPUT: bool; Was the placement successful? * 969 * * 970 * WARNINGS: none * 971 * * 972 * HISTORY: * 973 * 05/28/1994 JLB : Created. * 974 *=============================================================================================*/ 975 bool TerrainTypeClass::Create_And_Place(CELL cell, HousesType ) const 976 { 977 if (new TerrainClass(Type, cell)) { 978 return(true); 979 } 980 return(false); 981 } 982 983 984 /*********************************************************************************************** 985 * TerrainTypeClass::Create_On_Of -- Creates a terrain object from type. * 986 * * 987 * This is used to create a terrain object by using the terrain type as a guide. This * 988 * routine is typically used by the scenario editor in order to place a terrain object * 989 * onto the map. * 990 * * 991 * INPUT: none * 992 * * 993 * OUTPUT: Returns with a pointer to the created terrain object or NULL if one couldn't be * 994 * created. * 995 * * 996 * WARNINGS: none * 997 * * 998 * HISTORY: * 999 * 07/19/1994 JLB : Created. * 1000 *=============================================================================================*/ 1001 ObjectClass * TerrainTypeClass::Create_One_Of(HouseClass *) const 1002 { 1003 return(new TerrainClass(Type, -1)); 1004 } 1005 1006 1007 short const * TerrainTypeClass::Occupy_List(bool ) const 1008 { 1009 if (Occupy) return(Occupy); 1010 1011 static short const _simple[1] = { 1012 REFRESH_EOL 1013 }; 1014 return(&_simple[0]); 1015 } 1016 1017 1018 short const * TerrainTypeClass::Overlap_List(void) const 1019 { 1020 if (Overlap) return(Overlap); 1021 1022 static short const _simple[1] = { 1023 REFRESH_EOL 1024 }; 1025 return(&_simple[0]); 1026 }