: And I'm still curious as to how HP gets divided by three to make the damage
: thing in the first place.
Note to future hackers: Loren's "Unknown4a" field (4 bytes following damage taken, offset 190) stores damage inflicted. This number is divided by 3, and rounded down, for display on the carnage screen. Editing the body count or accuracy stats do not affect the damage reported; it's a separate value.
At first, I was surprised this wasn't documented before now. But, it's much harder to spot if you don't know internal damage is divided by 3. Thanks, Andrew, I couldn't have done it without you!
After tweaking these stored numbers, I found that the displayed damage ratio handles up to 327.67 and then fails, flipping to -327.-68 and counting down from there. The rest is obvious to a programmer -- the code would be something like:
Sint16 ratio = ((inflicted / 3) / taken) * 100;
Sint16 ratio_whole = ratio / 100;
Sint16 ratio_frac = ratio % 100;
At this point, you'd inflicted 114,308 internal damage points and taken 60 damage points. The math works out like so:
- 114,308 / 3 = 38102.67
- 38102.67 / 60 = 635.04
- 635.04 * 100 = 63504
- When stored as a signed 16-bit integer, 63504 becomes 65536 - 63504 = -2032
- Splitting -2032 for the whole-number and fractional parts gives -20 and -32