Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 5
- CUNIT *__stdcall MedicHeal_TargetAcquire(CUNIT *unitMem)
- {
- CUNIT *result; // eax
- CUNIT *v2; // ebx
- CUNIT *v3; // edi
- CUNIT *v4; // esi
- CSPRITE *v5; // eax
- unsigned int v6; // eax
- CUNIT *j; // edx
- char v8; // bl
- CORDER *v9; // eax
- int v10; // ecx
- CUNIT *v11; // eax
- CORDER *v12; // eax
- int v13; // esi
- int v14; // eax
- unsigned int v15; // edi
- CUNIT *v16; // ebx
- unsigned int v17; // eax
- int v18[1700]; // [esp+8h] [ebp-1AA0h]
- int v19; // [esp+1A98h] [ebp-10h]
- CUNIT *v20; // [esp+1A9Ch] [ebp-Ch]
- unsigned int v21; // [esp+1AA0h] [ebp-8h]
- unsigned int i; // [esp+1AA4h] [ebp-4h]
- v2 = unitMem;
- result = (CUNIT *)TechUseAllowed(unitMem, TECH_Healing, (unsigned __int8)unitMem->owner);
- if ( result )
- {
- if ( unitMem->CAIControl )
- {
- v4 = playerUnitPointers[(unsigned __int8)unitMem->owner];
- v3 = 0;
- for ( i = 0; v4; v4 = v4->playerNext )
- {
- v5 = v4->sprite;
- if ( v5 )
- {
- if ( v4->mainOrderType )
- {
- if ( !(v5->flags & 0x20) )
- {
- v20 = (CUNIT *)v4->statusFlags;
- if ( (unsigned __int8)v20 & 1 )
- {
- if ( !v4->isBeingHealed )
- {
- if ( AI_OrderHeal(v2, v4) )
- {
- if ( !((unsigned int)v20 & USFlag_IsHallucination) )
- {
- if ( !v3 && v4->type == UNI_T_MEDIC )
- v3 = v4;
- if ( unitsdat_SpecialAbilityFlags[(unsigned __int16)v4->type] & USAFlag_Organic )
- {
- v6 = i;
- v18[i] = (int)v4;
- i = v6 + 1;
- }
- }
- }
- v2 = unitMem;
- }
- }
- }
- }
- }
- }
- for ( j = v3; j; j = j->playerNext )
- {
- v8 = j->mainOrderType;
- if ( v8 == -80 || (v9 = j->orderQueueHead) != 0 && v9->orderType == -80 )
- {
- v10 = 0;
- if ( i )
- {
- while ( 1 )
- {
- if ( v8 == -80 )
- {
- v11 = j->mainOrderTargetUnit;
- }
- else
- {
- v12 = j->orderQueueHead;
- v13 = (int)v12->position;
- v11 = (CUNIT *)v12->target;
- v19 = v13;
- }
- if ( v11 == (CUNIT *)v18[v10] )
- break;
- if ( ++v10 >= i )
- goto LABEL_31;
- }
- v18[v10] = 0;
- }
- }
- LABEL_31:
- ;
- }
- v14 = 0;
- v15 = 99999999;
- v20 = 0;
- v21 = 0;
- if ( i )
- {
- do
- {
- v16 = (CUNIT *)v18[v14];
- if ( v16 )
- {
- v17 = getDistanceFast(
- unitMem->sprite->position.x,
- v16->sprite->position.x,
- unitMem->sprite->position.y,
- v16->sprite->position.y);
- if ( v17 < v15 )
- {
- v15 = v17;
- v20 = v16;
- }
- }
- v14 = v21++ + 1;
- }
- while ( v21 < i );
- }
- result = v20;
- }
- else
- {
- result = AI_BestUnit_InBox(160, unitMem, (int (__fastcall *)(_DWORD, _DWORD))Medic_HealTargetProc, unitMem);
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement