WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
90 stars 20 forks source link

Bug in debug message conditions and incorrect projectile number field size in fj_are_structure #86

Closed Argent77 closed 8 years ago

Argent77 commented 8 years ago

Two container-related debug messages are not displayed because offsets have been incorrectly calculated.

The "# of projectiles" field is 4 bytes big instead of 2 bytes.

You can apply this patch to solve the issues:

--- weidu/src/tph/include/fj_are_struct.tpa.orig    2016-11-06 14:52:56.050104000 +0100
+++ weidu/src/tph/include/fj_are_struct.tpa 2016-11-06 14:54:35.733805500 +0100
@@ -279,7 +279,7 @@
 END ELSE BEGIN
   TEXT_SPRINT $struct(0xc4 0xc8 0x04 0x034) note
 END
-TEXT_SPRINT $struct(0xcc 0xd0 0x02 0x01c) projectile
+TEXT_SPRINT $struct(0xcc 0xd0 0x04 0x01c) projectile
 PHP_EACH struct AS key => value BEGIN
   PATCH_IF ~%value%~ STRING_EQUAL_CASE ~%fj_structure_type%~ BEGIN
     SET fj_structure_type = key_0
@@ -386,7 +386,7 @@

         // load container vertices
         GET_OFFSET_ARRAY2 array off ARE_V10_CONTAINER_VERTICES
-        PATCH_IF( fj_debug && LONG_AT 0x54 )BEGIN PATCH_PRINT ~  Associating vertices.~ END
+        PATCH_IF( fj_debug && LONG_AT ( off + 0x54 ) )BEGIN PATCH_PRINT ~  Associating vertices.~ END
         PHP_EACH array AS num1 => off1 BEGIN
           READ_LONG off1 $EVAL ~are_container_%num%_vertex~(~%num1%~)
         END
@@ -394,7 +394,7 @@

         // load container items
         GET_OFFSET_ARRAY2 array off ARE_V10_ITEMS
-        PATCH_IF( fj_debug && LONG_AT 0x44 )BEGIN PATCH_PRINT ~  Associating items.~ END
+        PATCH_IF( fj_debug && LONG_AT ( off + 0x44 ) )BEGIN PATCH_PRINT ~  Associating items.~ END
         PHP_EACH array AS num1 => off1 BEGIN
           READ_ASCII off1 $EVAL ~are_container_%num%_itm~(~%num1%~) (0x14)
         END
FredrikLindgren commented 8 years ago

Fixed. Thanks.