mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- 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:
+26
-14
@@ -44,6 +44,8 @@
|
||||
#include "keys.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/Tools/Log.h"
|
||||
|
||||
#define NUMBER_TRIGGERS 27
|
||||
#define PRESSURE_ACTION_ID (NUMBER_TRIGGERS - 1)
|
||||
|
||||
@@ -526,25 +528,35 @@ void InitEditorItemsInfo(UINT32 uiItemType)
|
||||
|
||||
DisplayWrappedString(x, (UINT16)(y+25), 60, 2, SMALLCOMPFONT, FONT_WHITE, pStr, FONT_BLACK, TRUE, CENTER_JUSTIFIED );
|
||||
|
||||
//Calculate the center position of the graphic in a 60 pixel wide area.
|
||||
sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth;
|
||||
sOffset = hVObject->pETRLEObject[item->ubGraphicNum].sOffsetX;
|
||||
sStart = x + (60 - sWidth - sOffset*2) / 2;
|
||||
|
||||
if( sWidth && sWidth > 0 )
|
||||
if(item->ubGraphicNum < hVObject->usNumberOfObjects)
|
||||
{
|
||||
BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, 0, FALSE );
|
||||
}
|
||||
//Calculate the center position of the graphic in a 60 pixel wide area.
|
||||
sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth;
|
||||
sOffset = hVObject->pETRLEObject[item->ubGraphicNum].sOffsetX;
|
||||
sStart = x + (60 - sWidth - sOffset*2) / 2;
|
||||
|
||||
//cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)...
|
||||
if( y == 0 )
|
||||
{
|
||||
y = 40;
|
||||
if( sWidth && sWidth > 0 )
|
||||
{
|
||||
BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, 0, FALSE );
|
||||
}
|
||||
|
||||
//cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)...
|
||||
if( y == 0 )
|
||||
{
|
||||
y = 40;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0;
|
||||
x += 60;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 0;
|
||||
x += 60;
|
||||
static CLog& editorLog = *CLog::Create(L"EditorItems.log");
|
||||
editorLog << L"Tried to access item ["
|
||||
<< item->ubGraphicNum << L"/" << hVObject->usNumberOfObjects
|
||||
<< L"]" << CLog::endl;
|
||||
}
|
||||
}
|
||||
usCounter++;
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
#ifdef JA2EDITOR
|
||||
|
||||
//MAP EDITOR BUILD VERSION
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2996" };
|
||||
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.3023" };
|
||||
|
||||
#elif defined JA2BETAVERSION
|
||||
|
||||
@@ -32,7 +32,7 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
|
||||
|
||||
#endif
|
||||
|
||||
CHAR8 czVersionNumber[16] = { "Build 09.06.10" }; //YY.MM.DD
|
||||
CHAR8 czVersionNumber[16] = { "Build 09.06.19" }; //YY.MM.DD
|
||||
CHAR16 zTrackingNumber[16] = { L"Z" };
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+139
-169
@@ -74,7 +74,6 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom )
|
||||
iLeft = SCREEN_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
if ( iTop < 0 )
|
||||
{
|
||||
iTop = 0;
|
||||
@@ -84,7 +83,6 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom )
|
||||
iTop = SCREEN_HEIGHT;
|
||||
}
|
||||
|
||||
|
||||
if ( iRight < 0 )
|
||||
{
|
||||
iRight = 0;
|
||||
@@ -94,7 +92,6 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom )
|
||||
iRight = SCREEN_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
if ( iBottom < 0 )
|
||||
{
|
||||
iBottom = 0;
|
||||
@@ -104,16 +101,16 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom )
|
||||
iBottom = SCREEN_HEIGHT;
|
||||
}
|
||||
|
||||
if ( ( iRight - iLeft ) == 0 || ( iBottom - iTop ) == 0 )
|
||||
if ( ( iRight - iLeft ) == 0 || ( iBottom - iTop ) == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if((iLeft==gsVIEWPORT_START_X) &&
|
||||
(iRight==gsVIEWPORT_END_X) &&
|
||||
(iTop==gsVIEWPORT_WINDOW_START_Y) &&
|
||||
(iBottom==gsVIEWPORT_WINDOW_END_Y))
|
||||
if( (iLeft==gsVIEWPORT_START_X) &&
|
||||
(iRight==gsVIEWPORT_END_X) &&
|
||||
(iTop==gsVIEWPORT_WINDOW_START_Y) &&
|
||||
(iBottom==gsVIEWPORT_WINDOW_END_Y))
|
||||
{
|
||||
gfViewportDirty=TRUE;
|
||||
return;
|
||||
@@ -126,7 +123,6 @@ void AddBaseDirtyRect( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom )
|
||||
aRect.iBottom = iBottom;
|
||||
|
||||
InvalidateRegionEx( aRect.iLeft, aRect.iTop, aRect.iRight, aRect.iBottom, 0 );
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN ExecuteBaseDirtyRectQueue( )
|
||||
@@ -140,21 +136,18 @@ BOOLEAN ExecuteBaseDirtyRectQueue( )
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN EmptyDirtyRectQueue( )
|
||||
{
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
INT32 GetFreeBackgroundBuffer(void)
|
||||
{
|
||||
UINT32 uiCount;
|
||||
UINT32 uiCount;
|
||||
|
||||
for(uiCount=0; uiCount < guiNumBackSaves; uiCount++)
|
||||
{
|
||||
@@ -162,7 +155,6 @@ UINT32 uiCount;
|
||||
return((INT32)uiCount);
|
||||
}
|
||||
|
||||
|
||||
if(guiNumBackSaves < BACKGROUND_BUFFERS)
|
||||
return((INT32)guiNumBackSaves++);
|
||||
#ifdef JA2BETAVERSION
|
||||
@@ -172,13 +164,12 @@ UINT32 uiCount;
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ERROR! GetFreeBackgroundBuffer(): Trying to allocate more saves then there is room: guiCurrentScreen = %d", guiCurrentScreen ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void RecountBackgrounds(void)
|
||||
{
|
||||
INT32 uiCount;
|
||||
INT32 uiCount;
|
||||
|
||||
for(uiCount=guiNumBackSaves-1; (uiCount >=0) ; uiCount--)
|
||||
{
|
||||
@@ -190,30 +181,32 @@ INT32 uiCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include <map>
|
||||
extern std::map<UINT32,ClipRectangle> g_SurfaceRectangle;
|
||||
|
||||
INT32 RegisterBackgroundRect(UINT32 uiFlags, INT16 *pSaveArea, INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom)
|
||||
{
|
||||
UINT32 uiBufSize;
|
||||
INT32 iBackIndex;
|
||||
INT32 ClipX1, ClipY1, ClipX2, ClipY2;
|
||||
INT32 uiLeftSkip, uiRightSkip, uiTopSkip, uiBottomSkip;
|
||||
UINT32 usHeight, usWidth;
|
||||
INT32 iTempX, iTempY;
|
||||
|
||||
UINT32 uiBufSize;
|
||||
INT32 iBackIndex;
|
||||
INT32 ClipX1, ClipY1, ClipX2, ClipY2;
|
||||
INT32 uiLeftSkip, uiRightSkip, uiTopSkip, uiBottomSkip;
|
||||
UINT32 usHeight, usWidth;
|
||||
INT32 iTempX, iTempY;
|
||||
|
||||
// Don't register if we are rendering and we are below the viewport
|
||||
//if ( sTop >= gsVIEWPORT_WINDOW_END_Y )
|
||||
//{
|
||||
// return(-1 );
|
||||
//}
|
||||
//only time this shoudl be true is tactical..fix for games saved in broken state
|
||||
extern UINT32 guiTacticalInterfaceFlags;
|
||||
if (guiTacticalInterfaceFlags & 0x00000001)
|
||||
if(gDirtyClipRect.iBottom < SCREEN_HEIGHT)
|
||||
gDirtyClipRect.iBottom = SCREEN_HEIGHT;
|
||||
|
||||
//only time this shoudl be true is tactical..fix for games saved in broken state
|
||||
extern UINT32 guiTacticalInterfaceFlags;
|
||||
if (guiTacticalInterfaceFlags & 0x00000001)
|
||||
{
|
||||
if(gDirtyClipRect.iBottom < SCREEN_HEIGHT)
|
||||
{
|
||||
gDirtyClipRect.iBottom = SCREEN_HEIGHT;
|
||||
}
|
||||
}
|
||||
ClipX1= gDirtyClipRect.iLeft;
|
||||
ClipY1= gDirtyClipRect.iTop;
|
||||
ClipX2= gDirtyClipRect.iRight;
|
||||
@@ -247,7 +240,6 @@ if (guiTacticalInterfaceFlags & 0x00000001)
|
||||
sTop = sTop + (INT16)uiTopSkip;
|
||||
sBottom = sBottom - (INT16)uiBottomSkip;
|
||||
|
||||
|
||||
if((iBackIndex=GetFreeBackgroundBuffer())==(-1))
|
||||
return(-1);
|
||||
|
||||
@@ -266,6 +258,9 @@ if (guiTacticalInterfaceFlags & 0x00000001)
|
||||
{
|
||||
if((gBackSaves[iBackIndex].pSaveArea = (INT16 *) MemAlloc(uiBufSize))==NULL)
|
||||
return(-1);
|
||||
BYTE* data = (BYTE*)gBackSaves[iBackIndex].pSaveArea;
|
||||
SurfaceData::SetApplicationData(data);
|
||||
g_SurfaceRectangle[SurfaceData::GetSurfaceID(data)].SetRect(sRight-sLeft,sBottom-sTop);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,6 +269,9 @@ if (guiTacticalInterfaceFlags & 0x00000001)
|
||||
if((gBackSaves[iBackIndex].pZSaveArea = (INT16 *) MemAlloc(uiBufSize))==NULL)
|
||||
return(-1);
|
||||
gBackSaves[iBackIndex].fZBuffer=TRUE;
|
||||
BYTE* data = (BYTE*)gBackSaves[iBackIndex].pZSaveArea;
|
||||
SurfaceData::SetApplicationData(data);
|
||||
g_SurfaceRectangle[SurfaceData::GetSurfaceID(data)].SetRect(sRight-sLeft,sBottom-sTop);
|
||||
}
|
||||
|
||||
gBackSaves[iBackIndex].fFreeMemory=TRUE;
|
||||
@@ -300,14 +298,14 @@ void SetBackgroundRectFilled( UINT32 uiBackgroundID )
|
||||
gBackSaves[uiBackgroundID].fFilled=TRUE;
|
||||
|
||||
AddBaseDirtyRect(gBackSaves[uiBackgroundID].sLeft, gBackSaves[uiBackgroundID].sTop,
|
||||
gBackSaves[uiBackgroundID].sRight, gBackSaves[uiBackgroundID].sBottom);
|
||||
gBackSaves[uiBackgroundID].sRight, gBackSaves[uiBackgroundID].sBottom);
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN RestoreBackgroundRects(void)
|
||||
{
|
||||
UINT32 uiCount, uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
UINT32 uiCount, uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
|
||||
pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES);
|
||||
pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES);
|
||||
@@ -328,7 +326,6 @@ UINT8 *pDestBuf, *pSrcBuf;
|
||||
|
||||
AddBaseDirtyRect(gBackSaves[uiCount].sLeft, gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sRight, gBackSaves[uiCount].sBottom);
|
||||
|
||||
}
|
||||
}
|
||||
else if ( gBackSaves[uiCount].uiFlags & BGND_FLAG_SAVE_Z )
|
||||
@@ -350,10 +347,9 @@ UINT8 *pDestBuf, *pSrcBuf;
|
||||
gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight);
|
||||
|
||||
AddBaseDirtyRect(gBackSaves[uiCount].sLeft, gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sRight, gBackSaves[uiCount].sBottom);
|
||||
gBackSaves[uiCount].sRight, gBackSaves[uiCount].sBottom);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UnLockVideoSurface(guiRENDERBUFFER);
|
||||
@@ -381,11 +377,15 @@ BOOLEAN EmptyBackgroundRects(void)
|
||||
{
|
||||
if ( gBackSaves[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gBackSaves[uiCount].pSaveArea);
|
||||
MemFree(gBackSaves[uiCount].pSaveArea);
|
||||
}
|
||||
}
|
||||
if(gBackSaves[uiCount].fZBuffer)
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gBackSaves[uiCount].pZSaveArea);
|
||||
MemFree(gBackSaves[uiCount].pZSaveArea);
|
||||
}
|
||||
|
||||
gBackSaves[uiCount].fZBuffer=FALSE;
|
||||
gBackSaves[uiCount].fAllocated=FALSE;
|
||||
@@ -405,12 +405,16 @@ BOOLEAN EmptyBackgroundRects(void)
|
||||
{
|
||||
if ( gBackSaves[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gBackSaves[uiCount].pSaveArea);
|
||||
MemFree(gBackSaves[uiCount].pSaveArea);
|
||||
}
|
||||
}
|
||||
|
||||
if(gBackSaves[uiCount].fZBuffer)
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gBackSaves[uiCount].pZSaveArea);
|
||||
MemFree(gBackSaves[uiCount].pZSaveArea);
|
||||
}
|
||||
}
|
||||
|
||||
gBackSaves[uiCount].fZBuffer=FALSE;
|
||||
@@ -430,8 +434,8 @@ BOOLEAN EmptyBackgroundRects(void)
|
||||
|
||||
BOOLEAN SaveBackgroundRects(void)
|
||||
{
|
||||
UINT32 uiCount, uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
UINT32 uiCount, uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
|
||||
pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES );
|
||||
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES);
|
||||
@@ -440,36 +444,33 @@ UINT8 *pDestBuf, *pSrcBuf;
|
||||
{
|
||||
if(gBackSaves[uiCount].fAllocated && ( !gBackSaves[uiCount].fDisabled) )
|
||||
{
|
||||
if ( gBackSaves[uiCount].uiFlags & BGND_FLAG_SAVERECT )
|
||||
if ( gBackSaves[uiCount].uiFlags & BGND_FLAG_SAVERECT )
|
||||
{
|
||||
if ( gBackSaves[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
if ( gBackSaves[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pSaveArea, gBackSaves[uiCount].sWidth*2,
|
||||
(UINT16 *)pSrcBuf, uiDestPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight);
|
||||
|
||||
}
|
||||
Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pSaveArea, gBackSaves[uiCount].sWidth*2,
|
||||
(UINT16 *)pSrcBuf, uiDestPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight);
|
||||
|
||||
}
|
||||
else if(gBackSaves[uiCount].fZBuffer)
|
||||
{
|
||||
Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pZSaveArea, gBackSaves[uiCount].sWidth*2,
|
||||
}
|
||||
else if(gBackSaves[uiCount].fZBuffer)
|
||||
{
|
||||
Blt16BPPTo16BPP((UINT16 *)gBackSaves[uiCount].pZSaveArea, gBackSaves[uiCount].sWidth*2,
|
||||
(UINT16 *)gpZBuffer, uiDestPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[uiCount].sLeft , gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sWidth, gBackSaves[uiCount].sHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBaseDirtyRect(gBackSaves[uiCount].sLeft, gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sRight, gBackSaves[uiCount].sBottom);
|
||||
}
|
||||
|
||||
gBackSaves[uiCount].fFilled=TRUE;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
AddBaseDirtyRect(gBackSaves[uiCount].sLeft, gBackSaves[uiCount].sTop,
|
||||
gBackSaves[uiCount].sRight, gBackSaves[uiCount].sBottom);
|
||||
}
|
||||
|
||||
gBackSaves[uiCount].fFilled=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +507,10 @@ BOOLEAN FreeBackgroundRectNow(INT32 uiCount)
|
||||
{
|
||||
//MemFree(gBackSaves[uiCount].pSaveArea);
|
||||
if(gBackSaves[uiCount].fZBuffer)
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gBackSaves[uiCount].pZSaveArea);
|
||||
MemFree(gBackSaves[uiCount].pZSaveArea);
|
||||
}
|
||||
}
|
||||
|
||||
gBackSaves[uiCount].fZBuffer=FALSE;
|
||||
@@ -531,7 +535,10 @@ UINT32 uiCount;
|
||||
{
|
||||
//MemFree(gBackSaves[uiCount].pSaveArea);
|
||||
if(gBackSaves[uiCount].fZBuffer)
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gBackSaves[uiCount].pZSaveArea);
|
||||
MemFree(gBackSaves[uiCount].pZSaveArea);
|
||||
}
|
||||
}
|
||||
|
||||
gBackSaves[uiCount].fZBuffer=FALSE;
|
||||
@@ -556,7 +563,7 @@ BOOLEAN InitializeBackgroundRects(void)
|
||||
|
||||
BOOLEAN InvalidateBackgroundRects(void)
|
||||
{
|
||||
UINT32 uiCount;
|
||||
UINT32 uiCount;
|
||||
|
||||
for(uiCount=0; uiCount < guiNumBackSaves; uiCount++)
|
||||
gBackSaves[uiCount].fFilled=FALSE;
|
||||
@@ -567,7 +574,7 @@ UINT32 uiCount;
|
||||
|
||||
BOOLEAN ShutdownBackgroundRects(void)
|
||||
{
|
||||
UINT32 uiCount;
|
||||
UINT32 uiCount;
|
||||
|
||||
for(uiCount=0; uiCount < guiNumBackSaves; uiCount++)
|
||||
{
|
||||
@@ -590,7 +597,6 @@ BOOLEAN UpdateSaveBuffer(void)
|
||||
UINT16 usWidth, usHeight;
|
||||
UINT8 ubBitDepth;
|
||||
|
||||
|
||||
// Update saved buffer - do for the viewport size ony!
|
||||
GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth );
|
||||
|
||||
@@ -612,7 +618,6 @@ BOOLEAN UpdateSaveBuffer(void)
|
||||
0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, gsVIEWPORT_WINDOW_END_Y );
|
||||
}
|
||||
|
||||
|
||||
UnLockVideoSurface(guiRENDERBUFFER);
|
||||
UnLockVideoSurface(guiSAVEBUFFER);
|
||||
|
||||
@@ -622,7 +627,6 @@ BOOLEAN UpdateSaveBuffer(void)
|
||||
|
||||
BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight )
|
||||
{
|
||||
|
||||
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
|
||||
@@ -670,14 +674,13 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack )
|
||||
INT16 sLeft, sTop, sWidth, sHeight;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
|
||||
|
||||
if( !gBackSaves[iBack].fAllocated )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
sLeft = gBackSaves[iBack].sLeft;
|
||||
sTop = gBackSaves[iBack].sTop;
|
||||
sLeft = gBackSaves[iBack].sLeft;
|
||||
sTop = gBackSaves[iBack].sTop;
|
||||
sWidth = gBackSaves[iBack].sWidth;
|
||||
sHeight = gBackSaves[iBack].sHeight;
|
||||
|
||||
@@ -711,14 +714,11 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack )
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 sHeight )
|
||||
{
|
||||
|
||||
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
UINT8 *pDestBuf, *pSrcBuf;
|
||||
|
||||
|
||||
Assert( ( sLeft >= 0 ) && ( sTop >= 0 ) && ( sLeft + sWidth <= SCREEN_WIDTH ) && ( sTop + sHeight <= SCREEN_HEIGHT ) );
|
||||
|
||||
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
|
||||
@@ -746,7 +746,6 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// gprintfdirty
|
||||
//
|
||||
@@ -758,10 +757,10 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s
|
||||
//*****************************************************************************
|
||||
UINT16 gprintfdirty(INT16 x, INT16 y, STR16 pFontString, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR16 string[512];
|
||||
UINT16 uiStringLength, uiStringHeight;
|
||||
INT32 iBack;
|
||||
va_list argptr;
|
||||
CHAR16 string[512];
|
||||
UINT16 uiStringLength, uiStringHeight;
|
||||
INT32 iBack;
|
||||
|
||||
Assert(pFontString!=NULL);
|
||||
|
||||
@@ -787,9 +786,9 @@ INT32 iBack;
|
||||
|
||||
UINT16 gprintfinvalidate(INT16 x, INT16 y, STR16 pFontString, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR16 string[512];
|
||||
UINT16 uiStringLength, uiStringHeight;
|
||||
va_list argptr;
|
||||
CHAR16 string[512];
|
||||
UINT16 uiStringLength, uiStringHeight;
|
||||
|
||||
Assert(pFontString!=NULL);
|
||||
|
||||
@@ -809,9 +808,9 @@ UINT16 uiStringLength, uiStringHeight;
|
||||
|
||||
UINT16 gprintfRestore(INT16 x, INT16 y, STR16 pFontString, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR16 string[512];
|
||||
UINT16 uiStringLength, uiStringHeight;
|
||||
va_list argptr;
|
||||
CHAR16 string[512];
|
||||
UINT16 uiStringLength, uiStringHeight;
|
||||
|
||||
Assert(pFontString!=NULL);
|
||||
|
||||
@@ -830,7 +829,6 @@ UINT16 uiStringLength, uiStringHeight;
|
||||
return(uiStringLength);
|
||||
}
|
||||
|
||||
|
||||
// OVERLAY STUFF
|
||||
INT32 GetFreeVideoOverlay(void)
|
||||
{
|
||||
@@ -848,7 +846,6 @@ INT32 GetFreeVideoOverlay(void)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
void RecountVideoOverlays(void)
|
||||
{
|
||||
INT32 uiCount;
|
||||
@@ -881,8 +878,6 @@ INT32 RegisterVideoOverlay( UINT32 uiFlags, VIDEO_OVERLAY_DESC *pTopmostDesc )
|
||||
uiStringHeight=GetFontHeight( pTopmostDesc->uiFontID );
|
||||
|
||||
iBackIndex = RegisterBackgroundRect( BGND_FLAG_PERMANENT, NULL, pTopmostDesc->sLeft, pTopmostDesc->sTop, (INT16)(pTopmostDesc->sLeft + uiStringLength), (INT16)(pTopmostDesc->sTop + uiStringHeight) );
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -890,13 +885,11 @@ INT32 RegisterVideoOverlay( UINT32 uiFlags, VIDEO_OVERLAY_DESC *pTopmostDesc )
|
||||
iBackIndex = RegisterBackgroundRect( BGND_FLAG_PERMANENT, NULL, pTopmostDesc->sLeft, pTopmostDesc->sTop, pTopmostDesc->sRight, pTopmostDesc->sBottom );
|
||||
}
|
||||
|
||||
|
||||
if ( iBackIndex == -1 )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
||||
// Get next free topmost blitter index
|
||||
if( ( iBlitterIndex = GetFreeVideoOverlay())==(-1))
|
||||
return(-1);
|
||||
@@ -927,10 +920,8 @@ INT32 RegisterVideoOverlay( UINT32 uiFlags, VIDEO_OVERLAY_DESC *pTopmostDesc )
|
||||
//DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Register Overlay %d %S", iBlitterIndex, gVideoOverlays[ iBlitterIndex ].zText ) );
|
||||
|
||||
return( iBlitterIndex );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SetVideoOverlayPendingDelete( INT32 iVideoOverlay )
|
||||
{
|
||||
if ( iVideoOverlay != -1 )
|
||||
@@ -947,7 +938,6 @@ void RemoveVideoOverlay( INT32 iVideoOverlay )
|
||||
// Check if we are actively scrolling
|
||||
if ( gVideoOverlays[ iVideoOverlay ].fActivelySaving )
|
||||
{
|
||||
|
||||
// DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Overlay Actively saving %d %S", iVideoOverlay, gVideoOverlays[ iVideoOverlay ].zText ) );
|
||||
|
||||
gVideoOverlays[ iVideoOverlay ].fDeletionPending = TRUE;
|
||||
@@ -961,22 +951,20 @@ void RemoveVideoOverlay( INT32 iVideoOverlay )
|
||||
|
||||
//DebugMsg( TOPIC_JA2, DBG_LEVEL_0, String( "Delete Overlay %d %S", iVideoOverlay, gVideoOverlays[ iVideoOverlay ].zText ) );
|
||||
|
||||
|
||||
// Remove save buffer if not done so
|
||||
if ( gVideoOverlays[ iVideoOverlay ].pSaveArea != NULL )
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gVideoOverlays[ iVideoOverlay ].pSaveArea);
|
||||
MemFree( gVideoOverlays[ iVideoOverlay ].pSaveArea );
|
||||
}
|
||||
gVideoOverlays[ iVideoOverlay ].pSaveArea = NULL;
|
||||
|
||||
|
||||
// Set as not allocated
|
||||
gVideoOverlays[ iVideoOverlay ].fAllocated = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterIndex, BOOLEAN fForceAll )
|
||||
{
|
||||
UINT32 uiFlags;
|
||||
@@ -994,9 +982,9 @@ BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterInd
|
||||
|
||||
if ( fForceAll )
|
||||
{
|
||||
gVideoOverlays[ iBlitterIndex ].uiFontID = pTopmostDesc->uiFontID;
|
||||
gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX;
|
||||
gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY;
|
||||
gVideoOverlays[ iBlitterIndex ].uiFontID = pTopmostDesc->uiFontID;
|
||||
gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX;
|
||||
gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY;
|
||||
gVideoOverlays[ iBlitterIndex ].ubFontBack = pTopmostDesc->ubFontBack;
|
||||
gVideoOverlays[ iBlitterIndex ].ubFontFore = pTopmostDesc->ubFontFore;
|
||||
|
||||
@@ -1044,18 +1032,13 @@ BOOLEAN UpdateVideoOverlay( VIDEO_OVERLAY_DESC *pTopmostDesc, UINT32 iBlitterInd
|
||||
gVideoOverlays[ iBlitterIndex ].uiBackground = RegisterBackgroundRect( BGND_FLAG_PERMANENT, NULL, pTopmostDesc->sLeft, pTopmostDesc->sTop, (INT16)(pTopmostDesc->sLeft + uiStringLength), (INT16)(pTopmostDesc->sTop + uiStringHeight) );
|
||||
gVideoOverlays[ iBlitterIndex ].sX = pTopmostDesc->sX;
|
||||
gVideoOverlays[ iBlitterIndex ].sY = pTopmostDesc->sY;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
// FUnctions for entrie array of blitters
|
||||
void ExecuteVideoOverlays( )
|
||||
{
|
||||
@@ -1065,37 +1048,36 @@ void ExecuteVideoOverlays( )
|
||||
{
|
||||
if( gVideoOverlays[uiCount].fAllocated )
|
||||
{
|
||||
if ( !gVideoOverlays[uiCount].fDisabled )
|
||||
if ( !gVideoOverlays[uiCount].fDisabled )
|
||||
{
|
||||
// If we are scrolling but havn't saved yet, don't!
|
||||
if ( !gVideoOverlays[uiCount].fActivelySaving && gfScrollInertia > 0 )
|
||||
{
|
||||
// If we are scrolling but havn't saved yet, don't!
|
||||
if ( !gVideoOverlays[uiCount].fActivelySaving && gfScrollInertia > 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// ATE: Wait a frame before executing!
|
||||
if ( gVideoOverlays[uiCount].fAllocated == 1 )
|
||||
{
|
||||
// Call Blit Function
|
||||
(*(gVideoOverlays[uiCount].BltCallback ) ) ( &(gVideoOverlays[uiCount]) );
|
||||
}
|
||||
else if ( gVideoOverlays[uiCount].fAllocated == 2 )
|
||||
{
|
||||
gVideoOverlays[uiCount].fAllocated = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove if pending
|
||||
//if ( gVideoOverlays[uiCount].fDeletionPending )
|
||||
//{
|
||||
// RemoveVideoOverlay( uiCount );
|
||||
//}
|
||||
// ATE: Wait a frame before executing!
|
||||
if ( gVideoOverlays[uiCount].fAllocated == 1 )
|
||||
{
|
||||
// Call Blit Function
|
||||
(*(gVideoOverlays[uiCount].BltCallback ) ) ( &(gVideoOverlays[uiCount]) );
|
||||
}
|
||||
else if ( gVideoOverlays[uiCount].fAllocated == 2 )
|
||||
{
|
||||
gVideoOverlays[uiCount].fAllocated = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove if pending
|
||||
//if ( gVideoOverlays[uiCount].fDeletionPending )
|
||||
//{
|
||||
// RemoveVideoOverlay( uiCount );
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ExecuteVideoOverlaysToAlternateBuffer( UINT32 uiNewDestBuffer )
|
||||
{
|
||||
UINT32 uiCount;
|
||||
@@ -1112,13 +1094,12 @@ void ExecuteVideoOverlaysToAlternateBuffer( UINT32 uiNewDestBuffer )
|
||||
gVideoOverlays[uiCount].uiDestBuff = uiNewDestBuffer;
|
||||
|
||||
// Call Blit Function
|
||||
(*(gVideoOverlays[uiCount].BltCallback ) ) ( &(gVideoOverlays[uiCount]) );
|
||||
(*(gVideoOverlays[uiCount].BltCallback ) ) ( &(gVideoOverlays[uiCount]) );
|
||||
|
||||
gVideoOverlays[uiCount].uiDestBuff = uiOldDestBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AllocateVideoOverlaysArea( )
|
||||
@@ -1145,12 +1126,15 @@ void AllocateVideoOverlaysArea( )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
BYTE* data = (BYTE*)gVideoOverlays[ uiCount ].pSaveArea;
|
||||
SurfaceData::SetApplicationData(data);
|
||||
g_SurfaceRectangle[SurfaceData::GetSurfaceID(data)].SetRect(
|
||||
gBackSaves[ iBackIndex ].sWidth,
|
||||
gBackSaves[ iBackIndex ].sHeight);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void AllocateVideoOverlayArea( UINT32 uiCount )
|
||||
{
|
||||
UINT32 uiBufSize;
|
||||
@@ -1170,12 +1154,16 @@ void AllocateVideoOverlayArea( UINT32 uiCount )
|
||||
// Allocate
|
||||
if( ( gVideoOverlays[ uiCount ].pSaveArea = (INT16 *) MemAlloc( uiBufSize ) ) == NULL )
|
||||
{
|
||||
THROWEXCEPTION(L"Memory allocation failed");
|
||||
}
|
||||
BYTE* data = (BYTE*)gVideoOverlays[ uiCount ].pSaveArea;
|
||||
SurfaceData::SetApplicationData(data);
|
||||
g_SurfaceRectangle[SurfaceData::GetSurfaceID(data)].SetRect(
|
||||
gBackSaves[ iBackIndex ].sWidth,
|
||||
gBackSaves[ iBackIndex ].sHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SaveVideoOverlaysArea( UINT32 uiSrcBuffer )
|
||||
{
|
||||
UINT32 uiCount;
|
||||
@@ -1197,23 +1185,20 @@ void SaveVideoOverlaysArea( UINT32 uiSrcBuffer )
|
||||
|
||||
if ( gVideoOverlays[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
iBackIndex = gVideoOverlays[uiCount].uiBackground;
|
||||
iBackIndex = gVideoOverlays[uiCount].uiBackground;
|
||||
|
||||
// Save data from frame buffer!
|
||||
Blt16BPPTo16BPP((UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2,
|
||||
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop,
|
||||
gBackSaves[ iBackIndex ].sWidth, gBackSaves[ iBackIndex ].sHeight );
|
||||
// Save data from frame buffer!
|
||||
Blt16BPPTo16BPP((UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2,
|
||||
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop,
|
||||
gBackSaves[ iBackIndex ].sWidth, gBackSaves[ iBackIndex ].sHeight );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnLockVideoSurface( uiSrcBuffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SaveVideoOverlayArea( UINT32 uiSrcBuffer, UINT32 uiCount )
|
||||
{
|
||||
UINT32 iBackIndex;
|
||||
@@ -1233,22 +1218,19 @@ void SaveVideoOverlayArea( UINT32 uiSrcBuffer, UINT32 uiCount )
|
||||
if ( gVideoOverlays[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
|
||||
iBackIndex = gVideoOverlays[uiCount].uiBackground;
|
||||
iBackIndex = gVideoOverlays[uiCount].uiBackground;
|
||||
|
||||
// Save data from frame buffer!
|
||||
Blt16BPPTo16BPP((UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2,
|
||||
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop,
|
||||
gBackSaves[ iBackIndex ].sWidth, gBackSaves[ iBackIndex ].sHeight );
|
||||
// Save data from frame buffer!
|
||||
Blt16BPPTo16BPP((UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2,
|
||||
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
|
||||
0, 0,
|
||||
gBackSaves[ iBackIndex ].sLeft , gBackSaves[ iBackIndex ].sTop,
|
||||
gBackSaves[ iBackIndex ].sWidth, gBackSaves[ iBackIndex ].sHeight );
|
||||
}
|
||||
}
|
||||
|
||||
UnLockVideoSurface( uiSrcBuffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void DeleteVideoOverlaysArea( )
|
||||
{
|
||||
UINT32 uiCount;
|
||||
@@ -1259,6 +1241,7 @@ void DeleteVideoOverlaysArea( )
|
||||
{
|
||||
if ( gVideoOverlays[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
SurfaceData::ReleaseApplicationData((BYTE*)gVideoOverlays[ uiCount ].pSaveArea);
|
||||
MemFree( gVideoOverlays[uiCount].pSaveArea );
|
||||
}
|
||||
|
||||
@@ -1273,13 +1256,10 @@ void DeleteVideoOverlaysArea( )
|
||||
{
|
||||
RemoveVideoOverlay( uiCount );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY )
|
||||
{
|
||||
UINT32 uiCount, uiDestPitchBYTES;
|
||||
@@ -1288,9 +1268,9 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY )
|
||||
|
||||
INT32 ClipX1, ClipY1, ClipX2, ClipY2;
|
||||
INT32 uiLeftSkip, uiRightSkip, uiTopSkip, uiBottomSkip;
|
||||
UINT32 usHeight, usWidth;
|
||||
UINT32 usHeight, usWidth;
|
||||
INT32 iTempX, iTempY;
|
||||
INT16 sLeft, sTop, sRight, sBottom;
|
||||
INT16 sLeft, sTop, sRight, sBottom;
|
||||
|
||||
ClipX1= 0;
|
||||
ClipY1= gsVIEWPORT_WINDOW_START_Y;
|
||||
@@ -1306,7 +1286,6 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY )
|
||||
{
|
||||
iBackIndex = gVideoOverlays[uiCount].uiBackground;
|
||||
|
||||
|
||||
if ( gVideoOverlays[uiCount].pSaveArea != NULL )
|
||||
{
|
||||
// Get restore background values
|
||||
@@ -1317,7 +1296,6 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY )
|
||||
usHeight = gBackSaves[ iBackIndex ].sHeight;
|
||||
usWidth = gBackSaves[ iBackIndex ].sWidth;
|
||||
|
||||
|
||||
// Clip!!
|
||||
iTempX = sLeft + sShiftX;
|
||||
iTempY = sTop + sShiftY;
|
||||
@@ -1353,11 +1331,9 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY )
|
||||
sLeft, sTop,
|
||||
uiLeftSkip, uiTopSkip,
|
||||
usWidth, usHeight );
|
||||
|
||||
}
|
||||
else if(gbPixelDepth==8)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Once done, check for pending deletion
|
||||
@@ -1365,10 +1341,8 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY )
|
||||
{
|
||||
RemoveVideoOverlay( uiCount );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UnLockVideoSurface( BACKBUFFER );
|
||||
@@ -1409,10 +1383,8 @@ void BlitMFont( VIDEO_OVERLAY *pBlitter )
|
||||
mprintf_buffer( pDestBuf, uiDestPitchBYTES, pBlitter->uiFontID, pBlitter->sX, pBlitter->sY, pBlitter->zText );
|
||||
|
||||
UnLockVideoSurface( pBlitter->uiDestBuff );
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN BlitBufferToBuffer(UINT32 uiSrcBuffer, UINT32 uiDestBuffer, UINT16 usSrcX, UINT16 usSrcY, UINT16 usWidth, UINT16 usHeight)
|
||||
{
|
||||
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
|
||||
@@ -1433,14 +1405,12 @@ BOOLEAN BlitBufferToBuffer(UINT32 uiSrcBuffer, UINT32 uiDestBuffer, UINT16 usSrc
|
||||
return( fRetVal );
|
||||
}
|
||||
|
||||
|
||||
void EnableVideoOverlay( BOOLEAN fEnable, INT32 iOverlayIndex )
|
||||
{
|
||||
VIDEO_OVERLAY_DESC VideoOverlayDesc;
|
||||
|
||||
memset( &VideoOverlayDesc, 0, sizeof( VideoOverlayDesc ) );
|
||||
|
||||
|
||||
// enable or disable
|
||||
VideoOverlayDesc.fDisabled = !fEnable;
|
||||
|
||||
@@ -1448,5 +1418,5 @@ void EnableVideoOverlay( BOOLEAN fEnable, INT32 iOverlayIndex )
|
||||
VideoOverlayDesc.uiFlags = VOVERLAY_DESC_DISABLED;
|
||||
|
||||
UpdateVideoOverlay( &VideoOverlayDesc, iOverlayIndex, FALSE );
|
||||
|
||||
}
|
||||
|
||||
|
||||
+41
-3
@@ -16,6 +16,9 @@
|
||||
#include "wcheck.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
|
||||
//CONVERT_TO_16_BIT
|
||||
BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImageBuffer, UINT16 * pusNumberOfSubImages, UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 usHeight, UINT32 fFlags );
|
||||
|
||||
@@ -163,7 +166,7 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
|
||||
//
|
||||
// save file
|
||||
//
|
||||
|
||||
#ifndef USE_VFS
|
||||
pOutput = fopen( cOutputName, "wb" );
|
||||
if (pOutput == NULL )
|
||||
{
|
||||
@@ -171,6 +174,12 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
|
||||
}
|
||||
// write header
|
||||
fwrite( &Header, STCI_HEADER_SIZE, 1, pOutput );
|
||||
#else
|
||||
vfs::COpenWriteFile wfile(cOutputName,true,true);
|
||||
// write header
|
||||
vfs::UInt32 io;
|
||||
wfile.file().Write( (vfs::Byte*)&Header, STCI_HEADER_SIZE, io );
|
||||
#endif
|
||||
// write palette and subimage structs, if any
|
||||
if (Header.fFlags & STCI_INDEXED)
|
||||
{
|
||||
@@ -183,15 +192,24 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
|
||||
STCIPaletteEntry.ubRed = pSGPPaletteEntry[uiLoop].peRed;
|
||||
STCIPaletteEntry.ubGreen = pSGPPaletteEntry[uiLoop].peGreen;
|
||||
STCIPaletteEntry.ubBlue = pSGPPaletteEntry[uiLoop].peBlue;
|
||||
#ifndef USE_VFS
|
||||
fwrite( &STCIPaletteEntry, STCI_PALETTE_ELEMENT_SIZE, 1, pOutput );
|
||||
#else
|
||||
wfile.file().Write( (vfs::Byte*)&STCIPaletteEntry, STCI_PALETTE_ELEMENT_SIZE, io );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (Header.fFlags & STCI_ETRLE_COMPRESSED)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
fwrite( pSubImageBuffer, uiSubImageBufferSize, 1, pOutput );
|
||||
#else
|
||||
wfile.file().Write( (vfs::Byte*)pSubImageBuffer, uiSubImageBufferSize, io );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
// write file data
|
||||
if (Header.fFlags & STCI_ZLIB_COMPRESSED || Header.fFlags & STCI_ETRLE_COMPRESSED)
|
||||
{
|
||||
@@ -201,6 +219,17 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
|
||||
{
|
||||
fwrite( Image.pImageData, Header.uiStoredSize, 1, pOutput );
|
||||
}
|
||||
#else
|
||||
// write file data
|
||||
if (Header.fFlags & STCI_ZLIB_COMPRESSED || Header.fFlags & STCI_ETRLE_COMPRESSED)
|
||||
{
|
||||
wfile.file().Write( (vfs::Byte*)pOutputBuffer, Header.uiStoredSize, io );
|
||||
}
|
||||
else
|
||||
{
|
||||
wfile.file().Write( (vfs::Byte*)Image.pImageData, Header.uiStoredSize, io );
|
||||
}
|
||||
#endif
|
||||
|
||||
// write app-specific data (blanked to 0)
|
||||
if (Image.pAppData == NULL )
|
||||
@@ -209,22 +238,31 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
|
||||
{
|
||||
for (uiLoop = 0; uiLoop < Header.uiAppDataSize; uiLoop++)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
fputc( 0, pOutput );
|
||||
#else
|
||||
vfs::Byte c = 0;
|
||||
wfile.file().Write( &c, sizeof(c), io );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
fwrite( Image.pAppData, Header.uiAppDataSize, 1, pOutput );
|
||||
#else
|
||||
wfile.file().Write( (vfs::Byte*)Image.pAppData, Header.uiAppDataSize, io );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
fclose( pOutput );
|
||||
|
||||
if( pOutputBuffer != NULL )
|
||||
{
|
||||
MemFree( pOutputBuffer );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "vfs_memory_file.h"
|
||||
#include "vfs_file_raii.h"
|
||||
#include "../vfs_file_raii.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _VFS_7Z_LIBRARY_H_
|
||||
|
||||
#include "vfs_uncompressed_lib_base.h"
|
||||
#include "File/vfs_lib_file.h"
|
||||
#include "../File/vfs_lib_file.h"
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
|
||||
@@ -269,6 +269,9 @@ CTransferRules::EAction CTransferRules::ApplyRule(utf8string const& sStr)
|
||||
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
#ifdef USE_CODE_PAGE
|
||||
|
||||
typedef vfs::UInt16 UINT16;
|
||||
extern UINT16 gsKeyTranslationTable[1024];
|
||||
|
||||
@@ -469,5 +472,7 @@ void charSet::InitializeCharSets()
|
||||
charSet::AddToCharSet(charSet::CS_SPECIAL_NON_CHAR, L"~*+-_.,:;'´`#°^!\"§$%&/()=?\\{}[]");
|
||||
}
|
||||
|
||||
#endif // USE_CODE_PAGE
|
||||
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
@@ -77,8 +77,9 @@ private:
|
||||
/**************************************************************/
|
||||
/**************************************************************/
|
||||
|
||||
#define USE_CODE_PAGE
|
||||
//#define USE_CODE_PAGE
|
||||
|
||||
#ifdef USE_CODE_PAGE
|
||||
class CodePageReader
|
||||
{
|
||||
public:
|
||||
@@ -117,6 +118,7 @@ namespace charSet
|
||||
|
||||
void InitializeCharSets();
|
||||
};
|
||||
#endif // USE_CODE_PAGE
|
||||
|
||||
#endif // _PARSER_TOOLS_H_
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// This class reads the contents of a directory file-by-file
|
||||
//
|
||||
#include "iteratedir.h"
|
||||
#include "VFS/vfs_debug.h"
|
||||
#include "vfs_debug.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "utf8string.h"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "utf8.h"
|
||||
#include <vector>
|
||||
|
||||
#include <vfs_debug.h>
|
||||
#include "vfs_debug.h"
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace _StrCmp
|
||||
|
||||
+5
-5
@@ -551,15 +551,15 @@ bool vfs::CVirtualFileSystem::CreateNewFile(vfs::Path const& sFileName)
|
||||
}
|
||||
// see if the closest match is exclusive
|
||||
// if yes, then the the new path is a subdirectory and has to be exclusive too
|
||||
vfs::CVirtualLocation *pVLoc = this->GetVirtualLocation(sLeft);
|
||||
vfs::CVirtualLocation *pVLoc = this->GetVirtualLocation(sLeft,true);
|
||||
if(pVLoc)
|
||||
{
|
||||
bIsExclusive = pVLoc->GetIsExclusive();
|
||||
}
|
||||
else
|
||||
{
|
||||
THROWEXCEPTION(L"location (closest match) should exist");
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// THROWEXCEPTION(L"location (closest match) should exist");
|
||||
//}
|
||||
bNewLocation = true;
|
||||
}
|
||||
if(pProfLoc && pProfLoc->IsWriteable())
|
||||
|
||||
@@ -93,7 +93,7 @@ vfs::COpenWriteFile::COpenWriteFile(vfs::tWriteableFile *pFile)
|
||||
{
|
||||
m_pFile = pFile;
|
||||
THROWIFFALSE(m_pFile, L"no file");
|
||||
THROWIFFALSE(m_pFile->OpenWrite(true,false), L"not open");
|
||||
THROWIFFALSE(m_pFile->OpenWrite(true,false), (L"File not open : " + m_pFile->GetFullPath()().c_wcs()).c_str());
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
{
|
||||
|
||||
+37
-28
@@ -10,6 +10,12 @@
|
||||
#include "PropertyContainer.h"
|
||||
#include "Tools/Log.h"
|
||||
|
||||
//#define LOG_VFS_INITIALIZATION
|
||||
#ifdef LOG_VFS_INITIALIZATION
|
||||
#define LOG(x) (x)
|
||||
#else
|
||||
#define LOG(x)
|
||||
#endif
|
||||
/********************************************************************/
|
||||
/********************************************************************/
|
||||
|
||||
@@ -27,61 +33,64 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
{
|
||||
oVFSProps.InitFromIniFile(*clit);
|
||||
}
|
||||
|
||||
CLog _LOG(vfs::Path(L"vfs_init.log"));
|
||||
return InitVirtualFileSystem(oVFSProps);
|
||||
}
|
||||
bool InitVirtualFileSystem(CPropertyContainer& oVFSProps)
|
||||
{
|
||||
LOG(CLog _LOG(vfs::Path(L"vfs_init.log")));
|
||||
|
||||
vfs::CVirtualFileSystem *pVirtFileSys = GetVFS();
|
||||
|
||||
_LOG << "Initializing Virtual File System";
|
||||
_LOG.Endl();
|
||||
LOG(_LOG << "Initializing Virtual File System");
|
||||
LOG(_LOG.Endl());
|
||||
|
||||
_LOG.Endl() << "reading profiles .. ";
|
||||
LOG(_LOG.Endl() << "reading profiles .. ");
|
||||
std::list<utf8string> lProfiles, lLocSections;
|
||||
oVFSProps.GetStringListProperty(L"vfs_config",L"PROFILES",lProfiles,L"");
|
||||
if(lProfiles.empty())
|
||||
{
|
||||
_LOG << " ERROR";
|
||||
LOG(_LOG << " ERROR");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << " OK";
|
||||
LOG(_LOG << " OK");
|
||||
}
|
||||
_LOG.Endl() << " profiles to read : ";
|
||||
LOG(_LOG.Endl() << " profiles to read : ");
|
||||
std::list<utf8string>::const_iterator cit_profiles = lProfiles.begin();
|
||||
for(; cit_profiles != lProfiles.end(); ++cit_profiles)
|
||||
{
|
||||
_LOG << (*cit_profiles) << ", ";
|
||||
LOG(_LOG << (*cit_profiles) << ", ");
|
||||
}
|
||||
_LOG.Endl();
|
||||
LOG(_LOG.Endl());
|
||||
|
||||
std::list<utf8string>::const_iterator prof_cit = lProfiles.begin();
|
||||
for(; prof_cit != lProfiles.end(); ++prof_cit)
|
||||
{
|
||||
_LOG.Endl() << " reading profile [";
|
||||
LOG(_LOG.Endl() << " reading profile [");
|
||||
utf8string sProfSection = utf8string("PROFILE_") + utf8string(*prof_cit);
|
||||
utf8string sProfName = oVFSProps.GetStringProperty(sProfSection,L"NAME",L"");
|
||||
_LOG << sProfName << "] .. ";
|
||||
LOG(_LOG << sProfName << "] .. ");
|
||||
|
||||
vfs::Path profileRoot = oVFSProps.GetStringProperty(sProfSection,L"PROFILE_ROOT",L"");
|
||||
|
||||
lLocSections.clear();
|
||||
oVFSProps.GetStringListProperty(sProfSection,L"LOCATIONS",lLocSections,L"");
|
||||
|
||||
_LOG << "OK";
|
||||
_LOG.Endl() << " locations to read : ";
|
||||
LOG(_LOG << "OK");
|
||||
LOG(_LOG.Endl() << " locations to read : ");
|
||||
std::list<utf8string>::const_iterator cit_locations = lLocSections.begin();
|
||||
for(; cit_locations != lLocSections.end(); ++cit_locations)
|
||||
{
|
||||
_LOG << (*cit_locations) << ", ";
|
||||
LOG(_LOG << (*cit_locations) << ", ");
|
||||
}
|
||||
_LOG.Endl().Endl();
|
||||
LOG(_LOG.Endl().Endl());
|
||||
|
||||
std::list<utf8string>::iterator loc_it = lLocSections.begin();
|
||||
bool bIsWriteable = oVFSProps.GetBoolProperty(sProfSection,L"WRITE",false);
|
||||
for(; loc_it != lLocSections.end(); ++loc_it)
|
||||
{
|
||||
_LOG << " reading location [ ";
|
||||
LOG(_LOG << " reading location [ ");
|
||||
utf8string sLocSection = utf8string("LOC_") + utf8string(*loc_it);
|
||||
vfs::Path sLocPath, sLocMountPoint;
|
||||
utf8string sLocType;
|
||||
@@ -92,7 +101,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
bool bOptional = oVFSProps.GetBoolProperty(sLocSection,L"OPTIONAL",false);
|
||||
if(StrCmp::Equal(sLocType,L"LIBRARY"))
|
||||
{
|
||||
_LOG << sLocType << " | " << (*loc_it) << " ] .. ";
|
||||
LOG(_LOG << sLocType << " | " << (*loc_it) << " ] .. ");
|
||||
vfs::tReadableFile *pLibFile = NULL;
|
||||
bool bOwnFile = false;
|
||||
if(!sLocPath.empty())
|
||||
@@ -123,7 +132,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
utf8string::str_t s = L"File [" + utf8string(sLocPath()).c_wcs() + L"] in not an SLF or 7z library";
|
||||
THROWEXCEPTION(s.c_str());
|
||||
return false;
|
||||
@@ -132,7 +141,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
{
|
||||
if(!bOptional)
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
//std::cout << "ERROR : library initialization failed [ " << full_str << " ]" << std::endl;
|
||||
std::wstring s = L"Could not initialize library [ " + sLocPath().c_wcs()
|
||||
+ L" ] in : profile [ " + utf8string(sProfName).c_wcs()
|
||||
@@ -141,27 +150,27 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
THROWEXCEPTION(s.c_str());
|
||||
return false;
|
||||
}
|
||||
_LOG << "optional library ignored" << CLog::endl;
|
||||
LOG(_LOG << "optional library ignored" << CLog::endl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "OK" << CLog::endl;
|
||||
LOG(_LOG << "OK" << CLog::endl);
|
||||
}
|
||||
pVirtFileSys->AddLocation(vfs::tReadLocation::Cast(pLib), sProfName, bIsWriteable);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
THROWEXCEPTION(L"File not found");
|
||||
}
|
||||
}
|
||||
else if(StrCmp::Equal(sLocType,L"DIRECTORY"))
|
||||
{
|
||||
_LOG << sLocType << " | " << (*loc_it) << " ] .. ";
|
||||
LOG(_LOG << sLocType << " | " << (*loc_it) << " ] .. ");
|
||||
vfs::CDirectoryTree *pDirTree = new vfs::CDirectoryTree(sLocMountPoint,profileRoot + sLocPath);
|
||||
if(!pDirTree->Init())
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
std::wstring s = L"Could not initialize directory [\"" + sLocPath().c_wcs()
|
||||
+ L"\"] in : profile [\"" + utf8string(sProfName).c_wcs()
|
||||
+ L"\"], location [\"" + (*loc_it).c_wcs()
|
||||
@@ -170,11 +179,11 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
return false;
|
||||
}
|
||||
pVirtFileSys->AddLocation(vfs::tReadLocation::Cast(pDirTree),sProfName,bIsWriteable);
|
||||
_LOG << "OK" << CLog::endl;
|
||||
LOG(_LOG << "OK" << CLog::endl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "]" << CLog::endl;
|
||||
LOG(_LOG << "]" << CLog::endl);
|
||||
}
|
||||
//else if( sLocType == "NOT_FOUND")
|
||||
//{
|
||||
@@ -201,7 +210,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
InitWriteProfile(*pProf, profileRoot);
|
||||
}
|
||||
}
|
||||
_LOG.Endl() << "VFS successfully initialized" << CLog::endl;
|
||||
LOG(_LOG.Endl() << "VFS successfully initialized" << CLog::endl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include "vfs_types.h"
|
||||
#include "vfs_profile.h"
|
||||
#include "PropertyContainer.h"
|
||||
|
||||
bool InitWriteProfile(vfs::CVirtualProfile &rProf, vfs::Path const& profileRoot);
|
||||
bool InitVirtualFileSystem(vfs::Path const& vfs_ini);
|
||||
bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list);
|
||||
bool InitVirtualFileSystem(CPropertyContainer& props);
|
||||
|
||||
#endif // _VFS_INIT_H_
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="\games\jagged alliance 2"
|
||||
OutputDirectory="D:\misc\1.13\JA2 - EN"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets=".\ja2_2005Express.vsprops;.\ja2_2005ExpressDebug.vsprops"
|
||||
@@ -229,7 +229,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)\MapEditor_EN_2996.exe"
|
||||
OutputFile="$(OutDir)\MapEditor_EN_3023.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
GenerateMapFile="true"
|
||||
|
||||
+4
-1
@@ -1118,7 +1118,10 @@ void PrintExceptionList()
|
||||
ClipRect.iTop = 0;
|
||||
ClipRect.iBottom = SCREEN_HEIGHT;
|
||||
|
||||
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
|
||||
if( !(pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ) ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
//Blt16BPPBufferShadowRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect );
|
||||
Blt16BPPBufferHatchRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect );
|
||||
UnLockVideoSurface( FRAME_BUFFER );
|
||||
|
||||
Reference in New Issue
Block a user