From 84d5a221fc8c525974cc6479ec681c4fc80a2ebe Mon Sep 17 00:00:00 2001 From: Leo Reyes Date: Mon, 4 Oct 2021 22:46:17 -0700 Subject: [PATCH] Explosions in the DS2 mission now default to procedural explosions. MechDonald's new explosions are great, but they are also a bit big and long. So, in the DS2 mission, these explosions may obscure the tunnel. In this commit, we check if the mission is the DS2 tunnel, and if so, we remove regular explosions and turn them all into procedural explosions. To turn off this feature, add the following setting to SSAO.cfg: DS2_force_procedural_explosions = 0 Of course, setting it to 1 (or removing it), will enable it again. --- impl11/Materials/dat-2000.mat | 6 ++++-- impl11/Materials/dat-2001.mat | 6 ++++-- impl11/Materials/dat-2002.mat | 6 ++++-- impl11/Materials/dat-2003.mat | 6 ++++-- impl11/Materials/dat-2004.mat | 6 ++++-- impl11/Materials/dat-2005.mat | 6 ++++-- impl11/Materials/dat-2006.mat | 6 ++++-- impl11/ddraw/Direct3DDevice.cpp | 9 ++++++++- impl11/ddraw/Materials.h | 4 +++- impl11/ddraw/VRConfig.cpp | 4 ++++ impl11/ddraw/globals.h | 1 + 11 files changed, 44 insertions(+), 16 deletions(-) diff --git a/impl11/Materials/dat-2000.mat b/impl11/Materials/dat-2000.mat index 73606009..cbc5f269 100644 --- a/impl11/Materials/dat-2000.mat +++ b/impl11/Materials/dat-2000.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 18 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 24 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/Materials/dat-2001.mat b/impl11/Materials/dat-2001.mat index 73606009..e639c29f 100644 --- a/impl11/Materials/dat-2001.mat +++ b/impl11/Materials/dat-2001.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 18 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 21 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/Materials/dat-2002.mat b/impl11/Materials/dat-2002.mat index a03eaa62..2cefeefe 100644 --- a/impl11/Materials/dat-2002.mat +++ b/impl11/Materials/dat-2002.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 21 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 16 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/Materials/dat-2003.mat b/impl11/Materials/dat-2003.mat index a785f003..cbc5f269 100644 --- a/impl11/Materials/dat-2003.mat +++ b/impl11/Materials/dat-2003.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 26 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 24 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/Materials/dat-2004.mat b/impl11/Materials/dat-2004.mat index 764551a8..cbc5f269 100644 --- a/impl11/Materials/dat-2004.mat +++ b/impl11/Materials/dat-2004.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 16 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 24 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/Materials/dat-2005.mat b/impl11/Materials/dat-2005.mat index 73606009..cbc5f269 100644 --- a/impl11/Materials/dat-2005.mat +++ b/impl11/Materials/dat-2005.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 18 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 24 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/Materials/dat-2006.mat b/impl11/Materials/dat-2006.mat index ef90fe2f..0a699a03 100644 --- a/impl11/Materials/dat-2006.mat +++ b/impl11/Materials/dat-2006.mat @@ -1,4 +1,6 @@ [Default] -TotalFrames = 47 -ExplosionBlendMode = 1 +; MechDonald's explosions are great, but for the DSII mission they might be a +; bit long, so here I'm going to use half the frames they actually have +TotalFrames = 27 +ExplosionBlendMode = 0 ExplosionScale = 3.5 \ No newline at end of file diff --git a/impl11/ddraw/Direct3DDevice.cpp b/impl11/ddraw/Direct3DDevice.cpp index 631562eb..d02ecc76 100644 --- a/impl11/ddraw/Direct3DDevice.cpp +++ b/impl11/ddraw/Direct3DDevice.cpp @@ -473,6 +473,8 @@ bool g_bResetDC = false; // DS2 Effects int g_iReactorExplosionCount = 0; +// Replace regular explosions with procedural explosions during the DS2 mission to improve visibility. +bool g_bDS2ForceProceduralExplosions = true; /*********************************************************/ // High Resolution Timers @@ -4514,7 +4516,12 @@ HRESULT Direct3DDevice::Execute( } // Render the procedural explosions - if (bIsExplosion && bHasMaterial && lastTextureSelected->material.ExplosionBlendMode > 0) + if (bIsExplosion && bHasMaterial && + (lastTextureSelected->material.ExplosionBlendMode > 0 || + // The newest explosions by MechDonald are bigger and longer. Unfortunately, during the DS2 mission, this can + // block a lot of visibility in the tunnel. So if we're in the DS2 mission, let's use procedural explosions + // instead. + (g_bDS2ForceProceduralExplosions && *missionIndexLoaded == DEATH_STAR_MISSION_INDEX))) { static float iTime = 0.0f; //iTime += 0.05f; diff --git a/impl11/ddraw/Materials.h b/impl11/ddraw/Materials.h index efd40084..15d209a8 100644 --- a/impl11/ddraw/Materials.h +++ b/impl11/ddraw/Materials.h @@ -347,7 +347,9 @@ typedef struct MaterialStruct { TotalFrames = 0; ExplosionScale = 2.0f; // 2.0f is the original scale ExplosionSpeed = 0.001f; - ExplosionBlendMode = 1; // 0: Original texture, 1: Blend with procedural explosion, 2: Use procedural explosions only + // MechDonald's explosions are so good that we probably want to default to using them + // now (instead of blending them with a procedural explosion) + ExplosionBlendMode = 0; // 0: Original texture, 1: Blend with procedural explosion, 2: Use procedural explosions only DATGroupImageIdParsed = false; GroupId = 0; diff --git a/impl11/ddraw/VRConfig.cpp b/impl11/ddraw/VRConfig.cpp index 391b7415..e68a9126 100644 --- a/impl11/ddraw/VRConfig.cpp +++ b/impl11/ddraw/VRConfig.cpp @@ -2283,6 +2283,10 @@ bool LoadSSAOParams() { if (_stricmp(param, "star_debug_enabled") == 0) { g_bStarDebugEnabled = (bool)fValue; } + + if (_stricmp(param, "DS2_force_procedural_explosions") == 0) { + g_bDS2ForceProceduralExplosions = (bool)fValue; + } } } fclose(file); diff --git a/impl11/ddraw/globals.h b/impl11/ddraw/globals.h index 4d56c995..7489cf46 100644 --- a/impl11/ddraw/globals.h +++ b/impl11/ddraw/globals.h @@ -77,6 +77,7 @@ extern HiResTimer g_HiResTimer; // DS2 Effects extern int g_iReactorExplosionCount; +extern bool g_bDS2ForceProceduralExplosions;