mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Helicopter features (by anv):
- Waldo can now repair the helicopter for money - alternative fuel system - damage to helicopter can damage passengers Appropriate Data in GameDir r1897. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6695 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -311,6 +311,12 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
|
||||
case EVENT_HELICOPTER_HOVER_WAY_TOO_LONG:
|
||||
HandleHeliHoverTooLong( );
|
||||
break;
|
||||
case EVENT_HELICOPTER_HOVER_FOR_A_MINUTE:
|
||||
HandleHeliHoverForAMinute( );
|
||||
break;
|
||||
case EVENT_HELICOPTER_REFUEL_FOR_A_MINUTE:
|
||||
ReFuelHelicopterForAMinute( );
|
||||
break;
|
||||
case EVENT_MERC_LEAVE_EQUIP_IN_DRASSEN:
|
||||
HandleEquipmentLeftInDrassen( pEvent->uiParam );
|
||||
break;
|
||||
|
||||
@@ -109,6 +109,9 @@ enum
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
EVENT_HELICOPTER_HOVER_FOR_A_MINUTE,
|
||||
EVENT_HELICOPTER_REFUEL_FOR_A_MINUTE,
|
||||
|
||||
NUMBER_OF_EVENT_TYPES_PLUS_ONE,
|
||||
NUMBER_OF_EVENT_TYPES = NUMBER_OF_EVENT_TYPES_PLUS_ONE - 1
|
||||
};
|
||||
|
||||
@@ -107,6 +107,8 @@ CHAR16 gEventName[NUMBER_OF_EVENT_TYPES_PLUS_ONE][40]={
|
||||
#ifdef CRIPPLED_VERSION
|
||||
L"Crippled version end game check",
|
||||
#endif
|
||||
L"HelicopterHoverForAMinute",
|
||||
L"HelicopterRefuelForAMinute",
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
// HEADROCK HAM 3.5: Add facility code for hourly update of detection levels
|
||||
#include "Facilities.h"
|
||||
#include "Food.h" // added by Flugente
|
||||
// anv: for hourly heli repair
|
||||
#include "Vehicles.h"
|
||||
#include "Map Screen Helicopter.h"
|
||||
|
||||
void HourlyQuestUpdate();
|
||||
void HourlyLarryUpdate();
|
||||
@@ -45,6 +48,12 @@ extern void PayOffSkyriderDebtIfAny( );
|
||||
void HourlyCheckIfSlayAloneSoHeCanLeave();
|
||||
#endif
|
||||
|
||||
#if (defined JA2UB)
|
||||
//no UB
|
||||
#else
|
||||
void HourlyHelicopterRepair();
|
||||
#endif
|
||||
|
||||
void UpdateRegenCounters( void );
|
||||
|
||||
void HandleMinuteUpdate()
|
||||
@@ -114,6 +123,8 @@ CHAR16 zString[128];
|
||||
|
||||
PayOffSkyriderDebtIfAny();
|
||||
|
||||
HourlyHelicopterRepair();
|
||||
|
||||
if ( GetWorldHour() % 6 == 0 ) // 4 times a day
|
||||
{
|
||||
UpdateRegenCounters();
|
||||
@@ -566,3 +577,33 @@ void HourlyCheckIfSlayAloneSoHeCanLeave()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined JA2UB)
|
||||
// no JA25 UB
|
||||
#else
|
||||
void HourlyHelicopterRepair()
|
||||
{
|
||||
if( gubHelicopterHoursToRepair == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
MERCPROFILESTRUCT *pMechanic;
|
||||
pMechanic = &(gMercProfiles[ WALDO ]);
|
||||
if( !pMechanic )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( !pMechanic->bLife )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( pVehicleList[ iHelicopterVehicleId ].sSectorX == gMercProfiles[ WALDO ].sSectorX && pVehicleList[ iHelicopterVehicleId ].sSectorX == gMercProfiles[ WALDO ].sSectorX )
|
||||
{
|
||||
gubHelicopterHoursToRepair--;
|
||||
}
|
||||
if( gubHelicopterHoursToRepair == 0 )
|
||||
{
|
||||
FinishHelicopterRepair();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -45,23 +45,33 @@
|
||||
#endif
|
||||
|
||||
#include "Vehicles.h"
|
||||
#include "NPC.h"
|
||||
#include "history.h"
|
||||
|
||||
// the amounts of time to wait for hover stuff
|
||||
#define TIME_DELAY_FOR_HOVER_WAIT 10 // minutes
|
||||
#define TIME_DELAY_FOR_HOVER_WAIT_TOO_LONG 20 // mintues
|
||||
// externalised, use gHelicopterSettings.ubHelicopterTimeDelayForHoverWait instead
|
||||
//#define TIME_DELAY_FOR_HOVER_WAIT 10 // minutes
|
||||
// externalised, use gHelicopterSettings.ubHelicopterTimeDelayForHoverWaitTooLong instead
|
||||
//#define TIME_DELAY_FOR_HOVER_WAIT_TOO_LONG 20 // mintues
|
||||
|
||||
|
||||
#define MIN_DAYS_BETWEEN_SKYRIDER_MONOLOGUES 1
|
||||
|
||||
// refuel delay
|
||||
#define REFUEL_HELICOPTER_DELAY 30 // minutes
|
||||
// externalised, use gHelicopterSettings.ubHelicopterRefuelTime instead
|
||||
//#define REFUEL_HELICOPTER_DELAY 30 // minutes
|
||||
|
||||
// total number of sectors one can go
|
||||
//#define MAX_HELICOPTER_DISTANCE 25
|
||||
// externalised, use gHelicopterSettings.ubHelicopterDistanceWithoutRefuel instead
|
||||
//#define MAX_HELICOPTER_DISTANCE 25
|
||||
|
||||
// maximum chance out of a hundred per unsafe sector that a SAM site in decent working condition will hit Skyrider
|
||||
#define MAX_SAM_SITE_ACCURACY 33
|
||||
// externalised, use gHelicopterSettings.ubHelicopterSAMSiteAccuracy instead
|
||||
//#define MAX_SAM_SITE_ACCURACY 33
|
||||
|
||||
#define HELICOPTER_RETURN_REASON_NONE 0
|
||||
#define HELICOPTER_RETURN_REASON_LOW_FUEL 1
|
||||
#define HELICOPTER_RETURN_REASON_DAMAGE 2
|
||||
|
||||
extern FACETYPE *gpCurrentTalkingFace;
|
||||
extern UINT8 gubCurrentTalkingID;
|
||||
@@ -97,7 +107,7 @@ INT32 iHelicopterVehicleId = -1;
|
||||
UINT32 guiHelicopterIcon;
|
||||
|
||||
// total distance travelled
|
||||
//INT32 iTotalHeliDistanceSinceRefuel = 0;
|
||||
INT32 iTotalHeliDistanceSinceRefuel = 0;
|
||||
|
||||
// total owed to player
|
||||
INT32 iTotalAccumulatedCostByPlayer = 0;
|
||||
@@ -153,6 +163,13 @@ UINT32 guiTimeOfLastSkyriderMonologue = 0;
|
||||
|
||||
UINT8 gubHelicopterHitsTaken = 0;
|
||||
|
||||
UINT8 gubHelicopterHoursToRepair = 0;
|
||||
UINT8 gubHelicopterBasicRepairsSoFar = 0;
|
||||
UINT8 gubHelicopterSeriousRepairsSoFar = 0;
|
||||
|
||||
UINT8 gubHelicopterHoverTime = 0;
|
||||
UINT8 gubHelicopterTimeToFullRefuel = 0;
|
||||
|
||||
BOOLEAN gfSkyriderSaidCongratsOnTakingSAM = FALSE;
|
||||
UINT8 gubPlayerProgressSkyriderLastCommentedOn = 0;
|
||||
|
||||
@@ -173,14 +190,14 @@ BOOLEAN DoesSkyriderNoticeEnemiesInSector( UINT8 ubNumEnemies );
|
||||
BOOLEAN EndOfHelicoptersPath( void );
|
||||
|
||||
// find the location sector of closest refuel point for heli..and the criteria if the sector must be under the players control
|
||||
INT32 FindLocationOfClosestRefuelSite( BOOLEAN fMustBeAvailable );
|
||||
INT32 FindLocationOfClosestRefuelSite( BOOLEAN fMustBeAvailable, INT16 sX, INT16 sY );
|
||||
|
||||
|
||||
// add the tactical heli graphic
|
||||
void AddHelicopterToMaps( BOOLEAN fAdd, UINT8 ubSite );
|
||||
|
||||
void PaySkyriderBill( void );
|
||||
void MakeHeliReturnToBase( void );
|
||||
void MakeHeliReturnToBase( UINT8 ubReturnReason );
|
||||
|
||||
void HandleSkyRiderMonologueAboutDrassenSAMSite( UINT32 uiSpecialCode );
|
||||
void HandleSkyRiderMonologueAboutCambriaHospital( UINT32 uiSpecialCode );
|
||||
@@ -558,7 +575,7 @@ void InitializeHelicopter( void )
|
||||
fPlotForHelicopter = FALSE;
|
||||
pTempHelicopterPath = NULL;
|
||||
|
||||
// iTotalHeliDistanceSinceRefuel = 0;
|
||||
iTotalHeliDistanceSinceRefuel = 0;
|
||||
iTotalAccumulatedCostByPlayer = 0;
|
||||
|
||||
fHelicopterDestroyed = FALSE;
|
||||
@@ -691,14 +708,14 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
||||
|
||||
|
||||
// player pays for travel if Skyrider is NOT returning to base (even if empty while scouting/going for pickup)
|
||||
if ( fHeliReturnStraightToBase == FALSE )
|
||||
if ( fHeliReturnStraightToBase == FALSE || gGameExternalOptions.fHelicopterReturnToBaseIsNotFree )
|
||||
{
|
||||
// charge cost for flying another sector
|
||||
iTotalAccumulatedCostByPlayer += GetCostOfPassageForHelicopter( sX, sY );
|
||||
}
|
||||
|
||||
// accumulate distance travelled
|
||||
// AddSectorToHelicopterDistanceTravelled( );
|
||||
AddSectorToHelicopterDistanceTravelled( );
|
||||
|
||||
|
||||
// check if heli has any real path left
|
||||
@@ -720,7 +737,8 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
||||
}
|
||||
|
||||
// destination reached, payment due. If player can't pay, mercs get kicked off and heli flies to base!
|
||||
PaySkyriderBill();
|
||||
if( gGameExternalOptions.fPaySkyriderInBase == FALSE || CheckForArrivalAtRefuelPoint( ) )
|
||||
PaySkyriderBill();
|
||||
|
||||
// WANNE: Fix by Headrock: Always stop time!
|
||||
StopTimeCompression();
|
||||
@@ -735,23 +753,55 @@ BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY )
|
||||
else
|
||||
HeliCharacterDialogue( pSkyRider, HELI_HOT_DROP );
|
||||
|
||||
PaySkyriderBill();
|
||||
if( gGameExternalOptions.fPaySkyriderInBase == FALSE || CheckForArrivalAtRefuelPoint( ) )
|
||||
PaySkyriderBill();
|
||||
StopTimeCompression();
|
||||
}
|
||||
|
||||
if( CheckForArrivalAtRefuelPoint( ) )
|
||||
{
|
||||
ReFuelHelicopter( );
|
||||
OfferHelicopterRepair();
|
||||
}
|
||||
}
|
||||
|
||||
CheckIfHelicopterHasEnoughFuelToReturn( sX, sY );
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
BOOLEAN CheckIfHelicopterHasEnoughFuelToReturn( INT16 sX, INT16 sY )
|
||||
{
|
||||
// anv: check if we didn't come too far
|
||||
if( !CheckForArrivalAtRefuelPoint() && fHeliReturnStraightToBase == FALSE && gHelicopterSettings.ubHelicopterDistanceWithoutRefuel - iTotalHeliDistanceSinceRefuel < DistanceToNearestRefuelPoint(sX, sY) )
|
||||
{
|
||||
// hovered too long, inform player heli is returning to base
|
||||
HeliCharacterDialogue( pSkyRider, RETURN_TO_BASE );
|
||||
|
||||
// If the sector is safe
|
||||
if ( NumEnemiesInSector( pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY ) == 0 )
|
||||
{
|
||||
// kick everyone out!
|
||||
// anv: possibly show prompt, if option is on, and heli has any passengers
|
||||
if( gHelicopterSettings.fAskBeforeKickingPassengersOut == FALSE || GetNumberInVehicle( iHelicopterVehicleId ) == 0 )
|
||||
{
|
||||
MoveAllInHelicopterToFootMovementGroup( );
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_LOW_FUEL );
|
||||
}
|
||||
else
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, pHelicopterEtaStrings[ STR_HELI_ETA_KICK_OUT_PASSENGERS_PROMPT ], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, KickOutPassengersBoxCallBack, NULL );
|
||||
}
|
||||
else
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_LOW_FUEL );
|
||||
|
||||
return ( FALSE );
|
||||
}
|
||||
return ( TRUE );
|
||||
}
|
||||
|
||||
INT32 GetTotalDistanceHelicopterCanTravel( void )
|
||||
{
|
||||
return( MAX_HELICOPTER_DISTANCE );
|
||||
return( gHelicopterSettings.ubHelicopterDistanceWithoutRefuel );
|
||||
}
|
||||
|
||||
INT32 HowFarHelicopterhasTravelledSinceRefueling( void )
|
||||
@@ -763,7 +813,7 @@ INT32 HowFarHelicopterhasTravelledSinceRefueling( void )
|
||||
INT32 HowFurtherCanHelicopterTravel( void )
|
||||
{
|
||||
// how many sectors further can we go on remaining fuel?
|
||||
return( MAX_HELICOPTER_DISTANCE - ( HowFarHelicopterhasTravelledSinceRefueling( ) + DistanceOfIntendedHelicopterPath( ) ) );
|
||||
return( gHelicopterSettings.ubHelicopterDistanceWithoutRefuel - ( HowFarHelicopterhasTravelledSinceRefueling( ) + DistanceOfIntendedHelicopterPath( ) ) );
|
||||
}
|
||||
|
||||
void AddSectorToHelicopterDistanceTravelled( void )
|
||||
@@ -776,26 +826,38 @@ void AddSectorToHelicopterDistanceTravelled( void )
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
INT32 LocationOfNearestRefuelPoint( BOOLEAN fNotifyPlayerIfNoSafeLZ )
|
||||
|
||||
INT32 LocationOfNearestRefuelPoint( BOOLEAN fNotifyPlayerIfNoSafeLZ, UINT8 ubReturnReason, INT16 sX, INT16 sY )
|
||||
{
|
||||
INT32 iClosestLocation = -1;
|
||||
|
||||
// anv: update availability before check
|
||||
UpdateRefuelSiteAvailability();
|
||||
// try to find one, any one under the players control
|
||||
iClosestLocation = FindLocationOfClosestRefuelSite( TRUE );
|
||||
iClosestLocation = FindLocationOfClosestRefuelSite( TRUE, sX, sY );
|
||||
|
||||
// no go?...then find
|
||||
if( iClosestLocation == -1 )
|
||||
{
|
||||
if( fNotifyPlayerIfNoSafeLZ )
|
||||
{
|
||||
// no refueling sites available, might wanna warn player about this
|
||||
ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, pHelicopterEtaStrings[ 5 ] );
|
||||
switch( ubReturnReason )
|
||||
{
|
||||
case HELICOPTER_RETURN_REASON_LOW_FUEL:
|
||||
// no refueling sites available, might wanna warn player about this
|
||||
ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, pHelicopterEtaStrings[ STR_HELI_ETA_LOW_ON_FUEL_HOSTILE_TERRITORY ] );
|
||||
break;
|
||||
case HELICOPTER_RETURN_REASON_DAMAGE:
|
||||
// no refueling sites available, might wanna warn player about this
|
||||
ScreenMsg( FONT_MCOLOR_DKRED, MSG_INTERFACE, pHelicopterEtaStrings[ STR_HELI_ETA_HELI_DAMAGED_HOSTILE_TERRITORY ] );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// find the closest location regardless
|
||||
iClosestLocation = FindLocationOfClosestRefuelSite( FALSE );
|
||||
iClosestLocation = FindLocationOfClosestRefuelSite( FALSE, sX, sY );
|
||||
}
|
||||
|
||||
// always returns a valid refuel point, picking a hostile one if unavoidable
|
||||
@@ -804,7 +866,7 @@ INT32 LocationOfNearestRefuelPoint( BOOLEAN fNotifyPlayerIfNoSafeLZ )
|
||||
return( iClosestLocation );
|
||||
}
|
||||
|
||||
INT32 FindLocationOfClosestRefuelSite( BOOLEAN fMustBeAvailable )
|
||||
INT32 FindLocationOfClosestRefuelSite( BOOLEAN fMustBeAvailable, INT16 sX, INT16 sY )
|
||||
{
|
||||
INT32 iShortestDistance = 9999;
|
||||
INT32 iCounter = 0;
|
||||
@@ -815,10 +877,10 @@ INT32 FindLocationOfClosestRefuelSite( BOOLEAN fMustBeAvailable )
|
||||
for( iCounter = 0; iCounter < NUMBER_OF_REFUEL_SITES; iCounter++ )
|
||||
{
|
||||
// if this refuelling site is available
|
||||
if( ( fRefuelingSiteAvailable[ iCounter ] ) || ( fMustBeAvailable == FALSE ) )
|
||||
if( ( fRefuelingSiteAvailable[ iCounter ] ) || ( fMustBeAvailable == FALSE && !( ( iCounter == ESTONI_REFUELING_SITE ) && ( CheckFact( FACT_ESTONI_REFUELLING_POSSIBLE, 0 ) == FALSE ) ) ) )
|
||||
{
|
||||
// find if sector is under control, find distance from heli to it
|
||||
iDistance = ( INT32 )FindStratPath( ( INT16 )( CALCULATE_STRATEGIC_INDEX( pVehicleList[ iHelicopterVehicleId ].sSectorX , pVehicleList[ iHelicopterVehicleId ].sSectorY ) ), ( INT16 )( CALCULATE_STRATEGIC_INDEX( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ] ) ) , pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE );
|
||||
iDistance = ( INT32 )FindStratPath( ( INT16 )( CALCULATE_STRATEGIC_INDEX( sX , sY ) ), ( INT16 )( CALCULATE_STRATEGIC_INDEX( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ] ) ) , pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE );
|
||||
|
||||
if( iDistance < iShortestDistance )
|
||||
{
|
||||
@@ -840,14 +902,14 @@ INT32 DistanceToNearestRefuelPoint( INT16 sX, INT16 sY )
|
||||
INT32 iDistance;
|
||||
|
||||
// don't notify player during these checks!
|
||||
iClosestLocation = LocationOfNearestRefuelPoint( FALSE );
|
||||
iClosestLocation = LocationOfNearestRefuelPoint( FALSE, HELICOPTER_RETURN_REASON_NONE, sX, sY );
|
||||
|
||||
iDistance = ( INT32 )FindStratPath( ( INT16 )( CALCULATE_STRATEGIC_INDEX( sX, sY ) ), ( INT16 )( CALCULATE_STRATEGIC_INDEX( sRefuelSectorX[ iClosestLocation ], sRefuelSectorY[ iClosestLocation ] ) ) , pVehicleList[ iHelicopterVehicleId ].ubMovementGroup, FALSE );
|
||||
return( iDistance );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
BOOLEAN IsSectorOutOfTheWay( INT16 sX, INT16 sY )
|
||||
{
|
||||
// check distance to nearest refuel point
|
||||
@@ -859,7 +921,6 @@ BOOLEAN IsSectorOutOfTheWay( INT16 sX, INT16 sY )
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -869,17 +930,194 @@ void ReFuelHelicopter( void )
|
||||
|
||||
LandHelicopter( );
|
||||
|
||||
/*
|
||||
AddStrategicEvent( EVENT_HELICOPTER_DONE_REFUELING, GetWorldTotalMin() + REFUEL_HELICOPTER_DELAY, 0 );
|
||||
|
||||
// reset distance traveled
|
||||
iTotalHeliDistanceSinceRefuel = 0;
|
||||
*/
|
||||
if(gGameExternalOptions.fAlternativeHelicopterFuelSystem)
|
||||
{
|
||||
gubHelicopterTimeToFullRefuel = ( gHelicopterSettings.ubHelicopterRefuelTime * ( iTotalHeliDistanceSinceRefuel ) ) / gHelicopterSettings.ubHelicopterDistanceWithoutRefuel;
|
||||
//AddStrategicEvent( EVENT_HELICOPTER_DONE_REFUELING, GetWorldTotalMin() + gHelicopterSettings.ubHelicopterRefuelTime, 0 );
|
||||
AddStrategicEvent( EVENT_HELICOPTER_REFUEL_FOR_A_MINUTE, GetWorldTotalMin() + 1, 0 );
|
||||
// reset distance traveled
|
||||
//iTotalHeliDistanceSinceRefuel = 0;
|
||||
// reset hover time
|
||||
gubHelicopterHoverTime = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void ReFuelHelicopterForAMinute( void )
|
||||
{
|
||||
if( CheckForArrivalAtRefuelPoint() == FALSE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( iTotalHeliDistanceSinceRefuel <= 0 )
|
||||
{
|
||||
gubHelicopterTimeToFullRefuel = 0;
|
||||
iTotalHeliDistanceSinceRefuel = 0;
|
||||
ScreenMsg( FONT_GRAY2, MSG_INTERFACE, L"%s", pHelicopterRepairRefuelStrings[ STR_HELI_RR_REFUEL_FINISHED ]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gubHelicopterTimeToFullRefuel--;
|
||||
iTotalHeliDistanceSinceRefuel = ( gubHelicopterTimeToFullRefuel * gHelicopterSettings.ubHelicopterDistanceWithoutRefuel ) / gHelicopterSettings.ubHelicopterRefuelTime ;
|
||||
|
||||
AddStrategicEvent( EVENT_HELICOPTER_REFUEL_FOR_A_MINUTE, GetWorldTotalMin() + 1, 0 );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void OfferHelicopterRepair( void )
|
||||
{
|
||||
CHAR16 sHelicopterRepairPromptText[ 320 ];
|
||||
if( !gGameExternalOptions.fAllowWaldoToOfferRepairInStrategic )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( CheckFact(FACT_HELI_DAMAGED_CAN_START_REPAIR, 0 ) == TRUE )
|
||||
{
|
||||
if( gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
{
|
||||
CharacterDialogue( WALDO, WALDO_REPAIR_PROPOSITION, uiExternalStaticNPCFaces[ WALDO_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE );
|
||||
// popup will be called from HandleDialogueEnd()
|
||||
}
|
||||
else
|
||||
{
|
||||
// no dialogue, show popup right away
|
||||
swprintf( sHelicopterRepairPromptText, pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_PROMPT ], gMercProfiles[ WALDO ].zNickname, CalculateHelicopterRepairCost( FALSE ), gHelicopterSettings.ubHelicopterBasicRepairTime );
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, sHelicopterRepairPromptText, guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, OfferHelicopterRepairBoxCallBack, NULL );
|
||||
}
|
||||
}
|
||||
else if( CheckFact(FACT_HELI_SERIOUSLY_DAMAGED_CAN_START_REPAIR, 0 ) == TRUE )
|
||||
{
|
||||
if( gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
{
|
||||
CharacterDialogue( WALDO, WALDO_SERIOUS_REPAIR_PROPOSITION, uiExternalStaticNPCFaces[ WALDO_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( sHelicopterRepairPromptText, pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_PROMPT ], gMercProfiles[ WALDO ].zNickname, CalculateHelicopterRepairCost( TRUE ), gHelicopterSettings.ubHelicopterSeriousRepairTime );
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, sHelicopterRepairPromptText, guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, OfferHelicopterRepairBoxCallBack, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void OfferHelicopterRepairBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
if ( ubExitValue == MSG_BOX_RETURN_YES )
|
||||
{
|
||||
StartHelicopterRepair( TRUE, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
CharacterDialogue( WALDO, WALDO_REPAIR_REFUSED, uiExternalStaticNPCFaces[ WALDO_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void KickOutPassengersBoxCallBack( UINT8 ubExitValue )
|
||||
{
|
||||
if ( ubExitValue == MSG_BOX_RETURN_YES )
|
||||
{
|
||||
MoveAllInHelicopterToFootMovementGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_LOW_FUEL );
|
||||
return;
|
||||
}
|
||||
|
||||
UINT16 CalculateHelicopterRepairCost( BOOLEAN fSeriousRepair )
|
||||
{
|
||||
if( gGameExternalOptions.fWaldoSubsequentRepairsIncreaseCosts )
|
||||
{
|
||||
if( fSeriousRepair )
|
||||
{
|
||||
return min( gHelicopterSettings.usHelicopterSeriousRepairCost + gHelicopterSettings.usHelicopterSeriousCostIncreaseAfterBasicRepair * gubHelicopterBasicRepairsSoFar +
|
||||
+ gHelicopterSettings.usHelicopterSeriousCostIncreaseAfterSeriousRepair * gubHelicopterSeriousRepairsSoFar, gHelicopterSettings.usHelicopterSeriousRepairCostMax );
|
||||
}
|
||||
else
|
||||
{
|
||||
return min( gHelicopterSettings.usHelicopterBasicRepairCost + gHelicopterSettings.usHelicopterBasicCostIncreaseAfterBasicRepair * gubHelicopterBasicRepairsSoFar +
|
||||
+ gHelicopterSettings.usHelicopterBasicCostIncreaseAfterSeriousRepair * gubHelicopterSeriousRepairsSoFar, gHelicopterSettings.usHelicopterBasicRepairCostMax );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fSeriousRepair )
|
||||
{
|
||||
return min( gHelicopterSettings.usHelicopterSeriousRepairCost, gHelicopterSettings.usHelicopterSeriousRepairCostMax );
|
||||
}
|
||||
else
|
||||
{
|
||||
return min( gHelicopterSettings.usHelicopterBasicRepairCost, gHelicopterSettings.usHelicopterBasicRepairCostMax );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void StartHelicopterRepair( BOOLEAN fInStrategic, BOOLEAN fCalledByGivingMoney )
|
||||
{
|
||||
MoveAllInHelicopterToFootMovementGroup( );
|
||||
if( CheckFact( FACT_HELI_DAMAGED_CAN_START_REPAIR, 0 ) == TRUE )
|
||||
{
|
||||
gubHelicopterHoursToRepair = min( max( 1, ( gHelicopterSettings.ubHelicopterBasicRepairTime - gHelicopterSettings.ubHelicopterBasicRepairTimeVariation + 2*Random(gHelicopterSettings.ubHelicopterBasicRepairTimeVariation) ) ), 255 );
|
||||
AddTransactionToPlayersBook( PAYMENT_TO_NPC, WALDO, GetWorldTotalMin(), -CalculateHelicopterRepairCost(FALSE) );
|
||||
AddHistoryToPlayersLog( HISTORY_HELICOPTER_REPAIR_STARTED, gHelicopterSettings.ubHelicopterBasicRepairTime, GetWorldTotalMin(), pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY );
|
||||
gubHelicopterBasicRepairsSoFar++;
|
||||
}
|
||||
else if( CheckFact( FACT_HELI_SERIOUSLY_DAMAGED_CAN_START_REPAIR, 0 ) == TRUE )
|
||||
{
|
||||
gubHelicopterHoursToRepair = min( max( 1, ( gHelicopterSettings.ubHelicopterSeriousRepairTime - gHelicopterSettings.ubHelicopterSeriousRepairTimeVariation + 2*Random(gHelicopterSettings.ubHelicopterSeriousRepairTimeVariation) ) ), 255 );
|
||||
AddTransactionToPlayersBook( PAYMENT_TO_NPC, WALDO, GetWorldTotalMin(), -CalculateHelicopterRepairCost(TRUE) );
|
||||
AddHistoryToPlayersLog( HISTORY_HELICOPTER_REPAIR_STARTED, gHelicopterSettings.ubHelicopterSeriousRepairTime, GetWorldTotalMin(), pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY );
|
||||
gubHelicopterSeriousRepairsSoFar++;
|
||||
}
|
||||
|
||||
if( gubHelicopterHoursToRepair > 18 && gubHelicopterHoursToRepair < 30 )
|
||||
{
|
||||
if( fInStrategic == TRUE )
|
||||
{
|
||||
if( gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
CharacterDialogue( WALDO, WALDO_COME_BACK_TOMORROW, uiExternalStaticNPCFaces[ WALDO_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !fCalledByGivingMoney )
|
||||
TriggerNPCRecord( WALDO, 15 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( fInStrategic == TRUE )
|
||||
{
|
||||
if( gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
CharacterDialogue( WALDO, WALDO_COME_BACK_IN_SOME_TIME, uiExternalStaticNPCFaces[ WALDO_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !fCalledByGivingMoney )
|
||||
TriggerNPCRecord( WALDO, 16 );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void FinishHelicopterRepair()
|
||||
{
|
||||
gubHelicopterHoursToRepair = 0;
|
||||
gubHelicopterHitsTaken = 0;
|
||||
if( gGameSettings.fOptions[ TOPTION_SILENT_SKYRIDER ] == FALSE )
|
||||
CharacterDialogue( WALDO, WALDO_REPAIR_COMPLETED, uiExternalStaticNPCFaces[ WALDO_EXTERNAL_FACE ], DIALOGUE_EXTERNAL_NPC_UI, FALSE, FALSE );
|
||||
ScreenMsg( FONT_GRAY2, MSG_INTERFACE, L"%s", pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_FINISHED ]);
|
||||
return;
|
||||
}
|
||||
|
||||
INT32 GetCostOfPassageForHelicopter( INT16 sX, INT16 sY )
|
||||
{
|
||||
@@ -928,7 +1166,7 @@ void SkyriderDestroyed( void )
|
||||
|
||||
// zero out balance due
|
||||
gMercProfiles[ SKYRIDER ].iBalance = 0;
|
||||
// iTotalHeliDistanceSinceRefuel = 0;
|
||||
iTotalHeliDistanceSinceRefuel = 0;
|
||||
iTotalAccumulatedCostByPlayer = 0;
|
||||
|
||||
// remove vehicle and reset
|
||||
@@ -954,13 +1192,14 @@ BOOLEAN CanHelicopterFly( void )
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
// travelled too far?
|
||||
if( iTotalHeliDistanceSinceRefuel > MAX_HELICOPTER_DISTANCE )
|
||||
if( gGameExternalOptions.fAlternativeHelicopterFuelSystem )
|
||||
{
|
||||
return( FALSE );
|
||||
if( iTotalHeliDistanceSinceRefuel > gHelicopterSettings.ubHelicopterDistanceWithoutRefuel )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// is the pilot alive, well, and willing to help us?
|
||||
if( IsHelicopterPilotAvailable( ) == FALSE )
|
||||
@@ -979,6 +1218,12 @@ BOOLEAN CanHelicopterFly( void )
|
||||
return ( FALSE );
|
||||
}
|
||||
|
||||
// repair in progress?
|
||||
if( gubHelicopterHoursToRepair > 0 )
|
||||
{
|
||||
return ( FALSE );
|
||||
}
|
||||
|
||||
// everything A-OK!
|
||||
return( TRUE );
|
||||
}
|
||||
@@ -1003,6 +1248,12 @@ BOOLEAN IsHelicopterPilotAvailable( void )
|
||||
return ( FALSE );
|
||||
}
|
||||
|
||||
// anv - helicopter too damaged?
|
||||
if ( gGameExternalOptions.fSeriouslyDamagedSkyriderWontFly == TRUE && gubHelicopterHitsTaken > 1 )
|
||||
{
|
||||
return ( FALSE );
|
||||
}
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
@@ -1062,19 +1313,61 @@ void StartHoverTime( void )
|
||||
// post event for x mins in future, save start time, if event time - delay = start time, then hover has gone on too long
|
||||
uiStartHoverTime = GetWorldTotalMin( );
|
||||
|
||||
// post event..to call handle hover
|
||||
AddStrategicEvent( EVENT_HELICOPTER_HOVER_TOO_LONG, GetWorldTotalMin() + TIME_DELAY_FOR_HOVER_WAIT, 0 );
|
||||
if( gGameExternalOptions.fAlternativeHelicopterFuelSystem )
|
||||
{
|
||||
AddStrategicEvent( EVENT_HELICOPTER_HOVER_FOR_A_MINUTE, GetWorldTotalMin() + 1, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// post event..to call handle hover
|
||||
AddStrategicEvent( EVENT_HELICOPTER_HOVER_TOO_LONG, GetWorldTotalMin() + gHelicopterSettings.ubHelicopterTimeDelayForHoverWait, 0 );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void HandleHeliHoverForAMinute( void )
|
||||
{
|
||||
INT16 sX = pVehicleList[ iHelicopterVehicleId ].sSectorX;
|
||||
INT16 sY = pVehicleList[ iHelicopterVehicleId ].sSectorY;
|
||||
if( fHoveringHelicopter == FALSE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
gubHelicopterHoverTime++;
|
||||
if( gubHelicopterHoverTime == 10 )
|
||||
{
|
||||
gubHelicopterHoverTime = 0;
|
||||
|
||||
iTotalHeliDistanceSinceRefuel++;
|
||||
if( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sX, sY ) ].fEnemyAirControlled == FALSE )
|
||||
{
|
||||
iTotalAccumulatedCostByPlayer += gGameExternalOptions.usHelicopterHoverCostOnGreenTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
iTotalAccumulatedCostByPlayer += gGameExternalOptions.usHelicopterHoverCostOnRedTile;
|
||||
}
|
||||
|
||||
if( CheckIfHelicopterHasEnoughFuelToReturn( sX, sY ) == TRUE )
|
||||
{
|
||||
// since now heli can stay hovering longer, reminder every 10 minutes would get irritating
|
||||
if( iTotalHeliDistanceSinceRefuel % 3 == 0 && iTotalHeliDistanceSinceRefuel < gHelicopterSettings.ubHelicopterDistanceWithoutRefuel )
|
||||
// inform player
|
||||
HeliCharacterDialogue( pSkyRider, HOVERING_A_WHILE );
|
||||
}
|
||||
|
||||
}
|
||||
AddStrategicEvent( EVENT_HELICOPTER_HOVER_FOR_A_MINUTE, GetWorldTotalMin() + 1, 0 );
|
||||
}
|
||||
|
||||
void HandleHeliHoverLong( void )
|
||||
{
|
||||
// post message about hovering too long
|
||||
if( fHoveringHelicopter )
|
||||
{
|
||||
// proper event, post next one
|
||||
AddStrategicEvent( EVENT_HELICOPTER_HOVER_WAY_TOO_LONG, uiStartHoverTime + TIME_DELAY_FOR_HOVER_WAIT_TOO_LONG, 0 );
|
||||
AddStrategicEvent( EVENT_HELICOPTER_HOVER_WAY_TOO_LONG, uiStartHoverTime + gHelicopterSettings.ubHelicopterTimeDelayForHoverWaitTooLong, 0 );
|
||||
|
||||
// inform player
|
||||
HeliCharacterDialogue( pSkyRider, HOVERING_A_WHILE );
|
||||
@@ -1107,11 +1400,17 @@ void HandleHeliHoverTooLong( void )
|
||||
// If the sector is safe
|
||||
if ( NumEnemiesInSector( pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY ) == 0 )
|
||||
{
|
||||
// kick everyone out!
|
||||
MoveAllInHelicopterToFootMovementGroup( );
|
||||
// anv: possibly show prompt, if option is on, and heli has any passengers
|
||||
if( gHelicopterSettings.fAskBeforeKickingPassengersOut == FALSE || GetNumberInVehicle( iHelicopterVehicleId ) == 0 )
|
||||
{
|
||||
MoveAllInHelicopterToFootMovementGroup( );
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_LOW_FUEL );
|
||||
}
|
||||
else
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, pHelicopterEtaStrings[ STR_HELI_ETA_KICK_OUT_PASSENGERS_PROMPT ], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, KickOutPassengersBoxCallBack, NULL );
|
||||
}
|
||||
|
||||
MakeHeliReturnToBase();
|
||||
else
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_LOW_FUEL );
|
||||
}
|
||||
|
||||
|
||||
@@ -1275,12 +1574,14 @@ void UpdateRefuelSiteAvailability( void )
|
||||
|
||||
// Generally, only Drassen is initially available for refuelling
|
||||
// Estoni must first be captured (although player may already have it when he gets Skyrider!)
|
||||
// anv: Estoni should only available after Jake-Shank quest
|
||||
// site availability should not be dependent on SAM zones, or weird things will happen after controlling Estoni (like inability to land in base if it's in SAM zone)
|
||||
|
||||
for( iCounter = 0; iCounter < NUMBER_OF_REFUEL_SITES; iCounter++ )
|
||||
{
|
||||
// if enemy controlled sector (ground OR air, don't want to fly into enemy air territory)
|
||||
if( ( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ] ) ].fEnemyControlled == TRUE ) ||
|
||||
( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ] ) ].fEnemyAirControlled == TRUE ) ||
|
||||
//( StrategicMap[ CALCULATE_STRATEGIC_INDEX( sRefuelSectorX[ iCounter ], sRefuelSectorY[ iCounter ] ) ].fEnemyAirControlled == TRUE ) ||
|
||||
( ( iCounter == ESTONI_REFUELING_SITE ) && ( CheckFact( FACT_ESTONI_REFUELLING_POSSIBLE, 0 ) == FALSE ) ) )
|
||||
{
|
||||
// mark refueling site as unavailable
|
||||
@@ -2123,9 +2424,9 @@ BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY )
|
||||
ubChance = bSAMCondition;
|
||||
|
||||
// there's a fair chance of a miss even if the SAM site is in perfect working order
|
||||
if (ubChance > MAX_SAM_SITE_ACCURACY * 3) // Madd - since this is only used for enemy air raids, we'll say that good guy SAMs can have a max of 99% to hit instead of 33%
|
||||
if (ubChance > gHelicopterSettings.ubHelicopterSAMSiteAccuracy * 3) // Madd - since this is only used for enemy air raids, we'll say that good guy SAMs can have a max of 99% to hit instead of 33%
|
||||
{
|
||||
ubChance = MAX_SAM_SITE_ACCURACY * 3;
|
||||
ubChance = gHelicopterSettings.ubHelicopterSAMSiteAccuracy * 3;
|
||||
}
|
||||
|
||||
if( PreRandom( 100 ) < ubChance)
|
||||
@@ -2189,9 +2490,9 @@ BOOLEAN HandleSAMSiteAttackOfHelicopterInSector( INT16 sSectorX, INT16 sSectorY
|
||||
ubChance = bSAMCondition;
|
||||
|
||||
// there's a fair chance of a miss even if the SAM site is in perfect working order
|
||||
if (ubChance > MAX_SAM_SITE_ACCURACY)
|
||||
if (ubChance > gHelicopterSettings.ubHelicopterSAMSiteAccuracy)
|
||||
{
|
||||
ubChance = MAX_SAM_SITE_ACCURACY;
|
||||
ubChance = gHelicopterSettings.ubHelicopterSAMSiteAccuracy;
|
||||
}
|
||||
|
||||
if( PreRandom( 100 ) < ubChance)
|
||||
@@ -2206,13 +2507,17 @@ BOOLEAN HandleSAMSiteAttackOfHelicopterInSector( INT16 sSectorX, INT16 sSectorY
|
||||
if ( gubHelicopterHitsTaken == 1 )
|
||||
{
|
||||
HeliCharacterDialogue( pSkyRider, HELI_TOOK_MINOR_DAMAGE );
|
||||
if( gGameExternalOptions.fHelicopterPassengersCanGetHit == TRUE )
|
||||
HurtPassengersInHelicopter( iHelicopterVehicleId );
|
||||
}
|
||||
// second hit?
|
||||
else if ( gubHelicopterHitsTaken == 2 )
|
||||
{
|
||||
// going back to base (no choice, dialogue says so)
|
||||
HeliCharacterDialogue( pSkyRider, HELI_TOOK_MAJOR_DAMAGE );
|
||||
MakeHeliReturnToBase();
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_DAMAGE );
|
||||
if( gGameExternalOptions.fHelicopterPassengersCanGetHit == TRUE )
|
||||
HurtPassengersInHelicopter( iHelicopterVehicleId );
|
||||
}
|
||||
// third hit!
|
||||
else
|
||||
@@ -2222,17 +2527,21 @@ BOOLEAN HandleSAMSiteAttackOfHelicopterInSector( INT16 sSectorX, INT16 sSectorY
|
||||
|
||||
// everyone die die die
|
||||
// play sound
|
||||
if ( PlayJA2StreamingSampleFromFile( "stsounds\\blah2.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN, HeliCrashSoundStopCallback ) == SOUND_ERROR )
|
||||
{
|
||||
// Destroy here if we cannot play streamed sound sample....
|
||||
SkyriderDestroyed( );
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise it's handled in the callback
|
||||
// remove any arrival events for the helicopter's group
|
||||
DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup );
|
||||
}
|
||||
// if ( PlayJA2StreamingSampleFromFile( "stsounds\\blah2.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN, HeliCrashSoundStopCallback ) == SOUND_ERROR )
|
||||
//{
|
||||
//// Destroy here if we cannot play streamed sound sample....
|
||||
// SkyriderDestroyed( );
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//// otherwise it's handled in the callback
|
||||
//// remove any arrival events for the helicopter's group
|
||||
//DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup );
|
||||
//}
|
||||
// anv - calling SkyriderDestroyed() in callback from playing sound causes sound system to crash, as SkyriderDestroyed causes new sounds (hit battlesnds) to play while blah2 is not removed yet
|
||||
// + if there's a pause while falling heli sound is played, it's possible to cheat by changing passengers assignments
|
||||
PlayJA2StreamingSampleFromFile( "stsounds\\blah2.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN, HeliCrashSoundStopCallback );
|
||||
SkyriderDestroyed( );
|
||||
|
||||
// special return code indicating heli was destroyed
|
||||
return( TRUE );
|
||||
@@ -2593,7 +2902,7 @@ void PaySkyriderBill( void)
|
||||
//CHRISL: This may no longer be the case but I'm not sure of a better way to handle things.
|
||||
MoveAllInHelicopterToFootMovementGroup( );
|
||||
|
||||
MakeHeliReturnToBase();
|
||||
MakeHeliReturnToBase( HELICOPTER_RETURN_REASON_NONE );
|
||||
}
|
||||
|
||||
iTotalAccumulatedCostByPlayer = 0;
|
||||
@@ -2635,7 +2944,7 @@ void PayOffSkyriderDebtIfAny( )
|
||||
|
||||
|
||||
|
||||
void MakeHeliReturnToBase( void )
|
||||
void MakeHeliReturnToBase( UINT8 ubReturnReason )
|
||||
{
|
||||
INT32 iLocation = 0;
|
||||
|
||||
@@ -2648,7 +2957,7 @@ void MakeHeliReturnToBase( void )
|
||||
else
|
||||
{
|
||||
// choose destination (closest refueling sector)
|
||||
iLocation = LocationOfNearestRefuelPoint( TRUE );
|
||||
iLocation = LocationOfNearestRefuelPoint( TRUE, ubReturnReason, pVehicleList[ iHelicopterVehicleId ].sSectorX, pVehicleList[ iHelicopterVehicleId ].sSectorY );
|
||||
|
||||
// null out path
|
||||
pVehicleList[ iHelicopterVehicleId ].pMercPath = ClearStrategicPathList( pVehicleList[ iHelicopterVehicleId ].pMercPath, pVehicleList[ iHelicopterVehicleId ].ubMovementGroup );
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#define SPIEL_ABOUT_ESTONI_AIRSPACE 26
|
||||
#define CONFIRM_DESTINATION 27
|
||||
//#define DESTINATION_TOO_FAR 28 // unused
|
||||
#define DESTINATION_TOO_FAR 28 // unused // anv: used now
|
||||
#define ALTERNATE_FUEL_SITE 26
|
||||
#define ARRIVED_IN_HOSTILE_SECTOR 29
|
||||
#define BELIEVED_ENEMY_SECTOR 30 // may become unused
|
||||
@@ -42,6 +42,15 @@
|
||||
#define HELI_GOING_DOWN 54
|
||||
#define HELI_PATH_THROUGH_ENEMEY_AIRSPACE 55
|
||||
#define HELI_HOT_DROP 56
|
||||
#define HELI_TOO_DAMAGED_TO_FLY 57
|
||||
|
||||
// anv: Waldo quotes
|
||||
#define WALDO_REPAIR_PROPOSITION 22
|
||||
#define WALDO_SERIOUS_REPAIR_PROPOSITION 23
|
||||
#define WALDO_COME_BACK_TOMORROW 24
|
||||
#define WALDO_COME_BACK_IN_SOME_TIME 25
|
||||
#define WALDO_REPAIR_REFUSED 26
|
||||
#define WALDO_REPAIR_COMPLETED 27
|
||||
|
||||
// drassen airport sector
|
||||
#define AIRPORT_X gModSettings.ubAirportX //13
|
||||
@@ -102,10 +111,10 @@ extern BOOLEAN fHelicopterIsAirBorne;
|
||||
|
||||
|
||||
// total distance travelled
|
||||
//extern INT32 iTotalHeliDistanceSinceRefuel;
|
||||
extern INT32 iTotalHeliDistanceSinceRefuel;
|
||||
|
||||
// total owed to player
|
||||
//extern INT32 iTotalAccumlatedCostByPlayer;
|
||||
extern INT32 iTotalAccumlatedCostByPlayer;
|
||||
|
||||
// whether or not skyrider is alive and well? and on our side yet?
|
||||
extern BOOLEAN fSkyRiderAvailable;
|
||||
@@ -133,6 +142,13 @@ extern BOOLEAN fRefuelingSiteAvailable[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
extern BOOLEAN fRefuelingSiteHidden[ MAX_NUMBER_OF_REFUEL_SITES ];
|
||||
|
||||
extern UINT8 gubHelicopterHitsTaken;
|
||||
extern UINT8 gubHelicopterHoursToRepair;
|
||||
extern UINT8 gubHelicopterBasicRepairsSoFar;
|
||||
extern UINT8 gubHelicopterSeriousRepairsSoFar;
|
||||
|
||||
extern UINT8 gubHelicopterHoverTime;
|
||||
extern UINT8 gubHelicopterTimeToFullRefuel;
|
||||
|
||||
extern BOOLEAN gfSkyriderSaidCongratsOnTakingSAM;
|
||||
extern UINT8 gubPlayerProgressSkyriderLastCommentedOn;
|
||||
|
||||
@@ -145,7 +161,7 @@ extern BOOLEAN fSAMSitesDisabledFromAttackingPlayer;
|
||||
#endif
|
||||
|
||||
|
||||
/* ARM: Max. fuel range system removed
|
||||
// ARM: Max. fuel range system removed
|
||||
// add another sector to how far helictoper has travelled
|
||||
void AddSectorToHelicopterDistanceTravelled( void );
|
||||
|
||||
@@ -161,16 +177,25 @@ INT32 HowFurtherCanHelicopterTravel( void );
|
||||
// check if this sector is out of the way
|
||||
BOOLEAN IsSectorOutOfTheWay( INT16 sX, INT16 sY );
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// how far to nearest refuel point from this sector?
|
||||
INT32 DistanceToNearestRefuelPoint( INT16 sX, INT16 sY );
|
||||
|
||||
// location of closest
|
||||
INT32 LocationOfNearestRefuelPoint( BOOLEAN fNotifyPlayerIfNoSafeLZ );
|
||||
INT32 LocationOfNearestRefuelPoint( BOOLEAN fNotifyPlayerIfNoSafeLZ, UINT8 ubReturnReason, INT16 sX, INT16 sY );
|
||||
|
||||
// refuel helicopter
|
||||
void ReFuelHelicopter( void );
|
||||
void ReFuelHelicopterForAMinute( void );
|
||||
|
||||
void OfferHelicopterRepair( void );
|
||||
void OfferHelicopterRepairBoxCallBack( UINT8 ubExitValue );
|
||||
void KickOutPassengersBoxCallBack( UINT8 ubExitValue );
|
||||
|
||||
UINT16 CalculateHelicopterRepairCost( BOOLEAN fSeriousRepair );
|
||||
void StartHelicopterRepair( BOOLEAN fInStrategic, BOOLEAN fCalledByGivingMoney );
|
||||
void FinishHelicopterRepair();
|
||||
|
||||
// how much will it cost for helicopter to travel through this sector?
|
||||
INT32 GetCostOfPassageForHelicopter( INT16 sX, INT16 sY );
|
||||
@@ -211,6 +236,9 @@ void HandleHeliHoverLong( void );
|
||||
// handle a LONG wait in hover mode
|
||||
void HandleHeliHoverTooLong( void );
|
||||
|
||||
// anv: for alternative fuel system
|
||||
void HandleHeliHoverForAMinute( void );
|
||||
|
||||
// start the heli hover time
|
||||
void StartHoverTime( void );
|
||||
|
||||
@@ -220,6 +248,8 @@ void DropOffEveryOneInHelicopter( void );
|
||||
// handle heli entering this sector
|
||||
BOOLEAN HandleHeliEnteringSector( INT16 sX, INT16 sY );
|
||||
|
||||
BOOLEAN CheckIfHelicopterHasEnoughFuelToReturn( INT16 sX, INT16 sY );
|
||||
|
||||
// check for arrival at refuel
|
||||
BOOLEAN CheckForArrivalAtRefuelPoint( void );
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
#include "Facilities.h"
|
||||
#include "MilitiaSquads.h"
|
||||
|
||||
#include "LaptopSave.h"
|
||||
|
||||
UINT16 MAP_GRID_X;
|
||||
UINT16 MAP_GRID_Y;
|
||||
|
||||
@@ -88,6 +90,7 @@ UINT16 MAP_HELICOPTER_ETA_POPUP_Y;
|
||||
UINT16 MAP_HELICOPTER_UPPER_ETA_POPUP_Y;
|
||||
UINT16 MAP_HELICOPTER_ETA_POPUP_WIDTH;
|
||||
UINT16 MAP_HELICOPTER_ETA_POPUP_HEIGHT;
|
||||
UINT16 MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT;
|
||||
|
||||
// sublevel text string position
|
||||
UINT16 MAP_LEVEL_STRING_X;
|
||||
@@ -413,6 +416,9 @@ UINT32 guiMapBorderEtaPopUp;
|
||||
// heli pop up
|
||||
UINT32 guiMapBorderHeliSectors;
|
||||
|
||||
// anv: alternate heli pop up for alternative fuel system
|
||||
UINT32 guiMapBorderHeliSectorsAlternate;
|
||||
|
||||
// list of map sectors that player isn't allowed to even highlight
|
||||
BOOLEAN sBadSectorsList[ WORLD_MAP_X ][ WORLD_MAP_X ];
|
||||
|
||||
@@ -4577,7 +4583,8 @@ void DisplayDistancesForHelicopter( void )
|
||||
{
|
||||
// calculate the distance travelled, the proposed distance, and total distance one can go
|
||||
// display these on screen
|
||||
INT16 sDistanceToGo = 0;//, sDistanceSoFar = 0, sTotalCanTravel = 0;
|
||||
INT16 sDistanceToGo = 0, sDistanceSoFar = 0, sTotalCanTravel = 0;
|
||||
INT16 sRemainingFuel = 0, sDistToRefuelSite = 0;
|
||||
INT16 sX = 0, sY = 0;
|
||||
CHAR16 sString[ 32 ];
|
||||
HVOBJECT hHandle;
|
||||
@@ -4591,6 +4598,7 @@ void DisplayDistancesForHelicopter( void )
|
||||
UINT32 uiTripCost;
|
||||
|
||||
|
||||
|
||||
if ( GetMouseMapXY( &sMapX, &sMapY ) && !fZoomFlag && ( sMapY >= 13 ) )
|
||||
{
|
||||
sYPosition = MAP_HELICOPTER_UPPER_ETA_POPUP_Y;
|
||||
@@ -4602,14 +4610,20 @@ void DisplayDistancesForHelicopter( void )
|
||||
|
||||
if( ( sOldYPosition != 0 ) && ( sOldYPosition != sYPosition ) )
|
||||
{
|
||||
RestoreExternBackgroundRect( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, MAP_HELICOPTER_ETA_POPUP_HEIGHT );
|
||||
if( !gGameExternalOptions.fAlternativeHelicopterFuelSystem )
|
||||
RestoreExternBackgroundRect( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, MAP_HELICOPTER_ETA_POPUP_HEIGHT );
|
||||
else
|
||||
RestoreExternBackgroundRect( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT );
|
||||
}
|
||||
|
||||
sOldYPosition = sYPosition;
|
||||
|
||||
// blit in background
|
||||
UINT8 imageIndex = 0;
|
||||
GetVideoObject( &hHandle, guiMapBorderHeliSectors );
|
||||
if( gGameExternalOptions.fAlternativeHelicopterFuelSystem )
|
||||
GetVideoObject( &hHandle, guiMapBorderHeliSectorsAlternate );
|
||||
else
|
||||
GetVideoObject( &hHandle, guiMapBorderHeliSectors );
|
||||
|
||||
if (iResolution >= _640x480 && iResolution < _800x600)
|
||||
imageIndex = 0;
|
||||
@@ -4620,14 +4634,16 @@ void DisplayDistancesForHelicopter( void )
|
||||
|
||||
BltVideoObject( FRAME_BUFFER, hHandle, imageIndex, MAP_HELICOPTER_ETA_POPUP_X, sYPosition, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
// sTotalCanTravel = ( INT16 )GetTotalDistanceHelicopterCanTravel( );
|
||||
sTotalCanTravel = ( INT16 )GetTotalDistanceHelicopterCanTravel( );
|
||||
sDistanceToGo = ( INT16 )DistanceOfIntendedHelicopterPath( );
|
||||
sTotalOfTrip = sDistanceToGo; // + ( INT16 ) ( DistanceToNearestRefuelPoint( ( INT16 )( LastSectorInHelicoptersPath() % MAP_WORLD_X ), ( INT16 ) ( LastSectorInHelicoptersPath() / MAP_WORLD_X ) ) );
|
||||
sNumSafeSectors = GetNumSafeSectorsInPath( );
|
||||
sNumUnSafeSectors = GetNumUnSafeSectorsInPath( );
|
||||
|
||||
// sDistanceSoFar = ( INT16 )HowFarHelicopterhasTravelledSinceRefueling( );
|
||||
// sTotalDistanceOfTrip = ( INT16 )DistanceToNearestRefuelPoint( )
|
||||
//sDistanceSoFar = ( INT16 )HowFarHelicopterhasTravelledSinceRefueling( );
|
||||
//sTotalDistanceOfTrip = ( INT16 )DistanceToNearestRefuelPoint( );
|
||||
sRemainingFuel = ( INT16 )(gHelicopterSettings.ubHelicopterDistanceWithoutRefuel - iTotalHeliDistanceSinceRefuel - sDistanceToGo);
|
||||
sDistToRefuelSite = ( INT16 )DistanceToNearestRefuelPoint( sMapX, sMapY );
|
||||
|
||||
if( sDistanceToGo == 9999)
|
||||
{
|
||||
@@ -4639,7 +4655,7 @@ void DisplayDistancesForHelicopter( void )
|
||||
SetFontForeground( FONT_LTGREEN );
|
||||
SetFontBackground( FONT_BLACK );
|
||||
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ 0 ] );
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_TOTAL_DISTANCE ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5, sString );
|
||||
|
||||
/*
|
||||
@@ -4659,21 +4675,21 @@ void DisplayDistancesForHelicopter( void )
|
||||
|
||||
SetFontForeground( FONT_LTGREEN );
|
||||
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ 1 ] );
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_SAFE ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + GetFontHeight( MAP_FONT ), sString );
|
||||
|
||||
swprintf( sString, L"%d", sNumSafeSectors );
|
||||
FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 2 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + GetFontHeight( MAP_FONT ) ), sString );
|
||||
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ 2 ] );
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_UNSAFE ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 2 * GetFontHeight( MAP_FONT ), sString );
|
||||
|
||||
swprintf( sString, L"%d", sNumUnSafeSectors );
|
||||
FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 2 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + 2 * GetFontHeight( MAP_FONT ) ), sString );
|
||||
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ 3 ] );
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_TOTAL_COST ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 3 * GetFontHeight( MAP_FONT ), sString );
|
||||
|
||||
|
||||
@@ -4683,15 +4699,19 @@ void DisplayDistancesForHelicopter( void )
|
||||
UINT32 uiCostRed = __max(0,gGameExternalOptions.usHelicopterBaseCostPerRedTile + gsSkyriderCostModifier);
|
||||
uiTripCost = ( sNumSafeSectors * uiCostGreen ) + ( sNumUnSafeSectors * uiCostRed );
|
||||
|
||||
if( uiTripCost > LaptopSaveInfo.iCurrentBalance )
|
||||
SetFontForeground( FONT_LTRED );
|
||||
|
||||
swprintf( sString, L"%d", uiTripCost );
|
||||
InsertCommasForDollarFigure( sString );
|
||||
InsertDollarSignInToString( sString );
|
||||
FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 3 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + 3 * GetFontHeight( MAP_FONT ) ), sString );
|
||||
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ 4 ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ), sString );
|
||||
SetFontForeground( FONT_LTGREEN );
|
||||
|
||||
swprintf( sString, L"%s", pHelicopterEtaStrings[ STR_HELI_ETA_ETA ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 4 * GetFontHeight( MAP_FONT ), sString );
|
||||
|
||||
// get travel time for the last path segment
|
||||
iTime = GetPathTravelTimeDuringPlotting( pTempHelicopterPath );
|
||||
@@ -4705,13 +4725,34 @@ void DisplayDistancesForHelicopter( void )
|
||||
|
||||
|
||||
// show # of passengers aboard the chopper
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 5 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ 6 ] );
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 5 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_PASSENGERS ] );
|
||||
swprintf( sString, L"%d", GetNumberOfPassengersInHelicopter() );
|
||||
FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 5 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + 5 * GetFontHeight( MAP_FONT ) ), sString );
|
||||
|
||||
// show remaining fuel
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 6 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_REMAINING_FUEL ] );
|
||||
swprintf( sString, L"%d", sRemainingFuel );
|
||||
FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 6 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY );
|
||||
if( sRemainingFuel < sDistToRefuelSite )
|
||||
SetFontForeground( FONT_LTRED );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + 6 * GetFontHeight( MAP_FONT ) ), sString );
|
||||
SetFontForeground( FONT_LTGREEN );
|
||||
|
||||
// show distance to the nearest refuel site
|
||||
mprintf( MAP_HELICOPTER_ETA_POPUP_X + 5, sYPosition + 5 + 7 * GetFontHeight( MAP_FONT ), pHelicopterEtaStrings[ STR_HELI_ETA_DISTANCE_TO_REFUEL_SITE ] );
|
||||
swprintf( sString, L"%d", sDistToRefuelSite );
|
||||
FindFontRightCoordinates( MAP_HELICOPTER_ETA_POPUP_X + 5, ( INT16 ) ( MAP_HELICOPTER_ETA_POPUP_Y + 5 + 7 * GetFontHeight( MAP_FONT ) ), MAP_HELICOPTER_ETA_POPUP_WIDTH, 0, sString, MAP_FONT, &sX, &sY );
|
||||
if( sRemainingFuel < sDistToRefuelSite )
|
||||
SetFontForeground( FONT_LTRED );
|
||||
mprintf( sX, ( INT16 ) ( sYPosition + 5 + 7 * GetFontHeight( MAP_FONT ) ), sString );
|
||||
SetFontForeground( FONT_LTGREEN );
|
||||
|
||||
if( !gGameExternalOptions.fAlternativeHelicopterFuelSystem )
|
||||
InvalidateRegion( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_X + MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, sOldYPosition + MAP_HELICOPTER_ETA_POPUP_HEIGHT );
|
||||
else
|
||||
InvalidateRegion( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_X + MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, sOldYPosition + MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT );
|
||||
|
||||
InvalidateRegion( MAP_HELICOPTER_ETA_POPUP_X, sOldYPosition, MAP_HELICOPTER_ETA_POPUP_X + MAP_HELICOPTER_ETA_POPUP_WIDTH + 20, sOldYPosition + MAP_HELICOPTER_ETA_POPUP_HEIGHT );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ extern UINT16 MAP_HELICOPTER_ETA_POPUP_Y;
|
||||
extern UINT16 MAP_HELICOPTER_UPPER_ETA_POPUP_Y;
|
||||
extern UINT16 MAP_HELICOPTER_ETA_POPUP_WIDTH;
|
||||
extern UINT16 MAP_HELICOPTER_ETA_POPUP_HEIGHT;
|
||||
extern UINT16 MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT;
|
||||
|
||||
// sublevel text string position
|
||||
extern UINT16 MAP_LEVEL_STRING_X;
|
||||
@@ -326,6 +327,9 @@ extern UINT32 guiMapBorderEtaPopUp;
|
||||
// heli pop up
|
||||
extern UINT32 guiMapBorderHeliSectors;
|
||||
|
||||
// anv: alternate heli pop up for alternative fuel system
|
||||
extern UINT32 guiMapBorderHeliSectorsAlternate;
|
||||
|
||||
// the currently selected town militia
|
||||
extern INT16 sSelectedMilitiaTown;
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
|
||||
#include "Luaglobal.h"
|
||||
|
||||
// anv: Waldo The Mechanic - for fact checking with helicopter
|
||||
#include "Vehicles.h"
|
||||
|
||||
#define TESTQUESTS
|
||||
|
||||
extern SOLDIERTYPE * gpSrcSoldier;
|
||||
@@ -1307,6 +1310,43 @@ BOOLEAN CheckFact( UINT16 usFact, UINT8 ubProfileID )
|
||||
gubFact[usFact] = ;
|
||||
break;
|
||||
*/
|
||||
// anv: facts for checking if Waldo can repair helicopter
|
||||
|
||||
case FACT_HELI_DAMAGED_CAN_START_REPAIR:
|
||||
gubFact[usFact] = ( gGameExternalOptions.fWaldoCanRepairHelicopter &&
|
||||
!fHelicopterDestroyed && !fHelicopterIsAirBorne && gubHelicopterHitsTaken == 1 &&
|
||||
pVehicleList[ iHelicopterVehicleId ].sSectorX == gMercProfiles[ WALDO ].sSectorX && pVehicleList[ iHelicopterVehicleId ].sSectorY == gMercProfiles[ WALDO ].sSectorY &&
|
||||
LaptopSaveInfo.iCurrentBalance >= CalculateHelicopterRepairCost( FALSE ) &&
|
||||
gubHelicopterHoursToRepair == 0 && CheckFact( FACT_WALDO_MET, 0 ) );
|
||||
break;
|
||||
|
||||
case FACT_HELI_SERIOUSLY_DAMAGED_CAN_START_REPAIR:
|
||||
gubFact[usFact] = ( gGameExternalOptions.fWaldoCanRepairHelicopter &&
|
||||
!fHelicopterDestroyed && !fHelicopterIsAirBorne && gubHelicopterHitsTaken == 2 &&
|
||||
pVehicleList[ iHelicopterVehicleId ].sSectorX == gMercProfiles[ WALDO ].sSectorX && pVehicleList[ iHelicopterVehicleId ].sSectorY == gMercProfiles[ WALDO ].sSectorY &&
|
||||
LaptopSaveInfo.iCurrentBalance >= CalculateHelicopterRepairCost( TRUE ) &&
|
||||
gubHelicopterHoursToRepair == 0 && CheckFact( FACT_WALDO_MET, 0 ) );
|
||||
break;
|
||||
|
||||
case FACT_HELI_GIVEN_MONEY_CAN_START_REPAIR:
|
||||
gubFact[usFact] = ( ( gGameExternalOptions.fWaldoCanRepairHelicopter &&
|
||||
!fHelicopterDestroyed && !fHelicopterIsAirBorne && gubHelicopterHitsTaken > 0 &&
|
||||
pVehicleList[ iHelicopterVehicleId ].sSectorX == gMercProfiles[ WALDO ].sSectorX && pVehicleList[ iHelicopterVehicleId ].sSectorY == gMercProfiles[ WALDO ].sSectorY &&
|
||||
gubHelicopterHoursToRepair == 0 ) &&
|
||||
( CheckFact(FACT_GIVEN_ENOUGH_TO_REPAIR_HELI, 0) || CheckFact(FACT_GIVEN_ENOUGH_TO_SERIOUSLY_REPAIR_HELI, 0) ) && CheckFact( FACT_WALDO_MET, 0 ) );
|
||||
break;
|
||||
|
||||
case FACT_HELI_CANT_START_REPAIR:
|
||||
gubFact[usFact] = ( !CheckFact(FACT_HELI_GIVEN_MONEY_CAN_START_REPAIR, 0) && !CheckFact(FACT_HELICOPTER_IN_PERFECT_CONDITION, 0));
|
||||
break;
|
||||
|
||||
case FACT_HELICOPTER_IN_PERFECT_CONDITION:
|
||||
gubFact[usFact] = ( gubHelicopterHitsTaken == 0 );
|
||||
break;
|
||||
|
||||
case FACT_HELICOPTER_LOST:
|
||||
gubFact[usFact] = fHelicopterDestroyed;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -331,9 +331,15 @@ enum Facts
|
||||
FACT_PABLO_WONT_STEAL = 124,
|
||||
FACT_AGENTS_PREVENTED_SHIPMENT,// 125
|
||||
|
||||
// anv: it was 126 in Waldo script
|
||||
FACT_HELICOPTER_IN_PERFECT_CONDITION = 126,
|
||||
|
||||
FACT_LARGE_AMOUNT_OF_MONEY = 127,
|
||||
FACT_SMALL_AMOUNT_OF_MONEY,// 128
|
||||
|
||||
// anv: it was 130 in Waldo script
|
||||
FACT_HELICOPTER_LOST = 130,
|
||||
|
||||
FACT_LOYALTY_OKAY = 135,
|
||||
FACT_LOYALTY_LOW,// 136
|
||||
FACT_LOYALTY_HIGH,// 137
|
||||
@@ -530,6 +536,20 @@ enum Facts
|
||||
FACT_PLAYER_KILLED_BOXERS = 368,
|
||||
// HEADROCK HAM 4: Seen Mobile Militia screen after having at least one mobile unit?
|
||||
FACT_MOBILE_RESTRICTIONS_VIEWED = 369,
|
||||
|
||||
// anv: Waldo The Mechanic, facts for his dialogue
|
||||
FACT_HELI_DAMAGED_CAN_START_REPAIR,
|
||||
FACT_HELI_SERIOUSLY_DAMAGED_CAN_START_REPAIR,
|
||||
|
||||
FACT_GIVEN_ENOUGH_TO_REPAIR_HELI,
|
||||
FACT_GIVEN_ENOUGH_TO_SERIOUSLY_REPAIR_HELI,
|
||||
|
||||
FACT_HELI_GIVEN_MONEY_CAN_START_REPAIR,
|
||||
FACT_HELI_CANT_START_REPAIR,
|
||||
|
||||
FACT_WALDO_MET,
|
||||
|
||||
|
||||
#ifdef JA2UB
|
||||
//Ja25 UB
|
||||
FACT_IMPORTED_SAVE_AND_MARY_WAS_DEAD = 400,
|
||||
|
||||
+27
-5
@@ -4617,6 +4617,7 @@ UINT32 MapScreenHandle(void)
|
||||
MAP_HELICOPTER_UPPER_ETA_POPUP_Y = (50 + iScreenHeightOffset) - yResOffset;
|
||||
MAP_HELICOPTER_ETA_POPUP_WIDTH = 120;
|
||||
MAP_HELICOPTER_ETA_POPUP_HEIGHT = 68;
|
||||
MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT = 74;
|
||||
|
||||
// Map Level string
|
||||
MAP_LEVEL_STRING_X = (SCREEN_WIDTH - 208);
|
||||
@@ -4669,6 +4670,7 @@ UINT32 MapScreenHandle(void)
|
||||
MAP_HELICOPTER_UPPER_ETA_POPUP_Y = (50 + iScreenHeightOffset - 40) - yResOffset;
|
||||
MAP_HELICOPTER_ETA_POPUP_WIDTH = 120;
|
||||
MAP_HELICOPTER_ETA_POPUP_HEIGHT = 68;
|
||||
MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT = 74;
|
||||
|
||||
// Map Level string
|
||||
MAP_LEVEL_STRING_X = (SCREEN_WIDTH - 800)/ 2 + (800 - 208 - 80);
|
||||
@@ -4720,6 +4722,7 @@ UINT32 MapScreenHandle(void)
|
||||
MAP_HELICOPTER_UPPER_ETA_POPUP_Y = (50 + iScreenHeightOffset - 100) - yResOffset;
|
||||
MAP_HELICOPTER_ETA_POPUP_WIDTH = 120;
|
||||
MAP_HELICOPTER_ETA_POPUP_HEIGHT = 76;
|
||||
MAP_HELICOPTER_ETA_POPUP_ALTERNATE_HEIGHT = 97;
|
||||
|
||||
// Map Level string
|
||||
MAP_LEVEL_STRING_X = (SCREEN_WIDTH - 1024)/ 2 + (1024 - 208 - 187);
|
||||
@@ -4958,6 +4961,9 @@ UINT32 MapScreenHandle(void)
|
||||
FilenameForBPP("INTERFACE\\pos2.sti", VObjectDesc.ImageFile);
|
||||
CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectors));
|
||||
|
||||
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP("INTERFACE\\pos2_alternate.sti", VObjectDesc.ImageFile);
|
||||
CHECKF(AddVideoObject(&VObjectDesc, &guiMapBorderHeliSectorsAlternate));
|
||||
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP("INTERFACE\\secondary_gun_hidden.sti", VObjectDesc.ImageFile);
|
||||
@@ -6407,7 +6413,7 @@ UINT32 HandleMapUI( )
|
||||
// plotting for the chopper?
|
||||
if( fPlotForHelicopter == TRUE )
|
||||
{
|
||||
/*
|
||||
|
||||
if( IsSectorOutOfTheWay( sMapX, sMapY ) == TRUE )
|
||||
{
|
||||
if( gfAllowSkyriderTooFarQuote == TRUE )
|
||||
@@ -6417,7 +6423,7 @@ UINT32 HandleMapUI( )
|
||||
|
||||
return( MAP_SCREEN );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
PlotPathForHelicopter( sMapX, sMapY );
|
||||
fTeamPanelDirty = TRUE;
|
||||
@@ -8546,6 +8552,7 @@ INT32 iCounter2 = 0;
|
||||
DeleteVideoObjectFromIndex( guiSecItemHiddenVO );
|
||||
DeleteVideoObjectFromIndex( guiSelectedCharArrow );
|
||||
DeleteVideoObjectFromIndex( guiMapBorderHeliSectors );
|
||||
DeleteVideoObjectFromIndex( guiMapBorderHeliSectorsAlternate );
|
||||
DeleteVideoObjectFromIndex( guiHelicopterIcon );
|
||||
DeleteVideoObjectFromIndex( guiMINEICON );
|
||||
DeleteVideoObjectFromIndex( guiSectorLocatorGraphicID );
|
||||
@@ -13322,6 +13329,7 @@ INT32 iCounter2 = 0;
|
||||
DeleteVideoObjectFromIndex( guiSecItemHiddenVO );
|
||||
DeleteVideoObjectFromIndex( guiSelectedCharArrow );
|
||||
DeleteVideoObjectFromIndex( guiMapBorderHeliSectors );
|
||||
DeleteVideoObjectFromIndex( guiMapBorderHeliSectorsAlternate );
|
||||
DeleteVideoObjectFromIndex( guiHelicopterIcon );
|
||||
DeleteVideoObjectFromIndex( guiMINEICON );
|
||||
DeleteVideoObjectFromIndex( guiSectorLocatorGraphicID );
|
||||
@@ -15217,6 +15225,20 @@ void ExplainWhySkyriderCantFly( void )
|
||||
return;
|
||||
}
|
||||
|
||||
// repairs in progress
|
||||
if ( gubHelicopterHoursToRepair > 0 )
|
||||
{
|
||||
DoMapMessageBox( MSG_BOX_BASIC_STYLE, pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_IN_PROGRESS ], MAP_SCREEN, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback );
|
||||
return;
|
||||
}
|
||||
|
||||
// anv - helicopter too damaged?
|
||||
if ( gGameExternalOptions.fSeriouslyDamagedSkyriderWontFly == TRUE && gubHelicopterHitsTaken > 1 )
|
||||
{
|
||||
SkyRiderTalk( HELI_TOO_DAMAGED_TO_FLY );
|
||||
return;
|
||||
}
|
||||
|
||||
// no explainable reason
|
||||
}
|
||||
|
||||
@@ -15511,11 +15533,11 @@ BOOLEAN CanMoveBullseyeAndClickedOnIt( INT16 sMapX, INT16 sMapY )
|
||||
|
||||
void CreateBullsEyeOrChopperSelectionPopup( void )
|
||||
{
|
||||
wcscpy( gzUserDefinedButton1, pHelicopterEtaStrings[ 8 ] );
|
||||
wcscpy( gzUserDefinedButton2, pHelicopterEtaStrings[ 9 ] );
|
||||
wcscpy( gzUserDefinedButton1, pHelicopterEtaStrings[ STR_HELI_ETA_SKYRIDER ] );
|
||||
wcscpy( gzUserDefinedButton2, pHelicopterEtaStrings[ STR_HELI_ETA_ARRIVALS ] );
|
||||
|
||||
// do a BULLSEYE/CHOPPER message box
|
||||
DoScreenIndependantMessageBox( pHelicopterEtaStrings[ 7 ], MSG_BOX_FLAG_GENERIC_TWO_BUTTONS, BullsEyeOrChopperSelectionPopupCallback );
|
||||
DoScreenIndependantMessageBox( pHelicopterEtaStrings[ STR_HELI_ETA_SELECT_SKYRIDER_OR_ARRIVALS ], MSG_BOX_FLAG_GENERIC_TWO_BUTTONS, BullsEyeOrChopperSelectionPopupCallback );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user