foxygit / doom Log in
commit 8675ebb0cdaf2882e178f3e202ecf7fcd04a3e39
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Sun Sep 12 03:49:51 2010 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Sun Sep 12 03:49:51 2010 +0000

    Functional demosequence for storyboard intro and exit outro.

    Subversion-branch: /branches/strife-branch
    Subversion-revision: 2071
---
 src/strife/d_englsh.h |   3 +-
 src/strife/d_main.c   | 183 +++++++++++++++++++++++++++++++++++---------------
 src/strife/d_main.h   |   1 +
 src/strife/m_menu.c   |  96 +++++++++-----------------
 src/strife/s_sound.c  |   4 +-
 5 files changed, 165 insertions(+), 122 deletions(-)

diff --git a/src/strife/d_englsh.h b/src/strife/d_englsh.h
index 983526a1..743dfdea 100644
--- a/src/strife/d_englsh.h
+++ b/src/strife/d_englsh.h
@@ -68,7 +68,8 @@
 #define NETEND	"you can't end a netgame!\n\n"PRESSKEY
 #define ENDGAME	"are you sure you want to end the game?\n\n"PRESSYN

-#define DOSY		"(press y to quit to dos.)"
+// haleyjd 09/11/10: [STRIFE] No "to dos." on this
+#define DOSY		"(press y to quit)"

 #define DETAILHI	"High detail"
 #define DETAILLO	"Low detail"
diff --git a/src/strife/d_main.c b/src/strife/d_main.c
index 041a4bc8..97951aa5 100644
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -575,63 +575,119 @@ void D_DoAdvanceDemo (void)
     usergame = false;               // no save / end game here
     paused = false;
     gameaction = ga_nothing;
-
-    if (gamemode == retail && gameversion != exe_chex)
-      demosequence = (demosequence+1)%7;
-    else
-      demosequence = (demosequence+1)%6;

     switch (demosequence)
     {
-      case 0:
-	if ( gamemode == commercial )
-	    pagetic = TICRATE * 11;
-	else
-	    pagetic = 170;
-	gamestate = GS_DEMOSCREEN;
-	pagename = DEH_String("TITLEPIC");
-	if ( gamemode == commercial )
-	  S_StartMusic(mus_logo);   // villsa [STRIFE] TODO - fix music
-	else
-	  S_StartMusic (mus_intro);
-	break;
-      case 1:
-	G_DeferedPlayDemo(DEH_String("demo1"));
-	break;
-      case 2:
-	pagetic = 200;
-	gamestate = GS_DEMOSCREEN;
-	pagename = DEH_String("CREDIT");
-	break;
-      case 3:
-	G_DeferedPlayDemo(DEH_String("demo2"));
-	break;
-      case 4:
-	gamestate = GS_DEMOSCREEN;
-	if ( gamemode == commercial)
-	{
-	    pagetic = TICRATE * 11;
-	    pagename = DEH_String("TITLEPIC");
-	    S_StartMusic(mus_logo); // villsa [STRIFE] TODO - fix music
-	}
-	else
-	{
-	    pagetic = 200;
-
-	    if ( gamemode == retail )
-	      pagename = DEH_String("CREDIT");
-	    else
-	      pagename = DEH_String("HELP2");
-	}
-	break;
-      case 5:
-	G_DeferedPlayDemo(DEH_String("demo3"));
-	break;
-        // THE DEFINITIVE DOOM Special Edition demo
-      case 6:
-	G_DeferedPlayDemo(DEH_String("demo4"));
-	break;
+    case -5: // exit the game
+        I_Quit();
+        return;
+    case -4: // show exit screen
+        menuactive = false;
+        pagetic = 105;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("PANEL7");
+        S_StartMusic(mus_fast);
+        if(isdemoversion)
+            demosequence = -3; // show Velocity logo
+        else
+            demosequence = -5; // exit
+        return;
+    case -3: // show Velocity logo for demo version
+        pagetic = 210;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("vellogo");
+        demosequence = -5; // exit
+        return;
+    case -2: // title screen
+        pagetic = 210;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("TITLEPIC");
+        S_StartMusic(mus_logo);
+        demosequence = -1; // start intro cinematic
+        return;
+    case -1: // start of intro cinematic
+        pagetic = 10;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("PANEL0");
+        S_StartSound(NULL, sfx_rb2act);
+        wipegamestate = -1;
+        break;
+    case 0: // Rogue logo
+        pagetic = 140;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("RGELOGO");
+        wipegamestate = -1;
+        break;
+    case 1:
+        pagetic = 245;                    // The comet struck our planet without
+        gamestate = GS_DEMOSCREEN;        // warning.We lost our paradise in a
+        pagename = DEH_String("PANEL1");  // single, violent stroke.
+        I_StartVoice(DEH_String("pro1"));
+        S_StartMusic(mus_intro);
+        break;
+    case 2:
+        pagetic = 315;                    // The impact released a virus which
+        gamestate = GS_DEMOSCREEN;        // swept through the land and killed
+        pagename = DEH_String("PANEL2");  // millions. They turned out to be
+        I_StartVoice(DEH_String("pro2")); // the lucky ones...
+        break;
+    case 3:
+        pagetic = 420;                    // For those that did not die became
+        gamestate = GS_DEMOSCREEN;        // mutations of humanity. Some became
+        pagename = DEH_String("PANEL3");  // fanatics who heard the voice of a
+        I_StartVoice(DEH_String("pro3")); // malignant God in their heads, and
+        break;                            // called themselves the Order.
+    case 4:
+        pagetic = 385;                    // Those of us who were deaf to this
+        pagename = DEH_String("PANEL4");  // voice suffer horribly and are
+        gamestate = GS_DEMOSCREEN;        // forced to serve these ruthless
+        I_StartVoice(DEH_String("pro4")); // psychotics, who wield weapons more
+        break;                            // powerful than anything we can muster.
+    case 5:
+        pagetic = 350;                    // They destroy our women and children,
+        gamestate = GS_DEMOSCREEN;        // so that we must hide them underground,
+        pagename = DEH_String("PANEL5");  // and live like animals in constant
+        I_StartVoice(DEH_String("pro5")); // fear for our lives.
+        break;
+    case 6:                               // But there are whispers of discontent.
+        pagetic = 560;                    // If we organize, can we defeat our
+        gamestate = GS_DEMOSCREEN;        // masters? Weapons are being stolen,
+        pagename = DEH_String("PANEL6");  // soldiers are being trained. A
+        I_StartVoice(DEH_String("pro6")); // Movement is born! Born of lifelong
+        break;                            // STRIFE!
+    case 7: // titlepic again - unused...
+        pagetic = 315;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("TITLEPIC");
+        wipegamestate = -1;
+        break;
+    case 8: // demo
+        //ClearTmp();  STRIFE-TODO
+        pagetic = 315;
+        G_DeferedPlayDemo(DEH_String("demo1"));
+        break;
+    case 9: // velocity logo? - unused...
+        pagetic = 210;
+        gamestate = GS_DEMOSCREEN;
+        pagename = DEH_String("vellogo");
+        wipegamestate = -1;
+        break;
+    case 10: // credits
+        gamestate = GS_DEMOSCREEN;
+        pagetic = 420;
+        pagename = DEH_String("CREDIT");
+        wipegamestate = -1;
+        break;
+    default:
+        break;
     }
+
+    ++demosequence;
+
+    if(demosequence > 11)
+        demosequence = -2;
+    if(demosequence == 7 || demosequence == 9)
+        ++demosequence;
 }


@@ -639,14 +695,31 @@ void D_DoAdvanceDemo (void)
 //
 // D_StartTitle
 //
+// [STRIFE]
+// haleyjd 09/11/10: Small modifications for new demo sequence.
+//
 void D_StartTitle (void)
 {
-    // STRIFE-FIXME: some poorly understood changes are pending here
+    gamestate = GS_DEMOSCREEN;
     gameaction = ga_nothing;
-    demosequence = -1;
+    demosequence = -2;
     D_AdvanceDemo ();
 }

+//
+// D_QuitGame
+//
+// [STRIFE] New function
+// haleyjd 09/11/10: Sets up the quit game snippet powered by the
+// demo sequence.
+//
+void D_QuitGame(void)
+{
+    gameaction = ga_nothing;
+    demosequence = -4;
+    D_AdvanceDemo();
+}
+
 // Strings for dehacked replacements of the startup banner
 //
 // These are from the original source: some of them are perhaps
diff --git a/src/strife/d_main.h b/src/strife/d_main.h
index 985bb66c..0a39dd7f 100644
--- a/src/strife/d_main.h
+++ b/src/strife/d_main.h
@@ -46,6 +46,7 @@ void D_PageDrawer (void);
 void D_AdvanceDemo (void);
 void D_DoAdvanceDemo (void);
 void D_StartTitle (void);
+void D_QuitGame (void); // [STRIFE]

 //
 // GLOBAL VARIABLES
diff --git a/src/strife/m_menu.c b/src/strife/m_menu.c
index ef868236..d03f73be 100644
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -66,7 +66,7 @@
 #include "m_menu.h"


-extern void M_QuitDOOM(int);
+extern void M_QuitStrife(int);

 extern patch_t*		hu_font[HU_FONTSIZE];
 extern boolean		message_dontfuckwithme;
@@ -167,7 +167,7 @@ void M_EndGame(int choice);
 void M_ReadThis(int choice);
 void M_ReadThis2(int choice);
 void M_ReadThis3(int choice); // [STRIFE]
-void M_QuitDOOM(int choice);
+void M_QuitStrife(int choice);

 void M_ChangeMessages(int choice);
 void M_ChangeSensitivity(int choice);
@@ -233,7 +233,7 @@ menuitem_t MainMenu[]=
     {1,"M_SAVEG",M_SaveGame,'s'},
     // Another hickup with Special edition.
     {1,"M_RDTHIS",M_ReadThis,'h'}, // haleyjd 08/28/10: 'r' -> 'h'
-    {1,"M_QUITG",M_QuitDOOM,'q'}
+    {1,"M_QUITG",M_QuitStrife,'q'}
 };

 menu_t  MainDef =
@@ -1093,81 +1093,49 @@ void M_FinishReadThis(int choice)
 */


-
 //
-// M_QuitDOOM
+// M_QuitResponse
+//
+// haleyjd 09/11/10: [STRIFE] Modifications to start up endgame
+// demosequence.
 //
-// villsa [STRIFE] TODO - fix sounds
-int     quitsounds[8] =
-{
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish
-};
-
-int     quitsounds2[8] =
-{
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish,
-    sfx_swish
-};
-
-
-
 void M_QuitResponse(int key)
 {
+    char buffer[20];
+
     if (key != key_menu_confirm)
-	return;
-    if (!netgame)
+        return;
+
+    if(netgame)
+        I_Quit();
+    else
     {
-	if (gamemode == commercial)
-	    S_StartSound(NULL,quitsounds2[(gametic>>2)&7]);
-	else
-	    S_StartSound(NULL,quitsounds[(gametic>>2)&7]);
-	I_WaitVBL(105);
+        sprintf(buffer, DEH_String("qfmrm%i"), gametic % 8 + 1);
+        I_StartVoice(buffer);
+        D_QuitGame();
     }
-    I_Quit ();
 }

-
+/*
+// haleyjd 09/11/10: [STRIFE] Unused
 static char *M_SelectEndMessage(void)
 {
-    char **endmsg;
-
-    if (gamemission == doom)
-    {
-        // Doom 1
-
-        endmsg = doom1_endmsg;
-    }
-    else
-    {
-        // Doom 2
-
-        endmsg = doom2_endmsg;
-    }
-
-    return endmsg[gametic % NUM_QUITMESSAGES];
 }
+*/

-
-void M_QuitDOOM(int choice)
+//
+// M_QuitStrife
+//
+// [STRIFE] Renamed from M_QuitDOOM
+// haleyjd 09/11/10: No randomized text message; that's taken care of
+// by the randomized voice message after confirmation.
+//
+void M_QuitStrife(int choice)
 {
     sprintf(endstring,
-            DEH_String("%s\n\n" DOSY),
-            DEH_String(M_SelectEndMessage()));
+            DEH_String("Do you really want to leave?\n\n" DOSY));

-    M_StartMessage(endstring,M_QuitResponse,true);
+    M_StartMessage(endstring, M_QuitResponse, true);
 }


@@ -1533,7 +1501,7 @@ boolean M_Responder (event_t* ev)
     if (ev->type == ev_quit)
     {
         S_StartSound(NULL, sfx_swtchn);
-        M_QuitDOOM(0);
+        M_QuitStrife(0);
         return true;
     }

@@ -1811,7 +1779,7 @@ boolean M_Responder (event_t* ev)
         else if (key == key_menu_quit)     // Quit DOOM
         {
             S_StartSound(NULL,sfx_swtchn);
-            M_QuitDOOM(0);
+            M_QuitStrife(0);
             return true;
         }
         else if (key == key_menu_gamma)    // gamma toggle
diff --git a/src/strife/s_sound.c b/src/strife/s_sound.c
index 6a6ddd15..642586cf 100644
--- a/src/strife/s_sound.c
+++ b/src/strife/s_sound.c
@@ -550,7 +550,7 @@ static voiceinfo_t *voices[NUMVOICECHAINS];
 static voiceinfo_t *S_getVoice(const char *name, int lumpnum)
 {
     voiceinfo_t *voice;
-    int hashkey = S_voiceHash(name) % NUMVOICECHAINS;
+    unsigned int hashkey = S_voiceHash(name) % NUMVOICECHAINS;

     voice = voices[hashkey];

@@ -603,7 +603,7 @@ void I_StartVoice(const char *lumpname)
         return;

     // have a voice playing already? stop it.
-    if (i_voicehandle >= 0)
+    if(i_voicehandle >= 0)
         S_StopChannel(i_voicehandle);

     // Vanilla STRIFE appears to have stopped any current voice without