From: Jaka K. <lyn...@us...> - 2011-01-15 14:53:26
|
gemrb: Infinity Engine emulator The branch master has been updated via e959da2c23e08069b6dcad049c34c97b78e0a1bb (commit) via cd897e45dc401c650de317f3dd397f4452198519 (commit) via 9e8ddb60f7cbc9213022783f0a1fe13b939ad074 (commit) via df7ede1e2d7d767d78993d8f3ec88449078be76c (commit) Summary of changes: gemrb/core/Scriptable/Actor.cpp | 1 + gemrb/core/Scriptable/Actor.h | 15 +++++++ gemrb/core/Scriptable/ActorBlock.cpp | 73 +++++++++++++++++++++++++++++---- 3 files changed, 80 insertions(+), 9 deletions(-) from 2cea77593fdb2c8cd02a7a9535fab148ec2171b6 (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=e959da2c23e08069b6dcad049c34c97b78e0a1bb commit e959da2c23e08069b6dcad049c34c97b78e0a1bb Author: Jaka Kranjc <lyn...@us...> Date: Sat Jan 15 15:05:47 2011 +0100 unhardcoded the projectile speed modifying surge diff --git a/gemrb/core/Scriptable/ActorBlock.cpp b/gemrb/core/Scriptable/ActorBlock.cpp index 6f92859..14caae4 100644 --- a/gemrb/core/Scriptable/ActorBlock.cpp +++ b/gemrb/core/Scriptable/ActorBlock.cpp @@ -630,6 +630,16 @@ void Scriptable::CreateProjectile(const ieResRef SpellResRef, ieDword tgt, bool origin = ((InfoPoint *)this)->TrapLaunch; } + if (caster) { + // check for the speed mod + if (caster->wildSurgeMods.projectile_speed_mod) { + pro->Speed = (pro->Speed * caster->wildSurgeMods.projectile_speed_mod) / 100; + if (!pro->Speed) { + pro->Speed = 1; + } + } + } + if (tgt) { area->AddProjectile(pro, origin, LastTarget, fake); } else { http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=cd897e45dc401c650de317f3dd397f4452198519 commit cd897e45dc401c650de317f3dd397f4452198519 Author: Jaka Kranjc <lyn...@us...> Date: Sat Jan 15 15:00:07 2011 +0100 unhardcoded the "cast spell x times" surge diff --git a/gemrb/core/Scriptable/ActorBlock.cpp b/gemrb/core/Scriptable/ActorBlock.cpp index b37ac27..6f92859 100644 --- a/gemrb/core/Scriptable/ActorBlock.cpp +++ b/gemrb/core/Scriptable/ActorBlock.cpp @@ -605,10 +605,14 @@ void Scriptable::CreateProjectile(const ieResRef SpellResRef, ieDword tgt, bool int duplicate = 1; if (Type == ST_ACTOR) { caster = (Actor *) this; + duplicate = caster->wildSurgeMods.num_castings; + if (!duplicate) { + duplicate = 1; + } } if (core->HasFeature(GF_PST_STATE_FLAGS) && (Type == ST_ACTOR)) { if (caster->GetStat(IE_STATE_ID)&STATE_EE_DUPL) { - duplicate = 2; + duplicate *= 2; } } http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=9e8ddb60f7cbc9213022783f0a1fe13b939ad074 commit 9e8ddb60f7cbc9213022783f0a1fe13b939ad074 Author: Jaka Kranjc <lyn...@us...> Date: Sat Jan 15 14:58:12 2011 +0100 added a WildSurgeSpellMods struct to Actor for the tricky wild surges populate it when needed diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index 61ddd61..b3141fc 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -408,6 +408,7 @@ Actor::Actor() WMLevelMod = 0; polymorphCache = NULL; + memset(&wildSurgeMods, 0, sizeof(wildSurgeMods)); } Actor::~Actor(void) diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h index 713d839..240c922 100644 --- a/gemrb/core/Scriptable/Actor.h +++ b/gemrb/core/Scriptable/Actor.h @@ -184,6 +184,20 @@ struct PolymorphCache; // used for distinguishing damage immunity from high damage resistance #define DR_IMMUNE 999999 +// wild surge target change type +#define WSTC_SETTYPE 1 // change to this target type +#define WSTC_ADDTYPE 2 // affect also this target type +#define WSTC_RANDOMIZE 3 // choose a random target +struct WildSurgeSpellMods { + unsigned int num_castings; // number of times to cast + unsigned int num_wildrolls; // number of times to roll + unsigned int projectile_id; // new projectile id + unsigned int target_change_type; // settype, addtype, randomize + unsigned int target_type; // type to use when target_change_type is not WSTC_RANDOMIZE + unsigned int projectile_speed_mod; // factor in percents + int saving_throw_mod; +}; + typedef ieByte ActionButtonRow[GUIBT_COUNT]; struct ActionButtonRow2 { ActionButtonRow buttons; @@ -310,6 +324,7 @@ public: int speed; PolymorphCache *polymorphCache; // fx_polymorph etc + WildSurgeSpellMods wildSurgeMods; private: //this stuff doesn't get saved CharAnimations* anims; diff --git a/gemrb/core/Scriptable/ActorBlock.cpp b/gemrb/core/Scriptable/ActorBlock.cpp index b76181a..b37ac27 100644 --- a/gemrb/core/Scriptable/ActorBlock.cpp +++ b/gemrb/core/Scriptable/ActorBlock.cpp @@ -694,8 +694,10 @@ void Scriptable::CreateProjectile(const ieResRef SpellResRef, ieDword tgt, bool void Scriptable::CastSpellPointEnd() { + Actor *caster = NULL; if (Type == ST_ACTOR) { - ((Actor *) this)->SetStance(IE_ANI_CONJURE); + caster = ((Actor *) this); + caster->SetStance(IE_ANI_CONJURE); } if (SpellHeader == -1) { @@ -718,12 +720,17 @@ void Scriptable::CastSpellPointEnd() SpellResRef[0] = 0; LastTarget = 0; LastTargetPos.empty(); + if (caster) { + memset(&(caster->wildSurgeMods), 0, sizeof(caster->wildSurgeMods)); + } } void Scriptable::CastSpellEnd() { + Actor *caster = NULL; if (Type == ST_ACTOR) { - ((Actor *) this)->SetStance(IE_ANI_CONJURE); + caster = ((Actor *) this); + caster->SetStance(IE_ANI_CONJURE); } if (SpellHeader == -1) { @@ -744,6 +751,9 @@ void Scriptable::CastSpellEnd() SpellResRef[0] = 0; LastTarget = 0; LastTargetPos.empty(); + if (caster) { + memset(&(caster->wildSurgeMods), 0, sizeof(caster->wildSurgeMods)); + } } // check for input sanity and good casting conditions @@ -1018,13 +1028,41 @@ bool Scriptable::HandleHardcodedSurge(ieResRef surgeSpellRef, Spell *spl, Actor core->ApplySpell(surgeSpellRef+1, caster, caster, caster->GetCasterLevel(spl->SpellType)); break; case '0': // cast spell param1 times + strtok(surgeSpellRef,"."); + count = strtol(strtok(NULL,"."), NULL, 0); + caster->wildSurgeMods.num_castings = count; + break; case '1': // change projectile (id) to param1 + strtok(surgeSpellRef,"."); + count = strtol(strtok(NULL,"."), NULL, 0); + caster->wildSurgeMods.projectile_id = count; + break; case '2': // also target target type param1 - case '3': // (wild surge) roll param1 more times + strtok(surgeSpellRef,"."); + count = strtol(strtok(NULL,"."), NULL, 0); + caster->wildSurgeMods.target_type = count; + caster->wildSurgeMods.target_change_type = WSTC_ADDTYPE; + break; case '4': // change the target type to param1 + strtok(surgeSpellRef,"."); + count = strtol(strtok(NULL,"."), NULL, 0); + caster->wildSurgeMods.target_type = count; + caster->wildSurgeMods.target_change_type = WSTC_SETTYPE; + break; case '5': // change the target to a random actor + caster->wildSurgeMods.target_change_type = WSTC_RANDOMIZE; + break; case '6': // change saving throw (+param1) + strtok(surgeSpellRef,"."); + count = strtol(strtok(NULL,"."), NULL, 0); + caster->wildSurgeMods.saving_throw_mod = count; + break; case '9': // set projectile speed to param1 % + strtok(surgeSpellRef,"."); + count = strtol(strtok(NULL,"."), NULL, 0); + caster->wildSurgeMods.projectile_speed_mod = count; + break; + case '3': // (wild surge) roll param1 more times default: SpellHeader = -1; SpellResRef[0] = 0; http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=df7ede1e2d7d767d78993d8f3ec88449078be76c commit df7ede1e2d7d767d78993d8f3ec88449078be76c Author: Jaka Kranjc <lyn...@us...> Date: Sat Jan 15 12:44:33 2011 +0100 Scriptable::CreateProjectile: find out if the caster is an actor earlier diff --git a/gemrb/core/Scriptable/ActorBlock.cpp b/gemrb/core/Scriptable/ActorBlock.cpp index 2252684..b76181a 100644 --- a/gemrb/core/Scriptable/ActorBlock.cpp +++ b/gemrb/core/Scriptable/ActorBlock.cpp @@ -598,12 +598,16 @@ static EffectRef fx_set_invisible_state_ref={"State:Invisible",NULL,-1}; void Scriptable::CreateProjectile(const ieResRef SpellResRef, ieDword tgt, bool fake) { Spell* spl = gamedata->GetSpell( SpellResRef ); + Actor *caster = NULL; //PST has a weird effect, called Enoll Eva's duplication //it creates every projectile of the affected actor twice int duplicate = 1; + if (Type == ST_ACTOR) { + caster = (Actor *) this; + } if (core->HasFeature(GF_PST_STATE_FLAGS) && (Type == ST_ACTOR)) { - if ( ((Actor *)this)->GetStat(IE_STATE_ID)&STATE_EE_DUPL) { + if (caster->GetStat(IE_STATE_ID)&STATE_EE_DUPL) { duplicate = 2; } } @@ -656,9 +660,8 @@ void Scriptable::CreateProjectile(const ieResRef SpellResRef, ieDword tgt, bool if(LastTarget) { if (target && (Type==ST_ACTOR) ) { - Actor *me = (Actor *) this; target->LastSpellOnMe = spellnum; - target->LastCasterOnMe = me->GetGlobalID(); + target->LastCasterOnMe = caster->GetGlobalID(); // don't cure invisibility if this is a self targetting invisibility spell // like shadow door //can't check GetEffectBlock, since it doesn't construct the queue for selftargetting spells @@ -673,11 +676,11 @@ void Scriptable::CreateProjectile(const ieResRef SpellResRef, ieDword tgt, bool if (invis && spl->GetExtHeader(SpellHeader)->Target == TARGET_SELF) { //pass } else { - me->CureInvisibility(); + caster->CureInvisibility(); } // sanctuary ends with all hostile actions or when the caster targets someone else if (target != this || spl->Flags & SF_HOSTILE) { - me->CureSanctuary(); + caster->CureSanctuary(); } } } ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |