From: Laszlo T. <ave...@us...> - 2010-07-17 10:43:22
|
gemrb: Infinity Engine emulator The branch master has been updated via 475cdf2606314d8a00fbb1c37498a087001d8901 (commit) Summary of changes: gemrb/core/GameScript/Actions.cpp | 9 +++++++ gemrb/core/GameScript/GSUtils.cpp | 41 ++++++++++++++++++++++++++++++++++ gemrb/core/GameScript/GSUtils.h | 2 + gemrb/core/GameScript/GameScript.cpp | 2 + gemrb/core/GameScript/GameScript.h | 2 + gemrb/core/GameScript/Triggers.cpp | 16 +++++++++++++ gemrb/override/how/island00.2da | 11 +++++++++ gemrb/override/iwd2/island00.2da | 11 +++++++++ 8 files changed, 94 insertions(+), 0 deletions(-) create mode 100644 gemrb/override/how/island00.2da create mode 100644 gemrb/override/iwd2/island00.2da from ec0911b2406c522fbc82da13959402db7b955fce (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=475cdf2606314d8a00fbb1c37498a087001d8901 commit 475cdf2606314d8a00fbb1c37498a087001d8901 Author: Avenger <ave...@so...> Date: Sat Jul 17 12:42:19 2010 +0200 implemented OnIsland trigger (used by HoW) diff --git a/gemrb/core/GameScript/Actions.cpp b/gemrb/core/GameScript/Actions.cpp index 81589f2..7c9af01 100644 --- a/gemrb/core/GameScript/Actions.cpp +++ b/gemrb/core/GameScript/Actions.cpp @@ -6652,6 +6652,15 @@ void GameScript::IncrementKillStat(Scriptable* Sender, Action* parameters) SetVariable( Sender, variable, "GLOBAL", value ); } +void GameScript::SpellCastEffect(Scriptable* Sender, Action* parameters) +{ + Scriptable* src = GetActorFromObject( Sender, parameters->objects[1] ); + if (!src) { + return; + } + //TODO: finish this +} + //this action plays a vvc animation over target //we simply apply the appropriate opcode on the target (see iwdopcodes) //the list of vvcs is in iwdshtab.2da diff --git a/gemrb/core/GameScript/GSUtils.cpp b/gemrb/core/GameScript/GSUtils.cpp index 15cba5b..86efee7 100644 --- a/gemrb/core/GameScript/GSUtils.cpp +++ b/gemrb/core/GameScript/GSUtils.cpp @@ -66,6 +66,7 @@ int SkillCount=-1; // reaction modifiers (by reputation and charisma) int rmodrep[20]; int rmodchr[25]; +Gem_Polygon **polygons; void InitScriptTables() { @@ -2730,6 +2731,7 @@ unsigned int GetItemDistance(ieResRef itemres, int header) return dist*15; } +//read the wish 2da void SetupWishCore(Scriptable *Sender, int column, int picks) { int count; @@ -2784,3 +2786,42 @@ retry: free(selects); } +#define MAX_ISLAND_POLYGONS 10 + +//read a polygon 2da +Gem_Polygon *GetPolygon2DA(ieDword index) +{ + ieResRef resref; + + if (index>=MAX_ISLAND_POLYGONS) { + return NULL; + } + + if (!polygons) { + polygons = (Gem_Polygon **) calloc(MAX_ISLAND_POLYGONS, sizeof(Gem_Polygon *) ); + } + if (polygons[index]) { + return polygons[index]; + } + snprintf(resref, sizeof(ieResRef), "ISLAND%02d", index); + AutoTable tm(resref); + if (!tm) { + return NULL; + } + int cnt = tm->GetRowCount(); + if (!cnt) { + return NULL; + } + Point *p = new Point[cnt]; + + int i = cnt; + while(i--) { + p[i].x = atoi(tm->QueryField(i, 0)); + p[i].y = atoi(tm->QueryField(i, 1)); + } + + polygons[index] = new Gem_Polygon(p, cnt, NULL); + delete [] p; + return polygons[index]; +} + diff --git a/gemrb/core/GameScript/GSUtils.h b/gemrb/core/GameScript/GSUtils.h index 588c3fe..e0c7bb4 100644 --- a/gemrb/core/GameScript/GSUtils.h +++ b/gemrb/core/GameScript/GSUtils.h @@ -56,6 +56,7 @@ extern int ExtraParametersCount; extern int InDebug; extern int *SkillStats; extern int SkillCount; +extern Gem_Polygon **polygons; #define MIC_INVALID -2 #define MIC_FULL -1 @@ -146,6 +147,7 @@ Trigger *GenerateTriggerCore(const char *src, const char *str, int trIndex, int unsigned int GetSpellDistance(ieResRef spellres, Actor *actor); unsigned int GetItemDistance(ieResRef itemres, int header); void SetupWishCore(Scriptable *Sender, int column, int picks); +Gem_Polygon *GetPolygon2DA(ieDword index); inline int Bones(ieDword value) { diff --git a/gemrb/core/GameScript/GameScript.cpp b/gemrb/core/GameScript/GameScript.cpp index 6a2e39d..9c1fbff 100644 --- a/gemrb/core/GameScript/GameScript.cpp +++ b/gemrb/core/GameScript/GameScript.cpp @@ -290,6 +290,7 @@ static const TriggerLink triggernames[] = { {"objitemcountgt", GameScript::NumItemsGT, 0}, {"objitemcountlt", GameScript::NumItemsLT, 0}, {"oncreation", GameScript::OnCreation, 0}, + {"onisland", GameScript::OnIsland, 0}, {"onscreen", GameScript::OnScreen, 0}, {"opened", GameScript::Opened, 0}, {"openfailed", GameScript::OpenFailed, 0}, @@ -847,6 +848,7 @@ static const ActionLink actionnames[] = { {"spawnptdeactivate", GameScript::SpawnPtDeactivate, 0}, {"spawnptspawn", GameScript::SpawnPtSpawn, 0}, {"spell", GameScript::Spell, AF_BLOCKING|AF_ALIVE}, + {"spellcasteffect", GameScript::SpellCastEffect, 0}, {"spellhiteffectpoint", GameScript::SpellHitEffectPoint, 0}, {"spellhiteffectsprite", GameScript::SpellHitEffectSprite, 0}, {"spellnodec", GameScript::SpellNoDec, AF_BLOCKING|AF_ALIVE}, diff --git a/gemrb/core/GameScript/GameScript.h b/gemrb/core/GameScript/GameScript.h index 36a9833..50406ec 100644 --- a/gemrb/core/GameScript/GameScript.h +++ b/gemrb/core/GameScript/GameScript.h @@ -835,6 +835,7 @@ public: //Script Functions static int NumTimesTalkedToLT(Scriptable* Sender, Trigger* parameters); static int ObjectActionListEmpty(Scriptable* Sender, Trigger* parameters); static int OnCreation(Scriptable* Sender, Trigger* parameters); + static int OnIsland(Scriptable* Sender, Trigger* parameters); static int OnScreen(Scriptable* Sender, Trigger* parameters); static int Opened(Scriptable* Sender, Trigger* parameters); static int OpenFailed(Scriptable* Sender, Trigger* parameters); @@ -1331,6 +1332,7 @@ public: static void SpawnPtDeactivate(Scriptable* Sender, Action* parameters); static void SpawnPtSpawn(Scriptable* Sender, Action* parameters); static void Spell(Scriptable* Sender, Action* parameters); + static void SpellCastEffect(Scriptable* Sender, Action* parameters); static void SpellHitEffectPoint(Scriptable* Sender, Action* parameters); static void SpellHitEffectSprite(Scriptable* Sender, Action* parameters); static void SpellNoDec(Scriptable* Sender, Action* parameters); diff --git a/gemrb/core/GameScript/Triggers.cpp b/gemrb/core/GameScript/Triggers.cpp index 12c975d..0eb896e 100644 --- a/gemrb/core/GameScript/Triggers.cpp +++ b/gemrb/core/GameScript/Triggers.cpp @@ -344,6 +344,22 @@ int GameScript::InTrap(Scriptable* Sender, Trigger* parameters) return 0; } +/* checks if targeted actor is in the specified region + GemRB allows different regions, referenced by int0Parameter + The polygons are stored in island<nn>.2da files */ +int GameScript::OnIsland(Scriptable* Sender, Trigger* parameters) +{ + Scriptable* scr = GetActorFromObject( Sender, parameters->objectParameter ); + if (!scr) { + return 0; + } + Gem_Polygon *p = GetPolygon2DA(parameters->int0Parameter); + if (!p) { + return 0; + } + return p->PointIn(scr->Pos); +} + int GameScript::School(Scriptable* Sender, Trigger* parameters) { Scriptable* scr = GetActorFromObject( Sender, parameters->objectParameter ); diff --git a/gemrb/override/how/island00.2da b/gemrb/override/how/island00.2da new file mode 100644 index 0000000..aa3f8e2 --- /dev/null +++ b/gemrb/override/how/island00.2da @@ -0,0 +1,11 @@ +2DA V1.0 +0 + X Y +1 0 105 +2 0 590 +3 692 590 +4 692 459 +5 1018 459 +6 1018 301 +7 1027 301 +8 1027 105 diff --git a/gemrb/override/iwd2/island00.2da b/gemrb/override/iwd2/island00.2da new file mode 100644 index 0000000..aa3f8e2 --- /dev/null +++ b/gemrb/override/iwd2/island00.2da @@ -0,0 +1,11 @@ +2DA V1.0 +0 + X Y +1 0 105 +2 0 590 +3 692 590 +4 692 459 +5 1018 459 +6 1018 301 +7 1027 301 +8 1027 105 ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |