Skip to content

Commit

Permalink
release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
anbridge committed Jun 8, 2016
1 parent fbca312 commit bd2d5d6
Show file tree
Hide file tree
Showing 8 changed files with 564 additions and 26,875 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Easy TF2 Mapper (late beta 2.8.5)
# Easy TF2 Mapper (release 1.0.0)
##in broken state: No.
Make TF2 maps with blocks, similar to the Time Splitters map creator. currently in development; a few weeks from release. Send bugs, ideas, and suggestions to [email protected].
### current development branch: master, bugfixes
<p>
_CURRENTLY IN LATE BETA 2.8.5. PROBABLY BUGGY. SEND BUGS TO [email protected]_ This is only for Windows, as Hammer is only for Windows.
_CURRENTLY IN RELEASE 1.0.0. POSSIBLY BUGGY. SEND BUGS TO [email protected]_ This is only for Windows, as Hammer is only for Windows.
<p>
*READ THE README.TXT AND WIKI FOR INFO*
<p>
Expand Down
Binary file modified __pycache__/main.cpython-34.pyc
Binary file not shown.
125 changes: 74 additions & 51 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,16 @@ def click_func(self, parent, x, y, btn_id, clicked=True, h_moduleName="None", h_
global levels
global rotation, currentfilename
global history

#global last_tuple
"""
if last_tuple == 'First':
del last_tuple
last_tuple = ('None',x,y,btn_id,self.icon)
history.append([last_tuple,self.icon])
else:
history.append([last_tuple,self.icon])"""
"""
if self.icon:
history.append(last_tuple)
else:
last_tuple = ("None",x,y,id_num,world_id_num,entity_num,placeholder_list,rotation,level,"")
history.append(last_tuple)"""
global redo_history

#format | history.append((x,y,moduleName,self.icon,level))
if clicked:
redo_history=[]
if self.icon[level]:
moduleName = eval(prefab_list[parent.tile_list.currentRow()])
history.append((x,y,moduleName,self.icon[level],None)) #make work even without rotations enabled
templist=[(x,y,moduleName,self.icon[level],None)]
else:
history.append((x,y,None,None,None))

print(history)
templist=[(x,y,None,None,None)]

def clear_btn(btn_id):
self.button.setIcon(QIcon())
Expand Down Expand Up @@ -125,14 +110,18 @@ def clear_btn(btn_id):
self.button.setIcon(QIcon(icon))
self.button.setIconSize(QSize(32,32))
iconlist[level][btn_id] = icon
stored_info_list[level][btn_id] = (moduleName,x,y,id_num,world_id_num,entity_num,placeholder_list,rotation,level)
stored_info_list[level][btn_id] = [moduleName,x,y,id_num,world_id_num,entity_num,placeholder_list,rotation,level]

self.icon[level] = icon
else:
stored_info_list[level][btn_id] = ""

if "*" not in parent.windowTitle():
parent.setWindowTitle("Easy TF2 Mapper* - ["+currentfilename+"]")

if clicked:
templist.append((x,y,moduleName,self.icon[level],None))
history.append(templist)

def checkForCtrl(self, clicked):
if clicked:
Expand Down Expand Up @@ -590,7 +579,7 @@ def change_level(self, but = False, up = False, undo = False):
global level, levels

if not undo:
history.append((None,None,None,None,level))
templist = [(None,None,None,None,level)]

if not but:
self.file_save(True)
Expand Down Expand Up @@ -618,6 +607,10 @@ def change_level(self, but = False, up = False, undo = False):
self.file_open(True)
self.level.setText("Level: " + str(level+1))
#change grid to grid for level

if not undo:
templist.append((None,None,None,None,level))
history.append(templist)


def rotateCW_func(self):
Expand Down Expand Up @@ -761,7 +754,7 @@ def changeIcon(self):


def file_open(self, tmp = False, first = False):
global grid_list, iconlist, level, stored_info_list, totalblocks,entity_list, currentfilename, file_loaded, latest_path
global grid_list, iconlist, level, stored_info_list, totalblocks,entity_list, currentfilename, file_loaded, latest_path,save_dict,load_dict
print(latest_path)
if not tmp:
name = QFileDialog.getOpenFileName(self, "Open File", latest_path,"*.ezm")
Expand All @@ -779,9 +772,19 @@ def file_open(self, tmp = False, first = False):
self.grid_change(openlines[0],openlines[1],openlines[2],False, True, True)
elif "stored_info_list" in header:
stored_info_list=[]
stored_info_list_temp=[]
openlines = pickle.load(file)
for item in openlines:
stored_info_list.append(item)
stored_info_list_temp.append(item)
for index,lvl in enumerate(stored_info_list_temp):
stored_info_list.append([])
for info in lvl:
try:
temp = save_dict[info[0]]
info[0] = temp
stored_info_list[index].append(info)
except:
stored_info_list[index].append('')
elif "icon_list" in header:
global grid_list
iconlist=[]
Expand Down Expand Up @@ -822,7 +825,7 @@ def file_open(self, tmp = False, first = False):
print(str(e))

def file_save(self, tmp = False, saveAs = False):
global grid_x, grid_y, iconlist, levels, level, currentfilename, file_loaded, latest_path, stored_info_list
global grid_x, grid_y, iconlist, levels, level, currentfilename, file_loaded, latest_path, stored_info_list, save_dict,load_dict
print(latest_path)
gridsize_list = (grid_x,grid_y,levels)
skybox_sav = skybox2_list.currentRow()
Expand All @@ -841,7 +844,18 @@ def file_save(self, tmp = False, saveAs = False):
pickle.dump("<grid_size>", file)
pickle.dump(gridsize_list, file)
pickle.dump("<stored_info_list>", file)
pickle.dump(stored_info_list, file)
stored_info_list_temp=[]
for index,lvl in enumerate(stored_info_list):
stored_info_list_temp.append([])
for info in lvl:
print(info)
try:
temp = load_dict[info[0]]
info[0] = temp
stored_info_list_temp[index].append(info)
except:
stored_info_list_temp[index].append('')
pickle.dump(stored_info_list_temp, file)
pickle.dump("<icon_list>", file)
pickle.dump(iconlist, file)
pickle.dump("<skybox>", file)
Expand All @@ -867,7 +881,7 @@ def file_save(self, tmp = False, saveAs = False):
def file_export(self,bsp=False):
global cur_vmf_location,id_num,stored_info_list, grid_y, grid_x, world_id_num, count_btns, currentlight, skybox, skybox2_list, entity_list, skybox_light_list, skybox_angle_list, latest_path
skyboxgeolist = []
skyboxz = QInputDialog.getText(self,("Set Skybox Height"),("Skybox Height(hammer units, %d minimum recommended):" %(levels*512)))
skyboxz = QInputDialog.getText(self,("Set Skybox Height"),("Skybox Height(hammer units, %d minimum recommended):" %(levels*512)), QLineEdit.Normal, "%d" %(levels*512))
try:
skyboxz = int(skyboxz[0])
except:
Expand Down Expand Up @@ -958,7 +972,6 @@ def file_export(self,bsp=False):
if popup.clickedButton() == exitButton:
popup.deleteLater()
cur_vmf_location = name[0]
print('not bsp vmf part done')
else:
file = open('output/tf2mapperoutput.vmf','w+')
totalblocks =[]
Expand Down Expand Up @@ -996,7 +1009,7 @@ def file_export(self,bsp=False):
file.write(wholething)
file.close()
cur_vmf_location = 'output/tf2mapperoutput.vmf'
print('bsp vmf part done')



def file_export_bsp(self):
Expand Down Expand Up @@ -1565,43 +1578,28 @@ def console_enter(self):

def undo(self, undo):
if history if undo else redo_history:
x = history[-1][0] if undo else redo_history[-1][0]
y = history[-1][1] if undo else redo_history[-1][1]
h_moduleName = history[-1][2] if undo else redo_history[-1][2]
h_icon = history[-1][3] if undo else redo_history[-1][3]
h_level = history[-1][4] if undo else redo_history[-1][4]
x = history[-1][0][0] if undo else redo_history[-1][1][0]
y = history[-1][0][1] if undo else redo_history[-1][1][1]
h_moduleName = history[-1][0][2] if undo else redo_history[-1][1][2]
h_icon = history[-1][0][3] if undo else redo_history[-1][1][3]
h_level = history[-1][0][4] if undo else redo_history[-1][1][4]

if h_level == None:
for button in grid_list:
if button.x == x and button.y == y:
"""if undo:
history[-1][3] = button.icon
else:
redo_history[-1][3] = button.icon"""
print('button\'s icon:', button.icon)
button.click_func(self, x, y, button.btn_id, False, h_moduleName, h_icon)
break
else:
print('changelevel')
"""
if undo:
history[-1][4] = level
else:
redo_history[-1][4] = level
"""
self.level.setText("Level: " + str(h_level+1))
self.levellist.setCurrentRow(h_level)
self.change_level(False, False, True)

redo_history.append(history.pop(-1)) if undo else history.append(redo_history.pop(-1))
else:
print('No more items to undo!')
winsound.MessageBeep(winsound.MB_ICONEXCLAMATION)

#format | click_func(parent, x, y, btn_id, clicked=True, h_moduleName="None", h_icon='')
#format | history.append((x,y,moduleName,self.icon,level))

print(history)
#format | history.append((x,y,moduleName,self.icon,level), (x,y,moduleName,self.icon,level))

def sideshow(self):
self.gif("icons/sideshow.gif", (350,262,154,103), "SIDESHOW", "icons/ss.ico")
Expand Down Expand Up @@ -1640,6 +1638,9 @@ def gif(self, file, geo, title, icon="icons\icon.ico"):
count_btns = 0
entity_list=[]

save_dict={}
load_dict={}

stored_info_list=[]

prefab_text_list = []
Expand Down Expand Up @@ -1686,7 +1687,27 @@ def gif(self, file, geo, title, icon="icons\icon.ico"):
if %pathtoicon%=="" set pathtoicon=%pathtoexe%,0
REG ADD HKEY_CLASSES_ROOT\%extension%\ /t REG_SZ /d %ftypename% /f
REG ADD HKLM\SOFTWARE\Classes\%ftypename%\DefaultIcon\ /t REG_SZ /d %pathtoicon% /f
ftype %ftypename%=%pathtoexe% "%%1" %%*
ftype %ftypename%=%pathtoexe% "%%1" %%*import pickle
import pprint
import random
import glob
import webbrowser
import wave
import zipfile
import shutil
import winsound
class GridBtn(QWidget):
def __init__(self, parent, x, y, btn_id):
super(GridBtn, self).__init__()
self.button = QPushButton("", parent)
self.x = x
self.y = y
self.btn_id = btn_id
#self.button.move(self.x,self.y)
self.button.resize(32,32)
self.button.setFixedSize(32, 32)
assoc %extension%=%ftypename%
'''
#skyboxlight = '255 255 255 200'
Expand Down Expand Up @@ -1731,6 +1752,8 @@ def gif(self, file, geo, title, icon="icons\icon.ico"):
for item in prefab_list:
globals()[item] = importlib.import_module(item)
print("import", item)
save_dict[item]=eval(item)
load_dict[eval(item)]=item

logo = open('logo.log','r+')
logo_f = logo.readlines()
Expand Down
Binary file modified output/tf2mapperoutput.bsp
Binary file not shown.
5 changes: 0 additions & 5 deletions output/tf2mapperoutput.lin

This file was deleted.

Loading

0 comments on commit bd2d5d6

Please sign in to comment.