UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos , BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) { UINT16 usInHand; usInHand = pSoldier->inv[ HANDPOS ].usItem; if ( Item[ usInHand ].usItemClass != IC_THROWING_KNIFE ) { if (( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { //DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, FALSE, fRecalc ); DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, fShowAPs, fRecalc ); if ( pSoldier->fReloading || pSoldier->fPauseAim ) { return( ACTION_TARGET_RELOADING ); } } // Check for enough ammo... if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) ) { // Check if ANY ammo exists..... if ( FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ) == NO_SLOT ) { // OK, use BAD reload cursor..... return( BAD_RELOAD_UICURSOR ); } else { // Check APs to reload... gsCurrentActionPoints = GetAPsToAutoReload( pSoldier ); gfUIDisplayActionPoints = TRUE; //gUIDisplayActionPointsOffX = 14; //gUIDisplayActionPointsOffY = 7; // OK, use GOOD reload cursor..... return( GOOD_RELOAD_UICURSOR ); } } } if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) ) { DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, fShowAPs, fRecalc ); gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->bShownAimTime / 2) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; if ( fShowAPs ) { if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0 , FALSE ) ) { gfUIDisplayActionPointsInvalid = TRUE; } } else { //gfUIDisplayActionPointsBlack = TRUE; gfUIDisplayActionPoints = FALSE; } } //if ( gTacticalStatus.uiFlags & TURNBASED && !(gTacticalStatus.uiFlags & INCOMBAT ) ) { if ( fRecalc ) { if ( SoldierToLocationChanceToGetThrough( pSoldier, usMapPos, (INT8) gsInterfaceLevel, pSoldier->bTargetCubeLevel, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) { gfCannotGetThrough = TRUE; } else { gfCannotGetThrough = FALSE; } } // OK, if we begin to move, reset the cursor... if ( uiCursorFlags & MOUSE_MOVING ) { gfCannotGetThrough = FALSE; } if ( gfCannotGetThrough ) { if ( pSoldier->bDoBurst ) { return( ACTION_NOCHANCE_BURST_UICURSOR ); } else if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { return( BAD_THROW_UICURSOR ); } else { return( ACTION_NOCHANCE_SHOOT_UICURSOR ); } } } // Determine if good range if ( !InRange( pSoldier, usMapPos ) ) { // Flash cursor! // Check if we're in burst mode! if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { return( FLASH_THROW_UICURSOR ); } else if ( pSoldier->bDoBurst ) { //return( ACTION_FIRSTAID_RED ); return( ACTION_FLASH_BURST_UICURSOR ); } else { //return( ACTION_FIRSTAID_RED ); return( ACTION_FLASH_SHOOT_UICURSOR ); } } else { // Check if we're in burst mode! if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { return( GOOD_THROW_UICURSOR ); } else if ( pSoldier->bDoBurst ) { //return( ACTION_FIRSTAID_RED ); return( ACTION_TARGETBURST_UICURSOR ); } else { //return( ACTION_FIRSTAID_RED ); return( ACTION_SHOOT_UICURSOR ); } } }
UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, UINT16 usMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags ) { UINT8 switchVal; BOOLEAN fEnoughPoints = TRUE; UINT8 bFutureAim; INT16 sAPCosts; UINT16 usCursor=0; BOOLEAN fMaxPointLimitHit = FALSE; UINT16 usInHand; usInHand = pSoldier->inv[ HANDPOS ].usItem; if ( Item[ usInHand ].usItemClass != IC_THROWING_KNIFE ) { // If we are in realtime, follow! if ( ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { if ( ( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) ) { if ( gUITargetShotWaiting ) { guiPendingOverrideEvent = CA_MERC_SHOOT; } } //SoldierFollowGridNo( pSoldier, usMapPos ); } // Check if we are reloading if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { if ( pSoldier->fReloading || pSoldier->fPauseAim ) { return( ACTION_TARGET_RELOADING ); } } } // Determine where we are shooting / aiming //if ( fRecalc ) { DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, TRUE, TRUE ); } if ( gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->bShownAimTime / 2) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; // If we don't have any points and we are at the first refine, do nothing but warn! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0 , FALSE ) ) { gfUIDisplayActionPointsInvalid = TRUE; fMaxPointLimitHit = TRUE; } else { bFutureAim = (INT8)( pSoldier->bShownAimTime + 2 ); if ( bFutureAim <= REFINE_AIM_5 ) { sAPCosts = MinAPsToAttack( pSoldier, usMapPos, TRUE ) + ( bFutureAim / 2 ); // Determine if we can afford! if ( !EnoughPoints( pSoldier, (INT16)sAPCosts, 0 , FALSE ) ) { fEnoughPoints = FALSE; } } } } if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { if ( !pSoldier->fPauseAim ) { if ( COUNTERDONE( TARGETREFINE ) ) { // Reset counter RESETCOUNTER( TARGETREFINE ); if ( pSoldier->bDoBurst ) { pSoldier->bShownAimTime = REFINE_AIM_BURST; } else { pSoldier->bShownAimTime++; if ( pSoldier->bShownAimTime > REFINE_AIM_5 ) { pSoldier->bShownAimTime = REFINE_AIM_5; } else { if ( pSoldier->bShownAimTime % 2 ) { PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); } } } } } } if ( fRecalc ) { if ( gusUIFullTargetID != NOBODY ) { if ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, MercPtrs[ gusUIFullTargetID ], pSoldier->bAimShotLocation ) < OK_CHANCE_TO_GET_THROUGH ) { gfCannotGetThrough = TRUE; } else { gfCannotGetThrough = FALSE; } } else { if ( SoldierToLocationChanceToGetThrough( pSoldier, usMapPos, (INT8) gsInterfaceLevel, pSoldier->bTargetCubeLevel, NOBODY ) < OK_CHANCE_TO_GET_THROUGH ) { gfCannotGetThrough = TRUE; } else { gfCannotGetThrough = FALSE; } } } // OK, if we begin to move, reset the cursor... if ( uiCursorFlags & MOUSE_MOVING ) { //gfCannotGetThrough = FALSE; } if ( fMaxPointLimitHit ) { // Check if we're in burst mode! if ( pSoldier->bDoBurst ) { usCursor = ACTION_TARGETREDBURST_UICURSOR; } else if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { usCursor = RED_THROW_UICURSOR; } else { usCursor = ACTION_TARGETRED_UICURSOR; } } else if ( pSoldier->bDoBurst ) { if ( pSoldier->fDoSpread ) { usCursor = ACTION_TARGETREDBURST_UICURSOR; } else { usCursor = ACTION_TARGETCONFIRMBURST_UICURSOR; } } else { // IF we are in turnbased, half the shown time values if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) { switchVal = pSoldier->bShownAimTime; } else { switchVal = pSoldier->bShownAimTime; } switch( switchVal ) { case REFINE_AIM_1: if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) { usCursor = ACTION_THROWAIMYELLOW1_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_THROWAIM1_UICURSOR; } else { usCursor = ACTION_THROWAIMCANT1_UICURSOR; } } else { if ( gfDisplayFullCountRing ) { usCursor = ACTION_TARGETAIMYELLOW1_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_TARGETAIM1_UICURSOR; } else { usCursor = ACTION_TARGETAIMCANT1_UICURSOR; } } break; case REFINE_AIM_2: if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) { usCursor = ACTION_THROWAIMYELLOW2_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_THROWAIM3_UICURSOR; } else { usCursor = ACTION_THROWAIMCANT2_UICURSOR; } } else { if ( gfDisplayFullCountRing ) { usCursor = ACTION_TARGETAIMYELLOW2_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_TARGETAIM3_UICURSOR; } else { usCursor = ACTION_TARGETAIMCANT2_UICURSOR; } } break; case REFINE_AIM_3: if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) { usCursor = ACTION_THROWAIMYELLOW3_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_THROWAIM5_UICURSOR; } else { usCursor = ACTION_THROWAIMCANT3_UICURSOR; } } else { if ( gfDisplayFullCountRing ) { usCursor = ACTION_TARGETAIMYELLOW3_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_TARGETAIM5_UICURSOR; } else { usCursor = ACTION_TARGETAIMCANT3_UICURSOR; } } break; case REFINE_AIM_4: if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) { usCursor = ACTION_THROWAIMYELLOW4_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_THROWAIM7_UICURSOR; } else { usCursor = ACTION_THROWAIMCANT4_UICURSOR; } } else { if ( gfDisplayFullCountRing ) { usCursor = ACTION_TARGETAIMYELLOW4_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_TARGETAIM7_UICURSOR; } else { usCursor = ACTION_TARGETAIMCANT4_UICURSOR; } } break; case REFINE_AIM_5: if ( Item[ usInHand ].usItemClass == IC_THROWING_KNIFE ) { if ( gfDisplayFullCountRing ) { usCursor = ACTION_THROWAIMFULL_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_THROWAIM9_UICURSOR; } else { usCursor = ACTION_THROWAIMCANT5_UICURSOR; } } else { if ( gfDisplayFullCountRing ) { usCursor = ACTION_TARGETAIMFULL_UICURSOR; } else if ( fEnoughPoints ) { usCursor = ACTION_TARGETAIM9_UICURSOR; } else { usCursor = ACTION_TARGETAIMCANT5_UICURSOR; } } break; case REFINE_AIM_MID1: usCursor = ACTION_TARGETAIM2_UICURSOR; break; case REFINE_AIM_MID2: usCursor = ACTION_TARGETAIM4_UICURSOR; break; case REFINE_AIM_MID3: usCursor = ACTION_TARGETAIM6_UICURSOR; break; case REFINE_AIM_MID4: usCursor = ACTION_TARGETAIM8_UICURSOR; break; } } if ( !fMaxPointLimitHit ) { // Remove flash flag! RemoveCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_FLASH ); RemoveCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_PLAY_SOUND ); if ( gfCannotGetThrough ) { SetCursorSpecialFrame( gUICursors[ usCursor ].usFreeCursorName, 1 ); } else { if ( !InRange( pSoldier, usMapPos ) ) { // OK, make buddy flash! SetCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_FLASH ); SetCursorFlags( gUICursors[ usCursor ].usFreeCursorName, CURSOR_TO_PLAY_SOUND ); } else { SetCursorSpecialFrame( gUICursors[ usCursor ].usFreeCursorName, 0 ); } } } return( (UINT8)usCursor ); }
void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT16 usMapPos ) { UINT16 usInHand; INT16 sAPCosts; INT8 bFutureAim; UINT8 ubCursor; SOLDIERTYPE *pTSoldier; INT16 sGridNo; INT8 bTargetLevel; usInHand = pSoldier->inv[HANDPOS].usItem; ubCursor = GetActionModeCursor( pSoldier ); // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) { usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; } switch( ubCursor ) { case TARGETCURS: // CHECK IF GUY HAS IN HAND A WEAPON if ( pSoldier->bDoBurst ) { // Do nothing! // pSoldier->bShownAimTime = REFINE_AIM_BURST; } else { sGridNo = usMapPos; bTargetLevel = (INT8)gsInterfaceLevel; // Look for a target here... if ( gfUIFullTargetFound ) { // Get target soldier, if one exists pTSoldier = MercPtrs[ gusUIFullTargetID ]; sGridNo = pTSoldier->sGridNo; bTargetLevel = pSoldier->bLevel; if ( !HandleCheckForBadChangeToGetThrough( pSoldier, pTSoldier, sGridNo , bTargetLevel ) ) { return; } } bFutureAim = (INT8)( pSoldier->bShownAimTime + 2 ); if ( bFutureAim <= REFINE_AIM_5 ) { sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) ); // Determine if we can afford! if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) ) { pSoldier->bShownAimTime+= 2; if ( pSoldier->bShownAimTime > REFINE_AIM_5 ) { pSoldier->bShownAimTime = REFINE_AIM_5; } } // Else - goto first level! else { if ( !gfDisplayFullCountRing ) { gfDisplayFullCountRing = TRUE; } else { pSoldier->bShownAimTime = REFINE_AIM_1; gfDisplayFullCountRing = FALSE; } } } else { if ( !gfDisplayFullCountRing ) { gfDisplayFullCountRing = TRUE; } else { pSoldier->bShownAimTime = REFINE_AIM_1; gfDisplayFullCountRing = FALSE; } } } break; case PUNCHCURS: bFutureAim = (INT8)( pSoldier->bShownAimTime + REFINE_PUNCH_2 ); if ( bFutureAim <= REFINE_PUNCH_2 ) { sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) ); // Determine if we can afford! if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) ) { pSoldier->bShownAimTime+= REFINE_PUNCH_2; if ( pSoldier->bShownAimTime > REFINE_PUNCH_2 ) { pSoldier->bShownAimTime = REFINE_PUNCH_2; } } // Else - goto first level! else { if ( !gfDisplayFullCountRing ) { gfDisplayFullCountRing = TRUE; } else { pSoldier->bShownAimTime = REFINE_PUNCH_1; gfDisplayFullCountRing = FALSE; } } } else { if ( !gfDisplayFullCountRing ) { gfDisplayFullCountRing = TRUE; } else { pSoldier->bShownAimTime = REFINE_PUNCH_1; gfDisplayFullCountRing = FALSE; } } break; case KNIFECURS: bFutureAim = (INT8)( pSoldier->bShownAimTime + REFINE_KNIFE_2 ); if ( bFutureAim <= REFINE_KNIFE_2 ) { sAPCosts = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(bFutureAim / 2) ); // Determine if we can afford! if ( EnoughPoints( pSoldier, sAPCosts, 0, FALSE ) ) { pSoldier->bShownAimTime+= REFINE_KNIFE_2; if ( pSoldier->bShownAimTime > REFINE_KNIFE_2 ) { pSoldier->bShownAimTime = REFINE_KNIFE_2; } } // Else - goto first level! else { if ( !gfDisplayFullCountRing ) { gfDisplayFullCountRing = TRUE; } else { pSoldier->bShownAimTime = REFINE_KNIFE_1; gfDisplayFullCountRing = FALSE; } } } else { if ( !gfDisplayFullCountRing ) { gfDisplayFullCountRing = TRUE; } else { pSoldier->bShownAimTime = REFINE_KNIFE_1; gfDisplayFullCountRing = FALSE; } } break; case TOSSCURS: //IncrementAimCubeUI( ); break; default: ErasePath( TRUE ); } }
UINT8 HandleNonActivatedTossCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fRecalc, UINT32 uiCursorFlags, UINT8 ubItemCursor ) { INT16 sFinalGridNo; static BOOLEAN fBadCTGH = FALSE; BOOLEAN fArmed = FALSE; INT8 bLevel; OBJECTTYPE TempObject; INT8 bSlot; OBJECTTYPE * pObj; INT8 bAttachPos; // Check for enough ammo... if ( ubItemCursor == TRAJECTORYCURS ) { fArmed = TRUE; if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) ) { // Check if ANY ammo exists..... if ( FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ) == NO_SLOT ) { // OK, use BAD reload cursor..... return( BAD_RELOAD_UICURSOR ); } else { // Check APs to reload... gsCurrentActionPoints = GetAPsToAutoReload( pSoldier ); gfUIDisplayActionPoints = TRUE; //gUIDisplayActionPointsOffX = 14; //gUIDisplayActionPointsOffY = 7; // OK, use GOOD reload cursor..... return( GOOD_RELOAD_UICURSOR ); } } } // Add APs.... if ( gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { if ( ubItemCursor == TRAJECTORYCURS ) { gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->bShownAimTime / 2) ); } else { gsCurrentActionPoints = MinAPsToThrow( pSoldier, sGridNo, TRUE ); } gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; // If we don't have any points and we are at the first refine, do nothing but warn! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0 , FALSE ) ) { gfUIDisplayActionPointsInvalid = TRUE; } } // OK, if we begin to move, reset the cursor... if ( uiCursorFlags & MOUSE_MOVING ) { EndPhysicsTrajectoryUI( ); } gfUIHandlePhysicsTrajectory = TRUE; if ( fRecalc ) { // Calculate chance to throw here..... if ( sGridNo == pSoldier->sGridNo ) { fBadCTGH = FALSE; } else { // ATE: Find the object to use... memcpy( &TempObject, &(pSoldier->inv[ HANDPOS ] ), sizeof( OBJECTTYPE ) ); // Do we have a launcable? pObj = &(pSoldier->inv[HANDPOS]); for (bAttachPos = 0; bAttachPos < MAX_ATTACHMENTS; bAttachPos++) { if (pObj->usAttachItem[ bAttachPos ] != NOTHING) { if ( Item[ pObj->usAttachItem[ bAttachPos ] ].usItemClass & IC_EXPLOSV ) { break; } } } if (bAttachPos != MAX_ATTACHMENTS) { CreateItem( pObj->usAttachItem[ bAttachPos ], pObj->bAttachStatus[ bAttachPos ], &TempObject ); } if (pSoldier->bWeaponMode == WM_ATTACHED && FindAttachment( &(pSoldier->inv[HANDPOS]), UNDER_GLAUNCHER ) != NO_SLOT ) { bSlot = FindAttachment( &(pSoldier->inv[HANDPOS]), UNDER_GLAUNCHER ); if ( bSlot != NO_SLOT ) { CreateItem( UNDER_GLAUNCHER, pSoldier->inv[HANDPOS].bAttachStatus[ bSlot ], &TempObject ); if ( !CalculateLaunchItemChanceToGetThrough( pSoldier, &TempObject, sGridNo, (INT8)gsInterfaceLevel, (INT16)( gsInterfaceLevel * 256 ), &sFinalGridNo, fArmed, &bLevel, TRUE ) ) { fBadCTGH = TRUE; } else { fBadCTGH = FALSE; } BeginPhysicsTrajectoryUI( sFinalGridNo, bLevel, fBadCTGH ); } } else { if ( !CalculateLaunchItemChanceToGetThrough( pSoldier, &TempObject, sGridNo, (INT8)gsInterfaceLevel, (INT16)( gsInterfaceLevel * 256 ), &sFinalGridNo, fArmed, &bLevel, TRUE ) ) { fBadCTGH = TRUE; } else { fBadCTGH = FALSE; } BeginPhysicsTrajectoryUI( sFinalGridNo, bLevel, fBadCTGH ); } } } if ( fBadCTGH ) { return( BAD_THROW_UICURSOR ); } return( GOOD_THROW_UICURSOR ); }
UINT8 HandlePunchCursor( SOLDIERTYPE *pSoldier, UINT16 sGridNo, BOOLEAN fActivated, UINT32 uiCursorFlags ) { INT16 sAPCosts; INT8 bFutureAim; BOOLEAN fEnoughPoints = TRUE; // DRAW PATH TO GUY HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_MERCS ); if ( fActivated ) { DetermineCursorBodyLocation( pSoldier->ubID, TRUE, TRUE ); if ( gfUIHandleShowMoveGrid ) { gfUIHandleShowMoveGrid = 2; } // Calculate action points if ( gTacticalStatus.uiFlags & TURNBASED ) { gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(pSoldier->bShownAimTime / 2) ); gfUIDisplayActionPoints = TRUE; gfUIDisplayActionPointsCenter = TRUE; // If we don't have any points and we are at the first refine, do nothing but warn! if ( !EnoughPoints( pSoldier, gsCurrentActionPoints, 0 , FALSE ) ) { gfUIDisplayActionPointsInvalid = TRUE; if ( pSoldier->bShownAimTime == REFINE_PUNCH_1 ) { return( ACTION_PUNCH_RED ); } } bFutureAim = (INT8)( REFINE_PUNCH_2 ); sAPCosts = CalcTotalAPsToAttack( pSoldier, sGridNo, TRUE, (INT8)(bFutureAim / 2) ); // Determine if we can afford! if ( !EnoughPoints( pSoldier, (INT16)sAPCosts, 0 , FALSE ) ) { fEnoughPoints = FALSE; } } if ( ( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { if ( !pSoldier->fPauseAim ) { if ( COUNTERDONE( NONGUNTARGETREFINE ) ) { // Reset counter RESETCOUNTER( NONGUNTARGETREFINE ); if ( pSoldier->bShownAimTime == REFINE_PUNCH_1 ) { PlayJA2Sample( TARG_REFINE_BEEP, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); } pSoldier->bShownAimTime = REFINE_PUNCH_2; } } } switch( pSoldier->bShownAimTime ) { case REFINE_PUNCH_1: if ( gfDisplayFullCountRing ) { return( ACTION_PUNCH_YELLOW_AIM1_UICURSOR ); } else if ( fEnoughPoints ) { return( ACTION_PUNCH_RED_AIM1_UICURSOR ); } else { return( ACTION_PUNCH_NOGO_AIM1_UICURSOR ); } break; case REFINE_PUNCH_2: if ( gfDisplayFullCountRing ) { return( ACTION_PUNCH_YELLOW_AIM2_UICURSOR ); } else if ( fEnoughPoints ) { return( ACTION_PUNCH_RED_AIM2_UICURSOR ); } else { return( ACTION_PUNCH_NOGO_AIM2_UICURSOR ); } break; default: Assert( FALSE ); // no return value! return(0); break; } } else { gfUIDisplayActionPointsCenter = TRUE; // CHECK IF WE ARE ON A GUY ( THAT'S NOT SELECTED )! if ( gfUIFullTargetFound && !( guiUIFullTargetFlags & SELECTED_MERC ) ) { DetermineCursorBodyLocation( pSoldier->ubID, TRUE, TRUE ); return( ACTION_PUNCH_RED ); } else { return( ACTION_PUNCH_GRAY ); } } }
BOOLEAN AddUIPlan( UINT16 sGridNo, UINT8 ubPlanID ) { SOLDIERTYPE *pPlanSoldier; INT16 sXPos, sYPos; INT16 sAPCost = 0; INT8 bDirection; INT32 iLoop; SOLDIERCREATE_STRUCT MercCreateStruct; UINT8 ubNewIndex; // Depeding on stance and direction facing, add guy! // If we have a planned action here, ignore! // If not OK Dest, ignore! if ( !NewOKDestination( gpUIPlannedSoldier, sGridNo, FALSE, (INT8)gsInterfaceLevel ) ) { return( FALSE ); } if ( ubPlanID == UIPLAN_ACTION_MOVETO ) { // Calculate cost to move here sAPCost = PlotPath( gpUIPlannedSoldier, sGridNo, COPYROUTE, NO_PLOT, TEMPORARY, (UINT16) gpUIPlannedSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, gpUIPlannedSoldier->bActionPoints ); // Adjust for running if we are not already running if ( gpUIPlannedSoldier->usUIMovementMode == RUNNING ) { sAPCost += AP_START_RUN_COST; } if ( EnoughPoints( gpUIPlannedSoldier, sAPCost, 0, FALSE ) ) { memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fPlayerPlan = TRUE; MercCreateStruct.bBodyType = gpUIPlannedSoldier->ubBodyType; MercCreateStruct.sInsertionGridNo = sGridNo; // Get Grid Corrdinates of mouse if ( TacticalCreateSoldier( &MercCreateStruct, &ubNewIndex ) ) { // Get pointer to soldier GetSoldier( &pPlanSoldier, (UINT16)ubNewIndex ); pPlanSoldier->sPlannedTargetX = -1; pPlanSoldier->sPlannedTargetY = -1; // Compare OPPLISTS! // Set ones we don't know about but do now back to old ( ie no new guys ) for (iLoop = 0; iLoop < MAX_NUM_SOLDIERS; iLoop++ ) { if ( gpUIPlannedSoldier->bOppList[ iLoop ] < 0 ) { pPlanSoldier->bOppList[ iLoop ] = gpUIPlannedSoldier->bOppList[ iLoop ]; } } // Get XY from Gridno ConvertGridNoToCenterCellXY( sGridNo, &sXPos, &sYPos ); EVENT_SetSoldierPosition( pPlanSoldier, sXPos, sYPos ); EVENT_SetSoldierDestination( pPlanSoldier, sGridNo ); pPlanSoldier->bVisible = 1; pPlanSoldier->usUIMovementMode = gpUIPlannedSoldier->usUIMovementMode; pPlanSoldier->bActionPoints = gpUIPlannedSoldier->bActionPoints - sAPCost; pPlanSoldier->ubPlannedUIAPCost = (UINT8)pPlanSoldier->bActionPoints; // Get direction bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ]; // Set direction pPlanSoldier->bDirection = bDirection; pPlanSoldier->bDesiredDirection = bDirection; // Set walking animation ChangeSoldierState( pPlanSoldier, pPlanSoldier->usUIMovementMode, 0, FALSE ); // Change selected soldier gusSelectedSoldier = (UINT16)pPlanSoldier->ubID; // Change global planned mode to this guy! gpUIPlannedSoldier = pPlanSoldier; gubNumUIPlannedMoves++; gfPlotNewMovement = TRUE; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Adding Merc Move to Plan" ); } } else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Merc will not have enough action points" ); } } else if ( ubPlanID == UIPLAN_ACTION_FIRE ) { sAPCost = CalcTotalAPsToAttack( gpUIPlannedSoldier, sGridNo, TRUE, (INT8)(gpUIPlannedSoldier->bShownAimTime /2) ); // Get XY from Gridno ConvertGridNoToCenterCellXY( sGridNo, &sXPos, &sYPos ); // If this is a player guy, show message about no APS if ( EnoughPoints( gpUIPlannedSoldier, sAPCost, 0, FALSE ) ) { // CHECK IF WE ARE A PLANNED SOLDIER OR NOT< IF SO< CREATE! if ( gpUIPlannedSoldier->ubID < MAX_NUM_SOLDIERS ) { memset( &MercCreateStruct, 0, sizeof( MercCreateStruct ) ); MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.fPlayerPlan = TRUE; MercCreateStruct.bBodyType = gpUIPlannedSoldier->ubBodyType; MercCreateStruct.sInsertionGridNo = sGridNo; // Get Grid Corrdinates of mouse if ( TacticalCreateSoldier( &MercCreateStruct, &ubNewIndex ) ) { // Get pointer to soldier GetSoldier( &pPlanSoldier, (UINT16)ubNewIndex ); pPlanSoldier->sPlannedTargetX = -1; pPlanSoldier->sPlannedTargetY = -1; // Compare OPPLISTS! // Set ones we don't know about but do now back to old ( ie no new guys ) for (iLoop = 0; iLoop < MAX_NUM_SOLDIERS; iLoop++ ) { if ( gpUIPlannedSoldier->bOppList[ iLoop ] < 0 ) { pPlanSoldier->bOppList[ iLoop ] = gpUIPlannedSoldier->bOppList[ iLoop ]; } } EVENT_SetSoldierPosition( pPlanSoldier, gpUIPlannedSoldier->dXPos, gpUIPlannedSoldier->dYPos ); EVENT_SetSoldierDestination( pPlanSoldier, gpUIPlannedSoldier->sGridNo ); pPlanSoldier->bVisible = 1; pPlanSoldier->usUIMovementMode = gpUIPlannedSoldier->usUIMovementMode; pPlanSoldier->bActionPoints = gpUIPlannedSoldier->bActionPoints - sAPCost; pPlanSoldier->ubPlannedUIAPCost = (UINT8)pPlanSoldier->bActionPoints; // Get direction bDirection = (INT8)gpUIPlannedSoldier->usPathingData[ gpUIPlannedSoldier->usPathDataSize - 1 ]; // Set direction pPlanSoldier->bDirection = bDirection; pPlanSoldier->bDesiredDirection = bDirection; // Set walking animation ChangeSoldierState( pPlanSoldier, pPlanSoldier->usUIMovementMode, 0, FALSE ); // Change selected soldier gusSelectedSoldier = (UINT16)pPlanSoldier->ubID; // Change global planned mode to this guy! gpUIPlannedSoldier = pPlanSoldier; gubNumUIPlannedMoves++; } } gpUIPlannedSoldier->bActionPoints = gpUIPlannedSoldier->bActionPoints - sAPCost; gpUIPlannedSoldier->ubPlannedUIAPCost = (UINT8)gpUIPlannedSoldier->bActionPoints; // Get direction from gridno bDirection = (INT8)GetDirectionFromGridNo( sGridNo, gpUIPlannedSoldier ); // Set direction gpUIPlannedSoldier->bDirection = bDirection; gpUIPlannedSoldier->bDesiredDirection = bDirection; // Set to shooting animation SelectPausedFireAnimation( gpUIPlannedSoldier ); gpUIPlannedSoldier->sPlannedTargetX = sXPos; gpUIPlannedSoldier->sPlannedTargetY = sYPos; ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Adding Merc Shoot to Plan" ); } else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Merc will not have enough action points" ); } } return( TRUE ); }