Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

U2.CodeMonkey


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
//=============================================================================
// $Author: Mfox $
// $Date: 3/03/03 7:18p $
// $Revision: 89 $
//=============================================================================

//------------------------------------------------------------------------------
// Name:	CodeMonkey.uc
// Author:	Aaron R Leiby
// Date:	3 January 2001
//------------------------------------------------------------------------------
// Description:	Used to store various needed UnrealScript functions for the UI.
//------------------------------------------------------------------------------
// Notes:
//------------------------------------------------------------------------------
// How to use this class:
//------------------------------------------------------------------------------

class CodeMonkey extends UIHelper;

var localized string EmptySlotText;
var localized string QuickSaveText;
var LevelDesc LevelDescCache[10];

var localized string ApplySettingsText;

var string PendingRes;
var string PendingBPP;
var bool bPendingDetail;

var bool bNoShadowUpdate;
var bool bPendingUpdateShadow;
var bool bPendingSuperUpdateShadow;

var bool bNoResetMenus;

var bool bLastHUDState;
var bool bLockHUDState;

const PauseKey = 314;
const Pause_withDrawKey = 278;
const PauseKey_Objectives = 777;

function string GetEngineVersion()			{ return "Unreal2 v." $ GetPlayerOwner().Level.EngineVersion; }

function Pause()							{ GetPlayerOwner().SetPause(true,PauseKey); GetConsole().bNoDrawWorld=true; }
function UnPause()							{ GetPlayerOwner().SetPause(false,PauseKey); GetConsole().bNoDrawWorld=false; }

function Pause_withDraw()					{ GetPlayerOwner().SetPause(true,Pause_withDrawKey); }
function UnPause_withDraw()					{ GetPlayerOwner().SetPause(false,Pause_withDrawKey); }

function Pause_Objectives()					{ GetPlayerOwner().SetPause(true,PauseKey_Objectives); }
function UnPause_Objectives()				{ GetPlayerOwner().SetPause(false,PauseKey_Objectives); }

function HideHUD()							{ if(bLockHUDState) return; bLockHUDState = true; bLastHUDState = GetPlayerOwner().Level.Game.bDisplayHud; GetPlayerOwner().Level.Game.bDisplayHud = false; }
function RestoreHUD()						{ bLockHUDState = false; GetPlayerOwner().Level.Game.bDisplayHud = bLastHUDState; }

function EndGame_LoadMenu()					{ class'UIConsole'.static.SendEvent("ShowMenus"); class'UIConsole'.static.SendEvent("ShowMenuLoadGame"); }
function EndGame_QuickLoad()				{ if(GetPlayerOwner().IsInState(U2PlayerController.DeadState)) class'MusicScriptEvent'.static.CallRoutine(GetPlayerOwner(),"",""); QuickLoad(); }
function EndGame_RestartLevel()				{ GetPlayerOwner().ConsoleCommand("restartlevel"); }

function SetAirControl(float F)				{ GetPlayerOwner().Pawn.AirControl = F; }
function float GetAirControl()				{ return GetPlayerOwner().Pawn.AirControl; }

function SetBehindView(bool B)				{ GetPlayerOwner().BehindView(B); }
function bool GetBehindView()				{ return GetPlayerOwner().bBehindView; }

//OPTIONS::PREFERENCES::GAME
function SetViewBob(float F)				{ GetPlayerOwner().Bob=F; GetPlayerOwner().SaveConfig(); }
function float GetViewBob()					{ return GetPlayerOwner().Bob; }

function SetGameSpeed(float F)				{ GetPlayerOwner().Level.Game.SetGameSpeed(F); GetPlayerOwner().Level.Game.SaveConfig(); }
function float GetGameSpeed()				{ return GetPlayerOwner().Level.Game.GetGameSpeed(); }

function SetDodging(float F)				{ GetPlayerOwner().PlayerInput.DoubleClickTime=F; GetPlayerOwner().PlayerInput.SaveConfig(); }
function float GetDodging()					{ return GetPlayerOwner().PlayerInput.DoubleClickTime; }

function SetDuckToggle(bool B)				{ local U2PlayerNetTestController C; C=U2PlayerNetTestController(GetPlayerOwner()); C.bUseDuckToggles=B; C.SaveConfig(); }
function bool GetDuckToggle()				{ local U2PlayerNetTestController C; C=U2PlayerNetTestController(GetPlayerOwner()); return C.bUseDuckToggles; }

function SetRunToggle(bool B)				{ local U2PlayerNetTestController C; C=U2PlayerNetTestController(GetPlayerOwner()); C.bUseRunToggles=B; C.SaveConfig(); }
function bool GetRunToggle()				{ local U2PlayerNetTestController C; C=U2PlayerNetTestController(GetPlayerOwner()); return C.bUseRunToggles; }

function SetLeanToggle(bool B)				{ local U2PlayerNetTestController C; C=U2PlayerNetTestController(GetPlayerOwner()); C.bUseLeanToggles=B; C.SaveConfig(); }
function bool GetLeanToggle()				{ local U2PlayerNetTestController C; C=U2PlayerNetTestController(GetPlayerOwner()); return C.bUseLeanToggles; }

function SetSwitchOnPickup(bool B)			{ GetPlayerOwner().bNeverSwitchOnPickup=!B; GetPlayerOwner().SaveConfig(); }
function bool GetSwitchOnPickup()			{ return !GetPlayerOwner().bNeverSwitchOnPickup; }

function SetBroadcastObjectives(bool B)		{ U2GameInfo(GetPlayerOwner().Level.Game).bBroadcastObjectives=B; GetPlayerOwner().Level.Game.SaveConfig(); }
function bool GetBroadcastObjectives()		{ return U2GameInfo(GetPlayerOwner().Level.Game).bBroadcastObjectives; }

// Dialog stuff
function SetShowSubtitles(bool B)			{ GetPlayerOwner().ShowSubtitles = B; GetPlayerOwner().SaveConfig(); }
function bool GetShowSubtitles()			{ return GetPlayerOwner().ShowSubtitles; }

//OPTIONS::PREFERENCES::VIDEO
function array<string> GetDisplayModes()	{ local string S; local array<string> DisplayModes; S=GetConsole().ConsoleCommandEx("DISPLAYMODES"); StrArray(S," ",DisplayModes,true); return DisplayModes; }
function SetRes(string Res)					{ PendingRes=Res; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }	//{ GetPlayerOwner().ConsoleCommand("SETRES"@Res); }
function string GetRes()					{ local Dimension D; if(PendingRes?) return PendingRes; D=class'UIConsole'.static.GetComponentSize(GetUIConsole().Root); return int(D.Width)$"x"$int(D.Height); }

function SetBPP32()							{ PendingBPP="32"; class'UIConsole'.static.SendEvent("FlashVideoSettings"); } //{ GetPlayerOwner().ConsoleCommand("SETRES"@GetRes()$"x32"); }
function SetBPP16()							{ PendingBPP="16"; class'UIConsole'.static.SendEvent("FlashVideoSettings"); } //{ GetPlayerOwner().ConsoleCommand("SETRES"@GetRes()$"x16"); }
function int GetBPPIndex()					{ local string BPP; if(PendingBPP?) BPP=PendingBPP; else BPP=GetPlayerOwner().ConsoleCommand("GETCOLORDEPTH"); switch(BPP){ case "32": return 0; case "16": return 1; }; }

function SetTextureDetailHigh()				{ GetClient().TextureDetail=High;		GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function SetTextureDetailMedium()			{ GetClient().TextureDetail=Medium;		GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function SetTextureDetailLow()				{ GetClient().TextureDetail=Low;		GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function SetTextureDetailUltraLow()			{ GetClient().TextureDetail=UltraLow;	GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function int GetTextureDetailIndex()		{ return GetClient().TextureDetail; }

function SetSkinDetailHigh()				{ GetClient().SkinDetail=High;			GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function SetSkinDetailMedium()				{ GetClient().SkinDetail=Medium;		GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function SetSkinDetailLow()					{ GetClient().SkinDetail=Low;			GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function SetSkinDetailUltraLow()			{ GetClient().SkinDetail=UltraLow;		GetClient().SaveConfig(); bPendingDetail=true; class'UIConsole'.static.SendEvent("FlashVideoSettings"); }
function int GetSkinDetailIndex()			{ return GetClient().SkinDetail; }

function color GetApplyColor()				{ if( PendingRes? || PendingBPP? || bPendingDetail ) return GetPlayerOwner().ColorRed(); else return GetPlayerOwner().ColorWhite(); }

function ApplyVideoSettings()
{
	local string Res;
	local string BPP;
	if( PendingRes? || PendingBPP? || bPendingDetail )
	{
		GetPlayerOwner().ConsoleCommand("FLUSH");
//		class'UIConsole'.static.SendEvent("ResetMenus");
		class'UIConsole'.static.BroadcastStatusMessage(GetPlayerOwner(),ApplySettingsText,0.5,,,,,,"U2MenusTimedHolder");
		if(PendingRes? && PendingBPP?) GetPlayerOwner().ConsoleCommand("SETRES"@PendingRes$"x"$PendingBPP);
		if(PendingRes? && !PendingBPP) GetPlayerOwner().ConsoleCommand("SETRES"@PendingRes);
		if(!PendingRes && PendingBPP?) GetPlayerOwner().ConsoleCommand("SETRES"@GetRes()$"x"$PendingBPP);
//		if(!PendingRes && !PendingBPP) GetPlayerOwner().ConsoleCommand("SETRES"@GetRes());
		PendingRes="";
		PendingBPP="";
		bPendingDetail=false;
	}
}

function SetBrightness(float F)				{ GetPlayerOwner().ConsoleCommand("brightness"@F); }
function float GetBrightness()				{ return GetClient().Brightness; }

function SetContrast(float F)				{ GetPlayerOwner().ConsoleCommand("contrast"@F); }
function float GetContrast()				{ return GetClient().Contrast; }

function SetGamma(float F)					{ GetPlayerOwner().ConsoleCommand("gamma"@F); }
function float GetGamma()					{ return GetClient().Gamma; }

function SetFullscreen(bool B)				{ class'UIConsole'.static.SendEvent("ResetMenus"); GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.ViewportManager StartupFullscreen"@B); GetPlayerOwner().ConsoleCommand("TOGGLEFULLSCREEN"); }
function bool GetFullscreen()				{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.ViewportManager StartupFullscreen")); }

function SetDecals(bool B)					{ GetClient().Decals=B; GetClient().SaveConfig(); }
function bool GetDecals()					{ return GetClient().Decals; }

function SetCrosshairGlows(bool B)			{ GetPlayerOwner().ConsoleCommand("set U2Weapon UseGlowingCrosshairs"@B); class'U2Weapon'.static.StaticSaveConfig(); }
function bool GetCrosshairGlows()			{ return bool(GetPlayerOwner().ConsoleCommand("get U2Weapon UseGlowingCrosshairs")); }

// Is this the same as sensitivity?
function SetMouseSpeed(float F)				{ GetClient().MouseSpeed=F; GetClient().SaveConfig(); }
function float GetMouseSpeed()				{ return GetClient().MouseSpeed; }

function SetMinFramerate(string S)			{ GetClient().MinDesiredFrameRate=int(S); GetClient().SaveConfig(); }
function string GetMinFramerate()			{ return string(int(GetClient().MinDesiredFrameRate))$"fps"; }

function SetParticleDensity(float F)		{ GetClient().ParticleDensity=F; GetClient().SaveConfig(); }
function float GetParticleDensity()			{ return GetClient().ParticleDensity; }

function SetDecoLayerDensity(float F)		{ GetPlayerOwner().ConsoleCommand("set TerrainInfo DecoLayerDensity"@F); class'TerrainInfo'.static.StaticSaveConfig(); }
function float GetDecoLayerDensity()		{ return float(GetPlayerOwner().ConsoleCommand("get TerrainInfo DecoLayerDensity")); }

//OPTIONS::PREFERENCES::D3D

function SetUsePrecaching(bool B)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice UsePrecaching"@B); }
function bool GetUsePrecaching()			{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice UsePrecaching")); }

function SetUseTrilinear(bool B)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice UseTrilinear"@B); }
function bool GetUseTrilinear()				{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice UseTrilinear")); }

function SetUseVSync(bool B)				{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice UseVSync"@B); }
function bool GetUseVSync()					{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice UseVSync")); }

function SetUseTripleBuffering(bool B)		{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice UseTripleBuffering"@B); }
function bool GetUseTripleBuffering()		{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice UseTripleBuffering")); }

function SetUseCubemaps(bool B)				{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice UseCubemaps"@B); }
function bool GetUseCubemaps()				{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice UseCubemaps")); }

function SetReduceMouseLag(bool B)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice ReduceMouseLag"@B); }
function bool GetReduceMouseLag()			{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice ReduceMouseLag")); }

/*
function SetDesiredRefreshRate(string S)	{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DesiredRefreshRate"@S); }
function string GetDesiredRefreshRate()		{ return GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice DesiredRefreshRate"); }
*/

function SetRefreshRate85()					{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DesiredRefreshRate"@85); }
function SetRefreshRate75()					{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DesiredRefreshRate"@75); }
function SetRefreshRate72()					{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DesiredRefreshRate"@72); }
function SetRefreshRate70()					{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DesiredRefreshRate"@70); }
function SetRefreshRate60()					{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DesiredRefreshRate"@60); }
function int GetRefreshRate()				{ switch(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice DesiredRefreshRate")){ case "85": return 0; case "75": return 1; case "72": return 2; case "70": return 3; case "60": return 4; default: return 4; } }

// Fix ARL: Steal AUDIO_REBOOT from UT2107?  Do something similar for D3D?

//OPTIONS::PREFERENCES::AUDIO
function SetMusicVolume(float F)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice MusicVolume"@F);
	if(F?)	class'MusicScriptEvent'.static.SetMasterVolume(Blend(-1500,100,F));
	else	class'MusicScriptEvent'.static.SetMasterVolume(-10000); }
function float GetMusicVolume()				{ return float(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.AudioDevice MusicVolume")); }

function SoundReboot()
{
	GetPlayerOwner().ConsoleCommand("sound_reboot");

	// Restart music if necessary.
	if( GetPlayerOwner().Level.Song? )
		GetPlayerOwner().ClientSetMusic( GetPlayerOwner().Level.Song, MTRAN_Fade );
}

function int GetAudioChannelsUsed()			{ return int(GetConsole().ConsoleCommandEx("AUDIOCHANNELSUSED")); }
function int GetAudioChannelsTotal()		{ return int(GetConsole().ConsoleCommandEx("AUDIOCHANNELSTOTAL")); }
function float GetAudioChannelsPct()		{ return float(GetAudioChannelsUsed()) / float(GetAudioChannelsTotal()); }
function float GetAudioChannelsUnPct()		{ return 1.0 - GetAudioChannelsPct(); }
function string GetAudioStat()				{ return "[" $ GetAudioChannelsUsed() $ "/" $ GetAudioChannelsTotal() $ "]"; }

function SetSoundVolume(float F)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice SoundVolume"@F); }
function float GetSoundVolume()				{ return float(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.AudioDevice SoundVolume")); }

function SetReverseStereo(bool B)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice ReverseStereo"@B); }
function bool GetReverseStereo()			{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.AudioDevice ReverseStereo")); }

function SetAudioChannels(float F)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice Channels"@byte(F)); SoundReboot(); }
function float GetAudioChannels()			{ return float(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.AudioDevice Channels")); }
/*
function SetDopplerFactor(float F)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice DopplerFactor"@F); SoundReboot(); }
function float GetDopplerFactor()			{ return float(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.AudioDevice DopplerFactor")); }
*/
function SetUseEAX(bool B)					{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice UseEAX"@B); SoundReboot(); }
function bool GetUseEAX()					{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.AudioDevice UseEAX")); }

function SetDetailTextures(bool B)			{ GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.RenderDevice DetailTextures"@B); }
function bool GetDetailTextures()			{ return bool(GetPlayerOwner().ConsoleCommand("get ini:Engine.Engine.RenderDevice DetailTextures")); }

function int GetDifficulty()				{ return GetPlayerOwner().Level.Game.GetDifficulty(); }
function string GetDifficultyText()			{ switch(GetDifficulty()){ case 0: return "Easy"; case 1: return "Normal"; case 2: return "Hard"; } }

function SetDifficulty0()					{ GetPlayerOwner().Level.Game.SetDifficulty( 0 ); GetPlayerOwner().Level.Game.SaveConfig(); }
function SetDifficulty1()					{ GetPlayerOwner().Level.Game.SetDifficulty( 1 ); GetPlayerOwner().Level.Game.SaveConfig(); }
function SetDifficulty2()					{ GetPlayerOwner().Level.Game.SetDifficulty( 2 ); GetPlayerOwner().Level.Game.SaveConfig(); }
function int GetDifficultyIndex()			{ return (2 - GetPlayerOwner().Level.Game.GetDifficulty()); }

function SetActorDetail0()					{ GetClient().SetMaxDetailLevel( GetPlayerOwner(), 0 ); GetClient().SaveConfig(); }
function SetActorDetail1()					{ GetClient().SetMaxDetailLevel( GetPlayerOwner(), 1 ); GetClient().SaveConfig(); }
function SetActorDetail2()					{ GetClient().SetMaxDetailLevel( GetPlayerOwner(), 2 ); GetClient().SaveConfig(); }
function int GetActorDetailIndex()			{ return (2 - GetClient().MaxDetailLevel); }

function SetRagdoll0()						{ U2GameInfo(GetPlayerOwner().Level.Game).RagdollDetailLevel=0; GetPlayerOwner().Level.Game.SaveConfig(); }
function SetRagdoll1()						{ U2GameInfo(GetPlayerOwner().Level.Game).RagdollDetailLevel=1; GetPlayerOwner().Level.Game.SaveConfig(); }
function SetRagdoll2()						{ U2GameInfo(GetPlayerOwner().Level.Game).RagdollDetailLevel=2; GetPlayerOwner().Level.Game.SaveConfig(); }
function SetRagdoll3()						{ U2GameInfo(GetPlayerOwner().Level.Game).RagdollDetailLevel=3; GetPlayerOwner().Level.Game.SaveConfig(); }
function int GetRagdollIndex()				{ return (3 - U2GameInfo(GetPlayerOwner().Level.Game).RagdollDetailLevel); }

function SetRagdollDeaths(float F)			{ U2GameInfo(GetPlayerOwner().Level.Game).MaxRagdollDeaths=F; GetPlayerOwner().Level.Game.SaveConfig(); }
function float GetRagdollDeaths()			{ return U2GameInfo(GetPlayerOwner().Level.Game).MaxRagdollDeaths; }

function SetFluidSurfaceHigh()				{ GetClient().FluidSurfaceDetail=1; GetClient().SaveConfig(); }
function SetFluidSurfaceLow()				{ GetClient().FluidSurfaceDetail=0; GetClient().SaveConfig(); }
function int GetFluidSurfaceDetail()		{ return (1 - GetClient().FluidSurfaceDetail); }

function SetGoreLevel0()					{ GetClient().GoreDetailLevel=0; GetClient().SaveConfig(); AdjustGore(); }
function SetGoreLevel1()					{ GetClient().GoreDetailLevel=1; GetClient().SaveConfig(); AdjustGore(); }
function SetGoreLevel2()					{ GetClient().GoreDetailLevel=2; GetClient().SaveConfig(); AdjustGore(); }
function SetGoreLevel3()					{ GetClient().GoreDetailLevel=3; GetClient().SaveConfig(); AdjustGore(); }
function int GetGoreLevelIndex()			{ return (3 - GetClient().GoreDetailLevel); }
function bool GetGoreLock()					{ return !GetPlayerOwner().Level.Game.bAllowGore; }
function  AdjustGore()
{
	local Actor A;
	local byte GoreDetaillevel;
	GoreDetailLevel = GetClient().GoreDetailLevel;
	foreach GetPlayerOwner().DynamicActors( class'Actor', A )
		A.NotifyGoreDetailChanged( GoreDetailLevel );
}

function SetMasterShadowDetail0()			{ SetMasterShadowDetail(0); }
function SetMasterShadowDetail1()			{ SetMasterShadowDetail(1); }
function SetMasterShadowDetail2()			{ SetMasterShadowDetail(2); }
function SetMasterShadowDetail3()			{ SetMasterShadowDetail(3); }
function SetMasterShadowDetailX()			{ CustomShadows(); }
function SetMasterShadowDetail(int Level)
{
	ShadowUpdateDisable();
	switch(Level)
	{
	case 3:		//HIGH
		if(GetEnableShadows()==false)				// Shadows: enabled
			SetEnableShadows(true);
		if(GetBlobShadows()==true)					// BlobShadows: false
			SetBlobShadows(false);					
		if(GetClient().ShadowResolution!=256)		// ShadowResolution: 256 [High]
			SetShadowResHigh();
		if(GetLightSourceShadows()==false)			// LightSourced: true
			SetLightSourceShadows(true);
//		if(GetWeaponShadows()==false)				// Weapon shadows: enabled
//			SetWeaponShadows(true);
		if(GetMaxVisibleShadows()!=3)				// MaxVisibleShadows: 3
			SetMaxVisibleShadows(3);
		if(GetShadowCullDistance()!=1024)			// ShadowCullDistance: 1024
			SetShadowCullDistance(1024);
		if(GetShadowTraceDistance()!=512)			// ShadowTraceDistance: 512
			SetShadowTraceDistance(512);
		break;
	case 2:		//MEDIUM
		if(GetEnableShadows()==false)				// Shadows: enabled
			SetEnableShadows(true);					
		if(GetBlobShadows()==true)					// BlobShadows: false
			SetBlobShadows(false);					
		if(GetClient().ShadowResolution!=128)		// ShadowResolution: 128 [Medium]
			SetShadowResMedium();					
		if(GetLightSourceShadows()==true)			// LightSourced: false
			SetLightSourceShadows(false);			
//		if(GetWeaponShadows()==true)				// Weapon shadows: disabled
//			SetWeaponShadows(false);
		if(GetMaxVisibleShadows()!=4)				// MaxVisibleShadows: 4
			SetMaxVisibleShadows(4);
		if(GetShadowCullDistance()!=1024)			// ShadowCullDistance: 1024
			SetShadowCullDistance(1024);
		if(GetShadowTraceDistance()!=512)			// ShadowTraceDistance: 512
			SetShadowTraceDistance(512);
		break;
	case 1:		//LOW
		if(GetEnableShadows()==false)				// Shadows: enabled
			SetEnableShadows(true);					
		if(GetBlobShadows()==false)					// BlobShadows: true
			SetBlobShadows(true);					
		if(GetClient().ShadowResolution!=64)		// ShadowResolution: 64 [Low]
			SetShadowResLow();					
		if(GetLightSourceShadows()==false)			// LightSourced: true
			SetLightSourceShadows(true);			
//		if(GetWeaponShadows()==true)				// Weapon shadows: disabled
//			SetWeaponShadows(false);
		if(GetMaxVisibleShadows()!=0)				// MaxVisibleShadows: 0
			SetMaxVisibleShadows(0);
		if(GetShadowCullDistance()!=1024)			// ShadowCullDistance: 1024
			SetShadowCullDistance(1024);
		if(GetShadowTraceDistance()!=512)			// ShadowTraceDistance: 512
			SetShadowTraceDistance(512);
		break;
	case 0:		//OFF
		if(GetEnableShadows()==true)				// Shadows: disabled
			SetEnableShadows(false);					
//		if(GetBlobShadows()==false)					// BlobShadows: true
//			SetBlobShadows(true);					
//		if(GetClient().ShadowResolution!=64)		// ShadowResolution: 64 [Low]
//			SetShadowResLow();					
//		if(GetLightSourceShadows()==true)			// LightSourced: false
//			SetLightSourceShadows(false);			
//		if(GetWeaponShadows==true)					// Weapon shadows: disabled
//			SetWeaponShadows(false);
		if(GetMaxVisibleShadows()!=0)				// MaxVisibleShadows: 0
			SetMaxVisibleShadows(0);
//		if(GetShadowCullDistance()!=1024)			// ShadowCullDistance: 1024
//			SetShadowCullDistance(1024);
//		if(GetShadowTraceDistance()!=512)			// ShadowTraceDistance: 512
//			SetShadowTraceDistance(512);
		break;
	};
	ShadowUpdateEnable();
	GetClient().MasterShadowDetail=Level;
	GetClient().SaveConfig();
}
function int GetMasterShadowDetailIndex()
{
	switch(GetClient().MasterShadowDetail)
	{
	case 3: return 0;
	case 2: return 1;
	case 1: return 2;
	case 0: return 3;
	default: return 4;
	};
}

function CustomShadows()					{ GetClient().MasterShadowDetail=255; GetClient().SaveConfig(); }

function SetShadowResUltraHigh()			{ GetClient().ShadowResolution=512; SuperUpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function SetShadowResHigh()					{ GetClient().ShadowResolution=256; SuperUpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function SetShadowResMedium()				{ GetClient().ShadowResolution=128; SuperUpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function SetShadowResLow()					{ GetClient().ShadowResolution=64; SuperUpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function int GetShadowResIndex()			{ switch(GetClient().ShadowResolution){ case 512: return 0; case 256: return 1; case 128: return 2; case 64: return 3; }; }

function SetEnableShadows(bool B)			{ GetClient().MaxShadowsStatic=byte(B); UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function bool GetEnableShadows()			{ return bool(GetClient().MaxShadowsStatic); }
/*
function SetWeaponShadows(bool B)			{ GetClient().MaxShadowsDynamic=byte(B); UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function bool GetWeaponShadows()			{ return bool(GetClient().MaxShadowsDynamic); }
*/
function SetLightSourceShadows(bool B)		{ GetClient().LightSourceShadows=B; UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function bool GetLightSourceShadows()		{ return GetClient().LightSourceShadows; }

function SetBlobShadows(bool B)				{ GetClient().BlobShadows=B; UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function bool GetBlobShadows()				{ return GetClient().BlobShadows; }

function SetBlurShadows(bool B)				{ GetClient().BlurShadows=B; UpdateShadows(); GetClient().SaveConfig(); /*CustomShadows();*/ }
function bool GetBlurShadows()				{ return GetClient().BlurShadows; }

function SetMaxVisibleShadows(float F)		{ GetPlayerOwner().Level.ObjectPoolPrecacheList[0].NumObjects=F; SuperUpdateShadows(); GetPlayerOwner().Level.SaveConfig(); CustomShadows(); }
function float GetMaxVisibleShadows()		{ return GetPlayerOwner().Level.ObjectPoolPrecacheList[0].NumObjects; }
/*
function SetMaxShadowsStatic(float F)		{ GetClient().MaxShadowsStatic=F; UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function float GetMaxShadowsStatic()		{ return GetClient().MaxShadowsStatic; }

function SetMaxShadowsDynamic(float F)		{ GetClient().MaxShadowsDynamic=F; UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function float GetMaxShadowsDynamic()		{ return GetClient().MaxShadowsDynamic; }
*/
function SetShadowCullDistance(float F)		{ GetClient().ShadowCullDistance=F; UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function float GetShadowCullDistance()		{ return GetClient().ShadowCullDistance; }

function SetShadowTraceDistance(float F)	{ GetClient().ShadowTraceDistance=F; UpdateShadows(); GetClient().SaveConfig(); CustomShadows(); }
function float GetShadowTraceDistance()		{ return GetClient().ShadowTraceDistance; }

function ShadowUpdateDisable()				{ bNoShadowUpdate=true; bPendingUpdateShadow=false; bPendingSuperUpdateShadow=false; }
function ShadowUpdateEnable()				{ bNoShadowUpdate=false; if(bPendingUpdateShadow) UpdateShadows(); if(bPendingSuperUpdateShadow) SuperUpdateShadows(); }

function UpdateShadows()
{
//	local Actor A;
//	foreach GetPlayerOwner().AllActors( class'Actor', A )
//		A.UpdateShadows();
	local Pawn P;
	if(bNoShadowUpdate){ bPendingUpdateShadow=true; return; }
	foreach GetPlayerOwner().AllActors( class'Pawn', P )
		P.ResetShadows();
}

function SuperUpdateShadows()
{
	local PlayerController Player;
	local Pawn P;
	local ShadowBitmapMaterial M;
	local LevelInfo Level;

	if(bNoShadowUpdate){ bPendingSuperUpdateShadow=true; return; }

	Player = GetPlayerOwner();
	Level = Player.Level;
	foreach Player.AllActors( class'Pawn', P )
	{
		if( P.ShadowA != None )
		{
			P.ShadowA.Destroy();
			P.ShadowA=None;
		}
		if( P.ShadowB != None )
		{
			P.ShadowB.Destroy();
			P.ShadowB=None;
		}
	}

	for	(	M=ShadowBitmapMaterial(Level.ObjectPool.GetObject(class'ShadowBitmapMaterial'));M?;
			M=ShadowBitmapMaterial(Level.ObjectPool.GetObject(class'ShadowBitmapMaterial')))
	{
		M.Delete();
	}

	Level.PrecacheObjects();

	foreach Player.AllActors( class'Pawn', P )
		P.ResetShadows();

	Player.ConsoleCommand("FLUSH");
}

//OPTIONS::CONTROLS::INPUT

function SetMouseLook(bool B)				{ GetPlayerOwner().bAlwaysMouseLook=B; GetPlayerOwner().SaveConfig(); }
function bool GetMouseLook()				{ return GetPlayerOwner().bAlwaysMouseLook; }

function SetMouseSmoothing(bool B)			{ GetPlayerOwner().PlayerInput.bMaxMouseSmoothing=B; GetPlayerOwner().PlayerInput.SaveConfig(); }
function bool GetMouseSmoothing()			{ return GetPlayerOwner().PlayerInput.bMaxMouseSmoothing; }

function SetInvertMouse(bool B)				{ GetPlayerOwner().PlayerInput.bInvertMouse=B; GetPlayerOwner().PlayerInput.SaveConfig(); }
function bool GetInvertMouse()				{ return GetPlayerOwner().PlayerInput.bInvertMouse; }

function SetLookSpring(bool B)				{ GetPlayerOwner().bSnapToLevel=B; GetPlayerOwner().SaveConfig(); }
function bool GetLookSpring()				{ return GetPlayerOwner().bSnapToLevel; }

function SetMouseSensitivity(float F)		{ GetPlayerOwner().PlayerInput.MouseSensitivity=F; GetPlayerOwner().PlayerInput.SaveConfig(); }
function float GetMouseSensitivity()		{ return GetPlayerOwner().PlayerInput.MouseSensitivity; }

function ResetKeyboard()					{ GetPlayerOwner().ResetKeyboard(); }

function float GetLevelLoadPct()			{ return GetConsole().LevelLoadingPct; }
function float GetLevelLoadAlpha()			{ return Blend( 255, 32, GetConsole().LevelLoadingPct ); }

function TriggerEvent( name Event )					{ GetPlayerOwner().TriggerEvent(Event,None,None); }
function TriggerSpecialCreditsParticles_yellow()	{ TriggerEvent('SpecialCreditsParticles_yellow'); }
function TriggerSpecialCreditsParticles_blue()		{ TriggerEvent('SpecialCreditsParticles_blue'); }
function TriggerSpecialCreditsParticles_purple()	{ TriggerEvent('SpecialCreditsParticles_purple'); }
function TriggerSpecialCreditsParticles_gold()		{ TriggerEvent('SpecialCreditsParticles_gold'); }
function TriggerLevelChange()						{ TriggerEvent('LevelChange'); }

function StopMusic()
{
	class'MusicScriptEvent'.static.CallRoutine(GetPlayerOwner(),"dmFadeout");
	GetPlayerOwner().StopAllMusic( 1.0 );
}

function PlayMusic( string Song )
{
	StopMusic();
	GetPlayerOwner().PlayMusic( Song, 0.0 );
}

function PlayMusic_Credits()
{
	PlayMusic("CreditsMusic.ogg");
}


// Save/Load Game Info
function string GetSaveGameName0()			{ return QuickSaveText @ GetSaveGameName(0); }
function string GetSaveGameName1()			{ return QuickSaveText @ GetSaveGameName(1); }
function string GetSaveGameName2()			{ return GetSaveGameName(2); }
function string GetSaveGameName3()			{ return GetSaveGameName(3); }
function string GetSaveGameName4()			{ return GetSaveGameName(4); }
function string GetSaveGameName5()			{ return GetSaveGameName(5); }
function string GetSaveGameName6()			{ return GetSaveGameName(6); }
function string GetSaveGameName7()			{ return GetSaveGameName(7); }
function string GetSaveGameName8()			{ return GetSaveGameName(8); }
function string GetSaveGameName9()			{ return GetSaveGameName(9); }

function string GetSaveGameName(int Slot)
{
	local LevelDesc Desc;
	Desc = LevelDescCache[Slot];
	if(Desc==None)	return EmptySlotText;
	else			return Desc.MapName;
}

function LoadLevelDescriptions()
{
	local int i;
	for(i=0;i<ArrayCount(LevelDescCache);i++)
		LevelDescCache[i]=LevelDesc(DynamicLoadObject("Save"$i$".Description",class'LevelDesc'));
}

function ClearLoadCache( LevelDesc Exclude )
{
	local int i;
	for(i=0;i<ArrayCount(LevelDescCache);i++)
	{
		if( LevelDescCache[i]!=None )
		{
			if( LevelDescCache[i]!=Exclude )
			{
				ResetLoaders(LevelDescCache[i].Outer,false,true);
				//LevelDescCache[i].Delete();
			}
			LevelDescCache[i]=None;
		}
	}
}

function string GetSaveGameDate0()	{ return GetSaveGameDate(0); }
function string GetSaveGameDate1()	{ return GetSaveGameDate(1); }
function string GetSaveGameDate2()	{ return GetSaveGameDate(2); }
function string GetSaveGameDate3()	{ return GetSaveGameDate(3); }
function string GetSaveGameDate4()	{ return GetSaveGameDate(4); }
function string GetSaveGameDate5()	{ return GetSaveGameDate(5); }
function string GetSaveGameDate6()	{ return GetSaveGameDate(6); }
function string GetSaveGameDate7()	{ return GetSaveGameDate(7); }
function string GetSaveGameDate8()	{ return GetSaveGameDate(8); }
function string GetSaveGameDate9()	{ return GetSaveGameDate(9); }

function string GetSaveGameDate(int Slot)
{
	local LevelDesc Desc;
	Desc = LevelDescCache[Slot];
	if(Desc?)	return Desc.SaveDate;
	else		return "";
}

function array<string> GetSaveGameDescription0()	{ return GetSaveGameDescription(0); }
function array<string> GetSaveGameDescription1()	{ return GetSaveGameDescription(1); }
function array<string> GetSaveGameDescription2()	{ return GetSaveGameDescription(2); }
function array<string> GetSaveGameDescription3()	{ return GetSaveGameDescription(3); }
function array<string> GetSaveGameDescription4()	{ return GetSaveGameDescription(4); }
function array<string> GetSaveGameDescription5()	{ return GetSaveGameDescription(5); }
function array<string> GetSaveGameDescription6()	{ return GetSaveGameDescription(6); }
function array<string> GetSaveGameDescription7()	{ return GetSaveGameDescription(7); }
function array<string> GetSaveGameDescription8()	{ return GetSaveGameDescription(8); }
function array<string> GetSaveGameDescription9()	{ return GetSaveGameDescription(9); }

function array<string> GetSaveGameDescription(int Slot)
{
	local int i;
	local array<string> Text;
	local LevelDesc Desc;

	Desc = LevelDescCache[Slot];

	if(Desc==None)
	{
		Text.length=1;
		Text[i++]="Description not available.";
	}
	else
	{
		Text.length=11;
		Text[i++]=Desc.Description;
		Text[i++]=Desc.Objectives;
		Text[i++]=" ";
		Text[i++]=Desc.SaveDate;
		Text[i++]="Health:"			@ Desc.Health;
		Text[i++]="Shields:"		@ Desc.Shields;
		Text[i++]="Weapons:"		@ Desc.Weapons;
		Text[i++]="Artifacts:"		@ Desc.Artifacts;
		Text[i++]="Complete:"		@ Desc.Complete;
		Text[i++]="Elapsed time:"	@ Desc.ElapsedTime;
		Text[i++]="Secrets:"		@ Desc.Secrets;
	}

	return Text;
}

function SaveGameSlot0()	{ SaveGameSlot(0); }	// Fix ARL: Ask user for confirmation.
function SaveGameSlot1()	{ SaveGameSlot(1); }
function SaveGameSlot2()	{ SaveGameSlot(2); }
function SaveGameSlot3()	{ SaveGameSlot(3); }
function SaveGameSlot4()	{ SaveGameSlot(4); }
function SaveGameSlot5()	{ SaveGameSlot(5); }
function SaveGameSlot6()	{ SaveGameSlot(6); }
function SaveGameSlot7()	{ SaveGameSlot(7); }
function SaveGameSlot8()	{ SaveGameSlot(8); }
function SaveGameSlot9()	{ SaveGameSlot(9); }

function QuickSave()		{ bNoResetMenus=true; SaveGameSlot(0); bNoResetMenus=false; }
function QuickLoad()		{ bNoResetMenus=true; LoadGameSlot(0); bNoResetMenus=false; }
function NULL();

function bool QuickLoadExists(){ return FileSize("..\\Save\\Save0.usa")>=0; }

function ResetMenus(){ if(!bNoResetMenus) class'UIConsole'.static.SendEvent("ResetMenus"); }

function SaveGameSlot(int Slot)
{
	local U2PlayerController	Player;
	local LevelInfo				Info;
	local LevelDesc				Desc;

	ResetMenus();

	Player = U2PlayerController(GetPlayerOwner());
	Info = Player.Level;
	Desc = Info.GetLevelDesc();

	Player.PauseAudio( false );

	ClearLoadCache(Desc);

	if (Desc.MapName=="")
		Desc.MapName="Untitled";
	else
		Desc.MapName=Player.Level.Game.GetCustomMapName( Desc.MapName );

	Desc.SaveDate		= ConstructDate(Info);
	Desc.Health			= Player.GetHealthString();
	Desc.Shields		= Player.GetPowerSuitPowerString() $"/"$ Player.GetPowerSuitMaxString();
	Desc.Weapons		= Player.GetWeaponString();
	Desc.Artifacts		= Player.GetArtifactString();
	Desc.Complete		= "not implemented";
	Desc.ElapsedTime	= string(Info.TimeSeconds);
	Desc.Secrets		= "not implemented";

	ConsoleCommand("SaveGame"@Slot);

	LoadLevelDescriptions();

	Player.UnPauseAudio();
}

function string ConstructDate( LevelInfo Info )
{
	local string Date,L,R;
	Date = Localize( "General", "DateFormat", "U2Menus" );

	if( Split( Date, "YEAR",   L, R ) ) Date = L $ PadNum(Info.Year)   $ R;
	if( Split( Date, "MONTH",  L, R ) ) Date = L $ PadNum(Info.Month)  $ R;
	if( Split( Date, "DAY",    L, R ) ) Date = L $ PadNum(Info.Day)    $ R;
	if( Split( Date, "HOUR",   L, R ) ) Date = L $ PadNum(Info.Hour)   $ R;
	if( Split( Date, "MINUTE", L, R ) ) Date = L $ PadNum(Info.Minute) $ R;
	if( Split( Date, "SECOND", L, R ) ) Date = L $ PadNum(Info.Second) $ R;

	return Date;
}

function string PadNum(int N){ if(N<10) return "0"$N; else return string(N); }
function string CurrentDate(){ return ConstructDate(GetPlayerOwner().Level); }

function LoadGameSlot0()	{ LoadGameSlot(0); }
function LoadGameSlot1()	{ LoadGameSlot(1); }
function LoadGameSlot2()	{ LoadGameSlot(2); }
function LoadGameSlot3()	{ LoadGameSlot(3); }
function LoadGameSlot4()	{ LoadGameSlot(4); }
function LoadGameSlot5()	{ LoadGameSlot(5); }
function LoadGameSlot6()	{ LoadGameSlot(6); }
function LoadGameSlot7()	{ LoadGameSlot(7); }
function LoadGameSlot8()	{ LoadGameSlot(8); }
function LoadGameSlot9()	{ LoadGameSlot(9); }

function LoadGameSlot(int Slot)
{
	GetPlayerOwner().StopSound( None ); // stop all sounds

	if (LevelDescCache[Slot]==None)	// make sure description is loaded (for cases like quick save which don't go through the load menu).
		LevelDescCache[Slot]=LevelDesc(DynamicLoadObject("Save"$Slot$".Description",class'LevelDesc'));
	if (LevelDescCache[Slot]!=None)
	{
		ResetMenus();
		GetPlayerOwner().ClientTravel("?load="$Slot,TRAVEL_Absolute,false);
	}
}

function texture GetSaveGameImage0()	{ return GetSaveGameImage(0); }
function texture GetSaveGameImage1()	{ return GetSaveGameImage(1); }
function texture GetSaveGameImage2()	{ return GetSaveGameImage(2); }
function texture GetSaveGameImage3()	{ return GetSaveGameImage(3); }
function texture GetSaveGameImage4()	{ return GetSaveGameImage(4); }
function texture GetSaveGameImage5()	{ return GetSaveGameImage(5); }
function texture GetSaveGameImage6()	{ return GetSaveGameImage(6); }
function texture GetSaveGameImage7()	{ return GetSaveGameImage(7); }
function texture GetSaveGameImage8()	{ return GetSaveGameImage(8); }
function texture GetSaveGameImage9()	{ return GetSaveGameImage(9); }

function texture GetSaveGameImage(int Slot)
{
	local LevelDesc Desc;
	local texture ScreenShot;
	Desc = LevelDescCache[Slot];
	if(Desc!=None)
		ScreenShot=Desc.ScreenShot;
	return ScreenShot;
}

/*
var InternetInfo Receiver;

function JoinFirstServer()					{ blah(); GetPlayerOwner().ConsoleCommand("open "$Receiver.GetBeaconAddress(0)); }
function string GetServerAddress( int i )	{ blah(); return Receiver.GetBeaconAddress(i); }
function string GetServerName( int i )		{ blah(); return Receiver.GetBeaconText(i); }

function array<string> GetBeaconAddressList() { blah(); return Receiver.GetBeaconAddressList(); }
function JoinServer( string S )				{ GetPlayerOwner().ConsoleCommand("open "$S); }

function blah()
{
	if( Receiver==None )
		Receiver = GetPlayerOwner().Spawn( class<InternetInfo>(DynamicLoadObject("IpDrv.ClientBeaconReceiver", class'Class')) );
}
*/

simulated function array<string> GetObjectives()
{
	return U2GameInfo(GetPlayerOwner().Level.Game).GetObjectives();
}

// Tutorial stuff

//!!ARL/MB (mdf) getting accessed nones with these...
function string TutorialGetPlayerName()		{ if( U2TutorialGameInfo(GetPlayerOwner().Level.Game) != None ) return U2TutorialGameInfo(GetPlayerOwner().Level.Game).GetPlayerName(); else return ""; }
function string TutorialGetOpponentName()	{ if( U2TutorialGameInfo(GetPlayerOwner().Level.Game) != None ) return U2TutorialGameInfo(GetPlayerOwner().Level.Game).GetOpponentName(); else return ""; }
function string TutorialGetPlayerScore()	{ if( U2TutorialGameInfo(GetPlayerOwner().Level.Game) != None ) return U2TutorialGameInfo(GetPlayerOwner().Level.Game).GetPlayerScoreStr(); else return ""; }
function string TutorialGetOpponentScore()	{ if( U2TutorialGameInfo(GetPlayerOwner().Level.Game) != None ) return U2TutorialGameInfo(GetPlayerOwner().Level.Game).GetOpponentScoreStr(); else return ""; }

defaultproperties
{
	EmptySlotText="Empty Slot"
	QuickSaveText="QuickSave:"
	ApplySettingsText="Applying settings..."
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:37.701 - Created with UnCodeX