Commit Graph
89 Commits
Author SHA1 Message Date
Marco Antonio J. Costaandmajcosta b4176bb2d9 Fix/drag unconscious softlock
Same logic but cleaned up version of https://github.com/1dot13/source/pull/602 which Tais contributed with Claude Code's help

Most calls to SOLDIERTYPE::IsDragging() aren't supposed to have a side effect of cancelling a drag, being simple queries.
Changing the default to reflect that is right move.

Assisted-by: Claude:
2026-06-01 21:45:55 -03:00
Asdow 4fcf03d31a Include cleanup Tactical/.*cpp 2025-12-09 00:35:18 +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 0d97e36c34 Use SoldierID 2024-11-21 23:56:44 +02:00
Asdow 10250dc035 Merge branch 'master' into ExtraMercs 2024-11-09 13:44:53 +02:00
AsdowandGitHub 65698284c3 Re-enable extracover check for A* (#283)
Allows smarter pathfinding for AI, only done during turnbased pathing  to alleviate its extra cost
2024-02-11 14:57:53 +02:00
AsdowandGitHub 8f454e2aab Container.cpp & .h delete (#242)
* Remove GetFilesInDirectory()
* Remove BuildFileDirectory
* Remove container.cpp & .h

Not used in the code
2023-10-20 21:30:39 +03:00
majcostaandGitHub c8c7066969 Refactor merc backpack checking in FindBestPath (#162)
* remove unused fNonFenceJumper from AstarPathfinder::GetPath

* Extract backpack check into function and flip logic

Avoiding double negatives is nice
2023-07-28 12:07:25 -03:00
Asdow 9ac53cac32 Fix UINT8 references to pSoldier->ubID to UINT16 2023-07-27 21:29:37 +03:00
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +03:00
Marco Antonio Jaguaribe Costaandmajcosta 764d2f9389 remove int AStarPathFinder::CalcG(int*) function
not being called by anyone at the moment
2023-06-03 22:01:38 -03:00
AsdowandGitHub 17a0a08097 Add Astars pathing to ingame options (#124)
* Enabled astars pathing

* Add toggleable pathfinding choice to ingame options

You can choose between original and A* pathfinding algorithms
2023-02-15 11:49:04 +02:00
rftrdevandGitHub b5ec955324 Disable backpack climb check for non-player soldiers (#117) 2023-01-27 17:56:46 -08:00
Marco Antonio Jaguaribe CostaandAsdow d4abc82488 Address review feedback 2023-01-19 00:13:08 +02: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 a0a71894d1 Path code optimization: moved inventory searching functions out of path loop.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9385 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-05-12 16:15:58 +00:00
Sevenfm 904fae7a96 CancelDrag, StartDrag: update interface panel to change drag icon status.
DrawTraitRadius uses usColour.
Allow to start dragging from any stance, soldier will crouch automatically.
Show draggable objects when drag skill menu is active.
Press [\] key to start dragging object/solder/corpse in front of merc.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9369 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-04-24 18:21:44 +00:00
Shadooow 61f1dd4acb fixed MAX_BACKPACK_WEIGHT_TO_CLIMB not being checked in all places which caused:
- mouse cursor showing blocked path incorrectly and jumping over fence via mouse failing
- endless clock issue at the end of the boxing match if player merc had backpack

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9238 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-10 22:44:52 +00:00
Shadooow 0101ed3c58 minor code fix under debug defined (seems that someone replaced all instances of bLevel with pathing.bLevel, but the structure path_s doesn't have this)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9094 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-21 10:53:30 +00:00
Shadooow 807bd518b3 fixes for running over water
- merc will continue running after he walks out of last water tile
- fixed both pathing prediction AP cost calculation and an actual AP cost deduction when running into water and out of water

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9068 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-09 03:25:43 +00:00
Shadooow 43dfa982a5 Bright future is here, introduced turning AP costs into pathing AP prediction. Full changelog:
- fixed camera action AP cost shown and made soldier to turn towards target
- fixed handcuffs, jar and can actions AP cost shown calculating pathing cost twice and not calculating stance change at all
- fixed refueling and repairing pathing leading to inside vehicle
- fixed endless clock issue when trying to refuel from spot next to vehicle
- fixed endless clock issue when trying to repair vehicle/SAM site during combat
- fixed refuel, repair and jar actions not costing any AP in turn based mode
- fixed multiple actions not calculating and substracting AP cost for turning
- fixed using toolkit asking whether player wants to attack ally
- fixed issue where the required AP cost for melee attack was not recalculated when changing movement mode
- allowed to start repairs on robot manually from tactical mode
still a problem:
- repairing during combat still does nothing as soldiers cannot go into assignment while there are enemies on map
- we need new function to return action gridno for actions on vehicles, FindAdjacentGridEx is not working very well
- soldiers doesn't turn during interactive actions

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9033 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-20 11:42:57 +00:00
Sevenfm f9ec5b1b04 Partially fixed vanilla exploit (detect invisible enemy by using plotted path), still doesn't work if merc is prone.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8974 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-25 06:32:03 +00:00
Sevenfm b8aac91b9e Fixes (by Shadooow):
- fixed AP cost shown at the cursor when pressing ALT during RUN mode since game doesn't allow to "reverse run" and forces walking
- shows walking cursor instead of running if ALT is held

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8966 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-23 06:42:09 +00:00
Sevenfm 32e8f9d4ff EstimatePathCostToLocation: safety checks.
Main Red AI: fixed decision weight calculation.
Player mercs should avoid moving into gas/fire when in autobandage mode or under AI control.
IsLocationSittable, IsLocationSittableExcludingPeople: return FALSE if location on roof does not exist.
NWSS: play room effect for first shot only.
AI inventory choosing: more variety for mortar shells, improved hand/GL grenade choosing code.
Red AI: improved mortar use code: use next action to fire mortar after stepping back.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8920 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-01-14 15:45:11 +00:00
Sevenfm 2f576684ac VR r2348 fix - loading .jpc.7z with a single image would cause exception as file was not considered open (by anv)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8786 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-20 00:20:37 +00:00
Sevenfm 3e07b01a45 Removed old zombie AI code.
Improved AI path tweaks:
- tanks prefer moving in straight directions to avoid sliding effect
- combat jeeps prefer moving on roads (PAVED_ROAD, DIRT_ROAD)
- armed vehicles avoid moving into buildings (FLAT_FLOOR)
- increased value to avoid light and corpses for enemy soldiers

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8770 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-03-09 23:21:25 +00:00
Sevenfm 4fb6369368 AI pathing: avoid deep water if not in deep water already and not SEEKENEMY (allow max 2 tiles of deep water for other soldiers).
CONSIDERED_NEUTRAL: removed dying check as it may cause problems with AI.
Improved code to avoid moving into gas/deep water/light/artillery danger zone.
ClosestReachableDisturbance: 
- skip dying opponent if found not dying
- when in deep water, skip opponents in deep water
ClosestKnownOpponent: skip dying opponent if found not dying.
RedSmokeDanger: consider deep water as safe from artillery strike.
Allow deep water flanking for soldiers of ENEMY_TEAM with SEEKENEMY orders and CUNNINGSOLO attitude or athletics trait.
CalcBestShot:
- dying, cowering or unconscious soldiers have very low priority
- added safety checks
- if best opponent is dying and new opponent is ok, use new opponent
DecideAction: improved deep water checks.
Red, Black AI: when SEEKENEMY soldier is in deep water, move to closest opponent on the ground.
FindNearestUngassedLand: 
- increased max search distance to 35
- added speed optimization
- removed max AP budget
FindNearbyDarkerSpot:
- increased max search range to 25
- added speed optimization
- removed max AP budget
FindFlankingSpot: added condition to allow deep water flanking


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8758 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-02-17 19:20:28 +00:00
Sevenfm 352a344308 Added new option AI_PATH_TWEAKS which controls various experimental path tweaks for AI: avoid gas, deep water, light at night.
Added experimental path tweak: AI tanks prefer moving in straight directions to avoid sliding effect.
Set default value for options AI_EXTRA_SUPPRESSION, AI_NEW_MORALE, AI_BETTER_COVER, AI_MOVEMENT_MODE to TRUE.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8737 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-24 09:14:38 +00:00
Sevenfm 9c563c9c8a Improved AI path tweaks.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8730 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-12 09:17:51 +00:00
Sevenfm 168f9b9f6d Improved AI path tweaks.
FindBestNearbyCover: avoid moving into light if not in light already and not under attack.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8729 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-12 09:07:31 +00:00
Sevenfm b367fad899 Switch scope mode to default for suppressed soldier if he uses alt weapon holding.
Improved AI path tweaks.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8715 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-12-04 13:27:24 +00:00
Sevenfm 92b6f40a17 Improved AI path tweaks.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8714 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-12-04 12:05:11 +00:00
Sevenfm 219a1c76e2 Experimental path AI tweaks:
- avoid light at night
- avoid corpses
- avoid deep water
- avoid gas/fire

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8713 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-12-03 21:52:36 +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
silversurfer 4021450369 - fixed incorrect AP and BP calculation for jumping over fences
- fixed incorrect stance handling for jumping over fences

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8635 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-11-04 17:49:10 +00:00
silversurfer 384572098b - fixed incorrect rounding in several places in the code
- diagonal movement now uses the proper amount of AP and BP

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8634 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-11-03 16:11:21 +00:00
Flugente 5bdd23ac13 New animations: added animations for crouched walking with weapons aimed for all merc bodytypes (made by Taro)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8496 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-10-15 17:10:49 +00:00
Flugente 6031257dcd New feature: mercs can drag people and corpses
Requires GameDir >= r2386.

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23508&goto=350989&#msg_350989

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8474 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-09-17 22:16:30 +00:00
Flugente 11729a132e New feature: riot shields protect against damage from some directions.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23452&start=0&

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8434 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-07-29 21:18:13 +00:00
Sevenfm e9a1f4b352 New feature: delayed grenade explosions:
- use transformation menu to change explosion mode
- only Normal/Stun/Flashbang type grenades can be delayed
- AI soldiers will avoid staying close to armed grenades\explosives
- use option DELAYED_GRENADE_EXPLOSION to make all hand\GL grenades work as delayed
- new value AP_GRENADE_MODE = 4 in APBPConstants.ini
- new item flag DELAYED_GRENADE_EXPLOSION

Other changes:
- fixed call to sqrt in DrawExplosionWarning() that prevented compiling in VS2010
- correctly update interface after transformations
- PATHAI: AI soldiers will skip gassed tiles if not in gas already
- InGas check: AI soldiers will avoid mustard gas even when wearing gas mask
- Yellow AI: added check to avoid gas/water/bomb using FindNearestUngassedLand
- gas/flare grenades will always explode instantly even when in bad state
- LegalNPCDestination: locations near armed bombs are not legal
- FindBestNearbyCover: avoid locations near armed bombs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8324 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-10-18 12:39:06 +00:00
Sevenfm 762fb79c09 CalcEffVolume fix: sleeping state check
Attacks fix: 100 AP system for HitRate calculation
EstimatePath fix: ignore person at destination if we are estimating path cost
FindFlankingSpot: use full search range

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8265 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-07-03 09:53:56 +00:00
Flugente 9e97538d89 New feature: enemy combat jeeps fill the role between infantry and tanks. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=344628&#msg_344628
This is savegame compatible. GameDir >= r2305 required.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8114 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-03-20 18:45:51 +00:00
Wanne 23d4051473 Fixed problems with enemy rooftop climbing (by sevenfm)
- Also updated "Water", "DeepWater" and "WaterTooDeepForAttacks" methods: Added bLevel parameter (by sevenfm)
- see: http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22966&start=0&

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8110 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-03-15 12:40:54 +00:00
Wanne dbc852ea74 Vehicle Update: Roadkill with vehicles and ramming (by anv)
- new feature: ramming people - set with Tactical Gameplay Settings > ALLOW_CARS_DRIVING_OVER_PEOPLE and Tactical Gameplay Settings > ALLOW_TANKS_DRIVING_OVER_PEOPLE - when shift is pressed planned vehicle route will go through people. Those who will stay on its path will be hit, causing wounds and knock-outs.
- new feature: ramming structures - when shift is pressed planned vehicle route will go through obstacles. When vehicle hits the structure on its path it will be destroyed, causing small damage to vehicle too (with exception of tank). Tactical Gameplay Settings > CARS_RAMMING_MAX_STRUCTURE_ARMOUR and Tactical Gameplay Settings > TANKS_RAMMING_MAX_STRUCTURE_ARMOUR settings control how well armoured structure can be driven through and amount of potential damage for vehicle.
- see: http://www.ja-galaxy-forum.com/ubbthreads.php/topics/333829/Drivable_Vehicles#Post333829


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7284 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-06-21 10:07:11 +00:00
Wanne fa29d9be26 Merged from revision: 7258
- Translated russian source code comments (by Sevenfm)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7259 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-06-03 18:13:23 +00:00
Wanne fe995dc2f3 New Feature: Allow driving vehicles in tactical (by anv)
- To control vehicle, click on it or on the steering wheel in team panel under driver's portrait.
- Vehicles have two gears - slow drive and fast drive, switchable just like walking and running ('S', 'R', double-click).
- Vehicles working: Ice Cream Van, Hummer, Jeep, El Dorado and, potentially, tanks.
- Passengers can be selected and ordered to open fire from the inside
- You can also open inventory screen for passengers, pass or throw items, etc.

Normally vehicle is treated as any other merc and has its own APs. It has obvious disadvantages - it's possible to drive in the middle of the enemy group using vehicle's 100AP,
and then use all your mercs inside vehicle with their still full APs to kill everything that moves at point blank range - with even the driver participating!
- To prevent that you can set Tactical Gameplay Settings > AP_SHARED_AMONG_PASSENGERS_AND_VEHICLE_MODE with following calculation methods

more infos: http://www.bears-pit.com/board/ubbthreads.php/topics/332208/1.html


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7193 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-06 08:46:26 +00:00
Wanne cf06aed52a Bugfix: AP deduct is different then shown (by Moa)
- no more jump with backpack (keys 'j' and 'J'). This is more consistent. Sometimes the soldier got stuck in the fence as some functions did not allow jumping and others did.
- Pickup items from ground will now cost AP.
- Backpack, Scubba fins and swimming background AP modificattion is now shown in path and is considered when calculating new path. No pathing through fences when wearing backpack. More likely to create path through water when wearing scubba fins.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6543 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2013-10-30 19:36:15 +00:00