Commit Graph
246 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
Marco Antonio J. Costa 73f7812165 Slightly less straightforward CHINESE conversion in Interface Items.cpp
A bit clunkier, had to repeat function calls because of how
preprocessor tricks don't map 1:1 with actual C++.
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa d008d10b31 Replace a ton of trivial #ifdefs with runtime checks
This one is big, but unless I missed something, should be all be
trivial.

scripted-diff with the following, then manually tweaked whatever needed:
```

if [ $# -ne 3 ]; then
    echo "Usage: $0 '<pattern>' '<replacement>' '<filename>'"
    exit 1
fi

pattern="$1"
replacement="$2"
filename="$3"

if [ ! -f "$filename" ]; then
    echo "Error: File $filename does not exist."
    exit 1
fi

sed -i '/'"$pattern"'/ {
    :loop
    $ !{
        N
        /'"$pattern"'.*\n.*#endif/ {
            s/'"$pattern"'/'"$replacement"'/
            s/#else/} else {/
            s/#endif/}/
            P
            D
        }
        /'"$pattern"'/ b loop
    }
}' "$filename"

echo "Replacement complete in $filename"
```

h/t to Grok2 for the sed command
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costaandmajcosta 897f684705 remove all #include's for Language Defines
scripted diff:

find . -type f -iname "*.h" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \;
find . -type f -iname "*.cpp" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \;
2024-12-27 02:35:29 -03: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
kitty624 72f01b5379 Fix Attachable Launchers Slot Tooltips
fix:
launchables made valid by attached launchers are now again  shown as tooltip and can be attached to slot with click

fixes

https://github.com/1dot13/source/issues/298
2024-04-10 09:22:01 +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
sun-alf f8637e5972 [~] Performance optimizations around Attachment[] and Launchable[] arrays
AIMNAS with its ~50K elements in Attachment[] suffered of performance drop when MOLLE stuff is in the visible inventory. To resolve it the following is done:
* Introduce gMAXATTACHMENTS_READ with actual number of elements in Attachment[]; according refactoring.
* Introduce gMAXLAUNCHABLES_READ with actual number of elements in Launchable[]; according refactoring.
* Introduce std::multimap AttachmentBackmap for quick access to attachments using itemId as a key.
* Sort Attachment[] by attachmentIndex right after loading from XML. According order in XML is not needed anymore.
* Introduce FindAttachmentRange() for quick access to attachments using attachmentId as a key (binary search in Attachment[]).
In a few words, GetHelpTextForItemInLaptop(), ValidAttachment(), SetAttachmentSlotsFlag() were heavily optimized.
2023-09-08 21:58:14 +03:00
AsdowandGitHub 2163a66169 Prevent writing past array capacity (#185)
Game would crash with stack-based buffer overrun when a MOLLE item had enough attachments and their texts were written past attachString capacity
2023-07-25 14:19:30 +03:00
AsdowandGitHub 35bb9a70ec Do not load language specific icon file (#146)
Unnecessary, as there is no translated text in the image files
2023-05-19 16:47:42 +03: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
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 682cbda213 Fixed graphic glitches, usually black screen or shadow boxes over the screen, appearing when inside the key ring popup box.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9326 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-03-16 22:38:32 +00:00
Shadooow 1503b32e30 Fixes random merc portraits sometimes appearing in a region where would merc inventory normally be when opening inventory of a vehicle.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9289 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-02-02 15:20:12 +00:00
Shadooow a57cc79c83 enabled new attachments to be shown even without EDB for all items except LBE gear
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9239 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-11 01:11:50 +00: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 d238927dd0 detaching attachment will no longer check for 12AP more than it should, this was kind of safety check, but it is confusing and not needed anymore
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9199 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-28 08:48:54 +00:00
Sevenfm d02547c7c8 When attaching launchable to attached launcher, use launcher's reload AP cost.
Don't apply ambidextrous attach speed bonus when attaching launchable to launcher.
When playing reload sounds, set volume and pan based on soldier's location.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9196 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-26 13:49:55 +00:00
Shadooow 566f8ab5d4 fixed exploit allowing to steal attachments from vendor items
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9168 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-09-24 01:45:04 +00:00
Shadooow 2e7071d1c7 highlighting fix: hovering over item will now highlight valid attachment that doesn't have attachment tag
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9111 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-27 02:52:51 +00:00
Shadooow 326b44787b improved inventory costs feature to show red straffing on pockets that soldier has not enough APs to move currently held item into
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9044 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-24 05:28:51 +00:00
Sevenfm 239005365f More highlighting changes (by Shadooow):
- unified the highlight behavior with currently held item in cursor to only ever highlight compatible items for that item (was the case in tactical, not in map screen)
- enabled the body silhouette in map screen to be lit up when hovering/holding consumable item just as it happens in tactical mode
- few small fixes correcting code I sent previously

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8999 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-04 09:56:58 +00:00
Sevenfm a9a6193a81 Another efficiency improvement for attachments validity check function - will not check all items in inventory to be a valid gun/ammo for tested item if the tested item is attachment/hidden addon (by Shadooow).
Significant improvement for the inventory panel item highlighting code on map screen. There is also a fix for wrong items highlighted when changing currently selected merc (by Shadooow).
Old code was constantly running update for highlights several times a second. Now it only happens when the mouse position first finds or loses an item in inventory.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8998 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-03 04:57:07 +00:00
Sevenfm 1db29862c8 Fix for incorrect highlighting attachments + lots of efficiency improvements (by Shadooow).
Code formatting.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8996 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-02 05:19:43 +00:00
Sevenfm 3784f56ce1 Fix: small GUI issue where the body silhouette in merc inventory turned dark after moving applicable item onto it and then out of it (by Shadooow).
Fix: GUI issue where the body silhouette wasn't lit up with some of the new consumable items such as energy drinks, etc. Also, empty canteen will no longer lit up the body silhouette anymore (by Shadooow).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8994 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-01 16:13:40 +00:00
Sevenfm f8768a557d Minor code improvement for r8924.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8925 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-01-31 14:37:38 +00:00
Sevenfm bc3b398b63 Use MAXITEMS + 1 max limit when checking transformations.
UpdateAttachmentTooltips: 
- separate items, launchables and attachments checks as they have different max limits
- improved searching of existing item in vector

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8924 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-01-31 13:48:21 +00:00
Sevenfm 0d969503c5 PopupAttachmentInfo class: added missing initializations in constructor.
DragSelection class: added missing initialization in constructor.
MERCPROFILEGEAR class: added missing copy constructor.
WORLDITEM class: added missing copy constructor.
BuildString class: added missing assignment operator.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8906 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-21 06:28:15 +00:00
Flugente dd9f2c28e8 Minor code cleanup
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8824 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-06-17 22:27:20 +00:00
Sevenfm 03d7fd5266 DrawItemUIBarEx: use GetGunOverheatDisplayPercentage so that OVERHEATING_DISPLAY_JAMPERCENTAGE option can have effect.
Minor code improvements.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8797 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-05-05 16:34:15 +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 26a1b0aa5a New option SHOW_BACKPACK_OWNER (TRUE by default): show backpack owner's name on the ground and in taking items interface.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8735 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-19 19:38:30 +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
Sevenfm 3efe899526 HandleItemPointerClick(): use correct target level.
CalcPreRecoilOffset(), CalcRecoilOffset(): fix counterforce calculation for weapon resting feature.
SOLDIERTYPE::GetAPBonus(): use THROUGH_STRATEGIC_MOVE instead of soldier's facing direction to determine sector type.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8719 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-12-22 05:57:52 +00:00
Flugente be7005c3f8 - Fix: messagebox flagmask is UINT32, not UINT16 or UINT8
- added flag to display messagebox buttons horizontally instead of vertically

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8661 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-02-10 14:03:28 +00:00
Flugente f4800dbacc Show scope mode on launchers
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8656 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-01-28 22:32:25 +00:00
Flugente e7f098c2f2 If DELAYED_GRENADE_EXPLOSION = TRUE in JA2_Options.ini, toggling fire modes on a grenade launcher toggles whether the grenades explode on impact or with a 1-turn delay.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8653 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-01-27 23:53:11 +00:00
Flugente a5e5ff6bd8 The new <BarrelConfiguration>-tag specifies how many bullets a gun shoots at once. Several values can be used. If no value is set, 1 will be used.
Toggling fire modes cycles between barrel configurations if several have been set.

Requires GameDir >= r2461

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8652 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2019-01-27 19:48:18 +00:00
Flugente 7a49e4921a Ammo colour in AmmoTypes.xml is now set using <red>/<green>/<blue> tags instead of <fontColour>/<grayed>/<offNormal>/<onNormal>.
For more information, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=355255&#msg_355255

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8627 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-10-06 17:51:25 +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 c320bd98d0 Removed WEAPON_RESTING_DISPLAY, DISPLAY_SCOPE_MODES and OVERHEATING_DISPLAY_THERMOMETER options (always show indicators if features are on instead)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8599 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-08-24 22:26:37 +00:00
silversurfer fed9ca298c - new modifiers "MISS_MAX_RADIUS_x" for grenades and mortar to set a max radius where they will land. Chance to hit something with explosives is now based more on skill than on luck.
- fixed infinite loop in function "RandomGridFromRadius" when min and max radius were 1
- fixed incorrect exit condition in function "RandomGridFromRadius" when min radius was 0
- fixed incorrect CtH calculation for mortar

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8598 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-08-22 17:54:24 +00:00
Flugente 2e86f6c0ef 'Disease->Diagnose' assignment also checks for contaminated items and marks them permanently
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8595 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-08-15 19:20:08 +00:00
Flugente 876b8f2502 Fix: possible crash during item transformation
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8520 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2018-02-17 19:23:03 +00:00
Flugente 35cdd64a92 Fix: redraw ammo count in EDB if button is dirty
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8439 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-08-06 20:20:18 +00:00
silversurfer d7f91064f0 Fixes (by The_Bob):
- Fixed index out of bounds in get items assignment check
- Fixed attachment popup not allowing more than one of the same attachment
- Improved timer control sanity check code
- Added timer adjustment for variable CPU frequency
- Added shortcut: ctrl+left-click on attachment to remove and drop it in sector inventory

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8400 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-04-14 08:34:20 +00:00
silversurfer fef0722178 Fixes (by The_Bob):
- Fixed random freeze on win8/10
- Fixed crash on mercs entering sector
- Fixed crash when using cover display (del/end)
- Fixed attachment popup showing incompatible attachments (crash/freeze/confusion on clicking the option)
- Fixed attachment popup positioning
- Fixed LBE contents corruption/deletion
- Fixed access violation (out of array bounds) in interrupt code
- Fixed a bunch of random old stuff
- Got the project to build on VS2015
- Improved popup class handling of grayed out options
- Improved performance of get item assignment check (added by Flugente)
- Added Ctrl+Space bind for testing/fixing broken LBE contents


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8399 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-04-12 08:09:12 +00:00
Flugente c2b3d1a5a0 Speed up inventory rendering by avoiding unnecessary function calls
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8394 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2017-03-11 15:35:39 +00:00