Mercurial > mm7
diff mm7_6.cpp @ 2114:68fbaf45ef66
_42FB5C_check_spell cleaned
author | Ritor1 |
---|---|
date | Mon, 23 Dec 2013 17:30:22 +0600 |
parents | f9698295c0bd |
children | c7bf59066842 |
line wrap: on
line diff
--- a/mm7_6.cpp Mon Dec 23 00:48:53 2013 +0600 +++ b/mm7_6.cpp Mon Dec 23 17:30:22 2013 +0600 @@ -60,6 +60,7 @@ int v15; // eax@14 signed int result; // eax@17 + __debugbreak();//Ritor1 v5 = pActor->pMonsterInfo.uAC; v6 = 0; if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 ) @@ -439,11 +440,7 @@ DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED)) - _42FA66_do_explosive_impact( - actor->vPosition.x, - actor->vPosition.y, - actor->vPosition.z + actor->uActorHeight / 2, - 0, 512, uActiveCharacter); + _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter); } else if (bow_idx) { @@ -464,7 +461,6 @@ player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); } - int v34 = 0; if (shooting_wand) return; @@ -529,6 +525,7 @@ int i; // [sp+38h] [bp+Ch]@33 signed int v32; // [sp+3Ch] [bp+10h]@32 + __debugbreak();//Ritor1 v4 = 0; v5 = this; v24 = this; @@ -708,16 +705,11 @@ pSpellObject.spell_id = 0; pSpellObject.field_54 = 0; pSpellObject.uType = uSpriteID; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - pObjectDescID = 0; - else + pObjectDescID = 0; + for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) { - pObjectDescID = 0; - for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) - { - if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) - pObjectDescID = i; - } + if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) + pObjectDescID = i; } pSpellObject.uObjectDescID = pObjectDescID; pSpellObject.vPosition.x = x; @@ -770,52 +762,32 @@ //----- (0042F960) -------------------------------------------------------- void __fastcall sub_42F960_create_object(int x, int y, int z) { - int v3; // ebx@1 - int v4; // edi@1 - signed int v5; // edx@1 - char *v6; // ecx@2 unsigned __int16 v7; // ax@5 signed int v8; // eax@6 signed int v9; // eax@7 - //SpriteObject a1; // [sp+Ch] [bp-70h]@1 - v3 = x; - v4 = y; - SpriteObject a1; // [sp+Ch] [bp-70h]@1 //SpriteObject::SpriteObject(&a1); a1.stru_24.Reset(); - v5 = 0; a1.spell_skill = 0; a1.spell_level = 0; a1.spell_id = 0; a1.field_54 = 0; a1.uType = 800; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_5: - v7 = 0; - } - else + v7 = 0; + for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) { - v6 = (char *)&pObjectList->pObjects->uObjectID; - while ( *(short *)v6 != 800 ) - { - ++v5; - v6 += 56; - if ( v5 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_5; - } - v7 = v5; + if ( a1.uType == pObjectList->pObjects[i].uObjectID ) + v7 = i; } a1.uObjectDescID = v7; - a1.vPosition.x = v3; - a1.vPosition.y = v4; + a1.vPosition.x = x; + a1.vPosition.y = y; a1.vPosition.z = z; a1.uSoundID = 0; a1.uAttributes = 0; - a1.uSectorID = pIndoor->GetSector(v3, v4, z); + a1.uSectorID = pIndoor->GetSector(x, y, z); a1.uSpriteFrameID = 0; a1.spell_caster_pid = 0; a1.spell_target_pid = 0; @@ -828,23 +800,11 @@ } } - - //----- (0042FA66) -------------------------------------------------------- void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) { - int v6; // edi@1 - int v7; // esi@1 - char *v8; // ecx@2 unsigned __int16 v9; // ax@5 - //int v10; // eax@10 - //signed int result; // eax@11 - //__int16 v12; // ax@12 - //SpriteObject a1a; // [sp+Ch] [bp-74h]@1 - int v14; // [sp+7Ch] [bp-4h]@1 - v6 = a1; - v7 = a2; SpriteObject a1a; // [sp+Ch] [bp-74h]@1 //SpriteObject::SpriteObject(&a1a); a1a.uType = 600; @@ -853,43 +813,27 @@ a1a.spell_id = SPELL_FIRE_FIREBALL; a1a.spell_level = 8; a1a.spell_skill = 3; - v14 = 0; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_5: - v9 = 0; - } - else + v9 = 0; + for ( uint i = 0; i < pObjectList->uNumObjects; ++i ) { - v8 = (char *)&pObjectList->pObjects->uObjectID; - while ( (short)a1a.uType != *(short *)v8 ) - { - ++v14; - v8 += 56; - if ( v14 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_5; - } - v9 = v14; + if ( a1a.uType == pObjectList->pObjects[i].uObjectID ) + v9 = i; } a1a.uObjectDescID = v9; - a1a.vPosition.x = v6; - a1a.vPosition.y = v7; + a1a.vPosition.x = a1; + a1a.vPosition.y = a2; a1a.vPosition.z = a3; a1a.uAttributes = 0; - a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); + a1a.uSectorID = pIndoor->GetSector(a1, a2, a3); a1a.uSpriteFrameID = 0; a1a.spell_target_pid = 0; a1a.field_60_distance_related_prolly_lod = 0; a1a.uFacing = 0; a1a.uSoundID = 0; if ( a6 >= 1 || a6 <= 4 ) - { a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); - } else - { a1a.spell_caster_pid = 0; - } int id = a1a.Create(0, 0, 0, 0); if (id != -1) @@ -898,63 +842,22 @@ } //----- (0042FB5C) -------------------------------------------------------- -bool _42FB5C_check_spell(signed int a1) +bool _42FB5C_check_spell(signed int spell_id) { - int v1; // ecx@3 - int v2; // ecx@4 - int v3; // ecx@5 - int v4; // ecx@6 - int v5; // ecx@7 - int v6; // ecx@8 - char v7; // zf@9 - - if ( a1 > 39 ) + if ( spell_id > 39 ) { - if ( a1 > 77 ) - { - if ( a1 == 80 ) - return 0; - if ( a1 > 84 ) - { - if ( a1 <= 86 ) - return 0; - v7 = a1 == 95; - goto LABEL_20; - } - } - else - { - if ( a1 == 77 ) - return 0; - if ( a1 >= 46 ) - { - if ( a1 <= 47 || a1 == 51 ) - return 0; - v7 = a1 == 73; - goto LABEL_20; - } - } - return 1; + if ( spell_id == SPELL_SPIRIT_BLESS || spell_id == SPELL_SPIRIT_FATE || spell_id == SPELL_SPIRIT_HEROISM || spell_id == SPELL_BODY_HAMMERHANDS + || spell_id == SPELL_BODY_POWER_CURE ||spell_id == SPELL_LIGHT_DISPEL_MAGIC || spell_id == SPELL_LIGHT_DAY_OF_PROTECTION + || spell_id == SPELL_LIGHT_HOUR_OF_POWER || spell_id == SPELL_DARK_PAIN_REFLECTION) + return false; + return true; } - if ( a1 == 39 || (v1 = a1 - 2) == 0 ) - return 1; - v2 = v1 - 3; - if ( !v2 ) - return 0; - v3 = v2 - 1; - if ( !v3 || (v4 = v3 - 3) == 0 ) - return 1; - v5 = v4 - 8; - if ( !v5 ) - return 0; - v6 = v5 - 1; - if ( !v6 ) - return 1; - v7 = v6 == 20; -LABEL_20: - if ( !v7 ) - return 1; - return 0; + if ( spell_id == SPELL_FIRE_FIRE_BOLT || spell_id == SPELL_FIRE_FIREBALL || spell_id == SPELL_FIRE_METEOR_SHOWER + || spell_id == SPELL_AIR_LIGHNING_BOLT || spell_id == SPELL_EARTH_BLADES ) + return true; + if ( spell_id == SPELL_FIRE_HASTE || spell_id == SPELL_AIR_SHIELD || spell_id == SPELL_EARTH_STONESKIN ) + return false; + return true; } //----- (0042FBDD) -------------------------------------------------------- @@ -977,14 +880,14 @@ void ProcessInputActions() { char v4; // al@9 - char v8; // bl@100 + //char v8; // bl@100 unsigned __int16 v9; // ax@102 - int v10; // eax@103 + int spell_price; // eax@103 char v14; // al@159 unsigned int v15; // eax@168 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 InputAction inputAction; // [sp+0h] [bp-8h]@7 - int v24; // [sp+4h] [bp-4h]@87 + //int v24; // [sp+4h] [bp-4h]@87 pGame->pKeyboardInstance->EnterCriticalSection(); Keyboard* pKeyboard = pGame->pKeyboardInstance; @@ -1208,9 +1111,8 @@ { if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) { - v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); if ( !pParty->bTurnBasedModeOn ) - pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); + pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false) * 2.133333333333333)); CastSpellInfoHelpers::_427D48(); pTurnEngine->ApplyPlayerAction(); } @@ -1244,24 +1146,21 @@ } if ( !uActiveCharacter ) break; - v8 = pPlayers[uActiveCharacter]->uQuickSpell; - if ( !v8 - || bUnderwater - || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? - ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : - (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : - (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : - (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), - v10 > pPlayers[uActiveCharacter]->sMana) ) + v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12]; + if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater + || (( !(HIBYTE(v9) & 1)) ? + ((v9 & 0x80) == 0 ? + ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) : + spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) : + spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana, + spell_price > pPlayers[uActiveCharacter]->sMana) ) { pPartyActionQueue = pPartyActionQueue; pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); break; } else - { - pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); - } + pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0); break; case INPUT_Attack: if (pCurrentScreen != SCREEN_GAME)