# HG changeset patch # User zipi # Date 1383414358 0 # Node ID 33787c8938a554f6ce1b8abca71165747458db2a # Parent 7e2dd49832b5e127d2294996a26cf13994e4394f Single and Two-handed ENUM diff -r 7e2dd49832b5 -r 33787c8938a5 Actor.cpp --- a/Actor.cpp Sat Nov 02 17:24:31 2013 +0000 +++ b/Actor.cpp Sat Nov 02 17:45:58 2013 +0000 @@ -3622,7 +3622,7 @@ { int main_hand_idx = player->pEquipment.uMainHand; IsAdditionalDamagePossible = true; - if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) + if ( player->HasItemEquipped(EQUIP_TWO_HANDED) ) { uint main_hand_skill = player->GetMainHandItem()->GetPlayerSkillType(); uint main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); diff -r 7e2dd49832b5 -r 33787c8938a5 Items.cpp --- a/Items.cpp Sat Nov 02 17:24:31 2013 +0000 +++ b/Items.cpp Sat Nov 02 17:45:58 2013 +0000 @@ -549,17 +549,17 @@ { if ( !_stricmp(test_string, "weapon") ) { - pItems[item_counter].uEquipType = EQUIP_OFF_HAND; + pItems[item_counter].uEquipType = EQUIP_SINGLE_HANDED; break; } if ( !_stricmp(test_string, "weapon2") ) { - pItems[item_counter].uEquipType = EQUIP_MAIN_HAND; + pItems[item_counter].uEquipType = EQUIP_TWO_HANDED; break; } if ( !_stricmp(test_string, "weapon1or2") ) { - pItems[item_counter].uEquipType = EQUIP_OFF_HAND; + pItems[item_counter].uEquipType = EQUIP_SINGLE_HANDED; break; } if ( !(_stricmp(test_string, "missile")&&_stricmp(test_string, "bow"))) @@ -1618,7 +1618,7 @@ PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; switch (uTreasureType) { - case 20: requested_equip = EQUIP_OFF_HAND; break; + case 20: requested_equip = EQUIP_SINGLE_HANDED; break; case 21: requested_equip = EQUIP_ARMOUR; break; case 22: requested_skill = PLAYER_SKILL_MISC; break; case 23: requested_skill = PLAYER_SKILL_SWORD; break; @@ -1769,8 +1769,8 @@ //try get special enhansment switch (out_item->GetItemEquipType()) { - case EQUIP_OFF_HAND: - case EQUIP_MAIN_HAND : + case EQUIP_SINGLE_HANDED: + case EQUIP_TWO_HANDED : case EQUIP_BOW : if ( !uBonusChanceWpSpecial[v6] ) return; diff -r 7e2dd49832b5 -r 33787c8938a5 Items.h --- a/Items.h Sat Nov 02 17:24:31 2013 +0000 +++ b/Items.h Sat Nov 02 17:45:58 2013 +0000 @@ -164,8 +164,8 @@ /* 331 */ enum ITEM_EQUIP_TYPE: unsigned __int8 { - EQUIP_OFF_HAND = 0, - EQUIP_MAIN_HAND = 1, + EQUIP_SINGLE_HANDED = 0, + EQUIP_TWO_HANDED = 1, EQUIP_BOW = 2, EQUIP_ARMOUR = 3, EQUIP_SHIELD = 4, diff -r 7e2dd49832b5 -r 33787c8938a5 Player.cpp --- a/Player.cpp Sat Nov 02 17:24:31 2013 +0000 +++ b/Player.cpp Sat Nov 02 17:45:58 2013 +0000 @@ -87,8 +87,8 @@ unsigned char pEquipTypeToBodyAnchor[21] = // 4E8398 { - 1, // EQUIP_OFF_HAND - 1, // EQUIP_MAIN_HAND + 1, // EQUIP_SINGLE_HANDED + 1, // EQUIP_TWO_HANDED 2, // EQUIP_BOW 3, // EQUIP_ARMOUR 0, // EQUIP_SHIELD @@ -1550,7 +1550,7 @@ } else { - if ( HasItemEquipped(EQUIP_MAIN_HAND) ) + if ( HasItemEquipped(EQUIP_TWO_HANDED) ) { ItemGen *mainHandItemGen = this->GetMainHandItem(); int itemId = mainHandItemGen->uItemID; @@ -1561,7 +1561,7 @@ } if ( !ignoreOffhand ) { - if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) + if ( this->HasItemEquipped(EQUIP_SINGLE_HANDED) ) { ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1]; if ( offHandItemGen->GetItemEquipType() != EQUIP_SHIELD ) @@ -1908,8 +1908,8 @@ //----- (0048D676) -------------------------------------------------------- bool Player::IsUnarmed() { - return !HasItemEquipped(EQUIP_MAIN_HAND) && - (!HasItemEquipped(EQUIP_OFF_HAND) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD); + return !HasItemEquipped(EQUIP_TWO_HANDED) && + (!HasItemEquipped(EQUIP_SINGLE_HANDED) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD); } //----- (0048D6AA) -------------------------------------------------------- @@ -1979,7 +1979,7 @@ v8 = SkillToMastery(v6); itemvalue = itemToSteal->GetValue(); v10 = itemToSteal->GetItemEquipType(); - if ( v10 == EQUIP_OFF_HAND || v10 == EQUIP_MAIN_HAND || v10 == EQUIP_BOW ) + if ( v10 == EQUIP_SINGLE_HANDED || v10 == EQUIP_TWO_HANDED || v10 == EQUIP_BOW ) itemvalue *= 3; currMaxItemValue = StealingRandomBonuses[rand() % 5] + v7 * StealingMasteryBonuses[v8]; *fineIfFailed = 100 * (reputation + extraStealDifficulty) + itemvalue; @@ -2283,7 +2283,7 @@ { if ( i == EQUIP_ARMOUR ) v46[v4++] = this->pEquipment.uArmor - 1; - if ( (i == EQUIP_OFF_HAND || i == EQUIP_MAIN_HAND) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SHIELD ) + if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SHIELD ) v46[v4++] = this->pEquipment.pIndices[i] - 1; } } @@ -2299,8 +2299,8 @@ { if ( i == EQUIP_BOW ) v46[v4++] = LOBYTE(this->pEquipment.uBow) - 1; - if ( (i == EQUIP_OFF_HAND || i == EQUIP_MAIN_HAND) - && (GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_OFF_HAND || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_MAIN_HAND) ) + if ( (i == EQUIP_SINGLE_HANDED || i == EQUIP_TWO_HANDED) + && (GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_SINGLE_HANDED || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i) == EQUIP_TWO_HANDED) ) v46[v4++] = this->pEquipment.pIndices[i] - 1; } } @@ -2525,7 +2525,7 @@ { weapon_recovery = base_recovery_times_per_weapon_type[1]; } - else if ( HasItemEquipped(EQUIP_MAIN_HAND) ) + else if ( HasItemEquipped(EQUIP_TWO_HANDED) ) { weapon = GetMainHandItem(); if (weapon->GetItemEquipType() == EQUIP_WAND) @@ -2537,7 +2537,7 @@ else weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; } - if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) + if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled { if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery) @@ -2576,7 +2576,7 @@ } uint shield_recovery = 0; - if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) + if (HasItemEquipped(EQUIP_SINGLE_HANDED) && GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) == EQUIP_SHIELD) { uchar skill_type = GetOffHandItem()->GetPlayerSkillType(); @@ -2948,7 +2948,7 @@ //----- (0048EA46) -------------------------------------------------------- int Player::GetSpecialItemBonus( int enchantmentId ) { - for (int i = EQUIP_OFF_HAND; i < EQUIP_BOOK; ++i ) + for (int i = EQUIP_SINGLE_HANDED; i < EQUIP_BOOK; ++i ) { if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { @@ -3060,9 +3060,9 @@ } else { - if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) + if ( this->HasItemEquipped(EQUIP_TWO_HANDED) ) { - v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); + v22 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED); if ( v22 >= 0 && v22 <= 2) { ItemGen* mainHandItem = GetMainHandItem(); @@ -3078,7 +3078,7 @@ v5 = mainHandItem->GetDamageMod() + v25 * v26; } } - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 || GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2)) + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0 || GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2)) { return v5; } @@ -3098,15 +3098,15 @@ { return 0; } - if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) + if ( this->HasItemEquipped(EQUIP_TWO_HANDED) ) { - v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); + v17 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED); if ( v17 >= 0 && v17 <= 2) { v5 = GetMainHandItem()->GetDamageMod(); } } - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 ) + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 ) return v5; else { @@ -3120,9 +3120,9 @@ { return 1; } - if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) + if ( this->HasItemEquipped(EQUIP_TWO_HANDED) ) { - v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); + v9 = this->GetEquippedItemEquipType(EQUIP_TWO_HANDED); if ( v9 >= 0 && v9 <= 2) { ItemGen* mainHandItem = GetMainHandItem(); @@ -3135,7 +3135,7 @@ } } - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 ) + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_SINGLE_HANDED) || (this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) < 0) || this->GetEquippedItemEquipType(EQUIP_SINGLE_HANDED) > 2 ) { return v5; } @@ -3642,7 +3642,7 @@ if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { ItemGen* currItem = GetNthEquippedIndexItem(i); - if ( currItem->GetItemEquipType() <= EQUIP_MAIN_HAND) + if ( currItem->GetItemEquipType() <= EQUIP_TWO_HANDED) { PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType(); int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); @@ -3705,7 +3705,7 @@ if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { ItemGen* currItemPtr = GetNthEquippedIndexItem(i); - if ( currItemPtr->GetItemEquipType() == EQUIP_MAIN_HAND || currItemPtr->GetItemEquipType() == EQUIP_OFF_HAND ) + if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED ) { PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItemPtr->GetPlayerSkillType(); int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); @@ -7479,13 +7479,13 @@ if ( playerPtr->HasItemEquipped(EQUIP_ARMOUR) && playerPtr->GetArmorItem()->uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) dmgToReceive >>= 1; - if ( playerPtr->HasItemEquipped(EQUIP_MAIN_HAND)) + if ( playerPtr->HasItemEquipped(EQUIP_TWO_HANDED)) { ItemGen* mainHandItem = playerPtr->GetMainHandItem(); if ( mainHandItem->uItemID == ITEM_RELIC_KELEBRIM || mainHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (mainHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) dmgToReceive >>= 1; } - if ( playerPtr->HasItemEquipped(EQUIP_OFF_HAND)) + if ( playerPtr->HasItemEquipped(EQUIP_SINGLE_HANDED)) { ItemGen* offHandItem = playerPtr->GetOffHandItem(); if ( offHandItem->uItemID == ITEM_RELIC_KELEBRIM || offHandItem->uItemID == ITEM_ARTIFACT_ELFBANE || (offHandItem->GetItemEquipType() == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) diff -r 7e2dd49832b5 -r 33787c8938a5 UI/UICharacter.cpp --- a/UI/UICharacter.cpp Sat Nov 02 17:24:31 2013 +0000 +++ b/UI/UICharacter.cpp Sat Nov 02 17:45:58 2013 +0000 @@ -777,7 +777,7 @@ pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); //Рука не занята или ... if ( !player->GetItem(&PlayerEquipment::uMainHand) - || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_MAIN_HAND) + || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED) && (player->GetMainHandItem()->GetItemEquipType() != PLAYER_SKILL_SPEAR || player->GetItem(&PlayerEquipment::uShield)) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], @@ -1062,7 +1062,7 @@ } //--------------------------------------------(Hand/Рука)------------------------------------------------------ if ( !player->GetItem(&PlayerEquipment::uMainHand) - || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_MAIN_HAND) + || ( player->GetMainHandItem()->GetItemEquipType() != EQUIP_TWO_HANDED) && (player->GetMainHandItem()->GetPlayerSkillType() != PLAYER_SKILL_SPEAR || player->GetItem(&PlayerEquipment::uShield)) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], @@ -1130,7 +1130,7 @@ //---------------------------------------------(Hand2/Рука2)-------------------------------------------------- if ( player->GetItem(&PlayerEquipment::uMainHand) ) { - if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_MAIN_HAND + if ( player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR && !player->GetItem(&PlayerEquipment::uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], @@ -1161,7 +1161,7 @@ if ( index >= 0 && index < 17 ) { if ( player->GetItem(&PlayerEquipment::uMainHand) - && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_MAIN_HAND + && (player->GetMainHandItem()->GetItemEquipType() == EQUIP_TWO_HANDED || player->GetMainHandItem()->GetPlayerSkillType() == PLAYER_SKILL_SPEAR && !player->GetItem(&PlayerEquipment::uShield) ))//без щита { @@ -1528,7 +1528,7 @@ if ( player->GetItem(&PlayerEquipment::uMainHand)) { item = player->GetMainHandItem(); - if ( item->GetItemEquipType() == EQUIP_MAIN_HAND + if ( item->GetItemEquipType() == EQUIP_TWO_HANDED || item->GetPlayerSkillType() == PLAYER_SKILL_SPEAR && !player->GetItem(&PlayerEquipment::uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], @@ -2347,7 +2347,7 @@ _this.Reset(); v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; - if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_MAIN_HAND ) + if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_TWO_HANDED ) v51 = v1; v3 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) @@ -2476,7 +2476,7 @@ _this.uBodyAnchor = 1; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; - if ( v51 == EQUIP_OFF_HAND ) + if ( v51 == EQUIP_SINGLE_HANDED ) return; } else @@ -2505,7 +2505,7 @@ pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; return; //-------------------------taken in hand(взять в руку)------------------------------------------- - case EQUIP_OFF_HAND: + case EQUIP_SINGLE_HANDED: case EQUIP_WAND: if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() && pParty->pPickedItem.uItemID != 64 @@ -2610,7 +2610,7 @@ } break; //---------------------------take two hands(взять двумя руками)--------------------------------- - case EQUIP_MAIN_HAND: + case EQUIP_TWO_HANDED: if ( pPlayers[uActiveCharacter]->HasUnderwaterSuitEquipped() ) { pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0); diff -r 7e2dd49832b5 -r 33787c8938a5 UI/UIPopup.cpp --- a/UI/UIPopup.cpp Sat Nov 02 17:24:31 2013 +0000 +++ b/UI/UIPopup.cpp Sat Nov 02 17:45:58 2013 +0000 @@ -240,8 +240,8 @@ out_text[200] = 0; switch (inspect_item->GetItemEquipType()) { - case EQUIP_OFF_HAND: - case EQUIP_MAIN_HAND: + case EQUIP_SINGLE_HANDED: + case EQUIP_TWO_HANDED: sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage" @@ -1688,7 +1688,7 @@ { if (item->IsBroken() || // cant harden broken items item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts - item->GetItemEquipType() < EQUIP_OFF_HAND || + item->GetItemEquipType() < EQUIP_SINGLE_HANDED || item->GetItemEquipType() > EQUIP_WAND) { pMouse->RemoveHoldingItem(); diff -r 7e2dd49832b5 -r 33787c8938a5 mm7_6.cpp --- a/mm7_6.cpp Sat Nov 02 17:24:31 2013 +0000 +++ b/mm7_6.cpp Sat Nov 02 17:45:58 2013 +0000 @@ -438,7 +438,7 @@ Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); - if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_MAIN_HAND) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_OFF_HAND)) + if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED)) _42FA66_do_explosive_impact( actor->vPosition.x, actor->vPosition.y, @@ -478,7 +478,7 @@ else { int main_hand_idx = player->pEquipment.uMainHand; - if (player->HasItemEquipped(EQUIP_MAIN_HAND)) + if (player->HasItemEquipped(EQUIP_TWO_HANDED)) v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); pTurnEngine->ApplyPlayerAction(); }