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

CLONE_EFFECT and ALTER_EFFECT should be able to write negative numbers #171

Closed 4Luke4 closed 9 months ago

4Luke4 commented 4 years ago

@CamDawg Pretty much what the title states.

As you know, there are a lot of opcodes whose parameter1 can take negative values. On top of that, the special field of some opcodes (e.g. Cast spell on condition when parameter2 = 15) can take negative values.

As a result, these functions should be able to write negative values (at least when it comes to parameter1 and special). In order to do that, I suggest the following changes:

4Luke4 commented 4 years ago

Actually, scratch that (the PATCH fails if you want to keep the existing value).

You should treat them as STR_VAR (default value SAME, like resource). However, you'll lose the ability to write numerical expressions (e.g. special = BIT30|BIT5) unless you're willing to further tweak those functions with PATCH_REINCLUDE.

4Luke4 commented 9 months ago

Closing this one since the desired behavior can be easily achieved with GET_OFFSET_ARRAY.

suy commented 9 months ago

Easily? 👀

I entirely gave up on doing it with WeiDU when I faced the issue of the negative number, and did a hand edited change to the file. A few weeks later I think an alternative function was posted (I think both DavidW and CamDawg have one, but that was some time ago...).