129 Commits
Author SHA1 Message Date
CptMoore 9df885a264 Fixed tagged releases #2 2025-04-09 20:33:32 +02:00
CptMooreandGitHub 5ed70befb4 Fixed tagged releases (#429)
Fixed tagged releases
2025-04-09 19:52:23 +02:00
Asdow f21cb38647 Increase TileNo to UINT32
Bigmap grid number values go over uint16 max
2025-04-05 16:20:37 +03:00
Asdow 4823ef4929 Add check for vest position attachments 2025-03-06 17:39:35 +02:00
Asdow 586a46bb78 Remove last reference to gbPixelDepth 2025-02-24 23:08:52 +02:00
Asdow fffb3a45fb Remove 8bit mode
Obsolete and doesn't work

* Remove gbPixelDepth
* Remove 8-bit to 8-bit blitters
* FileNameForBPP now only calls strcopy
2025-02-24 21:42:36 +02:00
Asdow 9c951adfea Read correct variable from CTHconstants.ini 2025-02-24 16:11:58 +02:00
Asdow e3a542bf5d Exclude robots from trying to activate panic triggers 2025-02-14 16:47:03 +02:00
Asdow 222daead0e Remove unused ItemFlags
Detonator and Remote Detonator are specified by AttachmentClass
No items in items.xml actually even contained these flags.
2025-01-27 18:30:11 +02:00
Marco Antonio J. Costaandmajcosta ebd2e25e0f Fix a wrong #ifdef to runtime check conversion
I didn't get this right the first time, non-Chinese text was looking
funny in dialog boxes
2025-01-09 21:37:19 -03:00
Marco Antonio J. Costaandmajcosta ff8376d625 Keep UB specific enum value for all builds
but at the end, not beginning as to not make a mess

along with an intro.lua change in gamedir/Data-UB/Scripts this gets rid of a nasty preprocessor conditional in a header file
2025-01-09 21:34:07 -03:00
Marco Antonio J. Costaandmajcosta 7aa0e18352 Revert "make sure these steps run"
This reverts commit 1976dee738.

Revert "yet another fix for the github actions"

This reverts commit 552951795c.

Revert "make sure CI to assemble release on 'v*' tag push or manually"

This reverts commit 8897769f0d.
2025-01-07 16:51:30 -03:00
Marco Antonio J. Costaandmajcosta 1976dee738 make sure these steps run
otherwise there is no 'source' working directory for the final step
2025-01-07 14:13:46 -03:00
Marco Antonio J. Costaandmajcosta 552951795c yet another fix for the github actions
github.ref_name isn't 'master' when a tag is pushed, but the tag name,
so it won't trigger a release build when a 'v*' tag is pushed
2025-01-07 13:19:03 -03:00
Marco Antonio J. Costaandmajcosta 8897769f0d make sure CI to assemble release on 'v*' tag push or manually
also put bash script through shellcheck to be more posix compliant
2025-01-07 13:09:23 -03:00
Asdow dcf202990f Remove duplicate header includes 2025-01-05 17:08:02 +02:00
Asdow db40cd433e Move mapscreen bottom coordinates' initialization
Fixes radar map's initial  position in strategic screen being in the top right corner.
2025-01-05 17:08:02 +02:00
Marco Antonio J. Costaandmajcosta ac6a1504df add a space to string to prevent compilation errors in GB2312 2025-01-05 10:04:04 -03:00
Marco Antonio J. Costaandmajcosta 22e67f66fa Move wine.cpp into its own library
avoid extra compilations that way
2025-01-05 07:57:57 -03:00
FunkyFr3shandmajcosta fd6ffd8d69 automatically add needed dll override for Linux/macOS/Android (WINE) 2025-01-05 07:06:01 -03:00
Marco Antonio J. Costaandmajcosta f471b74f5b fix inconsistent case for a few files
you can now build in a case-sensitive filesystem
2025-01-04 13:14:22 -03:00
majcostaandGitHub 4a16698cdb CHINESE: actually display BobbyR amount purchased correctly at runtime (#398)
* Revert "Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n"

This reverts commit ecdc8916f2.

* actually display the amount purchased correctly at runtime
2025-01-03 21:03:09 -03:00
Marco Antonio J. Costaandmajcosta 846abf5f1c Convert Text.h to utf-8-sig and move ChineseSpecString* there
This time without mangling the characters
2025-01-02 13:53:27 -03:00
Marco Antonio J. Costaandmajcosta ed73bd07ae Revert "Make Chinese specific strings compile-time instead of conditional"
When these lines were edited, I likely opened _ChineseText.cpp in the
wrong encoding, and therefore saved it in the wrong encoding, mangling
the characters

This reverts commit cd69f5f3ae.
2025-01-02 13:53:27 -03:00
Marco Antonio J. Costaandmajcosta b908bcecb9 fix missing icon in executable
the Ja2.rc file needs to be in the add_executable target for the icon
to appear, and that one requires WinMain.

so get rid of dummy.cpp and put sgp/sgp.cpp in there
2025-01-02 08:02:52 -03:00
Marco Antonio J. Costaandmajcosta a7b0091a27 use link-time optimization when creating a release
it's a lot slower, but we don't release often
2025-01-01 18:10:47 -03:00
Marco Antonio J. Costaandmajcosta 7aafa7aada fix the GitHub actions for VS2022's quirk too
missed this change in 98cdffe5, fix it now
2025-01-01 18:10:47 -03:00
majcostaandGitHub 3e76e9525e Merge pull request #378 from majcosta/pr_remove_language_from_preprocessor
Get every language preprocessor conditional into one library
2024-12-31 18:32:50 -03:00
Marco Antonio J. Costa 959c29434e Adjust the build system
Language is now just built once per app (still some JA2UB conditionals
going on in there) but building everything should now take eight times
less work
2024-12-31 18:24:36 -03:00
Marco Antonio J. Costa e9686c0dca reformat CMakeLists.txt 2024-12-31 16:28:45 -03:00
Marco Antonio J. Costa 10037291f3 remove preprocessor from i18n Multi Language Graphic Utils.cpp 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 9ed713f952 move Utils/Multi Language Graphic Utils.* to i18n
has language preprocessor silliness, straight to jail
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa cccec0ef11 straggler in Utils/Font Control.cpp 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4a7625cef0 Slightly clunky RUSSIAN conversion 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 70f09471c2 just cast g_lang into lua's language code
because magically I got the enum order right first try
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa b15c4ef96c the really gnarly CHINESE #ifdef conversions
these seem to be right, chinese text appears to be flowing correctly
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa ecdc8916f2 Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n
Just awful
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 4b563fefc8 Slightly clunkier fix for RUSSIAN conditional 2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa cf0b4dfc40 Manual unrolling preprocessor stuff and added function
This function is just for GERMAN but it has a unique name so it's no
problem.

Had to slightly change how MercID gets populated
2024-12-31 16:28:44 -03:00
Marco Antonio J. Costa 5fb989a1fc Move Text.h over to i18n too
Never use relative paths for #includes. Didn't touch the rest because
out of scope.
2024-12-31 16:28:44 -03:00
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
AsdowandGitHub 93e89798ec Merc can be assigned to patient in well-fed state (#327)
Previously merc had to be in overfed state for both food and water
2024-10-02 21:24:02 +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
AsdowandGitHub ce02a488f0 Remove sleep() (#324)
Near instantaneous program exit when we let the CPU do its thing :)
2024-08-15 00:50:13 +03:00
AsdowandGitHub caa02cd6b7 Read new MercOpinions.xml format (#323)
Requires accompanying gameDir change.

MercOpinions.xml now only contains opinions that are not 0. A new tag with fields "id" and "modifier" are used instead of old ones that had 255 <Opinion%d> $value$ </Opinion%d> tags for all profiles.

Loading time of MercOpinions.xml went down from ~4.047 s to 0.011 s due to this change with default 1.13 VFS config.

A small cmd utility tool for converting existing MercOpinions.xml data into the new format is available at https://github.com/Asdow/JA2-ConvertXMLData/tree/master
2024-08-13 00:29:48 +03:00
AsdowandGitHub 3391c6d777 Ignore mercs away on minievents for food status updates (#322) 2024-08-11 13:30:49 +03:00
AsdowandGitHub 2307508a85 Use auto & to prevent an unnecessary copy (#321) 2024-08-10 21:56:35 +03:00
AsdowandGitHub a26845b608 Check that a dropped backpack belongs to a controllable merc (#320)
Fixes handle BP pickup behavior if a merc drops a backpack and then leaves the sector.
2024-08-10 20:14:15 +03:00
AsdowandGitHub f7f214f347 Fix CTD (#304)
Fix illegal array access when creating an IMP and the help texts are referenced.
With the missing comma, the array length was 5 and it's supposed to be 6.
2024-05-25 20:59:00 +03:00
KittyandGitHub c32d09b88e Merge pull request #302 from kitty624/source-dev
Rework of r9343 - simplyfied some things and removed unnecessary parts
2024-04-15 07:18:14 +02:00
kitty624 3bab6ef3b7 Update XML_Items.cpp
reworking r9343

- some leftover cleanup and formating
2024-04-15 02:28:49 +02:00
kitty624 b13bcaac71 Update Items.cpp
reworking r9343

- the part about Food System is obsolete, already was happening in code prior to r9343

- the flags got removed and a boolean is used instead, allowing a simpler function for the remaining disease

- wether an item is considered exclusive to disease feature or not is decided by usage of tag in items.xml
2024-04-15 01:33:47 +02:00
kitty624 71667aba27 Update XML_Items.cpp
reworking r9343

- part about food system was obsolete, that was already a thing prior to r9343 (see IsItemLegal)

- disease changed because instead of flag now boolean is used
2024-04-15 01:26:50 +02:00
kitty624 e386a66f03 Update Item Types.h
reworking r9343

- no need for Foodsystem flag, restricting food items to food system was already part of the code prior to r9343 (in IsItemLegal by silversurfer)
- for disease system changed flag to boolean
2024-04-15 01:22:26 +02:00
kitty624 c03bd3ff3a Update ShopKeeper Interface.cpp
reworking r9343

- already decided in IsItemlegal
- if it ain't legal, it won't be shown in ShopKeeperInventory, no need to bother with it again
2024-04-15 01:17:18 +02:00
kitty624 6650f70c93 Update AimMembers.cpp
reworking r9343

- this resulted in player being forced to choose features to allways see all possible merc gear sets

- loosing whole gearsets to avoid a few items is too much

- in some item-mods that even could result in some mercs not having any

- therefore deleted
2024-04-15 01:08:41 +02:00
KittyandGitHub cdb267ea17 Merge pull request #300 from kitty624/source-dev
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 issue #298
2024-04-10 09:26:50 +02: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
Marco Costaandmajcosta dee2415d4a simplify SOLDIERTYPE::GetDiseaseContactProtection( ) 2024-04-03 22:09:05 -03:00
Marco Costaandmajcosta 049ec47219 make OBJECTTYPE::Exists() const 2024-04-03 22:09:05 -03:00
Marco Costaandmajcosta d670383f3a add const accessor to Inventory 2024-04-03 22:09:05 -03:00
KittyandGitHub fad3a27059 Merge pull request #296 from kitty624/Backgrounds
Alternative IMP Background Selection
2024-03-19 22:43:33 +01:00
kitty624 682dbaa8fc Alternative IMP Background Selection
- two new options in ja2options.ini
 ALTERNATIVE IMP CREATION
- adds new additional backgrounds, exclusive to this option
- which IMP backgrounds will be available at selection is determined by previously made choices for skills, character traits and disablities
- if a tag in background is contradicting to content of skill/character/disability, it won't be shown at selection
- what's considered contradicting is based on what's been found in code for conntent of skill/character/disability
- i.e. HeatIntolerant adds a penalty for desert and tropical sectors, so don't show backgrounds that add bonus for those sectortypes instead
- a new tag <alt_impcreation, has been added to backgrounds for this as well
- if that tag is found, it will be considered as additional IMP background exclusive to the option

REDUCED IMP CREATION
- same as above, but this time only the new additional backgrounds will be avaialable at selection
- same rules for possible restrictions to be shown

ALTERNATIVE IMP CREATION is required for REDUCED IMP CREATION to work

For ja2options.ini, a new category, "Backgrounds" was created.
This will contain the two new options and the general option to enable backgrounds

Accompanying changes in gamedir:

INIEditorJA2Options.xml
ja2options.ini
backgrounds.xml
2024-03-19 19:37:16 +01:00
KittyandGitHub 42cbf3fdbb Merge branch '1dot13:master' into Backgrounds 2024-03-18 12:58:32 +01:00
KittyandGitHub 236eb08b68 Merge pull request #295 from andrzejfalkowski/xml-backgrounds-parse-fix
Fixed drugtypes and drugitems background tags causing subsequent tags in the same background to be skipped
2024-03-16 17:18:26 +01:00
Andrzej Fałkowski e6c5f95d73 Fixed drugtypes and drugitems background tags causing subsequent tags in the same background to be skipped 2024-03-16 15:48:22 +01:00
AsdowandGitHub bf01f87cb4 Revert "Cache result of evaluating strategicmap.lua (#32)" (#293)
This reverts commit 8f22d13fd9.
2024-03-16 13:00:04 +02:00
AsdowandGitHub 9dfbc7d394 Use correct gridno for XY conversion (#289) 2024-03-13 19:29:28 +02:00
KittyandGitHub 0616507282 Merge branch '1dot13:master' into Backgrounds 2024-02-18 01:46:43 +01:00
AsdowandGitHub 65698284c3 Re-enable extracover check for A* (#283)
Allows smarter pathfinding for AI, only done during turnbased pathing  to alleviate its extra cost
2024-02-11 14:57:53 +02:00
AsdowandGitHub 4338b5b909 Fix AI tactical retreat (#282)
Only perform tactical traversal if pSoldier is at the map edge
2024-02-11 12:42:21 +02:00
AsdowandGitHub ef69f9b2e6 Allow enemy to retreat (#279)
This check was preventing enemies from retreating into another sector if tactical AI retreat was enabled, leading into AI deadlock every time AI_ACTION_RUNAWAY was the decision.
2024-02-11 00:27:14 +02:00
AsdowandGitHub 28a4db0355 Guard against nullptr dereference (#278)
Encountered a situation where a pSoldier between bFirstID and bLastID was null and then we'd dereference it.
2024-02-10 17:18:19 +02:00
KittyandGitHub 6ef6303eb1 Merge branch '1dot13:master' into Backgrounds 2024-02-10 00:56:00 +01:00
KittyandGitHub 352459910c Merge branch '1dot13:master' into Backgrounds 2024-02-01 16:25:45 +01:00
KittyandGitHub 6840394610 Merge branch '1dot13:master' into Backgrounds 2024-01-03 03:01:34 +01:00
KittyandGitHub 668a4e96ad Merge branch '1dot13:master' into Backgrounds 2023-11-08 01:27:57 +01:00
KittyandGitHub 3fa6a4bd45 Merge branch '1dot13:master' into Backgrounds 2023-09-06 03:28:47 +02:00
KittyandGitHub 1c11c88598 Merge branch '1dot13:master' into Backgrounds 2023-09-03 13:36:35 +02:00
kitty624 0962319a43 Fix skill checks for backgrounds during IMP creation
fixed checks for major and minor traits determining available IMP backgrounds

edited disability trait case HEAT INTOLERANT

added case DEAF at disability traits
2023-08-31 02:55:51 +02:00
417 changed files with 4695 additions and 9890 deletions
-4
View File
@@ -169,8 +169,6 @@ jobs:
with: with:
language: ${{ matrix.language }} language: ${{ matrix.language }}
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }} assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
# TODO check if English and German build faster for code changes on master, if not remove caching
build-cache-enabled: ${{ matrix.language == 'English' || matrix.language == 'German' }}
# at least English and some other lang have to work # at least English and some other lang have to work
continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }} continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
@@ -188,7 +186,6 @@ jobs:
merge-multiple: true merge-multiple: true
- name: Checkout Repo - name: Checkout Repo
if: github.ref == 'refs/heads/master'
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
path: source path: source
@@ -215,7 +212,6 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
working-directory: source working-directory: source
run: | run: |
exit 0
gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+13 -20
View File
@@ -13,11 +13,6 @@ on:
required: true required: true
default: true default: true
type: boolean type: boolean
build-cache-enabled:
description: 'enable sscache'
required: true
default: false
type: boolean
continue-on-error: continue-on-error:
description: 'allows a language to fail, used when building all languages' description: 'allows a language to fail, used when building all languages'
required: false required: false
@@ -32,8 +27,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor] application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor]
env:
SCCACHE_GHA_ENABLED: ${{ inputs.build-cache-enabled }}
steps: steps:
- name: Checkout source - name: Checkout source
@@ -61,12 +54,22 @@ jobs:
sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp
cat Ja2/GameVersion.cpp cat Ja2/GameVersion.cpp
- name: Turn on link-time optimization?
if: fromJSON(inputs.assemble)
shell: bash
run: |
set -eux
echo "
LTO=ON
" >> $GITHUB_ENV
- name: Prepare build properties - name: Prepare build properties
shell: bash shell: bash
run: | run: |
set -eux set -eux
touch CMakeUserPresets.json touch CMakePresets.json
JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]') JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]')
JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]') JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]')
@@ -82,19 +85,9 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: x86 arch: x86
- name: Prepare build cache
if: ${{ inputs.build-cache-enabled }}
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ inputs.language }}_${{ matrix.application }}
save: ${{ github.ref == 'refs/heads/master' }}
variant: sccache
- name: Prepare build - name: Prepare build
run: > run: |
cmake -S . -B build -GNinja cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" -DLTO_OPTION="$Env:LTO"
-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_BUILD_TYPE=Release
-DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
- name: Build - name: Build
run: | run: |
cmake --build build/ -- -v cmake --build build/ -- -v
+1 -1
View File
@@ -6,6 +6,6 @@
/.vs/ /.vs/
/build/ /build/
/out/ /out/
/CMakePresets.json
/CMakeSettings.json /CMakeSettings.json
/CMakeUserPresets.json
/lib/ /lib/
+103 -55
View File
@@ -9,12 +9,27 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
option(LTO_OPTION "Enable link-time optimization if supported by compiler" OFF)
include(CheckIPOSupported)
check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX)
if(LinkTimeOptimization AND LTO_OPTION)
message(STATUS "Configuring WITH link-time optimization")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else()
message(STATUS "Configuring WITHOUT link-time optimization ${IpoError}")
endif()
option(ADDRESS_SANITIZER OFF) option(ADDRESS_SANITIZER OFF)
if(ADDRESS_SANITIZER) if(ADDRESS_SANITIZER)
message(STATUS "AddressSanitizer ENABLED for non-Release builds") message(STATUS "AddressSanitizer ENABLED for non-Release builds")
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>) add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
endif() endif()
if(MSVC)
add_compile_options("/wd4838")
endif()
# whether we are using MSBuild as a generator # whether we are using MSBuild as a generator
set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>) set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
@@ -23,7 +38,24 @@ set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE) add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
include_directories(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console) include_directories(
"${CMAKE_SOURCE_DIR}/Ja2"
"${CMAKE_SOURCE_DIR}/ext/VFS/include"
"${CMAKE_SOURCE_DIR}/Utils"
"${CMAKE_SOURCE_DIR}/TileEngine"
"${CMAKE_SOURCE_DIR}/TacticalAI"
"${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include"
"${CMAKE_SOURCE_DIR}/Tactical"
"${CMAKE_SOURCE_DIR}/Strategic"
"${CMAKE_SOURCE_DIR}/sgp"
"${CMAKE_SOURCE_DIR}/Ja2/Res"
"${CMAKE_SOURCE_DIR}/Lua"
"${CMAKE_SOURCE_DIR}/Laptop"
"${CMAKE_SOURCE_DIR}/Multiplayer"
"${CMAKE_SOURCE_DIR}/Editor"
"${CMAKE_SOURCE_DIR}/Console"
"${CMAKE_SOURCE_DIR}/i18n/include"
)
# external libraries # external libraries
add_subdirectory("ext/libpng") add_subdirectory("ext/libpng")
@@ -34,32 +66,46 @@ target_link_libraries(bfVFS PRIVATE 7z)
# ja2export utility # ja2export utility
add_subdirectory("ext/export/src") add_subdirectory("ext/export/src")
# static libraries whose source files, header files or header files included # static libraries whose translation units don't rely on Application preprocessor definitions.
# by header files do not rely on Applications or Languages preprocessor definitions, add_subdirectory(lua)
# and therefore only need to be compiled once. Good.
add_subdirectory(Lua)
add_subdirectory(Multiplayer) add_subdirectory(Multiplayer)
add_subdirectory(wine)
# static libraries whose source files, header files or header files included set(Ja2_Libraries
# by header files rely on Application and Language preprocessor definitions, and "${CMAKE_SOURCE_DIR}/binkw32.lib"
# therefore need to be compiled multiple times. Very Bad. "${CMAKE_SOURCE_DIR}/libexpatMT.lib"
"${CMAKE_SOURCE_DIR}/lua51.lib"
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
"Dbghelp.lib"
"Winmm.lib"
"ws2_32.lib"
bfVFS
Lua
Multiplayer
wine
)
# static libraries whose translation units rely on Application preprocessor definitions.
set(Ja2_Libs set(Ja2_Libs
TileEngine Console
TacticalAI Editor
Utils Ja2
Strategic Laptop
sgp ModularizedTacticalAI
Laptop sgp
Editor Strategic
Console Tactical
Tactical TacticalAI
ModularizedTacticalAI TileEngine
Utils
) )
foreach(lib IN LISTS Ja2_Libs) foreach(lib IN LISTS Ja2_Libs)
add_subdirectory(${lib}) add_subdirectory(${lib})
endforeach() endforeach()
add_subdirectory(Ja2) # language library relies on Application _and_ Language preprocessor definition. very bad.
add_subdirectory(i18n)
# simple function to validate Languages and Application choices # simple function to validate Languages and Application choices
include(cmake/ValidateOptions.cmake) include(cmake/ValidateOptions.cmake)
@@ -74,47 +120,49 @@ ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "Applica
# preprocessor definitions for Debug build, per the legacy MSBuild # preprocessor definitions for Debug build, per the legacy MSBuild
set(debugFlags $<IF:$<CONFIG:Debug>,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>) set(debugFlags $<IF:$<CONFIG:Debug>,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>)
# Due to widespread preprocessor definition abuse in the codebase, practically foreach(app IN LISTS ApplicationTargets)
# every library-language-executable combination is its own compilation target set(isEditor $<STREQUAL:${app},JA2MAPEDITOR>)
# TODO: refactor preprocessor usage onto, ideally, a single translation unit set(isUb $<STREQUAL:${app},JA2UB>)
foreach(lang IN LISTS LangTargets) set(isUbEditor $<STREQUAL:${app},JA2UBMAPEDITOR>)
foreach(exe IN LISTS ApplicationTargets) set(compilationFlags
set(Executable ${exe}_${lang})
# executable for an application/language combination, e.g. JA2_ENGLISH.exe
add_executable(${Executable} WIN32)
target_sources(${Executable} PRIVATE ${Ja2Src})
# Good libraries have already been built, can be simply linked here
target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $<IF:${usingMsBuild},legacy_stdio_definitions.lib,>)
target_link_options(${Executable} PRIVATE $<IF:${usingMsBuild},/SAFESEH:NO,>)
# for each app/lang combination, the Very Bad libraries need to be built,
# with the appropriate preprocessor definitions
foreach(lib IN LISTS Ja2_Libs)
# syntactic sugar to hopefully make this more readable
set(VeryBadLib ${Executable}_${lib})
set(isEditor $<STREQUAL:${exe},JA2MAPEDITOR>)
set(isUb $<STREQUAL:${exe},JA2UB>)
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
# static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib
add_library(${VeryBadLib})
target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
target_compile_definitions(${VeryBadLib} PUBLIC
$<IF:${isEditor},JA2EDITOR;JA2BETAVERSION,> $<IF:${isEditor},JA2EDITOR;JA2BETAVERSION,>
$<IF:${isUb},JA2UB;JA2UBMAPS,> $<IF:${isUb},JA2UB;JA2UBMAPS,>
$<IF:${isUbEditor},JA2UB;JA2UBMAPS;JA2EDITOR;JA2BETAVERSION,> $<IF:${isUbEditor},JA2UB;JA2UBMAPS;JA2EDITOR;JA2BETAVERSION,>
${debugFlags}
${lang}
) )
target_link_libraries(${Executable} PUBLIC ${VeryBadLib})
foreach(lib IN LISTS Ja2_Libs)
# library for an application, e.g. JA2UB_sgp
set(game_library ${app}_${lib})
add_library(${game_library})
target_sources(${game_library} PRIVATE ${${lib}Src})
target_compile_definitions(${game_library} PRIVATE ${compilationFlags} ${debugFlags})
endforeach() endforeach()
# for sgp only foreach(lang IN LISTS LangTargets)
target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") # executable for an application/language combination, e.g. JA2_ENGLISH.exe
target_link_libraries(${Executable}_sgp PUBLIC libpng) set(exe ${app}_${lang})
target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) add_executable(${exe} WIN32
sgp/sgp.cpp
Ja2/Res/ja2.rc
)
target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $<IF:${usingMsBuild},legacy_stdio_definitions.lib,>)
target_link_options(${exe} PRIVATE $<IF:${usingMsBuild},/SAFESEH:NO,>)
# language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n
set(language_library ${exe}_i18n)
add_library(${language_library})
target_sources(${language_library} PRIVATE ${i18nSrc})
target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags} ${lang})
target_link_libraries(${exe} PRIVATE ${language_library})
# go through all game libraries again and link them to the app/language executable
foreach(lib IN LISTS Ja2_Libs)
target_link_libraries(${exe} PRIVATE ${app}_${lib})
endforeach() endforeach()
endforeach()
# for SGP only
target_link_libraries(${app}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib")
target_link_libraries(${app}_sgp PRIVATE libpng)
target_compile_definitions(${app}_sgp PRIVATE NO_ZLIB_COMPRESSION)
endforeach() endforeach()
+2 -2
View File
@@ -152,7 +152,7 @@ void EntryInitEditorItemsInfo()
item = &Item[i]; item = &Item[i];
//if( Item[i].fFlags & ITEM_NOT_EDITOR ) //if( Item[i].fFlags & ITEM_NOT_EDITOR )
// continue; // continue;
if(item->notineditor) if(ItemIsNotInEditor(i))
continue; continue;
if( i == SWITCH || i == ACTION_ITEM ) if( i == SWITCH || i == ACTION_ITEM )
{ {
@@ -331,7 +331,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
continue; continue;
} }
item = &Item[usCounter]; item = &Item[usCounter];
if(item->notineditor) if(ItemIsNotInEditor(usCounter))
{ {
usCounter++; usCounter++;
continue; continue;
+8
View File
@@ -173,7 +173,15 @@ void LoadSaveScreenEntry()
vfs::CVirtualProfile* prof = it.value(); vfs::CVirtualProfile* prof = it.value();
memset(&FileInfo, 0, sizeof(GETFILESTRUCT)); memset(&FileInfo, 0, sizeof(GETFILESTRUCT));
strcpy(FileInfo.zFileName, "< "); strcpy(FileInfo.zFileName, "< ");
// Cut filename off if it's too long for the buffer
if (strlen(prof->cName.utf8().c_str()) > FILENAME_BUFLEN-4)
{
strncpy(FileInfo.zFileName+1, prof->cName.utf8().c_str(), FILENAME_BUFLEN-4);
}
else
{
strcat(FileInfo.zFileName, prof->cName.utf8().c_str()); strcat(FileInfo.zFileName, prof->cName.utf8().c_str());
}
strcat(FileInfo.zFileName, " >"); strcat(FileInfo.zFileName, " >");
FileInfo.zFileName[FILENAME_BUFLEN] = 0; FileInfo.zFileName[FILENAME_BUFLEN] = 0;
FileInfo.uiFileAttribs = FILE_IS_DIRECTORY; FileInfo.uiFileAttribs = FILE_IS_DIRECTORY;
+1 -1
View File
@@ -1,7 +1,7 @@
#include "BuildDefines.h" #include "BuildDefines.h"
#include "Fileman.h" #include "Fileman.h"
#define FILENAME_BUFLEN (20 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213 #define FILENAME_BUFLEN (30 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213
#ifdef JA2EDITOR #ifdef JA2EDITOR
+34 -6
View File
@@ -403,14 +403,42 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID )
while( gRoadMacros[ i ].sMacroID == iMacroID ) while( gRoadMacros[ i ].sMacroID == iMacroID )
{ {
// need to recalc MACROSTRUCT::sOffset 'cause it sticked to 160*160 old map size // need to recalc MACROSTRUCT::sOffset 'cause it sticked to 160*160 old map size
INT32 sdX = gRoadMacros[ i ].sOffset % OLD_WORLD_COLS; INT32 sdY = gRoadMacros[ i ].sOffset / (OLD_WORLD_COLS);
INT32 sdY = gRoadMacros[ i ].sOffset / OLD_WORLD_COLS; INT32 sdX = gRoadMacros[ i ].sOffset - (sdY*OLD_WORLD_COLS);
INT32 sOffset = sdY*WORLD_COLS + sdX;
// Take into account the dfference between old and new row size for tiles that are shifted
// by one row due to X offset
// For example:
// {RBR, 159},
//{ RBR, -159 },
// //
AddToUndoList( iMapIndex + sOffset ); // Offsets for 160x160 map
RemoveAllObjectsOfTypeRange( iMapIndex + sOffset, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); // [] [] [-159]
// [] [0] []
// [159] [] []
//
// Converted to 200x200 map
// [] [] [-199]
// [] [0] []
// [199] [] []
//
// Without this the original conversion would output 159 and -159 for X coordinate
if (sdX < -OLD_WORLD_COLS/2)
{
sdX -= WORLD_COLS - OLD_WORLD_COLS;
}
else if (sdX > OLD_WORLD_COLS / 2)
{
sdX += WORLD_COLS - OLD_WORLD_COLS;
}
INT32 sOffset = sdY*WORLD_COLS + sdX;
INT32 newGridNo = iMapIndex + sOffset;
AddToUndoList( newGridNo );
RemoveAllObjectsOfTypeRange( newGridNo, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES );
GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex ); GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex );
AddObjectToHead( iMapIndex + sOffset, usTileIndex ); AddObjectToHead( newGridNo, usTileIndex );
i++; i++;
} }
} }
+18 -4
View File
@@ -1,4 +1,4 @@
#include "builddefines.h" #include "builddefines.h"
#ifdef JA2EDITOR #ifdef JA2EDITOR
@@ -1069,10 +1069,7 @@ void ShowCurrentDrawingMode( void )
// Set the color for the window's border. Blueish color = Normal, Red = Fake lighting is turned on // Set the color for the window's border. Blueish color = Normal, Red = Fake lighting is turned on
usFillColor = GenericButtonFillColors[0]; usFillColor = GenericButtonFillColors[0];
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
if(gbPixelDepth==16)
RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf );
else if(gbPixelDepth==8)
RectangleDraw8( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf );
UnLockVideoSurface( FRAME_BUFFER ); UnLockVideoSurface( FRAME_BUFFER );
@@ -2954,6 +2951,23 @@ UINT32 WaitForSelectionWindowResponse( void )
} }
} }
// Mousewheel scroll
if (_WheelValue > 0)
{
while (_WheelValue--)
{
ScrollSelWinUp();
}
}
else
{
while (_WheelValue++)
{
ScrollSelWinDown();
}
}
_WheelValue = 0;
if ( DoWindowSelection( ) ) if ( DoWindowSelection( ) )
{ {
fSelectionWindow = FALSE; fSelectionWindow = FALSE;
+60 -36
View File
@@ -29,6 +29,16 @@ extern BOOLEAN fDontUseRandom;
extern UINT16 GenericButtonFillColors[40]; extern UINT16 GenericButtonFillColors[40];
struct SelectionWindow
{
SGPRect window;
SGPPoint displayAreaStart; // Area where selectable items are drawn
SGPPoint displayAreaEnd;
SGPPoint spacing; // For displayed items
};
SelectionWindow gSelection;
BOOLEAN gfRenderSquareArea = FALSE; BOOLEAN gfRenderSquareArea = FALSE;
INT16 iStartClickX,iStartClickY; INT16 iStartClickX,iStartClickY;
INT16 iEndClickX,iEndClickY; INT16 iEndClickX,iEndClickY;
@@ -40,7 +50,6 @@ INT32 iSelectWin,iCancelWin,iScrollUp,iScrollDown,iOkWin;
BOOLEAN fAllDone=FALSE; BOOLEAN fAllDone=FALSE;
BOOLEAN fButtonsPresent=FALSE; BOOLEAN fButtonsPresent=FALSE;
SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint;
//These definitions help define the start and end of the various wall indices. //These definitions help define the start and end of the various wall indices.
//This needs to be maintained if the walls change. //This needs to be maintained if the walls change.
@@ -172,6 +181,30 @@ UINT16 SelWinHilightFillColor = 0x23BA; //blue, formerly 0x000d a kind of mediu
// //
void CreateJA2SelectionWindow( INT16 sWhat ) void CreateJA2SelectionWindow( INT16 sWhat )
{ {
auto selectWinWidth = 600;
const auto selectWinHeight = SCREEN_HEIGHT - 120; // From top edge to taskbar
if (iResolution > _800x600)
{
selectWinWidth = 900;
}
auto tlX = 0;
auto tlY = 0;
auto brX = tlX + selectWinWidth;
auto brY = tlY + selectWinHeight;
gSelection.window.iLeft = tlX;
gSelection.window.iTop = tlY;
gSelection.window.iRight = brX;
gSelection.window.iBottom = brY;
gSelection.displayAreaStart.iX = tlX + 1;
gSelection.displayAreaStart.iY = tlY + 15;
gSelection.displayAreaEnd.iX = brX - 1;
gSelection.displayAreaEnd.iY= brY - 1;
gSelection.spacing.iX = 2;
gSelection.spacing.iY = 2;
iTopWinCutOff = gSelection.displayAreaStart.iY;
iBotWinCutOff = gSelection.displayAreaEnd.iY;
DisplaySpec *pDSpec; DisplaySpec *pDSpec;
UINT16 usNSpecs; UINT16 usNSpecs;
@@ -185,32 +218,33 @@ void CreateJA2SelectionWindow( INT16 sWhat )
iButtonIcons[ SEL_WIN_DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" ); iButtonIcons[ SEL_WIN_DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" );
iButtonIcons[ SEL_WIN_OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" ); iButtonIcons[ SEL_WIN_OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" );
iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH,
iSelectWin = CreateHotSpot(0, 0, selectWinWidth, selectWinHeight, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, SelWinClkCallback); DEFAULT_MOVE_CALLBACK, SelWinClkCallback);
iOkWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_OK_ICON], 0, iOkWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_OK_ICON], 0,
BUTTON_USE_DEFAULT, 600, 0, BUTTON_USE_DEFAULT, selectWinWidth, 0,
40, 40, BUTTON_TOGGLE, 40, 40, BUTTON_TOGGLE,
MSYS_PRIORITY_HIGH, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, OkClkCallback); DEFAULT_MOVE_CALLBACK, OkClkCallback);
SetButtonFastHelpText(iOkWin,pDisplaySelectionWindowButtonText[0]); SetButtonFastHelpText(iOkWin,pDisplaySelectionWindowButtonText[0]);
iCancelWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_CANCEL_ICON], 0, iCancelWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_CANCEL_ICON], 0,
BUTTON_USE_DEFAULT, 600, 40, BUTTON_USE_DEFAULT, selectWinWidth, 40,
40, 40, BUTTON_TOGGLE, 40, 40, BUTTON_TOGGLE,
MSYS_PRIORITY_HIGH, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, CnclClkCallback); DEFAULT_MOVE_CALLBACK, CnclClkCallback);
SetButtonFastHelpText(iCancelWin,pDisplaySelectionWindowButtonText[1]); SetButtonFastHelpText(iCancelWin,pDisplaySelectionWindowButtonText[1]);
iScrollUp = CreateIconButton((INT16)iButtonIcons[SEL_WIN_UP_ICON], 0, iScrollUp = CreateIconButton((INT16)iButtonIcons[SEL_WIN_UP_ICON], 0,
BUTTON_USE_DEFAULT, 600, 80, BUTTON_USE_DEFAULT, selectWinWidth, 80,
40, 160, BUTTON_NO_TOGGLE, 40, 160, BUTTON_NO_TOGGLE,
MSYS_PRIORITY_HIGH, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, UpClkCallback); DEFAULT_MOVE_CALLBACK, UpClkCallback);
SetButtonFastHelpText(iScrollUp,pDisplaySelectionWindowButtonText[2]); SetButtonFastHelpText(iScrollUp,pDisplaySelectionWindowButtonText[2]);
iScrollDown = CreateIconButton((INT16)iButtonIcons[SEL_WIN_DOWN_ICON], 0, iScrollDown = CreateIconButton((INT16)iButtonIcons[SEL_WIN_DOWN_ICON], 0,
BUTTON_USE_DEFAULT, 600, 240, BUTTON_USE_DEFAULT, selectWinWidth, 240,
40, 160, BUTTON_NO_TOGGLE, 40, 160, BUTTON_NO_TOGGLE,
MSYS_PRIORITY_HIGH, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, DwnClkCallback); DEFAULT_MOVE_CALLBACK, DwnClkCallback);
@@ -218,18 +252,6 @@ void CreateJA2SelectionWindow( INT16 sWhat )
fButtonsPresent = TRUE; fButtonsPresent = TRUE;
SelWinSpacing.iX = 2;
SelWinSpacing.iY = 2;
SelWinStartPoint.iX = 1;
SelWinStartPoint.iY = 15;
iTopWinCutOff = 15;
SelWinEndPoint.iX = 599;
SelWinEndPoint.iY = 359;
iBotWinCutOff = 359;
switch( sWhat ) switch( sWhat )
{ {
@@ -347,8 +369,8 @@ void CreateJA2SelectionWindow( INT16 sWhat )
return; return;
} }
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &gSelection.displayAreaStart , &gSelection.displayAreaEnd,
&SelWinSpacing, CLEAR_BACKGROUND); &gSelection.spacing, CLEAR_BACKGROUND);
} }
@@ -849,12 +871,14 @@ void RenderSelectionWindow( void )
return; return;
ColorFillVideoSurfaceArea(FRAME_BUFFER, ColorFillVideoSurfaceArea(FRAME_BUFFER,
0, 0, 600, 400, gSelection.window.iLeft, gSelection.window.iTop, gSelection.window.iRight, gSelection.window.iBottom,
GenericButtonFillColors[0]); GenericButtonFillColors[0]
);
DrawSelections( ); DrawSelections( );
MarkButtonsDirty(); MarkButtonsDirty();
RenderButtons( ); RenderButtons( );
// Draw selection rectangle
if ( gfRenderSquareArea ) if ( gfRenderSquareArea )
{ {
button = ButtonList[iSelectWin]; button = ButtonList[iSelectWin];
@@ -862,7 +886,7 @@ void RenderSelectionWindow( void )
return; return;
if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) || if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) ||
(abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) ) (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY)) > 9) )
{ {
// iSX = (INT32)iStartClickX; // iSX = (INT32)iStartClickX;
// iEX = (INT32)button->Area.MouseXPos; // iEX = (INT32)button->Area.MouseXPos;
@@ -870,7 +894,7 @@ void RenderSelectionWindow( void )
// iEY = (INT32)(button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY); // iEY = (INT32)(button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY);
iSX = iStartClickX; iSX = iStartClickX;
iSY = iStartClickY - iTopWinCutOff + SelWinStartPoint.iY; iSY = iStartClickY - iTopWinCutOff + gSelection.displayAreaStart.iY;
iEX = gusMouseXPos; iEX = gusMouseXPos;
iEY = gusMouseYPos; iEY = gusMouseYPos;
@@ -889,10 +913,10 @@ void RenderSelectionWindow( void )
iEY ^= iSY; iEY ^= iSY;
} }
iEX = min( iEX, 600 ); iEX = min( gSelection.displayAreaEnd.iX, iEX);
iSY = max( SelWinStartPoint.iY, iSY ); iSY = max( gSelection.displayAreaStart.iY, iSY );
iEY = min( 359, iEY ); iEY = min( gSelection.displayAreaEnd.iY, iEY );
iEY = max( SelWinStartPoint.iY, iEY ); iEY = max( gSelection.displayAreaStart.iY, iEY );
usFillColor = Get16BPPColor(FROMRGB(255, usFillGreen, 0)); usFillColor = Get16BPPColor(FROMRGB(255, usFillGreen, 0));
usFillGreen += usDir; usFillGreen += usDir;
@@ -928,7 +952,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason )
return; return;
iClickX = button->Area.MouseXPos; iClickX = button->Area.MouseXPos;
iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY;
if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN)
{ {
@@ -1035,9 +1059,9 @@ void DisplaySelectionWindowGraphicalInformation()
UINT16 y; UINT16 y;
//Determine if there is a valid picture at cursor position. //Determine if there is a valid picture at cursor position.
//iRelX = gusMouseXPos; //iRelX = gusMouseXPos;
//iRelY = gusMouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; //iRelY = gusMouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY;
y = gusMouseYPos + iTopWinCutOff - (UINT16)SelWinStartPoint.iY; y = gusMouseYPos + iTopWinCutOff - (UINT16)gSelection.displayAreaStart.iY;
pNode = pDispList; pNode = pDispList;
fDone = FALSE; fDone = FALSE;
while( (pNode != NULL) && !fDone ) while( (pNode != NULL) && !fDone )
@@ -1470,10 +1494,10 @@ void DrawSelections( void )
{ {
SGPRect ClipRect, NewRect; SGPRect ClipRect, NewRect;
NewRect.iLeft = SelWinStartPoint.iX; NewRect.iLeft = gSelection.displayAreaStart.iX;
NewRect.iTop = SelWinStartPoint.iY; NewRect.iTop = gSelection.displayAreaStart.iY;
NewRect.iRight = SelWinEndPoint.iX; NewRect.iRight = gSelection.displayAreaEnd.iX;
NewRect.iBottom = SelWinEndPoint.iY; NewRect.iBottom = gSelection.displayAreaEnd.iY;
GetClippingRect(&ClipRect); GetClippingRect(&ClipRect);
SetClippingRect(&NewRect); SetClippingRect(&NewRect);
@@ -1483,7 +1507,7 @@ void DrawSelections( void )
SetObjectShade( gvoLargeFontType1, 0 ); SetObjectShade( gvoLargeFontType1, 0 );
// SetObjectShade( gvoLargeFont, 0 ); // SetObjectShade( gvoLargeFont, 0 );
DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND ); DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &gSelection.displayAreaStart, CLEAR_BACKGROUND );
SetObjectShade( gvoLargeFontType1, 4 ); SetObjectShade( gvoLargeFontType1, 4 );
+2 -17
View File
@@ -14,7 +14,6 @@ set(Ja2Src
"${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp"
@@ -28,25 +27,11 @@ set(Ja2Src
"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Screens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/TimeLogging.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp"
${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc
PARENT_SCOPE)
set(Ja2_Libraries
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
Lua
"${CMAKE_SOURCE_DIR}/lua51.lib"
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
"Winmm.lib"
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
"${CMAKE_SOURCE_DIR}/binkw32.lib"
bfVFS
"ws2_32.lib"
Multiplayer
PARENT_SCOPE) PARENT_SCOPE)
-1
View File
@@ -1,7 +1,6 @@
#ifndef _CHEATS__H_ #ifndef _CHEATS__H_
#define _CHEATS__H_ #define _CHEATS__H_
#include "Language Defines.h"
extern UINT8 gubCheatLevel; extern UINT8 gubCheatLevel;
-1
View File
@@ -1,6 +1,5 @@
#include "Types.h" #include "Types.h"
#include "Credits.h" #include "Credits.h"
#include "Language Defines.h"
#include "vsurface.h" #include "vsurface.h"
#include "mousesystem.h" #include "mousesystem.h"
#include "Text.h" #include "Text.h"
-4
View File
@@ -681,13 +681,9 @@ BOOLEAN UpdateSaveBufferWithBackbuffer(void)
pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES);
pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES);
if(gbPixelDepth==16)
{
// BLIT HERE
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
}
UnLockVideoSurface(FRAME_BUFFER); UnLockVideoSurface(FRAME_BUFFER);
UnLockVideoSurface(guiSAVEBUFFER); UnLockVideoSurface(guiSAVEBUFFER);
-1
View File
@@ -26,7 +26,6 @@
#include "Text.h" #include "Text.h"
#include "Interface Control.h" #include "Interface Control.h"
#include "Message.h" #include "Message.h"
#include "Language Defines.h"
#include "Multi Language Graphic Utils.h" #include "Multi Language Graphic Utils.h"
#include "Map Information.h" #include "Map Information.h"
#include "Sys Globals.h" #include "Sys Globals.h"
+11 -4
View File
@@ -10,7 +10,6 @@
#include "GameVersion.h" #include "GameVersion.h"
#include "LibraryDataBase.h" #include "LibraryDataBase.h"
#include "Debug.h" #include "Debug.h"
#include "Language Defines.h"
#include "HelpScreen.h" #include "HelpScreen.h"
#include "INIReader.h" #include "INIReader.h"
#include "Shade Table Util.h" #include "Shade Table Util.h"
@@ -45,7 +44,7 @@
#include <vfs/Core/vfs_file_raii.h> #include <vfs/Core/vfs_file_raii.h>
#include <vfs/Core/File/vfs_file.h> #include <vfs/Core/File/vfs_file.h>
#define GAME_SETTINGS_FILE "Ja2_Settings.INI" #define GAME_SETTINGS_FILE "Ja2_Settings.ini"
#define FEATURE_FLAGS_FILE "Ja2_Features.ini" #define FEATURE_FLAGS_FILE "Ja2_Features.ini"
@@ -992,8 +991,16 @@ void LoadGameExternalOptions()
//Madd: set number of pItem files to be used //Madd: set number of pItem files to be used
gGameExternalOptions.ubNumPItems = iniReader.ReadInteger("Data File Settings","NUM_P_ITEMS", 3, 3, MAX_PITEMS); gGameExternalOptions.ubNumPItems = iniReader.ReadInteger("Data File Settings","NUM_P_ITEMS", 3, 3, MAX_PITEMS);
//################# Backgrounds #################
// Flugente: backgrounds // Flugente: backgrounds
gGameExternalOptions.fBackGround = iniReader.ReadBoolean("Data File Settings", "BACKGROUNDS", TRUE ); gGameExternalOptions.fBackGround = iniReader.ReadBoolean("Backgrounds", "ENABLE_BACKGROUNDS", TRUE );
// Kitty: show additional IMP backgrounds and determine which IMP backgrounds are available at selection based on choices for skills, chararcter traits and disabilities
gGameExternalOptions.fAltIMPCreation = iniReader.ReadBoolean("Backgrounds", "ALTERNATIVE_IMP_CREATION", FALSE);
// Kitty: only show additional IMP backgrounds enabled by AlternativeImpCreation (same rules which are shown as with AlternativeImpCreation)
gGameExternalOptions.fReducedIMPCreation = iniReader.ReadBoolean("Backgrounds", "REDUCED_IMP_CREATION", FALSE);
//################# Merc Recruitment Settings ################# //################# Merc Recruitment Settings #################
@@ -3786,7 +3793,7 @@ void LoadCTHConstants()
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_WIS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_WIS",1.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_WIS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_WIS",1.0, 0.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AGI = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AGI",1.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AGI = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AGI",1.0, 0.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_EXP_LEVEL = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_EXP_LEVEL",2.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_EXP_LEVEL = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_EXP_LEVEL",2.0, 0.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_TRACER_BONUS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_TRACER_BONUS",10.0, -1000.0, 1000.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_TRACER_BONUS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_TRACER_BONUS",10.0, -1000.0, 1000.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_ANTICIPATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_ANTICIPATION",25.0, -1000.0, 1000.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_ANTICIPATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_ANTICIPATION",25.0, -1000.0, 1000.0);
gGameCTHConstants.RECOIL_COUNTER_ACCURACY_COMPENSATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_COMPENSATION",2.0, 0.0, 5.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_COMPENSATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_COMPENSATION",2.0, 0.0, 5.0);
+7
View File
@@ -337,6 +337,7 @@ BOOLEAN UsingBackGroundSystem();
BOOLEAN UsingImprovedInterruptSystem(); BOOLEAN UsingImprovedInterruptSystem();
BOOLEAN UsingInventoryCostsAPSystem(); BOOLEAN UsingInventoryCostsAPSystem();
BOOLEAN IsNIVModeValid(bool checkRes = true); BOOLEAN IsNIVModeValid(bool checkRes = true);
// Snap: Options read from an INI file in the default of custom Data directory // Snap: Options read from an INI file in the default of custom Data directory
@@ -1559,6 +1560,12 @@ typedef struct
// Flugente: backgrounds // Flugente: backgrounds
BOOLEAN fBackGround; BOOLEAN fBackGround;
// Kitty: Alternative IMP Creation (choices in skills/char-traits/disabilities determine available backgrounds, plus additional available backgrounds)
BOOLEAN fAltIMPCreation;
// Kitty: Reduced IMP Backgrounds (same as fAltIMPCreation, but for this only the additional backgrounds)
BOOLEAN fReducedIMPCreation;
// Sandro: Alternative weapon holding (rifles fired from hip / pistols fired one-handed) // Sandro: Alternative weapon holding (rifles fired from hip / pistols fired one-handed)
UINT8 ubAllowAlternativeWeaponHolding; UINT8 ubAllowAlternativeWeaponHolding;
UINT8 ubToAltWeaponHoldReadyAPsPerc; UINT8 ubToAltWeaponHoldReadyAPsPerc;
+88 -109
View File
@@ -35,7 +35,6 @@
#include "tile cache.h" #include "tile cache.h"
#include "strategicmap.h" #include "strategicmap.h"
#include "Map Information.h" #include "Map Information.h"
#include "laptop.h"
#include "Shade Table Util.h" #include "Shade Table Util.h"
#include "Exit Grids.h" #include "Exit Grids.h"
#include "Summary Info.h" #include "Summary Info.h"
@@ -51,6 +50,7 @@
#include "Multilingual Text Code Generator.h" #include "Multilingual Text Code Generator.h"
#include "editscreen.h" #include "editscreen.h"
#include "Arms Dealer Init.h" #include "Arms Dealer Init.h"
#include "Map Screen Interface Bottom.h"
#include "MPXmlTeams.hpp" #include "MPXmlTeams.hpp"
#include "Strategic Mines LUA.h" #include "Strategic Mines LUA.h"
#include "UndergroundInit.h" #include "UndergroundInit.h"
@@ -76,7 +76,8 @@
#include "AimArchives.h" #include "AimArchives.h"
#include "connect.h" #include "connect.h"
#include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes() #include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes()
#include "Animation Data.h" // added by Flugente
#include <language.hpp>
extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0}; extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0};
extern INT16 gubMaxActionPoints[TOTALBODYTYPES];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08 extern INT16 gubMaxActionPoints[TOTALBODYTYPES];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08
@@ -134,34 +135,6 @@ static void AddLanguagePrefix(STR fileName, const STR language)
memmove( fileComponent, language, strlen( language) ); memmove( fileComponent, language, strlen( language) );
} }
static const STR GetLanguagePrefix()
{
#ifdef ENGLISH
return "";
#endif
#ifdef GERMAN
return GERMAN_PREFIX;
#endif
#ifdef RUSSIAN
return RUSSIAN_PREFIX;
#endif
#ifdef DUTCH
return DUTCH_PREFIX;
#endif
#ifdef POLISH
return POLISH_PREFIX;
#endif
#ifdef FRENCH
return FRENCH_PREFIX;
#endif
#ifdef ITALIAN
return ITALIAN_PREFIX;
#endif
#ifdef CHINESE
return CHINESE_PREFIX;
#endif
}
static void AddLanguagePrefix(STR fileName) static void AddLanguagePrefix(STR fileName)
{ {
AddLanguagePrefix( fileName, GetLanguagePrefix()); AddLanguagePrefix( fileName, GetLanguagePrefix());
@@ -254,7 +227,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, AMMOFILENAME); strcat(fileName, AMMOFILENAME);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
@@ -268,9 +241,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, AMMOFILENAME); strcat(fileName, AMMOFILENAME);
SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME);
} }
#else } else {
SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME);
#endif }
// Lesh: added this, begin // Lesh: added this, begin
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -294,14 +267,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
// the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags // the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInItemStats(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInItemStats(fileName,TRUE), fileName);
} }
#endif }
//if(!WriteItemStats()) //if(!WriteItemStats())
// return FALSE; // return FALSE;
@@ -366,14 +339,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat( fileName, DISEASEFILENAME ); strcat( fileName, DISEASEFILENAME );
SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME ); SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME );
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME); SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME);
} }
#endif }
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, STRUCTUREDECONSTRUCTFILENAME); strcat(fileName, STRUCTUREDECONSTRUCTFILENAME);
@@ -411,14 +384,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, LOADSCREENHINTSFILENAME); strcat(fileName, LOADSCREENHINTSFILENAME);
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName);
} }
#endif }
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, ARMOURSFILENAME); strcat(fileName, ARMOURSFILENAME);
@@ -438,22 +411,24 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
if (isMultiplayer == false) if (isMultiplayer == false)
{ {
using namespace LogicalBodyTypes; using namespace LogicalBodyTypes;
SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME), LBT_LAYERSFILENAME); CHAR8 errorBuf[512]{"Failed loading LogicalBodyTypes external data!"};
SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME), LBT_PALETTESFILENAME);
SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME), LBT_ANIMSURFACESFILENAME); SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME), LBT_FILTERSFILENAME); SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME), LBT_BODYTYPESFILENAME); SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME, errorBuf), errorBuf);
SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME, errorBuf), errorBuf);
} }
} }
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInLBEPocketStats(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInLBEPocketStats(fileName,TRUE), fileName);
} }
#endif }
// THE_BOB : added for pocket popup definitions // THE_BOB : added for pocket popup definitions
LBEPocketPopup.clear(); LBEPocketPopup.clear();
@@ -461,7 +436,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, LBEPOCKETPOPUPFILENAME); strcat(fileName, LBEPOCKETPOPUPFILENAME);
SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if (FileExists(fileName)) if (FileExists(fileName))
@@ -476,10 +451,10 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, LBEPOCKETPOPUPFILENAME); strcat(fileName, LBEPOCKETPOPUPFILENAME);
SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME);
} }
#else } else {
// WANNE: Load english file // WANNE: Load english file
SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME);
#endif }
#ifdef JA2UB #ifdef JA2UB
@@ -495,14 +470,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, MERCSTARTINGGEARFILENAME); strcat(fileName, MERCSTARTINGGEARFILENAME);
SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName, FALSE), MERCSTARTINGGEARFILENAME); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName, FALSE), MERCSTARTINGGEARFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName,TRUE), fileName);
} }
#endif }
#endif #endif
@@ -519,14 +494,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, ATTACHMENTSLOTSFILENAME); strcat(fileName, ATTACHMENTSLOTSFILENAME);
SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName, FALSE),ATTACHMENTSLOTSFILENAME); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName, FALSE),ATTACHMENTSLOTSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName,TRUE), fileName);
} }
#endif }
// Flugente: created separate gun and item choices for different soldier classes - read in different xmls // Flugente: created separate gun and item choices for different soldier classes - read in different xmls
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -700,14 +675,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, CITYTABLEFILENAME); strcat(fileName, CITYTABLEFILENAME);
SGP_THROW_IFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME); SGP_THROW_IFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInStrategicMapSectorTownNames(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInStrategicMapSectorTownNames(fileName,TRUE), fileName);
} }
#endif }
// Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp, // Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp,
// function BOOLEAN InitStrategicMovementCosts(); // function BOOLEAN InitStrategicMovementCosts();
@@ -758,14 +733,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, TRUE),fileName); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, TRUE),fileName);
} }
#endif }
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
strcat(fileName, DELIVERYMETHODSFILENAME); strcat(fileName, DELIVERYMETHODSFILENAME);
@@ -778,14 +753,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,FALSE), FACILITYTYPESFILENAME); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,FALSE), FACILITYTYPESFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,TRUE), fileName);
} }
#endif }
// HEADROCK HAM 3.4: Read in facility locations // HEADROCK HAM 3.4: Read in facility locations
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -799,14 +774,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSectorNames(fileName,FALSE,0), SECTORNAMESFILENAME); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,FALSE,0), SECTORNAMESFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSectorNames(fileName,TRUE, 0), fileName); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,TRUE, 0), fileName);
} }
#endif }
// HEADROCK HAM 5: Read in Coolness by Sector // HEADROCK HAM 5: Read in Coolness by Sector
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -828,7 +803,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -836,7 +811,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
if(!ReadInMercProfiles(fileName,TRUE)) if(!ReadInMercProfiles(fileName,TRUE))
return FALSE; return FALSE;
} }
#endif }
} }
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -854,14 +829,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercProfiles(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName,TRUE), fileName);
} }
#endif }
// HEADROCK PROFEX: Read in Merc Opinion data to replace PROF.DAT data // HEADROCK PROFEX: Read in Merc Opinion data to replace PROF.DAT data
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -924,14 +899,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,FALSE), ENEMYNAMESFILENAME); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,FALSE), ENEMYNAMESFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,TRUE), fileName);
} }
#endif }
} }
@@ -943,14 +918,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,FALSE), CIVGROUPNAMESFILENAME); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,FALSE), CIVGROUPNAMESFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,TRUE), fileName);
} }
#endif }
} }
@@ -960,14 +935,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,TRUE), fileName);
} }
#endif }
if (gGameExternalOptions.fEnemyRank == TRUE) if (gGameExternalOptions.fEnemyRank == TRUE)
{ {
@@ -977,14 +952,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,FALSE), ENEMYRANKFILENAME); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,FALSE), ENEMYRANKFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,TRUE), fileName);
} }
#endif }
} }
// Flugente: backgrounds // Flugente: backgrounds
@@ -993,14 +968,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,FALSE), BACKGROUNDSFILENAME); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,FALSE), BACKGROUNDSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,TRUE), BACKGROUNDSFILENAME); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,TRUE), BACKGROUNDSFILENAME);
} }
#endif }
// Flugente: individual militia // Flugente: individual militia
strcpy( fileName, directoryName ); strcpy( fileName, directoryName );
@@ -1014,14 +989,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,FALSE), CAMPAIGNSTATSEVENTSFILENAME); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,FALSE), CAMPAIGNSTATSEVENTSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,TRUE), CAMPAIGNSTATSEVENTSFILENAME); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,TRUE), CAMPAIGNSTATSEVENTSFILENAME);
} }
#endif }
// WANNE: Only in a singleplayer game... // WANNE: Only in a singleplayer game...
// Externalised taunts // Externalised taunts
@@ -1042,14 +1017,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, FileInfo.zFileName); strcat(fileName, FileInfo.zFileName);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName);
} }
#endif }
while( GetFileNext(&FileInfo) ) while( GetFileNext(&FileInfo) )
{ {
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -1057,14 +1032,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
strcat(fileName, FileInfo.zFileName); strcat(fileName, FileInfo.zFileName);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName);
} }
#endif }
} }
GetFileClose(&FileInfo); GetFileClose(&FileInfo);
} }
@@ -1076,14 +1051,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME); SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName);
} }
#endif }
// IMP Portraits List by Jazz // IMP Portraits List by Jazz
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -1091,14 +1066,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,FALSE), IMPPORTRAITS); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,FALSE), IMPPORTRAITS);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,TRUE), fileName);
} }
#endif }
LoadIMPPortraitsTEMP( ); LoadIMPPortraitsTEMP( );
@@ -1183,14 +1158,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
SGP_THROW_IFFALSE(ReadInFaceGear(zNewFaceGear, fileName), FACEGEARFILENAME); SGP_THROW_IFFALSE(ReadInFaceGear(zNewFaceGear, fileName), FACEGEARFILENAME);
//WriteFaceGear(); //WriteFaceGear();
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMercAvailability(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInMercAvailability(fileName,TRUE), fileName);
} }
#endif }
UINT32 i; UINT32 i;
for(i=0; i<NUM_PROFILES; i++) for(i=0; i<NUM_PROFILES; i++)
{ {
@@ -1204,14 +1179,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,FALSE), AIMAVAILABILITY); SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,FALSE), AIMAVAILABILITY);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInAimAvailability(fileName,TRUE), fileName);
} }
#endif }
//Main Menu by Jazz //Main Menu by Jazz
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -1224,7 +1199,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInActionItems(fileName,FALSE), ACTIONITEMSFILENAME); SGP_THROW_IFFALSE(ReadInActionItems(fileName,FALSE), ACTIONITEMSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -1232,7 +1207,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer)
if(!ReadInActionItems(fileName,TRUE)) if(!ReadInActionItems(fileName,TRUE))
return FALSE; return FALSE;
} }
#endif }
if ( ReadXMLEmail == TRUE ) if ( ReadXMLEmail == TRUE )
{ {
@@ -1242,7 +1217,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailMercAvailable(fileName,FALSE), EMAILMERCAVAILABLE); SGP_THROW_IFFALSE(ReadInEmailMercAvailable(fileName,FALSE), EMAILMERCAVAILABLE);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -1250,7 +1225,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInEmailMercAvailable(fileName,TRUE)) if(!ReadInEmailMercAvailable(fileName,TRUE))
return FALSE; return FALSE;
} }
#endif }
// EMAIL MERC LEVEL UP by Jazz // EMAIL MERC LEVEL UP by Jazz
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -1258,7 +1233,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailMercLevelUp(fileName,FALSE), EMAILMERCLEVELUP); SGP_THROW_IFFALSE(ReadInEmailMercLevelUp(fileName,FALSE), EMAILMERCLEVELUP);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -1266,7 +1241,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInEmailMercLevelUp(fileName,TRUE)) if(!ReadInEmailMercLevelUp(fileName,TRUE))
return FALSE; return FALSE;
} }
#endif }
} }
/* /*
// EMAIL OTHER by Jazz // EMAIL OTHER by Jazz
@@ -1275,7 +1250,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInEmailOther(fileName,FALSE), EMAILOTHER); SGP_THROW_IFFALSE(ReadInEmailOther(fileName,FALSE), EMAILOTHER);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -1283,7 +1258,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInEmailOther(fileName,TRUE)) if(!ReadInEmailOther(fileName,TRUE))
return FALSE; return FALSE;
} }
#endif }
*/ */
//new vehicles by Jazz //new vehicles by Jazz
@@ -1294,7 +1269,7 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInNewVehicles(fileName,FALSE), VEHICLESFILENAME); SGP_THROW_IFFALSE(ReadInNewVehicles(fileName,FALSE), VEHICLESFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -1302,9 +1277,9 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInNewVehicles(fileName,TRUE)) if(!ReadInNewVehicles(fileName,TRUE))
return FALSE; return FALSE;
} }
#endif }
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
@@ -1312,7 +1287,7 @@ if ( ReadXMLEmail == TRUE )
if(!ReadInLanguageLocation(fileName,TRUE,zlanguageText,0)) if(!ReadInLanguageLocation(fileName,TRUE,zlanguageText,0))
return FALSE; return FALSE;
} }
#endif }
#ifdef ENABLE_BRIEFINGROOM #ifdef ENABLE_BRIEFINGROOM
strcpy(fileName, directoryName); strcpy(fileName, directoryName);
@@ -1320,14 +1295,14 @@ if ( ReadXMLEmail == TRUE )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,FALSE,gBriefingRoomData, 4), BRIEFINGROOMFILENAME); SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,FALSE,gBriefingRoomData, 4), BRIEFINGROOMFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,TRUE,gBriefingRoomData, 4), fileName); SGP_THROW_IFFALSE(ReadInBriefingRoom(fileName,TRUE,gBriefingRoomData, 4), fileName);
} }
#endif }
BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0); BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
@@ -1339,14 +1314,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMinerals(fileName,FALSE), MINERALSFILENAME); SGP_THROW_IFFALSE(ReadInMinerals(fileName,FALSE), MINERALSFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInMinerals(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInMinerals(fileName,TRUE), fileName);
} }
#endif }
// Old AIM Archive // Old AIM Archive
UINT8 p; UINT8 p;
@@ -1360,14 +1335,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,FALSE), OLDAIMARCHIVEFILENAME); SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,FALSE), OLDAIMARCHIVEFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInAimOldArchive(fileName,TRUE), fileName);
} }
#endif }
UINT8 emptyslotsinarchives = 0; UINT8 emptyslotsinarchives = 0;
for (p=0;p<NUM_PROFILES;p++) for (p=0;p<NUM_PROFILES;p++)
{ {
@@ -1417,14 +1392,14 @@ BackupBRandEncyclopedia ( gBriefingRoomData, gBriefingRoomDataBackup, 0);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,FALSE), DIFFICULTYFILENAME); SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,FALSE), DIFFICULTYFILENAME);
#ifndef ENGLISH if( g_lang != i18n::Lang::en ) {
AddLanguagePrefix(fileName); AddLanguagePrefix(fileName);
if ( FileExists(fileName) ) if ( FileExists(fileName) )
{ {
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName));
SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,TRUE), fileName); SGP_THROW_IFFALSE(ReadInDifficultySettings(fileName,TRUE), fileName);
} }
#endif }
LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true); LuaState::INIT(lua::LUA_STATE_STRATEGIC_MINES_AND_UNDERGROUND, true);
g_luaUnderground.LoadScript(GetLanguagePrefix()); g_luaUnderground.LoadScript(GetLanguagePrefix());
@@ -1498,6 +1473,10 @@ UINT32 InitializeJA2(void)
return( ERROR_SCREEN ); return( ERROR_SCREEN );
} }
// InitRadarScreenCoords() depend on Mapscreen Interface Bottom coordinates -> need to initiate them first
// before calling InitTacticalEngine()
InitMapScreenInterfaceBottomCoords();
// Init tactical engine // Init tactical engine
if ( !InitTacticalEngine( ) ) if ( !InitTacticalEngine( ) )
{ {
+4 -3
View File
@@ -36,6 +36,7 @@
#include "LuaInitNPCs.h" #include "LuaInitNPCs.h"
#include "XML.h" #include "XML.h"
#include <language.hpp>
BOOLEAN Style_JA = TRUE; BOOLEAN Style_JA = TRUE;
extern INT8 Test = 0; extern INT8 Test = 0;
@@ -726,11 +727,11 @@ void DisplaySirtechSplashScreen()
* (2006-10-10, Sergeant_Kolja) * (2006-10-10, Sergeant_Kolja)
*/ */
#ifdef _DEBUG #ifdef _DEBUG
# if defined(ENGLISH) if( g_lang == i18n::Lang::en ) {
AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) ); AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) );
# elif defined(GERMAN) } else if( g_lang == i18n::Lang::de ) {
AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) ); AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) );
# endif }
#endif #endif
AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) ); AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) );
return; return;
+2 -4
View File
@@ -12,13 +12,11 @@ void StopIntroVideo();
//enums used for when the intro screen can come up, used with 'gbIntroScreenMode' //enums used for when the intro screen can come up, used with 'gbIntroScreenMode'
enum EIntroType enum EIntroType
{ {
#ifdef JA2UB
INTRO_HELI_CRASH,
#endif
INTRO_BEGINNING, //set when viewing the intro at the begining of the game INTRO_BEGINNING, //set when viewing the intro at the begining of the game
INTRO_ENDING, //set when viewing the end game video. INTRO_ENDING, //set when viewing the end game video.
INTRO_SPLASH, INTRO_SPLASH,
// Unfinished Business
INTRO_HELI_CRASH
}; };
+4 -3
View File
@@ -5,6 +5,7 @@
#include "Timer Control.h" #include "Timer Control.h"
#include "Multi Language Graphic Utils.h" #include "Multi Language Graphic Utils.h"
#include <stdio.h> #include <stdio.h>
#include <language.hpp>
UINT32 guiSplashFrameFade = 10; UINT32 guiSplashFrameFade = 10;
UINT32 guiSplashStartTime = 0; UINT32 guiSplashStartTime = 0;
@@ -13,10 +14,10 @@ extern HVSURFACE ghFrameBuffer;
//Simply create videosurface, load image, and draw it to the screen. //Simply create videosurface, load image, and draw it to the screen.
void InitJA2SplashScreen() void InitJA2SplashScreen()
{ {
#ifdef ENGLISH if( g_lang == i18n::Lang::en ) {
ClearMainMenu(); ClearMainMenu();
#else } else {
UINT32 uiLogoID = 0; UINT32 uiLogoID = 0;
HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions
VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions
@@ -69,7 +70,7 @@ void InitJA2SplashScreen()
GetVideoSurface( &hVSurface, uiLogoID ); GetVideoSurface( &hVSurface, uiLogoID );
BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL );
DeleteVideoSurfaceFromIndex( uiLogoID ); DeleteVideoSurfaceFromIndex( uiLogoID );
#endif // ENGLISH } // ENGLISH
InvalidateScreen(); InvalidateScreen();
RefreshScreen( NULL ); RefreshScreen( NULL );
-21
View File
@@ -1,21 +0,0 @@
#include "Language Defines.h"
#if defined(ENGLISH)
# pragma message(" (Language set to ENGLISH, You'll need english CDs)")
#elif defined(GERMAN)
# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)")
#elif defined(RUSSIAN)
# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)")
#elif defined(DUTCH)
# pragma message(" (Language set to DUTCH, You'll need dutch CDs)")
#elif defined(POLISH)
# pragma message(" (Language set to POLISH, You'll need polish CDs)")
#elif defined(FRENCH)
# pragma message(" (Language set to FRENCH, You'll need french CDs)")
#elif defined(ITALIAN)
# pragma message(" (Language set to ITALIAN, You'll need italian CDs)")
#elif defined(CHINESE)
# pragma message(" (Language set to CHINESE, You'll need chinese CDs)")
#else
# error "At least You have to specify a Language somewhere. See comments above."
#endif
-119
View File
@@ -1,119 +0,0 @@
#ifndef __LANGUAGE_DEFINES_H
#define __LANGUAGE_DEFINES_H
#pragma once
/* ============================================================================
* ONLY ONE OF THESE LANGUAGES CAN BE DEFINED AT A TIME!
* BUT now You can define it _here_ by uncommenting one _or_ (better):
* You can comment them all out and then set it _global_ in "Preprocessor
* options" (do it for ALL projects in the workspace and both debug & release)
* _or_
* give it do Your MAKEFILE, f.i. make ENGLISH, but keep in mind that some
* weird make tools will require 'make ENGLISH=1' instead
*
* using one of the two later methods will keep this SVN file unchanged for the
* future, only Your private project files (workspace/solution) will differ
* from the SVN stuff.
* (2006-10-10, Sergeant_Kolja)
*/
/* The recommend approach for VS2010 multi-language builds is to use the command line or the ja2.props file.
By default the language is ENGLISH and the Language Prefix is EN.
There are 3 ways you can build the JA2 1.13 executable file:
// -------------------------------------------------------
// 1. Using the command line
// -------------------------------------------------------
For example, where msbuild is located in %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ if not on your path
msbuild.exe /p:Configuration=Release ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=PL /p:JA2Language=POLISH ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=RU /p:JA2Language=RUSSIAN ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=NL /p:JA2Language=DUTCH ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=FR /p:JA2Language=FRENCH ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=IT /p:JA2Language=ITALIAN ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=CN /p:JA2Language=CHINESE ja2_VS2010.sln
Note: If you want to build "Unfinished Business" version, just append the /p:JA2Config=JA2UB in the command line
msbuild.exe /p:Configuration=Release /p:JA2Config=JA2UB ja2_VS2010.sln
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB ja2_VS2010.sln
Note2: You can also specify the target output name with the parameter /p:TargetName
msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB /p:TargetName="JA2UB_113" ja2_VS2010.sln
// --------------------------------------------------------
// 2. Editing the ja2.props file and then build in VS 2010
// -------------------------------------------------------
1. Open the "ja2.props" file in a text editor and set the <BuildMacro> tags to your likeing.
For example: If you want to build Russian Version (normal JA2, not UB) then set the following:
<BuildMacro Include="JA2Config">
<Value></Value>
</BuildMacro>
<BuildMacro Include="JA2LangPrefix">
<Value>RU</Value>
</BuildMacro>
<BuildMacro Include="JA2Language">
<Value>RUSSIAN</Value>
</BuildMacro>
2. Save the file
3. Build the project in Visual Studio 2010
// --------------------------------------------------------
// 3. The "old" way for building the executable
// -------------------------------------------------------
1. Enable the "#undef ENGLISH" define below, so English will not be used anymore
2. Set the desired language below
3. If you want to build "Unfinished Business" version, enable "#define JA2UB" and "#define JA2UBMAPS" in builddefines.h"
4. Build the executable in VS 2005 / 2008 / 2010
5. The output will be placed in the "Build\bin\" folder
*/
// Only enable this "undef", if you use the 3. way of building the executable!
#undef ENGLISH
#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE)
/* please set one manually here (by uncommenting) if not willingly to set Workspace wide */
#define ENGLISH
//#define GERMAN
//#define RUSSIAN
//#define DUTCH
//#define FRENCH
//#define ITALIAN
//#define POLISH
// INFO: For Chinese 1.13 version, you also have to set USE_WINFONTS = 1 in ja2.ini inside your JA2 installation directory!
//#define CHINESE
#endif
//**ddd direct link libraries
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "gdi32.lib")
#pragma comment (lib, "advapi32.lib")
#pragma comment (lib, "shell32.lib")
/* ====================================================================
* Regardless of if we did it Workspace wide or by uncommenting above,
* HERE we must see, what language was selected. If one, we
*/
#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE)
# error "At least You have to specify a Language somewhere. See comments above."
#endif
//if the language represents words as single chars
/*#ifdef TAIWAN
#define SINGLE_CHAR_WORDS
#endif*/
#endif
-1
View File
@@ -29,7 +29,6 @@
#include "Text.h" #include "Text.h"
#include "Interface Control.h" #include "Interface Control.h"
#include "Message.h" #include "Message.h"
#include "Language Defines.h"
#include "Multi Language Graphic Utils.h" #include "Multi Language Graphic Utils.h"
#include "Map Information.h" #include "Map Information.h"
#include "SmokeEffects.h" #include "SmokeEffects.h"
+46 -178
View File
@@ -138,7 +138,6 @@
#include "Map Screen Interface Map Inventory.h"//dnl ch51 081009 #include "Map Screen Interface Map Inventory.h"//dnl ch51 081009
#include "Sys Globals.h"//dnl ch74 201013 #include "Sys Globals.h"//dnl ch74 201013
#include "Ambient Control.h" // added by Flugente for HandleNewSectorAmbience(...) #include "Ambient Control.h" // added by Flugente for HandleNewSectorAmbience(...)
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
// //
// Local Defines // Local Defines
@@ -153,6 +152,7 @@
#endif #endif
#include "LuaInitNPCs.h" #include "LuaInitNPCs.h"
#include <language.hpp>
#ifdef JA2UB #ifdef JA2UB
@@ -177,7 +177,11 @@ extern void initMapViewAndBorderCoordinates(void);
UINT32 guiNumberOfMapTempFiles; //Test purposes UINT32 guiNumberOfMapTempFiles; //Test purposes
UINT32 guiSizeOfTempFiles; UINT32 guiSizeOfTempFiles;
CHAR gzNameOfMapTempFile[128]; CHAR gzNameOfMapTempFile[128];
#endif
//#define LOADSAVEGAME_LOGTIME 1 //#define LOADSAVEGAME_LOGTIME 1
#ifdef LOADSAVEGAME_LOGTIME
#include "TimeLogging.h"
#endif #endif
extern SOLDIERTYPE *gpSMCurrentMerc; extern SOLDIERTYPE *gpSMCurrentMerc;
@@ -3588,14 +3592,8 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
alreadySaving = true; alreadySaving = true;
#ifdef LOADSAVEGAME_LOGTIME #ifdef LOADSAVEGAME_LOGTIME
// Flugente: log how long this takes TimingLogInitialize("TimeLog_LoadSavedGame.txt");
clock_t starttime = clock();
clock_t t0;
clock_t t1 = starttime;
FILE* fp_timelog = fopen("LoadSavedGame_TimeLog.txt", "a");
#endif #endif
//clear out the save game header //clear out the save game header
memset( &SaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); memset( &SaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) );
@@ -3775,14 +3773,9 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
//Create the name of the file //Create the name of the file
CreateSavedGameFileNameFromNumber( ubSaveGameID, zSaveGameName ); CreateSavedGameFileNameFromNumber( ubSaveGameID, zSaveGameName );
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLogWrite("Save ");
{ TimingLogWrite(zSaveGameName);
fprintf(fp_timelog, "Save savegame: %s\n", zSaveGameName); TimingLog("\nShutdown stuff", 10);
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "Shutdown stuff\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
//if the file already exists, delete it //if the file already exists, delete it
@@ -3919,12 +3912,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Tactical Status" ); SaveGameFilePosition( FileGetPos( hFile ), "Tactical Status" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveTacticalStatusToSavedGame", 6);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveTacticalStatusFromSavedGame done\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
@@ -3966,12 +3954,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Laptop Info" ); SaveGameFilePosition( FileGetPos( hFile ), "Laptop Info" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveLaptopInfoToSavedGame", 7);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveLaptopInfoFromSavedGame done\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
// //
@@ -4003,12 +3986,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Soldier Structure" ); SaveGameFilePosition( FileGetPos( hFile ), "Soldier Structure" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveSoldierStructure", 8);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveSoldierStructure done\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
@@ -4071,12 +4049,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Strategic Information" ); SaveGameFilePosition( FileGetPos( hFile ), "Strategic Information" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveStrategicInfoToSavedFile", 6);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveStrategicInfoFromSavedFile done\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
/*// Flugente: Save the strategic supply /*// Flugente: Save the strategic supply
@@ -4126,12 +4099,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Strategic Movement Groups" ); SaveGameFilePosition( FileGetPos( hFile ), "Strategic Movement Groups" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveStrategicMovementGroupsToSaveGameFile", 3);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveStrategicMovementGroupsFromSavedGameFile done\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
@@ -4148,12 +4116,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "All the Map Temp files" ); SaveGameFilePosition( FileGetPos( hFile ), "All the Map Temp files" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveMapTempFilesToSavedGameFile", 6);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveMapTempFilesFromSavedGameFile done\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
if( !SaveQuestInfoToSavedGameFile( hFile ) ) if( !SaveQuestInfoToSavedGameFile( hFile ) )
@@ -4319,12 +4282,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Militia Movement" ); SaveGameFilePosition( FileGetPos( hFile ), "Militia Movement" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveMilitiaMovementInformationToSaveGameFile", 2);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveMilitiaMovementInformationFromSavedGameFile done\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
if( !SaveBulletStructureToSaveGameFile( hFile ) ) if( !SaveBulletStructureToSaveGameFile( hFile ) )
@@ -4564,12 +4522,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
SaveGameFilePosition( FileGetPos( hFile ), "Lua global" ); SaveGameFilePosition( FileGetPos( hFile ), "Lua global" );
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("SaveLuaGlobalToSaveGameFile", 7);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "SaveLuaGlobalFromLoadGameFile done\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
if( !SaveDataSaveToSaveGameFile( hFile ) ) if( !SaveDataSaveToSaveGameFile( hFile ) )
@@ -4669,12 +4622,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
goto FAILED_TO_SAVE; goto FAILED_TO_SAVE;
} }
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("File read done", 10);
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "File read done\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
#endif #endif
//Close the saved game file //Close the saved game file
@@ -4755,22 +4703,9 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc )
alreadySaving = false; alreadySaving = false;
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if (fp_timelog) TimingLog("Update functions", 9);
{ TimingLogTotalTime("SaveSavedGame total", 9);
t0 = t1; TimingLogStop();
t1 = clock();
fprintf(fp_timelog, "Update functions\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
if (fp_timelog)
{
t0 = starttime;
t1 = clock();
fprintf(fp_timelog, "SaveSavedGame total\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
if (fp_timelog)
fclose(fp_timelog);
#endif #endif
return( TRUE ); return( TRUE );
@@ -4780,6 +4715,9 @@ FAILED_TO_SAVE:
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
SaveGameFilePosition( FileGetPos( hFile ), "Failed to Save!!!" ); SaveGameFilePosition( FileGetPos( hFile ), "Failed to Save!!!" );
#endif #endif
#if LOADSAVEGAME_LOGTIME
TimingLogStop();
#endif
FileClose( hFile ); FileClose( hFile );
@@ -4825,8 +4763,6 @@ extern int gEnemyPreservedTempFileVersion[256];
extern int gCivPreservedTempFileVersion[256]; extern int gCivPreservedTempFileVersion[256];
#include "time.h"
BOOLEAN LoadSavedGame( int ubSavedGameID ) BOOLEAN LoadSavedGame( int ubSavedGameID )
{ {
HWFILE hFile; HWFILE hFile;
@@ -4845,12 +4781,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#ifdef LOADSAVEGAME_LOGTIME #ifdef LOADSAVEGAME_LOGTIME
// Flugente: log how long this takes TimingLogInitialize("TimeLog_LoadSavedGame.txt");
clock_t starttime = clock();
clock_t t0;
clock_t t1 = starttime;
FILE *fp_timelog = fopen( "LoadSavedGame_TimeLog.txt", "a" );
#endif #endif
uiRelStartPerc = uiRelEndPerc =0; uiRelStartPerc = uiRelEndPerc =0;
@@ -4933,14 +4864,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
CreateSavedGameFileNameFromNumber( ubSavedGameID, zSaveGameName ); CreateSavedGameFileNameFromNumber( ubSavedGameID, zSaveGameName );
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLogWrite("Load ");
{ TimingLogWrite(zSaveGameName);
fprintf( fp_timelog, "Load savegame: %s\n", zSaveGameName ); TimingLog("\nShutdown stuff", 10);
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "Shutdown stuff\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
// open the save game file // open the save game file
@@ -5061,19 +4987,14 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
LoadGameFilePosition( FileGetPos( hFile ), "Tactical Status" ); LoadGameFilePosition( FileGetPos( hFile ), "Tactical Status" );
#endif #endif
#if LOADSAVEGAME_LOGTIME
TimingLog("LoadTacticalStatusFromSavedGame", 6);
#endif
//This gets reset by the above function //This gets reset by the above function
gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; gTacticalStatus.uiFlags |= LOADING_SAVED_GAME;
#if LOADSAVEGAME_LOGTIME
if ( fp_timelog )
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadTacticalStatusFromSavedGame done\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif
//Load the game clock ingo //Load the game clock ingo
if( !LoadGameClock( hFile ) ) if( !LoadGameClock( hFile ) )
@@ -5194,12 +5115,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadLaptopInfoFromSavedGame", 7);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadLaptopInfoFromSavedGame done\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
uiRelEndPerc += 0; uiRelEndPerc += 0;
@@ -5242,12 +5158,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadSoldierStructure", 8);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadSoldierStructure done\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
uiRelEndPerc += 1; uiRelEndPerc += 1;
@@ -5376,12 +5287,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadStrategicInfoFromSavedFile", 6);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadStrategicInfoFromSavedFile done\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
uiRelEndPerc += 1; uiRelEndPerc += 1;
@@ -5442,12 +5348,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
ValidateStrategicGroups(); ValidateStrategicGroups();
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadStrategicMovementGroupsFromSavedGameFile", 2);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadStrategicMovementGroupsFromSavedGameFile done\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
uiRelEndPerc += 30; uiRelEndPerc += 30;
@@ -5467,12 +5368,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadMapTempFilesFromSavedGameFile", 5);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadMapTempFilesFromSavedGameFile done\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
uiRelEndPerc += 1; uiRelEndPerc += 1;
@@ -5771,12 +5667,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadMilitiaMovementInformationFromSavedGameFile", 2);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadMilitiaMovementInformationFromSavedGameFile done\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
uiRelEndPerc += 1; uiRelEndPerc += 1;
@@ -6336,12 +6227,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
#endif #endif
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("LoadLuaGlobalFromLoadGameFile", 6);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "LoadLuaGlobalFromLoadGameFile done\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
if( guiCurrentSaveGameVersion >= VEHICLES_DATATYPE_CHANGE && guiCurrentSaveGameVersion < NO_VEHICLE_SAVE) if( guiCurrentSaveGameVersion >= VEHICLES_DATATYPE_CHANGE && guiCurrentSaveGameVersion < NO_VEHICLE_SAVE)
@@ -6573,12 +6459,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
} }
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("File read done", 10);
{
t0 = t1;
t1 = clock();
fprintf( fp_timelog, "File read done\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
#endif #endif
// //
@@ -7023,22 +6904,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
gGameExternalOptions.gfAllowReinforcements = zDiffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcements; gGameExternalOptions.gfAllowReinforcements = zDiffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcements;
#if LOADSAVEGAME_LOGTIME #if LOADSAVEGAME_LOGTIME
if ( fp_timelog ) TimingLog("Update functions", 9);
{ TimingLogTotalTime("LoadSavedGame total", 9);
t0 = t1; TimingLogStop();
t1 = clock();
fprintf( fp_timelog, "Update functions\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
if ( fp_timelog )
{
t0 = starttime;
t1 = clock();
fprintf( fp_timelog, "LoadSavedGame total\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) );
}
if ( fp_timelog )
fclose( fp_timelog );
#endif #endif
DebugQuestInfo("\n--------- Game loaded ---------"); DebugQuestInfo("\n--------- Game loaded ---------");
@@ -7338,7 +7206,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile )
} }
} }
#ifdef GERMAN if( g_lang == i18n::Lang::de ) {
// Fix neutral flags // Fix neutral flags
if ( guiCurrentSaveGameVersion < 94 ) if ( guiCurrentSaveGameVersion < 94 )
{ {
@@ -7348,7 +7216,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile )
Menptr[ cnt].aiData.bNeutral = FALSE; Menptr[ cnt].aiData.bNeutral = FALSE;
} }
} }
#endif }
//#ifdef JA2UB //#ifdef JA2UB
//if the soldier has the NON weapon version of the merc knofe or merc umbrella //if the soldier has the NON weapon version of the merc knofe or merc umbrella
//ConvertWeapons( &Menptr[ cnt ] ); //ConvertWeapons( &Menptr[ cnt ] );
@@ -10029,9 +9897,9 @@ UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader )
} }
} }
#ifdef GERMAN if( g_lang == i18n::Lang::de ) {
uiEncryptionSet *= 11; uiEncryptionSet *= 11;
#endif }
uiEncryptionSet = uiEncryptionSet % 10; uiEncryptionSet = uiEncryptionSet % 10;
+72
View File
@@ -0,0 +1,72 @@
#include "TimeLogging.h"
#include "time.h"
#include <stdio.h>
clock_t starttime;
clock_t t0;
clock_t t1;
FILE* fp_timelog = nullptr;
static void indent(int n)
{
for (int i = 0; i < n; i++)
fputc('\t', fp_timelog);
}
void TimingLogInitialize(const CHAR8* filename)
{
starttime = clock();
t1 = starttime;
if (!fp_timelog)
{
fp_timelog = fopen(filename, "a");
}
}
void TimingLog(const CHAR8* logEvent, int n)
{
if (fp_timelog)
{
t0 = t1;
t1 = clock();
fprintf(fp_timelog, "%s", logEvent);
indent(n);
fprintf(fp_timelog, ": %f s\n", ((float)(t1 - t0) / CLOCKS_PER_SEC));
}
}
void TimingLogTotalTime(const CHAR8* logEvent, int n)
{
if (fp_timelog)
{
t1 = clock();
fprintf(fp_timelog, "%s", logEvent);
indent(n);
fprintf(fp_timelog, ": %f s\n", ((float)(t1 - starttime) / CLOCKS_PER_SEC));
}
}
void TimingLogWrite(const CHAR8* text)
{
if (fp_timelog)
{
fprintf(fp_timelog, text);
}
}
void TimingLogStop()
{
if (fp_timelog)
{
fprintf(fp_timelog, "\n");
fclose(fp_timelog);
fp_timelog = nullptr;
}
}
+8
View File
@@ -0,0 +1,8 @@
#pragma once
#include "Types.h"
void TimingLogInitialize(const CHAR8* filename);
void TimingLog(const CHAR8* logEvent, int n);
void TimingLogTotalTime(const CHAR8* logEvent, int n);
void TimingLogWrite(const CHAR8* text);
void TimingLogStop();
-2
View File
@@ -1,8 +1,6 @@
#ifndef _BUILDDEFINES_H #ifndef _BUILDDEFINES_H
#define _BUILDDEFINES_H #define _BUILDDEFINES_H
#include "Language Defines.h"
//----- Briefing Room (Mission based JA2 like in JA/DG) - by Jazz ----- //----- Briefing Room (Mission based JA2 like in JA/DG) - by Jazz -----
// Once enabled here and also enabled in the ja2_options.ini (BRIEFING_ROOM), // Once enabled here and also enabled in the ja2_options.ini (BRIEFING_ROOM),
// you can access the briefing room feature from the laptop // you can access the briefing room feature from the laptop
+6 -8
View File
@@ -45,10 +45,10 @@
#include "Sound Control.h" #include "Sound Control.h"
#include "WordWrap.h" #include "WordWrap.h"
#include "text.h" #include "text.h"
#include "Language Defines.h"
#include "IniReader.h" #include "IniReader.h"
#include "sgp_logger.h" #include "sgp_logger.h"
#include <language.hpp>
#define _UNICODE #define _UNICODE
// Networking Stuff // Networking Stuff
@@ -332,7 +332,7 @@ UINT32 InitScreenHandle(void)
if ( ubCurrentScreen == 255 ) if ( ubCurrentScreen == 255 )
{ {
#ifdef ENGLISH if( g_lang == i18n::Lang::en ) {
if( gfDoneWithSplashScreen ) if( gfDoneWithSplashScreen )
{ {
ubCurrentScreen = 0; ubCurrentScreen = 0;
@@ -342,9 +342,9 @@ UINT32 InitScreenHandle(void)
SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR );
return( INTRO_SCREEN ); return( INTRO_SCREEN );
} }
#else } else {
ubCurrentScreen = 0; ubCurrentScreen = 0;
#endif }
} }
if ( ubCurrentScreen == 0 ) if ( ubCurrentScreen == 0 )
@@ -397,7 +397,7 @@ UINT32 InitScreenHandle(void)
// Handle queued .ini file error messages // Handle queued .ini file error messages
int y = 40; int y = 40;
sgp::Logger_ID ini_id = sgp::Logger::instance().createLogger(); sgp::Logger_ID ini_id = sgp::Logger::instance().createLogger();
sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.txt", false, sgp::Logger::FLUSH_ON_DELETE); sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.log", false, sgp::Logger::FLUSH_ON_DELETE);
sgp::Logger::LogInstance logger = sgp::Logger::instance().logger(ini_id); sgp::Logger::LogInstance logger = sgp::Logger::instance().logger(ini_id);
while (! iniErrorMessages.empty()) { while (! iniErrorMessages.empty()) {
static BOOL iniErrorMessage_create_out_file = TRUE; static BOOL iniErrorMessage_create_out_file = TRUE;
@@ -407,7 +407,7 @@ UINT32 InitScreenHandle(void)
if (iniErrorMessage_create_out_file) if (iniErrorMessage_create_out_file)
{ {
y += 25; y += 25;
swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.txt has been created." ); swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.log has been created." );
DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_ORANGE, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED ); DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_ORANGE, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED );
iniErrorMessage_create_out_file = FALSE; iniErrorMessage_create_out_file = FALSE;
} }
@@ -959,7 +959,6 @@ void DoneFadeOutForDemoExitScreen( void )
// unused // unused
//extern INT8 gbFadeSpeed; //extern INT8 gbFadeSpeed;
#ifdef GERMAN
void DisplayTopwareGermanyAddress() void DisplayTopwareGermanyAddress()
{ {
VOBJECT_DESC vo_desc; VOBJECT_DESC vo_desc;
@@ -994,7 +993,6 @@ void DisplayTopwareGermanyAddress()
ExecuteBaseDirtyRectQueue(); ExecuteBaseDirtyRectQueue();
EndFrameBufferRender(); EndFrameBufferRender();
} }
#endif
UINT32 DemoExitScreenHandle(void) UINT32 DemoExitScreenHandle(void)
{ {
+94 -31
View File
@@ -36,7 +36,6 @@
#include "Strategic Status.h" #include "Strategic Status.h"
#include "Merc Contract.h" #include "Merc Contract.h"
#include "Strategic Merc Handler.h" #include "Strategic Merc Handler.h"
#include "Language Defines.h"
#include "Assignments.h" #include "Assignments.h"
#include "Sound Control.h" #include "Sound Control.h"
#include "Quests.h" #include "Quests.h"
@@ -50,6 +49,7 @@
#include "Encrypted File.h" #include "Encrypted File.h"
#include "InterfaceItemImages.h" #include "InterfaceItemImages.h"
#include <sstream> #include <sstream>
#include <language.hpp>
// //
//****** Defines ****** //****** Defines ******
@@ -148,10 +148,16 @@
#define FEE_X PRICE_X + 7 #define FEE_X PRICE_X + 7
#define FEE_Y NAME_Y #define FEE_Y NAME_Y
#define FEE_WIDTH 37 #define FEE_WIDTH 37
#define FEE_X_UB PRICE_X + 40
#define FEE_Y_UB STATS_Y + 28
#define FEE_Y_UB_NSGI STATS_Y
#define AIM_CONTRACT_X PRICE_X + 51 #define AIM_CONTRACT_X PRICE_X + 51
#define AIM_CONTRACT_Y FEE_Y #define AIM_CONTRACT_Y FEE_Y
#define AIM_CONTRACT_WIDTH 59 #define AIM_CONTRACT_WIDTH 59
#define AIM_CONTRACT_X_UB PRICE_X + 19
#define AIM_OFFER_X PRICE_X + 3
#define AIM_OFFER_WIDTH 110
#define ONEDAY_X AIM_CONTRACT_X #define ONEDAY_X AIM_CONTRACT_X
#define ONEWEEK_X AIM_CONTRACT_X #define ONEWEEK_X AIM_CONTRACT_X
@@ -1120,7 +1126,13 @@ BOOLEAN RenderAIMMembers()
UpdateMercInfo(); UpdateMercInfo();
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
//Draw fee & contract //Draw fee & contract
#ifdef JA2UB
DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
#else
DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X_NSGI, FEE_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X_NSGI, FEE_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X_NSGI, AIM_CONTRACT_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X_NSGI, AIM_CONTRACT_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
@@ -1129,9 +1141,6 @@ BOOLEAN RenderAIMMembers()
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X_NSGI, MARKSMAN_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X_NSGI, MARKSMAN_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X_NSGI, MECHANAICAL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X_NSGI, MECHANAICAL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
//Display Option Gear Cost text //Display Option Gear Cost text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_MEMBER_OPTIONAL_GEAR_X_NSGI, EXPLOSIVE_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_MEMBER_OPTIONAL_GEAR_X_NSGI, EXPLOSIVE_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
@@ -1140,6 +1149,7 @@ BOOLEAN RenderAIMMembers()
InsertDollarSignInToString( wTemp ); InsertDollarSignInToString( wTemp );
uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X_NSGI + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_M_FONT_STATIC_TEXT) + 5; uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X_NSGI + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_M_FONT_STATIC_TEXT) + 5;
DrawTextToScreen(wTemp, AIM_MEMBER_OPTIONAL_GEAR_COST_X_NSGI, EXPLOSIVE_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(wTemp, AIM_MEMBER_OPTIONAL_GEAR_COST_X_NSGI, EXPLOSIVE_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
#endif // JA2UB
} }
else else
{ {
@@ -1163,6 +1173,12 @@ BOOLEAN RenderAIMMembers()
UpdateMercInfo(); UpdateMercInfo();
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#ifdef JA2UB
DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
#else
//Draw fee & contract //Draw fee & contract
DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X, FEE_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X, FEE_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X, AIM_CONTRACT_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X, AIM_CONTRACT_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
@@ -1172,9 +1188,6 @@ BOOLEAN RenderAIMMembers()
DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X, MARKSMAN_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X, MARKSMAN_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X, MECHANAICAL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X, MECHANAICAL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED );
//Display AIM Member text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
//Display Option Gear Cost text //Display Option Gear Cost text
DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_MEMBER_OPTIONAL_GEAR_X, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_MEMBER_OPTIONAL_GEAR_X, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
@@ -1183,6 +1196,7 @@ BOOLEAN RenderAIMMembers()
InsertDollarSignInToString( wTemp ); InsertDollarSignInToString( wTemp );
uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_M_FONT_STATIC_TEXT) + 5; uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_M_FONT_STATIC_TEXT) + 5;
DrawTextToScreen(wTemp, uiPosX, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(wTemp, uiPosX, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
#endif
} }
DisableAimButton(); DisableAimButton();
@@ -1309,6 +1323,10 @@ BOOLEAN UpdateMercInfo(void)
if(gGameExternalOptions.gfUseNewStartingGearInterface) if(gGameExternalOptions.gfUseNewStartingGearInterface)
{ {
#ifdef JA2UB
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X_UB, FEE_Y_UB_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT);
DisplayWrappedString(AIM_OFFER_X, AGILITY_Y_NSGI, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#else
//Display the salaries //Display the salaries
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH_NSGI, FEE_X_NSGI, HEALTH_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH_NSGI, FEE_X_NSGI, HEALTH_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH_NSGI, FEE_X_NSGI, AGILITY_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH_NSGI, FEE_X_NSGI, AGILITY_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
@@ -1335,6 +1353,8 @@ BOOLEAN UpdateMercInfo(void)
else else
DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X_NSGI, AIM_MEDICAL_DEPOSIT_Y_NSGI, AIM_MEDICAL_DEPOSIT_WIDTH_NSGI, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X_NSGI, AIM_MEDICAL_DEPOSIT_Y_NSGI, AIM_MEDICAL_DEPOSIT_WIDTH_NSGI, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
} }
#endif // JA2UB
if(!g_bUseXML_Strings) if(!g_bUseXML_Strings)
{ {
// LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); // LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString);
@@ -1363,6 +1383,10 @@ BOOLEAN UpdateMercInfo(void)
} }
else else
{ {
#ifdef JA2UB
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X_UB, FEE_Y_UB, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT);
DisplayWrappedString(AIM_OFFER_X, AGILITY_Y, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
#else
//Display the salaries //Display the salaries
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH, FEE_X, HEALTH_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH, FEE_X, HEALTH_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X, AGILITY_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X, AGILITY_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT );
@@ -1389,6 +1413,7 @@ BOOLEAN UpdateMercInfo(void)
else else
DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
} }
#endif
if(!g_bUseXML_Strings) if(!g_bUseXML_Strings)
{ {
// LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); // LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString);
@@ -2528,6 +2553,21 @@ BOOLEAN DisplayVideoConferencingDisplay()
DisplayMercChargeAmount(); DisplayMercChargeAmount();
#ifdef JA2UB
if (gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE)
{
CHAR16 offerText[190];
swprintf(offerText, zNewTacticalMessages[TACT_MSG__AIMMEMBER_ONE_TIME_FEE], gMercProfiles[gbCurrentSoldier].zNickname);
const auto xCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_X + 115;
const auto yCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_Y + 45;
const auto textAreaWidth = 245;
SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR);
DisplayWrappedString(xCoord, yCoord, textAreaWidth, 2, AIM_M_FONT_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, offerText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
SetFontShadow(DEFAULT_SHADOW);
}
#endif // JA2UB
// if( gfMercIsTalking && !gfIsAnsweringMachineActive) // if( gfMercIsTalking && !gfIsAnsweringMachineActive)
if( gfMercIsTalking && gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) if( gfMercIsTalking && gGameSettings.fOptions[ TOPTION_SUBTITLES ] )
{ {
@@ -2577,6 +2617,9 @@ BOOLEAN DisplayMercsVideoFace()
void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown)
{ {
#ifdef JA2UB
return;
#else
UINT16 i, usPosY, usPosX; UINT16 i, usPosY, usPosX;
//First draw the select light for the contract length buttons //First draw the select light for the contract length buttons
@@ -2630,6 +2673,8 @@ void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown)
usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP;
} }
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
#endif // JA2UB
} }
@@ -2653,7 +2698,10 @@ UINT32 DisplayMercChargeAmount()
giContractAmount = 0; giContractAmount = 0;
//the contract charge amount //the contract charge amount
#ifdef JA2UB
// Special offer for a limited time! Act fast!
giContractAmount = gMercProfiles[gbCurrentSoldier].uiWeeklySalary;
#else
// Get the salary rate // Get the salary rate
if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY) if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY)
giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary; giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary;
@@ -2675,6 +2723,7 @@ UINT32 DisplayMercChargeAmount()
{ {
giContractAmount += gMercProfiles[gbCurrentSoldier].usOptionalGearCost; giContractAmount += gMercProfiles[gbCurrentSoldier].usOptionalGearCost;
} }
#endif
} }
@@ -2685,10 +2734,15 @@ UINT32 DisplayMercChargeAmount()
//if the merc hasnt just been hired //if the merc hasnt just been hired
// if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) // if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL )
{ {
#ifdef JA2UB
// Don't even have to pay for medical insurance! What a DEAL!
swprintf(wTemp, L"%s", wDollarTemp);
#else
if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit )
swprintf(wTemp, L"%s %s", wDollarTemp, VideoConfercingText[AIM_MEMBER_WITH_MEDICAL] ); swprintf(wTemp, L"%s %s", wDollarTemp, VideoConfercingText[AIM_MEMBER_WITH_MEDICAL] );
else else
swprintf(wTemp, L"%s", wDollarTemp ); swprintf(wTemp, L"%s", wDollarTemp );
#endif // JA2UB
DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X+1, AIM_CONTRACT_CHARGE_AMOUNNT_Y+3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X+1, AIM_CONTRACT_CHARGE_AMOUNNT_Y+3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
} }
@@ -4085,6 +4139,22 @@ BOOLEAN InitDeleteVideoConferencePopUp( )
// InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT); // InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT);
DelayMercSpeech( gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT, 750, TRUE, FALSE ); DelayMercSpeech( gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT, 750, TRUE, FALSE );
#ifdef JA2UB
// Disable and hide contract length & gear purchase buttons
gfBuyEquipment = TRUE;
for (size_t i = 0; i < 3; i++)
{
DisableButton(giContractLengthButton[i]);
HideButton(giContractLengthButton[i]);
if (i < 2)
{
DisableButton(giBuyEquipmentButton[i]);
HideButton(giBuyEquipmentButton[i]);
}
}
#endif // JA2UB
} }
@@ -5297,11 +5367,17 @@ BOOLEAN DisplayShadedStretchedMercFace( UINT8 ubMercID, UINT16 usPosX, UINT16 us
void DemoHiringOfMercs( ) void DemoHiringOfMercs( )
{ {
INT16 i; INT16 i;
#ifdef GERMAN UINT8 MercID[5];
UINT8 MercID[]={ 7, 10, 4, 14, 50 }; MercID[0] = 7;
#else MercID[1] = 10;
UINT8 MercID[]={ 7, 10, 4, 42, 33 }; MercID[2] = 4;
#endif if( g_lang == i18n::Lang::de ) {
MercID[3] = 14;
MercID[4] = 50;
} else {
MercID[3] = 42;
MercID[4] = 33;
}
MERC_HIRE_STRUCT HireMercStruct; MERC_HIRE_STRUCT HireMercStruct;
static BOOLEAN fHaveCalledBefore=FALSE; static BOOLEAN fHaveCalledBefore=FALSE;
@@ -5392,20 +5468,20 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( )
//create the string to display to the user, looks like.... //create the string to display to the user, looks like....
// L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival // L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival
#ifdef GERMAN if( g_lang == i18n::Lang::de ) {
//Germans version has a different argument order //Germans version has a different argument order
swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ],
gMercProfiles[ pSoldier->ubProfile ].zNickname, gMercProfiles[ pSoldier->ubProfile ].zNickname,
LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440,
zTimeString, zTimeString,
zSectorIDString ); zSectorIDString );
#else } else {
swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ],
gMercProfiles[ pSoldier->ubProfile ].zNickname, gMercProfiles[ pSoldier->ubProfile ].zNickname,
zSectorIDString, zSectorIDString,
LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440,
zTimeString ); zTimeString );
#endif }
@@ -5633,30 +5709,17 @@ void EnableWeaponKitSelectionButtons()
{ {
if ( !(gMercProfiles[gbCurrentSoldier].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) || gGameExternalOptions.fGearKitsAlwaysAvailable ) if ( !(gMercProfiles[gbCurrentSoldier].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) || gGameExternalOptions.fGearKitsAlwaysAvailable )
{ {
bool bShow;
INT16 usItem;
for(int i=0; i<NUM_MERCSTARTINGGEAR_KITS; ++i) for(int i=0; i<NUM_MERCSTARTINGGEAR_KITS; ++i)
{ {
bShow = false;
for(int j=INV_START_POS; j<NUM_INV_SLOTS; ++j) for(int j=INV_START_POS; j<NUM_INV_SLOTS; ++j)
{ {
usItem = gMercProfileGear[gbCurrentSoldier][i].inv[j]; if(gMercProfileGear[gbCurrentSoldier][i].inv[j] != NONE)
if(usItem != NONE)
{ {
bShow = true; ShowButton( giWeaponboxSelectionButton[i] );
//shadooow: if any of the item in kit is limited to specific system and this system isn't enabled then disable the whole kit from selection
if (((Item[usItem].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[usItem].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease))
{
bShow = false;
break; break;
} }
} }
} }
if (bShow)
{
ShowButton(giWeaponboxSelectionButton[i]);
}
}
} }
} }
} }
+1 -1
View File
@@ -627,7 +627,7 @@ TestTable::Display( )
{ {
MSYS_DefineRegion( &it->mMouseRegion[i - mFirstEntryShown], MSYS_DefineRegion( &it->mMouseRegion[i - mFirstEntryShown],
usPosX, usPosY, usPosX + it->GetRequiredLength(), usPosY + heightperrow, usPosX, usPosY, usPosX + it->GetRequiredLength(), usPosY + heightperrow,
MSYS_PRIORITY_HIGHEST, CURSOR_WWW, MSYS_PRIORITY_HIGHEST-3, CURSOR_WWW,
MSYS_NO_CALLBACK, ( *it ).RegionClickCallBack ); MSYS_NO_CALLBACK, ( *it ).RegionClickCallBack );
MSYS_AddRegion( &it->mMouseRegion[i - mFirstEntryShown] ); MSYS_AddRegion( &it->mMouseRegion[i - mFirstEntryShown] );
+21 -20
View File
@@ -20,6 +20,7 @@
// HEADROCK HAM 4 // HEADROCK HAM 4
#include "input.h" #include "input.h"
#include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item #include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item
#include <language.hpp>
#define BOBBYR_DEFAULT_MENU_COLOR 255 #define BOBBYR_DEFAULT_MENU_COLOR 255
@@ -115,11 +116,7 @@
#define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 #define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1
#define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 #define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40
#ifdef CHINESE #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X
#define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH - 10 //BOBBYR_ITEM_QTY_NUM_X
#else
#define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X
#endif
#define BOBBY_RAY_NOT_PURCHASED 255 #define BOBBY_RAY_NOT_PURCHASED 255
#define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 #define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200
@@ -1765,11 +1762,11 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter, INT32 iSubFilter)
{ {
if ( iSubFilter > -1 ) // Madd: new BR filters if ( iSubFilter > -1 ) // Madd: new BR filters
{ {
if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & iSubFilter ) if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & iSubFilter )
bAddItem = TRUE; bAddItem = TRUE;
else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex))
bAddItem = TRUE; bAddItem = TRUE;
else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment) else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex))
bAddItem = TRUE; bAddItem = TRUE;
} }
else else
@@ -2506,7 +2503,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex,
if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED) if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED)
{ {
swprintf(sTemp, L"% 4d", BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased); swprintf(sTemp, L"% 4d", BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased);
DrawTextToScreen(sTemp, BOBBYR_ITEMS_BOUGHT_X, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); auto bobbyRItemsBoughtX{ BOBBYR_ITEMS_BOUGHT_X };
if (g_lang == i18n::Lang::zh) {
bobbyRItemsBoughtX -= 10;
}
DrawTextToScreen(sTemp, bobbyRItemsBoughtX, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
} }
} }
@@ -2516,11 +2517,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex,
//if it's a used item, display how damaged the item is //if it's a used item, display how damaged the item is
if( fUsed ) if( fUsed )
{ {
#ifdef CHINESE if ( g_lang == i18n::Lang::zh ) {
swprintf( sTemp, ChineseSpecString2, LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality );//zww swprintf( sTemp, ChineseSpecString2, LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality );//zww
#else } else {
swprintf( sTemp, L"*%3d%%%%", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ); swprintf( sTemp, L"*%3d%%%%", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality );
#endif }
DrawTextToScreen(sTemp, (UINT16)(BOBBYR_ITEM_NAME_X-2), (UINT16)(usPosY - BOBBYR_ORDER_NUM_Y_OFFSET), BOBBYR_ORDER_NUM_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); DrawTextToScreen(sTemp, (UINT16)(BOBBYR_ITEM_NAME_X-2), (UINT16)(usPosY - BOBBYR_ORDER_NUM_Y_OFFSET), BOBBYR_ORDER_NUM_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED);
} }
@@ -2653,11 +2654,11 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter, INT32 iSubFilte
{ {
if (iSubFilter > -1 ) if (iSubFilter > -1 )
{ {
if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & iSubFilter) if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & iSubFilter)
bCntNumItems = TRUE; bCntNumItems = TRUE;
else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex))
bCntNumItems = TRUE; bCntNumItems = TRUE;
else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment ) else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex))
bCntNumItems = TRUE; bCntNumItems = TRUE;
} }
else else
@@ -3641,11 +3642,11 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass )
{ {
if (guiCurrentMiscSubFilterMode > -1) // Madd: new BR filter options if (guiCurrentMiscSubFilterMode > -1) // Madd: new BR filter options
{ {
if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & guiCurrentMiscSubFilterMode) if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & guiCurrentMiscSubFilterMode)
bCntItem = TRUE; bCntItem = TRUE;
else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex))
bCntItem = TRUE; bCntItem = TRUE;
else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment) else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex))
bCntItem = TRUE; bCntItem = TRUE;
} }
else else
@@ -4181,7 +4182,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
for (it = range.first; it != range.second; it++) for (it = range.first; it != range.second; it++)
{ {
UINT16 attachmentId = it->second.attachmentIndex; UINT16 attachmentId = it->second.attachmentIndex;
if (!Item[attachmentId].hiddenaddon && !Item[attachmentId].hiddenattachment && ItemIsLegal(attachmentId, TRUE)) if (!ItemIsHiddenAddon(attachmentId) && !ItemIsHiddenAttachment(attachmentId) && ItemIsLegal(attachmentId, TRUE))
{ {
fAttachmentsFound = TRUE; fAttachmentsFound = TRUE;
if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[attachmentId].szItemName) == FALSE) if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[attachmentId].szItemName) == FALSE)
@@ -4194,7 +4195,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
for (UINT32 itemId = 1; itemId < gMAXITEMS_READ; itemId++) for (UINT32 itemId = 1; itemId < gMAXITEMS_READ; itemId++)
{ {
// If the attachment is not hidden and attachable to the gun (usItemNumber) // If the attachment is not hidden and attachable to the gun (usItemNumber)
if (!Item[itemId].hiddenaddon && !Item[itemId].hiddenattachment && if (!ItemIsHiddenAddon(itemId) && !ItemIsHiddenAttachment(itemId) &&
ItemIsLegal(itemId, TRUE) && IsAttachmentPointAvailable(Item[usItemNumber].uiIndex, itemId)) ItemIsLegal(itemId, TRUE) && IsAttachmentPointAvailable(Item[usItemNumber].uiIndex, itemId))
{ {
fAttachmentsFound = TRUE; fAttachmentsFound = TRUE;
+7 -6
View File
@@ -30,6 +30,7 @@
#include "GameSettings.h" #include "GameSettings.h"
#include <vfs/Core/vfs.h> #include <vfs/Core/vfs.h>
#include <vfs/Core/File/vfs_file.h> #include <vfs/Core/File/vfs_file.h>
#include <language.hpp>
/* /*
typedef struct typedef struct
@@ -488,11 +489,11 @@ BOOLEAN EnterBobbyRMailOrder()
SetButtonCursor(guiBobbyRClearOrder, CURSOR_LAPTOP_SCREEN); SetButtonCursor(guiBobbyRClearOrder, CURSOR_LAPTOP_SCREEN);
SpecifyDisabledButtonStyle( guiBobbyRClearOrder, DISABLED_STYLE_NONE ); SpecifyDisabledButtonStyle( guiBobbyRClearOrder, DISABLED_STYLE_NONE );
//inshy: fix position of text for buttons //inshy: fix position of text for buttons
#ifdef FRENCH if(g_lang == i18n::Lang::fr) {
SpecifyButtonTextOffsets( guiBobbyRClearOrder, 13, 10, TRUE ); SpecifyButtonTextOffsets( guiBobbyRClearOrder, 13, 10, TRUE );
#else } else {
SpecifyButtonTextOffsets( guiBobbyRClearOrder, 39, 10, TRUE ); SpecifyButtonTextOffsets( guiBobbyRClearOrder, 39, 10, TRUE );
#endif }
// Accept Order button // Accept Order button
guiBobbyRAcceptOrderImage = LoadButtonImage("LAPTOP\\AcceptOrderButton.sti", 2,0,-1,1,-1 ); guiBobbyRAcceptOrderImage = LoadButtonImage("LAPTOP\\AcceptOrderButton.sti", 2,0,-1,1,-1 );
@@ -504,11 +505,11 @@ BOOLEAN EnterBobbyRMailOrder()
DEFAULT_MOVE_CALLBACK, BtnBobbyRAcceptOrderCallback); DEFAULT_MOVE_CALLBACK, BtnBobbyRAcceptOrderCallback);
SetButtonCursor( guiBobbyRAcceptOrder, CURSOR_LAPTOP_SCREEN); SetButtonCursor( guiBobbyRAcceptOrder, CURSOR_LAPTOP_SCREEN);
//inshy: fix position of text for buttons //inshy: fix position of text for buttons
#ifdef FRENCH if(g_lang == i18n::Lang::fr) {
SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 15, 24, TRUE ); SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 15, 24, TRUE );
#else } else {
SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 43, 24, TRUE ); SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 43, 24, TRUE );
#endif }
SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED );
if( gbSelectedCity == -1 ) if( gbSelectedCity == -1 )
+226 -45
View File
@@ -17,6 +17,7 @@
#include "IMP Compile Character.h" #include "IMP Compile Character.h"
#include "IMP Disability Trait.h" #include "IMP Disability Trait.h"
#include "IMP Character Trait.h" #include "IMP Character Trait.h"
#include "IMP Minor Trait.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "Interface.h" #include "Interface.h"
@@ -602,81 +603,187 @@ void ResetDisplaySkills()
extern INT32 SkillsList[ ATTITUDE_LIST_SIZE ]; extern INT32 SkillsList[ ATTITUDE_LIST_SIZE ];
BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) extern BOOLEAN gfSkillTraitQuestions[20];
extern BOOLEAN gfSkillTraitQuestions2[20];
extern BOOLEAN gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS];
BOOLEAN IsBackGroundAllowed(UINT16 ubNumber)
{ {
if ( !ubNumber ) if (!ubNumber)
return FALSE; return FALSE;
// some backgrounds are only allowed to specific genders. Set both to forbid a background from ever showing up in IMP creation (for merc-specific backgrounds) // some backgrounds are only allowed to specific genders. Set both to forbid a background from ever showing up in IMP creation (for merc-specific backgrounds)
if ( fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_MALE ) if (fCharacterIsMale && zBackground[ubNumber].uiFlags & BACKGROUND_NO_MALE)
return FALSE; return FALSE;
else if ( !fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_FEMALE ) else if (!fCharacterIsMale && zBackground[ubNumber].uiFlags & BACKGROUND_NO_FEMALE)
return FALSE; return FALSE;
if ( SkillsList[0] == HEAVY_WEAPONS_NT || SkillsList[1] == HEAVY_WEAPONS_NT || SkillsList[2] == HEAVY_WEAPONS_NT ) // added new ini-options and accompanying background-tag
// choices in skills/character-traits/disabilities determine available backgrounds if true in ja2options.ini
// new tag <alt_impcreation> has been added to backgrounds.xml
if (!gGameExternalOptions.fAltIMPCreation)
{ {
if ( zBackground[ ubNumber ].value[BG_ARTILLERY] > 0 ) if (zBackground[ubNumber].uiFlags & BACKGROUND_ALT_IMP_CREATION) // don't show BG with tag <alt_impcreation> if Alt_Imp_Creation isn't true in ja2options.ini
{
return FALSE;
}
else
{
return TRUE;
}
}
// show BG with tag <alt_impcreation>,
// but don't show BG whose tags would contradict with a main bonus/penalty gained by skill/char-trait/disability
if (gGameExternalOptions.fAltIMPCreation)
// define which tags are considered contradicting for major traits, minor traits, disablities and character traits
// major traits (single-trait and dual-trait)
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS])
{
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS])
{
if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //dual trait (expert)
return FALSE;
}
else
{
if (zBackground[ubNumber].value[BG_ARTILLERY] > 10) //single trait
return FALSE;
}
}
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER])
{
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER])
{
if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0 || zBackground[ubNumber].value[BG_MARKSMANSHIP] < 0 )
return FALSE;
}
else
{
if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0 )
return FALSE;
}
}
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS])
{
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS])
{
if (zBackground[ubNumber].value[BG_RESI_PHYSICAL] < 0 )
return FALSE;
}
else
{
if (zBackground[ubNumber].value[BG_RESI_PHYSICAL] < 0 )
return FALSE;
}
}
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN])
{
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN])
{
if (zBackground[ubNumber].value[BG_MECHANICAL] < 0)
return FALSE;
}
else
{
if (zBackground[ubNumber].value[BG_MECHANICAL] < 0)
return FALSE;
}
}
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR])
{
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR])
{
if (zBackground[ubNumber].value[BG_PERC_BANDAGING] < 0 || zBackground[ubNumber].value[BG_MEDICAL] < 0 )
return FALSE;
}
else
{
if (zBackground[ubNumber].value[BG_PERC_BANDAGING] < 0)
return FALSE;
}
}
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_SQUADLEADER] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_SQUADLEADER])
{
if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_SQUADLEADER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_SQUADLEADER])
{
if (zBackground[ubNumber].value[BG_RESI_SUPPRESSION] < 0 || zBackground[ubNumber].value[BG_RESI_FEAR] < 0 )
return FALSE;
}
else
{
if (zBackground[ubNumber].value[BG_RESI_SUPPRESSION] < 0)
return FALSE;
}
}
// Minor Traits (single trait only)
if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_MELEE])
{
if (zBackground[ubNumber].value[BG_PERC_CTH_BLADE] < 0 || zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0 )
return FALSE; return FALSE;
} }
if ( SkillsList[0] == SNIPER_NT || SkillsList[1] == SNIPER_NT || SkillsList[2] == SNIPER_NT ) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_STEALTHY])
{ {
if ( zBackground[ ubNumber ].value[BG_PERC_CTH_MAX] < 0 ) if (zBackground[ubNumber].value[BG_PERC_STEALTH] < 0)
return FALSE; return FALSE;
} }
if ( SkillsList[0] == SURVIVAL_NT || SkillsList[1] == SURVIVAL_NT || SkillsList[2] == SURVIVAL_NT ) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_DEMOLITIONS])
{ {
if ( zBackground[ ubNumber ].value[BG_PERC_CAMO] < 0 ) if (zBackground[ubNumber].value[BG_BONUS_BREACHINGCHARGE] < 0 || zBackground[ubNumber].value[BG_EXPLOSIVE_ASSIGN] < 0 )
return FALSE; return FALSE;
} }
if ( SkillsList[0] == MARTIAL_ARTS_NT || SkillsList[1] == MARTIAL_ARTS_NT || SkillsList[2] == MARTIAL_ARTS_NT ) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_SURVIVAL])
{ {
if ( zBackground[ ubNumber ].value[BG_PERC_DAMAGE_MELEE] < 0 ) if (zBackground[ubNumber].value[BG_TRAVEL_FOOT] < 0 || zBackground[ubNumber].value[BG_TRAVEL_CAR] <0 || zBackground[ubNumber].value[BG_TRAVEL_AIR] <0 ||
zBackground[ubNumber].value[BG_RESI_DISEASE] < 0 || zBackground[ubNumber].value[BG_SNAKEDEFENSE] < 0 )
return FALSE; return FALSE;
} }
if ( SkillsList[0] == TECHNICIAN_NT || SkillsList[1] == TECHNICIAN_NT || SkillsList[2] == TECHNICIAN_NT ) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_BODYBUILDING])
{ {
if ( zBackground[ ubNumber ].value[BG_MECHANICAL] < 0 ) if (zBackground[ubNumber].value[BG_PERC_CARRYSTRENGTH] < 0)
return FALSE; return FALSE;
} }
if ( SkillsList[0] == DOCTOR_NT || SkillsList[1] == DOCTOR_NT || SkillsList[2] == DOCTOR_NT ) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_AMBIDEXTROUS])
{ {
if ( zBackground[ ubNumber ].value[BG_MEDICAL] < 0 ) if (zBackground[ubNumber].value[BG_INVENTORY] > 0)
return FALSE; return FALSE;
} }
if ( SkillsList[0] == MELEE_NT || SkillsList[1] == MELEE_NT || SkillsList[2] == MELEE_NT ) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_NIGHT_OPS])
{ {
if ( zBackground[ ubNumber ].value[BG_PERC_CTH_BLADE] < 0 ) if (zBackground[ubNumber].value[BG_PERC_SLEEP] > 0 || zBackground[ubNumber].value[BG_PERC_HEARING_NIGHT] < 0 )
return FALSE; return FALSE;
} }
if ( SkillsList[0] == STEALTHY_NT || SkillsList[1] == STEALTHY_NT || SkillsList[2] == STEALTHY_NT ) // Disabiliies
{ switch (iChosenDisabilityTrait())
if ( zBackground[ ubNumber ].value[BG_PERC_STEALTH] < 0 )
return FALSE;
}
if ( SkillsList[0] == ATHLETICS_NT || SkillsList[1] == ATHLETICS_NT || SkillsList[2] == ATHLETICS_NT )
{
if ( zBackground[ ubNumber ].value[BG_PERC_SPEED_RUNNING] < 0 )
return FALSE;
}
if ( SkillsList[0] == DEMOLITIONS_NT || SkillsList[1] == DEMOLITIONS_NT || SkillsList[2] == DEMOLITIONS_NT )
{
if ( zBackground[ ubNumber ].value[BG_EXPLOSIVE_ASSIGN] < 0 )
return FALSE;
}
switch ( iChosenDisabilityTrait() )
{ {
case HEAT_INTOLERANT: case HEAT_INTOLERANT:
if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 ) if (zBackground[ubNumber].value[BG_DESERT] > 0 || zBackground[ubNumber].value[BG_TROPICAL] > 0)
return FALSE; return FALSE;
break; break;
case NERVOUS: case NERVOUS:
@@ -686,7 +793,7 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber )
return FALSE; return FALSE;
break; break;
case NONSWIMMER: case NONSWIMMER:
if ( zBackground[ ubNumber ].value[BG_RIVER] > 0 || zBackground[ ubNumber ].value[BG_COASTAL] > 0 || zBackground[ ubNumber ].value[BG_SWIMMING] > 0 ) if ( zBackground[ ubNumber ].value[BG_RIVER] > 0 || zBackground[ ubNumber ].value[BG_COASTAL] > 0 )
return FALSE; return FALSE;
break; break;
case FEAR_OF_INSECTS: case FEAR_OF_INSECTS:
@@ -694,35 +801,109 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber )
return FALSE; return FALSE;
break; break;
case FORGETFUL: case FORGETFUL:
if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) if (zBackground[ubNumber].value[BG_INVENTORY] < 0 || zBackground[ubNumber].value[BG_ASSAULT] < 0 )
return FALSE; return FALSE;
break; break;
case PSYCHO: case PSYCHO:
if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) if (zBackground[ubNumber].value[BG_LEADERSHIP] > 5)
return FALSE;
break;
case DEAF:
if (zBackground[ ubNumber ].value[BG_PERC_HEARING_NIGHT] > 0 || zBackground[ ubNumber ].value[BG_PERC_HEARING_DAY] > 0)
return FALSE;
break;
case SHORTSIGHTED:
if (zBackground[ ubNumber ].value[BG_PERC_CTH_MAX] > 0 || zBackground[ubNumber].value[BG_PERC_SPOTTER] > 0 )
return FALSE;
break;
case HEMOPHILIAC:
if (zBackground[ubNumber].value[BG_RESI_DISEASE] > 0)
return FALSE; return FALSE;
break; break;
case AFRAID_OF_HEIGHTS: case AFRAID_OF_HEIGHTS:
if ( zBackground[ubNumber].value[BG_HEIGHT] > 0 ) if ( zBackground[ ubNumber ].value[BG_HEIGHT] > 0 || zBackground[ubNumber].value[BG_AIRDROP] > 0 )
return FALSE;
break;
case SELF_HARM:
if (zBackground[ubNumber].value[BG_RESI_DISEASE] > 0)
return FALSE; return FALSE;
break; break;
default: default:
break; break;
} }
switch ( iChosenCharacterTrait() ) // Character Traits
switch (iChosenCharacterTrait())
{ {
case CHAR_TRAIT_SOCIABLE: case CHAR_TRAIT_SOCIABLE:
if ( zBackground[ ubNumber ].uiFlags & BACKGROUND_XENOPHOBIC ) if (zBackground[ubNumber].uiFlags & BACKGROUND_XENOPHOBIC || zBackground[ubNumber].value[BG_PERC_SPOTTER] < 0)
return FALSE; return FALSE;
break; break;
case CHAR_TRAIT_LONER: case CHAR_TRAIT_LONER:
if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) if (zBackground[ubNumber].value[BG_LEADERSHIP] > 0 || zBackground[ubNumber].value[BG_PERC_SPOTTER] > 0)
return FALSE;
break;
case CHAR_TRAIT_OPTIMIST:
if (zBackground[ubNumber].uiFlags & BACKGROUND_TRAPLEVEL)
return FALSE;
break;
case CHAR_TRAIT_ASSERTIVE:
if (zBackground[ubNumber].value[BG_PERC_INTERROGATION] < 0 || zBackground[ubNumber].value[BG_PERC_APPROACH_THREATEN] < 0)
return FALSE;
break;
case CHAR_TRAIT_INTELLECTUAL:
if (zBackground[ubNumber].value[BG_ADMINISTRATION_ASSIGNMENT] < 0)
return FALSE;
break;
case CHAR_TRAIT_PRIMITIVE:
if (zBackground[ubNumber].value[BG_ADMINISTRATION_ASSIGNMENT] > 0)
return FALSE;
break;
case CHAR_TRAIT_AGGRESSIVE:
if (zBackground[ubNumber].uiFlags & BACKGROUND_TRAPLEVEL || zBackground[ubNumber].value[BG_PERC_DISARM] > 0 )
return FALSE;
break;
case CHAR_TRAIT_PHLEGMATIC:
if (zBackground[ubNumber].value[BG_ASSAULT] > 0 )
return FALSE;
break;
case CHAR_TRAIT_DAUNTLESS:
if (zBackground[ubNumber].value[BG_CROUCHEDDEFENSE] < 0 )
return FALSE;
break;
case CHAR_TRAIT_PACIFIST:
break;
case CHAR_TRAIT_MALICIOUS:
if (zBackground[ubNumber].value[BG_PERC_APPROACH_FRIENDLY] > 0)
return FALSE;
break;
case CHAR_TRAIT_SHOWOFF:
break;
case CHAR_TRAIT_COWARD:
if (zBackground[ubNumber].value[BG_PERC_CAPITULATION] > 0)
return FALSE; return FALSE;
break; break;
default: default:
break; break;
} }
// show exclusivly the BG's with tag <alt_impcreation> if Reduced_Imp_Creation is true in ja2options.ini
// requires Alt_Imp_Creation to be true in ja2options.ini (otherwise BG's with tag <alt_impcreation> won't be shown)
if (gGameExternalOptions.fReducedIMPCreation)
{
if (zBackground[ubNumber].uiFlags & BACKGROUND_ALT_IMP_CREATION)
{
return TRUE;
}
else
{
return FALSE;
}
}
return TRUE; return TRUE;
} }
+9 -13
View File
@@ -24,6 +24,7 @@
#include "text.h" #include "text.h"
#include "LaptopSave.h" #include "LaptopSave.h"
#include <language.hpp>
#define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138 #define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138
#define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195 #define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195
@@ -552,14 +553,14 @@ void HandleBeginScreenTextEvent( UINT32 uiKey )
//Heinz (18.01.2009): Russian layout //Heinz (18.01.2009): Russian layout
// ViSoR (07.01.2012) : Russian and Belarussian layouts // ViSoR (07.01.2012) : Russian and Belarussian layouts
// //
#if defined(RUSSIAN) || defined(BELARUSSIAN) if(g_lang == i18n::Lang::ru) {
// ViSoR (02.02.2013): Fix for Cyrillic layouts // ViSoR (02.02.2013): Fix for Cyrillic layouts
DWORD threadId = GetWindowThreadProcessId( ghWindow, 0 ); DWORD threadId = GetWindowThreadProcessId( ghWindow, 0 );
DWORD layout = (DWORD)GetKeyboardLayout( threadId ) & 0xFFFF; DWORD layout = (DWORD)GetKeyboardLayout( threadId ) & 0xFFFF;
if( layout == 0x419 ) // Russian if( layout == 0x419 ) // Russian
{ {
unsigned char TranslationTable[] = unsigned char TranslationTable[] =
" #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨"; " #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨ ";
uiKey = TranslateKey( uiKey, TranslationTable ); uiKey = TranslateKey( uiKey, TranslationTable );
uiKey = GetCyrillicUnicodeChar( uiKey ); uiKey = GetCyrillicUnicodeChar( uiKey );
@@ -567,28 +568,23 @@ void HandleBeginScreenTextEvent( UINT32 uiKey )
else if( layout == 0x423 ) // Belarussian else if( layout == 0x423 ) // Belarussian
{ {
unsigned char TranslationTable[] = unsigned char TranslationTable[] =
" #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#Ô²ÑÂÓÀÏÐØÎËÄÜÒ¡ÇÉÊÛÅÃÌÖ×Íßõ#'#_¸ô³ñâóàïðøîëäüò¢çéêûåãìö÷íÿÕ#'¨"; " #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#Ô²ÑÂÓÀÏÐØÎËÄÜÒ¡ÇÉÊÛÅÃÌÖ×Íßõ#'#_¸ô³ñâóàïðøîëäüò¢çéêûåãìö÷íÿÕ#'¨ ";
uiKey = TranslateKey( uiKey, TranslationTable ); uiKey = TranslateKey( uiKey, TranslationTable );
uiKey = GetCyrillicUnicodeChar( uiKey ); uiKey = GetCyrillicUnicodeChar( uiKey );
} }
else if( !CheckIsKeyValid( uiKey ) ) else if( !CheckIsKeyValid( uiKey ) )
uiKey = '#'; uiKey = '#';
}
if( uiKey != '#') if( (g_lang != i18n::Lang::ru &&
#else uiKey >= 'A' && uiKey <= 'Z' ||
#ifndef USE_CODE_PAGE
if( uiKey >= 'A' && uiKey <= 'Z' ||
uiKey >= 'a' && uiKey <= 'z' || uiKey >= 'a' && uiKey <= 'z' ||
uiKey >= '0' && uiKey <= '9' || uiKey >= '0' && uiKey <= '9' ||
uiKey == '_' || uiKey == '.' || uiKey == '_' || uiKey == '.' ||
uiKey == ' ' || uiKey == '"' || uiKey == ' ' || uiKey == '"' ||
uiKey == 39 // This is ' which cannot be written explicitly here of course uiKey == 39 // This is ' which cannot be written explicitly here of course
) ) ||
#else uiKey != '#')
if( charSet::IsFromSet( uiKey, charSet::CS_SPACE|charSet::CS_ALPHA_NUM|charSet::CS_SPECIAL_ALPHA ) )
#endif
#endif
{ {
// if the current string position is at max or great, do nothing // if the current string position is at max or great, do nothing
switch( ubTextEnterMode ) switch( ubTextEnterMode )
+5 -5
View File
@@ -526,7 +526,7 @@ void DistributeInitialGear(MERCPROFILESTRUCT *pProfile)
if(iOrder[i]!=-1) if(iOrder[i]!=-1)
{ {
// skip if this item is an attachment // skip if this item is an attachment
if(Item[tInv[iOrder[i]].inv].attachment) if(ItemIsAttachment(tInv[iOrder[i]].inv))
continue; continue;
iSet = FALSE; iSet = FALSE;
number = tInv[iOrder[i]].iNumber; number = tInv[iOrder[i]].iNumber;
@@ -1103,7 +1103,7 @@ INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHow
return HELMETPOS; return HELMETPOS;
if ( pProfile->inv[VESTPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_VEST ) if ( pProfile->inv[VESTPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_VEST )
return VESTPOS; return VESTPOS;
if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !(Item[usItem].attachment)) if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !ItemIsAttachment(usItem) )
return LEGPOS; return LEGPOS;
break; break;
case IC_BLADE: case IC_BLADE:
@@ -1132,7 +1132,7 @@ INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHow
case IC_GUN: case IC_GUN:
if ( pProfile->inv[HANDPOS] == NONE ) if ( pProfile->inv[HANDPOS] == NONE )
return HANDPOS; return HANDPOS;
if ( pProfile->inv[SECONDHANDPOS] == NONE && !(Item[pProfile->inv[HANDPOS]].twohanded)) if ( pProfile->inv[SECONDHANDPOS] == NONE && !(ItemIsTwoHanded(pProfile->inv[HANDPOS])))
return SECONDHANDPOS; return SECONDHANDPOS;
if((UsingNewInventorySystem() == true)) if((UsingNewInventorySystem() == true))
if ( pProfile->inv[GUNSLINGPOCKPOS] == NONE && pProfile->inv[BPACKPOCKPOS] == NONE && LBEPocketType[1].ItemCapacityPerSize[Item[usItem].ItemSize]!=0) if ( pProfile->inv[GUNSLINGPOCKPOS] == NONE && pProfile->inv[BPACKPOCKPOS] == NONE && LBEPocketType[1].ItemCapacityPerSize[Item[usItem].ItemSize]!=0)
@@ -1681,7 +1681,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex )
// give ammo for guns // give ammo for guns
Assert( usItem < gMAXITEMS_READ ); Assert( usItem < gMAXITEMS_READ );
if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) )
{ {
usItem = DefaultMagazine(usItem); usItem = DefaultMagazine(usItem);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give ammo typeIndex = %d, usItem = %d ",typeIndex, usItem )); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give ammo typeIndex = %d, usItem = %d ",typeIndex, usItem ));
@@ -1726,7 +1726,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd
MakeProfileInvItemAnySlot(pProfile,usItem,100,1); MakeProfileInvItemAnySlot(pProfile,usItem,100,1);
// give ammo for guns // give ammo for guns
if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) )
{ {
usItem = DefaultMagazine(usItem); usItem = DefaultMagazine(usItem);
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem ));
+1 -1
View File
@@ -1285,7 +1285,7 @@ void DistributePossibleItemsToVectors(void)
{ {
gIMPPossibleItems[HANDPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName)); gIMPPossibleItems[HANDPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName));
if (Item[usItem].twohanded) { if (ItemIsTwoHanded(usItem)) {
gIMPPossibleItems[GUNSLINGPOCKPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName)); gIMPPossibleItems[GUNSLINGPOCKPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName));
} }
else { else {
+4 -3
View File
@@ -38,6 +38,7 @@
#include "GameSettings.h" #include "GameSettings.h"
#endif #endif
#include <language.hpp>
#define IMP_SEEK_AMOUNT 5 * 80 * 2 #define IMP_SEEK_AMOUNT 5 * 80 * 2
@@ -204,18 +205,18 @@ void PrintImpText( void )
LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0);
//inshy (18.01.2009): fix position for russian text //inshy (18.01.2009): fix position for russian text
#ifdef RUSSIAN if( g_lang == i18n::Lang::ru ) {
// male // male
LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 225, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 225, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0);
// female // female
LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 335, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 335, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0);
#else } else {
// male // male
LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0);
// female // female
LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0);
#endif }
break; break;
case ( IMP_PERSONALITY ): case ( IMP_PERSONALITY ):
+1 -1
View File
@@ -15,7 +15,7 @@
#include "../../TileEngine/Isometric Utils.h" // defines NOWHERE #include "../../TileEngine/Isometric Utils.h" // defines NOWHERE
#include "../../Utils/Debug Control.h" // LiveMessage #include "../../Utils/Debug Control.h" // LiveMessage
#include "../../Utils/Font Control.h" // ScreenMsg about deadlock #include "../../Utils/Font Control.h" // ScreenMsg about deadlock
#include "../../Utils/Text.h" // Sniper warning #include <Text.h> // Sniper warning
#include "../../Utils/message.h" // ditto #include "../../Utils/message.h" // ditto
+2 -2
View File
@@ -1198,7 +1198,7 @@ void EnemyHeliMANPADSCheck( INT16 id )
if ( pObj ) if ( pObj )
{ {
// abort if this is a launcher without ammo // abort if this is a launcher without ammo
if ( Item[pObj->usItem].rocketlauncher && !Item[pObj->usItem].singleshotrocketlauncher ) if (ItemIsRocketLauncher(pObj->usItem) && !ItemIsSingleShotRocketLauncher(pObj->usItem))
{ {
OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE );
if ( !pAttachment->exists( ) ) if ( !pAttachment->exists( ) )
@@ -1227,7 +1227,7 @@ void EnemyHeliMANPADSCheck( INT16 id )
MapScreenMessage( FONT_MCOLOR_LTRED, MSG_INTERFACE, szEnemyHeliText[7], pSoldier->GetName( ), Item[pObj->usItem].szItemName, pStrSectorName ); MapScreenMessage( FONT_MCOLOR_LTRED, MSG_INTERFACE, szEnemyHeliText[7], pSoldier->GetName( ), Item[pObj->usItem].szItemName, pStrSectorName );
// 'fire' (remove shot) // 'fire' (remove shot)
if ( Item[pObj->usItem].singleshotrocketlauncher ) if (ItemIsSingleShotRocketLauncher(pObj->usItem))
{ {
CreateItem( Item[pObj->usItem].discardedlauncheritem, (*pObj)[0]->data.objectStatus, pObj ); CreateItem( Item[pObj->usItem].discardedlauncheritem, (*pObj)[0]->data.objectStatus, pObj );
+12 -12
View File
@@ -1562,7 +1562,7 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier )
return ( TRUE ); return ( TRUE );
// Flugente: stats can also be damaged // Flugente: stats can also be damaged
if ( !UsingFoodSystem() || ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold ) ) if ( !UsingFoodSystem() || ( pSoldier->bFoodLevel >= FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel >= FoodMoraleMods[FOOD_NORMAL].bThreshold ) )
{ {
if ( pSoldier->usStarveDamageHealth > 0 || pSoldier->usStarveDamageStrength > 0 ) if ( pSoldier->usStarveDamageHealth > 0 || pSoldier->usStarveDamageStrength > 0 )
return ( TRUE ); return ( TRUE );
@@ -3349,7 +3349,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
} }
// can't repair at all without a toolkit // can't repair at all without a toolkit
if (!Item[pSoldier->inv[HANDPOS].usItem].toolkit ) if (!ItemIsToolkit(pSoldier->inv[HANDPOS].usItem))
{ {
*pusMaxPts = 0; *pusMaxPts = 0;
return(0); return(0);
@@ -4063,7 +4063,7 @@ UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier)
// CHRISL: Changed to dynamically determine max inventory locations. // CHRISL: Changed to dynamically determine max inventory locations.
for (int ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ++ubPocket) for (int ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ++ubPocket)
{ {
if( Item[pSoldier->inv[ ubPocket ].usItem].toolkit ) if(ItemIsToolkit(pSoldier->inv[ ubPocket ].usItem))
{ {
usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) ); usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) );
} }
@@ -5138,7 +5138,7 @@ void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT16 * pbStatus, IN
// repairs on electronic items take twice as long if the guy doesn't have the skill // repairs on electronic items take twice as long if the guy doesn't have the skill
// Technician/Electronic traits - repairing electronic items - SANDRO // Technician/Electronic traits - repairing electronic items - SANDRO
if ( Item[ usItem ].electronic ) if (ItemIsElectronic(usItem))
{ {
if (gGameOptions.fNewTraitSystem) if (gGameOptions.fNewTraitSystem)
{ {
@@ -5745,7 +5745,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
BOOLEAN IsItemRepairable(SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold ) BOOLEAN IsItemRepairable(SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold )
{ {
// check to see if item can/needs to be repaired // check to see if item can/needs to be repaired
if ( ( bStatus < 100) && ( Item[ usItem ].repairable ) ) if ( ( bStatus < 100) && ItemIsRepairable(usItem) )
{ {
if ( gGameExternalOptions.fAdvRepairSystem ) if ( gGameExternalOptions.fAdvRepairSystem )
{ {
@@ -10459,7 +10459,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier )
INT8 bPocket = 0, bonus = -101, bToolkitPocket = NO_SLOT; INT8 bPocket = 0, bonus = -101, bToolkitPocket = NO_SLOT;
// if there isn't a toolkit in his hand // if there isn't a toolkit in his hand
if( Item[pSoldier->inv[ HANDPOS].usItem].toolkit ) if(ItemIsToolkit(pSoldier->inv[ HANDPOS].usItem))
{ {
bonus = Item[pSoldier->inv[ HANDPOS].usItem].RepairModifier; bonus = Item[pSoldier->inv[ HANDPOS].usItem].RepairModifier;
bToolkitPocket = HANDPOS; bToolkitPocket = HANDPOS;
@@ -10469,7 +10469,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier )
// CHRISL: Changed to dynamically determine max inventory locations. // CHRISL: Changed to dynamically determine max inventory locations.
for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket)
{ {
if( Item[pSoldier->inv[ bPocket ].usItem].toolkit && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus) if(ItemIsToolkit(pSoldier->inv[ bPocket ].usItem) && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus)
{ {
bonus = Item[pSoldier->inv[ bPocket ].usItem].RepairModifier; bonus = Item[pSoldier->inv[ bPocket ].usItem].RepairModifier;
bToolkitPocket = bPocket; bToolkitPocket = bPocket;
@@ -10503,7 +10503,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
fTeamPanelDirty = TRUE; fTeamPanelDirty = TRUE;
// if there is a MEDICAL BAG in his hand, we're set // if there is a MEDICAL BAG in his hand, we're set
if ( Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) if (ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem))
{ {
return(TRUE); return(TRUE);
} }
@@ -10511,7 +10511,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
// run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found // run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found
for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket)
{ {
if ( Item[pSoldier->inv[ bPocket ].usItem].medicalkit ) if (ItemIsMedicalKit(pSoldier->inv[ bPocket ].usItem))
{ {
medkit_found = true; medkit_found = true;
can_swap = true; can_swap = true;
@@ -10579,7 +10579,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
return FALSE; return FALSE;
// we didn't find a medical bag, so settle for a FIRST AID KIT // we didn't find a medical bag, so settle for a FIRST AID KIT
if ( Item[pSoldier->inv[ HANDPOS ].usItem].firstaidkit ) if (ItemIsFirstAidKit(pSoldier->inv[ HANDPOS ].usItem))
{ {
return(TRUE); return(TRUE);
} }
@@ -10588,10 +10588,10 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit)
// CHRISL: Changed to dynamically determine max inventory locations. // CHRISL: Changed to dynamically determine max inventory locations.
for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket)
{ {
if ( Item[pSoldier->inv[ bPocket ].usItem].firstaidkit ) if (ItemIsFirstAidKit(pSoldier->inv[ bPocket ].usItem))
{ {
// CHRISL: This needs to start with the first "non-big" pocket. // CHRISL: This needs to start with the first "non-big" pocket.
if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].twohanded ) && ( bPocket >= SMALLPOCKSTART ) ) if( (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && (bPocket >= SMALLPOCKSTART)))
{ {
// first move from hand to second hand // first move from hand to second hand
SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE ); SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE );
+2 -2
View File
@@ -4257,7 +4257,7 @@ BOOLEAN FireTankCannon( SOLDIERCELL *pAttacker )
{ {
pItem = &pSoldier->inv[i]; pItem = &pSoldier->inv[i];
if ( Item[pItem->usItem].cannon ) if (ItemIsCannon(pItem->usItem))
{ {
PlayAutoResolveSample( Weapon[pItem->usItem].sSound, RATE_11025, 50, 1, MIDDLEPAN ); PlayAutoResolveSample( Weapon[pItem->usItem].sSound, RATE_11025, 50, 1, MIDDLEPAN );
@@ -4291,7 +4291,7 @@ BOOLEAN FireAntiTankWeapon( SOLDIERCELL *pAttacker )
{ {
pItem = &pSoldier->inv[i]; pItem = &pSoldier->inv[i];
if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || Item[pItem->usItem].cannon ) if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || ItemIsCannon(pItem->usItem))
{ {
pAttacker->bWeaponSlot = (INT8)i; pAttacker->bWeaponSlot = (INT8)i;
if ( gpAR->fUnlimitedAmmo ) if ( gpAR->fUnlimitedAmmo )
+1 -1
View File
@@ -627,7 +627,7 @@ void HourlySmokerUpdate( )
INT8 invsize = (INT8)pSoldier->inv.size( ); // remember inventorysize, so we don't call size() repeatedly INT8 invsize = (INT8)pSoldier->inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ... for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ...
{ {
if ( pSoldier->inv[bLoop].exists( ) && Item[pSoldier->inv[bLoop].usItem].cigarette ) if ( pSoldier->inv[bLoop].exists( ) && ItemIsCigarette(pSoldier->inv[bLoop].usItem) )
{ {
pObj = &(pSoldier->inv[bLoop]); pObj = &(pSoldier->inv[bLoop]);
+23 -56
View File
@@ -96,6 +96,7 @@ extern "C" {
#include "Merc Contract.h" #include "Merc Contract.h"
#include "message.h" #include "message.h"
#include "Town Militia.h" #include "Town Militia.h"
#include <language.hpp>
extern UINT8 gubWaitingForAllMercsToExitCode; extern UINT8 gubWaitingForAllMercsToExitCode;
@@ -13208,26 +13209,7 @@ static int l_GetUsedLanguage( lua_State *L )
{ {
if ( lua_gettop( L ) ) if ( lua_gettop( L ) )
{ {
INT32 val = 0; INT32 val = static_cast<INT32>(g_lang);
#if defined(ENGLISH)
val = 0;
#elif defined(GERMAN)
val = 1;
#elif defined(RUSSIAN)
val = 2;
#elif defined(DUTCH)
val = 3;
#elif defined(POLISH)
val = 4;
#elif defined(FRENCH)
val = 5;
#elif defined(ITALIAN)
val = 6;
#elif defined(CHINESE)
val = 7;
#endif
lua_pushinteger( L, val ); lua_pushinteger( L, val );
} }
@@ -13603,58 +13585,43 @@ static int l_GetNumHostilesInSector( lua_State *L )
void LuaGetIntelAndQuestMapData( INT32 aLevel ) void LuaGetIntelAndQuestMapData( INT32 aLevel )
{ {
static LuaScopeState _LS(true);
static bool isInitialized = false;
// Initialize only once during lifetime of program
if (!isInitialized)
{
isInitialized = true;
IniFunction(_LS.L(), TRUE);
IniGlobalGameSetting(_LS.L());
const char* filename = "scripts\\strategicmap.lua"; const char* filename = "scripts\\strategicmap.lua";
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
}
IniGlobalGameSetting(_LS.L()); LuaScopeState _LS( true );
IniFunction( _LS.L(), TRUE );
IniGlobalGameSetting( _LS.L() );
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 ); LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param<int>( aLevel ).Call( 1 );
} }
void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft ) void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft )
{ {
static LuaScopeState _LS(true);
static bool isInitialized = false;
// Initialize only once during lifetime of program
if (!isInitialized)
{
isInitialized = true;
IniFunction(_LS.L(), TRUE);
IniGlobalGameSetting(_LS.L());
const char* filename = "scripts\\strategicmap.lua"; const char* filename = "scripts\\strategicmap.lua";
SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget);
}
IniGlobalGameSetting(_LS.L()); LuaScopeState _LS( true );
IniFunction( _LS.L(), TRUE );
IniGlobalGameSetting( _LS.L() );
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 ); LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Param<int>( sProgressLeft ).Call( 6 );
} }
INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber ) INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber )
{ {
static LuaScopeState _LS( true );
static bool isInitialized = false;
// Initialize only once during lifetime of program
if (!isInitialized)
{
isInitialized = true;
IniFunction( _LS.L(), TRUE );
IniGlobalGameSetting(_LS.L());
const char* filename = "scripts\\strategicmap.lua"; const char* filename = "scripts\\strategicmap.lua";
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
}
IniGlobalGameSetting(_LS.L()); LuaScopeState _LS( true );
IniFunction( _LS.L(), TRUE );
IniGlobalGameSetting( _LS.L() );
SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget );
LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 ); LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param<int>( sSectorX ).Param<int>( sSectorY ).Param<int>( bSectorZ ).Param<int>( usFacilityType ).Param<int>( usProductionNumber ).Call( 5 );
if ( lua_gettop( _LS.L() ) >= 0 ) if ( lua_gettop( _LS.L() ) >= 0 )
+1 -1
View File
@@ -50,11 +50,11 @@
#include "Ja25 Strategic Ai.h" #include "Ja25 Strategic Ai.h"
#include "MapScreen Quotes.h" #include "MapScreen Quotes.h"
#include "SaveLoadGame.h" #include "SaveLoadGame.h"
#include "strategicmap.h"
#endif #endif
#include "connect.h" #include "connect.h"
#include <language.hpp>
struct UILayout_BottomButtons struct UILayout_BottomButtons
{ {
-6
View File
@@ -4,12 +4,6 @@
#include "types.h" #include "types.h"
#include "Soldier Control.h" #include "Soldier Control.h"
#ifdef CHINESE //zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows
#define MAX_MESSAGES_ON_MAP_BOTTOM 6
#else
#define MAX_MESSAGES_ON_MAP_BOTTOM 9
#endif
#ifdef JA2UB #ifdef JA2UB
extern INT8 gbExitingMapScreenToWhere; extern INT8 gbExitingMapScreenToWhere;
#endif #endif
@@ -1481,7 +1481,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason )
} }
else else
{ {
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !(Item[twItem->object.usItem].singleshotrocketlauncher)) if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !ItemIsSingleShotRocketLauncher(twItem->object.usItem))
{ {
EmptyWeaponMagazine( &twItem->object, &gItemPointer ); EmptyWeaponMagazine( &twItem->object, &gItemPointer );
InternalMAPBeginItemPointer( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] ); InternalMAPBeginItemPointer( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] );
@@ -6009,7 +6009,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
//original code by flugente, renamed variables to fit here, removed "min (OVERHEATING_MAX_TEMPERATURE, newValue)" for dirt to allow to go beyond maximum and deduct later the same amount if neccessary. //original code by flugente, renamed variables to fit here, removed "min (OVERHEATING_MAX_TEMPERATURE, newValue)" for dirt to allow to go beyond maximum and deduct later the same amount if neccessary.
// ... if we use overheating and item is a gun, a launcher or a barrel ... // ... if we use overheating and item is a gun, a launcher or a barrel ...
if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[itemStack->usItem].barrel == TRUE ) ) if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel(itemStack->usItem) ) )
{ {
for(INT16 i = 0; i < itemStack->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ... for(INT16 i = 0; i < itemStack->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ...
{ {
@@ -6017,7 +6017,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
FLOAT cooldownfactor = GetItemCooldownFactor(itemStack); // ... get item cooldown factor provided of attachments ... FLOAT cooldownfactor = GetItemCooldownFactor(itemStack); // ... get item cooldown factor provided of attachments ...
if ( Item[itemStack->usItem].barrel == TRUE ) // ... a barrel lying around cools down a bit faster ... if (ItemIsBarrel(itemStack->usItem)) // ... a barrel lying around cools down a bit faster ...
cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel; cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel;
FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ... FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ...
+7 -6
View File
@@ -56,6 +56,7 @@
#include "MilitiaSquads.h" #include "MilitiaSquads.h"
#include "LaptopSave.h" #include "LaptopSave.h"
#include <language.hpp>
// added by Flugente // added by Flugente
extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH]; extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH];
@@ -1199,11 +1200,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1");
// don't show loyalty string until loyalty tracking for that town has been started // don't show loyalty string until loyalty tracking for that town has been started
if( gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ]) if( gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ])
{ {
#ifdef CHINESE if ( g_lang == i18n::Lang::zh ) {
swprintf( sStringA, L"%d%£¥%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); swprintf( sStringA, L"%d%£¥%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]);
#else } else {
swprintf( sStringA, L"%d%%%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); swprintf( sStringA, L"%d%%%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]);
#endif }
// if loyalty is too low to train militia, and militia training is allowed here // if loyalty is too low to train militia, and militia training is allowed here
if ( ( gTownLoyalty[ bTown ].ubRating < iMinLoyaltyToTrain ) && MilitiaTrainingAllowedInTown( bTown ) ) if ( ( gTownLoyalty[ bTown ].ubRating < iMinLoyaltyToTrain ) && MilitiaTrainingAllowedInTown( bTown ) )
@@ -4873,11 +4874,11 @@ void BlitMineText( INT16 sMapX, INT16 sMapY )
// if potential is not nil, show percentage of the two // if potential is not nil, show percentage of the two
if (GetMaxPeriodicRemovalFromMine(ubMineIndex) > 0) if (GetMaxPeriodicRemovalFromMine(ubMineIndex) > 0)
{ {
#ifdef CHINESE if ( g_lang == i18n::Lang::zh ) {
swprintf( wSubString, L" (%d%£¥%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); swprintf( wSubString, L" (%d%£¥%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) );
#else } else {
swprintf( wSubString, L" (%d%%%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); swprintf( wSubString, L" (%d%%%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) );
#endif }
wcscat( wString, wSubString ); wcscat( wString, wSubString );
} }
+1 -1
View File
@@ -864,7 +864,7 @@ void EndMeanwhile( )
{ {
// We leave this sector open for our POWs to escape! // We leave this sector open for our POWs to escape!
// Set music mode to enemy present! // Set music mode to enemy present!
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
+1 -1
View File
@@ -1071,7 +1071,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
//Disable the options button when the auto resolve screen comes up //Disable the options button when the auto resolve screen comes up
EnableDisAbleMapScreenOptionsButton( FALSE ); EnableDisAbleMapScreenOptionsButton( FALSE );
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
#ifdef NEWMUSIC #ifdef NEWMUSIC
GlobalSoundID = MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ]; GlobalSoundID = MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ];
+6 -6
View File
@@ -4417,16 +4417,16 @@ void SetupInfo()
// (Item[i].usItemClass & IC_AMMO) && (Magazine[ Item[i].ubClassIndex ].ubMagType == AMMO_BOX or AMMO_CRATE?) // (Item[i].usItemClass & IC_AMMO) && (Magazine[ Item[i].ubClassIndex ].ubMagType == AMMO_BOX or AMMO_CRATE?)
for (UINT16 i = 0; i < MAXITEMS; ++i) for (UINT16 i = 0; i < MAXITEMS; ++i)
{ {
if (Item[i].gascan) ItemIdCache::gasCans.push_back(i); if (ItemIsGascan(i)) ItemIdCache::gasCans.push_back(i);
else if (Item[i].firstaidkit) ItemIdCache::firstAidKits.push_back(i); else if (ItemIsFirstAidKit(i)) ItemIdCache::firstAidKits.push_back(i);
else if (Item[i].medicalkit) ItemIdCache::medKits.push_back(i); else if (ItemIsMedicalKit(i)) ItemIdCache::medKits.push_back(i);
else if (Item[i].toolkit) ItemIdCache::toolKits.push_back(i); else if (ItemIsToolkit(i)) ItemIdCache::toolKits.push_back(i);
else if (Item[i].usItemClass & IC_AMMO) else if (Item[i].usItemClass & IC_AMMO)
{ {
if (Magazine[Item[i].ubClassIndex].ubMagType == AMMO_BOX) if (Magazine[Item[i].ubClassIndex].ubMagType == AMMO_BOX)
{ {
if ((gGameOptions.fGunNut || !Item[i].biggunlist) if ((gGameOptions.fGunNut || !ItemIsOnlyInTonsOfGuns(i))
&& (gGameOptions.ubGameStyle == STYLE_SCIFI || !Item[i].scifi)) && (gGameOptions.ubGameStyle == STYLE_SCIFI || !ItemIsOnlyInScifi(i)))
{ {
// coolness runs from 1-10, so apply offset // coolness runs from 1-10, so apply offset
const UINT8 coolness = min(max(1, Item[i].ubCoolness), 10); const UINT8 coolness = min(max(1, Item[i].ubCoolness), 10);
+1 -1
View File
@@ -1334,7 +1334,7 @@ void CheckForMissingHospitalSupplies( void )
} }
} }
#endif//obsoleteCode #endif//obsoleteCode
if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) if (ItemIsFirstAidKit(pObj->usItem) || ItemIsMedicalKit(pObj->usItem) || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER )
{ {
for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) { for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) {
if ( iter->data.objectStatus > 60 ) if ( iter->data.objectStatus > 60 )
+2 -2
View File
@@ -1085,7 +1085,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating
} }
//Set music //Set music
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
#ifdef NEWMUSIC #ifdef NEWMUSIC
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
@@ -5137,7 +5137,7 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle )
OBJECTTYPE *pItem; OBJECTTYPE *pItem;
INT16 sFuelNeeded, sFuelAvailable, sFuelAdded; INT16 sFuelNeeded, sFuelAvailable, sFuelAdded;
pItem = &pSoldier->inv[ HANDPOS ]; pItem = &pSoldier->inv[ HANDPOS ];
if( !Item[pItem->usItem].gascan ) if( !ItemIsGascan(pItem->usItem))
{ {
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
CHAR16 str[ 100 ]; CHAR16 str[ 100 ];
+4 -3
View File
@@ -40,6 +40,7 @@
#include "Luaglobal.h" #include "Luaglobal.h"
#include "LuaInitNPCs.h" #include "LuaInitNPCs.h"
#include "Interface.h" #include "Interface.h"
#include <language.hpp>
#include "GameInitOptionsScreen.h" #include "GameInitOptionsScreen.h"
extern WorldItems gAllWorldItems; extern WorldItems gAllWorldItems;
@@ -1631,12 +1632,12 @@ void AdjustLoyaltyForCivsEatenByMonsters( INT16 sSectorX, INT16 sSectorY, UINT8
swprintf( str, gpStrategicString[STR_PB_BANDIT_KILLCIVS_IN_SECTOR], ubHowMany, pSectorString ); swprintf( str, gpStrategicString[STR_PB_BANDIT_KILLCIVS_IN_SECTOR], ubHowMany, pSectorString );
else else
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
//diffrent order of words in Chinese //diffrent order of words in Chinese
swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], pSectorString, ubHowMany ); swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], pSectorString, ubHowMany );
#else } else {
swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], ubHowMany, pSectorString ); swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], ubHowMany, pSectorString );
#endif }
} }
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback );
+12 -12
View File
@@ -500,18 +500,18 @@ void UpdateTransportGroupInventory()
if (!ItemIsLegal(i, TRUE)) continue; if (!ItemIsLegal(i, TRUE)) continue;
if ((Item[i].usItemClass & IC_AMMO) == 0 && (Item[i].iTransportGroupMaxProgress == 0 || Item[i].iTransportGroupMinProgress > progress || progress > Item[i].iTransportGroupMaxProgress)) continue; if ((Item[i].usItemClass & IC_AMMO) == 0 && (Item[i].iTransportGroupMaxProgress == 0 || Item[i].iTransportGroupMinProgress > progress || progress > Item[i].iTransportGroupMaxProgress)) continue;
if (Item[i].medical) if (ItemIsMedical(i))
{ {
if (Item[i].firstaidkit) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i); if (ItemIsFirstAidKit(i)) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i);
else if (Item[i].medicalkit) itemMap[MEDICAL_MEDKITS].push_back(i); else if (ItemIsMedicalKit(i)) itemMap[MEDICAL_MEDKITS].push_back(i);
else itemMap[MEDICAL_OTHER].push_back(i); else itemMap[MEDICAL_OTHER].push_back(i);
} }
else if (Item[i].gascan) itemMap[GAS_CANS].push_back(i); else if (ItemIsGascan(i)) itemMap[GAS_CANS].push_back(i);
else if (Item[i].toolkit) itemMap[TOOL_KITS].push_back(i); else if (ItemIsToolkit(i)) itemMap[TOOL_KITS].push_back(i);
else if (HasItemFlag(i, RADIO_SET)) itemMap[RADIOS].push_back(i); else if (HasItemFlag(i, RADIO_SET)) itemMap[RADIOS].push_back(i);
else if (Item[i].usItemClass & IC_GRENADE) else if (Item[i].usItemClass & IC_GRENADE)
{ {
if (Item[i].glgrenade == 0 if (!ItemIsGLgrenade(i)
&& Item[i].attachmentclass != AC_GRENADE // not for a grenade launcher && Item[i].attachmentclass != AC_GRENADE // not for a grenade launcher
&& Item[i].attachmentclass != AC_ROCKET) // not for a rocket launcher && Item[i].attachmentclass != AC_ROCKET) // not for a rocket launcher
itemMap[GRENADE_THROWN].push_back(i); itemMap[GRENADE_THROWN].push_back(i);
@@ -523,7 +523,7 @@ void UpdateTransportGroupInventory()
itemMap[BACKPACKS].push_back(i); itemMap[BACKPACKS].push_back(i);
} }
} }
else if (Item[i].camouflagekit) itemMap[CAMO_KITS].push_back(i); else if (ItemIsCamoKit(i)) itemMap[CAMO_KITS].push_back(i);
else if (Item[i].usItemClass & IC_MISC) else if (Item[i].usItemClass & IC_MISC)
{ {
switch (Item[i].attachmentclass) switch (Item[i].attachmentclass)
@@ -555,11 +555,11 @@ void UpdateTransportGroupInventory()
{ {
itemMap[GUNS].push_back(i); itemMap[GUNS].push_back(i);
} }
else if (Item[i].grenadelauncher) else if (ItemIsGrenadeLauncher(i))
{ {
itemMap[GRENADELAUNCHERS].push_back(i); itemMap[GRENADELAUNCHERS].push_back(i);
} }
else if (Item[i].rocketlauncher) else if (ItemIsRocketLauncher(i))
{ {
itemMap[ROCKETLAUNCHERS].push_back(i); itemMap[ROCKETLAUNCHERS].push_back(i);
} }
@@ -713,7 +713,7 @@ void UpdateTransportGroupInventory()
case ROCKETLAUNCHERS: case ROCKETLAUNCHERS:
{ {
addItemToInventory(pSoldier, id, Item[id].singleshotrocketlauncher ? 3 : 1); addItemToInventory(pSoldier, id, ItemIsSingleShotRocketLauncher(id) ? 3 : 1);
const UINT16 launchableId = PickARandomLaunchable(id); const UINT16 launchableId = PickARandomLaunchable(id);
if (launchableId == 0) continue; // no launchable matches, skip if (launchableId == 0) continue; // no launchable matches, skip
@@ -773,7 +773,7 @@ void UpdateTransportGroupInventory()
for (int i = 0; i < pSoldier->inv.size(); ++i) for (int i = 0; i < pSoldier->inv.size(); ++i)
{ {
OBJECTTYPE* item = &pSoldier->inv[i]; OBJECTTYPE* item = &pSoldier->inv[i];
if (item->exists() && Item[item->usItem].defaultundroppable == FALSE) if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE)
{ {
item->fFlags &= ~OBJECT_UNDROPPABLE; item->fFlags &= ~OBJECT_UNDROPPABLE;
} }
@@ -861,7 +861,7 @@ void UpdateTransportGroupInventory()
for (int i = 0; i < pSoldier->inv.size(); ++i) for (int i = 0; i < pSoldier->inv.size(); ++i)
{ {
OBJECTTYPE* item = &pSoldier->inv[i]; OBJECTTYPE* item = &pSoldier->inv[i];
if (item->exists() && Item[item->usItem].defaultundroppable == FALSE) if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE)
{ {
item->fFlags &= ~OBJECT_UNDROPPABLE; item->fFlags &= ~OBJECT_UNDROPPABLE;
} }
+1
View File
@@ -64,6 +64,7 @@ BOOLEAN LuaUnderground::InitializeSectorList()
.TableOpen() .TableOpen()
.TParam("difficultyLevel", int(gGameOptions.ubDifficultyLevel)) .TParam("difficultyLevel", int(gGameOptions.ubDifficultyLevel))
.TParam("gameStyle", int(gGameOptions.ubGameStyle)) .TParam("gameStyle", int(gGameOptions.ubGameStyle))
.TParam("maxTacticalEnemies", int(gGameExternalOptions.ubGameMaximumNumberOfEnemies))
.TableClose(); .TableClose();
SGP_THROW_IFFALSE(initsectorlist_func.Call(1), "call to lua function BuildUndergroundSectorList failed"); SGP_THROW_IFFALSE(initsectorlist_func.Call(1), "call to lua function BuildUndergroundSectorList failed");
+16 -28
View File
@@ -11,10 +11,8 @@
#include "font.h" #include "font.h"
#include "screenids.h" #include "screenids.h"
#include "screens.h" #include "screens.h"
#include "gameloop.h"
#include "overhead.h" #include "overhead.h"
#include "sysutil.h" #include "sysutil.h"
#include "input.h"
#include "Event Pump.h" #include "Event Pump.h"
#include "Font Control.h" #include "Font Control.h"
#include "Timer Control.h" #include "Timer Control.h"
@@ -44,18 +42,15 @@
#include "PopUpBox.h" #include "PopUpBox.h"
#include "Game Clock.h" #include "Game Clock.h"
#include "items.h" #include "items.h"
#include "vobject.h"
#include "Cursor Control.h" #include "Cursor Control.h"
#include "text.h" #include "text.h"
#include "strategic.h" #include "strategic.h"
#include "strategicmap.h" #include "strategicmap.h"
#include "interface.h"
#include "strategic pathing.h" #include "strategic pathing.h"
#include "Map Screen Interface Bottom.h" #include "Map Screen Interface Bottom.h"
#include "Map Screen Interface Border.h" #include "Map Screen Interface Border.h"
#include "Map Screen Interface Map.h" #include "Map Screen Interface Map.h"
#include "Map Screen Interface.h" #include "Map Screen Interface.h"
#include "Strategic Pathing.h"
#include "Assignments.h" #include "Assignments.h"
#include "points.h" #include "points.h"
#include "Squads.h" #include "Squads.h"
@@ -114,7 +109,7 @@
#include "connect.h" //hayden #include "connect.h" //hayden
#include "InterfaceItemImages.h" #include "InterfaceItemImages.h"
#include "vobject.h" #include <language.hpp>
#ifdef JA2UB #ifdef JA2UB
#include "laptop.h" #include "laptop.h"
@@ -4792,9 +4787,6 @@ UINT32 MapScreenHandle(void)
InitPreviousPaths(); InitPreviousPaths();
// HEADROCK HAM 3.6: Init coordinates for new variable-sized message window
InitMapScreenInterfaceBottomCoords();
// if arrival sector is invalid, reset to A9 // if arrival sector is invalid, reset to A9
if ( ( gsMercArriveSectorX < 1 ) || ( gsMercArriveSectorY < 1 ) || if ( ( gsMercArriveSectorX < 1 ) || ( gsMercArriveSectorY < 1 ) ||
( gsMercArriveSectorX > 16 ) || ( gsMercArriveSectorY > 16 ) ) ( gsMercArriveSectorX > 16 ) || ( gsMercArriveSectorY > 16 ) )
@@ -9056,12 +9048,8 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f
// clip to view region // clip to view region
ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES );
if(gbPixelDepth==16)
{
// DB Need to add a radar color for 8-bit
RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf );
InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 );
}
RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES );
UnLockVideoSurface( FRAME_BUFFER ); UnLockVideoSurface( FRAME_BUFFER );
@@ -9664,27 +9652,27 @@ void BltCharInvPanel()
// print armor/weight/camo labels // print armor/weight/camo labels
mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] ); mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 ); mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 );
#else } else {
mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" ); mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" );
#endif }
mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] ); mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 ); mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 );
#else } else {
mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" ); mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" );
#endif }
mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] ); mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 ); mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 );
#else } else {
mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" ); mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" );
#endif }
const auto width = UI_CHARINV.Text.PercentWidth; const auto width = UI_CHARINV.Text.PercentWidth;
const auto height = UI_CHARINV.Text.PercentHeight; const auto height = UI_CHARINV.Text.PercentHeight;
@@ -9797,12 +9785,12 @@ void BltCharInvPanel()
UINT32 fontColour = FONT_MCOLOR_RED; UINT32 fontColour = FONT_MCOLOR_RED;
// robot targeting bonus // robot targeting bonus
if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) if (ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem))
{ {
swprintf(text, szRobotText[ROBOT_TEXT_LASER]); swprintf(text, szRobotText[ROBOT_TEXT_LASER]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
} }
else if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) else if (ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem))
{ {
swprintf(text, szRobotText[ROBOT_TEXT_NIGHT_VISION]); swprintf(text, szRobotText[ROBOT_TEXT_NIGHT_VISION]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
@@ -9825,7 +9813,7 @@ void BltCharInvPanel()
swprintf(text, szRobotText[ROBOT_TEXT_STAT_BONUSES]); swprintf(text, szRobotText[ROBOT_TEXT_STAT_BONUSES]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
} }
else if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) else if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem))
{ {
swprintf(text, szRobotText[ROBOT_TEXT_CAMO]); swprintf(text, szRobotText[ROBOT_TEXT_CAMO]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
@@ -9858,12 +9846,12 @@ void BltCharInvPanel()
swprintf(text, L"%s", szRobotText[ROBOT_TEXT_RADIO]); swprintf(text, L"%s", szRobotText[ROBOT_TEXT_RADIO]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
} }
else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].metaldetector == 1) else if (ItemIsMetalDetector(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem))
{ {
swprintf(text, L"%s", szRobotText[ROBOT_TEXT_METAL_DETECTOR]); swprintf(text, L"%s", szRobotText[ROBOT_TEXT_METAL_DETECTOR]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
} }
else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1) else if (ItemHasXRay(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem))
{ {
swprintf(text, L"%s", szRobotText[ROBOT_TEXT_XRAY]); swprintf(text, L"%s", szRobotText[ROBOT_TEXT_XRAY]);
fontColour = FONT_MCOLOR_LTGREEN; fontColour = FONT_MCOLOR_LTGREEN;
@@ -10442,7 +10430,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason )
{ {
if ( !InItemDescriptionBox( ) ) if ( !InItemDescriptionBox( ) )
{ {
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[pSoldier->inv[ uiHandPos ].usItem].singleshotrocketlauncher) ) if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(pSoldier->inv[ uiHandPos ].usItem) )
{ {
EmptyWeaponMagazine( &(pSoldier->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); EmptyWeaponMagazine( &(pSoldier->inv[ uiHandPos ]), &gItemPointer, uiHandPos );
InternalMAPBeginItemPointer( pSoldier ); InternalMAPBeginItemPointer( pSoldier );
+1 -3
View File
@@ -6665,8 +6665,7 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( )
if ( guiCurrentScreen == AUTORESOLVE_SCREEN ) if ( guiCurrentScreen == AUTORESOLVE_SCREEN )
{ {
if ( gWorldSectorX == sBattleSectorX && gWorldSectorY == sBattleSectorY && gbWorldSectorZ == sBattleSectorZ ) //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside
{ //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside
//TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because //TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because
//we are in the autoresolve screen, soldiers are internally created different (from pointers instead of //we are in the autoresolve screen, soldiers are internally created different (from pointers instead of
//the MercPtrs[]). It keys on the fact that we are in the autoresolve screen. So, by switching the //the MercPtrs[]). It keys on the fact that we are in the autoresolve screen. So, by switching the
@@ -6677,7 +6676,6 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( )
TrashWorld( ); TrashWorld( );
guiCurrentScreen = AUTORESOLVE_SCREEN; guiCurrentScreen = AUTORESOLVE_SCREEN;
} }
}
else else
{ {
TrashWorld( ); TrashWorld( );
+5
View File
@@ -0,0 +1,5 @@
# stuff that needs doing
# priority (LOW,HIGH) and description
LOW readd the C4838 (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4838) warning to CMakeLists.txt once they're all fixed in the code
HIGH get rid of ENGLISH, GERMAN, etc preprocessor definitions completely. that way i18n can be built just once and language can be changed in the options screen pending game restart (hotloading will likely require more work)
+5 -5
View File
@@ -4297,10 +4297,10 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta
// ADJUST BASED ON ITEM IN HAND.... // ADJUST BASED ON ITEM IN HAND....
usItem = pSoldier->inv[ HANDPOS ].usItem; usItem = pSoldier->inv[ HANDPOS ].usItem;
if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher) if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !ItemIsRocketLauncher(usItem) )
{ {
// if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) )
if ( (Item[ usItem ].twohanded ) ) if (ItemIsTwoHanded(usItem))
{ {
ubWaterHandIndex = 0; ubWaterHandIndex = 0;
} }
@@ -4321,7 +4321,7 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta
// ADJUST BASED ON ITEM IN HAND.... // ADJUST BASED ON ITEM IN HAND....
usItem = pSoldier->inv[ HANDPOS ].usItem; usItem = pSoldier->inv[ HANDPOS ].usItem;
if ( !(Item[ usItem ].usItemClass == IC_GUN ) && !(Item[ usItem ].usItemClass == IC_LAUNCHER ) || Item[usItem].rocketlauncher ) if ( !(Item[ usItem ].usItemClass == IC_GUN ) && !(Item[ usItem ].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) )
{ {
if ( usAnimState == STANDING ) if ( usAnimState == STANDING )
{ {
@@ -4342,10 +4342,10 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta
else else
{ {
// CHECK FOR HANDGUN // CHECK FOR HANDGUN
if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher ) if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !ItemIsRocketLauncher(usItem) )
{ {
// if ( !(Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) // if ( !(Item[ usItem ].fFlags & ITEM_TWO_HANDED) )
if ( !(Item[ usItem ].twohanded ) ) if ( !ItemIsTwoHanded(usItem) )
{ {
// SANDRO - new anim for running with pistol by PasHancock // SANDRO - new anim for running with pistol by PasHancock
if ( usAnimState == RUNNING ) if ( usAnimState == RUNNING )
+19 -50
View File
@@ -71,7 +71,6 @@ void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UIN
void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems );
void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems ); void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems );
BOOLEAN ItemContainsLiquid( UINT16 usItemIndex );
UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ); UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex );
BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer );
@@ -85,8 +84,6 @@ BOOLEAN CanThisItemBeSoldToSimulatedCustomer( UINT8 ubArmsDealerID, UINT16 usIte
void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ); void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer );
BOOLEAN ItemIsARocketRifle( INT16 sItemIndex );
BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ); BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime );
ARMS_DEALER_STATUS& ARMS_DEALER_STATUS::operator=(const OLD_ARMS_DEALER_STATUS_101& status) ARMS_DEALER_STATUS& ARMS_DEALER_STATUS::operator=(const OLD_ARMS_DEALER_STATUS_101& status)
@@ -961,7 +958,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem )
return( ARMS_DEALER_HANDGUNCLASS ); return( ARMS_DEALER_HANDGUNCLASS );
break; break;
case RIFLECLASS: case RIFLECLASS:
if ( ItemIsARocketRifle( usItem ) ) if (ItemHasFingerPrintID( usItem ) )
return( ARMS_DEALER_ROCKET_RIFLE ); return( ARMS_DEALER_ROCKET_RIFLE );
else else
return( ARMS_DEALER_RIFLECLASS ); return( ARMS_DEALER_RIFLECLASS );
@@ -1010,15 +1007,15 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem )
{ {
if ( Item [usItem].alcohol > 0.0f ) if ( Item [usItem].alcohol > 0.0f )
return( ARMS_DEALER_ALCOHOL ); return( ARMS_DEALER_ALCOHOL );
else if ( Item [usItem].electronic ) else if (ItemIsElectronic(usItem))
return( ARMS_DEALER_ELECTRONICS ); return( ARMS_DEALER_ELECTRONICS );
else if ( Item [usItem].hardware ) else if (ItemIsHardware(usItem))
return( ARMS_DEALER_HARDWARE ); return( ARMS_DEALER_HARDWARE );
else if ( Item [usItem].medical ) else if (ItemIsMedical(usItem))
return( ARMS_DEALER_MEDICAL ); return( ARMS_DEALER_MEDICAL );
else if ( Item [usItem].attachment ) else if (ItemIsAttachment(usItem))
return( ARMS_DEALER_ATTACHMENTS ); return( ARMS_DEALER_ATTACHMENTS );
else if ( Item [usItem].detonator || Item [usItem].remotedetonator || Item [usItem].remotetrigger ) else if ( IsAttachmentClass( usItem, (AC_DETONATOR | AC_REMOTEDET) ) || ItemIsRemoteTrigger(usItem))
return( ARMS_DEALER_DETONATORS ); return( ARMS_DEALER_DETONATORS );
else else
return( ARMS_DEALER_MISC ); return( ARMS_DEALER_MISC );
@@ -1076,7 +1073,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem )
return( ARMS_DEALER_AMMO ); return( ARMS_DEALER_AMMO );
break; break;
case IC_FACE: case IC_FACE:
if (Item[usItem].electronic ) if (ItemIsElectronic(usItem))
return ARMS_DEALER_ELECTRONICS; return ARMS_DEALER_ELECTRONICS;
else else
return ARMS_DEALER_FACE; return ARMS_DEALER_FACE;
@@ -1278,8 +1275,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex )
// uiFlags = Item[ usItemIndex ].fFlags; // uiFlags = Item[ usItemIndex ].fFlags;
// can't repair anything that's not repairable! // can't repair anything that's not repairable!
// if ( !( uiFlags & ITEM_REPAIRABLE ) ) if ( !ItemIsRepairable(usItemIndex) )
if ( !( Item[ usItemIndex ].repairable ) )
{ {
return(FALSE); return(FALSE);
} }
@@ -1297,8 +1293,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex )
case ARMS_DEALER_PERKO: case ARMS_DEALER_PERKO:
#endif #endif
// repairs ANYTHING non-electronic // repairs ANYTHING non-electronic
// if ( !( uiFlags & ITEM_ELECTRONIC ) ) if ( !ItemIsElectronic(usItemIndex) )
if ( !( Item[ usItemIndex ].electronic ) )
{ {
return(TRUE); return(TRUE);
} }
@@ -1306,8 +1301,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex )
case ARMS_DEALER_FREDO: case ARMS_DEALER_FREDO:
// repairs ONLY electronics // repairs ONLY electronics
// if ( uiFlags & ITEM_ELECTRONIC ) if (ItemIsElectronic(usItemIndex))
if ( Item[ usItemIndex ].electronic )
{ {
return(TRUE); return(TRUE);
} }
@@ -1318,7 +1312,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex )
// Flugente: if we set this guy to be a repairguy, and this item is NOT electronic, well, we can // Flugente: if we set this guy to be a repairguy, and this item is NOT electronic, well, we can
if ( armsDealerInfo[ubArmsDealer].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) if ( armsDealerInfo[ubArmsDealer].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS )
{ {
if ( !( Item[ usItemIndex ].electronic ) ) if ( !ItemIsElectronic(usItemIndex) )
return(TRUE); return(TRUE);
else else
return(FALSE); return(FALSE);
@@ -1369,7 +1363,7 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex )
// if it's a damagable item, and not a liquid (those are always sold full) // if it's a damagable item, and not a liquid (those are always sold full)
// if ( ( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) && !ItemContainsLiquid( usItemIndex ) ) // if ( ( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) && !ItemContainsLiquid( usItemIndex ) )
if ( ( Item[ usItemIndex ].damageable ) && !ItemContainsLiquid( usItemIndex ) ) if (ItemIsDamageable(usItemIndex) && !ItemContainsLiquid(usItemIndex))
{ {
// if he ONLY has used items, or 50% of the time if he carries both used & new items // if he ONLY has used items, or 50% of the time if he carries both used & new items
if ( ( armsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_ONLY_USED_ITEMS ) || if ( ( armsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_ONLY_USED_ITEMS ) ||
@@ -1383,25 +1377,6 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex )
return( ubCondition); return( ubCondition);
} }
BOOLEAN ItemContainsLiquid( UINT16 usItemIndex )
{
return Item[usItemIndex].containsliquid;
//switch ( usItemIndex )
//{
// case CANTEEN:
// case BEER:
// case ALCOHOL:
// case JAR_HUMAN_BLOOD:
// case JAR_CREATURE_BLOOD:
// case JAR_QUEEN_CREATURE_BLOOD:
// case JAR_ELIXIR:
// case GAS_CAN:
// return( TRUE );
//}
//return( FALSE );
}
bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item) bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item)
{ {
@@ -1839,7 +1814,7 @@ void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE
// they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this // they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this
// ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets. // ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets.
//CHRISL: If we're working with a SingleShotRocketLauncher, we need ubGunShotsLeft to equal 1 //CHRISL: If we're working with a SingleShotRocketLauncher, we need ubGunShotsLeft to equal 1
if(Item[pObject->usItem].singleshotrocketlauncher == TRUE) if(ItemIsSingleShotRocketLauncher(pObject->usItem))
(*pObject)[subObject]->data.gun.ubGunShotsLeft = 1; (*pObject)[subObject]->data.gun.ubGunShotsLeft = 1;
else else
(*pObject)[subObject]->data.gun.ubGunShotsLeft = 0; (*pObject)[subObject]->data.gun.ubGunShotsLeft = 0;
@@ -1863,7 +1838,7 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U
Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) ); Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) );
// c) Actually damaged, or a rocket rifle (being reset) // c) Actually damaged, or a rocket rifle (being reset)
Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemHasFingerPrintID( pObject->usItem ) );
/* ARM: Can now repair with removeable attachments still attached... /* ARM: Can now repair with removeable attachments still attached...
// d) Already stripped of all *detachable* attachments // d) Already stripped of all *detachable* attachments
@@ -1898,7 +1873,7 @@ void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, OBJECTTYPE* pObject, UIN
Assert( DoesDealerDoRepairs( ubArmsDealer ) ); Assert( DoesDealerDoRepairs( ubArmsDealer ) );
Assert( (*pObject)[0]->data.objectStatus > 0 ); Assert( (*pObject)[0]->data.objectStatus > 0 );
Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemHasFingerPrintID( pObject->usItem ) );
// figure out the earliest the repairman will be free to start repairing this item // figure out the earliest the repairman will be free to start repairing this item
uiTimeWhenFreeToStartIt = WhenWillRepairmanBeAllDoneRepairing( ubArmsDealer ); uiTimeWhenFreeToStartIt = WhenWillRepairmanBeAllDoneRepairing( ubArmsDealer );
@@ -1995,8 +1970,7 @@ UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, IN
// repairs on electronic items take twice as long if the guy doesn't have the skill // repairs on electronic items take twice as long if the guy doesn't have the skill
// for dealers, this means anyone but Fredo the Electronics guy takes twice as long (but doesn't charge double) // for dealers, this means anyone but Fredo the Electronics guy takes twice as long (but doesn't charge double)
// (Mind you, current he's the ONLY one who CAN repair Electronics at all! Oh well.) // (Mind you, current he's the ONLY one who CAN repair Electronics at all! Oh well.)
// if( ( Item[ usItemIndex ].fFlags & ITEM_ELECTRONIC ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) if( ItemIsElectronic(usItemIndex) && ( ubArmsDealer != ARMS_DEALER_FREDO ) )
if( ( Item[ usItemIndex ].electronic ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) )
{ {
uiTimeToRepair *= 2; uiTimeToRepair *= 2;
} }
@@ -2065,7 +2039,7 @@ UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, IN
} }
*/ */
if ( ItemIsARocketRifle( usItemIndex ) ) if (ItemHasFingerPrintID( usItemIndex ) )
{ {
// resetting imprinting for a rocket rifle costs something extra even if rifle is at 100% // resetting imprinting for a rocket rifle costs something extra even if rifle is at 100%
uiRepairCost += 100; uiRepairCost += 100;
@@ -2167,7 +2141,7 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN
// the rest of this function applies only to the "general" dealers ( Jake, Keith, and Franz ) // the rest of this function applies only to the "general" dealers ( Jake, Keith, and Franz )
// Micky & Gabby specialize in creature parts & such, the others don't buy these at all (exception: jars) // Micky & Gabby specialize in creature parts & such, the others don't buy these at all (exception: jars)
if ( ( !Item[usItemIndex].jar ) && if ( ( !ItemIsJar(usItemIndex)) &&
( DoesItemAppearInDealerInventoryList( ARMS_DEALER_MICKY, usItemIndex, TRUE ) || ( DoesItemAppearInDealerInventoryList( ARMS_DEALER_MICKY, usItemIndex, TRUE ) ||
DoesItemAppearInDealerInventoryList( ARMS_DEALER_GABBY, usItemIndex, TRUE ) ) ) DoesItemAppearInDealerInventoryList( ARMS_DEALER_GABBY, usItemIndex, TRUE ) ) )
{ {
@@ -2214,7 +2188,7 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN
{ {
// exception: Gas (Jake's) // exception: Gas (Jake's)
// if ( usItemIndex != GAS_CAN ) // if ( usItemIndex != GAS_CAN )
if ( !Item[usItemIndex].gascan ) if ( !ItemIsGascan(usItemIndex))
{ {
// they pay only 1/3 of true value! // they pay only 1/3 of true value!
usValueToThisDealer /= 3; usValueToThisDealer /= 3;
@@ -2244,11 +2218,6 @@ void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer )
GuaranteeAtLeastXItemsOfIndex( ubArmsDealer, ALCOHOL, ( UINT8 ) ( GetDealersMaxItemAmount( ubArmsDealer, ALCOHOL ) / 3 ) ); GuaranteeAtLeastXItemsOfIndex( ubArmsDealer, ALCOHOL, ( UINT8 ) ( GetDealersMaxItemAmount( ubArmsDealer, ALCOHOL ) / 3 ) );
} }
BOOLEAN ItemIsARocketRifle( INT16 sItemIndex )
{
return( Item[sItemIndex].fingerprintid );
}
BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ) BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime )
{ {
SOLDIERTYPE *pSoldier; SOLDIERTYPE *pSoldier;
+3 -5
View File
@@ -944,8 +944,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA
} }
// items normally not sold at shops are unsuitable // items normally not sold at shops are unsuitable
// if ( Item[ usItemIndex ].fFlags & ITEM_NOT_BUYABLE ) if (ItemIsNotBuyable(usItemIndex))
if ( Item[ usItemIndex ].notbuyable )
{ {
return(ITEM_SUITABILITY_NONE); return(ITEM_SUITABILITY_NONE);
} }
@@ -971,7 +970,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA
// case JAR: // case JAR:
// case JAR_ELIXIR: // case JAR_ELIXIR:
// case JAR_CREATURE_BLOOD: // case JAR_CREATURE_BLOOD:
if ( Item[usItemIndex].medical || Item[usItemIndex].canteen || Item[usItemIndex].medicalkit || Item[usItemIndex].locksmithkit || Item[usItemIndex].toolkit || Item[usItemIndex].crowbar || Item[usItemIndex].jar ) if (ItemIsMedical(usItemIndex) || ItemIsCanteen(usItemIndex) || ItemIsMedicalKit(usItemIndex) || ItemIsLocksmithKit(usItemIndex) || ItemIsToolkit(usItemIndex) || ItemIsCrowbar(usItemIndex) || ItemIsJar(usItemIndex) )
return(ITEM_SUITABILITY_ALWAYS); return(ITEM_SUITABILITY_ALWAYS);
//} //}
@@ -1455,8 +1454,7 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex )
BOOLEAN CanDealerItemBeSoldUsed( UINT16 usItemIndex ) BOOLEAN CanDealerItemBeSoldUsed( UINT16 usItemIndex )
{ {
// if ( !( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) ) if ( !ItemIsDamageable(usItemIndex) )
if ( !( Item[ usItemIndex ].damageable ) )
return(FALSE); return(FALSE);
// certain items, although they're damagable, shouldn't be sold in a used condition // certain items, although they're damagable, shouldn't be sold in a used condition
+8 -4
View File
@@ -460,7 +460,7 @@ void AutoBandage( BOOLEAN fStart )
for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier ) for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier )
{ {
// 0verhaul: Make sure the merc is also in the sector before making him stand up! // 0verhaul: Make sure the merc is also in the sector before making him stand up!
if ( pSoldier->bActive && pSoldier->bInSector ) if (pSoldier && pSoldier->bActive && pSoldier->bInSector)
{ {
ActionDone( pSoldier ); ActionDone( pSoldier );
if ( pSoldier->bSlotItemTakenFrom != NO_SLOT ) if ( pSoldier->bSlotItemTakenFrom != NO_SLOT )
@@ -483,12 +483,16 @@ void AutoBandage( BOOLEAN fStart )
ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop) for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop)
{ {
ActionDone( MercPtrs[ ubLoop ] ); pSoldier = MercPtrs[ubLoop];
if (pSoldier && pSoldier->bActive && pSoldier->bInSector)
{
ActionDone(pSoldier);
// If anyone is still doing aid animation, stop! // If anyone is still doing aid animation, stop!
if ( MercPtrs[ ubLoop ]->usAnimState == GIVING_AID || MercPtrs[ ubLoop ]->usAnimState == GIVING_AID_PRN ) if (pSoldier->usAnimState == GIVING_AID || pSoldier->usAnimState == GIVING_AID_PRN)
{ {
MercPtrs[ ubLoop ]->SoldierGotoStationaryStance( ); pSoldier->SoldierGotoStationaryStance();
}
} }
} }
+1
View File
@@ -93,6 +93,7 @@ set(TacticalSrc
"${CMAKE_CURRENT_SOURCE_DIR}/VehicleMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/VehicleMenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Weapons.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Weapons.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/World Items.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/World Items.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoStrings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoTypes.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoTypes.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Armour.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Armour.cpp"
+4 -3
View File
@@ -67,6 +67,7 @@
#include "ub_config.h" #include "ub_config.h"
#include "history.h" #include "history.h"
#include <language.hpp>
//forward declarations of common classes to eliminate includes //forward declarations of common classes to eliminate includes
class OBJECTTYPE; class OBJECTTYPE;
@@ -2407,8 +2408,8 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
{ {
if ( fWavFile ) if ( fWavFile )
{ {
#ifdef RUSSIAN if ( g_lang == i18n::Lang::ru &&
if ( ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC ||
gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC ||
gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED )
{ {
@@ -2426,7 +2427,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN
#endif #endif
} }
else else
#endif
{ {
// build name of wav file (characternum + quotenum) // build name of wav file (characternum + quotenum)
sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum );
+3 -3
View File
@@ -1274,7 +1274,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
{ {
case MINES_DRAW_PLAYERTEAM_NETWORKS: case MINES_DRAW_PLAYERTEAM_NETWORKS:
{ {
if ( Item[pObj->usItem].tripwire == 1 ) if (ItemIsTripwire(pObj->usItem))
{ {
// if we're already marked as MINE_BOMB, switch to MINE_BOMB_AND_WIRE // if we're already marked as MINE_BOMB, switch to MINE_BOMB_AND_WIRE
if ( bOverlayType == MINE_BOMB ) if ( bOverlayType == MINE_BOMB )
@@ -1314,7 +1314,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
case MINES_DRAW_NETWORKCOLOURING: case MINES_DRAW_NETWORKCOLOURING:
{ {
if ( Item[pObj->usItem].tripwire == 1 ) if (ItemIsTripwire(pObj->usItem))
{ {
// determine if wire is of the network we're searching for // determine if wire is of the network we're searching for
// determine this tripwire's flag // determine this tripwire's flag
@@ -1342,7 +1342,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType,
case MINES_DRAW_NET_C: case MINES_DRAW_NET_C:
case MINES_DRAW_NET_D: case MINES_DRAW_NET_D:
{ {
if ( Item[pObj->usItem].tripwire == 1 ) if (ItemIsTripwire(pObj->usItem))
{ {
UINT32 specificnet = 0; UINT32 specificnet = 0;
switch ( gubDrawMode ) switch ( gubDrawMode )
+1 -1
View File
@@ -205,7 +205,7 @@ BOOLEAN ApplyDrugs_New( SOLDIERTYPE *pSoldier, UINT16 usItem, UINT16 uStatusUsed
gMercProfiles[pSoldier->ubProfile].ubNumTimesDrugUseInLifetime++; gMercProfiles[pSoldier->ubProfile].ubNumTimesDrugUseInLifetime++;
} }
if ( Item[usItem].cigarette ) if (ItemIsCigarette(usItem))
{ {
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_MERC_TOOK_CIGARETTE], pSoldier->GetName( ), ShortItemNames[usItem] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_MERC_TOOK_CIGARETTE], pSoldier->GetName( ), ShortItemNames[usItem] );
} }
+3 -3
View File
@@ -1950,7 +1950,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
// check first face slot // check first face slot
if (uiFaceItemOne != NONE) if (uiFaceItemOne != NONE)
{ {
if (Item[uiFaceItemOne].gasmask) if (ItemIsGasmask(uiFaceItemOne))
uiFaceItemOne = 1; uiFaceItemOne = 1;
else if (Item[uiFaceItemOne].nightvisionrangebonus > 0) else if (Item[uiFaceItemOne].nightvisionrangebonus > 0)
uiFaceItemOne = 2; uiFaceItemOne = 2;
@@ -1965,7 +1965,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
// check second face slot // check second face slot
if (uiFaceItemTwo != NONE) if (uiFaceItemTwo != NONE)
{ {
if (Item[uiFaceItemTwo].gasmask) if (ItemIsGasmask(uiFaceItemTwo))
uiFaceItemTwo = 21; uiFaceItemTwo = 21;
else if (Item[uiFaceItemTwo].nightvisionrangebonus > 0) else if (Item[uiFaceItemTwo].nightvisionrangebonus > 0)
uiFaceItemTwo = 42; uiFaceItemTwo = 42;
@@ -2250,7 +2250,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE
sIconIndex_Assignment = 0; sIconIndex_Assignment = 0;
fDoIcon_Assignment = TRUE; fDoIcon_Assignment = TRUE;
// Show repair points if merc has a toolkit in his hand. Otherwise show cleaning points. // Show repair points if merc has a toolkit in his hand. Otherwise show cleaning points.
if (Item[pSoldier->inv[HANDPOS].usItem].toolkit) if (ItemIsToolkit(pSoldier->inv[HANDPOS].usItem))
sPtsAvailable = CalculateRepairPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE); sPtsAvailable = CalculateRepairPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE);
else else
sPtsAvailable = CalculateCleaningPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts); sPtsAvailable = CalculateCleaningPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts);
+15 -13
View File
@@ -174,7 +174,7 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, UINT16 usPointsTo
return( FALSE); return( FALSE);
// workaround: canteens with 1% status are treated as 'empty'. They cannot be consumed, but refilled // workaround: canteens with 1% status are treated as 'empty'. They cannot be consumed, but refilled
if ( Item[pObject->usItem].canteen == TRUE && (*pObject)[0]->data.objectStatus == 1 ) if (ItemIsCanteen(pObject->usItem) && (*pObject)[0]->data.objectStatus == 1 )
return( FALSE); return( FALSE);
// do we eat or drink this stuff? // do we eat or drink this stuff?
@@ -364,7 +364,9 @@ void ReduceBPRegenForHunger( SOLDIERTYPE *pSoldier, INT32 *psPoints )
void HourlyFoodSituationUpdate( SOLDIERTYPE *pSoldier ) void HourlyFoodSituationUpdate( SOLDIERTYPE *pSoldier )
{ {
if ( !pSoldier ) // A merc away on a minievent assignment is ignored since we cannot control their food or water intake.
// Without this they would end up losing stats and/or dying during long event assignments, which would lead to the game crashing when death occurs.
if ( !pSoldier || pSoldier->bAssignment == ASSIGNMENT_MINIEVENT)
return; return;
// determine our current activity level // determine our current activity level
@@ -691,7 +693,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly )
// if fcanteensonly is TRUE, omit everything that is not a canteen // if fcanteensonly is TRUE, omit everything that is not a canteen
if ( fcanteensonly ) if ( fcanteensonly )
{ {
if ( Item[pObj->usItem].canteen == FALSE ) if ( !ItemIsCanteen(pObj->usItem))
continue; continue;
} }
else else
@@ -705,7 +707,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly )
if ( foodcondition < FOOD_BAD_THRESHOLD ) if ( foodcondition < FOOD_BAD_THRESHOLD )
continue; continue;
if ( Item[pObj->usItem].canteen == TRUE ) if (ItemIsCanteen(pObj->usItem))
continue; continue;
} }
@@ -739,7 +741,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly )
// if fcanteensonly is TRUE, omit everything that is not a canteen // if fcanteensonly is TRUE, omit everything that is not a canteen
if ( fcanteensonly ) if ( fcanteensonly )
{ {
if ( Item[pObj->usItem].canteen == FALSE ) if (!ItemIsCanteen(pObj->usItem))
continue; continue;
} }
@@ -844,7 +846,7 @@ void SectorFillCanteens( void )
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ...
{ {
// ... if Item exists and is canteen (that can have drink points) ... // ... if Item exists and is canteen (that can have drink points) ...
if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0)
{ {
OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ...
@@ -876,7 +878,7 @@ void SectorFillCanteens( void )
if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... if( gWorldItems[ uiCount ].fExists ) // ... if item exists ...
{ {
// ... if Item exists and is a canteen (only those are refillable) ... // ... if Item exists and is a canteen (only those are refillable) ...
if ( Item[gWorldItems[ uiCount ].object.usItem].canteen && Food[Item[gWorldItems[ uiCount ].object.usItem].foodtype].bDrinkPoints > 0) if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem) && Food[Item[gWorldItems[ uiCount ].object.usItem].foodtype].bDrinkPoints > 0)
{ {
OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ...
@@ -918,7 +920,7 @@ void SectorFillCanteens( void )
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ...
{ {
// ... if Item exists and is canteen and is NOT a water drum... // ... if Item exists and is canteen and is NOT a water drum...
if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && (Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) && !HasItemFlag(pSoldier->inv[bLoop].usItem, (WATER_DRUM))) if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && (Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) && !HasItemFlag(pSoldier->inv[bLoop].usItem, (WATER_DRUM)))
{ {
OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ...
@@ -971,7 +973,7 @@ void SectorFillCanteens( void )
if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... if( gWorldItems[ uiCount ].fExists ) // ... if item exists ...
{ {
// ... if Item exists and is a canteen (only those are refillable) ... // ... if Item exists and is a canteen (only those are refillable) ...
if ( Item[gWorldItems[ uiCount ].object.usItem].canteen ) if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem))
{ {
OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ...
@@ -1029,7 +1031,7 @@ OBJECTTYPE* GetUsableWaterDrumInSector( void )
if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... if( gWorldItems[ uiCount ].fExists ) // ... if item exists ...
{ {
// ... if Item exists and is a canteen (only those are refillable) ... // ... if Item exists and is a canteen (only those are refillable) ...
if ( Item[gWorldItems[ uiCount ].object.usItem].canteen ) if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem))
{ {
OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ...
@@ -1075,7 +1077,7 @@ void SoldierAutoFillCanteens(SOLDIERTYPE *pSoldier)
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ...
{ {
// ... if Item exists and is canteen (that can have drink points) ... // ... if Item exists and is canteen (that can have drink points) ...
if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0)
{ {
OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ...
@@ -1116,7 +1118,7 @@ BOOLEAN HasFoodInInventory( SOLDIERTYPE *pSoldier, BOOLEAN fCheckFood, BOOLEAN f
if ( fCheckDrink && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints ) if ( fCheckDrink && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints )
{ {
if ( Item[pSoldier->inv[bLoop].usItem].canteen ) if (ItemIsCanteen(pSoldier->inv[bLoop].usItem))
{ {
// empty canteens retain 1% status, so check ether something is in them // empty canteens retain 1% status, so check ether something is in them
if ( pSoldier->inv[bLoop][0]->data.objectStatus > 1 ) if ( pSoldier->inv[bLoop][0]->data.objectStatus > 1 )
@@ -1168,7 +1170,7 @@ void DrinkFromWaterTap( SOLDIERTYPE* pSoldier )
for (INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... for (INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ...
{ {
// ... if Item exists and is canteen (that can have drink points) ... // ... if Item exists and is canteen (that can have drink points) ...
if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0)
{ {
OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ...
+4 -3
View File
@@ -33,6 +33,7 @@
#include "GameSettings.h" #include "GameSettings.h"
#include "fresh_header.h" #include "fresh_header.h"
#include "connect.h" #include "connect.h"
#include <language.hpp>
#ifdef JA2UB #ifdef JA2UB
#include "Explosion Control.h" #include "Explosion Control.h"
@@ -1492,7 +1493,7 @@ void SetDoorString( INT32 sGridNo )
// ATE: If here, we try to say, opened or closed... // ATE: If here, we try to say, opened or closed...
if ( gfUIIntTileLocation2 == FALSE ) if ( gfUIIntTileLocation2 == FALSE )
{ {
#ifdef GERMAN if( g_lang == i18n::Lang::de ) {
wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_DOOR_MOUSE_DESCRIPTION ] ); wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_DOOR_MOUSE_DESCRIPTION ] );
gfUIIntTileLocation2 = TRUE; gfUIIntTileLocation2 = TRUE;
@@ -1535,7 +1536,7 @@ void SetDoorString( INT32 sGridNo )
gfUIIntTileLocation = TRUE; gfUIIntTileLocation = TRUE;
} }
} }
#else } else {
// Try to get doors status here... // Try to get doors status here...
pDoorStatus = GetDoorStatus( sGridNo ); pDoorStatus = GetDoorStatus( sGridNo );
@@ -1576,7 +1577,7 @@ void SetDoorString( INT32 sGridNo )
} }
} }
#endif }
} }
} }
+33 -34
View File
@@ -319,7 +319,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != NO_PROFILE &&
pTargetSoldier && pTargetSoldier &&
Item[usHandItem].usItemClass != IC_MEDKIT && Item[usHandItem].usItemClass != IC_MEDKIT &&
!Item[usHandItem].gascan && !ItemIsGascan(usHandItem) &&
!ItemCanBeAppliedToOthers(usHandItem) && !ItemCanBeAppliedToOthers(usHandItem) &&
!HasItemFlag(usHandItem, EMPTY_BLOOD_BAG) && !HasItemFlag(usHandItem, EMPTY_BLOOD_BAG) &&
!HasItemFlag( usHandItem, MEDICAL_SPLINT ) ) !HasItemFlag( usHandItem, MEDICAL_SPLINT ) )
@@ -473,8 +473,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
if ( Item[ usHandItem ].usItemClass == IC_GUN || Item[ usHandItem ].usItemClass == IC_THROWING_KNIFE ) if ( Item[ usHandItem ].usItemClass == IC_GUN || Item[ usHandItem ].usItemClass == IC_THROWING_KNIFE )
{ {
// WEAPONS // WEAPONS
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem,Item[usHandItem].fingerprintid,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem, ItemHasFingerPrintID(usHandItem), pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile));
if ( Item[usHandItem].fingerprintid ) if (ItemHasFingerPrintID(usHandItem))
{ {
// check imprint ID // check imprint ID
// NB not-imprinted value is NO_PROFILE // NB not-imprinted value is NO_PROFILE
@@ -807,7 +807,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
} }
// ATE: Here to make cursor go back to move after LAW shot... // ATE: Here to make cursor go back to move after LAW shot...
if ( fFromUI && Item[usHandItem].singleshotrocketlauncher) if ( fFromUI && ItemIsSingleShotRocketLauncher(usHandItem) )
{ {
guiPendingOverrideEvent = A_CHANGE_TO_MOVE; guiPendingOverrideEvent = A_CHANGE_TO_MOVE;
} }
@@ -969,7 +969,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
BOOLEAN fCorpse = FALSE; BOOLEAN fCorpse = FALSE;
if(pCorpse != NULL) if(pCorpse != NULL)
fCorpse = IsValidDecapitationCorpse( pCorpse ); fCorpse = IsValidDecapitationCorpse( pCorpse );
if ( Item[usHandItem].wirecutters && pTargetSoldier == NULL && !pCorpse ) // Madd: quick fix to allow wirecutter/knives if (ItemIsWirecutters(usHandItem) && pTargetSoldier == NULL && !pCorpse ) // Madd: quick fix to allow wirecutter/knives
{ {
// See if we can get there to stab // See if we can get there to stab
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
@@ -1025,7 +1025,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
} }
} }
if ( Item[usHandItem].toolkit ) if (ItemIsToolkit(usHandItem))
{ {
UINT8 ubMercID; UINT8 ubMercID;
BOOLEAN fVehicle = FALSE; BOOLEAN fVehicle = FALSE;
@@ -1098,7 +1098,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
} }
} }
if ( Item[usHandItem].gascan ) if (ItemIsGascan(usHandItem))
{ {
UINT8 ubMercID; UINT8 ubMercID;
INT32 sVehicleGridNo=-1; INT32 sVehicleGridNo=-1;
@@ -1170,7 +1170,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
} }
if ( Item[usHandItem].jar ) if (ItemIsJar(usHandItem))
{ {
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
@@ -1614,7 +1614,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
} }
} }
if ( Item[usHandItem].canandstring ) if (ItemIsCanAndString(usHandItem))
{ {
STRUCTURE *pStructure; STRUCTURE *pStructure;
LEVELNODE *pIntTile; LEVELNODE *pIntTile;
@@ -1686,7 +1686,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) ) if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) )
{ {
DeductPoints( pSoldier, sAPCost, 0 ); DeductPoints( pSoldier, sAPCost, 0 );
if ( Item[usHandItem].xray ) if (ItemHasXRay(usHandItem))
{ {
PlayJA2Sample( USE_X_RAY_MACHINE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); PlayJA2Sample( USE_X_RAY_MACHINE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) );
@@ -1867,7 +1867,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
sAPCost = MinAPsToAttack( pSoldier, sTargetGridNo, TRUE, pSoldier->aiData.bAimTime, 0 ); sAPCost = MinAPsToAttack( pSoldier, sTargetGridNo, TRUE, pSoldier->aiData.bAimTime, 0 );
// Check if these is room to place mortar! // Check if these is room to place mortar!
if ( Item[usHandItem].mortar ) if (ItemIsMortar(usHandItem))
{ {
ubDirection = (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ); ubDirection = (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier );
@@ -1881,7 +1881,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
//pSoldier->flags.fDontChargeAPsForStanceChange = TRUE;//dnl ch72 270913 no reason why not charge for stance change //pSoldier->flags.fDontChargeAPsForStanceChange = TRUE;//dnl ch72 270913 no reason why not charge for stance change
} }
else if ( Item[usHandItem].grenadelauncher )//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER ) else if (ItemIsGrenadeLauncher(usHandItem))//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER )
{ {
GetAPChargeForShootOrStabWRTGunRaises( pSoldier, sTargetGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost, pSoldier->aiData.bAimTime ); GetAPChargeForShootOrStabWRTGunRaises( pSoldier, sTargetGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost, pSoldier->aiData.bAimTime );
usTurningCost = CalculateTurningCost(pSoldier, usHandItem, fAddingTurningCost); usTurningCost = CalculateTurningCost(pSoldier, usHandItem, fAddingTurningCost);
@@ -1960,7 +1960,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
if ( Item[ usHandItem ].ubCursor == INVALIDCURS ) if ( Item[ usHandItem ].ubCursor == INVALIDCURS )
{ {
// Found detonator... // Found detonator...
if ( HasAttachmentOfClass( &(pSoldier->inv[pSoldier->ubAttackingHand]), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || Item[usHandItem].tripwire ) if ( HasAttachmentOfClass( &(pSoldier->inv[pSoldier->ubAttackingHand]), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || ItemIsTripwire(usHandItem))
{ {
StartBombMessageBox( pSoldier, sGridNo ); StartBombMessageBox( pSoldier, sGridNo );
@@ -1980,7 +1980,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo )
{ {
// Does this have detonator that needs info? // Does this have detonator that needs info?
if ( HasAttachmentOfClass( &(pSoldier->inv[ HANDPOS ] ), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || Item[ (&(pSoldier->inv[ HANDPOS ] ))->usItem ].tripwire == 1) if ( HasAttachmentOfClass( &(pSoldier->inv[ HANDPOS ] ), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || ItemIsTripwire((&(pSoldier->inv[ HANDPOS ] ))->usItem) )
{ {
StartBombMessageBox( pSoldier, sGridNo ); StartBombMessageBox( pSoldier, sGridNo );
} }
@@ -2003,7 +2003,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo )
if ( iResult >= 0 ) if ( iResult >= 0 )
{ {
// Less explosives gain for placing tripwire // Less explosives gain for placing tripwire
if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire ) if (ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem))
StatChange( pSoldier, EXPLODEAMT, 1, FALSE ); StatChange( pSoldier, EXPLODEAMT, 1, FALSE );
else if ( HasItemFlag( (pSoldier->inv[HANDPOS]).usItem, BEARTRAP ) ) else if ( HasItemFlag( (pSoldier->inv[HANDPOS]).usItem, BEARTRAP ) )
StatChange( pSoldier, MECHANAMT, 10, FALSE ); StatChange( pSoldier, MECHANAMT, 10, FALSE );
@@ -2027,7 +2027,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo )
pSoldier->inv[ HANDPOS ][0]->data.bTrap++; pSoldier->inv[ HANDPOS ][0]->data.bTrap++;
// anv: additional tile properties - modify trap level depending on its placement // anv: additional tile properties - modify trap level depending on its placement
if(gGameExternalOptions.fAdditionalTileProperties && Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) if(gGameExternalOptions.fAdditionalTileProperties && !ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem))
{ {
ADDITIONAL_TILE_PROPERTIES_VALUES zAllTileValues = GetAllAdditonalTilePropertiesForGrid( sGridNo, pSoldier->pathing.bLevel ); ADDITIONAL_TILE_PROPERTIES_VALUES zAllTileValues = GetAllAdditonalTilePropertiesForGrid( sGridNo, pSoldier->pathing.bLevel );
pSoldier->inv[ HANDPOS ][0]->data.bTrap += zAllTileValues.bTrapBonus; pSoldier->inv[ HANDPOS ][0]->data.bTrap += zAllTileValues.bTrapBonus;
@@ -2072,7 +2072,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo )
StatChange( pSoldier, EXPLODEAMT, 10, FROM_FAILURE ); StatChange( pSoldier, EXPLODEAMT, 10, FROM_FAILURE );
// oops! How badly did we screw up? // oops! How badly did we screw up?
if ( iResult < -20 && Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) if ( iResult < -20 && !ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem) )
{ {
// OOPS! ... BOOM! // OOPS! ... BOOM!
IgniteExplosion( NOBODY, pSoldier->sX, pSoldier->sY, (INT16) (gpWorldLevelData[pSoldier->sGridNo].sHeight), pSoldier->sGridNo, pSoldier->inv[ HANDPOS ].usItem, pSoldier->pathing.bLevel, pSoldier->ubDirection, &pSoldier->inv[ HANDPOS ] ); IgniteExplosion( NOBODY, pSoldier->sX, pSoldier->sY, (INT16) (gpWorldLevelData[pSoldier->sGridNo].sHeight), pSoldier->sGridNo, pSoldier->inv[ HANDPOS ].usItem, pSoldier->pathing.bLevel, pSoldier->ubDirection, &pSoldier->inv[ HANDPOS ] );
@@ -2576,7 +2576,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr
if ( ItemExistsAtLocation( sGridNo, iItemIndex, pSoldier->pathing.bLevel ) ) if ( ItemExistsAtLocation( sGridNo, iItemIndex, pSoldier->pathing.bLevel ) )
{ {
// Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the items' existence already... // Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the items' existence already...
if ( gWorldItems[ iItemIndex ].object.exists() && gWorldItems[ iItemIndex ].object.fFlags & OBJECT_ARMED_BOMB && Item[gWorldItems[ iItemIndex ].object.usItem].tripwireactivation == 1 ) if ( gWorldItems[ iItemIndex ].object.exists() && gWorldItems[ iItemIndex ].object.fFlags & OBJECT_ARMED_BOMB && ItemHasTripwireActivation(gWorldItems[ iItemIndex ].object.usItem) )
{ {
gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel );
gpBoobyTrapSoldier = pSoldier; gpBoobyTrapSoldier = pSoldier;
@@ -2998,8 +2998,7 @@ OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bV
if ( TERRAIN_IS_WATER( bTerrainID) ) if ( TERRAIN_IS_WATER( bTerrainID) )
{ {
// if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS ) if (ItemSinks(pObject->usItem))
if ( Item[ pObject->usItem ].sinks )
{ {
return( NULL ); return( NULL );
} }
@@ -3340,7 +3339,7 @@ BOOLEAN MarblesExistAtLocation( INT32 sGridNo, UINT8 ubLevel, INT32 * piItemInde
pItemPoolTemp = pItemPool; pItemPoolTemp = pItemPool;
while( pItemPoolTemp != NULL ) while( pItemPoolTemp != NULL )
{ {
if ( Item[gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem].marbles ) if (ItemIsMarbles(gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem))
{ {
if ( piItemIndex ) if ( piItemIndex )
{ {
@@ -5154,7 +5153,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo )
gpTempSoldier = pSoldier; gpTempSoldier = pSoldier;
gsTempGridNo = sGridNo; gsTempGridNo = sGridNo;
if (Item[ pSoldier->inv[HANDPOS].usItem].remotetrigger ) if (ItemIsRemoteTrigger(pSoldier->inv[HANDPOS].usItem))
{ {
wcscpy( gzUserDefinedButton[0], L"1" ); wcscpy( gzUserDefinedButton[0], L"1" );
wcscpy( gzUserDefinedButton[1], L"2" ); wcscpy( gzUserDefinedButton[1], L"2" );
@@ -5249,7 +5248,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo )
{ {
DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ CHOOSE_REMOTE_FREQUENCY_STR ], GAME_SCREEN, MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, BombMessageBoxCallBack, NULL ); DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ CHOOSE_REMOTE_FREQUENCY_STR ], GAME_SCREEN, MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, BombMessageBoxCallBack, NULL );
} }
else if ( Item[ (&(pSoldier->inv[HANDPOS]))->usItem ].tripwire == 1 ) else if (ItemIsTripwire((&(pSoldier->inv[HANDPOS]))->usItem))
{ {
wcscpy( gzUserDefinedButton[0], L"1-A" ); wcscpy( gzUserDefinedButton[0], L"1-A" );
wcscpy( gzUserDefinedButton[1], L"1-B" ); wcscpy( gzUserDefinedButton[1], L"1-B" );
@@ -5573,10 +5572,10 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
if (gpTempSoldier) if (gpTempSoldier)
{ {
// sevenfm: remember last tripwire network settings // sevenfm: remember last tripwire network settings
if(Item[ gpTempSoldier->inv[HANDPOS].usItem ].tripwire ) if(ItemIsTripwire(gpTempSoldier->inv[HANDPOS].usItem))
gubLastTripwire = ubExitValue; gubLastTripwire = ubExitValue;
if (Item[ gpTempSoldier->inv[HANDPOS].usItem ].remotetrigger ) if (ItemIsRemoteTrigger(gpTempSoldier->inv[HANDPOS].usItem))
{ {
// Flugente: jamming can prevent bomb activation // Flugente: jamming can prevent bomb activation
if ( !gSkillTraitValues.fVOJammingBlocksRemoteBombs || !SectorJammed() ) if ( !gSkillTraitValues.fVOJammingBlocksRemoteBombs || !SectorJammed() )
@@ -5602,7 +5601,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
if ( iResult >= 0 ) if ( iResult >= 0 )
{ {
// Less explosives gain for placing tripwire // Less explosives gain for placing tripwire
if ( Item[ gpTempSoldier->inv[ HANDPOS ].usItem ].tripwire == 1 ) if (ItemIsTripwire(gpTempSoldier->inv[ HANDPOS ].usItem))
StatChange( gpTempSoldier, EXPLODEAMT, 5, FALSE ); StatChange( gpTempSoldier, EXPLODEAMT, 5, FALSE );
else if ( HasItemFlag( (gpTempSoldier->inv[HANDPOS]).usItem, BEARTRAP ) ) else if ( HasItemFlag( (gpTempSoldier->inv[HANDPOS]).usItem, BEARTRAP ) )
StatChange( gpTempSoldier, MECHANAMT, 10, FALSE ); StatChange( gpTempSoldier, MECHANAMT, 10, FALSE );
@@ -5643,7 +5642,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
else else
{ {
// we can't blow up tripwire, no matter how bad we fail // we can't blow up tripwire, no matter how bad we fail
if ( Item[ gpTempSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) if ( !ItemIsTripwire(gpTempSoldier->inv[ HANDPOS ].usItem))
{ {
// OOPS! ... BOOM! // OOPS! ... BOOM!
IgniteExplosion( NOBODY, gpTempSoldier->sX, gpTempSoldier->sY, (INT16) (gpWorldLevelData[gpTempSoldier->sGridNo].sHeight), gpTempSoldier->sGridNo, gpTempSoldier->inv[ HANDPOS ].usItem, gpTempSoldier->pathing.bLevel, gpTempSoldier->ubDirection, &gpTempSoldier->inv[ HANDPOS ] ); IgniteExplosion( NOBODY, gpTempSoldier->sX, gpTempSoldier->sY, (INT16) (gpWorldLevelData[gpTempSoldier->sGridNo].sHeight), gpTempSoldier->sGridNo, gpTempSoldier->inv[ HANDPOS ].usItem, gpTempSoldier->pathing.bLevel, gpTempSoldier->ubDirection, &gpTempSoldier->inv[ HANDPOS ] );
@@ -5699,7 +5698,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue )
gTempObject[0]->data.ubDirection = gpTempSoldier->ubDirection; // Flugente: direction of bomb is direction of soldier gTempObject[0]->data.ubDirection = gpTempSoldier->ubDirection; // Flugente: direction of bomb is direction of soldier
// Flugente: tripwire was called through a messagebox, but has to be buried nevertheless // Flugente: tripwire was called through a messagebox, but has to be buried nevertheless
if ( Item[ (&gTempObject)->usItem ].tripwire == 1 ) if (ItemIsTripwire((&gTempObject)->usItem))
{ {
AddItemToPool( gsTempGridNo, &gTempObject, BURIED, gpTempSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); AddItemToPool( gsTempGridNo, &gTempObject, BURIED, gpTempSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 );
// sevenfm: set flag only if planting tripwire // sevenfm: set flag only if planting tripwire
@@ -5839,7 +5838,7 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot )
// shape to be usable, and doesn't break during use. // shape to be usable, and doesn't break during use.
// Exception: land mines. You can bury them broken, they just won't blow! // Exception: land mines. You can bury them broken, they just won't blow!
// if ( (Item[ pObj->usItem ].fFlags & ITEM_DAMAGEABLE) && (pObj->usItem != MINE) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && pObj->usItem != GAS_CAN ) // if ( (Item[ pObj->usItem ].fFlags & ITEM_DAMAGEABLE) && (pObj->usItem != MINE) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && pObj->usItem != GAS_CAN )
if ( Item[pObj->usItem].damageable && !Item[pObj->usItem].mine && (Item[pObj->usItem].usItemClass != IC_MEDKIT) && !Item[pObj->usItem].gascan && !IsStructureConstructItem( pObj->usItem, pSoldier->sGridNo, NULL ) ) if (ItemIsDamageable(pObj->usItem) && !ItemIsMine(pObj->usItem) && (Item[pObj->usItem].usItemClass != IC_MEDKIT) && !ItemIsGascan(pObj->usItem) && !IsStructureConstructItem( pObj->usItem, pSoldier->sGridNo, NULL ) )
{ {
// if it's still usable, check whether it breaks // if it's still usable, check whether it breaks
if ( (*pObj)[0]->data.objectStatus >= USABLE) if ( (*pObj)[0]->data.objectStatus >= USABLE)
@@ -6103,7 +6102,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
CreateItem(gTempObject[0]->data.misc.usBombItem, gTempObject[0]->data.misc.bBombStatus, &TempObject); CreateItem(gTempObject[0]->data.misc.usBombItem, gTempObject[0]->data.misc.bBombStatus, &TempObject);
// also spawn attached guns/explosives // also spawn attached guns/explosives
if (gTempObject.usItem != ACTION_ITEM && (Item[gTempObject.usItem].tripwire || Item[gTempObject.usItem].usItemClass & IC_EXPLOSV)) if (gTempObject.usItem != ACTION_ITEM && (ItemIsTripwire(gTempObject.usItem) || Item[gTempObject.usItem].usItemClass & IC_EXPLOSV))
{ {
// search for attached items // search for attached items
OBJECTTYPE* pAttItem = NULL; OBJECTTYPE* pAttItem = NULL;
@@ -6990,7 +6989,7 @@ INT32 FindNearestAvailableGridNoForItem( INT32 sSweetGridNo, INT8 ubRadius )
BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay ) BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay )
{ {
if ( Item[pSoldier->inv[ pSoldier->ubAttackingHand ].usItem].fingerprintid ) if (ItemHasFingerPrintID(pSoldier->inv[ pSoldier->ubAttackingHand ].usItem))
{ {
// check imprint ID // check imprint ID
// NB not-imprinted value is NO_PROFILE // NB not-imprinted value is NO_PROFILE
@@ -7042,7 +7041,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet
fStealItem = FALSE; fStealItem = FALSE;
pObject=&pOpponent->inv[i]; pObject=&pOpponent->inv[i];
if ((pObject->exists() == true) && !(Item[pObject->usItem].defaultundroppable )) // CHECK! Undroppable items cannot be stolen - SANDRO if ((pObject->exists() == true) && !ItemIsUndroppableByDefault(pObject->usItem)) // CHECK! Undroppable items cannot be stolen - SANDRO
{ {
// Is the enemy collapsed // Is the enemy collapsed
if ( pOpponent->stats.bLife < OKLIFE || pOpponent->bCollapsed ) if ( pOpponent->stats.bLife < OKLIFE || pOpponent->bCollapsed )
@@ -9855,7 +9854,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
} }
} }
// if we want to equip a two-handed item in our first hand, also drop whatever we have in the second hand // if we want to equip a two-handed item in our first hand, also drop whatever we have in the second hand
else if ( node.slot == HANDPOS && Item[node.item].twohanded && pSoldier->inv[SECONDHANDPOS].exists( ) ) else if ( node.slot == HANDPOS && ItemIsTwoHanded(node.item) && pSoldier->inv[SECONDHANDPOS].exists( ) )
{ {
AutoPlaceObjectInInventoryStash( &pSoldier->inv[SECONDHANDPOS], pSoldier->sGridNo, pSoldier->pathing.bLevel ); AutoPlaceObjectInInventoryStash( &pSoldier->inv[SECONDHANDPOS], pSoldier->sGridNo, pSoldier->pathing.bLevel );
DeleteObj( &pSoldier->inv[SECONDHANDPOS] ); DeleteObj( &pSoldier->inv[SECONDHANDPOS] );
@@ -10268,7 +10267,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name )
} }
// if there is water in this sector, refill canteens // if there is water in this sector, refill canteens
if ( refillwaterfromsector && Item[(pSoldier->inv[slot]).usItem].canteen && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 ) if ( refillwaterfromsector && ItemIsCanteen(pSoldier->inv[slot].usItem) && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 )
{ {
OBJECTTYPE* pObj = &(pSoldier->inv[slot]); OBJECTTYPE* pObj = &(pSoldier->inv[slot]);
+10 -9
View File
@@ -2988,11 +2988,12 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent )
if ( pTSoldier != NULL ) if ( pTSoldier != NULL )
{ {
// If this is one of our own guys.....pop up requiester... // If this is one of our own guys.....pop up requiester...
UINT16 usItem = pSoldier->inv[HANDPOS].usItem;
if ( ( pTSoldier->bTeam == gbPlayerNum || pTSoldier->bTeam == MILITIA_TEAM ) if ( ( pTSoldier->bTeam == gbPlayerNum || pTSoldier->bTeam == MILITIA_TEAM )
&& Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass != IC_MEDKIT && Item[ usItem ].usItemClass != IC_MEDKIT
&& !Item[pSoldier->inv[ HANDPOS ].usItem].gascan && !ItemIsGascan(usItem)
&& !Item[pSoldier->inv[HANDPOS].usItem].toolkit && !ItemIsToolkit(usItem)
&& !ItemCanBeAppliedToOthers( pSoldier->inv[ HANDPOS ].usItem ) && !ItemCanBeAppliedToOthers( usItem )
&& gTacticalStatus.ubLastRequesterTargetID != pTSoldier->ubProfile && gTacticalStatus.ubLastRequesterTargetID != pTSoldier->ubProfile
&& ( pTSoldier->ubID != pSoldier->ubID ) ) && ( pTSoldier->ubID != pSoldier->ubID ) )
{ {
@@ -3010,7 +3011,7 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent )
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
// SANDRO - Should we ask if we really want to do the surgery? // SANDRO - Should we ask if we really want to do the surgery?
else if (Item[ pSoldier->inv[ HANDPOS ].usItem ].medicalkit && (NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) else if (ItemIsMedicalKit(usItem) && (NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery)
&& (pTSoldier->bTeam == OUR_TEAM || pTSoldier->bTeam == MILITIA_TEAM) && (pTSoldier->bTeam == OUR_TEAM || pTSoldier->bTeam == MILITIA_TEAM)
&& (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier )) && (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier ))
&& gGameOptions.fNewTraitSystem && pTSoldier->iHealableInjury >= 100 && gGameOptions.fNewTraitSystem && pTSoldier->iHealableInjury >= 100
@@ -3894,7 +3895,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance )
gGameExternalOptions.ubAllowAlternativeWeaponHolding && gGameExternalOptions.ubAllowAlternativeWeaponHolding &&
pSoldier->inv[HANDPOS].exists() && pSoldier->inv[HANDPOS].exists() &&
Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun &&
Item[pSoldier->inv[HANDPOS].usItem].twohanded && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) &&
bNewStance == ANIM_STAND) bNewStance == ANIM_STAND)
{ {
ChangeScopeMode(pSoldier, NOWHERE); ChangeScopeMode(pSoldier, NOWHERE);
@@ -3937,7 +3938,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance )
gGameExternalOptions.ubAllowAlternativeWeaponHolding && gGameExternalOptions.ubAllowAlternativeWeaponHolding &&
pSoldier->inv[HANDPOS].exists() && pSoldier->inv[HANDPOS].exists() &&
Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun &&
Item[pSoldier->inv[HANDPOS].usItem].twohanded && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) &&
bNewStance == ANIM_STAND) bNewStance == ANIM_STAND)
{ {
ChangeScopeMode(pSoldier, NOWHERE); ChangeScopeMode(pSoldier, NOWHERE);
@@ -4628,7 +4629,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags )
} }
else if ( uiFlags == MOVEUI_TARGET_BOMB ) else if ( uiFlags == MOVEUI_TARGET_BOMB )
{ {
if(Item[pSoldier->inv[HANDPOS].usItem].mine == 1) if(ItemIsMine(pSoldier->inv[HANDPOS].usItem))
sAPCost += GetAPsToPlantMine( pSoldier ); sAPCost += GetAPsToPlantMine( pSoldier );
else else
sAPCost += GetAPsToDropBomb( pSoldier ); sAPCost += GetAPsToDropBomb( pSoldier );
@@ -5014,7 +5015,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier )
} }
// SANDRO - doctor with medical bag trying to do the surgery // SANDRO - doctor with medical bag trying to do the surgery
if ((NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit && gGameOptions.fNewTraitSystem if ((NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem) && gGameOptions.fNewTraitSystem
&& (pTSoldier->stats.bLife != pTSoldier->stats.bLifeMax) && (pTSoldier->iHealableInjury >= 100)) && (pTSoldier->stats.bLife != pTSoldier->stats.bLifeMax) && (pTSoldier->iHealableInjury >= 100))
{ {
// should come a question first if you really want to do the surgery // should come a question first if you really want to do the surgery
File diff suppressed because it is too large Load Diff
+225 -102
View File
@@ -57,7 +57,6 @@
#include "game clock.h" #include "game clock.h"
#include "squads.h" #include "squads.h"
#include "MessageBoxScreen.h" #include "MessageBoxScreen.h"
#include "Language Defines.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "Map Screen Interface Map Inventory.h" #include "Map Screen Interface Map Inventory.h"
#include "Quests.h" #include "Quests.h"
@@ -83,6 +82,7 @@
#include "Sound Control.h" #include "Sound Control.h"
#include "Multi Language Graphic Utils.h" #include "Multi Language Graphic Utils.h"
#include <language.hpp>
#ifdef JA2UB #ifdef JA2UB
#include "Ja25_Tactical.h" #include "Ja25_Tactical.h"
@@ -168,7 +168,7 @@ INT16 ITEMDESC_DONE_Y;
#define DOTDOTDOT L"..." #define DOTDOTDOT L"..."
#define COMMA_AND_SPACE L", " #define COMMA_AND_SPACE L", "
#define ITEM_PROS_AND_CONS( usItem ) ( ( Item[ usItem ].usItemClass & IC_GUN && !Item[ usItem ].rocketlauncher ) ) #define ITEM_PROS_AND_CONS( usItem ) ( ( Item[ usItem ].usItemClass & IC_GUN && !ItemIsRocketLauncher(usItem) ) )
#define ITEMDESC_ITEM_STATUS_WIDTH 2 #define ITEMDESC_ITEM_STATUS_WIDTH 2
#define ITEMDESC_ITEM_WIDTH 117 #define ITEMDESC_ITEM_WIDTH 117
@@ -2666,7 +2666,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe
} }
// IF it's the second hand and this hand cannot contain anything, remove the second hand position graphic // IF it's the second hand and this hand cannot contain anything, remove the second hand position graphic
if (sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) if (sPocket == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem))
{ {
// CHRISL: Change coords for STI that covers 2nd hand location when carrying a 2handed weapon // CHRISL: Change coords for STI that covers 2nd hand location when carrying a 2handed weapon
if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) if( guiCurrentItemDescriptionScreen != MAP_SCREEN )
@@ -2710,7 +2710,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe
fHatchItOut = TRUE; fHatchItOut = TRUE;
} }
// CHRISL: Don't hatch second hand position if we're holding a two handed item // CHRISL: Don't hatch second hand position if we're holding a two handed item
else if ( sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) else if ( sPocket == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) )
{ {
fHatchItOut = FALSE; fHatchItOut = FALSE;
} }
@@ -2832,8 +2832,8 @@ BOOLEAN CompatibleItemForApplyingOnMerc(OBJECTTYPE *pTestObject)
//Shadooow: rewritten to use new item flags and check canteen not empty //Shadooow: rewritten to use new item flags and check canteen not empty
if (((HasItemFlag(usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) || Item[usItem].camouflagekit || usItem == JAR_ELIXIR || if (((HasItemFlag(usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) || ItemIsCamoKit(usItem) || usItem == JAR_ELIXIR ||
Item[usItem].clothestype || Item[usItem].drugtype || Item[usItem].foodtype) && (!Item[usItem].canteen || (*pTestObject)[0]->data.objectStatus > 1)) Item[usItem].clothestype || Item[usItem].drugtype || Item[usItem].foodtype) && (!ItemIsCanteen(usItem) || (*pTestObject)[0]->data.objectStatus > 1))
{ {
return( TRUE ); return( TRUE );
} }
@@ -3010,14 +3010,14 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos
UINT32 invsize = pSoldier->inv.size(); UINT32 invsize = pSoldier->inv.size();
// First test attachments, which almost any type of item can have.... // First test attachments, which almost any type of item can have....
if ( !(Item[ pTestObject->usItem ].hiddenaddon ) ) if ( !(ItemIsHiddenAddon(pTestObject->usItem)) )
{ {
for ( cnt = 0; cnt < invsize; ++cnt ) for ( cnt = 0; cnt < invsize; ++cnt )
{ {
pObject = &(pSoldier->inv[ cnt ]); pObject = &(pSoldier->inv[ cnt ]);
if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) &&
!Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) &&
!Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass))
{ {
// don't consider for UI purposes // don't consider for UI purposes
@@ -3116,14 +3116,14 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory(SOLDIERTYPE *pSoldier, INT32 bInvP
} }
// First test attachments, which almost any type of item can have.... // First test attachments, which almost any type of item can have....
if (!(Item[pTestObject->usItem].hiddenaddon)) if (!(ItemIsHiddenAddon(pTestObject->usItem)))
{ {
for (cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; ++cnt) for (cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; ++cnt)
{ {
pObject = &(pInventoryPoolList[iStartSlotNumber + cnt].object); pObject = &(pInventoryPoolList[iStartSlotNumber + cnt].object);
if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) &&
!Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) &&
!Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass))
{ {
// don't consider for UI purposes // don't consider for UI purposes
@@ -3270,14 +3270,14 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
UINT32 invsize = pSoldier->inv.size(); UINT32 invsize = pSoldier->inv.size();
// First test attachments, which almost any type of item can have.... // First test attachments, which almost any type of item can have....
if (!(Item[pTestObject->usItem].hiddenaddon)) if (!(ItemIsHiddenAddon(pTestObject->usItem)))
{ {
for (cnt = 0; cnt < invsize; ++cnt) for (cnt = 0; cnt < invsize; ++cnt)
{ {
pObject = &(pSoldier->inv[cnt]); pObject = &(pSoldier->inv[cnt]);
if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) &&
!Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) &&
!Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass))
{ {
// don't consider for UI purposes // don't consider for UI purposes
@@ -3302,7 +3302,7 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest
} }
} }
//if the test object is hidden addon or attachment, it won't be ammunition or gun so skip this //if the test object is hidden addon or attachment, it won't be ammunition or gun so skip this
if (!Item[pTestObject->usItem].hiddenaddon && !Item[pTestObject->usItem].attachment) if (!ItemIsHiddenAddon(pTestObject->usItem) && !ItemIsAttachment(pTestObject->usItem))
{ {
if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) )
{ {
@@ -3816,7 +3816,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
} }
} }
if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher ) if ( pItem->usItemClass == IC_GUN && !ItemIsRocketLauncher(pObject->usItem) )
{ {
sNewY = sY + sHeight - 10; sNewY = sY + sHeight - 10;
sNewX = sX + 1; sNewX = sX + 1;
@@ -3872,7 +3872,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
} }
} }
if ( pItemShown->usItemClass == IC_GUN && !Item[pObjShown->usItem].rocketlauncher ) if ( pItemShown->usItemClass == IC_GUN && !ItemIsRocketLauncher(pObjShown->usItem) )
{ {
SetRGBFontForeground( AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].red, SetRGBFontForeground( AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].red,
AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].green, AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].green,
@@ -3950,7 +3950,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
} }
// Flugente: overheating // Flugente: overheating
if ( gGameExternalOptions.fWeaponOverheating && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || Item[pObject->usItem].barrel ) ) if ( gGameExternalOptions.fWeaponOverheating && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || ItemIsBarrel(pObject->usItem)) )
{ {
OBJECTTYPE* pObjShown = pObject; OBJECTTYPE* pObjShown = pObject;
@@ -4201,7 +4201,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
} }
if ( ( ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) || if ( ( ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) ||
( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) ) && ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) ) &&
pSoldier->usGLDelayMode ) pSoldier->usGLDelayMode )
{ {
wcscat( pStr, New113Message[MSG113_FIREMODE_GL_DELAYED] ); wcscat( pStr, New113Message[MSG113_FIREMODE_GL_DELAYED] );
@@ -4231,7 +4231,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec
if ( pSoldier && pObject == &(pSoldier->inv[SECONDHANDPOS] ) && if ( pSoldier && pObject == &(pSoldier->inv[SECONDHANDPOS] ) &&
(pSoldier->bWeaponMode == WM_BURST || pSoldier->bWeaponMode == WM_AUTOFIRE) && (pSoldier->bWeaponMode == WM_BURST || pSoldier->bWeaponMode == WM_AUTOFIRE) &&
Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN &&
!(Item[ pSoldier->inv[HANDPOS ].usItem ].twohanded ) && !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) &&
pSoldier->IsValidSecondHandBurst() ) pSoldier->IsValidSecondHandBurst() )
{ {
sNewY = sY + 13; // rather arbitrary sNewY = sY + 13; // rather arbitrary
@@ -4565,7 +4565,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb
} }
//////////////////// GUN DATA ////////////////// //////////////////// GUN DATA //////////////////
if ( pItem->usItemClass & IC_GUN && !Item[pObject->usItem].rocketlauncher ) if ( pItem->usItemClass & IC_GUN && !ItemIsRocketLauncher(pObject->usItem) )
{ {
//////////////// AMMO REMAINING //////////////// AMMO REMAINING
@@ -4804,7 +4804,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb
} }
iCurAsterisk = ATTACHMENT_GENERAL; iCurAsterisk = ATTACHMENT_GENERAL;
if (Item[iter->usItem].grenadelauncher ) if (ItemIsGrenadeLauncher(iter->usItem))
{ {
//iCurAsterisk = ATTACHMENT_GL; //iCurAsterisk = ATTACHMENT_GL;
uiNumAttachmentsGL++; uiNumAttachmentsGL++;
@@ -5233,7 +5233,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
} }
// Add ammo eject button for GUN type objects. // Add ammo eject button for GUN type objects.
if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !Item[pObject->usItem].rocketlauncher ) if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !ItemIsRocketLauncher(pObject->usItem) )
{ {
if ( GetMagSize(gpItemDescObject) <= 99 ) if ( GetMagSize(gpItemDescObject) <= 99 )
{ {
@@ -5610,7 +5610,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY,
} }
// if ( !(Item[ pObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) && ( ValidAttachment( gpItemPointer->usItem, pObject->usItem ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) // if ( !(Item[ pObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) && ( ValidAttachment( gpItemPointer->usItem, pObject->usItem ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) )
if ( !(Item[ pObject->usItem ].hiddenaddon ) && ( ValidAttachment( gpItemPointer->usItem, pObject ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) if ( !(ItemIsHiddenAddon(pObject->usItem)) && ( ValidAttachment( gpItemPointer->usItem, pObject ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) )
{ {
SetUpFastHelpListRegions( SetUpFastHelpListRegions(
gItemDescHelpText.iXPosition, gItemDescHelpText.iXPosition,
@@ -5750,7 +5750,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
if (Item[usLoop].nasAttachmentClass & AttachmentSlots[usLoopSlotID].nasAttachmentClass && IsAttachmentPointAvailable(point, usLoop, TRUE)) if (Item[usLoop].nasAttachmentClass & AttachmentSlots[usLoopSlotID].nasAttachmentClass && IsAttachmentPointAvailable(point, usLoop, TRUE))
{ {
usAttachment = usLoop; usAttachment = usLoop;
if (!Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) if (!ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment))
{ {
if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end())
{ {
@@ -5769,14 +5769,6 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
//search primary item launchables.xml //search primary item launchables.xml
usAttachment = Launchable[usLoop][0]; usAttachment = Launchable[usLoop][0];
} }
if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment))
{
if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end())
{
attachList.push_back(usAttachment);
}
}
else else
{ {
//search for launchables made valid by other attachments //search for launchables made valid by other attachments
@@ -5785,11 +5777,22 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
while (cnt) while (cnt)
{ {
if (Launchable[usLoop][1] == *p && AttachmentSlots[usLoopSlotID].nasAttachmentClass & Item[Launchable[usLoop][0]].nasAttachmentClass) if (Launchable[usLoop][1] == *p && AttachmentSlots[usLoopSlotID].nasAttachmentClass & Item[Launchable[usLoop][0]].nasAttachmentClass)
{
usAttachment = Launchable[usLoop][0]; usAttachment = Launchable[usLoop][0];
break;
}
cnt--, p++; cnt--, p++;
} }
} }
if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment))
{
if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end())
{
attachList.push_back(usAttachment);
}
}
} }
// check all attachments // check all attachments
@@ -5819,7 +5822,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
} }
} }
if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment))
{ {
if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end())
{ {
@@ -5892,7 +5895,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
for(UINT16 loop = 0; loop < attachList.size(); loop++){ for(UINT16 loop = 0; loop < attachList.size(); loop++){
usAttachment = attachList[loop]; usAttachment = attachList[loop];
// If the attachment is not hidden // If the attachment is not hidden
if (usAttachment > 0 && !Item[ usAttachment ].hiddenaddon && !Item[ usAttachment ].hiddenattachment) if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment))
{ {
if (wcslen( attachStr3 ) + wcslen(Item[usAttachment].szItemName) > 3600) if (wcslen( attachStr3 ) + wcslen(Item[usAttachment].szItemName) > 3600)
{ {
@@ -7018,8 +7021,7 @@ void RenderItemDescriptionBox( )
//WarmSteel - This hatches out attachment slots one by one, instead of all of em. //WarmSteel - This hatches out attachment slots one by one, instead of all of em.
for(cnt = 0; cnt < (INT32)(*gpItemDescObject)[gubItemDescStatusIndex]->attachments.size(); cnt++) for(cnt = 0; cnt < (INT32)(*gpItemDescObject)[gubItemDescStatusIndex]->attachments.size(); cnt++)
{ {
//if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || if (ItemIsHiddenAddon(gpItemPointer->usItem) ||
if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) ||
( !ValidItemAttachmentSlot( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, cnt, FALSE, NULL, usAttachmentSlotIndexVector) && ( !ValidItemAttachmentSlot( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, cnt, FALSE, NULL, usAttachmentSlotIndexVector) &&
!ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) ) )
@@ -7035,8 +7037,7 @@ void RenderItemDescriptionBox( )
} else { } else {
for(cnt = 0; cnt < OLD_MAX_ATTACHMENTS_101; cnt++) for(cnt = 0; cnt < OLD_MAX_ATTACHMENTS_101; cnt++)
{ {
//if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || if (ItemIsHiddenAddon(gpItemPointer->usItem) ||
if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) ||
( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, usAttachmentSlotIndexVector) && ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, usAttachmentSlotIndexVector) &&
!ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) && !ValidLaunchable( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) && !ValidLaunchable( gpItemPointer->usItem, gpItemDescObject->usItem ) ) )
@@ -7068,7 +7069,7 @@ void RenderItemDescriptionBox( )
DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex ); DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex );
// Flugente: overheating // Flugente: overheating
if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[ (iter)->usItem ].barrel == TRUE) ) // Flugente if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel((iter)->usItem)) ) // Flugente
{ {
FLOAT overheatjampercentage = GetGunOverheatDisplayPercentage( &(*iter)); FLOAT overheatjampercentage = GetGunOverheatDisplayPercentage( &(*iter));
@@ -7216,7 +7217,7 @@ void RenderItemDescriptionBox( )
SetFontForeground( FONT_BLACK ); SetFontForeground( FONT_BLACK );
SetFontShadow( ITEMDESC_FONTSHADOW2 ); SetFontShadow( ITEMDESC_FONTSHADOW2 );
// Caliber // Caliber
if ( (Item[gpItemDescObject->usItem].fingerprintid ) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) if ( ItemHasFingerPrintID(gpItemDescObject->usItem) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE )
{ {
// Fingerprint ID // Fingerprint ID
swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID ].zNickname ); swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID ].zNickname );
@@ -7281,7 +7282,7 @@ void RenderItemDescriptionBox( )
} }
// Flugente: display temperature string // Flugente: display temperature string
if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].barrel == TRUE ) ) if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || ItemIsBarrel(gpItemDescObject->usItem) ) )
{ {
// UDB system displays a string with colored condition text. // UDB system displays a string with colored condition text.
int regionindex = 8; int regionindex = 8;
@@ -7409,11 +7410,11 @@ void RenderItemDescriptionBox( )
FindFontRightCoordinates( gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sTop, gODBItemDescRegions[0][0].sRight - gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sBottom - gODBItemDescRegions[0][0].sTop ,pStr, BLOCKFONT2, &usX, &usY); FindFontRightCoordinates( gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sTop, gODBItemDescRegions[0][0].sRight - gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sBottom - gODBItemDescRegions[0][0].sTop ,pStr, BLOCKFONT2, &usX, &usY);
} }
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
wcscat( pStr, ChineseSpecString1 ); wcscat( pStr, ChineseSpecString1 );
#else } else {
wcscat( pStr, L"%%" ); wcscat( pStr, L"%%" );
#endif }
mprintf( usX, usY, pStr ); mprintf( usX, usY, pStr );
} }
@@ -7609,7 +7610,7 @@ void RenderItemDescriptionBox( )
FindFontRightCoordinates( gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sTop, gODBItemDescRegions[2][7].sRight - gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sBottom - gODBItemDescRegions[2][7].sTop ,pStr, BLOCKFONT2, &usX, &usY); FindFontRightCoordinates( gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sTop, gODBItemDescRegions[2][7].sRight - gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sBottom - gODBItemDescRegions[2][7].sTop ,pStr, BLOCKFONT2, &usX, &usY);
mprintf( usX, usY, pStr ); mprintf( usX, usY, pStr );
} }
if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) )
{ {
// DAMAGE // DAMAGE
SetFontForeground( 6 ); SetFontForeground( 6 );
@@ -8362,7 +8363,7 @@ void DeleteItemDescriptionBox( )
} }
if (Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && ValidLaunchable(newIter->usItem, gpItemDescObject->usItem) || if (Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && ValidLaunchable(newIter->usItem, gpItemDescObject->usItem) ||
Item[gpItemDescObject->usItem].cannon) ItemIsCannon(gpItemDescObject->usItem))
{ {
//lalien: changed to charge AP's for reloading a GL/RL //lalien: changed to charge AP's for reloading a GL/RL
ubAPCost = GetAPsToReload(gpItemDescObject); ubAPCost = GetAPsToReload(gpItemDescObject);
@@ -10709,7 +10710,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason )
} }
else else
{ {
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpItemPopupObject->usItem].singleshotrocketlauncher) ) if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpItemPopupObject->usItem) )
{ {
EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos ); EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos );
InternalMAPBeginItemPointer( gpItemPopupSoldier ); InternalMAPBeginItemPointer( gpItemPopupSoldier );
@@ -10720,7 +10721,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason )
} }
else else
{ {
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpItemPopupObject->usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpItemPopupObject->usItem) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) )
{ {
EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos ); EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos );
gpItemPointer = &gItemPointer; gpItemPointer = &gItemPointer;
@@ -11178,11 +11179,11 @@ void SetupPickupPage( INT8 bPage )
} }
else else
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString3, sValue ); swprintf( pStr, ChineseSpecString3, sValue );
#else } else {
swprintf( pStr, L"%d%%", sValue ); swprintf( pStr, L"%d%%", sValue );
#endif }
} }
SetRegionFastHelpText( &(gItemPickupMenu.Regions[ cnt - iStart ]), pStr ); SetRegionFastHelpText( &(gItemPickupMenu.Regions[ cnt - iStart ]), pStr );
@@ -12280,12 +12281,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString11, swprintf( pStr, ChineseSpecString11,
#else ItemNames[ usItem ],
AmmoCaliber[ Weapon[ usItem ].ubCalibre ],
sValue,
sThreshold,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
} else {
swprintf( pStr, L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", swprintf( pStr, L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
AmmoCaliber[ Weapon[ usItem ].ubCalibre ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ],
sValue, sValue,
@@ -12305,15 +12322,11 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} }
}
else else
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString4, swprintf( pStr, ChineseSpecString4,
#else
swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
AmmoCaliber[ Weapon[ usItem ].ubCalibre ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ],
sValue, sValue,
@@ -12331,6 +12344,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
fWeight, //Weight fWeight, //Weight
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} else {
swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
ItemNames[ usItem ],
AmmoCaliber[ Weapon[ usItem ].ubCalibre ],
sValue,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
}
} }
} }
break; break;
@@ -12379,12 +12414,27 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, L"%s [%d%£¥(%d%£¥)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", swprintf( pStr, L"%s [%d%£¥(%d%£¥)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
#else ItemNames[ usItem ],
sValue,
sThreshold,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
} else {
swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
sValue, sValue,
sThreshold, sThreshold,
@@ -12403,14 +12453,11 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} }
}
else else
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, L"%s [%d%£¥]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", swprintf( pStr, L"%s [%d%£¥]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
#else
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
sValue, sValue,
gWeaponStatsDesc[ 9 ], //Accuracy String gWeaponStatsDesc[ 9 ], //Accuracy String
@@ -12427,6 +12474,25 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
fWeight, //Weight fWeight, //Weight
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} else {
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s",
ItemNames[ usItem ],
sValue,
gWeaponStatsDesc[ 9 ], //Accuracy String
accuracy,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject),
gWeaponStatsDesc[ 10 ], //Range String
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range
gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range
gWeaponStatsDesc[ 6 ], //AP String
(Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's
apStr, //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
}
} }
} }
break; break;
@@ -12437,12 +12503,21 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
{ {
if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString9, swprintf( pStr, ChineseSpecString9,
#else ItemNames[ usItem ],
sValue,
sThreshold,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject), //Melee damage
gWeaponStatsDesc[ 6 ], //AP String
BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
} else {
swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
sValue, sValue,
sThreshold, sThreshold,
@@ -12455,14 +12530,11 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} }
}
else else
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString5, swprintf( pStr, ChineseSpecString5,
#else
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
sValue, sValue,
gWeaponStatsDesc[ 11 ], //Damage String gWeaponStatsDesc[ 11 ], //Damage String
@@ -12473,6 +12545,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
fWeight, //Weight fWeight, //Weight
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} else {
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s",
ItemNames[ usItem ],
sValue,
gWeaponStatsDesc[ 11 ], //Damage String
GetDamage(pObject), //Melee damage
gWeaponStatsDesc[ 6 ], //AP String
BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
}
} }
} }
break; break;
@@ -12512,12 +12597,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage, 0 ); UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage, 0 );
UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage, 1 ); UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage, 1 );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString5, swprintf( pStr, ChineseSpecString5,
#else
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s",
#endif
ItemNames[ usItem ], ItemNames[ usItem ],
sValue, sValue,
gWeaponStatsDesc[ 11 ], //Damage String gWeaponStatsDesc[ 11 ], //Damage String
@@ -12528,6 +12609,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
fWeight, //Weight fWeight, //Weight
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} else {
swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s",
ItemNames[ usItem ],
sValue,
gWeaponStatsDesc[ 11 ], //Damage String
explDamage,
gWeaponStatsDesc[ 13 ], //Stun Damage String
explStunDamage, //Stun Damage
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
}
} }
break; break;
@@ -12557,12 +12651,23 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 )
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString10, swprintf( pStr, ChineseSpecString10,
#else ItemNames[ usItem ], //Item long name
sValue, //Item condition
sThreshold, //repair threshold
pInvPanelTitleStrings[ 4 ], //Protection string
iProtection, //Protection rating in % based on best armor
Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100,
Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data)
pInvPanelTitleStrings[ 3 ], //Camo string
GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus
gWeaponStatsDesc[ 12 ], //Weight string
fWeight, //Weight
GetWeightUnitString() //Weight units
);
} else {
swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s",
#endif
ItemNames[ usItem ], //Item long name ItemNames[ usItem ], //Item long name
sValue, //Item condition sValue, //Item condition
sThreshold, //repair threshold sThreshold, //repair threshold
@@ -12577,14 +12682,25 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} }
}
else else
{ {
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString6, swprintf( pStr, ChineseSpecString6,
#else ItemNames[ usItem ], //Item long name
sValue, //Item condition
pInvPanelTitleStrings[ 4 ], //Protection string
iProtection, //Protection rating in % based on best armor
Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100,
Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data)
pInvPanelTitleStrings[ 3 ], //Camo string
GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus
gWeaponStatsDesc[ 12 ], //Weight string
fWeight, //Weight
GetWeightUnitString() //Weight units
);
} else {
swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s",
#endif
ItemNames[ usItem ], //Item long name ItemNames[ usItem ], //Item long name
sValue, //Item condition sValue, //Item condition
pInvPanelTitleStrings[ 4 ], //Protection string pInvPanelTitleStrings[ 4 ], //Protection string
@@ -12599,6 +12715,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
); );
} }
} }
}
break; break;
@@ -12609,11 +12726,16 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
default: default:
{ {
// The final, and typical case, is that of an item with a percent status // The final, and typical case, is that of an item with a percent status
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
swprintf( pStr, ChineseSpecString7, swprintf( pStr, ChineseSpecString7,
#else ItemNames[ usItem ], //Item long name
sValue, //Item condition
gWeaponStatsDesc[ 12 ], //Weight String
fWeight, //Weight
GetWeightUnitString() //Weight units
);
} else {
swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s",
#endif
ItemNames[ usItem ], //Item long name ItemNames[ usItem ], //Item long name
sValue, //Item condition sValue, //Item condition
gWeaponStatsDesc[ 12 ], //Weight String gWeaponStatsDesc[ 12 ], //Weight String
@@ -12621,12 +12743,13 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier
GetWeightUnitString() //Weight units GetWeightUnitString() //Weight units
); );
} }
}
break; break;
} }
// Fingerprint ID (Soldier Name) // Fingerprint ID (Soldier Name)
if ( ( Item[pObject->usItem].fingerprintid ) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE ) if ( ItemHasFingerPrintID(pObject->usItem) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE )
{ {
CHAR16 pStr2[20]; CHAR16 pStr2[20];
swprintf( pStr2, L" [%s]", gMercProfiles[ (*pObject)[subObject]->data.ubImprintID ].zNickname ); swprintf( pStr2, L" [%s]", gMercProfiles[ (*pObject)[subObject]->data.ubImprintID ].zNickname );
@@ -13813,7 +13936,7 @@ void BombInventoryMessageBoxCallBack( UINT8 ubExitValue )
if (gpItemDescSoldier) if (gpItemDescSoldier)
{ {
// no planting tripwire in our inventory... // no planting tripwire in our inventory...
if ( Item[ gpItemDescObject->usItem ].tripwire == 1 ) if (ItemIsTripwire(gpItemDescObject->usItem))
return; return;
INT32 iResult; INT32 iResult;
@@ -13962,14 +14085,14 @@ void BombInventoryDisArmMessageBoxCallBack( UINT8 ubExitValue )
if ( (*gpItemDescObject)[0]->data.misc.ubBombOwner > 1 && ( (INT32)(*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) if ( (*gpItemDescObject)[0]->data.misc.ubBombOwner > 1 && ( (INT32)(*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) )
{ {
// Flugente: get a tripwire-related bonus if we have a wire cutter in our hands // Flugente: get a tripwire-related bonus if we have a wire cutter in our hands
if ( ( (&gpItemDescSoldier->inv[HANDPOS])->exists() && Item[ gpItemDescSoldier->inv[HANDPOS].usItem ].wirecutters == 1 ) || ( (&gpItemDescSoldier->inv[SECONDHANDPOS])->exists() && Item[ gpItemDescSoldier->inv[SECONDHANDPOS].usItem ].wirecutters == 1 ) ) if ( ( (&gpItemDescSoldier->inv[HANDPOS])->exists() && ItemIsWirecutters(gpItemDescSoldier->inv[HANDPOS].usItem) ) || ( (&gpItemDescSoldier->inv[SECONDHANDPOS])->exists() && ItemIsWirecutters(gpItemDescSoldier->inv[SECONDHANDPOS].usItem) ) )
{ {
// + 10 if item gets activated by tripwire // + 10 if item gets activated by tripwire
if ( Item[gpItemDescObject->usItem].tripwireactivation == 1 ) if (ItemHasTripwireActivation(gpItemDescObject->usItem))
diff += 10; diff += 10;
// + 10 if item is tripwire // + 10 if item is tripwire
if ( Item[gpItemDescObject->usItem].tripwire == 1 ) if (ItemIsTripwire(gpItemDescObject->usItem))
diff += 10; diff += 10;
} }
+20 -17
View File
@@ -73,6 +73,8 @@
//legion by Jazz //legion by Jazz
#include "Interface Utils.h" #include "Interface Utils.h"
#include <language.hpp>
//forward declarations of common classes to eliminate includes //forward declarations of common classes to eliminate includes
class OBJECTTYPE; class OBJECTTYPE;
class SOLDIERTYPE; class SOLDIERTYPE;
@@ -2747,27 +2749,27 @@ void RenderSMPanel( BOOLEAN *pfDirty )
mprintf( SM_ARMOR_LABEL_X - StringPixLength( pInvPanelTitleStrings[0], BLOCKFONT2 ) / 2, SM_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); mprintf( SM_ARMOR_LABEL_X - StringPixLength( pInvPanelTitleStrings[0], BLOCKFONT2 ) / 2, SM_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, ChineseSpecString1 ); mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, ChineseSpecString1 );
#else } else {
mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, L"%%" ); mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, L"%%" );
#endif }
mprintf( SM_WEIGHT_LABEL_X - StringPixLength( pInvPanelTitleStrings[1], BLOCKFONT2 ), SM_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); mprintf( SM_WEIGHT_LABEL_X - StringPixLength( pInvPanelTitleStrings[1], BLOCKFONT2 ), SM_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, ChineseSpecString1 ); mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, ChineseSpecString1 );
#else } else {
mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, L"%%" ); mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, L"%%" );
#endif }
mprintf( SM_CAMMO_LABEL_X - StringPixLength( pInvPanelTitleStrings[2], BLOCKFONT2 ), SM_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); mprintf( SM_CAMMO_LABEL_X - StringPixLength( pInvPanelTitleStrings[2], BLOCKFONT2 ), SM_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] );
#ifdef CHINESE if( g_lang == i18n::Lang::zh ) {
mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, ChineseSpecString1 ); mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, ChineseSpecString1 );
#else } else {
mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, L"%%" ); mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, L"%%" );
#endif }
UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeAgilityTime, (BOOLEAN)(gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE ? TRUE : FALSE), (BOOLEAN)((gGameOptions.fNewTraitSystem && (gpSMCurrentMerc->ubCriticalStatDamage[DAMAGED_STAT_AGILITY] > 0)) ? TRUE : FALSE), gpSMCurrentMerc->bExtraAgility != 0 ); // SANDRO UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeAgilityTime, (BOOLEAN)(gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE ? TRUE : FALSE), (BOOLEAN)((gGameOptions.fNewTraitSystem && (gpSMCurrentMerc->ubCriticalStatDamage[DAMAGED_STAT_AGILITY] > 0)) ? TRUE : FALSE), gpSMCurrentMerc->bExtraAgility != 0 ); // SANDRO
@@ -3373,7 +3375,7 @@ BOOLEAN HandleNailsVestFetish( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, UINT16 u
else else
{ {
// Do we have nothing or the leather vest or kevlar leather vest? // Do we have nothing or the leather vest or kevlar leather vest?
if ( Item[usReplaceItem].leatherjacket || if (ItemIsLeatherJacket(usReplaceItem) ||
usReplaceItem == COMPOUND18 || usReplaceItem == COMPOUND18 ||
usReplaceItem == JAR_QUEEN_CREATURE_BLOOD ) usReplaceItem == JAR_QUEEN_CREATURE_BLOOD )
{ {
@@ -4044,7 +4046,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
{ {
if ( !InItemDescriptionBox( ) ) if ( !InItemDescriptionBox( ) )
{ {
if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpSMCurrentMerc->inv[ uiHandPos ].usItem) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) )
{ {
EmptyWeaponMagazine( &(gpSMCurrentMerc->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); EmptyWeaponMagazine( &(gpSMCurrentMerc->inv[ uiHandPos ]), &gItemPointer, uiHandPos );
gpItemPointer = &gItemPointer; gpItemPointer = &gItemPointer;
@@ -7096,22 +7098,23 @@ void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier )
void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj )
{ {
INT16 bMaxPoints; INT16 bMaxPoints;
UINT16 usItem = pObj->usItem;
if ( !(Item[pObj->usItem].usItemClass & IC_AMMO || Item[pObj->usItem].usItemClass & IC_KIT || Item[pObj->usItem].usItemClass & IC_MEDKIT || Item[pObj->usItem].canteen || Item[pObj->usItem].gascan || Item[pObj->usItem].alcohol > 0.0f) ) if ( !(Item[usItem].usItemClass & IC_AMMO || Item[usItem].usItemClass & IC_KIT || Item[usItem].usItemClass & IC_MEDKIT || ItemIsCanteen(usItem) || ItemIsGascan(usItem) || Item[usItem].alcohol > 0.0f) )
{ {
return; return;
} }
if ( Item[ pObj->usItem ].usItemClass & IC_AMMO ) if ( Item[ usItem ].usItemClass & IC_AMMO )
{ {
bMaxPoints = Magazine[ Item[ pObj->usItem ].ubClassIndex ].ubMagSize; bMaxPoints = Magazine[ Item[ usItem ].ubClassIndex ].ubMagSize;
} }
else else
{ {
bMaxPoints = 100; bMaxPoints = 100;
} }
if ( pCursorObj && pCursorObj->usItem == pObj->usItem ) if ( pCursorObj && pCursorObj->usItem == usItem )
{ {
DistributeStatus(pCursorObj, pObj, bMaxPoints); DistributeStatus(pCursorObj, pObj, bMaxPoints);
} }
@@ -7120,13 +7123,13 @@ void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj )
// Flugente: one of the items on the stack might not be full. Make sure it is the first one, so the player can see what is missing at a glance // Flugente: one of the items on the stack might not be full. Make sure it is the first one, so the player can see what is missing at a glance
if ( pObj->ubNumberOfObjects > 1 ) if ( pObj->ubNumberOfObjects > 1 )
{ {
if ( Item[pObj->usItem].usItemClass & IC_AMMO ) if ( Item[usItem].usItemClass & IC_AMMO )
{ {
UINT16 shots_first = (*pObj)[0]->data.ubShotsLeft; UINT16 shots_first = (*pObj)[0]->data.ubShotsLeft;
(*pObj)[0]->data.ubShotsLeft = (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft; (*pObj)[0]->data.ubShotsLeft = (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft;
(*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft = shots_first; (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft = shots_first;
} }
else if ( Item[pObj->usItem].usItemClass & IC_MAPFILTER_KIT ) else if ( Item[usItem].usItemClass & IC_MAPFILTER_KIT )
{ {
INT16 status_first = (*pObj)[0]->data.objectStatus; INT16 status_first = (*pObj)[0]->data.objectStatus;
(*pObj)[0]->data.objectStatus = (*pObj)[pObj->ubNumberOfObjects - 1]->data.objectStatus; (*pObj)[0]->data.objectStatus = (*pObj)[pObj->ubNumberOfObjects - 1]->data.objectStatus;
+4 -17
View File
@@ -461,14 +461,7 @@ BOOLEAN InitializeTacticalInterface( )
// failing the CHECKF after this will cause you to lose your mouse // failing the CHECKF after this will cause you to lose your mouse
if ( GETPIXELDEPTH() == 8 )
{
strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT_8.pcx" );
}
else if ( GETPIXELDEPTH() == 16 )
{
strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" );
}
if( !AddVideoSurface( &vs_desc, &guiINTEXT ) ) if( !AddVideoSurface( &vs_desc, &guiINTEXT ) )
AssertMsg( 0, "Missing INTERFACE\\In_text.sti"); AssertMsg( 0, "Missing INTERFACE\\In_text.sti");
@@ -978,12 +971,12 @@ void PopupMovementMenu( UI_EVENT *pUIEvent )
} }
else else
{ {
if ( Item[pSoldier->inv[ HANDPOS ].usItem].toolkit ) if (ItemIsToolkit(pSoldier->inv[ HANDPOS ].usItem))
{ {
uiActionImages = TOOLKITACTIONC_IMAGES; uiActionImages = TOOLKITACTIONC_IMAGES;
swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] ); swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] );
} }
else if ( Item[pSoldier->inv[ HANDPOS ].usItem].wirecutters ) else if (ItemIsWirecutters(pSoldier->inv[ HANDPOS ].usItem))
{ {
uiActionImages = WIRECUTACTIONC_IMAGES; uiActionImages = WIRECUTACTIONC_IMAGES;
swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] ); swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] );
@@ -3562,10 +3555,7 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW
} }
if ( pSoldier->ubID == gusSelectedSoldier ) if ( pSoldier->ubID == gusSelectedSoldier )
{ {
if(gbPixelDepth==16)
RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf);
else
RectangleDraw8( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color8, pDestBuf);
} }
} }
@@ -5812,10 +5802,7 @@ void DrawBar( INT32 x, INT32 y, INT32 width, INT32 height, UINT16 color8, UINT16
{ {
for( INT32 i=0; i < height; i++ ) for( INT32 i=0; i < height; i++ )
{ {
if(gbPixelDepth==16)
LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf );
else if(gbPixelDepth==8)
LineDraw8( TRUE, x, y+i, x+width-1, y+i, color8, pDestBuf );
} }
} }
} }
@@ -6043,7 +6030,7 @@ void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSold
} }
else else
{ // show general name { // show general name
if( Item[pTargetSoldier->inv[HEAD1POS].usItem].gasmask ) if(ItemIsGasmask(pTargetSoldier->inv[HEAD1POS].usItem))
wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] ); wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] );
else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus ) else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus )
wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] ); wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] );
@@ -6059,7 +6046,7 @@ void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSold
} }
else else
{ // show general name { // show general name
if( Item[pTargetSoldier->inv[HEAD1POS].usItem].gasmask ) if(ItemIsGasmask(pTargetSoldier->inv[HEAD1POS].usItem))
wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] ); wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] );
else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus ) else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus )
wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] ); wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] );
+7 -7
View File
@@ -738,7 +738,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8
switch( Item[ pItem->usItem ].usItemClass ) switch( Item[ pItem->usItem ].usItemClass )
{ {
case IC_GUN: case IC_GUN:
if ( !Item[pItem->usItem].rocketlauncher ) if ( !ItemIsRocketLauncher(pItem->usItem) )
{ {
bWeaponClass *= -1; bWeaponClass *= -1;
} }
@@ -873,7 +873,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
pp->Inv[ i ][0]->data.gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ i ][0]->data.gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType;
pp->Inv[ i ][0]->data.gun.usGunAmmoItem = usAmmoIndex; pp->Inv[ i ][0]->data.gun.usGunAmmoItem = usAmmoIndex;
if ( Item[usGunIndex].fingerprintid ) if (ItemHasFingerPrintID(usGunIndex))
{ {
pp->Inv[ i ][0]->data.ubImprintID = (NO_PROFILE + 1); pp->Inv[ i ][0]->data.ubImprintID = (NO_PROFILE + 1);
} }
@@ -951,7 +951,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
pp->Inv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE; pp->Inv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE;
// Rocket Rifles must come pre-imprinted, in case carrier gets killed without getting a shot off // Rocket Rifles must come pre-imprinted, in case carrier gets killed without getting a shot off
if ( Item[usGunIndex].fingerprintid ) if (ItemHasFingerPrintID(usGunIndex))
{ {
pp->Inv[ HANDPOS ][0]->data.ubImprintID = (NO_PROFILE + 1); pp->Inv[ HANDPOS ][0]->data.ubImprintID = (NO_PROFILE + 1);
} }
@@ -3144,7 +3144,7 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass )
{ {
usItem = pp->Inv[ uiLoop ].usItem; usItem = pp->Inv[ uiLoop ].usItem;
if ( ( Item[ usItem ].usItemClass & IC_GUN ) && ExtendedGunListGun( usItem ) ) if ( ( Item[ usItem ].usItemClass & IC_GUN ) && ItemIsOnlyInTonsOfGuns( usItem ) )
{ {
if ( bSoldierClass == SOLDIER_CLASS_NONE ) if ( bSoldierClass == SOLDIER_CLASS_NONE )
{ {
@@ -3528,7 +3528,7 @@ UINT32 ItemFitness( OBJECTTYPE* pObj, UINT8 idx )
} }
else if ( Item[ pObj->usItem ].usItemClass & IC_FACE ) else if ( Item[ pObj->usItem ].usItemClass & IC_FACE )
{ {
if ( Item[ pObj->usItem ].gasmask ) if (ItemIsGasmask(pObj->usItem))
value = (*pObj)[idx]->data.objectStatus; value = (*pObj)[idx]->data.objectStatus;
else if ( Item[ pObj->usItem ].hearingrangebonus ) else if ( Item[ pObj->usItem ].hearingrangebonus )
{ {
@@ -4186,7 +4186,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
else if ( Item[pWorldItem[ uiCount ].object.usItem].usItemClass & IC_FACE && (!si[SI_SIGHT].done || !si[SI_FACE2].done || !si[SI_FACE_SPARESIGHT].done || !si[SI_GASMASK].done) ) else if ( Item[pWorldItem[ uiCount ].object.usItem].usItemClass & IC_FACE && (!si[SI_SIGHT].done || !si[SI_FACE2].done || !si[SI_FACE_SPARESIGHT].done || !si[SI_GASMASK].done) )
{ {
// gasmasks are reserved for a special slot and will only be worn if we do not have 2 face items. items that increase our vision (NVGs adn sungooggles) get to slot 1, everything else in 2 // gasmasks are reserved for a special slot and will only be worn if we do not have 2 face items. items that increase our vision (NVGs adn sungooggles) get to slot 1, everything else in 2
if ( Item[ pWorldItem[ uiCount ].object.usItem ].gasmask ) if (ItemIsGasmask(pWorldItem[ uiCount ].object.usItem))
EvaluateObjForItem( pWorldItem, pObj, uiCount, &si[SI_GASMASK] ); EvaluateObjForItem( pWorldItem, pObj, uiCount, &si[SI_GASMASK] );
else if ( Item[ pWorldItem[ uiCount ].object.usItem ].nightvisionrangebonus > 0 ) else if ( Item[ pWorldItem[ uiCount ].object.usItem ].nightvisionrangebonus > 0 )
{ {
@@ -4265,7 +4265,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
if ( fnd == launcherhelpmap.end() ) if ( fnd == launcherhelpmap.end() )
{ {
LauncherHelpStruct tmp; LauncherHelpStruct tmp;
tmp.fNeedsAmmo = !Item[pWorldItem[ uiCount ].object.usItem].singleshotrocketlauncher; tmp.fNeedsAmmo = !ItemIsSingleShotRocketLauncher(pWorldItem[ uiCount ].object.usItem);
launcherhelpmap[ pWorldItem[ uiCount ].object.usItem ] = tmp; launcherhelpmap[ pWorldItem[ uiCount ].object.usItem ] = tmp;
} }
} }
+2 -2
View File
@@ -592,7 +592,7 @@ LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index)
} }
bool OBJECTTYPE::exists() bool OBJECTTYPE::exists() const
{ {
return(this && ubNumberOfObjects && usItem); return(this && ubNumberOfObjects && usItem);
} }
@@ -1595,7 +1595,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src)
} }
else if ( EXPLOSIVE_GUN( this->usItem ) ) else if ( EXPLOSIVE_GUN( this->usItem ) )
{ {
if ( Item[this->usItem].singleshotrocketlauncher ) if (ItemIsSingleShotRocketLauncher(this->usItem))
{ {
(*this)[0]->data.gun.ubGunShotsLeft = 1; (*this)[0]->data.gun.ubGunShotsLeft = 1;
} }
+211 -250
View File
@@ -546,7 +546,7 @@ public:
bool operator==(OBJECTTYPE& compare); bool operator==(OBJECTTYPE& compare);
bool operator==(const OBJECTTYPE& compare)const; bool operator==(const OBJECTTYPE& compare)const;
bool exists(); bool exists() const;
bool IsActiveLBE(unsigned int index); bool IsActiveLBE(unsigned int index);
bool HasAnyActiveLBEs(SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0); bool HasAnyActiveLBEs(SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0);
LBENODE* GetLBEPointer(unsigned int index); LBENODE* GetLBEPointer(unsigned int index);
@@ -779,6 +779,98 @@ extern OBJECTTYPE gTempObject;
// extended flagmask to UINT64 // extended flagmask to UINT64
#define EMPTY_BLOOD_BAG 0x0000000100000000 // this item is a empty blood bag #define EMPTY_BLOOD_BAG 0x0000000100000000 // this item is a empty blood bag
#define MEDICAL_SPLINT 0x0000000200000000 // this item is a medical splint that can be applied to some diseases #define MEDICAL_SPLINT 0x0000000200000000 // this item is a medical splint that can be applied to some diseases
#define ITEM_damageable 0x0000000400000000
#define ITEM_repairable 0x0000000800000000
#define ITEM_waterdamages 0x0000001000000000
#define ITEM_metal 0x0000002000000000
#define ITEM_sinks 0x0000004000000000
#define ITEM_showstatus 0x0000008000000000
#define ITEM_hiddenaddon 0x0000010000000000
#define ITEM_twohanded 0x0000020000000000
#define ITEM_notbuyable 0x0000040000000000
#define ITEM_attachment 0x0000080000000000
#define ITEM_hiddenattachment 0x0000100000000000
#define ITEM_biggunlist 0x0000200000000000
#define ITEM_notineditor 0x0000400000000000
#define ITEM_defaultundroppable 0x0000800000000000
#define ITEM_unaerodynamic 0x0001000000000000
#define ITEM_electronic 0x0002000000000000
#define ITEM_cannon 0x0004000000000000
#define ITEM_rocketrifle 0x0008000000000000
#define ITEM_fingerprintid 0x0010000000000000
#define ITEM_metaldetector 0x0020000000000000
#define ITEM_gasmask 0x0040000000000000
#define ITEM_lockbomb 0x0080000000000000
#define ITEM_flare 0x0100000000000000
#define ITEM_grenadelauncher 0x0200000000000000
#define ITEM_mortar 0x0400000000000000
#define ITEM_duckbill 0x0800000000000000
//UNUSED #define ITEM_detonator 0x1000000000000000
//UNUSED #define ITEM_remotedetonator 0x2000000000000000
#define ITEM_hidemuzzleflash 0x4000000000000000
#define ITEM_rocketlauncher 0x8000000000000000
// New UINT64 Item Flag => usItemFlag2
#define ITEM_singleshotrocketlauncher 0x00000001
#define ITEM_brassknuckles 0x00000002
#define ITEM_crowbar 0x00000004
#define ITEM_glgrenade 0x00000008
#define ITEM_flakjacket 0x00000010
#define ITEM_leatherjacket 0x00000020
#define ITEM_batteries 0x00000040
#define ITEM_needsbatteries 0x00000080
#define ITEM_xray 0x00000100
#define ITEM_wirecutters 0x00000200
#define ITEM_toolkit 0x00000400
#define ITEM_firstaidkit 0x00000800
#define ITEM_medicalkit 0x00001000
#define ITEM_canteen 0x00002000
#define ITEM_jar 0x00004000
#define ITEM_canandstring 0x00008000
#define ITEM_marbles 0x00010000
#define ITEM_walkman 0x00020000
#define ITEM_remotetrigger 0x00040000
#define ITEM_robotremotecontrol 0x00080000
#define ITEM_camouflagekit 0x00100000
#define ITEM_locksmithkit 0x00200000
#define ITEM_mine 0x00400000
#define ITEM_antitankmine 0x00800000
#define ITEM_hardware 0x01000000
#define ITEM_medical 0x02000000
#define ITEM_gascan 0x04000000
#define ITEM_containsliquid 0x08000000
#define ITEM_rock 0x10000000
#define ITEM_thermaloptics 0x20000000
#define ITEM_scifi 0x40000000
#define ITEM_newinv 0x80000000
#define ITEM_DiseaseSystemExclusive 0x0000000100000000 // kitty: item exclusively available with disease feature
#define ITEM_barrel 0x0000000200000000 // item can be used on some guns as an exchange barrel
#define ITEM_tripwireactivation 0x0000000400000000 // item (mine) can be activated by nearby tripwire
#define ITEM_tripwire 0x0000000800000000 // item is tripwire
#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting)
#define ITEM_blockironsight 0x0000002000000000 // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight)
#define ITEM_fAllowClimbing 0x0000004000000000 // JMich: BackpackClimb does item allow climbing while wearing it
#define ITEM_cigarette 0x0000008000000000 // Flugente: this item can be smoked
#define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments
#define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments
#define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments
// ---------------------------------------------------------------- // ----------------------------------------------------------------
@@ -947,163 +1039,48 @@ extern OBJECTTYPE gTempObject;
// autofiretohitbonus, // autofiretohitbonus,
// bursttohitbonus // bursttohitbonus
// bitflags for usLimitedToSystem
#define FOOD_SYSTEM_FLAG 1
#define DISEASE_SYSTEM_FLAG 2
typedef struct typedef struct
{ {
UINT32 usItemClass; CHAR16 szItemDesc[400];
CHAR16 szBRDesc[400];
CHAR16 szItemName[80]; //+1 for the null terminator //added
CHAR16 szLongItemName[80];
CHAR16 szBRName[80];
UINT16 defaultattachments[MAX_DEFAULT_ATTACHMENTS]; //Need more default attachments, chose an array to do so. (no vector / list just to keep this all plain data)
UINT64 nasAttachmentClass; //CHRISL: Identify the class of attachment UINT64 nasAttachmentClass; //CHRISL: Identify the class of attachment
UINT64 nasLayoutClass; UINT64 nasLayoutClass;
//Madd: Common Attachment Framework: attach items based on matching connection points rather than using the old long attachmentinfo method
UINT64 ulAvailableAttachmentPoint; UINT64 ulAvailableAttachmentPoint;
UINT64 ulAttachmentPoint; UINT64 ulAttachmentPoint;
UINT8 ubAttachToPointAPCost; // cost to attach to any matching point UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 64 BOOLEAN values). If I only had thought of this earlier....
UINT16 ubClassIndex; UINT64 usItemFlag2; // bitflags to store various item properties
UINT8 ubCursor;
INT8 bSoundType;
UINT8 ubGraphicType;
UINT16 ubGraphicNum;
UINT16 ubWeight; //2 units per kilogram; roughly 1 unit per pound
UINT8 ubPerPocket;
UINT16 ItemSize;
UINT16 usPrice;
UINT8 ubCoolness;
INT8 bReliability;
INT8 bRepairEase;
UINT16 fFlags;
UINT32 uiIndex; // added UINT32 uiIndex;
CHAR16 szItemName[80]; //+1 for the null terminator //added UINT32 usItemClass;
UINT32 attachmentclass; // attachmentclass used
BOOLEAN damageable; UINT32 drugtype; // this flagmask determines what different components are used in a drug, which results in different effects
BOOLEAN repairable; UINT32 foodtype;
BOOLEAN waterdamages; UINT32 usActionItemFlag; // Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives)
BOOLEAN metal; UINT32 clothestype; // Flugente: clothes type that 'links' to an entry in Clothes.xml
BOOLEAN sinks;
BOOLEAN showstatus;
BOOLEAN hiddenaddon;
BOOLEAN twohanded;
BOOLEAN notbuyable;
BOOLEAN attachment;
BOOLEAN hiddenattachment;
BOOLEAN biggunlist;
BOOLEAN notineditor;
BOOLEAN defaultundroppable;
BOOLEAN unaerodynamic;
BOOLEAN electronic;
UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed.
//But now we will make it so that these items can be replaced, but still not removed directly.
//0 = removeable (as before)
//1 = inseparable (as before)
//2 = inseparable, but replaceable
CHAR16 szLongItemName[80];
CHAR16 szItemDesc[400];
CHAR16 szBRName[80];
CHAR16 szBRDesc[400];
//TODO: quest items, boosters, money
// special item/attachment functions:
BOOLEAN cannon;
BOOLEAN rocketrifle;
BOOLEAN fingerprintid;
BOOLEAN metaldetector;
BOOLEAN gasmask;
BOOLEAN lockbomb;
BOOLEAN flare;
INT16 percentnoisereduction;
INT16 bipod;
INT16 tohitbonus;
INT16 bestlaserrange;
INT16 rangebonus;
INT16 percentrangebonus;
INT16 aimbonus;
INT16 minrangeforaimbonus;
INT16 percentapreduction;
INT16 percentstatusdrainreduction;
BOOLEAN grenadelauncher;
BOOLEAN mortar;
BOOLEAN duckbill;
BOOLEAN detonator;
BOOLEAN remotedetonator;
BOOLEAN hidemuzzleflash;
BOOLEAN rocketlauncher;
BOOLEAN singleshotrocketlauncher;
UINT16 discardedlauncheritem;
BOOLEAN brassknuckles;
//*** ddd UINT16 bloodieditem;
INT16 bloodieditem;
BOOLEAN crowbar;
BOOLEAN glgrenade;
BOOLEAN flakjacket;
INT16 hearingrangebonus;
INT16 visionrangebonus;
INT16 nightvisionrangebonus;
INT16 dayvisionrangebonus;
INT16 cavevisionrangebonus;
INT16 brightlightvisionrangebonus;
INT16 itemsizebonus;
BOOLEAN leatherjacket;
BOOLEAN batteries;
BOOLEAN needsbatteries;
BOOLEAN xray;
BOOLEAN wirecutters;
BOOLEAN toolkit;
BOOLEAN firstaidkit;
BOOLEAN medicalkit;
BOOLEAN canteen;
BOOLEAN jar;
BOOLEAN canandstring;
BOOLEAN marbles;
BOOLEAN walkman;
BOOLEAN remotetrigger;
BOOLEAN robotremotecontrol;
BOOLEAN camouflagekit;
BOOLEAN locksmithkit;
BOOLEAN mine;
BOOLEAN antitankmine;
FLOAT alcohol;
BOOLEAN hardware;
BOOLEAN medical;
BOOLEAN gascan;
BOOLEAN containsliquid;
BOOLEAN rock;
INT16 damagebonus;
INT16 meleedamagebonus;
INT16 magsizebonus;
INT16 percentautofireapreduction;
INT16 autofiretohitbonus;
INT16 APBonus;
INT16 rateoffirebonus;
INT16 burstsizebonus;
INT16 bursttohitbonus;
INT16 percentreadytimeapreduction;
INT16 bulletspeedbonus;
BOOLEAN thermaloptics;
UINT8 percenttunnelvision;
INT16 percentreloadtimeapreduction;
INT16 percentburstfireapreduction;
INT16 camobonus;
INT16 stealthbonus;
INT16 urbanCamobonus;
INT16 desertCamobonus;
INT16 snowCamobonus;
BOOLEAN scifi; // item only available in scifi mode
BOOLEAN newinv; // item only available in new inventory mode
UINT8 ubAttachmentSystem; //Item availability per attachment system: 0 = both, 1 = OAS, 2 = NAS
UINT16 defaultattachments[MAX_DEFAULT_ATTACHMENTS]; //Need more default attachments, chose an array to do so. (no vector / list just to keep this all plain data)
//zilpin: pellet spread patterns externalized in XML //zilpin: pellet spread patterns externalized in XML
INT32 spreadPattern; INT32 spreadPattern;
FLOAT alcohol;
// HEADROCK HAM 4: New modifiers that do not require a stance array, since they affect the gun objectively, not
// subjectively.
FLOAT RecoilModifierX;
FLOAT RecoilModifierY;
FLOAT scopemagfactor;
FLOAT projectionfactor;
FLOAT usOverheatingCooldownFactor; // every turn/5 seconds, a gun's temperature is lowered by this amount
FLOAT overheatTemperatureModificator; // percentage modifier of heat a shot generates (read from attachments)
FLOAT overheatCooldownModificator; // percentage modifier of cooldown amount (read from attachments, applies to guns & barrels)
FLOAT overheatJamThresholdModificator; // percentage modifier of a gun's jam threshold (read from attachments)
FLOAT overheatDamageThresholdModificator; // percentage modifier of a gun's damage threshold (read from attachments)
FLOAT dirtIncreaseFactor; // Flugente: advanced repair/dirt system. One shot causes this much dirt on a gun
FLOAT fRobotDamageReductionModifier; // rftr: robot attachments
// HEADROCK HAM 4: New variable arrays for the New CTH system. // HEADROCK HAM 4: New variable arrays for the New CTH system.
INT16 flatbasemodifier[3]; INT16 flatbasemodifier[3];
INT16 percentbasemodifier[3]; INT16 percentbasemodifier[3];
@@ -1116,114 +1093,98 @@ typedef struct
INT16 counterforceaccuracymodifier[3]; INT16 counterforceaccuracymodifier[3];
INT16 targettrackingmodifier[3]; INT16 targettrackingmodifier[3];
INT16 aimlevelsmodifier[3]; INT16 aimlevelsmodifier[3];
// HEADROCK HAM 4: New modifiers that do not require a stance array, since they affect the gun objectively, not
// subjectively. //Madd: Common Attachment Framework: attach items based on matching connection points rather than using the old long attachmentinfo method
FLOAT RecoilModifierX; UINT16 ubClassIndex;
FLOAT RecoilModifierY; UINT16 ubGraphicNum;
UINT16 ubWeight; //2 units per kilogram; roughly 1 unit per pound
UINT16 ItemSize;
UINT16 usPrice;
UINT16 discardedlauncheritem;
UINT16 randomitem; // Flugente: a link to RandomItemsClass.xml. Out of such an item, a random object is created, depending on the entries in the xml
UINT16 usBuddyItem; // Flugente: item is connected to another item. Type of connection depends on item specifics
UINT16 usRiotShieldStrength; // Flugente: riot shields. strength of shield
UINT16 usRiotShieldGraphic; // Flugente: riot shields. graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti)
INT16 percentnoisereduction;
INT16 bipod;
INT16 tohitbonus;
INT16 bestlaserrange;
INT16 rangebonus;
INT16 percentrangebonus;
INT16 aimbonus;
INT16 minrangeforaimbonus;
INT16 percentapreduction;
INT16 percentstatusdrainreduction;
INT16 bloodieditem;
INT16 hearingrangebonus;
INT16 visionrangebonus;
INT16 nightvisionrangebonus;
INT16 dayvisionrangebonus;
INT16 cavevisionrangebonus;
INT16 brightlightvisionrangebonus;
INT16 itemsizebonus;
INT16 damagebonus;
INT16 meleedamagebonus;
INT16 magsizebonus;
INT16 percentautofireapreduction;
INT16 autofiretohitbonus;
INT16 APBonus;
INT16 rateoffirebonus;
INT16 burstsizebonus;
INT16 bursttohitbonus;
INT16 percentreadytimeapreduction;
INT16 bulletspeedbonus;
INT16 percentreloadtimeapreduction;
INT16 percentburstfireapreduction;
INT16 camobonus;
INT16 stealthbonus;
INT16 urbanCamobonus;
INT16 desertCamobonus;
INT16 snowCamobonus;
INT16 PercentRecoilModifier; INT16 PercentRecoilModifier;
INT16 percentaccuracymodifier; INT16 percentaccuracymodifier;
FLOAT scopemagfactor; INT16 usSpotting; // Flugente: spotting effectiveness
FLOAT projectionfactor; INT16 sBackpackWeightModifier; // JMich: BackpackClimb modifier to weight calculation to climb.
BOOLEAN speeddot;
// Flugente
BOOLEAN barrel; // item can be used on some guns as an exchange barrel
FLOAT usOverheatingCooldownFactor; // every turn/5 seconds, a gun's temperature is lowered by this amount
FLOAT overheatTemperatureModificator; // percentage modifier of heat a shot generates (read from attachments)
FLOAT overheatCooldownModificator; // percentage modifier of cooldown amount (read from attachments, applies to guns & barrels)
FLOAT overheatJamThresholdModificator; // percentage modifier of a gun's jam threshold (read from attachments)
FLOAT overheatDamageThresholdModificator; // percentage modifier of a gun's damage threshold (read from attachments)
UINT32 attachmentclass; // attachmentclass used
BOOLEAN tripwireactivation; // item (mine) can be activated by nearby tripwire
BOOLEAN tripwire; // item is tripwire
BOOLEAN directional; // item is a directional mine/bomb (actual direction is set upon planting)
UINT32 drugtype; // this flagmask determines what different components are used in a drug, which results in different effects
BOOLEAN blockironsight; // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight)
UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 32 BOOLEAN values). If I only had thought of this earlier....
// Flugente: food type
UINT32 foodtype;
//JMich_SkillModifiers: Adding new skill modifiers
INT8 LockPickModifier;
UINT8 CrowbarModifier;
UINT8 DisarmModifier;
INT8 RepairModifier;
// Flugente: a modifier to hacking
UINT8 usHackingModifier;
// Flugente: a modifier for burial effectiveness
UINT8 usBurialModifier;
// Flugente: advanced repair/dirt system
UINT8 usDamageChance; // chance that damage to the status will also damage the repair threshold
FLOAT dirtIncreaseFactor; // one shot causes this much dirt on a gun
// Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives)
UINT32 usActionItemFlag;
// Flugente: clothes type that 'links' to an entry in Clothes.xml
UINT32 clothestype;
// Flugente: a link to RandomItemsClass.xml. Out of such an item, a random object is created, depending on the entries in the xml
UINT16 randomitem;
INT8 randomitemcoolnessmodificator; // alters the allowed maximum coolness a random item can have
// Flugente: range of a flashlight (an item with usFlashLightRange > 0 is deemed a flashlight)
UINT8 usFlashLightRange;
// Flugente: determine wether the AI should pick this item for its choices only at certain times
UINT8 usItemChoiceTimeSetting;
// Flugente: item is connected to another item. Type of connection depends on item specifics
UINT16 usBuddyItem;
// silversurfer: item provides breath regeneration bonus while resting
UINT8 ubSleepModifier;
// Flugente: spotting effectiveness
INT16 usSpotting;
//JMich.BackpackClimb
INT16 sBackpackWeightModifier; //modifier to weight calculation to climb.
BOOLEAN fAllowClimbing; //does item allow climbing while wearing it
BOOLEAN cigarette; // Flugente: this item can be smoked
UINT8 usPortionSize; // Flugente: for consumables: how much of this item is consumed at once
// Flugente: riot shields
UINT16 usRiotShieldStrength; // strength of shield
UINT16 usRiotShieldGraphic; // graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti)
// Flugente: fire resistance
INT16 sFireResistance; INT16 sFireResistance;
// Flugente: a modifier for administration effectiveness UINT8 ubAttachToPointAPCost; // cost to attach to any matching point
UINT8 usAdministrationModifier; UINT8 ubCursor;
UINT8 ubGraphicType;
UINT8 ubPerPocket;
UINT8 ubCoolness;
UINT8 percenttunnelvision;
UINT8 ubAttachmentSystem; //Item availability per attachment system: 0 = both, 1 = OAS, 2 = NAS
UINT8 CrowbarModifier;
UINT8 DisarmModifier;
UINT8 usHackingModifier;
UINT8 usBurialModifier; // Flugente: a modifier for burial effectiveness
UINT8 usDamageChance; // Flugente: advanced repair/dirt system. Chance that damage to the status will also damage the repair threshold
UINT8 usFlashLightRange; // Flugente: range of a flashlight (an item with usFlashLightRange > 0 is deemed a flashlight)
UINT8 usItemChoiceTimeSetting; // Flugente: determine wether the AI should pick this item for its choices only at certain times
UINT8 ubSleepModifier; // silversurfer: item provides breath regeneration bonus while resting
UINT8 usPortionSize; // Flugente: for consumables: how much of this item is consumed at once
UINT8 usAdministrationModifier; // Flugente: a modifier for administration effectiveness
UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed.
//But now we will make it so that these items can be replaced, but still not removed directly.
//0 = removeable (as before)
//1 = inseparable (as before)
//2 = inseparable, but replaceable
// rftr: robot attachments INT8 bSoundType;
FLOAT fRobotDamageReductionModifier; INT8 bReliability;
INT8 bRobotStrBonus; INT8 bRepairEase;
INT8 bRobotAgiBonus; INT8 LockPickModifier;
INT8 bRobotDexBonus; INT8 RepairModifier;
INT8 bRobotTargetingSkillGrant; INT8 randomitemcoolnessmodificator; // Flugente: a link to RandomItemsClass.xml. alters the allowed maximum coolness a random item can have
INT8 bRobotChassisSkillGrant; INT8 bRobotStrBonus; // rftr: robot attachments
INT8 bRobotUtilitySkillGrant; INT8 bRobotAgiBonus; // rftr: robot attachments
BOOLEAN fProvidesRobotCamo; INT8 bRobotDexBonus; // rftr: robot attachments
BOOLEAN fProvidesRobotNightVision; INT8 bRobotTargetingSkillGrant; // rftr: robot attachments
BOOLEAN fProvidesRobotLaserBonus; INT8 bRobotChassisSkillGrant; // rftr: robot attachments
//shadooow: bitflag controlling what system needs to be in play for item to appear INT8 bRobotUtilitySkillGrant; // rftr: robot attachments
UINT8 usLimitedToSystem; INT8 iTransportGroupMinProgress; // rftr: the progress bounds that allow a transport group to drop an item
INT8 iTransportGroupMaxProgress; // rftr: the progress bounds that allow a transport group to drop an item
// rftr: the progress bounds that allow a transport group to drop an item
INT8 iTransportGroupMinProgress;
INT8 iTransportGroupMaxProgress;
} INVTYPE; } INVTYPE;
+232 -168
View File
File diff suppressed because it is too large Load Diff
+72 -4
View File
@@ -179,8 +179,76 @@ BOOLEAN ValidAttachmentClass( UINT16 usAttachment, UINT16 usItem );
//Determines if it is possible to equip this weapon with this ammo. //Determines if it is possible to equip this weapon with this ammo.
BOOLEAN ValidAmmoType( UINT16 usItem, UINT16 usAmmoType ); BOOLEAN ValidAmmoType( UINT16 usItem, UINT16 usAmmoType );
//Determines if this item is a two handed item. BOOLEAN ItemIsDamageable(UINT16 usItem);
BOOLEAN TwoHandedItem( UINT16 usItem ); BOOLEAN ItemIsRepairable(UINT16 usItem);
BOOLEAN ItemIsDamagedByWater(UINT16 usItem);
BOOLEAN ItemIsMetal(UINT16 usItem);
BOOLEAN ItemSinks(UINT16 usItem);
BOOLEAN ItemIsTwoHanded(UINT16 usItem);
BOOLEAN ItemIsHiddenAddon(UINT16 usItem);
BOOLEAN ItemIsNotBuyable(UINT16 usItem);
BOOLEAN ItemIsAttachment(UINT16 usItem);
BOOLEAN ItemIsHiddenAttachment(UINT16 usItem);
BOOLEAN ItemIsOnlyInTonsOfGuns(UINT16 usItem);
BOOLEAN ItemIsNotInEditor(UINT16 usItem);
BOOLEAN ItemIsUndroppableByDefault(UINT16 usItem);
BOOLEAN ItemIsUnaerodynamic(UINT16 usItem);
BOOLEAN ItemIsElectronic(UINT16 usItem);
BOOLEAN ItemIsCannon(UINT16 usItem);
BOOLEAN ItemIsRocketRifle(UINT16 usItem);
BOOLEAN ItemHasFingerPrintID(UINT16 usItem);
BOOLEAN ItemIsMetalDetector(UINT16 usItem);
BOOLEAN ItemIsGasmask(UINT16 usItem);
BOOLEAN ItemIsLockBomb(UINT16 usItem);
BOOLEAN ItemIsFlare(UINT16 usItem);
BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem);
BOOLEAN ItemIsMortar(UINT16 usItem);
BOOLEAN ItemIsDuckbill(UINT16 usItem);
BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem);
BOOLEAN ItemIsRocketLauncher(UINT16 usItem);
BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem);
BOOLEAN ItemIsBrassKnuckles(UINT16 usItem);
BOOLEAN ItemIsCrowbar(UINT16 usItem);
BOOLEAN ItemIsGLgrenade(UINT16 usItem);
BOOLEAN ItemIsFlakJacket(UINT16 usItem);
BOOLEAN ItemIsLeatherJacket(UINT16 usItem);
BOOLEAN ItemIsBatteries(UINT16 usItem);
BOOLEAN ItemNeedsBatteries(UINT16 usItem);
BOOLEAN ItemHasXRay(UINT16 usItem);
BOOLEAN ItemIsWirecutters(UINT16 usItem);
BOOLEAN ItemIsToolkit(UINT16 usItem);
BOOLEAN ItemIsFirstAidKit(UINT16 usItem);
BOOLEAN ItemIsMedicalKit(UINT16 usItem);
BOOLEAN ItemIsCanteen(UINT16 usItem);
BOOLEAN ItemIsJar(UINT16 usItem);
BOOLEAN ItemIsCanAndString(UINT16 usItem);
BOOLEAN ItemIsMarbles(UINT16 usItem);
BOOLEAN ItemIsWalkman(UINT16 usItem);
BOOLEAN ItemIsRemoteTrigger(UINT16 usItem);
BOOLEAN ItemIsRobotRemote(UINT16 usItem);
BOOLEAN ItemIsCamoKit(UINT16 usItem);
BOOLEAN ItemIsLocksmithKit(UINT16 usItem);
BOOLEAN ItemIsMine(UINT16 usItem);
BOOLEAN ItemIsATMine(UINT16 usItem);
BOOLEAN ItemIsHardware(UINT16 usItem);
BOOLEAN ItemIsMedical(UINT16 usItem);
BOOLEAN ItemIsGascan(UINT16 usItem);
BOOLEAN ItemContainsLiquid(UINT16 usItem);
BOOLEAN ItemIsRock(UINT16 usItem);
BOOLEAN ItemIsThermalOptics(UINT16 usItem);
BOOLEAN ItemIsOnlyInScifi(UINT16 usItem);
BOOLEAN ItemIsOnlyInNIV(UINT16 usItem);
BOOLEAN ItemIsBarrel(UINT16 usItem);
BOOLEAN ItemHasTripwireActivation(UINT16 usItem);
BOOLEAN ItemIsTripwire(UINT16 usItem);
BOOLEAN ItemIsDirectional(UINT16 usItem);
BOOLEAN ItemBlocksIronsight(UINT16 usItem);
BOOLEAN ItemAllowsClimbing(UINT16 usItem);
BOOLEAN ItemIsCigarette(UINT16 usItem);
BOOLEAN ItemIsOnlyInDisease(UINT16 usItem);
BOOLEAN ItemProvidesRobotCamo(UINT16 usItem);
BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem);
BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem);
//Existing functions without header def's, added them here, just incase I'll need to call //Existing functions without header def's, added them here, just incase I'll need to call
//them from the editor. //them from the editor.
@@ -222,7 +290,6 @@ UINT8 ConvertObjectTypeMoneyValueToProfileMoneyValue( UINT32 uiMoneyAmount );
BOOLEAN CheckForChainReaction( UINT16 usItem, INT16 bStatus, INT16 bDamage, BOOLEAN fOnGround ); BOOLEAN CheckForChainReaction( UINT16 usItem, INT16 bStatus, INT16 bDamage, BOOLEAN fOnGround );
BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness = FALSE ); BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness = FALSE );
BOOLEAN ExtendedGunListGun( UINT16 usGun );
UINT16 StandardGunListReplacement( UINT16 usGun ); UINT16 StandardGunListReplacement( UINT16 usGun );
UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType); UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType);
UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun ); UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun );
@@ -497,7 +564,8 @@ UINT64 GetAvailableAttachmentPoint ( OBJECTTYPE * pObject, UINT8 subObject );
void CheckBombSpecifics( OBJECTTYPE * pObj, INT8* detonatortype, INT8* setting, INT8* defusefrequency ); void CheckBombSpecifics( OBJECTTYPE * pObj, INT8* detonatortype, INT8* setting, INT8* defusefrequency );
// Flugente: check for specific flags // Flugente: check for specific flags
BOOLEAN HasItemFlag( UINT16 usItem, UINT64 aFlag ); BOOLEAN HasItemFlag(UINT16 usItem, UINT64 aFlag);
BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag);
// Flugente: get first item number that has this flag. Use with caution, as we search in all items // Flugente: get first item number that has this flag. Use with caution, as we search in all items
BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ); BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag );
+16 -16
View File
@@ -4840,15 +4840,15 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY,
{ {
usBulletFlags |= BULLET_FLAG_KNIFE; usBulletFlags |= BULLET_FLAG_KNIFE;
} }
else if ( Item[usHandItem].rocketlauncher ) else if (ItemIsRocketLauncher(usHandItem))
{ {
usBulletFlags |= BULLET_FLAG_MISSILE; usBulletFlags |= BULLET_FLAG_MISSILE;
} }
else if ( Item[usHandItem].cannon ) else if (ItemIsCannon(usHandItem))
{ {
usBulletFlags |= BULLET_FLAG_TANK_CANNON; usBulletFlags |= BULLET_FLAG_TANK_CANNON;
} }
else if ( Item[usHandItem].rocketrifle ) else if (ItemIsRocketRifle(usHandItem))
{ {
usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; usBulletFlags |= BULLET_FLAG_SMALL_MISSILE;
} }
@@ -5237,7 +5237,7 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY,
if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) ) if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) )
{ {
// another shot fired // another shot fired
if ( Item[usHandItem].usItemClass == IC_LAUNCHER || Item[usHandItem].grenadelauncher || Item[usHandItem].rocketlauncher || Item[usHandItem].singleshotrocketlauncher || Item[usHandItem].mortar) if ( Item[usHandItem].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usHandItem) || ItemIsRocketLauncher(usHandItem) || ItemIsSingleShotRocketLauncher(usHandItem) || ItemIsMortar(usHandItem))
gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++; gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++;
else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE ) else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE )
gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++; gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++;
@@ -5335,15 +5335,15 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
{ {
usBulletFlags |= BULLET_FLAG_KNIFE; usBulletFlags |= BULLET_FLAG_KNIFE;
} }
else if ( Item[usHandItem].rocketlauncher ) else if (ItemIsRocketLauncher(usHandItem))
{ {
usBulletFlags |= BULLET_FLAG_MISSILE; usBulletFlags |= BULLET_FLAG_MISSILE;
} }
else if ( Item[usHandItem].cannon ) else if (ItemIsCannon(usHandItem))
{ {
usBulletFlags |= BULLET_FLAG_TANK_CANNON; usBulletFlags |= BULLET_FLAG_TANK_CANNON;
} }
else if ( Item[usHandItem].rocketrifle ) else if (ItemIsRocketRifle(usHandItem))
{ {
usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; usBulletFlags |= BULLET_FLAG_SMALL_MISSILE;
} }
@@ -5753,7 +5753,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA
if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) ) if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) )
{ {
// another shot fired // another shot fired
if ( Item[usHandItem].usItemClass == IC_LAUNCHER || Item[usHandItem].grenadelauncher || Item[usHandItem].rocketlauncher || Item[usHandItem].singleshotrocketlauncher || Item[usHandItem].mortar) if ( Item[usHandItem].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usHandItem) || ItemIsRocketLauncher(usHandItem) || ItemIsSingleShotRocketLauncher(usHandItem) || ItemIsMortar(usHandItem))
gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++; gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++;
else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE ) else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE )
gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++; gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++;
@@ -6007,15 +6007,15 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT
{ {
usBulletFlags |= BULLET_FLAG_KNIFE; usBulletFlags |= BULLET_FLAG_KNIFE;
} }
else if ( Item[usItem].rocketlauncher ) else if (ItemIsRocketLauncher(usItem))
{ {
usBulletFlags |= BULLET_FLAG_MISSILE; usBulletFlags |= BULLET_FLAG_MISSILE;
} }
else if ( Item[usItem].cannon ) else if (ItemIsCannon(usItem))
{ {
usBulletFlags |= BULLET_FLAG_TANK_CANNON; usBulletFlags |= BULLET_FLAG_TANK_CANNON;
} }
else if ( Item[usItem].rocketrifle ) else if (ItemIsRocketRifle(usItem))
{ {
usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; usBulletFlags |= BULLET_FLAG_SMALL_MISSILE;
} }
@@ -6594,15 +6594,15 @@ INT8 FireBulletGivenTarget_NoObjectNoSoldier( UINT16 usItem, UINT8 ammotype, UIN
{ {
usBulletFlags |= BULLET_FLAG_KNIFE; usBulletFlags |= BULLET_FLAG_KNIFE;
} }
else if ( Item[usItem].rocketlauncher ) else if (ItemIsRocketLauncher(usItem))
{ {
usBulletFlags |= BULLET_FLAG_MISSILE; usBulletFlags |= BULLET_FLAG_MISSILE;
} }
else if ( Item[usItem].cannon ) else if (ItemIsCannon(usItem))
{ {
usBulletFlags |= BULLET_FLAG_TANK_CANNON; usBulletFlags |= BULLET_FLAG_TANK_CANNON;
} }
else if ( Item[usItem].rocketrifle ) else if (ItemIsRocketRifle(usItem))
{ {
usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; usBulletFlags |= BULLET_FLAG_SMALL_MISSILE;
} }
@@ -6923,7 +6923,7 @@ INT8 ChanceToGetThrough(SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dE
// sevenfm: check that weapon exists! // sevenfm: check that weapon exists!
if (pObjHand->exists() && if (pObjHand->exists() &&
pObjHand->usItem == pFirer->usAttackingWeapon && pObjHand->usItem == pFirer->usAttackingWeapon &&
(Item[pFirer->usAttackingWeapon].usItemClass == IC_GUN || Item[pFirer->usAttackingWeapon].usItemClass == IC_THROWING_KNIFE || Item[pFirer->usAttackingWeapon].rocketlauncher)) (Item[pFirer->usAttackingWeapon].usItemClass == IC_GUN || Item[pFirer->usAttackingWeapon].usItemClass == IC_THROWING_KNIFE || ItemIsRocketLauncher(pFirer->usAttackingWeapon)))
{ {
BOOLEAN fBuckShot = FALSE; BOOLEAN fBuckShot = FALSE;
@@ -8643,7 +8643,7 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT
//INT32 iLaserRange = GetBestLaserRange(&(pShooter->inv[pSoldier->ubAttackingHand])); //INT32 iLaserRange = GetBestLaserRange(&(pShooter->inv[pSoldier->ubAttackingHand]));
INT16 sLaserRange = GetBestLaserRange(pWeapon); INT16 sLaserRange = GetBestLaserRange(pWeapon);
if (AM_A_ROBOT(pShooter) && Item[pShooter->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) if (AM_A_ROBOT(pShooter) && ItemProvidesRobotLaserBonus(pShooter->inv[ROBOT_TARGETING_SLOT].usItem))
{ {
sLaserRange = max(sLaserRange, GetBestLaserRange(&pShooter->inv[ROBOT_TARGETING_SLOT])); sLaserRange = max(sLaserRange, GetBestLaserRange(&pShooter->inv[ROBOT_TARGETING_SLOT]));
} }
@@ -24,14 +24,15 @@ AbstractXMLLoader::ParseData* AbstractXMLLoader::MakeParseData(XML_Parser* parse
return new ParseData(parser); return new ParseData(parser);
} }
bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* fileName) { bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* fileName, CHAR8* errorBuf) {
HWFILE hFile; HWFILE hFile;
UINT32 uiBytesRead; UINT32 uiBytesRead;
UINT32 uiFSize; UINT32 uiFSize;
CHAR8* lpcBuffer; CHAR8* lpcBuffer;
char fileNameFull[MAX_PATH + 1]; char fileNameFull[MAX_PATH + 1];
if (strlen(fileName) + strlen(directoryName) >= MAX_PATH) { if (strlen(fileName) + strlen(directoryName) >= MAX_PATH) {
LiveMessage("Can't load file. Concatinated filename too long for buffer!"); sprintf(errorBuf, "Can't load file %s%s, Concatenated filename too long for buffer!", directoryName, fileName);
LiveMessage(errorBuf);
return false; return false;
} }
SetDirectoryName(directoryName); SetDirectoryName(directoryName);
@@ -46,12 +47,14 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, msg.c_str()); DebugMsg(TOPIC_JA2, DBG_LEVEL_3, msg.c_str());
hFile = FileOpen(fileNameFull, FILE_ACCESS_READ, FALSE); hFile = FileOpen(fileNameFull, FILE_ACCESS_READ, FALSE);
if (!hFile) { if (!hFile) {
sprintf(errorBuf, "Can't open %s", fileNameFull);
delete data; delete data;
return false; return false;
} }
uiFSize = FileGetSize(hFile); uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8*)MemAlloc(uiFSize + 1); lpcBuffer = (CHAR8*)MemAlloc(uiFSize + 1);
if (!FileRead(hFile, lpcBuffer, uiFSize, &uiBytesRead)) { if (!FileRead(hFile, lpcBuffer, uiFSize, &uiBytesRead)) {
sprintf(errorBuf, "Error reading %s to buffer", fileNameFull);
MemFree(lpcBuffer); MemFree(lpcBuffer);
delete data; delete data;
return false; return false;
@@ -72,7 +75,6 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file
try { try {
if (!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { if (!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) {
CHAR8 errorBuf[512];
sprintf(errorBuf, "XML Parser Error in %s[%d]: %s", fileNameFull, XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser))); sprintf(errorBuf, "XML Parser Error in %s[%d]: %s", fileNameFull, XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser)));
LiveMessage(errorBuf); LiveMessage(errorBuf);
MemFree(lpcBuffer); MemFree(lpcBuffer);
@@ -80,7 +82,6 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file
return false; return false;
} }
} catch (XMLParseException e) { } catch (XMLParseException e) {
CHAR8 errorBuf[512];
sprintf(errorBuf, "XML Parser Exception in %s[%d]: %s", fileNameFull, e._LINE, e.what()); sprintf(errorBuf, "XML Parser Exception in %s[%d]: %s", fileNameFull, e._LINE, e.what());
LiveMessage(errorBuf); LiveMessage(errorBuf);
MemFree(lpcBuffer); MemFree(lpcBuffer);
@@ -55,7 +55,7 @@ private:
public: public:
AbstractXMLLoader(XML_StartElementHandler startHandler, XML_EndElementHandler endHandler, XML_CharacterDataHandler charHandler, ParseDataFactoryFunc parseDataFactF = MakeParseData); AbstractXMLLoader(XML_StartElementHandler startHandler, XML_EndElementHandler endHandler, XML_CharacterDataHandler charHandler, ParseDataFactoryFunc parseDataFactF = MakeParseData);
~AbstractXMLLoader(void); ~AbstractXMLLoader(void);
bool LoadFromFile(const char* directoryName, const char* fileName); bool LoadFromFile(const char* directoryName, const char* fileName, CHAR8* errorBuf);
const char* GetFileName(); const char* GetFileName();
const char* GetDirectoryName(); const char* GetDirectoryName();
void SetFileName(const char* fileName); void SetFileName(const char* fileName);
+14 -2
View File
@@ -214,10 +214,10 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) {
cmp_val = Weapon[pSoldier->inv[HANDPOS].usItem].ubCalibre; cmp_val = Weapon[pSoldier->inv[HANDPOS].usItem].ubCalibre;
break; break;
case REQ_WEAPON_TWOHANDED: case REQ_WEAPON_TWOHANDED:
cmp_val = TwoHandedItem(pSoldier->inv[HANDPOS].usItem); cmp_val = ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem);
break; break;
case REQ_LEFT_WEAPON_TWOHANDED: case REQ_LEFT_WEAPON_TWOHANDED:
cmp_val = TwoHandedItem(pSoldier->inv[SECONDHANDPOS].usItem); cmp_val = ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem);
break; break;
case REQ_VEST_AMOR_PROTECTION: case REQ_VEST_AMOR_PROTECTION:
cmp_val = Armour[Item[pSoldier->inv[VESTPOS].usItem].ubClassIndex].ubProtection; cmp_val = Armour[Item[pSoldier->inv[VESTPOS].usItem].ubClassIndex].ubProtection;
@@ -258,6 +258,18 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) {
case REQ_LEGPOSATTACHMENT3: case REQ_LEGPOSATTACHMENT3:
cmp_val = CompareAttachment(pSoldier, LEGPOS, 3); cmp_val = CompareAttachment(pSoldier, LEGPOS, 3);
break; break;
case REQ_VESTPOSATTACHMENT0:
cmp_val = CompareAttachment( pSoldier, VESTPOS, 0 );
break;
case REQ_VESTPOSATTACHMENT1:
cmp_val = CompareAttachment( pSoldier, VESTPOS, 1 );
break;
case REQ_VESTPOSATTACHMENT2:
cmp_val = CompareAttachment( pSoldier, VESTPOS, 2 );
break;
case REQ_VESTPOSATTACHMENT3:
cmp_val = CompareAttachment( pSoldier, VESTPOS, 3 );
break;
default: default:
if (q < NUM_REQTYPESINV) { if (q < NUM_REQTYPESINV) {
cmp_val = pSoldier->inv[q].usItem; cmp_val = pSoldier->inv[q].usItem;
+4
View File
@@ -75,6 +75,10 @@ public:
REQ_LEGPOSATTACHMENT1, REQ_LEGPOSATTACHMENT1,
REQ_LEGPOSATTACHMENT2, REQ_LEGPOSATTACHMENT2,
REQ_LEGPOSATTACHMENT3, REQ_LEGPOSATTACHMENT3,
REQ_VESTPOSATTACHMENT0,
REQ_VESTPOSATTACHMENT1,
REQ_VESTPOSATTACHMENT2,
REQ_VESTPOSATTACHMENT3,
NUM_REQTYPES, NUM_REQTYPES,
// 3rd byte is for operator flags // 3rd byte is for operator flags
_REQ_BTWN = 0x20000, _REQ_BTWN = 0x20000,
+6 -2
View File
@@ -270,7 +270,7 @@ namespace LogicalBodyTypes {
/***************************************** /*****************************************
Filter enum criterion types Filter enum criterion types
******************************************/ ******************************************/
LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 43, LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 47,
Filter::REQ_HELMETPOS, Filter::REQ_HELMETPOS,
Filter::REQ_VESTPOS, Filter::REQ_VESTPOS,
Filter::REQ_LEGPOS, Filter::REQ_LEGPOS,
@@ -313,7 +313,11 @@ namespace LogicalBodyTypes {
Filter::REQ_LEGPOSATTACHMENT0, Filter::REQ_LEGPOSATTACHMENT0,
Filter::REQ_LEGPOSATTACHMENT1, Filter::REQ_LEGPOSATTACHMENT1,
Filter::REQ_LEGPOSATTACHMENT2, Filter::REQ_LEGPOSATTACHMENT2,
Filter::REQ_LEGPOSATTACHMENT3 Filter::REQ_LEGPOSATTACHMENT3,
Filter::REQ_VESTPOSATTACHMENT0,
Filter::REQ_VESTPOSATTACHMENT1,
Filter::REQ_VESTPOSATTACHMENT2,
Filter::REQ_VESTPOSATTACHMENT3
); );
/***************************************** /*****************************************
+1 -1
View File
@@ -991,7 +991,7 @@ void HandleFirstHeliDropOfGame( )
SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE );
// Start music // Start music
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
#ifdef NEWMUSIC #ifdef NEWMUSIC
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
+24 -19
View File
@@ -5081,8 +5081,14 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe
INT16 sDesiredLevel; INT16 sDesiredLevel;
BOOLEAN fOKCheckStruct; BOOLEAN fOKCheckStruct;
// sevenfm: allow civilians and NPCs with profile to go off screen // Allow civilians and NPCs with profile to go off screen, and also enemies if tactical retreat is enabled
if (!GridNoOnVisibleWorldTile(sGridNo) && (pCurrSoldier->bTeam != CIV_TEAM || pCurrSoldier->ubProfile == NO_PROFILE)) auto destinationOffscreen = !(GridNoOnVisibleWorldTile(sGridNo));
auto hasProfile = pCurrSoldier->ubProfile != NO_PROFILE;
auto isCivilian = pCurrSoldier->bTeam == CIV_TEAM;
auto isEnemy = pCurrSoldier->bTeam == ENEMY_TEAM;
auto retreatAllowed = gGameExternalOptions.fAITacticalRetreat == true;
if (destinationOffscreen && !(isCivilian || hasProfile || (isEnemy && retreatAllowed)))
{ {
return(FALSE); return(FALSE);
} }
@@ -6658,7 +6664,7 @@ void ExitCombatMode( )
// unused // unused
//gfForceMusicToTense = TRUE; //gfForceMusicToTense = TRUE;
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
#ifdef NEWMUSIC #ifdef NEWMUSIC
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
@@ -6700,17 +6706,17 @@ void ExitCombatMode( )
} }
void SetEnemyPresence( ) void SetEnemyPresence()
{ {
// We have an ememy present.... // We have an ememy present....
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence")); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence" ) );
// Check if we previously had no enemys present and we are in a virgin secotr ( no enemys spotted yet ) // Check if we previously had no enemys present and we are in a virgin secotr ( no enemys spotted yet )
if ( !gTacticalStatus.fEnemyInSector && gTacticalStatus.fVirginSector ) if ( !gTacticalStatus.fEnemyInSector && gTacticalStatus.fVirginSector )
{ {
// If we have a guy selected, say quote! // If we have a guy selected, say quote!
// For now, display ono status message // For now, display ono status message
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ENEMY_IN_SECTOR_STR ] ); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ENEMY_IN_SECTOR_STR] );
// Change music modes.. // Change music modes..
@@ -6720,22 +6726,21 @@ void SetEnemyPresence( )
//Ja25: no meanwhiles //Ja25: no meanwhiles
if ( !DidGameJustStart() ) if ( !DidGameJustStart() )
#else #else
if ( !DidGameJustStart() && !AreInMeanwhile( ) ) if ( !DidGameJustStart() && !AreInMeanwhile() )
#endif #endif
{ {
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
#ifdef NEWMUSIC #ifdef NEWMUSIC
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; GlobalSoundID = MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ];
if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 ) if ( MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ] != -1 )
SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] ); SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ] );
else else
#endif #endif
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false")); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence: warnings = false" ) );
sniperwarning = FALSE; sniperwarning = FALSE;
biggunwarning = FALSE; biggunwarning = FALSE;
gogglewarning = FALSE; gogglewarning = FALSE;
@@ -6744,7 +6749,7 @@ void SetEnemyPresence( )
} }
else else
{ {
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = true")); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence: warnings = true" ) );
sniperwarning = TRUE; sniperwarning = TRUE;
biggunwarning = TRUE; biggunwarning = TRUE;
//gogglewarning = TRUE; //gogglewarning = TRUE;
@@ -7072,7 +7077,7 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen )
// Begin tense music.... // Begin tense music....
// unused // unused
//gfForceMusicToTense = TRUE; //gfForceMusicToTense = TRUE;
UseCreatureMusic(HostileZombiesPresent()); CheckForZombieMusic();
#ifdef NEWMUSIC #ifdef NEWMUSIC
GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ];
@@ -7281,7 +7286,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
// Check if it's supposed to be dropped // Check if it's supposed to be dropped
if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) || pTeamSoldier->bTeam == gbPlayerNum ) if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) || pTeamSoldier->bTeam == gbPlayerNum )
{ {
if ( !(Item[pObj->usItem].defaultundroppable) ) if ( !ItemIsUndroppableByDefault(pObj->usItem) )
{ {
//ReduceAmmoDroppedByNonPlayerSoldiers( pTeamSoldier, cnt ); //ReduceAmmoDroppedByNonPlayerSoldiers( pTeamSoldier, cnt );
@@ -7295,7 +7300,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ )
//add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items
usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY;
if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives if (ItemIsDamageable(pObj->usItem) && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives
{ {
// silversurfer: externalized this // silversurfer: externalized this
//(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random( 20 ); //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random( 20 );
@@ -9314,7 +9319,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp
if ( gTacticalStatus.bBoxingState == BOXING ) if ( gTacticalStatus.bBoxingState == BOXING )
{ {
// should have a check for "in boxing ring", no? // should have a check for "in boxing ring", no?
if ( ( pSoldier->usAttackingWeapon != NOTHING && !Item[pSoldier->usAttackingWeapon].brassknuckles ) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) || pSoldier->IsRiotShieldEquipped() ) if ( ( pSoldier->usAttackingWeapon != NOTHING && !ItemIsBrassKnuckles(pSoldier->usAttackingWeapon)) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) || pSoldier->IsRiotShieldEquipped() )
{ {
// someone's cheating! // someone's cheating!
if ( (Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_BLADE || Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_PUNCH) && (pTarget->flags.uiStatusFlags & SOLDIER_BOXER) ) if ( (Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_BLADE || Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_PUNCH) && (pTarget->flags.uiStatusFlags & SOLDIER_BOXER) )
@@ -9915,7 +9920,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( )
pSoldier->bDoAutofire = 1; pSoldier->bDoAutofire = 1;
pSoldier->bDoBurst = TRUE; pSoldier->bDoBurst = TRUE;
} }
if ( Item[pSoldier->inv[ HANDPOS ].usItem].twohanded && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 )
pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD;
else else
pSoldier->bScopeMode = USE_BEST_SCOPE; pSoldier->bScopeMode = USE_BEST_SCOPE;
+17 -17
View File
@@ -461,7 +461,7 @@ static auto canJumpFences(SOLDIERTYPE* pSoldier) -> bool {
//ADB the extra cover feature is supposed to pick a path of the same distance as one calculated with the feature off, //ADB the extra cover feature is supposed to pick a path of the same distance as one calculated with the feature off,
//but a safer path, usually farther away from an enemy or following behind some cover. //but a safer path, usually farther away from an enemy or following behind some cover.
//however it has not been tested and it may need some work, I haven't touched it in a while //however it has not been tested and it may need some work, I haven't touched it in a while
//#define ASTAR_USING_EXTRACOVER #define ASTAR_USING_EXTRACOVER
using namespace std; using namespace std;
using namespace ASTAR; using namespace ASTAR;
@@ -1164,7 +1164,7 @@ void AStarPathfinder::ExecuteAStarLogic()
#ifdef ASTAR_USING_EXTRACOVER #ifdef ASTAR_USING_EXTRACOVER
//check if we will run out of AP while entering this node or before //check if we will run out of AP while entering this node or before
//if we run out, the merc will stop at the parent node for a turn and be vulnerable //if we run out, the merc will stop at the parent node for a turn and be vulnerable
if (mercsMaxAPs && APCost > mercsMaxAPs) if (gfTurnBasedAI && mercsMaxAPs && AStarG > mercsMaxAPs)
{ {
extraGCoverCost = GetExtraGCover(ParentNode); extraGCoverCost = GetExtraGCover(ParentNode);
@@ -1174,7 +1174,7 @@ void AStarPathfinder::ExecuteAStarLogic()
//use the stance and cover to see how much we really want to stop at the parent node //use the stance and cover to see how much we really want to stop at the parent node
//as opposed to an equal path with different cover //as opposed to an equal path with different cover
//because other nodes further on the path will stop here too, add this value to the F cost //because other nodes further on the path will stop here too, add this value to the F cost
extraGCoverCost = CalcGCover(ParentNodeIndex, APCost); extraGCoverCost = CalcGCover(ParentNode, AStarG);
//remember, we have run out of points to *enter* this node, so we are stuck at the *parent* node //remember, we have run out of points to *enter* this node, so we are stuck at the *parent* node
//cache the cost to stay at the parent node //cache the cost to stay at the parent node
@@ -1512,7 +1512,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
INT32 iMyThreatValue; INT32 iMyThreatValue;
INT16 sThreatLoc; INT16 sThreatLoc;
UINT32 uiThreatCnt = 0; UINT32 uiThreatCnt = 0;
INT16 * pusLastLoc; INT32* pusLastLoc;
INT8 * pbPersOL; INT8 * pbPersOL;
INT8 * pbPublOL; INT8 * pbPublOL;
@@ -1523,7 +1523,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
pusLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]); pusLastLoc = &(gsLastKnownOppLoc[pSoldier->ubID][0]);
// hang a pointer into personal opplist // hang a pointer into personal opplist
pbPersOL = &(pSoldier->bOppList[0]); pbPersOL = &(pSoldier->aiData.bOppList[0]);
// hang a pointer into public opplist // hang a pointer into public opplist
pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]); pbPublOL = &(gbPublicOpplist[pSoldier->bTeam][0]);
@@ -1535,7 +1535,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
SOLDIERTYPE* pOpponent = MercSlots[ uiLoop ]; SOLDIERTYPE* pOpponent = MercSlots[ uiLoop ];
// if this merc is inactive, at base, on assignment, dead, unconscious // if this merc is inactive, at base, on assignment, dead, unconscious
if (!pOpponent || pOpponent->bLife < OKLIFE) { if (!pOpponent || pOpponent->stats.bLife < OKLIFE) {
continue; // next merc continue; // next merc
} }
@@ -1544,7 +1544,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
continue; // next merc continue; // next merc
} }
pbPersOL = pSoldier->bOppList + pOpponent->ubID; pbPersOL = pSoldier->aiData.bOppList + pOpponent->ubID;
pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID; pbPublOL = gbPublicOpplist[pSoldier->bTeam] + pOpponent->ubID;
pusLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpponent->ubID; pusLastLoc = gsLastKnownOppLoc[pSoldier->ubID] + pOpponent->ubID;
@@ -1554,7 +1554,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
} }
// Special stuff for Carmen the bounty hunter // Special stuff for Carmen the bounty hunter
if (pSoldier->bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) { if (pSoldier->aiData.bAttitude == ATTACKSLAYONLY && pOpponent->ubProfile != 64) {
continue; // next opponent continue; // next opponent
} }
@@ -1599,7 +1599,7 @@ int AStarPathfinder::CalcGCover(int const NodeIndex,
Threats[uiThreatCnt].iOrigRange = iThreatRange; Threats[uiThreatCnt].iOrigRange = iThreatRange;
// calculate how many APs he will have at the start of the next turn // calculate how many APs he will have at the start of the next turn
Threats[uiThreatCnt].iAPs = CalcActionPoints(pOpponent); Threats[uiThreatCnt].iAPs = pOpponent->CalcActionPoints();
if (iThreatRange < iClosestThreatRange) { if (iThreatRange < iClosestThreatRange) {
iClosestThreatRange = iThreatRange; iClosestThreatRange = iThreatRange;
@@ -1641,7 +1641,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
INT32 myThreatsiValue, INT32 myThreatsiAPs, INT32 myThreatsiCertainty) INT32 myThreatsiValue, INT32 myThreatsiAPs, INT32 myThreatsiCertainty)
{ {
SOLDIERTYPE* pMe = this->pSoldier; SOLDIERTYPE* pMe = this->pSoldier;
INT32 morale = pSoldier->bAIMorale; INT32 morale = pSoldier->aiData.bAIMorale;
INT32 iRange = myThreatsiOrigRange; INT32 iRange = myThreatsiOrigRange;
// all 32-bit integers for max. speed // all 32-bit integers for max. speed
@@ -1690,7 +1690,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
else else
{ {
// optimistically assume we'll be behind the best cover available at this spot // optimistically assume we'll be behind the best cover available at this spot
bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft ); bHisActualCTGT = CalcWorstCTGTForPosition( pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft );
} }
// normally, that will be the cover I'll use, unless worst case over-rides it // normally, that will be the cover I'll use, unless worst case over-rides it
@@ -1709,7 +1709,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
} }
// calculate where my cover is worst if opponent moves just 1 tile over // calculate where my cover is worst if opponent moves just 1 tile over
bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->bLevel, iMyAPsLeft); bHisBestCTGT = CalcBestCTGT(pHim, pMe->ubID, sMyGridNo, pMe->pathing.bLevel, iMyAPsLeft);
// if he can actually improve his CTGT by moving to a nearby gridno // if he can actually improve his CTGT by moving to a nearby gridno
if (bHisBestCTGT > bHisActualCTGT) if (bHisBestCTGT > bHisActualCTGT)
@@ -1738,7 +1738,7 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
// let's not assume anything about the stance the enemy might take, so take an average // let's not assume anything about the stance the enemy might take, so take an average
// value... no cover give a higher value than partial cover // value... no cover give a higher value than partial cover
bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->bLevel, iMyAPsLeft ); bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->pathing.bLevel, iMyAPsLeft );
// since NPCs are too dumb to shoot "blind", ie. at opponents that they // since NPCs are too dumb to shoot "blind", ie. at opponents that they
// themselves can't see (mercs can, using another as a spotter!), if the // themselves can't see (mercs can, using another as a spotter!), if the
@@ -1768,14 +1768,14 @@ int AStarPathfinder::CalcCoverValue(INT32 sMyGridNo, INT32 iMyThreat, INT32 iMyA
// try to account for who outnumbers who: the side with the advantage thus // try to account for who outnumbers who: the side with the advantage thus
// (hopefully) values offense more, while those in trouble will play defense // (hopefully) values offense more, while those in trouble will play defense
if (pHim->bOppCnt > 1) if (pHim->aiData.bOppCnt > 1)
{ {
HisPosValue /= pHim->bOppCnt; HisPosValue /= pHim->aiData.bOppCnt;
} }
if (pMe->bOppCnt > 1) if (pMe->aiData.bOppCnt > 1)
{ {
MyPosValue /= pMe->bOppCnt; MyPosValue /= pMe->aiData.bOppCnt;
} }
+18 -18
View File
@@ -2375,9 +2375,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
// Do we need to stand up? // Do we need to stand up?
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
} }
else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too else if(ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem))//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too
{ {
if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND)
bAPCost += GetAPsToChangeStance(pSoldier, ANIM_CROUCH); bAPCost += GetAPsToChangeStance(pSoldier, ANIM_CROUCH);
else else
bAPCost += GetAPsToChangeStance(pSoldier, gAnimControl[pSoldier->usAnimState].ubEndHeight); bAPCost += GetAPsToChangeStance(pSoldier, gAnimControl[pSoldier->usAnimState].ubEndHeight);
@@ -2393,9 +2393,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
if (!TileIsOutOfBounds(sGridNo)) if (!TileIsOutOfBounds(sGridNo))
{ {
{ {
if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 if(ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem))//dnl ch72 260913
{ {
if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND)
usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost, ANIM_CROUCH); usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost, ANIM_CROUCH);
else else
usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost); usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost);
@@ -2429,7 +2429,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
// if attacking a new target (or if the specific target is uncertain) // if attacking a new target (or if the specific target is uncertain)
// Added check if the weapon is throwing knife/melee weapons - otherwise it would add APs for change target on cursor but not actually deduct them afterwards - SANDRO // Added check if the weapon is throwing knife/melee weapons - otherwise it would add APs for change target on cursor but not actually deduct them afterwards - SANDRO
if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !Item[usUBItem].rocketlauncher && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913 if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !ItemIsRocketLauncher(usUBItem) && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913
{ {
if ( pSoldier->IsValidAlternativeFireMode( bAimTime, sGridNo ) ) if ( pSoldier->IsValidAlternativeFireMode( bAimTime, sGridNo ) )
bAPCost += (APBPConstants[AP_CHANGE_TARGET] / 2); bAPCost += (APBPConstants[AP_CHANGE_TARGET] / 2);
@@ -2635,13 +2635,13 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( &(pSoldier->inv[bInvPos]) ); OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( &(pSoldier->inv[bInvPos]) );
UINT16 usItemUsed = pSoldier->GetUsedWeaponNumber( &(pSoldier->inv[bInvPos]) ); UINT16 usItemUsed = pSoldier->GetUsedWeaponNumber( &(pSoldier->inv[bInvPos]) );
if ( Item[usItemUsed].singleshotrocketlauncher ) if (ItemIsSingleShotRocketLauncher(usItemUsed))
{ {
// hack... they turn empty afterwards anyways // hack... they turn empty afterwards anyways
return( TRUE ); return( TRUE );
} }
if (Item[ usItemUsed ].usItemClass == IC_LAUNCHER || Item[usItemUsed].cannon ) if (Item[ usItemUsed ].usItemClass == IC_LAUNCHER || ItemIsCannon(usItemUsed))
{ {
if ( FindAttachmentByClass( pObjUsed, IC_GRENADE ) != 0 ) if ( FindAttachmentByClass( pObjUsed, IC_GRENADE ) != 0 )
{ {
@@ -2661,7 +2661,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos )
} }
// WANNE: If there is a tank, it always have ammo to shoot, no check! // WANNE: If there is a tank, it always have ammo to shoot, no check!
if (Item[usItemUsed].cannon) if (ItemIsCannon(usItemUsed))
{ {
return ( TRUE ); return ( TRUE );
} }
@@ -2715,13 +2715,13 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE* pObj )
{ {
// tanks never run out of MG ammo! // tanks never run out of MG ammo!
// unlimited cannon ammo is handled in AI // unlimited cannon ammo is handled in AI
if ( (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && !Item[pObj->usItem].cannon ) if ( (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && !ItemIsCannon(pObj->usItem) )
return; return;
if ( Item[pObj->usItem].cannon ) if (ItemIsCannon(pObj->usItem))
{ {
} }
else if ( Item[ pObj->usItem ].usItemClass == IC_GUN && !Item[pObj->usItem].cannon && pSoldier->bWeaponMode != WM_ATTACHED_GL && pSoldier->bWeaponMode != WM_ATTACHED_GL_BURST && pSoldier->bWeaponMode != WM_ATTACHED_GL_AUTO ) else if ( Item[ pObj->usItem ].usItemClass == IC_GUN && !ItemIsCannon(pObj->usItem) && pSoldier->bWeaponMode != WM_ATTACHED_GL && pSoldier->bWeaponMode != WM_ATTACHED_GL_BURST && pSoldier->bWeaponMode != WM_ATTACHED_GL_AUTO )
{ {
// Flugente: check for underbarrel weapons and use that object if necessary // Flugente: check for underbarrel weapons and use that object if necessary
OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( pObj ); OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( pObj );
@@ -2754,7 +2754,7 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE* pObj )
gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_AMMO, (FLOAT)(Item[(*pObjUsed)[0]->data.gun.usGunAmmoItem].ubWeight) / (FLOAT)(Magazine[ Item[ (*pObjUsed)[0]->data.gun.usGunAmmoItem ].ubClassIndex ].ubMagSize ) ); gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_AMMO, (FLOAT)(Item[(*pObjUsed)[0]->data.gun.usGunAmmoItem].ubWeight) / (FLOAT)(Magazine[ Item[ (*pObjUsed)[0]->data.gun.usGunAmmoItem ].ubClassIndex ].ubMagSize ) );
} }
} }
else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[pObj->usItem].cannon || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(pObj->usItem) || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )
{ {
OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE );
if ( !pAttachment->exists() ) if ( !pAttachment->exists() )
@@ -3325,7 +3325,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState )
// If we are told to go to the alt weapon holding mode // If we are told to go to the alt weapon holding mode
if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) || (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && usAnimState == INVALID_ANIMATION) )//dnl ch71 180913 if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) || (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && usAnimState == INVALID_ANIMATION) )//dnl ch71 180913
{ {
if ( Item[ usItem ].twohanded ) if (ItemIsTwoHanded(usItem))
{ {
// Raising only to hip, either charge no APs or a portion of them // Raising only to hip, either charge no APs or a portion of them
ubReadyAPs = ((ubReadyAPs * gGameExternalOptions.ubToAltWeaponHoldReadyAPsPerc) + 99) / 100 ; // round up for rifles ubReadyAPs = ((ubReadyAPs * gGameExternalOptions.ubToAltWeaponHoldReadyAPsPerc) + 99) / 100 ; // round up for rifles
@@ -3339,7 +3339,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState )
// If we are told to go from alternative to standard weapon holding // If we are told to go from alternative to standard weapon holding
else if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) ) else if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) )
{ {
if ( Item[ usItem ].twohanded ) if (ItemIsTwoHanded(usItem))
{ {
ubReadyAPs = ubReadyAPs * gGameExternalOptions.ubFromAltWeaponHoldReadyAPsPerc / 100; // round down for rifles ubReadyAPs = ubReadyAPs * gGameExternalOptions.ubFromAltWeaponHoldReadyAPsPerc / 100; // round down for rifles
} }
@@ -3703,7 +3703,7 @@ UINT16 GetTotalAPsToDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo )
if ( sAPs > 0 ) if ( sAPs > 0 )
{ {
if(Item[pSoldier->inv[HANDPOS].usItem].mine == 1) if(ItemIsMine(pSoldier->inv[HANDPOS].usItem))
sAPs += GetAPsToPlantMine( pSoldier ); // changed by SANDRO sAPs += GetAPsToPlantMine( pSoldier ); // changed by SANDRO
else else
sAPs += GetAPsToDropBomb( pSoldier ); // changed by SANDRO sAPs += GetAPsToDropBomb( pSoldier ); // changed by SANDRO
@@ -4154,7 +4154,7 @@ INT32 GetBPCostPer10APsForGunHolding( SOLDIERTYPE * pSoldier, BOOLEAN fEstimate
// Alternative weapon holding? // Alternative weapon holding?
if (( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) || (fEstimate && pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD) ) if (( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) || (fEstimate && pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD) )
{ {
if ( Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) // firing from hip is not nearly ?n effort if (ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem)) // firing from hip is not nearly ?n effort
dModifier += 80; // only 20% cost if on hip dModifier += 80; // only 20% cost if on hip
else // holding pistol in one hand is worse in this case else // holding pistol in one hand is worse in this case
dModifier -= 25; // increased cost by 25% dModifier -= 25; // increased cost by 25%
@@ -4265,7 +4265,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier )
iKickPower = iKickPower * (100 - sWeaponWeight) / 100; iKickPower = iKickPower * (100 - sWeaponWeight) / 100;
// If one-handed gun, reduce it a bit, since the whole thing is somewhat different. // If one-handed gun, reduce it a bit, since the whole thing is somewhat different.
if ( !Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) if ( !ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem) )
iKickPower = iKickPower * 3 / 4; // -25% iKickPower = iKickPower * 3 / 4; // -25%
// ::: overview ::: // ::: overview :::
@@ -4310,7 +4310,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier )
// Alternative weapon holding? // Alternative weapon holding?
if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING )
{ {
if ( Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) // firing from hip makes the kicking rather diminishing if (ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem)) // firing from hip makes the kicking rather diminishing
dModifier += 80; // only 20% of the regular kick power dModifier += 80; // only 20% of the regular kick power
else // holding pistol in one hand is worse in this case else // holding pistol in one hand is worse in this case
dModifier -= 33; // plus 33% power dModifier -= 33; // plus 33% power
+4 -3
View File
@@ -460,7 +460,7 @@ INVTYPE* GearGetRandomFaceItem(INT8 min_coolness = -1, INT8 max_coolness = -1, U
if (HasItemFlag((*it)->uiIndex, SCUBA_MASK)) if (HasItemFlag((*it)->uiIndex, SCUBA_MASK))
continue; continue;
if (item_type == FACEITEM_GAS_MASK && (*it)->gasmask < 1) continue; if (item_type == FACEITEM_GAS_MASK && !ItemIsGasmask((*it)->uiIndex)) continue;
if (item_type == FACEITEM_SPECTACLES && (*it)->brightlightvisionrangebonus < 1) continue; if (item_type == FACEITEM_SPECTACLES && (*it)->brightlightvisionrangebonus < 1) continue;
if (item_type == FACEITEM_NVG && (*it)->nightvisionrangebonus < 1) continue; if (item_type == FACEITEM_NVG && (*it)->nightvisionrangebonus < 1) continue;
if (item_type == FACEITEM_HEADSET && (*it)->hearingrangebonus < 1) continue; if (item_type == FACEITEM_HEADSET && (*it)->hearingrangebonus < 1) continue;
@@ -643,7 +643,8 @@ std::vector<INVTYPE*> GearFindAttachmentsForWeapon(INVTYPE* weapon, BOOL attach_
{ {
INVTYPE* item = *it; INVTYPE* item = *it;
if (item->attachment < 1) //if (item->attachment < 1)
if (!ItemIsAttachment(item->uiIndex))
continue; continue;
if (!ValidAttachment(item->uiIndex, weapon->uiIndex)) if (!ValidAttachment(item->uiIndex, weapon->uiIndex))
@@ -680,7 +681,7 @@ std::vector<INVTYPE*> GearFindItemsForRole(std::vector<UINT8>* roles, std::vecto
INVTYPE* item = *it; INVTYPE* item = *it;
INT8 chance = 0; INT8 chance = 0;
if (item->glgrenade > 0) if (ItemIsGLgrenade(item->uiIndex))
continue; continue;
if (item->attachmentclass == AC_GRENADE || item->attachmentclass == AC_ROCKET) if (item->attachmentclass == AC_GRENADE || item->attachmentclass == AC_ROCKET)
+25 -2
View File
@@ -1014,7 +1014,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
{ {
// and make sure that it really is a droppable item type // and make sure that it really is a droppable item type
// if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) // if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) )
if ( !(Item[ pObj->usItem ].defaultundroppable ) ) if ( !ItemIsUndroppableByDefault(pObj->usItem) )
{ {
ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt );
//if this soldier was an enemy //if this soldier was an enemy
@@ -1027,7 +1027,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE
//add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items
usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY;
if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives if (ItemIsDamageable(pObj->usItem) && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives
{ {
// silversurfer: externalized this // silversurfer: externalized this
//(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20);
@@ -3259,3 +3259,26 @@ FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse )
return (FLOAT)(min(gGameExternalOptions.usCorpseDelayUntilRotting, GetWorldTotalMin() - pCorpse->def.uiTimeOfDeath)) / gGameExternalOptions.usCorpseDelayUntilRotting; return (FLOAT)(min(gGameExternalOptions.usCorpseDelayUntilRotting, GetWorldTotalMin() - pCorpse->def.uiTimeOfDeath)) / gGameExternalOptions.usCorpseDelayUntilRotting;
} }
void CheckForZombieMusic()
{
extern UINT8 LightGetColors( SGPPaletteEntry * pPal );
if ( gGameSettings.fOptions[TOPTION_ZOMBIES] )
{
SGPPaletteEntry LColors[3];
LightGetColors( LColors );
// If we're underground in the creature caves, use creepy music based on the cave light colors.
// Without this, the crepitus cave music is not working correctly as these checks override the original musicmode choice
// See PrepareCreaturesForBattle() in Creature Spreading.cpp
if ( gbWorldSectorZ )
{
UseCreatureMusic( LColors->peBlue || HostileZombiesPresent() );
}
else
{
UseCreatureMusic( HostileZombiesPresent() );
}
}
}
+2
View File
@@ -242,4 +242,6 @@ BOOLEAN CorpseOkToDress( ROTTING_CORPSE* pCorpse );
// Flugente: how rotten is this corpse? values from 0 to 1, 1 as soon as it is rotting // Flugente: how rotten is this corpse? values from 0 to 1, 1 as soon as it is rotting
FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ); FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse );
void CheckForZombieMusic();
#endif #endif
+5 -17
View File
@@ -607,8 +607,6 @@ void EnableAllDealersOfferSlots( void );
void HatchOutInvSlot( UINT16 usPosX, UINT16 usPosY ); void HatchOutInvSlot( UINT16 usPosX, UINT16 usPosY );
extern BOOLEAN ItemIsARocketRifle( INT16 sItemIndex );
#ifdef JA2TESTVERSION #ifdef JA2TESTVERSION
BOOLEAN gfTestDisplayDealerCash = FALSE; BOOLEAN gfTestDisplayDealerCash = FALSE;
void DisplayAllDealersCash(); void DisplayAllDealersCash();
@@ -2896,13 +2894,6 @@ BOOLEAN DetermineArmsDealersSellingInventory( )
continue; continue;
} }
//shadooow: do not sell any item that is limited to specific system and this system isn't enabled
if (((Item[iter->object.usItem].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[iter->object.usItem].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease))
{
++iter;
continue;
}
bool increment = true; bool increment = true;
if (ItemIsSpecial(*iter) == false) { if (ItemIsSpecial(*iter) == false) {
StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, gbSelectedArmsDealerID ); StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, gbSelectedArmsDealerID );
@@ -3399,8 +3390,7 @@ FLOAT ItemConditionModifier(UINT16 usItemIndex, INT16 bStatus)
// an item at 100% is worth full price... // an item at 100% is worth full price...
// if ( Item[ usItemIndex ].fFlags & ITEM_REPAIRABLE ) if (ItemIsRepairable(usItemIndex))
if ( Item[ usItemIndex ].repairable )
{ {
// a REPAIRABLE item at 0% is still worth 50% of its full price, not 0% // a REPAIRABLE item at 0% is still worth 50% of its full price, not 0%
dConditionModifier = 0.5f + ( bStatus / (FLOAT)200 ); dConditionModifier = 0.5f + ( bStatus / (FLOAT)200 );
@@ -5014,8 +5004,7 @@ BOOLEAN IsGunOrAmmoOfSameTypeSelected( OBJECTTYPE *pItemObject )
} }
//if the highlighted object is an attachment //if the highlighted object is an attachment
// if( Item[ pItemObject->usItem ].fFlags & ITEM_ATTACHMENT ) if(ItemIsAttachment(pItemObject->usItem))
if( Item[ pItemObject->usItem ].attachment )
{ {
if( ValidAttachment( pItemObject->usItem, gpHighLightedItemObject ) ) if( ValidAttachment( pItemObject->usItem, gpHighLightedItemObject ) )
return( TRUE ); return( TRUE );
@@ -5653,7 +5642,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
} }
//if the item is a rocket rifle //if the item is a rocket rifle
if( ItemIsARocketRifle( PlayersOfferArea[ bSlotID ].sItemIndex ) ) if(ItemHasFingerPrintID( PlayersOfferArea[ bSlotID ].sItemIndex ) )
{ {
fRocketRifleWasEvaluated = TRUE; fRocketRifleWasEvaluated = TRUE;
} }
@@ -5723,8 +5712,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne )
if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS )
{ {
// only otherwise repairable items count as actual rejections // only otherwise repairable items count as actual rejections
// if ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].fFlags & ITEM_REPAIRABLE ) if (ItemIsRepairable(PlayersOfferArea[bSlotID].sItemIndex))
if ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].repairable )
{ {
uiEvalResult = EVAL_RESULT_DONT_HANDLE; uiEvalResult = EVAL_RESULT_DONT_HANDLE;
} }
@@ -6363,7 +6351,7 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject )
// strip off any loaded ammo/payload // strip off any loaded ammo/payload
// Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up! // Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up!
if ( !Item[usItem].singleshotrocketlauncher ) // Madd rpg - still do this if ( !ItemIsSingleShotRocketLauncher(usItem)) // Madd rpg - still do this
{ {
pData->data.gun.usGunAmmoItem = NONE; pData->data.gun.usGunAmmoItem = NONE;
pData->data.gun.ubGunShotsLeft = 0; pData->data.gun.ubGunShotsLeft = 0;
+7
View File
@@ -1201,8 +1201,15 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO
if( fCalculateDirection ) if( fCalculateDirection )
ubDirection = ubCalculatedDirection; ubDirection = ubCalculatedDirection;
else else
{
// Override calculated direction if we were told to....
if ( pSoldier->ubInsertionDirection >= 100 )
{
pSoldier->ubInsertionDirection -= 100;
}
ubDirection = pSoldier->ubInsertionDirection; ubDirection = pSoldier->ubInsertionDirection;
} }
}
else else
{ {
if(TileIsOutOfBounds(pSoldier->sInsertionGridNo)) if(TileIsOutOfBounds(pSoldier->sInsertionGridNo))
+7 -7
View File
@@ -375,8 +375,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
{ {
// sevenfm: breaking window with crowbar code // sevenfm: breaking window with crowbar code
if (pSoldier->inv[HANDPOS].exists() && if (pSoldier->inv[HANDPOS].exists() &&
(Item[pSoldier->inv[HANDPOS].usItem].crowbar && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || (ItemIsCrowbar(pSoldier->inv[HANDPOS].usItem) && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) ||
Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[pSoldier->inv[HANDPOS].usItem].twohanded && Item[pSoldier->inv[HANDPOS].usItem].metal)) Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && ItemIsMetal(pSoldier->inv[HANDPOS].usItem)))
{ {
INT32 sWindowGridNo = pSoldier->sTargetGridNo; INT32 sWindowGridNo = pSoldier->sTargetGridNo;
if (pSoldier->ubDirection == NORTH || pSoldier->ubDirection == WEST) if (pSoldier->ubDirection == NORTH || pSoldier->ubDirection == WEST)
@@ -1135,10 +1135,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
UINT16 usItem = pSoldier->pTempObject->usItem; UINT16 usItem = pSoldier->pTempObject->usItem;
UINT16 usBuddyItem = Item[usItem].usBuddyItem; UINT16 usBuddyItem = Item[usItem].usBuddyItem;
if (pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM && if (pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM &&
(Item[usItem].flare || (ItemIsFlare(usItem) ||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE ||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS ||
usBuddyItem && (Item[usBuddyItem].usItemClass & IC_EXPLOSV) && (Item[usBuddyItem].flare || Explosive[Item[usBuddyItem].ubClassIndex].ubType == EXPLOSV_FLARE))) usBuddyItem && (Item[usBuddyItem].usItemClass & IC_EXPLOSV) && (ItemIsFlare(usBuddyItem) || Explosive[Item[usBuddyItem].ubClassIndex].ubType == EXPLOSV_FLARE)))
{ {
if ((pSoldier->iMuzFlash = LightSpriteCreate("L-R03.LHT", 0)) != -1) if ((pSoldier->iMuzFlash = LightSpriteCreate("L-R03.LHT", 0)) != -1)
{ {
@@ -1805,7 +1805,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
if ( Item[ usItem ].usItemClass == IC_GUN ) if ( Item[ usItem ].usItemClass == IC_GUN )
{ {
// if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) )
if ( (Item[ usItem ].twohanded ) ) if (ItemIsTwoHanded(usItem))
{ {
// Set to rifle // Set to rifle
ubRandomHandIndex = RANDOM_ANIM_RIFLEINHAND; ubRandomHandIndex = RANDOM_ANIM_RIFLEINHAND;
@@ -2714,7 +2714,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
case BIGBUY_STRECH: case BIGBUY_STRECH:
case FEM_KICKSN: case FEM_KICKSN:
case FEM_WIPE: case FEM_WIPE:
if ( pSoldier->inv[ HANDPOS ].exists() == true && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded ) if ( pSoldier->inv[ HANDPOS ].exists() == true && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) )
{ {
pSoldier->EVENT_InitNewSoldierAnim( RAISE_RIFLE, 0 , FALSE ); pSoldier->EVENT_InitNewSoldierAnim( RAISE_RIFLE, 0 , FALSE );
return( TRUE ); return( TRUE );
@@ -4457,7 +4457,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier )
// SANDRO - if Martial Artist took someone down, always fall back if possible (for the fun) // SANDRO - if Martial Artist took someone down, always fall back if possible (for the fun)
if ( pSoldier->ubAttackerID != NOBODY && gGameOptions.fNewTraitSystem ) if ( pSoldier->ubAttackerID != NOBODY && gGameOptions.fNewTraitSystem )
{ {
if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || Item[MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem].brassknuckles ) ) if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || ItemIsBrassKnuckles(MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem)) )
{ {
fAlwaysFallBack = TRUE; fAlwaysFallBack = TRUE;
} }
+93 -93
View File
@@ -378,6 +378,10 @@ unsigned int Inventory::size( ) const {
return inv.size( ); return inv.size( );
} }
auto Inventory::get() const -> const std::vector<OBJECTTYPE>& {
return inv;
}
// Assignment operator // Assignment operator
Inventory& Inventory::operator=(const Inventory& src) Inventory& Inventory::operator=(const Inventory& src)
{ {
@@ -3013,7 +3017,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
} }
else else
{ {
if (Item[usItem].flare || if (ItemIsFlare(usItem) ||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE ||
Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE) Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE)
{ {
@@ -3155,7 +3159,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// Going from shoulder stance to hip stance // Going from shoulder stance to hip stance
else if ( usNewState == READY_ALTERNATIVE_STAND && (gAnimControl[this->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) ) else if ( usNewState == READY_ALTERNATIVE_STAND && (gAnimControl[this->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) )
{ {
if ( Item[this->inv[HANDPOS].usItem].twohanded ) if (ItemIsTwoHanded(this->inv[HANDPOS].usItem))
usStartingAniCode = 1; usStartingAniCode = 1;
else else
usStartingAniCode = 2; usStartingAniCode = 2;
@@ -3274,7 +3278,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// 1) We have a rifle in hand... // 1) We have a rifle in hand...
//usItem = this->inv[ HANDPOS ].usItem; //usItem = this->inv[ HANDPOS ].usItem;
if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) && !Item[usItem].rocketlauncher ) if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) )
{ {
// Switch on height! // Switch on height!
switch ( gAnimControl[this->usAnimState].ubEndHeight ) switch ( gAnimControl[this->usAnimState].ubEndHeight )
@@ -3297,7 +3301,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// 1) We have a rifle in hand... // 1) We have a rifle in hand...
//usItem = this->inv[ HANDPOS ].usItem; //usItem = this->inv[ HANDPOS ].usItem;
if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) && !Item[usItem].rocketlauncher ) if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) )
{ {
// Switch on height! // Switch on height!
switch ( gAnimControl[this->usAnimState].ubEndHeight ) switch ( gAnimControl[this->usAnimState].ubEndHeight )
@@ -3425,10 +3429,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
if ( this->inv[HANDPOS].exists( ) == true ) if ( this->inv[HANDPOS].exists( ) == true )
{ {
if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) )
{ {
// if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) )
if ( (Item[usItem].twohanded) ) if (ItemIsTwoHanded(usItem))
{ {
usNewState = BIGMERC_CROUCH_TRANS_INTO; usNewState = BIGMERC_CROUCH_TRANS_INTO;
} }
@@ -3445,10 +3449,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
if ( this->inv[HANDPOS].exists( ) == true ) if ( this->inv[HANDPOS].exists( ) == true )
{ {
if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) )
{ {
// if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) )
if ( (Item[usItem].twohanded) ) if (ItemIsTwoHanded(usItem))
{ {
usNewState = BIGMERC_CROUCH_TRANS_OUTOF; usNewState = BIGMERC_CROUCH_TRANS_OUTOF;
} }
@@ -3473,7 +3477,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
if ( ((gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || if ( ((gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) ||
(gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE)) && gGameExternalOptions.fAllowWalkingWithWeaponRaised ) (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE)) && gGameExternalOptions.fAllowWalkingWithWeaponRaised )
{ {
if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) )
{ {
if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND )
{ {
@@ -3520,7 +3524,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
{ {
if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_CROUCH ) if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_CROUCH )
{ {
if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && Item[usItem].twohanded && !Item[usItem].rocketlauncher ) if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) )
usNewState = SWAT_BACKWARDS; usNewState = SWAT_BACKWARDS;
else else
usNewState = SWAT_BACKWARDS_NOTHING; usNewState = SWAT_BACKWARDS_NOTHING;
@@ -3591,7 +3595,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
// SANDRO - check if we are gonna move with weapon raised // SANDRO - check if we are gonna move with weapon raised
else if ( gGameExternalOptions.fAllowWalkingWithWeaponRaised && ( (gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE) ) ) else if ( gGameExternalOptions.fAllowWalkingWithWeaponRaised && ( (gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE) ) )
{ {
if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) )
{ {
if ( usNewState == WALKING ) if ( usNewState == WALKING )
{ {
@@ -3614,7 +3618,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
{ {
usNewState = CROUCHEDMOVE_DUAL_READY; usNewState = CROUCHEDMOVE_DUAL_READY;
} }
else if ( !Item[this->inv[HANDPOS].usItem].twohanded ) else if (!ItemIsTwoHanded(this->inv[HANDPOS].usItem))
{ {
usNewState = CROUCHEDMOVE_PISTOL_READY; usNewState = CROUCHEDMOVE_PISTOL_READY;
} }
@@ -3987,7 +3991,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
case PLANT_BOMB: case PLANT_BOMB:
if ( Item[this->inv[HANDPOS].usItem].mine == 1 ) // bury a mine if (ItemIsMine(this->inv[HANDPOS].usItem)) // bury a mine
DeductPoints( this, GetAPsToPlantMine( this ), APBPConstants[BP_BURY_MINE] ); // changed by SANDRO DeductPoints( this, GetAPsToPlantMine( this ), APBPConstants[BP_BURY_MINE] ); // changed by SANDRO
else else
DeductPoints( this, GetAPsToDropBomb( this ), APBPConstants[BP_DROP_BOMB] ); // changed by SANDRO DeductPoints( this, GetAPsToDropBomb( this ), APBPConstants[BP_DROP_BOMB] ); // changed by SANDRO
@@ -4956,9 +4960,9 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo )
usItem = GetAttachedGrenadeLauncher( &this->inv[HANDPOS] ); usItem = GetAttachedGrenadeLauncher( &this->inv[HANDPOS] );
else else
usItem = this->inv[HANDPOS].usItem; usItem = this->inv[HANDPOS].usItem;
if ( Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar ) if (ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) )
{ {
if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND )
SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); SendChangeSoldierStanceEvent( this, ANIM_CROUCH );
fDoFireRightAway = TRUE; fDoFireRightAway = TRUE;
} }
@@ -5114,7 +5118,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight )
} }
// Check for rocket laucncher.... // Check for rocket laucncher....
if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) if (ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem))
{ {
//***ddd if shoot crouched //***ddd if shoot crouched
if ( ubHeight == ANIM_STAND ) if ( ubHeight == ANIM_STAND )
@@ -5124,14 +5128,14 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight )
} }
// Check for mortar.... // Check for mortar....
if ( Item[pSoldier->inv[HANDPOS].usItem].mortar ) if (ItemIsMortar(pSoldier->inv[HANDPOS].usItem))
{ {
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "SelectFireAnimation: shoot_mortar" ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "SelectFireAnimation: shoot_mortar" );
return(SHOOT_MORTAR); return(SHOOT_MORTAR);
} }
// Check for tank cannon // Check for tank cannon
if ( Item[pSoldier->inv[HANDPOS].usItem].cannon ) if (ItemIsCannon(pSoldier->inv[HANDPOS].usItem))
{ {
return(TANK_SHOOT); return(TANK_SHOOT);
} }
@@ -5443,7 +5447,7 @@ BOOLEAN SOLDIERTYPE::InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndR
} }
//dnl ch72 270913 ugly but fast fix for not charging turning APs as there is no fire ready animation for mortars and rocket launchers //dnl ch72 270913 ugly but fast fix for not charging turning APs as there is no fire ready animation for mortars and rocket launchers
UINT16 usItem = this->inv[HANDPOS].usItem; UINT16 usItem = this->inv[HANDPOS].usItem;
if ( Item[usItem].rocketlauncher || Item[usItem].mortar ) if (ItemIsRocketLauncher(usItem) || ItemIsMortar(usItem) )
usForceAnimState = this->usAnimState; usForceAnimState = this->usAnimState;
EVENT_InternalSetSoldierDesiredDirection( this, sFacingDir, FALSE, usAnimState ); EVENT_InternalSetSoldierDesiredDirection( this, sFacingDir, FALSE, usAnimState );
usForceAnimState = INVALID_ANIMATION; usForceAnimState = INVALID_ANIMATION;
@@ -5531,12 +5535,12 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL
} }
// Check if we have a gun..... // Check if we have a gun.....
if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass != IC_GUN && !Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass != IC_GUN && !ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) )
{ {
return(INVALID_ANIMATION); return(INVALID_ANIMATION);
} }
if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) if (ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem))
{ {
return(INVALID_ANIMATION); return(INVALID_ANIMATION);
} }
@@ -5617,7 +5621,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL
// this is a specific situation when we have a gun in standard holding (shouldered rifle/two-hand pistol) and was told to go to alternative holding // this is a specific situation when we have a gun in standard holding (shouldered rifle/two-hand pistol) and was told to go to alternative holding
else if ( (gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) && !(gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_ALT_WEAPON_HOLDING)) else if ( (gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) && !(gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_ALT_WEAPON_HOLDING))
&& fAltWeaponHolding && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 && pSoldier->bScopeMode == -1 && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND && fAltWeaponHolding && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 && pSoldier->bScopeMode == -1 && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND
&& ((!Item[pSoldier->inv[HANDPOS].usItem].twohanded && !pSoldier->IsValidSecondHandShot( ) && !pSoldier->MercInWater( )) || Item[pSoldier->inv[HANDPOS].usItem].twohanded) ) && ((!ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && !pSoldier->IsValidSecondHandShot( ) && !pSoldier->MercInWater( )) || ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) )
{ {
return(READY_ALTERNATIVE_STAND); return(READY_ALTERNATIVE_STAND);
} }
@@ -5637,7 +5641,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL
{ {
if ( gGameExternalOptions.ubAllowAlternativeWeaponHolding ) if ( gGameExternalOptions.ubAllowAlternativeWeaponHolding )
{ {
if ( fAltWeaponHolding || (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].HeavyGun && Item[pSoldier->inv[HANDPOS].usItem].twohanded) ) if ( fAltWeaponHolding || (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].HeavyGun && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) )
{ {
return(READY_ALTERNATIVE_STAND); return(READY_ALTERNATIVE_STAND);
} }
@@ -5873,7 +5877,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
{ {
if ( ubAttackerID != NOBODY ) if ( ubAttackerID != NOBODY )
{ {
if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || Item[MercPtrs[ubAttackerID]->inv[HANDPOS].usItem].brassknuckles ) if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || ItemIsBrassKnuckles(MercPtrs[ubAttackerID]->inv[HANDPOS].usItem) )
{ {
// with enhanced CCS, make the lost breath harder to regenerate, which makes CQC more usable // with enhanced CCS, make the lost breath harder to regenerate, which makes CQC more usable
if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) if ( gGameExternalOptions.fEnhancedCloseCombatSystem )
@@ -5940,7 +5944,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
if ( HasItemFlag( usWeaponIndex, TASER ) ) if ( HasItemFlag( usWeaponIndex, TASER ) )
{ {
// tasers need batteries, because I say so // tasers need batteries, because I say so
if ( Item[usWeaponIndex].needsbatteries ) if (ItemNeedsBatteries(usWeaponIndex))
{ {
// check for batteries // check for batteries
OBJECTTYPE* pBatteries = FindAttachedBatteries( &(MercPtrs[ubAttackerID]->inv[HANDPOS]) ); OBJECTTYPE* pBatteries = FindAttachedBatteries( &(MercPtrs[ubAttackerID]->inv[HANDPOS]) );
@@ -9730,7 +9734,7 @@ BOOLEAN SOLDIERTYPE::CanClimbWithCurrentBackpack()
// only apply backpack climbing limitations to player mercs // only apply backpack climbing limitations to player mercs
if (UsingNewInventorySystem() == true && this->inv[BPACKPOCKPOS].exists() == true && this->bTeam == OUR_TEAM if (UsingNewInventorySystem() == true && this->inv[BPACKPOCKPOS].exists() == true && this->bTeam == OUR_TEAM
&& ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb)
&& ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[this->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || !ItemAllowsClimbing(this->inv[BPACKPOCKPOS].usItem)))
return FALSE; return FALSE;
return TRUE; return TRUE;
@@ -10435,7 +10439,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr
&& this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_ARMS ) ) && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_ARMS ) )
{ {
// drop item in main hand if twohanded // drop item in main hand if twohanded
if ( this->inv[HANDPOS].exists() == true && TwoHandedItem( this->inv[HANDPOS].usItem ) ) if ( this->inv[HANDPOS].exists() == true && ItemIsTwoHanded( this->inv[HANDPOS].usItem ) )
dropiteminmainhand = true; dropiteminmainhand = true;
// we can only use one hand, so drop items in second hand // we can only use one hand, so drop items in second hand
@@ -12759,9 +12763,9 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio
//Ja25 No meanwhiles //Ja25 No meanwhiles
#ifdef JA2UB #ifdef JA2UB
if ( fMartialArtist && !Item[usItem].crowbar && this->ubBodyType == REGMALE ) if ( fMartialArtist && !ItemIsCrowbar(usItem) && this->ubBodyType == REGMALE )
#else #else
if ( fMartialArtist && !AreInMeanwhile( ) && !Item[usItem].crowbar && this->ubBodyType == REGMALE && !IsZombie( ) if ( fMartialArtist && !AreInMeanwhile( ) && !ItemIsCrowbar(usItem) && this->ubBodyType == REGMALE && !IsZombie( )
&& !( gGameExternalOptions.fDiseaseSevereLimitations && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_LEGS )) ) // SANDRO - added check for body type && !( gGameExternalOptions.fDiseaseSevereLimitations && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_LEGS )) ) // SANDRO - added check for body type
#endif #endif
{ {
@@ -12867,7 +12871,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio
case ANIM_STAND: case ANIM_STAND:
case ANIM_CROUCH: case ANIM_CROUCH:
if ( !Item[usItem].crowbar ) if ( !ItemIsCrowbar(usItem) )
{ {
BOOLEAN fCannotKick = (ubDirection & 1); BOOLEAN fCannotKick = (ubDirection & 1);
// SANDRO - we will determine here what type of punch we are gonna use // SANDRO - we will determine here what type of punch we are gonna use
@@ -13091,7 +13095,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginDropBomb( )
void SOLDIERTYPE::EVENT_SoldierDefuseTripwire( INT32 sGridNo, INT32 sItem ) void SOLDIERTYPE::EVENT_SoldierDefuseTripwire( INT32 sGridNo, INT32 sItem )
{ {
// Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the item's existence already... // Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the item's existence already...
if ( gWorldItems[sItem].object.exists( ) && gWorldItems[sItem].object.fFlags & OBJECT_ARMED_BOMB && Item[gWorldItems[sItem].object.usItem].tripwire == 1 ) if ( gWorldItems[sItem].object.exists( ) && gWorldItems[sItem].object.fFlags & OBJECT_ARMED_BOMB && ItemIsTripwire(gWorldItems[sItem].object.usItem) )
{ {
// Increment the number of people busy doing stuff because of an attack // Increment the number of people busy doing stuff because of an attack
switch ( gAnimControl[this->usAnimState].ubHeight ) switch ( gAnimControl[this->usAnimState].ubHeight )
@@ -13144,7 +13148,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection )
//SANDRO - hack! Find out if we are a doctor with medical bag trying to make a surgery //SANDRO - hack! Find out if we are a doctor with medical bag trying to make a surgery
this->fDoingSurgery = FALSE; this->fDoingSurgery = FALSE;
if ( (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && Item[this->inv[HANDPOS].usItem].medicalkit && gGameOptions.fNewTraitSystem ) if ( (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && ItemIsMedicalKit(this->inv[HANDPOS].usItem) && gGameOptions.fNewTraitSystem )
{ {
if ( ((pTSoldier->bTeam == OUR_TEAM) || (pTSoldier->bTeam == MILITIA_TEAM)) if ( ((pTSoldier->bTeam == OUR_TEAM) || (pTSoldier->bTeam == MILITIA_TEAM))
&& (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier )) && (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier ))
@@ -13316,7 +13320,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
// Flugente: AI medics are allowed to perform surgery without first aid kits, and can do this on themselves // Flugente: AI medics are allowed to perform surgery without first aid kits, and can do this on themselves
if ( pVictim->iHealableInjury > 0 && this->fDoingSurgery && (this->ubID != pVictim->ubID || (gGameExternalOptions.fEnemyMedicsHealSelf && this->bTeam == ENEMY_TEAM)) if ( pVictim->iHealableInjury > 0 && this->fDoingSurgery && (this->ubID != pVictim->ubID || (gGameExternalOptions.fEnemyMedicsHealSelf && this->bTeam == ENEMY_TEAM))
&& gGameOptions.fNewTraitSystem && (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && gGameOptions.fNewTraitSystem && (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery)
&& (Item[this->inv[HANDPOS].usItem].medicalkit || this->bTeam == ENEMY_TEAM) ) && (ItemIsMedicalKit(this->inv[HANDPOS].usItem) || this->bTeam == ENEMY_TEAM) )
{ {
fOnSurgery = TRUE; fOnSurgery = TRUE;
} }
@@ -13355,7 +13359,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
return(0); return(0);
// using the GOOD medic stuff // using the GOOD medic stuff
if ( Item[this->inv[HANDPOS].usItem].medicalkit && !(fOnSurgery) ) // added check if (ItemIsMedicalKit(this->inv[HANDPOS].usItem) && !(fOnSurgery) ) // added check
{ {
uiPossible += (uiPossible / 2); // add extra 50 % uiPossible += (uiPossible / 2); // add extra 50 %
} }
@@ -13413,7 +13417,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
} }
// now make sure we HAVE that much // now make sure we HAVE that much
if ( Item[this->inv[HANDPOS].usItem].medicalkit ) if (ItemIsMedicalKit(this->inv[HANDPOS].usItem))
{ {
if ( fOnSurgery ) if ( fOnSurgery )
uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot
@@ -13661,7 +13665,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1
// usedAPs equals (actionPts) * (%of possible points actually used) // usedAPs equals (actionPts) * (%of possible points actually used)
uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible; uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible;
if ( Item[this->inv[HANDPOS].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff if (ItemIsMedicalKit(this->inv[HANDPOS].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff
{ {
uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds
} }
@@ -14067,7 +14071,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U
this->bWeaponMode = WM_ATTACHED_GL; this->bWeaponMode = WM_ATTACHED_GL;
} }
if ( Item[usNewItem].twohanded && Weapon[usNewItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) if (ItemIsTwoHanded(usNewItem) && Weapon[usNewItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 )
this->bScopeMode = USE_ALT_WEAPON_HOLD; this->bScopeMode = USE_ALT_WEAPON_HOLD;
else else
this->bScopeMode = USE_BEST_SCOPE; this->bScopeMode = USE_BEST_SCOPE;
@@ -14090,8 +14094,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U
{ {
if ( Item[usOldItem].usItemClass == IC_GUN ) if ( Item[usOldItem].usItemClass == IC_GUN )
{ {
// if ( (Item[ usOldItem ].fFlags & ITEM_TWO_HANDED) && usOldItem != ROCKET_LAUNCHER ) if (ItemIsTwoHanded(usOldItem) && !ItemIsRocketLauncher(usOldItem))
if ( (Item[usOldItem].twohanded) && !Item[usOldItem].rocketlauncher )
{ {
fOldRifle = TRUE; fOldRifle = TRUE;
} }
@@ -14102,8 +14105,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U
{ {
if ( Item[usNewItem].usItemClass == IC_GUN ) if ( Item[usNewItem].usItemClass == IC_GUN )
{ {
// if ( (Item[ usNewItem ].fFlags & ITEM_TWO_HANDED) && usNewItem != ROCKET_LAUNCHER ) if (ItemIsTwoHanded(usNewItem) && !ItemIsRocketLauncher(usNewItem))
if ( (Item[usNewItem].twohanded) && !Item[usNewItem].rocketlauncher )
{ {
fNewRifle = TRUE; fNewRifle = TRUE;
} }
@@ -14628,7 +14630,7 @@ BOOLEAN SOLDIERTYPE::SoldierCarriesTwoHandedWeapon( void )
usItem = this->inv[HANDPOS].usItem; usItem = this->inv[HANDPOS].usItem;
if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) ) if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) )
{ {
return(TRUE); return(TRUE);
} }
@@ -15525,7 +15527,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void )
{ {
// if that item is a gun, explosives, military armour or facewear, we're screwed // if that item is a gun, explosives, military armour or facewear, we're screwed
if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) || if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) ||
((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !Item[this->inv[bLoop].usItem].leatherjacket && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !ItemIsLeatherJacket(this->inv[bLoop].usItem) && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) ||
(Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0) (Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0)
) )
{ {
@@ -15547,7 +15549,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void )
{ {
// if that item is a gun, explosives, military armour or facewear, we're screwed // if that item is a gun, explosives, military armour or facewear, we're screwed
if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) || if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) ||
((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !Item[this->inv[bLoop].usItem].leatherjacket && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !ItemIsLeatherJacket(this->inv[bLoop].usItem) && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) ||
(Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0) (Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0)
) )
{ {
@@ -16844,7 +16846,7 @@ void SOLDIERTYPE::DropSectorEquipment( )
if ( pObj->exists( ) ) if ( pObj->exists( ) )
{ {
// Check if it's supposed to be dropped // Check if it's supposed to be dropped
if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !(Item[pObj->usItem].defaultundroppable) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !ItemIsUndroppableByDefault(pObj->usItem) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA )
{ {
(*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA; (*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA;
@@ -16870,7 +16872,7 @@ void SOLDIERTYPE::DropSectorEquipment( )
if ( pObj->exists( ) ) if ( pObj->exists( ) )
{ {
// Check if it's supposed to be dropped // Check if it's supposed to be dropped
if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !(Item[pObj->usItem].defaultundroppable) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !ItemIsUndroppableByDefault(pObj->usItem) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA )
{ {
(*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA; (*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA;
@@ -16940,12 +16942,13 @@ void SOLDIERTYPE::TakeNewBombFromInventory( UINT16 usItem )
// take tripwire-activated item only if used item is tripwire activated // take tripwire-activated item only if used item is tripwire activated
for ( i = 0; i < invsize; i++ ) for ( i = 0; i < invsize; i++ )
{ {
UINT16 usItem = this->inv[i].usItem;
if ( this->inv[i].exists( ) == true && if ( this->inv[i].exists( ) == true &&
Item[this->inv[i].usItem].usItemClass == IC_BOMB && Item[usItem].usItemClass == IC_BOMB &&
Item[this->inv[i].usItem].ubCursor == BOMBCURS && Item[usItem].ubCursor == BOMBCURS &&
!Item[this->inv[i].usItem].tripwire && !ItemIsTripwire(usItem) &&
((Item[this->inv[i].usItem].tripwireactivation && Item[usItem].tripwireactivation) || ((ItemHasTripwireActivation(usItem) && ItemHasTripwireActivation(usItem)) ||
(!Item[this->inv[i].usItem].tripwireactivation && !Item[usItem].tripwireactivation)) ) (!ItemHasTripwireActivation(usItem) && !ItemHasTripwireActivation(usItem))) )
{ {
this->inv[i].MoveThisObjectTo( this->inv[HANDPOS], 1, this ); this->inv[i].MoveThisObjectTo( this->inv[HANDPOS], 1, this );
return; return;
@@ -17068,7 +17071,7 @@ void SOLDIERTYPE::SwitchWeapons( BOOLEAN fKnife, BOOLEAN fSideArm )
else else
handCanMove = (CanItemFitInPosition( this, &this->inv[HANDPOS], handobjstorageslot, FALSE ) || (this->inv[HANDPOS].exists( ) == false && this->inv[SECONDHANDPOS].exists( ) == false)); handCanMove = (CanItemFitInPosition( this, &this->inv[HANDPOS], handobjstorageslot, FALSE ) || (this->inv[HANDPOS].exists( ) == false && this->inv[SECONDHANDPOS].exists( ) == false));
if ( Item[this->inv[retrieveslot].usItem].twohanded && this->inv[SECONDHANDPOS].exists( ) == true ) if ( ItemIsTwoHanded(this->inv[retrieveslot].usItem) && this->inv[SECONDHANDPOS].exists( ) == true )
searchitemCanMove = FALSE; searchitemCanMove = FALSE;
else else
searchitemCanMove = (CanItemFitInPosition( this, &this->inv[retrieveslot], HANDPOS, FALSE ) || this->inv[retrieveslot].exists( ) == false); searchitemCanMove = (CanItemFitInPosition( this, &this->inv[retrieveslot], HANDPOS, FALSE ) || this->inv[retrieveslot].exists( ) == false);
@@ -17167,7 +17170,7 @@ INT8 SOLDIERTYPE::GetTraitCTHModifier( UINT16 usItem, INT16 ubAimTime, UINT8 ubT
{ {
// Bonus for heavy weapons moved here from above to get instant CtH bonus and not marksmanship bonus, // Bonus for heavy weapons moved here from above to get instant CtH bonus and not marksmanship bonus,
// which is supressed by weapon condition // which is supressed by weapon condition
if ( Item[usItem].rocketlauncher || Item[usItem].singleshotrocketlauncher ) if (ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem))
{ {
modifier += gSkillTraitValues.bCtHModifierRocketLaunchers; // -25% for untrained mercs !!! modifier += gSkillTraitValues.bCtHModifierRocketLaunchers; // -25% for untrained mercs !!!
@@ -17863,7 +17866,7 @@ void SOLDIERTYPE::SoldierPropertyUpkeep( )
if ( this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT] ) if ( this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT] )
this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT]--; this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT]--;
if (AM_A_ROBOT(this) && Item[this->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1) if (AM_A_ROBOT(this) && ItemHasXRay(this->inv[ROBOT_UTILITY_SLOT].usItem))
{ {
if (this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]) if (this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY])
this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]--; this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]--;
@@ -18551,7 +18554,7 @@ BOOLEAN SOLDIERTYPE::HasMortar( )
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
{ {
if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].mortar ) if ( inv[bLoop].exists( ) == true && ItemIsMortar(inv[bLoop].usItem) )
{ {
return TRUE; return TRUE;
} }
@@ -18567,7 +18570,7 @@ BOOLEAN SOLDIERTYPE::GetSlotOfSignalShellIfMortar( UINT8* pbLoop )
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
{ {
if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].mortar ) if ( inv[bLoop].exists( ) == true && ItemIsMortar(inv[bLoop].usItem) )
{ {
mortaritem = inv[bLoop].usItem; mortaritem = inv[bLoop].usItem;
break; break;
@@ -18586,7 +18589,7 @@ BOOLEAN SOLDIERTYPE::GetSlotOfSignalShellIfMortar( UINT8* pbLoop )
return TRUE; return TRUE;
} }
if ( Item[inv[bLoop].usItem].mortar ) if (ItemIsMortar(inv[bLoop].usItem))
{ {
OBJECTTYPE* pAttObj = FindAttachmentByClass( &(inv[bLoop]), IC_BOMB ); OBJECTTYPE* pAttObj = FindAttachmentByClass( &(inv[bLoop]), IC_BOMB );
@@ -18874,7 +18877,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN
for ( INT8 bLoop = 0; (bLoop < invsize) && (mortaritemcnt < maxFiringMortarsAmount); ++bLoop ) for ( INT8 bLoop = 0; (bLoop < invsize) && (mortaritemcnt < maxFiringMortarsAmount); ++bLoop )
{ {
if ( pSoldier->inv[bLoop].exists( ) == true && Item[pSoldier->inv[bLoop].usItem].mortar ) if ( pSoldier->inv[bLoop].exists( ) == true && ItemIsMortar(pSoldier->inv[bLoop].usItem))
{ {
// if not already in list, remember this mortar // if not already in list, remember this mortar
bool alreadyInList = false; bool alreadyInList = false;
@@ -18919,7 +18922,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN
{ {
if ( pSoldier->inv[bLoop].exists( ) == true ) if ( pSoldier->inv[bLoop].exists( ) == true )
{ {
if ( Item[pSoldier->inv[bLoop].usItem].mortar ) if (ItemIsMortar(pSoldier->inv[bLoop].usItem))
{ {
OBJECTTYPE* pAttObj = FindAttachmentByClass( &(pSoldier->inv[bLoop]), IC_BOMB ); OBJECTTYPE* pAttObj = FindAttachmentByClass( &(pSoldier->inv[bLoop]), IC_BOMB );
@@ -19934,22 +19937,19 @@ FLOAT SOLDIERTYPE::GetDiseaseContactProtection( )
// if we wear special equipment, lower our chances of being infected // if we wear special equipment, lower our chances of being infected
FLOAT bestfacegear = 0.0f; FLOAT bestfacegear = 0.0f;
FLOAT bestprotectivegear = 0.0f; FLOAT bestprotectivegear = 0.0f;
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( const auto &item : inv.get() )
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
{ {
if ( inv[bLoop].exists( ) ) if ( item.exists( ) )
{ {
OBJECTTYPE* pObj = &(inv[bLoop]); if ( item[0]->data.objectStatus >= USABLE )
if ( pObj && (*pObj)[0]->data.objectStatus >= USABLE )
{ {
if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_1 ) ) if ( HasItemFlag( item.usItem, DISEASEPROTECTION_1 ) )
{ {
bestfacegear = max( bestfacegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) ); bestfacegear = max( bestfacegear, (FLOAT)(item[0]->data.objectStatus / 100) );
} }
if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_2 ) ) if ( HasItemFlag( item.usItem, DISEASEPROTECTION_2 ) )
{ {
bestprotectivegear = max( bestprotectivegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) ); bestprotectivegear = max( bestprotectivegear, (FLOAT)(item[0]->data.objectStatus / 100) );
} }
} }
} }
@@ -22428,7 +22428,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginAttachCan( INT32 sGridNo, UINT8 ubDirection
// OK, find door, attach to door, do animation...., remove item.... // OK, find door, attach to door, do animation...., remove item....
// First make sure we still have item in hand.... // First make sure we still have item in hand....
if ( !Item[this->inv[HANDPOS].usItem].canandstring ) if ( !ItemIsCanAndString(this->inv[HANDPOS].usItem))
{ {
return; return;
} }
@@ -22740,7 +22740,7 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti
if ( success ) if ( success )
{ {
if ( Item[usItem].gasmask ) if (ItemIsGasmask(usItem))
{ {
// put this item into a (at best empty) faceslot if no gasmask is been worn // put this item into a (at best empty) faceslot if no gasmask is been worn
INT8 bSlot = FindGasMask( pSoldier ); INT8 bSlot = FindGasMask( pSoldier );
@@ -23361,11 +23361,11 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid
BOOLEAN SOLDIERTYPE::IsValidSecondHandShot( void ) BOOLEAN SOLDIERTYPE::IsValidSecondHandShot( void )
{ {
if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN &&
!(Item[this->inv[SECONDHANDPOS].usItem].twohanded) && !ItemIsTwoHanded(this->inv[SECONDHANDPOS].usItem) &&
(!this->bDoBurst || this->IsValidSecondHandBurst( )) && (!this->bDoBurst || this->IsValidSecondHandBurst( )) &&
!Item[this->inv[HANDPOS].usItem].grenadelauncher && !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) &&
Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN &&
!(Item[this->inv[HANDPOS].usItem].twohanded) && !ItemIsTwoHanded(this->inv[HANDPOS].usItem) &&
this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE &&
this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 )
{ {
@@ -23379,11 +23379,11 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandBurst( void )
{ {
// SANDRO - a function to determine if we can autofire with both weapons // SANDRO - a function to determine if we can autofire with both weapons
if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN &&
!(Item[this->inv[SECONDHANDPOS].usItem].twohanded) && !ItemIsTwoHanded(this->inv[SECONDHANDPOS].usItem) &&
!Item[this->inv[HANDPOS].usItem].grenadelauncher && !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) &&
this->bDoBurst && this->bDoBurst &&
Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN &&
!(Item[this->inv[HANDPOS].usItem].twohanded) && !ItemIsTwoHanded(this->inv[HANDPOS].usItem) &&
this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE &&
this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 )
{ {
@@ -23415,7 +23415,7 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandShotForReloadingPurposes( void )
// about ammo taken out! // about ammo taken out!
if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN &&
//!this->bDoBurst && //!this->bDoBurst &&
!Item[this->inv[HANDPOS].usItem].grenadelauncher && !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) &&
Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN &&
this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE //&& this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE //&&
// this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 && // this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 &&
@@ -23451,7 +23451,7 @@ BOOLEAN SOLDIERTYPE::IsValidShotFromHip( INT16 bAimTime, INT32 iTrgGridNo )
return(FALSE); return(FALSE);
} }
// must be two handed for this // must be two handed for this
if ( !Item[this->inv[HANDPOS].usItem].twohanded ) if ( !ItemIsTwoHanded(this->inv[HANDPOS].usItem) )
{ {
return(FALSE); return(FALSE);
} }
@@ -23508,7 +23508,7 @@ BOOLEAN SOLDIERTYPE::IsValidPistolFastShot( INT16 bAimTime, INT32 iTrgGridNo )
return(FALSE); return(FALSE);
} }
// must be one handed for this // must be one handed for this
if ( Item[this->inv[HANDPOS].usItem].twohanded ) if (ItemIsTwoHanded(this->inv[HANDPOS].usItem))
{ {
return(FALSE); return(FALSE);
} }
@@ -24177,8 +24177,8 @@ void SOLDIERTYPE::BreakWindow(void)
{ {
if (this->inv[HANDPOS].exists() && if (this->inv[HANDPOS].exists() &&
this->inv[HANDPOS][0]->data.objectStatus >= USABLE && this->inv[HANDPOS][0]->data.objectStatus >= USABLE &&
(Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || (ItemIsCrowbar(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) ||
Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal)) Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(this->inv[HANDPOS].usItem) && ItemIsMetal(this->inv[HANDPOS].usItem) ))
{ {
this->usAttackingWeapon = this->inv[HANDPOS].usItem; this->usAttackingWeapon = this->inv[HANDPOS].usItem;
this->aiData.bAction = AI_ACTION_KNIFE_STAB; this->aiData.bAction = AI_ACTION_KNIFE_STAB;
@@ -24202,8 +24202,8 @@ BOOLEAN SOLDIERTYPE::CanBreakWindow(void)
IS_MERC_BODY_TYPE(this) && IS_MERC_BODY_TYPE(this) &&
this->inv[HANDPOS].exists() && this->inv[HANDPOS].exists() &&
this->inv[HANDPOS][0]->data.objectStatus >= USABLE && this->inv[HANDPOS][0]->data.objectStatus >= USABLE &&
(Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || (ItemIsCrowbar(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) ||
Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal)) Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(this->inv[HANDPOS].usItem) && ItemIsMetal(this->inv[HANDPOS].usItem) ))
{ {
//INT32 sWindowGridNo = this->sTargetGridNo; //INT32 sWindowGridNo = this->sTargetGridNo;
INT32 sWindowGridNo = this->sGridNo; INT32 sWindowGridNo = this->sGridNo;
@@ -25062,7 +25062,7 @@ BOOLEAN AIDecideHipOrShoulderStance( SOLDIERTYPE * pSoldier, INT32 iGridNo )
UINT16 usInHand = pSoldier->usAttackingWeapon; UINT16 usInHand = pSoldier->usAttackingWeapon;
// not 2-handed or not standing // not 2-handed or not standing
if ( gAnimControl[pSoldier->usAnimState].ubEndHeight != ANIM_STAND || !Item[pSoldier->inv[HANDPOS].usItem].twohanded ) if ( gAnimControl[pSoldier->usAnimState].ubEndHeight != ANIM_STAND || !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) )
{ {
return FALSE; return FALSE;
} }
@@ -25595,7 +25595,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB
if ( !uiPossible ) if ( !uiPossible )
return 0; return 0;
if ( Item[pSoldier->inv[0].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff if (ItemIsMedicalKit(pSoldier->inv[0].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff
uiPossible += (uiPossible / 2); // add extra 50 % uiPossible += (uiPossible / 2); // add extra 50 %
// Doctor trait improves basic bandaging ability // Doctor trait improves basic bandaging ability
@@ -25631,7 +25631,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB
uiActual = uiDeficiency; // reduce actual not to waste anything uiActual = uiDeficiency; // reduce actual not to waste anything
// now make sure we HAVE that much // now make sure we HAVE that much
if ( Item[pKit->usItem].medicalkit ) if (ItemIsMedicalKit(pKit->usItem))
{ {
if ( fOnSurgery ) if ( fOnSurgery )
uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot
@@ -25850,7 +25850,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB
// usedAPs equals (actionPts) * (%of possible points actually used) // usedAPs equals (actionPts) * (%of possible points actually used)
uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible; uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible;
if ( Item[pSoldier->inv[0].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff if (ItemIsMedicalKit(pSoldier->inv[0].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff
uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds
// surgery is harder so cost more BPs // surgery is harder so cost more BPs
@@ -25982,7 +25982,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce,
// how much of this item do we use up // how much of this item do we use up
UINT16 statusused = min(portionsize, (*pObj)[0]->data.objectStatus); UINT16 statusused = min(portionsize, (*pObj)[0]->data.objectStatus);
if (!statusused || (statusused == 1 && Item[pObj->usItem].canteen)) if (!statusused || (statusused == 1 && ItemIsCanteen(pObj->usItem)))
return FALSE; return FALSE;
INT16 apcost = 0; INT16 apcost = 0;
@@ -25999,12 +25999,12 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce,
apcost = max( apcost, (APBPConstants[AP_CAMOFLAGE] / 2) ); apcost = max( apcost, (APBPConstants[AP_CAMOFLAGE] / 2) );
} }
if ( Item[pObj->usItem].camouflagekit ) if (ItemIsCamoKit(pObj->usItem))
{ {
apcost = max( apcost, APBPConstants[AP_CAMOFLAGE] ); apcost = max( apcost, APBPConstants[AP_CAMOFLAGE] );
} }
if ( Item[pObj->usItem].canteen ) if (ItemIsCanteen(pObj->usItem))
{ {
apcost = max( apcost, APBPConstants[AP_DRINK] ); apcost = max( apcost, APBPConstants[AP_DRINK] );
} }
@@ -26051,7 +26051,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce,
} }
// some mercs will refuse to smoke // some mercs will refuse to smoke
if ( Item[pObj->usItem].cigarette && pSoldier->GetBackgroundValue( BG_SMOKERTYPE ) == 2 ) if (ItemIsCigarette(pObj->usItem) && pSoldier->GetBackgroundValue( BG_SMOKERTYPE ) == 2 )
{ {
// merc gets slightly pissed by the player even suggesting this // merc gets slightly pissed by the player even suggesting this
TacticalCharacterDialogue( pSoldier, QUOTE_REFUSE_TO_SMOKE ); TacticalCharacterDialogue( pSoldier, QUOTE_REFUSE_TO_SMOKE );
@@ -26107,7 +26107,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce,
fSuccess = TRUE; fSuccess = TRUE;
// no sound on consuming cigarettes, as that is very annoying // no sound on consuming cigarettes, as that is very annoying
if ( !Item[pObj->usItem].cigarette ) if ( !ItemIsCigarette(pObj->usItem) )
{ {
fDoSound = TRUE; fDoSound = TRUE;
} }
+6 -2
View File
@@ -466,12 +466,13 @@ enum
#define BACKGROUND_ANIMALFRIEND 0x0000000000000200 //512 // refuses to attack animals #define BACKGROUND_ANIMALFRIEND 0x0000000000000200 //512 // refuses to attack animals
#define BACKGROUND_CIVGROUPLOYAL 0x0000000000000400 //1024 // refuses to attack members of the same civgroup #define BACKGROUND_CIVGROUPLOYAL 0x0000000000000400 //1024 // refuses to attack members of the same civgroup
#define BACKGROUND_ALT_IMP_CREATION 0x0000000000000800 //2048 // BG can only be used when ALT_IMP_CREATION is TRUE in ja2options.ini (IMP creation)
#define BACKGROUND_FLAG_MAX 11 // number of flagged backgrounds - keep this updated, or properties will get lost! #define BACKGROUND_FLAG_MAX 12 // number of flagged backgrounds - keep this updated, or properties will get lost!
// some properties are hidden (forbid background in MP creation) // some properties are hidden (forbid background in MP creation)
// corruption property is not relevant in 1.13 // corruption property is not relevant in 1.13
#define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE|BACKGROUND_CORRUPTIONSPREAD) #define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE|BACKGROUND_CORRUPTIONSPREAD|BACKGROUND_ALT_IMP_CREATION)
// anv: externalised taunts // anv: externalised taunts
// taunt properties // taunt properties
@@ -771,6 +772,9 @@ public:
// How any slots are there in this inventory? // How any slots are there in this inventory?
unsigned int size() const; unsigned int size() const;
// const-only accessor
auto get() const -> const std::vector<OBJECTTYPE>&;
//temporarily? public //temporarily? public
std::vector<int> bNewItemCount; std::vector<int> bNewItemCount;
std::vector<int> bNewItemCycleCount; std::vector<int> bNewItemCycleCount;
+23 -21
View File
@@ -419,6 +419,7 @@ SOLDIERCREATE_STRUCT::~SOLDIERCREATE_STRUCT() {
// Note that the constructor does this automatically. // Note that the constructor does this automatically.
void SOLDIERCREATE_STRUCT::initialize() { void SOLDIERCREATE_STRUCT::initialize() {
memset( this, 0, SIZEOF_SOLDIERCREATE_STRUCT_POD); memset( this, 0, SIZEOF_SOLDIERCREATE_STRUCT_POD);
this->bAIMorale = MORALE_NORMAL;
Inv.clear(); Inv.clear();
} }
@@ -4163,7 +4164,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
UINT32 invsize = pProfile->inv.size(); UINT32 invsize = pProfile->inv.size();
for ( cnt = 0; cnt < pProfile->inv.size(); ++cnt ) for ( cnt = 0; cnt < pProfile->inv.size(); ++cnt )
{ {
if ( pProfile->inv[ cnt ] == NOTHING || Item[pProfile->inv[cnt]].attachment) { if ( pProfile->inv[ cnt ] == NOTHING || ItemIsAttachment(pProfile->inv[cnt]) ) {
continue; continue;
} }
fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject );
@@ -4188,7 +4189,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
if ( pProfile->inv[ cnt ] == NOTHING) { if ( pProfile->inv[ cnt ] == NOTHING) {
continue; continue;
} }
if (!Item[pProfile->inv[cnt]].attachment) { if (!ItemIsAttachment(pProfile->inv[cnt])) {
continue; continue;
} }
fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject );
@@ -4293,7 +4294,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc
if(fRet) if(fRet)
{ {
pSoldier->inv[cnt] = gTempObject; pSoldier->inv[cnt] = gTempObject;
if ( Item[gTempObject.usItem].fingerprintid ) if (ItemHasFingerPrintID(gTempObject.usItem))
{ {
for (int x = 0; x < pProfile->bInvNumber[ cnt ]; ++x) { for (int x = 0; x < pProfile->bInvNumber[ cnt ]; ++x) {
gTempObject[x]->data.ubImprintID = pSoldier->ubProfile; gTempObject[x]->data.ubImprintID = pSoldier->ubProfile;
@@ -5090,7 +5091,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
} }
} }
// Chance to gain second weapon // Chance to gain second weapon
if ( Chance( iChance / 4 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) // 1/4 of chance if ( Chance( iChance / 4 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) // 1/4 of chance
{ {
(pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]);
@@ -5178,7 +5179,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
BTraitAssigned = TRUE; BTraitAssigned = TRUE;
// elites can have third skill trait // elites can have third skill trait
if ( Chance( iChance / 3 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && if ( Chance( iChance / 3 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) &&
(ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) ) (ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) )
{ {
pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT; pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT;
@@ -5188,7 +5189,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
} }
// Chance to gain second weapon and ambidextrous trait // Chance to gain second weapon and ambidextrous trait
else if ( Chance( iChance / 2 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && !BTraitAssigned ) // 1/2 of chance else if ( Chance( iChance / 2 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && !BTraitAssigned ) // 1/2 of chance
{ {
if ( pCreateStruct->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory && gGameExternalOptions.fMilitiaUseSectorInventory_Gun ) if ( pCreateStruct->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory && gGameExternalOptions.fMilitiaUseSectorInventory_Gun )
; ;
@@ -5206,7 +5207,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
BTraitAssigned = TRUE; BTraitAssigned = TRUE;
// elites can have third skill trait // elites can have third skill trait
if ( Chance( iChance / 3 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && if ( Chance( iChance / 3 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) &&
(ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) ) (ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) )
{ {
pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT; pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT;
@@ -5222,7 +5223,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
pSoldier->stats.ubSkillTraits[0] = AMBIDEXT_OT; pSoldier->stats.ubSkillTraits[0] = AMBIDEXT_OT;
ATraitAssigned = TRUE; ATraitAssigned = TRUE;
// Ambidextrous trait gives us second weapon automatically // Ambidextrous trait gives us second weapon automatically
if ( !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) if ( !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) )
{ {
(pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]);
} }
@@ -5232,7 +5233,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
pSoldier->stats.ubSkillTraits[1] = AMBIDEXT_OT; pSoldier->stats.ubSkillTraits[1] = AMBIDEXT_OT;
BTraitAssigned = TRUE; BTraitAssigned = TRUE;
// Ambidextrous trait gives us second weapon automatically // Ambidextrous trait gives us second weapon automatically
if ( !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) if ( !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) )
{ {
(pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]);
} }
@@ -5267,28 +5268,29 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre
{ {
if ( pCreateStruct->Inv[bLoop].exists( ) == true ) if ( pCreateStruct->Inv[bLoop].exists( ) == true )
{ {
if ( Item[pCreateStruct->Inv[bLoop].usItem].mortar ) UINT16 usItem = pCreateStruct->Inv[bLoop].usItem;
if (ItemIsMortar(usItem))
foundMortar = TRUE; foundMortar = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].rocketlauncher ) else if (ItemIsRocketLauncher(usItem))
foundRocketlauncher = TRUE; foundRocketlauncher = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].grenadelauncher ) else if (ItemIsGrenadeLauncher(usItem))
foundGrenadelauncher = TRUE; foundGrenadelauncher = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_BLADE ) else if ( Item[usItem].usItemClass == IC_BLADE )
foundKnife = TRUE; foundKnife = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_THROWING_KNIFE ) else if ( Item[usItem].usItemClass == IC_THROWING_KNIFE )
foundThrowing = TRUE; foundThrowing = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_GRENADE ) else if ( Item[usItem].usItemClass == IC_GRENADE )
foundGrenades = TRUE; foundGrenades = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].brassknuckles ) else if (ItemIsBrassKnuckles(usItem))
foundHtH = TRUE; foundHtH = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == 128 && // 128 is an identifier of blunt melee weapons else if ( Item[usItem].usItemClass == 128 && // 128 is an identifier of blunt melee weapons
Item[pCreateStruct->Inv[bLoop].usItem].uiIndex != 0 ) Item[usItem].uiIndex != 0 )
foundMelee = TRUE; foundMelee = TRUE;
else if ( HasItemFlag( pCreateStruct->Inv[bLoop].usItem, RADIO_SET ) ) else if ( HasItemFlag( usItem, RADIO_SET ) )
fRadioSetFound = TRUE; fRadioSetFound = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].firstaidkit ) else if (ItemIsFirstAidKit(usItem))
fFirstAidKitFound = TRUE; fFirstAidKitFound = TRUE;
else if ( Item[pCreateStruct->Inv[bLoop].usItem].medicalkit ) else if (ItemIsMedicalKit(usItem))
{ {
// Flugente: for enemy medic purposes, med kits also count as first aid kits // Flugente: for enemy medic purposes, med kits also count as first aid kits
fFirstAidKitFound = TRUE; fFirstAidKitFound = TRUE;

Some files were not shown because too many files have changed in this diff Show More