Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signed int __thiscall CNWSCreature__DoListenDetection(int this, int a2, unsigned int a3)
- {
- int v3; // edi@1
- int v4; // esi@1
- int v5; // eax@1
- signed int result; // eax@2
- float v7; // ebx@3
- float v8; // ebp@3
- float v9; // ecx@3
- float v10; // edx@3
- float v11; // eax@3
- char v12; // al@4
- long double v13; // fst7@8
- int v14; // eax@10
- long double v15; // fst7@14
- unsigned int v16; // eax@18
- float v17; // ST08_4@18
- int v18; // eax@18
- float v19; // ST14_4@18
- float v20; // ST00_4@18
- float v21; // ST04_4@18
- float v22; // ST08_4@18
- int v23; // eax@18
- int v24; // eax@23
- int v25; // ebx@23
- int v26; // eax@25
- int v27; // eax@28
- int v28; // ebx@28
- int v29; // eax@30
- int v30; // ebx@34
- int v31; // eax@35
- float v32; // edx@35
- int v33; // ecx@35
- int v34; // ST28_4@35
- int v35; // eax@35
- int v36; // ebp@38
- int v37; // eax@38
- char v38; // al@39
- int v39; // ebp@42
- int v40; // eax@42
- int v41; // ebx@51
- int v42; // ebp@51
- int v43; // eax@51
- int v44; // ebp@52
- int v45; // eax@52
- int v46; // ebx@53
- int v47; // eax@59
- int v48; // ebx@59
- signed int v49; // [sp+10h] [bp-40h]@1
- float v50; // [sp+14h] [bp-3Ch]@3
- int v51; // [sp+18h] [bp-38h]@18
- int v52; // [sp+1Ch] [bp-34h]@1
- float v53; // [sp+20h] [bp-30h]@3
- float v54; // [sp+24h] [bp-2Ch]@3
- float v55; // [sp+28h] [bp-28h]@3
- int v56; // [sp+2Ch] [bp-24h]@1
- float v57; // [sp+30h] [bp-20h]@1
- float v58; // [sp+34h] [bp-1Ch]@1
- int v59; // [sp+38h] [bp-18h]@1
- float v60; // [sp+3Ch] [bp-14h]@1
- float v61; // [sp+40h] [bp-10h]@1
- float v62; // [sp+44h] [bp-Ch]@3
- float v63; // [sp+48h] [bp-8h]@3
- float v64; // [sp+4Ch] [bp-4h]@3
- float v65; // [sp+54h] [bp+4h]@21
- v3 = a2;
- v5 = *(_DWORD *)(a2 + 2504);
- v4 = this;
- v59 = 0;
- LODWORD(v60) = 0;
- LODWORD(v61) = 0;
- v56 = 0;
- LODWORD(v57) = 0;
- LODWORD(v58) = 0;
- v52 = 1;
- v49 = 0;
- if ( v5 )
- return 0;
- LODWORD(v8) = *(_DWORD *)(this + 120);
- LODWORD(v7) = *(_DWORD *)(this + 124);
- LODWORD(v64) = *(_DWORD *)(this + 128);
- LODWORD(v9) = *(_DWORD *)(a2 + 120);
- LODWORD(v10) = *(_DWORD *)(a2 + 124);
- LODWORD(v11) = *(_DWORD *)(a2 + 128);
- v64 = v64 + 1.0;
- v62 = v8;
- v53 = v9;
- v55 = v11 + 1.0;
- v63 = v7;
- v54 = v10;
- v50 = (v64 - v55) * (v64 - v55) + (v7 - v10) * (v7 - v10) + (v8 - v9) * (v8 - v9);
- if ( a3 || (v12 = *(_BYTE *)(v4 + 2524), !(v12 & 0x24)) && (v12 & 0x10 || v12 & 8 && !(v12 & 2)) )
- {
- v13 = CNWSCreature__DesiredAttackRange(v4, *(_DWORD *)(a2 + 4), 1);
- if ( v50 > (v13 + 1.5) * (v13 + 1.5) )
- return 0;
- v14 = CNWSCreature__GetVisibleListElement(v4, *(_DWORD *)(a2 + 4));
- if ( v14 )
- {
- if ( (*(_BYTE *)(v14 + 4) & 0xC) == 4 )
- return 0;
- }
- }
- if ( *(_DWORD *)(v4 + 1212) )
- v15 = *(float *)(v4 + 2592);
- else
- v15 = *(float *)(v4 + 2588);
- if ( v50 > v15 * v15 )
- return 0;
- v17 = v64;
- v18 = CNWSObject__GetArea((void *)v4);
- CNWSArea__ClearLineOfSight((void *)v18, v8, v7, v17, v53, v54, v55, (int)&v59, (int)&a3, 0x7F000000u, 0x7F000000u, 0);
- v19 = v64;
- v20 = v53;
- v21 = v54;
- v22 = v55;
- v23 = CNWSObject__GetArea((void *)v4);
- CNWSArea__ClearLineOfSight((void *)v23, v20, v21, v22, v8, v7, v19, (int)&v56, (int)&v51, 0x7F000000u, 0x7F000000u, 0);
- v16 = a3;
- if ( a3 == v51 )
- {
- if ( a3 != 2130706432 && v51 != 2130706432 )
- {
- LODWORD(v65) = 1042536203;
- goto LABEL_32;
- }
- }
- else
- {
- if ( a3 != 2130706432 )
- {
- v24 = CServerExoApp__GetGameObject(*(_DWORD *)(g_pAppManager + 4), a3);
- v25 = v24;
- if ( v24 )
- {
- if ( (*(int (__thiscall **)(int))(*(_DWORD *)v24 + 16))(v24) )
- {
- v26 = (*(int (__thiscall **)(int))(*(_DWORD *)v25 + 16))(v25) + 120;
- v59 = *(_DWORD *)v26;
- LODWORD(v60) = *(_DWORD *)(v26 + 4);
- LODWORD(v61) = *(_DWORD *)(v26 + 8);
- }
- }
- v16 = a3;
- }
- if ( v51 != 2130706432 )
- {
- v27 = CServerExoApp__GetGameObject(*(_DWORD *)(g_pAppManager + 4), v16);
- v28 = v27;
- if ( v27 )
- {
- if ( (*(int (__thiscall **)(int))(*(_DWORD *)v27 + 16))(v27) )
- {
- v29 = (*(int (__thiscall **)(int))(*(_DWORD *)v28 + 16))(v28) + 120;
- v56 = *(_DWORD *)v29;
- LODWORD(v57) = *(_DWORD *)(v29 + 4);
- LODWORD(v58) = *(_DWORD *)(v29 + 8);
- }
- }
- }
- }
- v65 = (v58 - v61) * (v58 - v61)
- + (v57 - v60) * (v57 - v60)
- + (*(float *)&v56 - *(float *)&v59) * (*(float *)&v56 - *(float *)&v59);
- if ( v65 <= 0.0 )
- {
- LABEL_37:
- v30 = v49;
- goto LABEL_38;
- }
- LABEL_32:
- if ( *(_BYTE *)(CNWSObject__GetArea((void *)v4) + 4) & 1 || *(_BYTE *)(CNWSObject__GetArea((void *)v4) + 4) & 2 )
- {
- v31 = *(_DWORD *)(CNWSObject__GetArea((void *)v4) + 408);
- LODWORD(v62) = *(_DWORD *)(v4 + 120);
- LODWORD(v64) = *(_DWORD *)(v4 + 128);
- *(float *)(v31 + 100) = v62;
- LODWORD(v62) = *(_DWORD *)(v4 + 120);
- LODWORD(v32) = *(_DWORD *)(v4 + 124);
- LODWORD(v64) = *(_DWORD *)(v4 + 128);
- v63 = v32;
- *(float *)(v31 + 104) = v32;
- LODWORD(v62) = *(_DWORD *)(v3 + 120);
- LODWORD(v64) = *(_DWORD *)(v3 + 128);
- *(float *)(v31 + 76) = v62;
- LODWORD(v62) = *(_DWORD *)(v3 + 120);
- v33 = *(_DWORD *)(v3 + 128);
- LODWORD(v63) = *(_DWORD *)(v3 + 124);
- LODWORD(v64) = v33;
- *(float *)(v31 + 80) = v63;
- v34 = v31;
- v35 = CNWSObject__GetArea((void *)v4);
- if ( CNWSArea__PlotSoundPath((void *)v35, v34) != 1 )
- return 0;
- v49 = -2;
- goto LABEL_37;
- }
- v30 = -5 * (signed __int64)sqrt(v65);
- LABEL_38:
- v36 = *(_DWORD *)(v3 + 3172);
- v37 = (*(int (__thiscall **)(int))(*(_DWORD *)v4 + 16))(v4);
- if ( CNWSCreatureStats__GetSkillRank(v36, 8u, v37, 0)
- && (v38 = *(_BYTE *)(v3 + 1193)) != 0
- && *(_DWORD *)(v3 + 2864) != *(_DWORD *)(v4 + 4) )
- {
- if ( v38 == 1 )
- {
- v39 = *(_DWORD *)(v3 + 3172);
- v40 = (*(int (__thiscall **)(int))(*(_DWORD *)v4 + 16))(v4);
- v30 = v30 - CNWSCreatureStats__GetSkillRank(v39, 8u, v40, 0) - *(_BYTE *)(v3 + 2601);
- }
- if ( CNWSCreatureStats__HasFeat(*(_DWORD *)(v4 + 3172), 240)
- || (*(_DWORD *)(v4 + 172) || *(_BYTE *)(v4 + 1192) == 1) && *(_BYTE *)(v4 + 1192) == 1
- || !CNWSCreatureStats__HasFeat(*(_DWORD *)(v4 + 3172), 240)
- && (!*(_DWORD *)(v4 + 172) && *(_BYTE *)(v4 + 1192) != 1 || *(_BYTE *)(v4 + 1192) == 2) )
- {
- v44 = *(_DWORD *)(v4 + 3172);
- v45 = (*(int (__thiscall **)(int))(*(_DWORD *)v3 + 16))(v3);
- v41 = CNWSCreatureStats__GetSkillRank(v44, 6u, v45, 0) + v30;
- }
- else
- {
- v42 = *(_DWORD *)(v4 + 3172);
- v43 = (*(int (__thiscall **)(int))(*(_DWORD *)v3 + 16))(v3);
- v41 = CNWSCreatureStats__GetSkillRank(v42, 6u, v43, 0) / 2 + v30;
- }
- v46 = *(_BYTE *)(v4 + 2603) + *(_DWORD *)(CNWSObject__GetArea((void *)v4) + 332) + v41;
- if ( *(_DWORD *)(v4 + 1212) )
- v46 -= 10;
- if ( CNWSObject__AnimationStationary(*(_DWORD *)(v3 + 172)) )
- v46 -= 5;
- if ( CNWSObject__AnimationStationary(*(_DWORD *)(v4 + 172)) )
- v46 += 5;
- v48 = (signed __int64)(sqrt(v50) * -0.3333333432674408) + v46;
- v47 = *(_DWORD *)(v3 + 1236);
- switch ( v47 )
- {
- case 1:
- v48 -= 8;
- break;
- case 2:
- v48 -= 4;
- break;
- case 4:
- v48 += 4;
- break;
- case 5:
- v48 += 8;
- break;
- }
- if ( CNWSCreatureStats__GetFavoredEnemyBonus(*(_DWORD *)(v4 + 3172), v3) + v48 <= 0 )
- return 0;
- result = v52;
- }
- else
- {
- result = 1;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement