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 "Facilities.h"
#include "Debug Control.h" #include "Debug Control.h"
#include "expat.h" #include "expat.h"
#include "merc entering.h" // added by Flugente
#endif #endif
#include "Vehicles.h" #include "Vehicles.h"
@@ -1692,12 +1693,42 @@ UINT8 MoveAllInHelicopterToFootMovementGroup( INT8 bNewSquad )
pSoldier->ubStrategicInsertionCode = ubInsertionCode; pSoldier->ubStrategicInsertionCode = ubInsertionCode;
pSoldier->usStrategicInsertionData = usInsertionData; pSoldier->usStrategicInsertionData = usInsertionData;
} }
// Flugente: we are leaving the helicopter and instantly deploy into combat - this must be an airdrop // Flugente: we are leaving the helicopter and instantly deploy into combat - this must be an airdrop
pSoldier->usSoldierFlagMask |= (SOLDIER_AIRDROP_TURN|SOLDIER_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 ) if ( fAnyoneAboard )
{ {
ubGroupId = SquadMovementGroups[ bNewSquad ]; ubGroupId = SquadMovementGroups[ bNewSquad ];
+111 -26
View File
@@ -375,6 +375,9 @@ INT8 gbCurDrop;
INT8 gbExitCount; INT8 gbExitCount;
INT8 gbHeliRound; INT8 gbHeliRound;
// Flugente: direction of helicopter approach
UINT8 gHeliEnterDirection = NORTH;
BOOLEAN fFadingHeliIn = FALSE; BOOLEAN fFadingHeliIn = FALSE;
BOOLEAN fFadingHeliOut = FALSE; BOOLEAN fFadingHeliOut = FALSE;
@@ -393,12 +396,10 @@ void ResetHeliSeats( )
void AddMercToHeli( UINT8 ubID ) void AddMercToHeli( UINT8 ubID )
{ {
INT32 cnt;
if ( gbNumHeliSeatsOccupied < MAX_MERC_IN_HELI ) if ( gbNumHeliSeatsOccupied < MAX_MERC_IN_HELI )
{ {
// Check if it already exists! // Check if it already exists!
for ( cnt = 0; cnt < gbNumHeliSeatsOccupied; cnt++ ) for ( INT32 cnt = 0; cnt < gbNumHeliSeatsOccupied; ++cnt )
{ {
if ( gusHeliSeats[ cnt ] == ubID ) if ( gusHeliSeats[ cnt ] == ubID )
{ {
@@ -407,7 +408,7 @@ void AddMercToHeli( UINT8 ubID )
} }
gusHeliSeats[ gbNumHeliSeatsOccupied ] = ubID; gusHeliSeats[ gbNumHeliSeatsOccupied ] = ubID;
gbNumHeliSeatsOccupied++; ++gbNumHeliSeatsOccupied;
} }
} }
@@ -417,6 +418,11 @@ void SetHelicopterDroppoint( INT32 sGridNo )
gsGridNoSweetSpot = sGridNo; gsGridNoSweetSpot = sGridNo;
} }
void SetHelicopterDropDirection( UINT8 usDirection )
{
gHeliEnterDirection = usDirection;
}
void StartHelicopterRun() void StartHelicopterRun()
{ {
INT16 sX, sY; INT16 sX, sY;
@@ -432,10 +438,27 @@ void StartHelicopterRun()
ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY ); ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY );
gsHeliXPos = sX - ( 2 * CELL_X_SIZE ); if ( gHeliEnterDirection == SOUTH )
gsHeliYPos = sY - ( 10 * CELL_Y_SIZE ); {
//gsHeliXPos = sX - ( 3 * CELL_X_SIZE ); gsHeliXPos = sX - (2 * CELL_X_SIZE);
//gsHeliYPos = sY + ( 4 * CELL_Y_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; gdHeliZPos = 0;
gsHeliScript = 0; gsHeliScript = 0;
gbCurDrop = 0; gbCurDrop = 0;
@@ -533,11 +556,11 @@ void HandleHeliDrop( )
for ( cnt = gbCurDrop; cnt < gbNumHeliSeatsOccupied; cnt++ ) for ( cnt = gbCurDrop; cnt < gbNumHeliSeatsOccupied; cnt++ )
{ {
// Add merc to sector // Add merc to sector
#ifdef JA2UB #ifdef JA2UB
//MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO;
#else #else
//MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation;
@@ -549,7 +572,6 @@ void HandleHeliDrop( )
HandleMercArrivesQuotes( MercPtrs[ gusHeliSeats[ cnt ] ] ); HandleMercArrivesQuotes( MercPtrs[ gusHeliSeats[ cnt ] ] );
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ cnt ] ]->GetName() ); ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ cnt ] ]->GetName() );
} }
// Remove heli // Remove heli
@@ -569,7 +591,6 @@ void HandleHeliDrop( )
UnLockPauseState(); UnLockPauseState();
UnPauseGame(); UnPauseGame();
// Select our first guy // Select our first guy
SelectSoldier( gusHeliSeats[ 0 ], FALSE, TRUE ); SelectSoldier( gusHeliSeats[ 0 ], FALSE, TRUE );
@@ -580,7 +601,6 @@ void HandleHeliDrop( )
HandleFirstHeliDropOfGame( ); HandleFirstHeliDropOfGame( );
return; return;
} }
#endif #endif
gfIgnoreScrolling = TRUE; gfIgnoreScrolling = TRUE;
@@ -673,7 +693,7 @@ void HandleHeliDrop( )
if ( gbCurDrop < bEndVal ) 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. // 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; MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usAnimState = STANDING;
//sWorldX = CenterX( gsGridNoSweetSpot ); //sWorldX = CenterX( gsGridNoSweetSpot );
@@ -696,7 +716,7 @@ void HandleHeliDrop( )
} }
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->GetName() ); ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->GetName() );
gbCurDrop++; ++gbCurDrop;
gfIngagedInDrop = TRUE; gfIngagedInDrop = TRUE;
} }
@@ -755,12 +775,46 @@ void HandleHeliDrop( )
case HELI_MOVEY: 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; break;
case HELI_MOVELARGERY: 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; break;
case HELI_GOTO_BEGINDROP: case HELI_GOTO_BEGINDROP:
@@ -781,7 +835,23 @@ void HandleHeliDrop( )
AniParams.sX = gsHeliXPos; AniParams.sX = gsHeliXPos;
AniParams.sY = gsHeliYPos; AniParams.sY = gsHeliYPos;
AniParams.sZ = (INT16)gdHeliZPos; 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 ); gpHeli = CreateAnimationTile( &AniParams );
break; break;
@@ -818,13 +888,32 @@ void HandleHeliDrop( )
ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY ); ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY );
gsHeliXPos = sX - ( 2 * CELL_X_SIZE ); if ( gHeliEnterDirection == SOUTH )
gsHeliYPos = sY - ( 10 * CELL_Y_SIZE ); {
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; gdHeliZPos = 0;
gsHeliScript = 0; gsHeliScript = 0;
gbExitCount = 0; gbExitCount = 0;
gubHeliState = HELI_APPROACH; gubHeliState = HELI_APPROACH;
gbHeliRound++; ++gbHeliRound;
// Ahh, but still delete the heli! // Ahh, but still delete the heli!
DeleteAniTile( gpHeli ); DeleteAniTile( gpHeli );
@@ -858,8 +947,7 @@ void HandleHeliDrop( )
break; break;
} }
gsHeliScript++; ++gsHeliScript;
} }
} }
} }
@@ -933,6 +1021,3 @@ void HandleFirstHeliDropOfGame( )
// Send message to turn on ai again.... // Send message to turn on ai again....
CharacterDialogueWithSpecialEvent( 0, 0, 0, DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 ); 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 // Flugente: we might want to set the helicopter dropoff point without starting it at the same time
void SetHelicopterDroppoint( INT32 sGridNo ); void SetHelicopterDroppoint( INT32 sGridNo );
void SetHelicopterDropDirection( UINT8 usDirection );
void StartHelicopterRun(); void StartHelicopterRun();
+2
View File
@@ -1220,6 +1220,8 @@ void InitHelicopterEntranceByMercs( void )
SetHelicopterDroppoint( gGameExternalOptions.iInitialMercArrivalLocation ); SetHelicopterDroppoint( gGameExternalOptions.iInitialMercArrivalLocation );
#endif #endif
SetHelicopterDropDirection(NORTH);
gTacticalStatus.fDidGameJustStart = FALSE; gTacticalStatus.fDidGameJustStart = FALSE;
} }
} }