shithub: wl3d

Download patch

ref: 3537473ee848597fc6fe8ecd1ef8bcde939ae187
parent: 3891487cd9fb5088d99344d33cf4e37e0abf7f9b
author: Konstantinn Bonnet <[email protected]>
date: Fri Mar 25 22:26:47 EDT 2016

use ver for versioning, ext only for filenames

--- a/fs.c
+++ b/fs.c
@@ -4,7 +4,6 @@
 #include "dat.h"
 #include "fns.h"
 
-int ver;
 u32int *pal, pals[Cend][256]={ {
 	0x000000, 0x0000aa, 0x00aa00, 0x00aaaa, 0xaa0000, 0xaa00aa, 0xaa5500,
 	0xaaaaaa, 0x555555, 0x5555ff, 0x55ff55, 0x55ffff, 0xff5555, 0xff55ff,
@@ -911,19 +910,6 @@
 	Bterm(dat);
 }
 
-static void
-version(void)
-{
-	if(strcmp(ext, "wl6") == 0)
-		ver = WL6;
-	else if(strcmp(ext, "wl1") == 0)
-		ver = WL1;
-	else if(strcmp(ext, "sdm") == 0)
-		ver = SDM;
-	else
-		ver = SOD;
-}
-
 void
 dat(char *dir)
 {
@@ -930,7 +916,6 @@
 	rfork(RFNAMEG);
 	if(bind(".", dir, MBEFORE|MCREATE) < 0 || chdir(dir) < 0)
 		fprint(2, "dat: %r\n");
-	version();
 	vswap();
 	gamemaps();
 	if(ver == SOD)
--- a/wl3d.c
+++ b/wl3d.c
@@ -9,6 +9,7 @@
 
 mainstacksize = 16*1024;
 char *ext = "wl6";
+int ver;
 int grabon;
 int cson, kbon, mson;
 int (*step)(void);
@@ -224,13 +225,13 @@
 	n = 0;
 	step = mstep;
 	ARGBEGIN{
-	case '2': ext = "sd2"; break;
-	case '3': ext = "sd3"; break;
-	case 'd': ext = "wl1"; break;
+	case '2': ext = "sd2"; ver = SOD; break;
+	case '3': ext = "sd3"; ver = SOD; break;
+	case 'd': ext = "wl1"; ver = WL1; break;
 	case 'i': n++; break;
 	case 'm': datdir = EARGF(usage()); break;
-	case 'o': ext = "sdm"; break;
-	case 's': ext = "sod"; break;
+	case 'o': ext = "sdm"; ver = SDM; break;
+	case 's': ext = "sod"; ver = SOD; break;
 	case 'w': /* TODO: warp to ep, level */ break;
 	case 'x': /* TODO: set difficulty for warp */ break;
 	default: