# HG changeset patch # User Grumpy7 # Date 1391116288 -3600 # Node ID d0e321190c86da773deb9ecf48005f0f8e3965cb # Parent 4842f58715eab43c32150b4d21e30ccd0a2b35dd# Parent c13ae8d8471f188d5da1d5ade47a63aba431b923 Merge diff -r 4842f58715ea -r d0e321190c86 CastSpellInfo.cpp --- a/CastSpellInfo.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/CastSpellInfo.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -37,65 +37,21 @@ signed int v6; // eax@14 unsigned __int16 v11; // cx@45 signed int i; // esi@76 - __int16 v23; // ax@88 - signed __int64 v54; // qax@164 - signed __int64 v58; // qax@177 Actor *pActor; // edi@177 - unsigned __int16 v60; // ax@184 int v61; // ecx@184 - double v90; // st7@245 - Player *v92; // eax@255 - int v105; // edi@271 int v111; // eax@274 - Actor *v112; // esi@278 int dist_X; // eax@278 int new_dist_Y; int dist_Z; - int v114; // ebx@278 - unsigned int v115; // ecx@278 int v116; // edx@279 int v117; // edx@281 int v118; // edx@283 - signed int v122; // eax@286 - int v127; // eax@296 - int v153; // ecx@322 - int v154; // eax@322 - int v155; // eax@323 - int v156; // eax@323 - int v162; // edi@340 - signed int v164; // eax@340 - signed int v165; // edi@340 - signed int v168; // edi@343 int v169; // eax@344 - signed int v174; // edi@355 int v188; // esi@369 int v189; // edi@369 - signed int v191; // edi@379 - signed int v205; // edi@405 int v206; // eax@407 - __int16 v207; // cx@407 - int v208; // eax@411 - signed int v209; // ecx@412 - int v210; // edx@412 - signed int v211; // ecx@412 - int v212; // eax@413 - int v213; // eax@413 - int v214; // eax@413 - int v215; // eax@415 - double v216; // st7@415 - double v217; // st6@415 - signed __int64 v218; // qtt@423 - char v223; // al@438 - int v227; // esi@453 - unsigned int v228; // edi@454 - int v229; // edi@466 - ItemGen *v240; // ecx@472 double v241; // st7@478 ItemGen *v245; // edi@492 - int v254; // eax@513 - int v255; // esi@513 - int v256; // ecx@513 - int v257; // edx@514 int v258; // ecx@514 char v259; // al@516 int v260; // eax@518 @@ -107,8 +63,6 @@ int *ii; // eax@522 int v267; // eax@524 int v268; // eax@524 - char v271; // al@531 - int v277; // edx@548 int v278; // ecx@548 char v279; // al@550 int v280; // eax@552 @@ -118,133 +72,19 @@ int v284; // esi@555 int v285; // edx@555 int *l; // eax@556 - ItemGen *v294; // esi@575 int v295; // edx@575 - int kk; // edi@575 char v313; // al@606pGame->GetStru6() const char *v317; // ecx@617 - Player *v318; // ecx@619 - unsigned int v319; // edi@627 - int v323; // edi@635 - char *v324; // eax@635 - Player *v325; // ecx@640 - int v328; // ecx@651 - int v329; // ecx@652 - int v330; // edi@654 - signed int v342; // edi@668 - signed int v343; // edi@670 - unsigned __int64 v344; // ST08_8@670 - Player *v351; // edi@680 - Player *v357; // edi@694 - Actor *v369; // edi@705 - int v373; // eax@715 - int v374; // eax@717 - int v376; // eax@717 - Player *v377; // ecx@719 - int v381; // edi@727 - int v382; // ecx@727 - Player *v383; // eax@728 - int v384; // eax@733 - int v388; // edi@740 int v396; // eax@752 - int v397; // eax@757 - int v398; // eax@757 - int v399; // eax@757 - Actor *v417; // eax@787 - int v418; // ecx@789 - __int16 v419; // ax@791 - signed int v420; // eax@793 - ItemGen *v421; // edx@793 - const char *v422; // eax@801 - signed int v426; // eax@815 - Actor *v433; // edi@832 - int v435; // ecx@837 - int v440; // eax@843 - int v441; // eax@847 - signed int v445; // edi@857 __int16 v448; // ax@864 - char *v449; // esi@870 - int v450; // eax@870 - signed int v460; // eax@895 - Actor *v461; // eax@897 - unsigned __int16 v462; // cx@897 - signed int v463; // edx@897 - int v470; // edi@913 - int v471; // eax@917 - int v472; // eax@917 - int v498; // edi@931 - int v499; // eax@935 - int v500; // eax@935 - Player *v501; // edi@939 - int v505; // eax@943 - int v507; // edi@944 - signed int v509; // eax@944 - Actor *v518; // edx@957 - __int16 v519; // cx@958 - int v531; // eax@982 - int v533; // edi@983 - signed int v535; // eax@983 - signed int v536; // edi@983 - stru6 *v537; // eax@984 - double v549; // st7@991 - unsigned __int16 v550; // di@991 - Player *v553; // edi@1001 - unsigned __int16 v562; // di@1005 - signed int v563; // eax@1010 - unsigned int v564; // ecx@1011 - signed int v565; // eax@1012 - Player **v566; // ecx@1012 - int v567; // eax@1012 - Player *v571; // eax@1013 - char *v572; // ecx@1013 - signed int v576; // eax@1025 - Player *v577; // eax@1026 - int v578; // eax@1028 - __int16 v579; // ax@1029 - int v581; // edi@1031 - char *v585; // esi@1034 - signed int v587; // eax@1035 - char v591; // al@1048 - ItemGen *v592; // esi@1052 - int v596; // esi@1066 - unsigned int v597; // edi@1067 - NPCData *pNPCData; // eax@1089 - int v606; // edx@1091 - AwardType *v607; // ecx@1100 - __int16 v608; // ax@1102 - signed int v609; // eax@1104 - int v610; // edi@1106 - unsigned int v611; // eax@1106 - Player *v612; // edi@1106 DDM_DLV_Header *v613; // eax@1108 - int v615; // edi@1119 - Player *v619; // edi@1123 - signed __int64 v623; // qax@1127 - int v625; // edi@1129 - signed int v627; // eax@1129 - signed int v628; // edi@1129 - int v629; // ecx@1130 - Player *v630; // eax@1131 - int v631; // eax@1137 - int v635; // edi@1142 int v642; // edi@1156 int v643; // eax@1156 - int v644; // eax@1156 - signed int v645; // eax@1158 - unsigned int v656; // [sp-4h] [bp-E88h]@639 int v659; // [sp+0h] [bp-E84h]@123 - Actor *v661; // [sp+0h] [bp-E84h]@164 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 - const char *v664; // [sp+0h] [bp-E84h]@802 int v666; // [sp+4h] [bp-E80h]@12 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 - int v675; // [sp+4h] [bp-E80h]@800 int v679[800]; // [sp+14h] [bp-E70h]@515 - AIDirection a3; // [sp+C94h] [bp-1F0h]@21 - int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 - int v682[4]; // [sp+CC0h] [bp-1C4h]@731 - //ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 - int v684; // [sp+D04h] [bp-180h]@416 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 @@ -256,27 +96,17 @@ Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 int v710; // [sp+D8Ch] [bp-F8h]@1156 - __int64 v712; // [sp+D94h] [bp-F0h]@991 - int v713; // [sp+D9Ch] [bp-E8h]@324 int n; // [sp+DA0h] [bp-E4h]@1 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 - __int64 v717; // [sp+DC4h] [bp-C0h]@271 - float v718; // [sp+DCCh] [bp-B8h]@176 - signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 - char *y; // [sp+DD4h] [bp-B0h]@325 - int v721; int mon_id; int dist_Y; // [sp+DD8h] [bp-ACh]@163 int v723; // [sp+E4Ch] [bp-38h]@1 ItemGen *_this; // [sp+E50h] [bp-34h]@23 - float v725; // [sp+E54h] [bp-30h]@23 + int v725; // [sp+E54h] [bp-30h]@23 int buff_resist; - Player *v726; // [sp+E58h] [bp-2Ch]@131 - float v727; // [sp+E5Ch] [bp-28h]@1 - unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 + bool spell_sound_flag; // [sp+E5Ch] [bp-28h]@1 Player *pPlayer; // [sp+E64h] [bp-20h]@8 int v730; // [sp+E68h] [bp-1Ch]@53 - Player *v730b; ItemGen *v730c; int skill_level; // [sp+E6Ch] [bp-18h]@48 signed int v732; // [sp+E70h] [bp-14h]@325 @@ -293,7 +123,7 @@ amount = 0; LODWORD(v733) = 0; v723 = 0; - v727 = 0.0; + spell_sound_flag = false; for(n = 0; n < CastSpellInfoCount; ++n) { pCastSpell = &pCastSpellInfo[n]; @@ -344,7 +174,7 @@ } } - LODWORD(v725) = 0; + v725 = 0; _this = 0; if (pCastSpell->forced_spell_skill_level) { @@ -375,24 +205,28 @@ v667 = PLAYER_SKILL_DARK; else if (pCastSpell->uSpellID == SPELL_BOW_ARROW) v667 = PLAYER_SKILL_BOW; + else if (pCastSpell->uSpellID == SPELL_101 || pCastSpell->uSpellID == SPELL_LASER_PROJECTILE ) + v667 = PLAYER_SKILL_BLASTER; else assert(false && "Unknown spell"); - LODWORD(v725) = v667; + v725 = v667; v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; spell_level = v723; - v11 = pPlayer->pActiveSkills[LODWORD(v725)]; + v11 = pPlayer->pActiveSkills[v725]; } skill_level = SkillToMastery(v11); + if (pCastSpell->uSpellID < SPELL_BOW_ARROW ) + { + if (pCastSpell->forced_spell_skill_level) + uRequiredMana = 0; + else + uRequiredMana = pSpellDatas[pCastSpell->uSpellID].mana_per_skill[skill_level - 1]; + sRecoveryTime = pSpellDatas[pCastSpell->uSpellID].recovery_per_skill[skill_level - 1]; + } - if (pCastSpell->forced_spell_skill_level) - uRequiredMana = 0; - else - uRequiredMana = pSpellDatas[pCastSpell->uSpellID].mana_per_skill[skill_level - 1]; - sRecoveryTime = pSpellDatas[pCastSpell->uSpellID].recovery_per_skill[skill_level - 1]; - - if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || - LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) + if (v725 == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || + v725 == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) uRequiredMana = 0; if (pCastSpell->uSpellID < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) @@ -507,7 +341,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * spell_level * 4.2666669), skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_FIRE_SPIKE://огненный шип @@ -558,7 +392,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_IMPLOSION://Точный взрыв @@ -596,7 +430,7 @@ pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id); DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v697); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_EARTH_MASS_DISTORTION://Изменение веса @@ -628,7 +462,7 @@ pSpellSprite.spell_target_pid = PID(OBJECT_Actor, mon_id); DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v704); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_DESTROY_UNDEAD://Уничтожение нежити @@ -666,7 +500,7 @@ continue; } DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_FIRE_BOLT://Удар огня @@ -711,7 +545,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_WATER_ACID_BURST://Всплеск кислоты @@ -742,7 +576,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_SUNRAY://Луч Солнца @@ -778,7 +612,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; } break; } @@ -796,7 +630,7 @@ pActors[mon_id].vVelocity.y = 0; pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_EARTH_SLOW://Замедление @@ -820,7 +654,7 @@ pActors[mon_id].uAttributes |= 0x80000; pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_CHARM:// Очарование @@ -858,7 +692,7 @@ pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_DARK_SHRINKING_RAY://Сжимающий луч @@ -886,7 +720,7 @@ v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_FIRE_AURA: //Аура огня @@ -920,7 +754,7 @@ } v730c->uAttributes |= ITEM_AURA_EFFECT_RED; _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } _50C9D0_AfterEnchClickEventId = 113; @@ -946,7 +780,7 @@ break; pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_PROTECTION_FROM_FIRE://Защита от Огня @@ -997,7 +831,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); //v90 = (double)(signed int)(3600 * spell_level) * 4.2666669; pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_HASTE://Спешка @@ -1013,13 +847,13 @@ } if ( pPlayer->CanCastSpell(uRequiredMana) ) { - LODWORD(v727) = 1; + spell_sound_flag = true; for ( uint pl_id = 0; pl_id < 4; pl_id++ ) { if ( pParty->pPlayers[pl_id].pConditions[Condition_Weak] ) - LODWORD(v727) = 0; + spell_sound_flag = false; } - if (LODWORD(v727)) + if ( spell_sound_flag ) { pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0); @@ -1050,7 +884,7 @@ v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), 1, amount, v111, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } for ( uint pl_id = 0; pl_id < 4; pl_id++ ) @@ -1060,7 +894,7 @@ pParty->pPlayers[pl_id].pPlayerBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, v111, 0); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_SPIRIT_LASH://Плеть Духа @@ -1114,7 +948,7 @@ pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z - (unsigned int)(signed __int64)((double)pActors[mon_id].uActorHeight * -0.8); pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), mon_id, &v701); - LODWORD(v727) = 1; + spell_sound_flag = true; } else { @@ -1164,7 +998,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_IMMOLATION://Кольцо огня @@ -1181,7 +1015,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, spell_level, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_METEOR_SHOWER://Поток метеоров @@ -1258,7 +1092,7 @@ k = rand() % 1024 - 512; } } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_FIRE_INFERNO://Адский огонь @@ -1298,7 +1132,7 @@ pGame->GetStru6()->_4A81CA(&pSpellSprite); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1E, 0x40); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_WIZARD_EYE://Око чародея @@ -1309,7 +1143,7 @@ for ( uint pl_id = 0; pl_id < 4; pl_id++ ) v169 = pOtherOverlayList->_4418B1(2000, pl_id + 100, 0, 65536); pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, v169, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_FEATHER_FALL://Падение пера(пёрышком) @@ -1334,7 +1168,7 @@ pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_SPARKS://Искры @@ -1380,7 +1214,7 @@ ++pTurnEngine->pending_actions; v188 += _v726 / (amount - 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_JUMP://Прыжок @@ -1397,7 +1231,7 @@ pOtherOverlayList->_4418B1(2040, pl_id + 100, 0, 65536); pParty->uFlags |= 0x100; pParty->uFallSpeed = 1000; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_INVISIBILITY://Невидимость @@ -1426,7 +1260,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; } break; } @@ -1455,7 +1289,7 @@ v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, amount, v206, pCastSpell->uPlayerID + 1); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_AIR_STARBURST://Звездопад @@ -1524,7 +1358,7 @@ j = rand() % 1024 - 512; k = rand() % 1024 - 512; } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_WATER_AWAKEN://Пробуждение @@ -1557,7 +1391,7 @@ pParty->pPlayers[i].PlaySound(SPEECH_103, 0); } } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_WATER_POISON_SPRAY://Распыление яда @@ -1617,24 +1451,23 @@ pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) LOBYTE(pSpellSprite.uAttributes) |= 4; - v227 = _v733 / -2; - signed int _y = _v733 / 2; - if ( v227 <= _y ) + v188 = _v733 / -2; + v189 = _v733 / 2; + if ( v188 <= v189 ) { - v228 = v715.uYawAngle; do { - pSpellSprite.uFacing = v227 + v228; + pSpellSprite.uFacing = v188 + v715.uYawAngle; if ( pSpellSprite.Create(pSpellSprite.uFacing, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - v227 += _v733 / (amount - 1); + v188 += _v733 / (amount - 1); } - while ( v227 <= _y ); + while ( v188 <= v189 ); } } - LODWORD(v727) = 1; - break; + spell_sound_flag = true; + break; } case SPELL_WATER_WATER_WALK://Хождение по воде { @@ -1664,7 +1497,7 @@ skill_level, amount, v169, pCastSpell->uPlayerID + 1); if ( skill_level == 4 ) pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_WATER_RECHARGE_ITEM://Перезарядка @@ -1709,7 +1542,7 @@ } v730c->uAttributes |= 0x40u; _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_WATER_ENCHANT_ITEM://Талисман @@ -1771,13 +1604,13 @@ v245->m_enchantmentStrength = pItemsTable->pEnchantments[v295].to_item[_v725->uEquipType - EQUIP_ARMOUR]; v245->uAttributes |= 0x20u; _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } else if ( skill_level == 3 || skill_level == 4)//мастер и гранд { v258 = 0; - v725 = 0.0; + v725 = 0; int _v733; if ( pItemsTable->pSpecialEnchantments_count > 0 ) { @@ -1788,7 +1621,7 @@ if ( !v259 || v259 == 1 ) { v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() + 4] + v258 * 28); - LODWORD(v725) += v260; + v725 += v260; if ( v260 ) { v261 = v730; @@ -1799,7 +1632,7 @@ ++v258; } } - v262 = rand() % SLODWORD(v725); + v262 = rand() % v725; v263 = v679; v245->uSpecEnchantmentType = v679[0]; v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4]; @@ -1818,7 +1651,7 @@ } } v278 = 0; - v725 = 0.0; + v725 = 0; if ( pItemsTable->pSpecialEnchantments_count > 0 ) { int *_v730 = v679; @@ -1852,14 +1685,14 @@ ++v245->uSpecEnchantmentType; v245->uAttributes |= 0x20u; _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } } } } } - if ( LODWORD(v727) == 0 ) + if ( spell_sound_flag == 0 ) { v317 = pGlobalTXT_LocalizationStrings[428];//Не получилось!!! if ( item_not_broken == false ) @@ -1887,7 +1720,7 @@ } town_portal_caster_id = pCastSpell->uPlayerID; pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_WATER_LLOYDS_BEACON://Маяк Ллойда @@ -1931,13 +1764,13 @@ if ( skill_level == 4 )//for GM { pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Pertified] = 0; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Pertified, v663); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_EARTH_ROCK_BLAST://Взрыв камня @@ -1966,7 +1799,7 @@ if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_EARTH_DEATH_BLOSSOM: //Цветок смерти @@ -2003,7 +1836,7 @@ if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->pending_actions; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_DETECT_LIFE: // Детектор жизни @@ -2025,7 +1858,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)amount << 7) * 0.033333335), skill_level, 0, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_FATE:// Судьба @@ -2046,7 +1879,7 @@ { pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } if (PID_TYPE(pCastSpell->spell_target_pid) == OBJECT_Actor) @@ -2056,7 +1889,7 @@ pActors[mon_id].uAttributes |= 0x80000; pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_REMOVE_CURSE:// Снятие порчи @@ -2074,7 +1907,7 @@ break; if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Cursed] ) { - LODWORD(v727) = 1; + spell_sound_flag = true; break; } if ( skill_level == 4 )//GM @@ -2085,12 +1918,12 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Cursed] ) { - LODWORD(v727) = 1; + spell_sound_flag = true; break; } } pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_PRESERVATION://Сохранение @@ -2106,7 +1939,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } for ( uint pl_id = 0; pl_id < 4; pl_id++ ) @@ -2115,7 +1948,7 @@ pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_TURN_UNDEAD://Бег мертвецов @@ -2154,7 +1987,7 @@ (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); } } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_RAISE_DEAD://Оживление @@ -2168,7 +2001,7 @@ pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] ) { - LODWORD(v727) = 1; + spell_sound_flag = true; break; } pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; @@ -2185,7 +2018,7 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); } pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_SHARED_LIFE://Общая жизнь @@ -2218,7 +2051,7 @@ pPlayers[pl_array[i]]->SetUnconcious(0); pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[i] - 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_SPIRIT_RESSURECTION://Воскресение @@ -2258,7 +2091,7 @@ pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_CURE_PARALYSIS://лечение паралича @@ -2277,18 +2110,18 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] ) { - LODWORD(v727) = 1; + spell_sound_flag = true; break; } if ( skill_level == 4 ) { pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] = 0; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Paralyzed, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_REMOVE_FEAR://Снять страх @@ -2307,18 +2140,18 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] ) { - LODWORD(v727) = 1; + spell_sound_flag = true; break; } if ( skill_level == 4 ) { pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] = 0; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Fear, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_TELEPATHY://Телепатия @@ -2385,7 +2218,7 @@ pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_BERSERK://Берсерк @@ -2431,7 +2264,7 @@ pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_ENSLAVE://Порабощение @@ -2471,7 +2304,7 @@ pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_MASS_FEAR://Массовый страх @@ -2512,7 +2345,7 @@ skill_level, 0, 0, 0); } } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_MIND_CURE_INSANITY://Лечение Безумия @@ -2535,7 +2368,7 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 0); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_EARTH_TELEKINESIS://Телекинез @@ -2591,7 +2424,7 @@ v448 = pOutdoor->pBModels[a2 >> 9].pFaces[obj_id & 0x3F].sCogTriggeredID; EventProcessor(v448, a2, 1); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_CURE_WEAKNESS://Лечить Слабость @@ -2613,13 +2446,13 @@ if ( skill_level == 4 ) { pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak] = 0; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Weak, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_FIRST_AID://Первая помощь @@ -2651,7 +2484,7 @@ pActors[mon_id].sCurrentHP = pActors[mon_id].pMonsterInfo.uHP; } } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_CURE_POISON://Лечение Отравления(Противоядие) @@ -2677,14 +2510,14 @@ pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Weak] = 0; pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Medium] = 0; pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Severe] = 0; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Weak, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Medium, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Poison_Severe, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_PROTECTION_FROM_MAGIC://Защита от магии @@ -2697,7 +2530,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_HAMMERHANDS://Руки-Молоты @@ -2713,13 +2546,13 @@ for ( uint pl_id = 0; pl_id < 4; pl_id++) pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), 4, spell_level, spell_level, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, spell_level, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_CURE_DISEASE://Лечить Болезнь @@ -2748,7 +2581,7 @@ pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(Condition_Disease_Severe, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_BODY_POWER_CURE://Исцеление @@ -2760,7 +2593,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); pParty->pPlayers[pl_id].Heal(5 * spell_level + 10); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_DISPEL_MAGIC://Снятие чар @@ -2806,7 +2639,7 @@ for (int i = 0; i < 22; ++i) pActors[_50BF30_actors_in_viewport_ids[a2]].pActorBuffs[i].Reset(); } - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_SUMMON_ELEMENTAL://Элементал @@ -2837,7 +2670,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, skill_level, v733); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_DAY_OF_THE_GODS://День богов @@ -2859,7 +2692,7 @@ pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3); pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_PRISMATIC_LIGHT://Свет призмы @@ -2901,7 +2734,7 @@ } //v537 = pGame->GetStru6(); pGame->GetStru6()->_4A8BFC(); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_DAY_OF_PROTECTION://День защиты @@ -2937,7 +2770,7 @@ (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0); pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_HOUR_OF_POWER: //Час могущества @@ -2974,7 +2807,7 @@ if ( !player_weak ) pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed __int64)((double)((60 * (spell_level * duration + 60)) << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0); - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_LIGHT_DIVINE_INTERVENTION://Божественное вмешательство @@ -3003,7 +2836,7 @@ pPlayer->sAgeModifier = pPlayer->sAgeModifier + 10; sRecoveryTime += -5 * spell_level; ++pPlayer->uNumDivineInterventionCastsThisDay; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_DARK_REANIMATE: //Реанимация @@ -3082,438 +2915,359 @@ pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Reset(); if ( pActors[mon_id].sCurrentHP > 10 * amount ) pActors[mon_id].sCurrentHP = 10 * amount; - LODWORD(v727) = 1; + spell_sound_flag = true; break; } case SPELL_DARK_VAMPIRIC_WEAPON:// Оружие-вампир { amount = 16; if ( skill_level == 4 ) - { - LODWORD(v733) = 0; - } - else - { - LODWORD(v733) = 3600 * spell_level; - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - __debugbreak(); - //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; - ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; - ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; - _v733->UpdateTempBonus(pParty->uTimePlayed); - if ( _v733->uItemID >= 64 && _v733->uItemID <= 65 - || LOBYTE(_v733->uAttributes) & 2 - || _v733->uSpecEnchantmentType != 0 - || _v733->uEnchantmentType != 0 - || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2 - || pItemsTable->IsMaterialNonCommon(_v733) ) - { - _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; - } - v592 = _v733; - //v14 = skill_level == 4; - _v733->uSpecEnchantmentType = 16; - if ( skill_level != 4 ) - { - v732 = (int)v733 << 7; - v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); - v592->uAttributes |= 8u; - } - LOBYTE(v592->uAttributes) |= 0x80u; - _50C9A8_item_enchantment_timer = 256; - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_SHARPMETAL: - { - switch (skill_level) - { - case 1: amount = 5; break; - case 2: amount = 5; break; - case 3: amount = 7; break; - case 4: amount = 9; break; - default: - assert(false); - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - signed int _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.vPosition.x = pParty->vPosition.x; - pSpellSprite.vPosition.y = pParty->vPosition.y; - pSpellSprite.uAttributes = 0; - pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; - pSpellSprite.uSectorID = pIndoor->GetSector( - pParty->vPosition.x, - pParty->vPosition.y, - pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.spell_target_pid = a2; - pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(pSpellSprite.uAttributes) |= 4u; - v596 = (signed int)_v726 / -2; - y = (char *)((signed int)_v726 / 2); - if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) - { - v597 = v715.uYawAngle; - do - { - pSpellSprite.uFacing = v596 + v597; - if ( pSpellSprite.Create( - v596 + v597, - v715.uPitchAngle, - pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, - pCastSpell->uPlayerID + 1) != -1 - && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->pending_actions; - v596 += _v726 / (amount - 1); - } - while ( v596 <= (signed int)y ); - } - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_CONTROL_UNDEAD: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - switch (skill_level) - { - case 1: LODWORD(v733) = 180 * spell_level; break; - case 2: LODWORD(v733) = 180 * spell_level; break; - case 3: LODWORD(v733) = 300 * spell_level; break; - case 4: LODWORD(v733) = 29030400; break; - default: - assert(false); - } - if (PID_TYPE(a2) != OBJECT_Actor) - { - LODWORD(v727) = 1; - break; - } - pActor = &pActors[PID_ID(a2)]; - if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) - break; - if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - pActor->pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); - pActor->pActorBuffs[ACTOR_BUFF_CHARM].Reset(); - pActor->pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), - skill_level, 0, 0, 0); - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - - pSpellSprite.uObjectDescID = v60; - pSpellSprite.vPosition.x = pActor->vPosition.x; - pSpellSprite.vPosition.y = pActor->vPosition.y; - pSpellSprite.vPosition.z = pActor->vPosition.z + pActor->uActorHeight; - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = pIndoor->GetSector(pActor->vPosition.x, pActor->vPosition.y, pSpellSprite.vPosition.z); - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.spell_target_pid = a2; - pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - pSpellSprite.uFacing = LOWORD(v715.uYawAngle); - LOBYTE(pSpellSprite.uAttributes) |= 0x80u; - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_SACRIFICE: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - int _v733 = 0; - memset(&achieved_awards, 0, 4000); - int i = 0; - pNPCData = pParty->pHirelings.data(); - do - { - if ( pNPCData->pName != 0) - { - v606 = _v733++; - achieved_awards[v606] = (AwardType)(i + 1); - } - ++i; - ++pNPCData; - } - while ( pNPCData <= &pParty->pHirelings[1] ); - i = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0) - { - pNPCData = pNPCStats->pNewNPCData; - //__debugbreak(); // data offset - AwardType *_v734 = &achieved_awards[_v733]; - do - { - if ( pNPCData->uFlags & 0x80 - && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName)) - && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) ) - { - v607 = _v734; - ++_v734; - *v607 = (AwardType)(i + 3); - } - ++i; - ++pNPCData; - } - while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs ); - } - v608 = pCastSpell->uPlayerID_2; - if ( v608 != 4 && v608 != 5 - || (v609 = (signed int)*(&pFontCChar + v608 + pParty->hirelingScrollPosition), v609 <= 0) - || v609 >= 3 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - v610 = 76 * v609; - //*((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; - pParty->pHirelings[v609-1].evt_B = 0; - v611 = pIconsFrameTable->FindIcon("spell96"); - //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); - pParty->pHirelings[v609-1].evt_C = pIconsFrameTable->GetIconAnimLength(v611); - //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; - pParty->pHirelings[v609-1].evt_A = 1; - - v612 = pParty->pPlayers.data(); - do - { - v612->sHealth = v612->GetMaxHealth(); - v612->sMana = v612->GetMaxMana(); - ++v612; - } - while ( v612 <= &pParty->pPlayers[3] ); - v613 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) - v613 = &pIndoor->dlv; - v613->uReputation += 15; - if ( v613->uReputation > 10000 ) - v613->uReputation = 10000; - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_PAIN_REFLECTION: - { - switch (skill_level) - { - case 1: LODWORD(v733) = 300 * (spell_level + 12); break; - case 2: LODWORD(v733) = 300 * (spell_level + 12); break; - case 3: LODWORD(v733) = 300 * (spell_level + 12); break; - case 4: LODWORD(v733) = 900 * (spell_level + 4); break; - default: - assert(false); - } - amount = spell_level + 5; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - if ( skill_level != 3 && skill_level != 4 ) - { - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); - pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, amount, 0, 0); - LODWORD(v727) = 1; - break; - } - for ( uint pl_id = 0; pl_id , 4; pl_id++ ) - { - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); - pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + - (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), skill_level, amount, 0, 0); - } - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_SOULDRINKER: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - pGame->GetIndoorCamera(); - v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); - signed int _v733 = pRenderer->_46А6АС_GetActorsInViewport(v623); - v707.x = 0; - v707.y = 0; - v707.z = 0; - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->uSpellID; - pSpellSprite.spell_level = spell_level; - pSpellSprite.spell_skill = skill_level; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = 0; - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.field_60_distance_related_prolly_lod = 0; - pSpellSprite.uFacing = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - a2 = 0; - int _v726 = 0; - if ( _v733 > 0 ) - { - _v726 = (_v733 * (7 * spell_level + 25)); - do - { - v625 = _50BF30_actors_in_viewport_ids[a2]; - pSpellSprite.vPosition.x = pActors[v625].vPosition.x; - pSpellSprite.vPosition.y = pActors[v625].vPosition.y; - //v732 = pActors[v625].uActorHeight; - pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * -0.8); - pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[a2]); - v627 = pSpellSprite.Create(0, 0, 0, 0); - v628 = a2; - DamageMonsterFromParty(PID(OBJECT_Item, v627), _50BF30_actors_in_viewport_ids[a2], &v707); - a2 = v628 + 1; - } - while ( v628 + 1 < _v733 ); - } - v730 = 0; - v629 = 1; - do - { - v630 = pPlayers[v629]; - if ( !v630->pConditions[2] - && !v630->pConditions[12] - && !v630->pConditions[13] - && !v630->pConditions[14] - && !v630->pConditions[15] - && !v630->pConditions[16] ) - { - v631 = v730++; - v681[v631] = v629; - } - ++v629; - } - while ( v629 <= 4 ); - v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); - _v733 = 0; - if ( v730 > 0 ) - { - do - { - //v632 = 4 * v681[HIDWORD(v733)] + 10965188; - v726 = pPlayers[v681[_v733]]; - //v633 = pPlayers[v681[HIDWORD(v733)]]; - v726->sHealth += v732; - //v726 = *(Player **)v632; - //v634 = v726->GetMaxHealth(); - if ( v726->sHealth > v726->GetMaxHealth()) - v726->sHealth = v726->GetMaxHealth(); - v635 = _v733; - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, WORD2(v733)); - _v733 = v635 + 1; - } - while ( v635 + 1 < v730 ); - } - pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_ARMAGEDDON: - { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - if ( skill_level == 4) - amount = 4; - else - amount = 3; - if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->uSpellID = 0; - continue; - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - pParty->armageddon_timer = 256; - pParty->armageddonDamage = spell_level; - ++pPlayer->uNumArmageddonCasts; - if ( pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->pending_actions; - int _v726 = 50; - do - { - v642 = rand() % 4096 - 2048; - v643 = rand(); - v721 = v642 + pParty->vPosition.x; - y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); - v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, &v710, 0); - v644 = rand(); - sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); - --_v726; - } - while ( _v726 != 0 ); - LODWORD(v727) = 1; - break; - } - - default: - break; - } - if ( pCastSpell->uFlags & 0x20 ) - { - if ( v727 != 0.0 ) - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); - } - else - { - if ( sRecoveryTime < 0 ) - sRecoveryTime = 0; - if ( pParty->bTurnBasedModeOn ) - { - v645 = sRecoveryTime; - pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; - pPlayer->SetRecoveryTime(v645); - if ( !some_active_character ) - pTurnEngine->ApplyPlayerAction(); - } - else - { - pPlayer->SetRecoveryTime( - (signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); - } - if ( v727 != 0.0 ) - { - pPlayer->PlaySound(SPEECH_49, 0); - if ( v727 != 0.0 ) - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); - } - } - pCastSpell->uSpellID = 0; - spell_level = v723; - continue; + duration = 0; + else + duration = 3600 * spell_level; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + ItemGen *item = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; + item->UpdateTempBonus(pParty->uTimePlayed); + if ( item->uItemID >= 64 && item->uItemID <= 65//blasters + || LOBYTE(item->uAttributes) & 2 + || item->uSpecEnchantmentType != 0 + || item->uEnchantmentType != 0 + || pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_SINGLE_HANDED + && pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_TWO_HANDED + && pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_BOW + || pItemsTable->IsMaterialNonCommon(item) ) + { + _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; + } + item->uSpecEnchantmentType = 16; + if ( skill_level != 4 ) + { + item->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335); + item->uAttributes |= 8; + } + LOBYTE(item->uAttributes) |= 0x80; + _50C9A8_item_enchantment_timer = 256; + spell_sound_flag = true; + break; + } + case SPELL_DARK_SHARPMETAL://Шрапнель + { + switch (skill_level) + { + case 1: amount = 5; break; + case 2: amount = 5; break; + case 3: amount = 7; break; + case 4: amount = 9; break; + default: + assert(false); + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + signed int _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; + pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, + pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + if ( pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4; + v188 = (signed int)_v726 / -2; + v189 = (signed int)_v726 / 2; + if ( v188 <= v189 ) + { + do + { + pSpellSprite.uFacing = v188 + v715.uYawAngle; + if ( pSpellSprite.Create(pSpellSprite.uFacing, v715.uPitchAngle, + pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, pCastSpell->uPlayerID + 1) != -1 + && pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->pending_actions; + v188 += _v726 / (amount - 1); + } + while ( v188 <= v189 ); + } + spell_sound_flag = true; + break; + } + case SPELL_DARK_CONTROL_UNDEAD://Глава нежити + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + switch (skill_level) + { + case 1: duration = 180 * spell_level; break; + case 2: duration = 180 * spell_level; break; + case 3: duration = 300 * spell_level; break; + case 4: duration = 29030400; break; + default: + assert(false); + } + if (PID_TYPE(a2) == OBJECT_Actor) + { + mon_id = PID_ID(a2); + if ( !MonsterStats::BelongsToSupertype(pActors[mon_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) + break; + if ( !stru_50C198.GetMagicalResistance(&pActors[mon_id], 10) ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + pActors[mon_id].pActorBuffs[ACTOR_BUFF_BERSERK].Reset(); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_CHARM].Reset(); + pActors[mon_id].pActorBuffs[ACTOR_BUFF_ENSLAVED].Apply(pParty->uTimePlayed + + (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pActors[mon_id].vPosition.x; + pSpellSprite.vPosition.y = pActors[mon_id].vPosition.y; + pSpellSprite.vPosition.z = pActors[mon_id].vPosition.z + pActors[mon_id].uActorHeight; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(pActors[mon_id].vPosition.x, pActors[mon_id].vPosition.y, pSpellSprite.vPosition.z); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); + } + spell_sound_flag = true; + break; + } + case SPELL_DARK_SACRIFICE://Жертва + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + int hired_npc = 0; + memset(&achieved_awards, 0, 4000); + for ( uint npc_id = 0; npc_id < 2; npc_id++ ) //количество нанятых НПС + { + if ( pParty->pHirelings[npc_id].pName != 0) + achieved_awards[hired_npc++] = (AwardType)(npc_id + 1); + } + /*if ( (signed int)pNPCStats->uNumNewNPCs > 0) + { + //AwardType *_v734 = &achieved_awards[_v733]; + for ( int npc_id = 0; npc_id < pNPCStats->uNumNewNPCs; ++npc_id ) + { + if ( pNPCStats->pNewNPCData[npc_id].uFlags & 0x80//hired(наёмный) + && (!pParty->pHirelings[0].pName + || strcmp(pNPCStats->pNewNPCData[npc_id].pName, pParty->pHirelings[0].pName)) + && (!pParty->pHirelings[1].pName + || strcmp(pNPCStats->pNewNPCData[npc_id].pName, pParty->pHirelings[1].pName)) ) + { + //v607 = _v734; + //++_v734; + achieved_awards[hired_npc++] = (AwardType)(npc_id + 3); + } + } + }*/ + if ( pCastSpell->uPlayerID_2 != 4 && pCastSpell->uPlayerID_2 != 5 + || achieved_awards[pCastSpell->uPlayerID_2 - 4] <= 0 || achieved_awards[pCastSpell->uPlayerID_2 - 4] >= 3 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_A = 1; + pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_B = 0; + pParty->pHirelings[achieved_awards[pCastSpell->uPlayerID_2 - 4] - 1].evt_C = pIconsFrameTable->GetIconAnimLength(pIconsFrameTable->FindIcon("spell96")); + for ( uint pl_id = 0; pl_id < 4; pl_id++ ) + { + pParty->pPlayers[pl_id].sHealth = pParty->pPlayers[pl_id].GetMaxHealth(); + pParty->pPlayers[pl_id].sMana = pParty->pPlayers[pl_id].GetMaxMana(); + } + v613 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) + v613 = &pIndoor->dlv; + v613->uReputation += 15; + if ( v613->uReputation > 10000 ) + v613->uReputation = 10000; + spell_sound_flag = true; + break; + } + case SPELL_DARK_PAIN_REFLECTION://Отражение боли + { + switch (skill_level) + { + case 1: duration = 300 * (spell_level + 12); break; + case 2: duration = 300 * (spell_level + 12); break; + case 3: duration = 300 * (spell_level + 12); break; + case 4: duration = 900 * (spell_level + 4); break; + default: + assert(false); + } + amount = spell_level + 5; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + if ( skill_level != 3 && skill_level != 4 ) + { + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2); + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); + spell_sound_flag = true; + break; + } + for ( uint pl_id = 0; pl_id < 4; pl_id++ ) + { + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id); + pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0); + } + spell_sound_flag = true; + break; + } + case SPELL_DARK_SOULDRINKER://Испить душу + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetIndoorCamera(); + int mon_num = pRenderer->_46А6АС_GetActorsInViewport((signed __int64)pGame->pIndoorCameraD3D->GetPickDepth()); + v707.x = 0; + v707.y = 0; + v707.z = 0; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->uSpellID; + pSpellSprite.spell_level = spell_level; + pSpellSprite.spell_skill = skill_level; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + amount = 0; + if ( mon_num > 0 ) + { + amount = (mon_num * (7 * spell_level + 25)); + for ( uint mon_id = 0; mon_id < mon_num; mon_id++ ) + { + pSpellSprite.vPosition.x = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.x; + pSpellSprite.vPosition.y = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.y; + pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[mon_id]].vPosition.z - + (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[mon_id]].uActorHeight * -0.8); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[mon_id]); + DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[mon_id], &v707); + } + } + int pl_num = 0; + int pl_array[4]; + for ( uint pl_id = 1; pl_id <= 4; ++pl_id ) + { + if ( !pPlayers[pl_id]->pConditions[Condition_Sleep] && !pPlayers[pl_id]->pConditions[Condition_Paralyzed] + && !pPlayers[pl_id]->pConditions[Condition_Unconcious] && !pPlayers[pl_id]->pConditions[Condition_Dead] + && !pPlayers[pl_id]->pConditions[Condition_Pertified] && !pPlayers[pl_id]->pConditions[Condition_Eradicated] ) + { + pl_array[pl_num++] = pl_id; + } + } + for ( uint j = 0; j < pl_num; j++ ) + { + pPlayers[pl_array[j]]->sHealth += (signed __int64)((double)(signed int)amount / (double)pl_num); + if ( pPlayers[pl_array[j]]->sHealth > pPlayers[pl_array[j]]->GetMaxHealth()) + pPlayers[pl_array[j]]->sHealth = pPlayers[pl_array[j]]->GetMaxHealth(); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[j]); + } + pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 64); + spell_sound_flag = true; + break; + } + case SPELL_DARK_ARMAGEDDON://Армагеддон + { + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + if ( skill_level == 4) + amount = 4; + else + amount = 3; + if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->uSpellID = 0; + continue; + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pParty->armageddon_timer = 256; + pParty->armageddonDamage = spell_level; + ++pPlayer->uNumArmageddonCasts; + if ( pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->pending_actions; + for ( uint i = 0; i < 50; i++ ) + { + v642 = rand() % 4096 - 2048; + v643 = rand(); + v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, pParty->vPosition.y + (v643 % 4096 - 2048), &v710, 0); + sub_42F7EB_DropItemAt(4070, v642 + pParty->vPosition.x, pParty->vPosition.y + (v643 % 4096 - 2048), v732 + 16, rand() % 500 + 500, 1, 0, 0, 0); + } + spell_sound_flag = true; + break; + } + default: + break; + } + if ( pCastSpell->uFlags & 0x20 ) + { + if ( spell_sound_flag ) + pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); + } + else + { + if ( sRecoveryTime < 0 ) + sRecoveryTime = 0; + if ( pParty->bTurnBasedModeOn ) + { + //v645 = sRecoveryTime; + pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; + pPlayer->SetRecoveryTime(sRecoveryTime); + if ( !some_active_character ) + pTurnEngine->ApplyPlayerAction(); + } + else + pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); + if ( spell_sound_flag ) + { + pPlayer->PlaySound(SPEECH_49, 0); + //if ( spell_sound_flag ) + pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->uSpellID], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); + } + } + pCastSpell->uSpellID = 0; + spell_level = v723; + continue; } } diff -r 4842f58715ea -r d0e321190c86 LOD.cpp --- a/LOD.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/LOD.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -1668,7 +1668,10 @@ else pFile = fopen(pFilename, "rb+"); if (!pFile) + { + __debugbreak(); return false;// возможно файл не закрыт, поэтому не открывается + } strcpy(pLODName, pFilename); fread(&header, sizeof(LOD::FileHeader), 1, pFile); @@ -1774,7 +1777,7 @@ if ( pFile ) { strcpy(pLODName, pFilename); - fread(&header, sizeof(LOD::FileHeader), 1u, pFile); + fread(&header, sizeof(LOD::FileHeader), 1, pFile); pRoot = (LOD::Directory *)malloc(160); if ( pRoot ) { diff -r 4842f58715ea -r d0e321190c86 Party.cpp --- a/Party.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/Party.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -757,7 +757,7 @@ if ( pPlayer->classType == PLAYER_CLASS_LICH ) { have_vessels_soul = false; - for ( uint i = 0; i < 138; i++ ) + for ( uint i = 0; i < 126; i++ ) { if ( pPlayer->pInventoryItemList[i].uItemID == ITEM_LICH_JAR_FULL && pPlayer->pInventoryItemList[i].uHolderPlayer == pPlayerID + 1 ) have_vessels_soul = true; diff -r 4842f58715ea -r d0e321190c86 Player.cpp --- a/Player.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/Player.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -4014,6 +4014,13 @@ } } + memset(&pEquipment, 0, sizeof(PlayerEquipment)); + pInventoryMatrix.fill(0); + for (uint i = 0; i < 126; ++i) + pInventoryItemList[i].Reset(); + for (uint i = 0; i < 12; ++i) + pEquippedItems[i].Reset(); + sHealth = GetMaxHealth(); sMana = GetMaxMana(); } diff -r 4842f58715ea -r d0e321190c86 Render.cpp --- a/Render.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/Render.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -8656,7 +8656,7 @@ { if ( next_vertices_flag ) { - //t = neer_clip - v0.x / v1.x - v0.x (формула получения точки пересечения отрезка с плоскостью) + //t = near_clip - v0.x / v1.x - v0.x (формула получения точки пересечения отрезка с плоскостью) t = (8.0 - array_50AC10[i].vWorldViewPosition.x) / (array_50AC10[i + 1].vWorldViewPosition.x - array_50AC10[i].vWorldViewPosition.x); array_507D30[out_num_vertices].vWorldViewPosition.y = (array_50AC10[i + 1].vWorldViewPosition.y - array_50AC10[i].vWorldViewPosition.y) * t + array_50AC10[i].vWorldViewPosition.y; array_507D30[out_num_vertices].vWorldViewPosition.z = (array_50AC10[i + 1].vWorldViewPosition.z - array_50AC10[i].vWorldViewPosition.z) * t + array_50AC10[i].vWorldViewPosition.z; diff -r 4842f58715ea -r d0e321190c86 UI/UIPopup.cpp --- a/UI/UIPopup.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/UI/UIPopup.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -1278,10 +1278,11 @@ 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); + int skill_level = SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 12]); + spell_info_window.DrawTitleText(pFontComic, 12, 75, 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); + pSpellDatas[spell_index + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage + 1].mana_per_skill[skill_level - 1]); + spell_info_window.DrawTitleText(pFontComic, 12, 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; diff -r 4842f58715ea -r d0e321190c86 mm7_2.cpp --- a/mm7_2.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/mm7_2.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -4200,7 +4200,7 @@ uCPUSpeed = Rect.bottom;*/ uCPUSpeed = 2048; // about 2GHz - //constructors(); + constructors(); if (!MM7_Initialize(640, 480)) { diff -r 4842f58715ea -r d0e321190c86 mm7_7.cpp --- a/mm7_7.cpp Thu Jan 30 22:09:10 2014 +0100 +++ b/mm7_7.cpp Thu Jan 30 22:11:28 2014 +0100 @@ -25,7 +25,7 @@ dword_4F8580[0] = 1; return result; */ - __debugbreak();//Ritor1 + //__debugbreak();//Ritor1 for( int i = 0; i < 62; i++ ) { dword_4F8580[i] = 0; @@ -37,7 +37,7 @@ //----- (00423B4A) -------------------------------------------------------- void sub_423B4A() { - __debugbreak();//Ritor1 + //__debugbreak();//Ritor1 for ( uint i = 0; i < 50; i++ ) array_507D30[i].flt_2C = 0.0; }