Add a command to invoke eureka for the given wad and map.

This commit is contained in:
yrriban 2025-04-28 18:31:36 -04:00
parent 70826d4227
commit 7f397f352f
3 changed files with 39 additions and 9 deletions

View file

@ -23,15 +23,9 @@ TEXT_STROKE_COLOR="srgb(176,0,0)"
MIRROR="https://youfailit.net/pub/idgames" # NYC MIRROR="https://youfailit.net/pub/idgames" # NYC
def DsdaPreamble(wad, mapstr): def DsdaPreamble(wad, mapstr):
args = [] args = ["-iwad", IwadPath(wad)]
pwadpath = PWADS.joinpath(wad)
iwad = DEFAULT_IWAD
iwadpath = pwadpath.joinpath("iwad")
if iwadpath.exists():
with io.open(iwadpath) as f:
iwad = IWADS.joinpath(f.read().strip() + ".WAD")
args = args + ["-iwad", iwad]
pwadpath = PWADS.joinpath(wad)
wads = sorted(pwadpath.glob('*.wad', case_sensitive=False)) wads = sorted(pwadpath.glob('*.wad', case_sensitive=False))
if len(wads) > 0: if len(wads) > 0:
args = args + ["-file"] + wads args = args + ["-file"] + wads
@ -45,7 +39,7 @@ def DsdaPreamble(wad, mapstr):
raise Exception("No complevel set in PWAD dir {}.".format(pwadpath)) raise Exception("No complevel set in PWAD dir {}.".format(pwadpath))
with io.open(complevel) as f: with io.open(complevel) as f:
args = args + ["-complevel", f.read().strip()] args = args + ["-complevel", Complevel(wad)]
args = args + ["-skill", "4"] args = args + ["-skill", "4"]
args = args + ["-warp", mapstr] # TODO: UDoom args = args + ["-warp", mapstr] # TODO: UDoom
@ -68,6 +62,22 @@ def DemoOutPath(wad, mapstr):
def DemoName(wad, mapstr): def DemoName(wad, mapstr):
return "{}_map{}.lmp".format(wad, mapstr) return "{}_map{}.lmp".format(wad, mapstr)
def Complevel(wad):
complevel = PwadPath(wad).joinpath("complevel")
if not complevel.exists():
raise Exception("No complevel set in PWAD dir {}.".format(pwadpath))
with io.open(complevel) as f:
return f.read().strip()
def IwadPath(wad):
iwad = DEFAULT_IWAD
iwadpath = PwadPath(wad).joinpath("iwad")
if iwadpath.exists():
with io.open(iwadpath) as f:
iwad = IWADS.joinpath(f.read().strip() + ".WAD")
return iwad
def PwadPath(wad): def PwadPath(wad):
return Ensure(PWADS.joinpath(wad)) return Ensure(PWADS.joinpath(wad))

19
dcc/eureka.py Normal file
View file

@ -0,0 +1,19 @@
import dcc.doom_base
import dcc.config
import subprocess
class Eureka(dcc.doom_base.WadMap):
def take_action(self, parsed_args):
iwad = dcc.config.IwadPath(parsed_args.wad)
pwadpath = dcc.config.PwadPath(parsed_args.wad)
mw = list(pwadpath.glob('*{}*.wad'.format(parsed_args.wad), case_sensitive=False))
if len(mw) != 1:
raise Exception("Unable to guess at main pwad for wad {}.".format(parsed_args.wad))
complevel = dcc.config.Complevel(parsed_args.wad)
port = "vanilla"
if complevel == "9":
port = "boom"
if complevel == "11" or complevel == "21":
port = "mbf"
subprocess.run(["eureka"] + ["-iwad", iwad] + ["-w", parsed_args.map] + ["-p", port] + [mw[0]])

View file

@ -33,6 +33,7 @@ setup(
'text = dcc.text:Text', 'text = dcc.text:Text',
'thumb = dcc.thumb:Thumb', 'thumb = dcc.thumb:Thumb',
'dsda = dcc.dsda:DSDA', 'dsda = dcc.dsda:DSDA',
'eureka = dcc.eureka:Eureka',
], ],
}, },
zip_safe=False, zip_safe=False,