Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+57 -57
View File
@@ -57,11 +57,11 @@ STR8 zMercBorderPopupFilenames[ ] = {
// filenames for background popup .pcx's
STR8 zMercBackgroundPopupFilenames[ ] = {
"INTERFACE\\TactPopupBackground.pcx",
"INTERFACE\\TactPopupWhiteBackground.pcx",
"INTERFACE\\TactPopupGreyBackground.pcx",
"INTERFACE\\TactPopupBackgroundMain.pcx",
"INTERFACE\\LaptopPopupBackground.pcx",
"INTERFACE\\TactPopupBackground.pcx",
"INTERFACE\\TactPopupWhiteBackground.pcx",
"INTERFACE\\TactPopupGreyBackground.pcx",
"INTERFACE\\TactPopupBackgroundMain.pcx",
"INTERFACE\\LaptopPopupBackground.pcx",
"INTERFACE\\imp_popup_background.pcx",
};
@@ -98,7 +98,7 @@ BOOLEAN SetCurrentPopUpBox( UINT32 uiId )
// see if box inited
if( gpPopUpBoxList[ uiId ] != NULL )
{
{
gPopUpTextBox = gpPopUpBoxList[ uiId ];
return( TRUE );
}
@@ -127,7 +127,7 @@ BOOLEAN ResetOverrideMercPopupBox( )
BOOLEAN InitMercPopupBox( )
{
INT32 iCounter = 0;
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
// init the pop up box list
for( iCounter = 0; iCounter < MAX_NUMBER_OF_POPUP_BOXES; iCounter++ )
@@ -174,17 +174,17 @@ void GetMercPopupBoxFontColor( UINT8 ubBackgroundIndex, UINT8 *pubFontColor, UIN
BOOLEAN LoadTextMercPopupImages( UINT8 ubBackgroundIndex, UINT8 ubBorderIndex)
{
VSURFACE_DESC vs_desc;
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
// this function will load the graphics associated with the background and border index values
// this function will load the graphics associated with the background and border index values
// the background
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE;
strcpy(vs_desc.ImageFile, zMercBackgroundPopupFilenames [ ubBackgroundIndex ]);
vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE;
strcpy(vs_desc.ImageFile, zMercBackgroundPopupFilenames [ ubBackgroundIndex ]);
CHECKF(AddVideoSurface(&vs_desc, &gPopUpTextBox->uiMercTextPopUpBackground));
// border
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
// border
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
FilenameForBPP( zMercBorderPopupFilenames[ ubBorderIndex ], VObjectDesc.ImageFile );
CHECKF( AddVideoObject( &VObjectDesc, &gPopUpTextBox->uiMercTextPopUpBorder ) );
@@ -206,7 +206,7 @@ void RemoveTextMercPopupImages( )
{
// the background
DeleteVideoSurfaceFromIndex( gPopUpTextBox->uiMercTextPopUpBackground );
// the border
DeleteVideoObjectFromIndex( gPopUpTextBox->uiMercTextPopUpBorder );
@@ -228,28 +228,28 @@ BOOLEAN RenderMercPopUpBoxFromIndex( INT32 iBoxId, INT16 sDestX, INT16 sDestY, U
}
// now attempt to render the box
return( RenderMercPopupBox( sDestX, sDestY, uiBuffer ) );
return( RenderMercPopupBox( sDestX, sDestY, uiBuffer ) );
}
BOOLEAN RenderMercPopupBox(INT16 sDestX, INT16 sDestY, UINT32 uiBuffer )
{
// UINT32 uiDestPitchBYTES;
// UINT32 uiSrcPitchBYTES;
// UINT16 *pDestBuf;
// UINT16 *pSrcBuf;
// UINT32 uiDestPitchBYTES;
// UINT32 uiSrcPitchBYTES;
// UINT16 *pDestBuf;
// UINT16 *pSrcBuf;
// will render/transfer the image from the buffer in the data structure to the buffer specified by user
BOOLEAN fReturnValue = TRUE;
// grab the destination buffer
// pDestBuf = ( UINT16* )LockVideoSurface( uiBuffer, &uiDestPitchBYTES );
// now lock it
// pSrcBuf = ( UINT16* )LockVideoSurface( gPopUpTextBox->uiSourceBufferIndex, &uiSrcPitchBYTES);
//check to see if we are wanting to blit a transparent background
//check to see if we are wanting to blit a transparent background
if ( gPopUpTextBox->uiFlags & MERC_POPUP_PREPARE_FLAGS_TRANS_BACK )
BltVideoSurface( uiBuffer, gPopUpTextBox->uiSourceBufferIndex, 0, sDestX, sDestY, VS_BLT_FAST | VS_BLT_USECOLORKEY, NULL );
else
@@ -257,8 +257,8 @@ BOOLEAN RenderMercPopupBox(INT16 sDestX, INT16 sDestY, UINT32 uiBuffer )
// blt, and grab return value
// fReturnValue = Blt16BPPTo16BPP(pDestBuf, uiDestPitchBYTES, pSrcBuf, uiSrcPitchBYTES, sDestX, sDestY, 0, 0, gPopUpTextBox->sWidth, gPopUpTextBox->sHeight);
// fReturnValue = Blt16BPPTo16BPP(pDestBuf, uiDestPitchBYTES, pSrcBuf, uiSrcPitchBYTES, sDestX, sDestY, 0, 0, gPopUpTextBox->sWidth, gPopUpTextBox->sHeight);
//Invalidate!
if ( uiBuffer == FRAME_BUFFER )
{
@@ -269,12 +269,12 @@ BOOLEAN RenderMercPopupBox(INT16 sDestX, INT16 sDestY, UINT32 uiBuffer )
// source
// UnLockVideoSurface( gPopUpTextBox->uiSourceBufferIndex );
// destination
// UnLockVideoSurface( uiBuffer );
// return success or failure
return fReturnValue;
return fReturnValue;
}
@@ -296,7 +296,7 @@ INT32 AddPopUpBoxToList( MercPopUpBox *pPopUpTextBox )
{
// found a spot, inset
gpPopUpBoxList[ iCounter ] = pPopUpTextBox;
// set as current
SetCurrentPopUpBox( iCounter );
@@ -315,23 +315,23 @@ MercPopUpBox * GetPopUpBoxIndex( INT32 iId )
return( gpPopUpBoxList[ iId ] );
}
INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorderIndex, STR16 pString,
UINT16 usWidth, UINT16 usMarginX, UINT16 usMarginTopY, UINT16 usMarginBottomY,
INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorderIndex, STR16 pString,
UINT16 usWidth, UINT16 usMarginX, UINT16 usMarginTopY, UINT16 usMarginBottomY,
UINT16 *pActualWidth, UINT16 *pActualHeight)
{
UINT16 usNumberVerticalPixels, usNumberOfLines;
UINT16 usTextWidth, usHeight;
UINT16 i;
HVOBJECT hImageHandle;
HVOBJECT hImageHandle;
UINT16 usPosY, usPosX;
VSURFACE_DESC vs_desc;
UINT16 usStringPixLength;
SGPRect DestRect;
HVSURFACE hSrcVSurface;
UINT32 uiDestPitchBYTES;
HVSURFACE hSrcVSurface;
UINT32 uiDestPitchBYTES;
UINT32 uiSrcPitchBYTES;
UINT16 *pDestBuf;
UINT8 *pSrcBuf;
UINT16 *pDestBuf;
UINT8 *pSrcBuf;
UINT8 ubFontColor, ubFontShadowColor;
UINT16 usColorVal;
UINT16 usLoopEnd;
@@ -348,7 +348,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
if( iBoxId == -1 )
{
// no box yet
// create box
pPopUpTextBox = (MercPopUpBox *) MemAlloc( sizeof( MercPopUpBox ) );
@@ -365,7 +365,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
}
else
{
// has been created already,
// has been created already,
// Check if these images are different
// grab box
@@ -373,7 +373,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
// box has valid id and no instance?..error
Assert( pPopUpTextBox );
// copy over ptr
gPopUpTextBox = pPopUpTextBox;
@@ -397,14 +397,14 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
if( usStringPixLength < ( usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 ) )
{
usWidth = usStringPixLength + MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X * 2;
usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1;
usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1;
}
else
{
usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1 - usMarginX;
usTextWidth = usWidth - ( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_X ) * 2 + 1 - usMarginX;
}
usNumberVerticalPixels = IanWrappedStringHeight(0,0, usTextWidth, 2, TEXT_POPUP_FONT, MERC_TEXT_COLOR, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
usNumberVerticalPixels = IanWrappedStringHeight(0,0, usTextWidth, 2, TEXT_POPUP_FONT, MERC_TEXT_COLOR, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
usNumberOfLines = usNumberVerticalPixels / TEXT_POPUP_GAP_BN_LINES;
@@ -464,12 +464,12 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
{
// Zero with yellow,
// Set source transparcenty
SetVideoSurfaceTransparency( pPopUpTextBox->uiSourceBufferIndex, FROMRGB( 255, 255, 0 ) );
SetVideoSurfaceTransparency( pPopUpTextBox->uiSourceBufferIndex, FROMRGB( 255, 255, 0 ) );
pDestBuf = (UINT16*)LockVideoSurface( pPopUpTextBox->uiSourceBufferIndex, &uiDestPitchBYTES);
pDestBuf = (UINT16*)LockVideoSurface( pPopUpTextBox->uiSourceBufferIndex, &uiDestPitchBYTES);
usColorVal = Get16BPPColor( FROMRGB( 255, 255, 0 ) );
usLoopEnd = ( usWidth * usHeight );
usLoopEnd = ( usWidth * usHeight );
for ( i = 0; i <usLoopEnd; i++ )
{
@@ -483,14 +483,14 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
{
if( !GetVideoSurface( &hSrcVSurface, pPopUpTextBox->uiMercTextPopUpBackground) )
{
AssertMsg( 0, String( "Failed to GetVideoSurface for PrepareMercPopupBox. VSurfaceID: %d",
AssertMsg( 0, String( "Failed to GetVideoSurface for PrepareMercPopupBox. VSurfaceID: %d",
pPopUpTextBox->uiMercTextPopUpBackground ) );
}
pDestBuf = (UINT16*)LockVideoSurface( pPopUpTextBox->uiSourceBufferIndex, &uiDestPitchBYTES);
pSrcBuf = LockVideoSurface( pPopUpTextBox->uiMercTextPopUpBackground, &uiSrcPitchBYTES);
Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,0,0, &DestRect);
Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,0,0, &DestRect);
UnLockVideoSurface( pPopUpTextBox->uiMercTextPopUpBackground);
UnLockVideoSurface(pPopUpTextBox->uiSourceBufferIndex);
@@ -503,17 +503,17 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
for(i=TEXT_POPUP_GAP_BN_LINES; i< usWidth-TEXT_POPUP_GAP_BN_LINES; i+=TEXT_POPUP_GAP_BN_LINES)
{
//TOP ROW
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 1,i, usPosY, VO_BLT_SRCTRANSPARENCY,NULL);
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 1,i, usPosY, VO_BLT_SRCTRANSPARENCY,NULL);
//BOTTOM ROW
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 6,i, usHeight - TEXT_POPUP_GAP_BN_LINES+6, VO_BLT_SRCTRANSPARENCY,NULL);
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 6,i, usHeight - TEXT_POPUP_GAP_BN_LINES+6, VO_BLT_SRCTRANSPARENCY,NULL);
}
//blit the left and right row of images
usPosX = 0;
for(i=TEXT_POPUP_GAP_BN_LINES; i< usHeight-TEXT_POPUP_GAP_BN_LINES; i+=TEXT_POPUP_GAP_BN_LINES)
{
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 3,usPosX, i, VO_BLT_SRCTRANSPARENCY,NULL);
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 4,usPosX+usWidth-4, i, VO_BLT_SRCTRANSPARENCY,NULL);
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 3,usPosX, i, VO_BLT_SRCTRANSPARENCY,NULL);
BltVideoObject(pPopUpTextBox->uiSourceBufferIndex, hImageHandle, 4,usPosX+usWidth-4, i, VO_BLT_SRCTRANSPARENCY,NULL);
}
//blt the corner images for the row
@@ -547,7 +547,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
if ( pPopUpTextBox->uiFlags & ( MERC_POPUP_PREPARE_FLAGS_STOPICON | MERC_POPUP_PREPARE_FLAGS_SKULLICON ) )
{
sDispTextXPos += 30;
sDispTextXPos += 30;
}
@@ -561,7 +561,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
}
//Display the text
DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
//Disable the use of single word wordwrap
UseSingleCharWordsForWordWrap( FALSE );
@@ -569,7 +569,7 @@ INT32 PrepareMercPopupBox( INT32 iBoxId, UINT8 ubBackgroundIndex, UINT8 ubBorde
#else
{
//Display the text
DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
DisplayWrappedString( sDispTextXPos, (INT16)(( MERC_TEXT_POPUP_WINDOW_TEXT_OFFSET_Y + usMarginTopY ) ), usTextWidth, 2, MERC_TEXT_FONT, ubFontColor, pString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
}
#endif
@@ -613,8 +613,8 @@ BOOLEAN RemoveMercPopupBox()
{
if( gpPopUpBoxList[ iCounter ] == gPopUpTextBox )
{
gpPopUpBoxList[ iCounter ] = NULL;
iCounter = MAX_NUMBER_OF_POPUP_BOXES;
gpPopUpBoxList[ iCounter ] = NULL;
iCounter = MAX_NUMBER_OF_POPUP_BOXES;
}
}
// yep, get rid of the bloody...