\ProvidesPackage{sheets}

% This package
%
% * Sets default geometry.
% * Provides the \sheetbanner macro and initializes \doname to
%   invoke it such that \name{\Frobozz} will put up the funky banner,
%   with the ``name of the character this FooSheet is for'' spot
%   and your eps icon, proclaiming itself \me{} (i.e. \Frobozz{}).
%   Everything involved in that is customizable globally (here) or
%   (more usually) per-substyle or (rarely) per actual sheet.
% * Provides a couple useful environments/macros for sheetwriters,
%   namely tightlist and \topquote.


% Acknowledgments: portions trace back to material variously
%   written/edited by David Oh (1991),
%   modified for `One is not a Prime Number' (1992),
%   modified for `Midnight in Moscow, Take 2' (1994),
%   modified by Jeremy Brown (August 1994),
%      again for `Moon Over Bourbon Street' (1995),
%      again for `Catastrophe' (1996),
% before the Template went to work on it.


%%%%%%%%%%%%%%%%%%%
% Package options %
%%%%%%%%%%%%%%%%%%%
%
\newdimen\InlineHeaderIndent  \InlineHeaderIndent=0pt
\DeclareOption{inlineheaders}{\InlineHeaderIndent=\parindent}
%
\ProcessOptions\relax


%%%%%%%%%%%%%%%%%%
% Other packages %
%%%%%%%%%%%%%%%%%%
%
\RequirePackage{graphicx}	% for including postscript graphics
\RequirePackage{doublespace}	% for setting default linespacing
\setstretch{1.2}


%%%%%%%%%%%%%%%
% Page layout %
%%%%%%%%%%%%%%%
%
\geometry{width=7.0in,height=9.5in}
\geometry{includefoot,vmarginratio=3:2}
% substyles that set \pagestyle{empty} will probably want to set
% \geometry{ignorefoot,vmarginratio=1:1}, redistributing that space


%%%%%%%%%%%%%%%%%%%
% Section headers %
%%%%%%%%%%%%%%%%%%%
%
\ifdim\InlineHeaderIndent=0pt
  % leave section headers alone (non-inline)
\else
  \font\HeaderFont=phvb  % Helvetica-Bold
  \newdimen\HeaderOutdent
  \HeaderOutdent=\oddsidemargin\relax
  \advance\HeaderOutdent by .667in\relax
  \ifdim\HeaderOutdent>.5in\relax \HeaderOutdent=.5in\relax \fi
  \newcommand\MakeInline[2]{
    \expandafter\renewcommand\csname#1\endcsname{
      \@startsection{#1}{#2}
        {-\HeaderOutdent}{.5\baselineskip}{-\InlineHeaderIndent}{\HeaderFont}
    }
  }
  \MakeInline{section}{1}
  \MakeInline{subsection}{2}
  \MakeInline{subsubsection}{3}
\fi    


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Build the pretty banner (original version by David Oh) %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Specific sheet styles will \renewcommand\sheetname to whatever they
% are, but you can also use [sheets] as a style by itself (getting this).
%
\newcommand\sheetname{Miscellaneous Sheet}
%
%
% Put in the eps of the char name if available (the perl scripts
% cause it to be; it's not there otherwise unless you're 
% doing it by hand on purpose).  This doesn't take args to
% fiddle the offset and scaling (alter llx/lly/urx/ury/rwi)... yet.
%
% Styles based on this style that don't want the charname to appear
% (e.g. character sheets, where it would be highly redundant)
% should \renewcommand\docharnamehere{}. 
% 
\newcommand\docharnamehere{%
  \special{psfile=charnameheader.eps llx=0 lly=0 urx=1 ury=0 rwi=-10}%
}
%
%
%% \useicon[optional width]{eps icon file}
% sets what icon goes in the banner, and optionally what width it is.
% We pass it the default here; the Czar could overrule that in specific
% sheet styles (bluesheet icon, greensheet icon...) and/or the GMs can
% overrule it for individual sheets.  Width defaults if not present.
% Zero width arg or empty icon arg mean no icon.
%
\newcommand\useicon[2][7em]{%
  \def\icon@width{#1}%
  \ifdim\icon@width>0pt \def\icon@file{#2}\relax \else \def\icon@file{}\fi
}
\useicon{icon.eps}
%
%
%% \sheetbanner{Frobozz} puts it all together into the actual banner
%% proclaiming this as Frobozz (typically Frobozz == \me{} == \Cbob{}).
%
\newcommand\sheetbanner[1]{%
  \def\line@across{\leaders\hrule height.6ex depth-.55ex\hfill\null}
  \noindent
  \valign{\centering \vfil##\vfil\cr
      \ifx\icon@file\empty\else
        \hsize=\icon@width \includegraphics[width=\hsize]{\icon@file}\cr
        \advance\hsize by -\icon@width
      \fi
      \parindent 5pt
      {\small\sc \gamename~\line@across}%
      \docharnamehere
      \break\vfil
      {#1}%
      \break\vfil
      {\small\sc \sheetname~\line@across}%
      \cr
  }
  \vspace{.15in}
}
%
%
%% Almost always sheets start by calling \name{xyz} (which sets \me == xyz,
%% then invokes \doname) and want to get a banner for xyz there, so we set
%% \doname to make it so.  To override that for specific substyles the
%% Czar can just \renewcommand\doname{whatever} there.
%
\renewcommand\doname{\sheetbanner{\Large\me{}}}


% stolen from Andre' DeHon, edited by Jeremy Brown, edited by Jamie Morris
\newenvironment{tightlist}{
  \begin{list}{$\bullet$}{%
    \advance\partopsep by \topsep
    \setlength{\topsep}{0in}
    \setlength{\itemsep}{0in}
    \setlength{\parsep}{0em}
    \setlength{\leftmargin}{1.5em}
    \setlength{\rightmargin}{0in}
    \setlength{\itemindent}{0in}
    \def\tightlist@empty{}
  }
}
{\ifx\tightlist@empty\empty \item[$\circ$] None \fi \end{list}\vspace{1ex}}

\let\normalitem@macro=\item   % make the above auto-insertion work right
\def\item{\def\tightlist@empty{Nope}\normalitem@macro}

%Mike's adds, edited
\newdef\topquote[2]{%
  \begin{quotation} \em #1 \par \flushright #2 \end{quotation}}
