Skip to content

Comments

Protection Icons Overhaul#47

Open
Myszax wants to merge 20 commits intoFranisz:masterfrom
Myszax:dev
Open

Protection Icons Overhaul#47
Myszax wants to merge 20 commits intoFranisz:masterfrom
Myszax:dev

Conversation

@Myszax
Copy link
Contributor

@Myszax Myszax commented Dec 15, 2025

I've extended ShowTargetProtection functionality.
Split ShowTargetProtection into two separate settings ShowTargetProtectionNoFight and ShowTargetProtectionInFight.
Why? When I am playing Gothic I've found that current settings does not me freedom to choose what I want to see on my screen.
For example: When I wandering around the game world talking with NPCs etc. I'd rather see their All protection info or see the ones that matters AllButZeros. In fight mode I want to be focused on CurrentWeapon only.
Players now will able to choose what fits them :)

System looks more consistent now. When NPC has NPC_FLAG_IMMORTAL there is no point in showing all icons, just Shield in gray color. When target is immune to some damage type then corresponding icon and value MAX is shown.

There is another option to choose icon types. "New" ones are the same as DamagePopup icons as suggested in #40 . Second option is to use Shield icons those that have been used so far.

Last but not least. System is now checking for all equipped weapon/spells damage types. Not only for GetTopDmgIndex.
For example Uriziel in G1 has magic and fire damage type. So for this weapon and CurrentWeapon setting both fire and magic protection icons will be shown.

@Myszax
Copy link
Contributor Author

Myszax commented Dec 16, 2025

I am wondering about oEDamageIndex_Barrier. Is it even considerable to show barrier damage type protection? I've never seen something with oEDamageType_Barrier.
Kinda same applies to oEDamageIndex_Fall. But I left it as it was originally.

@Myszax
Copy link
Contributor Author

Myszax commented Dec 16, 2025

Another thing came into my mind. Idk if it would be an overkill xD
Add fifth option for ShowTargetProtectionNoFight/ShowTargetProtectionInFight called Custom that player would be able to set custom order of icons and choose exactly those he wants to see.

@Myszax
Copy link
Contributor Author

Myszax commented Dec 17, 2025

Don't know if spell->spellType == 2 should be checked before MarkSpellDamage.
There are 3 constants in G1/G2 scrips:

const int SPELL_GOOD = 0;
const int SPELL_NEUTRAL = 1;
const int SPELL_BAD = 2;

0 is never used, 1 is used for no charm spells like (heal/light), 2 is used for all kind of damaging/transformation.
Could mods change this behavior?

@Myszax
Copy link
Contributor Author

Myszax commented Dec 19, 2025

Seems like engine (at least G2A) is transforming oETypeDamage done by distance weapons to oEDamageType_Point. No matter if ITM_CAT_FF or ITEM_KAT_MUN (in current implementation I do not even check for amunition) has damageType different than DAM_POINT it's still converted. Tested on magic crossbow.
Is there a point of checking damage values for distance weapons? Or just set bit for oEDamageType_Point and go on.

@Franisz
Copy link
Owner

Franisz commented Dec 19, 2025

Seems like engine (at least G2A) is transforming oETypeDamage done by distance weapons to oEDamageType_Point. No matter if ITM_CAT_FF or ITEM_KAT_MUN (in current implementation I do not even check for amunition) has damageType different than DAM_POINT it's still converted. Tested on magic crossbow. Is there a point of checking damage values for distance weapons? Or just set bit for oEDamageType_Point and go on.

IIRC some mods or Ninja FreeAim allows for dealing different types of damage. I don't think there would be any universal solution for this so maybe it would be good to check for actual damage type dealt at runtime and flag whether dmg matches the weapon or the arrow or the fixed point damage type and save the flag to ini. On mismatch overwrite the flag.

@Myszax
Copy link
Contributor Author

Myszax commented Dec 21, 2025

Seems like engine (at least G2A) is transforming oETypeDamage done by distance weapons to oEDamageType_Point. No matter if ITM_CAT_FF or ITEM_KAT_MUN (in current implementation I do not even check for amunition) has damageType different than DAM_POINT it's still converted. Tested on magic crossbow. Is there a point of checking damage values for distance weapons? Or just set bit for oEDamageType_Point and go on.

IIRC some mods or Ninja FreeAim allows for dealing different types of damage. I don't think there would be any universal solution for this so maybe it would be good to check for actual damage type dealt at runtime and flag whether dmg matches the weapon or the arrow or the fixed point damage type and save the flag to ini. On mismatch overwrite the flag.

So I'd have to hook OnDamage_Hit and check enuModeDamage in oSDamageDescriptor?
So the damage type information would only appear after the hit.
So, shouldn't I show anything before the hit? Or should I show the resistance taken from MarkWeaponDamage and then correct it if it's different?
A system for resetting the saved flag when the player reequips a ranged weapon would also be useful.
Why save the flag to the ini file?
I don't know how to approach this xD

@Franisz
Copy link
Owner

Franisz commented Dec 21, 2025

Seems like engine (at least G2A) is transforming oETypeDamage done by distance weapons to oEDamageType_Point. No matter if ITM_CAT_FF or ITEM_KAT_MUN (in current implementation I do not even check for amunition) has damageType different than DAM_POINT it's still converted. Tested on magic crossbow. Is there a point of checking damage values for distance weapons? Or just set bit for oEDamageType_Point and go on.

IIRC some mods or Ninja FreeAim allows for dealing different types of damage. I don't think there would be any universal solution for this so maybe it would be good to check for actual damage type dealt at runtime and flag whether dmg matches the weapon or the arrow or the fixed point damage type and save the flag to ini. On mismatch overwrite the flag.

So I'd have to hook OnDamage_Hit and check enuModeDamage in oSDamageDescriptor? So the damage type information would only appear after the hit. So, shouldn't I show anything before the hit? Or should I show the resistance taken from MarkWeaponDamage and then correct it if it's different? A system for resetting the saved flag when the player reequips a ranged weapon would also be useful. Why save the flag to the ini file? I don't know how to approach this xD

Before the hit show in default way and then correct, but save in ini so that after restarting the game, we show already the right way. After that the flag in ini would be only overwritten if for eg. player changes the mod and dmg is treated differently there. Random idea, but should work in theory

@Myszax
Copy link
Contributor Author

Myszax commented Dec 23, 2025

Okay so I build this system like this:
Before distance weapon damage hit land default distance weapon damage will be shown defined by DamageMask DistanceWeaponDamageType = DamageMask{ oEDamageType::oEDamageType_Point }; in PlayerStatus.cpp.
Then hook to oCNpc::OnDamage_Hit will check if damage done is different than default. If yes then save this damage to variable and ini. It won't be checked again until other hook to oCNpc::EquipItem will reset checking flag (after few checks if distance weapon etc.).
I've created new section in ini called ZUTILITIES_TEMP. Didn't add any trivia. I treat it as temporary plugin variable, not something that is meant to change by user.
It's up to you how do you want to ini file be implemented :)

@Myszax Myszax requested a review from Franisz December 23, 2025 00:57
Disabled = 0,
CurrentWeapon = 1,
AllButZeros = 2,
All = 3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here should be only, Disabled, CurrentWeapon, All and there should be separate option for excluding from "All". We should be able to exclude Zeros, Fall, Fly and any combination of those. It should not affect the display of CurrentWeapon option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay.
What about difference between fight and no fight mode? Should be unified like TargetProtectionIconStyle to not double options? I think so.
Then it will be 3 new options like ProtectionIconHideZeros, ProtectionIconHideFall, ProtectionIconHideFly and it will be applicable only when mode is set to All?
It would be even better to add mask configuration, but it will make people confused how to set it up.
It could be expanded to 8 booleans (7 for damage types and 1 for hide zeros) - simpler and more elastic for players.
Please elaborate.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those 3 separate options that apply for both in fight and out of combat is fine. Mask would be ok as well, but I don't really see why someone would want to set it up completely different for combat/out of combat, so simpler is better here i think.

ShowCurrWeapProtOnly = showTargetProtectionValue == 1;
ShowProtOnlyInFight = zoptions->ReadBool(PLUGIN_NAME, "ShowProtOnlyInFight", true);
ShowProtAllDamageTypes = zoptions->ReadBool(PLUGIN_NAME, "ShowProtAllDamageTypes", false);
ShowTargetProtectionNoFight = zoptions->ReadInt(PLUGIN_NAME, "ShowTargetProtectionNoFight", TargetProtectionMode::AllButZeros);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be disabled by default.

@Franisz
Copy link
Owner

Franisz commented Feb 1, 2026

01-02-2026_12-07-39

With using dmg icons now spacing looks bad in case of some icons. Maybe just increase the spacing a bit.

@Myszax
Copy link
Contributor Author

Myszax commented Feb 3, 2026

01-02-2026_12-07-39

With using dmg icons now spacing looks bad in case of some icons. Maybe just increase the spacing a bit.

Sure it looks odd.
I've added same spacing for both versions. It looks kinda long :P
obraz
obraz
Idk, maybe i should add it (or increase further) only to dmg icons, but it looks better in both versions

@Franisz
Copy link
Owner

Franisz commented Feb 4, 2026

01-02-2026_12-07-39 With using dmg icons now spacing looks bad in case of some icons. Maybe just increase the spacing a bit.

Sure it looks odd. I've added same spacing for both versions. It looks kinda long :P obraz obraz Idk, maybe i should add it (or increase further) only to dmg icons, but it looks better in both versions

Spacing in both versions is fine. It's inevitable to further clutter the screen the more protections we want to display, that's why the default in plugin is single value in combat only.

Initially I also thought about listing it in column next to the npc, but dunno if that would be better.
04-02-2026_12-48-16

@Myszax
Copy link
Contributor Author

Myszax commented Feb 4, 2026

Quick preview
img
I don't know what to think about it 😃
Emm this could be added like an another option, but idk.

@Franisz
Copy link
Owner

Franisz commented Feb 5, 2026

I think its fine as an option. It's definitely more readable especially for mods that tend to have some absurd prot values like 99999 in Odyssee for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants