New armour bug: blue and green armour add
In Doom, picking up green armour, some helmets and blue armour after one another results in having an armour value of more than 300%. Actually, armour addition should stop at 200%. Tested in Doom2 with high-res textures and models activated. This bug seems to be a result of the fix of bug #2642596.
#1 Updated by xrdvx about 13 years ago
Maybe caused because the armor is added totally and not point by point... If the armor points are added one by one, you can stop them at 200%...
I'm just speculating... Of course that will cause more usage of computer resources, but, is a solution.
Other way, is make: 200 - (added armor + actual armor): if added armor + actual armor is bigger than 200, then set actual armor to 200, if less or equal, just pust the result of the (added + actual).
There you got another solution.
#3 Updated by skyjake about 13 years ago
(originally posted by anonymous SF.net user)
Looks to me like P_GiveArmor in p_inter.c is simply behaving incorrectly. P_GiveArmor is called in three cases in jDoom; on picking up the green armor, the blue armor, or the megasphere. The green armor makes your armor total exactly 100 if it was less; the blue armor and the megasphere make your armor total exactly 200 if it was less. None of them adds any fixed amount to your armor total.
As such, P_GiveArmor should call P_PlayerGiveArmorBonus(plr, points - plr->armorPoints) and not P_PlayerGiveArmorBonus(plr, points). The check above already ensures that this value will be positive, and the 200 cap is maintained, not artificially, but because the blue armor gives 200. The armor bonus has its own check, which is also against the blue armor, and which doesn't need fixing.
Anyway, I can confirm from other ports and from testing that this is the correct fix for jDoom. I believe the exact same one line fix to P_GiveArmor is also correct for jHeretic and jHexen but I can't promise :)