Skip to content

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.

fix(data): mine light as a small dot and glow, plate sunk in the soil

Olcay Seyganba5f746723d0
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index cca18d511..09f0daa9d 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -11,6 +11,8 @@ Data/Art/Textures/ReforgedBarGLALeft.tga
Data/Art/Textures/ReforgedBarGLARight.tga
Data/Art/Textures/ReforgedLaserPink.tga
Data/Art/Textures/ReforgedMine.tga
+Data/Art/Textures/ReforgedMineGlowBlue.tga
+Data/Art/Textures/ReforgedMineGlowRed.tga
Data/Art/Textures/ReforgedMineLedBlue.tga
Data/Art/Textures/ReforgedMineLedRed.tga
Data/Art/Textures/ReforgedOrders.tga
@@ -38,11 +40,14 @@ Data/Cinema/hero_loop_09.txt
Data/Cinema/hero_loop_10.txt
Data/Cinema/inf_jam.txt
Data/Cinema/inf_walk.txt
+Data/Cinema/looks4.txt
+Data/Cinema/looks4amber.txt
Data/Cinema/lsv_burst.txt
Data/Cinema/lsv_laser.txt
Data/Cinema/lsv_spam.txt
Data/Cinema/lsv_spam2.txt
Data/Cinema/minefx.txt
+Data/Cinema/minefx_desert.txt
Data/Cinema/minefx_player.txt
Data/Cinema/minefx_scene.txt
Data/Cinema/minefx_scene_enemy.txt
@@ -185,11 +190,13 @@ Data/Scenarios/jetpass.txt
Data/Scenarios/laserglow.txt
Data/Scenarios/leadinfantry.txt
Data/Scenarios/leadvehicle.txt
+Data/Scenarios/looks4.txt
Data/Scenarios/mappers.txt
Data/Scenarios/mass420x2.txt
Data/Scenarios/mass840.txt
Data/Scenarios/massmove.txt
Data/Scenarios/minefx.txt
+Data/Scenarios/minefx_desert.txt
Data/Scenarios/minefx_player.txt
Data/Scenarios/minefx_scene.txt
Data/Scenarios/minefx_scene_enemy.txt
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tga
index 6731f568d..8e9b7b976 100644
Binary files a/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tga and b/GeneralsMD/Code/Data/Art/Textures/ReforgedMine.tga differ
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedMineGlowBlue.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedMineGlowBlue.tga
new file mode 100644
index 000000000..fd731b8f6
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedMineGlowBlue.tga differ
diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedMineGlowRed.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedMineGlowRed.tga
new file mode 100644
index 000000000..2c8339432
Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedMineGlowRed.tga differ
diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
index 09d6e7d79..2fdeee5c2 100644
--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
@@ -3401,17 +3401,19 @@ End
; 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 five across, laid flat on the bone at a random turn, with an arming LED
-; above its middle, red on the standard and cluster mines and cold sky blue on the EMP mines.
-; The LED is ReforgedMineLedRed.tga or ReforgedMineLedBlue.tga, a coloured lens with a near-white hot
-; spot inside a dark bezel, alpha blended so it keeps its colour on grass, sand or snow; the additive
-; glow it replaced took the ground's colour. The slave's Size scales the plate's, so 1.1 makes it 11
-; across with a lens of five and a half. It lies flat five above the plate, because the soft particle
-; fade thins a sprite over its own half width wherever the ground is closer behind it than that, and
-; the old 30-across glow 0.6 above the plate came out at about a tenth of its colour. It comes on at
-; full strength, holds for eight frames and is gone two frames later, then stays dark until the next
-; plate a second and a half on: the lens flare it replaced was a soft blob that swelled and faded
-; over 24 frames.
+; sunk in a ring of dug earth ten across, laid flat on the bone at a random turn, with an arming
+; light over its cap, red on the standard and cluster mines and blue on the EMP mines. The light is
+; two systems. MineFXLight is a dot two and a half across lying flat 1.5 over the plate,
+; ReforgedMineLedRed.tga or ReforgedMineLedBlue.tga, a coloured lens with a near-white middle in a
+; dark bezel, alpha blended so it keeps its colour on grass, sand or snow; a slave's Size scales the
+; plate's, so 0.25 is a half width of 1.25. MineFXGlow hangs off the dot, a slave of a slave, which
+; takes its own Size rather than a scaled one: an additive glow six across facing the camera 3.5 over
+; the plate, ReforgedMineGlow*.tga, a white-hot point in a saturated glow. Both sit higher above the
+; ground than their own half width, because the soft particle fade thins a sprite over its half width
+; wherever the ground is closer behind it than that; the light before this was a 30-across glow 0.6
+; over the plate and came out at about a tenth of its colour. The light comes on at full strength,
+; holds for eight frames and is gone two frames later, then stays dark until the next plate a second
+; and a half on: the lens flare it replaced was a soft blob that swelled and faded over 24 frames.
;
; 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
@@ -3419,12 +3421,124 @@ End
; 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 MineFXGlow
+ Priority = ALWAYS_RENDER
+ IsOneShot = No
+ Shader = ADDITIVE
+ Type = PARTICLE
+ ParticleName = ReforgedMineGlowRed.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 = 11.00 11.00
+ SystemLifetime = 0
+ Size = 3.00 3.00
+ 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:255 B:255 0
+ Color2 = R:255 G:255 B:255 8
+ Color3 = R:0 G:0 B:0 10
+ 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 MineFXGlowPurple
+ Priority = ALWAYS_RENDER
+ IsOneShot = No
+ Shader = ADDITIVE
+ Type = PARTICLE
+ ParticleName = ReforgedMineGlowBlue.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 = 11.00 11.00
+ SystemLifetime = 0
+ Size = 3.00 3.00
+ 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:255 B:255 0
+ Color2 = R:255 G:255 B:255 8
+ Color3 = R:0 G:0 B:0 10
+ 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 MineFXLight
Priority = ALWAYS_RENDER
IsOneShot = No
Shader = ALPHA
Type = PARTICLE
ParticleName = ReforgedMineLedRed.tga
+ SlaveSystem = MineFXGlow
+ SlavePosOffset = X:0.00 Y:0.00 Z:3.50
AngleZ = 0.00 0.00
AngularRateZ = 0.00 0.00
AngularDamping = 1.00 1.00
@@ -3432,7 +3546,7 @@ ParticleSystem MineFXLight
Gravity = 0.00
Lifetime = 11.00 11.00
SystemLifetime = 0
- Size = 1.10 1.10
+ Size = 0.25 0.25
StartSizeRate = 0.00 0.00
SizeRate = 0.00 0.00
SizeRateDamping = 1.00 1.00
@@ -3480,6 +3594,8 @@ ParticleSystem MineFXLightPurple
Shader = ALPHA
Type = PARTICLE
ParticleName = ReforgedMineLedBlue.tga
+ SlaveSystem = MineFXGlowPurple
+ SlavePosOffset = X:0.00 Y:0.00 Z:3.50
AngleZ = 0.00 0.00
AngularRateZ = 0.00 0.00
AngularDamping = 1.00 1.00
@@ -3487,7 +3603,7 @@ ParticleSystem MineFXLightPurple
Gravity = 0.00
Lifetime = 11.00 11.00
SystemLifetime = 0
- Size = 1.10 1.10
+ Size = 0.25 0.25
StartSizeRate = 0.00 0.00
SizeRate = 0.00 0.00
SizeRateDamping = 1.00 1.00
@@ -3583,7 +3699,7 @@ ParticleSystem MineFX
WindPingPongEndAngleMin = 5.497787
WindPingPongEndAngleMax = 6.283185
SlaveSystem = MineFXLight
- SlavePosOffset = X:0.00 Y:0.00 Z:5.00
+ SlavePosOffset = X:0.00 Y:0.00 Z:1.50
End
ParticleSystem MineFXPurple
@@ -3640,7 +3756,7 @@ ParticleSystem MineFXPurple
WindPingPongEndAngleMin = 5.497787
WindPingPongEndAngleMax = 6.283185
SlaveSystem = MineFXLightPurple
- SlavePosOffset = X:0.00 Y:0.00 Z:5.00
+ SlavePosOffset = X:0.00 Y:0.00 Z:1.50
End
; A mine going off under a vehicle (WeaponFX_MineDetonation and Neutron_WeaponFX_Mine in
diff --git a/GeneralsMD/Code/Tools/mine_marks.py b/GeneralsMD/Code/Tools/mine_marks.py
index 4bad750e6..b1c1466f6 100644
--- a/GeneralsMD/Code/Tools/mine_marks.py
+++ b/GeneralsMD/Code/Tools/mine_marks.py
@@ -3,10 +3,15 @@ of disturbed earth. The game lays it flat on the ground at each of a mine field
(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.
-The arming light over each mine is an LED seen from above: a lens in the light's colour, red for the
-standard and cluster mines and a saturated blue for the EMP mines, with a near-white hot spot in its
-middle, inside a dark bezel. It is alpha blended, not additive, so the lens keeps its colour over
-grass, sand or snow and the bezel parts it from whatever ground is round it.
+The steel is smeared with soil in places and the dug ring is uneven, lumpy and reaches further on
+some headings than others, darkest in the hollow against the rim, so the plate looks sunk in the
+ground rather than laid on it.
+
+The arming light over each mine is two pictures. ReforgedMineLed*.tga is a small dot on the plate's
+cap: a lens in the light's colour, red for the standard and cluster mines and a saturated blue for
+the EMP mines, with a near-white middle, inside a dark bezel, alpha blended so it keeps its colour
+over grass, sand or snow. ReforgedMineGlow*.tga is the light above it, drawn additively: a white-hot
+point in a saturated glow.
python Tools/mine_marks.py # writes Data/Art/Textures/ReforgedMine.tga and ReforgedMineLed*.tga
@@ -24,6 +29,8 @@ 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 = (26, 20, 14)
+SOIL_LIT = (70, 58, 42) # dry soil smeared on the steel, before the steel's shading
+DIRT = 0.45 # how much of the steel it hides where it is thickest
SOIL_ALPHA = 0.85 # the dark ring is what tells a mine from a stone on grass at the player's camera
OUTLINE = 0.035 # a near-black edge round the steel, as a share of the half width
PLATE = 0.70 # radius of the steel, as a share of the half width
@@ -34,6 +41,8 @@ LED_LENS = 0.50 # radius of the lit lens in the light's colour
LED_BEZEL_OUT = 0.74 # outer edge of the dark bezel round the lens
LED_BEZEL = (10, 8, 8)
LED_BEZEL_ALPHA = 0.9
+GLOW_HOT = 0.12 # the light's white-hot point, as a share of the glow sprite's half width
+GLOW_FALL = 0.22 # the glow round it falls off as exp(-(r - hot) / this)
LEDS = (("Red", (255, 28, 10), (255, 235, 225)), ("Blue", (40, 110, 255), (225, 240, 255)))
OUT_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures")
@@ -57,11 +66,23 @@ def height(x, y):
return h
+def waves(seed, count, frequency):
+ """Smooth noise in about -1..1: a few plane waves at random headings and phases."""
+ pick = random.Random(seed)
+ terms = [(pick.uniform(0, 2 * math.pi), pick.uniform(0.6, 1.4) * frequency, pick.uniform(0, 2 * math.pi))
+ for _ in range(count)]
+ scale = 1.0 / math.sqrt(count / 2.0)
+ return lambda x, y: scale * sum(math.sin(f * (x * math.cos(a) + y * math.sin(a)) + p) for a, f, p in terms)
+
+
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)
+ clumps = waves(11, 6, 9.0) # lumps of turned earth
+ dirt = waves(13, 5, 6.0) # where soil has smeared over the steel
+ edge = waves(17, 4, 3.0) # how far the dug ring reaches, by heading
step = 2.0 / DRAWN
image = Image.new("RGBA", (DRAWN, DRAWN))
pixels = image.load()
@@ -71,23 +92,33 @@ def main():
x = (px - CENTRE) / CENTRE
r = math.hypot(x, y)
noise = grit.uniform(-1.0, 1.0)
- if r < PLATE:
+ heading = math.atan2(y, x)
+ reach = SOIL_OUT - 0.10 + 0.07 * edge(math.cos(heading), math.sin(heading))
+ # the soil laps over the rim in places, so the plate is sunk rather than laid on top
+ lip = PLATE - 0.05 * max(0.0, clumps(x * 0.7, y * 0.7) - 0.6)
+ if r < lip:
# 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.25 + 1.1 * lit + 0.05 * noise
- if r > PLATE - OUTLINE:
+ shade = 0.25 + 1.0 * lit + 0.05 * noise
+ if r > lip - OUTLINE:
shade *= 0.35
- colour = tuple(min(255, max(0, int(c * shade))) for c in STEEL)
+ smear = DIRT * ramp(-0.2, 0.8, dirt(x, y))
+ colour = tuple(min(255, max(0, int((c * (1.0 - smear) + s * smear) * shade)))
+ for c, s in zip(STEEL, SOIL_LIT))
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
+ elif r < reach:
+ # darkest in the hollow against the rim, fading out into the ground in clumps
+ fade = 1.0 - ramp(lip + 0.02, reach, r)
+ lump = clumps(x, y)
+ alpha = SOIL_ALPHA * fade * min(1.0, 0.75 + 0.35 * lump + 0.1 * noise)
+ hollow = 1.0 - 0.45 * (1.0 - ramp(lip, lip + 0.10, r))
+ shade = (1.0 + 0.25 * lump + 0.15 * noise) * hollow
colour = tuple(min(255, max(0, int(c * shade))) for c in SOIL)
- pixels[px, py] = colour + (max(0, int(255 * alpha)),)
+ pixels[px, py] = colour + (max(0, min(255, int(255 * alpha))),)
else:
pixels[px, py] = SOIL + (0,)
path = os.path.join(out_folder, "ReforgedMine.tga")
@@ -97,6 +128,26 @@ def main():
path = os.path.join(out_folder, "ReforgedMineLed%s.tga" % name)
led(glow, core).resize((SHIPPED, SHIPPED), Image.LANCZOS).save(path)
print(path)
+ path = os.path.join(out_folder, "ReforgedMineGlow%s.tga" % name)
+ shine(glow, core).resize((SHIPPED, SHIPPED), Image.LANCZOS).save(path)
+ print(path)
+
+
+def shine(colour, hot):
+ """The light itself, drawn additively over the lens: a white-hot point, a saturated glow round it
+ falling away to nothing at the sprite's edge."""
+ 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)
+ white = 1.0 - ramp(GLOW_HOT, GLOW_HOT + 0.06, r)
+ strength = math.exp(-max(0.0, r - GLOW_HOT) / GLOW_FALL) * (1.0 - ramp(0.75, 1.0, r))
+ value = tuple(int(min(255, (h * white + c * (1.0 - white)) * strength)) for h, c in zip(hot, colour))
+ pixels[px, py] = value + (max(value),)
+ return image
def led(lens, hot):