Bug #980
Headshot code is wrong. Multiplies when what seems to be desired is an addition.
| Status: | Rejected | Start: | 01/06/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | - | Spent time: | - | |
| Target version: | - | |||
| Milestones: | ||||
| Votes: | 0 |
Description
Headshot code is wrong. Multiplies when what seems to be desired is an addition.
g_balance_rifle_primary_headshotaddeddamage suggests that what is desired is that the headshotdmg be added to the regular damage
The code in qcsrc/server/g_damage.qc is as thus:
damage *= 1 + damage_headshotbonus;
What was desired seems to be (damage*1)+damage_headshotbonus
because damage * (1+damage_headshotbonus) doesn't make much sence from a configuration standpoint (add a 1? why?)
However after testing it seems that the order of operations win out and that line up there is translated as just that
damage = damage * (1+damage_headshotbonus)
Code needs to be rewritten to add the damage rather than ... multiplying to one above whatever was put there in g_balance_rifle_primary_headshotaddeddamage
damage += damage_headshotbonus; ?
History
Updated by mand1nga 4 months ago
- Status changed from New to Rejected
Code work as intended, damage_headshotbonus would be the fraction of the original damage to added
Updated by nyov 4 months ago
yes, to clarify, what it does is multiply damage (which is a floating point number) with another float,
so it is "shorthand" for percentage calculations, in this case an addition.
damage = damage (as 100%) + bonus% (where 1.00 is 100%)
If 100% (original damage) equal 100 hp that means a bonus of 40hp would be 0.4