Skip to content

Commit

Permalink
Explosions in the DS2 mission now default to procedural explosions.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Prof-Butts committed Oct 5, 2021
1 parent 7fbc38a commit 84d5a22
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 16 deletions.
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2000.mat
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2001.mat
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2002.mat
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2003.mat
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2004.mat
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2005.mat
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions impl11/Materials/dat-2006.mat
Original file line number Diff line number Diff line change
@@ -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
9 changes: 8 additions & 1 deletion impl11/ddraw/Direct3DDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion impl11/ddraw/Materials.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions impl11/ddraw/VRConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions impl11/ddraw/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ extern HiResTimer g_HiResTimer;

// DS2 Effects
extern int g_iReactorExplosionCount;
extern bool g_bDS2ForceProceduralExplosions;



Expand Down

0 comments on commit 84d5a22

Please sign in to comment.