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
87 stars 19 forks source link

Script actions are not always decompiled correctly #207

Open Argent77 opened 2 years ago

Argent77 commented 2 years ago

The following script is not decompiled correctly in Enhanced Edition games:

IF
  True()
THEN
  RESPONSE #100
    UseItemSlotAbility(Myself,SLOT_AMULET,1)
END

Result after decompiling:

IF
  True()
THEN
  RESPONSE #100
    UseItemSlot(Myself,SLOT_AMULET)
END
FredrikLindgren commented 2 years ago

This happens with all overloaded opcodes. WeiDU resolves the ambiguity by taking whatever's at the top of the symbol stack (IIRC). I'd have to figure out some way of decompiling into the right symbol from the byte code. I'll have a closer look at some point, but I don't think it's a quick fix.