Depending on whch direction the helicopter came from, a different aniamtion will play when performing a heli insertion.

Requires GameDir >= r2212.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7755 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-02-26 20:16:13 +00:00
parent 34803db3cd
commit 3f615cc68b
4 changed files with 146 additions and 27 deletions
+32 -1
View File
@@ -42,6 +42,7 @@
#include "Facilities.h"
#include "Debug Control.h"
#include "expat.h"
#include "merc entering.h" // added by Flugente
#endif
#include "Vehicles.h"
@@ -1692,12 +1693,42 @@ UINT8 MoveAllInHelicopterToFootMovementGroup( INT8 bNewSquad )
pSoldier->ubStrategicInsertionCode = ubInsertionCode;
pSoldier->usStrategicInsertionData = usInsertionData;
}
// Flugente: we are leaving the helicopter and instantly deploy into combat - this must be an airdrop
pSoldier->usSoldierFlagMask |= (SOLDIER_AIRDROP_TURN|SOLDIER_AIRDROP);
}
}
//Flugente: we need to determine what direction th heli came from, so that we can play the correct animation
UINT8 usDirection = NORTH;
GROUP* pGroup = gpGroupList;
while ( pGroup )
{
if ( pGroup->usGroupTeam == OUR_TEAM && IsGroupTheHelicopterGroup( pGroup ) ) // Group came from the examined source
{
if ( pGroup->ubSectorX == pGroup->ubPrevX - 1 && pGroup->ubSectorY == pGroup->ubPrevY )
{
usDirection = EAST;
}
else if ( pGroup->ubSectorX == pGroup->ubPrevX + 1 && pGroup->ubSectorY == pGroup->ubPrevY )
{
usDirection = WEST;
}
else if ( pGroup->ubSectorX == pGroup->ubPrevX && pGroup->ubSectorY == pGroup->ubPrevY - 1 )
{
usDirection = SOUTH;
}
SetHelicopterDropDirection( usDirection );
break;
}
pGroup = pGroup->next;
}
SetHelicopterDropDirection( usDirection );
if ( fAnyoneAboard )
{
ubGroupId = SquadMovementGroups[ bNewSquad ];
+111 -26
View File
@@ -375,6 +375,9 @@ INT8 gbCurDrop;
INT8 gbExitCount;
INT8 gbHeliRound;
// Flugente: direction of helicopter approach
UINT8 gHeliEnterDirection = NORTH;
BOOLEAN fFadingHeliIn = FALSE;
BOOLEAN fFadingHeliOut = FALSE;
@@ -393,12 +396,10 @@ void ResetHeliSeats( )
void AddMercToHeli( UINT8 ubID )
{
INT32 cnt;
if ( gbNumHeliSeatsOccupied < MAX_MERC_IN_HELI )
{
// Check if it already exists!
for ( cnt = 0; cnt < gbNumHeliSeatsOccupied; cnt++ )
for ( INT32 cnt = 0; cnt < gbNumHeliSeatsOccupied; ++cnt )
{
if ( gusHeliSeats[ cnt ] == ubID )
{
@@ -407,7 +408,7 @@ void AddMercToHeli( UINT8 ubID )
}
gusHeliSeats[ gbNumHeliSeatsOccupied ] = ubID;
gbNumHeliSeatsOccupied++;
++gbNumHeliSeatsOccupied;
}
}
@@ -417,6 +418,11 @@ void SetHelicopterDroppoint( INT32 sGridNo )
gsGridNoSweetSpot = sGridNo;
}
void SetHelicopterDropDirection( UINT8 usDirection )
{
gHeliEnterDirection = usDirection;
}
void StartHelicopterRun()
{
INT16 sX, sY;
@@ -432,10 +438,27 @@ void StartHelicopterRun()
ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY );
gsHeliXPos = sX - ( 2 * CELL_X_SIZE );
gsHeliYPos = sY - ( 10 * CELL_Y_SIZE );
//gsHeliXPos = sX - ( 3 * CELL_X_SIZE );
//gsHeliYPos = sY + ( 4 * CELL_Y_SIZE );
if ( gHeliEnterDirection == SOUTH )
{
gsHeliXPos = sX - (2 * CELL_X_SIZE);
gsHeliYPos = sY + (10 * CELL_Y_SIZE);
}
else if ( gHeliEnterDirection == EAST )
{
gsHeliXPos = sX + (10 * CELL_X_SIZE);
gsHeliYPos = sY + (2 * CELL_Y_SIZE);
}
else if ( gHeliEnterDirection == WEST )
{
gsHeliXPos = sX - (10 * CELL_X_SIZE);
gsHeliYPos = sY - (2 * CELL_Y_SIZE);
}
else
{
gsHeliXPos = sX - (2 * CELL_X_SIZE);
gsHeliYPos = sY - (10 * CELL_Y_SIZE);
}
gdHeliZPos = 0;
gsHeliScript = 0;
gbCurDrop = 0;
@@ -533,11 +556,11 @@ void HandleHeliDrop( )
for ( cnt = gbCurDrop; cnt < gbNumHeliSeatsOccupied; cnt++ )
{
// Add merc to sector
#ifdef JA2UB
#ifdef JA2UB
//MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO;
#else
#else
//MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation;
@@ -549,7 +572,6 @@ void HandleHeliDrop( )
HandleMercArrivesQuotes( MercPtrs[ gusHeliSeats[ cnt ] ] );
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ cnt ] ]->GetName() );
}
// Remove heli
@@ -569,7 +591,6 @@ void HandleHeliDrop( )
UnLockPauseState();
UnPauseGame();
// Select our first guy
SelectSoldier( gusHeliSeats[ 0 ], FALSE, TRUE );
@@ -580,7 +601,6 @@ void HandleHeliDrop( )
HandleFirstHeliDropOfGame( );
return;
}
#endif
gfIgnoreScrolling = TRUE;
@@ -673,7 +693,7 @@ void HandleHeliDrop( )
if ( gbCurDrop < bEndVal )
{
// Flugente: it is now possible to use airdrops with soldiers after they have arrived in Arulco. In that case, they might have an animation that breaks EVENT_InitNewSoldierAnim prematurely.
// In the worst case, this can cause the game to be unable to finsih the airdrop. For that reason, we set all those soldier to the STANDING aniamtion.
// In the worst case, this can cause the game to be unable to finish the airdrop. For that reason, we set all those soldier to the STANDING aniamtion.
MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usAnimState = STANDING;
//sWorldX = CenterX( gsGridNoSweetSpot );
@@ -696,7 +716,7 @@ void HandleHeliDrop( )
}
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->GetName() );
gbCurDrop++;
++gbCurDrop;
gfIngagedInDrop = TRUE;
}
@@ -755,12 +775,46 @@ void HandleHeliDrop( )
case HELI_MOVEY:
gpHeli->sRelativeY += 4;
if ( gHeliEnterDirection == SOUTH )
{
gpHeli->sRelativeY -= 4;
}
else if ( gHeliEnterDirection == EAST )
{
gpHeli->sRelativeX -= 4;
gpHeli->sRelativeY -= 1;
}
else if ( gHeliEnterDirection == WEST )
{
gpHeli->sRelativeX += 4;
gpHeli->sRelativeY += 1;
}
else
{
gpHeli->sRelativeY += 4;
}
break;
case HELI_MOVELARGERY:
gpHeli->sRelativeY += 6;
if ( gHeliEnterDirection == SOUTH )
{
gpHeli->sRelativeY -= 6;
}
else if ( gHeliEnterDirection == EAST )
{
gpHeli->sRelativeX -= 6;
gpHeli->sRelativeY -= 1;
}
else if ( gHeliEnterDirection == WEST )
{
gpHeli->sRelativeX += 6;
gpHeli->sRelativeY += 1;
}
else
{
gpHeli->sRelativeY += 6;
}
break;
case HELI_GOTO_BEGINDROP:
@@ -781,7 +835,23 @@ void HandleHeliDrop( )
AniParams.sX = gsHeliXPos;
AniParams.sY = gsHeliYPos;
AniParams.sZ = (INT16)gdHeliZPos;
strcpy( AniParams.zCachedFile, "TILECACHE\\HELI_SH.STI" );
if ( gHeliEnterDirection == SOUTH )
{
strcpy( AniParams.zCachedFile, "TILECACHE\\HELI_SH_SOUTH.STI" );
}
else if ( gHeliEnterDirection == EAST )
{
strcpy( AniParams.zCachedFile, "TILECACHE\\HELI_SH_EAST.STI" );
}
else if ( gHeliEnterDirection == WEST )
{
strcpy( AniParams.zCachedFile, "TILECACHE\\HELI_SH_WEST.STI" );
}
else
{
strcpy( AniParams.zCachedFile, "TILECACHE\\HELI_SH.STI" );
}
gpHeli = CreateAnimationTile( &AniParams );
break;
@@ -818,13 +888,32 @@ void HandleHeliDrop( )
ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY );
gsHeliXPos = sX - ( 2 * CELL_X_SIZE );
gsHeliYPos = sY - ( 10 * CELL_Y_SIZE );
if ( gHeliEnterDirection == SOUTH )
{
gsHeliXPos = sX - (2 * CELL_X_SIZE);
gsHeliYPos = sY + (10 * CELL_Y_SIZE);
}
else if ( gHeliEnterDirection == EAST )
{
gsHeliXPos = sX + (10 * CELL_X_SIZE);
gsHeliYPos = sY + (2 * CELL_Y_SIZE);
}
else if ( gHeliEnterDirection == WEST )
{
gsHeliXPos = sX - (10 * CELL_X_SIZE);
gsHeliYPos = sY - (2 * CELL_Y_SIZE);
}
else
{
gsHeliXPos = sX - (2 * CELL_X_SIZE);
gsHeliYPos = sY - (10 * CELL_Y_SIZE);
}
gdHeliZPos = 0;
gsHeliScript = 0;
gbExitCount = 0;
gubHeliState = HELI_APPROACH;
gbHeliRound++;
++gbHeliRound;
// Ahh, but still delete the heli!
DeleteAniTile( gpHeli );
@@ -858,8 +947,7 @@ void HandleHeliDrop( )
break;
}
gsHeliScript++;
++gsHeliScript;
}
}
}
@@ -933,6 +1021,3 @@ void HandleFirstHeliDropOfGame( )
// Send message to turn on ai again....
CharacterDialogueWithSpecialEvent( 0, 0, 0, DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 );
}
+1
View File
@@ -7,6 +7,7 @@ void AddMercToHeli( UINT8 ubID );
// Flugente: we might want to set the helicopter dropoff point without starting it at the same time
void SetHelicopterDroppoint( INT32 sGridNo );
void SetHelicopterDropDirection( UINT8 usDirection );
void StartHelicopterRun();
+2
View File
@@ -1220,6 +1220,8 @@ void InitHelicopterEntranceByMercs( void )
SetHelicopterDroppoint( gGameExternalOptions.iInitialMercArrivalLocation );
#endif
SetHelicopterDropDirection(NORTH);
gTacticalStatus.fDidGameJustStart = FALSE;
}
}