Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.4 KiB

  1. sub CreateFile
  2. {
  3. local( $filename ) = shift;
  4. local( *FILE );
  5. open FILE, ">$filename";
  6. close FILE;
  7. }
  8. sub ProcessFile
  9. {
  10. local( $filename ) = shift;
  11. local( @fileContents );
  12. # print "$filename\n";
  13. if( $filename =~ /\.vtf/i )
  14. {
  15. return if( $filename =~ /_normal/i );
  16. return if( $filename =~ /_dudv/i );
  17. local( $cmd ) = "..\\..\\..\\bin\\vtfscrew \"$filename\" $r $g $b";
  18. print $cmd . "\n";
  19. system $cmd;
  20. }
  21. }
  22. sub ProcessFileOrDirectory
  23. {
  24. local( $name ) = shift;
  25. # If the file has "." at the end, skip it.
  26. if( $name eq "." || $name eq ".." || $name =~ /\.$/ )
  27. {
  28. # print "skipping: $name\n";
  29. return;
  30. }
  31. # Figure out if it's a file or a directory.
  32. if( -d $name )
  33. {
  34. local( *SRCDIR );
  35. # print "$name is a directory\n";
  36. opendir SRCDIR, $name;
  37. local( @dir ) = readdir SRCDIR;
  38. closedir SRCDIR;
  39. local( $item );
  40. while( $item = shift @dir )
  41. {
  42. &ProcessFileOrDirectory( $name . "/" . $item );
  43. }
  44. }
  45. elsif( -f $name )
  46. {
  47. &ProcessFile( $name );
  48. }
  49. else
  50. {
  51. print "$name is neither a file or a directory\n";
  52. }
  53. return;
  54. }
  55. $baseDirectory = shift;
  56. $r = shift;
  57. $g = shift;
  58. $b = shift;
  59. if( !$baseDirectory )
  60. {
  61. die "Usage: createvmt.pl baseDir";
  62. }
  63. print "baseDirectory = \"$baseDirectory\"\n";
  64. opendir SRCDIR, $baseDirectory;
  65. @dir = readdir SRCDIR;
  66. closedir SRCDIR;
  67. while( $item = shift @dir )
  68. {
  69. &ProcessFileOrDirectory( "$baseDirectory/$item" );
  70. }