# HG changeset patch # User Grumpy7 # Date 1393457278 -3600 # Node ID 4c9fef516e0a5d70f925d6d43319af53c960fa48 # Parent 2e02c384c62be89acd48a0a55c4047ebe6470849 immolation cleaned up a bit diff -r 2e02c384c62b -r 4c9fef516e0a mm7_2.cpp --- a/mm7_2.cpp Wed Feb 26 23:35:46 2014 +0100 +++ b/mm7_2.cpp Thu Feb 27 00:27:58 2014 +0100 @@ -4492,40 +4492,32 @@ //----- (0046A89E) -------------------------------------------------------- -int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3) +int _46A89E_immolation_effect(int* affected, int affectedArrSize, int effectRange) { int v5; // ebx@3 - int v6; // eax@3 - int v7; // ebx@3 - unsigned int v8; // ecx@3 - int v9; // edx@4 - unsigned int v10; // edx@6 - unsigned int v11; // edx@8 - int v13; // ecx@15 int v17; // [sp+Ch] [bp-10h]@3 int v18; // [sp+10h] [bp-Ch]@3 - int v19; // [sp+18h] [bp-4h]@1 - - v19 = 0; - for ( uint i = 0; i < (signed int)uNumActors; ++i ) + int affectedCount; // [sp+18h] [bp-4h]@1 + + affectedCount = 0; + for ( size_t i = 0; i < uNumActors; ++i ) { v5 = abs(pActors[i].vPosition.x - pParty->vPosition.x); v17 = abs(pActors[i].vPosition.y - pParty->vPosition.y); v18 = abs(pActors[i].vPosition.z - pParty->vPosition.z); - if ( int_get_vector_length(v5, v17, v18) <= a3 ) + if ( int_get_vector_length(v5, v17, v18) <= effectRange ) { if ( pActors[i].uAIState != Dead && pActors[i].uAIState != Dying && pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned ) { - __debugbreak();// *(int *)(a1 + 4 * v13) = i; что это такое? - v13 = v19++; - *(int *)(a1 + 4 * v13) = i; - if ( v19 >= a2 - 1 ) + affected[affectedCount] = i; + affectedCount++; + if ( affectedCount >= affectedArrSize ) break; } } } - return v19; + return affectedCount; } //----- (0046BDA8) -------------------------------------------------------- diff -r 2e02c384c62b -r 4c9fef516e0a mm7_4.cpp --- a/mm7_4.cpp Wed Feb 26 23:35:46 2014 +0100 +++ b/mm7_4.cpp Thu Feb 27 00:27:58 2014 +0100 @@ -264,10 +264,10 @@ signed int v10; // eax@15 __int16 *v11; // edx@16 int v12; // eax@20 - int v13; // ebx@20 - unsigned int *v14; // esi@21 - unsigned int v15; // ecx@21 - unsigned int v16; // eax@21 + int numberOfActorsAffected; // ebx@20 + unsigned int v14; // esi@21 + //unsigned int v15; // ecx@21 + //unsigned int v16; // eax@21 int v18; // eax@21 signed int v19; // eax@21 bool recovery_HP; // ebx@25 @@ -277,7 +277,7 @@ int v27; // eax@36 int v28; // eax@37 signed int v31; // ecx@53 - int v41[100]; // [sp+4h] [bp-22Ch]@20 + int actorsAffectedByImmolation[100]; // [sp+4h] [bp-22Ch]@20 SpriteObject a1; // [sp+194h] [bp-9Ch]@15 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15 bool has_dragon_flag; // [sp+210h] [bp-20h]@22 @@ -363,28 +363,22 @@ } a1.uObjectDescID = v10; a1.field_60_distance_related_prolly_lod = 0; - v12 = 8 * pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster; - LOBYTE(v12) = v12 | OBJECT_Player; a1.uAttributes = 0; a1.uSectorID = 0; a1.uSpriteFrameID = 0; - a1.spell_caster_pid = v12; + a1.spell_caster_pid = PID(OBJECT_Player, pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster); a1.uFacing = 0; a1.uSoundID = 0; - v13 = _46A89E_immolation_effect((int)v41, 100, 307); - for ( v9 = 0; v9 < v13; ++v9 ) + numberOfActorsAffected = _46A89E_immolation_effect(actorsAffectedByImmolation, 100, 307); + for ( v9 = 0; v9 < numberOfActorsAffected; ++v9 ) { - v14 = (unsigned int *)&v41[v9]; - v15 = *v14; - v16 = *v14; - a1.vPosition.x = pActors[v16].vPosition.x; - a1.vPosition.y = pActors[v16].vPosition.y; - a1.vPosition.z = pActors[v16].vPosition.z; - v18 = 8 * v15; - LOBYTE(v18) = PID(OBJECT_Actor,v15); - a1.spell_target_pid = v18; + v14 = actorsAffectedByImmolation[v9]; + a1.vPosition.x = pActors[v14].vPosition.x; + a1.vPosition.y = pActors[v14].vPosition.y; + a1.vPosition.z = pActors[v14].vPosition.z; + a1.spell_target_pid = PID(OBJECT_Actor,v14); v19 = a1.Create(0, 0, 0, 0); - DamageMonsterFromParty(PID(OBJECT_Item,v19), *v14, &a3); + DamageMonsterFromParty(PID(OBJECT_Item,v19), v14, &a3); } } diff -r 2e02c384c62b -r 4c9fef516e0a mm7_unsorted_subs.h --- a/mm7_unsorted_subs.h Wed Feb 26 23:35:46 2014 +0100 +++ b/mm7_unsorted_subs.h Thu Feb 27 00:27:58 2014 +0100 @@ -223,7 +223,7 @@ void ShowPopupShopItem(); void RestAndHeal(__int64 uNumMinutes); // idb void GetHouseGoodbyeSpeech(); -int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3); +int _46A89E_immolation_effect(int* affected, int affectedArrSize, int effectRange); unsigned int GetGravityStrength(); void UpdateUserInput_and_MapSpecificStuff(); void BLV_UpdateUserInputAndOther();