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
+162 -163
View File
@@ -39,9 +39,9 @@
#include "gameloop.h"
#include "sysutil.h"
#include "tile surface.h"
#include <vector>
#endif
#ifdef JA2EDITOR
#include "Soldier Init List.h"
extern SOLDIERINITNODE *gpSelected;
@@ -70,7 +70,7 @@ typedef struct
typedef struct
{
HVOBJECT vo;
UINT16 usSubIndex;
UINT16 usSubIndex;
UINT32 fType;
} SMALL_TILE_DB;
@@ -78,7 +78,7 @@ typedef struct
SMALL_TILE_SURF gSmTileSurf[ NUMBEROFTILETYPES ];
SMALL_TILE_DB gSmTileDB[ NUMBEROFTILES ];
UINT8 gubSmTileNum = 0;
UINT8 gubSmTileNum = 0;
BOOLEAN gfSmTileLoaded = FALSE;
BOOLEAN gfInOverheadMap = FALSE;
MOUSE_REGION OverheadRegion;
@@ -116,8 +116,8 @@ void RenderOverheadOverlays();
void InitNewOverheadDB( UINT8 ubTilesetID )
{
UINT32 uiLoop;
VOBJECT_DESC VObjectDesc;
HVOBJECT hVObject;
VOBJECT_DESC VObjectDesc;
HVOBJECT hVObject;
CHAR8 cFileBPP[128];
CHAR8 cAdjustedFile[ 128 ];
UINT32 cnt1, cnt2;
@@ -125,7 +125,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
UINT32 NumRegions;
UINT32 dbSize = 0;
for (uiLoop = 0; uiLoop < NUMBEROFTILETYPES; uiLoop++)
{
@@ -135,7 +135,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
FilenameForBPP( gTilesets[ ubTilesetID ].TileSurfaceFilenames[ uiLoop ], cFileBPP);
// Adjust for tileset position
sprintf( cAdjustedFile, "TILESETS\\%d\\T\\%s", ubTilesetID, cFileBPP );
sprintf( cAdjustedFile, "TILESETS\\%d\\T\\%s", ubTilesetID, cFileBPP );
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
strcpy( VObjectDesc.ImageFile, cAdjustedFile);
@@ -146,7 +146,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
// TRY loading from default directory
FilenameForBPP( gTilesets[ TLS_GENERIC_1 ].TileSurfaceFilenames[ uiLoop ], cFileBPP);
// Adjust for tileset position
sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP );
sprintf( cAdjustedFile, "TILESETS\\0\\T\\%s", cFileBPP );
// LOAD ONE WE KNOW ABOUT!
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
@@ -173,7 +173,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
s = gSmTileSurf[ cnt1 ];
NumRegions = s.vo->usNumberOfObjects;
// Check for overflow
if ( NumRegions > gNumTilesPerType[ cnt1 ] )
{
@@ -215,7 +215,7 @@ void InitNewOverheadDB( UINT8 ubTilesetID )
INT16 sX1, sY1, sX2, sY2;
CalculateRestrictedMapCoords( NORTH, &sX1, &sY1, &sX2, &gsStartRestrictedY, iOffsetHorizontal + 640, iOffsetVertical + 320 );
CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &gsStartRestrictedX, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 );
CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &gsStartRestrictedX, &sY2, iOffsetHorizontal + 640, iOffsetVertical + 320 );
}
// Copy over shade tables from main tileset
@@ -237,24 +237,24 @@ void DeleteOverheadDB( )
BOOLEAN GetClosestItemPool( INT16 sSweetGridNo, ITEM_POOL **ppReturnedItemPool, UINT8 ubRadius, INT8 bLevel )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sGridNo;
INT32 uiRange, uiLowestRange = 999999;
INT32 leftmost;
BOOLEAN fFound = FALSE;
ITEM_POOL *pItemPool;
//create dummy soldier, and use the pathing to determine which nearby slots are
//reachable.
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
uiLowestRange = 999999;
sLeft = - ubRadius;
sRight = ubRadius;
uiLowestRange = 999999;
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
{
@@ -286,23 +286,23 @@ BOOLEAN GetClosestItemPool( INT16 sSweetGridNo, ITEM_POOL **ppReturnedItemPool,
BOOLEAN GetClosestMercInOverheadMap( INT16 sSweetGridNo, SOLDIERTYPE **ppReturnedSoldier, UINT8 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sGridNo;
INT32 uiRange, uiLowestRange = 999999;
INT32 leftmost;
BOOLEAN fFound = FALSE;
//create dummy soldier, and use the pathing to determine which nearby slots are
//reachable.
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
uiLowestRange = 999999;
sLeft = - ubRadius;
sRight = ubRadius;
uiLowestRange = 999999;
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
{
@@ -315,7 +315,7 @@ BOOLEAN GetClosestMercInOverheadMap( INT16 sSweetGridNo, SOLDIERTYPE **ppReturne
if( sGridNo >=0 && sGridNo < WORLD_MAX && sGridNo >= leftmost && sGridNo < ( leftmost + WORLD_COLS ) )
{
// Go on sweet stop
if ( gpWorldLevelData[ sGridNo ].pMercHead != NULL && gpWorldLevelData[ sGridNo ].pMercHead->pSoldier->bVisible != -1 )
if ( gpWorldLevelData[ sGridNo ].pMercHead != NULL && gpWorldLevelData[ sGridNo ].pMercHead->pSoldier->bVisible != -1 )
{
uiRange = GetRangeInCellCoordsFromGridNoDiff( sSweetGridNo, sGridNo );
@@ -398,7 +398,7 @@ void HandleOverheadMap( )
// Force load
gfSmTileLoaded = FALSE;
}
}
}
gubSmTileNum = (UINT8)giCurrentTilesetID;
@@ -410,12 +410,12 @@ void HandleOverheadMap( )
InitNewOverheadDB( gubSmTileNum );
gfSmTileLoaded = TRUE;
}
// restore background rects
RestoreBackgroundRects( );
// Render the overhead map
RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal,
RenderOverheadMap( 0, (WORLD_COLS / 2), iOffsetHorizontal,
iOffsetVertical, 640 + iOffsetHorizontal, 320 + iOffsetVertical, FALSE );
HandleTalkingAutoFaces( );
@@ -436,7 +436,7 @@ void HandleOverheadMap( )
HandleOverheadUI();
if ( !gfInOverheadMap )
{
{
return;
}
RenderTacticalInterface( );
@@ -448,74 +448,73 @@ void HandleOverheadMap( )
// RenderClock( CLOCK_X, CLOCK_Y );
// RenderTownIDString( );
HandleAutoFaces( );
HandleAutoFaces( );
}
}
if( !gfEditMode && !gfTacticalPlacementGUIActive )
{
INT16 usMapPos;
INT16 sMapPos;
ITEM_POOL *pItemPool;
gfUIHandleSelectionAboveGuy = FALSE;
HandleAnyMercInSquadHasCompatibleStuff( (INT8) CurrentSquad( ), NULL, TRUE );
if ( GetOverheadMouseGridNo( &usMapPos ) )
if ( GetOverheadMouseGridNo( &sMapPos ) )
{
// ATE: Find the closest item pool within 5 tiles....
if ( GetClosestItemPool( usMapPos, &pItemPool, 1, 0 ) )
if ( GetClosestItemPool( sMapPos, &pItemPool, 1, 0 ) )
{
STRUCTURE *pStructure = NULL;
INT16 sIntTileGridNo;
INT8 bZLevel = 0;
INT16 sActionGridNo = usMapPos;
INT16 sActionGridNo = sMapPos;
// Get interactive tile...
if ( ConditionalGetCurInteractiveTileGridNoAndStructure( &sIntTileGridNo , &pStructure, FALSE ) )
{
sActionGridNo = sIntTileGridNo;
}
bZLevel = GetZLevelOfItemPoolGivenStructure( sActionGridNo, 0, pStructure );
if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) )
{
DrawItemPoolList( pItemPool, usMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos );
DrawItemPoolList( pItemPool, sMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, gusMouseYPos );
gfOverItemPool = TRUE;
gsOveritemPoolGridNo = pItemPool->sGridNo;
}
}
if ( GetClosestItemPool( usMapPos, &pItemPool, 1, 1 ) )
if ( GetClosestItemPool( sMapPos, &pItemPool, 1, 1 ) )
{
INT8 bZLevel = 0;
INT16 sActionGridNo = usMapPos;
if ( AnyItemsVisibleOnLevel( pItemPool, bZLevel ) )
{
DrawItemPoolList( pItemPool, usMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, (UINT16)( gusMouseYPos - 5 ) );
DrawItemPoolList( pItemPool, sMapPos , ITEMLIST_DISPLAY, bZLevel, gusMouseXPos, (UINT16)( gusMouseYPos - 5 ) );
gfOverItemPool = TRUE;
gsOveritemPoolGridNo = pItemPool->sGridNo;
}
}
}
}
if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &usMapPos ) )
{
if ( GetClosestMercInOverheadMap( usMapPos, &pSoldier, 1 ) )
if ( GetOverheadMouseGridNoForFullSoldiersGridNo( &sMapPos ) )
{
if ( GetClosestMercInOverheadMap( sMapPos, &pSoldier, 1 ) )
{
if ( pSoldier->bTeam == gbPlayerNum )
{
gfUIHandleSelectionAboveGuy = TRUE;
gsSelectedGuy = pSoldier->ubID;
}
if ( pSoldier->bTeam == gbPlayerNum )
{
gfUIHandleSelectionAboveGuy = TRUE;
gsSelectedGuy = pSoldier->ubID;
}
DisplayMercNameInOverhead( pSoldier );
}
DisplayMercNameInOverhead( pSoldier );
}
}
}
@@ -528,7 +527,7 @@ void HandleOverheadMap( )
{
pSoldier = MercPtrs[ gusSelectedSoldier ];
DisplayMercNameInOverhead( pSoldier );
DisplayMercNameInOverhead( pSoldier );
}
RenderButtons( );
@@ -553,7 +552,7 @@ BOOLEAN InOverheadMap( )
void GoIntoOverheadMap( )
{
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
HVOBJECT hVObject;
gfInOverheadMap = TRUE;
@@ -565,13 +564,13 @@ void GoIntoOverheadMap( )
iOffsetVertical = (SCREEN_HEIGHT - 160) / 2 - 160; // Vertical start position of the overview map
MSYS_DefineRegion( &OverheadBackgroundRegion, 0, 0 , SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH,
CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
//Add region
MSYS_AddRegion( &OverheadBackgroundRegion );
MSYS_DefineRegion( &OverheadRegion, 0, 0 , SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH,
CURSOR_NORMAL, MoveOverheadRegionCallback, ClickOverheadRegionCallback );
CURSOR_NORMAL, MoveOverheadRegionCallback, ClickOverheadRegionCallback );
// Add region
MSYS_AddRegion( &OverheadRegion );
@@ -608,9 +607,9 @@ void GoIntoOverheadMap( )
// Add shades to persons....
GetVideoObject( &hVObject, uiPERSONS );
hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 256, 256, 256, FALSE );
hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 310, 310, 310, FALSE );
hVObject->pShades[ 2 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 0, 0, 0, FALSE );
hVObject->pShades[ 0 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 256, 256, 256, FALSE );
hVObject->pShades[ 1 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 310, 310, 310, FALSE );
hVObject->pShades[ 2 ] = Create16BPPPaletteShaded( hVObject->pPaletteEntry, 0, 0, 0, FALSE );
gfOverheadMapDirty = TRUE;
@@ -637,7 +636,7 @@ void GoIntoOverheadMap( )
void HandleOverheadUI( )
{
InputAtom InputEvent;
InputAtom InputEvent;
INT16 sMousePos=0;
UINT8 ubID;
@@ -645,7 +644,7 @@ void HandleOverheadUI( )
if ( GetOverheadMouseGridNo( &sMousePos ) )
{
// Look quickly for a soldier....
ubID = QuickFindSoldier( sMousePos );
ubID = QuickFindSoldier( sMousePos );
if ( ubID != NOBODY )
{
@@ -658,10 +657,10 @@ void HandleOverheadUI( )
}
}
while (DequeueEvent(&InputEvent) == TRUE)
{
if( ( InputEvent.usEvent == KEY_DOWN ) )
{
while (DequeueEvent(&InputEvent) == TRUE)
{
if( ( InputEvent.usEvent == KEY_DOWN ) )
{
switch( InputEvent.usParam )
{
case( ESC ):
@@ -677,7 +676,7 @@ void HandleOverheadUI( )
}
break;
}
}
}
}
}
@@ -702,7 +701,7 @@ void KillOverheadMap()
INT16 GetOffsetLandHeight( INT32 sGridNo )
{
INT16 sTileHeight;
sTileHeight = gpWorldLevelData[ sGridNo ].sHeight;
return( sTileHeight );
@@ -739,7 +738,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
INT16 sX, sY;
UINT32 uiDestPitchBYTES;
UINT8 *pDestBuf;
LEVELNODE *pNode;
LEVELNODE *pNode;
SMALL_TILE_DB *pTile;
INT16 sHeight;
HVOBJECT hVObject;
@@ -794,7 +793,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
do
{
// / 5 -> / 3
// / 5->/ 3
usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M );
@@ -814,8 +813,8 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
// RENDER!
//BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, gSmallTileDatabase[ gpWorldLevelData[ usTileIndex ].pLandHead->usIndex ], sX, sY, VO_BLT_SRCTRANSPARENCY, NULL );
//BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL );
//BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, gSmallTileDatabase[ gpWorldLevelData[ usTileIndex ].pLandHead->usIndex ], sX, sY, VO_BLT_SRCTRANSPARENCY, NULL );
//BltVideoObjectFromIndex( FRAME_BUFFER, SGR1, 0, sX, sY, VO_BLT_SRCTRANSPARENCY, NULL );
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
pNode = pNode->pPrevNode;
@@ -829,7 +828,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
if ( sTempPosX_S >= sEndXS )
{
fEndRenderRow = TRUE;
fEndRenderRow = TRUE;
}
} while( !fEndRenderRow );
@@ -842,7 +841,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
{
sAnchorPosX_M ++;
}
bXOddFlag = !bXOddFlag;
sAnchorPosY_S += 2;
@@ -956,7 +955,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
sX = sTempPosX_S;
sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5);
if( gTileDatabase[ pNode->usIndex ].uiFlags & IGNORE_WORLD_HEIGHT )
{
sY -= sModifiedHeight;
@@ -978,14 +977,14 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
pNode = pNode->pNext;
}
}
sTempPosX_S += 8;
sTempPosX_M ++;
sTempPosY_M --;
if ( sTempPosX_S >= sEndXS )
{
fEndRenderRow = TRUE;
fEndRenderRow = TRUE;
}
} while( !fEndRenderRow );
@@ -998,7 +997,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
{
sAnchorPosX_M ++;
}
bXOddFlag = !bXOddFlag;
sAnchorPosY_S += 2;
@@ -1012,7 +1011,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
while( !fEndRenderCol );
//if ( !fFromMapUtility && !gfEditMode )
{
{
// ROOF RENDR LOOP
// Begin Render Loop
@@ -1044,30 +1043,30 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
{
sHeight=( GetOffsetLandHeight(usTileIndex) /5);
pNode = gpWorldLevelData[ usTileIndex ].pRoofHead;
while( pNode != NULL )
{
if ( pNode->usIndex < NUMBEROFTILES )
{
if ( !( pNode->uiFlags & LEVELNODE_HIDDEN ) )
{
pTile = &( gSmTileDB[ pNode->usIndex ] );
pNode = gpWorldLevelData[ usTileIndex ].pRoofHead;
while( pNode != NULL )
{
if ( pNode->usIndex < NUMBEROFTILES )
{
if ( !( pNode->uiFlags & LEVELNODE_HIDDEN ) )
{
pTile = &( gSmTileDB[ pNode->usIndex ] );
sX = sTempPosX_S;
sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5) -sHeight;
sX = sTempPosX_S;
sY = sTempPosY_S - (gTileDatabase[ pNode->usIndex ].sOffsetHeight/5) -sHeight;
sY -= ( WALL_HEIGHT/5 );
sY -= ( WALL_HEIGHT/5 );
sY += ( gsRenderHeight / 5 );
sY += ( gsRenderHeight / 5 );
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
pTile->vo->pShadeCurrent= gSmTileSurf[ pTile->fType ].vo->pShades[pNode->ubShadeLevel];
// RENDER!
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
}
}
pNode = pNode->pNext;
}
// RENDER!
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, pTile->vo, sX, sY, pTile->usSubIndex );
}
}
pNode = pNode->pNext;
}
}
sTempPosX_S += 8;
@@ -1076,7 +1075,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
if ( sTempPosX_S >= sEndXS )
{
fEndRenderRow = TRUE;
fEndRenderRow = TRUE;
}
} while( !fEndRenderRow );
@@ -1089,7 +1088,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
{
sAnchorPosX_M ++;
}
bXOddFlag = !bXOddFlag;
sAnchorPosY_S += 2;
@@ -1109,16 +1108,16 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
if ( gMapInformation.ubRestrictedScrollID != 0 )
{
CalculateRestrictedMapCoords( NORTH, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
CalculateRestrictedMapCoords( EAST, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
CalculateRestrictedMapCoords( SOUTH, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
CalculateRestrictedMapCoords( WEST, &sX1, &sY1, &sX2, &sY2, sEndXS, sEndYS );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
ColorFillVideoSurfaceArea( FRAME_BUFFER, sX1, sY1, sX2, sY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) );
}
if ( !fFromMapUtility )
@@ -1127,31 +1126,31 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart
BltVideoObjectFromIndex( FRAME_BUFFER, uiOVERMAP, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL );
}
// Update the save buffer
{
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
UINT16 usWidth, usHeight;
UINT8 ubBitDepth;
// Update saved buffer - do for the viewport size ony!
GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth );
// Update the save buffer
{
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
UINT16 usWidth, usHeight;
UINT8 ubBitDepth;
pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES);
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
// Update saved buffer - do for the viewport size ony!
GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth );
if(gbPixelDepth==16)
{
// BLIT HERE
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0, 0, 0, 0, usWidth, usHeight );
}
pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES);
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
UnLockVideoSurface(guiRENDERBUFFER);
UnLockVideoSurface(guiSAVEBUFFER);
if(gbPixelDepth==16)
{
// BLIT HERE
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0, 0, 0, 0, usWidth, usHeight );
}
}
UnLockVideoSurface(guiRENDERBUFFER);
UnLockVideoSurface(guiSAVEBUFFER);
}
}
}
@@ -1172,7 +1171,7 @@ void RenderOverheadOverlays()
GetVideoObject( &hVObject, uiPERSONS );
//SOLDIER OVERLAY
//SOLDIER OVERLAY
if( gfTacticalPlacementGUIActive )
{ //loop through only the player soldiers
end = gTacticalStatus.Team[ OUR_TEAM ].bLastID;
@@ -1188,8 +1187,8 @@ void RenderOverheadOverlays()
pSoldier = MercPtrs[ i ];
if( !pSoldier->bActive || !pSoldier->bInSector )
continue;
//Soldier is here. Calculate his screen position based on his current gridno.
//Soldier is here. Calculate his screen position based on his current gridno.
GetOverheadScreenXYFromGridNo( pSoldier->sGridNo, &sX, &sY );
//Now, draw his "doll"
@@ -1257,46 +1256,46 @@ void RenderOverheadOverlays()
#ifdef JA2EDITOR
if( gfEditMode && gpSelected && gpSelected->pSoldier == pSoldier )
{ //editor: show the selected edited merc as the yellow one.
{ //editor: show the selected edited merc as the yellow one.
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 0 );
}
else
#endif
if( !gfTacticalPlacementGUIActive )
{ //normal
{ //normal
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
}
else if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE )
else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE )
{ //vehicle
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 9 );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-6), (INT16)(sY), (INT16)(sX + 9), (INT16)(sY + 10));
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-6), (INT16)(sY), (INT16)(sX + 9), (INT16)(sY + 10));
}
//else if( pSoldier->uiStatusFlags & (SOLDIER_PASSENGER | SOLDIER_DRIVER) )
//else if( pSoldier->flags.uiStatusFlags & (SOLDIER_PASSENGER | SOLDIER_DRIVER) )
//{// //don't draw person, because they are inside the vehicle.
// ubPassengers++;
//}
else if( gpTacticalPlacementSelectedSoldier == pSoldier )
{ //tactical placement selected merc
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 7 );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
}
else if( gpTacticalPlacementHilightedSoldier == pSoldier && pSoldier->uiStatusFlags )
else if( gpTacticalPlacementHilightedSoldier == pSoldier && pSoldier->flags.uiStatusFlags )
{ //tactical placement hilighted merc
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 8 );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
}
else
{ //normal
{ //normal
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9));
}
if( ubPassengers )
{
SetFont( SMALLCOMPFONT );
SetFontForeground( FONT_WHITE );
gprintfdirty( (INT16)(sX - 3), sY, L"%d", ubPassengers );
mprintf_buffer( pDestBuf, uiDestPitchBYTES, SMALLCOMPFONT, sX - 3, sY , L"%d", ubPassengers );
mprintf_buffer( pDestBuf, uiDestPitchBYTES, SMALLCOMPFONT, sX - 3, sY , L"%d", ubPassengers );
}
}
@@ -1304,7 +1303,7 @@ void RenderOverheadOverlays()
//ITEMS OVERLAY
if( !gfTacticalPlacementGUIActive )
{
for( i = 0 ; i < guiNumWorldItems; i++ )
for( i = 0 ; i < guiNumWorldItems; i++ )
{
pWorldItem = &gWorldItems[ i ];
if( !pWorldItem || !pWorldItem->fExists || pWorldItem->bVisible != VISIBLE && !(gTacticalStatus.uiFlags & SHOW_ALL_ITEMS) )
@@ -1331,7 +1330,7 @@ void RenderOverheadOverlays()
{
sX += iOffsetHorizontal;
}
// Smaller maps
if (gsStartRestrictedY > 0)
{
@@ -1352,16 +1351,16 @@ void RenderOverheadOverlays()
}
else switch( pWorldItem->bVisible )
{
case HIDDEN_ITEM: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break;
case BURIED: usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); break;
case HIDDEN_IN_OBJECT: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break;
case INVISIBLE: usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); break;
case HIDDEN_ITEM: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break;
case BURIED: usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); break;
case HIDDEN_IN_OBJECT: usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); break;
case INVISIBLE: usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); break;
case VISIBLE: usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); break;
}
if ( gfOverItemPool && gsOveritemPoolGridNo == pWorldItem->sGridNo )
{
usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) );
usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) );
}
PixelDraw( FALSE, sX, sY, usLineColor, pDestBuf );
@@ -1387,7 +1386,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
INT16 sX, sY;
UINT32 uiDestPitchBYTES;
UINT8 *pDestBuf;
LEVELNODE *pNode;
LEVELNODE *pNode;
UINT16 usLineColor;
INT16 sHeight;
SOLDIERTYPE *pSoldier;
@@ -1434,7 +1433,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
sX = sTempPosX_S;
sY = sTempPosY_S - sHeight;
// RENDER!
if ( pNode->pItemPool->bVisible == -1 && !(gTacticalStatus.uiFlags & SHOW_ALL_ITEMS) )
if ( pNode->pItemPool->bVisible == -1 && !(gTacticalStatus.uiFlags & SHOW_ALL_ITEMS) )
{
}
@@ -1469,7 +1468,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
sY = sTempPosY_S - sHeight - 8; // 8 height of doll guy
// RENDER!
if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) )
if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) )
{
}
@@ -1496,7 +1495,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
}
#ifdef JA2EDITOR
if( gfEditMode && gpSelected && gpSelected->pSoldier == pSoldier )
{ //editor: show the selected edited merc as the yellow one.
{ //editor: show the selected edited merc as the yellow one.
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 0 );
}
else
@@ -1510,10 +1509,10 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, 8 );
}
else
{ //normal
{ //normal
Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam );
}
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, (INT16)(sX-2), (INT16)(sY-2), (INT16)(sX + 5), (INT16)(sY + 11));
}
pNode = pNode->pNext;
@@ -1526,7 +1525,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
if ( sTempPosX_S >= sEndXS )
{
fEndRenderRow = TRUE;
fEndRenderRow = TRUE;
}
} while( !fEndRenderRow );
@@ -1539,7 +1538,7 @@ void RenderOverheadOverlays( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 s
{
sAnchorPosX_M ++;
}
bXOddFlag = !bXOddFlag;
sAnchorPosY_S += 2;
@@ -1563,7 +1562,7 @@ void MoveInOverheadRegionCallback(MOUSE_REGION *reg, INT32 reason)
void ClickOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason)
{
UINT32 uiCellX, uiCellY;
INT16 sWorldScreenX, sWorldScreenY;
INT16 sWorldScreenX, sWorldScreenY;
if( gfTacticalPlacementGUIActive )
{
@@ -1627,7 +1626,7 @@ void MoveOverheadRegionCallback(MOUSE_REGION *reg,INT32 reason)
void GetOverheadScreenXYFromGridNo( INT16 sGridNo, INT16 *psScreenX, INT16 *psScreenY )
{
GetWorldXYAbsoluteScreenXY( (INT16)(CenterX( sGridNo ) / CELL_X_SIZE ), (INT16)( CenterY( sGridNo ) / CELL_Y_SIZE ), psScreenX, psScreenY );
GetWorldXYAbsoluteScreenXY( (INT16)(CenterX( sGridNo ) / CELL_X_SIZE ), (INT16)( CenterY( sGridNo ) / CELL_Y_SIZE ), psScreenX, psScreenY );
*psScreenX /= 5;
*psScreenY /= 5;
@@ -1635,14 +1634,14 @@ void GetOverheadScreenXYFromGridNo( INT16 sGridNo, INT16 *psScreenX, INT16 *psSc
*psScreenY += 5;
//Subtract the height....
//*psScreenY -= gpWorldLevelData[ sGridNo ].sHeight / 5;
//*psScreenY -= gpWorldLevelData[ sGridNo ].sHeight / 5;
}
// WANNE: Fixed bug from sir tech, which occured on smaller maps ;-)
BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo )
{
UINT32 uiCellX, uiCellY;
INT16 sWorldScreenX, sWorldScreenY;
INT16 sWorldScreenX, sWorldScreenY;
if ( ( OverheadRegion.uiFlags & MSYS_MOUSE_IN_AREA ) )
{
@@ -1697,7 +1696,7 @@ BOOLEAN GetOverheadMouseGridNo( INT16 *psGridNo )
BOOLEAN GetOverheadMouseGridNoForFullSoldiersGridNo( INT16 *psGridNo )
{
UINT32 uiCellX, uiCellY;
INT16 sWorldScreenX, sWorldScreenY;
INT16 sWorldScreenX, sWorldScreenY;
if ( ( OverheadRegion.uiFlags & MSYS_MOUSE_IN_AREA ) )
{
@@ -1787,7 +1786,7 @@ void CalculateRestrictedMapCoords( INT8 bDirection, INT16 *psX1, INT16 *psY1, IN
void CopyOverheadDBShadetablesFromTileset( )
{
UINT32 uiLoop, uiLoop2;
PTILE_IMAGERY pTileSurf;
PTILE_IMAGERY pTileSurf;
// Loop through tileset
@@ -1802,7 +1801,7 @@ void CopyOverheadDBShadetablesFromTileset( )
gSmTileSurf[ uiLoop ].vo->pShades[ uiLoop2 ] = pTileSurf->vo->pShades[ uiLoop2 ];
}
}
}
void TrashOverheadMap( )
@@ -1815,5 +1814,5 @@ void TrashOverheadMap( )
// Force load
gfSmTileLoaded = FALSE;
}
}
}
}