forked from id-tech-3-tools/map-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-fast-vis-no-lights.bat
More file actions
138 lines (115 loc) · 3.93 KB
/
Copy pathtest-fast-vis-no-lights.bat
File metadata and controls
138 lines (115 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
@echo off
set parent=%~dp0
cd %parent%
set scriptName=%~n0%~x0
:: ================== SETTINGS ==================
:: You can pre set MAPName, but it's not required.
:: You can pass in filename using command line, type help for usage examples.
:: The map file will be searched in the script(this one) and in the maps directories.
:: You can set this if you want to launch the script by double click.
set MAPName=
:: !IMPORTANT! set Q3MAP path here
set Q3MapPath=
:: !IMPORTANT! set game directory path here
set GameDirectory=
:: !IMPORTANT! correct game name here
:: For instance: q3, et, rtcw; should match the q3map2 -game argument
set GameName=q3
:: No further edits required
:: =================== END ======================
:: Type help to get usage information
if /I "%1" == "help" goto printHelp
if /I "%1" == "-help" goto printHelp
if /I "%1" == "" (
if "%MAPName%" == "" goto printHelp
)
:: Validate vars
if "%Q3MapPath%" == "" (
call :printMissingQ3MapPath
goto atExit
)
if "%GameDirectory%" == "" (
call :printMissingGameDirectoryPath
goto atExit
)
set BaseDirectoryName=baseq3
call :setBaseDirectoryName
set BasePath=%GameDirectory%/%BaseDirectoryName%
:: Find the right map/bsp file
set MapsDirectory=%BasePath%/maps/
if "%~1" == "" (
set MapName=%MAPName%
) else (
set MapName=%~1
)
set MapPath=""
call :findCorrectMapPath
if %MapPath% == "" (
call :printMapFileNotFound
goto atExit
)
:: Compile stages
set BSPStage=-bsp -game %GameName% -fs_basepath "%GameDirectory%" -v -meta
set VisStage=-vis -game %GameName% -fs_basepath "%GameDirectory%" -v -fast -saveprt
:: Print info
echo. & echo.[Settings]
echo Q3MAP: %Q3MapPath%
echo GAME NAME: %GameName%
echo GAME DIRECTORY: %GameDirectory%
echo BASE DIRECTORY: %BaseDirectoryName%
echo MAP PATH: %MapPath%
echo BSP STAGE: %BSPStage%
echo VIS STAGE: %VisStage%
:: Do work
echo. & echo [Convert MAP to BSP]
%Q3MapPath% %BSPStage% "%MapPath%"
echo. & echo [Calculate VIS]
%Q3MapPath% %VisStage% "%MapPath%"
:atExit
echo. & pause
exit 0
:printHelp
echo Basic usage:
echo %scriptName% castle.map
goto atExit
:printMissingQ3MapPath
echo Error: please set Q3Map2 path by editing this file (find Q3MapPath variable)!
exit /B 0
:printMissingGameDirectoryPath
echo Error: Please set game directory path by editing this file (find GameDirectory variable)!
exit /B 0
:printMapFileNotFound
echo Error: %MapName% was not found!
exit /B 0
:setBaseDirectoryName
if "%GameName%" == "q3" set BaseDirectoryName=baseq3
if "%GameName%" == "et" set BaseDirectoryName=etmain
if "%GameName%" == "wolf" set BaseDirectoryName=main
if "%GameName%" == "darkplaces" set BaseDirectoryName=id1
if "%GameName%" == "dq" set BaseDirectoryName=basedq
if "%GameName%" == "ef" set BaseDirectoryName=basee
if "%GameName%" == "etut" set BaseDirectoryName=etut
if "%GameName%" == "ja" set BaseDirectoryName=base
if "%GameName%" == "jk2" set BaseDirectoryName=base
if "%GameName%" == "nexuiz" set BaseDirectoryName=data
if "%GameName%" == "prophecy" set BaseDirectoryName=base
if "%GameName%" == "qfusion" set BaseDirectoryName=base
if "%GameName%" == "quakelive" set BaseDirectoryName=baseq3
if "%GameName%" == "reaction" set BaseDirectoryName=Boomstick
if "%GameName%" == "sof2" set BaseDirectoryName=base
if "%GameName%" == "tenebrae" set BaseDirectoryName=base
if "%GameName%" == "tremulous" set BaseDirectoryName=base
if "%GameName%" == "unvanquished" set BaseDirectoryName=pkg
if "%GameName%" == "xonotic" set BaseDirectoryName=data
exit /B 0
:: search map in cwd
:: search map in game directory
:findCorrectMapPath
if exist "%MapName%" (
set MapPath=%parent%%MapName%
) else (
if exist "%MapsDirectory%%MapName%" set MapPath=%MapsDirectory%%MapName%
)
exit /B 0
:getFileBaseName
set baseName=%~n1