Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
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.

84 lines
1.4 KiB

5 years ago
sub CreateFile
{
local( $filename ) = shift;
local( *FILE );
open FILE, ">$filename";
close FILE;
}
sub ProcessFile
{
local( $filename ) = shift;
local( @fileContents );
# print "$filename\n";
if( $filename =~ /\.vtf/i )
{
return if( $filename =~ /_normal/i );
return if( $filename =~ /_dudv/i );
local( $cmd ) = "..\\..\\..\\bin\\vtfscrew \"$filename\" $r $g $b";
print $cmd . "\n";
system $cmd;
}
}
sub ProcessFileOrDirectory
{
local( $name ) = shift;
# If the file has "." at the end, skip it.
if( $name eq "." || $name eq ".." || $name =~ /\.$/ )
{
# print "skipping: $name\n";
return;
}
# Figure out if it's a file or a directory.
if( -d $name )
{
local( *SRCDIR );
# print "$name is a directory\n";
opendir SRCDIR, $name;
local( @dir ) = readdir SRCDIR;
closedir SRCDIR;
local( $item );
while( $item = shift @dir )
{
&ProcessFileOrDirectory( $name . "/" . $item );
}
}
elsif( -f $name )
{
&ProcessFile( $name );
}
else
{
print "$name is neither a file or a directory\n";
}
return;
}
$baseDirectory = shift;
$r = shift;
$g = shift;
$b = shift;
if( !$baseDirectory )
{
die "Usage: createvmt.pl baseDir";
}
print "baseDirectory = \"$baseDirectory\"\n";
opendir SRCDIR, $baseDirectory;
@dir = readdir SRCDIR;
closedir SRCDIR;
while( $item = shift @dir )
{
&ProcessFileOrDirectory( "$baseDirectory/$item" );
}