szapp / GothicFreeAim

Free aiming for the video game series Gothic
https://gfa.szapp.de
MIT License
36 stars 4 forks source link

Simplify categorizing spells for drawing reticle in config #189

Closed szapp closed 5 years ago

szapp commented 6 years ago

The reticle for spells is currently determined by spell ID in separate files for Gothic 1 and Gothic 2 in the config.

This decreases compatibility with mods that may have removed spells or renamed their ID constants. A viable method could be to compare the names of the spell instances instead. This would also make discerning between Gothic 1 and Gothic 2 obsolete.

Example code:

var string instName;
instName = MEM_ReadString(MEM_GetSymbolByIndex(Hlp_GetInstanceID(spellInst)));

if (STR_IndexOf(instName, "FIRE") != -1)
|| (STR_IndexOf(instName, "PYRO") != -1) {
    // Fire spells
    return RETICLE_HORNS;
} else if (STR_IndexOf(instName, "ICE") != -1)
|| (STR_IndexOf(instName, "THUNDER") != -1) {
    // Ice spells
    return RETICLE_SPADES;
} else if { // ...