No, my alterations to the offset-adjusting code for ADD_CRE_EFFECT doesn't work so well with non-standard orders.
This works:
--- g_macros_original.tpa 2010-09-29 23:47:12.000000000 +0200
+++ g_macros.tpa 2010-10-26 23:39:59.406250000 +0200
@@ -496,10 +496,12 @@
WRITE_LONG 0x2c8 (___#fx_num + 1)
//correcting offsets
- PATCH_FOR_EACH ___#offset IN 0x2b8 0x2bc BEGIN //item slots offset and items offset
- READ_LONG ___#offset ___#current_off
- WRITE_LONG ___#offset (___#current_off + 0x30)
- END
+ PATCH_FOR_EACH ___#offset IN 0x2a0 0x2a8 0x2b0 0x2b8 0x2bc BEGIN
+ READ_LONG ___#offset ___#current_off
+ PATCH_IF ___#current_off >= ___#fx_off BEGIN
+ WRITE_LONG ___#offset (___#current_off + 0x30)
+ END
+ END
//reset vars
SET opcode = 0
@@ -580,7 +582,9 @@
//correcting offsets
PATCH_FOR_EACH ___#offset IN 0x2a0 0x2a8 0x2b0 0x2b8 0x2bc BEGIN
READ_LONG ___#offset ___#current_off
- WRITE_LONG ___#offset (___#current_off + 0x108)
+ PATCH_IF ___#current_off >= ___#fx_off BEGIN
+ WRITE_LONG ___#offset (___#current_off + 0x108)
+ END
END
//reset vars
@@ -624,13 +628,14 @@
DEFINE_PATCH_MACRO ~DELETE_CRE_EFFECT~ BEGIN
PATCH_IF (SOURCE_SIZE > 0x2c8) BEGIN
+ READ_BYTE 0x33 ___#fx_flag
READ_LONG 0x2c4 ___#fx_off
READ_LONG 0x2c8 ___#fx_num
SET ___#delta = 0
FOR (___#index1 = 0; ___#index1 < ___#fx_num; ___#index1 = ___#index1 + 1) BEGIN
- READ_LONG (___#fx_off + ___#index1 * 0x108 + 0x8) ___#opcode
+ READ_LONG (___#fx_off + ___#index1 * (___#fx_flag = 1 ? 0x108 : 0x30) + (___#fx_flag = 1 ? 0x8 : 0x0)) ___#opcode
PATCH_IF ((___#opcode = opcode_to_delete) OR (opcode_to_delete = (0 - 1))) BEGIN
- DELETE_BYTES (___#fx_off + ___#index1 * 0x108) 0x108
+ DELETE_BYTES (___#fx_off + ___#index1 * (___#fx_flag = 1 ? 0x108 : 0x30)) ___#fx_flag = 1 ? 0x108 : 0x30
SET ___#delta = ___#delta + 1 //track deleted number
SET ___#fx_num = ___#fx_num - 1 //decrease effects number to stop cycle properly
SET ___#index1 = ___#index1 - 1 //step back to not miss an effect
@@ -641,7 +646,9 @@
WRITE_LONG 0x2c8 ___#fx_num //corrected earlier
PATCH_FOR_EACH ___#offset IN 0x2a0 0x2a8 0x2b0 0x2b8 0x2bc BEGIN
READ_LONG ___#offset ___#current_off
- WRITE_LONG ___#offset (___#current_off - ___#delta * 0x108)
+ PATCH_IF ___#current_off > ___#fx_off BEGIN
+ WRITE_LONG ___#offset (___#current_off - ___#delta * (___#fx_flag = 1 ? 0x108 : 0x30))
+ END
END
END
@@ -667,8 +674,13 @@
SET ___#itm_num = ___#itm_num - 1
SET ___#delta = ___#delta + 1
- //correct islot offset
- WRITE_LONG 0x2b8 (___#islot_off - 0x14)
+ //correct offsets
+ PATCH_FOR_EACH ___#offset IN 0x2a0 0x2a8 0x2b0 0x2b8 0x2bc BEGIN
+ READ_LONG ___#offset ___#current_off
+ PATCH_IF ___#current_off > ___#itm_off BEGIN
+ WRITE_LONG ___#offset (___#current_off - ___#delta * 0x14)
+ END
+ END
FOR (___#cur_slot = 0; ___#cur_slot < 37; ___#cur_slot = ___#cur_slot + 1) BEGIN
READ_LONG 0x2b8 ___#islot_off
The QP dragon will still CTD the game if you try to add an EFF to it, however, since it's eff offset is 0.