예제 #1
0
static BOOL Video_OnCreate(HWND hWindow, LPCREATESTRUCT lpCreateStruct)
/***********************************************************************/
{
	BOOL fRemap;
	LPVIDEO lpVideo;

	if ( !(lpVideo = (LPVIDEO)AllocX( sizeof(VIDEO), GMEM_ZEROINIT|GMEM_SHARE )) )
		return( FALSE );

	SetWindowLong( hWindow, GWL_DATAPTR, (long)lpVideo );

	ITEMID id;
	if ( !(id = GetWindowWord( hWindow, GWW_ICONID )) )
		id = GET_WINDOW_ID( hWindow );
	lpVideo->lpAllShots = Video_GetShotData( id, &lpVideo->iNumShots, &fRemap );
	lpVideo->lCurrentShot = lpVideo->lPrevShot = (lDefaultShot ? lDefaultShot : 1 );
	lDefaultShot = 0;
	lpVideo->lPrevFrame = 0;

	// Remap the shot table to make all entries sequential
	if (fRemap)
		Video_RemapShotTable( hWindow );
	Video_CheckDumpShotTable(id, lpVideo->lpAllShots, lpVideo->iNumShots);

	LPSHOT lpShot = Video_GetShotPtr( lpVideo, lpVideo->lCurrentShot );
	return( Video_Open( hWindow, lpVideo, (lpShot ? lpShot->wDisk : 1), (lpShot ? lpShot->lStartFrame : 0) ) );
}
예제 #2
0
//************************************************************************
BOOL CDib::LoadFromFile(LPCSTR lpFileName, BOOL fDecodeRLE)
//************************************************************************
{
	FNAME szExpFileName;
	if ( !FindContent( (LPSTR)lpFileName, szExpFileName ) )
		return(FALSE);

	HFILE fh;
	OFSTRUCT of;
	if ( (fh = OpenFile(szExpFileName, &of, OF_READ)) < 0 )
		return(FALSE);
			
	if ( !(ReadBitmapInfo(fh)) )
		return FALSE;

	// Can we get enough memory to hold the DIB bits
	DWORD dwBits;
	if ( !(m_lp = AllocX( dwBits = GetSizeImage(), GMEM_ZEROINIT )) )
		{
		_lclose(fh);
		return( FALSE );
		}

	// read in the bits
	_hread( fh, m_lp, dwBits );
	_lclose( fh );

	return(CheckDecodeRLE(fDecodeRLE));
}
예제 #3
0
//************************************************************************
BOOL CDib::LoadFromResource(HINSTANCE hInstance, LPCSTR szResource, BOOL fDecodeRLE)
//************************************************************************
{
	HRSRC hDibRes;
	HGLOBAL hDib;
	LPTR lpDib;
	LPBITMAPINFO lpbmInfo; 
	DWORD dwBits;

	if ( !(hDibRes = FindResource(hInstance, szResource, RT_BITMAP)) )
		return(FALSE);
	if (! (hDib = LoadResource(hInstance, hDibRes)) )
		return(FALSE);
	lpDib = (LPTR)LockResource(hDib);
	if (!lpDib)
		return(FALSE);
	lpbmInfo = (LPBITMAPINFO)lpDib;
	m_bmiHeader = lpbmInfo->bmiHeader;
	FixHeader();
	hmemcpy(m_rgbQuad, lpbmInfo->bmiColors, GetNumColors() * sizeof(RGBQUAD));
	lpDib += m_bmiHeader.biSize + (GetNumColors() * sizeof(RGBQUAD));

	// Can we get enough memory to hold the DIB bits
	if ( (m_lp = AllocX( dwBits = GetSizeImage(), GMEM_ZEROINIT )) != NULL )
		hmemcpy(m_lp, lpDib, dwBits);
	UnlockResource(hDib);
	FreeResource(hDib);

	return(CheckDecodeRLE(fDecodeRLE));
}
예제 #4
0
//************************************************************************
PDIB CDib::GetDib(BOOL fDecodeRLE)
//************************************************************************
{
	if ((GetCompression() == BI_RLE8) && fDecodeRLE)
	{	
		DWORD dwSize = (long)GetWidthBytes() * (long)abs(GetHeight());
		LPTR lp = AllocX(dwSize, GMEM_ZEROINIT );
		if (!lp)
			return(NULL);
		PDIB pDib = new CDib(this, lp, FALSE);
		if (!pDib)
		{
			FreeUp(lp);
			return(NULL);
		}
		DecodeRLE(lp);
		pDib->SetCompression(BI_RGB);
		pDib->SetSizeImage(dwSize);
		return(pDib);
	}
	else
	{
		AddRef();
		return(this);
	}
}
예제 #5
0
static BOOL Slider_OnCreate (HWND hWindow, LPCREATESTRUCT lpCreateStruct)
/***********************************************************************/
{
	LPHSLIDERINFO lpInfo;
	if ( (lpInfo = (LPHSLIDERINFO)AllocX( sizeof(HSLIDERINFO), GMEM_ZEROINIT|GMEM_SHARE )) )
	{
		Slider_Init (lpInfo) ;
		SetWindowLong( hWindow, GWL_DATAPTR, (long)lpInfo );
	}
	else
		return FALSE;

	return TRUE;
}
예제 #6
0
static BOOL Bmulti_OnCreate (HWND hWindow, LPCREATESTRUCT lpCreateStruct)
/***********************************************************************/
{
	LPBMULTICONTINFO lpInfo;
	if (! (lpInfo = (LPBMULTICONTINFO)AllocX (sizeof(BMULTICONTINFO), GMEM_ZEROINIT|GMEM_SHARE)) )
		return FALSE;

	lpInfo->State = 0;
	lpInfo->NumDIBs = 8;
	lpInfo->Incr = 5;
	lpInfo->bTrack = FALSE;
	lpInfo->bInRect = FALSE;
	SetWindowLong (hWindow, GWL_DATAPTR, (long)lpInfo);
	return TRUE;
}
예제 #7
0
static BOOL Meter_OnCreate(HWND hWindow, LPCREATESTRUCT lpCreateStruct)
/***********************************************************************/
{
    LPMETERCONTINFO lpInfo;
    if ( (lpInfo = (LPMETERCONTINFO)AllocX(sizeof(METERCONTINFO), GMEM_ZEROINIT|GMEM_SHARE) ))
    {
        Meter_Init(lpInfo);
        Meter_UpdateText(hWindow, lpInfo);
        SetWindowLong(hWindow, GWL_DATAPTR, (long)lpInfo);
    }
    else
        return FALSE;

    return TRUE;
}
예제 #8
0
//************************************************************************
BOOL CDib::Create( PDIB pdib )
//************************************************************************
{
	DWORD dwSizeImage;

	dwSizeImage = pdib->GetSizeImage();
	if ( !(m_lp = AllocX( dwSizeImage + 1024, GMEM_ZEROINIT )) )
	{
		return FALSE;
	}
	
	m_bmiHeader = *pdib->GetInfoHeader();
	hmemcpy( m_rgbQuad, pdib->GetColors(), sizeof(m_rgbQuad));
	hmemcpy(m_lp, pdib->GetPtr(), pdib->GetSizeImage());
	
	return TRUE;
}
예제 #9
0
//************************************************************************
PDIB CDib::DibCopy(BOOL fCopyBits)
//************************************************************************
{
	PDIB pdibCopy;
	LPTR lp;

	if ( !(lp = AllocX( GetSizeImage(), GMEM_ZEROINIT )) )
	{
		return( NULL );
	}
	if ( !(pdibCopy = new CDib(this, lp, fCopyBits)) )
	{
		FreeUp(lp);
		return( NULL );
	}

	return pdibCopy;
}
예제 #10
0
// This basically allocates our "instance info" (that struct defined above)
//***************************************************************************
static long AVIDrawOpen(ICOPEN FAR * icopen)
//***************************************************************************
{
	PINSTINFO pinst;

	if (!icopen)
	   return 1;
	if (icopen->fccType != streamtypeVIDEO)
		return NULL;
	if (icopen->dwFlags == ICMODE_COMPRESS || icopen->dwFlags == ICMODE_DECOMPRESS)
		return NULL;
	if ( !(pinst = (PINSTINFO)AllocX(sizeof(INSTINFO), GMEM_ZEROINIT)) )
	{
		icopen->dwError = ICERR_MEMORY;
		return NULL;
	}
	pinst->hdd = DrawDibOpen();
	icopen->dwError = ICERR_OK;
	return (LONG) pinst;
}
예제 #11
0
//************************************************************************
BOOL CDib::Create( int bits, int dx, int dy )
//************************************************************************
{
	DWORD dwSizeImage;
	int i;
	LPDWORD pdw;

	dwSizeImage = dy * (DWORD)((dx * bits/8+3)&~3);
	if ( !(m_lp = AllocX( dwSizeImage + 1024, GMEM_ZEROINIT )) )
		{
		return FALSE;
		}

#ifdef UNUSED // We can't use this because of a problem noted in DibToDCBlt()
	//	Get WinG to recommend the fastest DIB format
	//	Orientation = ( m_bmiHeader.biHeight < 0 ? -1 : 1 ); 
	if ( WinGRecommendDIBFormat( (LPBITMAPINFO)&m_bmiHeader ) )
		{ // make sure it's 8bpp
		m_bmiHeader.biWidth			*= dx;
		m_bmiHeader.biHeight		*= dy;
		m_bmiHeader.biBitCount		= bits;
		m_bmiHeader.biCompression	= BI_RGB;
		}
	else
#endif
		{ // set it up ourselves
		m_bmiHeader.biSize			= sizeof(BITMAPINFOHEADER);
		m_bmiHeader.biPlanes		= 1;
		m_bmiHeader.biSizeImage		= dwSizeImage;
		m_bmiHeader.biXPelsPerMeter = 0 ;
		m_bmiHeader.biYPelsPerMeter = 0 ;
		m_bmiHeader.biClrUsed		= 0 ;
		m_bmiHeader.biClrImportant	= 0 ;
		m_bmiHeader.biWidth			= dx;
		m_bmiHeader.biHeight		= dy;
		m_bmiHeader.biBitCount		= bits;
		m_bmiHeader.biCompression	= BI_RGB;
		}

	if (bits == 4)
		m_bmiHeader.biClrUsed = 16;
	else
	if (bits == 8)
		m_bmiHeader.biClrUsed = 256;

	pdw = (LPDWORD)m_rgbQuad;
	for (i=0; i<(int)m_bmiHeader.biClrUsed/16; i++)
		{
		*pdw++ = 0x00000000;	// 0000	 black
		*pdw++ = 0x00800000;	// 0001	 dark red
		*pdw++ = 0x00008000;	// 0010	 dark green
		*pdw++ = 0x00808000;	// 0011	 mustard
		*pdw++ = 0x00000080;	// 0100	 dark blue
		*pdw++ = 0x00800080;	// 0101	 purple
		*pdw++ = 0x00008080;	// 0110	 dark turquoise
		*pdw++ = 0x00C0C0C0;	// 1000	 gray
		*pdw++ = 0x00808080;	// 0111	 dark gray
		*pdw++ = 0x00FF0000;	// 1001	 red
		*pdw++ = 0x0000FF00;	// 1010	 green
		*pdw++ = 0x00FFFF00;	// 1011	 yellow
		*pdw++ = 0x000000FF;	// 1100	 blue
		*pdw++ = 0x00FF00FF;	// 1101	 pink (magenta)
		*pdw++ = 0x0000FFFF;	// 1110	 cyan
		*pdw++ = 0x00FFFFFF;	// 1111	 white
		}

	FixHeader();
	return TRUE;
}
예제 #12
0
CStory::CStory(HWND hWindow)
/***********************************************************************/
{
	STRING szString, szFile; 
	FNAME szFileName;
	HRSRC hResource;
	HGLOBAL hData;
	LPSHORT lpShortData;
	DWORD dwSize;
	int id;

	m_hWnd = hWindow;
	m_nRects = 0;
	m_hMCIfile = NULL;
	m_iHighlight = 0;
	m_pDib = NULL;
	m_lpWordData = NULL;
	m_fPlaying = FALSE;
	m_szStoryFile[0] = '\0';
	m_szDibFile[0] = '\0';
	m_hHotSpotCursor = LoadCursor(GetWindowInstance(hWindow), MAKEINTRESOURCE(ID_POINTER));
	m_fCursorEnabled = TRUE;
	m_fMappedToPalette = FALSE;

	GetModuleFileName(GetWindowInstance(hWindow), szFileName, sizeof(szFileName));
	StripFile(szFileName);

	GetWindowText(hWindow, szString, sizeof(szString));
	for (int i = 0; i < 2; ++i)
	{
		if (GetStringParm(szString, i, ',', szFile))
		{
			if (lstrcmpi(Extension(szFile), ".wav") == 0)
			{
				lstrcpy(m_szStoryFile, szFileName);
				lstrcat(m_szStoryFile, szFile);
			}
			else
			{
				lstrcpy(m_szDibFile, szFileName);
				lstrcat(m_szDibFile, szFile);
			}
		}
		else
			break;
	}

	id = GetDlgCtrlID(hWindow)-IDC_STORY;	
	if (id)
		wsprintf(szString, "story%d", id+1);
	else
		lstrcpy(szString, "story");
		
	id = App.GetSceneNo(GetParent(hWindow));
	if ( !(hResource = FindResource( App.GetInstance(), MAKEINTRESOURCE(id), szString )) )
		return;
	if ( !(dwSize = SizeofResource( App.GetInstance(), hResource )) )
		return;
	if ( !(hData = LoadResource( App.GetInstance(), hResource )) )
		return;
	if ( !(lpShortData = (LPSHORT)LockResource( hData )) )
		{
		FreeResource( hData );
		return;
		}
	m_nRects = (int)(dwSize / (sizeof(WORD) * 6));
	if (m_nRects)
	{
		m_lpWordData = (LPWORD_DATA)AllocX( (m_nRects * sizeof(WORD_DATA)), GMEM_ZEROINIT|GMEM_SHARE );
		if (!m_lpWordData)
			return;
		for (int i = 0; i < m_nRects; ++i)
		{
			m_lpWordData[i].dwFrom = (int)*lpShortData++;
			m_lpWordData[i].dwTo = (int)*lpShortData++;
			m_lpWordData[i].rArea.left = (int)*lpShortData++;
			m_lpWordData[i].rArea.top = (int)*lpShortData++;
			m_lpWordData[i].rArea.right = (int)*lpShortData++;
			m_lpWordData[i].rArea.bottom = (int)*lpShortData++;
		}
	}
	UnlockResource( hData );
	FreeResource( hData );
}
예제 #13
0
LPTR Alloc( long lCount )
/************************************************************************/
{
return( AllocX( lCount, 0 ) );
}