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 |
//============================================================================= // PlayerController // // PlayerControllers are used by human players to control pawns. // // This is a built-in Unreal class and it shouldn't be modified. // CHANGENOTE: All Changes since v739 in this class are related to the Weapon code update, except // for the change in Possess(). //============================================================================= //NEW (mdf) support Licensee extensions class PlayerController extends LicenseeController config(user) native nativereplication; //NEW (mdf) State names const BaseSpectatingState = 'BaseSpectating'; const SpectatingState = 'Spectating'; const PlayerClimbingState = 'PlayerClimbing'; const PlayerFlyingState = 'PlayerFlying'; const PlayerHelicopteringState = 'PlayerHelicoptering'; const PlayerSpideringState = 'PlayerSpidering'; const PlayerSwimmingState = 'PlayerSwimming'; const PlayerWaitingState = 'PlayerWaiting'; const PlayerWalkingState = 'PlayerWalking'; const WaitingForPawnState = 'WaitingForPawn'; //OLD // Player info. var const player Player; // player input control var globalconfig bool bLookUpStairs; // look up/down stairs (player) var globalconfig bool bSnapToLevel; // Snap to level eyeheight when not mouselooking var globalconfig bool bAlwaysMouseLook; var globalconfig bool bKeyboardLook; // no snapping when true var bool bCenterView; var const PlayerController nextPlayerController; //NEW (mdf) chained PlayerControllerList // Player control flags var bool bBehindView; // Outside-the-player view. 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 bUpdatePosition; var bool bIsTyping; var bool bFixedCamera; // used to fix camera in position (to view animations) //NEW MJL var bool bJumped; /*OLD var bool bJumpStatus; // used in net games */ var bool bUpdating; var globalconfig bool bNeverSwitchOnPickup; // if true, don't automatically switch to picked up weapon //NEW (mdf) - icky \hack moved here so can be accessed in native weapon code (U2PlayerController not native) var vector LeanOffset; // actual additional camera offset due to leaning (DesiredLeanOffset smoothed in over time) //OLD //NEW (mwp) replace the PlayerController.WeaponPriority support that was removed from Warfare var globalconfig name WeaponPriority[50]; // weapon class priorities higher is better //OLD var bool bZooming; var bool bOnlySpectator; // This controller is not allowed to possess pawns var globalconfig bool bCheatsEnabled; //NEW (mdf) var globalconfig bool bAlwaysLevel; var bool bSetTurnRot; var bool bCheatFlying; // instantly stop in flying mode var bool bFreeCamera; // free camera when in behindview mode (for checking out player models and animations) var bool bZeroRoll; var float AimingHelp; var float WaitDelay; // Delay time until can restart var input float aBaseX, aBaseY, aBaseZ, aMouseX, aMouseY, aForward, aTurn, aStrafe, aUp, aLookUp; var input byte bStrafe, bSnapLevel, bLook, bFreeLook, bTurn180, bTurnToNearest; var EDoubleClickDir DoubleClickDir; // direction of movement key double click (for special moves) // Camera info. var int ShowFlags; var int Misc1,Misc2; var int RendMap; var float OrthoZoom; // Orthogonal/map view zoom factor. var const actor ViewTarget; var float CameraDist; // multiplier for behindview camera dist var globalconfig float DesiredFOV; var globalconfig float DefaultFOV; var float ZoomLevel; // Screen flashes var vector FlashScale, FlashFog; var float DesiredFlashScale, ConstantGlowScale, InstantFlash; var vector DesiredFlashFog, ConstantGlowFog, InstantFog; // Distance fog fading. var color LastDistanceFogColor; var float LastDistanceFogStart; var float LastDistanceFogEnd; var float CurrentDistanceFogEnd; var float TimeSinceLastFogChange; var int LastZone; // Remote Pawn ViewTargets var rotator TargetViewRotation; var float TargetEyeHeight; var vector TargetWeaponViewOffset; var HUD myHUD; // heads up display info var float LastPlaySound; var globalconfig int AnnouncerVolume; // Music info. var string Song; var EMusicTransition Transition; // Move buffering for network games. Clients save their un-acknowledged moves in order to replay them // when they get position updates from the server. var SavedMove SavedMoves; // buffered moves pending position updates var SavedMove FreeMoves; // freed moves, available for buffering var SavedMove PendingMove; var float CurrentTimeStamp,LastUpdateTime,ServerTimeStamp,TimeMargin, ClientUpdateTime; var globalconfig float MaxTimeMargin; var Weapon OldClientWeapon; var int WeaponUpdate; // Progess Indicator - used by the engine to provide status messages (HUD is responsible for displaying these). var string ProgressMessage[4]; var color ProgressColor[4]; var float ProgressTimeOut; // Localized strings var localized string QuickSaveString; var localized string NoPauseMessage; var localized string ViewingFrom; var localized string OwnCamera; // ReplicationInfo var GameReplicationInfo GameReplicationInfo; // ngWorldStats Logging var globalconfig private string ngWorldSecret; var globalconfig bool ngSecretSet; var bool ReceivedSecretChecksum; var class<LocalMessage> LocalMessageClass; var globalconfig float Bob; var float LandBob, AppliedBob; var float bobtime; var vector WalkBob; // view shaking (affects roll, and offsets camera position) //NEW var float ShakeDuration,ShakeTime; var float ShakeMagX,ShakeMagY; var const float ShakePeriodX,ShakePeriodY; var vector ShakeOffset; //current magnitude to offset camera from shake /*OLD var float MaxShakeRoll; // max magnitude to roll camera var vector MaxShakeOffset; // max magnitude to offset camera position var float ShakeRollRate; // rate to change roll var vector ShakeOffsetRate; var vector ShakeOffset; //current magnitude to offset camera from shake var float ShakeRollTime; // how long to roll. if value is < 1.0, then MaxShakeOffset gets damped by this, else if > 1 then its the number of times to repeat undamped var vector ShakeOffsetTime; */ var Pawn TurnTarget; var config int EnemyTurnSpeed; var int GroundPitch; var rotator TurnRot180; var vector OldFloor; // used by PlayerSpider mode - floor for which old rotation was based; // Components ( inner classes ) //NEW /*OLD var CheatManager CheatManager; // Object within playercontroller that manages "cheat" commands var class<CheatManager> CheatClass; // class of my CheatManager */ var transient PlayerInput PlayerInput; // Object within playercontroller that manages player input. var class<PlayerInput> InputClass; // class of my PlayerInput //NEW MJL: needs to be here so the native code can run through the ExecManagers var array<Object> ExecManagers; // Array of execmanagers (cheatmanager is not used anymore) var array< class<Object> > ExecManagerClasses; // Array of default execmanager classes, set in the ini //OLD //NEW (mdf) var bool bForwardPressed; // mantling support (!!MJL tbr -- remove if definitely won't be used) var bool bUpPressed; // mantling support var globalconfig float SpectatingAccelerationScale; // default to faster movement when spectating and make the speed configurable var float CheatFlyingSpeed; // ghost can specify speed //OLD //NEW (mdf) matinee fixes var bool bMatineePossess; // set to true for duration of PossessMatinee/UnPossessMatinee //OLD // Demo recording view rotation var int DemoViewPitch; var int DemoViewYaw; var globalconfig bool ShowSubtitles; //NEW replication { // Functions server can call. reliable if( Role==ROLE_Authority ) ClientSetHUD,ClientReliablePlaySound, FOV, StartZoom, //NEW MJL ToggleZoom, StopZoom, EndZoom, ClientSetMusic, SetMasterVolume, /*OLD ToggleZoom, StopZoom, EndZoom, ClientSetMusic, ClientRestart, */ ClientReplicateSkins, ClientAdjustGlow, ClientSetBehindView, ClientSetFixedCamera, ClearProgressMessages, SetProgressMessage, SetProgressTime, //NEW MJL ClientGotoState; /*OLD GivePawn, ClientGotoState; */ reliable if ( (Role == ROLE_Authority) && (!bDemoRecording || (bClientDemoRecording && bClientDemoNetFunc)) ) ClientMessage, TeamMessage, ReceiveLocalizedMessage; unreliable if( Role==ROLE_Authority && !bDemoRecording ) ClientPlaySound; reliable if( Role==ROLE_Authority && !bDemoRecording ) ClientTravel; unreliable if( Role==ROLE_Authority ) SetFOVAngle, ClientShake, ClientFlash, ClientInstantFlash, ClientAdjustPosition, ShortClientAdjustPosition, VeryShortClientAdjustPosition, LongClientAdjustPosition; unreliable if( (!bDemoRecording || bClientDemoRecording && bClientDemoNetFunc) && Role==ROLE_Authority ) ClientHearSound; //NEW MJL: revised interface to send UI events reliable if( Role==ROLE_Authority ) ClientSendEvent; //OLD // Functions client can call. unreliable if( Role<ROLE_Authority ) ShortServerMove, ServerMove, Say, TeamSay, ServerSetHandedness; reliable if( Role<ROLE_Authority ) //NEW Speech, Pause, SetPause, Admin, PrevItem, ActivateItem, ServerReStartGame, ChangeName, ChangeTeam, Suicide, ActivateInventoryItem, ServerThrowWeapon, // new functions BehindView, Typing; /*OLD Speech, Pause, SetPause, PrevItem, ActivateItem, ServerReStartGame, AskForPawn, ChangeName, ChangeTeam, Suicide, ThrowWeapon, BehindView, Typing; */ } event Replication() { Super.Replication(); //controllers are only relevant to the player they correspond to, so bNetOwner checks are not necessary if( !bNetInitial ) { DOREP('bCollideWorld'); DOREP('CollisionRadius'); DOREP('CollisionHeight'); } if( bNetInitial ) { //needed so the initial replication reaches the client, and we can join the game in the first place DOREP('bNetOwner'); DOREP('GameReplicationInfo'); } DOREP('bBehindView'); DOREP('ViewTarget'); if ( (ViewTarget != Pawn) && Pawn(ViewTarget) != None ) { DOREP('TargetViewRotation'); DOREP('TargetEyeHeight'); DOREP('TargetWeaponViewOffset'); } /*NEW MJL: for our pawn viewtargets ... viewrotation is sent as part of the u2pawn's currentstatus. weaponviewoffset could be calculated clientside. eyeheight ... it changes? :) */ /* mjl-tbd: demos if( bDemoRecording ) { DOREP('DemoViewPitch'); DOREP('DemoViewYaw'); } */ } function SetAutoSaveIndex( int i ); // Autosave interface. function bool OKToCheat( optional bool bQuiet ) { return true; } //NEW (Mdf) //NEW MJL: for easier debugging exec function Mark() { log("Mark at Time = "$Level.TimeSeconds); } //NEW MJL: to allow easy overriding of the movement code protected function HandleMove ( float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot ) { if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, NewAccel, DoubleClickMove, DeltaRot); else ProcessMove(DeltaTime, NewAccel, DoubleClickMove, DeltaRot); } //OLD //NEW MJL: revised interface to send UI events native final function SendEvent( string Event ); final function ClientSendEvent( string Event ) { SendEvent( Event ); } //OLD native final function string GetPlayerNetworkAddress(); native function string ConsoleCommand( string Command ); native final function LevelInfo GetEntryLevel(); native(544) final function ResetKeyboard(); native /*final*/ function SetViewTarget(Actor NewViewTarget); //NEW (mdf) Allow overriding in subclasses. native event ClientTravel( string URL, ETravelType TravelType, bool bItems ); native(546) final function UpdateURL(string NewOption, string NewValue, bool bSaveDefault); 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(); /* 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); native event ClientHearSound ( actor Actor, int Id, sound S, vector SoundLocation, vector Parameters, bool Attenuate ); //NEW MJL exec function Admin( string CommandLine ) { local string Result; if( PlayerReplicationInfo.bAdmin || Level.NetMode == NM_Standalone ) { Result = ConsoleCommand( CommandLine ); if( Result!="" ) ClientMessage( Result ); } } //OLD event PostBeginPlay() { local int i; //NEW MJL: for the code below Super.PostBeginPlay(); SpawnDefaultHUD(); if (Level.LevelEnterText != "" ) ClientMessage(Level.LevelEnterText); DesiredFOV = DefaultFOV; SetViewTarget(self); // MUST have a view target! //NEW MJL: improved execmanager support if (Role==ROLE_Authority) { for (i=0; i<ExecManagerClasses.Length; i++) { ExecManagers[i] = new(self) ExecManagerClasses[i]; } } /*OLD if ( Level.NetMode == NM_Standalone ) CheatManager = new CheatClass; */ } /* SpawnDefaultHUD() Spawn a HUD (make sure that PlayerController always has valid HUD, even if \ ClientSetHUD() hasn't been called\ */ function SpawnDefaultHUD() { myHUD = spawn(class'HUD',self); } /* Reset() reset actor to initial state - used when restarting level without reloading. */ function Reset() { PawnDied(); Super.Reset(); SetViewTarget(self); bBehindView = false; WaitDelay = Level.TimeSeconds + 2; GotoState('PlayerWaiting'); } /* InitInputSystem() Spawn the appropriate class of PlayerInput Only called for playercontrollers that belong to local players */ event InitInputSystem() { PlayerInput = new InputClass; } /* ClientGotoState() server uses this to force client into NewState */ function ClientGotoState(name NewState, name NewLabel) { GotoState(NewState,NewLabel); } //NEW MJL /*OLD function AskForPawn() { if ( Pawn != None ) GivePawn(Pawn); else if ( IsInState('GameEnded') ) ClientGotoState('GameEnded', 'Begin'); else if ( IsInState('Dead') ) { bFrozen = false; ServerRestartPlayer(); } } function GivePawn(Pawn NewPawn) { if ( NewPawn == None ) return; Pawn = NewPawn; NewPawn.Controller = self; ClientRestart(); } */ /* GetFacingDirection() returns direction faced relative to movement dir 0 = forward 16384 = right 32768 = back 49152 = left */ function int GetFacingDirection() { local vector X,Y,Z, Dir; GetAxes(Pawn.Rotation, X,Y,Z); Dir = Normal(Pawn.Acceleration); if ( Y Dot Dir > 0 ) return ( 49152 + 16384 * (X Dot Dir) ); else return ( 16384 - 16384 * (X Dot Dir) ); } // Possess a pawn function Possess( Pawn aPawn ) { if ( bOnlySpectator ) return; //NEW MJL: //would be nice if we could do this on the server as well, // but various places set Pawn before code execution gets here // so this logic applies only on the server if( Level.NetMode == NM_Client ) { if( Pawn == aPawn ) return; if( Pawn != None ) UnPossess(); } //OLD SetRotation(aPawn.Rotation); //NEW MJL: Pawn = aPawn; Pawn.PossessedBy(self); /*OLD aPawn.PossessedBy(self); Pawn = aPawn; */ Pawn.bStasis = false; PlayerReplicationInfo.bIsFemale = Pawn.bIsFemale; ServerSetHandedness(Handedness); Restart(); } // unpossessed a pawn (not because pawn was killed) function UnPossess() { if ( Pawn != None ) { SetLocation(Pawn.Location); //NEW MJL Pawn.UnPossessed(); Pawn.RemoteRole = ROLE_SimulatedProxy; /*OLD Pawn.RemoteRole = ROLE_SimulatedProxy; Pawn.UnPossessed(); */ if ( Viewtarget == Pawn ) SetViewTarget(self); } Pawn = None; //NEW GotoState( SpectatingState ); /*OLD GotoState('Spectating'); */ } //NEW (mdf) matinee fixes function PossessMatinee( Pawn P ) { bMatineePossess = true; Possess( P ); bMatineePossess = false; } function UnPossessMatinee() { // basically a hack so we don't have to refactor 100's of lines of code bMatineePossess = true; UnPossess(); bMatineePossess = false; } //OLD // unpossessed a pawn (because pawn was killed) function PawnDied() { StopZoom(); if ( Pawn != None ) Pawn.RemoteRole = ROLE_SimulatedProxy; if ( ViewTarget == Pawn ) bBehindView = true; Super.PawnDied(); } function ClientSetHUD(class<HUD> newHUDType, class<Scoreboard> newScoringType) { local HUD NewHUD; if ( (myHUD == None) || ((newHUDType != None) && (newHUDType != myHUD.Class)) ) { NewHUD = spawn(newHUDType, self); if ( NewHUD != None ) { if ( myHUD != None ) myHUD.Destroy(); myHUD = NewHUD; } } if ( (myHUD != None) && (newScoringType != None) ) MyHUD.SpawnScoreBoard(newScoringType); } function HandlePickup(Pickup pick) { ReceiveLocalizedMessage( pick.MessageClass, 0, None, None, pick.Class ); } function ViewFlash(float DeltaTime) { local vector goalFog; local float goalscale, delta; delta = FMin(0.1, DeltaTime); goalScale = 1 + DesiredFlashScale + ConstantGlowScale; goalFog = DesiredFlashFog + ConstantGlowFog; if ( Pawn != None ) { goalScale += Pawn.HeadVolume.ViewFlash.X; goalFog += Pawn.HeadVolume.ViewFog; } DesiredFlashScale -= DesiredFlashScale * 2 * delta; DesiredFlashFog -= DesiredFlashFog * 2 * delta; FlashScale.X += (goalScale - FlashScale.X + InstantFlash) * 10 * delta; FlashFog += (goalFog - FlashFog + InstantFog) * 10 * delta; InstantFlash = 0; InstantFog = vect(0,0,0); if ( FlashScale.X > 0.981 ) FlashScale.X = 1; FlashScale = FlashScale.X * vect(1,1,1); if ( FlashFog.X < 0.019 ) FlashFog.X = 0; if ( FlashFog.Y < 0.019 ) FlashFog.Y = 0; if ( FlashFog.Z < 0.019 ) FlashFog.Z = 0; } event ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) { Message.Static.ClientReceive( Self, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject ); } event ClientMessage( coerce string S, optional Name Type ) { if (Type == '') Type = 'Event'; TeamMessage(PlayerReplicationInfo, S, Type); } event TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type ) { local string ConsoleString; //log("Teammessage with PRI "$PRI$" hud "$myHud$" Player "$Player$" console "$Player.console$" string "$S); ConsoleString = S; //NEW (mdf) -- temp warning fix until PRI stuff nailed down if ( PRI != None && ((Type == 'Say') || (Type == 'TeamSay')) ) /*OLD if ( (Type == 'Say') || (Type == 'TeamSay') ) */ ConsoleString = PRI.PlayerName$": "$ConsoleString; //NEW (mdf) -- temp warning fix until PRI stuff nailed down if( Player != None && Player.Console != None ) Player.Console.Message( ConsoleString, 6.0 ); /*OLD Player.Console.Message( ConsoleString, 6.0 ); */ myHUD.Message( PRI, S, Type ); } simulated function PlayBeepSound(); //Play a sound client side (so only client will hear it simulated function ClientPlaySound(sound ASound, optional bool bVolumeControl ) { local int i; ViewTarget.PlaySound(ASound, SLOT_None, 1); LastPlaySound = Level.TimeSeconds; // so voice messages won't overlap } simulated function ClientReliablePlaySound(sound ASound, optional bool bVolumeControl ) { ClientPlaySound(ASound, bVolumeControl); } simulated event Destroyed() { local SavedMove Next; local int i; //NEW (mdf) //NEW (mdf) if( Role == ROLE_Authority ) { for( i=0; i<ExecManagerClasses.Length; i++ ) { if( ExecManagers[ i ] != None ) ExecManagers[ i ].Delete(); } ExecManagers.Length = 0; } //OLD if ( Pawn != None ) { Pawn.Health = 0; Pawn.Died( self, class'Suicided', Pawn.Location, vect(0,0,0) ); } Super.Destroyed(); myHud.Destroy(); while ( FreeMoves != None ) { Next = FreeMoves.NextMove; FreeMoves.Destroy(); FreeMoves = Next; } while ( SavedMoves != None ) { Next = SavedMoves.NextMove; SavedMoves.Destroy(); SavedMoves = Next; } } function ClientSetMusic( string NewSong, EMusicTransition NewTransition ) { StopAllMusic( 0.0 ); PlayMusic( NewSong, 3.0 ); Song = NewSong; Transition = NewTransition; } // Volume is in decibels (-100db to +10db). exec function SetMasterVolume( int Volume ) { class'MusicScriptEvent'.static.SetMasterVolume( Volume ); } // ------------------------------------------------------------------------ // Zooming/FOV change functions function ToggleZoom() { if ( DefaultFOV != DesiredFOV ) EndZoom(); else StartZoom(); } function StartZoom() { ZoomLevel = 0.0; bZooming = true; } function StopZoom() { bZooming = false; } function EndZoom() { bZooming = false; DesiredFOV = DefaultFOV; } //NEW /*OLD (mdf) interferes with our exec -- is this needed? function SetFOV(float NewFOV) { DesiredFOV = NewFOV; FOVAngle = NewFOV; } */ function FixFOV() { FOVAngle = Default.DefaultFOV; DesiredFOV = Default.DefaultFOV; DefaultFOV = Default.DefaultFOV; } function ResetFOV() { DesiredFOV = DefaultFOV; FOVAngle = DefaultFOV; } exec function FOV(float F) { if( (F >= 80.0) || (Level.Netmode==NM_Standalone) ) { DefaultFOV = FClamp(F, 1, 170); DesiredFOV = DefaultFOV; SaveConfig(); } } // ------------------------------------------------------------------------ // Messaging functions // Send a message to all players. exec function Say( string Msg ) { Level.Game.Broadcast(self, Msg, 'Say'); } exec function TeamSay( string Msg ) { Level.Game.BroadcastTeam(self, Msg, 'Say'); } //NEW exec function Use(); exec function Unuse(); //OLD // ------------------------------------------------------------------------ function ServerSetHandedness( float hand) { Handedness = hand; if ( Pawn.Weapon != None ) Pawn.Weapon.SetHand(Handedness); } function SetHand() { Pawn.Weapon.SetHand(Handedness); ServerSetHandedness(Handedness); } function ChangeSetHand( string S ) { if ( S ~= "Left" ) Handedness = -1; else if ( S~= "Right" ) Handedness = 1; else if ( S ~= "Center" ) Handedness = 0; else if ( S ~= "Hidden" ) Handedness = 2; SetHand(); } event PreClientTravel() { } function ClientSetFixedCamera(bool B) { bFixedCamera = B; } function ClientSetBehindView(bool B) { bBehindView = B; } function ClientReplicateSkins(Material Skin1, optional Material Skin2, optional Material Skin3, optional Material Skin4) { // do nothing (just loading other player skins onto client) log("Getting "$Skin1$", "$Skin2$", "$Skin3$", "$Skin4); return; } function CheckBob(float DeltaTime, float Speed2D, vector Y) { if ( Speed2D < 10 ) BobTime += 0.2 * DeltaTime; else BobTime += DeltaTime * (0.3 + 0.7 * Speed2D/Pawn.GroundSpeed); WalkBob = Y * 0.4 * Bob * Speed2D * sin(8 * BobTime); AppliedBob = AppliedBob * (1 - FMin(1, 16 * deltatime)); if ( Speed2D < 10 ) WalkBob.Z = AppliedBob; else WalkBob.Z = AppliedBob + 0.3 * Bob * Speed2D * sin(16 * BobTime); if ( LandBob > 0.01 ) { AppliedBob += FMin(1, 16 * deltatime) * LandBob; LandBob *= (1 - 8*Deltatime); } } function vector WeaponBob(float BobDamping) { Local Vector WBob; WBob = BobDamping * WalkBob; WBob.Z = (0.45 + 0.55 * BobDamping) * WalkBob.Z; return (WBob + 0.9 * ShakeOffset); } function ClientVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID) { local VoicePack V; if ( (Sender == None) || (Sender.voicetype == None) || (Player.Console == None) ) return; V = Spawn(Sender.voicetype, self); if ( V != None ) V.ClientInitialize(Sender, Recipient, messagetype, messageID); } /* ForceDeathUpdate() Make sure ClientAdjustPosition immediately informs client of pawn's death */ function ForceDeathUpdate() { LastUpdateTime = Level.TimeSeconds - 10; } /* ShortServerMove() compressed version of server move for bandwidth saving */ function ShortServerMove ( float TimeStamp, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, byte ClientRoll, int View ) { ServerMove(TimeStamp,vect(0,0,0),ClientLoc,NewbRun,NewbDuck,NewbJumpStatus,DCLICK_None,ClientRoll,View); } /* ServerMove() - replicated function sent by client to server - contains client movement and firing info Passes acceleration in components so it doesn't get rounded. */ function ServerMove ( float TimeStamp, vector InAccel, vector ClientLoc, bool NewbRun, bool NewbDuck, //NEW bool bJumped, /*OLD bool NewbJumpStatus, */ eDoubleClickDir DoubleClickMove, byte ClientRoll, int View, optional byte OldTimeDelta, optional int OldAccel ) { local float DeltaTime, clientErr, OldTimeStamp; local rotator DeltaRot, Rot, ViewRot; local vector Accel, LocDiff, ClientVel, ClientFloor; local int maxPitch, ViewPitch, ViewYaw; local bool NewbPressedJump, OldbRun, OldbDuck; local eDoubleClickDir OldDoubleClickMove; local actor ClientBase; local ePhysics ClientPhysics; // If this move is outdated, discard it. if ( CurrentTimeStamp >= TimeStamp ) return; // if OldTimeDelta corresponds to a lost packet, process it first if ( OldTimeDelta != 0 ) { OldTimeStamp = TimeStamp - float(OldTimeDelta)/500 - 0.001; if ( CurrentTimeStamp < OldTimeStamp - 0.001 ) { // split out components of lost move (approx) Accel.X = OldAccel >>> 23; if ( Accel.X > 127 ) Accel.X = -1 * (Accel.X - 128); Accel.Y = (OldAccel >>> 15) & 255; if ( Accel.Y > 127 ) Accel.Y = -1 * (Accel.Y - 128); Accel.Z = (OldAccel >>> 7) & 255; if ( Accel.Z > 127 ) Accel.Z = -1 * (Accel.Z - 128); Accel *= 20; OldbRun = ( (OldAccel & 64) != 0 ); OldbDuck = ( (OldAccel & 32) != 0 ); //NEW MJL: jump (ugly copied code from below...to make ServerMove work, even though we have ServerMoveEx) NewbPressedJump = false; if ( (OldAccel & 16) != 0 ) { if ( bJump == 0 ) NewbPressedJump = true; bJump = 1; } else { bJump = 0; } /*OLD NewbPressedJump = ( (OldAccel & 16) != 0 ); if ( NewbPressedJump ) bJumpStatus = NewbJumpStatus; */ switch (OldAccel & 7) { case 0: OldDoubleClickMove = DCLICK_None; break; case 1: OldDoubleClickMove = DCLICK_Left; break; case 2: OldDoubleClickMove = DCLICK_Right; break; case 3: OldDoubleClickMove = DCLICK_Forward; break; case 4: OldDoubleClickMove = DCLICK_Back; break; } //log("Recovered move from "$OldTimeStamp$" acceleration "$Accel$" from "$OldAccel); MoveAutonomous(OldTimeStamp - CurrentTimeStamp, OldbRun, OldbDuck, NewbPressedJump, OldDoubleClickMove, Accel, rot(0,0,0)); CurrentTimeStamp = OldTimeStamp; } } // View components ViewPitch = View/32768; ViewYaw = 2 * (View - 32768 * ViewPitch); ViewPitch *= 2; // Make acceleration. Accel = InAccel/10; //NEW MJL: jump NewbPressedJump = false; if ( bJumped ) { if ( bJump == 0 ) NewbPressedJump = true; bJump = 1; } else { bJump = 0; } /*OLD NewbPressedJump = (bJumpStatus != NewbJumpStatus); bJumpStatus = NewbJumpStatus; */ /*uw829 has weapons handle their firing. we are retaining the old way...in U2PlayerNetTestController // handle firing and alt-firing if ( bFired ) { //NEW MJL: no ForceFire if ( bFire == 0 ) { bFire = 1; Fire(); } /*OLD if ( bForceFire && (Pawn != None) && (Pawn.Weapon != None) ) Pawn.Weapon.ForceFire(); else if ( bFire == 0 ) Fire(0); bFire = 1; */ } else bFire = 0; if ( bAltFired ) { //NEW MJL: no ForceAltFire if ( bAltFire == 0 ) { bAltFire = 1; AltFire(); } /*OLD if ( bForceAltFire && (Pawn != None) && (Pawn.Weapon != None) ) Pawn.Weapon.ForceAltFire(); else if ( bAltFire == 0 ) AltFire(0); bAltFire = 1; */ } else bAltFire = 0; */ // Save move parameters. DeltaTime = TimeStamp - CurrentTimeStamp; if ( ServerTimeStamp > 0 ) { // allow 1% error TimeMargin += DeltaTime - 1.01 * (Level.TimeSeconds - ServerTimeStamp); if ( TimeMargin > MaxTimeMargin ) { // player is too far ahead TimeMargin -= DeltaTime; if ( TimeMargin < 0.5 ) MaxTimeMargin = Default.MaxTimeMargin; else MaxTimeMargin = 0.5; DeltaTime = 0; } } CurrentTimeStamp = TimeStamp; ServerTimeStamp = Level.TimeSeconds; ViewRot.Pitch = ViewPitch; ViewRot.Yaw = ViewYaw; ViewRot.Roll = 0; SetRotation(ViewRot); if ( Pawn != None ) { Rot.Roll = 256 * ClientRoll; Rot.Yaw = ViewYaw; if ( (Pawn.Physics == PHYS_Swimming) || (Pawn.Physics == PHYS_Flying) ) maxPitch = 2; else maxPitch = 1; If ( (ViewPitch > maxPitch * RotationRate.Pitch) && (ViewPitch < 65536 - maxPitch * RotationRate.Pitch) ) { If (ViewPitch < 32768) Rot.Pitch = maxPitch * RotationRate.Pitch; else Rot.Pitch = 65536 - maxPitch * RotationRate.Pitch; } else Rot.Pitch = ViewPitch; //NEW MJL: Should use Pawn's Rotation, not Controller's DeltaRot = (Pawn.Rotation - Rot); /*OLD DeltaRot = (Rotation - Rot); */ Pawn.SetRotation(Rot); } // Perform actual movement. if ( (Level.Pauser == None) && (DeltaTime > 0) ) MoveAutonomous(DeltaTime, NewbRun, NewbDuck, NewbPressedJump, DoubleClickMove, Accel, DeltaRot); // Accumulate movement error. if ( Level.TimeSeconds - LastUpdateTime > 0.3 ) ClientErr = 10000; else if ( Level.TimeSeconds - LastUpdateTime > 180.0/Player.CurrentNetSpeed ) { if ( Pawn == None ) LocDiff = Location - ClientLoc; else LocDiff = Pawn.Location - ClientLoc; ClientErr = LocDiff Dot LocDiff; } // If client has accumulated a noticeable positional error, correct him. if ( ClientErr > 3 ) { if ( Pawn == None ) { ClientPhysics = Physics; ClientLoc = Location; ClientVel = Velocity; } else { ClientPhysics = Pawn.Physics; ClientVel = Pawn.Velocity; ClientBase = Pawn.Base; if ( Mover(Pawn.Base) != None ) ClientLoc = Pawn.Location - Pawn.Base.Location; else ClientLoc = Pawn.Location; ClientFloor = Pawn.Floor; } //log("Client Error at "$TimeStamp$" is "$ClientErr$" with acceleration "$Accel$" LocDiff "$LocDiff$" Physics "$Pawn.Physics); LastUpdateTime = Level.TimeSeconds; if ( (Pawn == None) || (Pawn.Physics != PHYS_Spider) ) { if ( ClientVel == vect(0,0,0) ) { if ( IsInState('PlayerWalking') && (Pawn != None) && (Pawn.Physics == PHYS_Walking) ) { VeryShortClientAdjustPosition ( TimeStamp, ClientLoc.X, ClientLoc.Y, ClientLoc.Z, ClientBase ); } else ShortClientAdjustPosition ( TimeStamp, GetStateName(), ClientPhysics, ClientLoc.X, ClientLoc.Y, ClientLoc.Z, ClientBase ); } else ClientAdjustPosition ( TimeStamp, GetStateName(), ClientPhysics, ClientLoc.X, ClientLoc.Y, ClientLoc.Z, ClientVel.X, ClientVel.Y, ClientVel.Z, ClientBase ); } else LongClientAdjustPosition ( TimeStamp, GetStateName(), ClientPhysics, ClientLoc.X, ClientLoc.Y, ClientLoc.Z, ClientVel.X, ClientVel.Y, ClientVel.Z, ClientBase, ClientFloor.X, ClientFloor.Y, ClientFloor.Z ); } //log("Server moved stamp "$TimeStamp$" location "$Pawn.Location$" Acceleration "$Pawn.Acceleration$" Velocity "$Pawn.Velocity); } function ProcessMove ( float DeltaTime, vector newAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { if ( Pawn != None ) Pawn.Acceleration = newAccel; } final function MoveAutonomous ( float DeltaTime, bool NewbRun, bool NewbDuck, bool NewbPressedJump, eDoubleClickDir DoubleClickMove, vector newAccel, rotator DeltaRot ) { //NEW (mdf) if ( NewbRun ) SetRunFlag( 1 ); else SetRunFlag( 0 ); if ( NewbDuck ) SetDuckFlag( 1 ); else SetDuckFlag( 0 ); /*OLD if ( NewbRun ) bRun = 1; else bRun = 0; if ( NewbDuck ) bDuck = 1; else bDuck = 0; */ bPressedJump = NewbPressedJump; HandleWalking(); ProcessMove(DeltaTime, newAccel, DoubleClickMove, DeltaRot); if ( Pawn != None ) Pawn.AutonomousPhysics(DeltaTime); else AutonomousPhysics(DeltaTime); //log("Role "$Role$" moveauto time "$100 * DeltaTime$" ("$Level.TimeDilation$")"); } /* VeryShortClientAdjustPosition bandwidth saving version, when velocity is zeroed, and pawn is walking */ 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 */ 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); } /* ClientAdjustPosition - pass newloc and newvel in components so they don't get rounded */ 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); } /* LongClientAdjustPosition long version, when care about pawn's floor normal */ 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, NewFloor; local Actor MoveActor; if ( Pawn != None ) { if ( Pawn.bTearOff ) { Pawn = None; GotoState('Dead'); return; } MoveActor = Pawn; } else MoveActor = self; if ( CurrentTimeStamp > TimeStamp ) return; CurrentTimeStamp = TimeStamp; NewLocation.X = NewLocX; NewLocation.Y = NewLocY; NewLocation.Z = NewLocZ; MoveActor.Velocity.X = NewVelX; MoveActor.Velocity.Y = NewVelY; MoveActor.Velocity.Z = NewVelZ; NewFloor.X = NewFloorX; NewFloor.Y = NewFloorY; NewFloor.Z = NewFloorZ; MoveActor.SetBase(NewBase, NewFloor); if ( Mover(NewBase) != None ) NewLocation += NewBase.Location; //log("Client "$Role$" adjust "$self$" stamp "$TimeStamp$" location "$MoveActor.Location); MoveActor.bCanTeleport = false; MoveActor.SetLocation(NewLocation); MoveActor.bCanTeleport = true; MoveActor.SetPhysics(newPhysics); if( GetStateName() != newstate ) GotoState(newstate); bUpdatePosition = true; } function ClientUpdatePosition() { local SavedMove CurrentMove; local int realbRun, realbDuck; local bool bRealJump; local float TotalTime; bUpdatePosition = false; //NEW (mdf) realbRun = GetbRun(); realbDuck = GetbDuck(); /*OLD realbRun = bRun; realbDuck = bDuck; */ bRealJump = bPressedJump; CurrentMove = SavedMoves; bUpdating = true; while ( CurrentMove != None ) { if ( CurrentMove.TimeStamp <= CurrentTimeStamp ) { SavedMoves = CurrentMove.NextMove; CurrentMove.NextMove = FreeMoves; FreeMoves = CurrentMove; FreeMoves.Clear(); CurrentMove = SavedMoves; } else { if ( (TotalTime > 0) && (Pawn != None) ) AdjustRadius(CurrentMove.Delta * Pawn.GroundSpeed); TotalTime += CurrentMove.Delta; MoveAutonomous(CurrentMove.Delta, CurrentMove.bRun, CurrentMove.bDuck, CurrentMove.bPressedJump, CurrentMove.DoubleClickMove, CurrentMove.Acceleration, rot(0,0,0)); CurrentMove = CurrentMove.NextMove; } } //log("Client updated position to "$Pawn.Location); bUpdating = false; //NEW (mdf) SetDuckFlag( realbDuck ); SetRunFlag( realbRun ); /*OLD bDuck = realbDuck; bRun = realbRun; */ bPressedJump = bRealJump; } function AdjustRadius(float MaxMove) { local Pawn P; local vector Dir; // if other pawn moving away from player, push it away if its close // since the client-side position is behind the server side position ForEach DynamicActors(class'Pawn', P) if ( (P != Pawn) && (P.Velocity != vect(0,0,0)) && P.bBlockPlayers ) { Dir = Normal(P.Location - Pawn.Location); if ( (Pawn.Velocity Dot Dir > 0) && (P.Velocity Dot Dir > 0) ) { if ( VSize(P.Location - Pawn.Location) < P.CollisionRadius + Pawn.CollisionRadius + MaxMove ) //NEW MJL: should be 1 * ping, not .5 * ping, since our view is one full ping out of sync with our local gamestate P.MoveSmooth(P.Velocity * PlayerReplicationInfo.Ping / 1000.0 ); /*OLD P.MoveSmooth(P.Velocity * 0.5 * PlayerReplicationInfo.Ping); */ } } } final function SavedMove GetFreeMove() { local SavedMove s, first; local int i; if ( FreeMoves == None ) { // don't allow more than 30 saved moves For ( s=SavedMoves; s!=None; s=s.NextMove ) { i++; if ( i > 30 ) { 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; } return first; } } return Spawn(class'SavedMove'); } 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() event 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, LastMove; local byte ClientRoll; local float OldTimeDelta, NetMoveDelta; local int i, OldAccel; local vector BuildAccel, AccelNorm, MoveLoc; // Get a SavedMove actor to store the movement in. if ( PendingMove != None ) PendingMove.SetMoveFor(self, DeltaTime, NewAccel, DoubleClickMove); if ( SavedMoves != None ) { NewMove = SavedMoves; AccelNorm = Normal(NewAccel); while ( NewMove.NextMove != None ) { // find most recent interesting move to send redundantly if ( NewMove.bPressedJump || ((NewMove.DoubleClickMove != DCLICK_NONE) && (NewMove.DoubleClickMove < 5)) || ((NewMove.Acceleration != NewAccel) && ((normal(NewMove.Acceleration) Dot AccelNorm) < 0.95)) ) OldMove = NewMove; NewMove = NewMove.NextMove; } if ( NewMove.bPressedJump || ((NewMove.DoubleClickMove != DCLICK_NONE) && (NewMove.DoubleClickMove < 5)) || ((NewMove.Acceleration != NewAccel) && ((normal(NewMove.Acceleration) Dot AccelNorm) < 0.95)) ) OldMove = NewMove; } LastMove = NewMove; NewMove = GetFreeMove(); if ( NewMove == None ) return; NewMove.SetMoveFor(self, DeltaTime, NewAccel, DoubleClickMove); // adjust radius of nearby players with uncertain location if ( Pawn != None ) AdjustRadius(NewMove.Delta * Pawn.GroundSpeed); // Simulate the movement locally. ProcessMove(NewMove.Delta, NewMove.Acceleration, NewMove.DoubleClickMove, DeltaRot); if ( Pawn != None ) Pawn.AutonomousPhysics(NewMove.Delta); else AutonomousPhysics(DeltaTime); //log("Role "$Role$" repmove at "$Level.TimeSeconds$" Move time "$100 * DeltaTime$" ("$Level.TimeDilation$")"); // Decide whether to hold off on move // send if double click move, jump, or fire unless really too soon, or if newmove.delta big enough // on client side, save extra buffered time in LastUpdateTime if ( PendingMove == None ) PendingMove = NewMove; else { NewMove.NextMove = FreeMoves; FreeMoves = NewMove; FreeMoves.Clear(); NewMove = PendingMove; } NetMoveDelta = FMax(64.0/Player.CurrentNetSpeed, 0.011); if ( !PendingMove.bPressedJump && (PendingMove.Delta < NetMoveDelta - ClientUpdateTime) ) { // save as pending move return; } else if ( (ClientUpdateTime < 0) && (PendingMove.Delta < NetMoveDelta - ClientUpdateTime) ) return; else { ClientUpdateTime = PendingMove.Delta - NetMoveDelta; if ( SavedMoves == None ) SavedMoves = PendingMove; else LastMove.NextMove = PendingMove; PendingMove = None; } // check if need to redundantly send previous move if ( OldMove != None ) { // log("Redundant send timestamp "$OldMove.TimeStamp$" accel "$OldMove.Acceleration$" at "$Level.Timeseconds$" New accel "$NewAccel); // old move important to replicate redundantly OldTimeDelta = FMin(255, (Level.TimeSeconds - OldMove.TimeStamp) * 500); BuildAccel = 0.05 * OldMove.Acceleration + vect(0.5, 0.5, 0.5); OldAccel = (CompressAccel(BuildAccel.X) << 23) + (CompressAccel(BuildAccel.Y) << 15) + (CompressAccel(BuildAccel.Z) << 7); if ( OldMove.bRun ) OldAccel += 64; if ( OldMove.bDuck ) OldAccel += 32; if ( OldMove.bPressedJump ) OldAccel += 16; OldAccel += OldMove.DoubleClickMove; } //else // log("No redundant timestamp at "$Level.TimeSeconds$" with accel "$NewAccel); //log("Replicate move at "$NewMove.TimeStamp$" location "$Pawn.Location); // Send to the server ClientRoll = (Rotation.Roll >> 8) & 255; //NEW /*OLD if ( NewMove.bPressedJump ) bJumpStatus = !bJumpStatus; */ if ( Pawn == None ) MoveLoc = Location; else MoveLoc = Pawn.Location; if ( (NewMove.Acceleration == vect(0,0,0)) && (NewMove.DoubleClickMove == DCLICK_None) ) ShortServerMove ( NewMove.TimeStamp, MoveLoc, NewMove.bRun, NewMove.bDuck, //NEW NewMove.bPressedJump, /*OLD bJumpStatus, */ ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)) ); else ServerMove ( NewMove.TimeStamp, NewMove.Acceleration * 10, MoveLoc, NewMove.bRun, NewMove.bDuck, //NEW NewMove.bPressedJump, /*OLD bJumpStatus, */ NewMove.DoubleClickMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)), OldTimeDelta, OldAccel ); } function HandleWalking() { //NEW (mdf) note: totally overridden for U2 Pawn.SetWalking( ((GetRunFlag() > 0) || (GetDuckFlag() > 0)) && !Region.Zone.IsA('WarpZoneInfo') ); /*OLD Pawn.SetWalking(((bRun != 0) || (bDuck != 0)) && !Region.Zone.IsA('WarpZoneInfo')); */ } function ServerRestartGame() { } function SetFOVAngle(float newFOV) { FOVAngle = newFOV; } function ClientFlash( float scale, vector fog ) { DesiredFlashScale = scale; DesiredFlashFog = 0.001 * fog; } function ClientInstantFlash( float scale, vector fog ) { InstantFlash = scale; InstantFog = 0.001 * fog; } function ClientAdjustGlow( float scale, vector fog ) { ConstantGlowScale += scale; ConstantGlowFog += 0.001 * fog; } /* ClientShake() Function called on client to shake view. Only ShakeView() should call ClientShake() */ /*OLD private function ClientShake(vector ShakeRoll, vector OffsetMag, vector ShakeRate, float OffsetTime) { if ( (MaxShakeRoll < ShakeRoll.X) || (ShakeRollTime < 0.01 * ShakeRoll.Y) ) { MaxShakeRoll = ShakeRoll.X; ShakeRollTime = 0.01 * ShakeRoll.Y; ShakeRollRate = 0.01 * ShakeRoll.Z; } if ( VSize(OffsetMag) > VSize(MaxShakeOffset) ) { ShakeOffsetTime = OffsetTime * vect(1,1,1); MaxShakeOffset = OffsetMag; ShakeOffsetRate = ShakeRate; } } */ /* ShakeView() Call this function to shake the player's view shaketime = how long to roll view RollMag = how far to roll view as it shakes OffsetMag = max view offset RollRate = how fast to roll view OffsetRate = how fast to offset view OffsetTime = how long to offset view (number of shakes) */ /*OLD function ShakeView( float shaketime, float RollMag, vector OffsetMag, float RollRate, vector OffsetRate, float OffsetTime) { local vector ShakeRoll; ShakeRoll.X = RollMag; ShakeRoll.Y = 100 * shaketime; ShakeRoll.Z = 100 * rollrate; ClientShake(ShakeRoll, OffsetMag, OffsetRate, OffsetTime); } */ //NEW (mdf) -- of no use for players in U2 /* function DamageAttitudeTo(pawn Other, float Damage) { if ( (Other != None) && (Other != Pawn) && (Damage > 0) ) Enemy = Other; } */ function Typing( bool bTyping ) { bIsTyping = bTyping; //NEW /*OLD (mdf) not used for U2 if ( bTyping && (Pawn != None) && !Pawn.bTearOff ) Pawn.ChangeAnimation(); */ if (Level.Game.StatLog != None) Level.Game.StatLog.LogTypingEvent(bTyping, Self); } // ------------------------------------------------------------------------ // Normal gameplay execs // Type the name of the exec function at the console to execute it exec function Jump( optional float F ) { if ( Level.Pauser == PlayerReplicationInfo ) SetPause(False); else bPressedJump = true; } // Send a voice message of a certain type to a certain player. exec function Speech( int Type, int Index, int Callsign ) { local VoicePack V; V = Spawn( PlayerReplicationInfo.VoiceType, Self ); if (V != None) V.PlayerSpeech( Type, Index, Callsign ); } exec function RestartLevel() { if( Level.Netmode==NM_Standalone ) ClientTravel( "?restart", TRAVEL_Relative, false ); } exec function LocalTravel( string URL ) { if( Level.Netmode==NM_Standalone ) ClientTravel( URL, TRAVEL_Relative, false ); } // ------------------------------------------------------------------------ // Loading and saving /* QuickSave() Save game to slot 9 */ exec function QuickSave() { if ( (Pawn.Health > 0) && (Level.NetMode == NM_Standalone) ) { ClientMessage(QuickSaveString); ConsoleCommand("SaveGame 9"); } } /* QuickLoad() Load game from slot 9 */ exec function QuickLoad() { if ( Level.NetMode == NM_Standalone ) ClientTravel( "?load=9", TRAVEL_Absolute, false); } /* SetPause() Try to pause game; returns success indicator. Replicated to server in network games. */ function bool SetPause( BOOL bPause, optional int Key ) { return Level.Game.SetPause(bPause, self, Key); } /* Pause() Command to try to pause the game. */ exec function Pause() { if( !SetPause(Level.Pauser==None) ) ClientMessage(NoPauseMessage); } // Activate specific inventory item exec function ActivateInventoryItem( class InvItem ) { local Powerups Inv; Inv = Powerups(Pawn.FindInventoryType(InvItem)); if ( Inv != None ) Inv.Activate(); } // ------------------------------------------------------------------------ // Weapon changing functions /* ThrowWeapon() Throw out current weapon, and switch to a new weapon */ //NEW MJL function ServerThrowWeapon() { Pawn.Weapon.bTossedOut = true; Pawn.TossWeapon(Vector(Rotation) * 500 + vect(0,0,220)); SwitchToBestWeapon(); } exec function ThrowWeapon() { if( Pawn == None || Pawn.Weapon==None || !Pawn.Weapon.bCanThrow ) return; ServerThrowWeapon(); //if we are on the server, then ServerThrowWeapon handles SwitchToBestWeapon // and Pawn.TossWeapon handles Pawn.DeleteInventory if ( Level.NetMode == NM_Client ) { //we have to do this here in order to stay 'in sync' with the server. // otherwise bad things will happen Pawn.Weapon.ClearWeaponEffects(); Pawn.DeleteInventory(Pawn.Weapon); SwitchToBestWeapon(); } } /*OLD exec function ThrowWeapon() { if( Level.NetMode == NM_Client ) return; if( Pawn.Weapon==None || !Pawn.Weapon.bCanThrow ) return; Pawn.Weapon.bTossedOut = true; Pawn.TossWeapon(Vector(Rotation) * 500 + vect(0,0,220)); if ( Pawn.Weapon == None ) SwitchToBestWeapon(); } */ /* PrevWeapon() - switch to previous inventory group weapon */ exec function PrevWeapon() { if( Level.Pauser!=None ) return; if ( Pawn.Weapon == None ) { SwitchToBestWeapon(); return; } if ( Pawn.PendingWeapon != None ) Pawn.PendingWeapon = Pawn.Inventory.PrevWeapon(None, Pawn.PendingWeapon); else Pawn.PendingWeapon = Pawn.Inventory.PrevWeapon(None, Pawn.Weapon); if ( Pawn.PendingWeapon != None ) Pawn.Weapon.PutDown(); } /* NextWeapon() - switch to next inventory group weapon */ exec function NextWeapon() { if( Level.Pauser!=None ) return; //2002.12.19 (mdf) warning fix if( Pawn == None ) return; if ( Pawn.Weapon == None ) { SwitchToBestWeapon(); return; } if ( Pawn.PendingWeapon != None ) Pawn.PendingWeapon = Pawn.Inventory.NextWeapon(None, Pawn.PendingWeapon); else Pawn.PendingWeapon = Pawn.Inventory.NextWeapon(None, Pawn.Weapon); if ( Pawn.PendingWeapon != None ) Pawn.Weapon.PutDown(); } // The player wants to switch to weapon group number F. exec function SwitchWeapon (byte F ) { local weapon newWeapon; //NEW MIB changed WeaponChange call, cleaned up if ( (Level.Pauser!=None) || (Pawn == None) || (Pawn.Inventory == None) ) return; newWeapon = Pawn.Inventory.WeaponChange(F,None); if ( newWeapon != None ) { if ( Pawn.Weapon == None ) { Pawn.PendingWeapon = newWeapon; Pawn.ChangedWeapon(); } else if ( Pawn.Weapon != newWeapon || (Pawn.PendingWeapon != None && newWeapon != Pawn.PendingWeapon) ) { Pawn.PendingWeapon = newWeapon; if ( !Pawn.Weapon.PutDown() ) Pawn.PendingWeapon = None; } } /*OLD if ( (Level.Pauser!=None) || (Pawn == None) || (Pawn.Inventory == None) ) return; if ( (Pawn.Weapon != None) && (Pawn.Weapon.Inventory != None) ) newWeapon = Pawn.Weapon.Inventory.WeaponChange(F); else newWeapon = None; if ( newWeapon == None ) newWeapon = Pawn.Inventory.WeaponChange(F); if ( newWeapon == None ) return; if ( Pawn.Weapon == None ) { Pawn.PendingWeapon = newWeapon; Pawn.ChangedWeapon(); } else if ( Pawn.Weapon != newWeapon ) { Pawn.PendingWeapon = newWeapon; if ( !Pawn.Weapon.PutDown() ) Pawn.PendingWeapon = None; } */ } exec function GetWeapon(class<Weapon> NewWeaponClass ) { local Inventory Inv; if ( (Pawn.Inventory == None) || (NewWeaponClass == None) || ((Pawn.Weapon != None) && (Pawn.Weapon.Class == NewWeaponClass)) ) return; for ( Inv=Pawn.Inventory; Inv!=None; Inv=Inv.Inventory ) if ( Inv.Class == NewWeaponClass ) { Pawn.PendingWeapon = Weapon(Inv); if ( !Pawn.PendingWeapon.HasAmmo() ) { ClientMessage( Pawn.PendingWeapon.ItemName$Pawn.PendingWeapon.MessageNoAmmo ); Pawn.PendingWeapon = None; return; } Pawn.Weapon.PutDown(); return; } } // The player wants to select previous item exec function PrevItem() { local Inventory Inv; local Powerups LastItem; if ( Level.Pauser!=None ) return; if (Pawn.SelectedItem==None) { //NEW (mdf) P/C fix -- EPIC PLEASE FIX ALSO! Pawn.SelectedItem = Pawn.Inventory.SelectNext(); /*OLD Pawn.SelectedItem = Inventory.SelectNext(); */ Return; } if (Pawn.SelectedItem.Inventory!=None) for( Inv=Pawn.SelectedItem.Inventory; Inv!=None; Inv=Inv.Inventory ) { if (Inv==None) Break; if ( Inv.IsA('Powerups') && Powerups(Inv).bActivatable) LastItem=Powerups(Inv); } for( Inv=Pawn.Inventory; Inv!=Pawn.SelectedItem; Inv=Inv.Inventory ) { if (Inv==None) Break; if ( Inv.IsA('Powerups') && Powerups(Inv).bActivatable) LastItem=Powerups(Inv); } if (LastItem!=None) Pawn.SelectedItem = LastItem; } // The player wants to active selected item exec function ActivateItem() { if( Level.Pauser!=None ) return; if ( (Pawn != None) && (Pawn.SelectedItem!=None) ) Pawn.SelectedItem.Activate(); } // The player wants to fire. //NEW (mdf) weapon interface cleanup exec function Fire() /*OLD exec function Fire( optional float F ) */ { //NEW /*OLD MJL: overridden in U2PlayerController if ( Level.Pauser == PlayerReplicationInfo ) { SetPause(false); return; } if( Pawn.Weapon!=None ) Pawn.Weapon.Fire(F); */ } // The player wants to alternate-fire. //NEW (mdf) weapon interface cleanup exec function AltFire() /*OLD exec function AltFire( optional float F ) */ { //NEW /*OLD MJL: overridden in U2PlayerController if ( Level.Pauser == PlayerReplicationInfo ) { SetPause(false); return; } if( Pawn.Weapon!=None ) Pawn.Weapon.AltFire(F); */ } //NEW /*OLD MIB // The player wants to use something in the level. exec function Use() { local Actor A; if ( Level.Pauser == PlayerReplicationInfo ) { SetPause(false); return; } // Send the 'DoUse' event to each actor player is touching. ForEach Pawn.TouchingActors(class'Actor', A) { A.UsedBy(Pawn); } } */ exec function Suicide() { Pawn.KilledBy( None ); } exec function Name( coerce string S ) { ChangeName(S); UpdateURL("Name", S, true); SaveConfig(); } function ChangeName( coerce string S ) { if ( Len(S) > 28 ) S = left(S,28); ReplaceText(S, " ", "_"); Level.Game.ChangeName( self, S, false ); } exec function SwitchTeam() { if ( (PlayerReplicationInfo.Team == None) || (PlayerReplicationInfo.Team.TeamIndex == 1) ) ChangeTeam(0); else ChangeTeam(1); } function ChangeTeam( int N ) { local TeamInfo OldTeam; OldTeam = PlayerReplicationInfo.Team; Level.Game.ChangeTeam(self, N); if ( Level.Game.bTeamGame && (PlayerReplicationInfo.Team != OldTeam) ) Pawn.Died( None, class'DamageType', Pawn.Location, vect(0,0,0) ); } exec function SwitchLevel( string URL ) { if( Level.NetMode==NM_Standalone || Level.netMode==NM_ListenServer ) Level.ServerTravel( URL, false ); } exec function ClearProgressMessages() { local int i; for (i=0; i<ArrayCount(ProgressMessage); i++) { ProgressMessage[i] = ""; ProgressColor[i] = class'Canvas'.Static.MakeColor(255,255,255); } } exec event SetProgressMessage( int Index, string S, color C ) { if ( Index < ArrayCount(ProgressMessage) ) { ProgressMessage[Index] = S; ProgressColor[Index] = C; } } exec event SetProgressTime( float T ) { ProgressTimeOut = T + Level.TimeSeconds; } function Restart() { ServerTimeStamp = 0; TimeMargin = 0; //NEW (mdf) #debug SetControllerEnemy( None, GetContext() ); #release SetControllerEnemy( None ); /*OLD Enemy = None; */ EnterStartState(); SetViewTarget(Pawn); bBehindView = Pawn.PointOfView(); //NEW MJL Pawn.ClientRestart(); /*OLD ClientRestart(); */ } function EnterStartState() { local name NewState; //NEW (mdf) if( bMatineePossess && Pawn.Physics == PHYS_Flying ) NewState = PlayerFlyingState; else //OLD if ( Pawn.PhysicsVolume.bWaterVolume ) { if ( Pawn.HeadVolume.bWaterVolume ) Pawn.BreathTime = Pawn.UnderWaterTime; NewState = Pawn.WaterMovementState; } else NewState = Pawn.LandMovementState; if ( IsInState(NewState) ) BeginState(); else GotoState(NewState); } //NEW MJL /*OLD function ClientRestart() { if ( Pawn == None ) { GotoState('WaitingForPawn'); return; } Pawn.ClientRestart(); SetViewTarget(Pawn); bBehindView = Pawn.PointOfView(); EnterStartState(); } */ exec function BehindView( Bool B ) { bBehindView = B; ClientSetBehindView(bBehindView); } function UpdateBob(float F) { Bob = FClamp(F,0,0.032); } //============================================================================= // functions. // Just changed to pendingWeapon function ChangedWeapon() { if ( Pawn.PendingWeapon != None ) Pawn.PendingWeapon.SetHand(Handedness); } event TravelPostAccept() { if ( Pawn.Health <= 0 ) Pawn.Health = Pawn.Default.Health; } event PlayerTick( float DeltaTime ) { PlayerInput.PlayerInput(DeltaTime); if ( bUpdatePosition ) ClientUpdatePosition(); //NEW (mdf) -- mantling support // bForwardPressed = (aForward > 0.0); bUpPressed = (aUp > 0.0); //OLD PlayerMove(DeltaTime); } function PlayerMove(float DeltaTime); //NEW (mdf) 777 version (reverted SteveP's changes) // /* AdjustAim() Used for warning potential targets (if any) player aiming help (mainly if AimingHelp != 0, but always some help!) */ function bool AdjustAim( class<Projectile> ProjectileClass, float ProjSpeed, vector ProjStart, float WeaponFireSpread, bool bLeadTarget, bool bWarnTarget, bool bTossed, bool bTrySplash ) { local vector FireDir, AimSpot, HitNormal, HitLocation, OldAim, AimOffset; local Actor BestTarget; local float BestAim, BestDist; local Actor HitActor; local bool bNoZAdjust, bLeading; local bool bFastHit; // set if instant hit or high speed projectile local vector CameraLoc; /* #debugbegin if( DebugAIAttacks() ) { DMTNS( "AdjustAim (player)" ); DMTNS( " Target: " $ Target ); DMTNS( " ProjClass: " $ ProjectileClass ); DMTNS( " ProjSpeed: " $ ProjSpeed ); DMTNS( " ProjStart: " $ class'Util'.static.GetVectorString(ProjStart) ); DMTNS( " WeaponFireSpread: " $ WeaponFireSpread ); DMTNS( " bLeadTarget: " $ bLeadTarget ); DMTNS( " bWarnTarget: " $ bWarnTarget ); DMTNS( " bTossed: " $ bTossed ); DMTNS( " bTrySplash: " $ bTrySplash ); AddActor( Pawn, ColorCyan() ); AddCylinder( ProjStart, 16, 16, ColorMagenta() ); if( Target != None ) { AddCylinder( Target.Location, 16, 16, ColorYellow() ); AddArrow( ProjStart, Target.Location, ColorGreen() ); } } #debugend */ FireDir = vector(Rotation); bFastHit = ( ProjSpeed <= 0 || ProjSpeed > 10000 ); // ==> warn target? if( bFastHit ) HitActor = Trace( HitLocation, HitNormal, ProjStart + 10000 * FireDir, ProjStart, true ); else HitActor = Trace( HitLocation, HitNormal, ProjStart + 4000 * FireDir, ProjStart, true ); if( HitActor != None && HitActor.bProjTarget ) { if( bWarnTarget && Pawn(HitActor) != None && Pawn(HitActor).Controller != None ) Pawn(HitActor).Controller.ShotFiredNotification( Pawn, FireDir, ProjectileClass, ProjSpeed ); BestTarget = HitActor; bNoZAdjust = true; OldAim = HitLocation; BestDist = VSize( BestTarget.Location - Pawn.Location ); } else { // adjust aim based on FOV BestAim = 0.95; if( AimingHelp == 1 ) { BestAim = 0.93; if( bFastHit ) BestAim = 0.97; if( FOVAngle < DefaultFOV - 8 ) BestAim = 0.99; } else { if( bFastHit ) BestAim = 0.98; if( FOVAngle != DefaultFOV ) BestAim = 0.995; } BestTarget = PickTarget( BestAim, BestDist, FireDir, ProjStart ); if( BestTarget != None ) { if( bWarnTarget && Pawn(BestTarget) != None && Pawn(BestTarget).Controller != None ) Pawn(BestTarget).Controller.ShotFiredNotification( Pawn, FireDir, ProjectileClass, ProjSpeed ); OldAim = ProjStart + FireDir * BestDist; } } if( BestTarget == None || AimingHelp == 0 ) { //NEW (mdf) /* #debugbegin HitActor = Trace( HitLocation, HitNormal, ProjStart + 8192.0*vector(Rotation), ProjStart, true ); if( Pawn(HitActor) != None ) AddArrow( ProjStart, HitLocation, ColorGreen() ); else AddArrow( ProjStart, HitLocation, ColorRed() ); #debugend */ //OLD //NEW (arl) CameraLoc = Pawn.Location; CameraLoc.Z += Pawn.BaseEyeHeight; HitActor = Trace( HitLocation, HitNormal, CameraLoc + 10000 * FireDir, CameraLoc, false ); if (!HitActor) AimRotation = Rotation; else AimRotation = rotator(HitLocation-ProjStart); return true; /*OLD return Rotation; */ } // ==> extra aiming help - help with leading also if( !bFastHit ) { BestDist = VSize( BestTarget.Location + BestTarget.Velocity * FMin(2, 0.02 + BestDist/ProjSpeed) - ProjStart ); bLeading = true; FireDir = BestTarget.Location + BestTarget.Velocity * FMin(2, 0.02 + BestDist/ProjSpeed) - ProjStart; AimSpot = ProjStart + BestDist * Normal(FireDir); // if splash damage weapon, try aiming at feet - trace down to find floor if( bTrySplash && (BestTarget.Velocity != vect(0,0,0) || BestDist > 1500) ) { HitActor = Trace( HitLocation, HitNormal, AimSpot - BestTarget.CollisionHeight * vect(0,0,2), AimSpot, false ); if( HitActor != None && FastTrace(HitLocation + vect(0,0,4),ProjStart) ) { AimRotation = rotator(HitLocation + vect(0,0,6) - ProjStart); return true; } } } else { FireDir = BestTarget.Location - ProjStart; AimSpot = ProjStart + BestDist * Normal(FireDir); } AimOffset = AimSpot - OldAim; // adjust Z of shooter if necessary if ( bNoZAdjust || (bLeading && Abs(AimOffset.Z) < BestTarget.CollisionHeight) ) AimSpot.Z = OldAim.Z; else if ( AimOffset.Z < 0 ) AimSpot.Z = BestTarget.Location.Z + 0.4 * BestTarget.CollisionHeight; else AimSpot.Z = BestTarget.Location.Z - 0.7 * BestTarget.CollisionHeight; if ( !bLeading ) { // if not leading, add slight random error ( significant at long distances ) if ( !bNoZAdjust ) { AimRotation = rotator(AimSpot - ProjStart); if ( FOVAngle < DefaultFOV - 8 ) AimRotation.Yaw = AimRotation.Yaw + 200 - Rand(400); else AimRotation.Yaw = AimRotation.Yaw + 375 - Rand(750); return true; } } else if ( !FastTrace(ProjStart + 0.9 * BestDist * Normal(FireDir), ProjStart) ) { FireDir = BestTarget.Location - ProjStart; AimSpot = ProjStart + BestDist * Normal(FireDir); } AimRotation = rotator(AimSpot - ProjStart); return true; } //OLD: 829 version with SteveP's changes. // /* AdjustAim() Calls this version for player aiming help. Aimerror not used in this version. Only adjusts aiming at pawns */ /* function rotator AdjustAim(Ammunition FiredAmmunition, vector ProjStart, int aimerror) { local vector FireDir, AimSpot, HitNormal, HitLocation, OldAim, AimOffset; local actor BestTarget; local float BestAim, BestDist, ProjSpeed; local actor HitActor; local bool bNoZAdjust, bLeading; local rotator AimRot; FireDir = vector(Rotation); if ( FiredAmmunition.bInstantHit ) HitActor = Trace(HitLocation, HitNormal, ProjStart + 10000 * FireDir, ProjStart, true); else HitActor = Trace(HitLocation, HitNormal, ProjStart + 4000 * FireDir, ProjStart, true); if ( (HitActor != None) && HitActor.bProjTarget ) { FiredAmmunition.WarnTarget(Target,Pawn,FireDir); BestTarget = HitActor; bNoZAdjust = true; OldAim = HitLocation; BestDist = VSize(BestTarget.Location - Pawn.Location); } else { // adjust aim based on FOV BestAim = 0.95; if ( AimingHelp == 1 ) { BestAim = 0.93; if ( FiredAmmunition.bInstantHit ) BestAim = 0.97; if ( FOVAngle < DefaultFOV - 8 ) BestAim = 0.99; } else { if ( FiredAmmunition.bInstantHit ) BestAim = 0.98; if ( FOVAngle != DefaultFOV ) BestAim = 0.995; } BestTarget = PickTarget(BestAim, BestDist, FireDir, ProjStart); if ( BestTarget == None ) return Rotation; FiredAmmunition.WarnTarget(Target,Pawn,FireDir); OldAim = ProjStart + FireDir * BestDist; } if ( AimingHelp == 0 ) return Rotation; // aim at target - help with leading also if ( !FiredAmmunition.bInstantHit ) { ProjSpeed = FiredAmmunition.ProjectileClass.default.speed; BestDist = vsize(BestTarget.Location + BestTarget.Velocity * FMin(2, 0.02 + BestDist/ProjSpeed) - ProjStart); bLeading = true; FireDir = BestTarget.Location + BestTarget.Velocity * FMin(2, 0.02 + BestDist/ProjSpeed) - ProjStart; AimSpot = ProjStart + BestDist * Normal(FireDir); // if splash damage weapon, try aiming at feet - trace down to find floor if ( FiredAmmunition.bTrySplash && ((BestTarget.Velocity != vect(0,0,0)) || (BestDist > 1500)) ) { HitActor = Trace(HitLocation, HitNormal, AimSpot - BestTarget.CollisionHeight * vect(0,0,2), AimSpot, false); if ( (HitActor != None) && FastTrace(HitLocation + vect(0,0,4),ProjStart) ) return rotator(HitLocation + vect(0,0,6) - ProjStart); } } else { FireDir = BestTarget.Location - ProjStart; AimSpot = ProjStart + BestDist * Normal(FireDir); } AimOffset = AimSpot - OldAim; // adjust Z of shooter if necessary if ( bNoZAdjust || (bLeading && (Abs(AimOffset.Z) < BestTarget.CollisionHeight)) ) AimSpot.Z = OldAim.Z; else if ( AimOffset.Z < 0 ) AimSpot.Z = BestTarget.Location.Z + 0.4 * BestTarget.CollisionHeight; else AimSpot.Z = BestTarget.Location.Z - 0.7 * BestTarget.CollisionHeight; if ( !bLeading ) { // if not leading, add slight random error ( significant at long distances ) if ( !bNoZAdjust ) { AimRot = rotator(AimSpot - ProjStart); if ( FOVAngle < DefaultFOV - 8 ) AimRot.Yaw = AimRot.Yaw + 200 - Rand(400); else AimRot.Yaw = AimRot.Yaw + 375 - Rand(750); return AimRot; } } else if ( !FastTrace(ProjStart + 0.9 * BestDist * Normal(FireDir), ProjStart) ) { FireDir = BestTarget.Location - ProjStart; AimSpot = ProjStart + BestDist * Normal(FireDir); } return rotator(AimSpot - ProjStart); } */ event bool NotifyLanded(vector HitNormal) { if ( bUpdating ) return true; LandBob = FMin(50, 0.055 * Pawn.Velocity.Z); return false; } //NEW (mdf) function NotifyStanceChange( byte NewStance, float HeightAdjust ) { bPressedJump = false; } //OLD //NEW /*OLD (mdf) -- U2 doesn't use this currently function eAttitude AttitudeTo(Pawn Other) { if ( Other.Controller == None ) return ATTITUDE_Ignore; if ( Other.IsPlayerPawn() ) return AttitudeToPlayer; return Other.Controller.AttitudeToPlayer; } */ //============================================================================= // Player Control // Player view. // Compute the rendering viewpoint for the player. // function AdjustView(float DeltaTime ) { // teleporters affect your FOV, so adjust it back down if ( FOVAngle != DesiredFOV ) { //NEW if ( FOVAngle > DesiredFOV ) { FOVAngle = FOVAngle - FMax(7, 0.9 * DeltaTime * (FOVAngle - DesiredFOV)); if ( Abs(FOVAngle - DesiredFOV) <= 10 ) FOVAngle = DesiredFOV; } else FOVAngle = DesiredFOV; /*OLD 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; */ } //NEW: Removed (MWP) /* // adjust FOV for weapon zooming if ( bZooming ) { ZoomLevel += DeltaTime * 1.0; if (ZoomLevel > 0.9) ZoomLevel = 0.9; DesiredFOV = FClamp(90.0 - (ZoomLevel * 88.0), 1, 170); } */ } function CalcBehindView(out vector CameraLocation, out rotator CameraRotation, float Dist) { local vector View,HitLocation,HitNormal; local float ViewDist; CameraRotation = Rotation; View = vect(1,0,0) >> CameraRotation; if( Trace( HitLocation, HitNormal, CameraLocation - (Dist + 30) * vector(CameraRotation), CameraLocation ) != None ) ViewDist = FMin( (CameraLocation - HitLocation) Dot View, Dist ); else ViewDist = Dist; CameraLocation -= (ViewDist - 30) * View; } function CalcFirstPersonView( out vector CameraLocation, out rotator CameraRotation ) { // First-person view. CameraRotation = Rotation; CameraLocation = CameraLocation + Pawn.EyePosition() + WalkBob + ShakeOffset; } event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation ) { local Pawn PTarget; if ( (ViewTarget == None) || ViewTarget.bDeleteMe ) { if ( (Pawn != None) && !Pawn.bDeleteMe ) SetViewTarget(Pawn); else SetViewTarget(self); } ViewActor = ViewTarget; CameraLocation = ViewTarget.Location; if ( ViewTarget == Pawn ) { if( bBehindView ) //up and behind CalcBehindView(CameraLocation, CameraRotation, CameraDist * Pawn.Default.CollisionRadius); else CalcFirstPersonView( CameraLocation, CameraRotation ); return; } if ( ViewTarget == self ) { CameraRotation = Rotation; return; } CameraRotation = ViewTarget.Rotation; PTarget = Pawn(ViewTarget); if ( PTarget != None ) { if ( Level.NetMode == NM_Client ) { if ( PTarget.IsPlayerPawn() ) { PTarget.SetViewRotation(TargetViewRotation); CameraRotation = TargetViewRotation; } PTarget.EyeHeight = TargetEyeHeight; if ( PTarget.Weapon != None ) PTarget.Weapon.PlayerViewOffset = TargetWeaponViewOffset; } else if ( PTarget.IsPlayerPawn() ) CameraRotation = PTarget.GetViewRotation(); if ( !bBehindView ) //NEW (mdf) hack fix move camera location away from center along Pawn's rotation to fix viewclass showing inside of golem meshes CameraLocation += PTarget.EyePosition() + 0.25 * PTarget.CollisionRadius * vector( PTarget.Rotation ); /*OLD CameraLocation += PTarget.EyePosition(); */ } if ( bBehindView ) { CameraLocation = CameraLocation + (ViewTarget.Default.CollisionHeight - ViewTarget.CollisionHeight) * vect(0,0,1); CalcBehindView(CameraLocation, CameraRotation, CameraDist * ViewTarget.Default.CollisionRadius); } } //NEW exec function TestShake(float Magnitude,optional float Duration){ ShakeView(Magnitude,Duration); } // Replication note: only call when Level.NetMode != NM_DedicatedServer, or from a non-simulated function (otherwise you'll get duplicate calls). simulated function ShakeView(float Magnitude,optional float Duration){ ClientShake(Magnitude,Duration); } simulated private function ClientShake(float Magnitude,optional float Duration) { if(Duration==0) Duration=0.5; ShakeMagX = Magnitude; ShakeMagY = Magnitude; if( FRand()>0.5 ) ShakeMagX = -ShakeMagX; if( FRand()>0.5 ) ShakeMagY = -ShakeMagY; ShakeTime = Duration; ShakeDuration = Duration; } function ViewShake(float DeltaTime) { local float Pct; ShakeOffset=vect(0,0,0); ShakeTime -= DeltaTime; if( ShakeTime<=0 ) return; Pct = ShakeTime / ShakeDuration; ShakeOffset.Y = Pct * ShakeMagX * sin( ShakeTime * ShakePeriodX * PI ); ShakeOffset.Z = Pct * ShakeMagY * sin( ShakeTime * ShakePeriodY * PI ); ShakeOffset.Y = FClamp( ShakeOffset.Y, -32.0, 32.0 ); ShakeOffset.Z = FClamp( ShakeOffset.Z, -32.0, 32.0 ); ShakeOffset = ShakeOffset >> Rotation; /* ShakeOffset.X = Pct * ShakeMagX * sin( ShakeTime * ShakePeriodX * PI ); ShakeOffset.Y = Pct * ShakeMagY * sin( ShakeTime * ShakePeriodY * PI ); ShakeOffset.Z = Pct * ShakeMagZ * sin( ShakeTime * ShakePeriodZ * PI ); */ } /*OLD function CheckShake(out float MaxOffset, out float Offset, out float Rate, out float Time) { if ( abs(Offset) < abs(MaxOffset) ) return; Offset = MaxOffset; if ( Time > 1 ) { if ( Time * abs(MaxOffset/Rate) <= 1 ) MaxOffset = MaxOffset * (1/Time - 1); else MaxOffset *= -1; Time -= 1; Rate *= -1; } else { MaxOffset = 0; Offset = 0; Rate = 0; } } function ViewShake(float DeltaTime) { local Rotator ViewRotation; local float FRoll; if ( ShakeOffsetRate != vect(0,0,0) ) { // modify shake offset ShakeOffset.X += DeltaTime * ShakeOffsetRate.X; CheckShake(MaxShakeOffset.X, ShakeOffset.X, ShakeOffsetRate.X, ShakeOffsetTime.X); ShakeOffset.Y += DeltaTime * ShakeOffsetRate.Y; CheckShake(MaxShakeOffset.Y, ShakeOffset.Y, ShakeOffsetRate.Y, ShakeOffsetTime.Y); ShakeOffset.Z += DeltaTime * ShakeOffsetRate.Z; CheckShake(MaxShakeOffset.Z, ShakeOffset.Z, ShakeOffsetRate.Z, ShakeOffsetTime.Z); } ViewRotation = Rotation; if ( ShakeRollRate != 0 ) { ViewRotation.Roll = ((ViewRotation.Roll & 65535) + ShakeRollRate * DeltaTime) & 65535; if ( ViewRotation.Roll > 32768 ) ViewRotation.Roll -= 65536; FRoll = ViewRotation.Roll; CheckShake(MaxShakeRoll, FRoll, ShakeRollRate, ShakeRollTime); ViewRotation.Roll = FRoll; } else if ( bZeroRoll ) ViewRotation.Roll = 0; SetRotation(ViewRotation); } */ function bool TurnTowardNearestEnemy(); function TurnAround() { if ( !bSetTurnRot ) { TurnRot180 = Rotation; TurnRot180.Yaw += 32768; bSetTurnRot = true; } DesiredRotation = TurnRot180; bRotateToDesired = ( DesiredRotation.Yaw != Rotation.Yaw ); } function UpdateRotation(float DeltaTime, float maxPitch) { local rotator newRotation, ViewRotation; if ( bInterpolating || ((Pawn != None) && Pawn.bInterpolating) ) { ViewShake(deltaTime); return; } ViewRotation = Rotation; DesiredRotation = ViewRotation; //save old rotation if ( bTurnToNearest != 0 ) TurnTowardNearestEnemy(); else if ( bTurn180 != 0 ) TurnAround(); else { TurnTarget = None; bRotateToDesired = false; bSetTurnRot = false; ViewRotation.Yaw += 32.0 * DeltaTime * aTurn; ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp; } ViewRotation.Pitch = ViewRotation.Pitch & 65535; If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152)) { If (aLookUp > 0) ViewRotation.Pitch = 18000; else ViewRotation.Pitch = 49152; } SetRotation(ViewRotation); ViewShake(deltaTime); ViewFlash(deltaTime); NewRotation = ViewRotation; NewRotation.Roll = Rotation.Roll; if ( !bRotateToDesired && (Pawn != None) && (!bFreeCamera || !bBehindView) ) Pawn.FaceRotation(NewRotation, deltatime); } // Player movement. // Player Standing, walking, running, falling. //NEW state @ PlayerWalkingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, Bump; /*OLD { state PlayerWalking //ignores SeePlayer, HearNoise, Bump; */ event bool NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( NewVolume.bWaterVolume ) GotoState(Pawn.WaterMovementState); return false; } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { //NEW (mdf) not used /*OLD local vector OldAccel; local bool OldCrouch; */ //NEW (mdf) not used /*OLD OldAccel = Pawn.Acceleration; */ Pawn.Acceleration = NewAccel; //NEW if ( bPressedJump && Level.Pauser == None ) /*OLD if ( bPressedJump ) */ Pawn.DoJump(bUpdating); if ( Pawn.Physics != PHYS_Falling ) { //NEW (mdf) if( GetDuckFlag() == 0 ) Pawn.SetStance( ST_Standing ); else if ( Pawn.bCanCrouch ) Pawn.SetStance( ST_Crouching ); /*OLD OldCrouch = Pawn.bWantsToCrouch; if (bDuck == 0) Pawn.ShouldCrouch(false); else if ( Pawn.bCanCrouch ) Pawn.ShouldCrouch(true); */ } } //NEW MJL: accel function vector GetAccel( vector X, vector Y, vector Z ) { local vector ReturnedAcceleration; ReturnedAcceleration = aForward*X + aStrafe*Y; ReturnedAcceleration.Z = 0; return ReturnedAcceleration; } function SetMovementVars( vector Accel ) { local vector LocalAccel; LocalAccel = Accel << (rot(0,1,0)*Pawn.Rotation.Yaw); //!!MJL (mdf) bForwardPressed = (LocalAccel.X > 0); bUpPressed = (bJump != 0); } //OLD function PlayerMove( float DeltaTime ) { local vector X,Y,Z, NewAccel; local eDoubleClickDir DoubleClickMove; local rotator OldRotation, ViewRotation; local float Speed2D; local bool bSaveJump; GetAxes( Pawn.Rotation, X, Y, Z ); // Update acceleration. //NEW MJL: accel NewAccel = GetAccel( X, Y, Z ); SetMovementVars( NewAccel ); /*OLD NewAccel = aForward*X + aStrafe*Y; NewAccel.Z = 0; */ if ( VSize(NewAccel) < 1.0 ) NewAccel = vect(0,0,0); DoubleClickMove = PlayerInput.CheckForDoubleClickMove(DeltaTime); GroundPitch = 0; ViewRotation = Rotation; if ( Pawn.Physics == PHYS_Walking ) { // tell pawn about any direction changes to give it a chance to play appropriate animation //if walking, look up/down stairs - unless player is rotating view GroundPitch = FindStairRotation(deltaTime); if ( (bLook == 0) && (((Pawn.Acceleration != Vect(0,0,0)) && bAlwaysLevel && bSnapToLevel) || !bKeyboardLook) ) { if ( bLookUpStairs || bSnapToLevel ) { ViewRotation.Pitch = GroundPitch; } else if ( bCenterView ) { ViewRotation.Pitch = ViewRotation.Pitch & 65535; if (ViewRotation.Pitch > 32768) ViewRotation.Pitch -= 65536; ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime)); if ( Abs(ViewRotation.Pitch) < 1000 ) ViewRotation.Pitch = 0; } } Speed2D = Sqrt(Pawn.Velocity.X * Pawn.Velocity.X + Pawn.Velocity.Y * Pawn.Velocity.Y); //add bobbing when walking CheckBob(DeltaTime, Speed2D, Y); } else { if ( !bKeyboardLook && (bLook == 0) && bCenterView ) { ViewRotation.Pitch = ViewRotation.Pitch & 65535; if (ViewRotation.Pitch > 32768) ViewRotation.Pitch -= 65536; ViewRotation.Pitch = ViewRotation.Pitch * (1 - 12 * FMin(0.0833, deltaTime)); if ( Abs(ViewRotation.Pitch) < 1000 ) ViewRotation.Pitch = 0; } BobTime = 0; WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime)); } // Update rotation. SetRotation(ViewRotation); OldRotation = Rotation; UpdateRotation(DeltaTime, 1); if ( bPressedJump && Pawn.JumpInProgress() ) { bSaveJump = true; bPressedJump = false; } else bSaveJump = false; //NEW MJL HandleMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation); /* 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() { if ( Pawn.Mesh == None ) Pawn.SetMesh(); WalkBob = vect(0,0,0); DoubleClickDir = DCLICK_None; //NEW (mdf) // Pawn.SetStance( ST_Standing ); /*OLD Pawn.ShouldCrouch(false); */ bPressedJump = false; if (Pawn.Physics != PHYS_Falling) Pawn.SetPhysics(PHYS_Walking); GroundPitch = 0; } event EndState() { GroundPitch = 0; WalkBob = vect(0,0,0); //NEW (mdf) // if ( Pawn != None ) // Pawn.SetStance( ST_Standing ); /*OLD if ( Pawn != None ) Pawn.ShouldCrouch(false); */ } } // PlayerWalkingState // player is climbing ladder //NEW (mdf) function bool CanJumpOffLadder() { return ( bPressedJump && (aForward != 0 || aStrafe != 0) && Level != None && Level.Pauser == None ); } state @ PlayerClimbingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, Bump; event bool NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( NewVolume.bWaterVolume ) GotoState(Pawn.WaterMovementState); else GotoState(Pawn.LandMovementState); return false; } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { Pawn.Acceleration = NewAccel; //NEW (mdf) handle jumping in playermove for ladders /*OLD if ( bPressedJump && Level.Pauser == None ) { assert( false ); Pawn.DoJump(bUpdating); if ( Pawn.Physics == PHYS_Falling ) GotoState( PlayerWalkingState ); } */ } function PlayerMove( float DeltaTime ) { local vector X,Y,Z, NewAccel; local eDoubleClickDir DoubleClickMove; local rotator OldRotation, ViewRotation; local float Speed2D; local bool bSaveJump; local float aForwardLocal, aStrafeLocal; //NEW (mdf) // Update acceleration. if ( Pawn.OnLadder != None ) { //DMTNS( "on Ladder" ); /* +allow strafing on ladders +crouch key moves player down ladder +jump moves player up ladder +jump + any movement key = jump */ if( CanJumpOffLadder() ) { //DMTNS( "CanJumpOffLadder!" ); Pawn.DoJump( bUpdating ); if( Pawn.Physics == PHYS_Falling ) GotoState( PlayerWalkingState ); } else { if( aUp > 0.0 ) { //DMTNS( "using aUp > 0" ); aForwardLocal = 24000; // mdf-tbd: 24000 is about what aForward peaks at for me -- how to get this value? } else if( aUp < 0.0 ) { //DMTNS( "using aUp < 0" ); aForwardLocal = -24000; } else { aForwardLocal = aForward; // if looking down ladder, reverse aForward if( (vector( Rotation ) dot Pawn.OnLadder.ClimbDir) >= 0 ) { //DMTNS( "keeping aForwardLocal" ); aForwardLocal = aForward; } else { //DMTNS( "reversing aForwardLocal" ); aForwardLocal = -aForward; } } // if looking away from ladder, reverse strafe if( (vector( Rotation ) dot Pawn.OnLadder.LookDir) >= 0 ) aStrafeLocal = aStrafe; else aStrafeLocal = -aStrafe; // fix cross product wasn't normalized? //NewAccel = aForwardLocal*Pawn.OnLadder.ClimbDir + aStrafeLocal*(Pawn.OnLadder.ClimbDir cross Pawn.OnLadder.LookDir); NewAccel = aForwardLocal*Pawn.OnLadder.ClimbDir + aStrafeLocal*Normal( Pawn.OnLadder.ClimbDir cross Pawn.OnLadder.LookDir ); } } else { //DMTNS( "not on Ladder" ); GetAxes( Rotation, X, Y, Z ); //NewAccel = aForward*X + aStrafe*Y; //NewAccel = aForward*Pawn.OnLadder.ClimbDir + aStrafeLocal*Normal( Pawn.OnLadder.ClimbDir cross Pawn.OnLadder.LookDir ); NewAccel = aForward*X + aStrafe*Y; //NewAccel.Z = 0; } //DMTNS( "NewAccel: " $ NewAccel ); if ( VSize(NewAccel) < 1.0 ) NewAccel = vect(0,0,0); ViewRotation = Rotation; // Update rotation. SetRotation(ViewRotation); OldRotation = Rotation; UpdateRotation(DeltaTime, 1); HandleMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation); bPressedJump = bSaveJump; } event BeginState() { //NEW (mdf) Pawn.SetStance( ST_Standing ); /*OLD Pawn.ShouldCrouch( false ); */ SetDuckFlag( 0 ); bPressedJump = false; } event EndState() { if( Pawn != None ) //NEW (mdf) Pawn.SetStance( ST_Standing ); /*OLD Pawn.ShouldCrouch( false ); */ Acceleration = vect(0,0,0); } } // PlayerClimbingState /*OLD state PlayerClimbing { //ignores SeePlayer, HearNoise, Bump; event bool NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( NewVolume.bWaterVolume ) GotoState(Pawn.WaterMovementState); else GotoState(Pawn.LandMovementState); return false; } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { local vector OldAccel; OldAccel = Pawn.Acceleration; Pawn.Acceleration = NewAccel; if ( bPressedJump ) { Pawn.DoJump(bUpdating); if ( Pawn.Physics == PHYS_Falling ) GotoState('PlayerWalking'); } } function PlayerMove( float DeltaTime ) { local vector X,Y,Z, NewAccel; local eDoubleClickDir DoubleClickMove; local rotator OldRotation, ViewRotation; local float Speed2D; local bool bSaveJump; local float aForwardLocal, aStrafeLocal; //NEW (mdf) GetAxes(Rotation,X,Y,Z); // Update acceleration. if ( Pawn.OnLadder != None ) NewAccel = aForward*Pawn.OnLadder.ClimbDir; else NewAccel = aForward*X + aStrafe*Y; if ( VSize(NewAccel) < 1.0 ) NewAccel = vect(0,0,0); ViewRotation = Rotation; // Update rotation. SetRotation(ViewRotation); OldRotation = Rotation; UpdateRotation(DeltaTime, 1); 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() { Pawn.ShouldCrouch(false); bPressedJump = false; } event EndState() { if ( Pawn != None ) Pawn.ShouldCrouch(false); aForwardLocal = 24000; // mdf-tbd: 24000 is about what aForward peaks at for me -- how to get this value? } } */ // Player movement. // Player Driving a Karma vehicle. state PlayerDriving { //NEW ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, Bump, Fire, AltFire, PressingFire, PressingAltFire; /*OLD { //ignores SeePlayer, HearNoise, Bump; */ event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation ) { local vector View, CamLookAt, HitLocation, HitNormal; local plane CamView; local KVehicle DrivenVehicle; if ( KVehicle(ViewTarget) == None ) { if ( (Pawn.ControlledActor != None) && !Pawn.bDeleteMe ) SetViewTarget(Pawn.ControlledActor); } ViewActor = ViewTarget; CameraLocation = ViewTarget.Location; if ( ViewTarget == Pawn.ControlledActor ) { if( !bBehindView ) // not drawing car { CalcBehindView(CameraLocation, CameraRotation, CameraDist * ViewTarget.Default.CollisionRadius); } else // drawing car (use vehicles camera position info) { DrivenVehicle = KVehicle(Pawn.ControlledActor); CamView = DrivenVehicle.CamPos[DrivenVehicle.CamPosIndex]; // Only follow vehicle rotation in 'in car' view. if(DrivenVehicle.CamPosIndex == 0) CameraRotation = Rotation+ViewTarget.Rotation; else CameraRotation = Rotation; View = CamView >> ViewTarget.Rotation; CameraLocation += View; CamLookAt = CameraLocation; View = (vect(1, 0, 0) * CamView.W) >> CameraRotation; CameraLocation -= View; if( Trace( HitLocation, HitNormal, CameraLocation, CamLookAt, false ) != None ) { CameraLocation = HitLocation; } } return; } if ( ViewTarget == self ) { CameraRotation = Rotation; return; } CameraRotation = ViewTarget.Rotation; if ( bBehindView ) { CameraLocation = CameraLocation + (ViewTarget.Default.CollisionHeight - ViewTarget.CollisionHeight) * vect(0,0,1); CalcBehindView(CameraLocation, CameraRotation, CameraDist * ViewTarget.Default.CollisionRadius); } } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { } //NEW see above ignores /*OLD exec function Fire() { } exec function AltFire() { } */ function PlayerMove( float DeltaTime ) { local KVehicle DrivenVehicle; DrivenVehicle = KVehicle(Pawn.ControlledActor); if(DrivenVehicle == None) { log("PlayerDriving.PlayerMove: No Vehicle"); return; } // check for 'jump' to throw the driver out. if(bPressedJump) { GotoState('PlayerWalking'); Pawn.SetPhysics(PHYS_Falling); return; } //log("Drive:"$aForward$" Steer:"$aStrafe); if(aForward > 1) { DrivenVehicle.Throttle = 1; } else if(aForward < -1) { DrivenVehicle.Throttle = -1; } else { DrivenVehicle.Throttle = 0; } if(aStrafe < -1) DrivenVehicle.Steering = 1; else if(aStrafe > 1) DrivenVehicle.Steering = -1; else DrivenVehicle.Steering = 0; // update 'looking' rotation - no affect on driving UpdateRotation(DeltaTime, 2); } event BeginState() { bBehindView = true; } event EndState() { local KVehicle DrivenVehicle; DrivenVehicle = KVehicle(Pawn.ControlledActor); SetViewTarget(Pawn); DrivenVehicle.KDriverLeave(Pawn); // execute 'Leave' event bBehindView = false; } } // Player movement. // Player walking on walls //NEW state @ PlayerSpideringState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, Bump; /*OLD state PlayerSpidering { //ignores SeePlayer, HearNoise, Bump; */ event bool NotifyHitWall(vector HitNormal, actor HitActor) { // FIXME - pawn should have bool identifying if this was a voluntary jump Pawn.SetPhysics(PHYS_Spider); Pawn.SetBase(HitActor, HitNormal); return true; } // if spider mode, update rotation based on floor function UpdateRotation(float DeltaTime, float maxPitch) { local rotator TempRot, ViewRotation; local vector MyFloor, CrossDir, FwdDir, OldFwdDir, OldX, RealFloor; if ( bInterpolating || Pawn.bInterpolating ) { ViewShake(deltaTime); return; } TurnTarget = None; bRotateToDesired = false; bSetTurnRot = false; if ( (Pawn.Base == None) || (Pawn.Floor == vect(0,0,0)) ) MyFloor = vect(0,0,1); else MyFloor = Pawn.Floor; if ( MyFloor != OldFloor ) { // smoothly change floor RealFloor = MyFloor; MyFloor = Normal(6*DeltaTime * MyFloor + (1 - 6*DeltaTime) * OldFloor); if ( (RealFloor Dot MyFloor) > 0.999 ) MyFloor = RealFloor; // translate view direction CrossDir = Normal(RealFloor Cross OldFloor); FwdDir = CrossDir Cross MyFloor; OldFwdDir = CrossDir Cross OldFloor; ViewX = MyFloor * (OldFloor Dot ViewX) + CrossDir * (CrossDir Dot ViewX) + FwdDir * (OldFwdDir Dot ViewX); ViewX = Normal(ViewX); ViewZ = MyFloor * (OldFloor Dot ViewZ) + CrossDir * (CrossDir Dot ViewZ) + FwdDir * (OldFwdDir Dot ViewZ); ViewZ = Normal(ViewZ); OldFloor = MyFloor; ViewY = Normal(MyFloor Cross ViewX); } if ( (aTurn != 0) || (aLookUp != 0) ) { // adjust Yaw based on aTurn if ( aTurn != 0 ) ViewX = Normal(ViewX + 2 * ViewY * Sin(0.0005*DeltaTime*aTurn)); // adjust Pitch based on aLookUp if ( aLookUp != 0 ) { OldX = ViewX; ViewX = Normal(ViewX + 2 * ViewZ * Sin(0.0005*DeltaTime*aLookUp)); ViewZ = Normal(ViewX Cross ViewY); // bound max pitch if ( (ViewZ Dot MyFloor) < 0.707 ) { OldX = Normal(OldX - MyFloor * (MyFloor Dot OldX)); if ( (ViewX Dot MyFloor) > 0) ViewX = Normal(OldX + MyFloor); else ViewX = Normal(OldX - MyFloor); ViewZ = Normal(ViewX Cross ViewY); } } // calculate new Y axis ViewY = Normal(MyFloor Cross ViewX); } ViewRotation = OrthoRotation(ViewX,ViewY,ViewZ); SetRotation(ViewRotation); ViewShake(deltaTime); ViewFlash(deltaTime); Pawn.FaceRotation(ViewRotation, deltaTime ); } event bool NotifyLanded(vector HitNormal) { Pawn.SetPhysics(PHYS_Spider); if ( bUpdating ) return true; LandBob = FMin(50, 0.055 * Pawn.Velocity.Z); return false; } event bool NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { if ( NewVolume.bWaterVolume ) GotoState(Pawn.WaterMovementState); return false; } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { //NEW (mdf) not used /*OLD local vector OldAccel; OldAccel = Pawn.Acceleration; */ Pawn.Acceleration = NewAccel; if ( bPressedJump ) Pawn.DoJump(bUpdating); } function PlayerMove( float DeltaTime ) { local vector NewAccel; local eDoubleClickDir OldDoubleClick; local eDoubleClickDir DoubleClickMove; local rotator OldRotation, ViewRotation; local float Speed2D; local bool bSaveJump; GroundPitch = 0; ViewRotation = Rotation; if ( !bKeyboardLook && (bLook == 0) && bCenterView ) { // FIXME - center view rotation based on current floor } BobTime = 0; WalkBob = WalkBob * (1 - FMin(1, 8 * deltatime)); // Update rotation. SetRotation(ViewRotation); OldRotation = Rotation; UpdateRotation(DeltaTime, 1); // Update acceleration. NewAccel = aForward*Normal(ViewX - OldFloor * (OldFloor Dot ViewX)) + aStrafe*ViewY; if ( VSize(NewAccel) < 1.0 ) NewAccel = vect(0,0,0); if ( bPressedJump && Pawn.JumpInProgress() ) { bSaveJump = true; bPressedJump = false; } else bSaveJump = false; //NEW MJL HandleMove(DeltaTime, NewAccel, DoubleClickMove, OldRotation - Rotation); /*OLD 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() { local Rotator NewRot; if ( Pawn.Mesh == None ) Pawn.SetMesh(); OldFloor = vect(0,0,1); GetAxes(Rotation,ViewX,ViewY,ViewZ); WalkBob = vect(0,0,0); DoubleClickDir = DCLICK_None; //NEW (mdf) Pawn.SetStance( ST_Standing ); /*OLD Pawn.ShouldCrouch(false); */ bPressedJump = false; if (Pawn.Physics != PHYS_Falling) Pawn.SetPhysics(PHYS_Spider); GroundPitch = 0; Pawn.bCrawler = true; Pawn.SetCollisionSize(Pawn.Default.CollisionHeight,Pawn.Default.CollisionHeight); } event EndState() { GroundPitch = 0; WalkBob = vect(0,0,0); if ( Pawn != None ) { Pawn.SetCollisionSize(Pawn.Default.CollisionRadius,Pawn.Default.CollisionHeight); //NEW (mdf) Pawn.SetStance( ST_Standing ); /*OLD Pawn.ShouldCrouch(false); */ Pawn.bCrawler = Pawn.Default.bCrawler; } } } // PlayerSpideringState // Player movement. // Player Swimming //NEW state @ PlayerSwimmingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, Bump; /*OLD state PlayerSwimming { //ignores SeePlayer, HearNoise, Bump; */ function bool WantsSmoothedView() { return ( !Pawn.bJustLanded ); } event bool NotifyLanded(vector HitNormal) { if ( Pawn.PhysicsVolume.bWaterVolume ) Pawn.SetPhysics(PHYS_Swimming); else GotoState(Pawn.LandMovementState); return bUpdating; } //NEW (mdf) refactored function LaunchActorOutofWater() { //set here so physics uses this for remainder of tick Pawn.velocity.Z = 330 + 2 * Pawn.CollisionRadius; GotoState(Pawn.LandMovementState); } //OLD event bool NotifyPhysicsVolumeChange( PhysicsVolume NewVolume ) { local actor HitActor; local vector HitLocation, HitNormal, checkpoint; if ( !NewVolume.bWaterVolume ) { Pawn.SetPhysics(PHYS_Falling); if (Pawn.bUpAndOut && Pawn.CheckWaterJump(HitNormal)) //check for waterjump { //NEW (mdf) refactored LaunchActorOutofWater(); /*OLD Pawn.velocity.Z = 330 + 2 * Pawn.CollisionRadius; //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.CollisionHeight + 6.0); HitActor = Trace(HitLocation, HitNormal, checkpoint, Pawn.Location, false); if (HitActor != None) GotoState(Pawn.LandMovementState); else { Enable('Timer'); SetTimer(0.7,false); } } } else { Disable('Timer'); Pawn.SetPhysics(PHYS_Swimming); } return false; } function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { //NEW (mdf) not used local vector X,Y,Z; /*OLD local vector X,Y,Z, OldAccel; */ GetAxes(Rotation,X,Y,Z); //NEW (mdf) not used /*OLD OldAccel = Pawn.Acceleration; */ Pawn.Acceleration = NewAccel; Pawn.bUpAndOut = ((X Dot Pawn.Acceleration) > 0) && ((Pawn.Acceleration.Z > 0) || (Rotation.Pitch > 2048)); if ( !Pawn.PhysicsVolume.bWaterVolume ) //check for waterjump NotifyPhysicsVolumeChange(Pawn.PhysicsVolume); } //NEW function vector GetAccel( vector X, vector Y, vector Z ) { local vector ReturnedAcceleration; ReturnedAcceleration = aForward*X + aStrafe*Y + aUp*vect(0,0,1); ReturnedAcceleration.Z = 0; return ReturnedAcceleration; } function SetMovementVars( vector Accel ) { local vector LocalAccel; LocalAccel = Accel << (rot(0,1,0)*Rotation.Yaw); //!!MJL (mdf) bForwardPressed = (LocalAccel.X > Pawn.SwimForwardThreshold); bUpPressed = (LocalAccel.Z > 0); } //OLD function PlayerMove(float DeltaTime) { local rotator oldRotation; local vector X,Y,Z, NewAccel; local float Speed2D; GetAxes( Rotation, X, Y, Z ); NewAccel = aForward*X + aStrafe*Y + aUp*vect(0,0,1); if ( VSize(NewAccel) < 1.0 ) NewAccel = vect(0,0,0); GetAxes(Rotation,X,Y,Z); //NEW NewAccel = GetAccel( X, Y, Z ); /*OLD NewAccel = aForward*X + aStrafe*Y + aUp*vect(0,0,1); */ //add bobbing when swimming Speed2D = Sqrt(Pawn.Velocity.X * Pawn.Velocity.X + Pawn.Velocity.Y * Pawn.Velocity.Y); WalkBob = Y * Bob * 0.5 * Speed2D * sin(4.0 * Level.TimeSeconds); WalkBob.Z = Bob * 1.5 * Speed2D * sin(8.0 * Level.TimeSeconds); // Update rotation. oldRotation = Rotation; UpdateRotation(DeltaTime, 2); //NEW MJL HandleMove(DeltaTime, NewAccel, DCLICK_None, OldRotation - Rotation); /*OLD 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); Disable('Timer'); } //NEW (mdf) function HandleWalking() { if ( Pawn != None ) { // Pawn is flying... Pawn.bIsWalking = false; } } //OLD event BeginState() { Disable('Timer'); Pawn.SetPhysics(PHYS_Swimming); } } // PlayerClimbingState //NEW (mdf) Fix state @ PlayerFlyingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, NotifyBump; /*OLD state PlayerFlying { //ignores SeePlayer, HearNoise, Bump; */ function PlayerMove(float DeltaTime) { local rotator newRotation; local vector X,Y,Z; GetAxes(Rotation,X,Y,Z); Pawn.Acceleration = aForward*X + aStrafe*Y; if ( VSize(Pawn.Acceleration) < 1.0 ) Pawn.Acceleration = vect(0,0,0); if ( bCheatFlying && (Pawn.Acceleration == vect(0,0,0)) ) //NEW Pawn.StopMovement( false, true ); /*OLD Pawn.Velocity = vect(0,0,0); */ // Update rotation. UpdateRotation(DeltaTime, 2); //NEW MJL HandleMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); /*OLD if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); else ProcessMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); */ } //NEW (mdf) function HandleWalking() { if ( Pawn != None ) { // Pawn is flying... Pawn.bIsWalking = false; } } //OLD event BeginState() { Pawn.SetPhysics(PHYS_Flying); } } // PlayerFlyingState //NEW (mdf) state @ PlayerHelicopteringState extends @ PlayerFlyingState /*OLD state PlayerHelicoptering extends PlayerFlying */ { function PlayerMove(float DeltaTime) { local rotator newRotation; local vector X,Y,Z; GetAxes(Rotation,X,Y,Z); Pawn.Acceleration = aForward*X + aStrafe*Y + aUp*vect(0,0,1); if ( VSize(Pawn.Acceleration) < 1.0 ) Pawn.Acceleration = vect(0,0,0); if ( bCheatFlying && (Pawn.Acceleration == vect(0,0,0)) ) Pawn.Velocity = vect(0,0,0); // Update rotation. UpdateRotation(DeltaTime, 2); //NEW MJL HandleMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); /*OLD if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); else ProcessMove(DeltaTime, Pawn.Acceleration, DCLICK_None, rot(0,0,0)); */ } } // PlayerHelicopteringState //NEW state @ BaseSpectatingState /*OLD state BaseSpectating */ { function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot) { Acceleration = NewAccel; MoveSmooth(Acceleration * DeltaTime); } function PlayerMove(float DeltaTime) { local rotator newRotation; local vector X,Y,Z; GetAxes(Rotation,X,Y,Z); //NEW (mdf) default to faster movement when spectating and make the speed configurable aUp *= 2.0; // goose up/down movement acceleration Acceleration = SpectatingAccelerationScale * (aForward*X + aStrafe*Y + aUp*vect(0,0,1)); /*OLD Acceleration = 0.02 * (aForward*X + aStrafe*Y + aUp*vect(0,0,1)); */ UpdateRotation(DeltaTime, 1); //NEW MJL HandleMove(DeltaTime, Acceleration, DCLICK_None, rot(0,0,0)); /*OLD 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)); */ } } // BaseSpectatingState //NEW state @ SpectatingState extends @ BaseSpectatingState /*OLD state Spectating extends BaseSpectating */ { //NEW ignores SwitchWeapon, RestartLevel, Suicide, /*OLD ignores SwitchWeapon, RestartLevel, ClientRestart, Suicide, */ ThrowWeapon, NotifyPhysicsVolumeChange, NotifyHeadVolumeChange; exec function NextWeapon() { Fire(); } exec function PrevWeapon() { if ( ViewTarget == self ) bBehindView = false; else bBehindView = true; //bChaseCam; } //NEW (mdf) weapon interface cleanup exec function Fire() /*OLD exec function Fire( optional float F ) */ { local Controller C, Pick; local bool bFound; if ( Role == ROLE_Authority ) { // view next player for ( C=Level.ControllerList; C!=None; C=C.NextController ) if ( (C.Pawn != None) && Level.Game.CanSpectate(self,C.Pawn) ) { if ( Pick == None ) Pick = C; if ( bFound ) { Pick = C; break; } else bFound = ( ViewTarget == C.Pawn ); } SetViewTarget(Pick.Pawn); if ( ViewTarget == self ) bBehindView = false; else bBehindView = true; //bChaseCam; } } // Return to spectator's own camera. //NEW (mdf) weapon interface cleanup exec function AltFire() /*OLD exec function AltFire( optional float F ) */ { bBehindView = false; SetViewtarget(self); ClientMessage(OwnCamera, 'Event'); } event BeginState() { if ( Pawn != None ) { SetLocation(Pawn.Location); UnPossess(); } bCollideWorld = true; } event EndState() { PlayerReplicationInfo.bIsSpectator = false; bCollideWorld = false; } } // SpectatingState //NEW auto state @ PlayerWaitingState extends @ BaseSpectatingState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, NotifyBump, TakeDamage, PhysicsVolumeChange; /*OLD auto state PlayerWaiting extends BaseSpectating { //ignores SeePlayer, HearNoise, NotifyBump, TakeDamage, PhysicsVolumeChange; */ exec function Jump( optional float F ) { } exec function Suicide() { } function ChangeTeam( int N ) { Level.Game.ChangeTeam(self, N); } function ServerReStartPlayer() { if ( Level.TimeSeconds < WaitDelay ) return; if ( Level.NetMode == NM_Client ) return; if ( Level.Game.bWaitingToStartMatch ) PlayerReplicationInfo.bReadyToPlay = true; else Level.Game.RestartPlayer(self); } //NEW (mdf) weapon interface cleanup exec function Fire() /*OLD exec function Fire(optional float F) */ { ServerReStartPlayer(); } //NEW (mdf) weapon interface cleanup exec function AltFire() /*OLD exec function AltFire(optional float F) */ { ServerReStartPlayer(); } event EndState() { if ( Pawn != None ) Pawn.SetMesh(); PlayerReplicationInfo.SetWaitingPlayer(false); bCollideWorld = false; } event BeginState() { if ( PlayerReplicationInfo != None ) PlayerReplicationInfo.SetWaitingPlayer(true); bCollideWorld = true; myHUD.bShowScores = false; } } // PlayerWaitingState //NEW MJL /*OLD state WaitingForPawn extends BaseSpectating { //ignores SeePlayer, HearNoise, KilledBy, SwitchWeapon; exec function Fire( optional float F ) { } exec function AltFire( optional float F ) { } 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 ) { } function PlayerTick(float DeltaTime) { Global.PlayerTick(DeltaTime); if ( Pawn != None ) { Pawn.Controller = self; ClientRestart(); } } event Timer() { AskForPawn(); } event BeginState() { SetTimer(0.2, true); } event EndState() { SetTimer(0.0, false); } } */ //NEW (mdf) state @ GameEndedState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, NotifyBump, HitWall, NotifyHeadVolumeChange, NotifyPhysicsVolumeChange, BeginFalling, TakeDamage, Suicide; /*OLD state GameEnded { //ignores SeePlayer, HearNoise, KilledBy, NotifyBump, HitWall, NotifyHeadVolumeChange, NotifyPhysicsVolumeChange, Falling, TakeDamage, Suicide; */ exec function ThrowWeapon() { } function ServerReStartGame() { Level.Game.RestartGame(); } //NEW (mdf) weapon interface cleanup exec function Fire() /*OLD exec function Fire( optional float F ) */ { if ( Role < ROLE_Authority) return; if ( !bFrozen ) ServerReStartGame(); else if ( TimerRate <= 0 ) SetTimer(1.5, false); } //NEW (mdf) weapon interface cleanup exec function AltFire() { Fire(); } /*OLD exec function AltFire( optional float F ) { Fire(F); } */ function PlayerMove(float DeltaTime) { local vector X,Y,Z; local Rotator ViewRotation; GetAxes(Rotation,X,Y,Z); // Update view rotation. if ( !bFixedCamera ) { ViewRotation = Rotation; ViewRotation.Yaw += 32.0 * DeltaTime * aTurn; ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp; ViewRotation.Pitch = ViewRotation.Pitch & 65535; If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152)) { If (aLookUp > 0) ViewRotation.Pitch = 18000; else ViewRotation.Pitch = 49152; } SetRotation(ViewRotation); } else if ( ViewTarget != None ) SetRotation(ViewTarget.Rotation); ViewShake(DeltaTime); ViewFlash(DeltaTime); //NEW MJL HandleMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0)); /*OLD 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; } function ServerMove ( float TimeStamp, vector InAccel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, eDoubleClickDir DoubleClickMove, byte ClientRoll, int View, optional byte OldTimeDelta, optional int OldAccel ) { Global.ServerMove(TimeStamp, InAccel, ClientLoc, NewbRun, NewbDuck, NewbJumpStatus, DoubleClickMove, ClientRoll, (32767 & (Rotation.Pitch/2)) * 32768 + (32767 & (Rotation.Yaw/2)) ); } function FindGoodView() { local vector cameraLoc; local rotator cameraRot, ViewRotation; local int tries, besttry; local float BestDist, newdist; local int startYaw; local actor ViewActor; ViewRotation = Rotation; ViewRotation.Pitch = 56000; tries = 0; besttry = 0; BestDist = 0.0; startYaw = ViewRotation.Yaw; for (tries=0; tries<16; tries++) { cameraLoc = ViewTarget.Location; PlayerCalcView(ViewActor, cameraLoc, cameraRot); newdist = VSize(cameraLoc - ViewTarget.Location); if (newdist > BestDist) { BestDist = newdist; besttry = tries; } ViewRotation.Yaw += 4096; } ViewRotation.Yaw = startYaw + besttry * 4096; SetRotation(ViewRotation); } event Timer() { bFrozen = false; } event BeginState() { local Pawn P; EndZoom(); bFire = 0; bAltFire = 0; if ( Pawn != None ) { Pawn.SimAnim.AnimRate = 0; Pawn.bPhysicsAnimUpdate = false; Pawn.StopAnimating(); Pawn.SetCollision(false,false,false); } myHUD.bShowScores = true; bFrozen = true; if ( !bFixedCamera ) { FindGoodView(); bBehindView = true; } SetTimer(1.5, false); SetPhysics(PHYS_None); ForEach DynamicActors(class'Pawn', P) { P.Velocity = vect(0,0,0); P.SetPhysics(PHYS_None); } //NEW: update client player's state as well (formerly implemented in DeathMatchPlus.uc, TeamGamePlus.uc, and CTFGame if( Role == ROLE_Authority && Level.NetMode != NM_StandAlone ) { ClientGameEnded(); } //OLD } } // GameEndedState //NEW MJL: unset crosshair when we die function ClientDying(class<DamageType> DamageType, vector HitLocation, Pawn InstigatedBy, vector Momentum) { if( Pawn != None && Pawn.Weapon != None) Pawn.Weapon.ClearWeaponEffects(); Super.ClientDying( DamageType, HitLocation, InstigatedBy, Momentum ); } //OLD //NEW state @ DeadState { ignores SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend, HearNoise, KilledBy, SwitchWeapon; /*OLD state Dead { //ignores SeePlayer, HearNoise, KilledBy, SwitchWeapon; */ function ServerRestartPlayer() { if ( bFrozen ) return; Super.ServerRestartPlayer(); } //NEW (mdf) weapon interface cleanup exec function Fire() /*OLD exec function Fire( optional float F ) */ { if ( !bFrozen ) ServerReStartPlayer(); } //NEW (mdf) weapon interface cleanup exec function AltFire() { Fire(); } /*OLD exec function AltFire( optional float F ) { Fire(F); } */ function ServerMove ( float TimeStamp, vector Accel, vector ClientLoc, bool NewbRun, bool NewbDuck, bool NewbJumpStatus, eDoubleClickDir DoubleClickMove, byte ClientRoll, int View, optional byte OldTimeDelta, optional int OldAccel ) { Global.ServerMove( TimeStamp, Accel, ClientLoc, false, false, false, DoubleClickMove, ClientRoll, View); } function PlayerMove(float DeltaTime) { local vector X,Y,Z; local rotator ViewRotation; if ( !bFrozen ) { if ( bPressedJump ) { //NEW (mdf) weapon interface cleanup Fire(); /*OLD Fire(0); */ bPressedJump = false; } GetAxes(Rotation,X,Y,Z); // Update view rotation. ViewRotation = Rotation; ViewRotation.Yaw += 32.0 * DeltaTime * aTurn; ViewRotation.Pitch += 32.0 * DeltaTime * aLookUp; ViewRotation.Pitch = ViewRotation.Pitch & 65535; If ((ViewRotation.Pitch > 18000) && (ViewRotation.Pitch < 49152)) { If (aLookUp > 0) ViewRotation.Pitch = 18000; else ViewRotation.Pitch = 49152; } SetRotation(ViewRotation); //NEW MJL HandleMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0)); /*OLD if ( Role < ROLE_Authority ) // then save this move and replicate it ReplicateMove(DeltaTime, vect(0,0,0), DCLICK_None, rot(0,0,0)); */ } ViewShake(DeltaTime); ViewFlash(DeltaTime); } function FindGoodView() { local vector cameraLoc; local rotator cameraRot, ViewRotation; local int tries, besttry; local float BestDist, newdist; local int startYaw; local actor ViewActor; ////log("Find good death scene view"); ViewRotation = Rotation; ViewRotation.Pitch = 56000; tries = 0; besttry = 0; BestDist = 0.0; startYaw = ViewRotation.Yaw; for (tries=0; tries<16; tries++) { cameraLoc = ViewTarget.Location; PlayerCalcView(ViewActor, cameraLoc, cameraRot); newdist = VSize(cameraLoc - ViewTarget.Location); if (newdist > BestDist) { BestDist = newdist; besttry = tries; } ViewRotation.Yaw += 4096; } ViewRotation.Yaw = startYaw + besttry * 4096; SetRotation(ViewRotation); } event Timer() { bFrozen = false; myHUD.bShowScores = true; bPressedJump = false; } event BeginState() { local SavedMove Next; //NEW (mdf) #debug SetControllerEnemy( None, GetContext() ); #release SetControllerEnemy( None ); /*OLD Enemy = None; */ bBehindView = true; bFrozen = true; bPressedJump = false; FindGoodView(); SetTimer(1.0, false); // clean out saved moves while ( SavedMoves != None ) { Next = SavedMoves.NextMove; SavedMoves.Destroy(); SavedMoves = Next; } if ( PendingMove != None ) { PendingMove.Destroy(); PendingMove = None; } } event EndState() { local SavedMove Next; // clean out saved moves while ( SavedMoves != None ) { Next = SavedMoves.NextMove; SavedMoves.Destroy(); SavedMoves = Next; } if ( PendingMove != None ) { PendingMove.Destroy(); PendingMove = None; } //NEW (mdf) StopMovement( true, true ); /*OLD Velocity = vect(0,0,0); Acceleration = vect(0,0,0); */ bBehindView = false; myHUD.bShowScores = false; bPressedJump = false; //Log(self$" exiting dying with remote role "$RemoteRole$" and role "$Role); } } //------------------------------------------------------------------------------ // ngStats Accessors function string GetNGSecret() { return ngWorldSecret; } function SetNGSecret(string newSecret) { ngWorldSecret = newSecret; } //------------------------------------------------------------------------------ // Control options function ChangeStairLook( bool B ) { bLookUpStairs = B; if ( bLookUpStairs ) bAlwaysMouseLook = false; } function ChangeAlwaysMouseLook(Bool B) { bAlwaysMouseLook = B; if ( bAlwaysMouseLook ) bLookUpStairs = false; } //NEW exec function SetAirControl( float F ) { //!!MJL (mwp) Restrict access (via AccessControl?). Pawn.AirControl = F; } //OLD //NEW (mdf) //----------------------------------------------------------------------------- // ADDITIONAL INTERFACE FUNCTIONS //----------------------------------------------------------------------------- function rotator GetViewRotation() { // !!mdf-tbd: ViewTarget initialized to Self, but TargetViewRotation not updated? if( ViewTarget != Pawn && ViewTarget != Self ) return TargetViewRotation; else return Rotation; } //OLD defaultproperties { bAlwaysMouseLook=true bKeyboardLook=true bNeverSwitchOnPickup=true WeaponPriority(0)='weaponInvTakkra' WeaponPriority(1)='weaponInvFlamethrower' WeaponPriority(2)='weaponInvLeechGun' WeaponPriority(3)='weaponInvDispersion' WeaponPriority(4)='weaponInvPistol' WeaponPriority(5)='weaponInvEnergyRifle' WeaponPriority(6)='weaponInvSniperRifle' WeaponPriority(7)='weaponInvShotgun' WeaponPriority(8)='weaponInvGrenadeLauncher' WeaponPriority(9)='weaponInvRocketLauncher' WeaponPriority(10)='weaponInvAssaultRifle' WeaponPriority(11)='weaponInvSingularityCannon' WeaponPriority(12)='weaponInvLaserRifle' WeaponPriority(13)='weaponTutorialInvGrenadeLauncher' bCheatsEnabled=true bZeroRoll=true OrthoZoom=40000.000000 CameraDist=9.000000 DesiredFOV=90.000000 DefaultFOV=90.000000 FlashScale=(X=1.000000,Y=1.000000,Z=1.000000) AnnouncerVolume=4 MaxTimeMargin=1.000000 QuickSaveString="Quick Saving" NoPauseMessage="Game is not pauseable" ViewingFrom="Now viewing from" OwnCamera="Now viewing from own camera" LocalMessageClass=Class'Engine.LocalMessage' Bob=0.045000 ShakePeriodX=31.000000 ShakePeriodY=29.000000 EnemyTurnSpeed=45000 InputClass=Class'Engine.PlayerInput' SpectatingAccelerationScale=0.025000 ShowSubtitles=true FovAngle=85.000000 bIsPlayer=true NetPriority=3.000000 UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |