New option AUTO_HIDE_PB (TRUE) enables auto hiding of the progress bar when mouse cursor is on the top map row.

AI soldiers will now avoid staying at top map row.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8723 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-01-05 08:20:42 +00:00
parent 58308434f7
commit f10590587a
8 changed files with 104 additions and 18 deletions
+5 -2
View File
@@ -919,8 +919,11 @@ void LoadGameExternalOptions()
// Are enemy females restricted to Blackshirts only?
gGameExternalOptions.fRestrictFemaleEnemiesExceptElite = iniReader.ReadBoolean("Graphics Settings","RESTRICT_FEMALE_ENEMIES_EXCEPT_ELITE",FALSE);
// New setting to allow thin progressbar
gGameExternalOptions.fSmallSizeProgressbar = iniReader.ReadBoolean("Graphics Settings", "SMALL_SIZE_PB", FALSE);
// New setting to allow thin progress bar
gGameExternalOptions.fSmallSizeProgressBar = iniReader.ReadBoolean("Graphics Settings", "SMALL_SIZE_PB", FALSE);
// New setting to allow auto hiding progress bar
gGameExternalOptions.fAutoHideProgressBar = iniReader.ReadBoolean("Graphics Settings", "AUTO_HIDE_PB", TRUE);
// anv: hide stuff on roof in explored rooms at ground level view (sandbags and other crap)
gGameExternalOptions.fHideExploredRoomRoofStructures = iniReader.ReadBoolean("Graphics Settings", "HIDE_EXPLORED_ROOM_ROOF_STRUCTURES", TRUE);
+2 -1
View File
@@ -870,7 +870,8 @@ typedef struct
INT32 iQuickItem0;
// for small progress bar
BOOLEAN fSmallSizeProgressbar;
BOOLEAN fSmallSizeProgressBar;
BOOLEAN fAutoHideProgressBar;
// anv: hide stuff on roof in explored rooms at ground level view (sandbags and other crap)
BOOLEAN fHideExploredRoomRoofStructures;
//enable ext mouse key
+7 -2
View File
@@ -3469,7 +3469,7 @@ BOOLEAN InitSaveDir()
// WDS - Automatically try to save when an assertion failure occurs
extern bool alreadySaving = false;
extern bool bHideTopMessage;
BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
{
@@ -3786,8 +3786,13 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
FileWrite( hFile, &gGameOptions, sizeof( GAME_OPTIONS ), &uiNumBytesWritten );
//
//Save the gTactical Status array, plus the curent secotr location
//Save the gTactical Status array, plus the current sector location
//
// sevenfm: enable fInTopMessage if top bar is hidden, to correctly show it after loading game
if (bHideTopMessage)
gTacticalStatus.fInTopMessage = TRUE;
if( !SaveTacticalStatusToSavedGame( hFile ) )
{
ScreenMsg( FONT_MCOLOR_WHITE, MSG_ERROR, L"ERROR writing tactical status");
+25
View File
@@ -786,6 +786,9 @@ UINT32 HandleTacticalUI( void )
return( ReturnVal );
}
bool bHideTopMessage = false;
extern INT32 HEIGHT_PROGRESSBAR;
void SetUIMouseCursor( )
{
UINT32 uiCursorFlags;
@@ -794,6 +797,28 @@ void SetUIMouseCursor( )
BOOLEAN fUpdateNewCursor = TRUE;
static INT32 sOldExitGridNo = NOWHERE;
static BOOLEAN fOkForExit = FALSE;
INT32 usGridNo;
// sevenfm: hide top bar
if (gusMouseYPos <= HEIGHT_PROGRESSBAR &&
GetMouseMapPos(&usGridNo) &&
!TileIsOutOfBounds(usGridNo) &&
NorthSpot(usGridNo, gsInterfaceLevel) &&
!bHideTopMessage &&
gTacticalStatus.fInTopMessage)
{
bHideTopMessage = true;
EndTopMessage();
}
// sevenfm: reveal top bar
if (gusMouseYPos > HEIGHT_PROGRESSBAR &&
!gfUIFullTargetFound &&
bHideTopMessage)
{
gTacticalStatus.fInTopMessage = TRUE;
bHideTopMessage = false;
}
// Check if we moved from confirm mode on exit arrows
// If not in move mode, return!
+13 -13
View File
@@ -418,7 +418,7 @@ BOOLEAN InitializeTacticalInterface( )
}
//*ddd{
if( gGameExternalOptions.fSmallSizeProgressbar )
if( gGameExternalOptions.fSmallSizeProgressBar )
{
HEIGHT_PROGRESSBAR = 7;
PROG_BAR_START_Y = 0;
@@ -4688,7 +4688,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution >= _640x480 && iResolution < _800x600)
{
iProgBarLength = 640 - 13;
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\rect_Thin.sti";
else
fn = "INTERFACE\\rect.sti";
@@ -4696,7 +4696,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
else if (iResolution < _1024x768)
{
iProgBarLength = 800 - 13;
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\rect_800x600Thin.sti";
else
fn = "INTERFACE\\rect_800x600.sti";
@@ -4704,7 +4704,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
else
{
iProgBarLength = 1024 - 13;
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\rect_1024x768Thin.sti";
else
fn = "INTERFACE\\rect_1024x768.sti";
@@ -4720,21 +4720,21 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution >= _640x480 && iResolution < _800x600)
{
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\timebargreen_Thin.sti";
else
fn = "INTERFACE\\timebargreen.sti";
}
else if (iResolution < _1024x768)
{
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\timebargreen_800x600Thin.sti";
else
fn = "INTERFACE\\timebargreen_800x600.sti";
}
else
{
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\timebargreen_1024x768Thin.sti";
else
fn = "INTERFACE\\timebargreen_1024x768.sti";
@@ -4749,21 +4749,21 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
if (iResolution >= _640x480 && iResolution < _800x600)
{
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\timebaryellow_Thin.sti";
else
fn = "INTERFACE\\timebaryellow.sti";
}
else if (iResolution < _1024x768)
{
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\timebaryellow_800x600Thin.sti";
else
fn = "INTERFACE\\timebaryellow_800x600.sti";
}
else
{
if (gGameExternalOptions.fSmallSizeProgressbar)
if (gGameExternalOptions.fSmallSizeProgressBar)
fn = "INTERFACE\\timebaryellow_1024x768Thin.sti";
else
fn = "INTERFACE\\timebaryellow_1024x768.sti";
@@ -4878,7 +4878,7 @@ void CreateTopMessage( UINT32 uiSurface, UINT8 ubType, STR16 psString )
DeleteVideoObjectFromIndex( uiPLAYERBAR );
// Draw text....
if(gGameExternalOptions.fSmallSizeProgressbar)
if(gGameExternalOptions.fSmallSizeProgressBar)
FindFontCenterCoordinates( SCREEN_WIDTH/2, 2, 1, 1, psString, TINYFONT1, &sX, &sY );
else
FindFontCenterCoordinates( SCREEN_WIDTH/2, 7, 1, 1, psString, TINYFONT1, &sX, &sY );
@@ -5047,7 +5047,7 @@ void HandleTopMessages( )
// Redner!
BltFx.SrcRect.iLeft = 0;
//* ddd BltFx.SrcRect.iTop = 20 - gTopMessage.bYPos;
if(gGameExternalOptions.fSmallSizeProgressbar)
if(gGameExternalOptions.fSmallSizeProgressBar)
BltFx.SrcRect.iTop = 0;
else
BltFx.SrcRect.iTop = 20 - gTopMessage.bYPos;
@@ -5063,7 +5063,7 @@ void HandleTopMessages( )
// Save to save buffer....
BltFx.SrcRect.iLeft = 0;
//* ddd BltFx.SrcRect.iTop = 0;
if(gGameExternalOptions.fSmallSizeProgressbar)
if(gGameExternalOptions.fSmallSizeProgressBar)
BltFx.SrcRect.iTop = 0;
else
BltFx.SrcRect.iTop = 20 - gTopMessage.bYPos;
+19
View File
@@ -4131,3 +4131,22 @@ UINT8 CountSeenEnemiesLastTurn( SOLDIERTYPE* pSoldier )
return cnt;
}
BOOLEAN NorthSpot(INT32 sSpot, INT8 bLevel)
{
if (TileIsOutOfBounds(sSpot))
return FALSE;
if (bLevel > 0)
return FALSE;
INT32 sNextSpot = NewGridNo(sSpot, DirectionInc(NORTHWEST));
if (gubWorldMovementCosts[sSpot + DirectionInc(NORTHWEST)][NORTHWEST][0] == TRAVELCOST_OFF_MAP ||
gubWorldMovementCosts[sNextSpot + DirectionInc(NORTHWEST)][NORTHWEST][0] == TRAVELCOST_OFF_MAP)
{
return TRUE;
}
return FALSE;
}
+31
View File
@@ -1032,6 +1032,12 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
continue;
}
// sevenfm: avoid staying at north edge
if (NorthSpot(sGridNo, pSoldier->pathing.bLevel))
{
continue;
}
iPathCost = gubAIPathCosts[AI_PATHCOST_RADIUS + sXOffset][AI_PATHCOST_RADIUS + sYOffset];
/*
// water is OK, if the only good hiding place requires us to get wet, OK
@@ -1475,6 +1481,13 @@ INT32 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier)
if ( InLightAtNight( sGridNo, pSoldier->pathing.bLevel ) )
continue;
// sevenfm: avoid staying at north edge
if (!gGameExternalOptions.fAITacticalRetreat &&
NorthSpot(sGridNo, pSoldier->pathing.bLevel))
{
continue;
}
// OK, this place shows potential. How useful is it as cover?
//NumMessage("Promising seems gridno #",gridno);
@@ -1615,6 +1628,12 @@ INT32 FindNearestUngassedLand(SOLDIERTYPE *pSoldier)
continue;
}
// sevenfm: avoid staying at north edge
if (NorthSpot(sGridNo, pSoldier->pathing.bLevel))
{
continue;
}
// CJC: here, unfortunately, we must calculate a path so we have an AP cost
// obviously, we're looking for LAND, so water is out!
@@ -1728,6 +1747,12 @@ INT32 FindNearbyDarkerSpot( SOLDIERTYPE *pSoldier )
continue;
}
// sevenfm: avoid staying at north edge
if (NorthSpot(sGridNo, pSoldier->pathing.bLevel))
{
continue;
}
// require this character to stay within their roam range
if ( PythSpacesAway( sOrigin, sGridNo ) > iRoamRange )
{
@@ -2663,6 +2688,12 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction )
continue;
}
// sevenfm: avoid staying at north edge
if (NorthSpot(sGridNo, pSoldier->pathing.bLevel))
{
continue;
}
// sevenfm: penalize locations near fresh corpses
if( GetNearestRottingCorpseAIWarning( sGridNo ) > 0 )
{
+2
View File
@@ -300,6 +300,8 @@ BOOLEAN FindBombNearby( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistance )
BOOLEAN AnyCoverFromSpot( INT32 sSpot, INT8 bLevel, INT32 sThreatLoc, INT8 bThreatLevel );
UINT8 CountSeenEnemiesLastTurn( SOLDIERTYPE *pSoldier );
BOOLEAN NorthSpot(INT32 sSpot, INT8 bLevel);
#define MAX_FLANKS_RED 25
#define MAX_FLANKS_YELLOW 25