From 33e795de9b9f1aade7eef1fc947db5ed8fc0ca2d Mon Sep 17 00:00:00 2001
From: Ian Curtis <i.curtis@gmail.com>
Date: Sat, 8 Oct 2016 15:15:25 +0000
Subject: [PATCH] Fix scenes with missing fog in ocean hunter. The game was
 passing negative fog densities. The sign seems to be ignored by the model 3.

---
 Src/Graphics/New3D/New3D.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp
index 953102a..b4cff02 100644
--- a/Src/Graphics/New3D/New3D.cpp
+++ b/Src/Graphics/New3D/New3D.cpp
@@ -732,7 +732,7 @@ void CNew3D::RenderViewport(UINT32 addr)
 		vp->fogParams[0] = (float)((vpnode[0x22] >> 16) & 0xFF) * (1.0f / 255.0f);	// fog color R
 		vp->fogParams[1] = (float)((vpnode[0x22] >> 8) & 0xFF) * (1.0f / 255.0f);	// fog color G
 		vp->fogParams[2] = (float)((vpnode[0x22] >> 0) & 0xFF) * (1.0f / 255.0f);	// fog color B
-		vp->fogParams[3] = *(float *)&vpnode[0x23];									// fog density
+		vp->fogParams[3] = std::abs(*(float *)&vpnode[0x23]);						// fog density	- ocean hunter uses negative values, but looks the same
 		vp->fogParams[4] = (float)(INT16)(vpnode[0x25] & 0xFFFF)*(1.0f / 255.0f);	// fog start
 
 		{
@@ -759,6 +759,8 @@ void CNew3D::RenderViewport(UINT32 addr)
 		float scrollFog = (float)(vpnode[0x20] & 0xFF) * (1.0f / 255.0f);	// scroll fog
 		float scrollAtt = (float)(vpnode[0x24] & 0xFF) * (1.0f / 255.0f);	// scroll attenuation
 
+		printf("scroll fog scroll %f attentioatn %f ---- %f %f %f %f\n", scrollFog, scrollAtt, vp->fogParams[0], vp->fogParams[1], vp->fogParams[2], vp->fogParams[3], vp->fogParams[4]);
+
 		// Clear texture offsets before proceeding
 		m_nodeAttribs.Reset();