├── .gitignore ├── .github └── pull_request_template.md ├── OpenRVS └── classes │ ├── OpenCheat.uc │ ├── OpenFOV.uc │ ├── OpenUbiLogIn.uc │ ├── OpenPopUp.uc │ ├── OpenPopUpWindow.uc │ ├── OpenString.uc │ ├── OpenPopUpContent.uc │ ├── OpenMenuInGameMultiPlayerRoot.uc │ ├── OpenHUD.uc │ ├── OpenRVS.uc │ ├── OpenLogger.uc │ ├── OpenTimer.uc │ ├── OpenCDKeyCheck.uc │ ├── OpenMenuIntelWidget.uc │ ├── OpenClientBeaconReceiver.uc │ ├── OpenMods.uc │ ├── OpenServer.uc │ ├── OpenJoinIP.uc │ ├── OpenOptionsGame.uc │ ├── OpenServerList.uc │ ├── OpenBeacon.uc │ ├── OpenHTTPClient.uc │ ├── OpenCustomMissionWidget.uc │ └── OpenMultiPlayerWidget.uc ├── openrvs.ini ├── OpenRenderFix └── classes │ ├── OpenFix.uc │ └── OpenRender.uc ├── Servers.list ├── RavenShield.mod ├── R6ClassDefines.ini ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | SDK156/ 2 | SDK160/ 3 | SDK16H/ 4 | sounds/ 5 | staticmeshes/ 6 | system/ 7 | textures/ -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Summary 2 | 3 | Edit this section to describe your changes. 4 | 5 | ## Testing 6 | 7 | I have tested my compiled build in the following scenarios: 8 | 9 | - [ ] A client running **my build** against a server running **latest stable version** 10 | - [ ] A client running **latest stable version** against a server running **my build** 11 | - [ ] A client running **my build** against a server running **my build** -------------------------------------------------------------------------------- /OpenRVS/classes/OpenCheat.uc: -------------------------------------------------------------------------------- 1 | class OpenCheat extends R6CheatManager; 2 | 3 | //v1.4 experimental 4 | //allows actor mods to use cmd 5 | //to use type in console: "cmd STRING" 6 | //and actors will receive in SetAttachVar: R6PC actor (cast to get var), STRING, '' 7 | 8 | //sends a command to mods 9 | exec function cmd(string s) 10 | { 11 | local Actor A; 12 | if ( CanExec() ) 13 | { 14 | foreach AllActors(class'Actor',A) 15 | { 16 | if ( A != none ) 17 | A.SetAttachVar(Outer,s,''); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenFOV.uc: -------------------------------------------------------------------------------- 1 | class OpenFOV extends Object config(openrvs); 2 | 3 | //can be used not just for FOV but also other things we need to load from multiple classes 4 | //a simple object that any class can create and use to load config variables 5 | 6 | var config int FieldOfView; 7 | var config string NewCheatManagerClass; 8 | 9 | function int GetFOV() 10 | { 11 | LoadConfig(); 12 | return FieldOfView; 13 | } 14 | 15 | function string GetCMClass() 16 | { 17 | LoadConfig(); 18 | return NewCheatManagerClass; 19 | } -------------------------------------------------------------------------------- /openrvs.ini: -------------------------------------------------------------------------------- 1 | [OpenRVS.OpenMultiPlayerWidget] 2 | ServerURL=api.openrvs.org 3 | ServerListURL=servers 4 | 5 | [OpenRVS.OpenMenuIntelWidget] 6 | bUseMPModsInSinglePlayer=True 7 | 8 | [OpenRVS.OpenMods] 9 | ForceStartMod= 10 | 11 | [OpenRVS.OpenFOV] 12 | FieldOfView=90 13 | NewCheatManagerClass= 14 | 15 | [OpenRVS.OpenOptionsGame] 16 | bUnlimited=False 17 | 18 | [OpenRVS.OpenHUD] 19 | DebugFPWeapRender=-90 20 | 21 | [OpenRenderFix.OpenRender] 22 | DebugFPWeapRender=-90 23 | 24 | [OpenRVS.OpenBeacon] 25 | RegistryServerHost=api.openrvs.org 26 | RegistryServerPort=8080 27 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenUbiLogIn.uc: -------------------------------------------------------------------------------- 1 | //fools the UBI ID window into thinking you successfully logged in 2 | //so you can select the Internet tab without any problems 3 | //installed client side 4 | class OpenUbiLogIn extends R6WindowUbiLogIn; 5 | 6 | //in 1.56 this is done in function Manager() 7 | //changed in 1.6 to processgsmsg 8 | function ProcessGSMsg (string _szMsg) 9 | { 10 | m_pR6UbiAccount.HideWindow(); 11 | m_pDisconnected.HideWindow(); 12 | HideWindow(); 13 | m_GameService.SaveConfig(); 14 | m_pSendMessageDest.SendMessage(MWM_UBI_LOGIN_SUCCESS); 15 | class'OpenLogger'.static.Debug("SUCCESSFULLY FAKED UBI LOGIN", self); 16 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenPopUp.uc: -------------------------------------------------------------------------------- 1 | class OpenPopUp extends Object; 2 | 3 | // A simple object that allows creation of a pop up box at any time, with no concrete references neede 4 | 5 | static function OpenPopUpWindow CreatePopUp(optional string sTitle,optional int iWidth,optional int iHeight) 6 | { 7 | local OpenPopUpWindow Window; 8 | local Canvas C; 9 | 10 | C = class'Actor'.static.GetCanvas(); 11 | if ( ( C == none ) || ( C.Viewport == none ) || ( C.Viewport.Console == none ) )//won't work on a server 12 | return none; 13 | Window = OpenPopUpWindow(R6Console(C.Viewport.Console).Root.CreateWindow(class'OpenPopUpWindow',0,0,640,480)); 14 | Window.BuildPopUp(sTitle,iWidth,iHeight); 15 | return Window; 16 | } 17 | -------------------------------------------------------------------------------- /OpenRenderFix/classes/OpenFix.uc: -------------------------------------------------------------------------------- 1 | class OpenFix extends Actor; 2 | 3 | //a server actor class that will ensure clients can choose their own FOV and have weapons render correctly 4 | //if the server already has a mod installed that requires a custom HUD, will not change it 5 | 6 | //POTENTIAL ISSUE 7 | //doesn't work in listen server? clients don't get a hud 8 | //most likely not an issue here, it would be with host having the regular OpenRVS fov fix 9 | 10 | simulated function PreBeginPlay() 11 | { 12 | local string s; 13 | //FP WEAP FOV FIX 14 | s = caps(class'Actor'.static.GetModMgr().m_pCurrentMod.m_GlobalHUDToSpawn); 15 | //if it's blank or if it's set to default, change 16 | if ( ( s == "" ) || ( s == "R6GAME.R6HUD" ) ) 17 | class'Actor'.static.GetModMgr().m_pCurrentMod.m_GlobalHUDToSpawn = "OpenRenderFix.OpenRender"; 18 | } 19 | 20 | defaultproperties 21 | { 22 | bHidden=true 23 | bAlwaysRelevant=true 24 | bAlwaysTick=true 25 | RemoteRole=ROLE_SimulatedProxy 26 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenPopUpWindow.uc: -------------------------------------------------------------------------------- 1 | class OpenPopUpWindow extends R6WindowPopUpBox; 2 | 3 | var OpenPopUpContent OpenClient; 4 | 5 | function BuildPopUp(optional string sTitle,optional int iWidth,optional int iHeight) 6 | { 7 | if ( sTitle == "" ) 8 | sTitle = "Please Note:"; 9 | if ( iWidth == 0 ) 10 | iWidth = 230; 11 | if ( iHeight == 0 ) 12 | iHeight = 140; 13 | CreateStdPopUpWindow(sTitle,30,320 - (iWidth / 2),240 - (iHeight / 2),iWidth,iHeight,2);//auto-centers the box based on width and height 14 | CreateClientWindow(class'OpenPopUpContent',false,true); 15 | OpenClient = OpenPopUpContent(m_ClientArea); 16 | m_ePopUpID = EPopUpID_UbiComDisconnected; 17 | } 18 | 19 | //pass to client window function 20 | //adds text to the popup 21 | function AddText(string s,optional bool bBlue) 22 | { 23 | OpenClient.AddText(s,bBlue); 24 | } 25 | 26 | //pass to client window function 27 | //creates a button that takes user to url at the bottom of the pop up 28 | function MakeURLButton(string url,optional string buttonText) 29 | { 30 | OpenClient.MakeURLButton(url,buttonText); 31 | } 32 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenString.uc: -------------------------------------------------------------------------------- 1 | class OpenString extends Object; 2 | 3 | // The native (string).Split() function is missing in this game. Replace it. 4 | // Only supports single-character separators. 5 | static function int Split(string input, string sep, out array fields) 6 | { 7 | local int i; 8 | local bool done; 9 | 10 | fields.Remove(0, fields.Length); 11 | while (!done) { 12 | i = InStr(input, sep); 13 | if (i != -1)//sep is present, there are more fields 14 | { 15 | fields[fields.Length] = Mid(input, 0, i);//save the field text 16 | input = Mid(input, i+1);//trim the string for the next iteration 17 | } 18 | else//final field 19 | { 20 | if (Len(input) > 0) 21 | fields[fields.Length] = input; 22 | done = true; 23 | } 24 | } 25 | 26 | return fields.Length; 27 | } 28 | 29 | // Replaces '"text"' with 'text'. 30 | static function string StripQuotes(string s) 31 | { 32 | return Mid(s, 1, Len(s)-2); 33 | } 34 | 35 | // replaces "replace" with "with" in "Text" 36 | // this function exists in Actor.uc but is not static and thus not available to non-actor objects 37 | // thus, added here 38 | static function string ReplaceText(string Text, string Replace, string With) 39 | { 40 | local int i; 41 | local string Input; 42 | 43 | Input = Text; 44 | Text = ""; 45 | i = InStr(Input, Replace); 46 | while ( i != -1 ) 47 | { 48 | Text = Text $ Left(Input, i) $ With; 49 | Input = Mid(Input, i + Len(Replace)); 50 | i = InStr(Input, Replace); 51 | } 52 | Text = Text $ Input; 53 | return Text; 54 | } 55 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenPopUpContent.uc: -------------------------------------------------------------------------------- 1 | class OpenPopUpContent extends UWindowDialogClientWindow; 2 | 3 | var R6WindowWrappedTextArea wTextBox; 4 | var R6WindowButton butURL; 5 | var string urlString; 6 | var float fMargin; 7 | 8 | function MakeTextBox() 9 | { 10 | wTextBox = R6WindowWrappedTextArea(CreateWindow(class'R6WindowWrappedTextArea',fMargin,fMargin,WinWidth-(fMargin*2),WinHeight-(fMargin*2),self)); 11 | wTextBox.m_bDrawBorders = false; 12 | wTextBox.SetScrollable(true); 13 | wTextBox.VertSB.SetBorderColor(Root.Colors.GrayLight); 14 | wTextBox.VertSB.SetHideWhenDisable(true); 15 | wTextBox.VertSB.SetEffect(true); 16 | } 17 | 18 | function AddText(string s,optional bool bBlue) 19 | { 20 | local color c; 21 | if ( bBlue ) 22 | c = Root.Colors.BlueLight; 23 | else 24 | c = Root.Colors.White; 25 | if ( wTextBox == none ) 26 | MakeTextBox(); 27 | wTextBox.AddText(s,c,Root.Fonts[F_VerySmallTitle]); 28 | } 29 | 30 | function MakeURLButton(string url,optional string buttonText) 31 | { 32 | if ( url == "" ) 33 | return; 34 | if ( buttonText == "" ) 35 | buttonText = url; 36 | butURL = R6WindowButton(CreateControl(class'R6WindowButton',0,WinHeight-20,WinWidth,16,self));//todo - button could overlap text box bottom 37 | butURL.Text = buttonText; 38 | butURL.Align = TA_CENTER; 39 | butURL.m_buttonFont = Root.Fonts[F_VerySmallTitle]; 40 | butURL.ResizeToText(); 41 | urlString = url; 42 | } 43 | 44 | //handles clicking on buttons 45 | function Notify(UWindowDialogControl C,byte E) 46 | { 47 | if ( E == DE_Click ) 48 | { 49 | if ( urlString != "" ) 50 | { 51 | if ( C == butURL ) 52 | { 53 | Root.Console.ConsoleCommand("startminimized"@urlString); 54 | } 55 | } 56 | } 57 | } 58 | 59 | defaultproperties 60 | { 61 | fMargin=4.0 62 | } 63 | -------------------------------------------------------------------------------- /Servers.list: -------------------------------------------------------------------------------- 1 | [OpenRVS.OpenServerList] 2 | FallbackServers=(ServerName="ALLR6 | AthenaSword+IronWrath",IP="104.243.46.138:7779",GameMode="coop") 3 | FallbackServers=(ServerName="ALLR6 | Original Maps Only",IP="104.243.46.138:9777",GameMode="coop") 4 | FallbackServers=(ServerName="ALLR6 | Tango Hunt 1",IP="162.248.92.181:7780",GameMode="coop") 5 | FallbackServers=(ServerName="ALLR6 | Tango Hunt 2",IP="162.248.92.181:7788",GameMode="coop") 6 | FallbackServers=(ServerName="ALLR6 | Tango Hunt 3",IP="162.248.92.181:7778",GameMode="coop") 7 | FallbackServers=(ServerName="ALLR6.com | Missions +",IP="162.248.92.181:7779",GameMode="coop") 8 | FallbackServers=(ServerName="ALLR6.com | RVS Campaign",IP="162.248.92.181:7789",GameMode="coop") 9 | FallbackServers=(ServerName="DMM Adversarial Server",IP="208.70.251.154:7778",GameMode="Adver") 10 | FallbackServers=(ServerName="DMM Tango Hunters",IP="208.70.251.154:7777",GameMode="coop") 11 | FallbackServers=(ServerName="IEF Everything Server",IP="121.127.40.41:7777",GameMode="Adver") 12 | FallbackServers=(ServerName="OBSOLETESUPERSTARS.COM",IP="172.93.104.79:7877",GameMode="coop") 13 | FallbackServers=(ServerName="OpenRVS.org Test Server",IP="184.73.85.28:6776",GameMode="coop") 14 | FallbackServers=(ServerName="RLC RUSH - 100 TANGOS",IP="75.188.142.62:7777",GameMode="Adver") 15 | FallbackServers=(ServerName="iD|Adversarial Server",IP="104.238.220.182:7777",GameMode="Adver") 16 | FallbackServers=(ServerName="|-HkM-| After Party House",IP="104.238.222.81:7777",GameMode="Adver") 17 | FallbackServers=(ServerName="|-HkM-| Japan Server",IP="178.249.213.236:7777",GameMode="Adver") 18 | FallbackServers=(ServerName="|-HkM-| The Party House",IP="64.44.61.101:7777",GameMode="Adver") 19 | FallbackServers=(ServerName="SMC Suppressed Action",IP="185.24.221.23:7778",GameMode="coop") 20 | FallbackServers=(ServerName="SMC Suppressed Stealth",IP="185.24.221.23:7777",GameMode="coop") -------------------------------------------------------------------------------- /OpenRVS/classes/OpenMenuInGameMultiPlayerRoot.uc: -------------------------------------------------------------------------------- 1 | //fixes disappearing server list 2 | //implements custom FOV 3 | //IMPORTANT - weapon will render inaccurately at custom FOV unless server implements Render Fix! 4 | 5 | class OpenMenuInGameMultiPlayerRoot extends R6MenuInGameMultiPlayerRootWindow; 6 | 7 | var int Count; 8 | var int FOV; 9 | var OpenFOV OpenFOV; 10 | 11 | //1.0 - fixes the disappearing server list, makes the escape menu just use disconnect console command 12 | function PopUpBoxDone(MessageBoxResult Result,ePopUpID _ePopUpID) 13 | { 14 | if ( Result == MR_OK ) 15 | { 16 | if ( _ePopUpID == EPopUpID_LeaveInGameToMultiMenu ) 17 | { 18 | R6Console(Root.console).ConsoleCommand("disconnect"); 19 | return; 20 | } 21 | } 22 | super.PopUpBoxDone(Result,_ePopUpID); 23 | } 24 | 25 | //1.4 FOV 26 | //a function that will let us load custom fov 27 | function ChangeCurrentWidget( eGameWidgetID widgetID ) 28 | { 29 | super.ChangeCurrentWidget(widgetID); 30 | if ( FOV == 0 ) 31 | { 32 | OpenFOV = new class'OpenFOV'; 33 | FOV = OpenFOV.GetFOV(); 34 | if ( FOV != 0 ) 35 | FOV = clamp(FOV,65,140); 36 | OpenFOV = none; 37 | } 38 | } 39 | 40 | //1.4 FOV 41 | //force new FOV so we don't start first round with 42 | function Paint(Canvas C,float X,float Y) 43 | { 44 | if ( ( FOV != 0 ) && ( GetPlayerOwner() != none ) && ( R6PlayerController(GetPlayerOwner()) != none ) ) 45 | { 46 | if ( R6PlayerController(GetPlayerOwner()).default.DefaultFOV != FOV ) 47 | { 48 | R6PlayerController(GetPlayerOwner()).default.DefaultFOV = FOV; 49 | R6PlayerController(GetPlayerOwner()).default.DesiredFOV = FOV; 50 | } 51 | //this section to fix spawning first round with 90 FOV 52 | if ( ( R6PlayerController(GetPlayerOwner()).DefaultFOV != FOV ) && ( !R6PlayerController(GetPlayerOwner()).m_bHelmetCameraOn ) ) 53 | { 54 | R6PlayerController(GetPlayerOwner()).DefaultFOV = FOV; 55 | R6PlayerController(GetPlayerOwner()).DesiredFOV = FOV; 56 | } 57 | } 58 | super.Paint(C,X,Y); 59 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenHUD.uc: -------------------------------------------------------------------------------- 1 | class OpenHUD extends R6HUD config(openrvs); 2 | 3 | //new in v1.4 4 | //implements weapon fov fix from supply drop 5 | 6 | //weapon rendering 7 | var config float DebugFPWeapRender; 8 | 9 | //debug set fov rendering for weapon 10 | exec function SetWeapFOV(float f) 11 | { 12 | DebugFPWeapRender = f; 13 | SaveConfig(); 14 | PlayerOwner.ClientMessage("DebugFPWeapRender="$DebugFPWeapRender); 15 | } 16 | 17 | simulated event RenderFirstPersonGun(Canvas C) 18 | { 19 | local R6Pawn P; 20 | local R6Weapons W; 21 | local R6PlayerController PC; 22 | local float g; 23 | local rotator rNewRotation; 24 | if ( !PlayerOwner.bBehindView ) 25 | { 26 | P = R6Pawn(PlayerOwner.ViewTarget); 27 | PC = R6PlayerController(PlayerOwner); 28 | if ( ( P != none ) && ( PC != none ) && ( R6Weapons(P.EngineWeapon) != none ) ) 29 | { 30 | W = R6Weapons(P.EngineWeapon); 31 | if ( ( DebugFPWeapRender != 0.0 ) && ( !Level.m_bInGamePlanningActive ) && ( PC.m_bUseFirstPersonWeapon ) && ( W.m_FPHands != none ) ) 32 | { 33 | W.m_FPHands.SetLocation(P.R6CalcDrawLocation(P.EngineWeapon,rNewRotation,P.EngineWeapon.m_vPositionOffset)); 34 | W.m_FPHands.SetRotation(P.GetViewRotation() + rNewRotation + PC.m_rHitRotation); 35 | if ( PC.ShouldDrawWeapon() ) 36 | { 37 | //IF DEBUGFPWEAPRENDER IS NEGATIVE 38 | //then the gun fov will be modified by the zoom level 39 | //this is default behaviour and what we want 40 | //ELSE 41 | //it will always render at a static fov 42 | if ( DebugFPWeapRender < -0.0 )//render at DebugFPWeapRender (modified by zoom) 43 | g = ( PlayerOwner.DefaultFOV * DebugFPWeapRender * -1 ) / PlayerOwner.default.DesiredFOV; 44 | else//render at DebugFPWeapRender (not modified) 45 | g = DebugFPWeapRender; 46 | C.DrawActor(W.m_FPHands,false,true,g); 47 | } 48 | } 49 | else 50 | P.EngineWeapon.RenderOverlays(C);//default vanilla ubi behaviour 51 | } 52 | } 53 | } 54 | 55 | defaultproperties 56 | { 57 | DebugFPWeapRender=-90.0 58 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenRVS.uc: -------------------------------------------------------------------------------- 1 | class OpenRVS extends Object; 2 | 3 | const OPENRVS_VERSION = "v1.6"; 4 | // This URL returns the latest release version from GitHub over HTTP. 5 | const LATEST_VERSION_URL = "http://api.openrvs.org/latest"; 6 | 7 | var OpenHTTPClient httpc; 8 | 9 | // Init contains the first OpenRVS code which runs. It has a different call 10 | // location for clients and servers. Clients call Init from 11 | // OpenCustomMissionWidget, while servers call Init from OpenServer. 12 | function Init(Actor a) 13 | { 14 | class'OpenLogger'.static.LogStartupMessage(); 15 | 16 | // Fire off version-checking request. 17 | httpc = a.Spawn(class'OpenHTTPClient'); 18 | httpc.CallbackName = "version_check"; 19 | httpc.VersionCheckCallbackProvider = self; 20 | httpc.SendRequest(LATEST_VERSION_URL); 21 | } 22 | 23 | function CheckVersion(OpenHTTPClient.HttpResponse resp) 24 | { 25 | local string latest; 26 | local string warning; 27 | local OpenPopUpWindow WarningWindow; 28 | 29 | if (resp.Code != 200) 30 | { 31 | class'OpenLogger'.static.Error("failed to retrieve latest version over http", self); 32 | return; 33 | } 34 | 35 | // Trim the line break. 36 | latest = resp.Body; 37 | // latest = Left(latest, Len(latest)-1);//WHAT IS THIS? No line break, just trims the 4 out of "v1.4" 38 | 39 | // Log version information to file. 40 | // TODO: Also display a popup. 41 | if (OPENRVS_VERSION != latest) 42 | { 43 | warning = "Your copy of the OpenRVS patch is outdated. Your version:" @ OPENRVS_VERSION $ ", latest version:" @ latest; 44 | class'OpenLogger'.static.Warning(warning, self); 45 | //v1.5 - add pop up box notification to main menu 46 | WarningWindow = class'OpenPopUp'.static.CreatePopUp("OpenRVS Patch Check"); 47 | WarningWindow.AddText("Please note:"); 48 | WarningWindow.AddText(warning); 49 | WarningWindow.AddText("Click the link below to download the latest update."); 50 | WarningWindow.AddText(""); 51 | WarningWindow.MakeURLButton("https://www.moddb.com/search?q=openrvs","Download from ModDB"); 52 | } 53 | else 54 | class'OpenLogger'.static.Info("OpenRVS is up to date (" $ latest $ ")", self); 55 | } 56 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenLogger.uc: -------------------------------------------------------------------------------- 1 | // OpenLogger writes leveled logs to \system\ravenshield.log. 2 | class OpenLogger extends Object; 3 | 4 | const LOG_LEVEL_ERROR = "error"; 5 | const LOG_LEVEL_WARNING = "warning"; 6 | const LOG_LEVEL_INFO = "info"; 7 | const LOG_LEVEL_DEBUG = "debug"; 8 | 9 | const MAX_LOG_LEN = 512; 10 | 11 | // Use Error() when something went wrong. 12 | static function Error(string s, optional Object o) 13 | { 14 | writeMsg(s, LOG_LEVEL_ERROR, o); 15 | } 16 | 17 | // Use Warning() when something went wrong, but we can proceed safely. 18 | static function Warning(string s, optional Object o) 19 | { 20 | writeMsg(s, LOG_LEVEL_WARNING, o); 21 | } 22 | 23 | // Use Info() for general messages. 24 | static function Info(string s, optional Object o) 25 | { 26 | writeMsg(s, LOG_LEVEL_INFO, o); 27 | } 28 | 29 | // Use Debug() for messages only developers should see. 30 | // Disable debug logging for releases by changing the default property below. 31 | static function Debug(string s, optional Object o) 32 | { 33 | local bool debugMode; 34 | debugMode = false;//WARNING: Set to false before building releases for users! 35 | if (debugMode) 36 | writeMsg(s, LOG_LEVEL_DEBUG, o); 37 | } 38 | 39 | // writeMsg consistently formats OpenRVS logs, prepending the name of the caller 40 | // class. For example: "[OpenRVS.OpenLogger] info: this is a log message". 41 | static function writeMsg(string s, string level, optional Object o) 42 | { 43 | // Format our log lines. 44 | if (o != none) 45 | s = "[" $ o.class $ "]" @ level $ ":" @ s; 46 | else 47 | s = "[OpenRVS]" @ level $ ":" @ s; 48 | 49 | // Enforce a maximum length. Calling log() with input longer than 990 bytes 50 | // appears to cause a full engine crash. Limit lines to 512 bytes and wrap 51 | // content beyond that length. 52 | while (Len(s) > MAX_LOG_LEN) 53 | { 54 | log(Left(s, MAX_LOG_LEN));//write 512 bytes 55 | s = Mid(s, MAX_LOG_LEN);//trim for next iteration 56 | } 57 | log(s);//write remaining bytes 58 | } 59 | 60 | // Prints the OpenRVS startup message to the log file. 61 | static function LogStartupMessage() 62 | { 63 | log(" ---- OpenRVS ----"); 64 | log(" The team: Twi, Will, and Tony");//v1.5 update name 65 | log(" With thanks to chriswak, Psycho, SMC clan, and SS clan"); 66 | } -------------------------------------------------------------------------------- /OpenRenderFix/classes/OpenRender.uc: -------------------------------------------------------------------------------- 1 | class OpenRender extends R6HUD config(openrvs); 2 | 3 | //new in v1.4 4 | //implements weapon fov fix from supply drop in MP 5 | 6 | //weapon rendering 7 | var config float DebugFPWeapRender; 8 | 9 | //debug set fov rendering for weapon 10 | exec function SetWeapFOV(float f) 11 | { 12 | DebugFPWeapRender = f; 13 | SaveConfig(); 14 | PlayerOwner.ClientMessage("DebugFPWeapRender="$DebugFPWeapRender); 15 | } 16 | 17 | simulated event RenderFirstPersonGun(Canvas C) 18 | { 19 | local R6Pawn P; 20 | local R6Weapons W; 21 | local R6PlayerController PC; 22 | local float g; 23 | local rotator rNewRotation; 24 | if ( !PlayerOwner.bBehindView )//not in behind view 25 | { 26 | P = R6Pawn(PlayerOwner.ViewTarget); 27 | PC = R6PlayerController(PlayerOwner); 28 | if ( ( P != none ) && ( PC != none ) && ( R6Weapons(P.EngineWeapon) != none ) )//have a pawn and a gun 29 | { 30 | W = R6Weapons(P.EngineWeapon); 31 | 32 | //0 is inactive - render at world FOV 33 | if ( ( DebugFPWeapRender != 0.0 ) && ( !Level.m_bInGamePlanningActive ) && ( PC.m_bUseFirstPersonWeapon ) && ( W.m_FPHands != none ) ) 34 | { 35 | //do the fp position calculation 36 | W.m_FPHands.SetLocation(P.R6CalcDrawLocation(P.EngineWeapon,rNewRotation,P.EngineWeapon.m_vPositionOffset)); 37 | W.m_FPHands.SetRotation(P.GetViewRotation() + rNewRotation + PC.m_rHitRotation); 38 | if ( PC.ShouldDrawWeapon() ) 39 | { 40 | //IF DEBUGFPWEAPRENDER IS NEGATIVE 41 | //then the gun fov will be modified by the zoom level 42 | //this is default behaviour and what we want 43 | //ELSE 44 | //it will always render at a static fov 45 | if ( DebugFPWeapRender < -0.0 ) 46 | g = ( PlayerOwner.DefaultFOV * DebugFPWeapRender * -1 ) / PlayerOwner.default.DesiredFOV;//render at DebugFPWeapRender (modified by zoom) 47 | else 48 | g = DebugFPWeapRender;//render at DebugFPWeapRender (not modified) 49 | C.DrawActor(W.m_FPHands,false,true,g);//call DrawActor() with the fov as an argument 50 | } 51 | } 52 | else 53 | P.EngineWeapon.RenderOverlays(C);//this is the default vanilla RVS behaviour 54 | } 55 | } 56 | } 57 | 58 | defaultproperties 59 | { 60 | DebugFPWeapRender=-90.0 61 | } 62 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenTimer.uc: -------------------------------------------------------------------------------- 1 | // OpenTimer provides convenience functions for measuring how long things take 2 | // Example usage: 3 | // var OpenTimer Timer; 4 | // var int Duration; 5 | // Timer = new class'OpenTimer'; 6 | // Timer.ClockSource = GetEntryLevel();//Level provides clock 7 | // Timer.StartTimer("my-timer-id"); 8 | // Duration = Timer.EndTimer("my-timer-id"); 9 | // Timer IDs are unique. Attempting to create a timer with a repeat ID will not 10 | // overwrite the existing timer (reusing its start time). 11 | // When a Timer is ended, its data is deleted from the set. 12 | // Timers store an array of Timings and a copy of the current level. These are 13 | // both reused and should not be set to None after use. Instead, set your Timer 14 | // instance to None when finished with timings. 15 | class OpenTimer extends Object; 16 | 17 | // Timing correlates a start time with a user-provided ID 18 | struct Timing 19 | { 20 | var transient string ID;//unique id for this timing, e.g. an IP address 21 | var transient int StartTime; 22 | }; 23 | 24 | const ERR_VALUE = -1; 25 | 26 | // Timings stores all timers in the class object 27 | var private array Timings; 28 | var LevelInfo ClockSource; 29 | 30 | // Start the clock 31 | function StartTimer(string id) 32 | { 33 | local Timing t; 34 | local LevelInfo now; 35 | local int i; 36 | 37 | // Prevent writes for duplicate timings. 38 | for ( i=0; i AMod; 19 | local Actor A; 20 | local bool bFound; 21 | local class CheatClass;//1.4 22 | local string s;//1.4 23 | local class CustomPC;//1.4 24 | super.ShowWindow(); 25 | LoadConfig(); 26 | if ( bUseMPModsInSinglePlayer ) 27 | { 28 | class'OpenLogger'.static.Info("experimental MP mods feature enabled", self); 29 | i = 0; 30 | GE = GameEngine(FindObject("Transient.GameEngine0",class'GameEngine')); 31 | if ( GE == none ) 32 | return; 33 | GE.LoadConfig("..\\Mods\\" $ class'Actor'.static.GetModMgr().GetModKeyword() $ ".mod"); 34 | while ( i < GE.ServerActors.length ) 35 | { 36 | if ( ( InStr(caps(GE.ServerActors[i]),"OPENRVS") == -1 ) && ( InStr(caps(GE.ServerActors[i]),"IPDRV") == -1 ) ) 37 | AMod = class(DynamicLoadObject(GE.ServerActors[i],class'class')); 38 | if ( AMod != none ) 39 | { 40 | bFound = false; 41 | foreach GetLevel().AllActors(class'Actor',A) 42 | { 43 | if ( A != none ) 44 | { 45 | if ( A.class == AMod ) 46 | bFound = true; 47 | } 48 | } 49 | if ( !bFound ) 50 | { 51 | GetLevel().spawn(AMod); 52 | class'OpenLogger'.static.Info("using multiplayer mod " $ AMod $ " in single-player ...", self); 53 | } 54 | } 55 | AMod = none; 56 | i++; 57 | } 58 | } 59 | //1.4 60 | //this section duplicated in OpenMods 61 | //in case a mod or map skips planning, this here won't run 62 | OpenFOV = new class'OpenFOV'; 63 | FOV = OpenFOV.GetFOV(); 64 | NewCheatManagerClass = OpenFOV.GetCMClass(); 65 | OpenFOV = none; 66 | if ( FOV != 0 ) 67 | { 68 | FOV = clamp(FOV,65,140); 69 | class'R6PlayerController'.default.DefaultFOV = FOV; 70 | class'R6PlayerController'.default.DesiredFOV = FOV; 71 | } 72 | if ( NewCheatManagerClass == "" ) 73 | CheatClass = class'OpenCheat'; 74 | else 75 | { 76 | CheatClass = class(DynamicLoadObject(NewCheatManagerClass,class'Class')); 77 | if ( CheatClass == none ) 78 | CheatClass = class'OpenCheat'; 79 | } 80 | class'OpenLogger'.static.Debug("OpenRVS experimental SP manager set to: "$CheatClass, self); 81 | class'R6PlayerController'.default.CheatClass = CheatClass; 82 | s = caps(class'Actor'.static.GetModMgr().m_pCurrentMod.m_PlayerCtrlToSpawn); 83 | if ( ( s != "" ) && ( InStr(s,"R6ENGINE.") == -1 ) )//mod has custom pc 84 | { 85 | CustomPC = class(DynamicLoadObject(class'Actor'.static.GetModMgr().m_pCurrentMod.m_PlayerCtrlToSpawn,class'Class')); 86 | if ( CustomPC != none ) 87 | { 88 | CustomPC.default.CheatClass = CheatClass; 89 | class'OpenLogger'.static.Debug("OpenRVS experimental SP manager set for: " $ CustomPC, self); 90 | if ( FOV != 0 ) 91 | { 92 | FOV = clamp(FOV,65,140); 93 | CustomPC.default.DefaultFOV = FOV; 94 | CustomPC.default.DesiredFOV = FOV; 95 | } 96 | } 97 | } 98 | //FP WEAP FOV FIX 99 | s = caps(class'Actor'.static.GetModMgr().m_pCurrentMod.m_GlobalHUDToSpawn); 100 | if ( ( s == "" ) || ( s == "R6GAME.R6HUD" ) ) 101 | class'Actor'.static.GetModMgr().m_pCurrentMod.m_GlobalHUDToSpawn = "OpenRVS.OpenHUD"; 102 | } -------------------------------------------------------------------------------- /R6ClassDefines.ini: -------------------------------------------------------------------------------- 1 | [UWindow.UWindowMenuClassDefines] 2 | ClassMPServerOption=class'R6Menu.R6MenuMPServerOption' 3 | ClassButtonsDefines=class'R6Menu.R6MenuButtonsDefines' 4 | 5 | ; root 6 | RegularRoot=R6Menu.R6MenuRootWindow 7 | InGameSingleRoot=R6Menu.R6MenuInGameRootWindow 8 | 9 | ; Tab 10 | ClassMPCreateGameTabOpt=class'R6Menu.R6MenuMPCreateGameTabOptions' 11 | ClassMPCreateGameTabAdvOpt=class'R6Menu.R6MenuMPCreateGameTabAdvOptions' 12 | ClassMPMenuTabGameModeFilters=class'R6Menu.R6MenuMPMenuTab' 13 | 14 | ; Widget 15 | ClassMainWidget=class'R6Menu.R6MenuMainWidget' 16 | ClassExecuteWidget=class'R6Menu.R6MenuExecuteWidget' 17 | ClassPlanningWidget=class'R6Menu.R6MenuPlanningWidget' 18 | ClassSinglePlayerWidget=class'R6Menu.R6MenuSinglePlayerWidget' 19 | ClassTrainingWidget=class'R6Menu.R6MenuTrainingWidget' 20 | ClassOptionsWidget=class'R6Menu.R6MenuOptionsWidget' 21 | ClassCreditsWidget=class'R6Menu.R6MenuCreditsWidget' 22 | ClassGearWidget=class'R6Menu.R6MenuGearWidget' 23 | ClassMPCreateGameWidget=class'R6Menu.R6MenuMPCreateGameWidget' 24 | ClassUbiComWidget=class'R6Menu.R6MenuUbiComWidget' 25 | ClassNonUbiComWidget=class'R6Menu.R6MenuNonUbiWidget' 26 | ClassQuitWidget=class'R6MenuQuit' 27 | 28 | ClassActionPointPupUpMenu=class'R6Menu.R6MenuActionPointMenu' 29 | ClassMovementModePupUpMenu=class'R6Menu.R6MenuModeMenu' 30 | 31 | ; servers related 32 | ClassGSServer=class'R6GameService.R6GSServers' 33 | ClassLanServer=class'R6GameService.R6LanServers' 34 | 35 | ; Ubi.com, CD-Key and game service related 36 | ClassQueryServerInfo=class'R6Window.R6WindowQueryServerInfo' 37 | ClassUbiLoginClient=class'R6Window.R6WindowUbiLoginClient' 38 | 39 | ; Multiplayer menus 40 | ClassWritableMapWidget=class'R6Menu.R6MenuInGameWritableMapWidget' 41 | ClassJoinTeamWidget=class'R6Menu.R6MenuMPJoinTeamWidget' 42 | ClassInterWidget=class'R6Menu.R6MenuMPInterWidget' 43 | ClassInGameEsc=class'R6Menu.R6MenuMPInGameEsc' 44 | ClassInGameRecMessages=class'R6Menu.R6MenuMPInGameRecMessages' 45 | ClassInGameMsgOffensive=class'R6Menu.R6MenuMPInGameMsgOffensive' 46 | ClassInGameMsgDefensive=class'R6Menu.R6MenuMPInGameMsgDefensive' 47 | ClassInGameMsgReply=class'R6Menu.R6MenuMPInGameMsgReply' 48 | ClassInGameMsgStatus=class'R6Menu.R6MenuMPInGameMsgStatus' 49 | ClassInGameVote=class'R6Menu.R6MenuMPInGameVote' 50 | ClassInGameOptionsWidget=class'R6Menu.R6MenuOptionsWidget' 51 | ClassCountDown=class'R6Menu.R6MenuMPCountDown' 52 | ClassInGameOperativeSelectorWidget=class'R6Menu.R6MenuInGameOperativeSelectorWidget' 53 | ClassInGameObjectives=class'R6Menu.R6MenuMPInGameObj' 54 | ClassInGameEscNavBar=class'R6Menu.R6MenuMPInGameEscNavBar' 55 | ClassGameMenuCom=class'R6Menu.R6MPGameMenuCom' 56 | ClassMenuCDKeyManager=class'R6Menu.R6MenuCDKeyManager' 57 | 58 | ; Options menus 59 | ClassOptionsSound=class'R6Menu.R6MenuOptionsSound'; 60 | ClassOptionsGraphic=class'R6Menu.R6MenuOptionsGraphic'; 61 | ClassOptionsHud=class'R6Menu.R6MenuOptionsHud'; 62 | ClassOptionsMulti=class'R6Menu.R6MenuOptionsMulti'; 63 | ClassOptionsControls=class'R6Menu.R6MenuOptionsControls'; 64 | ClassOptionsPatchService=class'R6Menu.R6MenuOptionsPatchService'; 65 | 66 | ; UBI's default settings 67 | //ClassMultiJoinIP=class'R6Window.R6WindowJoinIP' 68 | //ClassUbiLogIn=class'R6Window.R6WindowUbiLogIn' 69 | //ClassMultiPlayerWidget=class'R6Menu.R6MenuMultiPlayerWidget' 70 | //ClassUbiCDKeyCheck=class'R6Window.R6WindowUbiCDKeyCheck' 71 | //InGameMultiRoot=R6Menu.R6MenuInGameMultiPlayerRootWindow 72 | //ClassOptionsMOD=class'R6Menu.R6MenuOptionsMODS'; 73 | //ClassIntelWidget=class'R6Menu.R6MenuIntelWidget' 74 | //ClassCustomMissionWidget=class'R6Menu.R6MenuCustomMissionWidget' 75 | //ClassOptionsGame=class'R6Menu.R6MenuOptionsGame' 76 | 77 | ; OpenRVS multiplayer patch settings 78 | ClassMultiJoinIP=class'OpenRVS.OpenJoinIP' 79 | ClassUbiLogIn=class'OpenRVS.OpenUbiLogIn' 80 | ClassUbiCDKeyCheck=class'OpenRVS.OpenCDKeyCheck' 81 | ClassMultiPlayerWidget=class'OpenRVS.OpenMultiPlayerWidget' 82 | InGameMultiRoot=OpenRVS.OpenMenuInGameMultiPlayerRoot 83 | ClassOptionsMOD=class'OpenRVS.OpenMods' 84 | ClassIntelWidget=class'OpenRVS.OpenMenuIntelWidget' 85 | ClassCustomMissionWidget=class'OpenRVS.OpenCustomMissionWidget' 86 | ClassOptionsGame=class'OpenRVS.OpenOptionsGame' 87 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenClientBeaconReceiver.uc: -------------------------------------------------------------------------------- 1 | //new in 0.8 2 | //this class will handle receiving text from each server and parsing it to learn basic info about the server 3 | class OpenClientBeaconReceiver extends ClientBeaconReceiver transient; 4 | 5 | var OpenMultiPlayerWidget Widget; 6 | 7 | //call this function with the ip and server beacon port (regular port + 1000) of the server to get info from 8 | function QuerySingleServer(OpenMultiPlayerWidget OMPW, coerce string sIP, coerce int sPort) 9 | { 10 | local IpAddr Addr; 11 | if ( Widget == none )//get a reference to the widget to send info back to 12 | Widget = OMPW; 13 | StringToIpAddr(sIP,Addr);//turn the string to an IP 14 | Addr.Port = sPort; 15 | BroadcastBeacon(Addr); 16 | } 17 | 18 | //0.8 19 | //receive text 20 | //super it but also check if it's response to the "REPORT" broadcast 21 | //if so, parse and send to OpenMultiPlayerWidget 22 | event ReceivedText(IpAddr Addr, string Text) 23 | { 24 | local int pos;//position in the current string 25 | local string szSecondWord;//second word in the message 26 | local string szThirdWord;//third word in the message 27 | local string sNumP,sMaxP,sGMode,sMapName,sSvrName; 28 | local string sModName;//1.3 29 | local bool bSvrLocked;//1.5 30 | 31 | super.ReceivedText(Addr,Text); 32 | 33 | if ( left(Text,len(BeaconProduct)+1) ~= (BeaconProduct$" ") ) 34 | { 35 | // Decode the second word to determine the port number of the server 36 | szSecondWord = mid(Text,len(BeaconProduct)+1); 37 | Addr.Port = int(szSecondWord); 38 | // Check for the string KEYWORD 39 | szThirdWord = mid(szSecondWord,InStr(szSecondWord," ")+1); 40 | if ( left(szThirdWord,len(KeyWordMarker)+1) ~= ( KeyWordMarker$" " ) ) 41 | { 42 | //if we got to this stage, it's a REPORT response 43 | //start szthirdword at the first symbol for GrabOption() to work 44 | szThirdWord = mid(szThirdWord,InStr(szThirdWord, Chr(182))); 45 | //send the string to ParseOption() with it as first argument, key to look for the second 46 | //eg numplayers = ParseOption(szThirdWord,"keyfornumplayers"); 47 | //need to overwrite GetKeyValue because it looks for "=" when we need to look for the space between the marker and the value 48 | //GrabOption also leaves a space at the end as well as strips the initial symbol 49 | //so need to put that symbol back on, and strip the space in GrabOption 50 | sNumP = ParseOption(szThirdWord,NumPlayersMarker); 51 | sMaxP = ParseOption(szThirdWord,MaxPlayersMarker); 52 | sGMode = ParseOption(szThirdWord,GameTypeMarker); 53 | sMapName = ParseOption(szThirdWord,MapNameMarker); 54 | sSvrName = ParseOption(szThirdWord,SvrNameMarker); 55 | sModName = ParseOption(szThirdWord,ModNameMarker);//1.3 - sModName string added to function in MP menu 56 | bSvrLocked = bool(ParseOption(szThirdWord,LockedMarker));//1.5 - locked info received here 57 | Widget.ReceiveServerInfo(IpAddrToString(Addr),sNumP,sMaxP,sGMode,sMapName,sSvrName,sModName,bSvrLocked);//send received info back to server list 58 | class'OpenLogger'.static.Debug("Server " $ sSvrName $ " at " $ IpAddrToString(Addr) $ " is playing map " $ sMapName $ " in game mode type " $ sGMode $ ". Players: " $ sNumP $ "/" $ sMaxP, self); 59 | } 60 | } 61 | } 62 | 63 | //overridden from parent 64 | //need to strip out the final space from result 65 | //also need to add the removed symbol back into result 66 | function bool GrabOption(out string Options, out string Result)//¶I1 OBSOLETESUPERSTARS.COM ¶F1 RGM 67 | { 68 | local string pilcrow; 69 | pilcrow = Chr(182);//¶ 70 | 71 | if ( Left(Options,1) == pilcrow ) 72 | { 73 | // Get result. 74 | Result = Mid(Options,1); 75 | if( InStr(Result, pilcrow) >= 0 )//I1 OBSOLETESUPERSTARS.COM ¶F1 RGM 76 | Result = Left(Result,InStr(Result, pilcrow)-1);//I1 OBSOLETESUPERSTARS.COM//0.8 strip the space 77 | Result = pilcrow $ Result;//0.8 add the symbol back in - ¶I1 OBSOLETESUPERSTARS.COM 78 | 79 | // Update options. 80 | Options = Mid(Options,1);//I1 OBSOLETESUPERSTARS.COM ¶F1 RGM 81 | if( InStr(Options, pilcrow) >= 0 ) 82 | Options = Mid(Options,InStr(Options, pilcrow));//¶F1 RGM 83 | else 84 | Options = ""; 85 | return true; 86 | } 87 | else 88 | { 89 | class'OpenLogger'.static.Debug("GRABOPTION FALSE", self); 90 | return false; 91 | } 92 | } 93 | 94 | //overridden from parent 95 | //instead of looking for "=", need to look for first space 96 | function GetKeyValue(string Pair, out string Key, out string Value) 97 | { 98 | if ( InStr(Pair," ") >= 0 ) 99 | { 100 | Key = Left(Pair,InStr(Pair," ")); 101 | Value = Mid(Pair,InStr(Pair," ")+1); 102 | } 103 | else 104 | { 105 | Key = Pair; 106 | Value = ""; 107 | } 108 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenMods.uc: -------------------------------------------------------------------------------- 1 | //forces the "Custom Game" mod menu to load ALL mods, not just UBISoft's official ones 2 | //implements the FOV fix in singleplayer 3 | //allows loading of a custom cheat manager class 4 | //implements starting the game in any mod 5 | 6 | class OpenMods extends R6MenuOptionsMODS config(openrvs);//1.4 added config(openrvs) 7 | 8 | //v1.4 9 | var config string ForceStartMod; 10 | var int FOV; 11 | var string NewCheatManagerClass; 12 | var OpenFOV OpenFOV; 13 | 14 | //cycles through all *.mod files in Mods folder 15 | //and unlocks them for use 16 | //code originally recycled from Mod Unlocker by me 17 | function SetMenuMODS() 18 | { 19 | local R6FileManager pFileManager; 20 | local R6ModMgr pModManager; 21 | local R6Mod aMod; 22 | local int iFiles,i2,j; 23 | local string szIniFilename,s; 24 | local class CheatClass;//1.4 25 | local class CustomPC;//1.4 26 | local bool bFound; 27 | pModManager = class'Actor'.static.GetModMgr(); 28 | pFileManager = new(none) class'R6FileManager'; 29 | iFiles = pFileManager.GetNbFile("..\\Mods\\","mod"); 30 | for ( i2 = 0; i2 < iFiles; i2++ ) 31 | { 32 | pFileManager.GetFileName(i2,szIniFilename); 33 | if ( szIniFilename != "" ) 34 | { 35 | aMod = new(none) class'Engine.R6Mod'; 36 | aMod.Init(szIniFilename); 37 | j = 0; 38 | bFound = false; 39 | while ( j < pModManager.GetNbMods() ) 40 | { 41 | if ( pModManager.m_aMods[j].m_szKeyWord == aMod.m_szKeyWord ) 42 | bFound = true; 43 | j++; 44 | } 45 | if ( !bFound ) 46 | pModManager.m_aMods[pModManager.m_aMods.length] = aMod; 47 | } 48 | } 49 | super.SetMenuMODS(); 50 | LoadConfig();//1.4 51 | //1.4 jump to mod 52 | if ( ( ForceStartMod != "" ) && ( caps(ForceStartMod) != "RAVENSHIELD" ) ) 53 | { 54 | ForceMod(); 55 | //CRASHES! 56 | //something not working right here ... 57 | //can we uscript just call the button and "click" it? 58 | //class'Actor'.static.GetModMgr().SetCurrentMod(caps(ForceStartMod),GetLevel(),true,Root.Console,GetPlayerOwner().xlevel); 59 | //R6Console(Root.console).CleanAndChangeMod(); 60 | //R6Console(Root.console).m_GameService.InitModInfo(); 61 | //R6Console(Root.console).m_GameService.m_ModGSInfo.InitMod(); 62 | //R6Console(Root.console).LeaveR6Game(LG_InitMod); 63 | //R6Console(Root.console).m_bChangeModInProgress = true; 64 | //R6Console(Root.console).LeaveR6Game(LG_InitMod); 65 | //R6GSServers(class'Actor'.static.GetGameManager().GetGameMgrGameService()).InitializeMod(); 66 | } 67 | //1.4 68 | //this section duplicated in OpenMenuIntelWidget 69 | OpenFOV = new class'OpenFOV'; 70 | FOV = OpenFOV.GetFOV(); 71 | NewCheatManagerClass = OpenFOV.GetCMClass(); 72 | OpenFOV = none; 73 | if ( FOV != 0 ) 74 | { 75 | FOV = clamp(FOV,65,140); 76 | class'R6PlayerController'.default.DefaultFOV = FOV; 77 | class'R6PlayerController'.default.DesiredFOV = FOV; 78 | } 79 | if ( NewCheatManagerClass == "" ) 80 | CheatClass = class'OpenCheat'; 81 | else 82 | { 83 | CheatClass = class(DynamicLoadObject(NewCheatManagerClass,class'Class')); 84 | if ( CheatClass == none ) 85 | CheatClass = class'OpenCheat'; 86 | } 87 | class'OpenLogger'.static.Info("experimental SP manager set to:" @ CheatClass, self); 88 | 89 | class'R6PlayerController'.default.CheatClass = CheatClass; 90 | s = caps(class'Actor'.static.GetModMgr().m_pCurrentMod.m_PlayerCtrlToSpawn); 91 | if ( ( s != "" ) && ( InStr(s,"R6ENGINE.") == -1 ) )//mod has custom pc 92 | { 93 | CustomPC = class(DynamicLoadObject(class'Actor'.static.GetModMgr().m_pCurrentMod.m_PlayerCtrlToSpawn,class'Class')); 94 | if ( CustomPC != none ) 95 | { 96 | CustomPC.default.CheatClass = CheatClass; 97 | class'OpenLogger'.static.Debug("OpenRVS experimental SP manager set for: " $ CustomPC, self); 98 | if ( FOV != 0 ) 99 | { 100 | FOV = clamp(FOV,65,140); 101 | CustomPC.default.DefaultFOV = FOV; 102 | CustomPC.default.DesiredFOV = FOV; 103 | } 104 | } 105 | } 106 | //FP WEAP FOV FIX 107 | s = caps(class'Actor'.static.GetModMgr().m_pCurrentMod.m_GlobalHUDToSpawn); 108 | if ( ( s == "" ) || ( s == "R6GAME.R6HUD" ) ) 109 | class'Actor'.static.GetModMgr().m_pCurrentMod.m_GlobalHUDToSpawn = "OpenRVS.OpenHUD"; 110 | } 111 | 112 | //1.4 jump straight to mod 113 | function ForceMod() 114 | { 115 | local R6WindowListBoxItem NewItem; 116 | if ( class'Actor'.static.GetModMgr().m_pCurrentMod.m_szKeyWord ~= ForceStartMod ) 117 | return; 118 | NewItem = R6WindowListBoxItem(m_pListOfMods.FindItemWithName(ForceStartMod)); 119 | if ( NewItem != none ) 120 | { 121 | m_pListOfMods.SetSelectedItem(NewItem); 122 | m_pListOfMods.ActivateMOD(); 123 | } 124 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenServer.uc: -------------------------------------------------------------------------------- 1 | //This class detects all players joining a server. 2 | //Before the CD key check can run, this class modifies certain hidden variables, 3 | //to fool the server into thinking the player's CD key has already been validated. 4 | //This class also handles converting the old banlist system to IP-based bans 5 | //Fixes bugs in multi-server lists 6 | //Sets all pawns as always relevant - important for high ping players 7 | //installed server side 8 | class OpenServer extends Actor config(BanList); 9 | 10 | var bool bLogged, bCracked; 11 | 12 | //log to server to make sure it's running 13 | event PreBeginPlay() 14 | { 15 | local OpenRVS openrvs; 16 | 17 | openrvs = new class'OpenRVS'; 18 | openrvs.Init(self);//initialize OpenRVS 19 | openrvs = none;//done initializing 20 | 21 | super.PreBeginPlay(); 22 | SetTimer(60, true); 23 | } 24 | 25 | //once everything is initialized, build a beacon text and automatically register 26 | //this server with the OpenRVS registry. 27 | event PostNetBeginPlay() 28 | { 29 | super.PostNetBeginPlay(); 30 | 31 | //send a UDP beacon to the registry 32 | OpenBeacon(R6AbstractGameInfo(Level.Game).m_UdpBeacon).RegisterServer(); 33 | } 34 | 35 | //find a player who hasn't been validated 36 | //and fix it before the server attempts to send the info to Ubi master server 37 | function Tick(float delta) 38 | { 39 | local Controller C; 40 | local R6PlayerController P; 41 | local R6AbstractGameManager A; 42 | local R6GSServers G; 43 | local R6GameInfo I; 44 | local string s; 45 | local Pawn Pawn; 46 | super.Tick(delta); 47 | C = Level.ControllerList; 48 | while ( C != none ) 49 | { 50 | P = R6PlayerController(C); 51 | //doesn't have valid cd key 52 | if ( ( P != none ) && ( P.m_stPlayerVerCDKeyStatus.m_eCDKeyStatus != ECDKEYST_PLAYER_VALID ) ) 53 | { 54 | if ( !bLogged ) 55 | { 56 | class'OpenLogger'.static.Info("Current Status: Validating players", self); 57 | bLogged = true; 58 | } 59 | //THE IMPORTANT STUFF 60 | //Set each client to have a validated cd key request object 61 | //Before the server gets around to checking them 62 | P.m_stPlayerVerCDKeyStatus.m_eCDKeyRequest = ECDKEY_NONE; 63 | P.m_stPlayerVerCDKeyStatus.m_szAuthorizationID = string(rand(1000000000)); 64 | P.m_stPlayerVerCDKeyStatus.m_iCDKeyReqID = 1; 65 | P.m_stPlayerVerCDKeyStatus.m_bCDKeyValSecondTry = false; 66 | P.m_stPlayerVerCDKeyStatus.m_eCDKeyStatus = ECDKEYST_PLAYER_VALID; 67 | if ( HandleBans(P) )//PLAYER IS BANNED VIA IP ADDRESS 68 | { 69 | class'OpenLogger'.static.Info("Player '" $ P.PlayerReplicationInfo.PlayerName $ "' is banned via IP address", self); 70 | P.ClientMessage("Your IP address is banned on this server"); 71 | P.ClientKickedOut(); 72 | P.SpecialDestroy(); 73 | } 74 | } 75 | //1.2: 76 | //set each existing pawn as always relevant 77 | //so they replicate location to each client 78 | //vanilla behaviour was to not let them be relevant unless engine determines they should be visible or near visible 79 | //but lag for high-ping players always meant that the enemy would "pop" in 80 | //this fix requires marginally more bandwidth but forces the server to replicate all alive pawns at all times 81 | Pawn = C.Pawn; 82 | if ( ( Pawn != none ) && ( Pawn.IsAlive() ) && ( !Pawn.bAlwaysRelevant ) ) 83 | { 84 | Pawn.bAlwaysRelevant = true; 85 | } 86 | C = C.NextController; 87 | } 88 | } 89 | 90 | //bug fix: when multiple servers use the same ban list, data is not sent between the two always 91 | //loading the config file every minute will ensure that the banlist is up to date 92 | function Timer() 93 | { 94 | super.Timer(); 95 | Level.Game.AccessControl.LoadConfig(); 96 | } 97 | 98 | //should be called once per controller per map 99 | //set the globalID to the IP address 100 | //so the IP will get banned instead of obsolete ID 101 | function bool HandleBans(R6PlayerController P) 102 | { 103 | local string s; 104 | local int i; 105 | s = P.GetPlayerNetworkAddress(); 106 | P.m_szGlobalID = left(s,InStr(s,":")); 107 | //0.6 update: 108 | //log each player's IP address 109 | //TO DO: 110 | //log the time of joining as well 111 | class'OpenLogger'.static.Info("Player '" $ P.PlayerReplicationInfo.PlayerName $ "' joining server; IP address is:" @ left(s,InStr(s,":")), self); 112 | class'OpenLogger'.static.Debug("PLAYER ID IS: " $ P.m_szGlobalID, self); 113 | while ( i < Level.Game.AccessControl.Banned.length ) 114 | { 115 | if ( Level.Game.AccessControl.Banned[i] ~= Left(P.m_szGlobalID,Len(Level.Game.AccessControl.Banned[i])) ) 116 | return true; 117 | i++; 118 | } 119 | class'OpenLogger'.static.Info("PLAYER NOT BANNED", self); 120 | return false; 121 | } 122 | 123 | defaultproperties 124 | { 125 | bHidden=true 126 | bAlwaysRelevant=true 127 | bAlwaysTick=true 128 | RemoteRole=ROLE_SimulatedProxy 129 | } 130 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenJoinIP.uc: -------------------------------------------------------------------------------- 1 | //fixes UBISoft's stupid join IP bug 2 | //properly uses the main port/serverbeaconport 3 | //IMPORTANT: assumes that serverbeaconport is main port+1000 4 | //also allows connection over the internet to a LAN server 5 | //running an internet dedicated server as a LAN server does NOT seem like it is needed 6 | //but COULD remove the need for the r6gameservice dll fix? 7 | //functionality still left in this class just in case - (2020 - I believe some server owners do run their internet servers as LAN) 8 | //debug: allows logging the state of joining a server 9 | //installed client side 10 | 11 | class OpenJoinIP extends R6WindowJoinIP; 12 | 13 | //fix UBI's stupid code 14 | function PopUpBoxDone(MessageBoxResult Result,ePopUpID _ePopUpID) 15 | { 16 | local int m_iPort; 17 | if ( Result == MR_OK ) 18 | { 19 | if ( _ePopUpID == EPopUpID_EnterIP ) 20 | { 21 | m_szIP = R6WindowEditBox(m_pEnterIP.m_ClientArea).GetValue(); 22 | 23 | //THIS IS UBI'S ORIGINAL LINE: 24 | //if ( m_GameService.m_ClientBeacon.PreJoinQuery(m_szIP,0) == false ) 25 | 26 | //this is bullshit because it ignores the port number! 27 | 28 | //When PreJoinQuery() is called in class ClientBeaconReceiver, any number after ":" is discarded 29 | //and so if your server requires a port number, connection fails 30 | //because when ClientBeaconReceiver sees port 0, it just assumes the default port 31 | 32 | //here's the new version: 33 | if ( InStr(m_szIP,":") != -1 )//find if a port number included 34 | m_iPort = int(Mid(m_szIP,InStr(m_szIP,":")+1))+1000;//get the port number (port to question is default +1000) 35 | else 36 | m_iPort = 0;//no port included, use the default port 37 | if ( !m_GameService.m_ClientBeacon.PreJoinQuery(m_szIP,m_iPort) ) 38 | { 39 | // handle invalid ip string format here 40 | PopUpBoxDone(MR_OK,EPopUpID_JoinIPError); 41 | class'OpenLogger'.static.Info("Invalid IP string entered", self); 42 | } 43 | else 44 | { 45 | if ( !m_bStartByCmdLine ) 46 | m_pPleaseWait.ShowWindow(); 47 | m_fBeaconTime = m_GameService.NativeGetSeconds(); 48 | eState = EJOINIP_WAITING_FOR_BEACON; 49 | } 50 | } 51 | else 52 | super.PopUpBoxDone(Result,_ePopUpID); 53 | } 54 | else 55 | super.PopUpBoxDone(Result,_ePopUpID); 56 | } 57 | 58 | //Overriding the original popup logic which does not allow IP connection to a LAN server 59 | //some testers report crashes when they connect to a LAN though 60 | //if internet servers can be preserved, this area may no longer be needed 61 | function Manager( UWindowWindow _pCurrentWidget ) 62 | { 63 | local FLOAT elapsedTime; // Elapsed time waiting for response from server 64 | 65 | switch ( eState ) 66 | { 67 | case EJOINIP_WAITING_FOR_UBICOMLOGIN: 68 | if ( m_GameService.m_bLoggedInUbiDotCom ) 69 | { 70 | PopUpBoxDone(MR_OK, EPopUpID_EnterIP); 71 | } 72 | break; 73 | 74 | case EJOINIP_WAITING_FOR_BEACON: 75 | // Response has been received from the server 76 | if ( m_GameService.m_ClientBeacon.PreJoinInfo.bResponseRcvd ) 77 | { 78 | class'OpenLogger'.static.Debug("INTERNET SERVER: " $ m_GameService.m_ClientBeacon.PreJoinInfo.bInternetServer, self); 79 | // Verify that the server is the same version as the game 80 | if ( Root.Console.ViewportOwner.Actor.GetGameVersion() != m_GameService.m_ClientBeacon.PreJoinInfo.szGameVersion ) 81 | { 82 | class'OpenLogger'.static.Error("VERSION FAIL", self); 83 | eState = EJOINIP_BEACON_FAIL; 84 | m_pPleaseWait.HideWindow(); 85 | m_pError.ShowWindow(); 86 | R6WindowTextLabel(m_pError.m_ClientArea).Text = Localize("MultiPlayer","PopUp_Error_BadVersion","R6Menu"); 87 | } 88 | else if ( R6Console(Root.console).m_bNonUbiMatchMaking ) 89 | { 90 | class'OpenLogger'.static.Error("NON UBI MATCHMAKING", self); 91 | _pCurrentWidget.SendMessage( MWM_UBI_JOINIP_SUCCESS ); 92 | if (!m_bStartByCmdLine) 93 | HideWindow(); 94 | } 95 | // Only allow user to join internet servers using the Join IP button 96 | //BYPASSED! 97 | //allow any server, even LAN, to be joined via IP 98 | //however, seems to not work? Maybe experience crashes 99 | //else if ( !m_GameService.m_ClientBeacon.PreJoinInfo.bInternetServer ) 100 | //{ 101 | // eState = EJOINIP_BEACON_FAIL; 102 | // m_pPleaseWait.HideWindow(); 103 | // m_pError.ShowWindow(); 104 | // R6WindowTextLabel(m_pError.m_ClientArea).Text = Localize("MultiPlayer","PopUp_Error_LanServer","R6Menu"); 105 | //} 106 | else 107 | { 108 | //set to always false? seems to prevent hang when joining my personal server 109 | m_bRoomValid = false;//( m_GameService.m_ClientBeacon.PreJoinInfo.iLobbyID != 0 && m_GameService.m_ClientBeacon.PreJoinInfo.iGroupID != 0 ); 110 | _pCurrentWidget.SendMessage( MWM_UBI_JOINIP_SUCCESS ); 111 | class'OpenLogger'.static.Debug("SUCCESS", self); 112 | HideWindow(); 113 | } 114 | } 115 | else 116 | { 117 | // Check if beacon has timed out, if so put up error message 118 | elapsedTime = m_GameService.NativeGetSeconds() - m_fBeaconTime; 119 | if ( elapsedTime > K_MAX_TIME_BEACON ) 120 | { 121 | class'OpenLogger'.static.Warning("beacon timed out", self); 122 | eState = EJOINIP_BEACON_FAIL; 123 | m_pPleaseWait.HideWindow(); 124 | m_pError.ShowWindow(); 125 | R6WindowTextLabel(m_pError.m_ClientArea).Text = Localize("MultiPlayer","PopUp_Error_NoServer","R6Menu"); 126 | } 127 | } 128 | break; 129 | } 130 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenOptionsGame.uc: -------------------------------------------------------------------------------- 1 | class OpenOptionsGame extends R6MenuOptionsGame config(openrvs); 2 | 3 | //v1.4 experimental 4 | //add the unlimited practice button back! 5 | //not super useful for 99.99% of people 6 | 7 | // Called by base game, do not set to None. Commented out in vanilla. 8 | var R6WindowButtonBox m_pOptionUnlimitedP; 9 | 10 | var config bool bUnlimited;//need a save for this 11 | 12 | //1.56 was named InitOptionsGame() 13 | //renamed in 1.6 14 | function InitPageOptions() 15 | { 16 | local FLOAT fXOffset, fYOffset, fYStep, fWidth, fHeight, fTemp, fSizeOfCounter, fXRightOffset; 17 | local Font ButtonFont; 18 | 19 | local INT iAutoAimBitmapHeight, iAutoAimVPadding, iSBButtonWidth; 20 | 21 | //create buttons -- check text label offset for concordance 22 | ButtonFont = Root.Fonts[F_SmallTitle]; 23 | 24 | //1.6 vanilla DOES NOT have following - this is from 1.56 25 | //m_ePageOptID = ePO_Game; 26 | 27 | fXOffset = 5; 28 | fXRightOffset = 26; 29 | fYOffset = 5; 30 | fWidth = WinWidth - fXOffset - 40; // 40 distance to the end of the window 31 | fHeight = 15; 32 | fYStep = 27; 33 | iSBButtonWidth = 14; 34 | 35 | iAutoAimBitmapHeight = 73; 36 | iAutoAimVPadding = 5; //Padding Between the bitmap and the scrollBar 37 | 38 | // ALWAYS RUN 39 | m_pOptionAlwaysRun = R6WindowButtonBox(CreateControl(class'R6WindowButtonBox', 40 | fXOffset, fYOffset, fWidth, fHeight, self)); 41 | m_pOptionAlwaysRun.SetButtonBox(false); 42 | m_pOptionAlwaysRun.CreateTextAndBox(Localize("Options","Opt_GameAlways","R6Menu"), 43 | Localize("Tip","Opt_GameAlways","R6Menu"), 0, 2); 44 | 45 | fYOffset += fYStep; 46 | // INVERT MOUSE 47 | m_pOptionInvertMouse = R6WindowButtonBox(CreateControl(class'R6WindowButtonBox', 48 | fXOffset, fYOffset, fWidth, fHeight, self)); 49 | m_pOptionInvertMouse.SetButtonBox(false); 50 | m_pOptionInvertMouse.CreateTextAndBox(Localize("Options","Opt_GameInvertM","R6Menu"), 51 | Localize("Tip","Opt_GameInvertM","R6Menu"), 0, 3); 52 | 53 | fYOffset += fYStep; 54 | // MOUSE SENSITIVITY 55 | m_pOptionMouseSens = R6WindowHScrollBar(CreateControl(class'R6WindowHScrollBar', 56 | fXOffset, fYOffset, WinWidth - fXOffset - fXRightOffset, C_fSCROLLBAR_HEIGHT, self)); 57 | //180 is the size of the scrollbar 58 | m_pOptionMouseSens.CreateSB(0, C_fXPOS_SCROLLBAR, 0, C_fSCROLLBAR_WIDTH, 59 | C_fSCROLLBAR_HEIGHT, self); 60 | m_pOptionMouseSens.CreateSBTextLabel(Localize("Options","Opt_GameMouseSens","R6Menu"), 61 | Localize("Tip","Opt_GameMouseSens","R6Menu")); 62 | m_pOptionMouseSens.SetScrollBarRange(0, 120, 20); 63 | 64 | fYOffset += fYStep; 65 | // POP UP LOAD PLAN 66 | m_pPopUpLoadPlan = R6WindowButtonBox(CreateControl(class'R6WindowButtonBox', 67 | fXOffset, fYOffset, fWidth, fHeight, self)); 68 | m_pPopUpLoadPlan.SetButtonBox(false); 69 | m_pPopUpLoadPlan.CreateTextAndBox(Localize("Options","Opt_GamePopUpLoadPlan","R6Menu"), 70 | Localize("Tip","Opt_GamePopUpLoadPlan","R6Menu"), 0, 5); 71 | 72 | fYOffset += fYStep; 73 | // POP UP LOAD PLAN 74 | m_pPopUpQuickPlay = R6WindowButtonBox(CreateControl(class'R6WindowButtonBox', 75 | fXOffset, fYOffset, fWidth, fHeight, self)); 76 | m_pPopUpQuickPlay.SetButtonBox(false); 77 | m_pPopUpQuickPlay.CreateTextAndBox(Localize("Options","Opt_GamePopUpQuickPlay","R6Menu"), 78 | Localize("Tip","Opt_GamePopUpQuickPlay","R6Menu"), 0, 5); 79 | 80 | fYOffset += fYStep; 81 | 82 | //originally commented out! 83 | //moved lower as well 84 | // UNLIMITED PRATICE 85 | m_pOptionUnlimitedP = R6WindowButtonBox(CreateControl(class'R6WindowButtonBox', 86 | fXOffset, fYOffset, fWidth, fHeight, self)); 87 | //these next lines let us save the status of this box 88 | LoadConfig(); 89 | m_pOptionUnlimitedP.SetButtonBox(bUnlimited); 90 | class'Actor'.static.GetGameOptions().UnlimitedPractice = m_pOptionUnlimitedP.m_bSelected; 91 | m_pOptionUnlimitedP.CreateTextAndBox("Unlimited Practice Mode", 92 | "Hidden beta feature that lets you continue playing after completing or failing objectives.", 93 | 0, 0); 94 | 95 | fYOffset += fYStep; 96 | 97 | // AUTO AIM 98 | m_pAutoAim = R6WindowTextureBrowser(CreateWindow( 99 | class'R6WindowTextureBrowser', fXOffset , fYOffset, WinWidth - fXOffset, 100 | C_fSCROLLBAR_HEIGHT + iAutoAimBitmapHeight + iAutoAimVPadding, self)); 101 | m_pAutoAim.CreateSB(C_fXPOS_SCROLLBAR, 102 | m_pAutoAim.WinHeight - C_fSCROLLBAR_HEIGHT, C_fSCROLLBAR_WIDTH, 103 | C_fSCROLLBAR_HEIGHT); //180 is the size of the scrollbar 104 | m_pAutoAim.CreateBitmap(C_fXPOS_SCROLLBAR + iSBButtonWidth, 0, 105 | C_fSCROLLBAR_WIDTH - (2 * iSBButtonWidth), iAutoAimBitmapHeight); 106 | m_pAutoAim.SetBitmapProperties(false, true, 5, false); 107 | m_pAutoAim.SetBitmapBorder(true, Root.Colors.White); 108 | m_pAutoAim.CreateTextLabel(0, 0, 109 | m_pAutoAim.WinWidth - m_pAutoAim.m_CurrentSelection.WinLeft, 110 | m_pAutoAim.WinHeight, Localize("Options","Opt_AutoTarget","R6Menu"), 111 | Localize("Tip","Opt_AutoTarget","R6Menu")); 112 | 113 | m_pAutoAim.AddTexture(m_pAutoAimTexture, m_pAutoAimTextReg[0]); 114 | m_pAutoAim.AddTexture(m_pAutoAimTexture, m_pAutoAimTextReg[1]); 115 | m_pAutoAim.AddTexture(m_pAutoAimTexture, m_pAutoAimTextReg[2]); 116 | m_pAutoAim.AddTexture(m_pAutoAimTexture, m_pAutoAimTextReg[3]); 117 | 118 | InitResetButton(); 119 | //1.6 vanilla DOES NOT have following: 120 | //SetMenuGameValues(); 121 | 122 | //m_bInitComplete = true; 123 | //instead has: 124 | UpdateOptionsInPage(); 125 | } 126 | 127 | //function existed in 1.56 as SetGameValues() 128 | //renamed in 1.6 129 | // Called in R6MenuOptionsWidget which we do not override; this must be present. 130 | function UpdateOptionsInEngine() 131 | { 132 | local R6GameOptions pGameOptions; 133 | pGameOptions = class'Actor'.static.GetGameOptions(); 134 | //commented out in vanilla 135 | pGameOptions.UnlimitedPractice = m_pOptionUnlimitedP.m_bSelected; 136 | pGameOptions.AlwaysRun = m_pOptionAlwaysRun.m_bSelected; 137 | pGameOptions.InvertMouse = m_pOptionInvertMouse.m_bSelected; 138 | pGameOptions.PopUpLoadPlan = m_pPopUpLoadPlan.m_bSelected; 139 | pGameOptions.PopUpQuickPlay = m_pPopUpQuickPlay.m_bSelected; 140 | pGameOptions.AutoTargetSlider = m_pAutoAim.GetCurrentTextureIndex(); 141 | pGameOptions.MouseSensitivity = m_pOptionMouseSens.GetScrollBarValue(); 142 | //added 1.4 orvs 143 | bUnlimited = m_pOptionUnlimitedP.m_bSelected; 144 | SaveConfig(); 145 | } 146 | 147 | //function existed in 1.56 as SetMenuGameValues() 148 | //renamed in 1.6 149 | function UpdateOptionsInPage() 150 | { 151 | local R6GameOptions pGameOptions; 152 | pGameOptions = class'Actor'.static.GetGameOptions(); 153 | //commented out in vanilla 154 | m_pOptionUnlimitedP.SetButtonBox(pGameOptions.UnlimitedPractice); 155 | m_pOptionAlwaysRun.SetButtonBox(pGameOptions.AlwaysRun); 156 | m_pOptionInvertMouse.SetButtonBox(pGameOptions.InvertMouse); 157 | m_pPopUpLoadPlan.SetButtonBox(pGameOptions.PopUpLoadPlan); 158 | m_pPopUpQuickPlay.SetButtonBox(pGameOptions.PopUpQuickPlay); 159 | m_pAutoAim.SetCurrentTextureFromIndex(pGameOptions.AutoTargetSlider); 160 | m_pOptionMouseSens.SetScrollBarValue(pGameOptions.MouseSensitivity); 161 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenServerList.uc: -------------------------------------------------------------------------------- 1 | //initiates a connection with external server list 2 | //strips the received data down to an array of strings, then sends them to the server list to be parsed and displayed 3 | //class is spawned on client by OpenMultiPlayerWidget 4 | //0.6 beta 5 | // - fixed issue with server list file being too large and causing errors 6 | // - now correctly retrieves a server list of any size (theoretically?) 7 | //1.3 8 | // - this class now handles all parsing of server information 9 | // - also handles loading backup server list if connection fails 10 | // - now passes each server's info to the widget class instead of passing the raw strings to parse 11 | //1.5 12 | // - refactored to use OpenHTTPClient for request/response 13 | // - now only focuses on parsing the response 14 | class OpenServerList extends Actor; 15 | 16 | struct AServer 17 | { 18 | var string ServerName; 19 | var string IP; 20 | var string GameMode; 21 | }; 22 | 23 | const INI_HEADER_LINE = "[OpenRVS.";//support any OpenRVS class 24 | const CSV_HEADER_LINE = "name,ip,port,mode"; 25 | const FALLBACK_SERVERS_FILE = "Servers.list"; 26 | 27 | var OpenMultiPlayerWidget M; 28 | var OpenHTTPClient httpc; 29 | var config array FallbackServers;//var name must match Servers.list 30 | var string WebAddress; 31 | var string FileName; 32 | 33 | // Starts OpenServerList and send an HTTP request to the server list provider. 34 | function Init(OpenMultiPlayerWidget Widget, optional string W, optional string F) 35 | { 36 | M = Widget; 37 | if ( W != "" ) 38 | WebAddress = W; 39 | else 40 | WebAddress = "api.openrvs.org"; 41 | if ( F != "" ) 42 | FileName = F; 43 | else 44 | FileName = "servers"; 45 | 46 | httpc = Spawn(class'OpenHTTPClient'); 47 | httpc.CallbackName = "server_list"; 48 | httpc.ServerListCallbackProvider = self; 49 | httpc.SendRequest("http://" $ WebAddress $ "/" $ FileName); 50 | } 51 | 52 | // Receives and detects type for an HTTP response from the server list provider. 53 | // It is also responsible for sending servers to OpenMultiPlayerWidget. 54 | function ParseServers(OpenHTTPClient.HttpResponse resp) 55 | { 56 | local array lines; 57 | 58 | httpc = none;//done with HTTP client 59 | 60 | //Check for errors. 61 | if (resp.Code != 200) 62 | { 63 | class'OpenLogger'.static.Error("failed to retrieve servers over http", self); 64 | SendServersUpstream(GetFallbackServers()); 65 | return; 66 | } 67 | 68 | class'OpenLogger'.static.Info("loading servers from Internet", self); 69 | class'OpenString'.static.Split(resp.Body, Chr(10), lines); 70 | class'OpenLogger'.static.Info("parsing" @ lines.Length @ "server lines", self); 71 | 72 | // Determine response type. 73 | if (Left(lines[0], Len(CSV_HEADER_LINE)) ~= CSV_HEADER_LINE) 74 | { 75 | SendServersUpstream(ParseServersCSV(lines)); 76 | return; 77 | } 78 | if (Left(lines[0], Len(INI_HEADER_LINE)) ~= INI_HEADER_LINE) 79 | { 80 | SendServersUpstream(ParseServersINI(lines)); 81 | return; 82 | } 83 | 84 | // Fall back to local file. 85 | class'OpenLogger'.static.Error("unknown server list response type", self); 86 | SendServersUpstream(GetFallbackServers()); 87 | } 88 | 89 | // Parses a server list in the INI file format. 90 | function array ParseServersINI(array lines) 91 | { 92 | local string line;//server list line "ServerList=(a=b,c=d,e=f)" 93 | local array fields;//parsed server parameters ["a=b", "c=d"] 94 | local array kvpair;//one key=value parameter pair ["a", "b"] 95 | local int numFields, numSubfields; 96 | local int i, j; 97 | local AServer srv; 98 | local array servers; 99 | 100 | class'OpenLogger'.static.Debug("using csv parser", self); 101 | lines.Remove(0, 1);//skips header line (specific to INI parser) 102 | 103 | // Convert each line to CSV K=V format (i.e. "a=b,c=d,e=f") 104 | for (i=0; i ParseServersCSV(array lines) 149 | { 150 | local array fields; 151 | local int i; 152 | local AServer srv; 153 | local array servers; 154 | 155 | class'OpenLogger'.static.Debug("using csv parser", self); 156 | lines.Remove(0, 1);//skips header line (specific to registry csv format) 157 | 158 | for (i=0; i GetFallbackServers() 185 | { 186 | LoadConfig(FALLBACK_SERVERS_FILE); 187 | class'OpenLogger'.static.Info("loaded" @ FallbackServers.Length @ "servers from fallback file", self); 188 | return FallbackServers; 189 | } 190 | 191 | // Sends the completed server list to OpenMultiPlayerWidget. 192 | function SendServersUpstream(array servers) 193 | { 194 | local int i; 195 | 196 | class'OpenLogger'.static.Info("loading" @ servers.Length @ "parsed servers", self); 197 | M.ClearServerList(); 198 | for (i=0; i ML; 83 | local INT iCounter; 84 | local PlayerController aPC; 85 | local INT iNumPlayers; 86 | local string szIPAddr; 87 | local FLOAT fPlayingTime[32]; 88 | local INT iPingTimeMS[32]; 89 | local INT iKillCount[32]; 90 | local Controller _Controller; 91 | local R6ServerInfo pServerOptions; 92 | 93 | // Custom OpenRVS fields 94 | local string motd; 95 | 96 | pServerOptions = class'Actor'.static.GetServerOptions(); 97 | textData = KeyWordMarker $ " "; 98 | 99 | // This large block of textData changes packs all relevant data into the UDP 100 | // message body for the beacon response. 101 | textData = textData @ GamePortMarker @ Mid(Level.GetAddressURL(), InStr(Level.GetAddressURL(),":")+1); 102 | if ( InStr(Level.Game.GetURLMap(), ".") == -1 ) 103 | textData = textData @ MapNameMarker @ Level.Game.GetURLMap(); 104 | else 105 | textData = textData @ MapNameMarker @ left( Level.Game.GetURLMap(), InStr(Level.Game.GetURLMap(), ".") ); 106 | textData = textData @ SvrNameMarker @ Level.Game.GameReplicationInfo.ServerName; 107 | textData = textData @ GameTypeMarker @ Level.Game.m_szCurrGameType; 108 | textData = textData @ MaxPlayersMarker @ Level.Game.MaxPlayers; 109 | if ( Level.Game.AccessControl.GamePasswordNeeded() ) 110 | integerData = 1; 111 | else 112 | integerData = 0; 113 | textData = textData @ LockedMarker @ integerData; 114 | if ( Level.NetMode == NM_DedicatedServer ) 115 | integerData = 1; 116 | else 117 | integerData = 0; 118 | textData = textData @ DecicatedMarker @ integerData; 119 | MapListType = "Engine.R6MapList"; 120 | ML = class(DynamicLoadObject(MapListType, class'Class')); 121 | myList = spawn(ML); 122 | textData = textData @ MapListMarker $ " "; 123 | for ( iCounter = 0; iCounter < arraycount(myList.Maps); iCounter++ ) 124 | { 125 | if ( myList.Maps[iCounter] != "" ) 126 | { 127 | if ( InStr(myList.Maps[iCounter], ".") == -1 ) 128 | textData = textData $ "/" $ myList.Maps[iCounter]; 129 | else 130 | textData = textData $ "/" $ left( myList.Maps[iCounter], InStr(myList.Maps[iCounter], ".") ); 131 | } 132 | } 133 | textData = textData @ MenuGmNameMarker $ " "; 134 | for ( iCounter = 0; iCounter < arraycount(myList.Maps); iCounter++ ) 135 | { 136 | textData = textData $ "/" $ Level.GetGameTypeFromClassName(R6MapList(myList).GameType[iCounter]) ; 137 | } 138 | myList.Destroy(); 139 | textData = textData @ PlayerListMarker $ " "; 140 | CheckForPlayerTimeouts(); 141 | iNumPlayers = 0; 142 | for (_Controller=Level.ControllerList; _Controller!=None; _Controller=_Controller.NextController) 143 | { 144 | aPC = PlayerController(_Controller); 145 | if (aPC!=none) 146 | { 147 | textData = textData $ "/" $ aPC.PlayerReplicationInfo.PlayerName; 148 | if ( NetConnection( aPC.Player) == None ) 149 | szIPAddr = WindowConsole(aPC.Player.Console).szStoreIP; 150 | else 151 | szIPAddr = aPC.GetPlayerNetworkAddress(); 152 | szIPAddr = left( szIPAddr, InStr( szIPAddr, ":" ) ); 153 | iPingTimeMS[iNumPlayers] = aPC.PlayerReplicationInfo.Ping; 154 | iKillCount[iNumPlayers] = aPC.PlayerReplicationInfo.m_iKillCount; 155 | fPlayingTime[iNumPlayers] = GetPlayingTime( szIPAddr ); 156 | iNumPlayers++; 157 | } 158 | } 159 | textData = textData @ PlayerTimeMarker $ " "; 160 | for (iCounter = 0; iCounter < iNumPlayers; iCounter++ ) 161 | { 162 | textData = textData $ "/" $ DisplayTime( INT( fPlayingTime[iCounter] ) ); 163 | } 164 | textData = textData @ PlayerPingMarker $ " "; 165 | for (iCounter = 0; iCounter < iNumPlayers; iCounter++ ) 166 | { 167 | textData = textData $ "/" $ iPingTimeMS[iCounter]; 168 | } 169 | textData = textData @ PlayerKillMarker $ " "; 170 | for (iCounter = 0; iCounter < iNumPlayers; iCounter++ ) 171 | { 172 | textData = textData $ "/" $ iKillCount[iCounter]; 173 | } 174 | textData = textData @ NumPlayersMarker @ iNumPlayers; 175 | textData = textData @ RoundsPerMatchMarker @ pServerOptions.RoundsPerMatch; 176 | textData = textData @ RoundTimeMarker @ pServerOptions.RoundTime; 177 | textData = textData @ BetTimeMarker @ pServerOptions.BetweenRoundTime; 178 | if (pServerOptions.BombTime > -1) 179 | textData = textData @ BombTimeMarker @ pServerOptions.BombTime; 180 | if ( pServerOptions.ShowNames ) 181 | integerData = 1; 182 | else 183 | integerData = 0; 184 | textData = textData @ ShowNamesMarker @ integerData; 185 | if ( pServerOptions.InternetServer ) 186 | integerData = 1; 187 | else 188 | integerData = 0; 189 | textData = textData @ InternetServerMarker @ integerData; 190 | if ( pServerOptions.FriendlyFire ) 191 | integerData = 1; 192 | else 193 | integerData = 0; 194 | textData = textData @ FriendlyFireMarker @ integerData; 195 | if ( pServerOptions.Autobalance ) 196 | integerData = 1; 197 | else 198 | integerData = 0; 199 | textData = textData @ AutoBalTeamMarker @ integerData; 200 | if ( pServerOptions.TeamKillerPenalty ) 201 | integerData = 1; 202 | else 203 | integerData = 0; 204 | textData = textData @ TKPenaltyMarker @ integerData; 205 | textData = textData @ GameVersionMarker @ Level.GetGameVersion(); 206 | if ( pServerOptions.AllowRadar ) 207 | integerData = 1; 208 | else 209 | integerData = 0; 210 | textData = textData @ AllowRadarMarker @ integerData; 211 | textData = textData @ LobbyServerIDMarker $ " 0"; 212 | textData = textData @ GroupIDMarker $ " 0"; 213 | textData = textData @ BeaconPortMarker @ boundport; 214 | textData = textData @ NumTerroMarker @ pServerOptions.NbTerro; 215 | if ( pServerOptions.AIBkp ) 216 | integerData = 1; 217 | else 218 | integerData = 0; 219 | textData = textData @ AIBkpMarker @ integerData; 220 | if ( pServerOptions.RotateMap ) 221 | integerData = 1; 222 | else 223 | integerData = 0; 224 | textData = textData @ RotateMapMarker @ integerData; 225 | if ( pServerOptions.ForceFPersonWeapon ) 226 | integerData = 1; 227 | else 228 | integerData = 0; 229 | textData = textData @ ForceFPWpnMarker @ integerData; 230 | textData = textData @ ModNameMarker @ class'Actor'.static.GetModMgr().m_pCurrentMod.m_szKeyWord; 231 | textData = textData @ PunkBusterMarker $ " 0"; 232 | 233 | // Begin OpenRVS modifications. 234 | motd = pServerOptions.MOTD; 235 | if ( len(motd) > MOTD_MAX_LEN ) 236 | motd = left(motd, MOTD_MAX_LEN); 237 | textData = textData @ getMarker(MARKER_MOTD) @ motd; 238 | // End OpenRVS modifications. 239 | 240 | return textData; 241 | } 242 | 243 | private function string getMarker(string m) 244 | { 245 | // Chr(182) returns ¶ 246 | return Chr(182) $ m; 247 | } 248 | -------------------------------------------------------------------------------- /OpenRVS/classes/OpenHTTPClient.uc: -------------------------------------------------------------------------------- 1 | // OpenHTTPClient handles all HTTP/TCP traffic originating from the game client. 2 | // The base game only uses UDP, so this is only used by us. 3 | // TcpLink extends InternetLink extends InternetInfo extends Info extends Actor. 4 | // Use Spawn(class'OpenHTTPClient') to get an instance. 5 | // HTTP clients store an HttpResponse, an array buffer, and a reference 6 | // to each callback provider. These are all reused and should not be set to None 7 | // after use. Instead, set your HTTP client instance to None with finished. 8 | // WARNING: UE2 only supports HTTP 1.0; HTTP 1.1 connections won't close before 9 | // timing out. 10 | // Instructions for using OpenHTTPClient: 11 | // 1. Write a callback function with the signature `function C(HttpResponse r)`. 12 | // Your function can operate on the status code `r.Code` or the response 13 | // body `r.Body`. This function should be added to the very bottom of this 14 | // file. 15 | // 2. Add the name of your callback as a const in this class. 16 | // 3. Add a reference to your callback provider as a var in this class. 17 | // 4. Register your callback in the switch statement in triggerCallbacks(). 18 | // 5. After spawning the client, set c.CallbackName = "your_callback" and set 19 | // c.YourCallbackProvider = class. Then you can call c.SendRequest() and 20 | // receive the data in your callback provider. 21 | class OpenHTTPClient extends TcpLink; 22 | 23 | // 24 | // Types 25 | // 26 | 27 | struct ParsedURL 28 | { 29 | var string Host;//e.g. google.com 30 | var int Port;//e.g. 80 31 | var string Path;//e.g. /servers 32 | }; 33 | 34 | struct HttpResponse 35 | { 36 | var int Code;//e.g. 200 (OK) or 404 (Not Found) 37 | var string Body;//response body 38 | }; 39 | 40 | // 41 | // Instance Variables 42 | // 43 | 44 | var HttpResponse Response; 45 | var array kiloBuffer;//array of 999-byte response segments 46 | var bool requestInFlight; 47 | 48 | var string Host; 49 | var int Port; 50 | var string Path; 51 | var string CallbackName; 52 | 53 | // Add new Callback vars here. 54 | const CALLBACK_SERVER_LIST = "server_list"; 55 | var OpenServerList ServerListCallbackProvider; 56 | 57 | const CALLBACK_VERSION_CHECK = "version_check"; 58 | var OpenRVS VersionCheckCallbackProvider; 59 | 60 | // 61 | // Event Overrides 62 | // 63 | 64 | // Called when domain resolution is successful. 65 | // The IpAddr struct Addr contains the valid address. 66 | event Resolved(IpAddr Addr) 67 | { 68 | super.Resolved(Addr); 69 | 70 | class'OpenLogger'.static.Debug("dns resolution succeeded, initiating connection", self); 71 | Addr.Port = Port; 72 | Open(Addr); 73 | } 74 | 75 | // Called when domain resolution fails. 76 | event ResolveFailed() 77 | { 78 | super.ResolveFailed(); 79 | 80 | class'OpenLogger'.static.Error("dns resolution failed", self); 81 | triggerCallbacks();//caller still needs to process a result 82 | 83 | super.Destroy();//clean up the connection 84 | } 85 | 86 | // Opened: Called when socket successfully connects. 87 | // Sends an HTTP request. 88 | event Opened() 89 | { 90 | local string CRLF; 91 | 92 | super.Opened(); 93 | class'OpenLogger'.static.Debug("connection opened", self); 94 | 95 | // HTTP GET request format: 96 | // First line is "GET $PATH $HOST HTTP/1.0" followed by CRLF. 97 | // Next N lines are headers followed by CRLF. 98 | // Last line is empty line (CRLF). 99 | 100 | CRLF = Chr(13) $ Chr(10); 101 | SendText("GET" @ Path @ "HTTP/1.0" $ CRLF $ "Host:" @ Host $ CRLF $ "Accept: text/plain" $ CRLF $ CRLF); 102 | class'OpenLogger'.static.Debug("request sent", self); 103 | } 104 | 105 | // ReceivedText: Called when data is received. 106 | // It will only deliver 999 bytes of data per call, so we need to buffer the output. 107 | event ReceivedText(string bytes) 108 | { 109 | super.ReceivedText(bytes); 110 | 111 | class'OpenLogger'.static.Debug("text received. size:" @ Len(bytes) @ "bytes", self); 112 | kiloBuffer[kiloBuffer.Length] = bytes; 113 | } 114 | 115 | // Closed: Called when Close() completes or the connection is dropped. 116 | // Parses an HTTP response and sends it to the matching callback function. 117 | event Closed() 118 | { 119 | local HttpResponse resp; 120 | local string bytes; 121 | local int i; 122 | 123 | super.Closed(); 124 | 125 | class'OpenLogger'.static.Debug("connection closed, data is ready", self); 126 | 127 | // Merge paged response data. 128 | for (i=0; i urlParts; 230 | local int numParts; 231 | local ParsedURL parsed; 232 | local int i; 233 | local string path; 234 | local int sep;//index of ":" 235 | 236 | if (InStr(url, "http://") == -1) 237 | url = "http://" $ url;//make http:// optional 238 | 239 | //before: "http://www.example.com[:80]/servers" 240 | //after: ["http:", "", "www.example.com[:80]", "servers"] 241 | numParts = class'OpenString'.static.Split(url, "/", urlParts); 242 | 243 | // Parse host and port. 244 | if (InStr(urlParts[2], ":") == -1)//url does not contain port 245 | { 246 | parsed.Host = urlParts[2]; 247 | parsed.Port = 80;//make port optional 248 | } 249 | else//url contains port 250 | { 251 | parsed.Host = Left(urlParts[2], InStr(urlParts[2], ":"));//up to : 252 | parsed.Port = int(Mid(urlParts[2], InStr(urlParts[2], ":")+1));//after : 253 | } 254 | 255 | // Parse path. 256 | for (i=3; i" + CRLF e.g. "HTTP/1.0 200 OK" 276 | // Next N lines are info+headers followed by CRLF. 277 | // Next line is CRLF only. 278 | // Remaining lines are HTTP response body. 279 | 280 | if (Left(response, 4) != "HTTP")//this is not an HTTP response 281 | { 282 | resp.Code = -1; 283 | return resp; 284 | } 285 | resp.Code = int(Mid(response, 9, 11));//response code is always these three characters. 286 | 287 | // Two CRLF in a row precede response body. 288 | CRLF = Chr(13) $ Chr(10); 289 | bodyStartsAt = InStr(response, CRLF $ CRLF); 290 | resp.Body = Mid(response, bodyStartsAt+4);//4=bytes of CR LF CR LF 291 | 292 | return resp; 293 | } 294 | 295 | // 296 | // Callbacks (in lieu of waiting for responses, get a callback instead) 297 | // Callbacks should accept an HttpResponse as the only param and return nothing. 298 | // 299 | 300 | // Feed data to the server list parser. 301 | function ServerListCallback(HttpResponse resp) 302 | { 303 | if (ServerListCallbackProvider == none) 304 | { 305 | class'OpenLogger'.static.Debug("ServerListCallbackProvider was none", self); 306 | return;//nothing to do 307 | } 308 | ServerListCallbackProvider.ParseServers(resp); 309 | } 310 | 311 | // Return the latest OpenRVS version to the version checker. 312 | function VersionCheckCallback(HttpResponse resp) 313 | { 314 | if (VersionCheckCallbackProvider == none) 315 | { 316 | class'OpenLogger'.static.Debug("VersionCheckCallbackProvider was none", self); 317 | return;//nothing to do 318 | } 319 | VersionCheckCallbackProvider.CheckVersion(resp); 320 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenCustomMissionWidget.uc: -------------------------------------------------------------------------------- 1 | //NEW in 1.3 2 | //allows loading custom gametypes! 3 | //handles creation of a new button for game type selection 4 | //handles spawning the proper gametype 5 | 6 | //mods should be: 7 | // - a text file with extension ".game", includes: 8 | // - GameType - the string for the new gametype class eg "newmod.mynewgametype" 9 | // - ParentGameType - the default game type it extends, eg "RGM_LoneWolfMode" 10 | // - ButtonText - the appearance of the new button in Custom Mission, usually caps, eg "STEALTH WOLF" 11 | // - HelpString - the tooltip text that appears at the bottom on mouseover 12 | // - UTX or U files that contain any needed resources 13 | 14 | //issue: 15 | // - after pressing > button on mission completed (maybe on failed too?), all custom buttons disappear for good 16 | class OpenCustomMissionWidget extends R6MenuCustomMissionWidget; 17 | 18 | var config string GameType;//the string for the new gametype class eg "newmod.mynewgametype" 19 | var config string ParentGameType;//the default game type it extends, eg "RGM_LoneWolfMode" 20 | var config string ButtonText;//the appearance of the new button in Custom Mission, eg "Stealth Wolf" 21 | var config string HelpString;//the info that will appear in the box, eg "A stealthy version of Lone Wolf by Twi" 22 | 23 | var bool CurrentIsCustomType;//we are clicked on a custom game type button 24 | var array CustomTypeBut;//the buttons for the custom game type 25 | struct GInfo 26 | { 27 | var string GType;//class of new type 28 | var string PType;//parent game type marker 29 | var string BText;//button text 30 | var string HText;//tooltip text 31 | }; 32 | var array NewTypes;//all the new game type mods we find 33 | 34 | //finds all *.game files and uses them to populate the list of modded game types 35 | function LoadNewGameTypes() 36 | { 37 | local R6FileManager pFileManager; 38 | local int i,iFiles; 39 | local string szIniFilename; 40 | local GInfo Temp; 41 | pFileManager = new(none) class'R6FileManager'; 42 | iFiles = pFileManager.GetNbFile("..\\Mods\\","game"); 43 | for ( i = 0; i < iFiles; i++ ) 44 | { 45 | GameType = ""; 46 | ParentGameType = ""; 47 | ButtonText = ""; 48 | HelpString = ""; 49 | pFileManager.GetFileName(i,szIniFilename); 50 | if ( szIniFilename == "" ) 51 | continue; 52 | LoadConfig("..\\Mods\\"$szIniFilename); 53 | if ( GameType != "" ) 54 | { 55 | Temp.GType = GameType; 56 | Temp.PType = ParentGameType; 57 | Temp.BText = ButtonText; 58 | Temp.HText = HelpString; 59 | NewTypes[NewTypes.length] = Temp; 60 | } 61 | } 62 | } 63 | 64 | //modified from super to create buttons for the new game types 65 | function CreateButtons() 66 | { 67 | local float fXOffset,fYOffset,fWidth,fHeight,fYPos; 68 | local int i; 69 | local R6WindowButton Temp; 70 | fXOffset = 10; 71 | fYOffset = 26; 72 | fWidth = 200; 73 | fHeight = 25; 74 | fYPos = 64; 75 | super.CreateButtons();//create the default buttons before cycling through *.game files looking for a new game mode to create 76 | LoadNewGameTypes(); 77 | i = 0; 78 | while ( i < NewTypes.length ) 79 | { 80 | Temp = R6WindowButton(CreateControl(class'R6WindowButton',fXOffset,(fYOffset*(i+1))+142,fWidth,fHeight,self)); 81 | Temp.ToolTipString = NewTypes[i].HText; 82 | Temp.Text = NewTypes[i].BText; 83 | Temp.m_iButtonID = 99 + i; 84 | Temp.Align = TA_Left; 85 | Temp.m_buttonFont = m_LeftButtonFont; 86 | Temp.CheckToDownSizeFont(m_LeftDownSizeFont,0); 87 | Temp.ResizeToText(); 88 | CustomTypeBut[CustomTypeBut.length] = Temp; 89 | i++; 90 | } 91 | i = 0; 92 | while ( i < CustomTypeBut.length ) 93 | { 94 | if ( CustomMissionGameType == CustomTypeBut[i].m_iButtonID ) 95 | { 96 | m_pButCurrent.m_bSelected = false; 97 | m_pButCurrent = CustomTypeBut[i]; 98 | CustomTypeBut[i].m_bSelected = true; 99 | CurrentIsCustomType = true; 100 | RefreshList();//help fix? 101 | } 102 | i++; 103 | } 104 | } 105 | 106 | //from super 107 | //now adds U and UTX support to the Mods folder 108 | //this is the first OpenRVS code which is executed by clients 109 | function Created() 110 | { 111 | local R6Mod Temp; 112 | local OpenRVS openrvs; 113 | 114 | openrvs = new class'OpenRVS'; 115 | openrvs.Init(GetEntryLevel());//initialize OpenRVS 116 | openrvs = none;//done initializing 117 | 118 | super.Created(); 119 | Temp = class'Actor'.static.GetModMgr().m_pCurrentMod; 120 | Temp.m_aExtraPaths[Temp.m_aExtraPaths.length] = "..\\Mods\\*.u"; 121 | Temp.m_aExtraPaths[Temp.m_aExtraPaths.length] = "..\\Mods\\*.utx"; 122 | class'Actor'.static.GetModMgr().AddNewModExtraPath(Temp,0); 123 | } 124 | 125 | //rewritten from super 126 | //will get the custom game type if a custom type button is selected 127 | function GotoPlanning() 128 | { 129 | local R6MenuRootWindow R6Root; 130 | local R6MissionDescription CurrentMission; 131 | local R6WindowListBoxItem SelectedItem; 132 | local R6Console R6Console; 133 | R6Root = R6MenuRootWindow(Root); 134 | //Make sure that ValidateBeforePlanning() has returned true 135 | //Before calling this 136 | SelectedItem = R6WindowListBoxItem(m_GameLevelBox.m_SelectedItem); 137 | CurrentMission = R6MissionDescription(SelectedItem.m_Object);//IF THIS IS NONE WE ARE SCREWED 138 | R6Console = R6Console(Root.console); 139 | R6Console.master.m_StartGameInfo.m_CurrentMission = CurrentMission; 140 | R6Console.master.m_StartGameInfo.m_MapName = CurrentMission.m_MapName; 141 | R6Console.master.m_StartGameInfo.m_DifficultyLevel = R6MenuDiffCustomMissionSelect(m_DifficultyArea.m_ClientArea).GetDifficulty(); 142 | R6Console.master.m_StartGameInfo.m_iNbTerro = R6MenuCustomMissionNbTerroSelect(m_TerroArea.m_ClientArea).GetNbTerro(); 143 | if ( CurrentIsCustomType )//need to grab raw text of class name 144 | R6Console.master.m_StartGameInfo.m_GameMode = NewTypes[m_pButCurrent.m_iButtonID - 99].GType; 145 | else 146 | R6Console.master.m_StartGameInfo.m_GameMode = GetLevel().GetGameTypeClassName(GetLevel().ConvertGameTypeIntToString(m_pButCurrent.m_iButtonID)); 147 | CustomMissionMap = CurrentMission.m_MapName; 148 | CustomMissionGameType = m_pButCurrent.m_iButtonID; 149 | SaveConfig(); 150 | Root.ResetMenus(); 151 | R6Root.m_bLoadingPlanning = true; 152 | R6Console.PreloadMapForPlanning(); 153 | } 154 | 155 | //rewritten from super 156 | //if a custom game type selected, will get the parent type to display maplist 157 | function RefreshList() 158 | { 159 | local int i, iCampaign, iMission; 160 | local R6console r6Console; 161 | local string szMapName; 162 | local R6WindowListBoxItem NewItem, ItemToSelect; 163 | local string szGameType; 164 | local R6MissionDescription mission; 165 | r6console = R6Console( Root.Console ); 166 | if ( CurrentIsCustomType )//need to grab parent type flag 167 | szGameType = NewTypes[m_pButCurrent.m_iButtonID - 99].PType; 168 | else 169 | szGameType = GetLevel().ConvertGameTypeIntToString(m_pButCurrent.m_iButtonID); 170 | m_GameLevelBox.Clear(); 171 | // loop on campaign and list all thier mission in the right order 172 | iCampaign = 0; 173 | while ( iCampaign < r6console.m_aCampaigns.length ) 174 | { 175 | iMission = 0; 176 | while ( iMission < r6console.m_aCampaigns[iCampaign].m_missions.length ) 177 | { 178 | mission = r6console.m_aCampaigns[iCampaign].m_missions[iMission]; 179 | // a campaign and is available and is for the current mod 180 | if ( mission.IsAvailableInGameType( szGameType ) && mission.m_MapName != "" && CampainMapExistInMapList(mission)) 181 | { 182 | szMapName = Localize( mission.m_MapName, "ID_MENUNAME", mission.LocalizationFile, true ); 183 | if ( szMapName == "" ) // failed to find the name, copy the map map (usefull for debugging) 184 | { 185 | szMapName = mission.m_MapName; 186 | } 187 | NewItem = R6WindowListBoxItem(m_GameLevelBox.Items.Append(m_GameLevelBox.ListClass)); 188 | NewItem.HelpText = szMapName; 189 | NewItem.m_Object = mission; 190 | if ( mission.m_bIsLocked ) 191 | { 192 | NewItem.m_bDisabled = true; 193 | } 194 | else if((mission.m_MapName == m_LastMapPlayed) && (ItemToSelect == None)) 195 | { 196 | ItemToSelect = NewItem; 197 | } 198 | } 199 | ++iMission; 200 | } 201 | ++iCampaign; 202 | } 203 | // loop on the mission description and add all none campaign mission 204 | iMission = 0; 205 | while ( iMission < r6console.m_aMissionDescriptions.length ) 206 | { 207 | mission = r6console.m_aMissionDescriptions[iMission]; 208 | // not a campaign and is available and is for the current mod 209 | if ( !mission.m_bCampaignMission && mission.IsAvailableInGameType( szGameType ) && mission.m_MapName != "" ) 210 | { 211 | szMapName = Localize( mission.m_MapName, "ID_MENUNAME", mission.LocalizationFile, true ); 212 | if ( szMapName == "" ) // failed to find the name, copy the map map (usefull for debugging) 213 | { 214 | szMapName = mission.m_MapName; 215 | } 216 | NewItem = R6WindowListBoxItem(m_GameLevelBox.Items.Append(m_GameLevelBox.ListClass)); 217 | NewItem.HelpText = szMapName; 218 | NewItem.m_Object = mission; 219 | if ( mission.m_bIsLocked ) 220 | { 221 | NewItem.m_bDisabled = true; 222 | } 223 | else if((mission.m_MapName == m_LastMapPlayed) && (ItemToSelect == None)) 224 | { 225 | ItemToSelect = NewItem; 226 | } 227 | } 228 | ++iMission; 229 | } 230 | if(m_GameLevelBox.Items.Count() > 0) 231 | { 232 | if(ItemToSelect != None) 233 | m_GameLevelBox.SetSelectedItem(ItemToSelect); 234 | else 235 | m_GameLevelBox.SetSelectedItem(R6WindowListBoxItem(m_GameLevelBox.Items.Next)); 236 | m_GameLevelBox.MakeSelectedVisible(); 237 | } 238 | //TO DO : FILTER MAPS 239 | UpdateBackground(); 240 | m_LastMapPlayed = ""; 241 | } 242 | 243 | //from super 244 | //handles the number of tangos area 245 | //needs to get the string of parent type if custom 246 | function UpdateBackground() 247 | { 248 | local string s; 249 | if ( CurrentIsCustomType )//need to grab parent type flag 250 | s = NewTypes[m_pButCurrent.m_iButtonID - 99].PType; 251 | else 252 | s = GetLevel().ConvertGameTypeIntToString(m_pButCurrent.m_iButtonID); 253 | if ( GetLevel().GameTypeUseNbOfTerroristToSpawn(s) ) 254 | { 255 | m_DifficultyArea.SetCornerType(Top_Corners); 256 | m_TerroArea.ShowWindow(); 257 | // randomly update the background texture 258 | Root.SetLoadRandomBackgroundImage("OtherMission"); 259 | } 260 | else 261 | { 262 | m_DifficultyArea.SetCornerType(All_Corners); 263 | m_TerroArea.HideWindow(); 264 | // randomly update the background texture 265 | Root.SetLoadRandomBackgroundImage("PracticeMission"); 266 | } 267 | } 268 | 269 | //from super 270 | //needs to set CurrentIsCustomType based on what we click 271 | function Notify(UWindowDialogControl C, byte E) 272 | { 273 | local R6WindowListBoxItem SelectedItem; 274 | local R6MissionDescription CurrentMission; 275 | local R6WindowBitMap mapBitmap; 276 | local int i; 277 | if(E == DE_Click) 278 | { 279 | switch(C) 280 | { 281 | case m_ButtonMainMenu: 282 | Root.ChangeCurrentWidget(MainMenuWidgetID); 283 | break; 284 | case m_ButtonOptions: 285 | Root.ChangeCurrentWidget(OptionsWidgetID); 286 | break; 287 | case m_ButtonStart: 288 | if( ValidateBeforePlanning() ) 289 | GotoPlanning(); 290 | break; 291 | case m_pButPraticeMission: 292 | case m_pButLoneWolf: 293 | case m_pButTerroHunt: 294 | case m_pButHostageRescue: 295 | CurrentIsCustomType = false; 296 | case m_pButCurrent: 297 | m_pButCurrent.m_bSelected = false; 298 | R6WindowButton(C).m_bSelected = true; 299 | m_pButCurrent = R6WindowButton(C); 300 | RefreshList(); 301 | break; 302 | case m_GameLevelBox: 303 | mapBitmap = R6WindowBitMap(m_Map.m_ClientArea); 304 | SelectedItem = R6WindowListBoxItem(m_GameLevelBox.m_SelectedItem); 305 | 306 | if(SelectedItem == None) 307 | { 308 | mapBitmap.T = None; 309 | break; 310 | } 311 | if(SelectedItem.m_Object == None) 312 | break; 313 | CurrentMission = R6MissionDescription(SelectedItem.m_Object); 314 | if(CurrentMission == None) 315 | break; 316 | //This is for the current mission overview texture 317 | //Bottom right og the page 318 | mapBitmap.R = CurrentMission.m_RMissionOverview; 319 | mapBitmap.T = CurrentMission.m_TMissionOverview; 320 | break; 321 | default: 322 | //added so that we can click on the new types and it sets the customtype flag to true, then refreshes 323 | i = 0; 324 | while ( i < CustomTypeBut.length ) 325 | { 326 | if ( ( R6WindowButton(C) != none ) && ( R6WindowButton(C) == CustomTypeBut[i] ) ) 327 | { 328 | CurrentIsCustomType = true; 329 | m_pButCurrent.m_bSelected = false; 330 | R6WindowButton(C).m_bSelected = true; 331 | m_pButCurrent = R6WindowButton(C); 332 | RefreshList(); 333 | } 334 | i++; 335 | } 336 | break; 337 | } 338 | } 339 | else if (E == DE_DoubleClick) 340 | { 341 | // start a game on a double-click on the list 342 | if ( (C == m_GameLevelBox) && ( ValidateBeforePlanning() ) ) 343 | { 344 | GotoPlanning(); 345 | } 346 | } 347 | } -------------------------------------------------------------------------------- /OpenRVS/classes/OpenMultiPlayerWidget.uc: -------------------------------------------------------------------------------- 1 | //fixes UBI's shitty connection code 2 | //improves port logic 3 | //allows you to join ip in the internet tab 4 | //also allows listing of predermined good servers in internet tab 5 | //debug - logs the joining server process 6 | //IMPORTANT: assumes that serverbeaconport is main port+1000 7 | //installed client side 8 | 9 | class OpenMultiPlayerWidget extends R6MenuMultiPlayerWidget; 10 | 11 | struct AServer 12 | { 13 | var string ServerName; 14 | var string IP; 15 | var bool Locked; 16 | var string GameMode; 17 | var int iMaxPlayers,iNumPlayers;//1.5 - max players/current players 18 | var string szGameType;//1.5 - localized game mode name 19 | var string szMap;//1.5 - map name 20 | var bool bWrongVersion;//1.5 - running same expansion mod - for future use? - needs to be inverted so only true value will trigger changing the menu 21 | var int iPing;//1.5 - ping 22 | }; 23 | var array ServerList;//1.3 - not config - config is now in openserverlist, which handles loading the backup list 24 | var config string ServerURL;//0.8 server list URL to load 25 | var config string ServerListURL;//0.8 server list file to load 26 | var bool bServerSuccess;//0.8 got list of servers from online provider 27 | var array OpenQueries;//1.5 keep track of servers we've queried 28 | var OpenTimer Timer;//1.5 ping update 29 | var OpenServerList OS;//moved here from local - because needed in tab switching function 30 | var bool bNeedsExtraRefresh;//if going from lan tab to internet, we need an extra refresh forced after the server list is fetched 31 | 32 | // QueryReceivedStartPreJoin() (aka PREJOIN) fires when a server query has 33 | // completed successfully. It is called by the SendMessage() function. In the 34 | // base game, it is responsible for validating CD keys and joining Ubi.com rooms. 35 | // In our version, we use the EJRC_NO enum to disable the Ubi.com interaction. 36 | // Overrides the matching function in R6MenuMultiPlayerWidget. 37 | function QueryReceivedStartPreJoin () 38 | { 39 | R6MenuRootWindow(Root).m_pMenuCDKeyManager.StartCDKeyProcess(EJRC_NO, 40 | m_GameService.m_ClientBeacon.PreJoinInfo); 41 | } 42 | 43 | // Created() fires when the menu widget has been successfully created. It is 44 | // called by ShowWindow(). In the base game, it sets up some variables regarding 45 | // server list refreshes. In our version, we use our own server types to 46 | // populate the server list. 47 | // Overrides the matching function in R6MenuMultiPlayerWidget. 48 | // Added in 0.8 - made this function load saved URL for server list 49 | function Created() 50 | { 51 | super.Created(); 52 | m_GameService.m_bAutoLISave = false;//0.9 freeze fix - not sure if this does anything but seems to help steam users 53 | LoadConfig("openrvs.ini");//0.8 - see if we need alternate list source 54 | OS = Root.Console.ViewportOwner.Actor.spawn(class'OpenServerList');//get the server list over http 55 | OS.Init(self,ServerURL,ServerListURL);//0.8 made this load saved config vars in openrvs.ini 56 | } 57 | 58 | //couldn't get server list 59 | //1.3 - this function no longer used! 60 | //openserverlist handles loading the backup list and sending to this class 61 | function NoServerList() 62 | { 63 | class'OpenLogger'.static.Info("loading backup file Servers.list", self); 64 | LoadConfig("Servers.list"); 65 | bServerSuccess = true;//0.8 - leave this here if we want backup server list to get queried too 66 | GetGSServers(); 67 | } 68 | 69 | //1.3 70 | //clears server list 71 | function ClearServerList() 72 | { 73 | ServerList.remove(0,ServerList.length); 74 | } 75 | 76 | // Adds a server to the list. 77 | function AddServerToList(string sn, string sip, string sm) 78 | { 79 | //fill the array with fetched servers 80 | //1.3 attempt 81 | //rewrote some of the dynamic array logic - see openserverlist for changes 82 | //moved parsing the list to the openserverlist class 83 | //to prevent auto saving and loading in this class's super 84 | local AServer Temp; 85 | Temp.ServerName = sn; 86 | Temp.IP = sip; 87 | Temp.GameMode = sm; 88 | Temp.iPing = 1000;//1.5 - don't let iPing initialize with null value of 0 - for sorting. If server responds, this value will be set to actual ping 89 | ServerList[ServerList.length] = Temp; 90 | } 91 | 92 | //1.3 93 | //receives the signal that the server list is built 94 | function FinishedServers() 95 | { 96 | bServerSuccess = true; 97 | GetGSServers(); 98 | if ( bNeedsExtraRefresh ) 99 | { 100 | bNeedsExtraRefresh = false; 101 | Refresh(false); 102 | } 103 | } 104 | 105 | // GetGSServers() retrieves the current list of servers from the GameService. 106 | // It fires when filters or favorites are changed, when switching tabs in the MP 107 | // menu, and in the Paint() function which fills the window. 108 | // In the base game, it does not refresh the list, but instead processes a list 109 | // which has already been built. 110 | // Overrides the matching function in R6MenuMultiPlayerWidget. 111 | function GetGSServers() 112 | { 113 | local R6WindowListServerItem NewItem; 114 | local int i,j; 115 | local int iNumServers; 116 | local int iNumServersDisplay; 117 | local string szSelSvrIP; 118 | local bool bFirstSvr; 119 | local string szGameType; 120 | local LevelInfo pLevel; 121 | local R6Console console; 122 | local int iNbPages; 123 | local int iStartingIndex,iEndIndex; 124 | local R6ServerList.stGameServer _stGameServer; 125 | 126 | InitServerList();//needed here to prevent big accessed nones! 127 | console = R6Console(Root.Console); 128 | pLevel = GetLevel(); 129 | 130 | // Remember IP of selected server, we sill keep this server highlighted 131 | // in the list if it is still there after the list has been rebuilt. 132 | 133 | if ( m_ServerListBox.m_SelectedItem != none ) 134 | szSelSvrIP = R6WindowListServerItem(m_ServerListBox.m_SelectedItem).szIPAddr; 135 | else 136 | szSelSvrIP = ""; 137 | 138 | m_ServerListBox.ClearListOfItems(); // Clear current list of servers 139 | m_ServerListBox.m_SelectedItem = none; 140 | 141 | //iNumServers = m_GameService.m_GameServerList.length; 142 | iNumServers = ServerList.length; 143 | //iNumServersDisplay = m_GameService.GetDisplayListSize(); 144 | 145 | bFirstSvr = true; 146 | 147 | // nb of page 148 | //iNbPages = iNumServersDisplay / console.iBrowserMaxNbServerPerPage; 149 | iNbPages = 1; // start at page 1 150 | 151 | // cap the page number 152 | // set current page / set max page 153 | //if ( m_PageCount.m_iCurrentPages > iNbPages ) 154 | // m_PageCount.SetCurrentPage( iNbPages ); 155 | 156 | //if ( iNbPages != m_PageCount.m_iTotalPages ) 157 | // m_PageCount.SetTotalPages( iNbPages ); 158 | 159 | //iStartingIndex = console.iBrowserMaxNbServerPerPage * (m_PageCount.m_iCurrentPages - 1); 160 | //iEndIndex = iStartingIndex + console.iBrowserMaxNbServerPerPage; 161 | 162 | //if ( iEndIndex > iNumServersDisplay ) 163 | // iEndIndex = iNumServersDisplay; 164 | 165 | i = 0; 166 | while ( i < ServerList.length ) 167 | { 168 | NewItem = R6WindowListServerItem(m_ServerListBox.GetNextItem(i,NewItem)); 169 | NewItem.Created(); 170 | NewItem.iMainSvrListIdx = i; 171 | NewItem.bFavorite = true;//todo - favorite servers 172 | NewItem.bSameVersion = !ServerList[i].bWrongVersion;//true;//1.5 change - bWrongVersion inits as false but can be set true in later check 173 | NewItem.szIPAddr = ServerList[i].IP; 174 | NewItem.iPing = ServerList[i].iPing; 175 | NewItem.szName = ServerList[i].ServerName; 176 | NewItem.szMap = ServerList[i].szMap;//"";//1.5 change 177 | NewItem.iMaxPlayers = ServerList[i].iMaxPlayers; 178 | NewItem.iNumPlayers = ServerList[i].iNumPlayers; 179 | NewItem.bLocked = ServerList[i].Locked; 180 | NewItem.bDedicated = true;//todo: grab dedicated info from client beacon receiver 181 | NewItem.bPunkBuster = false; 182 | //Root.GetMapNameLocalisation( NewItem.szMap, NewItem.szMap, true); 183 | NewItem.szGameType = ServerList[i].szGameType;//"";//1.5 change 184 | if ( InStr(caps(ServerList[i].GameMode),"ADV") != -1 ) 185 | NewItem.szGameMode = Localize("MultiPlayer","GameMode_Adversarial","R6Menu"); 186 | else 187 | NewItem.szGameMode = Localize("MultiPlayer","GameMode_Cooperative","R6Menu"); 188 | // If selected server is still in list, reset this item 189 | // to be the selcted server. By default the selected server will 190 | // be the first server in the list. 191 | if ( NewItem.szIPAddr == szSelSvrIP || bFirstSvr ) 192 | { 193 | m_ServerListBox.SetSelectedItem( NewItem );//sends this server upstream 194 | //m_GameService.SetSelectedServer( i ); 195 | } 196 | //if ( m_GameService.m_GameServerList[i].szIPAddress == szSelSvrIP ) 197 | // m_oldSelItem = m_ServerListBox.m_SelectedItem; 198 | //if ( NewItem.szIPAddr == szSelSvrIP ) 199 | // m_oldSelItem = m_ServerListBox.m_SelectedItem; 200 | 201 | bFirstSvr = false; 202 | i++; 203 | } 204 | 205 | ManageToolTip("", true); 206 | } 207 | 208 | // JoinSelectedServerRequested() fires when a user connects to a server in the 209 | // server list. In the base game, it parses the IP, sends a beacon request, and 210 | // then hands off to StartQueryServerInfoProcedure(). In our version, we skip 211 | // any calls to the CD key manager. 212 | // Overrides the matching function in R6MenuMultiPlayerWidget. 213 | function JoinSelectedServerRequested() 214 | { 215 | if ( m_ServerListBox.m_SelectedItem == None ) 216 | return; 217 | if ( m_ConnectionTab == TAB_Internet_Server ) 218 | { 219 | //0.7: treat the connection as a join IP connection 220 | m_pJoinIPWindow.ShowWindow(); 221 | R6WindowEditBox(m_pJoinIPWindow.m_pEnterIP.m_ClientArea).SetValue(R6WindowListServerItem(m_ServerListBox.m_SelectedItem).szIPAddr);//set the join ip box to selected server ip 222 | m_pJoinIPWindow.PopUpBoxDone(MR_OK,EPopUpID_EnterIP);//fake a click on OK 223 | m_bJoinIPInProgress = true; 224 | } 225 | else 226 | super.JoinSelectedServerRequested(); 227 | } 228 | 229 | // ShowWindow() displays the server list window. It fires when a user changes 230 | // tabs in the multiplayer menu. In the base game, it performs some CD key 231 | // checking. In our version, these checks are disabled. 232 | // Overrides the matching function in R6MenuMultiPlayerWidget. 233 | //0.8 - create a custom client beacon receiver class 234 | //0.9 - fix freeze here? 235 | function ShowWindow() 236 | { 237 | //0.8 attempt: allow super to run 238 | //but then replace the created client beacon with our own 239 | //0.9 fix: copy all super into this function and eliminate super call 240 | //super.ShowWindow();//0.9 - lag fix 241 | local string _szIpAddress; 242 | 243 | //BELOW IS FROM SUPER! 244 | //important line from 1.6 - not present in 1.56! 245 | //without this, will hang permanently on please wait 246 | R6MenuRootWindow(Root).m_pMenuCDKeyManager.SetWindowUser(MultiPlayerWidgetID,self);//root.15 is the UTPT version 247 | 248 | // Since the client beacon is an actor, it will get 249 | // destroyed every time we change levels. Check here 250 | // if the beacon exists and re-spawn when needed. 251 | if ( m_LanServers == none ) 252 | { 253 | m_LanServers = new(none) class(Root.MenuClassDefines.ClassLanServer); 254 | R6Console(Root.console).m_LanServers = m_LanServers; 255 | m_LanServers.Created(); 256 | InitServerList(); 257 | InitSecondTabWindow();//GameMode,Tech Filter,ServerInfo; 258 | } 259 | if ( m_LanServers.m_ClientBeacon == none ) 260 | m_LanServers.m_ClientBeacon = Root.Console.ViewportOwner.Actor.spawn(class'OpenClientBeaconReceiver');//ClientBeaconReceiver');//0.9! 261 | m_GameService.m_ClientBeacon = m_LanServers.m_ClientBeacon; 262 | m_iLastSortCategory = m_LanServers.eSortCategory.eSG_PingTime; 263 | m_bLastTypeOfSort = true; 264 | 265 | //SUPER is actually uwindowwindow showwindow() 266 | //added here instead of calling super 267 | //Super.ShowWindow();//0.9 268 | ParentWindow.ShowChildWindow(self); 269 | WindowShown(); 270 | //end uwindowwindow super() 271 | 272 | //0.9 - freeze 273 | //R6Console(Root.console).m_GameService.InitGSCDKey();//0.9 kill the freeze! 274 | //end 0.9 275 | 276 | // randomly update the background texture 277 | Root.SetLoadRandomBackgroundImage("Multiplayer"); 278 | if ( R6Console(Root.console).m_bNonUbiMatchMaking ) 279 | { 280 | class'Actor'.static.NativeNonUbiMatchMakingAddress(_szIpAddress); 281 | // ASE DEVELOPMENT - Eric Begin - May 11th, 2003 282 | // 283 | // In orfer to simplify the code, I added a new function "StartCmdLineJoinIPProcedure" 284 | // This functoin make sure that the player is connected on Ubi.Com before login in on the 285 | // game server 286 | m_pJoinIPWindow.StartCmdLineJoinIPProcedure(m_ButtonJoinIP,_szIpAddress); 287 | m_bJoinIPInProgress = true; 288 | } 289 | //END SUPER 290 | } 291 | 292 | // Refresh() refreshes the list of servers. In the base game, it clears the list 293 | // and rebuilds it with fresh data. In our version, we execute our own refresh. 294 | // Refresh is called at the following times: 295 | // - When a user opens the Internet tab for the first time 296 | // - When a user opens the LAN tab for the first time 297 | // - When a user manually refreshes the list of servers 298 | // Overrides the matching function in R6MenuMultiPlayerWidget. 299 | // 0.8: should let refresh button also update player counts 300 | function Refresh(bool bActivatedByUser) 301 | { 302 | local bool bFound;//1.5 - prevent multiple open queries 303 | local int i,j; 304 | 305 | super.Refresh(bActivatedByUser);//call super first 306 | 307 | //dont do this function if we haven't received a server list OR if the open beacon isn't loaded 308 | if ( !bServerSuccess ) 309 | return; 310 | if ( m_LanServers == none ) 311 | return; 312 | if ( ( m_LanServers.m_ClientBeacon == none ) || ( !m_LanServers.m_ClientBeacon.IsA('OpenClientBeaconReceiver') ) ) 313 | return; 314 | 315 | //1.5 - if initiated by user, clear the list of current queries and start fresh 316 | if ( bActivatedByUser ) 317 | OpenQueries.remove(0,OpenQueries.length); 318 | //0.9: get each server in the list, then query for more info 319 | //1.5 - query ServerList instead 320 | j = 0; 321 | while ( j < ServerList.length ) 322 | { 323 | i = 0; 324 | bFound = false; 325 | ServerList[j].iPing = 1000;//set to 1000 so if server doesn't respond this time, it will sort to the bottom of the list 326 | //1.5 - only one open query to a server at a time 327 | while ( i < OpenQueries.length ) 328 | { 329 | if ( OpenQueries[i] == ServerList[j].IP )//aleady have query open 330 | { 331 | bFound = true; 332 | break; 333 | } 334 | i++; 335 | } 336 | if ( !bFound ) 337 | { 338 | OpenQueries[OpenQueries.length] = ServerList[j].IP; 339 | //1.5 - get rough ping 340 | if ( Timer == none ) 341 | { 342 | Timer = new class'OpenTimer'; 343 | Timer.ClockSource = GetLevel(); 344 | } 345 | Timer.StartTimer(ServerList[j].IP); 346 | OpenClientBeaconReceiver(m_GameService.m_ClientBeacon).QuerySingleServer(self, 347 | Left(ServerList[j].IP,InStr(ServerList[j].IP,":")), 348 | int(Mid(ServerList[j].IP,InStr(ServerList[j].IP,":")+1))+1000); 349 | } 350 | j++; 351 | } 352 | } 353 | 354 | //0.8 written 355 | //1.3 added mod keyword locking 356 | //1.5 receive locked info from specific servers, not master list 357 | function ReceiveServerInfo(string sIP,coerce int iNumP,coerce int iMaxP,string sGMode,string sMapName,string sSvrName,string sModName,bool bSvrLocked) 358 | { 359 | local R6WindowListServerItem CurServer; 360 | local int i,iTime; 361 | 362 | //1.5 363 | //modify the servers array rather than the list items 364 | //then rebuild list items with GetGSServers() 365 | i = 0; 366 | while ( i < OpenQueries.length ) 367 | { 368 | if ( OpenQueries[i] == sIP )//close open query 369 | { 370 | OpenQueries.remove(i,1); 371 | break; 372 | } 373 | i++; 374 | } 375 | i = 0; 376 | while ( i < ServerList.length ) 377 | { 378 | if ( ServerList[i].IP == sIP ) 379 | { 380 | ServerList[i].ServerName = sSvrName; 381 | ServerList[i].Locked = bSvrLocked; 382 | ServerList[i].iMaxPlayers = iMaxP; 383 | ServerList[i].iNumPlayers = iNumP; 384 | ServerList[i].szGameType = GetLevel().GetGameNameLocalization(sGMode); 385 | ServerList[i].szMap = sMapName; 386 | ServerList[i].bWrongVersion = ( caps(class'Actor'.static.GetModMgr().m_pCurrentMod.m_szKeyWord) != caps(sModName) ); 387 | iTime = Timer.EndTimer(sIP); 388 | if ( iTime != -1 ) 389 | ServerList[i].iPing = iTime / 2;//divide by two for single-trip time - consistent with how Ubi used to measure 390 | } 391 | i++; 392 | } 393 | GetGSServers(); 394 | } 395 | 396 | // InitServerList() creates a window for the server list. It is called by 397 | // ShowWindow(). In our version, we are able to override the server ping timeout. 398 | // Overrides the matching function in R6MenuMultiPlayerWidget. 399 | // 1.3: fixed access none 400 | function InitServerList() 401 | { 402 | local Font buttonFont; 403 | local int iFiles, i, j; 404 | 405 | // Create window for server list 406 | if ( m_ServerListBox != none ) 407 | return; 408 | m_ServerListBox = R6WindowServerListBox(CreateWindow(class'R6WindowServerListBox',K_XSTARTPOS_NOBORDER,K_YPOS_FIRST_TABWINDOW,K_WINDOWWIDTH_NOBORDER,K_FFIRST_WINDOWHEIGHT,self)); 409 | m_ServerListBox.Register( m_pFirstTabManager); 410 | m_ServerListBox.SetCornerType(No_Borders); 411 | m_ServerListBox.m_Font = Root.Fonts[F_ListItemSmall]; 412 | if ( m_LanServers != none )//accessed none fix? 413 | m_ServerListBox.m_iPingTimeOut = m_LanServers.NativeGetPingTimeOut(); 414 | else 415 | m_ServerListBox.m_iPingTimeOut = 10000; 416 | } 417 | 418 | //sorting update 1.5 419 | //calls super if in LAN tab - use the built-in native functions for LAN 420 | function ResortServerList(int iCategory, bool _bAscending) 421 | { 422 | local int i,j;//indices for iterating ServerList 423 | local bool bSwap; 424 | local int iListSize; 425 | local AServer temp; 426 | local string sCompare1,sCompare2; 427 | local int iCompare1,iCompare2; 428 | local bool bIntComp; 429 | 430 | if ( m_ConnectionTab == TAB_Lan_Server ) 431 | { 432 | super.ResortServerList(iCategory,_bAscending); 433 | return; 434 | } 435 | m_iLastSortCategory = iCategory; 436 | m_bLastTypeOfSort = _bAscending; 437 | iListSize = ServerList.length; 438 | for ( i = 0; i < iListSize - 1; i++ ) 439 | { 440 | for ( j = 0; j < iListSize - 1 - i; j++ ) 441 | { 442 | bIntComp = false; 443 | bSwap = false; 444 | switch ( iCategory ) 445 | { 446 | case 1://locked 447 | sCompare1 = string(ServerList[j].Locked); 448 | sCompare2 = string(ServerList[j+1].Locked); 449 | break; 450 | case 5://name 451 | sCompare1 = ServerList[j].ServerName; 452 | sCompare2 = ServerList[j+1].ServerName; 453 | break; 454 | case 6://game type 455 | sCompare1 = ServerList[j].szGameType; 456 | sCompare2 = ServerList[j+1].szGameType; 457 | break; 458 | case 7://game mode 459 | sCompare1 = ServerList[j].GameMode; 460 | sCompare2 = ServerList[j+1].GameMode; 461 | break; 462 | case 8://map name 463 | sCompare1 = ServerList[j].szMap; 464 | sCompare2 = ServerList[j+1].szMap; 465 | break; 466 | case 9://num players 467 | bIntComp = true; 468 | iCompare1 = ServerList[j].iNumPlayers; 469 | iCompare2 = ServerList[j+1].iNumPlayers; 470 | break; 471 | default://ping sort and ALL unsupported right now (fav, punkbuster, dedicated) sort by ping - todo: add support for displaying and sorting by dedicated server, favorites 472 | bIntComp = true; 473 | iCompare1 = ServerList[j].iPing; 474 | iCompare2 = ServerList[j+1].iPing; 475 | break; 476 | } 477 | if ( bIntComp )//compare int sizes 478 | { 479 | if ( _bAscending ) 480 | bSwap = iCompare1 > iCompare2; 481 | else 482 | bSwap = iCompare1 < iCompare2; 483 | } 484 | else//compare strings 485 | { 486 | if ( _bAscending ) 487 | bSwap = sCompare1 > sCompare2; 488 | else 489 | bSwap = sCompare1 < sCompare2; 490 | } 491 | bSwap = ( ( bSwap || ( ServerList[j].iPing == 1000 ) ) && ( ServerList[j+1].iPing != 1000 ) );//always send servers with no response to the bottom of the list 492 | if ( bSwap ) 493 | { 494 | temp = ServerList[j]; 495 | ServerList[j] = ServerList[j + 1]; 496 | ServerList[j + 1] = temp; 497 | } 498 | } 499 | } 500 | GetGSServers();//forces a rebuild in the menu list items based on our resorted ServerList array 501 | } 502 | 503 | // ManageTabSelection() performs various actions when a user changes the tab in 504 | // the multiplayer menu. 505 | // Overrides the matching function in R6MenuMultiPlayerWidget. 506 | // Copied directly and commented out additional refreshes. 507 | function ManageTabSelection(INT _MPTabChoiceID) 508 | { 509 | switch(_MPTabChoiceID) 510 | { 511 | case MultiPlayerTabID.TAB_Lan_Server: 512 | m_ConnectionTab = TAB_Lan_Server; 513 | ClearServerList();//added to fix bug where internet servers stay in lan tab 514 | m_ServerListBox.ClearListOfItems();//fix lan tab 515 | m_ServerListBox.m_SelectedItem = none;//fix lan tab 516 | if ( m_LanServers.m_GameServerList.length == 0 ) 517 | Refresh( FALSE ); 518 | GetLanServers(); 519 | GetServerInfo( m_LanServers ); 520 | UpdateServerFilters(); 521 | m_iLastTabSel = MultiPlayerTabID.TAB_Lan_Server; 522 | SaveConfig(); 523 | break; 524 | case MultiPlayerTabID.TAB_Internet_Server: 525 | m_ConnectionTab = TAB_Internet_Server; 526 | m_LoginSuccessAction = eLSAct_InternetTab; 527 | m_pLoginWindow.StartLogInProcedure(self); 528 | //if ( m_GameService.m_GameServerList.length == 0 ) 529 | // Refresh( FALSE ); 530 | //when clicking from LAN to internet 531 | if ( m_iLastTabSel == MultiPlayerTabID.TAB_Lan_Server ) 532 | { 533 | ClearServerList(); 534 | bNeedsExtraRefresh = true;//force a refresh once server list fetched 535 | if ( OS != none ) 536 | OS.Init(self,ServerURL,ServerListURL);//fix bug switching between internet/lan tabs - need to refetch server list 537 | } 538 | //GetGSServers();//commented out - this will get called automatically when openserverlist is done 539 | UpdateServerFilters(); 540 | m_iLastTabSel = MultiPlayerTabID.TAB_Internet_Server; 541 | SaveConfig(); 542 | break; 543 | case MultiPlayerTabID.TAB_Game_Mode: 544 | m_FilterTab = TAB_Game_Mode; 545 | m_ServerInfoPlayerBox.HideWindow(); 546 | m_ServerInfoMapBox.HideWindow(); 547 | m_ServerInfoOptionsBox.HideWindow(); 548 | m_pSecondWindow.HideWindow(); 549 | m_pSecondWindowGameMode.ShowWindow(); 550 | m_pSecondWindow = m_pSecondWindowGameMode; 551 | break; 552 | case MultiPlayerTabID.TAB_Tech_Filter: 553 | m_FilterTab = TAB_Tech_Filter; 554 | m_ServerInfoPlayerBox.HideWindow(); 555 | m_ServerInfoMapBox.HideWindow(); 556 | m_ServerInfoOptionsBox.HideWindow(); 557 | m_pSecondWindow.HideWindow(); 558 | m_pSecondWindowFilter.ShowWindow(); 559 | m_pSecondWindow = m_pSecondWindowFilter; 560 | break; 561 | case MultiPlayerTabID.TAB_Server_Info: 562 | m_FilterTab = TAB_Server_Info; 563 | m_pSecondWindow.HideWindow(); 564 | m_pSecondWindowServerInfo.ShowWindow(); 565 | m_ServerInfoPlayerBox.ShowWindow(); 566 | m_ServerInfoMapBox.ShowWindow(); 567 | m_ServerInfoOptionsBox.ShowWindow(); 568 | m_pSecondWindow = m_pSecondWindowServerInfo; 569 | break; 570 | default: 571 | class'OpenLogger'.static.Warning("This tab was not supported (OpenMultiPlayerWidget)", self); 572 | break; 573 | } 574 | } 575 | 576 | defaultproperties 577 | { 578 | ServerURL="api.openrvs.org" 579 | ServerListURL="servers" 580 | //ServerList(0)=(ServerName="SMC Mod Testing",IP="185.24.221.23:7777",MaxPlayers=4,Locked=true,GameMode="coop") 581 | //ServerList(1)=(ServerName="ShadowSquadHQ Adver",IP="198.23.145.10:7778",MaxPlayers=16,Locked=false,GameMode="Adver") 582 | } 583 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------