home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 October / VPR9710A.ISO / Ffilly / GOMAC006 / 4KOMA.TFY < prev    next >
Text File  |  1997-07-29  |  3KB  |  158 lines

  1. int sClick;
  2. int pic[],basePic;
  3. int zoomPic;
  4. int mainWin,zoomWin;
  5. int picW,picH,picH0;
  6. int sc,zoom;
  7. int koma,title;
  8. str file[];
  9. int bgms;
  10. str bgm;
  11.  
  12. main(){
  13.     int backPic;
  14.     int cast,i;
  15.  
  16.     loadIni();
  17.     sc=1;
  18.     sClick=LoadRsc("101.wav");
  19.     if(WinInfo(1)<768)sc=2;
  20.     loadPic();
  21.     picW=PicWidth(pic[1]);
  22.     picH=PicHeight(pic[1]);
  23.     if(title!=0)makeTitle();
  24.     picH0=PicHeight(pic[0]);
  25.     backPic=CreatePic(pic[0],picW,picH0+picH);
  26.     MoveSPic(pic[0],0,0,picW,picH0,backPic,0,0,picW,picH0);
  27.     basePic=CreatePic(backPic);
  28.     PutCast(backPic,basePic);
  29.     cast=PutCast(pic[1],basePic,0,picH0);
  30.     playBGM();
  31.     mainWin=OpenWin(basePic);
  32.     i=1;
  33.     mes(KEY_DOWN){
  34.         step{
  35.             zoom=1;
  36.             zoomin();
  37.             ,
  38.             zoom=0;
  39.             zoomin();
  40.         }
  41.     }
  42.     mes(RBDBLCLK){
  43.         exit();
  44.     }
  45.     mes(LBDOWN){
  46.         i=i+1;
  47.         if(i==koma+2){
  48.             exit();
  49.             i=i-1;
  50.         }
  51.         if(i==koma+1)lastMes();
  52.         else MoveCast(cast,pic[i],0,picH0);
  53.         PlayRsc(sClick);
  54.     }
  55.     mes(RBDOWN){
  56.         i=i-1;
  57.         if(i==0){
  58.             exit();
  59.             i=i+1;
  60.         }
  61.         else MoveCast(cast,pic[i],0,picH0);
  62.         PlayRsc(sClick);
  63.     }
  64. }
  65.  
  66. int loadPic(){
  67.     int i,pic_;
  68.     int picW_,picH_;
  69.     for(i=title;i<=koma;i=i+1){
  70.         pic_=LoadPic(file[i]);
  71.         picW_=PicWidth(pic_);
  72.         picH_=PicHeight(pic_);
  73.         pic[i]=CreatePic(pic_,picW_/sc,picH_/sc);
  74.         MoveSPic(pic_,0,0,picW_,picH_,pic[i],0,0,picW_/sc,picH_/sc);
  75.         DelPic(pic_);
  76.     }
  77. }
  78.  
  79. int lastMes(){
  80.     SetFont(144/sc,"MS ゴシック",128,0,0,0,700);
  81.     BackMode(1);
  82.     TextColor(0,0,0);
  83.     TextWrite("おしまい",basePic,20/sc+2,500/sc+2);
  84.     TextColor(255,0,0);
  85.     TextWrite("おしまい",basePic,20/sc,500/sc);
  86. }
  87.  
  88. int playBGM(){
  89.     if(bgms==1){
  90.         mes(MIDI_END){
  91.             PlayMIDI(bgm);
  92.         }
  93.         PlayMIDI(bgm);
  94.     }
  95. }
  96.  
  97. int exit(){
  98.     int ans;
  99.     ans=MsgBox("終了しますか?",0x24);
  100.     if(ans==7)return;
  101.     CloseWinAll();
  102.     ExitTitle();
  103.     del_all;
  104.     del_me;
  105. }
  106.  
  107. int playSE(){
  108.     
  109. }
  110.  
  111. int zoomin(){
  112.     if(zoom==1){
  113.         int scz;
  114.         int i,j;
  115.         scz=2;
  116.         zoomPic=CreatePic(basePic,picW+10,(picH0+picH*2)/scz);
  117.         SetPaintColor( 0xffffff );
  118.         SetLineSize(1);
  119.         DrawRect(zoomPic,0,0,picW+10,(picH0+picH*2)/scz);
  120.         MoveSPic(pic[0],0,0,picW,picH0,zoomPic,picW/4+5,0,picW/scz,picH0/scz);
  121.         for(i=0;i<4;i=i+1){
  122.             j=1-i/2;
  123.             MoveSPic(pic[i+1],0,0,picW,picH,zoomPic,j*(picW/2+10),((i%2)*picH+picH0)/scz,picW/scz,picH/scz);
  124.         }
  125.         zoomWin=OpenWin(zoomPic);
  126.         CloseWin(mainWin);
  127.     }
  128.     else if(zoom==0){
  129.         mainWin=OpenWin(basePic);
  130.         CloseWin(zoomWin);
  131.         DelPic(zoomPic);
  132.     }
  133. }
  134.  
  135. int loadIni(){
  136.     int i;
  137.     title=GetIniInt("4koma","title",1,"4koma.ini");
  138.     koma=GetIniInt("4koma","koma",4,"4koma.ini");
  139.     for(i=title;i<=koma;i=i+1){
  140.         file[i]=GetIniStr("4koma",StrPrint("koma%ld",i),"","4koma.ini");
  141.     }
  142.     bgm=GetIniStr("4koma","bgm","NO_BGM","4koma.ini");
  143.     if(IsExist(bgm)==0)bgms=0;
  144.     else bgms=1;
  145. }
  146.  
  147. int makeTitle(){
  148.     pic[0]=CreatePic(pic[1],picW/sc,200/sc);
  149.     SetPaintColor(0xffffff);
  150.     SetLineSize(1);
  151.     DrawRect(pic[0],0,0,picW/sc,200/sc);
  152.     SetFont(100/sc,"MS ゴシック",128,0,0,0,500);
  153.     BackMode(1);
  154.     BgColor(255,255,255);
  155.     TextColor(0,0,255);
  156.     TextWrite("4コママンガ",pic[0],10/sc,50/sc);
  157. }
  158.