shithub: hexen

Download patch

ref: e07e07242c04919d40513ffe14f5f1a94ce0b412
parent: ef1ba7ed5da0ddfd59b1b6d828c44db598dcca4f
author: Jacob Moody <[email protected]>
date: Sun Jan 22 04:18:49 EST 2023

use the right names and directories

--- a/h2_main.c
+++ b/h2_main.c
@@ -16,6 +16,7 @@
 #include "p_local.h"
 #include "soundst.h"
 #include "v_compat.h"
+#include "i_system.h"
 
 // MACROS ------------------------------------------------------------------
 
@@ -112,6 +113,8 @@
 static int pagetic;
 static const char *pagename;
 
+static char basedefault[1024];
+
 static const char *wadfiles[MAXWADFILES + 1] =
 {
 	"hexen.wad",
@@ -184,7 +187,9 @@
 
 void H2_Main(void)
 {
-	int p;
+	int p, i;
+	char *slash;
+	char *wadloc[nelem(wadfiles)];
 
 	M_FindResponseFile();
 	setbuf(stdout, NULL);
@@ -200,17 +205,31 @@
 	ST_Message("V_Init: allocate screens.\n");
 	V_Init();
 
-	// Load defaults before initing other systems
-	ST_Message("M_LoadDefaults: Load system defaults.\n");
-	M_LoadDefaults(CONFIG_FILE_NAME);
-
 	// HEXEN MODIFICATION:
 	// There is a realloc() in W_AddFile() that might fail if the zone
 	// heap has been previously allocated, so we need to initialize the
 	// WAD files BEFORE the zone memory initialization.
 	ST_Message("W_Init: Init WADfiles.\n");
-	W_InitMultipleFiles(wadfiles);
+	for(i = 0; i < nelem(wadfiles); i++){
+		if(wadfiles[i] == nil){
+			wadloc[i] = nil;
+			break;
+		} else
+			wadloc[i] = I_IdentifyWAD(wadfiles[i]);
+	}
+	W_InitMultipleFiles(wadloc);
 	W_CheckWADFiles();
+
+	strncpy(basedefault, wadloc[0], sizeof(basedefault)-5);
+	basedefault[sizeof(basedefault)-5] = '\0';
+	slash = strrchr(basedefault, '/');
+	if (slash++ == 0)
+		slash = basedefault;
+	strcpy(slash, "cfg");
+
+	// Load defaults before initing other systems
+	ST_Message("M_LoadDefaults: Load system defaults.\n");
+	M_LoadDefaults(basedefault);
 
 	ST_Message("Z_Init: Init zone memory allocation daemon.\n");
 	Z_Init();
--- a/i_system.c
+++ b/i_system.c
@@ -126,7 +126,7 @@
 		return path;
 
 	if(home = getenv("home")){
-		snprintf(path, sizeof path, "%s/lib/doom/%s", home, wadname);
+		snprintf(path, sizeof path, "%s/lib/hexen/%s", home, wadname);
 		free(home);
 
 		if (I_FileExists (path))
@@ -133,11 +133,11 @@
 			return path;
 	}
 
-	snprintf(path, sizeof path, "/sys/lib/doom/%s", wadname);
+	snprintf(path, sizeof path, "/sys/lib/hexen/%s", wadname);
 	if (I_FileExists (path))
 		return path;
 
-	snprintf(path, sizeof path, "/sys/games/lib/doom/%s", wadname);
+	snprintf(path, sizeof path, "/sys/games/lib/hexen/%s", wadname);
 	if (I_FileExists (path))
 		return path;
 
--- a/i_video.c
+++ b/i_video.c
@@ -43,7 +43,7 @@
 
 	notify(catch);
 
-	if(initdraw(nil, nil, "doom") < 0)
+	if(initdraw(nil, nil, "hexen") < 0)
 		I_Error("I_InitGraphics failed");
 
 	draw(screen, screen->r, display->black, nil, ZP);
@@ -209,7 +209,6 @@
 	static char nocurs[2*4+2*2*16];
 	static int fd = -1;
 
-	/*
 	if(mouseactive == on || !usemouse)
 		return;
 	if(mouseactive = on){
@@ -220,7 +219,6 @@
 		close(fd);
 		fd = -1;
 	}
-	*/
 }
 
 void I_ReadScreen(byte *scr)