changeset 305:8c9b9156a235 misc

Improve TF data output.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 29 Dec 2015 04:52:49 +0200
parents 5f5f45216218
children 1a6f435a1e4d
files materials/parsematerial.pl
diffstat 1 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/materials/parsematerial.pl	Tue Dec 29 04:51:22 2015 +0200
+++ b/materials/parsematerial.pl	Tue Dec 29 04:52:49 2015 +0200
@@ -279,6 +279,20 @@
     "slab" => 48,
     "flare" => 49,
   },
+
+  99 => {
+    "Organic" => 0,
+    "Cloth" => 1,
+    "Paper" => 2,
+    "Bone" => 3,
+    "Metal" => 4,
+    "Wood" => 5,
+    "Stone" => 6,
+    "Alloy" => 7,
+    "Inorganic" => 8,
+    "Glass" => 9,
+    "Gem" => 10,
+  },
 );
 
 my %revTransTable = ();
@@ -592,14 +606,15 @@
 ###
 elsif ($opt_mode eq "-tf")
 {
-  print "/set gmat_names=".join(' ', @entries)."\n";
-  print "/set gmat_ntypes=".join(' ', map(lc(pt($$data{$_},16)), @entries))."\n";
-  print "/set gmat_types=".join(' ', map(lc(ptranslate(16,$_)), values %matTypes))."\n";
-  
-  foreach my $type (values %matTypes)
+  print "/set gmat_names=".join(' ', map { my $tmp = $_; $tmp =~ s/ /_/g; $tmp } @entries)."\n";
+  print "/set gmat_ntypes=".join(' ', map(lc(ptranslate(99,$$data{$_}{16})), @entries))."\n";
+  print "/set gmat_types=".join(' ', sort map(lc(ptranslate(99,$_)), values %matTypes))."\n";
+
+  foreach my $mkey (sort keys %matTypes)
   {
+    my $type = $matTypes{$mkey};
     print "/set gmat_type_".
-      lc(ptranslate(16, $type))."=".
+      lc(ptranslate(99, $type))."=".
       join('|', @{$matByType{$type}})."\n";
   }
 }