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(data): china mine fields draw steel mines with a blinking light
Olcay Seygandea2aedec2a9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f5fa2c8c3..5b3227872 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1373,6 +1373,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- An explosion lights everything around it, smoothly. On the default renderer the light of a blast reaches every tank, soldier, building and patch of ground it can see, fading out with distance, where the ground used to brighten in blocky squares and a model took only four lights at once, so in a big fight half the tanks next to a burning wreck stayed dark. The 32 blasts nearest the camera light at the same time, and a wall with its back to the fire stays in shadow. The light brightens what it falls on by three quarters at most: a nuke's took the ground to white within a few frames until it was held there.- A bright cloud no longer shows what is behind it as a line drawing. Inside a nuke's white cloud, or a falling War Factory's fireball, every tree and wreck under it used to come out as a thin grey outline, and the picture's sharpening ringed each dark piece in white. Both stop where the frame is bright.- Smoke and fire no longer end on a straight line where they meet the ground or a building. A puff that sinks into a hillside or drifts against a wall thins out over its last few metres, softly enough that a nuke's haze and a Scud's grey smoke no longer come out as stacked, stair-stepped terraces, and a toxin cloud lying low over the ground keeps its body instead of breaking into hard-edged green islands. A China mine field blinks where you can see it again: its lights hang just off the ground, and the fade had eaten all but a thirtieth of their bright middle. No effect fades over more than its own size now, so a small spark close to the ground keeps its light. This is the default renderer; Classic and the old renderer keep the hard edge they had in 2003.+- A China mine field has mines in it. EA's field had no model at all, only a white glint blinking on each of its eight spots, so your own minefield looked like a patch of fireflies. Each spot is now a round steel mine pressed into a ring of dug earth, at a random turn, with a small red light blinking over its fuse, violet on EMP mines. You and your allies see them a little see-through, the way you see your own stealthed units. The enemy still sees nothing until he detects the field, and then he sees the same mines. What a mine does is unchanged.- Effects fade out instead of blinking off. The rings a nuke sends across the ground, and any spark, flash or puff whose own colours never reached nothing, used to vanish at full strength on their last frame. Each one now dims away over its last quarter of a second, or over a quarter of its life when it lives shorter than that. One that was already fading looks the way it always did.- Toxin, anthrax and radiation pools lie on the ground. A pool is a carpet of puddle pictures spread up to 140 paces from where the shell or the spray came down, and every one of them was drawn dead flat at the height of that one spot: on a hillside the uphill half of the pool disappeared into the slope and the downhill half hung in the air above it. Each puddle now bends over the ground underneath it, on both renderers, and a pool on a bridge stays on the deck. The pool also holds still. It used to throb twice a second, because every half second the pool's poison fired a fresh batch of puddles that swelled out of black to full green and back to black in two seconds, each batch somewhere new. Now it comes up in half a second, stays one pool at full colour for as long as it does damage, and fades over its last three seconds, or over three seconds from the moment the fog of war closes over it. It is not frozen, though: each puddle fades down and back up on its own beat, so the surface shimmers like something liquid while the pool as a whole never pulses. Four Scud warheads landing on one spot used to stack into a white-hot blotch in the middle; overlapping pools now share their light and the middle stays toxin green. The ground under it takes on its colour, green for toxin and the anthrax colours for anthrax, so it looks spilled rather than shone onto the grass. China's radiation keeps its orange but glows instead of browning the grass, which made it look like a scorch mark, and small bubbles swell out of it and pop. A nuke's radiation lies on the hillside as a pool from three seconds after the blast, where its first ten seconds used to be flat squares cutting into the slope.- A Scud Storm or a carpet bomb shakes the screen as hard as it should. The game cut a pile of heavy shakes back to a mild one, so a run of missiles or bombs landing together shook less than one of them alone. Each now shakes a step lighter and the run builds up. Demo traps and Aurora bombs shake now, and a falling building shakes harder the bigger it was.diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifestindex 39ee5886f..5df5fb3a3 100644--- a/GeneralsMD/Code/BuildFingerprint.manifest+++ b/GeneralsMD/Code/BuildFingerprint.manifest@@ -10,6 +10,7 @@ Data/Art/Textures/ReforgedBarGLACenter.tgaData/Art/Textures/ReforgedBarGLALeft.tgaData/Art/Textures/ReforgedBarGLARight.tgaData/Art/Textures/ReforgedLaserPink.tga+Data/Art/Textures/ReforgedMine.tgaData/Art/Textures/ReforgedOrders.tgaData/Art/Textures/ReforgedSignalAttack.tgaData/Art/Textures/ReforgedSignalDefend.tga@@ -38,6 +39,9 @@ Data/Cinema/lsv_burst.txtData/Cinema/lsv_laser.txtData/Cinema/lsv_spam.txtData/Cinema/lsv_spam2.txt+Data/Cinema/minefx.txt+Data/Cinema/minefx_scene.txt+Data/Cinema/minefx_scene_enemy.txtData/Cinema/missileapex_film.txtData/Cinema/mobwatch.txtData/Cinema/nohud.txt@@ -179,6 +183,9 @@ Data/Scenarios/mappers.txtData/Scenarios/mass420x2.txtData/Scenarios/mass840.txtData/Scenarios/massmove.txt+Data/Scenarios/minefx.txt+Data/Scenarios/minefx_scene.txt+Data/Scenarios/minefx_scene_enemy.txtData/Scenarios/missileapex.txtData/Scenarios/missileapex_film.txtData/Scenarios/missiledefence.txt@@ -3911,6 +3918,7 @@ Tools/matchbot/wnet/tcp.cppTools/matchbot/wnet/tcp.hTools/matchbot/wnet/udp.cppTools/matchbot/wnet/udp.h+Tools/mine_marks.pyTools/net-check.shTools/net_check.pyTools/optionsmenu_layout.pydiff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tganew file mode 100644index 000000000..5946b88edBinary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tga differdiff --git a/GeneralsMD/Code/Data/Cinema/minefx_scene.txt b/GeneralsMD/Code/Data/Cinema/minefx_scene.txtnew file mode 100644index 000000000..4f1fe47b1--- /dev/null+++ b/GeneralsMD/Code/Data/Cinema/minefx_scene.txt@@ -0,0 +1,24 @@+# Scenarios/minefx_scene.txt on Alpine Assault: the China mine field round 760,900 with the+# outpost's own traffic crossing it, then the American column walking into it.+# Stills 4 to 13 s (three per framing, 0.6 s apart, so one catches the blink), footage from 13 s.++0 hud off+# close on the east half of the field (the EMP mine at 820,900), the Red Guard walking west through it+3.5 cut 850 880 0.17 -45 12+4.5 shot+5.1 shot+5.7 shot+# close on the middle of the field as the Red Guard reach it+6.5 cut 780 885 0.17 -45 12+7.5 shot+8.1 shot+8.7 shot+# play distance: the game's own zoom and tilt+9.5 cut 780 910 1.0 -45 0+10.5 shot+11.1 shot+11.7 shot+# footage: medium, the field in the middle, the street the column comes down above it+12.5 cut 790 920 0.42 -45 14+13.0 orbit 20 12+25.5 enddiff --git a/GeneralsMD/Code/Data/Cinema/minefx_scene_enemy.txt b/GeneralsMD/Code/Data/Cinema/minefx_scene_enemy.txtnew file mode 100644index 000000000..6bca1636d--- /dev/null+++ b/GeneralsMD/Code/Data/Cinema/minefx_scene_enemy.txt@@ -0,0 +1,12 @@+# Scenarios/minefx_scene_enemy.txt: the American column's own view of the China mine field it is+# driving into. The framing is minefx_scene's footage hold, so these stills pair with its frames.++0 hud off+12.5 cut 790 920 0.42 -45 14+13.5 shot+14.5 shot+15.5 shot+16.0 cut 830 905 0.15 -45 10+16.6 shot+17.2 shot+18.0 enddiff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.iniindex f057daeb9..a1752e722 100644--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini@@ -3397,3 +3397,241 @@ ParticleSystem NukeRadiationInitialWindPingPongEndAngleMin = 5.497787WindPingPongEndAngleMax = 6.283185End++; China's mine fields. EXAMineGroup has eight mine bones and no mesh at all, so EA's field was a+; white lens flare blinking on each bone every second and a half and nothing else. MineFX and+; MineFXPurple are the mines themselves now: ReforgedMine.tga (Tools/mine_marks.py), a steel plate+; in a ring of dug earth six and a half across, laid flat on the bone at a random turn, with a light+; about five across (the slave's Size scales the plate's) that blinks above its middle,+; red on the standard and cluster mines and blue-violet on the EMP mines. At five across with a light+; under two, the plate was a grey speck among the ballast at play zoom and the blink was lost.+;+; The systems hang off the field's model, so they keep its stealth: the owner and his allies see+; them, an enemy only while the field is detected. A plate lives two seconds and the next is laid+; under it eight frames before it goes, rising while the old one fades out, and the light blinks+; with each new plate. At 85 percent opacity the steel still lets a little ground through, a hint of+; the stealth look a friendly stealthed unit has; three quarters looked pale on rail ballast.++ParticleSystem MineFXLight+ Priority = ALWAYS_RENDER+ IsOneShot = No+ Shader = ADDITIVE+ Type = PARTICLE+ ParticleName = EXLnzFlar6.tga+ AngleZ = 0.00 0.00+ AngularRateZ = 0.00 0.00+ AngularDamping = 1.00 1.00+ VelocityDamping = 1.00 1.00+ Gravity = 0.00+ Lifetime = 24.00 24.00+ SystemLifetime = 0+ Size = 0.80 0.80+ StartSizeRate = 0.00 0.00+ SizeRate = 0.00 0.00+ SizeRateDamping = 1.00 1.00+ Alpha1 = 1.00 1.00 0+ Alpha2 = 0.00 0.00 0+ Alpha3 = 0.00 0.00 0+ Alpha4 = 0.00 0.00 0+ Alpha5 = 0.00 0.00 0+ Alpha6 = 0.00 0.00 0+ Alpha7 = 0.00 0.00 0+ Alpha8 = 0.00 0.00 0+ Color1 = R:255 G:40 B:20 0+ Color2 = R:255 G:40 B:20 12+ Color3 = R:0 G:0 B:0 24+ Color4 = R:0 G:0 B:0 0+ Color5 = R:0 G:0 B:0 0+ Color6 = R:0 G:0 B:0 0+ Color7 = R:0 G:0 B:0 0+ Color8 = R:0 G:0 B:0 0+ ColorScale = 0.00 0.00+ BurstDelay = 52.00 52.00+ BurstCount = 1.00 1.00+ InitialDelay = 0.00 0.00+ DriftVelocity = X:0.00 Y:0.00 Z:0.00+ VelocityType = OUTWARD+ VelOutward = 0.00 0.00+ VelOutwardOther = 0.00 0.00+ VolumeType = POINT+ IsHollow = No+ IsGroundAligned = No+ IsEmitAboveGroundOnly = No+ IsParticleUpTowardsEmitter = No+ WindMotion = Unused+ WindAngleChangeMin = 0.149924+ WindAngleChangeMax = 0.449946+ WindPingPongStartAngleMin = 0.000000+ WindPingPongStartAngleMax = 0.785398+ WindPingPongEndAngleMin = 5.497787+ WindPingPongEndAngleMax = 6.283185+End++ParticleSystem MineFXLightPurple+ Priority = ALWAYS_RENDER+ IsOneShot = No+ Shader = ADDITIVE+ Type = PARTICLE+ ParticleName = EXLnzFlar6.tga+ AngleZ = 0.00 0.00+ AngularRateZ = 0.00 0.00+ AngularDamping = 1.00 1.00+ VelocityDamping = 1.00 1.00+ Gravity = 0.00+ Lifetime = 24.00 24.00+ SystemLifetime = 0+ Size = 0.80 0.80+ StartSizeRate = 0.00 0.00+ SizeRate = 0.00 0.00+ SizeRateDamping = 1.00 1.00+ Alpha1 = 1.00 1.00 0+ Alpha2 = 0.00 0.00 0+ Alpha3 = 0.00 0.00 0+ Alpha4 = 0.00 0.00 0+ Alpha5 = 0.00 0.00 0+ Alpha6 = 0.00 0.00 0+ Alpha7 = 0.00 0.00 0+ Alpha8 = 0.00 0.00 0+ Color1 = R:140 G:90 B:255 0+ Color2 = R:140 G:90 B:255 12+ Color3 = R:0 G:0 B:0 24+ Color4 = R:0 G:0 B:0 0+ Color5 = R:0 G:0 B:0 0+ Color6 = R:0 G:0 B:0 0+ Color7 = R:0 G:0 B:0 0+ Color8 = R:0 G:0 B:0 0+ ColorScale = 0.00 0.00+ BurstDelay = 52.00 52.00+ BurstCount = 1.00 1.00+ InitialDelay = 0.00 0.00+ DriftVelocity = X:0.00 Y:0.00 Z:0.00+ VelocityType = OUTWARD+ VelOutward = 0.00 0.00+ VelOutwardOther = 0.00 0.00+ VolumeType = POINT+ IsHollow = No+ IsGroundAligned = No+ IsEmitAboveGroundOnly = No+ IsParticleUpTowardsEmitter = No+ WindMotion = Unused+ WindAngleChangeMin = 0.149924+ WindAngleChangeMax = 0.449946+ WindPingPongStartAngleMin = 0.000000+ WindPingPongStartAngleMax = 0.785398+ WindPingPongEndAngleMin = 5.497787+ WindPingPongEndAngleMax = 6.283185+End++ParticleSystem MineFX+ Priority = ALWAYS_RENDER+ IsOneShot = No+ Shader = ALPHA+ Type = PARTICLE+ ParticleName = ReforgedMine.tga+ AngleZ = 0.00 6.28+ AngularRateZ = 0.00 0.00+ AngularDamping = 1.00 1.00+ VelocityDamping = 1.00 1.00+ Gravity = 0.00+ Lifetime = 60.00 60.00+ SystemLifetime = 0+ Size = 6.50 6.50+ StartSizeRate = 0.00 0.00+ SizeRate = 0.00 0.00+ SizeRateDamping = 1.00 1.00+ Alpha1 = 0.00 0.00 0+ Alpha2 = 0.85 0.85 8+ Alpha3 = 0.85 0.85 60+ Alpha4 = 0.00 0.00 0+ Alpha5 = 0.00 0.00 0+ Alpha6 = 0.00 0.00 0+ Alpha7 = 0.00 0.00 0+ Alpha8 = 0.00 0.00 0+ Color1 = R:255 G:255 B:255 0+ Color2 = R:255 G:255 B:255 60+ Color3 = R:0 G:0 B:0 0+ Color4 = R:0 G:0 B:0 0+ Color5 = R:0 G:0 B:0 0+ Color6 = R:0 G:0 B:0 0+ Color7 = R:0 G:0 B:0 0+ Color8 = R:0 G:0 B:0 0+ ColorScale = 0.00 0.00+ BurstDelay = 52.00 52.00+ BurstCount = 1.00 1.00+ InitialDelay = 0.00 52.00+ DriftVelocity = X:0.00 Y:0.00 Z:0.00+ VelocityType = OUTWARD+ VelOutward = 0.00 0.00+ VelOutwardOther = 0.00 0.00+ VolumeType = POINT+ IsHollow = No+ IsGroundAligned = Yes+ IsEmitAboveGroundOnly = No+ IsParticleUpTowardsEmitter = No+ WindMotion = Unused+ WindAngleChangeMin = 0.149924+ WindAngleChangeMax = 0.449946+ WindPingPongStartAngleMin = 0.000000+ WindPingPongStartAngleMax = 0.785398+ WindPingPongEndAngleMin = 5.497787+ WindPingPongEndAngleMax = 6.283185+ SlaveSystem = MineFXLight+ SlavePosOffset = X:0.00 Y:0.00 Z:0.60+End++ParticleSystem MineFXPurple+ Priority = ALWAYS_RENDER+ IsOneShot = No+ Shader = ALPHA+ Type = PARTICLE+ ParticleName = ReforgedMine.tga+ AngleZ = 0.00 6.28+ AngularRateZ = 0.00 0.00+ AngularDamping = 1.00 1.00+ VelocityDamping = 1.00 1.00+ Gravity = 0.00+ Lifetime = 60.00 60.00+ SystemLifetime = 0+ Size = 6.50 6.50+ StartSizeRate = 0.00 0.00+ SizeRate = 0.00 0.00+ SizeRateDamping = 1.00 1.00+ Alpha1 = 0.00 0.00 0+ Alpha2 = 0.85 0.85 8+ Alpha3 = 0.85 0.85 60+ Alpha4 = 0.00 0.00 0+ Alpha5 = 0.00 0.00 0+ Alpha6 = 0.00 0.00 0+ Alpha7 = 0.00 0.00 0+ Alpha8 = 0.00 0.00 0+ Color1 = R:255 G:255 B:255 0+ Color2 = R:255 G:255 B:255 60+ Color3 = R:0 G:0 B:0 0+ Color4 = R:0 G:0 B:0 0+ Color5 = R:0 G:0 B:0 0+ Color6 = R:0 G:0 B:0 0+ Color7 = R:0 G:0 B:0 0+ Color8 = R:0 G:0 B:0 0+ ColorScale = 0.00 0.00+ BurstDelay = 52.00 52.00+ BurstCount = 1.00 1.00+ InitialDelay = 0.00 52.00+ DriftVelocity = X:0.00 Y:0.00 Z:0.00+ VelocityType = OUTWARD+ VelOutward = 0.00 0.00+ VelOutwardOther = 0.00 0.00+ VolumeType = POINT+ IsHollow = No+ IsGroundAligned = Yes+ IsEmitAboveGroundOnly = No+ IsParticleUpTowardsEmitter = No+ WindMotion = Unused+ WindAngleChangeMin = 0.149924+ WindAngleChangeMax = 0.449946+ WindPingPongStartAngleMin = 0.000000+ WindPingPongStartAngleMax = 0.785398+ WindPingPongEndAngleMin = 5.497787+ WindPingPongEndAngleMax = 6.283185+ SlaveSystem = MineFXLightPurple+ SlavePosOffset = X:0.00 Y:0.00 Z:0.60+Enddiff --git a/GeneralsMD/Code/Data/Scenarios/minefx_scene.txt b/GeneralsMD/Code/Data/Scenarios/minefx_scene.txtnew file mode 100644index 000000000..c6c97012b--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/minefx_scene.txt@@ -0,0 +1,43 @@+# The China mine field as a match scene on Alpine Assault (the MineFX bodies and blink): a small+# Chinese outpost in the rail yard round 760,900 with four mine fields in front of it, its own+# armour and infantry driving through the field, and an American column coming down the town+# street from 1150,1150 that walks into it. Seat 0 owns the mines; minefx_scene_enemy.txt is the+# same scene with the seats swapped, so the local player is the one walking in.+#+# generals.exe -win -borderless -xres 1280 -yres 720 -quickstart -noshellmap -multiInstance+# -fps 120 -noFPSLimit -particlecap 2500 -map "Maps\Alpine Assault\Alpine Assault.map"+# -autoskirmish 2 -takeover -side 0 FactionChina -side 1 FactionAmerica -seed 1+# -scenario minefx_scene -cinema minefx_scene -video 390 750 minefx_scene -maxframes 760++# the outpost+30 spawn 0 ChinaPowerPlant 1 620 780+30 spawn 0 ChinaBarracks 1 900 770+30 spawn 0 ChinaBunker 1 880 1000+30 spawn 0 ChinaGattlingCannon 1 1000 1060++# the field+30 spawn 0 ChinaStandardMine 1 700 900+30 spawn 0 ChinaEMPMine 1 820 900+30 spawn 0 ChinaStandardMine 1 760 860+30 spawn 0 ChinaEMPMine 1 760 940++# own traffic through the field, both ways+30 spawn 0 ChinaTankBattleMaster 3 1040 900 28+30 spawn 0 ChinaInfantryRedguard 6 960 860 14+30 spawn 0 ChinaVehicleSupplyTruck 1 980 960+40 move 0 ChinaTankBattleMaster 660 880+40 move 0 ChinaInfantryRedguard 600 880+40 move 0 ChinaVehicleSupplyTruck 620 940+330 attackmove 0 ChinaTankBattleMaster 900 950+330 move 0 ChinaVehicleSupplyTruck 980 940++# the American column down the street into the field+260 spawn 1 AmericaTankCrusader 4 1200 1160 30+260 spawn 1 AmericaVehicleHumvee 2 1240 1240 30+270 move 1 AmericaTankCrusader 700 880+270 move 1 AmericaVehicleHumvee 700 880+270 arrive 1 AmericaTankCrusader 760 900 90+30 tally 0 ChinaStandardMine+30 tally 0 ChinaEMPMine+750 tally 0 ChinaStandardMine+750 tally 0 ChinaEMPMinediff --git a/GeneralsMD/Code/Data/Scenarios/minefx_scene_enemy.txt b/GeneralsMD/Code/Data/Scenarios/minefx_scene_enemy.txtnew file mode 100644index 000000000..9b6e9bcac--- /dev/null+++ b/GeneralsMD/Code/Data/Scenarios/minefx_scene_enemy.txt@@ -0,0 +1,37 @@+# minefx_scene.txt with the seats swapped: China and its mine field are seat 1, the American column+# is seat 0 and the local player, with no detector. The field's mines and lights must not draw for+# it until a mine goes off. Same frames as minefx_scene, so a still here pairs with the owner's+# footage frame for frame.+#+# generals.exe -win -borderless -xres 1280 -yres 720 -quickstart -noshellmap -multiInstance+# -fps 120 -noFPSLimit -particlecap 2500 -map "Maps\Alpine Assault\Alpine Assault.map"+# -autoskirmish 2 -takeover -side 0 FactionAmerica -side 1 FactionChina -seed 1+# -scenario minefx_scene_enemy -cinema minefx_scene_enemy -maxframes 560++30 spawn 1 ChinaPowerPlant 1 620 780+30 spawn 1 ChinaBarracks 1 900 770+30 spawn 1 ChinaBunker 1 880 1000+30 spawn 1 ChinaGattlingCannon 1 1000 1060++30 spawn 1 ChinaStandardMine 1 700 900+30 spawn 1 ChinaEMPMine 1 820 900+30 spawn 1 ChinaStandardMine 1 760 860+30 spawn 1 ChinaEMPMine 1 760 940++30 spawn 1 ChinaTankBattleMaster 3 1040 900 28+30 spawn 1 ChinaInfantryRedguard 6 960 860 14+30 spawn 1 ChinaVehicleSupplyTruck 1 980 960+40 move 1 ChinaTankBattleMaster 660 880+40 move 1 ChinaInfantryRedguard 600 880+40 move 1 ChinaVehicleSupplyTruck 620 940+330 attackmove 1 ChinaTankBattleMaster 900 950+330 move 1 ChinaVehicleSupplyTruck 980 940++260 spawn 0 AmericaTankCrusader 4 1200 1160 30+260 spawn 0 AmericaVehicleHumvee 2 1240 1240 30+270 move 0 AmericaTankCrusader 700 880+270 move 0 AmericaVehicleHumvee 700 880+30 tally 1 ChinaStandardMine+30 tally 1 ChinaEMPMine+550 tally 1 ChinaStandardMine+550 tally 1 ChinaEMPMinediff --git a/GeneralsMD/Code/Tools/mine_marks.py b/GeneralsMD/Code/Tools/mine_marks.pynew file mode 100644index 000000000..26d2a623c--- /dev/null+++ b/GeneralsMD/Code/Tools/mine_marks.py@@ -0,0 +1,85 @@+"""The picture a China mine is drawn with: a round steel pressure mine seen from above, sunk in a ring+of disturbed earth. The game lays it flat on the ground at each of a mine field's eight mine bones+(ParticleSystemReforged.ini, MineFX and MineFXPurple), so it is shaded here once, lit from the top+left, and the soil ring fades out into whatever ground it lands on.++ python Tools/mine_marks.py # writes Data/Art/Textures/ReforgedMine.tga++Drawn four times too big and brought down, which is the antialiasing."""+import math+import os+import random+import sys++from PIL import Image++DRAWN = 512+SHIPPED = 128+CENTRE = (DRAWN - 1) / 2.0+LIGHT = (-0.45, -0.55, 0.70) # towards the light: up and to the left in the picture, mostly overhead+STEEL = (64, 68, 54) # olive drab, darker than grey ballast so the plate stands off it+SOIL = (40, 32, 22)+SOIL_ALPHA = 0.7+PLATE = 0.70 # radius of the steel, as a share of the half width+SOIL_OUT = 0.98+BOLTS = 0.55+OUT_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures")+++def ramp(edge0, edge1, x):+ t = min(1.0, max(0.0, (x - edge0) / (edge1 - edge0)))+ return t * t * (3.0 - 2.0 * t)+++def height(x, y):+ """The steel's height at a point in half widths: a bevelled rim, a flat top with a groove, a raised+ pressure cap in the middle and four bolt heads."""+ r = math.hypot(x, y)+ h = 1.0 - ramp(PLATE - 0.08, PLATE, r) # rim bevel down to the soil+ h -= 0.25 * (ramp(0.40, 0.42, r) - ramp(0.45, 0.47, r)) # groove round the top+ h += 0.35 * (1.0 - ramp(0.20, 0.25, r)) # pressure cap+ for k in range(4):+ angle = math.radians(45 + 90 * k)+ d = math.hypot(x - BOLTS * math.cos(angle), y - BOLTS * math.sin(angle))+ h += 0.18 * (1.0 - ramp(0.02, 0.045, d))+ return h+++def main():+ out_folder = sys.argv[1] if len(sys.argv) > 1 else OUT_FOLDER+ length = math.sqrt(sum(c * c for c in LIGHT))+ light = [c / length for c in LIGHT]+ grit = random.Random(7)+ step = 2.0 / DRAWN+ image = Image.new("RGBA", (DRAWN, DRAWN))+ pixels = image.load()+ for py in range(DRAWN):+ y = (py - CENTRE) / CENTRE+ for px in range(DRAWN):+ x = (px - CENTRE) / CENTRE+ r = math.hypot(x, y)+ noise = grit.uniform(-1.0, 1.0)+ if r < PLATE:+ # slope over eight drawn pixels, scaled so a bevel tilts the normal well over+ dx = (height(x + step * 4, y) - height(x - step * 4, y)) / (step * 8) * 0.06+ dy = (height(x, y + step * 4) - height(x, y - step * 4)) / (step * 8) * 0.06+ n = (-dx, -dy, 1.0)+ nl = math.sqrt(n[0] * n[0] + n[1] * n[1] + 1.0)+ lit = max(0.0, (n[0] * light[0] + n[1] * light[1] + n[2] * light[2]) / nl)+ shade = 0.35 + 0.85 * lit + 0.05 * noise+ colour = tuple(min(255, max(0, int(c * shade))) for c in STEEL)+ pixels[px, py] = colour + (255,)+ elif r < SOIL_OUT:+ alpha = SOIL_ALPHA * (1.0 - ramp(PLATE + 0.06, SOIL_OUT, r)) * (0.85 + 0.15 * noise)+ shade = 0.9 + 0.2 * noise+ colour = tuple(min(255, max(0, int(c * shade))) for c in SOIL)+ pixels[px, py] = colour + (max(0, int(255 * alpha)),)+ else:+ pixels[px, py] = SOIL + (0,)+ path = os.path.join(out_folder, "ReforgedMine.tga")+ image.resize((SHIPPED, SHIPPED), Image.LANCZOS).save(path)+ print(path)+++if __name__ == "__main__":+ main()