From 038b559c3ef2ee51713842250086835f1f5737de Mon Sep 17 00:00:00 2001 From: Flugente Date: Mon, 19 May 2014 20:47:42 +0000 Subject: [PATCH] - New: if KNOWN_NPCS_DIFFERENT_MAPCOLOUR is TRUE, friendly NPCs known to the player are displayed in dark blue to easier differentiate them from normal civilians - cleaned up DrawSelectedUIAboveGuy() - Fix: missing header - when jumping through windows, damage received is somewhat randomized git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7221 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameSettings.cpp | 4 +- GameSettings.h | 3 + SaveLoadGame.cpp | 1 + Tactical/Interface.cpp | 162 ++++++++++------------------------- Tactical/Soldier Control.cpp | 2 +- TileEngine/Radar Screen.cpp | 12 ++- TileEngine/overhead map.cpp | 8 +- 7 files changed, 64 insertions(+), 128 deletions(-) diff --git a/GameSettings.cpp b/GameSettings.cpp index 2d81d85b6..9fbb5a455 100644 --- a/GameSettings.cpp +++ b/GameSettings.cpp @@ -1355,6 +1355,9 @@ void LoadGameExternalOptions() //legion by Jazz gGameExternalOptions.fIndividualHiddenPersonNames = iniReader.ReadBoolean("Tactical Gameplay Settings","INDIVIDUAL_HIDDEN_PERSON_NAMES", FALSE); + // Flugente + gGameExternalOptions.fKnownNPCsUseDifferentColour = iniReader.ReadBoolean("Tactical Gameplay Settings", "KNOWN_NPCS_DIFFERENT_MAPCOLOUR", FALSE ); + //Enemy Names by Jazz gGameExternalOptions.fEnemyNames = iniReader.ReadBoolean("Tactical Gameplay Settings","INDIVIDUAL_ENEMY_NAMES",FALSE); @@ -1368,7 +1371,6 @@ void LoadGameExternalOptions() gGameExternalOptions.ubShowEnemyRankIcon = iniReader.ReadInteger("Tactical Gameplay Settings","SHOW_ENEMY_RANK_ICON", 0, 0, 2); // Flugente: soldier profiles - if (!is_networked) gGameExternalOptions.fSoldierProfiles_Enemy = iniReader.ReadBoolean("Tactical Gameplay Settings", "SOLDIER_PROFILES_ENEMY", TRUE); else diff --git a/GameSettings.h b/GameSettings.h index c740d95bd..1abd50814 100644 --- a/GameSettings.h +++ b/GameSettings.h @@ -1221,6 +1221,9 @@ typedef struct //legion by Jazz BOOLEAN fIndividualHiddenPersonNames; + + // Flugente: display NPCs we know of in a different colour on the sector and radar map + BOOLEAN fKnownNPCsUseDifferentColour; //SAveGame Slot by Jazz BOOLEAN fSaveGameSlot; diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index bdcf669f9..b766f6fb3 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -144,6 +144,7 @@ #include "connect.h" #include "Map Screen Interface Map Inventory.h"//dnl ch51 081009 #include "Sys Globals.h"//dnl ch74 201013 +#include "Ambient Control.h" // added by Flugente for HandleNewSectorAmbience(...) ///////////////////////////////////////////////////// // diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index eeb06f5f3..cfaa96f66 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -1965,16 +1965,15 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) { // target tile cover CalculateCoverForSoldier( pSoldier, usMapPos, gsInterfaceLevel, cover ); - showCover = CoverColorCode( cover, color8, color16 ); - SetFontForeground( (UINT8)color8 ); } else { // merc's cover - CalculateCoverForSoldier( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, cover ); - showCover = CoverColorCode( cover, color8, color16 ); - SetFontForeground( (UINT8)color8 ); + CalculateCoverForSoldier( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel, cover ); } + + showCover = CoverColorCode( cover, color8, color16 ); + SetFontForeground( (UINT8)color8 ); } else { @@ -2025,7 +2024,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) mprintf( sX, sY, NameStr ); fRaiseName = TRUE; } - else if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment < ON_DUTY && pSoldier->bAssignment != CurrentSquad() && !( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) + else if ( pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment < ON_DUTY && pSoldier->bAssignment != CurrentSquad() && !( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) { if ( gGameExternalOptions.fUseXMLSquadNames ) swprintf( NameStr, SquadNames[ pSoldier->bAssignment ].squadname ); @@ -2056,80 +2055,29 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if ( fDoName ) { - if ( fRaiseName ) + //legion2 jazz + if ( pSoldier->ubBodyType == ROBOTNOWEAPON && pSoldier->bTeam == ENEMY_TEAM ) { - //legion2 jazz - if (pSoldier->ubBodyType == ROBOTNOWEAPON && pSoldier->bTeam == ENEMY_TEAM ) - { - swprintf( NameStr, zGrod[0] ); - } - else if (zHiddenNames[pSoldier->ubProfile].Hidden == TRUE) - { - swprintf( NameStr,L"???" ); - } - else - { - swprintf( NameStr, L"%s", pSoldier->name ); - } - - //Legion - if (pSoldier->ubBodyType == TANK_NE || pSoldier->ubBodyType == TANK_NW) - { - swprintf( NameStr, gNewVehicle[164].NewVehicleStrings ); - //swprintf( NameStr, pVehicleStrings[4] ); - } - else if (zHiddenNames[pSoldier->ubProfile].Hidden == TRUE) - { - swprintf( NameStr,L"???" ); - } - else - { - swprintf( NameStr, L"%s", pSoldier->name ); - } - //------- - - //swprintf( NameStr, L"%s", pSoldier->name ); - FindFontCenterCoordinates( sXPos, (INT16)( sYPos - 10 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); - gprintfdirty( sX, sY, NameStr ); - mprintf( sX, sY, NameStr ); + swprintf( NameStr, zGrod[0] ); + } + //Legion + else if ( pSoldier->ubBodyType == TANK_NE || pSoldier->ubBodyType == TANK_NW ) + { + swprintf( NameStr, gNewVehicle[164].NewVehicleStrings ); + } + else if ( zHiddenNames[pSoldier->ubProfile].Hidden == TRUE ) + { + swprintf( NameStr, L"???" ); } else { - //legion Jazz - if (pSoldier->ubBodyType == ROBOTNOWEAPON && pSoldier->bTeam == ENEMY_TEAM ) - { - swprintf( NameStr, zGrod[0] ); - } - else if (zHiddenNames[pSoldier->ubProfile].Hidden == TRUE) - { - swprintf( NameStr,L"???" ); - } - else - { - swprintf( NameStr, L"%s", pSoldier->name ); - } - - //Legion - if (pSoldier->ubBodyType == TANK_NE || pSoldier->ubBodyType == TANK_NW) - { - //swprintf( NameStr, pVehicleStrings[4] ); - swprintf( NameStr, gNewVehicle[164].NewVehicleStrings ); - } - else if (zHiddenNames[pSoldier->ubProfile].Hidden == TRUE) - { - swprintf( NameStr,L"???" ); - } - else - { - wprintf( NameStr, L"%s", pSoldier->name ); - } - //--------------- - - //swprintf( NameStr, L"%s", pSoldier->name ); - FindFontCenterCoordinates( sXPos, sYPos, (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); - gprintfdirty( sX, sY, NameStr ); - mprintf( sX, sY, NameStr ); + swprintf( NameStr, L"%s", pSoldier->name ); } + + INT16 sNameY = fRaiseName ? sYPos - 10 : sYPos; + FindFontCenterCoordinates( sXPos, sNameY, (INT16)(80), 1, NameStr, TINYFONT1, &sX, &sY ); + gprintfdirty( sX, sY, NameStr ); + mprintf( sX, sY, NameStr ); } // if ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || RPC_RECRUITED( pSoldier ) || AM_AN_EPC( pSoldier ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) @@ -2204,7 +2152,6 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) DrawBarsInUIBox( pSoldier, (INT16)(sXPos -1), (INT16)(sYPos ), 16, 1, 3 ); } } - } } else // ( pSoldier->ubProfile < FIRST_RPC || pSoldier->ubProfile >= GASTON || @@ -2241,9 +2188,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if ( gGameExternalOptions.fSoldierProfiles_Enemy && pSoldier->usSoldierProfile ) { swprintf(NameStr, pSoldier->GetName()); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 20 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); @@ -2259,9 +2204,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if ( pSoldier->sSectorX == zEnemyName[iCounter2].SectorX && pSoldier->sSectorY == zEnemyName[iCounter2].SectorY ) { swprintf(NameStr, zEnemyName[iCounter2].szCurGroup); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); //legion2 @@ -2283,9 +2226,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if ( zEnemyRank[iCounter2].Stats == 0 && pSoldier->stats.bExpLevel == zEnemyRank[iCounter2].ExpLevel ) { swprintf(NameStr, zEnemyRank[iCounter2].szCurRank); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); //legion2 @@ -2304,9 +2245,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) { // get a proper chaos name swprintf(NameStr, pSoldier->GetName()); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 20 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); @@ -2318,9 +2257,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if (zCivGroupName[pSoldier->ubCivilianGroup].Enabled == 1) { swprintf(NameStr, zCivGroupName[pSoldier->ubCivilianGroup].szCurGroup); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); //legion2 @@ -2342,15 +2279,15 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) // sevenfm: fix for overlapping with SHOW_ENEMY_WEAPON feature if( !gGameExternalOptions.fShowEnemyWeapon || !gfUIFullTargetFound ) { - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); - SetFontForeground( FONT_YELLOW ); + SetFont( TINYFONT1 ); + SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); - swprintf( NameStr, gzLateLocalizedString[ 15 ] ); + swprintf( NameStr, gzLateLocalizedString[ 15 ] ); FindFontCenterCoordinates( sXPos, (INT16)(sYPos + 10), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); - gprintfdirty( sX, sY, NameStr ); - mprintf( sX, sY, NameStr ); - } + gprintfdirty( sX, sY, NameStr ); + mprintf( sX, sY, NameStr ); + } } pStr = GetSoldierHealthString( pSoldier ); @@ -2359,7 +2296,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) extern void SoldierTooltip(SOLDIERTYPE*); //if ( gGameExternalOptions.gfAllowSoldierToolTips ) // changed by SANDRO if ( gGameSettings.fOptions[TOPTION_ALLOW_SOLDIER_TOOLTIPS] ) - SoldierTooltip(pSoldier); + SoldierTooltip(pSoldier); SetFont( TINYFONT1 ); SetFontBackground( FONT_MCOLOR_BLACK ); @@ -2378,8 +2315,6 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) swprintf(NameStr, pSoldier->name); // Display name - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); //legion2 @@ -2396,9 +2331,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) { // get a proper chaos name swprintf(NameStr, pSoldier->GetName()); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 20 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); @@ -2414,9 +2347,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if ( pSoldier->sSectorX == zEnemyName[iCounter2].SectorX && pSoldier->sSectorY == zEnemyName[iCounter2].SectorY ) { swprintf(NameStr, zEnemyName[iCounter2].szCurGroup); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); //legion2 @@ -2429,6 +2360,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) } } } + if (gGameExternalOptions.fEnemyRank == TRUE) { for( iCounter2 = 1; iCounter2 < 11; ++iCounter2 ) @@ -2439,14 +2371,11 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) { swprintf(NameStr, zEnemyRank[iCounter2].szCurRank); - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_YELLOW ); // need to adjust sYPos because default position already occupied by the name if ( gGameExternalOptions.fSoldierProfiles_Enemy && pSoldier->usSoldierProfile || gGameExternalOptions.fEnemyNames ) FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 10 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); - // use default position for text else FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 20 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); @@ -2468,15 +2397,13 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) 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 ) { - // get a proper chaos name + // get a proper name swprintf(NameStr, pSoldier->GetName()); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); FindFontCenterCoordinates( sXPos, (INT16)( sYPos + 20 ), (INT16)(80 ), 1, NameStr, TINYFONT1, &sX, &sY ); @@ -2488,9 +2415,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) if (zCivGroupName[pSoldier->ubCivilianGroup].Enabled == 1) { swprintf(NameStr, zCivGroupName[pSoldier->ubCivilianGroup].szCurGroup); - - SetFont( TINYFONT1 ); - SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_YELLOW ); //legion2 @@ -2498,6 +2423,7 @@ void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) gprintfdirty( sX, sY, NameStr ); mprintf( sX, sY, NameStr ); } + // sevenfm: show weapon name and additional info FindFontCenterCoordinates( sXPos, (INT16)( sYPos ), (INT16)(80 ), 1, L"", TINYFONT1, &sX, &sY ); ShowEnemyWeapon( sX, sY, pSoldier ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 261a14836..07cdfefdc 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9316,7 +9316,7 @@ void SOLDIERTYPE::BeginSoldierClimbWindow( void ) WindowHit( sNewGridNo, pStructure->usStructureID, (this->ubDirection == SOUTH || this->ubDirection == EAST), TRUE ); // we get a bit of damage for jumping through a window - this->SoldierTakeDamage( 0, 1, 0, 1000, TAKE_DAMAGE_ELECTRICITY, NOBODY, sNewGridNo, 0, TRUE ); + this->SoldierTakeDamage( 0, 2 + Random(4), 0, 1000, TAKE_DAMAGE_ELECTRICITY, NOBODY, sNewGridNo, 0, TRUE ); } } } diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index 5108bf0c8..908b96313 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -636,11 +636,15 @@ void RenderRadarScreen( ) else { usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - - // Override civ team with red if hostile... - if ( pSoldier->bTeam == CIV_TEAM && !pSoldier->aiData.bNeutral && ( pSoldier->bSide != gbPlayerNum ) ) + + if ( pSoldier->bTeam == CIV_TEAM ) { - usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); + // Override civ team with red if hostile... + if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) + usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); + // if uncovered, different colour (so the player doesn't have to search for us) + else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) + usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); } // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 728fb9f8e..015669ab6 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1578,6 +1578,8 @@ void RenderOverheadOverlays() // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, MILITIA_TEAM ); + else if ( pSoldier->bTeam == CIV_TEAM && gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->aiData.bNeutral && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) + Blt8BPPDataTo16BPPBufferTransparent( (UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, PLAYER_PLAN ); else Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam ); @@ -1628,6 +1630,7 @@ void RenderOverheadOverlays() Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sX, sY, pSoldier->bTeam ); RegisterBackgroundRect(BGND_FLAG_SINGLE, NULL, sX, sY, (INT16)(sX + 3), (INT16)(sY + 9)); } + if( ubPassengers ) { SetFont( SMALLCOMPFONT ); @@ -1640,13 +1643,11 @@ 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) ) - { continue; - } if(!GetOverheadScreenXYFromGridNo(pWorldItem->sGridNo, &sX, &sY))//dnl ch45 041009 continue; @@ -1704,7 +1705,6 @@ void RenderOverheadOverlays() PixelDraw( FALSE, sX, sY, usLineColor, pDestBuf ); InvalidateRegion( sX, sY, (INT16)( sX + 1 ), (INT16)( sY + 1 ) ); - } }