Jump to content

Holy Power


Nythrun

Recommended Posts

Argh. I #&*^$# hate missing header patches.

 

// holy power missing level 19, 20 abilities
COPY_EXISTING ~sppr412.spl~ ~override~
 READ_LONG  0x64 "abil_off"
 READ_SHORT 0x68 "abil_num"
 READ_LONG  0x6a "fx_off"
 READ_SHORT 0x70 "fx_num"
 SET "lev19_exist" = 0
 SET "lev20_exist" = 0
 SET "new_abil" = 0
 FOR (index = 0; index < abil_num; index = index + 1) BEGIN
READ_SHORT  ("%abil_off%" + 0x10 + (0x28 * "%index%")) "min_lev"
PATCH_IF ("%index%" = ("%abil_num%" - 1)) BEGIN // last header
  READ_SHORT  ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
  READ_SHORT  ("%abil_off%" + 0x20 + (0x28 * "%index%")) "abil_fx_idx"
  READ_ASCII  ("%abil_off%" + (0x28 * "%index%"))	   "abil_clone" (0x28)
  READ_ASCII  ("%fx_off%" + (0x30 * ("%abil_fx_idx%"))) "fx_clone" (0x30 * "%abil_fx_num%")
  SET "new_fx" = "%abil_fx_num%"
  SET "start_fx" = ("%abil_fx_idx%" + "%abil_fx_num%")
END ELSE
PATCH_IF ("%min_lev%" = 19) BEGIN
  SET "lev19_exist" = 1
END
PATCH_IF ("%min_lev%" = 20) BEGIN
  SET "lev20_exist" = 1
END
 END
 PATCH_IF ("%lev19_exist%" = 0) BEGIN
SET "level" = 19
INSERT_BYTES ("%fx_off%" + (0x30 * "%start_fx%")) (0x30 * "%new_fx%")
  WRITE_EVALUATED_ASCII ("%fx_off%" + (0x30 * "%start_fx%")) "%fx_clone%"
FOR (index2 = 0; index2 < new_fx; index2 = index2 + 1) BEGIN
  READ_SHORT ("%fx_off%" +		(0x30 * ("%index2%" + "%start_fx%"))) "opcode"
  PATCH_IF ("%opcode%" = 54) BEGIN // thac0 bonus
	WRITE_LONG ("%fx_off%" + 0x04 + (0x30 * ("%index2%" + "%start_fx%"))) (21 - "%level%")
  END ELSE
  PATCH_IF ("%opcode%" = 18) BEGIN // hp bonus
	WRITE_LONG ("%fx_off%" + 0x04 + (0x30 * ("%index2%" + "%start_fx%"))) "%level%"
  END
  READ_BYTE  ("%fx_off%" + 0x0c + (0x30 * ("%index2%" + "%start_fx%"))) "timing"
  READ_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%start_fx%"))) "duration"
  PATCH_IF (("%duration%" > 5) AND (("%timing%" = 0) OR ("%timing%" = 3))) BEGIN // for durations longer than a round, limited timing modes
	WRITE_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%start_fx%"))) (6 * "%level%")
  END
END
INSERT_BYTES			("%fx_off%"	   ) 0x28
  WRITE_EVALUATED_ASCII ("%fx_off%"	   ) "%abil_clone%"
  WRITE_SHORT		   ("%fx_off%" + 0x10) "%level%"
SET "new_abil" = "%new_abil%" + 1
SET "fx_off" = ("%fx_off%" + 0x28)
SET "start_fx" = ("%start_fx%" + "%new_fx%")
 END
 PATCH_IF ("%lev20_exist%" = 0) BEGIN
SET "level" = 20
INSERT_BYTES ("%fx_off%" + (0x30 * "%start_fx%")) (0x30 * "%new_fx%")
  WRITE_EVALUATED_ASCII ("%fx_off%" + (0x30 * "%start_fx%")) "%fx_clone%"
FOR (index2 = 0; index2 < new_fx; index2 = index2 + 1) BEGIN
  READ_SHORT ("%fx_off%" +		(0x30 * ("%index2%" + "%start_fx%"))) "opcode"
  PATCH_IF ("%opcode%" = 54) BEGIN // thac0 bonus
	WRITE_LONG ("%fx_off%" + 0x04 + (0x30 * ("%index2%" + "%start_fx%"))) (21 - "%level%")
  END ELSE
  PATCH_IF ("%opcode%" = 18) BEGIN // hp bonus
	WRITE_LONG ("%fx_off%" + 0x04 + (0x30 * ("%index2%" + "%start_fx%"))) "%level%"
  END
  READ_BYTE  ("%fx_off%" + 0x0c + (0x30 * ("%index2%" + "%start_fx%"))) "timing"
  READ_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%start_fx%"))) "duration"
  PATCH_IF (("%duration%" > 5) AND (("%timing%" = 0) OR ("%timing%" = 3))) BEGIN // for durations longer than a round, limited timing modes
	WRITE_LONG  ("%fx_off%" + 0x0e + (0x30 * ("%index2%" + "%start_fx%"))) (6 * "%level%")
  END
END
INSERT_BYTES			("%fx_off%"	   ) 0x28
  WRITE_EVALUATED_ASCII ("%fx_off%"	   ) "%abil_clone%"
  WRITE_SHORT		   ("%fx_off%" + 0x10) "%level%"
SET "new_abil" = "%new_abil%" + 1
SET "fx_off" = ("%fx_off%" + 0x28)
SET "start_fx" = ("%start_fx%" + "%new_fx%")
 END
 PATCH_IF ("%new_abil%" > 0) BEGIN
SET "abil_num" = ("%abil_num%" + "%new_abil%")
WRITE_SHORT 0x68 "%abil_num%"
WRITE_LONG  0x6a "%fx_off%"
// re-index everything
FOR (index = 0; index < abil_num; index = index + 1) BEGIN
  WRITE_SHORT ("%abil_off%" + 0x20 + (0x28 * "%index%")) "%fx_num%"
  READ_SHORT  ("%abil_off%" + 0x1e + (0x28 * "%index%")) "abil_fx_num"
  SET "fx_num" = "%fx_num%" + "%abil_fx_num%"
END
 END
 BUT_ONLY_IF_IT_CHANGES

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...