From: Laszlo T. <ave...@us...> - 2010-08-01 22:01:23
|
gemrb: Infinity Engine emulator The branch master has been updated via 6a1b778dfe0526e363e7159962a5b7e1058cc37c (commit) Summary of changes: gemrb/core/GUI/GameControl.cpp | 71 +++++++++++++++++++-------------------- gemrb/core/Interface.cpp | 18 +++++----- gemrb/core/Inventory.h | 2 +- gemrb/core/Scriptable/Actor.cpp | 27 ++++++++++++++- gemrb/core/Scriptable/Actor.h | 4 ++ gemrb/override/bg2/qslot2.2da | 4 ++ 6 files changed, 78 insertions(+), 48 deletions(-) create mode 100644 gemrb/override/bg2/qslot2.2da from 181e4fbce7451886a6c203e564bd7fd6e8042503 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=6a1b778dfe0526e363e7159962a5b7e1058cc37c commit 6a1b778dfe0526e363e7159962a5b7e1058cc37c Author: Avenger <ave...@so...> Date: Mon Aug 2 00:00:11 2010 +0200 implemented special quickslot configurations fixed CanUseItemType fixed a crasher with wizard eye diff --git a/gemrb/core/GUI/GameControl.cpp b/gemrb/core/GUI/GameControl.cpp index 0ab6c32..d4b5bea 100644 --- a/gemrb/core/GUI/GameControl.cpp +++ b/gemrb/core/GUI/GameControl.cpp @@ -1791,72 +1791,71 @@ void GameControl::OnMouseUp(unsigned short x, unsigned short y, unsigned short B return; } - if (!actor && ( game->selected.size() > 0 )) { - if (overDoor) { - HandleDoor(overDoor, core->GetFirstSelectedPC(false)); - return; - } - if (overContainer) { - HandleContainer(overContainer, core->GetFirstSelectedPC(false)); - return; - } - if (overInfoPoint) { - if (HandleActiveRegion(overInfoPoint, core->GetFirstSelectedPC(false), p)) { + //this could be a non-PC + Actor *pc = NULL; + if (game->selected.size()>0) { + pc = game->selected[0]; + } + + if (!actor) { + if (pc) { + if (overDoor) { + HandleDoor(overDoor, pc); return; } + if (overContainer) { + HandleContainer(overContainer, pc); + return; + } + if (overInfoPoint) { + if (HandleActiveRegion(overInfoPoint, pc, p)) { + return; + } + } } //just a single actor, no formation if (game->selected.size()==1) { //the player is using an item or spell on the ground if ((target_mode == TARGET_MODE_CAST) && spellCount) { - TryToCast(core->GetFirstSelectedPC(false), p); + TryToCast(pc, p); return; } - actor=game->selected[0]; - actor->ClearPath(); - actor->ClearActions(); - CreateMovement(actor, p); + pc->ClearPath(); + pc->ClearActions(); + CreateMovement(pc, p); //p is a searchmap travel region - if ( actor->GetCurrentArea()->GetCursor(p) == IE_CURSOR_TRAVEL) { + if ( pc->GetCurrentArea()->GetCursor(p) == IE_CURSOR_TRAVEL) { sprintf( Tmp, "NIDSpecial2()" ); - actor->AddAction( GenerateAction( Tmp) ); + pc->AddAction( GenerateAction( Tmp) ); } return; } // construct a sorted party - // TODO: this is beyond horrible, help + // TODO: this is still ugly, help? std::vector<Actor *> party; // first, from the actual party - for (int idx = 0; idx < game->GetPartySize(false); idx++) { - Actor *pc = game->FindPC(idx + 1); - if (!pc) continue; - - for (unsigned int j = 0; j < game->selected.size(); j++) { - if (game->selected[j] == pc) { - party.push_back(pc); - } + int idx = game->GetPartySize(false); + while(idx--) { + Actor *act = game->FindPC(idx+1); + if(act->IsSelected()) { + party.push_back(act); } } - - // then, anything else we selected for (i = 0; i < game->selected.size(); i++) { - bool found = false; - for (unsigned int j = 0; j < party.size(); j++) { - if (game->selected[i] == party[j]) { - found = true; - break; - } + Actor *act = game->selected[i]; + if (!act->InParty) { + party.push_back(act); } - if (!found) party.push_back(game->selected[i]); } //party formation movement Point src = party[0]->Pos; for(i = 0; i < party.size(); i++) { actor = party[i]; +printf("Party order:%d %s\n", i+1, actor->ShortName); actor->ClearPath(); actor->ClearActions(); MoveToPointFormation(actor, i, src, p); diff --git a/gemrb/core/Interface.cpp b/gemrb/core/Interface.cpp index 775f8b1..018e428 100644 --- a/gemrb/core/Interface.cpp +++ b/gemrb/core/Interface.cpp @@ -4012,15 +4012,19 @@ const char *Interface::QuerySlotResRef(unsigned int idx) const int Interface::CanUseItemType(int slottype, Item *item, Actor *actor, bool feedback, bool equipped) const { //inventory is a special case, we allow any items to enter it - if ( slottype==SLOT_ALL ) { + if ( slottype==-1 ) { return SLOT_INVENTORY; } //if we look for ALL slot types, then SLOT_SHIELD shouldn't interfere //with twohandedness - if ((slottype&SLOT_SHIELD) && (slottype!=SLOT_ANY) ) { - //As long as this is an Item, use the ITEM constant - //switch for IE_INV_ITEM_* if it is a CREItem - if (item->Flags&IE_ITEM_TWO_HANDED) { + //As long as this is an Item, use the ITEM constant + //switch for IE_INV_ITEM_* if it is a CREItem + if (item->Flags&IE_ITEM_TWO_HANDED) { + //if the item is twohanded and there are more slots, drop the shield slot + if (slottype&~SLOT_SHIELD) { + slottype&=~SLOT_SHIELD; + } + if (slottype&SLOT_SHIELD) { //cannot equip twohanded in offhand if (feedback) displaymsg->DisplayConstantString(STR_NOT_IN_OFFHAND, 0xf0f0f0); return 0; @@ -4052,10 +4056,6 @@ int Interface::CanUseItemType(int slottype, Item *item, Actor *actor, bool feedb //if any bit is true, the answer counts as true int ret = (slotmatrix[item->ItemType]&slottype); - //this part is not needed, in any case, don't use ret = 1 - /*if (slottype == SLOT_INVENTORY || slottype == SLOT_ANY) { - ret = 1; - }*/ if (!ret) { if (feedback) displaymsg->DisplayConstantString(STR_WRONGITEMTYPE, 0xf0f0f0); return 0; diff --git a/gemrb/core/Inventory.h b/gemrb/core/Inventory.h index b422d93..720d5b8 100644 --- a/gemrb/core/Inventory.h +++ b/gemrb/core/Inventory.h @@ -67,7 +67,7 @@ class Map; #define SLOT_POTION 16384 #define SLOT_ANY 32767 #define SLOT_INVENTORY 32768 -#define SLOT_ALL -1 +#define SLOT_ALL 65535 //weapon slot types (1000==not equipped) #define IW_NO_EQUIPPED 1000 diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index b7f0d78..957fd2f 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -69,6 +69,7 @@ static const Color magenta = { static int sharexp = SX_DIVIDE; static int classcount = -1; +static int extraslots = -1; static char **clericspelltables = NULL; static char **druidspelltables = NULL; static char **wizardspelltables = NULL; @@ -81,8 +82,6 @@ static int xpbonuslevels = -1; static int **levelslots = NULL; static int *dualswap = NULL; static int *maxhpconbon = NULL; -//static ieVariable IWDDeathVarFormat = "KILL_%s_CNT"; -//static ieVariable DeathVarFormat = "SPRITE_IS_DEAD%s"; static ieVariable CounterNames[4]={"GOOD","LAW","LADY","MURDER"}; static int FistRows = -1; @@ -165,6 +164,7 @@ static unsigned int monkbon_rows = 0; #define CLASS_FLAMINGFIST 156 static ActionButtonRow *GUIBTDefaults = NULL; //qslots row count +static ActionButtonRow2 *OtherGUIButtons = NULL; 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}; @@ -1271,6 +1271,9 @@ void Actor::ReleaseMemory() free (GUIBTDefaults); GUIBTDefaults=NULL; } + if (OtherGUIButtons) { + free (OtherGUIButtons); + } classcount = -1; } @@ -1488,6 +1491,20 @@ static void InitActorTables() } } + tm.load("qslot2"); + if (tm) { + extraslots = tm->GetRowCount(); + OtherGUIButtons = (ActionButtonRow2 *) calloc( extraslots, sizeof (ActionButtonRow2) ); + + for (i=0; i<usecount; i++) { + OtherGUIButtons[i].clss = (ieByte) atoi( tm->QueryField(i,0) ); + memcpy(OtherGUIButtons[i].buttons, &DefaultButtons, sizeof(ActionButtonRow)); + for (int j=0;j<MAX_QSLOTS;j++) { + OtherGUIButtons[i].buttons[j+3]=(ieByte) atoi( tm->QueryField(i,j+1) ); + } + } + } + tm.load("itemuse"); if (tm) { usecount = tm->GetRowCount(); @@ -5665,6 +5682,12 @@ void Actor::InitButtons(ieDword cls, bool forced) ActionButtonRow myrow; if ((int) cls >= classcount) { memcpy(&myrow, &DefaultButtons, sizeof(ActionButtonRow)); + for (int i=0;i<extraslots;i++) { + if (cls==OtherGUIButtons[i].clss) { + memcpy(&myrow, &OtherGUIButtons[i].buttons, sizeof(ActionButtonRow)); + break; + } + } } else { memcpy(&myrow, GUIBTDefaults+cls, sizeof(ActionButtonRow)); } diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h index 45230bb..15f1379 100644 --- a/gemrb/core/Scriptable/Actor.h +++ b/gemrb/core/Scriptable/Actor.h @@ -169,6 +169,10 @@ class ScriptedAnimation; #define DR_IMMUNE 999999 typedef ieByte ActionButtonRow[GUIBT_COUNT]; +struct ActionButtonRow2 { + ActionButtonRow buttons; + ieByte clss; +}; typedef std::vector< ScriptedAnimation*> vvcVector; typedef std::list<ieResRef*> resourceList; diff --git a/gemrb/override/bg2/qslot2.2da b/gemrb/override/bg2/qslot2.2da new file mode 100644 index 0000000..656a1e4 --- /dev/null +++ b/gemrb/override/bg2/qslot2.2da @@ -0,0 +1,4 @@ +2DA V1.0 +100 + CLASS SLOT1 SLOT2 SLOT3 SLOT4 SLOT5 SLOT6 SLOT7 SLOT8 SLOT9 +WIZARDEYE 0xd1 100 100 100 100 100 100 100 100 100 ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |