From: <ave...@us...> - 2007-03-01 21:32:50
|
Revision: 4515 http://gemrb.svn.sourceforge.net/gemrb/?rev=4515&view=rev Author: avenger_teambg Date: 2007-03-01 13:32:48 -0800 (Thu, 01 Mar 2007) Log Message: ----------- removed some executable flags added 'critical hit averted by helmet' feature fixed a bug when dual wielding weapons and cleaned up the item animations a bit too fixed movetoobject to chase the target other scripting fixes Modified Paths: -------------- gemrb/trunk/gemrb/includes/strrefs.h gemrb/trunk/gemrb/override/bg1/slottype.2da gemrb/trunk/gemrb/override/bg1/strings.2da gemrb/trunk/gemrb/override/bg2/slottype.2da gemrb/trunk/gemrb/override/bg2/strings.2da gemrb/trunk/gemrb/override/how/slottype.2da gemrb/trunk/gemrb/override/how/strings.2da gemrb/trunk/gemrb/override/iwd/slottype.2da gemrb/trunk/gemrb/override/iwd/strings.2da gemrb/trunk/gemrb/override/iwd2/slottype.2da gemrb/trunk/gemrb/override/iwd2/strings.2da gemrb/trunk/gemrb/override/pst/strings.2da gemrb/trunk/gemrb/override/tob/slottype.2da gemrb/trunk/gemrb/override/tob/strings.2da gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.h gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Inventory.cpp gemrb/trunk/gemrb/plugins/Core/Inventory.h Modified: gemrb/trunk/gemrb/includes/strrefs.h =================================================================== --- gemrb/trunk/gemrb/includes/strrefs.h 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/includes/strrefs.h 2007-03-01 21:32:48 UTC (rev 4515) @@ -109,6 +109,7 @@ #define STR_CANT_DROP_ITEM 75 #define STR_NOT_IN_OFFHAND 76 #define STR_ITEM_IS_CURSED 77 -#define STRREF_COUNT 78 +#define STR_NO_CRITICAL 78 +#define STRREF_COUNT 79 #endif //! IE_STRINGS_H Modified: gemrb/trunk/gemrb/override/bg1/slottype.2da =================================================================== --- gemrb/trunk/gemrb/override/bg1/slottype.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/bg1/slottype.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -2,7 +2,7 @@ 0 BITS SCRIPT ICON STRREF EFFECT 10 0 0 * 0 2 -6 1 13 STONHELM 11999 1 +6 1 13 STONHELM 11999 7 1 2 11 STONARM 11997 1 9 4 26 STONSHIL 12006 1 5 8 12 STONGLET 11998 1 Modified: gemrb/trunk/gemrb/override/bg1/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/bg1/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/bg1/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -79,4 +79,4 @@ CANT_DROP_ITEM 25697 NOT_IN_OFFHAND -1 ITEM_IS_CURSED 16304 -~ +NO_CRITICAL 20696 Modified: gemrb/trunk/gemrb/override/bg2/slottype.2da =================================================================== --- gemrb/trunk/gemrb/override/bg2/slottype.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/bg2/slottype.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -2,7 +2,7 @@ 0 BITS SCRIPT ICON STRREF EFFECT 10 0 0 * 0 2 -6 1 13 STONHELM 11999 1 +6 1 13 STONHELM 11999 7 1 2 11 STONARM 11997 1 9 260 26 STONSHIL 12006 6 5 8 12 STONGLET 11998 1 Modified: gemrb/trunk/gemrb/override/bg2/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/bg2/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/bg2/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -79,3 +79,4 @@ CANT_DROP_ITEM 25697 NOT_IN_OFFHAND 26342 ITEM_IS_CURSED 16304 +NO_CRITICAL 20696 Modified: gemrb/trunk/gemrb/override/how/slottype.2da =================================================================== --- gemrb/trunk/gemrb/override/how/slottype.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/how/slottype.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -2,7 +2,7 @@ 0 BITS SCRIPT ICON STRREF EFFECT 10 0 0 * 0 2 -6 1 13 STONHELM 11999 1 +6 1 13 STONHELM 11999 7 1 2 11 STONARM 11997 1 9 4 26 STONSHIL 12006 6 5 8 12 STONGLET 11998 1 Modified: gemrb/trunk/gemrb/override/how/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/how/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/how/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -79,3 +79,4 @@ CANT_DROP_ITEM 25697 NOT_IN_OFFHAND 26342 ITEM_IS_CURSED 16304 +NO_CRITICAL 20696 Modified: gemrb/trunk/gemrb/override/iwd/slottype.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd/slottype.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/iwd/slottype.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -2,7 +2,7 @@ 0 BITS SCRIPT ICON STRREF EFFECT 10 0 0 * 0 2 -6 1 13 STONHELM 11999 1 +6 1 13 STONHELM 11999 7 1 2 11 STONARM 11997 1 9 4 26 STONSHIL 12006 6 5 8 12 STONGLET 11998 1 Modified: gemrb/trunk/gemrb/override/iwd/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/iwd/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -79,3 +79,4 @@ CANT_DROP_ITEM 25697 NOT_IN_OFFHAND 26342 ITEM_IS_CURSED 16304 +NO_CRITICAL 20696 Modified: gemrb/trunk/gemrb/override/iwd2/slottype.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/slottype.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/iwd2/slottype.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -2,7 +2,7 @@ 0 BITS SCRIPT ICON STRREF EFFECT 10 0 0 * 0 2 -6 1 13 STONHELM 11999 1 +6 1 13 STONHELM 11999 7 1 2 11 STONARM 11997 1 9 0 0 * 0 0 5 8 12 STONGLET 11998 1 Modified: gemrb/trunk/gemrb/override/iwd2/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/iwd2/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -76,7 +76,7 @@ OFFHAND_USED 9380 TWOHANDED_USED 9381 CANNOT_USE_ITEM 9382 -CANT_DROP_ITEM 25697 -NOT_IN_OFFHAND 26342 +CANT_DROP_ITEM 25697 +NOT_IN_OFFHAND 26342 ITEM_IS_CURSED 16304 - +NO_CRITICAL 20696 Modified: gemrb/trunk/gemrb/override/pst/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/pst/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/pst/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -79,3 +79,4 @@ CANT_DROP_ITEM -1 NOT_IN_OFFHAND -1 ITEM_IS_CURSED -1 +NO_CRITICAL 19273 Modified: gemrb/trunk/gemrb/override/tob/slottype.2da =================================================================== --- gemrb/trunk/gemrb/override/tob/slottype.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/tob/slottype.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -2,7 +2,7 @@ 0 BITS SCRIPT ICON STRREF EFFECT 10 0 0 * 0 2 -6 1 13 STONHELM 11999 1 +6 1 13 STONHELM 11999 7 1 2 11 STONARM 11997 1 9 260 26 STONSHIL 12006 6 5 8 12 STONGLET 11998 1 Modified: gemrb/trunk/gemrb/override/tob/strings.2da =================================================================== --- gemrb/trunk/gemrb/override/tob/strings.2da 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/override/tob/strings.2da 2007-03-01 21:32:48 UTC (rev 4515) @@ -79,3 +79,4 @@ CANT_DROP_ITEM 25697 NOT_IN_OFFHAND 26342 ITEM_IS_CURSED 16304 +NO_CRITICAL 20696 Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-01 21:32:48 UTC (rev 4515) @@ -1106,7 +1106,10 @@ if (target->Type==ST_ACTOR) { actor->SetLeader( (Actor *) target, 5); } - actor->WalkTo( target->Pos, 0, 5 ); + actor->WalkTo( target->Pos, 0, MAX_OPERATING_DISTANCE ); + Sender->AddActionInFront(parameters); + Sender->SetWait(1); + Sender->ReleaseCurrentAction(); } void GameScript::StorePartyLocation(Scriptable* /*Sender*/, Action* /*parameters*/) @@ -4355,6 +4358,19 @@ Sender->ReleaseCurrentAction(); } +//call the usecontainer action in target (not used) +void GameScript::ForceUseContainer(Scriptable* Sender, Action* parameters) +{ + Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); + if (!tar || tar->Type != ST_ACTOR) { + return; + } + char Tmp[256]; + sprintf( Tmp, "UseContainer()"); + Action *newaction = GenerateAction(Tmp); + tar->AddActionInFront(newaction); +} + //these actions directly manipulate a game variable (as the original engine) void GameScript::SetMazeEasier(Scriptable* Sender, Action* /*parameters*/) { @@ -4481,9 +4497,6 @@ void GameScript::AttachTransitionToDoor(Scriptable* Sender, Action* parameters) { Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); - if (!tar) { - return; - } if (!tar || tar->Type != ST_DOOR) { return; } @@ -5252,6 +5265,7 @@ scr->FollowOffset.y = parameters->int0Parameter; } +//keeps following the object in formation void GameScript::FollowObjectFormation(Scriptable* Sender, Action* parameters) { GameControl *gc = core->GetGameControl(); @@ -5276,6 +5290,30 @@ Sender->ReleaseCurrentAction(); } +//walks to a specific offset of target (quite like movetoobject) +void GameScript::Formation(Scriptable* Sender, Action* parameters) +{ + GameControl *gc = core->GetGameControl(); + if (!gc) { + return; + } + if (Sender->Type!=ST_ACTOR) { + return; + } + Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); + if (!tar) { + return; + } + Actor *scr = (Actor *)Sender; + ieDword formation = parameters->int0Parameter; + ieDword pos = parameters->int1Parameter; + Point FollowOffset = gc->GetFormationOffset(formation, pos); + FollowOffset.x+=tar->Pos.x; + FollowOffset.y+=tar->Pos.y; + scr->WalkTo( FollowOffset, 0, 1 ); + Sender->ReleaseCurrentAction(); +} + void GameScript::TransformItem(Scriptable* Sender, Action* parameters) { Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); @@ -5424,8 +5462,8 @@ int opcode = EffectQueue::ResolveEffect(fx_iwd_visual_spell_hit_ref); Effect *fx = core->GetEffect(opcode); if (!fx) { - //invalid effect name didn't resolve to opcode - return; + //invalid effect name didn't resolve to opcode + return; } //vvc type Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-01 21:32:48 UTC (rev 4515) @@ -2214,11 +2214,23 @@ if (critical) { //a critical surely raises the morale? NewBase(IE_MORALE, 1, MOD_ADDITIVE); - damage <<=1; //critical damage is always double? - //check if critical hit is averted by helmet + int head = inventory.GetHeadSlot(); + if ((head!=-1) && target->inventory.HasItemInSlot("",(ieDword) head)) { + //critical hit is averted by helmet + core->DisplayConstantString(STR_NO_CRITICAL,0xffffff); + } else { + damage <<=1; //critical damage is always double? + core->timer->SetScreenShake(2,2,2); + } } - if (damagetype>4) damagetype = 0; + ieDword tmp = target->Modified[IE_MINHITPOINTS]; + if (damagetype>5) { + //hack for nonlethal damage (this round only) + target->Modified[IE_MINHITPOINTS]=1; + damagetype = 0; + } target->Damage(damage, weapon_damagetype[damagetype], this); + target->Modified[IE_MINHITPOINTS]=tmp; } //idx could be: 0-6, 16-22, 32-38, 48-54 Modified: gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/GSUtils.cpp 2007-03-01 21:32:48 UTC (rev 4515) @@ -1014,7 +1014,8 @@ gc->SetScreenFlags(SF_CENTERONACTOR,BM_OR); } -//repeat movement, if goal isn't reached +//repeat movement, until goal isn't reached +//if int0parameter is !=0, then it will try only x times void MoveToObjectCore(Scriptable *Sender, Action *parameters, ieDword flags, bool untilsee) { if (Sender->Type != ST_ACTOR) { @@ -1037,6 +1038,16 @@ } } actor->WalkTo( target->Pos, flags, 0 ); + //repeat movement... + Action *newaction = ParamCopyNoOverride(parameters); + if (newaction->int0Parameter!=1) { + if (newaction->int0Parameter) { + newaction->int0Parameter--; + } + actor->AddActionInFront(newaction); + } + + Sender->ReleaseCurrentAction(); } void CreateItemCore(CREItem *item, const char *resref, int a, int b, int c) Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-03-01 21:32:48 UTC (rev 4515) @@ -52,6 +52,7 @@ {"arearestdisabled", GameScript::AreaRestDisabled, 0}, {"areatype", GameScript::AreaType, 0}, {"atlocation", GameScript::AtLocation, 0}, + {"assaltedby", GameScript::AttackedBy, 0},//pst {"attackedby", GameScript::AttackedBy, 0}, {"becamevisible", GameScript::BecameVisible, 0}, {"bitcheck", GameScript::BitCheck,TF_MERGESTRINGS}, @@ -543,6 +544,8 @@ {"forcehide", GameScript::ForceHide, 0}, {"forceleavearealua", GameScript::ForceLeaveAreaLUA, 0}, {"forcespell", GameScript::ForceSpell, AF_BLOCKING}, + {"forceusecontainer", GameScript::ForceUseContainer,AF_BLOCKING}, + {"formation", GameScript::Formation, AF_BLOCKING}, {"fullheal", GameScript::FullHeal, 0}, {"fullhealex", GameScript::FullHeal, 0}, //pst, not sure what's different {"generatepartymember", GameScript::GeneratePartyMember, 0}, @@ -897,6 +900,7 @@ {"lasttrigger", GameScript::LastTrigger}, {"leaderof", GameScript::LeaderOf}, {"leastdamagedof", GameScript::LeastDamagedOf}, + {"marked", GameScript::LastMarkedObject}, //pst {"mostdamagedof", GameScript::MostDamagedOf}, {"myself", GameScript::Myself}, {"mytarget", GameScript::MyTarget},//see lasttargetedby(myself) @@ -1584,12 +1588,15 @@ return; } - //MySelf->ClearActions(); + //movetoobjectfollow would break if this isn't called + //(what is broken if it is here?) + MySelf->ClearActions(); + //IE even clears the path, shall we? } lastAction=a; } continueExecution = ( ExecuteResponseSet( MySelf, - rB->responseSet ) != 0 ); + rB->responseSet ) != 0 ); //clear triggers after response executed //MySelf->ClearTriggers(); if (!continueExecution) Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-03-01 21:32:48 UTC (rev 4515) @@ -1098,6 +1098,8 @@ static void ForceHide(Scriptable* Sender, Action* parameters); static void ForceLeaveAreaLUA(Scriptable* Sender, Action* parameters); static void ForceSpell(Scriptable* Sender, Action* parameters); + static void ForceUseContainer(Scriptable* Sender, Action* parameters); + static void Formation(Scriptable* Sender, Action* parameters); static void FullHeal(Scriptable* Sender, Action* parameters); static void GeneratePartyMember(Scriptable* Sender, Action* parameters); static void GetItem(Scriptable* Sender, Action* parameters); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-03-01 21:32:48 UTC (rev 4515) @@ -3858,6 +3858,8 @@ case SLOT_EFFECT_MISSILE: Inventory::SetRangedSlot(i); break; //right hand case SLOT_EFFECT_LEFT: Inventory::SetShieldSlot(i); break; + //head (for averting critical hit) + case SLOT_EFFECT_HEAD: Inventory::SetHeadSlot(i); break; default:; } } Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-03-01 21:32:48 UTC (rev 4515) @@ -200,8 +200,8 @@ #define SLOT_EFFECT_MELEE 4 //normal weapon slot #define SLOT_EFFECT_MISSILE 5 //quiver slots #define SLOT_EFFECT_LEFT 6 //shield (left hand) slot +#define SLOT_EFFECT_HEAD 7 //head slot - //fog of war bits #define FOG_DRAWFOG 1 #define FOG_DRAWSEARCHMAP 2 Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-03-01 21:32:48 UTC (rev 4515) @@ -28,6 +28,7 @@ #include "Actor.h" #include "Game.h" +static int SLOT_HEAD = -1; static int SLOT_MAGIC = -1; static int SLOT_FIST = -1; static int SLOT_MELEE = -1; @@ -348,19 +349,11 @@ UpdateWeaponAnimation(); break; + case SLOT_EFFECT_HEAD: + Owner->SetUsedHelmet(""); + break; case SLOT_EFFECT_ITEM: - { - int l = itm->AnimationType[0]-'1'; - if (l>=0 && l<=3) { - Owner->SetBase(IE_ARMOR_TYPE, 0); - } else { - if (core->CanUseItemType(SLOT_HELM, itm)) { - Owner->SetUsedHelmet(""); - } else if (core->CanUseItemType(SLOT_SHIELD, itm)) { - Owner->SetUsedShield(""); - } - } - } + Owner->SetBase(IE_ARMOR_TYPE, 0); break; } core->FreeItem(itm, item->ItemResRef, false); @@ -799,6 +792,9 @@ } } break; + case SLOT_EFFECT_HEAD: + Owner->SetUsedHelmet(itm->AnimationType); + break; case SLOT_EFFECT_ITEM: //adjusting armour level if needed { @@ -806,11 +802,7 @@ if (l>=0 && l<=3) { Owner->SetBase(IE_ARMOR_TYPE, l); } else { - if (core->CanUseItemType( SLOT_HELM, itm)) { - Owner->SetUsedHelmet(itm->AnimationType); - } else if (core->CanUseItemType(SLOT_SHIELD, itm)) { - Owner->SetUsedShield(itm->AnimationType); - } + UpdateShieldAnimation(itm); } } break; @@ -923,6 +915,7 @@ return SLOT_FIST; } +void Inventory::SetHeadSlot(int arg) { SLOT_HEAD=arg; } void Inventory::SetFistSlot(int arg) { SLOT_FIST=arg; } void Inventory::SetMagicSlot(int arg) { SLOT_MAGIC=arg; } void Inventory::SetWeaponSlot(int arg) @@ -971,6 +964,11 @@ SLOT_LEFT=arg; } +int Inventory::GetHeadSlot() +{ + return SLOT_HEAD; +} + int Inventory::GetFistSlot() { return SLOT_FIST; @@ -1394,7 +1392,12 @@ // Examine shield slot to check if we're using two weapons // TODO: for consistency, use same Item* access method as above bool twoweapon = false; - CREItem* si = GetSlotItem( core->QuerySlot(GetShieldSlot()) ); + int slot = GetShieldSlot(); + CREItem* si = NULL; + if (slot>0) { + si = GetSlotItem( (ieDword) slot ); + } + //CREItem* si = GetSlotItem( core->QuerySlot(GetShieldSlot()) ); if (si) { Item* it = core->GetItem(si->ItemResRef); if (core->CanUseItemType(SLOT_WEAPON, it)) Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-03-01 20:50:30 UTC (rev 4514) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-03-01 21:32:48 UTC (rev 4515) @@ -314,6 +314,7 @@ int WhyCantEquip(int slot, int twohanded); //setting important constants static void Init(int mb); + static void SetHeadSlot(int arg); static void SetFistSlot(int arg); static void SetMagicSlot(int arg); static void SetWeaponSlot(int arg); @@ -321,6 +322,7 @@ static void SetQuickSlot(int arg); static void SetInventorySlot(int arg); static void SetShieldSlot(int arg); + static int GetHeadSlot(); static int GetFistSlot(); static int GetMagicSlot(); static int GetWeaponSlot(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wjp...@us...> - 2007-03-02 20:13:42
|
Revision: 4516 http://gemrb.svn.sourceforge.net/gemrb/?rev=4516&view=rev Author: wjpalenstijn Date: 2007-03-02 12:13:36 -0800 (Fri, 02 Mar 2007) Log Message: ----------- update svn:ignore Property Changed: ---------------- gemrb/trunk/gemrb/ gemrb/trunk/gemrb/plugins/ Property changes on: gemrb/trunk/gemrb ___________________________________________________________________ Name: svn:ignore - .deps .libs Makefile Makefile.in gemrb + .deps .libs Makefile Makefile.in gemrb Cache GemRB.cfg.* Property changes on: gemrb/trunk/gemrb/plugins ___________________________________________________________________ Name: svn:ignore - Makefile Makefile.in + Makefile Makefile.in lib*.so This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wjp...@us...> - 2007-03-02 21:54:26
|
Revision: 4519 http://gemrb.svn.sourceforge.net/gemrb/?rev=4519&view=rev Author: wjpalenstijn Date: 2007-03-02 13:54:21 -0800 (Fri, 02 Mar 2007) Log Message: ----------- rename GemRB.cfg to GemRB.cfg.sample Added Paths: ----------- gemrb/trunk/gemrb/GemRB.cfg.sample Removed Paths: ------------- gemrb/trunk/gemrb/GemRB.cfg Property Changed: ---------------- gemrb/trunk/gemrb/ Property changes on: gemrb/trunk/gemrb ___________________________________________________________________ Name: svn:ignore - .deps .libs Makefile Makefile.in gemrb Cache GemRB.cfg.* + .deps .libs Makefile Makefile.in gemrb Cache GemRB.cfg* Deleted: gemrb/trunk/gemrb/GemRB.cfg =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg 2007-03-02 20:18:48 UTC (rev 4518) +++ gemrb/trunk/gemrb/GemRB.cfg 2007-03-02 21:54:21 UTC (rev 4519) @@ -1,228 +0,0 @@ -##################################################### -# # -# This is the GemRB Configuration file. # -# Here are defined some default parameters for # -# basic configuration and paths definition. # -# # -# Parameters are defined as a Name=Value pair # -# The Value can be of three types: # -# - String # -# - Integer # -# - Boolean # -# # -# The String value is represented as follows # -# i.e. H:\GemRB\plugins # -# Integers are defined as follows # -# i.e. 12723 # -# Booleans are represented as 1 or 0 in this file # -# # -# Lines starting with # are ignored # -# # -##################################################### - -##################################################### -# # -# Game Type [String] Use one of the following # -# values: # -# # -# bg1 Baldur's Gate # -# bg2 Baldur's Gate 2 : SoA # -# tob Baldur's Gate 2 : ToB # -# iwd IceWind Dale # -# how IceWind Dale : HoW or ToTL # -# iwd2 IceWind Dale 2 # -# pst Planescape Torment # -# (More will come) # -# # -##################################################### - -GameType=bg2 - -##################################################### -# Game Name [String] Title for GemRB window, use # -# anything you wish, e.g. Baldur's Gate 3: RotFL # -##################################################### - -GameName=Baldur's Gate 2 - -##################################################### -# Video Parameters # -##################################################### - -#Screen width -Width=640 - -#Screen height -Height=480 - -#Bits per pixel [Integer:16,24,32] -Bpp=32 - -#Fullscreen [Boolean] -Fullscreen=0 - -# Delay before tooltips appear [milliseconds] -TooltipDelay=500 - -##################################################### -# Audio Parameters # -##################################################### -# # -# All volume options are in percents, with 100 # -# being the normal and default volume # -# # -##################################################### - -# Volume of ambient sounds -VolumeAmbients = 100 - -# Volume during movie playback -VolumeMovie = 100 - -# Volume of background music -VolumeMusic = 100 - -# Volume of sound effects -VolumeSFX = 100 - -# Volume of PC or NPC voices -VolumeVoices = 100 - -##################################################### -# Case Sensitive Filesystem [Boolean] # -# # -# If your installed game files are residing on a # -# case sensitive filesystem (ext2 on Linux) then # -# you need to set this value to 1, it has no # -# effect on Windows # -##################################################### - -CaseSensitive=1 - -#GameOnCD=0 - -##################################################### -# Debug # -##################################################### - -# Do not play intro videos [Boolean], useful for development -#SkipIntroVideos=1 - -# Draw Frames per Second info [Boolean] -#DrawFPS=1 - -# Hide unexplored parts of a map -#FogOfWar=1 - -# Enable debug and cheat keystrokes, see docs/en/CheatKeys.txt -# full listing -#EnableCheatKeys=1 - -##################################################### -# Paths # -##################################################### -# # -# Note: You have to terminate all paths with the # -# path separator character ('\' for Windows users, # -# '/' for Linux users) # -# # -##################################################### - -##################################################### -# Game Paths [String] # -# # -# These are the paths where the Game you want to # -# play is installed. # -# Enter the full path to the directory. # -##################################################### - -GamePath=/mnt/windows/Programmi/Black Isle/BGII - SoA/ -CD1=/mnt/windows/Programmi/Black Isle/BGII - SoA/ -CD2=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD2/ -CD3=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD3/ -CD4=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD4/ -CD5=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD5/ - -##################################################### -# GemRB Path [String] # -# # -# This is the path where GemRB is stored, just # -# enter the full path to the GemRB executable # -##################################################### - -GemRBPath=./ - -##################################################### -# GemRB Cache Path [String] # -# # -# This is the path where GemRB will store the # -# cached files, enter the full path to the GemRB # -# Cache directory. # -##################################################### - -CachePath=./Cache/ - -##################################################### -# GemRB GUI Scripts Path [String] # -# # -# This is the path where GemRB GUI scripts are # -# stored, usually these are in the GemRB directory # -# Enter the full path to the directory containing # -# the 'GUIScript' subdirectory. # -##################################################### - -GUIScriptsPath=./ - -##################################################### -# GemRB Plugins Path [String] # -# # -# This is the path containing GemRB plugins # -# - shared libraries (.so) on Unixes, or # -# DLLs (.dll) on windows. # -# Enter the full path to the directory. # -# # -# You may need to specify this path if running # -# GemRB from source directory on Linux. # -##################################################### - -#PluginsPath=./plugins/ - -##################################################### -# GemRB Save Path [String] # -# # -# This is the path where GemRB looks for saved # -# games. # -# Enter the full path to the directory containing # -# e.g. the 'save' subdirectory. # -# # -# You do not have to specify this if you use save # -# subdir in the GamePath directory. # -##################################################### - -#SavePath=/mnt/windows/Programmi/Black Isle/BGII - SoA/ - -##################################################### -# Game Data Path [String] # -# # -# This is the subdirectory under GamePath where # -# game data files are stored. # -# # -# You probably do NOT want to specify this! # -##################################################### - -#GameDataPath=data - -##################################################### -# Game Data Override Path [String] # -# # -# This is the subdirectory under GamePath where # -# game data override files are stored. # -# # -# You probably do NOT want to specify this! # -##################################################### - -#GameOverridePath=override - -##################################################### -# END # -##################################################### Copied: gemrb/trunk/gemrb/GemRB.cfg.sample (from rev 4515, gemrb/trunk/gemrb/GemRB.cfg) =================================================================== --- gemrb/trunk/gemrb/GemRB.cfg.sample (rev 0) +++ gemrb/trunk/gemrb/GemRB.cfg.sample 2007-03-02 21:54:21 UTC (rev 4519) @@ -0,0 +1,228 @@ +##################################################### +# # +# This is the GemRB Configuration file. # +# Here are defined some default parameters for # +# basic configuration and paths definition. # +# # +# Parameters are defined as a Name=Value pair # +# The Value can be of three types: # +# - String # +# - Integer # +# - Boolean # +# # +# The String value is represented as follows # +# i.e. H:\GemRB\plugins # +# Integers are defined as follows # +# i.e. 12723 # +# Booleans are represented as 1 or 0 in this file # +# # +# Lines starting with # are ignored # +# # +##################################################### + +##################################################### +# # +# Game Type [String] Use one of the following # +# values: # +# # +# bg1 Baldur's Gate # +# bg2 Baldur's Gate 2 : SoA # +# tob Baldur's Gate 2 : ToB # +# iwd IceWind Dale # +# how IceWind Dale : HoW or ToTL # +# iwd2 IceWind Dale 2 # +# pst Planescape Torment # +# (More will come) # +# # +##################################################### + +GameType=bg2 + +##################################################### +# Game Name [String] Title for GemRB window, use # +# anything you wish, e.g. Baldur's Gate 3: RotFL # +##################################################### + +GameName=Baldur's Gate 2 + +##################################################### +# Video Parameters # +##################################################### + +#Screen width +Width=640 + +#Screen height +Height=480 + +#Bits per pixel [Integer:16,24,32] +Bpp=32 + +#Fullscreen [Boolean] +Fullscreen=0 + +# Delay before tooltips appear [milliseconds] +TooltipDelay=500 + +##################################################### +# Audio Parameters # +##################################################### +# # +# All volume options are in percents, with 100 # +# being the normal and default volume # +# # +##################################################### + +# Volume of ambient sounds +VolumeAmbients = 100 + +# Volume during movie playback +VolumeMovie = 100 + +# Volume of background music +VolumeMusic = 100 + +# Volume of sound effects +VolumeSFX = 100 + +# Volume of PC or NPC voices +VolumeVoices = 100 + +##################################################### +# Case Sensitive Filesystem [Boolean] # +# # +# If your installed game files are residing on a # +# case sensitive filesystem (ext2 on Linux) then # +# you need to set this value to 1, it has no # +# effect on Windows # +##################################################### + +CaseSensitive=1 + +#GameOnCD=0 + +##################################################### +# Debug # +##################################################### + +# Do not play intro videos [Boolean], useful for development +#SkipIntroVideos=1 + +# Draw Frames per Second info [Boolean] +#DrawFPS=1 + +# Hide unexplored parts of a map +#FogOfWar=1 + +# Enable debug and cheat keystrokes, see docs/en/CheatKeys.txt +# full listing +#EnableCheatKeys=1 + +##################################################### +# Paths # +##################################################### +# # +# Note: You have to terminate all paths with the # +# path separator character ('\' for Windows users, # +# '/' for Linux users) # +# # +##################################################### + +##################################################### +# Game Paths [String] # +# # +# These are the paths where the Game you want to # +# play is installed. # +# Enter the full path to the directory. # +##################################################### + +GamePath=/mnt/windows/Programmi/Black Isle/BGII - SoA/ +CD1=/mnt/windows/Programmi/Black Isle/BGII - SoA/ +CD2=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD2/ +CD3=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD3/ +CD4=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD4/ +CD5=/mnt/windows/Programmi/Black Isle/BGII - SoA/CD5/ + +##################################################### +# GemRB Path [String] # +# # +# This is the path where GemRB is stored, just # +# enter the full path to the GemRB executable # +##################################################### + +GemRBPath=./ + +##################################################### +# GemRB Cache Path [String] # +# # +# This is the path where GemRB will store the # +# cached files, enter the full path to the GemRB # +# Cache directory. # +##################################################### + +CachePath=./Cache/ + +##################################################### +# GemRB GUI Scripts Path [String] # +# # +# This is the path where GemRB GUI scripts are # +# stored, usually these are in the GemRB directory # +# Enter the full path to the directory containing # +# the 'GUIScript' subdirectory. # +##################################################### + +GUIScriptsPath=./ + +##################################################### +# GemRB Plugins Path [String] # +# # +# This is the path containing GemRB plugins # +# - shared libraries (.so) on Unixes, or # +# DLLs (.dll) on windows. # +# Enter the full path to the directory. # +# # +# You may need to specify this path if running # +# GemRB from source directory on Linux. # +##################################################### + +#PluginsPath=./plugins/ + +##################################################### +# GemRB Save Path [String] # +# # +# This is the path where GemRB looks for saved # +# games. # +# Enter the full path to the directory containing # +# e.g. the 'save' subdirectory. # +# # +# You do not have to specify this if you use save # +# subdir in the GamePath directory. # +##################################################### + +#SavePath=/mnt/windows/Programmi/Black Isle/BGII - SoA/ + +##################################################### +# Game Data Path [String] # +# # +# This is the subdirectory under GamePath where # +# game data files are stored. # +# # +# You probably do NOT want to specify this! # +##################################################### + +#GameDataPath=data + +##################################################### +# Game Data Override Path [String] # +# # +# This is the subdirectory under GamePath where # +# game data override files are stored. # +# # +# You probably do NOT want to specify this! # +##################################################### + +#GameOverridePath=override + +##################################################### +# END # +##################################################### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-03-03 13:53:13
|
Revision: 4524 http://gemrb.svn.sourceforge.net/gemrb/?rev=4524&view=rev Author: avenger_teambg Date: 2007-03-03 05:53:13 -0800 (Sat, 03 Mar 2007) Log Message: ----------- added plot critical flag handling with SetCriticalPathObject action Modified Paths: -------------- gemrb/trunk/gemrb/includes/ie_stats.h gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.h Modified: gemrb/trunk/gemrb/includes/ie_stats.h =================================================================== --- gemrb/trunk/gemrb/includes/ie_stats.h 2007-03-03 13:50:35 UTC (rev 4523) +++ gemrb/trunk/gemrb/includes/ie_stats.h 2007-03-03 13:53:13 UTC (rev 4524) @@ -144,10 +144,11 @@ #define MC_FALLEN_RANGER 0x0400 #define MC_EXPORTABLE 0x0800 +#define MC_PLOT_CRITICAL 0x2000 //if dies, it means game over #define MC_BEENINPARTY 0x8000 #define MC_HIDDEN 0x10000 -#define MC_NO_TALK 0x80000 //ignore dialoginterrupt +#define MC_NO_TALK 0x80000 //ignore dialoginterrupt //stats #define IE_HITPOINTS 0 Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-03 13:50:35 UTC (rev 4523) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-03 13:53:13 UTC (rev 4524) @@ -2878,6 +2878,20 @@ core->GetGame()->IncrementChapter(); } +void GameScript::SetCriticalPathObject(Scriptable* Sender, Action* parameters) +{ + Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); + if (!tar || tar->Type != ST_ACTOR) { + return; + } + Actor* actor = ( Actor* ) tar; + if (parameters->int0Parameter) { + actor->SetMCFlag(MC_PLOT_CRITICAL, BM_OR); + } else { + actor->SetMCFlag(MC_PLOT_CRITICAL, BM_NAND); + } +} + void GameScript::SetBeenInPartyFlags(Scriptable* Sender, Action* /*parameters*/) { if (Sender->Type != ST_ACTOR) { Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 13:50:35 UTC (rev 4523) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 13:53:13 UTC (rev 4524) @@ -30,6 +30,7 @@ #include "Spell.h" #include "Game.h" #include "GameScript.h" +#include "ScriptEngine.h" #include "GSUtils.h" //needed for DisplayStringCore #include "Video.h" #include <cassert> @@ -1526,6 +1527,10 @@ InternalFlags|=IF_GIVEXP; } } + //a plot critical creature has died (iwd2) + if (BaseStats[IE_MC_FLAGS]&MC_PLOT_CRITICAL) { + core->GetGUIScriptEngine()->RunFunction("DeathWindowPlot", false); + } //ensure that the scripts of the actor will run as soon as possible ImmediateEvent(); } Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-03-03 13:50:35 UTC (rev 4523) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-03-03 13:53:13 UTC (rev 4524) @@ -727,6 +727,7 @@ {"setbestweapon", GameScript::SetBestWeapon, 0}, {"setcorpseenabled", GameScript::AmbientActivate, 0},//another weird name {"setcreatureareaflags", GameScript::SetCreatureAreaFlags, 0}, + {"setcriticalpathobject", GameScript::SetCriticalPathObject, 0}, {"setdialog", GameScript::SetDialogue,0}, {"setdialogrange", GameScript::SetDialogueRange, 0}, {"setdialogue", GameScript::SetDialogue,0}, Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-03-03 13:50:35 UTC (rev 4523) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-03-03 13:53:13 UTC (rev 4524) @@ -1262,6 +1262,7 @@ static void SetBeenInPartyFlags(Scriptable* Sender, Action* parameters); static void SetBestWeapon(Scriptable *Sender, Action *parameters); static void SetCreatureAreaFlags(Scriptable* Sender, Action* parameters); + static void SetCriticalPathObject(Scriptable* Sender, Action* parameters); static void SetDialogue(Scriptable* Sender, Action* parameters); static void SetDialogueRange(Scriptable* Sender, Action* parameters); static void SetDoorFlag(Scriptable* Sender, Action* parameters); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-03-03 18:37:48
|
Revision: 4526 http://gemrb.svn.sourceforge.net/gemrb/?rev=4526&view=rev Author: avenger_teambg Date: 2007-03-03 10:37:47 -0800 (Sat, 03 Mar 2007) Log Message: ----------- added drinkable potions (in bg2 so far) Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/GUISTORE.py gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/bg2/GUIINV.py gemrb/trunk/gemrb/GUIScripts/bg2/GUISTORE.py gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/tob/GUIINV.py gemrb/trunk/gemrb/GUIScripts/tob/GUISTORE.py gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg1/GUISTORE.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/GUISTORE.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/bg1/GUISTORE.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -30,6 +30,7 @@ from GUICommonWindows import * from ie_stats import * from ie_slots import * +from GUICommon import CheckStat100 StoreWindow = None MessageWindow = None @@ -50,6 +51,7 @@ ITEM_PC = 0 ITEM_STORE = 1 +Inventory = None RentIndex = -1 Store = None Buttons = [-1,-1,-1,-1] @@ -94,23 +96,28 @@ global StoreWindow, ActionWindow, PortraitWindow global OldPortraitWindow + GemRB.SetVar ("Inventory", 0) CloseWindows () GemRB.UnloadWindow (StoreWindow) GemRB.UnloadWindow (ActionWindow) GemRB.UnloadWindow (PortraitWindow) StoreWindow = None GemRB.LeaveStore () - GemRB.SetVisible (0,1) #enabling the game control screen - GemRB.UnhideGUI () #enabling the other windows GUICommonWindows.PortraitWindow = OldPortraitWindow - SetSelectionChangeHandler( None ) + if Inventory: + GemRB.RunEventHandler("OpenInventoryWindow") + else: + GemRB.SetVisible (0,1) #enabling the game control screen + GemRB.UnhideGUI () #enabling the other windows + SetSelectionChangeHandler( None ) + return - def OpenStoreWindow (): global Store global StoreWindow, ActionWindow, PortraitWindow global OldPortraitWindow global store_update_funcs + global Inventory #these are function pointers, not strings #can't put this in global init, doh! @@ -122,6 +129,11 @@ GemRB.HideGUI () GemRB.SetVisible (0,0) #removing the game control screen + if GemRB.GetVar ("Inventory"): + Inventory = 1 + else: + Inventory = None + GemRB.SetVar ("Action", 0) GemRB.LoadWindowPack ("GUISTORE", 640, 480) StoreWindow = Window = GemRB.LoadWindow (3) @@ -245,6 +257,7 @@ LeftButton = Button = GemRB.GetControl (Window, 5) GemRB.SetText (Window, Button, 14133) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "IdentifyPressed") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoIdentifyWindow") # price ... Label = GemRB.GetControl (Window, 0x10000003) @@ -280,7 +293,6 @@ Button = GemRB.GetControl (Window, i+4) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,32,32,192,128,0,1) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "RedrawStoreStealWindow") - GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoLeftWindow") Button = GemRB.GetControl (Window, i+11) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,32,32,192,128,0,1) @@ -644,7 +656,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Price = Item['Price'] * Store['BuyMarkup'] / 100 @@ -710,7 +722,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+TopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_ID: @@ -851,6 +863,7 @@ ScrollBar = GemRB.GetControl (Window, 10) GemRB.SetVarAssoc (Window, ScrollBar, "RightTopIndex", RightCount-3) GemRB.SetVar ("LeftIndex", -1) + GemRB.SetButtonState (Window, LeftButton, IE_GUI_BUTTON_DISABLED) RedrawStoreStealWindow () @@ -858,15 +871,12 @@ Window = StoreShoppingWindow LeftIndex = GemRB.GetVar ("LeftIndex") - print LeftIndex pc = GemRB.GameGetSelectedPCSingle () - #skill check, if fails + #percentage skill check, if fails, trigger StealFailed if CheckStat100 (pc, IE_PICKPOCKET, Store['StealFailure']): - print "success!" GemRB.ChangeStoreItem (pc, LeftIndex, SHOP_STEAL) UpdateStoreStealWindow () else: - print "failure!" GemRB.StealFailed () CloseStoreWindow () @@ -890,7 +900,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, i+LeftTopIndex, ITEM_STORE) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_STEAL: @@ -926,7 +936,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Price = Item['Price'] * Store['BuyMarkup'] / 100 @@ -1028,7 +1038,7 @@ GemRB.SetVarAssoc (Window, Button, "Index", TopIndex+i) if Cure != None: Spell = GemRB.GetSpell (Cure['CureResRef']) - GemRB.SetSpellIcon (Window,Button, Cure['CureResRef'],1) + GemRB.SetSpellIcon (Window, Button, Cure['CureResRef'],1) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -370,27 +370,28 @@ def ActionQItemPressed (action): pc = GemRB.GameGetFirstSelectedPC() - GemRB.UseItem(pc, action) + #quick slot + GemRB.UseItem(pc, -2, action) return def ActionQItem1Pressed (): - ActionQItemPressed (9) + ActionQItemPressed (0) return def ActionQItem2Pressed (): - ActionQItemPressed (11) + ActionQItemPressed (1) return def ActionQItem3Pressed (): - ActionQItemPressed (12) + ActionQItemPressed (2) return def ActionQItem4Pressed (): - ActionQItemPressed (10) + ActionQItemPressed (3) return def ActionQItem5Pressed (): - ActionQItemPressed (31) + ActionQItemPressed (4) return def ActionInnatePressed (): @@ -413,6 +414,7 @@ GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) Item = GemRB.GetVar("Equipment") + #equipment index GemRB.UseItem(pc, -1, Item) return Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUIINV.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUIINV.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUIINV.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -541,6 +541,22 @@ UpdateInventoryWindow () return +def DrinkItemWindow (): + pc = GemRB.GameGetSelectedPCSingle () + slot = GemRB.GetVar ("ItemButton") + # the drink item header is always the first + GemRB.UseItem (pc, slot, 0) + GemRB.UnloadWindow (ItemInfoWindow) + return + +def ReadItemWindow (): + pc = GemRB.GameGetSelectedPCSingle () + slot = GemRB.GetVar ("ItemButton") + # the learn scroll header is always the second + GemRB.UseItem (pc, slot, 1) + GemRB.UnloadWindow (ItemInfoWindow) + return + def OpenItemWindow (): #close inventory GemRB.SetVar ("Inventory", 1) Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUISTORE.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUISTORE.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUISTORE.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -139,7 +139,7 @@ StoreWindow = Window = GemRB.LoadWindow (3) #saving the original portrait window OldPortraitWindow = GUICommonWindows.PortraitWindow - PortraitWindow = OpenPortraitWindow(0) + PortraitWindow = OpenPortraitWindow (0) ActionWindow = GemRB.LoadWindow (0) #this window is static and grey, but good to stick the frame onto GemRB.SetWindowFrame (ActionWindow) @@ -177,7 +177,6 @@ GemRB.SetVisible (Window, 1) store_update_funcs[store_buttons[0]] () GemRB.SetVisible (PortraitWindow, 1) - #GemRB.SetVar ("Inventory", 0) def OpenStoreShoppingWindow (): @@ -200,10 +199,12 @@ Button = GemRB.GetControl (Window, i+5) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,128,160,0,1) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectBuy") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoLeftWindow") Button = GemRB.GetControl (Window, i+13) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,128,160,0,1) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectSell") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoRightWindow") # Buy LeftButton = Button = GemRB.GetControl (Window, 2) @@ -260,10 +261,9 @@ # Identify Button = GemRB.GetControl (Window, 5) GemRB.SetText (Window, Button, 14133) - GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "InfoIdentifyWindow") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "IdentifyPressed") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoIdentifyWindow") - # 23 ta - # price ... Label = GemRB.GetControl (Window, 0x10000003) GemRB.SetText (Window, Label, "0") @@ -304,7 +304,7 @@ Button = GemRB.GetControl (Window, i+11) GemRB.SetVarAssoc (Window, Button, "RightIndex", i) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,128,160,0,1) - GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "StealInfoWindow") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoRightWindow") # Steal LeftButton = Button = GemRB.GetControl (Window, 1) @@ -622,7 +622,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, i+LeftTopIndex, ITEM_STORE) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_BUY: @@ -661,7 +661,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Price = Item['Price'] * Store['BuyMarkup'] / 100 @@ -727,7 +727,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+TopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_ID: @@ -879,11 +879,9 @@ pc = GemRB.GameGetSelectedPCSingle () #percentage skill check, if fails, trigger StealFailed if CheckStat100 (pc, IE_PICKPOCKET, Store['StealFailure']): - print "success!" GemRB.ChangeStoreItem (pc, LeftIndex, SHOP_STEAL) UpdateStoreStealWindow () else: - print "failure!" GemRB.StealFailed () CloseStoreWindow () @@ -907,7 +905,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, i+LeftTopIndex, ITEM_STORE) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_STEAL: @@ -943,7 +941,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Price = Item['Price'] * Store['BuyMarkup'] / 100 @@ -1045,7 +1043,7 @@ GemRB.SetVarAssoc (Window, Button, "Index", TopIndex+i) if Cure != None: Spell = GemRB.GetSpell (Cure['CureResRef']) - GemRB.SetSpellIcon (Window,Button, Cure['CureResRef'],1) + GemRB.SetSpellIcon (Window, Button, Cure['CureResRef'],1) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -370,27 +370,28 @@ def ActionQItemPressed (action): pc = GemRB.GameGetFirstSelectedPC() - GemRB.UseItem(pc, action) + #quick slot + GemRB.UseItem(pc, -2, action) return def ActionQItem1Pressed (): - ActionQItemPressed (9) + ActionQItemPressed (0) return def ActionQItem2Pressed (): - ActionQItemPressed (11) + ActionQItemPressed (1) return def ActionQItem3Pressed (): - ActionQItemPressed (12) + ActionQItemPressed (2) return def ActionQItem4Pressed (): - ActionQItemPressed (10) + ActionQItemPressed (3) return def ActionQItem5Pressed (): - ActionQItemPressed (31) + ActionQItemPressed (4) return def ActionInnatePressed (): @@ -413,6 +414,7 @@ GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) Item = GemRB.GetVar("Equipment") + #equipment index GemRB.UseItem(pc, -1, Item) return Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIINV.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIINV.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIINV.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -541,6 +541,22 @@ UpdateInventoryWindow () return +def DrinkItemWindow (): + pc = GemRB.GameGetSelectedPCSingle () + slot = GemRB.GetVar ("ItemButton") + # the drink item header is always the first + GemRB.UseItem (pc, slot, 0) + GemRB.UnloadWindow (ItemInfoWindow) + return + +def ReadItemWindow (): + pc = GemRB.GameGetSelectedPCSingle () + slot = GemRB.GetVar ("ItemButton") + # the learn scroll header is always the second + GemRB.UseItem (pc, slot, 1) + GemRB.UnloadWindow (ItemInfoWindow) + return + def OpenItemWindow (): #close inventory GemRB.SetVar ("Inventory", 1) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUISTORE.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUISTORE.py 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUISTORE.py 2007-03-03 18:37:47 UTC (rev 4526) @@ -139,7 +139,7 @@ StoreWindow = Window = GemRB.LoadWindow (3) #saving the original portrait window OldPortraitWindow = GUICommonWindows.PortraitWindow - PortraitWindow = OpenPortraitWindow(0) + PortraitWindow = OpenPortraitWindow (0) ActionWindow = GemRB.LoadWindow (0) #this window is static and grey, but good to stick the frame onto GemRB.SetWindowFrame (ActionWindow) @@ -177,7 +177,6 @@ GemRB.SetVisible (Window, 1) store_update_funcs[store_buttons[0]] () GemRB.SetVisible (PortraitWindow, 1) - #GemRB.SetVar ("Inventory", 0) def OpenStoreShoppingWindow (): @@ -200,10 +199,12 @@ Button = GemRB.GetControl (Window, i+5) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,128,160,0,1) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectBuy") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoLeftWindow") Button = GemRB.GetControl (Window, i+13) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,128,160,0,1) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectSell") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoRightWindow") # Buy LeftButton = Button = GemRB.GetControl (Window, 2) @@ -260,10 +261,9 @@ # Identify Button = GemRB.GetControl (Window, 5) GemRB.SetText (Window, Button, 14133) - GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "InfoIdentifyWindow") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "IdentifyPressed") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoIdentifyWindow") - # 23 ta - # price ... Label = GemRB.GetControl (Window, 0x10000003) GemRB.SetText (Window, Label, "0") @@ -304,7 +304,7 @@ Button = GemRB.GetControl (Window, i+11) GemRB.SetVarAssoc (Window, Button, "RightIndex", i) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,128,160,0,1) - GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "StealInfoWindow") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "InfoRightWindow") # Steal LeftButton = Button = GemRB.GetControl (Window, 1) @@ -622,7 +622,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, i+LeftTopIndex, ITEM_STORE) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_BUY: @@ -661,7 +661,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Price = Item['Price'] * Store['BuyMarkup'] / 100 @@ -727,7 +727,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+TopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_ID: @@ -879,11 +879,9 @@ pc = GemRB.GameGetSelectedPCSingle () #percentage skill check, if fails, trigger StealFailed if CheckStat100 (pc, IE_PICKPOCKET, Store['StealFailure']): - print "success!" GemRB.ChangeStoreItem (pc, LeftIndex, SHOP_STEAL) UpdateStoreStealWindow () else: - print "failure!" GemRB.StealFailed () CloseStoreWindow () @@ -907,7 +905,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, i+LeftTopIndex, ITEM_STORE) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_STEAL: @@ -943,7 +941,7 @@ if Slot != None: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) - GemRB.SetItemIcon (Window,Button, Slot['ItemResRef'],0) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Price = Item['Price'] * Store['BuyMarkup'] / 100 @@ -1045,7 +1043,7 @@ GemRB.SetVarAssoc (Window, Button, "Index", TopIndex+i) if Cure != None: Spell = GemRB.GetSpell (Cure['CureResRef']) - GemRB.SetSpellIcon (Window,Button, Cure['CureResRef'],1) + GemRB.SetSpellIcon (Window, Button, Cure['CureResRef'],1) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-03 18:37:47 UTC (rev 4526) @@ -5068,16 +5068,43 @@ if (!tar) { return; } - int Slot; + int Slot, header; Actor *scr = (Actor *) Sender; if (parameters->string0Parameter) { Slot = scr->inventory.FindItem(parameters->string0Parameter, 0); + //this is actually not in the original game code + header = parameters->int0Parameter; } else { Slot = parameters->int0Parameter; + //this is actually not in the original game code + header = parameters->int1Parameter; } - scr->UseItem(Slot, tar); + scr->UseItem(Slot, header, tar); } +void GameScript::UseItemPoint(Scriptable* Sender, Action* parameters) +{ + if (Sender->Type!=ST_ACTOR) { + return; + } + Scriptable* tar = GetActorFromObject( Sender, parameters->objects[1] ); + if (!tar) { + return; + } + int Slot, header; + Actor *scr = (Actor *) Sender; + if (parameters->string0Parameter) { + Slot = scr->inventory.FindItem(parameters->string0Parameter, 0); + //this IS in the original game code (ability) + header = parameters->int0Parameter; + } else { + Slot = parameters->int0Parameter; + //this is actually not in the original game code + header = parameters->int1Parameter; + } + scr->UseItemPoint(Slot, header, parameters->pointParameter); +} + //addfeat will be able to remove feats too //(the second int parameter is a bitmode) void GameScript::AddFeat(Scriptable* Sender, Action* parameters) Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 18:37:47 UTC (rev 4526) @@ -1635,23 +1635,32 @@ } /** returns quick item data */ -/** which is a 'use quickitem' action */ -void Actor::GetItemSlotInfo(ItemExtHeader *item, int which) +/** if header==-1 which is a 'use quickitem' action */ +/** if header is set, then which is the absolute slot index, */ +/** and header is the header index */ +void Actor::GetItemSlotInfo(ItemExtHeader *item, int which, int header) { ieWord idx; ieWord headerindex; memset(item, 0, sizeof(ItemExtHeader) ); - if (!PCStats) return; //not a player character - PCStats->GetSlotAndIndex(which,idx,headerindex); - if (headerindex==0xffff) return; //headerindex is invalid + if (header<0) { + if (!PCStats) return; //not a player character + PCStats->GetSlotAndIndex(which,idx,headerindex); + if (headerindex==0xffff) return; //headerindex is invalid + } else { + idx=(ieWord) which; + headerindex=(ieWord) header; + } CREItem *slot = inventory.GetSlotItem(idx); if (!slot) return; //quick item slot is empty Item *itm = core->GetItem(slot->ItemResRef); if (!itm) return; //quick item slot contains invalid item resref ITMExtHeader *ext_header = itm->GetExtHeader(headerindex); - if (!ext_header) return; //item has no extended header, or header index is wrong + //item has no extended header, or header index is wrong + if (!ext_header) return; memcpy(item->itemname, slot->ItemResRef, sizeof(ieResRef) ); + item->slot = idx; item->headerindex = headerindex; memcpy(&(item->AttackType), &(ext_header->AttackType), ((char *) &(item->itemname)) -((char *) &(item->AttackType)) ); @@ -2984,14 +2993,42 @@ return STR_MAGICWEAPON; } -bool Actor::UseItem(int slot, Scriptable* /*target*/) +bool Actor::UseItemPoint(int slot, int header, Point &target) { CREItem *item = inventory.GetSlotItem(slot); if (!item) return false; Item *itm = core->GetItem(item->ItemResRef); if (!itm) return false; //quick item slot contains invalid item resref + //in fact this should build a projectile and hurl it at the target + //this is just a temporary solution + EffectQueue *fx = itm->GetEffectBlock(header); + Actor *tar=GetCurrentArea()->GetActor(target, 10); + if (tar) { + fx->SetOwner(this); + fx->AddAllEffects(tar); + } // + core->FreeItem(itm,item->ItemResRef, false); + return true; +} + +bool Actor::UseItem(int slot, int header, Scriptable* target) +{ + CREItem *item = inventory.GetSlotItem(slot); + if (!item) + return false; + Item *itm = core->GetItem(item->ItemResRef); + if (!itm) return false; //quick item slot contains invalid item resref + //in fact this should build a projectile and hurl it at the target + //this is just a temporary solution + EffectQueue *fx = itm->GetEffectBlock(header); + fx->SetOwner(this); + if (target->Type==ST_ACTOR) { + fx->AddAllEffects((Actor *) target); + } else { + //ABSOLUTELY NO IDEA YET, only a few effects work on non actors + } // core->FreeItem(itm,item->ItemResRef, false); return true; Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-03-03 18:37:47 UTC (rev 4526) @@ -317,7 +317,7 @@ void DropItem(const ieResRef resref, unsigned int flags); void DropItem(int slot, unsigned int flags); /* returns item information in quickitem slot */ - void GetItemSlotInfo(ItemExtHeader *item, int which); + void GetItemSlotInfo(ItemExtHeader *item, int which, int header); /* returns spell information in quickspell slot */ void GetSpellSlotInfo(SpellExtHeader *spell, int which); /* updates quickslots */ @@ -424,8 +424,9 @@ int GetQuickSlot(int slot); /* Sets equipped Quick slot */ int SetEquippedQuickSlot(int slot); - /* Uses an item on the target */ - bool UseItem(int slot, Scriptable *target); + /* Uses an item on the target or point */ + bool UseItemPoint(int slot, int header, Point &point); + bool UseItem(int slot, int header, Scriptable *target); /* If it returns true, then default AC=10 and the lesser the better */ bool IsReverseToHit(); void InitButtons(ieDword cls); Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-03-03 18:37:47 UTC (rev 4526) @@ -851,6 +851,8 @@ {"usecontainer", GameScript::UseContainer,AF_BLOCKING}, {"usedoor", GameScript::UseDoor,AF_BLOCKING}, {"useitem", GameScript::UseItem,AF_BLOCKING}, + {"useitempoint", GameScript::UseItemPoint,AF_BLOCKING}, + {"useitempointslot", GameScript::UseItemPoint,AF_BLOCKING}, {"useitemslot", GameScript::UseItem,AF_BLOCKING}, {"vequip",GameScript::SetArmourLevel, 0}, {"verbalconstant", GameScript::VerbalConstant, 0}, Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-03-03 18:37:47 UTC (rev 4526) @@ -1366,6 +1366,7 @@ static void UseContainer(Scriptable* Sender, Action* parameters); static void UseDoor(Scriptable* Sender, Action* parameters); static void UseItem(Scriptable* Sender, Action* parameters); + static void UseItemPoint(Scriptable* Sender, Action* parameters); static void VerbalConstant(Scriptable* Sender, Action* parameters); static void VerbalConstantHead(Scriptable* Sender, Action* parameters); static void Wait(Scriptable* Sender, Action* parameters); Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-03 18:37:36 UTC (rev 4525) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-03 18:37:47 UTC (rev 4526) @@ -97,7 +97,7 @@ static SpellDescType *StoreSpells = NULL; static ItemExtHeader *ItemArray = NULL; static SpellExtHeader *SpellArray = NULL; -static UsedItemType *UsedItems = NULL; +static UsedItemType *UsedItems = NULL; static ResRefPairs *ItemSounds = NULL; static int ReputationIncrease[20]={(int) UNINIT_IEDWORD}; @@ -139,7 +139,7 @@ } /* Sets RuntimeError exception and returns NULL, so this function - * can be called in `return'. + * can be called in `return'. */ inline PyObject* RuntimeError(char* msg) { @@ -245,7 +245,7 @@ strnlwrcpy(Sound, ItemSounds[ItemType][Col], 8); } -PyDoc_STRVAR( GemRB_SetInfoTextColor__doc, +PyDoc_STRVAR( GemRB_SetInfoTextColor__doc, "SetInfoTextColor(red, green, blue, [alpha])\n\n" "Sets the color of Floating Messages in GameControl." ); @@ -660,7 +660,7 @@ int Flag; if (!PyArg_ParseTuple( args, "i", &Flag )) { - return AttributeError( GemRB_EnableCheatKeys__doc ); + return AttributeError( GemRB_EnableCheatKeys__doc ); } core->EnableCheatKeys( Flag ); @@ -1004,7 +1004,7 @@ } PyDoc_STRVAR( GemRB_LoadSymbol__doc, -"LoadSymbol(IDSResRef) => SymbolIndex\n\n" +"LoadSymbol(IDSResRef) => SymbolIndex\n\n" "Loads a IDS Symbol Table." ); static PyObject* GemRB_LoadSymbol(PyObject * /*self*/, PyObject* args) @@ -1281,7 +1281,7 @@ if (PyArg_UnpackTuple( args, "ref", 2, 2, &wi, &ci )) { if (!PyObject_TypeCheck( wi, &PyInt_Type ) || - !PyObject_TypeCheck( ci, &PyInt_Type )) { + !PyObject_TypeCheck( ci, &PyInt_Type )) { return AttributeError( GemRB_TextAreaClear__doc ); } WindowIndex = PyInt_AsLong( wi ); @@ -1615,7 +1615,7 @@ return Py_None; } -PyDoc_STRVAR( GemRB_CreateWindow__doc, +PyDoc_STRVAR( GemRB_CreateWindow__doc, "CreateWindow(WindowID, X, Y, Width, Height, MosResRef) => WindowIndex\n\n" "Creates a new empty window and returns its index."); @@ -1949,7 +1949,7 @@ // FIXME: swap is a hack for fonts which apparently have swapped f & B // colors. Maybe it depends on need_palette? - if (! swap) + if (! swap) but->SetTextColor( fore, back ); else but->SetTextColor( back, fore ); @@ -3892,7 +3892,7 @@ return AttributeError( GemRB_CreatePlayer__doc ); } //PlayerSlot is zero based - Slot = ( PlayerSlot & 0x7fff ); + Slot = ( PlayerSlot & 0x7fff ); Game *game = core->GetGame(); if (!game) { return RuntimeError( "No game loaded!" ); @@ -4598,7 +4598,7 @@ } if (core->GetCurrentStore()) { - return RuntimeError( "Already in a store!\n"); + return RuntimeError( "Already in a store!\n"); } core->SetCurrentStore( StoreResRef, NULL ); @@ -4862,7 +4862,7 @@ //store {STA_BUYSELL,STA_IDENTIFY|STA_OPTIONAL,STA_STEAL|STA_OPTIONAL,STA_CURE|STA_OPTIONAL}, //tavern -{STA_DRINK,STA_BUYSELL|STA_OPTIONAL,STA_IDENTIFY|STA_OPTIONAL,STA_STEAL|STA_OPTIONAL}, +{STA_DRINK,STA_BUYSELL|STA_OPTIONAL,STA_IDENTIFY|STA_OPTIONAL,STA_STEAL|STA_OPTIONAL}, //inn {STA_ROOMRENT,STA_BUYSELL|STA_OPTIONAL,STA_DRINK|STA_OPTIONAL,STA_STEAL|STA_OPTIONAL}, //temple @@ -4889,7 +4889,7 @@ return RuntimeError("No current store!"); } if (store->Type>STORETYPE_COUNT-1) { - store->Type=STORETYPE_COUNT-1; + store->Type=STORETYPE_COUNT-1; } PyObject* dict = PyDict_New(); PyDict_SetItemString(dict, "StoreType", PyInt_FromLong( store->Type )); @@ -5972,10 +5972,20 @@ static PyObject* GemRB_GetItem(PyObject * /*self*/, PyObject* args) { char* ResRef; + int PartyID = 0; + Actor *actor = NULL; - if (!PyArg_ParseTuple( args, "s", &ResRef)) { + if (!PyArg_ParseTuple( args, "s|i", &ResRef, &PartyID)) { return AttributeError( GemRB_GetItem__doc ); } + //it isn't a problem if actor not found + Game *game = core->GetGame(); + if (game) { + if (!PartyID) { + PartyID = game->GetSelectedPCSingle(); + } + actor = game->FindPC( PartyID ); + } Item* item = core->GetItem(ResRef); if (item == NULL) { @@ -6001,10 +6011,10 @@ PyDict_SetItemString(dict, "LoreToID", PyInt_FromLong(item->LoreToID)); int function=0; - if (core->CanUseItemType(SLOT_POTION, item, NULL) ) { + if (core->CanUseItemType(SLOT_POTION, item, actor) ) { function|=CAN_DRINK; } - if (core->CanUseItemType(SLOT_SCROLL, item, NULL) ) { + if (core->CanUseItemType(SLOT_SCROLL, item, actor) ) { ITMExtHeader *eh; Effect *f; //determining if this is a copyable scroll @@ -6029,7 +6039,7 @@ not_a_scroll: if (core->CanUseItemType(SLOT_BAG, item, NULL) ) { //allow the open container flag only if there is - //a store file (this fixes pst eye items, which + //a store file (this fixes pst eye items, which //got the same item type as bags) //this isn't required anymore, as bag itemtypes are customisable if (core->Exists( ResRef, IE_STO_CLASS_ID) ) { @@ -6059,7 +6069,7 @@ ///check if item is undroppable because the actor likes it if (UsedItemsCount==-1) { ReadUsedItems(); - } + } unsigned int i=UsedItemsCount; while(i--) { @@ -6083,7 +6093,7 @@ if (!si) { return NULL; } - + //it is always possible to put these items into the inventory if (!(core->QuerySlotType(Slot)&SLOT_INVENTORY)) { if (CheckRemoveItem(actor, si)) { @@ -6682,7 +6692,7 @@ Py_INCREF( Py_None ); return Py_None; } - + typedef union pack { ieDword data; ieByte bytes[4]; @@ -7468,20 +7478,22 @@ } PyDoc_STRVAR( GemRB_UseItem__doc, -"UseItem(actor, slot[, item])\n\n" +"UseItem(actor, slot, header)\n\n" "Makes the actor try to use an item. " -"If slot is negative, then item is the index of the item functionality in the use item list. " -"If slot is non-negative, then item is the quick item or weapon in slot."); +"If slot is -1, then header is the index of the item functionality in the use item list. " +"If slot is -2, then header is the quickslot index. " +"If slot is non-negative, then header is the header of the item in the 'slot'."); static PyObject* GemRB_UseItem(PyObject * /*self*/, PyObject* args) { int PartyID; int slot; - int item = -1; + int header; - if (!PyArg_ParseTuple( args, "ii|i", &PartyID, &slot, &item )) { + if (!PyArg_ParseTuple( args, "iii", &PartyID, &slot, &header )) { return AttributeError( GemRB_UseItem__doc ); } + Game *game = core->GetGame(); if (!game) { return RuntimeError( "No game loaded!" ); @@ -7492,15 +7504,22 @@ } ItemExtHeader itemdata; - if (slot>=0) { - actor->GetItemSlotInfo(&itemdata, slot); - } else { - if (item<0) { - return RuntimeError( "Invalid position" ); - } - actor->inventory.GetEquipmentInfo(&itemdata, item, 1); + switch (slot) { + case -1: + //some equipment + actor->inventory.GetEquipmentInfo(&itemdata, header, 1); + break; + case -2: + //quickslot + actor->GetItemSlotInfo(&itemdata, header, -1); + break; + default: + //any normal slot + actor->GetItemSlotInfo(&itemdata, core->QuerySlot(slot), header); + break; } + actor->UseItem(itemdata.slot, itemdata.headerindex, actor); printf("Use item: %s\n", itemdata.itemname); printf("Extended header: %d\n", itemdata.headerindex); printf("Attacktype: %d\n",itemdata.AttackType); @@ -7891,7 +7910,7 @@ METHOD(GetStoreCure, METH_VARARGS), METHOD(GetStoreItem, METH_VARARGS), METHOD(InvalidateWindow, METH_VARARGS), - METHOD(EnableCheatKeys, METH_VARARGS), + METHOD(EnableCheatKeys, METH_VARARGS), METHOD(UpdateMusicVolume, METH_NOARGS), METHOD(UpdateAmbientsVolume, METH_NOARGS), METHOD(GetCurrentArea, METH_NOARGS), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-03-03 23:27:44
|
Revision: 4532 http://gemrb.svn.sourceforge.net/gemrb/?rev=4532&view=rev Author: avenger_teambg Date: 2007-03-03 15:27:43 -0800 (Sat, 03 Mar 2007) Log Message: ----------- added charge removal and sound effect when item is gone Modified Paths: -------------- gemrb/trunk/gemrb/includes/defsounds.h gemrb/trunk/gemrb/override/bg1/defsound.2da gemrb/trunk/gemrb/override/bg2/defsound.2da gemrb/trunk/gemrb/override/how/defsound.2da gemrb/trunk/gemrb/override/iwd/defsound.2da gemrb/trunk/gemrb/override/iwd2/defsound.2da gemrb/trunk/gemrb/override/pst/defsound.2da gemrb/trunk/gemrb/override/tob/defsound.2da gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/Item.cpp gemrb/trunk/gemrb/plugins/Core/Item.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/includes/defsounds.h =================================================================== --- gemrb/trunk/gemrb/includes/defsounds.h 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/includes/defsounds.h 2007-03-03 23:27:43 UTC (rev 4532) @@ -38,6 +38,7 @@ #define DS_WINDOW_CLOSE 6 #define DS_OPEN_FAIL 7 #define DS_CLOSE_FAIL 8 +#define DS_ITEM_GONE 9 #define DS_RAIN 20 #define DS_SNOW 21 Modified: gemrb/trunk/gemrb/override/bg1/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/bg1/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/bg1/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE GAM_11 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/bg2/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/bg2/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/bg2/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE GAM_11 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/how/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/how/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/how/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE GAM_11 10 * 11 * 12 * @@ -26,3 +26,4 @@ LIGHTNING3 AMB_E13F RAIN AMB_E11 SNOW AMB_E02B + Modified: gemrb/trunk/gemrb/override/iwd/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/iwd/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE GAM_11 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/iwd2/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/iwd2/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE GAM_11 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/pst/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/pst/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/pst/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 INT_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE INT_11 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/tob/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/tob/defsound.2da 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/override/tob/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -9 * +ITEM_GONE GAM_11 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/CREImporter/CREImp.cpp 2007-03-03 23:27:43 UTC (rev 4532) @@ -754,9 +754,11 @@ if (item && core->Exists(item->ItemResRef, IE_ITM_CLASS_ID)) { act->inventory.SetSlotItem( item, Slot ); if (core->QuerySlotEffects( i )) { +/* if ( act->inventory.EquipItem( Slot ) ) { printf( "EQUIP2 0x%04x\n", item->Flags ); } +*/ } items[index] = NULL; continue; Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-03-03 23:27:43 UTC (rev 4532) @@ -5079,7 +5079,7 @@ //this is actually not in the original game code header = parameters->int1Parameter; } - scr->UseItem(Slot, header, tar); + scr->UseItem(Slot, header, tar, false); } void GameScript::UseItemPoint(Scriptable* Sender, Action* parameters) Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 23:27:43 UTC (rev 4532) @@ -3003,18 +3003,20 @@ //in fact this should build a projectile and hurl it at the target //this is just a temporary solution EffectQueue *fx = itm->GetEffectBlock(header); + if (!fx) + return false; Actor *tar=GetCurrentArea()->GetActor(target, 10); if (tar) { fx->SetOwner(this); fx->AddAllEffects(tar); } // + ChargeItem(slot, header, item, itm, false); core->FreeItem(itm,item->ItemResRef, false); - inventory.BreakItemSlot(slot); return true; } -bool Actor::UseItem(int slot, int header, Scriptable* target) +bool Actor::UseItem(int slot, int header, Scriptable* target, bool silent) { CREItem *item = inventory.GetSlotItem(slot); if (!item) @@ -3024,6 +3026,8 @@ //in fact this should build a projectile and hurl it at the target //this is just a temporary solution EffectQueue *fx = itm->GetEffectBlock(header); + if (!fx) + return false; fx->SetOwner(this); if (target->Type==ST_ACTOR) { fx->AddAllEffects((Actor *) target); @@ -3031,11 +3035,36 @@ //ABSOLUTELY NO IDEA YET, only a few effects work on non actors } // + ChargeItem(slot, header, item, itm, silent); core->FreeItem(itm,item->ItemResRef, false); - inventory.BreakItemSlot(slot); return true; } +void Actor::ChargeItem(int slot, int header, CREItem *item, Item *itm, bool silent) +{ + if (!itm) { + item = inventory.GetSlotItem(slot); + if (!item) + return; + itm = core->GetItem(item->ItemResRef); + } + if (!itm) return; //quick item slot contains invalid item resref + + switch(itm->UseCharge(item->Usages, header)) { + case CHG_NOSOUND: //remove item + inventory.BreakItemSlot(slot); + break; + case CHG_BREAK: //both + if (!silent) { + core->PlaySound(DS_ITEM_GONE); + } + inventory.BreakItemSlot(slot); + break; + default: //don't do anything + break; + } +} + bool Actor::IsReverseToHit() { return REVERSE_TOHIT; Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-03-03 23:27:43 UTC (rev 4532) @@ -426,7 +426,9 @@ int SetEquippedQuickSlot(int slot); /* Uses an item on the target or point */ bool UseItemPoint(int slot, int header, Point &point); - bool UseItem(int slot, int header, Scriptable *target); + bool UseItem(int slot, int header, Scriptable *target, bool silent); + /* Deducts a charge from an item */ + void ChargeItem(int slot, int header, CREItem *item, Item *itm, bool silent); /* If it returns true, then default AC=10 and the lesser the better */ bool IsReverseToHit(); void InitButtons(ieDword cls); Modified: gemrb/trunk/gemrb/plugins/Core/Item.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Item.cpp 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/Core/Item.cpp 2007-03-03 23:27:43 UTC (rev 4532) @@ -98,3 +98,24 @@ } return NULL; } + +#define CHARGE_COUNTERS 3 + +int Item::UseCharge(ieWord *Charges, int header) +{ + ITMExtHeader *ieh = GetExtHeader(header); + if (!ieh) return 0; + int type = ieh->ChargeDepletion; + int ccount = 0; + if (header<CHARGE_COUNTERS) { + ccount = --Charges[header]; + } + if (ccount>0) { + return CHG_NONE; + } + if (type == CHG_NONE) { + Charges[header]=0; + } + return type; +} + Modified: gemrb/trunk/gemrb/plugins/Core/Item.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Item.h 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/Core/Item.h 2007-03-03 23:27:43 UTC (rev 4532) @@ -80,10 +80,16 @@ #define ITEM_AT_MAGIC 3 #define ITEM_AT_BOW 4 +//projectile qualifiers #define PROJ_ARROW 1 #define PROJ_BOLT 2 #define PROJ_BULLET 4 +//charge depletion flags +#define CHG_BREAK 1 +#define CHG_NOSOUND 2 +#define CHG_NONE 3 + /** * @class ITMExtHeader * Header for special effects and uses of an Item. @@ -115,17 +121,11 @@ ieDword RechargeFlags; //this is a bitfield with many bits ieWord ProjectileAnimation; ieWord MeleeAnimation[3]; - /* - ieWord BowArrowQualifier; - ieWord CrossbowBoltQualifier; - ieWord MiscProjectileQualifier; - */ //this value is set in projectiles and launchers too int ProjectileQualifier; //this is a derived value determined on load time Effect *features; }; - /** * @class Item * Class for all things your PCs can pick, carry and wear and many they can't. @@ -212,6 +212,8 @@ return ItemDescIdentified; } + int UseCharge(ieWord *Charges, int header); + //returns the requested extended header ITMExtHeader *GetExtHeader(unsigned int which) const { Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-03 20:28:46 UTC (rev 4531) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-03 23:27:43 UTC (rev 4532) @@ -7503,6 +7503,7 @@ return RuntimeError( "Actor not found" ); } ItemExtHeader itemdata; + bool silent = false; switch (slot) { case -1: @@ -7516,15 +7517,19 @@ default: //any normal slot actor->GetItemSlotInfo(&itemdata, core->QuerySlot(slot), header); + silent = true; break; } - actor->UseItem(itemdata.slot, itemdata.headerindex, actor); + /// remove this after projectile is done printf("Use item: %s\n", itemdata.itemname); printf("Extended header: %d\n", itemdata.headerindex); printf("Attacktype: %d\n",itemdata.AttackType); printf("Range: %d\n",itemdata.Range); printf("Target: %d\n",itemdata.Target); + printf("Projectile: %d\n", itemdata.ProjectileAnimation); + // + actor->UseItem(itemdata.slot, itemdata.headerindex, actor, silent); Py_INCREF( Py_None ); return Py_None; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-03-06 22:29:29
|
Revision: 4533 http://gemrb.svn.sourceforge.net/gemrb/?rev=4533&view=rev Author: avenger_teambg Date: 2007-03-06 14:29:26 -0800 (Tue, 06 Mar 2007) Log Message: ----------- improved usable equipment list (charge counts, eq button etc) Modified Paths: -------------- gemrb/trunk/gemrb/includes/globals.h gemrb/trunk/gemrb/override/bg1/defsound.2da gemrb/trunk/gemrb/override/bg2/defsound.2da gemrb/trunk/gemrb/override/tob/defsound.2da gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Inventory.cpp gemrb/trunk/gemrb/plugins/Core/Inventory.h gemrb/trunk/gemrb/plugins/Core/Item.cpp gemrb/trunk/gemrb/plugins/Core/Store.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/includes/globals.h =================================================================== --- gemrb/trunk/gemrb/includes/globals.h 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/includes/globals.h 2007-03-06 22:29:26 UTC (rev 4533) @@ -125,6 +125,9 @@ #define GF_CHECK_ABILITIES 28 //bg2 (others?) #define GF_CHALLENGERATING 29 //iwd2 +//the number of item usage fields (used in CREItem and STOItem) +#define CHARGE_COUNTERS 3 + /////AI global defines #define AI_UPDATE_TIME 10 Modified: gemrb/trunk/gemrb/override/bg1/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/bg1/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/override/bg1/defsound.2da 2007-03-06 22:29:26 UTC (rev 4533) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -ITEM_GONE GAM_11 +ITEM_GONE EFF_M02 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/bg2/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/bg2/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/override/bg2/defsound.2da 2007-03-06 22:29:26 UTC (rev 4533) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -ITEM_GONE GAM_11 +ITEM_GONE EFF_M02 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/override/tob/defsound.2da =================================================================== --- gemrb/trunk/gemrb/override/tob/defsound.2da 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/override/tob/defsound.2da 2007-03-06 22:29:26 UTC (rev 4533) @@ -10,7 +10,7 @@ BUTTON3 GAM_04 OPENFAIL * CLOSEFAIL * -ITEM_GONE GAM_11 +ITEM_GONE EFF_M02 10 * 11 * 12 * Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-03-06 22:29:26 UTC (rev 4533) @@ -1664,7 +1664,7 @@ item->headerindex = headerindex; memcpy(&(item->AttackType), &(ext_header->AttackType), ((char *) &(item->itemname)) -((char *) &(item->AttackType)) ); - if (headerindex>2) { + if (headerindex>=CHARGE_COUNTERS) { item->Charges=0; } else { item->Charges=slot->Usages[headerindex]; @@ -2993,13 +2993,17 @@ return STR_MAGICWEAPON; } -bool Actor::UseItemPoint(int slot, int header, Point &target) +bool Actor::UseItemPoint(int slot, ieDword header, Point &target) { CREItem *item = inventory.GetSlotItem(slot); if (!item) return false; Item *itm = core->GetItem(item->ItemResRef); if (!itm) return false; //quick item slot contains invalid item resref + if ((header<CHARGE_COUNTERS) && !item->Usages[header]) { + return false; + } + //in fact this should build a projectile and hurl it at the target //this is just a temporary solution EffectQueue *fx = itm->GetEffectBlock(header); @@ -3016,13 +3020,16 @@ return true; } -bool Actor::UseItem(int slot, int header, Scriptable* target, bool silent) +bool Actor::UseItem(int slot, ieDword header, Scriptable* target, bool silent) { CREItem *item = inventory.GetSlotItem(slot); if (!item) return false; Item *itm = core->GetItem(item->ItemResRef); if (!itm) return false; //quick item slot contains invalid item resref + if ((header<CHARGE_COUNTERS) && !item->Usages[header]) { + return false; + } //in fact this should build a projectile and hurl it at the target //this is just a temporary solution EffectQueue *fx = itm->GetEffectBlock(header); @@ -3040,7 +3047,7 @@ return true; } -void Actor::ChargeItem(int slot, int header, CREItem *item, Item *itm, bool silent) +void Actor::ChargeItem(int slot, ieDword header, CREItem *item, Item *itm, bool silent) { if (!itm) { item = inventory.GetSlotItem(slot); Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-03-06 22:29:26 UTC (rev 4533) @@ -425,10 +425,10 @@ /* Sets equipped Quick slot */ int SetEquippedQuickSlot(int slot); /* Uses an item on the target or point */ - bool UseItemPoint(int slot, int header, Point &point); - bool UseItem(int slot, int header, Scriptable *target, bool silent); + bool UseItemPoint(int slot, ieDword header, Point &point); + bool UseItem(int slot, ieDword header, Scriptable *target, bool silent); /* Deducts a charge from an item */ - void ChargeItem(int slot, int header, CREItem *item, Item *itm, bool silent); + void ChargeItem(int slot, ieDword header, CREItem *item, Item *itm, bool silent); /* If it returns true, then default AC=10 and the lesser the better */ bool IsReverseToHit(); void InitButtons(ieDword cls); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-03-06 22:29:26 UTC (rev 4533) @@ -805,7 +805,7 @@ int *value = NULL; if (ItemTooltipTable) { - void* lookup; + void* lookup = NULL; ItemTooltipTable->Lookup(itemname, lookup); value = (int*)lookup; } Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-03-06 22:29:26 UTC (rev 4533) @@ -1258,6 +1258,10 @@ UpdateWeaponAnimation(); } +#define ID_NONEED 0 //id is not important +#define ID_NEED 1 //id is important +#define ID_NO 2 //shouldn't id + /* returns true if there are more item usages not fitting in given array */ bool Inventory::GetEquipmentInfo(ItemExtHeader *array, int startindex, int count) { @@ -1282,8 +1286,13 @@ //skipping if we cannot use the item int idreq1 = (slot->Flags&IE_INV_ITEM_IDENTIFIED); int idreq2 = ext_header->IDReq; - if (idreq1!=idreq2) { - continue; + switch (idreq2) { + case ID_NO: + if (idreq1) continue; + break; + case ID_NEED: + if (!idreq1) continue; + default:; } actual++; @@ -1297,13 +1306,17 @@ count--; memcpy(array[pos].itemname, slot->ItemResRef, sizeof(ieResRef) ); array[pos].headerindex = ehc; - memcpy(&(array[pos].AttackType), &(ext_header->AttackType), - ((char *) &(array[pos].itemname)) -((char *) &(array[pos].AttackType)) ); - //StoreItemInfo(array+pos, ext_header, ehc); - if (ehc>2) { - array[pos].Charges=0; + int slen = ((char *) &(array[pos].itemname)) -((char *) &(array[pos].AttackType)); + memcpy(&(array[pos].AttackType), &(ext_header->AttackType), slen); + if (ext_header->Charges) { + //don't modify ehc, it is a counter + if (ehc>=CHARGE_COUNTERS) { + array[pos].Charges=slot->Usages[0]; + } else { + array[pos].Charges=slot->Usages[ehc]; + } } else { - array[pos].Charges=slot->Usages[ehc]; + array[pos].Charges=0xffff; } pos++; } Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-03-06 22:29:26 UTC (rev 4533) @@ -175,7 +175,7 @@ //recent research showed that this field is used by the create item //for days effect. This field shows the expiration in gametime hours ieWord Expired; - ieWord Usages[3]; + ieWord Usages[CHARGE_COUNTERS]; ieDword Flags; // 2 cached values from associated item. LEAVE IT SIGNED! /** Weight of items in the stack */ Modified: gemrb/trunk/gemrb/plugins/Core/Item.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Item.cpp 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Item.cpp 2007-03-06 22:29:26 UTC (rev 4533) @@ -99,17 +99,19 @@ return NULL; } -#define CHARGE_COUNTERS 3 - int Item::UseCharge(ieWord *Charges, int header) { ITMExtHeader *ieh = GetExtHeader(header); if (!ieh) return 0; int type = ieh->ChargeDepletion; int ccount = 0; - if (header<CHARGE_COUNTERS) { - ccount = --Charges[header]; + if (header>=CHARGE_COUNTERS) { + header = 0; } + ccount = --Charges[header]; + if (!ieh->Charges) { + return CHG_NONE; + } if (ccount>0) { return CHG_NONE; } Modified: gemrb/trunk/gemrb/plugins/Core/Store.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Store.h 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/Core/Store.h 2007-03-06 22:29:26 UTC (rev 4533) @@ -73,11 +73,10 @@ * @struct STOItem * Item in a store, together with available amount etc. */ - typedef struct STOItem { ieResRef ItemResRef; ieWord PurchasedAmount; - ieWord Usages[3]; + ieWord Usages[CHARGE_COUNTERS]; ieDword Flags; // 2 cached values from associated item. LEAVE IT SIGNED! int Weight; Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-03 23:27:43 UTC (rev 4532) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-06 22:29:26 UTC (rev 4533) @@ -6898,7 +6898,7 @@ Sprite2D *Picture = NULL; if (item->UseIcon[0]) { - core->GetBAMSprite(item->UseIcon, 0, 0); + Picture = core->GetBAMSprite(item->UseIcon, 0, 0); } if (!Picture) { @@ -6921,13 +6921,13 @@ } char usagestr[10]; - if (item->Charges || item->ChargeDepletion) { + if (item->Charges && (item->Charges!=0xffff) ) { sprintf(usagestr,"%d", item->Charges); btn->SetText( usagestr ); - if (!item->Charges && item->ChargeDepletion) { - btn->SetState(IE_GUI_BUTTON_DISABLED); - } } + if (!item->Charges && (item->ChargeDepletion==CHG_NONE) ) { + btn->SetState(IE_GUI_BUTTON_DISABLED); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-03-10 23:31:31
|
Revision: 4537 http://gemrb.svn.sourceforge.net/gemrb/?rev=4537&view=rev Author: avenger_teambg Date: 2007-03-10 15:31:31 -0800 (Sat, 10 Mar 2007) Log Message: ----------- synchronised iwd spell/equipment action buttons with the current developments Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py gemrb/trunk/gemrb/override/how/guibtact.2da gemrb/trunk/gemrb/override/iwd/guibtact.2da Modified: gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-03-10 21:54:29 UTC (rev 4536) +++ gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-03-10 23:31:31 UTC (rev 4537) @@ -27,6 +27,8 @@ from GUIDefines import * from GUICommon import CloseOtherWindow from ie_stats import * +from ie_modal import * +from ie_action import * FRAME_PC_SELECTED = 0 FRAME_PC_TARGET = 1 @@ -241,8 +243,10 @@ elif level == 1: GemRB.SetupEquipmentIcons(ActionsWindow, pc, TopIndex) elif level == 2: #spells + GemRB.SetVar("Type", 3) GemRB.SetupSpellIcons(ActionsWindow, pc, 3, TopIndex) elif level == 3: #innates + GemRB.SetVar("Type", 4) GemRB.SetupSpellIcons(ActionsWindow, pc, 4, TopIndex) return @@ -287,17 +291,60 @@ return #no check needed because the button wouldn't be drawn if illegal -def LeftScrollPressed (): - GemRB.SetVar ("TopIndex", GemRB.GetVar ("TopIndex") -1) +def ActionLeftPressed (): + TopIndex = GemRB.GetVar ("TopIndex") + if TopIndex>10: + TopIndex -= 10 + else: + TopIndex = 0 + GemRB.SetVar ("TopIndex", TopIndex) UpdateActionsWindow () return #no check needed because the button wouldn't be drawn if illegal -def RightScrollPressed (): - GemRB.SetVar ("TopIndex", GemRB.GetVar ("TopIndex") +1) +def ActionRightPressed (): + pc = GemRB.GameGetFirstSelectedPC() + TopIndex = GemRB.GetVar ("TopIndex") + Type = GemRB.GetVar ("Type") + if Type == 3: + Max = GemRB.GetMemorizedSpellsCount(pc,0)+GemRB.GetMemorizedSpellsCount(pc,1) + else: + Max = GemRB.GetMemorizedSpellsCount(pc,2) + TopIndex += 10 + if TopIndex > Max - 10: + if Max>10: + TopIndex = Max-10 + else: + TopIndex = 0 + + GemRB.SetVar ("TopIndex", TopIndex) UpdateActionsWindow () return +def ActionSongPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_BATTLESONG) + UpdateActionsWindow () + return + +def ActionSearchPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_DETECTTRAPS) + UpdateActionsWindow () + return + +def ActionStealthPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_STEALTH) + UpdateActionsWindow () + return + +def ActionTurnPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_TURNUNDEAD) + UpdateActionsWindow () + return + def ActionUseItemPressed (): GemRB.SetVar ("TopIndex", 0) GemRB.SetVar ("ActionLevel", 1) @@ -310,12 +357,56 @@ UpdateActionsWindow () return +def ActionQItemPressed (action): + pc = GemRB.GameGetFirstSelectedPC() + #quick slot + GemRB.UseItem(pc, -2, action) + return + +def ActionQItem1Pressed (): + ActionQItemPressed (ACT_QSLOT1) + return + +def ActionQItem2Pressed (): + ActionQItemPressed (ACT_QSLOT2) + return + +def ActionQItem3Pressed (): + ActionQItemPressed (ACT_QSLOT3) + return + +def ActionQItem4Pressed (): + ActionQItemPressed (ACT_QSLOT4) + return + +def ActionQItem5Pressed (): + ActionQItemPressed (ACT_QSLOT5) + return + def ActionInnatePressed (): GemRB.SetVar ("TopIndex", 0) GemRB.SetVar ("ActionLevel", 3) UpdateActionsWindow () return +def SpellPressed (): + pc = GemRB.GameGetFirstSelectedPC() + + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) + Spell = GemRB.GetVar("Spell") + Type = GemRB.GetVar("Type") + GemRB.SpellCast(pc, Type, Spell) + return + +def EquipmentPressed (): + pc = GemRB.GameGetFirstSelectedPC() + + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) + Item = GemRB.GetVar("Equipment") + #equipment index + GemRB.UseItem(pc, -1, Item) + return + def GetActorClassTitle (actor): ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) KitIndex = 0 Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-03-10 21:54:29 UTC (rev 4536) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-03-10 23:31:31 UTC (rev 4537) @@ -27,6 +27,8 @@ from GUIDefines import * from GUICommon import CloseOtherWindow from ie_stats import * +from ie_modal import * +from ie_action import * FRAME_PC_SELECTED = 0 FRAME_PC_TARGET = 1 @@ -115,6 +117,7 @@ else: GemRB.GameSetScreenFlags(GS_PARTYAI, OP_OR) GemRB.SetTooltip (PortraitWindow, Button, 15917) + return def RestPress (): GemRB.RestParty(0,0,0) @@ -238,8 +241,10 @@ elif level == 1: GemRB.SetupEquipmentIcons(ActionsWindow, pc, TopIndex) elif level == 2: #spells + GemRB.SetVar("Type", 3) GemRB.SetupSpellIcons(ActionsWindow, pc, 3, TopIndex) elif level == 3: #innates + GemRB.SetVar("Type", 4) GemRB.SetupSpellIcons(ActionsWindow, pc, 4, TopIndex) return @@ -284,17 +289,60 @@ return #no check needed because the button wouldn't be drawn if illegal -def LeftScrollPressed (): - GemRB.SetVar ("TopIndex", GemRB.GetVar ("TopIndex") -1) +def ActionLeftPressed (): + TopIndex = GemRB.GetVar ("TopIndex") + if TopIndex>10: + TopIndex -= 10 + else: + TopIndex = 0 + GemRB.SetVar ("TopIndex", TopIndex) UpdateActionsWindow () return #no check needed because the button wouldn't be drawn if illegal -def RightScrollPressed (): - GemRB.SetVar ("TopIndex", GemRB.GetVar ("TopIndex") +1) +def ActionRightPressed (): + pc = GemRB.GameGetFirstSelectedPC() + TopIndex = GemRB.GetVar ("TopIndex") + Type = GemRB.GetVar ("Type") + if Type == 3: + Max = GemRB.GetMemorizedSpellsCount(pc,0)+GemRB.GetMemorizedSpellsCount(pc,1) + else: + Max = GemRB.GetMemorizedSpellsCount(pc,2) + TopIndex += 10 + if TopIndex > Max - 10: + if Max>10: + TopIndex = Max-10 + else: + TopIndex = 0 + + GemRB.SetVar ("TopIndex", TopIndex) UpdateActionsWindow () return +def ActionSongPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_BATTLESONG) + UpdateActionsWindow () + return + +def ActionSearchPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_DETECTTRAPS) + UpdateActionsWindow () + return + +def ActionStealthPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_STEALTH) + UpdateActionsWindow () + return + +def ActionTurnPressed (): + pc = GemRB.GameGetFirstSelectedPC() + GemRB.SetModalState (pc, MS_TURNUNDEAD) + UpdateActionsWindow () + return + def ActionUseItemPressed (): GemRB.SetVar ("TopIndex", 0) GemRB.SetVar ("ActionLevel", 1) @@ -307,12 +355,56 @@ UpdateActionsWindow () return +def ActionQItemPressed (action): + pc = GemRB.GameGetFirstSelectedPC() + #quick slot + GemRB.UseItem(pc, -2, action) + return + +def ActionQItem1Pressed (): + ActionQItemPressed (ACT_QSLOT1) + return + +def ActionQItem2Pressed (): + ActionQItemPressed (ACT_QSLOT2) + return + +def ActionQItem3Pressed (): + ActionQItemPressed (ACT_QSLOT3) + return + +def ActionQItem4Pressed (): + ActionQItemPressed (ACT_QSLOT4) + return + +def ActionQItem5Pressed (): + ActionQItemPressed (ACT_QSLOT5) + return + def ActionInnatePressed (): GemRB.SetVar ("TopIndex", 0) GemRB.SetVar ("ActionLevel", 3) UpdateActionsWindow () return +def SpellPressed (): + pc = GemRB.GameGetFirstSelectedPC() + + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) + Spell = GemRB.GetVar("Spell") + Type = GemRB.GetVar("Type") + GemRB.SpellCast(pc, Type, Spell) + return + +def EquipmentPressed (): + pc = GemRB.GameGetFirstSelectedPC() + + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) + Item = GemRB.GetVar("Equipment") + #equipment index + GemRB.UseItem(pc, -1, Item) + return + def GetActorClassTitle (actor): ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) KitIndex = 0 Modified: gemrb/trunk/gemrb/override/how/guibtact.2da =================================================================== --- gemrb/trunk/gemrb/override/how/guibtact.2da 2007-03-10 21:54:29 UTC (rev 4536) +++ gemrb/trunk/gemrb/override/how/guibtact.2da 2007-03-10 23:31:31 UTC (rev 4537) @@ -1,26 +1,37 @@ 2DA V1.0 -1 - 1 2 3 4 TOOLTIP RESREF -Stealth 30 31 32 33 4968 guibtact -Thieving 26 27 28 29 4971 guibtact -Cast 12 13 52 53 4688 guibtact -QSpell1 0 1 24 25 4938 guibtbut -QSpell2 2 3 26 27 4938 guibtbut -QSpell3 4 5 28 29 4938 guibtbut -Turn 8 9 10 11 4974 guibtact -Talk 4 5 6 7 4933 guibtact -UseItem 18 19 56 57 4978 guibtact -QItem1 0 1 24 25 4937 guibtbut -QItem4 6 7 30 31 4937 guibtbut -QItem2 2 3 26 27 4937 guibtbut -QItem3 4 5 28 29 4937 guibtbut -Innate 38 39 54 55 4954 guibtact -Defend 0 1 2 3 15925 guibtact -Attack 14 15 16 17 4666 guibtact -QWeapon1 0 1 24 25 4950 guibtbut -QWeapon2 2 3 26 27 4950 guibtbut -QWeapon3 4 5 28 29 4950 guibtbut -QWeapon4 6 7 30 31 4950 guibtbut -BardSong 22 23 24 25 11798 guibtact -Stop 58 59 60 61 15924 guibtact -Search 34 35 36 37 4927 guibtact + 1 2 3 4 TOOLTIP RESREF +Stealth 30 31 32 33 4968 guibtact +Thieving 26 27 28 29 4971 guibtact +Cast 12 13 52 53 4688 guibtact +QSpell1 0 1 24 25 4938 guibtbut +QSpell2 2 3 26 27 4938 guibtbut +QSpell3 4 5 28 29 4938 guibtbut +Turn 8 9 10 11 4974 guibtact +Talk 4 5 6 7 4933 guibtact +UseItem 18 19 56 57 4978 guibtact +QItem1 0 1 24 25 4937 guibtbut +QItem4 6 7 30 31 4937 guibtbut +QItem2 2 3 26 27 4937 guibtbut +QItem3 4 5 28 29 4937 guibtbut +Innate 38 39 54 55 4954 guibtact +Defend 0 1 2 3 15925 guibtact +Attack 14 15 16 17 4666 guibtact +QWeapon1 0 1 24 25 4950 guibtbut +QWeapon2 2 3 26 27 4950 guibtbut +QWeapon3 4 5 28 29 4950 guibtbut +QWeapon4 6 7 30 31 4950 guibtbut +BardSong 22 23 24 25 11798 guibtact +Stop 58 59 60 61 15924 guibtact +Search 34 35 36 37 4927 guibtact +23 * * * * * * +24 * * * * * * +25 * * * * * * +26 * * * * * * +27 * * * * * * +28 * * * * * * +29 * * * * * * +30 * * * * * * +QItem5 0 1 2 3 4937 guibtbut +Left 44 45 -1 -1 -1 guibtact +Right 42 43 -1 -1 -1 guibtact Modified: gemrb/trunk/gemrb/override/iwd/guibtact.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd/guibtact.2da 2007-03-10 21:54:29 UTC (rev 4536) +++ gemrb/trunk/gemrb/override/iwd/guibtact.2da 2007-03-10 23:31:31 UTC (rev 4537) @@ -1,26 +1,37 @@ 2DA V1.0 -1 - 1 2 3 4 TOOLTIP RESREF -Stealth 30 31 32 33 4968 guibtact -Thieving 26 27 28 29 4971 guibtact -Cast 12 13 52 53 4688 guibtact -QSpell1 0 1 24 25 4938 guibtbut -QSpell2 2 3 26 27 4938 guibtbut -QSpell3 4 5 28 29 4938 guibtbut -Turn 8 9 10 11 4974 guibtact -Talk 4 5 6 7 4933 guibtact -UseItem 18 19 56 57 4978 guibtact -QItem1 0 1 24 25 4937 guibtbut -QItem4 6 7 30 31 4937 guibtbut -QItem2 2 3 26 27 4937 guibtbut -QItem3 4 5 28 29 4937 guibtbut -Innate 38 39 54 55 4954 guibtact -Defend 0 1 2 3 15925 guibtact -Attack 14 15 16 17 4666 guibtact -QWeapon1 0 1 24 25 4950 guibtbut -QWeapon2 2 3 26 27 4950 guibtbut -QWeapon3 4 5 28 29 4950 guibtbut -QWeapon4 6 7 30 31 4950 guibtbut -BardSong 22 23 24 25 11798 guibtact -Stop 58 59 60 61 15924 guibtact -Search 34 35 36 37 4927 guibtact + 1 2 3 4 TOOLTIP RESREF +Stealth 30 31 32 33 4968 guibtact +Thieving 26 27 28 29 4971 guibtact +Cast 12 13 52 53 4688 guibtact +QSpell1 0 1 24 25 4938 guibtbut +QSpell2 2 3 26 27 4938 guibtbut +QSpell3 4 5 28 29 4938 guibtbut +Turn 8 9 10 11 4974 guibtact +Talk 4 5 6 7 4933 guibtact +UseItem 18 19 56 57 4978 guibtact +QItem1 0 1 24 25 4937 guibtbut +QItem4 6 7 30 31 4937 guibtbut +QItem2 2 3 26 27 4937 guibtbut +QItem3 4 5 28 29 4937 guibtbut +Innate 38 39 54 55 4954 guibtact +Defend 0 1 2 3 15925 guibtact +Attack 14 15 16 17 4666 guibtact +QWeapon1 0 1 24 25 4950 guibtbut +QWeapon2 2 3 26 27 4950 guibtbut +QWeapon3 4 5 28 29 4950 guibtbut +QWeapon4 6 7 30 31 4950 guibtbut +BardSong 22 23 24 25 11798 guibtact +Stop 58 59 60 61 15924 guibtact +Search 34 35 36 37 4927 guibtact +23 * * * * * * +24 * * * * * * +25 * * * * * * +26 * * * * * * +27 * * * * * * +28 * * * * * * +29 * * * * * * +30 * * * * * * +QItem5 0 1 2 3 4937 guibtbut +Left 44 45 -1 -1 -1 guibtact +Right 42 43 -1 -1 -1 guibtact This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-03-13 19:36:04
|
Revision: 4556 http://gemrb.svn.sourceforge.net/gemrb/?rev=4556&view=rev Author: avenger_teambg Date: 2007-03-13 12:35:48 -0700 (Tue, 13 Mar 2007) Log Message: ----------- fully implemented disguise in pst implemented weapon colour (pulsating colours still need work) in pst some source file indentation cleanup Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/pst/GUIINV.py gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp gemrb/trunk/gemrb/plugins/Core/EffectQueue.h gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/Core/Inventory.cpp gemrb/trunk/gemrb/plugins/Core/Inventory.h gemrb/trunk/gemrb/plugins/Core/Item.cpp gemrb/trunk/gemrb/plugins/Core/Item.h gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.cpp gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp gemrb/trunk/gemrb/plugins/MVEPlayer/MVEPlay.cpp gemrb/trunk/gemrb/plugins/PNGImporter/PNGImp.cpp Modified: gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py 2007-03-13 19:35:48 UTC (rev 4556) @@ -207,22 +207,22 @@ def UpdateAnimation (): - disguise = GemRB.GetGameVar ("APPEARANCE") pc = GemRB.GameGetSelectedPCSingle () - if disguise == 2: #dustman - GemRB.SetPlayerStat (pc, IE_ANIMATION_ID, 0x5d) - return - if disguise == 1: #zombie - GemRB.SetPlayerStat (pc, IE_ANIMATION_ID, 0x52) - return - slot = GemRB.GetEquippedQuickSlot (pc) - item = GemRB.GetSlotItem (pc, slot ) - animid = "" - if item: - item = GemRB.GetItem(item["ItemResRef"]) + disguise = GemRB.GetGameVar ("APPEARANCE") + if disguise == 2: #dustman + animid = "DR" + elif disguise == 1: #zombie + animid = "ZO" + else: + slot = GemRB.GetEquippedQuickSlot (pc) + item = GemRB.GetSlotItem (pc, slot ) + animid = "" if item: - animid = item["AnimationType"] + item = GemRB.GetItem(item["ItemResRef"]) + if item: + animid = item["AnimationType"] + BioTable = GemRB.LoadTable ("BIOS") Specific = "%d"%GemRB.GetPlayerStat (pc, IE_SPECIFIC) AvatarName = GemRB.GetTableValue (BioTable, Specific, "PC") @@ -465,10 +465,8 @@ Class = GemRB.FindTableValue (ClassTable, 5, 4) SaveName2 = GemRB.GetTableValue (ClassTable, Class, 3) Class = 0 #fighter - print "SaveName2", SaveName2 SaveName1 = GemRB.GetTableValue (ClassTable, Class, 3) - print "SaveName1", SaveName1 for row in range(5): tmp1 = GetSavingThrow (SaveName1, row, level1) @@ -477,7 +475,6 @@ if tmp2<tmp1: tmp1=tmp2 GemRB.SetPlayerStat (pc, IE_SAVEVSDEATH+row, tmp1) - print "Savingthrow:", tmp1 return Modified: gemrb/trunk/gemrb/GUIScripts/pst/GUIINV.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/pst/GUIINV.py 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/GUIScripts/pst/GUIINV.py 2007-03-13 19:35:48 UTC (rev 4556) @@ -147,6 +147,8 @@ Window = InventoryWindow + GemRB.RunEventHandler("UpdateAnimation") + pc = GemRB.GameGetSelectedPCSingle () Container = GemRB.GetContainer (pc, 1) @@ -333,9 +335,13 @@ pc = GemRB.GameGetSelectedPCSingle () - GemRB.DropDraggedItem (pc, -1) - #item = GemRB.GetItem (ResRef) - #GemRB.PlaySound (item["BrokenItem"]) + item = GemRB.GetSlotItem (0,0) + ret = GemRB.DropDraggedItem (pc, -1) + #this is exactly the same hack as the blackisle guys did it + #quite lame, but we should copy their efforts the best + if ret == 2 and item and (item['ItemResRef'] == "dustrobe"): + GemRB.SetGlobal("APPEARANCE","GLOBAL",2) + UpdateInventoryWindow () return @@ -348,11 +354,20 @@ ResRef = slot_item['ItemResRef'] item = GemRB.GetItem (ResRef) GemRB.DragItem (pc, slot, item["ItemIcon"], 0, 0) + if slot == 2: + GemRB.SetGlobal("APPEARANCE","GLOBAL",0) else: + item = GemRB.GetSlotItem (0,0) + itemdata = GemRB.GetItem(item['ItemResRef']) GemRB.DropDraggedItem (pc, slot) + if slot == 2 and item['ItemResRef'] == 'dustrobe': + GemRB.SetGlobal("APPEARANCE","GLOBAL",2) + elif slot < 21 and itemdata['AnimationType'] != '': + GemRB.SetGlobal("APPEARANCE","GLOBAL",0) UpdateInventoryWindow () + def OnDropItemToPC (): pc = GemRB.GetVar ("PressedPortrait") + 1 GemRB.DropDraggedItem (pc, -3) Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -254,7 +254,7 @@ opcodes_count += count; effectnames[opcodes_count].Name = NULL; //if we merge two effect lists, then we need to sort their effect tables - //actually, we might always want to sort this list, so there is no + //actually, we might always want to sort this list, so there is no //need to do it manually (sorted table is needed if we use bsearch) qsort(effectnames, opcodes_count, sizeof(EffectRef), compare_effects); } @@ -262,7 +262,6 @@ EffectQueue::EffectQueue() { Owner = NULL; -// opcodes_count = 0; } EffectQueue::~EffectQueue() @@ -272,6 +271,30 @@ } } +Effect *EffectQueue::CreateEffect(ieDword opcode, ieDword param1, ieDword param2, ieDword timing) +{ + if (opcode==0xffffffff) { + return NULL; + } + Effect *fx = new Effect(); + if (!fx) { + return NULL; + } + memset(fx,0,sizeof(Effect)); + fx->Opcode=opcode; + fx->Probability1=100; + fx->Parameter1=param1; + fx->Parameter2=param2; + fx->TimingMode=timing; + return fx; +} + +Effect *EffectQueue::CreateEffect(EffectRef &effect_reference, ieDword param1, ieDword param2, ieDword timing) +{ + ResolveEffectRef(effect_reference); + return CreateEffect(effect_reference.EffText, param1, param2, timing); +} + bool EffectQueue::AddEffect(Effect* fx) { Effect* new_fx = new Effect; @@ -597,7 +620,7 @@ if (NeedPrepare((ieByte) fx->TimingMode) ) { //prepare for delayed duration effects fx->Duration=fx->SecondaryDelay; - PrepareDuration(fx); + PrepareDuration(fx); } break; case DURATION: @@ -613,10 +636,10 @@ default: abort(); } - + EffectFunction fn = effect_refs[fx->Opcode].Function; bool flg = false; - if (fn) { + if (fn) { if ( effect_refs[fx->Opcode].EffText > 0 ) { char *text = core->GetString( effect_refs[fx->Opcode].EffText ); core->DisplayString( text ); @@ -640,7 +663,7 @@ //for example, a strength modifier effect if ((fx->TimingMode==FX_DURATION_INSTANT_PERMANENT) ) { fx->TimingMode=FX_DURATION_JUST_EXPIRED; - } + } break; case FX_ABORT: flg = true; @@ -766,12 +789,12 @@ if ( IsPrepared( (ieByte) ((*f)->TimingMode) )!=PERMANENT ) { if ( (*f)->Duration<=GameTime) { (*f)->TimingMode=FX_DURATION_JUST_EXPIRED; - } + } } } } -//this effect will expire all effects that are not truly permanent +//this effect will expire all effects that are not truly permanent //which i call permanent after death (iesdp calls it permanent after bonuses) void EffectQueue::RemoveAllNonPermanentEffects() { @@ -990,7 +1013,7 @@ } //returns true if the effect supports simplified duration -bool EffectQueue::HasDuration(Effect *fx) +bool EffectQueue::HasDuration(Effect *fx) { switch(fx->TimingMode) { case FX_DURATION_INSTANT_LIMITED: //simple duration Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-03-13 19:35:48 UTC (rev 4556) @@ -188,6 +188,7 @@ /* returns the number of saved effects */ ieDword GetSavedEffectsCount() const; size_t GetEffectsCount() const { return effects.size(); } + static Effect *CreateEffect(EffectRef &effect_reference, ieDword param1, ieDword param2, ieDword timing); //locating opcodes Effect *HasEffect(EffectRef &effect_reference); @@ -208,6 +209,7 @@ static int ResolveEffect(EffectRef &effect_reference); private: //use the effect reference style calls from outside + static Effect *CreateEffect(ieDword opcode, ieDword param1, ieDword param2, ieDword timing); void RemoveAllEffectsWithResource(ieDword opcode, const ieResRef resource); void RemoveAllEffectsWithParam(ieDword opcode, ieDword param2); Effect *HasOpcode(ieDword opcode) const; Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -4050,7 +4050,7 @@ switch (speaker->Type) { case ST_ACTOR: name = ((Actor *) speaker)->GetName(-1); - GetPalette( ((Actor *) speaker)->GetStat(IE_MAJOR_COLOR),8, ActorColor ); + GetPalette( ((Actor *) speaker)->GetStat(IE_MAJOR_COLOR), PALSIZE, ActorColor ); speaker_color = (ActorColor[4].r<<16) | (ActorColor[4].g<<8) | ActorColor[4].b; break; case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: @@ -4083,7 +4083,7 @@ switch (attacker->Type) { case ST_ACTOR: name1 = ((Actor *) attacker)->GetName(-1); - GetPalette( ((Actor *) attacker)->GetStat(IE_MAJOR_COLOR),8, ActorColor ); + GetPalette( ((Actor *) attacker)->GetStat(IE_MAJOR_COLOR),PALSIZE, ActorColor ); attacker_color = (ActorColor[4].r<<16) | (ActorColor[4].g<<8) | ActorColor[4].b; break; default: @@ -4119,7 +4119,7 @@ switch (speaker->Type) { case ST_ACTOR: name = ((Actor *) speaker)->GetName(-1); - GetPalette( ((Actor *) speaker)->GetStat(IE_MAJOR_COLOR),8, ActorColor ); + GetPalette( ((Actor *) speaker)->GetStat(IE_MAJOR_COLOR), PALSIZE, ActorColor ); speaker_color = (ActorColor[4].r<<16) | (ActorColor[4].g<<8) | ActorColor[4].b; break; case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-03-13 19:35:48 UTC (rev 4556) @@ -638,7 +638,7 @@ char GameSounds[12]; char GameScripts[12]; char GamePortraits[12]; - char GameCharacters[12]; + char GameCharacters[12]; ieResRef GameNameResRef; ieResRef GoldResRef; //MISC07.itm Variables *RtRows; Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -27,6 +27,7 @@ #include "Item.h" #include "Actor.h" #include "Game.h" +#include "ScriptEngine.h" static int SLOT_HEAD = -1; static int SLOT_MAGIC = -1; @@ -190,13 +191,18 @@ } ItemExcl|=itm->ItemExcl; + ieWord gradient = itm->GetWieldedGradient(); + if (gradient!=0xffff) { + Owner->SetBase(IE_COLORS, gradient); + } + //get the equipping effects - //EffectQueue *fxqueue = itm->GetEffectBlock(-1); - //fxqueue->SetOwner(Owner); //the equipped items owner is the equipping character - //fxqueue->ApplyAllEffects(Owner); + EffectQueue *eqfx = itm->GetEffectBlock(-1); + core->FreeItem( itm, slot->ItemResRef, false ); - for (int i = 0; i < itm->EquippingFeatureCount; i++) { - Effect *fx = itm->equipping_features+i; + int cnt = eqfx->GetEffectsCount(); + for (int i = 0; i < cnt; i++) { + Effect* fx = eqfx->GetEffect(i); fx->PosX = Owner->Pos.x; fx->PosY = Owner->Pos.y; @@ -215,8 +221,8 @@ Owner->fxqueue.AddEffect( fx ); } - - core->FreeItem( itm, slot->ItemResRef, false ); + delete eqfx; + core->GetGUIScriptEngine()->RunFunction("UpdateAnimation", false); } void Inventory::RemoveSlotEffects(CREItem* slot) @@ -227,13 +233,28 @@ if (!itm) return; ItemExcl&=~itm->ItemExcl; + EffectQueue *eqfx = itm->GetEffectBlock(-1); + core->FreeItem( itm, slot->ItemResRef, false ); + //this block is also ok, but knows too much about the item effect block + //if item wants other equipping effects (like pst weapon pulse) + //this one isn't good enough +/* for (int i = 0; i < itm->EquippingFeatureCount; i++) { Effect* fx = &itm->equipping_features[i]; if (fx->TimingMode == FX_DURATION_INSTANT_WHILE_EQUIPPED) { Owner->fxqueue.RemoveEffect( fx ); } } - core->FreeItem( itm, slot->ItemResRef, false ); +*/ + int cnt = eqfx->GetEffectsCount(); + for (int i = 0; i < cnt; i++) { + Effect* fx = eqfx->GetEffect(i); + if (fx->TimingMode == FX_DURATION_INSTANT_WHILE_EQUIPPED) { + Owner->fxqueue.RemoveEffect( fx ); + } + } + delete eqfx; + core->GetGUIScriptEngine()->RunFunction("UpdateAnimation", false); } void Inventory::SetInventoryType(int arg) @@ -1013,7 +1034,7 @@ int Inventory::GetEquippedSlot() { - if (Equipped==IW_NO_EQUIPPED) { + if (Equipped == IW_NO_EQUIPPED) { return SLOT_FIST; } if (IWD2 && Equipped>=0) { Modified: gemrb/trunk/gemrb/plugins/Core/Inventory.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/Inventory.h 2007-03-13 19:35:48 UTC (rev 4556) @@ -278,6 +278,7 @@ /** Returns item in specified slot. Does NOT change inventory */ CREItem* GetSlotItem(unsigned int slot); bool ChangeItemFlag(unsigned int slot, ieDword value, int mode); + /** Equips the item, don't use it directly for weapons */ bool EquipItem(unsigned int slot); bool UnEquipItem(unsigned int slot, bool removecurse); /** Returns equipped weapon */ Modified: gemrb/trunk/gemrb/plugins/Core/Item.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Item.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/Item.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -65,6 +65,13 @@ for (int i=0;i<count;i++) { fxqueue->AddEffect( features+i ); } + + //adding a pulse effect for weapons (PST) + if (WieldColor!=0xffff) { + if (Flags&IE_ITEM_PULSATING) { + fxqueue->AddEffect( BuildGlowEffect(WieldColor) ); + } + } return fxqueue; } @@ -101,7 +108,7 @@ return NULL; } -int Item::UseCharge(ieWord *Charges, int header) +int Item::UseCharge(ieWord *Charges, int header) const { ITMExtHeader *ieh = GetExtHeader(header); if (!ieh) return 0; @@ -130,9 +137,25 @@ if (!eh) { return NULL; } - EffectQueue *fx = GetEffectBlock(header); + EffectQueue *fx = GetEffectBlock(header); Projectile *pro = core->GetProjectileServer()->GetProjectileByIndex(eh->ProjectileAnimation); pro->SetEffects(fx); return pro; } +//this is the implementation of the weapon glow effect in PST +static EffectRef glow_ref ={"Color:PulseRGB",NULL,-1}; +//this type of colour uses PAL32, a PST specific palette +#define PALSIZE 32 +static Color ActorColor[PALSIZE]; + +Effect *Item::BuildGlowEffect(int gradient) const +{ + //palette entry to to RGB conversion + core->GetPalette( gradient, PALSIZE, ActorColor ); + ieDword rgb = (ActorColor[16].r<<16) | (ActorColor[16].g<<8) | ActorColor[16].b; + ieDword location = 0; + ieDword speed = 128; + Effect *fx = EffectQueue::CreateEffect(glow_ref, rgb, location|(speed<<16), FX_DURATION_INSTANT_WHILE_EQUIPPED); + return fx; +} Modified: gemrb/trunk/gemrb/plugins/Core/Item.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Item.h 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/Core/Item.h 2007-03-13 19:35:48 UTC (rev 4556) @@ -8,12 +8,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * @@ -57,7 +57,7 @@ #define IE_ITEM_CURSED 0x00000010 #define IE_ITEM_NOT_COPYABLE 0x00000020 #define IE_ITEM_MAGICAL 0x00000040 -#define IE_ITEM_BOW 0x00000080 +#define IE_ITEM_BOW 0x00000080 #define IE_ITEM_SILVER 0x00000100 #define IE_ITEM_COLD_IRON 0x00000200 #define IE_ITEM_STOLEN 0x00000400 @@ -80,7 +80,7 @@ #define ITEM_AT_MELEE 1 #define ITEM_AT_PROJECTILE 2 #define ITEM_AT_MAGIC 3 -#define ITEM_AT_BOW 4 +#define ITEM_AT_BOW 4 //projectile qualifiers #define PROJ_ARROW 1 @@ -214,7 +214,7 @@ return ItemDescIdentified; } - int UseCharge(ieWord *Charges, int header); + int UseCharge(ieWord *Charges, int header) const; //returns the requested extended header ITMExtHeader *GetExtHeader(unsigned int which) const @@ -224,14 +224,23 @@ } return ext_headers+which; } + ieDword GetWieldedGradient() const + { + return WieldColor; + } + //-1 will return the equipping feature block EffectQueue *GetEffectBlock(int usage) const; //returns a projectile created from an extended header Projectile *GetProjectile(int header) const; + //Builds an equipping glow effect from gradient colour + //this stuff is not item specific, could be moved elsewhere + Effect *BuildGlowEffect(int gradient) const; //returns the average damage of the weapon (doesn't check for special effects) int GetDamagePotential(bool ranged, ITMExtHeader *&header) const; //returns the weapon header ITMExtHeader *GetWeaponHeader(bool ranged) const; + }; -#endif // ! ITEM_H +#endif // ! ITEM_H Modified: gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/DLGImporter/DLGImp.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -104,8 +104,8 @@ DialogState* ds = new DialogState(); //16 = sizeof(State) str->Seek( StatesOffset + ( index * 16 ), GEM_STREAM_START ); - ieDword FirstTransitionIndex; - ieDword TriggerIndex; + ieDword FirstTransitionIndex; + ieDword TriggerIndex; str->ReadDword( &ds->StrRef ); str->ReadDword( &FirstTransitionIndex ); str->ReadDword( &ds->transitionsCount ); Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -6190,8 +6190,6 @@ core->GetSoundMgr()->Play(Sound); } core->DragItem (si, ResRef); - //this is PST specific, so the error flag is false - core->GetGUIScriptEngine()->RunFunction("UpdateAnimation", false); Py_INCREF( Py_None ); return Py_None; } @@ -6331,8 +6329,6 @@ if (Sound[0]) { core->GetSoundMgr()->Play(Sound); } - //this is PST specific, changes animation - core->GetGUIScriptEngine()->RunFunction("UpdateAnimation", false); return PyInt_FromLong( res ); } @@ -7705,16 +7701,11 @@ } work_ref.Name=opcodename; work_ref.EffText=-1; - EffectQueue::ResolveEffect(work_ref); - Effect *fx = core->GetEffect(work_ref.EffText); + Effect *fx = EffectQueue::CreateEffect(work_ref, param1, param2, FX_DURATION_INSTANT_PERMANENT_AFTER_BONUSES); if (!fx) { //invalid effect name didn't resolve to opcode return RuntimeError( "Invalid effect name!" ); } - fx->Parameter1=param1; - fx->Parameter2=param2; - fx->Probability1=100; - fx->TimingMode=FX_DURATION_INSTANT_PERMANENT_AFTER_BONUSES; //fx is freed by this function core->ApplyEffect(fx, actor, actor); Py_INCREF( Py_None ); Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -203,7 +203,7 @@ //function code (>=0x100). //If value is -1, then GemRB will use Param1, otherwise it is //compared to the target's stat using the relation function. -//The relation function is exactly the same as the extended +//The relation function is exactly the same as the extended //diffmode for gemrb. (Thus scripts can use the very same relation //functions). @@ -462,7 +462,7 @@ { if (0) printf( "fx_iwd_monster_summoning (%2d): ResRef:%s Anim:%s Type: %d\n", fx->Opcode, fx->Resource, fx->Resource2, fx->Parameter2 ); //check the summoning limit? - + ieResRef monster; ieResRef hit; ieResRef areahit; @@ -508,7 +508,7 @@ { if (0) printf( "fx_animate_dead (%2d): ResRef:%s Type: %d\n", fx->Opcode, fx->Resource, fx->Parameter2 ); //check the summoning limit? - + ieResRef monster; ieResRef hit; ieResRef areahit; @@ -525,8 +525,8 @@ } //f4,f5 (implemented in PST) -//0xf6 SummonMonster2 -#define IWD_SM2 11 +//0xf6 SummonMonster2 +#define IWD_SM2 11 ieResRef summon_monster_2da[IWD_SM2]={"SLIZARD","STROLLS","SSHADOW","ISTALKE", "CFELEMW","CEELEMW","CWELEMW","CFELEMP","CEELEMP","CWELEMP","CEELEMM"}; @@ -534,7 +534,7 @@ { if (0) printf( "fx_summon_monster2 (%2d): ResRef:%s Type: %d\n", fx->Opcode, fx->Resource, fx->Parameter2 ); //check the summoning limit? - + ieResRef monster; ieResRef hit; ieResRef areahit; @@ -601,7 +601,7 @@ { if (0) printf( "fx_summon_shadow_monster (%2d): ResRef:%s Type: %d\n", fx->Opcode, fx->Resource, fx->Parameter2 ); //check the summoning limit? - + ieResRef monster; ieResRef hit; ieResRef areahit; @@ -1238,9 +1238,9 @@ //418 FreeAction2 int fx_free_action_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_free_action_iwd2 (%2d)\n", fx->Opcode); + if (0) printf( "fx_free_action_iwd2 (%2d)\n", fx->Opcode); target->AddPortraitIcon(PI_FREEACTION); - return FX_APPLIED; + return FX_APPLIED; } //419 Unconsciousness //420 Death2 (see in core effects) Modified: gemrb/trunk/gemrb/plugins/MVEPlayer/MVEPlay.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/MVEPlayer/MVEPlay.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/MVEPlayer/MVEPlay.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -159,8 +159,8 @@ video->InitMovieScreen(w,h); MVE_rmPrepMovie( ( void * ) mve, -1, -1, 1 ); - vSpec.screenWidth = w; - vSpec.screenHeight = h; + vSpec.screenWidth = w; + vSpec.screenHeight = h; MVE_getVideoSpec( &vSpec ); bpp = vSpec.truecolor ? 16 : 8; Modified: gemrb/trunk/gemrb/plugins/PNGImporter/PNGImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/PNGImporter/PNGImp.cpp 2007-03-13 18:47:13 UTC (rev 4555) +++ gemrb/trunk/gemrb/plugins/PNGImporter/PNGImp.cpp 2007-03-13 19:35:48 UTC (rev 4556) @@ -29,7 +29,7 @@ #include <png.h> static void DataStream_png_read_data(png_structp png_ptr, - png_bytep data, png_size_t length) + png_bytep data, png_size_t length) { voidp read_io_ptr = png_get_io_ptr(png_ptr); DataStream* str = reinterpret_cast<DataStream*>(read_io_ptr); @@ -49,8 +49,6 @@ static ieDword alpha_mask = 0xff000000; - - PNGImp::PNGImp(void) { str = 0; @@ -73,7 +71,7 @@ if (inf) { if (inf->png_ptr) { png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, - &inf->end_info); + &inf->end_info); } inf->png_ptr = 0; inf->info_ptr = 0; @@ -103,26 +101,26 @@ if (!inf->png_ptr) return false; - inf->info_ptr = png_create_info_struct(inf->png_ptr); - if (!inf->info_ptr) - { - png_destroy_read_struct(&inf->png_ptr, (png_infopp)NULL, - (png_infopp)NULL); - return false; - } + inf->info_ptr = png_create_info_struct(inf->png_ptr); + if (!inf->info_ptr) + { + png_destroy_read_struct(&inf->png_ptr, (png_infopp)NULL, + (png_infopp)NULL); + return false; + } - inf->end_info = png_create_info_struct(inf->png_ptr); - if (!inf->end_info) - { - png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, - (png_infopp)NULL); - return false; - } + inf->end_info = png_create_info_struct(inf->png_ptr); + if (!inf->end_info) + { + png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, + (png_infopp)NULL); + return false; + } - if (setjmp(png_jmpbuf(inf->png_ptr))) { - png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, &inf->end_info); - return false; - } + if (setjmp(png_jmpbuf(inf->png_ptr))) { + png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, &inf->end_info); + return false; + } png_set_read_fn(inf->png_ptr, stream, DataStream_png_read_data); png_set_sig_bytes(inf->png_ptr, 8); @@ -133,8 +131,8 @@ int bit_depth, color_type; int interlace_type, compression_type, filter_method; png_get_IHDR(inf->png_ptr, inf->info_ptr, &width, &height, - &bit_depth, &color_type, - &interlace_type, &compression_type, &filter_method); + &bit_depth, &color_type, + &interlace_type, &compression_type, &filter_method); if (color_type != PNG_COLOR_TYPE_PALETTE && png_get_valid(inf->png_ptr, inf->info_ptr, PNG_INFO_tRNS)) @@ -144,8 +142,8 @@ png_set_tRNS_to_alpha(inf->png_ptr); } - if (bit_depth == 16) - png_set_strip_16(inf->png_ptr); + if (bit_depth == 16) + png_set_strip_16(inf->png_ptr); if (color_type == PNG_COLOR_TYPE_RGB) png_set_filler(inf->png_ptr, 0xFF, PNG_FILLER_AFTER); @@ -175,12 +173,12 @@ for (unsigned int i = 0; i < Height; ++i) row_pointers[i] = reinterpret_cast<png_bytep>(&buffer[(hasPalette?1:4)*i*Width]); - if (setjmp(png_jmpbuf(inf->png_ptr))) { + if (setjmp(png_jmpbuf(inf->png_ptr))) { delete[] row_pointers; free( buffer ); - png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, &inf->end_info); - return false; - } + png_destroy_read_struct(&inf->png_ptr, &inf->info_ptr, &inf->end_info); + return false; + } png_read_image(inf->png_ptr, row_pointers); @@ -230,5 +228,5 @@ void PNGImp::PutImage(DataStream* /*output*/) { - // FIXME: add png code here + // FIXME: add png code here } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-04-15 21:25:04
|
Revision: 4599 http://gemrb.svn.sourceforge.net/gemrb/?rev=4599&view=rev Author: avenger_teambg Date: 2007-04-15 14:25:05 -0700 (Sun, 15 Apr 2007) Log Message: ----------- CharAnimations: freeing modifiedPalette, create palette copy if globalmod was set, PSTOpc: set white glow for pst specific bless EffectQueue: set probability correctly for generated effects Modified Paths: -------------- gemrb/trunk/gemrb/override/pst/effects.ids gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp Modified: gemrb/trunk/gemrb/override/pst/effects.ids =================================================================== --- gemrb/trunk/gemrb/override/pst/effects.ids 2007-04-15 14:17:54 UTC (rev 4598) +++ gemrb/trunk/gemrb/override/pst/effects.ids 2007-04-15 21:25:05 UTC (rev 4599) @@ -129,7 +129,7 @@ 0x7f MonsterSummoning 0x80 State:Confused 0x81 AidNonCumulative -0x82 BlessNonCumulative +0x82 Bless 0x83 ChantNonCumulative 0x84 HolyNonCumulative 0x85 LuckNonCumulative Modified: gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp 2007-04-15 14:17:54 UTC (rev 4598) +++ gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp 2007-04-15 21:25:05 UTC (rev 4599) @@ -198,7 +198,7 @@ // TODO: Only drop weapon anims? DropAnims(); core->FreePalette(palette[PAL_WEAPON], 0); - core->FreePalette(modifiedPalette[PAL_HELMET], 0); + core->FreePalette(modifiedPalette[PAL_WEAPON], 0); } void CharAnimations::SetOffhandRef(const char* ref) @@ -248,6 +248,8 @@ // It tells how many customisable color slots we have. // The color slots start from the end of the palette and go // backwards. There are 6 available slots with a size of 32 each. + // Actually, the slots seem to be written in the cre file + // but we ignore them, i'm not sure this is correct int colorcount = Colors[6]; int size = 32; int dest = 256-colorcount*size; @@ -258,20 +260,20 @@ if ((colorcount == 0) && (needmod==false) ) { core->FreePalette(palette[PAL_MAIN], PaletteResRef); PaletteResRef[0]=0; - // FIXME: apply GlobalColorMod? return; } for (int i = 0; i < colorcount; i++) { core->GetPalette( Colors[i]&255, size, - &palette[PAL_MAIN]->col[dest] ); + &palette[PAL_MAIN]->col[dest] ); dest +=size; } - if (GlobalColorMod.type != RGBModifier::NONE) { + if (needmod) { if (!modifiedPalette[PAL_MAIN]) modifiedPalette[PAL_MAIN] = new Palette(); - //pst needs all color slots changed, luckily i already made this function modifiedPalette[PAL_MAIN]->SetupGlobalRGBModification(palette[PAL_MAIN], GlobalColorMod); + } else { + core->FreePalette(modifiedPalette[PAL_MAIN], 0); } return; } @@ -301,6 +303,8 @@ if (!modifiedPalette[PAL_MAIN]) modifiedPalette[PAL_MAIN] = new Palette(); modifiedPalette[PAL_MAIN]->SetupGlobalRGBModification(palette[PAL_MAIN], GlobalColorMod); + } else { + core->FreePalette(modifiedPalette[PAL_MAIN], 0); } return; } @@ -472,8 +476,11 @@ { DropAnims(); core->FreePalette(palette[PAL_MAIN], PaletteResRef); - for (int i = 1; i < 4; ++i) + int i; + for (i = 1; i < 4; ++i) core->FreePalette(palette[i], 0); + for (i = 0; i < 4; ++i) + core->FreePalette(modifiedPalette[i], 0); } /* This is a simple Idea of how the animation are coded @@ -772,7 +779,7 @@ } if (part < actorPartCount) { - if (!palette[PAL_MAIN] && (NoPalette()!=1) ) { + if (!palette[PAL_MAIN] && (GlobalColorMod.type!=RGBModifier::NONE) || (NoPalette()!=1) ) { // This is the first time we're loading an Animation. // We copy the palette of its first frame into our own palette palette[PAL_MAIN] = Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp 2007-04-15 14:17:54 UTC (rev 4598) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp 2007-04-15 21:25:05 UTC (rev 4599) @@ -326,7 +326,9 @@ return NULL; } memset(fx,0,sizeof(Effect)); + fx->Target=FX_TARGET_SELF; fx->Opcode=opcode; + //probability2 is the low number (by effectqueue 331) fx->Probability1=100; fx->Parameter1=param1; fx->Parameter2=param2; @@ -589,12 +591,15 @@ if (actor->fxqueue.HasEffectWithParamPair(fx_level_immunity_ref, fx->Power, 0) ) { return 0; } - if (actor->fxqueue.HasEffectWithResource(fx_spell_immunity_ref, fx->Source) ) { - return 0; + //if source is unspecified, don't resist it + if (fx->Source[0]) { + if (actor->fxqueue.HasEffectWithResource(fx_spell_immunity_ref, fx->Source) ) { + return 0; + } + if (actor->fxqueue.HasEffectWithResource(fx_spell_immunity2_ref, fx->Source) ) { + return 0; + } } - if (actor->fxqueue.HasEffectWithResource(fx_spell_immunity2_ref, fx->Source) ) { - return 0; - } if (fx->PrimaryType) { if (actor->fxqueue.HasEffectWithParam(fx_school_immunity_ref, fx->PrimaryType)) { return 0; Modified: gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp 2007-04-15 14:17:54 UTC (rev 4598) +++ gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp 2007-04-15 21:25:05 UTC (rev 4599) @@ -40,6 +40,7 @@ //unknown 0xc5-c8 int fx_overlay (Actor* Owner, Actor* target, Effect* fx);//c9 //unknown 0xca +int fx_bless (Actor* Owner, Actor* target, Effect* fx);//82 (this is a modified effect) int fx_curse (Actor* Owner, Actor* target, Effect* fx);//cb int fx_prayer (Actor* Owner, Actor* target, Effect* fx);//cc int fx_move_view (Actor* Owner, Actor* target, Effect* fx);//cd @@ -53,7 +54,8 @@ // FIXME: Make this an ordered list, so we could use bsearch! static EffectRef effectnames[] = { - { "CurseNonCumulative", fx_curse, 0},//cb + { "Bless", fx_bless, 0},//82 + { "Curse", fx_curse, 0},//cb { "DetectEvil", fx_detect_evil, 0}, //d2 { "Embalm", fx_embalm, 0}, //0xce { "FlashScreen", fx_flash_screen, 0}, //c2 @@ -329,6 +331,35 @@ return FX_NOT_APPLIED; } //0xca fx_unknown + +//0x82 fx_bless +static EffectRef glow_ref ={"Color:PulseRGBGlobal",NULL,-1}; +//pst bless effect spawns a color glow automatically +int fx_bless (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_curse (%2d): Par1: %d\n", fx->Opcode, fx->Parameter1 ); + //this bit is the same as the invisibility bit in other games + //it should be considered what if we replace the pst invis bit + //with this one (losing binary compatibility, gaining easier + //invis checks at core level) + if (STATE_GET (STATE_BLESS) ) //curse is non cummulative + return FX_NOT_APPLIED; + if (!target->fxqueue.HasEffectWithParamPair(glow_ref, 0xc8c8c800,0x300018)) { + Effect *newfx = EffectQueue::CreateEffect(glow_ref, 0xc8c8c800,0x300018, fx->TimingMode); + //calculating duration + newfx->Duration=(fx->Duration-core->GetGame()->GameTime)/6; + core->ApplyEffect(newfx, target, target); + } + STATE_SET( STATE_BLESS ); + STAT_SUB( IE_TOHIT, fx->Parameter1); + STAT_SUB( IE_SAVEVSDEATH, fx->Parameter1); + STAT_SUB( IE_SAVEVSWANDS, fx->Parameter1); + STAT_SUB( IE_SAVEVSPOLY, fx->Parameter1); + STAT_SUB( IE_SAVEVSBREATH, fx->Parameter1); + STAT_SUB( IE_SAVEVSSPELL, fx->Parameter1); + return FX_APPLIED; +} + //0xcb fx_curse int fx_curse (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -350,9 +381,9 @@ } //0xcc fx_prayer -EffectRef curse_ref={"CurseNonCumulative",NULL,-1}; -EffectRef bless_ref={"BlessNonCumulative",NULL,-1}; -int fx_prayer (Actor* /*Owner*/, Actor* target, Effect* fx) +EffectRef curse_ref={"Curse",NULL,-1}; +EffectRef bless_ref={"Bless",NULL,-1}; +int fx_prayer (Actor* Owner, Actor* target, Effect* fx) { if (0) printf( "fx_prayer (%2d): Par1: %d\n", fx->Opcode, fx->Parameter1 ); int ea = target->GetStat(IE_EA); @@ -369,11 +400,13 @@ if (ea>EA_EVILCUTOFF) type^=1; else if (ea>EA_GOODCUTOFF) continue; //this isn't a real perma effect, just applying the effect now - Effect *newfx = EffectQueue::CreateEffect(type?curse_ref:bless_ref, fx->Parameter1, fx->Parameter2, FX_DURATION_INSTANT_PERMANENT); + Effect *newfx = EffectQueue::CreateEffect(type?curse_ref:bless_ref, fx->Parameter1, fx->Parameter2, FX_DURATION_INSTANT_LIMITED); + memcpy(newfx, fx->Source,sizeof(ieResRef)); + newfx->Duration=60; //no idea how this should work with spell resistances, etc //lets assume it is never resisted - tar->fxqueue.ApplyEffect(tar, newfx, true); - delete newfx; + //the effect will be destructed by ApplyEffect + core->ApplyEffect(newfx, tar, Owner); } return FX_APPLIED; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-04-15 21:37:06
|
Revision: 4600 http://gemrb.svn.sourceforge.net/gemrb/?rev=4600&view=rev Author: avenger_teambg Date: 2007-04-15 14:37:07 -0700 (Sun, 15 Apr 2007) Log Message: ----------- added some symbols for iwd2 extended states Modified Paths: -------------- gemrb/trunk/gemrb/includes/ie_stats.h gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp Modified: gemrb/trunk/gemrb/includes/ie_stats.h =================================================================== --- gemrb/trunk/gemrb/includes/ie_stats.h 2007-04-15 21:25:05 UTC (rev 4599) +++ gemrb/trunk/gemrb/includes/ie_stats.h 2007-04-15 21:37:07 UTC (rev 4600) @@ -128,6 +128,13 @@ #define EXTSTATE_PRAYER_BAD 0x00000002 #define EXTSTATE_RECITATION 0x00000004 #define EXTSTATE_REC_BAD 0x00000008 +#define EXTSTATE_EYE_MIND 0x00000010 +#define EXTSTATE_EYE_SWORD 0x00000020 +#define EXTSTATE_EYE_MAGE 0x00000040 +#define EXTSTATE_EYE_VENOM 0x00000080 +#define EXTSTATE_EYE_SPIRIT 0x00000100 +#define EXTSTATE_EYE_FORT 0x00000200 +#define EXTSTATE_EYE_STONE 0x00000400 #define EXTSTATE_NO_BACKSTAB 0x00004000 #define EXTSTATE_DEAF 0x00020000 Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-04-15 21:25:05 UTC (rev 4599) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-04-15 21:37:07 UTC (rev 4600) @@ -316,18 +316,10 @@ static void ApplyDamageNearby(Actor* Owner, Actor* target, Effect *fx, ieDword damagetype) { - Effect *newfx = new Effect; - //fill with zeros - memset(newfx,0,sizeof(Effect)); - newfx->Opcode = EffectQueue::ResolveEffect(fx_damage_opcode_ref); - newfx->Target = FX_TARGET_SELF; + Effect *newfx = EffectQueue::CreateEffect(fx_damage_opcode_ref, fx->Parameter1, damagetype,FX_DURATION_INSTANT_PERMANENT); newfx->Power = fx->Power; - newfx->Parameter1 = fx->Parameter1; - newfx->Parameter2 = damagetype; - //newfx->Resistance = ? - newfx->Probability2=100; newfx->DiceThrown = fx->DiceThrown; - newfx->DiceSides = fx->DiceSides; + newfx->DiceSides = fx->DiceSides; memcpy(newfx->Resource, fx->Resource,sizeof(newfx->Resource) ); //applyeffectcopy on everyone near us Map *area = target->GetCurrentArea(); @@ -336,7 +328,10 @@ Actor *victim = area->GetActor(i,true); if (target!=victim) continue; if (PersonalDistance(target, victim)<20) { - core->ApplyEffect(newfx, victim, Owner); + Effect *tmp = new Effect(); + memcpy(tmp, newfx, sizeof(Effect)); + //this function deletes tmp + core->ApplyEffect(tmp, victim, Owner); } } //finally remove the master copy @@ -620,16 +615,16 @@ int fx_recitation (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_recitation (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - if (EXTSTATE_GET(4)) return FX_NOT_APPLIED; - EXTSTATE_SET(4); + if (EXTSTATE_GET(EXTSTATE_RECITATION)) return FX_NOT_APPLIED; + EXTSTATE_SET(EXTSTATE_RECITATION); return FX_APPLIED; } //fa RecitationBad int fx_recitation_bad (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_recitation (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - if (EXTSTATE_GET(8)) return FX_NOT_APPLIED; - EXTSTATE_SET(8); + if (EXTSTATE_GET(EXTSTATE_REC_BAD)) return FX_NOT_APPLIED; + EXTSTATE_SET(EXTSTATE_REC_BAD); return FX_APPLIED; } //fb LichTouch (how) @@ -866,7 +861,7 @@ { if (0) printf( "fx_eye_of_the_mind (%2d)\n", fx->Opcode ); target->add_animation("eyemind",-1,0,true); - EXTSTATE_SET(0x00000010); + EXTSTATE_SET(EXTSTATE_EYE_MIND); return FX_APPLIED; } //0x10d EyeOfTheSword @@ -874,7 +869,7 @@ { if (0) printf( "fx_eye_of_the_sword (%2d)\n", fx->Opcode ); target->add_animation("eyesword",-1,0,true); - EXTSTATE_SET(0x00000020); + EXTSTATE_SET(EXTSTATE_EYE_SWORD); return FX_APPLIED; } //0x10e EyeOfTheMage @@ -882,7 +877,7 @@ { if (0) printf( "fx_eye_of_the_mage (%2d)\n", fx->Opcode ); target->add_animation("eyemage",-1,0,true); - EXTSTATE_SET(0x00000040); + EXTSTATE_SET(EXTSTATE_EYE_MAGE); return FX_APPLIED; } //0x10f EyeOfVenom @@ -890,7 +885,7 @@ { if (0) printf( "fx_eye_of_venom (%2d)\n", fx->Opcode ); target->add_animation("eyevenom",-1,0,true); - EXTSTATE_SET(0x00000080); + EXTSTATE_SET(EXTSTATE_EYE_VENOM); return FX_APPLIED; } //0x110 EyeOfTheSpirit @@ -898,7 +893,7 @@ { if (0) printf( "fx_eye_of_the_spirit (%2d)\n", fx->Opcode ); target->add_animation("eyespir",-1,0,true); - EXTSTATE_SET(0x00000100); + EXTSTATE_SET(EXTSTATE_EYE_SPIRIT); return FX_APPLIED; } //0x111 EyeOfFortitude @@ -906,7 +901,7 @@ { if (0) printf( "fx_eye_of_fortitude (%2d)\n", fx->Opcode ); target->add_animation("eyefort",-1,0,true); - EXTSTATE_SET(0x00000200); + EXTSTATE_SET(EXTSTATE_EYE_FORT); return FX_APPLIED; } //0x112 EyeOfStone This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-01 19:35:52
|
Revision: 4631 http://gemrb.svn.sourceforge.net/gemrb/?rev=4631&view=rev Author: avenger_teambg Date: 2007-05-01 12:35:52 -0700 (Tue, 01 May 2007) Log Message: ----------- spellbookiconhack feature Modified Paths: -------------- gemrb/trunk/gemrb/includes/globals.h gemrb/trunk/gemrb/override/bg2/gemrb.ini gemrb/trunk/gemrb/override/tob/gemrb.ini Modified: gemrb/trunk/gemrb/includes/globals.h =================================================================== --- gemrb/trunk/gemrb/includes/globals.h 2007-05-01 19:22:40 UTC (rev 4630) +++ gemrb/trunk/gemrb/includes/globals.h 2007-05-01 19:35:52 UTC (rev 4631) @@ -124,6 +124,7 @@ #define GF_MAGICBIT 27 //iwd, iwd2 #define GF_CHECK_ABILITIES 28 //bg2 (others?) #define GF_CHALLENGERATING 29 //iwd2 +#define GF_SPELLBOOKICONHACK 30 //bg2 //the number of item usage fields (used in CREItem and STOItem) #define CHARGE_COUNTERS 3 Modified: gemrb/trunk/gemrb/override/bg2/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/bg2/gemrb.ini 2007-05-01 19:22:40 UTC (rev 4630) +++ gemrb/trunk/gemrb/override/bg2/gemrb.ini 2007-05-01 19:35:52 UTC (rev 4631) @@ -69,3 +69,4 @@ DialogueScrolls = 0 RedrawTile = 0 CheckAbilities = 1 +SpellBookIconHack = 1 Modified: gemrb/trunk/gemrb/override/tob/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/tob/gemrb.ini 2007-05-01 19:22:40 UTC (rev 4630) +++ gemrb/trunk/gemrb/override/tob/gemrb.ini 2007-05-01 19:35:52 UTC (rev 4631) @@ -69,3 +69,4 @@ DialogueScrolls = 0 RedrawTile = 0 CheckAbilities = 1 +SpellBookIconHack = 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-03 17:51:08
|
Revision: 4634 http://gemrb.svn.sourceforge.net/gemrb/?rev=4634&view=rev Author: avenger_teambg Date: 2007-05-03 10:51:09 -0700 (Thu, 03 May 2007) Log Message: ----------- improved spellbook guiscripts fixed spellbook hack Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/GUIMG.py gemrb/trunk/gemrb/GUIScripts/bg1/GUIPR.py gemrb/trunk/gemrb/GUIScripts/bg2/GUIMG.py gemrb/trunk/gemrb/GUIScripts/bg2/GUIPR.py gemrb/trunk/gemrb/GUIScripts/how/GUIMG.py gemrb/trunk/gemrb/GUIScripts/how/GUIPR.py gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py gemrb/trunk/gemrb/GUIScripts/tob/GUIMG.py gemrb/trunk/gemrb/GUIScripts/tob/GUIPR.py gemrb/trunk/gemrb/plugins/SPLImporter/SPLImp.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg1/GUIMG.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/GUIMG.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/bg1/GUIMG.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -81,13 +81,13 @@ GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (20): Button = GemRB.GetControl (Window, 27 + i) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdateMageWindow) UpdateMageWindow () Modified: gemrb/trunk/gemrb/GUIScripts/bg1/GUIPR.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/GUIPR.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/bg1/GUIPR.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -25,6 +25,7 @@ import GemRB from GUIDefines import * +from ie_stats import * from GUICommon import CloseOtherWindow from GUICommonWindows import SetSelectionChangeHandler @@ -37,17 +38,17 @@ def OpenPriestWindow (): global PriestWindow - + if CloseOtherWindow (OpenPriestWindow): GemRB.HideGUI () GemRB.UnloadWindow (PriestWindow) PriestWindow = None GemRB.SetVar ("OtherWindow", -1) - + SetSelectionChangeHandler (None) GemRB.UnhideGUI () return - + GemRB.HideGUI () GemRB.LoadWindowPack ("GUIPR") PriestWindow = Window = GemRB.LoadWindow (2) @@ -68,26 +69,27 @@ ## for i in range (7): ## Button = GemRB.GetControl (Window, 55 + i) ## GemRB.SetVarAssoc (Window, Button, "PriestSpellLevel", i) - + # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) - GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,160,0,1) - GemRB.SetButtonBAM (Window, Button, "SPELFRAM",0,0,0) + GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) + GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (20): Button = GemRB.GetControl (Window, 27 + i) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdatePriestWindow) UpdatePriestWindow () GemRB.UnhideGUI () - + def UpdatePriestWindow (): global PriestMemorizedSpellList, PriestKnownSpellList @@ -98,9 +100,8 @@ pc = GemRB.GameGetSelectedPCSingle () type = IE_SPELL_TYPE_PRIEST level = PriestSpellLevel - ###max_mem_cnt = GemRB.GetMemorizableSpellsCount (pc, type, level) - max_mem_cnt = 2 - + max_mem_cnt = GemRB.GetMemorizableSpellsCount (pc, type, level) + Label = GemRB.GetControl (Window, 0x10000032) GemRB.SetToken ('LEVEL', str (level + 1)) GemRB.SetText (Window, Label, 12137) @@ -129,11 +130,9 @@ GemRB.EnableButtonBorder (Window, Button, 0, ms['Flags'] == 0) else: if i < max_mem_cnt: - GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) - GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NORMAL, OP_SET) else: - GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) - GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_NAND) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_SET) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") GemRB.SetTooltip (Window, Button, '') @@ -153,6 +152,7 @@ GemRB.SetTooltip (Window, Button, spell['SpellName']) PriestKnownSpellList.append (ks['SpellResRef']) GemRB.SetVarAssoc (Window, Button, "SpellButton", 100 + i) + else: GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_NAND) @@ -161,6 +161,12 @@ GemRB.SetTooltip (Window, Button, '') GemRB.EnableButtonBorder (Window, Button, 0, 0) + Table = GemRB.LoadTable ("clskills") + if (GemRB.GetTableValue (Table, GemRB.GetPlayerStat( GemRB.GameGetSelectedPCSingle(), IE_CLASS), 1)=="*"): + GemRB.SetVisible (Window, 2) + else: + GemRB.SetVisible (Window, 1) + return def PriestPrevLevelPress (): global PriestSpellLevel @@ -168,38 +174,32 @@ if PriestSpellLevel > 0: PriestSpellLevel = PriestSpellLevel - 1 UpdatePriestWindow () + return - def PriestNextLevelPress (): global PriestSpellLevel if PriestSpellLevel < 6: PriestSpellLevel = PriestSpellLevel + 1 UpdatePriestWindow () + return - def RefreshPriestLevel (): global PriestSpellLevel PriestSpellLevel = GemRB.GetVar ("PriestSpellLevel") UpdatePriestWindow () + return - def OpenPriestSpellInfoWindow (): global PriestSpellInfoWindow - GemRB.HideGUI () - if PriestSpellInfoWindow != None: GemRB.UnloadWindow (PriestSpellInfoWindow) PriestSpellInfoWindow = None - GemRB.SetVar ("FloatWindow", -1) - - GemRB.UnhideGUI () return - + PriestSpellInfoWindow = Window = GemRB.LoadWindow (3) - GemRB.SetVar ("FloatWindow", PriestSpellInfoWindow) #back Button = GemRB.GetControl (Window, 5) @@ -226,8 +226,8 @@ Text = GemRB.GetControl (Window, 3) GemRB.SetText (Window, Text, spell['SpellDesc']) - GemRB.UnhideGUI () GemRB.ShowModal (Window, MODAL_SHADOW_GRAY) + return def OnPriestMemorizeSpell (): @@ -239,27 +239,16 @@ if GemRB.MemorizeSpell (pc, type, level, index): UpdatePriestWindow () + return - def OpenPriestSpellRemoveWindow (): global PriestSpellUnmemorizeWindow - - GemRB.HideGUI () - - if PriestSpellUnmemorizeWindow != None: - GemRB.UnloadWindow (PriestSpellUnmemorizeWindow) - PriestSpellUnmemorizeWindow = None - GemRB.SetVar ("FloatWindow", -1) - - GemRB.UnhideGUI () - return - + PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) - GemRB.SetVar ("FloatWindow", PriestSpellUnmemorizeWindow) # "Are you sure you want to ....?" TextArea = GemRB.GetControl (Window, 3) - GemRB.SetText (Window, TextArea, 63745) + GemRB.SetText (Window, TextArea, 11824) # Remove Button = GemRB.GetControl (Window, 0) @@ -271,25 +260,20 @@ GemRB.SetText (Window, Button, 13727) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "OpenPriestSpellRemoveWindow") - GemRB.UnhideGUI () GemRB.ShowModal (Window, MODAL_SHADOW_GRAY) + return +def ClosePriestSpellUnmemorizeWindow (): + global PriestSpellUnmemorizeWindow + GemRB.UnloadWindow (PriestSpellUnmemorizeWindow) + PriestSpellUnmemorizeWindow = None + return + def OpenPriestSpellUnmemorizeWindow (): global PriestSpellUnmemorizeWindow - - GemRB.HideGUI () - - if PriestSpellUnmemorizeWindow != None: - GemRB.UnloadWindow (PriestSpellUnmemorizeWindow) - PriestSpellUnmemorizeWindow = None - GemRB.SetVar ("FloatWindow", -1) - - GemRB.UnhideGUI () - return - + PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) - GemRB.SetVar ("FloatWindow", PriestSpellUnmemorizeWindow) # "Are you sure you want to ....?" TextArea = GemRB.GetControl (Window, 3) @@ -303,15 +287,14 @@ # Cancel Button = GemRB.GetControl (Window, 1) GemRB.SetText (Window, Button, 13727) - GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "OpenPriestSpellUnmemorizeWindow") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "ClosePriestSpellUnmemorizeWindow") - GemRB.UnhideGUI () GemRB.ShowModal (Window, MODAL_SHADOW_GRAY) + return - def OnPriestUnmemorizeSpell (): if PriestSpellUnmemorizeWindow: - OpenPriestSpellUnmemorizeWindow () + ClosePriestSpellUnmemorizeWindow () pc = GemRB.GameGetSelectedPCSingle () level = PriestSpellLevel @@ -321,24 +304,23 @@ if GemRB.UnmemorizeSpell (pc, type, level, index): UpdatePriestWindow () + return def OnPriestRemoveSpell (): - if PriestSpellUnmemorizeWindow: - OpenPriestSpellRemoveWindow () + ClosePriestSpellUnmemorizeWindow() + OpenPriestSpellInfoWindow() pc = GemRB.GameGetSelectedPCSingle () level = PriestSpellLevel type = IE_SPELL_TYPE_PRIEST - index = GemRB.GetVar ("SpellButton") + index = GemRB.GetVar ("SpellButton")-100 #remove spell from memory - #GemRB.UnmemorizeSpell (pc, type, level, index) - #remove spell from book - #GemRB.RemoveSpell (pc, type, level, index) + GemRB.RemoveSpell (pc, type, level, index) UpdatePriestWindow () + return - ################################################### # End of file GUIPR.py Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUIMG.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUIMG.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUIMG.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -81,7 +81,7 @@ #unknown usage Button = GemRB.GetControl (Window, 55) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) #setup level buttons for i in range (9): @@ -99,13 +99,13 @@ GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (24): Button = GemRB.GetControl (Window, 27 + i) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdateMageWindow) UpdateMageWindow () @@ -155,12 +155,8 @@ GemRB.EnableButtonBorder (Window, Button, 0, ms['Flags'] == 0) else: if i < max_mem_cnt: - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NORMAL, OP_SET) else: - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_SET) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS,"") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") @@ -187,6 +183,7 @@ GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") GemRB.SetTooltip (Window, Button, '') GemRB.EnableButtonBorder (Window, Button, 0, 0) + Table = GemRB.LoadTable ("clskills") if (GemRB.GetTableValue (Table, GemRB.GetPlayerStat( GemRB.GameGetSelectedPCSingle(), IE_CLASS), 2)=="*"): GemRB.SetVisible (Window, 2) @@ -194,7 +191,6 @@ GemRB.SetVisible (Window, 1) return - def MagePrevLevelPress (): global MageSpellLevel @@ -203,7 +199,6 @@ UpdateMageWindow () return - def MageNextLevelPress (): global MageSpellLevel Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUIPR.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUIPR.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUIPR.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -88,20 +88,20 @@ for i in range (7): Button = GemRB.GetControl (Window, 55 + i) GemRB.SetVarAssoc (Window, Button, "PriestSpellLevel", i) - + # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (24): Button = GemRB.GetControl (Window, 27 + i) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdatePriestWindow) UpdatePriestWindow () @@ -185,6 +185,7 @@ GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") GemRB.SetTooltip (Window, Button, '') GemRB.EnableButtonBorder (Window, Button, 0, 0) + Table = GemRB.LoadTable ("clskills") if (GemRB.GetTableValue (Table, GemRB.GetPlayerStat( GemRB.GameGetSelectedPCSingle(), IE_CLASS), 1)=="*"): GemRB.SetVisible (Window, 2) @@ -192,7 +193,6 @@ GemRB.SetVisible (Window, 1) return - def PriestPrevLevelPress (): global PriestSpellLevel @@ -201,7 +201,6 @@ UpdatePriestWindow () return - def PriestNextLevelPress (): global PriestSpellLevel @@ -216,7 +215,7 @@ PriestSpellLevel = GemRB.GetVar ("PriestSpellLevel") UpdatePriestWindow () return - + def OpenPriestSpellInfoWindow (): global PriestSpellInfoWindow @@ -224,7 +223,7 @@ GemRB.UnloadWindow (PriestSpellInfoWindow) PriestSpellInfoWindow = None return - + PriestSpellInfoWindow = Window = GemRB.LoadWindow (3) #back @@ -266,7 +265,7 @@ def OpenPriestSpellRemoveWindow (): global PriestSpellUnmemorizeWindow - + PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) # "Are you sure you want to ....?" @@ -295,7 +294,7 @@ def OpenPriestSpellUnmemorizeWindow (): global PriestSpellUnmemorizeWindow - + PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) # "Are you sure you want to ....?" Modified: gemrb/trunk/gemrb/GUIScripts/how/GUIMG.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUIMG.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/how/GUIMG.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -99,14 +99,15 @@ # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) - GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,160,0,1) - GemRB.SetButtonBAM (Window, Button, "SPELFRAM",0,0,0) + GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) + GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (24): Button = GemRB.GetControl (Window, 27 + i) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdateMageWindow) Modified: gemrb/trunk/gemrb/GUIScripts/how/GUIPR.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUIPR.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/how/GUIPR.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -82,14 +82,15 @@ # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) - GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,160,0,1) - GemRB.SetButtonBAM (Window, Button, "SPELFRAM",0,0,0) + GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) + GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (24): Button = GemRB.GetControl (Window, 27 + i) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdatePriestWindow) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -99,14 +99,15 @@ # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) - GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,160,0,1) - GemRB.SetButtonBAM (Window, Button, "SPELFRAM",0,0,0) + GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) + GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (20): Button = GemRB.GetControl (Window, 27 + i) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdateMageWindow) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -82,14 +82,15 @@ # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) - GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,160,0,1) - GemRB.SetButtonBAM (Window, Button, "SPELFRAM",0,0,0) + GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) + GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (20): Button = GemRB.GetControl (Window, 27 + i) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdatePriestWindow) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIMG.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIMG.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIMG.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -81,7 +81,7 @@ #unknown usage Button = GemRB.GetControl (Window, 55) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) #setup level buttons for i in range (9): @@ -99,13 +99,13 @@ GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (24): Button = GemRB.GetControl (Window, 27 + i) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdateMageWindow) UpdateMageWindow () @@ -155,12 +155,8 @@ GemRB.EnableButtonBorder (Window, Button, 0, ms['Flags'] == 0) else: if i < max_mem_cnt: - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NORMAL, OP_SET) else: - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) - #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_NAND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_SET) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS,"") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") @@ -187,6 +183,7 @@ GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") GemRB.SetTooltip (Window, Button, '') GemRB.EnableButtonBorder (Window, Button, 0, 0) + Table = GemRB.LoadTable ("clskills") if (GemRB.GetTableValue (Table, GemRB.GetPlayerStat( GemRB.GameGetSelectedPCSingle(), IE_CLASS), 2)=="*"): GemRB.SetVisible (Window, 2) @@ -194,7 +191,6 @@ GemRB.SetVisible (Window, 1) return - def MagePrevLevelPress (): global MageSpellLevel @@ -203,7 +199,6 @@ UpdateMageWindow () return - def MageNextLevelPress (): global MageSpellLevel Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUIPR.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUIPR.py 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUIPR.py 2007-05-03 17:51:09 UTC (rev 4634) @@ -88,20 +88,20 @@ for i in range (7): Button = GemRB.GetControl (Window, 55 + i) GemRB.SetVarAssoc (Window, Button, "PriestSpellLevel", i) - + # Setup memorized spells buttons for i in range (12): Button = GemRB.GetControl (Window, 3 + i) GemRB.SetButtonBorder (Window, Button, 0,0,0,0,0,0,0,0,64,0,1) GemRB.SetButtonSprites (Window, Button, "SPELFRAM",0,0,0,0,0) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons for i in range (24): Button = GemRB.GetControl (Window, 27 + i) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SECOND) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) SetSelectionChangeHandler (UpdatePriestWindow) UpdatePriestWindow () @@ -185,6 +185,7 @@ GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_RIGHT_PRESS, "") GemRB.SetTooltip (Window, Button, '') GemRB.EnableButtonBorder (Window, Button, 0, 0) + Table = GemRB.LoadTable ("clskills") if (GemRB.GetTableValue (Table, GemRB.GetPlayerStat( GemRB.GameGetSelectedPCSingle(), IE_CLASS), 1)=="*"): GemRB.SetVisible (Window, 2) @@ -192,7 +193,6 @@ GemRB.SetVisible (Window, 1) return - def PriestPrevLevelPress (): global PriestSpellLevel @@ -201,7 +201,6 @@ UpdatePriestWindow () return - def PriestNextLevelPress (): global PriestSpellLevel @@ -216,7 +215,7 @@ PriestSpellLevel = GemRB.GetVar ("PriestSpellLevel") UpdatePriestWindow () return - + def OpenPriestSpellInfoWindow (): global PriestSpellInfoWindow @@ -224,7 +223,7 @@ GemRB.UnloadWindow (PriestSpellInfoWindow) PriestSpellInfoWindow = None return - + PriestSpellInfoWindow = Window = GemRB.LoadWindow (3) #back @@ -266,7 +265,7 @@ def OpenPriestSpellRemoveWindow (): global PriestSpellUnmemorizeWindow - + PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) # "Are you sure you want to ....?" @@ -295,7 +294,7 @@ def OpenPriestSpellUnmemorizeWindow (): global PriestSpellUnmemorizeWindow - + PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) # "Are you sure you want to ....?" Modified: gemrb/trunk/gemrb/plugins/SPLImporter/SPLImp.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/SPLImporter/SPLImp.cpp 2007-05-03 17:49:39 UTC (rev 4633) +++ gemrb/trunk/gemrb/plugins/SPLImporter/SPLImp.cpp 2007-05-03 17:51:09 UTC (rev 4634) @@ -86,7 +86,7 @@ //this hack is needed in ToB at least if (core->HasFeature(GF_SPELLBOOKICONHACK)) { i=strlen(s->SpellbookIcon); - if (i) s->SpellbookIcon[i]='C'; + if (i) s->SpellbookIcon[i-1]='c'; } str->ReadWord( &s->unknown6 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-05 09:51:24
|
Revision: 4639 http://gemrb.svn.sourceforge.net/gemrb/?rev=4639&view=rev Author: avenger_teambg Date: 2007-05-05 02:51:23 -0700 (Sat, 05 May 2007) Log Message: ----------- implemented GetTableColumnCount fixed LearnSpell guiscript command (effect still seems to be broken) improved chargen scripts to set starting spell slots Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/CharGen9.py gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py gemrb/trunk/gemrb/GUIScripts/how/CharGen.py gemrb/trunk/gemrb/GUIScripts/iwd/CharGen.py gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py gemrb/trunk/gemrb/GUIScripts/tob/CharGen9.py gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp gemrb/trunk/gemrb/plugins/Core/Spellbook.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg1/CharGen9.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/CharGen9.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/bg1/CharGen9.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -1,7 +1,7 @@ #character generation (GUICG 0) import GemRB from ie_stats import * -from GUICommon import SetColorStat +from GUICommon import * CharGenWindow = 0 TextAreaControl = 0 @@ -10,9 +10,9 @@ def OnLoad(): global CharGenWindow, TextAreaControl, PortraitName - GemRB.LoadWindowPack("GUICG") - CharGenWindow = GemRB.LoadWindow(0) - PortraitButton = GemRB.GetControl(CharGenWindow, 12) + GemRB.LoadWindowPack ("GUICG", 640, 480) + CharGenWindow = GemRB.LoadWindow (0) + PortraitButton = GemRB.GetControl (CharGenWindow, 12) GemRB.SetButtonFlags(CharGenWindow, PortraitButton, IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_NO_IMAGE,OP_SET) PortraitName = GemRB.GetToken ("LargePortrait") GemRB.SetButtonPicture (CharGenWindow,PortraitButton,PortraitName,"NOPORTLG") @@ -23,129 +23,158 @@ AlignmentTable = GemRB.LoadTable ("aligns") AbilityTable = GemRB.LoadTable ("ability") - GenderButton = GemRB.GetControl(CharGenWindow,0) - GemRB.SetText(CharGenWindow,GenderButton,11956) - GemRB.SetButtonState(CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) + GenderButton = GemRB.GetControl (CharGenWindow,0) + GemRB.SetText (CharGenWindow,GenderButton,11956) + GemRB.SetButtonState (CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) - RaceButton = GemRB.GetControl(CharGenWindow,1) - GemRB.SetText(CharGenWindow,RaceButton, 11957) - GemRB.SetButtonState(CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) + RaceButton = GemRB.GetControl (CharGenWindow,1) + GemRB.SetText (CharGenWindow,RaceButton, 11957) + GemRB.SetButtonState (CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) - ClassButton = GemRB.GetControl(CharGenWindow,2) - GemRB.SetText(CharGenWindow,ClassButton, 11959) - GemRB.SetButtonState(CharGenWindow,ClassButton,IE_GUI_BUTTON_DISABLED) + ClassButton = GemRB.GetControl (CharGenWindow,2) + GemRB.SetText (CharGenWindow,ClassButton, 11959) + GemRB.SetButtonState (CharGenWindow,ClassButton,IE_GUI_BUTTON_DISABLED) - AlignmentButton = GemRB.GetControl(CharGenWindow,3) - GemRB.SetText(CharGenWindow,AlignmentButton, 11958) - GemRB.SetButtonState(CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) + AlignmentButton = GemRB.GetControl (CharGenWindow,3) + GemRB.SetText (CharGenWindow,AlignmentButton, 11958) + GemRB.SetButtonState (CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) - AbilitiesButton = GemRB.GetControl(CharGenWindow,4) - GemRB.SetText(CharGenWindow,AbilitiesButton, 11960) - GemRB.SetButtonState(CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) + AbilitiesButton = GemRB.GetControl (CharGenWindow,4) + GemRB.SetText (CharGenWindow,AbilitiesButton, 11960) + GemRB.SetButtonState (CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) - SkillButton = GemRB.GetControl(CharGenWindow,5) - GemRB.SetText(CharGenWindow,SkillButton, 17372) - GemRB.SetButtonState(CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) + SkillButton = GemRB.GetControl (CharGenWindow,5) + GemRB.SetText (CharGenWindow,SkillButton, 17372) + GemRB.SetButtonState (CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) - AppearanceButton = GemRB.GetControl(CharGenWindow,6) - GemRB.SetText(CharGenWindow,AppearanceButton, 11961) - GemRB.SetButtonState(CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) + AppearanceButton = GemRB.GetControl (CharGenWindow,6) + GemRB.SetText (CharGenWindow,AppearanceButton, 11961) + GemRB.SetButtonState (CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) - NameButton = GemRB.GetControl(CharGenWindow,7) - GemRB.SetText(CharGenWindow,NameButton, 11963) - GemRB.SetButtonState(CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) + NameButton = GemRB.GetControl (CharGenWindow,7) + GemRB.SetText (CharGenWindow,NameButton, 11963) + GemRB.SetButtonState (CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) - BackButton = GemRB.GetControl(CharGenWindow, 11) - GemRB.SetButtonState(CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) + BackButton = GemRB.GetControl (CharGenWindow, 11) + GemRB.SetButtonState (CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) - AcceptButton = GemRB.GetControl(CharGenWindow, 8) - GemRB.SetText(CharGenWindow, AcceptButton, 11962) - GemRB.SetButtonState(CharGenWindow,AcceptButton,IE_GUI_BUTTON_ENABLED) + AcceptButton = GemRB.GetControl (CharGenWindow, 8) + GemRB.SetText (CharGenWindow, AcceptButton, 11962) + GemRB.SetButtonState (CharGenWindow,AcceptButton,IE_GUI_BUTTON_ENABLED) GemRB.SetButtonFlags(CharGenWindow,AcceptButton, IE_GUI_BUTTON_DEFAULT,OP_OR) - ImportButton = GemRB.GetControl(CharGenWindow, 13) - GemRB.SetText(CharGenWindow, ImportButton, 13955) - GemRB.SetButtonState(CharGenWindow,ImportButton,IE_GUI_BUTTON_ENABLED) + ImportButton = GemRB.GetControl (CharGenWindow, 13) + GemRB.SetText (CharGenWindow, ImportButton, 13955) + GemRB.SetButtonState (CharGenWindow,ImportButton,IE_GUI_BUTTON_ENABLED) - CancelButton = GemRB.GetControl(CharGenWindow, 15) - GemRB.SetText(CharGenWindow, CancelButton, 13727) - GemRB.SetButtonState(CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) + CancelButton = GemRB.GetControl (CharGenWindow, 15) + GemRB.SetText (CharGenWindow, CancelButton, 13727) + GemRB.SetButtonState (CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) - TextAreaControl= GemRB.GetControl(CharGenWindow,9) - - GemRB.SetText(CharGenWindow, TextAreaControl, 1047) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, ": ") - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, GemRB.GetToken("CHARNAME") ) + TextAreaControl= GemRB.GetControl (CharGenWindow,9) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 12135, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") + GemRB.SetText (CharGenWindow, TextAreaControl, 1047) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, ": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, GemRB.GetToken ("CHARNAME") ) + + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 12135, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") if GemRB.GetVar ("Gender") == 1: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1050) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 1050) else: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1051) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1048,-1) # new line - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(RaceTable,GemRB.GetVar ("Race")-1,2)) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,12136, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 1051) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,1048,-1) # new line + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (RaceTable,GemRB.GetVar ("Race")-1,2)) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,12136, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") KitIndex = GemRB.GetVar ("Class Kit") if KitIndex == 0: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(ClassTable,GemRB.GetVar ("Class")-1,2)) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (ClassTable,GemRB.GetVar ("Class")-1,2)) else: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, GemRB.GetTableValue(KitTable, KitIndex,2) ) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1049, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") - v = GemRB.FindTableValue(AlignmentTable,3,GemRB.GetVar ("Alignment")) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(AlignmentTable,v,2)) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, GemRB.GetTableValue (KitTable, KitIndex,2) ) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,1049, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") + v = GemRB.FindTableValue (AlignmentTable,3,GemRB.GetVar ("Alignment")) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (AlignmentTable,v,2)) for i in range(6): - v = GemRB.GetTableValue(AbilityTable, i,2) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, v, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": "+str(GemRB.GetVar ("Ability "+str(i)))) + v = GemRB.GetTableValue (AbilityTable, i,2) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, v, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": "+str(GemRB.GetVar ("Ability "+str(i)))) - GemRB.SetEvent(CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") - GemRB.SetEvent(CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") - GemRB.SetEvent(CharGenWindow, AcceptButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") - GemRB.SetEvent(CharGenWindow, ImportButton, IE_GUI_BUTTON_ON_PRESS, "ImportPress") - GemRB.SetVisible(CharGenWindow,1) + GemRB.SetEvent (CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") + GemRB.SetEvent (CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") + GemRB.SetEvent (CharGenWindow, AcceptButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") + GemRB.SetEvent (CharGenWindow, ImportButton, IE_GUI_BUTTON_ON_PRESS, "ImportPress") + GemRB.SetVisible (CharGenWindow,1) return - + def NextPress(): - GemRB.UnloadWindow(CharGenWindow) + GemRB.UnloadWindow (CharGenWindow) #set my character up MyChar = GemRB.GetVar ("Slot") - GemRB.CreatePlayer("charbase", MyChar ) + GemRB.CreatePlayer ("charbase", MyChar ) GemRB.SetPlayerStat (MyChar, IE_SEX, GemRB.GetVar ("Gender") ) GemRB.SetPlayerStat (MyChar, IE_RACE, GemRB.GetVar ("Race") ) - ClassTable = GemRB.LoadTable("classes") + ClassTable = GemRB.LoadTable ("classes") ClassIndex = GemRB.GetVar ("Class")-1 - Class = GemRB.GetTableValue(ClassTable, ClassIndex, 5) + Class = GemRB.GetTableValue (ClassTable, ClassIndex, 5) GemRB.SetPlayerStat (MyChar, IE_CLASS, Class) KitIndex = GemRB.GetVar ("Class Kit") GemRB.SetPlayerStat (MyChar, IE_KIT, KitIndex) - t=GemRB.GetVar ("Alignment") + t = GemRB.GetVar ("Alignment") GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, t) + + TmpTable = GemRB.LoadTable ("clskills") + #mage spells + TableName = GemRB.GetTableValue (TmpTable, Class, 1, 0) + if TableName != "*": + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_WIZARD, 1) + Learnable = GetLearnableMageSpells( KitIndex, t, 1) + SpellBook = GemRB.GetVar ("MageSpellBook") + j=1 + for i in range(len(Learnable) ): + if SpellBook & j: + GemRB.LearnSpell (MyChar, Learnable[i], 0) + j=j<<1 + + #priest spells + TableName = GemRB.GetTableValue (TmpTable, Class, 1, 0) + if TableName != "*": + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_PRIEST, 1) + ClassFlag = 0 #set this according to class + Learnable = GetLearnablePriestSpells( ClassFlag, t, 1) + for i in range(len(Learnable) ): + GemRB.LearnSpell (MyChar, Learnable[i], 0) + + GemRB.UnloadTable (TmpTable) TmpTable=GemRB.LoadTable ("repstart") - t=GemRB.GetTableValue(TmpTable,t,0) + AlignmentTable = GemRB.LoadTable ("aligns") + t = GemRB.FindTableValue (AlignmentTable, 3, t) + t = GemRB.GetTableValue (TmpTable,t,0) * 10 GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t) - GemRB.UnloadTable (TmpTable) + #slot 1 is the protagonist + if MyChar == 1: + GemRB.GameSetReputation( t ) + TmpTable=GemRB.LoadTable ("strtgold") - t=GemRB.Roll(GemRB.GetTableValue(TmpTable,Class,1),GemRB.GetTableValue(TmpTable,Class,0), GemRB.GetTableValue(TmpTable,Class,2) ) - GemRB.SetPlayerStat (MyChar, IE_GOLD, t*GemRB.GetTableValue(TmpTable,Class,3) ) + t = GemRB.Roll (GemRB.GetTableValue (TmpTable,Class,1),GemRB.GetTableValue (TmpTable,Class,0), GemRB.GetTableValue (TmpTable,Class,2) ) + GemRB.SetPlayerStat (MyChar, IE_GOLD, t*GemRB.GetTableValue (TmpTable,Class,3) ) GemRB.UnloadTable (TmpTable) GemRB.SetPlayerStat (MyChar, IE_HATEDRACE, GemRB.GetVar ("HatedRace") ) TmpTable=GemRB.LoadTable ("ability") - AbilityCount = GemRB.GetTableRowCount(TmpTable) + AbilityCount = GemRB.GetTableRowCount (TmpTable) for i in range(AbilityCount): - StatID=GemRB.GetTableValue(TmpTable, i,4) + StatID=GemRB.GetTableValue (TmpTable, i,4) GemRB.SetPlayerStat (MyChar, StatID, GemRB.GetVar ("Ability "+str(i) ) ) GemRB.UnloadTable (TmpTable) TmpTable=GemRB.LoadTable ("weapprof") - ProfCount = GemRB.GetTableRowCount(TmpTable) + ProfCount = GemRB.GetTableRowCount (TmpTable) for i in range(7,ProfCount): - StatID=GemRB.GetTableValue(TmpTable, i, 0) + StatID=GemRB.GetTableValue (TmpTable, i, 0) GemRB.SetPlayerStat (MyChar, StatID, GemRB.GetVar ("Prof "+str(i) ) ) GemRB.UnloadTable (TmpTable) @@ -180,37 +209,37 @@ GemRB.SetPlayerStat (MyChar, stat, value ) GemRB.UnloadTable (TmpTable) - GemRB.SetPlayerName (MyChar, GemRB.GetToken("CHARNAME"), 0) + GemRB.SetPlayerName (MyChar, GemRB.GetToken ("CHARNAME"), 0) #does all the rest LargePortrait = GemRB.GetToken ("LargePortrait") SmallPortrait = GemRB.GetToken ("SmallPortrait") - GemRB.FillPlayerInfo(MyChar, LargePortrait, SmallPortrait) + GemRB.FillPlayerInfo (MyChar, LargePortrait, SmallPortrait) #35 is a weapon slot - GemRB.CreateItem(MyChar, "staf01", 35, 1, 0, 0) - GemRB.SetEquippedQuickSlot(MyChar, 0) + GemRB.CreateItem (MyChar, "staf01", 35, 1, 0, 0) + GemRB.SetEquippedQuickSlot (MyChar, 0) #LETS PLAY!! playmode = GemRB.GetVar ("PlayMode") if playmode >=0: GemRB.EnterGame() else: #leaving multi player pregen - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("GUIMP") + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("GUIMP") return def CancelPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("CharGen") + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("CharGen") return def BackPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("CharGen8") #name + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("CharGen8") #name return def ImportPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetToken("NextScript","CharGen9") - GemRB.SetNextScript("ImportFile") #import + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetToken ("NextScript","CharGen9") + GemRB.SetNextScript ("ImportFile") #import return Modified: gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/bg2/CharGen9.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -1,7 +1,7 @@ #character generation (GUICG 0) import GemRB from ie_stats import * -from GUICommon import GetLearnableMageSpells, GetLearnablePriestSpells, SetColorStat +from GUICommon import * CharGenWindow = 0 TextAreaControl = 0 @@ -10,152 +10,157 @@ def OnLoad(): global CharGenWindow, TextAreaControl, PortraitName - GemRB.LoadWindowPack("GUICG", 640, 480) - CharGenWindow = GemRB.LoadWindow(0) - PortraitButton = GemRB.GetControl(CharGenWindow, 12) + GemRB.LoadWindowPack ("GUICG", 640, 480) + CharGenWindow = GemRB.LoadWindow (0) + PortraitButton = GemRB.GetControl (CharGenWindow, 12) GemRB.SetButtonFlags(CharGenWindow, PortraitButton, IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_NO_IMAGE,OP_SET) PortraitName = GemRB.GetToken ("LargePortrait") GemRB.SetButtonPicture (CharGenWindow,PortraitButton,PortraitName,"NOPORTMD") - RaceTable = GemRB.LoadTable("races") - ClassTable = GemRB.LoadTable("classes") - KitTable = GemRB.LoadTable("kitlist") - AlignmentTable = GemRB.LoadTable("aligns") - AbilityTable = GemRB.LoadTable("ability") + RaceTable = GemRB.LoadTable ("races") + ClassTable = GemRB.LoadTable ("classes") + KitTable = GemRB.LoadTable ("kitlist") + AlignmentTable = GemRB.LoadTable ("aligns") + AbilityTable = GemRB.LoadTable ("ability") - GenderButton = GemRB.GetControl(CharGenWindow,0) - GemRB.SetText(CharGenWindow,GenderButton,11956) - GemRB.SetButtonState(CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) + GenderButton = GemRB.GetControl (CharGenWindow,0) + GemRB.SetText (CharGenWindow,GenderButton,11956) + GemRB.SetButtonState (CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) - RaceButton = GemRB.GetControl(CharGenWindow,1) - GemRB.SetText(CharGenWindow,RaceButton, 11957) - GemRB.SetButtonState(CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) + RaceButton = GemRB.GetControl (CharGenWindow,1) + GemRB.SetText (CharGenWindow,RaceButton, 11957) + GemRB.SetButtonState (CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) - ClassButton = GemRB.GetControl(CharGenWindow,2) - GemRB.SetText(CharGenWindow,ClassButton, 11959) - GemRB.SetButtonState(CharGenWindow,ClassButton,IE_GUI_BUTTON_DISABLED) + ClassButton = GemRB.GetControl (CharGenWindow,2) + GemRB.SetText (CharGenWindow,ClassButton, 11959) + GemRB.SetButtonState (CharGenWindow,ClassButton,IE_GUI_BUTTON_DISABLED) - AlignmentButton = GemRB.GetControl(CharGenWindow,3) - GemRB.SetText(CharGenWindow,AlignmentButton, 11958) - GemRB.SetButtonState(CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) + AlignmentButton = GemRB.GetControl (CharGenWindow,3) + GemRB.SetText (CharGenWindow,AlignmentButton, 11958) + GemRB.SetButtonState (CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) - AbilitiesButton = GemRB.GetControl(CharGenWindow,4) - GemRB.SetText(CharGenWindow,AbilitiesButton, 11960) - GemRB.SetButtonState(CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) + AbilitiesButton = GemRB.GetControl (CharGenWindow,4) + GemRB.SetText (CharGenWindow,AbilitiesButton, 11960) + GemRB.SetButtonState (CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) - SkillButton = GemRB.GetControl(CharGenWindow,5) - GemRB.SetText(CharGenWindow,SkillButton, 17372) - GemRB.SetButtonState(CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) + SkillButton = GemRB.GetControl (CharGenWindow,5) + GemRB.SetText (CharGenWindow,SkillButton, 17372) + GemRB.SetButtonState (CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) - AppearanceButton = GemRB.GetControl(CharGenWindow,6) - GemRB.SetText(CharGenWindow,AppearanceButton, 11961) - GemRB.SetButtonState(CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) + AppearanceButton = GemRB.GetControl (CharGenWindow,6) + GemRB.SetText (CharGenWindow,AppearanceButton, 11961) + GemRB.SetButtonState (CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) - NameButton = GemRB.GetControl(CharGenWindow,7) - GemRB.SetText(CharGenWindow,NameButton, 11963) - GemRB.SetButtonState(CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) + NameButton = GemRB.GetControl (CharGenWindow,7) + GemRB.SetText (CharGenWindow,NameButton, 11963) + GemRB.SetButtonState (CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) - BackButton = GemRB.GetControl(CharGenWindow, 11) - GemRB.SetText(CharGenWindow, BackButton, 15416) - GemRB.SetButtonState(CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) + BackButton = GemRB.GetControl (CharGenWindow, 11) + GemRB.SetText (CharGenWindow, BackButton, 15416) + GemRB.SetButtonState (CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) - AcceptButton = GemRB.GetControl(CharGenWindow, 8) - GemRB.SetText(CharGenWindow, AcceptButton, 11962) - GemRB.SetButtonState(CharGenWindow,AcceptButton,IE_GUI_BUTTON_ENABLED) + AcceptButton = GemRB.GetControl (CharGenWindow, 8) + GemRB.SetText (CharGenWindow, AcceptButton, 11962) + GemRB.SetButtonState (CharGenWindow,AcceptButton,IE_GUI_BUTTON_ENABLED) GemRB.SetButtonFlags(CharGenWindow,AcceptButton, IE_GUI_BUTTON_DEFAULT,OP_OR) - ImportButton = GemRB.GetControl(CharGenWindow, 13) - GemRB.SetText(CharGenWindow, ImportButton, 13955) - GemRB.SetButtonState(CharGenWindow,ImportButton,IE_GUI_BUTTON_DISABLED) + ImportButton = GemRB.GetControl (CharGenWindow, 13) + GemRB.SetText (CharGenWindow, ImportButton, 13955) + GemRB.SetButtonState (CharGenWindow,ImportButton,IE_GUI_BUTTON_ENABLED) - CancelButton = GemRB.GetControl(CharGenWindow, 15) - GemRB.SetText(CharGenWindow, CancelButton, 8159) - GemRB.SetButtonState(CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) + CancelButton = GemRB.GetControl (CharGenWindow, 15) + GemRB.SetText (CharGenWindow, CancelButton, 8159) + GemRB.SetButtonState (CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) - BiographyButton = GemRB.GetControl(CharGenWindow, 16) - GemRB.SetText(CharGenWindow, BiographyButton, 18003) - GemRB.SetButtonState(CharGenWindow,BiographyButton,IE_GUI_BUTTON_DISABLED) - TextAreaControl= GemRB.GetControl(CharGenWindow,9) - - GemRB.SetText(CharGenWindow, TextAreaControl, 1047) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, ": ") - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, GemRB.GetToken("CHARNAME") ) + BiographyButton = GemRB.GetControl (CharGenWindow, 16) + GemRB.SetText (CharGenWindow, BiographyButton, 18003) + GemRB.SetButtonState (CharGenWindow,BiographyButton,IE_GUI_BUTTON_DISABLED) + TextAreaControl= GemRB.GetControl (CharGenWindow,9) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 12135, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") + GemRB.SetText (CharGenWindow, TextAreaControl, 1047) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, ": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, GemRB.GetToken ("CHARNAME") ) + + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 12135, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") if GemRB.GetVar ("Gender") == 1: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1050) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 1050) else: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1051) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1048,-1) # new line - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(RaceTable,GemRB.GetVar ("Race")-1,2)) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,12136, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 1051) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,1048,-1) # new line + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (RaceTable,GemRB.GetVar ("Race")-1,2)) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,12136, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") KitIndex = GemRB.GetVar ("Class Kit") if KitIndex == 0: Class = GemRB.GetVar ("Class")-1 - ClassTitle=GemRB.GetTableValue(ClassTable, Class, 2) + ClassTitle=GemRB.GetTableValue (ClassTable, Class, 2) else: - ClassTitle=GemRB.GetTableValue(KitTable, KitIndex, 2) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, ClassTitle) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1049, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") - v = GemRB.FindTableValue(AlignmentTable,3,GemRB.GetVar ("Alignment")) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(AlignmentTable,v,2)) + ClassTitle=GemRB.GetTableValue (KitTable, KitIndex, 2) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, ClassTitle) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,1049, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") + v = GemRB.FindTableValue (AlignmentTable,3,GemRB.GetVar ("Alignment")) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (AlignmentTable,v,2)) for i in range(6): - v = GemRB.GetTableValue(AbilityTable, i,2) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, v, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": "+str(GemRB.GetVar ("Ability "+str(i)))) + v = GemRB.GetTableValue (AbilityTable, i,2) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, v, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": "+str(GemRB.GetVar ("Ability "+str(i)))) - GemRB.SetEvent(CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") - GemRB.SetEvent(CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") - GemRB.SetEvent(CharGenWindow, AcceptButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") - GemRB.SetVisible(CharGenWindow,1) + GemRB.SetEvent (CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") + GemRB.SetEvent (CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") + GemRB.SetEvent (CharGenWindow, AcceptButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") + GemRB.SetEvent (CharGenWindow, ImportButton, IE_GUI_BUTTON_ON_PRESS, "ImportPress") + GemRB.SetVisible (CharGenWindow,1) return - + def NextPress(): - GemRB.UnloadWindow(CharGenWindow) + GemRB.UnloadWindow (CharGenWindow) #set my character up MyChar = GemRB.GetVar ("Slot") - GemRB.CreatePlayer("charbase", MyChar ) + GemRB.CreatePlayer ("charbase", MyChar ) GemRB.SetPlayerStat (MyChar, IE_SEX, GemRB.GetVar ("Gender") ) - RaceTable = GemRB.LoadTable("races") + RaceTable = GemRB.LoadTable ("races") Race = GemRB.GetVar ("Race")-1 - GemRB.SetPlayerStat (MyChar, IE_RACE, GemRB.GetTableValue(RaceTable, Race, 3) ) - ClassTable = GemRB.LoadTable("classes") + GemRB.SetPlayerStat (MyChar, IE_RACE, GemRB.GetTableValue (RaceTable, Race, 3) ) + ClassTable = GemRB.LoadTable ("classes") ClassIndex = GemRB.GetVar ("Class")-1 - Class = GemRB.GetTableValue(ClassTable, ClassIndex, 5) + Class = GemRB.GetTableValue (ClassTable, ClassIndex, 5) GemRB.SetPlayerStat (MyChar, IE_CLASS, Class) KitIndex = GemRB.GetVar ("Class Kit") GemRB.SetPlayerStat (MyChar, IE_KIT, KitIndex) t = GemRB.GetVar ("Alignment") GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, t) + TmpTable = GemRB.LoadTable ("clskills") #mage spells - Learnable = GetLearnableMageSpells( KitIndex, t, 1) - SpellBook = GemRB.GetVar ("MageSpellBook") - j=1 - for i in range(len(Learnable) ): - if SpellBook & j: - GemRB.LearnSpell(MyChar, Learnable[i], 0) - j=j<<1 + TableName = GemRB.GetTableValue (TmpTable, Class, 1, 0) + if TableName != "*": + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_WIZARD, 1) + Learnable = GetLearnableMageSpells( KitIndex, t, 1) + SpellBook = GemRB.GetVar ("MageSpellBook") + j=1 + for i in range(len(Learnable) ): + if SpellBook & j: + GemRB.LearnSpell (MyChar, Learnable[i], 0) + j=j<<1 #priest spells - TmpTable = GemRB.LoadTable("clskills") - TableName = GemRB.GetTableValue(TmpTable, Class, 1) + TableName = GemRB.GetTableValue (TmpTable, Class, 1, 0) if TableName != "*": + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_PRIEST, 1) ClassFlag = 0 #set this according to class Learnable = GetLearnablePriestSpells( ClassFlag, t, 1) for i in range(len(Learnable) ): - GemRB.LearnSpell(MyChar, Learnable[i], 0) + GemRB.LearnSpell (MyChar, Learnable[i], 0) GemRB.UnloadTable (TmpTable) - TmpTable=GemRB.LoadTable("repstart") - AlignmentTable = GemRB.LoadTable("aligns") - t=GemRB.FindTableValue(AlignmentTable, 3, t) - t=GemRB.GetTableValue(TmpTable,t,0) * 10 + TmpTable=GemRB.LoadTable ("repstart") + AlignmentTable = GemRB.LoadTable ("aligns") + t = GemRB.FindTableValue (AlignmentTable, 3, t) + t = GemRB.GetTableValue (TmpTable,t,0) * 10 GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t) #slot 1 is the protagonist @@ -163,27 +168,27 @@ GemRB.GameSetReputation( t ) GemRB.UnloadTable (TmpTable) - TmpTable=GemRB.LoadTable("strtgold") - t=GemRB.Roll(GemRB.GetTableValue(TmpTable,Class,1),GemRB.GetTableValue(TmpTable,Class,0), GemRB.GetTableValue(TmpTable,Class,2) ) - GemRB.SetPlayerStat (MyChar, IE_GOLD, t*GemRB.GetTableValue(TmpTable,Class,3) ) + TmpTable=GemRB.LoadTable ("strtgold") + t = GemRB.Roll (GemRB.GetTableValue (TmpTable,Class,1),GemRB.GetTableValue (TmpTable,Class,0), GemRB.GetTableValue (TmpTable,Class,2) ) + GemRB.SetPlayerStat (MyChar, IE_GOLD, t*GemRB.GetTableValue (TmpTable,Class,3) ) GemRB.UnloadTable (AlignmentTable) GemRB.UnloadTable (ClassTable) GemRB.UnloadTable (RaceTable) GemRB.UnloadTable (TmpTable) GemRB.SetPlayerStat (MyChar, IE_HATEDRACE, GemRB.GetVar ("HatedRace") ) - TmpTable=GemRB.LoadTable("ability") - AbilityCount = GemRB.GetTableRowCount(TmpTable) + TmpTable=GemRB.LoadTable ("ability") + AbilityCount = GemRB.GetTableRowCount (TmpTable) for i in range(AbilityCount): - StatID=GemRB.GetTableValue(TmpTable, i,4) + StatID=GemRB.GetTableValue (TmpTable, i,4) GemRB.SetPlayerStat (MyChar, StatID, GemRB.GetVar ("Ability "+str(i) ) ) GemRB.UnloadTable (TmpTable) - TmpTable=GemRB.LoadTable("weapprof") - ProfCount = GemRB.GetTableRowCount(TmpTable) + TmpTable=GemRB.LoadTable ("weapprof") + ProfCount = GemRB.GetTableRowCount (TmpTable) #bg2 weapprof.2da contains the bg1 proficiencies too, skipping those for i in range(ProfCount-8): - StatID = GemRB.GetTableValue(TmpTable, i+8, 0) + StatID = GemRB.GetTableValue (TmpTable, i+8, 0) Value = GemRB.GetVar ("Prof "+str(i) ) if Value: GemRB.ApplyEffect (MyChar, "Proficiency", Value, StatID ) @@ -219,8 +224,8 @@ value = GemRB.GetVar ("Skill "+str(i) ) GemRB.SetPlayerStat (MyChar, stat, value ) GemRB.UnloadTable (TmpTable) - - GemRB.SetPlayerName (MyChar, GemRB.GetToken("CHARNAME"), 0) + + GemRB.SetPlayerName (MyChar, GemRB.GetToken ("CHARNAME"), 0) TmpTable = GemRB.LoadTable ("clskills") GemRB.SetPlayerStat (MyChar, IE_XP, GemRB.GetTableValue (TmpTable, Class, 3) ) #this will also set the level (automatically) GemRB.UnloadTable (TmpTable) @@ -228,7 +233,7 @@ #does all the rest LargePortrait = GemRB.GetToken ("LargePortrait") SmallPortrait = GemRB.GetToken ("SmallPortrait") - GemRB.FillPlayerInfo(MyChar, LargePortrait, SmallPortrait) + GemRB.FillPlayerInfo (MyChar, LargePortrait, SmallPortrait) #LETS PLAY!! playmode = GemRB.GetVar ("PlayMode") @@ -236,17 +241,23 @@ GemRB.EnterGame() else: #leaving multi player pregen - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("Start") + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("Start") return def CancelPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("CharGen") + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("CharGen") return def BackPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("CharGen8") #name + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("CharGen8") #name return +def ImportPress(): + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetToken ("NextScript","CharGen9") + GemRB.SetNextScript ("ImportFile") #import + return + Modified: gemrb/trunk/gemrb/GUIScripts/how/CharGen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/CharGen.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/how/CharGen.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -25,7 +25,7 @@ import GemRB from ie_stats import * -from GUICommon import GetLearnableMageSpells, GetLearnablePriestSpells, SetColorStat +from GUICommon import * CharGenWindow = 0 CharGenState = 0 @@ -52,7 +52,7 @@ ClassWindow = 0 ClassTable = 0 KitTable = 0 -ClassSkillTable = 0 +ClassSkillsTable = 0 ClassTextArea = 0 ClassDoneButton = 0 @@ -105,7 +105,6 @@ ProficienciesPointsLeft = 0 MageSpellsWindow = 0 -MageSpellsTable = 0 MageSpellsTextArea = 0 MageSpellsDoneButton = 0 MageSpellsSelectPointsLeft = 0 @@ -115,7 +114,6 @@ MageMemorizeDoneButton = 0 MageMemorizePointsLeft = 0 -PriestSpellsTable = 0 PriestMemorizeWindow = 0 PriestMemorizeTextArea = 0 PriestMemorizeDoneButton = 0 @@ -306,17 +304,23 @@ GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, t) #mage spells - Learnable = GetLearnableMageSpells( KitIndex, t, 1) - SpellBook = GemRB.GetVar ("MageSpellBook") - j=1 - for i in range (len(Learnable) ): - if SpellBook & j: - GemRB.LearnSpell (MyChar, Learnable[i], 0) - j=j<<1 + TableName = GemRB.GetTableValue (ClassSkillsTable, Class, 2, 0) + if TableName != "*": + #todo: set up ALL spell levels not just level 1 + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_WIZARD, 1) + Learnable = GetLearnableMageSpells( KitIndex, t, 1) + SpellBook = GemRB.GetVar ("MageSpellBook") + j=1 + for i in range (len(Learnable) ): + if SpellBook & j: + GemRB.LearnSpell (MyChar, Learnable[i], 0) + j=j<<1 #priest spells - TableName = GemRB.GetTableValue (ClassSkillTable, Class, 1) + TableName = GemRB.GetTableValue (ClassSkillsTable, Class, 1, 0) if TableName != "*": + #todo: set up ALL spell levels not just level 1 + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_PRIEST, 1) ClassFlag = 0 #set this according to class Learnable = GetLearnablePriestSpells( ClassFlag, t, 1) for i in range (len(Learnable) ): @@ -379,7 +383,6 @@ global CharGenWindow, TextArea, CharGenState, ClassFlag global ClassTable, KitTable, RaceTable, AlignmentTable, AbilitiesTable global SkillsTable, ProficienciesTable, RacialEnemyTable - global MageSpellsTable, PriestSpellsTable, ClassSkillTable GemRB.TextAreaClear(CharGenWindow, TextArea) if CharGenState > 7: @@ -1752,7 +1755,7 @@ # Mage Spells Memorize def MageSpellsMemorize(SpellTable, Level, SpellLevel): - global CharGenWindow, MageMemorizeWindow, MageSpellsTable, MageMemorizeTextArea, MageMemorizeDoneButton, MageMemorizePointsLeft + global CharGenWindow, MageMemorizeWindow, MageMemorizeTextArea, MageMemorizeDoneButton, MageMemorizePointsLeft GemRB.SetVisible (CharGenWindow, 0) MageMemorizeWindow = GemRB.LoadWindow (16) @@ -2183,9 +2186,7 @@ row = GemRB.QueryText (CharSoundWindow, CharSoundVoiceList) column = str(GemRB.Roll(1,40,0)) - print row, column x=GemRB.GetTableValue (CharSoundStrings, row, column) - print GemRB.GetString (x) return def CharSoundDonePress(): Modified: gemrb/trunk/gemrb/GUIScripts/iwd/CharGen.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/CharGen.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/iwd/CharGen.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -25,7 +25,7 @@ import GemRB from ie_stats import * -from GUICommon import GetLearnableMageSpells, GetLearnablePriestSpells, SetColorStat +from GUICommon import * CharGenWindow = 0 CharGenState = 0 @@ -52,7 +52,7 @@ ClassWindow = 0 ClassTable = 0 KitTable = 0 -ClassSkillTable = 0 +ClassSkillsTable = 0 ClassTextArea = 0 ClassDoneButton = 0 @@ -105,7 +105,6 @@ ProficienciesPointsLeft = 0 MageSpellsWindow = 0 -MageSpellsTable = 0 MageSpellsTextArea = 0 MageSpellsDoneButton = 0 MageSpellsSelectPointsLeft = 0 @@ -115,7 +114,6 @@ MageMemorizeDoneButton = 0 MageMemorizePointsLeft = 0 -PriestSpellsTable = 0 PriestMemorizeWindow = 0 PriestMemorizeTextArea = 0 PriestMemorizeDoneButton = 0 @@ -306,17 +304,23 @@ GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, t) #mage spells - Learnable = GetLearnableMageSpells( KitIndex, t, 1) - SpellBook = GemRB.GetVar ("MageSpellBook") - j=1 - for i in range (len(Learnable) ): - if SpellBook & j: - GemRB.LearnSpell (MyChar, Learnable[i], 0) - j=j<<1 + TableName = GemRB.GetTableValue (ClassSkillsTable, Class, 2, 0) + if TableName != "*": + #todo: set up ALL spell levels not just level 1 + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_WIZARD, 1) + Learnable = GetLearnableMageSpells( KitIndex, t, 1) + SpellBook = GemRB.GetVar ("MageSpellBook") + j=1 + for i in range (len(Learnable) ): + if SpellBook & j: + GemRB.LearnSpell (MyChar, Learnable[i], 0) + j=j<<1 #priest spells - TableName = GemRB.GetTableValue (ClassSkillTable, Class, 1) + TableName = GemRB.GetTableValue (ClassSkillsTable, Class, 1, 0) if TableName != "*": + #todo: set up ALL spell levels not just level 1 + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_PRIEST, 1) ClassFlag = 0 #set this according to class Learnable = GetLearnablePriestSpells( ClassFlag, t, 1) for i in range (len(Learnable) ): @@ -379,7 +383,6 @@ global CharGenWindow, TextArea, CharGenState, ClassFlag global ClassTable, KitTable, RaceTable, AlignmentTable, AbilitiesTable global SkillsTable, ProficienciesTable, RacialEnemyTable - global MageSpellsTable, PriestSpellsTable, ClassSkillTable GemRB.TextAreaClear(CharGenWindow, TextArea) if CharGenState > 7: @@ -1752,7 +1755,7 @@ # Mage Spells Memorize def MageSpellsMemorize(SpellTable, Level, SpellLevel): - global CharGenWindow, MageMemorizeWindow, MageSpellsTable, MageMemorizeTextArea, MageMemorizeDoneButton, MageMemorizePointsLeft + global CharGenWindow, MageMemorizeWindow, MageMemorizeTextArea, MageMemorizeDoneButton, MageMemorizePointsLeft GemRB.SetVisible (CharGenWindow, 0) MageMemorizeWindow = GemRB.LoadWindow (16) @@ -2183,9 +2186,7 @@ row = GemRB.QueryText (CharSoundWindow, CharSoundVoiceList) column = str(GemRB.Roll(1,40,0)) - print row, column x=GemRB.GetTableValue (CharSoundStrings, row, column) - print GemRB.GetString (x) return def CharSoundDonePress(): Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUIMG.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -105,7 +105,7 @@ GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons - for i in range (24): + for i in range (20): #only 20 for iwd Button = GemRB.GetControl (Window, 27 + i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) @@ -167,7 +167,7 @@ known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (24): + for i in range (20): Button = GemRB.GetControl (Window, 27 + i) if i < known_cnt: ks = GemRB.GetKnownSpell (pc, type, level, i) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUIPR.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -88,7 +88,7 @@ GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) # Setup book spells buttons - for i in range (24): + for i in range (20): #only 20 for iwd Button = GemRB.GetControl (Window, 27 + i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) @@ -151,7 +151,7 @@ known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (24): + for i in range (20): Button = GemRB.GetControl (Window, 27 + i) if i < known_cnt: ks = GemRB.GetKnownSpell (pc, type, level, i) Modified: gemrb/trunk/gemrb/GUIScripts/tob/CharGen9.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/CharGen9.py 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/GUIScripts/tob/CharGen9.py 2007-05-05 09:51:23 UTC (rev 4639) @@ -1,7 +1,7 @@ #character generation (GUICG 0) import GemRB from ie_stats import * -from GUICommon import GetLearnableMageSpells, GetLearnablePriestSpells, SetColorStat +from GUICommon import * CharGenWindow = 0 TextAreaControl = 0 @@ -10,152 +10,157 @@ def OnLoad(): global CharGenWindow, TextAreaControl, PortraitName - GemRB.LoadWindowPack("GUICG", 640, 480) - CharGenWindow = GemRB.LoadWindow(0) - PortraitButton = GemRB.GetControl(CharGenWindow, 12) + GemRB.LoadWindowPack ("GUICG", 640, 480) + CharGenWindow = GemRB.LoadWindow (0) + PortraitButton = GemRB.GetControl (CharGenWindow, 12) GemRB.SetButtonFlags(CharGenWindow, PortraitButton, IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_NO_IMAGE,OP_SET) PortraitName = GemRB.GetToken ("LargePortrait") GemRB.SetButtonPicture (CharGenWindow,PortraitButton,PortraitName,"NOPORTMD") - RaceTable = GemRB.LoadTable("races") - ClassTable = GemRB.LoadTable("classes") - KitTable = GemRB.LoadTable("kitlist") - AlignmentTable = GemRB.LoadTable("aligns") - AbilityTable = GemRB.LoadTable("ability") + RaceTable = GemRB.LoadTable ("races") + ClassTable = GemRB.LoadTable ("classes") + KitTable = GemRB.LoadTable ("kitlist") + AlignmentTable = GemRB.LoadTable ("aligns") + AbilityTable = GemRB.LoadTable ("ability") - GenderButton = GemRB.GetControl(CharGenWindow,0) - GemRB.SetText(CharGenWindow,GenderButton,11956) - GemRB.SetButtonState(CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) + GenderButton = GemRB.GetControl (CharGenWindow,0) + GemRB.SetText (CharGenWindow,GenderButton,11956) + GemRB.SetButtonState (CharGenWindow,GenderButton,IE_GUI_BUTTON_DISABLED) - RaceButton = GemRB.GetControl(CharGenWindow,1) - GemRB.SetText(CharGenWindow,RaceButton, 11957) - GemRB.SetButtonState(CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) + RaceButton = GemRB.GetControl (CharGenWindow,1) + GemRB.SetText (CharGenWindow,RaceButton, 11957) + GemRB.SetButtonState (CharGenWindow,RaceButton,IE_GUI_BUTTON_DISABLED) - ClassButton = GemRB.GetControl(CharGenWindow,2) - GemRB.SetText(CharGenWindow,ClassButton, 11959) - GemRB.SetButtonState(CharGenWindow,ClassButton,IE_GUI_BUTTON_DISABLED) + ClassButton = GemRB.GetControl (CharGenWindow,2) + GemRB.SetText (CharGenWindow,ClassButton, 11959) + GemRB.SetButtonState (CharGenWindow,ClassButton,IE_GUI_BUTTON_DISABLED) - AlignmentButton = GemRB.GetControl(CharGenWindow,3) - GemRB.SetText(CharGenWindow,AlignmentButton, 11958) - GemRB.SetButtonState(CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) + AlignmentButton = GemRB.GetControl (CharGenWindow,3) + GemRB.SetText (CharGenWindow,AlignmentButton, 11958) + GemRB.SetButtonState (CharGenWindow,AlignmentButton,IE_GUI_BUTTON_DISABLED) - AbilitiesButton = GemRB.GetControl(CharGenWindow,4) - GemRB.SetText(CharGenWindow,AbilitiesButton, 11960) - GemRB.SetButtonState(CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) + AbilitiesButton = GemRB.GetControl (CharGenWindow,4) + GemRB.SetText (CharGenWindow,AbilitiesButton, 11960) + GemRB.SetButtonState (CharGenWindow,AbilitiesButton,IE_GUI_BUTTON_DISABLED) - SkillButton = GemRB.GetControl(CharGenWindow,5) - GemRB.SetText(CharGenWindow,SkillButton, 17372) - GemRB.SetButtonState(CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) + SkillButton = GemRB.GetControl (CharGenWindow,5) + GemRB.SetText (CharGenWindow,SkillButton, 17372) + GemRB.SetButtonState (CharGenWindow,SkillButton,IE_GUI_BUTTON_DISABLED) - AppearanceButton = GemRB.GetControl(CharGenWindow,6) - GemRB.SetText(CharGenWindow,AppearanceButton, 11961) - GemRB.SetButtonState(CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) + AppearanceButton = GemRB.GetControl (CharGenWindow,6) + GemRB.SetText (CharGenWindow,AppearanceButton, 11961) + GemRB.SetButtonState (CharGenWindow,AppearanceButton,IE_GUI_BUTTON_DISABLED) - NameButton = GemRB.GetControl(CharGenWindow,7) - GemRB.SetText(CharGenWindow,NameButton, 11963) - GemRB.SetButtonState(CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) + NameButton = GemRB.GetControl (CharGenWindow,7) + GemRB.SetText (CharGenWindow,NameButton, 11963) + GemRB.SetButtonState (CharGenWindow,NameButton,IE_GUI_BUTTON_DISABLED) - BackButton = GemRB.GetControl(CharGenWindow, 11) - GemRB.SetText(CharGenWindow, BackButton, 15416) - GemRB.SetButtonState(CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) + BackButton = GemRB.GetControl (CharGenWindow, 11) + GemRB.SetText (CharGenWindow, BackButton, 15416) + GemRB.SetButtonState (CharGenWindow,BackButton,IE_GUI_BUTTON_ENABLED) - AcceptButton = GemRB.GetControl(CharGenWindow, 8) - GemRB.SetText(CharGenWindow, AcceptButton, 11962) - GemRB.SetButtonState(CharGenWindow,AcceptButton,IE_GUI_BUTTON_ENABLED) + AcceptButton = GemRB.GetControl (CharGenWindow, 8) + GemRB.SetText (CharGenWindow, AcceptButton, 11962) + GemRB.SetButtonState (CharGenWindow,AcceptButton,IE_GUI_BUTTON_ENABLED) GemRB.SetButtonFlags(CharGenWindow,AcceptButton, IE_GUI_BUTTON_DEFAULT,OP_OR) - ImportButton = GemRB.GetControl(CharGenWindow, 13) - GemRB.SetText(CharGenWindow, ImportButton, 13955) - GemRB.SetButtonState(CharGenWindow,ImportButton,IE_GUI_BUTTON_DISABLED) + ImportButton = GemRB.GetControl (CharGenWindow, 13) + GemRB.SetText (CharGenWindow, ImportButton, 13955) + GemRB.SetButtonState (CharGenWindow,ImportButton,IE_GUI_BUTTON_ENABLED) - CancelButton = GemRB.GetControl(CharGenWindow, 15) - GemRB.SetText(CharGenWindow, CancelButton, 8159) - GemRB.SetButtonState(CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) + CancelButton = GemRB.GetControl (CharGenWindow, 15) + GemRB.SetText (CharGenWindow, CancelButton, 8159) + GemRB.SetButtonState (CharGenWindow,CancelButton,IE_GUI_BUTTON_ENABLED) - BiographyButton = GemRB.GetControl(CharGenWindow, 16) - GemRB.SetText(CharGenWindow, BiographyButton, 18003) - GemRB.SetButtonState(CharGenWindow,BiographyButton,IE_GUI_BUTTON_DISABLED) - TextAreaControl= GemRB.GetControl(CharGenWindow,9) - - GemRB.SetText(CharGenWindow, TextAreaControl, 1047) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, ": ") - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, GemRB.GetToken("CHARNAME") ) + BiographyButton = GemRB.GetControl (CharGenWindow, 16) + GemRB.SetText (CharGenWindow, BiographyButton, 18003) + GemRB.SetButtonState (CharGenWindow,BiographyButton,IE_GUI_BUTTON_DISABLED) + TextAreaControl= GemRB.GetControl (CharGenWindow,9) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 12135, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") + GemRB.SetText (CharGenWindow, TextAreaControl, 1047) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, ": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, GemRB.GetToken ("CHARNAME") ) + + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 12135, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") if GemRB.GetVar ("Gender") == 1: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1050) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 1050) else: - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, 1051) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1048,-1) # new line - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(RaceTable,GemRB.GetVar ("Race")-1,2)) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,12136, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, 1051) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,1048,-1) # new line + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (RaceTable,GemRB.GetVar ("Race")-1,2)) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,12136, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") KitIndex = GemRB.GetVar ("Class Kit") if KitIndex == 0: Class = GemRB.GetVar ("Class")-1 - ClassTitle=GemRB.GetTableValue(ClassTable, Class, 2) + ClassTitle=GemRB.GetTableValue (ClassTable, Class, 2) else: - ClassTitle=GemRB.GetTableValue(KitTable, KitIndex, 2) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, ClassTitle) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,1049, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": ") - v = GemRB.FindTableValue(AlignmentTable,3,GemRB.GetVar ("Alignment")) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,GemRB.GetTableValue(AlignmentTable,v,2)) + ClassTitle=GemRB.GetTableValue (KitTable, KitIndex, 2) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, ClassTitle) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,1049, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": ") + v = GemRB.FindTableValue (AlignmentTable,3,GemRB.GetVar ("Alignment")) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,GemRB.GetTableValue (AlignmentTable,v,2)) for i in range(6): - v = GemRB.GetTableValue(AbilityTable, i,2) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl, v, -1) - GemRB.TextAreaAppend(CharGenWindow, TextAreaControl,": "+str(GemRB.GetVar ("Ability "+str(i)))) + v = GemRB.GetTableValue (AbilityTable, i,2) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl, v, -1) + GemRB.TextAreaAppend (CharGenWindow, TextAreaControl,": "+str(GemRB.GetVar ("Ability "+str(i)))) - GemRB.SetEvent(CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") - GemRB.SetEvent(CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") - GemRB.SetEvent(CharGenWindow, AcceptButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") - GemRB.SetVisible(CharGenWindow,1) + GemRB.SetEvent (CharGenWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "CancelPress") + GemRB.SetEvent (CharGenWindow, BackButton, IE_GUI_BUTTON_ON_PRESS, "BackPress") + GemRB.SetEvent (CharGenWindow, AcceptButton, IE_GUI_BUTTON_ON_PRESS, "NextPress") + GemRB.SetEvent (CharGenWindow, ImportButton, IE_GUI_BUTTON_ON_PRESS, "ImportPress") + GemRB.SetVisible (CharGenWindow,1) return - + def NextPress(): - GemRB.UnloadWindow(CharGenWindow) + GemRB.UnloadWindow (CharGenWindow) #set my character up MyChar = GemRB.GetVar ("Slot") - GemRB.CreatePlayer("charbase", MyChar ) + GemRB.CreatePlayer ("charbase", MyChar ) GemRB.SetPlayerStat (MyChar, IE_SEX, GemRB.GetVar ("Gender") ) - RaceTable = GemRB.LoadTable("races") + RaceTable = GemRB.LoadTable ("races") Race = GemRB.GetVar ("Race")-1 - GemRB.SetPlayerStat (MyChar, IE_RACE, GemRB.GetTableValue(RaceTable, Race, 3) ) - ClassTable = GemRB.LoadTable("classes") + GemRB.SetPlayerStat (MyChar, IE_RACE, GemRB.GetTableValue (RaceTable, Race, 3) ) + ClassTable = GemRB.LoadTable ("classes") ClassIndex = GemRB.GetVar ("Class")-1 - Class = GemRB.GetTableValue(ClassTable, ClassIndex, 5) + Class = GemRB.GetTableValue (ClassTable, ClassIndex, 5) GemRB.SetPlayerStat (MyChar, IE_CLASS, Class) KitIndex = GemRB.GetVar ("Class Kit") GemRB.SetPlayerStat (MyChar, IE_KIT, KitIndex) t = GemRB.GetVar ("Alignment") GemRB.SetPlayerStat (MyChar, IE_ALIGNMENT, t) + TmpTable = GemRB.LoadTable ("clskills") #mage spells - Learnable = GetLearnableMageSpells( KitIndex, t, 1) - SpellBook = GemRB.GetVar ("MageSpellBook") - j=1 - for i in range(len(Learnable) ): - if SpellBook & j: - GemRB.LearnSpell(MyChar, Learnable[i], 0) - j=j<<1 + TableName = GemRB.GetTableValue (TmpTable, Class, 1, 0) + if TableName != "*": + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_WIZARD, 1) + Learnable = GetLearnableMageSpells( KitIndex, t, 1) + SpellBook = GemRB.GetVar ("MageSpellBook") + j=1 + for i in range(len(Learnable) ): + if SpellBook & j: + GemRB.LearnSpell (MyChar, Learnable[i], 0) + j=j<<1 #priest spells - TmpTable = GemRB.LoadTable("clskills") - TableName = GemRB.GetTableValue(TmpTable, Class, 1) + TableName = GemRB.GetTableValue (TmpTable, Class, 1, 0) if TableName != "*": + SetupSpellLevels(MyChar, TableName, IE_SPELL_TYPE_PRIEST, 1) ClassFlag = 0 #set this according to class Learnable = GetLearnablePriestSpells( ClassFlag, t, 1) for i in range(len(Learnable) ): - GemRB.LearnSpell(MyChar, Learnable[i], 0) + GemRB.LearnSpell (MyChar, Learnable[i], 0) GemRB.UnloadTable (TmpTable) - TmpTable=GemRB.LoadTable("repstart") - AlignmentTable = GemRB.LoadTable("aligns") - t=GemRB.FindTableValue(AlignmentTable, 3, t) - t=GemRB.GetTableValue(TmpTable,t,0) * 10 + TmpTable=GemRB.LoadTable ("repstart") + AlignmentTable = GemRB.LoadTable ("aligns") + t = GemRB.FindTableValue (AlignmentTable, 3, t) + t = GemRB.GetTableValue (TmpTable,t,0) * 10 GemRB.SetPlayerStat (MyChar, IE_REPUTATION, t) #slot 1 is the protagonist @@ -163,27 +168,27 @@ GemRB.GameSetReputation( t ) GemRB.UnloadTable (TmpTable) - TmpTable=GemRB.LoadTable("strtgold") - t=GemRB.Roll(GemRB.GetTableValue(TmpTable,Class,1),GemRB.GetTableValue(TmpTable,Class,0), GemRB.GetTableValue(TmpTable,Class,2) ) - GemRB.SetPlayerStat (MyChar, IE_GOLD, t*GemRB.GetTableValue(TmpTable,Class,3) ) + TmpTable=GemRB.LoadTable ("strtgold") + t = GemRB.Roll (GemRB.GetTableValue (TmpTable,Class,1),GemRB.GetTableValue (TmpTable,Class,0), GemRB.GetTableValue (TmpTable,Class,2) ) + GemRB.SetPlayerStat (MyChar, IE_GOLD, t*GemRB.GetTableValue (TmpTable,Class,3) ) GemRB.UnloadTable (AlignmentTable) GemRB.UnloadTable (ClassTable) GemRB.UnloadTable (RaceTable) GemRB.UnloadTable (TmpTable) GemRB.SetPlayerStat (MyChar, IE_HATEDRACE, GemRB.GetVar ("HatedRace") ) - TmpTable=GemRB.LoadTable("ability") - AbilityCount = GemRB.GetTableRowCount(TmpTable) + TmpTable=GemRB.LoadTable ("ability") + AbilityCount = GemRB.GetTableRowCount (TmpTable) for i in range(AbilityCount): - StatID=GemRB.GetTableValue(TmpTable, i,4) + StatID=GemRB.GetTableValue (TmpTable, i,4) GemRB.SetPlayerStat (MyChar, StatID, GemRB.GetVar ("Ability "+str(i) ) ) GemRB.UnloadTable (TmpTable) - TmpTable=GemRB.LoadTable("weapprof") - ProfCount = GemRB.GetTableRowCount(TmpTable) + TmpTable=GemRB.LoadTable ("weapprof") + ProfCount = GemRB.GetTableRowCount (TmpTable) #bg2 weapprof.2da contains the bg1 proficiencies too, skipping those for i in range(ProfCount-8): - StatID = GemRB.GetTableValue(TmpTable, i+8, 0) + StatID = GemRB.GetTableValue (TmpTable, i+8, 0) Value = GemRB.GetVar ("Prof "+str(i) ) if Value: GemRB.ApplyEffect (MyChar, "Proficiency", Value, StatID ) @@ -219,8 +224,8 @@ value = GemRB.GetVar ("Skill "+str(i) ) GemRB.SetPlayerStat (MyChar, stat, value ) GemRB.UnloadTable (TmpTable) - - GemRB.SetPlayerName (MyChar, GemRB.GetToken("CHARNAME"), 0) + + GemRB.SetPlayerName (MyChar, GemRB.GetToken ("CHARNAME"), 0) TmpTable = GemRB.LoadTable ("clskills") GemRB.SetPlayerStat (MyChar, IE_XP, GemRB.GetTableValue (TmpTable, Class, 3) ) #this will also set the level (automatically) GemRB.UnloadTable (TmpTable) @@ -228,7 +233,7 @@ #does all the rest LargePortrait = GemRB.GetToken ("LargePortrait") SmallPortrait = GemRB.GetToken ("SmallPortrait") - GemRB.FillPlayerInfo(MyChar, LargePortrait, SmallPortrait) + GemRB.FillPlayerInfo (MyChar, LargePortrait, SmallPortrait) #LETS PLAY!! playmode = GemRB.GetVar ("PlayMode") @@ -236,17 +241,23 @@ GemRB.EnterGame() else: #leaving multi player pregen - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("Start") + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("Start") return def CancelPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("CharGen") + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("CharGen") return def BackPress(): - GemRB.UnloadWindow(CharGenWindow) - GemRB.SetNextScript("CharGen8") #name + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetNextScript ("CharGen8") #name return +def ImportPress(): + GemRB.UnloadWindow (CharGenWindow) + GemRB.SetToken ("NextScript","CharGen9") + GemRB.SetNextScript ("ImportFile") #import + return + Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-05-05 09:51:23 UTC (rev 4639) @@ -1995,23 +1995,12 @@ if (!spell) { return LSR_INVALID; //not existent spell } - //from now on, you must delete spl if you don't push back it - CREKnownSpell *spl = new CREKnownSpell(); - strncpy(spl->SpellResRef, spellname, 8); - spl->Type = spell->SpellType; - if ( spl->Type == IE_SPELL_TYPE_INNATE ) { - spl->Level = 0; - } - else { - spl->Level = (ieWord) (spell->SpellLevel-1); - } - bool ret=spellbook.AddKnownSpell(spl->Type, spl->Level, spl); - if (!ret) { - delete spl; + int exp = spellbook.LearnSpell(spell); + if (!exp) { return LSR_INVALID; } if (flags&LS_ADDXP) { - AddExperience(spl->Level*100); + AddExperience(exp); } return LSR_OK; } Modified: gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/plugins/Core/Spellbook.cpp 2007-05-05 09:51:23 UTC (rev 4639) @@ -35,6 +35,13 @@ static int NUM_SPELL_TYPES = 3; static bool IWD2Style = false; +//spelltypes in all games except iwd2 +#define IE_SPL_WIZARD 1 +#define IE_SPL_PRIEST 2 +#define IE_SPL_INNATE 4 + +static int spelltypes[3]={IE_SPL_PRIEST,IE_SPL_WIZARD,IE_SPL_INNATE}; + /* temporarily out static ieResRef *ResolveSpellName(ieDword index) { @@ -351,6 +358,34 @@ } } +int Spellbook::GetSpellType(int spelltype) +{ + if (IWD2Style) return spelltype; + + for(int i=0;i<3;i++) { + if (spelltypes[i]==spelltype) return i; + } + return IE_SPELL_TYPE_INNATE; +} + +int Spellbook::LearnSpell(Spell *spell) +{ + CREKnownSpell *spl = new CREKnownSpell(); + strncpy(spl->SpellResRef, spell->Name, 8); + spl->Type = GetSpellType(spell->SpellType); + if ( spl->Type == IE_SPELL_TYPE_INNATE) { + spl->Level = 0; + } + else { + spl->Level = (ieWord) (spell->SpellLevel-1); + } + bool ret=AddKnownSpell(spl->Type, spl->Level, spl); + if (!ret) { + delete spl; + } + return spell->SpellLevel*100; +} + bool Spellbook::AddKnownSpell(int type, unsigned int level, CREKnownSpell *spl) { if (type >= NUM_SPELL_TYPES) { Modified: gemrb/trunk/gemrb/plugins/Core/Spellbook.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Spellbook.h 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/plugins/Core/Spellbook.h 2007-05-05 09:51:23 UTC (rev 4639) @@ -34,6 +34,7 @@ #include <vector> class Actor; +class Spell; #ifdef WIN32 @@ -181,7 +182,11 @@ /** this removes ALL spells matching spellid */ void RemoveSpell(int spellid); - /** adds a spell to the book */ + /** returns the page number for the spelltype */ + static int GetSpellType(int spelltype); + /** adds a spell to the book, returns experience if learned */ + int LearnSpell(Spell *spell); + /** adds a spell to the book, internal */ bool AddKnownSpell(int type, unsigned int level, CREKnownSpell *spl); CREKnownSpell* GetKnownSpell(int type, unsigned int level, unsigned int index) const; unsigned int GetMemorizedSpellsCount(int type) const; Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-05 08:29:54 UTC (rev 4638) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-05 09:51:23 UTC (rev 4639) @@ -772,14 +772,14 @@ static PyObject* GemRB_LoadTable(PyObject * /*self*/, PyObject* args) { - char* string; + char* tablename; int noerror = 0; - if (!PyArg_ParseTuple( args, "s|i", &string, &noerror )) { + if (!PyArg_ParseTuple( args, "s|i", &tablename, &noerror )) { return AttributeError( GemRB_LoadTable__doc ); } - int ind = core->LoadTable( string ); + int ind = core->LoadTable( tablename ); if (!noerror && ind == -1) { return RuntimeError("Can't find resource"); } @@ -902,15 +902,6 @@ return RuntimeError("Can't find resource"); } return PyInt_FromLong(tm->FindTableValue(col, Value)); -/* - for (row = 0; row < tm->GetRowCount(); row++) { - const char* ret = tm->QueryField( row, col ); - long val; - if (valid_number( ret, val ) && (Value == val) ) - return PyInt_FromLong( row ); - } - return PyInt_FromLong( -1 ); //row not found -*/ } PyDoc_STRVAR( GemRB_GetTableRowIndex__doc, @@ -1003,6 +994,27 @@ return PyInt_FromLong( tm->GetRowCount() ); } +PyDoc_STRVAR( GemRB_GetTableColu... [truncated message content] |
From: <ave...@us...> - 2007-05-20 11:51:41
|
Revision: 4658 http://gemrb.svn.sourceforge.net/gemrb/?rev=4658&view=rev Author: avenger_teambg Date: 2007-05-20 04:51:39 -0700 (Sun, 20 May 2007) Log Message: ----------- implemented portrait change event (hp bar, state, portrait icons, etc) pst: implemented changing portraits based on state SetAnimation guiscript command will now accept an optional cycle parameter Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/ie_stats.py gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/ControlAnimation.cpp gemrb/trunk/gemrb/plugins/Core/ControlAnimation.h gemrb/trunk/gemrb/plugins/Core/Game.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/ie_stats.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/ie_stats.py 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/GUIScripts/ie_stats.py 2007-05-20 11:51:39 UTC (rev 4658) @@ -42,7 +42,11 @@ ENEMY = 255 # state bits (IE_STATE) +STATE_PANIC = 4 +STATE_HELPLESS = 1+ 8 + 32 +STATE_PETRIFIED = 64 + 128 STATE_DEAD = 2048 +STATE_POISONED = 0x4000 MC_FALLEN_PALADIN = 0x200 MC_FALLEN_RANGER = 0x400 Modified: gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py 2007-05-20 11:51:39 UTC (rev 4658) @@ -305,19 +305,40 @@ GemRB.SetButtonFlags (Window, ButtonHP, IE_GUI_BUTTON_NO_IMAGE, OP_SET) continue - #sel = GemRB.GameIsPCSelected (i+1) sel = GemRB.GameGetSelectedPCSingle () == i + 1 GemRB.SetButtonBAM (Window, Button, pic, 0, 0, -1) - GemRB.SetAnimation (Window, Button, pic) + + state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) + hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) + + if state & STATE_DEAD: + cycle = 9 + elif state & STATE_HELPLESS: + cycle = 8 + elif state & STATE_PETRIFIED: + cycle = 7 + elif state & STATE_PANIC: + cycle = 6 + elif state & STATE_POISONED: + cycle = 2 + elif hp<hp_max/5: + cycle = 4 + else: + cycle = 0 + + print "HP:",hp, ", ", hp_max + print "State:", state, "Cycle: ", cycle + + GemRB.SetAnimation (Window, Button, pic, cycle) - GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED | IE_GUI_BUTTON_PLAYRANDOM, OP_SET) - #GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_ANIMATED, OP_SET) + if cycle<6: + GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED | IE_GUI_BUTTON_PLAYRANDOM, OP_SET) + else: + GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED, OP_SET) GemRB.SetButtonFlags(Window, ButtonHP, IE_GUI_BUTTON_PICTURE, OP_SET) - hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) - hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) - ratio = (hp + 0.0) / hp_max if ratio > 1.0: ratio = 1.0 r = int (255 * (1.0 - ratio)) Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-05-20 11:51:39 UTC (rev 4658) @@ -576,6 +576,9 @@ void pcf_state(Actor *actor, ieDword Value) { + if (actor->InParty) { + core->SetEventFlag(EF_PORTRAIT); + } if (Value & STATE_PETRIFIED) { SetLockedPalette( actor, fullstone); return; @@ -599,6 +602,9 @@ actor->Die(NULL); } actor->Modified[IE_MINHITPOINTS]=Value; + if (actor->InParty) { + core->SetEventFlag(EF_PORTRAIT); + } } void pcf_maxhitpoint(Actor *actor, ieDword Value) @@ -607,6 +613,9 @@ actor->Modified[IE_HITPOINTS]=Value; pcf_hitpoint(actor,Value); } + if (actor->InParty) { + core->SetEventFlag(EF_PORTRAIT); + } } void pcf_minhitpoint(Actor *actor, ieDword Value) @@ -630,6 +639,9 @@ if ((signed) Value<=0) { actor->Die(NULL); } + if (actor->InParty) { + core->SetEventFlag(EF_PORTRAIT); + } } void pcf_gold(Actor *actor, ieDword /*Value*/) Modified: gemrb/trunk/gemrb/plugins/Core/ControlAnimation.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ControlAnimation.cpp 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/Core/ControlAnimation.cpp 2007-05-20 11:51:39 UTC (rev 4658) @@ -27,11 +27,11 @@ #include "Button.h" -ControlAnimation::ControlAnimation(Control* ctl, ieResRef ResRef) +ControlAnimation::ControlAnimation(Control* ctl, ieResRef ResRef, int Cycle) { control = NULL; bam = NULL; - cycle = 0; + cycle = Cycle; frame = 0; anim_phase = 0; @@ -55,19 +55,37 @@ bam = NULL; } +bool ControlAnimation::SameResource(ieResRef ResRef, int Cycle) +{ + if (!control ) return false; + if (!bam) return false; + if (memcmp(ResRef, bam->ResRef, sizeof(ieResRef) )) return false; + int c = cycle; + if (control->Flags&IE_GUI_BUTTON_PLAYRANDOM) { + c&=~1; + } + if (Cycle!=c) return false; + return true; +} + void ControlAnimation::UpdateAnimation(void) { unsigned long time; + int Cycle = cycle; if (control->Flags & IE_GUI_BUTTON_PLAYRANDOM) { // simple Finite-State Machine if (anim_phase == 0) { - cycle = 0; frame = 0; anim_phase = 1; time = 500 + 500 * (rand() % 20); + cycle&=~1; + Cycle=cycle; } else if (anim_phase == 1) { - if (rand() % 30 == 0) cycle = 1; + if (rand() % 30 == 0) { + cycle|=1; + Cycle=cycle; + } anim_phase = 2; time = 100; } else { @@ -79,7 +97,7 @@ time = 15; } - Sprite2D* pic = bam->GetFrame( (unsigned short) frame, (unsigned char) cycle ); + Sprite2D* pic = bam->GetFrame( (unsigned short) frame, (unsigned char) Cycle ); if (pic == NULL) { //stopping at end frame Modified: gemrb/trunk/gemrb/plugins/Core/ControlAnimation.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/ControlAnimation.h 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/Core/ControlAnimation.h 2007-05-20 11:51:39 UTC (rev 4658) @@ -54,9 +54,11 @@ unsigned int frame; unsigned int anim_phase; public: - ControlAnimation(Control* ctl, ieResRef ResRef); + ControlAnimation(Control* ctl, ieResRef ResRef, int Cycle = 0); ~ControlAnimation(void); void UpdateAnimation(); + //report if the current resource is the same as descripted by the params + bool SameResource(ieResRef ResRef, int Cycle); }; #endif Modified: gemrb/trunk/gemrb/plugins/Core/Game.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Game.cpp 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/Core/Game.cpp 2007-05-20 11:51:39 UTC (rev 4658) @@ -941,7 +941,7 @@ case BM_AND: ControlStatus&=value; break; case BM_XOR: ControlStatus^=value; break; } - core->EventFlag|=EF_CONTROL; + core->SetEventFlag(EF_CONTROL); } void Game::AddGold(ieDword add) Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-05-20 11:51:39 UTC (rev 4658) @@ -542,6 +542,15 @@ return; } + if (EventFlag&EF_PORTRAIT) { + ieDword tmp = (ieDword) ~0; + vars->Lookup( "PortraitWindow", tmp ); + if (tmp != (ieDword) ~0) { + EventFlag&=~EF_PORTRAIT; + guiscript->RunFunction( "UpdatePortraitWindow" ); + } + } + if (EventFlag&EF_CONTROL) { EventFlag&=~EF_CONTROL; guiscript->RunFunction( "UpdateControlStatus" ); Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-05-20 11:51:39 UTC (rev 4658) @@ -156,6 +156,7 @@ //they wait until the condition is right #define EF_CONTROL 1 #define EF_SHOWMAP 2 +#define EF_PORTRAIT 4 //autopause #define AP_UNUSABLE 0 @@ -677,16 +678,21 @@ /** Sends a termination signal to the Video Driver */ bool Quit(void); /** CheatKey support */ - void EnableCheatKeys(int Flag) + inline void EnableCheatKeys(int Flag) { CheatFlag=(Flag > 0); } - bool CheatEnabled() + inline bool CheatEnabled() { return CheatFlag; } + inline void SetEventFlag(int Flag) + { + EventFlag|=Flag; + } + /** Next Script Name */ char NextScript[64]; /** Console is on Screen */ Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-12 18:32:35 UTC (rev 4657) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-20 11:51:39 UTC (rev 4658) @@ -1406,7 +1406,7 @@ return NULL; } if (!WindowIndex) { - core->EventFlag|=EF_CONTROL; + core->SetEventFlag(EF_CONTROL); } Py_INCREF( Py_None ); @@ -2870,15 +2870,16 @@ } PyDoc_STRVAR( GemRB_SetAnimation__doc, -"SetAnimation(WindowIndex, ControlIndex, BAMResRef)\n\n" -"Sets the animation of a Button Control from a BAM file."); +"SetAnimation(WindowIndex, ControlIndex, BAMResRef[, Cycle])\n\n" +"Sets the animation of a Control (usually a Button) from a BAM file. Optionally an animation cycle could be set too."); static PyObject* GemRB_SetAnimation(PyObject * /*self*/, PyObject* args) { int wi, ci; char* ResRef; + int Cycle = 0; - if (!PyArg_ParseTuple( args, "iis", &wi, &ci, &ResRef )) { + if (!PyArg_ParseTuple( args, "iis|i", &wi, &ci, &ResRef, &Cycle )) { return AttributeError( GemRB_SetAnimation__doc ); } @@ -2887,8 +2888,14 @@ return NULL; } - //who knows, there might have been lurking an active animation + //who knows, there might have been an active animation lurking if (ctl->animation) { + //if this control says the resource is the same + //we are just setting now don't reset it + if(ctl->animation->SameResource(ResRef, Cycle)) { + Py_INCREF( Py_None ); + return Py_None; + } delete ctl->animation; ctl->animation = NULL; } @@ -2899,7 +2906,7 @@ return Py_None; } - ControlAnimation* anim = new ControlAnimation( ctl, ResRef ); + ControlAnimation* anim = new ControlAnimation( ctl, ResRef, Cycle ); anim->UpdateAnimation(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-22 18:21:10
|
Revision: 4660 http://gemrb.svn.sourceforge.net/gemrb/?rev=4660&view=rev Author: avenger_teambg Date: 2007-05-22 11:21:06 -0700 (Tue, 22 May 2007) Log Message: ----------- implemented SetButtonOverlay guiscript command implemented hp feedback on portraits Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/plugins/Core/Button.cpp gemrb/trunk/gemrb/plugins/Core/Button.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-05-20 18:19:50 UTC (rev 4659) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-05-22 18:21:06 UTC (rev 4660) @@ -563,7 +563,12 @@ GemRB.SetButtonPicture (Window, Button, pic, "NOPORTSM") hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) + state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + if hp<1 or (state & STATE_DEAD): + GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + else: + GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,64) #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) Modified: gemrb/trunk/gemrb/plugins/Core/Button.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Button.cpp 2007-05-20 18:19:50 UTC (rev 4659) +++ gemrb/trunk/gemrb/plugins/Core/Button.cpp 2007-05-22 18:21:06 UTC (rev 4660) @@ -55,6 +55,7 @@ Picture = NULL; Clipping = 1.0; memset( borders, 0, sizeof( borders )); + starttime = 0; } Button::~Button() { @@ -105,6 +106,34 @@ } Changed = true; } + +/** make SourceRGB go closer to DestRGB */ +void Button::CloseUpColor() +{ + if (!starttime) return; + //using the realtime timer, because i don't want to + //handle Game at this point + unsigned long newtime; + + GetTime( newtime ); + if (newtime<starttime) { + return; + } + Changed = true; + SourceRGB.r = (SourceRGB.r + DestRGB.r) / 2; + SourceRGB.g = (SourceRGB.g + DestRGB.g) / 2; + SourceRGB.b = (SourceRGB.b + DestRGB.b) / 2; + SourceRGB.a = (SourceRGB.a + DestRGB.a) / 2; + if (SourceRGB.r == DestRGB.r && + SourceRGB.g == DestRGB.g && + SourceRGB.b == DestRGB.b && + SourceRGB.a == DestRGB.a) { + starttime = 0; + return; + } + starttime = newtime + 40; +} + /** Draws the Control on the Output Display */ void Button::Draw(unsigned short x, unsigned short y) { @@ -168,8 +197,18 @@ // Picture is drawn centered int xOffs = ( Width / 2 ) - ( Picture->Width / 2 ); int yOffs = ( Height / 2 ) - ( Picture->Height / 2 ); - Region r( x + XPos + xOffs, y + YPos + yOffs, (int)(Picture->Width * Clipping), Picture->Height ); - video->BlitSprite( Picture, x + XPos + xOffs + Picture->XPos, y + YPos + yOffs + Picture->YPos, true, &r ); + if (Flags & IE_GUI_BUTTON_HORIZONTAL) { + xOffs += x + XPos + Picture->XPos; + yOffs += y + YPos + Picture->YPos; + video->BlitSprite( Picture, xOffs, yOffs, true ); + Region r = Region( xOffs, yOffs + (int) (Picture->Height * Clipping), Picture->Width, (int) (Picture->Height*(1.0 - Clipping)) ); + video->DrawRect( r, SourceRGB, true ); + CloseUpColor(); + } + else { + Region r( x + XPos + xOffs, y + YPos + yOffs, (int)(Picture->Width * Clipping), Picture->Height ); + video->BlitSprite( Picture, x + XPos + xOffs + Picture->XPos, y + YPos + yOffs + Picture->YPos, true, &r ); + } } // Composite pictures (paperdolls/description icons) @@ -579,3 +618,15 @@ Changed = true; } +void Button::SetHorizontalOverlay(double clip, Color src, Color dest) +{ + if (Clipping>clip) { + SourceRGB=src; + DestRGB=dest; + GetTime( starttime ); + starttime += 40; + } + Clipping = clip; + Flags |= IE_GUI_BUTTON_HORIZONTAL; + Changed = true; +} Modified: gemrb/trunk/gemrb/plugins/Core/Button.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Button.h 2007-05-20 18:19:50 UTC (rev 4659) +++ gemrb/trunk/gemrb/plugins/Core/Button.h 2007-05-22 18:21:06 UTC (rev 4660) @@ -72,6 +72,7 @@ #define IE_GUI_BUTTON_CENTER_PICTURES 0x00080000 // center button's PictureList #define IE_GUI_BUTTON_BG1_PAPERDOLL 0x00100000 // BG1-style paperdoll PictureList +#define IE_GUI_BUTTON_HORIZONTAL 0x00200000 // horizontal clipping of overlay #define IE_GUI_BUTTON_NORMAL 0x00000004 // default button, doesn't stick @@ -143,6 +144,8 @@ void StackPicture(Sprite2D* Picture); /** Sets border/frame parameters */ void SetBorder(int index, int dx1, int dy1, int dx2, int dy2, Color* color, bool enabled = false, bool filled = false); + /** Sets horizontal overlay, used in portrait hp overlay */ + void SetHorizontalOverlay(double clip, Color src, Color dest); /** Sets font used for drawing button label */ void SetFont(Font* newfont); /** Enables or disables specified border/frame */ @@ -202,9 +205,13 @@ unsigned char State; double Clipping; Point drag_start; + /** HP Bar over portraits */ + Color SourceRGB, DestRGB; + unsigned long starttime; /** frame settings */ ButtonBorder borders[MAX_NUM_BORDERS]; bool IsPixelTransparent (unsigned short x, unsigned short y); + void CloseUpColor(); }; #endif Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-20 18:19:50 UTC (rev 4659) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-22 18:21:06 UTC (rev 4660) @@ -1865,6 +1865,44 @@ return Py_None; } +PyDoc_STRVAR( GemRB_SetButtonOverlay__doc, +"SetButtonOverlay(WindowIndex, ControlIndex, Current, Max, r,g,b,a, r,g,b,a)\n\n" +"Sets up a portrait button for hitpoint overlay" ); + +static PyObject* GemRB_SetButtonOverlay(PyObject * /*self*/, PyObject* args) +{ + int WindowIndex, ControlIndex; + int Max, Current; + int r1,g1,b1,a1; + int r2,g2,b2,a2; + + if (!PyArg_ParseTuple( args, "iiiiiiiiiiii", &WindowIndex, &ControlIndex, + &Max, &Current, &r1, &g1, &b1, &a1, &r2, &g2, &b2, &a2)) { + return AttributeError( GemRB_SetButtonOverlay__doc ); + } + + Button* btn = ( Button* ) GetControl(WindowIndex, ControlIndex, IE_GUI_BUTTON); + if (!btn) { + return NULL; + } + + Color src = { r1, g1, b1, a1 }; + Color dest = { r2, g2, b2, a2 }; + double ratio = 0.0; + if (Max>0) { + if (Current>=Max) { + ratio = 1.0; + } else { + ratio = (double) Current / Max; + } + } + + //can't call clipping, because the change of ratio triggers color change + btn->SetHorizontalOverlay(ratio, src, dest); + Py_INCREF( Py_None ); + return Py_None; +} + PyDoc_STRVAR( GemRB_SetButtonBorder__doc, "SetButtonBorder(WindowIndex, ControlIndex, BorderIndex, dx1, dy1, dx2, dy2, R, G, B, A, [enabled, filled])\n\n" "Sets border/frame parameters for a button." ); @@ -1874,7 +1912,7 @@ int WindowIndex, ControlIndex, BorderIndex, dx1, dy1, dx2, dy2, r, g, b, a, enabled = 0, filled = 0; if (!PyArg_ParseTuple( args, "iiiiiiiiiii|ii", &WindowIndex, &ControlIndex, - &BorderIndex, &dx1, &dy1, &dx2, &dy2, &r, &g, &b, &a, &enabled, &filled)) { + &BorderIndex, &dx1, &dy1, &dx2, &dy2, &r, &g, &b, &a, &enabled, &filled)) { return AttributeError( GemRB_SetButtonBorder__doc ); } @@ -7939,6 +7977,7 @@ METHOD(SetButtonSprites, METH_VARARGS), METHOD(SetButtonBorder, METH_VARARGS), METHOD(EnableButtonBorder, METH_VARARGS), + METHOD(SetButtonOverlay, METH_VARARGS), METHOD(SetButtonFont, METH_VARARGS), METHOD(SetButtonTextColor, METH_VARARGS), METHOD(AdjustScrolling, METH_VARARGS), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-24 20:09:20
|
Revision: 4665 http://gemrb.svn.sourceforge.net/gemrb/?rev=4665&view=rev Author: avenger_teambg Date: 2007-05-24 13:09:09 -0700 (Thu, 24 May 2007) Log Message: ----------- fixed damage feedback ctrl-r now works exactly like in the IE synced up iwd/how Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/plugins/Core/Button.cpp gemrb/trunk/gemrb/plugins/Core/GameControl.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/Core/Interface.h gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-05-24 20:09:09 UTC (rev 4665) @@ -532,14 +532,18 @@ hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) + state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) - GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) + if hp<1 or (state & STATE_DEAD): + GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + else: + GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,64) + + #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) if sel: - #GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SELECTED) GemRB.EnableButtonBorder (Window, Button, FRAME_PC_SELECTED, 1) else: - #GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_UNPRESSED) GemRB.EnableButtonBorder (Window, Button, FRAME_PC_SELECTED, 0) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-05-24 20:09:09 UTC (rev 4665) @@ -524,14 +524,18 @@ hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) + state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) - GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) + if hp<1 or (state & STATE_DEAD): + GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + else: + GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,64) + + #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) if sel: - #GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_SELECTED) GemRB.EnableButtonBorder (Window, Button, FRAME_PC_SELECTED, 1) else: - #GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_UNPRESSED) GemRB.EnableButtonBorder (Window, Button, FRAME_PC_SELECTED, 0) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-05-24 20:09:09 UTC (rev 4665) @@ -565,6 +565,7 @@ hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + print i, ": ",state,", ", hp if hp<1 or (state & STATE_DEAD): GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) else: Modified: gemrb/trunk/gemrb/plugins/Core/Button.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Button.cpp 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/plugins/Core/Button.cpp 2007-05-24 20:09:09 UTC (rev 4665) @@ -115,11 +115,11 @@ //handle Game at this point unsigned long newtime; + Changed = true; GetTime( newtime ); if (newtime<starttime) { return; } - Changed = true; SourceRGB.r = (SourceRGB.r + DestRGB.r) / 2; SourceRGB.g = (SourceRGB.g + DestRGB.g) / 2; SourceRGB.b = (SourceRGB.b + DestRGB.b) / 2; Modified: gemrb/trunk/gemrb/plugins/Core/GameControl.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/plugins/Core/GameControl.cpp 2007-05-24 20:09:09 UTC (rev 4665) @@ -515,6 +515,8 @@ } } +static EffectRef heal_ref={"CurrentHPModifier", NULL, -1}; + /** Key Release Event */ void GameControl::OnKeyRelease(unsigned char Key, unsigned short Mod) { @@ -676,7 +678,10 @@ lastActor = area->GetActor( p, GA_DEFAULT); } if (lastActor) { - lastActor->Resurrect(); + Effect *fx = EffectQueue::CreateEffect(heal_ref, lastActor->GetStat(IE_MAXHITPOINTS), 3, FX_DURATION_INSTANT_LIMITED); + if (fx) { + core->ApplyEffect(fx, lastActor, lastActor); + } } break; case 't'://advances time Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-05-24 20:09:09 UTC (rev 4665) @@ -98,7 +98,7 @@ static ieWordSigned *conmod = NULL; static ieWordSigned *chrmod = NULL; -Interface::Interface(int iargc, char** iargv) +Interface::Interface(int iargc, char* iargv[]) { argc = iargc; argv = iargv; Modified: gemrb/trunk/gemrb/plugins/Core/Interface.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/plugins/Core/Interface.h 2007-05-24 20:09:09 UTC (rev 4665) @@ -313,7 +313,7 @@ Sprite2D *WindowFrames[4]; Sprite2D *GroundCircles[MAX_CIRCLE_SIZE][6]; public: - Interface(int iargc, char **iargv); + Interface(int iargc, char *iargv[]); ~Interface(void); int Init(void); //TODO: Core Methods in Interface Class Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-05-24 20:09:09 UTC (rev 4665) @@ -1124,6 +1124,12 @@ } else { STAT_MOD( IE_HITPOINTS ); } + if (fx->Parameter2&1) { + target->Resurrect(); + } + if (fx->Parameter2&2) { + target->fxqueue.RemoveAllNonPermanentEffects(); + } return FX_PERMANENT; } Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-23 16:58:31 UTC (rev 4664) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-24 20:09:09 UTC (rev 4665) @@ -1893,7 +1893,9 @@ if (Current>=Max) { ratio = 1.0; } else { - ratio = (double) Current / Max; + if (Current>0) { + ratio = (double) Current / Max; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-28 10:17:21
|
Revision: 4669 http://gemrb.svn.sourceforge.net/gemrb/?rev=4669&view=rev Author: avenger_teambg Date: 2007-05-28 03:17:20 -0700 (Mon, 28 May 2007) Log Message: ----------- changed max/actual to ratio in SetButtonOverlay (same as SetButtonPictureClipping) Modified Paths: -------------- gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/GUIScripts/bg1/GUICommonWindows.py 2007-05-28 10:17:20 UTC (rev 4669) @@ -239,10 +239,10 @@ elif level == 1: GemRB.SetupEquipmentIcons(ActionsWindow, pc, TopIndex) elif level == 2: #spells - GemRB.SetVar("Type", 3) + GemRB.SetVar ("Type", 3) GemRB.SetupSpellIcons(ActionsWindow, pc, 3, TopIndex) elif level == 3: #innates - GemRB.SetVar("Type", 4) + GemRB.SetVar ("Type", 4) GemRB.SetupSpellIcons(ActionsWindow, pc, 4, TopIndex) return @@ -356,7 +356,7 @@ def ActionQItemPressed (action): pc = GemRB.GameGetFirstSelectedPC () #quick slot - GemRB.UseItem(pc, -2, action) + GemRB.UseItem (pc, -2, action) return def ActionQItem1Pressed (): @@ -388,9 +388,10 @@ def SpellPressed (): pc = GemRB.GameGetFirstSelectedPC () - Spell = GemRB.GetVar("Spell") - Type = GemRB.GetVar("Type") - GemRB.SpellCast(pc, Type, Spell) + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) + Spell = GemRB.GetVar ("Spell") + Type = GemRB.GetVar ("Type") + GemRB.SpellCast (pc, Type, Spell) GemRB.SetVar ("ActionLevel", 0) UpdateActionsWindow () return @@ -398,8 +399,10 @@ def EquipmentPressed (): pc = GemRB.GameGetFirstSelectedPC () - Item = GemRB.GetVar("Equipment") - GemRB.UseItem(pc, -1, Item) + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) + Item = GemRB.GetVar ("Equipment") + #equipment index + GemRB.UseItem (pc, -1, Item) GemRB.SetVar ("ActionLevel", 0) UpdateActionsWindow () return @@ -412,7 +415,7 @@ Class = GemRB.FindTableValue ( ClassTable, 5, Class ) KitTable = GemRB.LoadTable ("kitlist") - if ClassTitle==0: + if ClassTitle == 0: if KitIndex == 0: ClassTitle=GemRB.GetTableValue (ClassTable, Class, 2) else: @@ -508,9 +511,14 @@ def UpdatePortraitWindow (): Window = PortraitWindow + pc = GemRB.GameGetSelectedPCSingle () + Inventory = GemRB.GetVar ("Inventory") + for i in range (PARTY_SIZE): Button = GemRB.GetControl (Window, i) pic = GemRB.GetPlayerPortrait (i+1, 1) + if Inventory and pc!=i+1: + pic = None if not pic: GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_SET) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) @@ -525,10 +533,15 @@ hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + if (hp_max<1): + ratio = 0.0 + else: + ratio = (hp+0.0) / hp_max + if hp<1 or (state & STATE_DEAD): - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 64,64,64,200, 64,64,64,200) else: - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 255,0,0,200, 128,0,0,200) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) @@ -583,11 +596,13 @@ if GemRB.IsDraggingItem (): Button = GemRB.GetControl (PortraitWindow, i) GemRB.EnableButtonBorder (PortraitWindow, Button, FRAME_PC_TARGET, 1) + return def PortraitButtonOnMouseLeave (): i = GemRB.GetVar ("PressedPortrait") Button = GemRB.GetControl (PortraitWindow, i) GemRB.EnableButtonBorder (PortraitWindow, Button, FRAME_PC_TARGET, 0) + return def GetSavingThrow (SaveName, row, level): SaveTable = GemRB.LoadTable (SaveName) @@ -604,8 +619,17 @@ level2 = 20 Class = GemRB.GetPlayerStat (pc, IE_CLASS) ClassTable = GemRB.LoadTable ("classes") + + Race = GemRB.GetPlayerStat (pc, IE_RACE) + RaceTable = GemRB.LoadTable ("races") + Class = GemRB.FindTableValue (ClassTable, 5, Class) - Multi = GemRB.GetTableValue (ClassTable, 4, Class) + Multi = GemRB.GetTableValue (ClassTable, Class, 4) + + Race = GemRB.FindTableValue (RaceTable, 3, Race) + RaceSaveTableName = GemRB.GetTableValue (RaceTable, Race, 4) + + #todo fix multi class if Multi: if Class == 7: #fighter/mage @@ -625,6 +649,14 @@ if tmp2<tmp1: tmp1=tmp2 GemRB.SetPlayerStat (pc, IE_SAVEVSDEATH+row, tmp1) + if RaceSaveTableName!="*": + Con = GemRB.GetPlayerStat (pc, IE_CON) + RaceSaveTable = GemRB.LoadTable (RaceSaveTableName) + for row in range (5): + tmp1 = GemRB.GetPlayerStat (pc, IE_SAVEVSDEATH+row) + tmp1 += GemRB.GetTableValue (RaceSaveTable, row, Con) + GemRB.SetPlayerStat (pc, IE_SAVEVSDEATH+row, tmp1) + GemRB.UnloadTable (RaceSaveTable) return def SetEncumbranceLabels (Window, Label, Label2, pc): Modified: gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/GUIScripts/bg2/GUICommonWindows.py 2007-05-28 10:17:20 UTC (rev 4669) @@ -565,11 +565,15 @@ hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + if (hp_max<1): + ratio = 0.0 + else: + ratio = (hp+0.0) / hp_max + if hp<1 or (state & STATE_DEAD): - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 64,64,64,200, 64,64,64,200) else: - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,200) - #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) + GemRB.SetButtonOverlay (Window, Button, ratio, 255,0,0,200, 128,0,0,200) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) Modified: gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/GUIScripts/how/GUICommonWindows.py 2007-05-28 10:17:20 UTC (rev 4669) @@ -362,7 +362,7 @@ def ActionQItemPressed (action): pc = GemRB.GameGetFirstSelectedPC () #quick slot - GemRB.UseItem(pc, -2, action) + GemRB.UseItem (pc, -2, action) return def ActionQItem1Pressed (): @@ -487,7 +487,7 @@ GemRB.SetTooltip (Window, Button, 10485) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectAllOnPress") else: - PortraitWindow = Window = GemRB.LoadWindow(1) + PortraitWindow = Window = GemRB.LoadWindow (1) for i in range (PARTY_SIZE): Button = GemRB.GetControl (Window, i) @@ -534,10 +534,15 @@ hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + if (hp_max<1): + ratio = 0.0 + else: + ratio = (hp+0.0) / hp_max + if hp<1 or (state & STATE_DEAD): - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 64,64,64,200, 64,64,64,200) else: - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 255,0,0,200, 128,0,0,200) #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) Modified: gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/GUIScripts/iwd/GUICommonWindows.py 2007-05-28 10:17:20 UTC (rev 4669) @@ -195,7 +195,7 @@ ActionsWindow = Window UpdateActionsWindow () return - + def UpdateActionsWindow (): global ActionsWindow, PortraitWindow, OptionsWindow @@ -228,7 +228,6 @@ GemRB.SetButtonFont (ActionsWindow, Button, "NUMBER") GemRB.SetText (ActionsWindow, Button, "") - if pc == 0: EmptyControls () return @@ -244,10 +243,10 @@ elif level == 1: GemRB.SetupEquipmentIcons(ActionsWindow, pc, TopIndex) elif level == 2: #spells - GemRB.SetVar("Type", 3) + GemRB.SetVar ("Type", 3) GemRB.SetupSpellIcons(ActionsWindow, pc, 3, TopIndex) elif level == 3: #innates - GemRB.SetVar("Type", 4) + GemRB.SetVar ("Type", 4) GemRB.SetupSpellIcons(ActionsWindow, pc, 4, TopIndex) return @@ -264,7 +263,7 @@ GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_DEFEND) def ActionQWeaponPressed (which): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () if GemRB.GetEquippedQuickSlot (pc)==which and not (GemRB.GameControlGetTargetMode() &TARGET_MODE_ATTACK): GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_ATTACK) @@ -307,7 +306,7 @@ #no check needed because the button wouldn't be drawn if illegal def ActionRightPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () TopIndex = GemRB.GetVar ("TopIndex") Type = GemRB.GetVar ("Type") Max = GemRB.GetMemorizedSpellsCount(pc, Type) @@ -323,25 +322,25 @@ return def ActionSongPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () GemRB.SetModalState (pc, MS_BATTLESONG) UpdateActionsWindow () return def ActionSearchPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () GemRB.SetModalState (pc, MS_DETECTTRAPS) UpdateActionsWindow () return def ActionStealthPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () GemRB.SetModalState (pc, MS_STEALTH) UpdateActionsWindow () return def ActionTurnPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () GemRB.SetModalState (pc, MS_TURNUNDEAD) UpdateActionsWindow () return @@ -359,9 +358,9 @@ return def ActionQItemPressed (action): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () #quick slot - GemRB.UseItem(pc, -2, action) + GemRB.UseItem (pc, -2, action) return def ActionQItem1Pressed (): @@ -391,23 +390,23 @@ return def SpellPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) - Spell = GemRB.GetVar("Spell") - Type = GemRB.GetVar("Type") - GemRB.SpellCast(pc, Type, Spell) + Spell = GemRB.GetVar ("Spell") + Type = GemRB.GetVar ("Type") + GemRB.SpellCast (pc, Type, Spell) GemRB.SetVar ("ActionLevel", 0) UpdateActionsWindow () return def EquipmentPressed (): - pc = GemRB.GameGetFirstSelectedPC() + pc = GemRB.GameGetFirstSelectedPC () GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_CAST) - Item = GemRB.GetVar("Equipment") + Item = GemRB.GetVar ("Equipment") #equipment index - GemRB.UseItem(pc, -1, Item) + GemRB.UseItem (pc, -1, Item) GemRB.SetVar ("ActionLevel", 0) UpdateActionsWindow () return @@ -461,7 +460,8 @@ def OpenPortraitWindow (needcontrols): global PortraitWindow - PortraitWindow = Window = GemRB.LoadWindow(1) + #take care, this window is different in how/iwd + PortraitWindow = Window = GemRB.LoadWindow (1) if needcontrols: # AI Button = GemRB.GetControl (Window, 6) @@ -512,7 +512,7 @@ GemRB.SetText (Window, Button, "") GemRB.SetTooltip (Window, Button, "") continue - + sel = GemRB.GameGetSelectedPCSingle () == i + 1 GemRB.SetButtonPicture (Window, Button, pic, "NOPORTSM") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ALIGN_TOP | IE_GUI_BUTTON_ALIGN_LEFT, OP_SET) @@ -525,10 +525,15 @@ hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + if (hp_max<1): + ratio = 0.0 + else: + ratio = (hp+0.0) / hp_max + if hp<1 or (state & STATE_DEAD): - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 64,64,64,200, 64,64,64,200) else: - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 255,0,0,200, 128,0,0,200) #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) Modified: gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/GUIScripts/pst/GUICommonWindows.py 2007-05-28 10:17:20 UTC (rev 4669) @@ -327,9 +327,6 @@ else: cycle = 0 - print "HP:",hp, ", ", hp_max - print "State:", state, "Cycle: ", cycle - GemRB.SetAnimation (Window, Button, pic, cycle) if cycle<6: @@ -339,8 +336,11 @@ GemRB.SetButtonFlags(Window, ButtonHP, IE_GUI_BUTTON_PICTURE, OP_SET) - ratio = (hp + 0.0) / hp_max - if ratio > 1.0: ratio = 1.0 + if hp_max<1: + ratio = 0.0 + else: + ratio = (hp + 0.0) / hp_max + if ratio > 1.0: ratio = 1.0 r = int (255 * (1.0 - ratio)) g = int (255 * ratio) Modified: gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py =================================================================== --- gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/GUIScripts/tob/GUICommonWindows.py 2007-05-28 10:17:20 UTC (rev 4669) @@ -372,7 +372,7 @@ def ActionQItemPressed (action): pc = GemRB.GameGetFirstSelectedPC () #quick slot - GemRB.UseItem(pc, -2, action) + GemRB.UseItem (pc, -2, action) return def ActionQItem1Pressed (): @@ -491,7 +491,7 @@ if needcontrols: Button=GemRB.GetControl (Window, 8) - GemRB.SetEvent(Window, Button, IE_GUI_BUTTON_ON_PRESS, "MinimizePortraits") + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "MinimizePortraits") # AI Button = GemRB.GetControl (Window, 6) @@ -533,7 +533,6 @@ GemRB.SetButtonBorder (Window, Button, FRAME_PC_SELECTED, 1, 1, 2, 2, 0, 255, 0, 255) GemRB.SetButtonBorder (Window, Button, FRAME_PC_TARGET, 3, 3, 4, 4, 255, 255, 0, 255) - #GemRB.SetButtonFont (Window, Button, "NORMAL") UpdatePortraitWindow () SelectionChanged () @@ -565,11 +564,15 @@ hp_max = GemRB.GetPlayerStat (i+1, IE_MAXHITPOINTS) state = GemRB.GetPlayerStat (i+1, IE_STATE_ID) + if (hp_max<1): + ratio = 0.0 + else: + ratio = (hp+0.0) / hp_max + if hp<1 or (state & STATE_DEAD): - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 64,64,64,200, 64,64,64,200) + GemRB.SetButtonOverlay (Window, Button, ratio, 64,64,64,200, 64,64,64,200) else: - GemRB.SetButtonOverlay (Window, Button, hp_max, hp, 255,0,0,200, 128,0,0,200) - #GemRB.SetText (Window, Button, "%d/%d" %(hp, hp_max)) + GemRB.SetButtonOverlay (Window, Button, ratio, 255,0,0,200, 128,0,0,200) GemRB.SetTooltip (Window, Button, GemRB.GetPlayerName (i+1, 1) + "\n%d/%d" %(hp, hp_max)) Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-28 09:17:07 UTC (rev 4668) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-28 10:17:20 UTC (rev 4669) @@ -1872,12 +1872,12 @@ static PyObject* GemRB_SetButtonOverlay(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlIndex; - int Max, Current; + double Clipping; int r1,g1,b1,a1; int r2,g2,b2,a2; - if (!PyArg_ParseTuple( args, "iiiiiiiiiiii", &WindowIndex, &ControlIndex, - &Max, &Current, &r1, &g1, &b1, &a1, &r2, &g2, &b2, &a2)) { + if (!PyArg_ParseTuple( args, "iidiiiiiiii", &WindowIndex, &ControlIndex, + &Clipping, &r1, &g1, &b1, &a1, &r2, &g2, &b2, &a2)) { return AttributeError( GemRB_SetButtonOverlay__doc ); } @@ -1888,19 +1888,11 @@ Color src = { r1, g1, b1, a1 }; Color dest = { r2, g2, b2, a2 }; - double ratio = 0.0; - if (Max>0) { - if (Current>=Max) { - ratio = 1.0; - } else { - if (Current>0) { - ratio = (double) Current / Max; - } - } - } + if (Clipping<0.0) Clipping = 0.0; + else if (Clipping>1.0) Clipping = 1.0; //can't call clipping, because the change of ratio triggers color change - btn->SetHorizontalOverlay(ratio, src, dest); + btn->SetHorizontalOverlay(Clipping, src, dest); Py_INCREF( Py_None ); return Py_None; } @@ -2622,6 +2614,8 @@ return NULL; } + if (Clipping<0.0) Clipping = 0.0; + else if (Clipping>1.0) Clipping = 1.0; btn->SetPictureClipping( Clipping ); Py_INCREF( Py_None ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-05-28 14:51:51
|
Revision: 4674 http://gemrb.svn.sourceforge.net/gemrb/?rev=4674&view=rev Author: avenger_teambg Date: 2007-05-28 07:51:52 -0700 (Mon, 28 May 2007) Log Message: ----------- improved GetEquippedQuickSlot to be able to return raw quick weapon slot index not just inventory slot index Modified Paths: -------------- gemrb/trunk/gemrb/docs/en/GUIScript/GetEquippedQuickSlot.txt gemrb/trunk/gemrb/docs/en/GUIScript/SetButtonPictureClipping.txt gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp Modified: gemrb/trunk/gemrb/docs/en/GUIScript/GetEquippedQuickSlot.txt =================================================================== --- gemrb/trunk/gemrb/docs/en/GUIScript/GetEquippedQuickSlot.txt 2007-05-28 14:48:44 UTC (rev 4673) +++ gemrb/trunk/gemrb/docs/en/GUIScript/GetEquippedQuickSlot.txt 2007-05-28 14:51:52 UTC (rev 4674) @@ -1,10 +1,13 @@ -Prototype: GemRB.GetEquippedQuickSlot(PartyID) +Prototype: GemRB.GetEquippedQuickSlot(PartyID[, NoTrans]) -Description: Returns the equipped weapon quickslot. +Description: Returns the quickweapon slot index or the inventory slot. -Parameters: PartyID - the PC's position in the party (1 based) +Parameters: + PartyID - the PC's position in the party (1 based) + NoTrans - 0 - return the inventory slot + 1 - return the quickweapon slot index -Return value: Inventory slot. +Return value: numeric See also: SetEquippedQuickSlot, GetEquippedAmmunition Modified: gemrb/trunk/gemrb/docs/en/GUIScript/SetButtonPictureClipping.txt =================================================================== --- gemrb/trunk/gemrb/docs/en/GUIScript/SetButtonPictureClipping.txt 2007-05-28 14:48:44 UTC (rev 4673) +++ gemrb/trunk/gemrb/docs/en/GUIScript/SetButtonPictureClipping.txt 2007-05-28 14:51:52 UTC (rev 4674) @@ -1,13 +1,13 @@ -Prototype: GemRB.SetButtonPictureClipping(Window, Button, ClippingPercent) +Prototype: GemRB.SetButtonPictureClipping(Window, Button, ClippingRatio) -Description: Sets percent (0-1.0) of width to which button picture will be clipped. +Description: Sets percent (0-1.0) of width to which button picture will be clipped. This clipping cannot be used simultaneously with SetButtonOverlay. Parameters: Window, Button - the control's reference -ClippingPercent - a floating point value from the 0-1 interval +ClippingRatio - a floating point value from the 0-1 interval Return value: N/A -See also: SetButtonPicture +See also: SetButtonPicture, SetButtonOverlay Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-28 14:48:44 UTC (rev 4673) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-05-28 14:51:52 UTC (rev 4674) @@ -2897,7 +2897,7 @@ //who knows, there might have been an active animation lurking if (ctl->animation) { //if this control says the resource is the same - //we are just setting now don't reset it + //we wanted to set, we don't reset it if(ctl->animation->SameResource(ResRef, Cycle)) { Py_INCREF( Py_None ); return Py_None; @@ -7414,14 +7414,15 @@ } PyDoc_STRVAR( GemRB_GetEquippedQuickSlot__doc, -"GetEquippedQuickSlot(PartyID) => QSlot\n\n" -"returns the equipped weapon slot." ); +"GetEquippedQuickSlot(PartyID[, NoTrans]) => Slot\n\n" +"Returns the inventory slot (translation) or quick weapon index (no translation) of the equipped weapon." ); static PyObject* GemRB_GetEquippedQuickSlot(PyObject * /*self*/, PyObject* args) { int PartyID; + int NoTrans = 0; - if (!PyArg_ParseTuple( args, "i", &PartyID)) { + if (!PyArg_ParseTuple( args, "i|i", &PartyID, &NoTrans)) { return AttributeError( GemRB_GetEquippedQuickSlot__doc ); } @@ -7442,6 +7443,9 @@ if (actor->PCStats) { for(int i=0;i<4;i++) { if (ret == actor->PCStats->QuickWeaponSlots[i]) { + if (NoTrans) { + return PyInt_FromLong(i); + } ret = i+actor->inventory.GetWeaponSlot(); break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-06-09 19:27:59
|
Revision: 4690 http://gemrb.svn.sourceforge.net/gemrb/?rev=4690&view=rev Author: avenger_teambg Date: 2007-06-09 12:28:00 -0700 (Sat, 09 Jun 2007) Log Message: ----------- iwd2: implemented spellstate flags (CheckSpellState trigger) Modified Paths: -------------- gemrb/trunk/gemrb/includes/ie_stats.h gemrb/trunk/gemrb/plugins/Core/GameScript.cpp gemrb/trunk/gemrb/plugins/Core/GameScript.h gemrb/trunk/gemrb/plugins/Core/Triggers.cpp Modified: gemrb/trunk/gemrb/includes/ie_stats.h =================================================================== --- gemrb/trunk/gemrb/includes/ie_stats.h 2007-06-09 18:13:18 UTC (rev 4689) +++ gemrb/trunk/gemrb/includes/ie_stats.h 2007-06-09 19:28:00 UTC (rev 4690) @@ -429,8 +429,13 @@ #define IE_GENERAL 233 #define IE_EA 234 #define IE_SPECIFIC 235 +#define IE_SAVEDXPOS 236 +#define IE_SAVEDYPOS 237 +#define IE_SAVEDFACE 238 +#define IE_USERSTAT 239 //user defined stat //These are in IWD2, but in a different place -#define IE_LEVELBARBARIAN 240 //iwd2 class levels (fighter, mage, thief are already stored) +//core class levels (fighter, mage, thief are already stored) +#define IE_LEVELBARBARIAN 240 #define IE_LEVELBARD 241 #define IE_LEVELCLERIC 242 #define IE_LEVELDRUID 243 @@ -438,9 +443,15 @@ #define IE_LEVELPALADIN 245 #define IE_LEVELRANGER 246 #define IE_LEVELSORCEROR 247 -// place for more classes -#define IE_SAVEDXPOS 253 -#define IE_SAVEDYPOS 254 -#define IE_SAVEDFACE 255 +// place for 2 more classes +#define IE_LEVELCLASS12 248 +#define IE_LEVELCLASS13 249 +// these are iwd2 spell states, iwd2 uses ~180, we have place for 192 +#define IE_SPLSTATE_ID1 250 +#define IE_SPLSTATE_ID2 251 +#define IE_SPLSTATE_ID3 252 +#define IE_SPLSTATE_ID4 253 +#define IE_SPLSTATE_ID5 254 +#define IE_SPLSTATE_ID6 255 #endif // ! IE_STATS_H Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-06-09 18:13:18 UTC (rev 4689) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.cpp 2007-06-09 19:28:00 UTC (rev 4690) @@ -69,6 +69,7 @@ {"checkskill", GameScript::CheckSkill, 0}, {"checkskillgt", GameScript::CheckSkillGT, 0}, {"checkskilllt", GameScript::CheckSkillLT, 0}, + {"checkspellstate", GameScript::CheckSpellState, 0}, {"checkstat", GameScript::CheckStat, 0}, {"checkstatgt", GameScript::CheckStatGT, 0}, {"checkstatlt", GameScript::CheckStatLT, 0}, Modified: gemrb/trunk/gemrb/plugins/Core/GameScript.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-06-09 18:13:18 UTC (rev 4689) +++ gemrb/trunk/gemrb/plugins/Core/GameScript.h 2007-06-09 19:28:00 UTC (rev 4690) @@ -680,6 +680,7 @@ static int CheckSkill(Scriptable* Sender, Trigger* parameters); static int CheckSkillGT(Scriptable* Sender, Trigger* parameters); static int CheckSkillLT(Scriptable* Sender, Trigger* parameters); + static int CheckSpellState(Scriptable* Sender, Trigger* parameters); static int CheckStat(Scriptable* Sender, Trigger* parameters); static int CheckStatGT(Scriptable* Sender, Trigger* parameters); static int CheckStatLT(Scriptable* Sender, Trigger* parameters); Modified: gemrb/trunk/gemrb/plugins/Core/Triggers.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-06-09 18:13:18 UTC (rev 4689) +++ gemrb/trunk/gemrb/plugins/Core/Triggers.cpp 2007-06-09 19:28:00 UTC (rev 4690) @@ -2320,6 +2320,24 @@ return (signed) actor->GetStat(IE_MORALEBREAK) < parameters->int0Parameter; } +int GameScript::CheckSpellState(Scriptable* Sender, Trigger* parameters) +{ + Scriptable* tar = GetActorFromObject( Sender, parameters->objectParameter ); + if (!tar || tar->Type != ST_ACTOR) { + return 0; + } + Actor* actor = ( Actor* ) tar; + if (parameters->int0Parameter>255) { + return 0; + } + unsigned int position = parameters->int0Parameter>>5; + unsigned int bit = 1<<(parameters->int0Parameter&31); + if (actor->GetStat(IE_SPLSTATE_ID1+position) & bit) { + return 1; + } + return 0; +} + int GameScript::StateCheck(Scriptable* Sender, Trigger* parameters) { Scriptable* tar = GetActorFromObject( Sender, parameters->objectParameter ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-06-15 21:34:23
|
Revision: 4698 http://gemrb.svn.sourceforge.net/gemrb/?rev=4698&view=rev Author: avenger_teambg Date: 2007-06-15 14:34:23 -0700 (Fri, 15 Jun 2007) Log Message: ----------- more consts more iwd2 effects Modified Paths: -------------- gemrb/trunk/gemrb/docs/en/GUIScript/RemoveSpell.txt gemrb/trunk/gemrb/override/iwd2/effects.ids gemrb/trunk/gemrb/plugins/Core/Actions.cpp gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Button.cpp gemrb/trunk/gemrb/plugins/Core/Button.h gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp gemrb/trunk/gemrb/plugins/Core/CharAnimations.h gemrb/trunk/gemrb/plugins/Core/Control.cpp gemrb/trunk/gemrb/plugins/Core/Control.h gemrb/trunk/gemrb/plugins/Core/Core.cpp gemrb/trunk/gemrb/plugins/Core/EffectQueue.h gemrb/trunk/gemrb/plugins/Core/Palette.cpp gemrb/trunk/gemrb/plugins/Core/Palette.h gemrb/trunk/gemrb/plugins/Core/Projectile.cpp gemrb/trunk/gemrb/plugins/Core/Projectile.h gemrb/trunk/gemrb/plugins/Core/Slider.cpp gemrb/trunk/gemrb/plugins/Core/Slider.h gemrb/trunk/gemrb/plugins/Core/TextArea.cpp gemrb/trunk/gemrb/plugins/Core/TextArea.h gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp Added Paths: ----------- gemrb/trunk/gemrb/override/iwd2/efftext.2da Modified: gemrb/trunk/gemrb/docs/en/GUIScript/RemoveSpell.txt =================================================================== --- gemrb/trunk/gemrb/docs/en/GUIScript/RemoveSpell.txt 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/docs/en/GUIScript/RemoveSpell.txt 2007-06-15 21:34:23 UTC (rev 4698) @@ -13,4 +13,4 @@ See also: UnmemorizeSpell, GetKnownSpellsCount, GetKnownSpell, LearnSpell -MD5: 09f911029d74e35bd84156c5635688c0 +MD5: 455fe10422ca29c4933f95052b792ab2 Modified: gemrb/trunk/gemrb/override/iwd2/effects.ids =================================================================== --- gemrb/trunk/gemrb/override/iwd2/effects.ids 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/override/iwd2/effects.ids 2007-06-15 21:34:23 UTC (rev 4698) @@ -1,5 +1,5 @@ IDS -0x0 ACVsDamageTypeModifier +0x0 ACVsDamageTypeModifierIWD2 0x1 AttacksPerRoundModifier 0x2 Cure:Sleep 0x3 State:Berserk @@ -326,7 +326,7 @@ 425 ControlUndead2 426 Aegis 427 ExecutionerEyes -428 Banish +428 Unsummon 429 EffectsOnStruck 430 EffectsOnProjectile 431 EnergyDrain @@ -337,9 +337,9 @@ 436 DamageReduction 437 Disguise 438 HeroicInspiration -439 PreventAISlowdown +439 OffscreenAIModifier 440 BarbarianRage -441 Slow +441 MovementRateModifier4 443 ProtectionFromArrows 444 TensersTransformation 446 SmiteEvil Added: gemrb/trunk/gemrb/override/iwd2/efftext.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/efftext.2da (rev 0) +++ gemrb/trunk/gemrb/override/iwd2/efftext.2da 2007-06-15 21:34:23 UTC (rev 4698) @@ -0,0 +1,12 @@ +2DA V1.0 +-1 + EFFECT_NAME STRREF +13 DEATH 14026 +12 DAMAGE 14027 +68 UNSUMMON 14065 +401 PROTFROMEVIL 14769 +414 RESILIENT 4732 +415 BARKSKIN 14785 +419 UNCONSCIOUS 20438 +421 ENTROPYSHIELD 8104 +423 PROTFROMELEM 8842 Property changes on: gemrb/trunk/gemrb/override/iwd2/efftext.2da ___________________________________________________________________ Name: svn:eol-style + native Modified: gemrb/trunk/gemrb/plugins/Core/Actions.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Actions.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -243,8 +243,7 @@ void GameScript::SetNamelessDisguise(Scriptable* Sender, Action* parameters) { SetVariable(Sender, "APPEARANCE", "GLOBAL", parameters->int0Parameter); - core->SetEventFlag(EF_UPDATEANIM); - //core->GetGUIScriptEngine()->RunFunction("UpdateAnimation"); + core->SetEventFlag(EF_UPDATEANIM); } void GameScript::ChangeSpecifics(Scriptable* Sender, Action* parameters) Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -548,7 +548,7 @@ actor->SetAnimationID(Value); } -static void SetLockedPalette(Actor *actor, ieDword *gradients) +static void SetLockedPalette(Actor *actor, const ieDword *gradients) { CharAnimations *anims = actor->GetAnims(); if (!anims) return; //cannot apply it (yet) @@ -564,9 +564,9 @@ } } -ieDword fullwhite[7]={ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT}; +static const ieDword fullwhite[7]={ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT}; -ieDword fullstone[7]={STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT}; +static const ieDword fullstone[7]={STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT}; void pcf_state(Actor *actor, ieDword Value) { Modified: gemrb/trunk/gemrb/plugins/Core/Button.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Button.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Button.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -509,7 +509,7 @@ } /** Set Event Handler */ -bool Button::SetEvent(int eventType, EventHandler handler) +bool Button::SetEvent(int eventType, const char *handler) { Changed = true; Modified: gemrb/trunk/gemrb/plugins/Core/Button.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Button.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Button.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -166,7 +166,7 @@ /** A special key has been pressed */ void OnSpecialKeyPress(unsigned char Key); /** Set handler for specified event */ - bool SetEvent(int eventType, EventHandler handler); + bool SetEvent(int eventType, const char *handler); /** Button Pressed Event Script Function Name */ EventHandler ButtonOnPress; EventHandler ButtonOnShiftPress; Modified: gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -212,7 +212,7 @@ core->FreePalette(modifiedPalette[PAL_OFFHAND], 0); } -void CharAnimations::LockPalette(ieDword *gradients) +void CharAnimations::LockPalette(const ieDword *gradients) { if (lockPalette) return; //cannot lock colors for PST animations @@ -228,7 +228,7 @@ } } -void CharAnimations::SetColors(ieDword *arg) +void CharAnimations::SetColors(const ieDword *arg) { Colors = arg; SetupColors(PAL_MAIN); Modified: gemrb/trunk/gemrb/plugins/Core/CharAnimations.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/CharAnimations.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/CharAnimations.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -127,7 +127,7 @@ char WeaponRef[2]; char OffhandRef[2]; public: - ieDword *Colors; //these are the custom color indices + const ieDword *Colors; //these are the custom color indices RGBModifier ColorMods[32]; // color modification effects unsigned long lastModUpdate; RGBModifier GlobalColorMod; // global color modification effect @@ -151,8 +151,8 @@ void SetWeaponRef(const char* ref); void SetOffhandRef(const char* ref); void SetupColors(PaletteType type); - void SetColors(ieDword *Colors); - void LockPalette(ieDword *Colors); + void SetColors(const ieDword *Colors); + void LockPalette(const ieDword *Colors); // returns an array of animations of size GetTotalPartCount() Animation** GetAnimation(unsigned char Stance, unsigned char Orient); Modified: gemrb/trunk/gemrb/plugins/Core/Control.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Control.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Control.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -96,7 +96,7 @@ strncpy( handler, funcName, sizeof( EventHandler ) ); } -bool Control::SetEvent(int /*eventType*/, EventHandler /*handler*/) +bool Control::SetEvent(int /*eventType*/, const char * /*handler*/) { return false; } @@ -104,7 +104,7 @@ int Control::RunEventHandler(EventHandler handler) { if (InHandler) { - printf("[Control] Nested event handlers are not supported!"); + printMessage("Control","Nested event handlers are not supported!", YELLOW); return -1; } if (handler[0]) { Modified: gemrb/trunk/gemrb/plugins/Core/Control.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Control.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Control.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -133,13 +133,13 @@ /** Reset/init event handler */ void ResetEventHandler(EventHandler handler); /** Set handler from function name */ - void SetEventHandler(EventHandler handler, const char* funcName); + void SetEventHandler(EventHandler handler, const char *funcName); /** Returns the Owner */ Window *GetOwner() const { return Owner; } /** Set the Flags */ int SetFlags(int arg_flags, int opcode); /** Set handler for specified event. Override in child classes */ - virtual bool SetEvent(int eventType, EventHandler handler); + virtual bool SetEvent(int eventType, const char *handler); /** Run specified handler, it may return error code */ int RunEventHandler(EventHandler handler); /** Key Press Event */ Modified: gemrb/trunk/gemrb/plugins/Core/Core.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Core.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Core.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -99,7 +99,7 @@ } } -static unsigned char orientations[25]={ +static const unsigned char orientations[25]={ 6,7,8,9,10, 5,6,8,10,11, 4,4,0,12,12, Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -169,8 +169,11 @@ void ApplyAllEffects(Actor* target); /* returns true if the process should abort applying a stack of effects */ int ApplyEffect(Actor* target, Effect* fx, bool first_apply); + /* directly removes effects with specified opcode, use effect_reference when you can */ void RemoveAllEffects(ieDword opcode); + void RemoveAllEffectsWithResource(ieDword opcode, const ieResRef resource); + /* removes all effects of a given spell */ void RemoveAllEffects(ieResRef Removed); void RemoveAllEffects(ieResRef Removed, ieDword timing); @@ -183,6 +186,7 @@ void RemoveAllEffectsWithParam(EffectRef &effect_reference, ieDword param2); void RemoveAllEffectsWithResource(EffectRef &effect_reference, const ieResRef resource); void RemoveLevelEffects(ieDword level, ieDword flags, ieDword match); + Effect *GetEffect(ieDword idx) const; /* returns true if the timing method supports simplified duration */ static bool HasDuration(Effect *fx); @@ -219,7 +223,6 @@ private: //use the effect reference style calls from outside static Effect *CreateEffect(ieDword opcode, ieDword param1, ieDword param2, ieDword timing); - void RemoveAllEffectsWithResource(ieDword opcode, const ieResRef resource); void RemoveAllEffectsWithParam(ieDword opcode, ieDword param2); Effect *HasOpcode(ieDword opcode) const; Effect *HasOpcodeWithParam(ieDword opcode, ieDword param2) const; Modified: gemrb/trunk/gemrb/plugins/Core/Palette.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Palette.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Palette.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -54,7 +54,7 @@ return pal; } -void Palette::SetupPaperdollColours(ieDword* Colors, unsigned int type) +void Palette::SetupPaperdollColours(const ieDword* Colors, unsigned int type) { unsigned int s = 8*type; //metal Modified: gemrb/trunk/gemrb/plugins/Core/Palette.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Palette.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Palette.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -96,7 +96,7 @@ void CreateShadedAlphaChannel(); - void SetupPaperdollColours(ieDword* Colors, unsigned int type); + void SetupPaperdollColours(const ieDword* Colors, unsigned int type); void SetupRGBModification(const Palette* src, const RGBModifier* mods, unsigned int type); void SetupGlobalRGBModification(const Palette* src, Modified: gemrb/trunk/gemrb/plugins/Core/Projectile.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Projectile.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Projectile.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -128,7 +128,7 @@ } //apply gradient colors -void Projectile::SetupPalette(Animation *anim[], Palette *&pal, ieByte *gradients) +void Projectile::SetupPalette(Animation *anim[], Palette *&pal, const ieByte *gradients) { ieDword Colors[7]; Modified: gemrb/trunk/gemrb/plugins/Core/Projectile.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Projectile.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Projectile.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -231,7 +231,7 @@ int GetShadowPos(int face); void SetPos(int face, int frame1, int frame2); void NextTarget(Point &p); - void SetupPalette(Animation *anim[], Palette *&pal, ieByte *gradients); + void SetupPalette(Animation *anim[], Palette *&pal, const ieByte *gradients); }; #endif // PROJECTILE_H Modified: gemrb/trunk/gemrb/plugins/Core/Slider.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Slider.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Slider.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -272,7 +272,7 @@ return 0; } -bool Slider::SetEvent(int eventType, EventHandler handler) +bool Slider::SetEvent(int eventType, const char *handler) { Changed = true; Modified: gemrb/trunk/gemrb/plugins/Core/Slider.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Slider.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/Slider.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -107,7 +107,7 @@ /** Mouse Over Event */ void OnMouseOver(unsigned short x, unsigned short y); /** Set handler for specified event */ - bool SetEvent(int eventType, EventHandler handler); + bool SetEvent(int eventType, const char *handler); /** OnChange Scripted Event Function Name */ EventHandler SliderOnChange; }; Modified: gemrb/trunk/gemrb/plugins/Core/TextArea.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/TextArea.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/TextArea.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -663,7 +663,7 @@ return ( const char *) ""; } -bool TextArea::SetEvent(int eventType, EventHandler handler) +bool TextArea::SetEvent(int eventType, const char *handler) { Changed = true; Modified: gemrb/trunk/gemrb/plugins/Core/TextArea.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/TextArea.h 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/Core/TextArea.h 2007-06-15 21:34:23 UTC (rev 4698) @@ -158,7 +158,7 @@ void OnMouseUp(unsigned short x, unsigned short y, unsigned char Button, unsigned short Mod); /** Set handler for specified event */ - bool SetEvent(int eventType, EventHandler handler); + bool SetEvent(int eventType, const char *handler); /** OnChange Scripted Event Function Name */ EventHandler TextAreaOnChange; /** OutOfText Scripted Event Function Name */ Modified: gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/GUIScript/GUIScript.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -129,7 +129,7 @@ } // Like PyString_FromString(), but for ResRef -inline PyObject* PyString_FromAnimID(char* AnimID) +inline PyObject* PyString_FromAnimID(const char* AnimID) { unsigned int i; @@ -212,7 +212,7 @@ core->SetTooltip((ieWord) WindowIndex, (ieWord) ControlIndex, ""); } -void ReadItemSounds() +static void ReadItemSounds() { int table = core->LoadTable( "itemsnd" ); if (table<0) { @@ -1693,7 +1693,7 @@ static PyObject* GemRB_CreateLabel(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlID, x, y, w, h, align; - char* font, * text; + char *font, *text; if (!PyArg_ParseTuple( args, "iiiiiissi", &WindowIndex, &ControlID, &x, &y, &w, &h, &font, &text, &align )) { @@ -1752,7 +1752,7 @@ static PyObject* GemRB_CreateTextEdit(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlID, x, y, w, h; - char* font, * text; + char *font, *text; if (!PyArg_ParseTuple( args, "iiiiiiss", &WindowIndex, &ControlID, &x, &y, &w, &h, &font, &text )) { @@ -1826,7 +1826,7 @@ { int WindowIndex, ControlIndex, cycle, unpressed, pressed, selected, disabled; - char* ResRef; + char *ResRef; if (!PyArg_ParseTuple( args, "iisiiiii", &WindowIndex, &ControlIndex, &ResRef, &cycle, &unpressed, &pressed, &selected, &disabled )) { @@ -1954,7 +1954,7 @@ static PyObject* GemRB_SetButtonFont(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlIndex; - char* FontResRef; + char *FontResRef; if (!PyArg_ParseTuple( args, "iis", &WindowIndex, &ControlIndex, &FontResRef)) { @@ -2131,7 +2131,7 @@ static PyObject* GemRB_CreateWorldMapControl(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlID, x, y, w, h, direction; - char *font=""; + char *font=NULL; if (!PyArg_ParseTuple( args, "iiiiiii|s", &WindowIndex, &ControlID, &x, &y, &w, &h, &direction, &font )) { @@ -2152,7 +2152,7 @@ //flags = ctrl->Value; win->DelControl( CtrlIndex ); } - WorldMapControl* wmap = new WorldMapControl( font, direction ); + WorldMapControl* wmap = new WorldMapControl( font?font:"", direction ); wmap->XPos = x; wmap->YPos = y; wmap->Width = w; @@ -2630,8 +2630,8 @@ static PyObject* GemRB_SetButtonPicture(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlIndex; - char* ResRef; - char* DefResRef = NULL; + char *ResRef; + char *DefResRef = NULL; if (!PyArg_ParseTuple( args, "iis|s", &WindowIndex, &ControlIndex, &ResRef, &DefResRef )) { return AttributeError( GemRB_SetButtonPicture__doc ); @@ -2670,7 +2670,7 @@ static PyObject* GemRB_SetButtonMOS(PyObject * /*self*/, PyObject* args) { int WindowIndex, ControlIndex; - char* ResRef; + char *ResRef; if (!PyArg_ParseTuple( args, "iis", &WindowIndex, &ControlIndex, &ResRef )) { return AttributeError( GemRB_SetButtonMOS__doc ); @@ -2726,7 +2726,7 @@ int WindowIndex, ControlIndex; ieDword col[8]; int type = 0; - char* ResRef; + char *ResRef; memset(col,-1,sizeof(col)); if (!PyArg_ParseTuple( args, "iis|iiiiiiiii", &WindowIndex, &ControlIndex, @@ -2861,7 +2861,7 @@ static PyObject* GemRB_SetButtonBAM(PyObject * /*self*/, PyObject* args) { int wi, ci, CycleIndex, FrameIndex, col1 = -1; - char* ResRef; + char *ResRef; if (!PyArg_ParseTuple( args, "iisii|i", &wi, &ci, &ResRef, &CycleIndex, &FrameIndex, &col1 )) { @@ -2882,7 +2882,7 @@ static PyObject* GemRB_SetAnimation(PyObject * /*self*/, PyObject* args) { int wi, ci; - char* ResRef; + char *ResRef; int Cycle = 0; if (!PyArg_ParseTuple( args, "iis|i", &wi, &ci, &ResRef, &Cycle )) { @@ -2927,7 +2927,7 @@ static PyObject* GemRB_PlaySound(PyObject * /*self*/, PyObject* args) { - char* ResRef; + char *ResRef; if (!PyArg_ParseTuple( args, "s", &ResRef )) { return AttributeError( GemRB_PlaySound__doc ); @@ -2975,7 +2975,7 @@ static PyObject* GemRB_LoadMusicPL(PyObject * /*self*/, PyObject* args) { - char* ResRef; + char *ResRef; int HardEnd = 0; if (!PyArg_ParseTuple( args, "s|i", &ResRef, &HardEnd )) { @@ -3018,8 +3018,8 @@ static PyObject* GemRB_SetToken(PyObject * /*self*/, PyObject* args) { - char* Variable; - char* value; + char *Variable; + char *value; if (!PyArg_ParseTuple( args, "ss", &Variable, &value )) { return AttributeError( GemRB_SetToken__doc ); @@ -3036,7 +3036,7 @@ static PyObject* GemRB_SetVar(PyObject * /*self*/, PyObject* args) { - char* Variable; + char *Variable; //this should be 32 bits, always, but i cannot tell that to Python unsigned long value; @@ -3069,8 +3069,8 @@ static PyObject* GemRB_GetToken(PyObject * /*self*/, PyObject* args) { - char* Variable; - char* value; + char *Variable; + char *value; if (!PyArg_ParseTuple( args, "s", &Variable )) { return AttributeError( GemRB_GetToken__doc ); @@ -3090,7 +3090,7 @@ static PyObject* GemRB_GetVar(PyObject * /*self*/, PyObject* args) { - char* Variable; + char *Variable; ieDword value; if (!PyArg_ParseTuple( args, "s", &Variable )) { @@ -3113,8 +3113,8 @@ static PyObject* GemRB_CheckVar(PyObject * /*self*/, PyObject* args) { - char* Variable; - char* Context; + char *Variable; + char *Context; if (!PyArg_ParseTuple( args, "ss", &Variable, &Context )) { return AttributeError( GemRB_CheckVar__doc ); @@ -3144,8 +3144,8 @@ static PyObject* GemRB_SetGlobal(PyObject * /*self*/, PyObject* args) { - char* Variable; - char* Context; + char *Variable; + char *Context; int Value; if (!PyArg_ParseTuple( args, "ssi", &Variable, &Context, &Value )) { @@ -3174,7 +3174,7 @@ static PyObject* GemRB_GetGameVar(PyObject * /*self*/, PyObject* args) { - char* Variable; + char *Variable; ieDword value; if (!PyArg_ParseTuple( args, "s", &Variable )) { @@ -3194,7 +3194,7 @@ static PyObject* GemRB_PlayMovie(PyObject * /*self*/, PyObject* args) { - char* string; + char *string; int flag = 0; if (!PyArg_ParseTuple( args, "s|i", &string, &flag )) { @@ -3854,7 +3854,8 @@ static PyObject* GemRB_GetINIQuestsKey(PyObject * /*self*/, PyObject* args) { - char* Tag, * Key, * Default; + char *Tag, *Key, *Default; + if (!PyArg_ParseTuple( args, "sss", &Tag, &Key, &Default )) { return AttributeError( GemRB_GetINIQuestsKey__doc ); } @@ -3871,7 +3872,8 @@ static PyObject* GemRB_GetINIBeastsKey(PyObject * /*self*/, PyObject* args) { - char* Tag, * Key, * Default; + char *Tag, *Key, *Default; + if (!PyArg_ParseTuple( args, "sss", &Tag, &Key, &Default )) { return AttributeError( GemRB_GetINIBeastsKey__doc ); } @@ -3888,7 +3890,8 @@ static PyObject* GemRB_GetINIPartyKey(PyObject * /*self*/, PyObject* args) { - char* Tag, * Key, * Default; + char *Tag, *Key, *Default; + if (!PyArg_ParseTuple( args, "sss", &Tag, &Key, &Default )) { return AttributeError( GemRB_GetINIPartyKey__doc ); } @@ -3905,7 +3908,7 @@ static PyObject* GemRB_CreatePlayer(PyObject * /*self*/, PyObject* args) { - char* CreResRef; + char *CreResRef; int PlayerSlot, Slot; int Import=0; @@ -4434,7 +4437,7 @@ return NULL; } - if (! SpellResRef[0]) { + if (!SpellResRef[0]) { btn->SetPicture( NULL ); //no incref here! return Py_None; @@ -4484,7 +4487,7 @@ static PyObject* GemRB_SetSpellIcon(PyObject * /*self*/, PyObject* args) { int wi, ci; - char* SpellResRef; + char *SpellResRef; int type=0; int tooltip=0; int Function=0; @@ -4539,64 +4542,65 @@ return NULL; } - if (ItemResRef[0]) { - Item* item = core->GetItem(ItemResRef); - if (item == NULL) { - btn->SetPicture(NULL); - //no incref here! - return Py_None; + if (!ItemResRef[0]) { + btn->SetPicture( NULL ); + //no incref here! + return Py_None; + } + Item* item = core->GetItem(ItemResRef); + if (item == NULL) { + btn->SetPicture(NULL); + //no incref here! + return Py_None; + } + + btn->SetFlags( IE_GUI_BUTTON_PICTURE, BM_OR ); + Sprite2D* Picture; + bool setpicture = true; + int i; + switch (Which) { + case 0: case 1: + Picture = core->GetBAMSprite(item->ItemIcon, -1, Which); + break; + case 2: + btn->SetPicture( NULL ); // also calls ClearPictureList + for (i=0;i<4;i++) { + Picture = core->GetBAMSprite(item->DescriptionIcon, -1, i); + if (Picture) + btn->StackPicture(Picture); } - - btn->SetFlags( IE_GUI_BUTTON_PICTURE, BM_OR ); - Sprite2D* Picture; - bool setpicture = true; - int i; - switch (Which) { - case 0: case 1: - Picture = core->GetBAMSprite(item->ItemIcon, -1, Which); - break; - case 2: + setpicture = false; + Picture = NULL; + break; + case 4: case 5: + Picture = GetUsedWeaponIcon(item, Which-4); + if (Item2ResRef) { btn->SetPicture( NULL ); // also calls ClearPictureList - for (i=0;i<4;i++) { - Picture = core->GetBAMSprite(item->DescriptionIcon, -1, i); - if (Picture) - btn->StackPicture(Picture); + Item* item2 = core->GetItem(Item2ResRef); + if (item2) { + Sprite2D* Picture2; + Picture2 = core->GetBAMSprite(item2->ItemIcon, -1, Which-4); + if (Picture2) btn->StackPicture(Picture2); + core->FreeItem( item2, Item2ResRef, false ); } + if (Picture) btn->StackPicture(Picture); setpicture = false; - Picture = NULL; - break; - case 4: case 5: - Picture = GetUsedWeaponIcon(item, Which-4); - if (Item2ResRef) { - btn->SetPicture( NULL ); // also calls ClearPictureList - Item* item2 = core->GetItem(Item2ResRef); - if (item2) { - Sprite2D* Picture2; - Picture2 = core->GetBAMSprite(item2->ItemIcon, -1, Which-4); - if (Picture2) btn->StackPicture(Picture2); - core->FreeItem( item2, Item2ResRef, false ); - } - if (Picture) btn->StackPicture(Picture); - setpicture = false; - } - break; - default: - Picture = NULL; } - - if (setpicture) - btn->SetPicture( Picture ); - if (tooltip) { - //later getitemname could also return tooltip stuff - char *str = core->GetString(item->GetItemName(tooltip==2),0); - //this will free str, no need of freeing it - SetFunctionTooltip(wi, ci, str, Function); - } - - core->FreeItem( item, ItemResRef, false ); - } else { - btn->SetPicture( NULL ); + break; + default: + Picture = NULL; } + + if (setpicture) + btn->SetPicture( Picture ); + if (tooltip) { + //later getitemname could also return tooltip stuff + char *str = core->GetString(item->GetItemName(tooltip==2),0); + //this will free str, no need of freeing it + SetFunctionTooltip(wi, ci, str, Function); + } + + core->FreeItem( item, ItemResRef, false ); //no incref here! return Py_None; } @@ -4604,11 +4608,11 @@ static PyObject* GemRB_SetItemIcon(PyObject * /*self*/, PyObject* args) { int wi, ci; - char* ItemResRef; + char *ItemResRef; int Which = 0; int tooltip = 0; int Function = 0; - const char* Item2ResRef = 0; + const char *Item2ResRef = NULL; if (!PyArg_ParseTuple( args, "iis|iiis", &wi, &ci, &ItemResRef, &Which, &tooltip, &Function, &Item2ResRef )) { return AttributeError( GemRB_SetItemIcon__doc ); @@ -6936,7 +6940,7 @@ for (i=0;i<GUIBT_COUNT-(more?1:0);i++) { int ci = core->GetControl(wi, i+(Start?1:0) ); Button* btn = (Button *) GetControl( wi, ci, IE_GUI_BUTTON ); - btn->SetEvent(IE_GUI_BUTTON_ON_PRESS,"EquipmentPressed"); + btn->SetEvent(IE_GUI_BUTTON_ON_PRESS, "EquipmentPressed"); strcpy(btn->VarName,"Equipment"); btn->Value = Start+i; Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-15 00:17:56 UTC (rev 4697) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-15 21:34:23 UTC (rev 4698) @@ -33,17 +33,25 @@ static int shcount = -1; #define PI_PROTFROMEVIL 9 -#define PI_FREEACTION 19 -#define PI_NAUSEA 43 +#define PI_FREEACTION 19 +#define PI_BARKSKIN 20 +#define PI_NAUSEA 43 #define PI_HOPELESSNESS 47 -#define PI_RIGHTEOUS 67 -#define PI_FAITHARMOR 84 -#define PI_HOLYPOWER 86 -#define PI_DEATHWARD 87 +#define PI_RIGHTEOUS 67 +#define PI_FAITHARMOR 84 +#define PI_HOLYPOWER 86 +#define PI_DEATHWARD 87 +#define PI_UNCONSCIOUS 88 #define PI_ENFEEBLEMENT 90 -#define PI_FIRESHIELD 121 -#define PI_ICESHIELD 122 +#define PI_ELEMPROT 93 +#define PI_ENTROPY 103 +#define PI_STORMSHELL 105 +#define PI_AEGIS 119 +#define PI_EXECUTIONER 120 +#define PI_FIRESHIELD 121 +#define PI_ICESHIELD 122 + #define SS_HOPELESSNESS 0 #define SS_PROTFROMEVIL 1 #define SS_ARMOROFFAITH 2 @@ -65,7 +73,52 @@ #define SS_STONESKIN 18 #define SS_IRONSKIN 19 #define SS_SANCTUARY 20 +#define SS_RESILIENT 21 +#define SS_BLESS 22 +#define SS_AID 23 +#define SS_BARKSKIN 24 +#define SS_HOLYMIGHT 25 +#define SS_ENTANGLE 26 +#define SS_WEB 27 +#define SS_GREASE 28 +#define SS_FREEACTION 29 +#define SS_ENTROPY 30 +#define SS_STORMSHELL 31 +#define SS_ELEMPROT 32 +#define SS_BERSERK 33 +#define SS_BLOODRAGE 34 +#define SS_NOHPINFO 35 +#define SS_NOAWAKE 36 +#define SS_AWAKE 37 +#define SS_DEAF 38 +#define SS_ANIMALRAGE 39 +#define SS_NOBACKSTAB 40 +#define SS_CHAOTICCMD 41 +#define SS_MISCAST 42 +#define SS_PAIN 43 +#define SS_MALISON 44 +//#define SS_CATSGRACE 45 //used explicitly +#define SS_MOLDTOUCH 46 +#define SS_FLAMESHROUD 47 +#define SS_EYEMIND 48 +#define SS_EYESWORD 49 +#define SS_EYEMAGE 50 +#define SS_EYEVENOM 51 +#define SS_EYESPIRIT 52 +#define SS_EYEFORTITUDE 53 +#define SS_EYESTONE 54 +#define SS_AEGIS 55 +#define SS_EXECUTIONER 56 +#define SS_ENERGYDRAIN 57 +#define SS_TORTOISE 58 +#define SS_BLINK 59 +#define SS_MINORGLOBE 60 +#define SS_PROTFROMMISS 61 +#define SS_GHOSTARMOR 62 +#define SS_REFLECTION 63 +#define SS_KAI 64 +static int fx_ac_vs_damage_type_modifier_iwd2 (Actor* Owner, Actor* target, Effect* fx);//0 static int fx_fade_rgb (Actor* Owner, Actor* target, Effect* fx);//e8 static int fx_iwd_visual_spell_hit (Actor* Owner, Actor* target, Effect* fx);//e9 static int fx_cold_damage (Actor* Owner, Actor* target, Effect* fx);//ea @@ -142,17 +195,30 @@ //iwd2 specific effects static int fx_hopelessness (Actor* Owner, Actor* target, Effect* fx);//400 static int fx_protection_from_evil (Actor* Owner, Actor* target, Effect* fx);//401 +static int fx_armor_of_faith (Actor* Owner, Actor* target, Effect* fx);//403 static int fx_nausea (Actor* Owner, Actor* target, Effect* fx); //404 static int fx_enfeeblement (Actor* Owner, Actor* target, Effect* fx); //405 static int fx_fireshield (Actor* Owner, Actor* target, Effect* fx); //406 static int fx_death_ward (Actor* Owner, Actor* target, Effect* fx); //407 static int fx_holy_power (Actor* Owner, Actor* target, Effect* fx); //408 static int fx_righteous_wrath (Actor* Owner, Actor* target, Effect* fx); //409 +static int fx_control (Actor* Owner, Actor* target, Effect* fx); //412 +static int fx_visual_effect_iwd2 (Actor* Owner, Actor* target, Effect* fx); //413 +static int fx_resilient_sphere (Actor* Owner, Actor* target, Effect* fx); //414 +static int fx_barkskin (Actor* Owner, Actor* target, Effect* fx); //415 static int fx_free_action_iwd2 (Actor* Owner, Actor* target, Effect* fx); //418 -static int fx_prevent_ai_slowdown (Actor* Owner, Actor* target, Effect* fx); //439 +static int fx_unconsciousness (Actor* Owner, Actor* target, Effect* fx); //419 +static int fx_entropy_shield (Actor* Owner, Actor* target, Effect* fx); //421 +static int fx_storm_shell (Actor* Owner, Actor* target, Effect* fx); //422 +static int fx_protection_from_elements (Actor* Owner, Actor* target, Effect* fx); //423 +static int fx_aegis (Actor* Owner, Actor* target, Effect* fx); //426 +static int fx_executioner_eyes (Actor* Owner, Actor* target, Effect* fx); //427 +//static int fx_prevent_ai_slowdown (Actor* Owner, Actor* target, Effect* fx); //439 + //No need to make these ordered, they will be ordered by EffectQueue static EffectRef effectnames[] = { + { "ACVsDamageTypeModifierIWD2", fx_ac_vs_damage_type_modifier_iwd2, 0}, //0 { "Color:FadeRGB", fx_fade_rgb, 0}, //e8 { "IWDVisualSpellHit", fx_iwd_visual_spell_hit, 0}, //e9 { "ColdDamage", fx_cold_damage, 0}, //ea @@ -212,15 +278,27 @@ //iwd2 effects { "Hopelessness", fx_hopelessness, 0}, //400 { "ProtectionFromEvil", fx_protection_from_evil, 0}, //401 + { "ArmorOfFaith", fx_armor_of_faith, 0}, //403 { "Nausea", fx_nausea, 0}, //404 { "Enfeeblement", fx_enfeeblement, 0}, //405 { "FireShield", fx_fireshield, 0}, //406 { "DeathWard", fx_death_ward, 0}, //407 { "HolyPower", fx_holy_power, 0}, //408 { "RighteousWrath", fx_righteous_wrath, 0}, //409 + { "Control2", fx_control, 0}, //412 + { "VisualEffectIWD2", fx_visual_effect_iwd2, 0}, //413 + { "ResilientSphere", fx_resilient_sphere, 0}, //414 + { "BarkSkin", fx_barkskin, 0}, //415 { "FreeAction2", fx_free_action_iwd2, 0}, //418 + { "Unconsciousness", fx_unconsciousness, 0}, //419 + { "EntropyShield", fx_entropy_shield, 0}, //421 + { "StormShell", fx_storm_shell, 0}, //422 + { "ProtectionFromElements", fx_protection_from_elements, 0}, //423 { "ControlUndead2", fx_control_undead, 0}, //425 - { "PreventAISlowDown", fx_prevent_ai_slowdown, 0}, //439 + { "Aegis", fx_aegis, 0}, //426 + { "ExecutionerEyes", fx_executioner_eyes, 0}, //427 + + //{ "PreventAISlowDown", fx_prevent_ai_slowdown, 0}, //439 same as bg2 { NULL, NULL, 0 }, }; @@ -394,6 +472,71 @@ delete newfx; } +static inline void HandleBonus(Actor *target, int stat, int mod, int mode) +{ + if (mode==FX_DURATION_INSTANT_PERMANENT) { + if (target->IsReverseToHit()) { + BASE_SUB( stat, mod ); + } else { + BASE_ADD( stat, mod ); + } + return; + } + if (target->IsReverseToHit()) { + STAT_SUB( stat, mod ); + } else { + STAT_ADD( stat, mod ); + } +} + +// fx_ac_vs_damage_type_modifier_iwd2 +int fx_ac_vs_damage_type_modifier_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_ac_vs_damage_type_modifier_iwd2 (%2d): AC Modif: %d ; Type: %d ; MinLevel: %d ; MaxLevel: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2, (int) fx->DiceSides, (int) fx->DiceThrown ); + //check level was pulled outside as a common functionality + //CHECK_LEVEL(); + + // it is a bitmask + int type = fx->Parameter2; + //the original engine did work with the combination of these bits + //but since it crashed, we are not bound to the same rules + switch(type) + { + case 0: //generic + HandleBonus(target, IE_ARMORCLASS, fx->Parameter1, fx->TimingMode); + break; + case 1: //armor + if (fx->TimingMode==FX_DURATION_INSTANT_PERMANENT) { + if (BASE_GET( IE_ARMORCLASS) > fx->Parameter1) { + BASE_SET( IE_ARMORCLASS, fx->Parameter1 ); + } + } else { + if (STAT_GET( IE_ARMORCLASS) > fx->Parameter1) { + STAT_SET( IE_ARMORCLASS, fx->Parameter1 ); + } + } + return FX_INSERT; + case 2: //deflection + break; + case 3: //shield + break; + case 4: + HandleBonus(target, IE_ACCRUSHINGMOD, fx->Parameter1, fx->TimingMode); + break; + case 5: + HandleBonus(target, IE_ACPIERCINGMOD, fx->Parameter1, fx->TimingMode); + break; + case 6: + HandleBonus(target, IE_ACSLASHINGMOD, fx->Parameter1, fx->TimingMode); + break; + case 7: + HandleBonus(target, IE_ACMISSILEMOD, fx->Parameter1, fx->TimingMode); + break; + } + + return FX_PERMANENT; +} + // 0xe8 Colour:FadeRGB int fx_fade_rgb (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -917,6 +1060,7 @@ int fx_eye_of_the_mind (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_mind (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYEMIND)) return FX_APPLIED; target->add_animation("eyemind",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_MIND); return FX_APPLIED; @@ -925,6 +1069,7 @@ int fx_eye_of_the_sword (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_sword (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYESWORD)) return FX_APPLIED; target->add_animation("eyesword",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_SWORD); return FX_APPLIED; @@ -933,6 +1078,7 @@ int fx_eye_of_the_mage (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_mage (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYEMAGE)) return FX_APPLIED; target->add_animation("eyemage",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_MAGE); return FX_APPLIED; @@ -941,6 +1087,7 @@ int fx_eye_of_venom (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_venom (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYEVENOM)) return FX_APPLIED; target->add_animation("eyevenom",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_VENOM); return FX_APPLIED; @@ -949,6 +1096,7 @@ int fx_eye_of_the_spirit (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_spirit (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYESPIRIT)) return FX_APPLIED; target->add_animation("eyespir",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_SPIRIT); return FX_APPLIED; @@ -957,6 +1105,7 @@ int fx_eye_of_fortitude (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_fortitude (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYEFORTITUDE)) return FX_APPLIED; target->add_animation("eyefort",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_FORT); return FX_APPLIED; @@ -965,6 +1114,7 @@ int fx_eye_of_stone (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_stone (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_EYESTONE)) return FX_APPLIED; target->add_animation("eyestone",-1,0,true); EXTSTATE_SET(0x00000400); return FX_APPLIED; @@ -995,7 +1145,14 @@ int fx_remove_effect (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_remove_effect (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - target->fxqueue.RemoveAllEffects(fx->Parameter2); + if (fx->Resource[0]) + { + target->fxqueue.RemoveAllEffectsWithResource(fx->Parameter2, fx->Resource); + } + else + { + target->fxqueue.RemoveAllEffects(fx->Parameter2); + } return FX_NOT_APPLIED; } @@ -1030,9 +1187,10 @@ } //0x116 ShroudOfFlame (iwd2) -int fx_shroud_of_flame2 (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +int fx_shroud_of_flame2 (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_shroud_of_flame2 (%2d)\n", fx->Opcode ); + if (SetSpellState(target, SS_FLAMESHROUD)) return FX_APPLIED; //timing if (core->GetGame()->GameTime%6) { return FX_APPLIED; @@ -1046,6 +1204,7 @@ int fx_animal_rage (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_animal_rage (%2d): Count %d\n", fx->Opcode, fx->Parameter1 ); + if (SetSpellState(target, SS_ANIMALRAGE)) return FX_APPLIED; //timing if (core->GetGame()->GameTime%6) { return FX_APPLIED; @@ -1119,6 +1278,7 @@ int fx_suppress_hp (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_suppress_hp (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_NOHPINFO)) return FX_APPLIED; EXTSTATE_SET(0x00001000); return FX_APPLIED; } @@ -1273,6 +1433,14 @@ // if (SetSpellState(target, SS_PROTFROMEVIL)) return FX_APPLIED; target->AddPortraitIcon(PI_PROTFROMEVIL); + //+2 to all saving throws + STAT_ADD( IE_SAVEFORTITUDE, 2); + STAT_ADD( IE_SAVEREFLEX, 2); + STAT_ADD( IE_SAVEWILL, 2); + //make it compatible with 2nd edition + STAT_ADD( IE_SAVEVSBREATH, 2); + STAT_ADD( IE_SAVEVSSPELL, 2); + //immune to control return FX_APPLIED; } //402 AddEffectsList @@ -1287,14 +1455,15 @@ } //403 ArmorOfFaith -int fx_faith_armor (Actor* /*Owner*/, Actor* target, Effect* fx) +static int fx_armor_of_faith (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_faith_armor (%2d)\n", fx->Opcode); + if (0) printf( "fx_armor_of_faith (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_ARMOROFFAITH)) return FX_APPLIED; //TODO: damage reduction (all types) target->AddPortraitIcon(PI_FAITHARMOR); return FX_APPLIED; } + //404 Nausea static EffectRef fx_unconscious_state_ref={"State:Helpless",NULL,-1}; @@ -1316,11 +1485,13 @@ return FX_APPLIED; } //405 Enfeeblement +//minimum stats in 3rd ed are 1, so this effect won't kill the target int fx_enfeeblement (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_enfeeblement (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_ENFEEBLED)) return FX_APPLIED; - target->AddPortraitIcon(PI_ENFEEBLEMENT); // is it ok? + target->AddPortraitIcon(PI_ENFEEBLEMENT); + STAT_ADD(IE_STR, -15); return FX_APPLIED; } //406 FireShield @@ -1373,28 +1544,159 @@ //410 SummonAllyIWD2 //411 SummonEnemyIWD2 //412 Control2 +int fx_control (Actor* Owner, Actor* target, Effect* fx) +{ + if (0) printf( "fx_control (%2d)\n", fx->Opcode); + bool enemyally = Owner->GetStat(IE_EA)>EA_GOODCUTOFF; + switch(fx->Parameter2) + { + case 0: + core->DisplayConstantStringName(STR_CHARMED, 0xf0f0f0, target); + break; + case 1: + core->DisplayConstantStringName(STR_DIRECHARMED, 0xf0f0f0, target) +; + break; + default: + core->DisplayConstantStringName(STR_CONTROLLED, 0xf0f0f0, target); + + break; + } + STATE_SET( STATE_CHARMED ); + STAT_SET( IE_EA, enemyally?EA_ENEMY:EA_CHARMED ); + return FX_APPLIED; +} + //413 VisualEffectIWD2 +int fx_visual_effect_iwd2 (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +{ + if (0) printf( "fx_visual_effect_iwd2 (%2d)\n", fx->Opcode); + //what else + return FX_APPLIED; +} //414 ResilientSphere +int fx_resilient_sphere (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_resilient_sphere (%2d)\n", fx->Opcode); + SetSpellState(target, SS_HELD|SS_RESILIENT); + //what else + return FX_APPLIED; +} //415 Barkskin +int fx_barkskin (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_barkskin (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_BARKSKIN)) return FX_APPLIED; + target->AddPortraitIcon(PI_BARKSKIN); + + int bonus; + int level = target->GetStat(IE_LEVELCLERIC); + if (level>6) { + if (level>12) { + bonus=5; + } else { + bonus=4; + } + } else { + bonus=3; + } + STAT_ADD(IE_ARMORCLASS,bonus); + return FX_APPLIED; +} //416 BleedingWounds //417 AreaEffect //418 FreeAction2 int fx_free_action_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_free_action_iwd2 (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_FREEACTION)) return FX_APPLIED; target->AddPortraitIcon(PI_FREEACTION); return FX_APPLIED; } //419 Unconsciousness +int fx_unconsciousness (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_unconsciousness (%2d)\n", fx->Opcode); + STATE_SET(STATE_HELPLESS|STATE_SLEEP); + target->AddPortraitIcon(PI_UNCONSCIOUS); + if (fx->Parameter2) { + SetSpellState(target, SS_NOAWAKE); + } + // + return FX_APPLIED; +} //420 Death2 (see in core effects) //421 EntropyShield +int fx_entropy_shield (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_entropy_shield (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_ENTROPY)) return FX_APPLIED; + target->AddPortraitIcon(PI_ENTROPY); + //immunity to certain projectiles? + // + // + return FX_APPLIED; +} //422 StormShell +int fx_storm_shell (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_storm_shell (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_STORMSHELL)) return FX_APPLIED; + // + return FX_APPLIED; +} //423 ProtectionFromElements +int fx_protection_from_elements (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_protection_from_elements (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_ELEMPROT)) return FX_APPLIED; + target->AddPortraitIcon(PI_ELEMPROT); + return FX_APPLIED; +} //424 HoldUndead //425 ControlUndead2 (see above) //426 Aegis +int fx_aegis (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_aegis (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_AEGIS)) return FX_APPLIED; + target->AddPortraitIcon(PI_AEGIS); + //deflection AC bonus + // + //physical damage reduction + STAT_ADD(IE_RESISTSLASHING, 10); + STAT_ADD(IE_RESISTCRUSHING, 10); + STAT_ADD(IE_RESISTPIERCING, 10); + + //elemental damage reduction + STAT_ADD(IE_RESISTFIRE, 15); + STAT_ADD(IE_RESISTCOLD, 15); + STAT_ADD(IE_RESISTELECTRICITY, 15); + STAT_ADD(IE_RESISTACID, 15); + + //magic resistance + STAT_ADD(IE_RESISTMAGIC, 3); + + //saving throws + STAT_ADD(IE_SAVEFORTITUDE, 2); + STAT_ADD(IE_SAVEWILL, 2); + STAT_ADD(IE_SAVEREFLEX, 2); + + return FX_APPLIED; +} //427 ExecutionerEyes -//428 Banish +int fx_executioner_eyes (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_executioner_eyes (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_EXECUTIONER)) return FX_APPLIED; + target->AddPortraitIcon(PI_EXECUTIONER); + + STAT_ADD(IE_CRITICALHITBONUS, 4); + STAT_ADD(IE_TOHIT, 4); + + return FX_APPLIED; +} +//428 Banish (same as unsummon?) //429 WhenStruckUseEffectList //430 ProjectileUseEffectList //431 EnergyDrain @@ -1405,14 +1707,23 @@ //436 DamageReduction //437 Disguise //438 HeroicInspiration -//439 PreventAISlowDown -int fx_prevent_ai_slowdown (Actor* /*Owner*/, Actor* target, Effect* fx) +int fx_heroic_inspiration (Actor* /*Owner*/, Actor* target, Effect* fx) { -// see also: BG2 OffscreenAIModifier - if (0) printf( "fx_prevent_ai_slowdown (%2d)\n", fx->Opcode); - STAT_SET(IE_ENABLEOFFSCREENAI,1); + if (0) printf( "fx_heroic_inspiration (%2d)\n", fx->Opcode); + + //+1 to all saves + STAT_ADD( IE_SAVEFORTITUDE, 1); + STAT_ADD( IE_SAVEREFLEX, 1); + STAT_ADD( IE_SAVEWILL, 1); + //make it compatible with 2nd edition + STAT_ADD( IE_SAVEVSBREATH, 1); + STAT_ADD( IE_SAVEVSSPELL, 1); + return FX_APPLIED; } +//439 PreventAISlowDown +//same as BG2 OffscreenAIModifier + //440 BarbarianRage //441 MovementRateModifier4 //442 Unknown This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-06-17 22:57:19
|
Revision: 4700 http://gemrb.svn.sourceforge.net/gemrb/?rev=4700&view=rev Author: avenger_teambg Date: 2007-06-17 15:57:15 -0700 (Sun, 17 Jun 2007) Log Message: ----------- more iwd2 effects Modified Paths: -------------- gemrb/trunk/gemrb/override/iwd2/effects.ids gemrb/trunk/gemrb/override/iwd2/efftext.2da gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp gemrb/trunk/gemrb/plugins/Core/EffectQueue.h gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp Added Paths: ----------- gemrb/trunk/gemrb/override/iwd2/sanctuc.vvc Modified: gemrb/trunk/gemrb/override/iwd2/effects.ids =================================================================== --- gemrb/trunk/gemrb/override/iwd2/effects.ids 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/override/iwd2/effects.ids 2007-06-17 22:57:15 UTC (rev 4700) @@ -217,7 +217,7 @@ 0xd7 PlayVisualEffect 0xd8 LevelDrainModifier 0xd9 PowerWordSleep -0xda StoneskinModifier +0xda IronSkins 0xdb ACVsCreatureType 0xdc DispelSchool 0xdd DispelSecondaryType Modified: gemrb/trunk/gemrb/override/iwd2/efftext.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/efftext.2da 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/override/iwd2/efftext.2da 2007-06-17 22:57:15 UTC (rev 4700) @@ -1,12 +1,23 @@ -2DA V1.0 +2DA V1.0 -1 EFFECT_NAME STRREF -13 DEATH 14026 -12 DAMAGE 14027 -68 UNSUMMON 14065 -401 PROTFROMEVIL 14769 -414 RESILIENT 4732 -415 BARKSKIN 14785 +13 DEATH 14026 +12 DAMAGE 14027 +68 UNSUMMON 14065 +132 DRAWUPONHOLY 14125 +400 HOPELESSNESS 1280 +401 PROTFROMEVIL 14769 +403 ARMOROFFAITH 509 +404 NAUSEA 4390 +405 ENFEEBLEMENT 7924 +406 FIRESHIELD 736 +407 DEATHWARD 1309 +414 RESILIENT 4732 +415 BARKSKIN 14785 419 UNCONSCIOUS 20438 421 ENTROPYSHIELD 8104 423 PROTFROMELEM 8842 +448 ALICORNLANCE 21646 +450 MINORGLOBE 14771 +451 LOWERRESISTANCE 16967 +452 BANE 14406 Added: gemrb/trunk/gemrb/override/iwd2/sanctuc.vvc =================================================================== (Binary files differ) Property changes on: gemrb/trunk/gemrb/override/iwd2/sanctuc.vvc ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-17 22:57:15 UTC (rev 4700) @@ -664,7 +664,7 @@ //de/activates the sanctuary overlay //the sanctuary effect draws the globe half transparent - +//if value has the 2 bit set, the palette will be altered to full white void pcf_sanctuary(Actor *actor, ieDword Value) { if (Value) { @@ -672,7 +672,9 @@ ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_SANCTUARY], false); actor->AddVVCell(sca); } - SetLockedPalette(actor, fullwhite); + if (Value&2) { + SetLockedPalette(actor, fullwhite); + } return; } actor->RemoveVVCell(overlay[OV_SANCTUARY], true); @@ -2493,6 +2495,7 @@ ca->GlobalColorMod.rgb.r = r; ca->GlobalColorMod.rgb.g = g; ca->GlobalColorMod.rgb.b = b; + ca->GlobalColorMod.rgb.a = 0; if (phase >= 0) ca->GlobalColorMod.phase = phase; else { @@ -2509,6 +2512,7 @@ ca->ColorMods[location].rgb.r = r; ca->ColorMods[location].rgb.g = g; ca->ColorMods[location].rgb.b = b; + ca->ColorMods[location].rgb.a = 0; if (phase >= 0) ca->ColorMods[location].phase = phase; else { Modified: gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/plugins/Core/CharAnimations.cpp 2007-06-17 22:57:15 UTC (rev 4700) @@ -324,7 +324,7 @@ } pal->SetupPaperdollColours(Colors, (int)type); - if (!lockPalette) { + if (lockPalette) { return; } Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-06-17 22:57:15 UTC (rev 4700) @@ -87,6 +87,7 @@ #define STAT_BIT_OR(stat, mod) target->SetStat( stat, STAT_GET( stat ) | ( mod ), 0 ) #define STAT_SET(stat, mod) target->SetStat( stat, ( mod ), 0 ) #define STAT_SET_PCF(stat, mod) target->SetStat( stat, ( mod ), 1 ) +#define STAT_BIT_OR_PCF(stat, mod) target->SetStat( stat, STAT_GET( stat ) | ( mod ), 1 ) #define STAT_MUL(stat, mod) target->SetStat( stat, STAT_GET(stat) * ( mod ) / 100, 0 ) //if an effect sticks around #define STATE_CURE( mod ) target->Modified[ IE_STATE_ID ] &= ~(ieDword) ( mod ) Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-06-17 22:57:15 UTC (rev 4700) @@ -221,6 +221,7 @@ int fx_replace_creature (Actor* Owner, Actor* target, Effect *fx);//97 int fx_play_movie (Actor* Owner, Actor* target, Effect* fx);//98 int fx_set_sanctuary_state (Actor* Owner, Actor* target, Effect* fx);//99 +int fx_set_sanctuary_state2 (Actor* Owner, Actor* target, Effect* fx);//99 int fx_set_entangle_state (Actor* Owner, Actor* target, Effect* fx);//9a int fx_set_minorglobe_state (Actor* Owner, Actor* target, Effect* fx);//9b int fx_set_shieldglobe_state (Actor* Owner, Actor* target, Effect* fx);//9c @@ -731,6 +732,15 @@ core->FreeResRefTable(spell_hits, shcount); } +static inline void SetGradient(Actor *target, ieDword gradient) +{ + gradient |= (gradient <<16); + gradient |= (gradient <<8); + for(int i=0;i<7;i++) { + STAT_SET(IE_COLORS+i, gradient); + } +} + static inline void HandleBonus(Actor *target, int stat, int mod, int mode) { if (mode==FX_DURATION_INSTANT_PERMANENT) { @@ -2347,14 +2357,26 @@ } return FX_APPLIED; } - -// 0x64, 65, 66 Protection:Creature +// 0x64, 65 Protection:Creature int fx_generic_effect (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) { if (0) printf( "fx_generic_effect (%2d): Param1: %d, Param2: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); return FX_APPLIED; } +//0x66 Protection:Level +int fx_protection_from_spell_level (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_protection_from_spell_level (%2d) Level: %d\n", fx->Opcode, fx->Parameter1); + + int value = fx->Parameter1; + if (value<9) { + STAT_BIT_OR(IE_MINORGLOBE, 1<<value); + return FX_APPLIED; + } + return FX_NOT_APPLIED; +} + //0x67 ChangeName int fx_change_name (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -3008,8 +3030,17 @@ // 0x99 Overlay:Sanctuary int fx_set_sanctuary_state (Actor* /*Owner*/, Actor* target, Effect* fx) { + //iwd and bg are a bit different, but we solve the whole stuff in a single opcode if (0) printf( "fx_set_sanctuary_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); - STAT_SET_PCF( IE_SANCTUARY, 1); + if (!fx->Parameter2) { + //this is just one way to decide if we have iwd or bg + if(core->HasFeature(GF_MAGICBIT)) { + fx->Parameter2=1; + } else { + fx->Parameter2=2; + } + } + STAT_SET_PCF( IE_SANCTUARY, fx->Parameter2); return FX_APPLIED; } @@ -3018,7 +3049,6 @@ { if (0) printf( "fx_set_entangle_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); STAT_SET_PCF( IE_ENTANGLE, 1); - //STAT_SET(IE_MOVEMENTRATE, 0); // return FX_APPLIED; } @@ -3026,7 +3056,9 @@ int fx_set_minorglobe_state (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_set_minorglobe_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); - STAT_SET_PCF( IE_MINORGLOBE, 1); + //the resisted levels are stored in minor globe (bit 2-) + //the globe effect is stored in the first bit + STAT_BIT_OR_PCF( IE_MINORGLOBE, 1); return FX_APPLIED; } @@ -3634,6 +3666,7 @@ { if (0) printf( "fx_stoneskin_modifier (%2d): Mod: %d\n", fx->Opcode, fx->Parameter1 ); STAT_SET(IE_STONESKINS, fx->Parameter1); + SetGradient(target, 14); return FX_APPLIED; } //0xDB ac vs creature type (general effect) @@ -4570,6 +4603,7 @@ { if (0) printf( "fx_golem_stoneskin_modifier (%2d): Mod: %d\n", fx->Opcode, fx->Parameter2 ); STAT_SET(IE_STONESKINSGOLEM, fx->Parameter1); + SetGradient(target, 14); return FX_APPLIED; } Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-15 22:53:11 UTC (rev 4699) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-17 22:57:15 UTC (rev 4700) @@ -38,20 +38,29 @@ #define PI_NAUSEA 43 #define PI_HOPELESSNESS 47 #define PI_RIGHTEOUS 67 +#define PI_ELEMENTS 76 #define PI_FAITHARMOR 84 +#define PI_BLEEDING 85 #define PI_HOLYPOWER 86 #define PI_DEATHWARD 87 #define PI_UNCONSCIOUS 88 #define PI_ENFEEBLEMENT 90 #define PI_ELEMPROT 93 +#define PI_MINORGLOBE 96 +#define PI_MAJORGLOBE 97 + #define PI_ENTROPY 103 #define PI_STORMSHELL 105 +#define PI_LOWERRESIST 106 #define PI_AEGIS 119 #define PI_EXECUTIONER 120 #define PI_FIRESHIELD 121 #define PI_ICESHIELD 122 +#define PI_BLINK 130 +#define PI_EMPTYBODY 145 + #define SS_HOPELESSNESS 0 #define SS_PROTFROMEVIL 1 #define SS_ARMOROFFAITH 2 @@ -117,8 +126,57 @@ #define SS_GHOSTARMOR 62 #define SS_REFLECTION 63 #define SS_KAI 64 +#define SS_CALLEDSHOT 65 +#define SS_MIRRORIMAGE 66 +#define SS_TURNED 67 +#define SS_BLADEBARRIER 68 +#define SS_POISONWEAPON 69 +#define SS_STUNNINGBLOW 70 +#define SS_QUIVERPALM 71 +#define SS_DOMINATION 72 +#define SS_MAJORGLOBE 73 +#define SS_SHIELD 74 +#define SS_ANTIMAGIC 75 +#define SS_POWERATTACK 76 +//more powerattack +#define SS_EXPERTISE 81 +//more expertise +#define SS_ARTERIAL 86 +#define SS_HAMSTRING 87 +#define SS_RAPIDSHOT 88 +#define SS_IRONBODY 89 +#define SS_TENSER 90 +#define SS_SMITEEVIL 91 +#define SS_ALICORNLANCE 92 +#define SS_LIGHTNING 93 +#define SS_CHAMPIONS 94 +#define SS_BONECIRCLE 95 +#define SS_CLOAKOFFEAR 96 +#define SS_PESTILENCE 97 +#define SS_CONTAGION 98 +#define SS_BANE 99 +#define SS_DEFENSIVE 100 +#define SS_DESTRUCTION 101 +#define SS_DOLOROUS 102 +#define SS_DOOM 103 +#define SS_EXALTATION 104 +#define SS_FAERIEFIRE 105 +#define SS_FINDTRAPS 106 +#define SS_GREATERLATH 107 +#define SS_MAGICRESIST 108 +#define SS_NPROTECTION 109 +#define SS_PROTFROMFIRE 110 +#define SS_PROTFROMLIGHTNING 111 +#define SS_ELEMENTAL 112 +#define SS_LATHANDER 113 +#define SS_SLOWPOISON 114 +#define SS_SPELLSHIELD 115 +#define SS_STATICCHARGE 116 +#define SS_LOWERRESIST 140 +#define SS_ static int fx_ac_vs_damage_type_modifier_iwd2 (Actor* Owner, Actor* target, Effect* fx);//0 +static int fx_ironskins (Actor* Owner, Actor* target, Effect* fx);//da (iwd2) static int fx_fade_rgb (Actor* Owner, Actor* target, Effect* fx);//e8 static int fx_iwd_visual_spell_hit (Actor* Owner, Actor* target, Effect* fx);//e9 static int fx_cold_damage (Actor* Owner, Actor* target, Effect* fx);//ea @@ -147,7 +205,7 @@ static int fx_salamander_aura (Actor* Owner, Actor* target, Effect* fx); //ff static int fx_umberhulk_gaze (Actor* Owner, Actor* target, Effect* fx); //100 static int fx_zombielord_aura (Actor* Owner, Actor* target, Effect* fx); //101 -//int fx_resist_spell (Actor* Owner, Actor* target, Effect* fx); //102 +static int fx_resist_spell (Actor* Owner, Actor* target, Effect* fx); //102 static int fx_summon_creature2 (Actor* Owner, Actor* target, Effect* fx); //103 //int fx_avatar_removal (Actor* Owner, Actor* target, Effect* fx); //104 //int fx_immunity_effect2 (Actor* Owner, Actor* target, Effect* fx); //105 @@ -215,10 +273,12 @@ static int fx_aegis (Actor* Owner, Actor* target, Effect* fx); //426 static int fx_executioner_eyes (Actor* Owner, Actor* target, Effect* fx); //427 //static int fx_prevent_ai_slowdown (Actor* Owner, Actor* target, Effect* fx); //439 +static int fx_bane (Actor* Owner, Actor* target, Effect* fx); //452 //No need to make these ordered, they will be ordered by EffectQueue static EffectRef effectnames[] = { { "ACVsDamageTypeModifierIWD2", fx_ac_vs_damage_type_modifier_iwd2, 0}, //0 + { "IronSkins", fx_ironskins, 0}, //da (iwd2) { "Color:FadeRGB", fx_fade_rgb, 0}, //e8 { "IWDVisualSpellHit", fx_iwd_visual_spell_hit, 0}, //e9 { "ColdDamage", fx_cold_damage, 0}, //ea @@ -299,6 +359,7 @@ { "ExecutionerEyes", fx_executioner_eyes, 0}, //427 //{ "PreventAISlowDown", fx_prevent_ai_slowdown, 0}, //439 same as bg2 + { "Bane", fx_bane, 0}, { NULL, NULL, 0 }, }; @@ -433,8 +494,17 @@ } } +static inline void SetGradient(Actor *target, ieDword gradient) +{ + gradient |= (gradient <<16); + gradient |= (gradient <<8); + for(int i=0;i<7;i++) { + STAT_SET(IE_COLORS+i, gradient); + } +} + //returns true if spell state is already set or illegal -static bool SetSpellState(Actor *target, unsigned int spellstate) +static inline bool SetSpellState(Actor *target, unsigned int spellstate) { if (spellstate>=192) return true; unsigned int pos = IE_SPLSTATE_ID1+(spellstate>>5); @@ -444,6 +514,16 @@ return false; } +//returns true if the feat exists +static inline bool HasFeat(Actor *target, unsigned int featindex) +{ + if (featindex>=96) return false; + unsigned int pos = IE_FEATS1+(featindex>>5); + unsigned int bit = 1<<(featindex&31); + if (target->GetStat(pos)&bit) return true; + return false; +} + //iwd got a hardcoded 'fireshield' system //this effect applies damage on ALL nearby actors, except the center static EffectRef fx_damage_opcode_ref={"Damage",NULL,-1}; @@ -537,7 +617,25 @@ return FX_PERMANENT; } -// 0xe8 Colour:FadeRGB +//0xda IronSkins (iwd2) +int fx_ironskins (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + //todo: calculate buffered damage in param3 on first run + //somehow deduct suffered damage from param3 + //abort effect when param3 goes below 0 + if (fx->Parameter2) { + //ironskins + if (SetSpellState(target, SS_IRONSKIN)) return FX_NOT_APPLIED; + + return FX_APPLIED; + } + //stoneskins (iwd2) + if (SetSpellState(target, SS_STONESKIN)) return FX_NOT_APPLIED; + SetGradient(target, 14); + return FX_APPLIED; +} + +//0xe8 Colour:FadeRGB int fx_fade_rgb (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_fade_rgb (%2d): \n", fx->Opcode ); @@ -938,6 +1036,7 @@ } //0x102 Protection:Spell (this is the same as in bg2?) + //0x103 SummonCreature2 static int eamods[]={EAM_DEFAULT,EAM_SOURCEALLY,EAM_SOURCEENEMY,EAM_NEUTRAL}; @@ -1216,6 +1315,7 @@ STAT_SET( IE_CHECKFORBERSERK, 1 ); return FX_APPLIED; } + //0x118 TurnUndead how int fx_turn_undead (Actor* Owner, Actor* target, Effect* fx) { @@ -1256,6 +1356,7 @@ } return FX_APPLIED; } + //0x119 VitriolicSphere int fx_vitriolic_sphere (Actor* Owner, Actor* target, Effect* fx) { @@ -1397,6 +1498,7 @@ target->Panic(); return FX_NOT_APPLIED; } + //0x127 JackalWereGaze (Charm ?) int fx_jackalwere_gaze (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1406,6 +1508,7 @@ } //0x128 ModifyGlobalVariable (same as bg2) //0x129 HideInShadows (same as bg2) + //0x12a UseMagicDevice int fx_use_magic_device_modifier (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1443,6 +1546,7 @@ //immune to control return FX_APPLIED; } + //402 AddEffectsList int fx_add_effects_list (Actor* Owner, Actor* target, Effect* fx) { @@ -1484,6 +1588,7 @@ STATE_SET(STATE_HELPLESS|STATE_SLEEP); return FX_APPLIED; } + //405 Enfeeblement //minimum stats in 3rd ed are 1, so this effect won't kill the target int fx_enfeeblement (Actor* /*Owner*/, Actor* target, Effect* fx) @@ -1494,6 +1599,7 @@ STAT_ADD(IE_STR, -15); return FX_APPLIED; } + //406 FireShield int fx_fireshield (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1508,22 +1614,28 @@ //target->SetSpellOnHit(fx->Resource); return FX_APPLIED; } + //407 DeathWard int fx_death_ward (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_death_ward (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_DEATHWARD)) return FX_APPLIED; target->AddPortraitIcon(PI_DEATHWARD); // is it ok? + return FX_APPLIED; } + //408 HolyPower int fx_holy_power (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_holy_power (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_HOLYPOWER)) return FX_APPLIED; target->AddPortraitIcon(PI_HOLYPOWER); + + target->SetColorMod(0xff, RGBModifier::ADD, 20, 0x80, 0x80, 0x80); return FX_APPLIED; } + //409 RighteousWrath int fx_righteous_wrath (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1539,13 +1651,23 @@ if (SetSpellState(target, SS_RIGHTEOUS)) return FX_APPLIED; // } + target->SetColorMod(0xff, RGBModifier::ADD, 30, 0xd7, 0xb6, 0 ); return FX_APPLIED; } + //410 SummonAllyIWD2 + //411 SummonEnemyIWD2 + //412 Control2 + +static EffectRef fx_protection_from_evil_ref={"ProtectionFromEvil",NULL,-1}; + int fx_control (Actor* Owner, Actor* target, Effect* fx) { + //prot from evil deflects it + if (target->fxqueue.HasEffect(fx_protection_from_evil_ref)) return FX_NOT_APPLIED; + if (0) printf( "fx_control (%2d)\n", fx->Opcode); bool enemyally = Owner->GetStat(IE_EA)>EA_GOODCUTOFF; switch(fx->Parameter2) @@ -1563,17 +1685,18 @@ break; } STATE_SET( STATE_CHARMED ); - STAT_SET( IE_EA, enemyally?EA_ENEMY:EA_CHARMED ); + STAT_SET( IE_EA, enemyally?EA_ENEMY:EA_CHARMED ); return FX_APPLIED; } //413 VisualEffectIWD2 int fx_visual_effect_iwd2 (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) { - if (0) printf( "fx_visual_effect_iwd2 (%2d)\n", fx->Opcode); - //what else - return FX_APPLIED; + if (0) printf( "fx_visual_effect_iwd2 (%2d)\n", fx->Opcode); + //what else + return FX_APPLIED; } + //414 ResilientSphere int fx_resilient_sphere (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1582,6 +1705,7 @@ //what else return FX_APPLIED; } + //415 Barkskin int fx_barkskin (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1601,10 +1725,48 @@ bonus=3; } STAT_ADD(IE_ARMORCLASS,bonus); + SetGradient(target, 2); return FX_APPLIED; } + +//regen/poison/disease types (works for bleeding wounds too) +#define RPD_PERCENT 1 +#define RPD_SECONDS 2 +#define RPD_POINTS 3 + //416 BleedingWounds +int fx_bleeding_wounds (Actor* Owner, Actor* target, Effect* fx) +{ + if (0) printf( "fx_bleeding_wounds (%2d): Damage: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); + + target->AddPortraitIcon(PI_BLEEDING); + //also this effect is executed every update + ieDword damage; + + switch(fx->Parameter2) { + case RPD_PERCENT: + damage = target->GetStat(IE_MAXHITPOINTS) * fx->Parameter1 / 100; + break; + case RPD_SECONDS: + damage = 1; + if (fx->Parameter1 && (core->GetGame()->GameTime%fx->Parameter1)) { + return FX_APPLIED; + } + break; + case RPD_POINTS: + damage = fx->Parameter1; + break; + default: + damage = 1; + break; + } + //percent + target->Damage(damage, DAMAGE_POISON, Owner); + return FX_APPLIED; +} + //417 AreaEffect + //418 FreeAction2 int fx_free_action_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1651,6 +1813,15 @@ if (0) printf( "fx_protection_from_elements (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_ELEMPROT)) return FX_APPLIED; target->AddPortraitIcon(PI_ELEMPROT); + STAT_ADD(IE_RESISTFIRE, 15); + STAT_ADD(IE_RESISTCOLD, 15); + STAT_ADD(IE_RESISTACID, 15); + STAT_ADD(IE_RESISTELECTRICITY, 15); + //compatible with 2nd ed + STAT_ADD(IE_RESISTMAGICFIRE, 15); + STAT_ADD(IE_RESISTMAGICCOLD, 15); + + target->SetColorMod(0xff, RGBModifier::ADD, 0x4f, 0, 0, 0xc0); return FX_APPLIED; } //424 HoldUndead @@ -1682,6 +1853,8 @@ STAT_ADD(IE_SAVEWILL, 2); STAT_ADD(IE_SAVEREFLEX, 2); + target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x80, 0x60, 0x60); + SetGradient(target, 14); return FX_APPLIED; } //427 ExecutionerEyes @@ -1694,6 +1867,7 @@ STAT_ADD(IE_CRITICALHITBONUS, 4); STAT_ADD(IE_TOHIT, 4); + SetGradient(target, 8); return FX_APPLIED; } //428 Banish (same as unsummon?) @@ -1702,6 +1876,19 @@ //431 EnergyDrain //432 TortoiseShell //433 Blink +int fx_blink (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_blink (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); + if (SetSpellState(target, SS_BLINK)) return FX_APPLIED; + if(fx->Parameter2) { + target->AddPortraitIcon(PI_EMPTYBODY); + return FX_APPLIED; + } + target->AddPortraitIcon(PI_BLINK); + + return FX_APPLIED; +} + //434 PersistentUseEffectList //435 DayBlindness //436 DamageReduction @@ -1726,20 +1913,119 @@ //440 BarbarianRage //441 MovementRateModifier4 -//442 Unknown +//442 Unknown (needs research) //443 MissileDamageReduction //444 TensersTransformation -//445 Unknown + +int fx_tenser_transformation (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_tenser_transformation (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_TENSER)) return FX_APPLIED; + STAT_SUB(IE_ARMORCLASS, 2); + + SetGradient(target, 0x3e); + return FX_APPLIED; +} + +//445 Unknown (empty function in iwd2) //446 SmiteEvil //447 Restoration //448 AlicornLance +int fx_alicorn_lance (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_alicorn_lance (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_ALICORNLANCE)) return FX_APPLIED; + ////target->AddPortraitIcon(PI_ALICORN); //no portrait icon + STAT_SUB(IE_ARMORCLASS, 2); + //color glow + return FX_APPLIED; +} //449 CallLightning //450 GlobeInvulnerability +int fx_minor_globe (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_minor_globe (%2d)\n", fx->Opcode); + int state; + int icon; + int value; + + if (fx->Parameter2) { + state = SS_MAJORGLOBE; + icon = PI_MAJORGLOBE; + value = 30; //if globe is needed, use 31 + } else { + state = SS_MINORGLOBE; + icon = PI_MINORGLOBE; + value = 14; //if globe is needed use 15 + } + + if (SetSpellState(target, state)) return FX_APPLIED; + target->AddPortraitIcon(icon); + + STAT_BIT_OR(IE_MINORGLOBE, value); + return FX_APPLIED; +} + //451 LowerResistance +int fx_lower_resistance (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_lower_resistance (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_LOWERRESIST)) return FX_APPLIED; + target->AddPortraitIcon(PI_LOWERRESIST); + + STAT_SUB(IE_RESISTMAGIC, 15); + return FX_APPLIED; +} //452 Bane +static EffectRef fx_bless_ref={"Bless",NULL,-1}; + +int fx_bane (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_bane (%2d)\n", fx->Opcode); + + if (SetSpellState(target, SS_BANE)) return FX_APPLIED; + target->SetColorMod(0xff, RGBModifier::ADD, 20, 0, 0, 0x80); + //do this once + target->fxqueue.RemoveAllEffects(fx_bless_ref); + return FX_APPLIED; +} + //453 PowerAttack +int fx_power_attack (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_power_attack (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_POWERATTACK)) return FX_APPLIED; + return FX_APPLIED; +} + //454 Expertise +int fx_expertise (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_expertise (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_EXPERTISE)) return FX_APPLIED; + return FX_APPLIED; +} + //455 ArterialStrike +int fx_arterial_strike (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_arterial_strike (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_ARTERIAL)) return FX_APPLIED; + return FX_APPLIED; +} + //456 HamString +int fx_hamstring (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_hamstring (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_HAMSTRING)) return FX_APPLIED; + return FX_APPLIED; +} + //457 RapidShot - +int fx_rapid_shot (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_rapid_shot (%2d)\n", fx->Opcode); + if (SetSpellState(target, SS_RAPIDSHOT)) return FX_APPLIED; + return FX_APPLIED; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-06-21 17:39:27
|
Revision: 4701 http://gemrb.svn.sourceforge.net/gemrb/?rev=4701&view=rev Author: avenger_teambg Date: 2007-06-21 10:39:20 -0700 (Thu, 21 Jun 2007) Log Message: ----------- changed the hardcoded graphic overlay system to the iwd2 scheme simplified gameflag option loading improved some effects Modified Paths: -------------- gemrb/trunk/gemrb/includes/globals.h gemrb/trunk/gemrb/override/bg1/overlay.2da gemrb/trunk/gemrb/override/bg2/overlay.2da gemrb/trunk/gemrb/override/how/overlay.2da gemrb/trunk/gemrb/override/iwd/overlay.2da gemrb/trunk/gemrb/override/iwd2/efftext.2da gemrb/trunk/gemrb/override/iwd2/overlay.2da gemrb/trunk/gemrb/override/pst/overlay.2da gemrb/trunk/gemrb/override/tob/overlay.2da gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp gemrb/trunk/gemrb/plugins/Core/EffectQueue.h gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp Modified: gemrb/trunk/gemrb/includes/globals.h =================================================================== --- gemrb/trunk/gemrb/includes/globals.h 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/includes/globals.h 2007-06-21 17:39:20 UTC (rev 4701) @@ -35,7 +35,7 @@ #include "ie_types.h" -#define VERSION_GEMRB "0.2.8" +#define VERSION_GEMRB "0.2.9" #define GEMRB_STRING "GemRB v" VERSION_GEMRB @@ -122,10 +122,14 @@ #define GF_SAVE_FOR_HALF 25 //pst #define GF_CHARNAMEISGABBER 26 //iwd2 #define GF_MAGICBIT 27 //iwd, iwd2 -#define GF_CHECK_ABILITIES 28 //bg2 (others?) -#define GF_CHALLENGERATING 29 //iwd2 -#define GF_SPELLBOOKICONHACK 30 //bg2 +#define GF_CHECK_ABILITIES 28 //bg2 (others?) +#define GF_CHALLENGERATING 29 //iwd2 +#define GF_SPELLBOOKICONHACK 30 //bg2 +#define GF_ENHANCED_EFFECTS 31 //iwd2 (maybe iwd/how too) +//update this +#define GF_COUNT 32 + //the number of item usage fields (used in CREItem and STOItem) #define CHARGE_COUNTERS 3 Modified: gemrb/trunk/gemrb/override/bg1/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/bg1/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/bg1/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -1,11 +1,36 @@ 2DA V1.0 * VVC -ENTANGLE WEBENTD +ENTANGLE SPENTACI SANCTUARY SANCTRY -MINORGLOBE MINORGLB +WISP WISP SHIELDGLOBE SPSHIELD GREASE GREASED WEB WEBENTD +MINORGLOBE MINORGLB +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 BOUNCE SPTURNI2 BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC + Modified: gemrb/trunk/gemrb/override/bg2/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/bg2/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/bg2/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -1,11 +1,36 @@ 2DA V1.0 * VVC +SANCTUARY SANCTRY ENTANGLE SPENTACI -SANCTUARY SANCTRY -MINORGLOBE MINORGLB +WISP WISP SHIELDGLOBE SPSHIELD GREASE GREASED WEB WEBENTD +MINORGLOBE MINORGLB +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 BOUNCE SPTURNI2 BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC + Modified: gemrb/trunk/gemrb/override/how/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/how/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/how/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -3,9 +3,33 @@ VVC ENTANGLE ENTANGC SANCTUARY SANCTUC -MINORGLOBE MGOINVC +WISP WISP SHIELDGLOBE SHIELDC GREASE GREASEC WEB WEBC +MINORGLOBE MGOINVC +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 BOUNCE SPTURNI2 BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC Modified: gemrb/trunk/gemrb/override/iwd/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/iwd/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -3,9 +3,33 @@ VVC ENTANGLE ENTANGC SANCTUARY SANCTUC -MINORGLOBE MGOINVC +WISP WISP SHIELDGLOBE SHIELDC GREASE GREASEC WEB WEBC +MINORGLOBE MGOINVC +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 BOUNCE SPTURNI2 BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC Modified: gemrb/trunk/gemrb/override/iwd2/efftext.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/efftext.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/iwd2/efftext.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -1,23 +1,25 @@ -2DA V1.0 +2DA V1.0 -1 - EFFECT_NAME STRREF -13 DEATH 14026 -12 DAMAGE 14027 -68 UNSUMMON 14065 -132 DRAWUPONHOLY 14125 -400 HOPELESSNESS 1280 -401 PROTFROMEVIL 14769 -403 ARMOROFFAITH 509 -404 NAUSEA 4390 -405 ENFEEBLEMENT 7924 -406 FIRESHIELD 736 -407 DEATHWARD 1309 -414 RESILIENT 4732 -415 BARKSKIN 14785 -419 UNCONSCIOUS 20438 -421 ENTROPYSHIELD 8104 -423 PROTFROMELEM 8842 -448 ALICORNLANCE 21646 -450 MINORGLOBE 14771 -451 LOWERRESISTANCE 16967 -452 BANE 14406 + EFFECT_NAME STRREF +13 DEATH 14026 +12 DAMAGE 14027 +68 UNSUMMON 14065 +132 DRAWUPONHOLY 14125 +400 HOPELESSNESS 1280 +401 PROTFROMEVIL 14769 +403 ARMOROFFAITH 509 +404 NAUSEA 4390 +405 ENFEEBLEMENT 7924 +406 FIRESHIELD 736 +407 DEATHWARD 1309 +414 RESILIENT 4732 +415 BARKSKIN 14785 +418 FREEACTION 14794 +419 UNCONSCIOUS 20438 +421 ENTROPYSHIELD 8104 +422 STORMSHELL 8830 +423 PROTFROMELEM 8842 +448 ALICORNLANCE 21646 +450 MINORGLOBE 14771 +451 LOWERRESISTANCE 16967 +452 BANE 14406 Modified: gemrb/trunk/gemrb/override/iwd2/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/iwd2/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/iwd2/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -1,11 +1,35 @@ 2DA V1.0 * - VVC + VVC +SANCTUARY SANCTUC ENTANGLE ENTANGC -SANCTUARY SANCTUC -MINORGLOBE MGOINVC -SHIELDGLOBE SHIELDC -GREASE GREASEC -WEB WEBC -BOUNCE SPTURNI2 -BOUNCE2 SPTURNI +WISP WISP +SHIELDGLOBE SHIELDC +GREASE GREASEC +WEB WEBC +MINORGLOBE MGOINVC +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 +BOUNCE SPTURNI2 +BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC Modified: gemrb/trunk/gemrb/override/pst/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/pst/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/pst/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -1,11 +1,35 @@ 2DA V1.0 * VVC +SANCTUARY SANCTRY ENTANGLE WEBENTD -SANCTUARY SANCTRY -MINORGLOBE MINORGLB +WISP WISP SHIELDGLOBE SPSHIELD GREASE GREASED WEB WEBENTD +MINORGLOBE MINORGLB +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 BOUNCE SPTURNI2 BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC Modified: gemrb/trunk/gemrb/override/tob/overlay.2da =================================================================== --- gemrb/trunk/gemrb/override/tob/overlay.2da 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/override/tob/overlay.2da 2007-06-21 17:39:20 UTC (rev 4701) @@ -3,9 +3,34 @@ VVC ENTANGLE SPENTACI SANCTUARY SANCTRY -MINORGLOBE MINORGLB +WISP WISP SHIELDGLOBE SPSHIELD GREASE GREASED WEB WEBENTD +MINORGLOBE MINORGLB +GLOBE GOINVUC +FLAMESHROUD SOFLAMC +ANTIMAGIC AMSHELC +RESILIENT ORSPHEC +PROTFROMMISS PFNMISC +CLOAKOFFEAR COFEARC +ENTROPY ESHIELC +FIREAURA FIAURAC +FROSTAURA FRAURAC +INSECT IPLAGUC +STORMSHELL SSHELLC +LATHANDER1 SOLATC1 +LATHANDER2 SOLATC2 +GLATHANDER1 GSOLAC1 +GLATHANDER2 GSOLAC2 +SEVENEYES1 SEYESC1 +SEVENEYES2 SEYESC2 BOUNCE SPTURNI2 BOUNCE2 SPTURNI +FIRESHIELD1 FSHIRC1 +FIRESHIELD2 FSHIRC2 +ICESHIELD1 FSHIBC1 +ICESHIELD2 FSHIBC2 +TORTOISE TSHELLC +DEATHARMOR DARMORC + Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-21 17:39:20 UTC (rev 4701) @@ -137,18 +137,45 @@ -1,-1,-1, ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT, }; -//the possible hardcoded overlays (they got separate stats) -#define OVERLAY_COUNT 8 -#define OV_ENTANGLE 0 -#define OV_SANCTUARY 1 -#define OV_MINORGLOBE 2 +//the possible hardcoded overlays (they got separate stats or bits) +#define OVERLAY_COUNT 32 + +#define OV_SANCTUARY 0 +#define OV_ENTANGLE 1 +#define OV_WISP 2 //iwd2 #define OV_SHIELDGLOBE 3 #define OV_GREASE 4 -#define OV_WEB 5 -#define OV_BOUNCE 6 //bouncing -#define OV_BOUNCE2 7 //bouncing activated -static ieResRef overlay[OVERLAY_COUNT]={"SPENTACI","SANCTRY","MINORGLB","SPSHIELD", -"GREASED","WEBENTD","SPTURNI2","SPTURNI"}; +#define OV_WEB 5 +#define OV_MINORGLOBE 6 +#define OV_GLOBE 7 +#define OV_SHROUD 8 +#define OV_ANTIMAGIC 9 +#define OV_RESILIENT 10 +#define OV_NORMALMISS 11 +#define OV_CLOAKFEAR 12 +#define OV_ENTROPY 13 +#define OV_FIREAURA 14 +#define OV_FROSTAURA 15 +#define OV_INSECT 16 +#define OV_STORMSHELL 17 +#define OV_LATH1 18 +#define OV_LATH2 19 +#define OV_GLATH1 20 +#define OV_GLATH2 21 +#define OV_SEVENEYES1 22 +#define OV_SEVENEYES2 23 +#define OV_BOUNCE 24 //bouncing +#define OV_BOUNCE2 25 //bouncing activated +#define OV_FIRESHIELD1 26 +#define OV_FIRESHIELD2 27 +#define OV_ICESHIELD1 28 +#define OV_ICESHIELD2 29 +#define OV_TORTOISE 30 +#define OV_DEATHARMOR 31 + +static ieResRef overlay[OVERLAY_COUNT]={"SANCTRY","SPENTACI","","SPSHIELD", +"GREASED","WEBENTD","MINORGLB","","","","","","","","","","","","","","", +"","","","SPTURNI2","SPTURNI","","","","","",""}; static int *mxsplwis = NULL; static int spllevels; @@ -505,7 +532,8 @@ } //call this when morale or moralebreak changed -void pcf_morale (Actor *actor, ieDword /*Value*/) +//cannot use old or new value, because it is called two ways +void pcf_morale (Actor *actor, ieDword /*oldValue*/, ieDword /*newValue*/) { if (actor->Modified[IE_MORALE]<=actor->Modified[IE_MORALEBREAK] ) { actor->Panic(); @@ -514,13 +542,13 @@ actor->SetCircleSize(); } -void pcf_ea (Actor *actor, ieDword /*Value*/) +void pcf_ea (Actor *actor, ieDword /*oldValue*/, ieDword /*newValue*/) { actor->SetCircleSize(); } //this is a good place to recalculate level up stuff -void pcf_level (Actor *actor, ieDword /*Value*/) +void pcf_level (Actor *actor, ieDword /*oldValue*/, ieDword /*newValue*/) { ieDword sum = actor->BaseStats[IE_LEVELFIGHTER]+ @@ -538,99 +566,88 @@ actor->SetupFist(); } -void pcf_class (Actor *actor, ieDword Value) +void pcf_class (Actor *actor, ieDword /*Value*/, ieDword /*newValue*/) { - actor->InitButtons(Value); + actor->InitButtons(actor->Modified[IE_CLASS]); } -void pcf_animid(Actor *actor, ieDword Value) +void pcf_animid(Actor *actor, ieDword /*Value*/, ieDword newValue) { - actor->SetAnimationID(Value); + actor->SetAnimationID(newValue); } -static void SetLockedPalette(Actor *actor, const ieDword *gradients) -{ - CharAnimations *anims = actor->GetAnims(); - if (!anims) return; //cannot apply it (yet) - anims->LockPalette(gradients); -} - -static void UnlockPalette(Actor *actor) -{ - CharAnimations *anims = actor->GetAnims(); - if (anims) { - anims->lockPalette=false; - anims->SetColors(actor->Modified+IE_COLORS); - } -} - static const ieDword fullwhite[7]={ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT}; static const ieDword fullstone[7]={STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT,STONE_GRADIENT}; -void pcf_state(Actor *actor, ieDword Value) +void pcf_state(Actor *actor, ieDword /*Value*/, ieDword State) { if (actor->InParty) { core->SetEventFlag(EF_PORTRAIT); } - if (Value & STATE_PETRIFIED) { - SetLockedPalette( actor, fullstone); + if (State & STATE_PETRIFIED) { + actor->SetLockedPalette(fullstone); return; } - if (Value & STATE_FROZEN) { - SetLockedPalette(actor, fullwhite); + if (State & STATE_FROZEN) { + actor->SetLockedPalette(fullwhite); return; } - UnlockPalette(actor); + actor->UnlockPalette(); } -void pcf_hitpoint(Actor *actor, ieDword Value) +void pcf_hitpoint(Actor *actor, ieDword /*Value*/, ieDword hp) { - if ((signed) Value>(signed) actor->Modified[IE_MAXHITPOINTS]) { - Value=actor->Modified[IE_MAXHITPOINTS]; + if ((signed) hp>(signed) actor->Modified[IE_MAXHITPOINTS]) { + hp=actor->Modified[IE_MAXHITPOINTS]; } - if ((signed) Value<(signed) actor->Modified[IE_MINHITPOINTS]) { - Value=actor->Modified[IE_MINHITPOINTS]; + if ((signed) hp<(signed) actor->Modified[IE_MINHITPOINTS]) { + hp=actor->Modified[IE_MINHITPOINTS]; } - if ((signed) Value<=0) { + if ((signed) hp<=0) { actor->Die(NULL); } - actor->Modified[IE_MINHITPOINTS]=Value; + + actor->Modified[IE_MINHITPOINTS]=hp; + if (actor->InParty) { core->SetEventFlag(EF_PORTRAIT); } } -void pcf_maxhitpoint(Actor *actor, ieDword Value) +void pcf_maxhitpoint(Actor *actor, ieDword /*Value*/, ieDword hp) { - if ((signed) Value<(signed) actor->Modified[IE_HITPOINTS]) { - actor->Modified[IE_HITPOINTS]=Value; - pcf_hitpoint(actor,Value); + if ((signed) hp<(signed) actor->Modified[IE_HITPOINTS]) { + actor->Modified[IE_HITPOINTS]=hp; + //passing 0 because it is ignored anyway + pcf_hitpoint(actor, 0, hp); } if (actor->InParty) { core->SetEventFlag(EF_PORTRAIT); } } -void pcf_minhitpoint(Actor *actor, ieDword Value) +void pcf_minhitpoint(Actor *actor, ieDword /*Value*/, ieDword hp) { - if ((signed) Value>(signed) actor->Modified[IE_HITPOINTS]) { - actor->Modified[IE_HITPOINTS]=Value; - pcf_hitpoint(actor,Value); + if ((signed) hp>(signed) actor->Modified[IE_HITPOINTS]) { + actor->Modified[IE_HITPOINTS]=hp; + //passing 0 because it is ignored anyway + pcf_hitpoint(actor, 0, hp); } } -void pcf_con(Actor *actor, ieDword Value) +void pcf_con(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { - if ((signed) Value<=0) { + if ((signed) newValue<=0) { actor->Die(NULL); } - pcf_hitpoint(actor, actor->Modified[IE_HITPOINTS]); + //passing 0 because it is ignored anyway + pcf_hitpoint(actor, 0, actor->Modified[IE_HITPOINTS]); } -void pcf_stat(Actor *actor, ieDword Value) +void pcf_stat(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { - if ((signed) Value<=0) { + if ((signed) newValue<=0) { actor->Die(NULL); } if (actor->InParty) { @@ -638,7 +655,7 @@ } } -void pcf_gold(Actor *actor, ieDword /*Value*/) +void pcf_gold(Actor *actor, ieDword /*Value*/, ieDword /*newValue*/) { //this function will make a party member automatically donate their //gold to the party pool, not the same as in the original engine @@ -650,112 +667,127 @@ } //de/activates the entangle overlay -void pcf_entangle(Actor *actor, ieDword Value) +void pcf_entangle(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { + if (newValue&1) { if (actor->HasVVCCell(overlay[OV_ENTANGLE])) return; ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_ENTANGLE], false); actor->AddVVCell(sca); - } else { + return; + } + if (oldValue&1) { actor->RemoveVVCell(overlay[OV_ENTANGLE], true); } } //de/activates the sanctuary overlay -//the sanctuary effect draws the globe half transparent -//if value has the 2 bit set, the palette will be altered to full white -void pcf_sanctuary(Actor *actor, ieDword Value) +//the sanctuary vvc draws the globe half transparent +void pcf_sanctuary(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { - if (!actor->HasVVCCell(overlay[OV_SANCTUARY])) { - ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_SANCTUARY], false); - actor->AddVVCell(sca); + ieDword changed = newValue^oldValue; + ieDword mask = 1; + for (int i=0;i<32;i++) { + if (changed&mask) { + if (newValue&mask) { + if (!actor->HasVVCCell(overlay[i])) { + ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[i], false); + actor->AddVVCell(sca); + } + } else { + actor->RemoveVVCell(overlay[i], true); + } } - if (Value&2) { - SetLockedPalette(actor, fullwhite); - } - return; } - actor->RemoveVVCell(overlay[OV_SANCTUARY], true); - UnlockPalette(actor); } //de/activates the prot from missiles overlay -void pcf_shieldglobe(Actor *actor, ieDword Value) +void pcf_shieldglobe(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { + if (newValue&1) { if (actor->HasVVCCell(overlay[OV_SHIELDGLOBE])) return; ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_SHIELDGLOBE], false); actor->AddVVCell(sca); - } else { + return; + } + if (oldValue&1) { actor->RemoveVVCell(overlay[OV_SHIELDGLOBE], true); } } //de/activates the globe of invul. overlay -void pcf_minorglobe(Actor *actor, ieDword Value) +void pcf_minorglobe(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { + if (newValue&1) { if (actor->HasVVCCell(overlay[OV_MINORGLOBE])) return; ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_MINORGLOBE], false); actor->AddVVCell(sca); - } else { + return; + } + if (oldValue&1) { actor->RemoveVVCell(overlay[OV_MINORGLOBE], true); } } //de/activates the grease background -void pcf_grease(Actor *actor, ieDword Value) +void pcf_grease(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { + if (newValue&1) { if (actor->HasVVCCell(overlay[OV_GREASE])) return; - actor->add_animation(overlay[OV_GREASE], -1, -1, 0); - } else { + actor->AddAnimation(overlay[OV_GREASE], -1, -1, 0); + return; + } + if (oldValue&1) { actor->RemoveVVCell(overlay[OV_GREASE], true); } } //de/activates the web overlay //the web effect also immobilizes the actor! -void pcf_web(Actor *actor, ieDword Value) +void pcf_web(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { + if (newValue&1) { if (actor->HasVVCCell(overlay[OV_WEB])) return; - actor->add_animation(overlay[OV_WEB], -1, 0, 0); - } else { + actor->AddAnimation(overlay[OV_WEB], -1, 0, 0); + return; + } + if (oldValue&1) { actor->RemoveVVCell(overlay[OV_WEB], true); } } //de/activates the spell bounce background -void pcf_bounce(Actor *actor, ieDword Value) +void pcf_bounce(Actor *actor, ieDword oldValue, ieDword newValue) { - if (Value) { - actor->add_animation(overlay[OV_BOUNCE], -1, -1, 0); - } else { + if (newValue&1) { + if (actor->HasVVCCell(overlay[OV_BOUNCE])) + return; + actor->AddAnimation(overlay[OV_BOUNCE], -1, -1, 0); + return; + } + if (oldValue&1) { //it seems we have to remove it abruptly actor->RemoveVVCell(overlay[OV_BOUNCE], false); } } //no separate values (changes are permanent) -void pcf_fatigue(Actor *actor, ieDword Value) +void pcf_fatigue(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { - actor->BaseStats[IE_FATIGUE]=Value; + actor->BaseStats[IE_FATIGUE]=newValue; } //no separate values (changes are permanent) -void pcf_intoxication(Actor *actor, ieDword Value) +void pcf_intoxication(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { - actor->BaseStats[IE_INTOXICATION]=Value; + actor->BaseStats[IE_INTOXICATION]=newValue; } -void pcf_color(Actor *actor, ieDword /*Value*/) +void pcf_color(Actor *actor, ieDword /*oldValue*/, ieDword /*newValue*/) { CharAnimations *anims = actor->GetAnims(); if (anims) { @@ -763,11 +795,11 @@ } } -void pcf_armorlevel(Actor *actor, ieDword Value) +void pcf_armorlevel(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { CharAnimations *anims = actor->GetAnims(); if (anims) { - anims->SetArmourLevel(Value); + anims->SetArmourLevel(newValue); } } @@ -791,7 +823,7 @@ MAX_LEVEL,MAX_LEVEL,MAX_LEVEL,MAX_LEVEL, 255,65535,65535,15//ff }; -typedef void (*PostChangeFunctionType)(Actor *actor, ieDword Value); +typedef void (*PostChangeFunctionType)(Actor *actor, ieDword oldValue, ieDword newValue); static PostChangeFunctionType post_change_functions[256]={ pcf_hitpoint, pcf_maxhitpoint, NULL, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, //0f @@ -1017,8 +1049,21 @@ } } -void Actor::add_animation(const ieResRef resource, int gradient, int height, int flags) +void Actor::SetLockedPalette(const ieDword *gradients) { + if (!anims) return; //cannot apply it (yet) + anims->LockPalette(gradients); +} + +void Actor::UnlockPalette() +{ + if (!anims) return; + anims->lockPalette=false; + anims->SetColors(Modified+IE_COLORS); +} + +void Actor::AddAnimation(const ieResRef resource, int gradient, int height, int flags) +{ ScriptedAnimation *sca = core->GetScriptedAnimation(resource, false); if (!sca) return; @@ -1044,28 +1089,28 @@ case 0: case 1: case 2: case 3: //blood i = (int) GetStat(IE_ANIMATION_ID)>>16; if (!i) i = d_gradient[type]; - add_animation(d_main[type], i, 0, AA_PLAYONCE); + AddAnimation(d_main[type], i, 0, AA_PLAYONCE); break; case 4: case 5: case 7: //fire - add_animation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); + AddAnimation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); for(i=DL_FIRE;i<=type;i++) { - add_animation(d_splash[i], d_gradient[i], 0, AA_PLAYONCE); + AddAnimation(d_splash[i], d_gradient[i], 0, AA_PLAYONCE); } break; case 8: case 9: case 10: //electricity - add_animation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); + AddAnimation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); for(i=DL_ELECTRICITY;i<=type;i++) { - add_animation(d_splash[i], d_gradient[i], 0, AA_PLAYONCE); + AddAnimation(d_splash[i], d_gradient[i], 0, AA_PLAYONCE); } break; case 11: case 12: case 13://cold - add_animation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); + AddAnimation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); break; case 14: case 15: case 16://acid - add_animation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); + AddAnimation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); break; case 17: case 18: case 19://disintegrate - add_animation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); + AddAnimation(d_main[type], d_gradient[type], 0, AA_PLAYONCE); break; } } @@ -1086,12 +1131,13 @@ } } - if (pcf && Modified[StatIndex]!=Value) { - Modified[StatIndex] = Value; - PostChangeFunctionType f = post_change_functions[StatIndex]; - if (f) (*f)(this, Value); - } else { - Modified[StatIndex] = Value; + unsigned int previous = Modified[StatIndex]; + if (Modified[StatIndex]!=Value) { + if (pcf) { + Modified[StatIndex] = Value; + PostChangeFunctionType f = post_change_functions[StatIndex]; + if (f) (*f)(this, previous, Value); + } } return true; } @@ -1273,7 +1319,7 @@ if (first || (Modified[i]!=previous[i]) ) { PostChangeFunctionType f = post_change_functions[i]; if (f) { - (*f)(this, Modified[i]); + (*f)(this, first?0:previous[i], Modified[i]); } } } @@ -2495,7 +2541,7 @@ ca->GlobalColorMod.rgb.r = r; ca->GlobalColorMod.rgb.g = g; ca->GlobalColorMod.rgb.b = b; - ca->GlobalColorMod.rgb.a = 0; + ca->GlobalColorMod.rgb.a = 0; if (phase >= 0) ca->GlobalColorMod.phase = phase; else { Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-06-21 17:39:20 UTC (rev 4701) @@ -420,7 +420,9 @@ /* draw videocells */ void DrawVideocells(Region &screen, vvcVector &vvcCells, Color &tint); - void add_animation(const ieResRef resource, int gradient, int height, int flags); + void SetLockedPalette(const ieDword *gradients); + void UnlockPalette(); + void AddAnimation(const ieResRef resource, int gradient, int height, int flags); void PlayDamageAnimation(int x); /* restores a spell of maximum maxlevel level, type is a mask of disabled spells */ int RestoreSpellLevel(ieDword maxlevel, ieDword typemask); Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.cpp 2007-06-21 17:39:20 UTC (rev 4701) @@ -889,6 +889,29 @@ RemoveAllEffectsWithResource(effect_reference.EffText, resource); } +void EffectQueue::RemoveAllDetrimentalEffects(ieDword opcode, ieDword current) +{ + std::vector< Effect* >::iterator f; + for ( f = effects.begin(); f != effects.end(); f++ ) { + MATCH_OPCODE(); + MATCH_LIVE_FX(); + switch((*f)->Parameter2) { + case 0:case 3: + if (((signed) (*f)->Parameter1)>=0) continue; + break; + case 1:case 4: + if (((signed) (*f)->Parameter1)>=(signed) current) continue; + break; + case 2:case 5: + if (((signed) (*f)->Parameter1)>=100) continue; + break; + default: + break; + } + (*f)->TimingMode=FX_DURATION_JUST_EXPIRED; + } +} + void EffectQueue::RemoveAllEffectsWithParam(ieDword opcode, ieDword param2) { std::vector< Effect* >::iterator f; @@ -937,6 +960,13 @@ } //this will modify effect reference + +void EffectQueue::RemoveAllDetrimentalEffects(EffectRef &effect_reference, ieDword current) +{ + ResolveEffectRef(effect_reference); + RemoveAllDetrimentalEffects(effect_reference.EffText, current); +} + void EffectQueue::RemoveAllEffectsWithParam(EffectRef &effect_reference, ieDword param2) { ResolveEffectRef(effect_reference); Modified: gemrb/trunk/gemrb/plugins/Core/EffectQueue.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/Core/EffectQueue.h 2007-06-21 17:39:20 UTC (rev 4701) @@ -184,6 +184,7 @@ void RemoveExpiredEffects(ieDword futuretime); /* removes all effects except timing mode 9 */ void RemoveAllNonPermanentEffects(); + void RemoveAllDetrimentalEffects(EffectRef &effect_reference, ieDword current); void RemoveAllEffectsWithParam(EffectRef &effect_reference, ieDword param2); void RemoveAllEffectsWithResource(EffectRef &effect_reference, const ieResRef resource); void RemoveLevelEffects(ieDword level, ieDword flags, ieDword match); @@ -224,6 +225,7 @@ private: //use the effect reference style calls from outside static Effect *CreateEffect(ieDword opcode, ieDword param1, ieDword param2, ieDword timing); + void RemoveAllDetrimentalEffects(ieDword opcode, ieDword current); void RemoveAllEffectsWithParam(ieDword opcode, ieDword param2); Effect *HasOpcode(ieDword opcode) const; Effect *HasOpcodeWithParam(ieDword opcode, ieDword param2) const; Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-06-21 17:39:20 UTC (rev 4701) @@ -2098,6 +2098,41 @@ pl_lowercase[upper]=(ieByte) lower; } +static const char *game_flags[GF_COUNT]={ + "HasKaputz", //0 GF_HAS_KAPUTZ + "AllStringsTagged", //1 GF_ALL_STRINGS_TAGGED + "HasSongList", //2 GF_HAS_SONGLIST + "TeamMovement", //3 GF_TEAM_MOVEMENT + "UpperButtonText", //4 GF_UPPER_BUTTON_TEXT + "LowerLabelText", //5 GF_LOWER_LABEL_TEXT + "HasPartyIni", //6 GF_HAS_PARTY_INI + "SoundFolders", //7 GF_SOUNDFOLDERS + "IgnoreButtonFrames", //8 GF_IGNORE_BUTTON_FRAMES + "OneByteAnimationID", //9 GF_ONE_BYTE_ANIMID + "HasDPLAYER", //10GF_HAS_DPLAYER + "HasEXPTABLE", //11GF_HAS_EXPTABLE + "HasBeastsIni", //12GF_HAS_BEASTS_INI + "HasDescIcon", //13GF_HAS_DESC_ICON + "HasPickSound", //14GF_HAS_PICK_SOUND + "IWDMapDimensions", //15GF_IWD_MAP_DIMENSIONS + "AutomapIni", //16GF_AUTOMAP_INI + "SmallFog", //17GF_SMALL_FOG + "ReverseDoor", //18GF_REVERSE_DOOR + "ProtagonistTalks", //19GF_PROTAGONIST_TALKS + "HasSpellList", //20GF_HAS_SPELLLIST + "IWD2ScriptName", //21GF_IWD2_SCRIPTNAME + "DialogueScrolls", //22GF_DIALOGUE_SCROLLS + "KnowWorld", //23GF_KNOW_WORLD + "ReverseToHit", //24GF_REVERSE_TOHIT + "SaveForHalfDamage", //25GF_SAVE_FOR_HALF + "CharNameIsGabber", //26GF_CHARNAMEISGABBER + "MagicBit", //27GF_MAGICBIT + "CheckAbilities", //28GF_CHECK_ABILITIES + "ChallengeRating", //29GF_CHALLENGERATING + "SpellBookIconHack", //30GF_SPELLBOOKICONHACK + "EnhancedEffects", //31GF_ENHANCED_EFFECTS +}; + /** Loads gemrb.ini */ bool Interface::LoadGemRBINI() { @@ -2218,37 +2253,13 @@ MaximumAbility = ini->GetKeyAsInt ("resources", "MaximumAbility", 25 ); RedrawTile = ini->GetKeyAsInt( "resources", "RedrawTile", 0 )!=0; - SetFeature( ini->GetKeyAsInt( "resources", "CharNameIsGabber", 0 ), GF_CHARNAMEISGABBER ); - SetFeature( ini->GetKeyAsInt( "resources", "IWD2ScriptName", 0 ), GF_IWD2_SCRIPTNAME ); - SetFeature( ini->GetKeyAsInt( "resources", "HasSpellList", 0 ), GF_HAS_SPELLLIST ); - SetFeature( ini->GetKeyAsInt( "resources", "ProtagonistTalks", 0 ), GF_PROTAGONIST_TALKS ); - SetFeature( ini->GetKeyAsInt( "resources", "AutomapIni", 0 ), GF_AUTOMAP_INI ); - SetFeature( ini->GetKeyAsInt( "resources", "IWDMapDimensions", 0 ), GF_IWD_MAP_DIMENSIONS ); - SetFeature( ini->GetKeyAsInt( "resources", "OneByteAnimationID", 0 ), GF_ONE_BYTE_ANIMID ); - SetFeature( ini->GetKeyAsInt( "resources", "IgnoreButtonFrames", 1 ), GF_IGNORE_BUTTON_FRAMES ); - SetFeature( ini->GetKeyAsInt( "resources", "AllStringsTagged", 1 ), GF_ALL_STRINGS_TAGGED ); - SetFeature( ini->GetKeyAsInt( "resources", "HasDPLAYER", 0 ), GF_HAS_DPLAYER ); - SetFeature( ini->GetKeyAsInt( "resources", "HasPickSound", 0 ), GF_HAS_PICK_SOUND ); - SetFeature( ini->GetKeyAsInt( "resources", "HasDescIcon", 0 ), GF_HAS_DESC_ICON ); - SetFeature( ini->GetKeyAsInt( "resources", "HasEXPTABLE", 0 ), GF_HAS_EXPTABLE ); - SetFeature( ini->GetKeyAsInt( "resources", "HasKaputz", 0 ), GF_HAS_KAPUTZ ); - SetFeature( ini->GetKeyAsInt( "resources", "SoundFolders", 0 ), GF_SOUNDFOLDERS ); - SetFeature( ini->GetKeyAsInt( "resources", "HasSongList", 0 ), GF_HAS_SONGLIST ); - SetFeature( ini->GetKeyAsInt( "resources", "UpperButtonText", 0 ), GF_UPPER_BUTTON_TEXT ); - SetFeature( ini->GetKeyAsInt( "resources", "LowerLabelText", 0 ), GF_LOWER_LABEL_TEXT ); - SetFeature( ini->GetKeyAsInt( "resources", "HasPartyIni", 0 ), GF_HAS_PARTY_INI ); - SetFeature( ini->GetKeyAsInt( "resources", "HasBeastsIni", 0 ), GF_HAS_BEASTS_INI ); - SetFeature( ini->GetKeyAsInt( "resources", "TeamMovement", 0 ), GF_TEAM_MOVEMENT ); - SetFeature( ini->GetKeyAsInt( "resources", "SmallFog", 1 ), GF_SMALL_FOG ); - SetFeature( ini->GetKeyAsInt( "resources", "ReverseDoor", 0 ), GF_REVERSE_DOOR ); - SetFeature( ini->GetKeyAsInt( "resources", "DialogueScrolls", 0 ), GF_DIALOGUE_SCROLLS ); - SetFeature( ini->GetKeyAsInt( "resources", "KnowWorld", 0 ), GF_KNOW_WORLD ); - SetFeature( ini->GetKeyAsInt( "resources", "ReverseToHit", 1 ), GF_REVERSE_TOHIT ); - SetFeature( ini->GetKeyAsInt( "resources", "SaveForHalfDamage", 0 ), GF_SAVE_FOR_HALF ); - SetFeature( ini->GetKeyAsInt( "resources", "MagicBit", 0 ), GF_MAGICBIT ); - SetFeature( ini->GetKeyAsInt( "resources", "CheckAbilities", 0 ), GF_CHECK_ABILITIES ); - SetFeature( ini->GetKeyAsInt( "resources", "ChallengeRating", 0 ), GF_CHALLENGERATING ); - SetFeature( ini->GetKeyAsInt( "resources", "SpellBookIconHack", 0), GF_SPELLBOOKICONHACK ); + + for (i=0;i<GF_COUNT;i++) { + SetFeature( ini->GetKeyAsInt( "resources", game_flags[i], 0 ), i ); + printMessage("Option", "", GREEN); + printf("%s = %s\n", game_flags[i], HasFeature(i)?"yes":"no"); + } + ForceStereo = ini->GetKeyAsInt( "resources", "ForceStereo", 0 ); FreeInterface( ini ); Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-06-21 17:39:20 UTC (rev 4701) @@ -61,8 +61,9 @@ static ieResRef *casting_glows = NULL; static int cgcount = -1; static ieResRef *spell_hits = NULL; +static bool enhanced_effects = false; static int shcount = -1; -//static Color sparkle_rgb[12][5]; + static ScriptedAnimation default_spell_hit; int fx_ac_vs_damage_type_modifier (Actor* Owner, Actor* target, Effect* fx);//00 @@ -221,7 +222,6 @@ int fx_replace_creature (Actor* Owner, Actor* target, Effect *fx);//97 int fx_play_movie (Actor* Owner, Actor* target, Effect* fx);//98 int fx_set_sanctuary_state (Actor* Owner, Actor* target, Effect* fx);//99 -int fx_set_sanctuary_state2 (Actor* Owner, Actor* target, Effect* fx);//99 int fx_set_entangle_state (Actor* Owner, Actor* target, Effect* fx);//9a int fx_set_minorglobe_state (Actor* Owner, Actor* target, Effect* fx);//9b int fx_set_shieldglobe_state (Actor* Owner, Actor* target, Effect* fx);//9c @@ -677,6 +677,7 @@ { "State:Hold", fx_hold_creature, 0 }, //175 { "State:Hold2", fx_hold_creature, 0 },//185 { "State:Hold3", fx_hold_creature_no_icon, 0 }, //109 + { "HoldUndead", fx_hold_creature_no_icon, 0 }, //0x1a8 (iwd2) { "State:Imprisonment", fx_imprisonment, 0 }, { "State:Infravision", fx_set_infravision_state, 0 }, { "State:Invisible", fx_set_invisible_state, 0 }, //both invis or improved invis @@ -723,6 +724,7 @@ FXOpc::FXOpc(void) { core->RegisterOpcodes( sizeof( effectnames ) / sizeof( EffectRef ) - 1, effectnames ); + enhanced_effects=!!core->HasFeature(GF_ENHANCED_EFFECTS); default_spell_hit.SequenceFlags|=IE_VVC_BAM; } @@ -737,7 +739,7 @@ gradient |= (gradient <<16); gradient |= (gradient <<8); for(int i=0;i<7;i++) { - STAT_SET(IE_COLORS+i, gradient); + STAT_SET(IE_COLORS+i, gradient); } } @@ -2371,8 +2373,8 @@ int value = fx->Parameter1; if (value<9) { - STAT_BIT_OR(IE_MINORGLOBE, 1<<value); - return FX_APPLIED; + STAT_BIT_OR(IE_MINORGLOBE, 1<<value); + return FX_APPLIED; } return FX_NOT_APPLIED; } @@ -3028,19 +3030,24 @@ return FX_NOT_APPLIED; } // 0x99 Overlay:Sanctuary +#define ICE_GRADIENT 71 + +static const ieDword fullwhite[7]={ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT}; + int fx_set_sanctuary_state (Actor* /*Owner*/, Actor* target, Effect* fx) { //iwd and bg are a bit different, but we solve the whole stuff in a single opcode if (0) printf( "fx_set_sanctuary_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); if (!fx->Parameter2) { - //this is just one way to decide if we have iwd or bg - if(core->HasFeature(GF_MAGICBIT)) { - fx->Parameter2=1; - } else { - fx->Parameter2=2; - } + fx->Parameter2=1; } STAT_SET_PCF( IE_SANCTUARY, fx->Parameter2); + //a rare event, but this effect gives more in bg2 than in iwd2 + //so we use this flag + if (!enhanced_effects) + { + target->SetLockedPalette(fullwhite); + } return FX_APPLIED; } @@ -3048,7 +3055,10 @@ int fx_set_entangle_state (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_set_entangle_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); - STAT_SET_PCF( IE_ENTANGLE, 1); + if (!fx->Parameter2) { + fx->Parameter2=1; + } + STAT_SET_PCF( IE_ENTANGLE, fx->Parameter2); return FX_APPLIED; } @@ -3258,6 +3268,7 @@ } //0x6d State:Hold3 +//0x1a8 HoldUndead (iwd2) int fx_hold_creature_no_icon (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_hold_creature_no_icon (%2d): Value: %d, IDS: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); @@ -4464,7 +4475,7 @@ if (0) printf( "fx_chaos_shield_modifier (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); STAT_MOD( IE_CHAOSSHIELD ); if (fx->Parameter2) { - target->AddPortraitIcon(PI_CSHIELD); //162 + target->AddPortraitIcon(PI_CSHIELD); //162 } else { target->AddPortraitIcon(PI_CSHIELD2); //163 } Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-21 17:39:20 UTC (rev 4701) @@ -30,6 +30,8 @@ #include "IWDOpc.h" static ieResRef *iwd_spell_hits = NULL; + +static bool enhanced_effects = false; static int shcount = -1; #define PI_PROTFROMEVIL 9 @@ -48,16 +50,23 @@ #define PI_ELEMPROT 93 #define PI_MINORGLOBE 96 #define PI_MAJORGLOBE 97 - +#define PI_SHROUD 98 +#define PI_ANTIMAGIC 99 +#define PI_RESILIENT 100 +#define PI_MINDFLAYER 101 +#define PI_CLOAKOFFEAR 102 #define PI_ENTROPY 103 +#define PI_INSECT 104 #define PI_STORMSHELL 105 -#define PI_LOWERRESIST 106 +//#define PI_LOWERRESIST 106 //this is different in iwd2 and bg2 #define PI_AEGIS 119 #define PI_EXECUTIONER 120 #define PI_FIRESHIELD 121 #define PI_ICESHIELD 122 +#define PI_TORTOISE 125 + #define PI_BLINK 130 #define PI_EMPTYBODY 145 @@ -173,8 +182,41 @@ #define SS_SPELLSHIELD 115 #define SS_STATICCHARGE 116 #define SS_LOWERRESIST 140 -#define SS_ +//icewind visuals (overlays) +#define IWV_SANCTUARY 0 +#define IWV_ENTANGLE 1 +//#define iWV_WISP 2 +#define IWV_SHIELDGLOBE 3 +#define IWV_GREASE 4 +#define IWV_WEB 5 +#define IWV_MINORGLOBE 6 +#define IWV_GLOBEINVUL 7 +#define IWV_FLAMESHROUD 8 +#define IWV_ANTIMAGIC 9 +#define IWV_RESILIENT 10 +#define IWV_PROTFROM 11 +#define IWV_CLOAKFEAR 12 +#define IWV_ENTROPY 13 +#define IWV_FIREAURA 14 +#define IWV_FROSTAURA 15 +#define IWV_INSECT 16 +#define IWV_STORMSHELL 17 +#define IWV_LATHANDER 18 +#define IWV_LATHANDER2 19 +#define IWV_GLATHANDER 20 +#define IWV_GLATHANDER2 21 +#define IWV_SEVENEYES 22 +#define IWV_SEVENEYES2 23 +///24 +///25 +#define IWV_FIRESHIELD 26 +#define IWV_ICESHIELD 27 +#define IWV_FIRESHIELD2 28 +#define IWV_ICESHIELD2 29 +#define IWV_TORTOISE 30 +#define IWV_DEATHARMOR 31 + static int fx_ac_vs_damage_type_modifier_iwd2 (Actor* Owner, Actor* target, Effect* fx);//0 static int fx_ironskins (Actor* Owner, Actor* target, Effect* fx);//da (iwd2) static int fx_fade_rgb (Actor* Owner, Actor* target, Effect* fx);//e8 @@ -367,6 +409,7 @@ IWDOpc::IWDOpc(void) { core->RegisterOpcodes( sizeof( effectnames ) / sizeof( EffectRef ) - 1, effectnames ); + enhanced_effects=!!core->HasFeature(GF_ENHANCED_EFFECTS); } IWDOpc::~IWDOpc(void) @@ -503,6 +546,12 @@ } } +static inline void SetOverlay(Actor *target, unsigned int overlay) +{ + if (overlay>=32) return; + STAT_BIT_OR(IE_SANCTUARY, 1<<overlay); +} + //returns true if spell state is already set or illegal static inline bool SetSpellState(Actor *target, unsigned int spellstate) { @@ -1073,6 +1122,7 @@ } //0x107 ControlUndead (like charm?) +//425 ControlUndead2 int fx_control_undead (Actor* Owner, Actor* target, Effect* fx) { if (0) printf( "fx_control_undead (%2d): General: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); @@ -1160,7 +1210,7 @@ { if (0) printf( "fx_eye_of_the_mind (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYEMIND)) return FX_APPLIED; - target->add_animation("eyemind",-1,0,true); + target->AddAnimation("eyemind",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_MIND); return FX_APPLIED; } @@ -1169,7 +1219,7 @@ { if (0) printf( "fx_eye_of_the_sword (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYESWORD)) return FX_APPLIED; - target->add_animation("eyesword",-1,0,true); + target->AddAnimation("eyesword",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_SWORD); return FX_APPLIED; } @@ -1178,7 +1228,7 @@ { if (0) printf( "fx_eye_of_the_mage (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYEMAGE)) return FX_APPLIED; - target->add_animation("eyemage",-1,0,true); + target->AddAnimation("eyemage",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_MAGE); return FX_APPLIED; } @@ -1187,7 +1237,7 @@ { if (0) printf( "fx_eye_of_venom (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYEVENOM)) return FX_APPLIED; - target->add_animation("eyevenom",-1,0,true); + target->AddAnimation("eyevenom",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_VENOM); return FX_APPLIED; } @@ -1196,7 +1246,7 @@ { if (0) printf( "fx_eye_of_the_spirit (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYESPIRIT)) return FX_APPLIED; - target->add_animation("eyespir",-1,0,true); + target->AddAnimation("eyespir",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_SPIRIT); return FX_APPLIED; } @@ -1205,7 +1255,7 @@ { if (0) printf( "fx_eye_of_fortitude (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYEFORTITUDE)) return FX_APPLIED; - target->add_animation("eyefort",-1,0,true); + target->AddAnimation("eyefort",-1,0,true); EXTSTATE_SET(EXTSTATE_EYE_FORT); return FX_APPLIED; } @@ -1214,7 +1264,7 @@ { if (0) printf( "fx_eye_of_stone (%2d)\n", fx->Opcode ); if (SetSpellState(target, SS_EYESTONE)) return FX_APPLIED; - target->add_animation("eyestone",-1,0,true); + target->AddAnimation("eyestone",-1,0,true); EXTSTATE_SET(0x00000400); return FX_APPLIED; } @@ -1630,9 +1680,11 @@ { if (0) printf( "fx_holy_power (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_HOLYPOWER)) return FX_APPLIED; - target->AddPortraitIcon(PI_HOLYPOWER); - target->SetColorMod(0xff, RGBModifier::ADD, 20, 0x80, 0x80, 0x80); + if (enhanced_effects) { + target->AddPortraitIcon(PI_HOLYPOWER); + target->SetColorMod(0xff, RGBModifier::ADD, 20, 0x80, 0x80, 0x80); + } return FX_APPLIED; } @@ -1640,7 +1692,6 @@ int fx_righteous_wrath (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_righteous_wrath (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); - target->AddPortraitIcon(PI_RIGHTEOUS); if (fx->Parameter2) { if (SetSpellState(target, SS_RIGHTEOUS2)) return FX_APPLIED; @@ -1651,7 +1702,10 @@ if (SetSpellState(target, SS_RIGHTEOUS)) return FX_APPLIED; // } - target->SetColorMod(0xff, RGBModifier::ADD, 30, 0xd7, 0xb6, 0 ); + if (enhanced_effects) { + target->AddPortraitIcon(PI_RIGHTEOUS); + target->SetColorMod(0xff, RGBModifier::ADD, 30, 0xd7, 0xb6, 0 ); + } return FX_APPLIED; } @@ -1685,16 +1739,41 @@ break; } STATE_SET( STATE_CHARMED ); - STAT_SET( IE_EA, enemyally?EA_ENEMY:EA_CHARMED ); + STAT_SET( IE_EA, enemyally?EA_ENEMY:EA_CHARMED ); return FX_APPLIED; } //413 VisualEffectIWD2 -int fx_visual_effect_iwd2 (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +//there are 32 bits, so they will fit on IE_SANCTUARY stat +//i put them there because the first bit is sanctuary +int fx_visual_effect_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_visual_effect_iwd2 (%2d)\n", fx->Opcode); - //what else - return FX_APPLIED; + // + if (0) printf( "fx_visual_effect_iwd2 (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); + unsigned int type = fx->Parameter2; + if (type<32) { + switch(type) { + case 1: + STAT_BIT_OR(IE_ENTANGLE, 1); + break; + case 3: + STAT_BIT_OR(IE_SHIELDGLOBE, 1); + break; + case 4: + STAT_BIT_OR(IE_GREASE, 1); + break; + case 5: + STAT_BIT_OR(IE_WEB, 1); + break; + case 6: case 7: + STAT_BIT_OR(IE_MINORGLOBE, 1); + break; + // some more + } + STAT_BIT_OR(IE_SANCTUARY, 1<<type); + return FX_APPLIED; + } + return FX_NOT_APPLIED; } //414 ResilientSphere @@ -1702,7 +1781,11 @@ { if (0) printf( "fx_resilient_sphere (%2d)\n", fx->Opcode); SetSpellState(target, SS_HELD|SS_RESILIENT); - //what else + STATE_SET(STATE_HELPLESS); + if (enhanced_effects) { + target->AddPortraitIcon(PI_RESILIENT); + SetOverlay(target, IWV_RESILIENT); + } return FX_APPLIED; } @@ -1711,7 +1794,6 @@ { if (0) printf( "fx_barkskin (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_BARKSKIN)) return FX_APPLIED; - target->AddPortraitIcon(PI_BARKSKIN); int bonus; int level = target->GetStat(IE_LEVELCLERIC); @@ -1725,7 +1807,10 @@ bonus=3; } STAT_ADD(IE_ARMORCLASS,bonus); - SetGradient(target, 2); + if (enhanced_effects) { + target->AddPortraitIcon(PI_BARKSKIN); + SetGradient(target, 2); + } return FX_APPLIED; } @@ -1739,7 +1824,6 @@ { if (0) printf( "fx_bleeding_wounds (%2d): Damage: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); - target->AddPortraitIcon(PI_BLEEDING); //also this effect is executed every update ieDword damage; @@ -1762,6 +1846,7 @@ } //percent target->Damage(damage, DAMAGE_POISON, Owner); + target->AddPortraitIcon(PI_BLEEDING); return FX_APPLIED; } @@ -1772,41 +1857,70 @@ { if (0) printf( "fx_free_action_iwd2 (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_FREEACTION)) return FX_APPLIED; - target->AddPortraitIcon(PI_FREEACTION); + + // immunity to the following effects: + // 0x9a Overlay:Entangle, + // 0x9d Overlay:Web + // 0x9e Overlay:Grease + // 0x6d State:Hold3 + // 0x28 State:Slowed + // 0xb0 MovementModifier + if (enhanced_effects) { + target->AddPortraitIcon(PI_FREEACTION); + target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x80, 0x60, 0x60); + } return FX_APPLIED; } + //419 Unconsciousness int fx_unconsciousness (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_unconsciousness (%2d)\n", fx->Opcode); STATE_SET(STATE_HELPLESS|STATE_SLEEP); - target->AddPortraitIcon(PI_UNCONSCIOUS); if (fx->Parameter2) { SetSpellState(target, SS_NOAWAKE); } // + if (enhanced_effects) { + target->AddPortraitIcon(PI_UNCONSCIOUS); + } return FX_APPLIED; } + //420 Death2 (see in core effects) + //421 EntropyShield int fx_entropy_shield (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_entropy_shield (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_ENTROPY)) return FX_APPLIED; - target->AddPortraitIcon(PI_ENTROPY); //immunity to certain projectiles? // // + if (enhanced_effects) { + target->AddPortraitIcon(PI_ENTROPY); + //entropy shield overlay + SetOverlay(target, IWV_ENTROPY); + target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x40, 0xc0, 0x40); + } return FX_APPLIED; } + //422 StormShell int fx_storm_shell (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_storm_shell (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_STORMSHELL)) return FX_APPLIED; - // + STAT_ADD(IE_RESISTFIRE, 15); + STAT_ADD(IE_RESISTCOLD, 15); + STAT_ADD(IE_RESISTELECTRICITY, 15); + + if (enhanced_effects) { + SetOverlay(target, IWV_STORMSHELL); + } return FX_APPLIED; } + //423 ProtectionFromElements int fx_protection_from_elements (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1821,17 +1935,19 @@ STAT_ADD(IE_RESISTMAGICFIRE, 15); STAT_ADD(IE_RESISTMAGICCOLD, 15); - target->SetColorMod(0xff, RGBModifier::ADD, 0x4f, 0, 0, 0xc0); + if (enhanced_effects) { + target->SetColorMod(0xff, RGBModifier::ADD, 0x4f, 0, 0, 0xc0); + } return FX_APPLIED; } -//424 HoldUndead + +//424 HoldUndead (see in core effects, 0x6d) //425 ControlUndead2 (see above) //426 Aegis int fx_aegis (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_aegis (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_AEGIS)) return FX_APPLIED; - target->AddPortraitIcon(PI_AEGIS); //deflection AC bonus // //physical damage reduction @@ -1853,28 +1969,65 @@ STAT_ADD(IE_SAVEWILL, 2); STAT_ADD(IE_SAVEREFLEX, 2); - target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x80, 0x60, 0x60); - SetGradient(target, 14); + if (enhanced_effects) { + target->AddPortraitIcon(PI_AEGIS); + target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x80, 0x60, 0x60); + SetGradient(target, 14); + } return FX_APPLIED; } + //427 ExecutionerEyes int fx_executioner_eyes (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_executioner_eyes (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_EXECUTIONER)) return FX_APPLIED; - target->AddPortraitIcon(PI_EXECUTIONER); STAT_ADD(IE_CRITICALHITBONUS, 4); STAT_ADD(IE_TOHIT, 4); - SetGradient(target, 8); + if (enhanced_effects) { + target->AddPortraitIcon(PI_EXECUTIONER); + SetGradient(target, 8); + } return FX_APPLIED; } + //428 Banish (same as unsummon?) + //429 WhenStruckUseEffectList + //430 ProjectileUseEffectList + //431 EnergyDrain + +static EffectRef fx_energy_drain_ref={"EnergyDrain",NULL,-1}; + +int fx_energy_drain (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_energy_drain (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); + Effect *oldfx = target->fxqueue.HasEffect(fx_energy_drain_ref); + if (oldfx) { + oldfx->Parameter2+=fx->Parameter2; + return FX_NOT_APPLIED; + } + //if there is another energy drain effect, add it up + STAT_SET(IE_LEVELDRAIN, fx->Parameter2); + return FX_APPLIED; +} + //432 TortoiseShell +int fx_tortoise_shell (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_tortoise_shell (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); + if (SetSpellState(target, SS_TORTOISE)) return FX_NOT_APPLIED; + if (enhanced_effects) { + target->AddPortraitIcon(PI_TORTOISE); + SetOverlay(target, IWV_TORTOISE); + } + return FX_APPLIED; +} + //433 Blink int fx_blink (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1929,7 +2082,45 @@ //445 Unknown (empty function in iwd2) //446 SmiteEvil +int fx_smite_evil (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_smite_evil (%2d)\n", fx->Opcode); + SetSpellState(target, SS_SMITEEVIL); + return FX_NOT_APPLIED; +} + //447 Restoration + +static EffectRef fx_disease_ref={"Disease",NULL,-1}; +static EffectRef fx_str_ref={"StrengthModifier",NULL,-1}; +static EffectRef fx_int_ref={"IntelligenceModifier",NULL,-1}; +static EffectRef fx_wis_ref={"WisdomModifier",NULL,-1}; +static EffectRef fx_con_ref={"ConstitutionModifier",NULL,-1}; +static EffectRef fx_dex_ref={"DexterityModifier",NULL,-1}; +static EffectRef fx_cha_ref={"CharismaModifier",NULL,-1}; + +int fx_restoration (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_restoration (%2d)\n", fx->Opcode); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 4); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 5); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 6); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 7); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 8); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 9); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 13); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 14); + target->fxqueue.RemoveAllEffectsWithParam(fx_disease_ref, 15); + + target->fxqueue.RemoveAllDetrimentalEffects(fx_str_ref, BASE_GET(IE_STR)); + target->fxqueue.RemoveAllDetrimentalEffects(fx_int_ref, BASE_GET(IE_INT)); + target->fxqueue.RemoveAllDetrimentalEffects(fx_wis_ref, BASE_GET(IE_WIS)); + target->fxqueue.RemoveAllDetrimentalEffects(fx_con_ref, BASE_GET(IE_CON)); + target->fxqueue.RemoveAllDetrimentalEffects(fx_dex_ref, BASE_GET(IE_DEX)); + target->fxqueue.RemoveAllDetrimentalEffects(fx_cha_ref, BASE_GET(IE_CHR)); + return FX_NOT_APPLIED; +} + //448 AlicornLance int fx_alicorn_lance (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1938,9 +2129,20 @@ ////target->AddPortraitIcon(PI_ALICORN); //no portrait icon STAT_SUB(IE_ARMORCLASS, 2); //color glow + if (enhanced_effects) { + target->SetColorMod(0xff, RGBModifier::ADD, 1, 0xb9, 0xb9, 0xb9); + } return FX_APPLIED; } + //449 CallLightning +int fx_call_lightning (Actor* /*Owner*/, Actor* /*target*/, Effect* fx) +{ + if (0) printf( "fx_call_lightning (%2d)\n", fx->Opcode); + //TODO: implement + return FX_NOT_APPLIED; +} + //450 GlobeInvulnerability int fx_minor_globe (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -1948,21 +2150,26 @@ int state; int icon; int value; + int overlay; if (fx->Parameter2) { state = SS_MAJORGLOBE; icon = PI_MAJORGLOBE; value = 30; //if globe is needed, use 31 + overlay = IWV_GLOBEINVUL; } else { state = SS_MINORGLOBE; icon = PI_MINORGLOBE; value = 14; //if globe is needed use 15 + overlay = IWV_MINORGLOBE; } - if (SetSpellState(target, state)) return FX_APPLIED; - target->AddPortraitIcon(icon); STAT_BIT_OR(IE_MINORGLOBE, value); + if (enhanced_effects) { + target->AddPortraitIcon(icon); + SetOverlay(target,overlay); + } return FX_APPLIED; } @@ -1971,7 +2178,6 @@ { if (0) printf( "fx_lower_resistance (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_LOWERRESIST)) return FX_APPLIED; - target->AddPortraitIcon(PI_LOWERRESIST); STAT_SUB(IE_RESISTMAGIC, 15); return FX_APPLIED; @@ -1984,9 +2190,11 @@ if (0) printf( "fx_bane (%2d)\n", fx->Opcode); if (SetSpellState(target, SS_BANE)) return FX_APPLIED; - target->SetColorMod(0xff, RGBModifier::ADD, 20, 0, 0, 0x80); //do this once target->fxqueue.RemoveAllEffects(fx_bless_ref); + if (enhanced_effects) { + target->SetColorMod(0xff, RGBModifier::ADD, 20, 0, 0, 0x80); + } return FX_APPLIED; } Modified: gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp 2007-06-17 22:57:15 UTC (rev 4700) +++ gemrb/trunk/gemrb/plugins/PSTOpcodes/PSTOpc.cpp 2007-06-21 17:39:20 UTC (rev 4701) @@ -334,15 +334,16 @@ int fx_overlay (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_overlay (%2d): Par2: %d\n", fx->Opcode, fx->Parameter2 ); - target->add_animation(fx->Resource,-1,0,true); + target->AddAnimation(fx->Resource,-1,0,true); //special effects based on fx_param2 return FX_NOT_APPLIED; } //0xca fx_unknown //0x82 fx_bless -static EffectRef fx_glow_ref ={"Color:PulseRGBGlobal",NULL,-1}; +//static EffectRef fx_glow_ref ={"Color:PulseRGBGlobal",NULL,-1}; //pst bless effect spawns a color glow automatically +//but i would rather use the IWD2 method int fx_bless (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_curse (%2d): Par1: %d\n", fx->Opcode, fx->Parameter1 ); @@ -350,14 +351,18 @@ //it should be considered what if we replace the pst invis bit //with this one (losing binary compatibility, gaining easier //invis checks at core level) - if (STATE_GET (STATE_BLESS) ) //curse is non cummulative + if (STATE_GET (STATE_BLESS) ) //curse is non-cumulative return FX_NOT_APPLIED; + + target->SetColorMod(255, RGBModifier::ADD, 0x18, 0xc8, 0xc8, 0xc8); +/* if (!target->fxqueue.HasEffectWithParamPair(fx_glow_ref, 0xc8c8c800,0x300018)) { Effect *newfx = EffectQueue::CreateEffect(fx_glow_ref, 0xc8c8c800,0x300018, fx->TimingMode); //calculating duration newfx->Duration=(fx->Duration-core->GetGame()->GameTime)/6; core->ApplyEffect(newfx, target, target); } +*/ STATE_SET( STATE_BLESS ); STAT_SUB( IE_TOHIT, fx->Parameter1); STAT_SUB( IE_SAVEVSDEATH, fx->Parameter1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-06-22 15:17:52
|
Revision: 4703 http://gemrb.svn.sourceforge.net/gemrb/?rev=4703&view=rev Author: avenger_teambg Date: 2007-06-22 08:17:47 -0700 (Fri, 22 Jun 2007) Log Message: ----------- added possibility to disable 'DeathOnZeroStat' feature Modified Paths: -------------- gemrb/trunk/gemrb/includes/globals.h gemrb/trunk/gemrb/override/iwd2/gemrb.ini gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Interface.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp Modified: gemrb/trunk/gemrb/includes/globals.h =================================================================== --- gemrb/trunk/gemrb/includes/globals.h 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/includes/globals.h 2007-06-22 15:17:47 UTC (rev 4703) @@ -126,9 +126,10 @@ #define GF_CHALLENGERATING 29 //iwd2 #define GF_SPELLBOOKICONHACK 30 //bg2 #define GF_ENHANCED_EFFECTS 31 //iwd2 (maybe iwd/how too) +#define GF_DEATH_ON_ZERO_STAT 32 //not in iwd2 //update this -#define GF_COUNT 32 +#define GF_COUNT 33 //the number of item usage fields (used in CREItem and STOItem) #define CHARGE_COUNTERS 3 Modified: gemrb/trunk/gemrb/override/iwd2/gemrb.ini =================================================================== --- gemrb/trunk/gemrb/override/iwd2/gemrb.ini 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/override/iwd2/gemrb.ini 2007-06-22 15:17:47 UTC (rev 4703) @@ -73,3 +73,4 @@ CharNameIsGabber = 1 MagicBit = 1 ChallengeRating = 1 +DeathOnZeroStat = 0 Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-22 15:17:47 UTC (rev 4703) @@ -85,7 +85,8 @@ ActionButtonRow DefaultButtons = {ACT_TALK, ACT_WEAPON1, ACT_WEAPON2, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_NONE, ACT_INNATE}; -static int QslotTranslation = false; +static bool QslotTranslation = false; +static bool DeathOnZeroStat = true; static char iwd2gemrb[32] = { 0,0,20,2,22,25,0,14, @@ -180,8 +181,8 @@ static int spllevels; //for every game except IWD2 we need to reverse TOHIT -static bool REVERSE_TOHIT=true; -static bool CHECK_ABILITIES=false; +static bool ReverseToHit=true; +static bool CheckAbilities=false; //internal flags for calculating to hit #define WEAPON_FIST 0 @@ -636,26 +637,52 @@ } } -void pcf_con(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +void pcf_stat(Actor *actor, ieDword newValue, ieDword stat) { if ((signed) newValue<=0) { - actor->Die(NULL); + if (DeathOnZeroStat) { + actor->Die(NULL); + } else { + actor->Modified[stat]=1; + } } - //passing 0 because it is ignored anyway + if (actor->InParty) { + core->SetEventFlag(EF_PORTRAIT); + } +} + +void pcf_stat_str(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_STR); +} + +void pcf_stat_int(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_INT); +} + +void pcf_stat_wis(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_WIS); +} + +void pcf_stat_dex(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_DEX); +} + +void pcf_stat_con(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +{ + pcf_stat(actor, newValue, IE_CON); pcf_hitpoint(actor, 0, actor->Modified[IE_HITPOINTS]); } -void pcf_stat(Actor *actor, ieDword /*oldValue*/, ieDword newValue) +void pcf_stat_cha(Actor *actor, ieDword /*oldValue*/, ieDword newValue) { - if ((signed) newValue<=0) { - actor->Die(NULL); - } - if (actor->InParty) { - core->SetEventFlag(EF_PORTRAIT); - } + pcf_stat(actor, newValue, IE_CHR); } -void pcf_gold(Actor *actor, ieDword /*Value*/, ieDword /*newValue*/) +void pcf_gold(Actor *actor, ieDword /*oldValue*/, ieDword /*newValue*/) { //this function will make a party member automatically donate their //gold to the party pool, not the same as in the original engine @@ -829,8 +856,8 @@ NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, //0f NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL,NULL, NULL, NULL, pcf_fatigue, pcf_intoxication, //1f -NULL,NULL,pcf_level,NULL, pcf_stat, NULL, pcf_stat, pcf_stat, -pcf_stat,pcf_con,NULL,NULL, NULL, pcf_gold, pcf_morale, NULL, //2f +NULL,NULL,pcf_level,NULL, pcf_stat_str, NULL, pcf_stat_int, pcf_stat_wis, +pcf_stat_dex,pcf_stat_con,pcf_stat_cha,NULL, NULL, pcf_gold, pcf_morale, NULL, //2f NULL,NULL,NULL,NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL,NULL, NULL, NULL, pcf_entangle, pcf_sanctuary, //3f pcf_minorglobe, pcf_shieldglobe, pcf_grease, pcf_web, pcf_level, pcf_level, NULL, NULL, @@ -909,8 +936,9 @@ } else { sharexp=SX_DIVIDE; } - REVERSE_TOHIT=(bool) core->HasFeature(GF_REVERSE_TOHIT); - CHECK_ABILITIES=(bool) core->HasFeature(GF_CHECK_ABILITIES); + ReverseToHit=(bool) core->HasFeature(GF_REVERSE_TOHIT); + CheckAbilities=(bool) core->HasFeature(GF_CHECK_ABILITIES); + DeathOnZeroStat=(bool) core->HasFeature(GF_DEATH_ON_ZERO_STAT); //this table lists skill groups assigned to classes //it is theoretically possible to create hybrid classes @@ -942,7 +970,7 @@ maximum_values[IE_CON]=i; maximum_values[IE_CHR]=i; maximum_values[IE_WIS]=i; - if (REVERSE_TOHIT) { + if (ReverseToHit) { //all games except iwd2 maximum_values[IE_ARMORCLASS]=20; } else { @@ -2322,7 +2350,7 @@ int Actor::GetToHit(int bonus, ieDword Flags) { int tohit = GetStat(IE_TOHIT); - if (REVERSE_TOHIT) { + if (ReverseToHit) { tohit = ATTACKROLL-tohit; } tohit += bonus; @@ -2450,7 +2478,7 @@ //get target's defense against attack int defense = target->GetStat(IE_ARMORCLASS); defense += core->GetDexterityBonus(STAT_DEX_AC, target->GetStat(IE_DEX) ); - if (REVERSE_TOHIT) { + if (ReverseToHit) { defense = DEFAULTAC - defense; } @@ -3336,7 +3364,7 @@ bool Actor::IsReverseToHit() { - return REVERSE_TOHIT; + return ReverseToHit; } void Actor::InitButtons(ieDword cls) @@ -3513,7 +3541,7 @@ } } - if (!CHECK_ABILITIES) { + if (!CheckAbilities) { return 0; } Modified: gemrb/trunk/gemrb/plugins/Core/Interface.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/plugins/Core/Interface.cpp 2007-06-22 15:17:47 UTC (rev 4703) @@ -2098,7 +2098,7 @@ pl_lowercase[upper]=(ieByte) lower; } -static const char *game_flags[GF_COUNT]={ +static const char *game_flags[GF_COUNT+1]={ "HasKaputz", //0 GF_HAS_KAPUTZ "AllStringsTagged", //1 GF_ALL_STRINGS_TAGGED "HasSongList", //2 GF_HAS_SONGLIST @@ -2131,6 +2131,9 @@ "ChallengeRating", //29GF_CHALLENGERATING "SpellBookIconHack", //30GF_SPELLBOOKICONHACK "EnhancedEffects", //31GF_ENHANCED_EFFECTS + "DeathOnZeroStat", //32GF_DEATH_ON_ZERO_STAT + + NULL //for our own safety, this marks the end of the pole }; /** Loads gemrb.ini */ @@ -2255,6 +2258,10 @@ RedrawTile = ini->GetKeyAsInt( "resources", "RedrawTile", 0 )!=0; for (i=0;i<GF_COUNT;i++) { + if (!game_flags[i]) { + printf("Fix the game flags!\n"); + abort(); + } SetFeature( ini->GetKeyAsInt( "resources", game_flags[i], 0 ), i ); printMessage("Option", "", GREEN); printf("%s = %s\n", game_flags[i], HasFeature(i)?"yes":"no"); Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-21 18:44:27 UTC (rev 4702) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-22 15:17:47 UTC (rev 4703) @@ -302,20 +302,43 @@ static int fx_death_ward (Actor* Owner, Actor* target, Effect* fx); //407 static int fx_holy_power (Actor* Owner, Actor* target, Effect* fx); //408 static int fx_righteous_wrath (Actor* Owner, Actor* target, Effect* fx); //409 +//static int fx_summon_ally_iwd2 (Actor* Owner, Actor* target, Effect* fx); //410 +//static int fx_summon_enemy_iwd2 (Actor* Owner, Actor* target, Effect* fx); //411 static int fx_control (Actor* Owner, Actor* target, Effect* fx); //412 static int fx_visual_effect_iwd2 (Actor* Owner, Actor* target, Effect* fx); //413 static int fx_resilient_sphere (Actor* Owner, Actor* target, Effect* fx); //414 static int fx_barkskin (Actor* Owner, Actor* target, Effect* fx); //415 +static int fx_bleeding_wounds (Actor* Owner, Actor* target, Effect* fx); //416 static int fx_free_action_iwd2 (Actor* Owner, Actor* target, Effect* fx); //418 static int fx_unconsciousness (Actor* Owner, Actor* target, Effect* fx); //419 static int fx_entropy_shield (Actor* Owner, Actor* target, Effect* fx); //421 static int fx_storm_shell (Actor* Owner, Actor* target, Effect* fx); //422 static int fx_protection_from_elements (Actor* Owner, Actor* target, Effect* fx); //423 - +//424 HoldUndead (same as 0x6d) +//425 ControlUndead static int fx_aegis (Actor* Owner, Actor* target, Effect* fx); //426 static int fx_executioner_eyes (Actor* Owner, Actor* target, Effect* fx); //427 + +static int fx_energy_drain (Actor* Owner, Actor* target, Effect* fx); //431 +static int fx_tortoise_shell (Actor* Owner, Actor* target, Effect* fx); //432 +static int fx_blink (Actor* Owner, Actor* target, Effect* fx); //433 + +static int fx_heroic_inspiration (Actor* Owner, Actor* target, Effect* fx); //438 //static int fx_prevent_ai_slowdown (Actor* Owner, Actor* target, Effect* fx); //439 +static int fx_tenser_transformation (Actor* Owner, Actor* target, Effect* fx); //444 +//static int fx_445 (Actor* Owner, Actor* target, Effect* fx); //445 unused +static int fx_smite_evil (Actor* Owner, Actor* target, Effect* fx); //446 +static int fx_restoration (Actor* Owner, Actor* target, Effect* fx); //447 +static int fx_alicorn_lance (Actor* Owner, Actor* target, Effect* fx); //448 +static int fx_call_lightning (Actor* Owner, Actor* target, Effect* fx); //449 +static int fx_globe_invulnerability (Actor* Owner, Actor* target, Effect* fx); //450 +static int fx_lower_resistance (Actor* Owner, Actor* target, Effect* fx); //451 static int fx_bane (Actor* Owner, Actor* target, Effect* fx); //452 +static int fx_power_attack (Actor* Owner, Actor* target, Effect* fx); //453 +static int fx_expertise (Actor* Owner, Actor* target, Effect* fx); //454 +static int fx_arterial_strike (Actor* Owner, Actor* target, Effect* fx); //455 +static int fx_hamstring (Actor* Owner, Actor* target, Effect* fx); //456 +static int fx_rapid_shot (Actor* Owner, Actor* target, Effect* fx); //457 //No need to make these ordered, they will be ordered by EffectQueue static EffectRef effectnames[] = { @@ -387,10 +410,13 @@ { "DeathWard", fx_death_ward, 0}, //407 { "HolyPower", fx_holy_power, 0}, //408 { "RighteousWrath", fx_righteous_wrath, 0}, //409 + { "Control2", fx_control, 0}, //412 { "VisualEffectIWD2", fx_visual_effect_iwd2, 0}, //413 { "ResilientSphere", fx_resilient_sphere, 0}, //414 { "BarkSkin", fx_barkskin, 0}, //415 + { "BleedingWounds", fx_bleeding_wounds, 0},//416 + { "FreeAction2", fx_free_action_iwd2, 0}, //418 { "Unconsciousness", fx_unconsciousness, 0}, //419 { "EntropyShield", fx_entropy_shield, 0}, //421 @@ -399,9 +425,24 @@ { "ControlUndead2", fx_control_undead, 0}, //425 { "Aegis", fx_aegis, 0}, //426 { "ExecutionerEyes", fx_executioner_eyes, 0}, //427 - + { "EnergyDrain", fx_energy_drain, 0}, //431 + { "TortoiseShell", fx_tortoise_shell, 0}, //432 + { "Blink", fx_blink, 0},//433 + { "HeroicInspiration", fx_heroic_inspiration, 0},//438 //{ "PreventAISlowDown", fx_prevent_ai_slowdown, 0}, //439 same as bg2 - { "Bane", fx_bane, 0}, + { "TensersTransformation", fx_tenser_transformation, 0}, //444 + { "SmiteEvil", fx_smite_evil, 0}, //446 + { "Restoration", fx_restoration, 0}, //447 + { "AlicornLance", fx_alicorn_lance, 0}, //448 + { "CallLightning", fx_call_lightning, 0}, //449 + { "GlobeInvulnerability", fx_globe_invulnerability, 0}, //450 + { "LowerResistance", fx_lower_resistance, 0}, //451 + { "Bane", fx_bane, 0}, //452 + { "PowerAttack", fx_power_attack, 0}, //453 + { "Expertise", fx_expertise, 0}, //454 + { "ArterialStrike", fx_arterial_strike, 0}, //455 + { "HamString", fx_hamstring, 0}, //456 + { "RapidShot", fx_rapid_shot, 0}, //457 { NULL, NULL, 0 }, }; @@ -1573,7 +1614,7 @@ int fx_hopelessness (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_hopelessness (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_HOPELESSNESS)) return FX_APPLIED; + if (SetSpellState(target, SS_HOPELESSNESS)) return FX_NOT_APPLIED; target->AddPortraitIcon(PI_HOPELESSNESS); STATE_SET(STATE_HELPLESS); return FX_APPLIED; @@ -2065,11 +2106,21 @@ //same as BG2 OffscreenAIModifier //440 BarbarianRage + //441 MovementRateModifier4 + //442 Unknown (needs research) + //443 MissileDamageReduction +int fx_missile_damage_reduction (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_missile_damage_reduction (%2d)\n", fx->Opcode); + STAT_SET(IE_RESISTMISSILE, fx->Parameter1); + //didn't set the pluses + return FX_APPLIED; +} + //444 TensersTransformation - int fx_tenser_transformation (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_tenser_transformation (%2d)\n", fx->Opcode); @@ -2081,6 +2132,7 @@ } //445 Unknown (empty function in iwd2) + //446 SmiteEvil int fx_smite_evil (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -2144,9 +2196,9 @@ } //450 GlobeInvulnerability -int fx_minor_globe (Actor* /*Owner*/, Actor* target, Effect* fx) +int fx_globe_invulnerability (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_minor_globe (%2d)\n", fx->Opcode); + if (0) printf( "fx_globe_invulnerability (%2d)\n", fx->Opcode); int state; int icon; int value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ave...@us...> - 2007-06-23 20:11:38
|
Revision: 4708 http://gemrb.svn.sourceforge.net/gemrb/?rev=4708&view=rev Author: avenger_teambg Date: 2007-06-23 13:11:38 -0700 (Sat, 23 Jun 2007) Log Message: ----------- refactored overlay handling (layers configurable) Modified Paths: -------------- gemrb/trunk/gemrb/plugins/Core/Actor.cpp gemrb/trunk/gemrb/plugins/Core/Actor.h gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp Added Paths: ----------- gemrb/trunk/gemrb/includes/overlays.h Added: gemrb/trunk/gemrb/includes/overlays.h =================================================================== --- gemrb/trunk/gemrb/includes/overlays.h (rev 0) +++ gemrb/trunk/gemrb/includes/overlays.h 2007-06-23 20:11:38 UTC (rev 4708) @@ -0,0 +1,61 @@ +/* GemRB - Infinity Engine Emulator + * Copyright (C) 2007 The GemRB Project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id: overlays.h 4690 2007-06-09 19:28:00Z avenger_teambg $ + * + */ + +/** + * @file overlays.h + * the possible hardcoded overlays (they got separate stats or bits) + * the numbers are compliant with the internals of IWD2 + * @author The GemRB Project + */ + +#define OVERLAY_COUNT 32 + +#define OV_SANCTUARY 0 +#define OV_ENTANGLE 1 +#define OV_WISP 2 //iwd2 +#define OV_SHIELDGLOBE 3 +#define OV_GREASE 4 +#define OV_WEB 5 +#define OV_MINORGLOBE 6 +#define OV_GLOBE 7 +#define OV_SHROUD 8 +#define OV_ANTIMAGIC 9 +#define OV_RESILIENT 10 +#define OV_NORMALMISS 11 +#define OV_CLOAKFEAR 12 +#define OV_ENTROPY 13 +#define OV_FIREAURA 14 +#define OV_FROSTAURA 15 +#define OV_INSECT 16 +#define OV_STORMSHELL 17 +#define OV_LATH1 18 +#define OV_LATH2 19 +#define OV_GLATH1 20 +#define OV_GLATH2 21 +#define OV_SEVENEYES 22 +#define OV_SEVENEYES2 23 +#define OV_BOUNCE 24 //bouncing +#define OV_BOUNCE2 25 //bouncing activated +#define OV_FIRESHIELD1 26 +#define OV_FIRESHIELD2 27 +#define OV_ICESHIELD1 28 +#define OV_ICESHIELD2 29 +#define OV_TORTOISE 30 +#define OV_DEATHARMOR 31 + Property changes on: gemrb/trunk/gemrb/includes/overlays.h ___________________________________________________________________ Name: svn:eol-style + native Modified: gemrb/trunk/gemrb/plugins/Core/Actor.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-23 19:19:22 UTC (rev 4707) +++ gemrb/trunk/gemrb/plugins/Core/Actor.cpp 2007-06-23 20:11:38 UTC (rev 4708) @@ -26,6 +26,7 @@ #include "Actor.h" #include "Interface.h" #include "../../includes/strrefs.h" +#include "../../includes/overlays.h" #include "Item.h" #include "Spell.h" #include "Projectile.h" @@ -138,45 +139,12 @@ -1,-1,-1, ICE_GRADIENT,ICE_GRADIENT,ICE_GRADIENT, }; -//the possible hardcoded overlays (they got separate stats or bits) -#define OVERLAY_COUNT 32 -#define OV_SANCTUARY 0 -#define OV_ENTANGLE 1 -#define OV_WISP 2 //iwd2 -#define OV_SHIELDGLOBE 3 -#define OV_GREASE 4 -#define OV_WEB 5 -#define OV_MINORGLOBE 6 -#define OV_GLOBE 7 -#define OV_SHROUD 8 -#define OV_ANTIMAGIC 9 -#define OV_RESILIENT 10 -#define OV_NORMALMISS 11 -#define OV_CLOAKFEAR 12 -#define OV_ENTROPY 13 -#define OV_FIREAURA 14 -#define OV_FROSTAURA 15 -#define OV_INSECT 16 -#define OV_STORMSHELL 17 -#define OV_LATH1 18 -#define OV_LATH2 19 -#define OV_GLATH1 20 -#define OV_GLATH2 21 -#define OV_SEVENEYES1 22 -#define OV_SEVENEYES2 23 -#define OV_BOUNCE 24 //bouncing -#define OV_BOUNCE2 25 //bouncing activated -#define OV_FIRESHIELD1 26 -#define OV_FIRESHIELD2 27 -#define OV_ICESHIELD1 28 -#define OV_ICESHIELD2 29 -#define OV_TORTOISE 30 -#define OV_DEATHARMOR 31 - -static ieResRef overlay[OVERLAY_COUNT]={"SANCTRY","SPENTACI","","SPSHIELD", +static ieResRef hc_overlays[OVERLAY_COUNT]={"SANCTRY","SPENTACI","","SPSHIELD", "GREASED","WEBENTD","MINORGLB","","","","","","","","","","","","","","", "","","","SPTURNI2","SPTURNI","","","","","",""}; +static ieDword hc_locations=0x2ba80030; + static int *mxsplwis = NULL; static int spllevels; @@ -693,18 +661,27 @@ } } +static void handle_overlay(Actor*actor, ieResRef overlay, ieDword flag) +{ + if (actor->HasVVCCell(overlay)) + return; + ScriptedAnimation *sca = core->GetScriptedAnimation(overlay, false); + if (sca) { + if (flag) { + sca->ZPos=-1; + } + actor->AddVVCell(sca); + } +} + //de/activates the entangle overlay void pcf_entangle(Actor *actor, ieDword oldValue, ieDword newValue) { if (newValue&1) { - if (actor->HasVVCCell(overlay[OV_ENTANGLE])) - return; - ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_ENTANGLE], false); - actor->AddVVCell(sca); - return; + handle_overlay(actor, hc_overlays[OV_ENTANGLE], hc_locations&(1<<OV_ENTANGLE)); } if (oldValue&1) { - actor->RemoveVVCell(overlay[OV_ENTANGLE], true); + actor->RemoveVVCell(hc_overlays[OV_ENTANGLE], true); } } @@ -717,14 +694,12 @@ for (int i=0;i<32;i++) { if (changed&mask) { if (newValue&mask) { - if (!actor->HasVVCCell(overlay[i])) { - ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[i], false); - actor->AddVVCell(sca); - } + handle_overlay(actor, hc_overlays[i], hc_locations&mask); } else { - actor->RemoveVVCell(overlay[i], true); + actor->RemoveVVCell(hc_overlays[i], true); } } + mask<<=1; } } @@ -732,14 +707,11 @@ void pcf_shieldglobe(Actor *actor, ieDword oldValue, ieDword newValue) { if (newValue&1) { - if (actor->HasVVCCell(overlay[OV_SHIELDGLOBE])) - return; - ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_SHIELDGLOBE], false); - actor->AddVVCell(sca); + handle_overlay(actor, hc_overlays[OV_SHIELDGLOBE],hc_locations&(1<<OV_SHIELDGLOBE) ); return; } if (oldValue&1) { - actor->RemoveVVCell(overlay[OV_SHIELDGLOBE], true); + actor->RemoveVVCell(hc_overlays[OV_SHIELDGLOBE], true); } } @@ -747,14 +719,11 @@ void pcf_minorglobe(Actor *actor, ieDword oldValue, ieDword newValue) { if (newValue&1) { - if (actor->HasVVCCell(overlay[OV_MINORGLOBE])) - return; - ScriptedAnimation *sca = core->GetScriptedAnimation(overlay[OV_MINORGLOBE], false); - actor->AddVVCell(sca); + handle_overlay(actor, hc_overlays[OV_MINORGLOBE],hc_locations&(1<<OV_MINORGLOBE) ); return; } if (oldValue&1) { - actor->RemoveVVCell(overlay[OV_MINORGLOBE], true); + actor->RemoveVVCell(hc_overlays[OV_MINORGLOBE], true); } } @@ -762,13 +731,11 @@ void pcf_grease(Actor *actor, ieDword oldValue, ieDword newValue) { if (newValue&1) { - if (actor->HasVVCCell(overlay[OV_GREASE])) - return; - actor->AddAnimation(overlay[OV_GREASE], -1, -1, 0); + handle_overlay(actor, hc_overlays[OV_GREASE],hc_locations&(1<<OV_GREASE) ); return; } if (oldValue&1) { - actor->RemoveVVCell(overlay[OV_GREASE], true); + actor->RemoveVVCell(hc_overlays[OV_GREASE], true); } } @@ -777,13 +744,11 @@ void pcf_web(Actor *actor, ieDword oldValue, ieDword newValue) { if (newValue&1) { - if (actor->HasVVCCell(overlay[OV_WEB])) - return; - actor->AddAnimation(overlay[OV_WEB], -1, 0, 0); + handle_overlay(actor, hc_overlays[OV_WEB],hc_locations&(1<<OV_WEB) ); return; } if (oldValue&1) { - actor->RemoveVVCell(overlay[OV_WEB], true); + actor->RemoveVVCell(hc_overlays[OV_WEB], true); } } @@ -791,14 +756,12 @@ void pcf_bounce(Actor *actor, ieDword oldValue, ieDword newValue) { if (newValue&1) { - if (actor->HasVVCCell(overlay[OV_BOUNCE])) - return; - actor->AddAnimation(overlay[OV_BOUNCE], -1, -1, 0); + handle_overlay(actor, hc_overlays[OV_BOUNCE],hc_locations&(1<<OV_BOUNCE) ); return; } if (oldValue&1) { //it seems we have to remove it abruptly - actor->RemoveVVCell(overlay[OV_BOUNCE], false); + actor->RemoveVVCell(hc_overlays[OV_BOUNCE], false); } } @@ -1002,9 +965,14 @@ table = core->LoadTable( "overlay" ); tm = core->GetTable( table ); if (tm) { + ieDword mask = 1; for (i=0;i<OVERLAY_COUNT;i++) { const char *tmp = tm->QueryField( i, 0 ); - strnlwrcpy(overlay[i], tmp, 8); + strnlwrcpy(hc_overlays[i], tmp, 8); + if (atoi(tm->QueryField( i, 1))) { + hc_locations|=mask; + } + mask<<=1; } core->DelTable( table ); } @@ -3578,3 +3546,40 @@ return 0; } +//full palette will be shaded in gradient color +void Actor::SetGradient(ieDword gradient) +{ + gradient |= (gradient <<16); + gradient |= (gradient <<8); + for(int i=0;i<7;i++) { + Modified[IE_COLORS+i]=gradient; + } +} + +//sets one bit of the sanctuary stat (used for overlays) +void Actor::SetOverlay(unsigned int overlay) +{ + if (overlay>=32) return; + Modified[IE_SANCTUARY]|=1<<overlay; +} + +//returns true if spell state is already set or illegal +bool Actor::SetSpellState(unsigned int spellstate) +{ + if (spellstate>=192) return true; + unsigned int pos = IE_SPLSTATE_ID1+(spellstate>>5); + unsigned int bit = 1<<(spellstate&31); + if (Modified[pos]&bit) return true; + Modified[pos]|=bit; + return false; +} + +//returns true if the feat exists +bool Actor::HasFeat(unsigned int featindex) +{ + if (featindex>=96) return false; + unsigned int pos = IE_FEATS1+(featindex>>5); + unsigned int bit = 1<<(featindex&31); + if (Modified[pos]&bit) return true; + return false; +} Modified: gemrb/trunk/gemrb/plugins/Core/Actor.h =================================================================== --- gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-06-23 19:19:22 UTC (rev 4707) +++ gemrb/trunk/gemrb/plugins/Core/Actor.h 2007-06-23 20:11:38 UTC (rev 4708) @@ -457,5 +457,13 @@ int Immobile(); /* Returns negative error code if the item is unusable */ int Unusable(Item *item) const; + /* Sets all clown colour to the given gradient */ + void SetGradient(ieDword gradient); + /* Enables an overlay */ + void SetOverlay(unsigned int overlay); + /* Checks and sets a spellstate if it wasn't set yet */ + bool SetSpellState(unsigned int spellstate); + /* Checks a feat */ + bool HasFeat(unsigned int featindex); }; #endif Modified: gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-06-23 19:19:22 UTC (rev 4707) +++ gemrb/trunk/gemrb/plugins/FXOpcodes/FXOpc.cpp 2007-06-23 20:11:38 UTC (rev 4708) @@ -47,7 +47,10 @@ //FIXME: find a way to handle portrait icons better #define PI_HELD 13 #define PI_HASTED 38 +#define PI_FATIGUE 39 #define PI_SLOWED 41 +#define PI_HOPELESS 44 +#define PI_FEEBLEMIND 54 #define PI_STUN 55 #define PI_BOUNCE 65 #define PI_BOUNCE2 67 @@ -488,6 +491,7 @@ { "DamageVsCreature", fx_generic_effect, 0 }, { "Death", fx_death, 0 }, { "Death2", fx_death, 0 }, //(iwd2 effect) + { "Death3", fx_death, 0 }, //(iwd2 effect too, Banish) { "DetectAlignment", fx_detect_alignment, 0 }, { "DetectIllusionsModifier", fx_detect_illusion_modifier, 0 }, { "DexterityModifier", fx_dexterity_modifier, 0 }, @@ -1598,6 +1602,8 @@ BASE_STATE_CURE( STATE_STUNNED ); target->fxqueue.RemoveAllEffects(fx_set_stun_state_ref); target->fxqueue.RemoveAllEffects(fx_hold_creature_no_icon_ref); + target->fxqueue.RemoveAllEffectsWithParam(fx_display_portrait_icon_ref, PI_HELD); + target->fxqueue.RemoveAllEffectsWithParam(fx_display_portrait_icon_ref, PI_HOPELESS); return FX_NOT_APPLIED; } @@ -2064,6 +2070,9 @@ if (0) printf( "fx_set_feebleminded_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); STATE_SET( STATE_FEEBLE ); STAT_SET( IE_INT, 3); + if (enhanced_effects) { + target->AddPortraitIcon(PI_FEEBLEMIND); + } return FX_APPLIED; } @@ -2074,6 +2083,7 @@ if (0) printf( "fx_cure_feebleminded_state (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); STATE_CURE( STATE_FEEBLE ); target->fxqueue.RemoveAllEffects(fx_set_feebleminded_state_ref); + target->fxqueue.RemoveAllEffectsWithParam(fx_display_portrait_icon_ref, PI_FEEBLEMIND); return FX_NOT_APPLIED; } @@ -2749,6 +2759,7 @@ if (STATE_GET (STATE_HOLY) ) //holy power is non cummulative return FX_NOT_APPLIED; STATE_SET( STATE_HOLY ); + //SetSpellState(SS_HOLYMIGHT); STAT_ADD( IE_STR, fx->Parameter1); STAT_ADD( IE_CON, fx->Parameter1); STAT_ADD( IE_DEX, fx->Parameter1); @@ -4406,6 +4417,9 @@ return FX_APPLIED; } //0x123 DisableOverlay +//FIXME: which overlay is disabled? +//if one of the overlays marked by sanctuary, then +//make the bit correspond to it int fx_disable_overlay_modifier (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_disable_overlay_modifier (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); @@ -4413,7 +4427,10 @@ return FX_APPLIED; } //0x124 Protection:Backstab (bg2) -//0x11f Protection:Backstab (how) +//0x11f Protection:Backstab (how, iwd2) +//3 different games, 3 different methods of flagging this +#define SS_NOBACKSTAB 40 + int fx_no_backstab_modifier (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_no_backstab_modifier (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); @@ -4421,6 +4438,8 @@ STAT_SET( IE_DISABLEBACKSTAB, fx->Parameter1 ); //how EXTSTATE_SET(EXTSTATE_NO_BACKSTAB); + //iwd2 + target->SetSpellState(SS_NOBACKSTAB); return FX_APPLIED; } //0x125 OffscreenAIModifier @@ -4625,12 +4644,13 @@ STAT_SET(IE_AVATARREMOVAL, fx->Parameter2); return FX_APPLIED; } -// 0x13c MagicalRest +// 0x13c MagicalRest (also 0x124 Rest) int fx_magical_rest (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_magical_rest (%2d)\n", fx->Opcode ); //instant, full rest target->Rest(0); + target->fxqueue.RemoveAllEffectsWithParam(fx_display_portrait_icon_ref, PI_FATIGUE); return FX_NOT_APPLIED; } Modified: gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp =================================================================== --- gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-23 19:19:22 UTC (rev 4707) +++ gemrb/trunk/gemrb/plugins/IWDOpcodes/IWDOpc.cpp 2007-06-23 20:11:38 UTC (rev 4708) @@ -20,7 +20,7 @@ */ #include "../../includes/win32def.h" -#include "../../includes/strrefs.h" +#include "../../includes/overlays.h" #include "../Core/Actor.h" #include "../Core/EffectQueue.h" #include "../Core/Interface.h" @@ -31,6 +31,17 @@ static ieResRef *iwd_spell_hits = NULL; +//resources for the seven eyes effect +#define EYE_MIND 0 +#define EYE_SWORD 1 +#define EYE_MAGE 2 +#define EYE_VENOM 3 +#define EYE_SPIRIT 4 +#define EYE_FORT 5 +#define EYE_STONE 6 + +static ieResRef SevenEyes[7]={"spin126","spin127","spin128","spin129","spin130","spin131","spin132"}; + static bool enhanced_effects = false; static int shcount = -1; @@ -38,7 +49,7 @@ #define PI_FREEACTION 19 #define PI_BARKSKIN 20 #define PI_NAUSEA 43 -#define PI_HOPELESSNESS 47 +#define PI_HOPELESSNESS 44 #define PI_RIGHTEOUS 67 #define PI_ELEMENTS 76 #define PI_FAITHARMOR 84 @@ -183,41 +194,8 @@ #define SS_STATICCHARGE 116 #define SS_LOWERRESIST 140 -//icewind visuals (overlays) -#define IWV_SANCTUARY 0 -#define IWV_ENTANGLE 1 -//#define iWV_WISP 2 -#define IWV_SHIELDGLOBE 3 -#define IWV_GREASE 4 -#define IWV_WEB 5 -#define IWV_MINORGLOBE 6 -#define IWV_GLOBEINVUL 7 -#define IWV_FLAMESHROUD 8 -#define IWV_ANTIMAGIC 9 -#define IWV_RESILIENT 10 -#define IWV_PROTFROM 11 -#define IWV_CLOAKFEAR 12 -#define IWV_ENTROPY 13 -#define IWV_FIREAURA 14 -#define IWV_FROSTAURA 15 -#define IWV_INSECT 16 -#define IWV_STORMSHELL 17 -#define IWV_LATHANDER 18 -#define IWV_LATHANDER2 19 -#define IWV_GLATHANDER 20 -#define IWV_GLATHANDER2 21 -#define IWV_SEVENEYES 22 -#define IWV_SEVENEYES2 23 -///24 -///25 -#define IWV_FIRESHIELD 26 -#define IWV_ICESHIELD 27 -#define IWV_FIRESHIELD2 28 -#define IWV_ICESHIELD2 29 -#define IWV_TORTOISE 30 -#define IWV_DEATHARMOR 31 - static int fx_ac_vs_damage_type_modifier_iwd2 (Actor* Owner, Actor* target, Effect* fx);//0 +static int fx_draw_upon_holy_might (Actor* Owner, Actor* target, Effect* fx);//84 (iwd2) static int fx_ironskins (Actor* Owner, Actor* target, Effect* fx);//da (iwd2) static int fx_fade_rgb (Actor* Owner, Actor* target, Effect* fx);//e8 static int fx_iwd_visual_spell_hit (Actor* Owner, Actor* target, Effect* fx);//e9 @@ -295,6 +273,7 @@ //iwd2 specific effects static int fx_hopelessness (Actor* Owner, Actor* target, Effect* fx);//400 static int fx_protection_from_evil (Actor* Owner, Actor* target, Effect* fx);//401 +static int fx_add_effects_list (Actor* Owner, Actor* target, Effect* fx);//402 static int fx_armor_of_faith (Actor* Owner, Actor* target, Effect* fx);//403 static int fx_nausea (Actor* Owner, Actor* target, Effect* fx); //404 static int fx_enfeeblement (Actor* Owner, Actor* target, Effect* fx); //405 @@ -325,6 +304,7 @@ static int fx_heroic_inspiration (Actor* Owner, Actor* target, Effect* fx); //438 //static int fx_prevent_ai_slowdown (Actor* Owner, Actor* target, Effect* fx); //439 +static int fx_missile_damage_reduction (Actor* Owner, Actor* target, Effect* fx); //443 static int fx_tenser_transformation (Actor* Owner, Actor* target, Effect* fx); //444 //static int fx_445 (Actor* Owner, Actor* target, Effect* fx); //445 unused static int fx_smite_evil (Actor* Owner, Actor* target, Effect* fx); //446 @@ -343,6 +323,7 @@ //No need to make these ordered, they will be ordered by EffectQueue static EffectRef effectnames[] = { { "ACVsDamageTypeModifierIWD2", fx_ac_vs_damage_type_modifier_iwd2, 0}, //0 + { "DrawUponHolyMight", fx_draw_upon_holy_might, 0},//84 (iwd2) { "IronSkins", fx_ironskins, 0}, //da (iwd2) { "Color:FadeRGB", fx_fade_rgb, 0}, //e8 { "IWDVisualSpellHit", fx_iwd_visual_spell_hit, 0}, //e9 @@ -403,6 +384,7 @@ //iwd2 effects { "Hopelessness", fx_hopelessness, 0}, //400 { "ProtectionFromEvil", fx_protection_from_evil, 0}, //401 + { "AddEffectsList", fx_add_effects_list, 0}, //402 { "ArmorOfFaith", fx_armor_of_faith, 0}, //403 { "Nausea", fx_nausea, 0}, //404 { "Enfeeblement", fx_enfeeblement, 0}, //405 @@ -430,6 +412,7 @@ { "Blink", fx_blink, 0},//433 { "HeroicInspiration", fx_heroic_inspiration, 0},//438 //{ "PreventAISlowDown", fx_prevent_ai_slowdown, 0}, //439 same as bg2 + { "MissileDamageReduction", fx_missile_damage_reduction, 0}, //443 { "TensersTransformation", fx_tenser_transformation, 0}, //444 { "SmiteEvil", fx_smite_evil, 0}, //446 { "Restoration", fx_restoration, 0}, //447 @@ -552,7 +535,7 @@ case STI_AREATYPE: return DiffCore((ieDword) target->GetCurrentArea()->AreaType, val, spellres[type].relation); case STI_MORAL_ALIGNMENT: - return DiffCore(Owner->GetStat(IE_ALIGNMENT)&0x3,target->GetStat(IE_ALIGNMENT)&0x3, spellres[type].relation); + return DiffCore(Owner->GetStat(IE_ALIGNMENT)&0x3,STAT_GET(IE_ALIGNMENT)&0x3, spellres[type].relation); case STI_TWO_ROWS: if (check_iwd_targeting(Owner, target, value, idx)) return 0; if (check_iwd_targeting(Owner, target, value, val)) return 0; @@ -574,46 +557,10 @@ case STI_CIRCLESIZE: return DiffCore((ieDword) target->GetAnims()->GetCircleSize(), val, spellres[type].relation); default: - return DiffCore(target->GetStat(idx), val, spellres[type].relation); + return DiffCore(STAT_GET(idx), val, spellres[type].relation); } } -static inline void SetGradient(Actor *target, ieDword gradient) -{ - gradient |= (gradient <<16); - gradient |= (gradient <<8); - for(int i=0;i<7;i++) { - STAT_SET(IE_COLORS+i, gradient); - } -} - -static inline void SetOverlay(Actor *target, unsigned int overlay) -{ - if (overlay>=32) return; - STAT_BIT_OR(IE_SANCTUARY, 1<<overlay); -} - -//returns true if spell state is already set or illegal -static inline bool SetSpellState(Actor *target, unsigned int spellstate) -{ - if (spellstate>=192) return true; - unsigned int pos = IE_SPLSTATE_ID1+(spellstate>>5); - unsigned int bit = 1<<(spellstate&31); - if (target->GetStat(pos)&bit) return true; - STAT_BIT_OR(pos, bit); - return false; -} - -//returns true if the feat exists -static inline bool HasFeat(Actor *target, unsigned int featindex) -{ - if (featindex>=96) return false; - unsigned int pos = IE_FEATS1+(featindex>>5); - unsigned int bit = 1<<(featindex&31); - if (target->GetStat(pos)&bit) return true; - return false; -} - //iwd got a hardcoded 'fireshield' system //this effect applies damage on ALL nearby actors, except the center static EffectRef fx_damage_opcode_ref={"Damage",NULL,-1}; @@ -707,6 +654,20 @@ return FX_PERMANENT; } +// 0x84 DrawUponHolyMight +// this effect differs from bg2 because it doesn't use the actor state field +// it uses the spell state field +int fx_draw_upon_holy_might (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_draw_upon_holy_might (%2d): Mod: %d, Type: %d\n", fx->Opcode, fx->Parameter1, fx->Parameter2 ); + + if (target->SetSpellState( SS_HOLYMIGHT)) return FX_NOT_APPLIED; + STAT_ADD( IE_STR, fx->Parameter1); + STAT_ADD( IE_CON, fx->Parameter1); + STAT_ADD( IE_DEX, fx->Parameter1); + return FX_APPLIED; +} + //0xda IronSkins (iwd2) int fx_ironskins (Actor* /*Owner*/, Actor* target, Effect* fx) { @@ -715,13 +676,13 @@ //abort effect when param3 goes below 0 if (fx->Parameter2) { //ironskins - if (SetSpellState(target, SS_IRONSKIN)) return FX_NOT_APPLIED; + if (target->SetSpellState( SS_IRONSKIN)) return FX_NOT_APPLIED; return FX_APPLIED; } //stoneskins (iwd2) - if (SetSpellState(target, SS_STONESKIN)) return FX_NOT_APPLIED; - SetGradient(target, 14); + if (target->SetSpellState( SS_STONESKIN)) return FX_NOT_APPLIED; + target->SetGradient(14); return FX_APPLIED; } @@ -792,7 +753,7 @@ { if (0) printf( "fx_chill_touch (%2d)\n", fx->Opcode); target->Damage(fx->Parameter1, DAMAGE_COLD, Owner); - if (target->GetStat(IE_GENERAL)==GEN_UNDEAD) { + if (STAT_GET(IE_GENERAL)==GEN_UNDEAD) { target->Panic(); } return FX_NOT_APPLIED; @@ -803,7 +764,7 @@ int fx_chill_touch_panic (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_chill_touch_panic (%2d)\n", fx->Opcode); - STAT_SET(IE_MORALE, target->GetStat(IE_MORALEBREAK)); + STAT_SET(IE_MORALE, STAT_GET(IE_MORALEBREAK)); return FX_APPLIED; } @@ -1020,7 +981,7 @@ int fx_lich_touch (Actor* Owner, Actor* target, Effect* fx) { if (0) printf( "fx_lich_touch (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - if (target->GetStat(IE_GENERAL)==GEN_UNDEAD) { + if (STAT_GET(IE_GENERAL)==GEN_UNDEAD) { return FX_NOT_APPLIED; } target->Damage(DICE_ROLL(0), DAMAGE_COLD, Owner); @@ -1040,7 +1001,7 @@ int fx_blinding_orb (Actor* Owner, Actor* target, Effect* fx) { ieDword damage = fx->Parameter1; - if (target->GetStat(IE_GENERAL)==GEN_UNDEAD) { + if (STAT_GET(IE_GENERAL)==GEN_UNDEAD) { damage *= 2; } //check saving throw @@ -1250,84 +1211,90 @@ int fx_eye_of_the_mind (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_mind (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYEMIND)) return FX_APPLIED; - target->AddAnimation("eyemind",-1,0,true); + if (target->SetSpellState( SS_EYEMIND)) return FX_APPLIED; EXTSTATE_SET(EXTSTATE_EYE_MIND); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_MIND], 0); return FX_APPLIED; } //0x10d EyeOfTheSword int fx_eye_of_the_sword (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_sword (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYESWORD)) return FX_APPLIED; - target->AddAnimation("eyesword",-1,0,true); + if (target->SetSpellState( SS_EYESWORD)) return FX_APPLIED; EXTSTATE_SET(EXTSTATE_EYE_SWORD); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_SWORD], 0); return FX_APPLIED; } + //0x10e EyeOfTheMage int fx_eye_of_the_mage (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_mage (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYEMAGE)) return FX_APPLIED; - target->AddAnimation("eyemage",-1,0,true); + if (target->SetSpellState( SS_EYEMAGE)) return FX_APPLIED; EXTSTATE_SET(EXTSTATE_EYE_MAGE); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_MAGE], 0); return FX_APPLIED; } + //0x10f EyeOfVenom int fx_eye_of_venom (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_venom (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYEVENOM)) return FX_APPLIED; - target->AddAnimation("eyevenom",-1,0,true); + if (target->SetSpellState( SS_EYEVENOM)) return FX_APPLIED; EXTSTATE_SET(EXTSTATE_EYE_VENOM); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_VENOM], 0); return FX_APPLIED; } + //0x110 EyeOfTheSpirit int fx_eye_of_the_spirit (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_the_spirit (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYESPIRIT)) return FX_APPLIED; - target->AddAnimation("eyespir",-1,0,true); + if (target->SetSpellState( SS_EYESPIRIT)) return FX_APPLIED; EXTSTATE_SET(EXTSTATE_EYE_SPIRIT); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_SPIRIT], 0); return FX_APPLIED; } + //0x111 EyeOfFortitude int fx_eye_of_fortitude (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_fortitude (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYEFORTITUDE)) return FX_APPLIED; - target->AddAnimation("eyefort",-1,0,true); + if (target->SetSpellState( SS_EYEFORTITUDE)) return FX_APPLIED; EXTSTATE_SET(EXTSTATE_EYE_FORT); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_FORT], 0); return FX_APPLIED; } + //0x112 EyeOfStone int fx_eye_of_stone (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_eye_of_stone (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_EYESTONE)) return FX_APPLIED; - target->AddAnimation("eyestone",-1,0,true); - EXTSTATE_SET(0x00000400); + if (target->SetSpellState( SS_EYESTONE)) return FX_APPLIED; + EXTSTATE_SET(EXTSTATE_EYE_STONE); + //TODO: first run + target->LearnSpell(SevenEyes[EYE_STONE], 0); return FX_APPLIED; } + //0x113 RemoveSevenEyes -static EffectRef fx_eye1_ref={"EyeOfTheMind",NULL,-1}; -static EffectRef fx_eye2_ref={"EyeOfTheSword",NULL,-1}; -static EffectRef fx_eye3_ref={"EyeOfTheMage",NULL,-1}; -static EffectRef fx_eye4_ref={"EyeOfVenom",NULL,-1}; -static EffectRef fx_eye5_ref={"EyeOfThespirit",NULL,-1}; -static EffectRef fx_eye6_ref={"EyeOfFortitude",NULL,-1}; -static EffectRef fx_eye7_ref={"EyeOfStone",NULL,-1}; int fx_remove_seven_eyes (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_remove_seven_eyes (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - target->fxqueue.RemoveAllEffects(fx_eye1_ref); - target->fxqueue.RemoveAllEffects(fx_eye2_ref); - target->fxqueue.RemoveAllEffects(fx_eye3_ref); - target->fxqueue.RemoveAllEffects(fx_eye4_ref); - target->fxqueue.RemoveAllEffects(fx_eye5_ref); - target->fxqueue.RemoveAllEffects(fx_eye6_ref); - target->fxqueue.RemoveAllEffects(fx_eye7_ref); + target->spellbook.RemoveSpell(SevenEyes[EYE_MIND]); + target->spellbook.RemoveSpell(SevenEyes[EYE_SWORD]); + target->spellbook.RemoveSpell(SevenEyes[EYE_MAGE]); + target->spellbook.RemoveSpell(SevenEyes[EYE_VENOM]); + target->spellbook.RemoveSpell(SevenEyes[EYE_SPIRIT]); + target->spellbook.RemoveSpell(SevenEyes[EYE_FORT]); + target->spellbook.RemoveSpell(SevenEyes[EYE_STONE]); return FX_NOT_APPLIED; } @@ -1380,7 +1347,7 @@ int fx_shroud_of_flame2 (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_shroud_of_flame2 (%2d)\n", fx->Opcode ); - if (SetSpellState(target, SS_FLAMESHROUD)) return FX_APPLIED; + if (target->SetSpellState( SS_FLAMESHROUD)) return FX_APPLIED; //timing if (core->GetGame()->GameTime%6) { return FX_APPLIED; @@ -1394,7 +1361,7 @@ int fx_animal_rage (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_animal_rage (%2d): Count %d\n", fx->Opcode, fx->Parameter1 ); - if (SetSpellState(target, SS_ANIMALRAGE)) return FX_APPLIED; + if (target->SetSpellState( SS_ANIMALRAGE)) return FX_APPLIED; //timing if (core->GetGame()->GameTime%6) { return FX_APPLIED; @@ -1458,7 +1425,7 @@ } target->Damage(fx->Parameter1, DAMAGE_ACID, Owner); fx->DiceThrown-=2; - if (fx->DiceThrown<1) { + if ((signed) fx->DiceThrown<1) { return FX_NOT_APPLIED; } //also damage people nearby? @@ -1470,7 +1437,7 @@ int fx_suppress_hp (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_suppress_hp (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_NOHPINFO)) return FX_APPLIED; + if (target->SetSpellState( SS_NOHPINFO)) return FX_APPLIED; EXTSTATE_SET(0x00001000); return FX_APPLIED; } @@ -1496,16 +1463,54 @@ } //0x11c MaceOfDisruption -int fx_mace_of_disruption (Actor* /*Owner*/, Actor* target, Effect* fx) +//death with chance based on race and level +static EffectRef fx_death_ref={"Death",NULL,-1}; + +int fx_mace_of_disruption (Actor* Owner, Actor* target, Effect* fx) { if (0) printf( "fx_mace_of_disruption (%2d): ResRef:%s Anim:%s Type: %d\n", fx->Opcode, fx->Resource, fx->Resource2, fx->Parameter2 ); - ieDword race = target->GetStat(IE_RACE); + ieDword race = STAT_GET(IE_RACE); //golem / outer planar gets hit + int chance = 0; switch (race) { - case 144: // golem + case 156: // outsider + chance = 5; break; + case 108: case 115: case 167: //ghoul, skeleton, undead + switch (STAT_GET(IE_LEVEL)) { + case 1: case 2: case 3: case 4: + chance = 100; + break; + case 5: + chance = 95; + break; + case 6: + chance = 80; + break; + case 7: + chance = 65; + break; + case 8: case 9: + chance = 50; + break; + case 10: + chance = 35; + break; + default: + chance = 20; + break; + } + break; default:; } + if (chance>core->Roll(1,100,0)) { + return FX_NOT_APPLIED; + } + + + Effect *newfx = EffectQueue::CreateEffect(fx_death_ref, 0, + 8, FX_DURATION_INSTANT_PERMANENT); + core->ApplyEffect(newfx, Owner, target); return FX_NOT_APPLIED; } //0x11d Sleep2 ??? power word sleep? @@ -1516,8 +1521,12 @@ int fx_set_state (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_set_state (%2d): Type: %d\n", fx->Opcode, fx->Parameter2 ); - //in HoW this also sets the last bits of extstate (until it runs out of bits) - EXTSTATE_SET(0x40000<<fx->Parameter2); + //in IWD2 we have 176 states (original had 256) + target->SetSpellState(fx->Parameter2); + //in HoW this sets only the 10 last bits of extstate (until it runs out of bits) + if (fx->Parameter2<11) { + EXTSTATE_SET(0x40000<<fx->Parameter2); + } return FX_APPLIED; } @@ -1567,16 +1576,45 @@ } //0x123 RodOfSmithing -int fx_rod_of_smithing (Actor* /*Owner*/, Actor* target, Effect* fx) +//if golem: 5% death or 1d8+3 damage +//if outsider: 5% 8d3 damage or nothing +//otherwise: nothing +int fx_rod_of_smithing (Actor* Owner, Actor* target, Effect* fx) { if (0) printf( "fx_rod_of_smithing (%2d): ResRef:%s Anim:%s Type: %d\n", fx->Opcode, fx->Resource, fx->Resource2, fx->Parameter2 ); - ieDword race = target->GetStat(IE_RACE); + ieDword race = STAT_GET(IE_RACE); //golem / outer planar gets hit + int damage; + switch (race) { case 144: // golem + if (core->Roll(1,100,0)>5) { + damage = core->Roll(1,8,3); + } else { + damage = -1; + } break; + case 156: //outsider + if (core->Roll(1,100,0)>5) { + return FX_NOT_APPLIED; + } + damage = core->Roll(8,3,0); + break; default:; + return FX_NOT_APPLIED; } + + Effect *newfx; + if (damage<0) { + //create death effect (chunked death) + newfx = EffectQueue::CreateEffect(fx_death_ref, 0, + 8, FX_DURATION_INSTANT_PERMANENT); + } else { + //create damage effect (blunt) + newfx = EffectQueue::CreateEffect(fx_damage_opcode_ref, (ieDword) damage, + 0, FX_DURATION_INSTANT_PERMANENT); + } + core->ApplyEffect(newfx, Owner, target); return FX_NOT_APPLIED; } @@ -1614,7 +1652,7 @@ int fx_hopelessness (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_hopelessness (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_HOPELESSNESS)) return FX_NOT_APPLIED; + if (target->SetSpellState( SS_HOPELESSNESS)) return FX_NOT_APPLIED; target->AddPortraitIcon(PI_HOPELESSNESS); STATE_SET(STATE_HELPLESS); return FX_APPLIED; @@ -1625,7 +1663,7 @@ { if (0) printf( "fx_protection_from_evil (%2d)\n", fx->Opcode); // - if (SetSpellState(target, SS_PROTFROMEVIL)) return FX_APPLIED; + if (target->SetSpellState( SS_PROTFROMEVIL)) return FX_APPLIED; target->AddPortraitIcon(PI_PROTFROMEVIL); //+2 to all saving throws STAT_ADD( IE_SAVEFORTITUDE, 2); @@ -1653,7 +1691,7 @@ static int fx_armor_of_faith (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_armor_of_faith (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_ARMOROFFAITH)) return FX_APPLIED; + if (target->SetSpellState( SS_ARMOROFFAITH)) return FX_APPLIED; //TODO: damage reduction (all types) target->AddPortraitIcon(PI_FAITHARMOR); return FX_APPLIED; @@ -1674,7 +1712,7 @@ fx->Parameter3=1; } //end of unsure part - if (SetSpellState(target, SS_NAUSEA)) return FX_APPLIED; + if (target->SetSpellState( SS_NAUSEA)) return FX_APPLIED; target->AddPortraitIcon(PI_NAUSEA); STATE_SET(STATE_HELPLESS|STATE_SLEEP); return FX_APPLIED; @@ -1685,7 +1723,7 @@ int fx_enfeeblement (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_enfeeblement (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_ENFEEBLED)) return FX_APPLIED; + if (target->SetSpellState( SS_ENFEEBLED)) return FX_APPLIED; target->AddPortraitIcon(PI_ENFEEBLEMENT); STAT_ADD(IE_STR, -15); return FX_APPLIED; @@ -1696,10 +1734,10 @@ { if (0) printf( "fx_fireshield (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); if (fx->Parameter2) { - if (SetSpellState(target, SS_ICESHIELD)) return FX_APPLIED; + if (target->SetSpellState( SS_ICESHIELD)) return FX_APPLIED; target->AddPortraitIcon(PI_ICESHIELD); } else { - if (SetSpellState(target, SS_FIRESHIELD)) return FX_APPLIED; + if (target->SetSpellState( SS_FIRESHIELD)) return FX_APPLIED; target->AddPortraitIcon(PI_FIRESHIELD); } //target->SetSpellOnHit(fx->Resource); @@ -1710,7 +1748,7 @@ int fx_death_ward (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_death_ward (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_DEATHWARD)) return FX_APPLIED; + if (target->SetSpellState( SS_DEATHWARD)) return FX_APPLIED; target->AddPortraitIcon(PI_DEATHWARD); // is it ok? return FX_APPLIED; @@ -1720,7 +1758,7 @@ int fx_holy_power (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_holy_power (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_HOLYPOWER)) return FX_APPLIED; + if (target->SetSpellState( SS_HOLYPOWER)) return FX_APPLIED; if (enhanced_effects) { target->AddPortraitIcon(PI_HOLYPOWER); @@ -1735,12 +1773,12 @@ if (0) printf( "fx_righteous_wrath (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); if (fx->Parameter2) { - if (SetSpellState(target, SS_RIGHTEOUS2)) return FX_APPLIED; + if (target->SetSpellState( SS_RIGHTEOUS2)) return FX_APPLIED; // } else { - if (SetSpellState(target, SS_RIGHTEOUS)) return FX_APPLIED; + if (target->SetSpellState( SS_RIGHTEOUS)) return FX_APPLIED; // } if (enhanced_effects) { @@ -1794,24 +1832,27 @@ unsigned int type = fx->Parameter2; if (type<32) { switch(type) { - case 1: + case OV_ENTANGLE: STAT_BIT_OR(IE_ENTANGLE, 1); break; - case 3: + case OV_SHIELDGLOBE: STAT_BIT_OR(IE_SHIELDGLOBE, 1); break; - case 4: + case OV_GREASE: STAT_BIT_OR(IE_GREASE, 1); break; - case 5: + case OV_WEB: STAT_BIT_OR(IE_WEB, 1); break; - case 6: case 7: + case OV_MINORGLOBE: case OV_GLOBE: STAT_BIT_OR(IE_MINORGLOBE, 1); break; + case OV_SEVENEYES: + target->SetOverlay(OV_SEVENEYES2); // some more } - STAT_BIT_OR(IE_SANCTUARY, 1<<type); + target->SetOverlay(type); + //STAT_BIT_OR(IE_SANCTUARY, 1<<type); return FX_APPLIED; } return FX_NOT_APPLIED; @@ -1821,11 +1862,11 @@ int fx_resilient_sphere (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_resilient_sphere (%2d)\n", fx->Opcode); - SetSpellState(target, SS_HELD|SS_RESILIENT); + target->SetSpellState(SS_HELD|SS_RESILIENT); STATE_SET(STATE_HELPLESS); if (enhanced_effects) { target->AddPortraitIcon(PI_RESILIENT); - SetOverlay(target, IWV_RESILIENT); + target->SetOverlay(OV_RESILIENT); } return FX_APPLIED; } @@ -1834,10 +1875,10 @@ int fx_barkskin (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_barkskin (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_BARKSKIN)) return FX_APPLIED; + if (target->SetSpellState( SS_BARKSKIN)) return FX_APPLIED; int bonus; - int level = target->GetStat(IE_LEVELCLERIC); + int level = STAT_GET(IE_LEVELCLERIC); if (level>6) { if (level>12) { bonus=5; @@ -1850,7 +1891,7 @@ STAT_ADD(IE_ARMORCLASS,bonus); if (enhanced_effects) { target->AddPortraitIcon(PI_BARKSKIN); - SetGradient(target, 2); + target->SetGradient(2); } return FX_APPLIED; } @@ -1870,7 +1911,7 @@ switch(fx->Parameter2) { case RPD_PERCENT: - damage = target->GetStat(IE_MAXHITPOINTS) * fx->Parameter1 / 100; + damage = STAT_GET(IE_MAXHITPOINTS) * fx->Parameter1 / 100; break; case RPD_SECONDS: damage = 1; @@ -1897,7 +1938,7 @@ int fx_free_action_iwd2 (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_free_action_iwd2 (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_FREEACTION)) return FX_APPLIED; + if (target->SetSpellState( SS_FREEACTION)) return FX_APPLIED; // immunity to the following effects: // 0x9a Overlay:Entangle, @@ -1919,7 +1960,7 @@ if (0) printf( "fx_unconsciousness (%2d)\n", fx->Opcode); STATE_SET(STATE_HELPLESS|STATE_SLEEP); if (fx->Parameter2) { - SetSpellState(target, SS_NOAWAKE); + target->SetSpellState(SS_NOAWAKE); } // if (enhanced_effects) { @@ -1934,14 +1975,14 @@ int fx_entropy_shield (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_entropy_shield (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_ENTROPY)) return FX_APPLIED; + if (target->SetSpellState( SS_ENTROPY)) return FX_APPLIED; //immunity to certain projectiles? // // if (enhanced_effects) { target->AddPortraitIcon(PI_ENTROPY); //entropy shield overlay - SetOverlay(target, IWV_ENTROPY); + target->SetOverlay(OV_ENTROPY); target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x40, 0xc0, 0x40); } return FX_APPLIED; @@ -1951,13 +1992,13 @@ int fx_storm_shell (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_storm_shell (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_STORMSHELL)) return FX_APPLIED; + if (target->SetSpellState(SS_STORMSHELL)) return FX_APPLIED; STAT_ADD(IE_RESISTFIRE, 15); STAT_ADD(IE_RESISTCOLD, 15); STAT_ADD(IE_RESISTELECTRICITY, 15); if (enhanced_effects) { - SetOverlay(target, IWV_STORMSHELL); + target->SetOverlay(OV_STORMSHELL); } return FX_APPLIED; } @@ -1966,7 +2007,7 @@ int fx_protection_from_elements (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_protection_from_elements (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_ELEMPROT)) return FX_APPLIED; + if (target->SetSpellState( SS_ELEMPROT)) return FX_APPLIED; target->AddPortraitIcon(PI_ELEMPROT); STAT_ADD(IE_RESISTFIRE, 15); STAT_ADD(IE_RESISTCOLD, 15); @@ -1988,7 +2029,7 @@ int fx_aegis (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_aegis (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_AEGIS)) return FX_APPLIED; + if (target->SetSpellState( SS_AEGIS)) return FX_APPLIED; //deflection AC bonus // //physical damage reduction @@ -2013,7 +2054,7 @@ if (enhanced_effects) { target->AddPortraitIcon(PI_AEGIS); target->SetColorMod(0xff, RGBModifier::ADD, 30, 0x80, 0x60, 0x60); - SetGradient(target, 14); + target->SetGradient(14); } return FX_APPLIED; } @@ -2022,19 +2063,19 @@ int fx_executioner_eyes (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_executioner_eyes (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_EXECUTIONER)) return FX_APPLIED; + if (target->SetSpellState( SS_EXECUTIONER)) return FX_APPLIED; STAT_ADD(IE_CRITICALHITBONUS, 4); STAT_ADD(IE_TOHIT, 4); if (enhanced_effects) { target->AddPortraitIcon(PI_EXECUTIONER); - SetGradient(target, 8); + target->SetGradient(8); } return FX_APPLIED; } -//428 Banish (same as unsummon?) +//428 Death3 (also a death effect) //429 WhenStruckUseEffectList @@ -2061,10 +2102,10 @@ int fx_tortoise_shell (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_tortoise_shell (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); - if (SetSpellState(target, SS_TORTOISE)) return FX_NOT_APPLIED; + if (target->SetSpellState( SS_TORTOISE)) return FX_NOT_APPLIED; if (enhanced_effects) { target->AddPortraitIcon(PI_TORTOISE); - SetOverlay(target, IWV_TORTOISE); + target->SetOverlay(OV_TORTOISE); } return FX_APPLIED; } @@ -2073,7 +2114,7 @@ int fx_blink (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_blink (%2d) Type: %d\n", fx->Opcode, fx->Parameter2); - if (SetSpellState(target, SS_BLINK)) return FX_APPLIED; + if (target->SetSpellState( SS_BLINK)) return FX_APPLIED; if(fx->Parameter2) { target->AddPortraitIcon(PI_EMPTYBODY); return FX_APPLIED; @@ -2085,7 +2126,17 @@ //434 PersistentUseEffectList //435 DayBlindness + //436 DamageReduction +int fx_damage_reduction (Actor* /*Owner*/, Actor* target, Effect* fx) +{ + if (0) printf( "fx_damage_reduction (%2d) Amount: %d\n", fx->Opcode, fx->Parameter2); + STAT_SET(IE_RESISTSLASHING, fx->Parameter2*5); + STAT_SET(IE_RESISTCRUSHING, fx->Parameter2*5); + STAT_SET(IE_RESISTPIERCING, fx->Parameter2*5); + return FX_APPLIED; +} + //437 Disguise //438 HeroicInspiration int fx_heroic_inspiration (Actor* /*Owner*/, Actor* target, Effect* fx) @@ -2114,9 +2165,9 @@ //443 MissileDamageReduction int fx_missile_damage_reduction (Actor* /*Owner*/, Actor* target, Effect* fx) { - if (0) printf( "fx_missile_damage_reduction (%2d)\n", fx->Opcode); + if (0) printf( "fx_missile_damage_reduction (%2d) Amount:%d\n", fx->Opcode, fx->Parameter1); STAT_SET(IE_RESISTMISSILE, fx->Parameter1); - //didn't set the pluses + //TODO: didn't set the pluses return FX_APPLIED; } @@ -2124,10 +2175,12 @@ int fx_tenser_transformation (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_tenser_transformation (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_TENSER)) return FX_APPLIED; + if (target->SetSpellState( SS_TENSER)) return FX_APPLIED; STAT_SUB(IE_ARMORCLASS, 2); - SetGradient(target, 0x3e); + if (enhanced_effects) { + target->SetGradient(0x3e); + } return FX_APPLIED; } @@ -2137,7 +2190,7 @@ int fx_smite_evil (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_smite_evil (%2d)\n", fx->Opcode); - SetSpellState(target, SS_SMITEEVIL); + target->SetSpellState(SS_SMITEEVIL); return FX_NOT_APPLIED; } @@ -2177,7 +2230,7 @@ int fx_alicorn_lance (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_alicorn_lance (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_ALICORNLANCE)) return FX_APPLIED; + if (target->SetSpellState( SS_ALICORNLANCE)) return FX_APPLIED; ////target->AddPortraitIcon(PI_ALICORN); //no portrait icon STAT_SUB(IE_ARMORCLASS, 2); //color glow @@ -2208,19 +2261,19 @@ state = SS_MAJORGLOBE; icon = PI_MAJORGLOBE; value = 30; //if globe is needed, use 31 - overlay = IWV_GLOBEINVUL; + overlay = OV_GLOBE; } else { state = SS_MINORGLOBE; icon = PI_MINORGLOBE; value = 14; //if globe is needed use 15 - overlay = IWV_MINORGLOBE; + overlay = OV_MINORGLOBE; } - if (SetSpellState(target, state)) return FX_APPLIED; + if (target->SetSpellState( state)) return FX_APPLIED; STAT_BIT_OR(IE_MINORGLOBE, value); if (enhanced_effects) { target->AddPortraitIcon(icon); - SetOverlay(target,overlay); + target->SetOverlay(overlay); } return FX_APPLIED; } @@ -2229,7 +2282,7 @@ int fx_lower_resistance (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_lower_resistance (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_LOWERRESIST)) return FX_APPLIED; + if (target->SetSpellState( SS_LOWERRESIST)) return FX_APPLIED; STAT_SUB(IE_RESISTMAGIC, 15); return FX_APPLIED; @@ -2241,7 +2294,7 @@ { if (0) printf( "fx_bane (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_BANE)) return FX_APPLIED; + if (target->SetSpellState( SS_BANE)) return FX_APPLIED; //do this once target->fxqueue.RemoveAllEffects(fx_bless_ref); if (enhanced_effects) { @@ -2254,7 +2307,8 @@ int fx_power_attack (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_power_attack (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_POWERATTACK)) return FX_APPLIED; + if (target->SetSpellState( SS_POWERATTACK)) return FX_APPLIED; + //TODO: return FX_APPLIED; } @@ -2262,7 +2316,8 @@ int fx_expertise (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_expertise (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_EXPERTISE)) return FX_APPLIED; + if (target->SetSpellState( SS_EXPERTISE)) return FX_APPLIED; + //TODO: return FX_APPLIED; } @@ -2270,7 +2325,8 @@ int fx_arterial_strike (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_arterial_strike (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_ARTERIAL)) return FX_APPLIED; + if (target->SetSpellState( SS_ARTERIAL)) return FX_APPLIED; + //TODO: return FX_APPLIED; } @@ -2278,7 +2334,8 @@ int fx_hamstring (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_hamstring (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_HAMSTRING)) return FX_APPLIED; + if (target->SetSpellState( SS_HAMSTRING)) return FX_APPLIED; + //TODO: return FX_APPLIED; } @@ -2286,6 +2343,7 @@ int fx_rapid_shot (Actor* /*Owner*/, Actor* target, Effect* fx) { if (0) printf( "fx_rapid_shot (%2d)\n", fx->Opcode); - if (SetSpellState(target, SS_RAPIDSHOT)) return FX_APPLIED; + if (target->SetSpellState( SS_RAPIDSHOT)) return FX_APPLIED; + //TODO: return FX_APPLIED; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |