- Merged Source Code from MP branch Revision 3021

. clip surface coordinates before blitting
. track surface data pointer, to identify the surface's clip rectangle
. editor : test if item index is smaller than the number of items 
. other minor updates
. update png loader to work with new appdata.xml structure
. VFS updates
. fix radar maps : write to <userprofile>\RADARMAPS

* New Map Editor Release (Build: 3023)


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3023 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-06-19 15:19:49 +00:00
parent 1d3313182d
commit 46cd01e366
21 changed files with 639 additions and 263 deletions
+86 -18
View File
@@ -257,17 +257,19 @@ class CAppDataParser : public IXMLParser
enum DOM_OBJECT
{
DO_ELEMENT_NONE,
DO_ELEMENT_APPDATA,
DO_ELEMENT_ImageData,
DO_ELEMENT_SubImage,
DO_ELEMENT_offset,
DO_ELEMENT_AuxData,
DO_ELEMENT_flags,
DO_ELEMENT_properties,
};
public:
CAppDataParser(XML_Parser &parser, IXMLParser* caller=NULL)
: IXMLParser("APPDATA", parser, caller),
: IXMLParser("ImageData", parser, caller),
current_state(DO_ELEMENT_NONE),
m_hImage(NULL),
m_iCurrentAux(-1)
m_iCurrentIndex(-1)
{
}
virtual ~CAppDataParser() {};
@@ -279,29 +281,66 @@ public:
void SetImage(HIMAGE hImage)
{
m_hImage = hImage;
if(m_hImage)
{
m_vAppData.resize(m_hImage->usNumberOfObjects);
}
}
private:
DOM_OBJECT current_state;
HIMAGE m_hImage;
std::vector<AuxObjectData> m_vAppData;
int m_iCurrentAux;
struct SubImage{
SubImage()
{
memset(&aux,0,sizeof(AuxObjectData));
offset._override = false;
offset.x = 0;
offset.y = 0;
};
AuxObjectData aux;
struct{
int x,y;
bool _override;
} offset;
};
std::vector<SubImage> m_vAppData;
int m_iCurrentIndex;
};
void CAppDataParser::OnStartElement(const XML_Char* name, const XML_Char** atts)
{
if( current_state == DO_ELEMENT_NONE && strcmp(name, this->ElementName) == 0 )
{
current_state = DO_ELEMENT_APPDATA;
current_state = DO_ELEMENT_ImageData;
}
else if(current_state == DO_ELEMENT_APPDATA && strcmp(name, "AuxObjectData") == 0)
else if(current_state == DO_ELEMENT_ImageData && strcmp(name, "SubImage") == 0)
{
int index = -1;
THROWIFFALSE(GetAttributeAsInt("index",atts,index), L"could not read attribute \"index\"");
m_iCurrentAux = index;
m_iCurrentIndex = index;
if(index >= (int)m_vAppData.size())
{
m_vAppData.resize(index+1);
}
current_state = DO_ELEMENT_SubImage;
}
else if(current_state == DO_ELEMENT_SubImage && strcmp(name, "offset") == 0)
{
int offset_x = 0, offset_y = 0;
if(GetAttributeAsInt("x",atts,offset_x))
{
m_vAppData[m_iCurrentIndex].offset.x = offset_x;
m_vAppData[m_iCurrentIndex].offset._override = true;
}
if(GetAttributeAsInt("y",atts,offset_y))
{
m_vAppData[m_iCurrentIndex].offset.y = offset_y;
m_vAppData[m_iCurrentIndex].offset._override = true;
}
current_state = DO_ELEMENT_offset;
}
else if(current_state == DO_ELEMENT_SubImage && strcmp(name, "AuxObjectData") == 0)
{
current_state = DO_ELEMENT_AuxData;
}
else if(current_state == DO_ELEMENT_AuxData && strcmp(name, "flags") == 0)
@@ -310,7 +349,7 @@ void CAppDataParser::OnStartElement(const XML_Char* name, const XML_Char** atts)
}
else if(current_state == DO_ELEMENT_flags)
{
SetFlag(m_vAppData[m_iCurrentAux].fFlags, name);
SetFlag(m_vAppData[m_iCurrentIndex].aux.fFlags, name);
}
else if(current_state == DO_ELEMENT_AuxData &&
( strcmp(name, "ubCurrentFrame") == 0 ||
@@ -329,39 +368,53 @@ void CAppDataParser::OnEndElement(const XML_Char* name)
char *p;
if( strcmp(name, "usTileLocIndex") == 0 && current_state == DO_ELEMENT_properties)
{
m_vAppData[m_iCurrentAux].usTileLocIndex = (UINT16)strtoul( sCharData.c_str(),&p,10);
m_vAppData[m_iCurrentIndex].aux.usTileLocIndex = (UINT16)strtoul( sCharData.c_str(),&p,10);
current_state = DO_ELEMENT_AuxData;
}
else if( strcmp(name, "ubWallOrientation") == 0 && current_state == DO_ELEMENT_properties)
{
m_vAppData[m_iCurrentAux].ubWallOrientation = (UINT8)strtoul(sCharData.c_str(),&p,10);
m_vAppData[m_iCurrentIndex].aux.ubWallOrientation = (UINT8)strtoul(sCharData.c_str(),&p,10);
current_state = DO_ELEMENT_AuxData;
}
else if( strcmp(name, "ubNumberOfTiles") == 0 && current_state == DO_ELEMENT_properties)
{
m_vAppData[m_iCurrentAux].ubNumberOfTiles = (UINT8)strtoul(sCharData.c_str(),&p,10);
m_vAppData[m_iCurrentIndex].aux.ubNumberOfTiles = (UINT8)strtoul(sCharData.c_str(),&p,10);
current_state = DO_ELEMENT_AuxData;
}
else if( strcmp(name, "ubNumberOfFrames") == 0 && current_state == DO_ELEMENT_properties)
{
m_vAppData[m_iCurrentAux].ubNumberOfFrames = (UINT)strtoul(sCharData.c_str(),&p,10);
m_vAppData[m_iCurrentIndex].aux.ubNumberOfFrames = (UINT)strtoul(sCharData.c_str(),&p,10);
current_state = DO_ELEMENT_AuxData;
}
else if( strcmp(name, "ubCurrentFrame") == 0 && current_state == DO_ELEMENT_properties)
{
m_vAppData[m_iCurrentAux].ubCurrentFrame = (UINT8)strtoul(sCharData.c_str(),&p,10);
m_vAppData[m_iCurrentIndex].aux.ubCurrentFrame = (UINT8)strtoul(sCharData.c_str(),&p,10);
current_state = DO_ELEMENT_AuxData;
}
else if( strcmp(name, "flags") == 0 && current_state == DO_ELEMENT_flags)
{
current_state = DO_ELEMENT_AuxData;
}
else if( strcmp(name, "offset") == 0 && current_state == DO_ELEMENT_offset)
{
current_state = DO_ELEMENT_SubImage;
}
else if( strcmp(name, "AuxObjectData") == 0 && current_state == DO_ELEMENT_AuxData)
{
current_state = DO_ELEMENT_APPDATA;
current_state = DO_ELEMENT_SubImage;
}
else if( strcmp(name, this->ElementName) == 0 && current_state == DO_ELEMENT_APPDATA)
else if( strcmp(name, "SubImage") == 0 && current_state == DO_ELEMENT_SubImage)
{
current_state = DO_ELEMENT_ImageData;
}
else if( strcmp(name, this->ElementName) == 0 && current_state == DO_ELEMENT_ImageData)
{
unsigned int sum_frames = 0;
for(unsigned int i = 0; i < m_vAppData.size(); ++i)
{
sum_frames += m_vAppData[i].aux.ubNumberOfFrames;
}
THROWIFFALSE(sum_frames <= m_vAppData.size(), L"Sum of animation frames doesn't match the total number of frames");
int iAppDataSize = m_vAppData.size()*sizeof(AuxObjectData);
m_hImage->pAppData = (UINT8*) MemAlloc( iAppDataSize );
for(unsigned int i = 0; i < m_vAppData.size(); ++i)
@@ -369,6 +422,15 @@ void CAppDataParser::OnEndElement(const XML_Char* name)
memcpy(&((AuxObjectData*)m_hImage->pAppData)[i],&m_vAppData[i],sizeof(AuxObjectData));
}
m_hImage->uiAppDataSize = iAppDataSize;
unsigned int aaa = std::max<int>(m_hImage->usNumberOfObjects,m_vAppData.size());
for(unsigned int i = 0; i < aaa; ++i)
{
if(m_vAppData[i].offset._override)
{
m_hImage->pETRLEObject[i].sOffsetX = m_vAppData[i].offset.x;
m_hImage->pETRLEObject[i].sOffsetY = m_vAppData[i].offset.y;
}
}
current_state = DO_ELEMENT_NONE;
}
}
@@ -669,6 +731,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
}
vFiles.resize(count_files);
it = oLib.begin();
vfs::tReadableFile* appdata_file = NULL;
for(; !it.end(); it.next())
{
// check extension
@@ -693,7 +756,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
}
else if (StrCmp::Equal(fname.substr(dot,fname.length()-dot), CONST_DOTXML) )
{
image.ReadAppDataFromXMLFile(hImage, vfs::tReadableFile::Cast(it.value()));
appdata_file = vfs::tReadableFile::Cast(it.value());
}
}
}
@@ -794,7 +857,12 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
}
}
}
return image.WriteToHIMAGE(hImage);
bool success = image.WriteToHIMAGE(hImage);
if(appdata_file)
{
success &= image.ReadAppDataFromXMLFile(hImage, appdata_file);
}
return success;
}
+37 -8
View File
@@ -21,6 +21,8 @@
#include "shading.h"
#endif
#include <map>
std::map<UINT32,ClipRectangle> g_SurfaceRectangle;
static UINT8 g_AlphaTimesValueCache[256][256];
@@ -1729,6 +1731,9 @@ UINT16 *pBuffer;
if((pBuffer = (UINT16 *) MemAlloc(uiPitch*uiHeight))==NULL)
return(NULL);
BYTE* data = (BYTE*)pBuffer;
SurfaceData::SetApplicationData(data);
g_SurfaceRectangle[SurfaceData::GetSurfaceID(data)].SetRect(ClippingRect);
memset(pBuffer, 0, (uiPitch*uiHeight));
return(pBuffer);
@@ -1742,6 +1747,7 @@ UINT16 *pBuffer;
**********************************************************************************************/
BOOLEAN ShutdownZBuffer(UINT16 *pBuffer)
{
SurfaceData::ReleaseApplicationData((BYTE*)pBuffer);
MemFree(pBuffer);
return(TRUE);
}
@@ -6968,7 +6974,7 @@ BlitDone:
extern void WriteMessageToFile( const STR16 pString );
/**********************************************************************************************
Blt16BPPTo16BPP
@@ -6986,14 +6992,37 @@ UINT32 uiLineSkipDest, uiLineSkipSrc;
Assert(pDest!=NULL);
Assert(pSrc!=NULL);
if(iSrcXPos >= SCREEN_WIDTH)
try
{
UINT32 surfID = SurfaceData::GetSurfaceID((BYTE*)pDest);
ClipRectangle::ClipType ct;
if( (ct=g_SurfaceRectangle[surfID].Clip(iDestXPos, iDestYPos,uiWidth, uiHeight)) != ClipRectangle::NoClip )
{
#if _DEBUG
WriteMessageToFile(L"Trying to render to outside of destination surface");
#endif
if(ct == ClipRectangle::FullClip)
{
return false;
}
}
surfID = SurfaceData::GetSurfaceID((BYTE*)pSrc);
if( (ct=g_SurfaceRectangle[surfID].Clip(iSrcXPos, iSrcYPos,uiWidth, uiHeight)) != ClipRectangle::NoClip )
{
#if _DEBUG
WriteMessageToFile(L"Trying to render from outside of surface surface");
#endif
if(ct == ClipRectangle::FullClip)
{
return false;
}
}
}
catch(CBasicException& ex)
{
LogException(ex);
return false;
if(iSrcYPos >= SCREEN_HEIGHT)
return false;
if(iSrcXPos + uiWidth > SCREEN_WIDTH)
uiWidth = SCREEN_WIDTH - iSrcXPos;
if(iSrcYPos + uiHeight > SCREEN_HEIGHT)
uiHeight = SCREEN_HEIGHT - iSrcYPos;
}
pSrcPtr=(UINT16 *)((UINT8 *)pSrc+(iSrcYPos*uiSrcPitch)+(iSrcXPos*2));
pDestPtr=(UINT16 *)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
+26 -1
View File
@@ -11,6 +11,32 @@ extern "C" {
#endif
*/
class ClipRectangle
{
public:
enum ClipType
{
NoClip, PartialClip, FullClip,
};
public:
ClipRectangle();
void SetRect(SGPRect const& rect);
void SetRect(unsigned int w, unsigned int h, int x=0, int y=0);
void Set(int x1, int y1, int x2, int y2);
/**
* @returns:
* NoClip : value references are not modified
* FullClip : value references are not modified, as the values lie completely outside. Why bother doing the extra work.
* PartialClip : value references are modified
*/
ClipType Clip(int& x, int& y, unsigned int& w, unsigned int& h);
ClipType Clip(int& x1, int& y1, int& x2, int& y2);
private:
SGPRect cr;
};
extern SGPRect ClippingRect;
extern UINT32 guiTranslucentMask;
extern UINT16 White16BPPPalette[ 256 ];
@@ -18,7 +44,6 @@ extern UINT16 White16BPPPalette[ 256 ];
extern void SetClippingRect(SGPRect *clip);
void GetClippingRect(SGPRect *clip);
BOOLEAN BltIsClipped(HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion);
CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion );
+210 -6
View File
@@ -120,6 +120,201 @@ HVSURFACE ghBackBuffer = NULL;
HVSURFACE ghFrameBuffer = NULL;
HVSURFACE ghMouseBuffer = NULL;
#include <map>
extern std::map<UINT32,ClipRectangle> g_SurfaceRectangle;
namespace SurfaceData
{
typedef void* tSurface;
std::map<tID,tSurface> _surfaceID;
std::map<tSurface,BYTE*> _surfaceData;
std::map<BYTE*,tID> _surfaceOfData;
void RegisterSurface(tID surfaceID, HVSURFACE surface)
{
SurfaceData::_surfaceID[surfaceID] = surface;
g_SurfaceRectangle[surfaceID].SetRect(surface->usWidth, surface->usHeight);
}
void UnRegisterSurface(tID surfaceID)
{
std::map<tID,tSurface>::iterator it = SurfaceData::_surfaceID.find(surfaceID);
if(it != SurfaceData::_surfaceID.end())
{
g_SurfaceRectangle.erase(it->first);
SurfaceData::_surfaceID.erase(it);
}
}
void UnRegisterSurface(HVSURFACE surface)
{
std::map<tID,tSurface>::iterator it = SurfaceData::_surfaceID.begin();
for(;it != SurfaceData::_surfaceID.end(); it++)
{
if(it->second == surface)
{
SurfaceData::_surfaceID.erase(it);
return;
}
}
}
BYTE* SetSurfaceData(tID surfaceID, BYTE* data)
{
std::map<tID,tSurface>::iterator sit = SurfaceData::_surfaceID.find(surfaceID);
if(sit != SurfaceData::_surfaceID.end())
{
SurfaceData::_surfaceData[sit->second] = data;
SurfaceData::_surfaceOfData[data] = surfaceID;
return data;
}
THROWEXCEPTION(L"Unregistered surface ID");
}
BYTE* SetSurfaceData(HVSURFACE surface, BYTE* data)
{
std::map<tID,tSurface>::iterator sit = SurfaceData::_surfaceID.begin();
for(;sit != SurfaceData::_surfaceID.end(); ++sit)
{
if(sit->second = surface)
{
SurfaceData::_surfaceData[sit->second] = data;
SurfaceData::_surfaceOfData[data] = sit->first;
return data;
}
}
THROWEXCEPTION(L"Unregistered surface");
}
void ReleaseSurfaceData(tID surfaceID)
{
// does a surface with this ID exist
std::map<tID,tSurface>::iterator sit = SurfaceData::_surfaceID.find(surfaceID);
if(sit != SurfaceData::_surfaceID.end())
{
// get saved data of this surface
std::map<tSurface,BYTE*>::iterator dit = SurfaceData::_surfaceData.find(sit->second);
if(dit != SurfaceData::_surfaceData.end())
{
// as data pointer is going to be removed, release its connection to a surface ID
std::map<BYTE*,tID>::iterator it = SurfaceData::_surfaceOfData.find(dit->second);
if(it != SurfaceData::_surfaceOfData.end())
{
SurfaceData::_surfaceOfData.erase(it);
}
// finally remove data pointer
SurfaceData::_surfaceData.erase(dit);
}
}
}
void ReleaseSurfaceData(HVSURFACE surface)
{
// get saved data of this surface
std::map<tSurface,BYTE*>::iterator dit = SurfaceData::_surfaceData.find(surface);
if(dit != SurfaceData::_surfaceData.end())
{
// as data pointer is going to be removed, release its connection to a surface ID
std::map<BYTE*,tID>::iterator it = SurfaceData::_surfaceOfData.find(dit->second);
if(it != SurfaceData::_surfaceOfData.end())
{
_surfaceOfData.erase(it);
}
// finally remove data pointer
SurfaceData::_surfaceData.erase(dit);
}
}
BYTE* SetApplicationData(BYTE* data)
{
tID id = (tID)(data);
SurfaceData::_surfaceOfData[data] = id;
return data;
}
void ReleaseApplicationData(BYTE* data)
{
tID id = (tID)(data);
std::map<BYTE*,tID>::iterator it = SurfaceData::_surfaceOfData.find(data);
if(it != SurfaceData::_surfaceOfData.end())
{
g_SurfaceRectangle.erase(it->second);
SurfaceData::_surfaceOfData.erase(it);
}
return ReleaseSurfaceData(id);
}
tID GetSurfaceID(BYTE* data)
{
std::map<BYTE*,tID>::iterator it = SurfaceData::_surfaceOfData.find(data);
if(it != SurfaceData::_surfaceOfData.end())
{
return it->second;
}
THROWEXCEPTION(L"Pointer to surface invalid");
}
};
ClipRectangle::ClipRectangle()
{
cr.iLeft = 0;
cr.iTop = 0;
cr.iRight = 0;
cr.iBottom = 0;
};
void ClipRectangle::SetRect(SGPRect const& rect)
{
Set(rect.iLeft, rect.iTop, rect.iRight, rect.iBottom);
}
void ClipRectangle::SetRect(unsigned int w, unsigned int h, int x, int y)
{
Set(x,y,x+w,y+h);
}
void ClipRectangle::Set(int x1, int y1, int x2, int y2)
{
cr.iLeft = x1;
cr.iRight = x2;
cr.iTop = y1;
cr.iBottom = y2;
}
/**
* @returns:
* NoClip : value references are not modified
* FullClip : value references are not modified, as the values lie completely outside. Why bother doing the extra work.
* PartialClip : value references are modified
*/
ClipRectangle::ClipType ClipRectangle::Clip(int& x, int& y, unsigned int& w, unsigned int& h)
{
int right = x + w - 1;
int bottom = y + h - 1;
ClipType ct;
if( (ct = Clip(x,y,right,bottom)) == PartialClip)
{
w = right - x + 1;
h = bottom - y + 1;
}
return ct;
}
ClipRectangle::ClipType ClipRectangle::Clip(int& x1, int& y1, int& x2, int& y2)
{
if( (x1 >= cr.iLeft) &&
(x2 <= cr.iRight) &&
(y1 >= cr.iTop) &&
(y2 <= cr.iBottom) )
{
return NoClip;
}
if( (x1 > cr.iRight) || // right of rectangle
(x2 < cr.iLeft) || // left of rectangle
(y1 > cr.iBottom) || // below rectangle
(y2 < cr.iTop) ) // above rectangle
{
return FullClip;
}
if( x1 < cr.iLeft) x1 = cr.iLeft;
if( x2 > cr.iRight) x2 = cr.iRight;
if( y1 < cr.iTop) y1 = cr.iTop;
if( y2 > cr.iBottom) y2 = cr.iBottom;
return PartialClip;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Video Surface Manager functions
@@ -244,6 +439,7 @@ BOOLEAN AddStandardVideoSurface( VSURFACE_DESC *pVSurfaceDesc, UINT32 *puiIndex
gpVSurfaceTail->hVSurface = hVSurface;
gpVSurfaceTail->uiIndex = guiVSurfaceIndex+=2;
*puiIndex = gpVSurfaceTail->uiIndex;
SurfaceData::RegisterSurface(*puiIndex, hVSurface);
Assert( guiVSurfaceIndex < 0xfffffff0 ); //unlikely that we will ever use 2 billion VSurfaces!
//We would have to create about 70 VSurfaces per second for 1 year straight to achieve this...
guiVSurfaceSize++;
@@ -266,23 +462,23 @@ BYTE *LockVideoSurface( UINT32 uiVSurface, UINT32 *puiPitch )
#ifdef JA2
if ( uiVSurface == PRIMARY_SURFACE )
{
return (BYTE *)LockPrimarySurface( puiPitch );
return SurfaceData::SetSurfaceData(uiVSurface, (BYTE *)LockPrimarySurface( puiPitch ));
}
if ( uiVSurface == BACKBUFFER )
{
return (BYTE *)LockBackBuffer( puiPitch );
return SurfaceData::SetSurfaceData(uiVSurface, (BYTE *)LockBackBuffer( puiPitch ));
}
#endif
if ( uiVSurface == FRAME_BUFFER )
{
return (BYTE *)LockFrameBuffer( puiPitch );
return SurfaceData::SetSurfaceData(uiVSurface, (BYTE *)LockFrameBuffer( puiPitch ));
}
if ( uiVSurface == MOUSE_BUFFER )
{
return (BYTE *)LockMouseBuffer( puiPitch );
return SurfaceData::SetSurfaceData(uiVSurface, (BYTE *)LockMouseBuffer( puiPitch ));
}
//
@@ -307,7 +503,7 @@ BYTE *LockVideoSurface( UINT32 uiVSurface, UINT32 *puiPitch )
// Lock buffer
//
return LockVideoSurfaceBuffer( curr->hVSurface, puiPitch );
return SurfaceData::SetSurfaceData(uiVSurface, LockVideoSurfaceBuffer( curr->hVSurface, puiPitch ));
}
@@ -315,6 +511,7 @@ void UnLockVideoSurface( UINT32 uiVSurface )
{
VSURFACE_NODE *curr;
SurfaceData::ReleaseSurfaceData(uiVSurface);
//
// Check if given backbuffer or primary buffer
//
@@ -495,6 +692,7 @@ BOOLEAN SetPrimaryVideoSurfaces( )
ghPrimary = CreateVideoSurfaceFromDDSurface( pSurface );
CHECKF( ghPrimary != NULL );
SurfaceData::RegisterSurface(PRIMARY_SURFACE,ghPrimary);
//
// Get Backbuffer surface
@@ -505,6 +703,7 @@ BOOLEAN SetPrimaryVideoSurfaces( )
ghBackBuffer = CreateVideoSurfaceFromDDSurface( pSurface );
CHECKF( ghBackBuffer != NULL );
SurfaceData::RegisterSurface(BACKBUFFER,ghBackBuffer);
//
// Get mouse buffer surface
@@ -514,6 +713,7 @@ BOOLEAN SetPrimaryVideoSurfaces( )
ghMouseBuffer = CreateVideoSurfaceFromDDSurface( pSurface );
CHECKF( ghMouseBuffer != NULL );
SurfaceData::RegisterSurface(MOUSE_BUFFER,ghMouseBuffer);
#endif
@@ -526,7 +726,7 @@ BOOLEAN SetPrimaryVideoSurfaces( )
ghFrameBuffer = CreateVideoSurfaceFromDDSurface( pSurface );
CHECKF( ghFrameBuffer != NULL );
SurfaceData::RegisterSurface(FRAME_BUFFER,ghFrameBuffer);
return( TRUE );
}
@@ -539,24 +739,28 @@ void DeletePrimaryVideoSurfaces( )
if ( ghPrimary != NULL )
{
SurfaceData::UnRegisterSurface(ghPrimary);
DeleteVideoSurface( ghPrimary );
ghPrimary = NULL;
}
if ( ghBackBuffer != NULL )
{
SurfaceData::UnRegisterSurface(ghBackBuffer);
DeleteVideoSurface( ghBackBuffer );
ghBackBuffer = NULL;
}
if ( ghFrameBuffer != NULL )
{
SurfaceData::UnRegisterSurface(ghFrameBuffer);
DeleteVideoSurface( ghFrameBuffer );
ghFrameBuffer = NULL;
}
if ( ghMouseBuffer != NULL )
{
SurfaceData::UnRegisterSurface(ghMouseBuffer);
DeleteVideoSurface( ghMouseBuffer );
ghMouseBuffer = NULL;
}
+9
View File
@@ -118,6 +118,15 @@ typedef struct
} VSURFACE_DESC;
namespace SurfaceData
{
typedef unsigned long tID;
BYTE* SetApplicationData(BYTE* data);
void ReleaseApplicationData(BYTE* data);
tID GetSurfaceID(BYTE* data);
};
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Video Surface Manager Functions