home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / demo / help.c < prev    next >
Text File  |  1990-06-14  |  6KB  |  360 lines

  1. #include "demo.h"
  2. void
  3. MusicSwitch()
  4. {
  5.     if (MusicFlag) {
  6.         MusicStop();
  7.     } else {
  8.         MusicStart(MusicTable[region]);
  9.     }
  10. }
  11. void
  12. InitialStart()
  13. {
  14.     int joy;
  15.     
  16.     EGB_writeMode(GWork,0);
  17.     ClrObject();
  18.     region = 0;
  19.     Myx = 1;
  20.     Myy = 3;
  21.     level = 0;
  22.     mapedit();
  23.     DispObject();
  24. }
  25. void
  26. SpeedSelect()
  27. {
  28.     int joy,select,x,y,bsel,end;
  29.     BOX box;
  30.     
  31.     while ((joy & 0xff) != 0xff) {
  32.         SND_joy_in_2(0,&joy);
  33.     }
  34.     
  35.     EGB_color(GWork,0,6);
  36.     EGB_color(GWork,2,6);
  37.     EGB_writeMode(GWork,4);
  38.     
  39.     select = 0;
  40.     end = 0;
  41.     
  42.     x = select*100+273+4;
  43.     y = 416+8+4;
  44.     
  45.     box.x1 = x;
  46.     box.y1 = y;
  47.     box.x2 = x+98;
  48.     box.y2 = y+19;
  49.     EGB_rectangle(GWork,(char *)&box);
  50.     
  51.     do {
  52.         SND_joy_in_2(0,&joy);
  53.         
  54.         bsel = select;
  55.         
  56.         if (JoyStatus(joy,RIGHT)) {
  57.             if (select < 2) {
  58.                 select++;
  59.             }
  60.         } else if (JoyStatus(joy,LEFT)) {
  61.             if (select > 0) {
  62.                 select--;
  63.             }
  64.         } else if (JoyStatus(joy,TR_A) || JoyStatus(joy,TR_B)) {
  65.             switch (select) {
  66.             case 0:
  67.                 WaitCnt = 500;
  68.                 end = 1;
  69.                 break;
  70.             case 1:
  71.                 WaitCnt = 200;
  72.                 end = 1;
  73.                 break;
  74.             case 2:
  75.                 WaitCnt = 0;
  76.                 end = 1;
  77.                 break;
  78.             }
  79.         }
  80.         if (bsel != select) {
  81.             x = bsel*100+273+4;
  82.             y = 416+8+4;
  83.             
  84.             box.x1 = x;
  85.             box.y1 = y;
  86.             box.x2 = x+98;
  87.             box.y2 = y+19;
  88.             EGB_rectangle(GWork,(char *)&box);
  89.             
  90.             x = select*100+273+4;
  91.             y = 416+8+4;
  92.             
  93.             box.x1 = x;
  94.             box.y1 = y;
  95.             box.x2 = x+98;
  96.             box.y2 = y+19;
  97.             EGB_rectangle(GWork,(char *)&box);
  98.         }
  99.         
  100.         while ((joy & 0xff) != 0xff) {
  101.             SND_joy_in_2(0,&joy);
  102.         }
  103.         
  104.     } while(!end);
  105.     
  106.     EGB_writeMode(GWork,0);
  107.     
  108. }
  109. void
  110. GameSpeed()
  111. {
  112.     BOX box;
  113.     LINE line;
  114.     STRING    string;
  115.     int cnt;
  116.     char *buf;
  117.     char *menumes[3] ={
  118.         "  SLOW ",
  119.         "NORMAL",
  120.         "  FAST "
  121.     };
  122.     
  123.     EGB_writeMode(GWork,0);
  124.     
  125.     EGB_color(GWork,0,9);
  126.     EGB_color(GWork,2,9);
  127.     EGB_paintMode(GWork,0x22);
  128.     
  129.     box.x1 = 273;
  130.     box.y1 = 416+8;
  131.     box.x2 = 579;
  132.     box.y2 = 447+4;
  133.     EGB_rectangle(GWork,(char *)&box);
  134.     
  135.     EGB_color(GWork,0,15);
  136.     EGB_color(GWork,2,15);
  137.     
  138.     box.x1 = 273+4;
  139.     box.y1 = 416+8+4;
  140.     box.x2 = 579-4;
  141.     box.y2 = 447;
  142.     EGB_rectangle(GWork,(char *)&box);
  143.     
  144.     EGB_color(GWork,0,9);
  145.     
  146.     line.no = 2;
  147.     line.x1 = 273+4+100-1;
  148.     line.y1 = 416+8+4;
  149.     line.x2 = 273+4+100-1;
  150.     line.y2 = 448;
  151.     EGB_unConnect(GWork,(char *)&line);
  152.     
  153.     line.x1 = 273+4+200-1;
  154.     line.y1 = 416+8+4;
  155.     line.x2 = 273+4+200-1;
  156.     line.y2 = 448;
  157.     EGB_unConnect(GWork,(char *)&line);
  158.     
  159.     EGB_color(GWork,0,9);
  160.     for (cnt=0;cnt<3;cnt++) {
  161.         string.x = 273+4-1+cnt*100+2;
  162.         string.y = 416+8+4+18;
  163.         string.len = 12;
  164.         strcpy((char *)string.str,menumes[cnt]);
  165.         EGB_sjisString(GWork,(char *)&string);
  166.     }
  167.     
  168.     SpeedSelect();
  169.     
  170.     EGB_writeMode(GWork,4);
  171. }
  172. int
  173. MenuSelect()
  174. {
  175.     int joy,select,x,y,bsel,ret,end;
  176.     BOX box;
  177.     
  178.     EGB_color(GWork,0,6);
  179.     EGB_color(GWork,2,6);
  180.     EGB_writeMode(GWork,4);
  181.     
  182.     select = 0;
  183.     ret = 0;
  184.     end = 0;
  185.     
  186.     x = (select / 2)*100+273+4;
  187.     y = (select % 2)*21+416+8+4;
  188.     
  189.     box.x1 = x;
  190.     box.y1 = y;
  191.     box.x2 = x+98;
  192.     box.y2 = y+19;
  193.     EGB_rectangle(GWork,(char *)&box);
  194.     
  195.     ret = 0;
  196.     
  197.     do {
  198.         SND_joy_in_2(0,&joy);
  199.         
  200.         bsel = select;
  201.         
  202.         if (JoyStatus(joy,UP)) {
  203.             if (select % 2) {
  204.                 select--;
  205.             }
  206.         } else if (JoyStatus(joy,DOWN)){
  207.             if (!(select % 2)) {
  208.                 select++;
  209.             }
  210.         } else if (JoyStatus(joy,RIGHT)) {
  211.             if ((select / 2) < 2) {
  212.                 select += 2;
  213.             }
  214.         } else if (JoyStatus(joy,LEFT)) {
  215.             if ((select / 2) > 0) {
  216.                 select -= 2;
  217.             }
  218.         } else if (JoyStatus(joy,TR_A) || JoyStatus(joy,TR_B)) {
  219.             switch (select) {
  220.             case 0:
  221.                 end = 1;
  222.                 break;
  223.             case 1:
  224.                 GameSpeed();
  225.                 end = 1;
  226.                 break;
  227.             case 2:
  228.                 MusicSwitch();
  229.                 end = 1;
  230.                 break;
  231.             case 3:
  232.                 break;
  233.             case 4:
  234. /*
  235.                 InitialStart();
  236.                 end = 1;
  237. */
  238.                 break;
  239.             case 5:
  240.                 end = 1;
  241.                 ret = 1;
  242.                 break;
  243.             }
  244.         }
  245.         if (bsel != select) {
  246.             x = (bsel / 2)*100+273+4;
  247.             y = (bsel % 2)*21+416+8+4;
  248.             
  249.             box.x1 = x;
  250.             box.y1 = y;
  251.             box.x2 = x+98;
  252.             box.y2 = y+19;
  253.             EGB_rectangle(GWork,(char *)&box);
  254.             
  255.             x = (select / 2)*100+273+4;
  256.             y = (select % 2)*21+416+8+4;
  257.             
  258.             box.x1 = x;
  259.             box.y1 = y;
  260.             box.x2 = x+98;
  261.             box.y2 = y+19;
  262.             EGB_rectangle(GWork,(char *)&box);
  263.         }
  264.         
  265.         while ((joy & 0xff) != 0xff) {
  266.             SND_joy_in_2(0,&joy);
  267.         }
  268.         
  269.     } while(!end);
  270.     
  271.     EGB_writeMode(GWork,0);
  272.     
  273.     return(ret);
  274. }
  275.  
  276. int
  277. Help()
  278. {
  279.     int ret;
  280.     GETPUT get;
  281.     BOX box;
  282.     LINE line;
  283.     STRING    string;
  284.     int cnt;
  285.     char *buf;
  286.     char *menumes[6] ={
  287.         "CANSEL",
  288.         " SPEED ",
  289.         " MUSIC ",
  290.         "            ",
  291.         "      ",
  292.         " EXIT  "
  293.     };
  294.     
  295.     buf = malloc(64*308/2);
  296.     get.addr = buf;
  297.     get.select = 0x14;
  298.     get.x1 = 273;
  299.     get.y1 = 416;
  300.     get.x2 = 579;
  301.     get.y2 = 479;
  302.     EGB_getBlock(GWork,(char *)&get);
  303.     
  304.     EGB_color(GWork,0,9);
  305.     EGB_color(GWork,2,9);
  306.     EGB_paintMode(GWork,0x22);
  307.     
  308.     box.x1 = 273;
  309.     box.y1 = 416+8;
  310.     box.x2 = 579;
  311.     box.y2 = 479-7;
  312.     EGB_rectangle(GWork,(char *)&box);
  313.     
  314.     EGB_color(GWork,0,15);
  315.     EGB_color(GWork,2,15);
  316.     
  317.     box.x1 = 273+4;
  318.     box.y1 = 416+8+4;
  319.     box.x2 = 579-4;
  320.     box.y2 = 479-7-4;
  321.     EGB_rectangle(GWork,(char *)&box);
  322.     
  323.     EGB_color(GWork,0,9);
  324.     
  325.     line.no = 2;
  326.     line.x1 = 273+4;
  327.     line.y1 = 416+8+4+20;
  328.     line.x2 = 579-4;
  329.     line.y2 = 416+8+4+20;
  330.     EGB_unConnect(GWork,(char *)&line);
  331.     
  332.     line.x1 = 273+4+100-1;
  333.     line.y1 = 416+8+4;
  334.     line.x2 = 273+4+100-1;
  335.     line.y2 = 479-7-4;
  336.     EGB_unConnect(GWork,(char *)&line);
  337.     
  338.     line.x1 = 273+4+200-1;
  339.     line.y1 = 416+8+4;
  340.     line.x2 = 273+4+200-1;
  341.     line.y2 = 479-7-4;
  342.     EGB_unConnect(GWork,(char *)&line);
  343.     
  344.     EGB_color(GWork,0,9);
  345.     for (cnt=0;cnt<6;cnt++) {
  346.         string.x = 273+4-1+(cnt/2)*100+2;
  347.         string.y = 416+8+4+(cnt%2)*20+18;
  348.         string.len = 12;
  349.         strcpy((char *)string.str,menumes[cnt]);
  350.         EGB_sjisString(GWork,(char *)&string);
  351.     }
  352.     
  353.     ret = MenuSelect();
  354.     
  355.     EGB_putBlock(GWork,0,(char *)&get);
  356.     free(buf);
  357.     
  358.     return(ret);
  359. }
  360.