Game Development Community

OOPS!! Help me restore the Torque Splash!

by Nicolai Dutka · in Torque Game Engine Advanced · 07/03/2009 (2:29 pm) · 13 replies

I removed the Torque Splash screen that displays for a couple seconds before displaying the main menu... I did this over a year ago and didn't realize it has to be there if I plan to sell this game... Problem is, I must've deleted the code and files rather than comment it out because I can't remember how I removed it and therefore I can't remember how to put it back in.

I could simply make a new gui and stick in the Torque Splash Screen as an image, then set a timer to switch to my main menu, but I don't know what the required display length is and would just rather have it all back the way it was intended so I don't have any legal concerns...

Any help at all on this is much appreciated!

#1
07/03/2009 (4:03 pm)
Very simple.

Look in any of the examples. ~/client/ui/startup.gui
#2
07/03/2009 (4:32 pm)
Has to be more to it than that...

I do still have the startup.gui file and added it back to the 'exec' list in: client/init.cs

Loaded up the game and still get nothing... There isn't a startup.cs either...
#3
07/03/2009 (5:18 pm)
This changes depending on the version of TGEA. In the version I'm currently looking at, LoadStartup() in Startupg.GUI is called from your client/init.cs (last thing in initClient()). There is no .CS file for this gui (the scripts are embedded).
LoadStartup sets the canvas to StartupGui. StartupGui has a single control which references the logo.



#4
07/04/2009 (1:59 am)
Here's my startupGui.gui with multiple (2) splashscreens, "click-through", and a fade to black feature.

  • It all resides in "scriptsAndassets/client/ui/StartupGui.gui
  • the intial call to loadStartup(); is at the end of function initClient()

  • new GuiFadeinBitmapCtrl(StartupGui) 
    {
       profile = "GuiInputCtrlProfile";
       horizSizing = "right";
       vertSizing = "bottom";
       position = "0 0";
       extent = "640 480";
       minExtent = "8 8";
       visible = "1";
       helpTag = "0";
       bitmap = "";
       wrap = "0";
       fadeinTime = "1000";
       waitTime = "3000";
       fadeoutTime = "1000";
    };
    
    new GuiFadeinBitmapCtrl(BlankGui) 
    {
       profile = "GuiInputCtrlProfile";
       horizSizing = "right";
       vertSizing = "bottom";
       position = "0 0";
       extent = "640 480";
       minExtent = "8 8";
       visible = "1";
       helpTag = "0";
       bitmap = "";
       wrap = "0";
       fadeinTime = "100";
       waitTime = "2000";
       fadeoutTime = "100";
    };
    
    function loadStartup()
    {
       $StartupIdx = 0;
       StartupGui::next();
       schedule(100, 0, checkStartupDone);
    
       // If you want a sound or music to play add a suitable sound to the directory 
       // indicated, you can change this directory if you wish.  
       SFXPlayOnce(AudioGui, "scrptsAndAssets/data/sound/gui/startup");
    
       // You could also create a SFXProfile, and play that sound, but since this is 
       // a one-time only type of sound I use the above line.
       //sfxPlay(startsnd); 
    }
       
    function StartupGui::click()
    {
       StartupGui.done = true;
       checkStartupDone();
    }
    
    function StartupGui::next()
    {
       Canvas.setContent(BlankGui);
       $StartupIdx++;
       %bitmap[1] = "splash1.png";
       %bitmap[2] = "splash2.jpg";
       StartupGui.setBitmap("scriptsAndAssets/client/ui/"@ %bitmap[$StartupIdx]);
       StartupGui.done = false;
       Canvas.setContent(StartupGui);
    }
    
    function checkStartupDone()
    {
       if (!isObject(StartupGui))
          return;
       if (StartupGui.done)
          if ($StartupIdx == 2)
          {
             StartupGui.done = 1;
             StartupGui.delete();
             BlankGui.delete();
             //flushTextureCache();
             loadMainMenu(); 
             //sfxStop(startsnd);  // Uncomment this if you use the SFXProfile mentioned above.
          } 
          else 
          {           
             StartupGui::next();
             schedule(100, 0, checkStartupDone);
          }
       else
          schedule(100, 0, checkStartupDone);
    }

    Note this line -
    StartupGui.setBitmap("scriptsAndAssets/client/ui/"@ %bitmap[$StartupIdx]);
    - and make sure it points to the correct filepath, the %bitmap[$StartupIdx] array provides the file name.
    #5
    07/04/2009 (2:03 am)
    Oh, and the approved GarageGames splash has to display for 4 seconds....

    The above code does
  • 1 sec fadein
  • 3 sec display
  • 1 sec fadeout
  • So close enough, maybe.... ;D
    #6
    04/15/2015 (11:13 am)
    I've been working with this same issue, so that piece of code goes into the startup.gui or the init.cs ?
    #7
    04/16/2015 (6:13 am)
    Which engine? You're using TGEA? Or T3D?
    #8
    04/16/2015 (9:35 am)
    In general it's better practice to have a separation between gui and code, but it doesn't really matter so long as it gets exec'd.

    The tricky bit is that the older engines weren't very consistent from project to project so client initialization varies. Somewhere (ususally found in "~/scripts/client/init.cs") within initClient() you''ll need to tell it to loadStartUp() instead of loadMainMenu() (or the equivalent).
    #9
    04/17/2015 (2:57 am)

    // Default player key bindings
    exec("./scripts/default.bind.cs");
    exec("./config.cs");

    exec("./scripts/rpg/mission.cs");


    // Really shouldn't be starting the networking unless we are
    // going to connect to a remote server, or host a multi-player
    // game.
    setNetPort(0);

    // Copy saved script prefs into C++ code.
    setShadowDetailLevel( $pref::shadows );
    setDefaultFov( $pref::Player::defaultFov );
    setZoomSpeed( $pref::Player::zoomSpeed );

    // Start up the main menu... this is separated out into a
    // method for easier mod override.

    if ($JoinGameAddress !$= "") {
    // If we are instantly connecting to an address, load the
    // main menu then attempt the connect.

    loadMainMenu();
    connect($JoinGameAddress, "", $Pref::Player::Name);
    }
    else {
    // Otherwise go to the splash screen.
    Canvas.setCursor("DefaultCursor");
    loadStartup();
    loadMainMenu();
    }
    }


    //-----------------------------------------------------------------------------


    function loadMainMenu()
    {
    // Startup the client with the Main menu...
    Canvas.setContent( MainMenuGui );
    Canvas.pushDialog( EULAWnd );
    FadeWnd.fadeinTime = 400;
    Canvas.pushDialog( FadeWnd );
    if ($displayPatch)
    Py::DisplayPatchInfo();


    // Make sure the audio initialized.
    if($Audio::initFailed) {
    MessageBoxOK("Audio Initialization Failed",
    "The OpenAL audio system failed to initialize. " @
    "You can get the most recent OpenAL drivers at http://openal.org/downloads.html");
    }

    Canvas.setCursor("DefaultCursor");
    }
    #10
    04/17/2015 (3:03 am)
    that is the lower part of init.cs startup.gui was commented out and I reinstated it, and I found the actual gui part for that..

    //--- OBJECT WRITE BEGIN ---
    new GuiFadeinBitmapCtrl(StartupGui) {
    canSaveDynamicFields = "0";
    Profile = "GuiInputCtrlProfile";
    HorizSizing = "right";
    VertSizing = "bottom";
    position = "0 0";
    Extent = "1024 768";
    MinExtent = "8 8";
    canSave = "1";
    Visible = "1";
    renderTooltip = "0";
    hovertime = "1000";
    bitmap = "./splash.png";
    wrap = "0";
    modulation = "0.945098 0.929412 0.898039 1";
    canMove = "0";
    fadeInTime = "200";
    waitTime = "5000";
    fadeOutTime = "200";
    done = "0";
    };
    //--- OBJECT WRITE END ---

    thats all there is in startup.gui
    #11
    04/17/2015 (3:05 am)
    I know from use, it loads the mainmenu.gui before it connects to any server... the first thing that comes on the screen after you install the game and load it up to play is the EULA.Gui .... and after you click agree.. it "pops"... and the mainmenu.gui is there. just giving an idea to how it loads.
    #12
    04/17/2015 (9:11 am)
    Right here...
    // Otherwise go to the splash screen.
    Canvas.setCursor("DefaultCursor");
    loadStartup();
    loadMainMenu();
    The call to loadStartup() is immediatelysuperceded by the one to loadMainMenu(). If you comment the call to loadMainMenu() then the splash screen should display. However since there is not a check startup done method you'll need to implement one like in the above code, or you could use a schedule to initiate the main menu after an amount of time has passed.
    #13
    01/18/2016 (2:09 am)
    well I've found about fourteen ways to break it, and you are correct if you don't put in a start.done check it just loops at the splash screen. unfortunately for me I couldn't find any examples of a stop check that I could successfully implement to work. I copied and pasted from this page and others and experimented with it.. to no avail.. something so simple for some but for me.. couldn't make it work. it would either break completely and seizure while populating cursors at machine gun speed, or just sit on the splash screen... so I took it all back to "stock" just so it works again.... maybe one of you guys could "hold my hand" lol... just been one of them days.