Browse Source

Opener and File Read Work

master
NCLanceman 4 days ago
parent
commit
31aa658388
  1. 6
      Settings.txt
  2. 105
      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

105
doomstarter.py

@ -15,46 +15,51 @@ 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
settings = ((open("Settings.txt")).read()).splitlines()
currentSetting = "" currentSetting = ""
for i in settings: for i in settings:
print("Examining " + i) print("Examining " + i)
print("Current Setting is: " + currentSetting) print("Current Setting is: " + currentSetting)
@ -85,60 +90,60 @@ for i in settings:
previousSettings.append(i) previousSettings.append(i)
print("Adding " + i + " to Previous Settings") print("Adding " + i + " to Previous Settings")
print("Printing Source Settings...") print("Printing Source Settings...")
print(sourceSettings) print(sourceSettings)
print("Printing Maps...") print("Printing Maps...")
print(mapsSettings) print(mapsSettings)
print("Printing Gameplay WADs...") print("Printing Gameplay WADs...")
print(gameplaySettings) print(gameplaySettings)
print("Printing Misc WADs...") print("Printing Misc WADs...")
print(miscSettings) print(miscSettings)
print("Printing Previous Settings...") print("Printing Previous Settings...")
print(previousSettings) print(previousSettings)
# Detect SourcePorts # Detect SourcePorts
# Source Port list: GZDoom, UZDoom, ChocolateDoom, DSDA-Doom, Woof! # Source Port list: GZDoom, UZDoom, ChocolateDoom, DSDA-Doom, Woof!
settingsDict = { settingsDict = {
"sourcePorts": {}, "sourcePorts": {},
"maps": {}, "maps": {},
"gameplay": {}, "gameplay": {},
"misc": {}, "misc": {},
"previous": {} "previous": {}
} }
# print("Running UZDoom with no arguements...") # print("Running UZDoom with no arguements...")
# subprocess.run(sourceport_dict["UZDoom"]["runcommand"] # subprocess.run(sourceport_dict["UZDoom"]["runcommand"]
# + " ./gameplay/PVT_STONE_V12_5.wad", shell = True) # + " ./gameplay/PVT_STONE_V12_5.wad", shell = True)
# subprocess.run(sourceport_dict["Woof"]["runcommand"], shell=True) # subprocess.run(sourceport_dict["Woof"]["runcommand"], shell=True)
# List all that stuff in a file # List all that stuff in a file
print("Listing everything in Maps...") print("Listing everything in Maps...")
print(os.listdir("./maps/")) print(os.listdir("./maps/"))
# TODO: Add maps to main dict # TODO: Add maps to main dict
# Read information from the settings file # Read information from the settings file
print("Adding maps to the main dict...") print("Adding maps to the main dict...")
mapSettingsRead() settingsDict = mapSettingsRead(settingsDict)
print("Listing everything in Gameplay...") print("Listing everything in Gameplay...")
print(os.listdir("./gameplay/")) print(os.listdir("./gameplay/"))
# TODO: Add gameplay WADS to main dict # TODO: Add gameplay WADS to main dict
print("Listing everything in Misc...") print("Listing everything in Misc...")
print(os.listdir("./misc/")) print(os.listdir("./misc/"))
# TODO: Add misc wads to the main dict # TODO: Add misc wads to the main dict
print(settingsDict) print(settingsDict)
# print("Sample Maps listing: ") # print("Sample Maps listing: ")
# menuPrinter(os.listdir("./maps/")) # menuPrinter(os.listdir("./maps/"))
# Store last configs for later use # Store last configs for later use
# Configure SourcePort # Configure SourcePort
# Add Gameplay WAD (optional) # Add Gameplay WAD (optional)
# Select Map WADs # Select Map WADs
print("END OF PROGRAM") print("END OF PROGRAM")

Loading…
Cancel
Save