**********************************************************

** Big Maps Projects code (incl. Multiplayer v1.5 **
**********************************************************
- Merged Big Maps Project code from BMP+MP trunk (Revision: 3340)
o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- Before THIS merge, I made a branch of the existing 1.13 source
o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src
- Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago
- I will add VS 2010 projects and solution file in the next few days

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2010-02-28 18:38:52 +00:00
parent a98c44ac78
commit 14750c6903
461 changed files with 23615 additions and 120157 deletions
+144 -83
View File
@@ -51,6 +51,8 @@
using namespace std;
#include "VFS/vfs.h"
#include "VFS/os_functions.h"
#include "VFS/vfs_settings.h"
#ifdef USE_VFS
@@ -256,7 +258,7 @@ void FileDebug( BOOLEAN f )
BOOLEAN FileExists( STR strFilename )
{
#ifdef USE_VFS
return GetVFS()->FileExists(vfs::Path(strFilename));
return getVFS()->fileExists(vfs::Path(strFilename));
#else
// First check to see if it's in a library (most files should be there)
if ( gFileDataBase.fInitialized &&
@@ -302,7 +304,7 @@ BOOLEAN FileExists( STR strFilename )
extern BOOLEAN FileExistsNoDB( STR strFilename )
{
#ifdef USE_VFS
return GetVFS()->FileExists(vfs::Path(strFilename));
return getVFS()->fileExists(vfs::Path(strFilename));
#else
// First check if it's in the custom Data directory
if ( gCustomDataCat.FindFile(strFilename) ) return TRUE;
@@ -342,7 +344,7 @@ extern BOOLEAN FileExistsNoDB( STR strFilename )
BOOLEAN FileDelete( STR strFilename )
{
#ifdef USE_VFS
return GetVFS()->RemoveFileFromFS(vfs::Path(strFilename));
return getVFS()->removeFileFromFS(vfs::Path(strFilename));
#else
// Snap: delete the file from the default Data catalogue (if it is there)
// Since the path can be either relative or absolute, try both methods
@@ -388,9 +390,9 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
if(uiOptions & FILE_ACCESS_WRITE)
{
// 'vfs::CVirtualFile::SF_TOP' should be enough, but if for some strange reason
// file creation fails, we will stop at a writeable profile
// file creation fails, we will stop at a writable profile
// and won't unintentionally mess up a file from another profile
vfs::COpenWriteFile open_w( path, true, false, vfs::CVirtualFile::SF_STOP_ON_WRITEABLE_PROFILE);
vfs::COpenWriteFile open_w( path, true, false, vfs::CVirtualFile::SF_STOP_ON_WRITABLE_PROFILE);
pFile = &open_w.file();
open_w.release();
s_mapFiles[pFile].op = SOperation::WRITE;
@@ -408,10 +410,10 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
// sometimes a file is supposed to opened that does not exist (not tested with FileExists())
// this operation can fail with an exception that the calling code doesn't catch
// instead we catch it (any exception, not just CBasicException) here and return 0
catch(CBasicException& ex) { LogException(ex); }
catch(CBasicException& ex) { logException(ex); }
catch(...)
{
LogException( CBasicException("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__) );
logException( CBasicException("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__) );
}
return 0;
#else
@@ -584,7 +586,7 @@ void FileClose( HWFILE hFile )
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
if(pFile)
{
pFile->Close();
pFile->close();
s_mapFiles.erase(pFile);
}
#else
@@ -650,24 +652,45 @@ void FileClose( HWFILE hFile )
extern UINT32 uiTotalFileReadTime;
extern UINT32 uiTotalFileReadCalls;
#include "Timer Control.h"
#endif
class TimeCounter
{
public:
TimeCounter() : start_time(GetJA2Clock()) {}
~TimeCounter()
{
uiTotalFileReadTime += GetJA2Clock() - start_time;
uiTotalFileReadCalls++;
}
private:
UINT32 start_time;
};
#endif
BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead )
{
#ifdef USE_VFS
#ifdef JA2TESTVERSION
UINT32 uiStartTime = GetJA2Clock();
TimeCounter timer;
#endif
bool bSuccess = false;
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
if(pFile && (s_mapFiles[pFile].op == SOperation::READ))
{
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
vfs::tReadableFile *pRF = vfs::tReadableFile::cast(pFile);
if(pRF)
{
UINT32 uiBytesRead;
bSuccess = pRF->Read((vfs::Byte*)pDest, uiBytesToRead, uiBytesRead);
try
{
uiBytesRead = pRF->read((vfs::Byte*)pDest, uiBytesToRead);
}
catch(CBasicException& ex)
{
pRF->close();
RETHROWEXCEPTION(L"", &ex);
}
if(uiBytesToRead != uiBytesRead)
{
return FALSE;
@@ -676,14 +699,10 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
{
*puiBytesRead = uiBytesRead;
}
return TRUE;
}
}
#ifdef JA2TESTVERSION
//Add the time that we spent in this function to the total.
uiTotalFileReadTime += GetJA2Clock() - uiStartTime;
uiTotalFileReadCalls++;
#endif
return bSuccess;
return FALSE;
#else
HANDLE hRealFile;
DWORD dwNumBytesToRead, dwNumBytesRead;
@@ -785,14 +804,27 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten )
{
#ifdef USE_VFS
if(uiBytesToWrite == 0)//dnl ch38 110909
{
*puiBytesWritten = 0;
return(TRUE);
}
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
if(pFile && (s_mapFiles[pFile].op == SOperation::WRITE))
{
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
vfs::tWritableFile *pWF = vfs::tWritableFile::cast(pFile);
if(pWF)
{
UINT32 uiBytesWritten;
bool bSuccess = pWF->Write((vfs::Byte*)pDest, uiBytesToWrite, uiBytesWritten);
try
{
uiBytesWritten = pWF->write((vfs::Byte*)pDest, uiBytesToWrite);
}
catch(CBasicException& ex)
{
pWF->close();
RETHROWEXCEPTION(L"", &ex);
}
if (uiBytesToWrite != uiBytesWritten)
{
@@ -802,7 +834,7 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy
{
*puiBytesWritten = uiBytesWritten;
}
return bSuccess;
return TRUE;
}
}
return FALSE;
@@ -868,12 +900,12 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy
BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead )
{
#ifdef USE_VFS
vfs::tReadableFile *pFile = GetVFS()->GetRFile(vfs::Path(strFilename));
vfs::tReadableFile *pFile = getVFS()->getReadFile(vfs::Path(strFilename));
vfs::COpenReadFile rfile(pFile);
if(pFile)
{
UINT32 uiNumBytesRead;
bool bSuccess = pFile->Read((vfs::Byte*)pDest,uiBytesToRead, uiNumBytesRead);
pFile->Close();
UINT32 uiNumBytesRead;
TRYCATCH_RETHROW(uiNumBytesRead = pFile->read((vfs::Byte*)pDest,uiBytesToRead), L"");
if (uiBytesToRead != uiNumBytesRead)
{
@@ -884,7 +916,7 @@ BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiB
*puiBytesRead = uiNumBytesRead;
}
CHECKF( uiNumBytesRead == uiBytesToRead );
return bSuccess;
return TRUE;
}
return FALSE;
#else
@@ -1038,18 +1070,20 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
if(s_mapFiles[pFile].op == SOperation::WRITE)
{
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
vfs::tWritableFile *pWF = vfs::tWritableFile::cast(pFile);
if(pWF)
{
return pWF->SetWriteLocation(iDistance, eSD);
TRYCATCH_RETHROW(pWF->setWritePosition(iDistance, eSD), L"");
return TRUE;
}
}
else if(s_mapFiles[pFile].op == SOperation::READ)
{
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
vfs::tReadableFile *pRF = vfs::tReadableFile::cast(pFile);
if(pRF)
{
return pRF->SetReadLocation(iDistance, eSD);
TRYCATCH_RETHROW(pRF->setReadPosition(iDistance, eSD), L"");
return TRUE;
}
}
else
@@ -1131,23 +1165,20 @@ INT32 FileGetPos( HWFILE hFile )
{
#ifdef USE_VFS
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
if(pFile)
if(pFile && (s_mapFiles[pFile].op == SOperation::WRITE))
{
if(pFile->IsWriteable())
vfs::tWritableFile *pWF = vfs::tWritableFile::cast(pFile);
if(pWF)
{
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
if(pWF)
{
return pWF->GetWriteLocation();
}
return pWF->getWritePosition();
}
else if(pFile->IsReadable())
}
else if(pFile && (s_mapFiles[pFile].op == SOperation::READ))
{
vfs::tReadableFile *pRF = vfs::tReadableFile::cast(pFile);
if(pRF)
{
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
if(pRF)
{
return pRF->GetReadLocation();
}
return pRF->getReadPosition();
}
}
@@ -1221,7 +1252,7 @@ UINT32 FileGetSize( HWFILE hFile )
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
if(pFile)
{
return pFile->GetFileSize();
return pFile->getSize();
}
return 0;
#else
@@ -1568,17 +1599,45 @@ INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_F
BOOLEAN SetFileManCurrentDirectory( STR pcDirectory )
{
#ifndef USE_VFS
return( SetCurrentDirectory( pcDirectory ) );
#else
try
{
os::setCurrectDirectory(pcDirectory);
}
catch(CBasicException& ex)
{
logException(ex);
return FALSE;
}
return TRUE;
#endif
}
BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory )
{
#ifndef USE_VFS
if (GetCurrentDirectory( 512, pcDirectory ) == 0)
{
return( FALSE );
}
return( TRUE );
#else
try
{
vfs::Path sDir;
os::getCurrentDirectory(sDir);
strncpy(pcDirectory, sDir.to_string().c_str(), 512);
}
catch(CBasicException& ex)
{
logException(ex);
return FALSE;
}
return TRUE;
#endif
}
@@ -1631,7 +1690,7 @@ BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive )
{
#ifdef USE_VFS
// ignore 'recursive' flag, just delete every file in that subtree (but leave the directories)
return GetVFS()->RemoveDirectoryFromFS(pcDirectory);
return getVFS()->removeDirectoryFromFS(pcDirectory);
#else
WIN32_FIND_DATA sFindData;
HANDLE SearchHandle;
@@ -1721,7 +1780,7 @@ BOOLEAN EraseDirectory( STRING512 pcDirectory)
{
#ifdef USE_VFS
// ignore 'recursive' flag, just delete every file in that subtree (but leave the directories)
return GetVFS()->RemoveDirectoryFromFS(pcDirectory);
return getVFS()->removeDirectoryFromFS(pcDirectory);
#else
WIN32_FIND_DATA sFindData;
HANDLE SearchHandle;
@@ -1780,6 +1839,12 @@ BOOLEAN EraseDirectory( STRING512 pcDirectory)
BOOLEAN GetExecutableDirectory( STRING512 pcDirectory )
{
#ifdef USE_VFS
vfs::Path exe_dir, exe_file;
os::getExecutablePath(exe_dir, exe_file);
strncpy(pcDirectory, exe_dir.to_string().c_str(), 512);
return true;
#else
SGPFILENAME ModuleFilename;
UINT32 cnt;
@@ -1799,7 +1864,7 @@ BOOLEAN GetExecutableDirectory( STRING512 pcDirectory )
break;
}
}
#endif
return( TRUE );
}
@@ -1812,20 +1877,19 @@ BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct )
CHECKF( pSpec != NULL );
CHECKF( pGFStruct != NULL );
file_iter = GetVFS()->begin(pSpec);
file_iter = getVFS()->begin(pSpec);
if(!file_iter.end())
{
//vfs::Path const& path = file_iter.value()->GetFullPath();
vfs::Path const& path = file_iter.value()->GetFileName();
std::string s = path().utf8();
utf8string::size_t size = s.length();
size = std::min<unsigned int>(size,260-1);
vfs::Path const& path = file_iter.value()->getName();
std::string s = path.to_string();
::size_t size = s.length();
size = std::min< ::size_t>(size,260-1);
sprintf( pGFStruct->zFileName, s.c_str());
pGFStruct->zFileName[size] = 0;
pGFStruct->iFindHandle = 0;
pGFStruct->uiFileSize = file_iter.value()->GetFileSize();
pGFStruct->uiFileAttribs = ( file_iter.value()->IsWriteable() ? FILE_IS_NORMAL : FILE_IS_READONLY );
pGFStruct->uiFileSize = file_iter.value()->getSize();
pGFStruct->uiFileAttribs = ( file_iter.value()->implementsWritable() ? FILE_IS_NORMAL : FILE_IS_READONLY );
return TRUE;
}
@@ -1873,17 +1937,16 @@ BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct )
}
if(!file_iter.end())
{
//vfs::Path const& path = file_iter.value()->GetFullPath();
vfs::Path const& path = file_iter.value()->GetFileName();
std::string s = path().utf8();
utf8string::size_t size = s.length();
size = std::min<unsigned int>(size,260-1);
vfs::Path const& path = file_iter.value()->getName();
std::string s = path.to_string();
::size_t size = s.length();
size = std::min< ::size_t>(size,260-1);
sprintf( pGFStruct->zFileName, s.c_str());
pGFStruct->zFileName[size] = 0;
pGFStruct->iFindHandle = 0;
pGFStruct->uiFileSize = file_iter.value()->GetFileSize();
pGFStruct->uiFileAttribs = ( file_iter.value()->IsWriteable() ? FILE_IS_NORMAL : FILE_IS_READONLY );
pGFStruct->uiFileSize = file_iter.value()->getSize();
pGFStruct->uiFileAttribs = ( file_iter.value()->implementsWritable() ? FILE_IS_NORMAL : FILE_IS_READONLY );
return TRUE;
}
@@ -2142,29 +2205,27 @@ BOOLEAN FileClearAttributes( STR strFilename )
BOOLEAN FileCheckEndOfFile( HWFILE hFile )
{
#ifdef USE_VFS
UINT32 uiCurrentLocation, uiMaxLocation;
vfs::size_t current_position, max_position;
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
if(pFile)
if(pFile && (s_mapFiles[pFile].op == SOperation::WRITE))
{
if(pFile->IsWriteable())
vfs::tWritableFile *pWF = vfs::tWritableFile::cast(pFile);
if(pWF)
{
vfs::tWriteableFile *pWF = vfs::tWriteableFile::Cast(pFile);
if(pWF)
{
uiCurrentLocation = pWF->GetWriteLocation();
uiMaxLocation = pWF->GetFileSize();
return uiCurrentLocation < uiMaxLocation;
}
current_position = pWF->getWritePosition();
max_position = pWF->getSize();
return current_position < max_position;
}
else if(pFile->IsReadable())
}
else if(pFile && (s_mapFiles[pFile].op == SOperation::READ))
{
vfs::tReadableFile *pRF = vfs::tReadableFile::cast(pFile);
if(pRF)
{
vfs::tReadableFile *pRF = vfs::tReadableFile::Cast(pFile);
if(pRF)
{
uiCurrentLocation = pRF->GetReadLocation();
uiMaxLocation = pRF->GetFileSize();
return uiCurrentLocation < uiMaxLocation;
}
current_position = pRF->getReadPosition();
max_position = pRF->getSize();
return current_position < max_position;
}
}
return FALSE;
@@ -2306,10 +2367,10 @@ INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFi
UINT32 FileSize(STR strFilename)
{
#ifdef USE_VFS
vfs::IBaseFile *pFile = GetVFS()->GetFile(vfs::Path(strFilename));
vfs::IBaseFile *pFile = getVFS()->getFile(vfs::Path(strFilename));
if(pFile)
{
return pFile->GetFileSize();
return pFile->getSize();
}
return 0;
#else
+9 -9
View File
@@ -232,15 +232,15 @@ void ShutdownMemoryManager( void )
fclose( fp );
#else
CLog memLeak( L"MemLeakInfo.txt", true);
memLeak.Endl().Endl();
memLeak << ">>>>> MEMORY LEAK DETECTED!!! <<<<<" << CLog::endl;
memLeak << " " << guiMemAlloced << " bytes memory total was allocated" << CLog::endl;
memLeak << "- " << guiMemFreed << " bytes memory total was freed" << CLog::endl;
memLeak << "_______________________________________________" << CLog::endl;
memLeak << guiMemTotal << " bytes memory total STILL allocated" << CLog::endl;
memLeak << MemDebugCounter << " memory blocks still allocated" << CLog::endl;
memLeak << "guiScreenExitedFrom = " << gzJA2ScreenNames[ gMsgBox.uiExitScreen ] << CLog::endl;
memLeak.Endl().Endl();
memLeak.endl().endl();
memLeak << ">>>>> MEMORY LEAK DETECTED!!! <<<<<" << CLog::ENDL;
memLeak << " " << guiMemAlloced << " bytes memory total was allocated" << CLog::ENDL;
memLeak << "- " << guiMemFreed << " bytes memory total was freed" << CLog::ENDL;
memLeak << "_______________________________________________" << CLog::ENDL;
memLeak << guiMemTotal << " bytes memory total STILL allocated" << CLog::ENDL;
memLeak << MemDebugCounter << " memory blocks still allocated" << CLog::ENDL;
memLeak << "guiScreenExitedFrom = " << gzJA2ScreenNames[ gMsgBox.uiExitScreen ] << CLog::ENDL;
memLeak.endl().endl();
#endif
}
#endif
+71 -78
View File
@@ -26,8 +26,8 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
void user_read_data(png::png_structp png_ptr, png::png_bytep data, png::png_size_t length)
{
vfs::UInt32 read;
THROWIFFALSE( static_cast<vfs::tReadableFile*>(png_ptr->io_ptr)->Read((vfs::Byte*)data,length, read),"error during png file reading");
TRYCATCH_RETHROW( static_cast<vfs::tReadableFile*>(png_ptr->io_ptr)->read((vfs::Byte*)data,length),
L"error during png file reading");
}
/*******************************************************************************/
@@ -39,22 +39,22 @@ public:
IndexedSTIImage();
~IndexedSTIImage();
bool SetPalette(SGPPaletteEntry *pPal, int iSize);
bool SetPalette(png::png_colorp pPal, int iSize);
bool AddImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y, UINT8 *original_compressed=NULL, UINT32 original_compressed_size=0);
bool setPalette(SGPPaletteEntry *pPal, int iSize);
bool setPalette(png::png_colorp pPal, int iSize);
bool addImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y, UINT8 *original_compressed=NULL, UINT32 original_compressed_size=0);
bool AddCompressedImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y);
bool addCompressedImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y);
bool ReadAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile* pFile);
bool readAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile* pFile);
bool WriteImage(vfs::tWriteableFile* pFile);
bool WriteToHIMAGE(HIMAGE pImage);
bool writeImage(vfs::tWritableFile* pFile);
bool writeToHIMAGE(HIMAGE pImage);
private:
STCIHeader _header;
STCIPaletteElement *_palette;
int _pal_size;
std::vector<STCISubImage> _images;
std::vector<std::vector<UINT8> > _compressed_images;
STCIHeader _header;
STCIPaletteElement* _palette;
int _pal_size;
std::vector<STCISubImage> _images;
std::vector<std::vector<UINT8> > _compressed_images;
};
IndexedSTIImage::IndexedSTIImage()
@@ -75,7 +75,7 @@ IndexedSTIImage::~IndexedSTIImage()
}
}
bool IndexedSTIImage::SetPalette(SGPPaletteEntry *pPal, int iSize)
bool IndexedSTIImage::setPalette(SGPPaletteEntry *pPal, int iSize)
{
if(iSize < 0 ||iSize > 1024)
{
@@ -92,7 +92,7 @@ bool IndexedSTIImage::SetPalette(SGPPaletteEntry *pPal, int iSize)
return true;
}
bool IndexedSTIImage::SetPalette(png::png_colorp pPal, int iSize)
bool IndexedSTIImage::setPalette(png::png_colorp pPal, int iSize)
{
if(iSize < 0 ||iSize > 1024)
{
@@ -109,7 +109,7 @@ bool IndexedSTIImage::SetPalette(png::png_colorp pPal, int iSize)
return true;
}
bool IndexedSTIImage::AddCompressedImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y)
bool IndexedSTIImage::addCompressedImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y)
{
if(!data || (data_size < 0) )
{
@@ -135,7 +135,7 @@ bool IndexedSTIImage::AddCompressedImage(UINT8 *data, UINT32 data_size, UINT32 i
}
bool IndexedSTIImage::AddImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y, UINT8 *original_compressed, UINT32 original_compressed_size)
bool IndexedSTIImage::addImage(UINT8 *data, UINT32 data_size, UINT32 image_width, UINT32 image_height, INT32 image_offset_x, INT32 image_offset_y, UINT8 *original_compressed, UINT32 original_compressed_size)
{
if(!data || (data_size != image_width*image_height) )
{
@@ -236,7 +236,7 @@ bool IndexedSTIImage::AddImage(UINT8 *data, UINT32 data_size, UINT32 image_width
inline void SetFlag(UINT8 &flags, char const* sFlag)
static inline void setFlag(UINT8 &flags, char const* sFlag)
{
/*0x01*/ if (strcmp(sFlag, "AUX_FULL_TILE") == 0) flags |= AUX_FULL_TILE;
/*0x02*/ else if(strcmp(sFlag, "AUX_ANIMATED_TILE") == 0) flags |= AUX_ANIMATED_TILE;
@@ -274,11 +274,11 @@ public:
}
virtual ~CAppDataParser() {};
virtual void OnStartElement(const XML_Char* name, const XML_Char** atts);
virtual void OnEndElement(const XML_Char* name);
virtual void OnTextElement(const XML_Char *str, int len);
virtual void onStartElement(const XML_Char* name, const XML_Char** atts);
virtual void onEndElement(const XML_Char* name);
virtual void onTextElement(const XML_Char *str, int len);
void SetImage(HIMAGE hImage)
void setImage(HIMAGE hImage)
{
m_hImage = hImage;
if(m_hImage)
@@ -307,7 +307,7 @@ private:
int m_iCurrentIndex;
};
void CAppDataParser::OnStartElement(const XML_Char* name, const XML_Char** atts)
void CAppDataParser::onStartElement(const XML_Char* name, const XML_Char** atts)
{
if( current_state == DO_ELEMENT_NONE && strcmp(name, this->ElementName) == 0 )
{
@@ -316,7 +316,7 @@ void CAppDataParser::OnStartElement(const XML_Char* name, const XML_Char** atts)
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\"");
THROWIFFALSE(getAttributeAsInt("index",atts,index), L"could not read attribute \"index\"");
m_iCurrentIndex = index;
if(index >= (int)m_vAppData.size())
{
@@ -327,12 +327,12 @@ void CAppDataParser::OnStartElement(const XML_Char* name, const XML_Char** atts)
else if(current_state == DO_ELEMENT_SubImage && strcmp(name, "offset") == 0)
{
int offset_x = 0, offset_y = 0;
if(GetAttributeAsInt("x",atts,offset_x))
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))
if(getAttributeAsInt("y",atts,offset_y))
{
m_vAppData[m_iCurrentIndex].offset.y = offset_y;
m_vAppData[m_iCurrentIndex].offset._override = true;
@@ -349,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_iCurrentIndex].aux.fFlags, name);
setFlag(m_vAppData[m_iCurrentIndex].aux.fFlags, name);
}
else if(current_state == DO_ELEMENT_AuxData &&
( strcmp(name, "ubCurrentFrame") == 0 ||
@@ -363,7 +363,7 @@ void CAppDataParser::OnStartElement(const XML_Char* name, const XML_Char** atts)
}
sCharData = "";
}
void CAppDataParser::OnEndElement(const XML_Char* name)
void CAppDataParser::onEndElement(const XML_Char* name)
{
char *p;
if( strcmp(name, "usTileLocIndex") == 0 && current_state == DO_ELEMENT_properties)
@@ -434,7 +434,7 @@ void CAppDataParser::OnEndElement(const XML_Char* name)
current_state = DO_ELEMENT_NONE;
}
}
void CAppDataParser::OnTextElement(const XML_Char *str, int len)
void CAppDataParser::onTextElement(const XML_Char *str, int len)
{
// handle only this special case; everything else does not matter for now
if(current_state == DO_ELEMENT_properties)
@@ -445,26 +445,34 @@ void CAppDataParser::OnTextElement(const XML_Char *str, int len)
}
bool IndexedSTIImage::ReadAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile* pFile)
bool IndexedSTIImage::readAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile* pFile)
{
if(!pFile)
{
return false;
}
vfs::COpenReadFile oFile(pFile);
UINT32 uiSize = oFile.file().GetFileSize();
std::vector<char> vBuffer(uiSize+1);
std::vector<char> vBuffer;
UINT32 uiSize = 0;
try
{
vfs::COpenReadFile oFile(pFile);
uiSize = oFile.file().getSize();
vBuffer.resize(uiSize+1);
THROWIFFALSE(uiSize == oFile.file().read(&vBuffer[0],uiSize), L"Could not read XML file");
vBuffer[uiSize] = 0;
oFile.file().close();
}
catch(CBasicException& ex)
{
RETHROWEXCEPTION(L"", &ex);
}
UINT32 uiHasRead;
THROWIFFALSE( oFile.file().Read(&vBuffer[0],uiSize,uiHasRead) || (uiSize != uiHasRead), L"Could not read XML file");
vBuffer[uiSize] = 0;
oFile.file().Close();
XML_Parser parser = XML_ParserCreate(NULL);
CAppDataParser adp(parser);
adp.GrabParser();
adp.SetImage(hImage);
adp.grabParser();
adp.setImage(hImage);
try
{
@@ -472,7 +480,7 @@ bool IndexedSTIImage::ReadAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile*
{
std::wstringstream wss;
wss << L"XML Parser Error in Groups.xml: "
<< utf8string(XML_ErrorString(XML_GetErrorCode(parser))).c_wcs().c_str()
<< utf8string(XML_ErrorString(XML_GetErrorCode(parser))).c_wcs()
<< L" at line "
<< XML_GetCurrentLineNumber(parser);
THROWEXCEPTION(wss.str().c_str());
@@ -486,7 +494,7 @@ bool IndexedSTIImage::ReadAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile*
}
bool IndexedSTIImage::WriteToHIMAGE(HIMAGE pImage)
bool IndexedSTIImage::writeToHIMAGE(HIMAGE pImage)
{
if(!pImage)
{
@@ -617,7 +625,7 @@ public:
{
if(_file)
{
_file->Close();
_file->close();
}
if(_struct && _info)
{
@@ -686,36 +694,21 @@ bool LoadPNGFileToImage(HIMAGE hImage, UINT16 fContents)
bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
{
if(!GetVFS()->FileExists(hImage->ImageFile))
if(!getVFS()->fileExists(hImage->ImageFile))
{
return false;
}
vfs::COpenReadFile oFile(hImage->ImageFile);
vfs::CMemoryFile oBuffer("");
THROWIFFALSE( oBuffer.CopyToBuffer(oFile.file()), L"Could not copy file to buffer");
//UINT32 uiSize = oFile.file().GetFileSize();
//std::vector<UINT8> vBuffer(uiSize);
//UINT uiHasRead, uiHasWritten;
//if( !oFile.file().Read(&vBuffer[0],uiSize,&uiHasRead) || uiHasRead != uiSize)
//{
// THROWEXCEPTION(L"could not load file content to buffer");
//}
//oBuffer.OpenWrite();
//if( !oBuffer.Write(&vBuffer[0],uiSize,&uiHasWritten) || uiSize != uiHasWritten)
//{
// THROWEXCEPTION(L"cound not write buffer content into memory file");
//}
oBuffer.Close();
vfs::COpenReadFile oFile(hImage->ImageFile);
TRYCATCH_RETHROW(oBuffer.copyToBuffer(oFile.file()), L"Could not copy file to buffer");
oBuffer.close();
//vfs::CUncompressed7zLibrary oLib(&oFile.file(),"");
ObjBlockAllocator<vfs::CLibFile> allocator(128);
vfs::CUncompressed7zLibrary oLib(vfs::tReadableFile::Cast(&oBuffer),"",false, &allocator);
vfs::CUncompressed7zLibrary oLib(vfs::tReadableFile::cast(&oBuffer),"",false, &allocator);
if(!oLib.Init())
if(!oLib.init())
{
return false;
}
@@ -735,7 +728,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
for(; !it.end(); it.next())
{
// check extension
utf8string::str_t const& fname = it.value()->GetFileName()().c_wcs();
utf8string::str_t const& fname = it.value()->getName().c_wcs();
utf8string::size_t dot = fname.find_last_of(vfs::Const::DOT());
if(dot != utf8string::str_t::npos)
{
@@ -756,7 +749,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
}
else if (StrCmp::Equal(fname.substr(dot,fname.length()-dot), CONST_DOTXML) )
{
appdata_file = vfs::tReadableFile::Cast(it.value());
appdata_file = vfs::tReadableFile::cast(it.value());
}
}
}
@@ -767,7 +760,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
{
try
{
LoadPngFile lpng( vfs::tReadableFile::Cast(vFiles[0]) );
LoadPngFile lpng( vfs::tReadableFile::cast(vFiles[0]) );
bool bLoadS = lpng.Load();
@@ -799,7 +792,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
{
std::wstringstream wss;
wss << L"Loading PNG image from file '"
<< oFile.file().GetFullPath()().c_wcs()
<< oFile.file().getPath().c_wcs()
<< L"' failed";
RETHROWEXCEPTION(wss.str().c_str(),&ex);
}
@@ -817,10 +810,10 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
try
{
vfs::CMemoryFile oTempFile("");
oTempFile.CopyToBuffer( *vfs::tReadableFile::Cast(*fit) );
oTempFile.copyToBuffer( *vfs::tReadableFile::cast(*fit) );
// LoadPngFile lpng( vfs::tReadableFile::Cast(*fit) );
LoadPngFile lpng( vfs::tReadableFile::Cast(&oTempFile) );
// LoadPngFile lpng( vfs::tReadableFile::cast(*fit) );
LoadPngFile lpng( vfs::tReadableFile::cast(&oTempFile) );
bool bLoadS = lpng.Load();
if(bLoadS)
@@ -830,7 +823,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
if(!bHasPalette)
{
THROWIFFALSE(lpng.Info()->num_palette == 256, L"size of palette is not 256");
image.SetPalette(lpng.Info()->palette, lpng.Info()->num_palette);
image.setPalette(lpng.Info()->palette, lpng.Info()->num_palette);
bHasPalette = true;
}
UINT32 SIZE = lpng.Info()->height * lpng.Info()->width;
@@ -839,12 +832,12 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
{
memcpy(&data[i*lpng.Info()->width],lpng.Rows()[i],lpng.Info()->width);
}
image.AddImage(&data[0], SIZE, lpng.Info()->width, lpng.Info()->height, lpng.Info()->x_offset, lpng.Info()->y_offset);
image.addImage(&data[0], SIZE, lpng.Info()->width, lpng.Info()->height, lpng.Info()->x_offset, lpng.Info()->y_offset);
}
else
{
std::wstringstream wss;
wss << L"PNG file '" << (*fit)->GetFileName()() << L" @ " << oFile.file().GetFullPath()() << L"' is not a paletted image";
wss << L"PNG file '" << (*fit)->getName()() << L" @ " << oFile.file().getPath()() << L"' is not a paletted image";
THROWEXCEPTION(wss.str().c_str());
}
}
@@ -852,15 +845,15 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
catch(CBasicException& ex)
{
std::wstringstream wss;
wss << L"Loading PNG image [" << findex << L"] from file '" << oFile.file().GetFullPath()().c_wcs() << L"' failed";
wss << L"Loading PNG image [" << findex << L"] from file '" << oFile.file().getPath().c_wcs() << L"' failed";
RETHROWEXCEPTION(wss.str().c_str(),&ex);
}
}
}
bool success = image.WriteToHIMAGE(hImage);
bool success = image.writeToHIMAGE(hImage);
if(appdata_file)
{
success &= image.ReadAppDataFromXMLFile(hImage, appdata_file);
success &= image.readAppDataFromXMLFile(hImage, appdata_file);
}
return success;
}
+77
View File
@@ -1,5 +1,80 @@
#include "Random.h"
#include <time.h>
#include "debug control.h"
extern bool is_client;
extern bool is_server;
extern bool is_networked;
bool gfMPDebugOutputRandoms = false;
// OJW - 091024 - MP random syncing
// need to syncronise the randomness of events in a multiplayer game on all clients
UINT32 MPPreRandom( UINT32 uiRange )
{
UINT32 uiNum;
if( uiRange == 0 )
return 0;
//Extract the current pregenerated number
uiNum = guiPreRandomNums[ guiPreRandomIndex ] * uiRange / RAND_MAX % uiRange;
if (gfMPDebugOutputRandoms)
{
char tmpMPDbgString[512];
sprintf(tmpMPDbgString,"MPPreRandom ( uiRange : %i , uiPreRandomIndex : %i , uiResult : %i )\n",uiRange, guiPreRandomIndex , uiNum );
MPDebugMsg(tmpMPDbgString);
}
//Go to the next index.
guiPreRandomIndex++;
if (guiPreRandomIndex >= MAX_PREGENERATED_NUMS)
guiPreRandomIndex = 0;
return uiNum;
}
#ifdef BMP_RANDOM//dnl ch55 111009
#include <windows.h>
UINT32 guiPreRandomIndex;
UINT32 guiPreRandomNums[MAX_PREGENERATED_NUMS];
UINT32 GetRndNum(UINT32 maxnum)
{
if (is_networked && is_client)
return MPPreRandom(maxnum);
static UINT32 rnd=0, cnt=0;
POINT pt;
if(!(cnt++%RAND_MAX))
{
GetCursorPos(&pt);// Get cursor location
srand(maxnum ^ rnd ^ pt.x ^ pt.y ^ GetTickCount());
//SendFmtMsg("Random Number Generator Reinitialized.");
//for(int l=0;l<100;l++)SendFmtMsg("%2d", Random(100));
}
if(maxnum == 0)
return(0);
rnd = rand();
rnd <<= 11;
rnd ^= rand();
rnd <<= 7;
rnd ^= rand();
return(rnd % maxnum);
}
void InitializeRandom(void)
{
// Pregenerate all of the random numbers.
for(guiPreRandomIndex = 0; guiPreRandomIndex<MAX_PREGENERATED_NUMS; guiPreRandomIndex++)
guiPreRandomNums[guiPreRandomIndex] = GetRndNum(0xFFFFFFFF);
guiPreRandomIndex = 0;
}
#else
UINT32 guiPreRandomIndex = 0;
std::vector<UINT32> guiPreRandomNums(MAX_PREGENERATED_NUMS, 0);
@@ -17,3 +92,5 @@ void InitializeRandom()
}
guiPreRandomIndex = 0;
}
#endif
@@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\ext\7z"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -105,7 +105,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\ext\7z"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
@@ -166,7 +166,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\ext\7z"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
@@ -228,7 +228,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\VFS"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\ext\7z"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -267,6 +267,68 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release_WithDebugInfo|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_2005Express.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
AdditionalIncludeDirectories="..\Multiplayer;..\ext\libpng;..\ext\utf8\source;..\ext\7z"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
@@ -268,6 +268,70 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release_WithDebugInfo|Win32"
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_VS2008.vsprops"
CharacterSet="0"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
File diff suppressed because it is too large Load Diff
@@ -1,650 +0,0 @@
# Microsoft Developer Studio Project File - Name="Standard Gaming Platform" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=Standard Gaming Platform - Win32 Debug Demo
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Standard Gaming Platform.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug Demo"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Standard Gaming Platform - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "Standard Gaming Platform - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "Standard Gaming Platform - Win32 Release with Debug Info" (based on "Win32 (x86) Static Library")
!MESSAGE "Standard Gaming Platform - Win32 Bounds Checker" (based on "Win32 (x86) Static Library")
!MESSAGE "Standard Gaming Platform - Win32 Debug Demo" (based on "Win32 (x86) Static Library")
!MESSAGE "Standard Gaming Platform - Win32 Release Demo" (based on "Win32 (x86) Static Library")
!MESSAGE "Standard Gaming Platform - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA"
# PROP Scc_LocalPath "..\ja2\build"
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Standard Gaming Platform - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir "."
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "NO_ZLIB" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir "."
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\Build" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I "..\\" /I ".\\" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Release with Debug Info"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release with Debug Info"
# PROP BASE Intermediate_Dir "Release with Debug Info"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release with Debug Info"
# PROP Intermediate_Dir "Release with Debug Info"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "NDEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "NO_ZLIB" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Bounds Checker"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Standar0"
# PROP BASE Intermediate_Dir "Standar0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Standar0"
# PROP Intermediate_Dir "Standar0"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "NO_ZLIB" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "_VTUNE_PROFILING" /FR /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Debug Demo"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Standard"
# PROP BASE Intermediate_Dir "Standard"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Standard"
# PROP Intermediate_Dir "Standard"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2DEMO" /D "NO_ZLIB" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /FR /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Release Demo"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Standar1"
# PROP BASE Intermediate_Dir "Standar1"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Standar1"
# PROP Intermediate_Dir "Standar1"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W4 /GX /Zi /O2 /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "NDEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /D "RELEASE_WITH_DEBUG_INFO" /YX /FD /c
# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "NO_ZLIB" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Demo Release with Debug Info"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Standar2"
# PROP BASE Intermediate_Dir "Standar2"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Standar2"
# PROP Intermediate_Dir "Standar2"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W4 /GX /Zi /O2 /I "\ja2\build" /I "\ja2\build\TileEngine" /I "\ja2\build\Tactical" /I "\ja2\build\Utils" /I "\ja2\build\strategic" /D "NDEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /D "RELEASE_WITH_DEBUG_INFO" /YX /FD /c
# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "NO_ZLIB" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "XML_STATIC" /D "CINTERFACE" /YX"JA2 SGP ALL.H" /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "Standard Gaming Platform - Win32 Release"
# Name "Standard Gaming Platform - Win32 Debug"
# Name "Standard Gaming Platform - Win32 Release with Debug Info"
# Name "Standard Gaming Platform - Win32 Bounds Checker"
# Name "Standard Gaming Platform - Win32 Debug Demo"
# Name "Standard Gaming Platform - Win32 Release Demo"
# Name "Standard Gaming Platform - Win32 Demo Release with Debug Info"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=".\Button Sound Control.cpp"
# End Source File
# Begin Source File
SOURCE=".\Button System.cpp"
# End Source File
# Begin Source File
SOURCE=".\Container.cpp"
# End Source File
# Begin Source File
SOURCE=".\Cursor Control.cpp"
# End Source File
# Begin Source File
SOURCE=".\DbMan.cpp"
# End Source File
# Begin Source File
SOURCE=".\DEBUG.cpp"
!IF "$(CFG)" == "Standard Gaming Platform - Win32 Release"
# ADD CPP /D "_DEBUG"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Debug"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Release with Debug Info"
# ADD BASE CPP /D "_DEBUG"
# ADD CPP /D "_DEBUG"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Bounds Checker"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Debug Demo"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Release Demo"
# ADD BASE CPP /D "_DEBUG"
# ADD CPP /D "_DEBUG"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Demo Release with Debug Info"
# ADD BASE CPP /D "_DEBUG"
# ADD CPP /D "_DEBUG"
!ENDIF
# End Source File
# Begin Source File
SOURCE=".\DirectDraw Calls.cpp"
# End Source File
# Begin Source File
SOURCE=".\DirectX Common.cpp"
# End Source File
# Begin Source File
SOURCE=".\English.cpp"
# End Source File
# Begin Source File
SOURCE=.\ExceptionHandling.cpp
# End Source File
# Begin Source File
SOURCE=.\FileCat.cpp
# End Source File
# Begin Source File
SOURCE=".\FileMan.cpp"
# End Source File
# Begin Source File
SOURCE=".\Font.cpp"
# End Source File
# Begin Source File
SOURCE=".\himage.cpp"
# End Source File
# Begin Source File
SOURCE=".\impTGA.cpp"
# End Source File
# Begin Source File
SOURCE=".\input.cpp"
# End Source File
# Begin Source File
SOURCE=".\Install.cpp"
# End Source File
# Begin Source File
SOURCE=".\LibraryDataBase.cpp"
# End Source File
# Begin Source File
SOURCE=".\line.cpp"
# End Source File
# Begin Source File
SOURCE=".\MemMan.cpp"
!IF "$(CFG)" == "Standard Gaming Platform - Win32 Release"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Debug"
# ADD CPP /D "_MEMMAN_DEBUG"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Release with Debug Info"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Bounds Checker"
# ADD BASE CPP /D "_MEMMAN_DEBUG"
# ADD CPP /D "_MEMMAN_DEBUG"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Debug Demo"
# ADD BASE CPP /D "_MEMMAN_DEBUG"
# ADD CPP /D "_MEMMAN_DEBUG"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Release Demo"
!ELSEIF "$(CFG)" == "Standard Gaming Platform - Win32 Demo Release with Debug Info"
!ENDIF
# End Source File
# Begin Source File
SOURCE=".\mousesystem.cpp"
# End Source File
# Begin Source File
SOURCE=".\Mutex Manager.cpp"
# End Source File
# Begin Source File
SOURCE=".\PCX.cpp"
# End Source File
# Begin Source File
SOURCE=".\Random.cpp"
# End Source File
# Begin Source File
SOURCE=.\readdir.cpp
# End Source File
# Begin Source File
SOURCE=".\RegInst.cpp"
# End Source File
# Begin Source File
SOURCE=".\sgp.cpp"
# End Source File
# Begin Source File
SOURCE=".\shading.cpp"
# End Source File
# Begin Source File
SOURCE=".\soundman.cpp"
# End Source File
# Begin Source File
SOURCE=".\STCI.cpp"
# End Source File
# Begin Source File
SOURCE=.\stringicmp.cpp
# End Source File
# Begin Source File
SOURCE=".\timer.cpp"
# End Source File
# Begin Source File
SOURCE=".\video.cpp"
# End Source File
# Begin Source File
SOURCE=".\vobject.cpp"
# End Source File
# Begin Source File
SOURCE=".\vobject_blitters.cpp"
# End Source File
# Begin Source File
SOURCE=".\vsurface.cpp"
# End Source File
# Begin Source File
SOURCE=.\WinFont.cpp
# End Source File
# Begin Source File
SOURCE=".\ddraw.lib"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=".\Button System.h"
# End Source File
# Begin Source File
SOURCE=".\container.h"
# End Source File
# Begin Source File
SOURCE=".\Cursor Control.h"
# End Source File
# Begin Source File
SOURCE=".\DbMan.h"
# End Source File
# Begin Source File
SOURCE=".\Debug.h"
# End Source File
# Begin Source File
SOURCE=".\DirectDraw Calls.h"
# End Source File
# Begin Source File
SOURCE=".\DirectX Common.h"
# End Source File
# Begin Source File
SOURCE=".\english.h"
# End Source File
# Begin Source File
SOURCE=.\ExceptionHandling.h
# End Source File
# Begin Source File
SOURCE=.\FileCat.h
# End Source File
# Begin Source File
SOURCE=".\FileMan.h"
# End Source File
# Begin Source File
SOURCE="..\Utils\Font Control.h"
# End Source File
# Begin Source File
SOURCE=".\font.h"
# End Source File
# Begin Source File
SOURCE=".\gameloop.h"
# End Source File
# Begin Source File
SOURCE=".\himage.h"
# End Source File
# Begin Source File
SOURCE=".\imgfmt.h"
# End Source File
# Begin Source File
SOURCE=".\impTGA.h"
# End Source File
# Begin Source File
SOURCE=".\Input.h"
# End Source File
# Begin Source File
SOURCE=".\Install.h"
# End Source File
# Begin Source File
SOURCE=".\JA2 SGP ALL.H"
# End Source File
# Begin Source File
SOURCE=..\jascreens.h
# End Source File
# Begin Source File
SOURCE=".\LibraryDataBase.h"
# End Source File
# Begin Source File
SOURCE=".\line.h"
# End Source File
# Begin Source File
SOURCE=..\local.h
# End Source File
# Begin Source File
SOURCE=".\MemMan.h"
# End Source File
# Begin Source File
SOURCE=".\mousesystem.h"
# End Source File
# Begin Source File
SOURCE=".\mousesystem_macros.h"
# End Source File
# Begin Source File
SOURCE=".\Mutex Manager.h"
# End Source File
# Begin Source File
SOURCE=".\pcx.h"
# End Source File
# Begin Source File
SOURCE=".\random.h"
# End Source File
# Begin Source File
SOURCE=.\readdir.h
# End Source File
# Begin Source File
SOURCE=".\RegInst.h"
# End Source File
# Begin Source File
SOURCE="..\TileEngine\render dirty.h"
# End Source File
# Begin Source File
SOURCE=..\screenids.h
# End Source File
# Begin Source File
SOURCE=..\SCREENS.H
# End Source File
# Begin Source File
SOURCE=".\sgp.h"
# End Source File
# Begin Source File
SOURCE=".\shading.h"
# End Source File
# Begin Source File
SOURCE=".\soundman.h"
# End Source File
# Begin Source File
SOURCE=".\STCI.h"
# End Source File
# Begin Source File
SOURCE=.\stringicmp.h
# End Source File
# Begin Source File
SOURCE=".\timer.h"
# End Source File
# Begin Source File
SOURCE=".\TopicIDs.h"
# End Source File
# Begin Source File
SOURCE=".\TopicOps.h"
# End Source File
# Begin Source File
SOURCE=".\trle.h"
# End Source File
# Begin Source File
SOURCE=.\Types.h
# End Source File
# Begin Source File
SOURCE=".\Video.h"
# End Source File
# Begin Source File
SOURCE=".\video_private.h"
# End Source File
# Begin Source File
SOURCE=".\vobject.h"
# End Source File
# Begin Source File
SOURCE=".\vobject_blitters.h"
# End Source File
# Begin Source File
SOURCE=".\vobject_private.h"
# End Source File
# Begin Source File
SOURCE=".\vsurface.h"
# End Source File
# Begin Source File
SOURCE=".\vsurface_private.h"
# End Source File
# Begin Source File
SOURCE=".\WCheck.h"
# End Source File
# Begin Source File
SOURCE=".\Winbart97.h"
# End Source File
# Begin Source File
SOURCE=.\WinFont.h
# End Source File
# Begin Source File
SOURCE=".\WizShare.h"
# End Source File
# Begin Source File
SOURCE=".\ZCONF.H"
# End Source File
# End Group
# End Target
# End Project
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -33,6 +33,7 @@
#if defined( JA2 ) || defined( UTILS )
typedef unsigned int UINT32;
typedef __int64 INT64; // WANNE - BMP: Used for Big Maps
typedef signed int INT32;
#else
typedef unsigned int UINT32;
+2 -2
View File
@@ -95,11 +95,11 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
{
#ifdef USE_VFS
// see if there is a .jpc file first and when that fails, try .sti
utf8string str(ImageFile);
vfs::Path str(ImageFile);
utf8string::str_t const& findext = str.c_wcs();
utf8string::size_t dot = findext.find_last_of(vfs::Const::DOT());
utf8string fname = findext.substr(0,dot).append(CONST_DOTJPC);
if(GetVFS()->FileExists(fname))
if(getVFS()->fileExists(fname))
{
iFileLoader = JPC_FILE_READER;
strncpy(ImageFile, fname.utf8().c_str(), fname.length());
+17 -20
View File
@@ -1296,8 +1296,6 @@ INT16 GetNumberOfLinesInHeight( const STR16 pStringA )
{
STR16 pToken;
INT16 sCounter = 0;
// HEADROCK HAM 3.6: This is a serious limitation... Increasing size
//CHAR16 pString[ 512 ];
CHAR16 pString[ 4096 ];
wcscpy( pString, pStringA );
@@ -1307,14 +1305,16 @@ INT16 GetNumberOfLinesInHeight( const STR16 pStringA )
while( pToken != NULL )
{
// HEADROCK HAM 3.6: Make sure that all lines can appear on screen. If impossible, reduce number of lines
// artificially.
// WANNE: Fix by Headrock
if ( (sCounter+1) * (GetFontHeight(FONT10ARIAL)+1) > (SCREEN_HEIGHT - 10) )
{
break;
}
pToken = wcstok( NULL, L"\n" );
sCounter++;
{
break;
}
pToken = wcstok( NULL, L"\n" );
sCounter++;
/*pToken = wcstok( NULL, L"\n" );
sCounter++;*/
}
return( sCounter );
@@ -1387,8 +1387,6 @@ void DisplayFastHelp( MOUSE_REGION *region )
INT16 GetWidthOfString( const STR16 pStringA )
{
// HEADROCK HAM 3.6: This is a serious limitation... Increasing size.
//CHAR16 pString[ 512 ];
CHAR16 pString[ 4096 ];
STR16 pToken;
INT16 sWidth = 0;
@@ -1416,8 +1414,6 @@ void DisplayHelpTokenizedString( const STR16 pStringA, INT16 sX, INT16 sY )
STR16 pToken;
INT32 iCounter = 0, i;
UINT32 uiCursorXPos;
// HEADROCK HAM 3.6: This is a serious limitation... Increasing size
//CHAR16 pString[ 512 ];
CHAR16 pString[ 4096 ];
INT32 iLength;
@@ -1428,14 +1424,15 @@ void DisplayHelpTokenizedString( const STR16 pStringA, INT16 sX, INT16 sY )
while( pToken != NULL )
{
// HEADROCK HAM 3.6: If height of screen exceeds screen height, replace the last VISIBLE line with "..."
// and break the cycle.
// WANNE: Fix by Headrock
if ( (iCounter+2) * (GetFontHeight(FONT10ARIAL)+1) > (SCREEN_HEIGHT - 10) )
{
mprintf( sX, sY + iCounter * (GetFontHeight(FONT10ARIAL)+1), L"..." );
break;
}
iLength = (INT32)wcslen( pToken );
{
mprintf( sX, sY + iCounter * (GetFontHeight(FONT10ARIAL)+1), L"..." );
break;
}
iLength = (INT32)wcslen( pToken );
//iLength = (INT32)wcslen( pToken );
for( i = 0; i < iLength; i++ )
{
uiCursorXPos = StringPixLengthArgFastHelp( FONT10ARIAL, FONT10ARIALBOLD, i, pToken );
+44 -5
View File
@@ -1,13 +1,51 @@
#ifndef __RANDOM_
#define __RANDOM_
#define BMP_RANDOM
#include "Types.h"
#include "Debug.h"
#include <stdlib.h>
//IMPORTANT: Changing this define will invalidate the JA2 save. If this
// is necessary, please ifdef your own value.
#define MAX_PREGENERATED_NUMS 256
//IMPORTANT: Changing this define will invalidate the JA2 save. If this is necessary, please ifdef your own value.
#define MAX_PREGENERATED_NUMS 256
#ifdef BMP_RANDOM//dnl ch55 111009 !!!Do not undefine this if plan play Big maps, old random generator not work properly and return only 2^15 different values although seems that should return all posible INT32 values
extern UINT32 guiPreRandomIndex;
extern UINT32 guiPreRandomNums[MAX_PREGENERATED_NUMS];
extern void InitializeRandom(void);
extern UINT32 GetRndNum(UINT32 maxnum);
extern bool gfMPDebugOutputRandoms;
inline UINT32 Random(UINT32 uiRange)
{
return(GetRndNum(uiRange));
}
inline INT32 iRandom(UINT32 uiRange)
{
return(GetRndNum(uiRange));
}
inline BOOLEAN Chance( UINT32 uiChance )
{
return((BOOLEAN)(Random(100) < uiChance));
}
inline UINT32 PreRandom(UINT32 uiRange)
{
return(GetRndNum(uiRange));
}
inline BOOLEAN PreChance( UINT32 uiChance )
{
return((BOOLEAN)(PreRandom(100) < uiChance));
}
#else
#include <stdlib.h>
extern UINT32 guiPreRandomIndex;
extern std::vector<UINT32> guiPreRandomNums;
@@ -91,5 +129,6 @@ inline BOOLEAN PreChance( UINT32 uiChance )
return (BOOLEAN)(PreRandom( 100 ) < uiChance);
}
#endif
#endif
#endif
+91 -45
View File
@@ -44,6 +44,8 @@
#include "VFS/Tools/Log.h"
#include "VFS/Tools/ParserTools.h"
#include "Text.h"
#include "VFS/os_functions.h"
#include "VFS/vfs_settings.h"
#define USE_CONSOLE 0
@@ -83,7 +85,7 @@ void SHOWEXCEPTION(CBasicException& ex)
_ExceptionMessage(ex);
}
catch(CBasicException &ex2) {
LogException(ex2);
logException(ex2);
exit(0);
}
}
@@ -599,7 +601,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
}
catch(CBasicException& ex)
{
LogException(ex);
logException(ex);
// nothing is set up, no vfs, no video manager
// regular error processing wouldn't work here
// set default values and continue as if nothing has happened
@@ -696,20 +698,20 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
//InitializeJA2TimerID();
#ifdef USE_VFS
STRING512 sExecutableDir;
GetExecutableDirectory( sExecutableDir );
vfs::Path exe_dir, exe_file;
os::getExecutablePath(exe_dir, exe_file);
// set current directory to exe's directory
SetCurrentDirectory(sExecutableDir);
os::setCurrectDirectory(exe_dir);
THROWIFFALSE( InitVirtualFileSystem( vfs_config_ini ), L"Initializing Virtual File System failed");
THROWIFFALSE( initVirtualFileSystem( vfs_config_ini ), L"Initializing Virtual File System failed");
s_VfsIsInitialized = true;
GetVFS()->GetVirtualLocation(vfs::Path("Temp"),true)->SetIsExclusive(true);
GetVFS()->GetVirtualLocation(vfs::Path("ShadeTables"),true)->SetIsExclusive(true);
GetVFS()->GetVirtualLocation(vfs::Path(pMessageStrings[MSG_SAVEDIRECTORY]+3),true)->SetIsExclusive(true);
GetVFS()->GetVirtualLocation(vfs::Path(pMessageStrings[MSG_MPSAVEDIRECTORY]+3),true)->SetIsExclusive(true);
getVFS()->getVirtualLocation(vfs::Path("Temp"),true)->setIsExclusive(true);
getVFS()->getVirtualLocation(vfs::Path("ShadeTables"),true)->setIsExclusive(true);
getVFS()->getVirtualLocation(vfs::Path(pMessageStrings[MSG_SAVEDIRECTORY]+3),true)->setIsExclusive(true);
getVFS()->getVirtualLocation(vfs::Path(pMessageStrings[MSG_MPSAVEDIRECTORY]+3),true)->setIsExclusive(true);
#ifdef USE_CODE_PAGE
charSet::InitializeCharSets();
@@ -797,10 +799,6 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
}
#endif
FastDebugMsg("Initializing Random");
// Initialize random number generator
InitializeRandom(); // no Shutdown
FastDebugMsg("Initializing Game Manager");
// Initialize the Game
if (InitializeGame() == FALSE)
@@ -895,11 +893,26 @@ void ShutdownStandardGamingPlatform(void)
ShutdownDebugManager();
CLog::FlushFinally();
vfs::CVirtualFileSystem::ShutdownVFS();
CFileAllocator::Clear();
CLog::flushFinally();
vfs::CVirtualFileSystem::shutdownVFS();
CFileAllocator::clear();
}
#ifdef USE_VFS
#include "MPJoinScreen.h"
utf8string getGameID()
{
static utf8string _id;
static bool has_id = false;
if(!has_id)
{
CUniqueServerId::uniqueRandomString(_id);
has_id = true;
}
return _id;
}
#endif
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow)
{
@@ -950,6 +963,14 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
return( 0 );
}
FastDebugMsg("Initializing Random");
// Initialize random number generator
InitializeRandom(); // no Shutdown
#ifdef USE_VFS
CLog::setSharedString( getGameID() );
#endif
//rain
//NSLoadSettings();
//NSSaveSettings();
@@ -1008,6 +1029,10 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
// ShowCursor(FALSE);
#ifdef USE_VFS
vfs::Path exe_dir, exe_file;
os::getExecutablePath(exe_dir, exe_file);
os::setCurrectDirectory(exe_dir);
#else
STRING512 sExecutableDir;
GetExecutableDirectory( sExecutableDir );
SetCurrentDirectory(sExecutableDir);
@@ -1026,10 +1051,10 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
if(!s_VfsIsInitialized)
{
vfs::CFile* fonts = new vfs::CFile("Data/Fonts.slf");
vfs::CSLFLibrary* slfLib = new vfs::CSLFLibrary(vfs::tReadableFile::Cast(fonts),"");
if(slfLib->Init())
vfs::CSLFLibrary* slfLib = new vfs::CSLFLibrary(vfs::tReadableFile::cast(fonts),"");
if(slfLib->init())
{
GetVFS()->AddLocation(slfLib,"doesn't matter");
getVFS()->addLocation(slfLib,"doesn't matter");
}
// fonts not initialized
FontTranslationTable *pFontTable = CreateEnglishTransTable( );
@@ -1056,28 +1081,28 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
}
}
gfProgramIsRunning = 1;
LogException(ex);
logException(ex);
SHOWEXCEPTION(ex);
}
catch(std::exception &ex)
{
gfProgramIsRunning = 1;
CBasicException nex(ex.what(),_FUNCTION_FORMAT_,__LINE__,__FILE__);
LogException(nex);
logException(nex);
SHOWEXCEPTION(nex);
}
catch(const char* msg)
{
gfProgramIsRunning = 1;
CBasicException ex(msg,_FUNCTION_FORMAT_,__LINE__,__FILE__);
LogException(ex);
logException(ex);
SHOWEXCEPTION(ex);
}
catch(...)
{
gfProgramIsRunning = 1;
CBasicException ex("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__);
LogException( ex );
logException( ex );
SHOWEXCEPTION(ex);
}
@@ -1123,25 +1148,25 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
}
catch(CBasicException &ex)
{
LogException(ex);
logException(ex);
SHOWEXCEPTION(ex);
}
catch(std::exception &ex)
{
CBasicException nex(ex.what(),_FUNCTION_FORMAT_,__LINE__,__FILE__);
LogException(nex);
logException(nex);
SHOWEXCEPTION(nex);
}
catch(const char* msg)
{
CBasicException ex(msg,_FUNCTION_FORMAT_,__LINE__,__FILE__);
LogException(ex);
logException(ex);
SHOWEXCEPTION(ex);
}
catch(...)
{
CBasicException ex("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__);
LogException( ex );
logException( ex );
SHOWEXCEPTION(ex);
}
@@ -1225,7 +1250,6 @@ void SGPExit(void)
}
extern bool g_VFS_NO_UNICODE;
void GetRuntimeSettings( )
{
#ifndef USE_VFS
@@ -1239,7 +1263,7 @@ void GetRuntimeSettings( )
strcat(INIFile, "\\Ja2.ini");
#else
CPropertyContainer oProps;
oProps.InitFromIniFile("Ja2.ini");
oProps.initFromIniFile("Ja2.ini");
#endif
iResolution = -1;
#ifndef USE_VFS
@@ -1248,12 +1272,30 @@ void GetRuntimeSettings( )
iResolution = atoi(zScreenResolution);
}
#else
iResolution = oProps.GetIntProperty(L"Ja2 Settings", L"SCREEN_RESOLUTION", -1);
utf8string loc = oProps.getStringProperty("Ja2 Settings", L"LOCALE");
if(!loc.empty())
{
THROWIFFALSE( setlocale(LC_ALL, loc.utf8().c_str()), BuildString().add(L"invalid locale : ").add(loc).get());
}
g_VFS_NO_UNICODE = oProps.GetBoolProperty(L"Ja2 Settings", L"VFS_NO_UNICODE", false);
iResolution = (int)oProps.getIntProperty(L"Ja2 Settings", L"SCREEN_RESOLUTION", -1);
vfs::Settings::setUseUnicode( !oProps.getBoolProperty(L"Ja2 Settings", L"VFS_NO_UNICODE", false) );
std::list<utf8string> ini_list;
if(oProps.GetStringListProperty(L"Ja2 Settings", L"VFS_CONFIG_INI", ini_list, L""))
utf8string vfs_config_file;
if(oProps.getStringProperty(L"Ja2 Settings", L"VFS_CONFIG", vfs_config_file))
{
CPropertyContainer temp_cont;
temp_cont.initFromIniFile(vfs_config_file);
utf8string temp_str;
if(temp_cont.getStringProperty(L"vfs_config", L"VFS_CONFIG_INI", temp_str))
{
oProps.setStringProperty(L"Ja2 Settings", L"VFS_CONFIG_INI", temp_str);
}
}
if(oProps.getStringListProperty(L"Ja2 Settings", L"VFS_CONFIG_INI", ini_list, L""))
{
vfs_config_ini.clear();
for(std::list<utf8string>::iterator it = ini_list.begin(); it != ini_list.end(); ++it)
@@ -1269,15 +1311,19 @@ void GetRuntimeSettings( )
#ifdef JA2EDITOR
#ifndef USE_VFS
if (GetPrivateProfileString( "Ja2 Settings","EDITOR_SCREEN_RESOLUTION", "", zScreenResolution, 50, INIFile ))
{
iResolution = atoi(zScreenResolution);
}
if (GetPrivateProfileString( "Ja2 Settings","EDITOR_SCREEN_RESOLUTION", "", zScreenResolution, 50, INIFile ))
{
iResolution = atoi(zScreenResolution);
}
#else
iResolution = oProps.GetIntProperty("Ja2 Settings","EDITOR_SCREEN_RESOLUTION", -1);
iResolution = (int)oProps.getIntProperty("Ja2 Settings","EDITOR_SCREEN_RESOLUTION", -1);
#endif
#endif
#ifdef USE_VFS
extern bool g_bUsePngItemImages;
g_bUsePngItemImages = oProps.getBoolProperty(L"Ja2 Settings", "USE_PNG_ITEM_IMAGES", false);
#endif
int iResX;
int iResY;
@@ -1318,10 +1364,10 @@ void GetRuntimeSettings( )
// WANNE: Should we play the intro?
iPlayIntro = (int) GetPrivateProfileInt( "Ja2 Settings","PLAY_INTRO", iPlayIntro, INIFile );
#else
gbPixelDepth = (UINT8)oProps.GetIntProperty(L"SGP", L"PIXEL_DEPTH", PIXEL_DEPTH);
gbPixelDepth = (UINT8)oProps.getIntProperty(L"SGP", L"PIXEL_DEPTH", PIXEL_DEPTH);
SCREEN_WIDTH = (UINT16)oProps.GetIntProperty(L"SGP", L"WIDTH", iResX);
SCREEN_HEIGHT = (UINT16)oProps.GetIntProperty(L"SGP", L"HEIGHT", iResY);
SCREEN_WIDTH = (UINT16)oProps.getIntProperty(L"SGP", L"WIDTH", iResX);
SCREEN_HEIGHT = (UINT16)oProps.getIntProperty(L"SGP", L"HEIGHT", iResY);
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
@@ -1330,15 +1376,15 @@ void GetRuntimeSettings( )
/* 1 for Windowed, 0 for Fullscreen */
if( !bScreenModeCmdLine )
{
iScreenMode = oProps.GetIntProperty("Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode);
iScreenMode = (int)oProps.getIntProperty("Ja2 Settings","SCREEN_MODE_WINDOWED", iScreenMode);
}
// WANNE: Should we play the intro?
iPlayIntro = oProps.GetIntProperty("Ja2 Settings","PLAY_INTRO", iPlayIntro);
iPlayIntro = (int)oProps.getIntProperty("Ja2 Settings","PLAY_INTRO", iPlayIntro);
#ifdef USE_CODE_PAGE
s_DebugKeyboardInput = oProps.GetBoolProperty(L"Ja2 Settings", L"DEBUG_KEYS", false);
s_CodePage = oProps.GetStringProperty(L"Ja2 Settings", L"CODE_PAGE");
s_DebugKeyboardInput = oProps.getBoolProperty(L"Ja2 Settings", L"DEBUG_KEYS", false);
s_CodePage = oProps.getStringProperty(L"Ja2 Settings", L"CODE_PAGE");
#endif // USE_CODE_PAGE
#endif
}
+2 -2
View File
@@ -1807,7 +1807,7 @@ UINT32 uiCount;
// Lesh modifications
// Sound debug
#ifdef USE_VFS
static CLog& s_SoundLog = *CLog::Create(SndDebugFileName,true);
static CLog& s_SoundLog = *CLog::create(SndDebugFileName,true);
#endif
//*****************************************************************************************
// SoundLog
@@ -1826,7 +1826,7 @@ void SoundLog(CHAR8 *strMessage)
fclose(SndDebug);
}
#else
s_SoundLog << strMessage << CLog::endl;
s_SoundLog << strMessage << CLog::ENDL;
#endif
}
+6 -8
View File
@@ -1993,8 +1993,7 @@ void RefreshScreen(void *DummyVariable)
{
vfs::COpenWriteFile wfile(FileName,true,true);
char head[] = {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, LOBYTE(SCREEN_WIDTH), HIBYTE(SCREEN_WIDTH), LOBYTE(SCREEN_HEIGHT), HIBYTE(SCREEN_HEIGHT), 0x10, 0};
vfs::UInt32 io;
wfile.file().Write(head,18,io);
TRYCATCH_RETHROW(wfile.file().write(head,18), L"");
#endif
//
@@ -2035,7 +2034,7 @@ void RefreshScreen(void *DummyVariable)
#ifndef USE_VFS
fwrite( p16BPPData, SCREEN_WIDTH * 2, 1, OutputFile);
#else
wfile.file().Write((vfs::Byte*)p16BPPData, SCREEN_WIDTH * 2, io);
TRYCATCH_RETHROW(wfile.file().write((vfs::Byte*)p16BPPData, SCREEN_WIDTH * 2), L"");
#endif
}
else
@@ -2043,7 +2042,7 @@ void RefreshScreen(void *DummyVariable)
#ifndef USE_VFS
fwrite((void *)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2, 1, OutputFile);
#else
wfile.file().Write((vfs::Byte*)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2, io);
TRYCATCH_RETHROW(wfile.file().write((vfs::Byte*)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2), L"");
#endif
}
}
@@ -3384,8 +3383,7 @@ void RefreshMovieCache( )
#ifndef USE_VFS
fwrite(&Header, sizeof(TARGA_HEADER), 1, disk);
#else
vfs::UInt32 io;
wfile.file().Write((vfs::Byte*)&Header, sizeof(TARGA_HEADER), io);
TRYCATCH_RETHROW(wfile.file().write((vfs::Byte*)&Header, sizeof(TARGA_HEADER)), L"");
#endif
pDest = gpFrameData[ cnt ];
@@ -3396,7 +3394,7 @@ void RefreshMovieCache( )
#ifndef USE_VFS
fwrite( ( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16), 1, disk);
#else
wfile.file().Write( (vfs::Byte*)( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16), io);
TRYCATCH_RETHROW(wfile.file().write( (vfs::Byte*)( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16)), L"");
#endif
}
@@ -3418,7 +3416,7 @@ void RefreshMovieCache( )
}
catch(CBasicException& ex)
{
LogException(ex);
logException(ex);
}
#endif
}
@@ -7020,7 +7020,7 @@ UINT32 uiLineSkipDest, uiLineSkipSrc;
}
catch(CBasicException& ex)
{
LogException(ex);
logException(ex);
return false;
}