Files
zombie-fps/tools/extract_grenade_assets.py
T
enne2 956a15a525 Add industrial metal soundtrack with seamless loop
- assets/audio/music/zombie_industrial_loop.ogg: 57.60 s Ogg Vorbis loop
  generated locally with YuE2-3B on the Tesla V100 (score written for this
  track; vocals removed with HTDemucs). The loop is spliced at the track's
  structural repeat with a 0.6 s crossfade: measured seam dip <= 1.6 dB.
- scripts/main.gd: "Music" AudioStreamPlayer at -11 dB, started at boot on
  desktop and on the start click on Web (browser autoplay policy). It forces
  stream.loop at runtime because the Web staging step re-imports the OGG with
  loop=false.
- tools/test_music.gd: soundtrack test (loop, length, volume, playback,
  still playing after player death).
- docs/MUSIC.md: source, loop construction, verification, licence.
- docs/WEB-DEPLOY.md: release ab6054111f5919a8 notes.

Initial commit of the project.
2026-10-10 23:11:13 +02:00

22 lines
1.1 KiB
Python

"""Copy original grenade assets; verify and append provenance manifest."""
from pathlib import Path
import shutil,hashlib,json,struct,wave
root=Path(__file__).resolve().parents[1]
source=Path.home()/'.steam/steam/steamapps/common/Half-Life/valve'
manifest=root/'assets/half_life_manifest.json'
rows=json.loads(manifest.read_text())
for relative in ['models/grenade.mdl']+['sound/weapons/explode%d.wav'%i for i in [3,4,5]]:
p=source/relative
dest=root/'assets'/('weapons/'+p.name if relative.startswith('models/') else 'audio/weapons/'+p.name)
shutil.copyfile(p,dest)
raw=p.read_bytes(); assert raw==dest.read_bytes()
row={'source':relative,'destination':str(dest.relative_to(root)),'sha256':hashlib.sha256(raw).hexdigest()}
if p.suffix=='.mdl':
assert raw[:4]==b'IDST' and struct.unpack_from('<i',raw,4)[0]==10
row['textures']=struct.unpack_from('<i',raw,180)[0]
else:
with wave.open(str(dest)) as w: assert w.getcomptype()=='NONE'
rows=[x for x in rows if x['destination']!=row['destination']]+[row]
print(relative,row['sha256'])
manifest.write_text(json.dumps(rows,indent=2)+'\n')