From: Jaka K. <lyn...@us...> - 2013-01-13 18:42:19
|
gemrb: Infinity Engine emulator The branch master has been updated via 2f411d282e7bbfc1f2ed5bd4422ba5d7e4e3cad3 (commit) via 20111d5591afe30aa7450c5f056f8f885e5c4a03 (commit) Summary of changes: gemrb/core/Scriptable/Actor.cpp | 57 +++++++++++++++++++++++++++++++------- 1 files changed, 46 insertions(+), 11 deletions(-) from d1c6dfb0fd2cffd9a49e79537512ff99e7c238a5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=2f411d282e7bbfc1f2ed5bd4422ba5d7e4e3cad3 commit 2f411d282e7bbfc1f2ed5bd4422ba5d7e4e3cad3 Author: Jaka Kranjc <lyn...@us...> Date: Sun Jan 13 19:41:40 2013 +0100 Actor: implemented iwd2 bonus spells diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index 9e6ed20..9d08e79 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -91,6 +91,7 @@ static int *turnlevels = NULL; static int *booktypes = NULL; static int *xpbonus = NULL; static int *defaultprof = NULL; +static int *castingstat = NULL; static int xpbonustypes = -1; static int xpbonuslevels = -1; static int **levelslots = NULL; @@ -1429,6 +1430,11 @@ void Actor::ReleaseMemory() booktypes=NULL; } + if (castingstat) { + free(castingstat); + castingstat=NULL; + } + if (xpbonus) { free(xpbonus); xpbonus=NULL; @@ -1679,6 +1685,7 @@ static void InitActorTables() booktypes = (int *) calloc(classcount, sizeof(int)); classabilities = (char **) calloc(classcount, sizeof(char*)); defaultprof = (int *) calloc(classcount, sizeof(int)); + castingstat = (int *) calloc(classcount, sizeof(int)); ieDword bitmask = 1; @@ -1731,7 +1738,12 @@ static void InitActorTables() isclass[ISSORCERER] |= bitmask; } - field = tm->QueryField( rowname, skillcolumns[COL_HATERACE] ); + if (third) { + field = tm->QueryField(rowname, "CASTING"); // COL_HATERACE but different name + castingstat[i] = atoi(field); + } + + field = tm->QueryField(rowname, "HATERACE"); if (field[0]!='*') { isclass[ISRANGER] |= bitmask; } @@ -1880,7 +1892,13 @@ static void InitActorTables() } } - tm.load("mxsplwis"); + // iwd2 has mxsplbon instead, since all casters get a bonus with high enough stats (which are not always wisdom) + // luckily, they both use the same format + if (third) { + tm.load("mxsplbon"); + } else { + tm.load("mxsplwis"); + } if (tm) { spllevels = tm->GetColumnCount(0); int max = core->GetMaximumAbility(); @@ -2927,11 +2945,28 @@ void Actor::RefreshEffects(EffectQueue *fx) } } } - //add wisdom bonus spells - if (!spellbook.IsIWDSpellBook() && mxsplwis) { - int level = Modified[IE_WIS]; - if (level--) { - spellbook.BonusSpells(IE_SPELL_TYPE_PRIEST, spllevels, mxsplwis+spllevels*level); + //add wisdom/casting_ability bonus spells + if (mxsplwis) { + if (spellbook.IsIWDSpellBook()) { + // check each class separately for the casting stat and booktype (luckily there is no bonus for domain spells) + for (i=0; i < ISCLASSES; i++) { + int level = GetClassLevel(i); + int booktype = booksiwd2[i]; // ieIWD2SpellType + if (!level || booktype == -1) { + continue; + } + level = Modified[castingstat[classesiwd2[i]]]; + // FIXME: this ignores level requirements (bards ...), but we can avoid that by checking max level + // a shortcut is possible, since no class has both cleric and mage spells, so always at least one of the clskills columns is empty + if (level--) { + spellbook.BonusSpells(booktype, spllevels, mxsplwis+spllevels*level); + } + } + } else { + int level = Modified[IE_WIS]; + if (level--) { + spellbook.BonusSpells(IE_SPELL_TYPE_PRIEST, spllevels, mxsplwis+spllevels*level); + } } } http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=20111d5591afe30aa7450c5f056f8f885e5c4a03 commit 20111d5591afe30aa7450c5f056f8f885e5c4a03 Author: Jaka Kranjc <lyn...@us...> Date: Sun Jan 13 19:27:09 2013 +0100 Actor: store booksiwd2 unshifted, so types can be used directly too diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index edfff54..9e6ed20 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -196,9 +196,9 @@ static const int levelslotsbg[BGCLASSCNT]={ISFIGHTER, ISMAGE, ISFIGHTER, ISCLERI //autogenerating for non IWD2 now!!! static unsigned int classesiwd2[ISCLASSES]={5, 11, 9, 1, 2, 3, 4, 6, 7, 8, 10, 12, 13}; //this map could probably be auto-generated (isClass -> IWD2 book ID) -static const unsigned int booksiwd2[ISCLASSES]={0, 1<<IE_IWD2_SPELL_WIZARD, 0, 0, - 1<<IE_IWD2_SPELL_BARD, 1<<IE_IWD2_SPELL_CLERIC, 1<<IE_IWD2_SPELL_DRUID, 0, - 1<<IE_IWD2_SPELL_PALADIN, 1<<IE_IWD2_SPELL_RANGER, 1<<IE_IWD2_SPELL_SORCEROR, 0, 0}; +static const int booksiwd2[ISCLASSES]={-1, IE_IWD2_SPELL_WIZARD, -1, -1, + IE_IWD2_SPELL_BARD, IE_IWD2_SPELL_CLERIC, IE_IWD2_SPELL_DRUID, -1, + IE_IWD2_SPELL_PALADIN, IE_IWD2_SPELL_RANGER, IE_IWD2_SPELL_SORCEROR, -1, -1}; //stat values are 0-255, so a byte is enough static ieByte featstats[MAX_FEATS]={0 @@ -9182,7 +9182,7 @@ int Actor::GetBookMask() const int bookmask = 0; for (int i=0; i < ISCLASSES; i++) { if (Modified[levelslotsiwd2[i]] > 0) { - bookmask |= 1<<(booksiwd2[i]-1); + bookmask |= 1<<((1<<booksiwd2[i])-1); } } ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |