Commit fdd9b6d1 authored by dylan grafmyre's avatar dylan grafmyre
Browse files

uhh, try to pack zips automatically, its not going well

parent 0571cb2e
......@@ -19,6 +19,9 @@ RAD_FLAGS?=$(VBIN_FLAGS) -StaticPropLighting -bounce 2 -noextra
BSPZIP_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)bspzip.exe
BSPZIP_FLAGS?=$(VBIN_FLAGS)
GEN_BSPZIP_ADDLIST_BIN?=./contrib/gen-bspzip-addlist
GEN_BSPZIP_ADDLIST_FLAGS?=--pack-used-local
# my take on compiling
# vbsp: writes bsp
# vvis: depends on .prt, r/w bsp
......@@ -33,15 +36,18 @@ BSPZIP_FLAGS?=$(VBIN_FLAGS)
@test -f $@ || rm -f $(basename $@).bsp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(basename $@).bsp
%.log: %.bsp
@test -f $@ || rm -f $(basename $@).bsp
@test -f $@ ||rm -f $(basename $@).bsp
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) $(basename $@).bsp
%_p.bsp: %.bsp
$(BSPZIP_BIN) -addlist $^ $(basename $^).bspzip-addlist $@ $(BSPZIP_FLAGS)
$(BSPZIP_BIN) -addlist $^ $(^:.bsp=.bspzip-addlist) $@ $(BSPZIP_FLAGS)
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
all: ttt_terrorcon_v2.bsp ttt_terrorcon_v2.lint ttt_terrorcon_v2.game
%.bspzip-addlist: %.vmf
$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $@
%.game: %.bsp
ifeq ($(GAME),0)
echo user disabled run game via GAME=0
......@@ -53,7 +59,7 @@ install: ttt_terrorcon_v2_hdr_final_p.bsp
cp -v $^ $(MOD_DIR)maps\\
%.lint: %.bspzip-addlist
$(PYTHON_BIN) ./contrib/bspzip-lint $^ 2>&1 | tee $@
$(PYTHON_BIN) ./contrib/bspzip-lint $^ 2>&1 | tee $@
# hammer default flags
......@@ -64,6 +70,7 @@ install: ttt_terrorcon_v2_hdr_final_p.bsp
$(RAD_BIN) $(VBIN_FLAGS) $(basename $^)
mv $(@:_default.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
%_fast.bsp: %.vmf
# fast
......@@ -72,6 +79,7 @@ install: ttt_terrorcon_v2_hdr_final_p.bsp
$(RAD_BIN) -bounce 2 -noextra $(VBIN_FLAGS) $(basename $^)
mv $(@:_fast.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
%_hdr.bsp: %.vmf
# hdr
......@@ -80,6 +88,7 @@ install: ttt_terrorcon_v2_hdr_final_p.bsp
$(RAD_BIN) -both $(VBIN_FLAGS) $(basename $^)
mv $(@:_hdr.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
%_hdr_final.bsp: %.vmf
# hdr-final
......@@ -88,6 +97,7 @@ install: ttt_terrorcon_v2_hdr_final_p.bsp
$(RAD_BIN) -both -final $(VBIN_FLAGS) $(basename $^)
mv $(@:_hdr_final.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
$(GEN_BSPZIP_ADDLIST_BIN) $(GEN_BSPZIP_ADDLIST_FLAGS) $^ > $(@:.bsp=.bspzip-addlist)
# only ents works on an existing bsp,
# which are not typically left "in place" for this operation
......
#!/usr/bin/env python3
import argparse
import os
import pyvmf
ARGP = argparse.ArgumentParser()
ARGP.add_argument('vmf', type=argparse.FileType())
ARGP.add_argument('--pack-used-local', action='store_true')
argp = ARGP.parse_args()
if not argp.pack_used_local:
exit()
vmf = pyvmf.Vmf.load(argp.vmf)
dedupe = set()
for prop in vmf.iter_props():
model = prop.attributes['model']
model_lower = model.lower()
if model_lower in dedupe:
continue
dedupe.add(model_lower)
if not os.path.exists(model):
continue
model_base = os.path.splitext(model)[0]
for ext in ['dx80.vtx', 'dx90.vtx', 'mdl', 'phy', 'sw.vtx', 'vvd']:
model_ext = '{}.{}'.format(model_base, ext)
print(model_ext)
print(model_ext)
for leaf, material in vmf.iter_materials():
material_lower = 'materials/{}'.format(material.lower())
if material_lower in dedupe:
continue
dedupe.add(material_lower)
if not os.path.exists('{}.vmt'.format(material_lower)):
continue
for ext in ['vtf', 'vmt']:
material_ext = '{}.{}'.format(material_lower, ext)
print(material_ext)
print(material_ext)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment