Core.Object | +--Engine.Actor | +--Engine.Menu | +--UnrealShare.UnrealMenu | +--UnrealShare.UnrealLongMenu | +--UnrealShare.UnrealVideoMenu
string
AvailableRes
CurrentRes
LowText,
HighText
MenuValues[20]
SoundVol,
MusicVol
Resolutions[16]
bLowTextureDetail,
bLowSoundQuality
float
brightness
int
resNum
void
DrawMenu(Canvas Canvas)
GetAvailableRes()
bool
ProcessLeft()
ProcessRight()
ProcessSelection()
00001 //============================================================================= 00002 // UnrealVideoMenu 00003 //============================================================================= 00004 class UnrealVideoMenu extends UnrealLongMenu; 00005 00006 var float brightness; 00007 var string CurrentRes; 00008 var string AvailableRes; 00009 var string MenuValues[20]; 00010 var string Resolutions[16]; 00011 var localized string LowText, HighText; 00012 var int resNum; 00013 var int SoundVol, MusicVol; 00014 var bool bLowTextureDetail, bLowSoundQuality; 00015 00016 function bool ProcessLeft() 00017 { 00018 if ( Selection == 1 ) 00019 { 00020 Brightness = FMax(0.2, Brightness - 0.1); 00021 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager Brightness "$Brightness); 00022 PlayerOwner.ConsoleCommand("FLUSH"); 00023 return true; 00024 } 00025 else if ( Selection == 3 ) 00026 { 00027 ResNum--; 00028 if ( ResNum < 0 ) 00029 { 00030 ResNum = ArrayCount(Resolutions) - 1; 00031 While ( Resolutions[ResNum] == "" ) 00032 ResNum--; 00033 } 00034 MenuValues[3] = Resolutions[ResNum]; 00035 return true; 00036 } 00037 else if ( Selection == 5 ) 00038 { 00039 MusicVol = Max(0, MusicVol - 32); 00040 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice MusicVolume "$MusicVol); 00041 return true; 00042 } 00043 else if ( Selection == 6 ) 00044 { 00045 SoundVol = Max(0, SoundVol - 32); 00046 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice SoundVolume "$SoundVol); 00047 return true; 00048 } 00049 else if ( Selection == 4 ) 00050 { 00051 bLowTextureDetail = !bLowTextureDetail; 00052 if(bLowTextureDetail) 00053 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager TextureDetail Medium"); 00054 else 00055 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager TextureDetail High"); 00056 return true; 00057 } 00058 else if ( Selection == 7 ) 00059 { 00060 bLowSoundQuality = !bLowSoundQuality; 00061 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice LowSoundQuality "$bLowSoundQuality); 00062 return true; 00063 } 00064 else if ( Selection == 8 ) 00065 { 00066 PlayerOwner.bNoVoices = !PlayerOwner.bNoVoices; 00067 return true; 00068 } 00069 else if ( Selection == 9 ) 00070 { 00071 PlayerOwner.bMessageBeep = !PlayerOwner.bMessageBeep; 00072 return true; 00073 } 00074 00075 return false; 00076 } 00077 00078 function bool ProcessRight() 00079 { 00080 local string ParseString; 00081 local string FirstString; 00082 local int p; 00083 00084 if ( Selection == 1 ) 00085 { 00086 Brightness = FMin(1, Brightness + 0.1); 00087 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager Brightness "$Brightness); 00088 PlayerOwner.ConsoleCommand("FLUSH"); 00089 return true; 00090 } 00091 else if ( Selection == 3 ) 00092 { 00093 ResNum++; 00094 if ( (ResNum >= ArrayCount(Resolutions)) || (Resolutions[ResNum] == "") ) 00095 ResNum = 0; 00096 MenuValues[3] = Resolutions[ResNum]; 00097 return true; 00098 } 00099 else if ( Selection == 5 ) 00100 { 00101 MusicVol = Min(255, MusicVol + 32); 00102 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice MusicVolume "$MusicVol); 00103 return true; 00104 } 00105 else if ( Selection == 6 ) 00106 { 00107 SoundVol = Min(255, SoundVol + 32); 00108 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice SoundVolume "$SoundVol); 00109 return true; 00110 } 00111 else if ( Selection == 4 ) 00112 { 00113 bLowTextureDetail = !bLowTextureDetail; 00114 if(bLowTextureDetail) 00115 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager TextureDetail Medium"); 00116 else 00117 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager TextureDetail High"); 00118 return true; 00119 } 00120 else if ( Selection == 7 ) 00121 { 00122 bLowSoundQuality = !bLowSoundQuality; 00123 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice LowSoundQuality "$bLowSoundQuality); 00124 return true; 00125 } 00126 else if ( Selection == 8 ) 00127 { 00128 PlayerOwner.bNoVoices = !PlayerOwner.bNoVoices; 00129 return true; 00130 } 00131 else if ( Selection == 9 ) 00132 { 00133 PlayerOwner.bMessageBeep = !PlayerOwner.bMessageBeep; 00134 return true; 00135 } 00136 00137 return false; 00138 } 00139 00140 function bool ProcessSelection() 00141 { 00142 if ( Selection == 2 ) 00143 { 00144 PlayerOwner.ConsoleCommand("TOGGLEFULLSCREEN"); 00145 CurrentRes = PlayerOwner.ConsoleCommand("GetCurrentRes"); 00146 GetAvailableRes(); 00147 return true; 00148 } 00149 else if ( Selection == 3 ) 00150 { 00151 PlayerOwner.ConsoleCommand("SetRes "$MenuValues[3]); 00152 CurrentRes = PlayerOwner.ConsoleCommand("GetCurrentRes"); 00153 GetAvailableRes(); 00154 return true; 00155 } 00156 else if ( Selection == 4 ) 00157 { 00158 bLowTextureDetail = !bLowTextureDetail; 00159 if(bLowTextureDetail) 00160 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager TextureDetail Medium"); 00161 else 00162 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.ViewportManager TextureDetail High"); 00163 return true; 00164 } 00165 else if ( Selection == 7 ) 00166 { 00167 bLowSoundQuality = !bLowSoundQuality; 00168 PlayerOwner.ConsoleCommand("set ini:Engine.Engine.AudioDevice LowSoundQuality "$bLowSoundQuality); 00169 return true; 00170 } 00171 else if ( Selection == 8 ) 00172 { 00173 PlayerOwner.bNoVoices = !PlayerOwner.bNoVoices; 00174 return true; 00175 } 00176 else if ( Selection == 9 ) 00177 { 00178 PlayerOwner.bMessageBeep = !PlayerOwner.bMessageBeep; 00179 return true; 00180 } 00181 00182 return false; 00183 } 00184 00185 00186 function DrawMenu(canvas Canvas) 00187 { 00188 local int StartX, StartY, Spacing, i, HelpPanelX; 00189 00190 DrawBackGround(Canvas, (Canvas.ClipY < 250)); 00191 HelpPanelX = 228; 00192 00193 Spacing = Clamp(0.04 * Canvas.ClipY, 16, 32); 00194 StartX = Max(40, 0.5 * Canvas.ClipX - 120); 00195 00196 DrawTitle(Canvas); 00197 StartY = Max(36, 0.5 * (Canvas.ClipY - MenuLength * Spacing - 128)); 00198 00199 // draw text 00200 DrawList(Canvas, false, Spacing, StartX, StartY); 00201 00202 // draw icons 00203 Brightness = float(PlayerOwner.ConsoleCommand("get ini:Engine.Engine.ViewportManager Brightness")); 00204 DrawSlider(Canvas, StartX + 155, StartY + 1, (10 * Brightness - 2), 0, 1); 00205 00206 SoundVol = int(PlayerOwner.ConsoleCommand("get ini:Engine.Engine.AudioDevice SoundVolume")); 00207 MusicVol = int(PlayerOwner.ConsoleCommand("get ini:Engine.Engine.AudioDevice MusicVolume")); 00208 DrawSlider(Canvas, StartX + 155, StartY + 4*Spacing + 1, MusicVol, 0, 32); 00209 DrawSlider(Canvas, StartX + 155, StartY + 5*Spacing + 1, SoundVol, 0, 32); 00210 00211 if ( CurrentRes == "" ) 00212 GetAvailableRes(); 00213 else if ( AvailableRes == "" ) 00214 GetAvailableRes(); 00215 00216 SetFontBrightness( Canvas, (Selection == 3) ); 00217 Canvas.SetPos(StartX + 152, StartY + Spacing * 2); 00218 if ( MenuValues[3] ~= CurrentRes ) 00219 Canvas.DrawText("["$MenuValues[3]$"]", false); 00220 else 00221 Canvas.DrawText(" "$MenuValues[3], false); 00222 Canvas.DrawColor = Canvas.Default.DrawColor; 00223 00224 bLowTextureDetail = PlayerOwner.ConsoleCommand("get ini:Engine.Engine.ViewportManager TextureDetail") != "High"; 00225 00226 SetFontBrightness( Canvas, (Selection == 4) ); 00227 Canvas.SetPos(StartX + 152, StartY + Spacing * 3); 00228 if ( bLowTextureDetail ) 00229 Canvas.DrawText(LowText, false); 00230 else 00231 Canvas.DrawText(HighText, false); 00232 Canvas.DrawColor = Canvas.Default.DrawColor; 00233 00234 bLowSoundQuality = bool(PlayerOwner.ConsoleCommand("get ini:Engine.Engine.AudioDevice LowSoundQuality")); 00235 SetFontBrightness( Canvas, (Selection == 7) ); 00236 Canvas.SetPos(StartX + 152, StartY + Spacing * 6); 00237 if ( bLowSoundQuality ) 00238 Canvas.DrawText(LowText, false); 00239 else 00240 Canvas.DrawText(HighText, false); 00241 Canvas.DrawColor = Canvas.Default.DrawColor; 00242 00243 SetFontBrightness( Canvas, (Selection == 8) ); 00244 Canvas.SetPos(StartX + 152, StartY + Spacing * 7); 00245 Canvas.DrawText(!PlayerOwner.bNoVoices, false); 00246 00247 SetFontBrightness( Canvas, (Selection == 9) ); 00248 Canvas.SetPos(StartX + 152, StartY + Spacing * 8); 00249 Canvas.DrawText(PlayerOwner.bMessageBeep, false); 00250 00251 // Draw help panel 00252 DrawHelpPanel(Canvas, StartY + MenuLength * Spacing, HelpPanelX); 00253 } 00254 00255 function GetAvailableRes() 00256 { 00257 local int p,i; 00258 local string ParseString; 00259 00260 AvailableRes = PlayerOwner.ConsoleCommand("GetRes"); 00261 resNum = 0; 00262 ParseString = AvailableRes; 00263 p = InStr(ParseString, " "); 00264 while ( (ResNum < ArrayCount(Resolutions)) && (p != -1) ) 00265 { 00266 Resolutions[ResNum] = Left(ParseString, p); 00267 ParseString = Right(ParseString, Len(ParseString) - p - 1); 00268 p = InStr(ParseString, " "); 00269 ResNum++; 00270 } 00271 00272 Resolutions[ResNum] = ParseString; 00273 for ( i=ResNum+1; i< ArrayCount(Resolutions); i++ ) 00274 Resolutions[i] = ""; 00275 00276 CurrentRes = PlayerOwner.ConsoleCommand("GetCurrentRes"); 00277 MenuValues[3] = CurrentRes; 00278 for ( i=0; i< ResNum+1; i++ ) 00279 if ( MenuValues[3] ~= Resolutions[i] ) 00280 { 00281 ResNum = i; 00282 return; 00283 } 00284 00285 ResNum = 0; 00286 MenuValues[3] = Resolutions[0]; 00287 } 00288 00289 defaultproperties 00290 { 00291 LowText="Low" 00292 HighText="High" 00293 MenuLength=9 00294 HelpMessage(1)="Adjust display brightness using the left and right arrow keys." 00295 HelpMessage(2)="Display Unreal in a window. Note that going to a software display mode may remove high detail actors that were visible with hardware acceleration." 00296 HelpMessage(3)="Use the left and right arrows to select a resolution, and press enter to select this resolution." 00297 HelpMessage(4)="Use the low texture detail option to improve performance. Changes to this setting will take effect on the next level change." 00298 HelpMessage(5)="Adjust the volume of the music using the left and right arrow keys." 00299 HelpMessage(6)="Adjust the volume of sound effects in the game using the left and right arrow keys." 00300 HelpMessage(7)="Use the low sound quality option to improve performance on machines with 32 megabytes or less of memory. Changes to this setting will take effect on the next level change." 00301 HelpMessage(8)="If true, you will hear voice messages during gametypes that use them." 00302 HelpMessage(9)="If true, you will hear a beep when you receive a message." 00303 MenuList(1)="Brightness" 00304 MenuList(2)="Toggle Fullscreen Mode" 00305 MenuList(3)="Select Resolution" 00306 MenuList(4)="Texture Detail" 00307 MenuList(5)="Music Volume" 00308 MenuList(6)="Sound Volume" 00309 MenuList(7)="Sound Quality" 00310 MenuList(8)="Voice Messages" 00311 MenuList(9)="Message Beep" 00312 MenuTitle="AUDIO/VIDEO" 00313 }