Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall CPathFind::FindNodeClosestInRegion(CPathFind *this, int a2, unsigned __int16 region, float a4, float a5, float a6, int pathType, float *a8, char a9, char a10, char a11, int a12)
- {
- CPathFind *v12; // esi@1
- int i; // eax@4
- int v14; // ebp@7
- float *v15; // edi@8
- int v16; // eax@8
- CPathNode *v17; // ecx@9
- float v18; // ST24_4@14
- long double v19; // fst7@14
- long double v20; // fst7@15
- int v21; // [sp+0h] [bp-10h]@8
- float a8a; // [sp+2Ch] [bp+1Ch]@15
- v12 = this;
- if ( this->m_pPathNodes[region] )
- {
- if ( (_BYTE)pathType )
- {
- if ( (unsigned __int8)pathType == 1 )
- {
- i = this->NumVehicleNodes[region]; // start
- pathType = this->NumNodes[region]; // end
- }
- else
- {
- i = pathType; // wrong option - loop will be terminated
- }
- }
- else
- {
- // Scan vehicle nodes.
- i = 0; // start
- pathType = this->NumVehicleNodes[region]; // end
- }
- v14 = i;
- if ( i < pathType )
- {
- v15 = a8;
- v16 = 28 * i;
- v21 = v16;
- do
- {
- v17 = (CPathNode *)((char *)v12->m_pPathNodes[region] + v16);
- if ( (!a9 || !(v17->m_dwFlags[0] & 0x20)) && (!a10 || !(v17->m_dwFlags[1] & 2)) )
- {
- if ( a11 == (unsigned __int8)v17->m_dwFlags[0] >> 7 )
- {
- v18 = (long double)v17->m_posn.x * 0.125;
- v19 = (fabs((long double)v17->m_posn.z * 0.125 - a6) * 3.0
- + fabs((long double)v17->m_posn.y * 0.125 - a5)
- + fabs(v18 - a4))
- * 0.30000001;
- if ( v19 < *v15 )
- {
- a8a = v19;
- v20 = CPathFind::CalcDistToAnyConnectingLinks(v12, v17, SLODWORD(a4), SLODWORD(a5), SLODWORD(a6)) * 0.2
- + a8a;
- if ( v20 < *v15 )
- {
- *v15 = v20;
- *(_WORD *)a2 = region;
- *(_WORD *)(a2 + 2) = v14;
- }
- }
- }
- }
- ++v14;
- v16 = v21 + 28;
- v21 += 28;
- }
- while ( v14 < pathType );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement