Ticket #2116: patch_splashscreen.diff

File patch_splashscreen.diff, 2.6 KB (added by Itms, 11 years ago)
  • binaries/data/config/default.cfg

     
    2020; Enable/disable windowed mode by default. (Use Alt+Enter to toggle in the game.)
    2121windowed = false
    2222
    23 ; Enable/disable the splashscreen
    24 splashscreenenable = true
     23; Choose the splashscreen. (0 to disable it.)
     24splashscreen = 1
    2525
    2626; Pause the game on window focus loss (Only applicable to single player mode)
    2727pauseonfocusloss = true
  • binaries/data/mods/public/gui/splashscreen/splashscreen.xml

     
    2323        <object name="btnOK" type="button" style="StoneButton" tooltip_style="snToolTip" size="24 100%-52 188 100%-24">
    2424            OK
    2525            <action on="Press"><![CDATA[
    26             Engine.SetSplashScreenEnabled(!getGUIObjectByName("displaySplashScreen").checked);
     26            if(getGUIObjectByName("displaySplashScreen").checked)
     27                Engine.SetSplashScreen(0);
    2728            Engine.PopGuiPage();
    2829            ]]></action>
    2930        </object>
  • source/gui/scripting/ScriptFunctions.cpp

     
    525525
    526526bool IsSplashScreenEnabled(void* UNUSED(cbdata))
    527527{
    528     bool splashScreenEnable = true;
    529     CFG_GET_VAL("splashscreenenable", Bool, splashScreenEnable);
    530     return splashScreenEnable;
     528    unsigned int splashScreen = 0;
     529    CFG_GET_VAL("splashscreen", UnsignedInt, splashScreen);
     530   
     531    return (splashScreen != 0);
    531532}
    532533
    533 void SetSplashScreenEnabled(void* UNUSED(cbdata), bool enabled)
     534void SetSplashScreen(void* UNUSED(cbdata), unsigned int id)
    534535{
    535     CStr val = (enabled ? "true" : "false");
    536     g_ConfigDB.CreateValue(CFG_USER, "splashscreenenable")->m_String = val;
     536    CStr val = CStr::FromUInt(id);
     537    g_ConfigDB.CreateValue(CFG_USER, "splashscreen")->m_String = val;
    537538    g_ConfigDB.WriteFile(CFG_USER);
    538539}
    539540
     
    719720
    720721    // Splash screen functions
    721722    scriptInterface.RegisterFunction<bool, &IsSplashScreenEnabled>("IsSplashScreenEnabled");
    722     scriptInterface.RegisterFunction<void, bool, &SetSplashScreenEnabled>("SetSplashScreenEnabled");
     723    scriptInterface.RegisterFunction<void, unsigned int, &SetSplashScreen>("SetSplashScreen");
    723724
    724725    // Development/debugging functions
    725726    scriptInterface.RegisterFunction<void, float, &SetSimRate>("SetSimRate");