Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(w3ddevice): more dynamic lights and scorch marks, distance shake
Olcay Seyganfc316a3cbdb7
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.hindex bf9d0ebc2..074083ffb 100644--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h@@ -43,7 +43,9 @@#include "Common/GameType.h"#include "WorldHeightMap.h"-#define MAX_ENABLED_DYNAMIC_LIGHTS 20+// The lights one terrain relight takes in, the rest dropped. Only the vertex path reads it: the+// Direct3D 11 frame lights the ground per pixel and takes BLAST_LIGHT_SLOTS (32) instead. Was 20.+#define MAX_ENABLED_DYNAMIC_LIGHTS 32typedef UnsignedByte HeightSampleType; //type of data to store in heightmapclass W3DTreeBuffer;class W3DBibBuffer;@@ -251,9 +253,12 @@ protected:Int m_y; ///< dimensions of heightmap#ifdef DO_SCORCH- enum { MAX_SCORCH_VERTEX=32768,- MAX_SCORCH_INDEX=65535,- MAX_SCORCH_MARKS=500,+ // ponytail: one 16-bit buffer pair, so the indices cap the drawn marks at about 680 of radius+ // fifteen whatever MAX_SCORCH_MARKS says (DX8IndexBufferClass counts in an unsigned short); the+ // newest are drawn and the oldest wait in the list. A second buffer pair when that shows.+ enum { MAX_SCORCH_VERTEX=65535,+ MAX_SCORCH_INDEX=65535,+ MAX_SCORCH_MARKS=1000,SCORCH_MARKS_IN_TEXTURE=9,SCORCH_PER_ROW = 3};DX8VertexBufferClass *m_vertexScorch; ///<Scorch vertex buffer.diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cppindex 2a8f17db9..79169e629 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp@@ -1714,8 +1714,13 @@ void W3DView::update(void)m_shakeOffset.x = m_shakeIntensity * m_shakeAngleCos;m_shakeOffset.y = m_shakeIntensity * m_shakeAngleSin;- // fake a stiff spring/damper- const Real dampingCoeff = 0.75f;+ // fake a stiff spring/damper. A big kick settles at EA's rate and what is left of it rumbles+ // on: the damping eases from 0.75 a step at an intensity of two or more to 0.88 near rest, so+ // a heavy blast trails off over about a second instead of stopping dead after half of one.+ const Real HARD_DAMPING = 0.75f;+ const Real TAIL_DAMPING = 0.88f;+ const Real hardness = WWMath::Clamp(m_shakeIntensity * 0.5f, 0.0f, 1.0f);+ const Real dampingCoeff = TAIL_DAMPING + (HARD_DAMPING - TAIL_DAMPING) * hardness;m_shakeIntensity *= dampingCoeff;// spring is so "stiff", it pulls 180 degrees opposite each frame@@ -3982,7 +3987,12 @@ void W3DView::shake( const Coord3D *epicenter, CameraShakeType shakeType )if (dist > TheGlobalData->m_maxShakeRange)return;- intensity *= 1.0f - (dist/TheGlobalData->m_maxShakeRange);+ // A square of the remaining distance rather than a straight line, and half as much again at the+ // epicentre: a shell landing under the camera kicks it hard, one at the edge of the range barely+ // moves it. The two meet the old line at about a third of the range.+ const Real SHAKE_NEAR_BOOST = 1.5f;+ const Real nearness = 1.0f - (dist/TheGlobalData->m_maxShakeRange);+ intensity *= SHAKE_NEAR_BOOST * nearness * nearness;// add intensity and clampm_shakeIntensity += intensity;