Skip to content

Commit

Permalink
Improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed May 9, 2024
1 parent 7698c3c commit c6dccda
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
40 changes: 40 additions & 0 deletions _work/data/Scripts/Content/GFA/_intern/auxiliary.d
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,46 @@ func int GFA_GetActiveSpellIsScroll(var C_Npc slf) {
return CALL_RetValAsInt();
};

/*
* Get the instance name of a spell by its spell ID.
* This function is used for compatibility and only used optionally in the configuration.
*/
func string GFA_GetSpellName(var int spellID) {
const spellFxInstanceNamesPtr = 0;
if (!spellFxInstanceNamesPtr) {
var int symPtr; symbPtr = MEM_GetSymbol("SPELLFXINSTANCENAMES");
if (symbPtr) {
var zCPar_Symbol symb; symb = _^(symbPtr);
spellFxInstanceNamesPtr = symb.content;
} else {
MEM_Warn("GFA_GetSpellName: String constant 'spellFxInstanceNames' not found.");
return "";
};
};

return STR_Upper(MEM_ReadStringArray(spellFxInstanceNamesPtr, spellID));
};

/*
* Get the animation name of a spell by its spell ID.
* This function is used for compatibility.
*/
func string GFA_GetSpellAni(var int spellID) {
const spellFxAniLettersPtr = 0;
if (!spellFxAniLettersPtr) {
var int symPtr; symbPtr = MEM_GetSymbol("SPELLFXANILETTERS");
if (symbPtr) {
var zCPar_Symbol symb; symb = _^(symbPtr);
spellFxAniLettersPtr = symb.content;
} else {
MEM_Warn("GFA_GetSpellAni: String constant 'spellFxAniLetters' not found.");
return "";
};
};

return MEM_ReadStringArray(spellFxAniLettersPtr, spellID);
};


/*
* Retrieve whether a spell is eligible for free aiming (GFA_SPL_FREEAIM), that is, it supports free aiming by its
Expand Down
2 changes: 1 addition & 1 deletion _work/data/Scripts/Content/GFA/_intern/controls.d
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ func void GFA_AdjustDamageAnimation() {
// Also treat variations of casting animations
var int spellID; spellID = Npc_GetActiveSpell(victim); // Scrolls are removed: sometimes not found
if (GFA_InvestingOrCasting(victim) > 0) && (spellID != -1) {
var string castMod; castMod = ConcatStrings(modifier, MEM_ReadStatStringArr(spellFxAniLetters, spellID));
var string castMod; castMod = ConcatStrings(modifier, GFA_GetSpellAni(spellID));

// Check if animation with casting modifier exists
var int aniNamePtr; aniNamePtr = _@s(ConcatStrings(ConcatStrings(prefix, castMod), aniName));
Expand Down
2 changes: 1 addition & 1 deletion _work/data/Scripts/Content/GFA/_intern/strafing.d
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func void GFA_Strafe() {
// Also treat variations of casting animations
var int spellID; spellID = Npc_GetActiveSpell(hero); // Scrolls are removed: sometimes not found
if (GFA_InvestingOrCasting(hero) > 0) && (spellID != -1) {
modifier = ConcatStrings(modifier, MEM_ReadStatStringArr(spellFxAniLetters, spellID));
modifier = ConcatStrings(modifier, GFA_GetSpellAni(spellID));
};
} else if (her.fmode == FMODE_FAR) {
modifier = "BOW";
Expand Down
2 changes: 1 addition & 1 deletion _work/data/Scripts/Content/GFA/config/reticle.d
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func void GFA_GetSpellReticle(var C_Npc target, var int spellID, var GFA_C_Spell
// Note: Only spells are listed that are eligible for free aiming. All other spells will not have a reticle anyways.

// Exact spell name, e.g. "FIREBOLT"
var string spellName; spellName = STR_Upper(MEM_ReadStatStringArr(spellFxInstanceNames, spellID));
var string spellName; spellName = GFA_GetSpellName(spellID);

if (STR_IndexOf(spellName, "ICE") != -1)
|| (STR_IndexOf(spellName, "THUNDERBOLT") != -1) {
Expand Down
4 changes: 2 additions & 2 deletions _work/data/Scripts/System/GFA/instances/Menu_Opt_GFA.d
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const int GFA_IT_EFFECTS_NEXT = 128; // IT_EFFECT

Instance MENUITEM_OPT_GFA (GFA_C_Menu_Item) {
backPic = GFA_MENU_ITEM_BACK_PIC;
type = MENU_ITEM_TEXT;
fontName = MENU_FONT_DEFAULT;
type = GFA_MENU_ITEM_TEXT;
fontName = GFA_MENU_FONT_DEFAULT;
text[0] = GFA_MENU_LABEL;
text[1] = GFA_MENU_DESCR;
posx = 1000;
Expand Down

0 comments on commit c6dccda

Please sign in to comment.