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:
Flugente
2013-12-19 22:01:44 +00:00
parent 80c1b65494
commit faba9ea713
39 changed files with 1075 additions and 131 deletions
+3 -2
View File
@@ -1716,14 +1716,15 @@ void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTar
if( pTarget != NULL )
{
#ifdef ENABLE_ZOMBIES
// target should be zombie
if( zTaunt[ i ].uiFlags2 & TAUNT_T_ZOMBIE )
{
// anv: moved ifdef - if zombies are off, we want to skip any taunts with TAUNT_T_ZOMBIE flag
#ifdef ENABLE_ZOMBIES
if( pTarget->IsZombie() == FALSE )
#endif
continue;
}
#endif
// target merc profile
if( zTaunt[ i ].value[TAUNT_TARGET_MERC_PROFILE] != -1 )
+25
View File
@@ -70,6 +70,8 @@
#include "ub_config.h"
#include "history.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
@@ -354,6 +356,8 @@ void InitalizeStaticExternalNPCFaces( void )
//}
// ... put Skyrider's face at index 0
uiExternalStaticNPCFaces.push_back(( UINT32 )InitFace( ( UINT8 )( SKYRIDER ), NOBODY, FACE_FORCE_SMALL ));
// anv: and put Waldo too
uiExternalStaticNPCFaces.push_back(( UINT32 )InitFace( ( UINT8 )( WALDO ), NOBODY, FACE_FORCE_SMALL ));
return;
}
@@ -2682,6 +2686,21 @@ void HandleDialogueEnd( FACETYPE *pFace )
MSYS_RemoveRegion( &gTextBoxMouseRegion );
fTextBoxMouseRegionCreated = FALSE;
}
// anv: show repair prompt afer Waldo offered repairs
if ( gbUIHandlerID == DIALOGUE_EXTERNAL_NPC_UI && gTacticalStatus.ubLastQuoteProfileNUm == WALDO &&
( gTacticalStatus.ubLastQuoteSaid == WALDO_REPAIR_PROPOSITION || gTacticalStatus.ubLastQuoteSaid == WALDO_SERIOUS_REPAIR_PROPOSITION ) )
{
CHAR16 sHelicopterRepairPromptText[ 320 ];
if( CheckFact(FACT_HELI_DAMAGED_CAN_START_REPAIR, 0) == TRUE )
{
swprintf( sHelicopterRepairPromptText, pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_PROMPT ], gMercProfiles[ WALDO ].zNickname, CalculateHelicopterRepairCost( FALSE ), gHelicopterSettings.ubHelicopterBasicRepairTime );
}
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 );
}
// anv: after merc finishes his quote, we want enemy to answer
if ( gbUIHandlerID == DIALOGUE_TACTICAL_UI )
@@ -2720,6 +2739,12 @@ void HandleDialogueEnd( FACETYPE *pFace )
case DIALOGUE_NPC_UI:
// anv: "meet" Waldo when speaking with him first time
if ( gTacticalStatus.ubLastQuoteProfileNUm == WALDO && CheckFact( FACT_WALDO_MET, 0 ) == FALSE && gTacticalStatus.ubLastQuoteSaid == 0 )
{
AddHistoryToPlayersLog( HISTORY_WALDO, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY );
SetFactTrue( FACT_WALDO_MET );
}
// Remove region
if ( gTalkPanel.fTextRegionOn )
+1
View File
@@ -287,6 +287,7 @@ enum{
enum{
SKYRIDER_EXTERNAL_FACE =0,
WALDO_EXTERNAL_FACE,
//MINER_FRED_EXTERNAL_FACE,
//MINER_MATT_EXTERNAL_FACE,
//MINER_OSWALD_EXTERNAL_FACE,
+29
View File
@@ -2402,6 +2402,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
case NPC_ACTION_MEDICAL_REQUESTOR_2: // at hospital
case NPC_ACTION_BUY_VEHICLE_REQUESTOR: // from Dave
case NPC_ACTION_KROTT_REQUESTOR:
case NPC_ACTION_WALDO_REPAIR_REQUESTOR:
// Vince or Willis asks about payment? for medical attention
if (ubTargetNPC != gpDestSoldier->ubProfile)
{
@@ -4478,6 +4479,11 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum
// }
break;
case NPC_ACTION_WALDO_START_REPAIRS:
// it's called after giving him money
StartHelicopterRepair( FALSE, TRUE );
break;
default:
ScreenMsg( FONT_MCOLOR_RED, MSG_TESTVERSION, L"No code support for NPC action %d", usActionCode );
break;
@@ -4670,6 +4676,19 @@ void StartDialogueMessageBox( UINT8 ubProfileID, UINT16 usMessageBoxType )
swprintf( zTemp, TacticalStr[ SPARE_KROTT_PROMPT ], gMercProfiles[ubProfileID].zNickname );
DoMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
break;
// anv: Waldo The Mechanic
case NPC_ACTION_WALDO_REPAIR_REQUESTOR:
swprintf( zTemp, TacticalStr[ STR_HELI_RR_REPAIR_PROMPT ], gMercProfiles[ubProfileID].zNickname );
if( CheckFact(FACT_HELI_DAMAGED_CAN_START_REPAIR, 0) == TRUE )
{
swprintf( zTemp, pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_PROMPT ], gMercProfiles[ WALDO ].zNickname, CalculateHelicopterRepairCost( FALSE ), gHelicopterSettings.ubHelicopterBasicRepairTime);
}
else
{
swprintf( zTemp, pHelicopterRepairRefuelStrings[ STR_HELI_RR_REPAIR_PROMPT ], gMercProfiles[ WALDO ].zNickname, CalculateHelicopterRepairCost( TRUE ), gHelicopterSettings.ubHelicopterSeriousRepairTime );
}
DoMessageBox( MSG_BOX_BASIC_STYLE, zTemp, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, DialogueMessageBoxCallBack, NULL );
break;
default:
break;
}
@@ -4953,6 +4972,16 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue )
TriggerNPCRecord( SERGEANT, 6 );
}
break;
case NPC_ACTION_WALDO_REPAIR_REQUESTOR:
if ( ubExitValue == MSG_BOX_RETURN_YES )
{
StartHelicopterRepair( FALSE, FALSE );
}
else
{
TriggerNPCRecord( WALDO, 17 );
}
break;
case NPC_ACTION_TRIGGER_MARRY_DARYL_PROMPT:
gMercProfiles[ gpSrcSoldier->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_ASKED_BY_HICKS;
if ( ubExitValue == MSG_BOX_RETURN_YES )
+4 -4
View File
@@ -1055,10 +1055,10 @@ void HourlyMoraleUpdate( void )
{
// skip past ourselves and all inactive mercs
if (bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->ubProfile != NO_PROFILE &&
!(pOtherSoldier->bAssignment == IN_TRANSIT ||
pOtherSoldier->flags.fMercAsleep == TRUE ||
pOtherSoldier->bAssignment == ASSIGNMENT_DEAD ||
pOtherSoldier->bAssignment == ASSIGNMENT_POW))
!(pOtherSoldier->bAssignment == IN_TRANSIT ||
pOtherSoldier->flags.fMercAsleep == TRUE ||
pOtherSoldier->bAssignment == ASSIGNMENT_DEAD ||
pOtherSoldier->bAssignment == ASSIGNMENT_POW))
{
if (fSameGroupOnly)
{
+27
View File
@@ -1380,7 +1380,34 @@ BOOLEAN KillAllInVehicle( INT32 iId )
}
}
}
return ( TRUE );
}
// anv: for hurting heli passengers on SAM attack
BOOLEAN HurtPassengersInHelicopter( INT32 iId )
{
INT32 iCounter = 0;
// find if vehicle is valid
if( VehicleIdIsValid( iId ) == FALSE )
{
return ( FALSE );
}
// go through list of occupants and hurt them
for( iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ )
{
if( pVehicleList[ iId ].pPassengers[ iCounter ] != NULL )
{
if( PreRandom(100) < gHelicopterSettings.ubHelicopterPassengerHitChance )
{
if( InjurePersonInVehicle( iId , pVehicleList[ iId ].pPassengers[ iCounter ],
gHelicopterSettings.ubHelicopterPassengerHitMinDamage + PreRandom( gHelicopterSettings.ubHelicopterPassengerHitMaxDamage - gHelicopterSettings.ubHelicopterPassengerHitMinDamage ) ) == FALSE )
{
return( FALSE );
}
}
}
}
return ( TRUE );
}
+3
View File
@@ -355,6 +355,9 @@ BOOLEAN KillPersonInVehicle( INT32 iId, SOLDIERTYPE *pSoldier );
// kill everyone in vehicle
BOOLEAN KillAllInVehicle( INT32 iId );
// anv: for hurting heli passengers on SAM attack
BOOLEAN HurtPassengersInHelicopter( INT32 iId );
#ifdef JA2TESTVERSION
// test vehicle stuff
void VehicleTest( void );
+4
View File
@@ -205,6 +205,7 @@ enum
NPC_ACTION_REMOVE_DOREEN,
NPC_ACTION_RESET_SHIPMENT_ARRIVAL_STUFF,
// 153 Fix helicopter by next morning?
NPC_ACTION_WALDO_START_REPAIRS = 153,// anv: added this
NPC_ACTION_DECIDE_ACTIVE_TERRORISTS = 154,
NPC_ACTION_TRIGGER_FATHER_18_20_OR_15,
NPC_ACTION_CHECK_LAST_TERRORIST_HEAD,
@@ -369,6 +370,9 @@ enum
NPC_ACTION_SEND_WEIGHTED_ASSAULT_TO_LOCATION, // 1st optional parm is "direness: rating
NPC_ACTION_SEND_SPECIFIC_ASSAULT_TO_LOCATION, // 1st option parm is # of soldiers to send, 2nd is composition
// anv: Waldo The Mechanic
NPC_ACTION_WALDO_REPAIR_REQUESTOR,
NPC_ACTION_TURN_TO_FACE_NEAREST_MERC = 500,
NPC_ACTION_TURN_TO_FACE_PROFILE_ID_0,