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

  1. #include "demo.h"
  2.  
  3.  
  4. #define END_CNT 6
  5. #define ENDMES 8
  6.  
  7. typedef struct {
  8.     int x1;
  9.     int y1;
  10.     int x2;
  11.     int y2;
  12.     int dx1;
  13.     int dy1;
  14.     int dx2;
  15.     int dy2;
  16. } ENDINFO;
  17. /*59,56    155,104*/
  18. ENDINFO EndInfo[END_CNT] = {
  19.     -97,56,215,56,1,0,-1,0,
  20.     -97,212,215,-100,1,-1,-1,1,
  21.     -97,-100,215,212,1,1,-1,-1,
  22.     -97,212,215,-100,1,-1,-1,1,
  23.     -97,56,215,56,1,0,-1,0,
  24.     59,-49,59,161,0,1,0,-1,
  25. };
  26.  
  27. void
  28. EndMessage()
  29. {
  30.     STRING str;
  31.     PALETTE pal;
  32.     int cnt,cnt1,cnt2;
  33.     
  34.     struct {
  35.         int mesno;
  36.         char *mes[10];
  37.     } endmes[9];
  38.     
  39.     endmes[0].mesno = 3;
  40.     endmes[0].mes[0] = "少年は";
  41.     endmes[0].mes[1] = "しだいに意識が";
  42.     endmes[0].mes[2] = "戻りつつありました";
  43.     
  44.     endmes[1].mesno = 3;
  45.     endmes[1].mes[0] = "目の前にはTOWNSのディスプレイ";
  46.     endmes[1].mes[1] = "そしてここはいつもの";
  47.     endmes[1].mes[2] = "見慣れた自分の部屋です";
  48.     
  49.     endmes[2].mesno = 4;
  50.     endmes[2].mes[0] = "まだ完全には戻っていない";
  51.     endmes[2].mes[1] = "かすかな意識の中で";
  52.     endmes[2].mes[2] = "少年は数分前までの出来事を";
  53.     endmes[2].mes[3] = "思い返そうとしていました";
  54.     
  55.     endmes[3].mesno = 2;
  56.     endmes[3].mes[0] = "しかし";
  57.     endmes[3].mes[1] = "少年は思い出す事が出来ませんでした";
  58.     
  59.     endmes[4].mesno = 4;
  60.     endmes[4].mes[0] = "たった一つの言葉を除いて";
  61.     endmes[4].mes[1] = "・";
  62.     endmes[4].mes[2] = "・";
  63.     endmes[4].mes[3] = "・";
  64.     
  65.     endmes[5].mesno = 4;
  66.     endmes[5].mes[0] = "伝説の道具を";
  67.     endmes[5].mes[1] = "数多く残してくれた";
  68.     endmes[5].mes[2] = "勇者がいることだけは";
  69.     endmes[5].mes[3] = "忘れないでほしい";
  70.  
  71.     endmes[6].mesno = 3;
  72.     endmes[6].mes[0] = "その伝説は";
  73.     endmes[6].mes[1] = "今もなお";
  74.     endmes[6].mes[2] = "受け継がれています";
  75.     
  76.     endmes[7].mesno = 3;
  77.     endmes[7].mes[0] = "その伝説の一部が";
  78.     endmes[7].mes[1] = "今";
  79.     endmes[7].mes[2] = "あなたの目の前にあるのです";
  80.     
  81.     
  82.     SPR_display(2,SpriteCnt);
  83.     for (cnt=0;cnt<=SpriteCnt;cnt++) {
  84.         SPR_setAttribute(1024-cnt,1,1,128,256 | 0x8000 | 0x2000);
  85.     }
  86.     SPR_display(1,SpriteCnt);
  87.     
  88.     EGB_color(GWork,1,15);
  89.     EGB_clearScreen(GWork);
  90.     
  91.     EGB_textZoom(GWork,1,32,32);
  92.     
  93.     for (cnt=0;cnt<ENDMES;cnt++) {
  94.         for (cnt1=0;cnt1<endmes[cnt].mesno;cnt1++) {
  95.             EGB_color(GWork,0,cnt1);
  96.             str.len = strlen(endmes[cnt].mes[cnt1]);
  97.             str.x = 320-str.len*8;
  98.             str.y = 240-(endmes[cnt].mesno/2-cnt1)*35;
  99.             strcpy(str.str,endmes[cnt].mes[cnt1]);
  100.             EGB_sjisString(GWork,(char *)&str);
  101.         }
  102.         
  103.         pal.no = endmes[cnt].mesno;
  104.         for(cnt1=0;cnt1<endmes[cnt].mesno*8+8;cnt1++) {
  105.             for (cnt2=0;cnt2<endmes[cnt].mesno;cnt2++) {
  106.                 if ((cnt1 >= cnt2*8) && (cnt1 < cnt2*8+16)) {
  107.                     pal.color[cnt2].seqno = cnt2;
  108.                     pal.color[cnt2].blue = (15-(cnt1-cnt2*8)) << 4;
  109.                     pal.color[cnt2].red = (15-(cnt1-cnt2*8)) << 4;
  110.                     pal.color[cnt2].green = (15-(cnt1-cnt2*8)) << 4;
  111.                     pal.color[cnt2].dummy = 0;
  112.                 }
  113.             }
  114.             EGB_palette(GWork,1,(char *)&pal);
  115.         }
  116.         for(cnt1=0;cnt1<3000000;cnt1++);
  117.         for(cnt1=0;cnt1<endmes[cnt].mesno*8+8;cnt1++) {
  118.             for (cnt2=0;cnt2<endmes[cnt].mesno;cnt2++) {
  119.                 if ((cnt1 >= cnt2*8) && (cnt1 < cnt2*8+16)) {
  120.                     pal.color[cnt2].seqno = cnt2;
  121.                     pal.color[cnt2].blue = (cnt1-cnt2*8) << 4;
  122.                     pal.color[cnt2].red = (cnt1-cnt2*8) << 4;
  123.                     pal.color[cnt2].green = (cnt1-cnt2*8) << 4;
  124.                     pal.color[cnt2].dummy = 0;
  125.                 }
  126.             }
  127.             EGB_palette(GWork,1,(char *)&pal);
  128.         }
  129.         EGB_color(GWork,1,15);
  130.         EGB_clearScreen(GWork);
  131.     
  132.     }
  133. }
  134.  
  135. void
  136. FlashScreen()
  137. {
  138.     PALETTE pal;
  139.     short int orgpal[16][3];
  140.     int cnt,cnt1,joy;
  141.     
  142.     for (cnt=0;cnt<16;cnt++) {
  143.         orgpal[cnt][0] = (PalBuf[16][cnt] & 0xf00) >> 8;
  144.         orgpal[cnt][1] = (PalBuf[16][cnt] & 0x0f0) >> 4;
  145.         orgpal[cnt][2] = (PalBuf[16][cnt] & 0x00f);
  146.     }
  147.     
  148.     pal.no = 16;
  149.     for (cnt=0;cnt<16;cnt++) {
  150.         for (cnt1=0;cnt1<16;cnt1++) {
  151.             orgpal[cnt1][0]++;
  152.             orgpal[cnt1][1]++;
  153.             orgpal[cnt1][2]++;
  154.             if (orgpal[cnt1][0] > 0xf) {
  155.                 orgpal[cnt1][0] = 0xf;
  156.             }
  157.             if (orgpal[cnt1][1] > 0xf) {
  158.                 orgpal[cnt1][1] = 0xf;
  159.             }
  160.             if (orgpal[cnt1][2] > 0xf) {
  161.                 orgpal[cnt1][2] = 0xf;
  162.             }
  163.             pal.color[cnt1].seqno = cnt1;
  164.             pal.color[cnt1].blue = orgpal[cnt1][0] << 4;
  165.             pal.color[cnt1].red = orgpal[cnt1][1] << 4;
  166.             pal.color[cnt1].green = orgpal[cnt1][2] << 4;
  167.             pal.color[cnt1].dummy = 0;
  168.         }
  169.         EGB_palette(GWork,1,(char *)&pal);
  170.     }
  171.     
  172.     EndMessage();
  173.     
  174.     pal.no = 16;
  175.     for (cnt=15;cnt>=0;cnt--) {
  176.         for (cnt1=0;cnt1<16;cnt1++) {
  177.             orgpal[cnt1][0]--;
  178.             orgpal[cnt1][1]--;
  179.             orgpal[cnt1][2]--;
  180.             if (orgpal[cnt1][0] < 0) {
  181.                 orgpal[cnt1][0] = 0;
  182.             }
  183.             if (orgpal[cnt1][1] < 0) {
  184.                 orgpal[cnt1][1] = 0;
  185.             }
  186.             if (orgpal[cnt1][2] < 0) {
  187.                 orgpal[cnt1][2] = 0;
  188.             }
  189.             pal.color[cnt1].seqno = cnt1;
  190.             pal.color[cnt1].blue = orgpal[cnt1][0] << 4;
  191.             pal.color[cnt1].red = orgpal[cnt1][1] << 4;
  192.             pal.color[cnt1].green = orgpal[cnt1][2] << 4;
  193.             pal.color[cnt1].dummy = 0;
  194.         }
  195.         EGB_palette(GWork,1,(char *)&pal);
  196.     }
  197. }
  198.  
  199. void
  200. Ending()
  201. {
  202.     int cnt,cnt1,x1,x2,y1,y2;
  203.     
  204.     
  205.     FlashScreen();
  206.     
  207.     EGB_writePage(GWork,0);
  208.     EGB_clearScreen(GWork);
  209.     
  210.     SPR_display(2,SpriteCnt);
  211.     for (cnt=0;cnt<=SpriteCnt;cnt++) {
  212.         SPR_setAttribute(1024-cnt,1,1,128,256 | 0x8000 | 0x2000);
  213.     }
  214.     SPR_display(1,SpriteCnt);
  215.     
  216.     EGB_writePage(GWork,1);
  217.     EGB_displayStart(GWork,0,0,0);
  218.     EGB_displayStart(GWork,1,0,0);
  219.     EGB_displayStart(GWork,2,3,3);
  220.     EGB_displayStart(GWork,3,256,256);
  221.     
  222.     for (cnt1=0;cnt1<END_CNT;cnt1++) {
  223.         
  224.         for (cnt=0;cnt<500000;cnt++);
  225.         
  226.         SPR_display(2,36);
  227.         
  228.         SPR_setPosition(0,1024-18,6,3,-96,-48);
  229.         SPR_setPosition(0,1024-36,6,3,214,160);
  230.         SPR_setAttribute(1024-18,6,3,PtnInfo[cnt1*2+18].ptn_no,0x8000 | PtnInfo[cnt1*2+18].pal);
  231.         SPR_setAttribute(1024-36,6,3,PtnInfo[cnt1*2+19].ptn_no,0x8000 | PtnInfo[cnt1*2+19].pal);
  232.         
  233.         SPR_display(1,36);
  234.         
  235.         x1 = EndInfo[cnt1].x1;
  236.         x2 = EndInfo[cnt1].x2;
  237.         y1 = EndInfo[cnt1].y1;
  238.         y2 = EndInfo[cnt1].y2;
  239.         
  240.         while ((x1 != x2) || (y1 != y2)) {
  241.             x1 += EndInfo[cnt1].dx1;
  242.             x2 += EndInfo[cnt1].dx2;
  243.             y1 += EndInfo[cnt1].dy1;
  244.             y2 += EndInfo[cnt1].dy2;
  245.             
  246.             SPR_display(2,36);
  247.             
  248.             SPR_setPosition(0,1024-18,6,3,x1,y1);
  249.             SPR_setPosition(0,1024-36,6,3,x2,y2);
  250.             
  251.             SPR_display(1,36);
  252.         }
  253.         for (cnt=0;cnt<2000000;cnt++);
  254.         
  255.         while (((x1 < 214) || (x2 > -80)) && ((y2 > -48) || (y1 < 160))) {
  256.             
  257.             x1 += EndInfo[cnt1].dx1;
  258.             x2 += EndInfo[cnt1].dx2;
  259.             y1 += EndInfo[cnt1].dy1;
  260.             y2 += EndInfo[cnt1].dy2;
  261.             
  262.             SPR_display(2,36);
  263.             SPR_setPosition(0,1024-18,6,3,x1,y1);
  264.             SPR_setPosition(0,1024-36,6,3,x2,y2);
  265.             SPR_display(1,36);
  266.             
  267.         }
  268.     }
  269.     
  270. }
  271.