diff --git a/GameSettings.cpp b/GameSettings.cpp index 743748ee..6f68982f 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1047,9 +1047,6 @@ void LoadGameExternalOptions() // sevenfm: show health over enemy gGameExternalOptions.ubShowEnemyHealth = iniReader.ReadInteger("Tactical Interface Settings","SHOW_ENEMY_HEALTH", 1, 0, 6); - // sevenfm: show cover indicator - gGameExternalOptions.ubShowCoverIndicator = iniReader.ReadInteger("Tactical Interface Settings","SHOW_COVER_INDICATOR", 0, 0, 2); - // WANNE: Hide the hit count when enemy gets hit gGameExternalOptions.ubEnemyHitCount = iniReader.ReadInteger("Tactical Interface Settings","ENEMY_HIT_COUNT", 0, 0, 4); // sevenfm: added similar option for player hit count @@ -1340,7 +1337,6 @@ void LoadGameExternalOptions() // sevenfm gGameExternalOptions.fShowEnemyWeapon = iniReader.ReadBoolean("Tactical Gameplay Settings","SHOW_ENEMY_WEAPON", FALSE); gGameExternalOptions.fShowEnemyExtendedInfo = iniReader.ReadBoolean("Tactical Gameplay Settings","SHOW_ENEMY_EXTENDED_INFO", FALSE); - gGameExternalOptions.fShowEnemyAwareness = iniReader.ReadBoolean("Tactical Gameplay Settings","SHOW_ENEMY_AWARENESS", FALSE); //legion by Jazz gGameExternalOptions.fIndividualHiddenPersonNames = iniReader.ReadBoolean("Tactical Gameplay Settings","INDIVIDUAL_HIDDEN_PERSON_NAMES", FALSE); @@ -1358,7 +1354,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fEnemyRank = iniReader.ReadBoolean("Tactical Gameplay Settings","INDIVIDUAL_ENEMY_RANK",FALSE); // sevenfm: show enemy rank as icon - gGameExternalOptions.ubShowEnemyRankIcon = iniReader.ReadInteger("Tactical Gameplay Settings","SHOW_ENEMY_RANK_ICON", 0, 0, 2); + gGameExternalOptions.fImprovedTacticalUI = iniReader.ReadBoolean("Tactical Gameplay Settings","IMPROVED_TACTICAL_UI",FALSE); // Flugente: soldier profiles if (!is_networked) @@ -1478,6 +1474,7 @@ void LoadGameExternalOptions() gGameExternalOptions.bNewTacticalAIBehavior = iniReader.ReadBoolean("Tactical Interface Settings","NEW_AI_TACTICAL",FALSE); // sevenfm: AI tweaks and improvements + gGameExternalOptions.fAIYellowFlanking = iniReader.ReadBoolean("Tactical Interface Settings","AI_YELLOW_FLANKING",FALSE); gGameExternalOptions.fAIExtraSuppression = iniReader.ReadBoolean("Tactical Interface Settings","AI_EXTRA_SUPPRESSION",FALSE); gGameExternalOptions.fAINewMorale = iniReader.ReadBoolean("Tactical Interface Settings","AI_NEW_MORALE",FALSE); gGameExternalOptions.fAIBetterCover = iniReader.ReadBoolean("Tactical Interface Settings","AI_BETTER_COVER",FALSE); diff --git a/GameSettings.h b/GameSettings.h index e25a3334..993348fc 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -806,6 +806,7 @@ typedef struct BOOLEAN bAllowSpecialExplosiveAttachments; INT16 iChanceSayAnnoyingPhrase; BOOLEAN bNewTacticalAIBehavior; + BOOLEAN fAIYellowFlanking; BOOLEAN fAIExtraSuppression; BOOLEAN fAINewMorale; BOOLEAN fAIBetterCover; @@ -1212,8 +1213,6 @@ typedef struct // sevenfm: show enemy weapon above soldier in tactical BOOLEAN fShowEnemyWeapon; BOOLEAN fShowEnemyExtendedInfo; - // show awareness sight and level - BOOLEAN fShowEnemyAwareness; //legion by Jazz BOOLEAN fIndividualHiddenPersonNames; @@ -1242,7 +1241,7 @@ typedef struct BOOLEAN fEnemyRank; // sevenfm: show enemy rank as icon - UINT8 ubShowEnemyRankIcon; + BOOLEAN fImprovedTacticalUI; // Flugente: soldier profiles BOOLEAN fSoldierProfiles_Enemy; @@ -1252,7 +1251,6 @@ typedef struct //BOOLEAN fHideEnemyHealthText; UINT8 ubShowHealthBarsOnHead; - UINT8 ubShowCoverIndicator; UINT8 ubShowEnemyHealth; UINT8 ubEnemyHitCount; diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index eb1befa4..417ebc8a 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -1082,7 +1082,7 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 ui return; } // only enemies that are able to speak at the moment can taunt - if ( pCiv->stats.bLife < OKLIFE || pCiv->bBreathCollapsed ) + if ( pCiv->stats.bLife < OKLIFE || pCiv->bCollapsed || pCiv->bBreathCollapsed ) { return; } diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 34a44888..fd2f5aa3 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -62,10 +62,9 @@ #include "weapons.h" #include "Map Screen Interface.h" // added by Flugente for SquadNames #include "environment.h" - // sevenfm: needed for _KeyDown(SHIFT) - #include "english.h" - #include "DisplayCover.h" #include "SkillCheck.h" // added by Flugente + #include "Drugs And Alcohol.h" // sevenfm + #include "english.h" // sevenfm #endif #include "InterfaceItemImages.h" @@ -1908,39 +1907,36 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) // Display name SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_MCOLOR_WHITE ); - BOOLEAN bInCombat = gTacticalStatus.uiFlags & TURNBASED && gTacticalStatus.uiFlags & INCOMBAT; - BOOLEAN bStealth = pSoldier->bStealthMode || pSoldier->usSoldierFlagMask & ( SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER ); - // sevenfm: for mercs use name color as cover indicator - // only use color when there is enemy in sector - if( pSoldier->bTeam == OUR_TEAM && - (NumEnemyInSector() != 0) && - ! ( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT) ) && - ( ( gGameExternalOptions.ubShowCoverIndicator == 1 && ( bInCombat || bStealth ) ) || - ( gGameExternalOptions.ubShowCoverIndicator == 2 && bStealth ) ) ) + // sevenfm: improved UI + if( gGameExternalOptions.fImprovedTacticalUI ) { - INT8 cover = 3; // MAX_COVER - BOOLEAN showCover; - INT32 usMapPos; - INT16 color8, color16; - - if( GetMouseMapPos(&usMapPos) && _KeyDown(SHIFT) ) + if( pSoldier->flags.uiStatusFlags & SOLDIER_PC && + pSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER) ) { - // target tile cover - CalculateCoverForSoldier( pSoldier, usMapPos, gsInterfaceLevel, cover ); + SetRGBFontForeground( 220, 220, 0 ); } - else + else if ( GetDrunkLevel(pSoldier) != SOBER ) { - // merc's cover - CalculateCoverForSoldier( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, cover ); + switch ( GetDrunkLevel(pSoldier) ) + { + case FEELING_GOOD: + SetRGBFontForeground( 180, 180, 240 ); + break; + case BORDERLINE: + SetRGBFontForeground( 120, 120, 240 ); + break; + case DRUNK: + SetRGBFontForeground( 20, 20, 240 ); + break; + case HUNGOVER: + SetRGBFontForeground( 120, 20, 240 ); + break; + default: + SetFontForeground( FONT_MCOLOR_WHITE ); + } } - - showCover = CoverColorCode( cover, color8, color16 ); - SetFontForeground( (UINT8)color8 ); - } - else - { - SetFontForeground( FONT_MCOLOR_WHITE ); } if ( pSoldier->ubProfile != NO_PROFILE || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) @@ -2358,8 +2354,6 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) // sevenfm: show weapon name and additional info ShowEnemyWeapon( sX, sY, pSoldier ); ShowEnemyHealthBar( sX, sY, pSoldier ); - ShowAdditionalInfo( sX, sY, pSoldier ); - ShowRankIcon( sXPos, sYPos, pSoldier ); } // Flugente: soldier profiles else if ( pSoldier->bTeam == MILITIA_TEAM && ((gGameExternalOptions.fSoldierProfiles_Militia && pSoldier->usSoldierProfile) || pSoldier->usIndividualMilitiaID) ) @@ -3592,43 +3586,7 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW DrawBar( sXPos+3, sYPos+1+2*interval, (INT32)dWidth, sHeight, COLOR_ORANGE, Get16BPPColor( FROMRGB( 220, 140, 0 ) ), pDestBuf ); } - /* - BOOLEAN bDisguised = pSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER); - BOOLEAN bStealth = pSoldier->bStealthMode; - // draw cover indicators - if( ( gGameExternalOptions.ubShowHealthBarsOnHead > 1 ) && - ( (gTacticalStatus.uiFlags & TURNBASED ) && (gTacticalStatus.uiFlags & INCOMBAT) || bStealth || bDisguised ) ) - { - INT8 cover = 3; // MAX_COVER - BOOLEAN showCover; - INT32 usMapPos; - - if( gGameExternalOptions.ubShowCoverIndicator ==1 || - ( gGameExternalOptions.ubShowCoverIndicator ==3 && (bStealth || bDisguised) ) ) - { - if( GetMouseMapPos(&usMapPos) && _KeyDown(SHIFT) ) - { - // draw target tile cover indicator - CalculateCoverForSoldier( pSoldier, usMapPos, gsInterfaceLevel, cover ); - showCover = CoverColorCode( cover, color8, color16 ); - } - else - { - // draw cover indicator - CalculateCoverForSoldier( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, cover ); - showCover = CoverColorCode( cover, color8, color16 ); - if ( color8 == COLOR_GREEN) - showCover = FALSE; - } - - if(showCover) - DrawBar( sXPos+33, sYPos+1, 1+sHeight , (interval==3 ? 2 : 3 )*interval-1, color8, color16, pDestBuf ); - } - } - */ - UnLockVideoSurface( FRAME_BUFFER ); - } void EndDeadlockMsg( ) @@ -5823,141 +5781,6 @@ void DrawBar( INT32 x, INT32 y, INT32 width, INT32 height, UINT16 color8, UINT16 } } -BOOLEAN CoverColorCode( INT8 cover, INT16 &color8, INT16 &color16 ){ - BOOLEAN showCover = TRUE; - switch(cover) - { - case 0: - //color8 = COLOR_RED; - color8 = FONT_MCOLOR_RED; - color16 = Get16BPPColor( FROMRGB( 220, 0, 0 ) ); - break; - case 1: - color8 = COLOR_ORANGE; - color16 = Get16BPPColor( FROMRGB( 220, 140, 0 ) ); - break; - case 2: - color8 = COLOR_YELLOW; - color16 = Get16BPPColor( FROMRGB( 220, 220, 0 ) ); - break; - case 3: - color8 = COLOR_GREEN; - color16 = Get16BPPColor( FROMRGB( 0, 200, 0 ) ); - break; - default: - showCover = FALSE; - } - return showCover; -} - -void DrawRankIcon( INT8 rank, INT32 baseX, INT32 baseY ) -{ - UINT32 uiDestPitchBYTES; - UINT8 *pDestBuf; - INT16 color8; - INT16 color16; - - pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, gsVIEWPORT_WINDOW_START_Y, SCREEN_WIDTH, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); - - if(rank<6) - { - color8 = FONT_DKGREEN; - color16 = Get16BPPColor( FROMRGB( 20, 60, 20 ) ); - //color8 = FONT_ORANGE; - //color16 = Get16BPPColor( FROMRGB( 160, 80, 0 ) ); - } - else - { - color8 = FONT_DKRED; - color16 = Get16BPPColor( FROMRGB( 60, 20, 20 ) ); - } - - DrawBar( baseX+2, baseY+2, 7, 8, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+10, baseX+7, baseY+10, color8, color16, pDestBuf ); - DrawLine( baseX+4, baseY+11, baseX+6, baseY+11, color8, color16, pDestBuf ); - - if(rank<6) - { - color8 = COLOR_GREEN; - color16 = Get16BPPColor( FROMRGB( 20, 80, 20 ) ); - //color8 = FONT_YELLOW; - //color16 = Get16BPPColor( FROMRGB( 200, 120, 00 ) ); - } - else - { - color8 = COLOR_RED; - color16 = Get16BPPColor( FROMRGB( 120, 20, 20 ) ); - } - - DrawLine( baseX+2, baseY+1, baseX+8, baseY+1, color8, color16, pDestBuf ); - DrawLine( baseX+1, baseY+2, baseX+1, baseY+9, color8, color16, pDestBuf ); - DrawLine( baseX+9, baseY+2, baseX+9, baseY+9, color8, color16, pDestBuf ); - - DrawLine( baseX+1, baseY+9, baseX+4, baseY+12, color8, color16, pDestBuf ); - DrawLine( baseX+4, baseY+12, baseX+6, baseY+12, color8, color16, pDestBuf ); - DrawLine( baseX+6, baseY+12, baseX+9, baseY+9, color8, color16, pDestBuf ); - - if(rank<6) - { - //color8 = FONT_DKGREEN; - //color16 = Get16BPPColor( FROMRGB( 0, 40, 0 ) ); - //color8 = COLOR_LTGREY; - //color16 = Get16BPPColor( FROMRGB( 120, 120, 120 ) ); - color8 = COLOR_YELLOW; - color16 = Get16BPPColor( FROMRGB( 200, 200, 200 ) ); - } - else - { - color8 = FONT_ORANGE; - color16 = Get16BPPColor( FROMRGB( 220, 140, 20 ) ); - } - - switch( rank ) - { - case 1: - DrawLine( baseX+3, baseY+6, baseX+7, baseY+6, color8, color16, pDestBuf ); - break; - case 2: - DrawLine( baseX+3, baseY+5, baseX+7, baseY+5, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+7, baseX+7, baseY+7, color8, color16, pDestBuf ); - break; - case 3: - DrawLine( baseX+3, baseY+4, baseX+7, baseY+4, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+6, baseX+7, baseY+6, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+8, baseX+7, baseY+8, color8, color16, pDestBuf ); - break; - case 4: - DrawLine( baseX+3, baseY+5, baseX+5, baseY+8, color8, color16, pDestBuf ); - DrawLine( baseX+5, baseY+8, baseX+7, baseY+5, color8, color16, pDestBuf ); - break; - case 5: - DrawLine( baseX+3, baseY+4, baseX+7, baseY+4, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+6, baseX+5, baseY+9, color8, color16, pDestBuf ); - DrawLine( baseX+5, baseY+9, baseX+7, baseY+6, color8, color16, pDestBuf ); - break; - case 6: - DrawLine( baseX+5, baseY+4, baseX+5, baseY+8, color8, color16, pDestBuf ); - break; - case 7: - DrawLine( baseX+4, baseY+4, baseX+4, baseY+8, color8, color16, pDestBuf ); - DrawLine( baseX+6, baseY+4, baseX+6, baseY+8, color8, color16, pDestBuf ); - break; - case 8: - DrawLine( baseX+5, baseY+4, baseX+5, baseY+8, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+4, baseX+3, baseY+8, color8, color16, pDestBuf ); - DrawLine( baseX+7, baseY+4, baseX+7, baseY+8, color8, color16, pDestBuf ); - break; - case 9: - DrawLine( baseX+2, baseY+6, baseX+8, baseY+6, color8, color16, pDestBuf ); - DrawLine( baseX+5, baseY+3, baseX+5, baseY+9, color8, color16, pDestBuf ); - DrawLine( baseX+3, baseY+4, baseX+7, baseY+8, color8, color16, pDestBuf ); - DrawLine( baseX+7, baseY+4, baseX+3, baseY+8, color8, color16, pDestBuf ); - } - - UnLockVideoSurface( FRAME_BUFFER ); -} - void DrawItemPic(INVTYPE *pItem, INT16 sX, INT16 sY ) { UINT16 usGraphicNum; @@ -6311,69 +6134,6 @@ void ShowEnemyWeapon( INT16 sX, INT16 sY, SOLDIERTYPE* pTargetSoldier ) } } -void ShowAdditionalInfo( INT16 sX, INT16 sY, SOLDIERTYPE* pTargetSoldier ) -{ - BOOLEAN showExactInfo; - CHAR16 NameStr[ MAX_ENEMY_NAMES_CHARS ]; - SOLDIERTYPE *pSelectedSoldier; - - if ( gusSelectedSoldier != NOBODY ) - pSelectedSoldier = MercPtrs[ gusSelectedSoldier ]; - else - return; - - if( gGameExternalOptions.fEnemyRank || gGameExternalOptions.fEnemyNames ) - return; - - // calc max range for exact info - if ( gusSelectedSoldier != NOBODY ) - showExactInfo = ShowExactInfo( pSelectedSoldier, pTargetSoldier ); - - sX -= StringPixLength ( L"*", TINYFONT1 ); - if( gGameExternalOptions.fShowEnemyAwareness && gTacticalStatus.ubCurrentTeam == OUR_TEAM ) - { - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); - // show awareness sign only when in stealth mode or disguised - if( ( gusSelectedSoldier != NOBODY ) && - ( pTargetSoldier->bTeam == ENEMY_TEAM || pTargetSoldier->bTeam == CIV_TEAM && !pTargetSoldier->aiData.bNeutral ) && - ( MercPtrs[ gusSelectedSoldier ]->bStealthMode || MercPtrs[ gusSelectedSoldier ]->usSoldierFlagMask & ( SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER ) ) ) - { - if( pTargetSoldier->aiData.bOppList[ MercPtrs[ gusSelectedSoldier ]->ubID ] == SEEN_CURRENTLY ) - swprintf( NameStr, L"%s", L"*" ); - else - swprintf( NameStr, L"%s", L"-" ); - - SetFontForeground( FONT_GRAY1 ); - switch ( pTargetSoldier->aiData.bAlertStatus ) - { - case STATUS_GREEN: // everything's OK, no suspicion - SetFontForeground( FONT_GREEN ); - break; - case STATUS_YELLOW: // he or his friend heard something - SetFontForeground( FONT_YELLOW ); - break; - case STATUS_RED: // has definite evidence of opponent - SetFontForeground( FONT_ORANGE ); - break; - case STATUS_BLACK: // currently sees an active opponent - SetFontForeground( FONT_DKRED ); - break; - } - - if ( showExactInfo ) - { - // this feature is a part of 'show enemy health bar' - if( gGameExternalOptions.ubShowEnemyHealth > 1 ) - { - gprintfdirty( sX - 15, sY, NameStr ); - mprintf( sX - 15, sY, NameStr ); - } - } - } - } -} - void ShowEnemyHealthBar( INT16 sX, INT16 sY, SOLDIERTYPE* pSoldier ) { INT32 iBack; @@ -6406,46 +6166,6 @@ void ShowEnemyHealthBar( INT16 sX, INT16 sY, SOLDIERTYPE* pSoldier ) } } -void ShowRankIcon( INT16 sXPos, INT16 sYPos, SOLDIERTYPE* pSoldier ) -{ - INT32 iBack; - INT16 sX, sY; - SOLDIERTYPE *pSelectedSoldier; - - if ( gusSelectedSoldier != NOBODY ) - pSelectedSoldier = MercPtrs[ gusSelectedSoldier ]; - else - return; - - if ( pSelectedSoldier->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) - return; - - if( gGameExternalOptions.ubShowEnemyRankIcon && gTacticalStatus.ubCurrentTeam == OUR_TEAM ) - //&& (!gGameExternalOptions.fEnemyNames) && (!gGameExternalOptions.fEnemyRank)) - { - sX = sXPos + 50; - sY = sYPos + 17; - if(gGameExternalOptions.fEnemyNames) - sY+=10; - if(gGameExternalOptions.fEnemyRank) - sY+=10; - - iBack = RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 11 ), (INT16)(sY + 14 ) ); - if ( iBack != -1 ) - SetBackgroundRectFilled( iBack ); - - DrawRankIcon( pSoldier->stats.bExpLevel, sX, sY ); - } -} - -void DrawLine( INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color8, UINT16 color16, UINT8 *pDestBuf ) -{ - if(gbPixelDepth==16) - LineDraw( TRUE, x1, y1, x2, y2, color16, pDestBuf); - else - LineDraw8( TRUE, x1, y1, x2, y2, color8, pDestBuf); -} - void DrawEnemyHealthBar( SOLDIERTYPE* pSoldier, INT32 sX, INT32 sY, UINT8 ubLines, INT32 iBarWidth, INT32 iBarHeight ) { FLOAT dWidth, dPercentage; diff --git a/Tactical/Interface.h b/Tactical/Interface.h index e7f0d0fe..a2e51534 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -539,10 +539,6 @@ void RenderTopmostMultiPurposeLocator( ); void DrawBar( INT32 x, INT32 y, INT32 width, INT32 height, UINT16 color8, UINT16 color16, UINT8 *pDestBuf ); // draw health bar over enemy void DrawEnemyHealthBar( SOLDIERTYPE* pSoldier, INT32 sX, INT32 sY, UINT8 ubLines, INT32 iBarWidth, INT32 iBarHeight ); -// get cover display code from cover value -BOOLEAN CoverColorCode( INT8 cover, INT16 &color8, INT16 &color16 ); -void DrawRankIcon( INT8 rank, INT32 baseX, INT32 baseY ); -void DrawLine( INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color8, UINT16 color16, UINT8 *pDestBuf ); // Flugente: show enemy role BOOLEAN ShowSoldierRoleSymbol(SOLDIERTYPE* pSoldier); @@ -556,8 +552,6 @@ void DrawNCTHCursorItemPics( INT16 sStartScreenX, INT16 sStartScreenY ); void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSoldier, BOOLEAN showExactInfo, CHAR16 *NameStr ); void ShowEnemyWeapon( INT16 sX, INT16 sY, SOLDIERTYPE* pTargetSoldier ); -void ShowAdditionalInfo( INT16 sX, INT16 sY, SOLDIERTYPE* pTargetSoldier ); -void ShowRankIcon( INT16 sXPos, INT16 sYPos, SOLDIERTYPE* pSoldier ); void ShowEnemyHealthBar( INT16 sX, INT16 sY, SOLDIERTYPE* pSoldier ); void NCTHImprovedAPColor( SOLDIERTYPE* pSoldier, OBJECTTYPE* pWeapon ); diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 98687e8e..a5c9e164 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1222,6 +1222,12 @@ INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, return( 0 ); } + // sevenfm: if soldier is unconscious, he can't see anything + if ( pSoldier->bCollapsed && pSoldier->bBreath == 0 ) + { + return( 0 ); + } + // anv: some places in vehicle don't give passenger any view outside INT8 bSeatIndex = GetSeatIndexFromSoldier( pSoldier ); if( bSeatIndex != (-1) ) @@ -2190,6 +2196,11 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, if ( pOpponent->bTeam == ENEMY_TEAM && pSoldier->bTeam == OUR_TEAM ) pOpponent->usSoldierFlagMask |= SOLDIER_ENEMY_OBSERVEDTHISTURN; } + // sevenfm: if soldier is unconscious, he can't see anybody + if ( pSoldier->bCollapsed && pSoldier->bBreath == 0 ) + { + return; + } // if we're seeing a guy we didn't see on our last chance to look for him if (pSoldier->aiData.bOppList[pOpponent->ubID] != SEEN_CURRENTLY) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 0532efd5..a612fc1d 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -948,6 +948,7 @@ INT32 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, INT8 *pbPersOL,*pbPublOL; INT32 sClimbGridNo; SOLDIERTYPE * pOpp; + INT32 sDistToEnemy, sDistToClosestEnemy = 10000; // sevenfm: safety check if ( pfChangeLevel ) @@ -1034,23 +1035,28 @@ INT32 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK, continue; } - iPathCost = EstimatePathCostToLocation( pSoldier, sGridNo, bLevel, FALSE, &fClimbingNecessary, &sClimbGridNo ); - - // if we can get there and it's first reachable enemy or closer than other known enemies - if( iPathCost != 0 && - (TileIsOutOfBounds(sClosestDisturbance) || iPathCost < iShortestPath) ) + // sevenfm: if we found reachable enemy, check other enemies only if they are closer + sDistToEnemy = PythSpacesAway( pSoldier->sGridNo, sGridNo ); + if (sDistToEnemy < sDistToClosestEnemy || TileIsOutOfBounds(sClosestDisturbance) ) { - if (fClimbingNecessary) - { - sClosestDisturbance = sClimbGridNo; - } - else - { - sClosestDisturbance = sGridNo; - } + iPathCost = EstimatePathCostToLocation( pSoldier, sGridNo, bLevel, FALSE, &fClimbingNecessary, &sClimbGridNo ); - iShortestPath = iPathCost; - fClosestClimbingNecessary = fClimbingNecessary; + // if we can get there and it's first reachable enemy or closer than other known enemies + if (iPathCost != 0 && (TileIsOutOfBounds(sClosestDisturbance) || iPathCost < iShortestPath)) + { + if (fClimbingNecessary) + { + sClosestDisturbance = sClimbGridNo; + } + else + { + sClosestDisturbance = sGridNo; + } + + sDistToClosestEnemy = sDistToEnemy; + iShortestPath = iPathCost; + fClosestClimbingNecessary = fClimbingNecessary; + } } } diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index bfef2a7b..66671be4 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2097,12 +2097,13 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } // possibly start YELLOW flanking - if ( ( pSoldier->aiData.bAttitude == CUNNINGAID || pSoldier->aiData.bAttitude == CUNNINGSOLO ) && + if( gGameExternalOptions.fAIYellowFlanking && + ( pSoldier->aiData.bAttitude == CUNNINGAID || pSoldier->aiData.bAttitude == CUNNINGSOLO ) && pSoldier->bTeam == ENEMY_TEAM && ( CountFriendsInDirection( pSoldier, sNoiseGridNo ) > 0 || NightTime() ) && ( pSoldier->aiData.bOrders == SEEKENEMY || pSoldier->aiData.bOrders == FARPATROL || - pSoldier->aiData.bOrders == CLOSEPATROL && NightTime() ) ) + pSoldier->aiData.bOrders == CLOSEPATROL && NightTime() )) { INT8 action = AI_ACTION_SEEK_NOISE; INT16 dist = PythSpacesAway ( pSoldier->sGridNo, sNoiseGridNo ); @@ -9555,12 +9556,13 @@ INT8 ArmedVehicleDecideActionYellow( SOLDIERTYPE *pSoldier ) #endif // possibly start YELLOW flanking - if ( (pSoldier->aiData.bAttitude == CUNNINGAID || pSoldier->aiData.bAttitude == CUNNINGSOLO) && - pSoldier->bTeam == ENEMY_TEAM && - (CountFriendsInDirection( pSoldier, sNoiseGridNo ) > 0 || NightTime( )) && - (pSoldier->aiData.bOrders == SEEKENEMY || - pSoldier->aiData.bOrders == FARPATROL || - pSoldier->aiData.bOrders == CLOSEPATROL && NightTime( )) ) + if( gGameExternalOptions.fAIYellowFlanking && + (pSoldier->aiData.bAttitude == CUNNINGAID || pSoldier->aiData.bAttitude == CUNNINGSOLO) && + pSoldier->bTeam == ENEMY_TEAM && + (CountFriendsInDirection( pSoldier, sNoiseGridNo ) > 0 || NightTime( )) && + (pSoldier->aiData.bOrders == SEEKENEMY || + pSoldier->aiData.bOrders == FARPATROL || + pSoldier->aiData.bOrders == CLOSEPATROL && NightTime( )) ) { INT8 action = AI_ACTION_SEEK_NOISE; INT16 dist = PythSpacesAway( pSoldier->sGridNo, sNoiseGridNo ); diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index dd29fc8c..3e35a4d7 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -517,27 +517,8 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN fPathFlags = 0; if ( CREATURE_OR_BLOODCAT( pSoldier ) ) - { /* - if ( PythSpacesAway( pSoldier->sGridNo, sDesGrid ) <= PATH_CLOSE_RADIUS ) - { - // then do a limited range path search and see if we can get there - gubNPCDistLimit = 10; - if ( !LegalNPCDestination( pSoldier, sDesGrid, ENSURE_PATH, NOWATER, fPathFlags) ) - { - gubNPCDistLimit = 0; - return( NOWHERE ); - } - else - { - // allow attempt to path without 'good enough' flag on - gubNPCDistLimit = 0; - } - } - else - { - */ + { fPathFlags = PATH_CLOSE_GOOD_ENOUGH; - //} } // first step: try to find an OK destination at or near the desired gridno @@ -634,13 +615,15 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN // we'll only go as far along the plotted route as is within our // permitted roaming range, and we'll stop as soon as we're down to <= 5 APs + sTempDest = pSoldier->sGridNo; + for (sLoop = 0; sLoop < (pSoldier->pathing.usPathDataSize - pSoldier->pathing.usPathIndex); sLoop++) { // what is the next gridno in the path? //sTempDest = NewGridNo( sGoToGrid,DirectionInc( (INT16) (pSoldier->pathing.usPathingData[sLoop] + 1) ) ); - sTempDest = NewGridNo( sGoToGrid,DirectionInc( (UINT8) (pSoldier->pathing.usPathingData[sLoop]) ) ); - //NumMessage("sTempDest = ",sTempDest); + //sTempDest = NewGridNo( sGoToGrid,DirectionInc( (UINT8) (pSoldier->pathing.usPathingData[sLoop]) ) ); + sTempDest = NewGridNo( sTempDest,DirectionInc( (UINT8) (pSoldier->pathing.usPathingData[sLoop]) ) ); // this should NEVER be out of bounds if (sTempDest == sGoToGrid) @@ -679,13 +662,6 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN break; // quit here, sGoToGrid is where we are going } - // if this gridno is NOT a legal NPC destination - // DONT'T test path again - that would replace the traced path! - Ian - // NOTE: It's OK to go *THROUGH* water to try and get to the destination! - if (!LegalNPCDestination(pSoldier,sTempDest,IGNORE_PATH,WATEROK,0)) - break; // quit here, sGoToGrid is where we are going - - // CAN'T CALL PathCost() HERE! IT CALLS findBestPath() and overwrites // pathRouteToGo !!! Gotta calculate the cost ourselves - Ian // @@ -696,31 +672,6 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN // if we're just starting the "costing" process (first gridno) if (sLoop == 0) { - /* - // first, add any additional costs - such as intermediate animations, etc. - switch(pSoldier->anitype[pSoldier->anim]) - { - // in theory, no NPC should ever be in one of these animations as - // things stand (they don't medic anyone), but leave it for robustness - case START_AID : - case GIVING_AID : sAnimCost = APBPConstants[AP_STOP_FIRST_AID]; - break; - - case TWISTOMACH : - case COLLAPSED : sAnimCost = APBPConstants[AP_GET_UP]; - break; - - case TWISTBACK : - case UNCONSCIOUS : sAnimCost = (APBPConstants[AP_ROLL_OVER] + APBPConstants[AP_GET_UP]); - break; - - default : sAnimCost = 0; - } - - // this is our first cost - sAPCost += sAnimCost; - */ - if (pSoldier->usUIMovementMode == RUNNING) { sAPCost += GetAPsStartRun( pSoldier ); // changed by SANDRO @@ -733,6 +684,16 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN bAPsLeft = pSoldier->bActionPoints - sAPCost; } + // if this gridno is NOT a legal NPC destination + // DONT'T test path again - that would replace the traced path! - Ian + // NOTE: It's OK to go *THROUGH* water to try and get to the destination! + // sevenfm: jump over fence code - if current gridno is not legal destination, check next gridno + if (!LegalNPCDestination(pSoldier,sTempDest,IGNORE_PATH,WATEROK,0)) + { + // break; + continue; + } + // if after this, we have <= 5 APs remaining, that's far enough, break out // (the idea is to preserve APs so we can crouch or react if // necessary, and benefit from the carry-over next turn if not needed)