Commit Graph
111 Commits
Author SHA1 Message Date
Asdow b98732daa7 Convert gusSelectedSoldier to SoldierID 2024-11-15 19:06:34 +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 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
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +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 0cc70519d3 Widescreen UI patch (by Asdow).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9216 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-11-21 12:56:27 +00:00
Shadooow fbade9d355 fixed rain disappearing with NCTH
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9207 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-31 00:20:10 +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 191db0b2ac Fixed vs2010 compilation errors.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8914 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-11-01 05:01:11 +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
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
Flugente c5022fa1e5 New feature: turncoats can be created from enemies and ordered to switch sides
Requires GameDir >= r2535

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

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8811 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-05-30 00:13:42 +00:00
Sevenfm 84afe6b160 GetSoldierAboveGuyPositions:
- use max value so that animation and text do not overlap
- lowered Y offset for crouched stance

DrawSelectedUIAboveGuy:
- reduce vertical gap if not showing health bars

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8805 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-05-18 06:04:34 +00:00
Sevenfm 0578c2a89a New option: SOLDIER_TOOLTIP_DEBUG_AI shows additional AI debug information.
Show tooltips for all persons.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8784 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-11 11:13:53 +00:00
Sevenfm f10590587a New option AUTO_HIDE_PB (TRUE) enables auto hiding of the progress bar when mouse cursor is on the top map row.
AI soldiers will now avoid staying at top map row.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8723 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-05 08:20:42 +00:00
Sevenfm 54e7c1e24d DrawCTHIndicator: bAimTime -> bShownAimTime fix.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8694 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-09-25 18:40:51 +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 494dbc6e69 Store the profile type in the profile structure and remove superfluous code
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8620 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-09-24 19:36:28 +00:00
Flugente 2dbacd32de The following options have been moved from the campaign the campaign start screen to JA2_Options.ini:
- Maximum number of IMPs (now MAX_IMP_CHARACTERS (Default: 10))
- Enemies drop all items (now DROP_ALL (Default: FALSE))
- Merc Story Backgrounds (now BACKGROUNDS (Default: TRUE))
- Food System (now FOOD (Default: FALSE))
- Improved Interrupt System (now IMPROVED_INTERRUPT_SYSTEM (Default: TRUE))
- Inventory Manipulation Costs AP (now INVENTORY_MANIPULATION_COSTS_AP (Default: FALSE))

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

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8610 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-09-02 15:14:01 +00:00
Flugente 92e759555d - New enemy role: display whether an enemy carries a key
For more, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=21774&goto=352502&#msg_352502
- If ENHANCED_CLOSE_COMBAT_SYSTEM is on, stealing multiple items from an enemy is possible if he is not on alert

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8523 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-02-21 18:49:35 +00:00
Flugente 2fe522db4b Fix: compiler warnings
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8471 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-09-13 20:01:48 +00:00
silversurfer cedb77bffb Fixes (by Sevenfm):
- put back AIM_VISIBILITY calculation in function "CalcNewChanceToHitGun"
- fixed possible NULL pointer condition

Added an indicator to the NCTH cursor to show aiming penalty for moving target.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8294 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-09-03 11:56:00 +00:00
silversurfer 73e3e1172c Fix: gGameCTHConstants.BASE_CROUCHING_STANCE was missing from handling calculations in NCTH
- removed gGameExternalOptions.fUseNewCTHCalculation as it is not needed anymore
- cleaned up function CalcNewChanceToHitGun

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8281 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-08-06 10:44:42 +00:00
Sevenfm 90594fb43f ShowEnemyWeapon: bVisible fix
MinAPsToPunch fix: allow correct calculation when no target gridno supplied
World Items: don't allow max repair threshold less than current object status

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8261 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-06-25 10:31:55 +00:00
silversurfer 196a1eb84d AI and tactics improvements (by Sevenfm):
New options:
 AI_YELLOW_FLANKING - yellow flanking is disabled by default
 IMPROVED_TACTICAL_UI - use name color to show soldier's status (disguised, drunk)

Removed obsolete options:
 SHOW_COVER_INDICATOR
 SHOW_ENEMY_RANK_ICON
 SHOW_ENEMY_AWARENESS

Fixes and improvements:
 - collapsed enemies should not taunt
 - if soldier is unconscious, he can't see anything or anybody
 - ClosestReachableDisturbance - performance improvement
 - allow InternalGoAsFarAsPossibleTowards to jump over fences

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8226 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-05-20 18:25:33 +00:00
Flugente 9f52c940a8 New feature: individual militia creates small militia profiles that track a militia's history and allow it to be recreated, thereby maintaining the illusion of persistent militia.
Requires GameDir >= r2316.

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=tree&th=23044&goto=345324&#msg_345324

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8202 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-05-06 14:51:24 +00:00
Flugente def585ef80 The merc profile #71 (RPC71) is now used for all combat jeeps.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8116 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-03-21 21:30:10 +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
Flugente 908923e813 New display mode: "CTH mode" displays a very rough cth indication in the current merc's firing cone. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=344441&#msg_344441
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8099 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-03-08 22:36:39 +00:00
Flugente 330925b0ef When displaying a merc's maximum assignment points, factor in backgrounds values.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8050 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2016-02-05 22:18:05 +00:00
Flugente 929d15ec8a changed several variable names for body types to 'ubBodyType', as this is more consistent and allows wider use of macros
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7961 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2015-08-07 20:09:10 +00:00
Flugente b2217eaab9 Deleted Feature: The poison feature has been made obsolete by the disease feature and has been removed.
GameDir >= r2245 is recommended.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7870 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2015-05-20 20:39:51 +00:00
silversurfer 8ef0c1e353 Fix: It's not allowed to use scope modes other than iron sight and alternative weapon holding anymore when dual wielding guns.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7792 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2015-03-20 21:26:28 +00:00
silversurfer 8ae8c147f9 Fix (by Sevenfm): NCTH aperture was offset by 1 to the bottom right
EDB enhancement: rechamber display now includes effects from traits

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7765 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2015-03-02 17:15:29 +00:00
Flugente 499ff2db06 If the itemlist is huge and one uses New Inventory System, New Attachment System and a lot of MOLLE items, there is a noticable slowdown if inventory is open in tactical. I cleaned up code to ease that somewhat, but the problem will likely persist.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7600 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-10-19 21:53:05 +00:00
silversurfer a2be5b06c2 added new option to CTHConstants.ini:
IRON_SIGHTS_MAX_APERTURE_MODIFIER = 3.0

This modifies how fast the aperture grows for iron sights when IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT = TRUE

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7504 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-09-10 12:16:45 +00:00
Flugente 36e9d15edc New feature: Diseaes affect your mercenaries. They can be contracted in varíous ways and have varying effects.
For more info, see http://www.ja-galaxy-forum.com/ubbthreads.php/topics/334918#Post334918

Requires GameDir >= r2099.

Does not break savegame compatibility.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7384 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-08-10 13:45:11 +00:00
silversurfer 9f5aa4c227 Bugfix for crash in main menu when the player pressed 'n' for new game.
New option in CTHConstants.ini:
IRON_SIGHTS_MAX_APERTURE_USE_GRADIENT = FALSE/TRUE
When activated it will make iron sights more powerful over longer distances. This is an experimental switch. The formula might need to be tweaked.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7358 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-07-22 09:55:56 +00:00
Wanne ff34f538d9 Merged from revision: 7287
Fixes (by Buggler)
- Disabled calling reinforcements from patrol groups when queen wakes up as they will not be replenished (thanks anv)
- Fixed queen reinforcement pool being replenished on depletion when playing with limited enemy troops setting
- Alternative hotkey ~ (tilde) to toggle merc inventory in strategic screen like in tactical screen

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7288 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-06-23 17:46:10 +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
Flugente 5e9289b450 - New Feature: dynamic opinions allows mercs to form opinions about each other depening on actions they/the player take or do not take. These can be viewed in the 'MeLoDY 'website. See also http://www.bears-pit.com/board/ubbthreads.php/topics/333259.html#Post333259
- Requires GameDir r2050.
- new background property: <dislikebackground> allows mercs to dislike specific backgrounds
- Fix: snitches did not correctly prevent misbehaviour
- Fix: morale event was not handled
- Fix: DropDowns did not refresh when using the arrow buttons

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7240 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-28 22:10:42 +00:00
Flugente 038b559c3e - New: if KNOWN_NPCS_DIFFERENT_MAPCOLOUR is TRUE, friendly NPCs known to the player are displayed in dark blue to easier differentiate them from normal civilians
- cleaned up DrawSelectedUIAboveGuy()
- Fix: missing header
- when jumping through windows, damage received is somewhat randomized

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7221 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-19 20:47:42 +00:00
Wanne 666a9fdf22 - Improved NCTH cursor (by Sevenfm)
ja2_options.ini: IMPROVED_NCTH_CURSOR

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7213 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-18 15:42:56 +00:00
Wanne bbff053fc5 Driveable vehicle Update: Externalized vehicle seats (by anv)
- externalised vehicle seats (TableData\Vehicles.xml) influence position of passenger, field of view, ability to shoot and being hidden,
- seat can chosen by using ctrl+RMB on vehicle (ctrl + LMB just takes the first visible seat)
- seats can be changed or swapped while inside vehicle,
- remade JSD files for cars,
- vehicles aren't transparent anymore,
- vehicles are louder than people, depending how fast they move.
see: http://www.bears-pit.com/board/ubbthreads.php/topics/332790/5.html


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7212 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-18 15:26:15 +00:00
Flugente 1fe56555eb Drivable Cars update (by anv):
- Streamlined vehicle controls - no more selecting driver and vehicle separately, switching displayed APs and other esoteric activities. To move vehicle just select its driver and you're good to go. If you click on vehicle in tactical, also its driver will be selected automatically. Besides driving car, driver can perform other actions normally.
- Vehicle's APs, health and fuel are displayed on the steering wheel - thanks to Buggler for idea. Vehicle APs are treated as a resource (so if car changes driver mid-turn, it won't go any further than it would).
- Added option Tactical Interface Settings > ADD_PASSENGER_TO_ANY_SQUAD. If you order passenger to exit vehicle by clicking on the seat belt, he'll be added to new squad, so if you ordered six passengers to exit one by one, you'd end up with six new squads. With ADD_PASSENGER_TO_ANY_SQUAD = TRUE, passenger will be added to any existing squad with empty slot if possible.
- Added option Tactical Interface Settings > PASSENGER_LEAVING_SWITCH_TO_NEW_SQUAD. If you order passenger to exit vehicle by clicking on the seat belt, by default you get switched to his new squad. With PASSENGER_LEAVING_SWITCH_TO_NEW_SQUAD = FALSE you'll switch only if exiting passenger is the selected one.
- Cosmetic fix: changed display above vehicle from "*Merc's name* (VEHICLE)" to "*Merc's name* (*Vehicle's name*)" and colour from yellow to white (since mercs in vehicle are controllable and yellow is reserved for mercs on assignments).
- Fixed passengers rotation. Again.
- Fixed vehicles getting "tired" - lowered APs due to fuel below max. They can move the same as long as they have any fuel.
- Fixed unrelated bug: clicking on any empty slot in team panel would select merc with id 0.
- Fixed unrelated bug: switching to squad with less mercs would cause team panel to still show skill tooltips for mercs from previous squad on empty slots.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7204 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-13 20:50:16 +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
Flugente 2d1436aa5d Generals no longer become officers, as that would make it easier to identify them.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7187 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-02 23:30:11 +00:00
Flugente 3a7f7b263b Fix: wrong function calls
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7184 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2014-05-02 18:17:49 +00:00