Improved Feature: Improved ambushes:

- Enemy deployment radius depends on your mercs' experience.
- With high enough leadership, your team will be able to deploy before battle.
- Added new background tag <ambush_radius> that increases enemy deployment radius (thereby moving them farther away).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7854 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-05-10 10:14:21 +00:00
parent 74bfaaf900
commit 9149dbe850
17 changed files with 294 additions and 113 deletions
+77 -32
View File
@@ -265,6 +265,8 @@ void ValidateAndCorrectInBattleCounters( GROUP *pLocGroup )
}
#endif
FLOAT gAmbushRadiusModifier = 1.0f;
void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
{
VOBJECT_DESC VObjectDesc;
@@ -279,6 +281,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
SECTORINFO *pSector;
BOOLEAN fScoutPresent = FALSE; // Added by SANDRO
BOOLEAN fAirDrop = FALSE; // Added by Flugente
UINT16 usDeploymentLeadership = 0;
gAmbushRadiusModifier = 0.0f;
// ARM: Feb01/98 - Cancel out of mapscreen movement plotting if PBI subscreen is coming up
if ( (bSelectedDestChar != -1) || fPlotForHelicopter || fPlotForMilitia )
@@ -424,7 +429,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gubEnemyEncounterCode == ENEMY_INVASION_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == ENTERING_BLOODCAT_LAIR_CODE ||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE )
gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{ //use same code
gubExplicitEnemyEncounterCode = gubEnemyEncounterCode;
}
@@ -565,6 +571,24 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
{
fAirDrop = TRUE;
}
UINT16 deploymentleadership = EffectiveLeadership( MercPtrs[i] );
FLOAT ambushradiusmodifier = 10 * EffectiveExpLevel( MercPtrs[i] ) + MercPtrs[i]->GetBackgroundValue( BG_AMBUSH_RADIUS );
if ( gGameOptions.fNewTraitSystem )
{
deploymentleadership += 50 * NUM_SKILL_TRAITS( MercPtrs[i], SQUADLEADER_NT );
ambushradiusmodifier += 50 * NUM_SKILL_TRAITS( MercPtrs[i], SCOUTING_NT );
}
// bonus with old traits, so that the check can be won
else
{
deploymentleadership += 30;
}
usDeploymentLeadership = max( usDeploymentLeadership, deploymentleadership );
gAmbushRadiusModifier = max( gAmbushRadiusModifier, ambushradiusmodifier / 100 );
}
else
{
@@ -705,6 +729,12 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
}
}
}
// Flugente: improved ambush: if a real squadleader is present, we may deploy our mercs instead of having them being dropped into combat randomly
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE && usDeploymentLeadership > 120 )
{
gubEnemyEncounterCode = ENEMY_AMBUSH_DEPLOYMENT_CODE;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
@@ -725,7 +755,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// SANDRO - merc records - ambush experienced
if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || fAmbushPrevented )
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE || fAmbushPrevented )
{
for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i )
{
@@ -733,7 +763,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
{
if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) && MercPtrs[ i ]->ubProfile != NO_PROFILE )
{
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE )
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++;
else if ( fAmbushPrevented && HAS_SKILL_TRAIT( MercPtrs[ i ], SCOUTING_NT ) ) // Scouts actually get this as number of prevented ambushes
gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++;
@@ -793,8 +823,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
SetButtonFastHelpText( iPBButton[ 0 ], gpStrategicString[ STR_PB_DISABLED_AUTORESOLVE_FASTHELP ] );
}
else if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE )
{ //Don't allow autoresolve for ambushes
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
//Don't allow autoresolve for ambushes
DisableButton( iPBButton[ 0 ] );
SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 3 ] );
}
@@ -803,19 +835,24 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
SetButtonFastHelpText( iPBButton[ 0 ], gpStrategicString[ STR_PB_AUTORESOLVE_FASTHELP ] );
}
SetButtonFastHelpText( iPBButton[ 1 ], gpStrategicString[ STR_PB_GOTOSECTOR_FASTHELP ] );
if( gfAutomaticallyStartAutoResolve )
{
DisableButton( iPBButton[ 1 ] );
}
if( gfCantRetreatInPBI )
{
gfCantRetreatInPBI = FALSE;
fRetreatAnOption = FALSE;
}
if( gfAutomaticallyStartAutoResolve || !fRetreatAnOption ||
gubEnemyEncounterCode == ENEMY_AMBUSH_CODE ||
gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE ||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE || is_client)
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE ||
gubEnemyEncounterCode == CREATURE_ATTACK_CODE ||
is_client)
{
DisableButton( iPBButton[ 2 ] );
SetButtonFastHelpText( iPBButton[ 2 ], gzNonPersistantPBIText[ 9 ] );
@@ -851,6 +888,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 3 ] );
break;
case ENEMY_AMBUSH_CODE:
case ENEMY_AMBUSH_DEPLOYMENT_CODE:
DisableButton( iPBButton[ 0 ] );
SetButtonFastHelpText( iPBButton[ 0 ], gzNonPersistantPBIText[ 4 ] );
break;
@@ -1089,6 +1127,7 @@ void RenderPBHeader( INT32 *piX, INT32 *piWidth)
swprintf( str, gpStrategicString[ STR_PB_ENEMYENCOUNTER_HEADER ] );
break;
case ENEMY_AMBUSH_CODE:
case ENEMY_AMBUSH_DEPLOYMENT_CODE:
swprintf( str, gpStrategicString[ STR_PB_ENEMYAMBUSH_HEADER ] );
gfBlinkHeader = TRUE;
break;
@@ -1462,38 +1501,41 @@ void GoToSectorCallback( GUI_BUTTON *btn, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
#ifdef JA2TESTVERSION
if( _KeyDown( ALT ) )
#else
if( _KeyDown( ALT ) && CHEATER_CHEAT_LEVEL() )
#endif
#ifdef JA2TESTVERSION
if( _KeyDown( ALT ) )
#else
if( _KeyDown( ALT ) && CHEATER_CHEAT_LEVEL() )
#endif
{
if( !gfPersistantPBI )
{
if( !gfPersistantPBI )
{
return;
}
PlayJA2Sample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
gStrategicStatus.usPlayerKills += NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM );
EliminateAllEnemies( gubPBSectorX, gubPBSectorY );
SetMusicMode( MUSIC_TACTICAL_VICTORY );
btn->uiFlags &= ~BUTTON_CLICKED_ON;
DrawButton( btn->IDNum );
InvalidateRegion( btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY );
ExecuteBaseDirtyRectQueue();
EndFrameBufferRender( );
RefreshScreen( NULL );
KillPreBattleInterface();
StopTimeCompression();
SetMusicMode( MUSIC_TACTICAL_NOTHING );
return;
}
if ( gfPersistantPBI && gpBattleGroup && gpBattleGroup->usGroupTeam == OUR_TEAM &&
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
gubEnemyEncounterCode != CREATURE_ATTACK_CODE &&
gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE )
PlayJA2Sample( EXPLOSION_1, RATE_11025, HIGHVOLUME, 1, MIDDLEPAN );
gStrategicStatus.usPlayerKills += NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM );
EliminateAllEnemies( gubPBSectorX, gubPBSectorY );
SetMusicMode( MUSIC_TACTICAL_VICTORY );
btn->uiFlags &= ~BUTTON_CLICKED_ON;
DrawButton( btn->IDNum );
InvalidateRegion( btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY );
ExecuteBaseDirtyRectQueue();
EndFrameBufferRender( );
RefreshScreen( NULL );
KillPreBattleInterface();
StopTimeCompression();
SetMusicMode( MUSIC_TACTICAL_NOTHING );
return;
}
if ( gfPersistantPBI && gpBattleGroup && gpBattleGroup->usGroupTeam == OUR_TEAM &&
gubEnemyEncounterCode != ENEMY_AMBUSH_CODE &&
gubEnemyEncounterCode != CREATURE_ATTACK_CODE &&
gubEnemyEncounterCode != BLOODCAT_AMBUSH_CODE )
{
gfEnterTacticalPlacementGUI = TRUE;
}
btn->uiFlags &= ~BUTTON_CLICKED_ON;
DrawButton( btn->IDNum );
InvalidateRegion( btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY );
@@ -2289,6 +2331,7 @@ void LogBattleResults( UINT8 ubVictoryCode)
AddHistoryToPlayersLog( HISTORY_WONBATTLE, 0, GetWorldTotalMin(), sSectorX, sSectorY );
break;
case ENEMY_AMBUSH_CODE:
case ENEMY_AMBUSH_DEPLOYMENT_CODE:
AddHistoryToPlayersLog( HISTORY_WIPEDOUTENEMYAMBUSH, 0, GetWorldTotalMin(), sSectorX, sSectorY );
break;
case ENTERING_ENEMY_SECTOR_CODE:
@@ -2317,6 +2360,7 @@ void LogBattleResults( UINT8 ubVictoryCode)
AddHistoryToPlayersLog( HISTORY_LOSTBATTLE, 0, GetWorldTotalMin(), sSectorX, sSectorY );
break;
case ENEMY_AMBUSH_CODE:
case ENEMY_AMBUSH_DEPLOYMENT_CODE:
AddHistoryToPlayersLog( HISTORY_FATALAMBUSH, 0, GetWorldTotalMin(), sSectorX, sSectorY );
break;
case ENTERING_ENEMY_SECTOR_CODE:
@@ -2348,6 +2392,7 @@ void LogBattleResults( UINT8 ubVictoryCode)
break;
case ENEMY_AMBUSH_CODE:
case BLOODCAT_AMBUSH_CODE:
case ENEMY_AMBUSH_DEPLOYMENT_CODE:
gCurrentIncident.usIncidentFlags |= (INCIDENT_ATTACK_ENEMY|INCIDENT_AMBUSH);
break;
}
+2
View File
@@ -39,6 +39,8 @@ enum
FIGHTING_CREATURES_CODE,
HOSTILE_CIVILIANS_CODE,
HOSTILE_BLOODCATS_CODE,
ENEMY_AMBUSH_DEPLOYMENT_CODE, // Flugente: an ambush in which we can deploy our mercs (somewhat)
};
extern BOOLEAN gfAutoAmbush;
+5 -6
View File
@@ -2623,7 +2623,7 @@ void PrepareLoadedSector()
PostSchedules();
}
if( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE )
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
if( gMapInformation.sCenterGridNo != NOWHERE )
{
@@ -2631,10 +2631,9 @@ void PrepareLoadedSector()
}
else
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"Ambush aborted in sector %c%d -- no center point in map. LC:1",
gWorldSectorY + 'A' - 1, gWorldSectorX );
#endif
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"Ambush aborted in sector %c%d -- no center point in map. LC:1", gWorldSectorY + 'A' - 1, gWorldSectorX );
#endif
}
}
@@ -3119,7 +3118,7 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ )
if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) )
{
if( gMapInformation.sCenterGridNo != NOWHERE && gfBlitBattleSectorLocator &&
(gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) && pSoldier->bTeam != CIV_TEAM )
(gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) && pSoldier->bTeam != CIV_TEAM )
{
// Flugente: improved ambush
if ( gGameExternalOptions.fAmbushSpreadMercs )
+1
View File
@@ -191,6 +191,7 @@ enum {
BG_PERC_DISEASE_DIAGNOSE,
BG_PERC_DISEASE_TREAT,
BG_TRACKER_ABILITY,
BG_AMBUSH_RADIUS,
BG_DISLIKEBG, // dislike any other background that has the negative of this value set
+2 -1
View File
@@ -25,6 +25,7 @@
#include "renderworld.h" // added by Flugente
#include "Vehicles.h" // added by Flugente
#include "CampaignStats.h" // added by Flugente
#include "worldman.h" // added by Flugente for Water(...)
#endif
#ifdef JA2UB
@@ -1117,7 +1118,7 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U
sGridNo = sCenterGridNo + (WORLD_COLS * sY) + sX;
if ( TileIsOutOfBounds( sGridNo ) || !IsLocationSittable( sGridNo, 0 ) || PythSpacesAway( sGridNo, sCenterGridNo ) <= uInnerRadius || PythSpacesAway( sGridNo, sCenterGridNo ) > uOuterRadius )
if ( TileIsOutOfBounds( sGridNo ) || Water( sGridNo ) || !IsLocationSittable( sGridNo, 0 ) || PythSpacesAway( sGridNo, sCenterGridNo ) <= uInnerRadius || PythSpacesAway( sGridNo, sCenterGridNo ) > uOuterRadius )
sGridNo = NOWHERE;
else
fFound = TRUE;
+6 -4
View File
@@ -576,6 +576,8 @@ void SortSoldierInitList()
}
extern FLOAT gAmbushRadiusModifier;
BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
{
UINT8 ubProfile;
@@ -772,10 +774,10 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
}
// Flugente: if this is an enemy, and we are using ambush code, place us somewhat away from the map center, where the player will be
if ( (tempDetailedPlacement.bTeam == ENEMY_TEAM && gubEnemyEncounterCode == ENEMY_AMBUSH_CODE) ||
if ( (tempDetailedPlacement.bTeam == ENEMY_TEAM && (gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE) ) ||
(tempDetailedPlacement.bTeam == CREATURE_TEAM && gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) )
{
if ( ( gGameExternalOptions.uAmbushEnemyEncircle == 1 && PythSpacesAway( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) <= gGameExternalOptions.usAmbushEnemyEncircleRadius1 ) ||
if ( (gGameExternalOptions.uAmbushEnemyEncircle == 1 && PythSpacesAway( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) ||
( gGameExternalOptions.uAmbushEnemyEncircle == 2) )
{
// we simply look for a entry point inside a bigger circle, but not inside the merc deployment zone.
@@ -783,9 +785,9 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
UINT16 counter = 0;
UINT8 ubDirection = DIRECTION_IRRELEVANT;
while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
{
bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gGameExternalOptions.usAmbushEnemyEncircleRadius1, gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
}
if ( bettergridno != NOWHERE )
+6
View File
@@ -129,6 +129,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
strcmp(name, "disease_diagnose" ) == 0 ||
strcmp(name, "disease_treatment" ) == 0 ||
strcmp(name, "tracker_ability" ) == 0 ||
strcmp(name, "ambush_radius" ) == 0 ||
strcmp(name, "dislikebackground" ) == 0 ||
strcmp(name, "druguse") == 0 ||
strcmp(name, "xenophobic") == 0 ||
@@ -544,6 +545,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curBackground.value[BG_TRACKER_ABILITY] = min( 40, max( 0, (INT16)atol( pData->szCharData ) ) );
}
else if ( strcmp( name, "ambush_radius" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curBackground.value[BG_AMBUSH_RADIUS] = min( 50, max( 0, (INT16)atol( pData->szCharData ) ) );
}
else if ( strcmp( name, "dislikebackground" ) == 0 )
{
pData->curElement = ELEMENT;
+2 -1
View File
@@ -17,6 +17,7 @@
#include "strategicmap.h"
#include "environment.h"
#include "worldman.h"
#include "PreBattle Interface.h" // added by Flugente
#endif
#include "connect.h"
@@ -1399,7 +1400,7 @@ INT32 SearchForClosestPrimaryMapEdgepoint(INT32 sGridNo, UINT8 ubInsertionCode,
break;
}
// WANNE - MP: Center
if( (is_networked && ubInsertionCode == INSERTION_CODE_CENTER) || ubInsertionCode == INSERTION_CODE_CHOPPER )
if ( ( (is_networked || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE ) && ubInsertionCode == INSERTION_CODE_CENTER) || ubInsertionCode == INSERTION_CODE_CHOPPER )
{
InitCenterEdgepoint( ubInsertionCode == INSERTION_CODE_CENTER );
psArray = gps1stCenterEdgepointArray;
+185 -69
View File
@@ -118,6 +118,8 @@ SOLDIERTYPE *gpTacticalPlacementHilightedSoldier = NULL;
// WANNE - MP: Center
BOOLEAN gfCenter;
extern BOOLEAN GetOverheadScreenXYFromGridNo( INT32 sGridNo, INT16* psScreenX, INT16* psScreenY );
void DoneOverheadPlacementClickCallback( GUI_BUTTON *btn, INT32 reason );
void SpreadPlacementsCallback ( GUI_BUTTON *btn, INT32 reason );
void GroupPlacementsCallback( GUI_BUTTON *btn, INT32 reason );
@@ -377,6 +379,13 @@ void InitTacticalPlacementGUI()
gfCenter = TRUE;
}
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
gMercPlacement[giPlacements].ubStrategicInsertionCode = INSERTION_CODE_CENTER;
MercPtrs[i]->ubStrategicInsertionCode = INSERTION_CODE_CENTER;
gfCenter = TRUE;
}
// WANNE - MP: Check if the desired insertion direction is valid on the map. If not, choose another entry direction!
if (is_networked)
{
@@ -423,7 +432,7 @@ void InitTacticalPlacementGUI()
gfCenter = TRUE;
}
giPlacements++;
++giPlacements;
}
}
//add all the faces now
@@ -609,6 +618,7 @@ UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint)
return validInsertionDirection;
}
void RenderTacticalPlacementGUI()
{
INT32 i, xp, yp, width, height;
@@ -625,6 +635,7 @@ void RenderTacticalPlacementGUI()
gfTacticalPlacementFirstTime = FALSE;
DisableScrollMessages();
}
//Check to make sure that if we have a hilighted merc (not selected) and the mouse has moved out
//of it's region, then we will clear the hilighted ID, and refresh the display.
if( !gfTacticalPlacementGUIDirty && gbHilightedMercID != -1 )
@@ -650,6 +661,7 @@ void RenderTacticalPlacementGUI()
gpTacticalPlacementHilightedSoldier = NULL;
}
}
//If the display is dirty render the entire panel.
if( gfTacticalPlacementGUIDirty )
{
@@ -660,11 +672,11 @@ void RenderTacticalPlacementGUI()
//DisableHilightsAndHelpText();
//RenderButtons();
//EnableHilightsAndHelpText();
for( i = 0; i < giPlacements; i++ )
{ //Render the mercs
for( i = 0; i < giPlacements; ++i )
{
//Render the mercs
pSoldier = gMercPlacement[ i ].pSoldier;
xp = xResOffset + 95 + (i / 2) * 54;
if (i % 2)
@@ -734,6 +746,7 @@ void RenderTacticalPlacementGUI()
ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+42, iStartY, xp+43, yp+29, Get16BPPColor( FROMRGB( 8, 156, 8 ) ) );
ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+43, iStartY, xp+44, yp+29, Get16BPPColor( FROMRGB( 8, 107, 8 ) ) );
}
SetFont( BLOCKFONT );
SetFontForeground( FONT_BEIGE );
SetFontShadow( 141 );
@@ -745,6 +758,7 @@ void RenderTacticalPlacementGUI()
//Shade out the part of the tactical map that isn't considered placable.
BlitBufferToBuffer(FRAME_BUFFER, guiSAVEBUFFER, 0, SCREEN_HEIGHT - 160, SCREEN_WIDTH, 160);
}
if( gfValidLocationsChanged )
{
if( DayTime() )
@@ -755,7 +769,8 @@ void RenderTacticalPlacementGUI()
{ //9PM to 6AM is gray (black is too dark to distinguish)
usHatchColor = Get16BPPColor( FROMRGB( 63, 31, 31 ) );
}
gfValidLocationsChanged--;
--gfValidLocationsChanged;
//DBrot bigger map code
if(gfUseBiggerOverview)
@@ -769,19 +784,50 @@ void RenderTacticalPlacementGUI()
}
else
{
BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, iOffsetHorizontal, iOffsetVertical, 640, 320 );
InvalidateRegion( iOffsetHorizontal, iOffsetVertical, iOffsetHorizontal + 640, iOffsetVertical + 320 );
//dnl ch45 051009
gTPClipRect.iLeft = iOffsetHorizontal + 1;
gTPClipRect.iTop = iOffsetVertical + 1;
gTPClipRect.iBottom = iOffsetVertical + 318;
gTPClipRect.iRight = iOffsetHorizontal + 634;
BlitBufferToBuffer( guiSAVEBUFFER, FRAME_BUFFER, iOffsetHorizontal, iOffsetVertical, 640, 320 );
InvalidateRegion( iOffsetHorizontal, iOffsetVertical, iOffsetHorizontal + 640, iOffsetVertical + 320 );
//dnl ch45 051009
gTPClipRect.iLeft = iOffsetHorizontal + 1;
gTPClipRect.iTop = iOffsetVertical + 1;
gTPClipRect.iBottom = iOffsetVertical + 318;
gTPClipRect.iRight = iOffsetHorizontal + 634;
}
if( gbCursorMercID == -1 )
{
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
INT16 sCellX = 0;
INT16 sCellY = 0;
GetOverheadScreenXYFromGridNo( gMapInformation.sCenterGridNo, &sCellX, &sCellY );
// Left black border
gTPClipRectCenterLeft.iLeft = iOffsetHorizontal;
gTPClipRectCenterLeft.iTop = iOffsetVertical + 3;
gTPClipRectCenterLeft.iBottom = iOffsetVertical + 320;
gTPClipRectCenterLeft.iRight = iOffsetHorizontal + sCellX - 5 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
// Top black border
gTPClipRectCenterTop.iLeft = iOffsetHorizontal;
gTPClipRectCenterTop.iTop = iOffsetVertical + 3;
gTPClipRectCenterTop.iBottom = iOffsetVertical + sCellY - 3 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
gTPClipRectCenterTop.iRight = iOffsetHorizontal + 634;
// Right black border
gTPClipRectCenterRight.iLeft = iOffsetHorizontal + sCellX + 5 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
gTPClipRectCenterRight.iTop = iOffsetVertical + 3;
gTPClipRectCenterRight.iBottom = iOffsetVertical + 320;
gTPClipRectCenterRight.iRight = iOffsetHorizontal + 634;
// Bottom black border
gTPClipRectCenterBottom.iLeft = iOffsetHorizontal;
gTPClipRectCenterBottom.iTop = iOffsetVertical + sCellY + 3 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
gTPClipRectCenterBottom.iBottom = iOffsetVertical + 320;
gTPClipRectCenterBottom.iRight = iOffsetHorizontal + 634;
}
// WANNE - MP: Center
if (is_networked && gfCenter)
else if (is_networked && gfCenter)
{
// Left black border
gTPClipRectCenterLeft.iLeft = iOffsetHorizontal;
@@ -833,7 +879,7 @@ void RenderTacticalPlacementGUI()
gTPClipRectCenterBottom.iTop = iOffsetVertical + AIRDROPENTRYPTS_BOTTOM_Y;
gTPClipRectCenterBottom.iBottom = iOffsetVertical + 320;
gTPClipRectCenterBottom.iRight = iOffsetHorizontal + 634;
}
}
}
else
{
@@ -850,10 +896,13 @@ void RenderTacticalPlacementGUI()
GetWorldXYAbsoluteScreenXY(sX, sY, &sWorldScreenX, &sWorldScreenY);
sWorldScreenX += 20;// Correction from invisible area X
sWorldScreenY += 35;// Correction from invisible area Y
//DBrot: adjust offsets for big maps
if(gfUseBiggerOverview){
switch(gMercPlacement[gbCursorMercID].ubStrategicInsertionCode){
case INSERTION_CODE_NORTH:
if(gfUseBiggerOverview)
{
switch(gMercPlacement[gbCursorMercID].ubStrategicInsertionCode)
{
case INSERTION_CODE_NORTH:
//if(sWorldScreenY <= PLACEMENT_OFFSET){
//sY = (PLACEMENT_OFFSET - sWorldScreenY) / 5;
//gTPClipRect.iTop += sY;
@@ -887,39 +936,70 @@ void RenderTacticalPlacementGUI()
{
switch(gMercPlacement[gbCursorMercID].ubStrategicInsertionCode)
{
case INSERTION_CODE_NORTH:
if(sWorldScreenY <= PLACEMENT_OFFSET)
{
sY = (PLACEMENT_OFFSET - sWorldScreenY) / 5;
gTPClipRect.iTop += sY;
case INSERTION_CODE_NORTH:
if(sWorldScreenY <= PLACEMENT_OFFSET)
{
sY = (PLACEMENT_OFFSET - sWorldScreenY) / 5;
gTPClipRect.iTop += sY;
}
break;
case INSERTION_CODE_EAST:
if((sWorldScreenX + NORMAL_MAP_SCREEN_WIDTH) >= (MAPWIDTH - PLACEMENT_OFFSET))
{
sX = ((sWorldScreenX + NORMAL_MAP_SCREEN_WIDTH) - (MAPWIDTH - PLACEMENT_OFFSET)) / 5;
gTPClipRect.iRight -= sX;
}
break;
case INSERTION_CODE_SOUTH:
if((sWorldScreenY + NORMAL_MAP_SCREEN_HEIGHT) >= (MAPHEIGHT - PLACEMENT_OFFSET))
{
sY = ((sWorldScreenY + NORMAL_MAP_SCREEN_HEIGHT) - (MAPHEIGHT - PLACEMENT_OFFSET)) / 5;
gTPClipRect.iBottom -= sY;
}
break;
case INSERTION_CODE_WEST:
if(sWorldScreenX <= PLACEMENT_OFFSET)
{
sX = (PLACEMENT_OFFSET - sWorldScreenX) / 5;
gTPClipRect.iLeft += sX;
}
break;
}
break;
case INSERTION_CODE_EAST:
if((sWorldScreenX + NORMAL_MAP_SCREEN_WIDTH) >= (MAPWIDTH - PLACEMENT_OFFSET))
{
sX = ((sWorldScreenX + NORMAL_MAP_SCREEN_WIDTH) - (MAPWIDTH - PLACEMENT_OFFSET)) / 5;
gTPClipRect.iRight -= sX;
}
break;
case INSERTION_CODE_SOUTH:
if((sWorldScreenY + NORMAL_MAP_SCREEN_HEIGHT) >= (MAPHEIGHT - PLACEMENT_OFFSET))
{
sY = ((sWorldScreenY + NORMAL_MAP_SCREEN_HEIGHT) - (MAPHEIGHT - PLACEMENT_OFFSET)) / 5;
gTPClipRect.iBottom -= sY;
}
break;
case INSERTION_CODE_WEST:
if(sWorldScreenX <= PLACEMENT_OFFSET)
{
sX = (PLACEMENT_OFFSET - sWorldScreenX) / 5;
gTPClipRect.iLeft += sX;
}
break;
}
}
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
INT16 sCellX = 0;
INT16 sCellY = 0;
GetOverheadScreenXYFromGridNo( gMapInformation.sCenterGridNo, &sCellX, &sCellY );
// Left black border
gTPClipRectCenterLeft.iLeft = iOffsetHorizontal;
gTPClipRectCenterLeft.iTop = iOffsetVertical + 3;
gTPClipRectCenterLeft.iBottom = iOffsetVertical + 320;
gTPClipRectCenterLeft.iRight = iOffsetHorizontal + sCellX - 5 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
// Top black border
gTPClipRectCenterTop.iLeft = iOffsetHorizontal;
gTPClipRectCenterTop.iTop = iOffsetVertical + 3;
gTPClipRectCenterTop.iBottom = iOffsetVertical + sCellY - 3 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
gTPClipRectCenterTop.iRight = iOffsetHorizontal + 634;
// Right black border
gTPClipRectCenterRight.iLeft = iOffsetHorizontal + sCellX + 5 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
gTPClipRectCenterRight.iTop = iOffsetVertical + 3;
gTPClipRectCenterRight.iBottom = iOffsetVertical + 320;
gTPClipRectCenterRight.iRight = iOffsetHorizontal + 634;
// Bottom black border
gTPClipRectCenterBottom.iLeft = iOffsetHorizontal;
gTPClipRectCenterBottom.iTop = iOffsetVertical + sCellY + 3 * gGameExternalOptions.usAmbushSpreadRadiusMercs;
gTPClipRectCenterBottom.iBottom = iOffsetVertical + 320;
gTPClipRectCenterBottom.iRight = iOffsetHorizontal + 634;
}
// WANNE - MP: Center
if (is_networked && gfCenter)
else if (is_networked && gfCenter)
{
// Left black border
gTPClipRectCenterLeft.iLeft = iOffsetHorizontal;
@@ -971,7 +1051,7 @@ void RenderTacticalPlacementGUI()
gTPClipRectCenterBottom.iTop = iOffsetVertical + AIRDROPENTRYPTS_BOTTOM_Y;
gTPClipRectCenterBottom.iBottom = iOffsetVertical + 320;
gTPClipRectCenterBottom.iRight = iOffsetHorizontal + 634;
}
}
}
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
@@ -1001,8 +1081,10 @@ void RenderTacticalPlacementGUI()
UnLockVideoSurface( FRAME_BUFFER );
}
for( i = 0; i < giPlacements; i++ )
{ //Render the merc's names
for( i = 0; i < giPlacements; ++i )
{
//Render the merc's names
pSoldier = gMercPlacement[ i ].pSoldier;
xp = xResOffset + 95 + (i / 2) * 54;
@@ -1035,6 +1117,7 @@ void RenderTacticalPlacementGUI()
SetFont( FONT10ARIALBOLD );
SetFontForeground( ubColor );
SetFontShadow( 141 );
//Render the question mark over the face if the merc hasn't yet been placed.
if( gMercPlacement[ i ].fPlaced )
{
@@ -1199,9 +1282,20 @@ void TacticalPlacementHandle()
}
// WANNE - MP: Center
if ( gfCenter && ( is_networked || (gGameExternalOptions.ubSkyriderHotLZ == 3 && gMercPlacement[ gbSelectedMercID ].pSoldier->usSoldierFlagMask & SOLDIER_AIRDROP)) )
if ( gfCenter && (is_networked ||
gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE ||
( gGameExternalOptions.ubSkyriderHotLZ == 3 && gMercPlacement[gbSelectedMercID].pSoldier->usSoldierFlagMask & SOLDIER_AIRDROP )) )
{
if (gMercPlacement[ gbCursorMercID ].ubStrategicInsertionCode == INSERTION_CODE_CENTER )
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
INT32 testgridno = NOWHERE;
if ( GetOverheadMouseGridNo( &testgridno ) && PythSpacesAway( testgridno, gMapInformation.sCenterGridNo ) < gGameExternalOptions.usAmbushSpreadRadiusMercs )
{
gfValidCursor = TRUE;
}
}
else if( gMercPlacement[gbCursorMercID].ubStrategicInsertionCode == INSERTION_CODE_CENTER )
{
if (gusMouseYPos >= (iOffsetVertical + CENTERENTRYPTS_TOP_Y) && // N
gusMouseYPos <= (iOffsetVertical + CENTERENTRYPTS_BOTTOM_Y) && // S
@@ -1219,7 +1313,7 @@ void TacticalPlacementHandle()
gusMouseXPos <= (iOffsetHorizontal + AIRDROPENTRYPTS_RIGHT_X)) // E
{
gfValidCursor = TRUE;
}
}
}
}
@@ -1337,7 +1431,19 @@ void ChooseRandomEdgepoints()
{
if ( !( gMercPlacement[ i ].pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( &gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode );
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
UINT8 ubDirection;
gMercPlacement[i].pSoldier->usStrategicInsertionData = FindRandomGridNoFromSweetSpotExcludingSweetSpot( gMercPlacement[i].pSoldier, gMapInformation.sCenterGridNo, gGameExternalOptions.usAmbushSpreadRadiusMercs, &ubDirection );
// have the merc look outward. We add + 100 because later on we use this to signify that we want really enforce this direction
gMercPlacement[i].pSoldier->ubInsertionDirection = (UINT8)GetDirectionToGridNoFromGridNo( gMapInformation.sCenterGridNo, gMercPlacement[i].pSoldier->usStrategicInsertionData ) + 100;
}
else
{
gMercPlacement[ i ].pSoldier->usStrategicInsertionData = ChooseMapEdgepoint( &gMercPlacement[ i ].ubStrategicInsertionCode, lastValidICode );
}
if( !TileIsOutOfBounds(gMercPlacement[ i ].pSoldier->usStrategicInsertionData))
{
@@ -1461,27 +1567,27 @@ void MercClickCallback( MOUSE_REGION *reg, INT32 reason )
{
if(islocked != 1)//hayden
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
INT8 i;
for( i = 0; i < giPlacements; i++ )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
if( &gMercPlacement[ i ].region == reg )
INT8 i;
for( i = 0; i < giPlacements; i++ )
{
if( gbSelectedMercID != i )
if( &gMercPlacement[ i ].region == reg )
{
if( gbSelectedMercID != i )
{
if ( gGameExternalOptions.ubSkyriderHotLZ == 3 && gMercPlacement[ i ].pSoldier->usSoldierFlagMask & SOLDIER_AIRDROP )
gubDefaultButton = GROUP_BUTTON;
gbSelectedMercID = i;
gpTacticalPlacementSelectedSoldier = gMercPlacement[ i ].pSoldier;
if( gubDefaultButton == GROUP_BUTTON )
{
gubSelectedGroupID = gpTacticalPlacementSelectedSoldier->ubGroupID;
gbSelectedMercID = i;
gpTacticalPlacementSelectedSoldier = gMercPlacement[ i ].pSoldier;
if( gubDefaultButton == GROUP_BUTTON )
{
gubSelectedGroupID = gpTacticalPlacementSelectedSoldier->ubGroupID;
}
}
return;
}
return;
}
}
}
}
@@ -1496,7 +1602,7 @@ void SelectNextUnplacedUnit()
if ( gGameExternalOptions.ubSkyriderHotLZ == 3 && gMercPlacement[ gbSelectedMercID ].pSoldier->usSoldierFlagMask & SOLDIER_AIRDROP )
gubDefaultButton = GROUP_BUTTON;
for( i = gbSelectedMercID; i < giPlacements; i++ )
for( i = gbSelectedMercID; i < giPlacements; ++i )
{ //go from the currently selected soldier to the end
if( !gMercPlacement[ i ].fPlaced )
{ //Found an unplaced merc. Select him.
@@ -1509,7 +1615,8 @@ void SelectNextUnplacedUnit()
return;
}
}
for( i = 0; i < gbSelectedMercID; i++ )
for( i = 0; i < gbSelectedMercID; ++i )
{ //go from the beginning to the currently selected soldier
if( !gMercPlacement[ i ].fPlaced )
{ //Found an unplaced merc. Select him.
@@ -1522,6 +1629,7 @@ void SelectNextUnplacedUnit()
return;
}
}
//checked the whole array, and everybody has been placed. Select nobody.
if( !gfEveryonePlaced )
{
@@ -1687,8 +1795,10 @@ void PutDownMercPiece( INT32 iPlacement )
Assert( 0 );
break;
}
if( gMercPlacement[ iPlacement ].fPlaced )
PickUpMercPiece( iPlacement );
sGridNo = FindGridNoFromSweetSpot( pSoldier, pSoldier->sInsertionGridNo, 4, &ubDirection );
if(!TileIsOutOfBounds(sGridNo))
@@ -1720,9 +1830,15 @@ void PutDownMercPiece( INT32 iPlacement )
{
pSoldier->EVENT_SetSoldierPosition( (FLOAT)sCellX, (FLOAT)sCellY );
}
if ( gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE )
{
ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( gMapInformation.sCenterGridNo, sGridNo ) + 100;
}
pSoldier->EVENT_SetSoldierDirection( ubDirection );
pSoldier->ubInsertionDirection = pSoldier->ubDirection;
gMercPlacement[ iPlacement ].fPlaced = TRUE;
gMercPlacement[ iPlacement ].pSoldier->bInSector = TRUE;
//hayden
+1
View File
@@ -8276,6 +8276,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};
+1
View File
@@ -8289,6 +8289,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};
+1
View File
@@ -8274,6 +8274,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n",
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds",
};
+1
View File
@@ -8275,6 +8275,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};
+1
View File
@@ -8106,6 +8106,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};
+1
View File
@@ -8284,6 +8284,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};
+1
View File
@@ -8301,6 +8301,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};
+1
View File
@@ -8273,6 +8273,7 @@ STR16 szBackgroundText_Value[]=
L" %s%d%% effectiveness at diagnosing diseases\n", // TODO.Translate
L" %s%d%% effectiveness at treating population against diseases\n",
L"Can spot tracks up to %d tiles away\n",
L" %s%d%% initial distance to enemy in ambush\n",
L" dislikes some other backgrounds", // TODO.Translate
};