/* four in a row's structures */


/* menu and item definitions */
#define PROJECT      0
#define GAME         1
#define ABOUT        0
#define QUIT         1
#define NEWGAME      0
#define PLAYER2      1
#define FIRSTPLAYER  2
#define INSTRUCTIONS 3


void set_itext(), init_itexts(), set_item(), init_items();
void set_menu(), init_menus();

struct IntuiText m1_text1, m1_text2,
                 m2_text1, m2_text2a, m2_text2b, m2_text3a,
                 m2_text3b, m2_text4,
                 instr1, instr2, instr3, instr4, instr5, instr6,
                 about1, about2, about3, about4, about5, about6, about7,
                 address1, address2, address3, address4, address5,
                 positive, negative;

struct MenuItem  m1_item1, m1_item2,
                 m2_item1, m2_item2, m2_item3, m2_item4;

struct Menu      menu1, menu2;


/* intuitext structures and routines for menus */

void set_itext(intuitext, pen, left, top, text, next)
struct IntuiText *intuitext, *next;
UBYTE pen, *text;
SHORT left, top;
{
   intuitext-> FrontPen    =  pen;
   intuitext-> BackPen     =  1;
   intuitext-> DrawMode    =  JAM1;
   intuitext-> LeftEdge    =  left;
   intuitext-> TopEdge     =  top;
   intuitext-> ITextFont   =  NULL;
   intuitext-> IText       =  text;
   intuitext-> NextText    =  next;
   return;
}


void init_itexts()
{
   set_itext(&m1_text1, 3, 8, 1, "About", NULL);
   set_itext(&m1_text2, 3, 8, 1, "Quit", NULL);
   set_itext(&m2_text1, 3, 8, 1, "New Game", NULL);
   set_itext(&m2_text2a, 3, 8, 1, "One Player", NULL);
   set_itext(&m2_text2b, 3, 8, 1, "Two Players", NULL);
   set_itext(&m2_text3a, 3, 8, 1, "I Am First", NULL);
   set_itext(&m2_text3b, 3, 8, 1, "You're First", NULL);
   set_itext(&m2_text4, 3, 8, 1, "Instructions", NULL);

   set_itext(&instr6, 3, 8, 54, "(no pun intended)", NULL);
   set_itext(&instr5, 3, 8, 44, "plays with brown beads.", &instr6);
   set_itext(&instr4, 3, 8, 34, "on the poles.  The computer", &instr5);
   set_itext(&instr3, 3, 8, 24, "horizontally by stacking them", &instr4);
   set_itext(&instr2, 3, 8, 14, "vertically, diagonally, or", &instr3);
   set_itext(&instr1, 3, 8, 04, "Get four beads in a row", &instr2);

   set_itext(&address5, 3,  8, 154, "Chico #:  (916)343-6676", NULL);
   set_itext(&address4, 3,  8, 144, "          Chico, CA  95926", &address5);
   set_itext(&address3, 3,  8, 134, "     or   634 W. 2nd Ave. #2", &address4);
   set_itext(&address2, 3,  8, 114, "          Modesto, CA  95350", &address3);
   set_itext(&address1, 3,  8, 104, "U.Snail:  1125 Ulrich Ave.", &address2);
   set_itext(&about7,   3,  8,  89, "Comments welcome:", &address1);
   set_itext(&about6,   3, 13,  69, "money;  it's Public Domain.", &about7);
   set_itext(&about5,   3, 13,  59, "not for commercial use or", &about6);
   set_itext(&about4,   3, 13,  49, "distribute this program, but", &about5);
   set_itext(&about3,   3, 13,  39, "Feel free to copy and", &about4);
   set_itext(&about2,   3,  8,  24, "Copyright (C) 1987 by Pery Pearson", &about3);
   set_itext(&about1,   2, 24,   4, "Four in a Row   V1.0  08/14/87", &about2);

   set_itext(&positive, 2, 6, 4, "Gotcha", NULL);
   set_itext(&negative, 2, 7, 4, "Hmm...", NULL);

   return;
}


/* menu item structures */

void set_item(item, n, l, t, w, h, f)
struct MenuItem *item, *n;
SHORT l, t, w, h;
APTR  f;
{
   item-> NextItem      =  n;
   item-> LeftEdge      =  l;
   item-> TopEdge       =  t;
   item-> Width         =  w;
   item-> Height        =  h;
   item-> Flags         =  ITEMTEXT | HIGHCOMP | ITEMENABLED;
   item-> MutualExclude =  NULL;
   item-> ItemFill      =  f;
   item-> SelectFill    =  NULL;
   item-> Command       =  NULL;
   item-> SubItem       =  NULL;

   return;
}


void init_items()
{
   set_item(&m1_item2, NULL, 0, 10, 9*8, 10, (APTR)&m1_text2);
   set_item(&m1_item1, &m1_item2, 0, 0, 9*8, 10, (APTR)&m1_text1);
   set_item(&m2_item4, NULL, 0, 30, 14*8, 10, (APTR)&m2_text4);
   set_item(&m2_item3, &m2_item4, 0, 20, 14*8, 10, (APTR)&m2_text3b);
   set_item(&m2_item2, &m2_item3, 0, 10, 14*8, 10, (APTR)&m2_text2a);
   set_item(&m2_item1, &m2_item2, 0, 0, 14*8, 10, (APTR)&m2_text1);
   return;
}


/* menu structures and routines */

void set_menu(menu, next, l, t, w, h, name, f)
struct Menu *menu, *next;
SHORT l, t, w, h;
BYTE  *name;
struct MenuItem *f;
{
   menu-> NextMenu      =  next;
   menu-> LeftEdge      =  l;
   menu-> TopEdge       =  t;
   menu-> Width         =  w;
   menu-> Height        =  h;
   menu-> Flags         =  MENUENABLED;
   menu-> MenuName      =  name;
   menu-> FirstItem     =  f;

   return;
}


void init_menus()
{
   init_itexts();
   init_items();

   set_menu(&menu2, NULL, 14*8, 0, 14*8, 10, " Game         ", &m2_item1);
   set_menu(&menu1, &menu2, 2*8, 0, 9*8, 10, " Project ", &m1_item1);
   return;
}
