264 Commits
Author SHA1 Message Date
GreysaandAsdow 346e5c6293 fix for issue #580 2026-05-23 21:22:28 +03:00
Asdow 03a7b017b6 Change mouse cursor if attachment attempt fails 2026-05-06 23:23:07 +03:00
Asdow edf8f2f086 Fix crash when failing an attachment via item desc popup callback 2026-05-06 23:23:07 +03:00
Asdow 4fcf03d31a Include cleanup Tactical/.*cpp 2025-12-09 00:35:18 +02:00
Marco Antonio J. Costaandmajcosta 3d29eff4d8 use FormatMoney everywhere 2025-10-08 05:36:37 -03:00
Asdow 82aca548f5 Merge branch 'master' into ExtraMercs 2025-09-24 16:14:10 +03:00
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
Asdow c62d767622 Update to Master 2025-08-08 18:00:31 +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
Asdow 0d97e36c34 Use SoldierID 2024-11-21 23:56:44 +02:00
Asdow 07420ce245 Revert "Guard against out of bounds access"
This reverts commit c75f57785e.
2024-11-18 21:42:13 +02:00
Asdow c75f57785e Guard against out of bounds access
Can't trust a simple != check
2024-11-18 18:49:38 +02:00
Asdow b74ccf3ddc Convert to SoldierID 2024-11-17 23:45:48 +02:00
Asdow f50bdf99cc Convert to SoldierID 2024-11-17 20:41:09 +02:00
Asdow 34f0b40f93 Convert functions and globals to SoldierID 2024-11-17 14:53:52 +02:00
Asdow c475f9e4e6 Convert MapScreenCharacterSt::usSolID to SoldierID 2024-11-17 01:25:00 +02:00
Asdow 2918801f75 AddSoldierToSector & OBJECTTYPE::soldierID changed to SoldierID 2024-11-16 20:55:08 +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
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
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +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
Asdow 1f0a8f46e8 Import changes from the local SVN working copy 2022-10-10 10:08:44 +03: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