From: Ian Jackson Date: Sun, 10 Mar 2019 20:16:47 +0000 (+0000) Subject: move into misc-data.pl: decks, also adjuncts_dy_from_boundings X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=5209760357b799eccfe74d77c8d5c1167b1c5ede;p=pandemic-rising-tide.git move into misc-data.pl: decks, also adjuncts_dy_from_boundings NFC --- diff --git a/generate-board b/generate-board index 109e84d..1cc3242 100755 --- a/generate-board +++ b/generate-board @@ -38,8 +38,7 @@ our $a1_h = 2384; our $max_printeredge = 5.50 * MM2PT; our $a1m_pasteedge = 3.5 * MM2PT; # along each edge our $preamble_from_boundings = ''; -our $top_adjuncts_dy_from_boundings = 0; -our $bottom_adjuncts_dy_from_boundings = 0; +our %adjuncts_dy_from_boundings = (Top => 0, Bottom => 0); # ----- region names from plag, incl. reverse mapping ----- @@ -388,8 +387,8 @@ sub computeboundings() { -$surroundw 0 rlineto closepath $w_stroke clip END - ($top_adjuncts_dy_from_boundings, - $bottom_adjuncts_dy_from_boundings) = @{ $c{PA}{BoundingsA1dy} }; + $adjuncts_dy_from_boundings{Top} = $c{PA}{BoundingsA1dy}[0]; + $adjuncts_dy_from_boundings{Bottom} = $c{PA}{BoundingsA1dy}[1]; # ^ if we are doing it all in one go we lose less printable area } else { confess; @@ -771,16 +770,22 @@ sub decks(){ } o(" closepath\n"); o(" } bind def"); + o(" /deckpairpathx {\n"); # x because it leaves matrix changed o(" newpath deck1path\n"); o(" 200 0 translate deck1path\n"); o(" } bind def"); - o(" $lw setlinewidth ",miscpscolour('playerdeck'),"\n"); - o(" gsave 401 44 $bottom_adjuncts_dy_from_boundings add translate"); - o(" deckpairpathx stroke grestore"); - o(" $lw setlinewidth ",miscpscolour('dykefail'),"\n"); - o(" gsave 242 1363 $top_adjuncts_dy_from_boundings add translate "); - o(" 90 rotate deckpairpathx stroke grestore"); + + foreach my $deck (@{ $c{Decks} }) { + o(" $lw setlinewidth ",miscpscolour($deck->{Colour}),"\n"); + o(" gsave @{ $deck->{Pos} } "); + my $adjunct = $adjuncts_dy_from_boundings{ $deck->{dyAdjunct} }; + if (defined $adjunct) { o("$adjunct add translate"); } + o(" "); + my $rotate = $deck->{Rotate}; + if ($rotate) { o(" $rotate rotate "); } + o("deckpairpathx stroke grestore"); + } } sub sea_track(){ @@ -932,7 +937,7 @@ sub hs_initial_1 ($$$;$$$) { my $demo_w = $demo_x0 + $dyke_l * 0.60; o(" % HS I $colour\n"); o(" gsave\n"); - o(" 550 1705 $top_adjuncts_dy_from_boundings add translate\n"); + o(" 550 1705 $adjuncts_dy_from_boundings{Top} add translate\n"); o(" ", ($xi*$interval), " ", (($yi-1)*$interval), " translate\n"); if ($fn) { o(" gsave\n"); @@ -970,7 +975,7 @@ sub hs_initial () { sub play_hint () { my $sz = 20; o(" gsave ",miscpscolour('hinttext'), - " 260 1715 $top_adjuncts_dy_from_boundings add translate\n"); + " 260 1715 $adjuncts_dy_from_boundings{$c{PlayHintdyAdjunct}} add translate\n"); o(" /Helvetica-Bold findfont $sz scalefont setfont\n"); my @t = split /\n/, $c{PlayHint}; foreach my $i (0..$#t) { diff --git a/misc-data.pl b/misc-data.pl index 65b5285..4c061ae 100644 --- a/misc-data.pl +++ b/misc-data.pl @@ -67,8 +67,14 @@ END Overall => [ 34, -15 ], OverallOn => { a4 => [ 0, -17 ] }, }, + PlayHintdyAdjunct => 'Top', PA_HS_HS => { green => [0, -0.40] }, PA_Outercoast_Vertices => [ { Re => qr{Noorderzijlvest}, PA => [ 100,-50 ] }, ], + Decks => [ + { Colour => 'playerdeck', Pos => [ 401, 44 ], dyAdjunct => 'Bottom' }, + { Colour => 'dykefail', Pos => [ 242, 1363 ], dyAdjunct => 'Top', + Rotate => 90 }, + ], );