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 02515 02516 02517 02518 02519 02520 02521 02522 02523 02524 02525 02526 02527 02528 02529 02530 02531 02532 02533 02534 02535 02536 02537 02538 02539 02540 02541 02542 02543 02544 02545 02546 02547 02548 02549 02550 02551 02552 02553 02554 02555 02556 02557 02558 02559 02560 02561 02562 02563 02564 02565 02566 02567 02568 02569 02570 02571 02572 02573 02574 02575 02576 02577 02578 02579 02580 02581 02582 02583 02584 02585 02586 02587 02588 02589 02590 02591 02592 02593 02594 02595 02596 02597 02598 02599 02600 02601 02602 02603 02604 02605 02606 02607 02608 02609 02610 02611 02612 02613 02614 02615 02616 02617 02618 02619 02620 02621 02622 02623 02624 02625 02626 02627 02628 02629 02630 02631 02632 02633 02634 02635 02636 02637 02638 02639 02640 02641 02642 02643 02644 02645 02646 02647 02648 02649 02650 02651 02652 02653 02654 02655 02656 02657 02658 02659 02660 02661 02662 02663 02664 02665 02666 02667 02668 02669 02670 02671 02672 02673 02674 02675 02676 02677 02678 02679 02680 02681 02682 02683 02684 02685 02686 02687 02688 02689 02690 02691 02692 02693 02694 02695 02696 02697 02698 02699 02700 02701 02702 02703 02704 02705 02706 02707 02708 02709 02710 02711 02712 02713 02714 02715 02716 02717 02718 02719 02720 02721 02722 02723 02724 02725 02726 02727 02728 02729 02730 02731 02732 02733 02734 02735 02736 02737 02738 02739 02740 02741 02742 02743 02744 02745 02746 02747 02748 02749 02750 02751 02752 02753 02754 02755 02756 02757 02758 02759 02760 02761 02762 02763 02764 02765 02766 02767 02768 02769 02770 02771 02772 02773 02774 02775 02776 02777 02778 02779 02780 02781 02782 02783 02784 02785 02786 02787 02788 02789 02790 02791 02792 02793 02794 02795 02796 02797 02798 02799 02800 02801 02802 02803 02804 02805 02806 02807 02808 02809 02810 02811 02812 02813 02814 02815 02816 02817 02818 02819 02820 02821 02822 02823 02824 02825 02826 02827 02828 02829 02830 02831 02832 02833 02834 02835 02836 02837 02838 02839 02840 02841 02842 02843 02844 02845 02846 02847 02848 02849 02850 02851 02852 02853 02854 02855 02856 02857 02858 02859 02860 02861 02862 02863 02864 02865 02866 02867 02868 02869 02870 02871 02872 02873 02874 02875 02876 02877 02878 02879 02880 02881 02882 02883 02884 02885 02886 02887 02888 02889 02890 02891 02892 02893 02894 02895 02896 02897 02898 02899 02900 02901 02902 02903 02904 02905 02906 02907 02908 02909 02910 02911 02912 02913 02914 02915 02916 02917 02918 02919 02920 02921 02922 02923 02924 02925 02926 02927 02928 02929 02930 02931 02932 02933 02934 02935 02936 02937 02938 02939 02940 02941 02942 02943 02944 02945 02946 02947 02948 02949 02950 02951 02952 02953 02954 02955 02956 02957 02958 02959 02960 02961 02962 02963 02964 02965 02966 02967 02968 02969 02970 02971 02972 02973 02974 02975 02976 02977 02978 02979 02980 02981 02982 02983 02984 02985 02986 02987 02988 02989 02990 02991 02992 02993 02994 02995 02996 02997 02998 02999 03000 03001 03002 03003 03004 03005 03006 03007 03008 03009 03010 03011 03012 03013 03014 03015 03016 03017 03018 03019 03020 03021 03022 03023 03024 03025 03026 03027 03028 03029 03030 03031 03032 03033 03034 03035 03036 03037 03038 03039 03040 03041 03042 03043 03044 03045 03046 03047 03048 03049 03050 03051 03052 03053 03054 03055 03056 03057 03058 03059 03060 03061 03062 03063 03064 03065 03066 03067 03068 03069 03070 03071 03072 03073 03074 03075 03076 03077 03078 03079 03080 03081 03082 03083 03084 03085 03086 03087 03088 03089 03090 03091 03092 03093 03094 03095 03096 03097 03098 03099 03100 03101 03102 03103 03104 03105 03106 03107 03108 03109 03110 03111 03112 03113 03114 03115 03116 03117 03118 03119 03120 03121 03122 03123 03124 03125 03126 03127 03128 03129 03130 03131 03132 03133 03134 03135 03136 03137 03138 03139 03140 03141 03142 03143 03144 03145 03146 03147 03148 03149 03150 03151 03152 03153 03154 03155 03156 03157 03158 03159 03160 03161 03162 03163 03164 03165 03166 03167 03168 03169 03170 03171 03172 03173 03174 03175 03176 03177 03178 03179 03180 03181 03182 03183 03184 03185 03186 03187 03188 03189 03190 03191 03192 03193 03194 03195 03196 03197 03198 03199 03200 03201 03202 03203 03204 03205 03206 03207 03208 03209 03210 03211 03212 03213 03214 03215 03216 03217 03218 03219 03220 03221 03222 03223 03224 03225 03226 03227 03228 03229 03230 03231 03232 03233 03234 03235 03236 03237 03238 03239 03240 03241 03242 03243 03244 03245 03246 03247 03248 03249 03250 03251 03252 03253 03254 03255 03256 03257 03258 03259 03260 03261 03262 03263 03264 03265 03266 03267 03268 03269 03270 03271 03272 03273 03274 03275 03276 03277 03278 03279 03280 03281 03282 03283 03284 03285 03286 03287 03288 03289 03290 03291 03292 03293 03294 03295 03296 03297 03298 03299 03300 03301 03302 03303 03304 03305 03306 03307 03308 03309 03310 03311 03312 03313 03314 03315 03316 03317 03318 03319 03320 03321 03322 03323 03324 03325 03326 03327 03328 03329 03330 03331 03332 03333 03334 03335 03336 03337 03338 03339 03340 03341 03342 03343 03344 03345 03346 03347 03348 03349 03350 03351 03352 03353 03354 03355 03356 03357 03358 03359 03360 03361 03362 03363 03364 03365 03366 03367 03368 03369 03370 03371 03372 03373 03374 03375 03376 03377 03378 03379 03380 03381 03382 03383 03384 03385 03386 03387 03388 03389 03390 03391 03392 03393 03394 03395 03396 03397 03398 03399 03400 03401 03402 03403 03404 03405 03406 03407 03408 03409 03410 03411 03412 03413 03414 03415 03416 03417 03418 03419 03420 03421 03422 03423 03424 03425 03426 03427 03428 03429 03430 03431 03432 03433 03434 03435 03436 03437 03438 03439 03440 03441 03442 03443 03444 03445 03446 03447 03448 03449 03450 03451 03452 03453 03454 03455 03456 03457 03458 03459 03460 03461 03462 03463 03464 03465 03466 03467 03468 03469 03470 03471 03472 03473 03474 03475 03476 03477 03478 03479 03480 03481 03482 03483 03484 03485 03486 03487 03488 03489 03490 03491 03492 03493 03494 03495 03496 03497 03498 03499 03500 03501 03502 03503 03504 03505 03506 03507 03508 03509 03510 03511 03512 03513 03514 03515 03516 03517 03518 03519 03520 03521 03522 03523 03524 03525 03526 03527 03528 03529 03530 03531 03532 03533 03534 03535 03536 03537 03538 03539 03540 03541 03542 03543 03544 03545 03546 03547 03548 03549 03550 03551 03552 03553 03554 03555 03556 03557 03558 03559 03560 03561 03562 03563 03564 03565 03566 03567 03568 03569 03570 03571 03572 03573 03574 03575 03576 03577 03578 03579 03580 03581 03582 03583 03584 03585 03586 03587 03588 03589 03590 03591 03592 03593 03594 03595 03596 03597 03598 03599 03600 03601 03602 03603 03604 03605 03606 03607 03608 03609 03610 03611 03612 03613 03614 03615 03616 03617 03618 03619 03620 03621 03622 03623 03624 03625 03626 03627 03628 03629 03630 03631 03632 03633 03634 03635 03636 03637 03638 03639 03640 03641 03642 03643 03644 03645 03646 03647 03648 03649 03650 03651 03652 03653 03654 03655 03656 03657 03658 03659 03660 03661 03662 03663 03664 03665 03666 03667 03668 03669 03670 03671 03672 03673 03674 03675 03676 03677 03678 03679 03680 03681 03682 03683 03684 03685 03686 03687 03688 03689 03690 03691 03692 03693 03694 03695 03696 03697 03698 03699 03700 03701 03702 03703 03704 03705 03706 03707 03708 03709 03710 03711 03712 03713 03714 03715 03716 03717 03718 03719 03720 03721 03722 03723 03724 03725 03726 03727 03728 03729 03730 03731 03732 03733 03734 03735 03736 03737 03738 03739 03740 03741 03742 03743 03744 03745 03746 03747 03748 03749 03750 03751 03752 03753 03754 03755 03756 03757 03758 03759 03760 03761 03762 03763 03764 03765 03766 03767 03768 03769 03770 03771 03772 03773 03774 03775 03776 03777 03778 03779 03780 03781 03782 03783 03784 03785 03786 03787 03788 03789 03790 03791 03792 03793 03794 03795 03796 03797 03798 03799 03800 03801 03802 03803 03804 03805 03806 03807 03808 03809 03810 03811 03812 03813 03814 03815 03816 03817 03818 03819 03820 03821 03822 03823 03824 03825 03826 03827 03828 03829 03830 03831 03832 03833 03834 03835 03836 03837 03838 03839 03840 03841 03842 03843 03844 03845 03846 03847 03848 03849 03850 03851 03852 03853 03854 03855 03856 03857 03858 03859 03860 03861 03862 03863 03864 03865 03866 03867 03868 03869 03870 03871 03872 03873 03874 03875 03876 03877 03878 03879 03880 03881 03882 03883 03884 03885 03886 03887 03888 03889 03890 03891 03892 03893 03894 03895 03896 03897 03898 03899 03900 03901 03902 03903 03904 03905 03906 03907 03908 03909 03910 03911 03912 03913 03914 03915 03916 03917 03918 03919 03920 03921 03922 03923 03924 03925 03926 03927 03928 03929 03930 03931 03932 03933 03934 03935 03936 03937 03938 03939 03940 03941 03942 03943 03944 03945 03946 03947 03948 03949 03950 03951 03952 03953 03954 03955 03956 03957 03958 03959 03960 03961 03962 03963 03964 03965 03966 03967 03968 03969 03970 03971 03972 03973 03974 03975 03976 03977 03978 03979 03980 03981 03982 03983 03984 03985 03986 03987 03988 03989 03990 03991 03992 03993 03994 03995 03996 03997 03998 03999 04000 04001 04002 04003 04004 04005 04006 04007 04008 04009 04010 04011 04012 04013 04014 04015 04016 04017 04018 04019 04020 04021 04022 04023 04024 04025 04026 04027 04028 04029 04030 04031 04032 04033 04034 04035 04036 04037 04038 04039 04040 04041 04042 04043 04044 04045 04046 04047 04048 04049 04050 04051 04052 04053 04054 04055 04056 04057 04058 04059 04060 04061 04062 04063 04064 04065 04066 04067 04068 04069 04070 04071 04072 04073 04074 04075 04076 04077 04078 04079 04080 04081 04082 04083 04084 04085 04086 04087 04088 04089 04090 04091 04092 04093 04094 04095 04096 04097 04098 04099 04100 04101 04102 04103 04104 04105 04106 04107 04108 04109 04110 04111 04112 04113 04114 04115 04116 04117 04118 04119 04120 04121 04122 04123 04124 04125 04126 04127 04128 04129 04130 04131 04132 04133 04134 04135 04136 04137 04138 04139 04140 04141 04142 04143 04144 04145 04146 04147 04148 04149 04150 04151 04152 04153 04154 04155 04156 04157 04158 04159 04160 04161 04162 04163 04164 04165 04166 04167 04168 04169 04170 04171 04172 04173 04174 04175 04176 04177 04178 04179 04180 04181 04182 04183 04184 04185 04186 04187 04188 04189 04190 04191 04192 04193 04194 04195 04196 04197 04198 04199 04200 04201 04202 04203 04204 04205 04206 04207 04208 04209 04210 04211 04212 04213 04214 04215 04216 04217 04218 04219 04220 04221 04222 04223 04224 04225 04226 04227 04228 04229 04230 04231 04232 04233 04234 04235 04236 04237 04238 04239 04240 04241 04242 04243 04244 04245 04246 04247 04248 04249 04250 04251 04252 04253 04254 04255 04256 04257 04258 04259 04260 04261 04262 04263 04264 04265 04266 04267 04268 04269 04270 04271 04272 04273 04274 04275 04276 04277 04278 04279 04280 04281 04282 04283 04284 04285 04286 04287 04288 04289 04290 04291 04292 04293 04294 04295 04296 04297 04298 04299 04300 04301 04302 04303 04304 04305 04306 04307 04308 04309 04310 04311 04312 04313 04314 04315 04316 04317 04318 04319 04320 04321 04322 04323 04324 04325 04326 04327 04328 04329 04330 04331 04332 04333 04334 04335 04336 04337 04338 04339 04340 04341 04342 04343 04344 04345 04346 04347 04348 04349 04350 04351 04352 04353 04354 04355 04356 04357 04358 04359 04360 04361 04362 04363 04364 04365 04366 04367 04368 04369 04370 04371 04372 04373 04374 04375 04376 04377 04378 04379 04380 04381 04382 04383 04384 04385 04386 04387 04388 04389 04390 04391 04392 04393 04394 04395 04396 04397 04398 04399 04400 04401 04402 04403 04404 04405 04406 04407 04408 04409 04410 04411 04412 04413 04414 04415 04416 04417 04418 04419 04420 04421 04422 04423 04424 04425 04426 04427 04428 04429 04430 04431 04432 04433 04434 04435 04436 04437 04438 04439 04440 04441 04442 04443 04444 04445 04446 04447 04448 04449 04450 04451 04452 04453 04454 04455 04456 04457 04458 04459 04460 04461 04462 04463 04464 04465 04466 04467 04468 04469 04470 04471 04472 04473 04474 04475 04476 04477 04478 04479 04480 04481 04482 04483 04484 04485 04486 04487 04488 04489 04490 04491 04492 04493 04494 04495 04496 04497 04498 04499 04500 04501 04502 04503 04504 04505 04506 04507 04508 04509 04510 04511 04512 04513 04514 04515 04516 04517 04518 04519 04520 04521 04522 04523 04524 04525 04526 04527 04528 04529 04530 04531 04532 04533 04534 04535 04536 04537 04538 04539 04540 04541 04542 04543 04544 04545 04546 04547 04548 04549 04550 04551 04552 04553 04554 04555 04556 04557 04558 04559 04560 04561 04562 04563 04564 04565 04566 04567 04568 04569 04570 04571 04572 04573 04574 04575 04576 04577 04578 04579 04580 04581 04582 04583 04584 04585 04586 04587 04588 04589 04590 04591 04592 04593 04594 04595 04596 04597 04598 04599 04600 04601 04602 04603 04604 04605 04606 04607 04608 04609 04610 04611 04612 04613 04614 04615 04616 04617 04618 04619 04620 04621 04622 04623 04624 04625 04626 04627 04628 04629 04630 04631 04632 04633 04634 04635 04636 04637 04638 04639 04640 04641 04642 04643 04644 04645 04646 04647 04648 04649 04650 04651 04652 04653 04654 04655 04656 04657 04658 04659 04660 04661 04662 04663 04664 04665 04666 04667 04668 04669 04670 04671 04672 04673 04674 04675 04676 04677 04678 04679 04680 04681 04682 04683 04684 04685 04686 04687 04688 04689 04690 04691 04692 04693 04694 04695 04696 04697 04698 04699 04700 04701 04702 04703 04704 04705 04706 04707 04708 04709 04710 04711 04712 04713 04714 04715 04716 04717 04718 04719 04720 04721 04722 04723 04724 04725 04726 04727 04728 04729 04730 04731 04732 04733 04734 04735 04736 04737 04738 04739 04740 04741 04742 04743 04744 04745 04746 04747 04748 04749 04750 04751 04752 04753 04754 04755 04756 04757 04758 04759 04760 04761 04762 04763 04764 04765 04766 04767 04768 04769 04770 04771 04772 04773 04774 04775 04776 04777 04778 04779 04780 04781 04782 04783 04784 04785 04786 04787 04788 04789 04790 04791 04792 04793 04794 04795 04796 04797 04798 04799 04800 04801 04802 04803 04804 04805 04806 04807 04808 04809 04810 04811 04812 04813 04814 04815 04816 04817 04818 04819 04820 04821 04822 04823 04824 04825 04826 04827 04828 04829 04830 04831 04832 04833 04834 04835 04836 04837 04838 04839 04840 04841 04842 04843 04844 04845 04846 04847 04848 04849 04850 04851 04852 04853 04854 04855 04856 04857 04858 04859 04860 04861 04862 04863 04864 04865 04866 04867 04868 04869 04870 04871 04872 04873 04874 04875 04876 04877 04878 04879 04880 04881 04882 04883 04884 04885 04886 04887 04888 04889 04890 04891 04892 04893 04894 04895 04896 04897 04898 04899 04900 04901 04902 04903 04904 04905 04906 04907 04908 04909 04910 04911 04912 04913 04914 04915 04916 04917 04918 04919 04920 04921 04922 04923 04924 04925 04926 04927 04928 04929 04930 04931 04932 04933 04934 04935 04936 04937 04938 04939 04940 04941 04942 04943 04944 04945 04946 04947 04948 04949 04950 04951 04952 04953 04954 04955 04956 04957 04958 04959 04960 04961 04962 04963 04964 04965 04966 04967 04968 04969 04970 04971 04972 04973 04974 04975 04976 04977 04978 04979 04980 04981 04982 04983 04984 04985 04986 04987 04988 04989 04990 04991 04992 04993 04994 04995 04996 04997 04998 04999 05000 05001 05002 05003 05004 05005 05006 05007 05008 05009 05010 05011 05012 05013 05014 05015 05016 05017 05018 05019 05020 05021 05022 05023 05024 05025 05026 05027 05028 05029 05030 05031 05032 05033 05034 05035 05036 05037 05038 05039 05040 05041 05042 05043 05044 05045 05046 05047 05048 05049 05050 05051 05052 05053 05054 05055 05056 05057 05058 05059 05060 05061 05062 05063 05064 05065 05066 05067 05068 05069 05070 05071 05072 05073 05074 05075 05076 05077 05078 05079 05080 05081 05082 05083 05084 05085 05086 05087 05088 05089 05090 05091 05092 05093 05094 05095 05096 05097 05098 05099 05100 05101 05102 05103 05104 05105 05106 05107 05108 05109 05110 05111 05112 05113 05114 05115 05116 05117 05118 05119 05120 05121 05122 05123 05124 05125 05126 05127 05128 05129 05130 05131 05132 05133 05134 05135 05136 05137 05138 05139 05140 05141 05142 05143 05144 05145 05146 05147 05148 05149 05150 05151 05152 05153 05154 05155 05156 05157 05158 05159 05160 05161 05162 05163 05164 05165 05166 05167 05168 05169 05170 05171 05172 05173 05174 05175 05176 05177 05178 05179 05180 05181 05182 05183 05184 05185 05186 05187 05188 05189 05190 05191 05192 05193 05194 05195 05196 05197 05198 05199 05200 05201 05202 05203 05204 05205 05206 05207 05208 05209 05210 05211 05212 05213 05214 05215 05216 05217 05218 05219 05220 05221 05222 05223 05224 05225 05226 05227 05228 05229 05230 05231 05232 05233 05234 05235 05236 05237 05238 05239 05240 05241 05242 05243 05244 05245 05246 05247 05248 05249 05250 05251 05252 05253 05254 05255 05256 05257 05258 05259 05260 05261 05262 05263 05264 05265 05266 05267 05268 05269 05270 05271 05272 05273 05274 05275 05276 05277 05278 05279 05280 05281 05282 05283 05284 05285 05286 05287 05288 05289 05290 05291 05292 05293 05294 05295 05296 05297 05298 05299 05300 05301 05302 05303 05304 05305 05306 05307 05308 05309 05310 05311 05312 05313 05314 05315 05316 05317 05318 05319 05320 05321 05322 05323 05324 05325 05326 05327 05328 05329 05330 05331 05332 05333 05334 05335 05336 05337 05338 05339 05340 05341 05342 05343 05344 05345 05346 05347 05348 05349 05350 05351 05352 05353 05354 05355 05356 05357 05358 05359 05360 05361 05362 05363 05364 05365 05366 05367 05368 05369 05370 05371 05372 05373 05374 05375 05376 05377 05378 05379 05380 05381 05382 05383 05384 05385 05386 05387 05388 05389 05390 05391 05392 05393 05394 05395 05396 05397 05398 05399 05400 05401 05402 05403 05404 05405 05406 05407 05408 05409 05410 05411 05412 05413 05414 05415 05416 05417 05418 05419 05420 05421 05422 05423 05424 05425 05426 05427 05428 05429 05430 05431 05432 05433 05434 05435 05436 05437 05438 05439 05440 05441 05442 05443 05444 05445 05446 05447 05448 05449 05450 05451 05452 05453 05454 05455 05456 05457 05458 05459 05460 05461 05462 05463 05464 05465 05466 05467 05468 05469 05470 05471 05472 05473 05474 05475 05476 05477 05478 05479 05480 05481 05482 05483 05484 05485 05486 05487 05488 05489 05490 05491 05492 05493 05494 05495 05496 05497 05498 05499 05500 05501 05502 05503 05504 05505 05506 05507 05508 05509 05510 05511 05512 05513 05514 05515 05516 05517 05518 05519 05520 05521 05522 05523 05524 05525 05526 05527 05528 05529 05530 05531 05532 05533 05534 05535 05536 05537 05538 05539 05540 05541 05542 05543 05544 05545 05546 05547 05548 05549 05550 05551 05552 05553 05554 05555 05556 05557 05558 05559 05560 05561 05562 05563 05564 05565 05566 05567 05568 05569 05570 05571 05572 05573 05574 05575 05576 05577 05578 05579 05580 05581 05582 05583 05584 05585 05586 05587 05588 05589 05590 05591 05592 05593 05594 05595 05596 05597 05598 05599 05600 05601 05602 05603 05604 05605 05606 05607 05608 05609 05610 05611 05612 05613 05614 05615 05616 05617 05618 05619 05620 05621 05622 05623 05624 05625 05626 05627 05628 05629 05630 05631 05632 05633 05634 05635 05636 05637 05638 05639 05640 05641 05642 05643 05644 05645 05646 05647 05648 05649 05650 05651 05652 05653 05654 05655 05656 05657 05658 05659 05660 05661 05662 05663 05664 05665 05666 05667 05668 05669 05670 05671 05672 05673 05674 05675 05676 05677 05678 05679 05680 05681 05682 05683 05684 05685 05686 05687 05688 05689 05690 05691 05692 05693 05694 05695 05696 05697 05698 05699 05700 05701 05702 05703 05704 05705 05706 05707 05708 05709 05710 05711 05712 05713 05714 05715 05716 05717 05718 05719 05720 05721 05722 05723 05724 05725 05726 05727 05728 05729 05730 05731 05732 05733 05734 05735 05736 05737 05738 05739 05740 05741 05742 05743 05744 05745 05746 05747 05748 05749 05750 05751 05752 05753 05754 05755 05756 05757 05758 05759 05760 05761 05762 05763 05764 05765 05766 05767 05768 05769 05770 05771 05772 05773 05774 05775 05776 05777 05778 05779 05780 05781 05782 05783 05784 05785 05786 05787 05788 05789 05790 05791 05792 05793 05794 05795 05796 05797 05798 05799 05800 05801 05802 05803 05804 05805 05806 05807 05808 05809 05810 05811 05812 05813 05814 05815 05816 05817 05818 05819 05820 05821 05822 05823 05824 05825 05826 05827 05828 05829 05830 05831 05832 05833 05834 05835 05836 05837 05838 05839 05840 05841 05842 05843 05844 05845 05846 05847 05848 05849 05850 05851 05852 05853 05854 05855 05856 05857 05858 05859 05860 05861 05862 05863 05864 05865 05866 05867 05868 05869 05870 05871 05872 05873 05874 05875 05876 05877 05878 05879 05880 05881 05882 05883 05884 05885 05886 05887 05888 05889 05890 05891 05892 05893 05894 05895 05896 05897 05898 05899 05900 05901 05902 05903 05904 05905 05906 05907 05908 05909 05910 05911 05912 05913 05914 05915 05916 05917 05918 05919 05920 05921 05922 05923 05924 05925 05926 05927 05928 05929 05930 05931 05932 05933 05934 05935 05936 05937 05938 05939 05940 05941 05942 05943 05944 05945 05946 05947 05948 05949 05950 05951 05952 05953 05954 05955 05956 05957 05958 05959 05960 05961 05962 05963 05964 05965 05966 05967 05968 05969 05970 05971 05972 05973 05974 05975 05976 05977 05978 05979 05980 05981 05982 05983 05984 05985 05986 05987 05988 05989 05990 05991 05992 05993 05994 05995 05996 05997 05998 05999 06000 06001 06002 06003 06004 06005 06006 06007 06008 06009 06010 06011 06012 06013 06014 06015 06016 06017 06018 06019 06020 06021 06022 06023 06024 06025 06026 06027 06028 06029 06030 06031 06032 06033 06034 06035 06036 06037 06038 06039 06040 06041 06042 06043 06044 06045 06046 06047 06048 06049 06050 06051 06052 06053 06054 06055 06056 06057 06058 06059 06060 06061 06062 06063 06064 06065 06066 06067 06068 06069 06070 06071 06072 06073 06074 06075 06076 06077 06078 06079 06080 06081 06082 06083 06084 06085 06086 06087 06088 06089 06090 06091 06092 06093 06094 06095 06096 06097 06098 06099 06100 06101 06102 06103 06104 06105 06106 06107 06108 06109 06110 06111 06112 06113 06114 06115 06116 06117 06118 06119 06120 06121 06122 06123 06124 06125 06126 06127 06128 06129 06130 06131 06132 06133 06134 06135 06136 06137 06138 06139 06140 06141 06142 06143 06144 06145 06146 06147 06148 06149 06150 06151 06152 06153 06154 06155 06156 06157 06158 06159 06160 06161 06162 06163 06164 06165 06166 06167 06168 06169 06170 06171 06172 06173 06174 06175 06176 06177 06178 06179 06180 06181 06182 06183 06184 06185 06186 06187 06188 06189 06190 06191 06192 06193 06194 06195 06196 06197 06198 06199 06200 06201 06202 06203 06204 06205 06206 06207 06208 06209 06210 06211 06212 06213 06214 06215 06216 06217 06218 06219 06220 06221 06222 06223 06224 06225 06226 06227 06228 06229 06230 06231 06232 06233 06234 06235 06236 06237 06238 06239 06240 06241 06242 06243 06244 06245 06246 06247 06248 06249 06250 06251 06252 06253 06254 06255 06256 06257 06258 06259 06260 06261 06262 06263 06264 06265 06266 06267 06268 06269 06270 06271 06272 06273 06274 06275 06276 06277 06278 06279 06280 06281 06282 06283 06284 06285 06286 06287 06288 06289 06290 06291 06292 06293 06294 06295 06296 06297 06298 06299 06300 06301 06302 06303 06304 06305 06306 06307 06308 06309 06310 06311 06312 06313 06314 06315 06316 06317 06318 06319 06320 06321 06322 06323 06324 06325 06326 06327 06328 06329 06330 06331 06332 06333 06334 06335 06336 06337 06338 06339 06340 06341 06342 06343 06344 06345 06346 06347 06348 06349 06350 06351 06352 06353 06354 06355 06356 06357 06358 06359 06360 06361 06362 06363 06364 06365 06366 06367 06368 06369 06370 06371 06372 06373 06374 06375 06376 06377 06378 06379 06380 06381 06382 06383 06384 06385 06386 06387 06388 06389 06390 06391 06392 06393 06394 06395 06396 06397 06398 06399 06400 06401 06402 06403 06404 06405 06406 06407 06408 06409 06410 06411 06412 06413 06414 06415 06416 06417 06418 06419 06420 06421 06422 06423 06424 06425 06426 06427 06428 06429 06430 06431 06432 06433 06434 06435 06436 06437 06438 06439 06440 06441 06442 06443 06444 06445 06446 06447 06448 06449 06450 06451 06452 06453 06454 06455 06456 06457 06458 06459 06460 06461 06462 06463 06464 06465 06466 06467 06468 06469 06470 06471 06472 06473 06474 06475 06476 06477 06478 06479 06480 06481 06482 06483 06484 06485 06486 06487 06488 06489 06490 06491 06492 06493 06494 06495 06496 06497 06498 06499 06500 06501 06502 06503 06504 06505 06506 06507 06508 06509 06510 06511 06512 06513 06514 06515 06516 06517 06518 06519 06520 06521 06522 06523 06524 06525 06526 06527 06528 06529 06530 06531 06532 06533 06534 06535 06536 06537 06538 06539 06540 06541 06542 06543 06544 06545 06546 06547 06548 06549 06550 06551 06552 06553 06554 06555 06556 06557 06558 06559 06560 06561 06562 06563 06564 06565 06566 06567 06568 06569 06570 06571 06572 06573 06574 06575 06576 06577 06578 06579 06580 06581 06582 06583 06584 06585 06586 06587 06588 06589 06590 06591 06592 06593 06594 06595 06596 06597 06598 06599 06600 06601 06602 06603 06604 06605 06606 06607 06608 06609 06610 06611 06612 06613 06614 06615 06616 06617 06618 06619 06620 06621 06622 06623 06624 06625 06626 06627 06628 06629 06630 06631 06632 06633 06634 06635 06636 06637 06638 06639 06640 06641 06642 06643 06644 06645 06646 06647 06648 06649 06650 06651 06652 06653 06654 06655 06656 06657 06658 06659 06660 06661 06662 06663 06664 06665 06666 06667 06668 06669 06670 06671 06672 06673 06674 06675 06676 06677 06678 06679 06680 06681 06682 06683 06684 06685 06686 06687 06688 06689 06690 06691 06692 06693 06694 06695 06696 06697 06698 06699 06700 06701 06702 06703 06704 06705 06706 06707 06708 06709 06710 06711 06712 06713 06714 06715 06716 06717 06718 06719 06720 06721 06722 06723 06724 06725 06726 06727 06728 06729 06730 06731 06732 06733 06734 06735 06736 06737 06738 06739 06740 06741 06742 06743 06744 06745 06746 06747 06748 06749 06750 06751 06752 06753 06754 06755 06756 06757 06758 06759 06760 06761 06762 06763 06764 06765 06766 06767 06768 06769 06770 06771 06772 06773 06774 06775 06776 06777 06778 06779 06780 06781 06782 06783 06784 06785 06786 06787 06788 06789 06790 06791 06792 06793 06794 06795 06796 06797 06798 06799 06800 06801 06802 06803 06804 06805 06806 06807 06808 06809 06810 06811 06812 06813 06814 06815 06816 06817 06818 06819 06820 06821 06822 06823 06824 06825 06826 06827 06828 06829 06830 06831 06832 06833 06834 06835 06836 06837 06838 06839 06840 06841 06842 06843 06844 06845 06846 06847 06848 06849 06850 06851 06852 06853 06854 06855 06856 06857 06858 06859 06860 06861 06862 06863 06864 06865 06866 06867 06868 06869 06870 06871 06872 06873 06874 06875 06876 06877 06878 06879 06880 06881 06882 06883 06884 06885 06886 06887 06888 06889 06890 06891 06892 06893 06894 06895 06896 06897 06898 06899 06900 06901 06902 06903 06904 06905 06906 06907 06908 06909 06910 06911 06912 06913 06914 06915 06916 06917 06918 06919 06920 06921 06922 06923 06924 06925 06926 06927 06928 06929 06930 06931 06932 06933 06934 06935 06936 06937 06938 06939 06940 06941 06942 06943 06944 06945 06946 06947 06948 06949 06950 06951 06952 06953 06954 06955 06956 06957 06958 06959 06960 06961 06962 06963 06964 06965 06966 06967 06968 06969 06970 06971 06972 06973 06974 06975 06976 06977 06978 06979 06980 06981 06982 06983 06984 06985 06986 06987 06988 06989 06990 06991 06992 06993 06994 06995 06996 06997 06998 06999 07000 07001 07002 07003 07004 07005 07006 07007 07008 07009 07010 07011 07012 07013 07014 07015 07016 07017 07018 07019 07020 07021 07022 07023 07024 07025 07026 07027 07028 07029 07030 07031 07032 07033 07034 07035 07036 07037 07038 07039 07040 07041 07042 07043 07044 07045 07046 07047 07048 07049 07050 07051 07052 07053 07054 07055 07056 07057 07058 07059 07060 07061 07062 07063 07064 07065 07066 07067 07068 07069 07070 07071 07072 07073 07074 07075 07076 07077 07078 07079 07080 07081 07082 07083 07084 07085 07086 07087 07088 07089 07090 07091 07092 07093 07094 07095 07096 07097 07098 07099 07100 07101 07102 07103 07104 07105 07106 07107 07108 07109 07110 07111 07112 07113 07114 07115 07116 07117 07118 07119 07120 07121 07122 07123 07124 07125 07126 07127 07128 07129 07130 07131 07132 07133 07134 07135 07136 07137 07138 07139 07140 07141 07142 07143 07144 07145 07146 07147 07148 07149 07150 07151 07152 07153 07154 07155 07156 07157 07158 07159 07160 07161 07162 07163 07164 07165 07166 07167 07168 07169 07170 07171 07172 07173 07174 07175 07176 07177 07178 07179 07180 07181 07182 07183 07184 07185 07186 07187 07188 07189 07190 07191 07192 07193 07194 07195 07196 07197 07198 07199 07200 07201 07202 07203 07204 07205 07206 07207 07208 07209 07210 07211 07212 07213 07214 07215 07216 07217 07218 07219 07220 07221 07222 07223 07224 07225 07226 07227 07228 07229 07230 07231 07232 07233 07234 07235 07236 07237 07238 07239 07240 07241 07242 07243 07244 07245 07246 07247 07248 07249 07250 07251 07252 07253 07254 07255 07256 07257 07258 07259 07260 07261 07262 07263 07264 07265 07266 07267 07268 07269 07270 07271 07272 07273 07274 07275 07276 07277 07278 07279 07280 07281 07282 07283 07284 07285 07286 07287 07288 07289 07290 07291 07292 07293 07294 07295 07296 07297 07298 07299 07300 07301 07302 07303 07304 07305 07306 07307 07308 07309 07310 07311 07312 07313 07314 07315 07316 07317 07318 07319 07320 07321 07322 07323 07324 07325 07326 07327 07328 07329 07330 07331 07332 07333 07334 07335 07336 07337 07338 07339 07340 07341 07342 07343 07344 07345 07346 07347 07348 07349 07350 07351 07352 07353 07354 07355 07356 07357 07358 07359 07360 07361 07362 07363 07364 07365 07366 07367 07368 07369 07370 07371 07372 07373 07374 07375 07376 07377 07378 07379 07380 07381 07382 07383 07384 07385 07386 07387 07388 07389 07390 07391 07392 07393 07394 07395 07396 07397 07398 07399 07400 07401 07402 07403 07404 07405 07406 07407 07408 07409 07410 07411 07412 07413 07414 07415 07416 07417 07418 07419 07420 07421 07422 07423 07424 07425 07426 07427 07428 07429 07430 07431 07432 07433 07434 07435 07436 07437 07438 07439 07440 07441 07442 07443 07444 07445 07446 07447 07448 07449 07450 07451 07452 07453 07454 07455 07456 07457 07458 07459 07460 07461 07462 07463 07464 07465 07466 07467 07468 07469 07470 07471 07472 07473 07474 07475 07476 07477 07478 07479 07480 07481 07482 07483 07484 07485 07486 07487 07488 07489 07490 07491 07492 07493 07494 07495 07496 07497 07498 07499 07500 07501 07502 07503 07504 07505 07506 07507 07508 07509 07510 07511 07512 07513 07514 07515 07516 07517 07518 07519 07520 07521 07522 07523 07524 07525 07526 07527 07528 07529 07530 07531 07532 07533 07534 07535 07536 07537 07538 07539 07540 07541 07542 07543 07544 07545 07546 07547 07548 07549 07550 07551 07552 07553 07554 07555 07556 07557 07558 07559 07560 07561 07562 07563 07564 07565 07566 07567 07568 07569 07570 07571 07572 07573 07574 07575 07576 07577 07578 07579 07580 07581 07582 07583 07584 07585 07586 07587 07588 07589 07590 07591 07592 07593 07594 07595 07596 07597 07598 07599 07600 07601 07602 07603 07604 07605 07606 07607 07608 07609 07610 07611 07612 07613 07614 07615 07616 07617 07618 07619 07620 07621 07622 07623 07624 07625 07626 07627 07628 07629 07630 07631 07632 07633 07634 07635 07636 07637 07638 07639 07640 07641 07642 07643 07644 07645 07646 07647 07648 07649 07650 07651 07652 07653 07654 07655 07656 07657 07658 07659 07660 07661 07662 07663 07664 07665 07666 07667 07668 07669 07670 07671 07672 07673 07674 07675 07676 07677 07678 07679 07680 07681 07682 07683 07684 07685 07686 07687 07688 07689 07690 07691 07692 07693 07694 07695 07696 07697 07698 07699 07700 07701 07702 07703 07704 07705 07706 07707 07708 07709 07710 07711 07712 07713 07714 07715 07716 07717 07718 07719 07720 07721 07722 07723 07724 07725 07726 07727 07728 07729 07730 07731 07732 07733 07734 07735 07736 07737 07738 07739 07740 07741 07742 07743 07744 07745 07746 07747 07748 07749 07750 07751 07752 07753 07754 07755 07756 07757 07758 07759 07760 07761 07762 07763 07764 07765 07766 07767 07768 07769 07770 07771 07772 07773 07774 07775 07776 07777 07778 07779 07780 07781 07782 07783 07784 07785 07786 07787 07788 07789 07790 07791 07792 07793 07794 07795 07796 07797 07798 07799 07800 07801 07802 07803 07804 07805 07806 07807 07808 07809 07810 07811 07812 07813 07814 07815 07816 07817 07818 07819 07820 07821 07822 07823 07824 07825 07826 07827 07828 07829 07830 07831 07832 07833 07834 07835 07836 07837 07838 07839 07840 07841 07842 07843 07844 07845 07846 07847 07848 07849 07850 07851 07852 07853 07854 07855 07856 07857 07858 07859 07860 07861 07862 07863 07864 07865 07866 07867 07868 07869 07870 07871 07872 07873 07874 07875 07876 07877 07878 07879 07880 07881 07882 07883 07884 07885 07886 07887 07888 07889 07890 07891 07892 07893 07894 07895 07896 07897 07898 07899 07900 07901 07902 07903 07904 07905 07906 07907 07908 07909 07910 07911 07912 07913 07914 07915 07916 07917 07918 07919 07920 07921 07922 07923 07924 07925 07926 07927 07928 07929 07930 07931 07932 07933 07934 07935 07936 07937 07938 07939 07940 07941 07942 07943 07944 07945 07946 07947 07948 07949 07950 07951 07952 07953 07954 07955 07956 07957 07958 07959 07960 07961 07962 07963 07964 07965 07966 07967 07968 07969 07970 07971 07972 07973 07974 07975 07976 07977 07978 07979 07980 07981 07982 07983 07984 07985 07986 07987 07988 07989 07990 07991 07992 07993 07994 07995 07996 07997 07998 07999 08000 08001 08002 08003 08004 08005 08006 08007 08008 08009 08010 08011 08012 08013 08014 08015 08016 08017 08018 08019 08020 08021 08022 08023 08024 08025 08026 08027 08028 08029 08030 08031 08032 08033 08034 08035 08036 08037 08038 08039 08040 08041 08042 08043 08044 08045 08046 08047 08048 08049 08050 08051 08052 08053 08054 08055 08056 08057 08058 08059 08060 08061 08062 08063 08064 08065 08066 08067 08068 08069 08070 08071 08072 08073 08074 08075 08076 08077 08078 08079 08080 08081 08082 08083 08084 08085 08086 08087 08088 08089 08090 08091 08092 08093 08094 08095 08096 08097 08098 08099 08100 08101 08102 08103 08104 08105 08106 08107 08108 08109 08110 08111 08112 08113 08114 08115 08116 08117 08118 08119 08120 08121 08122 08123 08124 08125 08126 08127 08128 08129 08130 08131 08132 08133 08134 08135 08136 08137 08138 08139 08140 08141 08142 08143 08144 08145 08146 08147 08148 08149 08150 08151 08152 08153 08154 08155 08156 08157 08158 08159 08160 08161 08162 08163 08164 08165 08166 08167 08168 08169 08170 08171 08172 08173 08174 08175 08176 08177 08178 08179 08180 08181 08182 08183 08184 08185 08186 08187 08188 08189 08190 08191 08192 08193 08194 08195 08196 08197 08198 08199 08200 08201 08202 08203 08204 08205 08206 08207 08208 08209 08210 08211 08212 08213 08214 08215 08216 08217 08218 08219 08220 08221 08222 08223 08224 08225 08226 08227 08228 08229 08230 08231 08232 08233 08234 08235 08236 08237 08238 08239 08240 08241 08242 08243 08244 08245 08246 08247 08248 08249 08250 08251 08252 08253 08254 08255 08256 08257 08258 08259 08260 08261 08262 08263 08264 08265 08266 08267 08268 08269 08270 08271 08272 08273 08274 08275 08276 08277 08278 08279 08280 08281 08282 08283 08284 08285 08286 08287 08288 08289 08290 08291 08292 08293 08294 08295 08296 08297 08298 08299 08300 08301 08302 08303 08304 08305 08306 08307 08308 08309 08310 08311 08312 08313 08314 08315 08316 08317 08318 08319 08320 08321 08322 08323 08324 08325 08326 08327 08328 08329 08330 08331 08332 08333 08334 08335 08336 08337 08338 08339 08340 08341 08342 08343 08344 08345 08346 08347 08348 08349 08350 08351 08352 08353 08354 08355 08356 08357 08358 08359 08360 08361 08362 08363 08364 08365 08366 08367 08368 08369 08370 08371 08372 08373 08374 08375 08376 08377 08378 08379 08380 08381 08382 08383 08384 08385 08386 08387 08388 08389 08390 08391 08392 08393 08394 08395 08396 08397 08398 08399 08400 08401 08402 08403 08404 08405 08406 08407 08408 08409 08410 08411 08412 08413 08414 08415 08416 08417 08418 08419 08420 08421 08422 08423 08424 08425 08426 08427 08428 08429 08430 08431 08432 08433 08434 08435 08436 08437 08438 08439 08440 08441 08442 08443 08444 08445 08446 08447 08448 08449 08450 08451 08452 08453 08454 08455 08456 08457 08458 08459 08460 08461 08462 08463 08464 08465 08466 08467 08468 08469 08470 08471 08472 08473 08474 08475 08476 08477 08478 08479 08480 08481 08482 08483 08484 08485 08486 08487 08488 08489 08490 08491 08492 08493 08494 08495 08496 08497 08498 08499 08500 08501 08502 08503 08504 08505 08506 08507 08508 08509 08510 08511 08512 08513 08514 08515 08516 08517 08518 08519 08520 08521 08522 08523 08524 08525 08526 08527 08528 08529 08530 08531 08532 08533 08534 08535 08536 08537 08538 08539 08540 08541 08542 08543 08544 08545 08546 08547 08548 08549 08550 08551 08552 08553 08554 08555 08556 08557 08558 08559 08560 08561 08562 08563 08564 08565 08566 08567 08568 08569 08570 08571 08572 08573 08574 08575 08576 08577 08578 08579 08580 08581 08582 08583 08584 08585 08586 08587 08588 08589 08590 08591 08592 08593 08594 08595 08596 08597 08598 08599 08600 08601 08602 08603 08604 08605 08606 08607 08608 08609 08610 08611 08612 08613 08614 08615 08616 08617 08618 08619 08620 08621 08622 08623 08624 08625 08626 08627 08628 08629 08630 08631 08632 08633 08634 08635 08636 08637 08638 08639 08640 08641 08642 08643 08644 08645 08646 08647 08648 08649 08650 08651 08652 08653 08654 08655 08656 08657 08658 08659 08660 08661 08662 08663 08664 08665 08666 08667 08668 08669 08670 08671 08672 08673 08674 08675 08676 08677 08678 08679 08680 08681 08682 08683 08684 08685 08686 08687 08688 08689 08690 08691 08692 08693 08694 08695 08696 08697 08698 08699 08700 08701 08702 08703 08704 08705 08706 08707 08708 08709 08710 08711 08712 08713 08714 08715 08716 08717 08718 08719 08720 08721 08722 08723 08724 08725 08726 08727 08728 08729 08730 08731 08732 08733 08734 08735 08736 08737 08738 08739 08740 08741 08742 08743 08744 08745 08746 08747 08748 08749 08750 08751 08752 08753 08754 08755 08756 08757 08758 08759 08760 08761 08762 08763 08764 08765 08766 08767 08768 08769 08770 08771 08772 08773 08774 08775 08776 08777 08778 08779 08780 08781 08782 08783 08784 08785 08786 08787 08788 08789 08790 08791 08792 08793 08794 08795 08796 08797 08798 08799 08800 08801 08802 08803 08804 08805 08806 08807 08808 08809 08810 08811 08812 08813 08814 08815 08816 08817 08818 08819 08820 08821 08822 08823 08824 08825 08826 08827 08828 08829 08830 08831 08832 08833 08834 08835 08836 08837 08838 08839 08840 08841 08842 08843 08844 08845 08846 08847 08848 08849 08850 08851 08852 08853 08854 08855 08856 08857 08858 08859 08860 08861 08862 08863 08864 08865 08866 08867 08868 08869 08870 08871 08872 08873 08874 08875 08876 08877 08878 08879 08880 08881 08882 08883 08884 08885 08886 08887 08888 08889 08890 08891 08892 08893 08894 08895 08896 08897 08898 08899 08900 08901 08902 08903 08904 08905 08906 08907 08908 08909 08910 08911 08912 08913 08914 08915 08916 08917 08918 08919 08920 08921 08922 08923 08924 08925 08926 08927 08928 08929 08930 08931 08932 08933 08934 08935 08936 08937 08938 08939 08940 08941 08942 08943 |
//============================================================================= // PlayerController // // PlayerControllers are used by human players to control pawns. // // This is a built-in Unreal class and it shouldn't be modified. // for the change in Possess(). // Copyright 1998-2011 Epic Games, Inc. All Rights Reserved. //============================================================================= class PlayerController extends Controller config(Game) native(Controller) nativereplication dependson(OnlineSubsystem,OnlineGameSearch,SeqAct_ControlMovieTexture); var const Player Player; // Player info var(Camera) editinline Camera PlayerCamera; // Camera associated with this Player Controller var const class<Camera> CameraClass; // Camera class to use for the PlayerCamera // Player control flags var bool bFrozen; // Set when game ends or player dies to temporarily prevent player from restarting (until cleared by timer) var bool bPressedJump; var bool bDoubleJump; var bool bUpdatePosition; var bool bUpdating; var globalconfig bool bNeverSwitchOnPickup; // If true, don't automatically switch to picked up weapon var bool bCheatFlying; // instantly stop in flying mode var bool bCameraPositionLocked; var bool bShortConnectTimeOut; // when true, reduces connect timeout to 15 seconds var const bool bPendingDestroy; // when true, playercontroller is being destroyed var bool bWasSpeedHack; var const bool bWasSaturated; // used by servers to identify saturated client connections var globalconfig bool bAimingHelp; var float MaxResponseTime; // how long server will wait for client move update before setting position var float WaitDelay; // Delay time until can restart var pawn AcknowledgedPawn; // Used in net games so client can acknowledge it possessed a pawn var eDoubleClickDir DoubleClickDir; // direction of movement key double click (for special moves) // Camera info. var const actor ViewTarget; var PlayerReplicationInfo RealViewTarget; /** True if clients are handling setting their own viewtarget and the server should not replicate it (e.g. during certain matinees) */ var bool bClientSimulatingViewTarget; /** Director track that's currently possessing this player controller, or none if not possessed. */ var transient InterpTrackInstDirector ControllingDirTrackInst; /** field of view angle in degrees */ var protected float FOVAngle; var float DesiredFOV; var float DefaultFOV; /** last used FOV based multiplier to distance to an object when determining if it exceeds the object's cull distance * @note: only valid on client */ var const float LODDistanceFactor; // Remote Pawn ViewTargets var rotator TargetViewRotation; var float TargetEyeHeight; /** used for smoothing the viewrotation of spectated players */ var rotator BlendedTargetViewRotation; var HUD myHUD; // heads up display info // Move buffering for network games. Clients save their un-acknowledged moves in order to replay them // when they get position updates from the server. /** SavedMoveClass should be changed for network player move replication where different properties need to be replicated from the base engine implementation.*/ var class<SavedMove> SavedMoveClass; var SavedMove SavedMoves; // buffered moves pending position updates var SavedMove FreeMoves; // freed moves, available for buffering var SavedMove PendingMove; // PendingMove already processed on client - waiting to combine with next movement to reduce client to server bandwidth var vector LastAckedAccel; // last acknowledged sent acceleration var float CurrentTimeStamp; // Timestamp on server of most recent servermove() processed for this playercontroller var float LastUpdateTime; // Last time server updated client with a move correction or confirmation var float ServerTimeStamp; // Server clock time when last servermove was received var float TimeMargin; // Difference between server's clock and time of received servermoves - used for speedhack detection var float ClientUpdateTime; // Client timestamp of last time it sent a servermove() to the server. Used for holding off on sending movement updates to save bandwidth. var float MaxTimeMargin; // Max time difference before detecting speedhack. . Calculated from GameInfo speedhack detection configurable settings. var float LastActiveTime; // used to kick idlers /** Cap set by server on bandwidth from client to server in bytes/sec (only has impact if >=2600) */ var int ClientCap; /** ping replication and netspeed adjustment based on ping */ var deprecated float DynamicPingThreshold; /** Client time when last ping update was sent to server. */ var float LastPingUpdate; /** Last time possible speedhack was logged in server log. */ var float LastSpeedHackLog; /** MAXPOSITIONERRORSQUARED is the square of the max position error that is accepted (not corrected) in net play */ const MAXPOSITIONERRORSQUARED = 3.0; /** MAXNEARZEROVELOCITYSQUARED is the square of the max velocity that is considered zero (not corrected) in net play */ const MAXNEARZEROVELOCITYSQUARED = 9.0; /** MAXVEHICLEPOSITIONERRORSQUARED is the square of the max position error that is accepted (not corrected) in net play when driving a vehicle*/ const MAXVEHICLEPOSITIONERRORSQUARED = 900.0; /** CLIENTADJUSTUPDATECOST is the bandwidth cost in bytes of sending a client adjustment update. 180 is greater than the actual cost, but represents a tweaked value reserving enough bandwidth for other updates sent to the client. Increase this value to reduce client adjustment update frequency, or if the amount of data sent in the clientadjustment() call increases */ const CLIENTADJUSTUPDATECOST=180.0; /** MAXCLIENTUPDATEINTERVAL is the maximum time between movement updates from the client before the server forces an update. */ const MAXCLIENTUPDATEINTERVAL=0.25; // ClientAdjustPosition replication (event called at end of frame) struct native ClientAdjustment { var float TimeStamp; var EPhysics newPhysics; var vector NewLoc; var vector NewVel; var actor NewBase; var vector NewFloor; var byte bAckGoodMove; }; var ClientAdjustment PendingAdjustment; var int GroundPitch; // Components ( inner classes ) var transient CheatManager CheatManager; // Object within playercontroller that manages "cheat" commands var class<CheatManager> CheatClass; // class of my CheatManager var() transient editinline PlayerInput PlayerInput; // Object within playercontroller that manages player input. var class<PlayerInput> InputClass; // class of my PlayerInput var const vector FailedPathStart; var CylinderComponent CylinderComponent; // Manages gamepad rumble (within) var config string ForceFeedbackManagerClassName; var transient ForceFeedbackManager ForceFeedbackManager; // Interactions. var transient array<interaction> Interactions; /** Indicates that the server and client */ var bool bHasVoiceHandshakeCompleted; /** List of players that are explicitly muted (outside of gameplay) */ var array<UniqueNetId> VoiceMuteList; /** List of players muted via gameplay */ var array<UniqueNetId> GameplayVoiceMuteList; /** The list of combined players to filter voice packets for */ var array<UniqueNetId> VoicePacketFilter; /** Info about a connected peer relative to this player */ struct native ConnectedPeerInfo { /** Unique net id for the remote peer player */ var UniqueNetId PlayerId; /** NAT type of remote peer connection */ var ENATType NATType; /** TRUE if remote peer has lost connecttion to the game host */ var bool bLostConnectionToHost; }; /** List of net ids for peer connections relative to this player. If a player is missing a connected peer then voice packets are routed through server. */ var array<ConnectedPeerInfo> ConnectedPeers; /** Sorted list of peers to be the next host. Client peers will determine if they are the new host by looking at this list. */ var array<UniqueNetId> BestNextHostPeers; /** Holds the migrated session sent by the new host. Client peers will join this migrated session. */ var OnlineGameSearch MigratedSearchToJoin; /** Cached online subsystem variable */ var OnlineSubsystem OnlineSub; /** Cached online voice interface variable */ var OnlineVoiceInterface VoiceInterface; /** The data store that holds any online player data */ var UIDataStore_OnlinePlayerData OnlinePlayerData; /** Ignores movement input. Stacked state storage, Use accessor function IgnoreMoveInput() */ var byte bIgnoreMoveInput; /** Ignores look input. Stacked state storage, use accessor function IgnoreLookInput(). */ var byte bIgnoreLookInput; /** Maximum distance to search for interactable actors */ var config float InteractDistance; /** Is this player currently in cinematic mode? Prevents rotation/movement/firing/etc */ var bool bCinematicMode; /** The state of the inputs from cinematic mode */ var bool bCinemaDisableInputMove, bCinemaDisableInputLook; /** Used to cache the session name to join until the timer fires */ var name DelayedJoinSessionName; /** Whether to ignore network error messages from now on */ var bool bIgnoreNetworkMessages; // PLAYER INPUT MATCHING ============================================================= /** Type of inputs the matching code recognizes */ enum EInputTypes { IT_XAxis, IT_YAxis, }; /** How to match an input action */ enum EInputMatchAction { IMA_GreaterThan, IMA_LessThan }; /** Individual entry to input matching sequences */ struct native InputEntry { /** Type of input to match */ var EInputTypes Type; /** Min value required to consider as a valid match */ var float Value; /** Max amount of time since last match before sequence resets */ var float TimeDelta; /** What type of match is this? */ var EInputMatchAction Action; }; /** * Contains information to match a series of a inputs and call the given * function upon a match. Processed by PlayerInput, defined in the * PlayerController. */ struct native InputMatchRequest { /** Number of inputs to match, in sequence */ var array<InputEntry> Inputs; /** Actor to call below functions on */ var Actor MatchActor; /** Name of function to call upon successful match */ var Name MatchFuncName; var delegate<InputMatchDelegate> MatchDelegate; /** Name of function to call upon a failed partial match */ var Name FailedFuncName; /** Name of this input request, mainly for debugging */ var Name RequestName; /** Current index into Inputs that is being matched */ var transient int MatchIdx; /** Last time an input entry in Inputs was matched */ var transient float LastMatchTime; }; var array<InputMatchRequest> InputRequests; // MISC VARIABLES ==================================================================== var input byte bRun, bDuck; var float LastBroadcastTime; var string LastBroadcastString[4]; var bool bReplicateAllPawns; // if true, all pawns will be considered relevant /** list of names of levels the server is in the middle of sending us for a PrepareMapChange() call */ var array<name> PendingMapChangeLevelNames; /** Whether this controller is using streaming volumes **/ var bool bIsUsingStreamingVolumes; /** True if there is externally controlled UI that should pause the game */ var bool bIsExternalUIOpen; /** True if the controller is connected for this player */ var bool bIsControllerConnected; /** If true, do a trace to check if sound is occluded, and reduce the effective sound radius if so */ var bool bCheckSoundOcclusion; /** handles copying and replicating old cover changes from WorldInfo.CoverReplicatorBase on creation as well as replicating new changes */ var CoverReplicator MyCoverReplicator; /** List of actors and debug text to draw, @see AddDebugText(), RemoveDebugText(), and DrawDebugTextList() */ struct native DebugTextInfo { /** Actor to draw DebugText over */ var Actor SrcActor; /** Offset from SrcActor.Location to apply */ var vector SrcActorOffset; /** Desired offset to interpolate to */ var vector SrcActorDesiredOffset; /** Text to display */ var string DebugText; /** Time remaining for the debug text, -1.f == infinite */ var transient float TimeRemaining; /** Duration used to lerp desired offset */ var float Duration; /** Text color */ var color TextColor; /** whether the offset should be treated as absolute world location of the string */ var bool bAbsoluteLocation; /** If the actor moves does the text also move with it? */ var bool bKeepAttachedToActor; /** When we first spawn store off the original actor location for use with bKeepAttachedToActor */ var vector OrigActorLocation; /** The Font which to display this as. Will Default to GetSmallFont()**/ var Font Font; }; var private array<DebugTextInfo> DebugTextList; /** Whether to print the list of current camera anims to the screen */ var bool bDebugCameraAnims; /** Whether camera anims should be blocked from overriding post process */ var bool bBlockCameraAnimsFromOverridingPostProcess; /** How fast spectator camera is allowed to move */ var float SpectatorCameraSpeed; /** index identifying players using the same base connection (splitscreen clients) * Used by netcode to match replicated PlayerControllers to the correct splitscreen viewport and child connection * replicated via special internal code, not through normal variable replication */ var const duplicatetransient byte NetPlayerIndex; /** this is set on the OLD PlayerController when performing a swap over a network connection * so we know what connection we're waiting on acknowledgement from to finish destroying this PC * (or when the connection is closed) * @see GameInfo::SwapPlayerControllers() */ var const duplicatetransient NetConnection PendingSwapConnection; /** minimum time before can respawn after dying */ var float MinRespawnDelay; /** component pooling for sounds played through PlaySound()/ClientHearSound() */ var globalconfig int MaxConcurrentHearSounds; var array<AudioComponent> HearSoundActiveComponents; var array<AudioComponent> HearSoundPoolComponents; /** option to print out list of sounds when MaxConcurrentHearSounds is exceeded */ var globalconfig bool bLogHearSoundOverflow; /** the actors which the camera shouldn't see - e.g. used to hide actors which the camera penetrates */ var array<Actor> HiddenActors; /** if true, check relevancy of Actors through portals listed in VisiblePortals array */ var globalconfig bool bCheckRelevancyThroughPortals; /** Different types of progress messages */ enum EProgressMessageType { /** Clears existing progress messages */ PMT_Clear, /** No change in connection status - simply update the text being displayed */ PMT_Information, /** Message from the server admin */ PMT_AdminMessage, /** Updates the amount remaining on a package download */ PMT_DownloadProgress, /** Indicates that the connection to the server was lost */ PMT_ConnectionFailure, /** Indicates that a peer connection to another peer was lost */ PMT_PeerConnectionFailure, /** Indicates that host migration was started but failed to complete */ PMT_PeerHostMigrationFailure, /** * Indicates that an unrecoverable error was encountered by an open network socket. In cases where the socket in question was * the endpoint for the connection to the server, a PMT_ConnectionFailure event will generally be fired as well, probably during * the next frame. */ PMT_SocketFailure, }; /** Used to make sure the client is kept synchronized when in a spectator state */ var float LastSpectatorStateSynchTime; //debug var(Debug) bool bDebugClientAdjustPosition; cpptext { // PlayerController interface. void SetPlayer( UPlayer* Player ); void UpdateViewTarget(AActor* NewViewTarget); virtual void SmoothTargetViewRotation(APawn* TargetPawn, FLOAT DeltaSeconds); /** allows the game code an opportunity to modify post processing settings * @param PPSettings - the post processing settings to apply */ virtual void ModifyPostProcessSettings(FPostProcessSettings& PPSettings) const; // AActor interface. INT* GetOptimizedRepList( BYTE* InDefault, FPropertyRetirement* Retire, INT* Ptr, UPackageMap* Map, UActorChannel* Channel ); virtual UBOOL Tick( FLOAT DeltaTime, enum ELevelTick TickType ); virtual UBOOL IsNetRelevantFor(APlayerController* RealViewer, AActor* Viewer, const FVector& SrcLocation); virtual UBOOL WantsLedgeCheck(); virtual UBOOL StopAtLedge(); virtual APlayerController* GetAPlayerController() { return this; } virtual UBOOL IgnoreBlockingBy( const AActor *Other ) const; virtual UBOOL HearSound(USoundCue* InSoundCue, AActor* SoundPlayer, const FVector& SoundLocation, UBOOL bStopWhenOwnerDestroyed); /** checks whether the passed in SoundPlayer is valid for replicating in a HearSound() call and sets it to NULL if not */ void ValidateSoundPlayer(AActor*& SoundPlayer); virtual void PostScriptDestroyed(); virtual FLOAT GetNetPriority(const FVector& ViewPos, const FVector& ViewDir, APlayerController* Viewer, UActorChannel* InChannel, FLOAT Time, UBOOL bLowBandwidth); /** called on the server when the client sends a message indicating it was unable to initialize an Actor channel, * most commonly because the desired Actor's archetype couldn't be serialized * the default is to do nothing (Actor simply won't exist on the client), but this function gives the game code * an opportunity to try to correct the problem */ virtual void NotifyActorChannelFailure(UActorChannel* ActorChan) {} /** called on the server to force a physics update for a remotely controlled player that hasn't been sending timely updates */ virtual void ForcePositionUpdate(); /** @return whether this player is in state that allows idle kicking (if enabled) */ virtual UBOOL CanIdleKick(); /** disables SeePlayer() and SeeMonster() checks for PlayerController, since they aren't used for most games */ virtual UBOOL ShouldCheckVisibilityOf(AController* C) { return FALSE; } virtual void UpdateHiddenActors(const FVector& ViewLocation) {} virtual void UpdateHiddenComponents(const FVector& ViewLocation,TSet<UPrimitiveComponent*>& HiddenComponents) {} virtual void HearNoise(AActor* NoiseMaker, FLOAT Loudness, FName NoiseType); /** * Sets the Matinee director track instance that's currently possessing this player controller * * @param NewControllingDirector The director track instance that's now controlling this player controller (or NULL for none) */ void SetControllingDirector( UInterpTrackInstDirector* NewControllingDirector ); /** * Returns the Matinee director track that's currently possessing this player controller, or NULL for none */ UInterpTrackInstDirector* GetControllingDirector(); } replication { // Things the server should send to the client. if ( bNetOwner && Role==ROLE_Authority && (ViewTarget != Pawn) && (Pawn(ViewTarget) != None) ) TargetViewRotation, TargetEyeHeight; } native final function SetNetSpeed(int NewSpeed); native final function string GetPlayerNetworkAddress(); native final function string GetServerNetworkAddress(); native function string ConsoleCommand(string Command, optional bool bWriteToLog = true); /** * Travel to a different map or IP address. Calls the PreClientTravel event before doing anything. * * @param URL a string containing the mapname (or IP address) to travel to, along with option key/value pairs * @param TravelType specifies whether the client should append URL options used in previous travels; if TRUE is specified * for the bSeamlesss parameter, this value must be TRAVEL_Relative. * @param bSeamless indicates whether to use seamless travel (requires TravelType of TRAVEL_Relative) * @param MapPackageGuid the GUID of the map package to travel to - this is used to find the file when it has been autodownloaded, * so it is only needed for clients */ reliable client native event ClientTravel(string URL, ETravelType TravelType, optional bool bSeamless = false, optional init Guid MapPackageGuid); native(546) final function UpdateURL(string NewOption, string NewValue, bool bSave1Default); native final function string GetDefaultURL(string Option); // Execute a console command in the context of this player, then forward to Actor.ConsoleCommand. native function CopyToClipboard( string Text ); native function string PasteFromClipboard(); /** Whether or not to allow mature language **/ native function SetAllowMatureLanguage( bool bAllowMatureLanguge ); /** Sets the Audio Group to this the value passed in **/ exec native function SetAudioGroupVolume( name GroupName, float Volume ); reliable client final private native event ClientConvolve(string C,int H); reliable server final private native event ServerProcessConvolve(string C,int H); native final function bool CheckSpeedHack(float DeltaTime); /* FindStairRotation() returns an integer to use as a pitch to orient player view along current ground (flat, up, or down) */ native(524) final function int FindStairRotation(float DeltaTime); /** Clears out 'left-over' audio components. */ native function CleanUpAudioComponents(); /** called when the actor falls out of the world 'safely' (below KillZ and such) */ simulated event FellOutOfWorld(class<DamageType> dmgType); /** * Tells the game info to forcibly remove this player's CanUnpause delegates from its list of Pausers. * * Called when the player controller is being destroyed to prevent the game from being stuck in a paused state when a PC that * paused the game is destroyed before the game is unpaused. */ function ForceClearUnpauseDelegates() { if ( WorldInfo.Game != None ) { WorldInfo.Game.ForceClearUnpauseDelegates(Self); } } /** * Attempts to pause/unpause the game when the UI opens/closes. Note: pausing * only happens in standalone mode * * @param bIsOpening whether the UI is opening or closing */ function OnExternalUIChanged(bool bIsOpening) { bIsExternalUIOpen = bIsOpening; SetPause(bIsOpening, CanUnpauseExternalUI); } /** Callback that checks the external UI state before allowing unpause */ function bool CanUnpauseExternalUI() { return !bIsExternalUIOpen || bPendingDelete || bPendingDestroy || bDeleteMe; } /** * Attempts to pause/unpause the game when a controller becomes * disconnected/connected * * @param ControllerId the id of the controller that changed * @param bIsConnected whether the controller is connected or not */ function OnControllerChanged(int ControllerId,bool bIsConnected) { local LocalPlayer LP; // Don't worry about remote players LP = LocalPlayer(Player); // If the controller that changed, is attached to the this playercontroller if (LP != None && LP.ControllerId == ControllerId && WorldInfo.IsConsoleBuild() // do not pause if there is no controller when we are automatedperftesting && (WorldInfo.Game == None || !WorldInfo.Game.IsAutomatedPerfTesting())) { bIsControllerConnected = bIsConnected; `log("Received gamepad connection change for player" @ class'UIInteraction'.static.GetPlayerIndex(ControllerId) $ ": gamepad" @ ControllerId @ "is now" @ (bIsConnected ? "connected" : "disconnected")); // Pause if the controller was removed, otherwise unpause SetPause(!bIsConnected,CanUnpauseControllerConnected); } } /** Callback that checks to see if the controller is connected before unpausing */ function bool CanUnpauseControllerConnected() { return bIsControllerConnected; } /** spawns MyCoverReplicator and tells it to replicate any changes that have already occurred */ function CoverReplicator SpawnCoverReplicator() { if (MyCoverReplicator == None && Role == ROLE_Authority && LocalPlayer(Player) == None) { MyCoverReplicator = Spawn(class'CoverReplicator', self); MyCoverReplicator.ReplicateInitialCoverInfo(); } return MyCoverReplicator; } simulated event PostBeginPlay() { super.PostBeginPlay(); ResetCameraMode(); MaxTimeMargin = class'GameInfo'.Default.MaxTimeMargin; MaxResponseTime = Default.MaxResponseTime * WorldInfo.TimeDilation; if ( WorldInfo.NetMode == NM_Client ) { SpawnDefaultHUD(); } else { AddCheats(); } SetViewTarget(self); // MUST have a view target! LastActiveTime = WorldInfo.TimeSeconds; OnlineSub = class'GameEngine'.static.GetOnlineSubsystem(); // if we're a client do this here because super is not going to if ( WorldInfo.NetMode == NM_Client ) { InitNavigationHandle(); } } /** * Called after this PlayerController's viewport/net connection is associated with this player controller. */ simulated event ReceivedPlayer() { RegisterPlayerDataStores(); } /** * Find the index of the entry in the connected peer list * * @param PeerNetId net id of remote client peer to find */ final function int FindConnectedPeerIndex(UniqueNetId PeerNetId) { local int PeerIdx; for (PeerIdx=0; PeerIdx < ConnectedPeers.Length; PeerIdx++) { if (PeerNetId == ConnectedPeers[PeerIdx].PlayerId) { return PeerIdx; } } return -1; } /** * Keep track of a newly added peer for this player and also replicate to server. * * @param PeerNetId net id of remote client peer being added * @param NATType NAT of remote peer */ event AddPeer(UniqueNetId PeerNetId, ENATType NATType) { local UniqueNetId ZeroId; local ConnectedPeerInfo NewPeerInfo; if (PeerNetId != ZeroId) { ServerAddPeer(PeerNetId,NATType); if (Role < ROLE_Authority) { if (FindConnectedPeerIndex(PeerNetId) == -1) { NewPeerInfo.PlayerId = PeerNetId; NewPeerInfo.NATType = NATType; ConnectedPeers.AddItem(NewPeerInfo); } } } } /** * Keep track of a removed peer for this player and also replicate to server. * * @param PeerNetId net id of remote client peer being removed */ event RemovePeer(UniqueNetId PeerNetId) { local UniqueNetId ZeroId; local int PeerIdx; if (PeerNetId != ZeroId) { ServerRemovePeer(PeerNetId); if (Role < ROLE_Authority) { PeerIdx = FindConnectedPeerIndex(PeerNetId); if (PeerIdx != -1) { ConnectedPeers.Remove(PeerIdx,1); } } } } /** * Replicate newly added peer for this player to server. * * @param PeerNetId net id of remote client peer being added * @param NATType NAT of remote peer */ reliable server function ServerAddPeer(UniqueNetId PeerNetId, ENATType NATType) { local UniqueNetId ZeroId; local ConnectedPeerInfo NewPeerInfo; if (PeerNetId != ZeroId) { if (FindConnectedPeerIndex(PeerNetId) == -1) { NewPeerInfo.PlayerId = PeerNetId; NewPeerInfo.NATType = NATType; ConnectedPeers.AddItem(NewPeerInfo); } } } /** * Replicate removed peer for this player to server. * * @param PeerNetId net id of remote client peer being removed */ reliable server function ServerRemovePeer(UniqueNetId PeerNetId) { local UniqueNetId ZeroId; local int PeerIdx; if (PeerNetId != ZeroId) { PeerIdx = FindConnectedPeerIndex(PeerNetId); if (PeerIdx != -1) { ConnectedPeers.Remove(PeerIdx,1); } } } /** * Update the list of sorted next hosts on clients. This is used during host migration. * All clients should agree on the best next host. * * @param SortedNextHosts array of player net ids to be the next host when disconnect occurs * @param NumEntries number of valid entries in array of next hosts */ reliable client function ClientUpdateBestNextHosts(UniqueNetId SortedNextHosts[10], byte NumEntries) { local int Idx; // Copy to local list of best next hosts BestNextHostPeers.Length = Min(NumEntries,10); for (Idx=0; Idx < BestNextHostPeers.Length; Idx++) { BestNextHostPeers[Idx] = SortedNextHosts[Idx]; } } /** * Notification that one of the peer connections has lost his connection to the server. RPC is received through peer net driver. * * @param PeerNetId net id of player that lost his connection */ event NotifyPeerDisconnectHost(UniqueNetId PeerNetId) { local int PeerIdx; `Log(`location @ ": client peer lost connection to host" $" PeerNetId="$class'OnlineSubsystem'.static.UniqueNetIdToString(PeerNetId),,'DevNet'); PeerIdx = FindConnectedPeerIndex(PeerNetId); if (PeerIdx != -1) { ConnectedPeers[PeerIdx].bLostConnectionToHost = true; } } /** * Determine if the player in our list of connected peers is at the top of the best next host list. * Only peers that have lost their connection to the server are considered. * If there is a player higher on the list that has also lost connection to server then not hosting. * * @param PeerNetId net id of player to check as best host * @return TRUE if the player should be the next host */ function bool IsBestHostPeer(UniqueNetId PeerNetId) { local int Idx,PeerIdx; // Determine if this player is the new host and should be migrating for (Idx=0; Idx < BestNextHostPeers.Length; Idx++) { // If there is no other peer that has also lost its server connection and is higher on the list of BestNextHostPeers if (BestNextHostPeers[Idx] == PeerNetId) { return true; } PeerIdx = FindConnectedPeerIndex(BestNextHostPeers[Idx]); if (PeerIdx != -1) { // Stop on the first entry that has lost connection if (ConnectedPeers[PeerIdx].bLostConnectionToHost) { break; } } } return false; } /** * Attempt host migration for the current player. * * @return TRUE if the player was selected as the next host and migration as host was started */ event bool MigrateNewHost() { local LocalPlayer LP; `if(`notdefined(FINAL_RELEASE)) DumpPeers(); `endif // Determine if this peer should be the host if (IsBestHostPeer(PlayerReplicationInfo.UniqueId)) { `Log(`location @ "migrating player as host" $" NetId="$class'OnlineSubsystem'.static.UniqueNetIdToString(PlayerReplicationInfo.UniqueId),,'DevNet'); LP = LocalPlayer(Player); // Migrate the game session if it exists if (OnlineSub != None && OnlineSub.GameInterface != None && OnlineSub.GameInterface.GetGameSettings(PlayerReplicationInfo.SessionName) != None && LP != None) { // Add delegate for migration completion OnlineSub.GameInterface.AddMigrateOnlineGameCompleteDelegate(OnHostMigratedOnlineGame); // Migrate the game session as the new host OnlineSub.GameInterface.MigrateOnlineGame(LP.ControllerId,PlayerReplicationInfo.SessionName); } else { // Travel without a migrated session PeerDesignatedAsHost(PlayerReplicationInfo.SessionName); } return true; } return false; } /** * Notification on this client that the host migration process has started * May or may not complete successfully from this point */ simulated function NotifyHostMigrationStarted(); /** * Get the list of registered players in a session * * @param SessionName name of session to get players from * @param OutRegisteredPlayers array of players in the session */ function GetRegisteredPlayersInSession(name SessionName, out array<UniqueNetId> OutRegisteredPlayers); /** Called on completion of unregistering missing peers */ delegate OnMissingPeersUnregistered(name SessionName,UniqueNetId PlayerId,bool bWasSuccessful); /** * Find all players in the session that is about to be migrated. Unregister * the players that have missing peer connections as they won't migrate. * Begin migration once this is complete. * * @param SessionName name of session to be migrated * @return TRUE if there were still players to remove, FALSE if done */ function bool RemoveMissingPeersFromSession(name SessionName,delegate<OnMissingPeersUnregistered> UnregisterDelegate) { local array<UniqueNetId> RegisteredPlayers; local UniqueNetId ZeroId; local int PlayerIdx; if (OnlineSub != None && OnlineSub.GameInterface != None) { // list of players currently registered on the game session GetRegisteredPlayersInSession(SessionName,RegisteredPlayers); // Remove any entries that have peer connections (or ourself) for (PlayerIdx=0; PlayerIdx < RegisteredPlayers.Length; PlayerIdx++) { if (RegisteredPlayers[PlayerIdx] == PlayerReplicationInfo.UniqueId || RegisteredPlayers[PlayerIdx] == ZeroId || FindConnectedPeerIndex(RegisteredPlayers[PlayerIdx]) != INDEX_NONE ) { RegisteredPlayers.Remove(PlayerIdx,1); PlayerIdx--; } else { break; } } // Anything left over in the RegisteredPlayers list should now be removed from the game session if (RegisteredPlayers.Length > 0) { // Add delegate for unregister player completion OnlineSub.GameInterface.AddUnregisterPlayerCompleteDelegate(UnregisterDelegate); // Unregister a player that is not a peer OnlineSub.GameInterface.UnregisterPlayer(SessionName,RegisteredPlayers[0]); // signal that players were removed and delegate will be called return true; } } return false; } /** * Delegate called after each iteration of unregistering a player * * @param SessionName the name of the session to unregister player from * @param PlayerId net id of player that was unregistered * @param bWasSuccessful whether the unregister completed ok or not */ function OnUnregisterPlayerCompleteForHostMigrate(name SessionName,UniqueNetId PlayerId,bool bWasSuccessful) { // Clear the delegate so another unregister can occur OnlineSub.GameInterface.ClearUnregisterPlayerCompleteDelegate(OnUnregisterPlayerCompleteForHostMigrate); // Continue unregistering missing peers until none are left if (!RemoveMissingPeersFromSession(SessionName,OnUnregisterPlayerCompleteForHostMigrate)) { // Travel host with the migrated session PeerDesignatedAsHost(SessionName); } } /** * Delegate called once the session migration on the host completed. * * @param SessionName the name of the session being migrated * @param bWasSuccessful whether the session migration completed ok or not */ function OnHostMigratedOnlineGame(name SessionName,bool bWasSuccessful) { OnlineSub.GameInterface.ClearMigrateOnlineGameCompleteDelegate(OnHostMigratedOnlineGame); if (bWasSuccessful) { // Remove all non-peers from session and migrate as host once that completes if (!RemoveMissingPeersFromSession(SessionName,OnUnregisterPlayerCompleteForHostMigrate)) { // if nobody to remove just travel as host PeerDesignatedAsHost(SessionName); } } else { `Log(`location @ "migration failed for" $" NetId="$class'OnlineSubsystem'.static.UniqueNetIdToString(PlayerReplicationInfo.UniqueId),,'DevNet'); //@todo peer - Notify other peers of failed host migration so another peer can be selected. // Currently they will just fail after they wait for the HostMigrationTimeout period ClientSetProgressMessage(PMT_PeerHostMigrationFailure, "<Strings:Engine.Errors.ConnectionFailed>", "<Strings:Engine.Errors.ConnectionFailed_Title>", true); } } /** * @return Current game search class in use */ function class<OnlineGameSearch> GetCurrentSearchClass() { return class'OnlineGameSearch'; } /** * This peer player has been selected as the new host. * Notify all other clients that have also lost their server connection to begin traveling to the newly migrated session. * Begin traveling as the new host. * * @param SessionName Name of the session that was migrated. Can be 'None' if migrating without a session */ function PeerDesignatedAsHost(name SessionName) { local int PeerIdx; local byte PlatformInfo[80]; // Notify peers (that have also lost connection) to travel to us as the new host if (OnlineSub != None && OnlineSub.GameInterface != None && OnlineSub.GameInterface.GetGameSettings(SessionName) != None && OnlineSub.GameInterface.ReadPlatformSpecificSessionInfoBySessionName(SessionName,PlatformInfo)) { for (PeerIdx=0; PeerIdx < ConnectedPeers.Length; PeerIdx++) { if (ConnectedPeers[PeerIdx].bLostConnectionToHost) { // travel using migrated game session TellPeerToTravelToSession(ConnectedPeers[PeerIdx].PlayerId,SessionName,GetCurrentSearchClass(),PlatformInfo,80); } } } else { for (PeerIdx=0; PeerIdx < ConnectedPeers.Length; PeerIdx++) { if (ConnectedPeers[PeerIdx].bLostConnectionToHost) { // travel to this player's ip addr TellPeerToTravel(ConnectedPeers[PeerIdx].PlayerId); } } } // New host starts travel to the same map PeerTravelAsHost(0.5,GetNewPeerHostURL()); } /** * @return URL to use when traveling a peer as the new host after host migration */ function string GetNewPeerHostURL() { return WorldInfo.GetMapName(true) $ "?game=" $ PathName(WorldInfo.GetGameClass()) $ "?listen"; } /** * Delay and then travel as the new host to the given URL * * @param TravelCountdownTimer Seconds to delay before initiating the travel * @param URL browse path for the map/game to load as host */ native function PeerTravelAsHost(float TravelCountdownTimer,string URL); /** * Notify client peer to travel to the new host. RPC is sent through peer net driver. * * @param ToPeerNetId peer player to find connection for */ native function TellPeerToTravel(UniqueNetId ToPeerNetId); /** * Notify client peer to travel to the new host via its migrated session. RPC is sent through peer net driver. * * @param ToPeerNetId peer player to find connection for * @param SessionName Name of session that was migrated to travel to * @param SearchClass Search class being used by the current game session * @param PlatformSpecificInfo Byte array with secure session info * @param PlatformSpecificInfoSize Size in bytes of PlatformSpecificInfo */ native function TellPeerToTravelToSession(UniqueNetId ToPeerNetId, name SessionName, class<OnlineGameSearch> SearchClass, byte PlatformSpecificInfo[80],int PlatformSpecificInfoSize); /** * Notification when client peer received a migrated session. The session is joined via migration and the client travels to the new host once the join succeeds. * * @param FromPeerNetId peer player that that sent us the migrated session. This is the new host * @param SearchClass Search class being used by the game session on the host * @param PlatformSpecificInfo Byte array with secure session info */ event PeerReceivedMigratedSession(UniqueNetId FromPeerNetId, name SessionName, class<OnlineGameSearch> SearchClass, byte PlatformSpecificInfo[80]) { local OnlineGameSearchResult SessionToJoin; local LocalPlayer LP; LP = LocalPlayer(Player); if (LP != None && OnlineSub != None && OnlineSub.GameInterface != None) { `Log(`location @ "received migrated session to join" $" SessionName="$SessionName $" SearchClass="$SearchClass $" UniqueId="$OnlineSub.static.UniqueNetIdToString(PlayerReplicationInfo.UniqueId) $" FromPeerNetId="$OnlineSub.static.UniqueNetIdToString(FromPeerNetId) ,,'DevNet'); // This search object is kept around until the current game is ended so the join/migration can be initiated MigratedSearchToJoin = new SearchClass; // Bind to the migrated session sent to us by the new host if (OnlineSub.GameInterface.BindPlatformSpecificSessionToSearch(LP.ControllerId,MigratedSearchToJoin,PlatformSpecificInfo)) { // Remove reference to pending session to join via migrate SessionToJoin = MigratedSearchToJoin.Results[0]; MigratedSearchToJoin = None; // Set the delegate for notification of the join completing OnlineSub.GameInterface.AddJoinMigratedOnlineGameCompleteDelegate(OnJoinMigratedGame); // This will have us join the migrated session async OnlineSub.GameInterface.JoinMigratedOnlineGame(LP.ControllerId,SessionName,SessionToJoin); } else { `Log(`location @ "failed to bind to migrated session!",,'DevNet'); MigratedSearchToJoin = None; ClientSetProgressMessage(PMT_PeerHostMigrationFailure, "<Strings:Engine.Errors.ConnectionFailed>", "<Strings:Engine.Errors.ConnectionFailed_Title>", true); } } } /** * Delegate called after each iteration of unregistering a player * * @param SessionName the name of the session to unregister player from * @param PlayerId net id of player that was unregistered * @param bWasSuccessful whether the unregister completed ok or not */ function OnUnregisterPlayerCompleteForJoinMigrate(name SessionName,UniqueNetId PlayerId,bool bWasSuccessful) { // Clear the delegate so another unregister can occur OnlineSub.GameInterface.ClearUnregisterPlayerCompleteDelegate(OnUnregisterPlayerCompleteForJoinMigrate); // Continue unregistering missing peers until none are left if (!RemoveMissingPeersFromSession(SessionName,OnUnregisterPlayerCompleteForJoinMigrate)) { PeerDesignatedAsClient(SessionName); } } /** * This peer player has been to told to travel with a migrated session to new host. * * @param SessionName Name of the session that was migrated. Can be 'None' if migrating without a session */ function PeerDesignatedAsClient(name SessionName) { local string URL; // We are joining so grab the connect string to use if (OnlineSub.GameInterface.GetResolvedConnectString(SessionName,URL)) { `Log(`location @ "traveling to joined,migrated session " $" SessionName="$SessionName $" URL="$URL ,,'DevNet'); // travel to the specified URL ClientTravel(URL, TRAVEL_Absolute); } else { `Log(`location @ "failed joining migrated session " $" SessionName="$SessionName ,,'DevNet'); ClientSetProgressMessage(PMT_PeerHostMigrationFailure, "<Strings:Engine.Errors.ConnectionFailed>", "<Strings:Engine.Errors.ConnectionFailed_Title>", true); } } /** * Delegate called once the join/migration of the session has completed. * * @param SessionName the name of the session being joined/migrated * @param bWasSuccessful whether the join/migrate completed ok or not */ function OnJoinMigratedGame(name SessionName,bool bWasSuccessful) { OnlineSub.GameInterface.ClearJoinMigratedOnlineGameCompleteDelegate(OnJoinMigratedGame); if (bWasSuccessful) { // Remove all non-peers from session and join once that completes if (!RemoveMissingPeersFromSession(SessionName,OnUnregisterPlayerCompleteForJoinMigrate)) { PeerDesignatedAsClient(SessionName); } } if (!bWasSuccessful) { `Log(`location @ "failed joining migrated session " $" SessionName="$SessionName ,,'DevNet'); ClientSetProgressMessage(PMT_PeerHostMigrationFailure, "<Strings:Engine.Errors.ConnectionFailed>", "<Strings:Engine.Errors.ConnectionFailed_Title>", true); } } event PreRender(Canvas Canvas); function ResetTimeMargin() { TimeMargin = -0.1; MaxTimeMargin = class'GameInfo'.Default.MaxTimeMargin; } reliable server function ServerShortTimeout() { local Actor A; if (!bShortConnectTimeout) { bShortConnectTimeOut = true; ResetTimeMargin(); // quick update of pickups and gameobjectives since this player is now relevant if (WorldInfo.Pauser != None) { // update everything immediately, as TimeSeconds won't get advanced while paused // so otherwise it won't happen at all until the game is unpaused // this floods the network, but we're paused, so no gameplay is going on that would care much foreach AllActors(class'Actor', A) { if (!A.bOnlyRelevantToOwner) { A.bForceNetUpdate = TRUE; } } } else if ( WorldInfo.Game.NumPlayers < 8 ) { foreach AllActors(class'Actor', A) { if ( (A.NetUpdateFrequency < 1) && !A.bOnlyRelevantToOwner ) { A.SetNetUpdateTime(FMin(A.NetUpdateTime, WorldInfo.TimeSeconds + 0.2 * FRand())); } } } else { foreach AllActors(class'Actor', A) { if ( (A.NetUpdateFrequency < 1) && !A.bOnlyRelevantToOwner ) { A.SetNetUpdateTime(FMin(A.NetUpdateTime, WorldInfo.TimeSeconds + 0.5 * FRand())); } } } } } function ServerGivePawn() { GivePawn(Pawn); } event KickWarning() { ReceiveLocalizedMessage( class'GameMessage', 15 ); } function AddCheats(optional bool bForce) { // Assuming that this never gets called for NM_Client without bForce=true if ( (CheatManager == None) && (WorldInfo.Game != None) && WorldInfo.Game.AllowCheats(self) || bForce) { CheatManager = new(Self) CheatClass; CheatManager.InitCheatManager(); } } exec function EnableCheats() { `if(`notdefined(FINAL_RELEASE)) AddCheats(true); `else AddCheats(); `endif } /* SpawnDefaultHUD() Spawn a HUD (make sure that PlayerController always has valid HUD, even if \ ClientSetHUD() hasn't been called\ */ function SpawnDefaultHUD() { if ( LocalPlayer(Player) == None ) return; `log(GetFuncName()); myHUD = spawn(class'HUD',self); } /* Reset() reset actor to initial state - used when restarting level without reloading. */ function Reset() { local vehicle DrivenVehicle; DrivenVehicle = Vehicle(Pawn); if( DrivenVehicle != None ) DrivenVehicle.DriverLeave(true); // Force the driver out of the car if ( Pawn != None ) { PawnDied( Pawn ); UnPossess(); } super.Reset(); SetViewTarget( Self ); ResetCameraMode(); WaitDelay = WorldInfo.TimeSeconds + 2; FixFOV(); if ( PlayerReplicationInfo.bOnlySpectator ) GotoState('Spectating'); else GotoState('PlayerWaiting'); } reliable client function ClientReset() { ResetCameraMode(); SetViewTarget(self); GotoState(PlayerReplicationInfo.bOnlySpectator ? 'Spectating' : 'PlayerWaiting'); } function CleanOutSavedMoves() { SavedMoves = None; PendingMove = None; } /** * Notification that the ControllerId for this PC LocalPlayer is about to change. Provides the PC a chance to cleanup anything that was * associated with the old ControllerId. When this method is called, LocalPlayer.ControllerId is still the old value. */ function PreControllerIdChange() { local LocalPlayer LP; LP = LocalPlayer(Player); if ( LP != None ) { ClientStopNetworkedVoice(); ClearOnlineDelegates(); UnregisterPlayerDataStores(); } } /** * Notification that the ControllerId for this PC's LocalPlayer has been changed. Re-register all player data stores and any delegates that * require a ControllerId. */ function PostControllerIdChange() { local LocalPlayer LP; local UniqueNetId PlayerId; LP = LocalPlayer(Player); if ( LP != None ) { // update unique ID // you get kicked for this in network games so no need to update if (WorldInfo.NetMode != NM_Client && OnlineSub != None && OnlineSub.PlayerInterface != None) { // Get our local id from the online subsystem OnlineSub.PlayerInterface.GetUniquePlayerId(LP.ControllerId, PlayerId); PlayerReplicationInfo.SetUniqueId(PlayerId); } RegisterPlayerDataStores(); RegisterOnlineDelegates(); ClientSetOnlineStatus(); // we don't currently allow players to migrate gamepads after the initial interactive screen. If we are a client or not in the menu // level then that constraint has been lifted - technically this shouldn't be an assertion, but this would be a really difficult bug // to track down otherwise, if switching gamepads is ever allowed after initial interactive scene. `assert(WorldInfo.Game != None); if ( !WorldInfo.Game.bRequiresPushToTalk ) { ClientStartNetworkedVoice(); } } } /** * Wrapper for getting reference to the OnlineSubsystem */ simulated final function OnlineSubsystem GetOnlineSubsystem() { if ( OnlineSub == None ) { OnlineSub = class'GameEngine'.static.GetOnlineSubsystem(); } return OnlineSub; } /* InitInputSystem() Spawn the appropriate class of PlayerInput Only called for playercontrollers that belong to local players */ event InitInputSystem() { local Class<ForceFeedbackManager> FFManagerClass; local int i; local Sequence GameSeq; local array<SequenceObject> AllInterpActions; if (PlayerInput == None) { Assert(InputClass != None); PlayerInput = new(Self) InputClass; if (PlayerInput != none) { PlayerInput.InitInputSystem(); } } if ( Interactions.Find(PlayerInput) == -1 ) { Interactions[Interactions.Length] = PlayerInput; } // Spawn the waveform manager here if (ForceFeedbackManagerClassName != "") { FFManagerClass = class<ForceFeedbackManager>(DynamicLoadObject(ForceFeedbackManagerClassName,class'Class')); if (FFManagerClass != None) { ForceFeedbackManager = new(Self) FFManagerClass; } } RegisterOnlineDelegates(); // add the player to any matinees running so that it gets in on any cinematics already running, etc // (already done on server in PostLogin()) if (Role < ROLE_Authority) { GameSeq = WorldInfo.GetGameSequence(); if (GameSeq != None) { // find any matinee actions that exist GameSeq.FindSeqObjectsByClass(class'SeqAct_Interp', true, AllInterpActions); // tell them all to add this PC to any running Director tracks for (i = 0; i < AllInterpActions.Length; i++) { SeqAct_Interp(AllInterpActions[i]).AddPlayerToDirectorTracks(self); } } } // this is a good stop gap measure for any cases that we miss / other code getting turned on / called // there is never a case where we want the tilt to be on at the point where the player controller is created SetOnlyUseControllerTiltInput( FALSE ); SetUseTiltForwardAndBack( TRUE ); SetControllerTiltActive( FALSE ); } /** * Initializes this client's Player data stores after seamless map travel */ reliable client function ClientInitializeDataStores() { `log(">> PlayerController::ClientInitializeDataStores for player" @ Self,,'DevDataStore'); // register the player's data stores and bind the PRI to the PlayerOwner data store. RegisterPlayerDataStores(); `log("<< PlayerController::ClientInitializeDataStores for player" @ Self,,'DevDataStore'); } /** * Register all player data stores. */ simulated final function RegisterPlayerDataStores() { RegisterCustomPlayerDataStores(); RegisterStandardPlayerDataStores(); } /** * Creates and initializes the "PlayerOwner" and "PlayerSettings" data stores. This function assumes that the PlayerReplicationInfo * for this player has not yet been created. */ simulated protected function RegisterCustomPlayerDataStores() { local LocalPlayer LP; local DataStoreClient DataStoreManager; local class<UIDataStore_OnlinePlayerData> PlayerDataStoreClass; `if(`notdefined(FINAL_RELEASE)) local string PlayerName; PlayerName = PlayerReplicationInfo != None ? PlayerReplicationInfo.PlayerName : "None"; `endif // only create player data store for local players LP = LocalPlayer(Player); `log(">>" @ `location @ "(" $ PlayerName $ ")" @ `showobj(LP),,'DevDataStore'); if ( LP != None ) { // get a reference to the main data store client DataStoreManager = class'UIInteraction'.static.GetDataStoreClient(); if ( DataStoreManager != None ) { // create the OnlinePlayerData data store OnlinePlayerData = UIDataStore_OnlinePlayerData(DataStoreManager.FindDataStore('OnlinePlayerData',LP)); if ( OnlinePlayerData == None ) { PlayerDataStoreClass = class<UIDataStore_OnlinePlayerData>(DataStoreManager.FindDataStoreClass(class'UIDataStore_OnlinePlayerData')); if ( PlayerDataStoreClass != None ) { // find the appropriate class to use for the PlayerSettings data store // create the PlayerSettings data store OnlinePlayerData = DataStoreManager.CreateDataStore(PlayerDataStoreClass); if ( OnlinePlayerData != None ) { if ( !DataStoreManager.RegisterDataStore(OnlinePlayerData, LP) ) { `log("Failed to register 'OnlinePlayerData' data store for player:"@ Self @ "(" $ PlayerName $ ")" @ `showobj(OnlinePlayerData),,'DevDataStore'); } } else { `log("Failed to create 'OnlinePlayerData' data store for player:"@ Self @ "(" $ PlayerName $ ") using class" @ PlayerDataStoreClass,,'DevDataStore'); } } else { `log("Failed to find valid data store class while attempting to register the 'OnlinePlayerData' data store for player:"@ Self @ "(" $ PlayerName $ ")",,'DevDataStore'); } } else { `log("'OnlinePlayerData' data store already registered for player:"@ Self @ "(" $ PlayerName $ ")",,'DevDataStore'); } } } `log("<<" @ `location @ "(" $ PlayerName $ ")",,'DevDataStore'); } /** * Register any player data stores which do not require special initialization. */ simulated protected function RegisterStandardPlayerDataStores() { local LocalPlayer LP; local DataStoreClient DataStoreManager; local array<class<UIDataStore> > PlayerDataStoreClasses; local class<UIDataStore> PlayerDataStoreClass; local UIDataStore PlayerDataStore; local int ClassIndex; `if(`notdefined(FINAL_RELEASE)) local string PlayerName; PlayerName = PlayerReplicationInfo != None ? PlayerReplicationInfo.PlayerName : "None"; `endif // only create player data store for local players LP = LocalPlayer(Player); if ( LP != None ) { `log(">>" @ `location @ "(" $ PlayerName $ ")",,'DevDataStore'); // get a reference to the main data store client DataStoreManager = class'UIInteraction'.static.GetDataStoreClient(); if ( DataStoreManager != None ) { DataStoreManager.GetPlayerDataStoreClasses(PlayerDataStoreClasses); // go through the data store client's list of player data store classes for ( ClassIndex = 0; ClassIndex < PlayerDataStoreClasses.Length; ClassIndex++ ) { PlayerDataStoreClass = PlayerDataStoreClasses[ClassIndex]; if ( PlayerDataStoreClass != None ) { // if the data store isn't already registered, do it now PlayerDataStore = DataStoreManager.FindDataStore(PlayerDataStoreClass.default.Tag, LP); if ( PlayerDataStore == None ) { `log(" Registering standard player data store '" $ PlayerDataStoreClass.Name $ "' for player" @ Self @ "(" $ PlayerName $ ")" @ `showobj(LP),,'DevDataStore'); PlayerDataStore = DataStoreManager.CreateDataStore(PlayerDataStoreClass); if ( PlayerDataStore != None ) { if ( !DataStoreManager.RegisterDataStore(PlayerDataStore, LP) ) { `log("Failed to register '" $ PlayerDataStoreClass.default.Tag $ "' data store for player:" @ Self @ "(" $ PlayerName $ ")" @ `showobj(PlayerDataStore),,'DevDataStore'); } } } else { `log("'" $ PlayerDataStoreClass.default.Tag $ "' data store already registered for player:" @ Self @ "(" $ PlayerName $ ")",,'DevDataStore'); } } } } } } /** * Unregisters the "PlayerOwner" data store for this player. Called when this PlayerController is destroyed. */ simulated function UnregisterPlayerDataStores() { local LocalPlayer LP; local DataStoreClient DataStoreManager; local UIDataStore_OnlinePlayerData OnlinePlayerDataStore; `if(`notdefined(FINAL_RELEASE)) local string PlayerName; PlayerName = PlayerReplicationInfo != None ? PlayerReplicationInfo.PlayerName : "None"; `endif // only execute for local players LP = LocalPlayer(Player); if ( LP != None ) { `log(">>" @ `location @ "(" $ PlayerName $ ")",,'DevDataStore'); // because the PlayerOwner data store is created and registered each match, all we should need to do is // unregister it from the data store client and clear our reference // get a reference to the main data store client DataStoreManager = class'UIInteraction'.static.GetDataStoreClient(); if ( DataStoreManager != None ) { // unregister the current player data store // Don't hold onto a ref OnlinePlayerData = None; // Unregister the online player data OnlinePlayerDataStore = UIDataStore_OnlinePlayerData(DataStoreManager.FindDataStore('OnlinePlayerData',LP)); if ( OnlinePlayerDataStore != None ) { if ( !DataStoreManager.UnregisterDataStore(OnlinePlayerDataStore) ) { `log("Failed to unregister 'OnlinePlayerData' data store for player:"@ Self @ "(" $ PlayerName $ ")" @ `showobj(OnlinePlayerDataStore),,'DevDataStore'); } } else { `log("'OnlinePlayerData' data store not registered for player:" @ Self @ "(" $ PlayerName $ ")",,'DevDataStore'); } UnregisterStandardPlayerDataStores(); } else { `log("Data store client not found!",,'DevDataStore'); } `log("<<" @ `location @ "(" $ PlayerName $ ")",,'DevDataStore'); } } /** * Unregisters all player data stores that remain after unregistering all player data stores that require custom unregister logic. */ simulated function UnregisterStandardPlayerDataStores() { local LocalPlayer LP; local DataStoreClient DataStoreManager; local array<class<UIDataStore> > PlayerDataStoreClasses; local class<UIDataStore> PlayerDataStoreClass; local UIDataStore PlayerDataStore; local int ClassIndex; `if(`notdefined(FINAL_RELEASE)) local string PlayerName; PlayerName = PlayerReplicationInfo != None ? PlayerReplicationInfo.PlayerName : "None"; `endif // only execute for local players LP = LocalPlayer(Player); if ( LP != None ) { `log(">>" @ `location @ "(" $ PlayerName $ ")",,'DevDataStore'); // because the PlayerOwner data store is created and registered each match, all we should need to do is // unregister it from the data store client and clear our reference // get a reference to the main data store client DataStoreManager = class'UIInteraction'.static.GetDataStoreClient(); if ( DataStoreManager != None ) { DataStoreManager.GetPlayerDataStoreClasses(PlayerDataStoreClasses); // now go through the rest of the registered player data stores and unregister them for ( ClassIndex = 0; ClassIndex < PlayerDataStoreClasses.Length; ClassIndex++ ) { PlayerDataStoreClass = PlayerDataStoreClasses[ClassIndex]; if ( PlayerDataStoreClass != None ) { // if the data store isn't already registered, do it now PlayerDataStore = DataStoreManager.FindDataStore(PlayerDataStoreClass.default.Tag, LP); if ( PlayerDataStore != None ) { if ( !DataStoreManager.UnregisterDataStore(PlayerDataStore) ) { `log("Failed to unregister '" $ PlayerDataStore.Tag $ "' data store for player:"@ Self @ "(" $ PlayerName $ ")" @ `showobj(PlayerDataStore),,'DevDataStore'); } } } } } `log("<<" @ `location @ "(" $ PlayerName $ ")",,'DevDataStore'); } } /** * Refetches this player's profile settings. */ simulated function ReloadProfileSettings() { if ( OnlinePlayerData != None && OnlinePlayerData.ProfileProvider != None ) { OnlinePlayerData.ProfileProvider.RefreshStorageData(); } } /** * Scales the amount the rumble will play on the gamepad * * @param ScaleBy The amount to scale the waveforms by */ final function SetRumbleScale(float ScaleBy) { if (ForceFeedbackManager != None) { ForceFeedbackManager.ScaleAllWaveformsBy = ScaleBy; } } /** * @return whether or not this Controller has Tilt Turned on **/ native simulated function bool IsControllerTiltActive() const; /** * sets whether or not the the player wants to utilize the Tilt functionality **/ native simulated function SetControllerTiltDesiredIfAvailable( bool bActive ); /** * sets whether or not the Tilt functionality is turned on **/ native simulated function SetControllerTiltActive( bool bActive ); /** * sets whether or not to ONLY use the tilt input controls **/ native simulated function SetOnlyUseControllerTiltInput( bool bActive ); /** * sets whether or not to use the tilt forward and back input controls **/ native simulated function SetUseTiltForwardAndBack( bool bActive ); /** * @return whether or not this Controller has a keyboard available to be used **/ native simulated function bool IsKeyboardAvailable() const; /** * @return whether or not this Controller has a mouse available to be used **/ native simulated function bool IsMouseAvailable() const; /* ClientGotoState() server uses this to force client into NewState */ reliable client function ClientGotoState(name NewState, optional name NewLabel) { if ((NewLabel == 'Begin' || NewLabel == '') && !IsInState(NewState)) { GotoState(NewState); } else { GotoState(NewState,NewLabel); } } reliable server function AskForPawn() { if ( GamePlayEndedState() ) ClientGotoState(GetStateName(), 'Begin'); else if ( Pawn != None ) GivePawn(Pawn); else { bFrozen = false; ServerRestartPlayer(); } } reliable client function GivePawn(Pawn NewPawn) { if ( NewPawn == None ) return; Pawn = NewPawn; NewPawn.Controller = self; ClientRestart(Pawn); } // Possess a pawn event Possess(Pawn aPawn, bool bVehicleTransition) { local Actor A; local int i; local SeqEvent_Touch TouchEvent; if (!PlayerReplicationInfo.bOnlySpectator) { if (aPawn.Controller != None) { aPawn.Controller.UnPossess(); } aPawn.PossessedBy(self, bVehicleTransition); Pawn = aPawn; Pawn.SetTickIsDisabled(false); ResetTimeMargin(); Restart(bVehicleTransition); // check if touching any actors with playeronly kismet touch events ForEach Pawn.TouchingActors(class'Actor', A) { for ( i=0; i < A.GeneratedEvents.length; i++) { TouchEvent = SeqEvent_Touch(A.GeneratedEvents[i]); if ( (TouchEvent != None) && TouchEvent.bPlayerOnly ) { TouchEvent.CheckTouchActivate(A,Pawn); } } } } } function AcknowledgePossession(Pawn P) { if ( LocalPlayer(Player) != None ) { AcknowledgedPawn = P; if ( P != None ) { P.SetBaseEyeHeight(); P.Eyeheight = P.BaseEyeHeight; } ServerAcknowledgePossession(P); } } reliable server function ServerAcknowledgePossession(Pawn P) { if ( (P != None) && (P == Pawn) && (P != AcknowledgedPawn) ) { ResetTimeMargin(); } AcknowledgedPawn = P; } // unpossessed a pawn (not because pawn was killed) event UnPossess() { if (Pawn != None) { SetLocation(Pawn.Location); if (Role == ROLE_Authority) { Pawn.RemoteRole = ROLE_SimulatedProxy; } Pawn.UnPossessed(); CleanOutSavedMoves(); // don't replay moves previous to unpossession if (GetViewTarget() == Pawn) { SetViewTarget(self); } } Pawn = None; } // unpossessed a pawn (because pawn was killed) function PawnDied(Pawn P) { if (P == Pawn) { if (Role == ROLE_Authority && Pawn != None) { Pawn.RemoteRole = ROLE_SimulatedProxy; } Super.PawnDied(P); } } reliable client function ClientSetHUD(class<HUD> newHUDType) { if ( myHUD != None ) { myHUD.Destroy(); } myHUD = (newHUDType != None) ? Spawn(newHUDType, self) : None; } function HandlePickup(Inventory Inv) { ReceiveLocalizedMessage(Inv.MessageClass,,,,Inv.class); } /* epic =============================================== * ::CleanupPRI * * Called from Destroyed(). Cleans up PlayerReplicationInfo. * PlayerControllers add their PRI to the gameinfo's InactivePRI list, so disconnected players can rejoin without losing their score. * * ===================================================== */ function CleanupPRI() { WorldInfo.Game.AddInactivePRI(PlayerReplicationInfo, self); PlayerReplicationInfo = None; } reliable client event ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) { // Wait for player to be up to date with replication when joining a server, before stacking up messages if ( WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.GRI == None ) return; Message.Static.ClientReceive( Self, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject ); } //Play a sound client side (so only client will hear it) unreliable client event ClientPlaySound(SoundCue ASound) { ClientHearSound(ASound, self, Location, false, false); } /** hooked up to the OnAudioFinished delegate of AudioComponents created through PlaySound() to return them to the pool */ simulated function HearSoundFinished(AudioComponent AC) { HearSoundActiveComponents.RemoveItem(AC); // if the component is already pending kill (playing actor was destroyed), then we can't put it back in the pool if (!AC.IsPendingKill()) { AC.ResetToDefaults(); HearSoundPoolComponents[HearSoundPoolComponents.length] = AC; } } /** get an audio component from the HearSound pool * creates a new component if the pool is empty and MaxConcurrentHearSounds has not been exceeded * the component is initialized with the values passed in, ready to call Play() on * its OnAudioFinished delegate is set to this PC's HearSoundFinished() function * @param ASound - the sound to play * @param SourceActor - the Actor to attach the sound to (if None, attached to self) * @param bStopWhenOwnerDestroyed - whether the sound stops if SourceActor is destroyed * @param bUseLocation (optional) - whether to use the SourceLocation parameter for the sound's location (otherwise, SourceActor's location) * @param SourceLocation (optional) - if bUseLocation, the location for the sound * @return the AudioComponent that was found/created */ native function AudioComponent GetPooledAudioComponent(SoundCue ASound, Actor SourceActor, bool bStopWhenOwnerDestroyed, optional bool bUseLocation, optional vector SourceLocation); /* ClientHearSound() Replicated function from server for replicating audible sounds played on server */ unreliable client event ClientHearSound(SoundCue ASound, Actor SourceActor, vector SourceLocation, bool bStopWhenOwnerDestroyed, optional bool bIsOccluded ) { local AudioComponent AC; // `log("### ClientHearSound:"@ASound@SourceActor@SourceLocation@bStopWhenOwnerDestroyed@VSize(SourceLocation - Pawn.Location)); if ( SourceActor == None ) { AC = GetPooledAudioComponent(ASound, SourceActor, bStopWhenOwnerDestroyed, true, SourceLocation); if (AC == None) { return; } AC.bUseOwnerLocation = false; AC.Location = SourceLocation; } else if ( (SourceActor == GetViewTarget()) || (SourceActor == self) ) { AC = GetPooledAudioComponent(ASound, None, bStopWhenOwnerDestroyed); if (AC == None) { return; } AC.bAllowSpatialization = false; } else { AC = GetPooledAudioComponent(ASound, SourceActor, bStopWhenOwnerDestroyed); if (AC == None) { return; } if (!IsZero(SourceLocation) && SourceLocation != SourceActor.Location) { AC.bUseOwnerLocation = false; AC.Location = SourceLocation; } } if ( bIsOccluded ) { // if occluded reduce volume: @FIXME do something better AC.VolumeMultiplier *= 0.5; } AC.Play(); } simulated function bool IsClosestLocalPlayerToActor(Actor TheActor) { local PlayerController PC; local float MyDist; if(ViewTarget == none) { return false; } MyDist = VSize(ViewTarget.Location - TheActor.Location); ForEach LocalPlayerControllers( class'PlayerController', PC ) { if( PC != self && (PC.ViewTarget != None) && (VSize(PC.ViewTarget.Location - TheActor.Location) < MyDist) ) { return false; } } return true; } reliable client event Kismet_ClientPlaySound(SoundCue ASound, Actor SourceActor, float VolumeMultiplier, float PitchMultiplier, float FadeInTime, bool bSuppressSubtitles, bool bSuppressSpatialization) { local AudioComponent AC; if ( SourceActor != None && IsClosestLocalPlayerToActor(SourceActor)) { // If we have a FaceFX animation hooked up, play that instead if( ASound.FaceFXAnimName != "" && SourceActor.PlayActorFaceFXAnim(ASound.FaceFXAnimSetRef, ASound.FaceFXGroupName, ASound.FaceFXAnimName, ASound) ) { // Success - In case of failure, fall back to playing the sound with no Face FX animation, but there will be a warning in the log instead. } else { AC = SourceActor.CreateAudioComponent(ASound, false, true); if ( AC != None ) { AC.VolumeMultiplier = VolumeMultiplier; AC.PitchMultiplier = PitchMultiplier; AC.bAutoDestroy = true; AC.SubtitlePriority = 10000; AC.bSuppressSubtitles = bSuppressSubtitles; AC.FadeIn(FadeInTime, 1.f); if( bSuppressSpatialization ) { AC.bAllowSpatialization = false; } } } } } reliable client event Kismet_ClientStopSound(SoundCue ASound, Actor SourceActor, float FadeOutTime) { local AudioComponent AC, CheckAC; if (SourceActor == None) { SourceActor = WorldInfo; } foreach SourceActor.AllOwnedComponents(class'AudioComponent',CheckAC) { if (CheckAC.SoundCue == ASound) { AC = CheckAC; break; } } if (AC != None) { AC.FadeOut(FadeOutTime,0.f); } } /** plays a FaceFX anim on the specified actor for the client */ reliable client function ClientPlayActorFaceFXAnim(Actor SourceActor, FaceFXAnimSet AnimSet, string GroupName, string SeqName, SoundCue SoundCueToPlay) { if (SourceActor != None) { SourceActor.PlayActorFaceFXAnim(AnimSet, GroupName, SeqName, SoundCueToPlay); } } reliable client event ClientMessage( coerce string S, optional Name Type, optional float MsgLifeTime ) { if ( WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.GRI == None ) { return; } if (Type == '') { Type = 'Event'; } TeamMessage(PlayerReplicationInfo, S, Type, MsgLifeTime); } /** Overridden by specific games */ simulated private function bool CanCommunicate() { return TRUE; } simulated private function bool AllowTTSMessageFrom( PlayerReplicationInfo PRI ) { return TRUE; } /** * Text to speech handling */ /** Constructs a SoundCue, performs text-to-wavedata conversion. */ simulated private native function SoundCue CreateTTSSoundCue( string StrToSpeak, PlayerReplicationInfo PRI ); exec function Talk() { local Console PlayerConsole; local LocalPlayer LP; LP = LocalPlayer( Player ); if( ( LP != None ) && CanCommunicate() && ( LP.ViewportClient.ViewportConsole != None ) ) { PlayerConsole = LocalPlayer( Player ).ViewportClient.ViewportConsole; PlayerConsole.StartTyping( "Say " ); } } exec function TeamTalk() { local Console PlayerConsole; local LocalPlayer LP; LP = LocalPlayer( Player ); if( ( LP != None ) && CanCommunicate() && ( LP.ViewportClient.ViewportConsole != None ) ) { PlayerConsole = LocalPlayer( Player ).ViewportClient.ViewportConsole; PlayerConsole.StartTyping( "TeamSay " ); } } simulated function SpeakTTS( coerce string S, optional PlayerReplicationInfo PRI ) { local SoundCue Cue; local AudioComponent AC; Cue = CreateTTSSoundCue( S, PRI ); if( Cue != None ) { AC = CreateAudioComponent( Cue, FALSE, TRUE, , , TRUE ); AC.bAllowSpatialization = FALSE; AC.bAutoDestroy = TRUE; AC.Play(); } } reliable client event TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type, optional float MsgLifeTime ) { local bool bIsUserCreated; if( CanCommunicate() ) { if( ( ( Type == 'Say' ) || (Type == 'TeamSay' ) ) && ( PRI != None ) && AllowTTSMessageFrom( PRI ) ) { if( !bIsUserCreated || ( bIsUserCreated && CanViewUserCreatedContent() ) ) { SpeakTTS( S, PRI ); } } if( myHUD != None ) { myHUD.Message( PRI, S, Type, MsgLifeTime ); } if( ( ( Type == 'Say' ) || ( Type == 'TeamSay' ) ) && ( PRI != None ) ) { S = PRI.PlayerName$": "$S; // This came from a user so flag as user created bIsUserCreated = true; } // since this is on the client, we can assume that if Player exists, it is a LocalPlayer if( Player != None ) { // Don't allow this if the parental controls block it if( !bIsUserCreated || ( bIsUserCreated && CanViewUserCreatedContent() ) ) { LocalPlayer( Player ).ViewportClient.ViewportConsole.OutputText( S ); } } } } function PlayBeepSound(); /** * Registers any handlers for delegates in the OnlineSubsystem. Called when a player is being created and/or ControllerId is changing. */ function RegisterOnlineDelegates() { local LocalPlayer LP; LP = LocalPlayer(Player); // If there is an online subsystem, add our callback for UI changes if (OnlineSub != None && LP != None) { VoiceInterface = OnlineSub.VoiceInterface; if (OnlineSub.SystemInterface != None) { // Register the callback for when external UI is shown/hidden // This will pause/unpause a single player game based upon the UI state OnlineSub.SystemInterface.AddExternalUIChangeDelegate(OnExternalUIChanged); // This will pause/unpause a single player game based upon the controller state OnlineSub.SystemInterface.AddControllerChangeDelegate(OnControllerChanged); } // Register for accepting game invites if possible if (OnlineSub.GameInterface != None) { OnlineSub.GameInterface.AddGameInviteAcceptedDelegate(LP.ControllerId,OnGameInviteAccepted); } if (OnlineSub.PartyChatInterface != None) { OnlineSub.PartyChatInterface.AddPartyMemberListChangedDelegate(LP.ControllerId,OnPartyMemberListChanged); OnlineSub.PartyChatInterface.AddPartyMembersInfoChangedDelegate(LP.ControllerId,OnPartyMembersInfoChanged); } } } /** * Is called when someone joins/leaves the player's party chat session * * @param bJoinedOrLeft true if the player joined, false if they left * @param PlayerName the name of the player that was affected * @param PlayerId the net id of the player that left */ function OnPartyMemberListChanged(bool bJoinedOrLeft,string PlayerName,UniqueNetId PlayerId); /** * Is called when someone in your party chat has their custom data change (game controlled) * * @param PlayerName the name of the player that was affected * @param PlayerId the net id of the player that had data change * @param CustomData1 the first 4 bytes of the custom data * @param CustomData2 the second 4 bytes of the custom data * @param CustomData3 the third 4 bytes of the custom data * @param CustomData4 the fourth 4 bytes of the custom data */ function OnPartyMembersInfoChanged(string PlayerName,UniqueNetId PlayerId,int CustomData1,int CustomData2,int CustomData3,int CustomData4); /** * Unregisters all delegates previously registered with the online subsystem. Called when the player controller is being * destroyed and/or replaced. * * @note: in certain cases (i.e. when the channel is closed from the server's end), the player controller will no longer have * a reference its ULocalPlayer object. these delegates won't be cleared, but GC should clear the references for us. */ event ClearOnlineDelegates() { local LocalPlayer LP; `log("Clearing online delegates for" @ Self @ "(" $ `showobj(Player) $ ")",,'DevOnline'); LP = LocalPlayer(Player); if (Role < ROLE_Authority || LP != None) { // If there is an online subsystem, clear our callback for UI/controller changes if (OnlineSub != None) { if (OnlineSub.SystemInterface != None) { OnlineSub.SystemInterface.ClearExternalUIChangeDelegate(OnExternalUIChanged); OnlineSub.SystemInterface.ClearControllerChangeDelegate(OnControllerChanged); } if (LP != None) { // Cleanup game invite delegate if (OnlineSub.GameInterface != None) { OnlineSub.GameInterface.ClearGameInviteAcceptedDelegate(LP.ControllerId, OnGameInviteAccepted); } if (OnlineSub.PartyChatInterface != None) { OnlineSub.PartyChatInterface.ClearPartyMemberListChangedDelegate(LP.ControllerId, OnPartyMemberListChanged); OnlineSub.PartyChatInterface.ClearPartyMembersInfoChangedDelegate(LP.ControllerId, OnPartyMembersInfoChanged); } } } } } /** When the Controller is destroyed, the controlled pawn will need to be killed, but not the vehicle */ function CleanupPawn() { local Vehicle DrivenVehicle; local Pawn Driver; // If its a vehicle, just destroy the driver, otherwise do the normal. DrivenVehicle = Vehicle(Pawn); if (DrivenVehicle != None) { Driver = DrivenVehicle.Driver; DrivenVehicle.DriverLeave(TRUE); // Force the driver out of the car if ( Driver != None ) { Driver.Health = 0; Driver.Died(Self, class'DmgType_Suicided', Driver.Location); } } else if (Pawn != None) { Pawn.Health = 0; Pawn.Died(Self, class'DmgType_Suicided', Pawn.Location); } } event Destroyed() { local int EffectIdx; local LocalPlayer LPlayer; local MaterialEffect Effect; local MaterialInstanceConstant MIC; // Disable any currently playing rumble ClientPlayForceFeedbackWaveform(None,None); // if this is a local player, clear all online delegates if ( Role < ROLE_Authority || LocalPlayer(Player) != None ) { ClearOnlineDelegates(); } // cheatmanager and playerinput cleaned up in C++ PostScriptDestroyed() if ( Pawn != None ) { CleanupPawn(); } if ( myHUD != None ) { myHud.Destroy(); myHUD = None; } if( PlayerCamera != None ) { PlayerCamera.Destroy(); PlayerCamera = None; } ForceClearUnpauseDelegates(); // remove this player's data store from the registered data stores.. UnregisterPlayerDataStores(); // remove instanced MICs from the PP chain LPlayer = LocalPlayer(Player); if ((LPlayer != None) && (LPlayer.PlayerPostProcess != None)) { for (EffectIdx = 0; EffectIdx < LPlayer.PlayerPostProcess.Effects.Length; EffectIdx++) { Effect = MaterialEffect(LPlayer.PlayerPostProcess.Effects[EffectIdx]); if ((Effect != None) && (Effect.Material != None)) { MIC = MaterialInstanceConstant(Effect.Material); if ((MIC != None) && (MIC.Parent != None)) { Effect.Material = MIC.Parent; } } } } Super.Destroyed(); } function FixFOV() { FOVAngle = Default.DefaultFOV; DesiredFOV = Default.DefaultFOV; DefaultFOV = Default.DefaultFOV; } function SetFOV(float NewFOV) { DesiredFOV = NewFOV; FOVAngle = NewFOV; } function ResetFOV() { DesiredFOV = DefaultFOV; FOVAngle = DefaultFOV; } exec function FOV(float F) { if( PlayerCamera != None ) { PlayerCamera.SetFOV( F ); return; } if( (F >= 80.0) || (WorldInfo.NetMode==NM_Standalone) || PlayerReplicationInfo.bOnlySpectator ) { DefaultFOV = FClamp(F, 80, 100); DesiredFOV = DefaultFOV; } } exec function Mutate(string MutateString) { ServerMutate(MutateString); } reliable server function ServerMutate(string MutateString) { if( WorldInfo.NetMode == NM_Client ) return; WorldInfo.Game.Mutate(MutateString, Self); } // ------------------------------------------------------------------------ // Messaging functions function bool AllowTextMessage(string Msg) { local int i; if ( (WorldInfo.NetMode == NM_Standalone) || PlayerReplicationInfo.bAdmin ) return true; if ( ( WorldInfo.Pauser == none) && (WorldInfo.TimeSeconds - LastBroadcastTime < 2 ) ) return false; // lower frequency if same text if ( WorldInfo.TimeSeconds - LastBroadcastTime < 5 ) { Msg = Left(Msg,Clamp(len(Msg) - 4, 8, 64)); for ( i=0; i<4; i++ ) if ( LastBroadcastString[i] ~= Msg ) return false; } for ( i=3; i>0; i-- ) LastBroadcastString[i] = LastBroadcastString[i-1]; LastBroadcastTime = WorldInfo.TimeSeconds; return true; } // Send a message to all players. exec function Say( string Msg ) { Msg = Left(Msg,128); if ( AllowTextMessage(Msg) ) ServerSay(Msg); } unreliable server function ServerSay( string Msg ) { local PlayerController PC; // center print admin messages which start with # if (PlayerReplicationInfo.bAdmin && left(Msg,1) == "#" ) { Msg = right(Msg,len(Msg)-1); foreach WorldInfo.AllControllers(class'PlayerController', PC) { PC.ClientAdminMessage(Msg); } return; } WorldInfo.Game.Broadcast(self, Msg, 'Say'); } reliable client function ClientAdminMessage(string Msg) { local LocalPlayer LP; LP = LocalPlayer(Player); if (LP != None) { LP.ViewportClient.ClearProgressMessages(); LP.ViewportClient.SetProgressTime(6); LP.ViewportClient.SetProgressMessage(PMT_AdminMessage, Msg); } } exec function TeamSay( string Msg ) { Msg = Left(Msg,128); if ( AllowTextMessage(Msg) ) ServerTeamSay(Msg); } unreliable server function ServerTeamSay( string Msg ) { LastActiveTime = WorldInfo.TimeSeconds; if( !WorldInfo.GRI.GameClass.Default.bTeamGame ) { Say( Msg ); return; } WorldInfo.Game.BroadcastTeam( self, Msg, 'TeamSay'); } // ------------------------------------------------------------------------ /** * Called when the local player is about to travel to a new map or IP address. Provides subclass with an opportunity * to perform cleanup or other tasks prior to the travel. */ event PreClientTravel( string PendingURL, ETravelType TravelType, bool bIsSeamlessTravel ) { local UIInteraction UIController; local GameUISceneClient GameSceneClient; // notify the UI system that we're about to perform a travel. UIController = GetUIController(); if ( UIController != None && IsPrimaryPlayer() ) { GameSceneClient = UIController.SceneClient; if ( GameSceneClient != None ) { GameSceneClient.NotifyClientTravel(Self, PendingURL, TravelType, bIsSeamlessTravel); } if (PlayerInput != none) { PlayerInput.PreClientTravel(PendingURL, TravelType, bIsSeamlessTravel); } } } /** * Change Camera mode * * @param New camera mode to set */ exec function Camera( name NewMode ) { ServerCamera(NewMode); } reliable server function ServerCamera( name NewMode ) { if ( NewMode == '1st' ) { NewMode = 'FirstPerson'; } else if ( NewMode == '3rd' ) { NewMode = 'ThirdPerson'; } SetCameraMode( NewMode ); `if(`notdefined(FINAL_RELEASE)) if ( PlayerCamera != None ) `log("#### " $ PlayerCamera.CameraStyle); `endif } /** * Replicated function to set camera style on client * * @param NewCamMode, name defining the new camera mode */ reliable client function ClientSetCameraMode( name NewCamMode ) { if ( PlayerCamera != None ) PlayerCamera.CameraStyle = NewCamMode; } /** * Set new camera mode * * @param NewCamMode, new camera mode. */ function SetCameraMode( name NewCamMode ) { if ( PlayerCamera != None ) { PlayerCamera.CameraStyle = NewCamMode; if ( WorldInfo.NetMode == NM_DedicatedServer ) { ClientSetCameraMode( NewCamMode ); } } } /** * Reset Camera Mode to default */ event ResetCameraMode() { if ( Pawn != None ) { // If we have a pawn, let's ask it which camera mode we should use SetCameraMode( Pawn.GetDefaultCameraMode( Self ) ); } else { // otherwise default to first person view. SetCameraMode( 'FirstPerson' ); } } reliable client event ClientSetCameraFade(bool bEnableFading, optional color FadeColor, optional vector2d FadeAlpha, optional float FadeTime) { if (PlayerCamera != None) { PlayerCamera.bEnableFading = bEnableFading; if (PlayerCamera.bEnableFading) { PlayerCamera.FadeColor = FadeColor; PlayerCamera.FadeAlpha = FadeAlpha; PlayerCamera.FadeTime = FadeTime; PlayerCamera.FadeTimeRemaining = FadeTime; } else { // Make sure FadeAmount finishes at the correct value PlayerCamera.FadeAmount = PlayerCamera.FadeAlpha.Y; } } } /** * return whether viewing in first person mode */ function bool UsingFirstPersonCamera() { return ((PlayerCamera == None) || (PlayerCamera.CameraStyle == 'FirstPerson')) && LocalPlayer(Player) != None; } /* ForceDeathUpdate() Make sure ClientAdjustPosition immediately informs client of pawn's death */ function ForceDeathUpdate() { LastUpdateTime = WorldInfo.TimeSeconds - 10; } /* DualServerMove() - replicated function sent by client to server - contains client movement and firing info for two moves */ unreliable server function DualServerMove ( float TimeStamp0, vector InAccel0, byte PendingFlags, int View0, float TimeStamp, vector InAccel, vector ClientLoc, byte NewFlags, byte ClientRoll, int View ) { ServerMove(TimeStamp0,InAccel0,vect(1,2,3),PendingFlags,ClientRoll,View0); ServerMove(TimeStamp,InAccel,ClientLoc,NewFlags,ClientRoll,View); } /* OldServerMove() - resending an (important) old move. Process it if not already processed. */ unreliable server function OldServerMove ( float OldTimeStamp, byte OldAccelX, byte OldAccelY, byte OldAccelZ, byte OldMoveFlags ) { local vector Accel; if ( AcknowledgedPawn != Pawn ) return; if ( CurrentTimeStamp < OldTimeStamp - 0.001 ) { // split out components of lost move (approx) Accel.X = OldAccelX; if ( Accel.X > 127 ) Accel.X = -1 * (Accel.X - 128); Accel.Y = OldAccelY; if ( Accel.Y > 127 ) Accel.Y = -1 * (Accel.Y - 128); Accel.Z = OldAccelZ; if ( Accel.Z > 127 ) Accel.Z = -1 * (Accel.Z - 128); Accel *= 20; //`log("Recovered move from "$OldTimeStamp$" acceleration "$Accel$" from "$OldAccel); OldTimeStamp = FMin(OldTimeStamp, CurrentTimeStamp + MaxResponseTime); MoveAutonomous(OldTimeStamp - CurrentTimeStamp, OldMoveFlags, Accel, rot(0,0,0)); CurrentTimeStamp = OldTimeStamp; } } /** @return time delta to use for the current ServerMove() */ function float GetServerMoveDeltaTime(float TimeStamp) { local float DeltaTime; DeltaTime = FMin(MaxResponseTime, TimeStamp - CurrentTimeStamp); if( Pawn == None ) { bWasSpeedHack = FALSE; ResetTimeMargin(); } else if( !CheckSpeedHack(DeltaTime) ) { if( !bWasSpeedHack ) { if( WorldInfo.TimeSeconds - LastSpeedHackLog > 20 ) { `log("Possible speed hack by "$PlayerReplicationInfo.PlayerName); LastSpeedHackLog = WorldInfo.TimeSeconds; } ClientMessage( "Speed Hack Detected!",'CriticalEvent' ); } else { bWasSpeedHack = TRUE; } DeltaTime = 0; Pawn.Velocity = vect(0,0,0); } else { DeltaTime *= Pawn.CustomTimeDilation; bWasSpeedHack = FALSE; } return DeltaTime; } /** called after movement in ServerMove() to check for and handle any potential error between server and client position * by setting PendingAdjustment appropriately */ function ServerMoveHandleClientError(float TimeStamp, vector Accel, vector ClientLoc) { local float ClientErr; local vector LocDiff; // Accumulate movement error. if (ClientLoc == vect(1,2,3)) { return; // first part of double servermove } else if (WorldInfo.TimeSeconds - LastUpdateTime < CLIENTADJUSTUPDATECOST / Player.CurrentNetSpeed) { // limit frequency of corrections if connection speed is limited return; } if (Pawn == None) { LocDiff = Location - ClientLoc; } else if (Pawn.bForceRMVelocity && Pawn.default.Mesh.RootMotionMode == RMM_Ignore) { // don't do corrections during root motion LocDiff = vect(0,0,0); } // force a correction periodically if the Pawn is not moving // this handles cases where the client incorrectly thinks movement is impossible // since without movement on one side or the other error can never be accumulated else if (Pawn.Physics != PHYS_None && WorldInfo.TimeSeconds - LastUpdateTime > 1.0 && IsZero(Accel)) { LocDiff = vect(1000,1000,1000); } else { LocDiff = Pawn.Location - ClientLoc; } ClientErr = LocDiff Dot LocDiff; // If client has accumulated a noticeable positional error, correct him. if (ClientErr > MAXPOSITIONERRORSQUARED) { if (Pawn == None) { PendingAdjustment.newPhysics = Physics; PendingAdjustment.NewLoc = Location; PendingAdjustment.NewVel = Velocity; } else { PendingAdjustment.newPhysics = Pawn.Physics; PendingAdjustment.NewVel = Pawn.Velocity; PendingAdjustment.NewBase = Pawn.Base; if( (InterpActor(Pawn.Base) != None) || (Vehicle(Pawn.Base) != None) ) { PendingAdjustment.NewLoc = Pawn.Location - Pawn.Base.Location; } else { PendingAdjustment.NewLoc = Pawn.Location; } PendingAdjustment.NewFloor = Pawn.Floor; } //`log("Client Error at" @ TimeStamp @ "is" @ ClientErr @ "with acceleration" @ Accel @ "LocDiff" @ LocDiff @ "Physics" @ Pawn.Physics); LastUpdateTime = WorldInfo.TimeSeconds; PendingAdjustment.TimeStamp = TimeStamp; PendingAdjustment.bAckGoodMove = 0; } else { // acknowledge receipt of this successful servermove() PendingAdjustment.TimeStamp = TimeStamp; PendingAdjustment.bAckGoodMove = 1; } } /* ServerMove() - replicated function sent by client to server - contains client movement and firing info. */ unreliable server function ServerMove(float TimeStamp, vector InAccel, vector ClientLoc, byte MoveFlags, byte ClientRoll, int View) { local float DeltaTime; local rotator DeltaRot, Rot, ViewRot; local vector Accel; local int maxPitch, ViewPitch, ViewYaw; // If this move is outdated, discard it. if( CurrentTimeStamp >= TimeStamp ) { return; } if( AcknowledgedPawn != Pawn ) { InAccel = vect(0,0,0); GivePawn(Pawn); } // View components ViewPitch = (View & 65535); ViewYaw = (View >> 16); // Acceleration was scaled by 10x for replication, to keep more precision since vectors are rounded for replication Accel = InAccel * 0.1; // Save move parameters. DeltaTime = GetServerMoveDeltaTime(TimeStamp); CurrentTimeStamp = TimeStamp; ServerTimeStamp = WorldInfo.TimeSeconds; ViewRot.Pitch = ViewPitch; ViewRot.Yaw = ViewYaw; ViewRot.Roll = 0; if( InAccel != vect(0,0,0) ) { LastActiveTime = WorldInfo.TimeSeconds; } SetRotation(ViewRot); if( AcknowledgedPawn != Pawn ) { return; } if( Pawn != None ) { Rot.Roll = 256 * ClientRoll; Rot.Yaw = ViewYaw; if( (Pawn.Physics == PHYS_Swimming) || (Pawn.Physics == PHYS_Flying) ) { maxPitch = 2; } else { maxPitch = 0; } if( (ViewPitch > maxPitch * Pawn.MaxPitchLimit) && (ViewPitch < 65536 - maxPitch * Pawn.MaxPitchLimit) ) { if( ViewPitch < 32768 ) { Rot.Pitch = maxPitch * Pawn.MaxPitchLimit; } else { Rot.Pitch = 65536 - maxPitch * Pawn.MaxPitchLimit; } } else { Rot.Pitch = ViewPitch; } DeltaRot = (Rotation - Rot); Pawn.FaceRotation(Rot, DeltaTime); } // Perform actual movement if( (WorldInfo.Pauser == None) && (DeltaTime > 0) ) { MoveAutonomous(DeltaTime, MoveFlags, Accel, DeltaRot); } ServerMoveHandleClientError(TimeStamp, Accel, ClientLoc); //`log("Server moved stamp "$TimeStamp$" location "$Pawn.Location$" Acceleration "$Pawn.Acceleration$" Velocity "$Pawn.Velocity); } /* Called on server at end of tick when PendingAdjustment has been set. Done this way to avoid ever sending more than one ClientAdjustment per server tick. */ event SendClientAdjustment() { if( AcknowledgedPawn != Pawn ) { PendingAdjustment.TimeStamp = 0; return; } if( PendingAdjustment.bAckGoodMove == 1 ) { // just notify client this move was received ClientAckGoodMove(PendingAdjustment.TimeStamp); } else if( (Pawn == None) || (Pawn.Physics != PHYS_Spider) ) { if( PendingAdjustment.NewVel == vect(0,0,0) ) { if (GetStateName() == 'PlayerWalking' && Pawn != None && Pawn.Physics == PHYS_Walking) { VeryShortClientAdjustPosition ( PendingAdjustment.TimeStamp, PendingAdjustment.NewLoc.X, PendingAdjustment.NewLoc.Y, PendingAdjustment.NewLoc.Z, PendingAdjustment.NewBase ); } else { ShortClientAdjustPosition ( PendingAdjustment.TimeStamp, GetStateName(), PendingAdjustment.newPhysics, PendingAdjustment.NewLoc.X, PendingAdjustment.NewLoc.Y, PendingAdjustment.NewLoc.Z, PendingAdjustment.NewBase ); } } else { ClientAdjustPosition ( PendingAdjustment.TimeStamp, GetStateName(), PendingAdjustment.newPhysics, PendingAdjustment.NewLoc.X, PendingAdjustment.NewLoc.Y, PendingAdjustment.NewLoc.Z, PendingAdjustment.NewVel.X, PendingAdjustment.NewVel.Y, PendingAdjustment.NewVel.Z, PendingAdjustment.NewBase ); } } else { LongClientAdjustPosition ( PendingAdjustment.TimeStamp, GetStateName(), PendingAdjustment.newPhysics, PendingAdjustment.NewLoc.X, PendingAdjustment.NewLoc.Y, PendingAdjustment.NewLoc.Z, PendingAdjustment.NewVel.X, PendingAdjustment.NewVel.Y, PendingAdjustment.NewVel.Z, PendingAdjustment.NewBase, PendingAdjustment.NewFloor.X, PendingAdjustment.NewFloor.Y, PendingAdjustment.NewFloor.Z ); } PendingAdjustment.TimeStamp = 0; PendingAdjustment.bAckGoodMove = 0; } // Only executed on server unreliable server function ServerDrive(float InForward, float InStrafe, float aUp, bool InJump, int View) { local rotator ViewRotation; ViewRotation.Pitch = (View & 65535); ViewRotation.Yaw = (View >> 16); ViewRotation.Roll = 0; SetRotation(ViewRotation); ProcessDrive(InForward, InStrafe, aUp, InJump); } function ProcessDrive(float InForward, float InStrafe, float InUp, bool InJump) { ClientGotoState(GetStateName(), 'Begin'); } function ProcessMove( float DeltaTime, vector newAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { if( (Pawn != None) && (Pawn.Acceleration != newAccel) ) { Pawn.Acceleration = newAccel; } } function MoveAutonomous ( float DeltaTime, byte CompressedFlags, vector newAccel, rotator DeltaRot ) { local EDoubleClickDir DoubleClickMove; if ( (Pawn != None) && Pawn.bHardAttach ) return; DoubleClickMove = SavedMoveClass.static.SetFlags(CompressedFlags, self); HandleWalking(); ProcessMove(DeltaTime, newAccel, DoubleClickMove, DeltaRot); if ( Pawn != None ) { Pawn.AutonomousPhysics(DeltaTime); } else { AutonomousPhysics(DeltaTime); } bDoubleJump = false; //`log("Role "$Role$" moveauto time "$100 * DeltaTime$" ("$WorldInfo.TimeDilation$")"); } /* VeryShortClientAdjustPosition bandwidth saving version, when velocity is zeroed, and pawn is walking */ unreliable client function VeryShortClientAdjustPosition ( float TimeStamp, float NewLocX, float NewLocY, float NewLocZ, Actor NewBase ) { local vector Floor; if( Pawn != None ) { Floor = Pawn.Floor; } LongClientAdjustPosition(TimeStamp, 'PlayerWalking', PHYS_Walking, NewLocX, NewLocY, NewLocZ, 0, 0, 0, NewBase, Floor.X, Floor.Y, Floor.Z); } /* ShortClientAdjustPosition bandwidth saving version, when velocity is zeroed */ unreliable client function ShortClientAdjustPosition ( float TimeStamp, name newState, EPhysics newPhysics, float NewLocX, float NewLocY, float NewLocZ, Actor NewBase ) { local vector Floor; if( Pawn != None ) { Floor = Pawn.Floor; } LongClientAdjustPosition(TimeStamp, newState, newPhysics, NewLocX, NewLocY, NewLocZ, 0, 0, 0, NewBase, Floor.X, Floor.Y, Floor.Z); } reliable client function ClientCapBandwidth(int Cap) { ClientCap = Cap; if( (Player != None) && (Player.CurrentNetSpeed > Cap) ) { SetNetSpeed(Cap); } } unreliable client function ClientAckGoodMove(float TimeStamp) { UpdatePing(TimeStamp); CurrentTimeStamp = TimeStamp; ClearAckedMoves(); } /* ClientAdjustPosition - pass newloc and newvel in components so they don't get rounded */ unreliable client function ClientAdjustPosition ( float TimeStamp, name newState, EPhysics newPhysics, float NewLocX, float NewLocY, float NewLocZ, float NewVelX, float NewVelY, float NewVelZ, Actor NewBase ) { local vector Floor; if ( Pawn != None ) { Floor = Pawn.Floor; } LongClientAdjustPosition(TimeStamp,newState,newPhysics,NewLocX,NewLocY,NewLocZ,NewVelX,NewVelY,NewVelZ,NewBase,Floor.X,Floor.Y,Floor.Z); } /* epic =============================================== * ::UpdatePing update average ping based on newly received round trip timestamp. Occasionally send ping updates to the server, and also adjust netspeed if connection appears to be saturated */ final function UpdatePing(float TimeStamp) { if ( PlayerReplicationInfo != None ) { PlayerReplicationInfo.UpdatePing(TimeStamp); if ( WorldInfo.TimeSeconds - LastPingUpdate > 4 ) { LastPingUpdate = WorldInfo.TimeSeconds; ServerUpdatePing(1000 * PlayerReplicationInfo.ExactPing); } } } /** @return whether we should skip the position updating in LongClientAdjustPosition() due to current or upcoming root motion * (does not affect move acknowledgement or state transitions) */ function bool SkipPositionUpdateForRM() { local SavedMove CurrentMove; // avoiding correcting for temporary root motion moves; wait until the animation completes if (Pawn != None && Pawn.default.Mesh.RootMotionMode == RMM_Ignore) { if ( Pawn.Physics != PHYS_Falling && Pawn.Mesh != None && Pawn.Mesh.RootMotionMode != RMM_Ignore && !Pawn.bRootMotionFromInterpCurve ) { `log("- skipping position update for root motion",,'PlayerMove'); return true; } // don't correct if have upcoming root motion CurrentMove = SavedMoves; while( CurrentMove != None ) { if ( CurrentMove.bForceRMVelocity ) { `log("- skipping position update for upcoming root motion",,'PlayerMove'); return true; } CurrentMove = CurrentMove.NextMove; } } return false; } /* LongClientAdjustPosition long version, when care about pawn's floor normal */ unreliable client function LongClientAdjustPosition ( float TimeStamp, name newState, EPhysics newPhysics, float NewLocX, float NewLocY, float NewLocZ, float NewVelX, float NewVelY, float NewVelZ, Actor NewBase, float NewFloorX, float NewFloorY, float NewFloorZ ) { local vector NewLocation, NewVelocity, NewFloor; local Actor MoveActor; local SavedMove CurrentMove; local Actor TheViewTarget; `if(`notdefined(FINAL_RELEASE)) local Vector OldLoc; OldLoc = (Pawn != None) ? Pawn.Location : Location; `endif UpdatePing(TimeStamp); if( Pawn != None ) { if( Pawn.bTearOff ) { Pawn = None; if( !GamePlayEndedState() && !IsInState('Dead') ) { GotoState('Dead'); } return; } MoveActor = Pawn; TheViewTarget = GetViewTarget(); if( (TheViewTarget != Pawn) && ((TheViewTarget == self) || ((Pawn(TheViewTarget) != None) && (Pawn(TheViewTarget).Health <= 0))) ) { ResetCameraMode(); SetViewTarget(Pawn); } } else { MoveActor = self; if( GetStateName() != newstate ) { `log("- state change:"@GetStateName()@"->"@newstate,,'PlayerMove'); if( NewState == 'RoundEnded' ) { GotoState(NewState); } else if( IsInState('Dead') ) { if( (NewState != 'PlayerWalking') && (NewState != 'PlayerSwimming') ) { GotoState(NewState); } return; } else if( NewState == 'Dead' ) { GotoState(NewState); } } } if( CurrentTimeStamp >= TimeStamp ) { return; } CurrentTimeStamp = TimeStamp; NewLocation.X = NewLocX; NewLocation.Y = NewLocY; NewLocation.Z = NewLocZ; NewVelocity.X = NewVelX; NewVelocity.Y = NewVelY; NewVelocity.Z = NewVelZ; // skip update if no error CurrentMove = SavedMoves; // note that acked moves are cleared here, instead of calling ClearAckedMoves() while( CurrentMove != None ) { if( CurrentMove.TimeStamp <= CurrentTimeStamp ) { SavedMoves = CurrentMove.NextMove; CurrentMove.NextMove = FreeMoves; FreeMoves = CurrentMove; if( CurrentMove.TimeStamp == CurrentTimeStamp ) { LastAckedAccel = CurrentMove.Acceleration; FreeMoves.Clear(); if( ((InterpActor(NewBase) != None) || (Vehicle(NewBase) != None)) && (NewBase == CurrentMove.EndBase) ) { if ( (GetStateName() == NewState) && IsInState('PlayerWalking') && ((MoveActor.Physics == PHYS_Walking) || (MoveActor.Physics == PHYS_Falling)) ) { if ( VSizeSq(CurrentMove.SavedRelativeLocation - NewLocation) < MAXPOSITIONERRORSQUARED ) { CurrentMove = None; return; } else if ( (Vehicle(NewBase) != None) && (VSizeSq(Velocity) < MAXNEARZEROVELOCITYSQUARED) && (VSizeSq(NewVelocity) < MAXNEARZEROVELOCITYSQUARED) && (VSizeSq(CurrentMove.SavedRelativeLocation - NewLocation) < MAXVEHICLEPOSITIONERRORSQUARED) ) { CurrentMove = None; return; } } } else if ( (VSizeSq(CurrentMove.SavedLocation - NewLocation) < MAXPOSITIONERRORSQUARED) && (VSizeSq(CurrentMove.SavedVelocity - NewVelocity) < MAXNEARZEROVELOCITYSQUARED) && (GetStateName() == NewState) && IsInState('PlayerWalking') && ((MoveActor.Physics == PHYS_Walking) || (MoveActor.Physics == PHYS_Falling)) ) { CurrentMove = None; return; } CurrentMove = None; } else { FreeMoves.Clear(); CurrentMove = SavedMoves; } } else { CurrentMove = None; } } if (MoveActor.bHardAttach) { if (MoveActor.Base == None || MoveActor.Base.bWorldGeometry) { if (NewBase != None) { MoveActor.SetLocation(NewLocation); MoveActor.SetPhysics(NewPhysics); MoveActor.SetBase(NewBase); } if( MoveActor.Base == None ) { MoveActor.SetHardAttach(false); } else { return; } } else { return; } } NewFloor.X = NewFloorX; NewFloor.Y = NewFloorY; NewFloor.Z = NewFloorZ; //@debug - track down the errors `log("- base mismatch:"@MoveActor.Base@NewBase,MoveActor.Base != NewBase,'PlayerMove'); `log("- location mismatch, delta:"@VSize(MoveActor.Location - NewLocation),MoveActor.Location != NewLocation,'PlayerMove'); `log("- velocity mismatch, delta:"@VSize(NewVelocity - MoveActor.Velocity)@"client:"@VSize(MoveActor.Velocity)@"server:"@VSize(NewVelocity),MoveActor.Velocity != NewVelocity,'PlayerMove'); if (SkipPositionUpdateForRM()) { return; } if( (InterpActor(NewBase) != None) || (Vehicle(NewBase) != None) ) { NewLocation += NewBase.Location; } // `log("Client "$Role$" adjust "$self$" stamp "$TimeStamp$" location "$MoveActor.Location); MoveActor.bCanTeleport = FALSE; if ( !MoveActor.SetLocation(NewLocation) && (Pawn(MoveActor) != None) && (Pawn(MoveActor).CylinderComponent.CollisionHeight > Pawn(MoveActor).CrouchHeight) && !Pawn(MoveActor).bIsCrouched && (newPhysics == PHYS_Walking) && (MoveActor.Physics != PHYS_RigidBody) ) { MoveActor.SetPhysics(newPhysics); if( !MoveActor.SetLocation(NewLocation + vect(0,0,1)*Pawn(MoveActor).MaxStepHeight) ) { Pawn(MoveActor).ForceCrouch(); MoveActor.SetLocation(NewLocation); } else { MoveActor.MoveSmooth(vect(0,0,-1)*Pawn(MoveActor).MaxStepHeight); } } MoveActor.bCanTeleport = TRUE; // Hack. Don't let network change physics mode of rigid body stuff on the client. if( MoveActor.Physics != PHYS_RigidBody && newPhysics != PHYS_RigidBody ) { MoveActor.SetPhysics(newPhysics); } if( MoveActor != self ) { MoveActor.SetBase(NewBase, NewFloor); } MoveActor.Velocity = NewVelocity; UpdateStateFromAdjustment(NewState); bUpdatePosition = TRUE; `if(`notdefined(FINAL_RELEASE)) if( bDebugClientAdjustPosition ) { DrawDebugBox( OldLoc, vect(2,2,2), 0, 120, 0, TRUE ); DrawDebugBox( Pawn.Location, vect(3,3,3), 255, 255, 255, TRUE ); DrawDebugLine( Pawn.Location, OldLoc, 255, 255, 255, TRUE ); `log( `location@"!!!!!!!!!!!!!!"@SavedMoves@`showvar(Pawn.Rotation)@`showvar(WorldInfo.TimeSeconds)); } `endif } /** Called by LongClientAdjustPosition() @param NewState is the state recommended by the server */ function UpdateStateFromAdjustment(name NewState) { if( GetStateName() != newstate ) { GotoState(newstate); } } unreliable server function ServerUpdatePing(int NewPing) { PlayerReplicationInfo.Ping = Min(0.25 * NewPing, 250); } /* ClearAckedMoves() clear out acknowledged/missed sent moves */ function ClearAckedMoves() { local SavedMove CurrentMove; CurrentMove = SavedMoves; while ( CurrentMove != None ) { if ( CurrentMove.TimeStamp <= CurrentTimeStamp ) { if ( CurrentMove.TimeStamp == CurrentTimeStamp ) LastAckedAccel = CurrentMove.Acceleration; SavedMoves = CurrentMove.NextMove; CurrentMove.NextMove = FreeMoves; FreeMoves = CurrentMove; FreeMoves.Clear(); CurrentMove = SavedMoves; } else break; } } /** * Called from PlayerTick after receiving ClientAdjustPosition call from server (and setting the bUpdating flag) * Client has already had position information corrected * * This function plays through previously saved moves that haven't been acknowledged by the server, predicting where the client * should be after the server correction */ function ClientUpdatePosition() { local SavedMove CurrentMove; local int realbRun, realbDuck; local bool bRealJump; local bool bRealPreciseDestination; local bool bRealForceMaxAccel; local bool bRealRootMotionFromInterpCurve; local ERootMotionMode RealRootMotionMode; `if(`notdefined(FINAL_RELEASE)) local Vector OldLoc; `endif bUpdatePosition = FALSE; // Dont do any network position updates on things running PHYS_RigidBody if( Pawn != None && Pawn.Physics == PHYS_RigidBody ) { return; } `if(`notdefined(FINAL_RELEASE)) if( bDebugClientAdjustPosition ) { `log( `location@"!!!!!!!!!!!!!!"@SavedMoves@`showvar(Pawn.Rotation)@`showvar(WorldInfo.TimeSeconds)); } `endif realbRun = bRun; realbDuck = bDuck; bRealJump = bPressedJump; bUpdating = TRUE; bRealPreciseDestination = bPreciseDestination; if( Pawn != None ) { bRealForceMaxAccel = Pawn.bForceMaxAccel; bRealRootMotionFromInterpCurve = Pawn.bRootMotionFromInterpCurve; RealRootMotionMode = Pawn.Mesh.RootMotionMode; } ClearAckedMoves(); CurrentMove = SavedMoves; while( CurrentMove != None ) { if( (PendingMove == CurrentMove) && (Pawn != None) ) { PendingMove.SetInitialPosition(Pawn); } `if(`notdefined(FINAL_RELEASE)) if( bDebugClientAdjustPosition ) { `log( CurrentMove.GetDebugString() ); `log( "Old"@Pawn.Location@Pawn.bRootMotionFromInterpCurve@Pawn.RootMotionInterpCurrentTime ); OldLoc = Pawn.Location; } `endif CurrentMove.PrepMoveFor( Pawn ); MoveAutonomous(CurrentMove.Delta, CurrentMove.CompressedFlags(), CurrentMove.Acceleration, rot(0,0,0)); CurrentMove.ResetMoveFor( Pawn ); `if(`notdefined(FINAL_RELEASE)) if( bDebugClientAdjustPosition ) { `log( "New"@Pawn.Location@Pawn.bRootMotionFromInterpCurve@Pawn.RootMotionInterpCurrentTime ); DrawDebugBox( OldLoc, vect(4,4,4), 120, 0, 0, TRUE ); DrawDebugBox( Pawn.Location, vect(5,5,5), 0, 0, 120, TRUE ); DrawDebugLine( OldLoc + vect(0,0,2), Pawn.Location + vect(0,0,2), 0, 120, 0, TRUE ); } `endif CurrentMove = CurrentMove.NextMove; } bUpdating = FALSE; bDuck = realbDuck; bRun = realbRun; bPressedJump = bRealJump; bPreciseDestination = bRealPreciseDestination; if( Pawn != None ) { Pawn.bForceMaxAccel = bRealForceMaxAccel; Pawn.bRootMotionFromInterpCurve = bRealRootMotionFromInterpCurve; Pawn.Mesh.RootMotionMode = RealRootMotionMode; } } final function SavedMove GetFreeMove() { local SavedMove s, first; local int i; if ( FreeMoves == None ) { // don't allow more than 100 saved moves For ( s=SavedMoves; s!=None; s=s.NextMove ) { i++; if ( i > 100 ) { first = SavedMoves; SavedMoves = SavedMoves.NextMove; first.Clear(); first.NextMove = None; // clear out all the moves While ( SavedMoves != None ) { s = SavedMoves; SavedMoves = SavedMoves.NextMove; s.Clear(); s.NextMove = FreeMoves; FreeMoves = s; } PendingMove = None; return first; } } return new(self) SavedMoveClass; } else { s = FreeMoves; FreeMoves = FreeMoves.NextMove; s.NextMove = None; return s; } } function int CompressAccel(int C) { if ( C >= 0 ) C = Min(C, 127); else C = Min(abs(C), 127) + 128; return C; } /* ======================================================================== Here's how player movement prediction, replication and correction works in network games: Every tick, the PlayerTick() function is called. It calls the PlayerMove() function (which is implemented in various states). PlayerMove() figures out the acceleration and rotation, and then calls ProcessMove() (for single player or listen servers), or ReplicateMove() (if its a network client). ReplicateMove() saves the move (in the PendingMove list), calls ProcessMove(), and then replicates the move to the server by calling the replicated function ServerMove() - passing the movement parameters, the client's resultant position, and a timestamp. ServerMove() is executed on the server. It decodes the movement parameters and causes the appropriate movement to occur. It then looks at the resulting position and if enough time has passed since the last response, or the position error is significant enough, the server calls ClientAdjustPosition(), a replicated function. ClientAdjustPosition() is executed on the client. The client sets its position to the servers version of position, and sets the bUpdatePosition flag to true. When PlayerTick() is called on the client again, if bUpdatePosition is true, the client will call ClientUpdatePosition() before calling PlayerMove(). ClientUpdatePosition() replays all the moves in the pending move list which occured after the timestamp of the move the server was adjusting. */ // // Replicate this client's desired movement to the server. // function ReplicateMove ( float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot ) { local SavedMove NewMove, OldMove, AlmostLastMove, LastMove; local byte ClientRoll; local float NetMoveDelta; // do nothing if we are no longer connected if (Player == None) { return; } MaxResponseTime = Default.MaxResponseTime * WorldInfo.TimeDilation; DeltaTime = ((Pawn != None) ? Pawn.CustomTimeDilation : CustomTimeDilation) * FMin(DeltaTime, MaxResponseTime); // find the most recent move (LastMove), and the oldest (unacknowledged) important move (OldMove) // a SavedMove is interesting if it differs significantly from the last acknowledged move if ( SavedMoves != None ) { LastMove = SavedMoves; AlmostLastMove = LastMove; OldMove = None; while ( LastMove.NextMove != None ) { // find first important unacknowledged move if ( (OldMove == None) && (Pawn != None) && LastMove.IsImportantMove(LastAckedAccel) ) { OldMove = LastMove; } AlmostLastMove = LastMove; LastMove = LastMove.NextMove; } } // Get a SavedMove object to store the movement in. NewMove = GetFreeMove(); if ( NewMove == None ) { return; } NewMove.SetMoveFor(self, DeltaTime, NewAccel, DoubleClickMove); // Simulate the movement locally. bDoubleJump = false; ProcessMove(NewMove.Delta, NewMove.Acceleration, NewMove.DoubleClickMove, DeltaRot); // see if the two moves could be combined if ( (PendingMove != None) && PendingMove.CanCombineWith(NewMove, Pawn, MaxResponseTime) ) { // to combine move, first revert pawn position to PendingMove start position, before playing combined move on client Pawn.SetLocation(PendingMove.GetStartLocation()); Pawn.Velocity = PendingMove.StartVelocity; if( PendingMove.StartBase != Pawn.Base ) { Pawn.SetBase(PendingMove.StartBase); } Pawn.Floor = PendingMove.StartFloor; NewMove.Delta += PendingMove.Delta; NewMove.SetInitialPosition(Pawn); // remove pending move from move list if ( LastMove == PendingMove ) { if ( SavedMoves == PendingMove ) { SavedMoves.NextMove = FreeMoves; FreeMoves = SavedMoves; SavedMoves = None; } else { PendingMove.NextMove = FreeMoves; FreeMoves = PendingMove; if ( AlmostLastMove != None ) { AlmostLastMove.NextMove = None; LastMove = AlmostLastMove; } } FreeMoves.Clear(); } PendingMove = None; } if( Pawn != None ) { Pawn.AutonomousPhysics(NewMove.Delta); } else { AutonomousPhysics(DeltaTime); } NewMove.PostUpdate(self); if( SavedMoves == None ) { SavedMoves = NewMove; } else { LastMove.NextMove = NewMove; } if ( PendingMove == None ) { // Decide whether to hold off on move // send moves more frequently in small games where server isn't likely to be saturated if( (Player.CurrentNetSpeed > 10000) && (WorldInfo.GRI != None) && (WorldInfo.GRI.PRIArray.Length <= 10) ) { NetMoveDelta = 0.011; } else { NetMoveDelta = FMax(0.0222,2 * WorldInfo.MoveRepSize/Player.CurrentNetSpeed); } if( (WorldInfo.TimeSeconds - ClientUpdateTime) * WorldInfo.TimeDilation < NetMoveDelta ) { PendingMove = NewMove; return; } } ClientUpdateTime = WorldInfo.TimeSeconds; // Send to the server ClientRoll = (Rotation.Roll >> 8) & 255; CallServerMove( NewMove, ((Pawn == None) ? Location : Pawn.Location), ClientRoll, ((Rotation.Yaw & 65535) << 16) + (Rotation.Pitch & 65535), OldMove ); PendingMove = None; } /* CallServerMove() Call the appropriate replicated servermove() function to send a client player move to the server */ function CallServerMove ( SavedMove NewMove, vector ClientLoc, byte ClientRoll, int View, SavedMove OldMove ) { local vector BuildAccel; local byte OldAccelX, OldAccelY, OldAccelZ; // compress old move if it exists if ( OldMove != None ) { // old move important to replicate redundantly BuildAccel = 0.05 * OldMove.Acceleration + vect(0.5, 0.5, 0.5); OldAccelX = CompressAccel(BuildAccel.X); OldAccelY = CompressAccel(BuildAccel.Y); OldAccelZ = CompressAccel(BuildAccel.Z); OldServerMove(OldMove.TimeStamp,OldAccelX, OldAccelY, OldAccelZ, OldMove.CompressedFlags()); } if ( PendingMove != None ) { // send two moves simultaneously DualServerMove ( PendingMove.TimeStamp, PendingMove.Acceleration * 10, PendingMove.CompressedFlags(), ((PendingMove.Rotation.Yaw & 65535) << 16) + (PendingMove.Rotation.Pitch & 65535), NewMove.TimeStamp, NewMove.Acceleration * 10, ClientLoc, NewMove.CompressedFlags(), ClientRoll, View ); } else { ServerMove ( NewMove.TimeStamp, NewMove.Acceleration * 10, ClientLoc, NewMove.CompressedFlags(), ClientRoll, View ); } } /* HandleWalking: Called by PlayerController and PlayerInput to set bIsWalking flag, affecting Pawn's velocity */ function HandleWalking() { if ( Pawn != None ) Pawn.SetWalking( bRun != 0 ); } reliable server function ServerRestartGame() { } // Send a voice message of a certain type to a certain player. exec function Speech( name Type, int Index, string Callsign ) { ServerSpeech(Type,Index,Callsign); } reliable server function ServerSpeech( name Type, int Index, string Callsign ); exec function RestartLevel() { if( WorldInfo.NetMode==NM_Standalone ) { ClientTravel( "?restart", TRAVEL_Relative ); } } exec function LocalTravel( string URL ) { if( WorldInfo.NetMode==NM_Standalone ) ClientTravel( URL, TRAVEL_Relative ); } /** * Pause force-feedback for all local players. * * @param bShouldPauseRumble indicates whether force-feedback should be paused or unpaused. */ function PauseRumbleForAllPlayers( optional bool bShouldPauseRumble=true ) { local PlayerController PC; foreach LocalPlayerControllers( class'PlayerController', PC ) { if ( PC.ForceFeedbackManager != None ) { PC.ForceFeedbackManager.PauseWaveform(bShouldPauseRumble); } } } /** Callback the server uses to determine if the unpause can happen */ delegate bool CanUnpause() { return WorldInfo.Pauser == PlayerReplicationInfo; } /* SetPause() Try to pause game; returns success indicator. Replicated to server in network games. */ function bool SetPause( bool bPause, optional delegate<CanUnpause> CanUnpauseDelegate=CanUnpause) { local bool bResult; if (WorldInfo.NetMode != NM_Client) { if (bPause) { bFire = 0; // Pause gamepad rumbling too if needed bResult = WorldInfo.Game.SetPause(self,CanUnpauseDelegate); if (bResult) { PauseRumbleForAllPlayers(); } } else { WorldInfo.Game.ClearPause(); // If the unpause is complete, let rumble occur if ( WorldInfo.Pauser == None ) { PauseRumbleForAllPlayers(false); } } } return bResult; } /** * Returns whether the game is currently paused. */ final simulated function bool IsPaused() { return WorldInfo.Pauser != None; } /* Pause() Command to try to pause the game. */ exec function Pause() { ServerPause(); } reliable server function ServerPause() { // Pause if not already if( !IsPaused() ) SetPause(true); else SetPause(false); } /** * Toggles the game's paused state if it does not match the desired pause state. * * @param bDesiredPauseState TRUE indicates that the game should be paused. */ event ConditionalPause( bool bDesiredPauseState ) { if ( bDesiredPauseState != IsPaused() ) { SetPause(bDesiredPauseState); } } reliable server function ServerUTrace() { if (WorldInfo.NetMode != NM_Standalone && (PlayerReplicationInfo == None || !PlayerReplicationInfo.bAdmin) ) { return; } UTrace(); } exec function UTrace() { // disable the log, or we'll grind the game to a halt ConsoleCommand("hidelog"); if ( Role != ROLE_Authority ) { ServerUTrace(); } SetUTracing( !IsUTracing() ); `log("UTracing changed to "$ IsUTracing() $ " at "$ WorldInfo.TimeSeconds,,'UTrace'); } // ------------------------------------------------------------------------ // Weapon changing functions /* ThrowWeapon() Throw out current weapon, and switch to a new weapon */ exec function ThrowWeapon() { if ( (Pawn == None) || (Pawn.Weapon == None) ) return; ServerThrowWeapon(); } reliable server function ServerThrowWeapon() { if ( Pawn.CanThrowWeapon() ) { Pawn.ThrowActiveWeapon(); } } /* PrevWeapon() - switch to previous inventory group weapon */ exec function PrevWeapon() { if ( WorldInfo.Pauser!=None ) return; if ( Pawn.Weapon == None ) { SwitchToBestWeapon(); return; } if ( Pawn.InvManager != None ) Pawn.InvManager.PrevWeapon(); } /* NextWeapon() - switch to next inventory group weapon */ exec function NextWeapon() { if ( WorldInfo.Pauser!=None ) return; if ( Pawn.Weapon == None ) { SwitchToBestWeapon(); return; } if ( Pawn.InvManager != None ) Pawn.InvManager.NextWeapon(); } // The player wants to fire. exec function StartFire( optional byte FireModeNum ) { if ( WorldInfo.Pauser == PlayerReplicationInfo ) { SetPause( false ); return; } if ( Pawn != None && !bCinematicMode && !WorldInfo.bPlayersOnly ) { Pawn.StartFire( FireModeNum ); } } exec function StopFire( optional byte FireModeNum ) { if ( Pawn != None ) { Pawn.StopFire( FireModeNum ); } } // The player wants to alternate-fire. exec function StartAltFire( optional Byte FireModeNum ) { StartFire( 1 ); } exec function StopAltFire( optional byte FireModeNum ) { StopFire( 1 ); } /** * Looks at all nearby triggers, looking for any that can be * interacted with. * * @param interactDistanceToCheck - distance to search for nearby triggers * * @param crosshairDist - distance from the crosshair that * triggers must be, else they will be filtered out * * @param minDot - minimum dot product between trigger and the * camera orientation needed to make the list * * @param bUsuableOnly - if true, event must return true from * SequenceEvent::CheckActivate() * * @param out_useList - the list of triggers found to be * usuable */ function GetTriggerUseList(float interactDistanceToCheck, float crosshairDist, float minDot, bool bUsuableOnly, out array<Trigger> out_useList) { local int Idx; local vector cameraLoc; local rotator cameraRot; local Trigger checkTrigger; local SeqEvent_Used UseSeq; if (Pawn != None) { // grab camera location/rotation for checking crosshairDist GetPlayerViewPoint(cameraLoc, cameraRot); // This doesn't work how it should. It really needs to query ALL of the triggers and get their // InteractDistance and then compare those against the pawn's location and then do the various checks // search of nearby actors that have use events foreach Pawn.CollidingActors(class'Trigger',checkTrigger,interactDistanceToCheck) { for (Idx = 0; Idx < checkTrigger.GeneratedEvents.Length; Idx++) { UseSeq = SeqEvent_Used(checkTrigger.GeneratedEvents[Idx]); if( ( UseSeq != None ) // if bUsuableOnly is true then we must get true back from CheckActivate (which tests various validity checks on the player and on the trigger's trigger count and retrigger conditions etc) && ( !bUsuableOnly || ( checkTrigger.GeneratedEvents[Idx].CheckActivate(checkTrigger,Pawn,true)) ) // check to see if we are looking at the object && ( Normal(checkTrigger.Location-cameraLoc) dot vector(cameraRot) >= minDot ) // if this is an aimToInteract then check to see if we are aiming at the object and we are inside the InteractDistance (NOTE: we need to do use a number close to 1.0 as the dot will give a number that is very close to 1.0 for aiming at the target) && ( ( ( UseSeq.bAimToInteract && IsAimingAt( checkTrigger, 0.98f ) && ( VSize(Pawn.Location - checkTrigger.Location) <= UseSeq.InteractDistance ) ) ) // if we should NOT aim to interact then we need to be close to the trigger || ( !UseSeq.bAimToInteract && ( VSize(Pawn.Location - checkTrigger.Location) <= UseSeq.InteractDistance ) ) // this should be UseSeq.InteractDistance ) ) { out_useList[out_useList.Length] = checkTrigger; // don't bother searching for more events Idx = checkTrigger.GeneratedEvents.Length; } } } } } /** * Entry point function for player interactions with the world, * re-directs to ServerUse. */ exec function Use() { if( Role < Role_Authority ) { PerformedUseAction(); } ServerUse(); } /** * Player pressed UseKey */ unreliable server function ServerUse() { PerformedUseAction(); } /** * return true if player the Use action was handled */ function bool PerformedUseAction() { // if the level is paused, if( WorldInfo.Pauser == PlayerReplicationInfo ) { if( Role == Role_Authority ) { // unpause and move on SetPause( false ); } return true; } if ( Pawn == None ) { return true; } // below is only on server if( Role < Role_Authority ) { return false; } // leave vehicle if currently in one if( Vehicle(Pawn) != None ) { return Vehicle(Pawn).DriverLeave(false); } // try to find a vehicle to drive if( FindVehicleToDrive() ) { return true; } // try to interact with triggers return TriggerInteracted(); } /** Tries to find a vehicle to drive within a limited radius. Returns true if successful */ function bool FindVehicleToDrive() { local Vehicle V, Best; local vector ViewDir, PawnLoc2D, VLoc2D; local float NewDot, BestDot; if (Vehicle(Pawn.Base) != None && Vehicle(Pawn.Base).TryToDrive(Pawn)) { return true; } // Pick best nearby vehicle PawnLoc2D = Pawn.Location; PawnLoc2D.Z = 0; ViewDir = vector(Pawn.Rotation); ForEach Pawn.OverlappingActors(class'Vehicle', V, Pawn.VehicleCheckRadius) { // Prefer vehicles that Pawn is facing VLoc2D = V.Location; Vloc2D.Z = 0; NewDot = Normal(VLoc2D-PawnLoc2D) Dot ViewDir; if ( (Best == None) || (NewDot > BestDot) ) { // check that vehicle is visible if ( FastTrace(V.Location,Pawn.Location) ) { Best = V; BestDot = NewDot; } } } return (Best != None && Best.TryToDrive(Pawn)); } /** * Examines the nearby enviroment and generates a priority sorted * list of interactable actors, and then attempts to activate each * of them until either one was successfully activated, or no more * actors are available. */ function bool TriggerInteracted() { local Actor A; local int Idx; local float Weight; local bool bInserted; local vector cameraLoc; local rotator cameraRot; local array<Trigger> useList; // the following 2 arrays should always match in length local array<Actor> sortedList; local array<float> weightList; if ( Pawn != None ) { GetTriggerUseList(InteractDistance,60.f,0.f,true,useList); // if we have found some interactable actors, if (useList.Length > 0) { // grab the current camera location/rotation for weighting purposes GetPlayerViewPoint(cameraLoc, cameraRot); // then build the sorted list while (useList.Length > 0) { // pop the actor off this list A = useList[useList.Length-1]; useList.Length = useList.Length - 1; // calculate the weight of this actor in terms of optimal interaction // first based on the dot product from our view rotation weight = Normal(A.Location-cameraLoc) dot vector(cameraRot); // and next on the distance weight += 1.f - (VSize(A.Location-Pawn.Location)/InteractDistance); // find the optimal insertion point bInserted = false; for (Idx = 0; Idx < sortedList.Length && !bInserted; Idx++) { if (weightList[Idx] < weight) { // insert the new entry sortedList.Insert(Idx,1); weightList.Insert(Idx,1); sortedList[Idx] = A; weightList[Idx] = weight; bInserted = true; } } // if no insertion was made if (!bInserted) { // then tack on the end of the list Idx = sortedList.Length; sortedList[Idx] = A; weightList[Idx] = weight; } } // finally iterate through each actor in the sorted list and // attempt to activate it until one succeeds or none are left for (Idx = 0; Idx < sortedList.Length; Idx++) { if (sortedList[Idx].UsedBy(Pawn)) { // skip the rest // Idx = sortedList.Length; return true; } } } } return false; } exec function Suicide() { ServerSuicide(); } reliable server function ServerSuicide() { if ( (Pawn != None) && ((WorldInfo.TimeSeconds - Pawn.LastStartTime > 10) || (WorldInfo.NetMode == NM_Standalone)) ) { Pawn.Suicide(); } } exec function SetName(coerce string S) { local string NewName; local LocalPlayer LocPlayer; if (S != "") { LocPlayer = LocalPlayer(Player); if (LocPlayer != None && OnlineSub.GameInterface != None && OnlineSub.PlayerInterface != None) { // Check to see if they are logged in locally or not if (OnlineSub.PlayerInterface.GetLoginStatus(LocPlayer.ControllerId) == LS_LoggedIn && OnlineSub.GameInterface.GetGameSettings('Game') != None) { // Ignore what ever was specified and use the profile's nick S = OnlineSub.PlayerInterface.GetPlayerNickname(LocPlayer.ControllerId); } } NewName = S; ServerChangeName(NewName); UpdateURL("Name", NewName, true); SaveConfig(); } } reliable server function ServerChangeName( coerce string S ) { if (S != "") { WorldInfo.Game.ChangeName( self, S, true ); } } exec function SwitchTeam() { if ( (PlayerReplicationInfo.Team == None) || (PlayerReplicationInfo.Team.TeamIndex == 1) ) { ServerChangeTeam(0); } else { ServerChangeTeam(1); } } exec function ChangeTeam( optional string TeamName ) { local int N; if ( TeamName ~= "blue" ) N = 1; else if ( (TeamName ~= "red") || (PlayerReplicationInfo == None) || (PlayerReplicationInfo.Team == None) || (PlayerReplicationInfo.Team.TeamIndex > 1) ) N = 0; else N = 1 - PlayerReplicationInfo.Team.TeamIndex; ServerChangeTeam(N); } reliable server function ServerChangeTeam(int N) { local TeamInfo OldTeam; OldTeam = PlayerReplicationInfo.Team; WorldInfo.Game.ChangeTeam(self, N, true); if (WorldInfo.Game.bTeamGame && PlayerReplicationInfo.Team != OldTeam) { if (Pawn != None) { Pawn.PlayerChangedTeam(); } } } exec function SwitchLevel(string URL) { if (WorldInfo.NetMode == NM_Standalone || WorldInfo.NetMode == NM_ListenServer) { WorldInfo.ServerTravel(URL); } } /** server to client RPC for server-generated network messages that aren't part of the connection process (e.g. being kicked) */ reliable client event ClientSetProgressMessage(EProgressMessageType MessageType, string Message, optional string Title, optional bool bIgnoreFutureNetworkMessages) { if (LocalPlayer(Player) != None) { LocalPlayer(Player).ViewportClient.SetProgressMessage(MessageType, Message, Title, bIgnoreFutureNetworkMessages); } else { `Warn("Discarded progress message due to no viewport:" @ MessageType @ Message @ Title); } } function Restart(bool bVehicleTransition) { Super.Restart(bVehicleTransition); ServerTimeStamp = 0; ResetTimeMargin(); EnterStartState(); ClientRestart(Pawn); SetViewTarget(Pawn); ResetCameraMode(); } /** called to notify the server when the client has loaded a new world via seamless travelling * @param WorldPackageName the name of the world package that was loaded */ reliable server native final event ServerNotifyLoadedWorld(name WorldPackageName); /** called clientside when it is loaded a new world via seamless travelling * @param WorldPackageName the name of the world package that was loaded * @param bFinalDest whether this world is the destination map for the travel (i.e. not the transition level) */ event NotifyLoadedWorld(name WorldPackageName, bool bFinalDest) { local PlayerStart P; local rotator SpawnRotation; // place the camera at the first playerstart we can find SetViewTarget(self); foreach WorldInfo.AllNavigationPoints(class'PlayerStart', P) { SetLocation(P.Location); SpawnRotation.Yaw = P.Rotation.Yaw; SetRotation(SpawnRotation); break; } } /** returns whether the client has completely loaded the server's current world (valid on server only) */ native final function bool HasClientLoadedCurrentWorld(); /** forces a full replication check of the specified Actor on only the client that owns this PlayerController * (equivalent to setting bForceNetUpdate and bNetDirty to true, but only for that client) * this function has no effect if this PC is not a remote client or if the Actor is not relevant to that client */ native final function ForceSingleNetUpdateFor(Actor Target); function EnterStartState() { local name NewState; if ( Pawn.PhysicsVolume.bWaterVolume ) { if ( Pawn.HeadVolume.bWaterVolume ) { Pawn.BreathTime = Pawn.UnderWaterTime; } NewState = Pawn.WaterMovementState; } else { NewState = Pawn.LandMovementState; } if (GetStateName() == NewState) { BeginState(NewState); } else { GotoState(NewState); } } reliable client function ClientRestart(Pawn NewPawn) { ResetPlayerMovementInput(); CleanOutSavedMoves(); // don't replay moves previous to possession Pawn = NewPawn; if ( (Pawn != None) && Pawn.bTearOff ) { UnPossess(); Pawn = None; } AcknowledgePossession(Pawn); if ( Pawn == None ) { GotoState('WaitingForPawn'); return; } Pawn.ClientRestart(); if (Role < ROLE_Authority) { SetViewTarget(Pawn); ResetCameraMode(); EnterStartState(); } CleanOutSavedMoves(); } /* epic =============================================== * ::GameHasEnded * * Called from game info upon end of the game, used to * transition to proper state. * * ===================================================== */ function GameHasEnded(optional Actor EndGameFocus, optional bool bIsWinner) { // and transition to the game ended state SetViewTarget(EndGameFocus); GotoState('RoundEnded'); ClientGameEnded(EndGameFocus, bIsWinner); } /* epic =============================================== * ::ClientGameEnded * * Replicated function called by GameHasEnded(). * * @param EndGameFocus - actor to view with camera * @param bIsWinner - true if this controller is on winning team * ===================================================== */ reliable client function ClientGameEnded(Actor EndGameFocus, bool bIsWinner) { SetViewTarget(EndGameFocus); GotoState('RoundEnded'); } // Just changed to pendingWeapon function NotifyChangedWeapon( Weapon PreviousWeapon, Weapon NewWeapon ); /** * PlayerTick is only called if the PlayerController has a PlayerInput object. Therefore, it will not be called on servers for non-locally controlled playercontrollers */ event PlayerTick( float DeltaTime ) { if ( !bShortConnectTimeOut ) { bShortConnectTimeOut = true; ServerShortTimeout(); } if ( Pawn != AcknowledgedPawn ) { if ( Role < ROLE_Authority ) { // make sure old pawn controller is right if ( (AcknowledgedPawn != None) && (AcknowledgedPawn.Controller == self) ) AcknowledgedPawn.Controller = None; } AcknowledgePossession(Pawn); } PlayerInput.PlayerInput(DeltaTime); if ( bUpdatePosition ) { ClientUpdatePosition(); } PlayerMove(DeltaTime); AdjustFOV(DeltaTime); } function PlayerMove(float DeltaTime); function bool AimingHelp(bool bInstantHit) { return (WorldInfo.NetMode == NM_Standalone) && bAimingHelp; } /** The function called when a CameraLookAt action is deactivated from kismet */ event CameraLookAtFinished(SeqAct_CameraLookAt Action); /** * Adjusts weapon aiming direction. * Gives controller a chance to modify the aiming of the pawn. For example aim error, auto aiming, adhesion, AI help... * Requested by weapon prior to firing. * * @param W, weapon about to fire * @param StartFireLoc, world location of weapon fire start trace, or projectile spawn loc. * @param BaseAimRot, original aiming rotation without any modifications. */ function Rotator GetAdjustedAimFor( Weapon W, vector StartFireLoc ) { local vector FireDir, AimSpot, HitLocation, HitNormal, OldAim, AimOffset; local actor BestTarget, HitActor; local float bestAim, bestDist; local bool bNoZAdjust, bInstantHit; local rotator BaseAimRot, AimRot; bInstantHit = ( W == None || W.bInstantHit ); BaseAimRot = (Pawn != None) ? Pawn.GetBaseAimRotation() : Rotation; FireDir = vector(BaseAimRot); HitActor = Trace(HitLocation, HitNormal, StartFireLoc + W.GetTraceRange() * FireDir, StartFireLoc, true); if ( (HitActor != None) && HitActor.bProjTarget ) { BestTarget = HitActor; bNoZAdjust = true; OldAim = HitLocation; BestDist = VSize(BestTarget.Location - Pawn.Location); } else { // adjust aim based on FOV bestAim = 0.90; if ( AimingHelp(bInstantHit) ) { bestAim = AimHelpDot(bInstantHit); } else if ( bInstantHit ) bestAim = 1.0; BestTarget = PickTarget(class'Pawn', bestAim, bestDist, FireDir, StartFireLoc, W.WeaponRange); if ( BestTarget == None ) { return BaseAimRot; } OldAim = StartFireLoc + FireDir * bestDist; } ShotTarget = Pawn(BestTarget); if ( !AimingHelp(bInstantHit) ) { return BaseAimRot; } // aim at target - help with leading also FireDir = BestTarget.Location - StartFireLoc; AimSpot = StartFireLoc + bestDist * Normal(FireDir); AimOffset = AimSpot - OldAim; if ( ShotTarget != None ) { // adjust Z of shooter if necessary if ( bNoZAdjust ) AimSpot.Z = OldAim.Z; else if ( AimOffset.Z < 0 ) AimSpot.Z = ShotTarget.Location.Z + 0.4 * ShotTarget.CylinderComponent.CollisionHeight; else AimSpot.Z = ShotTarget.Location.Z - 0.7 * ShotTarget.CylinderComponent.CollisionHeight; } else AimSpot.Z = OldAim.Z; // if not leading, add slight random error ( significant at long distances ) if ( !bNoZAdjust ) { AimRot = rotator(AimSpot - StartFireLoc); if ( FOVAngle < DefaultFOV - 8 ) AimRot.Yaw = AimRot.Yaw + 200 - Rand(400); else AimRot.Yaw = AimRot.Yaw + 375 - Rand(750); return AimRot; } return rotator(AimSpot - StartFireLoc); } /** AimHelpDot() * @returns the dot product corresponding to the maximum deflection of target for which aiming help should be applied */ function float AimHelpDot(bool bInstantHit) { if ( FOVAngle < DefaultFOV - 8 ) return 0.99; if ( bInstantHit ) return 0.97; return 0.93; } event bool NotifyLanded(vector HitNormal, Actor FloorActor) { return bUpdating; } //============================================================================= // Player Control // Player view. // Compute the rendering viewpoint for the player. // /** AdjustFOV() FOVAngle smoothly interpolates to DesiredFOV */ function AdjustFOV(float DeltaTime ) { if ( FOVAngle != DesiredFOV ) { if ( FOVAngle > DesiredFOV ) FOVAngle = FOVAngle - FMax(7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); else FOVAngle = FOVAngle - FMin(-7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); if ( Abs(FOVAngle - DesiredFOV) <= 10 ) FOVAngle = DesiredFOV; } } /** returns player's FOV angle */ event float GetFOVAngle() { return (PlayerCamera != None) ? PlayerCamera.GetFOVAngle() : FOVAngle; } /** returns whether this Controller is a locally controlled PlayerController * @note not valid until the Controller is completely spawned (i.e, unusable in Pre/PostBeginPlay()) */ native function bool IsLocalPlayerController(); native function SetViewTarget(Actor NewViewTarget, optional ViewTargetTransitionParams TransitionParams); /** Wrapper to SetViewTarget with useful defaults */ final function SetViewTargetWithBlend(Actor NewViewTarget, optional float BlendTime = 0.35, optional EViewTargetBlendFunction BlendFunc = VTBlend_Cubic, optional float BlendExp = 2.f, optional bool bLockOutgoing = FALSE) { local ViewTargetTransitionParams TransitionParams; TransitionParams.BlendTime = BlendTime; TransitionParams.BlendFunction = BlendFunc; TransitionParams.BlendExp = BlendExp; TransitionParams.bLockOutgoing = bLockOutgoing; SetViewTarget(NewViewTarget,TransitionParams); } reliable client event ClientSetViewTarget( Actor A, optional ViewTargetTransitionParams TransitionParams ) { if (!bClientSimulatingViewTarget) { if( A == None ) { ServerVerifyViewTarget(); } SetViewTarget(A, TransitionParams); } } native function Actor GetViewTarget(); reliable server function ServerVerifyViewTarget() { local Actor TheViewTarget; TheViewTarget = GetViewTarget(); if( TheViewTarget == Self ) { return; } ClientSetViewTarget( TheViewTarget ); } event SpawnPlayerCamera() { if( CameraClass != None && IsLocalPlayerController() ) { // Associate Camera with PlayerController PlayerCamera = Spawn( CameraClass, self ); if( PlayerCamera != None ) { PlayerCamera.InitializeFor( self ); } else { `Log( "Couldn't Spawn Camera Actor for Player!!" ); } } else { // not having a CameraClass is fine. Another class will handing the "camera" type duties // usually PlayerController } } /** * Returns Player's Point of View * For the AI this means the Pawn's 'Eyes' ViewPoint * For a Human player, this means the Camera's ViewPoint * * @output out_Location, view location of player * @output out_rotation, view rotation of player */ simulated event GetPlayerViewPoint( out vector out_Location, out Rotator out_Rotation ) { local Actor TheViewTarget; // sometimes the PlayerCamera can be none and we probably do not want this // so we will check to see if we have a CameraClass. Having a CameraClass is // saying: we want a camera so make certain one exists by spawning one if( PlayerCamera == None ) { if( CameraClass != None ) { // Associate Camera with PlayerController PlayerCamera = Spawn(CameraClass, Self); if( PlayerCamera != None ) { PlayerCamera.InitializeFor( Self ); } else { `log("Couldn't Spawn Camera Actor for Player!!"); } } } if( PlayerCamera != None ) { PlayerCamera.GetCameraViewPoint(out_Location, out_Rotation); } else { TheViewTarget = GetViewTarget(); if( TheViewTarget != None ) { out_Location = TheViewTarget.Location; out_Rotation = TheViewTarget.Rotation; } else { super.GetPlayerViewPoint(out_Location, out_Rotation); } } } /** Updates any camera view shaking that is going on */ function ViewShake(float DeltaTime); function UpdateRotation( float DeltaTime ) { local Rotator DeltaRot, newRotation, ViewRotation; ViewRotation = Rotation; if (Pawn!=none) { Pawn.SetDesiredRotation(ViewRotation); } // Calculate Delta to be applied on ViewRotation DeltaRot.Yaw = PlayerInput.aTurn; DeltaRot.Pitch = PlayerInput.aLookUp; ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot ); SetRotation(ViewRotation); ViewShake( deltaTime ); NewRotation = ViewRotation; NewRotation.Roll = Rotation.Roll; if ( Pawn != None ) Pawn.FaceRotation(NewRotation, deltatime); } /** * Processes the player's ViewRotation * adds delta rot (player input), applies any limits and post-processing * returns the final ViewRotation set on PlayerController * * @param DeltaTime, time since last frame * @param ViewRotation, current player ViewRotation * @param DeltaRot, player input added to ViewRotation */ function ProcessViewRotation( float DeltaTime, out Rotator out_ViewRotation, Rotator DeltaRot ) { if( PlayerCamera != None ) { PlayerCamera.ProcessViewRotation( DeltaTime, out_ViewRotation, DeltaRot ); } if ( Pawn != None ) { // Give the Pawn a chance to modify DeltaRot (limit view for ex.) Pawn.ProcessViewRotation( DeltaTime, out_ViewRotation, DeltaRot ); } else { // If Pawn doesn't exist, limit view // Add Delta Rotation out_ViewRotation += DeltaRot; out_ViewRotation = LimitViewRotation(out_ViewRotation, -16384, 16383 ); } } /** * Limit the player's view rotation. (Pitch component). */ event Rotator LimitViewRotation( Rotator ViewRotation, float ViewPitchMin, float ViewPitchMax ) { ViewRotation.Pitch = ViewRotation.Pitch & 65535; if( ViewRotation.Pitch > ViewPitchMax && ViewRotation.Pitch < (65535+ViewPitchMin) ) { if( ViewRotation.Pitch < 32768 ) { ViewRotation.Pitch = ViewPitchMax; } else { ViewRotation.Pitch = 65535 + ViewPitchMin; } } return ViewRotation; } /* CheckJumpOrDuck() Called by ProcessMove() handle jump and duck buttons which are pressed */ function CheckJumpOrDuck() { if ( bPressedJump && (Pawn != None) ) { Pawn.DoJump( bUpdating ); } } // Player movement. // Player Standing, walking, running, falling. state PlayerWalking { ignores SeePlayer, HearNoise, Bump; event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( NewVolume.bWaterVolume && Pawn.bCollideWorld ) { GotoState(Pawn.WaterMovementState); } } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { if( Pawn == None ) { return; } if (Role == ROLE_Authority) { // Update ViewPitch for remote clients Pawn.SetRemoteViewPitch( Rotation.Pitch ); } Pawn.Acceleration = NewAccel; CheckJumpOrDuck(); } function PlayerMove( float DeltaTime ) { local vector X,Y,Z, NewAccel; local eDoubleClickDir DoubleClickMove; local rotator OldRotation; local bool bSaveJump; if( Pawn == None ) { GotoState('Dead'); } else { GetAxes(Pawn.Rotation,X,Y,Z); // Update acceleration. NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y; NewAccel.Z = 0; NewAccel = Pawn.AccelRate * Normal(NewAccel); DoubleClickMove = PlayerInput.CheckForDoubleClickMove( DeltaTime/WorldInfo.TimeDilation ); // Update rotation. OldRotation = Rotation; UpdateRotation( DeltaTime ); bDoubleJump = false; if( bPressedJump && Pawn.CannotJumpNow() ) { bSaveJump = true; bPressedJump = false; } else { bSaveJump = false; } if( Role < ROLE_Authority ) // then save this move and replicate it { ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation); } else { ProcessMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation); } bPressedJump = bSaveJump; } } event BeginState(Name PreviousStateName) { DoubleClickDir = DCLICK_None; bPressedJump = false; GroundPitch = 0; if ( Pawn != None ) { Pawn.ShouldCrouch(false); if (Pawn.Physics != PHYS_Falling && Pawn.Physics != PHYS_RigidBody) // FIXME HACK!!! Pawn.SetPhysics(Pawn.WalkingPhysics); } } event EndState(Name NextStateName) { GroundPitch = 0; if ( Pawn != None ) { Pawn.SetRemoteViewPitch( 0 ); if ( bDuck == 0 ) { Pawn.ShouldCrouch(false); } } } Begin: } // player is climbing ladder state PlayerClimbing { ignores SeePlayer, HearNoise, Bump; event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { if( NewVolume.bWaterVolume ) { GotoState( Pawn.WaterMovementState ); } else { GotoState( Pawn.LandMovementState ); } } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { if( Pawn == None ) { return; } if (Role == ROLE_Authority) { // Update ViewPitch for remote clients Pawn.SetRemoteViewPitch( Rotation.Pitch ); } Pawn.Acceleration = NewAccel; if( bPressedJump ) { Pawn.DoJump( bUpdating ); if( Pawn.Physics == PHYS_Falling ) { GotoState(Pawn.LandMovementState); } } } function PlayerMove( float DeltaTime ) { local vector X,Y,Z, NewAccel; local rotator OldRotation, ViewRotation; GetAxes(Rotation,X,Y,Z); // Update acceleration. if ( Pawn.OnLadder != None ) { NewAccel = PlayerInput.aForward*Pawn.OnLadder.ClimbDir; if ( Pawn.OnLadder.bAllowLadderStrafing ) NewAccel += PlayerInput.aStrafe*Y; } else NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y; NewAccel = Pawn.AccelRate * Normal(NewAccel); ViewRotation = Rotation; // Update rotation. SetRotation(ViewRotation); OldRotation = Rotation; UpdateRotation( DeltaTime ); if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); else ProcessMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); bPressedJump = false; } event BeginState(Name PreviousStateName) { Pawn.ShouldCrouch(false); bPressedJump = false; } event EndState(Name NextStateName) { if ( Pawn != None ) { Pawn.SetRemoteViewPitch( 0 ); Pawn.ShouldCrouch(false); } } } // Player Driving a vehicle. state PlayerDriving { ignores SeePlayer, HearNoise, Bump; function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot); // Set the throttle, steering etc. for the vehicle based on the input provided function ProcessDrive(float InForward, float InStrafe, float InUp, bool InJump) { local Vehicle CurrentVehicle; CurrentVehicle = Vehicle(Pawn); if (CurrentVehicle != None) { //`log("Forward:"@InForward@" Strafe:"@InStrafe@" Up:"@InUp); bPressedJump = InJump; CurrentVehicle.SetInputs(InForward, -InStrafe, InUp); CheckJumpOrDuck(); } } function PlayerMove( float DeltaTime ) { // update 'looking' rotation UpdateRotation(DeltaTime); // TODO: Don't send things like aForward and aStrafe for gunners who don't need it // Only servers can actually do the driving logic. ProcessDrive(PlayerInput.RawJoyUp, PlayerInput.RawJoyRight, PlayerInput.aUp, bPressedJump); if (Role < ROLE_Authority) { ServerDrive(PlayerInput.RawJoyUp, PlayerInput.RawJoyRight, PlayerInput.aUp, bPressedJump, ((Rotation.Yaw & 65535) << 16) + (Rotation.Pitch & 65535)); } bPressedJump = false; } unreliable server function ServerUse() { local Vehicle CurrentVehicle; CurrentVehicle = Vehicle(Pawn); CurrentVehicle.DriverLeave(false); } event BeginState(Name PreviousStateName) { CleanOutSavedMoves(); } event EndState(Name NextStateName) { CleanOutSavedMoves(); } } // Player movement. // Player Swimming state PlayerSwimming { ignores SeePlayer, HearNoise, Bump; event bool NotifyLanded(vector HitNormal, Actor FloorActor) { if ( Pawn.PhysicsVolume.bWaterVolume ) Pawn.SetPhysics(PHYS_Swimming); else GotoState(Pawn.LandMovementState); return bUpdating; } event NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { local actor HitActor; local vector HitLocation, HitNormal, Checkpoint; local vector X,Y,Z; if ( !Pawn.bCollideActors ) { GotoState(Pawn.LandMovementState); } if (Pawn.Physics != PHYS_RigidBody) { if ( !NewVolume.bWaterVolume ) { Pawn.SetPhysics(PHYS_Falling); if ( Pawn.Velocity.Z > 0 ) { GetAxes(Rotation,X,Y,Z); Pawn.bUpAndOut = ((X Dot Pawn.Acceleration) > 0) && ((Pawn.Acceleration.Z > 0) || (Rotation.Pitch > 2048)); if (Pawn.bUpAndOut && Pawn.CheckWaterJump(HitNormal)) //check for waterjump { Pawn.velocity.Z = Pawn.OutOfWaterZ; //set here so physics uses this for remainder of tick GotoState(Pawn.LandMovementState); } else if ( (Pawn.Velocity.Z > 160) || !Pawn.TouchingWaterVolume() ) GotoState(Pawn.LandMovementState); else //check if in deep water { Checkpoint = Pawn.Location; Checkpoint.Z -= (Pawn.CylinderComponent.CollisionHeight + 6.0); HitActor = Trace(HitLocation, HitNormal, Checkpoint, Pawn.Location, false); if (HitActor != None) GotoState(Pawn.LandMovementState); else { SetTimer(0.7, false); } } } } else { ClearTimer(); Pawn.SetPhysics(PHYS_Swimming); } } else if (!NewVolume.bWaterVolume) { // if in rigid body, go to appropriate state, but don't modify pawn physics GotoState(Pawn.LandMovementState); } } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { Pawn.Acceleration = NewAccel; } function PlayerMove(float DeltaTime) { local rotator oldRotation; local vector X,Y,Z, NewAccel; if (Pawn == None) { GotoState('Dead'); } else { GetAxes(Rotation,X,Y,Z); NewAccel = PlayerInput.aForward*X + PlayerInput.aStrafe*Y + PlayerInput.aUp*vect(0,0,1); NewAccel = Pawn.AccelRate * Normal(NewAccel); // Update rotation. oldRotation = Rotation; UpdateRotation( DeltaTime ); if ( Role < ROLE_Authority ) // then save this move and replicate it { ReplicateMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); } else { ProcessMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); } bPressedJump = false; } } event Timer() { if (!Pawn.PhysicsVolume.bWaterVolume && Role == ROLE_Authority) { GotoState(Pawn.LandMovementState); } ClearTimer(); } event BeginState(Name PreviousStateName) { ClearTimer(); if (Pawn.Physics != PHYS_RigidBody) { Pawn.SetPhysics(PHYS_Swimming); } } Begin: } state PlayerFlying { ignores SeePlayer, HearNoise, Bump; function PlayerMove(float DeltaTime) { local vector X,Y,Z; GetAxes(Rotation,X,Y,Z); Pawn.Acceleration = PlayerInput.aForward*X + PlayerInput.aStrafe*Y + PlayerInput.aUp*vect(0,0,1);; Pawn.Acceleration = Pawn.AccelRate * Normal(Pawn.Acceleration); if ( bCheatFlying && (Pawn.Acceleration == vect(0,0,0)) ) Pawn.Velocity = vect(0,0,0); // Update rotation. UpdateRotation( DeltaTime ); 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(Name PreviousStateName) { Pawn.SetPhysics(PHYS_Flying); } } function bool IsSpectating() { return false; } /** when spectating, tells server where the client is (client is authoritative on location when spectating) */ unreliable server function ServerSetSpectatorLocation(vector NewLoc) { // if we receive this here, the client is in the wrong state; tell it what state it should be in if (WorldInfo.TimeSeconds != LastSpectatorStateSynchTime) { ClientGotoState(GetStateName()); ClientSetViewTarget(GetViewTarget()); LastSpectatorStateSynchTime = WorldInfo.TimeSeconds; } } state BaseSpectating { function bool IsSpectating() { return true; } /** * Adjust spectator velocity if "out of bounds" * (above stallz or below killz) */ function bool LimitSpectatorVelocity() { if ( Location.Z > WorldInfo.StallZ ) { Velocity.Z = FMin(SpectatorCameraSpeed, WorldInfo.StallZ - Location.Z - 2.0); return true; } else if ( Location.Z < WorldInfo.KillZ ) { Velocity.Z = FMin(SpectatorCameraSpeed, WorldInfo.KillZ - Location.Z + 2.0); return true; } return false; } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { local float VelSize; /* smoothly accelerate and decelerate */ Acceleration = Normal(NewAccel) * SpectatorCameraSpeed; VelSize = VSize(Velocity); if( VelSize > 0 ) { Velocity = Velocity - (Velocity - Normal(Acceleration) * VelSize) * FMin(DeltaTime * 8, 1); } Velocity = Velocity + Acceleration * DeltaTime; if( VSize(Velocity) > SpectatorCameraSpeed ) { Velocity = Normal(Velocity) * SpectatorCameraSpeed; } LimitSpectatorVelocity(); if( VSize(Velocity) > 0 ) { MoveSmooth( (1+bRun) * Velocity * DeltaTime ); // correct if out of bounds after move if ( LimitSpectatorVelocity() ) { MoveSmooth( Velocity.Z * vect(0,0,1) * DeltaTime ); } } } function PlayerMove(float DeltaTime) { local vector X,Y,Z; GetAxes(Rotation,X,Y,Z); Acceleration = PlayerInput.aForward*X + PlayerInput.aStrafe*Y + PlayerInput.aUp*vect(0,0,1); UpdateRotation(DeltaTime); if (Role < ROLE_Authority) // then save this move and replicate it { ReplicateMove(DeltaTime, Acceleration, DCLICK_None, rot(0,0,0)); } else { ProcessMove(DeltaTime, Acceleration, DCLICK_None, rot(0,0,0)); } } /** when spectating, tells server where the client is (client is authoritative on location when spectating) */ unreliable server function ServerSetSpectatorLocation(vector NewLoc) { SetLocation(NewLoc); if ( WorldInfo.TimeSeconds - LastSpectatorStateSynchTime > 2.0 ) { ClientGotoState(GetStateName()); LastSpectatorStateSynchTime = WorldInfo.TimeSeconds; } } function ReplicateMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { ProcessMove(DeltaTime, NewAccel, DoubleClickMove, DeltaRot); // when spectating, client position is authoritative ServerSetSpectatorLocation(Location); } event BeginState(Name PreviousStateName) { bCollideWorld = true; } event EndState(Name NextStateName) { bCollideWorld = false; } } unreliable server function ServerViewNextPlayer() { if (IsSpectating()) { ViewAPlayer(+1); } } unreliable server function ServerViewPrevPlayer() { if (IsSpectating()) { ViewAPlayer(-1); } } /** * View next active player in PRIArray. * @param dir is the direction to go in the array */ function ViewAPlayer(int dir) { local int i, CurrentIndex, NewIndex; local PlayerReplicationInfo PRI; local bool bSuccess; CurrentIndex = -1; if ( RealViewTarget != None ) { // Find index of current viewtarget's PRI For ( i=0; i<WorldInfo.GRI.PRIArray.Length; i++ ) { if ( RealViewTarget == WorldInfo.GRI.PRIArray[i] ) { CurrentIndex = i; break; } } } // Find next valid viewtarget in appropriate direction for ( NewIndex=CurrentIndex+dir; (NewIndex>=0)&&(NewIndex<WorldInfo.GRI.PRIArray.Length); NewIndex=NewIndex+dir ) { PRI = WorldInfo.GRI.PRIArray[NewIndex]; if ( (PRI != None) && (Controller(PRI.Owner) != None) && (Controller(PRI.Owner).Pawn != None) && WorldInfo.Game.CanSpectate(self, PRI) ) { bSuccess = true; break; } } if ( !bSuccess ) { // wrap around CurrentIndex = (NewIndex < 0) ? WorldInfo.GRI.PRIArray.Length : -1; for ( NewIndex=CurrentIndex+dir; (NewIndex>=0)&&(NewIndex<WorldInfo.GRI.PRIArray.Length); NewIndex=NewIndex+dir ) { PRI = WorldInfo.GRI.PRIArray[NewIndex]; if ( (PRI != None) && (Controller(PRI.Owner) != None) && (Controller(PRI.Owner).Pawn != None) && WorldInfo.Game.CanSpectate(self, PRI) ) { bSuccess = true; break; } } } if ( bSuccess ) SetViewTarget(PRI); } unreliable server function ServerViewSelf(optional ViewTargetTransitionParams TransitionParams) { if (IsSpectating()) { ResetCameraMode(); SetViewTarget( Self, TransitionParams ); ClientSetViewTarget( Self, TransitionParams ); } } state Spectating extends BaseSpectating { ignores RestartLevel, Suicide, ThrowWeapon, NotifyPhysicsVolumeChange, NotifyHeadVolumeChange; exec function StartFire( optional byte FireModeNum ) { ServerViewNextPlayer(); } // Return to spectator's own camera. exec function StartAltFire( optional byte FireModeNum ) { ResetCameraMode(); ServerViewSelf(); } event BeginState(Name PreviousStateName) { if ( Pawn != None ) { SetLocation(Pawn.Location); UnPossess(); } bCollideWorld = true; } event EndState(Name NextStateName) { if ( PlayerReplicationInfo != None ) { if ( PlayerReplicationInfo.bOnlySpectator ) { `log("WARNING - Spectator only player leaving spectating state to go to "$NextStateName); } PlayerReplicationInfo.bIsSpectator = false; } bCollideWorld = false; } } auto state PlayerWaiting extends BaseSpectating { ignores SeePlayer, HearNoise, NotifyBump, TakeDamage, PhysicsVolumeChange, NextWeapon, PrevWeapon, SwitchToBestWeapon; exec function Jump(); exec function Suicide(); reliable server function ServerSuicide(); reliable server function ServerChangeTeam( int N ) { WorldInfo.Game.ChangeTeam(self, N, true); } reliable server function ServerRestartPlayer() { if ( WorldInfo.TimeSeconds < WaitDelay ) return; if ( WorldInfo.NetMode == NM_Client ) return; if ( WorldInfo.Game.bWaitingToStartMatch ) PlayerReplicationInfo.bReadyToPlay = true; else WorldInfo.Game.RestartPlayer(self); } exec function StartFire( optional byte FireModeNum ) { ServerReStartPlayer(); } event EndState(Name NextStateName) { if ( PlayerReplicationInfo != None ) { PlayerReplicationInfo.SetWaitingPlayer(false); } bCollideWorld = false; } // @note: this must be simulated to execute on the client because at the time the initial state is entered, RemoteRole has not been // set yet and so only simulated functions will be executed simulated event BeginState(Name PreviousStateName) { if ( PlayerReplicationInfo != None ) { PlayerReplicationInfo.SetWaitingPlayer(true); } bCollideWorld = true; } } state WaitingForPawn extends BaseSpectating { ignores SeePlayer, HearNoise, KilledBy; exec function StartFire( optional byte FireModeNum ) { AskForPawn(); } reliable client function ClientGotoState(name NewState, optional name NewLabel) { if (NewState == 'RoundEnded') { Global.ClientGotoState(NewState, NewLabel); } } unreliable client function LongClientAdjustPosition ( float TimeStamp, name newState, EPhysics newPhysics, float NewLocX, float NewLocY, float NewLocZ, float NewVelX, float NewVelY, float NewVelZ, Actor NewBase, float NewFloorX, float NewFloorY, float NewFloorZ ) { if ( newState == 'RoundEnded' ) GotoState(newState); } event PlayerTick(float DeltaTime) { Global.PlayerTick(DeltaTime); if ( Pawn != None ) { Pawn.Controller = self; Pawn.BecomeViewTarget(self); ClientRestart(Pawn); } else if ( !IsTimerActive() || GetTimerCount() > 1.f ) { SetTimer(0.2,true); AskForPawn(); } } function ReplicateMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { ProcessMove(DeltaTime, NewAccel, DoubleClickMove, DeltaRot); // do not actually call ServerSetSpectatorLocation() as the server is not in this state and so won't accept it anyway // something is wrong if we're in this state for an extended period of time, so the fact that // the server side spectator location is not being updated should not be relevant } event Timer() { AskForPawn(); } event BeginState(Name PreviousStateName) { SetTimer(0.2, true); AskForPawn(); } event EndState(Name NextStateName) { ResetCameraMode(); SetTimer(0.0, false); } } state RoundEnded { ignores SeePlayer, HearNoise, KilledBy, NotifyBump, HitWall, NotifyHeadVolumeChange, NotifyPhysicsVolumeChange, Falling, TakeDamage, Suicide; reliable server function ServerReStartPlayer() { } function bool IsSpectating() { return true; } exec function ThrowWeapon() {} exec function Use() {} event Possess(Pawn aPawn, bool bVehicleTransition) { Global.Possess(aPawn, bVehicleTransition); if (Pawn != None) Pawn.TurnOff(); } reliable server function ServerReStartGame() { if (WorldInfo.Game.PlayerCanRestartGame(self)) { WorldInfo.Game.ResetLevel(); } } exec function StartFire( optional byte FireModeNum ) { if ( Role < ROLE_Authority) return; if ( !bFrozen ) ServerReStartGame(); else if ( !IsTimerActive() ) SetTimer(1.5, false); } function PlayerMove(float DeltaTime) { local vector X,Y,Z; local Rotator DeltaRot, ViewRotation; GetAxes(Rotation,X,Y,Z); // Update view rotation. ViewRotation = Rotation; // Calculate Delta to be applied on ViewRotation DeltaRot.Yaw = PlayerInput.aTurn; DeltaRot.Pitch = PlayerInput.aLookUp; ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot ); SetRotation(ViewRotation); ViewShake(DeltaTime); if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0)); else ProcessMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0)); bPressedJump = false; } unreliable server function ServerMove ( float TimeStamp, vector InAccel, vector ClientLoc, byte NewFlags, byte ClientRoll, int View ) { Global.ServerMove( TimeStamp, InAccel, ClientLoc, NewFlags, ClientRoll, //epic superville: Cleaner compression with no roundoff error ((Rotation.Yaw & 65535) << 16) + (Rotation.Pitch & 65535) ); } function FindGoodView() { local rotator GoodRotation; GoodRotation = Rotation; GetViewTarget().FindGoodEndView(self, GoodRotation); SetRotation(GoodRotation); } event Timer() { bFrozen = false; } unreliable client function LongClientAdjustPosition ( float TimeStamp, name newState, EPhysics newPhysics, float NewLocX, float NewLocY, float NewLocZ, float NewVelX, float NewVelY, float NewVelZ, Actor NewBase, float NewFloorX, float NewFloorY, float NewFloorZ ) { } event BeginState(Name PreviousStateName) { local Pawn P; FOVAngle = DesiredFOV; bFire = 0; if( Pawn != None ) { Pawn.TurnOff(); StopFiring(); } if( myHUD != None ) { myHUD.SetShowScores(TRUE); } bFrozen = TRUE; FindGoodView(); SetTimer(5, FALSE); ForEach DynamicActors(class'Pawn', P) { P.TurnOff(); } } event EndState(name NextStateName) { if (myHUD != None) { myHUD.SetShowScores(false); } } Begin: } state Dead { ignores SeePlayer, HearNoise, KilledBy, NextWeapon, PrevWeapon; simulated event ReplicatedEvent(name VarName) { // if we got a Pawn, get into the correct control state // probably should be in global ReplicatedEvent() but minimizing risk here if (VarName == nameof(Pawn) && Pawn != None && Pawn != AcknowledgedPawn) { ClientRestart(Pawn); } Global.ReplicatedEvent(VarName); } exec function ThrowWeapon() { //clientmessage("Throwweapon while dead, pawn "$Pawn$" health "$Pawn.health); } function bool IsDead() { return true; } reliable server function ServerReStartPlayer() { if ( !WorldInfo.Game.PlayerCanRestart( Self ) ) return; super.ServerRestartPlayer(); } exec function StartFire( optional byte FireModeNum ) { if ( bFrozen ) { if ( !IsTimerActive() || GetTimerCount() > MinRespawnDelay ) bFrozen = false; return; } ServerReStartPlayer(); } exec function Use() { StartFire(0); } exec function Jump() { StartFire(0); } unreliable server function ServerMove ( float TimeStamp, vector Accel, vector ClientLoc, byte NewFlags, byte ClientRoll, int View ) { Global.ServerMove( TimeStamp, Accel, ClientLoc, 0, ClientRoll, View); } function PlayerMove(float DeltaTime) { local vector X,Y,Z; local rotator DeltaRot, ViewRotation; if ( !bFrozen ) { if ( bPressedJump ) { StartFire( 0 ); bPressedJump = false; } GetAxes(Rotation,X,Y,Z); // Update view rotation. ViewRotation = Rotation; // Calculate Delta to be applied on ViewRotation DeltaRot.Yaw = PlayerInput.aTurn; DeltaRot.Pitch = PlayerInput.aLookUp; ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot ); SetRotation(ViewRotation); if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0)); } else if ( !IsTimerActive() || GetTimerCount() > MinRespawnDelay ) { bFrozen = false; } ViewShake(DeltaTime); } function FindGoodView() { local vector cameraLoc; local rotator cameraRot, ViewRotation; local int tries, besttry; local float bestdist, newdist; local int startYaw; local Actor TheViewTarget; ViewRotation = Rotation; ViewRotation.Pitch = 56000; tries = 0; besttry = 0; bestdist = 0.0; startYaw = ViewRotation.Yaw; TheViewTarget = GetViewTarget(); for (tries=0; tries<16; tries++) { cameraLoc = TheViewTarget.Location; SetRotation(ViewRotation); GetPlayerViewPoint( cameraLoc, cameraRot ); newdist = VSize(cameraLoc - TheViewTarget.Location); if (newdist > bestdist) { bestdist = newdist; besttry = tries; } ViewRotation.Yaw += 4096; } ViewRotation.Yaw = startYaw + besttry * 4096; SetRotation(ViewRotation); } event Timer() { if (!bFrozen) return; bFrozen = false; bPressedJump = false; } event BeginState(Name PreviousStateName) { if ( (Pawn != None) && (Pawn.Controller == self) ) Pawn.Controller = None; Pawn = None; FOVAngle = DesiredFOV; Enemy = None; bFrozen = true; bPressedJump = false; FindGoodView(); SetTimer(MinRespawnDelay, false); CleanOutSavedMoves(); } event EndState(Name NextStateName) { CleanOutSavedMoves(); Velocity = vect(0,0,0); Acceleration = vect(0,0,0); if ( !PlayerReplicationInfo.bOutOfLives ) ResetCameraMode(); bPressedJump = false; if ( myHUD != None ) { myHUD.SetShowScores(false); } } Begin: if ( LocalPlayer(Player) != None ) { if (myHUD != None) { myHUD.PlayerOwnerDied(); } } } function bool CanRestartPlayer() { return PlayerReplicationInfo != None && !PlayerReplicationInfo.bOnlySpectator && HasClientLoadedCurrentWorld() && PendingSwapConnection == None; } /** * Hook called from HUD actor. Gives access to HUD and Canvas */ function DrawHUD( HUD H ) { if ( Pawn != None ) { Pawn.DrawHUD( H ); } if ( PlayerInput != None ) { PlayerInput.DrawHUD( H ); } } /* epic =============================================== * ::OnToggleInput * * Looks at the activated input from the SeqAct_ToggleInput * op and sets bPlayerInputEnabled accordingly. * * ===================================================== */ function OnToggleInput(SeqAct_ToggleInput inAction) { local bool bNewValue; if (Role < ROLE_Authority) { `Warn("Not supported on client"); return; } if( inAction.InputLinks[0].bHasImpulse ) { if( inAction.bToggleMovement ) { IgnoreMoveInput( FALSE ); ClientIgnoreMoveInput(false); } if( inAction.bToggleTurning ) { IgnoreLookInput( FALSE ); ClientIgnoreLookInput(false); } } else if( inAction.InputLinks[1].bHasImpulse ) { if( inAction.bToggleMovement ) { IgnoreMoveInput( TRUE ); ClientIgnoreMoveInput(true); } if( inAction.bToggleTurning ) { IgnoreLookInput( TRUE ); ClientIgnoreLookInput(true); } } else if( inAction.InputLinks[2].bHasImpulse ) { if( inAction.bToggleMovement ) { bNewValue = !IsMoveInputIgnored(); IgnoreMoveInput(bNewValue); ClientIgnoreMoveInput(bNewValue); } if( inAction.bToggleTurning ) { bNewValue = !IsLookInputIgnored(); IgnoreLookInput(bNewValue); ClientIgnoreLookInput(bNewValue); } } } /** calls IgnoreMoveInput on client */ client reliable function ClientIgnoreMoveInput(bool bIgnore) { IgnoreMoveInput(bIgnore); } /** calls IgnoreLookInput on client */ client reliable function ClientIgnoreLookInput(bool bIgnore) { IgnoreLookInput(bIgnore); } /** * list important PlayerController variables on canvas. HUD will call DisplayDebug() on the current ViewTarget when * the ShowDebug exec is used * * @param HUD - HUD with canvas to draw on * @input out_YL - Height of the current font * @input out_YPos - Y position on Canvas. out_YPos += out_YL, gives position to draw text for next debug line. */ simulated function DisplayDebug(HUD HUD, out float out_YL, out float out_YPos) { super.DisplayDebug(HUD, out_YL, out_YPos); if (HUD.ShouldDisplayDebug('camera')) { if( PlayerCamera != None ) { PlayerCamera.DisplayDebug( HUD, out_YL, out_YPos ); } else { HUD.Canvas.SetDrawColor(255,0,0); HUD.Canvas.DrawText("NO CAMERA"); out_YPos += out_YL; HUD.Canvas.SetPos(4, out_YPos); } } if ( HUD.ShouldDisplayDebug('input') ) { HUD.Canvas.SetDrawColor(255,0,0); HUD.Canvas.DrawText("Input ignoremove "$bIgnoreMoveInput$" ignore look "$bIgnoreLookInput$" aForward "$PlayerInput.aForward); out_YPos += out_YL; HUD.Canvas.SetPos(4, out_YPos); } } /* epic =============================================== * ::OnDrawText * * Displays text according to parameters set in inAction * * ===================================================== */ function OnDrawText(SeqAct_DrawText inAction) { if( inAction.InputLinks[0].bHasImpulse ) { ClientDrawKismetText(inAction.DrawTextInfo, inAction.DisplayTimeSeconds); } else { ClientClearKismetText(inAction.DrawTextInfo.MessageOffset); } } /** Start drawing a kismet message on the HUD */ reliable client final function ClientDrawKismetText(KismetDrawTextInfo DrawTextInfo, float DisplayTime) { if ( DisplayTime > 0 ) { DrawTextInfo.MessageEndTime = WorldInfo.TimeSeconds + DisplayTime; } else { DrawTextInfo.MessageEndTime = -1; } myHUD.KismetTextInfo.AddItem(DrawTextInfo); } /** Stop drawing a kismet message on the HUD */ reliable client final function ClientClearKismetText(Vector2D MessageOffset) { local int RemoveIdx; RemoveIdx = myHUD.KismetTextInfo.Find('MessageOffset', MessageOffset); if( RemoveIdx != INDEX_NONE ) { myHUD.KismetTextInfo.Remove(RemoveIdx, 1); } } /* epic =============================================== * ::OnSetCameraTarget * * Sets the specified view target. * * ===================================================== */ simulated function OnSetCameraTarget(SeqAct_SetCameraTarget inAction) { local Actor RealCameraTarget; RealCameraTarget = inAction.CameraTarget; if (RealCameraTarget == None) { RealCameraTarget = (Pawn != None) ? Pawn : self; } // If we're asked to view a Controller, set its Pawn as out view target instead. else if (RealCameraTarget.IsA('Controller')) { RealCameraTarget = Controller(RealCameraTarget).Pawn; } SetViewTarget( RealCameraTarget, inAction.TransitionParams ); } simulated function OnToggleHUD(SeqAct_ToggleHUD inAction) { if (myHUD != None) { if (inAction.InputLinks[0].bHasImpulse) { myHUD.bShowHUD = true; } else if (inAction.InputLinks[1].bHasImpulse) { myHUD.bShowHUD = false; } else if (inAction.InputLinks[2].bHasImpulse) { myHUD.bShowHUD = !myHUD.bShowHUD; } } } /** * Attempts to match the name passed in to a SeqEvent_Console * object and then activate it. * * @param eventName - name of the event to cause */ unreliable server function ServerCauseEvent(Name EventName) { local array<SequenceObject> AllConsoleEvents; local SeqEvent_Console ConsoleEvt; local Sequence GameSeq; local int Idx; local bool bFoundEvt; // Get the gameplay sequence. GameSeq = WorldInfo.GetGameSequence(); if ( (GameSeq != None) && (EventName != '') ) { // Find all SeqEvent_Console objects anywhere. GameSeq.FindSeqObjectsByClass(class'SeqEvent_Console', TRUE, AllConsoleEvents); // Iterate over them, seeing if the name is the one we typed in. for( Idx=0; Idx < AllConsoleEvents.Length; Idx++ ) { ConsoleEvt = SeqEvent_Console(AllConsoleEvents[Idx]); if (ConsoleEvt != None && EventName == ConsoleEvt.ConsoleEventName) { bFoundEvt = TRUE; // activate the vent ConsoleEvt.CheckActivate(self, Pawn); } } } if (!bFoundEvt) { ListConsoleEvents(); } } exec function CauseEvent(optional Name EventName) { ServerCauseEvent(EventName); } /** * Shortcut version for LDs who get tired of typing 'CauseEvent' all day. :-) */ exec function CE(optional Name EventName) { ServerCauseEvent(EventName); } /** * Lists all console events to the HUD. */ exec function ListConsoleEvents() { local array<SequenceObject> ConsoleEvents; local SeqEvent_Console ConsoleEvt; local Sequence GameSeq; local int Idx; GameSeq = WorldInfo.GetGameSequence(); if (GameSeq != None) { `log("Console events:"); ClientMessage("Console events:",,15.f); GameSeq.FindSeqObjectsByClass(class'SeqEvent_Console',TRUE,ConsoleEvents); for (Idx = 0; Idx < ConsoleEvents.Length; Idx++) { ConsoleEvt = SeqEvent_Console(ConsoleEvents[Idx]); if (ConsoleEvt != None && ConsoleEvt.bEnabled) { `log("-"@ConsoleEvt.ConsoleEventName@ConsoleEvt.EventDesc); ClientMessage("-"@ConsoleEvt.ConsoleEventName@ConsoleEvt.EventDesc,,15.f); } } } } exec function ListCE() { ListConsoleEvents(); } /** triggers a SeqEvent_RemoteEvent instead of a console event; LDs specifically requested separate commands */ exec function RemoteEvent(optional name EventName) { ServerRemoteEvent(EventName); } exec function RE(optional name EventName) { ServerRemoteEvent(EventName); } unreliable server function ServerRemoteEvent(name EventName) { local array<SequenceObject> AllRemoteEvents; local SeqEvent_RemoteEvent RemoteEvt; local Sequence GameSeq; local int Idx; local bool bFoundEvt; // Get the gameplay sequence. GameSeq = WorldInfo.GetGameSequence(); if (GameSeq != None) { // Find all SeqEvent_Console objects anywhere. GameSeq.FindSeqObjectsByClass(class'SeqEvent_RemoteEvent', true, AllRemoteEvents); if (EventName != '') { // Iterate over them, seeing if the name is the one we typed in. for (Idx = 0; Idx < AllRemoteEvents.length; Idx++) { RemoteEvt = SeqEvent_RemoteEvent(AllRemoteEvents[Idx]); if (RemoteEvt != None && EventName == RemoteEvt.EventName) { bFoundEvt = true; // activate the vent RemoteEvt.CheckActivate(self, Pawn); } } } } if (!bFoundEvt) { `log("Remote events:"); ClientMessage("Remote events:",, 15.0); for (Idx = 0; Idx < AllRemoteEvents.Length; Idx++) { RemoteEvt = SeqEvent_RemoteEvent(AllRemoteEvents[Idx]); if (RemoteEvt != None && RemoteEvt.bEnabled) { `log("-" @ RemoteEvt.EventName); ClientMessage("-" @ RemoteEvt.EventName,, 15.0); } } } } exec function ShowPlayerState() { `log("Dumping state stack for" @ Self); DumpStateStack(); } exec function ShowGameState() { if ( WorldInfo.Game != None ) { `log(`location$": Dumping state stack for" @ WorldInfo.Game); WorldInfo.Game.DumpStateStack(); } else { `log(`location$": No GameInfo found!"); } } /** * Notification from pawn that it has received damage * via TakeDamage(). */ function NotifyTakeHit(Controller InstigatedBy, vector HitLocation, int Damage, class<DamageType> damageType, vector Momentum) { Super.NotifyTakeHit(InstigatedBy,HitLocation,Damage,damageType,Momentum); // Play waveform ClientPlayForceFeedbackWaveform(damageType.default.DamagedFFWaveform); } /** * Kismet interface for playing/stopping force feedback. */ function OnForceFeedback(SeqAct_ForceFeedback Action) { if (Action.InputLinks[0].bHasImpulse) { ClientPlayForceFeedbackWaveform(Action.FFWaveform); } else if (Action.InputLinks[1].bHasImpulse) { ClientStopForceFeedbackWaveform(Action.FFWaveform); } } /** This will take an AnimNotify_Rumble and then grab out the correct waveform to be played **/ event PlayRumble( const AnimNotify_Rumble TheAnimNotify ) { if( TheAnimNotify.PredefinedWaveForm != none ) { ClientPlayForceFeedbackWaveform( TheAnimNotify.PredefinedWaveForm.default.TheWaveForm ); } else { ClientPlayForceFeedbackWaveform( TheAnimNotify.WaveForm ); } } /** * Tells the client to play a waveform for the specified damage type * * @param FFWaveform The forcefeedback waveform to play * @param FFWaveformInstigator the actor causing the waveform to play */ reliable client event ClientPlayForceFeedbackWaveform(ForceFeedbackWaveform FFWaveform,optional Actor FFWaveformInstigator) { if (PlayerInput != None && !PlayerInput.bUsingGamepad && !WorldInfo.IsConsoleBuild(CONSOLE_Any)) { return; // don't play forcefeedback if gamepad isn't being used } if( ForceFeedbackManager != None && PlayerReplicationInfo != None && IsForceFeedbackAllowed() ) { ForceFeedbackManager.PlayForceFeedbackWaveform(FFWaveform,FFWaveformInstigator); } } /** * Tells the client to stop any waveform that is playing. Note if the optional * parameter is passed in, then the waveform is only stopped if it matches * * @param FFWaveform The forcefeedback waveform to stop */ reliable client final event ClientStopForceFeedbackWaveform(optional ForceFeedbackWaveform FFWaveform) { if( ForceFeedbackManager != None ) { ForceFeedbackManager.StopForceFeedbackWaveform(FFWaveform); } } /** * @return TRUE if starting a force feedback waveform is allowed; child classes should override this method to e.g. temporarily disable * force feedback */ simulated function bool IsForceFeedbackAllowed() { return ForceFeedbackManager != None && ForceFeedbackManager.bAllowsForceFeedback; } /** * Handles switching the player in/out of cinematic mode. */ function OnToggleCinematicMode(SeqAct_ToggleCinematicMode Action) { local bool bNewCinematicMode; if (Role < ROLE_Authority) { `Warn("Not supported on client"); return; } if (Action.InputLinks[0].bHasImpulse) { bNewCinematicMode = TRUE; } else if (Action.InputLinks[1].bHasImpulse) { bNewCinematicMode = FALSE; } else if (Action.InputLinks[2].bHasImpulse) { bNewCinematicMode = !bCinematicMode; } SetCinematicMode(bNewCinematicMode, Action.bHidePlayer, Action.bHideHUD, Action.bDisableMovement, Action.bDisableTurning, Action.bDisableInput); } /** * Server/SP only function for changing whether the player is in cinematic mode. Updates values of various state variables, then replicates the call to the client * to sync the current cinematic mode. * * @param bInCinematicMode specify TRUE if the player is entering cinematic mode; FALSE if the player is leaving cinematic mode. * @param bHidePlayer specify TRUE to hide the player's pawn (only relevant if bInCinematicMode is TRUE) * @param bAffectsHUD specify TRUE if we should show/hide the HUD to match the value of bCinematicMode * @param bAffectsMovement specify TRUE to disable movement in cinematic mode, enable it when leaving * @param bAffectsTurning specify TRUE to disable turning in cinematic mode or enable it when leaving * @param bAffectsButtons specify TRUE to disable button input in cinematic mode or enable it when leaving. */ function SetCinematicMode( bool bInCinematicMode, bool bHidePlayer, bool bAffectsHUD, bool bAffectsMovement, bool bAffectsTurning, bool bAffectsButtons ) { local bool bAdjustMoveInput, bAdjustLookInput; bCinematicMode = bInCinematicMode; // if now in cinematic mode if( bCinematicMode ) { // hide the player if (Pawn != None && bHidePlayer) { Pawn.SetHidden(True); } } else { if( Pawn != None ) { Pawn.SetHidden(False); } } bAdjustMoveInput = bAffectsMovement && (bCinematicMode != bCinemaDisableInputMove); bAdjustLookInput = bAffectsTurning && (bCinematicMode != bCinemaDisableInputLook); if ( bAdjustMoveInput ) { IgnoreMoveInput(bCinematicMode); bCinemaDisableInputMove = bCinematicMode; } if ( bAdjustLookInput ) { IgnoreLookInput(bCinematicMode); bCinemaDisableInputLook = bCinematicMode; } ClientSetCinematicMode(bCinematicMode, bAdjustMoveInput, bAdjustLookInput, bAffectsHUD); } /** called by the server to synchronize cinematic transitions with the client */ reliable client function ClientSetCinematicMode(bool bInCinematicMode, bool bAffectsMovement, bool bAffectsTurning, bool bAffectsHUD) { bCinematicMode = bInCinematicMode; // if there's a hud, set whether it should be shown or not if ( (myHUD != None) && bAffectsHUD ) { myHUD.bShowHUD = !bCinematicMode; } if (bAffectsMovement) { IgnoreMoveInput(bCinematicMode); } if (bAffectsTurning) { IgnoreLookInput(bCinematicMode); } } /** Toggles move input. FALSE means movement input is cleared. */ function IgnoreMoveInput( bool bNewMoveInput ) { bIgnoreMoveInput = Max( bIgnoreMoveInput + (bNewMoveInput ? +1 : -1), 0 ); //`Log("IgnoreMove: " $ bIgnoreMoveInput); } /** return TRUE if movement input is ignored. */ event bool IsMoveInputIgnored() { return (bIgnoreMoveInput > 0); } /** Toggles look input. FALSE means look input is cleared. */ function IgnoreLookInput( bool bNewLookInput ) { bIgnoreLookInput = Max( bIgnoreLookInput + (bNewLookInput ? +1 : -1), 0 ); //`Log("IgnoreLook: " $ bIgnoreLookInput); } /** return TRUE if look input is ignored. */ event bool IsLookInputIgnored() { return (bIgnoreLookInput > 0); } /** reset input to defaults */ function ResetPlayerMovementInput() { bIgnoreMoveInput = default.bIgnoreMoveInput; bIgnoreLookInput = default.bIgnoreLookInput; } /** Kismet hook to trigger console events */ function OnConsoleCommand( SeqAct_ConsoleCommand inAction ) { local string Command; foreach inAction.Commands(Command) { // prevent "set" commands from ever working in Kismet as they are e.g. disabled in netplay if (!(Left(Command, 4) ~= "set ") && !(Left(Command, 9) ~= "setnopec ")) { ConsoleCommand(Command); } } } /** forces GC at the end of the tick on the client */ reliable client event ClientForceGarbageCollection() { WorldInfo.ForceGarbageCollection(); } final event LevelStreamingStatusChanged(LevelStreaming LevelObject, bool bNewShouldBeLoaded, bool bNewShouldBeVisible, bool bNewShouldBlockOnLoad ) { //`log( "LevelStreamingStatusChanged: " @ LevelObject @ bNewShouldBeLoaded @ bNewShouldBeVisible @ bNewShouldBeVisible ); ClientUpdateLevelStreamingStatus(LevelObject.PackageName,bNewShouldBeLoaded,bNewShouldBeVisible,bNewShouldBlockOnLoad); } native reliable client function ClientUpdateLevelStreamingStatus(Name PackageName, bool bNewShouldBeLoaded, bool bNewShouldBeVisible, bool bNewShouldBlockOnLoad); /** called when the client adds/removes a streamed level * the server will only replicate references to Actors in visible levels so that it's impossible to send references to * Actors the client has not initialized * @param PackageName the name of the package for the level whose status changed */ native reliable server final event ServerUpdateLevelVisibility(name PackageName, bool bIsVisible); /** asynchronously loads the given level in preparation for a streaming map transition. * the server sends one function per level name since dynamic arrays can't be replicated * @param LevelNames the names of the level packages to load. LevelNames[0] will be the new persistent (primary) level * @param bFirst whether this is the first item in the list (so clear the list first) * @param bLast whether this is the last item in the list (so start preparing the change after receiving it) */ reliable client event ClientPrepareMapChange(name LevelName, bool bFirst, bool bLast) { // Only call on the first local player controller to handle it being called on multiple PCs for splitscreen. local PlayerController PC; foreach LocalPlayerControllers(class'PlayerController', PC) { if( PC != self ) { return; } else { break; } } if (bFirst) { PendingMapChangeLevelNames.length = 0; ClearTimer('DelayedPrepareMapChange'); } PendingMapChangeLevelNames[PendingMapChangeLevelNames.length] = LevelName; if (bLast) { DelayedPrepareMapChange(); } } /** used to wait until a map change can be prepared when one was already in progress */ function DelayedPrepareMapChange() { if (WorldInfo.IsPreparingMapChange()) { // we must wait for the previous one to complete SetTimer( 0.01, false, nameof(DelayedPrepareMapChange) ); } else { WorldInfo.PrepareMapChange(PendingMapChangeLevelNames); } } /** actually performs the level transition prepared by PrepareMapChange() */ reliable client event ClientCommitMapChange() { if (IsTimerActive(nameof(DelayedPrepareMapChange))) { SetTimer(0.01, false, nameof(ClientCommitMapChange)); } else { if (Pawn != None) { SetViewTarget(Pawn); } else { SetViewTarget(self); } WorldInfo.CommitMapChange(); } } /** tells client to cancel any pending map change */ reliable client event ClientCancelPendingMapChange() { WorldInfo.CancelPendingMapChange(); } /** tells the client to block until all pending level streaming actions are complete * happens at the end of the tick * primarily used to force update the client ASAP at join time */ reliable client native final event ClientFlushLevelStreaming(); /** sets bRequestedBlockOnAsyncLoading which will later bring up a loading screen and then finish any async loading in progress * called automatically on all clients whenever something triggers it on the server */ reliable client event ClientSetBlockOnAsyncLoading() { WorldInfo.bRequestedBlockOnAsyncLoading = true; } /** * Force a save config on the specified class. */ exec function SaveClassConfig(coerce string className) { local class<Object> saveClass; `log("SaveClassConfig:"@className); saveClass = class<Object>(DynamicLoadObject(className,class'class')); if (saveClass != None) { `log("- Saving config on:"@saveClass); saveClass.static.StaticSaveConfig(); } `if(`notdefined(FINAL_RELEASE)) else { `log("- Failed to find class:"@className); } `endif } /** * Force a save config on the specified actor. */ exec function SaveActorConfig(coerce Name actorName) { local Actor chkActor; `log("SaveActorConfig:"@actorName); foreach AllActors(class'Actor',chkActor) { if (chkActor != None && chkActor.Name == actorName) { `log("- Saving config on:"@chkActor); chkActor.SaveConfig(); } } } /** * Returns the interaction that manages the UI system. */ final function UIInteraction GetUIController() { local LocalPlayer LP; local UIInteraction Result; LP = LocalPlayer(Player); if ( LP != None && LP.ViewportClient != None ) { Result = LP.ViewportClient.UIController; } return Result; } /** * Native function to determine if voice data should be received from this player. * Only called on the server to determine whether voice packet replication * should happen for the given sender. * * NOTE: This function is final because it can be called n^2 number of times * in a given frame, where n is the number of players. Change/overload this * function with caution as this can affect your network performance. * * @param Sender the player to check for mute status * * @return TRUE if this player is muted, FALSE otherwise */ native final function bool IsPlayerMuted(const out UniqueNetId Sender); /** called on client during seamless level transitions to get the list of Actors that should be moved into the new level * PlayerControllers, Role < ROLE_Authority Actors, and any non-Actors that are inside an Actor that is in the list * (i.e. Object.Outer == Actor in the list) * are all autmoatically moved regardless of whether they're included here * only dynamic (!bStatic and !bNoDelete) actors in the PersistentLevel may be moved (this includes all actors spawned during gameplay) * this is called for both parts of the transition because actors might change while in the middle (e.g. players might join or leave the game) * @see also GameInfo::GetSeamlessTravelActorList() (the function that's called on servers) * @param bToEntry true if we are going from old level -> entry, false if we are going from entry -> new level * @param ActorList (out) list of actors to maintain */ event GetSeamlessTravelActorList(bool bToEntry, out array<Actor> ActorList) { // clear out audio pool HearSoundActiveComponents.length = 0; HearSoundPoolComponents.length = 0; if (myHUD != None) { ActorList[ActorList.length] = myHUD; } } /** called when seamless travelling and we are being replaced by the specified PC * clean up any persistent state (post process chains on LocalPlayers, for example) * (not called if PlayerControllerClass is the same for the from and to gametypes) */ function SeamlessTravelTo(PlayerController NewPC); /** called when seamless travelling and the specified PC is being replaced by this one * copy over data that should persist * (not called if PlayerControllerClass is the same for the from and to gametypes) */ function SeamlessTravelFrom(PlayerController OldPC) { // copy PRI data OldPC.PlayerReplicationInfo.Reset(); OldPC.PlayerReplicationInfo.SeamlessTravelTo(PlayerReplicationInfo); // mark the old PC as not a player, so it doesn't get Logout() etc when they player represented didn't really leave OldPC.bIsPlayer = false; //@fixme: need a way to replace PRIs that doesn't cause incorrect "player left the game"/"player entered the game" messages OldPC.PlayerReplicationInfo.Destroy(); OldPC.PlayerReplicationInfo = None; } /** * Looks at the current game state and uses that to set the * rich presence strings * * Licensees should override this in their player controller derived class */ reliable client function ClientSetOnlineStatus(); /** * Returns the player controller associated with this net id * * @param PlayerNetId the id to search for * * @return the player controller if found, otherwise none */ native static function PlayerController GetPlayerControllerFromNetId(UniqueNetId PlayerNetId); /** * Tells the client that the server has all the information it needs and that it * is ok to start sending voice packets. The server will already send voice packets * when this function is called, since it is set server side and then forwarded * * NOTE: This is done as an RPC instead of variable replication because ordering matters */ reliable client function ClientVoiceHandshakeComplete() { bHasVoiceHandshakeCompleted = true; } /** * Locally mutes a remote player * * @param PlayerNetId the remote player to mute */ reliable client event ClientMutePlayer(UniqueNetId PlayerNetId) { local LocalPlayer LocPlayer; // Add to the filter list on clients (used for peer to peer voice) if (VoicePacketFilter.Find('Uid',PlayerNetId.Uid) == INDEX_NONE) { VoicePacketFilter.AddItem(PlayerNetId); } if (VoiceInterface != None) { // Use the local player to determine the controller id LocPlayer = LocalPlayer(Player); if (LocPlayer != None) { // Have the voice subsystem mute this player VoiceInterface.MuteRemoteTalker(LocPlayer.ControllerId,PlayerNetId); } } } /** * Locally unmutes a remote player * * @param PlayerNetId the remote player to unmute */ reliable client event ClientUnmutePlayer(UniqueNetId PlayerNetId) { local LocalPlayer LocPlayer; local int RemoveIndex; // It's safe to remove them from the filter list on clients (used for peer to peer voice) RemoveIndex = VoicePacketFilter.Find('Uid',PlayerNetId.Uid); if (RemoveIndex != INDEX_NONE) { VoicePacketFilter.Remove(RemoveIndex,1); } if (VoiceInterface != None) { // Use the local player to determine the controller id LocPlayer = LocalPlayer(Player); if (LocPlayer != None) { // Have the voice subsystem restore voice for this player VoiceInterface.UnmuteRemoteTalker(LocPlayer.ControllerId,PlayerNetId); } } } /** * Mutes a remote player on the server and then tells the client to mute * * @param PlayerNetId the remote player to mute */ function GameplayMutePlayer(UniqueNetId PlayerNetId) { // Don't add if already muted if (GameplayVoiceMuteList.Find('Uid',PlayerNetId.Uid) == INDEX_NONE) { GameplayVoiceMuteList.AddItem(PlayerNetId); } // Add to the filter list too, if missing if (VoicePacketFilter.Find('Uid',PlayerNetId.Uid) == INDEX_NONE) { VoicePacketFilter.AddItem(PlayerNetId); } // Now process on the client needed for splitscreen net play ClientMutePlayer(PlayerNetId); } /** * Unmutes a remote player on the server and then tells the client to unmute * * @param PlayerNetId the remote player to unmute */ function GameplayUnmutePlayer(UniqueNetId PlayerNetId) { local int RemoveIndex; local PlayerController Other; // Remove from the gameplay mute list RemoveIndex = GameplayVoiceMuteList.Find('Uid',PlayerNetId.Uid); if (RemoveIndex != INDEX_NONE) { GameplayVoiceMuteList.Remove(RemoveIndex,1); } // Find the muted player's player controller so it can be notified Other = GetPlayerControllerFromNetId(PlayerNetId); if (Other != None) { // If they were not explicitly muted if (VoiceMuteList.Find('Uid',PlayerNetId.Uid) == INDEX_NONE && // and they did not explicitly mute us Other.VoiceMuteList.Find('Uid',PlayerReplicationInfo.UniqueId.Uid) == INDEX_NONE) { // It's safe to remove them from the filter list RemoveIndex = VoicePacketFilter.Find('Uid',PlayerNetId.Uid); if (RemoveIndex != INDEX_NONE) { VoicePacketFilter.Remove(RemoveIndex,1); } // Now process on the client ClientUnmutePlayer(PlayerNetId); } } } /** * Updates the server side information by adding to the mute list. Tells the * player controller that owns the specified net id to also mute this PC. * * @param PlayerNetId the remote player to mute */ reliable server event ServerMutePlayer(UniqueNetId PlayerNetId) { local PlayerController Other; // Don't reprocess if they are already muted if (VoiceMuteList.Find('Uid',PlayerNetId.Uid) == INDEX_NONE) { VoiceMuteList.AddItem(PlayerNetId); } // Add them to the packet filter list if not already on it if (VoicePacketFilter.Find('Uid',PlayerNetId.Uid) == INDEX_NONE) { VoicePacketFilter.AddItem(PlayerNetId); } ClientMutePlayer(PlayerNetId); // Find the muted player's player controller so it can be notified Other = GetPlayerControllerFromNetId(PlayerNetId); if (Other != None) { // Update their packet filter list too if (Other.VoicePacketFilter.Find('Uid',PlayerReplicationInfo.UniqueId.Uid) == INDEX_NONE) { Other.VoicePacketFilter.AddItem(PlayerReplicationInfo.UniqueId); } // Tell the other PC to mute this one Other.ClientMutePlayer(PlayerReplicationInfo.UniqueId); } } /** * Updates the server side information by removing from the mute list. Tells the * player controller that owns the specified net id to also unmute this PC. * * @param PlayerNetId the remote player to unmute */ reliable server event ServerUnmutePlayer(UniqueNetId PlayerNetId) { local PlayerController Other; local int RemoveIndex; RemoveIndex = VoiceMuteList.Find('Uid',PlayerNetId.Uid); // If the player was found, remove them from our explicit list if (RemoveIndex != INDEX_NONE) { VoiceMuteList.Remove(RemoveIndex,1); } // Find the muted player's player controller so it can be notified Other = GetPlayerControllerFromNetId(PlayerNetId); if (Other != None) { // Make sure this player isn't muted for gameplay reasons if (GameplayVoiceMuteList.Find('Uid',PlayerNetId.Uid) == INDEX_NONE && // And make sure they didn't mute us Other.VoiceMuteList.Find('Uid',PlayerReplicationInfo.UniqueId.Uid) == INDEX_NONE) { ClientUnmutePlayer(PlayerNetId); } // If the other player doesn't have this player muted if (Other.VoiceMuteList.Find('Uid',PlayerReplicationInfo.UniqueId.Uid) == INDEX_NONE && Other.GameplayVoiceMuteList.Find('Uid',PlayerReplicationInfo.UniqueId.Uid) == INDEX_NONE) { // Remove them from the packet filter list RemoveIndex = VoicePacketFilter.Find('Uid',PlayerNetId.Uid); if (RemoveIndex != INDEX_NONE) { VoicePacketFilter.Remove(RemoveIndex,1); } // If found, remove so packets flow to that client too RemoveIndex = Other.VoicePacketFilter.Find('Uid',PlayerReplicationInfo.UniqueId.Uid); if (RemoveIndex != INDEX_NONE) { Other.VoicePacketFilter.Remove(RemoveIndex,1); } // Tell the other PC to unmute this one Other.ClientUnmutePlayer(PlayerReplicationInfo.UniqueId); } } } /** notification when a matinee director track starts or stops controlling the ViewTarget of this PlayerController */ event NotifyDirectorControl(bool bNowControlling) { // matinee is done, make sure client syncs up viewtargets, since we were ignoring // ClientSetViewTarget during the matinee. if ( !bNowControlling && (WorldInfo.NetMode == NM_Client) && bClientSimulatingViewTarget ) { ServerVerifyViewTarget(); } } /** * This will turn the subtitles on or off depending on the value of bValue * * @param bValue to show or not to show **/ native simulated exec function SetShowSubtitles( bool bValue ); /** * This will turn return whether the subtitles are on or off * **/ native simulated function bool IsShowingSubtitles(); reliable client event ClientWasKicked(); /** * Tells the client to register with arbitration. The client must notify the * server once that is complete or it will be kicked from the match */ reliable client function ClientRegisterForArbitration() { if (OnlineSub != None && OnlineSub.GameInterface != None) { OnlineSub.GameInterface.AddArbitrationRegistrationCompleteDelegate(OnArbitrationRegisterComplete); // Kick off async arbitration registration OnlineSub.GameInterface.RegisterForArbitration('Game'); } else { // Fake completion with the server for flow testing ServerRegisteredForArbitration(true); } } /** * Delegate that is notified when registration is complete. Forwards the call * to the server so that it can finalize processing * * @param SessionName the name of the session this is for * @param bWasSuccessful whether registration worked or not */ function OnArbitrationRegisterComplete(name SessionName,bool bWasSuccessful) { // Clear the delegate since it isn't needed OnlineSub.GameInterface.ClearArbitrationRegistrationCompleteDelegate(OnArbitrationRegisterComplete); // Tell the server that we completed registration ServerRegisteredForArbitration(bWasSuccessful); } /** * Notifies the server that the arbitration registration is complete * * @param bWasSuccessful whether the registration with arbitration worked */ reliable server function ServerRegisteredForArbitration(bool bWasSuccessful) { // Tell the game info this PC is done and whether it worked or not WorldInfo.Game.ProcessClientRegistrationCompletion(self,bWasSuccessful); } /** * Delegate called when the user accepts a game invite externally. This allows * the game code a chance to clean up before joining the game via * AcceptGameInvite() call. * * NOTE: There must be space for all signed in players to join the game. All * players must also have permission to play online too. * * @param InviteResult the search/settings for the game we're to join */ function OnGameInviteAccepted(const out OnlineGameSearchResult InviteResult) { local OnlineGameSettings GameInviteSettings; if (OnlineSub != None && OnlineSub.GameInterface != None) { GameInviteSettings = InviteResult.GameSettings; if (GameInviteSettings != None) { // Make sure the new game has space if (InviteHasEnoughSpace(GameInviteSettings)) { // Make sure everyone logged in can play online if (CanAllPlayersPlayOnline()) { if (WorldInfo.NetMode != NM_Standalone) { // Write arbitration data, if required if (OnlineSub.GameInterface.GetGameSettings('Game').bUsesArbitration) { // Write out our version of the scoring before leaving ClientWriteOnlinePlayerScores(WorldInfo.GRI.GameClass != None ? WorldInfo.GRI.GameClass.default.ArbitratedLeaderBoardId : 0); } // Set the end delegate, where we'll destroy the game and then join OnlineSub.GameInterface.AddEndOnlineGameCompleteDelegate(OnEndForInviteComplete); // Force the flush of the stats OnlineSub.GameInterface.EndOnlineGame('Game'); } else { // Set the delegate for notification of the join completing OnlineSub.GameInterface.AddJoinOnlineGameCompleteDelegate(OnInviteJoinComplete); // We can immediately accept since there is no online game if (!OnlineSub.GameInterface.AcceptGameInvite(LocalPlayer(Player).ControllerId,'Game')) { OnlineSub.GameInterface.ClearJoinOnlineGameCompleteDelegate(OnInviteJoinComplete); // Do some error handling NotifyInviteFailed(); } } } else { // Display an error message NotifyNotAllPlayersCanJoinInvite(); } } else { // Display an error message NotifyNotEnoughSpaceInInvite(); } } else { // Display an error message NotifyInviteFailed(); } } } /** * Counts the number of local players to verify there is enough space * * @return true if there is sufficient space, false if not */ function bool InviteHasEnoughSpace(OnlineGameSettings InviteSettings) { local int NumLocalPlayers; local PlayerController PC; foreach LocalPlayerControllers(class'PlayerController', PC) { NumLocalPlayers++; } // Invites consume private connections return (InviteSettings.NumOpenPrivateConnections + InviteSettings.NumOpenPublicConnections) >= NumLocalPlayers; } /** * Validates that each local player can play online * * @return true if there is sufficient space, false if not */ function bool CanAllPlayersPlayOnline() { local PlayerController PC; local LocalPlayer LocPlayer; foreach LocalPlayerControllers(class'PlayerController', PC) { LocPlayer = LocalPlayer(PC.Player); if (LocPlayer != None) { // Check their login status and permissions if (OnlineSub.PlayerInterface.GetLoginStatus(LocPlayer.ControllerId) != LS_LoggedIn || OnlineSub.PlayerInterface.CanPlayOnline(LocPlayer.ControllerId) == FPL_Disabled) { return false; } } else { return false; } } return true; } /** * Clears all of the invite delegates */ function ClearInviteDelegates() { // Clear the end delegate OnlineSub.GameInterface.ClearEndOnlineGameCompleteDelegate(OnEndForInviteComplete); // Clear the destroy delegate OnlineSub.GameInterface.ClearDestroyOnlineGameCompleteDelegate(OnDestroyForInviteComplete); // Set the delegate for notification of the join completing OnlineSub.GameInterface.ClearJoinOnlineGameCompleteDelegate(OnInviteJoinComplete); } /** * Delegate called once the destroy of an online game before accepting an invite * is complete. From here, the game invite can be accepted * * @param SessionName the name of the session being ended * @param bWasSuccessful whether the end completed ok or not */ function OnEndForInviteComplete(name SessionName,bool bWasSuccessful) { // Set the destroy delegate so we can know when that is complete OnlineSub.GameInterface.AddDestroyOnlineGameCompleteDelegate(OnDestroyForInviteComplete); // Now we can destroy the game (completion delegate guaranteed to be called) OnlineSub.GameInterface.DestroyOnlineGame(SessionName); } /** * Delegate called once the destroy of an online game before accepting an invite * is complete. From here, the game invite can be accepted * * @param SessionName the name of the session being ended * @param bWasSuccessful whether the end completed ok or not */ function OnDestroyForInviteComplete(name SessionName,bool bWasSuccessful) { if (bWasSuccessful) { // Set the delegate for notification of the join completing OnlineSub.GameInterface.AddJoinOnlineGameCompleteDelegate(OnInviteJoinComplete); // This will have us join async if (!OnlineSub.GameInterface.AcceptGameInvite(LocalPlayer(Player).ControllerId,SessionName)) { OnlineSub.GameInterface.ClearJoinOnlineGameCompleteDelegate(OnInviteJoinComplete); // Do some error handling NotifyInviteFailed(); } } else { // Do some error handling NotifyInviteFailed(); } } /** * Allows the game to modify the URL that clients will use to connect to a server (should be called * by pretty much anyone who calls GetResolvedConnectString()) */ function string ModifyClientURL(string URL) { return URL; } /** * Once the join completes, use the platform specific connection information * to connect to it * * @param SessionName the name of the session that was joined * @param bWasSuccessful whether the join worked or not */ function OnInviteJoinComplete(name SessionName,bool bWasSuccessful) { local string URL, ConnectPassword; if (bWasSuccessful) { if (OnlineSub != None && OnlineSub.GameInterface != None) { // Get the platform specific information if (OnlineSub.GameInterface.GetResolvedConnectString(SessionName,URL)) { // if a password was set in the registry (this would normally be done by the UI scene that handles accepting // the game invite or join friend request), append it to the URL if ( class'UIRoot'.static.GetDataStoreStringValue("<Registry:ConnectPassword>", ConnectPassword) && ConnectPassword != "" ) { // we append "Password=" because that's what AccessControl checks for (see AccessControl.PreLogin) URL $= "?Password=" $ ConnectPassword; } URL $= "?bIsFromInvite"; // allow game to override URL = ModifyClientURL(URL); `Log("Resulting url is ("$URL$")"); // Open a network connection to it ClientTravel(URL, TRAVEL_Absolute); } } } else { // Do some error handling NotifyInviteFailed(); } ClearInviteDelegates(); class'UIRoot'.static.SetDataStoreStringValue("<Registry:ConnectPassword>", ""); } /** Override to display a message to the user */ function NotifyInviteFailed() { `Log("Invite handling failed"); ClearInviteDelegates(); } /** Override to display a message to the user */ function NotifyNotAllPlayersCanJoinInvite() { `Log("Not all local players have permission to join the game invite"); } /** Override to display a message to the user */ function NotifyNotEnoughSpaceInInvite() { `Log("Not enough space for all local players in the game invite"); } /** * Called when an arbitrated match has ended and we need to disconnect */ reliable client function ClientArbitratedMatchEnded() { ConsoleCommand("Disconnect"); } /** * Writes the scores for all active players. Override this in your * playercontroller class to provide custom scoring * * @param LeaderboardId the leaderboard the scores are being written to */ reliable client function ClientWriteOnlinePlayerScores(int LeaderboardId) { local GameReplicationInfo GRI; local int Index; local array<OnlinePlayerScore> PlayerScores; local UniqueNetId ZeroUniqueId; local bool bIsTeamGame; local int ScoreIndex; GRI = WorldInfo.GRI; if (GRI != None && OnlineSub != None && OnlineSub.StatsInterface != None) { // Look at the default object of the gameinfo to determine if this is a // team game or not bIsTeamGame = GRI.GameClass != None ? GRI.GameClass.default.bTeamGame : false; // Iterate through the players building their score data for (Index = 0; Index < GRI.PRIArray.Length; Index++) { if (GRI.PRIArray[Index].UniqueId != ZeroUniqueId) { if (bIsTeamGame) { // Players without teams in team games are excluded from submitted scores if (GRI.PRIArray[Index].Team != None) { ScoreIndex = PlayerScores.Length; PlayerScores.Length = ScoreIndex + 1; // Build the skill data for this player PlayerScores[ScoreIndex].PlayerId = GRI.PRIArray[Index].UniqueId; PlayerScores[ScoreIndex].TeamId = GRI.PRIArray[Index].Team.TeamIndex; PlayerScores[ScoreIndex].Score = GRI.PRIArray[Index].Team.Score; } } else { ScoreIndex = PlayerScores.Length; PlayerScores.Length = ScoreIndex + 1; // Build the skill data for this player PlayerScores[ScoreIndex].PlayerId = GRI.PRIArray[Index].UniqueId; PlayerScores[ScoreIndex].TeamId = Index; PlayerScores[ScoreIndex].Score = GRI.PRIArray[Index].Score; } } } // Now write out the scores OnlineSub.StatsInterface.WriteOnlinePlayerScores(PlayerReplicationInfo.SessionName,LeaderboardId,PlayerScores); } } /** * Tells the clients to write the stats using the specified stats object * * @param OnlineStatsWriteClass the stats class to write with * @param bIsIncomplete TRUE if the match wasn't finished at the time of the write */ reliable client function ClientWriteLeaderboardStats(class<OnlineStatsWrite> OnlineStatsWriteClass, optional bool bIsIncomplete=false); /** * Sets the host's net id for handling dropped arbitrated matches * * @param InHostId the host's unique net id to report the drop for */ reliable client function ClientSetHostUniqueId(UniqueNetId InHostId); /** Tells this client that it should not send voice data over the network */ reliable client function ClientStopNetworkedVoice() { local LocalPlayer LocPlayer; LocPlayer = LocalPlayer(Player); if (LocPlayer != None && OnlineSub != None && OnlineSub.VoiceInterface != None) { OnlineSub.VoiceInterface.StopNetworkedVoice(LocPlayer.ControllerId); } } /** Tells this client that it should send voice data over the network */ reliable client function ClientStartNetworkedVoice() { local LocalPlayer LocPlayer; LocPlayer = LocalPlayer(Player); if (LocPlayer != None && OnlineSub != None && OnlineSub.VoiceInterface != None) { OnlineSub.VoiceInterface.StartNetworkedVoice(LocPlayer.ControllerId); } } simulated function OnDestroy(SeqAct_Destroy Action) { // Kismet is not allowed to disconnect players from the game Action.ScriptLog("Cannot use Destroy action on players"); } `if(`notdefined(ShippingPC)) /** console control commands, useful when remote debugging so you can't touch the console the normal way */ exec function ConsoleKey(name Key) { if (LocalPlayer(Player) != None) { LocalPlayer(Player).ViewportClient.ViewportConsole.InputKey(0, Key, IE_Pressed); } } exec function SendToConsole(string Command) { if (LocalPlayer(Player) != None) { LocalPlayer(Player).ViewportClient.ViewportConsole.ConsoleCommand(Command); } } `endif /** * Iterate through list of debug text and draw it over the associated actors in world space. * Also handles culling null entries, and reducing the duration for timed debug text. */ final simulated function DrawDebugTextList(Canvas Canvas, float RenderDelta) { local vector CameraLoc, ScreenLoc, Offset, WorldTextLoc; local rotator CameraRot; local int Idx; if (DebugTextList.Length > 0) { GetPlayerViewPoint(CameraLoc,CameraRot); Canvas.SetDrawColor(255,255,255); for (Idx = 0; Idx < DebugTextList.Length; Idx++) { if (DebugTextList[Idx].SrcActor == None) { DebugTextList.Remove(Idx--,1); continue; } if (DebugTextList[Idx].TimeRemaining != -1.f) { DebugTextList[Idx].TimeRemaining -= RenderDelta; if (DebugTextList[Idx].TimeRemaining <= 0.f) { DebugTextList.Remove(Idx--,1); continue; } } if( DebugTextList[Idx].Font != None ) { Canvas.Font = DebugTextList[Idx].Font; } else { Canvas.Font = class'Engine'.static.GetSmallFont(); } if(DebugTextList[Idx].bAbsoluteLocation) { WorldTextLoc = VLerp(DebugTextList[Idx].SrcActorOffset,DebugTextList[Idx].SrcActorDesiredOffset,1.f - (DebugTextList[Idx].TimeRemaining/DebugTextList[Idx].Duration)); } else { Offset = VLerp(DebugTextList[Idx].SrcActorOffset,DebugTextList[Idx].SrcActorDesiredOffset,1.f - (DebugTextList[Idx].TimeRemaining/DebugTextList[Idx].Duration)); if( DebugTextList[Idx].bKeepAttachedToActor ) { WorldTextLoc = DebugTextList[Idx].SrcActor.Location + (Offset >> CameraRot); } else { WorldTextLoc = DebugTextList[Idx].OrigActorLocation + (Offset >> CameraRot); } } // don't draw text behind the camera if ( ((WorldTextLoc - CameraLoc) dot vector(CameraRot)) > 0.f ) { ScreenLoc = Canvas.Project(WorldTextLoc); Canvas.SetPos(ScreenLoc.X,ScreenLoc.Y); Canvas.DrawColor = DebugTextList[Idx].TextColor; Canvas.DrawText(DebugTextList[Idx].DebugText); } } } } /** * Add debug text for a specific actor to be displayed via DrawDebugTextList(). If the debug text is invalid then it will * attempt to remove any previous entries via RemoveDebugText(). */ final reliable client event AddDebugText(string DebugText, optional Actor SrcActor, optional float Duration = -1.f, optional vector Offset, optional vector DesiredOffset, optional color TextColor, optional bool bSkipOverwriteCheck, optional bool bAbsoluteLocation, optional bool bKeepAttachedToActor = TRUE, optional Font InFont ) { local int Idx; // set a default color if (TextColor.R == 0 && TextColor.G == 0 && TextColor.B == 0 && TextColor.A == 0) { TextColor.R = 255; TextColor.G = 255; TextColor.B = 255; TextColor.A = 255; } // and a default source actor of our pawn if (SrcActor != None) { if (Len(DebugText) == 0) { RemoveDebugText(SrcActor); } else { //`log("Adding debug text:"@DebugText@"for actor:"@SrcActor); // search for an existing entry if (!bSkipOverwriteCheck) { Idx = DebugTextList.Find('SrcActor',SrcActor); if (Idx == INDEX_NONE) { // manually grow the array one struct element Idx = DebugTextList.Length; DebugTextList.Length = Idx + 1; } } else { Idx = DebugTextList.Length; DebugTextList.Length = Idx + 1; } // assign the new text and actor DebugTextList[Idx].SrcActor = SrcActor; DebugTextList[Idx].SrcActorOffset = Offset; DebugTextList[Idx].SrcActorDesiredOffset = DesiredOffset; DebugTextList[Idx].DebugText = DebugText; DebugTextList[Idx].TimeRemaining = Duration; DebugTextList[Idx].Duration = Duration; DebugTextList[Idx].TextColor = TextColor; DebugTextList[Idx].bAbsoluteLocation=bAbsoluteLocation; DebugTextList[Idx].bKeepAttachedToActor=bKeepAttachedToActor; DebugTextList[Idx].OrigActorLocation = SrcActor.Location; DebugTextList[Idx].Font=InFont; } } } /** * Remove debug text for the specific actor. */ final reliable client event RemoveDebugText(Actor SrcActor) { local int Idx; Idx = DebugTextList.Find('SrcActor',SrcActor); if (Idx != INDEX_NONE) { DebugTextList.Remove(Idx,1); } } /** * Remove all debug text */ final reliable client event RemoveAllDebugStrings() { DebugTextList.Length=0; } /** * Registers the host's stat guid with the online subsystem * * @param StatGuid the stat guid to register */ reliable client function ClientRegisterHostStatGuid(string StatGuid) { if (OnlineSub != None && OnlineSub.StatsInterface != None) { OnlineSub.StatsInterface.AddRegisterHostStatGuidCompleteDelegate(OnRegisterHostStatGuidComplete); if(OnlineSub.StatsInterface.RegisterHostStatGuid(StatGuid)==false) { OnRegisterHostStatGuidComplete(false); } } } /** * Called once the host registration has completed. Sends the host this clients stat guid * * @param bWasSuccessful true if the registration worked, false otherwise */ function OnRegisterHostStatGuidComplete(bool bWasSuccessful) { local string StatGuid; OnlineSub.StatsInterface.ClearRegisterHostStatGuidCompleteDelegateDelegate(OnRegisterHostStatGuidComplete); if (bWasSuccessful) { StatGuid = OnlineSub.StatsInterface.GetClientStatGuid(); // Report the client stat guid back to the server ServerRegisterClientStatGuid(StatGuid); } } /** * Registers the client's stat guid with the online subsystem * * @param StatGuid the stat guid to register */ reliable server function ServerRegisterClientStatGuid(string StatGuid) { if (OnlineSub != None && OnlineSub.StatsInterface != None) { OnlineSub.StatsInterface.RegisterStatGuid(PlayerReplicationInfo.UniqueId,StatGuid); } } /** * Starts the online game using the session name in the PRI */ reliable client function ClientStartOnlineGame() { local OnlineGameSettings GameSettings; if (OnlineSub != None && OnlineSub.GameInterface != None && IsPrimaryPlayer()) { GameSettings = OnlineSub.GameInterface.GetGameSettings(PlayerReplicationInfo.SessionName); // Start the game if not already in progress if (GameSettings != None && (GameSettings.GameState == OGS_Pending || GameSettings.GameState == OGS_Ended)) { OnlineSub.GameInterface.StartOnlineGame(PlayerReplicationInfo.SessionName); } } } /** * Ends the online game using the session name in the PRI */ reliable client function ClientEndOnlineGame() { local OnlineGameSettings GameSettings; if (OnlineSub != None && OnlineSub.GameInterface != None&& IsPrimaryPlayer()) { GameSettings = OnlineSub.GameInterface.GetGameSettings(PlayerReplicationInfo.SessionName); // End the game if in progress if (GameSettings != None && GameSettings.GameState == OGS_InProgress) { OnlineSub.GameInterface.EndOnlineGame(PlayerReplicationInfo.SessionName); } } } /** Checks for parental controls blocking user created content */ function bool CanViewUserCreatedContent() { local LocalPlayer LocPlayer; LocPlayer = LocalPlayer(Player); if (LocPlayer != None && OnlineSub != None && OnlineSub.PlayerInterface != None) { return OnlineSub.PlayerInterface.CanDownloadUserContent(LocPlayer.ControllerId) == FPL_Enabled; } return true; } function IncrementNumberOfMatchesPlayed() { `log( " Num Matches Played: " $ PlayerReplicationInfo.AutomatedTestingData.NumberOfMatchesPlayed ); PlayerReplicationInfo.AutomatedTestingData.NumberOfMatchesPlayed++; } /** For AI debugging */ event SoakPause(Pawn P) { `log("Soak pause by "$P); SetViewTarget(P); SetPause(true); myHud.bShowDebugInfo = true; } // AI PATHING DEBUG exec function PathStep( optional int Cnt) { Pawn.IncrementPathStep( Max(1, Cnt), myHud.Canvas ); } exec function PathChild( optional int Cnt ) { Pawn.IncrementPathChild( Max(1, Cnt), myHud.Canvas ); } exec function PathClear() { Pawn.ClearPathStep(); } /** * Used when a host is telling a client to go to a specific Internet session * * @param SessionName the name of the session to register * @param SearchClass the search that should be populated with the session * @param PlatformSpecificInfo the binary data to place in the platform specific areas */ reliable client function ClientTravelToSession(name SessionName,class<OnlineGameSearch> SearchClass,byte PlatformSpecificInfo[80]) { local OnlineGameSearch Search; local LocalPlayer LP; local OnlineGameSearchResult SessionToJoin; LP = LocalPlayer(Player); if (LP != None) { Search = new SearchClass; // Get the information needed to travel to this destination if (OnlineSub.GameInterface.BindPlatformSpecificSessionToSearch(LP.ControllerId,Search,PlatformSpecificInfo)) { // There will be only one search result so use it SessionToJoin = Search.Results[0]; `Log("(PlayerController.ClientTravelToSession): " $" SessionName="$SessionName $" SearchClass="$SearchClass $" UniqueId="$OnlineSub.static.UniqueNetIdToString(PlayerReplicationInfo.UniqueId) $" Session.OwnerId="$OnlineSub.static.UniqueNetIdToString(SessionToJoin.GameSettings.OwningPlayerId)); // Fixup game settings object pre-join PreJoinUpdateGameSettings(SessionName,SessionToJoin.GameSettings); OnlineSub.GameInterface.AddJoinOnlineGameCompleteDelegate(OnJoinTravelToSessionComplete); // Now join this Session OnlineSub.GameInterface.JoinOnlineGame(LP.ControllerId,SessionName,SessionToJoin); } } } /** * Last chance to fixup game settings values before joining a game with those settings * * @param SessionName name of the session that is about to be joined * @param GameSettings settings object to be modified */ simulated function PreJoinUpdateGameSettings(name SessionName,OnlineGameSettings GameSettings); /** * Called when the join for the travel destination has completed * * @param SessionName the name of the session the event is for * @param bWasSuccessful whether it worked or not */ function OnJoinTravelToSessionComplete(name SessionName,bool bWasSuccessful) { local string URL; if (bWasSuccessful) { // We are joining so grab the connect string to use if (OnlineSub.GameInterface.GetResolvedConnectString(SessionName,URL)) { `Log("Resulting url for 'Game' is ("$URL$")"); // travel to the specified URL ClientTravel(URL, TRAVEL_Absolute); } } } /** * Used when a host is telling a client to return to their party host from the * current session. It looks for the session named 'Party' and does a travel to * it. If it's not available, it just does a "disconnect" * * @param RequestingPlayerId net id of the player that is requesting the travel */ reliable client function ClientReturnToParty(UniqueNetId RequestingPlayerId) { local string URL; // Disable when returning ourself to menus WorldInfo.ToggleHostMigration(false); // only do this for the first player in split-screen sessions. if (IsPrimaryPlayer()) { if (OnlineSub != None && OnlineSub.GameInterface != None && OnlineSub.PlayerInterface != None) { // Find the party settings to verify that a party is registered if (OnlineSub.GameInterface.GetGameSettings('Party') != None) { // Now see if we are the party host or not if (IsPartyLeader()) { // We are the party host so create the session and listen for returning clients URL = GetPartyMapName() $ "?game=" $ GetPartyGameTypeName() $ "?listen"; // Transition to being the party host without notifying clients and traveling absolute WorldInfo.ServerTravel(URL,true,true); } else { // We are joining so grab the connect string to use if (OnlineSub.GameInterface.GetResolvedConnectString('Party',URL)) { ClientTravel(URL, TRAVEL_Absolute); } } } else { ConsoleCommand("disconnect"); } } else { ConsoleCommand("disconnect"); } } } /** * RPC notification to client that a party host is about to leave the match * * @param PartyHostPlayerId net id of the party host that is leaving */ reliable client function ClientNotifyPartyHostLeaving(UniqueNetId PartyHostPlayerId) { if (PlayerReplicationInfo != None && PlayerReplicationInfo.UniqueId != PartyHostPlayerId) { //@todo sz - implement `Log(`location @ "Party host is leaving: " $" PartyHostPlayerId="$class'OnlineSubsystem'.static.UniqueNetIdToString(PartyHostPlayerId)); } } /** * RPC notification to server that a party host is about to leave the match. * * @param PartyHostPlayerId net id of the party host that is leaving */ reliable server function ServerNotifyPartyHostLeaving(UniqueNetId PartyHostPlayerId) { if (WorldInfo.Game != None) { // Forwarded notification to all clients WorldInfo.Game.TellClientsPartyHostIsLeaving(PartyHostPlayerId); } } /** * Wrapper for determining whether this player is the first player on their console. * * @return TRUE if this player is not using splitscreen, or is the first player in the split-screen layout. */ simulated final function bool IsPrimaryPlayer() { local int SSIndex; return !IsSplitscreenPlayer(SSIndex) || SSIndex == 0; } /** * Determines whether this player is playing split-screen. * * @param out_SplitscreenPlayerIndex receives the index [into the player's local GamePlayers array] for this player, if playing splitscreen. * . * @return TRUE if this player is playing splitscreen. */ simulated final function bool IsSplitscreenPlayer(optional out int out_SplitscreenPlayerIndex) { local bool bResult; local LocalPlayer LP; local NetConnection RemoteConnection; local ChildConnection ChildRemoteConnection; out_SplitscreenPlayerIndex = NetPlayerIndex; if (Player != None) { LP = LocalPlayer(Player); if (LP != None) { if (LP.Outer.GamePlayers.Length > 1) { out_SplitscreenPlayerIndex = LP.Outer.GamePlayers.Find(LP); bResult = true; } } else { RemoteConnection = NetConnection(Player); if (RemoteConnection.Children.Length > 0) { out_SplitscreenPlayerIndex = 0; bResult = true; } else { ChildRemoteConnection = ChildConnection(RemoteConnection); if (ChildRemoteConnection != None) { if (ChildRemoteConnection.Parent != None) { out_SplitscreenPlayerIndex = ChildRemoteConnection.Parent.Children.Find(ChildRemoteConnection) + 1; } bResult = true; } } } } return bResult; } /** * Returns the PRI associated with the player at the specified index. * * @param PlayerIndex the index [into the local player's GamePlayers array] for the player PRI to find * * @return the PRI associated with the player at the specified index, or None if the player is not a split-screen player or * the index was out of range. */ simulated function PlayerReplicationInfo GetSplitscreenPlayerByIndex( optional int PlayerIndex=1 ) { local PlayerReplicationInfo Result; local LocalPlayer LP, SplitPlayer; local NetConnection MasterConnection, RemoteConnection; local ChildConnection ChildRemoteConnection; if ( Player != None ) { if ( IsSplitscreenPlayer() ) { LP = LocalPlayer(Player); RemoteConnection = NetConnection(Player); if ( LP != None ) { // this PC is a local player if ( PlayerIndex >= 0 && PlayerIndex < LP.ViewportClient.Outer.GamePlayers.Length ) { SplitPlayer = LP.ViewportClient.Outer.GamePlayers[PlayerIndex]; Result = SplitPlayer.Actor.PlayerReplicationInfo; } else { `warn(`location $ ":" @ "requested player at invalid index!" @ `showvar(PlayerIndex) @ `showvar(LP.ViewportClient.Outer.GamePlayers.Length,NumLocalPlayers)); } } else if ( RemoteConnection != None ) { if ( WorldInfo.NetMode == NM_Client ) { //THIS SHOULD NEVER HAPPEN - IF HAVE A REMOTECONNECTION, WE SHOULDN'T BE A CLIENT // this player is a client `warn(`location $ ":" @ "CALLED ON CLIENT WITH VALID REMOTE NETCONNECTION!"); } else { ChildRemoteConnection = ChildConnection(RemoteConnection); if ( ChildRemoteConnection != None ) { // this player controller is not the primary player in the splitscreen layout MasterConnection = ChildRemoteConnection.Parent; if ( PlayerIndex == 0 ) { Result = MasterConnection.Actor.PlayerReplicationInfo; } else { PlayerIndex--; if ( PlayerIndex >= 0 && PlayerIndex < MasterConnection.Children.Length ) { ChildRemoteConnection = MasterConnection.Children[PlayerIndex]; Result = ChildRemoteConnection.Actor.PlayerReplicationInfo; } } } else if ( RemoteConnection.Children.Length > 0 ) { // this PC is the primary splitscreen player if ( PlayerIndex == 0 ) { // they want this player controller's PRI Result = PlayerReplicationInfo; } else { // our split-screen's PRI is being requested. PlayerIndex--; if ( PlayerIndex >= 0 && PlayerIndex < RemoteConnection.Children.Length ) { ChildRemoteConnection = RemoteConnection.Children[PlayerIndex]; Result = ChildRemoteConnection.Actor.PlayerReplicationInfo; } } } else { `log(`location $ ":" @ Player @ "IS NOT THE PRIMARY CONNECTION AND HAS NO CHILD CONNECTIONS!"); } } } else { `log(`location $ ":" @ Player @ "IS NOT A LOCALPLAYER AND NOT A REMOTECONNECTION! (No valid Player reference)"); } } } else { `log(`location $ ":" @ "NULL value for Player!"); } return Result; } /** * Returns the number of split-screen players playing on this player's machine. * * @return the total number of players on the player's local machine, or 0 if this player isn't playing split-screen. */ simulated function int GetSplitscreenPlayerCount() { local LocalPlayer LP; local NetConnection RemoteConnection; local int Result; if ( IsSplitscreenPlayer() ) { if ( Player != None ) { LP = LocalPlayer(Player); RemoteConnection = NetConnection(Player); if ( LP != None ) { Result = LP.ViewportClient.Outer.GamePlayers.Length; } else if ( RemoteConnection != None ) { if ( ChildConnection(RemoteConnection) != None ) { // we're the secondary (or otherwise) player in the split - we need to move up to the primary connection RemoteConnection = ChildConnection(RemoteConnection).Parent; } // add one for the primary player Result = RemoteConnection.Children.Length + 1; } else { `log(`location @ "NOT A LOCALPLAYER AND NOT A REMOTECONNECTION!"); } } else { `log(`location @ "called without a valid Player value!"); } } return Result; } reliable client function ClientControlMovieTexture(TextureMovie MovieTexture, SeqAct_ControlMovieTexture.EMovieControlType Mode) { if (MovieTexture != None) { switch (Mode) { case MCT_Play: MovieTexture.Play(); break; case MCT_Stop: MovieTexture.Stop(); break; case MCT_Pause: MovieTexture.Pause(); break; default: break; } } } /** * Forces the streaming system to disregard the normal logic for the specified duration and * instead always load all mip-levels for all textures used by the specified material. * * @param Material - The material whose textures should be forced into memory. * @param ForceDuration - Number of seconds to keep all mip-levels in memory, disregarding the normal priority logic. * @param CinematicTextureGroups - Bitfield indicating which texture groups that use extra high-resolution mips */ reliable client event ClientSetForceMipLevelsToBeResident( MaterialInterface Material, float ForceDuration, optional int CinematicTextureGroups ) { if ( Material != None && IsPrimaryPlayer() ) { Material.SetForceMipLevelsToBeResident( false, false, ForceDuration, CinematicTextureGroups ); } } /** * Forces the streaming system to disregard the normal logic for the specified duration and * instead always load all mip-levels for all textures used by the specified actor. * * @param ForcedActor - The actor whose textures should be forced into memory. * @param ForceDuration - Number of seconds to keep all mip-levels in memory, disregarding the normal priority logic. * @param bEnableStreaming - Whether to start (TRUE) or stop (FALSE) streaming * @param CinematicTextureGroups - Bitfield indicating which texture groups that use extra high-resolution mips */ reliable client event ClientPrestreamTextures( Actor ForcedActor, float ForceDuration, bool bEnableStreaming, optional int CinematicTextureGroups = 0 ) { if ( ForcedActor != None && IsPrimaryPlayer() ) { ForcedActor.PrestreamTextures( ForceDuration, bEnableStreaming, CinematicTextureGroups ); } } /** * Wrapper for determining whether a player is the party leader. * * @return TRUE if the player is the leader of the party; FALSE if not in a party or not the party leader. */ simulated function bool IsPartyLeader() { local OnlineGameSettings PartySettings; if ( OnlineSub != None && OnlineSub.GameInterface != None ) { // Find the party settings to verify that a party is registered PartySettings = OnlineSub.GameInterface.GetGameSettings('Party'); if ( PartySettings != None ) { if ( PlayerReplicationInfo != None ) { return PartySettings.OwningPlayerId == PlayerReplicationInfo.UniqueId; } } } return WorldInfo.NetMode != NM_Client && IsPrimaryPlayer(); } /** * Returns the party map name for this game */ static function string GetPartyMapName(); /** * Returns the party game info name for this game */ static function string GetPartyGameTypeName(); /** * Get the completion amount for a game achievement. * * @param AchievementId the id for the achievement to get the completion percetage for * @param CurrentValue the current number of times the event required to unlock the achievement has occurred. * @param MaxValue the value that represents 100% completion. * * @return TRUE if the AchievementId specified represents an progressive achievement. FALSE if the achievement is a one-time event * or if the AchievementId specified is invalid. */ event bool GetAchievementProgression( int AchievementId, out float CurrentValue, out float MaxValue ); //// SENTINEL FUNCTIONS START /** This is used to notify the PlayerController that a fly through has ended and then quit if we are doing a Sentinel run **/ simulated function OnFlyThroughHasEnded( SeqAct_FlyThroughHasEnded InAction ) { local PlayerController PC; if( WorldInfo.Game.IsDoingASentinelRun() ) { foreach WorldInfo.AllControllers(class'PlayerController', PC) { PC.ConsoleCommand( "quit" ); } } } /** * This is a function which is called when sentinel is able to start TravelTheWorld. This allows the specific game * to do things such as turning off UI/HUD and to not enter some default starting the game state. **/ function Sentinel_SetupForGamebasedTravelTheWorld() { } /** * This function is called before we acquire the travel points. **/ function Sentinel_PreAcquireTravelTheWorldPoints() { } /** * This function is called after we acquire the travel points right before we start traveling. **/ function Sentinel_PostAcquireTravelTheWorldPoints() { } //// SENTINEL FUNCTIONS END delegate InputMatchDelegate() { } /** Attempts to play force-feedback that matches the camera shake. To be implemented at a higher level (see GameFramework). */ simulated protected function DoForceFeedbackForScreenShake( CameraShake ShakeData, float ShakeScale ); /** Play Camera Shake */ unreliable client function ClientPlayCameraShake( CameraShake Shake, optional float Scale=1.f, optional bool bTryForceFeedback, optional ECameraAnimPlaySpace PlaySpace=CAPS_CameraLocal, optional rotator UserPlaySpaceRot ) { if (PlayerCamera != None) { PlayerCamera.PlayCameraShake(Shake, Scale, PlaySpace, UserPlaySpaceRot); if (bTryForceFeedback) { DoForceFeedbackForScreenShake(Shake, Scale); } } } unreliable client function ClientStopCameraShake( CameraShake Shake ) { if (PlayerCamera != None) { PlayerCamera.StopCameraShake(Shake); } } /** * Scripting hook for camera shakes. */ function OnCameraShake(SeqAct_CameraShake inAction) { if (inAction.InputLinks[0].bHasImpulse) { // start! if (InAction.bRadialShake) { // play an in-world camera shake if (InAction.LocationActor != None) { class'Camera'.static.PlayWorldCameraShake(InAction.Shake, inAction.LocationActor, inAction.LocationActor.Location, inAction.RadialShake_InnerRadius, inAction.RadialShake_OuterRadius, InAction.RadialShake_Falloff, InAction.bDoControllerVibration, inAction.bOrientTowardRadialEpicenter); } else { `Warn(self@"Location actor needed for bRadialFalloff camera shake."); return; } } else { // just shake Target(s) ClientPlayCameraShake(inAction.Shake, inAction.ShakeScale, inAction.bDoControllerVibration, inAction.PlaySpace, (inAction.LocationActor == None) ? rot(0,0,0) : inAction.LocationActor.Rotation ); } } else { // stop! ClientStopCameraShake(inAction.Shake); } } unreliable client event ClientPlayCameraAnim( CameraAnim AnimToPlay, optional float Scale=1.f, optional float Rate=1.f, optional float BlendInTime, optional float BlendOutTime, optional bool bLoop, optional bool bRandomStartTime, optional ECameraAnimPlaySpace Space=CAPS_CameraLocal, optional rotator CustomPlaySpace ) { local CameraAnimInst AnimInst; if (PlayerCamera != None) { AnimInst = PlayerCamera.PlayCameraAnim(AnimToPlay, Rate, Scale, BlendInTime, BlendOutTime, bLoop, bRandomStartTime); if (AnimInst != None && Space != CAPS_CameraLocal) { AnimInst.SetPlaySpace(Space, CustomPlaySpace); } } } reliable client event ClientStopCameraAnim(CameraAnim AnimToStop) { if (PlayerCamera != None) { PlayerCamera.StopAllCameraAnimsByType(AnimToStop); } } /** Toggle camera animation debug output */ exec function DebugCameraAnims() { bDebugCameraAnims = !bDebugCameraAnims; if (bDebugCameraAnims == FALSE) { // clear debug lines WorldInfo.FlushPersistentDebugLines(); } } /** Spawn a camera lens effect (e.g. blood).*/ unreliable client event ClientSpawnCameraLensEffect( class<EmitterCameraLensEffectBase> LensEffectEmitterClass ) { if (PlayerCamera != None) { PlayerCamera.AddCameraLensEffect(LensEffectEmitterClass); } } /** A trivial way to handle the SetSoundMode kismet action */ function OnSetSoundMode(SeqAct_SetSoundMode Action) { local AudioDevice Audio; Audio = class'Engine'.static.GetAudioDevice(); if (Audio != None) { if ( Action.InputLinks[0].bHasImpulse && (Action.SoundMode != None) ) { Audio.SetSoundMode(Action.SoundMode.Name); } else { Audio.SetSoundMode('Default'); } } } /** * Determine if this player has a peer connection for the given net id * * @param PeerNetId net id of remote client peer * @return TRUE if the player has the peer connection */ native function bool HasPeerConnection(const out UniqueNetId PeerNetId) const; /** * This will move the player and set their rotation to the passed in values. * We have this version of the BugIt family as it is easier to type in just raw numbers in the console. **/ exec function BugItGo( coerce float X, coerce float Y, coerce float Z, coerce int Pitch, coerce int Yaw, coerce int Roll ) { local vector TheLocation; local rotator TheRotation; TheLocation.X = X; TheLocation.Y = Y; TheLocation.Z = Z; TheRotation.Pitch = Pitch; TheRotation.Yaw = Yaw; TheRotation.Roll = Roll; BugItWorker( TheLocation, TheRotation ); } /** * This will move the player and set their rotation to the passed in values. * We have this version of the BugIt family strings can be passed in from the game ?options easily **/ function BugItGoString(string TheLocation, string TheRotation) { BugItWorker(vector(TheLocation), rotator(TheRotation)); } /** * This will move the player and set their rotation to the passed in values. * This actually does the location / rotation setting. Additionally it will set you as ghost as the level may have * changed since the last time you were here. And the bug may actually be inside of something. **/ function BugItWorker( vector TheLocation, rotator TheRotation ) { `log( "BugItGo to:" @ TheLocation @ TheRotation ); if( CheatManager != none ) { CheatManager.Ghost(); } ViewTarget.SetLocation( TheLocation ); Pawn.FaceRotation( TheRotation, 0.0f ); SetRotation( TheRotation ); } /** * This function is used to print out the BugIt location. It prints out copy and paste versions for both IMing someone to type in * and also a gameinfo ?options version so that you can append it to your launching url and be taken to the correct place. * Additionally, it will take a screen shot so reporting bugs is a one command action! * **/ exec event BugIt( optional string ScreenShotDescription ) { local vector ViewLocation; local rotator ViewRotation; local String GoString; local String LocString; ConsoleCommand( "bugscreenshot " $ ScreenShotDescription ); GetPlayerViewPoint( ViewLocation, ViewRotation ); if( Pawn != None ) { ViewLocation = Pawn.Location; } BugItStringCreator( ViewLocation, ViewRotation, GoString, LocString ); LogOutBugItGoToLogFile( ScreenShotDescription, GoString, LocString ); } /** * Logs the current location in bugit format without taking screenshot and further routing. */ exec function LogLoc() { local vector ViewLocation; local rotator ViewRotation; local String GoString; local String LocString; GetPlayerViewPoint( ViewLocation, ViewRotation ); if( Pawn != None ) { ViewLocation = Pawn.Location; } BugItStringCreator( ViewLocation, ViewRotation, GoString, LocString ); } exec event BugItAI( optional string ScreenShotDescription ) { local vector ViewLocation; local rotator ViewRotation; local String GoString; local String LocString; GetPlayerViewPoint( ViewLocation, ViewRotation ); if( Pawn != None ) { ViewLocation = Pawn.Location; } BugItStringCreator( ViewLocation, ViewRotation, GoString, LocString ); ConsoleCommand("debugai"); SetTimer(0.1,FALSE,nameof(DisableDebugAI)); LogOutBugItAIGoToLogFile( ScreenShotDescription, GoString, LocString ); } /** This will create a BugItGo string for us. Nice for calling form c++ where you just want the string and no Screenshots **/ exec event BugItStringCreator( const out Vector ViewLocation, const out Rotator ViewRotation, out String GoString, out String LocString ) { GoString = "BugItGo " $ ViewLocation.X $ " " $ ViewLocation.Y $ " " $ ViewLocation.Z $ " " $ ViewRotation.Pitch $ " " $ ViewRotation.Yaw $ " " $ ViewRotation.Roll; `log( GoString ); LocString = "?BugLoc=" $ string(ViewLocation) $ "?BugRot=" $ string(ViewRotation); `log( LocString ); } /** An event that is called after the first tick of GEngine */ event OnEngineInitialTick() { // by default, we need to hide any loading movies at this point (a subclass // can override this to keep the movie up longer) if (WorldInfo.IsConsoleBuild(CONSOLE_Mobile)) { ConsoleCommand("mobile stoploading"); } } `if(`notdefined(FINAL_RELEASE)) /** * Logs the list of active PRIs in the game */ function DebugLogPRIs() { local int PlayerIndex; local UniqueNetId NetId; // Log the PRI information for comparison with the online session state if (WorldInfo != None && WorldInfo.GRI != None) { `Log(" Number of PRI players: "$WorldInfo.GRI.PRIArray.Length); // List the PRIs that are here to find mismatches between the online state for (PlayerIndex = 0; PlayerIndex < WorldInfo.GRI.PRIArray.Length; PlayerIndex++) { NetId = WorldInfo.GRI.PRIArray[PlayerIndex].UniqueId; `Log(" Player: "$WorldInfo.GRI.PRIArray[PlayerIndex].PlayerName$" UID ("$class'OnlineSubsystem'.static.UniqueNetIdToString(NetId)$") PC ("$WorldInfo.GRI.PRIArray[PlayerIndex].Owner$")"); } `Log(""); } } /** * Logs the current session state for the online layer */ exec function DumpOnlineSessionState() { if (CheatManager != None) { CheatManager.DumpOnlineSessionState(); } else { // Log PRI player info DebugLogPRIs(); // Log the online session state if (OnlineSub != None) { OnlineSub.DumpSessionState(); } } } /** * Logs the current muting state of the server */ exec function DumpVoiceMutingState() { local UniqueNetId NetId; local PlayerController PC; local int MuteIndex; `Log(""); `Log("Voice state"); `Log("-------------------------------------------------------------"); `Log(""); // Log the online view of the voice state if (OnlineSub != None) { OnlineSub.DumpVoiceRegistration(); } `Log("Muting state"); // For each player list their gameplay mutes and system wide mutes foreach WorldInfo.AllControllers(class'PlayerController', PC) { `Log(" Player: "$PC.PlayerReplicationInfo.PlayerName); `Log(" Gameplay mutes: "); for (MuteIndex = 0; MuteIndex < PC.GameplayVoiceMuteList.Length; MuteIndex++) { NetId = PC.GameplayVoiceMuteList[MuteIndex]; `Log(" "$class'OnlineSubsystem'.static.UniqueNetIdToString(NetId)); } `Log(" System mutes: "); for (MuteIndex = 0; MuteIndex < PC.VoiceMuteList.Length; MuteIndex++) { NetId = PC.VoiceMuteList[MuteIndex]; `Log(" "$class'OnlineSubsystem'.static.UniqueNetIdToString(NetId)); } `Log(" Voice packet filter: "); for (MuteIndex = 0; MuteIndex < PC.VoicePacketFilter.Length; MuteIndex++) { NetId = PC.VoicePacketFilter[MuteIndex]; `Log(" "$class'OnlineSubsystem'.static.UniqueNetIdToString(NetId)); } `Log(""); } } /** * Logs the list of active peer connections for this player */ exec function DumpPeers() { local UniqueNetId NetId; local PlayerController PC; local int PeerIdx; local ConnectedPeerInfo PeerInfo; `Log(""); `Log("Peer List"); foreach WorldInfo.AllControllers(class'PlayerController', PC) { if (WorldInfo.NetMode == NM_Client || !PC.IsLocalPlayerController()) { `Log(" Player: "$PC.PlayerReplicationInfo.PlayerName$"("$class'OnlineSubsystem'.static.UniqueNetIdToString(PC.PlayerReplicationInfo.UniqueId)$")"); `Log(" Peer connections: "); for (PeerIdx = 0; PeerIdx < PC.ConnectedPeers.Length; PeerIdx++) { PeerInfo = PC.ConnectedPeers[PeerIdx]; `Log(" "$class'OnlineSubsystem'.static.UniqueNetIdToString(PeerInfo.PlayerId) // $" NAT="$PeerInfo.NATType $" HostLost="$PeerInfo.bLostConnectionToHost); } `Log(" Best Hosts:"); for (PeerIdx=0; PeerIdx < PC.BestNextHostPeers.Length; PeerIdx++) { NetId = PC.BestNextHostPeers[PeerIdx]; `Log(" "$class'OnlineSubsystem'.static.UniqueNetIdToString(NetId)); } `Log(""); } } } `endif function DisableDebugAI() { ConsoleCommand("debugai"); } private native function LogOutBugItGoToLogFile( const String InScreenShotDesc, const string InGoString, const string InLocString ); private native function LogOutBugItAIGoToLogFile( const String InScreenShotDesc, const string InGoString, const string InLocString ); /** * This function will be called to notify the player controller that the world has received it's game class. In the case of a client * we need to initialize the Input System here. * * @Param GameClass - The Class of the game that was replicated */ simulated function ReceivedGameClass(class<GameInfo> GameClass) { if (PlayerInput != none) { PlayerInput.ClientInitInputSystem(); } } defaultproperties { // The PlayerController is currently required to have collision as there is code that uses the collision // for moving the spectator camera around. Without collision certain assumptions will not hold (e.g. the // spectator does not have a pawn so the various game code looks at ALL pawns. Having a new pawnType will // require changes to that code. // Removing the collision from the controller and using the controller - pawn mechanic will eventually be coded // for spectator-esque functionality Begin Object Class=CylinderComponent Name=CollisionCylinder CollisionRadius=+22.000000 CollisionHeight=+22.000000 End Object CollisionComponent=CollisionCylinder CylinderComponent=CollisionCylinder Components.Add(CollisionCylinder) FOVAngle=85.000 NetPriority=3 bIsPlayer=true bCanDoSpecial=true Physics=PHYS_None CheatClass=class'Engine.CheatManager' InputClass=class'Engine.PlayerInput' CameraClass=class'Camera' MaxResponseTime=0.125 ClientCap=0 LastSpeedHackLog=-100.0 SavedMoveClass=class'SavedMove' DesiredFOV=85.000000 DefaultFOV=85.000000 LODDistanceFactor=1.0 bCinemaDisableInputMove=false bCinemaDisableInputLook=false bIsUsingStreamingVolumes=TRUE SpectatorCameraSpeed=600.0 MinRespawnDelay=1.0 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |