void SoldierInSectorRepair( SOLDIERTYPE *pSoldier, INT16 sGridNo ) { INT16 sWorldX, sWorldY; UINT8 ubNewDirection; INT16 sGoodGridNo; if ( !pSoldier->bInSector ) { return; } // OK, look for sutable placement.... sGoodGridNo = FindGridNoFromSweetSpotWithStructData( pSoldier, BEING_REPAIRMAN, sGridNo, 5, &ubNewDirection, FALSE ); sWorldX = CenterX( sGoodGridNo ); sWorldY = CenterY( sGoodGridNo ); EVENT_SetSoldierPosition( pSoldier, sWorldX, sWorldY ); EVENT_SetSoldierDirection( pSoldier, ubNewDirection ); EVENT_SetSoldierDesiredDirection( pSoldier, ubNewDirection ); //pSoldier->bDesiredDirection = pSoldier->bDirection; if ( !IS_MERC_BODY_TYPE( pSoldier ) ) { EVENT_InitNewSoldierAnim( pSoldier, STANDING, 1, TRUE ); } else { EVENT_InitNewSoldierAnim( pSoldier, BEING_REPAIRMAN, 1, TRUE ); } }
BOOLEAN CheckOnBoxers( void ) { UINT32 uiLoop; UINT8 ubID; // repick boxer IDs every time if ( gubBoxerID[0] == NOBODY ) { // get boxer soldier IDs! for( uiLoop = 0; uiLoop < NUM_BOXERS; uiLoop++ ) { ubID = WhoIsThere2( gsBoxerGridNo[ uiLoop ], 0 ); // WANNE: Safty check! if (ubID < TOTAL_SOLDIERS) { if ( FindObjClass( MercPtrs[ ubID ], IC_WEAPON ) == NO_SLOT && IS_MERC_BODY_TYPE( MercPtrs[ ubID ] ) ) { // no weapon and not a civilian so this guy is a boxer gubBoxerID[ uiLoop ] = ubID; } } } } if ( gubBoxerID[ 0 ] == NOBODY && gubBoxerID[ 1 ] == NOBODY && gubBoxerID[ 2 ] == NOBODY ) { return( FALSE ); } return( TRUE ); }
void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ) { UINT16 usMapPos; SOLDIERTYPE *pTargetSoldier = NULL, *pSoldier; UINT16 usFlags; INT16 sMouseX, sMouseY, sCellX, sCellY, sScreenX, sScreenY; BOOLEAN fOnGuy = FALSE; LEVELNODE *pNode; pSoldier = MercPtrs[ ubSoldierID ]; if ( gTacticalStatus.ubAttackBusyCount > 0 ) { // ATE: Return if attacker busy count > 0, this // helps in RT with re-setting the flag to random... return; } if ( fRecalc ) { // ALWAYS SET AIM LOCATION TO NOTHING pSoldier->bAimShotLocation = AIM_SHOT_RANDOM; if( !GetMouseMapPos( &usMapPos) ) { return; } // Determine which body part it's on pNode = GetAnimProfileFlags( usMapPos, &usFlags, &pTargetSoldier, NULL ); while( pNode != NULL ) { if ( pTargetSoldier != NULL ) { // ATE: Check their stance - if prone - return! if ( gAnimControl[ pTargetSoldier->usAnimState ].ubHeight == ANIM_PRONE ) { return; } fOnGuy = TRUE; // Check if we have a half tile profile if ( usFlags & TILE_FLAG_NORTH_HALF ) { // Check if we are in north half of tile! GetMouseXYWithRemainder( &sMouseX, &sMouseY, &sCellX, &sCellY ); if ( sCellY > (CELL_Y_SIZE / 2) ) { fOnGuy = FALSE; } } // Check if we have a half tile profile if ( usFlags & TILE_FLAG_SOUTH_HALF ) { // Check if we are in north half of tile! GetMouseXYWithRemainder( &sMouseX, &sMouseY, &sCellX, &sCellY ); if ( sCellY <= (CELL_Y_SIZE / 2) ) { fOnGuy = FALSE; } } // Check if we have a half tile profile if ( usFlags & TILE_FLAG_WEST_HALF ) { // Check if we are in north half of tile! GetMouseXYWithRemainder( &sMouseX, &sMouseY, &sCellX, &sCellY ); if ( sCellX > (CELL_X_SIZE / 2) ) { fOnGuy = FALSE; } } if ( usFlags & TILE_FLAG_EAST_HALF ) { // Check if we are in north half of tile! GetMouseXYWithRemainder( &sMouseX, &sMouseY, &sCellX, &sCellY ); if ( sCellX <= (CELL_X_SIZE / 2) ) { fOnGuy = FALSE; } } if ( usFlags & TILE_FLAG_TOP_HALF ) { // Check if we are in north half of tile! GetMouseXYWithRemainder( &sMouseX, &sMouseY, &sCellX, &sCellY ); // Convert these to screen corrdinates FromCellToScreenCoordinates( sCellX, sCellY, &sScreenX, &sScreenY ); // Check for Below... if ( sScreenX > (WORLD_TILE_Y / 2) ) { fOnGuy = FALSE; } } if ( usFlags & TILE_FLAG_BOTTOM_HALF ) { // Check if we are in north half of tile! GetMouseXYWithRemainder( &sMouseX, &sMouseY, &sCellX, &sCellY ); // Convert these to screen corrdinates FromCellToScreenCoordinates( sCellX, sCellY, &sScreenX, &sScreenY ); // Check for Below... if ( sScreenX <= (WORLD_TILE_Y / 2) ) { fOnGuy = FALSE; } } // Check if mouse is iin bounding box of soldier if ( !IsPointInSoldierBoundingBox( pTargetSoldier, gusMouseXPos, gusMouseYPos ) ) { fOnGuy = FALSE; } } if ( fOnGuy ) break; pNode = GetAnimProfileFlags( usMapPos, &usFlags, &pTargetSoldier, pNode ); } if ( !fOnGuy ) { // Check if we can find a soldier here if ( gfUIFullTargetFound ) { pTargetSoldier = MercPtrs[ gusUIFullTargetID ]; if ( FindRelativeSoldierPosition( pTargetSoldier, &usFlags, gusMouseXPos, gusMouseYPos ) ) { fOnGuy = TRUE; } } } if ( fOnGuy ) { if ( IsValidTargetMerc( pTargetSoldier->ubID ) ) { if ( usFlags & TILE_FLAG_FEET ) { pSoldier->bAimShotLocation = AIM_SHOT_LEGS; } if ( usFlags & TILE_FLAG_MID ) { pSoldier->bAimShotLocation = AIM_SHOT_TORSO; } if ( usFlags & TILE_FLAG_HEAD ) { pSoldier->bAimShotLocation = AIM_SHOT_HEAD; } } } } if ( fDisplay && ( !pSoldier->bDoBurst ) ) { if ( gfUIFullTargetFound ) { pTargetSoldier = MercPtrs[ gusUIFullTargetID ]; if ( pTargetSoldier->ubBodyType == CROW ) { pSoldier->bAimShotLocation = AIM_SHOT_LEGS; wcscpy( gzLocation, TacticalStr[ CROW_HIT_LOCATION_STR ] ); gfUIBodyHitLocation = TRUE; return; } if ( !IS_MERC_BODY_TYPE( pTargetSoldier ) ) { return; } switch( pSoldier->bAimShotLocation ) { case AIM_SHOT_HEAD: // If we have a knife in hand, change string if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_BLADE ) { wcscpy( gzLocation, TacticalStr[ NECK_HIT_LOCATION_STR ] ); } else { wcscpy( gzLocation, TacticalStr[ HEAD_HIT_LOCATION_STR ] ); } gfUIBodyHitLocation = TRUE; break; case AIM_SHOT_TORSO: wcscpy( gzLocation, TacticalStr[ TORSO_HIT_LOCATION_STR ] ); gfUIBodyHitLocation = TRUE; break; case AIM_SHOT_LEGS: wcscpy( gzLocation, TacticalStr[ LEGS_HIT_LOCATION_STR ] ); gfUIBodyHitLocation = TRUE; break; } } } }