Jump to content

Illithid component corrupts sw2h21.itm


the bigg

Recommended Posts

The corruption breaks installation of iiLearnThroughUse over SCSII - Illithids. I tested this with subcomponent 290 (same resistances, see invisible).

 

The COPY_EXISTING routine at lines 409~460 of scsII/psionics/psionic.tph deletes the equipped effects from the ITM file, without updating the indexes of all extended headers that follow in the file structure.

 

Here is code that fixes the problem: I remove equipped effects before the extended headers one, and increase num_removed even for those.

					COPY_EXISTING ~%objectname%%abend%~ ~override~
					READ_LONG 0x64 ~ab_off~
					READ_SHORT 0x68 ~num_abs~
					READ_LONG 0x6a ~eff_off~
					READ_SHORT 0x70 ~eff_global~
					SET ~num_removed~=0
					SET ~numtotal~=0
					SET ~k~=0
					WHILE (~%k%~<~%eff_global%~) BEGIN
						READ_ASCII 0x14+~%k%~*0x30+~%numtotal%~*0x30+~%eff_off%~ ~rescheck~ 
						SET ~deleteme~=0
						FOR (l=0;l<~%exemptcount%~;l=l+1) BEGIN
							PATCH_IF $exempt(~%l%~) STRING_EQUAL_CASE ~%rescheck%~ THEN BEGIN
								SET ~deleteme~=1
							END
						END
							PATCH_IF ~%deleteme%~=1 THEN BEGIN
							SET ~eff_global~=~%eff_global%~-1
							DELETE_BYTES ~%k%~*0x30+~%numtotal%~*0x30+~%eff_off%~ 0x30
							SET ~num_removed~=~%num_removed%~+1
						END ELSE BEGIN
							SET ~k~=~%k%~+1
						END
					END
					WRITE_SHORT 0x70 ~%eff_global%~
					FOR (j=0;j<~%num_abs%~;j=j+1) BEGIN
						READ_SHORT 0x20+~%absize%~*~%j%~+~%ab_off%~ ~eff_index~
						SET ~eff_index~=~%eff_index%~-~%num_removed%~
						WRITE_SHORT 0x20+~%absize%~*~%j%~+~%ab_off%~ ~%eff_index%~
						READ_SHORT 0x1e+~%absize%~*~%j%~+~%ab_off%~ ~effhere~
						SET ~k~=0
						WHILE (~%k%~<~%effhere%~) BEGIN
							READ_ASCII 0x14+~%k%~*0x30+~%eff_index%~*0x30+~%eff_off%~ ~rescheck~
							SET ~deleteme~=0
							FOR (l=0;l<~%exemptcount%~;l=l+1) BEGIN
								PATCH_IF $exempt(~%l%~) STRING_EQUAL_CASE ~%rescheck%~ THEN BEGIN
									SET ~deleteme~=1
								END
							END

							PATCH_IF ~%deleteme%~=1 THEN BEGIN
								SET ~effhere~=~%effhere%~-1
								SET ~num_removed~=~%num_removed%~+1
								DELETE_BYTES ~%k%~*0x30+~%eff_index%~*0x30+~%eff_off%~ 0x30
							END ELSE BEGIN
								SET ~k~=~%k%~+1
								SET ~numtotal~=~%numtotal%~+1
							END
						END
						WRITE_SHORT 0x1e+~%absize%~*~%j%~+~%ab_off%~ ~%effhere%~
					END

				BUT_ONLY_IF_IT_CHANGES

 

I don't know if the problem is more widespread than this. Ideally, you might want to double-check all effect deletion / insertion routines.

Link to comment

Archived

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

×
×
  • Create New...