Пример #1
0
void
SMK_playFlic(char *path)
{
#if 0
     int  frames=0,i;

     if (access(path,F_OK) != 0) {
          return;
     }
     if (!noSoundFlag) {
          smk=SmackOpen(path,SMACKTRACKS,SMACKAUTOEXTRA);
     }
     else {
          smk=SmackOpen(path,0,SMACKAUTOEXTRA);
     }
     if (smk) {
          GFX_fadeOut(255);        // make sure game palette is faded
          walock[SMACKTILE]=200;
          allocache(&waloff[SMACKTILE],320L*200L,&walock[SMACKTILE]);
          tilesizx[SMACKTILE]=200;
          tilesizy[SMACKTILE]=320;
          SmackToBuffer(smk,0L,0L,320L,200L,(void *)waloff[SMACKTILE],0);
          keystatus[1]=0;
          keystatus[28]=0;
          keystatus[57]=0;
          while (1) {
               if (smk->NewPalette) {
                    SMK_loadPalette(smk->Palette);
               }
               SmackDoFrame(smk);
               SmackNextFrame(smk);
               rotatesprite(320L<<15,200L<<15,65536L,512,SMACKTILE,0,0,2+4+64,
                            0L,0L,xdim-1L,ydim-1L);
               nextpage();
               SMK_setPalette();
               while (SmackWait(smk)) {
                    if (keystatus[1] || keystatus[57] || keystatus[28]) {
                         goto done;
                    }
               }
               if (keystatus[1] || keystatus[57] || keystatus[28]) {
                    goto done;
               }
               frames++;
               if (frames == smk->Frames) {
                    goto done;
               }
          }
done:
          walock[SMACKTILE]=1;
          SmackClose(smk);
          for (i = 0 ; i < MAXRADBUFFS ; i++) {
               radbuf[i].cache_lock=1;
          }
     }
#endif
}
Пример #2
0
//------------------------------------------------------------------------------
void SmackerCtrl::update(GFXSurface *sfc)
{
   if (smk && !finished)
   {
      // smoothly adjust volume up and down, just a nice simple touch
//      if (GWMain::foreground)
//         volume = volume*0.9f + 0.1f;
//      else
//         volume = volume*0.6f;
      SmackVolumePan(smk, SMACKTRACKS, 32768*volume, 32768);

      // HANDLE Palette changes
      if (smk->NewPalette)
      {  //do palette stuff
         Resource<GFXPalette> pal = SimGame::get()->getWorld()->getPalette();
         if ((bool)pal)
         {
            char *src = (char*)&smk->Palette[0];
            PALETTEENTRY *dst = &pal->palette[0].color[palStart];
            for (int i = 0; i < palColors; i++, dst++)
            {  
               dst->peRed  = *src++;
               dst->peGreen= *src++;
               dst->peBlue = *src++;
            }
            cBmp.flush(sfc, true);
            SimGame::get()->getWorld()->setPalette(pal, -1);
         }
      }

      // HANDLE frame changes
      if (!SmackWait(smk) && !paused)
      {  // SmackWait returns 0 if it's time to advance a frame
         SmackDoFrame(smk);
         cBmp.set(bmp);
         cBmp.flush(sfc, true);
         
         //loop stuff
         // check for a non-looping movie where the smacker is at the last frame
         // or for a smacker built without a ring frame and on the second-to-last frame
         if (!loop && ((smk->FrameNum == smk->Frames) || ((!smk->SmackerType & 0x1) && (smk->FrameNum == smk->Frames - 1))))
         {
            finished = true;
            
            // call up to Delegate here
            SimMessageEvent::post(this, movieDoneTag);
            return;
         }
         SmackNextFrame(smk);
      }
   }
}