#14427 closed defect (fixed)

XEEN: negative toHit underflow

Reported by: yarolig Owned by: dreammaster
Priority: low Component: --Unset--
Version: Keywords:
Cc: Game:

Description

Wooden and leather weapons should have toHit penalties.

But instead I have a wooden mace with "to Hit Modifier: +253".
And it hits really well!

branch 2-5-1 and 2-7.
World of Xeen version from ticket https://bugs.scummvm.org/ticket/12559

Change History (2)

comment:1 by yarolig, 15 months ago

My hack to fix it:

diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index e830d11491d..6fa09c5b48b 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -146,6 +146,13 @@ void Resources::loadData() {
        file.syncNumbers(METAL_DAMAGE, 22);
        file.syncNumbers(METAL_DAMAGE_PERCENT, 22);
        file.syncNumbers(METAL_LAC, 22);
+
+       for (int a = 0; a < 22; ++a) {
+               if (METAL_DAMAGE_PERCENT[a] > 127) {
+                       METAL_DAMAGE_PERCENT[a] -= 255;
+               }
+       }
+
        file.syncNumbers(ARMOR_STRENGTHS, 14);
        file.syncNumbers(MAKE_ITEM_ARR1, 6);
        file.syncNumbers3D((int *)MAKE_ITEM_ARR2, 6, 7, 2);

comment:2 by dreammaster, 15 months ago

Owner: set to dreammaster
Resolution: fixed
Status: newclosed

Thanks for the report, and good catch, no matter how unintendedly beneficial it was :). I decided to fix the numbers at the source in the create_xeen tool, since for the next release with the merge of Might and Magic 1 we're going to have to re-generate the data file anyway.

Note: See TracTickets for help on using tickets.