Mercurial > mm7
changeset 2184:e0863f5beee0
SPELL_WATER_RECHARGE_ITEM
author | Ritor1 |
---|---|
date | Fri, 24 Jan 2014 18:01:51 +0600 |
parents | 172cfb4ee150 |
children | 385040580292 |
files | AudioPlayer.cpp AudioPlayer.h CastSpellInfo.cpp Game.cpp SaveLoad.cpp UI/UICharacter.cpp mm7_3.cpp mm7_4.cpp |
diffstat | 8 files changed, 302 insertions(+), 322 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/AudioPlayer.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -35,7 +35,7 @@ std::array<stru339_spell_sound, 4> stru_A750F8; -std::array<stru339_spell_sound, 4> stru_AA1058; +std::array<stru339_spell_sound, 4> AA1058_PartyQuickSpellSound;
--- a/AudioPlayer.h Thu Jan 23 23:35:10 2014 +0600 +++ b/AudioPlayer.h Fri Jan 24 18:01:51 2014 +0600 @@ -344,7 +344,7 @@ #pragma pack(push, 1) struct stru339_spell_sound { - int _494836(int uSoundID, int a6); + int AddPartySpellSound(int uSoundID, int a6); char pSounds[44744]; int field_AEC8[45]; @@ -355,4 +355,4 @@ }; #pragma pack(pop) extern std::array<stru339_spell_sound, 4> stru_A750F8; -extern std::array<stru339_spell_sound, 4> stru_AA1058; +extern std::array<stru339_spell_sound, 4> AA1058_PartyQuickSpellSound;
--- a/CastSpellInfo.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/CastSpellInfo.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -285,6 +285,7 @@ signed int a2; // [sp+E7Ch] [bp-8h]@14 int amount; // [sp+E80h] [bp-4h]@1 int obj_type; + ItemDesc* _item; SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 @@ -560,7 +561,7 @@ LODWORD(v727) = 1; break; } - case SPELL_AIR_IMPLOSION://Точечный взрыв + case SPELL_AIR_IMPLOSION://Точный взрыв { mon_id = PID_ID(a2); if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -716,7 +717,7 @@ case SPELL_WATER_ACID_BURST://Всплеск кислоты case SPELL_EARTH_BLADES://Лезвия case SPELL_BODY_FLYING_FIST://Летающий кулак - case SPELL_DARK_TOXIC_CLOUD://Токсичное облако + case SPELL_DARK_TOXIC_CLOUD://Облако-токсин { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -888,7 +889,7 @@ LODWORD(v727) = 1; break; } - case SPELL_FIRE_FIRE_AURA: //Наколить + case SPELL_FIRE_FIRE_AURA: //Аура огня { switch (skill_level) { @@ -902,7 +903,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; - ItemDesc* _item = &pItemsTable->pItems[v730c->uItemID]; + _item = &pItemsTable->pItems[v730c->uItemID]; v730c->UpdateTempBonus(pParty->uTimePlayed); if ( v730c->uItemID < 64 || v730c->uItemID > 65 && !v730c->IsBroken() @@ -1183,7 +1184,7 @@ LODWORD(v727) = 1; break; } - case SPELL_FIRE_METEOR_SHOWER://Поток метеоритов + case SPELL_FIRE_METEOR_SHOWER://Поток метеоров { //if (skill_level < 3)//для мастера и магистра //break; @@ -1260,7 +1261,7 @@ LODWORD(v727) = 1; break; } - case SPELL_FIRE_INFERNO://Жар печи + case SPELL_FIRE_INFERNO://Адский огонь { if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { @@ -1300,7 +1301,7 @@ LODWORD(v727) = 1; break; } - case SPELL_AIR_WIZARD_EYE://Глаз колдуна + case SPELL_AIR_WIZARD_EYE://Око чародея { duration = 3600 * spell_level; if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -1311,7 +1312,7 @@ LODWORD(v727) = 1; break; } - case SPELL_AIR_FEATHER_FALL://Падение пёрышком + case SPELL_AIR_FEATHER_FALL://Падение пера(пёрышком) { switch (skill_level) { @@ -1496,7 +1497,7 @@ } else { - HIDWORD(v685) = stru_5C6E00->Atan2((signed __int64)sqrt(j * j + k * k), ((double)a2 + (double)dist_Z - (double)(dist_Z + 2500))); + HIDWORD(v685) = stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)), ((double)a2 + (double)dist_Z - (double)(dist_Z + 2500))); LODWORD(v685) = stru_5C6E00->Atan2(j, k); } pSpellSprite.stru_24.Reset(); @@ -1637,282 +1638,271 @@ LODWORD(v727) = 1; break; } - case SPELL_WATER_WATER_WALK: + case SPELL_WATER_WATER_WALK://Хождение по воде + { + if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + break; + } + switch (skill_level) + { + case 1: //break; + case 2: duration = 600 * spell_level; break; + case 3: + case 4: duration = 3600 * spell_level; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + v169 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); + pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(duration << 7) * 0.033333335), + skill_level, amount, v169, pCastSpell->uPlayerID + 1); + if ( skill_level == 4 ) + pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; + LODWORD(v727) = 1; + break; + } + case SPELL_WATER_RECHARGE_ITEM://Перезарядка { - if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - break; - } - if ( skill_level == 2 || skill_level != 3 && skill_level != 4 ) - v229 = 600 * spell_level; - else - v229 = 3600 * spell_level; - LODWORD(v733) = v229; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v169 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); - - pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), - skill_level, amount, v169, pCastSpell->uPlayerID + 1); - if ( skill_level == 4 ) - pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; - LODWORD(v727) = 1; - break; - } - case SPELL_WATER_RECHARGE_ITEM: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; - - if ( v240->GetItemEquipType() != 12 || v240->uAttributes & 2 ) - { - _50C9D0_AfterEnchClickEventId = 113; - _50C9D4_AfterEnchClickEventSecondParam = 0; - _50C9D8_AfterEnchClickEventTimeout = 1; - - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - if ( skill_level == 1 || skill_level == 2 ) - v241 = (double)v723 * 0.0099999998 + 0.5; - else if ( skill_level == 3 ) - v241 = (double)v723 * 0.0099999998 + 0.69999999; - else if ( skill_level == 4 ) - v241 = (double)v723 * 0.0099999998 + 0.80000001; - else - v241 = 0.0; - if ( v241 > 1.0 ) - v241 = 1.0; - int uNewCharges = v240->uMaxCharges * v241; - v240->uMaxCharges = uNewCharges; - v240->uNumCharges = uNewCharges; - if ( uNewCharges <= 0 ) - { - v240 = 0; - _50C9D0_AfterEnchClickEventId = 113; - _50C9D4_AfterEnchClickEventSecondParam = 0; - _50C9D8_AfterEnchClickEventTimeout = 1; - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - spell_level = v723; - continue; - } - v240->uAttributes |= 0x40u; - _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; - break; - } - case SPELL_WATER_ENCHANT_ITEM: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; + if ( v730c->GetItemEquipType() != 12 || v730c->uAttributes & 2 ) + { + _50C9D0_AfterEnchClickEventId = 113; + _50C9D4_AfterEnchClickEventSecondParam = 0; + _50C9D8_AfterEnchClickEventTimeout = 1; + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + if ( skill_level == 1 || skill_level == 2 ) + v241 = (double)v723 * 0.0099999998 + 0.5;//50 % + else if ( skill_level == 3 ) + v241 = (double)v723 * 0.0099999998 + 0.69999999;//30 % + else if ( skill_level == 4 ) + v241 = (double)v723 * 0.0099999998 + 0.80000001;//20 % + else + v241 = 0.0; + if ( v241 > 1.0 ) + v241 = 1.0; + int uNewCharges = v730c->uMaxCharges * v241; + v730c->uMaxCharges = uNewCharges; + v730c->uNumCharges = uNewCharges; + if ( uNewCharges <= 0 ) + { + v730c = 0; + _50C9D0_AfterEnchClickEventId = 113; + _50C9D4_AfterEnchClickEventSecondParam = 0; + _50C9D8_AfterEnchClickEventTimeout = 1; + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2);//Не получилось!!! + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + spell_level = v723; + continue; + } + v730c->uAttributes |= 0x40u; + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; break; - uRequiredMana = 0; - amount = 10 * spell_level; - v730 = 1; - pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - v245 = &pPlayer->pInventoryItemList[a2]; - ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; - if ( - skill_level == 1 || skill_level == 2 && _v725->uEquipType > 2 || - skill_level == 3 || skill_level == 4 && - v245->uItemID <= 134 && - v245->uSpecEnchantmentType == 0 && - v245->uEnchantmentType == 0 && - v245->m_enchantmentStrength== 0 && - !v245->IsBroken() ) - { - if ( v245->GetValue() < 450 || - (v245->GetValue() < 250 && (skill_level == 3 || skill_level == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2) - ) - { - v730 = 0; - } - - __debugbreak(); // castspellinfo.cpp(1962): warning C4700: uninitialized local variable 'v271' used - if ( rand() % 100 < 10 * spell_level || - (rand() % 100 < 80 && (skill_level == 3 || skill_level == 4 )) || - v245->GetValue() < 450 || - (v245->GetValue() < 250 && (skill_level == 3 || skill_level == 4) && v271 >= 0 && v271 <= 2) - ) - { - v313 = _v725->uEquipType; - if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 ) - { - v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; - v245->uEnchantmentType = 0; - __debugbreak(); // castspellinfo.cpp(1971): warning C4700: uninitialized local variable 'v294' used - for ( kk = pItemsTable->pEnchantments[0].to_item[v245->GetItemEquipType() + 1]; - ; - kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[v245->GetItemEquipType() + 1] ) - { - ++v245->uEnchantmentType; - if ( kk >= v295 ) - break; - } - v255 = 10;//pItemsTable->field_116D8[17]; - v256 = 10;//pItemsTable->field_116D8[16]; - v245->m_enchantmentStrength = v256 + rand() % (v255 - v256 + 1); - v245->uAttributes |= 0x20u; - _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; - break; - } - else if ( skill_level == 3 || skill_level == 4) - { - v257 = pItemsTable->pSpecialEnchantments_count; - v258 = 0; - v725 = 0.0; - int _v733 = 0; - if ( pItemsTable->pSpecialEnchantments_count > 0 ) - { - v730 = (int)&v679; - do - { - v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); - if ( !v259 || v259 == 1 ) - { - v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() - + 4] - + v258 * 28); - LODWORD(v725) += v260; - if ( v260 ) - { - v261 = v730; - v730 += 4; - *(int *)v261 = _v733; - } - } - ++_v733; - ++v258; - } - while ( _v733 < v257 ); - } - v262 = rand() % SLODWORD(v725); - v263 = v679; - v245->uSpecEnchantmentType = v679[0]; - v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4]; - v265 = v262 + 1; - if ( v264 < v265 ) - { - for ( ii = v679; ; ii = (int *)v732 ) - { - v267 = (int)(ii + 1); - v732 = v267; - v268 = *(int *)v267; - *(int *)(v245 + 12) = v268; - v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[v245->GetItemEquipType() - + 4]; - if ( v264 >= v265 ) - break; - } - } - - v277 = pItemsTable->pSpecialEnchantments_count; - v278 = 0; - v725 = 0.0; - _v733 = 0; - if ( pItemsTable->pSpecialEnchantments_count > 0 ) - { - int *_v730 = v679; - do - { - v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); - if ( !v279 || v279 == 1 ) - { - v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[v245->GetItemEquipType()]); - _v733 += v280; - if ( v280 ) - { - v281 = _v730; - ++_v730; - *v281 = _v733; - } - } - ++_v733; - ++v278; - } - while ( _v733 < v277 ); - } - v282 = rand() % _v733; - v283 = v679; - v245->uSpecEnchantmentType = v679[0]; - v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[v245->GetItemEquipType() ]; - v285 = v282 + 1; - for ( l = v679; v284 < v285; ++l ) - { - v245->uSpecEnchantmentType = *(l+1); - v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[v245->GetItemEquipType()]; - } - ++v245->uSpecEnchantmentType; - v245->uAttributes |= 0x20u; - _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; - break; - } - } - else - { - if ( !(BYTE1(v245->uAttributes) & 2) ) - { - v245->uAttributes |= 2; - } - } - - } - - if ( LODWORD(v727) == 0 ) - { - v317 = pGlobalTXT_LocalizationStrings[428]; - if ( v730 == 0 ) - v317 = pGlobalTXT_LocalizationStrings[585]; - ShowStatusBarString(v317, 2u); - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - pCastSpell->uSpellID = 0; - v318->PlaySound(SPEECH_43, 0); - } - - break; - } - case SPELL_WATER_TOWN_PORTAL: - { - amount = 10 * spell_level; - if ( pPlayer->sMana < (signed int)uRequiredMana ) - break; - if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && skill_level != 4 || rand() % 100 >= amount && skill_level != 4 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); - pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); - LODWORD(v727) = 1; - break; - } - case SPELL_WATER_LLOYDS_BEACON: - { - LODWORD(v733) = 604800 * spell_level; - if ( !_stricmp(pCurrentMapName, "d05.blv") ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - v319 = uRequiredMana; - if ( pPlayer->sMana >= (signed int)uRequiredMana ) + } + case SPELL_WATER_ENCHANT_ITEM://Талисман + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + uRequiredMana = 0; + amount = 10 * spell_level; + bool item_not_broken = true; + int rnd = rand() % 100; + pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + v245 = &pPlayer->pInventoryItemList[a2]; + ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; + if ((skill_level == 1 || skill_level == 2 /*&& _v725->uEquipType > EQUIP_BOW*/ || skill_level == 3 || skill_level == 4) && + v245->uItemID <= 134 && + v245->uSpecEnchantmentType == 0 && v245->uEnchantmentType == 0 && + v245->m_enchantmentStrength== 0 && !v245->IsBroken() ) + { + if ( (v245->GetValue() < 450 && ( skill_level == 1 || skill_level == 2 )) + || (v245->GetValue() < 450 && (skill_level == 3|| skill_level == 4 ) && _v725->uEquipType >= EQUIP_SINGLE_HANDED && _v725->uEquipType <= EQUIP_BOW) + || (v245->GetValue() < 250 && (skill_level == 3 || skill_level == 4 )&& _v725->uEquipType > EQUIP_BOW) )//Условия поломки + { + if ( !(v245->uAttributes & 0x200) )// предмет не сломан + { + v245->uAttributes |= 2;//теперь сломан + } + item_not_broken = false; + } + else + { + if ( rnd >= 10 * spell_level )//шанс на срабатывание + { + if ( !(v245->uAttributes & 0x200) )// предмет не сломан + v245->uAttributes |= 2;//теперь сломан + } + else + { + if ( (rnd < 80 && (skill_level == 3 || skill_level == 4 )) || v245->GetValue() < 450 || (v245->GetValue() < 250//Ritor1:здесь я остановился + && (skill_level == 3 || skill_level == 4) && _v725->uEquipType >= EQUIP_SINGLE_HANDED && _v725->uEquipType <= EQUIP_BOW)) + { + v313 = _v725->uEquipType; + if ( _v725->uEquipType >= EQUIP_ARMOUR && _v725->uEquipType <= EQUIP_AMULET ) + { + v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; + /*v245->uEnchantmentType = 0; + __debugbreak(); // castspellinfo.cpp(1971): warning C4700: uninitialized local variable 'v294' used + for ( kk = pItemsTable->pEnchantments[0].to_item[v245->GetItemEquipType() + 1]; + ; + kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[v245->GetItemEquipType() + 1] ) + { + ++v245->uEnchantmentType; + if ( kk >= v295 ) + break; + } + v255 = 10;//pItemsTable->field_116D8[17]; + v256 = 10;//pItemsTable->field_116D8[16]; + v245->m_enchantmentStrength = v256 + rand() % (v255 - v256 + 1);*/ + v245->uEnchantmentType = v295; + v245->m_enchantmentStrength = pItemsTable->pEnchantments[v295].to_item[_v725->uEquipType - EQUIP_ARMOUR]; + v245->uAttributes |= 0x20u; + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; + break; + } + else if ( skill_level == 3 || skill_level == 4) + { + v258 = 0; + v725 = 0.0; + int _v733; + if ( pItemsTable->pSpecialEnchantments_count > 0 ) + { + v730 = (int)&v679; + for ( _v733 = 0; _v733 < pItemsTable->pSpecialEnchantments_count; ++_v733 ) + { + v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); + if ( !v259 || v259 == 1 ) + { + v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() + 4] + v258 * 28); + LODWORD(v725) += v260; + if ( v260 ) + { + v261 = v730; + v730 += 4; + *(int *)v261 = _v733; + } + } + ++v258; + } + } + v262 = rand() % SLODWORD(v725); + v263 = v679; + v245->uSpecEnchantmentType = v679[0]; + v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4]; + v265 = v262 + 1; + if ( v264 < v265 ) + { + for ( ii = v679; ; ii = (int *)v732 ) + { + v267 = (int)(ii + 1); + v732 = v267; + v268 = *(int *)v267; + *(int *)(v245 + 12) = v268; + v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[v245->GetItemEquipType() + 4]; + if ( v264 >= v265 ) + break; + } + } + v278 = 0; + v725 = 0.0; + if ( pItemsTable->pSpecialEnchantments_count > 0 ) + { + int *_v730 = v679; + for ( _v733 = 0; _v733 < pItemsTable->pSpecialEnchantments_count; ++_v733 ) + { + v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); + if ( !v279 || v279 == 1 ) + { + v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[v245->GetItemEquipType()]); + _v733 += v280; + if ( v280 ) + { + v281 = _v730; + ++_v730; + *v281 = _v733; + } + } + ++v278; + } + } + v282 = rand() % _v733; + v283 = v679; + v245->uSpecEnchantmentType = v679[0]; + v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[v245->GetItemEquipType() ]; + v285 = v282 + 1; + for ( l = v679; v284 < v285; ++l ) + { + v245->uSpecEnchantmentType = *(l+1); + v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[v245->GetItemEquipType()]; + } + ++v245->uSpecEnchantmentType; + v245->uAttributes |= 0x20u; + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; + break; + } + } + } + } + } + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428];//Не получилось!!! + if ( item_not_broken == false ) + v317 = pGlobalTXT_LocalizationStrings[585];//Предмет недостаточно высокого качества + ShowStatusBarString(v317, 2); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + //v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->uSpellID = 0; + pParty->pPlayers[pCastSpell->uPlayerID_2].PlaySound(SPEECH_43, 0); + } + break; + } + case SPELL_WATER_TOWN_PORTAL://Портал города + { + amount = 10 * spell_level; + if ( pPlayer->sMana < (signed int)uRequiredMana ) + break; + if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && skill_level != 4 || rand() % 100 >= amount && skill_level != 4 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + town_portal_caster_id = pCastSpell->uPlayerID; + pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); + LODWORD(v727) = 1; + break; + } + case SPELL_WATER_LLOYDS_BEACON://Маяк Ллойда + { + LODWORD(v733) = 604800 * spell_level; + if ( !_stricmp(pCurrentMapName, "d05.blv") ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + v319 = uRequiredMana; + if ( pPlayer->sMana >= (signed int)uRequiredMana ) { pEventTimer->Pause(); pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
--- a/Game.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/Game.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -3725,9 +3725,8 @@ pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); continue; } - v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; - pPlayers[uActiveCharacter]->uQuickSpell = v99; - stru_AA1058[uActiveCharacter - 1]._494836(v99, uActiveCharacter); + pPlayers[uActiveCharacter]->uQuickSpell = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; + AA1058_PartyQuickSpellSound[uActiveCharacter - 1].AddPartySpellSound(pPlayers[uActiveCharacter]->uQuickSpell, uActiveCharacter); if ( uActiveCharacter ) pPlayer10->PlaySound(SPEECH_12, 0); byte_506550 = 0;
--- a/SaveLoad.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/SaveLoad.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -158,21 +158,19 @@ for (uint i = 0; i < 4; ++i) { - uchar uQuickspell = pParty->pPlayers[i].uQuickSpell; - if (uQuickspell) - stru_AA1058[i]._494836(uQuickspell, i + 1); + if ( pParty->pPlayers[i].uQuickSpell ) + AA1058_PartyQuickSpellSound[i].AddPartySpellSound(pParty->pPlayers[i].uQuickSpell, i + 1); for (uint j = 0; j < 2; ++j) { uint uEquipIdx = pParty->pPlayers[i].pEquipment.pIndices[j]; if (uEquipIdx) { - int uItemID = pParty->pPlayers[i].pInventoryItemList[uEquipIdx - 1].uItemID; - if (pItemsTable->pItems[uItemID].uEquipType == EQUIP_WAND)//жезл + int pItemID = pParty->pPlayers[i].pInventoryItemList[uEquipIdx - 1].uItemID; + if (pItemsTable->pItems[pItemID].uEquipType == EQUIP_WAND && pItemID )//жезл { - __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - v31 = *((int *)&pSpellDatas[66].uNormalLevelRecovery + uItemID); - stru_A750F8[i]._494836(v31, i + 9); + __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 + stru_A750F8[i].AddPartySpellSound(wand_spell_ids[pItemID - ITEM_WAND_FIRE], i + 9); } } }
--- a/UI/UICharacter.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/UI/UICharacter.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -2542,7 +2542,7 @@ if ( _this.uItemID ) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v50].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); } break; } @@ -2550,18 +2550,16 @@ if ( v23 < 0 ) return; pParty->pPickedItem.uBodyAnchor = 1; - v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v23]; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; pMouse->RemoveHoldingItem(); if ( pEquipType != EQUIP_WAND ) return; - v22 = *(int *)v50; - v50 = v22; + v50 = pPlayers[uActiveCharacter]->pInventoryItemList[v23].uItemID; if ( v50 ) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v50].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); } break; } @@ -2573,19 +2571,13 @@ if ( v26 < 0 ) return; pParty->pPickedItem.uBodyAnchor = 2; - v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v26]; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; pMouse->RemoveHoldingItem(); if ( pEquipType != EQUIP_WAND ) return; - v22 = *(int *)v50; - v50 = v22; - if ( v50 ) - { - __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); - } + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v26].uItemID ) + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[pPlayers[uActiveCharacter]->pInventoryItemList[v26].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); break; } --v1; @@ -2603,7 +2595,7 @@ if ( v50 )//взять жезл { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 - stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); + stru_A750F8[uActiveCharacter - 1].AddPartySpellSound(wand_spell_ids[v50 - ITEM_WAND_FIRE], uActiveCharacter - 1 + 9); } break; //---------------------------take two hands(взять двумя руками)---------------------------------
--- a/mm7_3.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/mm7_3.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -1594,7 +1594,7 @@ float v39; // [sp+D0h] [bp-8h]@6 int *v40; // [sp+D4h] [bp-4h]@2 - __debugbreak();//нужно почистить, срабатывает при применении закла Точечный взрыв + __debugbreak();//нужно почистить, срабатывает при применении закла Точечный взрыв и при стрельбе из жезла v2 = (char *)&this->field_64[4 * this->uNumVertices]; v38 = 0; *(int *)v2 = this->field_64[0]; @@ -2004,14 +2004,14 @@ { signed int v1; // ebx@1 double v3; // st7@2 - int v4; // edx@4 + //int v4; // edx@4 char *v5; // ecx@5 int v6; // edi@5 float v7; // ST08_4@13 signed int v9; // [sp+Ch] [bp-8h]@1 float v10; // [sp+10h] [bp-4h]@2 - __debugbreak();//где используется ф-ция sw или hw? + __debugbreak();// почистить v1 = 0; v9 = 0; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) @@ -2019,19 +2019,20 @@ v10 = 16192.0; v3 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789; } - else + else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) { v10 = (double)pODMRenderParams->shading_dist_mist; v3 = 8.0; } - v4 = this->uNumVertices; - if ( v4 <= 0 ) + else + __debugbreak();//Error + if ( this->uNumVertices <= 0 ) { - memcpy(&this->field_14[40], &this->field_14[20], 16 * v4); + memcpy(&this->field_14[40], &this->field_14[20], 16 * this->uNumVertices); return this->uNumVertices != 0; } v5 = (char *)&this->field_14[20]; - for ( v6 = v4; v6; --v6 ) + for ( v6 = 0; v6 < this->uNumVertices; v6++ ) { if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 ) { @@ -2049,7 +2050,7 @@ this->_477927(v10); return this->uNumVertices != 0; } - memcpy(&this->field_14[40], &this->field_14[20], 16 * v4); + memcpy(&this->field_14[40], &this->field_14[20], 16 * this->uNumVertices); return this->uNumVertices != 0; } v7 = v3;
--- a/mm7_4.cpp Thu Jan 23 23:35:10 2014 +0600 +++ b/mm7_4.cpp Fri Jan 24 18:01:51 2014 +0600 @@ -320,7 +320,7 @@ { if ( !(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) ) { // taking on water - v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; + v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&AA1058_PartyQuickSpellSound[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000]; v7 = *v8 < v4; *v8 -= v4; if ( v7 ) @@ -911,7 +911,7 @@ } //----- (00494836) -------------------------------------------------------- -int stru339_spell_sound::_494836(int uSoundID, int a6) +int stru339_spell_sound::AddPartySpellSound(int uSoundID, int a6) { int v3; // esi@1 int result; // eax@1