shithub: choc

Download patch

ref: 57dee80794dd9343f7038991ead3d92a2c34241a
parent: 691f1b3acbe3e9f847b7ded5aac98425fea054f0
author: James Haley <haleyjd@hotmail.com>
date: Wed Sep 8 01:27:33 EDT 2010

Functional menupause/menupausetime, fix to wait when there's not a
background pic, and elimination of more dead code in the menu system

Subversion-branch: /branches/strife-branch
Subversion-revision: 2042

--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -174,7 +174,6 @@
 void M_SfxVol(int choice);
 void M_VoiceVol(int choice); // [STRIFE]
 void M_MusicVol(int choice);
-void M_ChangeDetail(int choice);
 void M_SizeDisplay(int choice);
 void M_StartGame(int choice);
 void M_Sound(int choice);
@@ -251,6 +250,7 @@
 //
 // EPISODE SELECT
 //
+/*
 enum
 {
     ep1,
@@ -277,6 +277,7 @@
     48,63,              // x,y
     ep1			// lastOn
 };
+*/
 
 //
 // NEW GAME
@@ -304,7 +305,7 @@
 menu_t  NewDef =
 {
     newg_end,           // # of menu items
-    &EpiDef,            // previous menu - STRIFE-FIXME: should be MainDef
+    &MainDef,           // previous menu - haleyjd [STRIFE] changed to MainDef
     NewGameMenu,        // menuitem_t ->
     M_DrawNewGame,      // drawing routine ->
     48,63,              // x,y
@@ -909,16 +910,11 @@
 {
     if (netgame && !demoplayback)
     {
-	M_StartMessage(DEH_String(NEWGAME),NULL,false);
-	return;
+        M_StartMessage(DEH_String(NEWGAME),NULL,false);
+        return;
     }
-	
-    // Chex Quest disabled the episode select screen, as did Doom II.
-
-    if (gamemode == commercial || gameversion == exe_chex)
-	M_SetupNextMenu(&NewDef);
-    else
-	M_SetupNextMenu(&EpiDef);
+    // haleyjd 09/07/10: [STRIFE] Removed Chex Quest and DOOM gamemodes
+    M_SetupNextMenu(&NewDef);
 }
 
 
@@ -932,27 +928,27 @@
     V_DrawPatchDirect(54, 38, W_CacheLumpName(DEH_String("M_EPISOD"), PU_CACHE));
 }
 
+/*
+// haleyjd: [STRIFE] Unused
 void M_VerifyNightmare(int key)
 {
     if (key != key_menu_confirm)
-	return;
-		
+        return;
+
     G_DeferedInitNew(nightmare,epi+1,1);
     M_ClearMenus (0);
 }
+*/
 
 void M_ChooseSkill(int choice)
 {
-    if (choice == nightmare)
-    {
-	M_StartMessage(DEH_String(NIGHTMARE),M_VerifyNightmare,true);
-	return;
-    }
-	
+    // haleyjd 09/07/10: Removed nightmare confirmation
     G_DeferedInitNew(choice,epi+1,1);
     M_ClearMenus (0);
 }
 
+/*
+// haleyjd [STRIFE] Unused
 void M_Episode(int choice)
 {
     if ( (gamemode == shareware)
@@ -975,9 +971,9 @@
     epi = choice;
     M_SetupNextMenu(&NewDef);
 }
+*/
 
 
-
 //
 // M_Options
 //
@@ -988,13 +984,13 @@
 void M_DrawOptions(void)
 {
     // haleyjd 08/27/10: [STRIFE] M_OPTTTL -> M_OPTION
-    V_DrawPatchDirect(108, 15, W_CacheLumpName(DEH_String("M_OPTION"),
-                                               PU_CACHE));
+    V_DrawPatchDirect(108, 15, 
+                      W_CacheLumpName(DEH_String("M_OPTION"), PU_CACHE));
 
     // haleyjd 08/26/10: [STRIFE] Removed messages, sensitivity, detail.
 
     M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1),
-		 9,screenSize);
+                 9,screenSize);
 }
 
 void M_Options(int choice)
@@ -1192,9 +1188,8 @@
     }
 }
 
-
-
-
+/*
+// haleyjd [STRIFE] Unused
 void M_ChangeDetail(int choice)
 {
     choice = 0;
@@ -1207,10 +1202,8 @@
     else
 	players[consoleplayer].message = DEH_String(DETAILLO);
 }
+*/
 
-
-
-
 void M_SizeDisplay(int choice)
 {
     switch(choice)
@@ -1783,12 +1776,14 @@
 	    S_StartSound(NULL,sfx_swtchn);
 	    return true;
 	}
+        /*
         else if (key == key_menu_detail)   // Detail toggle
         {
-	    M_ChangeDetail(0);
-	    S_StartSound(NULL,sfx_swtchn);
-	    return true;
+            M_ChangeDetail(0);
+            S_StartSound(NULL,sfx_swtchn);
+            return true;
         }
+        */
         else if (key == key_menu_qsave)    // Quicksave
         {
 	    S_StartSound(NULL,sfx_swtchn);
@@ -1833,13 +1828,13 @@
     // Pop-up menu?
     if (!menuactive)
     {
-	if (key == key_menu_activate)
-	{
-	    M_StartControlPanel ();
-	    S_StartSound(NULL,sfx_swtchn);
-	    return true;
-	}
-	return false;
+        if (key == key_menu_activate)
+        {
+            M_StartControlPanel ();
+            S_StartSound(NULL,sfx_swtchn);
+            return true;
+        }
+        return false;
     }
 
     
@@ -1980,6 +1975,7 @@
         return;
     
     menuactive = 1;
+    menupause = true;
     currentMenu = &MainDef;         // JDC
     itemOn = currentMenu->lastOn;   // JDC
 }
@@ -2005,41 +2001,41 @@
     // Horiz. & Vertically center string and print it.
     if (messageToPrint)
     {
-	start = 0;
-	y = 100 - M_StringHeight(messageString) / 2;
-	while (messageString[start] != '\0')
-	{
-	    int foundnewline = 0;
+        start = 0;
+        y = 100 - M_StringHeight(messageString) / 2;
+        while (messageString[start] != '\0')
+        {
+            int foundnewline = 0;
 
-	    for (i = 0; i < strlen(messageString + start); i++)
-		if (messageString[start + i] == '\n')
-		{
-		    memset(string, 0, sizeof(string));
-		    strncpy(string, messageString + start, i);
-		    foundnewline = 1;
-		    start += i + 1;
-		    break;
-		}
-				
-	    if (!foundnewline)
-	    {
-		strcpy(string, messageString + start);
-		start += strlen(string);
-	    }
+            for (i = 0; i < strlen(messageString + start); i++)
+                if (messageString[start + i] == '\n')
+                {
+                    memset(string, 0, sizeof(string));
+                    strncpy(string, messageString + start, i);
+                    foundnewline = 1;
+                    start += i + 1;
+                    break;
+                }
 
-	    x = 160 - M_StringWidth(string) / 2;
-	    M_WriteText(x, y, string);
-	    y += SHORT(hu_font[0]->height);
-	}
+                if (!foundnewline)
+                {
+                    strcpy(string, messageString + start);
+                    start += strlen(string);
+                }
 
-	return;
+                x = 160 - M_StringWidth(string) / 2;
+                M_WriteText(x, y, string);
+                y += SHORT(hu_font[0]->height);
+        }
+
+        return;
     }
 
     if (!menuactive)
-	return;
+        return;
 
     if (currentMenu->routine)
-	currentMenu->routine();         // call Draw routine
+        currentMenu->routine();         // call Draw routine
     
     // DRAW MENU
     x = currentMenu->x;
@@ -2050,11 +2046,11 @@
     {
         name = DEH_String(currentMenu->menuitems[i].name);
 
-	if (name[0])
-	{
-	    V_DrawPatchDirect (x, y, W_CacheLumpName(name, PU_CACHE));
-	}
-	y += LINEHEIGHT;
+        if (name[0])
+        {
+            V_DrawPatchDirect (x, y, W_CacheLumpName(name, PU_CACHE));
+        }
+        y += LINEHEIGHT;
     }
 
     
@@ -2071,13 +2067,13 @@
 // M_ClearMenus
 //
 // haleyjd 08/28/10: [STRIFE] Added an int param so this can be called by menus.
+//         09/08/10: Added menupause.
 //
 void M_ClearMenus (int choice)
 {
     choice = 0;     // haleyjd: for no warning; not from decompilation.
     menuactive = 0;
-    // STRIFE-TODO:
-    // menupause = 0;
+    menupause = 0;
 }
 
 
--- a/src/strife/p_dialog.c
+++ b/src/strife/p_dialog.c
@@ -728,7 +728,7 @@
         V_DrawPatchDirect(0, 0, patch);
     }
 
-    if(menupausetime <= gametic)
+    if(dialogbgpiclumpnum == -1 || menupausetime <= gametic)
     {
         if(menuindialog)
         {
@@ -778,7 +778,7 @@
 // haleyjd 09/05/10: Handles making a choice in a dialog. Installed as the
 // callback for all items in the dialogmenu structure.
 //
-static void P_DialogDoChoice(int choice)
+void P_DialogDoChoice(int choice)
 {
     // STRIFE-TODO
 }
@@ -941,4 +941,5 @@
     }
 
     sprintf(dialoglastmsgbuffer, "%d) %s", i + 1, byetext);
-}
\ No newline at end of file
+}
+
--- a/src/strife/p_dialog.h
+++ b/src/strife/p_dialog.h
@@ -68,7 +68,7 @@
 
 void P_DialogLoad(void);
 void P_DialogStart(player_t *player);
-
+void P_DialogDoChoice(int choice);
 
 #endif
 
--- a/src/strife/p_tick.c
+++ b/src/strife/p_tick.c
@@ -130,22 +130,23 @@
     
     // run the tic
     if (paused)
-	return;
+        return;
 		
     // pause if in menu and at least one tic has been run
-    if ( !netgame
-	 && menuactive
-	 && !demoplayback
-	 && players[consoleplayer].viewz != 1)
+    // haleyjd 09/08/10: menuactive -> menupause
+    if (!netgame 
+        && menupause 
+        && !demoplayback 
+        && players[consoleplayer].viewz != 1)
     {
-	return;
+        return;
     }
     
-		
+
     for (i=0 ; i<MAXPLAYERS ; i++)
-	if (playeringame[i])
-	    P_PlayerThink (&players[i]);
-			
+        if (playeringame[i])
+            P_PlayerThink (&players[i]);
+
     P_RunThinkers ();
     P_UpdateSpecials ();
     P_RespawnSpecials ();