shithub: choc

Download patch

ref: 7a8b8e57e7bd6b6a61b8492031bf5e995272e6bf
parent: 854cb8073a336455d0bcd9b6a40d67c1b4226bb3
author: Simon Howard <fraggle@gmail.com>
date: Mon Oct 17 14:51:27 EDT 2011

Always show the Strife intro splash screen in windowed mode, and finish
the splash screen before network startup.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2435

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -420,6 +420,7 @@
     TryRunTics();
 
     I_SetWindowTitle(gamedescription);
+    I_GraphicsCheckCommandLine();
     I_InitGraphics();
     I_EnableLoadingDisk();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -246,6 +246,7 @@
         debugfile = fopen(filename, "w");
     }
     I_SetWindowTitle(gamedescription);
+    I_GraphicsCheckCommandLine();
     I_InitGraphics();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
 
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -564,6 +564,7 @@
         debugfile = fopen(filename, "w");
     }
     I_SetWindowTitle("Hexen");
+    I_GraphicsCheckCommandLine();
     I_InitGraphics();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -180,8 +180,8 @@
 
 // Screen width and height, from configuration file.
 
-static int screen_width = SCREENWIDTH;
-static int screen_height = SCREENHEIGHT;
+int screen_width = SCREENWIDTH;
+int screen_height = SCREENHEIGHT;
 
 // Color depth.
 
@@ -194,11 +194,11 @@
 
 // Run in full screen mode?  (int type for config code)
 
-static int fullscreen = true;
+int fullscreen = true;
 
 // Aspect ratio correction mode
 
-static int aspect_ratio_correct = true;
+int aspect_ratio_correct = true;
 
 // Time to wait for the screen to settle on startup before starting the
 // game (ms)
@@ -1581,7 +1581,7 @@
     }
 }
 
-static void CheckCommandLine(void)
+void I_GraphicsCheckCommandLine(void)
 {
     int i;
 
@@ -2033,10 +2033,6 @@
         I_Error("Failed to initialize video: %s", SDL_GetError());
     }
 
-    // Check for command-line video-related parameters.
-
-    CheckCommandLine();
-
     // Set up title and icon.  Windows cares about the ordering; this
     // has to be done before the call to SDL_SetVideoMode.
 
@@ -2212,4 +2208,3 @@
     }
 #endif
 }
-
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -78,6 +78,7 @@
 // and sets up the video mode
 void I_InitGraphics (void);
 
+void I_GraphicsCheckCommandLine(void);
 
 void I_ShutdownGraphics(void);
 
@@ -125,5 +126,10 @@
 extern int usegamma;
 extern byte *I_VideoBuffer;
 
-#endif
+extern int screen_width;
+extern int screen_height;
+extern int screen_bpp;
+extern int fullscreen;
+extern int aspect_ratio_correct;
 
+#endif
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -84,6 +84,11 @@
 
 #include "d_main.h"
 
+// Size of startup splash screen window.
+
+#define INTRO_SCREEN_W 640
+#define INTRO_SCREEN_H 480
+
 //
 // D-DoomLoop()
 // Not a globally visible function,
@@ -494,11 +499,9 @@
 
     TryRunTics();
 
-    if(!showintro) // [STRIFE]
-    {
-        I_SetWindowTitle(gamedescription);
-        I_InitGraphics();
-    }
+    I_SetWindowTitle(gamedescription);
+    I_InitGraphics();
+
     I_EnableLoadingDisk();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
 
@@ -1174,10 +1177,38 @@
 // [STRIFE] New function
 // haleyjd 20110206: Initialize the graphical introduction sequence
 //
+
+static int saved_screen_width, saved_screen_height;
+static int saved_fullscreen, saved_aspect_ratio_correct;
+
 static void D_InitIntroSequence(void)
 {
     if(showintro)
     {
+        // Intro splash screen runs in a window. We must save the actual
+        // display settings, and temporarily overwrite them with the
+        // windowed-mode settings. The real settings will be restored
+        // when the intro screen finishes.
+
+        saved_screen_width = screen_width;
+        saved_screen_height = screen_height;
+        saved_aspect_ratio_correct = aspect_ratio_correct;
+        saved_fullscreen = fullscreen;
+
+        // If the game display settings are to run in a small window, it
+        // makes no sense to switch to a larger window for the splash
+        // screen, so use the configured settings.
+
+        if (fullscreen
+         || screen_width > INTRO_SCREEN_W || screen_height > INTRO_SCREEN_H)
+        {
+            screen_width = INTRO_SCREEN_W;
+            screen_height = INTRO_SCREEN_H;
+            aspect_ratio_correct = 1;
+        }
+
+        fullscreen = 0;
+
         // In vanilla Strife, Mode 13h was initialized directly in D_DoomMain.
         // We have to be a little more courteous of the low-level code here.
         I_SetWindowTitle(gamedescription);
@@ -1214,6 +1245,23 @@
     */
 }
 
+// End of intro splash screen.
+
+static void D_FinishIntroSequence(void)
+{
+    if (showintro)
+    {
+        I_ShutdownGraphics();
+
+        // Restore display settings to the actual ones.
+
+        screen_width = saved_screen_width;
+        screen_height = saved_screen_height;
+        fullscreen = saved_fullscreen;
+        aspect_ratio_correct = saved_aspect_ratio_correct;
+    }
+}
+
 //
 // D_DrawIntroSequence
 //
@@ -1648,6 +1696,8 @@
     D_SetGameDescription();
     SetSaveGameDir(iwadfile);
 
+    I_GraphicsCheckCommandLine();
+
     // haleyjd 20110206 [STRIFE] Startup the introduction sequence
     D_InitIntroSequence();
 
@@ -1874,33 +1924,39 @@
     if(devparm)
         DEH_printf("  Play voices = %d\n", disable_voices == 0);
 
+    // [STRIFE]: This has been rearranged. These intro ticks occur
+    // further down in Vanilla Strife; however, we have to finish
+    // the intro sequence here so that netgame startup can begin.
+    // The original calls to D_IntroTick() are commented-out below.
+
+    D_IntroTick();
+    D_IntroTick();
+    D_IntroTick();
+    D_IntroTick();
+    D_IntroTick();
+    D_IntroTick();
+    D_IntroTick();
+
+    D_FinishIntroSequence();
+
     if(devparm) // [STRIFE]
         DEH_printf("D_CheckNetGame: Checking network game status.\n");
     D_CheckNetGame ();
 
-    // STRIFE-TODO: This is a temporary hack. The startup splash screen
-    // stuff needs to be reworked.
-    // The netgame waiting screen killed the graphics display. Re-run
-    // I_InitGraphics() to bring it back again.
-    if (showintro && netgame)
-    {
-        I_InitGraphics();
-    }
-
     PrintGameVersion();
 
     if(devparm)
         DEH_printf("HU_Init: Setting up heads up display.\n");
     HU_Init ();
-    D_IntroTick(); // [STRIFE]
+    //D_IntroTick(); // [STRIFE]
 
     if(devparm)
         DEH_printf("ST_Init: Init status bar.\n");
     ST_Init ();
-    D_IntroTick(); // [STRIFE]
+    //D_IntroTick(); // [STRIFE]
 
     // haleyjd [STRIFE] -statcopy used to be here...
-    D_IntroTick();
+    //D_IntroTick(); // [STRIFE]
 
     // If Doom II without a MAP01 lump, this is a store demo.  
     // Moved this here so that MAP01 isn't constantly looked up
@@ -1926,7 +1982,7 @@
         G_RecordDemo (myargv[p+1]);
         autostart = true;
     }
-    D_IntroTick(); // [STRIFE]
+    //D_IntroTick(); // [STRIFE]
 
     p = M_CheckParmWithArgs("-playdemo", 1);
     if (p)
@@ -1935,7 +1991,7 @@
         G_DeferedPlayDemo (demolumpname);
         D_DoomLoop ();  // never returns
     }
-    D_IntroTick(); // [STRIFE]
+    //D_IntroTick(); // [STRIFE]
 
     p = M_CheckParmWithArgs("-timedemo", 1);
     if (p)
@@ -1943,7 +1999,7 @@
         G_TimeDemo (demolumpname);
         D_DoomLoop ();  // never returns
     }
-    D_IntroTick(); // [STRIFE]
+    //D_IntroTick(); // [STRIFE]
 
     if (startloadgame >= 0)
     {
@@ -1950,7 +2006,8 @@
         // [STRIFE]: different, for hubs
         M_LoadSelect(startloadgame);
     }
-    D_IntroTick(); // [STRIFE]
+    //D_IntroTick(); // [STRIFE]
+
 
     if (gameaction != ga_loadgame )
     {