Skip to content

Commit

Permalink
Update function library
Browse files Browse the repository at this point in the history
  • Loading branch information
4Luke4 committed Jan 4, 2024
1 parent cfdf122 commit ac698f2
Show file tree
Hide file tree
Showing 31 changed files with 2,157 additions and 2,349 deletions.
901 changes: 0 additions & 901 deletions eefixpack/files/lib/gt_7eyes-o-matic.tph

This file was deleted.

764 changes: 377 additions & 387 deletions eefixpack/files/lib/gt_7eyes.tph

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions eefixpack/files/lib/gt_functions.tph
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,97 @@ BEGIN
END
OUTER_SET "count" += 1
END
END

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Language-independant version of WeiDU's native GET_STRREF
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

DEFINE_DIMORPHIC_FUNCTION "GT_GET_STRING"
INT_VAR
"strref" = 0
RET
"string"
BEGIN
OUTER_TEXT_SPRINT "string" ""
COPY - "lang\en_us\dialog.tlk" "override"
READ_LONG 0xE "base_off" // Offset to base data
READ_LONG (0x12 + 0x12 + ("%strref%" * 0x1A)) "off" // Relative offset of current string
READ_LONG (0x12 + 0x16 + ("%strref%" * 0x1A)) "length" // Length of this string
READ_ASCII ("%base_off%" + "%off%") "string" ("%length%")
BUT_ONLY_IF_IT_CHANGES
END

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

DEFINE_PATCH_FUNCTION ~ADD_SPELL_ABILITY~
INT_VAR
~type~ = 1 // Melee (should be irrelevant for `spl` files...)
~location~ = 4 // Ability (F13 button)
~target~ = 1 // Living actor
~#_targets~ = 0
~range~ = 30 // Default visual range
~minimum_level~ = 1
~casting_speed~ = 0
~projectile~ = IDS_OF_SYMBOL ("MISSILE" "None")
//
~copy_header~ = 0
~insert_point~ = ~-1~ // insert last
STR_VAR
~icon~ = ~~
RET
~insert_point~
BEGIN
//LPF ~FJ_SPL_ITM_REINDEX~ END
~hs~ = 0x28

READ_LONG 0x64 ~ho~
READ_SHORT 0x68 ~hc~
READ_LONG 0x6a ~eo~
~insert_point~ = ("%insert_point%" > "%hc%" || "%insert_point%" < 0) ? "%hc%" : "%insert_point%"
~copy_header~ = ("%copy_header%" < 0) ? 0 : "%copy_header%"

PATCH_IF "%copy_header%" > "%hc%" BEGIN
PATCH_WARN ~Unable to copy %copy_header%th header, "%DEST_FILE%" contains only %hc% headers!~
END ELSE BEGIN
INSERT_BYTES ("%ho%" + "%insert_point%" * "%hs%") "%hs%"
"hc" += 1
"eo" += "%hs%"
PATCH_IF "%copy_header%" BEGIN
READ_SHORT ("%ho%" + ("%copy_header%" - 1) * "%hs%" + 0x1e) "ec"
READ_SHORT ("%ho%" + ("%copy_header%" - 1) * "%hs%" + 0x20) "ei"
READ_ASCII ("%eo%" + "%ei%" * 0x30) "effs" ("%ec%" * 0x30)
READ_ASCII ("%ho%" + ("%copy_header%" - 1) * "%hs%") "copy" ("%hs%")
WRITE_ASCII ("%ho%" + "%insert_point%" * "%hs%") ~%copy%~ ("%hs%")
END
WRITE_SHORT 0x68 "%hc%"
WRITE_LONG 0x6a "%eo%"

READ_SHORT 0x70 "ei" // technically, it is a counter
FOR ("i" = "%ho%" ; "%i%" < "%ho%" + "%hc%" * "%hs%" ; "i" += "%hs%") BEGIN
READ_SHORT "%i%" + 0x1e "ec"
WRITE_SHORT "%i%" + 0x20 "%ei%"
"ei" += "%ec%"
END

PATCH_IF "%copy_header%" BEGIN
READ_SHORT ("%ho%" + "%insert_point%" * "%hs%" + 0x1e) "ec"
READ_SHORT ("%ho%" + "%insert_point%" * "%hs%" + 0x20) "ei"
INSERT_BYTES ("%eo%" + "%ei%" * 0x30) ("%ec%" * 0x30)
WRITE_ASCII ("%eo%" + "%ei%" * 0x30) ~%effs%~ ("%ec%" * 0x30)
END ELSE BEGIN
"off" = "%ho%" + "%insert_point%" * "%hs%"
WRITE_BYTE "%off%" "%type%"
WRITE_SHORT ("%off%" + 0x2) "%location%"
WRITE_ASCII ("%off%" + 0x4) ~%icon%~ #8
WRITE_BYTE ("%off%" + 0xc) "%target%"
WRITE_BYTE ("%off%" + 0xd) "%#_targets%"
WRITE_SHORT ("%off%" + 0xe) "%range%"
WRITE_SHORT ("%off%" + 0x10) "%minimum_level%"
WRITE_SHORT ("%off%" + 0x12) "%casting_speed%"
WRITE_SHORT ("%off%" + 0x26) "%projectile%"
END
END
END
41 changes: 26 additions & 15 deletions eefixpack/files/tph/bg2ee.tph
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ WITH_SCOPE BEGIN
END
END

/*
luke
"7eyes.2da" vs. SPL/ITM files
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/7eyes.tph"
LAUNCH_ACTION_FUNCTION "7EYES" END
END

/*
luke
**Wing Buffet vs. MR**
Expand Down Expand Up @@ -1449,11 +1458,23 @@ WITH_SCOPE BEGIN
/* Extended Header */
LPF "ALTER_SPELL_HEADER" INT_VAR "projectile" = IDS_OF_SYMBOL ("MISSILE" "Chain_Insect") END
PATCH_WITH_SCOPE BEGIN
SET "parameter2" = IDS_OF_SYMBOL ("STATS" "CLERIC_INSECT_PLAGUE")
GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
PHP_EACH "ab_array" AS "hdr" => "ab_off" BEGIN
LPF "COUNT_V10_HEAD_EFFECTS" STR_VAR "opcode" = "233" "parameter2" RET "count" END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 233 ~check_globals~ = 0 ~check_headers~ = (~%count%~ <= 1 ? 0 : 1) ~multi_match~ = (~%count%~ - 1) ~header~ = ~%hdr%~ ~match_parameter2~ = IDS_OF_SYMBOL ("STATS" "CLERIC_INSECT_PLAGUE") END
PHP_EACH "ab_array" AS "ab_ind" => "ab_off" BEGIN
SET "found" = 0
GET_OFFSET_ARRAY2 "fx_array" "%ab_off%" SPL_V10_HEAD_EFFECTS
PHP_EACH "fx_array" AS "fx_ind" => "fx_off" BEGIN
PATCH_MATCH SHORT_AT "%fx_off%" WITH
233 WHEN (LONG_AT ("%fx_off%" + 0x8) == IDS_OF_SYMBOL ("STATS" "CLERIC_INSECT_PLAGUE")) BEGIN
PATCH_IF !("%found%") BEGIN
SET "found" = 1
END ELSE BEGIN
WRITE_SHORT "%fx_off%" 999 // mark it for later deletion
END
END
DEFAULT
END
END
LPF ~DELETE_EFFECT~ INT_VAR ~match_opcode~ = 999 ~check_globals~ = 0 ~header~ = ~%ab_ind%~ END
END
END
BUT_ONLY_IF_IT_CHANGES
Expand Down Expand Up @@ -1585,14 +1606,4 @@ END

INCLUDE ~eefixpack/files/lib/cd_effect_batches_functions.tpa~ // function for effect batches
INCLUDE ~eefixpack/files/lib/cd_effect_batches_arrays_bg_bg2_iwd.tpa~ // array definitions for effect batches
INCLUDE ~eefixpack/files/tph/tbd_vfx_removal_bg2.tph~ // use effect batches to remove vfx from effects which have been removed

/*
luke
**"7eyes.2da" vs. SPL/ITM files**
- See "https://github.com/Gibberlings3/EE_Fixpack/pull/23" for further details
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack\files\lib\gt_7eyes-o-matic.tph"
LAF "GT_7EYES-O-MATIC" END
END
INCLUDE ~eefixpack/files/tph/tbd_vfx_removal_bg2.tph~ // use effect batches to remove vfx from effects which have been removed
21 changes: 10 additions & 11 deletions eefixpack/files/tph/bgee.tph
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ WITH_SCOPE BEGIN
END
END

/*
luke
"7eyes.2da" vs. SPL/ITM files
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/7eyes.tph"
LAUNCH_ACTION_FUNCTION "7EYES" END
END

/*
luke
**Wing Buffet vs. MR**
Expand Down Expand Up @@ -1923,14 +1932,4 @@ END

INCLUDE ~eefixpack/files/lib/cd_effect_batches_functions.tpa~ // function for effect batches
INCLUDE ~eefixpack/files/lib/cd_effect_batches_arrays_bg_bg2_iwd.tpa~ // array definitions for effect batches
INCLUDE ~eefixpack/files/tph/tbd_vfx_removal_bg.tph~ // use effect batches to remove vfx from effects which have been removed

/*
luke
**"7eyes.2da" vs. SPL/ITM files**
- See "https://github.com/Gibberlings3/EE_Fixpack/pull/23" for further details
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack\files\lib\gt_7eyes-o-matic.tph"
LAF "GT_7EYES-O-MATIC" END
END
INCLUDE ~eefixpack/files/tph/tbd_vfx_removal_bg.tph~ // use effect batches to remove vfx from effects which have been removed
4 changes: 2 additions & 2 deletions eefixpack/files/tph/dw_fixes.tph
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ LAF declutter INT_VAR write END
// Rearrange various orderings of effects; extract various effect blocks to subspells
// (Prepares for other changes, notably immunities_via_324)

INCLUDE "%library_path%/rearrange_itm_spl.tph"
LAF rearrange_itm_spl END
//INCLUDE "%library_path%/rearrange_itm_spl.tph"
//LAF rearrange_itm_spl END

// Sort out the various issues with 109/175/185 (this is the conservative bit)

Expand Down
27 changes: 14 additions & 13 deletions eefixpack/files/tph/iwdee.tph
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ END
luke
"7eyes.2da" vs. SPL/ITM files
*/
/*WITH_SCOPE BEGIN
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/7eyes.tph"
LAUNCH_ACTION_FUNCTION "7EYES" END
END*/
END

/*
luke
Expand Down Expand Up @@ -479,6 +479,17 @@ WITH_SCOPE BEGIN
BUT_ONLY_IF_IT_CHANGES
END

/*
luke
**Three White Doves +3**
- Redone from scratch via op326 (instead of op177)
- Fixed incorrect probability values
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/three_white_doves.tph"
LAUNCH_ACTION_FUNCTION "THREE_WHITE_DOVES" END
END

///// \\\\\
///// spell fixes \\\\\
///// \\\\\
Expand Down Expand Up @@ -989,14 +1000,4 @@ END

INCLUDE ~eefixpack/files/lib/cd_effect_batches_functions.tpa~ // function for effect batches
INCLUDE ~eefixpack/files/lib/cd_effect_batches_arrays_bg_bg2_iwd.tpa~ // array definitions for effect batches
INCLUDE ~eefixpack/files/tph/tbd_vfx_removal_iwd.tph~ // use effect batches to remove vfx from effects which have been removed

/*
luke
**"7eyes.2da" vs. SPL/ITM files**
- See "https://github.com/Gibberlings3/EE_Fixpack/pull/23" for further details
*/
WITH_SCOPE BEGIN
INCLUDE "eefixpack\files\lib\gt_7eyes-o-matic.tph"
LAF "GT_7EYES-O-MATIC" END
END
INCLUDE ~eefixpack/files/tph/tbd_vfx_removal_iwd.tph~ // use effect batches to remove vfx from effects which have been removed
120 changes: 61 additions & 59 deletions eefixpack/files/tph/luke/7eyes/7eyes.tph
Original file line number Diff line number Diff line change
@@ -1,66 +1,68 @@
DEFINE_ACTION_FUNCTION "7EYES"
DEFINE_ACTION_FUNCTION "7EYESification"
BEGIN
// Include function library
INCLUDE "eefixpack/files/lib/gt_7eyes.tph"
// Main
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/berserk.tph"
LAF "BERSERK" END
//
ACTION_MATCH 1 WITH
GAME_IS "bgee" BEGIN
OUTER_TEXT_SPRINT "game_folder" "bg1"
END
GAME_IS "bg2ee eet" BEGIN
OUTER_TEXT_SPRINT "game_folder" "bg2"
END
GAME_IS "iwdee" BEGIN
OUTER_TEXT_SPRINT "game_folder" "iwd"
END
DEFAULT
FAIL "Game not supported (should not happen)"
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/charm_creature.tph"
LAF "CHARM_CREATURE" END
ACTION_DEFINE_ASSOCIATIVE_ARRAY "7eyes-o-matic" BEGIN
// effectID , damageType , splState , opcodeExtra , feedbackString , feedbackIcon , feedbackVfx => 2daFile
3 , "null" , "BERSERK_IMMUNITY" , "" , "Berzerk, Berserk" , "4" , "" => "berserk.2da"
5 , "null" , "CHARM_IMMUNITY" , "" , "Charmed, Dire Charmed, Dominated, Turned" , "0 1 43" , "" => "charm.2da"
12 , "fire" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "fireh firel" => "damage_fire.2da"
12 , "cold" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "coldh coldl" => "damage_cold.2da"
12 , "electricity" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "electrh electrl" => "damage_electricity.2da"
12 , "acid" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "acidh" => "damage_acid.2da"
12 , "missile" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "" => "damage_missile.2da"
12 , "crushing" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "" => "damage_crushing.2da"
12 , "slashing" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "" => "damage_slashing.2da"
12 , "piercing" , "" , "" , "Bleeding, Suffers Bleeding Wound, Bleeding Wound, Deathbringer Assault" , "102 137" , "" => "damage_piercing.2da"
24 , "null" , "PANIC_IMMUNITY" , "23 106" , "Panic, Morale Failure: Panic, *flees in terror*" , "36" , "cdhorror" => "panic.2da"
38 , "null" , "SILENCE_IMMUNITY" , "" , "Silence, Silenced, Bard Song Silenced" , "34" , "" => "silence.2da"
45 , "null" , "STUN_IMMUNITY" , "" , "Stun, Stunned" , "55" , "spflayer" => "stun.2da"
74 , "null" , "BLIND_IMMUNITY" , "54" , "Blind, Blinded, Blindness" , "8" , "" => "blind.2da"
76 , "null" , "FEEBLEMIND_IMMUNITY" , "" , "Feeblemind, Feebleminded, Feeblemindedness" , "48" , "" => "feeblemind.2da"
80 , "null" , "DEAF_IMMUNITY" , "" , "Deaf, Deafened, Deafness" , "112" , "" => "deaf.2da"
109 , "null" , "PARALYZE_IMMUNITY" , "157" , "Paralyzed, Paralysed, Held" , "13" , "" => "paralyze.2da"
128 , "null" , "CONFUSION_IMMUNITY" , "" , "Confused, Rigid Thinking, Chaos" , "2 3 47" , "spconfus confush" => "confusion.2da"
134 , "null" , "PETRIFY_IMMUNITY" , "" , "Petrification, Petrified" , "171" , "" => "petrify.2da"
154 , "null" , "ENTANGLE_IMMUNITY" , "0 126" , "Entangle, Entangled" , "144" , "spentaci entangc" => "entangle.2da"
157 , "null" , "WEB_IMMUNITY" , "109" , "Webbed, Held" , "129" , "webentd webc" => "web.2da"
158 , "null" , "GREASE_IMMUNITY" , "126" , "Grease, Greased" , "145" , "greased greaseb" => "grease.2da"
175 , "null" , "HOLD_IMMUNITY" , "" , "Held" , "13" , "spmindat ohnwand1" => "hold.2da"
210 , "null" , "STUN_IMMUNITY" , "" , "Stun, Stunned" , "55" , "" => "power_word_stun.2da"
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/damage.tph"
LAF "DAMAGE" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/panic.tph"
LAF "PANIC" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/poison.tph"
LAF "POISON" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/silence.tph"
LAF "SILENCE" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/stun.tph"
LAF "STUN" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/blindness.tph"
LAF "BLINDNESS" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/feeblemindedness.tph"
LAF "FEEBLEMINDEDNESS" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/deafness.tph"
LAF "DEAFNESS" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/paralyze.tph"
LAF "PARALYZE" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/confusion.tph"
LAF "CONFUSION" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/petrification.tph"
LAF "PETRIFICATION" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/hold_creature.tph"
LAF "HOLD_CREATURE" END
END
WITH_SCOPE BEGIN
INCLUDE "eefixpack/files/tph/luke/7eyes/power_word_stun.tph"
LAF "POWER_WORD_STUN" END
//
ACTION_PHP_EACH "7eyes-o-matic" AS "key" => "2daFile" BEGIN
ACTION_IF ("%key_2%" STRING_COMPARE_CASE "") BEGIN
LAF "ADD_IDS_ENTRY" STR_VAR "idsFile" = "splstate" "identifier" = "%key_2%" RET "value" END
END ELSE BEGIN
OUTER_SET "value" = "-1"
END
//
LAF "7EYES-O-MATIC"
INT_VAR
"splstate" = "%value%"
"effectID" = "%key_0%"
"damage_type" = IDS_OF_SYMBOL ("dmgtype" "%key_1%")
STR_VAR
"opcode_extra" = "%key_3%"
"feedback_string" = "%key_4%"
"feedback_icon" = "%key_5%"
"feedback_vfx" = "%key_6%"
//
"2da_filespec" = "eefixpack\files\tph\luke\7eyes\%game_folder%\%2daFile%"
END
END
END
Loading

0 comments on commit ac698f2

Please sign in to comment.