121 Commits
Author SHA1 Message Date
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 fd9611ae04 Remove compiler warnings 2025-08-08 18:38:53 +03:00
Asdow bfb724eab9 Use SoldierID 2024-12-01 18:23:52 +02:00
Asdow 66bd1e41c2 Correct loops 2024-11-18 18:27:14 +02:00
Asdow b74ccf3ddc Convert to SoldierID 2024-11-17 23:45:48 +02:00
Asdow b9641d4c90 Convert to SoldierID 2024-11-17 20:52:12 +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
AsdowandGitHub 4338b5b909 Fix AI tactical retreat (#282)
Only perform tactical traversal if pSoldier is at the map edge
2024-02-11 12:42:21 +02:00
AsdowandGitHub 0910dba472 Revert "Disable AI logging by default" (#270)
This reverts commit 5a74323d1f.
2024-01-30 11:44:00 +02:00
Asdow 2697a17010 Check if pSoldier is null
Prevent nullptr dereference in AI logging function
2024-01-28 11:16:41 +02:00
Asdow 5a74323d1f Disable AI logging by default
We only want this on when specifically debugging/working on AI.
2024-01-28 11:16:41 +02:00
majcostaandGitHub ae55496e39 Move main executable source to its own directory (#248)
* Move main executable files to their own directory

* Adapt the build to the new file structure

... and fix some weird #include's that were relying on the project root
being an include directory.
2023-10-23 15:46:51 -03:00
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +03:00
rftrdevandGitHub 119c6fe6bb Fix FindBestNearbyCover() and delete global var (#156) 2023-05-26 21:28:00 -07:00
Marco Antonio Jaguaribe CostaandAsdow 8b1c4effa0 nuke all the #if 0's
scripted commit:

find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';'

https://coan2.sourceforge.net/coan_man_1.html
2023-01-19 00:13:08 +02:00
majcostaandGitHub 24425a82b1 More unused stuff removal (#49)
* More unused stuff removal

delete:
- giant 'metaheaders' (JA2 All.h, Laptop All.h, etc), preferring to add #includes directly where needed
- unused ExceptionHandling and DbMan translation units
- unused WizShare.h, Bitmap.h, trle.h, video_private.h headers

* remove mentions from vc proj files too

* remove preprocessor conditionals for unused definitions

find . -iname '*.h' -o -iname '*.cpp' -exec unifdef.exe -m -UPRECOMPILED_HEADERS -UJA2_PRECOMPILED_HEADERS -UWIZ8_PRECOMPILED_HEADERS -UPRECOMPILEDHEADERS {} ';'

then manually fixed a couple files the tool errored out on

* yes, the comments too

as title
2023-01-03 15:51:48 +02:00
Asdow 1f0a8f46e8 Import changes from the local SVN working copy 2022-10-10 10:08:44 +03:00
Sevenfm dc8fffb471 Fix: use system time instead of game time for breaking AI deadlock as game time is affected by fast timer mode, as a result breaking AI decision before it can execute normally.
Allow to break AI deadlock manually by pressing ESC key after 10 seconds, auto break AI after DEAD_LOCK_DELAY seconds.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9383 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-05-10 18:45:19 +00:00
Sevenfm b06b9132a7 Added functions for utf8 <> wstring conversion.
Added message when AI breaks deadlock because cannot complete action.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9262 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-16 17:09:09 +00:00
Sevenfm aa767c4355 Minor code improvements for quest logging.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9178 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:43:15 +00:00
Sevenfm 0a717c2697 Removed option AI_DECISION_INFO.
Added quest debug logging to Logs\QuestInfo.txt

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9177 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:35:32 +00:00
Sevenfm 08ba4f9323 CancelAIAction: improved condition to allow cover check.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9081 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-13 17:46:21 +00:00
Sevenfm 2459f90412 Disabled clearing next AI action in CancelAIAction as it may interfere with scripted actions code.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9077 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 17:33:16 +00:00
Shadooow 6c1f5ed7ee corrected typo in previous commit
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9074 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 10:06:32 +00:00
Shadooow d46cbda2b6 new fix for endless clock issue in POW cutscene, was actually caused by Elliot trying to do the kick animation which doesn't exists for civilian body type
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9072 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 09:39:20 +00:00
Shadooow 5b24d136f2 fix for endless clock issue in POW cutscene
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9070 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 00:10:42 +00:00
Sevenfm 09270c04f0 Fix Deidranna endless clock in cutscene.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8970 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-24 13:31:56 +00:00
Sevenfm b6f15b2347 Add robots to enemy groups (by rftr).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8956 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-03 03:32:40 +00:00
Sevenfm 4471b8ef97 Improved code to check if militia options are available.
Start radio animation when giving orders to militia.
FindClosestClimbPointAvailableToAI: don't check roaming range when searching climb spot for AI.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8939 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-17 15:01:57 +00:00
Sevenfm 1256639fe5 AI_ACTION_STOP_MEDIC: also check START_AID, START_AID_PRN animations to prevent AI endless clock when first aid has just started and AI decides to move somewhere.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8923 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-01-30 23:22:59 +00:00
Sevenfm 80554bcde8 Hopefully improved AI code: don't try to resume movement after ActionDone was executed.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8911 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-26 17:37:44 +00:00
Sevenfm 2c2d8c9276 AI:
- improved civilian cower/run away code
- CancelAIAction: reset bNextAction and next action data
- clear next action data before making decisions
- militia always try to spare grenades unless under attack or using flares

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8905 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-20 21:20:26 +00:00
Sevenfm b45af3f575 FindNearestUngassedLand, FindNearbyDarkerSpot:
- optimization: don't check spots already checked in previous loop
- increase max distance to 35, reduce to 25 if complex AI not allowed, reduce to 15 in realtime
CanDragPerson: use world movement cost instead of LOS check.
Say TAUNT_RELOAD, TAUNT_OUT_OF_AMMO taunts if mag size > 4 or Chance (CHANCE_SAY_ANNOYING_PHRASE).
SpotDangerLevel: also check Water and CorpseWarning for danger level = 1.
ManSeesMan: only call SetNewSituation if location or level are different to reduce frequency of AI re-evaluation.
Only allow radio animation on initial red alert, if sector is not jammed.
Press ESC to stop dragging.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8904 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-17 06:30:23 +00:00
Sevenfm c7d1acff01 fix: climbing related AI deadlocks (by anv)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8883 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-13 04:54:23 +00:00
Sevenfm 5903abee09 Various AI improvements.
FindThrowableGrenade: allows to specify type and damage of searched grenade.
New counter SOLDIER_COUNTER_RETREAT allows to set number of turns which soldier will try to retreat and take cover.
FindBestNearbyCover: use PrepareThreatlist as unified function to make list of all known opponents.

Militia Control:
- start retreating mode for 2 turns when ordering retreat
- replace AI_ACTION_RUN_AWAY with AI_ACTION_TAKE_COVER order so that militia do not retreat from sector

New AI behavior:
- soldier can use smoke grenade to cover himself when under fire
- soldier can use use smoke grenade on his friend to cover him
- if soldier used smoke, he starts retreat mode for 2 turns
- added retreat code to Red, Black AI
- improved Main Red AI for civilians (they only run away)

Improved suppression code:
- less chance of suppression when opponent has high shock level
- prefer using suppression fire when soldier is in cover

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8879 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-07 12:12:31 +00:00
Sevenfm 9e1b5338a6 More AI logging information.
PanicAI: use correct movement and stealth mode when determining AP needed.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8768 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-03-08 22:39:21 +00:00
Sevenfm 32482f20f6 New option AI_DECISION_INFO enables extended logging for AI decisions.
Moved zombie AI into separate file ZombieDecideAction.cpp
New zombie AI:
- simplified code
- advancing using cover
- if zombie cannot reach any opponent, he tries to hide
- if zombie cannot reach opponent and cannot hide and he is under fire, he will retreat, seeking cover away from known opponents
- if zombie doesn't know enemy location, he will try to run to closest friend who knows enemy location
- new zombie AI has extended AI logging
More water splash sounds (Data\Sounds\Misc\Splash1.ogg .. SplashN.ogg).
CalcCoverValue: 
- allow moving into shallow water if it provides better position
- special calculations for zombies: zombie is very dangerous at close range
- if soldier has no gun, use different calculation based on distance instead of CTGT
FindBestNearbyCover: zombies only choose spots that provide sight cover.
Added functions for extended AI log.
ClosestReachableDisturbance:
- if soldier is zombie and he cannot climb, skip location
- zombies do not attack vehicles
- improved check to avoid choosing dying opponents
EstimatePathCostToLocation: return 0 if checking for zombie which cannot climb and path needs climbing.
RoamingRange: always max roaming range for zombies.
SightCoverAtSpot, ProneSightCoverAtSpot:
- improved max sight range calculation
- added option for unlimited sight range check
New AI functions:
- AIDirection
- AICheckIsSniper
- AICheckIsMarksman
- AICheckIsMedic
- AICheckIsMortarOperator
- AICheckIsGLOperator
- AICheckIsOfficer
- AICheckIsCommander
- AICheckIsMachinegunner
- AIGunInHandScoped
- AIGunScoped
- AIGunRange
- AIGunClass
- AIGunType
- AIGunDeadliness
- AIGunAmmo
- AIGunAutofireCapable
- FindObstacleNearSpot
- InSmoke
- CorpseWarning
- CorpseEnemyTeam
- CorpseMilitiaTeam
- AICheckUnderground
- AnyCoverAtSpot
- AICheckHasWeaponOfType
- AICheckHasGun
- AICheckShortWeaponRange
GetCorpseAtGridNo: additional check for valid gridno.
More zombie raise sounds (Data\Sounds\Misc\ZombieRaise1.ogg .. ZombieRaiseN.ogg).
GetCorpseRotFactor: improved code to return FLOAT value between 0 and 1.
New debug topic id TOPIC_DECISIONS for logging AI decisions.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8760 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-02-21 23:33:25 +00:00
Sevenfm e4d30987bf Fix possible bug when executing AI_ACTION_STOP_COWERING.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8742 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-02-06 17:18:49 +00:00
Sevenfm 1455409057 AI:
- before deciding anything, stop cowering animation
- before deciding anything, stop giving aid animation
- before deciding to raise weapon, check if weapon can be raised
- simplified scope check
- removed duplicate code in Red AI

Added missing actions to gzActionStr[].
Fixed OKLIFE checks.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8740 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-25 19:02:53 +00:00
Sevenfm 7908dc2ff3 Reverted resetting next action in CancelAIAction() as it doesn't work as expected.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8697 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-10-18 21:31:19 +00:00
Sevenfm 30df6c350a CalcTargetMovementOffset: better integer calculation for max tiles penalty.
SOLDIERTYPE::initialize: initialize additional data.
EVENT_FireSoldierWeapon: if shooting soldier is invisible, locate screen to target spot.
CancelAIAction: reset next AI action.
FindBestPath: improved gas avoiding code.
InGas: improved code, also check the spot itself.
LegalNPCDestination: disabled additional checks to prevent AI deadlock.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8695 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-10-03 16:49:04 +00:00
Sevenfm 5d04583e13 - update "improved auto fast forward" feature
- disable radio animation for invisible soldiers and soldiers in water

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8603 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-08-26 01:24:06 +00:00
Flugente 3bbdd4a23a New ability: a disguised spy can distract unalerted enemies, making it easier to sneak by.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20228&goto=352562&#msg_352562

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8528 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-02-25 19:07:31 +00:00
Flugente dd3129ac11 New feature: additional dialogue allows modders to play additional dialogue on man occasions, including reactions to other people speaking
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=tree&goto=351982&#msg_351982 and for a demonstration http://thepit.ja-galaxy-forum.com/index.php?t=tree&goto=351981&#msg_351981

Requires GameDir >= r2400

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8516 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-01-10 23:41:52 +00:00
Sevenfm f8d9a538cd Taunts update:
- TAUNT_INFORM_ABOUT (check that this opponent is really new)
- TAUNT_ALERT (say taunt only when red alert raised, if it's no initial alert, use TAUNT_INFORM_ABOUT instead)
- TAUNT_SUSPICIOUS (only when yellow alert is raised)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8262 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-06-25 10:41:13 +00:00
Wanne c676a48cd5 Fix: Added explicit BOOLEAN check for pSoldier->bVisible (by sevenfm)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8230 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-05-23 05:24:45 +00:00
Flugente 7bf2943849 If a tank just took a heavy hit, but cannot see an enemy to fire upon, it can detonate a smoke grenade on itself to hide.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8127 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-03-26 23:16:41 +00:00
Flugente dba9e3eb88 AI update (by sevenfm):
- removed AI_EXTRA_FLANKING option
- LocationToLocationLineOfSightTest allows to check sight with specified height
- IsActionAffordable allows to specify action to check without faking it
- ClosestReachableDisturbance: correctly calculate path to each disturbance, added safety checks, update for noise checks
- CalcMoraleNew: update
- CalcBestShot: allow shooting at empty vehicles, but they have low priority
- allow AI to fire at dying opponents to avoid AI decision problems
- CheckIfShotPossible: allow any soldier with long range weapon to shoot in RED state (if he can hit)
- Flanking update
- WATCH decision update
- removed distance check for HELP decision to allow vanilla behavior, don't help if seen enemy recently or under fire
- suppression fire update
- pick up item decision: check that location is safe

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8125 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-03-26 13:41:54 +00:00