/*  f4.c for monopoly contains:   
      ckchancemsg(),  chance(), ckchestmsg(),  chest(),  showint()    */

#include "mono:defines"
#include "mono:xvariables"

VOID showint(value, where)
LONG value;
USHORT where;
{
(VOID) stcl_d(outputstr, value);
outstr.IText=&outputstr[0]; 
if (where)  PrintIText(rportchest, &outstr, 0, 10);   
if (!where)  PrintIText(rportchance, &outstr, 0, 0);   
}

VOID ckchancemsg()
{
ULONG cclass;
USHORT ccode;
cclass=0;
ccode=0;


while (chancemsg=(struct IntuiMessage *)GetMsg(chancewindow->UserPort))
   {
   cclass = chancemsg->Class;
   ccode = chancemsg->Code;
   ReplyMsg(chancemsg);
   }
if ((cclass == RAWKEY) && (ccode == HELP))  instruction();
if (cclass == GADGETDOWN)  donechance=TRUE;
}

VOID ckchestmsg()
{
ULONG chclass;
USHORT chcode;
chclass=0;
chcode=0;


while (chestmsg=(struct IntuiMessage *)GetMsg(chestwindow->UserPort))
   {
   chclass = chestmsg->Class;
   chcode = chestmsg->Code;
   ReplyMsg(chestmsg);
   }
if ((chclass == RAWKEY) && (chcode == HELP))  instruction();
if (chclass == GADGETDOWN)  donechest=TRUE;
}

USHORT chest()
{
USHORT card, numhouses, numhotels, hold_line;
LONG money;
struct IntuiText msg0, msg1, msg2, msg3, msg4, msg5, msg6,
                       msg7, msg8, msg9;


msg0.FrontPen=chest_yellow;
msg1.FrontPen=chest_yellow;
msg2.FrontPen=chest_yellow;
msg3.FrontPen=chest_yellow;
msg4.FrontPen=chest_yellow;
msg5.FrontPen=chest_yellow;
msg6.FrontPen=chest_yellow;
msg7.FrontPen=chest_yellow;
msg8.FrontPen=chest_yellow;
msg9.FrontPen=chest_yellow;
outstr.FrontPen=red;

msg0.BackPen=0;
msg0.DrawMode=JAM1;
msg0.LeftEdge=5;
msg0.TopEdge=20;
msg0.ITextFont=NULL;
msg0.NextText=NULL;
msg0.IText=(UBYTE *)"You have landed on";

msg1.BackPen=0;
msg1.DrawMode=JAM1;
msg1.LeftEdge=5;
msg1.TopEdge=30;
msg1.ITextFont=NULL;
msg1.NextText=NULL;
msg1.IText=(UBYTE *)"COMMUNITY CHEST.";

msg2.BackPen=0;
msg2.DrawMode=JAM1;
msg2.LeftEdge=5;
msg2.TopEdge=40;
msg2.ITextFont=NULL;
msg2.NextText=NULL;


msg3.BackPen=0;
msg3.DrawMode=JAM1;
msg3.LeftEdge=5;
msg3.TopEdge=50;
msg3.ITextFont=NULL;
msg3.NextText=NULL;

msg4.BackPen=0;
msg4.DrawMode=JAM1;
msg4.LeftEdge=5;
msg4.TopEdge=60;
msg4.ITextFont=NULL;
msg4.NextText=NULL;

msg5.BackPen=0;
msg5.DrawMode=JAM1;
msg5.LeftEdge=5;
msg5.TopEdge=70;
msg5.ITextFont=NULL;
msg5.NextText=NULL;

msg6.BackPen=0;
msg6.DrawMode=JAM1;
msg6.LeftEdge=5;
msg6.TopEdge=80;
msg6.ITextFont=NULL;
msg6.NextText=NULL;

msg7.BackPen=0;
msg7.DrawMode=JAM1;
msg7.LeftEdge=5;
msg7.TopEdge=90;
msg7.ITextFont=NULL;
msg7.NextText=NULL;

msg8.BackPen=0;
msg8.DrawMode=JAM1;
msg8.LeftEdge=5;
msg8.TopEdge=100;
msg8.ITextFont=NULL;
msg8.NextText=NULL;

msg9.BackPen=0;
msg9.DrawMode=JAM1;
msg9.LeftEdge=5;
msg9.TopEdge=110;
msg9.ITextFont=NULL;
msg9.NextText=NULL;

outstr.BackPen=0;
outstr.DrawMode=JAM1;
outstr.LeftEdge=15;
outstr.TopEdge=90;
outstr.ITextFont=NULL;
outstr.NextText=NULL;outstr.BackPen=0;
outstr.DrawMode=JAM1;
outstr.LeftEdge=15;
outstr.TopEdge=90;
outstr.ITextFont=NULL;
outstr.NextText=NULL;

nchestw.LeftEdge=63;
nchestw.TopEdge=29;
nchestw.Width=194;
nchestw.Height=143;
nchestw.DetailPen=white;
nchestw.BlockPen=green;
nchestw.Title=NULL;
nchestw.Flags=SMART_REFRESH | ACTIVATE | BORDERLESS;
nchestw.IDCMPFlags=GADGETDOWN|RAWKEY;
nchestw.FirstGadget=&continuegag;
nchestw.Screen=screen1;

if ((chestwindow=(struct Window *)OpenWindow(&nchestw))==NULL) cleanup();
rportchest=chestwindow->RPort;
PrintIText(rportchest, &cname, 0, 0);   
PrintIText(rportchest, &msg0, 0, 0);
PrintIText(rportchest, &msg1, 0, 0);

doublerr=FALSE;
doubleutil=FALSE;
card=getchestcard();

switch  (card)
   {
   case 0:
      msg4.IText=(UBYTE *)"FROM THE SALE";
      msg5.IText=(UBYTE *)"OF YOUR STOCK";
      msg7.IText=(UBYTE *)"YOU GET $45.";
      msg4.FrontPen=lt_blue;
      msg5.FrontPen=lt_blue;
      msg7.FrontPen=green;
      PrintIText(rportchest, &msg4, 40, 0);
      PrintIText(rportchest, &msg5, 40, 0);      
      PrintIText(rportchest, &msg7, 49, 0);
      eft(BANK, nowrolling, 45);
      break;
   case 1:  
      msg4.IText=(UBYTE *)"GO DIRECTLY TO JAIL!";
      msg4.FrontPen=dk_gray;
      msg6.IText=(UBYTE *)"DO NOT PASS GO!";
      msg6.FrontPen=lt_gray;
      msg8.IText=(UBYTE *)"DO NOT COLLECT $200!";
      msg8.FrontPen=red;
      PrintIText(rportchest, &msg4, 12, 0);
      PrintIText(rportchest, &msg6, 32, 0);      
      PrintIText(rportchest, &msg8, 12, 0);
      
      line0_text=0;   /*  will be > 147  COMMUNITY CHEST  */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
          instructIT[j].IText=instructline[hold_line++];

      donechest=FALSE;
      while (!donechest)
         {
         if (1<<chestwindow->UserPort->mp_SigBit)  ckchestmsg();
         }
      CloseWindow(chestwindow);
      sendtojail();
      return(0);
      break;
   case 2:
      msg3.IText=(UBYTE *)"You get a";
      msg4.IText=(UBYTE *)"GET OUT OF JAIL FREE!"; 
      msg4.FrontPen=white;
      msg5.IText=(UBYTE *)"card.";
      msg7.IText=(UBYTE *)"You may keep this";
      msg8.IText=(UBYTE *)"until needed, trade";
      msg9.IText=(UBYTE *)"it, or sell it.";
      PrintIText(rportchest, &msg3, 0, 0);      
      PrintIText(rportchest, &msg4, 0, 0);
      PrintIText(rportchest, &msg5, 0, 0);
      PrintIText(rportchest, &msg7, 0, 0);
      PrintIText(rportchest, &msg8, 0, 0);
      PrintIText(rportchest, &msg9, 0, 0);
      freecard[nowrolling]++;
      break;
   case 3:
      msg3.IText=(UBYTE *)"TWINS BORN!!";
      msg3.FrontPen=purple;
      msg5.IText=(UBYTE *)"HOSPITAL BILL DUE!";
      msg5.FrontPen=orange;
      msg7.IText=(UBYTE *)"Pay hospital $100.";
      msg7.FrontPen=red;
      PrintIText(rportchest, &msg3, 44, 0);      
      PrintIText(rportchest, &msg5, 20, 0);
      PrintIText(rportchest, &msg7, 20, 0);
      eft(nowrolling, BANK, 100);
      break;
   case 4:
      msg5.IText=(UBYTE *)"PAY SCHOOL TAX";
      msg5.FrontPen=orange;
      msg7.IText=(UBYTE *)"Amount due $150.";
      msg7.FrontPen=red;
      PrintIText(rportchest, &msg5, 36, 0);      
      PrintIText(rportchest, &msg7, 31, 0);
      eft(nowrolling, BANK, 150);      
      break;
   case 5:
      msg3.IText=(UBYTE *)"BROKEN LEG!!";
      msg3.FrontPen=tan;
      msg5.IText=(UBYTE *)"DOCTOR'S BILL DUE!";
      msg5.FrontPen=orange;
      msg7.IText=(UBYTE *)"Pay Doctor $50.";
      msg7.FrontPen=red;
      PrintIText(rportchest, &msg3, 44, 0);      
      PrintIText(rportchest, &msg5, 20, 0);
      PrintIText(rportchest, &msg7, 35, 0);
      eft(nowrolling, BANK, 50);
      break;
   case 6:
      msg5.IText=(UBYTE *)"LIFE INSURANCE MATURES.";
      msg7.IText=(UBYTE *)"COLLECT $100.";
      msg5.FrontPen=lt_blue;
      msg7.FrontPen=green;
      PrintIText(rportchest, &msg5, 0, 0);      
      PrintIText(rportchest, &msg7, 36, 0);
      eft(BANK, nowrolling, 100);
      break;
   case 7: 
      msg2.FrontPen=orange;
      msg3.FrontPen=red;
      msg4.FrontPen=red;
      msg5.FrontPen=red;
      msg6.FrontPen=maroon;
      msg7.FrontPen=red;
      msg8.FrontPen=maroon;
      msg9.FrontPen=red;     
      msg2.IText=(UBYTE *)"STREET REPAIRS!";
      msg3.IText=(UBYTE *)"PAY:";
      msg4.IText=(UBYTE *)"$40 per HOUSE";
      msg5.IText=(UBYTE *)"$115 per HOTEL";
      msg6.IText=(UBYTE *)"ASSESSMENT:";
      msg7.IText=(UBYTE *)"$";
      PrintIText(rportchest, &msg2, 32, 10);      
      PrintIText(rportchest, &msg3, 82, 10);      
      PrintIText(rportchest, &msg4, 40, 10);
      PrintIText(rportchest, &msg5, 40, 10);
      PrintIText(rportchest, &msg6, 53, 10);
      PrintIText(rportchest, &msg7, 0, 10);
      numhouses=counthouses();
      numhotels=counthotels();
      money=(LONG)((numhouses*40)+(numhotels*115));
      eft(nowrolling, SLUSH, (USHORT)money);
      showint(money, 1);    
      break;
   case 8:    /*   collect   */
      msg3.IText=(UBYTE *)"You Have Won";
      msg4.IText=(UBYTE *)"SECOND PRIZE";
      msg5.IText=(UBYTE *)"in a";
      msg6.IText=(UBYTE *)"BEAUTY CONTEST!";
      msg8.IText=(UBYTE *)"COLLECT $10.";
      msg3.FrontPen=white;
      msg4.FrontPen=lt_blue;
      msg5.FrontPen=lt_gray;
      msg6.FrontPen=dk_blue;
      msg8.FrontPen=green;
      PrintIText(rportchest, &msg3, 44, 0);
      PrintIText(rportchest, &msg4, 44, 0);
      PrintIText(rportchest, &msg5, 76, 0);
      PrintIText(rportchest, &msg6, 32, 0);
      PrintIText(rportchest, &msg8, 43, 0);
      eft(BANK, nowrolling, 10);
      break;
   case 9:
      msg4.IText=(UBYTE *)"PERFORM WEDDING!";
      msg6.IText=(UBYTE *)"Receive $25 for service.";
      msg4.FrontPen=white;
      msg6.FrontPen=green;
      PrintIText(rportchest, &msg4, 28, 0);
      PrintIText(rportchest, &msg6, 0, 0);      
      eft(BANK, nowrolling, 25);
      break;      
   case 10:
      msg4.IText=(UBYTE *)"BANK ERROR";
      msg5.IText=(UBYTE *)"IN YOUR FAVOR!";
      msg7.IText=(UBYTE *)"Collect $200.";
      msg4.FrontPen=dk_maroon;
      msg5.FrontPen=dk_maroon;
      msg7.FrontPen=green;
      PrintIText(rportchest, &msg4, 52, 0);
      PrintIText(rportchest, &msg5, 36, 0);      
      PrintIText(rportchest, &msg7, 43, 0);      
      eft(BANK, nowrolling, 200);
      break;
   case 11:
      msg5.IText=(UBYTE *)"INCOME TAX REFUND!";
      msg7.IText=(UBYTE *)"Collect $20.";
      msg5.FrontPen=flesh;
      msg7.FrontPen=green;
      PrintIText(rportchest, &msg5, 20, 0);      
      PrintIText(rportchest, &msg7, 47, 0);      
      eft(BANK, nowrolling, 20);
      break;
   case 12:
      msg4.IText=(UBYTE *)"GRAND OPERA OPENING!";
      msg6.IText=(UBYTE *)"Collect $50";
      msg7.IText=(UBYTE *)"from every player.";
      msg4.FrontPen=maroon;
      msg6.FrontPen=green;
      msg7.FrontPen=brite_green;
      PrintIText(rportchest, &msg4, 12, 0);      
      PrintIText(rportchest, &msg6, 48, 0);      
      PrintIText(rportchest, &msg7, 23, 0);
      if (nowrolling == 0)
         {
	 if (!notplaying[1])
	    {
	    if  (bankroll[1] < 50)  overdrawn(1, 50);
	    if  (bankroll[1] < 50)  outofgame(1, nowrolling);
            eft(1, nowrolling, 50);
	    }
 	 if (!notplaying[2])
	    {
	    if  (bankroll[2] < 50)  overdrawn(2, 50);
	    if  (bankroll[2] < 50)  outofgame(2, nowrolling);
            eft(2, nowrolling, 50);
	    }
 	 if (!notplaying[3])
	    {
	    if  (bankroll[3] < 50)  overdrawn(3, 50);
	    if  (bankroll[3] < 50)  outofgame(3, nowrolling);
            eft(3, nowrolling, 50);
	    }
         }
      if (nowrolling == 1)
         {
	 if (!notplaying[0])
	    {
	    if  (bankroll[0] < 50)  overdrawn(0, 50);
	    if  (bankroll[0] < 50)  outofgame(0, nowrolling);
            eft(0, nowrolling, 50);
	    }
 	 if (!notplaying[2])
	    {
	    if  (bankroll[2] < 50)  overdrawn(2, 50);
	    if  (bankroll[2] < 50)  outofgame(2, nowrolling);
            eft(2, nowrolling, 50);
	    }
 	 if (!notplaying[3])
	    {
	    if  (bankroll[3] < 50)  overdrawn(3, 50);
	    if  (bankroll[3] < 50)  outofgame(3, nowrolling);
            eft(3, nowrolling, 50);
	    }
         }
      if (nowrolling == 2)
         {
	 if (!notplaying[1])
	    {
	    if  (bankroll[1] < 50)  overdrawn(1, 50);
	    if  (bankroll[1] < 50)  outofgame(1, nowrolling);
            eft(1, nowrolling, 50);
	    }
 	 if (!notplaying[0])
	    {
	    if  (bankroll[0] < 50)  overdrawn(0, 50);
	    if  (bankroll[0] < 50)  outofgame(0, nowrolling);
            eft(0, nowrolling, 50);
	    }
 	 if (!notplaying[3])
	    {
	    if  (bankroll[3] < 50)  overdrawn(3, 50);
	    if  (bankroll[3] < 50)  outofgame(3, nowrolling);
            eft(3, nowrolling, 50);
	    }
         }
      if (nowrolling == 3)
         {
	 if (!notplaying[1])
	    {
	    if  (bankroll[1] < 50)  overdrawn(1, 50);
	    if  (bankroll[1] < 50)  outofgame(1, nowrolling);
            eft(1, nowrolling, 50);
	    }
 	 if (!notplaying[2])
	    {
	    if  (bankroll[2] < 50)  overdrawn(2, 50);
	    if  (bankroll[2] < 50)  outofgame(2, nowrolling);
            eft(2, nowrolling, 50);
	    }
 	 if (!notplaying[0])
	    {
	    if  (bankroll[0] < 50)  overdrawn(0, 50);
	    if  (bankroll[0] < 50)  outofgame(0, nowrolling);
            eft(0, nowrolling, 50);
	    }
         }
      break;
   case 13:
      msg4.IText=(UBYTE *)"RELATIVE DIES!";
      msg5.IText=(UBYTE *)"YOU INHERIT!";
      msg7.IText=(UBYTE *)"Collect $100.";
      msg4.FrontPen=tan;
      msg5.FrontPen=flesh;
      msg7.FrontPen=green;
      PrintIText(rportchest, &msg4, 36, 0);      
      PrintIText(rportchest, &msg5, 44, 0);      
      PrintIText(rportchest, &msg7, 47, 0);      
      eft(BANK, nowrolling, 100);
      break;
   case 14:
      msg5.IText=(UBYTE *)"ADVANCE TO GO!";
      msg6.IText=(UBYTE *)"COLLECT $200!!";
      msg5.FrontPen=green;
      msg6.FrontPen=green;
      PrintIText(rportchest, &msg5, 32, 0);
      PrintIText(rportchest, &msg6, 32, 0);

      line0_text=0;   /*  will be > 147  COMMUNITY CHEST  */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
          instructIT[j].IText=instructline[hold_line++];

      donechest=FALSE;
      while (!donechest)
         {
         if (1<<chestwindow->UserPort->mp_SigBit)  ckchestmsg();
         }
      CloseWindow(chestwindow);
      playerat[nowrolling]=0;
      if (nowrolling == 0)
         {
	 REDX=go[0][0];
	 REDY=go[1][0];
	 }
      if (nowrolling ==1)
         {
	 GREENX=go[0][1];
	 GREENY=go[1][1];
	 }
      if (nowrolling == 2)
         {
	 BLUEX=go[0][2];
	 BLUEY=go[1][2];
	 }
      if (nowrolling ==3)
         {
	 YELLOWX=go[0][3];
	 YELLOWY=go[1][3];
	 }
      WaitTOF();
      DrawGels();
      showpropinfo(0);
      return(0);
      break;
   case 15:
      msg3.IText=(UBYTE *)"CHRISTMAS";
      msg4.IText=(UBYTE *)"FUND";
      msg5.IText=(UBYTE *)"MATURES!";
      msg7.IText=(UBYTE *)"Collect $100.";
      msg3.FrontPen=red;
      msg4.FrontPen=brite_green;
      msg5.FrontPen=red;
      msg7.FrontPen=green;
      PrintIText(rportchest, &msg3, 56, 0);      
      PrintIText(rportchest, &msg4, 76, 0);      
      PrintIText(rportchest, &msg5, 60, 0);      
      PrintIText(rportchest, &msg7, 47, 0);      
      eft(BANK, nowrolling, 100);
      break;
   } /*  end of switch  */

line0_text=0;   /*  will be > 147  COMMUNITY CHEST  */
for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
    instructIT[j].IText=instructline[hold_line++];

donechest=FALSE;
while (!donechest)
   {
   if (1<<chestwindow->UserPort->mp_SigBit)  ckchestmsg();
   }
CloseWindow(chestwindow);
return(0);
}



USHORT chance()
{
USHORT card, numhouses, numhotels, hold_line;
LONG money;
struct IntuiText msg0, msg1, msg2, msg3, msg4, msg5, msg6,
                       msg7, msg8, msg9;

line0_text=0;   /*   will be > 147   CHANCE   */
for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
   instructIT[j].IText=instructline[hold_line++];

msg0.FrontPen=chance_orange;
msg1.FrontPen=chance_orange;
msg2.FrontPen=chance_orange;
msg3.FrontPen=chance_orange;
msg4.FrontPen=chance_orange;
msg5.FrontPen=chance_orange;
msg6.FrontPen=chance_orange;
msg7.FrontPen=chance_orange;
msg8.FrontPen=chance_orange;
msg9.FrontPen=chance_orange;
outstr.FrontPen=red;

msg0.BackPen=0;
msg0.DrawMode=JAM1;
msg0.LeftEdge=5;
msg0.TopEdge=20;
msg0.ITextFont=NULL;
msg0.NextText=NULL;
msg0.IText=(UBYTE *)"You have landed";

msg1.BackPen=0;
msg1.DrawMode=JAM1;
msg1.LeftEdge=5;
msg1.TopEdge=30;
msg1.ITextFont=NULL;
msg1.NextText=NULL;
msg1.IText=(UBYTE *)"on CHANCE.";

msg2.BackPen=0;
msg2.DrawMode=JAM1;
msg2.LeftEdge=5;
msg2.TopEdge=40;
msg2.ITextFont=NULL;
msg2.NextText=NULL;


msg3.BackPen=0;
msg3.DrawMode=JAM1;
msg3.LeftEdge=5;
msg3.TopEdge=50;
msg3.ITextFont=NULL;
msg3.NextText=NULL;

msg4.BackPen=0;
msg4.DrawMode=JAM1;
msg4.LeftEdge=5;
msg4.TopEdge=60;
msg4.ITextFont=NULL;
msg4.NextText=NULL;

msg5.BackPen=0;
msg5.DrawMode=JAM1;
msg5.LeftEdge=5;
msg5.TopEdge=70;
msg5.ITextFont=NULL;
msg5.NextText=NULL;

msg6.BackPen=0;
msg6.DrawMode=JAM1;
msg6.LeftEdge=5;
msg6.TopEdge=80;
msg6.ITextFont=NULL;
msg6.NextText=NULL;

msg7.BackPen=0;
msg7.DrawMode=JAM1;
msg7.LeftEdge=5;
msg7.TopEdge=90;
msg7.ITextFont=NULL;
msg7.NextText=NULL;

msg8.BackPen=0;
msg8.DrawMode=JAM1;
msg8.LeftEdge=5;
msg8.TopEdge=100;
msg8.ITextFont=NULL;
msg8.NextText=NULL;

msg9.BackPen=0;
msg9.DrawMode=JAM1;
msg9.LeftEdge=5;
msg9.TopEdge=110;
msg9.ITextFont=NULL;
msg9.NextText=NULL;

outstr.BackPen=0;
outstr.DrawMode=JAM1;
outstr.LeftEdge=15;
outstr.TopEdge=110;
outstr.ITextFont=NULL;
outstr.NextText=NULL;

nchancew.LeftEdge=63;
nchancew.TopEdge=29;
nchancew.Width=194;
nchancew.Height=143;
nchancew.DetailPen=white;
nchancew.BlockPen=green;
nchancew.Title=NULL;
nchancew.Flags=SMART_REFRESH | ACTIVATE | BORDERLESS;
nchancew.IDCMPFlags=GADGETDOWN|RAWKEY;
nchancew.FirstGadget=&continuegag;
nchancew.Screen=screen1;

if ((chancewindow=(struct Window *)OpenWindow(&nchancew))==NULL) cleanup();
rportchance=chancewindow->RPort;
PrintIText(rportchance, &cname, 0, 0);   
PrintIText(rportchance, &msg0, 0, 0);
PrintIText(rportchance, &msg1, 0, 0);

doublerr=FALSE;
doubleutil=FALSE;
card=getchancecard();

switch  (card)
   {
   case 0:
      msg3.IText=(UBYTE *)"ADVANCE TO";
      msg4.FrontPen=red;
      msg4.IText=(UBYTE *)"ILLINOIS AVE.";  
      msg6.IText=(UBYTE *)"If you pass GO";
      msg7.IText=(UBYTE *)"collect $200."; 
      msg6.FrontPen=green;   
      msg7.FrontPen=green;   
      PrintIText(rportchance, &msg3, 52, 0);
      PrintIText(rportchance, &msg4, 40, 0);
      PrintIText(rportchance, &msg6, 0, 0);
      PrintIText(rportchance, &msg7, 0, 0);
      if  (nowrolling == 0)
         {
	 REDX=il[0][0];
	 REDY=il[1][0];	 
	 }
      if  (nowrolling == 1)
         {
	 GREENX=il[0][1];
	 GREENY=il[1][1];	 
	 }
      if  (nowrolling == 2)
         {
	 BLUEX=il[0][2];
	 BLUEY=il[1][2];	 
	 }
      if  (nowrolling == 3)
         {
	 YELLOWX=il[0][3];
	 YELLOWY=il[1][3];	 
	 }
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      if (playerat[nowrolling] == 36)
         {
	 passgo();      
         eft(BANK, nowrolling, 200);
	 }
      WaitTOF();
      DrawGels();
      showpropinfo(24);
      playerat[nowrolling]=24;
      return(0);
      break;
   case 1:  
      msg4.IText=(UBYTE *)"GO DIRECTLY TO JAIL!";
      msg4.FrontPen=dk_gray;
      msg6.IText=(UBYTE *)"DO NOT PASS GO!";
      msg6.FrontPen=lt_gray;
      msg8.IText=(UBYTE *)"DO NOT COLLECT $200!";
      msg8.FrontPen=red;
      PrintIText(rportchance, &msg4, 12, 0);
      PrintIText(rportchance, &msg6, 32, 0);      
      PrintIText(rportchance, &msg8, 12, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];
      
      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      sendtojail();
      return(0);
      break;
   case 2:
      msg3.IText=(UBYTE *)"You get a";
      msg4.IText=(UBYTE *)"GET OUT OF JAIL FREE!"; 
      msg4.FrontPen=white;
      msg5.IText=(UBYTE *)"card.";
      msg7.IText=(UBYTE *)"You may keep this";
      msg8.IText=(UBYTE *)"until needed, trade";
      msg9.IText=(UBYTE *)"it, or sell it.";
      PrintIText(rportchance, &msg3, 0, 0);      
      PrintIText(rportchance, &msg4, 0, 0);
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg7, 0, 0);
      PrintIText(rportchance, &msg8, 0, 0);
      PrintIText(rportchance, &msg9, 0, 0);
      freecard[nowrolling]++;
      break;
   case 3:
      msg3.IText=(UBYTE *)"EXTRA! EXTRA!!";
      msg3.FrontPen=yellow;
      msg5.IText=(UBYTE *)"YOU ARE ELECTED";
      msg5.FrontPen=royal_blue;
      msg6.IText=(UBYTE *)"CHAIRPERSON OF";
      msg6.FrontPen=royal_blue;
      msg7.IText=(UBYTE *)"THE BOARD!!!";
      msg7.FrontPen=royal_blue;
      msg9.IText=(UBYTE *)"Pay everyone $50.";
      msg9.FrontPen=red;
      PrintIText(rportchance, &msg3, 36, 0);      
      PrintIText(rportchance, &msg5, 28, 0);
      PrintIText(rportchance, &msg6, 36, 0);
      PrintIText(rportchance, &msg7, 40, 0);
      PrintIText(rportchance, &msg9, 20, 0);
      if  (bankroll[nowrolling] < 50*(ntp-1) )
           overdrawn(nowrolling, 50*(ntp-1) );
      if  (bankroll[nowrolling] < 50*(ntp-1) )  outofgame(nowrolling, BANK);
      if  (!notplaying[nowrolling])
         {
	 if (!notplaying[0] && (nowrolling != 0) )  eft(nowrolling, 0, 50);
	 if (!notplaying[1] && (nowrolling != 1) )  eft(nowrolling, 1, 50);
	 if (!notplaying[2] && (nowrolling != 2) )  eft(nowrolling, 2, 50);
	 if (!notplaying[3] && (nowrolling != 3) )  eft(nowrolling, 3, 50);
         }
      break;
   case 4:
   case 13:
      msg3.IText=(UBYTE *)"Advance token to";
      msg4.IText=(UBYTE *)"the nearest";
      msg5.IText=(UBYTE *)"RAILROAD.";
      msg7.IText=(UBYTE *)"If someone else";
      msg8.IText=(UBYTE *)"owns it pay TWICE";
      msg9.IText=(UBYTE *)"the normal rent.";
      msg7.FrontPen=red;
      msg8.FrontPen=red;
      msg9.FrontPen=red;
      PrintIText(rportchance, &msg3, 0, 0);
      PrintIText(rportchance, &msg4, 0, 0);      
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg7, 0, 0);
      PrintIText(rportchance, &msg8, 0, 0);
      PrintIText(rportchance, &msg9, 0, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];
      
      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);           
      doublerr=TRUE;
      if  (playerat[nowrolling] == 7)
         {
	 playerat[nowrolling]=15;
	 if  (nowrolling == 0)
	    {
	    REDX=rrp[0][0];
	    REDY=rrp[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=rrp[0][1];
	    GREENY=rrp[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=rrp[0][2];
	    BLUEY=rrp[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=rrp[0][3];
	    YELLOWY=rrp[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(15);
	 }
      if  (playerat[nowrolling] == 22)
         {
	 playerat[nowrolling]=25;
	 if  (nowrolling == 0)
	    {
	    REDX=rrb[0][0];
	    REDY=rrb[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=rrb[0][1];
	    GREENY=rrb[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=rrb[0][2];
	    BLUEY=rrb[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=rrb[0][3];
	    YELLOWY=rrb[1][3];
	    } 
	 WaitTOF();
	 DrawGels();    
         showpropinfo(25);
	 }
      if  (playerat[nowrolling] == 36)
         {
	 passgo();
         eft(BANK, nowrolling, 200);
	 playerat[nowrolling]=5;
	 if  (nowrolling == 0)
	    {
	    REDX=rrr[0][0];
	    REDY=rrr[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=rrr[0][1];
	    GREENY=rrr[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=rrr[0][2];
	    BLUEY=rrr[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=rrr[0][3];
	    YELLOWY=rrr[1][3];
	    }      
	 WaitTOF();
	 DrawGels();      
         showpropinfo(5);
	 }    
      return(0);
      break;
   case 5:
      msg5.IText=(UBYTE *)"GO BACK";
      msg6.IText=(UBYTE *)"THREE SPACES!";
      PrintIText(rportchance, &msg5, 60, 0);
      PrintIText(rportchance, &msg6, 36, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      if  (playerat[nowrolling] == 7)
         {
	 if  (nowrolling == 0)
	    {
	    REDX=itax[0][0];
	    REDY=itax[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=itax[0][1];
	    GREENY=itax[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=itax[0][2];
	    BLUEY=itax[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=itax[0][3];
	    YELLOWY=itax[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(4);
	 }
      if  (playerat[nowrolling] == 22)
         {
	 if  (nowrolling == 0)
	    {
	    REDX=ny[0][0];
	    REDY=ny[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=ny[0][1];
	    GREENY=ny[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=ny[0][2];
	    BLUEY=ny[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=ny[0][3];
	    YELLOWY=ny[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(19);
	 }
      if  (playerat[nowrolling] == 36)
         {
	 if  (nowrolling == 0)
	    {
	    REDX=cc3[0][0];
	    REDY=cc3[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=cc3[0][1];
	    GREENY=cc3[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=cc3[0][2];
	    BLUEY=cc3[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=cc3[0][3];
	    YELLOWY=cc3[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(33);
	 }
      playerat[nowrolling]=playerat[nowrolling]-3;
      return(0);
      break;
   case 6:
      msg2.IText=(UBYTE *)"Advance token to";
      msg3.IText=(UBYTE *)"the nearest UTILITY.";
      msg5.IText=(UBYTE *)"If someone else";
      msg6.IText=(UBYTE *)"owns it, roll the";
      msg7.IText=(UBYTE *)"dice.  Pay ten";
      msg8.IText=(UBYTE *)"times the total";
      msg9.IText=(UBYTE *)"of both dice.";
      msg5.FrontPen=red;
      msg6.FrontPen=red;
      msg7.FrontPen=red;
      msg8.FrontPen=red;
      msg9.FrontPen=red;
      PrintIText(rportchance, &msg2, 0, 0);
      PrintIText(rportchance, &msg3, 0, 0);      
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg6, 0, 0);
      PrintIText(rportchance, &msg7, 0, 0);
      PrintIText(rportchance, &msg8, 0, 0);
      PrintIText(rportchance, &msg9, 0, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      doubleutil=TRUE;
      if  (playerat[nowrolling] == 7)
         {
	 playerat[nowrolling]=12;
	 if  (nowrolling == 0)
	    {
	    REDX=eco[0][0];
	    REDY=eco[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=eco[0][1];
	    GREENY=eco[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=eco[0][2];
	    BLUEY=eco[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=eco[0][3];
	    YELLOWY=eco[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(12);
	 }
      if  (playerat[nowrolling] == 22)
         {
	 playerat[nowrolling]=28;
	 if  (nowrolling == 0)
	    {
	    REDX=ww[0][0];
	    REDY=ww[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=ww[0][1];
	    GREENY=ww[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=ww[0][2];
	    BLUEY=ww[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=ww[0][3];
	    YELLOWY=ww[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(28);
	 }
      if  (playerat[nowrolling] == 36)
         {
	 playerat[nowrolling]=12;
	 eft(BANK, nowrolling, 200);
	 passgo();
	 if  (nowrolling == 0)
	    {
	    REDX=eco[0][0];
	    REDY=eco[1][0];
	    }
	 if  (nowrolling == 1)
	    {
	    GREENX=eco[0][1];
	    GREENY=eco[1][1];
	    }
	 if  (nowrolling == 2)
	    {
	    BLUEX=eco[0][2];
	    BLUEY=eco[1][2];
	    }
	 if  (nowrolling == 3)
	    {
	    YELLOWX=eco[0][3];
	    YELLOWY=eco[1][3];
	    }      
	 WaitTOF();
	 DrawGels();
         showpropinfo(12);
	 }
      return(0);
      break;
   case 7:      
      msg3.IText=(UBYTE *)"MAKE REPAIRS!";
      msg4.IText=(UBYTE *)"PAY:";
      msg5.IText=(UBYTE *)"$25 per HOUSE";
      msg6.IText=(UBYTE *)"$100 per HOTEL";
      msg8.IText=(UBYTE *)"ASSESSMENT:";
      msg9.IText=(UBYTE *)"$";
      msg3.FrontPen=yellow;
      msg4.FrontPen=red;
      msg5.FrontPen=red;
      msg6.FrontPen=red;
      msg8.FrontPen=maroon;
      msg9.FrontPen=red;
      PrintIText(rportchance, &msg3, 36, 0);      
      PrintIText(rportchance, &msg4, 72, 0);
      PrintIText(rportchance, &msg5, 36, 0);
      PrintIText(rportchance, &msg6, 32, 0);
      PrintIText(rportchance, &msg8, 44, 0);
      PrintIText(rportchance, &msg9, 0, 0);
      numhouses=counthouses();
      numhotels=counthotels();
      money=(LONG)((numhouses*25)+(numhotels*100));
      eft(nowrolling, SLUSH, (USHORT)money);
      showint(money, 0);
      break;
   case 8:
      msg4.IText=(UBYTE *)"YOUR BUILDING AND";
      msg5.IText=(UBYTE *)"LOAN MATURES.";
      msg7.IText=(UBYTE *)"COLLECT $150.";
      msg4.FrontPen=lt_blue;
      msg5.FrontPen=lt_blue;
      msg7.FrontPen=green;
      PrintIText(rportchance, &msg4, 20, 0);
      PrintIText(rportchance, &msg5, 36, 0);      
      PrintIText(rportchance, &msg7, 36, 0);
      eft(BANK, nowrolling, 150);
      break;
   case 9:
      msg4.IText=(UBYTE *)"BANK PAYS YOU";
      msg5.IText=(UBYTE *)"DIVIDEND OF $50.";
      msg4.FrontPen=green;
      msg5.FrontPen=green;
      PrintIText(rportchance, &msg4, 36, 0);
      PrintIText(rportchance, &msg5, 24, 0);      
      eft(BANK, nowrolling, 50);
      break;      
   case 10:
      msg4.IText=(UBYTE *)"Take a ride";
      msg5.IText=(UBYTE *)"on the READING.";
      msg7.IText=(UBYTE *)"IF you pass GO";
      msg8.IText=(UBYTE *)"collect $200.";
      msg7.FrontPen=green;
      msg8.FrontPen=green;
      PrintIText(rportchance, &msg4, 0, 0);
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg7, 0, 0);
      PrintIText(rportchance, &msg8, 0, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
          instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      passgo();
      eft(BANK, nowrolling, 200);      
      playerat[nowrolling]=5;
      if (nowrolling == 0)
         {
	 REDX=rrr[0][0];
	 REDY=rrr[1][0];
	 }
      if (nowrolling ==1)
         {
	 GREENX=rrr[0][1];
	 GREENY=rrr[1][1];
	 }
      if (nowrolling == 2)
         {
	 BLUEX=rrr[0][2];
	 BLUEY=rrr[1][2];
	 }
      if (nowrolling ==3)
         {
	 YELLOWX=rrr[0][3];
	 YELLOWY=rrr[1][3];
	 }
      WaitTOF();
      DrawGels();
      showpropinfo(5);
      return(0);
      break;
   case 11:      
      msg5.IText=(UBYTE *)"Pay POOR TAX";
      msg6.IText=(UBYTE *)"of $15.";
      msg5.FrontPen=red;
      msg6.FrontPen=red;
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg6, 0, 0);
      eft(nowrolling, SLUSH, 15);
      break;
   case 12:
      msg5.IText=(UBYTE *)"Take a walk on the";
      msg6.IText=(UBYTE *)"BOARD WALK.";
      msg6.FrontPen=dk_blue;
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg6, 0, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      playerat[nowrolling]=39;
      if (nowrolling == 0)
         {
	 REDX=bw[0][0];
	 REDY=bw[1][0];
	 }
      if (nowrolling ==1)
         {
	 GREENX=bw[0][1];
	 GREENY=bw[1][1];
	 }
      if (nowrolling == 2)
         {
	 BLUEX=bw[0][2];
	 BLUEY=bw[1][2];
	 }
      if (nowrolling ==3)
         {
	 YELLOWX=bw[0][3];
	 YELLOWY=bw[1][3];
	 }
      WaitTOF();
      DrawGels();
      showpropinfo(39);
      return(0);
      break;
   case 14:
      msg5.IText=(UBYTE *)"ADVANCE TO GO!";
      msg6.IText=(UBYTE *)"COLLECT $200!!";
      msg5.FrontPen=green;
      msg6.FrontPen=green;
      PrintIText(rportchance, &msg5, 32, 0);
      PrintIText(rportchance, &msg6, 32, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
          instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      playerat[nowrolling]=0;
      if (nowrolling == 0)
         {
	 REDX=go[0][0];
	 REDY=go[1][0];
	 }
      if (nowrolling ==1)
         {
	 GREENX=go[0][1];
	 GREENY=go[1][1];
	 }
      if (nowrolling == 2)
         {
	 BLUEX=go[0][2];
	 BLUEY=go[1][2];
	 }
      if (nowrolling ==3)
         {
	 YELLOWX=go[0][3];
	 YELLOWY=go[1][3];
	 }
      WaitTOF();
      DrawGels();
      showpropinfo(0);
      return(0);
      break;
   case 15:
      msg4.IText=(UBYTE *)"Advance to";
      msg5.FrontPen=maroon;
      msg5.IText=(UBYTE *)"ST. CHARLES PLACE.";
      msg7.IText=(UBYTE *)"IF you pass GO";
      msg8.IText=(UBYTE *)"collect $200.";
      msg7.FrontPen=green;
      msg8.FrontPen=green;
      PrintIText(rportchance, &msg4, 0, 0);
      PrintIText(rportchance, &msg5, 0, 0);
      PrintIText(rportchance, &msg7, 0, 0);
      PrintIText(rportchance, &msg8, 0, 0);
      
      line0_text=0;   /*   will be > 147   CHANCE   */
      for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
         instructIT[j].IText=instructline[hold_line++];

      donechance=FALSE;
      while (!donechance)
         {
         if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
         }
      CloseWindow(chancewindow);
      if (playerat[nowrolling] != 7)
         {
	 eft(BANK, nowrolling, 200); 
	 passgo();
	 }     
      if  (nowrolling == 0)
         {
	 REDX=stc[0][0];
	 REDY=stc[1][0];	 
	 }
      if  (nowrolling == 1)
         {
	 GREENX=stc[0][1];
	 GREENY=stc[1][1];	 
	 }
      if  (nowrolling == 2)
         {
	 BLUEX=stc[0][2];
	 BLUEY=stc[1][2];	 
	 }
      if  (nowrolling == 3)
         {
	 YELLOWX=stc[0][3];
	 YELLOWY=stc[1][3];	 
	 }
      playerat[nowrolling]=11;
      WaitTOF();
      DrawGels();
      showpropinfo(11);
      return(0);
      break;
   } /*  end of switch  */

line0_text=0;   /*   will be > 147   CHANCE   */
for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
   instructIT[j].IText=instructline[hold_line++];

donechance=FALSE;
while (!donechance)
   {
   if (1<<chancewindow->UserPort->mp_SigBit)  ckchancemsg();
   }
CloseWindow(chancewindow);
return(0);
} 
