mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Additional Laptop files (by sun_alf).
Example file: https://github.com/sun-alf/BRAINMOD-o/blob/master/Data-BRAINMOD/TableData/Laptop/AdditionalFiles.xml git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9363 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -57,6 +57,7 @@ using namespace std;
|
||||
#ifdef USE_VFS
|
||||
|
||||
#include <vfs/Core/vfs_file_raii.h>
|
||||
#include <vfs/Tools/vfs_parser_tools.h>
|
||||
#include <map>
|
||||
|
||||
struct SOperation
|
||||
@@ -780,6 +781,40 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOLEAN FileReadLine( HWFILE hFile, std::string* pDest )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::IBaseFile *pFile = (vfs::IBaseFile*)hFile;
|
||||
if ( pFile && FileCheckEndOfFile( hFile ) == FALSE && (s_mapFiles[pFile].op == SOperation::READ) )
|
||||
{
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::cast( pFile );
|
||||
if ( pRF && pDest )
|
||||
{
|
||||
vfs::CReadLine rl( *pRF, false );
|
||||
rl.getLine( *pDest );
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
#endif // ifdef USE_VFS
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN FileReadLine( HWFILE hFile, STR8 pDest, UINT32 uiDestSize, UINT32 *puiBytesRead )
|
||||
{
|
||||
std::string sBuffer;
|
||||
BOOLEAN result = (pDest != NULL) && FileReadLine( hFile, &sBuffer );
|
||||
if ( result )
|
||||
{
|
||||
if ( puiBytesRead )
|
||||
*puiBytesRead = sBuffer.length();
|
||||
|
||||
UINT32 uiCountToCopy = min( sBuffer.length(), uiDestSize - 1 );
|
||||
sBuffer.copy( pDest, uiCountToCopy );
|
||||
pDest[uiCountToCopy] = '\0'; // method copy() does not put a null-terminator
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
//
|
||||
// FileWrite
|
||||
|
||||
@@ -114,6 +114,8 @@ extern HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClos
|
||||
extern void FileClose( HWFILE );
|
||||
|
||||
extern BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead );
|
||||
extern BOOLEAN FileReadLine( HWFILE hFile, std::string* pDest );
|
||||
extern BOOLEAN FileReadLine( HWFILE hFile, STR8 pDest, UINT32 uiDestSize, UINT32 *puiBytesRead );
|
||||
extern BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten );
|
||||
extern BOOLEAN FileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead );
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#define PALETTE_SIZE 768
|
||||
#define STRING_DELIMITER 0
|
||||
#define ID_BLACK 0
|
||||
#define MAX_FONTS 25
|
||||
|
||||
//*******************************************************
|
||||
//
|
||||
@@ -282,9 +281,7 @@ void SetRGBFontShadow( UINT16 usFontShadow16 )
|
||||
//*****************************************************************************
|
||||
BOOLEAN ResetFontObjectPalette(INT32 iFont)
|
||||
{
|
||||
Assert(iFont >= 0);
|
||||
Assert(iFont <= MAX_FONTS);
|
||||
Assert(FontObjs[iFont] !=NULL);
|
||||
Assert(IsFontLoaded(iFont));
|
||||
|
||||
SetFontObjectPalette8BPP(iFont, FontObjs[iFont]->pPaletteEntry);
|
||||
|
||||
@@ -301,11 +298,8 @@ BOOLEAN ResetFontObjectPalette(INT32 iFont)
|
||||
//*****************************************************************************
|
||||
UINT16 *SetFontObjectPalette8BPP(INT32 iFont, SGPPaletteEntry *pPal8)
|
||||
{
|
||||
UINT16 *pPal16;
|
||||
|
||||
Assert(iFont >= 0);
|
||||
Assert(iFont <= MAX_FONTS);
|
||||
Assert(FontObjs[iFont] !=NULL);
|
||||
UINT16 *pPal16;
|
||||
Assert(IsFontLoaded(iFont));
|
||||
|
||||
if((pPal16=Create16BPPPalette(pPal8))==NULL)
|
||||
return(NULL);
|
||||
@@ -324,9 +318,7 @@ UINT16 *pPal16;
|
||||
//*****************************************************************************
|
||||
UINT16 *SetFontObjectPalette16BPP(INT32 iFont, UINT16 *pPal16)
|
||||
{
|
||||
Assert(iFont >= 0);
|
||||
Assert(iFont <= MAX_FONTS);
|
||||
Assert(FontObjs[iFont] !=NULL);
|
||||
Assert(IsFontLoaded(iFont));
|
||||
|
||||
FontObjs[iFont]->p16BPPPalette=pPal16;
|
||||
FontObjs[iFont]->pShadeCurrent=pPal16;
|
||||
@@ -343,13 +335,25 @@ UINT16 *SetFontObjectPalette16BPP(INT32 iFont, UINT16 *pPal16)
|
||||
//*****************************************************************************
|
||||
UINT16 *GetFontObjectPalette16BPP(INT32 iFont)
|
||||
{
|
||||
Assert(iFont >= 0);
|
||||
Assert(iFont <= MAX_FONTS);
|
||||
Assert(FontObjs[iFont] !=NULL);
|
||||
Assert(IsFontLoaded(iFont));
|
||||
|
||||
return(FontObjs[iFont]->p16BPPPalette);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// IsFontLoaded
|
||||
//
|
||||
// Returns TRUE if font at iFont into memory, FALSE otherwise.
|
||||
//
|
||||
//*****************************************************************************
|
||||
BOOLEAN IsFontLoaded(INT32 iFont)
|
||||
{
|
||||
Assert(iFont >= 0);
|
||||
Assert(iFont <= MAX_FONTS);
|
||||
|
||||
return (FontObjs[iFont] != NULL);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// GetFontObject
|
||||
//
|
||||
@@ -358,9 +362,7 @@ UINT16 *GetFontObjectPalette16BPP(INT32 iFont)
|
||||
//*****************************************************************************
|
||||
HVOBJECT GetFontObject(INT32 iFont)
|
||||
{
|
||||
Assert(iFont >= 0);
|
||||
Assert(iFont <= MAX_FONTS);
|
||||
Assert(FontObjs[iFont] !=NULL);
|
||||
Assert(IsFontLoaded(iFont));
|
||||
|
||||
return(FontObjs[iFont]);
|
||||
}
|
||||
@@ -434,9 +436,7 @@ UINT32 LoadIndex;
|
||||
//*****************************************************************************
|
||||
void UnloadFont(UINT32 FontIndex)
|
||||
{
|
||||
Assert(FontIndex >= 0);
|
||||
Assert(FontIndex < MAX_FONTS);
|
||||
Assert(FontObjs[FontIndex]!=NULL);
|
||||
Assert(IsFontLoaded(FontIndex));
|
||||
|
||||
DeleteVideoObject(FontObjs[FontIndex]);
|
||||
FontObjs[FontIndex]=NULL;
|
||||
@@ -728,9 +728,8 @@ UINT32 GetHeight(HVOBJECT hSrcVObject, INT16 ssIndex)
|
||||
//*****************************************************************************
|
||||
UINT16 GetFontHeight(INT32 FontNum)
|
||||
{
|
||||
Assert(FontNum >= 0);
|
||||
Assert(FontNum <= MAX_FONTS);
|
||||
Assert(FontObjs[FontNum]!=NULL);
|
||||
Assert(IsFontLoaded(FontNum));
|
||||
|
||||
if ( iUseWinFonts ) {
|
||||
INT32 MapFont;
|
||||
MapFont = WinFontMap[FontNum];
|
||||
@@ -974,9 +973,6 @@ CHAR16 GetUnicodeChar(CHAR16 siChar)
|
||||
//*****************************************************************************
|
||||
BOOLEAN SetFont(INT32 iFontIndex)
|
||||
{
|
||||
//Assert(iFontIndex >= 0);
|
||||
//Assert(iFontIndex <= MAX_FONTS);
|
||||
//Assert(FontObjs[iFontIndex]!=NULL);
|
||||
SGP_THROW_IFFALSE( iFontIndex >= 0 ,"negative font index");
|
||||
SGP_THROW_IFFALSE( iFontIndex <= MAX_FONTS, "font index > MAX_FONTS" );
|
||||
SGP_THROW_IFFALSE( FontObjs[iFontIndex]!=NULL, "font is not initialized" );
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
//#endif
|
||||
#include "Font Control.h"
|
||||
|
||||
#define MAX_FONTS 25
|
||||
|
||||
#define DEFAULT_SHADOW 2
|
||||
#define MILITARY_SHADOW 67
|
||||
#define NO_SHADOW 0
|
||||
@@ -129,6 +131,7 @@ UINT16 *GetFontObjectPalette16BPP(INT32 iFont);
|
||||
|
||||
void DestroyEnglishTransTable( void );
|
||||
|
||||
extern BOOLEAN IsFontLoaded(INT32 iFont);
|
||||
extern HVOBJECT GetFontObject(INT32 iFont);
|
||||
extern UINT32 gprintf(INT32 x, INT32 y, const STR16 pFontString, ...);
|
||||
extern UINT32 gprintfDirty(INT32 x, INT32 y, const STR16 pFontString, ...);
|
||||
|
||||
Reference in New Issue
Block a user