Overview | Package | Class | Source | Class tree | Glossary | 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 02242 02243 02244 02245 02246 02247 02248 02249 02250 02251 02252 02253 02254 02255 02256 02257 02258 02259 02260 02261 02262 02263 02264 02265 02266 02267 02268 02269 02270 02271 02272 02273 02274 02275 02276 02277 02278 02279 02280 02281 02282 02283 02284 02285 02286 02287 02288 02289 02290 02291 02292 02293 02294 02295 02296 02297 02298 02299 02300 02301 02302 02303 02304 02305 02306 02307 02308 02309 02310 02311 02312 02313 02314 02315 02316 02317 02318 02319 02320 02321 02322 02323 02324 02325 02326 02327 02328 02329 02330 02331 02332 02333 02334 02335 02336 02337 02338 02339 02340 02341 02342 02343 02344 02345 02346 02347 02348 02349 02350 02351 02352 02353 02354 02355 02356 02357 02358 02359 02360 02361 02362 02363 02364 02365 02366 02367 02368 02369 02370 02371 02372 02373 02374 02375 02376 02377 02378 02379 02380 02381 02382 02383 02384 02385 02386 02387 02388 02389 02390 02391 02392 02393 02394 02395 02396 02397 02398 02399 02400 02401 02402 02403 02404 02405 02406 02407 02408 02409 02410 02411 02412 02413 02414 02415 02416 02417 02418 02419 02420 02421 02422 02423 02424 02425 02426 02427 02428 02429 02430 02431 02432 02433 02434 02435 02436 02437 02438 02439 02440 02441 02442 02443 02444 02445 02446 02447 02448 02449 02450 02451 02452 02453 02454 02455 02456 02457 02458 02459 02460 02461 02462 02463 02464 02465 02466 02467 02468 02469 02470 02471 02472 02473 02474 02475 02476 02477 02478 02479 02480 02481 02482 02483 02484 02485 02486 02487 02488 02489 02490 02491 02492 02493 02494 02495 02496 02497 02498 02499 02500 02501 02502 02503 02504 02505 02506 02507 02508 02509 02510 02511 02512 02513 02514 |
//============================================================================= // U2PlayerController.uc //============================================================================= class U2PlayerController extends PlayerController config(User); //const CinematicState = 'Cinematic'; //const EndCinematicEvent = 'EndCinematic'; const MissionFailedState = 'MissionFailed'; const ImpaledState = 'Impaled'; const LevelTransitionState = 'LevelTransition'; const MantlingState = 'Mantling'; const PlayerEndLevelImmediatelyState = 'PlayerEndLevelImmediately'; const LeanRate = 256.0; // offset change in units per sec when transition to/from leaning const LeanTraceFudge = 16.0; // fudge factor used when checking whether lean put camera into geometry const LeanWalkingPctScale = 1.0; // pct of walking speed used when leaning enum ELeanDir { Lean_None, Lean_Forward, Lean_Left, Lean_Right, Lean_Up, }; var globalconfig bool bInstantRocket; var globalconfig bool bAutoTaunt; // player automatically generates taunts when fragging someone var globalconfig bool bNoAutoTaunts; // don't receive auto-taunts var globalconfig bool bNoVoiceTaunts; // don't receive any taunts var globalconfig bool bNoMatureLanguage; var globalconfig bool bNoVoiceMessages; // don't receive any voice messages var globalconfig bool bNoVoices; var bool bRising; var NavigationPoint StartSpot; //where player started the match var vector LastAutoAimLocation; var() globalconfig bool bIgnoreNextWhenZoomed; var bool bWeaponKickDisabled; //ARL test code var bool bWeaponKicking; // true during recoil, false while idle or recovering var bool bAltWeaponKick; // true for AltFire(), false for Fire() var float WeaponKickPercent; // holds 0.0 (neutral position) to 1.0 (maximum kick offset) var float LastWeaponKickTime; // last time weapon kick was updated var vector WeaponKickOffset; // resulting offset -- stored for use by U2Weapon.CalcDrawOffset() var() float ProneWeaponKickRatio; // amount that kick effect is reduced while prone // leaning var ELeanDir LeanDir; // set to lean direction var ELeanDir LastLeanDir; // previous lean dir (for use while unleaning) var bool bWantsToLean; // player wants to lean -- next movement update will set direction var bool bReleaseLeanKeys; // player needs to release lean keys before leaning direction can be set var float LastLeaningCheck; var vector DesiredLeanOffset; // desired additional camera offset due to leaning var vector LadderMoveLocation; // hack to track ladder movement & play ladder climbing sound var name UnFreezeState; //var EPhysics UnFreezePhysics; var() globalconfig byte UIAlpha; var float AmmoFlashTime; var U2Pawn U2P; // WeaponPanel support. struct native WeaponInfo { var config string WeaponName; // User readable name of the weapon. var config byte Priority; // Order within the tray (lower numbers = higher priority) - essentially group offset. var /****/ Weapon Weapon; // Pointer to the associated weapon - if the player has it currently. }; // NOTE[aleiby]: Stored as separate variables to make the ini cleaner and // to support weapon mods from clashing with U2 weapons with the same InventoryGroup/GroupOffsets var /*config*/ array<WeaponInfo> WeaponOrder1; var /*config*/ array<WeaponInfo> WeaponOrder2; var /*config*/ array<WeaponInfo> WeaponOrder3; var /*config*/ array<WeaponInfo> WeaponOrder4; var /*config*/ array<WeaponInfo> WeaponOrder5; // Autosave stuff. var globalconfig int AutoSaveIndex; var(Music) array<string> DeathMusic; //----------------------------------------------------------------------------- replication { // Things the server should send to the client. unreliable if( Role==ROLE_Authority ) ClientPlayTakeHit; reliable if ( Role == ROLE_Authority ) PlayWinMessage; // client to server reliable if ( Role < ROLE_Authority ) // weapons ServerReload, ServerSetTaunt, ServerSetInstantRocket, ServerTaunt, ServerAddBots; } // Autosave stuff. function SetAutoSaveIndex( int i ) { AutoSaveIndex = Max( AutoSaveIndex, i ); SaveConfig(); } function bool AutoSaveEnabledA1(){ return AutoSaveIndex >= 0; } function bool AutoSaveEnabledA2(){ return AutoSaveIndex >= 1; } function bool AutoSaveEnabledA3(){ return AutoSaveIndex >= 2; } function bool AutoSaveEnabledA4(){ return AutoSaveIndex >= 3; } function bool AutoSaveEnabledB1(){ return AutoSaveIndex >= 4; } function bool AutoSaveEnabledB2(){ return AutoSaveIndex >= 5; } function bool AutoSaveEnabledB3(){ return AutoSaveIndex >= 6; } function bool AutoSaveEnabledB4(){ return AutoSaveIndex >= 7; } function bool AutoSaveEnabledC1(){ return AutoSaveIndex >= 8; } function bool AutoSaveEnabledC2(){ return AutoSaveIndex >= 9; } function bool AutoSaveEnabledC3(){ return AutoSaveIndex >= 10; } function bool AutoSaveEnabledC4(){ return AutoSaveIndex >= 11; } function bool AutoSaveEnabledD1(){ return AutoSaveIndex >= 12; } function bool AutoSaveEnabledD2(){ return AutoSaveIndex >= 13; } function bool AutoSaveEnabledD3(){ return AutoSaveIndex >= 14; } function bool AutoSaveEnabledD4(){ return AutoSaveIndex >= 15; } function bool AutoSaveEnabledE1(){ return AutoSaveIndex >= 16; } function bool AutoSaveEnabledE2(){ return AutoSaveIndex >= 17; } function bool AutoSaveEnabledE3(){ return AutoSaveIndex >= 18; } function bool AutoSaveEnabledE4(){ return AutoSaveIndex >= 19; } function bool AutoSaveEnabledF1(){ return AutoSaveIndex >= 20; } function bool AutoSaveEnabledF2(){ return AutoSaveIndex >= 21; } function bool AutoSaveEnabledF3(){ return AutoSaveIndex >= 22; } function bool AutoSaveEnabledF4(){ return AutoSaveIndex >= 23; } function bool AutoSaveEnabledG1(){ return false; } // UI Callbacks. simulated function float GetUIAlpha(){ return UIAlpha; } simulated function SetUIAlpha( float A ){ UIAlpha=A; SaveConfig(); } //----------------------------------------------------------------------------- // Underwater sound modulation and sub-titles function bool ActorHeadInWater( Actor SourceActor, vector Loc ) { local bool bWaterVolume; if( Pawn(SourceActor) != None ) { bWaterVolume = Pawn(SourceActor).HeadVolume.bWaterVolume; } else { bWaterVolume = SourceActor.PhysicsVolume.bWaterVolume; } return bWaterVolume; } //----------------------------------------------------------------------------- // Modify non-ambient sounds when player is underwater. Ambient sounds aren't // relayed through ClientHearSound and these are currently modified in an // identical fashion in AlAudioSubsystem.cpp UALAudioSubsystem::Update() //----------------------------------------------------------------------------- simulated event ClientHearSound ( actor Actor, int Id, sound S, vector SoundLocation, vector Parameters, bool Attenuate ) { //DMTNS( "ClientHearSound Vol: " $ Parameters.X $ " Radius: " $ Parameters.Y $ " Pitch: " $ Parameters.Z ); // what does get pitched underwater // sounds not in the above which // either originate underwater or are being heard underwater // ambient sounds are pitched in ALAudioSubsystem.cpp. // what doesn't get pitched underwater: // any sound played in SLOT_Interface (UI sounds -- should always originate in player) //!!arl if( Slot != SLOT_Interface ) if( Pawn != None ) { // modify the sound's pitch etc. in water if( Pawn.HeadVolume.bWaterVolume || ((SoundLocation != Pawn.Location) && ActorHeadInWater( Actor, SoundLocation )) ) { // hearer underwater or sound source underwater // if you change these, update ALAudioSubsystem.cpp as well Parameters.x *= 0.90; // volume Parameters.y *= 0.80; // radius Parameters.z *= 0.85; // pitch } } super.ClientHearSound( Actor, Id, S, SoundLocation, Parameters, Attenuate ); } //----------------------------------------------------------------------------- // HUD Stuff //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // WeaponPanel convenience functions function WeaponPanel GetWeaponPanel() { local UIConsole Console; local WeaponPanel WP; local int i; if( Viewport(Player) != None ) { Console = UIConsole(Player.Console); if( Console != None ) { // Fix ARL: This code may break if we don't force Root to be loaded first. (make changes in Console then delete this note) for(i=0;i<Console.Helpers.length;i++) { WP=WeaponPanel(Console.Helpers[i]); if(WP!=None) break; } } } return WP; } //----------------------------------------------------------------------------- function HighlightPendingWeapon( Pawn P ) { local WeaponPanel Panel; if( P != None && P.PendingWeapon != None ) Panel = GetWeaponPanel(); if( Panel != None ) Panel.HighlightWeapon( P.PendingWeapon ); } //----------------------------------------------------------------------------- // Inventory notifications function NotifyAddInventory(inventory AddedItem) { local WeaponPanel WP; WP = GetWeaponPanel(); if( WP != None && Weapon(AddedItem) != None ) WP.DoAddWeapon( Weapon(AddedItem), true ); Super.NotifyAddInventory( AddedItem ); } //----------------------------------------------------------------------------- function NotifyRemoveInventory(inventory RemovedItem) { local WeaponPanel WP; WP = GetWeaponPanel(); if( WP != None && Weapon(RemovedItem) != None ) { WP.DoRemoveWeapon( Weapon(RemovedItem), true); WP.HighlightWeapon( Pawn.Weapon ); } Super.NotifyRemoveInventory( RemovedItem ); } //----------------------------------------------------------------------------- // Weapon exec overrides exec function ThrowWeapon() { // ThrowWeapon is disabled in Unreal II SP -- re-enable only for multiplayer /* Super.ThrowWeapon(); */ } //----------------------------------------------------------------------------- exec function PrevWeapon() { Super.PrevWeapon(); HighlightPendingWeapon( Pawn ); } //----------------------------------------------------------------------------- exec function NextWeapon() { Super.NextWeapon(); HighlightPendingWeapon( Pawn ); } //----------------------------------------------------------------------------- exec function SwitchWeapon (byte F ) { Super.SwitchWeapon(F); HighlightPendingWeapon( Pawn ); } //----------------------------------------------------------------------------- exec function bool SwitchToBestWeapon( optional out float Rating, optional out byte bUseAltMode ) { local bool WeaponHasChanged; WeaponHasChanged = Super.SwitchToBestWeapon( Rating, bUseAltMode ); if( WeaponHasChanged ) HighlightPendingWeapon( Pawn ); return WeaponHasChanged; } //----------------------------------------------------------------------------- // Hud Accessors simulated function float GetHealthPct() { if( Pawn != None ) return float(Pawn.Health) / float(Pawn.default.Health); else return 0; } //----------------------------------------------------------------------------- simulated function string GetHealthString() { local int Value; if( Pawn != None ) Value = Pawn.Health; if ( Value < 1 ) return "000"; else if ( Value < 10 ) return "00"$Value; else if ( Value < 100 ) return "0"$Value; else if ( Value < 1000 ) return string(Value); else return "ERR"; } //----------------------------------------------------------------------------- // in case the controller doesn't have a pawn (dead, spectating) simulated function float GetPowerSuitPct() { local U2Pawn AccessedPawn; AccessedPawn = U2Pawn(Pawn); if( AccessedPawn != None ) return AccessedPawn.GetPowerSuitPct(); else return 0; } //----------------------------------------------------------------------------- simulated function string GetPowerSuitString() { local int Power; local int Max; local U2Pawn AccessedPawn; AccessedPawn = U2Pawn(Pawn); if( AccessedPawn != None ) { Power = AccessedPawn.GetPowerSuit(); Max = AccessedPawn.GetPowerSuitMax(); if ( Max > 0 ) return Power $ "/" $ Max; } return "0"; } //----------------------------------------------------------------------------- simulated function string GetPowerSuitPowerString() { local int Value; local U2Pawn AccessedPawn; AccessedPawn = U2Pawn(Pawn); if( AccessedPawn != None ) Value = AccessedPawn.GetPowerSuit(); if ( Value < 1 ) return "000"; else if ( Value < 10 ) return "00"$Value; else if ( Value < 100 ) return "0"$Value; else if ( Value < 1000 ) return string(Value); else return "ERR"; } //----------------------------------------------------------------------------- simulated function string GetPowerSuitMaxString() { local int Value; local U2Pawn AccessedPawn; AccessedPawn = U2Pawn(Pawn); if( AccessedPawn != None ) Value = AccessedPawn.GetPowerSuitMax(); if ( Value < 1 ) return "000"; else if ( Value < 10 ) return "00"$Value; else if ( Value < 100 ) return "0"$Value; else if ( Value < 1000 ) return string(Value); else return "ERR"; } //----------------------------------------------------------------------------- simulated function string GetWeaponString() { local Inventory Inv; local string Weapons; for(Inv=Inventory;Inv!=None;Inv=Inv.Inventory) if(Inv.IsA('U2Weapon')) Weapons = Weapons$" "$Inv.ItemName; return Weapons; } //----------------------------------------------------------------------------- simulated function string GetArtifactString() { local Inventory Inv; local string Artifacts; for(Inv=Inventory;Inv!=None;Inv=Inv.Inventory) if(Inv.IsA('Artifact')) Artifacts = Artifacts$" "$Inv.ItemName; return Artifacts; } //----------------------------------------------------------------------------- simulated function float GetAmmoClipPct() { if ( Pawn != None && Pawn.Weapon != None ) return float(Pawn.Weapon.GetClipAmount()) / float(Pawn.Weapon.GetClipSize()); else return 0; } //----------------------------------------------------------------------------- simulated function float GetAmmoTotalPct() { if( Pawn != None && Pawn.Weapon != None ) return float(Pawn.Weapon.GetAmmoAmount() - Pawn.Weapon.GetClipAmount()) / float(Pawn.Weapon.GetMaxAmmo()); else return 0; } //----------------------------------------------------------------------------- simulated function string GetTotalAmmoString() { local int Value; if( Pawn != None && Pawn.Weapon != None ) Value = Pawn.Weapon.GetAmmoAmount() - Pawn.Weapon.GetClipAmount(); if ( Value < 1 ) return "000"; else if ( Value < 10 ) return "00"$Value; else if ( Value < 100 ) return "0"$Value; else if ( Value < 1000 ) return string(Value); else return "ERR"; } //----------------------------------------------------------------------------- simulated function string GetClipRoundsRemaining() { local int Value; if ( Pawn != None && Pawn.Weapon != None ) Value = Pawn.Weapon.GetClipAmount(); if ( Value < 1 ) return "000"; else if ( Value < 10 ) return "00"$Value; else if ( Value < 100 ) return "0"$Value; else if ( Value < 1000 ) return string(Value); else return "ERR"; } //----------------------------------------------------------------------------- simulated function string GetClipSize() { local int Value; if ( Pawn != None && Pawn.Weapon != None ) Value = Pawn.Weapon.GetClipSize(); if ( Value < 1 ) return "000"; else if ( Value < 10 ) return "00"$Value; else if ( Value < 100 ) return "0"$Value; else if ( Value < 1000 ) return string(Value); else return "ERR"; } //----------------------------------------------------------------------------- simulated function array<string> GetObjectives() { return U2GameInfo(Level.Game).GetObjectives(); } //----------------------------------------------------------------------------- simulated function bool GetAutoTaunt() { return bAutoTaunt; } //----------------------------------------------------------------------------- simulated function SetPlayVoiceMessages( bool B ) { bNoVoiceMessages = !B; } //----------------------------------------------------------------------------- simulated function bool GetPlayVoiceMessages() { return !bNoVoiceMessages; } //----------------------------------------------------------------------------- // Weapon Stuff //----------------------------------------------------------------------------- exec function Fire() { if ( Level.Pauser == PlayerReplicationInfo ) { SetPause(False); return; } if( !InLeanMode() ) { if( Pawn != None ) { if( Pawn.Weapon!=None ) { Pawn.Weapon.Fire(); if (Role == ROLE_Authority && Pawn.Weapon != None ) //NOTE (mdf): call to Fire can clear Pawn.Weapon if "firing" deployable inventory { Pawn.Weapon.bPointing = true; } } } } else { LeanEnd(); } } //----------------------------------------------------------------------------- exec function AltFire() { if ( Level.Pauser == PlayerReplicationInfo ) { SetPause(False); return; } if( !InLeanMode() ) { if( Pawn != None ) { if( Pawn.Weapon!=None ) { Pawn.Weapon.AltFire(); if (Pawn.Weapon!=None && Role == ROLE_Authority) { Pawn.Weapon.bPointing = true; } } } } else { LeanEnd(); } } //----------------------------------------------------------------------------- exec function Reload() { //DM( Self$".Reload()" ); if( Level.NetMode == NM_Client ) { ServerReload(); } if( U2Weapon(Pawn.Weapon) != None ) { U2Weapon(Pawn.Weapon).Reload(); } } //----------------------------------------------------------------------------- function ServerReload() { //DM( Self$".ServerReload()" ); Reload(); } //----------------------------------------------------------------------------- /*NEW(arl): removed exec function ToggleWeaponKick() { bWeaponKickDisabled = !bWeaponKickDisabled; } //----------------------------------------------------------------------------- simulated function ClientWeaponKick( bool bAlt ) { if( bWeaponKickDisabled ) return; // don't assert in multiplayer (Weapon is not always replicated in time) if( Level.NetMode != NM_Standalone && U2Weapon(Pawn.Weapon) == None ) return; assert( U2Weapon(Pawn.Weapon) != None ); if( U2Weapon(Pawn.Weapon).WeaponKickDirection != vect(0,0,0) && ( !bAlt || U2Weapon(Pawn.Weapon).AltWeaponKickDirection != vect(0,0,0) ) ) { bWeaponKicking = true; bAltWeaponKick = bAlt; LastWeaponKickTime = Level.TimeSeconds; } } */ //----------------------------------------------------------------------------- function CalcFirstPersonView( out vector CameraLocation, out rotator CameraRotation ) { //local vector CameraOffsetVector; //local U2Weapon W; //local float DeltaTime; //local vector WeaponKickDirection; //local float WeaponKickDuration; //local float WeaponKickRecoveryDuration; //local vector ViewDirection; local Actor HitActor; local vector CheckLocation, HitLocation, HitNormal; local float DeltaLen; local vector AddedOffset; Super.CalcFirstPersonView( CameraLocation, CameraRotation ); /* It throws off the aim....ask people whether they really want this? ViewDirection = vector(CameraRotation); ViewDirection.Z = 0; if (Pawn != None) CameraLocation -= ViewDirection*Pawn.CollisionRadius; */ /*MJL/!!mdf tbd if( Stance == ST_Prone ) { CameraRotation = ViewRotation; CameraLocation = Pawn.Location; CameraLocation.Z += EyeHeight; CameraLocation += WalkBob; // !!mdf-tbd: bob less when prone? // when prone put camera closer to where head is // !!mdf/arl-tbd: this borks aiming (aims high) CameraOffsetVector = vector(Rotation); CameraOffsetVector.Z = 0; CameraLocation += Pawn.CollisionRadius*CameraOffsetVector; // note: above calculation doesn't take mesh alignment into account so sometimes // the camera will be floating above where head really is. Eventually switch to // using head bone location? !!cdh (mdf) tbd: } else { Super.CalcFirstPersonView( CameraLocation, CameraRotation ); } */ if( LeanDir != Lean_None || LeanOffset != vect(0,0,0) ) { SetDesiredLeanOffset(); if( LeanOffset != DesiredLeanOffset ) { DeltaLen = (Level.TimeSeconds - LastLeaningCheck) * LeanRate; if( LeanDir != Lean_None ) { LeanOffset += DeltaLen*Normal( DesiredLeanOffset ) ; if( VSize(LeanOffset) >= VSize(DesiredLeanOffset) ) LeanOffset = DesiredLeanOffset; } else { if( VSize(LeanOffset) <= DeltaLen ) LeanOffset = vect(0,0,0); else LeanOffset -= DeltaLen*Normal( LeanOffset ); } LastLeaningCheck = Level.TimeSeconds; } if( LeanOffset != vect(0,0,0) ) { // make sure LeanOffset doesn't put camera into geometry CheckLocation = CameraLocation; HitActor = Pawn.Trace( HitLocation, HitNormal, CheckLocation + LeanOffset + LeanTraceFudge*Normal( LeanOffset ), CheckLocation, true ); //if( HitActor != None ) // DMTNS( "hit middle: " $ HitActor ); if( HitActor == None ) { // try from front CheckLocation = CameraLocation + 0.5*LeanTraceFudge * vector(Pawn.Rotation); HitActor = Pawn.Trace( HitLocation, HitNormal, CheckLocation + LeanOffset + LeanTraceFudge*Normal( LeanOffset ), CheckLocation, true ); //if( HitActor != None ) // DMTNS( "hit front: " $ HitActor ); } if( HitActor == None ) { // try from front CheckLocation = CameraLocation + 0.5*LeanTraceFudge * vector(Pawn.Rotation); HitActor = Pawn.Trace( HitLocation, HitNormal, CheckLocation + LeanOffset + LeanTraceFudge*Normal( LeanOffset ), CheckLocation, true ); //if( HitActor != None ) // DMTNS( "hit front: " $ HitActor ); } if( HitActor != None ) { //#debug AddArrow( CheckLocation, HitLocation ); //AddCylinder( HitLocation, 4, 4, ColorOrange() ); //AddedOffset = HitLocation - CheckLocation - LeanTraceFudge*Normal( LeanOffset ); //AddedOffset = LeanOffset - (VSize( HitLocation - CheckLocation ) + LeanTraceFudge) * Normal( LeanOffset ); AddedOffset = (VSize( HitLocation - CheckLocation ) - LeanTraceFudge) * Normal( LeanOffset ); //AddCylinder( CameraLocation + AddedOffset, 4, 4, ColorGreen() ); } else { AddedOffset = LeanOffset; } // add any offset to normal camera location CameraLocation += AddedOffset; // for left/right lean change camera roll if( LastLeanDir == Lean_Left ) CameraRotation.Roll -= VSize(AddedOffset)/48.0*2048.0; else if( LastLeanDir == Lean_Right ) CameraRotation.Roll += VSize(AddedOffset)/48.0*2048.0; } } /*NEW(arl): removed // adjust camera position for weapon kick and recovery if( bWeaponKicking || WeaponKickPercent != 0.0 ) { DeltaTime = Level.TimeSeconds - LastWeaponKickTime; LastWeaponKickTime = Level.TimeSeconds; W = U2Weapon(Pawn.Weapon); if( W != None ) { if( bAltWeaponKick ) { WeaponKickDirection = W.AltWeaponKickDirection; WeaponKickDuration = W.AltWeaponKickDuration; WeaponKickRecoveryDuration = W.AltWeaponKickRecoveryDuration; } else { WeaponKickDirection = W.WeaponKickDirection; WeaponKickDuration = W.WeaponKickDuration; WeaponKickRecoveryDuration = W.WeaponKickRecoveryDuration; } } else { WeaponKickDirection = class'U2Weapon'.default.WeaponKickDirection; WeaponKickDuration = class'U2Weapon'.default.WeaponKickDuration; WeaponKickRecoveryDuration = class'U2Weapon'.default.WeaponKickRecoveryDuration; } if( bWeaponKicking ) { WeaponKickPercent += DeltaTime / WeaponKickDuration; if( WeaponKickPercent > 1.0 ) { WeaponKickPercent = 1.0; bWeaponKicking = false; } } else { WeaponKickPercent -= DeltaTime / WeaponKickRecoveryDuration; if( WeaponKickPercent < 0.0 ) { WeaponKickPercent = 0.0; } } WeaponKickOffset = WeaponKickPercent * WeaponKickDirection >> Pawn.GetViewRotation(); //MJL/!!mdf-tbd //if( Stance == ST_Prone ) //{ // WeaponKickOffset *= ProneWeaponKickRatio; //} CameraLocation += WeaponKickOffset; } */ } //----------------------------------------------------------------------------- function bool ViewingSelf() { return ( ViewTarget == Self || ViewTarget == Pawn ); } //----------------------------------------------------------------------------- simulated function bool ThirdPerson() { return bBehindView; } //----------------------------------------------------------------------------- function SetViewTarget( Actor NewViewTarget ) { Super.SetViewTarget( NewViewTarget ); if( !ViewingSelf() ) { if( InLeanMode() ) LeanEnd(); } } //----------------------------------------------------------------------------- // If ViewTarget is a Controller use Pawn's Location if possible. event PlayerCalcView( out Actor ViewActor, out vector CameraLocation, out rotator CameraRotation ) { local Actor OldViewTarget; OldViewTarget = ViewTarget; if( Controller(ViewTarget) != None && Controller(ViewTarget).Pawn != None ) SetViewTarget( Controller(ViewTarget).Pawn ); Super.PlayerCalcView( ViewActor, CameraLocation, CameraRotation ); SetViewTarget( OldViewTarget ); } //----------------------------------------------------------------------------- // MAIN U2PLAYERCONTROLLER CODE //----------------------------------------------------------------------------- event /*probe*/ PlayerTick( float DeltaTime ) { local vector CameraLocation; local rotator CameraRotation; local Actor HitActor; local vector HitLocation, HitNormal; local float ClipPct; if( Pawn != None ) { PlayerCalcView( HitActor, CameraLocation, CameraRotation ); HitActor = Pawn.Trace( HitLocation, HitNormal, CameraLocation + class'U2UseManagerPlayer'.default.UseDistance*vector(CameraRotation), CameraLocation, true, vect(0,0,0), /*material*/, TRACE_AllColliding | TRACE_Usable ); class'U2UseManagerPlayer'.static.LookingAt( U2P, HitActor ); if( Pawn.Weapon != None ) { ClipPct = GetAmmoClipPct(); if( ClipPct<0.5 ) { AmmoFlashTime -= DeltaTime; if( AmmoFlashTime <= 0 ) { class'UIConsole'.static.SendEvent("ClipFlash"); AmmoFlashTime = Blend( 0.25, 4.0, ClipPct ); } } } } Super.PlayerTick( DeltaTime ); } //----------------------------------------------------------------------------- function UnPossessMatinee() { if (U2Weapon(Pawn.Weapon)?) U2Weapon(Pawn.Weapon).NotifyCutsceneBegin(); Super.UnPossessMatinee(); } //----------------------------------------------------------------------------- simulated event RenderOverlays( Canvas Canvas ) { class'U2UseManagerPlayer'.static.RenderOverlaysStatic( U2P, Canvas ); Super.RenderOverlays( Canvas ); } //----------------------------------------------------------------------------- exec function Use() { class'U2UseManagerPlayer'.static.UseTarget( U2P ); } //----------------------------------------------------------------------------- exec function Unuse() { class'U2UseManagerPlayer'.static.UnuseTarget( U2P ); } //----------------------------------------------------------------------------- exec function ActivateInventoryItem( class InvItem ) { local U2Inventory Inv; Inv = U2Inventory(Pawn.FindInventoryType(InvItem)); if ( Inv != None && Inv.bActivatable ) Inv.Activate( false ); } //----------------------------------------------------------------------------- exec function DeactivateInventoryItem( class InvItem ) { local U2Inventory Inv; Inv = U2Inventory(Pawn.FindInventoryType(InvItem)); if ( Inv != None && Inv.bActivatable ) Inv.Deactivate(); } //----------------------------------------------------------------------------- function EnableProne() { SetDuckFlag( 2 ); } //----------------------------------------------------------------------------- function bool CanDodge() { return ( Pawn != None && Pawn.Health > 0 && Pawn.IsStanding() && Pawn.Physics == PHYS_Walking ); } //----------------------------------------------------------------------------- // Leaning //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Return true if any of the keys used for selecting the lean direction are // currently being pressed. function bool PressingAnyLeanKey() { return ( aForward != 0 || aStrafe != 0 || aStrafe != 0 || aUp != 0 ); } //----------------------------------------------------------------------------- // Return true if key used to select lean direction was released function bool PressingSelectedLeanKey() { return ( (LeanDir == Lean_Forward && aForward > 0) || (LeanDir == Lean_Left && aStrafe < 0) || (LeanDir == Lean_Right && aStrafe > 0) || (LeanDir == Lean_Up && aUp > 0) ); } //----------------------------------------------------------------------------- function bool LeanTransition() { if( bWantsToLean ) { if( bReleaseLeanKeys ) bReleaseLeanKeys = PressingAnyLeanKey(); if( !bReleaseLeanKeys ) { if( aForward > 0 ) ToggleLeanForward(); else if( aStrafe < 0 ) ToggleLeanLeft(); else if( aStrafe > 0 ) ToggleLeanRight(); else if( aUp > 0 ) ToggleLeanUp(); } } else if( bReleaseLeanKeys ) { bReleaseLeanKeys = PressingSelectedLeanKey(); } // disable normal movement if lean direction selected and selected key still pressed return ( LeanDir != Lean_None && bReleaseLeanKeys ); } //----------------------------------------------------------------------------- function ELeanDir GetLeanDir() { return LeanDir; } //----------------------------------------------------------------------------- function vector GetLeanLeftRightVector() { local vector LeanVector; LeanVector = vector(Pawn.Rotation); LeanVector.Z = 0; LeanVector = Normal( LeanVector cross vect(0,0,1) ); return LeanVector; } //----------------------------------------------------------------------------- function SetDesiredLeanOffset() { switch( LeanDir ) { case Lean_Forward: // shift camera forward DesiredLeanOffset = vector(Pawn.Rotation); DesiredLeanOffset.Z = 0.0; DesiredLeanOffset = 32.0*Normal( DesiredLeanOffset ); break; case Lean_Left: // shift camera left and slightly down DesiredLeanOffset = 48.0*GetLeanLeftRightVector(); DesiredLeanOffset.Z = -16.0; break; case Lean_Right: // shift camera right and slightly down DesiredLeanOffset = -48.0*GetLeanLeftRightVector(); DesiredLeanOffset.Z = -16.0; break; case Lean_Up: // shift camera slightly up DesiredLeanOffset = vect(0,0,32); break; default: DesiredLeanOffset = vect(0,0,0); } } //----------------------------------------------------------------------------- function ClearWeaponEffects() { if( Pawn != None && Pawn.Weapon != None ) Pawn.Weapon.ClearWeaponEffects(); } //----------------------------------------------------------------------------- function float GetWalkingPctScale() { if( InLeanMode() ) return LeanWalkingPctScale; else return 1.0 / U2GameInfo(Level.Game).SpeedRatio; } //----------------------------------------------------------------------------- function bool CanLean() { //!!SBB (mdf) replace with a "can't lean now" sound (or use a generic "fail" // sound for this and other situations such as not being able to go prone // because there is no room for the new collision size). DM( "can't lean now" ); return false; } //----------------------------------------------------------------------------- function bool InLeanMode() { return( bWantsToLean || LeanDir != Lean_None || LeanOffset != vect(0,0,0) ); } //----------------------------------------------------------------------------- function LeanBegin( ELeanDir NewLeanDir ) { LastLeaningCheck = Level.TimeSeconds; bWantsToLean = false; bReleaseLeanKeys = true; // need to release selected lean key to be able to move again LeanDir = NewLeanDir; LastLeanDir = NewLeanDir; if( LPawn != None ) LPawn.UpdateWalkingPct(); // clear again so selected lean mode crosshair shown ClearWeaponEffects(); } //----------------------------------------------------------------------------- function LeanReset() { // restore usual camera position DesiredLeanOffset = vect(0,0,0); LastLeaningCheck = Level.TimeSeconds; LeanDir = Lean_None; bWantsToLean = false; bReleaseLeanKeys = false; // player needs to release lean keys before leaning direction can be set if( LPawn != None ) LPawn.UpdateWalkingPct(); } //----------------------------------------------------------------------------- function LeanEnd() { LeanReset(); // clear so weapon crosshair restored ClearWeaponEffects(); bFire = 0; bAltFire = 0; } //----------------------------------------------------------------------------- function ToggleLeanForward() { if( LeanDir != Lean_None ) LeanEnd(); else if( CanLean() ) LeanBegin( Lean_Forward ); } //----------------------------------------------------------------------------- function ToggleLeanLeft() { if( LeanDir != Lean_None ) LeanEnd(); else if( CanLean() ) LeanBegin( Lean_Left ); } //----------------------------------------------------------------------------- function ToggleLeanRight() { if( LeanDir != Lean_None ) LeanEnd(); else if( CanLean() ) LeanBegin( Lean_Right ); } //----------------------------------------------------------------------------- function ToggleLeanUp() { if( LeanDir != Lean_None ) LeanEnd(); else if( CanLean() ) LeanBegin( Lean_Up ); } //----------------------------------------------------------------------------- // Weapon checks this to determine whether its own crosshair should be used. function bool HandlingCrosshair() { return InLeanMode(); } //----------------------------------------------------------------------------- // misc //----------------------------------------------------------------------------- function HandleWalking() { if( Pawn != None ) { //NOTE: checking bDuck isn't enough since player might not have this set (not //holding duck key) but might be in an area where he is unable to stand up. Pawn.SetWalking( (LeanDir != Lean_None || GetRunFlag() > 0 || GetDuckFlag() > 0 || !Pawn.IsStanding() ) && WarpZoneInfo(Pawn.Region.Zone) == None ); } } //----------------------------------------------------------------------------- exec function Taunt( name Sequence ) { // !!mdf-tbd: don't allow taunting if player is moving -- prevents key binding cheats if( Pawn.Acceleration == vect(0,0,0) ) { /* SERVOTBD */ // cdh/arl-tbd: how to support choice of named gestures/taunts (wave, grab crotch, flip etc.) // on UI and map these to specific animations -- seems like we'll need some way to tag animations // as was done using GROUP=previously? // allowing any animation could be fun if( Pawn != None && Pawn.Health > 0 ) { ServerTaunt( Sequence ); Pawn.PlayAnim( Sequence, 0.7, 0.2 ); } } } //----------------------------------------------------------------------------- function ServerTaunt( name Sequence ) { Pawn.PlayAnim(Sequence, 0.7, 0.2); } //----------------------------------------------------------------------------- exec function AddBots( optional int N ) { if( N == 0 ) N = 1; ServerAddBots( N ); } //----------------------------------------------------------------------------- function ServerAddBots( int N ) { local int i; //!!mdf-tbd (stevep's comment) FIXME - should only work for standalone games!!! if( U2GameInfo(Level.Game) != None ) { for ( i=0; i<N; i++ ) U2GameInfo(Level.Game).ForceAddBot(); } } //----------------------------------------------------------------------------- function NotifyTakeHit( Pawn InstigatedBy, vector HitLocation, int Damage, class<DamageType> DamageType, vector Momentum ) { local bool bServerGuessWeapon; local int iDam; local float rnd; /*ARL: removed if( Damage > 1 ) { rnd = FClamp(Damage, 20, 60); ClientFlash(DamageType.Default.FlashScale*rnd,DamageType.Default.FlashFog*rnd); } */ //ARL (mdf) -- shouldn't shake view when drowning? other? if( DamageType != class'DamageTypeDrowned' && Damage > 0 ) ShakeView(Damage); // ShakeView(0.15 + 0.005 * Damage, Damage * 30, Damage * vect(0,0,0.03), 120000, vect(1,1,1), 0.2); bServerGuessWeapon = ( ((Pawn.Weapon != None) && Pawn.Weapon.bPointing) || Pawn.JumpInProgress() ); iDam = Clamp(Damage,0,200); ClientPlayTakeHit( HitLocation - Pawn.Location, iDam, DamageType, bServerGuessWeapon ); if( !bServerGuessWeapon && (Level.NetMode == NM_DedicatedServer || Level.NetMode == NM_ListenServer) ) { //servo-tbd: Enable( AnimEndEvent ); // !!mdf-tbd: would bork eye height if prone/crouched //Pawn.BaseEyeHeight = Pawn.default.BaseEyeHeight; Pawn.PlayTakeHit( HitLocation, Damage, DamageType ); } } //----------------------------------------------------------------------------- function ClientPlayTakeHit( vector HitLocation, byte Damage, class<DamageType> DamageType, bool bServerGuessWeapon ) { HitLocation += Pawn.Location; if ( bServerGuessWeapon && (Pawn.JumpInProgress() || ((Pawn.Weapon != None) && Pawn.Weapon.bPointing)) ) return; //servo-tbd: Enable( AnimEndEvent ); // !!mdf-tbd: would bork eye height if prone/crouched //Pawn.BaseEyeHeight = Pawn.Default.BaseEyeHeight; Pawn.PlayTakeHit( HitLocation, Damage, DamageType ); } //----------------------------------------------------------------------------- event TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type ) { local string ConsoleString; ConsoleString = S; if( PRI != None && ((Type == 'Say') || (Type == 'TeamSay')) ) ConsoleString = PRI.PlayerName$": "$ConsoleString; if( Player != None && Player.Console != None ) Player.Console.Message( ConsoleString, 6.0 ); //TBI } //----------------------------------------------------------------------------- function PlayWinMessage(bool bWinner) { local Sound Announcement; if ( bWinner ) Announcement = Sound(DynamicLoadObject("Announcer.Winner", class'Sound')); else Announcement = Sound(DynamicLoadObject("Announcer.LostMatch", class'Sound')); ClientPlaySound(Announcement, true); } // ------------------------------------------------------------------------ // Loading and saving function bool SaveEnabled() { return ( Pawn != None && Pawn.Health > 0 && Level.NetMode == NM_Standalone ); } exec function QuickSave() { if ( SaveEnabled() && Level.Pauser == None ) class'UIConsole'.static.SendEvent("QuickSave"); } exec function QuickLoad() { if ( Level.NetMode == NM_Standalone && Level.Pauser == None && !Player.Console.bNoDrawWorld ) class'UIConsole'.static.SendEvent("QuickLoad"); } //----------------------------------------------------------------------------- exec function ClearProgressMessages() { // class'UIConsole'.static.ClearProgressMessages(self); Super.ClearProgressMessages(); } //----------------------------------------------------------------------------- event bool EncroachingOn( actor Other ) { if ( GameReplicationInfo.bTeamGame && Pawn(Other) != None ) { if ( (Role == ROLE_Authority) && Level.Game.bWaitingToStartMatch ) return Super.EncroachingOn(Other); else return true; } return Super.EncroachingOn(Other); } //----------------------------------------------------------------------------- /*!!CDH/MJL function ClientReplicateSkins(texture Skin1, optional texture Skin2, optional texture Skin3, optional texture Skin4) { local class<Actor> C; // do nothing (just loading other player skins onto client) log("Getting "$Skin1$", "$Skin2$", "$Skin3$", "$Skin4); } */ //----------------------------------------------------------------------------- /* //MWP: function TimeMessage(int Num) { if ( TimeMessageClass == None ) TimeMessageClass = class<CriticalEventPlus>(DynamicLoadObject("GamePlay.TimeMessage", class'Class')); ReceiveLocalizedMessage( TimeMessageClass, 16 - Num ); } function SetVoice(class<ChallengeVoicePack> V) { PlayerReplicationInfo.VoiceType = V; UpdateURL("Voice", string(V), True); ServerSetVoice(V); } function ServerSetVoice(class<ChallengeVoicePack> V) { PlayerReplicationInfo.VoiceType = V; } */ function ServerSetTaunt(bool B) { bAutoTaunt = B; } function SetAutoTaunt(bool B) { bAutoTaunt = B; ServerSetTaunt(B); } function ServerSetInstantRocket(bool B) { bInstantRocket = B; } function bool GetInstantRocket() { return bInstantRocket; } exec function SetInstantRocket(bool B) { bInstantRocket = B; ServerSetInstantRocket(B); } /* function ChangeSetHand( string S ) { Super.ChangeSetHand(S); if ( Handedness == -1 ) LoadLeftHand(); } */ function LoadLeftHand() { local mesh M; // load left handed weapon meshes M = mesh(DynamicLoadObject("Weapons.PulseGunL", class'Mesh')); M = mesh(DynamicLoadObject("Weapons.Rifle2mL", class'Mesh')); M = mesh(DynamicLoadObject("Weapons.EightML", class'Mesh')); M = mesh(DynamicLoadObject("Weapons.Minigun2L", class'Mesh')); } //----------------------------------------------------------------------------- event PostBeginPlay() { Super.PostBeginPlay(); if( U2GameInfo(Level.Game).DefaultFOV != 0.0 ) DesiredFOV = U2GameInfo(Level.Game).DefaultFOV; } //----------------------------------------------------------------------------- function Possess( Pawn P ) { U2P = U2Pawn( P ); Super.Possess( P ); /* if ( Handedness == -1 ) LoadLeftHand(); if ( Level.Netmode == NM_Client ) { ServerSetTaunt(bAutoTaunt); ServerSetInstantRocket(bInstantRocket); } */ } //----------------------------------------------------------------------------- function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID) { if ( bNoVoiceMessages ) return; if ( bNoVoiceTaunts && ((messageType == 'TAUNT') || (messageType == 'AUTOTAUNT')) ) return; if ( bNoAutoTaunts && (messageType == 'AUTOTAUNT') ) return; Super.ClientVoiceMessage(Sender, Recipient, messagetype, messageID); } //----------------------------------------------------------------------------- function SendMessage(PlayerReplicationInfo Recipient, name MessageType, byte MessageID, float Wait, name BroadcastType) { if ( Level.TimeSeconds - OldMessageTime < 10 ) return; SendVoiceMessage(PlayerReplicationInfo, Recipient, MessageType, MessageID, BroadcastType); } //----------------------------------------------------------------------------- exec function Loaded() { local inventory Inv; local weapon Weap; if( !OKToCheat() ) return; if( Level.Netmode!=NM_Standalone ) return; Pawn.GiveWeapon("Weapons.PulseWeapon"); Pawn.GiveWeapon("Weapons.ShockWeapon"); Pawn.GiveWeapon("Weapons.FlakCannon"); Pawn.GiveWeapon("Weapons.Minigun"); Pawn.GiveWeapon("Weapons.Rifle"); Pawn.GiveWeapon("Weapons.Eightball"); for ( inv=Pawn.inventory; inv!=None; inv=inv.inventory ) { weap = Weapon(inv); if ( (weap != None) && (weap.AmmoType != None) ) weap.AmmoType.AmmoAmount = weap.AmmoType.MaxAmmo; } } //----------------------------------------------------------------------------- function CheckBob(float DeltaTime, float Speed2D, vector Y) { local float OldBobTime; local int m,n; OldBobTime = BobTime; Super.CheckBob(DeltaTime,Speed2D,Y); if ( bBehindView || (Speed2D < 10) ) return; m = int(0.5 * Pi + 9.0 * OldBobTime/Pi); n = int(0.5 * Pi + 9.0 * BobTime/Pi); } //----------------------------------------------------------------------------- function bool TurnTowardNearestEnemy() { local Pawn P; local Controller C; local vector LookDir, EnemyDir, Look; local float BestVal, NewVal; local rotator GoalRot; local float MinVal, MaxVal; // NOTE (mdf) this is basically a built-in aimbot. Presumably this was done // to help with aiming on consoles but I'm guessing we'll want to make sure // this is disabled for multiplayer games? MinVal = 0.93; MaxVal = 0.995; Look = Pawn.Location + Pawn.Eyeheight * vect(0,0,1); LookDir = vector(Rotation); if ( (TurnTarget == None) || (TurnTarget.Health <= 0) ) TurnTarget = None; else { NewVal = LookDir dot Normal(LastAutoAimLocation - Look); if ( NewVal > MaxVal ) { TurnTarget = None; return false; } if ( FastTrace(TurnTarget.Location, Look) ) LastAutoAimLocation = TurnTarget.Location; else if ( NewVal > MinVal ) TurnTarget = None; } if ( TurnTarget == None ) { BestVal = -2; if ( Level.NetMode == NM_Client ) { foreach DynamicActors(class'Pawn',P) if ( P.IsPlayerPawn() && (P.Controller != self) && (P.Health > 0) && (P.Visibility > 0) && (!GameReplicationInfo.bTeamGame || (P.PlayerReplicationInfo.Team != PlayerReplicationInfo.Team)) ) { NewVal = LookDir dot Normal(P.Location - Look); if ( (NewVal > MinVal) && (VSize(P.Location - Look) < 2600) && FastTrace(P.Location, Look) ) return false; // already close enough if ( (NewVal > BestVal) && FastTrace(P.Location, Look) ) { BestVal = NewVal; TurnTarget = P; } } } else { for ( C=Level.ControllerList; C!=None; C=C.NextController ) if ( C.bIsPlayer && (C != self) && (C.Pawn != None) && (C.Pawn.Visibility > 0) && (!GameReplicationInfo.bTeamGame || (P.PlayerReplicationInfo.Team != PlayerReplicationInfo.Team)) ) { NewVal = LookDir dot Normal(C.Pawn.Location - Look); if ( (NewVal > MinVal) && FastTrace(C.Pawn.Location, Look) ) return false; // already close enough else if ( (NewVal > BestVal) && FastTrace(C.Pawn.Location, Look) ) { BestVal = NewVal; TurnTarget = C.Pawn; } } } if ( TurnTarget == None ) return false; LastAutoAimLocation = TurnTarget.Location; } // Rotate towards best, but with as little up/down as possible bRotateToDesired = true; DesiredRotation = Rotator(LastAutoAimLocation - Look); GroundPitch = GroundPitch & 65535; if ( (DesiredFOV == DefaultFOV) && ((abs(DesiredRotation.Pitch - GroundPitch) < 12000) || (abs(DesiredRotation.Pitch - GroundPitch) > 53535)) ) DesiredRotation.Pitch = GroundPitch; return true; } //----------------------------------------------------------------------------- function PlayerEndLevel() { GotoState( PlayerEndLevelImmediatelyState ); } //----------------------------------------------------------------------------- function LevelChange() { GotoState( LevelTransitionState ); } //----------------------------------------------------------------------------- function SetMovementVars( vector NewAccel ) { //!!MJL (mdf) bForwardPressed = false; bUpPressed = false; } //----------------------------------------------------------------------------- function Freeze() { UnFreezeState = GetStateName(); //UnFreezePhysics = Pawn.Physics; GotoState( CantMoveState ); } function UnFreeze(); //----------------------------------------------------------------------------- /* exec function StartCinematic() { GotoState( CinematicState ); } //----------------------------------------------------------------------------- exec function EndCinematic() { } */ //----------------------------------------------------------------------------- function DialogInitiate( Actor Other, optional name Topic, optional Actor WaitingActor ) { if( Pawn != None ) class'DialogEngine'.static.Initiate( Pawn, Other, Topic, WaitingActor ); } //----------------------------------------------------------------------------- function DialogTerminate() { if( Pawn != None ) class'DialogEngine'.static.NotifyDialogScriptedAbort( Pawn ); } //----------------------------------------------------------------------------- // STATE CODE //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // while player is being impaled state @ ImpaledState extends @ CantMoveState { //------------------------------------------------------------------------- function PlayerMove( float DeltaTime ) { ViewFlash( DeltaTime ); ViewShake( DeltaTime ); UpdateRotation( DeltaTime, 2 ); } //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); bFreeCamera=true; } } // ImpaledState //----------------------------------------------------------------------------- state @ CantMoveState { //------------------------------------------------------------------------- event PlayerTick( float DeltaTime ) { Global.PlayerTick( DeltaTime ); if( bUpdatePosition ) ClientUpdatePosition(); PlayerMove( DeltaTime ); } //------------------------------------------------------------------------- function PlayerMove( float DeltaTime ) { local vector NewAccel; ViewFlash( DeltaTime ); ViewShake( DeltaTime ); // Update rotation. UpdateRotation( DeltaTime, 2 ); // prevent movement NewAccel = vect(0,0,0); //NEW MJL HandleMove( DeltaTime, NewAccel, DCLICK_None, rot(0,0,0) ); /*OLD if( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove( DeltaTime, NewAccel, DCLICK_None, Rot(0,0,0) ); else Pawn.Acceleration = NewAccel; */ } //------------------------------------------------------------------------- function bool IsFrozen() { return true; } function Freeze(); function UnFreeze() { //!!mdf -- why is this needed -- could bork AnimationController... //Pawn.SetPhysics( UnFreezePhysics ); GotoState( UnFreezeState ); } //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); //!!mdf -- why is this needed -- could bork AnimationController... //!!Pawn.SetPhysics( PHYS_None ); //!!mdf and therefore, why is unfreezephysics needed above? bPressedJump = false; bRising = false; LeanEnd(); } } //----------------------------------------------------------------------------- // Impaled behavior function NotifyImpaled() { //!!mib-tbd could use a push / pop state here UnFreezeState = GetStateName(); GotoState( ImpaledState ); } function NotifyUnImpaled() { GotoState( UnFreezeState ); } //----------------------------------------------------------------------------- state @ LandedHardState { //------------------------------------------------------------------------- // can't move during hard landing function PlayerMove( float DeltaTime ) { ViewFlash( DeltaTime ); ViewShake( DeltaTime ); // mdf-tbd: for singleplayer, allow looking around and firing during a // hard landing? This will have animation issues with 3rd person views // which is why its not enabled for networked games. //if( Level.NetMode == NM_Standalone ) // UpdateRotation( DeltaTime, 2 ); } //------------------------------------------------------------------------- function LandedHardDone() { GotoState( PlayerWalkingState ); } //------------------------------------------------------------------------- /*ARL: removed event BeginState() { Super.BeginState(); // NOTE: if applicable, damage handling code will also add its own flash ClientFlash( class'Fell'.default.FlashScale*20, class'Fell'.default.FlashFog*20 ); } */ } // LandedHardState //----------------------------------------------------------------------------- // state Mantling state @ MantlingState { ignores Fire, AltFire, PressingFire, PressingAltFire; //------------------------------------------------------------------------- event PlayerTick( float DeltaTime ) { Global.PlayerTick( DeltaTime ); if( bUpdatePosition ) ClientUpdatePosition(); PlayerMove( DeltaTime ); // !!mdf-tbi: squash CC as model steps onto ledge } //------------------------------------------------------------------------- function bool CanCrouch() { return false; } //------------------------------------------------------------------------- function vector GetAccel( vector X, vector Y, vector Z ) { local vector ReturnedAcceleration; ReturnedAcceleration = aForward*X + aStrafe*Y; ReturnedAcceleration.Z = 0; return ReturnedAcceleration; } //------------------------------------------------------------------------- function SetMovementVars( vector NewAccel ) { bUpPressed = (bJump != 0); } //------------------------------------------------------------------------- function PlayerMove( float DeltaTime ) { local vector X, Y, Z, NewAccel; //NEW MJL: accel GetAxes( Pawn.Rotation, X, Y, Z ); NewAccel = GetAccel( X, Y, Z); SetMovementVars( NewAccel ); aLookup *= 0.24; aTurn *= 0.24; aUp *= 0.1; HandleMove( DeltaTime, NewAccel, DCLICK_None, Rot(0,0,0) ); } //------------------------------------------------------------------------- // function PlayTakeHit( vector HitLocation, int Damage, , class<DamageType> DamageType ) // { // if( IsAnimating() ) // { // Global.PlayTakeHit( HitLoc, Damage, DamageType ); // } // } //------------------------------------------------------------------------- event MantleEnd() { GotoState( PlayerWalkingState ); } //------------------------------------------------------------------------- event BeginState() { U2Pawn(Pawn).AssetsHelperClass.static.HandleMantleBeginSound( U2Pawn(Pawn) ); Pawn.AirSpeed = LPawn.MantleSpeed; Pawn.SetPhysics( PHYS_Flying ); LeanEnd(); // !!mdf-tbd: current animation is shifting within CC = bad LPawn.MantlingBegin(); if( LPawn.MantleHeight < LPawn.MantleMaxStandingMantleHeight ) { // !!CDH - need to be able to tween to a specified frame AnimFrame = 1.0 - (LPawn.MantleHeight / LPawn.MantleMaxStandingMantleHeight); } // !!mdf-tbd: doesn't look great IMO //if( Pawn.Weapon != None ) // Pawn.Weapon.PutDown(); } //------------------------------------------------------------------------- event EndState() { Pawn.AirSpeed = Pawn.default.AirSpeed; LPawn.bMantling = false; // !!mdf-tbd: doesn't look great IMO //if( Pawn.Weapon != None ) // Pawn.Weapon.BringUp(); } } // MantlingState //----------------------------------------------------------------------------- // Allow firing only for the player in singleplayer games. state @ PlayerClimbingState { exec function Fire() { if( Level.NetMode == NM_Standalone ) Global.Fire(); } exec function AltFire() { if( Level.NetMode == NM_Standalone ) Global.AltFire(); } function bool CanLean() { return ( ViewingSelf() && Pawn.Physics == PHYS_Ladder ); } function PlayerMove( float DeltaTime ) { Super.PlayerMove( DeltaTime ); if( VSize(Pawn.Location - LadderMoveLocation) > 64.0 ) { U2Pawn(Pawn).PlayMovementSound(); LadderMoveLocation = Pawn.Location; } } event BeginState() { Super.BeginState(); LadderMoveLocation = Pawn.Location; } } // PlayerClimbingState //----------------------------------------------------------------------------- // When ghosted, don't change eye height (don't call PlaySwimming which // currently mucks with this). state @ PlayerFlyingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, NotifyBump, TakeDamage; //------------------------------------------------------------------------- function PlayerMove( float DeltaTime ) { local vector X,Y,Z; GetAxes( Rotation, X, Y, Z ); if ( bCheatFlying ) { if( CheatFlyingSpeed ~= 0.0 ) CheatFlyingSpeed = 1.0; Pawn.AirSpeed = CheatFlyingSpeed*Pawn.default.AirSpeed; aUp *= 2.0; } Pawn.Acceleration = (aForward*X + aStrafe*Y + aUp*vect(0,0,1)); // !!mdf-tbr: for some reason moving down speed is 1/2x moving up speed (somewhere in engine?) if ( bCheatFlying && (Pawn.Acceleration == vect(0,0,0)) ) Pawn.StopMovement( false, true ); // Update rotation. UpdateRotation( DeltaTime, 2 ); //NEW MJL HandleMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); /*OLD if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove( DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0) ); else ProcessMove( DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0) ); */ } //------------------------------------------------------------------------- event BeginState() { LeanEnd(); Pawn.AdjustEyeHeight( LPawn.default.ProneEyeHeight ); Pawn.SetPhysics( PHYS_Flying ); } //------------------------------------------------------------------------- event EndState() { if( Pawn != None ) Pawn.AirSpeed = Pawn.default.AirSpeed; } } // PlayerFlyingState //----------------------------------------------------------------------------- state @ GameEndedState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, NotifyBump, NotifyHitWall, NotifyHeadVolumeChange, NotifyPhysicsVolumeChange, BeginFalling, TakeDamage; //------------------------------------------------------------------------- exec function Fire() { if( Role < ROLE_Authority ) return; if( (Level.NetMode == NM_Standalone) && !bFrozen ) ServerReStartGame(); } //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); LeanEnd(); Pawn.RestoreEyeHeight(); } } // GameEndedState //----------------------------------------------------------------------------- state @ LevelTransitionState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, NotifyBump; ignores HitWall, NotifyHeadVolumeChange, NotifyPhysicsVolumeChange, BeginFalling, NotifyTakeHit, TakeDamage, Suicide; //------------------------------------------------------------------------- exec function ThrowWeapon(); exec function Fire(); exec function AltFire(); function PlayerMove( float DeltaTime ); //------------------------------------------------------------------------- event BeginState() { local Controller C; EndZoom(); bFire = 0; bAltFire = 0; if ( Pawn != None ) { Pawn.SimAnim.AnimRate = 0; Pawn.bPhysicsAnimUpdate = false; Pawn.StopAnimating(); //Pawn.SetCollision( false, true, false ); StopMovement( true, true ); //Pawn.SetPhysics( PHYS_None ); Pawn.bUpdateEyeHeight = false; } bFrozen = true; // disable NPCs for ( C=Level.ControllerList; C!=None; C=C.NextController ) { if( C.Pawn != None && !C.IsRealPlayer() && C.Pawn.Health > 0 ) { //!!mdf-tbd: is this ok? C.Pawn.bStasis = true; C.Pawn.SetPhysics( PHYS_None ); C.bStasis = true; //C.Pawn.AnimRate = 0.0; //C.StopMovement( true, true ); //C.Pawn.AmbientSound = None; //U2Pawn(C.Pawn).bServoEnabled = false; //AIController(C).DisableSenses( true ); //C.RemoveAllTimers(); //C.Pawn.RemoveAllTimers(); //C.SetClassStatic( class'AIController', true ); C.SetFrozen( true ); } } } } //----------------------------------------------------------------------------- state @ PlayerEndLevelImmediatelyState extends @ GameEndedState { ignores TakeDamage; //------------------------------------------------------------------------- // !!mdf-tbd: any of this not needed? event BeginState() { // For now we "kill" the player, make him // hidden, put him in the dying state and "press" the fire key in order to // restart the player / bring up the load menu. Pawn.SetPhysics( Phys_None ); StopMovement( true, false ); Pawn.RestoreEyeHeight(); Pawn.Health = 0; bFrozen = false; Pawn.bHidden = true; bPressedJump = false; } //------------------------------------------------------------------------- event EndState() { } } // PlayerEndLevelImmediatelyState //----------------------------------------------------------------------------- state @ BaseSpectatingState { //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); LeanEnd(); } } //----------------------------------------------------------------------------- state @ DeadState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, SwitchWeapon; //------------------------------------------------------------------------- function HandleMissionFailed( Pawn ViewTarget ); //------------------------------------------------------------------------- event BeginState() { if (!Player) return; // level transition (not safe to play music, etc.) Super.BeginState(); bFrozen = false; LeanEnd(); ResetFOV(); if( U2GameInfo(Level.Game) != None && U2GameInfo(Level.Game).bSinglePlayerMission ) { SetLevelAction(); class'MusicScriptEvent'.static.CallRoutine(Self,"dmFadeout"); StopAllMusic( 1.0 ); PlayMusic( DeathMusic[ Rand(DeathMusic.length) ], 0.0 ); Level.TimeDilation = 0.2; } } /* (mdf) fix music not playing issue with some levels exec function RestartLevel() { class'MusicScriptEvent'.static.CallRoutine(Self,"",""); // Shutdown DirectMusic so we don't get double dmFadeouts. Super.RestartLevel(); } */ //------------------------------------------------------------------------- event PlayerTick( float DeltaTime ) { Super.PlayerTick( DeltaTime ); Level.TimeDilation = FMin( Level.TimeDilation + (Level.TimeDilation * DeltaTime), 1.0 ); } //------------------------------------------------------------------------- function SetLevelAction() { Level.LevelAction = LEVACT_GameOver; class'UIConsole'.static.SendEvent("EndGame"); } } //----------------------------------------------------------------------------- function HandleMissionFailed( Pawn ViewTarget ) // derived from PawnDied() -- modified { Unuse(); //!!MWP (mdf) can't this happen if player died / gibbed sometime before mission failed? //assert( Pawn != None ); if( U2P != None ) { U2P.HandleMissionFailed(); SetLocation( U2P.Location ); U2P.UnPossessed(); } SetViewTarget( ViewTarget ); // reset the view target set in UnPossessed() Pawn = None; PendingMover = None; GotoState( MissionFailedState ); } //----------------------------------------------------------------------------- state @ MissionFailedState extends @ DeadState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, SwitchWeapon; //------------------------------------------------------------------------- function SetLevelAction() { Level.LevelAction = LEVACT_MissionFailed; class'UIConsole'.static.SendEvent("EndGame"); } } //----------------------------------------------------------------------------- state @ PlayerSwimmingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, Bump; //------------------------------------------------------------------------- function bool CanLean() { return ( ViewingSelf() && Pawn.Physics == PHYS_Swimming ); } //------------------------------------------------------------------------- function PlayerMove( float DeltaTime ) { local vector X,Y,Z; GetAxes( Rotation, X, Y, Z ); //Pawn.Acceleration = (aForward*X + aStrafe*Y + aUp*vect(0,0,1)); //!!mdf-tbd: give up/down the same weight as forward/back (engine will maintain waterspeed) if( aUp > 0 ) Pawn.Acceleration = (aForward*X + aStrafe*Y + vect(0,0,24000)); else if( aUp < 0 ) Pawn.Acceleration = (aForward*X + aStrafe*Y - vect(0,0,24000)); else Pawn.Acceleration = (aForward*X + aStrafe*Y); /* !!mdf-tbr: not needed for swimming // !!mdf-tbr: for some reason moving down speed is 1/2x moving up speed (somewhere in engine?) if ( Pawn.Acceleration == vect(0,0,0) ) Pawn.StopMovement( false, true ); */ // Update rotation. UpdateRotation( DeltaTime, 2 ); //NEW MJL HandleMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); /*OLD if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove( DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0) ); else ProcessMove( DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0) ); */ } //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); Pawn.AdjustEyeHeight( 0.7*Pawn.default.BaseEyeHeight ); } } // PlayerSwimmingState //----------------------------------------------------------------------------- // Player movement. // standing, walking, running, falling state @ PlayerWalkingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise; //------------------------------------------------------------------------- function bool CanLean() { return ( ViewingSelf() && Pawn.Physics == PHYS_Walking ); } //------------------------------------------------------------------------- event MantleBegin() { // MantleBegin still called if player almost mantled but was moving too fast if( LPawn.bMantling ) GotoState( MantlingState ); else U2Pawn(Pawn).AssetsHelperClass.static.HandleTakeHitSound( U2Pawn(Pawn), 0, class'DamageTypeImpact' ); // !!mdf-tbd: use a hurt sound? } //------------------------------------------------------------------------- event bool NotifyLanded( vector HitNormal ) { if( Pawn.GetStance() == ST_Standing ) Pawn.RestoreEyeHeight(); if ( Global.NotifyLanded( HitNormal ) ) return true; if( DoubleClickDir == DCLICK_Active ) { DoubleClickDir = DCLICK_Done; PlayerInput.DoubleClickTimer = 0.0; Pawn.Velocity = 0.1*Pawn.Velocity; } else DoubleClickDir = DCLICK_None; return false; } //------------------------------------------------------------------------- function ProcessMove( float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot ) { if( DoubleClickMove == DCLICK_Active && Pawn.Physics == PHYS_Falling ) DoubleClickDir = DCLICK_Active; else if( DoubleClickMove != DCLICK_None && DoubleClickMove < DCLICK_Active ) { if( U2Pawn(Pawn) != None && CanDodge() ) { U2Pawn(Pawn).Dodge( DoubleClickMove, true ); DoubleClickDir = DCLICK_Active; } } Super.ProcessMove( DeltaTime,NewAccel,DoubleClickMove,DeltaRot ); } //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); Pawn.RestoreEyeHeight(); } } // PlayerWalkingState //----------------------------------------------------------------------------- // Spectator state for cutscenes /* state @ CinematicState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, NotifyBump, NotifyHitWall, NotifyHeadVolumeChange, NotifyPhysicsVolumeChange, BeginFalling, TakeDamage; event BeginState() { // Hide UI local UIConsole C; C = UIConsole(Player.Console); if( C != None ) C.bHideUI = true; // Hide Player ConsoleCommand( "invisible 1" ); Pawn.ClearReferencesTo(); // Register key and mouse listeners - disabling all keyboard and mouse events // Intercept a key (space) to end cinematic } // Hide crosshair too function bool HandlingCrosshair() { return true; } exec function EndCinematic() { // Show UI local UIConsole C; C = UIConsole(Player.Console); if( C != None ) C.bHideUI = false; // Show Player ConsoleCommand( "invisible 0" ); // Trigger level change TriggerEvent( EndCinematicEvent, Self, None ); // tbd: Return player to default state // Remove key and mouse listeners } } // CinematicState */ //----------------------------------------------------------------------------- defaultproperties { bIgnoreNextWhenZoomed=true ProneWeaponKickRatio=0.500000 UIAlpha=255 AutoSaveIndex=22 DeathMusic(0)="DEATH_1.ogg" DeathMusic(1)="DEATH_2.ogg" DeathMusic(2)="DEATH_3.ogg" DeathMusic(3)="DEATH_4.ogg" ExecManagerClasses(0)=Class'U2.CheatManager' ExecManagerClasses(1)=Class'U2.AdminManager' UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |