# SpatialFear.SFPlayer

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 |
    //=============================================================================
    // Spatial Fear
    // Name: SFPlayer
    // Description: SpatialFear implementation of general player behaviour.
    //				Since the MOD is strongly based on these changes, this is
    //				our workhorse class. Modify it wisely!
    //
    // Author: Markus Nuebel
    //=============================================================================

    #exec AUDIO IMPORT FILE="Sounds\male\climb1.WAV" NAME="MClimb1" GROUP="Male"
    #exec AUDIO IMPORT FILE="Sounds\female\climb1.WAV" NAME="FClimb1" GROUP="Female"

    class SFPlayer extends TournamentPlayer;

    ////////////////////
    // enumerations
    ////////////////////
    enum EPlayerState
    {
    	STATE_UNDEF,
    	STATE_Crouch,
    	STATE_Creep,
    	STATE_Climb,
    	STATE_Swim,
    	STATE_Normal,
    };

    enum EScreenEffect
    {
    	EFFECT_NONE,
    	EFFECT_LR_WIPE
    };

    // Public class members
    var (Penalty) float JumpAccuracyPenalty;
    var (Penalty) float RunAccuracyPenalty;
    var (Penalty) float StrafeAccuracyPenalty;
    var (Penalty) float m_fPenaltyUpgrade;
    var (Movement) float SafeFall_Damage;
    var (Movement) float SafeFall_Kill;
    var (Collision) float CollisionHeightCrouch;
    var (Collision) float CollisionHeightCreep;
    var (Collision) float Correction;
    var (SpatialFear) int nShowVersionTime;
    var (SpatialFear) float NormalSpeed;
    var (SpatialFear) float CrouchSpeed;
    var (SpatialFear) float CreepSpeed;

    var (Sounds) sound ClimbStep;

    // Private class members
    var bool  m_bCannotDrown;
    var float m_fGroundSpeedOrg;
    var float m_fAirSpeedOrg;
    var float m_fWaterSpeedOrg;
    var float m_fAccelRate;
    var float m_fCurrentSpeedModification;
    var float m_fFrobTime;
    var float m_fInitialPrePivotZ;
    var int	m_nSafeFallDamage;
    var int m_nSafeFallKill;
    var SFMedStationMover	m_actNearestMedStation;

    var EScreenEffect m_screenEffect;
    var int m_nXWipePos;

    var string	strSFVersion;
    var bool	bShowVersionInfo;
    var bool	bJumpPenaltyAdded;
    var bool	bRunPenaltyAdded;
    var bool	bStrafePenaltyAdded;

    var bool	m_bIsJumping;
    var bool	m_bIsRunning;
    var bool	m_bIsStrafing;
    var bool	m_bIsCreeping;
    var byte	m_bStandState;

    var byte		m_bUseKey;
    var input byte	m_bCreep;
    var bool		m_bManualInput;
    var byte		m_bSavedDuck;
    var byte		m_bSavedCreep;

    var SFWeapon	oModifiedWeapon;
    var float   fPenaltyModifier;
    var int		nPenaltyCount;
    var EPlayerState	PlayerState;
    var EPlayerState	StartingPlayerState;	// Player state, before collision height corrections are taking place

    var float   fDiffStandCrouch;
    var float   fDiffCrouchCreep;
    var float   fDiffStandCreep;

    var Weapon	m_oCreepPendingWeapon;
    var bool	m_bInventoryOpen; // Private: Inventory window open/closed:
    var bool 	m_bWeaponSelectOpen; // Private: Weapon Upgrade select window open/closed
    var bool	m_bDreamMode; // Private: Indicates that player is in dreammode. E.g. no footsteps should be played. Default: false
    var float	m_fFootstepVolume; // Private: Footstep volume. Default: 2.2
    // Window stuff
    var UWindowMessageBox winConfirmLoad;

    // Upgrade modules
    var travel  bool				m_bWeaponDescUpgrade;
    var travel  bool				m_bVisorUnitUpgrade;
    var travel	SFDamageProtection	m_oSmartVest;

    var travel SFFlashlight m_oFlashlight;

    // STATS
    var bool bStatPlayer;
    var bool bStatWeapon;
    var bool bStatInventory;

    // Goaltable;
    var travel SFGoaltable					m_oGoals;

    const  NO_ACCURACY=-1.0;

    var input byte bDuck;
    var transient UWindowRootWindow  Root;

    // Smell system
    var float	m_fLastPheromoneSpawn;
    var bool	m_bViewScent;

    // Save games
    var int m_nLastSaveSlot;
    var bool m_bLoadDialogOpened;

    // testing
    var float fSoundPitch;

    // AI testing
    var Pawn	pawnCreatureMonitor;

    // List of seen communications
    var SFCommDetail	m_listCommunications;
    var SFCommunication	m_oScoutBotComm;
    // ScoutBot stuff
    var Decoration ScoutBot;

    // Null Weapon
    var Weapon m_oNullWeaponRestore;

    ////////////////////
    // Console commands
    ////////////////////

    exec function SFToggleFlashlight()
    {
    	local Inventory	oItem;

    	oItem	= Inventory;
    	while(None != oItem)
    	{
    		if(oItem.IsA('SFFlashlight'))
    		{
    			oItem.Activate();
    			return;
    		}
    		oItem	= oItem.Inventory;
    	}

    	ClientMessage("You do not own the flashlight.");

    }
    exec function ViewClass( class<actor> aClass, optional bool bQuiet )
    {
    }

    exec function SFViewScents(int n)
    {
    	if(0 == n)
    		m_bViewScent = false;
    	else
    		m_bViewScent = true;
    }

    exec function SFViewCreature(name nameClass)
    {
    	local Pawn	P;

    	pawnCreatureMonitor = None;

    	for ( P=Level.PawnList; P!=None; P=P.NextPawn )
    		if ( P.IsA(nameClass) )
    		{
    			pawnCreatureMonitor = P;
    		}

    }
    // Modifies the players health
    exec function SFHealth(int nHealth)
    {
    	Health = nHealth;
    }

    // upgrades the player accuracy
    function increasePenalty(float fUpgrade)
    {
    	// First reset all penalties
    	resetPenalties();

    	// Do the upgrade
    	m_fPenaltyUpgrade -= fUpgrade;

    	if(0.0 > m_fPenaltyUpgrade)
    		m_fPenaltyUpgrade = 0.0f;

    	// Calculate new penalties
    	AdjustAccuracy();
    }

    // Enables the different HUD modules
    exec function SFEnableHUD(name Type)
    {
    	if(('VISOR' == Type) || ('ALL' == Type))
    		m_bVisorUnitUpgrade=true;

    	if(('WEAPON' == Type) || ('ALL' == Type))
    		m_bWeaponDescUpgrade=true;
    }

    // Allows to modify the weapon penalties
    exec function SFAccuracy(name Type, float fAccuracy)
    {
    	// Set the different penalties
    	if('JUMP' == Type)
    		JumpAccuracyPenalty		= fAccuracy;
    	if('RUN' == Type)
    		RunAccuracyPenalty		= fAccuracy;
    	if('STRAFE' == Type)
    		StrafeAccuracyPenalty	= fAccuracy;
    }

    // Base class override, to prevent weapon switching in creep state
    exec function PrevWeapon()
    {
    	local int prevGroup;
    	local Inventory inv;
    	local Weapon realWeapon, w, Prev;
    	local bool bFoundWeapon;

    	// SF state check
    	if((PlayerState == STATE_Creep) || (m_bDreamMode))
    		return;

    	if( bShowMenu || Level.Pauser!="" )
    		return;

    	// No switch while picking up something
    	if(None != PendingWeapon)
    		if(PendingWeapon.IsA('SFNullGun') && (None != CarriedDecoration))
    			return;

    	// No switch while holding something
    	if(None != Weapon)
    		if(Weapon.IsA('SFNullGun') && (None != CarriedDecoration))
    			return;

    	if ( Weapon == None )
    	{
    		SwitchToBestWeapon();
    		return;
    	}
    	prevGroup = 0;
    	realWeapon = Weapon;
    	if ( PendingWeapon != None )
    		Weapon = PendingWeapon;
    	PendingWeapon = None;

    	for (inv=Inventory; inv!=None; inv=inv.Inventory)
    	{
    		w = Weapon(inv);
    		if ( w != None )
    		{
    			if ( w.InventoryGroup == Weapon.InventoryGroup )
    			{
    				if ( w == Weapon )
    				{
    					bFoundWeapon = true;
    					if ( Prev != None )
    					{
    						PendingWeapon = Prev;
    						break;
    					}
    				}
    				else if ( !bFoundWeapon && ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot()))) )
    					Prev = W;
    			}
    			else if ( (w.InventoryGroup < Weapon.InventoryGroup)
    					&& ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot())))
    					&& (w.InventoryGroup >= prevGroup) )
    			{
    				prevGroup = w.InventoryGroup;
    				PendingWeapon = w;
    			}
    		}
    	}
    	bFoundWeapon = false;
    	prevGroup = Weapon.InventoryGroup;
    	if ( PendingWeapon == None )
    		for (inv=Inventory; inv!=None; inv=inv.Inventory)
    		{
    			w = Weapon(inv);
    			if ( w != None )
    			{
    				if ( w.InventoryGroup == Weapon.InventoryGroup )
    				{
    					if ( w == Weapon )
    						bFoundWeapon = true;
    					else if ( bFoundWeapon && (PendingWeapon == None) && ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot()))) )
    						PendingWeapon = W;
    				}
    				else if ( (w.InventoryGroup > PrevGroup)
    						&& ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot()))) )
    				{
    					prevGroup = w.InventoryGroup;
    					PendingWeapon = w;
    				}
    			}
    		}

    	Weapon = realWeapon;
    	if ( PendingWeapon == None )
    		return;

    	Weapon.PutDown();
    }

    // Base class override, to prevent weapon switching in creep state
    exec function NextWeapon()
    {
    	local int nextGroup;
    	local Inventory inv;
    	local Weapon realWeapon, w, Prev;
    	local bool bFoundWeapon;

    	// SFState check here
    	if((PlayerState == STATE_Creep) || (m_bDreamMode))
    		return;
    	if( bShowMenu || Level.Pauser!="" )
    		return;

    	// No switch while picking up something
    	if(None != PendingWeapon)
    		if(PendingWeapon.IsA('SFNullGun') && (None != CarriedDecoration))
    			return;
    	// No switch while holding something
    	if(None != Weapon)
    		if(Weapon.IsA('SFNullGun') && (None != CarriedDecoration))
    			return;

    	if ( Weapon == None )
    	{
    		SwitchToBestWeapon();
    		return;
    	}
    	nextGroup = 100;
    	realWeapon = Weapon;
    	if ( PendingWeapon != None )
    		Weapon = PendingWeapon;
    	PendingWeapon = None;

    	for (inv=Inventory; inv!=None; inv=inv.Inventory)
    	{
    		w = Weapon(inv);
    		if ( w != None )
    		{
    			if ( w.InventoryGroup == Weapon.InventoryGroup )
    			{
    				if ( w == Weapon )
    					bFoundWeapon = true;
    				else if ( bFoundWeapon && ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot()))) )
    				{
    					PendingWeapon = W;
    					break;
    				}
    			}
    			else if ( (w.InventoryGroup > Weapon.InventoryGroup)
    					&& ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot())))
    					&& (w.InventoryGroup < nextGroup) )
    			{
    				nextGroup = w.InventoryGroup;
    				PendingWeapon = w;
    			}
    		}
    	}

    	bFoundWeapon = false;
    	nextGroup = Weapon.InventoryGroup;
    	if ( PendingWeapon == None )
    		for (inv=Inventory; inv!=None; inv=inv.Inventory)
    		{
    			w = Weapon(Inv);
    			if ( w != None )
    			{
    				if ( w.InventoryGroup == Weapon.InventoryGroup )
    				{
    					if ( w == Weapon )
    					{
    						bFoundWeapon = true;
    						if ( Prev != None )
    							PendingWeapon = Prev;
    					}
    					else if ( !bFoundWeapon && (PendingWeapon == None) && ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot()))) )
    						Prev = W;
    				}
    				else if ( (w.InventoryGroup < nextGroup)
    					&& ((w.AmmoType == None) || (w.AmmoType.AmmoAmount>(SFWeapon(w).getAmmoPerShot()))) )
    				{
    					nextGroup = w.InventoryGroup;
    					PendingWeapon = w;
    				}
    			}
    		}

    	Weapon = realWeapon;
    	if ( PendingWeapon == None )
    		return;

    	Weapon.PutDown();
    }

    // Adjusts the UseKey range
    exec function SFUseKeyRange(int nValue)
    {
    	SFGameInfo(Level.Game).nUseKeyRange = nValue;
    }

    // Adjusts the player crouching collision height
    exec function SFCrouchHeight(float fValue)
    {
    	CollisionHeightCrouch = fValue;
    }

    // Adjusts the player creep collision height
    exec function SFCreepHeight(float fValue)
    {
    	CollisionHeightCreep = fValue;
    }

    // Adjust the footstep volume
    exec function SFFootstepVolume(float fValue)
    {
    	if((0.0 > fValue) || (10.0 < fValue))
    		sfClientError("Invalid range >0.0 - 10.0<");

    	m_fFootstepVolume = fValue;
    }

    // Adjusts the player speed in relation to the original setting
    exec function SFPlayerSpeed(float fPercentage, optional bool bTrackModification)
    {
    	if((0.0 > fPercentage) || (10.0 < fPercentage))
    		sfClientError("Invalid range >0.0 - 10.0<");

    	if(!bTrackModification)
    	{
    		// No modification of current speed modification value
    		// Everything is relative to the original settings
    		GroundSpeed = fPercentage * m_fCurrentSpeedModification * m_fGroundSpeedOrg;
    		AirSpeed	= fPercentage * m_fCurrentSpeedModification * m_fAirSpeedOrg;
    		WaterSpeed	= fPercentage * m_fCurrentSpeedModification * m_fWaterSpeedOrg;
    		AccelRate	= fPercentage * m_fCurrentSpeedModification * m_fAccelRate;
    	}
    	else
    	{
    		// Calculate new speed based on current speed
    		GroundSpeed *= fPercentage;
    		AirSpeed	*= fPercentage;
    		WaterSpeed	*= fPercentage;
    		AccelRate	*= fPercentage ;
    		// Track speed modification
    		m_fCurrentSpeedModification *= fPercentage;

    	}
    }

    // Development shortcut
    exec function SFS( string ClassName)
    {
    	SFSummon(ClassName);
    }

    // Overwritten summon function, to provide better support
    // for SpatialFear packages
    exec function SFSummon( string ClassName)
    {
    	local class<actor> NewClass;
    	local bool	bSpecialized;
    	local string	strOrgClassName;

    	bSpecialized	= false;
    	strOrgClassName	= ClassName;

    	if( !bCheatsEnabled )
    		return;
    	if( !bAdmin && (Level.Netmode != NM_Standalone) )
    		return;

    	if( instr(ClassName,".")==-1 )
    		ClassName = "SpatialFear." $ strOrgClassName;
    	else
    		bSpecialized	= true;

    	// Try package SpatialFear
    	log( "Fabricate " $ ClassName );
    	NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    	if( NewClass!=None )
    	{
    		Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    		return;
    	}

    	// Specialized class has already been tried
    	if( bSpecialized )
    		return;

    	// Try package SFWeapon
    	ClassName = "SFWeapon." $ strOrgClassName;
    	class'SFUtils'.static.sfLogEx(5, "Fabricate " $ ClassName );
    	NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    	if( NewClass!=None )
    	{
    		Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    		return;
    	}

    	// Try package SFItem
    	ClassName = "SFItem." $ strOrgClassName;
    	class'SFUtils'.static.sfLogEx(5, "Fabricate " $ ClassName );
    	NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    	if( NewClass!=None )
    	{
    		Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    		return;
    	}

    	// Try package SFDecos
    	ClassName = "SFDecos." $ strOrgClassName;
    	class'SFUtils'.static.sfLogEx(5, "Fabricate " $ ClassName );
    	NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    	if( NewClass!=None )
    	{
    		Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    		return;
    	}

    	// Try package SFCharacter
    	ClassName = "SFCharacter." $ strOrgClassName;
    	class'SFUtils'.static.sfLogEx(5, "Fabricate " $ ClassName );
    	NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    	if( NewClass!=None )
    	{
    		Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    		return;
    	}

    	// Try package SFCharacter
    	ClassName = "SFCharacter2." $ strOrgClassName;
    	class'SFUtils'.static.sfLogEx(5, "Fabricate " $ ClassName );
    	NewClass = class<actor>( DynamicLoadObject( ClassName, class'Class' ) );
    	if( NewClass!=None )
    	{
    		Spawn( NewClass,,,Location + 72 * Vector(Rotation) + vect(0,0,1) * 15 );
    		return;
    	}

    	// Call to base class
    	Super.summon(strOrgClassName);
    }

    // Adjusts the falling height, where the player
    // starts talking falling damage default value 750
    exec function SFSafeFallDamage(int nValue)
    {
    	SafeFall_Damage = nValue;
    }

    // Adjusts the falling height, where the player
    // is being killed default value 1650
    exec function SFSafeFallKill(int nValue)
    {
    	SafeFall_Kill = nValue;
    }

    // Adjusts jumping height of a player
    // default value 370
    exec function SFJumpHeight(int nValue)
    {
    	JumpZ = nValue;
    }

    // toggles on/off Spatial Fear stat logging
    exec function SFStat(string strType)
    {
    	// Make all uppercase
    	strType	= Caps(strType);

    	// Comparisions for our STATS
    	if((strType == "PLAYER") || (strTYPE == "ALL"))
    		bStatPlayer = !bStatPlayer;
    	if((strType ==  "WEAPON") || (strTYPE == "ALL"))
    		bStatWeapon = !bStatWeapon;
    	if((strType ==  "INVENTORY") || (strTYPE == "ALL"))
    		bStatInventory = !bStatInventory;
    }

    // prints the current spatial fear code version to the log
    // and client window
    exec function SFVersion()
    {
    	if(strSFVersion != "")
    		ClientMessage( "Spatial Fear V"$strSFVersion  );
    }

    // sets the spatial fear log level
    exec function SFLogLevel( int nLevel)
    {
    	class'SFUtils'.default.LogLevel=nLevel;
    }

    exec function Climb(Bool B)
    {
    	if(B)
    		GotoState('Climbing');
    	else
    		GotoState(PlayerReStartState);
    }

    // Cancels an active HUD communication window
    exec function CancelComm()
    {
    	local SFHud	sfHud;

    	sfHud = SFHUD(myHUD);
    	sfHud.cancelComm();
    }

    // exec function for Next Item binding
    exec function NextItem()
    {
    	local SFHud	sfHud;

    	sfHud = SFHUD(myHUD);
    	if(None != sfHud)
    		sfHud.nextItem();
    }

    // exec function for Previous Item binding
    exec function PrevItem()
    {
    	local SFHud	sfHud;

    	sfHud = SFHUD(myHUD);
    	if(None != sfHud)
    		sfHud.prevItem();
    }

    // exec function to show/hide the passive item window
    exec function PassivItem()
    {
    	local SFHud	sfHud;

    	sfHud = SFHUD(myHUD);
    	if(None != sfHud)
    		sfHud.passiveItem();
    }

    // exec function to print out the goaltable
    exec function SFPrintGoals()
    {
    	m_oGoals.printTable();
    }

    // exec function to set a goal
    exec function SFSetGoal(int nIndex)
    {
    	m_oGoals.setGoal(nIndex);
    }

    // exec function to reset a goal
    exec function SFResetGoal(int nIndex)
    {
    	m_oGoals.resetGoal(nIndex);
    }

    // exec function for UseKey binding
    exec function UseKey()
    {
    	if((m_bWeaponSelectOpen) || (m_bInventoryOpen))
    	{
    		SFHud(myHUD).activateItem();
    		return;
    	}

    	m_bUseKey = 1;
    }

    // exec function for Creeping binding
    exec function Creeping()
    {
    	class'SFUtils'.static.sfError("Should not be called, since we have changed back to input buttons !!!!");
    	// m_bCreep, m_Duck are modified here
    	m_bStandState +=1;
    	// Check for roll over
    	if(m_bStandState > 2)
    		m_bStandState = 0;

    	switch(m_bStandState)
    	{
    	case 0:
    		bDuck = 0;
    		m_bCreep = 0;
    		break;
    	case 1:
    		bDuck = 1;
    		m_bCreep = 0;
    		break;
    	case 2:
    		bDuck = 0;
    		m_bCreep = 1;
    		break;
    	default:
    		bDuck = 0;
    		m_bCreep = 0;
    		break;
    	}
    }

    exec function SFLoadDialog()
    {
    	local	int		nLeft, nTop, nWidth, nHeight;
    	local	SFHUD	oHUD;

    	// Manually update the savegame path
    	//ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");
    	//Ask to overwrite
    	oHUD	= SFHUD(myHud);
    	nWidth	= oHUD.m_fHUDScale	* 50;
    	nHeight	= oHUD.m_fHUDScale	* 25;
    	nLeft	= (oHUD.m_nCanvasClipX-nWidth)/2;
    	nTop	= (oHUD.m_nCanvasClipy-nHeight)/2;

    	// Bring up the window
    	oHUD.openWindow(class'SFLoadGameWindow', nLeft, nTop, nWidth, nHeight);
    }

    exec function SFSaveDialog()
    {
    	local	int		nLeft, nTop, nWidth, nHeight;
    	local	SFHUD	oHUD;

    	// Manually update the savegame path
    	//ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");
    	//Ask to overwrite
    	oHUD	= SFHUD(myHud);
    	nWidth	= oHUD.m_fHUDScale	* 50;
    	nHeight	= oHUD.m_fHUDScale	* 25;
    	nLeft	= (oHUD.m_nCanvasClipX-nWidth)/2;
    	nTop	= (oHUD.m_nCanvasClipy-nHeight)/2;

    	// Bring up the window
    	oHUD.openWindow(class'SFSaveGameWindow', nLeft, nTop, nWidth, nHeight);
    }

    // Opens up the conversation history window
    exec function SFShowConvHistory()
    {
    	local	int		nLeft, nTop, nWidth, nHeight;
    	local	SFHUD	oHUD;

    	if ( (Health > 0) && (Level.NetMode == NM_Standalone))
    	{
    		//Show the dialog
    		oHUD	= SFHUD(myHud);
    		nWidth	= oHUD.m_fHUDScale	* 50;
    		nHeight	= oHUD.m_fHUDScale	* 25;
    		nLeft	= (oHUD.m_nCanvasClipX-nWidth)/2;
    		nTop	= (oHUD.m_nCanvasClipy-nHeight)/2;

    		// Bring up the window
    		oHUD.openWindow(class'SFMenuConversationRecallWindow', nLeft, nTop, nWidth, nHeight);
    	}
    }

    // Opens up the quicksave dialog
    exec function SFQuickSave()
    {
    	local	int		nLeft, nTop, nWidth, nHeight;
    	local	SFHUD	oHUD;

    	if ( (Health > 0) && (Level.NetMode == NM_Standalone))
    	{
    		// Manually update the savegame path
    	    //ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");
    		//Ask to overwrite
    		oHUD	= SFHUD(myHud);
    		nWidth	= oHUD.m_fHUDScale	* 50;
    		nHeight	= oHUD.m_fHUDScale	* 25;
    		nLeft	= (oHUD.m_nCanvasClipX-nWidth)/2;
    		nTop	= (oHUD.m_nCanvasClipy-nHeight)/2;

    		// Bring up the window
    		oHUD.openWindow(class'SFQuickSaveBox', nLeft, nTop, nWidth, nHeight);
    	}
    }

    exec function autoSaveGame()
    {
    	m_nLastSaveSlot = 9999;
    	//ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");
    	ConsoleCommand("SaveGame " $ 9999 );
    }

    exec function autoLoadGame()
    {
    	//ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");

    	if  (Level.NetMode == NM_Standalone)
    		ClientTravel( "?load=9999", TRAVEL_Absolute, true);
    }

    function saveGame(int nNumber)
    {
    	m_nLastSaveSlot=nNumber;

    	ConsoleCommand("SaveGame " $ nNumber);
    	if(9 == nNumber)
    		ClientMessage("Quick Saving ...");
    	else
    		ClientMessage("Saving game ...");

    }

    exec function loadGame(int nNumber)
    {
    	local int nOldSlot;

    	nOldSlot = m_nLastSaveSlot;
    	//ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");

    	if  (Level.NetMode == NM_Standalone)
    		ClientTravel( "?load="$nNumber, TRAVEL_Absolute, true);

    	m_nLastSaveSlot = nOldSlot;

    }

    exec function SFQuickLoad()
    {
    	local string	strSavePath;

    	strSavePath = ConsoleCommand("get core.system savepath");
        //ConsoleCommand("set core.system savepath ..\\spatial-fear\\Save");

    	ClientMessage("");
    	if  (Level.NetMode == NM_Standalone)
    		ClientTravel( "?load=9", TRAVEL_Absolute, true);
    	ClientMessage("Quick Loading");
    }

    /////////////////
    // Global functions
    /////////////////

    function showHUD(bool bEnable)
    {
    	// We are positive here, but negative in HUD, sorry.
    	SFHUD(myHUD).m_bHideStatus = !bEnable;
    }

    function sweat(float fDelta)
    {
    	local SFPheromone oParticle;

    	m_fLastPheromoneSpawn += fDelta;
    	if(m_fLastPheromoneSpawn > 1.5f)
    	{
    		m_fLastPheromoneSpawn = 0.0f;
    		oParticle	= Spawn(class'SFPheromone');
    		oParticle.m_actInstigator = Self;
    		if(m_bViewScent)
    			oParticle.bHidden = false;
    	}

    }

    // Manually fires the actors event
    function FireCustomEvent( actor Other , Pawn Instigator, name nameEvt)
    {
    	local actor A;

    	if( Instigator.IsA('SFPlayer') )
    	{
    		// Broadcast the Trigger message to all matching actors.
    		if( nameEvt != '' )
    		{
    			foreach AllActors( class 'Actor', A, nameEvt )
    				A.Trigger( Other, Instigator );
    		}
    	}
    }

    event HeadZoneChange(ZoneInfo newHeadZone)
    {
    	// Ignore drowning when not set
    	if(!m_bCannotDrown)
    		Super.HeadZoneChange(newHeadZone);
    }

    function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
    {
    	local int nNewDamage;

    	// Check for availability of smart vest
    	if(None != m_oSmartVest)
    		nNewDamage = m_oSmartVest.calcDamage(Damage, string(damageType));
    	else
    		nNewDamage = Damage;

    	Super.TakeDamage(nNewDamage, instigatedBy, hitlocation, momentum, damageType);

    	// Get of carried item
    	SlipDecoration();

    	//class'SFUtils'.static.sfLogEx(5, "SFPlayer - TakeDamage: Damage " $ Damage $ " NewDamage " $ nNewDamage  $ " DamageType: " $ damageType);

    }

    // Retrieves the human readable name of the current
    // player state
    function string getPlayerState()
    {
    	switch(PlayerState)
    	{
    	case STATE_Crouch:
    		return ("Crouching");
    		break;
    	case STATE_Creep:
    		return ("Creeping");
    		break;
    	case STATE_Climb:
    		return ("Climbing");
    		break;
    	case STATE_Swim:
    		return ("Swimming");
    		break;
    	case STATE_Normal:
    		return ("Standing");
    		break;
    	default:
    		return ("UNDEFINED");
    	}

    	return ("Unknown");
    }

    // Retrieves the human readable name of the current
    // player state
    function string getStartingPlayerState()
    {
    	switch(StartingPlayerState)
    	{
    	case STATE_Crouch:
    		return ("Crouching");
    		break;
    	case STATE_Creep:
    		return ("Creeping");
    		break;
    	case STATE_Climb:
    		return ("Climbing");
    		break;
    	case STATE_Swim:
    		return ("Swimming");
    		break;
    	case STATE_Normal:
    		return ("Standing");
    		break;
    	default:
    		return ("UNDEFINED");
    	}

    	return ("Unknown");
    }

    event ClientMessage( coerce string S, optional Name Type, optional bool bBeep )
    {
    	if (Player == None)
    		return;

    	if (Type == '')
    		Type = 'Event';

    	if (Player.Console != None)
    	{
    		Player.Console.Message( PlayerReplicationInfo, S, Type );
    	}
    	if (bBeep && bMessageBeep)
    		PlayBeepSound();
    	if ( myHUD != None )
    	{
    		myHUD.Message( PlayerReplicationInfo, S, Type );
    	}
    }

    // Prompts an error message to the client
    function sfClientError(string strMessage)
    {
    	ClientMessage("SF Error: " $ strMessage);
    }

    // Prompts a warning message to the client
    function sfClientWarning(string strMessage)
    {
    	ClientMessage("SF Warning: " $ strMessage);
    }

    // Plays the kneel animaion
    function PlayKneel()
    {
    	BaseEyeHeight = -5;
    	if ( (Weapon == None) || (Weapon.Mass < 20) )
    //		TweenAnim('SwimSM', 0.25);
    		TweenAnim('Crawl', 0.25);
    	else
    //		TweenAnim('SwimLG', 0.25);
    		TweenAnim('Crawl', 0.25);
    }

    // Plays the creeping animation
    function PlayCreeping()
    {
    	BaseEyeHeight = -5;

    	if ( (Weapon == None) || (Weapon.Mass < 20) )
    //		LoopAnim('SwimSM');
    		LoopAnim('Crawl');
    	else
    //		LoopAnim('SwimLG');
    		LoopAnim('Crawl');
    }

    // enables RL wipe for pawn
    function setLRWipe()
    {
    	m_screenEffect = EFFECT_LR_WIPE;
    }

    // Increases the wipe boundary
    function updateLRWipe()
    {
    	if(m_nXWipePos < 3000) // should be sufficient for nowadays monitors
    		m_nXWipePos +=40;
    }

    // Resets any screen effect
    function resetScreenEffect()
    {
    	m_screenEffect = EFFECT_NONE;
    }

    // Called from zone or trigger, when character enters
    // a speedzone
    function SpeedZoneEntered(float fAcceleration)
    {
    	// Adjust speed on ladder
    	SFPlayerSpeed(fAcceleration, true);
    }

    // Called from zone or trigger, when character leaves
    // a speedzone
    function SpeedZoneLeaving(float fAcceleration)
    {
    	// Adjust speed on ladder
    	SFPlayerSpeed(1.0/fAcceleration, true);
    }

    // Called from zone or trigger, when character enters
    // a climbzone
    function ClimbZoneEntered(float fLadderSpeedAcceleration)
    {
    	// Adjust speed on ladder
    	SFPlayerSpeed(fLadderSpeedAcceleration, true);

    	// Switch to state climbing
    	if('Dying' != GetStateName())
    		GotoState('Climbing');
    }

    // Called from zone or trigger, when character leaves
    // a climbzone
    function ClimbZoneLeaving(float fLadderSpeedAcceleration)
    {
    	// Adjust speed after leaving ladder
    	SFPlayerSpeed(1.0/fLadderSpeedAcceleration, true);

    	// Goto default state
    	SwitchToDefaultState();
    }

    // Goto default player state
    function SwitchToDefaultState()
    {
    	GotoState(PlayerReStartState);
    }

    // Adjust the weapon characteristics, according to the new player state
    function AdjustWeaponStuff(EPlayerState state)
    {
    	// First time we are going down, put the weapon down.
    	if((PlayerState != STATE_Creep) && (state == STATE_Creep))
    	{
    		// If holding a weapon, put it down
    		if(None != weapon)
    		{
    			weapon.PutDown();

    			// class'SFUtils'.Static.sfLogEx(5, "SFPlayer AdjustWeaponStuff - Putting down the weapon");
    		}

    	}
    }

    // Adjust collision characteristics for player staste
    function bool AdjustCollisionStuff(EPlayerState state)
    {
    	// ATTENTION: When changing to CREEP state, no PIVOT correction is done!1
    	// This is because I want the swimming animation to take place nearer to the ground
    	// Maybe someday someone can make a creep animation, as seen in the Unreal2 videos

    	local bool	bReturn;
    	local float fDiff;
    	local int	nDiff;
    	local vector	vectOffset;

    	bReturn = true;

    	if(PlayerState == state)
    		return true; // Nothing to do

    	switch(state)
    	{
    		case STATE_Crouch:
    			// First check for collision
    			if(CheckStandUp(fDiffCrouchCreep) || (PlayerState==STATE_Normal))
    			{
    				// class'SFUtils'.Static.sfLogEx(5,"SFPlayer - AdjustCollisionStuff: New state: STATE_Crouch");
    				// Modify bounding cylinder
    				SetCollisionSize(CollisionRadius,CollisionHeightCrouch);
    				// Adjust speed in new state
    				SFPlayerSpeed(Default.CrouchSpeed);
    				// Compensate mesh origin
    				if(PlayerState == STATE_Normal)
    					PrePivot.Z += fDiffStandCrouch;
    				else if(PlayerState == STATE_Creep)
    				{
    					PrePivot.Z = PrePivot.Z;		// Not correcting, just changing collision height
    //					PrePivot.Z -= fDiffCrouchCreep;
    				}
    				// Correct the location center, to prevent falling through decoration
    				if(PlayerState == STATE_Creep)
    				{
    					vectOffset = vect(0,0,0);
    					vectOffset.Z += int(fDiffCrouchCreep);
    					SetLocation(Location + vectOffset);
    				}
    				// Update state
    				PlayerState = STATE_Crouch;
    			}
    			else
    			{
    				//class'SFUtils'.Static.sfLogEx(5,"SFPlayer - AdjustCollisionStuff: Cannot switch to STATE_CROUCH: collision");
    				bReturn = false;
    			}
    		break;
    		case STATE_Creep:
    			//class'SFUtils'.Static.sfLogEx(5,"SFPlayer - AdjustCollisionStuff: New state: STATE_Creep");
    			// Modify bounding cylinder
    			SetCollisionSize(CollisionRadius,CollisionHeightCreep);
    			// Adjust speed in new state
    			SFPlayerSpeed(Default.CreepSpeed);
    			// Compensate mesh origin

    			if(PlayerState == STATE_Normal)
    //				PrePivot.Z = PrePivot.Z;
    				PrePivot.Z += fDiffStandCrouch;		// Only use PrePivot correciton based on crouch
    			else if(PlayerState == STATE_Crouch)
    				PrePivot.Z = PrePivot.Z; // Not correcting, just changing collision height
    //				PrePivot.Z += fDiffCrouchCreep;
    			// Update state
    			PlayerState = STATE_Creep;
    		break;
    		case STATE_Normal:
    			// Determine transition kind
    			if(StartingPlayerState == STATE_Crouch)
    				fDiff = fDiffStandCrouch;
    			else if (StartingPlayerState == STATE_Creep)
    				fDiff = fDiffStandCreep;
    			nDiff = int(fDiff);

    			// First check for collision
    			if(CheckStandUp(fDiff))
    			{
    				//class'SFUtils'.Static.sfLogEx(5,"SFPlayer - AdjustCollisionStuff: New state: STATE_Normal");
    				// Reset collision cylinder
    				SetCollisionSize(CollisionRadius,Default.CollisionHeight);
    				// Adjust speed in new state
    				SFPlayerSpeed(Default.NormalSpeed);
    				// Update PrePivot
    				PrePivot.Z = m_fInitialPrePivotZ;	// Return to initial
    				// Correct the location center, to prevent falling through decoration
    				vectOffset = vect(0,0,0);
    				vectOffset.Z += nDiff;
    				SetLocation(Location + vectOffset);
    				// Update state
    				PlayerState = STATE_Normal;
    			}
    			else
    			{
    				//class'SFUtils'.Static.sfLogEx(5,"SFPlayer - AdjustCollisionStuff: Cannot switch to STATE_NORMAL: collision");
    				bReturn = false;
    			}

    		break;
    	}
    	return bReturn;
    }

    // Base class override to prevent footsteps during creeping
    simulated function FootStepping()
    {
    	local sound				step;
    	local float				decision;
    	local Texture			texCurrent;
    	local SFPlayerShadow	oShadow;

    	// No sound during creeping
    	if(m_bIsCreeping)
    		return;

    	if ( FootRegion.Zone.bWaterZone )
    	{
    		PlaySound(WaterStep, SLOT_Interact, 1, false, 1000.0, 1.0);
    		return;
    	}

    	// Extract ground texture

    	step	= None;
    	if(None != Shadow)
    	{
    		texCurrent	= (SFPlayerShadow(Shadow)).m_texCurrent;
    		if(None != texCurrent)
    			step = texCurrent.FootstepSound;
    	}

    	// Footstep sound not assigned, yet?
    	if(None == step)
    	{
    		// Use one of the default footstep sounds
    		decision = FRand();
    		if ( decision < 0.34 )
    			step = Footstep1;
    		else if (decision < 0.67 )
    			step = Footstep2;
    		else
    			step = Footstep3;
    	}

    	PlaySound(step, SLOT_Interact, m_fFootstepVolume, false, 1000.0, 1.0);
    }

    exec function SoundPitch(float fPitch)
    {
    	fSoundPitch=fPitch;
    }

    function TakeFallingDamage()
    {
    	//class'SFUtils'.Static.sfLog("TakeFallingDamage " $ string(JumpZ) $ " " $ string(Velocity.Z));
    	if (Velocity.Z < -1.4 * JumpZ)
    	{
    		//class'SFUtils'.Static.sfLog("Velocity.Z < -1.4 * JumpZ) " $ string(JumpZ));
    		MakeNoise(-0.5 * Velocity.Z/(FMax(JumpZ, 150.0)));
    		if (Velocity.Z <= (-SafeFall_Damage - JumpZ))
    		{
    			class'SFUtils'.Static.sfLog("Velocity.Z <= -SafeFall_Damage - JumpZ " $ string(JumpZ));
    			if ( (Velocity.Z < -SafeFall_Kill - JumpZ) && (ReducedDamageType != 'All') )
    			{
    				//class'SFUtils'.Static.sfLog("TakeDamage(1000, None, Location, vect(0,0,0), 'Fell'); " $ string(JumpZ));
    				TakeDamage(1000, None, Location, vect(0,0,0), 'Fell');
    			}
    			else if ( Role == ROLE_Authority )
    			{
    				//class'SFUtils'.Static.sfLog("Taking damage" $ string(JumpZ));
    				TakeDamage(-0.15 * (Velocity.Z + (SafeFall_Damage*0.9) + JumpZ), None, Location, vect(0,0,0), 'Fell');
    			}
    			ShakeView(0.175 - 0.00007 * Velocity.Z, -0.85 * Velocity.Z, -0.002 * Velocity.Z);
    		}
    	}
    	else if ( Velocity.Z > 0.5 * Default.JumpZ )
    	{
    		MakeNoise(0.35);
    		//class'SFUtils'.Static.sfLog("Velocity.Z > 0.5 * Default.JumpZ " $ string(JumpZ));
    	}
    }

    // Prepares the player canvas for output
    function PrepareCanvas(out canvas C)
    {
    	// Set font
    	C.Font = class'FontInfo'.Static.GetStaticSmallFont( C.ClipX );
    	// Set color
    	C.DrawColor.R = 25;
    	C.DrawColor.G = 0;
    	C.DrawColor.B = 255;
    }

    // Prepares the player canvas for STAT output
    function PrepareCanvasStat(out canvas C)
    {
    	// Set font
    	C.Font = class'FontInfo'.Static.GetStaticSmallestFont( C.ClipX );
    	// Set color
    	C.DrawColor.R = 255;
    	C.DrawColor.G = 255;
    	C.DrawColor.B = 255;
    }

    // Renders creature info
    function RenderCreatureInfo(Canvas C, float fPosY)
    {
    	local string strCreatureData;
    	local float fPosX;
    	local float XL, YL;
    	local ScriptedPawn	oCreature;

    	if(None == pawnCreatureMonitor)
    		return;

    	oCreature = ScriptedPawn(pawnCreatureMonitor);
    	if(None == oCreature)
    		return;

    	fPosX = 1;
    	fPosY += 1*(YL + 2);
    	C.SetPos( fPosX, fPosY );
    	// Draw title and do  no CR
    	C.TextSize("SFPlayer:", XL, YL);
    	C.DrawText("Creature: " $ oCreature.name, false );
    	// Compose debug output
    	fPosY += YL + 2;
    	C.SetPos(fPosX, fPosY);
    	strCreatureData =  "   State: " $ oCreature.getStateName();
    	if(None != oCreature.OldEnemy)
    		strCreatureData = strCreatureData $ " OldEnemy: " $ oCreature.OldEnemy.name;
    	else
    		strCreatureData = strCreatureData $ " OldEnemy: None";
    	if(None != oCreature.Hated)
    		strCreatureData = strCreatureData $ " Hated: " $ oCreature.Hated.name;
    	else
    		strCreatureData = strCreatureData $ " Hated: None";
    	if(None != oCreature.Enemy)
    		strCreatureData = strCreatureData $ " Enemy: " $ oCreature.Enemy.name;
    	else
    		strCreatureData = strCreatureData $ " Enemy: None";
    	if(None != oCreature.Target)
    		strCreatureData = strCreatureData $ " Target: " $ oCreature.Target.name;
    	else
    		strCreatureData = strCreatureData $ " Target: None";
    	C.DrawText( strCreatureData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos(fPosX, fPosY);
    	strCreatureData =  "   Alertness: " $ oCreature.Alertness $ " PeripheralVision: " $ oCreature.PeripheralVision $ " HearingThreshold: " $ oCreature.HearingThreshold $ " AttitudeToPlayer: " $ oCreature.AttitudeToPlayer $ " health: " $ oCreature.health ;
    	C.DrawText( strCreatureData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos(fPosX, fPosY);
    	strCreatureData =  "   Orders: " $ oCreature.Orders;;
    	if(None != oCreature.TeamLeader)
    		strCreatureData =  strCreatureData $ " TeamLeader: " $ oCreature.TeamLeader.name;
    	else
    		strCreatureData =  strCreatureData $ " TeamLeader: None";
    	strCreatureData =  strCreatureData $ " CombatStyle: " $ oCreature.CombatStyle;
    	C.DrawText( strCreatureData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos(fPosX, fPosY);
    	strCreatureData =  "   NextState : " $ oCreature.NextState $ " NextLabel: " $ oCreature.NextLabel $ " NextAnim: " $ oCreature.NextAnim;
    	C.DrawText( strCreatureData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos(fPosX, fPosY);
    	strCreatureData =  "   Destination: " $ oCreature.Destination $  " LastSeenPos: " $ oCreature.LastSeenPos;
    	C.DrawText( strCreatureData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos(fPosX, fPosY);
    	strCreatureData =  "   AnimSequenc: " $ oCreature.GetAnimGroup(AnimSequence) ;
    	C.DrawText( strCreatureData, true );

    }

    // Renders the version info to the screen
    function RenderVersionInfo(canvas C)
    {
    	local string strVersionInfo;
    	local float fPosX, fPosY;
    	local float XL, YL;

    	if(strSFVersion == "")
    		return;

    	// Get text size
    	strVersionInfo = "Spatial Fear V." $ strSFVersion;
    	C.TextSize( strVersionInfo , XL, YL );
    	fPosX = C.ClipX - XL -10;
    	fPosY = YL + 15;
    	C.SetPos( fPosX, fPosY );
    	// Draw text and no CR
    	C.DrawText( strVersionInfo, False );
    }

    // Renders the player data to the screen
    function float RenderPlayerData(canvas C, float fPosY)
    {
    	local string strPlayerData;
    	local float fPosX;
    	local float XL, YL;

    	fPosX = 1;
    	fPosY += 1*(YL + 2);
    	C.SetPos( fPosX, fPosY );
    	// Draw title and do  no CR
    	C.DrawText( "SFPlayer:", false );
    	C.TextSize("SFPlayer:", XL, YL);
    	// Compose debug output
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strPlayerData =  "   Loc(" $ class'SFUtils'.static.FormatFloat(Location.x) $ "/" $ class'SFUtils'.static.FormatFloat(Location.y) $ "/"  $ class'SFUtils'.static.FormatFloat(Location.z) $ ") ColH: " $ string(CollisionHeight) $ " ColRad: " $ string(CollisionRadius) $ " Vel(" $ class'SFUtils'.static.FormatFloat(Velocity.x) $ "/" $ class'SFUtils'.static.FormatFloat(Velocity.y)$ "/"  $ class'SFUtils'.static.FormatFloat(Velocity.z) $ ") PrePivot.Z: " $ class'SFUtils'.static.FormatFloat(PrePivot.z); // Draw text and no CR
    	C.DrawText( strPlayerData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strPlayerData =  "   EyeHeight: " $ class'SFUtils'.static.FormatFloat(EyeHeight) $ " GrdSpeed: " $ class'SFUtils'.static.FormatFloat(GroundSpeed) $ " AirSpeed: " $ class'SFUtils'.static.FormatFloat(AirSpeed) $  " WaterSpeed: " $ class'SFUtils'.static.FormatFloat(WaterSpeed) $ " Accel: " $ class'SFUtils'.static.FormatFloat(AccelRate) $ " Cur. Modificator: " $ class'SFUtils'.static.FormatFloat(m_fCurrentSpeedModification);
    	// Draw text and no CR
    	C.DrawText( strPlayerData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strPlayerData =  "   JumpZ: " $ class'SFUtils'.static.FormatFloat(JumpZ) $ " SafeDamage: " $ class'SFUtils'.static.FormatFloat(SafeFall_Damage) $ " SafeKill: " $ class'SFUtils'.static.FormatFloat(SafeFall_Kill) $ " Health: " $ Health;
    	// Draw text and no CR
    	C.DrawText( strPlayerData, true );

    	// Next line
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strPlayerData =  "   State: " $ GetStateName() $ " PlayerState: " $ getPlayerState() $ " FootStepVolume: " $ class'SFUtils'.static.FormatFloat(m_fFootstepVolume) $ " AccuracyUpgrade: " $ class'SFUtils'.static.FormatFloat(m_fPenaltyUpgrade) $ " UnderwaterTime: " $ UnderWaterTime;
    	// Draw text and no CR
    	C.DrawText( strPlayerData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strPlayerData =  "   UseKeyRange: " $ SFGameInfo(Level.Game).nUseKeyRange;
    	// Draw text and no CR
    	C.DrawText( strPlayerData, true );
    	// Next line
    	fPosY += YL + 2;

    	return fPosY;
    }

    // Renders the current weapon data to the screen
    function float RenderWeaponData(canvas C, float fPosY)

    {
    	local string strWeaponData;
    	local float fPosX;

    	local float XL, YL;
    	local SFWeapon	oWeap;

    	// Cast to SFWeapon
    	oWeap = SFWeapon(Weapon);

    	if(None == oWeap)
    		return fPosY;

    	fPosX = 1;
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	// Draw title and do  no CR
    	C.DrawText( "SFWeapon:", false );
    	C.TextSize("SFWeapon:", XL, YL);
    	// Compose debug output
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strWeaponData =  "   Aimerror: " $ class'SFUtils'.static.FormatFloat(oWeap.AimError) $ " AccuracyPenalty: " $ class'SFUtils'.static.FormatFloat(oWeap.AccuracyPenalty) $ " RateOfFire: " $ class'SFUtils'.static.FormatFloat(oWeap.fDesiredRate) $ " SemiAuto: " $ oWeap.m_bSemiAuto $ " SemiAutoAlt: " $ oWeap.m_bSemiAutoAlt ; // Draw text and no CR
    	C.DrawText( strWeaponData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strWeaponData = "   ProjRange: " $ oWeap.nProjRange $ " ProjLifSpan: " $ oWeap.fProjLifeSpan $ " AltMode: " $ oWeap.m_bAltMode $ " ProjectileSpeed: " $ class'SFUtils'.static.FormatFloat(oWeap.ProjectileSpeed) $ " AltProjectileSpeed: " $ class'SFUtils'.static.FormatFloat(oWeap.AltProjectileSpeed) ;
    	C.DrawText( strWeaponData, true );
    	// Next line
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strWeaponData = "   State: " $ oWeap.GetStateName()  ;
    	C.DrawText( strWeaponData, true );

    	fPosY += YL + 2;
    	return fPosY;
    }

    // Renders the current inventory data to the screen
    function float RenderInventoryData(canvas C, float fPosY)
    {
    	local string strInvData;
    	local float fPosX;
    	local float XL, YL;
    	local SFDamageProtection	oItem;

    	// Cast to SFWeapon
    	oItem = m_oSmartVest;
    	if(None == oItem)
    		return fPosY;

    	fPosX = 1;
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	// Draw title and do  no CR
    	C.DrawText( "SFInventory:", false );
    	C.TextSize("SFInventory:", XL, YL);
    	// Compose debug output
    	fPosY += YL + 2;
    	C.SetPos( fPosX, fPosY );
    	strInvData =  "   SmartVest: HealthAmount: "  $ oItem.HealingAmount $ "("$ oItem.MaxHealing $ ") FireProtect: " $ class'SFUtils'.static.FormatFloat(oItem.m_fFireProtection) $ " ChemProtect: " $ class'SFUtils'.static.FormatFloat(oItem.m_fChemicalProtection) $ " ShotProtect: " $ class'SFUtils'.static.FormatFloat(oItem.m_fBallisticProtection) $ " RadioProtect: " $ class'SFUtils'.static.FormatFloat(oItem.m_fRadioactiveProtection) $ " MaxProtect: " $ class'SFUtils'.static.FormatFloat(oItem.m_fMaxProtection); // Draw text and no CR
    	C.DrawText( strInvData, true );
    }

    	simulated function ClimbStepping()
    {
    	PlaySound(ClimbStep, SLOT_Interact, 1, false, 1000.0, 1.0);
    }

    function RenderScreenEffect(canvas C)
    {
    	switch(m_screenEffect)
    	{
    	case EFFECT_LR_WIPE:
    		C.DrawTile( texture'BlackTexture', FMin(m_nXWipePos,C.ClipX), C.ClipY, 0, 0, 256, 256 );
    		break;
    	}
    }

    ////////////////////////
    // Events
    ////////////////////////
    event  Detach(Actor o)
    {
    	Super.Detach(o);
    }

    // Do some cleanup here
    event  Expired()
    {
    	local int i;

    	Super.Expired();

    	// Free some references

    }

    simulated event UnPossess()
    {
    	Super.UnPossess();
    	//class'SFUtils'.Static.sfLogEx(5, "SFPlayer - UnPossess :");

    }

    // Called when the actor is possesed
    simulated event Possess()
    {
    	local WindowConsole    C;

    	// Call to base class
    	Super.Possess();

    	C = WindowConsole(Player.Console);
    	if (C.Root == None)
    	{
    		// Create the root window on first impact
    		//class'SFUtils'.Static.sfLogEx(5, "SFPlayer Possess - C.Root == None - Creating Root");
    		C.CreateRootWindow(None);
    	}

    	if (Player != None	&& Player.Console != None  && UTConsole(Player.Console) != None
    		&& (UTConsole(Player.Console).Speechwindow == None	|| !UTConsole(Player.Console).Speechwindow.IsA('SFSpeechWindow')) )
    	{
    		// Create our own speech window
    		Root = WindowConsole(Player.Console).Root;

    		if (UTConsole(Player.Console).Speechwindow != None)
    		{
    			UTConsole(Player.Console).Speechwindow.Close();
    			UTConsole(Player.Console).Speechwindow.CancelAcceptsFocus();
    		}

    		UTConsole(Player.Console).Speechwindow = None;
    /*
    		UTConsole(Player.Console).Speechwindow = SpeechWindow(Root.CreateWindow(Class'SFSpeechWindow', 100, 100, 200, 200));
    		Song = None;
    		if (UTConsole(Player.Console).Speechwindow == None)
    		{
    			class'SFUtils'.Static.sfLogEx(5, "SFPlayer Possess - Failed to create speechwindow");
    			return;
    		}

    		UTConsole(Player.Console).SpeechWindow.bLeaveOnScreen = true;

    		if(UTConsole(Player.Console).bShowSpeech)
    		{
    			Root.SetMousePos(0, 132.0/768 * Root.WinWidth);
    			UTConsole(Player.Console).SpeechWindow.SlideInWindow();
    		}
    		else
    			UTConsole(Player.Console).SpeechWindow.HideWindow();
    */
    	}
    }

    // Saves the current input modifiers
    function SaveInput()
    {
    	m_bSavedDuck	= bDuck;
    	m_bSavedCreep	= m_bCreep;
    }

    // Restores the current input modifiers from the saved ones
    function RestoreInput()
    {
    	bDuck		= m_bSavedDuck;
    	m_bCreep	= m_bSavedCreep;
    }

    // Resets the current input
    function ResetInput()
    {
    	bDuck		= 0;
    	m_bCreep	= 0;
    }

    // Sets the input variables for the normal state: WALKING
    function SetNormalInput()
    {
    	bDuck			= 0;
    	m_bCreep		= 0;
    	m_bManualInput	= true;
    }

    // Sets the input variables for the crouch state: DUCK
    function SetCrouchInput()
    {
    	SaveInput();
    	bDuck			= 1;
    	m_bCreep		= 0;
    	m_bManualInput	= true;
    }

    // Sets the input variables for the creep state: CREEPING
    function SetCreepInput()
    {
    	SaveInput();
    	bDuck			= 0;
    	m_bCreep		= 1;
    	m_bManualInput	= true;
    }

    //Resets the manual modifications to the input state
    function ResetManualInput()
    {
    	// Early out
    	if(!m_bManualInput)
    		return;

    	ResetInput();

    	m_bManualInput	= false;
    }

    event PlayerInput( float DeltaTime )
    {
    	local bool bTryingToStandUp ;
    	// Call to base class
    	Super.PlayerInput(DeltaTime);

    	// Save the current starting state
    	StartingPlayerState = PlayerState;

    	if(m_bUseKey==1)
    	{
    		UseKeyTargetting();
    		// Reset key
    		m_bUseKey = 0;
    	}

    	// Cannot creep or crawl while carrying something
    	if(None != CarriedDecoration)
    	{
    		m_bCreep	= 0;

    		bDuck		= 0;
    	}

    	if(m_bCreep==1)
    	{
    		AdjustWeaponStuff(STATE_Creep);
    		AdjustCollisionStuff(STATE_Creep);
    	}
    	else if(bDuck==1)
    	{

    		// Try to go to duck state
    		if(!AdjustCollisionStuff(STATE_Crouch))
    		{
    			SetCreepInput();
    			AdjustCollisionStuff(STATE_Creep);
    		}
    	}
    	else
    	{
    		if(PlayerState != STATE_Normal)
    			bTryingToStandUp = true;

    		if(!AdjustCollisionStuff(STATE_Normal))
    		{
    			SetCrouchInput();
    			if(!AdjustCollisionStuff(STATE_Crouch))
    			{
    				SetCreepInput();
    				AdjustCollisionStuff(STATE_Creep);
    			}
    		}
    		else
    		{
    			if(bTryingToStandUp)
    			{
    				if(None != m_oCreepPendingWeapon)
    				{
    					Weapon=m_oCreepPendingWeapon;
    					m_oCreepPendingWeapon=None;
    					Weapon.BringUp();
    				}
    			}
    		}
    	}
    }

    event PostRender( canvas C )
    {
    	local texture tex;
    	local float fYPos;

    	fYPos = 1;
    	if(None != C)
    	{
    		if( m_screenEffect != EFFECT_NONE)
    			RenderScreenEffect(C);

    		PrepareCanvas(C);
    		if(bShowVersionInfo)
    			RenderVersionInfo(C);

    		if(bStatPlayer)
    		{
    			PrepareCanvasStat(C);
    			fYPos = RenderPlayerData(C, fYPos);
    		}
    		if(bStatWeapon)
    		{
    			PrepareCanvasStat(C);
    			fYPos = RenderWeaponData(C, fYPos);
    		}
    		if(bStatInventory)
    		{
    			PrepareCanvasStat(C);
    			fYPos = RenderInventoryData(C, fYPos);
    		}
    		RenderCreatureInfo(C, fYPos);

    		// Eventully do medstation readout
    		renderMedStationContact(C);
    	}

    	Super.PostRender(C);

    //	SizeX, SizeY
    }

    function renderMedStationContact(Canvas C)
    {
    	local float XL, YL;
    	local bool bFound;
    	local int X, Y;
    	local SFPlayer oPlayer;

    	// Check for current contact
    	if(None == m_actNearestMedStation)
    		return;

    	bFound = false;
    	foreach RadiusActors(class'SFPlayer', oPlayer, m_actNearestMedStation.RefillRadius+3, m_actNearestMedStation.Location)
    	{
    		if(oPlayer == Self)
    			bFound = true;
    	}

    	if(!bFound)
    		// Release contact
    		m_actNearestMedStation = None;

    	// Prepare canvas
    	C.Style = ERenderStyle.STY_Translucent;
    	C.Font	= SFHUD(myHud).m_Fonts.GetSmallFont(C.ClipX );
    	C.DrawColor.R = 210;

    	C.DrawColor.G = 80;
    	C.DrawColor.B = 30;

    	X = C.ClipX/3;
    	Y = C.ClipY/10;
    	C.StrLen("Med", XL, YL);
    	C.SetPos(X, Y);
    	C.DrawText("MedStation Link established ...");
    	Y += YL;
    	C.SetPos(X, Y);
    	if(m_actNearestMedStation.Broken)
    		C.DrawText("   Status: Not Functional.");
    	else
    		C.DrawText("   Status: Functional.");
    	Y += YL;
    	C.SetPos(X, Y);
    	C.DrawText("   Remaining Health: " $ m_actNearestMedStation.HealingAmount);
    	Y += 2*YL;
    	C.SetPos(X, Y);
    	C.DrawText("Current Health: " $ Health);
    	if(None != m_oSmartVest)
    	{
    		Y += YL;
    		C.SetPos(X, Y);
    		C.DrawText("Current Smart Vest Reservoir: " $ m_oSmartVest.HealingAmount);
    	}

    }

    // Called when the player wants to jump
    function DoJump( optional float F )
    {
    	if ((CarriedDecoration != None) && (CarriedDecoration.Mass > 20))
    		return;

    	// Only do jump when we are not creeping
    	if(!m_bIsCreeping)
    		Super.DoJump(F);
    	else
    		class'SFUtils'.Static.sfLogEx(5,"Jumping not possible when creeping");

    }

    /*
    With grab functionality
    function UseKeyTargetting()
    {
    	local vector lookDir, HitLocation, HitNormal, T1, T2, extent;
    	local actor HitActor;
    	local SFPickup			oPickUpObj;
    	local SFUseKeyTrigger	oTrigObj;
    	local SFMover			oMoverObj;

    	//first trace to find it
    	lookDir = vector(Rotation);
    	lookDir.Z = 0;
    	T1 = Location + BaseEyeHeight * vect(0,0,1) + lookDir * 0.8 * CollisionRadius;
    	T2 = T1 + lookDir * 1.2 * CollisionRadius;
    	HitActor = Trace(HitLocation, HitNormal, T2, T1, true);
    	if ( HitActor == None )
    	{
    log("Nothing found for the first trace");
    		T1 = T2 - (BaseEyeHeight + CollisionHeight - 2) * vect(0,0,1);
    		HitActor = Trace(HitLocation, HitNormal, T1, T2, true);
    	}
    	else if ( HitActor == Level )
    	{
    log("Level found for the first trace");

    		T2 = HitLocation - lookDir;
    		T1 = T2 - (BaseEyeHeight + CollisionHeight - 2) * vect(0,0,1);
    		HitActor = Trace(HitLocation, HitNormal, T1, T2, true);
    	}
    	if ( (HitActor == None) || (HitActor == Level) )
    	{
    log("Nothing or level found for the second trace: " $ HitActor.name);

    		extent.X = CollisionRadius;
    		extent.Y = CollisionRadius;
    		extent.Z = CollisionHeight;
    		HitActor = Trace(HitLocation, HitNormal, Location + lookDir * 1.2 * CollisionRadius, Location, true, extent);
    	}

    	// Check if something was found
    	if(None == HitActor)
    		return;
    log("Found HitActor: " $ HitActor.name);
    	// Check for UseKeyTrigger
    	if(HitActor.IsA('SFUseKeyTrigger'))
    	{
    		oTrigObj	= SFUseKeyTrigger(HitActor);
    		class'SFUtils'.Static.sfLogEx(12,"SFPlayer - UseKeyTargetting: Actor in range: " $ oTrigObj.name);
    		if(oTrigObj.IgnoreTouching)
    		{
    			class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found UseKeyTrigger, calling FireEvent");
        		oTrigObj.FireEvent(self);

    			return; // Do not continue
    		}
    	}

    	// Check for SFMover
    	if(HitActor.IsA('SFMover'))
    	{
    		oMoverObj	= SFMover(HitActor);
    		class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Actor in range: " $ oMoverObj.name);
    		if(oMoverObj.IgnoreBumping)
    		{
    			class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFMover, calling ManualBump");
    			if(oMoverObj.IsInState('TriggerToggle'))
    				oMoverObj.ManualTrigger(self);
    			else
        			oMoverObj.ManualBump(self);

    			return; // Do not continue
    		}
    	}

    	// Using TraceActors and a 10x10x10 cube for the extents
    	if(HitActor.IsA('SFPickup'))
    	{
    		oPickUpObj	= SFPickup(HitActor);
    		class'SFUtils'.Static.sfLogEx(12,"SFPlayer - UseKeyTargetting: Actor in range: " $ oPickUpObj.name);
    		if(oPickUpObj.bManualPickup)
    		{
    			class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFPickup, picking it  up.");
    			// Mark the pickup as "usekey accessed"
    			oPickupObj.bUseKeyHit = true;
    			// Pickup the object
    			oPickupObj.Touch(self);
    			// Reset the "usekey accessed" flag
    			oPickupObj.bUseKeyHit = false;

    			// Do not continue
    			return;
    		}
    	}
    }
    */
    /*
    My original

    //
    function UseKeyTargetting()
    {
    	local vector HitLoc, HitNorm, End, X, Y, Z, Start;
    	local actor Other ;
    	local rotator rotAdjustAim;
    	local rotator rotAiming;
    	local SFMover			oMoverObj;
    	local SFUseKeyTrigger	oTrigObj;
    	local SFPickup			oPickUpObj;

    	// Get vectors for where the player is aiming on each axis
    	GetAxes(ViewRotation, X, Y, Z);

    	// Calculate starting location
    	Start = Location + 0.5*EyeHeight * vect(0,0,1);
    	rotAiming = ViewRotation;

    	// Using an arbitrary range of 100 UUs
    	End = Start + (UseKeyRange *  vector(rotAiming));

    	class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargeting: Start: (" $ Start.x $ "/" $ Start.y $ "/" $ Start.z $") End: (" $ End.x $ "/" $ End.y $ "/" $ End.z $")" );

    	// Using TraceActors and a 10x10x10 cube for the extents
    	foreach TraceActors(class'SFUseKeyTrigger', oTrigObj, HitLoc, HitNorm, End, Start, ) //vect(10.0, 10.0, 10.0))
    	{
    		class'SFUtils'.Static.sfLogEx(12,"SFPlayer - UseKeyTargetting: Actor in range: " $ oTrigObj.name);
    		if(None != oTrigObj)
    		{
    			if(oTrigObj.IsA('SFUseKeyTrigger') && oTrigObj.IgnoreTouching)
    			{
    				class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found UseKeyTrigger, calling FireEvent");
        			oTrigObj.FireEvent(self);

    				return; // Do not continue
    			}

    		}
    	}

    	// Trace for movers
    	foreach TraceActors(class'SFMover', oMoverObj, HitLoc, HitNorm, End, Start , vect(10.0, 10.0, 10.0))
    	{
    		class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Actor in range: " $ oMoverObj.name);
    		if(None != oMoverObj)
    		{
    			if(oMoverObj.IsA('SFMover') && oMoverObj.IgnoreBumping)
    			{
    				class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFMover, calling ManualBump");
    				if(oMoverObj.IsInState('TriggerToggle'))
    					oMoverObj.ManualTrigger(self);
    				else
        				oMoverObj.ManualBump(self);

    				return; // Do not continue
    			}

    		}
    	}

    	// Using TraceActors and a 10x10x10 cube for the extents
    	foreach TraceActors(class'SFPickup', oPickUpObj, HitLoc, HitNorm, End, Start, ) //vect(10.0, 10.0, 10.0))

    	{
    		if(None != oPickUpObj)
    		{
    			class'SFUtils'.Static.sfLogEx(12,"SFPlayer - UseKeyTargetting: Actor in range: " $ oPickUpObj.name);
    			if(oPickUpObj.IsA('SFPickup'))
    			{
    				if(oPickUpObj.bManualPickup)

    				{
    					class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFPickup, picking it  up.");
    					// Mark the pickup as "usekey accessed"
    					oPickupObj.bUseKeyHit = true;
    					// Pickup the object
    					oPickupObj.Touch(self);
    					// Reset the "usekey accessed" flag
    					oPickupObj.bUseKeyHit = false;

    					// Do not continue
    					return;
    				}
    			}
    		}
    	}
    }
    */

    // Retrieves the angle between the two given vectors in radians
    function float getAngle(vector vecFirst, vector vecSecond)
    {
    	return Normal(vecFirst) dot Normal(vecSecond);
    }

    // Brings up an invisible gun
    function raiseNullGun()
    {
    	local Weapon	oNullGun;

    	oNullGun = Weapon(FindInventoryType(class'SFNullGun'));
    	if(None == oNullGun)
    		// Spawn the null gun
    		PendingWeapon = spawn(class'SFNullGun', Owner);
    	else
    		PendingWeapon = oNullGun;

    	if(None != Weapon)
    	{
    		m_oNullWeaponRestore	= Weapon;
    		Weapon.PutDown();
    	}
    }

    function putDownNullGun()
    {
    	local Weapon	oNullGun;

    	if(None != m_oNullWeaponRestore)
    	{
    		PendingWeapon			= m_oNullWeaponRestore;
    		m_oNullWeaponRestore	= None;
    		ChangedWeapon();
    	}

    	oNullGun = Weapon(FindInventoryType(class'SFNullGun'));
    	if(None != oNullGun)
    		oNullGun.Destroy();
    }

    // SF modifications to grab behaviour
    function GrabDecoration()
    {
    	local vector lookDir, HitLocation, HitNormal, T1, T2, extent;
    	local actor HitActor;

    	// Cannot pickup while creeping
    	if(m_bIsCreeping || bIsCrouching)
    		return;

    	if ( carriedDecoration == None )
    	{
    		//first trace to find it
    		lookDir = vector(Rotation);
    		lookDir.Z = 0;
    		T1 = Location + BaseEyeHeight * vect(0,0,1) + lookDir * 0.8 * CollisionRadius;
    		T2 = T1 + lookDir * 1.2 * CollisionRadius;
    		HitActor = Trace(HitLocation, HitNormal, T2, T1, true);
    		if ( HitActor == None )

    		{

    			T1 = T2 - (BaseEyeHeight + CollisionHeight - 2) * vect(0,0,1);
    			HitActor = Trace(HitLocation, HitNormal, T1, T2, true);
    		}
    		else if ( HitActor == Level )
    		{
    			T2 = HitLocation - lookDir;
    			T1 = T2 - (BaseEyeHeight + CollisionHeight - 2) * vect(0,0,1);
    			HitActor = Trace(HitLocation, HitNormal, T1, T2, true);
    		}
    		if ( (HitActor == None) || (HitActor == Level) )
    		{
    			extent.X = CollisionRadius;
    			extent.Y = CollisionRadius;
    			extent.Z = CollisionHeight;
    			HitActor = Trace(HitLocation, HitNormal, Location + lookDir * 1.2 * CollisionRadius, Location, true, extent);
    		}

    		if (Decoration(HitActor) != None )
    //		if ( (Decoration(HitActor) != None)  && ((weapon == None) || (weapon.Mass < 20)) )
    		{

    			CarriedDecoration = Decoration(HitActor);
    			if ( !CarriedDecoration.bPushable || (CarriedDecoration.Mass > 45)
    				|| (CarriedDecoration.StandingCount > 0) )
    			{
    				CarriedDecoration = None;
    				return;
    			}
    			lookDir.Z = 0;
    			raiseNullGun();
    			if ( CarriedDecoration.SetLocation(Location + (0.5 * CollisionRadius + CarriedDecoration.CollisionRadius) * lookDir) )
    			{
    				CarriedDecoration.SetPhysics(PHYS_None);
    				CarriedDecoration.SetBase(self);
    				CarriedDecoration.SetCollision(False, False, False);
    				CarriedDecoration.bCollideWorld = False;
    				CarriedDecoration.Style = STY_Translucent;
    				CarriedDecoration.ScaleGlow = 1.0;
    				CarriedDecoration.bUnlit = True;
    			}
    			else
    			{
    				putDownNullGun();
    				ClientMessage("Cannot lift item.");
    				CarriedDecoration = None;
    			}
    		}
    	}
    }

    function SlipDecoration()
    {
    	if (CarriedDecoration != None)
    	{

    		CarriedDecoration.bWasCarried = true;
    		CarriedDecoration.SetCollision(True, True, True);
    		CarriedDecoration.bCollideWorld = True;
    		CarriedDecoration.SetBase(None);
    		CarriedDecoration.SetPhysics(PHYS_Falling);
    		CarriedDecoration.Velocity = Velocity + 10 * VRand();
    		CarriedDecoration.Instigator = self;
    		// Restore display
    		CarriedDecoration.Style = CarriedDecoration.Default.Style;
    		CarriedDecoration.ScaleGlow = CarriedDecoration.Default.ScaleGlow;
    		CarriedDecoration.bUnlit = CarriedDecoration.Default.bUnlit;

    		CarriedDecoration = None;

    		putDownNullGun();
    	}

    }

    function DropDecoration()
    {
    	local Vector X, Y, Z, dropVect, origLoc, HitLocation, HitNormal, extent;
    	local float velscale, size, mult;
    	local bool bSuccess;
    	local Actor hitActor;

    	bSuccess = False;

    	if (CarriedDecoration != None)
    	{
    		// Check for not throwabel decoration
    		if(CarriedDecoration.IsA('SFDecoration'))
    		{
    			if(!SFDecoration(CarriedDecoration).bThrowable)
    			{
    				SlipDecoration();
    				return;
    			}
    		}

    		origLoc = CarriedDecoration.Location;
    		GetAxes(Rotation, X, Y, Z);

    		// Compute throw velocity
    		CarriedDecoration.Velocity = Vector(ViewRotation) * 500 + vect(0,0,220) + 40 * VRand();
    		// Scale it based on the mass
    		velscale = FClamp(CarriedDecoration.Mass / 20.0, 1.0, 40.0);
    		CarriedDecoration.Velocity /= velscale;

    		// Calculate impcat location
    		dropVect = Location + (CarriedDecoration.CollisionRadius + CollisionRadius + 4) * X;
    		dropVect.Z += BaseEyeHeight;

    		// Is anything blocking the drop point? (like thin doors)
    		if (FastTrace(dropVect))
    		{
    			CarriedDecoration.SetCollision(True, True, True);
    			CarriedDecoration.bCollideWorld = True;

    			// Check to see if there's space there
    			extent.X = CarriedDecoration.CollisionRadius;
    			extent.Y = CarriedDecoration.CollisionRadius;
    			extent.Z = 1;
    			hitActor = Trace(HitLocation, HitNormal, dropVect, CarriedDecoration.Location, True, extent);

    			if ((hitActor == None) && CarriedDecoration.SetLocation(dropVect))
    				bSuccess = True;
    			else
    			{
    				CarriedDecoration.SetCollision(False, False, False);
    				CarriedDecoration.bCollideWorld = False;
    			}
    		}

    		// Drop item and restore the view settings
    		if (bSuccess)
    		{
    			CarriedDecoration.bWasCarried = True;
    			CarriedDecoration.SetBase(None);
    			CarriedDecoration.SetPhysics(PHYS_Falling);
    			CarriedDecoration.Instigator = Self;

    			// Turn off translucency
    			CarriedDecoration.Style = CarriedDecoration.Default.Style;

    			CarriedDecoration.bUnlit = CarriedDecoration.Default.bUnlit;
    			CarriedDecoration = None;

    			putDownNullGun();
    		}
    		else
    		{
    			// otherwise, don't drop it and display a message
    			CarriedDecoration.SetLocation(origLoc);
    			ClientMessage("Cannot drop here.");
    		}
    	}

    }

    function UseKeyTargetting()
    {
    	local vector X, Y, Z, Start;
    	local vector XTrig, YTrig, ZTrig, XMov, YMov, ZMov;
    	local vector XProj;
    	local vector			vecActorDir;
    	local vector			vecEye;
    	local vector			vecPawnDir;
    	local float				fAngle, fAngle2;
    	local SFMover			oMoverObj;
    	local SFUseKeyTrigger	oTrigObj;
    	local SFPickup			oPickUpObj;
    	local float				fAngleLimit;
    	local float				fTreshold;
    	local bool				bHoldingUseWeapon;
    	local bool				bHasLineOfSight;
    	local bool				bFireEvent;
    	local int				UseKeyRange;

    	// Some inits
    	fAngleLimit			= 0.9f;
    	bHoldingUseWeapon	= false;
    	UseKeyRange			= SFGameInfo(Level.Game).nUseKeyRange;

    	// Get vectors for where the player is aiming on each axis
    	GetAxes(ViewRotation, X, Y, Z);

    	vecEye	= Location + EyeHeight * vect(0,0,1);
    	Start	= Location ;//+ EyeHeight * vect(0,0,1) + vecAiming*0.8*CollisionRadius;

    	//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargeting: Start: (" $ Start.x $ "/" $ Start.y $ "/" $ Start.z $")" );

    	// Check, if we are currently holding an item
    	if(None != CarriedDecoration)
    	{
    		DropDecoration();
    		return;
    	}

    	// First check for a grab operation
    	GrabDecoration();
    	if(None != CarriedDecoration)
    		return;

    	// Check for prybar
    	if(None != Weapon)
    	{
    		if(Weapon.IsA('SFWeapon'))
    		{
    			bHoldingUseWeapon = true;
    		}
    	}

    	// Trace for UseKeys
    /*
    	foreach RadiusActors(class'SFUseKeyTrigger', oTrigObj, float(UseKeyRange), Start) //vect(10.0, 10.0, 10.0))
    	{
    		//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: UseKeyTrace - Actor in range: " $ oTrigObj.name);
    		if(None != oTrigObj)
    		{
    			if(oTrigObj.IsA('SFUseKeyTrigger'))

    			{

    				fAngle	= getAngle(X, oTrigObj.Location-vecEye);
    				if(oTrigObj.IgnoreTouching && (fAngle > fAngleLimit))
    				{
    					class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found UseKeyTrigger, calling FireEvent");
    					oTrigObj.FireEvent(self);

    					if((bHoldingUseWeapon) && (oTrigObj.IsA('SFInteractTrigger')))
    					{
    						if(SFInteractTrigger(oTrigObj).NeededItem == Weapon.class)
    							SFWeapon(Weapon).PlayUseKeyHit();
    					}

    					return; // Do not continue
    				}
    			}
    		}
    	}
    */
    	// Replacement code from SFHUD (drawUseKeyHint

    	bFireEvent	= false;
    	foreach RadiusActors(class'SFUseKeyTrigger', oTrigObj, float(UseKeyRange), Start)
    	{
    		if(None != oTrigObj)
    		{
    			if(oTrigObj.IsA('SFUseKeyTrigger'))
    			{
    				if(oTrigObj.IgnoreTouching && !oTrigObj.m_bTriggerNoMore /*&& ( bHasLineOfSight || oTrigObj.bDirectional)*/)
    				{
    					// LineOfSight check
    					if(oTrigObj.bNeedsLineOfSight)
    						bHasLineOfSight	= LineOfSightTo(oTrigObj);
    					else
    						bHasLineOfSight	=	true;

    					bFireEvent = bHasLineOfSight;
    /*
    Removed, because the FOV check is no longer wanted
    					vecActorDir	= oTrigObj.Location-Location;
    					fAngle		= getAngle(X, oTrigObj.Location-Location);

    					fTreshold	= (1.0f- ((UseKeyRange - VSize(vecActorDir)+oTrigObj.CollisionRadius)/UseKeyRange)) *0.7f;

    					if(fAngle >= fTreshold)
    					{
    						// Actor is infront of player, now check if player is in front of actor

    						if(!oTrigObj.bDirectional && bHasLineOfSight)
    							bFireEvent=true;
    						else
    						{
    							// Check direction of trigger

    							// Calc the direction and angle to the trigger
    							oTrigObj.GetAxes(oTrigObj.Rotation, XTrig,YTrig,ZTrig);
    							vecPawnDir	= Location-oTrigObj.Location;
    							fAngle		= getAngle(XTrig, vecPawnDir);

    							if(fAngle > 0.8f)
    								bFireEvent = true;
    						}
    					}
    */
    					if(bFireEvent)
    					{
    						class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found UseKeyTrigger, calling FireEvent");
    						oTrigObj.FireEvent(self);

    						if((bHoldingUseWeapon) && (oTrigObj.IsA('SFInteractTrigger')))
    						{
    							if(SFInteractTrigger(oTrigObj).NeededItem == Weapon.class)
    								SFWeapon(Weapon).PlayUseKeyHit();
    						}

    						return; // Do not continue
    					}
    				}
    			}
    		}
    	}

    	// Trace for movers
    /*
    	foreach RadiusActors(class'SFMover', oMoverObj, float(UseKeyRange), Start)
    	{
    		//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: SFMoverTargetting - Actor in range: " $ oMoverObj.name);
    		if(None != oMoverObj)
    		{
    			if(oMoverObj.IsA('SFMover'))
    			{
    				fAngle	= getAngle(X, oMoverObj.Location+oMoverObj.CenterOffset-vecEye);
    				// class'SFUtils'.static.sfLogEx(5,"fAngle: " $ fAngle $ " Location: " $ oMoverObj.Location $ " RealPosition " $ oMoverObj.RealPosition);
    				if(oMoverObj.IgnoreBumping && (fAngle > fAngleLimit))
    				{
    					//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFMover, calling ManualBump");
    					if(oMoverObj.IsInState('TriggerToggle'))
    						oMoverObj.ManualTrigger(self);
    					else
        					oMoverObj.ManualBump(self);

    					return; // Do not continue
    				}
    			}
    		}
    	}
    */
    	// Replacement code from SFHUD (drawUseKeyHint
    	// Trace for movers
    	foreach RadiusActors(class'SFMover', oMoverObj, float(UseKeyRange), Start)
    	{
    		//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: SFMoverTargetting - Actor in range: " $ oMoverObj.name);
    		if(None != oMoverObj)
    		{
    			if(oMoverObj.IsA('SFMover'))
    			{
    				XProj			= X;
    				XProj.Z			= 0.0f;
    				vecActorDir		= oMoverObj.Location+oMoverObj.CenterOffset-Location;
    				vecActorDir.Z	= 0.0f;

    				// class'SFUtils'.static.sfLogEx(5,"fAngle: " $ fAngle $ " Location: " $ oMoverObj.Location $ " RealPosition " $ oMoverObj.RealPosition);
    				if(oMoverObj.IgnoreBumping || oMoverObj.IgnoreTrigger)
    				{

    					bFireEvent	= true;
    /*
    Removed, because FOV test is no longer wanted.

    					fAngle	= getAngle(XProj, vecActorDir);

    					// Is infront?
    					fTreshold	= (1.0f- ((UseKeyRange - VSize(vecActorDir)+oMoverObj.CollisionRadius)/UseKeyRange)) *0.7f;

    					if(fAngle > fTreshold)
    					{
    						if(!oMoverObj.bDirectional)
    							bFireEvent	= true;
    						else
    						{
    							// Actor is infront of player, now check if player is in front of actor
    							// Check direction of trigger

    							// Calc the direction and angle to the trigger
    							oMoverObj.GetAxes(oMoverObj.Rotation, XMov,YMov,ZMov);
    							XProj			= XMov;
    							XProj.Z			= 0.0f;
    							vecPawnDir		= Location-oMoverObj.Location;
    							vecPawnDir.Z	= 0.0f;

    							fAngle			= getAngle(XProj, vecPawnDir);
    							fTreshold		= (1.0f- ((UseKeyRange - VSize(vecActorDir)+oMoverObj.CollisionRadius)/UseKeyRange)) *0.7f;

    							if(fAngle > fTreshold)
    								bFireEvent=true;
    						}
    					}
    */
    					if(bFireEvent)
    					{
    						//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFMover, calling ManualBump");
    						if(oMoverObj.IsInState('TriggerToggle'))
    							oMoverObj.ManualTrigger(self);
    						else
        						oMoverObj.ManualBump(self);

    						return; // Do not continue
    					}
    				}
    			}
    		}
    	}

    	// Using TraceActors and a 10x10x10 cube for the extents
    	foreach RadiusActors(class'SFPickup', oPickUpObj, float(UseKeyRange), Start)
    	{
    		if(None != oPickUpObj)
    		{
    			//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: SFPickupTargetting - Actor in range: " $ oPickUpObj.name);
    			if(oPickUpObj.IsA('SFPickup'))
    			{
    				if(oPickUpObj.bManualPickup)
    				{
    //					fAngle	= getAngle(X, oPickUpObj.Location-vecEye);
    //					if(fAngle > fAngleLimit)
    //					{
    					bHasLineOfSight	= LineOfSightTo(oPickUpObj);
    					if(bHasLineOfSight)
    					{
    						//class'SFUtils'.Static.sfLogEx(4,"SFPlayer - UseKeyTargetting: Found SFPickup, picking it  up.");
    						// Mark the pickup as "usekey accessed"
    						oPickupObj.bUseKeyHit = true;
    						// Pickup the object
    						oPickupObj.Touch(self);
    						// Reset the "usekey accessed" flag
    						oPickupObj.bUseKeyHit = false;
    					}

    					// Do not continue
    					return;
    				}
    			}
    		}
    	}

    }

    // Checks if the room above an actor is unoccupied for a stand up
    function bool CheckStandUp(float fDiff)
    {

    	local bool	bRet;
    	local Actor oActor;
    	local vector vecHeadPos;
    	local vector vecNewPos;
    	local vector vecHitNormal;
    	local vector vecHitLoc;
    	local vector vecExtent;

    	// Some inits
    	bRet		= true;
    	vecExtent.x	= (2.0*CollisionRadius);
    	vecExtent.y	= (2.0*CollisionRadius);
    	vecExtent.z	= 0.0f;//(2.0*CollisionRadius);

    	// Calculate current head pos
    	vecHeadPos		= Location;
    	vecNewPos		= vecHeadPos;
    	vecNewPos.z		+= fDiff +2.0*CollisionRadius;

    	// Using TraceActors and a CollisionRadiusXStandCreepDifference cube for the extents
    	foreach TraceActors(class'Actor', oActor, vecHitLoc , vecHitNormal , vecNewPos, vecHeadPos, vecExtent)
    	{
    		// Just mark collision
    		bRet=false;
    	}

    	return bRet;
    }

    // Checks wheather a movement penalty has to be added or removed for
    // the current player state
    function bool CheckPenalty(bool bMoveState,  bool bPenaltyAdded, float fPenalty, string strPenaltyName)
    {
    	local SFWeapon oSFWeapon;

    	// Early outs
    	if(None == Weapon)
    		return false;
    	if(!Weapon.IsA('SFWeapon'))
    		return false;

    	if((bMoveState) && !bPenaltyAdded)
    	{
    		// Add penalty
    		// class'SFUtils'.Static.sflogEx(5, "SFPlayer - CheckPenalty: Adding " $ strPenaltyName $ " penalty");
    		bPenaltyAdded=true;
    		oSFWeapon = SFWeapon(Weapon);
    		if(none != oSFWeapon)
    			oSFWeapon.AccuracyPenalty += fPenalty;
    		// Log modification for ChangeWeapon event
    		oModifiedWeapon		= oSFWeapon;
    		fPenaltyModifier	+= fPenalty;
    		nPenaltyCount		+= 1;
    	}
    	if(!bMoveState && bPenaltyAdded)
    	{
    		// Remove  penalty
    		// class'SFUtils'.Static.sflogEx(5, "SFPlayer - CheckPenalty: Removing " $ strPenaltyName $ " penalty");
    		oSFWeapon = SFWeapon(Weapon);
    		if(none != oSFWeapon)
    			oSFWeapon.AccuracyPenalty -= fPenalty;
    		// Log modification for ChangeWeapon event
    		oModifiedWeapon		= oSFWeapon;
    		fPenaltyModifier	-= fPenalty;
    		nPenaltyCount		-= 1;
    		if( 0 == nPenaltyCount)
    		{
    			// Reset stat
    			oModifiedWeapon.AccuracyPenalty	= 0.0; // Account for FP errors here
    			oModifiedWeapon			= none;
    			fPenaltyModifier		= 0.0;
    		}

    		bPenaltyAdded=false;
    	}

    	return bPenaltyAdded;
    }

    // Determines, if we are still alive,
    // Used from client, to control their action depending on
    // their owners state.
    function bool isAlive()
    {
    	if(IsInState('Dying') && bHidden )
    		return false;

    	return true;
    }

    function addNewCommunication(SFCommunication oComm)
    {
    	local SFCommDetail	oNew, oPos;
    	local int			i;

    	// Check, if this communication has to be added to the history
    	if(!oComm.bAddToConversationHistory)
    		return;

    	oNew = spawn(class'SFCommDetail');

    	if(None == m_listCommunications)
    	{
    		// Add to front
    		oNew.m_oNext			= m_listCommunications;
    		oNew.m_oNext			= None;
    		m_listCommunications	= oNew;
    	}
    	else
    	{
    		// Add to end
    		oPos	= m_listCommunications;
    		// Find end
    		while(None != oPos.m_oNext)
    			oPos = oPos.m_oNext;
    		// Add
    		oPos.m_oNext	= oNew;
    		oNew.m_oNext	= None;
    	}

    	// Copy data
    	oNew.m_strTitle			= oComm.Title;
    	for(i=0; i<25; i++)
    		oNew.m_strDetailText[i]	= oComm.DetailText[i];
    	// Set dynamic data
    	switch(oComm.Type)
    	{
    		case CT_Captain:
    			oNew.m_strType = "Captain";
    			break;
    		case CT_DataNode:
    			oNew.m_strType = "Data Node";
    			break;
    		case CT_Trainer:
    			oNew.m_strType = "Trainer";
    			break;
    		case CT_NPC:
    			oNew.m_strType = "Normal";
    			break;
    		default:
    			oNew.m_strType = "Unknown";
    	}
    	oNew.m_strReceived = Level.Hour $ ":" $ Level.Minute $ ":" $ Level.Second $ " " $  " " $ Level.Year + 254 $ "/" $ Level.Month $ "/" $ Level.Day;

    }

    // Called by the communication actor to start a communication
    function playCommunication(SFCommunication oComm)
    {
    	// Early out
    	if(None == oComm)
    		return;

    	// Tell Hud class to playback the communication
    	SFHUD(myHUD).playCommunicationDirect(oComm);

    }

    // Called by the communication actor to start a communication
    function addCommunication(SFCommunication oComm)
    {

    	local SFHUD	oHUD;

    	// Early out
    	if(None == oComm)
    		return;

    	// Tell Hud class to playback the communication
    	oHUD	= SFHUD(myHUD);
    	if(None != oHUD)
    		oHUD.queueCommunication(oComm);
    	else
    		m_oScoutBotComm	= oComm;
    }

    // Adds/Removes accuracy penalty on the current weapon
    function AdjustAccuracy()
    {
    	// First check jump state
    	bJumpPenaltyAdded = CheckPenalty(m_bIsJumping, bJumpPenaltyAdded, JumpAccuracyPenalty*m_fPenaltyUpgrade, "jump");
    	// Second check run state
    	bRunPenaltyAdded = CheckPenalty((m_bIsRunning && !m_bIsCreeping), bRunPenaltyAdded, RunAccuracyPenalty*m_fPenaltyUpgrade, "run");
    	// Thied check strafe state
    	bStrafePenaltyAdded = CheckPenalty(m_bIsStrafing, bStrafePenaltyAdded, StrafeAccuracyPenalty*m_fPenaltyUpgrade, "strafe");
    }

    // Removes all currently added penalties
    function resetPenalties()
    {
    	// First check jump state
    	bJumpPenaltyAdded = CheckPenalty(false, bJumpPenaltyAdded, JumpAccuracyPenalty*m_fPenaltyUpgrade, "jump");
    	// Second check run state
    	bRunPenaltyAdded = CheckPenalty((false && !m_bIsCreeping), bRunPenaltyAdded, RunAccuracyPenalty*m_fPenaltyUpgrade, "run");
    	// Thied check strafe state
    	bStrafePenaltyAdded = CheckPenalty(false, bStrafePenaltyAdded, StrafeAccuracyPenalty*m_fPenaltyUpgrade, "strafe");

    }

    // Track change of weapon
    function ChangedWeapon()
    {
    	local Weapon	OldWeapon;
    	local Weapon	oNullGun;

    	if(	None != m_oCreepPendingWeapon && PlayerState == STATE_Creep)
    	{
    		PendingWeapon = m_oCreepPendingWeapon;
    		m_oCreepPendingWeapon = None;
    	}

    	// Call to base class
    	Super.ChangedWeapon();

    	// When changed weapon because of creep mode, remove weapon
    	if((PlayerState == STATE_Creep) || m_bDreamMode)
    	{
    		m_oCreepPendingWeapon = Weapon;
    		Weapon = None;
    	}

    	//class'SFUtils'.Static.sfLogEx(5, "SFPlayer - ChandedWeapon:");

    	// Remove penalty on old one
    	if(none != oModifiedWeapon)
    	{
    		// Remove penalty from old one
    		oModifiedWeapon.AccuracyPenalty = 0.0;
    	}
    	if((none != Weapon) && (Weapon.IsA('SFWeapon')))

    	{
    		// Track new weapon
    		oModifiedWeapon		= SFWeapon(Weapon);
    		// Add penalty on new one
    		oModifiedWeapon.AccuracyPenalty	+= fPenaltyModifier;
    		// Keep all penalty counters
    	}
    	else
    	{
    		// Reset counters
    		fPenaltyModifier	= 0.0;
    		nPenaltyCount		= 0;
    		oModifiedWeapon		= none;
    	}

    	// Destroy the NullGun in case we are using a full weapon
    	if(!Weapon.IsA('SFNullGun'))
    	{
    		oNullGun = Weapon(FindInventoryType(class'SFNullGun'));
    		if(None != oNullGun)
    			oNullGun.Destroy();

    	}
    }

    // Another actor as done a set owner
    event GainedChild( Actor Other )
    {
    	// class'SFUtils'.Static.sfLogEx(6,"SFPlayer - GainedChild: Checking zoneinfo and physic for swimming");

    	// Call to base class
    	Super.GainedChild(Other);

    	// Check for spawn in waterzone
    	if ( Region.Zone.bWaterZone && (PlayerRestartState == 'PlayerWalking') )
    	{
    		// Adjust physics
    		setPhysics(PHYS_Swimming);
    		GotoState('PlayerSwimming');
    	}
    }

    // Called every time the timer is fired
    event Timer()
    {
    	Super.Timer();
    	// Remove Version display
    	bShowVersionInfo = false;

    }

    event Bump( Actor Other )
    {
    	//class'SFUtils'.Static.sfLogEx(5, "SFPlayer - Bump:  " $ Other.name);
    	// Call to base class
    	Super.Bump(Other);
    }

    event HitWall( vector HitNormal, actor HitWall )
    {
    	//class'SFUtils'.Static.sfLogEx(5, "SFPlayer - HitWall:  " $ HitWall.name $ " (" $ class'SFUtils'.static.FormatFloat(HitNormal.x) $ "/" $ class'SFUtils'.static.FormatFloat(HitNormal.y) $ "/"  $ class'SFUtils'.static.FormatFloat(HitNormal.z) $ ")");
    	// Call to base class
    	Super.HitWall(HitNormal, HitWall);
    }

    event BeginPlay()
    {
    	local int i;

    	Super.BeginPlay();

    	// log the version
    	log("Running Spatial Fear V." $ strSFVersion);

    	// Development stuff
    	//class'SFUtils'.Static.sfLogEx(5, "SFPlayer - BeginPlay: !!!! : ?? " $ PlayerReplicationInfo.playername);
    	if(PlayerReplicationInfo.playername == "McLaud")
    	{
    		class'SFUtils'.Static.sfLogEx(5, "SFPlayer - BeginPlay: Setting values for " $ PlayerReplicationInfo.playername);
    		ConsoleCommand("SFLogLevel 12");
    		ConsoleCommand("SFStat all");
    	}

    	// Show version number
    	bShowVersionInfo = false;

    }

    event Attach(Actor Other)
    {
    	Super.Attach(Other);
    	// class'SFUtils'.Static.sfLogEx(5, "SFPlayer - Attach:");
    }

    event Spawned()
    {
    	Super.Spawned();
    	// class'SFUtils'.Static.sfLogEx(5, "SFPlayer - Spawned:");
    }

    event PreBeginPlay()
    {
    	Super.PreBeginPlay();
    	// class'SFUtils'.Static.sfLogEx(5, "SFPlayer - PreBeginPlay:");
    }

    event PostBeginPlay()
    {
    	local int i;

    	//class'SFUtils'.Static.sfLogEx(5, "SFPlayer - PostBeginPlay:");

    	// Call to base class
    	Super.PostBeginPlay();

    	// set some defaults
    	m_bIsJumping	= false;
    	m_bIsRunning	= true;
    	m_bIsStrafing	= false;
    	m_bLoadDialogOpened	=false;
    	bJumpPenaltyAdded	= false;
    	bRunPenaltyAdded	= false;
    	bStrafePenaltyAdded	= false;
    	oModifiedWeapon=None;

    	// Save original values
        m_fGroundSpeedOrg	= GroundSpeed;
    	m_fAirSpeedOrg		= AirSpeed;
    	m_fWaterSpeedOrg	= WaterSpeed;
        m_fAccelRate		= AccelRate;
    	m_nSafeFallDamage	= SafeFall_Damage;
    	m_nSafeFallKill		= SafeFall_Kill;

    	// Precalulations
        fDiffStandCrouch	= CollisionHeight-CollisionHeightCrouch;
    	fDiffCrouchCreep	= CollisionHeightCrouch-CollisionHeightCreep;
        fDiffStandCreep		= CollisionHeight-CollisionHeightCreep;
    	m_fInitialPrePivotZ	= PrePivot.Z;

    	// Setup timer to show version info
    	SetTimer(nShowVersionTime, false);

    	// Adjust player speed
    	//class'SFUtils'.Static.sfLogEx(5, "Adjusting player speed to: " $ string(Default.NormalSpeed));
    	SFPlayerSpeed(Default.NormalSpeed);

    	// Use our own shadow
    	if ( Level.NetMode != NM_DedicatedServer )
    	{
    		Shadow = None; // Release the old reference
    		Shadow = Spawn(class'SFPlayerShadow',self);
    	}

    }

    // Check all goaltable bound actors with creation tag
    // If they are bound to a not achieved goal they will be destroyed.
    function checkActorCreations()
    {
    	local SFPickup	oPickup;
    	local SFHealth	oHealth;
    	local SFWeapon	oWeapon;
    	local SFTrigger	oTrigger;
    	local SFCounter	oCounter;

    	// Check pickups

    	foreach AllActors( class'SFPickup', oPickup )
    	{
    		if(oPickup.IsA('SFPickup'))
    			// Find all matching pickups for this tag
    			if(!m_oGoals.reachedGoal(oPickup.CreateTag))
    				// Destroy the pickup
    				oPickup.Destroy();
    	}
    	// Check pickups
    	foreach AllActors( class'SFHealth', oHealth )
    	{
    		if(oHealth.IsA('SFHealth'))
    			// Find all matching health for this tag
    			if(!m_oGoals.reachedGoal(oHealth.CreateTag))
    				// Destroy the pickup
    				oHealth.Destroy();
    	}
    	// Check weapons
    	foreach AllActors( class'SFWeapon', oWeapon )
    	{
    		if(oWeapon.IsA('SFWeapon'))
    			// Find all matching weapons for this tag
    			if(!m_oGoals.reachedGoal(oWeapon.CreateTag))
    				// Destroy the pickup
    				oWeapon.Destroy();
    	}
    	// Check triggers
    	foreach AllActors( class'SFTrigger', oTrigger )
    	{
    		if(oTrigger.IsA('SFTrigger'))
    			// Find all matching weapons for this tag
    			if(!m_oGoals.reachedGoal(oTrigger.CreateTag))
    				// Destroy the pickup
    				oTrigger.Destroy();
    	}
    	// Check counters
    	foreach AllActors( class'SFCounter', oCounter )
    	{
    		if(oCounter.IsA('SFCounter'))
    			// Find all matching weapons for this tag
    			if(!m_oGoals.reachedGoal(oCounter.CreateTag))
    				// Destroy the pickup
    				oCounter.Destroy();
    	}
    }

    // FIXME
    exec function SFCheckInv()
    {
    	local Inventory Inv;

    	class'SFUtils'.static.sfLogEx(1, "SFPlayer - SFCheckInv: Checking inventory");
    	for ( Inv=Inventory; Inv!=None; Inv=Inv.Inventory )
    	{
    		class'SFUtils'.Static.sfLogEx(1,"SFPlayer - SFCheckInv: Inv: " $ Inv.name );
    	}
    }

    event TravelPostAccept()
    {
    	local Inventory Inv;

    	Super.TravelPostAccept();

    	// Do an autosave
    	//autoSaveGame();

    	checkActorCreations();
    /*
    	class'SFUtils'.Static.sfLogEx(5,"SFPlayer - TravelPostAccept: Starting ActiveItemBelt population.");
    	SFHUD(myHUD).populateActiveItemBelt();
    	class'SFUtils'.Static.sfLogEx(5,"SFPlayer - TravelPostAccept: Finished ActiveItemBelt population.");
    */

    }

    //////////////////////////////
    /// States
    //////////////////////////////

    // Overwrite of PlayerWalking state
    state PlayerWalking
    {
    	exec function FeignDeath()
    	{
    		// Not supported in SF
    	}

    	function ServerFeignDeath()
    	{
    		// Not supported in SF
    	}

    	// overwrite of AnimEnd function, used to add animation for creeping
    	function AnimEnd()
    	{
    		local name MyAnimGroup;

    		bAnimTransition = false;
    		if (Physics == PHYS_Walking)
    		{
    			if(m_bIsCreeping)
    			{
    				if ( !bIsTurning && ((Velocity.X * Velocity.X + Velocity.Y * Velocity.Y) < 1000) )
    				{
    					PlayKneel();
    				}
    				else
    				{
    					PlayCreeping();
    				}

    			} else if (bIsCrouching)
    			{
    				if ( !bIsTurning && ((Velocity.X * Velocity.X + Velocity.Y * Velocity.Y) < 1000) )
    				{
    					PlayDuck();
    				}
    				else
    				{
    					PlayCrawling();
    				}
    			}
    			else
    			{
    				MyAnimGroup = GetAnimGroup(AnimSequence);
    				if ((Velocity.X * Velocity.X + Velocity.Y * Velocity.Y) < 1000)
    				{
    					if ( MyAnimGroup == 'Waiting' )
    					{
    						PlayWaiting();
    					}
    					else
    					{
    						bAnimTransition = true;
    						TweenToWaiting(0.2);
    					}
    				}
    				else if (bIsWalking)
    				{
    					if ( (MyAnimGroup == 'Waiting') || (MyAnimGroup == 'Landing') || (MyAnimGroup == 'Gesture') || (MyAnimGroup == 'TakeHit')  )
    					{
    						TweenToWalking(0.1);
    						bAnimTransition = true;
    					}
    					else
    						PlayWalking();
    				}
    				else
    				{
    					if ( (MyAnimGroup == 'Waiting') || (MyAnimGroup == 'Landing') || (MyAnimGroup == 'Gesture') || (MyAnimGroup == 'TakeHit')  )
    					{
    						bAnimTransition = true;
    						TweenToRunning(0.1);
    					}
    					else
    						PlayRunning();
    				}
    			}
    		}
    		else
    			PlayInAir();
    	}

    	// overwrite of Dodge function, used to prevent dodging when

    	// in creeping state
    	function Dodge(vector" class="source">eDodgeDir DodgeMove)
    	{
    		// Only do dodging when not creeping
    		if(!m_bIsCreeping)
    			Super.Dodge(DodgeMove);
    		else
    			class'SFUtils'.Static.sfLogEx(4,"Dodgeing not possible when creeping");
    	}

    	// ProcessMove override, used to add creeping movement
    	function ProcessMove(float DeltaTime, vector NewAccel, vector" class="source">eDodgeDir DodgeMove, rotator DeltaRot)
    	{
    		local vector OldAccel;

    		OldAccel = Acceleration;
    		Acceleration = NewAccel;
    		bIsTurning = ( Abs(DeltaRot.Yaw/DeltaTime) > 5000 );
    		if ( (DodgeMove == DODGE_Active) && (Physics == PHYS_Falling) )
    			DodgeDir = DODGE_Active;
    		else if ( (DodgeMove != DODGE_None) && (DodgeMove < DODGE_Active) )
    			Dodge(DodgeMove);

    		if ( bPressedJump )
    			DoJump();
    		if ( (Physics == PHYS_Walking) && (GetAnimGroup(AnimSequence) != 'Dodge') )
    		{
    			// Check for creeping here
    			if(!m_bIsCreeping) // Will be set on first encounter
    			{
    				if (m_bCreep != 0)
    				{
    					// Mark creeping state
    					m_bIsCreeping= true;
    					bIsCrouching= false;
    					PlayCreeping();
    				}
    			}
    			else
    			{
    				// Check if still creeping
    				if(m_bCreep != 1)
    					m_bIsCreeping = false;
    			}

    			// Check for crouching only, if not creeping
    			if ((!bIsCrouching) && (!m_bIsCreeping)) // Will be set on first encounter
    			{
    				if (bDuck != 0)
    				{
    					m_bIsCreeping= false;
    					bIsCrouching= true;
    					PlayDuck();
    					//class'SFUtils'.Static.sfLogEx(4,"ProcessMove: bDuck set, bIsCrouching set to true");
    				}
    			}
    			else if ((bDuck == 0) && (m_bCreep== 0))
    			{
    				OldAccel = vect(0,0,0);
    				bIsCrouching= false;
    				m_bIsCreeping= false;
    				TweenToRunning(0.1);
    			}

    			if (( !bIsCrouching) && (!m_bIsCreeping))
    			{
    				if ( (!bAnimTransition || (AnimFrame > 0)) && (GetAnimGroup(AnimSequence) != 'Landing') )
    				{
    					if ( Acceleration != vect(0,0,0) )
    					{
    						if ( (GetAnimGroup(AnimSequence) == 'Waiting') || (GetAnimGroup(AnimSequence) == 'Gesture') || (GetAnimGroup(AnimSequence) == 'TakeHit') )
    						{
    							bAnimTransition = true;
    							TweenToRunning(0.1);
    						}
    					}
    			 		else if ( (Velocity.X * Velocity.X + Velocity.Y * Velocity.Y < 1000)
    						&& (GetAnimGroup(AnimSequence) != 'Gesture') )
    			 		{
    			 			if ( GetAnimGroup(AnimSequence) == 'Waiting' )
    			 			{

    							if ( bIsTurning && (AnimFrame >= 0) )
    							{
    								bAnimTransition = true;
    								PlayTurning();
    							}
    						}
    			 			else if ( !bIsTurning )
    						{
    							bAnimTransition = true;
    							TweenToWaiting(0.2);
    						}
    					}
    				}
    			}
    			else
    			{
    				// Crouching / Creeping state
    				if(bIsCrouching)
    				{
    					if ( (OldAccel == vect(0,0,0)) && (Acceleration != vect(0,0,0)) )
    						PlayCrawling();
    					else if ( !bIsTurning && (Acceleration == vect(0,0,0)) && (AnimFrame > 0.1) )
    					{
    						PlayDuck();
    					}
    				}

    				if(m_bIsCreeping)
    				{
    					if ( (OldAccel == vect(0,0,0)) && (Acceleration != vect(0,0,0)) )
    					{
    						PlayCreeping();
    					}
    					else if ( !bIsTurning && (Acceleration == vect(0,0,0)) && (AnimFrame > 0.1) )
    					{
    						PlayKneel();
    					}
    				}
    			}
    		}
    	}

    	event PlayerTick(float DeltaTime)
    	{
    		local vector X,Y,Z, Dir;

    		// Check for autosave here
    		if(None != SFHUD(myHUD))
    			if(SFHUD(myHud).bFirstTime)
    			{
    //FIXME: This is crashing in record mode
    				autoSaveGame();
    				SFHUD(myHud).bFirstTime=false;
    			}

    		// Call to base class
    		Super.PlayerTick(DeltaTime);

    		// Call to base class
    //		Super.Tick(DeltaTime );

    		// Check for jumping state
    		m_bIsJumping	= (Physics == PHYS_Falling);
    		m_bIsRunning	= !bIsWalking;

    		GetAxes(Rotation, X,Y,Z);
    		Dir = Normal(Acceleration);
    		if ( ( Dir Dot X > -0.75 ) && (Dir Dot X < 0.75) && (Dir != vect(0,0,0)) )
    			m_bIsStrafing	= true;
    		else
    			m_bIsStrafing	= false;

    		// Adjust accuracy
    		AdjustAccuracy();

    		// Eventually reset any modification
    		// done to the inputs
    		ResetManualInput();

    		sweat(DeltaTime);

    	}

    	// Base class override, to do own initialization
    	function BeginState()
    	{
    		// Call to base class
    		Super.BeginState();
    		m_bIsCreeping = false;

    	}

    	// Base class override, to do own cleanup
    	function EndState()
    	{
    		// Call to base class
    		Super.EndState();
    		m_bIsCreeping = false;

    	}

    }

    // Overwritten here, to prevent the SFRadiationZone from generating
    // bubbles, when player is taking damage
    function PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum)
    {
         local Bubble1 bub;
         local vector Mo;

         if ( Region.Zone.bDestructive && (Region.Zone.ExitActor != None) )
              Spawn(Region.Zone.ExitActor);

         if ((HeadRegion.Zone.bWaterZone) && (!HeadRegion.Zone.IsA('SFRadiationZone')))
         {
              bub = spawn(class 'Bubble1',,, Location
                   + 0.3 * CollisionRadius * vector(Rotation) + 0.8 * EyeHeight * vect(0,0,1));
              if (bub != None)
                   bub.DrawScale = FRand()*0.08+0.03;
              bub = spawn(class 'Bubble1',,, Location
                   + 0.2 * CollisionRadius * VRand() + 0.7 * EyeHeight * vect(0,0,1));
              if (bub != None)
                   bub.DrawScale = FRand()*0.08+0.03;
              bub = spawn(class 'Bubble1',,, Location
                   + 0.3 * CollisionRadius * VRand() + 0.6 * EyeHeight * vect(0,0,1));
              if (bub != None)
                   bub.DrawScale = FRand()*0.08+0.03;
         }

         if ( (!Level.bDropDetail || (FRand() < 0.67))
                   && ((DamageType == 'shot') || (DamageType == 'decapitated') || (DamageType == 'shredded')) )
         {
              Mo = Momentum;
              if ( Mo.Z > 0 )
                   Mo.Z *= 0.5;
              spawn(class 'UT_BloodHit',self,,hitLocation, rotator(Mo));
         }
         else if ( (damageType != 'Drowned') && (damageType != 'Corroded') )
              spawn(class 'UT_BloodBurst',self,'', hitLocation);
    }

    // Overwritten here, to prevent the SFRadiationZone from generating
    // drowning death sounds.
    function PlayDyingSound()
    {
         local int rnd;

         if ( HeadRegion.Zone.bWaterZone && !HeadRegion.Zone.IsA('SFRadiationZone'))
         {
              if ( FRand() < 0.5 )
                   PlaySound(UWHit1, SLOT_Pain,16,,,Frand()*0.2+0.9);
              else
                   PlaySound(UWHit2, SLOT_Pain,16,,,Frand()*0.2+0.9);

              return;
         }

         rnd = Rand(6);
         PlaySound(Deaths[rnd], SLOT_Talk, 16);
         PlaySound(Deaths[rnd], SLOT_Pain, 16);
    }

    // Overwritten here, to prevent the SFRadiationZone from generating
    // drowning death sounds.
    function PlayTakeHitSound(int damage, name damageType, int Mult)
    {
         if ( Level.TimeSeconds - LastPainSound < 0.3 )
              return;
         LastPainSound = Level.TimeSeconds;

         if ( HeadRegion.Zone.bWaterZone && !HeadRegion.Zone.IsA('SFRadiationZone'))
         {
              if ( damageType == 'Drowned' )
                   PlaySound(drown, SLOT_Pain, 12);
              else if ( FRand() < 0.5 )
                   PlaySound(UWHit1, SLOT_Pain,16,,,Frand()*0.15+0.9);
              else
                   PlaySound(UWHit2, SLOT_Pain,16,,,Frand()*0.15+0.9);
              return;
         }
         damage *= FRand();

         if (damage < 8)
    	 {
              PlaySound(HitSound1, SLOT_Pain,16,,,Frand()*0.15+0.9);
      	 }
         else if (damage < 25)
         {
              if (FRand() < 0.5) PlaySound(HitSound2, SLOT_Pain,16,,,Frand()*0.15+0.9);
              else PlaySound(HitSound3, SLOT_Pain,16,,,Frand()*0.15+0.9);
         }
         else
    	 {
              PlaySound(HitSound4, SLOT_Pain,16,,,Frand()*0.15+0.9);
    	 }
    }

    function ShowLoadMenu()
    {
    	WalkBob = vect(0,0,0);
    	bShowMenu = true; // menu is responsible for turning this off
    	class'SFUtils'.Static.sfLogEx(4,"myHud " $ myHud.name $ " " $ myHud.MainMenu.name);
    	Player.Console.GotoState('Menuing');

    	class'SFUtils'.Static.sfLogEx(4,"ShowLoadmenu");
    	if( Level.Netmode == NM_Standalone )
    		SetPause(true);
    }

    // Base class state override
    state FeigningDeath
    {
    	// Base class override to do initialization
    	function BeginState()
    	{
    		// Call to base class
    		Super.BeginState();
    		m_bIsCreeping = false;

    	}
    }

    state Climbing
    {
    ignores SeePlayer, HearNoise, Bump;

    	function ZoneChange( ZoneInfo NewZone )
    	{
    		if (NewZone.bWaterZone)
    		{
    			setPhysics(PHYS_Swimming);
    			GotoState('PlayerSwimming');

    		}

    	}

    	function AnimEnd()
    	{

    		local name MyAnimGroup;
    		local float fVel;

    		MyAnimGroup = GetAnimGroup(AnimSequence);
    		fVel =  Velocity.X * Velocity.X + Velocity.Z * Velocity.Z;

    		if ((fVel) < 0.3)
    		{
    			if ( MyAnimGroup == 'Waiting' )
    				PlayWaiting();
    			else
    			{
    				bAnimTransition = true;
    				TweenToWaiting(0.1);
    			}
    		}
    		else
    		{
    			if ( MyAnimGroup != 'Waiting' )
    				PlayWalking();
    			else
    			{
    				bAnimTransition = true;
    				TweenToWalking(0.1);
    			}
    		}
    	}

    	function ProcessMove(float DeltaTime, vector NewAccel, vector" class="source">eDodgeDir DodgeMove, rotator DeltaRot)
    	{
    		Acceleration = Normal(NewAccel);
    		Velocity = Normal(NewAccel) * 300;
    		AutonomousPhysics(DeltaTime);
    	}

    	event PlayerTick( float DeltaTime )
    	{
    		if ( bUpdatePosition )
    			ClientUpdatePosition();

    		PlayerMove(DeltaTime);

    		sweat(DeltaTime);
    	}

    	function PlayerMove(float DeltaTime)
    	{
    		local float fSpeed2D;
    		local rotator newRotation;
    		local vector X,Y,Z;

    		GetAxes(ViewRotation,X,Y,Z);

    		aForward *= 0.1;
    		aStrafe  *= 0.1;
    		aLookup  *= 0.24;
    		aTurn    *= 0.24;
    		aUp		 *= 0.1;

    		Acceleration = aForward*X + aStrafe*Y + aUp*vect(0,0,1);

    		UpdateRotation(DeltaTime, 1);

    		fSpeed2D = Sqrt(Velocity.X * Velocity.X + Velocity.Y * Velocity.Y);

    		if ( Role < ROLE_Authority ) // then save this move and replicate it
    			ReplicateMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));
    		else
    			ProcessMove(DeltaTime, Acceleration, DODGE_None, rot(0,0,0));

    		if (fSpeed2D > 10)
    			ClimbStepping();
    	}

    	function BeginState()
    	{
    		EyeHeight = BaseEyeHeight;

    		SetPhysics(PHYS_Flying);
    		if  ( !IsAnimating() ) PlayRunning();
    	}
    }

    // ----------------------------------------------------------------------
    // state Dying
    //

    // make sure the death animation finishes
    // ----------------------------------------------------------------------

    state Dying
    {

    ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, SwitchWeapon, Falling, PainTimer;
    	event PlayerTick(float deltaTime)
    	{
    		Super.PlayerTick(deltaTime);
    	}

    	exec function Fire(optional float F)
    	{
    //		if ( Level.NetMode != NM_Standalone )
    //			Super.Fire();
    		if ( Role < ROLE_Authority )
    			return;

    		if ( Level.NetMode == NM_Standalone )
    		{
    			//ServerReStartPlayer();
    			//loadGame(m_nLastSaveSlot);
    			m_bLoadDialogOpened=true;
    			SFLoadDialog();
    		}

    		bJustFired = false;
    		bJustAltFired = false;

    	}

    	exec function ShowMainMenu()
    	{
    		local UTConsole C;

    		class'SFUtils'.Static.sfLogEx(5,"State Dying: ShowMainMenu");

    		// reduce the white glow when the menu is up
    		if (InstantFog != vect(0,0,0))
    		{
    			InstantFog   = vect(0.1,0.1,0.1);
    			InstantFlash = 0.01;

    			// force an update
    			ViewFlash(1.0);
    		}

    //		Global.ShowMainMenu();
    //		myHud.bHidden = false;
    //		UTConsole(Player.Console).ShowSpeech();
    	}

       function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
    	{
    	}

    	function PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation)
    	{
    		local vector ViewVect, HitLocation, HitNormal;
    		local float ViewDist;
    		local actor HitActor;
    		local float time;

    		ViewActor = Self;

    		// spiral up and around carcass and fade to white in five seconds
    		time = Level.TimeSeconds - m_fFrobTime;

    		if (time < 8.0)
    		{
    			CameraRotation.Pitch = -16384;
    			CameraRotation.Yaw = (time * 4096.0) % 65536;
    			ViewDist = 32 + time * 16;
    			// make sure we don't go through the ceiling
    			ViewVect = vect(0,0,1);
    			HitActor = Trace(HitLocation, HitNormal, Location + ViewDist * ViewVect, Location);
    			if ( HitActor != None )
    				CameraLocation = HitLocation;
    			else
    				CameraLocation = Location + ViewDist * ViewVect;
    		}
    		else
    		{
    			CameraRotation.Pitch = -16384;
    			CameraRotation.Yaw = (time * 4096.0) % 65536;

    			 ViewDist = 32 + 8.0 * 16;

    			// make sure we don't go through the ceiling
    			ViewVect = vect(0,0,1);
    			HitActor = Trace(HitLocation, HitNormal, Location + ViewDist * ViewVect, Location);
    			if ( HitActor != None )
    				CameraLocation = HitLocation;
    			else
    				CameraLocation = Location + ViewDist * ViewVect;

    			if(!m_bLoadDialogOpened)
    			{
    				m_bLoadDialogOpened=true;
    				SFLoadDialog();
    			}
    		}

    	}

    	function BeginState()
    	{
    		local SFHUD	oHud;

    		class'SFUtils'.Static.sfLogEx(5,"SFPlayer - Dying - BeginState: Hiding HUD!");

    		// Release decoration
    		SlipDecoration();

    		// Get the SFHUD
    		oHud	= SFHUD(myHud);
    		// Save current time
    		m_fFrobTime = Level.TimeSeconds;
    		// Hide HUD
    		oHud.bHideHUD = true;
    		// Cancel any active HUD activity
    		oHud.CancelComm();

    		// Stop any action
    		bFrozen = true;
    		bPressedJump = false;
    		bJustFired = false;
    		bJustAltFired = false;

    		if(None == Player)
    			class'SFUtils'.Static.sfLogEx(5, "SFPlayer - Dying - BeginState: Player already destroyed !!!!");

    	}

    Begin:

    	class'SFUtils'.Static.sfLogEx(5,"SFPlayer - Dying: Entering state");

    	// Don't come back to life crouched
    	m_bCreep			= 0;
    	m_bIsCreeping		= False;
    	bDuck				= 0;

    	bBehindView = True;
    	Velocity = vect(0,0,0);
    	Acceleration = vect(0,0,0);
    	DesiredFOV = Default.DesiredFOV;
    	FinishAnim();

    	// hide us and spawn the carcass
    	if ( !bHidden )
    		SpawnCarcass();
    	bHidden = True;

    }

    state PlayerChat
    {
    ignores SeePlayer, HearNoise, Bump, TakeDamage, Died, ZoneChange, FootZoneChange;

    	event  PlayerInput(float DeltaTime)
    	{
    		// Do not call the global function that does the additional SF stuff.
    		Super.PlayerInput(DeltaTime);
    	}

    	function UseKeyTargetting()
    	{
    	}

    	exec function Jump( optional float F )
    	{
    	}

    	exec function Suicide()
    	{
    	}

    	exec function Fire(optional float F)
    	{
    	}

    	exec function AltFire(optional float F)
    	{
    	}

    	function ProcessMove(float DeltaTime, vector NewAccel, vector" class="source">eDodgeDir DodgeMove, rotator DeltaRot)
    	{
    	}

    	function PlayWaiting() {}

    	event PlayerTick( float DeltaTime )
    	{
    		if ( bUpdatePosition )
    			ClientUpdatePosition();

    		PlayerMove(DeltaTime);
    	}

    	function PlayerMove(float DeltaTime)
    	{
    	}

    	function AnimEnd()
    	{
    		PlayWaiting();
    	}

    	function EndState()
    	{
    //		SetMesh();
    		PlayerReplicationInfo.bIsSpectator = false;
    		PlayerReplicationInfo.bWaitingPlayer = false;
    		SetCollision(true,true,true);
    	}

    	function BeginState()
    	{
    //		Mesh = None;
    		SetCollision(false,false,false);
    		EyeHeight = BaseEyeHeight;
    		SetPhysics(PHYS_None);
    		PlayWaiting();

    	}
    }

    function bool CanAcceptScoutBotLinkup()
    {
    	local bool	bRet;

    	bRet	= true;
    	// MedStation renders on the HUD, so don't loose it...
    	if(None != m_actNearestMedStation)
    		bRet = false;

    	if(!bRet)
    		ClientMessage("Currently unable to link up to a ScoutBot!");

    	return bRet;

    }

    state Scouting
    {
    ignores Fire, AltFire;

    	function BeginState()
    	{
    		local rotator	rot;

    		// Set intigator for events
    		ScoutBot.Instigator = Self;

    		// Clear any reference
    		m_oScoutBotComm	= None;

    		// Fire entry event
    		FireCustomEvent( ScoutBot , Self, 'SFScoutBotEnter');

    		//Stand up
    		rot	= Rotation;
    		rot.pitch	= 0.0f;
    		SetRotation(rot);

    		PlayWaiting();
    	}

    	function EndState()
    	{
    		// Call to base class
    		Super.EndState();

    		// Fire exit event
    		FireCustomEvent( ScoutBot , Self, 'SFScoutBotLeave');

    		if(None != m_oScoutBotComm)
    			SFHUD(myHUD).queueCommunication(m_oScoutBotComm);
    		m_oScoutBotComm = None;
    	}

    	function AnimEnd()
    	{
    		PlayWaiting();
    	}

    	event PlayerTick( float DeltaTime )
    	{
    		if ( bUpdatePosition )
    			ClientUpdatePosition();

    		PlayerMove(DeltaTime);
    	}

    	/**
    	Forcing MouseSensitivity to be 1.0 during calculating input stuff.
    	*/
    	event PlayerInput( float DeltaTime )
    	{
    		local float	Temp;

    		Temp = MouseSensitivity;				// saving MouseSensitivity
    		MouseSensitivity = 1.0;					// forcing a value
    		super(PlayerPawn).PlayerInput(DeltaTime);		// calculating input stuff
    		MouseSensitivity = Temp;				// restoring MouseSensitivity
    	}

    	function PlayerMove(float DeltaTime)
    	{
    		if(ScoutBot != None)

    			ScoutBot.Drop(vect(0,0,0));	// that's just a damn trick :)) i use Drop function from Decoration class to avoid referencing to SFScoutBot class so i can keep ScoutBot in separate package, but i must say i'm not sure which version of Drop function will be called, the original one from Decoration class or the one from SFScoutBot class
    	}

    	exec function UseKey()
    	{
    		ScoutBot.Trigger(Self, Self);
    	}
    Begin:
    	PlayWaiting();
    	SlipDecoration();
    }

    //////////////////////////////
    /// Properties
    //////////////////////////////

    exec function Fire( optional float F )
    {
    	bJustFired = true;
    	if( bShowMenu || (Level.Pauser!="") || (Role < ROLE_Authority) )
    	{
    		if( (Role < ROLE_Authority) && (Weapon!=None) )
    			bJustFired = Weapon.ClientFire(F);
    		if ( !bShowMenu && (Level.Pauser == PlayerReplicationInfo.PlayerName)  )
    			SetPause(False);
    		return;
    	}
    	if( Weapon!=None )
    	{
    		Weapon.bPointing = true;
    		PlayFiring();
    		Weapon.Fire(F);
    	}
    }

    defaultproperties
    {
         JumpAccuracyPenalty=1.000000
         RunAccuracyPenalty=1.000000
         StrafeAccuracyPenalty=1.000000
         m_fPenaltyUpgrade=1.000000
         SafeFall_Damage=580.000000
         SafeFall_Kill=940.000000
         CollisionHeightCrouch=28.000000
         CollisionHeightCreep=21.000000
         nShowVersionTime=20
         NormalSpeed=0.800000
         CrouchSpeed=0.300000
         CreepSpeed=0.200000
         ClimbStep=Sound'SpatialFear.Female.FClimb1'
         m_fCurrentSpeedModification=1.000000
         strSFVersion="1.1.182"
         m_bIsRunning=True
         PlayerState=STATE_Normal
         m_fFootstepVolume=2.200000
         m_fLastPheromoneSpawn=-1.000000
         fSoundPitch=1.000000
         GroundSpeed=280.000000
         AirSpeed=280.000000
         AccelRate=1450.000000
         JumpZ=300.000000
         CollisionRadius=14.000000
    }

class file time: 12/7/2003 3:58:24 PM - creation time: 12/7/2003 4:03:45 PM
Created with UnCodeX