Browse Source

Opener and File Read Work

master
NCLanceman 4 days ago
parent
commit
31aa658388
  1. 6
      Settings.txt
  2. 201
      doomstarter.py

6
Settings.txt

@ -9,6 +9,12 @@ UZDoom
300minvr.wad 300minvr.wad
--name=300 Minutes of /vr/ --name=300 Minutes of /vr/
--description=4chan's /vr/ board gives us a megawad of solid bangers! --description=4chan's /vr/ board gives us a megawad of solid bangers!
valve.wad
--name=Valiant: Vaccinated Edition
--description=Valiant! Without the custom enemies or weapons!
sigil.wad
--name=SIGIL
--description=The Icon of Sin Himself, John Romero returns! Episode 5 of DOOM!
[Gameplay] [Gameplay]
PVT_STONE_V12_5.wad PVT_STONE_V12_5.wad
--name=Pvt.Stone --name=Pvt.Stone

201
doomstarter.py

@ -15,130 +15,135 @@ def menuPrinter(list):
print(str(i) + ": " + list[i]) print(str(i) + ": " + list[i])
def mapSettingsRead(): def mapSettingsRead(mainDict):
tempDict = {} tempDict = {}
counter = 0
for i in range(len(mapsSettings)): for i in range(len(mapsSettings)):
tempName = "map" + str(i) tempName = "map" + str(counter).zfill(2)
print("Examining " + mapsSettings[i]) print("Examining " + mapsSettings[i])
if (mapsSettings[i][:2] != "--"): if (mapsSettings[i][:2] != "--"):
if len(tempDict) != 0: if len(tempDict) != 0:
settingsDict["maps"].update({tempName: tempDict}) settingsDict["maps"].update({tempName: tempDict})
tempDict = {}
counter = counter + 1
tempDict["filename"] = mapsSettings[i] tempDict["filename"] = mapsSettings[i]
else: else:
temp = mapsSettings[i][2:].split("=") temp = mapsSettings[i][2:].split("=")
tempDict.update({temp[0]: temp[1]}) tempDict.update({temp[0]: temp[1]})
if len(tempDict) != 0: if len(tempDict) != 0:
settingsDict["maps"].update({tempName: tempDict}) mainDict["maps"].update({tempName: tempDict})
return mainDict
# Dynamic Introduction! # Dynamic Introduction!
print("So it looks like you wanna play some fuckin\' DOOM!") print("So it looks like you wanna play some fuckin\' DOOM!")
print("Checking current directories...") print("Checking current directories...")
# On Start: Check if necessary folders are there # On Start: Check if necessary folders are there
# ./gameplay/, ./maps/, ./misc/ # ./gameplay/, ./maps/, ./misc/
if (os.path.isdir('gameplay') == False): # If not, end the program to allow user to add WAD files.
if not (os.path.isdir('gameplay') and os.path.isdir('maps') and os.path.isdir('misc')):
print("Making Gameplay folder...") print("Making Gameplay folder...")
os.mkdir('gameplay') os.mkdir('gameplay')
if (os.path.isdir('maps') == False):
print("Making Maps folder...") print("Making Maps folder...")
os.mkdir('maps') os.mkdir('maps')
if (os.path.isdir('misc') == False):
print("Making Misc Folder...") print("Making Misc Folder...")
os.mkdir('misc') os.mkdir('misc')
# Load Config File print("Folders Created! Now go forth and fill them! Return when you are ready to DOOM!")
settings = ((open("Settings.txt")).read()).splitlines() else:
# Load Config File
currentSetting = "" settings = ((open("Settings.txt")).read()).splitlines()
for i in settings: currentSetting = ""
print("Examining " + i)
print("Current Setting is: " + currentSetting) for i in settings:
print("Examining " + i)
if (i == "[Source Ports]"): print("Current Setting is: " + currentSetting)
currentSetting = "Source Ports"
elif (i == "[Maps]"): if (i == "[Source Ports]"):
currentSetting = "Maps" currentSetting = "Source Ports"
elif (i == "[Gameplay]"): elif (i == "[Maps]"):
currentSetting = "Gameplay" currentSetting = "Maps"
elif (i == "[Misc]"): elif (i == "[Gameplay]"):
currentSetting = "Misc" currentSetting = "Gameplay"
elif (i == "[Last Used]"): elif (i == "[Misc]"):
currentSetting = "Previous" currentSetting = "Misc"
if i: elif (i == "[Last Used]"):
if (currentSetting == "Source Ports" and i[0] != '['): currentSetting = "Previous"
sourceSettings.append(i) if i:
print("Adding " + i + " to Source Ports") if (currentSetting == "Source Ports" and i[0] != '['):
elif (currentSetting == "Maps" and i[0] != '['): sourceSettings.append(i)
mapsSettings.append(i) print("Adding " + i + " to Source Ports")
print("Adding " + i + " to Maps") elif (currentSetting == "Maps" and i[0] != '['):
elif (currentSetting == "Gameplay" and i[0] != '['): mapsSettings.append(i)
gameplaySettings.append(i) print("Adding " + i + " to Maps")
print("Adding " + i + " to Gameplay") elif (currentSetting == "Gameplay" and i[0] != '['):
elif (currentSetting == "Misc" and i[0] != '['): gameplaySettings.append(i)
miscSettings.append(i) print("Adding " + i + " to Gameplay")
print("Adding " + i + " to Misc") elif (currentSetting == "Misc" and i[0] != '['):
elif (currentSetting == "Previous" and i[0] != '['): miscSettings.append(i)
previousSettings.append(i) print("Adding " + i + " to Misc")
print("Adding " + i + " to Previous Settings") elif (currentSetting == "Previous" and i[0] != '['):
previousSettings.append(i)
print("Printing Source Settings...") print("Adding " + i + " to Previous Settings")
print(sourceSettings)
print("Printing Maps...") print("Printing Source Settings...")
print(mapsSettings) print(sourceSettings)
print("Printing Gameplay WADs...") print("Printing Maps...")
print(gameplaySettings) print(mapsSettings)
print("Printing Misc WADs...") print("Printing Gameplay WADs...")
print(miscSettings) print(gameplaySettings)
print("Printing Previous Settings...") print("Printing Misc WADs...")
print(previousSettings) print(miscSettings)
print("Printing Previous Settings...")
# Detect SourcePorts print(previousSettings)
# Source Port list: GZDoom, UZDoom, ChocolateDoom, DSDA-Doom, Woof!
settingsDict = { # Detect SourcePorts
"sourcePorts": {}, # Source Port list: GZDoom, UZDoom, ChocolateDoom, DSDA-Doom, Woof!
"maps": {}, settingsDict = {
"gameplay": {}, "sourcePorts": {},
"misc": {}, "maps": {},
"previous": {} "gameplay": {},
} "misc": {},
"previous": {}
# print("Running UZDoom with no arguements...") }
# subprocess.run(sourceport_dict["UZDoom"]["runcommand"]
# + " ./gameplay/PVT_STONE_V12_5.wad", shell = True) # print("Running UZDoom with no arguements...")
# subprocess.run(sourceport_dict["Woof"]["runcommand"], shell=True) # subprocess.run(sourceport_dict["UZDoom"]["runcommand"]
# + " ./gameplay/PVT_STONE_V12_5.wad", shell = True)
# List all that stuff in a file # subprocess.run(sourceport_dict["Woof"]["runcommand"], shell=True)
print("Listing everything in Maps...")
print(os.listdir("./maps/")) # List all that stuff in a file
# TODO: Add maps to main dict print("Listing everything in Maps...")
print(os.listdir("./maps/"))
# Read information from the settings file # TODO: Add maps to main dict
print("Adding maps to the main dict...")
mapSettingsRead() # Read information from the settings file
print("Adding maps to the main dict...")
print("Listing everything in Gameplay...") settingsDict = mapSettingsRead(settingsDict)
print(os.listdir("./gameplay/"))
# TODO: Add gameplay WADS to main dict print("Listing everything in Gameplay...")
print(os.listdir("./gameplay/"))
print("Listing everything in Misc...") # TODO: Add gameplay WADS to main dict
print(os.listdir("./misc/"))
# TODO: Add misc wads to the main dict print("Listing everything in Misc...")
print(os.listdir("./misc/"))
print(settingsDict) # TODO: Add misc wads to the main dict
# print("Sample Maps listing: ") print(settingsDict)
# menuPrinter(os.listdir("./maps/"))
# print("Sample Maps listing: ")
# Store last configs for later use # menuPrinter(os.listdir("./maps/"))
# Configure SourcePort # Store last configs for later use
# Add Gameplay WAD (optional) # Configure SourcePort
# Select Map WADs # Add Gameplay WAD (optional)
# Select Map WADs
print("END OF PROGRAM") print("END OF PROGRAM")

Loading…
Cancel
Save