From c6c0b09b70e52f3b6901c6537143e7417202047f Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Thu, 14 Jan 2021 15:17:56 +0000 Subject: [PATCH] Added basic requirements to start snitching (alive, conscious, not in transit etc). When clicking on move equipment menu, check basic requirements. If soldiers land into enemy sector from helicopter, use gsGridNoSweetSpot instead of default arrival location when ESC is pressed. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8919 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Assignments.cpp | 63 ++++++++++++++++++++++++++++++++++---- Tactical/Merc Entering.cpp | 8 +++-- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index ed14a22a..8e07f29c 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -483,7 +483,7 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ ); // Flugente: prisons can riot if there aren't enough guards around void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ ); -// Flugente: assigned mercs can move equipemnt in city sectors +// Flugente: assigned mercs can move equipment in city sectors void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ ); void HandleTrainWorkers( ); @@ -515,7 +515,7 @@ void HandleAdministrationAssignments(); // Flugente: handle exploration assignements void HandleExplorationAssignments(); -// is the character between secotrs in mvt +// is the character between sectors in mvt BOOLEAN CharacterIsBetweenSectors( SOLDIERTYPE *pSoldier ); // update soldier life @@ -2747,6 +2747,56 @@ BOOLEAN CanCharacterSnitch( SOLDIERTYPE *pSoldier ) { AssertNotNIL(pSoldier); + // sevenfm: added basic requirements + if (!BasicCanCharacterAssignment(pSoldier, TRUE)) + { + return(FALSE); + } + + // only need to be alive and well to do so right now + // alive and conscious + if (pSoldier->stats.bLife < OKLIFE) + { + // dead or unconscious... + return (FALSE); + } + + if (pSoldier->bSectorZ != 0) + { + return(FALSE); + } + + // in transit? + if (IsCharacterInTransit(pSoldier) == TRUE) + { + return (FALSE); + } + + // character on the move? + if (CharacterIsBetweenSectors(pSoldier)) + { + return(FALSE); + } + + // check in helicopter in hostile sector + if (pSoldier->bAssignment == VEHICLE) + { + if ((iHelicopterVehicleId != -1) && (pSoldier->iVehicleId == iHelicopterVehicleId)) + { + // enemies in sector + if (NumNonPlayerTeamMembersInSector(pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM) > 0) + { + return(FALSE); + } + } + } + + if (pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__EPC) + { + // epcs can't do this + return(FALSE); + } + // Flugente: we can't perform most assignments while concealed if ( SPY_LOCATION( pSoldier->bAssignment ) ) return( FALSE ); @@ -8671,7 +8721,7 @@ void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ ) } } -// Flugente: assigned mercs can move equipemnt in city sectors +// Flugente: assigned mercs can move equipment in city sectors void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ ) { // no underground @@ -14103,7 +14153,8 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) break; case( ASSIGN_MENU_MOVE_ITEMS ): - if( 1 ) + if (CanCharacterPractise(pSoldier)) + //if( 1 ) { gAssignMenuState = ASMENU_NONE; @@ -14121,14 +14172,14 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) DetermineBoxPositions(); } } - else if( 0 ) + /*else if( 0 ) { fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; swprintf( sString, zMarksMapScreenText[ 18 ], pSoldier->GetName() ); DoScreenIndependantMessageBox( sString , MSG_BOX_FLAG_OK, NULL ); - } + }*/ break; case ASSIGN_MENU_FORTIFY: diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 69ff0711..6a425878 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -566,9 +566,11 @@ void HandleHeliDrop( BOOLEAN fPlayer ) MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; #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 ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; + // sevenfm: if soldiers land into enemy sector, use gsGridNoSweetSpot + //MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; + MercPtrs[gusHeliSeats[cnt]]->usStrategicInsertionData = gsGridNoSweetSpot; #endif // HEADROCK HAM 3.5: Externalized! UpdateMercInSector( MercPtrs[ gusHeliSeats[ cnt ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); @@ -699,7 +701,7 @@ void HandleHeliDrop( BOOLEAN fPlayer ) 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 finish the airdrop. For that reason, we set all those soldiers 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 soldiers to the STANDING animation. MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usAnimState = STANDING; MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE );