Major refactor to make handling name/path manipulation easier.
Most of this is now in doom_base.py, which stores wad/map/name, exposes them as properties, and also takes care of most common tasks needed for building command lines and such.
This commit is contained in:
parent
85d3686f1c
commit
2438995093
11 changed files with 113 additions and 100 deletions
|
@ -22,46 +22,6 @@ TEXT_STROKE_COLOR="srgb(176,0,0)"
|
|||
|
||||
MIRROR="https://youfailit.net/pub/idgames" # NYC
|
||||
|
||||
def DsdaPreamble(wad, mapstr):
|
||||
args = ["-iwad", IwadPath(wad)]
|
||||
|
||||
pwadpath = PWADS.joinpath(wad)
|
||||
wads = sorted(pwadpath.glob('*.wad', case_sensitive=False))
|
||||
if len(wads) > 0:
|
||||
args = args + ["-file"] + wads
|
||||
|
||||
dehs = sorted(pwadpath.glob('*.deh', case_sensitive=False))
|
||||
if len(dehs) > 0:
|
||||
args = args + ["-deh"] + dehs
|
||||
|
||||
complevel = pwadpath.joinpath("complevel")
|
||||
if not complevel.exists():
|
||||
raise Exception("No complevel set in PWAD dir {}.".format(pwadpath))
|
||||
|
||||
with io.open(complevel) as f:
|
||||
args = args + ["-complevel", Complevel(wad)]
|
||||
|
||||
args = args + ["-skill", "4"]
|
||||
args = args + ["-warp", mapstr] # TODO: UDoom
|
||||
return args
|
||||
|
||||
def DemoInPath(wad, mapstr, name=None):
|
||||
candidates = [x for x in DEMOS.joinpath(wad).glob("{}_map{}{}*.lmp".format(wad, mapstr, NameString(name)))]
|
||||
if len(candidates) == 0:
|
||||
raise Exception("no suitable demo candidates for WAD {} MAP {}.".format(wad, mapstr))
|
||||
if len(candidates) == 1:
|
||||
return candidates[0]
|
||||
return sorted(filter(lambda s : re.search("-", str(s)), candidates))[-1]
|
||||
|
||||
def DsdaTextPath(wad, mapstr):
|
||||
return Ensure(DEMOS.joinpath(wad)).joinpath("{}_map{}.txt".format(wad, mapstr))
|
||||
|
||||
def DemoOutPath(wad, mapstr, name=None):
|
||||
return Ensure(DEMOS.joinpath(wad)).joinpath(DemoName(wad, mapstr, name))
|
||||
|
||||
def DemoName(wad, mapstr, name=None):
|
||||
return "{}_map{}{}.lmp".format(wad, mapstr, NameString(name))
|
||||
|
||||
def Complevel(wad):
|
||||
complevel = PwadPath(wad).joinpath("complevel")
|
||||
if not complevel.exists():
|
||||
|
@ -79,27 +39,4 @@ def IwadPath(wad):
|
|||
return iwad
|
||||
|
||||
def PwadPath(wad):
|
||||
return Ensure(PWADS.joinpath(wad))
|
||||
|
||||
def BaseThumbPath(wad, mapstr, name=None):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}{}_base.png".format(wad, mapstr, NameString(name)))
|
||||
|
||||
def MDoomPath(wad):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("M_DOOM_scaled.png")
|
||||
|
||||
def TextThumbPath(wad, mapstr, name=None):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}_text.png".format(wad, mapstr, NameString(name)))
|
||||
|
||||
def ThumbPath(wad, mapstr, name=None):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}_thumb.png".format(wad, mapstr, NameString(name)))
|
||||
|
||||
def VideoPath(wad, mapstr, name=None):
|
||||
return Ensure(OUTPUT.joinpath(wad)).joinpath("{}_map{}{}.mp4".format(wad, mapstr, NameString(name)))
|
||||
|
||||
def NameString(name):
|
||||
return "" if name is None else "_" + name
|
||||
|
||||
def Ensure(path):
|
||||
if not path.exists():
|
||||
os.mkdir(path)
|
||||
return path
|
||||
return PWADS.joinpath(wad)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue