New Feature: Allow driving vehicles in tactical (by anv)

- To control vehicle, click on it or on the steering wheel in team panel under driver's portrait.
- Vehicles have two gears - slow drive and fast drive, switchable just like walking and running ('S', 'R', double-click).
- Vehicles working: Ice Cream Van, Hummer, Jeep, El Dorado and, potentially, tanks.
- Passengers can be selected and ordered to open fire from the inside
- You can also open inventory screen for passengers, pass or throw items, etc.

Normally vehicle is treated as any other merc and has its own APs. It has obvious disadvantages - it's possible to drive in the middle of the enemy group using vehicle's 100AP,
and then use all your mercs inside vehicle with their still full APs to kill everything that moves at point blank range - with even the driver participating!
- To prevent that you can set Tactical Gameplay Settings > AP_SHARED_AMONG_PASSENGERS_AND_VEHICLE_MODE with following calculation methods

more infos: http://www.bears-pit.com/board/ubbthreads.php/topics/332208/1.html


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7193 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2014-05-06 08:46:26 +00:00
parent 0e1670bf21
commit fe995dc2f3
15 changed files with 279 additions and 54 deletions
+56 -15
View File
@@ -1728,7 +1728,8 @@ void HandleVehicleMovementSound( SOLDIERTYPE *pSoldier, BOOLEAN fOn )
{
if ( pVehicle->iMovementSoundID == NO_SAMPLE )
{
pVehicle->iMovementSoundID = PlayJA2Sample( pVehicle->iMoveSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
// anv: will be played in InternalPlaySoldierFootstepSound
//pVehicle->iMovementSoundID = PlayJA2Sample( pVehicle->iMoveSound, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
}
}
else
@@ -3384,7 +3385,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
|| usNewState == SWATTING_WK)
{
// CHECK FOR SIDEWAYS!
if ( this->ubDirection == gPurpendicularDirection[ this->ubDirection ][ this->pathing.usPathingData[ this->pathing.usPathIndex ] ] )
if ( !( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) && this->ubDirection == gPurpendicularDirection[ this->ubDirection ][ this->pathing.usPathingData[ this->pathing.usPathIndex ] ] )
{
// We are perpendicular!
// SANDRO - wait wait wait!!! We need to determine if gonna sidestep with weapon raised
@@ -5289,9 +5290,10 @@ UINT16 SOLDIERTYPE::GetMoveStateBasedOnStance( UINT8 ubStanceHeight )
switch ( ubStanceHeight )
{
case ANIM_STAND:
if ( this->flags.fUIMovementFast && !( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
//if ( this->flags.fUIMovementFast && !( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
if ( this->flags.fUIMovementFast )
{
return( RUNNING );
return( RUNNING );
}
else
{
@@ -7876,14 +7878,29 @@ void SOLDIERTYPE::TurnSoldier( void )
INT32 cnt;
// If we are a vehicle... DON'T TURN!
// anv: YES PLIZ DO
if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE )
{
if ( this->ubBodyType != TANK_NW && this->ubBodyType != TANK_NE )
//if ( this->ubBodyType != TANK_NW && this->ubBodyType != TANK_NE )
//{
// return;
//}
// need to turn around passengers inside
INT32 iId = this->bVehicleID;
// Loop through passengers and update each guy's rotation
for( INT32 iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ )
{
return;
if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL )
{
pVehicleList[ iId ].pPassengers[ iCounter ]->flags.fDontChargeTurningAPs = TRUE;
pVehicleList[ iId ].pPassengers[ iCounter ]->EVENT_SetSoldierDesiredDirection( this->pathing.bDesiredDirection );
//pVehicleList[ iId ].pPassengers[ iCounter ]->pathing.bDesiredDirection = this->pathing.bDesiredDirection;
}
}
}
else // Lesh: patch for "Bug: Enemy turns around in turn based mode!"
//else // Lesh: patch for "Bug: Enemy turns around in turn based mode!"
{
// in case of errors in turning tasks
if ( this->pathing.bDesiredDirection > 7 || this->pathing.bDesiredDirection < 0)
@@ -8549,8 +8566,8 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier
UINT32 uiTerrainDelay;
UINT32 uiSpeed = 0;
INT8 bBreathDef, bLifeDef;
INT16 bAgilDef;
INT8 bBreathDef = 0, bLifeDef = 0;
INT16 bAgilDef = 0;
INT8 bAdditional = 0;
// for those animations which have a speed of zero, we have to calculate it
@@ -8675,13 +8692,29 @@ void CalculateSoldierAniSpeed( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pStatsSoldier
uiTerrainDelay = 40; // standing still
}
bBreathDef = 50 - ( pStatsSoldier->bBreath / 2 );
if( !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) )
{
bBreathDef = 50 - ( pStatsSoldier->bBreath / 2 );
if ( bBreathDef > 30 )
bBreathDef = 30;
if ( bBreathDef > 30 )
bBreathDef = 30;
bAgilDef = 50 - ( EffectiveAgility( pStatsSoldier, FALSE ) / 4 );
bLifeDef = 50 - ( pStatsSoldier->stats.bLife / 2 );
bAgilDef = 50 - ( EffectiveAgility( pStatsSoldier, FALSE ) / 4 );
bLifeDef = 50 - ( pStatsSoldier->stats.bLife / 2 );
}
else
{
// anv: vehicles have no agility and making them slower with less fuel would make no sense
// instead take gear into consideration here
if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE && pSoldier->usAnimState == RUNNING )
{
bAgilDef = 10;
}
else
{
bAgilDef = 30;
}
}
uiTerrainDelay += ( bLifeDef + bBreathDef + bAgilDef + bAdditional );
@@ -10237,7 +10270,9 @@ BOOLEAN SOLDIERTYPE::InternalDoMercBattleSound( UINT8 ubBattleSoundID, INT8 bSpe
if ( ( this->flags.uiStatusFlags & SOLDIER_VEHICLE ) )
{
// Pick a passenger from vehicle....
pSoldier = PickRandomPassengerFromVehicle( this );
//pSoldier = PickRandomPassengerFromVehicle( this );
// anv: as vehicles can be controlled, get a driver
pSoldier = GetDriver(this->bVehicleID);
if ( pSoldier == NULL )
{
@@ -20453,6 +20488,12 @@ void InternalPlaySoldierFootstepSound( SOLDIERTYPE * pSoldier )
PlaySoldierJA2Sample( pSoldier->ubID, ubSoundBase + pSoldier->ubLastFootPrintSound, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE );
}
}
else
{
// anv: vehicle sounds
//PlaySoldierJA2Sample( pSoldier->ubID, S_VECH1_MOVE, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE );
PlaySoldierJA2Sample( pSoldier->ubID, pVehicleList[ pSoldier->bVehicleID ].iMoveSound, RATE_11025, SoundVolume( bVolume, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ), TRUE );
}
}
void PlaySoldierFootstepSound( SOLDIERTYPE *pSoldier )