Files
REM-Mod/tools/make_hud_txm.py
NekuraMew 4bce9f6880 New REM client: drop the old plugins and hook leftovers, art sources to ART/UI
The native REM client replaces the dacom plugins (rem-essentials, jflp, numeric,
moors, ranks, shipclass, engclass, storyfactions, ...), the FLAR / ReShade /
DLSS renderer hooks and the Lua event scripts of the ClientHook (all empty or
unused); dacom.ini and dacomsrv.ini no longer load them. flserver.exe and
mysqlcppconn.dll belong to the server. The first-person camera zones are
deferred. The ClientHook's pictures move to ART/UI as the sources of the
generators in tools. REM/Audio and REM/Avatars stay.
2026-10-29 20:21:12 +01:00

47 lines
1.8 KiB
Python

"""The REM HUD texture file (.txm) -- the icons drawn in the target brackets (rem_target_hud.cpp).
A .txm is a UTF file with one "Texture library" node, as DATA\\INTERFACE\\ButtonTextures.txm. Each
PNG becomes a grey 32-bit TGA with alpha (brightest pixel white, three mips) named
"REM_<name>.tga"; the HUD tints it with the bracket colour like Freelancer's own target corners.
DATA\\INTERFACE\\REM\\rem_hud.ini lists the textures as shapes (tex_shape = REM_<name>.tga).
python tools/make_hud_txm.py <out.txm> <name>=<in.png> [<name>=<in.png> ...]
Example (the shipped file):
python tools/make_hud_txm.py DATA/INTERFACE/REM/rem_hud.txm \\
skull=ART/UI/ICON/skull_icon.png \\
probe=ART/UI/ICON/sensorprobe_active.png \\
menu=ART/UI/ICON/target_menu.png
"""
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
import make_icon_3db as icon # noqa: E402
import utf # noqa: E402
TEX_SIZE = 64
def make(out, entries):
N = utf.Node
textures = []
for name, png in entries:
w, h, rows = icon.read_png(png)
w, h, rows = icon.crop_to_content(w, h, rows)
mips = [icon.tga(icon.to_grey(icon.resample(w, h, rows, size)))
for size in (TEX_SIZE, TEX_SIZE // 2, TEX_SIZE // 4)]
textures.append(N('REM_' + name + '.tga', children=[N('MIP%d' % i, data=m) for i, m in enumerate(mips)]))
root = N('\\', children=[N('Texture library', children=textures)])
os.makedirs(os.path.dirname(os.path.abspath(out)), exist_ok=True)
utf.write(out, root)
if __name__ == '__main__':
if len(sys.argv) < 3 or any('=' not in a for a in sys.argv[2:]):
print(__doc__)
sys.exit(1)
make(sys.argv[1], [a.split('=', 1) for a in sys.argv[2:]])
print('wrote', sys.argv[1])