Vehicle Update: Roadkill with vehicles and ramming (by anv)

- new feature: ramming people - set with Tactical Gameplay Settings > ALLOW_CARS_DRIVING_OVER_PEOPLE and Tactical Gameplay Settings > ALLOW_TANKS_DRIVING_OVER_PEOPLE - when shift is pressed planned vehicle route will go through people. Those who will stay on its path will be hit, causing wounds and knock-outs.
- new feature: ramming structures - when shift is pressed planned vehicle route will go through obstacles. When vehicle hits the structure on its path it will be destroyed, causing small damage to vehicle too (with exception of tank). Tactical Gameplay Settings > CARS_RAMMING_MAX_STRUCTURE_ARMOUR and Tactical Gameplay Settings > TANKS_RAMMING_MAX_STRUCTURE_ARMOUR settings control how well armoured structure can be driven through and amount of potential damage for vehicle.
- see: http://www.ja-galaxy-forum.com/ubbthreads.php/topics/333829/Drivable_Vehicles#Post333829


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7284 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-06-21 10:07:11 +00:00
parent fc78fb6031
commit dbc852ea74
14 changed files with 331 additions and 19 deletions
+32 -3
View File
@@ -40,6 +40,7 @@
#include "gamesettings.h"
#include "Buildings.h"
#include "soldier profile.h" // added by SANDRO
#include "Soldier macros.h"
#endif
#include "connect.h"
@@ -2516,6 +2517,7 @@ b=GetJA2Clock();//return s->sGridNo+6;
STRUCTURE_FILE_REF * pStructureFileRef=NULL;
UINT16 usAnimSurface;
//INT32 iCnt2, iCnt3;
BOOLEAN fVehicleIgnoreObstacles = FALSE;
#endif
INT32 iLastDir = 0;
@@ -2628,6 +2630,25 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
}
fPathAroundPeople = ( (fFlags & PATH_THROUGH_PEOPLE) == 0 );
// anv: vehicles can drive through people and structures if shift is pressed
// (or rather route through can be planned, actual driving through is dependent on SOLDIER_RAM_THROUGH_OBSTACLES flag set in Handle UI)
if ( _KeyDown( SHIFT ) && fPathingForPlayer && ( s->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
fVehicleIgnoreObstacles = TRUE;
}
// AI can't press shift, let's assume only tanks ram through (we wouldn't want AI cars to get destroyed kamikazing through walls, no matter how funny that would be)
else if( !fPathingForPlayer && TANK(s) )
{
fVehicleIgnoreObstacles = TRUE;
}
if( fVehicleIgnoreObstacles &&
( ( gGameExternalOptions.fAllowCarsDrivingOverPeople && !TANK(s) ) ||
( gGameExternalOptions.fAllowTanksDrivingOverPeople && TANK(s) ) ) )
{
fPathAroundPeople = FALSE;
}
fCloseGoodEnough = ( (fFlags & PATH_CLOSE_GOOD_ENOUGH) != 0);
if ( fCloseGoodEnough )
{
@@ -2758,6 +2779,10 @@ if(!GridNoOnVisibleWorldTile(iDestination))
{
usOKToAddStructID = INVALID_STRUCTURE_ID;
}
if( fVehicleIgnoreObstacles )
{
usOKToAddStructID = VEHICLE_IGNORE_OBSTACLES_STRUCTURE_ID;
}
}
else
@@ -3006,7 +3031,7 @@ if(!GridNoOnVisibleWorldTile(iDestination))
{
if ( iCnt != iLastDir )
{
if ( !OkayToAddStructureToWorld( curLoc, ubLevel, &(pStructureFileRef->pDBStructureRef[ iStructIndex ]), usOKToAddStructID ) )
if ( !OkayToAddStructureToWorld( curLoc, ubLevel, &(pStructureFileRef->pDBStructureRef[ iStructIndex ]), usOKToAddStructID, FALSE, s->ubID ) )
{
// we have to abort this loop and possibly reset the loop conditions to
// search in the other direction (if we haven't already done the other dir)
@@ -3126,7 +3151,7 @@ if(!GridNoOnVisibleWorldTile(iDestination))
}
//how much is admission to the next tile
if ( gfPathAroundObstacles )
if ( gfPathAroundObstacles && !fVehicleIgnoreObstacles )
{
nextCost = gubWorldMovementCosts[ newLoc ][ iCnt ][ ubLevel ];
@@ -3351,6 +3376,10 @@ if(!GridNoOnVisibleWorldTile(iDestination))
goto NEXTDIR;
}
else if( fVehicleIgnoreObstacles )
{
nextCost = TRAVELCOST_FLAT;
}
else
{
nextCost = TRAVELCOST_FLAT;
@@ -3394,7 +3423,7 @@ if(!GridNoOnVisibleWorldTile(iDestination))
// then 0 1 2 3 4 5 6), we must subtract 1 from the direction
// ATE: Send in our existing structure ID so it's ignored!
if (!OkayToAddStructureToWorld( newLoc, ubLevel, &(pStructureFileRef->pDBStructureRef[ iStructIndex ]), usOKToAddStructID ) )
if (!OkayToAddStructureToWorld( newLoc, ubLevel, &(pStructureFileRef->pDBStructureRef[ iStructIndex ]), usOKToAddStructID, FALSE, s->ubID ) )
{
goto NEXTDIR;
}