Commit Graph
285 Commits
Author SHA1 Message Date
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
kitty624 eb3f62c3d5 Reverting Commit 9122d7a
it made: CAN_FAN_THE_HAMMER = FALSE now disables the burst mode on pistols
which effectivly resulted in pistols burst mode only being avaialbale with can fan the hammer active
which further resulted in being required to fire from hip mode when using burst with pistols
that's not a desired behaviour for burst on pistols, their burst should not depend on fan the hammer
therefore reverted
2025-08-01 20:52:22 +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 9dfbc7d394 Use correct gridno for XY conversion (#289) 2024-03-13 19:29:28 +02: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
AsdowandGitHub fc5573f73d Correct check for stance (#222)
Same issue as in commit 23ceb0f
2023-09-05 18:57:40 +03:00
AsdowandGitHub 23ceb0fa4c Fix bug in OCTH prone CTH calculation (by Seven) (#221)
GetToHitBonus() expects BOOLEAN for fProneStance argument, with no comparison to ANIM_PRONE, the ubEndHeight ends up adding bipod bonuses to *all* stances
2023-09-05 17:33:42 +03:00
rftrdevandGitHub b91871b518 Move grenade bonuses from Demolitions to Throwing (#202)
* Copy grenade settings from demolitions to throwing

* Fix setting strings

* Add throwing bonuses to the same spots as demolitions

* Delete grenade bonuses from Demolitions

* Update text

* Reapply throwing check
2023-08-11 11:27:29 -07: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
Sevenfm d0c5b366fb AICalcChanceToHitGun: take into account target facing for standing/crouched human targets (when not using SIDE_FACING_DIVISOR option).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9379 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-05-05 12:50:30 +00:00
rftr 7b57f834f6 unactivated turncoats ignore suspicious activity.
unactivated turncoats intentionally try to miss when shooting at mercs/militia.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9370 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-04-24 21:16:13 +00:00
rftr 87b0c7c6b7 new feature: madlab's robot can be upgraded
requires gamedir r2642

https://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=364403

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9338 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-03-21 17:34:49 +00:00
Shadooow 9122d7a7a6 CAN_FAN_THE_HAMMER = FALSE now disables the burst mode on pistols
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9319 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-03-13 19:43:25 +00:00
Sevenfm 1e94aea625 Don't apply mortar/GL default penalty for enemy/militia is they cannot have trait skills, improved code to support old skill system.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9313 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-03-01 18:20:46 +00:00
Shadooow c23d62de02 Makes it so that if ASSIGN_SKILL_TRAITS_TO_ENEMY or MILIATIA is disables then enemies or militia will not get penalties/bonuses from new traits which then should fix the issue where enemies do not use mortars at all when this option is disabled.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9312 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-03-01 17:49:24 +00:00
Sevenfm 1015614473 Play different sound when object drops into water, depending on object weight and type.
Play S_WATER_IMPACT1 when bullet hits water.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9294 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-02-08 10:17:38 +00:00
Shadooow 5e8fa16cb9 Added missing parenthesis to the code evaluating sightrange NCTH that could lead to issues.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9291 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-02-06 09:24:04 +00:00
Shadooow 68664bed77 fixed bleeding value not being substracted when losing max hp which resulted into the graphic HP bar having wrong color
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9189 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-18 08:26:32 +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
Flugente a93e9b4a9c Added helper functions to easier determine gun stats
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9158 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-08-27 20:48:19 +00:00
Flugente 102ee32232 Fix: when firing from several barrels with two guns, AP cost is deducted twice
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9145 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-24 11:00:59 +00:00
Shadooow d6f07a7ef5 godmode reworked: reused existing mechanism in code = same functionality, less code changes, also when enabled GOD MODE text will now show up in left corner in red color, this was already there I just uncommented it
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9128 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-06 19:06:23 +00:00
Shadooow 385210ba09 vehicles will no longer lose stats from critical hits
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9127 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-06 15:59:00 +00:00
Flugente 587b7e2874 Fix: reverted revert of 9115 and fixed the issue of guns always deteriorating in NCTH
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9119 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-28 14:39:45 +00:00
Shadooow 94f164eaa8 reverting commit 9088 as it causes regression of super high weapon deterioration
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9115 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-28 11:18:08 +00:00
Shadooow da940db97c god mode cheat code tweaks + preventing ability damage
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9098 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-22 00:20:12 +00:00
Flugente a7d7f4b93b Fix: crash due to overflow as a result of very low reliability values
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9088 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-19 10:27:13 +00:00
Flugente ff3076203f Fix: antimateriel bullet damage to structures often isn't properly applied
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9080 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-13 17:23:55 +00:00
Shadooow fe9dd67edc Fixed bug that resets melee attack aim location if the attack was stopped in interrupt.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9059 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-01 15:21:56 +00:00
Shadooow 5a2202f5b4 new feature: after throwing knives, put any throwing knife class item from second hand into main hand
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9037 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-22 15:07:28 +00:00
Sevenfm 205f4516d9 Missing part of previous fix (by Shadooow).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9022 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-13 05:19:22 +00:00
Sevenfm 037a70b253 Fix for drugged icon not displaying on merc portrait immediately when taking drug from map screen (by Shadooow).
Fix for playing full burst firing sound with less bullets than the usual for the gun burst fire in chamber (by Shadooow).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9011 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-07 18:12:32 +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 d66a05b0f4 NO_STANDING_ANIM_ADJUSTMENT_IN_COMBAT: apply only for player mercs, to avoid possible problems with AI.
CalcChanceHTH: only use reduced chance for boxers.
AIDoctorFriend, AIDoctorSelf: first change soldier to stationary.
AIDoctorFriend: change target to stationary.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8928 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-08 18:27:27 +00:00
Sevenfm 6ad8b22368 CalcChanceHTH: restored higher base chance for melee attacks.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8927 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-07 21:07:17 +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 dd9c6b1f3e ArtilleryStrike: supply GetArtilleryLaunchParams with launcher item and not just mortar shell, as it will check it's range later.
Add smoke after explosion: improved code.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8913 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-30 17:55:11 +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 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 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
Sevenfm d9c8a1c398 New tag <shotAnimation> in AmmoTypes.xml allows defining custom shot animation.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8800 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-05-13 06:31:11 +00:00
Sevenfm 7f8fc44a7d Improved code to update scope mode when changing stance.
ChangeScopeMode: use NOWHERE instead of 0 as incorrect target gridno.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8796 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-30 00:48:52 +00:00
Sevenfm 4e34605f86 Red, Black AI: try to use sidearm if not enough AP to shoot with main weapon.
Black AI: improved check to avoid friendly fire.
FindAIUsableObjClass: by default search for weapon with longest range, if fSidearm = TRUE search for fastest weapon.
AICalcChanceToHitGun: if AI_EXTRA_SUPPRESSION = TRUE, always return min 1% for AI.
RangeChangeDesire:
- civilians only want to run away
- added small bonus to range change desire if soldier has no gun or short range weapon
CalcBestShot, CheckIfShotPossible: always check if can shoot at target seen by another soldier.
CalcBestShot, CalcBestThrow, CalcBestStab: initialize attack data.
Removed obsolete code.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8782 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-08 21:24:56 +00:00
Sevenfm 5350258334 Added "WIP" description to LOBOT ingame option.
Fixed Polish localized string for LOBOT option.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8781 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-08 11:10:58 +00:00
Sevenfm 306eca7dfc New option NWSS enables New Weapon Sound System.
Increased SOUND_MAX_CHANNELS to 128 for NWSS to work correctly.
New tag in AmmoStrings.xml: <NWSSCaliber>
New tags in Weapons.xml: <ubNWSSCase>, <ubNWSSLast>, <szNWSSSound>
Fixed some warnings.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8780 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-05 23:58:07 +00:00
Sevenfm 560219ac36 Fixed delayed mode for grenades.
Changing delayed mode for grenade launcher only possible with DELAYED_GRENADE_EXPLOSION = FALSE.
Minor code improvements and warning fixes.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8771 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-03-14 10:39:18 +00:00
Sevenfm a6271e2e47 ExpAffect: don't spread fire on water.
StructureHit: check water level.
Only normal, stun and flashbang explosives create water explosion.
Increase max force when throwing items into water (to compensate for no bouncing).
Increased splash volume from LOWVOLUME to MIDVOLUME.
InternalIgniteExplosion: no fragments in water.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8752 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-02-13 15:57:10 +00:00
Sevenfm 74443ca8a9 New option TAUNT_VOICE (FALSE by default): if true, will play sound file instead of showing text.
New option TAUNT_VOICE_SHOW_INFO (FALSE by default): if true, will show debug info when playing voice taunt.
Restored JA2TESTVERSION for SpreadPatternLog.txt
Allow taunts from militia when using voice taunts.
Don't show noise text messages from militia (if on our side).
Fixed incorrect OKLIFE check in CheckStatusNearbyFriendlies().

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8743 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-02-07 10:13:16 +00:00
Sevenfm f54a91718b Play grenade pin sound (supports custom grenade pin sound with <sSound> tag in Weapons.xml)
Help AI associate noise with enemy presence: 
- melee attack noise type changed to NOISE_BULLET_IMPACT
- HTH attack noise type changed to NOISE_BULLET_IMPACT
- grenade pin noise type changed to NOISE_GRENADE_IMPACT
- launcher attack noise type changed to NOISE_GUNFIRE

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8728 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-11 17:15:17 +00:00