Skip to content

Commit

Permalink
v43
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDawg committed Dec 9, 2017
1 parent 978201b commit 418d4a8
Show file tree
Hide file tree
Showing 12 changed files with 947 additions and 760 deletions.
Binary file modified itemupgrade/itm/c2amul01.itm
Binary file not shown.
Binary file modified itemupgrade/itm/c2leat01.itm
Binary file not shown.
2 changes: 1 addition & 1 deletion itemupgrade/languages/american/setup.tra
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Speed Factor: 0
Proficiency Type: Quarterstaff
Type: 2-handed
Requires: 5 Strength
Usable By
Usable By:
Druids
Beast-Masters~

Expand Down
1,286 changes: 636 additions & 650 deletions itemupgrade/languages/polski/setup_ee.tra

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions itemupgrade/lib/ee_game.tpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// Available usability patterns
/*
OUTER_TEXT_SPRINT regexpUsable_EN ~^.*[Uu]sable by ?:\(.*\|[%WNL%]*\)*~
OUTER_TEXT_SPRINT regexpUsable_DE ~^.*[Vv]erwendet werden von ?:\(.*\|[%WNL%]*\)*~
OUTER_TEXT_SPRINT regexpUsable_ES ~^.*[Pp]uede usar ?:\(.*\|[%WNL%]*\)*~
OUTER_TEXT_SPRINT regexpUsable_FR ~^.*[Uu]tilisable par ?:\(.*\|[%WNL%]*\)*~
OUTER_TEXT_SPRINT regexpUsable_KO ~^.*사용\( *불가\)? ?:\(.*\|[%WNL%]*\)*~
OUTER_TEXT_SPRINT regexpUsable_PL ~^.*[Mm]oże używać ?:\(.*\|[%WNL%]*\)*~
OUTER_TEXT_SPRINT regexpUsable_RU ~^.*[Ии]спользуется ?:\(.*\|[%WNL%]*\)*~
*/

ACTION_IF ("%LANGUAGE%" STRING_COMPARE_CASE "russian" = 0) BEGIN

OUTER_TEXT_SPRINT regexpUsable ~^.*[Ии]спользуется ?:\(.*\|[%WNL%]*\)*~ // russian

END ELSE BEGIN

OUTER_TEXT_SPRINT regexpUsable ~^.*사용\( *불가\)? ?:\(.*\|[%WNL%]*\)*~ // korean

END

OUTER_TEXT_SPRINT regexpUsable ~^.*[Uu]sable by ?:?\(.*\|[%WNL%]*\)*~

/**
* Attempts to remove usability section from the specified (item description) string.
*
* INT_VAR autodetect Set to nonzero to update string only if an Enhanced Edition game is detected.
* (Default: 1)
* STR_VAR desc Text that should be updated. Can be either a literal string, tra reference (@1234)
* or strref value (#1234).
* STR_VAR title The item name to remove from the top of description text (if any).
* STR_VAR regexp The regular expression used to match the string section that will be removed.
* Use one of the predefined regexp definitions for best results.
* RET updated_desc The updated string. Returns an empty string on error.
*/
DEFINE_PATCH_FUNCTION ITEM_DESC_TO_EE
INT_VAR
autodetect = 1
STR_VAR
desc = ~~
title = ~~
regexp = ~~
RET
updated_desc
BEGIN
TEXT_SPRINT updated_desc ~~

// resolving string references
LPF GET_STRING_REFERENCE STR_VAR refString = EVAL ~%desc%~ RET string END
TEXT_SPRINT desc ~%string%~
LPF GET_STRING_REFERENCE STR_VAR refString = EVAL ~%title%~ RET string END
TEXT_SPRINT title ~%string%~
LPF ESCAPE_REGEXP STR_VAR string = EVAL ~%title%~ RET result END
TEXT_SPRINT title ~%result%~

PATCH_IF (NOT autodetect OR GAME_IS ~bgee bg2ee eet~) BEGIN
INNER_PATCH_SAVE updated_desc ~%desc%~ BEGIN
PATCH_IF (NOT ~%title%~ STRING_EQUAL ~~) BEGIN
REPLACE_TEXTUALLY ~^[ %TAB%]*%title%[ %TAB%]*[%WNL%]+~ ~~
END
REPLACE_TEXTUALLY ~%regexp%~ ~~
END
END ELSE BEGIN
TEXT_SPRINT updated_desc ~%desc%~
END
END


// Internally used to resolve string references into literal strings
DEFINE_PATCH_FUNCTION GET_STRING_REFERENCE
STR_VAR refString = ~~
RET string
BEGIN
TEXT_SPRINT string ~~

PATCH_IF (~%refString%~ STRING_MATCHES_REGEXP ~[@#]-?[0-9]+~ != 0) BEGIN
PATCH_IF (~%refString%~ STRING_CONTAINS_REGEXP ~"~ != 0) BEGIN
TEXT_SPRINT refString ~"%refString%"~
END ELSE PATCH_IF (~%refString%~ STRING_CONTAINS_REGEXP "~" != 0) BEGIN
TEXT_SPRINT refString "~%refString%~"
END ELSE BEGIN
TEXT_SPRINT refString "~~~~~%refString%~~~~~"
END
END

INNER_ACTION BEGIN
<<<<<<<< .../inlined/a7_get_string.tpp
SPRINT resolved
>>>>>>>>
SILENT
COPY - ~.../inlined/a7_get_string.tpp~ ~.../inlined/a7_get_string.tpp~
INSERT_BYTES SOURCE_SIZE (STRING_LENGTH ~%refString%~)
WRITE_ASCIIE SOURCE_SIZE ~%refString%~
VERBOSE
END

PATCH_REINCLUDE ~.../inlined/a7_get_string.tpp~

TEXT_SPRINT string ~%resolved%~
END


// Makes sure that the given string does not contain any special regular expression characters
DEFINE_PATCH_FUNCTION ESCAPE_REGEXP
STR_VAR string = ~~
RET result
BEGIN
INNER_PATCH_SAVE result ~%string%~ BEGIN
REPLACE_TEXTUALLY EXACT_MATCH ~?~ ~\?~
REPLACE_TEXTUALLY EXACT_MATCH ~*~ ~\*~
REPLACE_TEXTUALLY EXACT_MATCH ~+~ ~\+~
REPLACE_TEXTUALLY EXACT_MATCH ~[~ ~\[~
REPLACE_TEXTUALLY EXACT_MATCH ~]~ ~\]~
END
END





ACTION_FOR_EACH item IN
c2amul01 c2anom01 c2ax1h01 c2belt01 c2blun01 c2blun02 c2blun03 c2boot01 c2boot02 c2boot03 c2boot04 c2bow01 c2brac01 c2chan01 c2dagg01 c2hd1 c2hd2 c2helm01
c2helm02 c2hide01 c2keld01 c2keld02 c2kit c2mazz01 c2plat01 c2ring01 c2ring02 c2ring03 c2ring04 c2robe01 c2robe02 c2robe03 c2shld01 c2shld02 c2sper01
c2sper02 c2sper03 c2staf01 c2staf02 c2sw1h01 c2sw1h02 c2sw1h03 c2sw2h01 c2valy01
c2leat01 c2quiv01 c2quiv02 c2quiv03 c2sw2h02 // these five are tob-only
BEGIN

COPY_EXISTING ~%item%.itm~ ~override~
READ_STRREF 0x0c itm_title
READ_STRREF 0x54 itm_desc
LPF ITEM_DESC_TO_EE STR_VAR desc = EVAL ~%itm_desc%~ title = EVAL ~%itm_title%~ regexp = EVAL ~%regexpUsable%~ RET updated_desc END
SAY 0x54 ~%updated_desc%~
BUT_ONLY IF_EXISTS

END
23 changes: 22 additions & 1 deletion itemupgrade/lib/items_common.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2amul01.itm THEN BEGIN
COPY ~itemupgrade/itm/c2amul01.itm~ ~override~
SAY NAME2 @180
SAY DESC @181
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR insert_point = "-1" opcode = 318 target = 1 timing = 2 STR_VAR resource = wand13 END // ee protection from wand of cloudkill
END

COPY ~itemupgrade/bam/c2amul01.bam~ ~override~

Expand All @@ -47,6 +50,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2anom01.itm THEN BEGIN
COPY ~itemupgrade/itm/c2anom01.itm~ ~override~
SAY NAME2 @166
SAY DESC @167
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 319 target = 1 power = 1 parameter2 = 11 timing = 2 special = 9138 STR_VAR resource = ANOMEN END
END

COPY ~itemupgrade/bam/c2anom01.bam~ ~override~

Expand Down Expand Up @@ -197,6 +203,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2hd1.itm THEN BEGIN
COPY ~itemupgrade/itm/c2hd1.itm~ ~override~
SAY NAME2 @193
SAY DESC @194
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 319 target = 1 power = 1 parameter1 = 153 parameter2 = 4 timing = 2 special = 8332 END
END

COPY ~itemupgrade/bam/c2hd1.bam~ ~override~

Expand All @@ -207,6 +216,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2hd2.itm THEN BEGIN
COPY ~itemupgrade/itm/c2hd2.itm~ ~override~
SAY NAME2 @195
SAY DESC @196
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 319 target = 1 power = 1 parameter1 = 153 parameter2 = 4 timing = 2 special = 8332 END
END

END

Expand All @@ -231,7 +243,7 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2helm02.itm THEN BEGIN
END

ACTION_IF NOT FILE_EXISTS_IN_GAME c2hide01.itm THEN BEGIN

COPY ~itemupgrade/itm/c2hide01.itm~ ~override~
SAY NAME2 @140
SAY DESC @141
Expand All @@ -254,6 +266,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2keld01.itm THEN BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 267 target = 1 parameter1 = 1280 timing = 2 END // prevent 'stunned' string
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 267 target = 1 parameter1 = 14043 timing = 2 END // prevent 'stun' string
END
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 319 target = 1 power = 1 parameter2 = 11 timing = 2 special = 9144 STR_VAR resource = KELDORN END
END

COPY ~itemupgrade/bam/c2keld01.bam~ ~override~

Expand All @@ -277,6 +292,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2keld02.itm THEN BEGIN
LPF DELETE_EFFECT INT_VAR match_opcode = 240 match_parameter2 = 48 END // remove icon: feeblemind
LPF DELETE_EFFECT INT_VAR match_opcode = 240 match_parameter2 = 112 END // remove icon: deaf
END
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 319 target = 1 power = 1 parameter2 = 11 timing = 2 special = 9144 STR_VAR resource = KELDORN END
END

COPY ~itemupgrade/bam/c2keld02.bam~ ~override~

Expand Down Expand Up @@ -553,6 +571,9 @@ ACTION_IF NOT FILE_EXISTS_IN_GAME c2valy01.itm THEN BEGIN
COPY ~itemupgrade/itm/c2valy01.itm~ ~override~
SAY NAME2 @128
SAY DESC @129
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR opcode = 319 target = 1 power = 1 parameter2 = 11 timing = 2 special = 9158 STR_VAR resource = VALYGAR END
END

COPY ~itemupgrade/bam/c2valy01.bam~ ~override~

Expand Down
9 changes: 8 additions & 1 deletion itemupgrade/lib/soa.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ EXTEND_BOTTOM ~AR0334.bcs~ ~itemupgrade/crom/AR0334.baf~
COMPILE ~itemupgrade/dlg/riftg03.d~

// prompts random StringHeads if Lil +5 is being used
EXTEND_BOTTOM ~baldur.bcs~ ~itemupgrade/bcs/lilarcor.baf~
EXTEND_BOTTOM ~baldur.bcs~ ~itemupgrade/bcs/lilarcor.baf~

ACTION_IF ee_game = 2 BEGIN

INCLUDE ~itemupgrade/lib/ee_game.tpa~ // function to redo descriptions

END

11 changes: 10 additions & 1 deletion itemupgrade/lib/tob.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ INCLUDE ~itemupgrade/lib/items_common.tpa~
COPY ~itemupgrade/itm/c2leat01.itm~ ~override~
SAY NAME2 @142
SAY DESC @143
PATCH_IF ee_game BEGIN
LPF ADD_ITEM_EQEFFECT INT_VAR insert_point = "-1" opcode = 318 target = 1 timing = 2 STR_VAR resource = wand13 END // ee protection from wand of cloudkill
END

COPY ~itemupgrade/itm/c2quiv01.itm~ ~override~
SAY NAME2 @108
Expand Down Expand Up @@ -53,4 +56,10 @@ COPY_EXISTING ~quiver01.itm~ ~override~
COPY_EXISTING ~quiver02.itm~ ~override~
~quiver04.itm~ ~override~
WRITE_ASCII 0x44 ~gquiver0~
BUT_ONLY
BUT_ONLY

ACTION_IF ee_game = 2 BEGIN

INCLUDE ~itemupgrade/lib/ee_game.tpa~ // function to redo descriptions

END
File renamed without changes.
Loading

0 comments on commit 418d4a8

Please sign in to comment.