comparison mm7_2.cpp @ 2108:16f5a7ca289a

Merge
author Grumpy7
date Fri, 20 Dec 2013 01:28:39 +0100
parents 0db53678ff48
children f6e59446c133
comparison
equal deleted inserted replaced
2107:85e9766d6124 2108:16f5a7ca289a
2276 int v5; // esi@4 2276 int v5; // esi@4
2277 2277
2278 if (val < 1) 2278 if (val < 1)
2279 return val; 2279 return val;
2280 2280
2281
2282 v2 = 0; 2281 v2 = 0;
2283 v3 = val; 2282 v3 = val;
2284 result = 0; 2283 result = 0;
2285 //v4 = 16; 2284 //v4 = 16;
2286 for (uint i = 0; i < 16; ++i) 2285 for (uint i = 0; i < 16; ++i)
2347 } 2346 }
2348 2347
2349 //----- (00452B2E) -------------------------------------------------------- 2348 //----- (00452B2E) --------------------------------------------------------
2350 int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides) 2349 int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides)
2351 { 2350 {
2352 signed int v2; // edi@1
2353 int v3; // esi@1 2351 int v3; // esi@1
2354 int result; // eax@2 2352
2355 unsigned int v5; // ebx@4
2356
2357 v2 = uDiceSides;
2358 v3 = 0; 2353 v3 = 0;
2359 if ( uDiceSides ) 2354 if ( uDiceSides )
2360 { 2355 {
2361 if ( (signed int)uNumDice > 0 ) 2356 for ( uint i = 0; i < uNumDice; ++i)
2362 { 2357 v3 += rand() % uDiceSides + 1;
2363 v5 = uNumDice; 2358 return v3;
2364 do 2359 }
2365 { 2360 return 0;
2366 --v5;
2367 v3 += rand() % v2 + 1;
2368 }
2369 while ( v5 );
2370 }
2371 result = v3;
2372 }
2373 else
2374 {
2375 result = 0;
2376 }
2377 return result;
2378 } 2361 }
2379 2362
2380 //----- (00453F62) -------------------------------------------------------- 2363 //----- (00453F62) --------------------------------------------------------
2381 void MapStats::Initialize() 2364 void MapStats::Initialize()
2382 { 2365 {
2732 if ( pHostileTXT_Raw ) 2715 if ( pHostileTXT_Raw )
2733 free(pHostileTXT_Raw); 2716 free(pHostileTXT_Raw);
2734 pHostileTXT_Raw = NULL; 2717 pHostileTXT_Raw = NULL;
2735 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0); 2718 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0);
2736 strtok(pHostileTXT_Raw, "\r"); 2719 strtok(pHostileTXT_Raw, "\r");
2737 for (i=0; i<89; ++i) 2720 for ( i=0; i < 89; ++i )
2738 { 2721 {
2739 test_string = strtok(NULL, "\r") + 1; 2722 test_string = strtok(NULL, "\r") + 1;
2740 break_loop = false; 2723 break_loop = false;
2741 decode_step=0; 2724 decode_step=0;
2742 do 2725 do
2743 { 2726 {
2744 c = *(unsigned char*)test_string; 2727 c = *(unsigned char*)test_string;
2745 temp_str_len = 0; 2728 temp_str_len = 0;
2746 while((c!='\t')&&(c>0)) 2729 while((c!='\t') && (c > 0))
2747 { 2730 {
2748 ++temp_str_len; 2731 ++temp_str_len;
2749 c=test_string[temp_str_len]; 2732 c = test_string[temp_str_len];
2750 } 2733 }
2751 tmp_pos=test_string+temp_str_len; 2734 tmp_pos=test_string+temp_str_len;
2752 if (*tmp_pos == 0) 2735 if (*tmp_pos == 0)
2753 break_loop = true; 2736 break_loop = true;
2754 *tmp_pos = 0; 2737 *tmp_pos = 0;
2755 if (temp_str_len) 2738 if (temp_str_len)
2756 { 2739 {
2757 if ( decode_step >= 1 && decode_step < 90 ) 2740 if ( decode_step >= 1 && decode_step < 90 )
2758 relations[decode_step-1][i] = atoi(test_string); 2741 relations[decode_step-1][i] = atoi(test_string);
2759 } 2742 }
2760 else 2743 else
2761 { 2744 break_loop = true;
2762 break_loop = true; 2745 ++decode_step;
2763 } 2746 test_string=tmp_pos+1;
2764 ++decode_step; 2747 }
2765 test_string=tmp_pos+1; 2748 while ((decode_step < 92) && !break_loop );
2766 } while ((decode_step<92)&&!break_loop); 2749 }
2767 }
2768 if ( pHostileTXT_Raw) 2750 if ( pHostileTXT_Raw)
2769 { 2751 {
2770 free(pHostileTXT_Raw); 2752 free(pHostileTXT_Raw);
2771 pHostileTXT_Raw = NULL; 2753 pHostileTXT_Raw = NULL;
2772 } 2754 }
2829 void _461103_load_level_sub() 2811 void _461103_load_level_sub()
2830 { 2812 {
2831 //GUIProgressBar *v0; // ebx@1 2813 //GUIProgressBar *v0; // ebx@1
2832 //signed int v1; // ebp@1 2814 //signed int v1; // ebp@1
2833 //char *v2; // esi@2 2815 //char *v2; // esi@2
2834 __int16 v3; // cx@3 2816 //__int16 v3; // cx@3
2835 int v4; // edx@8 2817 int v4; // edx@8
2836 //size_t v5; // edi@14 2818 //size_t v5; // edi@14
2837 signed int v6; // esi@14 2819 signed int v6; // esi@14
2838 //char *v7; // edx@15 2820 //char *v7; // edx@15
2839 signed int v8; // ecx@16 2821 signed int v8; // ecx@16
2851 signed int v20; // [sp+18h] [bp-44h]@14 2833 signed int v20; // [sp+18h] [bp-44h]@14
2852 int v21[16]; // [sp+1Ch] [bp-40h]@17 2834 int v21[16]; // [sp+1Ch] [bp-40h]@17
2853 2835
2854 GenerateItemsInChest(); 2836 GenerateItemsInChest();
2855 pGameLoadingUI_ProgressBar->Progress(); 2837 pGameLoadingUI_ProgressBar->Progress();
2856 pParty->uFlags |= 2u; 2838 pParty->uFlags |= 2;
2857 pParty->field_7B5_in_arena_quest = 0; 2839 pParty->field_7B5_in_arena_quest = 0;
2858 dword_5C6DF8 = 1; 2840 dword_5C6DF8 = 1;
2859 pNPCStats->uNewlNPCBufPos = 0; 2841 pNPCStats->uNewlNPCBufPos = 0;
2860 v19 = pMapStats->GetMapInfo(pCurrentMapName); 2842 v19 = pMapStats->GetMapInfo(pCurrentMapName);
2861 2843
2865 { 2847 {
2866 //Actor* pActor = &pActors[i]; 2848 //Actor* pActor = &pActors[i];
2867 //v2 = (char *)&pActors[0].uNPC_ID; 2849 //v2 = (char *)&pActors[0].uNPC_ID;
2868 //do 2850 //do
2869 //{ 2851 //{
2870 v3 = pActors[i].pMonsterInfo.uID; 2852 //v3 = pActors[i].pMonsterInfo.uID;
2871 v17 = 0; 2853 v17 = 0;
2872 if ( pActors[i].pMonsterInfo.uID >= 115 && pActors[i].pMonsterInfo.uID <= 186 2854 if ( pActors[i].pMonsterInfo.uID >= 115 && pActors[i].pMonsterInfo.uID <= 186
2873 || pActors[i].pMonsterInfo.uID >= 232 && pActors[i].pMonsterInfo.uID <= 249 ) 2855 || pActors[i].pMonsterInfo.uID >= 232 && pActors[i].pMonsterInfo.uID <= 249 )
2874 v17 = 1; 2856 v17 = 1;
2875 //v1 = 0; 2857 //v1 = 0;
2876 v4 = (v3 - 1) % 3; 2858 v4 = (pActors[i].pMonsterInfo.uID - 1) % 3;
2877 if ( 2 == v4 ) 2859 if ( 2 == v4 )
2878 { 2860 {
2879 if ( pActors[i].sNPC_ID && pActors[i].sNPC_ID < 5000 ) 2861 if ( pActors[i].sNPC_ID && pActors[i].sNPC_ID < 5000 )
2880 continue; 2862 continue;
2881 } 2863 }
2882 else 2864 else
2883 { 2865 {
2884 if ( v4 != 1 ) 2866 if ( v4 != 1 )
2885 { 2867 {
2886 if ( v4 == 0 && pActors[i].sNPC_ID == 0 ) 2868 if ( v4 == 0 && pActors[i].sNPC_ID == 0 )
2887 pActors[i].sNPC_ID = 0; 2869 pActors[i].sNPC_ID = 0;
2888 continue; 2870 continue;
2889 } 2871 }
2890 } 2872 }
2891 if ( pActors[i].sNPC_ID > 0 && pActors[i].sNPC_ID < 5000 ) 2873 if ( pActors[i].sNPC_ID > 0 && pActors[i].sNPC_ID < 5000 )
2892 continue; 2874 continue;
2893 if ( v17 ) 2875 if ( v17 )
2894 { 2876 {
2895 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], v3, 0, v19); 2877 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], pActors[i].pMonsterInfo.uID, 0, v19);
2896 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000; 2878 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000;
2897 ++pNPCStats->uNewlNPCBufPos; 2879 ++pNPCStats->uNewlNPCBufPos;
2898 pActors[i].sNPC_ID = v14; 2880 pActors[i].sNPC_ID = v14;
2899 continue; 2881 continue;
2900 } 2882 }
2915 for (uint i = 0; i < uNumActors; ++i) 2897 for (uint i = 0; i < uNumActors; ++i)
2916 { 2898 {
2917 //v7 = (char *)&pActors[0].pMonsterInfo; 2899 //v7 = (char *)&pActors[0].pMonsterInfo;
2918 //do 2900 //do
2919 //{ 2901 //{
2920 v8 = 0; 2902 for ( v8 = 0; v8 < v6; ++v8 )
2921 if ( v6 > 0 ) 2903 {
2922 { 2904 if ( v21[v8] == pActors[i].pMonsterInfo.uID - 1 )
2923 do 2905 break;
2924 { 2906 }
2925 if ( v21[v8] == pActors[i].pMonsterInfo.uID - 1 ) 2907
2926 break; 2908 if ( v8 == v6 )
2927 ++v8; 2909 {
2928 } 2910 v21[v6++] = pActors[i].pMonsterInfo.uID - 1;
2929 while ( v8 < v6 ); 2911 v20 = v6;
2930 } 2912 if ( v6 == 16 )
2931 2913 break;
2932 if ( v8 == v6 ) 2914 }
2933 { 2915 //++v16;
2934 v21[v6++] = pActors[i].pMonsterInfo.uID - 1; 2916 //v7 += 836;
2935 v20 = v6;
2936 if ( v6 == 16 )
2937 break;
2938 }
2939 //++v16;
2940 //v7 += 836;
2941 //} 2917 //}
2942 //while ( v16 < (signed int)v5 ); 2918 //while ( v16 < (signed int)v5 );
2943 } 2919 }
2944 2920
2945 pGameLoadingUI_ProgressBar->Progress(); 2921 pGameLoadingUI_ProgressBar->Progress();
2946 2922
2947 if ( v6 > 0 ) 2923 for ( int _v0 = 0; _v0 < v6; ++_v0 )
2948 { 2924 {
2949 int _v0 = 0; 2925 for ( v18 = 4; v18; --v18 )
2950 do 2926 pSoundList->LoadSound(pMonsterList->pMonsters[v21[_v0]].pSoundSampleIDs[4 - v18], 0);
2951 {
2952 v9 = v21[_v0];
2953 v18 = 4;
2954 v10 = &pMonsterStats->pInfos[v9 + 1];
2955 //v11 = (int *)pMonsterList->pMonsters[v9].pSoundSampleIDs;
2956 MonsterDesc* v11 = &pMonsterList->pMonsters[v9];
2957 do
2958 {
2959 pSoundList->LoadSound(v11->pSoundSampleIDs[4 - v18], 0);
2960 //v11 = (int *)((char *)v11 + 2);
2961 --v18;
2962 }
2963 while ( v18 );
2964 v12 = 0; 2927 v12 = 0;
2965 do 2928 do
2966 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v10->uSpell1ID], 1); 2929 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[pMonsterStats->pInfos[v21[_v0] + 1].uSpell1ID], 1);
2967 while ( v13 ); 2930 while ( v13 );
2968 ++_v0; 2931 }
2969 }
2970 while ( _v0 < v6 );
2971 //v0 = pGameLoadingUI_ProgressBar; 2932 //v0 = pGameLoadingUI_ProgressBar;
2972 //v1 = 0; 2933 //v1 = 0;
2973 }
2974 2934
2975 pGameLoadingUI_ProgressBar->Progress(); 2935 pGameLoadingUI_ProgressBar->Progress();
2976 2936
2977 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS) 2937 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS)
2978 uNumActors = 0; 2938 uNumActors = 0;
3465 { 3425 {
3466 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v7, &dwDisposition) ) 3426 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v7, &dwDisposition) )
3467 { 3427 {
3468 if ( !RegCreateKeyExA(v7, "1.0", 0, "", 0, 0xF003Fu, 0, &v8, &dwDisposition) ) 3428 if ( !RegCreateKeyExA(v7, "1.0", 0, "", 0, 0xF003Fu, 0, &v8, &dwDisposition) )
3469 { 3429 {
3470 RegSetValueExA(v8, lpValueName, 0, 4u, Data, 4u); 3430 RegSetValueExA(v8, lpValueName, 0, 4, Data, 4);
3471 RegCloseKey(v8); 3431 RegCloseKey(v8);
3472 } 3432 }
3473 RegCloseKey(v7); 3433 RegCloseKey(v7);
3474 } 3434 }
3475 RegCloseKey(phkResult); 3435 RegCloseKey(phkResult);
4105 pUIAnims[i]->uAnimTime = 0; 4065 pUIAnims[i]->uAnimTime = 0;
4106 pUIAnims[i]->x = _4E98D0[i][0]; 4066 pUIAnims[i]->x = _4E98D0[i][0];
4107 pUIAnims[i]->y = _4E98D0[i][2]; 4067 pUIAnims[i]->y = _4E98D0[i][2];
4108 } 4068 }
4109 4069
4110 v5 = 0; 4070 for ( v5 = 0; v5 < (signed int)pObjectList->uNumObjects; ++v5 )
4111 if ( (signed int)pObjectList->uNumObjects > 0 ) 4071 {
4112 { 4072 BYTE3(v7) = 0;
4113 v6 = 0; 4073 *(short *)((char *)&v7 + 1) = pObjectList->pObjects[v5].uParticleTrailColorR;
4114 do 4074 LOBYTE(v7) = pObjectList->pObjects[v5].uParticleTrailColorG;
4115 { 4075 pObjectList->pObjects[v5].uParticleTrailColor = pObjectList->pObjects[v5].uParticleTrailColorB | (v7 << 8);
4116 BYTE3(v7) = 0;
4117 v8 = &pObjectList->pObjects[v6];
4118 ++v6;
4119 *(short *)((char *)&v7 + 1) = v8->uParticleTrailColorR;
4120 LOBYTE(v7) = v8->uParticleTrailColorG;
4121 ++v5;
4122 v8->uParticleTrailColor = v8->uParticleTrailColorB | (v7 << 8);
4123 }
4124 while ( v5 < (signed int)pObjectList->uNumObjects );
4125 } 4076 }
4126 flt_6BE3A0 = 0.55000001f; 4077 flt_6BE3A0 = 0.55000001f;
4127 MainMenuUI_Create(); 4078 MainMenuUI_Create();
4128 pGame->pStru6Instance->LoadAnimations(); 4079 pGame->pStru6Instance->LoadAnimations();
4129 4080
4684 } 4635 }
4685 else 4636 else
4686 { 4637 {
4687 LOBYTE(viewparams->field_20) = 0; 4638 LOBYTE(viewparams->field_20) = 0;
4688 } 4639 }
4689 pParty->uFlags |= 2u; 4640 pParty->uFlags |= 2;
4690 viewparams->uSomeY = viewparams->uScreen_topL_Y; 4641 viewparams->uSomeY = viewparams->uScreen_topL_Y;
4691 viewparams->uSomeX = viewparams->uScreen_topL_X; 4642 viewparams->uSomeX = viewparams->uScreen_topL_X;
4692 viewparams->uSomeZ = viewparams->uScreen_BttmR_X; 4643 viewparams->uSomeZ = viewparams->uScreen_BttmR_X;
4693 viewparams->uSomeW = viewparams->uScreen_BttmR_Y; 4644 viewparams->uSomeW = viewparams->uScreen_BttmR_Y;
4694 4645
4734 4685
4735 //----- (0046A6AC) -------------------------------------------------------- 4686 //----- (0046A6AC) --------------------------------------------------------
4736 int __fastcall _46A6AC_spell_render(int a1, int a2, int a3) 4687 int __fastcall _46A6AC_spell_render(int a1, int a2, int a3)
4737 { 4688 {
4738 int result; // eax@2 4689 int result; // eax@2
4739 unsigned int v4; // edx@3
4740 int *v5; // esi@6 4690 int *v5; // esi@6
4741 unsigned int v6; // ebx@6 4691 unsigned int v6; // ebx@6
4742 signed int v7; // edi@9 4692 signed int v7; // edi@9
4743 unsigned __int16 v8; // ax@9
4744 int i; // eax@14 4693 int i; // eax@14
4745 int v10; // ecx@19 4694 int v10; // ecx@19
4746 int v11; // [sp+0h] [bp-18h]@1
4747 unsigned int v12; // [sp+4h] [bp-14h]@3
4748 unsigned int v13; // [sp+8h] [bp-10h]@4 4695 unsigned int v13; // [sp+8h] [bp-10h]@4
4749 int v14; // [sp+Ch] [bp-Ch]@1
4750 int *v15; // [sp+10h] [bp-8h]@4 4696 int *v15; // [sp+10h] [bp-8h]@4
4751 int v16; // [sp+14h] [bp-4h]@3 4697 int v16; // [sp+14h] [bp-4h]@3
4752 4698
4753 v11 = a2;
4754 v14 = a1;
4755 if ( pRenderer->pRenderD3D ) 4699 if ( pRenderer->pRenderD3D )
4756 { 4700 {
4757 result = _46A6AC_spell_render_d3d(a1, a2, a3); 4701 result = _46A6AC_spell_render_d3d(a1, a2, a3);
4758 } 4702 }
4759 else 4703 else
4760 { 4704 {
4761 __debugbreak(); // SW render never called 4705 __debugbreak(); // SW render never called
4762 v16 = 0; 4706 v16 = 0;
4763 v4 = viewparams->uScreen_topL_X;
4764 v12 = viewparams->uScreen_BttmR_X;
4765 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) 4707 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
4766 { 4708 {
4767 v15 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; 4709 v15 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y];
4768 v13 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1; 4710 v13 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1;
4769 do 4711 for ( v13; v13; --v13 )
4770 { 4712 {
4771 if ( (signed int)v4 < (signed int)v12 ) 4713 if ( (signed int)viewparams->uScreen_topL_X < (signed int)viewparams->uScreen_BttmR_X )
4772 { 4714 {
4773 v5 = v15; 4715 v5 = v15;
4774 v6 = ((v12 - v4 - 1) >> 1) + 1; 4716 v6 = ((viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X - 1) >> 1) + 1;
4775 do 4717 for ( v6; v6; --v6 )
4776 { 4718 {
4777 if ( PID_TYPE(*(char *)v5) == OBJECT_Actor) 4719 if ( PID_TYPE(*(char *)v5) == OBJECT_Actor)
4778 { 4720 {
4779 if ( *v5 <= a3 << 16 ) 4721 if ( *v5 <= a3 << 16 )
4780 { 4722 {
4781 v7 = PID_ID((signed int)(unsigned __int16)*v5); 4723 v7 = PID_ID((signed int)(unsigned __int16)*v5);
4782 v8 = pActors[v7].uAIState; 4724 if ( pActors[v7].uAIState != Dead && pActors[v7].uAIState != Dying && pActors[v7].uAIState != Removed
4783 if ( v8 != 5 ) 4725 && pActors[v7].uAIState != Summoned && pActors[v7].uAIState != Disabled )
4784 { 4726 {
4785 if ( v8 != 4 && v8 != 11 && v8 != 17 && v8 != 19 ) 4727 for ( i = 0; i < v16; ++i )
4786 { 4728 {
4787 for ( i = 0; i < v16; ++i ) 4729 if ( *(int *)(a1 + 4 * i) == v7 )
4730 break;
4731 }
4732 if ( i == v16 )
4733 {
4734 if ( i < a2 - 1 )
4788 { 4735 {
4789 if ( *(int *)(v14 + 4 * i) == v7 ) 4736 v10 = v16++;
4790 break; 4737 *(int *)(a1 + 4 * v10) = v7;
4791 }
4792 if ( i == v16 )
4793 {
4794 if ( i < v11 - 1 )
4795 {
4796 v10 = v16++;
4797 *(int *)(v14 + 4 * v10) = v7;
4798 }
4799 } 4738 }
4800 } 4739 }
4801 } 4740 }
4802 } 4741 }
4803 } 4742 }
4804 v5 += 2; 4743 v5 += 2;
4805 --v6;
4806 } 4744 }
4807 while ( v6 );
4808 } 4745 }
4809 v15 += 1280; 4746 v15 += 1280;
4810 --v13;
4811 } 4747 }
4812 while ( v13 );
4813 } 4748 }
4814 result = v16; 4749 result = v16;
4815 } 4750 }
4816 return result; 4751 return result;
4817 } 4752 }
4818 4753
4819 //----- (0046A7C8) -------------------------------------------------------- 4754 //----- (0046A7C8) --------------------------------------------------------
4820 int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3) 4755 int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3)
4821 { 4756 {
4822 unsigned int v3; // eax@2 4757 unsigned int v3; // eax@2
4823 int v4; // ecx@2
4824 unsigned int v5; // eax@2 4758 unsigned int v5; // eax@2
4825 unsigned int v6; // eax@4 4759 unsigned int v6; // eax@4
4826 unsigned int v7; // edi@4
4827 unsigned __int16 v8; // ax@4
4828 float v9; // ST00_4@9
4829 int v10; // ecx@11 4760 int v10; // ecx@11
4830 unsigned int v12; // [sp+10h] [bp-14h]@1 4761 unsigned int v12; // [sp+10h] [bp-14h]@1
4831 int v13; // [sp+14h] [bp-10h]@1
4832 int v14; // [sp+18h] [bp-Ch]@1
4833 int v15; // [sp+1Ch] [bp-8h]@1 4762 int v15; // [sp+1Ch] [bp-8h]@1
4834 unsigned int a1a; // [sp+20h] [bp-4h]@1 4763 unsigned int a1a; // [sp+20h] [bp-4h]@1
4835 4764
4836 v13 = a1;
4837 v14 = a2;
4838 v15 = 0; 4765 v15 = 0;
4839 a1a = 0;
4840 v12 = pRenderer->GetBillboardDrawListSize(); 4766 v12 = pRenderer->GetBillboardDrawListSize();
4841 if ( (signed int)v12 > 0 ) 4767 if ( (signed int)pRenderer->GetBillboardDrawListSize() > 0 )
4842 { 4768 {
4843 do 4769 for ( a1a = 0; (signed int)a1a < (signed int)v12; ++a1a )
4844 { 4770 {
4845 v3 = pRenderer->GetParentBillboardID(a1a); 4771 v3 = pRenderer->GetParentBillboardID(a1a);
4846 v4 = pBillboardRenderList[v3].sZValue;
4847 v5 = (unsigned __int16)pBillboardRenderList[v3].object_pid; 4772 v5 = (unsigned __int16)pBillboardRenderList[v3].object_pid;
4848 if ( PID_TYPE(v5) == OBJECT_Actor) 4773 if ( PID_TYPE(v5) == OBJECT_Actor)
4849 { 4774 {
4850 if ( v4 <= (unsigned int)(a3 << 16) ) 4775 if ( pBillboardRenderList[v3].sZValue <= (unsigned int)(a3 << 16) )
4851 { 4776 {
4852 v6 = PID_ID(v5); 4777 v6 = PID_ID(v5);
4853 v7 = v6; 4778 if ( pActors[v6].uAIState != Dead && pActors[v6].uAIState != Dying && pActors[v6].uAIState != Removed
4854 v8 = pActors[v6].uAIState; 4779 && pActors[v6].uAIState != Disabled && pActors[v6].uAIState != Summoned )
4855 if ( v8 != Dead )
4856 { 4780 {
4857 if ( v8 != Dying ) 4781 if ( pGame->pVisInstance->DoesRayIntersectBillboard((double)a3, a1a) )
4858 { 4782 {
4859 if ( v8 != Removed ) 4783 if ( v15 < a2 - 1 )
4860 { 4784 {
4861 if ( v8 != Disabled ) 4785 __debugbreak();// *(int *)(a1 + 4 * v10) = v6; ÷òî ýòî òàêîå?
4862 { 4786 v10 = v15++;
4863 if ( v8 != Summoned ) 4787 *(int *)(a1 + 4 * v10) = v6;
4864 {
4865 v9 = (double)a3;
4866 if ( pGame->pVisInstance->DoesRayIntersectBillboard(v9, a1a) )
4867 {
4868 if ( v15 < v14 - 1 )
4869 {
4870 v10 = v15++;
4871 *(int *)(v13 + 4 * v10) = v7;
4872 }
4873 }
4874 }
4875 }
4876 } 4788 }
4877 } 4789 }
4878 } 4790 }
4879 } 4791 }
4880 } 4792 }
4881 ++a1a; 4793 }
4882 }
4883 while ( (signed int)a1a < (signed int)v12 );
4884 } 4794 }
4885 return v15; 4795 return v15;
4886 } 4796 }
4887 4797
4888 //----- (0046A89E) -------------------------------------------------------- 4798 //----- (0046A89E) --------------------------------------------------------
4889 int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3) 4799 int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3)
4890 { 4800 {
4891 signed int v3; // edi@1
4892 Actor *v4; // esi@2
4893 int v5; // ebx@3 4801 int v5; // ebx@3
4894 int v6; // eax@3 4802 int v6; // eax@3
4895 int v7; // ebx@3 4803 int v7; // ebx@3
4896 unsigned int v8; // ecx@3 4804 unsigned int v8; // ecx@3
4897 int v9; // edx@4 4805 int v9; // edx@4
4898 unsigned int v10; // edx@6 4806 unsigned int v10; // edx@6
4899 unsigned int v11; // edx@8 4807 unsigned int v11; // edx@8
4900 __int16 v12; // ax@10
4901 int v13; // ecx@15 4808 int v13; // ecx@15
4902 int v15; // [sp+4h] [bp-18h]@1
4903 int v16; // [sp+8h] [bp-14h]@1
4904 int v17; // [sp+Ch] [bp-10h]@3 4809 int v17; // [sp+Ch] [bp-10h]@3
4905 int v18; // [sp+10h] [bp-Ch]@3 4810 int v18; // [sp+10h] [bp-Ch]@3
4906 int v19; // [sp+18h] [bp-4h]@1 4811 int v19; // [sp+18h] [bp-4h]@1
4907 4812
4908 v3 = 0;
4909 v15 = a2;
4910 v16 = a1;
4911 v19 = 0; 4813 v19 = 0;
4912 if ( (signed int)uNumActors > 0 ) 4814 for ( uint i = 0; i < (signed int)uNumActors; ++i )
4913 { 4815 {
4914 v4 = pActors.data();//[0].uAIState; 4816 v5 = abs(pActors[i].vPosition.x - pParty->vPosition.x);
4915 do 4817 v17 = abs(pActors[i].vPosition.y - pParty->vPosition.y);
4916 { 4818 v18 = abs(pActors[i].vPosition.z - pParty->vPosition.z);
4917 v5 = abs(v4->vPosition.x - pParty->vPosition.x); 4819 v6 = v5;
4918 v17 = abs(v4->vPosition.y - pParty->vPosition.y); 4820 v7 = v17;
4919 v18 = abs(v4->vPosition.z - pParty->vPosition.z); 4821 v8 = v18;
4920 v6 = v5; 4822 if ( v6 < v17 )
4921 v7 = v17; 4823 {
4922 v8 = v18; 4824 v9 = v6;
4923 if ( v6 < v17 ) 4825 v6 = v17;
4826 v7 = v9;
4827 }
4828 if ( v6 < v18 )
4829 {
4830 v10 = v6;
4831 v6 = v18;
4832 v8 = v10;
4833 }
4834 if ( v7 < (signed int)v8 )
4835 {
4836 v11 = v8;
4837 v8 = v7;
4838 v7 = v11;
4839 }
4840 if ( (signed int)(((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6) <= a3 )
4841 {
4842 if ( pActors[i].uAIState != Dead && pActors[i].uAIState != Dying && pActors[i].uAIState != Removed
4843 && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned )
4924 { 4844 {
4925 v9 = v6; 4845 __debugbreak();// *(int *)(a1 + 4 * v13) = i; ÷òî ýòî òàêîå?
4926 v6 = v17; 4846 v13 = v19++;
4927 v7 = v9; 4847 *(int *)(a1 + 4 * v13) = i;
4848 if ( v19 >= a2 - 1 )
4849 break;
4928 } 4850 }
4929 if ( v6 < v18 ) 4851 }
4930 {
4931 v10 = v6;
4932 v6 = v18;
4933 v8 = v10;
4934 }
4935 if ( v7 < (signed int)v8 )
4936 {
4937 v11 = v8;
4938 v8 = v7;
4939 v7 = v11;
4940 }
4941 if ( (signed int)(((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6) <= a3 )
4942 {
4943 v12 = v4->uAIState;
4944 if ( v4->uAIState != 5 )
4945 {
4946 if ( v12 != 4 )
4947 {
4948 if ( v12 != 11 )
4949 {
4950 if ( v12 != 19 )
4951 {
4952 if ( v12 != 17 )
4953 {
4954 v13 = v19++;
4955 *(int *)(v16 + 4 * v13) = v3;
4956 if ( v19 >= v15 - 1 )
4957 break;
4958 }
4959 }
4960 }
4961 }
4962 }
4963 }
4964 ++v3;
4965 ++v4;
4966 }
4967 while ( v3 < (signed int)uNumActors );
4968 } 4852 }
4969 return v19; 4853 return v19;
4970 } 4854 }
4971 4855
4972 //----- (0046BDA8) -------------------------------------------------------- 4856 //----- (0046BDA8) --------------------------------------------------------
4997 } 4881 }
4998 4882
4999 //----- (0046BFFA) -------------------------------------------------------- 4883 //----- (0046BFFA) --------------------------------------------------------
5000 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) 4884 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2)
5001 { 4885 {
5002 //SpriteObject *v2; // esi@1 4886 ObjectDesc *object; // ebx@1
5003 ObjectDesc *v3; // ebx@1
5004 unsigned __int16 v5; // cx@9
5005 //unsigned __int16 v6; // cx@14
5006 //signed int v7; // edx@14
5007 unsigned int v8; // eax@19 4887 unsigned int v8; // eax@19
5008 unsigned int v9; // edi@19
5009 signed int v10; // ebx@19 4888 signed int v10; // ebx@19
5010 char *v11; // edx@20 4889 char *v11; // edx@20
5011 unsigned __int16 v12; // ax@23 4890 unsigned __int16 v12; // ax@23
5012 int v13; // eax@27 4891 int v13; // eax@27
5013 unsigned int v14; // ebx@33 4892 unsigned int v14; // ebx@33
5014 //unsigned __int16 v15; // ax@35
5015 int v16; // eax@36 4893 int v16; // eax@36
5016 unsigned int v17; // eax@37 4894 unsigned int v17; // eax@37
5017 __int16 v18; // di@37 4895 __int16 v18; // di@37
5018 signed int v19; // edx@37 4896 signed int v19; // edx@37
5019 unsigned __int8 v20; // sf@37 4897 unsigned __int8 v20; // sf@37
5045 unsigned __int16 v46; // ax@80 4923 unsigned __int16 v46; // ax@80
5046 int v47; // eax@81 4924 int v47; // eax@81
5047 int v48; // edx@87 4925 int v48; // edx@87
5048 int v49; // edx@88 4926 int v49; // edx@88
5049 int v50; // edx@89 4927 int v50; // edx@89
5050 unsigned int v51; // eax@93
5051 signed int v52; // ebx@93 4928 signed int v52; // ebx@93
5052 char *v53; // edx@94 4929 char *v53; // edx@94
5053 unsigned __int16 v54; // ax@98 4930 unsigned __int16 v54; // ax@98
5054 unsigned int v55; // ecx@98 4931 unsigned int v55; // ecx@98
5055 signed int v56; // ebx@98 4932 signed int v56; // ebx@98
5067 unsigned int v68; // ecx@124 4944 unsigned int v68; // ecx@124
5068 signed int v69; // ebx@124 4945 signed int v69; // ebx@124
5069 char *v70; // edx@125 4946 char *v70; // edx@125
5070 unsigned __int16 v71; // ax@128 4947 unsigned __int16 v71; // ax@128
5071 unsigned int v72; // ebx@131 4948 unsigned int v72; // ebx@131
5072 //int v73; // ST14_4@132
5073 //int v74; // ST10_4@132
5074 //int v75; // ebx@132
5075 //int v76; // ST0C_4@132
5076 //unsigned __int16 v77; // ax@132
5077 int v78; // eax@133 4949 int v78; // eax@133
5078 char v79; // zf@139 4950 char v79; // zf@139
5079 unsigned int v80; // eax@140 4951 unsigned int v80; // eax@140
5080 signed int v81; // edx@140 4952 signed int v81; // edx@140
5081 char *v82; // ecx@141 4953 char *v82; // ecx@141
5093 char *v94; // ecx@178 4965 char *v94; // ecx@178
5094 unsigned __int16 v95; // ax@181 4966 unsigned __int16 v95; // ax@181
5095 unsigned __int16 v96; // ax@184 4967 unsigned __int16 v96; // ax@184
5096 int v97; // eax@185 4968 int v97; // eax@185
5097 unsigned __int16 v98; // ax@191 4969 unsigned __int16 v98; // ax@191
5098 unsigned int v99; // ecx@191
5099 char v100; // ST18_1@198 4970 char v100; // ST18_1@198
5100 //int v101; // ST14_4@198
5101 int v102; // eax@198 4971 int v102; // eax@198
5102 //int v103; // ST10_4@198
5103 //int v104; // ST0C_4@198
5104 //unsigned __int16 v105; // ax@200
5105 signed int v106; // eax@208 4972 signed int v106; // eax@208
5106 unsigned int v107; // edx@220 4973 unsigned int v107; // edx@220
5107 signed int v108; // ebx@225 4974 signed int v108; // ebx@225
5108 unsigned int v109; // eax@234 4975 unsigned int v109; // eax@234
5109 signed int v110; // ebx@234 4976 signed int v110; // ebx@234
5110 char *v111; // ecx@235 4977 char *v111; // ecx@235
5111 unsigned __int16 v112; // ax@238 4978 unsigned __int16 v112; // ax@238
5112 unsigned __int16 v113; // si@241 4979 unsigned __int16 v113; // si@241
5113 int v114; // eax@242 4980 int v114; // eax@242
5114 int v115; // eax@245 4981 int v115; // eax@245
5115 //signed int v116; // eax@245
5116 unsigned __int16 v117; // ax@251 4982 unsigned __int16 v117; // ax@251
5117 unsigned int v118; // ecx@251 4983 unsigned int v118; // ecx@251
5118 signed int v119; // ebx@251 4984 signed int v119; // ebx@251
5119 char *v120; // edx@252 4985 char *v120; // edx@252
5120 unsigned __int16 v121; // ax@255 4986 unsigned __int16 v121; // ax@255
5121 unsigned int v122; // eax@260 4987 unsigned int v122; // eax@260
5122 char *v123; // edx@261 4988 char *v123; // edx@261
5123 int v124; // eax@267 4989 int v124; // eax@267
5124 int v125; // [sp-20h] [bp-4Ch]@28 4990 int v125; // [sp-20h] [bp-4Ch]@28
5125 //signed int v126; // [sp-1Ch] [bp-48h]@27
5126 //unsigned int v127; // [sp-18h] [bp-44h]@27
5127 //signed int v128; // [sp-14h] [bp-40h]@27
5128 //signed int v129; // [sp-10h] [bp-3Ch]@27
5129 //int v130; // [sp-Ch] [bp-38h]@27
5130 //unsigned int v131; // [sp-8h] [bp-34h]@27
5131 char v132; // [sp-8h] [bp-34h]@131 4991 char v132; // [sp-8h] [bp-34h]@131
5132 //int v133; // [sp-4h] [bp-30h]@27
5133 char v134; // [sp-4h] [bp-30h]@131 4992 char v134; // [sp-4h] [bp-30h]@131
5134 signed int v135; // [sp-4h] [bp-30h]@217 4993 signed int v135; // [sp-4h] [bp-30h]@217
5135 int v136; // [sp+Ch] [bp-20h]@208 4994 int v136; // [sp+Ch] [bp-20h]@208
5136 int v137; // [sp+10h] [bp-1Ch]@208 4995 int v137; // [sp+10h] [bp-1Ch]@208
5137 signed int v138; // [sp+14h] [bp-18h]@207 4996 signed int v138; // [sp+14h] [bp-18h]@207
5139 char *v140; // [sp+1Ch] [bp-10h]@61 4998 char *v140; // [sp+1Ch] [bp-10h]@61
5140 signed int v141; // [sp+1Ch] [bp-10h]@117 4999 signed int v141; // [sp+1Ch] [bp-10h]@117
5141 unsigned int v142; // [sp+1Ch] [bp-10h]@158 5000 unsigned int v142; // [sp+1Ch] [bp-10h]@158
5142 signed int v143; // [sp+1Ch] [bp-10h]@172 5001 signed int v143; // [sp+1Ch] [bp-10h]@172
5143 char *v144; // [sp+1Ch] [bp-10h]@192 5002 char *v144; // [sp+1Ch] [bp-10h]@192
5144 signed int v145; // [sp+20h] [bp-Ch]@1
5145 signed int v146; // [sp+20h] [bp-Ch]@60 5003 signed int v146; // [sp+20h] [bp-Ch]@60
5146 int v147; // [sp+20h] [bp-Ch]@72 5004 int v147; // [sp+20h] [bp-Ch]@72
5147 signed int v148; // [sp+20h] [bp-Ch]@158 5005 signed int v148; // [sp+20h] [bp-Ch]@158
5148 //int v149; // [sp+20h] [bp-Ch]@198
5149 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 5006 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208
5150 int v151; // [sp+24h] [bp-8h]@1
5151 signed int v152; // [sp+24h] [bp-8h]@208 5007 signed int v152; // [sp+24h] [bp-8h]@208
5152 unsigned int v153; // [sp+28h] [bp-4h]@1 5008
5153 5009 //ïðèìåíåíèå: ôàåðáîëò â õðàìå ëóíû
5154 v153 = uLayingItemID; 5010 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
5155 //v2 = &pSpriteObjects[uLayingItemID]; 5011 //v151 = PID_TYPE(a2);
5156 v3 = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
5157 v145 = a2;
5158 v151 = PID_TYPE(a2);
5159 if ( PID_TYPE(a2) == OBJECT_Actor) 5012 if ( PID_TYPE(a2) == OBJECT_Actor)
5160 { 5013 {
5161 if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor 5014 if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor
5162 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) 5015 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) )
5163 return 1; 5016 return 1;
5167 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player) 5020 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player)
5168 return 1; 5021 return 1;
5169 } 5022 }
5170 if ( pParty->bTurnBasedModeOn == 1 ) 5023 if ( pParty->bTurnBasedModeOn == 1 )
5171 { 5024 {
5172 v5 = pSpriteObjects[uLayingItemID].uAttributes; 5025 if ( pSpriteObjects[uLayingItemID].uAttributes & 4 )
5173 if ( v5 & 4 )
5174 { 5026 {
5175 --pTurnEngine->pending_actions; 5027 --pTurnEngine->pending_actions;
5176 pSpriteObjects[uLayingItemID].uAttributes = v5 & 0xFFFB; 5028 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB;
5177 } 5029 }
5178 } 5030 }
5179 if ( v151 == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) 5031 if ( PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
5180 { 5032 {
5181 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 5033 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000
5182 BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4; 5034 BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4;
5183 } 5035 }
5184 5036
5196 { 5048 {
5197 if ( pSpriteObjects[uLayingItemID].uType != 9040 ) 5049 if ( pSpriteObjects[uLayingItemID].uType != 9040 )
5198 { 5050 {
5199 if ( pSpriteObjects[uLayingItemID].uType != 9080 ) 5051 if ( pSpriteObjects[uLayingItemID].uType != 9080 )
5200 return 0; 5052 return 0;
5201 LABEL_191: 5053 v95 = 0;
5202 v98 = pSpriteObjects[uLayingItemID].uType + 1; 5054 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
5203 v99 = pObjectList->uNumObjects; 5055 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 )
5204 v32 = 0;
5205 pSpriteObjects[uLayingItemID].uType = v98;
5206 v146 = 0;
5207 if ( (signed int)v99 > 0 )
5208 { 5056 {
5209 v144 = (char *)&pObjectList->pObjects->uObjectID; 5057 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID )
5210 while ( v98 != *(short *)v144 ) 5058 v95 = v146;
5211 {
5212 ++v146;
5213 v144 += 56;
5214 if ( v146 >= (signed int)v99 )
5215 {
5216 pSpriteObjects[uLayingItemID].uObjectDescID = 0;
5217 if ( !v32 )
5218 SpriteObject::OnInteraction(v153);
5219 v100 = pSpriteObjects[uLayingItemID].field_61;
5220 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
5221 v102 = 8 * v153;
5222 LOBYTE(v102) = PID(OBJECT_Item,v153);
5223 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
5224 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
5225 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
5226 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
5227 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
5228 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
5229 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
5230 v47 = 0;
5231 else
5232 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5233 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5234 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
5235 return 0;
5236 }
5237 }
5238 pSpriteObjects[uLayingItemID].uObjectDescID = v146;
5239 if ( v146 == (short)v32 )
5240 SpriteObject::OnInteraction(v153);
5241 v100 = pSpriteObjects[uLayingItemID].field_61;
5242 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
5243 v102 = 8 * v153;
5244 LOBYTE(v102) = PID(OBJECT_Item,v153);
5245 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
5246 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
5247 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
5248 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
5249 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
5250 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
5251 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
5252 v47 = 0;
5253 else
5254 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5255 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5256 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
5257 return 0;
5258 } 5059 }
5259 pSpriteObjects[uLayingItemID].uObjectDescID = 0; 5060 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5260 if ( !v32 ) 5061 if ( !v95 )
5261 SpriteObject::OnInteraction(v153); 5062 SpriteObject::OnInteraction(uLayingItemID);
5262 v100 = pSpriteObjects[uLayingItemID].field_61; 5063 v100 = pSpriteObjects[uLayingItemID].field_61;
5263 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; 5064 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5264 v102 = 8 * v153; 5065 v102 = 8 * uLayingItemID;
5265 LOBYTE(v102) = PID(OBJECT_Item,v153); 5066 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
5266 pSpriteObjects[uLayingItemID].vVelocity.x = v32; 5067 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5267 pSpriteObjects[uLayingItemID].vVelocity.y = v32; 5068 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5268 pSpriteObjects[uLayingItemID].vVelocity.z = v32; 5069 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5269 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); 5070 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
5270 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) 5071 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
5271 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); 5072 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
5272 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) 5073 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5273 v47 = 0; 5074 v47 = 0;
5274 else 5075 else
5275 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5076 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5276 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5077 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5277 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); 5078 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
5278 return 0; 5079 return 0;
5279 } 5080 }
5280 goto LABEL_93; 5081 sub_43A97E(uLayingItemID, a2);
5082 ++pSpriteObjects[uLayingItemID].uType;
5083 v95 = 0;
5084 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5085 {
5086 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5087 v95 = v52;
5088 }
5089 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5090 if ( !v95 )
5091 SpriteObject::OnInteraction(uLayingItemID);
5092 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5093 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5094 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5095 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5096 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5097 if ( !v96 )
5098 v97 = 0;
5099 else
5100 v97 = (signed __int16)v96 + 4;
5101 v124 = 8 * uLayingItemID;
5102 LOBYTE(v124) = v124 | 2;
5103 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5104 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5105 return 0;
5281 } 5106 }
5282 LABEL_172: 5107 LABEL_172:
5283 v143 = 17030; 5108 v143 = 17030;
5284 switch ( pSpriteObjects[uLayingItemID].uType ) 5109 switch ( pSpriteObjects[uLayingItemID].uType )
5285 { 5110 {
5292 case 0x2346u: 5117 case 0x2346u:
5293 v143 = 18030; 5118 v143 = 18030;
5294 break; 5119 break;
5295 } 5120 }
5296 v138 = 1; 5121 v138 = 1;
5297 if ( v151 != OBJECT_Actor) 5122 if ( PID_TYPE(a2) != OBJECT_Actor)
5298 { 5123 {
5299 if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) 5124 if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 )
5300 { 5125 {
5301 SpriteObject::OnInteraction(v153); 5126 SpriteObject::OnInteraction(uLayingItemID);
5302 return 0; 5127 return 0;
5303 } 5128 }
5304 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); 5129 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe();
5305 LABEL_233: 5130 LABEL_233:
5306 if ( !v138 ) 5131 if ( !v138 )
5307 { 5132 {
5308 v109 = pObjectList->uNumObjects;
5309 ++pSpriteObjects[uLayingItemID].uType; 5133 ++pSpriteObjects[uLayingItemID].uType;
5310 v110 = 0; 5134 v112 = 0;
5311 if ( (signed int)v109 <= 0 ) 5135 for ( v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110 )
5312 { 5136 {
5313 LABEL_238: 5137 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID )
5314 v112 = 0; 5138 v112 = v110;
5315 }
5316 else
5317 {
5318 v111 = (char *)&pObjectList->pObjects->uObjectID;
5319 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v111 )
5320 {
5321 ++v110;
5322 v111 += 56;
5323 if ( v110 >= (signed int)v109 )
5324 goto LABEL_238;
5325 }
5326 v112 = v110;
5327 } 5139 }
5328 pSpriteObjects[uLayingItemID].uObjectDescID = v112; 5140 pSpriteObjects[uLayingItemID].uObjectDescID = v112;
5329 if ( !v112 ) 5141 if ( !v112 )
5330 SpriteObject::OnInteraction(v153); 5142 SpriteObject::OnInteraction(uLayingItemID);
5331 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5143 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5332 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5144 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5333 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5145 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5334 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; 5146 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5335 v113 = pSpriteObjects[uLayingItemID].uSoundID; 5147 v113 = pSpriteObjects[uLayingItemID].uSoundID;
5336 if ( v113 ) 5148 if ( v113 )
5337 v114 = (signed __int16)v113 + 4; 5149 v114 = (signed __int16)v113 + 4;
5338 else 5150 else
5339 v114 = 0; 5151 v114 = 0;
5340 v115 = 8 * v153; 5152 v115 = 8 * uLayingItemID;
5341 LOBYTE(v115) = PID(OBJECT_Item,v153); 5153 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID);
5342 v125 = v143 + 1; 5154 v125 = v143 + 1;
5343 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); 5155 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0);
5344 return 0; 5156 return 0;
5345 } 5157 }
5346 SpriteObject::OnInteraction(v153); 5158 SpriteObject::OnInteraction(uLayingItemID);
5347 return 0; 5159 return 0;
5348 } 5160 }
5349 v106 = v145; 5161 v106 = a2;
5350 v150 = 0; 5162 v150 = 0;
5351 v139 = PID_ID(v106); 5163 v139 = PID_ID(v106);
5352 v137 = pSpriteObjects[uLayingItemID].spell_level; 5164 v137 = pSpriteObjects[uLayingItemID].spell_level;
5353 v152 = pSpriteObjects[uLayingItemID].spell_skill; 5165 v152 = pSpriteObjects[uLayingItemID].spell_skill;
5354 v136 = pSpriteObjects[uLayingItemID].spell_id; 5166 v136 = pSpriteObjects[uLayingItemID].spell_id;
5410 } 5222 }
5411 } 5223 }
5412 v107 = v135; 5224 v107 = v135;
5413 goto LABEL_222; 5225 goto LABEL_222;
5414 } 5226 }
5415 if ( pSpriteObjects[uLayingItemID].uType == 8090 || pSpriteObjects[uLayingItemID].uType == 7030 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) 5227 if ( pSpriteObjects[uLayingItemID].uType == 8090
5416 goto LABEL_93; 5228 || pSpriteObjects[uLayingItemID].uType == 7030
5229 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 )
5230 {
5231 sub_43A97E(uLayingItemID, a2);
5232 ++pSpriteObjects[uLayingItemID].uType;
5233 v95 = 0;
5234 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5235 {
5236 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5237 v95 = v52;
5238 }
5239 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5240 if ( !v95 )
5241 SpriteObject::OnInteraction(uLayingItemID);
5242 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5243 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5244 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5245 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5246 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5247 if ( !v96 )
5248 v97 = 0;
5249 else
5250 v97 = (signed __int16)v96 + 4;
5251 v124 = 8 * uLayingItemID;
5252 LOBYTE(v124) = v124 | 2;
5253 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5254 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5255 return 0;
5256 }
5417 if ( pSpriteObjects[uLayingItemID].uType == 8010 ) 5257 if ( pSpriteObjects[uLayingItemID].uType == 8010 )
5418 { 5258 {
5419 if ( v151 == 3 5259 if ( PID_TYPE(a2) == 3
5420 && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) 5260 && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
5421 sub_43A97E(v153, v145); 5261 sub_43A97E(uLayingItemID, a2);
5422 v93 = pObjectList->uNumObjects;
5423 ++pSpriteObjects[uLayingItemID].uType; 5262 ++pSpriteObjects[uLayingItemID].uType;
5424 v9 = 0; 5263 //v9 = 0;
5425 v52 = 0; 5264 v95 = 0;
5426 if ( (signed int)v93 > 0 ) 5265 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5427 { 5266 {
5428 v94 = (char *)&pObjectList->pObjects->uObjectID; 5267 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5429 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v94 ) 5268 v95 = v52;
5430 {
5431 ++v52;
5432 v94 += 56;
5433 if ( v52 >= (signed int)v93 )
5434 goto LABEL_181;
5435 }
5436 v95 = v52;
5437 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5438 if ( v95 == (short)v9 )
5439 SpriteObject::OnInteraction(v153);
5440 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5441 pSpriteObjects[uLayingItemID].vVelocity.z = v9;
5442 pSpriteObjects[uLayingItemID].vVelocity.y = v9;
5443 pSpriteObjects[uLayingItemID].vVelocity.x = v9;
5444 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9;
5445 if ( v96 == (short)v9 )
5446 v97 = 0;
5447 else
5448 v97 = (signed __int16)v96 + 4;
5449 v92 = v153;
5450 v124 = 8 * v92;
5451 LOBYTE(v124) = v124 | 2;
5452 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5453 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9);
5454 return 0;
5455 } 5269 }
5456 goto LABEL_181; 5270 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5271 if ( !v95 )
5272 SpriteObject::OnInteraction(uLayingItemID);
5273 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5274 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5275 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5276 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5277 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5278 if ( !v96 )
5279 v97 = 0;
5280 else
5281 v97 = (signed __int16)v96 + 4;
5282 v92 = uLayingItemID;
5283 v124 = 8 * v92;
5284 LOBYTE(v124) = v124 | 2;
5285 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5286 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5287 return 0;
5457 } 5288 }
5458 v79 = pSpriteObjects[uLayingItemID].uType == 8030; 5289 v79 = pSpriteObjects[uLayingItemID].uType == 8030;
5459 } 5290 }
5460 else 5291 else
5461 { 5292 {
5462 if ( pSpriteObjects[uLayingItemID].uType == 6090 ) 5293 if ( pSpriteObjects[uLayingItemID].uType == 6090 )
5463 goto LABEL_93; 5294 {
5295 sub_43A97E(uLayingItemID, a2);
5296 ++pSpriteObjects[uLayingItemID].uType;
5297 v95 = 0;
5298 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5299 {
5300 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5301 v95 = v52;
5302 }
5303 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5304 if ( !v95 )
5305 SpriteObject::OnInteraction(uLayingItemID);
5306 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5307 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5308 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5309 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5310 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5311 if ( !v96 )
5312 v97 = 0;
5313 else
5314 v97 = (signed __int16)v96 + 4;
5315 v124 = 8 * uLayingItemID;
5316 LOBYTE(v124) = v124 | 2;
5317 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5318 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5319 return 0;
5320 }
5464 if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) 5321 if ( pSpriteObjects[uLayingItemID].uType <= 4070 )
5465 { 5322 {
5466 if ( pSpriteObjects[uLayingItemID].uType != 4070 ) 5323 if ( pSpriteObjects[uLayingItemID].uType != 4070 )
5467 { 5324 {
5468 v48 = pSpriteObjects[uLayingItemID].uType - 3090; 5325 v48 = pSpriteObjects[uLayingItemID].uType - 3090;
5470 { 5327 {
5471 v49 = v48 - 2; 5328 v49 = v48 - 2;
5472 if ( v49 ) 5329 if ( v49 )
5473 { 5330 {
5474 v50 = v49 - 908; 5331 v50 = v49 - 908;
5475 if ( !v50 ) 5332 if ( v49 == 908 )
5476 goto LABEL_93; 5333 {
5334 sub_43A97E(uLayingItemID, a2);
5335 ++pSpriteObjects[uLayingItemID].uType;
5336 v95 = 0;
5337 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5338 {
5339 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5340 v95 = v52;
5341 }
5342 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5343 if ( !v95 )
5344 SpriteObject::OnInteraction(uLayingItemID);
5345 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5346 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5347 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5348 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5349 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5350 if ( !v96 )
5351 v97 = 0;
5352 else
5353 v97 = (signed __int16)v96 + 4;
5354 v124 = 8 * uLayingItemID;
5355 LOBYTE(v124) = v124 | 2;
5356 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5357 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5358 return 0;
5359 }
5477 v45 = v50 - 30; 5360 v45 = v50 - 30;
5478 v44 = v45 == 0; 5361 v44 = v45 == 0;
5479 goto LABEL_91; 5362 goto LABEL_91;
5480 } 5363 }
5481 v54 = pSpriteObjects[uLayingItemID].uType - 1; 5364 //v9 = 0;
5482 v55 = pObjectList->uNumObjects; 5365 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType - 1;
5483 v9 = 0; 5366 v58 = 0;
5484 v56 = 0; 5367 for ( v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56 )
5485 v44 = pObjectList->uNumObjects == 0;
5486 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5487 pSpriteObjects[uLayingItemID].uType = v54;
5488 if ( v20 | v44 )
5489 { 5368 {
5490 LABEL_102: 5369 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID )
5491 v58 = 0; 5370 v58 = v56;
5492 }
5493 else
5494 {
5495 v57 = (char *)&pObjectList->pObjects->uObjectID;
5496 while ( v54 != *(short *)v57 )
5497 {
5498 ++v56;
5499 v57 += 56;
5500 if ( v56 >= (signed int)v55 )
5501 goto LABEL_102;
5502 }
5503 v58 = v56;
5504 } 5371 }
5505 pSpriteObjects[uLayingItemID].uObjectDescID = v58; 5372 pSpriteObjects[uLayingItemID].uObjectDescID = v58;
5506 if ( !v58 ) 5373 if ( !v58 )
5507 SpriteObject::OnInteraction(v153); 5374 SpriteObject::OnInteraction(uLayingItemID);
5508 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5375 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5509 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5376 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5510 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5377 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5511 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; 5378 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5512 sub_43A97E(v153, v145); 5379 sub_43A97E(uLayingItemID, a2);
5513 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) 5380 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5514 v16 = 0; 5381 v16 = 0;
5515 else 5382 else
5516 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5383 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5517 v124 = 8 * v153; 5384 v124 = 8 * uLayingItemID;
5518 LOBYTE(v124) = v124 | 2; 5385 LOBYTE(v124) = v124 | 2;
5519 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5386 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5520 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); 5387 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
5521 return 0; 5388 return 0;
5522 } 5389 }
5523 v59 = pSpriteObjects[uLayingItemID].uType + 2; 5390 //v9 = 0;
5524 v60 = pObjectList->uNumObjects; 5391 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2;
5525 v9 = 0; 5392 v63 = 0;
5526 v61 = 0; 5393 for ( v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61 )
5527 v44 = pObjectList->uNumObjects == 0;
5528 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5529 pSpriteObjects[uLayingItemID].uType = v59;
5530 if ( v20 | v44 )
5531 { 5394 {
5532 LABEL_111: 5395 if ( v59 == pObjectList->pObjects[v61].uObjectID )
5533 v63 = 0; 5396 v63 = v61;
5534 }
5535 else
5536 {
5537 v62 = (char *)&pObjectList->pObjects->uObjectID;
5538 while ( v59 != *(short *)v62 )
5539 {
5540 ++v61;
5541 v62 += 56;
5542 if ( v61 >= (signed int)v60 )
5543 goto LABEL_111;
5544 }
5545 v63 = v61;
5546 } 5397 }
5547 pSpriteObjects[uLayingItemID].uObjectDescID = v63; 5398 pSpriteObjects[uLayingItemID].uObjectDescID = v63;
5548 if ( !v63 ) 5399 if ( !v63 )
5549 SpriteObject::OnInteraction(v153); 5400 SpriteObject::OnInteraction(uLayingItemID);
5550 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; 5401 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
5551 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4; 5402 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4;
5552 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5403 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5553 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5404 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5554 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5405 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5558 if ( v65 > 0 ) 5409 if ( v65 > 0 )
5559 { 5410 {
5560 v141 = v65; 5411 v141 = v65;
5561 do 5412 do
5562 { 5413 {
5563 v64 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; 5414 v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2;
5564 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); 5415 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0);
5565 --v141; 5416 --v141;
5566 } 5417 }
5567 while ( v141 ); 5418 while ( v141 );
5568 } 5419 }
5569 SpriteObject::OnInteraction(v153); 5420 SpriteObject::OnInteraction(uLayingItemID);
5570 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) 5421 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5571 v16 = 0; 5422 v16 = 0;
5572 else 5423 else
5573 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5424 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5574 v124 = 8 * v153; 5425 v124 = 8 * uLayingItemID;
5575 LOBYTE(v124) = v124 | 2; 5426 LOBYTE(v124) = v124 | 2;
5576 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5427 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5577 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); 5428 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
5578 return 0; 5429 return 0;
5579 } 5430 }
5580 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) 5431 //v66 = 0;
5432 if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) )
5581 return 1; 5433 return 1;
5582 v67 = pSpriteObjects[uLayingItemID].uType + 1; 5434 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
5583 v68 = pObjectList->uNumObjects; 5435 v71 = 0;
5584 v69 = 0; 5436 for ( v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69 )
5585 v44 = pObjectList->uNumObjects == 0;
5586 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5587 pSpriteObjects[uLayingItemID].uType = v67;
5588 if ( v20 | v44 )
5589 { 5437 {
5590 LABEL_128: 5438 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID )
5591 v71 = 0; 5439 v71 = v69;
5592 }
5593 else
5594 {
5595 v70 = (char *)&pObjectList->pObjects->uObjectID;
5596 while ( v67 != *(short *)v70 )
5597 {
5598 ++v69;
5599 v70 += 56;
5600 if ( v69 >= (signed int)v68 )
5601 goto LABEL_128;
5602 }
5603 v71 = v69;
5604 } 5440 }
5605 pSpriteObjects[uLayingItemID].uObjectDescID = v71; 5441 pSpriteObjects[uLayingItemID].uObjectDescID = v71;
5606 if ( !v71 ) 5442 if ( !v71 )
5607 SpriteObject::OnInteraction(v153); 5443 SpriteObject::OnInteraction(uLayingItemID);
5608 v134 = 0; 5444 v134 = 0;
5609 v72 = v153; 5445 v72 = uLayingItemID;
5610 v132 = 0; 5446 v132 = 0;
5611 pSpriteObjects[uLayingItemID].vVelocity.z = v66; 5447 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5612 pSpriteObjects[uLayingItemID].vVelocity.y = v66; 5448 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5613 pSpriteObjects[uLayingItemID].vVelocity.x = v66; 5449 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5614 pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; 5450 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5615 AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); 5451 AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
5616 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) 5452 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5617 v78 = 0; 5453 v78 = 0;
5618 else 5454 else
5619 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5455 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5620 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5456 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5621 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); 5457 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66);
5622 return 0; 5458 return 0;
5623 } 5459 }
5624 if ( pSpriteObjects[uLayingItemID].uType == 4090 ) 5460 if ( pSpriteObjects[uLayingItemID].uType == 4090 )
5625 { 5461 {
5626 v84 = pSpriteObjects[uLayingItemID].uType + 2; 5462 //v9 = 0;
5627 v85 = pObjectList->uNumObjects; 5463 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2;
5628 v9 = 0; 5464 v88 = 0;
5629 v86 = 0; 5465 for ( v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86 )
5630 v44 = pObjectList->uNumObjects == 0;
5631 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5632 pSpriteObjects[uLayingItemID].uType = v84;
5633 if ( v20 | v44 )
5634 { 5466 {
5635 LABEL_155: 5467 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID )
5636 v88 = 0; 5468 v88 = v86;
5637 }
5638 else
5639 {
5640 v87 = (char *)&pObjectList->pObjects->uObjectID;
5641 while ( v84 != *(short *)v87 )
5642 {
5643 ++v86;
5644 v87 += 56;
5645 if ( v86 >= (signed int)v85 )
5646 goto LABEL_155;
5647 }
5648 v88 = v86;
5649 } 5469 }
5650 pSpriteObjects[uLayingItemID].uObjectDescID = v88; 5470 pSpriteObjects[uLayingItemID].uObjectDescID = v88;
5651 if ( !v88 ) 5471 if ( !v88 )
5652 SpriteObject::OnInteraction(v153); 5472 SpriteObject::OnInteraction(uLayingItemID);
5653 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; 5473 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi;
5654 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5474 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5655 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5475 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5656 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5476 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5657 v142 = v89; 5477 v142 = v89;
5665 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; 5485 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1;
5666 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); 5486 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0);
5667 --v148; 5487 --v148;
5668 } 5488 }
5669 while ( v148 ); 5489 while ( v148 );
5670 SpriteObject::OnInteraction(v153); 5490 SpriteObject::OnInteraction(uLayingItemID);
5671 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) 5491 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5672 v16 = 0; 5492 v16 = 0;
5673 else 5493 else
5674 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5494 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5675 v124 = 8 * v153; 5495 v124 = 8 * uLayingItemID;
5676 LOBYTE(v124) = v124 | 2; 5496 LOBYTE(v124) = v124 | 2;
5677 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1; 5497 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1;
5678 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); 5498 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
5679 return 0; 5499 return 0;
5680 } 5500 }
5681 if ( pSpriteObjects[uLayingItemID].uType == 4092 ) 5501 if ( pSpriteObjects[uLayingItemID].uType == 4092 )
5682 { 5502 {
5683 v80 = pObjectList->uNumObjects; 5503 //v66 = 0;
5684 v66 = 0;
5685 v81 = 0;
5686 v44 = pObjectList->uNumObjects == 0;
5687 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5688 pSpriteObjects[uLayingItemID].uType = 4091; 5504 pSpriteObjects[uLayingItemID].uType = 4091;
5689 if ( v20 | v44 ) 5505 v83 = 0;
5506 for ( v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81 )
5690 { 5507 {
5691 LABEL_144: 5508 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID )
5692 v83 = 0; 5509 v83 = v81;
5693 }
5694 else
5695 {
5696 v82 = (char *)&pObjectList->pObjects->uObjectID;
5697 while ( *(short *)v82 != 4091 )
5698 {
5699 ++v81;
5700 v82 += 56;
5701 if ( v81 >= (signed int)v80 )
5702 goto LABEL_144;
5703 }
5704 v83 = v81;
5705 } 5510 }
5706 pSpriteObjects[uLayingItemID].uObjectDescID = v83; 5511 pSpriteObjects[uLayingItemID].uObjectDescID = v83;
5707 if ( !v83 ) 5512 if ( !v83 )
5708 SpriteObject::OnInteraction(v153); 5513 SpriteObject::OnInteraction(uLayingItemID);
5709 v134 = 0; 5514 v134 = 0;
5710 v72 = v153; 5515 //v72 = uLayingItemID;
5711 v132 = pSpriteObjects[uLayingItemID].field_61; 5516 v132 = pSpriteObjects[uLayingItemID].field_61;
5712 pSpriteObjects[uLayingItemID].vVelocity.z = v66; 5517 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5713 pSpriteObjects[uLayingItemID].vVelocity.y = v66; 5518 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5714 pSpriteObjects[uLayingItemID].vVelocity.x = v66; 5519 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5715 pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; 5520 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5716 AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); 5521 AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134);
5717 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) 5522 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5718 v78 = 0; 5523 v78 = 0;
5719 else 5524 else
5720 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5525 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5721 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5526 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5722 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); 5527 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0);
5723 return 0; 5528 return 0;
5724 } 5529 }
5725 if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) 5530 if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 )
5726 goto LABEL_93; 5531 {
5532 sub_43A97E(uLayingItemID, a2);
5533 ++pSpriteObjects[uLayingItemID].uType;
5534 v95 = 0;
5535 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5536 {
5537 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5538 v95 = v52;
5539 }
5540 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5541 if ( !v95 )
5542 SpriteObject::OnInteraction(uLayingItemID);
5543 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5544 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5545 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5546 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5547 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5548 if ( !v96 )
5549 v97 = 0;
5550 else
5551 v97 = (signed __int16)v96 + 4;
5552 v124 = 8 * uLayingItemID;
5553 LOBYTE(v124) = v124 | 2;
5554 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5555 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5556 return 0;
5557 }
5727 v79 = pSpriteObjects[uLayingItemID].uType == 6040; 5558 v79 = pSpriteObjects[uLayingItemID].uType == 6040;
5728 } 5559 }
5729 if ( !v79 ) 5560 if ( !v79 )
5730 return 0; 5561 return 0;
5731 goto LABEL_172; 5562 goto LABEL_172;
5732 } 5563 }
5733 if ( pSpriteObjects[uLayingItemID].uType == 3060 ) 5564 if ( pSpriteObjects[uLayingItemID].uType == 3060 )
5734 goto LABEL_93; 5565 {
5566 sub_43A97E(uLayingItemID, a2);
5567 ++pSpriteObjects[uLayingItemID].uType;
5568 v95 = 0;
5569 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5570 {
5571 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5572 v95 = v52;
5573 }
5574 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5575 if ( !v95 )
5576 SpriteObject::OnInteraction(uLayingItemID);
5577 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5578 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5579 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5580 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5581 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5582 if ( !v96 )
5583 v97 = 0;
5584 else
5585 v97 = (signed __int16)v96 + 4;
5586 v124 = 8 * uLayingItemID;
5587 LOBYTE(v124) = v124 | 2;
5588 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5589 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5590 return 0;
5591 }
5735 if ( pSpriteObjects[uLayingItemID].uType <= 555 ) 5592 if ( pSpriteObjects[uLayingItemID].uType <= 555 )
5736 { 5593 {
5737 if ( pSpriteObjects[uLayingItemID].uType == 555 ) 5594 if ( pSpriteObjects[uLayingItemID].uType == 555 )
5738 { 5595 {
5739 sub_43A97E(v153, v145); 5596 sub_43A97E(uLayingItemID, a2);
5740 v23 = pObjectList->uNumObjects;
5741 ++pSpriteObjects[uLayingItemID].uType; 5597 ++pSpriteObjects[uLayingItemID].uType;
5742 v18 = 0; 5598 v18 = 0;
5743 v24 = 0; 5599 v22 = 0;
5744 if ( (signed int)v23 <= 0 ) 5600 v25 = (char *)&pObjectList->pObjects->uObjectID;
5601 for ( v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24 )
5745 { 5602 {
5746 LABEL_41: 5603 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID )
5747 v22 = 0; 5604 v22 = v24;
5748 } 5605 }
5749 else
5750 {
5751 v25 = (char *)&pObjectList->pObjects->uObjectID;
5752 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v25 )
5753 {
5754 ++v24;
5755 v25 += 56;
5756 if ( v24 >= (signed int)v23 )
5757 goto LABEL_41;
5758 }
5759 v22 = v24;
5760 }
5761 LABEL_42:
5762 pSpriteObjects[uLayingItemID].uObjectDescID = v22; 5606 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
5763 if ( v22 == v18 ) 5607 if ( v22 == v18 )
5764 SpriteObject::OnInteraction(v153); 5608 SpriteObject::OnInteraction(uLayingItemID);
5765 pSpriteObjects[uLayingItemID].vVelocity.z = v18; 5609 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
5766 pSpriteObjects[uLayingItemID].vVelocity.y = v18; 5610 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
5767 pSpriteObjects[uLayingItemID].vVelocity.x = v18; 5611 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
5768 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; 5612 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
5769 } 5613 }
5778 case 520: 5622 case 520:
5779 case 525: 5623 case 525:
5780 case 530: 5624 case 530:
5781 case 535: 5625 case 535:
5782 case 540: 5626 case 540:
5783 sub_43A97E(v153, v145); 5627 sub_43A97E(uLayingItemID, a2);
5784 v8 = pObjectList->uNumObjects;
5785 ++pSpriteObjects[uLayingItemID].uType; 5628 ++pSpriteObjects[uLayingItemID].uType;
5786 v9 = 0; 5629 v12 = 0;
5787 v10 = 0; 5630 for ( v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10 )
5788 if ( (signed int)v8 <= 0 )
5789 { 5631 {
5790 v12 = 0; 5632 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID )
5791 goto LABEL_24; 5633 v12 = v10;
5792 } 5634 }
5793 v11 = (char *)&pObjectList->pObjects->uObjectID; 5635 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
5794 break; 5636 if ( !v12 )
5637 SpriteObject::OnInteraction(uLayingItemID);
5638 v44 = pSpriteObjects[uLayingItemID].uType == 555;
5639 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5640 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5641 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5642 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5643 if ( !v44 )
5644 {
5645 v13 = 8 * uLayingItemID;
5646 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
5647 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0);
5648 }
5649 return 0;
5795 case 545: 5650 case 545:
5796 case 550: 5651 case 550:
5797 if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) 5652 if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 )
5798 { 5653 {
5799 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5654 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5800 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5655 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5801 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5656 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5802 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; 5657 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5803 sub_43A97E(v153, v145); 5658 sub_43A97E(uLayingItemID, a2);
5804 SpriteObject::OnInteraction(v153); 5659 SpriteObject::OnInteraction(uLayingItemID);
5805 if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) 5660 if ( pSpriteObjects[uLayingItemID].uSoundID == 0 )
5806 v16 = 0; 5661 v16 = 0;
5807 else 5662 else
5808 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5663 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5809 v124 = 8 * v153; 5664 v124 = 8 * uLayingItemID;
5810 LOBYTE(v124) = v124 | 2; 5665 LOBYTE(v124) = v124 | 2;
5811 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; 5666 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1;
5812 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); 5667 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
5813 return 0; 5668 return 0;
5814 } 5669 }
5815 v17 = pObjectList->uNumObjects;
5816 v18 = 0; 5670 v18 = 0;
5817 v19 = 0;
5818 v44 = pObjectList->uNumObjects == 0;
5819 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5820 pSpriteObjects[uLayingItemID].uType = 600; 5671 pSpriteObjects[uLayingItemID].uType = 600;
5821 if ( v20 | v44 ) 5672 v22 = 0;
5822 goto LABEL_41; 5673 for ( v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19 )
5823 v21 = (char *)&pObjectList->pObjects->uObjectID;
5824 while ( *(short *)v21 != 600 )
5825 { 5674 {
5826 ++v19; 5675 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID )
5827 v21 += 56; 5676 v22 = v19;
5828 if ( v19 >= (signed int)v17 )
5829 goto LABEL_41;
5830 } 5677 }
5831 v22 = v19; 5678 pSpriteObjects[uLayingItemID].uObjectDescID = v22;
5832 goto LABEL_42; 5679 if ( !v22 )
5680 SpriteObject::OnInteraction(uLayingItemID);
5681 pSpriteObjects[uLayingItemID].vVelocity.z = v18;
5682 pSpriteObjects[uLayingItemID].vVelocity.y = v18;
5683 pSpriteObjects[uLayingItemID].vVelocity.x = v18;
5684 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18;
5833 default: 5685 default:
5834 return 0; 5686 return 0;
5835 } 5687 }
5836 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) 5688 v12 = 0;
5689 for ( v10; v10 < (signed int)v8; ++v10 )
5837 { 5690 {
5838 ++v10;
5839 v11 += 56; 5691 v11 += 56;
5840 if ( v10 >= (signed int)v8 ) 5692 if ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 )
5841 { 5693 v12 = v10;
5842 v12 = 0;
5843 goto LABEL_24;
5844 }
5845 } 5694 }
5846 v12 = v10;
5847 LABEL_24:
5848 pSpriteObjects[uLayingItemID].uObjectDescID = v12; 5695 pSpriteObjects[uLayingItemID].uObjectDescID = v12;
5849 if ( !v12 ) 5696 if ( !v12 )
5850 SpriteObject::OnInteraction(v153); 5697 SpriteObject::OnInteraction(uLayingItemID);
5851 v44 = pSpriteObjects[uLayingItemID].uType == 555; 5698 v44 = pSpriteObjects[uLayingItemID].uType == 555;
5852 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5699 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5853 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5700 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5854 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5701 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5855 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; 5702 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5856 if ( !v44 ) 5703 if ( !v44 )
5857 { 5704 {
5858 v13 = 8 * v153; 5705 v13 = 8 * uLayingItemID;
5859 LOBYTE(v13) = PID(OBJECT_Item,v153); 5706 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID);
5860 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); 5707 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0);
5861 return 0; 5708 return 0;
5862 } 5709 }
5863 } 5710 }
5864 return 0; 5711 return 0;
5865 } 5712 }
5870 goto LABEL_247; 5717 goto LABEL_247;
5871 v42 = v41 - 30; 5718 v42 = v41 - 30;
5872 if ( v42 ) 5719 if ( v42 )
5873 { 5720 {
5874 v43 = v42 - 40; 5721 v43 = v42 - 40;
5875 if ( !v43 ) 5722 if ( v42 == 40 )
5876 goto LABEL_59; 5723 {
5724 if ( PID_TYPE(a2) != 3 )
5725 {
5726 //v32 = 0;
5727 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
5728 v46 = 0;
5729 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 )
5730 {
5731 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID )
5732 v46 = v146;
5733 }
5734 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
5735 if ( !v46 )
5736 SpriteObject::OnInteraction(uLayingItemID);
5737 v100 = pSpriteObjects[uLayingItemID].field_61;
5738 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5739 v102 = 8 * uLayingItemID;
5740 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
5741 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5742 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5743 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5744 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
5745 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
5746 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
5747 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5748 v47 = 0;
5749 else
5750 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5751 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5752 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
5753 return 0;
5754 }
5755 return 1;
5756 }
5877 v45 = v43 - 910; 5757 v45 = v43 - 910;
5878 v44 = v45 == 0; 5758 v44 = v45 == 0;
5879 LABEL_91: 5759 LABEL_91:
5880 if ( !v44 && v45 != 20 ) 5760 if ( !v44 && v45 != 20 )
5881 return 0; 5761 return 0;
5882 } 5762 }
5883 LABEL_93: 5763 sub_43A97E(uLayingItemID, a2);
5884 sub_43A97E(v153, v145);
5885 v51 = pObjectList->uNumObjects;
5886 ++pSpriteObjects[uLayingItemID].uType; 5764 ++pSpriteObjects[uLayingItemID].uType;
5887 v9 = 0;
5888 v52 = 0;
5889 if ( (signed int)v51 > 0 )
5890 {
5891 v53 = (char *)&pObjectList->pObjects->uObjectID;
5892 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v53 )
5893 {
5894 ++v52;
5895 v53 += 56;
5896 if ( v52 >= (signed int)v51 )
5897 goto LABEL_181;
5898 }
5899 v95 = v52;
5900 }
5901 else
5902 {
5903 LABEL_181:
5904 v95 = 0; 5765 v95 = 0;
5905 } 5766 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5767 {
5768 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5769 v95 = v52;
5770 }
5906 pSpriteObjects[uLayingItemID].uObjectDescID = v95; 5771 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5907 if ( v95 == (short)v9 ) 5772 if ( !v95 )
5908 SpriteObject::OnInteraction(v153); 5773 SpriteObject::OnInteraction(uLayingItemID);
5909 v96 = pSpriteObjects[uLayingItemID].uSoundID; 5774 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5910 pSpriteObjects[uLayingItemID].vVelocity.z = v9; 5775 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5911 pSpriteObjects[uLayingItemID].vVelocity.y = v9; 5776 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5912 pSpriteObjects[uLayingItemID].vVelocity.x = v9; 5777 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5913 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; 5778 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5914 if ( v96 == (short)v9 ) 5779 if ( !v96 )
5915 v97 = 0; 5780 v97 = 0;
5916 else 5781 else
5917 v97 = (signed __int16)v96 + 4; 5782 v97 = (signed __int16)v96 + 4;
5918 v92 = v153; 5783 v124 = 8 * uLayingItemID;
5784 LOBYTE(v124) = v124 | 2;
5785 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5786 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5787 return 0;
5788 }
5789 if ( pSpriteObjects[uLayingItemID].uType == 1100 )
5790 {
5791 sub_43A97E(uLayingItemID, a2);
5792 ++pSpriteObjects[uLayingItemID].uType;
5793 v95 = 0;
5794 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5795 {
5796 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5797 v95 = v52;
5798 }
5799 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5800 if ( !v95 )
5801 SpriteObject::OnInteraction(uLayingItemID);
5802 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5803 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5804 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5805 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5806 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5807 if ( !v96 )
5808 v97 = 0;
5809 else
5810 v97 = (signed __int16)v96 + 4;
5811 v92 = uLayingItemID;
5919 v124 = 8 * v92; 5812 v124 = 8 * v92;
5920 LOBYTE(v124) = v124 | 2; 5813 LOBYTE(v124) = v124 | 2;
5921 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5814 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5922 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); 5815 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5923 return 0; 5816 return 0;
5924 } 5817 }
5925 if ( pSpriteObjects[uLayingItemID].uType == 1100 )
5926 goto LABEL_93;
5927 v26 = pSpriteObjects[uLayingItemID].uType - 600; 5818 v26 = pSpriteObjects[uLayingItemID].uType - 600;
5928 if ( !v26 ) 5819 if ( pSpriteObjects[uLayingItemID].uType == 600 )
5929 { 5820 {
5930 v33 = pObjectList->uNumObjects;
5931 v34 = 0;
5932 v44 = pObjectList->uNumObjects == 0;
5933 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
5934 pSpriteObjects[uLayingItemID].uType = 601; 5821 pSpriteObjects[uLayingItemID].uType = 601;
5935 if ( v20 | v44 ) 5822 v36 = 0;
5936 { 5823 for ( v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34 )
5937 LABEL_69: 5824 {
5938 v36 = 0; 5825 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID )
5939 } 5826 v36 = v34;
5940 else
5941 {
5942 v35 = (char *)&pObjectList->pObjects->uObjectID;
5943 while ( *(short *)v35 != 601 )
5944 {
5945 ++v34;
5946 v35 += 56;
5947 if ( v34 >= (signed int)v33 )
5948 goto LABEL_69;
5949 }
5950 v36 = v34;
5951 } 5827 }
5952 pSpriteObjects[uLayingItemID].uObjectDescID = v36; 5828 pSpriteObjects[uLayingItemID].uObjectDescID = v36;
5953 if ( !v36 ) 5829 if ( !v36 )
5954 SpriteObject::OnInteraction(v153); 5830 SpriteObject::OnInteraction(uLayingItemID);
5955 v37 = pSpriteObjects[uLayingItemID].vPosition.z; 5831 v37 = pSpriteObjects[uLayingItemID].vPosition.z;
5956 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5832 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5957 v38 = 8 * v153; 5833 v38 = 8 * uLayingItemID;
5958 v39 = pSpriteObjects[uLayingItemID].vPosition.y; 5834 v39 = pSpriteObjects[uLayingItemID].vPosition.y;
5959 LOBYTE(v38) = PID(OBJECT_Item,v153); 5835 LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID);
5960 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5836 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5961 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5837 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5962 v40 = pSpriteObjects[uLayingItemID].vPosition.x; 5838 v40 = pSpriteObjects[uLayingItemID].vPosition.x;
5963 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; 5839 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5964 v147 = v38; 5840 v147 = v38;
5965 AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); 5841 AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0);
5966 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) 5842 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
5967 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); 5843 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
5968 pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); 5844 pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0);
5969 return 0; 5845 return 0;
5970 } 5846 }
5971 v27 = v26 - 410; 5847 v27 = v26 - 410;
5972 if ( !v27 ) 5848 if ( v26 == 410 )
5973 goto LABEL_93; 5849 {
5850 sub_43A97E(uLayingItemID, a2);
5851 ++pSpriteObjects[uLayingItemID].uType;
5852 v95 = 0;
5853 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
5854 {
5855 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
5856 v95 = v52;
5857 }
5858 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5859 if ( !v95 )
5860 SpriteObject::OnInteraction(uLayingItemID);
5861 v96 = pSpriteObjects[uLayingItemID].uSoundID;
5862 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5863 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5864 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5865 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5866 if ( !v96 )
5867 v97 = 0;
5868 else
5869 v97 = (signed __int16)v96 + 4;
5870 v124 = 8 * uLayingItemID;
5871 LOBYTE(v124) = v124 | 2;
5872 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5873 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
5874 return 0;
5875 }
5974 v28 = v27 - 40; 5876 v28 = v27 - 40;
5975 if ( !v28 ) 5877 if ( !v28 )
5976 goto LABEL_191; 5878 {
5879 v95 = 0;
5880 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
5881 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 )
5882 {
5883 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID )
5884 v95 = v146;
5885 }
5886 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
5887 if ( !v95 )
5888 SpriteObject::OnInteraction(uLayingItemID);
5889 v100 = pSpriteObjects[uLayingItemID].field_61;
5890 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
5891 v102 = 8 * uLayingItemID;
5892 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
5893 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
5894 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
5895 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
5896 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
5897 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
5898 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
5899 if ( !pSpriteObjects[uLayingItemID].uSoundID )
5900 v47 = 0;
5901 else
5902 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
5903 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
5904 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
5905 return 0;
5906 }
5977 v29 = v28 - 10; 5907 v29 = v28 - 10;
5978 if ( v29 ) 5908 if ( v29 )
5979 { 5909 {
5980 if ( v29 != 20 ) 5910 if ( v29 != 20 )
5981 return 0; 5911 return 0;
5982 LABEL_59: 5912 if ( PID_TYPE(a2) != 3 )
5983 if ( v151 != 3 ) 5913 {
5984 { 5914 //v32 = 0;
5985 v30 = pSpriteObjects[uLayingItemID].uType + 1; 5915 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
5986 v31 = pObjectList->uNumObjects; 5916 v46 = 0;
5987 v32 = 0; 5917 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 )
5988 pSpriteObjects[uLayingItemID].uType = v30;
5989 v146 = 0;
5990 if ( (signed int)v31 > 0 )
5991 { 5918 {
5992 v140 = (char *)&pObjectList->pObjects->uObjectID; 5919 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID )
5993 while ( v30 != *(short *)v140 ) 5920 v46 = v146;
5994 {
5995 ++v146;
5996 v140 += 56;
5997 if ( v146 >= (signed int)v31 )
5998 {
5999 v46 = 0;
6000 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
6001 if ( v46 == (short)v32 )
6002 SpriteObject::OnInteraction(v153);
6003 v100 = pSpriteObjects[uLayingItemID].field_61;
6004 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
6005 v102 = 8 * v153;
6006 LOBYTE(v102) = PID(OBJECT_Item,v153);
6007 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
6008 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
6009 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
6010 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
6011 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
6012 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
6013 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
6014 v47 = 0;
6015 else
6016 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6017 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6018 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
6019 return 0;
6020 }
6021 }
6022 v46 = v146;
6023 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
6024 if ( v46 == (short)v32 )
6025 SpriteObject::OnInteraction(v153);
6026 v100 = pSpriteObjects[uLayingItemID].field_61;
6027 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32;
6028 v102 = 8 * v153;
6029 LOBYTE(v102) = PID(OBJECT_Item,v153);
6030 pSpriteObjects[uLayingItemID].vVelocity.x = v32;
6031 pSpriteObjects[uLayingItemID].vVelocity.y = v32;
6032 pSpriteObjects[uLayingItemID].vVelocity.z = v32;
6033 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32);
6034 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
6035 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor);
6036 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 )
6037 v47 = 0;
6038 else
6039 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6040 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6041 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32);
6042 return 0;
6043 } 5921 }
6044 v46 = 0;
6045 pSpriteObjects[uLayingItemID].uObjectDescID = v46; 5922 pSpriteObjects[uLayingItemID].uObjectDescID = v46;
6046 if ( v46 == (short)v32 ) 5923 if ( !v46 )
6047 SpriteObject::OnInteraction(v153); 5924 SpriteObject::OnInteraction(uLayingItemID);
6048 v100 = pSpriteObjects[uLayingItemID].field_61; 5925 v100 = pSpriteObjects[uLayingItemID].field_61;
6049 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; 5926 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
6050 v102 = 8 * v153; 5927 v102 = 8 * uLayingItemID;
6051 LOBYTE(v102) = PID(OBJECT_Item,v153); 5928 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID);
6052 pSpriteObjects[uLayingItemID].vVelocity.x = v32; 5929 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6053 pSpriteObjects[uLayingItemID].vVelocity.y = v32; 5930 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6054 pSpriteObjects[uLayingItemID].vVelocity.z = v32; 5931 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6055 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); 5932 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0);
6056 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) 5933 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
6057 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); 5934 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor);
6058 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) 5935 if ( !pSpriteObjects[uLayingItemID].uSoundID )
6059 v47 = 0; 5936 v47 = 0;
6060 else 5937 else
6061 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 5938 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6062 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5939 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6063 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); 5940 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0);
6064 return 0; 5941 return 0;
6065 } 5942 }
6066 return 1; 5943 return 1;
6067 } 5944 }
6068 LABEL_247: 5945 LABEL_247:
6069 if ( v151 == 6 || v151 == 5 || (v9 = 0, !v151) ) 5946 //v9 = 0;
5947 if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) )
6070 return 1; 5948 return 1;
6071 if ( v151 != 2 ) 5949 if ( PID_TYPE(a2) != 2 )
6072 { 5950 {
6073 sub_43A97E(v153, v145); 5951 sub_43A97E(uLayingItemID, a2);
6074 v122 = pObjectList->uNumObjects;
6075 ++pSpriteObjects[uLayingItemID].uType; 5952 ++pSpriteObjects[uLayingItemID].uType;
6076 v52 = 0; 5953 v95 = 0;
6077 if ( (signed int)v122 > 0 ) 5954 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 )
6078 { 5955 {
6079 v123 = (char *)&pObjectList->pObjects->uObjectID; 5956 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID )
6080 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v123 ) 5957 v95 = v52;
6081 { 5958 }
6082 ++v52; 5959 pSpriteObjects[uLayingItemID].uObjectDescID = v95;
6083 v123 += 56; 5960 if ( !v95 )
6084 if ( v52 >= (signed int)v122 ) 5961 SpriteObject::OnInteraction(uLayingItemID);
6085 goto LABEL_181; 5962 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6086 } 5963 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6087 v95 = v52; 5964 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6088 pSpriteObjects[uLayingItemID].uObjectDescID = v95; 5965 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
6089 if ( v95 == (short)v9 ) 5966 if ( !pSpriteObjects[uLayingItemID].uSoundID )
6090 SpriteObject::OnInteraction(v153); 5967 v97 = 0;
6091 v96 = pSpriteObjects[uLayingItemID].uSoundID; 5968 else
6092 pSpriteObjects[uLayingItemID].vVelocity.z = v9; 5969 v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6093 pSpriteObjects[uLayingItemID].vVelocity.y = v9; 5970 v124 = 8 * uLayingItemID;
6094 pSpriteObjects[uLayingItemID].vVelocity.x = v9; 5971 LOBYTE(v124) = v124 | 2;
6095 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; 5972 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6096 if ( v96 == (short)v9 ) 5973 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0);
6097 v97 = 0; 5974 return 0;
6098 else 5975 }
6099 v97 = (signed __int16)v96 + 4; 5976 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1;
6100 v92 = v153; 5977 v121 = 0;
6101 v124 = 8 * v92; 5978 for ( v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119 )
6102 LOBYTE(v124) = v124 | 2; 5979 {
6103 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; 5980 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID )
6104 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); 5981 v121 = v119;
6105 return 0;
6106 }
6107 goto LABEL_181;
6108 }
6109 v117 = pSpriteObjects[uLayingItemID].uType + 1;
6110 v118 = pObjectList->uNumObjects;
6111 v119 = 0;
6112 v44 = pObjectList->uNumObjects == 0;
6113 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0;
6114 pSpriteObjects[uLayingItemID].uType = v117;
6115 if ( v20 | v44 )
6116 {
6117 v121 = 0;
6118 }
6119 else
6120 {
6121 v120 = (char *)&pObjectList->pObjects->uObjectID;
6122 while ( v117 != *(short *)v120 )
6123 {
6124 ++v119;
6125 v120 += 56;
6126 if ( v119 >= (signed int)v118 )
6127 {
6128 v121 = 0;
6129 pSpriteObjects[uLayingItemID].uObjectDescID = v121;
6130 if ( !v121 )
6131 SpriteObject::OnInteraction(v153);
6132 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6133 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6134 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6135 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
6136 v13 = 8 * v153;
6137 LOBYTE(v13) = PID(OBJECT_Item,v153);
6138 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9);
6139 return 0;
6140 }
6141 }
6142 v121 = v119;
6143 } 5982 }
6144 pSpriteObjects[uLayingItemID].uObjectDescID = v121; 5983 pSpriteObjects[uLayingItemID].uObjectDescID = v121;
6145 if ( !v121 ) 5984 if ( !v121 )
6146 SpriteObject::OnInteraction(v153); 5985 SpriteObject::OnInteraction(uLayingItemID);
6147 pSpriteObjects[uLayingItemID].vVelocity.z = 0; 5986 pSpriteObjects[uLayingItemID].vVelocity.z = 0;
6148 pSpriteObjects[uLayingItemID].vVelocity.y = 0; 5987 pSpriteObjects[uLayingItemID].vVelocity.y = 0;
6149 pSpriteObjects[uLayingItemID].vVelocity.x = 0; 5988 pSpriteObjects[uLayingItemID].vVelocity.x = 0;
6150 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; 5989 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0;
6151 v13 = 8 * v153; 5990 v13 = 8 * uLayingItemID;
6152 LOBYTE(v13) = PID(OBJECT_Item,v153); 5991 LOBYTE(v13) = PID(OBJECT_Item,uLayingItemID);
6153 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); 5992 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0);
6154 return 0; 5993 return 0;
6155 } 5994 }