comparison Actor.cpp @ 1897:436553b0603c

_46DF1A_collide_against_actor cleaned up, moved to Actor.h
author Grumpy7
date Sun, 20 Oct 2013 22:58:27 -0700
parents b6a7410ff0ef
children 768590235c2c
comparison
equal deleted inserted replaced
1896:b6a7410ff0ef 1897:436553b0603c
2785 v8->uSummonerID = PID(OBJECT_Actor,summonerId); 2785 v8->uSummonerID = PID(OBJECT_Actor,summonerId);
2786 2786
2787 } 2787 }
2788 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); 2788 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
2789 //----- (0046DF1A) -------------------------------------------------------- 2789 //----- (0046DF1A) --------------------------------------------------------
2790 signed int __fastcall _46DF1A_collide_against_actor(int a1, int a2) 2790 bool Actor::_46DF1A_collide_against_actor( int a1, int a2 )
2791 { 2791 {
2792 Actor *v2; // edi@1 2792 Actor *v2; // edi@1
2793 unsigned __int16 v3; // ax@1 2793 unsigned __int16 v3; // ax@1
2794 int v4; // esi@6 2794 int v4; // esi@6
2795 int v5; // ecx@8
2796 int v6; // eax@10
2797 int v7; // edx@12
2798 int v8; // ecx@14 2795 int v8; // ecx@14
2799 int v9; // eax@14 2796 int v9; // eax@14
2800 int v10; // ebx@14 2797 int v10; // ebx@14
2801 int v11; // esi@14 2798 int v11; // esi@14
2802 int v12; // ebx@15 2799 int v12; // ebx@15
2803 int v13; // ebx@17 2800 int v13; // ebx@17
2804 unsigned int v14; // eax@20 2801
2805 signed int result; // eax@21
2806 int v16; // [sp+Ch] [bp-10h]@1
2807 int v17; // [sp+10h] [bp-Ch]@14
2808 int v18; // [sp+14h] [bp-8h]@14
2809 int v19; // [sp+18h] [bp-4h]@14
2810
2811 v16 = a1;
2812 v2 = &pActors[a1]; 2802 v2 = &pActors[a1];
2813 v3 = v2->uAIState; 2803 v3 = v2->uAIState;
2814 if ( v3 == 11 || v3 == 4 || v3 == 19 || v3 == 5 || v3 == 17 ) 2804 if ( v3 == Removed || v3 == Dying || v3 == Disabled || v3 == Dead || v3 == Summoned )
2815 goto LABEL_25; 2805 return 0;
2816 v4 = v2->uActorRadius; 2806 v4 = v2->uActorRadius;
2817 if ( a2 ) 2807 if ( a2 )
2818 v4 = a2; 2808 v4 = a2;
2819 v5 = v2->vPosition.x; 2809
2820 if ( stru_721530.sMaxX > v5 + v4 2810 if (stru_721530.sMaxX > v2->vPosition.x + v4 ||
2821 || stru_721530.sMinX < v5 - v4 2811 stru_721530.sMinX < v2->vPosition.x - v4 ||
2822 || (v6 = v2->vPosition.y, stru_721530.sMaxY > v6 + v4) 2812 stru_721530.sMaxY > v2->vPosition.y + v4 ||
2823 || stru_721530.sMinY < v6 - v4 2813 stru_721530.sMinY < v2->vPosition.y - v4 ||
2824 || (v7 = v2->vPosition.z, stru_721530.sMaxZ > v7 + v2->uActorHeight) 2814 stru_721530.sMaxZ > v2->vPosition.z + v2->uActorHeight ||
2825 || stru_721530.sMinZ < v7 2815 stru_721530.sMinZ < v2->vPosition.z)
2826 || (v8 = v5 - stru_721530.normal.x, 2816 {
2827 v9 = v6 - stru_721530.normal.y, 2817 return false;
2828 v10 = stru_721530.prolly_normal_d + v4, 2818 }
2829 v17 = stru_721530.prolly_normal_d + v4, 2819 v8 = v2->vPosition.x - stru_721530.normal.x;
2830 v11 = (v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16, 2820 v9 = v2->vPosition.y - stru_721530.normal.y;
2831 v18 = v8, 2821 v10 = stru_721530.prolly_normal_d + v4;
2832 v19 = v9, 2822 v11 = (v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16;
2833 abs((v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16) > v10) 2823 v12 = (v8 * stru_721530.direction.x + v9 * stru_721530.direction.y) >> 16;
2834 || (v12 = (v18 * stru_721530.direction.x + v19 * stru_721530.direction.y) >> 16, v12 <= 0) 2824 if ( abs(v11) > v10 || v12 <= 0)
2835 || (signed int)(((unsigned __int64)(stru_721530.direction.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z ) 2825 {
2836 { 2826 return false;
2837 LABEL_25: 2827 }
2838 result = 0; 2828 if (((stru_721530.direction.z * (signed __int64)v12) >> 16) + stru_721530.normal.z < v2->vPosition.z)
2839 } 2829 {
2840 else 2830 return false;
2841 { 2831 }
2842 v13 = v12 - integer_sqrt(v17 * v17 - v11 * v11); 2832
2843 if ( v13 < 0 ) 2833 v13 = v12 - integer_sqrt(v10 * v10 - v11 * v11);
2844 v13 = 0; 2834 if ( v13 < 0 )
2845 if ( v13 < stru_721530.field_7C ) 2835 v13 = 0;
2846 { 2836 if ( v13 < stru_721530.field_7C )
2847 stru_721530.field_7C = v13; 2837 {
2848 v14 = 8 * v16; 2838 stru_721530.field_7C = v13;
2849 LOBYTE(v14) = PID(OBJECT_Actor,v16); 2839 stru_721530.uFaceID = PID(OBJECT_Actor,a1);
2850 stru_721530.uFaceID = v14; 2840 }
2851 } 2841 return true;
2852 result = 1;
2853 }
2854 return result;
2855 } 2842 }
2856 //----- (00401A91) -------------------------------------------------------- 2843 //----- (00401A91) --------------------------------------------------------
2857 void UpdateActorAI() 2844 void UpdateActorAI()
2858 { 2845 {
2859 //unsigned int v0; // esi@4 2846 //unsigned int v0; // esi@4