Mercurial > mm7
changeset 2059:f9698295c0bd
AttackerInfo, MerchandiseTest
author | Ritor1 |
---|---|
date | Sun, 01 Dec 2013 23:43:03 +0600 |
parents | e249bd483311 |
children | 72177f3603da |
files | Actor.cpp OSAPI.cpp Player.cpp TurnEngine.cpp UI/UIPopup.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp mm7_data.h stru298.h |
diffstat | 12 files changed, 175 insertions(+), 226 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/Actor.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -2203,7 +2203,7 @@ v7->uYawAngle = stru_5C6E00->Atan2( pParty->vPosition.x + (int)fixpoint_mul(stru_5C6E00->Cos(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.x, - pParty->vPosition.y + (int)fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); + pParty->vPosition.y + (int)fixpoint_mul(stru_5C6E00->Sin(v18 + stru_5C6E00->uIntegerPi + v10->uYawAngle), v10->uDistanceXZ) - v7->vPosition.y); if ( uActionLength ) v7->uCurrentActionLength = uActionLength; else @@ -3097,7 +3097,7 @@ else if ( pActor->uAIState == AttackingMelee ) { v35 = pActor->special_ability_use_check(actor_id); - AgressorAtackInfo.Add( + AttackerInfo.Add( a1, 5120, pActor->vPosition.x,
--- a/OSAPI.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/OSAPI.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -25,6 +25,7 @@ pVersion = new OSVersion; { + Log::Warning(L"OS init: ok"); extern bool MM_Main(const wchar_t *pCmdLine);
--- a/Player.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/Player.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -4384,6 +4384,7 @@ if ( new_mana_val > playerAffected->GetMaxMana() ) new_mana_val = playerAffected->GetMaxMana(); playerAffected->PlaySound(SPEECH_36, 0); + playerAffected->sMana = new_mana_val; break; case 224: //Cure Weakness playerAffected->pConditions[Condition_Weak] = 0i64;
--- a/TurnEngine.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/TurnEngine.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -728,7 +728,7 @@ { case AIState::AttackingMelee: v19 = pActors[v4].special_ability_use_check(v4); - AgressorAtackInfo.Add( v28->uPackedID, 5120, v5->vPosition.x, v5->vPosition.y, v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), v19, 1); + AttackerInfo.Add( v28->uPackedID, 5120, v5->vPosition.x, v5->vPosition.y, v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), v19, 1); Actor::AI_Stand(v4, a2a, 0, &a4); break; case AIState::AttackingRanged1: @@ -768,7 +768,7 @@ } } -// 50FE08: using guessed type stru298 AgressorAtackInfo; +// 50FE08: using guessed type stru298 AttackerInfo; //----- (0040680F) -------------------------------------------------------- void stru262_TurnBased::AI_Action_( int queue_index )
--- a/UI/UIPopup.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/UI/UIPopup.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -467,6 +467,9 @@ bool monster_full_informations = false; static Actor pMonsterInfoUI_Doll; + if ( !uActiveCharacter ) // + uActiveCharacter = 1; + /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) { bMonsterInfoUI_bDollInitialized |= 1u;
--- a/mm7_2.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/mm7_2.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -5232,7 +5232,7 @@ pSpriteObjects[uLayingItemID].vVelocity.x = v32; pSpriteObjects[uLayingItemID].vVelocity.y = v32; pSpriteObjects[uLayingItemID].vVelocity.z = v32; - AgressorAtackInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) @@ -5254,7 +5254,7 @@ pSpriteObjects[uLayingItemID].vVelocity.x = v32; pSpriteObjects[uLayingItemID].vVelocity.y = v32; pSpriteObjects[uLayingItemID].vVelocity.z = v32; - AgressorAtackInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) @@ -5275,7 +5275,7 @@ pSpriteObjects[uLayingItemID].vVelocity.x = v32; pSpriteObjects[uLayingItemID].vVelocity.y = v32; pSpriteObjects[uLayingItemID].vVelocity.z = v32; - AgressorAtackInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) @@ -5621,7 +5621,7 @@ pSpriteObjects[uLayingItemID].vVelocity.y = v66; pSpriteObjects[uLayingItemID].vVelocity.x = v66; pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; - AgressorAtackInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) v78 = 0; else @@ -5722,7 +5722,7 @@ pSpriteObjects[uLayingItemID].vVelocity.y = v66; pSpriteObjects[uLayingItemID].vVelocity.x = v66; pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; - AgressorAtackInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) v78 = 0; else @@ -5971,7 +5971,7 @@ v40 = pSpriteObjects[uLayingItemID].vPosition.x; pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; v147 = v38; - AgressorAtackInfo.Add(v38, 512, v40, v39, v37, 0, 0); + AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); @@ -6016,7 +6016,7 @@ pSpriteObjects[uLayingItemID].vVelocity.x = v32; pSpriteObjects[uLayingItemID].vVelocity.y = v32; pSpriteObjects[uLayingItemID].vVelocity.z = v32; - AgressorAtackInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) @@ -6039,7 +6039,7 @@ pSpriteObjects[uLayingItemID].vVelocity.x = v32; pSpriteObjects[uLayingItemID].vVelocity.y = v32; pSpriteObjects[uLayingItemID].vVelocity.z = v32; - AgressorAtackInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) @@ -6061,7 +6061,7 @@ pSpriteObjects[uLayingItemID].vVelocity.x = v32; pSpriteObjects[uLayingItemID].vVelocity.y = v32; pSpriteObjects[uLayingItemID].vVelocity.z = v32; - AgressorAtackInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
--- a/mm7_4.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/mm7_4.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -3411,7 +3411,7 @@ } //----- (004BDAAF) -------------------------------------------------------- -bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx) +bool MerchandiseTest(ItemGen *item, int _2da_idx) { int v6; // edx@8 int v7; // edx@9 @@ -3423,28 +3423,28 @@ if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->IsStolen()) - return 0; + return false; switch( p2DEvents[_2da_idx - 1].uType ) { case BuildingType_WeaponShop: { - test = item->GetItemEquipType() <= 2; + test = item->GetItemEquipType() <= EQUIP_BOW; break; } case BuildingType_ArmorShop: { - test = item->GetItemEquipType() >= 3; + test = item->GetItemEquipType() >= EQUIP_ARMOUR && item->GetItemEquipType() <= EQUIP_BOOTS; break; } case BuildingType_MagicShop: { - test = item->GetPlayerSkillType() == 38 || item->GetItemEquipType() == 16; + test = item->GetPlayerSkillType() == PLAYER_SKILL_MISC || item->GetItemEquipType() == EQIUP_ANY; break; } case BuildingType_AlchemistShop: { - test = item->GetItemEquipType() == 13 || item->GetItemEquipType() == 14 - || (item->GetItemEquipType() > 14 && !(item->GetItemEquipType() != 17 + test = item->GetItemEquipType() == EQUIP_REAGENT || item->GetItemEquipType() == EQUIP_POTION + || (item->GetItemEquipType() > EQUIP_POTION && !(item->GetItemEquipType() != EQUIP_MESSAGE_SCROLL || (signed int)item->uItemID < 740) && item->uItemID != 771); break; } @@ -3455,54 +3455,4 @@ } } return test; -/* - if ( p2DEvents[a2 - 1].uType == 1 ) - { - v11 = __OFSUB__(v5, 2); - v9 = v5 == 2; - v10 = v5 - 2 < 0; - goto LABEL_23; - } - if ( p2DEvents[a2 - 1].uType > 2 ) - { - if ( p2DEvents[a2 - 1].uType == 3 ) - { - if ( pItemsTable->pItems[v4].uSkillType != 38 ) - return v5 == 16; - return 1; - } - if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 ) - return 0; - if ( p2DEvents[a2 - 1].uType == 4) - { - if ( v5 < 13 ) - return 0; - if ( v5 <= 14 ) - return 1; - if ( v5 != 17 || (signed int)v3 < 740 ) - return 0; - v11 = __OFSUB__(v3, 771); - v9 = v3 == 771; - v10 = ((v3 - 771) & 0x80000000u) != 0; -LABEL_23: - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) - return 0; - return 1; - } - } - if ( p2DEvents[a2 - 1].uType == 2 ) - { - if ( v5 >= 3 ) - { - v11 = __OFSUB__(v5, 9); - v9 = v5 == 9; - v10 = v5 - 9 < 0; - goto LABEL_23; - } - } - return 0; -*/ -} - - - +} \ No newline at end of file
--- a/mm7_5.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/mm7_5.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -55,12 +55,12 @@ //----- (00438F8F) -------------------------------------------------------- void area_of_effect__damage_evaluate() { - int v2; // ecx@3 + int attacker_type; // ecx@3 signed int v3; // eax@3 - unsigned int victim_id; // edi@6 - int victim_type; // eax@6 + unsigned int target_id; // edi@6 + int target_type; // eax@6 int v10; // edi@8 - Vec3_int_ agressor_coord; // ST04_12@9 + Vec3_int_ attacker_coord; // ST04_12@9 int v12; // ST0C_4@10 int v15; // edx@15 int v19; // edi@15 @@ -71,149 +71,145 @@ int v32; // eax@29 int v33; // ST24_4@29 SpriteObject *v36; // [sp+0h] [bp-28h]@0 - int agressor_id; // [sp+10h] [bp-18h]@1 + int attacker_id; // [sp+10h] [bp-18h]@1 int v44; // [sp+14h] [bp-14h]@15 - Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 + //Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 int a1; // [sp+20h] [bp-8h]@8 int v48; // [sp+24h] [bp-4h]@8 - if ( AgressorAtackInfo.count > 0 ) + + for ( attacker_id = 0; attacker_id < AttackerInfo.count; ++attacker_id ) { - pVelocity = &AgressorAtackInfo.vec_4B4; - for ( agressor_id = 0; agressor_id < AgressorAtackInfo.count; ++agressor_id ) - { - v2 = PID_TYPE(AgressorAtackInfo.pIDs[agressor_id]); - v3 = PID_ID(AgressorAtackInfo.pIDs[agressor_id]); + attacker_type = PID_TYPE(AttackerInfo.pIDs[attacker_id]); + v3 = PID_ID(AttackerInfo.pIDs[attacker_id]); - if ( v2 == 2 ) - { - v36 = &pSpriteObjects[v3]; - v2 = PID_TYPE(pSpriteObjects[v3].spell_caster_pid); - v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid); - } + if ( attacker_type == 2 ) + { + v36 = &pSpriteObjects[v3]; + attacker_type = PID_TYPE(pSpriteObjects[v3].spell_caster_pid); + v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid); + } - if ( AgressorAtackInfo.field_3EC[agressor_id] & 1 ) + if ( AttackerInfo.field_3EC[attacker_id] & 1 ) + { + target_id = PID_ID(ai_near_actors_targets_pid[v3]); + target_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3; + if ( target_type ) { - victim_id = PID_ID(ai_near_actors_targets_pid[v3]); - victim_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3; - if ( victim_type ) + if ( target_type == 1 )//party damage from monsters(повреждения группе от монстров) { - if ( victim_type == 1 )//party damage from monsters(повреждения группе от монстров) + v10 = pParty->vPosition.y - AttackerInfo.pYs[attacker_id]; + a1 = pParty->vPosition.x - AttackerInfo.pXs[attacker_id]; + v48 = v10; + 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])) + < (unsigned int)((AttackerInfo.field_324[attacker_id] + 32) * (AttackerInfo.field_324[attacker_id] + 32)) ) { - v10 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id]; - a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id]; - v48 = v10; - if ( a1 * a1 + v10 * v10 - + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id])) - * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id])) - < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) ) - { - agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; - agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; - agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; - if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) ) - DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, stru_50C198.which_player_to_attack(&pActors[v3])); - } + attacker_coord.x = AttackerInfo.pXs[attacker_id]; + attacker_coord.y = AttackerInfo.pYs[attacker_id]; + attacker_coord.z = AttackerInfo.pZs[attacker_id]; + if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) ) + DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], stru_50C198.which_player_to_attack(&pActors[v3])); } } - else//Actor damage from monsters(повреждение местного жителя) + } + else//Actor damage from monsters(повреждение местного жителя) + { + if ( SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 + || SHIDWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 + && LODWORD(pActors[target_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) + || pActors[target_id].CanAct() ) { - if ( SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 - || SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 - && LODWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) - || pActors[victim_id].CanAct() ) + v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id]; + a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id]; + v44 = pActors[target_id].vPosition.z; + v19 = AttackerInfo.pYs[attacker_id] + pActors[target_id].uActorRadius; + v48 = v15; + if ( a1 * a1 + v15 * v15 + (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) + * (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) ) { - v15 = pActors[victim_id].vPosition.y - AgressorAtackInfo.pYs[agressor_id]; - a1 = pActors[victim_id].vPosition.x - AgressorAtackInfo.pXs[agressor_id]; - v44 = pActors[victim_id].vPosition.z; - v19 = AgressorAtackInfo.pYs[agressor_id] + pActors[victim_id].uActorRadius; - v48 = v15; - if ( a1 * a1 + v15 * v15 + (pActors[victim_id].vPosition.z + (pActors[victim_id].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]) - * (pActors[victim_id].vPosition.z + (pActors[victim_id].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]) < (unsigned int)(v19 * v19) ) + attacker_coord.x = AttackerInfo.pXs[attacker_id]; + attacker_coord.y = AttackerInfo.pYs[attacker_id]; + attacker_coord.z = AttackerInfo.pZs[attacker_id]; + if ( sub_407A1C(pActors[target_id].vPosition.x, pActors[target_id].vPosition.y, pActors[target_id].vPosition.z + 50, attacker_coord) ) { - agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; - agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; - agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; - if ( sub_407A1C(pActors[victim_id].vPosition.x, pActors[victim_id].vPosition.y, pActors[victim_id].vPosition.z + 50, agressor_coord) ) - { - Vec3_int_::Normalize(&a1, &v48, &v44); - pVelocity->x = a1; - pVelocity->y = v48; - pVelocity->z = v44; - ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], victim_id, pVelocity, AgressorAtackInfo.field_450[agressor_id]); - } + Vec3_int_::Normalize(&a1, &v48, &v44); + 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]); } } } } - else //damage from spells(повреждения от заклов(метеоритный дождь)) - { - v23 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id]; - v24 = ((signed int)pParty->uPartyHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]; - a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id]; - v48 = v23; - if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) ) - {//party damage (повреждения группе) - agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; - agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; - agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; - if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) ) + } + else //damage from spells(повреждения от заклов(метеоритный дождь)) + { + 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; + 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]; + attacker_coord.y = AttackerInfo.pYs[attacker_id]; + attacker_coord.z = AttackerInfo.pZs[attacker_id]; + if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, attacker_coord) ) + { + for ( uint i = 0; i < 4; ++i ) { - for ( uint i = 0; i < 4; ++i ) - { - if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead])) - && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] ) - DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, i); - } + if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead])) + && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] ) + DamagePlayerFromMonster(AttackerInfo.pIDs[attacker_id], AttackerInfo.field_450[attacker_id], &AttackerInfo.vec_4B4[attacker_id], i); } } - if ( (signed int)uNumActors > 0 ) - {//actors damage(повреждения другим участникам) - for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID ) + } + if ( (signed int)uNumActors > 0 ) + {//actors damage(повреждения другим участникам) + for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID ) + { + if ( pActors[actorID].CanAct() ) { - if ( pActors[actorID].CanAct() ) + v30 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id]; + a1 = pActors[actorID].vPosition.x - AttackerInfo.pXs[attacker_id]; + v31 = pActors[actorID].vPosition.z; + v48 = v30; + v44 = pActors[actorID].vPosition.z; + v32 = (pActors[actorID].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]; + v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id]; + if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) { - v30 = pActors[actorID].vPosition.y - AgressorAtackInfo.pYs[agressor_id]; - a1 = pActors[actorID].vPosition.x - AgressorAtackInfo.pXs[agressor_id]; - v31 = pActors[actorID].vPosition.z; - v48 = v30; - v44 = pActors[actorID].vPosition.z; - v32 = (pActors[actorID].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]; - v33 = pActors[actorID].uActorRadius + AgressorAtackInfo.pYs[agressor_id]; - if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) + attacker_coord.x = AttackerInfo.pXs[attacker_id]; + attacker_coord.y = AttackerInfo.pYs[attacker_id]; + attacker_coord.z = AttackerInfo.pZs[attacker_id]; + if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, attacker_coord) ) { - agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; - agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; - agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; - if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, agressor_coord) ) + Vec3_int_::Normalize(&a1, &v48, &v44); + AttackerInfo.vec_4B4[attacker_id].x = a1; + AttackerInfo.vec_4B4[attacker_id].y = v48; + AttackerInfo.vec_4B4[attacker_id].z = v44; + switch ( attacker_type ) { - Vec3_int_::Normalize(&a1, &v48, &v44); - pVelocity->x = a1; - pVelocity->y = v48; - pVelocity->z = v44; - switch ( v2 ) - { - case OBJECT_Player: - DamageMonsterFromParty(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity); - break; - case OBJECT_Actor: - if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) ) - ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity, v36->field_61); - break; - case OBJECT_Item: - sub_43B057(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity); - break; - } + case OBJECT_Player: + DamageMonsterFromParty(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]); + 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); + break; + case OBJECT_Item: + sub_43B057(AttackerInfo.pIDs[attacker_id], actorID, &AttackerInfo.vec_4B4[attacker_id]); + break; } } } } } } - ++pVelocity; } } - AgressorAtackInfo.count = 0; + AttackerInfo.count = 0; } @@ -339,13 +335,13 @@ } //----- (0043B1B0) -------------------------------------------------------- -void ActorDamageFromMonster(signed int agressor_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) +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 + //Actor *v7; // esi@4 + //Actor *v8; // edi@4 char v9; // zf@5 __int64 v10; // qax@8 signed __int16 v11; // cx@9 @@ -357,81 +353,79 @@ int v18; // [sp+20h] [bp+Ch]@34 v4 = 0; - v17 = agressor_id; - if ( PID_TYPE(agressor_id) == OBJECT_Item) + v17 = attacker_id; + if ( PID_TYPE(attacker_id) == OBJECT_Item) { - v4 = pSpriteObjects[PID_ID(agressor_id)].field_60_distance_related_prolly_lod; - v17 = pSpriteObjects[PID_ID(agressor_id)].spell_caster_pid; + 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) { - v7 = &pActors[actor_id]; - v8 = &pActors[PID_ID(v17)]; v6 = pActors[actor_id].IsNotAlive(); if ( !v6 ) { - v9 = v7->uAIState == 7; - v7->uLastCharacterIDToHit = v17; + v9 = pActors[actor_id].uAIState == 7; + pActors[actor_id].uLastCharacterIDToHit = v17; if ( v9 ) - BYTE2(v7->uAttributes) |= 2u; - v6 = v8->_4273BB_DoesHitOtherActor(v7, v4, 0); + BYTE2(pActors[actor_id].uAttributes) |= 2u; + v6 = pActors[PID_ID(v17)]._4273BB_DoesHitOtherActor(&pActors[actor_id], v4, 0); if ( v6 ) { - v10 = (unsigned int)v8->_43B3E0_CalcDamage(a4); - if ( (signed __int64)v8->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 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 = v8->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; + v11 = pActors[PID_ID(v17)].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; if ( v11 ) v10 = (signed int)v10 / (unsigned __int16)v11; } - if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10) - && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10) - || LODWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) ) + 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) ) { if ( a4 - HIDWORD(v10) == 1 ) { - v12 = v8->pMonsterInfo.uAttack2Type; - if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10) - && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10) - || LODWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) ) + 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 = v7->pMonsterInfo.uSpell1ID; + v13 = pActors[actor_id].pMonsterInfo.uSpell1ID; } else { if ( a4 - HIDWORD(v10) != 3 ) { if ( a4 - HIDWORD(v10) == 4 ) - v12 = v8->pMonsterInfo.field_3C_some_special_attack; + v12 = pActors[PID_ID(v17)].pMonsterInfo.field_3C_some_special_attack; else v12 = 4; LABEL_30: - v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); - v7->sCurrentHP -= v14; + v14 = stru_50C198.CalcMagicalDamageToActor(&pActors[actor_id], v12, v10); + pActors[actor_id].sCurrentHP -= v14; if ( v14 ) { - if ( v7->sCurrentHP > 0 ) + 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)v7->pMonsterInfo.uHP; - if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) + 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(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) + 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; - v7->vVelocity.x = 50 * LOWORD(pVelocity->x); - v7->vVelocity.y = 50 * LOWORD(pVelocity->y); - v7->vVelocity.z = 50 * LOWORD(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); } @@ -441,12 +435,12 @@ } return; } - v13 = v7->pMonsterInfo.uSpell2ID; + v13 = pActors[actor_id].pMonsterInfo.uSpell2ID; } v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); goto LABEL_30; } - v12 = v8->pMonsterInfo.uAttack1Type; + v12 = pActors[PID_ID(v17)].pMonsterInfo.uAttack1Type; goto LABEL_30; } }
--- a/mm7_6.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/mm7_6.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -893,7 +893,7 @@ int id = a1a.Create(0, 0, 0, 0); if (id != -1) - AgressorAtackInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y), + AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y), SLOWORD(a1a.vPosition.z), 0, 0); }
--- a/mm7_data.cpp Sun Dec 01 20:14:32 2013 +0600 +++ b/mm7_data.cpp Sun Dec 01 23:43:03 2013 +0600 @@ -43,7 +43,7 @@ stru123 stru_5E4C90_MapPersistVars; #include "stru298.h" -stru298 AgressorAtackInfo; // weak +stru298 AttackerInfo; // weak #include "Autonotes.h" std::array<Autonote, 196> pAutonoteTxt; // weak
--- a/mm7_data.h Sun Dec 01 20:14:32 2013 +0600 +++ b/mm7_data.h Sun Dec 01 23:43:03 2013 +0600 @@ -1111,7 +1111,7 @@ double __fastcall sub_43AE12(signed int a1); int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4); void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, struct Vec3_int_ *pVelocity); -void ActorDamageFromMonster(signed int agressor_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, signed int a4); +void ActorDamageFromMonster(signed int attacker_id, unsigned int actor_id, struct Vec3_int_ *pVelocity, signed int a4); void CharacterUI_LoadPaperdollTextures(); int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder); bool IsDwarfPresentInParty(bool b); @@ -1202,7 +1202,7 @@ void UI_CreateEndConversationButton(); void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); int HouseDialogPressCloseBtn(); -bool __fastcall MerchandiseTest(ItemGen *item, int _2da_idx); +bool MerchandiseTest(ItemGen *item, int _2da_idx); void UIShop_Buy_Identify_Repair(); bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); void ODM_LoadAndInitialize(const char *pLevelFilename, struct ODMRenderParams *thisa);
--- a/stru298.h Sun Dec 01 20:14:32 2013 +0600 +++ b/stru298.h Sun Dec 01 23:43:03 2013 +0600 @@ -14,8 +14,8 @@ __int16 field_324[100]; char field_3EC[100]; char field_450[100]; - Vec3_int_ vec_4B4; + Vec3_int_ vec_4B4[100]; }; #pragma pack(pop) -extern stru298 AgressorAtackInfo; // weak \ No newline at end of file +extern stru298 AttackerInfo; // weak \ No newline at end of file