Mercurial > mm7
diff mm7_5.cpp @ 2117:c7bf59066842
mm7_4-6 cleaned
author | Ritor1 |
---|---|
date | Mon, 23 Dec 2013 23:38:51 +0600 |
parents | 68fbaf45ef66 |
children | 3eab5530cc94 |
line wrap: on
line diff
--- a/mm7_5.cpp Mon Dec 23 17:30:22 2013 +0600 +++ b/mm7_5.cpp Mon Dec 23 23:38:51 2013 +0600 @@ -100,7 +100,7 @@ { v10 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id]; - v48 = v10; + v48 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; if ( a1 * a1 + v10 * v10 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id])) * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AttackerInfo.pZs[attacker_id])) @@ -149,7 +149,7 @@ v23 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; v24 = ((signed int)pParty->uPartyHeight >> 1) - AttackerInfo.pZs[attacker_id]; a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id]; - v48 = v23; + v48 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) ) {//party damage (повреждения группе) attacker_coord.x = AttackerInfo.pXs[attacker_id]; @@ -250,21 +250,18 @@ //----- (0043AE12) -------------------------------------------------------- double __fastcall sub_43AE12(signed int a1) { - signed int v1; // ST00_4@1 + //signed int v1; // ST00_4@1 signed int v2; // ecx@1 double v3; // st7@1 double result; // st7@6 - v1 = a1; - v2 = 0; - v3 = (double)v1; - do + __debugbreak();//Ritor1 + v3 = (double)a1; + for ( v2 = 0; v2 < 5; ++v2 ) { if ( v3 < flt_4E4A80[v2 + 5] ) break; - ++v2; } - while ( v2 < 5 ); if ( v2 <= 0 || v2 >= 5 ) { if ( v2 ) @@ -273,62 +270,49 @@ result = flt_4E4A80[0]; } else - { result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 1]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; - } return result; } //----- (0043B057) -------------------------------------------------------- void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) { - Actor *pActor; // esi@1 - SpriteObject *v4; // eax@3 - int v5; // ecx@3 int v6; // eax@4 int v7; // edi@4 - unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 - unsigned int a2; // [sp+Ch] [bp-4h]@1 int a2a; // [sp+Ch] [bp-4h]@8 - uActorIDa = uActorID; - pActor = &pActors[uActorID]; - a2 = uObjID; + __debugbreak();//Ritor1 if ( !pActors[uActorID].IsNotAlive() ) { - if ( PID_TYPE(a2) == OBJECT_Item) + if ( PID_TYPE(uObjID) == OBJECT_Item) { - v4 = &pSpriteObjects[PID_ID(a2)]; - v5 = v4->spell_id; - if ( v5 ) + if ( pSpriteObjects[PID_ID(uObjID)].spell_id ) { - v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); - v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); - pActor->sCurrentHP -= v7; + v6 = _43AFE3_calc_spell_damage(pSpriteObjects[PID_ID(uObjID)].spell_id, pSpriteObjects[PID_ID(uObjID)].spell_level, pSpriteObjects[PID_ID(uObjID)].spell_skill, pActors[uActorID].sCurrentHP); + v7 = stru_50C198.CalcMagicalDamageToActor(&pActors[uActorID], 0, v6); + pActors[uActorID].sCurrentHP -= v7; if ( v7 ) { - if ( pActor->sCurrentHP > 0 ) - Actor::AI_Stun(uActorIDa, a2, 0); + if ( pActors[uActorID].sCurrentHP > 0 ) + Actor::AI_Stun(uActorID, uObjID, 0); else - Actor::Die(uActorIDa); - a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; - if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) + Actor::Die(uActorID); + a2a = 20 * v7 / (signed int)pActors[uActorID].pMonsterInfo.uHP; + if ( 20 * v7 / (signed int)pActors[uActorID].pMonsterInfo.uHP > 10 ) a2a = 10; - if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) + if ( !MonsterStats::BelongsToSupertype(pActors[uActorID].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; - pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); - pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); - pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); + pActors[uActorID].vVelocity.x = 50 * LOWORD(pVelocity->x); + pActors[uActorID].vVelocity.y = 50 * LOWORD(pVelocity->y); + pActors[uActorID].vVelocity.z = 50 * LOWORD(pVelocity->z); } - Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); + Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v7); } else - { - Actor::AI_Stun(uActorIDa, a2, 0); - } + Actor::AI_Stun(uActorID, uObjID, 0); } } } @@ -338,17 +322,11 @@ void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) { int v4; // ebx@1 - //SpriteObject *v5; // eax@2 int v6; // eax@3 - //Actor *v7; // esi@4 - //Actor *v8; // edi@4 - //char v9; // zf@5 __int64 v10; // qax@8 - //signed __int16 v11; // cx@9 signed int v12; // ecx@20 int v13; // ecx@22 int v14; // edi@30 - //unsigned int uActorID; // [sp+Ch] [bp-8h]@1 signed int v17; // [sp+10h] [bp-4h]@1 int v18; // [sp+20h] [bp+Ch]@34 @@ -364,17 +342,14 @@ v6 = pActors[actor_id].IsNotAlive(); if ( !v6 ) { - //v9 = pActors[actor_id].uAIState == 7; pActors[actor_id].uLastCharacterIDToHit = v17; if ( pActors[actor_id].uAIState == Fleeing ) BYTE2(pActors[actor_id].uAttributes) |= 2; - //v6 = pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0); if ( pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) ) { v10 = (unsigned int)pActors[PID_ID(v17)]._43B3E0_CalcDamage(a4); if ( (signed __int64)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) { - //v11 = pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; if ( pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower ) v10 = (signed int)v10 / (unsigned __int16)pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; } @@ -382,66 +357,50 @@ && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10) || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) ) LODWORD(v10) = 0; - if ( a4 != HIDWORD(v10) ) + if ( a4 == HIDWORD(v10) ) + v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type; + else if ( a4 - HIDWORD(v10) == 1 ) { - if ( a4 - HIDWORD(v10) == 1 ) - { - v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack2Type; - if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10) - && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10) - || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) ) - LODWORD(v10) = (signed int)v10 >> 1; - goto LABEL_30; - } - if ( a4 - HIDWORD(v10) == 2 ) - { - v13 = pActors[actor_id].pMonsterInfo.uSpell1ID; - } + v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack2Type; + if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10) + && (SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10) + || LODWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) ) + LODWORD(v10) = (signed int)v10 / 2; + } + else if ( a4 - HIDWORD(v10) == 2 ) + v12 = LOBYTE(pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell1ID].uSchool); + else if ( a4 - HIDWORD(v10) == 3 ) + v12 = LOBYTE(pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell2ID].uSchool); + else if ( a4 - HIDWORD(v10) == 4 ) + v12 = pActors[PID_ID(v17)].pMonsterInfo.field_3C_some_special_attack; + else + v12 = 4; + v14 = stru_50C198.CalcMagicalDamageToActor(&pActors[actor_id], v12, v10); + pActors[actor_id].sCurrentHP -= v14; + if ( v14 ) + { + if ( pActors[actor_id].sCurrentHP > 0 ) + Actor::AI_Stun(actor_id, v17, 0); else + Actor::Die(actor_id); + Actor::AggroSurroundingPeasants(actor_id, 0); + v18 = 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP; + if ( 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP > 10 ) + v18 = 10; + if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) { - if ( a4 - HIDWORD(v10) != 3 ) - { - if ( a4 - HIDWORD(v10) == 4 ) - v12 = pActors[PID_ID(v17)].pMonsterInfo.field_3C_some_special_attack; - else - v12 = 4; -LABEL_30: - v14 = stru_50C198.CalcMagicalDamageToActor(&pActors[actor_id], v12, v10); - pActors[actor_id].sCurrentHP -= v14; - if ( v14 ) - { - if ( pActors[actor_id].sCurrentHP > 0 ) - Actor::AI_Stun(actor_id, v17, 0); - else - Actor::Die(actor_id); - Actor::AggroSurroundingPeasants(actor_id, 0); - v18 = 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP; - if ( 20 * v14 / (signed int)pActors[actor_id].pMonsterInfo.uHP > 10 ) - v18 = 10; - if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) - { - pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; - pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; - pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; - pActors[actor_id].vVelocity.x = 50 * LOWORD(pVelocity->x); - pActors[actor_id].vVelocity.y = 50 * LOWORD(pVelocity->y); - pActors[actor_id].vVelocity.z = 50 * LOWORD(pVelocity->z); - } - Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14); - } - else - { - Actor::AI_Stun(actor_id, v17, 0); - } - return; - } - v13 = pActors[actor_id].pMonsterInfo.uSpell2ID; + pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; + pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; + pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; + pActors[actor_id].vVelocity.x = 50 * LOWORD(pVelocity->x); + pActors[actor_id].vVelocity.y = 50 * LOWORD(pVelocity->y); + pActors[actor_id].vVelocity.z = 50 * LOWORD(pVelocity->z); } - v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); - goto LABEL_30; + Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14); } - v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type; - goto LABEL_30; + else + Actor::AI_Stun(actor_id, v17, 0); + return; } } }