shithub: choc

Download patch

ref: 22200650762b044b2f55026b91a175716d2a73f2
parent: 6694dd0891e2aae773e5b8709575f92996fa2e08
author: James Haley <haleyjd@hotmail.com>
date: Mon Aug 23 23:40:16 EDT 2010

Removed storedemo and Chex Quest cruft, adjusted screenwipe loop timing,
added DoTimeBomb function for historical interest, removed
GS_INTERMISSION and #if 0'd all of wi_stuff.c/.h. Removed DOOM level
transfer logic from G_DoCompleted - note that you cannot currently go to
the next level at *all*. Removed G_SecretExitLevel and DOOM par times.

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

--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -153,16 +153,16 @@
 
     // haleyjd 08/22/2010: [STRIFE] there is no such thing as a "store demo" 
     // version of Strife
-	
+
     // IF STORE DEMO, DO NOT ACCEPT INPUT
     //if (storedemo)
     //    return;
-	
+
     while ((ev = D_PopEvent()) != NULL)
     {
-	if (M_Responder (ev))
-	    continue;               // menu ate the event
-	G_Responder (ev);
+        if (M_Responder (ev))
+            continue;               // menu ate the event
+        G_Responder (ev);
     }
 }
 
@@ -173,8 +173,11 @@
 // D_Display
 //  draw current display, possibly wiping it from the previous
 //
-
 // wipegamestate can be set to -1 to force a wipe on the next draw
+//
+// haleyjd 08/23/10: [STRIFE]:
+// * Changes to eliminate intermission and change timing of screenwipe
+//
 gamestate_t     wipegamestate = GS_DEMOSCREEN;
 extern  boolean setsizeneeded;
 extern  int             showMessages;
@@ -182,105 +185,111 @@
 
 void D_Display (void)
 {
-    static  boolean		viewactivestate = false;
-    static  boolean		menuactivestate = false;
-    static  boolean		inhelpscreensstate = false;
-    static  boolean		fullscreen = false;
-    static  gamestate_t		oldgamestate = -1;
-    static  int			borderdrawcount;
-    int				nowtime;
-    int				tics;
-    int				wipestart;
-    int				y;
-    boolean			done;
-    boolean			wipe;
-    boolean			redrawsbar;
+    static  boolean             viewactivestate = false;
+    static  boolean             menuactivestate = false;
+    static  boolean             inhelpscreensstate = false;
+    static  boolean             fullscreen = false;
+    static  gamestate_t         oldgamestate = -1;
+    static  int                 borderdrawcount;
+    int                         nowtime;
+    int                         tics;
+    int                         wipestart;
+    int                         y;
+    boolean                     done;
+    boolean                     wipe;
+    boolean                     redrawsbar;
 
     if (nodrawers)
-	return;                    // for comparative timing / profiling
-		
+        return;                    // for comparative timing / profiling
+
     redrawsbar = false;
     
     // change the view size if needed
     if (setsizeneeded)
     {
-	R_ExecuteSetViewSize ();
-	oldgamestate = -1;                      // force background redraw
-	borderdrawcount = 3;
+        R_ExecuteSetViewSize ();
+        oldgamestate = -1;                      // force background redraw
+        borderdrawcount = 3;
     }
 
     // save the current screen if about to wipe
     if (gamestate != wipegamestate)
     {
-	wipe = true;
-	wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
+        wipe = true;
+        wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
     }
     else
-	wipe = false;
+        wipe = false;
 
     if (gamestate == GS_LEVEL && gametic)
-	HU_Erase();
-    
+        HU_Erase();
+
     // do buffered drawing
     switch (gamestate)
     {
-      case GS_LEVEL:
-	if (!gametic)
-	    break;
-	if (automapactive)
-	    AM_Drawer ();
-	if (wipe || (viewheight != 200 && fullscreen) )
-	    redrawsbar = true;
-	if (inhelpscreensstate && !inhelpscreens)
-	    redrawsbar = true;              // just put away the help screen
-	ST_Drawer (viewheight == 200, redrawsbar );
-	fullscreen = viewheight == 200;
-	break;
+    case GS_LEVEL:
+        if (!gametic)
+            break;
+        if (automapactive)
+            AM_Drawer ();
+        if (wipe || (viewheight != 200 && fullscreen) )
+            redrawsbar = true;
+        if (inhelpscreensstate && !inhelpscreens)
+            redrawsbar = true;              // just put away the help screen
+        ST_Drawer (viewheight == 200, redrawsbar );
+        fullscreen = viewheight == 200;
+        break;
+      
+     // haleyjd 08/23/2010: [STRIFE] No intermission
+     /*
+     case GS_INTERMISSION:
+         WI_Drawer ();
+         break;
+     */
+    case GS_FINALE:
+        F_Drawer ();
+        break;
 
-      case GS_INTERMISSION:
-	WI_Drawer ();
-	break;
-
-      case GS_FINALE:
-	F_Drawer ();
-	break;
-
-      case GS_DEMOSCREEN:
-	D_PageDrawer ();
-	break;
+    case GS_DEMOSCREEN:
+        D_PageDrawer ();
+        break;
     }
     
     // draw buffered stuff to screen
     I_UpdateNoBlit ();
-    
+
     // draw the view directly
     if (gamestate == GS_LEVEL && !automapactive && gametic)
-	R_RenderPlayerView (&players[displayplayer]);
+        R_RenderPlayerView (&players[displayplayer]);
 
     if (gamestate == GS_LEVEL && gametic)
-	HU_Drawer ();
-    
+        HU_Drawer ();
+
     // clean up border stuff
     if (gamestate != oldgamestate && gamestate != GS_LEVEL)
-	I_SetPalette (W_CacheLumpName (DEH_String("PLAYPAL"),PU_CACHE));
+        I_SetPalette (W_CacheLumpName (DEH_String("PLAYPAL"),PU_CACHE));
 
     // see if the border needs to be initially drawn
     if (gamestate == GS_LEVEL && oldgamestate != GS_LEVEL)
     {
-	viewactivestate = false;        // view was not active
-	R_FillBackScreen ();    // draw the pattern into the back screen
+        viewactivestate = false;        // view was not active
+        R_FillBackScreen ();    // draw the pattern into the back screen
     }
 
     // see if the border needs to be updated to the screen
     if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320)
     {
-	if (menuactive || menuactivestate || !viewactivestate)
-	    borderdrawcount = 3;
-	if (borderdrawcount)
-	{
-	    R_DrawViewBorder ();    // erase old menu stuff
-	    borderdrawcount--;
-	}
+        if (menuactive || menuactivestate || !viewactivestate)
+        {
+            borderdrawcount = 3;
+            // STRIFE-FIXME / TODO: Unknown variable
+            // dword_861C8 = 0; 
+        }
+        if (borderdrawcount)
+        {
+            R_DrawViewBorder ();    // erase old menu stuff
+            borderdrawcount--;
+        }
 
     }
 
@@ -295,15 +304,15 @@
     viewactivestate = viewactive;
     inhelpscreensstate = inhelpscreens;
     oldgamestate = wipegamestate = gamestate;
-    
+
     // draw pause pic
     if (paused)
     {
-	if (automapactive)
-	    y = 4;
-	else
-	    y = viewwindowy+4;
-	V_DrawPatchDirect(viewwindowx + (scaledviewwidth - 68) / 2, y,
+        if (automapactive)
+            y = 4;
+        else
+            y = viewwindowy+4;
+        V_DrawPatchDirect(viewwindowx + (scaledviewwidth - 68) / 2, y,
                           W_CacheLumpName (DEH_String("M_PAUSE"), PU_CACHE));
     }
 
@@ -316,8 +325,8 @@
     // normal update
     if (!wipe)
     {
-	I_FinishUpdate ();              // page flip or blit buffer
-	return;
+        I_FinishUpdate ();              // page flip or blit buffer
+        return;
     }
     
     // wipe update
@@ -327,19 +336,19 @@
 
     do
     {
-	do
-	{
-	    nowtime = I_GetTime ();
-	    tics = nowtime - wipestart;
+        do
+        {
+            nowtime = I_GetTime ();
+            tics = nowtime - wipestart;
             I_Sleep(1);
-	} while (tics <= 0);
-        
-	wipestart = nowtime;
-	done = wipe_ScreenWipe(wipe_Melt
-			       , 0, 0, SCREENWIDTH, SCREENHEIGHT, tics);
-	I_UpdateNoBlit ();
-	M_Drawer ();                            // menu is drawn even on top of wipes
-	I_FinishUpdate ();                      // page flip or blit buffer
+        } while (tics < 3); // haleyjd 08/23/2010: [STRIFE] Changed from == 0 to < 3
+
+        wipestart = nowtime;
+        done = wipe_ScreenWipe(wipe_Melt
+                               , 0, 0, SCREENWIDTH, SCREENHEIGHT, tics);
+        I_UpdateNoBlit ();
+        M_Drawer ();                            // menu is drawn even on top of wipes
+        I_FinishUpdate ();                      // page flip or blit buffer
     } while (!done);
 }
 
@@ -414,6 +423,8 @@
 //
 //  D_DoomLoop
 //
+//  haleyjd 08/23/10: [STRIFE] Verified unmodified.
+//
 extern  boolean         demorecording;
 
 void D_DoomLoop (void)
@@ -504,6 +515,8 @@
 //
 // D_PageDrawer
 //
+// haleyjd 08/22/2010: [STRIFE] verified unmodified
+//
 void D_PageDrawer (void)
 {
     V_DrawPatch (0, 0, W_CacheLumpName(pagename, PU_CACHE));
@@ -599,6 +612,7 @@
 //
 void D_StartTitle (void)
 {
+    // STRIFE-FIXME: some poorly understood changes are pending here
     gameaction = ga_nothing;
     demosequence = -1;
     D_AdvanceDemo ();
@@ -747,6 +761,39 @@
     }
 }
 
+#if 0
+//
+// DoTimeBomb
+//
+// haleyjd 08/23/2010: [STRIFE] New function
+// Code with no xrefs; probably left over from a private alpha or beta.
+// Translated here because it explains what the SERIAL lump was meant to do.
+//
+void DoTimeBomb(void)
+{
+    dosdate_t date;
+    char *serial;
+    int serialnum;
+    int serial_year;
+    int serial_month;
+
+    serial = W_CacheLumpName("serial", PU_CACHE);
+    serialnum = atoi(serial);
+
+    // Rogue, much like Governor Mourel, were lousy liars. These deceptive
+    // error messages are pretty low :P
+    dos_getdate(&date);
+    if(date.year > 1996 || date.day > 15 && date.month > 4)
+        I_Error("Data error! Corrupted WAD File!");
+    serial_year = serialnum / 10000;
+    serial_month = serialnum / 100 - 100 * serial_year;
+    if(date.year < serial_year || 
+       date.day < serialnum - 100 * serial_month - 10000 * serial_year &&
+       date.month < serial_month)
+       I_Error("Bad wadfile");
+}
+#endif
+
 // Set the gamedescription string
 
 void D_SetGameDescription(void)
@@ -821,7 +868,9 @@
 
 // Check if the IWAD file is the Chex Quest IWAD.  
 // Returns true if this is chex.wad.
-
+// haleyjd 08/23/10: there is no Chex Quest based on Strife,
+// though I must admit that makes an intriguing idea....
+/*
 static boolean CheckChex(char *iwadname)
 {
     char *chex_iwadname = "chex.wad";
@@ -830,6 +879,7 @@
      && !strcasecmp(iwadname + strlen(iwadname) - strlen(chex_iwadname),
                     chex_iwadname));
 }
+*/
 
 //      print title for every printed line
 char            title[128];
@@ -951,14 +1001,9 @@
     {
         // Determine automatically
 
-        if (CheckChex(iwadfile))
+        // haleyjd 08/23/10: Removed Chex mode, as it is irrelevant to Strife
+        if (gamemode == shareware || gamemode == registered)
         {
-            // chex.exe - identified by iwad filename
-
-            gameversion = exe_chex;
-        }
-        else if (gamemode == shareware || gamemode == registered)
-        {
             // original
 
             gameversion = exe_doom_1_9;
@@ -1013,7 +1058,8 @@
 }
 
 // Load the Chex Quest dehacked file, if we are in Chex mode.
-
+// haleyjd 08/23/2010: Removed, as irrelevant to Strife.
+/*
 static void LoadChexDeh(void)
 {
     char *chex_deh;
@@ -1037,6 +1083,7 @@
         }
     }
 }
+*/
 
 // Function called at exit to display the ENDOOM screen
 
@@ -1052,6 +1099,7 @@
         return;
     }
 
+    // STRIFE-TODO: ENDOOM -> ENDSTRF
     endoom = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC);
 
     I_Endoom(endoom);
@@ -1514,7 +1562,7 @@
     
     D_IdentifyVersion();
     InitGameVersion();
-    LoadChexDeh();
+    //LoadChexDeh(); - haleyjd: removed, as irrelevant to Strife
     D_SetGameDescription();
     SetSaveGameDir(iwadfile);
 
@@ -1521,28 +1569,28 @@
     // Check for -file in shareware
     if (modifiedgame)
     {
-	// These are the lumps that will be checked in IWAD,
-	// if any one is not present, execution will be aborted.
+        // These are the lumps that will be checked in IWAD,
+        // if any one is not present, execution will be aborted.
         // haleyjd 08/22/2010: [STRIFE] Check for Strife lumps.
-	char name[3][8]=
-	{
-           "map23", "map30", "ROB3E1"
-	};
-	int i;
-	
+        char name[3][8]=
+        {
+            "map23", "map30", "ROB3E1"
+        };
+        int i;
+
         // haleyjd 08/22/2010: [STRIFE] Changed string to match binary
         // STRIFE-FIXME: Needs to test isdemoversion variable
-	if ( gamemode == shareware)
-	    I_Error(DEH_String("\nYou cannot -file with the demo "
-			       "version. You must buy the real game!"));
+        if ( gamemode == shareware)
+            I_Error(DEH_String("\nYou cannot -file with the demo "
+                               "version. You must buy the real game!"));
 
-	// Check for fake IWAD with right name,
-	// but w/o all the lumps of the registered version. 
+        // Check for fake IWAD with right name,
+        // but w/o all the lumps of the registered version. 
         // STRIFE-FIXME: Needs to test isregistered variable
-	if (gamemode == registered)
-	    for (i = 0; i < 3; i++)
-		if (W_CheckNumForName(name[i])<0)
-		    I_Error(DEH_String("\nThis is not the registered version."));
+        if (gamemode == registered)
+            for (i = 0; i < 3; i++)
+                if (W_CheckNumForName(name[i])<0)
+                    I_Error(DEH_String("\nThis is not the registered version."));
     }
     
     // get skill / episode / map from parms
@@ -1732,9 +1780,11 @@
     // If Doom II without a MAP01 lump, this is a store demo.  
     // Moved this here so that MAP01 isn't constantly looked up
     // in the main loop.
-
+    // haleyjd 08/23/2010: [STRIFE] There is no storedemo version of Strife
+    /*
     if (gamemode == commercial && W_CheckNumForName("map01") < 0)
         storedemo = true;
+    */
 
     //!
     // @arg <x>
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -921,34 +921,40 @@
 
     // Have we just finished displaying an intermission screen?
 
+    // haleyjd 08/23/10: [STRIFE] No intermission.
+    /*
     if (oldgamestate == GS_INTERMISSION && gamestate != GS_INTERMISSION)
     {
         WI_End();
     }
+    */
 
     oldgamestate = gamestate;
-    
+
     // do main actions
     switch (gamestate) 
     { 
-      case GS_LEVEL: 
-	P_Ticker (); 
-	ST_Ticker (); 
-	AM_Ticker (); 
-	HU_Ticker ();            
-	break; 
-	 
-      case GS_INTERMISSION: 
-	WI_Ticker (); 
-	break; 
-			 
-      case GS_FINALE: 
-	F_Ticker (); 
-	break; 
- 
-      case GS_DEMOSCREEN: 
-	D_PageTicker (); 
-	break;
+    case GS_LEVEL: 
+        P_Ticker (); 
+        ST_Ticker (); 
+        AM_Ticker (); 
+        HU_Ticker ();            
+        break; 
+
+        // haleyjd 08/23/10: [STRIFE] No intermission.
+        /*
+    case GS_INTERMISSION: 
+        WI_Ticker (); 
+        break; 
+        */
+
+    case GS_FINALE: 
+        F_Ticker (); 
+        break; 
+
+    case GS_DEMOSCREEN: 
+        D_PageTicker (); 
+        break;
     }        
 } 
  
@@ -1176,28 +1182,9 @@
 { 
     gameaction = ga_screenshot; 
 } 
- 
 
+// haleyjd 08/23/2010: [STRIFE] Removed par times.
 
-// DOOM Par Times
-int pars[4][10] = 
-{ 
-    {0}, 
-    {0,30,75,120,90,165,180,180,30,165}, 
-    {0,90,90,90,120,90,360,240,30,170}, 
-    {0,90,45,90,150,90,90,165,30,135} 
-}; 
-
-// DOOM II Par Times
-int cpars[32] =
-{
-    30,90,120,120,90,150,120,120,270,90,	//  1-10
-    210,150,150,150,210,150,420,150,210,150,	// 11-20
-    240,150,180,150,150,300,330,420,300,180,	// 21-30
-    120,30					// 31-32
-};
- 
-
 //
 // G_DoCompleted 
 //
@@ -1210,151 +1197,42 @@
     gameaction = ga_completed; 
 } 
 
+/*
+// haleyjd 08/23/2010: [STRIFE] No secret exits in Strife.
 // Here's for the german edition.
 void G_SecretExitLevel (void) 
-{ 
+{
     // IF NO WOLF3D LEVELS, NO SECRET EXIT!
     if ( (gamemode == commercial)
-      && (W_CheckNumForName("map31")<0))
-	secretexit = false;
+        && (W_CheckNumForName("map31")<0))
+        secretexit = false;
     else
-	secretexit = true; 
+        secretexit = true; 
     gameaction = ga_completed; 
-} 
- 
+}
+*/
+
+//
+// G_DoCompleted
+//
+// haleyjd 08/23/10: [STRIFE]:
+// * Removed G_PlayerFinishLevel call for now... STRIFE-TODO
+// * Removed Chex, as not relevant to Strife.
+// * Removed DOOM level transfer logic 
+// * Removed intermission code.
+// * Added setting gameaction to ga_worlddone.
+//
 void G_DoCompleted (void) 
-{ 
-    int             i; 
-	 
-    gameaction = ga_nothing; 
- 
-    for (i=0 ; i<MAXPLAYERS ; i++) 
-	if (playeringame[i]) 
-	    G_PlayerFinishLevel (i);        // take away cards and stuff 
-	 
+{
+    // STRIFE-TODO: save automap powerup state (possibly inlined from G_PlayerFinishLevel)
+    // set destmap, stonecold
+
     if (automapactive) 
-	AM_Stop (); 
-	
-    if (gamemode != commercial)
-    {
-        // Chex Quest ends after 5 levels, rather than 8.
+        AM_Stop (); 
 
-        if (gameversion == exe_chex)
-        {
-            if (gamemap == 5)
-            {
-                gameaction = ga_victory;
-                return;
-            }
-        }
-        else
-        {
-            switch(gamemap)
-            {
-              case 8:
-                gameaction = ga_victory;
-                return;
-              case 9: 
-                for (i=0 ; i<MAXPLAYERS ; i++) 
-                    players[i].didsecret = true; 
-                break;
-            }
-        }
-    }
-
-//#if 0  Hmmm - why?
-    if ( (gamemap == 8)
-	 && (gamemode != commercial) ) 
-    {
-	// victory 
-	gameaction = ga_victory; 
-	return; 
-    } 
-	 
-    if ( (gamemap == 9)
-	 && (gamemode != commercial) ) 
-    {
-	// exit secret level 
-	for (i=0 ; i<MAXPLAYERS ; i++) 
-	    players[i].didsecret = true; 
-    } 
-//#endif
+    // STRIFE-TODO: needs call to G_DoSaveGame for hubs
     
-	 
-    wminfo.didsecret = players[consoleplayer].didsecret; 
-    wminfo.epsd = gameepisode -1; 
-    wminfo.last = gamemap -1;
-    
-    // wminfo.next is 0 biased, unlike gamemap
-    if ( gamemode == commercial)
-    {
-	if (secretexit)
-	    switch(gamemap)
-	    {
-	      case 15: wminfo.next = 30; break;
-	      case 31: wminfo.next = 31; break;
-	    }
-	else
-	    switch(gamemap)
-	    {
-	      case 31:
-	      case 32: wminfo.next = 15; break;
-	      default: wminfo.next = gamemap;
-	    }
-    }
-    else
-    {
-	if (secretexit) 
-	    wminfo.next = 8; 	// go to secret level 
-	else if (gamemap == 9) 
-	{
-	    // returning from secret level 
-	    switch (gameepisode) 
-	    { 
-	      case 1: 
-		wminfo.next = 3; 
-		break; 
-	      case 2: 
-		wminfo.next = 5; 
-		break; 
-	      case 3: 
-		wminfo.next = 6; 
-		break; 
-	      case 4:
-		wminfo.next = 2;
-		break;
-	    }                
-	} 
-	else 
-	    wminfo.next = gamemap;          // go to next level 
-    }
-		 
-    wminfo.maxkills = totalkills; 
-    wminfo.maxitems = totalitems; 
-    wminfo.maxsecret = totalsecret; 
-    wminfo.maxfrags = 0; 
-    if ( gamemode == commercial )
-	wminfo.partime = TICRATE*cpars[gamemap-1]; 
-    else
-	wminfo.partime = TICRATE*pars[gameepisode][gamemap]; 
-    wminfo.pnum = consoleplayer; 
- 
-    for (i=0 ; i<MAXPLAYERS ; i++) 
-    { 
-	wminfo.plyr[i].in = playeringame[i]; 
-	wminfo.plyr[i].skills = players[i].killcount; 
-	wminfo.plyr[i].sitems = players[i].itemcount; 
-	wminfo.plyr[i].ssecret = players[i].secretcount; 
-	wminfo.plyr[i].stime = leveltime; 
-	memcpy (wminfo.plyr[i].frags, players[i].frags 
-		, sizeof(wminfo.plyr[i].frags)); 
-    } 
- 
-    gamestate = GS_INTERMISSION; 
-    viewactive = false; 
-    automapactive = false; 
- 
-    WI_Start (&wminfo); 
+    gameaction = ga_worlddone;
 } 
 
 
--- a/src/strife/g_game.h
+++ b/src/strife/g_game.h
@@ -66,7 +66,7 @@
 boolean G_CheckDemoStatus (void);
 
 void G_ExitLevel (void);
-void G_SecretExitLevel (void);
+//void G_SecretExitLevel (void);
 
 void G_WorldDone (void);
 
--- a/src/strife/p_spec.c
+++ b/src/strife/p_spec.c
@@ -777,7 +777,7 @@
 	
       case 124:
 	// Secret EXIT
-	G_SecretExitLevel ();
+	//G_SecretExitLevel ();
 	break;
 		
       case 125:
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -433,7 +433,7 @@
       case 51:
 	// Secret EXIT
 	P_ChangeSwitchTexture(line,0);
-	G_SecretExitLevel ();
+	//G_SecretExitLevel ();
 	break;
 	
       case 55:
--- a/src/strife/wi_stuff.c
+++ b/src/strife/wi_stuff.c
@@ -24,7 +24,8 @@
 //
 //-----------------------------------------------------------------------------
 
-
+// haleyjd 08/23/2010: There is no intermission in Strife
+#if 0
 #include <stdio.h>
 
 #include "z_zone.h"
@@ -1839,3 +1840,4 @@
     else
 	WI_initStats();
 }
+#endif
--- a/src/strife/wi_stuff.h
+++ b/src/strife/wi_stuff.h
@@ -27,6 +27,8 @@
 #ifndef __WI_STUFF__
 #define __WI_STUFF__
 
+// haleyjd 08/23/2010: Strife does not have an intermission
+#if 0
 //#include "v_video.h"
 
 #include "doomdef.h"
@@ -53,4 +55,5 @@
 // Shut down the intermission screen
 void WI_End(void);
 
+#endif
 #endif