Advertisement
Redxone

[Doom] WADx4

Oct 29th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.97 KB | None | 0 0
  1. #Credits: Lewisk3, gggmork
  2.  
  3. import omg,random,copy
  4.  
  5. mapFile = raw_input("Doom wad to resize: ")
  6. mapSize = input("How many maps to resize: ")
  7. w = omg.WAD(from_file=mapFile)
  8. #this didn't work on map 32 for some reason
  9. mapNames = ['MAP01', 'MAP02', 'MAP03', 'MAP04', 'MAP05', 'MAP06', 'MAP07', 'MAP08', 'MAP09', 'MAP10', 'MAP11', 'MAP12', 'MAP13', 'MAP14', 'MAP15', 'MAP16', 'MAP17', 'MAP18', 'MAP19', 'MAP20', 'MAP21', 'MAP22', 'MAP23', 'MAP24', 'MAP25', 'MAP26', 'MAP27', 'MAP28', 'MAP29', 'MAP30', 'MAP31']#, 'MAP32']
  10. if(mapSize > 0):
  11.     mapNames = mapNames[:mapSize]
  12.     print("Initalizing resize of " + str(mapSize) + " maps...")
  13. for name in mapNames:
  14.     e = omg.MapEditor(w.maps[name])
  15.     print("resizing " + name)
  16.     for sector in e.sectors:
  17.         sector.z_ceil *= 4
  18.         sector.z_floor *= 4
  19.     for vertex in e.vertexes:
  20.         vertex.x *= 4
  21.         vertex.y *= 4
  22.     #1x1 thing will duplicate to 3x3, this list represents:
  23.     #topleft,top,topright,left,right,bottomleft,bottom,bottomright (each will be current thing x minus (the number in this list multiplied by thing size) same for y)
  24.     newThingXLoop = [-1,0,1,-1,1,-1,0,1]
  25.     newThingYLoop = [1,1,1,0,0,-1,-1,-1]
  26.     for i in range(len(e.things)):
  27.         e.things[i].x *= 4
  28.         e.things[i].y *= 4
  29.         #if its not a player start or warp spot, prepare to duplicate thing to 3x3
  30.         if e.things[i].type not in [11,1,2,3,4,87,14]:
  31.             #if its an arach,cyber,manc
  32.             if e.things[i].type in [68,16,67]:
  33.                 thingSize = 128
  34.             #if its a mastermind
  35.             elif e.things[i].type == 7:
  36.                 thingSize = 256
  37.             else:
  38.                 thingSize = 64
  39.             for c in range(8):
  40.                 newThing = copy.deepcopy(e.things[i])
  41.                 newThing.x = e.things[i].x + thingSize*newThingXLoop[c]
  42.                 newThing.y = e.things[i].y + thingSize*newThingYLoop[c]
  43.                 e.things.append(newThing)
  44.        
  45.     e.nodes = ''
  46.     try:
  47.         w.maps[name] = e.to_lumps()
  48.     except:
  49.         print("Skipping " + name + " too many VERTEXES, cannot resize.")    
  50.     w.to_file('output.wad')
  51. print 'done; outputed to: output.wad'
  52. input("Press enter to exit.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement