shithub: choc

Download patch

ref: cbfc9c134032630b71ec2acf4abe552a7569640f
parent: 8f24f63be140a34c9ac19463832bed0e7fabba67
author: James Haley <haleyjd@hotmail.com>
date: Sat Aug 28 01:35:52 EDT 2010

Added crossfade wipe and code to load XLATAB lump. Changes to the menu
system including working Sigil cursor, alignment changes, shortcut
character changes, and removal of items from the options menu that
Strife put elsewhere. Initial sweep for global lump name changes
completed: AMMNUM%d -> PLMNUM%d, M_DOOM -> M_STRIFE, M_OPTTTL ->
M_OPTION, STTMINUS -> STCFN045, et al. A dummy modified Strife IWAD must
be loaded over DOOM.WAD at this point in order to run.

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

--- a/src/strife/am_map.c
+++ b/src/strife/am_map.c
@@ -491,8 +491,10 @@
 }
 
 //
-// 
+// AM_loadPics
 //
+// haleyjd 08/27/10: [STRIFE] Changed marknums to PLMNUM%d
+//
 void AM_loadPics(void)
 {
     int i;
@@ -500,8 +502,8 @@
   
     for (i=0;i<10;i++)
     {
-	sprintf(namebuf, DEH_String("AMMNUM%d"), i);
-	marknums[i] = W_CacheLumpName(namebuf, PU_STATIC);
+        sprintf(namebuf, DEH_String("PLMNUM%d"), i); 
+        marknums[i] = W_CacheLumpName(namebuf, PU_STATIC);
     }
 
 }
@@ -513,8 +515,8 @@
   
     for (i=0;i<10;i++)
     {
-	sprintf(namebuf, DEH_String("AMMNUM%d"), i);
-	W_ReleaseLumpName(namebuf);
+        sprintf(namebuf, DEH_String("PLMNUM%d"), i); // haleyjd: Choco change.
+        W_ReleaseLumpName(namebuf);
     }
 }
 
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -343,8 +343,9 @@
             I_Sleep(1);
         } while (tics < 3); // haleyjd 08/23/2010: [STRIFE] Changed from == 0 to < 3
 
+        // haleyjd 08/26/10: [STRIFE] Changed to use ColorXForm wipe.
         wipestart = nowtime;
-        done = wipe_ScreenWipe(wipe_Melt
+        done = wipe_ScreenWipe(wipe_ColorXForm
                                , 0, 0, SCREENWIDTH, SCREENHEIGHT, tics);
         I_UpdateNoBlit ();
         M_Drawer ();                            // menu is drawn even on top of wipes
@@ -1099,8 +1100,8 @@
         return;
     }
 
-    // STRIFE-TODO: ENDOOM -> ENDSTRF
-    endoom = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC);
+    // haleyjd 08/27/10: [STRIFE] ENDOOM -> ENDSTRF
+    endoom = W_CacheLumpName(DEH_String("ENDSTRF"), PU_STATIC);
 
     I_Endoom(endoom);
 }
@@ -1567,7 +1568,7 @@
     SetSaveGameDir(iwadfile);
 
     // Check for -file in shareware
-    if (modifiedgame)
+    if (0 /*modifiedgame*/) // TEST
     {
         // These are the lumps that will be checked in IWAD,
         // if any one is not present, execution will be aborted.
--- a/src/strife/f_wipe.c
+++ b/src/strife/f_wipe.c
@@ -33,6 +33,9 @@
 
 #include "doomtype.h"
 
+#include "r_defs.h"   // haleyjd [STRIFE]
+#include "r_draw.h"
+
 #include "f_wipe.h"
 
 //
@@ -69,6 +72,7 @@
 
 }
 
+// haleyjd 08/26/10: [STRIFE] Verified unmodified.
 int
 wipe_initColorXForm
 ( int	width,
@@ -79,6 +83,13 @@
     return 0;
 }
 
+//
+// wipe_doColorXForm
+//
+// haleyjd 08/26/10: [STRIFE]
+// * Rogue modified the unused ColorXForm wipe in-place in order to implement 
+//   their distinctive crossfade wipe.
+//
 int
 wipe_doColorXForm
 ( int	width,
@@ -85,46 +96,27 @@
   int	height,
   int	ticks )
 {
-    boolean	changed;
-    byte*	w;
-    byte*	e;
-    int		newval;
+    byte *cur_screen = wipe_scr;
+    byte *end_screen = wipe_scr_end;
+    int   pix = width*height;
+    int   i;
+    boolean changed = false;
 
-    changed = false;
-    w = wipe_scr;
-    e = wipe_scr_end;
-    
-    while (w!=wipe_scr+width*height)
+    for(i = pix; i > 0; i--)
     {
-	if (*w != *e)
-	{
-	    if (*w > *e)
-	    {
-		newval = *w - ticks;
-		if (newval < *e)
-		    *w = *e;
-		else
-		    *w = newval;
-		changed = true;
-	    }
-	    else if (*w < *e)
-	    {
-		newval = *w + ticks;
-		if (newval > *e)
-		    *w = *e;
-		else
-		    *w = newval;
-		changed = true;
-	    }
-	}
-	w++;
-	e++;
+        if(*cur_screen != *end_screen)
+        {
+            changed = true;
+            *cur_screen = xlatab[(*cur_screen << 8) + *end_screen];
+        }
+        ++cur_screen;
+        ++end_screen;
     }
 
     return !changed;
-
 }
 
+// haleyjd 08/26/10: [STRIFE] Verified unmodified.
 int
 wipe_exitColorXForm
 ( int	width,
@@ -235,6 +227,7 @@
     return 0;
 }
 
+// haleyjd 08/26/10: [STRIFE] Verified unmodified.
 int
 wipe_StartScreen
 ( int	x,
@@ -247,6 +240,7 @@
     return 0;
 }
 
+// haleyjd 08/26/10: [STRIFE] Verified unmodified.
 int
 wipe_EndScreen
 ( int	x,
@@ -260,6 +254,7 @@
     return 0;
 }
 
+// haleyjd 08/26/10: [STRIFE] Verified unmodified.
 int
 wipe_ScreenWipe
 ( int	wipeno,
--- a/src/strife/f_wipe.h
+++ b/src/strife/f_wipe.h
@@ -34,7 +34,7 @@
 
 enum
 {
-    // simple gradual pixel change for 8-bit only
+    // [STRIFE]: ColorXForm reimplemented as a proper crossfade
     wipe_ColorXForm,
     
     // weird screen melt
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -126,8 +126,9 @@
 boolean			inhelpscreens;
 boolean			menuactive;
 
-#define SKULLXOFF		-32
-#define LINEHEIGHT		16
+// haleyjd 08/27/10: [STRIFE] SKULLXOFF == -28, LINEHEIGHT == 19
+#define CURSORXOFF		-28
+#define LINEHEIGHT		19
 
 extern boolean		sendpause;
 char			savegamestrings[10][SAVESTRINGSIZE];
@@ -167,13 +168,15 @@
     short		lastOn;		// last item user was on in menu
 } menu_t;
 
+// haleyjd 08/27/10: [STRIFE] skull* stuff changed to cursor* stuff
 short		itemOn;			// menu item skull is on
-short		skullAnimCounter;	// skull animation counter
-short		whichSkull;		// which skull to draw
+short		cursorAnimCounter;	// skull animation counter
+short		whichCursor;		// which skull to draw
 
-// graphic name of skulls
-// warning: initializer-string for array of chars is too long
-char    *skullName[2] = {"M_SKULL1","M_SKULL2"};
+// graphic name of cursors
+// haleyjd 08/27/10: [STRIFE] M_SKULL* -> M_CURS*
+char    *cursorName[8] = {"M_CURS1", "M_CURS2", "M_CURS3", "M_CURS4", 
+                          "M_CURS5", "M_CURS6", "M_CURS7", "M_CURS8" };
 
 // current menudef
 menu_t*	currentMenu;                          
@@ -255,7 +258,7 @@
     {1,"M_LOADG",M_LoadGame,'l'},
     {1,"M_SAVEG",M_SaveGame,'s'},
     // Another hickup with Special edition.
-    {1,"M_RDTHIS",M_ReadThis,'r'},
+    {1,"M_RDTHIS",M_ReadThis,'h'}, // haleyjd 08/28/10: 'r' -> 'h'
     {1,"M_QUITG",M_QuitDOOM,'q'}
 };
 
@@ -265,7 +268,7 @@
     NULL,
     MainMenu,
     M_DrawMainMenu,
-    97,64,
+    97,45, // haleyjd 08/28/10: [STRIFE] changed y coord
     0
 };
 
@@ -315,21 +318,22 @@
 
 menuitem_t NewGameMenu[]=
 {
-    {1,"M_JKILL",	M_ChooseSkill, 'i'},
-    {1,"M_ROUGH",	M_ChooseSkill, 'h'},
-    {1,"M_HURT",	M_ChooseSkill, 'h'},
-    {1,"M_ULTRA",	M_ChooseSkill, 'u'},
-    {1,"M_NMARE",	M_ChooseSkill, 'n'}
+    // haleyjd 08/28/10: [STRIFE] changed all shortcut letters
+    {1,"M_JKILL",	M_ChooseSkill, 't'},
+    {1,"M_ROUGH",	M_ChooseSkill, 'r'},
+    {1,"M_HURT",	M_ChooseSkill, 'v'},
+    {1,"M_ULTRA",	M_ChooseSkill, 'e'},
+    {1,"M_NMARE",	M_ChooseSkill, 'b'}
 };
 
 menu_t  NewDef =
 {
-    newg_end,		// # of menu items
-    &EpiDef,		// previous menu
-    NewGameMenu,	// menuitem_t ->
-    M_DrawNewGame,	// drawing routine ->
+    newg_end,           // # of menu items
+    &EpiDef,            // previous menu - STRIFE-FIXME: should be MainDef
+    NewGameMenu,        // menuitem_t ->
+    M_DrawNewGame,      // drawing routine ->
     48,63,              // x,y
-    hurtme		// lastOn
+    toorough            // lastOn - haleyjd [STRIFE]: default to skill 1
 };
 
 
@@ -339,13 +343,10 @@
 //
 enum
 {
+    // haleyjd 08/28/10: [STRIFE] Removed messages, mouse sens., detail.
     endgame,
-    messages,
-    detail,
     scrnsize,
     option_empty1,
-    mousesens,
-    option_empty2,
     soundvol,
     opt_end
 } options_e;
@@ -352,13 +353,10 @@
 
 menuitem_t OptionsMenu[]=
 {
+    // haleyjd 08/28/10: [STRIFE] Removed messages, mouse sens., detail.
     {1,"M_ENDGAM",	M_EndGame,'e'},
-    {1,"M_MESSG",	M_ChangeMessages,'m'},
-    {1,"M_DETAIL",	M_ChangeDetail,'g'},
     {2,"M_SCRNSZ",	M_SizeDisplay,'s'},
     {-1,"",0,'\0'},
-    {2,"M_MSENS",	M_ChangeSensitivity,'m'},
-    {-1,"",0,'\0'},
     {1,"M_SVOL",	M_Sound,'s'}
 };
 
@@ -891,10 +889,12 @@
 //
 // M_DrawMainMenu
 //
+// haleyjd 08/27/10: [STRIFE] Changed x coordinate; M_DOOM -> M_STRIFE
+//
 void M_DrawMainMenu(void)
 {
-    V_DrawPatchDirect(94, 2,
-                      W_CacheLumpName(DEH_String("M_DOOM"), PU_CACHE));
+    V_DrawPatchDirect(84, 2,
+                      W_CacheLumpName(DEH_String("M_STRIFE"), PU_CACHE));
 }
 
 
@@ -903,6 +903,8 @@
 //
 // M_NewGame
 //
+// haleyjd 08/27/10: [STRIFE] Verified unmodified.
+//
 void M_DrawNewGame(void)
 {
     V_DrawPatchDirect(96, 14, W_CacheLumpName(DEH_String("M_NEWG"), PU_CACHE));
@@ -991,20 +993,12 @@
 
 void M_DrawOptions(void)
 {
-    V_DrawPatchDirect(108, 15, W_CacheLumpName(DEH_String("M_OPTTTL"),
+    // haleyjd 08/27/10: [STRIFE] M_OPTTTL -> M_OPTION
+    V_DrawPatchDirect(108, 15, W_CacheLumpName(DEH_String("M_OPTION"),
                                                PU_CACHE));
-	
-    V_DrawPatchDirect(OptionsDef.x + 175, OptionsDef.y + LINEHEIGHT * detail,
-		      W_CacheLumpName(DEH_String(detailNames[detailLevel]),
-			              PU_CACHE));
 
-    V_DrawPatchDirect(OptionsDef.x + 120, OptionsDef.y + LINEHEIGHT * messages,
-                      W_CacheLumpName(DEH_String(msgNames[showMessages]),
-                                      PU_CACHE));
+    // haleyjd 08/26/10: [STRIFE] Removed messages, sensitivity, detail.
 
-    M_DrawThermo(OptionsDef.x, OptionsDef.y + LINEHEIGHT * (mousesens + 1),
-		 10, mouseSensitivity);
-
     M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1),
 		 9,screenSize);
 }
@@ -1949,10 +1943,11 @@
     }
 
     
-    // DRAW SKULL
-    V_DrawPatchDirect(x + SKULLXOFF, currentMenu->y - 5 + itemOn*LINEHEIGHT,
-		      W_CacheLumpName(DEH_String(skullName[whichSkull]),
-				      PU_CACHE));
+    // haleyjd 08/27/10: [STRIFE] Adjust to draw spinning Sigil
+    // DRAW SIGIL
+    V_DrawPatchDirect(x + CURSORXOFF, currentMenu->y - 5 + itemOn*LINEHEIGHT,
+                      W_CacheLumpName(DEH_String(cursorName[whichCursor]),
+                                      PU_CACHE));
 
 }
 
@@ -1983,12 +1978,14 @@
 //
 // M_Ticker
 //
+// haleyjd 08/27/10: [STRIFE] Rewritten for Sigil cursor
+//
 void M_Ticker (void)
 {
-    if (--skullAnimCounter <= 0)
+    if (--cursorAnimCounter <= 0)
     {
-	whichSkull ^= 1;
-	skullAnimCounter = 8;
+        whichCursor = (whichCursor + 1) % 8;
+        cursorAnimCounter = 5;
     }
 }
 
@@ -1996,44 +1993,22 @@
 //
 // M_Init
 //
+// haleyjd 08/27/10: [STRIFE] Removed DOOM gamemode stuff
+//
 void M_Init (void)
 {
     currentMenu = &MainDef;
     menuactive = 0;
     itemOn = currentMenu->lastOn;
-    whichSkull = 0;
-    skullAnimCounter = 10;
+    whichCursor = 0;
+    cursorAnimCounter = 10;
     screenSize = screenblocks - 3;
     messageToPrint = 0;
     messageString = NULL;
-    messageLastMenuActive = menuactive;
+    messageLastMenuActive = menuactive; // STRIFE-FIXME: assigns 0 here...
     quickSaveSlot = -1;
 
     // Here we could catch other version dependencies,
     //  like HELP1/2, and four episodes.
-
-  
-    switch ( gamemode )
-    {
-      case commercial:
-        // Commercial has no "read this" entry.
-	MainMenu[readthis] = MainMenu[quitdoom];
-	MainDef.numitems--;
-	MainDef.y += 8;
-	NewDef.prevMenu = &MainDef;
-	break;
-      case shareware:
-	// Episode 2 and 3 are handled,
-	//  branching to an ad screen.
-      case registered:
-	// We need to remove the fourth episode.
-	EpiDef.numitems--;
-	break;
-      case retail:
-	// We are fine.
-      default:
-	break;
-    }
-    
 }
 
--- a/src/strife/r_draw.c
+++ b/src/strife/r_draw.c
@@ -526,8 +526,10 @@
 } 
 
 
+// haleyjd 08/26/10: [STRIFE] - Rogue's translucency lookup table
+// This is functionally equivalent to Raven's TINTTAB and BOOM's TRANMAPs.
+byte *xlatab;
 
-
 //
 // R_InitTranslationTables
 // Creates the translation tables to map
@@ -535,28 +537,47 @@
 // Assumes a given structure of the PLAYPAL.
 // Could be read from a lump instead.
 //
+// haleyjd 08/26/10: [STRIFE]
+// * Added loading of XLATAB
+//
 void R_InitTranslationTables (void)
 {
-    int		i;
-	
+    int         i;
+
+    // [STRIFE] Load xlatab. Here's how Rogue did it:
+    //   v7 = W_CacheLumpName("XLATAB", PU_CACHE); // note potential cache bug...
+    //   HIWORD(v8) = (Z_Malloc(131072, PU_STATIC, NULL) + 65535) >> 16;
+    //   LOWORD(v8) = 0; // aligning to a 64K boundary, as if this is Wolf3D.
+    //   xlatab = v8;
+    //   memcpy(v8, v7, 65536);
+    //   memcpy(v8+65536, v7+65536, 0); // 0 bytes, does nothing!
+    // As you can see, they copypasta'd id's unnecessary 64K boundary alignment
+    // from the colormap code, and then evidently at some point dropped the high
+    // side of the presumably 128KB lump (because it is redundant data), but 
+    // just set the 2nd memset call's length to 0 bytes... Terrible. Since none
+    // of this accomplishes anything, and isn't strictly portable, all we need
+    // to do is this:
+    xlatab = W_CacheLumpName("XLATAB", PU_STATIC);
+
     translationtables = Z_Malloc (256*3, PU_STATIC, 0);
-    
+
+    // STRIFE-TODO: Strife has many more (and more varied) translations
     // translate just the 16 green colors
     for (i=0 ; i<256 ; i++)
     {
-	if (i >= 0x70 && i<= 0x7f)
-	{
-	    // map green ramp to gray, brown, red
-	    translationtables[i] = 0x60 + (i&0xf);
-	    translationtables [i+256] = 0x40 + (i&0xf);
-	    translationtables [i+512] = 0x20 + (i&0xf);
-	}
-	else
-	{
-	    // Keep all other colors as is.
-	    translationtables[i] = translationtables[i+256] 
-		= translationtables[i+512] = i;
-	}
+        if (i >= 0x70 && i<= 0x7f)
+        {
+            // map green ramp to gray, brown, red
+            translationtables[i] = 0x60 + (i&0xf);
+            translationtables [i+256] = 0x40 + (i&0xf);
+            translationtables [i+512] = 0x20 + (i&0xf);
+        }
+        else
+        {
+            // Keep all other colors as is.
+            translationtables[i] = translationtables[i+256] 
+            = translationtables[i+512] = i;
+        }
     }
 }
 
--- a/src/strife/r_draw.h
+++ b/src/strife/r_draw.h
@@ -79,6 +79,7 @@
 
 extern byte*		translationtables;
 extern byte*		dc_translation;
+extern byte*		xlatab;            // haleyjd 08/26/10: [STRIFE]
 
 
 // Span blitting for rows, floor/ceiling.
--- a/src/strife/st_lib.c
+++ b/src/strife/st_lib.c
@@ -58,7 +58,8 @@
 
 void STlib_init(void)
 {
-    sttminus = (patch_t *) W_CacheLumpName(DEH_String("STTMINUS"), PU_STATIC);
+    // haleyjd 08/28/10: [STRIFE] STTMINUS -> STCFN045
+    sttminus = (patch_t *) W_CacheLumpName(DEH_String("STCFN045"), PU_STATIC);
 }