Commit Graph
3321 Commits
Author SHA1 Message Date
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 43ab995ecd Only show "suppression fire" message if target soldier cannot be seen after turning.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8903 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 20:44:21 +00:00
Sevenfm b5cbc32261 EstimateStabDamage: updated code.
Black AI: 
- reduce stab attack attractiveness if target is not very close
- reduce stab attack attractiveness if soldier sees more than one opponent
- for HTH attacks, skills don't have effect on choosing attack type for boxers
- reduce HTH attack attractiveness if soldier sees more than one opponent
- allow to increase autofire bullets by reducing aim in NCTH if LIMIT_MAX_DEVIATION option is enabled

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8902 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 19:52:57 +00:00
Sevenfm 47c58e79d5 AI:
- new option AI_SAFE_SUPPRESSION adds additional checks for AI to avoid hitting friends when using suppression fire.
- chance to use suppression fire depends on actual chance to hit and SUPPRESSION_EFFECTIVENESS option
- reduced short burst to 2 bullets.
- improved code to use short burst

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8901 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 17:53:02 +00:00
silversurfer d867051cd6 fix: when multiple mercs are repairing, it could happen that one of them didn't spend any points, causing an error message about insufficient skill
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8900 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 07:52:46 +00:00
Wanne 8c74a30b35 Updated Chinese Text files (by TBS)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8898 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-01 09:42:09 +00:00
Sevenfm e5f8518674 Red AI:
- set default bAimShotLocation when checking if shot is possible
- remove second CheckIfShotPossible() call
- only use reloading before suppression fire if weapon is autofire capable and can swap clips

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8896 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-09-28 07:32:09 +00:00
Sevenfm 8c8115e3f2 Red AI:
- reload before suppression fire less often in dangerous situation, also check AP_MINIMUM so we don't reload when really low on APs
- use CanNPCAttack() check only for sniper and suppression fire as only these actions need usable gun
- when trying to step back to deploy mortar, check if we can reach the spot and have enough APs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8895 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-09-28 05:05:52 +00:00
Sevenfm 6194bbdbd8 Hopefully improved r8658:
- check weapon magazine size and chance to say phrase when using gun
- always reset fSayAmmoQuotePending in InternalReduceAttackBusyCount()

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8894 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-09-28 04:41:15 +00:00
Sevenfm 144cdc0131 FindAmmoToReload: added assert messages to indicate that searching attached weapon failed.
DecideAction: initialize bWeaponMode = WM_NORMAL to prevent FindAmmoToReload from crashing.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8892 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-31 16:35:56 +00:00
Sevenfm 4344c2caf8 Suppression:
- disabled ubAdjacentSoldierCnt check as it doesn't work correctly
- improved adjacent tile check to avoid out of bounds values

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8891 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-20 04:24:44 +00:00
Sevenfm f5162b31d2 Fixed minor error in previous commit.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8890 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-18 08:28:25 +00:00
Sevenfm fa557a0dea New option AI_SHOOT_UNSEEN (disabled by default): allow AI to shoot at recently seen/heard enemies (targets that nobody from soldier's team sees currently).
CalcBestShot:
- improved hit rate calculation, take into account possible options INCREASE_AIMING_COSTS, FIRST_AIM_READY_COST_DIVISOR
- minor code improvements
New AI function LOS_Raised checks LOS with forced raised gun status, to get max view distance with scope

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8889 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-18 08:23:39 +00:00
Sevenfm b49de1de60 Removes the noexcept keywords and fixes the jenkins build that's in here https://jenkins.maeyanie.com/job/JA2%20Build/ (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8888 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-16 11:03:42 +00:00
Sevenfm 95a4bde357 CalcBestThrow:
- improved AI code to avoid hitting friends with grenades
- correctly set usGrenade for mortar attacks

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8887 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-16 04:20:31 +00:00
Sevenfm 43e0f70a87 A patch to fix one blitter function for when LOBOT is in use and a merc is prone. (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8886 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-15 16:46:04 +00:00
Sevenfm 6e87488da6 Reworked the DrawMap function. Flattens the large switch in it, removes the need for a few if checks that were done in every iteration of the old switch case loop and also shades all the map sectors using only one call to Lock- and UnlockVideoSurface instead of continuously locking and unlocking the surfaces when shading every single map element. (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8885 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-15 12:55:33 +00:00
Sevenfm 5eaec6881e Added a nullpointer check to a DDraw call, gets rid of one FIXME. (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8884 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-15 12:40:37 +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 7111f40e54 Fixed a few very minor memory leaks. (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8882 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-13 02:33:39 +00:00
Sevenfm 2cdf1b2f0a Changed the way the STI file for CTH indicator is loaded to prevent the game from constantly loading and unloading the graphics file from the disk every time the function gets called. Now it's only done once per the lifetime of the game. (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8881 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-12 11:54:12 +00:00
Sevenfm ecf4e42fac Added static keyword to three vectors in CalculateCoverFromEnemies and resizing them to 0 at the end of the function so we're not constantly creating and destroying them at every call of DisplayCover function. Speeds it up a little bit. (by Asdow)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8880 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-09 14:01:32 +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 93c41f2f97 AI suppression fire improvements.
CalcBestShot:
- added standard check for valid opponent
- use standard knowledge functions
- blind soldier can only attack seen/heard personally
- determine suppression fire (shooting at target nobody sees currently)
- don't shoot if target location is seen and empty
- no fire on unseen opponents with throwing knives
- only enemy team can use blind suppression fire
- only try to suppress alive and conscious human targets
- additional check to limit shooting through walls
- alt weapon holding scope mode is used only when ubAllowAlternativeWeaponHolding == 3
- hip firing allowed only for human bodytypes
- take into account direction when checking stance
- shoot heavy guns in standing stance only when using hip fire
- penalize suppression fire

Red AI suppression fire:
- check valid target
- check weapon/ammo requirements
- check that soldier is not sniper
- check friendly fire chance
- reduce chance to shoot if target is beyond weapon range
- check that we have spare ammo

Improved code to prepare suppression fire:
- change stance first of needed
- allow shooting with aiming
- reserve APs to hide if no cover or enemy is close
- added debug messages

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8878 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-06 07:53:12 +00:00
Sevenfm e9107eab34 CalcChanceHTH:
- slightly lowered base chance
- reduce chance if defender is blind
- reduce chance if attacker is blind
- bonus for boxers for attacking from the back

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8877 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-02 16:55:46 +00:00
Sevenfm e959d6893b Added new soldier flags: SOLDIER_BACK_ATTACK, SOLDIER_SNEAK_ATTACK (work for punch and stab attacks only).
ClosestKnownOpponent() now can return ID of closest opponent.
CalcCoverValue: improved code to avoid friendly fire.
EVENT_SoldierBeginPunchAttack: use supplied gridno as sTargetGridNo may not be set yet

Boxing:
- added possibility of counterattack after failed attack
- added possibility of opportunity attack a passing enemy
- bonus in CTH for boxers for attack from the back

Boxing AI:
- for boxers, always use high morale so that they attack
- cautious boxer approach, reserve AP for two attacks (only if not attacking from the back)
- try to avoid frontal attack
- sometimes boxer may decide to restore breath instead of moving and attacking
- boxer can step back to move away from opponent, if he is low on breath
- improved main boxer AI

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8876 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-02 16:35:10 +00:00
silversurfer 1a31b21ea4 Fix: Re-enabled the condition check for mercs to enter tactical screen from map screen. Someone removed it, which made it possible to enter tactical with no mercs in the sector.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8875 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-01 15:22:26 +00:00
Sevenfm 5b71be4045 CalcCoverValue: improved friendly fire check.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8874 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-31 12:02:45 +00:00
Sevenfm 6b706f2747 Increased max possible soldiers stored for friendly fire check to 256.
Friendly fire chance code also checks for soldiers of the same side and optionally neutral civilians.
CalcCoverValue: check friendly fire chance for each position, penalize position if friendly fire chance is high (needs AI_BETTER_COVER = TRUE)

UnderFire::Add: 
- store friendly fire CTH for new added person
- use max value when replacing friendly fire CTH for existing person

CalcBestShot:
- check CTGT and friendly fire chance for every stance
- ignore possible shot if can hit friends in this stance

CalcMoraleNew: improved code to make enemy slightly more aggressive.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8873 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-31 10:26:07 +00:00
Flugente 8e4961f021 Fix: various compile warnings
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8872 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-24 19:27:34 +00:00
Flugente 5036772e1b - Fix: outdated text
- Fix: animation loops until new order given

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-24 19:25:47 +00:00
Flugente 0c4997f6ec Improved feature: structures can be dragged. Which ones is defined in a new xml.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=360672&#msg_360672

Requires GameDir >= r2558

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8870 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-23 22:11:23 +00:00
Flugente c8737017ff Fix: nullpointer access
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8869 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-22 21:30:39 +00:00
silversurfer 7931497b9c Fix:
- when USE_XML_SQUADNAMES was TRUE, the squad box was shifted upwards over the column headers, causing clipping issues
- when READ_PROFILE_DATA_FROM_XML was TRUE, the game would still read profile data from prof.dat, if the old inventory system was used

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8868 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-17 11:22:29 +00:00
Flugente ce61a0b85b Fix: if no squad name is provided in xml, fall back on hardcoded name
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8867 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-15 21:23:53 +00:00
Wanne e14444f14a Multiplayer: Disabled rooftop climbing, because its not syncing correctly between the clients
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8866 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-13 17:43:36 +00:00
Flugente 93db0bb728 - Fix: assignment not displayed consistently in personnel page
- Fix: bizarre function

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8863 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-12 16:48:32 +00:00
Flugente 0165ba5bed Print out details of savegame loading process to easier identify bottlenecks
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8856 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-10 16:51:08 +00:00
Flugente 39d79a0bb4 Fix: dragging soldiers is frequently cancelled
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8855 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-09 20:46:41 +00:00
Wanne 1e66fe2ba7 Multiplayer:
- Disabled fragments, because this can crash the game when stepping on a mine, ...
- Enabled rooftop climbing

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8854 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-09 09:32:49 +00:00
Wanne 9bc4b2bfb6 Translated a few German Texts
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8853 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-08 22:11:29 +00:00
Flugente 3e41299596 Accept sounds for dragging a body in other formats than .ogg
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8851 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-08 22:02:55 +00:00
Wanne aa0d52f790 Translated a few German texts
Moved // TODO.Translate comments
Fixed missing \n in text

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8850 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-08 19:30:44 +00:00
Wanne dc23302696 Fixed compilation error when trying to compile JA2UB version
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8849 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-08 18:46:45 +00:00
Wanne 5f54d43760 Fixed compilation error (sqrt) when compiling in Visual Studio 2010
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8848 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-08 18:28:31 +00:00
Flugente 1e101b2065 Use macro where appropriate for easier maintenance
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8847 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-07 19:47:52 +00:00
Flugente 6de9deae63 Fix: mercs staffing a facility for global propaganda cause mine income to drop to 0%
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8846 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-06 22:36:56 +00:00
Flugente 04fda674e5 Fix: radio operator in a city can give movement commands to any militia in a non-city sector
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8845 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-06 21:25:45 +00:00
Flugente 3864aca117 Display item names in merchant inventory (by bfant)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8844 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-05 12:48:12 +00:00
Flugente c8627c7234 - Fix: wrong face displayed on insurance website
- Chg: no insurance payout on suspicious deaths (no enemy presence during merc death, or merc died from friendly fire)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8843 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-05 12:03:44 +00:00