Advertisement
Guest User

Untitled

a guest
Oct 21st, 2011
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. REM halo configuration
  4. set TARGET_FILE=main\textures\BaboHalo.tga
  5. set SOURCE_DIR=main\textures\halos\
  6. set SOURCE_FILE=Classic.tga
  7. set OBJ_NAME=Classic Pro Client
  8.  
  9. REM run-time configuration
  10.  
  11. REM construct babo path
  12. set BABO_PATH=%~dp0..\..\
  13. REM switch drive
  14. %~d0
  15. REM change directory
  16. cd %BABO_PATH%
  17. REM set text color
  18. color 0c
  19. REM clear screen
  20. cls
  21.  
  22. echo Babo Violent 2 Prozac Mod (halo switcher)
  23. echo.
  24.  
  25. REM check for halos folder
  26. if exist "%BABO_PATH%%SOURCE_DIR%" goto check_source
  27.  
  28. echo Halos folder not found.
  29. goto suggestion
  30.  
  31. :check_source
  32. REM check for halo itself
  33. if exist "%BABO_PATH%%SOURCE_DIR%%SOURCE_FILE%" goto check_target
  34.  
  35. :source_not_found
  36. echo Prozac style halo texture file (%BABO_PATH%%SOURCE_DIR%%SOURCE_FILE%) not found.
  37. goto suggestion
  38.  
  39. :check_target
  40. REM if working halo texture already exists,
  41. REM there's check if it is already Prozac style
  42. if not exist "%BABO_PATH%%TARGET_FILE%" goto copy_file
  43.  
  44. fc "%BABO_PATH%%TARGET_FILE%" "%BABO_PATH%%SOURCE_DIR%%SOURCE_FILE%" > nul
  45. if errorlevel 1 goto copy_file
  46. REM pring error message
  47. echo You're already using %OBJ_NAME% halos.
  48. echo.
  49. pause
  50. goto self_rename
  51.  
  52. :copy_file
  53. echo CAUTION:
  54. echo You're going to switch halos to %OBJ_NAME%.
  55. echo You may cancel switching by closing this window, if you've changed your mind.
  56. echo.
  57. echo Press any key to set %OBJ_NAME% halos...
  58. pause>nul
  59.  
  60. REM clear file attributes
  61. attrib -H -S -R "%BABO_PATH%%TARGET_FILE%" > nul
  62.  
  63. REM trying xcopy
  64. xcopy "%BABO_PATH%%SOURCE_DIR%%SOURCE_FILE%" "%BABO_PATH%%TARGET_FILE%" /V /Q /G /H /R /Y
  65. echo.
  66.  
  67. REM 9009 = "file not found"
  68. if errorlevel 9009 goto use_copy
  69.  
  70. REM 1 = No files were found to copy.
  71. if errorlevel 1 goto source_not_found
  72.  
  73. REM 2 = The user pressed CTRL+C to terminate xcopy.
  74. if not errorlevel 2 goto is_other_error
  75. echo You have terminated %OBJ_NAME% halos installation!
  76. echo.
  77. pause
  78. goto term
  79.  
  80. :is_other_error
  81. if not errorlevel 0 goto xcopy_error
  82. echo %OBJ_NAME% halos is successfully set!
  83. goto new_halos
  84.  
  85. :xcopy_error
  86. echo %errorlevel%
  87. echo.
  88. echo Unexpected error (%errorlevel%) occured.
  89. echo Please make screenshots and contact <ketamine@warlabs.ru>
  90. echo.
  91. pause
  92. goto term
  93.  
  94.  
  95. :use_copy
  96. REM this routine is using 'copy' command to replace halo file
  97. REM sadly, copy doesn't set errorlevel, so we'll never know if it was successful
  98. echo Note: Xcopy utility not found.
  99. echo Nothing to be worried for, but we'll use old school 'copy' command.
  100. echo.
  101. REM use plain copy with every possibly useful switch set
  102. copy /B /D /V /Y "%BABO_PATH%%SOURCE_DIR%%SOURCE_FILE%" "%BABO_PATH%%TARGET_FILE%" > nul
  103. echo.
  104. echo If you see "1 file(s) copied" string above, everything is fine.
  105. goto new_halos
  106.  
  107. :new_halos
  108. echo Run bv2launcher.exe (the one with red icon) to check your new halos!
  109. echo.
  110. pause
  111. goto self_rename
  112.  
  113. :self_rename
  114. REM rename self just before exit
  115. REM nothing below next line will be executed
  116.  
  117. REM return to own folder
  118. cd Customization\Halos
  119.  
  120. REM determine own name without extension
  121. set SELF_NAME=%~n0
  122.  
  123. REM search for files with "(Active)" in their name
  124. REM call :for_each
  125. for %%f in (*Active?.cmd) do call :for_each "%%f"
  126.  
  127. REM wiping out "(Active)" tag from own filename
  128. set NEW_NAME=%SELF_NAME: (Active)=%
  129. color 07
  130.  
  131. REM no need to rename if already tagged
  132. if not "%NEW_NAME%"=="%SELF_NAME%" goto :eof
  133.  
  134. REM hard way, because 'rename' bugs when trying to rename oneself
  135. copy %0 "%SELF_NAME% (Active).cmd">nul
  136. del %0>nul
  137.  
  138. REM "The batch file cannot be found."
  139. goto :term
  140.  
  141. REM start :for_each
  142. :for_each
  143. REM skip empty rows
  144. if [%1]==[] goto :eof
  145.  
  146. REM skip self
  147. set TEST_NAME="%~n1"
  148. if %TEST_NAME%==%SELF_NAME% goto :eof
  149.  
  150. REM fix name
  151. set NEW_NAME=%TEST_NAME: (Active)=%.cmd
  152.  
  153. REM rename file
  154. ren %1 %NEW_NAME%>nul
  155.  
  156. REM skipping to the end of file to jump into next iteration
  157. goto :eof
  158. REM end :for_each
  159.  
  160. :suggestion
  161. echo.
  162. echo Probably you should download fresh Prozac copy from http://prozac.warlabs.ru.
  163. echo Unpack it into different directory and copy your config file (main\bv2.cfg).
  164. echo.
  165. pause
  166. goto :term
  167.  
  168.  
  169. :term
  170. color 07
  171.  
  172.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement