Skip to content

Commit

Permalink
Fix typos and spawn scrolls as quick item.
Browse files Browse the repository at this point in the history
Also filter out SCS debug spellbook and tutorial scrolls.
  • Loading branch information
GraionDilach committed Mar 3, 2022
1 parent 584fa3f commit be9570a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
36 changes: 19 additions & 17 deletions zgtweaks/library/setup_scrolls.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,32 @@ DEFINE_ACTION_FUNCTION setup_random_scrolls BEGIN
OUTER_TEXT_SPRINT scrolllv8 ~ZGTRWS8 ~
OUTER_TEXT_SPRINT scrolllv9 ~ZGTRWS9 ~

OUTER_TEXT_SPRINT exclusions ~TTSCRL01 TTSCRL02 DW#ALLSP~

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
PATCH_IF (SOURCE_SIZE > 0x71) BEGIN
GET_OFFSET_ARRAY headers ITM_V10_HEADERS
PHP_EACH headers AS int => hoff BEGIN
GET_OFFSET_ARRAY2 fx hoff ITM_V10_HEAD_EFFECTS
PHP_EACH fx AS intj => foff BEGIN
READ_SHORT foff opcode
PATCH_IF (opcode = 147) BEGIN
READ_ASCII (foff + 0x14) splres
SNPRINT (0 - 3) the_res ~%splres%~
SNPRINT 1 the_level ~%the_res%~
SPRINT spell_level ~scrolllv%the_level%~
INNER_ACTION BEGIN
ACTION_IF NOT (EVAL ~%splres%~ STRING_CONTAINS_REGEXP ~SPWI~) THEN BEGIN
ACTION_IF (EVAL ~%%spell_level%%~ STRING_CONTAINS_REGEXP EVAL ~%SOURCE_RES%~) THEN BEGIN
GET_OFFSET_ARRAY headers ITM_V10_HEADERS
PHP_EACH headers AS int => hoff BEGIN
GET_OFFSET_ARRAY2 fx hoff ITM_V10_HEAD_EFFECTS
PHP_EACH fx AS intj => foff BEGIN
READ_SHORT foff opcode
PATCH_IF (opcode = 147) BEGIN
READ_ASCII (foff + 0x14) splres
SNPRINT (0 - 3) the_res ~%splres%~
SNPRINT 1 the_level ~%the_res%~
SPRINT spell_level ~scrolllv%the_level%~
INNER_ACTION BEGIN
ACTION_IF NOT (EVAL ~%splres%~ STRING_CONTAINS_REGEXP ~SPWI~) THEN BEGIN
ACTION_IF (EVAL ~%%spell_level%%~ STRING_CONTAINS_REGEXP EVAL ~%SOURCE_RES%~) THEN BEGIN
ACTION_IF (EVAL ~%%exclusions%%~ STRING_CONTAINS_REGEXP EVAL ~%SOURCE_RES%~) THEN BEGIN
OUTER_TEXT_SPRINT EVAL ~%spell_level%~ EVAL ~%%spell_level%% %SOURCE_RES%~
END
END
END
END
END
END
END
BUT_ONLY
END
END
BUT_ONLY

ACTION_IF !FILE_EXISTS_IN_GAME "rndtres.2da" BEGIN
<<<<<<<< ./inlined/rndtres.2da
Expand Down
16 changes: 8 additions & 8 deletions zgtweaks/zgtweaks.tp2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
END
PATCH_IF (max_spell_level > 0) BEGIN
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -62,7 +62,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
PATCH_IF (max_spell_level > 4) BEGIN
SET secondary_spell_level = max_spell_level - 4
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -93,7 +93,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
END
PATCH_IF (max_spell_level > 0) BEGIN
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%M~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%M~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -125,7 +125,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
PATCH_IF (max_spell_level > 4) BEGIN
SET secondary_spell_level = max_spell_level - 4
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%M~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%M~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -157,7 +157,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
END
PATCH_IF (max_spell_level > 0) BEGIN
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -189,7 +189,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
PATCH_IF (max_spell_level > 4) BEGIN
SET secondary_spell_level = max_spell_level - 4
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -220,7 +220,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
END
PATCH_IF (max_spell_level > 0) BEGIN
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%M~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%max_spell_level%M~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY
Expand Down Expand Up @@ -252,7 +252,7 @@ REQUIRE_PREDICATE (GAME_IS ~bgee bg2ee iwdee eet~) @1000
END
PATCH_IF (max_spell_level > 4) BEGIN
SET secondary_spell_level = max_spell_level - 4
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%M~ #1 #0 #0 ~NONE~ ~INV~
ADD_CRE_ITEM ~ZGTRWS%secondary_spell_level%M~ #1 #0 #0 ~NONE~ ~QITEM INV~
END
SET max_spell_level = 0
BUT_ONLY

0 comments on commit be9570a

Please sign in to comment.