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): the shadow map replaces the volumes where it is on
Olcay Seygan9d797018beb1
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cppindex b422ff6da..36a0277b2 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp@@ -929,7 +929,22 @@ Int parseShadowMap(char *args[], int num){if (TheWritableGlobalData){+ // The map replaces the volumes rather than joining them: a caster that cast both would cast+ // twice, once hard and once soft, and the hard one would win every argument.TheWritableGlobalData->m_shadowMap = TRUE;+ TheWritableGlobalData->m_shadowMapOnly = TRUE;+ }+ return 1;+}++/* -shadowmapboth: the map and the stencil volumes at once, which is not a picture anybody should+ play with. It exists because the two can only be compared in one frame when both are in it. */+Int parseShadowMapBoth(char *args[], int num)+{+ if (TheWritableGlobalData)+ {+ TheWritableGlobalData->m_shadowMap = TRUE;+ TheWritableGlobalData->m_shadowMapOnly = FALSE;}return 1;}@@ -2188,6 +2203,7 @@ static CommandLineParam params[] ={ "-shadowmap", parseShadowMap },{ "-shadowmapreport", parseShadowMapReport },{ "-shadowmaponly", parseShadowMapOnly },+ { "-shadowmapboth", parseShadowMapBoth },{ "-noparticleshadows", parseNoParticleShadows },{ "-quickstart", parseQuickStart },diff --git a/shadow-check.ps1 b/shadow-check.ps1new file mode 100644index 000000000..3e20a323b--- /dev/null+++ b/shadow-check.ps1@@ -0,0 +1,64 @@+# Photograph the same eight views twice, once with the stencil volumes and once with the shadow+# map, and put the two pictures of each side by side. tree-check.ps1 answers "does this build draw+# what the last one drew"; this answers the other question, which is what the two shadow mechanisms+# make of the same frame. SHADOW-MAP-PLAN.md phase 4.+#+# .\shadow-check.ps1 # eight views, both ways, a sheet at the end+# .\shadow-check.ps1 -Only 3 # one view, while a knob is being turned++param([int]$Only = 0)++Add-Type -AssemblyName System.Drawing+$run = Join-Path $PSScriptRoot "GeneralsMD\Run"+$shots = "$env:USERPROFILE\Documents\Command and Conquer Generals Zero Hour Data"+$out = Join-Path $env:TEMP "shadowcheck"+if (-not (Test-Path $out)) { $null = New-Item -ItemType Directory $out }++# The same views tree-check uses, for the same reason: they are the ones with something in them.+$cases = @(+ @{map='Flash Effect'; x='1200'; y='945'; f=400},+ @{map='Flash Effect'; x='1816'; y='1861'; f=1200},+ @{map='Flash Effect'; x='1378'; y='1384'; f=2400},+ @{map='ForgottenForestZH'; x='1620'; y='1470'; f=600},+ @{map='ForgottenForestZH'; x='1543'; y='1636'; f=1800},+ @{map='Golden Oasis'; x='2643'; y='3580'; f=900},+ @{map='Alpine Assault'; x='760'; y='920'; f=700},+ @{map='Killing Fields'; x='1024'; y='1024'; f=1500}+)++function Shoot($case, $tag, $extra) {+ Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force+ $arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance',+ '-msaa','0','-dx11post','off','-map',"`"Maps\$($case.map)\$($case.map).map`"",+ '-autoskirmish','4','-aidiff','easy','-seed','5','-maxframes',($case.f+80),+ '-screenshot',$case.f,'-camera',$case.x,$case.y,'-logPrefix',"shd_$tag`_")+ if ($extra) { $arguments += $extra }+ try {+ $process = Start-Process (Join-Path $run "generals.exe") -ArgumentList $arguments `+ -WorkingDirectory $run -PassThru+ $null = $process.WaitForExit(900000)+ }+ finally {+ Get-Process -Name generals -ErrorAction SilentlyContinue | Stop-Process -Force+ }+ $bmp = Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue |+ Sort-Object LastWriteTime | Select-Object -Last 1+ if ($null -eq $bmp) { throw "no screenshot for $tag" }+ $image = [System.Drawing.Image]::FromFile($bmp.FullName)+ $path = "$out\$tag.png"+ $image.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)+ $image.Dispose()+ return $path+}++$index = 0+foreach ($case in $cases) {+ $index+++ if ($Only -gt 0 -and $index -ne $Only) { continue }+ $name = "{0:d2}" -f $index+ $volumes = Shoot $case "$name`_volumes" $null+ $map = Shoot $case "$name`_map" @('-shadowmap')+ Write-Host "$name $($case.map) $($case.x),$($case.y): $volumes | $map"+}++Write-Host "pictures in $out"