home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 August / VPR0008A.BIN / READERS / 4koma.tfy < prev    next >
Text File  |  2000-04-30  |  6KB  |  218 lines

  1. #info INAM "わかばちゃん・びゅーわー"
  2. #info IART "POCOPEN,GGB02243@niftyserve.or.jp;poco@yun.co.jp"
  3. #info ICOP "POCOPEN,GGB02243@niftyserve.or.jp;poco@yun.co.jp"
  4.  
  5. int sClick;
  6. int pic[],basePic;
  7. int zoomPic;
  8. int mainWin,zoomWin;
  9. int picW,picH,picH0;
  10. int sc,zoom;
  11. int koma,title;
  12. str file[];
  13. int bgms;
  14. str bgm;
  15. str LF;
  16. str name;
  17.  
  18. main(){
  19.     int backPic;
  20.     int cast,i;
  21.     LF=StrCode(0x0a);
  22.  
  23.     loadIni();
  24.     sc=1;
  25.     sClick=LoadRsc("CLICK.WAV");
  26.     if(WinInfo(1)<768)sc=2;
  27.     loadPic();
  28.     playBGM();
  29.     picW=PicWidth(pic[1]);
  30.     picH=PicHeight(pic[1]);
  31.     if(title!=0)makeTitle();
  32.     picH0=PicHeight(pic[0]);
  33.     backPic=CreatePic(pic[0],picW,picH0+picH);
  34.     MoveSPic(pic[0],0,0,picW,picH0,backPic,0,0,picW,picH0);
  35.     basePic=CreatePic(backPic);
  36.     PutCast(backPic,basePic);
  37.     cast=PutCast(pic[1],basePic,0,picH0);
  38.     putLink();
  39.     CapTitle(name);
  40.     mainWin=OpenWin(basePic);
  41.     showHelp(); 
  42.    i=1;
  43.     mes(KEY_DOWN){
  44.         if(StrCode(MesP2)=="H"){
  45.             showHelp();
  46.         }
  47.         else{
  48.             step{
  49.                 zoom=1;
  50.                 zoomin();
  51.                 ,
  52.                 zoom=0;
  53.                 zoomin();
  54.             }
  55.         }
  56.     }
  57.     mes(RBDBLCLK){
  58.         exit();
  59.     }
  60.     mes(LBDOWN){
  61.         if(zoom==0&&MesP3>picH0){
  62.             i=i+1;
  63.             if(i==koma+2){
  64.                 exit();
  65.                 i=i-1;
  66.             }
  67.             if(i==koma+1)lastMes();
  68.             else MoveCast(cast,pic[i],0,picH0);
  69.             PlayRsc(sClick);
  70.         }
  71.     }
  72.     mes(RBDOWN){
  73.         if(zoom==0&&MesP3>picH0){
  74.             i=i-1;
  75.             if(i==0){
  76.                 exit();
  77.                 i=i+1;
  78.             }
  79.             else MoveCast(cast,pic[i],0,picH0);
  80.             PlayRsc(sClick);
  81.         }
  82.     }
  83. }
  84.  
  85. int loadPic(){
  86.     int i,pic_;
  87.     int picW_,picH_;
  88.     for(i=title;i<=koma;i=i+1){
  89.         pic_=LoadPic(file[i]);
  90.         picW_=PicWidth(pic_);
  91.         picH_=PicHeight(pic_);
  92.         pic[i]=CreatePic(pic_,picW_/sc,picH_/sc);
  93.         MoveSPic(pic_,0,0,picW_,picH_,pic[i],0,0,picW_/sc,picH_/sc);
  94.         DelPic(pic_);
  95.     }
  96. }
  97.  
  98. int lastMes(){
  99.     SetFont(144/sc,"MS ゴシック",128,0,0,0,700);
  100.     BackMode(1);
  101.     TextColor(0,0,0);
  102.     TextWrite("おしまい",basePic,20/sc+2,500/sc+2);
  103.     TextColor(255,0,0);
  104.     TextWrite("おしまい",basePic,20/sc,500/sc);
  105. }
  106.  
  107. int playBGM(){
  108.     if(bgms==1){
  109.         mes(MIDI_END){
  110.             PlayMIDI(bgm);
  111.         }
  112.         PlayMIDI(bgm);
  113.     }
  114. }
  115.  
  116. int exit(){
  117.     int ans;
  118.     ans=MsgBox("終了しますか?",0x24);
  119.     if(ans==7)return;
  120.     CloseWinAll();
  121.     ExitTitle();
  122.     del_all;
  123.     del_me;
  124. }
  125.  
  126. int playSE(){
  127.     
  128. }
  129.  
  130. int zoomin(){
  131.     if(zoom==1){
  132.         int scz;
  133.         int i,j;
  134.         scz=2;
  135.         zoomPic=CreatePic(basePic,picW+10,(picH0+picH*2)/scz);
  136.         SetPaintColor( 0xffffff );
  137.         SetLineSize(1);
  138.         DrawRect(zoomPic,0,0,picW+10,(picH0+picH*2)/scz);
  139.         MoveSPic(pic[0],0,0,picW,picH0,zoomPic,picW/4+5,0,picW/scz,picH0/scz);
  140.         for(i=0;i<4;i=i+1){
  141.             j=1-i/2;
  142.             MoveSPic(pic[i+1],0,0,picW,picH,zoomPic,j*(picW/2+10),((i%2)*picH+picH0)/scz,picW/scz,picH/scz);
  143.         }
  144.         zoomWin=OpenWin(zoomPic);
  145.         CloseWin(mainWin);
  146.     }
  147.     else if(zoom==0){
  148.         mainWin=OpenWin(basePic);
  149.         CloseWin(zoomWin);
  150.         DelPic(zoomPic);
  151.     }
  152. }
  153.  
  154. int loadIni(){
  155.     int i;
  156.     title=GetIniInt("4koma","title",1,"4koma.ini");
  157.     name=GetIniStr("4koma","name","4コマまんが","4koma.ini");
  158.     koma=GetIniInt("4koma","koma",4,"4koma.ini");
  159.     for(i=title;i<=koma;i=i+1){
  160.         file[i]=GetIniStr("4koma",StrPrint("koma%ld",i),"","4koma.ini");
  161.     }
  162.     bgm=GetIniStr("4koma","bgm","NO_BGM","4koma.ini");
  163.     if(IsExist(bgm)==0)bgms=0;
  164.     else bgms=1;
  165. }
  166.  
  167. int makeTitle(){
  168.     pic[0]=CreatePic(pic[1],picW/sc,200/sc);
  169.     SetPaintColor(0xffffff);
  170.     SetLineSize(1);
  171.     DrawRect(pic[0],0,0,picW/sc,200/sc);
  172.     SetFont(100/sc,"MS ゴシック",128,0,0,0,500);
  173.     BackMode(1);
  174.     BgColor(255,255,255);
  175.     TextColor(0,0,255);
  176.     TextWrite("4コママンガ",pic[0],10/sc,50/sc);
  177. }
  178.  
  179. int showHelp(){
  180.     MsgBox("わかばちゃん・びゅーわー"+LF+
  181.            "------------------------------"+LF+
  182.            "・左クリックで次のコマへ進みます。  "+LF+
  183.            "・右クリックで前のコマに戻ります。  "+LF+
  184.            "・最後までいくか右ダブルクリック    "+LF+
  185.            "  すると、終了するかどうかを聴い    "+LF+
  186.            "  てきます。「はい」で終了します。  "+LF+
  187.            "・何かキーを押すと、全部のコマを    "+LF+
  188.            "  一緒に表示します。もう一度押すと  "+LF+
  189.            "  元に戻ります。                    "+LF+
  190.            "・[H]キーでこのヘルプを表示します。 "+LF+
  191.            "------------------------------"+LF+
  192.            "では、お楽しみください(^_^)         ");
  193. }
  194.  
  195. int putLink(){
  196.     int imgPic,linkx,linky;
  197.     str url,img;
  198.     url=GetIniStr("4koma","linkURL","","4koma.ini");
  199.     img=GetIniStr("4koma","linkIMG","","4koma.ini");
  200.     linkx=GetIniInt("4koma","linkx",0,"4koma.ini");
  201.     linky=GetIniInt("4koma","linky",0,"4koma.ini");
  202.     if(url=="")return;
  203.     if(IsExist(img)==0)return;
  204.     imgPic=LoadPic(img);
  205.     MoveSPic(imgPic,0,0,PicWidth(imgPic),PicHeight(imgPic),basePic,linkx/sc,linky/sc,PicWidth(imgPic)/(sc*2),PicHeight(imgPic)/(sc*2));
  206.     SetFont(12/sc,"MS ゴシック",128,0,0,0,1000-sc*300);
  207.     BackMode(1);
  208.     TextColor(0,0,255);
  209.     TextWrite("ホームページは",basePic,linkx/sc+18,(linky-24)/sc);
  210.     TextWrite("   ↓こちら",basePic,linkx/sc+18,(linky-12)/sc);
  211.     mes(LBDOWN){
  212.         if(MesP2>linkx/sc&&MesP2<(linkx+PicWidth(imgPic)/2)/sc&&MesP3>linky/sc&&MesP3<(linky+PicHeight(imgPic)/2)/sc){
  213.             PlayRsc(sClick);
  214.             Shell(url);
  215.         }
  216.     }
  217. }
  218.