#!/usr/bin/perl
use lib '.';
require "pagelib.pl";
header();
head();

$dir = "images/parv/final";
$dir2 = "images/parv/building";
#if(!opendir(DIR,$dir)) {
#    print "Internal error locating images!<br>\n";
#}
#@files = readdir(DIR);
#foreach(@files) { push @images,$1 if(!/_th\.jpg/ && /^(.*)\.jpg/); }
#%used2 = ();
#if(!opendir(DIR,$dir2)) {
#    print "Internal error locating images!<br>\n";
#}
#@files2 = readdir(DIR);
#foreach(@files2) { push @images2,$1 if(!/_th\.jpg/ && /^(.*)\.jpg/); }
#%used = ();

print qq`
<br><br>
<B><font size=+1>The P.A.R.V.</font></B><br>
`;
nav();
print "<br>\n";
if($params{area} eq "out") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>Outside</b></div><br>
The front of the PARV doesn't feature all that much, but it does have two access
panels for the drive motors, as well as a walk-through storage closet (containing
replacement wheels) that connects to the first level. And above, you can see through
the large windows into the bridge.`;
    show_images('out_front_05','out_front_06','out_front_07','out_front_01','out_front_08','out_front_09','out_front_03');
    print qq`The exterior sides are where all the action is. There are main entry
doors, access panels, hoses, spare treads, a connection opening, winches, ladders,
and just general greebles.`;
    show_images('out_side_01','out_side_02','out_side_06','out_side_07');
    print qq`Most of the exterior doors slide in and out, but these required little
ramps to connect with the ground below`;
    show_images('out_door_02','out_door_01','out_door_03');
    print qq`Right next to the side doors are serveral hoses and an access panel.
They're intended to be for water and power, with a 3rd for connecting to air, although
the physical limits of the MOC prevented me from getting a 3rd set of large hoses into
the small space, so the air "hose" got rather simplified.`;
    show_images('out_side_05','out_hoses_01','out_hoses_02');
    print qq`Like some tanks, the PARV features spare treads on the sides, which (given
their size) would be rather impractical for minifigs to carry around, but they'll just
have to cross that bridge when they come to it.`;
    show_images('out_side_08','out_treads_01','out_tread_01');
    print qq`The intent behind the PARV was that it could "connect" to other similar
vehicles. So with that in mind, there's a connector that leads right into the 2nd level
of the PARV.`;
    show_images('out_connect_01','out_connect_05','out_connect_04','out_connect_03','out_connect_02');
    print qq`The rear of the vehicle features a ramp for the Badger to roll out of. And
just within the doors are a couple more handy winches.`;
    show_images('out_ramp_01','out_ramp_02','badger_01','out_ramp_03','out_ramp_04','out_ramp_05');
    print qq`And of course, there's the Badger-- I'm not sure why it was named the "Badger",
but for some reason, after I thought of it, the name just stuck.`;
    show_images('badger_02','badger_03','badger_04','badger_05','badger_06','badger_07');
} elsif($params{area} eq "L1") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>Level 1</b></div><br>
The first level of the PARV features the main engine room, slots for 6 room modules, and
a storage closet for spare parts that leads outside the PARV.`;
    show_images('L1_over_01','L1_over_02','L1_over_03','L1_over_04');
    print qq`The exterior doors are located on the two sides, and have little storage
lockers (these contained weapons in the BrikWars game, but were not discovered during
gameplay).`;
    show_images('L1_entry_01','L1_entry_02','L1_entry_03');
    print qq`The engine room is actually more of an all-purpose room for the vehicle's
various systems. There's a set of power generators, water filtration and storage, air
filtration, and secondary control systems. The engine room also houses the Badger, which
can exit through the rear ramp.`;
    show_images('L1_engine_01','L1_engine_02','L1_engine_03','L1_engine_04','L1_engine_05','L1_engine_06','L1_engine_07');
    print qq`Four of the module slots in the 1st level are living modules (see Level 3
for pictures), but also featured in the lower level are a machine shop and general storage.`;
    show_images('L1_shop_01','L1_shop_02','L1_shop_03');
    show_images('L1_storage_01','L1_storage_02','L1_storage_03');
} elsif($params{area} eq "L2") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>Level 2</b></div><br>
The 2nd Level is intended for most of the crew's general living activity. It features the
bridge, 4 module slots (kitchen, lounge, medical, bio lab), and bathrooms. It also has two
external side decks, a hangar bay for the Piglet, and a rear landing platform`;
    show_images('L2_over_01','L2_over_02');
    print qq`The bridge is one of the largest rooms, with 8 control stations, and of
course, monitoring for the Death Star.`;
    show_images('L2_bridge_01','L2_bridge_02','L2_bridge_03','L2_bridge_04','L2_bridge_05');
    print qq`The bathrooms are located near the rear of the 2nd level, with mens and women's--
although neither are marked appropriately. Each has two shower stalls, 3 toilets, and only 1
sink. Yes, you can tell I'm male since I didn't put more priority on sinks and bathroom
mirrors.`;
    show_images('L2_bath_01','L2_bath_02','L2_bath_03','L2_bath_04');
    print qq`The rear hangar is pretty tight. There's JUST enough room in there for the
Piglet, but very little else in the room. The outer landing pad, however, features much more
room for it to romp around in.`;
    show_images('L2_hangar','out_pad_01','out_pad_02','out_pad_03','out_pad_04','out_pad_05','out_pad_06');
    print qq`The second level features quite a lot of other deck space, too. This was
primarily to make sure that during the BrikWars game, enemies would have no trouble finding
many places to board`;
    show_images('out_pad_07','out_pad_08','out_deck_03','out_deck_04','out_deck_05');
    print qq`This level is also home to the vehicles maintenance/security droids. Another
hidden bonus during the game, these robots were kept in four secret storage lockers close to
the bridge.`;
    show_images('out_deck_02','out_deck_01','out_deck_07','out_deck_06','L2_hall_01','L2_hall_03','L2_hall_02');
    print qq`We've also got the exterior connecting ramps on level 2 as well. There's some
better views of these outside, but from the inside, here's what it looks like.`;
    show_images('L2_connect_03','L2_connect_01');
    print qq`The 4 room module slots are taken up by the kitchen, lounge, medical bay, and
the bio lab. During the BrikWars game, 3 of these 4 slots were taken up by other people's
room modules-- a robot lab, a bar, and a bio freezing chamber. The kitchen:`;
    show_images('L2_kitchen_01','L2_kitchen_02','L2_kitchen_03','L2_kitchen_04');
    print qq`The lounge:`;
    show_images('L2_lounge_01');
    print qq`The medical bay:`;
    show_images('L2_med_01','L2_med_02','L2_med_03');
    print qq`The bio lab:`;
    show_images('L2_lab_01','L2_lab_02','L2_lab_03','L2_lab_04','L2_lab_05');
} elsif($params{area} eq "L3") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>Level 3</b></div><br>
The top level of the PARV is mostly dedicated to living quarters. It has 8 different
room slots, a laundry, and (not pictured) a storage closet up by the front.`;
    show_images('L3_over_01','L3_over_02','L3_over_03');
    show_images('L3_laundry_01','L3_hall_03','L3_hall_01');
    print qq`There are living quarters in the 1st and 3rd levels, but primarily, they're
up on the 3rd. Each room features two 3x6 mattresses (sometimes pushed together to form
a queen-sized bed), two workstations, and a moveable table with lamp.`;
    show_images('L3_living_01','L3_living_02','L3_living_03');
    print qq`From the exterior, you can see through the living quarters, all the way through
to the other side:`;
    show_images('L3_living_04','L3_living_05','L3_living_06');
} elsif($params{area} eq "roof") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>Roof</b></div><br>
The roof of the PARV actually has quite a bit on it. Two laser turrets, missile racks,
radar, a crane, 3 entry hatches, storage racks, and a set of raised lights.`;
    show_images('out_top_07','out_top_03');
    print qq`As I was building, I realized that the top was the only area where there wasn't
really any room to put effective lighting. Hence, I added 4 retractable lights on poles
that would actually make the top usable if this vehicle were in the slightest bit realistic.
Which it isn't. But I can dream.`;
    show_images('out_lights_01','out_lights_03','out_lights_04');
    print qq`Unfortunately, I never got adept enough at designing cranes. This crane was
more of a last-minute add-on that I intended to improve, but never did. So, sorry, no
pictures of it unfolded an "in action", since it wouldn't stay in place without a little
hand-holding.`;
    show_images('out_top_01','out_top_05');
    print qq`It's got some other little greebles up there on the roof-- many of which
were improvised in order to save me from buying more tan tiles, much to the chagrin of
Kevin Salm, who I'm sure would've been happy to sell me a kabillion more.`;
    show_images('out_hatch_01','out_lights_02','out_top_04');
    print qq`Of course the PARV has laser turrets. No self-respecting futuristic vehicle
would be without them. The PARV has 6 manned turrets in total, 2 on the roof, and one on
each corner of the 2nd level's outer decks. Also, on the front slope of the roof, there
are two unmanned turrets for all your blasting needs.`;
    show_images('out_turret_01','out_turret_02','out_gun_01');
    print qq`Another hidden feature was a set of missile racks. Part of the premise of
the BrikWars game was that the drivers of the PARV weren't familiar with its systems,
so these were carefully hidden from view until the time was right for them to be revealed.`;
    show_images('out_missiles_01','out_missiles_02','out_missiles_03');
} elsif($params{area} eq "hist") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>History</b></div><br>
The inspiration for the PARV came from Wayne McCaul, who suggested the concept
for the BrikWars game. The idea was for a Mad Max style BrikWars game, where
post-apocolyptic inhabitants wrestled for control of an advanced vehicle, and Blood
Warriors would attempt to try and board the escaping vehicle. I began playing with
ideas shortly thereafter, and took over the game direction from there. It wasn't
long before I began sketching out preliminary designs for the PARV.<br>`;
    print "<table width=100\%>\n";
    print "<tr>";
    print "<td align=center><a href=\"images/tmp/parv_small.jpg\"><img border=0 src=\"images/tmp/parv_small_th.jpg\"></a></td>\n";
    print "<td align=center><a href=\"images/tmp/parv_toobig.jpg\"><img border=0 src=\"images/tmp/parv_toobig_th.jpg\"></a></td>\n";
    print "</tr></table>\n";
print qq`<br>The design was largely influenced by Wayne's initial descriptions and also
by the game itself. According to the description, it had to be large-- capable of
housing dozens of people for months. And for the sake of the game, it had to be
easy for the invaders to board. Hence the rear landing platform, bevy of outer
ladders, and front/side exposed platforms. It also meant I wanted a lot of
functionality that could be manually overridden, like turrets, sub-vehicles, and
the crane.<br>
<br>
The idea to make it modular was Shaun Sullivan's. He suggested allowing other
game players to participate in the PARV's construction by letting them build modules
which could be inserted when the game was played. Turns out there were 3 modules
built by other players for the game (two by Shaun and one by Jonathan Dallas).`;
    show_images2('plans_top','plans_side');
print qq`Construction took place over about 8 months, the majority of which was done in extreme
building sessions prior to BrickFest 2005, in a mad dash to get it completed for display
at the event. It made it there (and won 2nd place in the large MOC Space category), but
the interior wasn't yet complete.`;
    show_images2('construction_01','construction_02','construction_03','construction_04','construction_05','construction_06','construction_07','construction_08','construction_09','construction_10');
    print qq`The game took place on Sep. 17, 2005. Participants included the Omics (defending
the PARV): Alfred Speredelozzi, Joe Comeau, and Dan Boger, and the Blood Warriors (attacking
the PARV): Shaun Sullivan, Wayne McCaul, Jamie Berard, and Jonathan Dallas. I served as the
Game Master, and Jennifer Boger served as an audience member. Pictures from the game are
available on BrickShelf:<br>
<table width=100%><tr>
<td align=center><a href="http://www.brickshelf.com/cgi-bin/gallery.cgi?f=146136">Alfred Speredelozzi's<br><img border=0 src="http://www.brickshelf.com/gallery/alfredjr/NELUG/PARV-BrikWars/thumb/dscf6307.jpg_thumb.jpg"></a></td>
<td align=center><a href="http://www.brickshelf.com/cgi-bin/gallery.cgi?f=146148">Wayne McCaul's<br><img border=0 src="http://www.brickshelf.com/gallery/Hazy/BW/PARV/thumb/pcp295.jpg_thumb.jpg"></a></td>
<td align=center><a href="http://www.brickshelf.com/cgi-bin/gallery.cgi?f=146054">Shaun Sullivan's<br><img border=0 src="http://www.brickshelf.com/gallery/sullis3/BRIKWARSGAMES/050917PARV/thumb/dsc00408.jpg_thumb.jpg"></a></td>
</tr></table>`;

} elsif($params{area} eq "etc") {
    print qq`<div align=center style=\"font-size: 24px;\"><b>Et Cetera</b></div><br>
What does P.A.R.V. stand for? "Post-Apocolyptic Research Vehicle". Or Recreational
Vehicle, if you prefer. Pretty snazzy for being post-apocolyptic, though, isn't it?
Well, the story goes that it was built prior to the 'apocolypse', with the intent of
its builders being to survive through it.<br>
<br>
The treads went through several design phases. The first idea was to use two sets of
technic treads parallel to each other. But these looked way to pitiful when compared
with the rest of the PARV, so I started work on other solutions. The first test
looked something like this:`;
    show_images2('links_bot','links_apart','links_top');
    print qq`All together (and in black of course), these looked pretty good, and
worked well:`;
    show_images2('proto_side','proto_side2','proto_top');
    print qq`The problem with these was that they used 2 1x2 technic bricks and 2 1x1
technic bricks per tread. And since I needed almost 500 studs of length, that meant about
500 1x2 technic bricks, and another 500 1x1 technic bricks. So I called out for help to
the community, and got some <a href="http://news.lugnet.com/build/?n=15740">very good ideas for treads from Ka-On Lee</a>,
including <a href="http://www.brickshelf.com/cgi-bin/gallery.cgi?i=1102268">the one I ended up using</a> (more or less).<br>
<br>
Here's the way the treads turned out:`;
    show_images('out_treads_03','out_treads_02');
    print qq`
The interior doors I haven't really seen other people use, but chances are someone
else has come up with the design. I kinda thought they were neat, allowing a bulkhead
style door to open and close in the middle of a wall, although it does leave an ugly
gap on one side of the door.`;
    show_images2('parv_door');
    print qq`The addition of modules was the idea of Shaun Sullivan. Early on, upon thinking
he had hit on something good with the idea, I modified the design of the PARV to accomodate
a number of 16x16 modules. Each one had a central slot for a door, and a pre-defined window
position. Unfortunately, modules in the bottom level had their windows covered, since they
would just look out onto the vehicle treads.`;
    show_images2('module','mod_door','mod_window');
} else {
    print qq`<div align=center style=\"font-size: 24px;\"><b>General</b></div><br>
The PARV is a large land vehicle built for a <a href="http://www.brikwars.com/">BrikWars</a> game which was played on Sep. 17th, 2005. I believe this was the largest minifig-scale land vehicle to be built out of LEGO until Dave DeGobbi's <a href="http://www.flickr.com/photos/29844928@N07/sets/72157623336807855/">Crawler Town</a>, but please correct me if you know otherwise. It was built over the course of about 8 months in 2005, weighs about 73 pounds, and consists of an estimated 30,000+ LEGO elements. It's more than 115 studs long (3 feet), a bit more than 66 studs wide (20 inches), and about 34 bricks tall (13 inches).<br>`;
    show_images('out_front_10','out_side_11','out_side_03','out_back_03','out_front_04','out_side_04','out_top_06','out_side_06','out_back_04','out_front_05','out_side_09','out_front_11','out_side_02','out_back_05','out_side_10','out_side_11','out_top_02',);
    print qq`<br><br>The whole thing is modular, consisting of some 25 sections that can be assembled. Of those, 18 are interior room modules, each measuring 16x16 studs. The other 7 modules are the "base", the rear landing deck, the front right and front left decks, the 2nd level, 3rd level, and roof. It also contains two smaller vehicles, named the Piglet (a small air vehicle) and the Badger (small rover).<br>`;
    show_images('L1_over_01','L1_over_04','L2_over_01','L3_over_04','modules_01','out_open_top_01','out_open_top_02','badger_01','out_pad_05');
}

sub nav {
    print "<Table><tr>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=gen\">General<br><img border=0 width=80 height=60 src=\"$dir/out_front_10_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=out\">Outside<br><img border=0 width=80 height=60 src=\"$dir/out_tread_01_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=L1\">Level 1<br><img border=0 width=80 height=60 src=\"$dir/L1_engine_03_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=L2\">Level 2<br><img border=0 width=80 height=60 src=\"$dir/L2_lab_03_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=L3\">Level 3<br><img border=0 width=80 height=60 src=\"$dir/L3_laundry_01_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=roof\">Roof<br><img border=0 width=80 height=60 src=\"$dir/out_lights_04_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=hist\">History<br><img border=0 width=80 height=60 src=\"images/parv/parv_concept_th.jpg\"></A><br>\n";
    print "<td align=center><A href=\"$ENV{SCRIPT_NAME}?area=etc\">ETC.<br><img border=0 width=80 height=60 src=\"images/parv/proto_side_th.jpg\"></A><br>\n";
    print "</tr>\n";
    print "</table>\n";
}
#show_images(@images);
foot();

sub show_images {
    my(@pics) = @_;
    my($i) = 0;
    print "<table width=100\%><tr>\n";
    foreach(@pics) {
	my($base) = $_;
	$base =~ s/_md//;
	next if($used{$base});
	$used{$base} = 1;
	if(!($i++%4)) {
	    print "</tr>\n<tr>\n";
	}
	print "<td align=center><a href=\"$dir/${base}_md.jpg\"><img src=\"$dir/$base\_th.jpg\" border=0></a></td>\n";
    }
    print "</tr></table>\n";
}

sub show_images2 {
    my(@pics) = @_;
    my($i) = 0;
    print "<table width=100\%><tr>\n";
    foreach(@pics) {
	my($base) = $_;
	$base =~ s/_md//;
	next if($used2{$base});
	$used2{$base} = 1;
	if(!($i++%4)) {
	    print "</tr>\n<tr>\n";
	}
	if(-e "$dir2/$base\_th.jpg") {
	    print "<td align=center><a href=\"$dir2/${base}_md.jpg\"><img src=\"$dir2/$base\_th.jpg\" border=0></a></td>\n";
	} elsif(-e "$dir2/$base\_th.gif") {
	    print "<td align=center><a href=\"$dir2/${base}.gif\"><img src=\"$dir2/$base\_th.gif\" border=0></a></td>\n";
	}
    }
    print "</tr></table>\n";
}
