void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) { SOLDIERTYPE *pKiller = NULL; INT16 sSectorX, sSectorY; //if the soldier HAS a profile if( pSoldier->ubProfile != NO_PROFILE ) { //add to the history log the fact that the merc died and the circumstances if( pSoldier->ubAttackerID != NOBODY ) { pKiller = MercPtrs[ pSoldier->ubAttackerID ]; } // CJC Nov 11, 2002 // Use the soldier's sector location unless impossible if (pSoldier->sSectorX != 0 && pSoldier->sSectorY != 0) { sSectorX = pSoldier->sSectorX; sSectorY = pSoldier->sSectorY; } else { sSectorX = gWorldSectorX; sSectorY = gWorldSectorY; } if( pKiller && pKiller->bTeam == OUR_TEAM ) { AddHistoryToPlayersLog( HISTORY_MERC_KILLED_CHARACTER, pSoldier->ubProfile, GetWorldTotalMin(), sSectorX, sSectorY ); } else { AddHistoryToPlayersLog( HISTORY_MERC_KILLED, pSoldier->ubProfile, GetWorldTotalMin(), sSectorX, sSectorY ); } } if ( guiCurrentScreen != GAME_SCREEN ) { ScreenMsg( FONT_RED, MSG_INTERFACE, pMercDeadString[ 0 ], pSoldier->name ); } // robot and EPCs don't count against death rate - the mercs back home don't particularly give a damn about locals & machines! if ( !AM_AN_EPC( pSoldier ) && !AM_A_ROBOT( pSoldier ) ) { // keep track of how many mercs have died under player's command (for death rate, can't wait until removed from team) gStrategicStatus.ubMercDeaths++; } pSoldier->uiStatusFlags |= SOLDIER_DEAD; // Set breath to 0! pSoldier->bBreathMax = pSoldier->bBreath = 0; // not asleep, DEAD! pSoldier->fMercAsleep = FALSE; //if the merc had life insurance if( pSoldier->usLifeInsurance ) { // if he didn't die during auto-resolve if( guiCurrentScreen != AUTORESOLVE_SCREEN ) { // check whether this was obviously a suspicious death // if killed within an hour of being insured if ( pSoldier->uiStartTimeOfInsuranceContract <= GetWorldTotalMin() && GetWorldTotalMin() - pSoldier->uiStartTimeOfInsuranceContract < 60 ) { gMercProfiles[ pSoldier->ubProfile ].ubSuspiciousDeath = VERY_SUSPICIOUS_DEATH; } // if killed by someone on our team, or while there weren't any opponents around else if (Menptr[ pSoldier->ubAttackerID ].bTeam == OUR_TEAM || !gTacticalStatus.fEnemyInSector ) { // cause insurance company to suspect fraud and investigate this claim gMercProfiles[ pSoldier->ubProfile ].ubSuspiciousDeath = SUSPICIOUS_DEATH; } } AddLifeInsurancePayout( pSoldier ); } // robot and EPCs don't penalize morale - merc don't care about fighting machines and the lives of locals much if ( !AM_AN_EPC( pSoldier ) && !AM_A_ROBOT( pSoldier ) ) { // Change morale of others based on this HandleMoraleEvent( pSoldier, MORALE_TEAMMATE_DIED, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); } //if its a MERC merc, record the time of his death if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { pSoldier->iEndofContractTime = GetWorldTotalMin(); //set is so Speck can say that a merc is dead LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote = 1; } //Set the fact that the merc is DEAD!! gMercProfiles[ pSoldier->ubProfile ].bMercStatus = MERC_IS_DEAD; if( pSoldier->bAssignment != ASSIGNMENT_DEAD ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } // handle strategic level death HandleStrategicDeath( pSoldier ); }
BOOLEAN AddCharacterToSquad( SOLDIERTYPE *pCharacter, INT8 bSquadValue ) { INT8 bCounter =0; INT16 sX, sY; INT8 bZ; // BOOLEAN fBetweenSectors = FALSE; GROUP *pGroup; BOOLEAN fNewSquad; // add character to squad...return success or failure // run through list of people in squad, find first free slo if( fExitingVehicleToSquad ) { return( FALSE ); } // ATE: If any vehicle exists in this squad AND we're not set to // a driver or or passenger, when return false if ( DoesVehicleExistInSquad( bSquadValue ) ) { // We're not allowing anybody to go on a vehicle if they are not passengers! // NB: We obviously need to make sure that REAL passengers have their // flags set before adding them to a squad! if ( !( pCharacter->uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER | SOLDIER_VEHICLE ) ) ) { return( FALSE ); } } // if squad is on the move, can't add someone if( IsThisSquadOnTheMove( bSquadValue ) == TRUE ) { // nope, go away now return( FALSE ); } for( bCounter =0; bCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; bCounter++ ) { // check if on current squad and current slot? if( Squad[ bSquadValue ][ bCounter ] == pCharacter ) { // 'successful of sorts, if there, then he's 'added' return ( TRUE ); } // free slot, add here if( Squad[ bSquadValue ][ bCounter ] == NULL ) { // check if squad empty, if not check sector x,y,z are the same as this guys if( SquadIsEmpty( bSquadValue ) == FALSE ) { GetLocationOfSquad( &sX, &sY, &bZ, bSquadValue ); // if not same, return false if( ( pCharacter->sSectorX != sX ) || ( pCharacter -> sSectorY != sY ) ||( pCharacter->bSectorZ != bZ) ) { return ( FALSE ); } // remove them RemoveCharacterFromSquads( pCharacter ); // fBetweenSectors = Squad[ bSquadValue ][ 0 ]->fBetweenSectors; } else { // remove them RemoveCharacterFromSquads( pCharacter ); } /* if( fBetweenSectors == TRUE ) { pCharacter->fBetweenSectors = TRUE; } */ // copy path of squad to this char CopyPathOfSquadToCharacter( pCharacter, bSquadValue ); // check if old mvt group if( pCharacter -> ubGroupID != 0 ) { // in valid group, remove from that group RemovePlayerFromGroup( pCharacter -> ubGroupID , pCharacter ); // character not on a reserved group if( ( pCharacter->bAssignment >= ON_DUTY ) && ( pCharacter->bAssignment != VEHICLE ) ) { // get the group from the character pGroup = GetGroup( pCharacter -> ubGroupID ); // if valid group, delete it if( pGroup ) { RemoveGroupFromList( pGroup ); } } } if( ( pCharacter->bAssignment == VEHICLE ) && ( pCharacter->iVehicleId == iHelicopterVehicleId ) && ( pCharacter-> iVehicleId != -1 ) ) { // if creating a new squad from guys exiting the chopper fNewSquad = SquadIsEmpty( bSquadValue ); RemoveSoldierFromHelicopter( pCharacter ); AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); SetGroupSectorValue( pCharacter->sSectorX, pCharacter->sSectorY, pCharacter->bSectorZ, SquadMovementGroups[ bSquadValue ] ); pCharacter -> ubGroupID = SquadMovementGroups[ bSquadValue ]; // if we've just started a new squad if ( fNewSquad ) { // set mvt group for GROUP *pGroup; // grab group pGroup = GetGroup( pVehicleList[ iHelicopterVehicleId ].ubMovementGroup ); Assert( pGroup ); if( pGroup ) { // set where it is and where it's going, then make it arrive there. Don't check for battle PlaceGroupInSector( SquadMovementGroups[ bSquadValue ], pGroup->ubPrevX, pGroup->ubPrevY, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubSectorZ, FALSE ); } } } else if( ( pCharacter->bAssignment == VEHICLE ) && ( pCharacter-> iVehicleId != -1 ) ) { fExitingVehicleToSquad = TRUE; // remove from vehicle TakeSoldierOutOfVehicle( pCharacter ); fExitingVehicleToSquad = FALSE; AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); SetGroupSectorValue( pCharacter->sSectorX, pCharacter->sSectorY, pCharacter->bSectorZ, SquadMovementGroups[ bSquadValue ] ); pCharacter -> ubGroupID = SquadMovementGroups[ bSquadValue ]; } else { AddPlayerToGroup( SquadMovementGroups[ bSquadValue ], pCharacter ); SetGroupSectorValue( pCharacter->sSectorX, pCharacter->sSectorY, pCharacter->bSectorZ, SquadMovementGroups[ bSquadValue ] ); pCharacter -> ubGroupID = SquadMovementGroups[ bSquadValue ]; } // assign here Squad[ bSquadValue ][ bCounter ] = pCharacter; if( ( pCharacter->bAssignment != bSquadValue ) ) { // check to see if we should wake them up if ( pCharacter->fMercAsleep ) { // try to wake him up SetMercAwake( pCharacter, FALSE, FALSE ); } SetTimeOfAssignmentChangeForMerc( pCharacter ); } // set squad value ChangeSoldiersAssignment( pCharacter, bSquadValue ); if ( pCharacter->bOldAssignment < ON_DUTY ) { pCharacter->bOldAssignment = bSquadValue; } // if current tactical sqaud...upadte panel if( NumberOfPeopleInSquad( ( INT8 )iCurrentTacticalSquad ) == 0 ) { SetCurrentSquad( bSquadValue, TRUE ); } if( bSquadValue == ( INT8 ) iCurrentTacticalSquad ) { CheckForAndAddMercToTeamPanel( Squad[ iCurrentTacticalSquad ][ bCounter ] ); } if ( pCharacter->ubID == gusSelectedSoldier ) { SetCurrentSquad( bSquadValue, TRUE ); } return ( TRUE ); } } return ( FALSE ); }
BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) { // add the guy to the dead list //AddCharacterToDeadList( pSoldier ); // If in a vehicle, remove them! if( ( pSoldier->bAssignment == VEHICLE ) && ( pSoldier->iVehicleId != -1 ) ) { // remove from vehicle TakeSoldierOutOfVehicle( pSoldier ); } // if not in mapscreen if ( !(guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { // ATE; At least make them dead! if( ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_DEAD ); } else if( ( pSoldier->stats.bLife == 0 )&&( pSoldier->bAssignment != ASSIGNMENT_DEAD ) ) { // died in mapscreen fReDrawFace = TRUE; // dead if( ( pSoldier->bAssignment != ASSIGNMENT_DEAD ) ) { SetTimeOfAssignmentChangeForMerc( pSoldier ); } ChangeSoldiersAssignment( pSoldier, ASSIGNMENT_DEAD ); //s et breath and breath max to 0 pSoldier->bBreath = pSoldier->bBreathMax = 0; // rebuild list ReBuildCharactersList( ); // ste merc as dead // pSoldier->flags.fUIdeadMerc = TRUE; // attempt to remove character from squad RemoveCharacterFromSquads( pSoldier ); // handle any passign comments by grunts HandleSoldierDeadComments( pSoldier ); // put the dead guys down AddDeadSoldierToUnLoadedSector( ( UINT8 ) ( pSoldier->sSectorX ), ( UINT8 )( pSoldier->sSectorY ), pSoldier->bSectorZ, pSoldier, RandomGridNo(), ADD_DEAD_SOLDIER_TO_SWEETSPOT ); fTeamPanelDirty = TRUE; fMapPanelDirty = TRUE; fCharacterInfoPanelDirty = TRUE; StopTimeCompression(); } return( TRUE ); }