1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338
|
/*
===========================================================================
Copyright (C) 2015 the OpenMoHAA team
This file is part of OpenMoHAA source code.
OpenMoHAA source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
OpenMoHAA source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenMoHAA source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// actor.h: Base class for character AI.
#pragma once
#include "g_local.h"
#include "simpleactor.h"
#include "actorenemy.h"
#include "level.h"
#include "game.h"
#include "gamescript.h"
#include "scriptmaster.h"
#include "grenadehint.h"
#include "parm.h"
//
// Export these events for AISpawnPoint (since 2.30)
//
extern Event EV_Actor_SetGun;
extern Event EV_Actor_SetGun2;
extern Event EV_Actor_GetGun;
extern Event EV_Actor_GetSight;
extern Event EV_Actor_SetSight;
extern Event EV_Actor_SetSight2;
extern Event EV_Actor_GetHearing;
extern Event EV_Actor_SetHearing;
extern Event EV_Actor_SetHearing2;
extern Event EV_Actor_GetFov;
extern Event EV_Actor_SetFov;
extern Event EV_Actor_SetFov2;
extern Event EV_Actor_SetTypeIdle;
extern Event EV_Actor_SetTypeIdle2;
extern Event EV_Actor_GetTypeIdle;
extern Event EV_Actor_SetTypeAttack;
extern Event EV_Actor_SetTypeAttack2;
extern Event EV_Actor_GetTypeAttack;
extern Event EV_Actor_SetTypeDisguise;
extern Event EV_Actor_SetTypeDisguise2;
extern Event EV_Actor_GetTypeDisguise;
extern Event EV_Actor_SetDisguiseLevel;
extern Event EV_Actor_SetDisguiseLevel2;
extern Event EV_Actor_GetDisguiseLevel;
extern Event EV_Actor_SetTypeGrenade;
extern Event EV_Actor_SetTypeGrenade2;
extern Event EV_Actor_GetTypeGrenade;
extern Event EV_Actor_SetPatrolPath;
extern Event EV_Actor_SetPatrolPath2;
extern Event EV_Actor_GetPatrolPath;
extern Event EV_Actor_SetPatrolWaitTrigger;
extern Event EV_Actor_SetPatrolWaitTrigger2;
extern Event EV_Actor_GetPatrolWaitTrigger;
extern Event EV_Actor_SetAlarmNode;
extern Event EV_Actor_SetAlarmNode2;
extern Event EV_Actor_GetAlarmNode;
extern Event EV_Actor_SetAccuracy;
extern Event EV_Actor_SetAccuracy2;
extern Event EV_Actor_GetAccuracy;
extern Event EV_Actor_SetMinDistance;
extern Event EV_Actor_SetMinDistance2;
extern Event EV_Actor_GetMinDistance;
extern Event EV_Actor_SetMaxDistance;
extern Event EV_Actor_SetMaxDistance2;
extern Event EV_Actor_GetMaxDistance;
extern Event EV_Actor_GetLeash;
extern Event EV_Actor_SetLeash;
extern Event EV_Actor_SetLeash2;
extern Event EV_Actor_GetInterval;
extern Event EV_Actor_SetInterval;
extern Event EV_Actor_SetInterval2;
extern Event EV_Actor_SetDisguiseRange;
extern Event EV_Actor_SetDisguiseRange2;
extern Event EV_Actor_GetDisguiseRange;
extern Event EV_Actor_SetDisguisePeriod;
extern Event EV_Actor_SetDisguisePeriod2;
extern Event EV_Actor_GetDisguisePeriod;
extern Event EV_Actor_SetGrenadeAwareness;
extern Event EV_Actor_SetGrenadeAwareness2;
extern Event EV_Actor_GetGrenadeAwareness;
extern Event EV_Actor_SetTurret;
extern Event EV_Actor_SetTurret2;
extern Event EV_Actor_GetTurret;
extern Event EV_Actor_SetSoundAwareness;
extern Event EV_Actor_SetSoundAwareness2;
extern Event EV_Actor_GetSoundAwareness;
extern Event EV_Actor_SetGrenadeAwareness;
extern Event EV_Actor_SetGrenadeAwareness2;
extern Event EV_Actor_SetAmmoGrenade;
extern Event EV_Actor_SetAmmoGrenade2;
extern Event EV_Actor_GetAmmoGrenade;
extern Event EV_Actor_GetMaxNoticeTimeScale;
extern Event EV_Actor_SetMaxNoticeTimeScale;
extern Event EV_Actor_SetMaxNoticeTimeScale2;
extern Event EV_Actor_GetFixedLeash;
extern Event EV_Actor_SetFixedLeash;
extern Event EV_Actor_SetFixedLeash2;
extern Event EV_Actor_GetEnemyShareRange;
extern Event EV_Actor_SetEnemyShareRange;
extern Event EV_Actor_SetEnemyShareRange2;
extern Event EV_Actor_SetWeapon;
extern Event EV_Actor_GetWeapon;
extern Event EV_Actor_GetVoiceType;
extern Event EV_Actor_SetVoiceType;
extern Event EV_Actor_SetVoiceType2;
extern Event EV_Actor_GetFavoriteEnemy;
extern Event EV_Actor_SetFavoriteEnemy;
extern Event EV_Actor_SetFavoriteEnemy2;
extern Event EV_Actor_SetBalconyHeight;
extern Event EV_Actor_SetBalconyHeight2;
extern Event EV_Actor_GetBalconyHeight;
extern Event EV_Actor_GetNoSurprise;
extern Event EV_Actor_SetNoSurprise;
extern Event EV_Actor_SetNoSurprise2;
extern Event EV_Actor_DeathEmbalm;
// Bones used by actor
//#define ACTOR_MOUTH_TAG 0
#define ACTOR_HEAD_TAG 0
#define ACTOR_TORSO_TAG 1
// Dialog stuff
#define LIP_SYNC_HZ 20.0
#define MAX_DIALOG_PARAMETERS_LENGTH 100
#define MAX_DIALOG_PARM_LENGTH 64
#define MAX_DIALOG_PARMS 10
#define DIALOG_PARM_TYPE_NONE 0
#define DIALOG_PARM_TYPE_PLAYERHAS 1
#define DIALOG_PARM_TYPE_PLAYERHASNOT 2
#define DIALOG_PARM_TYPE_HAS 3
#define DIALOG_PARM_TYPE_HASNOT 4
#define DIALOG_PARM_TYPE_DEPENDS 5
#define DIALOG_PARM_TYPE_DEPENDSNOT 6
typedef struct {
byte type;
char parm[MAX_DIALOG_PARM_LENGTH];
} DialogParm_t;
typedef struct DialogNode_s {
char alias_name[MAX_ALIAS_NAME_LENGTH];
int random_flag;
int number_of_parms;
float random_percent;
DialogParm_t parms[MAX_DIALOG_PARMS];
struct DialogNode_s *next;
} DialogNode_t;
typedef enum {
IS_INANIMATE,
IS_MONSTER,
IS_ENEMY,
IS_CIVILIAN,
IS_FRIEND,
IS_ANIMAL,
NUM_ACTORTYPES
} actortype_t;
// Stimuli types
#define STIMULI_ALL -1
#define STIMULI_NONE 0
#define STIMULI_SIGHT (1 << 0)
#define STIMULI_SOUND (1 << 1)
#define STIMULI_PAIN (1 << 2)
#define STIMULI_SCRIPT (1 << 3)
#define MAX_INACTIVE_TIME 30.0
// State flags
#define STATE_FLAG_IN_PAIN (1 << 0)
#define STATE_FLAG_MELEE_HIT (1 << 1)
#define STATE_FLAG_TOUCHED (1 << 2)
#define STATE_FLAG_ACTIVATED (1 << 3)
#define STATE_FLAG_USED (1 << 4)
#define STATE_FLAG_TWITCH (1 << 5)
#define STATE_FLAG_BLOCKED_HIT (1 << 6)
#define STATE_FLAG_SMALL_PAIN (1 << 7)
#define STATE_FLAG_OTHER_DIED (1 << 8)
#define STATE_FLAG_STUCK (1 << 9)
#define STATE_FLAG_NO_PATH (1 << 10)
// Actor modes
#define ACTOR_MODE_NONE 0
#define ACTOR_MODE_IDLE 1
#define ACTOR_MODE_AI 2
#define ACTOR_MODE_SCRIPT 3
#define ACTOR_MODE_TALK 4
// Pain types
#define PAIN_SMALL 0
#define PAIN_BIG 1
typedef struct {
EntityPtr ent;
unsigned int state_flags;
} part_t;
// Actor flags
#define ACTOR_FLAG_NOISE_HEARD 0
#define ACTOR_FLAG_INVESTIGATING 1
#define ACTOR_FLAG_DEATHGIB 2
#define ACTOR_FLAG_DEATHFADE 3
#define ACTOR_FLAG_NOCHATTER 4
#define ACTOR_FLAG_INACTIVE 5
#define ACTOR_FLAG_ANIM_DONE 6
#define ACTOR_FLAG_STATE_DONE_TIME_VALID 7
#define ACTOR_FLAG_AI_ON 8
#define ACTOR_FLAG_LAST_CANSEEENEMY 9
#define ACTOR_FLAG_LAST_CANSEEENEMY_NOFOV 10
#define ACTOR_FLAG_DIALOG_PLAYING 11
#define ACTOR_FLAG_ALLOW_TALK 12
#define ACTOR_FLAG_DAMAGE_ONCE_ON 13
#define ACTOR_FLAG_DAMAGE_ONCE_DAMAGED 14
#define ACTOR_FLAG_BOUNCE_OFF 15
#define ACTOR_FLAG_NOTIFY_OTHERS_AT_DEATH 16
#define ACTOR_FLAG_HAS_THING1 17
#define ACTOR_FLAG_HAS_THING2 18
#define ACTOR_FLAG_HAS_THING3 19
#define ACTOR_FLAG_HAS_THING4 20
#define ACTOR_FLAG_LAST_ATTACK_HIT 21
#define ACTOR_FLAG_STARTED 22
#define ACTOR_FLAG_ALLOW_HANGBACK 23
#define ACTOR_FLAG_USE_GRAVITY 24
#define ACTOR_FLAG_SPAWN_FAILED 25
#define ACTOR_FLAG_FADING_OUT 26
#define ACTOR_FLAG_DEATHSHRINK 27
#define ACTOR_FLAG_DEATHSINK 28
#define ACTOR_FLAG_STAYSOLID 29
#define ACTOR_FLAG_STUNNED 30
#define ACTOR_FLAG_ALLOW_FALL 31
#define ACTOR_FLAG_FINISHED 32
#define ACTOR_FLAG_IN_LIMBO 33
#define ACTOR_FLAG_CAN_WALK_ON_OTHERS 34
#define ACTOR_FLAG_PUSHABLE 35
#define ACTOR_FLAG_LAST_TRY_TALK 36
#define ACTOR_FLAG_ATTACKABLE_BY_ACTORS 37
#define ACTOR_FLAG_TARGETABLE 38
#define ACTOR_FLAG_ATTACK_ACTORS 39
#define ACTOR_FLAG_IMMORTAL 40
#define ACTOR_FLAG_TURNING_HEAD 41
#define ACTOR_FLAG_DIE_COMPLETELY 42
#define ACTOR_FLAG_BLEED_AFTER_DEATH 43
#define ACTOR_FLAG_IGNORE_STUCK_WARNING 44
#define ACTOR_FLAG_IGNORE_OFF_GROUND_WARNING 45
#define ACTOR_FLAG_ALLOWED_TO_KILL 46
#define ACTOR_FLAG_TOUCH_TRIGGERS 47
#define ACTOR_FLAG_IGNORE_WATER 48
#define ACTOR_FLAG_NEVER_IGNORE_SOUNDS 49
#define ACTOR_FLAG_SIMPLE_PATHFINDING 50
#define ACTOR_FLAG_HAVE_MOVED 51
#define ACTOR_FLAG_NO_PAIN_SOUNDS 52
#define ACTOR_FLAG_UPDATE_BOSS_HEALTH 53
#define ACTOR_FLAG_IGNORE_PAIN_FROM_ACTORS 54
#define ACTOR_FLAG_DAMAGE_ALLOWED 55
#define ACTOR_FLAG_ALWAYS_GIVE_WATER 56
// Look flags
#define LOOK_FLAG_EYE (1 << 0)
// The last actor_flag number and this one (ACTOR_FLAG_MAX) should match
#define ACTOR_FLAG_MAX 56
#define MAX_ORIGIN_HISTORY 4
#define MAX_COVER_NODES 16
#define MAX_BODYQUEUE 5
typedef enum {
AI_GREN_TOSS_NONE,
AI_GREN_TOSS_THROW,
AI_GREN_TOSS_ROLL,
AI_GREN_TOSS_HINT,
AI_GREN_KICK
} eGrenadeTossMode;
typedef enum {
AI_GRENSTATE_FLEE,
AI_GRENSTATE_THROW_ACQUIRE,
AI_GRENSTATE_THROW,
AI_GRENSTATE_KICK_ACQUIRE,
AI_GRENSTATE_KICK,
AI_GRENSTATE_MARTYR_ACQUIRE,
AI_GRENSTATE_MARTYR,
AI_GRENSTATE_UNK,
AI_GRENSTATE_FLEE_SUCCESS, //fled the grenade successfully, I'm safe
AI_GRENSTATE_FLEE_FAIL, //failed to flee, I'm gonna get hurt or die :'(
} eGrenadeState;
typedef struct {
byte length;
byte currentPos;
byte loop;
float startTime;
vec3_t pos[1];
} FallPath;
enum eThinkState {
THINKSTATE_VOID,
THINKSTATE_IDLE,
THINKSTATE_PAIN,
THINKSTATE_KILLED,
THINKSTATE_ATTACK,
THINKSTATE_CURIOUS,
THINKSTATE_DISGUISE,
THINKSTATE_BADPLACE, // Added in 2.0
THINKSTATE_GRENADE,
THINKSTATE_NOCLIP,
NUM_THINKSTATES,
};
enum eThinkNum {
THINK_VOID,
THINK_TURRET,
THINK_COVER,
THINK_PATROL,
THINK_RUNNER,
THINK_PAIN,
THINK_KILLED,
THINK_MOVETO,
THINK_IDLE,
THINK_CURIOUS,
THINK_DISGUISE_SALUTE,
THINK_DISGUISE_SENTRY,
THINK_DISGUISE_OFFICER,
THINK_DISGUISE_ROVER,
THINK_DISGUISE_NONE,
THINK_ALARM,
THINK_GRENADE,
THINK_MACHINEGUNNER,
THINK_DOG_IDLE,
THINK_DOG_ATTACK,
THINK_DOG_CURIOUS,
THINK_DOG_GRENADE,
THINK_ANIM,
THINK_ANIM_CURIOUS,
THINK_AIM,
THINK_BALCONY_IDLE,
THINK_BALCONY_CURIOUS,
THINK_BALCONY_ATTACK,
THINK_BALCONY_DISGUISE,
THINK_BALCONY_GRENADE,
THINK_BALCONY_PAIN,
THINK_BALCONY_KILLED,
THINK_WEAPONLESS,
THINK_NOCLIP,
THINK_DEAD,
THINK_BADPLACE, // Added in 2.0
THINK_RUN_AND_SHOOT, // Added in 2.30
NUM_THINKS,
};
enum eThinkLevel {
THINKLEVEL_IDLE,
THINKLEVEL_PAIN,
THINKLEVEL_KILLED,
THINKLEVEL_NOCLIP,
NUM_THINKLEVELS
};
enum eActorNationality {
ACTOR_NATIONALITY_DEFAULT,
ACTOR_NATIONALITY_AMERICAN,
ACTOR_NATIONALITY_GERMAN,
ACTOR_NATIONALITY_ITALIAN,
ACTOR_NATIONALITY_BRITISH,
ACTOR_NATIONALITY_RUSSIAN,
};
//
// Actor states
//
enum eActorState {
ACTOR_STATE_DISGUISE = 0,
ACTOR_STATE_TURRET = 100,
ACTOR_STATE_BALCONY_ATTACK = 200,
ACTOR_STATE_COVER = 300,
ACTOR_STATE_PAIN = 500,
ACTOR_STATE_ALARM = 600,
ACTOR_STATE_KILLED = 700,
ACTOR_STATE_BALCONY_KILLED = 800,
ACTOR_STATE_WEAPONLESS = 900,
ACTOR_STATE_ANIMATION = 1000,
ACTOR_STATE_CURIOUS = 1100,
ACTOR_STATE_MACHINE_GUNNER = 1200,
// Added in 2.30
ACTOR_STATE_RUN_AND_SHOOT = 1300,
};
//
// Disguise think state
//
enum eActorState_Disguise {
ACTOR_STATE_DISGUISE_START = ACTOR_STATE_DISGUISE,
ACTOR_STATE_DISGUISE_WAIT = ACTOR_STATE_DISGUISE_START,
ACTOR_STATE_DISGUISE_PAPERS,
ACTOR_STATE_DISGUISE_ACCEPT,
ACTOR_STATE_DISGUISE_ENEMY,
ACTOR_STATE_DISGUISE_HALT,
ACTOR_STATE_DISGUISE_DENY,
};
//
// Turret think state
//
enum eActorState_Turret {
ACTOR_STATE_TURRET_START = ACTOR_STATE_TURRET,
ACTOR_STATE_TURRET_COMBAT = ACTOR_STATE_TURRET_START,
ACTOR_STATE_TURRET_REACQUIRE,
ACTOR_STATE_TURRET_TAKE_SNIPER_NODE,
ACTOR_STATE_TURRET_SNIPER_NODE,
ACTOR_STATE_TURRET_RUN_HOME,
ACTOR_STATE_TURRET_RUN_AWAY,
ACTOR_STATE_TURRET_CHARGE,
ACTOR_STATE_TURRET_GRENADE,
ACTOR_STATE_TURRET_INTRO_AIM,
ACTOR_STATE_TURRET_FAKE_ENEMY,
ACTOR_STATE_TURRET_COVER_INSTEAD,
ACTOR_STATE_TURRET_BECOME_COVER,
ACTOR_STATE_TURRET_WAIT,
ACTOR_STATE_TURRET_SHOOT, // Added in 2.0
ACTOR_STATE_TURRET_RETARGET_SUPPRESS, // Added in 2.0
ACTOR_STATE_TURRET_RETARGET_SNIPER_NODE,
ACTOR_STATE_TURRET_RETARGET_STEP_SIDE_SMALL,
ACTOR_STATE_TURRET_RETARGET_PATH_EXACT,
ACTOR_STATE_TURRET_RETARGET_PATH_NEAR,
ACTOR_STATE_TURRET_RETARGET_STEP_SIDE_MEDIUM,
ACTOR_STATE_TURRET_RETARGET_STEP_SIDE_LARGE,
ACTOR_STATE_TURRET_RETARGET_STEP_FACE_MEDIUM,
ACTOR_STATE_TURRET_RETARGET_STEP_FACE_LARGE,
ACTOR_STATE_TURRET_NUM_STATES
};
//
// Balcony attack think state
//
enum eActorState_BalconyAttack {
ACTOR_STATE_BALCONY_ATTACK_START = ACTOR_STATE_BALCONY_ATTACK,
ACTOR_STATE_BALCONY_ATTACK_FIND_ENEMY = ACTOR_STATE_BALCONY_ATTACK_START,
ACTOR_STATE_BALCONY_ATTACK_TARGET,
ACTOR_STATE_BALCONY_ATTACK_SHOOT
};
//
// Balcony cover think state
//
enum eActorState_Cover {
ACTOR_STATE_COVER_START = ACTOR_STATE_COVER,
ACTOR_STATE_COVER_NEW_ENEMY = ACTOR_STATE_COVER_START,
ACTOR_STATE_COVER_FIND_COVER,
ACTOR_STATE_COVER_TAKE_COVER,
ACTOR_STATE_COVER_FINISH_RELOADING,
ACTOR_STATE_COVER_SPECIAL_ATTACK,
ACTOR_STATE_COVER_FIND_ENEMY,
ACTOR_STATE_COVER_SEARCH_NODE,
ACTOR_STATE_COVER_TARGET,
ACTOR_STATE_COVER_HIDE,
ACTOR_STATE_COVER_SHOOT,
ACTOR_STATE_COVER_GRENADE,
ACTOR_STATE_COVER_HUNT_ENEMY,
ACTOR_STATE_COVER_LOOP,
ACTOR_STATE_COVER_FAKE_ENEMY,
};
//
// Pain think state
//
enum eActorState_Pain {
ACTOR_STATE_PAIN_START = ACTOR_STATE_PAIN,
ACTOR_STATE_PAIN_INITIAL = ACTOR_STATE_PAIN_START,
ACTOR_STATE_PAIN_MAIN
};
//
// Alarm think state
//
enum eActorState_Alarm {
ACTOR_STATE_ALARM_START = ACTOR_STATE_ALARM,
ACTOR_STATE_ALARM_IDLE = ACTOR_STATE_ALARM_START,
ACTOR_STATE_ALARM_MOVE
};
//
// Killed think state
//
enum eActorState_Killed {
ACTOR_STATE_KILLED_START = ACTOR_STATE_KILLED,
ACTOR_STATE_KILLED_BEGIN = ACTOR_STATE_KILLED_START,
ACTOR_STATE_KILLED_END
};
//
// Balcony killed think state
//
enum eActorState_BalconyKilled {
ACTOR_STATE_BALCONY_KILLED_START = ACTOR_STATE_BALCONY_KILLED,
ACTOR_STATE_BALCONY_KILLED_BEGIN = ACTOR_STATE_BALCONY_KILLED_START,
ACTOR_STATE_BALCONY_KILLED_INTRO,
ACTOR_STATE_BALCONY_KILLED_LOOP,
ACTOR_STATE_BALCONY_KILLED_LOOP_END,
ACTOR_STATE_BALCONY_KILLED_OUTTRO,
ACTOR_STATE_BALCONY_KILLED_END,
ACTOR_STATE_BALCONY_KILLED_NORMAL,
};
//
// Weaponless think state
//
enum eActorState_WeaponLess {
ACTOR_STATE_WEAPONLESS_START = ACTOR_STATE_WEAPONLESS,
ACTOR_STATE_WEAPONLESS_NORMAL = ACTOR_STATE_WEAPONLESS_START,
ACTOR_STATE_WEAPONLESS_GRENADE,
ACTOR_STATE_WEAPONLESS_LOOP
};
//
// Animation think state
//
enum eActorState_Animation {
ACTOR_STATE_ANIMATION_START = ACTOR_STATE_ANIMATION,
ACTOR_STATE_ANIMATION_INITIAL = ACTOR_STATE_ANIMATION_START,
ACTOR_STATE_ANIMATION_MAIN,
};
//
// Curious think state
//
enum eActorState_Curious {
ACTOR_STATE_CURIOUS_START = ACTOR_STATE_CURIOUS,
ACTOR_STATE_CURIOUS_BEGIN = ACTOR_STATE_CURIOUS_START,
ACTOR_STATE_CURIOUS_RUNNING
};
//
// Machine gunner think state
//
enum eActorState_MachineGunner {
ACTOR_STATE_MACHINE_GUNNER_START = ACTOR_STATE_MACHINE_GUNNER,
ACTOR_STATE_MACHINE_GUNNER_READY = ACTOR_STATE_MACHINE_GUNNER_START,
ACTOR_STATE_MACHINE_GUNNER_RELOADING
};
//
// Run and shoot think state
//
enum eActorState_RunAndShoot {
ACTOR_STATE_RUN_AND_SHOOT_START = ACTOR_STATE_RUN_AND_SHOOT,
ACTOR_STATE_RUN_AND_SHOOT_RUN = ACTOR_STATE_RUN_AND_SHOOT_START,
ACTOR_STATE_RUN_AND_SHOOT_RUNNING
};
class Actor;
typedef SafePtr<Actor> ActorPtr;
class Actor : public SimpleActor
{
struct GlobalFuncs_t {
void (Actor::*ThinkState)(void);
void (Actor::*BeginState)(void);
void (Actor::*ResumeState)(void);
void (Actor::*EndState)(void);
void (Actor::*SuspendState)(void);
void (Actor::*RestartState)(void);
void (Actor::*FinishedAnimation)(void);
void (Actor::*PostShoot)(void);
void (Actor::*Pain)(Event *ev);
void (Actor::*Killed)(Event *ev, bool bPlayDeathAnim);
bool (Actor::*PassesTransitionConditions)(void);
void (Actor::*ShowInfo)(void);
void (Actor::*PathnodeClaimRevoked)(void);
void (Actor::*ReceiveAIEvent)(
vec3_t event_origin, int iType, Entity *originator, float fDistSquared, float fMaxDistSquared
);
bool (*IsState)(int state);
};
public:
/* GlobalFuncs: contains different funcs needed for each actor think
* think is basically a mode for the actor
* when m_ThinkLevel changes, new think value is inside m_Think
* to access current think : m_Think[m_ThinkLevel]
* to access GlobalFuncs related to current think
* GlobalFuncs[m_Think[m_ThinkLevel]];
**/
static GlobalFuncs_t GlobalFuncs[NUM_THINKS];
/* const string array containig think names */
static const_str m_csThinkNames[NUM_THINKS];
/* const string array containig think state names */
static const_str m_csThinkStateNames[NUM_THINKSTATES];
/* map contating every think value for each thinkstate */
eThinkNum m_ThinkMap[NUM_THINKSTATES];
/* think state for every think level */
eThinkState m_ThinkStates[NUM_THINKLEVELS];
/* think value for every think level */
eThinkNum m_Think[NUM_THINKLEVELS];
/* current think level
* think levels are more like priorities
* highest level is used.
**/
eThinkLevel m_ThinkLevel;
/* current think state*/
eThinkState m_ThinkState;
/* current state (different than think state) */
int m_State;
/* current state change time */
int m_iStateTime;
/* should lock think state ? */
bool m_bLockThinkState;
/* think state changed */
bool m_bDirtyThinkState;
/* debug state for m_State */
const char *m_pszDebugState;
/* currently animating ( used in G_RunFrame ) */
bool m_bAnimating;
/* 2.0: ignore bad place? */
bool m_bIgnoreBadPlace;
/* 2.0: bad place index? (0=none) */
int m_iBadPlaceIndex;
/* char refereing to voice type, chec gAmericanVoices and gGermanVoices */
int mVoiceType;
/* check EV_Actor_GetSilent, EV_Actor_SetSilent and EV_Actor_SetSilent2 */
bool m_bSilent;
/* check EV_Actor_GetNoSurprise, EV_Actor_SetNoSurprise and EV_Actor_SetNoSurprise2 */
bool m_bNoSurprise;
/* actor can mumble ? */
bool m_bMumble;
/* actor is allowed to have steamy breath */
bool m_bBreathSteam;
/* const string of head model */
const_str m_csHeadModel;
/* const string of head skin */
const_str m_csHeadSkin;
/* const string of weapon model */
const_str m_csWeapon;
/* const string of REAL weapon model (check Actor::EventGiveWeapon) */
const_str m_csLoadOut;
/* favorite enemy */
SentientPtr m_FavoriteEnemy;
/* last time enemy was checked */
int m_iEnemyCheckTime;
/* last time enemy was changed */
int m_iEnemyChangeTime;
/* last time a visible(CanSee) enemy was checked */
int m_iEnemyVisibleCheckTime;
/* last time a visible(CanSee) enemy was changed */
int m_iEnemyVisibleChangeTime;
/* last time a visible(CanSee) enemy was seen */
int m_iLastEnemyVisibleTime;
/* 2.0: visibility alpha */
float m_fVisibilityAlpha;
/* 2.0: max visibility threshold */
float m_fVisibilityThreshold;
/* last time a visible(CanSee + infov) enemy was checked */
int m_iEnemyFovCheckTime;
/* last time a visible(CanSee + infov) enemy was changed */
int m_iEnemyFovChangeTime;
/* last known enemy position. */
Vector m_vLastEnemyPos;
/* last time enemy position was changed. */
int m_iLastEnemyPosChangeTime;
/* check EV_Actor_GetEnemyShareRange and EV_Actor_SetEnemyShareRange */
float m_fMaxShareDistSquared;
/* can actor shoot enemy ? */
bool m_bCanShootEnemy;
/* 2.0: does it has visibility threshold set? */
bool m_bHasVisibilityThreshold;
/* last time m_bCanShootEnemy was changed */
int m_iCanShootCheckTime;
/* desired enable enemy(changed from script) */
bool m_bDesiredEnableEnemy;
/* enable enemy (change from code only, Actor::UpdateEnableEnemy) */
bool m_bEnableEnemy;
/* can take pain ? */
bool m_bEnablePain;
/* allow long pain ? */
bool m_bNoLongPain;
/* last set enemy is new ? */
bool m_bNewEnemy;
/* is enemy disguised ? */
bool m_bEnemyIsDisguised;
/* is enemy visible (CanSee) ? */
bool m_bEnemyVisible;
/* is enemy in fov (CanSee) ? */
bool m_bEnemyInFOV;
/* attack player even if disguised. */
bool m_bForceAttackPlayer;
/* actor should avoud player (Actor::IdleThink) (get out of the players way) */
bool m_bAutoAvoidPlayer;
/* actor will not go into idle after playing an animation */
bool m_bNoIdleAfterAnim;
/* is anim script set ? */
bool m_bAnimScriptSet;
/* const string of anim script path */
const_str m_csAnimScript;
/* anim mode */
int m_AnimMode;
/* 2.0: the run anim rate */
float m_fRunAnimRate;
/* Don't Face Wall request yaw. */
float m_fDfwRequestedYaw;
/* Don't Face Wall derived yaw. */
float m_fDfwDerivedYaw;
/* Don't Face Wall derived position. */
Vector m_vDfwPos;
/* Don't Face Wall time. */
float m_fDfwTime;
/* last time GunPostiton() was called */
int m_iGunPositionCheckTime;
/* gun position */
Vector m_vGunPosition;
int m_iWallDodgeTimeout;
vec2_t m_PrevObstacleNormal;
char m_WallDir;
/* EV_Actor_SetMoveDoneRadius */
float m_fMoveDoneRadiusSquared;
/* last time origin was changed */
int m_iOriginTime;
/* should I face enemy ? */
bool m_bFaceEnemy;
/* physics on/off ? */
bool m_bDoPhysics;
/* should become runner/patrol guy */
bool m_bBecomeRunner;
/* If true, patrol guys and running men wait until triggered to move */
bool m_bPatrolWaitTrigger;
bool m_bScriptGoalValid;
Vector m_vScriptGoal;
int m_iNextWatchStepTime;
/* current patrol node */
SafePtr<SimpleEntity> m_patrolCurrentNode;
/* current patrol anim */
const_str m_csPatrolCurrentAnim;
int m_iSquadStandTime;
/* distance AI tries to keep between squadmates while moving. */
float m_fInterval;
int m_iIntervalDirTime;
/* the direction the AI would like to move to maintain its interval */
Vector m_vIntervalDir;
short m_sCurrentPathNodeIndex;
/* current pain state(similar to m_State) */
int m_PainState;
/* last time actor switched to curious state. */
int m_iCuriousTime;
/* Current level of curiousity. It's value is from PriorityForEventType() */
int m_iCuriousLevel;
int m_iCuriousAnimHint;
/* next time to check for state change to disguise. PassesTransitionConditions_Disguise() */
int m_iNextDisguiseTime;
/* EV_Actor_SetDisguisePeriod */
int m_iDisguisePeriod;
/* EV_Actor_SetDisguiseRange */
float m_fMaxDisguiseDistSquared;
/* next time enemy should show papers */
int m_iEnemyShowPapersTime;
/* the thread for actor when accepting papers */
ScriptThreadLabel m_DisguiseAcceptThread;
/* disguise level of the actor, might be 1 or 2 */
int m_iDisguiseLevel;
/* node for actor to raise alaram against player. */
SafePtr<SimpleEntity> m_AlarmNode;
/* alarm thread for actor */
ScriptThreadLabel m_AlarmThread;
/* 2.30: pre-alarm thread for actor */
ScriptThreadLabel m_PreAlarmThread;
/* 2.0: Suppress chance */
int m_iSuppressChance;
/* used for turret actot to run back to home Turret_SelectState() */
int m_iRunHomeTime;
/* no cover path for initial turret state */
bool m_bTurretNoInitialCover;
/* potential cover nodes */
PathNode *m_pPotentialCoverNode[MAX_COVER_NODES];
/* potential cover node count */
int m_iPotentialCoverCount;
/* current cover node */
PathNode *m_pCoverNode;
/* special cover node attack script. */
const_str m_csSpecialAttack;
/* actor is reloading */
bool m_bInReload;
/* actor needs reloading */
bool m_bNeedReload;
/* should break(stop) special attack ? */
bool mbBreakSpecialAttack;
/* 2.30: is the AI curious? */
bool m_bIsCurious;
/* grenade has bounced ? (usually means actor should flee) */
bool m_bGrenadeBounced;
/* current grenade */
SafePtr<Entity> m_pGrenade;
/* grenade position */
Vector m_vGrenadePos;
/* first time grenade was noticed */
int m_iFirstGrenadeTime;
/* grenade state */
eGrenadeState m_eGrenadeState;
/* grenade mode */
eGrenadeTossMode m_eGrenadeMode;
/* grenade velocity */
Vector m_vGrenadeVel;
/* grenade kick direction */
Vector m_vKickDir;
/* falling path */
FallPath *m_pFallPath;
/* minimum height a balcony guy must fall to do special balcony death */
float m_fBalconyHeight;
/* actor should not collide with player */
bool m_bNoPlayerCollision;
/* multiplier in time to notice an enemy */
float m_fNoticeTimeScale;
/* max multiplier in time to notice an enemy */
float m_fMaxNoticeTimeScale;
/* set of potential enemies */
ActorEnemySet m_PotentialEnemies;
/* vision distance of the actor */
float m_fSight;
/* hearing radius of the actor */
float m_fHearing;
/* EV_Actor_GetSoundAwareness */
float m_fSoundAwareness;
/* EV_Actor_GetGrenadeAwareness */
float m_fGrenadeAwareness;
/* mask of AI_EVENT* bits for the actor to ignore. */
int m_iIgnoreSoundsMask;
/* fov angle of the actor */
float m_fFov;
/* used for infov check */
float m_fFovDot;
/* eye update time */
int m_iEyeUpdateTime;
/* eye direction */
Vector m_vEyeDir;
/* next time to look around */
int m_iNextLookTime;
/* fov angle for look around */
float m_fLookAroundFov;
/* entity to look at */
SafePtr<SimpleEntity> m_pLookEntity;
/* look flags(should be a bool) */
int m_iLookFlags;
/* entity to point at */
SafePtr<SimpleEntity> m_pPointEntity;
/* entity to turn to */
SafePtr<SimpleEntity> m_pTurnEntity;
/* allowed error(difference) in angles after doing turnto command */
float m_fTurnDoneError;
/* turn speed of the actor */
float m_fAngleYawSpeed;
/* node to aim at */
SafePtr<SimpleEntity> m_aimNode;
/* dont face wall mode */
int m_eDontFaceWallMode;
int m_iLastFaceDecideTime;
/* origin history */
vec2_t m_vOriginHistory[MAX_ORIGIN_HISTORY];
/* current origin history index */
int m_iCurrentHistory;
bool m_bHeadAnglesAchieved;
bool m_bLUpperArmAnglesAchieved;
bool m_bTorsoAnglesAchieved;
bool align3;
/* max head turn speed */
float m_fHeadMaxTurnSpeed;
/* desired head angles */
vec3_t m_vHeadDesiredAngles;
/* up arm turn speed */
float m_fLUpperArmTurnSpeed;
/* upper arm desired angles */
vec3_t m_vLUpperArmDesiredAngles;
/* max torso turn speed */
float m_fTorsoMaxTurnSpeed;
/* currnet torso turn speed */
float m_fTorsoCurrentTurnSpeed;
/* desired torso angles */
vec3_t m_vTorsoDesiredAngles;
/* global body queue */
static SafePtr<Actor> mBodyQueue[MAX_BODYQUEUE];
/* current body queue index */
static int mCurBody;
/* leash home */
Vector m_vHome;
/* tether entity */
SafePtr<SimpleEntity> m_pTetherEnt;
/* minimum distance actor tries to keep between itself and the player */
float m_fMinDistance;
/* square of minimum distance actor tries to keep between itself and the player */
float m_fMinDistanceSquared;
/* maximum distance actor tries to allow between itself and the player */
float m_fMaxDistance;
/* square of maximum distance actor tries to allow between itself and the player */
float m_fMaxDistanceSquared;
/* maximum distance actor will wander from its leash home */
float m_fLeash;
/* square of maximum distance actor will wander from its leash home */
float m_fLeashSquared;
/* if true, leash will not change. */
bool m_bFixedLeash;
/* 2.0: if true, enemy switch will be disabled. */
bool m_bEnemySwitch;
/* 2.30: the nationality index. */
int m_iNationality;
public:
CLASS_PROTOTYPE(Actor);
protected:
void MoveTo(Event *ev);
void WalkTo(Event *ev);
void RunTo(Event *ev);
void CrouchTo(Event *ev);
void CrawlTo(Event *ev);
void AimAt(Event *ev);
void DefaultRestart(void);
void SuspendState(void);
void ResumeState(void);
void BeginState(void);
void EndState(int level);
void RestartState(void);
public:
Actor();
~Actor();
virtual void setContentsSolid(void) override;
void InitThinkStates(void);
void UpdateEyeOrigin(void);
bool RequireThink(void);
void UpdateEnemy(int iMaxDirtyTime);
void UpdateEnemyInternal(void);
void DetectSmokeGrenades(void);
void SetEnemy(Sentient *pEnemy, bool bForceConfirmed);
void SetEnemyPos(Vector vPos);
static void ResetBodyQueue(void);
void AddToBodyQue(void);
Vector GetAntiBunchPoint(void);
static void InitVoid(GlobalFuncs_t *func);
virtual const char *DumpCallTrace(const char *pszFmt, ...) const override;
static void Init(void);
void FixAIParameters(void);
bool AttackEntryAnimation(void);
void CheckForThinkStateTransition(void);
bool CheckForTransition(eThinkState state, eThinkLevel level);
bool PassesTransitionConditions_Grenade(void);
bool PassesTransitionConditions_BadPlace(void); // Added in 2.0
bool PassesTransitionConditions_Attack(void);
bool PassesTransitionConditions_Disguise(void);
bool PassesTransitionConditions_Curious(void);
bool PassesTransitionConditions_Idle(void);
void UpdateEnableEnemy(void);
void ThinkStateTransitions(void);
void TransitionState(int iNewState, int iPadTime = 0);
void ChangeAnim(void);
void UpdateSayAnim(void);
void UpdateUpperAnim(void);
void UpdateAnim(void);
virtual void StoppedWaitFor(const_str name, bool bDeleting) override;
static void InitTurret(GlobalFuncs_t *func);
void Begin_Turret(void);
void End_Turret(void);
void Suspend_Turret(void);
void Think_Turret(void);
void FinishedAnimation_Turret(void);
void ReceiveAIEvent_Turret(
vec3_t event_origin, int iType, Entity *originator, float fDistSquared, float fMaxDistSquared
);
void InterruptPoint_Turret(void);
void PathnodeClaimRevoked_Turret(void);
bool Turret_IsRetargeting(void) const;
bool Turret_DecideToSelectState(void);
void Turret_SelectState(void);
bool Turret_CheckRetarget(void);
bool Turret_TryToBecomeCoverGuy(void);
void Turret_BeginRetarget(void);
void Turret_NextRetarget(void);
void Turret_SideStep(int iStepSize, vec3_t vDir);
void State_Turret_Combat(void);
void State_Turret_Reacquire(void);
void State_Turret_TakeSniperNode(void);
void State_Turret_SniperNode(void);
bool State_Turret_RunHome(bool bAttackOnFail);
void State_Turret_RunAway(void);
void State_Turret_Charge(void);
void State_Turret_Grenade(void);
void State_Turret_FakeEnemy(void);
void State_Turret_Wait(void);
void State_Turret_Shoot(void); // Added in 2.0
void State_Turret_Retarget_Suppress(void); // Added in 2.0
void State_Turret_Retarget_Sniper_Node(void);
void State_Turret_Retarget_Step_Side_Small(void);
void State_Turret_Retarget_Path_Exact(void);
void State_Turret_Retarget_Path_Near(void);
void State_Turret_Retarget_Step_Side_Medium(void);
void State_Turret_Retarget_Step_Side_Large(void);
void State_Turret_Retarget_Step_Face_Medium(void);
void State_Turret_Retarget_Step_Face_Large(void);
static void InitCover(GlobalFuncs_t *func);
bool Cover_IsValid(PathNode *node);
bool Cover_SetPath(PathNode *node);
void Cover_FindCover(bool bCheckAll);
void Begin_Cover(void);
void End_Cover(void);
void Suspend_Cover(void);
void Think_Cover(void);
void FinishedAnimation_Cover(void);
void PathnodeClaimRevoked_Cover(void);
void State_Cover_NewEnemy(void);
void State_Cover_FindCover(void);
void State_Cover_TakeCover(void);
void State_Cover_FinishReloading(void);
void State_Cover_SpecialAttack(void);
void State_Cover_Target(void);
void State_Cover_Hide(void);
void State_Cover_Shoot(void);
void State_Cover_Grenade(void);
void State_Cover_FindEnemy(void);
void State_Cover_SearchNode(void);
void State_Cover_HuntEnemy(void);
void State_Cover_FakeEnemy(void);
static void InitPatrol(GlobalFuncs_t *func);
void Begin_Patrol(void);
void End_Patrol(void);
void Resume_Patrol(void);
void Think_Patrol(void);
void ShowInfo_Patrol(void);
void IdleThink(void);
static void InitRunner(GlobalFuncs_t *func);
void Begin_Runner(void);
void End_Runner(void);
void Resume_Runner(void);
void Think_Runner(void);
void ShowInfo_Runner(void);
static void InitAlarm(GlobalFuncs_t *func);
void Begin_Alarm(void);
void End_Alarm(void);
void State_Alarm_StartThread(void);
void State_Alarm_Move(void);
void State_Alarm_Idle(void);
void Think_Alarm(void);
void FinishedAnimation_Alarm(void);
static void InitNoClip(GlobalFuncs_t *func);
bool IsNoClipState(int state);
void Think_NoClip(void);
bool ValidGrenadePath(const Vector &vFrom, const Vector &vTo, Vector &vVel);
static Vector CalcThrowVelocity(const Vector& vFrom, const Vector& vTo);
Vector CanThrowGrenade(const Vector &vFrom, const Vector &vTo);
static Vector CalcRollVelocity(const Vector& vFrom, const Vector& vTo);
Vector CanRollGrenade(const Vector &vFrom, const Vector &vTo);
bool CanTossGrenadeThroughHint(
GrenadeHint *pHint,
const Vector &vFrom,
const Vector &vTo,
bool bDesperate,
Vector *pvVel,
eGrenadeTossMode *peMode
);
static Vector GrenadeThrowPoint(const Vector& vFrom, const Vector& vDelta, const_str csAnim);
Vector CalcKickVelocity(Vector &vDelta, float fDist) const;
bool CanKickGrenade(Vector &vFrom, Vector &vTo, Vector &vFace, Vector *pvVel);
bool GrenadeWillHurtTeamAt(const Vector &vTo);
bool CanGetGrenadeFromAToB(
const Vector &vFrom, const Vector &vTo, bool bDesperate, Vector *pvVel, eGrenadeTossMode *peMode
);
bool DecideToThrowGrenade(const Vector &vTo, Vector *pvVel, eGrenadeTossMode *peMode, bool bDesperate);
void Grenade_EventFire(Event *ev);
void GenericGrenadeTossThink(void);
static void InitGrenade(GlobalFuncs_t *func);
bool Grenade_Acquire(eGrenadeState eNextState, const_str csReturnAnim);
void Grenade_Flee(void);
void Grenade_ThrowAcquire(void);
void Grenade_Throw(void);
void Grenade_KickAcquire(void);
void Grenade_Kick(void);
void Grenade_MartyrAcquire(void);
void Grenade_Martyr(void);
void Grenade_Wait(void);
void Grenade_NextThinkState(void);
void Grenade_EventAttach(Event *ev);
void Grenade_EventDetach(Event *ev);
void Begin_Grenade(void);
void End_Grenade(void);
void Resume_Grenade(void);
void Think_Grenade(void);
void FinishedAnimation_Grenade(void);
static void InitCurious(GlobalFuncs_t *func);
void SetCuriousAnimHint(int iAnimHint);
void Begin_Curious(void);
void End_Curious(void);
void Resume_Curious(void);
void Suspend_Curious(void);
void Think_Curious(void);
void FinishedAnimation_Curious(void);
void LookAtCuriosity(void);
void TimeOutCurious(void);
void State_Disguise_Wait(void);
void State_Disguise_Papers(void);
void State_Disguise_Fake_Papers(void);
void State_Disguise_Enemy(void);
void State_Disguise_Halt(void);
void State_Disguise_Accept(void);
void State_Disguise_Deny(void);
static void InitDisguiseSalute(GlobalFuncs_t *func);
void Begin_DisguiseSalute(void);
void End_DisguiseSalute(void);
void Resume_DisguiseSalute(void);
void Suspend_DisguiseSalute(void);
void Think_DisguiseSalute(void);
void FinishedAnimation_DisguiseSalute(void);
static void InitDisguiseSentry(GlobalFuncs_t *func);
void Begin_DisguiseSentry(void);
void End_DisguiseSentry(void);
void Resume_DisguiseSentry(void);
void Suspend_DisguiseSentry(void);
void Think_DisguiseSentry(void);
static void InitDisguiseOfficer(GlobalFuncs_t *func);
void Begin_DisguiseOfficer(void);
void End_DisguiseOfficer(void);
void Resume_DisguiseOfficer(void);
void Suspend_DisguiseOfficer(void);
void Think_DisguiseOfficer(void);
static void InitDisguiseRover(GlobalFuncs_t *func);
void Begin_DisguiseRover(void);
void End_DisguiseRover(void);
void Resume_DisguiseRover(void);
void Suspend_DisguiseRover(void);
void Think_DisguiseRover(void);
static void InitDisguiseNone(GlobalFuncs_t *func);
static void InitIdle(GlobalFuncs_t *func);
void Begin_Idle(void);
void Think_Idle(void);
static void InitMachineGunner(GlobalFuncs_t *func);
void Begin_MachineGunner(void);
void End_MachineGunner(void);
void BecomeTurretGuy(void);
void ThinkHoldGun_TurretGun(void); // Added in 2.0
void Think_MachineGunner_TurretGun(void); // Added in 2.0
void Think_MachineGunner(void);
void FinishedAnimation_MachineGunner(void);
bool MachineGunner_CanSee(Entity *ent, float fov, float vision_distance);
static void InitDogIdle(GlobalFuncs_t *func);
static void InitDogAttack(GlobalFuncs_t *func);
static void InitDogCurious(GlobalFuncs_t *func);
void Begin_Dog(void);
void End_Dog(void);
void Think_Dog_Idle(void);
void Think_Dog_Attack(void);
void Think_Dog_Curious(void);
static void InitAnim(GlobalFuncs_t *func);
void Begin_Anim(void);
void Think_Anim(void);
void FinishedAnimation_Anim(void);
void ShowInfo_Anim(void);
static void InitAnimCurious(GlobalFuncs_t *func);
void Begin_AnimCurious(void);
void Think_AnimCurious(void);
void FinishedAnimation_AnimCurious(void);
static void InitAim(GlobalFuncs_t *func);
void Begin_Aim(void);
void Think_Aim(void);
void ShowInfo_Aim(void);
static void InitBalconyIdle(GlobalFuncs_t *func);
static void InitBalconyCurious(GlobalFuncs_t *func);
static void InitBalconyAttack(GlobalFuncs_t *func);
static void InitBalconyDisguise(GlobalFuncs_t *func);
static void InitBalconyGrenade(GlobalFuncs_t *func);
static void InitBalconyPain(GlobalFuncs_t *func);
static void InitBalconyKilled(GlobalFuncs_t *func);
void Pain_Balcony(Event *ev);
void Killed_Balcony(Event *ev, bool bPlayDeathAnim);
void Think_BalconyAttack(void);
void Begin_BalconyAttack(void);
void FinishedAnimation_BalconyAttack(void);
void State_Balcony_PostShoot(void);
void State_Balcony_FindEnemy(void);
void State_Balcony_Target(void);
void State_Balcony_Shoot(void);
void Begin_BalconyKilled(void);
void End_BalconyKilled(void);
void Think_BalconyKilled(void);
void FinishedAnimation_BalconyKilled(void);
bool CalcFallPath(void);
static void InitPain(GlobalFuncs_t *func);
void Begin_Pain(void);
void Think_Pain(void);
void FinishedAnimation_Pain(void);
static void InitDead(GlobalFuncs_t *func);
static void InitKilled(GlobalFuncs_t *func);
void Begin_Killed(void);
void Think_Killed(void);
void FinishedAnimation_Killed(void);
static void InitWeaponless(GlobalFuncs_t *func);
void Begin_Weaponless(void);
void Suspend_Weaponless(void);
void Think_Weaponless(void);
void FinishedAnimation_Weaponless(void);
void State_Weaponless_Normal(void);
void State_Weaponless_Grenade(void);
static void InitBadPlace(GlobalFuncs_t *func);
// Added in 2.0
//====
void Begin_BadPlace(void);
void End_BadPlace(void);
void Think_BadPlace(void);
//====
// Added in 2.30
//====
static void InitRunAndShoot(GlobalFuncs_t *func);
void Begin_RunAndShoot(void);
void End_RunAndShoot(void);
void Resume_RunAndShoot(void);
void Think_RunAndShoot(void);
void ShowInfo_RunAndShoot(void);
void State_RunAndShoot_Running(void);
bool RunAndShoot_MoveToPatrolCurrentNode(void);
//====
virtual void Think(void) override;
void PostThink(bool bDontFaceWall);
virtual void SetMoveInfo(mmove_t *mm) override;
virtual void GetMoveInfo(mmove_t *mm) override;
void DoFailSafeMove(vec3_t dest);
void TouchStuff(mmove_t *mm);
void ExtractConstraints(mmove_t *mm);
void EventGiveWeaponInternal(Event *ev);
void EventGiveWeapon(Event *ev);
void EventGetWeapon(Event *ev);
void FireWeapon(Event *ev);
bool FriendlyInLineOfFire(Entity *other); // Added in 2.0
Vector VirtualEyePosition(); // Added in 2.0
virtual bool CanTarget(void) override;
virtual bool IsImmortal(void) override;
static bool IsVoidState(int state);
static bool IsIdleState(int state);
static bool IsCuriousState(int state);
static bool IsDisguiseState(int state);
static bool IsAttackState(int state);
static bool IsGrenadeState(int state);
static bool IsBadPlaceState(int state); // Added in 2.0
static bool IsPainState(int state);
static bool IsKilledState(int state);
static bool IsMachineGunnerState(int state);
static bool IsDogState(int state);
void IgnoreSoundSet(int iType);
void IgnoreSoundSetAll(void);
void IgnoreSoundClear(int iType);
void IgnoreSoundClearAll(void);
bool IgnoreSound(int iType);
void EventShareEnemy(Event *ev);
void EventShareGrenade(Event *ev);
void ReceiveAIEvent(vec3_t event_origin, int iType, Entity *originator, float fDistSquared, float fMaxDistSquared);
void DefaultReceiveAIEvent(
vec3_t event_origin, int iType, Entity *originator, float fDistSquared, float fMaxDistSquared
);
int PriorityForEventType(int iType);
void CuriousSound(int iType, vec3_t sound_origin, float fDistSquared, float fMaxDistSquared);
void WeaponSound(int iType, vec3_t sound_origin, float fDistSquared, float fMaxDistSquared, Entity *originator);
void FootstepSound(vec3_t sound_origin, float fDistSquared, float fMaxDistSquared, Entity *originator);
void VoiceSound(int iType, vec3_t sound_origin, float fDistSquared, float fMaxDistSquared, Entity *originator);
void GrenadeNotification(Entity *originator);
void SetGrenade(Entity *pGrenade);
void UpdateBadPlaces(void); // Added in 2.0
void NotifySquadmateKilled(Sentient *pSquadMate, Sentient *pAttacker);
void RaiseAlertnessForEventType(int iType);
void RaiseAlertness(float fAmount);
virtual bool CanSee(Entity *e1, float fov, float vision_distance, bool bNoEnts) override;
using Sentient::CanSee;
virtual Vector GunPosition(void) override;
bool WithinVisionDistance(Entity *ent) const;
bool InFOV(Vector pos, float check_fov, float check_fovdot);
bool EnemyInFOV(int iMaxDirtyTime);
bool InFOV(Vector pos);
bool InFOV(Entity *ent);
bool CanSeeNoFOV(Entity *ent);
bool CanSeeFOV(Entity *ent);
bool CanSeeEnemyFOV(int iMaxFovDirtyTime, int iMaxSightDirtyTime);
bool CanShoot(Entity *ent);
virtual bool CanSeeFrom(vec3_t pos, Entity *ent);
bool CanSeeEnemy(int iMaxDirtyTime);
bool CanShootEnemy(int iMaxDirtyTime);
void ShowInfo(void);
virtual void ShowInfo(float fDot, float fDist) override;
void DefaultPain(Event *ev);
void HandlePain(Event *ev);
void EventPain(Event *ev);
void DefaultKilled(Event *ev, bool bPlayDeathAnim);
void HandleKilled(Event *ev, bool bPlayDeathAnim);
void DispatchEventKilled(Event *ev, bool bPlayDeathAnim);
void EventKilled(Event *ev);
void EventBeDead(Event *ev);
void DeathEmbalm(Event *ev);
void DeathSinkStart(Event *ev);
bool NoticeShot(Sentient *pShooter, Sentient *pTarget, float fDist);
bool NoticeFootstep(Sentient *pPedestrian);
bool NoticeVoice(Sentient *pVocallist);
void ClearLookEntity(void);
void LookAt(const Vector &vec);
void LookAt(Listener *l);
void ForwardLook(void);
void LookAtLookEntity(void);
void IdleLook(void);
void IdleLook(vec3_t dir);
void SetDesiredLookDir(vec3_t dir);
void SetDesiredLookAnglesRelative(vec3_t ang);
void EventLookAt(Event *ev);
void EventEyesLookAt(Event *ev);
void NoPoint(void);
void IdlePoint(void);
void ClearPointEntity(void);
void PointAt(const Vector &vec);
void PointAt(Listener *l);
void EventPointAt(Event *ev);
void ClearTurnEntity(void);
void TurnTo(const Vector &vec);
void TurnTo(Listener *l);
void IdleTurn(void);
void EventTurnTo(Event *ev);
void EventSetTurnDoneError(Event *ev);
void EventGetTurnDoneError(Event *ev);
void LookAround(float fFovAdd);
bool SoundSayAnim(const_str name, byte bLevelSayAnim);
void EventSetAnim(Event *ev);
void EventIdleSayAnim(Event *ev);
void EventSayAnim(Event *ev);
void EventSetSayAnim(Event *ev);
void EventSetMotionAnim(Event *ev);
void EventSetAimMotionAnim(Event *ev);
void EventSetActionAnim(Event *ev);
void EventUpperAnim(Event *ev);
void EventSetUpperAnim(Event *ev);
void EventEndActionAnim(Event *ev);
void EventDamagePuff(Event *ev);
void SafeSetOrigin(vec3_t newOrigin);
void DoMove(void);
void AnimFinished(int slot, bool stop);
virtual void AnimFinished(int slot) override;
void PlayAnimation(Event *ev);
void PlayScriptedAnimation(Event *ev);
void PlayNoclipAnimation(Event *ev);
void PlayAttachedAnimation(Event *ev); // Added in 2.0
void MoveDest(float fMoveSpeed);
void MovePath(float fMoveSpeed);
void MovePathGoal(float fMoveSpeed);
void Dumb(Event *ev);
void PhysicsOn(Event *ev);
void PhysicsOff(Event *ev);
void EventStart(Event *ev);
void EventGetMood(Event *ev);
void EventSetMood(Event *ev);
void EventGetAngleYawSpeed(Event *ev);
void EventSetAngleYawSpeed(Event *ev);
void EventSetAimTarget(Event *ev);
void UpdateAngles(void);
void SetLeashHome(Vector vHome);
void AimAtTargetPos(void);
void AimAtAimNode(void);
void AimAtEnemyBehavior(void);
void FaceMotion(void);
void FaceDirectionDuringMotion(vec3_t vLook);
float PathDistanceAlongVector(vec3_t vDir);
void FaceEnemyOrMotion(int iTimeIntoMove);
static int NextUpdateTime(int iLastUpdateTime, int iUpdatePeriod);
void ResetBoneControllers(void);
void UpdateBoneControllers(void);
void ReadyToFire(Event *ev);
void EventGetSight(Event *ev);
void EventSetSight(Event *ev);
void EventGetHearing(Event *ev);
void EventSetHearing(Event *ev);
void ClearPatrolCurrentNode(void);
void NextPatrolCurrentNode(void);
void SetPatrolCurrentNode(Vector &vec);
void SetPatrolCurrentNode(Listener *l);
void EventSetPatrolPath(Event *ev);
void EventGetPatrolPath(Event *ev);
void EventSetPatrolWaitTrigger(Event *ev);
void EventGetPatrolWaitTrigger(Event *ev);
void ShowInfo_PatrolCurrentNode(void);
bool MoveOnPathWithSquad(void);
bool MoveToWaypointWithPlayer(void);
bool PatrolNextNodeExists(void);
void UpdatePatrolCurrentNode(void);
bool MoveToPatrolCurrentNode(void);
void ClearAimNode(void);
void SetAimNode(const Vector &vec);
void SetAimNode(Listener *l);
void ShowInfo_AimNode(void);
void EventSetAccuracy(Event *ev);
void EventGetAccuracy(Event *ev);
int GetThinkType(const_str csName);
void SetThink(eThinkState state, eThinkNum think);
void SetThinkIdle(eThinkNum think_idle);
void SetThinkState(eThinkState state, eThinkLevel level);
void EndCurrentThinkState(void);
void ClearThinkStates(void);
int CurrentThink(void) const;
bool IsAttacking(void) const;
void EventGetFov(Event *ev);
void EventSetFov(Event *ev);
void EventSetDestIdle(Event *ev);
void EventSetDestIdle2(Event *ev);
void EventSetTypeIdle(Event *ev);
void EventGetTypeIdle(Event *ev);
void EventSetTypeAttack(Event *ev);
void EventGetTypeAttack(Event *ev);
void EventSetTypeDisguise(Event *ev);
void EventGetTypeDisguise(Event *ev);
void EventSetDisguiseLevel(Event *ev);
void EventGetDisguiseLevel(Event *ev);
void EventSetTypeGrenade(Event *ev);
void EventGetTypeGrenade(Event *ev);
void EventSetMinDistance(Event *ev);
void EventGetMinDistance(Event *ev);
void EventSetMaxDistance(Event *ev);
void EventGetMaxDistance(Event *ev);
void EventGetLeash(Event *ev);
void EventSetLeash(Event *ev);
void EventGetInterval(Event *ev);
void EventSetInterval(Event *ev);
void EventDistToEnemy(Event *ev);
void EventGetRunAnim(Event *ev);
void EventGetWalkAnim(Event *ev);
void EventGetAnimName(Event *ev);
void EventSetAnimName(Event *ev);
void EventSetDisguiseRange(Event *ev);
void EventGetDisguiseRange(Event *ev);
void EventSetDisguisePeriod(Event *ev);
void EventGetDisguisePeriod(Event *ev);
void EventSetDisguiseAcceptThread(Event *ev);
void EventGetDisguiseAcceptThread(Event *ev);
void EventAttackPlayer(Event *ev);
void ForceAttackPlayer(void);
void EventSetAlarmNode(Event *ev);
void EventGetAlarmNode(Event *ev);
void EventSetPreAlarmThread(Event *ev); // Added in 2.30
void EventSetAlarmThread(Event *ev);
void EventGetAlarmThread(Event *ev);
void EventSetSoundAwareness(Event *ev);
void EventGetSoundAwareness(Event *ev);
void EventSetGrenadeAwareness(Event *ev);
void EventGetGrenadeAwareness(Event *ev);
str ThinkName(void) const;
str ThinkStateName(void) const;
void EventSetTurret(Event *ev);
void EventGetTurret(Event *ev);
void EventEnableEnemy(Event *ev);
void EventEnablePain(Event *ev);
void EventActivate(Event *ev);
void EventGetAmmoGrenade(Event *ev);
void EventSetAmmoGrenade(Event *ev);
void EventInterruptPoint(Event *ev);
// Added in 2.0
//====
void EventGetVisibilityThreshold(Event *ev);
void EventSetVisibilityThreshold(Event *ev);
void EventSetDefaultVisibilityThreshold(Event *ev);
void EventGetSuppressChance(Event *ev);
void EventSetSuppressChance(Event *ev);
//====
void EventAnimScript(Event *ev);
void EventAnimScript_Scripted(Event *ev);
void EventAnimScript_Noclip(Event *ev);
void EventAnimScript_Attached(Event *ev);
void EventReload_mg42(Event *ev);
void SetPathWithLeash(Vector vDestPos, const char *description, int iMaxDirtyTime);
void SetPathWithLeash(SimpleEntity *pDestNode, const char *description, int iMaxDirtyTime);
void FindPathAwayWithLeash(vec3_t vAwayFrom, vec3_t vDirPreferred, float fMinSafeDist);
void FindPathNearWithLeash(vec3_t vNearbyTo, float fCloseDistSquared);
bool CanMovePathWithLeash(void) const;
bool MovePathWithLeash(void);
bool ShortenPathToAttack(float fMinDist);
void StrafeToAttack(float fDist, vec3_t vDir);
virtual Vector GunTarget(bool bNoCollision, const vec3_t position, const vec3_t forward) override;
virtual qboolean setModel(void) override;
void EventSetHeadModel(Event *ev);
void EventGetHeadModel(Event *ev);
void EventSetHeadSkin(Event *ev);
void EventGetHeadSkin(Event *ev);
void EventSetNoIdle(Event *ev);
void EventGetNoIdle(Event *ev);
void EventGetEnemy(Event *ev);
void EventSetMaxNoticeTimeScale(Event *ev);
void EventGetMaxNoticeTimeScale(Event *ev);
void EventSetFixedLeash(Event *ev);
void EventGetFixedLeash(Event *ev);
void Holster(void);
void HolsterOffHand(void); // Added in 2.0
void Unholster(void);
void UnholsterOffHand(void); // Added in 2.0
void EventHolster(Event *ev);
void EventUnholster(Event *ev);
void EventSoundDone(Event *ev);
void EventSound(Event *ev);
void EventIsEnemyVisible(Event *ev);
void EventGetEnemyVisibleChangeTime(Event *ev);
void EventGetLastEnemyVisibleTime(Event *ev);
void EventSetFallHeight(Event *ev);
void EventGetFallHeight(Event *ev);
void EventCanMoveTo(Event *ev);
void EventMoveDir(Event *ev);
void EventIntervalDir(Event *ev);
void EventResetLeash(Event *ev);
void EventTether(Event *ev);
void EventGetThinkState(Event *ev);
void EventGetEnemyShareRange(Event *ev);
void EventSetEnemyShareRange(Event *ev);
void EventGetKickDir(Event *ev);
void EventGetNoLongPain(Event *ev);
void EventSetNoLongPain(Event *ev);
void EventGetFavoriteEnemy(Event *ev);
void EventSetFavoriteEnemy(Event *ev);
void EventFindEnemy(Event *ev); // Added in 2.0
void EventGetMumble(Event *ev);
void EventSetMumble(Event *ev);
void EventGetBreathSteam(Event *ev);
void EventSetBreathSteam(Event *ev);
void EventSetNextBreathTime(Event *ev);
void EventCalcGrenadeToss2(Event *ev);
void EventCalcGrenadeToss(Event *ev);
void EventGetNoSurprise(Event *ev);
void EventSetNoSurprise(Event *ev);
void EventGetSilent(Event *ev);
void EventSetSilent(Event *ev);
void EventGetAvoidPlayer(Event *ev);
void EventSetAvoidPlayer(Event *ev);
void EventGetLookAroundAngle(Event *ev);
void EventSetLookAroundAngle(Event *ev);
void EventHasCompleteLookahead(Event *ev);
void EventPathDist(Event *ev);
void EventCanShootEnemyFrom(Event *ev);
void EventCanShoot(Event *ev);
void EventSetInReload(Event *ev);
void EventGetInReload(Event *ev);
void EventSetReloadCover(Event *ev);
void EventBreakSpecial(Event *ev);
void GetVoiceType(Event *ev);
void SetVoiceType(Event *ev);
void ResolveVoiceType(void);
void EventSetBalconyHeight(Event *ev);
void EventGetBalconyHeight(Event *ev);
// Added in 2.0
//====
void EventSetIgnoreBadPlace(Event *ev);
void EventGetIgnoreBadPlace(Event *ev);
void EventEnableEnemySwitch(Event *ev);
void EventDisableEnemySwitch(Event *ev);
void EventSetRunAnimRate(Event *ev);
void EventGetRunAnimRate(Event *ev);
void Landed(Event *ev);
bool IsOnFloor(void);
//====
// Added in 2.30
//====
void GetNationality(Event *ev);
void SetNationality(Event *ev);
void EventWriteStats(Event *ev);
void EventCuriousOff(Event *ev);
void EventCuriousOn(Event *ev);
//====
PathNode *FindSniperNodeAndSetPath(bool *pbTryAgain);
void Remove(Event *ev);
void DontFaceWall(void);
bool AvoidingFacingWall(void) const;
void EndStates(void);
void ClearStates(void);
void CheckUnregister(void);
void BecomeCorpse(void);
virtual void PathnodeClaimRevoked(PathNode *node) override;
void SetPathToNotBlockSentient(Sentient *pOther);
void EventSetMoveDoneRadius(Event *ev);
void EventGetMoveDoneRadius(Event *ev); // Added in 2.0
virtual void ClearEnemies(void) override;
bool EnemyIsDisguised(void);
virtual void setOriginEvent(Vector org) override;
virtual void DumpAnimInfo(void) override;
static void ArchiveStatic(Archiver &arc);
virtual void Archive(Archiver& arc) override;
virtual bool AutoArchiveModel(void) override;
virtual bool IsDisabled() const override; // Added in 2.30
};
#define SAVE_FLAG_NEW_ANIM (1 << 0)
#define SAVE_FLAG_FORWARD_SPEED (1 << 1)
#define SAVE_FLAG_BEHAVIOR (1 << 2)
#define SAVE_FLAG_PATH (1 << 3)
#define SAVE_FLAG_NOISE (1 << 4)
#define SAVE_FLAG_SCRIPT_THREAD (1 << 5)
#define SAVE_FLAG_ACTOR_THREAD (1 << 6)
#define SAVE_FLAG_KILL_THREAD (1 << 7)
#define SAVE_FLAG_STATE (1 << 8)
#define SAVE_FLAG_IDLE_THREAD (1 << 7)
#define SAVE_FLAG_PARTS (1 << 10)
#define SAVE_FLAG_TRIGGER (1 << 11)
#define SAVE_FLAG_STATE_FLAGS (1 << 12)
#define SAVE_FLAG_COMMAND (1 << 13)
#define SAVE_FLAG_STAGE (1 << 14)
#define SAVE_FLAG_NUM_OF_SPAWNS (1 << 15)
#define SAVE_FLAG_SPAWN_PARENT (1 << 16)
#define SAVE_FLAG_DIALOG (1 << 17)
#define SAVE_FLAG_SAVED_STUFF (1 << 18)
#define SAVE_FLAG_LAST_ANIM_EVENT (1 << 19)
#define SAVE_FLAG_PICKUP_ENT (1 << 20)
#define SAVE_FLAG_PAIN (1 << 21)
#define SAVE_FLAG_SPAWN_ITEMS (1 << 22)
/*
===============
Actor::TransitionState
===============
*/
inline void Actor::TransitionState(int iNewState, int iPadTime)
{
m_State = iNewState;
m_iStateTime = level.inttime + iPadTime;
}
/*
===============
Actor::NextUpdateTime
Returns next update time.
===============
*/
inline int Actor::NextUpdateTime(int iLastUpdateTime, int iUpdatePeriod)
{
int i = iLastUpdateTime;
do {
i += iUpdatePeriod;
} while (i < level.inttime);
return i;
}
/*
===============
Actor::InFOV
Returns true if pos is within fov.
===============
*/
inline bool Actor::InFOV(Vector pos)
{
return InFOV(pos, m_fFov, m_fFovDot);
}
/*
===============
Actor::InFOV
Returns true if ent is within fov.
===============
*/
inline bool Actor::InFOV(Entity *ent)
{
if (ent == m_Enemy) {
return EnemyInFOV(0);
} else {
return InFOV(ent->centroid);
}
}
inline bool Actor::CanSeeNoFOV(Entity *ent)
{
bool bCanSee;
if (ent == m_Enemy) {
return CanSeeEnemy(0);
}
bCanSee = false;
if (gi.AreasConnected(edict->r.areanum, ent->edict->r.areanum)) {
bCanSee = CanSee(ent, 0, 0, false);
}
return bCanSee;
}
inline bool Actor::CanSeeFOV(Entity *ent)
{
bool bCanSee;
if (ent == m_Enemy) {
return CanSeeEnemyFOV(0, 0);
}
bCanSee = false;
if (InFOV(ent) && AreasConnected(ent)) {
bCanSee = CanSee(ent, 0, 0, false);
}
return bCanSee;
}
inline bool Actor::CanSeeEnemyFOV(int iMaxFovDirtyTime, int iMaxSightDirtyTime)
{
return EnemyInFOV(iMaxFovDirtyTime) && CanSeeEnemy(iMaxSightDirtyTime);
}
/*
===============
Actor::AimAtTargetPos
Aim at mTargetPos.
===============
*/
inline void Actor::AimAtTargetPos(void)
{
Vector v, v2;
v = mTargetPos - EyePosition();
v2 = v;
v2[2] += 16;
SetDesiredLookDir(v2);
m_DesiredGunDir[0] = 360.0f - v.toPitch();
m_DesiredGunDir[1] = v.toYaw();
m_DesiredGunDir[2] = 0;
SetDesiredYaw(m_DesiredGunDir[1]);
}
/*
===============
Actor::AimAtAimNode
Aim at m_aimNode.
===============
*/
inline void Actor::AimAtAimNode(void)
{
mTargetPos = m_aimNode->centroid;
AimAtTargetPos();
}
/*
===============
Actor::IgnoreSoundSet
Make actor ignore iType sound.
===============
*/
inline void Actor::IgnoreSoundSet(int iType)
{
m_iIgnoreSoundsMask |= 1 << iType;
}
/*
===============
Actor::IgnoreSoundSetAll
Make actor ignore all types of sound.
===============
*/
inline void Actor::IgnoreSoundSetAll(void)
{
m_iIgnoreSoundsMask = 0xffff;
}
/*
===============
Actor::IgnoreSoundClear
Don't ignore iType of sound.
===============
*/
inline void Actor::IgnoreSoundClear(int iType)
{
m_iIgnoreSoundsMask &= ~(1 << iType);
}
/*
===============
Actor::IgnoreSoundClearAll
Make actor ignore no type of sound.
===============
*/
inline void Actor::IgnoreSoundClearAll(void)
{
m_iIgnoreSoundsMask = 0;
}
/*
===============
Actor::IgnoreSoundClearAll
returns true if actor should ignore iType of sound.
===============
*/
inline bool Actor::IgnoreSound(int iType)
{
return (m_iIgnoreSoundsMask >> iType) & 1;
}
/*
===============
Actor::CurrentThink
Current think.
===============
*/
inline int Actor::CurrentThink(void) const
{
return m_Think[m_ThinkLevel];
}
/*
===============
Actor::IsAttacking
Returns true if actor is in attack state.
===============
*/
inline bool Actor::IsAttacking(void) const
{
return m_ThinkStates[THINKLEVEL_IDLE] == THINKSTATE_ATTACK;
}
inline void Actor::ArchiveStatic(Archiver& arc)
{
for (int i = 0; i < MAX_BODYQUEUE; i++) {
arc.ArchiveSafePointer(&mBodyQueue[i]);
}
arc.ArchiveInteger(&mCurBody);
}
inline void Actor::Archive(Archiver& arc)
{
int i;
SimpleActor::Archive(arc);
for (i = 0; i < NUM_THINKSTATES; i++) {
ArchiveEnum(m_ThinkMap[i], eThinkNum);
}
for (i = 0; i < NUM_THINKLEVELS; i++) {
ArchiveEnum(m_ThinkStates[i], eThinkState);
ArchiveEnum(m_Think[i], eThinkNum);
}
ArchiveEnum(m_ThinkLevel, eThinkLevel);
ArchiveEnum(m_ThinkState, eThinkState);
arc.ArchiveInteger(&m_State);
arc.ArchiveInteger(&m_iStateTime);
arc.ArchiveBool(&m_bLockThinkState);
arc.ArchiveBool(&m_bDirtyThinkState);
arc.ArchiveBool(&m_bAnimating);
arc.ArchiveBool(&m_bIgnoreBadPlace);
arc.ArchiveInteger(&m_iBadPlaceIndex);
arc.ArchiveInteger(&mVoiceType);
arc.ArchiveBool(&m_bSilent);
arc.ArchiveBool(&m_bNoSurprise);
arc.ArchiveBool(&m_bMumble);
arc.ArchiveBool(&m_bBreathSteam);
arc.ArchiveBool(&m_bIsCurious);
Director.ArchiveString(arc, m_csHeadModel);
Director.ArchiveString(arc, m_csHeadSkin);
Director.ArchiveString(arc, m_csWeapon);
Director.ArchiveString(arc, m_csLoadOut);
arc.ArchiveSafePointer(&m_FavoriteEnemy);
arc.ArchiveInteger(&m_iEnemyCheckTime);
arc.ArchiveInteger(&m_iEnemyChangeTime);
arc.ArchiveInteger(&m_iEnemyVisibleCheckTime);
arc.ArchiveInteger(&m_iEnemyVisibleChangeTime);
arc.ArchiveInteger(&m_iLastEnemyVisibleTime);
arc.ArchiveFloat(&m_fVisibilityAlpha);
arc.ArchiveFloat(&m_fVisibilityThreshold);
arc.ArchiveInteger(&m_iEnemyFovCheckTime);
arc.ArchiveInteger(&m_iEnemyFovChangeTime);
arc.ArchiveVector(&m_vLastEnemyPos);
arc.ArchiveInteger(&m_iLastEnemyPosChangeTime);
arc.ArchiveFloat(&m_fMaxShareDistSquared);
arc.ArchiveInteger(&m_iCanShootCheckTime);
arc.ArchiveBool(&m_bCanShootEnemy);
arc.ArchiveBool(&m_bHasVisibilityThreshold);
arc.ArchiveBool(&m_bDesiredEnableEnemy);
arc.ArchiveBool(&m_bEnableEnemy);
arc.ArchiveBool(&m_bEnablePain);
arc.ArchiveBool(&m_bNoLongPain);
arc.ArchiveBool(&m_bNewEnemy);
arc.ArchiveBool(&m_bEnemyIsDisguised);
arc.ArchiveBool(&m_bEnemyVisible);
arc.ArchiveBool(&m_bEnemyInFOV);
arc.ArchiveBool(&m_bForceAttackPlayer);
arc.ArchiveBool(&m_bAutoAvoidPlayer);
arc.ArchiveBool(&m_bNoIdleAfterAnim);
Director.ArchiveString(arc, m_csAnimScript);
arc.ArchiveBool(&m_bAnimScriptSet);
arc.ArchiveInteger(&m_AnimMode);
arc.ArchiveFloat(&m_fRunAnimRate);
arc.ArchiveFloat(&m_fDfwRequestedYaw);
arc.ArchiveFloat(&m_fDfwDerivedYaw);
arc.ArchiveVector(&m_vDfwPos);
arc.ArchiveFloat(&m_fDfwTime);
arc.ArchiveInteger(&m_iGunPositionCheckTime);
arc.ArchiveVector(&m_vGunPosition);
arc.ArchiveInteger(&m_iWallDodgeTimeout);
arc.ArchiveFloat(&m_PrevObstacleNormal[0]);
arc.ArchiveFloat(&m_PrevObstacleNormal[1]);
arc.ArchiveChar(&m_WallDir);
arc.ArchiveFloat(&m_fMoveDoneRadiusSquared);
arc.ArchiveBool(&m_bFaceEnemy);
arc.ArchiveBool(&m_bDoPhysics);
arc.ArchiveBool(&m_bPatrolWaitTrigger);
arc.ArchiveBool(&m_bBecomeRunner);
arc.ArchiveBool(&m_bScriptGoalValid);
arc.ArchiveVector(&m_vScriptGoal);
arc.ArchiveInteger(&m_iNextWatchStepTime);
arc.ArchiveSafePointer(&m_patrolCurrentNode);
Director.ArchiveString(arc, m_csPatrolCurrentAnim);
arc.ArchiveInteger(&m_iSquadStandTime);
arc.ArchiveFloat(&m_fInterval);
arc.ArchiveInteger(&m_iIntervalDirTime);
arc.ArchiveVector(&m_vIntervalDir);
arc.ArchiveShort(&m_sCurrentPathNodeIndex);
arc.ArchiveInteger(&m_PainState);
arc.ArchiveInteger(&m_iCuriousTime);
arc.ArchiveInteger(&m_iCuriousLevel);
arc.ArchiveInteger(&m_iCuriousAnimHint);
arc.ArchiveInteger(&m_iNextDisguiseTime);
arc.ArchiveInteger(&m_iDisguisePeriod);
arc.ArchiveFloat(&m_fMaxDisguiseDistSquared);
arc.ArchiveInteger(&m_iEnemyShowPapersTime);
m_DisguiseAcceptThread.Archive(arc);
arc.ArchiveInteger(&m_iDisguiseLevel);
arc.ArchiveSafePointer(&m_AlarmNode);
m_AlarmThread.Archive(arc);
m_PreAlarmThread.Archive(arc);
arc.ArchiveInteger(&m_iSuppressChance);
arc.ArchiveInteger(&m_iRunHomeTime);
arc.ArchiveBool(&m_bTurretNoInitialCover);
arc.ArchiveInteger(&m_iPotentialCoverCount);
for (i = 0; i < MAX_COVER_NODES; i++) {
arc.ArchiveObjectPointer((Class **)&m_pPotentialCoverNode[i]);
}
arc.ArchiveObjectPointer((Class **)&m_pCoverNode);
Director.ArchiveString(arc, m_csSpecialAttack);
arc.ArchiveBool(&m_bInReload);
arc.ArchiveBool(&m_bNeedReload);
arc.ArchiveBool(&mbBreakSpecialAttack);
arc.ArchiveBool(&m_bGrenadeBounced);
arc.ArchiveSafePointer(&m_pGrenade);
arc.ArchiveVector(&m_vGrenadePos);
arc.ArchiveInteger(&m_iFirstGrenadeTime);
ArchiveEnum(m_eGrenadeState, eGrenadeState);
ArchiveEnum(m_eGrenadeMode, eGrenadeTossMode);
arc.ArchiveVector(&m_vGrenadeVel);
arc.ArchiveVector(&m_vKickDir);
arc.ArchiveFloat(&m_fNoticeTimeScale);
arc.ArchiveFloat(&m_fMaxNoticeTimeScale);
m_PotentialEnemies.Archive(arc);
arc.ArchiveFloat(&m_fSight);
arc.ArchiveFloat(&m_fHearing);
arc.ArchiveFloat(&m_fSoundAwareness);
arc.ArchiveFloat(&m_fGrenadeAwareness);
arc.ArchiveInteger(&m_iIgnoreSoundsMask);
arc.ArchiveFloat(&m_fFov);
arc.ArchiveFloat(&m_fFovDot);
arc.ArchiveInteger(&m_iEyeUpdateTime);
arc.ArchiveVector(&m_vEyeDir);
arc.ArchiveInteger(&m_iNextLookTime);
arc.ArchiveFloat(&m_fLookAroundFov);
arc.ArchiveSafePointer(&m_pLookEntity);
arc.ArchiveInteger(&m_iLookFlags);
arc.ArchiveSafePointer(&m_pPointEntity);
arc.ArchiveSafePointer(&m_pTurnEntity);
arc.ArchiveFloat(&m_fTurnDoneError);
arc.ArchiveFloat(&m_fAngleYawSpeed);
arc.ArchiveSafePointer(&m_aimNode);
arc.ArchiveInteger(&m_eDontFaceWallMode);
arc.ArchiveInteger(&m_iLastFaceDecideTime);
arc.ArchiveBool(&m_bHeadAnglesAchieved);
arc.ArchiveBool(&m_bLUpperArmAnglesAchieved);
arc.ArchiveBool(&m_bTorsoAnglesAchieved);
arc.ArchiveFloat(&m_fHeadMaxTurnSpeed);
arc.ArchiveVec3(m_vHeadDesiredAngles);
arc.ArchiveFloat(&m_fLUpperArmTurnSpeed);
arc.ArchiveVec3(m_vLUpperArmDesiredAngles);
arc.ArchiveFloat(&m_fTorsoMaxTurnSpeed);
arc.ArchiveFloat(&m_fTorsoCurrentTurnSpeed);
arc.ArchiveVec3(m_vTorsoDesiredAngles);
arc.ArchiveVector(&m_vHome);
arc.ArchiveSafePointer(&m_pTetherEnt);
arc.ArchiveFloat(&m_fMinDistance);
arc.ArchiveFloat(&m_fMinDistanceSquared);
arc.ArchiveFloat(&m_fMaxDistance);
arc.ArchiveFloat(&m_fMaxDistanceSquared);
arc.ArchiveFloat(&m_fLeash);
arc.ArchiveFloat(&m_fLeashSquared);
arc.ArchiveBool(&m_bFixedLeash);
byte length;
if (arc.Saving()) {
if (m_pFallPath) {
length = m_pFallPath->length;
} else {
length = 0;
}
}
arc.ArchiveByte(&length);
if (arc.Loading() && length) {
m_pFallPath =
(FallPath *)gi.Malloc((sizeof(FallPath::pos)) * length + (sizeof(FallPath) - sizeof(FallPath::pos)));
m_pFallPath->length = length;
}
if (length) {
arc.ArchiveByte(&m_pFallPath->currentPos);
arc.ArchiveByte(&m_pFallPath->loop);
for (i = 0; i < length; i++) {
arc.ArchiveVec3(m_pFallPath->pos[i]);
}
}
arc.ArchiveFloat(&m_fBalconyHeight);
arc.ArchiveBool(&m_bNoPlayerCollision);
for (i = 0; i < MAX_ORIGIN_HISTORY; i++) {
arc.ArchiveVec2(m_vOriginHistory[i]);
}
arc.ArchiveInteger(&m_iCurrentHistory);
arc.ArchiveBool(&m_bEnemySwitch);
arc.ArchiveInteger(&m_iNationality);
// set the model
setModel();
}
/*
===============
Actor::SetDesiredLookDir
Change desired look direction.
===============
*/
inline void Actor::SetDesiredLookDir(vec3_t dir)
{
m_bHasDesiredLookAngles = true;
vectoangles(dir, m_DesiredLookAngles);
m_DesiredLookAngles[1] = m_DesiredLookAngles[1] - angles[1];
m_DesiredLookAngles[1] = AngleNormalize180(m_DesiredLookAngles[1]);
m_DesiredLookAngles[0] = AngleNormalize180(m_DesiredLookAngles[0]);
}
/*
===============
Actor::SetDesiredLookAnglesRelative
Change desired look angles relatively.
===============
*/
inline void Actor::SetDesiredLookAnglesRelative(vec3_t ang)
{
m_bHasDesiredLookAngles = true;
m_DesiredLookAngles[0] = AngleNormalize180(ang[0]);
m_DesiredLookAngles[1] = AngleNormalize180(ang[1]);
m_DesiredLookAngles[2] = AngleNormalize180(ang[2]);
}
/*
===============
Actor::ForwardLook
===============
*/
inline void Actor::ForwardLook(void)
{
m_bHasDesiredLookAngles = false;
}
inline bool Actor::EnemyIsDisguised(void)
{
if (!m_bEnemyIsDisguised && !m_Enemy->m_bIsDisguised) {
return false;
}
if (m_bForceAttackPlayer) {
return false;
}
if (m_ThinkState == THINKSTATE_ATTACK) {
return false;
}
return true;
}
inline bool Actor::AvoidingFacingWall(void) const
{
return m_eDontFaceWallMode > 5 && m_eDontFaceWallMode <= 8;
}
#if 0
// Set destination to node with duck or cover set. Class will find a path to that node, or a closer one.
class FindCoverMovement : public StandardMovement
{
public:
Actor *self;
inline qboolean validpath
(
PathNode *node,
int i
)
{
pathway_t *path;
PathNode *n;
path = &node->Child[ i ];
if ( !StandardMovement::validpath( node, i ) )
{
return false;
}
n = AI_GetNode( path->node );
if ( !n || self->CloseToEnemy( n->origin, 128 ) )
{
return false;
}
return true;
}
inline qboolean done
(
PathNode *node,
PathNode *end
)
{
if ( node == end )
{
return true;
}
//if ( node->reject )
if ( node->reject || !( node->nodeflags & ( AI_DUCK | AI_COVER ) ) )
{
return false;
}
if ( self )
{
node->reject = self->CanSeeEnemyFrom( node->origin );
return !node->reject;
}
return false;
}
};
// Set destination to node with flee set. Class will find a path to that node, or a closer one.
class FindFleeMovement : public StandardMovement
{
public:
Actor *self;
inline qboolean validpath
(
PathNode *node,
int i
)
{
pathway_t *path;
PathNode *n;
path = &node->Child[ i ];
if ( !StandardMovement::validpath( node, i ) )
{
return false;
}
n = AI_GetNode( path->node );
if ( !n || self->CloseToEnemy( n->origin, 128 ) )
{
return false;
}
return true;
}
inline qboolean done
(
PathNode *node,
PathNode *end
)
{
if ( node == end )
{
return true;
}
//if ( node->reject )
if ( node->reject || !( node->nodeflags & AI_FLEE ) )
{
return false;
}
if ( self )
{
node->reject = self->CanSeeEnemyFrom( node->origin );
return !node->reject;
}
return false;
}
};
class FindEnemyMovement : public StandardMovement
{
public:
Actor *self;
inline qboolean done
(
PathNode *node,
PathNode *end
)
{
if ( node == end )
{
return true;
}
if ( node->reject )
{
return false;
}
if ( self )
{
if ( self->currentEnemy )
{
node->reject = !self->CanShootFrom( node->origin, self->currentEnemy, false );
}
else
{
node->reject = false;
}
return !node->reject;
}
return false;
}
};
typedef PathFinder<FindCoverMovement> FindCoverPath;
typedef PathFinder<FindFleeMovement> FindFleePath;
typedef PathFinder<FindEnemyMovement> FindEnemyPath;
#endif
/*void AI_TargetPlayer( void );
class SpinningPlant : public Actor
{
public:
Mover *spinner_model;
Mover *spinner_clip;
CLASS_PROTOTYPE( SpinningPlant );
SpinningPlant();
~SpinningPlant();
void GetClip( Event *ev );
};
*/
|