#!/usr/local/bin/perl # # Copyright (c) 1995 by Delphi Internet Services Corporation, # Cambridge, Massachusetts. All Rights Reserved # # Name: tangoes.pl # Purpose: output HTML for placement of pieces on Tangoes field # # Modification history # # 95/10/10 Chris Rywalt require "/usr/local/etc/httpd/cgi-bin/crywalt/cgi-lib.pl"; #----------------------------------------------------------------- # Main (isn't it silly to have a ``Main'' section in an unstructured language?) # $PI = 3.14159; print &PrintHeader; &ReadParse(*formdata); # reads in form data if($formdata{'arbitrary'} ne '') { $rotate = $formdata{'arbitrary'}+$formdata{'prevrotate'}; } elsif($formdata{'rotation'} ne '') { $rotate = $formdata{'rotation'}+$formdata{'prevrotate'}; } else { $rotate = 0+$formdata{'prevrotate'}; } if($formdata{'image.x'}) { $x = 52-$formdata{'image.x'}; $y = 52-$formdata{'image.y'}; if($x == 0) { $angle = $PI; } if(($x>=0)&&($y>=0)) { $angle = atan2($x,$y); } elsif(($x>=0)&&($y<0)) { $angle = ($PI/2)+atan2(-$y,$x); } elsif(($x<0)&&($y<0)) { $angle = $PI+atan2(-$x,-$y); } else { $angle = (3*$PI/2)+atan2($y,-$x); } $angle = (180*$angle)/$PI; $rotate = int($angle+$formdata{'prevrotate'}); } if($ENV{'PATH_INFO'} eq '/') { $ENV{'PATH_INFO'} = ''; } $ENV{'PATH_INFO'} =~ s/\/\//\//g; $repeat = 0; $rest = substr($ENV{'PATH_INFO'},1); while($rest) { ($piece, $rotation, $xcoord, $ycoord, $rest) = split(/\//,$rest,5); if($piece == $ENV{'QUERY_STRING'}) { $repeat = 1; break; } } if($repeat) { print ""; print "
"; print ""; print ""; print ""; print ""; print ""; print "\n"; print " "; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
That piece was used already! Choose another.
"; print "
"; exit(); } print ""; print "
"; print ""; print ""; print ""; print ""; print ""; print ""; print " "; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
Place or rotate
"; print "
"; # EOF