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

fixup supervisev

parent 0b04b538
#
GAME?=hl2.exe
PYTHON_BIN?=./env/scripts/python
GARYSMOD_DIR?=D:\\Steam\\steamapps\\common\\GarrysMod\\
......@@ -8,23 +9,24 @@ MOUNT_DIR?=.\\
VBIN_FLAGS?=-game $(MOD_DIR)
SUPERVISE_V_BIN?=./contrib/supervise-v
BSP_BIN?=$(VBIN_DIR)vbsp.exe
BSP_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)vbsp.exe
BSP_FLAGS?=$(VBIN_FLAGS)
VIS_BIN?=$(VBIN_DIR)vvis.exe
VIS_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)vvis.exe
VIS_FLAGS?=$(VBIN_FLAGS) -fast
RAD_BIN?=$(VBIN_DIR)vrad.exe
RAD_BIN?=$(SUPERVISE_V_BIN) $(VBIN_DIR)vrad.exe
RAD_FLAGS?=$(VBIN_FLAGS) -StaticPropLighting -bounce 2 -noextra
# -StaticPropSampleScale 0.25
BSPZIP_BIN?=$(VBIN_DIR)bspzip.exe
BSPZIP_FLAGS?=
%.bsp: %.vmf
# my take on compiling
# vbsp: writes bsp
# vvis: depends on .prt, r/w bsp
# vrad: reads lights.rad, r/w bsp
$(SUPERVISE_V_BIN) $(BSP_BIN) $(BSP_FLAGS) $(basename $^)
$(SUPERVISE_V_BIN) $(VIS_BIN) $(VIS_FLAGS) $(basename $^)
$(SUPERVISE_V_BIN) $(RAD_BIN) $(RAD_FLAGS) $(basename $^)
%.bsp: %.vmf
$(BSP_BIN) $(BSP_FLAGS) $(basename $^)
$(VIS_BIN) $(VIS_FLAGS) $(basename $^)
$(RAD_BIN) $(RAD_FLAGS) $(basename $^)
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
%.prt: %.bsp
......@@ -37,15 +39,59 @@ BSPZIP_FLAGS?=
%_p.bsp: %.bsp
$(BSPZIP_BIN) $(BSPZIP_FLAGS) -addlist $^ $(basename $^).bspzip-addlist $@
ttt_terrorcon_v2.bsp:
all: ttt_terrorcon_v2.bsp ttt_terrorcon_v2.lint ttt_terrorcon_v2.game
game: install ttt_terrorcon_v2_p.bsp
$(GARYSMOD_DIR)hl2.exe -allowdebug $(VBIN_FLAGS) +map $(notdir $(basename $(word 2,$^))) +gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
%.game: %.bsp
ifeq ($(GAME),0)
echo user disabled run game via GAME=0
else
$(GARYSMOD_DIR)$(GAME) -allowdebug $(VBIN_FLAGS) +map $(notdir $(basename $^)) +gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
endif
install: ttt_terrorcon_v2_p.bsp
install: ttt_terrorcon_v2_hdr_final_p.bsp
cp -v $^ $(MOD_DIR)maps\\
%.lint: %.bspzip-addlist
$(PYTHON_BIN) ./contrib/bspzip-lint $^ 2> $@
$(PYTHON_BIN) ./contrib/bspzip-lint $^ 2>&1 | tee $@
# hammer default flags
%_default.bsp: %.vmf
# default
$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
$(VIS_BIN) $(VBIN_FLAGS) $(basename $^)
$(RAD_BIN) $(VBIN_FLAGS) $(basename $^)
mv $(@:_default.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
%_fast.bsp: %.vmf
# fast
$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
$(VIS_BIN) -fast $(VBIN_FLAGS) $(basename $^)
$(RAD_BIN) -bounce 2 -noextra $(VBIN_FLAGS) $(basename $^)
mv $(@:_fast.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
%_hdr.bsp: %.vmf
# hdr
$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
$(VIS_BIN) $(VBIN_FLAGS) $(basename $^)
$(RAD_BIN) -both $(VBIN_FLAGS) $(basename $^)
mv $(@:_hdr.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
%_hdr_final.bsp: %.vmf
# hdr-final
$(BSP_BIN) $(VBIN_FLAGS) $(basename $^)
$(VIS_BIN) $(VBIN_FLAGS) $(basename $^)
$(RAD_BIN) -both -final $(VBIN_FLAGS) $(basename $^)
mv $(@:_hdr_final.bsp=.bsp) $@
cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
.PHONY: lint
# only ents works on an existing bsp,
# which are not typically left "in place" for this operation
#%_ents.bsp: %.vmf
# # only-ents
# $(BSP_BIN) -onlyents $(VBIN_FLAGS) $(basename $^)
# mv $(@:_ents.bsp=.bsp) $@
# cp $@ $(MOUNT_DIR)maps\\$(notdir $@)
......@@ -41,8 +41,12 @@ class FileFingerprint:
return hash_
def __eq__(self, other):
if other is None:
return False
if other.stat.st_size != self.stat.st_size:
return False
if not isinstance(other, self.__class__):
raise NotImplementedError('cannot compare {s.__class__.__name__!r} to {o.__class__.__name__:!r}'.format(s=self, o=other))
return other.hash.digest() == self.hash.digest()
class Argset:
......@@ -86,6 +90,8 @@ def main():
# fp['vmf'][0] = FileFingerprint(argset.vmf)
if argset.has_bsp:
fp['bsp'][0] = FileFingerprint(argset.bsp)
else:
logging.info('no bsp file %r', argset.bsp)
execve = [argset.bin] + argset.vargs + [argset.file]
logging.info('execve: %r', execve)
......@@ -96,8 +102,12 @@ def main():
#if argset.has_vmf:
# fp['vmf'][1] = FileFingerprint(argset.vmf)
if argset.has_bsp:
if os.path.isfile(argset.bsp):
fp['bsp'][1] = FileFingerprint(argset.bsp)
else:
logging.info('no bsp file %r', argset.bsp)
exit(2)
bsp_changed = (fp['bsp'][0] == fp['bsp'][1])
exit(bsp_changed)
......
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