예제 #1
0
BOOLEAN			BinkPollFlics(void)
{
	UINT32 uiCount;
	BOOLEAN fFlicStatus=FALSE;
	DDSURFACEDESC SurfaceDescription;
	BINKFLIC *pBink=NULL;
	UINT32	uiCopyToBufferFlags = guiBinkPixelFormat;

	//loop through all the open flics
	for(uiCount=0; uiCount < BINK_NUM_FLICS; uiCount++)
	{
		pBink = &BinkList[uiCount];

		if( pBink->uiFlags & BINK_FLIC_PLAYING )
		{
			fFlicStatus = TRUE;

			//do we still have to wait for the frame to be finished being displayed
			if( !( BinkWait( pBink->BinkHandle ) ) )
			{
				DDLockSurface( pBink->lpDDS, NULL, &SurfaceDescription, 0, NULL);

				BinkDoFrame( pBink->BinkHandle );

				BinkCopyToBuffer( pBink->BinkHandle, 
													SurfaceDescription.lpSurface,
													SurfaceDescription.lPitch,
													pBink->BinkHandle->Height,
													pBink->uiLeft,
													pBink->uiTop,
													uiCopyToBufferFlags );


				DDUnlockSurface( pBink->lpDDS, SurfaceDescription.lpSurface);

				// Check to see if the flic is done the last frame
				if( pBink->BinkHandle->FrameNum == ( pBink->BinkHandle->Frames-1 ) )
				{
					// If flic is looping, reset frame to 0
					if( pBink->uiFlags & BINK_FLIC_LOOP)
					{
						BinkGoto( pBink->BinkHandle, 0, 0 );
					}
					else if( pBink->uiFlags & BINK_FLIC_AUTOCLOSE)
					{
						BinkCloseFlic( pBink );
					}
				}
				else
				{
					BinkNextFrame( BinkList[uiCount].BinkHandle );
				}

			}
		}
	}

	return( fFlicStatus );
}
예제 #2
0
/*-----------------------------------------------------------------------------
    Name        : binkUserPaintCallback
    Description :
    Inputs      : psurf - surface pointer or NULL
                  pitch, x, y - ignored
    Outputs     : frame is blitted onto binkSurface
    Return      :
----------------------------------------------------------------------------*/
static void binkUserPaintCallback(void* psurf, sdword pitch, sdword x, sdword y)
{
    WaitForSingleObject(binkSemaphore, INFINITE);

    binkDisplayFlags = BINKSURFACECOPYALL;

    if (psurf != NULL)
    {
        BinkCopyToBuffer(bnk, psurf, pitch, 480, x, y, BINKSURFACE565 | binkDisplayFlags);
    }
    else
    {
        switch (g_RGLtype)
        {
        case -1:
            if (pitch == 2*640)
            {
                BinkCopyToBuffer(bnk, binkSurface, pitch, 480, 0, 0,
                                 ((g_surfType == S_RGB565) ? BINKSURFACE565 : BINKSURFACE555) | binkDisplayFlags);
            }
            else
            {
                BinkCopyToBuffer(bnk, binkSurface, pitch, 480, 0, 0, BINKSURFACE32 | binkDisplayFlags);
            }
            break;
        case SWtype:
            BinkCopyToBuffer(bnk, binkSurface, 2*640, 480, 0, 0,
                             ((g_surfType == S_RGB565) ? BINKSURFACE565 : BINKSURFACE555) | binkDisplayFlags);
            break;
        case GLtype:
        case D3Dtype:
            BinkCopyToBuffer(bnk, binkSurface, 4*640, 480, 0, 0, BINKSURFACE32 | binkDisplayFlags);
            break;
        default:
            dbgFatalf(DBG_Loc, "what's this type: %d [binkUserPaintCallback]", g_RGLtype);
        }
    }

    ReleaseSemaphore(binkSemaphore, 1, NULL);
}
예제 #3
0
		void ITextureVideo::UpdateImage()
		{
		#if USE_BINK
			if (Bink /*&& !BinkWait( Bink )*/)
			{
				BinkDoFrame( Bink );

				BinkCopyToBuffer( Bink,
								  m_pBuffer.GetData(),
								  m_pBuffer.GetFormat()*m_pBuffer.GetWidth(),
								  Bink->Height,
								  0,0,
								  BINKSURFACE24R );

				if (m_pTextureManager)
					m_pTextureManager->SetTextureData(this,m_pBuffer);
				//printf("Process bink\n");
				BinkNextFrame( Bink );
			}
		#endif
		}
예제 #4
0
파일: exammss.c 프로젝트: BattleNWar/YDWE
static void Show_next_frame( HBINK bink,
                             HBINKBUFFER bink_buffer,
                             HWND window )
{
  //
  // Decompress the Bink frame.
  //

  BinkDoFrame( bink );

  //
  // Lock the BinkBuffer so that we can copy the decompressed frame into it.
  //

  if ( BinkBufferLock( bink_buffer ) )
  {
    //
    // Copy the decompressed frame into the BinkBuffer (this might be on-screen).
    //

    BinkCopyToBuffer( bink,
                      bink_buffer->Buffer,
                      bink_buffer->BufferPitch,
                      bink_buffer->Height,
                      0,0,
                      bink_buffer->SurfaceType);

    //
    // Unlock the BinkBuffer.
    //

    BinkBufferUnlock( bink_buffer );
  }

  //
  // Tell the BinkBuffer to blit the pixels onto the screen (if the
  //   BinkBuffer is using an off-screen blitting style).
  //

  BinkBufferBlit( bink_buffer,
                  bink->FrameRects,
                  BinkGetRects( bink, bink_buffer->SurfaceType ) );

  //
  // Are we at the end of the movie?
  //

  if ( bink->FrameNum == bink->Frames )
  {
    //
    // Yup, close the window.
    //

    DestroyWindow( window );
  }
  else
  {
    //
    // Nope, advance to the next frame.
    //

    BinkNextFrame( bink );
  }
}
예제 #5
0
void BinkRedraw2(void)
{
	if(!iPlaying) return;
	if(iBinkStop && iBinkLoop)
	{
		iBinkLoop = 0;
		iPlaying = 0;
		iBinkStop = 0;
		return;
	}

	if(g_flTime - fStartTime > ( float(hBink->FrameRateDiv)/ float(hBink->FrameRate))) 
	{ 
		if(iBinkIsScope)
		{
			if(!g_BinkScopeColor)
			{
				goto SKIP_FRAME;
			}
		}
		iFrame ++;
SKIP_FRAME:
		fStartTime = g_flTime;
		if(iFrame> hBink->Frames)
		{
			if(!iBinkLoop)
			{
				iPlaying = 0;
				BinkClose(hBink);
				return;
			}
			else
			{
				iFrame = 1;
			}
		}
		BinkGoto(hBink, iFrame, 0);
		BinkCopyToBuffer(hBink, pBinkMem, hBink->Width * 4, hBink->Height, 0, 0, BINKSURFACE32RA);
		Tri_BindTexture(GL_TEXTURE_2D, iBinkTextureID);
		Tri_SetTextureParam();		
		Tri_TexImage2D(GL_TEXTURE_2D, 0, 4, hBink->Width, hBink->Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pBinkMem);
	}
	int iX ,iY,iWidth,iHeight;
	iWidth = hBink->Width;
	iHeight = hBink->Height;

	if(Bink_iCenter)
	{
		iX = Bink_iX - iWidth/2;
		iY = Bink_iY - iHeight/2;
	}
	else
	{
		iX = Bink_iX ;
		iY = Bink_iY ;
	}
	float LENGTH_SCOPE = g_sScreenInfo.iWidth / 3.3;
	if(iBinkIsScope && fCurrentFOV<=40.0)
	{
		if(!g_BinkScopeColor)
		{
			BinkColor[0] = 171;
			BinkColor[1] = 89 ;
			BinkColor[2] = 78;
			// LOCKED!
	#define LENGTH_SCOPE_TARGET	120
#define	LENGTH_SCOPE_BORDER	75

			Tri_Enable(GL_TEXTURE_2D);
			Tri_Enable(GL_BLEND);
			Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 			

			Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_tga_Scope_Target].texid);
			if(g_iVideoMode)
			{
				glColor4ub(255,255,255,255);
			}
			else gEngfuncs.pTriAPI->Color4ub(255,255,255,255);

			gEngfuncs.pTriAPI->Begin(TRI_QUADS);
			gEngfuncs.pTriAPI->TexCoord2f(0,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_BORDER, 0);

			gEngfuncs.pTriAPI->TexCoord2f(1,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_BORDER,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(1,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_TARGET,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(0,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_TARGET,0);
			gEngfuncs.pTriAPI->End();
				// 2
			gEngfuncs.pTriAPI->Begin(TRI_QUADS);
			gEngfuncs.pTriAPI->TexCoord2f(0,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_BORDER, 0);

			gEngfuncs.pTriAPI->TexCoord2f(1,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2  - LENGTH_SCOPE_BORDER,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(1,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_TARGET,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(0,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE_TARGET,0);
			gEngfuncs.pTriAPI->End();
				// 3
			gEngfuncs.pTriAPI->Begin(TRI_QUADS);
			gEngfuncs.pTriAPI->TexCoord2f(0,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE_BORDER , 0);

			gEngfuncs.pTriAPI->TexCoord2f(1,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE_BORDER,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(1,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE_TARGET,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(0,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE_TARGET,0);
			gEngfuncs.pTriAPI->End();
				// 4
			gEngfuncs.pTriAPI->Begin(TRI_QUADS);
			gEngfuncs.pTriAPI->TexCoord2f(0,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2+LENGTH_SCOPE_TARGET, 0);

			gEngfuncs.pTriAPI->TexCoord2f(1,1);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_BORDER,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE_BORDER,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(1,0); 
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2+LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2+ LENGTH_SCOPE_BORDER,0);
				
			gEngfuncs.pTriAPI->TexCoord2f(0,0);
			gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE_TARGET,g_sScreenInfo.iHeight/2+LENGTH_SCOPE_TARGET,0);
			gEngfuncs.pTriAPI->End();
		}
		else
		{
			BinkColor[0] = 84;
			BinkColor[1] = 135;
			BinkColor[2] = 130;

		}
		// Draw SCOPR
		// 1024 -- 240
		// 800  -- 187.5
		
//#define LENGTH_SCOPE	240

		Tri_Enable(GL_TEXTURE_2D);
		Tri_Enable(GL_BLEND);
		Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
		

		Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_tga_Scope].texid);
		if(g_iVideoMode)
		{
			glColor4ub(255,255,255,255);
		}
		else gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
		
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->TexCoord2f(0,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE,g_sScreenInfo.iHeight/2, 0);

		gEngfuncs.pTriAPI->TexCoord2f(1,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(1,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(0,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->End();
			// 2
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->TexCoord2f(0,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE,g_sScreenInfo.iHeight/2, 0);

		gEngfuncs.pTriAPI->TexCoord2f(1,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(1,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(0,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->End();
			// 3
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->TexCoord2f(0,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE,g_sScreenInfo.iHeight/2, 0);

		gEngfuncs.pTriAPI->TexCoord2f(1,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(1,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(0,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE,g_sScreenInfo.iHeight/2 + LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->End();
			// 4
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->TexCoord2f(0,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2+LENGTH_SCOPE, 0);

		gEngfuncs.pTriAPI->TexCoord2f(1,1);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2,g_sScreenInfo.iHeight/2,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(1,0); 
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2+LENGTH_SCOPE,g_sScreenInfo.iHeight/2,0);
			
		gEngfuncs.pTriAPI->TexCoord2f(0,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE,g_sScreenInfo.iHeight/2+LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->End();

	}

	Tri_Enable(GL_TEXTURE_2D);
	Tri_Enable(GL_BLEND);
	Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	Tri_BindTexture(GL_TEXTURE_2D, iBinkTextureID);
	gEngfuncs.pTriAPI->Begin(TRI_QUADS);
	gEngfuncs.pTriAPI->Color4ub(BinkColor[0],BinkColor[1],BinkColor[2],255);
	gEngfuncs.pTriAPI->TexCoord2f(0,1);
	gEngfuncs.pTriAPI->Vertex3f(iX,iY+iHeight,0);
	gEngfuncs.pTriAPI->TexCoord2f(1,1);
	gEngfuncs.pTriAPI->Vertex3f(iX+iWidth,iY+iHeight,0);
	gEngfuncs.pTriAPI->TexCoord2f(1,0);
	gEngfuncs.pTriAPI->Vertex3f(iX+iWidth,iY,0);
	gEngfuncs.pTriAPI->TexCoord2f(0,0);
	gEngfuncs.pTriAPI->Vertex3f(iX,iY,0);
	gEngfuncs.pTriAPI->End();

	// Black Side
	if(iBinkIsScope && 0.0 < fCurrentFOV && fCurrentFOV<=40.0)
	{
		
		/*if(g_iVideoMode)
		{
			glColor4ub(0,0,0,255);
		}
		else gEngfuncs.pTriAPI->Color4ub(0,0,0,255);
		Tri_Disable(GL_TEXTURE_2D);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->Vertex3f(0,0,0);
		gEngfuncs.pTriAPI->Vertex3f(0,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth,g_sScreenInfo.iHeight/2 - LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth,0,0);
		gEngfuncs.pTriAPI->End();

		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->Vertex3f(0,0,0);
		gEngfuncs.pTriAPI->Vertex3f(0,g_sScreenInfo.iHeight,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE,g_sScreenInfo.iHeight,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 - LENGTH_SCOPE,0,0);
		gEngfuncs.pTriAPI->End();

		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE,0,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth/2 + LENGTH_SCOPE,g_sScreenInfo.iHeight,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth,g_sScreenInfo.iHeight,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth,0,0);
		gEngfuncs.pTriAPI->End();

		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		gEngfuncs.pTriAPI->Vertex3f(0,g_sScreenInfo.iHeight/2+LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->Vertex3f(0,g_sScreenInfo.iHeight,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth,g_sScreenInfo.iHeight,0);
		gEngfuncs.pTriAPI->Vertex3f(g_sScreenInfo.iWidth,g_sScreenInfo.iHeight/2+LENGTH_SCOPE,0);
		gEngfuncs.pTriAPI->End();*/
	}
}