Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

...
  • 3 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
8 gemrb/core/GameScript/Actions.cpp
View
@@ -459,12 +459,10 @@ void GameScript::SetTeamBit(Scriptable* Sender, Action* parameters)
void GameScript::TriggerActivation(Scriptable* Sender, Action* parameters)
{
- Scriptable* ip;
+ Scriptable* ip = Sender;
- if (!parameters->objects[1]) {
- ip=Sender;
- } else {
- ip = Sender->GetCurrentArea()->TMap->GetInfoPoint(parameters->objects[1]->objectName);
+ if (parameters->objects[1]) {
+ ip = GetActorFromObject(Sender, parameters->objects[1]);
}
if (!ip || (ip->Type!=ST_TRIGGER && ip->Type!=ST_TRAVEL && ip->Type!=ST_PROXIMITY)) {
Log(WARNING, "Actions", "Script error: No Trigger Named \"%s\"", parameters->objects[1]->objectName);
8 gemrb/core/Inventory.cpp
View
@@ -1065,7 +1065,7 @@ int Inventory::FindTypedRangedWeapon(unsigned int type) const
//always look for a ranged header when looking for a projectile/projector
ITMExtHeader *ext_header = itm->GetWeaponHeader(true);
int weapontype = 0;
- if (ext_header) {
+ if (ext_header && (ext_header->AttackType == ITEM_AT_BOW)) {
weapontype = ext_header->ProjectileQualifier;
}
gamedata->FreeItem(itm, Slot->ItemResRef, false);
@@ -1285,6 +1285,12 @@ int Inventory::GetEquippedHeader() const
return EquippedHeader;
}
+void Inventory::SetEquipped(ieWordSigned slot, ieWord header)
+{
+ Equipped = slot;
+ EquippedHeader = header;
+}
+
//returns the fist weapon if there is nothing else
//This will return the actual weapon, I mean the bow in the case of bow+arrow combination
CREItem *Inventory::GetUsedWeapon(bool leftorright, int &slot) const
1  gemrb/core/Inventory.h
View
@@ -277,6 +277,7 @@ class GEM_EXPORT Inventory {
bool SetEquippedSlot(ieWordSigned slotcode, ieWord header);
int GetEquipped() const;
int GetEquippedHeader() const;
+ void SetEquipped(ieWordSigned slot, ieWord header);
//right hand
int GetEquippedSlot() const;
//left hand
26 gemrb/core/Scriptable/Actor.cpp
View
@@ -476,8 +476,6 @@ Actor::Actor()
nextBored = 0;
inventory.SetInventoryType(INVENTORY_CREATURE);
- Equipped = 0;
- EquippedHeader = 0;
fxqueue.SetOwner( this );
inventory.SetOwner( this );
@@ -4267,12 +4265,8 @@ void Actor::SetMap(Map *map)
//case of quivers. (weird IE magic)
//The other word is the equipped header.
//find a quiver for the bow, etc
- if (Equipped!=IW_NO_EQUIPPED) {
- inventory.EquipItem( Equipped+inventory.GetWeaponSlot());
- } else {
- inventory.EquipItem(inventory.GetFistSlot());
- }
- SetEquippedQuickSlot( inventory.GetEquipped(), EquippedHeader );
+ inventory.EquipItem(inventory.GetEquippedSlot());
+ SetEquippedQuickSlot(inventory.GetEquipped(), inventory.GetEquippedHeader());
}
}
@@ -5659,7 +5653,7 @@ ieDword Actor::GetNumberOfAttacks()
bonus = 2 * IsDualWielding();
return base + bonus;
} else {
- if (monkbon != NULL && Equipped == IW_NO_EQUIPPED) {
+ if (monkbon != NULL && inventory.GetEquipped() == IW_NO_EQUIPPED) {
unsigned int level = GetMonkLevel();
if (level>=monkbon_cols) level=monkbon_cols-1;
if (level>0) {
@@ -5726,7 +5720,7 @@ int Actor::SetBaseAPRandAB(bool CheckRapidShot)
// act as a rogue unless barefisted and without armor
// multiclassed monks only use their monk levels when determining barefisted bab
// check the spell failure instead of the skill penalty, since otherwise leather armor would also be treated as none
- if (Equipped != IW_NO_EQUIPPED || GetTotalArmorFailure()) {
+ if (inventory.GetEquipped() != IW_NO_EQUIPPED || GetTotalArmorFailure()) {
pBAB += SetLevelBAB(MonkLevel, ISTHIEF);
} else {
pBABDecrement = 3;
@@ -5926,7 +5920,7 @@ bool Actor::GetCombatDetails(int &tohit, bool leftorright, WeaponInfo& wi, ITMEx
prof += -4;
} else {
// everyone is proficient with fists
- if (Equipped != IW_NO_EQUIPPED) {
+ if (inventory.GetEquipped() != IW_NO_EQUIPPED) {
prof += wspecial[stars][0];
}
}
@@ -5940,7 +5934,7 @@ bool Actor::GetCombatDetails(int &tohit, bool leftorright, WeaponInfo& wi, ITMEx
//Is it a PC class?
if (clss < (ieDword) classcount) {
// but skip fists, since they don't have a proficiency
- if (Equipped != IW_NO_EQUIPPED) {
+ if (inventory.GetEquipped() != IW_NO_EQUIPPED) {
prof += defaultprof[clss];
}
} else {
@@ -7931,9 +7925,7 @@ int Actor::SetEquippedQuickSlot(int slot, int header)
}
//if it is the fist slot and not currently used, then set it up
if (i==MAX_QUICKWEAPONSLOT) {
- Equipped = IW_NO_EQUIPPED;
- EquippedHeader = 0;
- inventory.SetEquippedSlot(Equipped, EquippedHeader);
+ inventory.SetEquippedSlot(IW_NO_EQUIPPED, 0);
return 0;
}
}
@@ -7946,8 +7938,6 @@ int Actor::SetEquippedQuickSlot(int slot, int header)
PCStats->QuickWeaponHeaders[slot]=header;
}
slot = inventory.GetWeaponQuickSlot(PCStats->QuickWeaponSlots[slot]);
- Equipped = (ieWordSigned) slot;
- EquippedHeader = (ieWord) header;
if (inventory.SetEquippedSlot(slot, header)) {
return 0;
}
@@ -8784,8 +8774,6 @@ Actor *Actor::CopySelf(bool mislead) const
newActor->inventory.SetSlotCount(inventory.GetSlotCount());
} else {
newActor->inventory.CopyFrom(this);
- newActor->Equipped = Equipped;
- newActor->EquippedHeader = EquippedHeader;
if (PCStats) {
newActor->CreateStats();
memcpy(newActor->PCStats, PCStats, sizeof(PCStatsStruct));
2  gemrb/core/Scriptable/Actor.h
View
@@ -303,8 +303,6 @@ class GEM_EXPORT Actor : public Movable {
ieByte SetDeathVar, IncKillCount, UnknownField; // boolean fields from iwd1 and iwd2
Inventory inventory;
- ieWordSigned Equipped; //the equipped weapon slot
- ieWord EquippedHeader; //the used extended header
Spellbook spellbook;
//savefile version (creatures embedded in area)
int version;
7 gemrb/plugins/CREImporter/CREImporter.cpp
View
@@ -1243,6 +1243,8 @@ void CREImporter::ReadInventory(Actor *act, unsigned int Inventory_Size)
ieWord *indices = (ieWord *) calloc(Inventory_Size, sizeof(ieWord));
//CREItem** items;
unsigned int i,j,k;
+ ieWordSigned eqslot;
+ ieWord eqheader;
act->inventory.SetSlotCount(Inventory_Size+1);
str->Seek( ItemSlotsOffset+CREOffset, GEM_STREAM_START );
@@ -1256,9 +1258,10 @@ void CREImporter::ReadInventory(Actor *act, unsigned int Inventory_Size)
// 1000 - fist
// -24,-23,-22,-21 - quiver
//the equipping effects are delayed until the actor gets an area
- str->ReadWordSigned( &act->Equipped );
+ str->ReadWordSigned(&eqslot);
//the equipped slot's selected ability is stored here
- str->ReadWord( &act->EquippedHeader );
+ str->ReadWord(&eqheader);
+ act->inventory.SetEquipped(eqslot, eqheader);
//read the item entries based on the previously read indices
//an item entry may be read multiple times if the indices are repeating

No commit comments for this range

Something went wrong with that request. Please try again.