\ProvidesPackage{badges}

% You shouldn't need to touch this file at all, unless you really want to 
% frob with how badges look.  Even then you probably won't have to frob it
% much to get what you want; the spacing tends to rearrange itself nicely.
%
% Badges don't have the I'M NOT HERE on the *back* of the Here side
% because it's convenient for dead people to be able to rip the
% Here side off and leave it to be their body while keeping the
% I'M NOT HERE side to wear.  Instead they mirror, like item cards,
% so that upside-down bodies are still recognizable.
%
% If the ``ghost'' charinfo field hasn't been left blank, the character
% is ``ghostly'' --- GM, Observer, etc --- so the whole badge will
% be reverse video (white-on-black).


\RequirePackage[mirror,.5cm]{cards}

\pagestyle{empty}

% should fit in badge holders!
\newlength\badgewidth  \badgewidth=3.1in
\newlength\badgeheight \badgeheight=2in

\def\head@line{Identity Badge \hfil\hfil\hfil Not Transferable}

\newfont\reallybig{ptmr scaled 3300}

\parindent 0pt                    % don't indent paragraphs
\centering                        % keep everything centered
\baselineskip 0pt  \lineskip 0pt  % ignore min spacing as necessary

% For what we do here it actually seems to be easier / more straightforward
% to toss in some color-frobbing postscript than to use the color package cmds.
\def\@ps#1{\special{ps:#1}}
%
\def\rvstart{%     % Reverse Video Start 
  \@ps{gsave 0.3 setgray}\vrule height\badgeheight width\hsize \@ps{grestore}%
  \vskip-\badgeheight \smallskip \@ps{gsave 1 setgray}%
}
\def\rvend{\@ps{grestore}}   % Reverse Video End

\newif\ifghostly


% when \name is called, we'll make a badge for \me
\renewcommand\doname{%
  \testinfo\me{ghost}\ifinfo \ghostlytrue \else \ghostlyfalse \fi
  %
  % cards.sty will frame the badge for us
  \makecard{%
    \vbox to 2\badgeheight{\hsize=\badgewidth % 2 sides high, one side wide  
      \vbox to \badgeheight{%    % id side
        \ifghostly\rvstart\fi
        \smallskip
        \head@line \break\vfil
        {\Huge \me{char}}\break\vfil      % character name
        {\huge \me{player}}\break\vfil    % player name
        {\LARGE \me{number}}\break\vfil   % number
        {\LARGE \me{desc}}\break\vfil     % description
        \gamename\break\vfil
        \ifghostly\rvend\fi
      }%
      \rotatebox[origin=c]{180}{%         % Not Here side is upside-down
        \vbox to \badgeheight{%       
          \rvstart                        % and is always reverse video
          \head@line \break\vfil
          \hbox{\reallybig I'M NOT HERE}\break\vfil
          \gamename\break\smallskip
          \rvend    % done with reverse video
        }%
      }%
    }%
  }%
}
