# HG changeset patch # User Ritor1 # Date 1380217345 -21600 # Node ID 26c1a3d50635879af48c11c8bf59b93f4d725a78 # Parent 79621dd046495ce1260b24fec5490748debf34b4# Parent 873ac151c38dae97d5c37efeffd6c85ed5e3d352 Merge diff -r 79621dd04649 -r 26c1a3d50635 Events.h --- a/Events.h Thu Sep 26 23:42:06 2013 +0600 +++ b/Events.h Thu Sep 26 23:42:25 2013 +0600 @@ -266,26 +266,34 @@ VAR_Reputation = 0xD7, VAR_ActiveSpells = 0xDE, VAR_AutoNotes = 0xDF, - VAR_MonthEquals = 0xE2, + VAR_IsMightMoreThanBase = 0xE0, + VAR_IsIntellectMoreThanBase = 0xE1, + VAR_IsPersonalityMoreThanBase = 0xE2, + VAR_IsEnduranceMoreThanBase = 0xE3, + VAR_IsSpeedMoreThanBase = 0xE4, + VAR_IsAccuracyMoreThanBase = 0xE5, + VAR_IsLuckMoreThanBase = 0xE6, + VAR_PlayerBits = 0xE7, VAR_NPCs2 = 0xE8, VAR_IsFlying = 0xF0, VAR_HiredNPCHasSpeciality = 0xF1, VAR_CircusPrises = 0xF2, VAR_NumSkillPoints = 0xF3, - VAR_MonthEquals2 = 0xF4, - VAR_Counter1 = 0xF7, - VAR_Counter2 = 0xF8, - VAR_Counter3 = 0xF9, - VAR_Counter4 = 0xFA, - VAR_Counter5 = 0xFB, - VAR_Counter6 = 0xFC, - VAR_Counter7 = 0xFD, - VAR_Counter8 = 0xFE, - VAR_Counter9 = 0xFF, - VAR_CounterA = 0x100, + VAR_MonthIs = 0xF4, + VAR_Counter1 = 0xF5, + VAR_Counter2 = 0xF6, + VAR_Counter3 = 0xF7, + VAR_Counter4 = 0xF8, + VAR_Counter5 = 0xF9, + VAR_Counter6 = 0xFa, + VAR_Counter7 = 0xFB, + VAR_Counter8 = 0xFC, + VAR_Counter9 = 0xFD, + VAR_Counter10 = 0xFE, VAR_ReputationInCurrentLocation = 0x113, VAR_History_0 = 0x114, VAR_History_28 = 0x130, + VAR_Unknown1 = 0x131, VAR_GoldInBank = 0x132, VAR_NumDeaths = 0x133, VAR_NumBounties = 0x134, diff -r 79621dd04649 -r 26c1a3d50635 Player.cpp --- a/Player.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/Player.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -1608,7 +1608,7 @@ { if ( HasItemEquipped(EQUIP_MAIN_HAND) ) { - ItemGen *mainHandItemGen = &this->pInventoryItemList[this->pEquipment.uMainHand-1]; + ItemGen *mainHandItemGen = this->GetMainHandItem(); int itemId = mainHandItemGen->uItemID; bool addOneDice = false; if ( pItemsTable->pItems[itemId].uSkillType == PLAYER_SKILL_SPEAR && !this->pEquipment.uShield ) @@ -1695,8 +1695,8 @@ int v6; // edi@4 int v7; // edi@4 - v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; - if ( v2 < ITEM_BLASTER || v2 > ITEM_LASER_RIFLE ) + ItemGen* mainHandItem = GetMainHandItem(); + if ( mainHandItem != nullptr && ( mainHandItem->uItemID < ITEM_BLASTER || mainHandItem->uItemID > ITEM_LASER_RIFLE )) { v4 = GetActualAccuracy(); v5 = GetParameterBonus(v4); @@ -1795,23 +1795,19 @@ //----- (0048D2EA) -------------------------------------------------------- char *Player::GetMeleeDamageString() { - signed int itemid; // eax@1 int min_damage; // edi@3 int max_damage; // eax@3 static char player__getmeleedamagestring_static_buff[40]; // idb - if (pEquipment.uMainHand >= 0) - { - itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; - } - - if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) + ItemGen* mainHandItem = GetMainHandItem(); + + if (mainHandItem != nullptr && ( mainHandItem->uItemID >= 135 ) && ( mainHandItem->uItemID <= 159 )) { strcpy(player__getmeleedamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" return player__getmeleedamagestring_static_buff; } - else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) + else if (mainHandItem != nullptr && (mainHandItem->uItemID == ITEM_BLASTER || mainHandItem->uItemID == ITEM_LASER_RIFLE)) { min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true); max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true); @@ -1835,23 +1831,19 @@ //----- (0048D396) -------------------------------------------------------- char *Player::GetRangedDamageString() { - signed int itemid; // eax@1 int min_damage; // edi@3 int max_damage; // eax@3 static char player__getrangeddamagestring_static_buff[40]; // idb - if (pEquipment.uMainHand >= 0) - { - itemid = pOwnItems[this->pEquipment.uMainHand-1].uItemID; - } - - if (pEquipment.uMainHand >= 0 && ( itemid >= 135 ) && ( itemid <= 159 )) + ItemGen* mainHandItem = GetMainHandItem(); + + if (mainHandItem != nullptr && ( mainHandItem->uItemID >= 135 ) && ( mainHandItem->uItemID <= 159 )) { strcpy(player__getrangeddamagestring_static_buff, pGlobalTXT_LocalizationStrings[595]); //"Wand" return player__getrangeddamagestring_static_buff; } - else if (pEquipment.uMainHand >= 0 && (itemid == ITEM_BLASTER || itemid == ITEM_LASER_RIFLE)) + else if (mainHandItem != nullptr && (mainHandItem->uItemID == ITEM_BLASTER || mainHandItem->uItemID == ITEM_LASER_RIFLE)) { min_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MIN, true); max_damage = GetItemsBonus(CHARACTER_ATTRIBUTE_MELEE_DMG_MAX, true); @@ -1933,11 +1925,12 @@ break; } } - if (( dmg_type == DMGT_PHISYCAL ) && ( pEquipment.uArmor )) - { - if (!pOwnItems[pEquipment.uArmor - 1].IsBroken()) + ItemGen* equippedArmor = GetArmorItem(); + if (( dmg_type == DMGT_PHISYCAL ) && ( equippedArmor != nullptr )) + { + if (!equippedArmor->IsBroken()) { - armor_skill = GetEquippedItemSkillType(EQUIP_ARMOUR); + armor_skill = equippedArmor->GetPlayerSkillType(); if ( armor_skill==PLAYER_SKILL_PLATE ) { if ( SkillToMastery(pActiveSkills[PLAYER_SKILL_PLATE]) >= 3 ) @@ -1956,20 +1949,20 @@ //----- (0048D62C) -------------------------------------------------------- ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) { - return pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].GetItemEquipType(); + return GetNthEquippedIndexItem(uEquipSlot)->GetItemEquipType(); } //----- (0048D651) -------------------------------------------------------- PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) { - return (PLAYER_SKILL_TYPE)pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].GetPlayerSkillType(); + return (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(uEquipSlot)->GetPlayerSkillType(); } //----- (0048D676) -------------------------------------------------------- bool Player::IsUnarmed() { return !HasItemEquipped(EQUIP_MAIN_HAND) && - (!HasItemEquipped(EQUIP_OFF_HAND) || GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD); + (!HasItemEquipped(EQUIP_OFF_HAND) || GetOffHandItem()->GetItemEquipType() == EQUIP_SHIELD); } //----- (0048D6AA) -------------------------------------------------------- @@ -1988,7 +1981,7 @@ for (uint i = 0; i < 16; ++i) { if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && - pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) + GetNthEquippedIndexItem(i)->uSpecEnchantmentType == uEnchantment) return true; } return false; @@ -1997,7 +1990,7 @@ //----- (0048D709) -------------------------------------------------------- bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) { - return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ); + return ( HasItemEquipped(equip_type) && GetNthEquippedIndexItem(equip_type)->uItemID == item_id ); } bool Player::WearsItemAnyWhere(int item_id) @@ -2230,7 +2223,6 @@ int Player::ReceiveDamage( signed int amount, DAMAGE_TYPE dmg_type ) { signed int recieved_dmg; // eax@1 - unsigned int armor_indx; // eax@8 bool broke_armor; SetAsleep(false); @@ -2252,12 +2244,12 @@ } if (broke_armor ) { - armor_indx = pEquipment.uArmor; - if ( armor_indx ) + ItemGen* equippedArmor = GetArmorItem(); + if ( equippedArmor != nullptr ) { - if ( !(pOwnItems[armor_indx-1].uAttributes & ITEM_HARDENED)) + if ( !(equippedArmor->uAttributes & ITEM_HARDENED)) { - pOwnItems[armor_indx-1].SetBroken(); + equippedArmor->SetBroken(); } } } @@ -2578,9 +2570,8 @@ { if ( HasItemEquipped(EQUIP_BOW) ) { - weapon = &pInventoryItemList[pEquipment.uBow - 1]; - weapon_desc = &pItemsTable->pItems[weapon->uItemID]; - weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; + weapon = GetBowItem(); + weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; } } else if ( IsUnarmed() == 1 && GetActualSkillLevel(PLAYER_SKILL_UNARMED) > 0) @@ -2589,26 +2580,22 @@ } else if ( HasItemEquipped(EQUIP_MAIN_HAND) ) { - weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; - weapon_desc = &pItemsTable->pItems[weapon->uItemID]; - if (weapon_desc->uEquipType == EQUIP_WAND) + weapon = GetMainHandItem(); + if (weapon->GetItemEquipType() == EQUIP_WAND) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 __debugbreak(); // looks like wands were two-handed weapons once, or supposed to be. should not get here now weapon_recovery = pSpellDatas[wand_spell_ids[weapon->uItemID - ITEM_WAND_FIRE]].uExpertLevelRecovery; } else - weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; + weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; } if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled { - auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; - auto v12_desc = &pItemsTable->pItems[v12->uItemID]; - if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) - { - weapon = &pInventoryItemList[pEquipment.uShield - 1]; - weapon_desc = &pItemsTable->pItems[weapon->uItemID]; + if (base_recovery_times_per_weapon_type[GetOffHandItem()->GetPlayerSkillType()] > weapon_recovery) + { + weapon = GetOffHandItem(); weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; } } @@ -2616,7 +2603,7 @@ uint armour_recovery = 0; if ( HasItemEquipped(EQUIP_ARMOUR) ) { - auto armour_skill_type = pInventoryItemList[pEquipment.uArmor - 1].GetPlayerSkillType(); + auto armour_skill_type = GetArmorItem()->GetPlayerSkillType(); uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; float multiplier; @@ -2644,8 +2631,7 @@ uint shield_recovery = 0; if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) { - auto shield = &pInventoryItemList[pEquipment.uShield - 1]; - auto skill_type = shield->GetPlayerSkillType(); + auto skill_type = GetOffHandItem()->GetPlayerSkillType(); uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0); @@ -2655,12 +2641,12 @@ uint player_speed_recovery_reduction = GetParameterBonus(GetActualSpeed()), sword_axe_bow_recovery_reduction = 0; bool shooting_laser = false; - if (weapon_desc) - { - if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon_desc->uSkillType) && - (weapon_desc->uSkillType == PLAYER_SKILL_SWORD || weapon_desc->uSkillType == PLAYER_SKILL_AXE || weapon_desc->uSkillType == PLAYER_SKILL_BOW) ) - { - if (SkillToMastery(pActiveSkills[weapon_desc->uSkillType]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery + if (weapon != nullptr) + { + if (GetActualSkillLevel((PLAYER_SKILL_TYPE)weapon->GetPlayerSkillType()) && + (weapon->GetPlayerSkillType() == PLAYER_SKILL_SWORD || weapon->GetPlayerSkillType() == PLAYER_SKILL_AXE || weapon->GetPlayerSkillType() == PLAYER_SKILL_BOW) ) + { + if (SkillToMastery(pActiveSkills[weapon->GetPlayerSkillType()]) >= 2 ) // Expert Sword, Axe & Bow reduce recovery sword_axe_bow_recovery_reduction = pActiveSkills[weapon_desc->uSkillType] & 0x3F; } if (weapon_desc->uSkillType == PLAYER_SKILL_BLASTER) @@ -2971,7 +2957,7 @@ if (rec > uTimeToRecovery) uTimeToRecovery = rec; - if (pPlayers[uActiveCharacter] == this && !some_active_character) + if (uActiveCharacter != 0 && pPlayers[uActiveCharacter] == this && !some_active_character) uActiveCharacter = pParty->GetNextActiveCharacter(); viewparams->bRedrawGameUI = true; @@ -3012,21 +2998,18 @@ //----- (0048EA46) -------------------------------------------------------- int Player::GetSpecialItemBonus( int enchantmentId ) { - int inv_indx; // eax@3 - for (int i = EQUIP_OFF_HAND; i < EQUIP_BOOK; ++i ) { if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - inv_indx = pEquipment.pIndices[i] - 1; if (enchantmentId == 17) { - if ((pInventoryItemList[inv_indx].uSpecEnchantmentType == 17) || (pInventoryItemList[inv_indx].uItemID == 533)) //Elven Chainmail+Increases rate of Recovery + if ((GetNthEquippedIndexItem(i)->uSpecEnchantmentType == 17) || (GetNthEquippedIndexItem(i)->uItemID == 533)) //Elven Chainmail+Increases rate of Recovery return 50; } if (enchantmentId == 24) { - if (pInventoryItemList[inv_indx].uSpecEnchantmentType == 24) //Increased Knockback. + if (GetNthEquippedIndexItem(i)->uSpecEnchantmentType == 24) //Increased Knockback. return 5; } } @@ -3042,16 +3025,11 @@ int v14; // ecx@58 int v15; // eax@58 int v17; // eax@62 - int v20; // eax@69 int v22; // eax@76 - int v23; // edx@76 int v25; // ecx@80 int v26; // edi@80 - int v31; // ebp@97 int v32; // eax@98 - unsigned int v33; // eax@100 int v56; // eax@365 - int v57; // ebx@368 signed int v58; // [sp-4h] [bp-20h]@10 int v61; // [sp+10h] [bp-Ch]@1 int v62; // [sp+14h] [bp-8h]@1 @@ -3100,25 +3078,23 @@ case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS: case CHARACTER_ATTRIBUTE_RANGED_ATTACK: if ( HasItemEquipped(EQUIP_BOW) ) - v5 = this->pOwnItems[this->pEquipment.uBow-1].GetDamageMod(); + v5 = GetBowItem()->GetDamageMod(); return v5; break; case CHARACTER_ATTRIBUTE_RANGED_DMG_MIN: if ( !HasItemEquipped(EQUIP_BOW) ) return 0; - v57 = this->pOwnItems[this->pEquipment.uBow-1].uItemID; - v5 = pItemsTable->pItems[v57].uDamageMod; - v56 = pItemsTable->pItems[v57].uDamageDice; + v5 = GetBowItem()->GetDamageMod(); + v56 = GetBowItem()->GetDamageDice(); return v5 + v56; break; case CHARACTER_ATTRIBUTE_RANGED_DMG_MAX: if ( !HasItemEquipped(EQUIP_BOW) ) return 0; - v20 = this->pOwnItems[this->pEquipment.uBow-1].uItemID; - v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; - v56 = pItemsTable->pItems[v20].uDamageMod; + v5 = GetBowItem()->GetDamageDice() * GetBowItem()->GetDamageRoll(); + v56 = GetBowItem()->GetDamageMod(); return v5 + v56; case CHARACTER_ATTRIBUTE_LEVEL: @@ -3139,17 +3115,17 @@ v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v22 >= 0 && v22 <= 2) { - v23 = this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID; - v26 = pItemsTable->pItems[v23].uDamageRoll; - if ( this->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) + ItemGen* mainHandItem = GetMainHandItem(); + v26 = mainHandItem->GetDamageRoll(); + if ( GetOffHandItem() != nullptr || mainHandItem->GetPlayerSkillType() != 4 ) { - v25 = pItemsTable->pItems[v23].uDamageDice; + v25 = mainHandItem->GetDamageDice(); } else { - v25 = pItemsTable->pItems[v23].uDamageDice + 1; + v25 = mainHandItem->GetDamageDice() + 1; } - v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; + v5 = mainHandItem->GetDamageMod() + v25 * v26; } } if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 || GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2)) @@ -3158,9 +3134,9 @@ } else { - v23 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID; - v15 = pItemsTable->pItems[v23].uDamageMod; - v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; + ItemGen* offHandItem = GetOffHandItem(); + v15 = offHandItem->GetDamageMod(); + v14 = offHandItem->GetDamageDice() * offHandItem->GetDamageRoll(); return v5 + v15 + v14; } } @@ -3177,15 +3153,14 @@ v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v17 >= 0 && v17 <= 2) { - v5 = this->pOwnItems[this->pEquipment.uMainHand-1].GetDamageMod(); + v5 = GetMainHandItem()->GetDamageMod(); } } if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 ) return v5; else { - v20 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID; - v56 = pItemsTable->pItems[v20].uDamageMod; + v56 = GetOffHandItem()->GetDamageMod(); return v5 + v56; } break; @@ -3200,9 +3175,10 @@ v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v9 >= 0 && v9 <= 2) { - v5 = this->pOwnItems[this->pEquipment.uMainHand - 1].GetDamageDice() + - this->pOwnItems[this->pEquipment.uMainHand - 1].GetDamageMod(); - if ( !this->pEquipment.uShield && this->pOwnItems[this->pEquipment.uMainHand - 1].GetPlayerSkillType() == 4) + ItemGen* mainHandItem = GetMainHandItem(); + v5 = mainHandItem->GetDamageDice() + + mainHandItem->GetDamageMod(); + if ( GetOffHandItem() == nullptr && mainHandItem->GetPlayerSkillType() == 4) { ++v5; } @@ -3215,8 +3191,9 @@ } else { - v14 = this->pOwnItems[this->pEquipment.uShield].GetDamageMod(); - v15 = this->pOwnItems[this->pEquipment.uShield].GetDamageDice(); + ItemGen* offHandItem = GetOffHandItem(); + v14 = offHandItem->GetDamageMod(); + v15 = offHandItem->GetDamageDice(); return v5 + v15 + v14; } break; @@ -3266,18 +3243,16 @@ { if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - v31 = this->pEquipment.pIndices[i] - 1; - currEquippedItem = &this->pInventoryItemList[v31]; + currEquippedItem = GetNthEquippedIndexItem(i); if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS ) { - v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i); + v32 = currEquippedItem->GetItemEquipType(); if ( v32 >= 3 && v32 <= 11 ) { - v33 = currEquippedItem->uItemID; - v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; + v5 += currEquippedItem->GetDamageDice() + currEquippedItem->GetDamageMod(); } } - if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(currEquippedItem)) + if ( pItemsTable->IsMaterialNonCommon(currEquippedItem) && !pItemsTable->IsMaterialSpecial(currEquippedItem) ) { currEquippedItem->GetItemBonusArtifact(this, attr, &v62); @@ -3649,10 +3624,10 @@ for (int j = 0; j < 16; ++j) { - if (pEquipment.pIndices[j] && (!pOwnItems[pEquipment.pIndices[j]].IsBroken())) + ItemGen* currItem = GetNthEquippedIndexItem(j); + if (currItem != nullptr && (!currItem->IsBroken())) { - int curr_item = pOwnItems[pEquipment.pIndices[j] - 1].uItemID; - PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[curr_item].uSkillType; + PLAYER_SKILL_TYPE itemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType(); int currArmorSkillLevel = GetActualSkillLevel(itemSkillType); int multiplier = 0; switch (itemSkillType) @@ -3710,10 +3685,10 @@ { if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - ItemDesc currItem = pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID]; - if ( currItem.uEquipType <= EQUIP_MAIN_HAND) + ItemGen* currItem = GetNthEquippedIndexItem(i); + if ( currItem->GetItemEquipType() <= EQUIP_MAIN_HAND) { - PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem.uSkillType; + PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItem->GetPlayerSkillType(); int currentItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); if (currItemSkillType == PLAYER_SKILL_BLASTER) { @@ -3741,7 +3716,7 @@ { if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].GetPlayerSkillType(); + PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(i)->GetPlayerSkillType(); int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); if ( currentItemSkillType == PLAYER_SKILL_BOW ) { @@ -3773,7 +3748,7 @@ { if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - ItemGen* currItemPtr = &this->pInventoryItemList[this->pEquipment.pIndices[i] - 1]; + ItemGen* currItemPtr = GetNthEquippedIndexItem(i); if ( currItemPtr->GetItemEquipType() == EQUIP_MAIN_HAND || currItemPtr->GetItemEquipType() == EQUIP_OFF_HAND ) { PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItemPtr->GetPlayerSkillType(); @@ -5011,9 +4986,10 @@ } //----- (00449BB4) -------------------------------------------------------- -bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) -{ - Player *v3; // esi@1 +bool Player::CompareVariable( enum VariableType VarNum, signed int pValue ) // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive +{ + Assert(pValue >= 0, "Compare variable shouldn't have negative arguments"); + signed int v4; // edi@1 unsigned int v5; // eax@8 int v6; // eax@9 @@ -5024,13 +5000,11 @@ int v11; // eax@19 unsigned int v12; // eax@20 unsigned int test_bit_value; // eax@25 - unsigned __int8 our_bit_value; // cl@25 + unsigned __int8 byteWithRequestedBit; // cl@25 signed int v15; // ecx@28 ItemGen *v16; // eax@28 - char v17; // zf@31 int v18; // edi@90 DDM_DLV_Header *v19; // eax@122 - char v20; // cl@124 DDM_DLV_Header *v21; // eax@126 unsigned int v22; // edi@129 Player *v23; // esi@134 @@ -5042,7 +5016,6 @@ int v29; // eax@161 v6 = 0; - v3 = this; v4 = -1; if ( VarNum > VAR_AutoNotes ) { @@ -5079,14 +5052,12 @@ v19 = &pIndoor->dlv; v6 = v19->uReputation >= pValue; return v6; - case VAR_History_28|VAR_Sex: + case VAR_Unknown1: v21 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v21 = &pIndoor->dlv; v6 = v21->field_C_alert == pValue; return v6; - case VAR_MonthEquals2|VAR_Sex: - case VAR_MonthEquals2|VAR_Class: case VAR_Counter1: case VAR_Counter2: case VAR_Counter3: @@ -5095,6 +5066,8 @@ case VAR_Counter6: case VAR_Counter7: case VAR_Counter8: + case VAR_Counter9: + case VAR_Counter10: v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) @@ -5104,36 +5077,29 @@ case VAR_NumSkillPoints: v4 = this->uSkillPoints; return v4 >= pValue; - case VAR_CircusPrises: + case VAR_CircusPrises: //isn't used in MM6 since 0x1D6u is a book of regeneration v4 = 0; - v23 = pParty->pPlayers;//[0].pInventoryItems; - do + for (int playerNum = 0; playerNum < 4; playerNum++) { - v24 = v23->pInventoryItemList; - v25 = 138; - do + for (int invPos = 0; invPos < 138; invPos++) { - switch ( v24->uItemID ) + int itemId = pParty->pPlayers[playerNum].pInventoryItemList[invPos].uItemID; + switch ( itemId ) { - case 0x1D6u: - ++v4; - break; - case 0x1D7u: - v4 += 3; - break; - case 0x1DDu: - v4 += 5; - break; + case 0x1D6u: + ++v4; + break; + case 0x1D7u: + v4 += 3; + break; + case 0x1DDu: + v4 += 5; + break; } - ++v24; - --v25; } - while ( v25 ); - ++v23; } - while ( v23 <= &pParty->pPlayers[3] ); return v4 >= pValue; - case VAR_MonthEquals2: + case VAR_MonthIs: v6 = pParty->uCurrentMonth == pValue; return v6; case VAR_IsFlying: @@ -5142,78 +5108,65 @@ return true; return false; case VAR_HiredNPCHasSpeciality: - LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); - return v6; + return CheckHiredNPCSpeciality(pValue); case VAR_NPCs2: return pNPCStats->pNewNPCData[pValue].Hired(); - case VAR_MonthEquals|VAR_CurrentSP: + case VAR_PlayerBits: test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; - our_bit_value = this->field_1A50[((signed __int16)pValue - 1)/8]; - if ( !((unsigned __int8)test_bit_value & our_bit_value) ) + byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8]; + if ( !((unsigned __int8)test_bit_value & byteWithRequestedBit) ) return v4 >= pValue; v4 = pValue; return v4 >= pValue; case VAR_ItemEquipped: - v26 = (ITEM_EQUIP_TYPE)0; - v27 = (char *)&this->pEquipment; - break; + for (int i = 0; i < 16; i++) + { + if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) && GetNthEquippedIndexItem(i)->uItemID == pValue ) + { + return true; + } + } + return false; case VAR_GoldInBank: v4 = pParty->uNumGoldInBank; return v4 >= pValue; - case VAR_ThieverySkill|0x80: + case VAR_IsMightMoreThanBase: v28 = GetActualMight(); - v29 = v3->GetBaseStrength(); - goto LABEL_168; - case VAR_DisarmTrapSkill|0x80: + v29 = GetBaseStrength(); + return (v28 >= v29); + case VAR_IsIntellectMoreThanBase: v28 = GetActualIntelligence(); - v29 = v3->GetBaseIntelligence(); - goto LABEL_168; - case VAR_MonthEquals: + v29 = GetBaseIntelligence(); + return (v28 >= v29); + case VAR_IsPersonalityMoreThanBase: v28 = GetActualWillpower(); - v29 = v3->GetBaseWillpower(); - goto LABEL_168; - case VAR_MonthEquals|VAR_Sex: + v29 = GetBaseWillpower(); + return (v28 >= v29); + case VAR_IsEnduranceMoreThanBase: v28 = GetActualEndurance(); - v29 = v3->GetBaseEndurance(); - goto LABEL_168; - case VAR_IdentifyMonsterSkill|0x80: + v29 = GetBaseEndurance(); + return (v28 >= v29); + case VAR_IsSpeedMoreThanBase: v28 = GetActualSpeed(); - v29 = v3->GetBaseSpeed(); - goto LABEL_168; - case VAR_ArmsmasterSkill|0x80: + v29 = GetBaseSpeed(); + return (v28 >= v29); + case VAR_IsAccuracyMoreThanBase: v28 = GetActualAccuracy(); - v29 = v3->GetBaseAccuracy(); - goto LABEL_168; - case VAR_MonthEquals|VAR_MaxHP: + v29 = GetBaseAccuracy(); + return (v28 >= v29); + case VAR_IsLuckMoreThanBase: v28 = GetActualLuck(); - v29 = v3->GetBaseLuck(); -LABEL_168: - v10 = __OFSUB__(v28, v29); - v9 = v28 - v29 < 0; -LABEL_169: - if ( v9 ^ v10 ) - return v4 >= pValue; - return true; + v29 = GetBaseLuck(); + return (v28 >= v29); default: - return v4 >= pValue; - } - while ( !v3->HasItemEquipped(v26) - || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) - { - v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); - v27 += 4; - if ( (signed int)v26 >= 16 ) return false; } - return true; - } - if ( VarNum == VAR_AutoNotes ) - { - test_bit_value = 0x80u >> ((signed __int16)(pValue - 1) - 1) % 8; - our_bit_value = pParty->_autonote_bits[((signed __int16)(pValue - 1) - 1) /8]; - if ( !((unsigned __int8)test_bit_value & our_bit_value) ) - return false; - return true; + } + if ( VarNum == VAR_AutoNotes ) //TODO: find out why the double subtraction. or whether this is even used + { + test_bit_value = 0x80u >> (pValue - 2) % 8; + byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8]; + return (test_bit_value & byteWithRequestedBit); } if ( VarNum <= VAR_BaseLuck ) { @@ -5222,29 +5175,27 @@ switch ( VarNum ) { case VAR_Hour: - if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) + if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) return true; return false; case VAR_DayOfYear: - v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; - v6 = v5 == pValue; - return v6; + if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue) + return true; + return false; case VAR_DayOfWeek: - v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; - v6 = v5 == pValue; - return v6; - case VAR_Sex: - if ( pValue == (CHARACTER_RACE)this->uSex ) + if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7) return true; - return v4 >= pValue; - case VAR_Class: - v7 = (CHARACTER_RACE)this->classType; - if ( pValue == v7 ) + return false; + case VAR_Sex: + if ( pValue == this->uSex ) return true; - return v4 >= pValue; - case VAR_Race: - v7 = GetRace(); - if ( pValue == v7 ) + return false; + case VAR_Class: + if ( pValue == this->classType ) + return true; + return false; + case VAR_Race: + if ( pValue == GetRace() ) return true; return v4 >= pValue; case VAR_CurrentHP: @@ -5252,20 +5203,18 @@ return v4 >= pValue; case VAR_MaxHP: v8 = GetMaxHealth(); - v10 = __OFSUB__(v3->sHealth, v8); - v9 = v3->sHealth - v8 < 0; - goto LABEL_169; + v9 = this->sHealth; + return (v9 >= v8); case VAR_CurrentSP: v4 = this->sMana; return v4 >= pValue; case VAR_MaxSP: - v11 = GetMaxMana(); - v10 = __OFSUB__(v3->sMana, v11); - v9 = v3->sMana - v11 < 0; - goto LABEL_169; + v8 = GetMaxMana(); + v9 = this->sMana; + return (v9 >= v8); case VAR_ActualAC: - v12 = GetActualAC(); - goto _j_cmp_against_arg; + v4 = GetActualAC(); + return v4 >= pValue; case VAR_ACModifier: v4 = this->sACModifier; return v4 >= pValue; @@ -5276,27 +5225,28 @@ v4 = this->sLevelModifier; return v4 >= pValue; case VAR_Age: - v12 = GetActualAge(); - goto _j_cmp_against_arg; + v4 = GetActualAge(); + return v4 >= pValue; case VAR_Award: - test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8; - our_bit_value = this->_achieved_awards_bits[((signed __int16)pValue - 1) /8]; - if ( !((unsigned __int8)test_bit_value & our_bit_value) ) - return true; - return false; + test_bit_value = 0x80u >> (pValue - 1) % 8; + byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8]; + return ( test_bit_value & byteWithRequestedBit ); case VAR_Experience: v4 = LODWORD(this->uExperience); return v4 >= pValue; case VAR_QBits_QuestsDone: test_bit_value = 0x80u >> (pValue - 1) % 8; - our_bit_value = pParty->_quest_bits[(pValue - 1)/8]; - if ( test_bit_value & our_bit_value ) - return true; - return false; + byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8]; + return ( test_bit_value & byteWithRequestedBit ); case VAR_PlayerItemInHands: - v15 = 0; - v16 = v3->pInventoryItemList; - break; + for (int i = 0; i < 138; i++) + { + if (pInventoryItemList[i].uItemID == pValue) + { + return true; + } + } + return pParty->pPickedItem.uItemID == pValue; case VAR_FixedGold: v4 = pParty->uNumGold; return v4 >= pValue; @@ -5343,19 +5293,8 @@ v4 = pParty->uNumFoodRations; return v4 >= pValue; default: - return v4 >= pValue; - } - while ( v16->uItemID != pValue ) - { - ++v15; - ++v16; - if ( v15 >= 138 ) - { - v6 = pParty->pPickedItem.uItemID == pValue; - return v6; - } - } - return true; + return false; + } } v4 = this->uLuck; return v4 >= pValue; @@ -5398,27 +5337,26 @@ v4 = this->sResDarkBase; return v4 >= pValue; case VAR_ActualMight: - v12 = GetActualMight(); - goto _j_cmp_against_arg; + v4 = GetActualMight(); + return v4 >= pValue; case VAR_ActualIntellect: - v12 = GetActualIntelligence(); - goto _j_cmp_against_arg; + v4 = GetActualIntelligence(); + return v4 >= pValue; case VAR_ActualPersonality: - v12 = GetActualWillpower(); - goto _j_cmp_against_arg; + v4 = GetActualWillpower(); + return v4 >= pValue; case VAR_ActualEndurance: - v12 = GetActualEndurance(); - goto _j_cmp_against_arg; + v4 = GetActualEndurance(); + return v4 >= pValue; case VAR_ActualSpeed: - v12 = GetActualSpeed(); - goto _j_cmp_against_arg; + v4 = GetActualSpeed(); + return v4 >= pValue; case VAR_ActualAccuracy: - v12 = GetActualAccuracy(); - goto _j_cmp_against_arg; + v4 = GetActualAccuracy(); + return v4 >= pValue; case VAR_ActualLuck: - v12 = GetActualLuck(); -_j_cmp_against_arg: - v4 = v12; + v4 = GetActualLuck(); + return v4 >= pValue; break; default: return v4 >= pValue; @@ -5436,24 +5374,23 @@ { case VAR_MindResistanceBonus: v4 = this->sResMindBonus; - break; + return v4 >= pValue; case VAR_FireResistanceBonus: v4 = this->sResFireBonus; - break; + return v4 >= pValue; case VAR_AirResistanceBonus: v4 = this->sResAirBonus; - break; + return v4 >= pValue; case VAR_WaterResistanceBonus: v4 = this->sResWaterBonus; - break; + return v4 >= pValue; case VAR_EarthResistanceBonus: v4 = this->sResEarthBonus; - break; + return v4 >= pValue; case VAR_SpiritResistanceBonus: v4 = this->sResSpiritBonus; - break; + return v4 >= pValue; } - return v4 >= pValue; } if ( VarNum == VAR_BodyResistanceBonus ) { @@ -5478,7 +5415,6 @@ if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) return v4 >= pValue; } -LABEL_90: v18 = *((short *)&this->pConditions[16] + VarNum); if ( pValue <= 63 ) v4 = v18 & 0x3F; @@ -5487,7 +5423,14 @@ return v4 >= pValue; } if ( VarNum == 104 ) - goto LABEL_90; + { + v18 = *((short *)&this->pConditions[16] + VarNum); + if ( pValue <= 63 ) + v4 = v18 & 0x3F; + else + v4 = pValue & v18; + return v4 >= pValue; + } if ( (signed int)VarNum <= 104 ) return v4 >= pValue; if ( (signed int)VarNum > 0x79 ) @@ -5506,7 +5449,7 @@ v4 = pValue; return v4 >= pValue; } - return &LODWORD(this->pConditions[VarNum]);// *((int *)this + 2 * VarNum - 210); + return (this->pConditions[VarNum - 105] > 0);// *((int *)this + 2 * VarNum - 210); the original was never used, which is why probably it wasn't correct } @@ -5575,7 +5518,7 @@ { switch ( var_type ) { - case VAR_MonthEquals|VAR_CurrentSP: + case VAR_PlayerBits: __debugbreak(); //how do I get here? _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); break; @@ -6554,7 +6497,7 @@ { switch ( var_type ) { - case VAR_MonthEquals|VAR_CurrentSP: + case VAR_PlayerBits: _449B7E_toggle_bit((unsigned char *)Dst->field_1A50, val, 1u); break; case VAR_NPCs2: @@ -7301,7 +7244,7 @@ //----- (0043EE77) -------------------------------------------------------- bool Player::HasUnderwaterSuitEquipped() //the original function took the player number as a parameter. if it was 0, the whole party was checked. calls with the parameter 0 have been changed to calls to this for every player { - if (this->pEquipment.uArmor == 0 || this->pInventoryItemList[this->pEquipment.uArmor].uItemID != 604) + if (GetArmorItem() == nullptr || GetArmorItem()->uItemID != 604) { return false; } @@ -7386,7 +7329,6 @@ { Player *playerPtr; // ebx@3 Actor *actorPtr; // esi@3 - unsigned int v8; // eax@4 int spellId; // eax@38 signed int recvdMagicDmg; // eax@139 int v72[4]; // [sp+30h] [bp-24h]@164 @@ -7401,13 +7343,13 @@ healthBeforeRecvdDamage = playerPtr->sHealth; if ( PID_TYPE(uObjID) != 3 || !stru_50C198.ActorHitOrMiss(actorPtr, playerPtr) ) return; - v8 = playerPtr->pEquipment.uArmor; + ItemGen* equippedArmor = playerPtr->GetArmorItem(); SoundID soundToPlay; - if ( !v8 - || playerPtr->pInventoryItemList[v8 - 1].IsBroken() + if ( !equippedArmor + || equippedArmor->IsBroken() || - (playerPtr->pInventoryItemList[v8 - 1].GetPlayerSkillType() != PLAYER_SKILL_CHAIN - && playerPtr->pInventoryItemList[v8 - 1].GetPlayerSkillType() != PLAYER_SKILL_PLATE + (equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_CHAIN + && equippedArmor->GetPlayerSkillType() != PLAYER_SKILL_PLATE ) ) { @@ -7602,18 +7544,18 @@ if ( playerPtr->HasEnchantedItemEquipped(69) ) dmgToReceive >>= 1; if ( playerPtr->HasItemEquipped(EQUIP_ARMOUR) - && playerPtr->pInventoryItemList[playerPtr->pEquipment.uArmor-1].uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) + && playerPtr->GetArmorItem()->uItemID == ITEM_ARTIFACT_GOVERNORS_ARMOR ) dmgToReceive >>= 1; if ( playerPtr->HasItemEquipped(EQUIP_MAIN_HAND)) { - int itemId = playerPtr->pInventoryItemList[playerPtr->pEquipment.uMainHand - 1].uItemID; - if ( itemId == ITEM_RELIC_KELEBRIM || itemId == ITEM_ARTIFACT_ELFBANE || (playerPtr->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + 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)) { - int itemId = playerPtr->pInventoryItemList[playerPtr->pEquipment.uShield - 1].uItemID; - if ( itemId == ITEM_RELIC_KELEBRIM || itemId == ITEM_ARTIFACT_ELFBANE || (playerPtr->GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD && SkillToMastery(playerPtr->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4)) + 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)) dmgToReceive >>= 1; } } @@ -7978,3 +7920,76 @@ { SetCondition(Condition_Dead, blockable); } + +ItemGen* Player::GetOffHandItem() +{ + return GetItem(&PlayerEquipment::uShield); +} + +ItemGen* Player::GetMainHandItem() +{ + return GetItem(&PlayerEquipment::uMainHand); +} + +ItemGen* Player::GetBowItem() +{ + return GetItem(&PlayerEquipment::uBow); +} + +ItemGen* Player::GetArmorItem() +{ + return GetItem(&PlayerEquipment::uArmor); +} + +ItemGen* Player::GetHelmItem() +{ + return GetItem(&PlayerEquipment::uHelm); +} + +ItemGen* Player::GetBeltItem() +{ + return GetItem(&PlayerEquipment::uBelt); +} + +ItemGen* Player::GetCloakItem() +{ + return GetItem(&PlayerEquipment::uCloak); +} + +ItemGen* Player::GetGloveItem() +{ + return GetItem(&PlayerEquipment::uGlove); +} + +ItemGen* Player::GetBootItem() +{ + return GetItem(&PlayerEquipment::uBoot); +} + +ItemGen* Player::GetAmuletItem() +{ + return GetItem(&PlayerEquipment::uAmulet); +} + +ItemGen* Player::GetNthRingItem(int ringNum) +{ + return GetNthEquippedIndexItem(ringNum + 10); +} + +ItemGen* Player::GetNthEquippedIndexItem(int index) +{ + if (this->pEquipment.pIndices[index] == 0) + { + return nullptr; + } + return &this->pInventoryItemList[this->pEquipment.pIndices[index] - 1]; +} + +ItemGen* Player::GetItem(unsigned int PlayerEquipment::* itemPos) +{ + if (this->pEquipment.*itemPos == 0) + { + return nullptr; + } + return &this->pInventoryItemList[this->pEquipment.*itemPos - 1]; +} \ No newline at end of file diff -r 79621dd04649 -r 26c1a3d50635 Player.h --- a/Player.h Thu Sep 26 23:42:06 2013 +0600 +++ b/Player.h Thu Sep 26 23:42:25 2013 +0600 @@ -55,7 +55,7 @@ SPEECH_12 = 12, SPEECH_14 = 14, SPEECH_NoRoom = 15, // when placing to inventory - SPEECH_16 = 16, + SPEECH_DO_POTION_FINE = 16, SPEECH_17 = 17, SPEECH_18 = 18, SPEECH_19 = 19, @@ -143,9 +143,9 @@ SPEECH_101 = 101, SPEECH_PickMe = 102, SPEECH_103 = 103, - SPEECH_104 = 104, - SPEECH_105 = 105, - SPEECH_106 = 106, + SPEECH_IDENTIFY_MONSTER_WEAKER = 104, + SPEECH_IDENTIFY_MONSTER_STRONGER = 105, + SPEECH_IDENTIFY_MONSTER_106 = 106, SPEECH_107 = 107, SPEECH_108 = 108, SPEECH_109 = 109, @@ -646,6 +646,20 @@ inline bool IsMale() { return GetSexByVoice() == SEX_MALE;} inline bool IsFemale() { return !IsMale();} + + ItemGen* GetMainHandItem(); + ItemGen* GetOffHandItem(); + ItemGen* GetBowItem(); + ItemGen* GetArmorItem(); + ItemGen* GetHelmItem(); + ItemGen* GetBeltItem(); + ItemGen* GetCloakItem(); + ItemGen* GetGloveItem(); + ItemGen* GetBootItem(); + ItemGen* GetAmuletItem(); + ItemGen* GetNthRingItem(int ringNum); + ItemGen* GetNthEquippedIndexItem(int index); + ItemGen* GetItem(unsigned int PlayerEquipment::* itemPos); __int64 pConditions[20]; unsigned __int64 uExperience; char pName[16]; diff -r 79621dd04649 -r 26c1a3d50635 UI/Books/UIMapBook.cpp --- a/UI/Books/UIMapBook.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -193,12 +193,12 @@ GUIWindow map_window; // [sp+84h] [bp-54h]@35 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); - if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 )//Button 1 + if ( BtnUp_flag || viewparams->uMapBookMapZoom / 128 >= 12 )//Button 1 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 2, pTex_book_button1_off); else pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_book_button1_on); - if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 )//Button 2 + if ( BtnDown_flag || viewparams->uMapBookMapZoom / 128 <= 3 )//Button 2 pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 408, pViewport->uViewportTL_Y + 38, pTex_book_button2_off); else pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on); @@ -265,11 +265,6 @@ void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) { int v20; // eax@16 - signed int v21; // esi@18 - int v22; // ecx@21 - BLVMapOutline *v23; // ecx@21 - Vec3_short_ *v24; // edx@21 - Vec3_short_ *v25; // eax@21 int v26; // ecx@21 unsigned __int16 *v27; // edi@21 int v28; // edx@21 @@ -313,16 +308,13 @@ unsigned __int16 *v67; // esi@96 int v68; // edi@98 unsigned __int16 v69; // cx@99 - unsigned int v70; // [sp-10h] [bp-48074h]@80 - unsigned int v71; // [sp-Ch] [bp-48070h]@80 - unsigned int v72; // [sp-8h] [bp-4806Ch]@80 signed int v73; // [sp-4h] [bp-48068h]@59 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23 int v76; // [sp+4800Ch] [bp-58h]@23 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 - int v81; // [sp+48020h] [bp-44h]@23 + int map_tile_X; // [sp+48020h] [bp-44h]@23 unsigned __int16* render16_data; unsigned char* texture8_data; unsigned char* curr_line; @@ -343,7 +335,7 @@ unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 signed int screenWidth; // [sp+48054h] [bp-10h]@8 unsigned int v95; // [sp+48058h] [bp-Ch]@16 - int v96; // [sp+4805Ch] [bp-8h]@10 + int map_tile_Y; // [sp+4805Ch] [bp-8h]@10 const void *v97; // [sp+48060h] [bp-4h]@16 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 int a5a; // [sp+48070h] [bp+Ch]@86 @@ -353,12 +345,12 @@ pRenderer->SetRasterClipRect(tl_x, tl_y, br_x, br_y); pCenterX = viewparams->sViewCenterX; pCenterY = viewparams->sViewCenterY; - if ( viewparams->field_2C != 384 ) + if ( viewparams->uMapBookMapZoom != 384 ) { - if ( viewparams->field_2C == 768 ) + if ( viewparams->uMapBookMapZoom == 768 ) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - viewparams->field_2C = 680; + viewparams->uMapBookMapZoom = 680; } } else @@ -367,7 +359,7 @@ pCenterX = viewparams->indoor_center_x; pCenterY = viewparams->indoor_center_y; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - viewparams->field_2C = viewparams->field_2C - 34; + viewparams->uMapBookMapZoom = viewparams->uMapBookMapZoom - 34; } if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { @@ -376,20 +368,16 @@ render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->field_2C; + scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30) << 16; - // v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); + teal = (unsigned int)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30) << 16; - // v32 = map_texture_16; textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->field_2C / 384)+ 32768) / v30) << 16; - // v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); - black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->field_2C / 384) + 32768) / v30); + stepY_r = (int)(signed __int64)((double)(- pCenterY - 22528 / (viewparams->uMapBookMapZoom / 384)+ 32768) / v30) << 16; + black = (signed __int16)(signed __int64)((double)(viewparams->sViewCenterX - 22528 / (viewparams->uMapBookMapZoom / 384) + 32768) / v30); - // v76 = textr_width; scaled_posY = stepY_r >> 16; //nearest neiborhood scaling if ( texture8_data) @@ -445,64 +433,52 @@ screenHeight = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].y - pCenterY; v20 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].y - pCenterY; v95 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX; - v97 = (const void *)v20; - v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16; - v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->field_2C) >> 16; - v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16); - screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->field_2C) >> 16; + + v88 = (unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex1ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v93 = (unsigned __int16 *)((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16); + screenHeight = (unsigned __int64)(v20 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; pRenderer->RasterLine2D(screenCenter_X + v88, screenCenterY - v87, - screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - screenHeight, black); + screenCenter_X + ((unsigned __int64)((pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[i].uVertex2ID].x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - screenHeight, black); } } } } - v21 = 0; if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) { - while ( 1 ) + for ( uint j = 0; j < (signed int)uNumBlueFacesInBLVMinimap; ++j ) { - v22 = pBlueFacesInBLVMinimapIDs[v21]; - v87 = viewparams->field_2C; - v23 = &pIndoor->pMapOutlines->pOutlines[v22]; - v24 = &pIndoor->pVertices[v23->uVertex1ID]; - v25 = &pIndoor->pVertices[v23->uVertex2ID]; - v26 = v25->x; - v27 = (unsigned __int16 *)(v24->x - pCenterX); - v28 = v24->y - pCenterY; - v29 = v25->y - pCenterY; - v93 = v27; - screenHeight = v28; - v97 = (const void *)v29; - v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16; - v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->field_2C) >> 16; - uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16; - v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->field_2C) >> 16; - pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->field_2C) >> 16), - screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->field_2C) >> 16), screenCenterY - v95, teal); - ++v21; - if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) - break; + v26 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].x; + v27 = (unsigned __int16 *)(pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].x - pCenterX); + v28 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex1ID].y - pCenterY; + v29 = pIndoor->pVertices[pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[j]].uVertex2ID].y - pCenterY; + + v87 = (unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v88 = (unsigned __int64)(v28 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + uint i = (unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + v95 = (unsigned __int64)(v29 * (signed __int64)viewparams->uMapBookMapZoom) >> 16; + pRenderer->RasterLine2D(screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)viewparams->uMapBookMapZoom) >> 16), + screenCenterY - v88, screenCenter_X + ((unsigned __int64)((v26 - pCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16), screenCenterY - v95, teal); } viewparams->sViewCenterX = pCenterX; } } - v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 3; - v81 = pParty->vPosition.y - pCenterY; - v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->field_2C) >> 16); + v47 = ((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 3; + v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - pCenterY) * (signed __int64)viewparams->uMapBookMapZoom) >> 16); v48 = 1; v49 = screenCenterY - (int)v97 - 3; if ( v47 >= (signed int)tl_x ) { if ( v47 > (signed int)br_x ) { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X - 6) > (signed int)br_x ) + if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X - 6) > (signed int)br_x ) v48 = 0; v47 = br_x; } } else { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X) < (signed int)tl_x ) + if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - viewparams->sViewCenterX) * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X) < (signed int)tl_x ) v48 = 0; v47 = tl_x; } @@ -542,8 +518,6 @@ v50 = 7; pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); } - result = TargetColor(0xFFu, 0xFFu, 0xFFu); - pCenterX = result; if ( (signed int)uNumLevelDecorations > 0 ) { for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i ) @@ -552,30 +526,22 @@ { screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX); - v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X; - v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->field_2C) >> 16); + v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X; + v97 = (const void *)((unsigned __int64)(screenHeight * (signed __int64)viewparams->uMapBookMapZoom) >> 16); v55 = screenCenterY - (int)v97; - if ( v54 >= pRenderer->raster_clip_x ) + if ( v54 >= pRenderer->raster_clip_x && v54 <= pRenderer->raster_clip_z + && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) { - if ( v54 <= pRenderer->raster_clip_z && v55 >= pRenderer->raster_clip_y && v55 <= pRenderer->raster_clip_w ) + if ( viewparams->uMapBookMapZoom > 512 ) { - if ( viewparams->field_2C > 512 ) - { - pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, pCenterX); - pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, pCenterX); - ++v54; - v72 = v55 + 1; - v71 = v54; - v70 = v55 - 1; - } - else - { - v72 = screenCenterY - (int)v97; - v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->field_2C) >> 16) + screenCenter_X; - v70 = screenCenterY - (int)v97; - } - pRenderer->RasterLine2D(v54, v70, v71, v72, pCenterX); + pRenderer->RasterLine2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu)); + pRenderer->RasterLine2D(v54, v55 - 1, v54, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu)); + pRenderer->RasterLine2D(v54 + 1, v55 - 1, v54 + 1, v55 + 1, TargetColor(0xFFu, 0xFFu, 0xFFu)); } + else + pRenderer->RasterLine2D(v54, screenCenterY - (int)v97, + ((unsigned __int64)((signed int)v93 * (signed __int64)viewparams->uMapBookMapZoom) >> 16) + screenCenter_X, + screenCenterY - (int)v97, TargetColor(0xFFu, 0xFFu, 0xFFu)); } } } @@ -585,35 +551,30 @@ screenCenterY = br_x - tl_x + 1; v95 = br_y - tl_y + 1; v77 = &pRenderer->pTargetSurface[tl_x + tl_y * pRenderer->uTargetSurfacePitch]; - v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; - black = (1 << (v56 + 16)) / viewparams->field_2C; - v57 = (double)(1 << (16 - v56)); - v58 = 22528 / (viewparams->field_2C / 384); - v59 = (signed __int64)((double)(viewparams->sViewCenterX - v58 + 32768) / v57); - v60 = (int)v59 << 16; - v97 = (const void *)((int)v59 << 16); - v61 = (signed __int64)((double)(32768 - v58 - pCenterY) / v57); + black = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / viewparams->uMapBookMapZoom; + v57 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + v60 = (int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16; + teal = v60 >> 16; pPalette_16 = (unsigned __int16 *)(v60 >> 16); - v62 = (int)v61 << 16; - teal = v60 >> 16; - v63 = (signed __int16)v61; + v97 = (const void *)((int)((signed __int64)((double)(viewparams->sViewCenterX - (22528 / (viewparams->uMapBookMapZoom / 384)) + 32768) / v57)) << 16); + v62 = (int)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)) << 16; + v63 = (signed __int16)((signed __int64)((double)(32768 - (22528 / (viewparams->uMapBookMapZoom / 384)) - pCenterY) / v57)); a4a = map_texture_16; - result = TargetColor(0xCu, 0xCu, 0xCu); for ( screenCenter_X = 0; screenCenter_X < (signed int)v95; ++screenCenter_X ) { if ( screenCenterY > 0 ) { - v96 = (v63 - 80) / 4; + map_tile_Y = (v63 - 80) / 4; v64 = teal; for ( a5a = 0; a5a < screenCenterY; ++a5a ) { - v81 = (v64 - 80) / 4; - if ( !pOutdoor->_47F04C(v81, v96) ) + map_tile_X = (v64 - 80) / 4; + if ( !pOutdoor->_47F04C(map_tile_X, map_tile_Y) ) { - if ( pOutdoor->_47F097(v81, v96) ) + if ( pOutdoor->_47F097(map_tile_X, map_tile_Y) ) { if ( !((a5a + screenCenter_X) % 2) ) - *a4a = result; + *a4a = TargetColor(0xCu, 0xCu, 0xCu); } else *a4a = 0; @@ -652,3 +613,63 @@ } } } + +//----- (00444564) -------------------------------------------------------- +const char * GetMapBookHintText() +{ + int v20; + int v21; // [sp+14h] [bp-Ch]@1 + double v0; // st7@3 + unsigned int pX; // [sp+1Ch] [bp-4h]@3 + unsigned int pY; // [sp+8h] [bp-18h]@3 + int global_coord_X; // ebx@3 + int global_coord_Y; + int map_tile_X; // edi@3 + int map_tile_Y; // eax@3 + const char *result; // eax@15 + + v20 = viewparams->sViewCenterX; + v21 = viewparams->sViewCenterY; + if ( viewparams->uMapBookMapZoom == 384 ) + { + v20 = viewparams->indoor_center_x; + v21 = viewparams->indoor_center_y; + } + pMouse->GetClickPos(&pX, &pY); + v0 = 1.0 / (float)((signed int)viewparams->uMapBookMapZoom * 0.000015258789); + + global_coord_X = (signed __int64)((double)(pX - 229) * v0 + (double)v20); + global_coord_Y = (signed __int64)((double)v21 - (double)(pY - 181) * v0); + + result = 0; + map_tile_X = abs(global_coord_X + 22528) / 512;//In the mapbook only lady Margaret dispays for defoult zoom(В книге карты только Леди Маргарита всплывает при дефолтном зуме) + map_tile_Y = abs(global_coord_Y - 22528) / 512; + if ( pOutdoor->_47F04C(map_tile_X, map_tile_Y) && uCurrentlyLoadedLevelType == LEVEL_Outdoor && (signed int)pOutdoor->uNumBModels > 0 ) + { + for(int i = 0; i < pOutdoor->uNumBModels && !result; i++) + { + if ( int_get_vector_length(abs((signed)pOutdoor->pBModels[i].vBoundingCenter.x - global_coord_X), + abs((signed)pOutdoor->pBModels[i].vBoundingCenter.y - global_coord_Y), 0) < pOutdoor->pBModels[i].sBoundingRadius ) + { + if ( pOutdoor->pBModels[i].uNumFaces > 0 ) + { + for( int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++ ) + { + if ( pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID ) + { + if ( !(pOutdoor->pBModels[i].pFaces[j].uAttributes & 0x100000) ) + { + if ( GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID) ) + { + if ( _stricmp(GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID), "") ) + result = GetEventHintString(pOutdoor->pBModels[i].pFaces[j].sCogTriggeredID); + } + } + } + } + } + } + } + } + return result; +} \ No newline at end of file diff -r 79621dd04649 -r 26c1a3d50635 UI/UICharacter.cpp --- a/UI/UICharacter.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/UI/UICharacter.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -1063,7 +1063,7 @@ //--------------------------------------------(Hand/Рука)------------------------------------------------------ if ( !pPlayers[uPlayerID]->pEquipment.uMainHand || ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != EQUIP_MAIN_HAND) - && (pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != PLAYER_SKILL_SPEAR + && (pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetPlayerSkillType() != PLAYER_SKILL_SPEAR || pPlayers[uPlayerID]->pEquipment.uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); @@ -1131,7 +1131,7 @@ if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { if ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == EQUIP_MAIN_HAND - || pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == PLAYER_SKILL_SPEAR + || pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetPlayerSkillType() == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); @@ -1526,7 +1526,7 @@ { item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; if ( item->GetItemEquipType() == EQUIP_MAIN_HAND - || item->GetItemEquipType() == PLAYER_SKILL_SPEAR + || item->GetPlayerSkillType() == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], @@ -2348,7 +2348,7 @@ if ( pParty->pPickedItem.uItemID ) { pEquipType = pParty->pPickedItem.GetItemEquipType(); - pSkillType = pParty->pPickedItem.GetItemEquipType(); + pSkillType = pParty->pPickedItem.GetPlayerSkillType(); if ( pSkillType == 4 ) { if ( v2 ) diff -r 79621dd04649 -r 26c1a3d50635 UI/UIPopup.cpp --- a/UI/UIPopup.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/UI/UIPopup.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -24,6 +24,7 @@ #include "..\texts.h" #include "..\mm7_data.h" +#include "..\Events.h" static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually @@ -440,13 +441,10 @@ unsigned __int8 v27; // sf@36 unsigned __int8 v28; // of@36 SpellBuff *v40; // eax@60 - int v41; // edi@61 - unsigned int v42; // eax@61 - int v43; // eax@62 - int v44; // eax@63 - signed int v45; // edi@65 + int skill_points; // edi@61 + unsigned int skill_level; // eax@61 int pTextHeight; // edi@90 - int v73; // [sp-8h] [bp-1F4h]@79 + PlayerSpeech speech; // [sp-8h] [bp-1F4h]@79 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 RECT v84; // [sp+ECh] [bp-100h]@26 @@ -457,7 +455,7 @@ unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34 unsigned int v109; // [sp+1A8h] [bp-44h]@32 LPVOID v110; // [sp+1ACh] [bp-40h]@28 - int v115; // [sp+1C0h] [bp-2Ch]@3 + bool for_effects; // [sp+1C0h] [bp-2Ch]@3 bool normal_level; // [sp+1D0h] [bp-1Ch]@18 bool expert_level; // [sp+1C4h] [bp-28h]@18 bool master_level; // [sp+1C8h] [bp-24h]@18 @@ -465,8 +463,9 @@ char *pText; // [sp+1D4h] [bp-18h]@18 int pTextColorID; // [sp+1E4h] [bp-8h]@18 int a4; // [sp+1E8h] [bp-4h]@18 + int v115; - bool monster_full_informations = true; + bool monster_full_informations = false; static Actor pMonsterInfoUI_Doll; /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) { @@ -667,93 +666,60 @@ expert_level = 0; master_level = 0; grandmaster_level = 0; + for_effects = 0; pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; - v115 = 0; - if ( !uActiveCharacter ) - v45 = 1; - else + if ( pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) { - int i = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); - if ( !i ) - v45 = 1; - else + skill_points = (unsigned __int8)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) & 0x3F; + skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) - 1; + if ( skill_level == 0 )//(normal) { - v41 = (unsigned __int8)i & 0x3F; - v42 = SkillToMastery(i) - 1; - if ( !v42 )//not master - { - if ( v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - v45 = 1; - normal_level = 1; - } - else - v45 = 1; - } - else//he is master + if ( skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) + normal_level = 1; + } + else if ( skill_level == 1 )//(expert) + { + if ( 2 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { - v43 = v42 - 1; - if ( !v43 ) - { - if ( 2 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - v45 = 1; - normal_level = 1; - expert_level = 1; - } - else - v45 = 1; - } - else - { - v44 = v43 - 1; - if ( !v44 ) - { - if ( 3 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) - { - v45 = 1; - normal_level = 1; - expert_level = 1; - master_level = 1; - } - else - v45 = 1; - } - else - { - if ( v44 != 1 ) - v45 = 1; - else - { - v45 = 1; - normal_level = 1; - expert_level = 1; - master_level = 1; - grandmaster_level = 1; - } - } - } + normal_level = 1; + expert_level = 1; } } - if ( pActors[uActorID].uAIState != Dead - && pActors[uActorID].uAIState != Dying - && !dword_507BF0_is_there_popup_onscreen && i ) + else if ( skill_level == 2 )//(master) { - if ( normal_level | expert_level | master_level | grandmaster_level ) + if ( 3 * skill_points + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { - if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) - v73 = SPEECH_105; - else - v73 = SPEECH_104; + normal_level = 1; + expert_level = 1; + master_level = 1; } - else - v73 = SPEECH_106; - pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)v73, 0); + } + else if ( skill_level == 3 )//grandmaster + { + normal_level = 1; + expert_level = 1; + master_level = 1; + grandmaster_level = 1; } } + if ( pActors[uActorID].uAIState != Dead + && pActors[uActorID].uAIState != Dying + && !dword_507BF0_is_there_popup_onscreen && pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID) ) + { + if ( normal_level | expert_level | master_level | grandmaster_level ) + { + if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) + speech = SPEECH_IDENTIFY_MONSTER_STRONGER; + else + speech = SPEECH_IDENTIFY_MONSTER_WEAKER; + } + else + speech = SPEECH_IDENTIFY_MONSTER_106; + pPlayers[uActiveCharacter]->PlaySound(speech, 0); + } - if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) - v115 = v45; + if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter - 1].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) + for_effects = 1; if ( monster_full_informations == true ) { @@ -761,11 +727,11 @@ expert_level = 1;// master_level = 1;// grandmaster_level = 1;// - v115 = 1; + for_effects = 1; } window->DrawText(pFontSmallnum, 12, 196, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects - if ( !v115 ) + if ( !for_effects ) window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? else { @@ -937,19 +903,19 @@ pText = pGlobalTXT_LocalizationStrings[629];//Spells if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName); + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName);//"%s\f%05u\t060%s\n" window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) { - sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName); + sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName);//"%s\f%05u\t060%s\n" window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]); + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]);//"%s\f%05u\t060%s\n" window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } @@ -1009,6 +975,7 @@ pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } } + //cast spell: Detect life if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) { sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points @@ -1017,191 +984,85 @@ } } - //----- (00417BB5) -------------------------------------------------------- const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) { - //enum PLAYER_SKILL_TYPE v2; // esi@1 - //unsigned int v3; // ebx@1 - int v4; // edi@1 - int v5; // eax@1 - Player *pPlayer; // ebx@7 - char v7; // al@7 - char v8; // cl@7 - unsigned int v9; // eax@8 - unsigned int v10; // eax@8 - unsigned int v11; // eax@8 - PLAYER_SKILL_TYPE v12; // edi@8 - unsigned int v13; // eax@8 - unsigned int v14; // eax@8 - PLAYER_SKILL_TYPE v15; // esi@8 - int v16; // edi@8 - char v17; // al@8 - int v18; // ST5C_4@8 - int v19; // ST4C_4@8 - int v20; // ST3C_4@8 - int v21; // ST2C_4@8 - int v22; // ST1C_4@8 - char *v23; // esi@8 - unsigned int v24; // eax@9 - unsigned int v25; // eax@9 - unsigned int v26; // eax@9 - unsigned int v27; // ecx@9 - PLAYER_SKILL_TYPE v28; // ebx@9 - unsigned int v29; // eax@9 - char a2[1200]; // [sp+Ch] [bp-538h]@7 - char Source[120]; // [sp+4BCh] [bp-88h]@7 - unsigned __int16 *v33; // [sp+534h] [bp-10h]@1 - int v34; // [sp+538h] [bp-Ch]@1 - unsigned __int16 *v35; // [sp+53Ch] [bp-8h]@1 - //enum PLAYER_SKILL_TYPE v36; // [sp+540h] [bp-4h]@1 + char a2[1200]; // [sp+Ch] [bp-538h]@7 + char Source[120]; // [sp+4BCh] [bp-88h]@7 + int v35; // [sp+53Ch] [bp-8h]@1 + + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]) > (signed int)v35 ) + v35 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand - //v2 = uPlayerSkillType; - //v3 = uPlayerID; - //v36 = uPlayerSkillType; - v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal - v34 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert - v33 = (unsigned __int16 *)pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master - v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[96]);// Grand - v35 = (unsigned __int16 *)v4; - if ( v34 > v4 ) - v35 = (unsigned __int16 *)v34; - if ( (signed int)v33 > (signed int)v35 ) - v35 = v33; - if ( v5 > (signed int)v35 ) - v35 = (unsigned __int16 *)v5; - pPlayer = &pParty->pPlayers[uPlayerID]; - //v33 = &pPlayer->pActiveSkills[uPlayerSkillType]; - v7 = pPlayer->GetActualSkillLevel(uPlayerSkillType); - v8 = pPlayer->pActiveSkills[uPlayerSkillType]; - a2[0] = 0; - Source[0] = 0; - if ( (v8 & 0x3F) == (v7 & 0x3F) ) - { - strcpy(a2, "%s\n\n"); - v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1); - sprintf(Source, "\f%05d", v24); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2); - sprintf(Source, "\f%05d", v25); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3); - sprintf(Source, "\f%05d", v26); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v27 = pPlayer->classType; - v28 = uPlayerSkillType; - v29 = GetSkillColor(v27, uPlayerSkillType, 4); - sprintf(Source, "\f%05d", v29); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - - v23 = static_sub_417BB5_out_string; - sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[v28], pGlobalTXT_LocalizationStrings[431], // Normal - (char *)v35 + 3, v35 + 5, pNormalSkillDesc[v28], pGlobalTXT_LocalizationStrings[433], // Expert - (char *)v35 + 3, v35 + 5, pExpertSkillDesc[v28], pGlobalTXT_LocalizationStrings[432], // Master - (char *)v35 + 3, v35 + 5, pMasterSkillDesc[v28], pGlobalTXT_LocalizationStrings[96], // Grand - (char *)v35 + 3, v35 + 5, pGrandSkillDesc[v28]); - } - else - { - strcpy(a2, "%s\n\n"); - v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1); - sprintf(Source, "\f%05d", v9); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2); - sprintf(Source, "\f%05d", v10); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3); - sprintf(Source, "\f%05d", v11); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); - v12 = uPlayerSkillType; - v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4); - sprintf(Source, "\f%05d", v13); - strcat(a2, Source); - strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n"); - v14 = TargetColor(0xFFu, 0xFFu, 0xFFu); - sprintf(Source, "\f%05d", v14); - strcat(a2, Source); - strcat(a2, "%s: +%d"); - v15 = v12; - v16 = (int)(v35 + 5); - v15 = (PLAYER_SKILL_TYPE)((int)v15 * 4); - v34 = (int)((char *)v35 + 3); - v17 = pPlayer->GetActualSkillLevel(uPlayerSkillType); - v18 = *(int *)(pGrandSkillDesc[v15]); - v19 = *(int *)(pMasterSkillDesc[v15]); - v20 = *(int *)(pExpertSkillDesc[v15]); - v21 = *(int *)(pNormalSkillDesc[v15]); - v22 = *(int *)(pSkillDesc[v15]); - v23 = static_sub_417BB5_out_string; - sprintf( - static_sub_417BB5_out_string, - a2, - v22, - pGlobalTXT_LocalizationStrings[431], - v34, - v16, - v21, - pGlobalTXT_LocalizationStrings[433], - v34, - v16, - v20, - pGlobalTXT_LocalizationStrings[432], - v34, - v16, - v19, - pGlobalTXT_LocalizationStrings[96], - v34, - v16, - v18, - pGlobalTXT_LocalizationStrings[623], - (v17 & 0x3F) - (*(char *)v33 & 0x3F)); - } - return v23; - } + a2[0] = 0; + Source[0] = 0; + strcpy(a2, "%s\n\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 1)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 2)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 3)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + sprintf(Source, "\f%05d", GetSkillColor(pParty->pPlayers[uPlayerID].classType, uPlayerSkillType, 4)); + strcat(a2, Source); + strcat(a2, "%s\t%03d:\t%03d%s\t000\n"); + if ( (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F) == (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) ) + { + sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], // Normal + pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], // Expert + pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], // Master + pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType]); // Grand + } + else + { + sprintf(Source, "\f%05d", TargetColor(0xFFu, 0xFFu, 0xFFu)); + strcat(a2, Source); + strcat(a2, "%s: +%d"); + sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[431], v35 + 3, v35 + 5, pNormalSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[433], v35 + 3, v35 + 5, pExpertSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[432], v35 + 3, v35 + 5, pMasterSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[96], v35 + 3, v35 + 5, pGrandSkillDesc[uPlayerSkillType], + pGlobalTXT_LocalizationStrings[623], //Bonus + (pParty->pPlayers[uPlayerID].GetActualSkillLevel(uPlayerSkillType) & 0x3F) - (pParty->pPlayers[uPlayerID].pActiveSkills[uPlayerSkillType] & 0x3F)); + } + return static_sub_417BB5_out_string; +} //----- (00417FE5) -------------------------------------------------------- - void CharacterUI_SkillsTab_ShowHint() - { - unsigned int v0; // ecx@1 - unsigned int v1; // eax@1 - GUIButton *i; // esi@6 - const char *v3; // eax@12 - unsigned int pX; // [sp+4h] [bp-8h]@1 - unsigned int pY; // [sp+8h] [bp-4h]@1 +void CharacterUI_SkillsTab_ShowHint() +{ + GUIButton *pButton; // esi@6 + unsigned int pX; // [sp+4h] [bp-8h]@1 + unsigned int pY; // [sp+8h] [bp-4h]@1 - pMouse->GetClickPos(&pX, &pY); - v0 = pX; - v1 = pY; - if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) - { - for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) - { - if ( i->msg == UIMSG_SkillUp - && (signed int)v0 >= (signed int)i->uX - && (signed int)v0 <= (signed int)i->uZ - && (signed int)v1 >= (signed int)i->uY - && (signed int)v1 <= (signed int)i->uW ) - { - v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param); - CharacterUI_DrawTooltip(pSkillNames[i->msg_param], v3); - v1 = pY; - v0 = pX; - } - } - } - else - { - CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); - } - + pMouse->GetClickPos(&pX, &pY); + if ( (signed int)pX < 24 || (signed int)pX > 455 || (signed int)pY < 18 || (signed int)pY > 36 ) + { + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) + { + if ( pButton->msg == UIMSG_SkillUp + && (signed int)pX >= (signed int)pButton->uX + && (signed int)pX <= (signed int)pButton->uZ + && (signed int)pY >= (signed int)pButton->uY + && (signed int)pY <= (signed int)pButton->uW ) + { + CharacterUI_DrawTooltip(pSkillNames[pButton->msg_param], CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)pButton->msg_param)); + } } + } + else + CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);//Очки навыков +} //----- (00418083) -------------------------------------------------------- void CharacterUI_StatsTab_ShowHint() @@ -1211,7 +1072,6 @@ char *pHourWord; // ecx@17 char *pDayWord; // eax@20 int v15; // ebx@28 - int v16; // eax@33 POINT a2; // [sp+Ch] [bp-24h]@1 int pHour; // [sp+14h] [bp-1Ch]@15 unsigned int pDay; // [sp+24h] [bp-Ch]@15 @@ -1304,8 +1164,7 @@ pTmpBuf2[0] = 0; if ( v15 > pPlayers[uActiveCharacter]->uLevel ) sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[147], v15); - v16 = GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience); - sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); + sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], GetExperienceRequiredForLevel(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience), v15 + 1); strcat(pTmpBuf.data(), "\n"); strcat(pTmpBuf.data(), pTmpBuf2.data()); sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); @@ -1368,463 +1227,771 @@ } } - //----- (00410B28) -------------------------------------------------------- - void DrawSpellDescriptionPopup(int spell_index) - { - Player *v1; // edi@1 - SpellInfo *v2; // esi@1 - unsigned int v3; // eax@2 - int v4; // eax@4 - LONG v5; // ecx@4 - int v6; // eax@10 - char *v7; // ST44_4@12 - unsigned __int16 v8; // ax@12 - GUIWindow a1; // [sp+Ch] [bp-68h]@4 - int v10; // [sp+60h] [bp-14h]@1 - POINT a2; // [sp+64h] [bp-10h]@1 - int v12; // [sp+6Ch] [bp-8h]@4 - int v13; // [sp+70h] [bp-4h]@4 +//----- (00410B28) -------------------------------------------------------- +void DrawSpellDescriptionPopup(int spell_index) +{ + SpellInfo *spell; // esi@1 + unsigned int v3; // eax@2 + LONG v5; // ecx@4 + GUIWindow spell_info_window; // [sp+Ch] [bp-68h]@4 + POINT mouse; // [sp+64h] [bp-10h]@1 - v1 = pPlayers[uActiveCharacter]; - v10 = spell_index; - v2 = &pSpellStats->pInfos[spell_index + 11 * v1->lastOpenedSpellbookPage + 1]; - if ( pMouse->GetCursorPos(&a2)->y <= 250 ) - v3 = pMouse->GetCursorPos(&a2)->y + 30; - else - v3 = 30; - a1.uFrameY = v3; - a1.uFrameWidth = 328; - a1.uFrameHeight = 68; - a1.uFrameX = 90; - a1.uFrameZ = 417; - a1.uFrameW = v3 + 67; - a1.Hint = 0; - a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); - v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); - v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); - v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); - v5 = a2.y; - if ( v13 > a2.y ) - v5 = v13; - if ( v12 > v5 ) - v5 = v12; - if ( v4 > v5 ) - v5 = v4; - sprintf( pTmpBuf2.data(), + spell = &pSpellStats->pInfos[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1]; + if ( pMouse->GetCursorPos(&mouse)->y <= 250 ) + v3 = pMouse->GetCursorPos(&mouse)->y + 30; + else + v3 = 30; + spell_info_window.uFrameY = v3; + spell_info_window.uFrameWidth = 328; + spell_info_window.uFrameHeight = 68; + spell_info_window.uFrameX = 90; + spell_info_window.uFrameZ = 417; + spell_info_window.uFrameW = v3 + 67; + spell_info_window.Hint = 0; + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_MASTER]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT]); + if ( pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]) > v5 ) + v5 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[LOCSTR_GRAND]); + sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s", - v2->pDescription, - pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], - v5 + 3, v5 + 10, - v2->pBasicSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], - v5 + 3, v5 + 10, - v2->pExpertSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], - v5 + 3, v5 + 10, - v2->pMasterSkillDesc, - pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], - v5 + 3, v5 + 10, - v2->pGrandmasterSkillDesc); - v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0); - a1.uFrameHeight += v6; - if ( (signed int)a1.uFrameHeight < 150 ) - a1.uFrameHeight = 150; - a1.uFrameWidth = game_viewport_width; - a1.DrawMessageBox(0); - a1.uFrameWidth -= 12; - a1.uFrameHeight -= 12; - v7 = v2->pName; - a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; - a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; - v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u); - a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); - a1.uFrameWidth = 108; - a1.uFrameZ = a1.uFrameX + 107; - a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u); - sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], - pSpellDatas[spell_index + 11 * v1->lastOpenedSpellbookPage + 1].mana_per_skill[v1->pActiveSkills[v1->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]); - // *(&[0].field_12 //temp_fix field_14 - // + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6) - // + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage))); - a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3u); - dword_507B00_spell_info_to_draw_in_popup = 0; - } + spell->pDescription, + pGlobalTXT_LocalizationStrings[LOCSTR_NORMAL], v5 + 3, v5 + 10, spell->pBasicSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_EXPERT], v5 + 3, v5 + 10, spell->pExpertSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_MASTER], v5 + 3, v5 + 10, spell->pMasterSkillDesc, + pGlobalTXT_LocalizationStrings[LOCSTR_GRAND], v5 + 3, v5 + 10, spell->pGrandmasterSkillDesc); + spell_info_window.uFrameHeight += pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &spell_info_window, 0, 0); + if ( (signed int)spell_info_window.uFrameHeight < 150 ) + spell_info_window.uFrameHeight = 150; + spell_info_window.uFrameWidth = game_viewport_width; + spell_info_window.DrawMessageBox(0); + spell_info_window.uFrameWidth -= 12; + spell_info_window.uFrameHeight -= 12; + spell_info_window.uFrameZ = spell_info_window.uFrameX + spell_info_window.uFrameWidth - 1; + spell_info_window.uFrameW = spell_info_window.uFrameHeight + spell_info_window.uFrameY - 1; + spell_info_window.DrawTitleText(pFontArrus, 0x78u, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), spell->pName, 3); + spell_info_window.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0); + spell_info_window.uFrameWidth = 108; + spell_info_window.uFrameZ = spell_info_window.uFrameX + 107; + spell_info_window.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12], 3); + sprintf( pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[LOCSTR_SP_COST], + pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + PLAYER_SKILL_FIRE]]); + spell_info_window.DrawTitleText(pFontComic, 0xCu, spell_info_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3); + dword_507B00_spell_info_to_draw_in_popup = 0; +} // 507B00: using guessed type int dword_507B00_spell_info_to_draw_in_popup; - - - - //----- (00416D62) -------------------------------------------------------- void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(Vec2_int_ *_this) { - signed int pPlayerNum; // eax@12 - char *v2; // eax@32 - void *v3; // ecx@52 - unsigned int v4; // eax@59 - int v5; // esi@62 - signed int v6; // esi@64 - signed int v7; // esi@69 - ItemGen *v8; // ecx@70 - unsigned int v9; // eax@72 - unsigned int v10; // eax@76 - //char v11; // zf@83 - GUIButton *pButton; // esi@84 - unsigned int v13; // ecx@85 - char *pStr; // edi@85 - //signed int pControlID; // eax@92 - int v16; // eax@95 - int v17; // eax@96 - PLAYER_SKILL_TYPE v18; // eax@98 - char *pStr2; // eax@99 - unsigned int v20; // eax@108 - unsigned int pSkillId; // eax@109 - const char *pSkillInfo; // eax@111 - //char *v23; // ebx@112 - char *pHint; // edx@113 - unsigned int pColor; // eax@113 - GUIWindow pWindow; // [sp+4h] [bp-74h]@32 - double v27; // [sp+58h] [bp-20h]@33 - struct tagPOINT Point; // [sp+60h] [bp-18h]@6 - char *v29; // [sp+68h] [bp-10h]@33 - float v30; // [sp+6Ch] [bp-Ch]@33 - unsigned int pX; // [sp+70h] [bp-8h]@3 - unsigned int pY; // [sp+74h] [bp-4h]@3 + int v5; // esi@62 + GUIButton *pButton; // esi@84 + char *pStr; // edi@85 + char *pHint; // edx@113 + GUIWindow popup_window; // [sp+4h] [bp-74h]@32 + struct tagPOINT Point; // [sp+60h] [bp-18h]@6 + unsigned int pX; // [sp+70h] [bp-8h]@3 + unsigned int pY; // [sp+74h] [bp-4h]@3 + + if ( pCurrentScreen == SCREEN_VIDEO ) + return; + if ( _this ) + { + pX = _this->x; + pY = _this->y; + } + else + { + pMouse->GetClickPos(&pX, &pY); + } + if ( pRenderer->bWindowMode ) + { + GetCursorPos(&Point); + ScreenToClient(hWnd, &Point); + if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) + { + back_to_game(); + return; + } + } + if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором + { + for ( uint i = 0; i < 4; ++i ) + { + if ( (signed int)pX > RightClickPortraitXmin[i] && (signed int)pX < RightClickPortraitXmax[i] + && (signed int)pY > 375 && (signed int)pY < 466 ) + { + pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(i + 1, 1); + return; + } + } + } - if ( pCurrentScreen == SCREEN_VIDEO ) - return; - if ( _this ) - { - pX = _this->x; - pY = _this->y; - } + pEventTimer->Pause(); + switch(pCurrentScreen) + { + case SCREEN_CASTING: + { + Inventory_ItemPopupAndAlchemy(); + break; + } + case SCREEN_CHEST: + { + if ( !pPlayers[uActiveCharacter]->CanAct() ) + { + sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + popup_window.Hint = pTmpBuf.data(); + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 180; + popup_window.uFrameY = 40; + if ( (signed int)pX <= 320 ) + popup_window.uFrameX = pX + 30; else - { - pMouse->GetClickPos(&pX, &pY); - } - if ( pRenderer->bWindowMode ) - { - GetCursorPos(&Point); - ScreenToClient(hWnd, &Point); - if ( Point.x < 1 || Point.y < 1 || Point.x > 638 || Point.y > 478 ) - { - back_to_game(); - return; - } - } - - if ( pParty->pPickedItem.uItemID )//нажатие на портрет перса правой кнопкой мыши с раствором + popup_window.uFrameX = pX - 414; + popup_window.DrawMessageBox(0); + } + else + { + if ( pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF ) + GameUI_DrawItemInfo(&pChests[pChestWindow->par1C].igChestItems[pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]] & 0xFFFF) - 1] - 1]); + } + break; + } + case SCREEN_GAME://In the main menu displays a pop-up window(В главном меню показывает всплывающее окно) + { + if (GetCurrentMenuID() > 0) + break; + if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) + { + popup_window.ptr_1C = (void *)((signed int)pX / 118); + if ( (signed int)pX / 118 < 4 )//portaits zone + { + popup_window.Hint = 0; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + GameUI_CharacterQuickRecord_Draw(&popup_window, pPlayers[(int)popup_window.ptr_1C + 1]); + } + } + else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) + { + if ( (signed int)pY >= 130 ) + { + if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 )//buff_tooltip zone + { + popup_window.Hint = 0; + popup_window.uFrameWidth = 400; + popup_window.uFrameHeight = 200; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + pAudioPlayer->StopChannels(-1, -1); + popup_window._41D73D_draw_buff_tooltip(); + } + else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 )//NPC zone + { + if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) { - //v1 = 0; - //do - for ( pPlayerNum = 0; pPlayerNum < 4; ++pPlayerNum) - { - if ( (signed int)pX > RightClickPortraitXmin[pPlayerNum] && (signed int)pX < RightClickPortraitXmax[pPlayerNum] - && (signed int)pY > 375 && (signed int)pY < 466 ) - { - pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(pPlayerNum + 1, 1); - return; - } - //++v1; - } - //while ( v1 < 4 ); + pAudioPlayer->StopChannels(-1, -1); + GameUI_DrawNPCPopup((void *)1);//NPC 2 } - - pEventTimer->Pause(); - - switch(pCurrentScreen) - { - case SCREEN_CASTING: - { - OnInventoryItemRightClick(); - break; - } - - case SCREEN_CHEST: + } + else + { + pAudioPlayer->StopChannels(-1, -1); + GameUI_DrawNPCPopup(0);//NPC 1 + } + } + else//minimap zone + { + popup_window.Hint = (char *)GameUI_GetMinimapHintText(); + popup_window.uFrameWidth = 256; + popup_window.uFrameX = 130; + popup_window.uFrameY = 140; + popup_window.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + popup_window.DrawMessageBox(0); + } + } + else//game zone + { + popup_window.Hint = 0; + popup_window.uFrameWidth = 320; + popup_window.uFrameHeight = 320; + popup_window.uFrameX = pX - 350; + if ( (signed int)pX <= 320 ) + popup_window.uFrameX = pX + 30; + popup_window.uFrameY = 40; + if ( pRenderer->pRenderD3D ) + LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); + else + v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; + if (PID_TYPE((unsigned __int16)v5) == OBJECT_Actor) + { + if ( pRenderer->uNumSceneBegins ) + { + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); + } + else + { + pRenderer->BeginScene(); + popup_window.DrawMessageBox(1); + MonsterPopup_Draw(PID_ID((unsigned __int16)v5), &popup_window); + pRenderer->EndScene(); + } + } + if (PID_TYPE((unsigned __int16)v5) == OBJECT_Item) + { + if ( !(pObjectList->pObjects[pSpriteObjects[PID_ID((unsigned __int16)v5)].uObjectDescID].uFlags & 0x10 ) ) + { + GameUI_DrawItemInfo(&pSpriteObjects[PID_ID((unsigned __int16)v5)].stru_24); + } + } + } + break; + } + case SCREEN_BOOKS: + { + if ( !dword_506364 + || (signed int)pX < (signed int)pViewport->uViewportTL_X || (signed int)pX > (signed int)pViewport->uViewportBR_X + || (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y + || ((popup_window.Hint = (char *)GetMapBookHintText()) == 0) ) + break; + popup_window.uFrameWidth = (pFontArrus->GetLineWidth(popup_window.Hint) + 32) + 0.5f; + popup_window.uFrameX = pX + 5; + popup_window.uFrameY = pY + 5; + popup_window.uFrameHeight = 64; + pAudioPlayer->StopChannels(-1, -1); + popup_window.DrawMessageBox(0); + break; + } + case SCREEN_CHARACTERS: + case SCREEN_E: + case SCREEN_CHEST_INVENTORY: + { + if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) + Inventory_ItemPopupAndAlchemy(); + else if ( (signed int)pY >= 345 ) + break; + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats + CharacterUI_StatsTab_ShowHint(); + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills + CharacterUI_SkillsTab_ShowHint(); + else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory + Inventory_ItemPopupAndAlchemy(); + break; + } + case SCREEN_SPELL_BOOK: + { + if ( dword_507B00_spell_info_to_draw_in_popup ) + DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); + break; + } + case SCREEN_HOUSE: + { + if ( (signed int)pY < 345 && (signed int)pX < 469 ) + ShowPopupShopItem(); + break; + } + case SCREEN_PARTY_CREATION: + { + popup_window.Hint = 0; + pStr = 0; + for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) + { + if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ + && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) + { + switch ( pButton->msg ) + { + case UIMSG_0: //stats info + popup_window.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; + pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; + break; + case UIMSG_PlayerCreationClickPlus: //Plus button info + pStr = pGlobalTXT_LocalizationStrings[670];//Добавить + popup_window.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" + break; + case UIMSG_PlayerCreationClickMinus: //Minus button info + pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть + popup_window.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" + break; + case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info + pStr = pSkillNames[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + popup_window.Hint = pSkillDesc[pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4)]; + break; + case UIMSG_PlayerCreationSelectClass: //Available Class Info + popup_window.Hint = pClassDescriptions[pButton->msg_param]; + pStr = pClassNames[pButton->msg_param]; + break; + case UIMSG_PlayerCreationClickOK: //OK Info + popup_window.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. + pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК + break; + case UIMSG_PlayerCreationClickReset: //Clear info + popup_window.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. + pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить + break; + case UIMSG_PlayerCreation_SelectAttribute: // Character info + pStr = pParty->pPlayers[pButton->msg_param].pName; + popup_window.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; + break; + } + if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info + { + pY = 0; + if ( (signed int)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48) < 37 ) { - if ( !pPlayers[uActiveCharacter]->CanAct() ) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427],//%s не в состоянии %s - pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//Опознать предметы - pWindow.Hint = pTmpBuf.data(); - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 180; - pWindow.uFrameY = 40; - if ( (signed int)pX <= 320 ) - v10 = pX + 30; - else - v10 = pX - 414; - pWindow.uFrameX = v10; - pWindow.DrawMessageBox(0); - } - else - { - v9 = pX + pSRZBufferLineOffsets[pY]; - if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF ) - { + strcpy(pTmpBuf2.data(), CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48))); + popup_window.Hint = pTmpBuf2.data(); + pStr = pSkillNames[pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48)]; + } + } + } + } + if ( popup_window.Hint ) + { + pHint = (char*)popup_window.Hint; + popup_window.Hint = 0; + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 256; + popup_window.uFrameX = 128; + popup_window.uFrameY = 40; + popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + popup_window.DrawMessageBox(0); + popup_window.uFrameX += 12; + popup_window.uFrameWidth -= 24; + popup_window.uFrameY += 12; + popup_window.uFrameHeight -= 12; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", TargetColor(0xFF, 0xFF, 0x9B), pStr); + popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); + popup_window.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); + } + break; + } + default: + break; + } + dword_507BF0_is_there_popup_onscreen = 1; + viewparams->bRedrawGameUI = 1; +} +int no_rightlick_in_inventory = false; // 0050CDCC +//----- (00416196) -------------------------------------------------------- +void Inventory_ItemPopupAndAlchemy() +{ + int potion1_id; // edx@25 + unsigned int potion2_id; // edi@25 + signed int potionID; // edx@27 + unsigned int pOut_y; // edx@57 + double v31; // st7@112 + Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 + GUIWindow message_window; // [sp+Ch] [bp-84h]@137 + POINT a2; // [sp+78h] [bp-18h]@2 + unsigned int damage_level; // [sp+8Ch] [bp-4h]@23 - // __debugbreak(); // invalid indexing will result in invalid object ptr - // v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime - // + (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); - v10=pChests[pChestWindow->par1C].pInventoryIndices[(pRenderer->pActiveZBuffer[v9] & 0xFFFF)-1]; - v8 =&pChests[pChestWindow->par1C].igChestItems[v10-1]; - GameUI_DrawItemInfo(v8); - } - } - break; - } - case SCREEN_GAME: - { - if (GetCurrentMenuID() > 0) - break; + if (no_rightlick_in_inventory) + return; + + pMouse->GetCursorPos(&a2); + int item_pid = (pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF) - 1; + auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid]; + + if (a2.x <= 13 || a2.x >= 462)//items out of inventory(вещи вне инвентаря) + { + GameUI_DrawItemInfo(item); + return; + } + + if (!item_pid) + { + int inventory_mouse_x = a2.x - 14; + int inventory_mouse_y = a2.y - 17; + + int mouse_cell_x = inventory_mouse_x / 32; + int mouse_cell_y = inventory_mouse_y / 32; + + if (mouse_cell_x + mouse_cell_y < 0) + return; + + int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; + if (inventory_idx > 126) + return; + + if (pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx) == 0) + return; - if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) - { - pWindow.ptr_1C = (void *)((signed int)pX / 118); - if ( (signed int)pX / 118 < 4 ) - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - GameUI_CharacterQuickRecord_Draw(&pWindow, pPlayers[(int)pWindow.ptr_1C + 1]); - } - } - else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) - { - if ( (signed int)pY >= 130 ) - { - if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 ) - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 400; - pWindow.uFrameHeight = 200; - pWindow.uFrameX = 38; - pWindow.uFrameY = 60; - pAudioPlayer->StopChannels(-1, -1); - pWindow._41D73D_draw_buff_tooltip(); - } - else if ( (signed int)pX < 485 || (signed int)pX > 548 || (signed int)pY < 156 || (signed int)pY > 229 ) - { - if (!( (signed int)pX < 566 || (signed int)pX > 629 || (signed int)pY < 156 || (signed int)pY > 229 )) - { - pAudioPlayer->StopChannels(-1, -1); - v3 = (void *)1; - GameUI_DrawNPCPopup(v3); - } - } - else - { - pAudioPlayer->StopChannels(-1, -1); - v3 = 0; - GameUI_DrawNPCPopup(v3); - } - } - else - { - pWindow.Hint = (char *)GameUI_GetMinimapHintText(); - pWindow.uFrameWidth = 256; - pWindow.uFrameX = 130; - pWindow.uFrameY = 140; - pWindow.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); - } - } - else - { - pWindow.Hint = 0; - pWindow.uFrameWidth = 320; - pWindow.uFrameHeight = 320; - v4 = pX - 350; - if ( (signed int)pX <= 320 ) - v4 = pX + 30; - pWindow.uFrameX = v4; - pWindow.uFrameY = 40; - if ( pRenderer->pRenderD3D ) - LOWORD(v5) = pGame->pVisInstance->get_picked_object_zbuf_val(); - else - v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - v6 = (unsigned __int16)v5; - if (PID_TYPE(v6) != OBJECT_Item) - { - if (PID_TYPE(v6) == OBJECT_Actor) - { - if ( pRenderer->uNumSceneBegins ) - { - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID(v6), &pWindow); - } - else - { - pRenderer->BeginScene(); - pWindow.DrawMessageBox(1); - MonsterPopup_Draw(PID_ID(v6), &pWindow); - pRenderer->EndScene(); - } - } - } - else - { - v7 = PID_ID(v6); - if ( ! (pObjectList->pObjects[pSpriteObjects[v7].uObjectDescID].uFlags & 0x10 ) ) - { - v8 = &pSpriteObjects[v7].stru_24; - GameUI_DrawItemInfo(v8); - } - } - } - break; - } - case SCREEN_BOOKS: - { - if ( !dword_506364 - || (signed int)pX < (signed int)pViewport->uViewportTL_X - || (signed int)pX > (signed int)pViewport->uViewportBR_X - || (signed int)pY < (signed int)pViewport->uViewportTL_Y - || (signed int)pY > (signed int)pViewport->uViewportBR_Y - || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) ) - break; - v30 = (double)(pFontArrus->GetLineWidth(v2) + 32); - v27 = v30 + 6.7553994e15; - v29 = (char *)LODWORD(v27); - pWindow.uFrameWidth = LODWORD(v27); - pWindow.uFrameX = pX + 5; - pWindow.uFrameY = pY + 5; - pWindow.uFrameHeight = 64; - pAudioPlayer->StopChannels(-1, -1); - pWindow.DrawMessageBox(0); - break; - } - case SCREEN_CHARACTERS: - case SCREEN_E: - case SCREEN_CHEST_INVENTORY: - { - if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) - { - OnInventoryItemRightClick(); - } - else if ( (signed int)pY >= 345 ) - break; - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 100 )//2DEvent - CharacerScreenStats - { - CharacterUI_StatsTab_ShowHint(); - } - else if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 101 )//2DEvent - CharacerScreenSkills - { - CharacterUI_SkillsTab_ShowHint(); - } - else - { - if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory - OnInventoryItemRightClick(); - } - break; - } - case SCREEN_SPELL_BOOK: - { - if ( dword_507B00_spell_info_to_draw_in_popup ) - DrawSpellDescriptionPopup(dword_507B00_spell_info_to_draw_in_popup - 1); - break; - } - case SCREEN_HOUSE: + item_pid = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx); + } +//check character condition(проверка состояния персонажа) + if (!pPlayers[uActiveCharacter]->CanAct()) + { + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы + message_window.Hint = pTmpBuf.data(); + message_window.uFrameWidth = 384; + message_window.uFrameHeight = 180; + if (a2.x <= 320 ) + message_window.uFrameX = a2.x + 30; + else + message_window.uFrameX = a2.x - 414; + message_window.uFrameY = 40; + message_window.DrawMessageBox(0); + return; + } + + int alchemy_skill_points = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY) & 0x3F; + int alchemy_skill_level = SkillToMastery(pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY)); + +// for potion bottle(простая бутылка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) + { + GameUI_DrawItemInfo(item); + return; + } +//for recharge potion(зелье перезарядка) + if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) + { + if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION)// all potions + { + if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } + + v31 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; + if ( v31 < 0.0 ) + v31 = 0.0; + item->uMaxCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); + item->uNumCharges = (signed __int64)((double)item->uMaxCharges - v31 * (double)item->uMaxCharges); + + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// for harden potion(зелье закалка) + else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) + { + if (item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // bottle and all potions + { + if (item->IsBroken() || // cant harden broken items + item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts + item->GetItemEquipType() < EQUIP_OFF_HAND || + item->GetItemEquipType() > EQUIP_WAND) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } +// several potions(несколько зелий) + else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || + pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + if ( item->uItemID < ITEM_POTION_BOTTLE || item->uItemID > ITEM_POTION_REJUVENATION) // all potions + { + if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || + item->uItemID >= ITEM_ARTIFACT_PUCK || + item->IsBroken() || + item->uSpecEnchantmentType || + item->uEnchantmentType || + item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + + item->UpdateTempBonus(pParty->uTimePlayed); + if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) + { + item->uSpecEnchantmentType = 40; // of Slaying + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + else + { + static int _4E2904_enchantment_by_potion_lut[] = { - if ( (signed int)pY < 345 && (signed int)pX < 469 ) - ShowPopupShopItem(); - break; + 164, 93, 22, + 164, 93, 22, + 11, 5, 13, 7, 59 + }; + item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; + v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); + } + + item->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; + item->uAttributes = alchemy_skill_level | 0x18; + + _50C9A8_item_enchantment_timer = 256; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = true; + return; + } + GameUI_DrawItemInfo(item); + return; + } + // use reagents(применение реагентов) + if (pParty->pPickedItem.uItemID >= ITEM_REAGENT_WIDOWSWEEP_BERRIES && pParty->pPickedItem.uItemID <= ITEM_REAGENT_PHILOSOPHERS_STONE && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_BOTTLE) + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice(); + switch ( pParty->pPickedItem.uItemID ) + { + case 200: + case 201: + case 202: + case 203: + case 204: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222; + break; + case 205: + case 206: + case 207: + case 208: + case 209: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223; + break; + case 210: + case 211: + case 212: + case 213: + case 214: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224; + break; + case 215: + case 216: + case 217: + case 218: + case 219: + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221; + break; + default: + break; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + if ( dword_4E455C ) + { + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + } + return; + } +//potions mixing(смешивание двух зелий) + if (pParty->pPickedItem.uItemID >= ITEM_POTION_CATALYST && pParty->pPickedItem.uItemID <= ITEM_POTION_REJUVENATION && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID >= ITEM_POTION_CATALYST && + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID <= ITEM_POTION_REJUVENATION) + { + potion1_id = item->uItemID - ITEM_POTION_CURE_WOUNDS; + potion2_id = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; + + if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || item->uItemID == ITEM_POTION_CATALYST ) + potionID = 5; + else + potionID = pItemsTable->potion_data[potion2_id][potion1_id]; + damage_level = 0; + if ( alchemy_skill_points ) + { + if ( potionID < ITEM_POTION_CURE_DISEASE || potionID > ITEM_POTION_AWAKEN )//< 225 >227 + { + if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY && alchemy_skill_level == 1)//228 >= potionID <= 239 + damage_level = 2; + if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE && alchemy_skill_level <= 2)//240 >= potionID <= 261 + damage_level = 3; + if ( potionID >= ITEM_POTION_STONE_TO_FLESH && alchemy_skill_level <= 3 )// 262 < potionID + damage_level = 4; + } + } + else//no skill(нет навыка) + { + if ( potionID >= ITEM_POTION_CURE_DISEASE && potionID <= ITEM_POTION_AWAKEN )//225 <= v16 <= 227 + damage_level = 1; + if ( potionID >= ITEM_POTION_HASTE && potionID <= ITEM_POTION_CURE_INSANITY )//228 <= v16 <= 239 + damage_level = 2; + if ( potionID >= ITEM_POTION_MIGHT_BOOST && potionID <= ITEM_POTION_BODY_RESISTANE )//240 <= v16 <= 261 + damage_level = 3; + if ( potionID >= ITEM_POTION_STONE_TO_FLESH )//262 <= v16 + damage_level = 4; + } + + int pOut_x = item_pid + 1; + for ( uint i = 0; i < 126; ++i ) + { + if ( pPlayers[uActiveCharacter]->pInventoryMatrix[i] == pOut_x ) + { + pOut_y = i; + break; + } + } + if ( !potionID ) + { + GameUI_DrawItemInfo(item); + return; + } + if ( damage_level == 1 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 11 + 10, DMGT_FIRE); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 2 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 71 + 30, DMGT_FIRE); + pPlayers[uActiveCharacter]->ItemsEnchant(1); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 3 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->ReceiveDamage(rand() % 201 + 50, DMGT_FIRE); + pPlayers[uActiveCharacter]->ItemsEnchant(5); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 4 ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(pOut_y); + pPlayers[uActiveCharacter]->SetCondition(0x10u, 0); + pPlayers[uActiveCharacter]->ItemsEnchant(0); + pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); + + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + + v39.z = pParty->vPosition.z + pParty->sEyelevel; + v39.x = pParty->vPosition.x; + v39.y = pParty->vPosition.y; + + int rot_x, rot_y, rot_z; + Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); + sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); + if ( dword_4E455C ) + { + if ( pPlayers[uActiveCharacter]->CanAct() ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2);//Ой! + dword_4E455C = 0; + } + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + if ( damage_level == 0 ) + { + if ( alchemy_skill_points ) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор) + { + if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID; + if ( pParty->pPickedItem.uItemID == 221 ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType; } - case SCREEN_PARTY_CREATION: - { - pWindow.Hint = 0; - pStr = 0; - for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext) - { - if ( pButton->uButtonType == 1 && pButton->uButtonType != 3 && (signed int)pX > (signed int)pButton->uX && (signed int)pX < (signed int)pButton->uZ - && (signed int)pY > (signed int)pButton->uY && (signed int)pY < (signed int)pButton->uW ) - { - switch ( pButton->msg ) - { - case UIMSG_0: //stats info - pWindow.Hint = pAttributeDescriptions[(signed int)pButton->msg_param % 7]; - pStr = aAttributeNames[(signed int)pButton->msg_param % 7]; - break; - case UIMSG_PlayerCreationClickPlus: //Plus button info - pStr = pGlobalTXT_LocalizationStrings[670];//Добавить - pWindow.Hint = pGlobalTXT_LocalizationStrings[671];//"Добавляет очко к выделенному навыку, забирая его из накопителя очков" - break; - case UIMSG_PlayerCreationClickMinus: //Minus button info - pStr = pGlobalTXT_LocalizationStrings[668];//Вычесть - pWindow.Hint = pGlobalTXT_LocalizationStrings[669];//"Вычитает очко из выделенного навыка, возвращая его в накопитель очков" - break; - case UIMSG_PlayerCreationSelectActiveSkill: //Available skill button info - v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pButton->msg_param + 4); - pStr = pSkillNames[v18]; - pWindow.Hint = pSkillDesc[v18]; - break; - case UIMSG_PlayerCreationSelectClass: //Available Class Info - pWindow.Hint = pClassDescriptions[pButton->msg_param]; - pStr = pClassNames[pButton->msg_param]; - break; - case UIMSG_PlayerCreationClickOK: //OK Info - pWindow.Hint = pGlobalTXT_LocalizationStrings[664];//Щелкните здесь для утверждения состава отряда и продолжения игры. - pStr = pGlobalTXT_LocalizationStrings[665];//Кнопка ОК - break; - case UIMSG_PlayerCreationClickReset: //Clear info - pWindow.Hint = pGlobalTXT_LocalizationStrings[666];//Сбрасывает все параметры и навыки отряда. - pStr = pGlobalTXT_LocalizationStrings[667];//Кнопка Очистить - break; - case UIMSG_PlayerCreation_SelectAttribute: // Character info - pStr = pParty->pPlayers[pButton->msg_param].pName; - pWindow.Hint = pClassDescriptions[pParty->pPlayers[pButton->msg_param].classType]; - break; - } - if ( pButton->msg > UIMSG_44 && pButton->msg <= UIMSG_PlayerCreationRemoveDownSkill ) //Sellected skills info - { - pSkillId = pParty->pPlayers[pButton->msg_param].GetSkillIdxByOrder(pButton->msg - UIMSG_48); - pY = 0; - if ( (signed int)pSkillId < 37 ) - { - pSkillInfo = CharacterUI_GetSkillDescText(pButton->msg_param, (PLAYER_SKILL_TYPE)pSkillId); - strcpy(pTmpBuf2.data(), pSkillInfo); - pWindow.Hint = pTmpBuf2.data(); - pStr = pSkillNames[pSkillId]; - } - } - } - } - if ( pWindow.Hint ) - { - pHint = (char*)pWindow.Hint; - pWindow.Hint = 0; - pWindow.uFrameWidth = 384; - pWindow.uFrameHeight = 256; - pWindow.uFrameX = 128; - pWindow.uFrameY = 40; - pWindow.uFrameHeight = pFontSmallnum->CalcTextHeight(pHint, &pWindow, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pWindow.DrawMessageBox(0); - pWindow.uFrameX += 12; - pWindow.uFrameWidth -= 24; - pWindow.uFrameY += 12; - pWindow.uFrameHeight -= 12; - pWindow.uFrameZ = pWindow.uFrameX + pWindow.uFrameWidth - 1; - pWindow.uFrameW = pWindow.uFrameY + pWindow.uFrameHeight - 1; - pColor = TargetColor(0xFF, 0xFF, 0x9B); - sprintf(pTmpBuf.data(), format_4E2D80, pColor, pStr);//"\f%05d%s\f00000\n" - pWindow.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); - pWindow.DrawText(pFontSmallnum, 1, pFontLucida->uFontHeight, 0, pHint, 0, 0, 0); - } - break; - } - default: - { - break; - } - } - dword_507BF0_is_there_popup_onscreen = 1; - viewparams->bRedrawGameUI = 1; - } \ No newline at end of file + else + { + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = potionID; + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2; + pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]); + } + int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка + if ( bottle ) + pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED; + if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) ) + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uAttributes |= 1; + if ( !dword_4E455C ) + { + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + pPlayers[uActiveCharacter]->PlaySound(SPEECH_DO_POTION_FINE, 0); + dword_4E455C = 0; + pMouse->RemoveHoldingItem(); + no_rightlick_in_inventory = 1; + return; + } + GameUI_DrawItemInfo(item); + return; + } + } + GameUI_DrawItemInfo(item); + return; +} diff -r 79621dd04649 -r 26c1a3d50635 UI/UISaveLoad.cpp --- a/UI/UISaveLoad.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/UI/UISaveLoad.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -21,125 +21,76 @@ //----- (004601B7) -------------------------------------------------------- static void UI_DrawSaveLoad(bool save) { - //unsigned __int16 v1; // bx@1 - unsigned int v2; // edi@4 - unsigned int v3; // eax@4 - unsigned int v4; // eax@8 - int v5; // edi@8 - unsigned int v6; // eax@8 - unsigned int pMapID; // eax@10 - signed __int64 v8; // qax@10 - unsigned int v9; // ebx@10 - unsigned __int64 v10; // qax@10 - __int64 v11; // qax@10 - char v12; // di@10 - unsigned __int64 v13; // qtt@10 - unsigned int v14; // ecx@10 - __int64 pOurHour; // qax@10 - int v16; // edi@10 - signed int pHour; // ebx@22 - int v19; // eax@32 - const char *v20; // ST18_4@32 - int v21; // eax@32 - int v23; // eax@32 const char *pSlotName; // edi@36 - int v25; // eax@43 - GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 - int pMinutes; // [sp+60h] [bp-24h]@10 - int pMonthNum; // [sp+68h] [bp-1Ch]@10 + GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 - __int64 pAMPM2; // [sp+74h] [bp-10h]@10 - int pYear; // [sp+7Ch] [bp-8h]@10 - int pFilesID; + unsigned __int64 full_hours; + unsigned __int64 full_days; + int full_weeks; + int full_month; + int current_year; + int current_month; + int current_day; + int current_hour; + int current_minutes; - //v1 = 255; - //TargetColor(0xFF, 0xFF, 0xFF); - //TargetColor(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); if (save) { - v2 = uTextureID_save_up; - v3 = uTextureID_LS_saveU; + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); } else { - v2 = uTextureID_load_up; - v3 = uTextureID_LS_loadU; + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); } - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); - pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); } if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { - memset(&pWindow, 0, 0x54); - pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; - v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight; - pWindow.uFrameWidth = 220; - v4 += 157; - pWindow.uFrameY = v4; - v5 = pFontSmallnum->uFontHeight; - pWindow.uFrameZ = pWindow.uFrameX + 219; - pWindow.uFrameHeight = v5; - pWindow.uFrameW = v5 + v4 - 1; - v6 = uLoadGameUI_SelectedSlot; - if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels) - { + memset(&save_load_window, 0, 0x54); + save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; + save_load_window.uFrameWidth = 220; + save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; + save_load_window.uFrameZ = save_load_window.uFrameX + 219; + save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; + save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; + if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels ) pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); - v6 = uLoadGameUI_SelectedSlot; - } - pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); - pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3); - v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60; - pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32); - v9 = v8; - v8 /= 60i64; - pAMPM2 = v8; - v10 = (unsigned int)v8 / 24; - pSaveFiles = v10; - v11 = (unsigned int)(v10 / 7); - v12 = v11; - LODWORD(v13) = (unsigned int)v11 >> 2; - HIDWORD(v13) = HIDWORD(v11); - pMonthNum = v13 % 12; - pYear = v13 / 12; - pMinutes = (int)__PAIR__(pMinutes, v9) % 60; - pOurHour = pAMPM2 % 24; - v14 = (unsigned __int64)(pAMPM2 % 24) >> 32; - LODWORD(pAMPM2) = pAMPM2 % 24; - HIDWORD(pOurHour) = pSaveFiles % 28; - pYear += game_starting_year; - v16 = v12 & 3; - pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; - HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12) - && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24); - if ( v14 != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 ) +//Draw map name + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); +//Draw date + full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; + full_days = (unsigned int)full_hours / 24; + full_weeks = (unsigned int)(full_days / 7); + full_month = (unsigned int)full_weeks / 4; + current_year = (full_month / 12) + game_starting_year; + current_month = full_month % 12; + current_day = full_days % 28; + current_hour = full_hours % 24; + current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); + + save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; + int am; + if ( (signed int)current_hour >= 12 ) { - if ( !(v14 | (unsigned int)pOurHour) ) - { - pSaveFiles = 0; - pHour = 12; - goto LABEL_23; - } + current_hour -= 12; + if ( !current_hour ) + current_hour = 12; + am = 1; } else - { - v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32; - LODWORD(pOurHour) = pOurHour - 12; - } - pHour = pOurHour; - pSaveFiles = v14; -LABEL_23: - auto day = aDayNames[HIDWORD(pOurHour) % 7]; - auto ampm = aAMPMNames[HIDWORD(pAMPM2)]; - auto month = aMonthNames[pMonthNum]; - //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); - sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); - pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); - //v1 = 255; + am = 0; + auto day = aDayNames[full_days % 7]; + auto ampm = aAMPMNames[am]; + auto month = aMonthNames[current_month]; + + sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); } if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { @@ -154,15 +105,12 @@ } if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { - //v18 = pGlobalTXT_LocalizationStrings[135]; - v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка" - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0); - v20 = (const char *)(&pSavegameHeader[uLoadGameUI_SelectedSlot]); - v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0); - //v22 = pGlobalTXT_LocalizationStrings[165]; - v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите" - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, + 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, + (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, + 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" } else { @@ -170,29 +118,19 @@ pSaveFiles = 40; else pSaveFiles = uNumSavegameFiles; - int a4 = 199; - pFilesID = pSaveListPosition; - pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot - do + + int slot_Y = 199; + for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) { - if ( pFilesID >= (signed int)pSaveFiles ) + if ( slot_Y >= 346 ) break; - short clr; - HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0); - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) - { - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); - } + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); else - { - v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1); - pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum); - } - a4 += 21; - ++pFilesID; - pSlotName += 100; + pGUIWindow_CurrentMenu->DrawFlashingInputCursor(pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1) + 27, + slot_Y, pFontSmallnum); + slot_Y += 21; } - while ( a4 < 346 ); } pRenderer->EndScene(); } diff -r 79621dd04649 -r 26c1a3d50635 UI/UIShops.cpp --- a/UI/UIShops.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/UI/UIShops.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -1352,8 +1352,8 @@ dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } - v66 = pMouse->GetCursorPos(&v98); - pNumActiveItem = v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]; + pMouse->GetCursorPos(&v98); + pNumActiveItem = v98.x + pSRZBufferLineOffsets[v98.y]; if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) { v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; diff -r 79621dd04649 -r 26c1a3d50635 UI/UiGame.cpp --- a/UI/UiGame.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/UI/UiGame.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -687,16 +687,16 @@ const char *v14; // eax@8 char *result; // eax@12 unsigned int pMapID; // eax@14 - int v19; // [sp+10h] [bp-1Ch]@1 - int v20; // [sp+14h] [bp-18h]@1 + int global_coord_X; // [sp+10h] [bp-1Ch]@1 + int global_coord_Y; // [sp+14h] [bp-18h]@1 unsigned int pY; // [sp+1Ch] [bp-10h]@1 unsigned int pX; // [sp+28h] [bp-4h]@1 result = 0; pMouse->GetClickPos(&pX, &pY); v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789); - v19 = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); - v20 = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); + global_coord_X = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); + global_coord_Y = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 ) { pMapID = pMapStats->GetMapInfo(pCurrentMapName); @@ -709,8 +709,8 @@ { for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j ) { - v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - v19), - abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - v20), 0); + v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - global_coord_X), + abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - global_coord_Y), 0); if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius ) { if ( pOutdoor->pBModels[j].uNumFaces ) diff -r 79621dd04649 -r 26c1a3d50635 Viewport.cpp --- a/Viewport.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/Viewport.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -128,9 +128,9 @@ //----- (00443249) -------------------------------------------------------- void ViewingParams::CenterOnParty() { - this->field_2C = (32768 * (__int64)this->field_2C) >> 16; - if (this->field_2C < 384) - this->field_2C = 384; + this->uMapBookMapZoom = (32768 * (__int64)this->uMapBookMapZoom) >> 16; + if (this->uMapBookMapZoom < 384) + this->uMapBookMapZoom = 384; this->sViewCenterX = pParty->vPosition.x; this->sViewCenterY = pParty->vPosition.y; @@ -149,9 +149,9 @@ v2 = 3072; else assert(false); - this->field_2C *= 2; - if (this->field_2C > v2 ) - this->field_2C = v2; + this->uMapBookMapZoom *= 2; + if (this->uMapBookMapZoom > v2 ) + this->uMapBookMapZoom = v2; this->sViewCenterX = pParty->vPosition.x; this->sViewCenterY = pParty->vPosition.y; @@ -172,7 +172,7 @@ v1 = this; v2 = this->indoor_center_y; - v3 = 88 >> (this->field_2C / 384); + v3 = 88 >> (this->uMapBookMapZoom / 384); v4 = (44 - v3) << 9; if ( v1->sViewCenterY > v2 + v4 ) v1->sViewCenterY = v2 + v4; @@ -253,7 +253,7 @@ uMinimapZoom = _576E2C_current_minimap_zoom; field_28 = dword_576E28; } - field_2C = 384; + uMapBookMapZoom = 384; } //----- (0042213C) -------------------------------------------------------- void OnGameViewportClick() diff -r 79621dd04649 -r 26c1a3d50635 Viewport.h --- a/Viewport.h Thu Sep 26 23:42:06 2013 +0600 +++ b/Viewport.h Thu Sep 26 23:42:25 2013 +0600 @@ -65,7 +65,7 @@ int field_20; unsigned int uMinimapZoom; int field_28; - int field_2C; + unsigned int uMapBookMapZoom; int sViewCenterX; int sViewCenterY; __int16 indoor_center_x; diff -r 79621dd04649 -r 26c1a3d50635 mm7_3.cpp --- a/mm7_3.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/mm7_3.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -6772,90 +6772,6 @@ LoadLevel_InitializeLevelStr(); } -//----- (00444564) -------------------------------------------------------- -const char * sub_444564() -{ - double v0; // st7@3 - int v1; // ebx@3 - int v2; // edi@3 - int v3; // eax@3 - int v5; // edi@6 - int v6; // eax@6 - int v7; // eax@6 - unsigned __int8 v9; // zf@7 - unsigned __int8 v10; // sf@7 - ODMFace *v11; // eax@9 - __int16 v12; // cx@9 - const char *v13; // eax@11 - const char *v14; // edi@11 - const char *result; // eax@15 - unsigned int v16; // [sp+0h] [bp-20h]@3 - const char *v17; // [sp+4h] [bp-1Ch]@3 - unsigned int pY; // [sp+8h] [bp-18h]@3 - float v19; // [sp+Ch] [bp-14h]@1 - int v20; - int v21; // [sp+14h] [bp-Ch]@1 - unsigned int v22; // [sp+18h] [bp-8h]@8 - int pX; // [sp+1Ch] [bp-4h]@3 - - v20 = viewparams->sViewCenterX; - v21 = viewparams->sViewCenterY; - v19 = (double)viewparams->field_2C * 0.000015258789; - if ( viewparams->field_2C == 384 ) - { - v20 = viewparams->indoor_center_x; - v21 = viewparams->indoor_center_y; - } - v17 = 0; - v16 = pOutdoor->uNumBModels; - pMouse->GetClickPos((unsigned int *)&pX, &pY); - v0 = 1.0 / v19; - v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20); - LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0); - v2 = abs(v1 + 22528) / 512; - v3 = abs((signed)LODWORD(v19) - 22528); - result = 0; - if ( pOutdoor->_47F04C(v2, v3 / 512) - && uCurrentlyLoadedLevelType == LEVEL_Outdoor - && (signed int)v16 > 0 ) - { - for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++) - { - pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1; - pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19); - v5 = abs((signed)pY); - v6 = abs((signed)pX); - v7 = int_get_vector_length(v6, v5, 0); - if ( v7 < pOutdoor->pBModels[i].sBoundingRadius ) - { - if ( pOutdoor->pBModels[i].uNumFaces > 0 ) - { - for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++) - { - v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134]; - v12 = v11->sCogTriggeredID; - if ( v12 ) - { - if ( !(v11->uAttributes & 0x100000) ) - { - v13 = GetEventHintString(v12); - v14 = v13; - if ( v13 ) - { - if ( _stricmp(v13, "") ) - v17 = v14; - } - } - } - } - } - result = v17; - } - } - } - return result; -} - //----- (00444D80) -------------------------------------------------------- int GetTravelTime() { diff -r 79621dd04649 -r 26c1a3d50635 mm7_5.cpp --- a/mm7_5.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/mm7_5.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -4904,478 +4904,6 @@ DrawCopyrightWindow(); } - -int no_rightlick_in_inventory = false; // 0050CDCC -//----- (00416196) -------------------------------------------------------- -void OnInventoryItemRightClick() -{ - //Player *v0; // esi@2 - //POINT *v1; // edi@2 - //signed int v2; // ecx@5 - //signed int v3; // eax@5 - //int v4; // eax@5 - //char v5; // sf@5 - //int v6; // eax@5 - int v7; // eax@7 - //unsigned __int16 v8; // ax@10 - int v9; // edi@10 - //int v10; // eax@10 - //int v11; // edx@13 - //LONG v12; // edx@23 - //signed int v13; // edx@23 - int v14; // edx@25 - unsigned int v15; // edi@25 - signed int v16; // edx@27 - int v17; // eax@54 - unsigned int v18; // edx@57 - int v19; // eax@65 - int v20; // edi@67 - int v21; // eax@72 - int v22; // ecx@74 - int v23; // edx@78 - int v24; // eax@79 - int v25; // eax@80 - int v26; // eax@84 - ItemGen *v27; // esi@98 - //unsigned int v28; // eax@98 - //ItemGen *v29; // edi@98 - //unsigned int v30; // ecx@103 - double v31; // st7@112 - //unsigned __int64 v32; // qax@113 - //unsigned int v33; // ecx@117 - //int v34; // eax@126 - //unsigned int v35; // ecx@127 - double v36; // st7@132 - signed __int64 v37; // qax@135 - //unsigned int v38; // eax@138 - Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 - //int *v40; // [sp-Ch] [bp-9Ch]@83 - //int *v41; // [sp-8h] [bp-98h]@83 - //int *v42; // [sp-4h] [bp-94h]@83 - GUIWindow v43; // [sp+Ch] [bp-84h]@137 - //unsigned int pY; // [sp+60h] [bp-30h]@2 - int v45; // [sp+64h] [bp-2Ch]@10 - //unsigned int pX; // [sp+68h] [bp-28h]@2 - //int v47; // [sp+6Ch] [bp-24h]@25 - //POINT y; // [sp+70h] [bp-20h]@2 - POINT a2; // [sp+78h] [bp-18h]@2 - //Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 - unsigned int v51; // [sp+8Ch] [bp-4h]@23 - - if (no_rightlick_in_inventory) - return; - - pMouse->GetCursorPos(&a2); - if (a2.x <= 13 || a2.x >= 462) - return; - - auto player = pPlayers[uActiveCharacter]; - - int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; - //pMouse->GetClickPos(&pX, &pY); - if (!item_pid) - { - int inventory_mouse_x = a2.x - 14; - int inventory_mouse_y = a2.y - 17; - - int mouse_cell_x = inventory_mouse_x / 32; - int mouse_cell_y = inventory_mouse_y / 32; - - if (mouse_cell_x + mouse_cell_y < 0) - return; - - int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; - if (inventory_idx > 126) - return; - - v7 = player->GetItemIDAtInventoryIndex(&inventory_idx); - if (v7 == 0) - return; - - item_pid = v7; - } - - if (!player->CanAct()) - { - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], player->pName, pGlobalTXT_LocalizationStrings[541]); - v43.Hint = pTmpBuf.data(); - v43.uFrameWidth = 384; - v43.uFrameHeight = 180; - if (a2.x <= 320 ) - v43.uFrameX = a2.x + 30; - else - v43.uFrameX = a2.x - 414; - v43.uFrameY = 40; - v43.DrawMessageBox(0); - return; - } - - --item_pid; - int alchemy_level = (int8_t)player->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); - v9 = alchemy_level & 0x3F; - //v45 = alchemy_level & 0x3F; - int alchemy_skill = SkillToMastery(alchemy_level); - - auto item = &player->pInventoryItemList[item_pid]; - if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) - { -__show_item_desc: - GameUI_DrawItemInfo(item); - return; - } - - if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle - item->uItemID < ITEM_POTION_CATALYST && // cant recharge - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } - - v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; - if ( v36 < 0.0 ) - v36 = 0.0; - v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); - item->uMaxCharges = v37; - item->uNumCharges = v37; - - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - goto __show_item_desc; - } - - else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle - item->uItemID < ITEM_POTION_CATALYST && // cant harden - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->IsBroken() || // cant harden broken items - item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts - item->GetItemEquipType() < EQUIP_OFF_HAND || - item->GetItemEquipType() > EQUIP_WAND) - goto __invalid_item; - - item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - goto __show_item_desc; - } - - else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && - pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || - pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle - item->uItemID < ITEM_POTION_CATALYST && // cant enchant - item->uItemID > ITEM_POTION_REJUVENATION) // all potions - { - if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || - item->uItemID >= ITEM_ARTIFACT_PUCK || - item->IsBroken() || - item->uSpecEnchantmentType || - item->uEnchantmentType || - item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows - goto __invalid_item; - - item->UpdateTempBonus(pParty->uTimePlayed); - if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) - { - item->uSpecEnchantmentType = 40; // of Slaying - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - else - { - static int _4E2904_enchantment_by_potion_lut[] = - { - 164, 93, 22, - 164, 93, 22, - 11, 5, 13, 7, 59 - }; - item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; - v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); - } - - v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; - v27->uAttributes = alchemy_skill | 0x18; - - _50C9A8_item_enchantment_timer = 256; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; - } - goto __show_item_desc; - } - - - - if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || - pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || - player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) - { - if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || - pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || - player->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || - player->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) - { - if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && - (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && - pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && - pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) - goto __show_item_desc; - } - - // src not reagent, dst not bottle - // src potion, dst potion - - v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; - v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; - - if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || - item->uItemID == ITEM_POTION_CATALYST ) - { - v16 = 5; - } - else - { - v16 = pItemsTable->potion_data[v15][v14 + 2]; - } - v51 = v16; - if ( v9 ) - { - if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN ) - { - if ( v16 < ITEM_POTION_HASTE || v16 > ITEM_POTION_CURE_INSANITY ) - { - if ( v16 < ITEM_POTION_MIGHT_BOOST || v16 > ITEM_POTION_BODY_RESISTANE ) - { - if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_level != 4 ) - { -LABEL_53: - v51 = 4; - goto LABEL_54; - } - } - else - { - if ( alchemy_level <= 2 ) - { -LABEL_38: - v51 = 3; - goto LABEL_54; - } - } - } - else - { - if ( alchemy_level == 1 ) - { -LABEL_35: - v51 = 2; - goto LABEL_54; - } - } - } - } - else - { - if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN ) - { - v51 = 1; - goto LABEL_54; - } - if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY ) - goto LABEL_35; - if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE ) - goto LABEL_38; - if ( v16 >= ITEM_POTION_STONE_TO_FLESH ) - goto LABEL_53; - } -LABEL_54: - int pOut_y = 0; - int pOut_x = item_pid + 1; - v17 = (int)player->pInventoryMatrix; - while ( *(int *)v17 != pOut_x ) - { - ++pOut_y; - v17 += 4; - if ( pOut_y >= 126 ) - { - v18 = pOut_y; - goto LABEL_59; - } - } - v18 = pOut_y; -LABEL_59: - if ( !v51 ) - goto __show_item_desc;; - if ( v51 == 1 ) - { - player->RemoveItemAtInventoryIndex(v18); - v26 = rand(); - player->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - else - { - if ( v51 == 2 ) - { - player->RemoveItemAtInventoryIndex(v18); - v25 = rand(); - player->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); - v23 = 1; - } - else - { - if ( v51 == 3 ) - { - player->RemoveItemAtInventoryIndex(v18); - v24 = rand(); - player->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); - v23 = 5; - } - else - { - if ( v51 != 4 ) - { - if ( v51 != 5 ) - { - v19 = player->AddItem(-1, 0xDCu); - if ( v19 ) - // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; - player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; - v20 = v14 + 50 * v15; - player->pInventoryItemList[item_pid].uItemID = v51; - player->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + player->pInventoryItemList[item_pid].uEnchantmentType) - / 2; - player->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 -LABEL_74: - v22 = (int)((char *)player + 36 * item_pid); - if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) - *(int *)(v22 + 552) |= 1u; - if ( !dword_4E455C ) - { - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - player->PlaySound(SPEECH_16, 0); - dword_4E455C = 0; - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - if ( v9 ) - { - if ( *(int *)(player + 36 * item_pid + 532) == 221 ) - *(int *)(player + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; - else - *(int *)(player + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; - v21 = player->AddItem(-1, 0xDCu); - if ( v21 ) - //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; - player->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; - goto LABEL_74; - } - goto __show_item_desc; - } - player->RemoveItemAtInventoryIndex(v18); - player->SetCondition(0x10u, 0); - v23 = 0; - } - } - player->ItemsEnchant(v23); - pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); - - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - - v39.z = pParty->vPosition.z + pParty->sEyelevel; - } - v39.x = pParty->vPosition.x; - v39.y = pParty->vPosition.y; - - int rot_x, rot_y, rot_z; - Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); - sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); - if ( dword_4E455C ) - { - if ( player->CanAct() ) - player->PlaySound(SPEECH_17, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); - dword_4E455C = 0; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - return; - } - - // end alchemy - - player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice(); - switch ( pParty->pPickedItem.uItemID ) - { - case 0xC8u: - case 0xC9u: - case 0xCAu: - case 0xCBu: - case 0xCCu: - player->pInventoryItemList[item_pid].uItemID = 222; - break; - case 0xCDu: - case 0xCEu: - case 0xCFu: - case 0xD0u: - case 0xD1u: - player->pInventoryItemList[item_pid].uItemID = 223; - break; - case 0xD2u: - case 0xD3u: - case 0xD4u: - case 0xD5u: - case 0xD6u: - player->pInventoryItemList[item_pid].uItemID = 224; - break; - case 0xD7u: - case 0xD8u: - case 0xD9u: - case 0xDAu: - case 0xDBu: - player->pInventoryItemList[item_pid].uItemID = 221; - break; - default: - break; - } - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = 1; - if ( dword_4E455C ) - { - player->PlaySound(SPEECH_16, 0); - dword_4E455C = 0; - } - return; - - -__invalid_item: - pMouse->RemoveHoldingItem(); - no_rightlick_in_inventory = true; - return; -} - //----- (00417AD4) -------------------------------------------------------- unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) { diff -r 79621dd04649 -r 26c1a3d50635 mm7_6.cpp --- a/mm7_6.cpp Thu Sep 26 23:42:06 2013 +0600 +++ b/mm7_6.cpp Thu Sep 26 23:42:25 2013 +0600 @@ -1545,7 +1545,7 @@ { if ( pItemsTable->uAllItemsCount ) { - for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i ) + for ( uint i = 1; i < pItemsTable->uAllItemsCount; ++i ) { if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) pSpellObject.stru_24.uItemID = i; diff -r 79621dd04649 -r 26c1a3d50635 mm7_data.h --- a/mm7_data.h Thu Sep 26 23:42:06 2013 +0600 +++ b/mm7_data.h Thu Sep 26 23:42:25 2013 +0600 @@ -1073,7 +1073,7 @@ void SetAttributeNames(); void uGameUIFontMain_initialize(); void uGameUIFontShadow_initialize(); -void OnInventoryItemRightClick(); +void Inventory_ItemPopupAndAlchemy(); void sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this); void UI_OnMouseLeftClick(int *pXY); // idb unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos); @@ -1150,7 +1150,7 @@ void OnMapLeave(); void OnMapLoad(); void Level_LoadEvtAndStr(const char *pLevelName); -const char *sub_444564(); +const char *GetMapBookHintText();//sub_444564 char *GetEventHintString(unsigned int uEventID); // idb int GetTravelTime(); void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4);