Commit Graph
4203 Commits
Author SHA1 Message Date
Marco Antonio J. Costa 33e8c1dc39 Move all the translated strings over to i18n
It's where all conditional language preprocessor goes
2024-12-31 16:28:44 -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. Costa cd69f5f3ae Make Chinese specific strings compile-time instead of conditional
eventually we'll switch between CHINESE and other languages during
runtime, so even if language is not chinese, these symbols must still
be there

these symbol names aren't used so this is fine
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa bf6de9f342 Move GetLanguagePrefix function into i18n 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 5d19c1fe25 make conditional CHINESE preprocessor def into global constant 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4624fe92f0 leave CHINESE struct member UINT8 Width[0x80]
this might cause a horrifying alignment bug, but I doubt it
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 3acd2cea97 move Ja 2 Libs.* to i18n
it has preprocessor silliness in it
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4d4e039da7 add an internationalization constant
gather all ENGLISH|GERMAN|CHINESE etc preprocessor hell into a single
library, so to restrict the number of targets that need to be built 8x

this still has UB/EDITOR definitions so that still needs to be dealt
with before we can build it only 8 times
2024-12-31 16:28:44 -03:00
Asdow 3cfde817ba Set table mouse_region priorities lower than bookmark bar 2024-12-30 21:21:30 +02:00
Marco Antonio J. Costaandmajcosta dd5cabc6ba actually make link-time optimization default to OFF
sorry, I lied in the last commit. didn't mean to
2024-12-29 07:29:13 -03:00
Marco Antonio J. Costaandmajcosta a83dfbefb0 add option to enable link time optimization
a bit slower to compile for developing so defaults to 'false', but
might be a good idea for the releases.
2024-12-27 18:17:20 -03:00
Marco Antonio J. Costaandmajcosta dc72a43a19 silence narrowing conversions in MSVC
we all know they're there, whenever someone fixes it (lol), this
should be removed
2024-12-27 03:08:36 -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
Marco Antonio J. Costaandmajcosta 0993789430 remove Language Defines file
we don't do it like that anymore, the build system takes care of it
2024-12-27 02:35:29 -03:00
Marco Antonio J. Costaandmajcosta 6b9997b9c5 we don't use USE_CODE_PAGE anymore 2024-12-26 11:51:31 -03:00
Asdow 4ed7b1fb98 Increase selection window size 2024-12-25 22:03:03 +02:00
Asdow 5499d1fba2 Whitespace formatting 2024-12-25 22:03:03 +02:00
Asdow 22af6e8ec8 Implement mousewheel scroll for selection window 2024-12-25 22:03:03 +02:00
Asdow a9ab60e5e5 Fix road tiles for big maps 2024-12-25 17:35:11 +02:00
Asdow c30b1c1b25 Reimplement UB pricing for AIM 2024-12-24 22:48:41 +02:00
Marco Antonio Jaguaribe Costaandmajcosta f4f48f23c7 cmake: favor vertical layout and absolute paths for include_directories
just the way git works should tilt us towards tall code rather than very
long lines, easier for merging/conflicts
2024-12-24 08:28:02 -03:00
Asdow 5b966b4df9 Provide MAX_TACTICAL_ENEMIES to lua 2024-12-24 00:16:09 +02:00
Asdow eb7837bc3e Increase filename buffer length
The mapeditor filedialog is big enough to show longer filenames than 20 characters.
2024-12-23 20:45:48 +02:00
Asdow c88fbbe749 Fix assertion error due to too long filenames 2024-12-23 20:45:48 +02:00
Asdow a580052e40 Read new tags
Maybe *this* time it'll finally be fixed. Sigh...
2024-12-23 19:26:37 +02:00
Asdow 7fa8ff930b Remove unused tag
PercentCounterForceFrequency is never read from items.xml and INVTYPE doesn't have a field for it either
2024-12-22 00:08:45 +02:00
Asdow c7d021f5f3 Read updated items.xml format
Requires accompanying GameDir change.

Removed ItemFlag as an xml tag and added  bitmask flags as their own individual tags. Makes modding easier when the flags can be modified without math in the xml files
2024-12-22 00:08:45 +02:00
KittyandGitHub bfc78e2ef8 Simplified rework foodsystem allowed items (#357)
Simplified rework foodsystem allowed items
now no more need for a tag when checking IsItemLegal for Food System
ontop of checking for foodpoints, now also check if is drug
as a result, as previously, all eatable food will be excluded without food system,
but now only if it isn't a drug at the same time
and no more tag to check for that in items.xml needed
2024-12-17 13:23:58 +01:00
kitty624 0bd932f20f Simplified rework foodsystem allowed items
simplified the previous commit, now no more need for a tag
when checking IsItemLegal for Food System, ontop of checking for foodpoints, now also check if is drug
as a result, as previously, all eatable food will be excluded without food system, but now only if it isn't a drug at the same time
and no more tag to check for that in items.xml needed
2024-12-17 13:13:37 +01:00
KittyandGitHub 28a51e0e7b Reworked foodsystem exclusive items
no food items if the food system is off
whether the item is exclusive is defined by tag in items.xml
replaced previous way of decision, which used Item[usItemIndex].foodtype > 0 as criteria
that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.)
2024-12-16 10:07:20 +01:00
kitty624 2fcba8b9f7 Reworked foodsystem exclusive items:
no food items if the food system is off
whether the item is exclusive is defined by tag in items.xml
replaced previous way of decision, which used Item[usItemIndex].foodtype > 0 as criteria
that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.)
2024-12-16 09:54:54 +01:00
Marco Antonio Jaguaribe Costaandmajcosta 184b44c386 a couple consistency extension changes
iniErrorReport is a log file, all other log files have .log extension, so make it
consistent with that

make Ja2_settings.ini's extension lowercase. OCD, sorry.
2024-12-15 15:25:28 -03:00
Marco Antonio J. Costaandmajcosta 86ad401186 add newline at end of file where it's lacking
.editorconfig already enforces it but it's getting changed piecemeal in
every commit. just get it done with.

the script:
```

find . -type f -not -path "./.git/*" -not -path "./.vs/*" | while read -r file; do
	isFile=$(file -0 "$file" | cut -d $'\0' -f2)
	case "$isFile" in
		(*text*)
			echo "$file is text"
			if [[ $(tail -c 1 "$file" | wc -l) -ne 1 ]]; then
				echo "" >> "$file"
			fi
			;;
		(*)
			echo "file isn't text"
			;;
	esac
done
```
2024-12-14 19:05:48 -03:00
Marco Antonio J. Costaandmajcosta 1d58bda82d cross-compilation scaffolding WIP
requires clang/lld or mingw, obviously

just make sure the MSVC_DIRECTORY env variable points to valid Visual Studio Build Tools directory
and do: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=clang_or_mingw_toolchain_file`
2024-12-13 19:24:59 -03:00
momoko-handGitHub 87f51f0f6e Fix warning C4715 in Music Control.cpp (#351) 2024-12-10 17:15:21 +02:00
Marco Antonio Jaguaribe Costaandmajcosta 98cdffe5fd (actually) fix broken MS2022 behavior
a recent Visual Studio update introduced an error unless there is a
CMakePresets.json file present, completely blowing up the previous
setup.

after this commit, you should either delete the CMakeUserPresets.json
file from your root or add it to your system - NOT repo! - excludesFile:
https://stackoverflow.com/questions/7335420/global-git-ignore
2024-12-09 14:19:25 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 2424066aab Revert "fix broken MS2022 behavior"
This reverts commit b89c63058f.
2024-12-09 13:45:08 -03:00
Marco Antonio Jaguaribe Costaandmajcosta b89c63058f fix broken MS2022 behavior
a recent Visual Studio update introduced an error unless there is a
CMakePresets.json file present, this patches it over for now and makes
note to remove it once this is fixed
2024-12-09 13:38:40 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 0b21d1d798 add a TODO file
put your TODOs here so you won't forget, or in case you do, maybe
someone can pick it up in the decades to come
2024-12-09 12:58:43 -03:00
AsdowandGitHub dcde413b7b Initialize AI morale to normal instead of hopeless (#345) 2024-12-05 23:05:50 +02:00
Asdow febb283c3a Allow bloodcats in RED state to roam farther
Bloodcat lair had a few cats with CLOSE PATROL orders, resulting them to move only 15 tiles from their starting point, allowing them to be picked off from afar with scoped rifles.
2024-12-05 22:56:57 +02:00
Asdow 678ef822ca Fix passive bloodcats 2024-12-05 22:56:57 +02:00
AsdowandGitHub 1eff9f6aaa Fix bloodcat ambush endless loop (#343)
Some bloodcats during ambushes could have ubInsertionDirection with values > 100, which then causes endless looping in pathfinding algorithms as valid direction values range from 0 to 7
2024-12-05 16:13:09 +02:00
AsdowandGitHub 11bb0f741f Fix music playing when crepitus is present (#341)
UseCreatureMusic( HostileZombiesPresent() ); was overriding the music mode set in PrepareCreaturesForBattle() when encountering crepitus or being in the creature caves, resulting in regular tense and battle music being played.
2024-12-02 01:10:58 +02:00
AsdowandGitHub 1cd94cda23 Fix inventory cloning bug (#338)
- If we have a sector already loaded (eg. Drassen airport)
- Squad in a different sector encounters enemies and goes to autoresolve
- After pressing DONE in autoresolve screen -> we miss calling the TrashWorld() function in CheckAndHandleUnloadingOfCurrentWorld() due to battle sector not being the same as loaded sector.
- Selected sector gets reset from Drassen airport to invalid values by same function
- Now we have the loaded sector's whole inventory existing in gWorldItems
 - Enter any other sector in tactical mode and the gWorldItems gets added into its sector inventory in EnterSector()

Because the TrashItems() work in a way where it only sets gWorldItems elements to not existing if it finds them in a loaded map's structure data, we will pretty much always have that original bugged out set of items present in gWorlItems and they will constantly be added to sector inventories from then on once the bug has been triggered.
2024-11-16 16:05:14 +02:00
AsdowandGitHub f48fadb802 Improve AbstractXMLParser error reporting (#330)
The more detailed error message that used to go only to Livelog.txt is now also displayed in the ingame error screen, providing more helpful error message to players when making bug reports/asking for help
2024-11-08 23:50:52 +02:00
KittyandGitHub 6497a35af9 Text EDB Pop-up Disease Protection adjusted ( #329)
- face protection had a misleading text, stating item should be worn at face
- that's no longer true, so adjusted text to avoid player confusion
- adjusted text to distinguish between both disease protections variations
2024-11-08 09:37:53 +01:00
kitty624 85ad2e5e72 Text EDB Pop-up Disease Protection adjusted
- face protection had a misleading text, stating item should be worn at face
- that's no longer true, so adjusted text to avoid player confusion
- adjusted text to distinguish between both disease protections variations
2024-11-08 09:08:38 +01:00
AsdowandGitHub 8040c5d826 Use functions for logging load & save game times (#328)
Less copy and paste. Allows these very simple timings to be logged from elsewhere as well.
2024-10-04 17:29:47 +03:00