[SCM] SDL-Port of Wolfenstein 3-D and Spear of Destiny branch, master, updated. debian/1.6-0fab3-13-ga27e173

Jon Dowland jmtd at debian.org
Thu Mar 31 21:56:51 UTC 2011


The following commit has been merged in the master branch:
commit 2d962278fcfb8a6c5daa4fc1514eca6087e92dde
Author: Jon Dowland <jmtd at debian.org>
Date:   Thu Mar 31 22:50:01 2011 +0100

    Revert "line-wrap changelog"
    
    This reverts commit 663c1bd544789b4d5af58ba51f08fc45158c50ce.
    Oops -- committed way too much.

diff --git a/Makefile b/Makefile
index a2cbe1b..75ba7a1 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,6 @@ SRCS += wl_agent.cpp
 SRCS += wl_atmos.cpp
 SRCS += wl_cloudsky.cpp
 SRCS += wl_debug.cpp
-SRCS += wl_shade.cpp
 SRCS += wl_draw.cpp
 SRCS += wl_floorceiling.cpp
 SRCS += wl_game.cpp
diff --git a/debian/changelog b/debian/changelog
index 5d1b5b7..09352be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,8 +15,7 @@ wolf4sdl (1.6-1) experimental; urgency=low
   * Add Vcs-* fields.
   * Play safe and run "make clean" between the builds.
   * Fix debian/watch file.
-  * Document the missing game data files in both debian/control and
-    README.Debian.
+  * Document the missing game data files in both debian/control and README.Debian.
 
  -- Fabian Greffrath <fabian+debian at greffrath.com>  Mon, 28 Feb 2011 13:06:25 +0100
 
diff --git a/fmopl.cpp b/fmopl.cpp
index ae10f37..77ce741 100644
--- a/fmopl.cpp
+++ b/fmopl.cpp
@@ -1955,21 +1955,19 @@ static void OPLSetUpdateHandler(FM_OPL *OPL,OPL_UPDATEHANDLER UpdateHandler,int
 	OPL->UpdateParam = param;
 }
 
-/*
 static int OPLWrite(FM_OPL *OPL,int a,int v)
 {
 	if( !(a&1) )
-	{	// address port
+	{	/* address port */
 		OPL->address = v & 0xff;
 	}
 	else
-	{	// data port
+	{	/* data port */
 		if(OPL->UpdateHandler) OPL->UpdateHandler(OPL->UpdateParam,0);
 		OPLWriteReg(OPL,OPL->address,v);
 	}
 	return OPL->status>>7;
 }
-*/
 
 static unsigned char OPLRead(FM_OPL *OPL,int a)
 {
diff --git a/id_ca.cpp b/id_ca.cpp
index a66c362..f2f2b63 100644
--- a/id_ca.cpp
+++ b/id_ca.cpp
@@ -23,6 +23,7 @@ loaded into the data segment
 #endif
 
 #include "wl_def.h"
+#pragma hdrstop
 
 #define THREEBYTEGRSTARTS
 
@@ -80,13 +81,13 @@ int     numEpisodesMissing = 0;
 char extension[5]; // Need a string, not constant to change cache files
 char graphext[5];
 char audioext[5];
-static const char gheadname[] = DATADIR "vgahead.";
-static const char gfilename[] = DATADIR "vgagraph.";
-static const char gdictname[] = DATADIR "vgadict.";
-static const char mheadname[] = DATADIR "maphead.";
-static const char mfilename[] = DATADIR "maptemp.";
-static const char aheadname[] = DATADIR "audiohed.";
-static const char afilename[] = DATADIR "audiot.";
+static const char gheadname[] = "vgahead.";
+static const char gfilename[] = "vgagraph.";
+static const char gdictname[] = "vgadict.";
+static const char mheadname[] = "maphead.";
+static const char mfilename[] = "maptemp.";
+static const char aheadname[] = "audiohed.";
+static const char afilename[] = "audiot.";
 
 void CA_CannotOpen(const char *string);
 
@@ -153,7 +154,7 @@ void CAL_GetGrChunkLength (int chunk)
 
 boolean CA_WriteFile (const char *filename, void *ptr, int32_t length)
 {
-    const int handle = open(filename, O_CREAT | O_WRONLY | O_BINARY, 0644);
+    const int handle = open(filename, O_CREAT | O_WRONLY | O_BINARY);
     if (handle == -1)
         return false;
 
@@ -442,7 +443,7 @@ void CA_RLEWexpand (word *source, word *dest, int32_t length, word rlewtag)
 
 void CAL_SetupGrFile (void)
 {
-    char fname[13 + sizeof(DATADIR)];
+    char fname[13];
     int handle;
     byte *compseg;
 
@@ -538,7 +539,7 @@ void CAL_SetupMapFile (void)
     int     i;
     int handle;
     int32_t length,pos;
-    char fname[13 + sizeof(DATADIR)];
+    char fname[13];
 
 //
 // load maphead.ext (offsets and tileinfo for map file)
@@ -562,7 +563,7 @@ void CAL_SetupMapFile (void)
 // open the data file
 //
 #ifdef CARMACIZED
-    strcpy(fname, DATADIR "gamemaps.");
+    strcpy(fname, "gamemaps.");
     strcat(fname, extension);
 
     maphandle = open(fname, O_RDONLY | O_BINARY);
@@ -618,7 +619,7 @@ void CAL_SetupMapFile (void)
 
 void CAL_SetupAudioFile (void)
 {
-    char fname[13 + sizeof(DATADIR)];
+    char fname[13];
 
 //
 // load audiohed.ext (offsets for audio file)
@@ -684,7 +685,7 @@ void CA_Startup (void)
 
 void CA_Shutdown (void)
 {
-    int i,start = STARTADLIBSOUNDS;
+    int i,start;
 
     if(maphandle != -1)
         close(maphandle);
@@ -794,7 +795,7 @@ void CA_CacheAdlibSoundChunk (int chunk)
 
 void CA_LoadAllSounds (void)
 {
-    unsigned start = STARTADLIBSOUNDS,i;
+    unsigned start,i;
 
     switch (oldsoundmode)
     {
@@ -1030,7 +1031,7 @@ void CA_CacheMap (int mapnum)
     int32_t   pos,compressed;
     int       plane;
     word     *dest;
-    memptr    bigbufferseg = 0;
+    memptr    bigbufferseg;
     unsigned  size;
     word     *source;
 #ifdef CARMACIZED
diff --git a/id_pm.cpp b/id_pm.cpp
index d24219c..b238edf 100644
--- a/id_pm.cpp
+++ b/id_pm.cpp
@@ -16,7 +16,7 @@ uint8_t **PMPages;
 
 void PM_Startup()
 {
-    char fname[13 + sizeof(DATADIR)] = DATADIR "vswap.";
+    char fname[13] = "vswap.";
     strcat(fname,extension);
 
     FILE *file = fopen(fname,"rb");
@@ -82,7 +82,7 @@ void PM_Startup()
     uint8_t *ptr = (uint8_t *) PMPageData;
     for(i = 0; i < ChunksInFile; i++)
     {
-        if((i >= PMSpriteStart && i < PMSoundStart) || i == ChunksInFile - 1)
+        if(i >= PMSpriteStart && i < PMSoundStart || i == ChunksInFile - 1)
         {
             size_t offs = ptr - (uint8_t *) PMPageData;
 
diff --git a/id_sd.cpp b/id_sd.cpp
index 92cb865..165fc67 100644
--- a/id_sd.cpp
+++ b/id_sd.cpp
@@ -31,6 +31,7 @@
 #include <SDL_mixer.h>
 #include "fmopl.h"
 
+#pragma hdrstop
 
 #define ORIGSAMPLERATE 7042
 
@@ -94,6 +95,7 @@ static  boolean                 DigiPlaying;
 //      PC Sound variables
 static  volatile byte           pcLastSample;
 static  byte * volatile         pcSound;
+static  longword                pcLengthLeft;
 
 //      AdLib variables
 static  byte * volatile         alSound;
@@ -778,7 +780,6 @@ SDL_ShutAL(void)
 //      SDL_CleanAL() - Totally shuts down the AdLib card
 //
 ///////////////////////////////////////////////////////////////////////////
-/*
 static void
 SDL_CleanAL(void)
 {
@@ -788,7 +789,6 @@ SDL_CleanAL(void)
     for (i = 1; i < 0xf5; i++)
         alOut(i, 0);
 }
-*/
 
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -808,7 +808,6 @@ SDL_StartAL(void)
 //              emulating an AdLib) present
 //
 ///////////////////////////////////////////////////////////////////////////
-/*
 static boolean
 SDL_DetectAdLib(void)
 {
@@ -820,7 +819,6 @@ SDL_DetectAdLib(void)
 
     return true;
 }
-*/
 
 ////////////////////////////////////////////////////////////////////////////
 //
@@ -847,14 +845,12 @@ SDL_ShutDevice(void)
 //      SDL_CleanDevice() - totally shuts down all sound devices
 //
 ///////////////////////////////////////////////////////////////////////////
-/*
 static void
 SDL_CleanDevice(void)
 {
     if ((SoundMode == sdm_AdLib) || (MusicMode == smm_AdLib))
         SDL_CleanAL();
 }
-*/
 
 ///////////////////////////////////////////////////////////////////////////
 //
diff --git a/id_us_1.cpp b/id_us_1.cpp
index aeac073..db8e30e 100644
--- a/id_us_1.cpp
+++ b/id_us_1.cpp
@@ -22,6 +22,7 @@
 
 #include "wl_def.h"
 
+#pragma	hdrstop
 
 #if _MSC_VER == 1200            // Visual C++ 6
 	#define vsnprintf _vsnprintf
@@ -176,7 +177,7 @@ void
 US_PrintUnsigned(longword n)
 {
 	char	buffer[32];
-	sprintf(buffer, "%lu", (long unsigned int) n);
+	sprintf(buffer, "%lu", n);
 
 	US_Print(buffer);
 }
@@ -487,11 +488,11 @@ US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
 {
 	boolean		redraw,
 				cursorvis,cursormoved,
-				done,result = false, checkkey;
+				done,result, checkkey;
 	ScanCode	sc;
 	char		c;
 	char		s[MaxString],olds[MaxString];
-	int         cursor,len = 0;
+	int         cursor,len;
 	word		i,
 				w,h,
 				temp;
@@ -529,7 +530,7 @@ US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
 		curtime = GetTimeCount();
 
 		// After each direction change accept the next change after 250 ms and then everz 125 ms
-		if(ci.dir != lastdir || (curtime - lastdirtime > TickBase / 4 && curtime - lastdirmovetime > TickBase / 8))
+		if(ci.dir != lastdir || curtime - lastdirtime > TickBase / 4 && curtime - lastdirmovetime > TickBase / 8)
 		{
 			if(ci.dir != lastdir)
 			{
@@ -557,7 +558,7 @@ US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
 					if(!s[cursor])
 					{
 						USL_MeasureString(s,&w,&h);
-						if(len >= maxchars || (maxwidth && w >= maxwidth)) break;
+						if(len >= maxchars || maxwidth && w >= maxwidth) break;
 
 						s[cursor] = ' ';
 						s[cursor + 1] = 0;
@@ -571,7 +572,7 @@ US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
 					if(!s[cursor])
 					{
 						USL_MeasureString(s,&w,&h);
-						if(len >= maxchars || (maxwidth && w >= maxwidth)) break;
+						if(len >= maxchars || maxwidth && w >= maxwidth) break;
 						s[cursor + 1] = 0;
 					}
 					s[cursor] = USL_RotateChar(s[cursor], 1);
@@ -583,7 +584,7 @@ US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
 					if(!s[cursor])
 					{
 						USL_MeasureString(s,&w,&h);
-						if(len >= maxchars || (maxwidth && w >= maxwidth)) break;
+						if(len >= maxchars || maxwidth && w >= maxwidth) break;
 						s[cursor + 1] = 0;
 					}
 					s[cursor] = USL_RotateChar(s[cursor], -1);
diff --git a/id_vl.cpp b/id_vl.cpp
index 82f6e22..57886c0 100644
--- a/id_vl.cpp
+++ b/id_vl.cpp
@@ -2,6 +2,7 @@
 
 #include <string.h>
 #include "wl_def.h"
+#pragma hdrstop
 
 // Uncomment the following line, if you get destination out of bounds
 // assertion errors and want to ignore them during debugging
diff --git a/version.h b/version.h
index dd4d453..5ddcf12 100644
--- a/version.h
+++ b/version.h
@@ -3,16 +3,12 @@
 
 #ifndef VERSIONALREADYCHOSEN              // used for batch compiling
 
-#ifndef DATADIR
-#define DATADIR ""
-#endif
-
 /* Defines used for different versions */
 
-#define SPEAR
-#define SPEARDEMO
+//#define SPEAR
+//#define SPEARDEMO
 //#define UPLOAD
-//#define GOODTIMES
+#define GOODTIMES
 #define CARMACIZED
 //#define APOGEE_1_0
 //#define APOGEE_1_1
@@ -34,7 +30,7 @@
 #endif
 
 //#define USE_FEATUREFLAGS    // Enables the level feature flags (see bottom of wl_def.h)
-#define USE_SHADING         // Enables shading support (see wl_shade.cpp)
+//#define USE_SHADING         // Enables shading support (see wl_shade.cpp)
 //#define USE_DIR3DSPR        // Enables directional 3d sprites (see wl_dir3dspr.cpp)
 //#define USE_FLOORCEILINGTEX // Enables floor and ceiling textures stored in the third mapplane (see wl_floorceiling.cpp)
 //#define USE_HIRES           // Enables high resolution textures/sprites (128x128)
diff --git a/wl_act1.cpp b/wl_act1.cpp
index 69fc738..40dc82d 100644
--- a/wl_act1.cpp
+++ b/wl_act1.cpp
@@ -1,6 +1,7 @@
 // WL_ACT1.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 /*
 =============================================================================
@@ -16,7 +17,6 @@ statobj_t       *laststatobj;
 
 
 struct
-statinfo_t
 {
     short      picnum;
     wl_stat_t  type;
@@ -844,7 +844,7 @@ void MovePWalls (void)
             pwally += dy;
 
             if (actorat[pwallx+dx][pwally+dy]
-                || (xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh))
+                || xl<=pwallx+dx && pwallx+dx<=xh && yl<=pwally+dy && pwally+dy<=yh)
             {
                 pwallstate = 0;
                 tilemap[pwallx][pwally] = oldtile;
diff --git a/wl_act2.cpp b/wl_act2.cpp
index 287f5d8..cacdd98 100644
--- a/wl_act2.cpp
+++ b/wl_act2.cpp
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <math.h>
 #include "wl_def.h"
+#pragma hdrstop
 
 /*
 =============================================================================
@@ -306,7 +307,7 @@ boolean ProjectileTryMove (objtype *ob)
 void T_Projectile (objtype *ob)
 {
     int32_t deltax,deltay;
-    int     damage = 0;
+    int     damage;
     int32_t speed;
 
     speed = (int32_t)ob->speed*tics;
diff --git a/wl_agent.cpp b/wl_agent.cpp
index 23234eb..cc49087 100644
--- a/wl_agent.cpp
+++ b/wl_agent.cpp
@@ -1,6 +1,7 @@
 // WL_AGENT.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 /*
 =============================================================================
diff --git a/wl_debug.cpp b/wl_debug.cpp
index 2d5e6fc..deaa0b8 100644
--- a/wl_debug.cpp
+++ b/wl_debug.cpp
@@ -7,6 +7,7 @@
 #endif
 
 #include "wl_def.h"
+#pragma hdrstop
 
 #ifdef USE_CLOUDSKY
 #include "wl_cloudsky.h"
@@ -51,7 +52,7 @@ void SimpleScaleShape (int xcenter, int shapenum, unsigned height);
 
 int     maporgx;
 int     maporgy;
-enum viewtype_t {mapview,tilemapview,actoratview,visview}  viewtype;
+enum {mapview,tilemapview,actoratview,visview}  viewtype;
 
 void ViewMap (void);
 
@@ -180,7 +181,7 @@ void BasicOverhead (void)
     // left side (filtered)
 
     uintptr_t tile;
-    int color = 0;
+    int color;
     offx -= 128;
 
     for(x=0;x<MAPSIZE;x++)
diff --git a/wl_def.h b/wl_def.h
index 95e30c8..48007f5 100644
--- a/wl_def.h
+++ b/wl_def.h
@@ -915,7 +915,7 @@ extern  unsigned screenofs;
 
 extern  boolean  startgame;
 extern  char     str[80];
-extern  char     configname[256];
+extern  char     configname[13];
 
 //
 // Command line parameter variables
diff --git a/wl_draw.cpp b/wl_draw.cpp
index 65909ad..3eb9e6a 100644
--- a/wl_draw.cpp
+++ b/wl_draw.cpp
@@ -1,6 +1,7 @@
 // WL_DRAW.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 #include "wl_cloudsky.h"
 #include "wl_atmos.h"
@@ -483,7 +484,7 @@ void HitHorizWall (void)
 
 void HitHorizDoor (void)
 {
-    int doorpage = DOORWALL;
+    int doorpage;
     int doornum;
     int texture;
 
@@ -548,7 +549,7 @@ void HitHorizDoor (void)
 
 void HitVertDoor (void)
 {
-    int doorpage = DOORWALL+1;
+    int doorpage;
     int doornum;
     int texture;
 
@@ -1207,8 +1208,8 @@ void CalcTics (void)
 
 void AsmRefresh()
 {
-    int32_t xstep = 0,ystep = 0;
-    longword xpartial = 0,ypartial = 0;
+    int32_t xstep,ystep;
+    longword xpartial,ypartial;
     boolean playerInPushwallBackTile = tilemap[focaltx][focalty] == 64;
 
     for(pixx=0;pixx<viewwidth;pixx++)
@@ -1263,8 +1264,8 @@ void AsmRefresh()
         // Special treatment when player is in back tile of pushwall
         if(playerInPushwallBackTile)
         {
-            if(    (pwalldir == di_east && xtilestep ==  1)
-                || (pwalldir == di_west && xtilestep == -1))
+            if(    pwalldir == di_east && xtilestep ==  1
+                || pwalldir == di_west && xtilestep == -1)
             {
                 int32_t yintbuf = yintercept - ((ystep * (64 - pwallpos)) >> 6);
                 if((yintbuf >> 16) == focalty)   // ray hits pushwall back?
@@ -1279,8 +1280,8 @@ void AsmRefresh()
                     continue;
                 }
             }
-            else if((pwalldir == di_south && ytilestep ==  1)
-                ||  (pwalldir == di_north && ytilestep == -1))
+            else if(pwalldir == di_south && ytilestep ==  1
+                ||  pwalldir == di_north && ytilestep == -1)
             {
                 int32_t xintbuf = xintercept - ((xstep * (64 - pwallpos)) >> 6);
                 if((xintbuf >> 16) == focaltx)   // ray hits pushwall back?
@@ -1347,8 +1348,8 @@ vertentry:
                                 pwallposnorm = pwallpos;
                                 pwallposinv = 64-pwallpos;
                             }
-                            if((pwalldir == di_east && xtile==pwallx && ((uint32_t)yintercept>>16)==pwally)
-                                || (pwalldir == di_west && !(xtile==pwallx && ((uint32_t)yintercept>>16)==pwally)))
+                            if(pwalldir == di_east && xtile==pwallx && ((uint32_t)yintercept>>16)==pwally
+                                || pwalldir == di_west && !(xtile==pwallx && ((uint32_t)yintercept>>16)==pwally))
                             {
                                 yintbuf=yintercept+((ystep*pwallposnorm)>>6);
                                 if((yintbuf>>16)!=(yintercept>>16))
@@ -1375,13 +1376,13 @@ vertentry:
                         {
                             int pwallposi = pwallpos;
                             if(pwalldir==di_north) pwallposi = 64-pwallpos;
-                            if((pwalldir==di_south && (word)yintercept<(pwallposi<<10))
-                                || (pwalldir==di_north && (word)yintercept>(pwallposi<<10)))
+                            if(pwalldir==di_south && (word)yintercept<(pwallposi<<10)
+                                || pwalldir==di_north && (word)yintercept>(pwallposi<<10))
                             {
                                 if(((uint32_t)yintercept>>16)==pwally && xtile==pwallx)
                                 {
-                                    if((pwalldir==di_south && (int32_t)((word)yintercept)+ystep<(pwallposi<<10))
-                                            || (pwalldir==di_north && (int32_t)((word)yintercept)+ystep>(pwallposi<<10)))
+                                    if(pwalldir==di_south && (int32_t)((word)yintercept)+ystep<(pwallposi<<10)
+                                            || pwalldir==di_north && (int32_t)((word)yintercept)+ystep>(pwallposi<<10))
                                         goto passvert;
 
                                     if(pwalldir==di_south)
@@ -1411,8 +1412,8 @@ vertentry:
                                 }
                                 else
                                 {
-                                    if((pwalldir==di_south && (int32_t)((word)yintercept)+ystep>(pwallposi<<10))
-                                            || (pwalldir==di_north && (int32_t)((word)yintercept)+ystep<(pwallposi<<10)))
+                                    if(pwalldir==di_south && (int32_t)((word)yintercept)+ystep>(pwallposi<<10)
+                                            || pwalldir==di_north && (int32_t)((word)yintercept)+ystep<(pwallposi<<10))
                                         goto passvert;
 
                                     if(pwalldir==di_south)
@@ -1493,8 +1494,8 @@ horizentry:
                                 pwallposnorm = pwallpos;
                                 pwallposinv = 64-pwallpos;
                             }
-                            if((pwalldir == di_south && ytile==pwally && ((uint32_t)xintercept>>16)==pwallx)
-                                || (pwalldir == di_north && !(ytile==pwally && ((uint32_t)xintercept>>16)==pwallx)))
+                            if(pwalldir == di_south && ytile==pwally && ((uint32_t)xintercept>>16)==pwallx
+                                || pwalldir == di_north && !(ytile==pwally && ((uint32_t)xintercept>>16)==pwallx))
                             {
                                 xintbuf=xintercept+((xstep*pwallposnorm)>>6);
                                 if((xintbuf>>16)!=(xintercept>>16))
@@ -1521,13 +1522,13 @@ horizentry:
                         {
                             int pwallposi = pwallpos;
                             if(pwalldir==di_west) pwallposi = 64-pwallpos;
-                            if((pwalldir==di_east && (word)xintercept<(pwallposi<<10))
-                                    || (pwalldir==di_west && (word)xintercept>(pwallposi<<10)))
+                            if(pwalldir==di_east && (word)xintercept<(pwallposi<<10)
+                                    || pwalldir==di_west && (word)xintercept>(pwallposi<<10))
                             {
                                 if(((uint32_t)xintercept>>16)==pwallx && ytile==pwally)
                                 {
-                                    if((pwalldir==di_east && (int32_t)((word)xintercept)+xstep<(pwallposi<<10))
-                                            || (pwalldir==di_west && (int32_t)((word)xintercept)+xstep>(pwallposi<<10)))
+                                    if(pwalldir==di_east && (int32_t)((word)xintercept)+xstep<(pwallposi<<10)
+                                            || pwalldir==di_west && (int32_t)((word)xintercept)+xstep>(pwallposi<<10))
                                         goto passhoriz;
 
                                     if(pwalldir==di_east)
@@ -1557,8 +1558,8 @@ horizentry:
                                 }
                                 else
                                 {
-                                    if((pwalldir==di_east && (int32_t)((word)xintercept)+xstep>(pwallposi<<10))
-                                            || (pwalldir==di_west && (int32_t)((word)xintercept)+xstep<(pwallposi<<10)))
+                                    if(pwalldir==di_east && (int32_t)((word)xintercept)+xstep>(pwallposi<<10)
+                                            || pwalldir==di_west && (int32_t)((word)xintercept)+xstep<(pwallposi<<10))
                                         goto passhoriz;
 
                                     if(pwalldir==di_east)
diff --git a/wl_game.cpp b/wl_game.cpp
index fcbad42..bee0073 100644
--- a/wl_game.cpp
+++ b/wl_game.cpp
@@ -3,6 +3,7 @@
 #include <math.h>
 #include "wl_def.h"
 #include <SDL_mixer.h>
+#pragma hdrstop
 
 #ifdef MYPROFILE
 #include <TIME.H>
@@ -1176,8 +1177,7 @@ void PlayDemo (int demonumber)
     NewGame (1,0);
     gamestate.mapon = *demoptr++;
     gamestate.difficulty = gd_hard;
-    length = demoptr[0] | demoptr[1] << 8;
-    demoptr+=2;
+    length = READWORD(*(uint8_t **)&demoptr);
     // TODO: Seems like the original demo format supports 16 MB demos
     //       But T_DEM00 and T_DEM01 of Wolf have a 0xd8 as third length size...
     demoptr++;
diff --git a/wl_inter.cpp b/wl_inter.cpp
index d60f07e..c045de8 100644
--- a/wl_inter.cpp
+++ b/wl_inter.cpp
@@ -1,6 +1,7 @@
 // WL_INTER.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 LRstruct LevelRatios[LRpack];
 int32_t lastBreathTime = 0;
@@ -385,7 +386,7 @@ Write (int x, int y, const char *string)
                     break;
 
                 default:
-                    VWB_DrawPic (nx, ny, alpha[(int)ch]);
+                    VWB_DrawPic (nx, ny, alpha[ch]);
             }
             nx += 16;
         }
diff --git a/wl_main.cpp b/wl_main.cpp
index b9313f7..dca0e89 100644
--- a/wl_main.cpp
+++ b/wl_main.cpp
@@ -4,14 +4,12 @@
     #include <io.h>
 #else
     #include <unistd.h>
-    #include <sys/stat.h>
-    #include <sys/types.h>
 #endif
 
 #include "wl_def.h"
+#pragma hdrstop
 #include "wl_atmos.h"
 #include <SDL_syswm.h>
-#include <errno.h>
 
 
 /*
@@ -75,8 +73,7 @@ boolean startgame;
 boolean loadedgame;
 int     mouseadjustment;
 
-char    configdir[256];
-char    configname[256];
+char    configname[13]="config.";
 
 //
 // Command line parameter variables
@@ -1421,7 +1418,7 @@ void Quit (const char *errorStr, ...)
     if (!pictable)  // don't try to display the red box before it's loaded
     {
         ShutdownId();
-        if (*error)
+        if (error && *error)
         {
 #ifdef NOTYET
             SetTextCursor(0,0);
@@ -1435,7 +1432,7 @@ void Quit (const char *errorStr, ...)
         exit(1);
     }
 
-    if (!*error)
+    if (!error || !*error)
     {
 #ifdef NOTYET
         #ifndef JAPAN
@@ -1455,7 +1452,7 @@ void Quit (const char *errorStr, ...)
 
     ShutdownId ();
 
-    if (*error)
+    if (error && *error)
     {
 #ifdef NOTYET
         memcpy((byte *)0xb8000,screen+7,7*160);
@@ -1469,7 +1466,7 @@ void Quit (const char *errorStr, ...)
         exit(1);
     }
     else
-    if (!*error)
+    if (!error || !(*error))
     {
 #ifdef NOTYET
         #ifndef JAPAN
@@ -1701,7 +1698,7 @@ void CheckParameters(int argc, char *argv[])
                 screenWidth = atoi(argv[++i]);
                 screenHeight = atoi(argv[++i]);
                 unsigned factor = screenWidth / 320;
-                if(screenWidth % 320 || (screenHeight != 200 * factor && screenHeight != 240 * factor))
+                if(screenWidth % 320 || screenHeight != 200 * factor && screenHeight != 240 * factor)
                     printf("Screen size must be a multiple of 320x200 or 320x240!\n"), hasError = true;
             }
         }
@@ -1874,19 +1871,6 @@ int main (int argc, char *argv[])
     CheckParameters(argc, argv);
 #endif
 
-#if defined (__unix__) && !defined(__MINGW32__)
-    /* Set up home directory */
-    if (getenv ("HOME") == NULL)
-        Quit ("Could not get \"HOME\" environment variable.");
-    int err;
-    snprintf(configdir, sizeof(configdir) - 1, "%s/.wolf4sdl/", getenv ("HOME"));
-    err = mkdir(configdir, S_IRWXU);
-    if (err == -1 && errno != EEXIST)
-        Quit ("Could not create directory \"%s\": %s\n", configdir, strerror (errno));
-#else
-    strcpy(configdir, "");
-#endif
-
     CheckForEpisodes();
 
     InitGame();
diff --git a/wl_menu.cpp b/wl_menu.cpp
index 297f16a..5591803 100644
--- a/wl_menu.cpp
+++ b/wl_menu.cpp
@@ -14,10 +14,10 @@
 #endif
 
 #include "wl_def.h"
+#pragma hdrstop
 
 extern int lastgamemusicoffset;
 extern int numEpisodesMissing;
-extern char configdir[256];
 
 //
 // PRIVATE PROTOTYPES
@@ -277,8 +277,8 @@ static int SaveGamesAvail[10];
 static int StartGame;
 static int SoundStatus = 1;
 static int pickquick;
-static char SaveGameNames[10][256];
-static char SaveName[256] = "savegam?.";
+static char SaveGameNames[10][32];
+static char SaveName[13] = "savegam?.";
 
 
 ////////////////////////////////////////////////////////////////////
@@ -920,7 +920,7 @@ CP_CheckQuick (ScanCode scancode)
 #ifdef SPANISH
             if (Confirm (ENDGAMESTR))
 #else
-            if (Confirm (endStrings[US_RndT () & (0x7 + (US_RndT () & 1))]))
+            if (Confirm (endStrings[US_RndT () & 0x7 + (US_RndT () & 1)]))
 #endif
 #endif
             {
@@ -1497,10 +1497,10 @@ CP_LoadGame (int quick)
 {
     FILE *file;
     int which, exit = 0;
-    char name[256];
+    char name[13];
 
 
-    snprintf (name, sizeof(name) - 1, "%s%s", configdir, SaveName);
+    strcpy (name, SaveName);
 
     //
     // QUICKLOAD?
@@ -1511,7 +1511,7 @@ CP_LoadGame (int quick)
 
         if (SaveGamesAvail[which])
         {
-            name[strlen(configdir) + 7] = which + '0';
+            name[7] = which + '0';
 #ifdef _arch_dreamcast
             DC_LoadFromVMU(name);
 #endif
@@ -1549,7 +1549,7 @@ CP_LoadGame (int quick)
         if (which >= 0 && SaveGamesAvail[which])
         {
             ShootSnd ();
-            name[strlen(configdir) + 7] = which + '0';
+            name[7] = which + '0';
 
 #ifdef _arch_dreamcast
             DC_LoadFromVMU(name);
@@ -1676,11 +1676,11 @@ CP_SaveGame (int quick)
 {
     int which, exit = 0;
     FILE *file;
-    char name[256];
-    char input[256];
+    char name[13];
+    char input[32];
 
 
-    snprintf (name, sizeof(name) - 1, "%s%s", configdir, SaveName);
+    strcpy (name, SaveName);
 
     //
     // QUICKSAVE?
@@ -1691,7 +1691,7 @@ CP_SaveGame (int quick)
 
         if (SaveGamesAvail[which])
         {
-            name[strlen(configdir) + 7] = which + '0';
+            name[7] = which + '0';
             unlink (name);
             file = fopen (name, "wb");
 
@@ -1728,7 +1728,6 @@ CP_SaveGame (int quick)
             // OVERWRITE EXISTING SAVEGAME?
             //
             if (SaveGamesAvail[which])
-            {
 #ifdef JAPAN
                 if (!GetYorN (7, 8, C_JAPSAVEOVERPIC))
 #else
@@ -1744,12 +1743,11 @@ CP_SaveGame (int quick)
                     PrintLSEntry (which, HIGHLIGHT);
                     VW_UpdateScreen ();
                 }
-            }
 
             ShootSnd ();
 
             strcpy (input, &SaveGameNames[which][0]);
-            name[strlen(configdir) + 7] = which + '0';
+            name[7] = which + '0';
 
             fontnumber = 0;
             if (!SaveGamesAvail[which])
@@ -2115,7 +2113,7 @@ CustomControls (int)
 void
 DefineMouseBtns (void)
 {
-    CustomCtrls mouseallowed = {{ 0, 1, 1, 1 }};
+    CustomCtrls mouseallowed = { 0, 1, 1, 1 };
     EnterCtrlData (2, &mouseallowed, DrawCustMouse, PrintCustMouse, MOUSE);
 }
 
@@ -2127,7 +2125,7 @@ DefineMouseBtns (void)
 void
 DefineJoyBtns (void)
 {
-    CustomCtrls joyallowed = {{ 1, 1, 1, 1 }};
+    CustomCtrls joyallowed = { 1, 1, 1, 1 };
     EnterCtrlData (5, &joyallowed, DrawCustJoy, PrintCustJoy, JOYSTICK);
 }
 
@@ -2139,7 +2137,7 @@ DefineJoyBtns (void)
 void
 DefineKeyBtns (void)
 {
-    CustomCtrls keyallowed = {{ 1, 1, 1, 1 }};
+    CustomCtrls keyallowed = { 1, 1, 1, 1 };
     EnterCtrlData (8, &keyallowed, DrawCustKeybd, PrintCustKeybd, KEYBOARDBTNS);
 }
 
@@ -2151,7 +2149,7 @@ DefineKeyBtns (void)
 void
 DefineKeyMove (void)
 {
-    CustomCtrls keyallowed = {{ 1, 1, 1, 1 }};
+    CustomCtrls keyallowed = { 1, 1, 1, 1 };
     EnterCtrlData (10, &keyallowed, DrawCustKeys, PrintCustKeys, KEYBOARDMOVE);
 }
 
@@ -2168,7 +2166,7 @@ void
 EnterCtrlData (int index, CustomCtrls * cust, void (*DrawRtn) (int), void (*PrintRtn) (int),
                int type)
 {
-    int j, exit, tick, redraw, which = 0, x = 0, picked, lastFlashTime;
+    int j, exit, tick, redraw, which, x, picked, lastFlashTime;
     ControlInfo ci;
 
 
@@ -2219,7 +2217,7 @@ EnterCtrlData (int index, CustomCtrls * cust, void (*DrawRtn) (int), void (*Prin
         //
         // CHANGE BUTTON VALUE?
         //
-        if (((type != KEYBOARDBTNS && type != KEYBOARDMOVE) && (ci.button0 | ci.button1 | ci.button2 | ci.button3)) ||
+        if ((type != KEYBOARDBTNS && type != KEYBOARDMOVE) && (ci.button0 | ci.button1 | ci.button2 | ci.button3) ||
             ((type == KEYBOARDBTNS || type == KEYBOARDMOVE) && LastScan == sc_Enter))
         {
             lastFlashTime = GetTimeCount();
@@ -2340,7 +2338,7 @@ EnterCtrlData (int index, CustomCtrls * cust, void (*DrawRtn) (int), void (*Prin
                 //
                 // EXIT INPUT?
                 //
-                if (IN_KeyDown (sc_Escape) || (type != JOYSTICK && ci.button1))
+                if (IN_KeyDown (sc_Escape) || type != JOYSTICK && ci.button1)
                 {
                     picked = 1;
                     SD_PlaySound (ESCPRESSEDSND);
@@ -2920,7 +2918,7 @@ CP_Quit (int)
 #ifdef SPANISH
     if (Confirm (ENDGAMESTR))
 #else
-    if (Confirm (endStrings[US_RndT () & (0x7 + (US_RndT () & 1))]))
+    if (Confirm (endStrings[US_RndT () & 0x7 + (US_RndT () & 1)]))
 #endif
 
 #endif
@@ -3144,7 +3142,7 @@ SetupControlPanel (void)
 ////////////////////////////////////////////////////////////////////
 void SetupSaveGames()
 {
-    char name[256];
+    char name[13];
 
 #ifdef _arch_dreamcast
     file_t dir;
@@ -3154,12 +3152,12 @@ void SetupSaveGames()
     dir = fs_open("/vmu/a1", O_RDONLY | O_DIR);
     x = 0;
 
-    snprintf(name, sizeof(name) - 1, "%s%s", configdir, SaveName);
+    strcpy(name, SaveName);
     while((dirent = fs_readdir(dir)) && x < 10)
     {
         for(int i=0; i<10; i++)
         {
-            name[strlen(configdir) + 7] = '0' + i;
+            name[7] = '0' + i;
             if(!strcmp(name, dirent->name))
             {
                 if(DC_LoadFromVMU(name) != -1)
@@ -3183,10 +3181,10 @@ void SetupSaveGames()
 
     fs_close(dir);
 #else
-    snprintf(name, sizeof(name) - 1, "%s%s", configdir, SaveName);
+    strcpy(name, SaveName);
     for(int i=0; i<10; i++)
     {
-        name[strlen(configdir) + 7] = '0' + i;
+        name[7] = '0' + i;
         const int handle = open(name, O_RDONLY | O_BINARY);
         if (handle >= 0)
         {
@@ -3406,7 +3404,7 @@ HandleMenu (CP_iteminfo * item_i, CP_itemtype * items, void (*routine) (int w))
         if (ci.button0 || Keyboard[sc_Space] || Keyboard[sc_Enter])
             exit = 1;
 
-        if ((ci.button1 && !Keyboard[sc_Alt]) || Keyboard[sc_Escape])
+        if (ci.button1 && !Keyboard[sc_Alt] || Keyboard[sc_Escape])
             exit = 2;
 
     }
@@ -3853,7 +3851,7 @@ Message (const char *string)
             h += font->height;
         }
         else
-            w += font->width[(int8_t)string[i]];
+            w += font->width[string[i]];
     }
 
     if (w + 10 > mw)
@@ -4000,16 +3998,16 @@ CheckForEpisodes (void)
 //
 #ifdef JAPAN
 #ifdef JAPDEMO
-    if(!stat(DATADIR "vswap.wj1", &statbuf))
+    if(!stat("vswap.wj1", &statbuf))
     {
         strcpy (extension, "wj1");
         numEpisodesMissing = 5;
 #else
-    if(!stat(DATADIR "vswap.wj6", &statbuf))
+    if(!stat("vswap.wj6", &statbuf))
     {
         strcpy (extension, "wj6");
 #endif
-        snprintf(configname, sizeof(configname) - 1, "%sconfig.%s", configdir, extension);
+        strcat (configname, extension);
         strcat (SaveName, extension);
         strcat (demoname, extension);
         EpisodeSelect[1] =
@@ -4023,7 +4021,7 @@ CheckForEpisodes (void)
 // ENGLISH
 //
 #ifdef UPLOAD
-    if(!stat(DATADIR "vswap.wl1", &statbuf))
+    if(!stat("vswap.wl1", &statbuf))
     {
         strcpy (extension, "wl1");
         numEpisodesMissing = 5;
@@ -4032,7 +4030,7 @@ CheckForEpisodes (void)
         Quit ("NO WOLFENSTEIN 3-D DATA FILES to be found!");
 #else
 #ifndef SPEAR
-    if(!stat(DATADIR "vswap.wl6", &statbuf))
+    if(!stat("vswap.wl6", &statbuf))
     {
         strcpy (extension, "wl6");
         NewEmenu[2].active =
@@ -4045,7 +4043,7 @@ CheckForEpisodes (void)
     }
     else
     {
-        if(!stat(DATADIR "vswap.wl3", &statbuf))
+        if(!stat("vswap.wl3", &statbuf))
         {
             strcpy (extension, "wl3");
             numEpisodesMissing = 3;
@@ -4053,7 +4051,7 @@ CheckForEpisodes (void)
         }
         else
         {
-            if(!stat(DATADIR "vswap.wl1", &statbuf))
+            if(!stat("vswap.wl1", &statbuf))
             {
                 strcpy (extension, "wl1");
                 numEpisodesMissing = 5;
@@ -4070,21 +4068,21 @@ CheckForEpisodes (void)
 #ifndef SPEARDEMO
     if(param_mission == 1)
     {
-        if(!stat(DATADIR "vswap.sod", &statbuf))
+        if(!stat("vswap.sod", &statbuf))
             strcpy (extension, "sod");
         else
             Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
     }
     else if(param_mission == 2)
     {
-        if(!stat(DATADIR "vswap.sd2", &statbuf))
+        if(!stat("vswap.sd2", &statbuf))
             strcpy (extension, "sd2");
         else
             Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
     }
     else if(param_mission == 3)
     {
-        if(!stat(DATADIR "vswap.sd3", &statbuf))
+        if(!stat("vswap.sd3", &statbuf))
             strcpy (extension, "sd3");
         else
             Quit ("NO SPEAR OF DESTINY DATA FILES TO BE FOUND!");
@@ -4094,7 +4092,7 @@ CheckForEpisodes (void)
     strcpy (graphext, "sod");
     strcpy (audioext, "sod");
 #else
-    if(!stat(DATADIR "vswap.sdm", &statbuf))
+    if(!stat("vswap.sdm", &statbuf))
     {
         strcpy (extension, "sdm");
     }
@@ -4108,7 +4106,7 @@ CheckForEpisodes (void)
     strcpy (audioext, extension);
 #endif
 
-    snprintf (configname, sizeof(configname) - 1, "%sconfig.%s", configdir, extension);
+    strcat (configname, extension);
     strcat (SaveName, extension);
     strcat (demoname, extension);
 
diff --git a/wl_play.cpp b/wl_play.cpp
index 7f56b04..e74d849 100644
--- a/wl_play.cpp
+++ b/wl_play.cpp
@@ -1,6 +1,7 @@
 // WL_PLAY.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 #include "wl_cloudsky.h"
 #include "wl_shade.h"
@@ -687,6 +688,8 @@ void CheckKeys (void)
 #endif
            scan == sc_F9 || scan == sc_F7 || scan == sc_F8)     // pop up quit dialog
     {
+        short oldmapon = gamestate.mapon;
+        short oldepisode = gamestate.episode;
         ClearMemory ();
         ClearSplitVWB ();
         US_ControlPanel (scan);
diff --git a/wl_state.cpp b/wl_state.cpp
index 68610c3..1f46a4a 100644
--- a/wl_state.cpp
+++ b/wl_state.cpp
@@ -1,6 +1,7 @@
 // WL_STATE.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 /*
 =============================================================================
diff --git a/wl_text.cpp b/wl_text.cpp
index fcd36d7..a3e2583 100644
--- a/wl_text.cpp
+++ b/wl_text.cpp
@@ -1,6 +1,7 @@
 // WL_TEXT.C
 
 #include "wl_def.h"
+#pragma hdrstop
 
 /*
 =============================================================================

-- 
SDL-Port of Wolfenstein 3-D and Spear of Destiny



More information about the Pkg-games-commits mailing list