Skip to content

Commit

Permalink
navmesh compiling, fix cubemaps compiler maybe
Browse files Browse the repository at this point in the history
propper changes
  • Loading branch information
Python1320 committed Jun 8, 2017
1 parent bf78795 commit 984fc8c
Show file tree
Hide file tree
Showing 7 changed files with 424 additions and 356 deletions.
11 changes: 10 additions & 1 deletion LAUNCH compile.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@set VRADHDR=-softsun 15 -bounce 32 -final
@set VRADHDR=-softsun 25 -bounce 24
@rem -StaticPropSampleScale 0.25 -StaticPropLighting
@rem @set VRADHDR=-softsun 15 -bounce 32 -StaticPropPolys -StaticPropLighting -final
@rem todo move to configs
@set VRADLDR=%VRADHDR%
Expand Down Expand Up @@ -263,10 +264,18 @@ call extras\gmodcommander.cmd cubemaps_ldr "%mapname%"
@if ERRORLEVEL 1 goto failed
@cd /d "%CMD_LC_ROOT%"

:navmesh
@echo ================= Generating navmesh =================
@cd /d "%CMD_LC_ROOT%"
@call extras\gmodcommander.cmd navmesh "%mapname%"
@if ERRORLEVEL 1 goto failed
@cd /d "%CMD_LC_ROOT%"


@echo ================= bzip2 Packing =================
start /low /min bzip2 -kf -9 "%GameDir%\maps\%mapname%.bsp"
start /low /min bzip2 -kf -9 "%GameDir%\maps\graphs\%mapname%.ain"
start /low /min bzip2 -kf -9 "%GameDir%\maps\%mapname%.nav"

@echo ================= TESTING MAP (HDR) =================

Expand Down
12 changes: 8 additions & 4 deletions LAUNCH propperall.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
@title Propper Batch Compiler

@set QC_STORAGE=%mapfolder%\propper

@set VBSPNAME=vbsp_propper
@call config.bat
@cd /d "%CMD_LC_ROOT%"

@%VBSPNAME% >nul 2>nul
@if ERRORLEVEL 9009 goto nofound
@goto found
Expand All @@ -22,7 +24,10 @@
:found
@cd /d "%mapfolder%\propper"
@echo.
@for /r %%i in (*.vmf) do %VBSPNAME% %%i > "%%i.log"
@for /r %%i in (*.vmf) do @(
@echo Processing %%i
@%VBSPNAME% %%i > "%%i.log"
)
@if ERRORLEVEL 1 goto failed
@goto win

Expand All @@ -36,12 +41,11 @@





:win
@echo =======================
@echo ====== FINISHED =======
@echo =======================
@pause > nul

@goto gtfo

Expand Down
35 changes: 20 additions & 15 deletions extras/build_cubemaps.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
if GetConVar("con_nprint_bgalpha"):GetString()=="cubemaps" then

local i=120
hook.Add("Think","agwegwegg",function()
i=i-1
if i>0 then return end

hook.Remove("Think","agwegwegg")
RunConsoleCommand"bcmaps"
hook.Add("ShutDown","agwegwegg",function()
print"Quitting..."

FindMetaTable"Player".ConCommand(nil,"exitgame",true)
end)
end)
if GetConVar("con_nprint_bgalpha"):GetString()=="cubemaps" then

local i=120
hook.Add("Think","agwegwegg",function()
i=i-1
if i>0 then return end

hook.Remove("Think","agwegwegg")
RunConsoleCommand"bcmaps"
print"\n!!!!!BUILDING CUBEMAPS!!!!!!!!\n"
hook.Add("ShutDown","agwegwegg",function()
print"Quitting..."

FindMetaTable"Player".ConCommand(nil,"exitgame",true)
end)
timer.Simple(1,function() print"cubemaps built test?" end)
timer.Simple(60*2,function()
FindMetaTable"Player".ConCommand(nil,"exitgame",true)
end)
end)
end
111 changes: 59 additions & 52 deletions extras/gmodcommander.cmd
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
@cd /d "%~dp0"
@cd ..
@call config.bat
@cd /d "%~dp0"



copy /Y build_cubemaps.lua "%GameDir%"\lua\autorun\client\build_cubemaps.lua > nul
@if ERRORLEVEL 1 goto fail

copy /Y gmodcommander.cfg "%GameDir%"\cfg\gmodcommander.cfg > nul
@if ERRORLEVEL 1 goto fail

copy /Y mapcomp_write_missing.lua "%GameDir%"\lua\autorun\client\mapcomp_write_missing.lua > nul
@if ERRORLEVEL 1 goto fail

@cd /D %GameExeDir%
@If "%1"=="missing" @goto missing
@If "%1"=="cubemaps_ldr" @goto cubemaps_ldr
@If "%1"=="cubemaps_hdr" @goto cubemaps_hdr

@echo "Unknown task: %1"
@exit 1
@goto out

:missing
start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -dev -disableluarefresh -insecure -nohltv -condebug -textmode -toconsole +map %2 +alias "exitgame quit" +con_nprint_bgalpha writemissing
@goto win

:cubemaps_ldr
@rem start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 -buildcubemaps
start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
@goto win

:cubemaps_hdr
@rem start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 -buildcubemaps
start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
@goto win

@goto win
:fail
@echo SUBTASK FAILED
@pause > nul
@goto out

:win
@echo Subtask finished
@goto out

:out
@rem @del "%GameDir%"\lua\autorun\client\build_cubemaps.lua
@del "%GameDir%"\lua\autorun\client\mapcomp_write_missing.lua
@cd /d "%~dp0"
@cd ..
@call config.bat
@cd /d "%~dp0"



copy /Y build_cubemaps.lua "%GameDir%"\lua\autorun\client\build_cubemaps.lua > nul
@if ERRORLEVEL 1 goto fail

copy /Y gmodcommander.cfg "%GameDir%"\cfg\gmodcommander.cfg > nul
@if ERRORLEVEL 1 goto fail

copy /Y mapcomp_write_missing.lua "%GameDir%"\lua\autorun\client\mapcomp_write_missing.lua > nul
@if ERRORLEVEL 1 goto fail

copy /Y navmesh.lua "%GameDir%"\lua\autorun\server\navmesh.lua > nul
@if ERRORLEVEL 1 goto fail

@cd /D %GameExeDir%
@If "%1"=="missing" @goto missing
@If "%1"=="cubemaps_ldr" @goto cubemaps_ldr
@If "%1"=="navmesh" @goto navmesh
@If "%1"=="cubemaps_hdr" @goto cubemaps_hdr

@echo "ERROR: Unknown task: %1"
@goto out

:missing
start /wait /min hl2.exe -game "%GameDir%" -multirun -disableluarefresh -noworkshop -windowed %GCNOADDONS% -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha writemissing
@goto win

:cubemaps_ldr
@rem start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 -buildcubemaps
start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -noworkshop %GCNOADDONS% -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 0 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
@goto win

:cubemaps_hdr
@rem start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 -buildcubemaps
start /wait /min hl2.exe -game "%GameDir%" -multirun -w 1024 -h 768 -noworkshop %GCNOADDONS% -windowed -console -disableluarefresh -insecure -nohltv -condebug -toconsole +map %2 +sv_cheats 1 +mat_hdr_level 2 +mat_specular 0 +exec gmodcommander +con_nprint_bgalpha cubemaps
@goto win

:navmesh
start /wait /min hl2.exe -game "%GameDir%" -multirun -console -noworkshop %GCNOADDONS% -windowed -disableluarefresh -insecure -nohltv -condebug -textmode -toconsole +map %2 +exec gmodcommander +con_nprint_bgalpha navmesh
@goto win

@goto win
:fail
@echo SUBTASK FAILED
@pause > nul
@goto out

:win
@echo Subtask finished
@goto out

:out
@rem @del "%GameDir%"\lua\autorun\client\build_cubemaps.lua
@rem del "%GameDir%"\lua\autorun\client\mapcomp_write_missing.lua
44 changes: 44 additions & 0 deletions extras/navmesh.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if GetConVar("con_nprint_bgalpha"):GetString()~="navmesh" then return end

local i=68
hook.Add("Think","agwegwegg",function()
i=i-1
if i>0 then return end
hook.Remove("Think","agwegwegg")

print"\n!!!!!BUILDING NAVMESH!!!!!!!!\n"

if not navmesh.IsLoaded() then navmesh.Load() end

if navmesh.IsLoaded() then
print"navmesh found, leaving..."
RunConsoleCommand("exitgame")
return
end

--TODO
local f = file.Read("navmesh_seed.txt",'DATA')
for v in (f or ""):gmatch'[^\r\n]+' do
if v and v:find"%d %d" then
print("seeding",v,navmesh.AddWalkableSeed(Vector(v),Vector(0,0,1)))
end
end
print("begin",navmesh.BeginGeneration())

hook.Add("ShutDown","agwegwegg",function()
print"Quitting...?"

RunConsoleCommand("exitgame")

end)
timer.Simple(1,function() print"built test?" end)
timer.Simple(60*2,function()
hook.Add("Think",'agwegwegg',function()
if navmesh.IsGenerating() then return end
hook.Remove("Think","agwegwegg")
print("save",navmesh.Save())
RunConsoleCommand("exitgame")
end)

end)
end)
Loading

0 comments on commit 984fc8c

Please sign in to comment.