Driveable vehicle update (by anv)

- Vehicles can now exit sector in tactical screen.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7216 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-05-19 18:49:20 +00:00
parent 0fd5f010b8
commit 6f253e7e49
3 changed files with 40 additions and 7 deletions
+15 -2
View File
@@ -4089,7 +4089,12 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
curr = pGroup->pPlayerList;
while( curr )
{
if ( OK_CONTROLLABLE_MERC( curr->pSoldier) )
// anv: passengers can't move anyway
if( curr->pSoldier->bAssignment == VEHICLE )
{
curr->pSoldier->ubWaitActionToDo = 0;
}
else if ( OK_CONTROLLABLE_MERC( curr->pSoldier ) )
{
if ( ubTacticalDirection != 255 )
{
@@ -4784,6 +4789,12 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu
return FALSE;
}
// anv: vehicles can't use inner exit grids
if( bExitDirection == (-1) && MercPtrs[gusSelectedSoldier]->bAssignment == VEHICLE )
{
return FALSE;
}
/*
//Exception code for the two sectors in San Mona that are separated by a cliff. We want to allow strategic
//traversal, but NOT tactical traversal. The only way to tactically go from D4 to D5 (or viceversa) is to enter
@@ -4812,7 +4823,9 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu
for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++)
{
// If we are controllable
if ( OK_CONTROLLABLE_MERC( pSoldier) && pSoldier->bAssignment == CurrentSquad( ) )
//if ( OK_CONTROLLABLE_MERC( pSoldier) && pSoldier->bAssignment == CurrentSquad( ) )
if ( OK_CONTROLLABLE_MERC( pSoldier) && ( pSoldier->bAssignment == CurrentSquad( ) ||
( pSoldier->bAssignment == VEHICLE && GetSoldierStructureForVehicle(pSoldier->iVehicleId)->bAssignment == CurrentSquad( ) ) ) )
{
//Need to keep a copy of a good soldier, so we can access it later, and
//not more than once.
+9 -3
View File
@@ -4557,9 +4557,15 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL
SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier )
{
INT32 cnt, cnt2;
// anv: soldier's "assignment" can be a vehicle, not a proper squad, causing out-of-range in second loop
INT8 bMaxSquad = pSoldier->bAssignment;
if( bMaxSquad >= NUMBER_OF_SQUADS )
{
bMaxSquad = NUMBER_OF_SQUADS - 1;
}
for( cnt = pSoldier->bAssignment + 1 ; cnt < NUMBER_OF_SQUADS; cnt++ )
for( cnt = bMaxSquad + 1 ; cnt < NUMBER_OF_SQUADS; cnt++ )
{
for( cnt2 =0; cnt2 < NUMBER_OF_SOLDIERS_PER_SQUAD; cnt2++ )
{
@@ -4572,7 +4578,7 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier )
// none found,
// Now loop back
for( cnt = 0; cnt <= pSoldier->bAssignment; cnt++ )
for( cnt = 0; cnt <= bMaxSquad; cnt++ )
{
for( cnt2 =0; cnt2 < NUMBER_OF_SOLDIERS_PER_SQUAD; cnt2++ )
{
+16 -2
View File
@@ -181,6 +181,17 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )//
gExitDialog.fAllMove = TRUE;
}
// anv: vehicle always move with all passengers inside
if( MercPtrs[gusSelectedSoldier]->bAssignment == VEHICLE )
{
gExitDialog.fSingleMoveDisabled = TRUE;
gExitDialog.fSingleMoveOn = FALSE;
gExitDialog.fSingleMove = FALSE;
gExitDialog.fAllMoveDisabled = FALSE;
gExitDialog.fAllMoveOn = TRUE;
gExitDialog.fAllMove = TRUE;
}
if ( gTacticalStatus.uiFlags & INCOMBAT )
{
INT32 i, cnt = 0;
@@ -224,11 +235,14 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )//
if( !pSoldier->flags.fBetweenSectors &&
pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ &&
pSoldier->stats.bLife >= OKLIFE &&
pSoldier->bAssignment != MercPtrs[ gusSelectedSoldier ]->bAssignment &&
pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD )
( pSoldier->bAssignment != MercPtrs[ gusSelectedSoldier ]->bAssignment ||
( pSoldier->bAssignment == VEHICLE && pSoldier->iVehicleId != MercPtrs[ gusSelectedSoldier ]->iVehicleId ) ) &&
pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD
&& !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{ //KM: We need to determine if there are more than one squad (meaning other concious mercs in a different squad or assignment)
// These conditions were done to the best of my knowledge, so if there are other situations that require modification,
// then feel free to do so.
// anv: added skipping vehicles and checking if soldiers on the same assignment aren't just in two different vehicles
gExitDialog.fMultipleSquadsInSector = TRUE;
break;
}