# !/usr/bin/perl -w

# 2000-04-17 0.0.1 first version

# scratch file to test reading/writing/compressing/converting of texture
# palettes. will be included in convert/strip

$VERSION = '0.01';
$| = 1; # disable out buffer

use Cowgen::Dromed;    # for some Thief constants and specifics
use Cowgen::Texture;   # texture stuff
use Cowgen::Vbr;
use Cowgen::Bunch;

print "TXT palette script (c) Copyright by Tels 1999-2000. All Rights Reserved.\n\n";
print "Usage: perl input.mis [output.mis]\n";

# get commandline parameter
$infile = shift || "in.mis"; 
$outfile = shift || "out.mis"; 

print "Reading '$infile' ...\n";
my ($vbr,$gf,$bunch,$txt) = Cowgen::Vbr::loadMission ($infile,"Thief.gam");

# get hash with number => 'family/name' mapping
$txthash = $txt->asHash();

foreach (sort { $a <=> $b } keys %$txthash)
  {
  print "$_ => $txthash->{$_}\n";
  }

# put back in
$vbr->texturePalette ( $txthash );

print "Writing to '$outfile' ...";
$vbr->saveMission($gf,$b,$outfile);

print " done, enjoy '$outfile'!\n";

# EOF
1;

