Gez
Why don't I have a custom title by now?!
Posts: 15174
Registered: 0707 
Basically, the maximum damage is equal to the maximum distance, which is 128 units. If you are 128 units away from the exploding barrel, you take 128128=0 damage. 127 units away? 1 damage. 8 units away? 120 damage.
Your radius is taken into account, and a player's radius is 16. So your player's center point needs to be 128+16=144 units away to get no damage.
And the distance being computed simplistically only as the greater of the two distances on the X and Y axes means that if you are 100 units away on the X axis and 100 units away on the Y axis, you aren't further away than if you are 100 units away on either axis and 0 units away on the other, even if trigonometry would tell you that in the former case, you are actually 141 units away from the center of the explosion. So the apparent distance, depending on the angle, can be greater than the effective distance.
Note that 128 damage/128 distance means that this is identical to a rocket's splash damage. This is the standard splash damage in Doom, only the archvile's blast differs. The rocket does deal an additional amount of random damage, but only if you get a direct hit  the splash damage itself is never random and depends only on the distance.
Of course, some ports allow to change that. For example, ZDoom allows to define a distance within which full damage are applied, and you can use random values for the parameters.
