home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_oth / monopoly.lzh / monopoly_source.LZH / f18.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-06  |  2.8 KB  |  116 lines

  1. #include "mono:defines"
  2. #include "mono:xvariables"
  3.  
  4.  
  5.  
  6.  
  7.  
  8. VOID scroll_text(how)
  9. USHORT how;
  10. {
  11. USHORT hold_line;
  12. int iter;
  13.  
  14. SetAPen(rportinstruct,lt_blue);
  15.  
  16. if (how == UP)
  17.    {
  18.    if (line0_text >= (MAX_LINES-SHOW_LINES))
  19.       {
  20.       DisplayBeep(screen1);
  21.       return;
  22.       }
  23.    RectFill(rportinstruct, 1, 11, 317, 184);   
  24.    for (iter=0, hold_line=(++line0_text); iter<SHOW_LINES; iter++)
  25.       instructIT[iter].IText=instructline[hold_line++];
  26.    PrintIText(rportinstruct, &instructIT[0], 0, 0);
  27.    return;
  28.    }
  29. if (how == DOWN)
  30.    {
  31.    if (line0_text == 0)
  32.       {
  33.       DisplayBeep(screen1);
  34.       return;
  35.       }
  36.    RectFill(rportinstruct, 1, 11, 317, 184);   
  37.    for (iter=0, hold_line=(--line0_text); iter<SHOW_LINES; iter++)
  38.       instructIT[iter].IText=instructline[hold_line++];
  39.    PrintIText(rportinstruct, &instructIT[0], 0, 0);
  40.    return;
  41.    }
  42. if (how == PAGE)
  43.    {
  44.    if (line0_text > (MAX_LINES-SHOW_LINES-SHOW_LINES))
  45.       line0_text=(MAX_LINES-SHOW_LINES-SHOW_LINES);
  46.    RectFill(rportinstruct, 1, 11, 317, 184);
  47.    for (iter=0, hold_line=(line0_text+=SHOW_LINES); iter<SHOW_LINES; iter++)
  48.       instructIT[iter].IText=instructline[hold_line++];
  49.    PrintIText(rportinstruct, &instructIT[0], 0, 0);
  50.    return;
  51.    }
  52. }
  53.  
  54. VOID ckinstructmsg()
  55. {
  56. ULONG instructclass;
  57. USHORT  instructcode;
  58. USHORT hold_line;
  59. instructclass=0;
  60. instructcode=0;
  61.  
  62.  
  63. while(instructmsg=(struct IntuiMessage *)GetMsg(instructwindow->UserPort))
  64.    {
  65.    instructclass = instructmsg->Class;
  66.    instructcode = instructmsg->Code;
  67.    if (instructclass == GADGETUP)  getID(instructmsg);
  68.    ReplyMsg(instructmsg);
  69.    }
  70. if ( (instructclass == RAWKEY) && (instructcode == HELP) )
  71.    {
  72.    line0_text=0;   /*  within instructions   */
  73.    for (j=0, hold_line=line0_text; j<SHOW_LINES; j++)
  74.       instructIT[j].IText=instructline[hold_line++];
  75.    RectFill(rportinstruct, 1, 11, 317, 184);   
  76.    PrintIText(rportinstruct, &instructIT[0], 0, 0);
  77.    }
  78. if(instructclass == CLOSEWINDOW)
  79.    {
  80.    instruct=FALSE;
  81.    RemoveGadget(instructwindow, &dnscrollgag);
  82.    RemoveGadget(instructwindow, &upscrollgag);
  83.    RemoveGadget(instructwindow, &instructpagegag);
  84.    CloseWindow(instructwindow);
  85.    }
  86. if (instructclass == GADGETUP)
  87.    {
  88.    if (gagid == 31)  scroll_text(PAGE);
  89.    if (gagid == 32)  scroll_text(UP);
  90.    if (gagid == 33)  scroll_text(DOWN);
  91.    }
  92. }
  93.  
  94. VOID instruction()
  95. {
  96. ninstructw.Screen = screen1;
  97. ninstructw.FirstGadget=&instructpagegag;
  98. instructpagegag.NextGadget=&upscrollgag;
  99. upscrollgag.NextGadget=&dnscrollgag;
  100. if ((instructwindow=(struct Window *)OpenWindow(&ninstructw))==NULL) cleanup();
  101. rportinstruct=instructwindow->RPort;
  102. SetAPen(rportinstruct,lt_blue);
  103. RectFill(rportinstruct, 1, 11, 317, 184);   
  104.  
  105.  
  106. PrintIText(rportinstruct, &instructIT[0], 0, 0);
  107.  
  108.  
  109. instruct=TRUE;
  110. while (instruct)
  111.    {
  112.    Wait(1<<instructwindow->UserPort->mp_SigBit);
  113.    ckinstructmsg();
  114.    }
  115. }
  116.