mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
New feature: interactive actions allow various actions (hacking/reading/drinking/...) from user-defined xml acttions. The exact results can be set in a lua function.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23144&goto=346447&#msg_346447 This is fully savegame compatible. GameDir >= r2333 is required. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8278 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+43
-7
@@ -57,6 +57,7 @@ UINT8 HandleTinCanCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorF
|
||||
UINT8 HandleFortificationCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorFlags ); //added by Flugente
|
||||
UINT8 HandleHandcuffCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorFlags ); //added by Flugente
|
||||
UINT8 HandleApplyItemCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorFlags ); //added by Flugente
|
||||
UINT8 HandleHackCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorFlags ); //added by Flugente
|
||||
|
||||
extern BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTargetSoldier, INT32 sTargetGridNo , INT8 bLevel );
|
||||
|
||||
@@ -323,11 +324,13 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos
|
||||
ubCursorID = HandleApplyItemCursor( pSoldier, sTargetGridNo, uiCursorFlags );
|
||||
break;
|
||||
|
||||
case INVALIDCURS:
|
||||
|
||||
ubCursorID = INVALID_ACTION_UICURSOR;
|
||||
case INTERACTIVEACTIONCURS:
|
||||
ubCursorID = HandleHackCursor( pSoldier, sTargetGridNo, uiCursorFlags );
|
||||
break;
|
||||
|
||||
case INVALIDCURS:
|
||||
ubCursorID = INVALID_ACTION_UICURSOR;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !( gTacticalStatus.uiFlags & INCOMBAT ) )
|
||||
@@ -341,12 +344,10 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos
|
||||
PauseRT( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return( ubCursorID );
|
||||
}
|
||||
|
||||
|
||||
// WANNE: Shows the target cursor over the enemy soldier
|
||||
UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEAN fShowAPs, BOOLEAN fRecalc, UINT32 uiCursorFlags )
|
||||
{
|
||||
@@ -2276,6 +2277,27 @@ UINT8 HandleApplyItemCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCurs
|
||||
return( APPLYITEM_RED_UICURSOR );
|
||||
}
|
||||
|
||||
UINT8 HandleHackCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorFlags )
|
||||
{
|
||||
// DRAW PATH TO GUY
|
||||
HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_INTERACTIVEACTION );
|
||||
|
||||
UINT16 structindex;
|
||||
UINT16 possibleaction = InteractiveActionPossibleAtGridNo( sGridNo, pSoldier->pathing.bLevel, structindex );
|
||||
UINT16 skill = pSoldier->GetInteractiveActionSkill( sGridNo, pSoldier->pathing.bLevel, possibleaction );
|
||||
|
||||
if ( possibleaction == INTERACTIVE_STRUCTURE_HACKABLE )
|
||||
return skill ? HACK_GREY_UICURSOR : HACK_RED_UICURSOR;
|
||||
else if ( possibleaction == INTERACTIVE_STRUCTURE_READFILE )
|
||||
return skill ? READFILE_GREY_UICURSOR : READFILE_RED_UICURSOR;
|
||||
else if ( possibleaction == INTERACTIVE_STRUCTURE_WATERTAP )
|
||||
return skill ? WATERTAP_GREY_UICURSOR : WATERTAP_RED_UICURSOR;
|
||||
else if ( possibleaction == INTERACTIVE_STRUCTURE_SODAMACHINE )
|
||||
return skill ? SODAMACHINE_GREY_UICURSOR : SODAMACHINE_RED_UICURSOR;
|
||||
|
||||
return NO_UICURSOR;
|
||||
}
|
||||
|
||||
void HandleEndConfirmCursor( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
UINT16 usInHand;
|
||||
@@ -2784,7 +2806,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier )
|
||||
else
|
||||
return ( TRAJECTORYCURS );
|
||||
}
|
||||
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || ( pSoldier->bWeaponMode == WM_AUTOFIRE && Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) )
|
||||
else if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || ( pSoldier->bWeaponMode == WM_AUTOFIRE && Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) )
|
||||
{
|
||||
if ( gGameSettings.fOptions [ TOPTION_GL_BURST_CURSOR ] )
|
||||
return( TARGETCURS );
|
||||
@@ -2823,6 +2845,20 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier )
|
||||
if ( gGameExternalOptions.fAllowPrisonerSystem && HasItemFlag(usInHand, HANDCUFFS) )
|
||||
ubCursor = HANDCUFFCURS;
|
||||
|
||||
// Flugente: interactive actions
|
||||
// we only check whether an action is possible in principle, not whether this particular guy can do it. That way we know an action is possible here even if we can't perform it at the moment.
|
||||
// only do this if the item doesn't already allow us to do something else
|
||||
if ( ubCursor == INVALIDCURS || usInHand == NONE )
|
||||
{
|
||||
INT32 usMapPos = NOWHERE;
|
||||
GetMouseMapPos( &usMapPos );
|
||||
|
||||
UINT16 structindex;
|
||||
UINT16 possibleaction = InteractiveActionPossibleAtGridNo( usMapPos, pSoldier->pathing.bLevel, structindex );
|
||||
if ( possibleaction > INTERACTIVE_STRUCTURE_NO_ACTION )
|
||||
ubCursor = INTERACTIVEACTIONCURS;
|
||||
}
|
||||
|
||||
// Flugente: apply misc items to other soldiers
|
||||
if ( ItemCanBeAppliedToOthers( usInHand ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user