And if it exists, convert the BMP to a BAM and patch the ITM to use this BAM as its description image?
Converting it is unnecessary, those BMP work for description images as well as BAM.
COPY_EXISTING_REGEXP ~.*\.itm~ override
READ_ASCII 0x58 c_image
PATCH_IF ~%c_image%~ STRING_EQUAL ~~ BEGIN
PATCH_IF FILE_EXISTS_IN_GAME ~C%SOURCE_RES%.BMP~ BEGIN // Try item filename
WRITE_EVALUATED_ASCII 0x58 ~C%SOURCE_RES%~
END ELSE BEGIN
READ_ASCII 0x3a i_image (8)
INNER_PATCH_SAVE i_image ~%i_image%~ BEGIN WRITE_ASCII 0 ~C~ #1 END
PATCH_IF FILE_EXISTS_IN_GAME ~%i_image%.BMP~ BEGIN // Try item inventory icon
WRITE_EVALUATED_ASCII 0x58 ~C%i_image%~
END ELSE BEGIN
READ_ASCII 0x44 g_image (8)
INNER_PATCH_SAVE g_image~%g_image%~ BEGIN WRITE_ASCII 0 ~C~ #1 END
PATCH_IF FILE_EXISTS_IN_GAME ~%g_image%.BMP~ BEGIN // Try item ground icon
WRITE_EVALUATED_ASCII 0x58 ~C%g_image%~
END
END
END
END
BUT_ONLY
Unfortunately a lot (if not all) of the IWD-unique items (all the U- and ZZ- prefixed items) don't have any such graphics specific to them. As well, a lot of the description graphics from BG1/2EE are not present in IWDEE.
Thanks a lot for the code Just a tiny details, I think it will copy all itms in the override folder. Is it possible to only copy the ones that will be patched?
The last line BUT_ONLY tells WeiDU to copy only itm files that have been patched.
The problem is that the UI automatically rescale bitmaps to use all available space (where bams are displayed using there own sizes) and I don't think there is a way to change this behavior As they can have different sizes and you can't query it in the UI, you can't set the correct area size.
If you wish, I can have a look on the way to convert on the fly the existing bmp files. But creating bam files with WeiDU is not that easy. The last time I wrote a WeiDU routine for that purpose (converting legacy inventory bam - classical games - to v2 format - EE), it took me about a whole week.
Comments
Unfortunately a lot (if not all) of the IWD-unique items (all the U- and ZZ- prefixed items) don't have any such graphics specific to them. As well, a lot of the description graphics from BG1/2EE are not present in IWDEE.