Advertisement
Guest User

CNWSCreature__DoListenDetection

a guest
Oct 19th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.67 KB | None | 0 0
  1. signed int __thiscall CNWSCreature__DoListenDetection(int this, int a2, unsigned int a3)
  2. {
  3.   int v3; // edi@1
  4.   int v4; // esi@1
  5.   int v5; // eax@1
  6.   signed int result; // eax@2
  7.   float v7; // ebx@3
  8.   float v8; // ebp@3
  9.   float v9; // ecx@3
  10.   float v10; // edx@3
  11.   float v11; // eax@3
  12.   char v12; // al@4
  13.   long double v13; // fst7@8
  14.   int v14; // eax@10
  15.   long double v15; // fst7@14
  16.   unsigned int v16; // eax@18
  17.   float v17; // ST08_4@18
  18.   int v18; // eax@18
  19.   float v19; // ST14_4@18
  20.   float v20; // ST00_4@18
  21.   float v21; // ST04_4@18
  22.   float v22; // ST08_4@18
  23.   int v23; // eax@18
  24.   int v24; // eax@23
  25.   int v25; // ebx@23
  26.   int v26; // eax@25
  27.   int v27; // eax@28
  28.   int v28; // ebx@28
  29.   int v29; // eax@30
  30.   int v30; // ebx@34
  31.   int v31; // eax@35
  32.   float v32; // edx@35
  33.   int v33; // ecx@35
  34.   int v34; // ST28_4@35
  35.   int v35; // eax@35
  36.   int v36; // ebp@38
  37.   int v37; // eax@38
  38.   char v38; // al@39
  39.   int v39; // ebp@42
  40.   int v40; // eax@42
  41.   int v41; // ebx@51
  42.   int v42; // ebp@51
  43.   int v43; // eax@51
  44.   int v44; // ebp@52
  45.   int v45; // eax@52
  46.   int v46; // ebx@53
  47.   int v47; // eax@59
  48.   int v48; // ebx@59
  49.   signed int v49; // [sp+10h] [bp-40h]@1
  50.   float v50; // [sp+14h] [bp-3Ch]@3
  51.   int v51; // [sp+18h] [bp-38h]@18
  52.   int v52; // [sp+1Ch] [bp-34h]@1
  53.   float v53; // [sp+20h] [bp-30h]@3
  54.   float v54; // [sp+24h] [bp-2Ch]@3
  55.   float v55; // [sp+28h] [bp-28h]@3
  56.   int v56; // [sp+2Ch] [bp-24h]@1
  57.   float v57; // [sp+30h] [bp-20h]@1
  58.   float v58; // [sp+34h] [bp-1Ch]@1
  59.   int v59; // [sp+38h] [bp-18h]@1
  60.   float v60; // [sp+3Ch] [bp-14h]@1
  61.   float v61; // [sp+40h] [bp-10h]@1
  62.   float v62; // [sp+44h] [bp-Ch]@3
  63.   float v63; // [sp+48h] [bp-8h]@3
  64.   float v64; // [sp+4Ch] [bp-4h]@3
  65.   float v65; // [sp+54h] [bp+4h]@21
  66.  
  67.   v3 = a2;
  68.   v5 = *(_DWORD *)(a2 + 2504);
  69.   v4 = this;
  70.   v59 = 0;
  71.   LODWORD(v60) = 0;
  72.   LODWORD(v61) = 0;
  73.   v56 = 0;
  74.   LODWORD(v57) = 0;
  75.   LODWORD(v58) = 0;
  76.   v52 = 1;
  77.   v49 = 0;
  78.   if ( v5 )
  79.     return 0;
  80.   LODWORD(v8) = *(_DWORD *)(this + 120);
  81.   LODWORD(v7) = *(_DWORD *)(this + 124);
  82.   LODWORD(v64) = *(_DWORD *)(this + 128);
  83.   LODWORD(v9) = *(_DWORD *)(a2 + 120);
  84.   LODWORD(v10) = *(_DWORD *)(a2 + 124);
  85.   LODWORD(v11) = *(_DWORD *)(a2 + 128);
  86.   v64 = v64 + 1.0;
  87.   v62 = v8;
  88.   v53 = v9;
  89.   v55 = v11 + 1.0;
  90.   v63 = v7;
  91.   v54 = v10;
  92.   v50 = (v64 - v55) * (v64 - v55) + (v7 - v10) * (v7 - v10) + (v8 - v9) * (v8 - v9);
  93.   if ( a3 || (v12 = *(_BYTE *)(v4 + 2524), !(v12 & 0x24)) && (v12 & 0x10 || v12 & 8 && !(v12 & 2)) )
  94.   {
  95.     v13 = CNWSCreature__DesiredAttackRange(v4, *(_DWORD *)(a2 + 4), 1);
  96.     if ( v50 > (v13 + 1.5) * (v13 + 1.5) )
  97.       return 0;
  98.     v14 = CNWSCreature__GetVisibleListElement(v4, *(_DWORD *)(a2 + 4));
  99.     if ( v14 )
  100.     {
  101.       if ( (*(_BYTE *)(v14 + 4) & 0xC) == 4 )
  102.         return 0;
  103.     }
  104.   }
  105.   if ( *(_DWORD *)(v4 + 1212) )
  106.     v15 = *(float *)(v4 + 2592);
  107.   else
  108.     v15 = *(float *)(v4 + 2588);
  109.   if ( v50 > v15 * v15 )
  110.     return 0;
  111.   v17 = v64;
  112.   v18 = CNWSObject__GetArea((void *)v4);
  113.   CNWSArea__ClearLineOfSight((void *)v18, v8, v7, v17, v53, v54, v55, (int)&v59, (int)&a3, 0x7F000000u, 0x7F000000u, 0);
  114.   v19 = v64;
  115.   v20 = v53;
  116.   v21 = v54;
  117.   v22 = v55;
  118.   v23 = CNWSObject__GetArea((void *)v4);
  119.   CNWSArea__ClearLineOfSight((void *)v23, v20, v21, v22, v8, v7, v19, (int)&v56, (int)&v51, 0x7F000000u, 0x7F000000u, 0);
  120.   v16 = a3;
  121.   if ( a3 == v51 )
  122.   {
  123.     if ( a3 != 2130706432 && v51 != 2130706432 )
  124.     {
  125.       LODWORD(v65) = 1042536203;
  126.       goto LABEL_32;
  127.     }
  128.   }
  129.   else
  130.   {
  131.     if ( a3 != 2130706432 )
  132.     {
  133.       v24 = CServerExoApp__GetGameObject(*(_DWORD *)(g_pAppManager + 4), a3);
  134.       v25 = v24;
  135.       if ( v24 )
  136.       {
  137.         if ( (*(int (__thiscall **)(int))(*(_DWORD *)v24 + 16))(v24) )
  138.         {
  139.           v26 = (*(int (__thiscall **)(int))(*(_DWORD *)v25 + 16))(v25) + 120;
  140.           v59 = *(_DWORD *)v26;
  141.           LODWORD(v60) = *(_DWORD *)(v26 + 4);
  142.           LODWORD(v61) = *(_DWORD *)(v26 + 8);
  143.         }
  144.       }
  145.       v16 = a3;
  146.     }
  147.     if ( v51 != 2130706432 )
  148.     {
  149.       v27 = CServerExoApp__GetGameObject(*(_DWORD *)(g_pAppManager + 4), v16);
  150.       v28 = v27;
  151.       if ( v27 )
  152.       {
  153.         if ( (*(int (__thiscall **)(int))(*(_DWORD *)v27 + 16))(v27) )
  154.         {
  155.           v29 = (*(int (__thiscall **)(int))(*(_DWORD *)v28 + 16))(v28) + 120;
  156.           v56 = *(_DWORD *)v29;
  157.           LODWORD(v57) = *(_DWORD *)(v29 + 4);
  158.           LODWORD(v58) = *(_DWORD *)(v29 + 8);
  159.         }
  160.       }
  161.     }
  162.   }
  163.   v65 = (v58 - v61) * (v58 - v61)
  164.       + (v57 - v60) * (v57 - v60)
  165.       + (*(float *)&v56 - *(float *)&v59) * (*(float *)&v56 - *(float *)&v59);
  166.   if ( v65 <= 0.0 )
  167.   {
  168. LABEL_37:
  169.     v30 = v49;
  170.     goto LABEL_38;
  171.   }
  172. LABEL_32:
  173.   if ( *(_BYTE *)(CNWSObject__GetArea((void *)v4) + 4) & 1 || *(_BYTE *)(CNWSObject__GetArea((void *)v4) + 4) & 2 )
  174.   {
  175.     v31 = *(_DWORD *)(CNWSObject__GetArea((void *)v4) + 408);
  176.     LODWORD(v62) = *(_DWORD *)(v4 + 120);
  177.     LODWORD(v64) = *(_DWORD *)(v4 + 128);
  178.     *(float *)(v31 + 100) = v62;
  179.     LODWORD(v62) = *(_DWORD *)(v4 + 120);
  180.     LODWORD(v32) = *(_DWORD *)(v4 + 124);
  181.     LODWORD(v64) = *(_DWORD *)(v4 + 128);
  182.     v63 = v32;
  183.     *(float *)(v31 + 104) = v32;
  184.     LODWORD(v62) = *(_DWORD *)(v3 + 120);
  185.     LODWORD(v64) = *(_DWORD *)(v3 + 128);
  186.     *(float *)(v31 + 76) = v62;
  187.     LODWORD(v62) = *(_DWORD *)(v3 + 120);
  188.     v33 = *(_DWORD *)(v3 + 128);
  189.     LODWORD(v63) = *(_DWORD *)(v3 + 124);
  190.     LODWORD(v64) = v33;
  191.     *(float *)(v31 + 80) = v63;
  192.     v34 = v31;
  193.     v35 = CNWSObject__GetArea((void *)v4);
  194.     if ( CNWSArea__PlotSoundPath((void *)v35, v34) != 1 )
  195.       return 0;
  196.     v49 = -2;
  197.     goto LABEL_37;
  198.   }
  199.   v30 = -5 * (signed __int64)sqrt(v65);
  200. LABEL_38:
  201.   v36 = *(_DWORD *)(v3 + 3172);
  202.   v37 = (*(int (__thiscall **)(int))(*(_DWORD *)v4 + 16))(v4);
  203.   if ( CNWSCreatureStats__GetSkillRank(v36, 8u, v37, 0)
  204.     && (v38 = *(_BYTE *)(v3 + 1193)) != 0
  205.     && *(_DWORD *)(v3 + 2864) != *(_DWORD *)(v4 + 4) )
  206.   {
  207.     if ( v38 == 1 )
  208.     {
  209.       v39 = *(_DWORD *)(v3 + 3172);
  210.       v40 = (*(int (__thiscall **)(int))(*(_DWORD *)v4 + 16))(v4);
  211.       v30 = v30 - CNWSCreatureStats__GetSkillRank(v39, 8u, v40, 0) - *(_BYTE *)(v3 + 2601);
  212.     }
  213.     if ( CNWSCreatureStats__HasFeat(*(_DWORD *)(v4 + 3172), 240)
  214.       || (*(_DWORD *)(v4 + 172) || *(_BYTE *)(v4 + 1192) == 1) && *(_BYTE *)(v4 + 1192) == 1
  215.       || !CNWSCreatureStats__HasFeat(*(_DWORD *)(v4 + 3172), 240)
  216.       && (!*(_DWORD *)(v4 + 172) && *(_BYTE *)(v4 + 1192) != 1 || *(_BYTE *)(v4 + 1192) == 2) )
  217.     {
  218.       v44 = *(_DWORD *)(v4 + 3172);
  219.       v45 = (*(int (__thiscall **)(int))(*(_DWORD *)v3 + 16))(v3);
  220.       v41 = CNWSCreatureStats__GetSkillRank(v44, 6u, v45, 0) + v30;
  221.     }
  222.     else
  223.     {
  224.       v42 = *(_DWORD *)(v4 + 3172);
  225.       v43 = (*(int (__thiscall **)(int))(*(_DWORD *)v3 + 16))(v3);
  226.       v41 = CNWSCreatureStats__GetSkillRank(v42, 6u, v43, 0) / 2 + v30;
  227.     }
  228.     v46 = *(_BYTE *)(v4 + 2603) + *(_DWORD *)(CNWSObject__GetArea((void *)v4) + 332) + v41;
  229.     if ( *(_DWORD *)(v4 + 1212) )
  230.       v46 -= 10;
  231.     if ( CNWSObject__AnimationStationary(*(_DWORD *)(v3 + 172)) )
  232.       v46 -= 5;
  233.     if ( CNWSObject__AnimationStationary(*(_DWORD *)(v4 + 172)) )
  234.       v46 += 5;
  235.     v48 = (signed __int64)(sqrt(v50) * -0.3333333432674408) + v46;
  236.     v47 = *(_DWORD *)(v3 + 1236);
  237.     switch ( v47 )
  238.     {
  239.       case 1:
  240.         v48 -= 8;
  241.         break;
  242.       case 2:
  243.         v48 -= 4;
  244.         break;
  245.       case 4:
  246.         v48 += 4;
  247.         break;
  248.       case 5:
  249.         v48 += 8;
  250.         break;
  251.     }
  252.     if ( CNWSCreatureStats__GetFavoredEnemyBonus(*(_DWORD *)(v4 + 3172), v3) + v48 <= 0 )
  253.       return 0;
  254.     result = v52;
  255.   }
  256.   else
  257.   {
  258.     result = 1;
  259.   }
  260.   return result;
  261. }
  262.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement