summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/wargame/hex/terrain.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/wargame/hex/terrain.dtx')
-rw-r--r--Master/texmf-dist/source/latex/wargame/hex/terrain.dtx24
1 files changed, 22 insertions, 2 deletions
diff --git a/Master/texmf-dist/source/latex/wargame/hex/terrain.dtx b/Master/texmf-dist/source/latex/wargame/hex/terrain.dtx
index 4c486adf770..9d15a555ec9 100644
--- a/Master/texmf-dist/source/latex/wargame/hex/terrain.dtx
+++ b/Master/texmf-dist/source/latex/wargame/hex/terrain.dtx
@@ -37,6 +37,7 @@
% select the common terrains.
%
% \begin{macrocode}
+\newif\if@hex@t@rot\@hex@t@rotfalse%
\tikzset{%
/hex/terrain/.search also={/tikz},%
/hex/terrain/.cd,%
@@ -44,6 +45,7 @@
image/.store in=\hex@t@image,%
code/.store in=\hex@t@code,%
clip/.store in=\hex@t@clip,%
+ random rotation/.is if=@hex@t@rot,
pic/.default=,
image/.default=,
code/.default=,
@@ -137,8 +139,23 @@
\@ifundefined{hex@t@code}{\let\hex@t@code\empty}{}
% \end{macrocode}
%
+% Possible make rotation. We define a scope and rotate within that.
+%
+% \begin{macrocode}
+ \def\hex@t@angle{0}%
+ \if@hex@t@rot%
+ \pgfmathrandominteger{\hex@t@angle}{0}{5}
+ \pgfmathparse{int(60*\hex@t@angle)}\edef\hex@t@angle{\pgfmathresult}%
+ \fi%
+ \hex@dbg{5}{Will rotate terrain by `\hex@t@angle'}%
+% \end{macrocode}
+%
+% If we have specified code for the terrain, then execute that.
+%
% \begin{macrocode}
- \ifx\hex@t@code\empty\else\hex@t@code\fi%
+ \scope[rotate=\hex@t@angle]%
+ \ifx\hex@t@code\empty\else\hex@t@code\fi%
+ \endscope% End rotate code
% \end{macrocode}
% First we check if we have not got terrain images, but terrain
% pictures. If we have that, we process these in turn. Note, the
@@ -154,7 +171,9 @@
\hex@dbg{5}{Terrain pictures}%
\pgfpointorigin\wg@tmpa=\pgf@x\wg@tmpb=\pgf@y%
\foreach \i in \hex@t@pic{%
- \wg@pic@all{\i}{}{\the\wg@tmpa,\the\wg@tmpb}{}}%
+ \wg@pic@all{\i}{}{\the\wg@tmpa,\the\wg@tmpb}{%
+ rotate=\hex@t@angle,
+ transform shape}}%
\fi% We have pictures.
% \end{macrocode}
%
@@ -172,6 +191,7 @@
\expandafter\wg@node{%
\includegraphics[width=2cm]{\i}}\@endwg@node %
{}{\wg@tmpa,\wg@tmpb}{%
+ rotate=\hex@t@angle,%
shape=rectangle,%
anchor=center,%
transform shape,%