Skip to content

Commit bd2d5d6

Browse files
committed
release 1.0.0
1 parent fbca312 commit bd2d5d6

8 files changed

Lines changed: 564 additions & 26875 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Easy TF2 Mapper (late beta 2.8.5)
1+
# Easy TF2 Mapper (release 1.0.0)
22
##in broken state: No.
33
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].
44
### current development branch: master, bugfixes
55
<p>
6-
_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.
6+
_CURRENTLY IN RELEASE 1.0.0. POSSIBLY BUGGY. SEND BUGS TO [email protected]_ This is only for Windows, as Hammer is only for Windows.
77
<p>
88
*READ THE README.TXT AND WIKI FOR INFO*
99
<p>

__pycache__/main.cpython-34.pyc

4.34 KB
Binary file not shown.

main.py

Lines changed: 74 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,16 @@ def click_func(self, parent, x, y, btn_id, clicked=True, h_moduleName="None", h_
5858
global levels
5959
global rotation, currentfilename
6060
global history
61-
62-
#global last_tuple
63-
"""
64-
if last_tuple == 'First':
65-
del last_tuple
66-
last_tuple = ('None',x,y,btn_id,self.icon)
67-
history.append([last_tuple,self.icon])
68-
else:
69-
history.append([last_tuple,self.icon])"""
70-
"""
71-
if self.icon:
72-
history.append(last_tuple)
73-
else:
74-
last_tuple = ("None",x,y,id_num,world_id_num,entity_num,placeholder_list,rotation,level,"")
75-
history.append(last_tuple)"""
61+
global redo_history
7662

7763
#format | history.append((x,y,moduleName,self.icon,level))
7864
if clicked:
65+
redo_history=[]
7966
if self.icon[level]:
8067
moduleName = eval(prefab_list[parent.tile_list.currentRow()])
81-
history.append((x,y,moduleName,self.icon[level],None)) #make work even without rotations enabled
68+
templist=[(x,y,moduleName,self.icon[level],None)]
8269
else:
83-
history.append((x,y,None,None,None))
84-
85-
print(history)
70+
templist=[(x,y,None,None,None)]
8671

8772
def clear_btn(btn_id):
8873
self.button.setIcon(QIcon())
@@ -125,14 +110,18 @@ def clear_btn(btn_id):
125110
self.button.setIcon(QIcon(icon))
126111
self.button.setIconSize(QSize(32,32))
127112
iconlist[level][btn_id] = icon
128-
stored_info_list[level][btn_id] = (moduleName,x,y,id_num,world_id_num,entity_num,placeholder_list,rotation,level)
113+
stored_info_list[level][btn_id] = [moduleName,x,y,id_num,world_id_num,entity_num,placeholder_list,rotation,level]
129114

130115
self.icon[level] = icon
131116
else:
132117
stored_info_list[level][btn_id] = ""
133118

134119
if "*" not in parent.windowTitle():
135120
parent.setWindowTitle("Easy TF2 Mapper* - ["+currentfilename+"]")
121+
122+
if clicked:
123+
templist.append((x,y,moduleName,self.icon[level],None))
124+
history.append(templist)
136125

137126
def checkForCtrl(self, clicked):
138127
if clicked:
@@ -590,7 +579,7 @@ def change_level(self, but = False, up = False, undo = False):
590579
global level, levels
591580

592581
if not undo:
593-
history.append((None,None,None,None,level))
582+
templist = [(None,None,None,None,level)]
594583

595584
if not but:
596585
self.file_save(True)
@@ -618,6 +607,10 @@ def change_level(self, but = False, up = False, undo = False):
618607
self.file_open(True)
619608
self.level.setText("Level: " + str(level+1))
620609
#change grid to grid for level
610+
611+
if not undo:
612+
templist.append((None,None,None,None,level))
613+
history.append(templist)
621614

622615

623616
def rotateCW_func(self):
@@ -761,7 +754,7 @@ def changeIcon(self):
761754

762755

763756
def file_open(self, tmp = False, first = False):
764-
global grid_list, iconlist, level, stored_info_list, totalblocks,entity_list, currentfilename, file_loaded, latest_path
757+
global grid_list, iconlist, level, stored_info_list, totalblocks,entity_list, currentfilename, file_loaded, latest_path,save_dict,load_dict
765758
print(latest_path)
766759
if not tmp:
767760
name = QFileDialog.getOpenFileName(self, "Open File", latest_path,"*.ezm")
@@ -779,9 +772,19 @@ def file_open(self, tmp = False, first = False):
779772
self.grid_change(openlines[0],openlines[1],openlines[2],False, True, True)
780773
elif "stored_info_list" in header:
781774
stored_info_list=[]
775+
stored_info_list_temp=[]
782776
openlines = pickle.load(file)
783777
for item in openlines:
784-
stored_info_list.append(item)
778+
stored_info_list_temp.append(item)
779+
for index,lvl in enumerate(stored_info_list_temp):
780+
stored_info_list.append([])
781+
for info in lvl:
782+
try:
783+
temp = save_dict[info[0]]
784+
info[0] = temp
785+
stored_info_list[index].append(info)
786+
except:
787+
stored_info_list[index].append('')
785788
elif "icon_list" in header:
786789
global grid_list
787790
iconlist=[]
@@ -822,7 +825,7 @@ def file_open(self, tmp = False, first = False):
822825
print(str(e))
823826

824827
def file_save(self, tmp = False, saveAs = False):
825-
global grid_x, grid_y, iconlist, levels, level, currentfilename, file_loaded, latest_path, stored_info_list
828+
global grid_x, grid_y, iconlist, levels, level, currentfilename, file_loaded, latest_path, stored_info_list, save_dict,load_dict
826829
print(latest_path)
827830
gridsize_list = (grid_x,grid_y,levels)
828831
skybox_sav = skybox2_list.currentRow()
@@ -841,7 +844,18 @@ def file_save(self, tmp = False, saveAs = False):
841844
pickle.dump("<grid_size>", file)
842845
pickle.dump(gridsize_list, file)
843846
pickle.dump("<stored_info_list>", file)
844-
pickle.dump(stored_info_list, file)
847+
stored_info_list_temp=[]
848+
for index,lvl in enumerate(stored_info_list):
849+
stored_info_list_temp.append([])
850+
for info in lvl:
851+
print(info)
852+
try:
853+
temp = load_dict[info[0]]
854+
info[0] = temp
855+
stored_info_list_temp[index].append(info)
856+
except:
857+
stored_info_list_temp[index].append('')
858+
pickle.dump(stored_info_list_temp, file)
845859
pickle.dump("<icon_list>", file)
846860
pickle.dump(iconlist, file)
847861
pickle.dump("<skybox>", file)
@@ -867,7 +881,7 @@ def file_save(self, tmp = False, saveAs = False):
867881
def file_export(self,bsp=False):
868882
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
869883
skyboxgeolist = []
870-
skyboxz = QInputDialog.getText(self,("Set Skybox Height"),("Skybox Height(hammer units, %d minimum recommended):" %(levels*512)))
884+
skyboxz = QInputDialog.getText(self,("Set Skybox Height"),("Skybox Height(hammer units, %d minimum recommended):" %(levels*512)), QLineEdit.Normal, "%d" %(levels*512))
871885
try:
872886
skyboxz = int(skyboxz[0])
873887
except:
@@ -958,7 +972,6 @@ def file_export(self,bsp=False):
958972
if popup.clickedButton() == exitButton:
959973
popup.deleteLater()
960974
cur_vmf_location = name[0]
961-
print('not bsp vmf part done')
962975
else:
963976
file = open('output/tf2mapperoutput.vmf','w+')
964977
totalblocks =[]
@@ -996,7 +1009,7 @@ def file_export(self,bsp=False):
9961009
file.write(wholething)
9971010
file.close()
9981011
cur_vmf_location = 'output/tf2mapperoutput.vmf'
999-
print('bsp vmf part done')
1012+
10001013

10011014

10021015
def file_export_bsp(self):
@@ -1565,43 +1578,28 @@ def console_enter(self):
15651578

15661579
def undo(self, undo):
15671580
if history if undo else redo_history:
1568-
x = history[-1][0] if undo else redo_history[-1][0]
1569-
y = history[-1][1] if undo else redo_history[-1][1]
1570-
h_moduleName = history[-1][2] if undo else redo_history[-1][2]
1571-
h_icon = history[-1][3] if undo else redo_history[-1][3]
1572-
h_level = history[-1][4] if undo else redo_history[-1][4]
1581+
x = history[-1][0][0] if undo else redo_history[-1][1][0]
1582+
y = history[-1][0][1] if undo else redo_history[-1][1][1]
1583+
h_moduleName = history[-1][0][2] if undo else redo_history[-1][1][2]
1584+
h_icon = history[-1][0][3] if undo else redo_history[-1][1][3]
1585+
h_level = history[-1][0][4] if undo else redo_history[-1][1][4]
15731586

15741587
if h_level == None:
15751588
for button in grid_list:
15761589
if button.x == x and button.y == y:
1577-
"""if undo:
1578-
history[-1][3] = button.icon
1579-
else:
1580-
redo_history[-1][3] = button.icon"""
1581-
print('button\'s icon:', button.icon)
15821590
button.click_func(self, x, y, button.btn_id, False, h_moduleName, h_icon)
15831591
break
15841592
else:
1585-
print('changelevel')
1586-
"""
1587-
if undo:
1588-
history[-1][4] = level
1589-
else:
1590-
redo_history[-1][4] = level
1591-
"""
15921593
self.level.setText("Level: " + str(h_level+1))
15931594
self.levellist.setCurrentRow(h_level)
15941595
self.change_level(False, False, True)
1595-
1596+
15961597
redo_history.append(history.pop(-1)) if undo else history.append(redo_history.pop(-1))
15971598
else:
1598-
print('No more items to undo!')
15991599
winsound.MessageBeep(winsound.MB_ICONEXCLAMATION)
16001600

16011601
#format | click_func(parent, x, y, btn_id, clicked=True, h_moduleName="None", h_icon='')
1602-
#format | history.append((x,y,moduleName,self.icon,level))
1603-
1604-
print(history)
1602+
#format | history.append((x,y,moduleName,self.icon,level), (x,y,moduleName,self.icon,level))
16051603

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

1641+
save_dict={}
1642+
load_dict={}
1643+
16431644
stored_info_list=[]
16441645

16451646
prefab_text_list = []
@@ -1686,7 +1687,27 @@ def gif(self, file, geo, title, icon="icons\icon.ico"):
16861687
if %pathtoicon%=="" set pathtoicon=%pathtoexe%,0
16871688
REG ADD HKEY_CLASSES_ROOT\%extension%\ /t REG_SZ /d %ftypename% /f
16881689
REG ADD HKLM\SOFTWARE\Classes\%ftypename%\DefaultIcon\ /t REG_SZ /d %pathtoicon% /f
1689-
ftype %ftypename%=%pathtoexe% "%%1" %%*
1690+
ftype %ftypename%=%pathtoexe% "%%1" %%*import pickle
1691+
import pprint
1692+
import random
1693+
import glob
1694+
import webbrowser
1695+
import wave
1696+
import zipfile
1697+
import shutil
1698+
import winsound
1699+
1700+
class GridBtn(QWidget):
1701+
def __init__(self, parent, x, y, btn_id):
1702+
super(GridBtn, self).__init__()
1703+
self.button = QPushButton("", parent)
1704+
self.x = x
1705+
self.y = y
1706+
self.btn_id = btn_id
1707+
#self.button.move(self.x,self.y)
1708+
self.button.resize(32,32)
1709+
self.button.setFixedSize(32, 32)
1710+
16901711
assoc %extension%=%ftypename%
16911712
'''
16921713
#skyboxlight = '255 255 255 200'
@@ -1731,6 +1752,8 @@ def gif(self, file, geo, title, icon="icons\icon.ico"):
17311752
for item in prefab_list:
17321753
globals()[item] = importlib.import_module(item)
17331754
print("import", item)
1755+
save_dict[item]=eval(item)
1756+
load_dict[eval(item)]=item
17341757

17351758
logo = open('logo.log','r+')
17361759
logo_f = logo.readlines()

output/tf2mapperoutput.bsp

-2.65 MB
Binary file not shown.

output/tf2mapperoutput.lin

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)