Commit Graph
370 Commits
Author SHA1 Message Date
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 ef9aa1b027 Convert to SoldierID 2024-11-17 22:29:31 +02:00
Asdow b9641d4c90 Convert to SoldierID 2024-11-17 20:52:12 +02:00
Asdow 34f0b40f93 Convert functions and globals to SoldierID 2024-11-17 14:53:52 +02:00
Asdow 131172e41a Convert SOLDIERTYPE->ubPreviousAttackerID to SoldierID 2024-11-15 22:54:44 +02:00
Asdow 735075869c Fix incorrect variables
ubImprintID uses SOLDIERTYPE->ubProfile, not SOLDIERTYPE->ubID in every other instance of the code. This one's clearly a mistake.
2024-11-15 01:14:30 +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
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
rftrdevandGitHub aaeea9aac8 Replace evolution with growth rates (#201) 2023-08-09 18:36:44 -07:00
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +03:00
AsdowandGitHub 0decb14856 Prevent endless clock (#186)
Stop AI from attempting to steal a weapon that has a sling attachment, which prevents stealing. (by Seven)
2023-07-26 10:18:13 +03:00
rftrdevandGitHub 119c6fe6bb Fix FindBestNearbyCover() and delete global var (#156) 2023-05-26 21:28:00 -07:00
Marco Antonio Jaguaribe Costaandmajcosta 760f8ab3d7 Remove all MSBuild files
now that CI is using cmake, we can be clean up the tree quite a bit

btw, cmake can still configure for the msbuild generator for those so inclined:

create the folder, cmd to it, run `cmake [project_root_dir] -G"Visual Studio 17 2022" -A Win32 -DLanguages=ENGLISH -DApplications=JA2` once, then open the solution file using Visual Studio 2022
2023-05-08 06:44:35 -03:00
AsdowandGitHub 35109a5615 Guard against possible illegal array access (by Seven) (#121)
ClosestPanicTrigger() can return -1 but its use in indexing gTacticalStatus.bPanicTriggerIsAlarm was not checked in all the places in the code
2023-01-31 20:26:21 +02:00
rftrdevandGitHub b5ec955324 Disable backpack climb check for non-player soldiers (#117) 2023-01-27 17:56:46 -08:00
AsdowandGitHub ae1fd0a2ee Prisoner feature bugfix (#110)
* Allow game to continue after offering to surrender to enemies

* Fix issues related to surrender and POW quests

- Quests were ended prematurely if one had prisoners in both alma and tixa
- Strategic status flags for rescue/escape were not set properly
- Only the maximum amount a prison can hold will be taken as POWs, rest of the mercs will either escape or have to fight to the death, to prevent a player having unrescuable POWs
- Capturing a mercenary had a lot of functions called that should not have been, IF the merc is not going to be captured after all

* Switch all tactical surrender calls to use one unified function

* Only mercs that are capable can escape

Incapacitated mercs left behind will die.
Should probably prioritize incapacitated mercs to be captured by the enemy to prevent needless deaths

* Combine pow quest state changes into one function

* Add JumpIntoEscapedSector to header file

* Allow enemy to demand surrender even if they already have POWs in Tixa and Alma

* Remove surrender from UB

* Address review feedback
2023-01-22 23:35: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
Marco Antonio Jaguaribe Costa 8609944467 Add a CMake build
Tried to stay as close as possible to ja2_2019.sln

On Visual Studio 2022 just Project -> CMake Settings for Ja2, add
the x86 configurations you want and press F7.

Below shows how the -DLanguages -DApplications switches work, If you don't
set them, the CMakeCache.txt of them will be set to ENGLISH and JA2,
respectively:

cmake [...] // nothing set, configure just JA2_ENGLISH.exe by default
cmake [...] -DApplications="JA2UB" // configures just Unfinished Business
cmake [...] build -DApplications="JA2UB;JA2UBMAPEDITOR" // Unfinished Business and UB Map Editor
cmake [...] build -DApplications="JA2UB;JA2MAPEDITOR;ALL" // ALL is in the list, configures every application
cmake [...] build -DApplications="JA2MAPEDITOR;DeathStranding" // fatal error: DeathStranding not an application

cmake [...] -DLanguages="GERMAN" // configures just German targets
cmake [...] build -DLanguages="GERMAN;ENGLISH" // German and English
cmake [...] build -DLanguages="GERMAN;ENGLISH;ALL" // ALL is in the list, configures every language
cmake [...] build -DLanguages="ENGLISH;ESPERANTO" // fatal error: ESPERANTO not supported
2023-01-14 02:08:39 -03: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
rftr 2cdc346934 fix divide-by-zero crash in some cases when crepitus queen is doing a tentacle attack
bug found by BigBritishGuy on discord

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9376 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-05-03 22:24:44 +00:00
Sevenfm f8be9a0db1 AI: minor code improvements (best cover calculation).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9273 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-23 03:10:13 +00:00
Sevenfm 7803378388 Militia: don't always spare RPGs when in tactical combat.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9270 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-21 19:22:12 +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 992c487176 Reverted r9221 change.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9222 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-12-21 21:20:48 +00:00
Sevenfm ad044f38c6 Improved code for AI attack location randomization.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9221 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-12-21 08:09:41 +00:00
Sevenfm b11957691c Fix for critical bug introduced in r9182: replace CoweringShockLevel check which calculates suppression tolerance every time, with IsCowering, which uses cowering animation check.
DrawBarsInUIBox: fix possible divide by zero.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9184 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-16 16:07:31 +00:00
Sevenfm 7978ad77f3 Morale changes for AI soldiers:
- GetMoraleModifier: use bMorale for both player and AI.
- CalcSuppressionTolerance: use morale as a base for tolerance for AI soldiers.
- HandleSuppressionFire: morale loss for AI soldiers.
- EVENT_BeginMercTurn: increase morale for AI soldiers.
- TacticalCreateSoldier: Set morale = 60 + 2 * bExpLevel + Random(20) when creating AI soldier.

NEW_SUPPRESSION_CODE: UseGun, UseGunNCTH: reduce shock when firing gun.
AI_NEW_MORALE: limit AI morale depending on morale and shock level.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9181 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-15 05:52:09 +00:00
Sevenfm 7a7f554908 Fix/change: the hospital now checks for mercs with damaged stats in addition to damaged health. in addition, the hospital now charges money to heal damaged stats (by rftr).
Minor fixes for quest debug log.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9180 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-15 04:49:17 +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 95a810e382 AI flanking:
- avoid moving too far from noise spot, except for CUNNINGSOLO
- avoid moving too close to enemy vision range

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9167 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-09-23 18:20:49 +00:00
Flugente 6cad680b02 We can now use interactive actions to alter decals on walls, so it is possible to simulate taking off an object from the scenery and add it as an item.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=363513&#msg_363513

Requires GameDir >= r2601

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9141 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-13 19:50:49 +00:00
Shadooow f779c0cb37 Major rework of getting captured quests and mechanics.
- new feature: added Tixa as another prison where capture mercs can be held (Alma is still primary choice though)
- fix: all mercs in the map will be taken POW when surrendered, however only 3 will appear in Alma/Tixa/N7, rest will be POW forever without chance of getting free
- fix: whenever player liberates any of the POW sectors (Alma, Tixa, N7) the respective quest/cutscene with POW will be disabled in that sector until enemy recapture the sector
- robot will be destroyed when surrendered as it makes no sense to inprison mechanical units
- externalized the GridNos for freeing POW mercs into Mod_Settings.ini

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9095 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-21 13:53:56 +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 cf7588cacd Only show "sniper" message when shooter uses sniper rifle.
Disabled "sniper" message for vehicles.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9014 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-09 03:54:41 +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