Jump to content

return header # from GET_OFFSET_ARRAY?


Recommended Posts

Posted (edited)

Maybe I'm dense... I've had some success using GET_OFFSET_ARRAY to retrieve information about spell and item headers, but it still seems a bit obtuse at times. So, at the moment I have something like this to detect all items with abilities that use the GAZE projectile:

OUTER_SET ind = 0
COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
  PATCH_IF (%SOURCE_SIZE% > 0x71) BEGIN
    READ_SHORT 0x68 num_ab
    PATCH_IF (num_ab > 0) BEGIN
      GET_OFFSET_ARRAY ab_array ITM_V10_HEADERS
      PHP_EACH ab_array AS int => ab_off BEGIN
        READ_SHORT (ab_off + 0x2a) itm_proj
        PATCH_IF (itm_proj = 65) BEGIN
          SET ind = (ind + 1)
          [detect which header this is]
          SPRINT $gazeitems(~%ind%~ ~%SOURCE_RES%~)~%header_#%~
        END
      END
    END
  END
BUT_ONLY

Later I'm going to want to copy the items in that array and patch the particular headers in some way:

ACTION_PHP_EACH gazeitems AS ind => head BEGIN
  COPY_EXISTING ~%ind_1%.itm~ ~override~
    LPF ALTER_EFFECT INT_VAR header = %head% match_opcode = x timing = y duration = z END [etc.]
  IF_EXISTS BUT_ONLY
END

Question is, how do I record the particular header numbers in the array?

Edited by subtledoctor
Posted (edited)
Quote

PHP_EACH ab_array AS ab_num => ab_off BEGIN
...

SPRINT $gazeitems(~%ind%~ ~%SOURCE_RES%~) ~%ab_num%~

or something

Edited by Magus

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...