Mercurial > mm7
changeset 2313:b75a8f15568d
Слияние
author | Ritor1 |
---|---|
date | Tue, 18 Mar 2014 17:34:33 +0600 |
parents | 4b052671da98 (current diff) 9dbfeda280d7 (diff) |
children | 8e9be4fa33a8 |
files | |
diffstat | 4 files changed, 84 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Tue Mar 18 17:34:26 2014 +0600 +++ b/Actor.cpp Tue Mar 18 17:34:33 2014 +0600 @@ -2591,6 +2591,86 @@ this->uAIState = Removed; } + +//----- (0043B1B0) -------------------------------------------------------- +void Actor::ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) +{ + int v4; // ebx@1 + int dmgToRecv; // qax@8 + signed int v12; // ecx@20 + int finalDmg; // edi@30 + int pushDistance; // [sp+20h] [bp+Ch]@34 + + v4 = 0; + if ( PID_TYPE(attacker_id) == OBJECT_Item) + { + v4 = pSpriteObjects[PID_ID(attacker_id)].field_60_distance_related_prolly_lod; + attacker_id = pSpriteObjects[PID_ID(attacker_id)].spell_caster_pid; + } + if ( PID_TYPE(attacker_id) == OBJECT_Actor) + { + if ( !pActors[actor_id].IsNotAlive() ) + { + pActors[actor_id].uLastCharacterIDToHit = attacker_id; + if ( pActors[actor_id].uAIState == Fleeing ) + pActors[actor_id].uAttributes |= FACE_UNKNOW7; + if ( pActors[PID_ID(attacker_id)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0) ) + { + dmgToRecv = pActors[PID_ID(attacker_id)]._43B3E0_CalcDamage(a4); + if ( pActors[PID_ID(attacker_id)].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) + { + if ( pActors[PID_ID(attacker_id)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower ) + dmgToRecv = dmgToRecv / pActors[PID_ID(attacker_id)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; + } + if ( pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 ) + dmgToRecv = 0; + if ( a4 == 0 ) + v12 = pActors[PID_ID(attacker_id)].pMonsterInfo.uAttack1Type; + else if ( a4 == 1 ) + { + v12 = pActors[PID_ID(attacker_id)].pMonsterInfo.uAttack2Type; + if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > 0 ) + dmgToRecv = dmgToRecv / 2; + } + else if ( a4 == 2 ) + v12 = pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell1ID].uSchool; + else if ( a4 == 3 ) + v12 = pSpellStats->pInfos[pActors[actor_id].pMonsterInfo.uSpell2ID].uSchool; + else if ( a4 == 4 ) + v12 = pActors[PID_ID(attacker_id)].pMonsterInfo.field_3C_some_special_attack; + else + v12 = 4; + finalDmg = pActors[actor_id].CalcMagicalDamageToActor((DAMAGE_TYPE)v12, dmgToRecv); + pActors[actor_id].sCurrentHP -= finalDmg; + if ( finalDmg ) + { + if ( pActors[actor_id].sCurrentHP > 0 ) + Actor::AI_Stun(actor_id, attacker_id, 0); + else + Actor::Die(actor_id); + Actor::AggroSurroundingPeasants(actor_id, 0); + pushDistance = 20 * finalDmg / pActors[actor_id].pMonsterInfo.uHP; + if ( pushDistance > 10 ) + pushDistance = 10; + if ( !MonsterStats::BelongsToSupertype(pActors[actor_id].pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) + { + pVelocity->x = (int32)fixpoint_mul(pushDistance, pVelocity->x); + pVelocity->y = (int32)fixpoint_mul(pushDistance, pVelocity->y); + pVelocity->z = (int32)fixpoint_mul(pushDistance, pVelocity->z); + 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, finalDmg); + } + else + Actor::AI_Stun(actor_id, attacker_id, 0); + return; + } + } + } +} + //----- (0044FD29) -------------------------------------------------------- void Actor::SummonMinion( int summonerId ) {
--- a/Actor.h Tue Mar 18 17:34:26 2014 +0600 +++ b/Actor.h Tue Mar 18 17:34:33 2014 +0600 @@ -213,6 +213,7 @@ static void Explode(unsigned int uActorID); static void AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4); static void AI_SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel); + static void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, signed int a4); static unsigned short GetObjDescId( int spellId );
--- a/mm7_5.cpp Tue Mar 18 17:34:26 2014 +0600 +++ b/mm7_5.cpp Tue Mar 18 17:34:33 2014 +0600 @@ -126,7 +126,7 @@ AttackerInfo.vec_4B4[attacker_id].x = a1; AttackerInfo.vec_4B4[attacker_id].y = v48; AttackerInfo.vec_4B4[attacker_id].z = v44; - ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], target_id, &AttackerInfo.vec_4B4[attacker_id], AttackerInfo.field_450[attacker_id]); + Actor::ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], target_id, &AttackerInfo.vec_4B4[attacker_id], AttackerInfo.field_450[attacker_id]); } } } @@ -184,7 +184,7 @@ break; case OBJECT_Actor: if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) ) - ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id], v36->field_61); + Actor::ActorDamageFromMonster(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id], v36->field_61); break; case OBJECT_Item: ItemDamageFromActor(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]); @@ -223,7 +223,7 @@ switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) { case OBJECT_Actor: - ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); + Actor::ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); break; case OBJECT_Player: DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); @@ -304,93 +304,6 @@ } } -//----- (0043B1B0) -------------------------------------------------------- -void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) -{ - int v4; // ebx@1 - int v6; // eax@3 - __int64 v10; // qax@8 - signed int v12; // ecx@20 - int v13; // ecx@22 - int v14; // edi@30 - signed int v17; // [sp+10h] [bp-4h]@1 - int v18; // [sp+20h] [bp+Ch]@34 - - v4 = 0; - v17 = attacker_id; - if ( PID_TYPE(attacker_id) == OBJECT_Item) - { - v4 = pSpriteObjects[PID_ID(attacker_id)].field_60_distance_related_prolly_lod; - v17 = pSpriteObjects[PID_ID(attacker_id)].spell_caster_pid; - } - if ( PID_TYPE(v17) == OBJECT_Actor) - { - v6 = pActors[actor_id].IsNotAlive(); - if ( !v6 ) - { - pActors[actor_id].uLastCharacterIDToHit = v17; - if ( pActors[actor_id].uAIState == Fleeing ) - pActors[actor_id].uAttributes |= FACE_UNKNOW7; - 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 ) - { - 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; - } - if ( SHIDWORD(pActors[actor_id].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10) - && (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) ) - v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type; - else 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 / 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 = pActors[actor_id].CalcMagicalDamageToActor((DAMAGE_TYPE)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 = fixpoint_mul(v18, pVelocity->x); - pVelocity->y = fixpoint_mul(v18, pVelocity->y); - pVelocity->z = fixpoint_mul(v18, pVelocity->z); - 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; - } - } - } -} //----- (0043F515) -------------------------------------------------------- void FindBillboardsLightLevels_BLV()
--- a/mm7_unsorted_subs.h Tue Mar 18 17:34:26 2014 +0600 +++ b/mm7_unsorted_subs.h Tue Mar 18 17:34:33 2014 +0600 @@ -85,7 +85,6 @@ double __fastcall sub_43AE12(signed int a1); int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4); void ItemDamageFromActor(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity); -void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, signed int a4); void CharacterUI_LoadPaperdollTextures(); int GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder); bool IsDwarfPresentInParty(bool b);