[Merged] Caverns of Darkness (scroller incompatibility)

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Caverns of Darkness (scroller incompatibility)

Post by Graf Zahl »

As everybody probably knows this excellent WAD comes with a shitty customized DOS engine that probably won't run on most modern computers anymore. So today I was in the mood to play it again and I thought that the minor changes could be added without much effort to ZDoom - and I was right. All that was needed are some very minor tweaks to support the two new sector specials. The rest could easily be done with DECORATE.

After half an hour of DECORATE work and these minor changes the game worked perfectly with ZDoom but then I discovered an incompatibility between ZDoom's handling of carrying floors and Boom's (or Eternity's which CoD's engine is based on:

ZDoom averages the speed of scrolling floors so carried objects don't get accelerated on sector boundaries. The problem here is that this breaks CoD's carefully created conveyor belts which require Boom's original behavior.

So here's my entire CoD .diff patch. It adds a MAPINFO flag that restores Boom's original scrolling behavior (thus fixing CoD's conveyor belts) and a second flag that enables the two new sector specials (instant death - identical with Strife's and a healing sector.) in Doom-format maps. Of course the healing sector is also available for Hexen-format maps without need of that little hack.

It would be great if this could be added to ZDoom. After this all that is needed to run CoD is a 17kb WAD with 5 lumps.

Code: Select all

diff -urN .96fresh\src/g_level.cpp .96cod\src/g_level.cpp
--- .96fresh\src/g_level.cpp	Fri Dec 24 21:43:15 2004
+++ .96cod\src/g_level.cpp	Sun Jan 23 11:04:36 2005
@@ -224,6 +224,8 @@
 	"redirect",
 	"strictmonsteractivation",
 	"laxmonsteractivation",
+	"additive_scrollers",
+	"cod_level",
 	NULL
 };
 
@@ -319,6 +321,8 @@
 	{ MITYPE_REDIRECT,	lioffset(RedirectMap), 0 },
 	{ MITYPE_CLRFLAG,	LEVEL_LAXMONSTERACTIVATION, LEVEL_LAXACTIVATIONMAPINFO },
 	{ MITYPE_SETFLAG,	LEVEL_LAXMONSTERACTIVATION, LEVEL_LAXACTIVATIONMAPINFO },
+	{ MITYPE_SETFLAG,	LEVEL_ADDITIVE_SCROLLERS, 0 },
+	{ MITYPE_SETFLAG,	LEVEL_CAVERNS_OF_DARKNESS, 0 },
 };
 
 static const char *MapInfoClusterLevel[] =
diff -urN .96fresh\src/g_level.h .96cod\src/g_level.h
--- .96fresh\src/g_level.h	Fri Dec 24 18:15:23 2004
+++ .96cod\src/g_level.h	Sun Jan 23 11:01:50 2005
@@ -92,6 +92,9 @@
 #define LEVEL_LAXMONSTERACTIVATION	UCONST64(0x400000000)		// Monsters can open doors depending on the door speed
 #define LEVEL_LAXACTIVATIONMAPINFO	UCONST64(0x800000000)		// LEVEL_LAXMONSTERACTIVATION is not a default.
 
+#define LEVEL_ADDITIVE_SCROLLERS	UCONST64(0x1000000000)		// scrollers add their momentum instead of averaging it
+#define LEVEL_CAVERNS_OF_DARKNESS	UCONST64(0x2000000000)		// to translate the special sector types of CoD.
+
 struct acsdefered_s;
 class FBehavior;
 
diff -urN .96fresh\src/p_lnspec.h .96cod\src/p_lnspec.h
--- .96fresh\src/p_lnspec.h	Thu Nov 04 10:22:47 2004
+++ .96cod\src/p_lnspec.h	Sun Jan 23 13:54:55 2005
@@ -346,6 +346,9 @@
 	sDamage_SuperHellslime = 116,
 	Scroll_StrifeCurrent = 118,
 
+	// Caverns of Darkness healing sector
+	Sector_Heal = 196,
+
 	Light_OutdoorLightning = 197,
 	Light_IndoorLightning1 = 198,
 	Light_IndoorLightning2 = 199,
diff -urN .96fresh\src/p_mobj.cpp .96cod\src/p_mobj.cpp
--- .96fresh\src/p_mobj.cpp	Sun Jan 23 10:51:28 2005
+++ .96cod\src/p_mobj.cpp	Sun Jan 23 11:08:43 2005
@@ -2411,13 +2411,18 @@
 			if (scrolly) county++;
 		}
 
-		if (countx > 1)
+		// Some Boom compatible levels don't like this
+		// But it is only important for non-player objects.
+		if (!(level.flags&LEVEL_ADDITIVE_SCROLLERS) && !player)
 		{
-			cummx /= countx;
-		}
-		if (county > 1)
-		{
-			cummy /= county;
+			if (countx > 1)
+			{
+				cummx /= countx;
+			}
+			if (county > 1)
+			{
+				cummy /= county;
+			}
 		}
 		momx += cummx;
 		momy += cummy;
diff -urN .96fresh\src/p_spec.cpp .96cod\src/p_spec.cpp
--- .96fresh\src/p_spec.cpp	Fri Dec 24 16:34:47 2004
+++ .96cod\src/p_spec.cpp	Sun Jan 23 13:54:55 2005
@@ -913,6 +913,11 @@
 	{
 		switch (special)
 		{
+		case Sector_Heal:
+			// CoD's healing sector
+			if (!(level.time&0x1f)) P_GiveBody(player,1);
+			break;
+
 		case Damage_InstantDeath:
 			// Strife's instant death sector
 			P_DamageMobj (player->mo, NULL, NULL, 999, MOD_UNKNOWN);
diff -urN .96fresh\src/p_xlat.cpp .96cod\src/p_xlat.cpp
--- .96fresh\src/p_xlat.cpp	Thu Nov 04 10:23:29 2004
+++ .96cod\src/p_xlat.cpp	Sun Jan 23 11:11:43 2005
@@ -427,6 +427,12 @@
 					return high | (special + 100);
 				}
 			}
+			else if (level.flags&LEVEL_CAVERNS_OF_DARKNESS)
+			{
+				// CoD uses 18 as an instant death sector type and 19 for healing the player
+				if (special == 18) return high | Damage_InstantDeath;
+				if (special == 19) return high | Sector_Heal;
+			}
 			return high | (special + 64);
 		}
 		else if (special < 40)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

And before anybody asks:

I'm playing this thing today and when I'm through and everything works to my satisfaction I'll upload it to the /idgames archives for everyone to enjoy. ;)
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Post by wildweasel »

Graf: It's about friggin' time somebody fixed this WAD. I've been wanting to play it for ages, but I couldn't be bothered to load up the custom Eternity engine that it's based on (because it rarely, if ever, works). Thank you very much for taking the pains upon yourself (what pains?) to fix this.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

And I can tell you: It makes a huge difference to play this with a decent engine. Although there is one big problem with this WAD. In some places the high amount of detail massively interferes with Doom's shitty sprite clipping code resulting in ugly visual artifacts (as you can see in this screenshot:

Image

There is nothing I can do about that though... :(


Still, considering the extent of the changes I had to do I'd really like to see them integrated into ZDoom itself. The scrolling stuff may be necessary for other WADs, too (preferably as a compatibility option), the healing sector would be a nice little addition and the one little MAPINFO flag to make the levels play without change to the WAD itself doesn't matter that much, does it?
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post by randi »

Merged.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49071
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Great. This means that I can replace my current patch which contains an EXE with a WAD only patch soon. :)
Post Reply

Return to “Closed Bugs [GZDoom]”