home *** CD-ROM | disk | FTP | other *** search
/ Phoenix Heaven Sunny 2 / APPARE2.BIN / oh_towns / install / dispoht.c < prev    next >
C/C++ Source or Header  |  1995-06-20  |  3KB  |  130 lines

  1. /*************************************************************************
  2. *
  3. *    オープニングCG表示
  4. *                                                    cording ... TaroPYON
  5. *
  6. *************************************************************************/
  7.  
  8. #include    "ccilib.h"
  9. #include    "kbcode.h"
  10. #include    "install.h"
  11.  
  12. #define    SCREEN_MODE        (0x0C)
  13.  
  14. int        init();
  15. int        term();
  16.  
  17. int        main(int argc, char **argv)
  18. {
  19.     int        x, y;
  20.  
  21.     init();
  22.     tif_load("/OH_TOWNS/ohtowns.tif");
  23.     _apl_wait(CLOCKS_PER_SEC * 5);
  24.     while ( PD_getp(&x,&y) )
  25.         ;
  26.     term();
  27.  
  28.     return (0);
  29. }
  30.  
  31. int    init()
  32. {
  33.     APL_init(SCREEN_MODE,1,1);
  34.     SCN_wrtPage(0);
  35.     return (NORMAL);
  36. }
  37.  
  38. int    term()
  39. {
  40.     APL_term();
  41. }
  42.  
  43. /*************************************************************************
  44. *    TIFF表示
  45. *************************************************************************/
  46.  
  47. int        tif_load( char *fn )
  48. {
  49.     int                i, x, y, ret, pixel, md, x0, y0;
  50.     char           *img;
  51.     short            fr[4];
  52.  
  53.     SCN_wrtPage(0);
  54.     SCN_boxf(0,0,639,479,PSET,0);
  55.  
  56.     if ( (img = IMG_open()) != NULL )
  57.     {
  58.         IMG_setAtt(img,IMG_ATT_PLTON);    /* パレット設定属性ON    */
  59.         if ( IMG_load(img,fn) == NORMAL )
  60.         {
  61.             IMG_getFr(img,fr);
  62.             pixel = IMG_getPixel(img);
  63.             switch ( pixel )
  64.             {
  65.                 case  1:    /* モノクロ    */
  66.                 case  4:    /* 16色        */
  67.                     x0 = (640 - (fr[2] - fr[0] + 1)) / 2;
  68.                     y0 = (480 - (fr[3] - fr[1] + 1)) / 2;
  69.                     md = 3;
  70.                     break;
  71.                 case  8:    /* 256 色    */
  72.                     x0 = (640 - (fr[2] - fr[0] + 1)) / 2;
  73.                     y0 = (480 - (fr[3] - fr[1] + 1)) / 2;
  74.                     md = 12;
  75.                     break;
  76.                 case 16:    /* 32768 色    */
  77.                     if ( fr[2] - fr[0] + 1 <= 320 )
  78.                     {
  79.                         x0 = (320 - (fr[2] - fr[0] + 1)) / 2;
  80.                         y0 = (240 - (fr[3] - fr[1] + 1)) / 2;
  81.                         md = 10;
  82.                     } else
  83.                     {
  84.                         x0 = (512 - (fr[2] - fr[0] + 1)) / 2;
  85.                         y0 = (480 - (fr[3] - fr[1] + 1)) / 2;
  86.                         md = 17;
  87.                     }
  88.                     break;
  89.                 default:
  90.                     goto _TIF_ERR;
  91.             }
  92.             IMG_setPos(img,x0,y0);    /* 表示位置補正            */
  93.             MOS_COFF();                /* マウスカーソル消去    */
  94.  
  95.             EGB_displayPage(EgbPtr,0,0);
  96.             EGB_writePage(EgbPtr,0);
  97.             EGB_clearScreen(EgbPtr);
  98.             EGB_resolution(EgbPtr,0,md);    /* 画面モード設定    */
  99.             if ( md == 3 || md == 10 )
  100.             {
  101.                 EGB_resolution(EgbPtr,1,3);    /* 画面モード設定    */
  102.                 EGB_writePage(EgbPtr,1);
  103.                 EGB_clearScreen(EgbPtr);
  104.             }
  105.  
  106.             EGB_writePage(EgbPtr,0);
  107.             if ( md == 10 )
  108.             {
  109.                 EGB_displayStart(EgbPtr,2,2,2);
  110.                 EGB_displayStart(EgbPtr,3,320,240);
  111.             }
  112.             EGB_color(EgbPtr,1,0);
  113.             EGB_clearScreen(EgbPtr);
  114.             IMG_dsp(img);
  115.             if ( md == 3 || md == 10 )
  116.                 EGB_displayPage(EgbPtr,1,3);
  117.             else
  118.                 EGB_displayPage(EgbPtr,0,1);
  119.         }
  120.         IMG_close(img);
  121.     }
  122.  
  123. #if    0
  124.     EGB_writePage(EgbPtr,0);
  125.     EGB_clearScreen(EgbPtr);
  126. #endif
  127.  
  128.     return (NORMAL);
  129. }
  130.