Overview | Package | Class | Source | Class tree | Glossary | Deus Ex UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 00746 00747 00748 00749 00750 00751 00752 00753 00754 00755 00756 00757 00758 00759 00760 00761 00762 00763 00764 00765 00766 00767 00768 00769 00770 00771 00772 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 00790 00791 00792 00793 00794 00795 00796 00797 00798 00799 00800 00801 00802 00803 00804 00805 00806 00807 00808 00809 00810 00811 00812 00813 00814 00815 00816 00817 00818 00819 00820 00821 00822 00823 00824 00825 00826 00827 00828 00829 00830 00831 00832 00833 00834 00835 00836 00837 00838 00839 00840 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 00863 00864 00865 00866 00867 00868 00869 00870 00871 00872 00873 00874 00875 00876 00877 00878 00879 00880 00881 00882 00883 00884 00885 00886 00887 00888 00889 00890 00891 00892 00893 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 00908 00909 00910 00911 00912 00913 00914 00915 00916 00917 00918 00919 00920 00921 00922 00923 00924 00925 00926 00927 00928 00929 00930 00931 00932 00933 00934 00935 00936 00937 00938 00939 00940 00941 00942 00943 00944 00945 00946 00947 00948 00949 00950 00951 00952 00953 00954 00955 00956 00957 00958 00959 00960 00961 00962 00963 00964 00965 00966 00967 00968 00969 00970 00971 00972 00973 00974 00975 00976 00977 00978 00979 00980 00981 00982 00983 00984 00985 00986 00987 00988 00989 00990 00991 00992 00993 00994 00995 00996 00997 00998 00999 01000 01001 01002 01003 01004 01005 01006 01007 01008 01009 01010 01011 01012 01013 01014 01015 01016 01017 01018 01019 01020 01021 01022 01023 01024 01025 01026 01027 01028 01029 01030 01031 01032 01033 01034 01035 01036 01037 01038 01039 01040 01041 01042 01043 01044 01045 01046 01047 01048 01049 01050 01051 01052 01053 01054 01055 01056 01057 01058 01059 01060 01061 01062 01063 01064 01065 01066 01067 01068 01069 01070 01071 01072 01073 01074 01075 01076 01077 01078 01079 01080 01081 01082 01083 01084 01085 01086 01087 01088 01089 01090 01091 01092 01093 01094 01095 01096 01097 01098 01099 01100 01101 01102 01103 01104 01105 01106 01107 01108 01109 01110 01111 01112 01113 01114 01115 01116 01117 01118 01119 01120 01121 01122 01123 01124 01125 01126 01127 01128 01129 01130 01131 01132 01133 01134 01135 01136 01137 01138 01139 01140 01141 01142 01143 01144 01145 01146 01147 01148 01149 01150 01151 01152 01153 01154 01155 01156 01157 01158 01159 01160 01161 01162 01163 01164 01165 01166 01167 01168 01169 01170 01171 01172 01173 01174 01175 01176 01177 01178 01179 01180 01181 01182 01183 01184 01185 01186 01187 01188 01189 01190 01191 01192 01193 01194 01195 01196 01197 01198 01199 01200 01201 01202 01203 01204 01205 01206 01207 01208 01209 01210 01211 01212 01213 01214 01215 01216 01217 01218 01219 01220 01221 01222 01223 01224 01225 01226 01227 01228 01229 01230 01231 01232 01233 01234 01235 01236 01237 01238 01239 01240 01241 01242 01243 01244 01245 01246 01247 01248 01249 01250 01251 01252 01253 01254 01255 01256 01257 01258 01259 01260 01261 01262 01263 01264 01265 01266 01267 01268 01269 01270 01271 01272 01273 01274 01275 01276 01277 01278 01279 01280 01281 01282 01283 01284 01285 01286 01287 01288 01289 01290 01291 01292 01293 01294 01295 01296 01297 01298 01299 01300 01301 01302 01303 01304 01305 01306 01307 01308 01309 01310 01311 01312 01313 01314 01315 01316 01317 01318 01319 01320 01321 01322 01323 01324 01325 01326 01327 01328 01329 01330 01331 01332 01333 01334 01335 01336 01337 01338 01339 01340 01341 01342 01343 01344 01345 01346 01347 01348 01349 01350 01351 01352 01353 01354 01355 01356 01357 01358 01359 01360 01361 01362 01363 01364 01365 01366 01367 01368 01369 01370 01371 01372 01373 01374 01375 01376 01377 01378 01379 01380 01381 01382 01383 01384 01385 01386 01387 01388 01389 01390 01391 01392 01393 01394 01395 01396 01397 01398 01399 01400 01401 01402 01403 01404 01405 01406 01407 01408 01409 01410 01411 01412 01413 01414 01415 01416 01417 01418 01419 01420 01421 01422 01423 01424 01425 01426 01427 01428 01429 01430 01431 01432 01433 01434 01435 01436 01437 01438 01439 01440 01441 01442 01443 01444 01445 01446 01447 01448 01449 01450 01451 01452 01453 01454 01455 01456 01457 01458 01459 01460 01461 01462 01463 01464 01465 01466 01467 01468 01469 01470 01471 01472 01473 01474 01475 01476 01477 01478 01479 01480 01481 01482 01483 01484 01485 01486 01487 01488 01489 01490 01491 01492 01493 01494 01495 01496 01497 01498 01499 01500 01501 01502 01503 01504 01505 01506 01507 01508 01509 01510 01511 01512 01513 01514 01515 01516 01517 01518 01519 01520 01521 01522 01523 01524 01525 01526 01527 01528 01529 01530 01531 01532 01533 01534 01535 01536 01537 01538 01539 01540 01541 01542 01543 01544 01545 01546 01547 01548 01549 01550 01551 01552 01553 01554 01555 01556 01557 01558 01559 01560 01561 01562 01563 01564 01565 01566 01567 01568 01569 01570 01571 01572 01573 01574 01575 01576 01577 01578 01579 01580 01581 01582 01583 01584 01585 01586 01587 01588 01589 01590 01591 01592 01593 01594 01595 01596 01597 01598 01599 01600 01601 01602 01603 01604 01605 01606 01607 01608 01609 01610 01611 01612 01613 01614 01615 01616 01617 01618 01619 01620 01621 01622 01623 01624 01625 01626 01627 01628 01629 01630 01631 01632 01633 01634 01635 01636 01637 01638 01639 01640 01641 01642 01643 01644 01645 01646 01647 01648 01649 01650 01651 01652 01653 01654 01655 01656 01657 01658 01659 01660 01661 01662 01663 01664 01665 01666 01667 01668 01669 01670 01671 01672 01673 01674 01675 01676 01677 01678 01679 01680 01681 01682 01683 01684 01685 01686 01687 01688 01689 01690 01691 01692 01693 01694 01695 01696 01697 01698 01699 01700 01701 01702 01703 01704 01705 01706 01707 01708 01709 01710 01711 01712 01713 01714 01715 01716 01717 01718 01719 01720 01721 01722 01723 01724 01725 01726 01727 01728 01729 01730 01731 01732 01733 01734 01735 01736 01737 01738 01739 01740 01741 01742 01743 01744 01745 01746 01747 01748 01749 01750 01751 01752 01753 01754 01755 01756 01757 01758 01759 01760 01761 01762 01763 01764 01765 01766 01767 01768 01769 01770 01771 01772 01773 01774 01775 01776 01777 01778 01779 01780 01781 01782 01783 01784 01785 01786 01787 01788 01789 01790 01791 01792 01793 01794 01795 01796 01797 01798 01799 01800 01801 01802 01803 01804 01805 01806 01807 01808 01809 01810 01811 01812 01813 01814 01815 01816 01817 01818 01819 01820 01821 01822 01823 01824 01825 01826 01827 01828 01829 01830 01831 01832 01833 01834 01835 01836 01837 01838 01839 01840 01841 01842 01843 01844 01845 01846 01847 01848 01849 01850 01851 01852 01853 01854 01855 01856 01857 01858 01859 01860 01861 01862 01863 01864 01865 01866 01867 01868 01869 01870 01871 01872 01873 01874 01875 01876 01877 01878 01879 01880 01881 01882 01883 01884 01885 01886 01887 01888 01889 01890 01891 01892 01893 01894 01895 01896 01897 01898 01899 01900 01901 01902 01903 01904 01905 01906 01907 01908 01909 01910 01911 01912 01913 01914 01915 01916 01917 01918 01919 01920 01921 01922 01923 01924 01925 01926 01927 01928 01929 01930 01931 01932 01933 01934 01935 01936 01937 01938 01939 01940 01941 01942 01943 01944 01945 01946 01947 01948 01949 01950 01951 01952 01953 01954 01955 01956 01957 01958 01959 01960 01961 01962 01963 01964 01965 01966 01967 01968 01969 01970 01971 01972 01973 01974 01975 01976 01977 01978 01979 01980 01981 01982 01983 01984 01985 01986 01987 01988 01989 01990 01991 01992 01993 01994 01995 01996 01997 01998 01999 02000 02001 02002 02003 02004 02005 02006 02007 02008 02009 02010 02011 02012 02013 02014 02015 02016 02017 02018 02019 02020 02021 02022 02023 02024 02025 02026 02027 02028 02029 02030 02031 02032 02033 02034 02035 02036 02037 02038 02039 02040 02041 02042 02043 02044 02045 02046 02047 02048 02049 02050 02051 02052 02053 02054 02055 02056 02057 02058 02059 02060 02061 02062 02063 02064 02065 02066 02067 02068 02069 02070 02071 02072 02073 02074 02075 02076 02077 02078 02079 02080 02081 02082 02083 02084 02085 02086 02087 02088 02089 02090 02091 02092 02093 02094 02095 02096 02097 02098 02099 02100 02101 02102 02103 02104 02105 02106 02107 02108 02109 02110 02111 02112 02113 02114 02115 02116 02117 02118 02119 02120 02121 02122 02123 02124 02125 02126 02127 02128 02129 02130 02131 02132 02133 02134 02135 02136 02137 02138 02139 02140 02141 02142 02143 02144 02145 02146 02147 02148 02149 02150 02151 02152 02153 02154 02155 02156 02157 02158 02159 02160 02161 02162 02163 02164 02165 02166 02167 02168 02169 02170 02171 02172 02173 02174 02175 02176 02177 02178 02179 02180 02181 02182 02183 02184 02185 02186 02187 02188 02189 02190 02191 02192 02193 02194 02195 02196 02197 02198 02199 02200 02201 02202 02203 02204 02205 02206 02207 02208 02209 02210 02211 02212 02213 02214 02215 02216 02217 02218 02219 02220 02221 02222 02223 02224 02225 02226 02227 02228 02229 02230 02231 02232 02233 02234 02235 02236 02237 02238 02239 02240 02241 |
//============================================================================= // Pawn, the base class of all actors that can be controlled by players or AI. // This is a built-in Unreal class and it shouldn't be modified. //============================================================================= class Pawn extends Actor abstract native nativereplication; #exec Texture Import File=Textures\Pawn.pcx Name=S_Pawn Mips=Off Flags=2 //----------------------------------------------------------------------------- // Pawn variables. // General flags. var bool bBehindView; // Outside-the-player view. var bool bIsPlayer; // Pawn is a player or a player-bot. var bool bJustLanded; // used by eyeheight adjustment var bool bUpAndOut; // used by swimming var bool bIsWalking; var const bool bHitSlopedWall; // used by Physics var globalconfig bool bNeverSwitchOnPickup; // if true, don't automatically switch to picked up weapon var bool bWarping; // Set when travelling through warpzone (so shouldn't telefrag) var bool bUpdatingDisplay; // to avoid infinite recursion through inventory setdisplay //AI flags var(Combat) bool bCanStrafe; var(Orders) bool bFixedStart; var const bool bReducedSpeed; //used by movement natives var bool bCanJump; var bool bCanWalk; var bool bCanSwim; var bool bCanFly; var bool bCanOpenDoors; var bool bCanDoSpecial; var bool bDrowning; var const bool bLOSflag; // used for alternating LineOfSight traces var bool bFromWall; var bool bHunting; // tells navigation code that pawn is hunting another pawn, // so fall back to finding a path to a visible pathnode if none // are reachable var bool bAvoidLedges; // don't get too close to ledges var bool bStopAtLedges; // if bAvoidLedges and bStopAtLedges, Pawn doesn't try to walk along the edge at all var bool bJumpOffPawn; var bool bShootSpecial; var bool bAutoActivate; var bool bIsHuman; // for games which care about whether a pawn is a human var bool bIsFemale; var bool bIsMultiSkinned; var bool bCountJumps; var bool bAdvancedTactics; // used during movement between pathnodes var bool bViewTarget; var bool bCanGlide; // DEUS_EX STM -- added for flying/swimming states // Ticked pawn timers var float SightCounter; //Used to keep track of when to check player visibility var float PainTime; //used for getting PainTimer() messages (for Lava, no air, etc.) var float SpeechTime; // Physics updating time monitoring (for AI monitoring reaching destinations) var const float AvgPhysicsTime; // Additional pawn region information. var PointRegion FootRegion; var PointRegion HeadRegion; // Navigation AI var float MoveTimer; var Actor MoveTarget; // set by movement natives var Actor FaceTarget; // set by strafefacing native var vector Destination; // set by Movement natives var vector Focus; // set by Movement natives var float DesiredSpeed; var float MaxDesiredSpeed; var(Combat) float MeleeRange; // Max range for melee attack (not including collision radii) // Player and enemy movement. var(Movement) float GroundSpeed; // The maximum ground speed. var(Movement) float WaterSpeed; // The maximum swimming speed. var(Movement) float AirSpeed; // The maximum flying speed. var(Movement) float AccelRate; // max acceleration rate var(Movement) float JumpZ; // vertical acceleration w/ jump var(Movement) float MaxStepHeight; // Maximum size of upward/downward step. var(Movement) float AirControl; // amount of AirControl available to the pawn // AI basics. var float MinHitWall; // Minimum HitNormal dot Velocity.Normal to get a HitWall from the // physics var() byte Visibility; //How visible is the pawn? 0 = invisible. // 128 = normal. 255 = highly visible. var float Alertness; // -1 to 1 ->Used within specific states for varying reaction to stimuli var float Stimulus; // Strength of stimulus - Set when stimulus happens, used in Acquisition state var(AI) float SightRadius; //Maximum seeing distance. var(AI) float PeripheralVision;//Cosine of limits of peripheral vision. var(AI) float HearingThreshold; //Minimum noise loudness for hearing var vector LastSeenPos; // enemy position when I last saw enemy (auto updated if EnemyNotVisible() enabled) var vector LastSeeingPos; // position where I last saw enemy (auto updated if EnemyNotVisible enabled) var float LastSeenTime; var Pawn Enemy; // Player info. var travel Weapon Weapon; // The pawn's current weapon. var Weapon PendingWeapon; // Will become weapon once current weapon is put down var travel Inventory SelectedItem; // currently selected inventory item // Movement. var rotator ViewRotation; // View rotation. var vector WalkBob; var() float BaseEyeHeight; // Base eye height above collision center. var float EyeHeight; // Current eye height, adjusted for bobbing and stairs. var const vector Floor; // Normal of floor pawn is standing on (only used // by PHYS_Spider) var float SplashTime; // time of last splash // View var float OrthoZoom; // Orthogonal/map view zoom factor. var() float FovAngle; // X field of view angle in degrees, usually 90. // Player game statistics. var int DieCount, ItemCount, KillCount, SecretCount, Spree; //Health var() travel int Health; // Health: 100 = normal maximum // Selection Mesh var() string SelectionMesh; var() string SpecialMesh; // Inherent Armor (for creatures). var() name ReducedDamageType; //Either a damagetype name or 'All', 'AllEnvironment' (Burned, Corroded, Frozen) var() float ReducedDamagePct; // Inventory to drop when killed (for creatures) var() class<inventory> DropWhenKilled; // Zone pain var(Movement) float UnderWaterTime; //how much time pawn can go without air (in seconds) var(AI) enum EAttitude //important - order in decreasing importance { ATTITUDE_Fear, //will try to run away ATTITUDE_Hate, // will attack enemy ATTITUDE_Frenzy, //will attack anything, indiscriminately ATTITUDE_Threaten, // animations, but no attack ATTITUDE_Ignore, ATTITUDE_Friendly, ATTITUDE_Follow //accepts player as leader } AttitudeToPlayer; //determines how creature will react on seeing player (if in human form) var(AI) enum EIntelligence //important - order in increasing intelligence { BRAINS_NONE, //only reacts to immediate stimulus BRAINS_REPTILE, //follows to last seen position BRAINS_MAMMAL, //simple navigation (limited path length) BRAINS_HUMAN //complex navigation, team coordination, use environment stuff (triggers, etc.) } Intelligence; var(AI) float Skill; // skill, scaled by game difficulty (add difficulty to this value) var actor SpecialGoal; // used by navigation AI var float SpecialPause; // Sound and noise management var const vector noise1spot; var const float noise1time; var const pawn noise1other; var const float noise1loudness; var const vector noise2spot; var const float noise2time; var const pawn noise2other; var const float noise2loudness; var float LastPainSound; // chained pawn list var const pawn nextPawn; // Common sounds var(Sounds) sound HitSound1; var(Sounds) sound HitSound2; var(Sounds) sound Land; var(Sounds) sound Die; var(Sounds) sound WaterStep; // Input buttons. var input byte bZoom, bRun, bLook, bDuck, bSnapLevel, bStrafe, bFire, bAltFire, bFreeLook, bExtra0, bExtra1, bExtra2, bExtra3; var(Combat) float CombatStyle; // -1 to 1 = low means tends to stay off and snipe, high means tends to charge and melee var NavigationPoint home; //set when begin play, used for retreating and attitude checks var name NextState; //for queueing states var name NextLabel; //for queueing states var float SoundDampening; var float DamageScaling; var(Orders) name AlarmTag; // tag of object to go to when see player var(Orders) name SharedAlarmTag; var travel Decoration carriedDecoration; var Name PlayerReStartState; var() localized string MenuName; //Name used for this pawn type in menus (e.g. player selection) var() localized string NameArticle; //article used in conjunction with this class (e.g. "a", "an") var() byte VoicePitch; //for speech var() string VoiceType; //for speech var float OldMessageTime; //to limit frequency of voice messages // Route Cache for Navigation var NavigationPoint RouteCache[16]; // Replication Info var() class<PlayerReplicationInfo> PlayerReplicationInfoClass; var PlayerReplicationInfo PlayerReplicationInfo; // shadow decal var Decal Shadow; // // hit extents for Deus Ex - DEUS_EX CNN // var() travel int HealthHead; var() travel int HealthTorso; var() travel int HealthLegLeft; var() travel int HealthLegRight; var() travel int HealthArmLeft; var() travel int HealthArmRight; // // lip synching stuff for Deus Ex - DEUS_EX CNN // var bool bIsSpeaking; // are we speaking now var bool bWasSpeaking; // were we speaking last frame? (should we close our mouth?) var string lastPhoneme; // phoneme last spoken var string nextPhoneme; // phoneme to speak next var float animTimer[4]; // misc. timers for ambient anims (blink, head, etc.) // // misc. stuff for Deus Ex - DEUS_EX CNN // var bool bOnFire; var float burnTimer; // // additional AI variables - DEUS_EX STM // var(AI) float AIHorizontalFov; // degrees var(AI) float AspectRatio; // horizontal/vertical ratio var(AI) float AngularResolution; // degrees var float MinAngularSize; // tan(AngularResolution)^2 var(AI) float VisibilityThreshold; // lowest visible brightness (0-1) var(AI) float SmellThreshold; // lowest smellable odor (0-1) var(Alliances) Name Alliance; // alliance tag var Rotator AIAddViewRotation; // rotation added to view rotation for AICanSee() // // look direction - DEUS_EX STM // enum ELookDirection { LOOK_Forward, LOOK_Left, LOOK_Right, LOOK_Up, LOOK_Down }; replication { // Variables the server should send to the client. reliable if( Role==ROLE_Authority ) Weapon, PlayerReplicationInfo, Health, bCanFly, bIsWalking; reliable if( bNetOwner && Role==ROLE_Authority ) bIsPlayer, CarriedDecoration, SelectedItem, GroundSpeed, WaterSpeed, AirSpeed, AccelRate, JumpZ, AirControl, bBehindView, PlayerRestartState, HealthHead, HealthTorso, HealthLegLeft, HealthLegRight, HealthArmLeft, HealthArmRight, bOnFire, burnTimer; unreliable if( (bNetOwner && bIsPlayer && bNetInitial && Role==ROLE_Authority) || bDemoRecording ) ViewRotation; unreliable if( bNetOwner && Role==ROLE_Authority ) MoveTarget; reliable if( bDemoRecording ) EyeHeight; // Functions the server calls on the client side. reliable if( RemoteRole==ROLE_AutonomousProxy ) ClientDying, ClientReStart, ClientGameEnded, ClientSetRotation, ClientSetLocation, ClientPutDown; unreliable if( (!bDemoRecording || bClientDemoRecording && bClientDemoNetFunc) && Role==ROLE_Authority ) ClientHearSound; reliable if ( (!bDemoRecording || (bClientDemoRecording && bClientDemoNetFunc)) && Role == ROLE_Authority ) ClientVoiceMessage; reliable if ( (!bDemoRecording || (bClientDemoRecording && bClientDemoNetFunc) || (Level.NetMode==NM_Standalone && IsA('PlayerPawn'))) && Role == ROLE_Authority ) ClientMessage, TeamMessage, ReceiveLocalizedMessage; // Functions the client calls on the server. unreliable if( Role<ROLE_Authority ) SendVoiceMessage, NextItem, SwitchToBestWeapon, TeamBroadcast; reliable if(Role < ROLE_Authority) DropDecoration; } // Latent Movement. //Note that MoveTo sets the actor's Destination, and MoveToward sets the //actor's MoveTarget. Actor will rotate towards destination native(500) final latent function MoveTo( vector NewDestination, optional float speed); native(502) final latent function MoveToward(actor NewTarget, optional float speed); native(504) final latent function StrafeTo(vector NewDestination, vector NewFocus, optional float speed); // DEUS_EX STM - added new param native(506) final latent function StrafeFacing(vector NewDestination, actor NewTarget, optional float speed); // DEUS_EX STM - added new param native(508) final latent function TurnTo(vector NewFocus); native(510) final latent function TurnToward(actor NewTarget); // native AI functions //LineOfSightTo() returns true if any of several points of Other is visible //(but only if they are within 1000 distance units does it do the other checks, unless you use bIgnoreDistance) // (origin, top, bottom) native(514) final function bool LineOfSightTo(actor Other, optional bool bIgnoreDistance); // CanSee() similar to line of sight, but also takes into account Pawn's peripheral vision native(533) final function bool CanSee(actor Other); native(518) final function Actor FindPathTo(vector aPoint, optional bool bSinglePath, optional bool bClearPaths); native(517) final function Actor FindPathToward(actor anActor, optional bool bSinglePath, optional bool bClearPaths); native(525) final function NavigationPoint FindRandomDest(optional bool bClearPaths); native(522) final function ClearPaths(); native(523) final function vector EAdjustJump(); //Reachable returns what part of direct path from Actor to aPoint is traversable //using the current locomotion method native(521) final function bool pointReachable(vector aPoint); native(520) final function bool actorReachable(actor anActor); /* PickWallAdjust() Check if could jump up over obstruction (only if there is a knee height obstruction) If so, start jump, and return current destination Else, try to step around - return a destination 90 degrees right or left depending on traces out and floor checks */ native(526) final function bool PickWallAdjust(); native(524) final function int FindStairRotation(float DeltaTime); native(527) final latent function WaitForLanding(); native(540) final function actor FindBestInventoryPath(out float MinWeight, bool bPredictRespawns); native(529) final function AddPawn(); native(530) final function RemovePawn(); // Pick best pawn target native(531) final function pawn PickTarget(out float bestAim, out float bestDist, vector FireDir, vector projStart); native(534) final function actor PickAnyTarget(out float bestAim, out float bestDist, vector FireDir, vector projStart); // New AI functions - DEUS_EX STM native(705) final function float AICanSee(actor other, optional float visibility, optional bool bCheckVisibility, optional bool bCheckDir, optional bool bCheckCylinder, optional bool bCheckLOS); native(706) final function float AICanHear(actor other, optional float Volume, optional float Radius); native(707) final function float AICanSmell(actor other, optional float smell); native(708) final function bool AIDirectionReachable(vector focus, int yaw, int pitch, float minDist, float maxDist, out vector bestDest); native(709) final function bool AIPickRandomDestination(float minDist, float maxDist, int centralYaw, float yawDistribution, int centralPitch, float pitchDistribution, int tries, float multiplier, out vector dest); native(1004) final iterator function ReachablePathnodes(class<NavigationPoint> BaseClass, out NavigationPoint NavPoint, Actor FromPoint, out float distance, optional bool bUsePrunedPaths); native(1020) final function ComputePathnodeDistances(optional actor startActor); // Force end to sleep native function StopWaiting(); event MayFall(); //return true if allowed to fall - called by engine when pawn is about to fall event AlterDestination(); // called when using movetoward with bAdvancedTactics true to temporarily modify destination function EncroachedByMover(Mover encroacher); // DEUS_EX STM simulated event RenderOverlays( canvas Canvas ) { if ( Weapon != None ) Weapon.RenderOverlays(Canvas); } function String GetHumanName() { if ( PlayerReplicationInfo != None ) return PlayerReplicationInfo.PlayerName; return NameArticle$MenuName; } function ClientPutDown(Weapon Current, Weapon Next) { Current.ClientPutDown(Next); } function SetDisplayProperties(ERenderStyle NewStyle, texture NewTexture, bool bLighting, bool bEnviroMap ) { Style = NewStyle; texture = NewTexture; bUnlit = bLighting; bMeshEnviromap = bEnviromap; if ( Weapon != None ) Weapon.SetDisplayProperties(Style, Texture, bUnlit, bMeshEnviromap); if ( !bUpdatingDisplay && (Inventory != None) ) { bUpdatingDisplay = true; Inventory.SetOwnerDisplay(); } bUpdatingDisplay = false; } function SetDefaultDisplayProperties() { Style = Default.Style; texture = Default.Texture; bUnlit = Default.bUnlit; bMeshEnviromap = Default.bMeshEnviromap; if ( Weapon != None ) Weapon.SetDisplayProperties(Weapon.Default.Style, Weapon.Default.Texture, Weapon.Default.bUnlit, Weapon.Default.bMeshEnviromap); if ( !bUpdatingDisplay && (Inventory != None) ) { bUpdatingDisplay = true; Inventory.SetOwnerDisplay(); } bUpdatingDisplay = false; } // // Client gateway functions. // event ClientMessage( coerce string S, optional name Type, optional bool bBeep ); event TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type, optional bool bBeep ); event ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ); function BecomeViewTarget() { bViewTarget = true; } event FellOutOfWorld() { Health = -1; SetPhysics(PHYS_None); Weapon = None; Died(None, 'Fell', Location); } function PlayRecoil(float Rate); function SpecialFire(); function bool CheckFutureSight(float DeltaTime) { return true; } function RestartPlayer(); // // Broadcast a message to all players, or all on the same team. // function TeamBroadcast( coerce string Msg) { local Pawn P; local bool bGlobal; if ( Left(Msg, 1) ~= "@" ) { Msg = Right(Msg, Len(Msg)-1); bGlobal = true; } if ( Left(Msg, 1) ~= "." ) Msg = "."$VoicePitch$Msg; if ( bGlobal || !Level.Game.bTeamGame ) { if ( Level.Game.AllowsBroadcast(self, Len(Msg)) ) for( P=Level.PawnList; P!=None; P=P.nextPawn ) if( P.bIsPlayer || P.IsA('MessagingSpectator') ) P.TeamMessage( PlayerReplicationInfo, Msg, 'Say' ); return; } if ( Level.Game.AllowsBroadcast(self, Len(Msg)) ) for( P=Level.PawnList; P!=None; P=P.nextPawn ) if( P.bIsPlayer && (P.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) ) { if ( P.IsA('PlayerPawn') ) P.TeamMessage( PlayerReplicationInfo, Msg, 'TeamSay' ); } } //------------------------------------------------------------------------------ // Speech related function SendGlobalMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait) { SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, 'GLOBAL'); } function SendTeamMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait) { SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, 'TEAM'); } function SendVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID, name broadcasttype) { local Pawn P; local bool bNoSpeak; if ( Level.TimeSeconds - OldMessageTime < 2.5 ) bNoSpeak = true; else OldMessageTime = Level.TimeSeconds; for ( P=Level.PawnList; P!=None; P=P.NextPawn ) { if ( P.IsA('PlayerPawn') ) { if ( !bNoSpeak ) { if ( (broadcasttype == 'GLOBAL') || !Level.Game.bTeamGame ) P.ClientVoiceMessage(Sender, Recipient, messagetype, messageID); else if ( Sender.Team == P.PlayerReplicationInfo.Team ) P.ClientVoiceMessage(Sender, Recipient, messagetype, messageID); } } else if ( (P.PlayerReplicationInfo == Recipient) || ((messagetype == 'ORDER') && (Recipient == None)) ) P.BotVoiceMessage(messagetype, messageID, self); } } function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID); function BotVoiceMessage(name messagetype, byte MessageID, Pawn Sender); //*************************************************************** function HandleHelpMessageFrom(Pawn Other); function FearThisSpot(Actor ASpot); function float GetRating() { return 1000; } function AddVelocity( vector NewVelocity) { if (Physics == PHYS_Walking) SetPhysics(PHYS_Falling); if ( (Velocity.Z > 380) && (NewVelocity.Z > 0) ) NewVelocity.Z *= 0.5; Velocity += NewVelocity; } function ClientSetLocation( vector NewLocation, rotator NewRotation ) { local Pawn P; ViewRotation = NewRotation; If ( (ViewRotation.Pitch > RotationRate.Pitch) && (ViewRotation.Pitch < 65536 - RotationRate.Pitch) ) { If (ViewRotation.Pitch < 32768) NewRotation.Pitch = RotationRate.Pitch; else NewRotation.Pitch = 65536 - RotationRate.Pitch; } NewRotation.Roll = 0; SetRotation( NewRotation ); SetLocation( NewLocation ); } function ClientSetRotation( rotator NewRotation ) { local Pawn P; ViewRotation = NewRotation; NewRotation.Pitch = 0; NewRotation.Roll = 0; SetRotation( NewRotation ); } function ClientDying(name DamageType, vector HitLocation) { PlayDying(DamageType, HitLocation); GotoState('Dying'); } function ClientReStart() { //log("client restart"); Velocity = vect(0,0,0); Acceleration = vect(0,0,0); BaseEyeHeight = Default.BaseEyeHeight; EyeHeight = BaseEyeHeight; PlayWaiting(); if ( Region.Zone.bWaterZone && (PlayerRestartState == 'PlayerWalking') ) { if (HeadRegion.Zone.bWaterZone) PainTime = UnderWaterTime; setPhysics(PHYS_Swimming); GotoState('PlayerSwimming'); } else GotoState(PlayerReStartState); } function ClientGameEnded() { GotoState('GameEnded'); } //============================================================================= // Inventory related functions. function float AdjustDesireFor(Inventory Inv) { return 0; } // toss out the weapon currently held function TossWeapon() { local vector X,Y,Z; if ( Weapon == None ) return; GetAxes(Rotation,X,Y,Z); Weapon.DropFrom(Location + 0.8 * CollisionRadius * X + - 0.5 * CollisionRadius * Y); } // The player/bot wants to select next item exec function NextItem() { local Inventory Inv; // DEUS_EX CNN - this function is EVIL! return; if (SelectedItem==None) { SelectedItem = Inventory.SelectNext(); Return; } if (SelectedItem.Inventory!=None) SelectedItem = SelectedItem.Inventory.SelectNext(); else SelectedItem = Inventory.SelectNext(); if ( SelectedItem == None ) SelectedItem = Inventory.SelectNext(); } // FindInventoryType() // returns the inventory item of the requested class // if it exists in this pawn's inventory function Inventory FindInventoryType( class DesiredClass ) { local Inventory Inv; for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) if ( Inv.class == DesiredClass ) return Inv; return None; } // Add Item to this pawn's inventory. // Returns true if successfully added, false if not. function bool AddInventory( inventory NewItem ) { // Skip if already in the inventory. local inventory Inv; // The item should not have been destroyed if we get here. if (NewItem ==None ) log("tried to add none inventory to "$self); for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) if( Inv == NewItem ) return false; // DEUS_EX AJY // Update the previous owner's inventory chain if (NewItem.Owner != None) Pawn(NewItem.Owner).DeleteInventory(NewItem); // Add to front of inventory chain. NewItem.SetOwner(Self); NewItem.Inventory = Inventory; Inventory = NewItem; return true; } // Remove Item from this pawn's inventory, if it exists. // Returns true if it existed and was deleted, false if it did not exist. function bool DeleteInventory( inventory Item ) { // If this item is in our inventory chain, unlink it. local actor Link; if ( Item == Weapon ) Weapon = None; if ( Item == SelectedItem ) SelectedItem = None; for( Link = Self; Link!=None; Link=Link.Inventory ) { if( Link.Inventory == Item ) { Link.Inventory = Item.Inventory; break; } } Item.SetOwner(None); } // Just changed to pendingWeapon function ChangedWeapon() { local Weapon OldWeapon; OldWeapon = Weapon; if (Weapon == PendingWeapon) { if ( Weapon == None ) SwitchToBestWeapon(); else if ( Weapon.IsInState('DownWeapon') ) Weapon.BringUp(); if ( Weapon != None ) Weapon.SetDefaultDisplayProperties(); Inventory.ChangedWeapon(); // tell inventory that weapon changed (in case any effect was being applied) PendingWeapon = None; return; } // removed these lines so you don't automatically pick another weapon - DEUS_EX CNN // if ( PendingWeapon == None ) // PendingWeapon = Weapon; PlayWeaponSwitch(PendingWeapon); if ( (PendingWeapon != None) && (PendingWeapon.Mass > 20) && (carriedDecoration != None) ) DropDecoration(); if ( Weapon != None ) Weapon.SetDefaultDisplayProperties(); Weapon = PendingWeapon; Inventory.ChangedWeapon(); // tell inventory that weapon changed (in case any effect was being applied) if ( Weapon != None ) { Weapon.RaiseUp(OldWeapon); if ( (Level.Game != None) && (Level.Game.Difficulty > 1) ) MakeNoise(0.1 * Level.Game.Difficulty); } PendingWeapon = None; } //============== // Encroachment event bool EncroachingOn( actor Other ) { if ( (Other.Brush != None) || (Brush(Other) != None) ) return true; if ( (!bIsPlayer || bWarping) && (Pawn(Other) != None)) return true; return false; } event EncroachedBy( actor Other ) { if ( Pawn(Other) != None ) gibbedBy(Other); } function gibbedBy(actor Other) { local pawn instigatedBy; instigatedBy = pawn(Other); if (instigatedBy == None) instigatedBy = Other.instigator; health = -1000; //make sure gibs Died(instigatedBy, 'Gibbed', Location); } event PlayerTimeOut() { if (Health > 0) Died(None, 'Suicided', Location); } //Base change - if new base is pawn or decoration, damage based on relative mass and old velocity // Also, non-players will jump off pawns immediately function JumpOffPawn() { Velocity += 60 * VRand(); Velocity.Z = 180; SetPhysics(PHYS_Falling); } function UnderLift(Mover M); singular event BaseChange() { local float decorMass; if ( (base == None) && (Physics == PHYS_None) ) SetPhysics(PHYS_Falling); else if (Pawn(Base) != None) { Base.TakeDamage( (1-Velocity.Z/400)* Mass/Base.Mass, Self,Location,0.5 * Velocity , 'stomped'); JumpOffPawn(); } else if ( (Decoration(Base) != None) && (Velocity.Z < -400) ) { decorMass = FMax(Decoration(Base).Mass, 1); Base.TakeDamage((-2* Mass/decorMass * Velocity.Z/400), Self, Location, 0.5 * Velocity, 'stomped'); } } event LongFall(); //============================================================================= // Network related functions. simulated event Destroyed() { local Inventory Inv; local Pawn OtherPawn; if ( Shadow != None ) Shadow.Destroy(); RemovePawn(); if ( Role < ROLE_Authority ) return; for( Inv=Inventory; Inv!=None; Inv=Inv.Inventory ) Inv.Destroy(); Weapon = None; Inventory = None; if ( bIsPlayer && (Level.Game != None) ) Level.Game.logout(self); if ( PlayerReplicationInfo != None ) PlayerReplicationInfo.Destroy(); for ( OtherPawn=Level.PawnList; OtherPawn!=None; OtherPawn=OtherPawn.nextPawn ) OtherPawn.Killed(None, self, ''); Super.Destroyed(); } //============================================================================= // functions. // // native client-side functions. // native simulated event ClientHearSound ( actor Actor, int Id, sound S, vector SoundLocation, vector Parameters ); // // Called immediately before gameplay begins. // event PreBeginPlay() { AddPawn(); Super.PreBeginPlay(); if ( bDeleteMe ) return; // Added angular size computation - DEUS_EX STM MinAngularSize = tan(AngularResolution*0.5*Pi/180.0); MinAngularSize *= MinAngularSize; // Set instigator to self. Instigator = Self; DesiredRotation = Rotation; SightCounter = 0.2 * FRand(); //offset randomly if ( Level.Game != None ) Skill += Level.Game.Difficulty; Skill = FClamp(Skill, 0, 3); PreSetMovement(); if ( DrawScale != Default.Drawscale ) { SetCollisionSize(CollisionRadius*DrawScale/Default.DrawScale, CollisionHeight*DrawScale/Default.DrawScale); Health = Health * DrawScale/Default.DrawScale; } if (bIsPlayer) { if (PlayerReplicationInfoClass != None) PlayerReplicationInfo = Spawn(PlayerReplicationInfoClass, Self,,vect(0,0,0),rot(0,0,0)); else PlayerReplicationInfo = Spawn(class'PlayerReplicationInfo', Self,,vect(0,0,0),rot(0,0,0)); InitPlayerReplicationInfo(); } if (!bIsPlayer) { if ( BaseEyeHeight == 0 ) BaseEyeHeight = 0.8 * CollisionHeight; EyeHeight = BaseEyeHeight; if (Fatness == 0) //vary monster fatness slightly if at default Fatness = 120 + Rand(8) + Rand(8); } if ( menuname == "" ) menuname = GetItemName(string(class)); if (SelectionMesh == "") SelectionMesh = string(Mesh); } event PostBeginPlay() { Super.PostBeginPlay(); SplashTime = 0; } simulated event PostNetBeginPlay() { local pawn CurPawn; local bool bAlreadyAdded; Super.PostNetBeginPlay(); bAlreadyAdded = false; for (CurPawn = Level.PawnList; CurPawn != None; CurPawn = CurPawn.NextPawn) { if (CurPawn == Self) { bAlreadyAdded = true; break; } } if (!bAlreadyAdded) { AddPawn(); } return; } /* PreSetMovement() default for walking creature. Re-implement in subclass for swimming/flying capability */ function PreSetMovement() { if (JumpZ > 0) bCanJump = true; bCanWalk = true; bCanSwim = false; bCanFly = false; MinHitWall = -0.6; if (Intelligence > BRAINS_Reptile) bCanOpenDoors = true; if (Intelligence == BRAINS_Human) bCanDoSpecial = true; } //============================================================================= // Multiskin support static function SetMultiSkin( actor SkinActor, string SkinName, string FaceName, byte TeamNum ) { local Texture NewSkin; if(SkinName != "") { NewSkin = texture(DynamicLoadObject(SkinName, class'Texture')); if ( NewSkin != None ) SkinActor.Skin = NewSkin; } } static function GetMultiSkin( Actor SkinActor, out string SkinName, out string FaceName ) { SkinName = String(SkinActor.Skin); FaceName = ""; } static function bool SetSkinElement(Actor SkinActor, int SkinNo, string SkinName, string DefaultSkinName) { local Texture NewSkin; NewSkin = Texture(DynamicLoadObject(SkinName, class'Texture')); if ( NewSkin != None ) { SkinActor.Multiskins[SkinNo] = NewSkin; return True; } else { log("Failed to load "$SkinName); if(DefaultSkinName != "") { NewSkin = Texture(DynamicLoadObject(DefaultSkinName, class'Texture')); SkinActor.Multiskins[SkinNo] = NewSkin; } return False; } } //============================================================================= // Replication function InitPlayerReplicationInfo() { if (PlayerReplicationInfo.PlayerName == "") PlayerReplicationInfo.PlayerName = class'GameInfo'.Default.DefaultPlayerName; } //============================================================================= // Animation playing - should be implemented in subclass, // // PlayWaiting, PlayRunning, and PlayGutHit, PlayMovingAttack (if used) // and PlayDying are required to be implemented in the subclass function PlayRunning() { ////log("Error - PlayRunning should be implemented in subclass of"@class); } function PlayWalking() { PlayRunning(); } function PlayWaiting() { ////log("Error - PlayWaiting should be implemented in subclass"); } function PlayMovingAttack() { ////log("Error - PlayMovingAttack should be implemented in subclass"); //Note - must restart attack timer when done with moving attack PlayRunning(); } function PlayWaitingAmbush() { PlayWaiting(); } function TweenToFighter(float tweentime) { } function TweenToRunning(float tweentime) { TweenToFighter(0.1); } function TweenToWalking(float tweentime) { TweenToRunning(tweentime); } function TweenToPatrolStop(float tweentime) { TweenToFighter(tweentime); } function TweenToWaiting(float tweentime) { TweenToFighter(tweentime); } function PlayThreatening() { TweenToFighter(0.1); } function PlayPatrolStop() { PlayWaiting(); } function PlayTurning() { TweenToFighter(0.1); } function PlayBigDeath(name DamageType); function PlayHeadDeath(name DamageType); function PlayLeftDeath(name DamageType); function PlayRightDeath(name DamageType); function PlayGutDeath(name DamageType); function PlayDying(name DamageType, vector HitLoc) { local vector X,Y,Z, HitVec, HitVec2D; local float dotp; if ( Velocity.Z > 250 ) { PlayBigDeath(DamageType); return; } if ( DamageType == 'Decapitated' ) { PlayHeadDeath(DamageType); return; } GetAxes(Rotation,X,Y,Z); X.Z = 0; HitVec = Normal(HitLoc - Location); HitVec2D= HitVec; HitVec2D.Z = 0; dotp = HitVec2D dot X; //first check for head hit if ( HitLoc.Z - Location.Z > 0.5 * CollisionHeight ) { if (dotp > 0) PlayHeadDeath(DamageType); else PlayGutDeath(DamageType); return; } if (dotp > 0.71) //then hit in front PlayGutDeath(DamageType); else { dotp = HitVec dot Y; if (dotp > 0.0) PlayLeftDeath(DamageType); else PlayRightDeath(DamageType); } } function PlayGutHit(float tweentime) { log("Error - play gut hit must be implemented in subclass of"@class); } function PlayHeadHit(float tweentime) { PlayGutHit(tweentime); } function PlayLeftHit(float tweentime) { PlayGutHit(tweentime); } function PlayRightHit(float tweentime) { PlayGutHit(tweentime); } function FireWeapon(); /* TraceShot - used by instant hit weapons, and monsters */ function actor TraceShot(out vector HitLocation, out vector HitNormal, vector EndTrace, vector StartTrace) { local vector realHit; local actor Other; Other = Trace(HitLocation,HitNormal,EndTrace,StartTrace,True); if ( Pawn(Other) != None ) { realHit = HitLocation; if ( !Pawn(Other).AdjustHitLocation(HitLocation, EndTrace - StartTrace) ) Other = Pawn(Other).TraceShot(HitLocation,HitNormal,EndTrace,realHit); } return Other; } /* Adjust hit location - adjusts the hit location in for pawns, and returns true if it was really a hit, and false if not (for ducking, etc.) */ simulated function bool AdjustHitLocation(out vector HitLocation, vector TraceDir) { local float adjZ, maxZ; TraceDir = Normal(TraceDir); HitLocation = HitLocation + 0.4 * CollisionRadius * TraceDir; /* DEUS_EX STM -- took this out because it fucks up crouching if ( (GetAnimGroup(AnimSequence) == 'Ducking') && (AnimFrame > -0.03) ) { maxZ = Location.Z + 0.25 * CollisionHeight; if ( HitLocation.Z > maxZ ) { if ( TraceDir.Z >= 0 ) return false; adjZ = (maxZ - HitLocation.Z)/TraceDir.Z; HitLocation.Z = maxZ; HitLocation.X = HitLocation.X + TraceDir.X * adjZ; HitLocation.Y = HitLocation.Y + TraceDir.Y * adjZ; if ( VSize(HitLocation - Location) > CollisionRadius ) return false; } } */ return true; } function PlayTakeHit(float tweentime, vector HitLoc, int damage) { local vector X,Y,Z, HitVec, HitVec2D; local float dotp; GetAxes(Rotation,X,Y,Z); X.Z = 0; HitVec = Normal(HitLoc - Location); HitVec2D= HitVec; HitVec2D.Z = 0; dotp = HitVec2D dot X; //first check for head hit if ( HitLoc.Z - Location.Z > 0.5 * CollisionHeight ) { if (dotp > 0) PlayHeadHit(tweentime); else PlayGutHit(tweentime); return; } if (dotp > 0.71) //then hit in front PlayGutHit( tweentime); else if (dotp < -0.71) // then hit in back PlayHeadHit(tweentime); else { dotp = HitVec dot Y; if (dotp > 0.0) PlayLeftHit(tweentime); else PlayRightHit(tweentime); } } function PlayVictoryDance() { TweenToFighter(0.1); } function PlayOutOfWater() { TweenToFalling(); } function PlayDive(); function TweenToFalling(); function PlayInAir(); function PlayDuck(); function PlayCrawling(); function PlayLanded(float impactVel) { local float landVol; //default - do nothing (keep playing existing animation) landVol = impactVel/JumpZ; landVol = 0.005 * Mass * landVol * landVol; PlaySound(Land, SLOT_Interact, FMin(20, landVol)); } function PlayFiring(); function PlayWeaponSwitch(Weapon NewWeapon); function TweenToSwimming(float tweentime); //----------------------------------------------------------------------------- // Sound functions function PlayTakeHitSound(int Damage, name damageType, int Mult) { if ( Level.TimeSeconds - LastPainSound < 0.25 ) return; if (HitSound1 == None)return; LastPainSound = Level.TimeSeconds; if (FRand() < 0.5) PlaySound(HitSound1, SLOT_Pain, FMax(Mult * TransientSoundVolume, Mult * 2.0)); else PlaySound(HitSound2, SLOT_Pain, FMax(Mult * TransientSoundVolume, Mult * 2.0)); } function Gasp(); function DropDecoration() { if (CarriedDecoration != None) { CarriedDecoration.bWasCarried = true; CarriedDecoration.SetBase(None); CarriedDecoration.SetPhysics(PHYS_Falling); CarriedDecoration.Velocity = Velocity + 10 * VRand(); CarriedDecoration.Instigator = self; // turn off translucency - DEUS_EX CNN CarriedDecoration.Style = CarriedDecoration.Default.Style; CarriedDecoration.ScaleGlow = CarriedDecoration.Default.ScaleGlow; CarriedDecoration.bUnlit = CarriedDecoration.Default.bUnlit; CarriedDecoration = None; } } function GrabDecoration() { local vector lookDir, HitLocation, HitNormal, T1, T2, extent; local actor HitActor; if ( carriedDecoration == None ) { //first trace to find it lookDir = vector(Rotation); lookDir.Z = 0; T1 = Location + BaseEyeHeight * vect(0,0,1) + lookDir * 0.8 * CollisionRadius; T2 = T1 + lookDir * 1.2 * CollisionRadius; HitActor = Trace(HitLocation, HitNormal, T2, T1, true); if ( HitActor == None ) { T1 = T2 - (BaseEyeHeight + CollisionHeight - 2) * vect(0,0,1); HitActor = Trace(HitLocation, HitNormal, T1, T2, true); } else if ( HitActor == Level ) { T2 = HitLocation - lookDir; T1 = T2 - (BaseEyeHeight + CollisionHeight - 2) * vect(0,0,1); HitActor = Trace(HitLocation, HitNormal, T1, T2, true); } if ( (HitActor == None) || (HitActor == Level) ) { extent.X = CollisionRadius; extent.Y = CollisionRadius; extent.Z = CollisionHeight; HitActor = Trace(HitLocation, HitNormal, Location + lookDir * 1.2 * CollisionRadius, Location, true, extent); } if ( Mover(HitActor) != None ) { if ( Mover(HitActor).bUseTriggered ) HitActor.Trigger( self, self ); } else if ( (Decoration(HitActor) != None) && ((weapon == None) || (weapon.Mass < 20)) ) { CarriedDecoration = Decoration(HitActor); if ( !CarriedDecoration.bPushable || (CarriedDecoration.Mass > 40) || (CarriedDecoration.StandingCount > 0) ) { CarriedDecoration = None; return; } lookDir.Z = 0; if ( CarriedDecoration.SetLocation(Location + (0.5 * CollisionRadius + CarriedDecoration.CollisionRadius) * lookDir) ) { CarriedDecoration.SetPhysics(PHYS_None); CarriedDecoration.SetBase(self); // make it translucent - DEUS_EX CNN CarriedDecoration.Style = STY_Translucent; CarriedDecoration.ScaleGlow = 1.0; CarriedDecoration.bUnlit = True; } else CarriedDecoration = None; } } } function StopFiring(); function ShakeView( float shaketime, float RollMag, float vertmag); function TakeFallingDamage() { if (Velocity.Z < -1.4 * JumpZ) { MakeNoise(-0.5 * Velocity.Z/(FMax(JumpZ, 150.0))); if (Velocity.Z <= -750 - JumpZ) { if ( (Velocity.Z < -1650 - JumpZ) && (ReducedDamageType != 'All') ) TakeDamage(1000, None, Location, vect(0,0,0), 'Fell'); else if ( Role == ROLE_Authority ) TakeDamage(-0.15 * (Velocity.Z + 700 + JumpZ), None, Location, vect(0,0,0), 'Fell'); ShakeView(0.175 - 0.00007 * Velocity.Z, -0.85 * Velocity.Z, -0.002 * Velocity.Z); } } else if ( Velocity.Z > 0.5 * Default.JumpZ ) MakeNoise(0.35); } /* AdjustAim() ScriptedPawn version does adjustment for non-controlled pawns. PlayerPawn version does the adjustment for player aiming help. Only adjusts aiming at pawns allows more error in Z direction (full as defined by AutoAim - only half that difference for XY) */ function rotator AdjustAim(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget) { return ViewRotation; } function rotator AdjustToss(float projSpeed, vector projStart, int aimerror, bool bLeadTarget, bool bWarnTarget) { return ViewRotation; } function WarnTarget(Pawn shooter, float projSpeed, vector FireDir) { // AI controlled creatures may duck // if not falling, and projectile time is long enough // often pick opposite to current direction (relative to shooter axis) } function SetMovementPhysics() { //implemented in sub-class } function PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum) { } function PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum) { } function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType) { local int actualDamage; local bool bAlreadyDead; if ( Role < ROLE_Authority ) { log(self$" client damage type "$damageType$" by "$instigatedBy); return; } //log(self@"take damage in state"@GetStateName()); bAlreadyDead = (Health <= 0); if (Physics == PHYS_None) SetMovementPhysics(); if (Physics == PHYS_Walking) momentum.Z = FMax(momentum.Z, 0.4 * VSize(momentum)); if ( instigatedBy == self ) momentum *= 0.6; momentum = momentum/Mass; AddVelocity( momentum ); actualDamage = Level.Game.ReduceDamage(Damage, DamageType, self, instigatedBy); if ( bIsPlayer ) { if (ReducedDamageType == 'All') //God mode actualDamage = 0; else if (Inventory != None) //then check if carrying armor actualDamage = Inventory.ReduceDamage(actualDamage, DamageType, HitLocation); else actualDamage = Damage; } else if ( (InstigatedBy != None) && (InstigatedBy.IsA(Class.Name) || self.IsA(InstigatedBy.Class.Name)) ) ActualDamage = ActualDamage * FMin(1 - ReducedDamagePct, 0.35); else if ( (ReducedDamageType == 'All') || ((ReducedDamageType != '') && (ReducedDamageType == damageType)) ) actualDamage = float(actualDamage) * (1 - ReducedDamagePct); if ( Level.Game.DamageMutator != None ) Level.Game.DamageMutator.MutatorTakeDamage( ActualDamage, Self, InstigatedBy, HitLocation, Momentum, DamageType ); Health -= actualDamage; if (CarriedDecoration != None) DropDecoration(); if ( HitLocation == vect(0,0,0) ) HitLocation = Location; if (Health > 0) { if ( (instigatedBy != None) && (instigatedBy != Self) ) damageAttitudeTo(instigatedBy); PlayHit(actualDamage, hitLocation, damageType, Momentum); } else if ( !bAlreadyDead ) { //log(self$" died"); NextState = ''; PlayDeathHit(actualDamage, hitLocation, damageType, Momentum); if ( actualDamage > mass ) Health = -1 * actualDamage; if ( (instigatedBy != None) && (instigatedBy != Self) ) damageAttitudeTo(instigatedBy); Died(instigatedBy, damageType, HitLocation); } else { //Warn(self$" took regular damage "$damagetype$" from "$instigator$" while already dead"); // SpawnGibbedCarcass(); if ( bIsPlayer ) { HidePlayer(); GotoState('Dying'); } else Destroy(); } MakeNoise(1.0); } function Died(pawn Killer, name damageType, vector HitLocation) { local pawn OtherPawn; local actor A; if ( bDeleteMe ) return; //already destroyed Health = Min(0, Health); for ( OtherPawn=Level.PawnList; OtherPawn!=None; OtherPawn=OtherPawn.nextPawn ) OtherPawn.Killed(Killer, self, damageType); if ( CarriedDecoration != None ) DropDecoration(); level.game.Killed(Killer, self, damageType); //log(class$" dying"); if( Event != '' ) foreach AllActors( class 'Actor', A, Event ) A.Trigger( Self, Killer ); Level.Game.DiscardInventory(self); Velocity.Z *= 1.3; if ( Gibbed(damageType) ) { SpawnGibbedCarcass(); if ( bIsPlayer ) HidePlayer(); else Destroy(); } PlayDying(DamageType, HitLocation); if ( Level.Game.bGameEnded ) return; if ( RemoteRole == ROLE_AutonomousProxy ) ClientDying(DamageType, HitLocation); GotoState('Dying'); } function bool Gibbed(name damageType) { return false; } function Carcass SpawnCarcass() { log(self$" should never call base spawncarcass"); return None; } function SpawnGibbedCarcass() { } function HidePlayer() { SetCollision(false, false, false); TweenToFighter(0.01); bHidden = true; } event HearNoise( float Loudness, Actor NoiseMaker); event SeePlayer( actor Seen ); event UpdateEyeHeight( float DeltaTime ); event UpdateTactics(float DeltaTime); // for advanced tactics event EnemyNotVisible(); function Killed(pawn Killer, pawn Other, name damageType) { if ( Enemy == Other ) Enemy = None; } //Typically implemented in subclass function string KillMessage( name damageType, pawn Other ) { local string message; message = Level.Game.CreatureKillMessage(damageType, Other); return (message$namearticle$menuname); } function damageAttitudeTo(pawn Other); function Falling() { //SetPhysics(PHYS_Falling); //Note - physics changes type to PHYS_Falling by default //log(class$" Falling"); PlayInAir(); } //LEGEND:begin // Pawn interface called while PHYS_Walking and PHYS_Swimming to update the pawn with // the latest information about the walk surface event WalkTexture( texture Texture, vector StepLocation, vector StepNormal ); //LEGEND:end event Landed(vector HitNormal) { SetMovementPhysics(); if ( !IsAnimating() ) PlayLanded(Velocity.Z); if (Velocity.Z < -1.4 * JumpZ) MakeNoise(-0.5 * Velocity.Z/(FMax(JumpZ, 150.0))); bJustLanded = true; } event FootZoneChange(ZoneInfo newFootZone) { local actor HitActor; local vector HitNormal, HitLocation; local float splashSize; local actor splash; if ( Level.NetMode == NM_Client ) return; if ( Level.TimeSeconds - SplashTime > 0.25 ) { SplashTime = Level.TimeSeconds; if (Physics == PHYS_Falling) MakeNoise(1.0); else MakeNoise(0.3); if ( FootRegion.Zone.bWaterZone ) { if ( !newFootZone.bWaterZone && (Role==ROLE_Authority) ) { if ( FootRegion.Zone.ExitSound != None ) PlaySound(FootRegion.Zone.ExitSound, SLOT_Interact, 1); if ( FootRegion.Zone.ExitActor != None ) Spawn(FootRegion.Zone.ExitActor,,,Location - CollisionHeight * vect(0,0,1)); } } else if ( newFootZone.bWaterZone && (Role==ROLE_Authority) ) { splashSize = FClamp(0.000025 * Mass * (300 - 0.5 * FMax(-500, Velocity.Z)), 1.0, 4.0 ); if ( newFootZone.EntrySound != None ) { HitActor = Trace(HitLocation, HitNormal, Location - (CollisionHeight + 40) * vect(0,0,0.8), Location - CollisionHeight * vect(0,0,0.8), false); if ( HitActor == None ) PlaySound(newFootZone.EntrySound, SLOT_Misc, 2 * splashSize); else PlaySound(WaterStep, SLOT_Misc, 1.5 + 0.5 * splashSize); } if( newFootZone.EntryActor != None ) { splash = Spawn(newFootZone.EntryActor,,,Location - CollisionHeight * vect(0,0,1)); if ( splash != None ) splash.DrawScale = splashSize; } //log("Feet entering water"); } } if (FootRegion.Zone.bPainZone) { if ( !newFootZone.bPainZone && !HeadRegion.Zone.bWaterZone ) PainTime = -1.0; } else if (newFootZone.bPainZone) PainTime = 0.01; } event HeadZoneChange(ZoneInfo newHeadZone) { if ( Level.NetMode == NM_Client ) return; if (HeadRegion.Zone.bWaterZone) { if (!newHeadZone.bWaterZone) { if ( bIsPlayer && (PainTime > 0) && (PainTime < 8) ) Gasp(); if ( Inventory != None ) Inventory.ReduceDamage(0, 'Breathe', Location); //inform inventory of zone change bDrowning = false; if ( !FootRegion.Zone.bPainZone ) PainTime = -1.0; } } else { if (newHeadZone.bWaterZone) { if ( !FootRegion.Zone.bPainZone ) PainTime = UnderWaterTime; if ( Inventory != None ) Inventory.ReduceDamage(0, 'Drowned', Location); //inform inventory of zone change //log("Can't breathe"); } } } event SpeechTimer(); //Pain timer just expired. //Check what zone I'm in (and which parts are) //based on that cause damage, and reset PainTime event PainTimer() { local float depth; //log("Pain Timer"); if ( (Health < 0) || (Level.NetMode == NM_Client) ) return; if ( FootRegion.Zone.bPainZone ) { depth = 0.4; if (Region.Zone.bPainZone) depth += 0.4; if (HeadRegion.Zone.bPainZone) depth += 0.2; if (FootRegion.Zone.DamagePerSec > 0) { if ( IsA('PlayerPawn') ) Level.Game.SpecialDamageString = FootRegion.Zone.DamageString; TakeDamage(int(float(FootRegion.Zone.DamagePerSec) * depth), None, Location, vect(0,0,0), FootRegion.Zone.DamageType); } else if ( Health < Default.Health ) Health = Min(Default.Health, Health - depth * FootRegion.Zone.DamagePerSec); if (Health > 0) PainTime = 1.0; } else if ( HeadRegion.Zone.bWaterZone ) { // DEUS_EX CNN - make drowning damage happen from center TakeDamage(5, None, Location, vect(0,0,0), 'Drowned'); if ( Health > 0 ) PainTime = 2.0; } } function bool CheckWaterJump(out vector WallNormal) { local actor HitActor; local vector HitLocation, HitNormal, checkpoint, start, checkNorm, Extent; if (CarriedDecoration != None) return false; checkpoint = vector(Rotation); checkpoint.Z = 0.0; checkNorm = Normal(checkpoint); checkPoint = Location + CollisionRadius * checkNorm; Extent = CollisionRadius * vect(1,1,0); Extent.Z = CollisionHeight; HitActor = Trace(HitLocation, HitNormal, checkpoint, Location, true, Extent); if ( (HitActor != None) && (Pawn(HitActor) == None) ) { WallNormal = -1 * HitNormal; start = Location; start.Z += 1.1 * MaxStepHeight; checkPoint = start + 2 * CollisionRadius * checkNorm; HitActor = Trace(HitLocation, HitNormal, checkpoint, start, true); if (HitActor == None) return true; } return false; } exec function bool SwitchToBestWeapon() { local float rating; local int usealt; if ( Inventory == None ) return false; PendingWeapon = Inventory.RecommendWeapon(rating, usealt); if ( PendingWeapon == Weapon ) PendingWeapon = None; if ( PendingWeapon == None ) return false; if ( Weapon == None ) ChangedWeapon(); if ( Weapon != PendingWeapon ) Weapon.PutDown(); return (usealt > 0); } State Dying { ignores SeePlayer, EnemyNotVisible, HearNoise, KilledBy, Trigger, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, WarnTarget, Died, LongFall, PainTimer; function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType) { if ( bDeleteMe ) return; Health = Health - Damage; Momentum = Momentum/Mass; AddVelocity( momentum ); if ( !bHidden && Gibbed(damageType) ) { bHidden = true; SpawnGibbedCarcass(); if ( bIsPlayer ) HidePlayer(); else Destroy(); } } function Timer() { if ( !bHidden ) { bHidden = true; SpawnCarcass(); if ( bIsPlayer ) HidePlayer(); else Destroy(); } } event Landed(vector HitNormal) { SetPhysics(PHYS_None); } function BeginState() { SetTimer(0.3, false); } } state GameEnded { ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, WarnTarget, Died; function BeginState() { SetPhysics(PHYS_None); HidePlayer(); } } // // lip synching support - DEUS_EX CNN // function LipSynch(float deltaTime) { local name animseq; local float rnd; local float tweentime; // update the animation timers that we are using animTimer[0] += deltaTime; animTimer[1] += deltaTime; animTimer[2] += deltaTime; if (bIsSpeaking) { // if our framerate is high enough (>20fps), tween the lips smoothly if (Level.TimeSeconds - animTimer[3] < 0.05) tweentime = 0.1; else tweentime = 0.0; // the last animTimer slot is used to check framerate animTimer[3] = Level.TimeSeconds; if (nextPhoneme == "A") animseq = 'MouthA'; else if (nextPhoneme == "E") animseq = 'MouthE'; else if (nextPhoneme == "F") animseq = 'MouthF'; else if (nextPhoneme == "M") animseq = 'MouthM'; else if (nextPhoneme == "O") animseq = 'MouthO'; else if (nextPhoneme == "T") animseq = 'MouthT'; else if (nextPhoneme == "U") animseq = 'MouthU'; else if (nextPhoneme == "X") animseq = 'MouthClosed'; if (animseq != '') { if (lastPhoneme != nextPhoneme) { lastPhoneme = nextPhoneme; TweenBlendAnim(animseq, tweentime); } } } else if (bWasSpeaking) { bWasSpeaking = False; TweenBlendAnim('MouthClosed', tweentime); } // blink randomly if (animTimer[0] > 2.0) { animTimer[0] = 0; if (FRand() < 0.4) PlayBlendAnim('Blink', 1.0, 0.1, 1); } LoopHeadConvoAnim(); LoopBaseConvoAnim(); } // // PlayTurnHead - DEUS_EX STM // function bool PlayTurnHead(ELookDirection dir, float rate, float tweentime) { local name lookName; local bool bSuccess; if (dir == LOOK_Left) lookName = 'HeadLeft'; else if (dir == LOOK_Right) lookName = 'HeadRight'; else if (dir == LOOK_Up) lookName = 'HeadUp'; else if (dir == LOOK_Down) lookName = 'HeadDown'; else lookName = 'Still'; bSuccess = false; if (BlendAnimSequence[3] != lookName) { if (animTimer[1] > 0.00) { animTimer[1] = 0; if (BlendAnimSequence[3] == '') BlendAnimSequence[3] = 'Still'; PlayBlendAnim(lookName, rate, tweentime, 3); bSuccess = true; } } return (bSuccess); } // // LoopHeadConvoAnim - DEUS_EX STM // function LoopHeadConvoAnim() { local float rnd; rnd = FRand(); // move head randomly (only while not speaking) if (!bIsSpeaking && (animTimer[1] > 0.5)) { if (rnd < 0.01) PlayTurnHead(LOOK_Left, 1.0, 2.0); else if (rnd < 0.02) PlayTurnHead(LOOK_Right, 1.0, 2.0); else PlayTurnHead(LOOK_Forward, 1.0, 1.0); } } // // LoopBaseConvoAnim - DEUS_EX CNN // function LoopBaseConvoAnim() { local float rnd; rnd = FRand(); // move arms randomly if (bIsSpeaking) { if (animTimer[2] > 2.5) { animTimer[2] = 0; if (rnd < 0.1) PlayAnim('GestureLeft', 0.35, 0.4); else if (rnd < 0.2) PlayAnim('GestureRight', 0.35, 0.4); else if (rnd < 0.3) PlayAnim('GestureBoth', 0.35, 0.4); } } // if we're not playing an animation, loop the breathe if (!IsAnimating()) LoopAnim('BreatheLight',, 0.4); } // // LookAtActor - DEUS_EX STM // function LookAtActor(Actor targ, bool bRotate, bool bLookHorizontal, bool bLookVertical, optional float DelayTime, optional float rate, optional float LockAngle, optional float AngleOffset) { local vector lookTo; // If we're looking at a pawn, look at the head; // otherwise, look at the center point lookTo = targ.Location; if (Pawn(targ) != None) lookTo += (vect(0,0,1)*Pawn(targ).BaseEyeHeight); else if (Decoration(targ) != None) lookTo += (vect(0,0,1)*Decoration(targ).BaseEyeHeight); else lookTo += (vect(0,0,1)*targ.CollisionHeight*0.75); LookAtVector(lookTo, bRotate, bLookHorizontal, bLookVertical, DelayTime, rate, LockAngle, AngleOffset); } // // LookAtVector - DEUS_EX STM // function LookAtVector(vector lookTo, bool bRotate, bool bLookHorizontal, bool bLookVertical, optional float DelayTime, optional float rate, optional float LockAngle, optional float AngleOffset) { local vector lookFrom; local rotator lookAngle; local int hPos, vPos; local int hAngle, vAngle; local int hAbs, vAbs; local int hRot; local ELookDirection lookDir; if (rate <= 0) rate = 1.0; // Head movement angles hAngle = 5461; // 30 degrees horizontally vAngle = 2731; // 15 degrees vertically // Determine our angle to the target lookFrom = Location + (vect(0,0,1)*CollisionHeight*0.9); lookAngle = Rotator(lookTo-lookFrom); lookAngle.Yaw = (lookAngle.Yaw - Rotation.Yaw) & 65535; if (lookAngle.Yaw > 32767) lookAngle.Yaw -= 65536; if (lookAngle.Pitch > 32767) lookAngle.Pitch -= 65536; // hPos and vPos determine which way the pawn needs to look // horizontally and vertically hPos = 0; vPos = 0; // Do we need to look up or down? if (bLookVertical) { if (lookAngle.Pitch > vAngle*0.9) vPos = 1; else if (lookAngle.Pitch < -vAngle*0.75) vPos = -1; } // Do we need to look left or right? if (bLookHorizontal) { if (lookAngle.Yaw > hAngle*0.5) hPos = 1; else if (lookAngle.Yaw < -hAngle*0.5) hPos = -1; } hAbs = Abs(lookAngle.Yaw); vAbs = Abs(lookAngle.Pitch); if (bRotate) { hRot = lookAngle.Yaw; // Hack -- NPCs that look horizontally or vertically, AND rotate, will use inexact rotations if (bLookHorizontal && (vPos == 0)) { if (hRot > hAngle*1.2) hRot -= hAngle*1.2; else if (hRot < -hAngle*1.2) hRot += hAngle*1.2; else hRot = 0; } else if (bLookVertical && (hPos == 0)) { if (hRot > hAngle*0.35) hRot -= hAngle*0.35; else if (hRot < -hAngle*0.35) hRot += hAngle*0.35; else hRot = 0; } // Clamp the rotation angle, based on the angles passed in if (AngleOffset > 0) { hRot = (hRot + (Rotation.Yaw-LockAngle) + 65536*4) & 65535; if (hRot > 32767) hRot -= 65536; if (hRot < -AngleOffset) hRot = -AngleOffset; else if (hRot > AngleOffset) hRot = AngleOffset; hRot = (hRot + (LockAngle-Rotation.Yaw) + 65536*4) & 65535; if (hRot > 32767) hRot -= 65536; } // Compute actual rotation, based on new angle hAbs = (65536 + lookAngle.Yaw - hRot) & 65535; if (hAbs > 32767) hAbs = 65536-hAbs; } // No rotation else hRot = 0; // We can't look vertically AND horizontally at the same time // (we need a skeletal animation system!!!) if ((hPos != 0) && (vPos != 0)) { if (hAbs > vAbs) vPos = 0; else hPos = 0; } // Play head turning animation if (hPos > 0) lookDir = LOOK_Right; else if (hPos < 0) lookDir = LOOK_Left; else if (vPos > 0) lookDir = LOOK_Up; else if (vPos < 0) lookDir = LOOK_Down; else lookDir = LOOK_Forward; if ((bLookHorizontal || bLookVertical) && (animTimer[1] >= DelayTime)) PlayTurnHead(lookDir, 1.0, rate); // Turn as necessary if (bRotate) DesiredRotation = Rotation + rot(0,1,0)*hRot; } defaultproperties { bCanGlide=True AvgPhysicsTime=0.100000 MaxDesiredSpeed=1.000000 GroundSpeed=320.000000 WaterSpeed=200.000000 AccelRate=500.000000 JumpZ=325.000000 MaxStepHeight=25.000000 AirControl=0.050000 Visibility=128 SightRadius=2500.000000 OrthoZoom=40000.000000 FovAngle=90.000000 Health=100 AttitudeToPlayer=ATTITUDE_Hate Intelligence=BRAINS_MAMMAL noise1time=-10.000000 noise2time=-10.000000 SoundDampening=1.000000 DamageScaling=1.000000 PlayerReStartState=PlayerWalking NameArticle=" a " PlayerReplicationInfoClass=Class'Engine.PlayerReplicationInfo' HealthHead=100 HealthTorso=100 HealthLegLeft=100 HealthLegRight=100 HealthArmLeft=100 HealthArmRight=100 AIHorizontalFov=75.000000 AspectRatio=1.333333 AngularResolution=1.000000 SmellThreshold=0.500000 bCanTeleport=True bIsKillGoal=True bStasis=True bIsPawn=True RemoteRole=ROLE_SimulatedProxy AnimSequence=Fighter bDirectional=True Texture=Texture'Engine.S_Pawn' SoundRadius=9 SoundVolume=240 TransientSoundVolume=2.000000 bCollideActors=True bCollideWorld=True bBlockActors=True bBlockPlayers=True bProjTarget=True bRotateToDesired=True RotationRate=(Pitch=4096,Yaw=50000,Roll=3072) bVisionImportant=True NetPriority=2.000000 } |
Overview | Package | Class | Source | Class tree | Glossary | Deus Ex UnrealScript Documentation |
previous class next class | frames no frames |