@echo off
echo PAINKEEP 1.1 to 1.11 patch update
echo http://www.planetquake.com/skins/painkeep
echo -----------------------------------------
echo This patch file and ALL files contained in the PainKeep 1.11 update MUST
echo be located and executed from the directory where PainKeep 1.1 is installed.
echo If this is not the case, hit CTRL-C and stop this now.  Otherwise, hit any 
echo key to begin
echo:
pause
echo This may take a while.... be patient
echo:
xpak -e pak0.pak *.bsp
data -d -o -spk111
cd maps
for %%f in (*.bsp) do ..\bspalign %%f
cd ..
echo:
echo Rebuilding PAK file ... This can also take a really long time.
echo:
xpak -a pak0.pak maps\*.bsp
xpak -a pak0.pak progs\*.*
echo:
echo Cleaning up...
rem We do this the dumb way to make sure we only delete our files and nothing the user wants to keep.  Using RD to remove the directory will fail if any files we didn't place are present.  
DEL MAPS\B_ESHEL0.BSP
DEL MAPS\START.BSP
DEL MAPS\PAINKEEP.BSP
DEL MAPS\PK0.BSP
DEL MAPS\PK1.BSP
DEL MAPS\PK2.BSP
DEL MAPS\PK3.BSP
DEL MAPS\PK4.BSP
DEL MAPS\PK5.BSP
DEL MAPS\PK6.BSP
DEL MAPS\PK7.BSP
DEL MAPS\PK8.BSP
DEL MAPS\PK9.BSP
DEL MAPS\PK10.BSP
DEL MAPS\PK11.BSP
DEL MAPS\PK12.BSP
DEL MAPS\PK13.BSP
DEL MAPS\PK14.BSP
DEL MAPS\PK15.BSP
DEL MAPS\PK16.BSP
DEL MAPS\PK17.BSP
DEL MAPS\PK18.BSP
RD MAPS
DEL PROGS\BEANS.MDL
DEL PROGS\BEARBLD.MDL
DEL PROGS\BEARGIB1.MDL
DEL PROGS\BEARGIB2.MDL
DEL PROGS\BEARGIB3.MDL
DEL PROGS\BEARGIB4.MDL
DEL PROGS\BEARPICK.MDL
DEL PROGS\BEARTRAP.MDL
DEL PROGS\BOLT3.MDL
DEL PROGS\CANDLE.MDL
DEL PROGS\CUBE.MDL
DEL PROGS\CUBEL.MDL
DEL PROGS\CUBSMALL.MDL
DEL PROGS\FRYGUY.MDL
DEL PROGS\G_AIRGUN.MDL
DEL PROGS\G_ARM.MDL
DEL PROGS\G_BOOT.MDL
DEL PROGS\G_CLIGHT.MDL
DEL PROGS\G_EYE.MDL
DEL PROGS\G_FNAIL.MDL
DEL PROGS\G_FORE.MDL
DEL PROGS\G_HARP.MDL
DEL PROGS\G_LEG.MDL
DEL PROGS\HARPCOIL.MDL
DEL PROGS\HARPOON.MDL
DEL PROGS\HARPROPE.MDL
DEL PROGS\NAIL.MDL
DEL PROGS\PLAYER.MDL
DEL PROGS\PNAIL.MDL
DEL PROGS\QTGIB1.MDL
DEL PROGS\QTGIB2.MDL
DEL PROGS\QTGIB3.MDL
DEL PROGS\SPARKS.SPR
DEL PROGS\S_ABLAST.SPR
DEL PROGS\S_DRIP.SPR
DEL PROGS\S_SPLASH.SPR
DEL PROGS\S_SPLAVA.SPR
DEL PROGS\TPOWER.MDL
DEL PROGS\TURGIB1.MDL
DEL PROGS\TURGIB2.MDL
DEL PROGS\TURGIB3.MDL
DEL PROGS\TURSTAND.MDL
DEL PROGS\TURTOP.MDL
DEL PROGS\V_AIRGUN.MDL
DEL PROGS\V_BEANS.MDL
DEL PROGS\V_BEAR.MDL
DEL PROGS\V_CL_OFF.MDL
DEL PROGS\V_CL_ON.MDL
DEL PROGS\V_CUBE.MDL
DEL PROGS\V_ESHOT.MDL
DEL PROGS\V_ESHOT2.MDL
DEL PROGS\V_FNAIL.MDL
DEL PROGS\V_HARP.MDL
DEL PROGS\V_TURRET.MDL
DEL PROGS\X_EXPLO1.SPR
DEL PROGS\X_EXPLO2.SPR
DEL PROGS\ZOMBIE2.MDL
DEL PROGS\ZOMBIE3.MDL
RD PROGS
DEL XPAK.EXE
DEL BSPALIGN.EXE
DEL BSPALIGN.C
DEL DATA.EXE
echo Update to PainKeep 1.11 completed!
echo:
if exist glquake\nul goto glfnd
echo You will receive an error message now, we are deleting the batch file.  This is 
echo caused by deleting this open file.  It is normal and part of the cleanup.
echo:
del patch.bat
goto end
:glfnd
echo Now removing glQuake mesh files from previous version of PainKeep.  Don't worry, glQuake
echo will rebuild these once you restart glQuake.  Answer Yes to delete the files.
del glquake
echo:
echo You will receive an error message now, we are deleting the batch file.  This is 
echo caused by deleting this open file.  It is normal and part of the cleanup
echo:
del patch.bat
:end
