#!/usr/bin/perl -w

# (c) Copyright by Tels 1999. All Rights Reserved.

# [09/30/99] v0.0.2 - new bend routine in basics
# 2000-01-17 v0.0.3 - revised to new texture methods

use Cowgen::Bunch;                  # for a bunch of brushes
use Cowgen::Dromed;                 # for some Thief constants and specifics
use Cowgen::Texture;                # to get texture mappings
use Cowgen::Architecture::Basics;  
use Cowgen::Architecture::Building;  
use Cowgen::Gamfile;

print "Demo script to show creation of windows/arms/hallway\n\n";

$vbr = Cowgen::Vbr->create("houses.mis");
$core = Cowgen::Texture->create($vbr->getTXT());

# get commandline parameter
$outfile = shift || "bend.mis";

my $bunch = Cowgen::Bunch->create("Bending around gravity");

my $wood = $core->texture("planks");
my $stone = $core->texture("rufgr");
my $floor = $core->texture("tile");
my $floor2 = $core->texture("mosaic");
$bunch->setDefTexture($stone);
print "Using ",$core->textureLName($wood);
print " and ",$core->textureLName($stone),".\n";

# round hallway
$bunch->addBrush (air()+mroom(),cube(),-40+25,44+25,-4, 50,50,16,$floor,0,0,0,$stone,$floor2);
$bunch->merge( bendHallway (-40,44,-4, 50, 40, 16, 270, 345, 32, 0, 0.5, $stone, $floor2) );

# round room
$bunch->merge( outerBend (0,0,0, 40, 32, 0, 360, 24, basroom(), 1, $stone,$wood) );
$bunch->merge( innerBend (40,0,0, 20, 32, 0, 360, 32, 0 , 0.5, $stone,$wood) );

#$bunch->merge( outerSpiral (-120,0,0, 90, 30, 24, 0, 270, 36, 0, 0.5, $stone,$wood) );
#$bunch->merge( innerSpiral (-120,0,0, 80, 20, 24, 0, 270, 36, 0, 0.5, $stone,$wood) );

# tunnel ends
$bunch->addBrush (solid,cube(), -9,0,0, 17, 2 ,17, $floor,0,0,0);
$bunch->addBrush (solid,cube(), -26,0,0, 21, 2 ,21,$floor,0,0,0);

# tunnels
$bunch->merge( tunnel(-2,0,-4,roundtop()+roundbottom(),1,1,16,0,0,6,$stone) ); 
$bunch->merge( tunnel(-18,0,0,roundtop()+roundbottom(),2,2,16,4,0,4,$wood) ); 
$bunch->merge( tunnel(-34,0,0,roundtop()+roundbottom(),2,2,16,0,6,2,$floor) ); 

# connection
$bunch->addBrush (solid,cube(),-40+50-5,44-5,-4, 10,12,18,$floor,0,0,0,$stone,$floor2);
$bunch->addBrush (air()+mroom(),cube(),-40+50-5,44-5,-4, 10,10,16,$floor,0,0,0,$stone,$floor2);

$bunch->autoRoom();
print "There are now ",$bunch->numBrushes()," brushes and ",$bunch->numRooms()
  ," rooms in the bunch.\n";
my $gf = Cowgen::Gamfile->create(); # use dark.gam
$vbr->missionEAX ( eax => eax_stoneRoom() );
$vbr->renderParams ( ambient => 20 ); # always use this!
$vbr->saveMission($gf,$bunch,$outfile);
print "Done.\n";

# EOF

1;
