Commit Graph
202 Commits
Author SHA1 Message Date
Asdow bd9cbd9944 Migrate +AI features
* Drink canteen
* Jump through window
* Use explosives
* Use wirecutters
2026-01-23 23:19:07 +02:00
Asdow 41945842d5 Migrate features from +AI
Create Scuba fins when in deep water for elites
2026-01-23 18:06:26 +02:00
Asdow 91a1059f87 Migrate features from +AI
Possibly wear gasmask if soldier sees tear or mustard gas
2026-01-23 16:47:34 +02:00
Asdow 3d7d7cc88a Reorganize stuff to improve readability 2026-01-22 00:31:31 +02:00
Asdow 737cd848ce Make water and gas checks const 2026-01-22 00:28:37 +02:00
Asdow 1bead3a0fe Improve readability 2026-01-22 00:27:53 +02:00
Asdow b50ed93f39 Remove armed vehicle check from soldier AI 2026-01-22 00:27:18 +02:00
Asdow 75355f6cac Set DangerousSpot to const 2026-01-22 00:26:48 +02:00
Asdow 2448ccb191 Tweak AI screen messages 2026-01-22 00:26:18 +02:00
Asdow 42215e7a51 Remove magic numbers 2026-01-22 00:25:33 +02:00
Asdow 4ad34f80a9 Fix includes 2026-01-19 22:59:55 +02:00
Asdow 58ea3be2fd Remove MercPtrs[]
SoldierID works without it thanks to operator overload
2026-01-19 22:58:58 +02:00
Asdow 4678cab16f Use correct type 2026-01-19 22:58:33 +02:00
Asdow 52a4959dfb Add optional InOut parameter to ClosestKnownOpponent
distanceInCellCoords will return the distance between pSoldier and closest known opponent. We're often calculating same range after the call using PythSpacesAway and this way it's no longer necessary in most cases.
2026-01-19 22:56:18 +02:00
Asdow e806fd37e7 Add screen messages that display AI decisions 2026-01-19 22:51:38 +02:00
Asdow cd054b549f Split DecideAction into several specialized DecideAction functions
* Removes the need to constantly check for fCivilian, ARMED_VEHICLE, ENEMY_ROBOT etc inside DecideAction
* Move AI decision checks into their own functions, such as DecideActionRadioRedAlert
* Add new entry to ActionType. AI_ACTION_INVALID signals that no valid action was found when a function returns, or no valid action is possible
* Do a weighted random selection for choosing target under DecideActionBlackSoldier
2026-01-19 22:50:27 +02:00
Asdow a46d2dbb96 Add global to selectively log AI status BLACK decisions 2026-01-19 22:31:34 +02:00
Asdow 20dadec54c Merge branch 'master' into decideaction 2026-01-13 00:38:40 +02:00
Asdow f3ce1d5ff9 Fix Tank suppression fire
Code used wrong item to calculate recoil and burst APs causing the burst length loop to be stuck until the whole 2000 round mg magazine would be fired in one go.
2026-01-10 16:38:00 +02:00
Asdow f075963bca Merge branch 'master' into decideaction 2025-12-25 18:58:41 +02:00
Asdow 82aca548f5 Merge branch 'master' into ExtraMercs 2025-09-24 16:14:10 +03:00
BeatAroundTheBuscherandGitHub ed00830202 Fixes Upper/Lower Casing for include paths (#487)
* Fixing upper/lower case for includes

types.h, zconf.h and zlib.h were renamed so that global includes like Types.h
are not used.
2025-08-16 22:01:12 -03:00
Asdow c62d767622 Update to Master 2025-08-08 18:00:31 +03:00
Asdow dd58f904f4 Do not offer surrender for multiplayer 2025-04-24 21:52:11 +03:00
Asdow e3a542bf5d Exclude robots from trying to activate panic triggers 2025-02-14 16:47:03 +02:00
Asdow bfb724eab9 Use SoldierID 2024-12-01 18:23:52 +02:00
Asdow 24656f2810 Use SoldierID 2024-11-30 15:20:18 +02:00
Asdow b74ccf3ddc Convert to SoldierID 2024-11-17 23:45:48 +02:00
Asdow 10250dc035 Merge branch 'master' into ExtraMercs 2024-11-09 13:44:53 +02:00
AsdowandGitHub 49a119e6b9 Convert INVTYPE boolean fields to flagmask (#325)
Rearranged fields from largest to smallest to remove alignment padding
2024-08-22 08:48:29 +03:00
Asdow ab2c5fc10d Add BOXER() & ISVIP() macros 2024-02-18 12:03:43 +02:00
Asdow 67a26e0936 Add more AI logging 2024-02-11 11:21:41 +02:00
Asdow 1a98420160 Remove extraneous check
Allow at least considering throwing smoke for cover even if pSoldier has used some AP from its initial amount.
2024-02-10 18:56:11 +02:00
Asdow 877ec385ee Whitespace changes 2024-02-10 18:50:30 +02:00
Asdow 5c86cf0b07 Attempt to continue moving towards enemy
when in water. If our current or last action was AI_ACTION_SEEK_OPPONENT.

The AI tends to flipflop between jumping into water, swimming a certain distance and then "panic" because they're in the water and then try to reach the closest land tile. Which is often right where they entered the water. Adding a bit of decision momentum with this change should help with that.
2024-02-10 18:12:30 +02:00
Asdow 79372d5d23 Try to find a cover spot when advancing to attack
Calling InternalGoAsFarAsPossibleTowards() with target's gridno means AI doesn't take into account eg. nearby friendlies resulting in them bunching up and  making a beeline straight at whoever they're trying to attack.
We'll first at least attempt to find a cover spot near said target, if it doesn't work, only then head straight at them.
2024-02-04 21:05:54 +02:00
Asdow 0ed68b6214 Set functions to static 2024-02-04 16:17:36 +02:00
Asdow f646bc2bfa Set correct next action if npc has no AP
With aiData.bAction = AI_ACTION_NONE and aiData.bNextAction = AI_ACTION_END_TURN, the npc turn is correctly ended in the next call to TurnBasedHandleNPCAI()
2024-02-04 16:14:01 +02:00
Asdow f249406ba0 Allow specific alert status AI logging
Less clutter in the AI logs if, for example one is only interested in BLACK status decisions
2024-02-04 15:29:05 +02:00
Asdow ffb95a2418 Remove unused variable from if checks
aiData.bRTPCombat is never initialized and is always 0 when valid values should be

#define RTP_COMBAT_AGGRESSIVE		1
#define RTP_COMBAT_CONSERVE			2
#define RTP_COMBAT_REFRAIN			3
2024-02-03 20:49:43 +02:00
Asdow 22f2c9ff9a Correct AP check
We can't do anything with negative action points either.
2024-02-02 01:00:12 +02:00
Asdow a90e11619d Merge branch 'master' into decideaction 2023-10-10 23:21:12 +03:00
AsdowandGitHub b8a870df02 Reduce code duplication (#233)
* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Add direction utility function

We have a lot of places in the code that calculate direction based on center cell coordinates, but lack a utility function for it similar to other direction methods.

* Use utility function for calculating direction

* Use ConvertGridNoToCenterCellXY

* Use utility function for direction

* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Remove CenterX & CenterY functions

Use ConvertGridNoToCenterCellXY instead

* Remove CenterX & CenterY calls from UB configuration

* Address review feedback

* Remove duplicate function

ConvertGridNoToCenterCellXY and ConvertMapPosToWorldTileCenter do the exact same thing

* Use PythSpacesAway instead of GetRangeFromGridNoDiff

Both functions calculate the same thing

* Remove GetRangeFromGridNoDiff

* Remove calls to abs()

The values end up being squared anyways making these unnecessary
2023-10-07 15:14:15 +03:00
Asdow 1586e8fd2b Allow possibly taking cover without full APs 2023-10-02 22:28:56 +03:00
Asdow a45f3ae319 Add more AI logging 2023-08-20 23:38:56 +03:00
Asdow 318e4a40cf Improve AI logging 2023-08-19 23:23:59 +03:00
Asdow 1170f82159 Move variable declarations to point of initialization 2023-08-19 21:47:31 +03:00
Asdow d28ed97dff Add section comments do DecideActionRed 2023-08-19 21:45:01 +03:00
Asdow 96a7fa0538 Add section comments to DecideActionBlack 2023-08-19 14:41:16 +03:00
Asdow c5d1615035 Move decision if stuck in water or gas into its own function 2023-08-19 14:39:33 +03:00