Mercurial > mm7
comparison mm7_3.cpp @ 826:1133e34a7560
Слияние
author | Ritor1 |
---|---|
date | Tue, 26 Mar 2013 23:19:12 +0600 |
parents | 35c31a49d989 fe4c8b113548 |
children | 085eb19b7ffd |
comparison
equal
deleted
inserted
replaced
825:35c31a49d989 | 826:1133e34a7560 |
---|---|
1388 { | 1388 { |
1389 //v3 = item->uObjectDescID; | 1389 //v3 = item->uObjectDescID; |
1390 v4 = &pObjectList->pObjects[item->uObjectDescID]; | 1390 v4 = &pObjectList->pObjects[item->uObjectDescID]; |
1391 if (item->AttachedToActor()) | 1391 if (item->AttachedToActor()) |
1392 { | 1392 { |
1393 v5 = item->field_5C >> 3; | 1393 v5 = item->spell_target_pid >> 3; |
1394 *(int *)(v2 - 26) = pActors[v5].vPosition.x; | 1394 *(int *)(v2 - 26) = pActors[v5].vPosition.x; |
1395 *(int *)(v2 - 22) = pActors[v5].vPosition.y; | 1395 *(int *)(v2 - 22) = pActors[v5].vPosition.y; |
1396 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | 1396 *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight; |
1397 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) | 1397 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) ) |
1398 goto LABEL_36; | 1398 goto LABEL_36; |
7722 } | 7722 } |
7723 return y3 - v10 > 512;*/ | 7723 return y3 - v10 > 512;*/ |
7724 } | 7724 } |
7725 | 7725 |
7726 //----- (0048257A) -------------------------------------------------------- | 7726 //----- (0048257A) -------------------------------------------------------- |
7727 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int a4) | 7727 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater) |
7728 { | 7728 { |
7729 unsigned int v4; // ebx@1 | 7729 //unsigned int v4; // ebx@1 |
7730 unsigned int v5; // edi@1 | 7730 //unsigned int v5; // edi@1 |
7731 int result; // eax@9 | 7731 int result; // eax@9 |
7732 int v7; // ebx@10 | 7732 //int v7; // ebx@10 |
7733 int v8; // ebx@11 | 7733 int v8; // ebx@11 |
7734 int v9; // eax@11 | 7734 int v9; // eax@11 |
7735 int v10; // ecx@11 | 7735 int v10; // ecx@11 |
7736 int v11; // [sp+Ch] [bp-Ch]@1 | 7736 //int v11; // [sp+Ch] [bp-Ch]@1 |
7737 int v12; // [sp+10h] [bp-8h]@1 | 7737 //int v12; // [sp+10h] [bp-8h]@1 |
7738 int v13; // [sp+10h] [bp-8h]@11 | 7738 int v13; // [sp+10h] [bp-8h]@11 |
7739 signed int v14; // [sp+14h] [bp-4h]@3 | 7739 signed int v14; // [sp+14h] [bp-4h]@3 |
7740 int v15; // [sp+24h] [bp+Ch]@11 | 7740 int v15; // [sp+24h] [bp+Ch]@11 |
7741 | 7741 |
7742 v11 = a1; | 7742 //v11 = a1; |
7743 v12 = a2; | 7743 //v12 = a2; |
7744 v4 = WorldPosToGridCellX(a1); | 7744 auto grid_x = WorldPosToGridCellX(a1); |
7745 v5 = WorldPosToGridCellZ(v12) - 1; | 7745 auto grid_z = WorldPosToGridCellZ(a2) - 1; |
7746 dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | 7746 |
7747 dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | 7747 auto grid_x1 = GridCellToWorldPosX(grid_x), |
7748 dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | 7748 grid_x2 = GridCellToWorldPosX(grid_x + 1); |
7749 dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | 7749 auto grid_z1 = GridCellToWorldPosZ(grid_z), |
7750 dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | 7750 grid_z2 = GridCellToWorldPosZ(grid_z + 1); |
7751 dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | 7751 |
7752 dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | 7752 auto y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z), |
7753 dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | 7753 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z), |
7754 dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | 7754 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1), |
7755 dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | 7755 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); |
7756 dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | 7756 //v4 = WorldPosToGridCellX(a1); |
7757 dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | 7757 //v5 = WorldPosToGridCellZ(v12) - 1; |
7758 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
7759 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
7760 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
7761 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
7762 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
7763 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
7764 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
7765 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
7766 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | |
7767 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | |
7768 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | |
7769 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | |
7758 *pIsOnWater = false; | 7770 *pIsOnWater = false; |
7759 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(v4, v5) & 2 ) | 7771 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 ) |
7760 *pIsOnWater = true; | 7772 *pIsOnWater = true; |
7761 v14 = 0; | 7773 v14 = 0; |
7762 if ( !a4 && *pIsOnWater ) | 7774 if ( !bFloatAboveWater && *pIsOnWater ) |
7763 v14 = -60; | 7775 v14 = -60; |
7764 if ( dword_76D518_terrain_cell_world_pos_around_party_y != dword_76D51C_terrain_cell_world_pos_around_party_y | 7776 if ( y_x1z1 != y_x2z1 || |
7765 || dword_76D51C_terrain_cell_world_pos_around_party_y != dword_76D520_terrain_cell_world_pos_around_party_y | 7777 y_x2z1 != y_x2z2 || |
7766 || dword_76D520_terrain_cell_world_pos_around_party_y != dword_76D524_terrain_cell_world_pos_around_party_y ) | 7778 y_x2z2 != y_x1z2 ) |
7767 { | 7779 { |
7768 v7 = abs(v11 - dword_76D538_terrain_cell_world_pos_around_party_x); | 7780 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) ) |
7769 if ( abs(dword_76D528_terrain_cell_world_pos_around_party_z - v12) >= v7 ) | 7781 { |
7770 { | 7782 v8 = y_x1z2; |
7771 v8 = dword_76D524_terrain_cell_world_pos_around_party_y; | 7783 v9 = y_x2z2; |
7772 v9 = dword_76D520_terrain_cell_world_pos_around_party_y; | 7784 v10 = y_x1z1; |
7773 v10 = dword_76D518_terrain_cell_world_pos_around_party_y; | 7785 v15 = a1 - grid_x1; |
7774 v15 = v11 - dword_76D544_terrain_cell_world_pos_around_party_x; | 7786 v13 = a2 - grid_z2; |
7775 v13 = v12 - dword_76D534_terrain_cell_world_pos_around_party_z; | |
7776 } | 7787 } |
7777 else | 7788 else |
7778 { | 7789 { |
7779 v8 = dword_76D51C_terrain_cell_world_pos_around_party_y; | 7790 v8 = y_x2z1; |
7780 v9 = dword_76D518_terrain_cell_world_pos_around_party_y; | 7791 v9 = y_x1z1; |
7781 v10 = dword_76D520_terrain_cell_world_pos_around_party_y; | 7792 v10 = y_x2z2; |
7782 v15 = dword_76D53C_terrain_cell_world_pos_around_party_x - v11; | 7793 v15 = grid_x2 - a1; |
7783 v13 = dword_76D52C_terrain_cell_world_pos_around_party_z - v12; | 7794 v13 = grid_z1 - a2; |
7784 } | 7795 } |
7785 result = v14 | 7796 return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128); |
7786 + v8 | |
7787 + ((unsigned __int64)(v13 * (signed __int64)((v10 - v8) << 7)) >> 16) | |
7788 + ((unsigned __int64)(v15 * (signed __int64)((v9 - v8) << 7)) >> 16); | |
7789 } | 7797 } |
7790 else | 7798 else |
7791 { | 7799 return y_x1z1; |
7792 result = v14 + dword_76D518_terrain_cell_world_pos_around_party_y; | |
7793 } | |
7794 return result; | |
7795 } | 7800 } |
7796 | 7801 |
7797 //----- (0048276F) -------------------------------------------------------- | 7802 //----- (0048276F) -------------------------------------------------------- |
7798 void stru148::_48276F_sr() | 7803 void stru148::_48276F_sr() |
7799 { | 7804 { |
11921 start_event_seq_number = 0; | 11926 start_event_seq_number = 0; |
11922 } | 11927 } |
11923 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) | 11928 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) |
11924 { | 11929 { |
11925 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; | 11930 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; |
11926 v20 = pOutdoor->uLastVisitDay; | 11931 v20 = pOutdoor->loc_time.uLastVisitDay; |
11927 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | 11932 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
11928 v20 = pIndoor->stru1.uLastVisitDay; | 11933 v20 = pIndoor->stru1.uLastVisitDay; |
11929 | 11934 |
11930 v3->timer_evt_type = _evt->_e_type; | 11935 v3->timer_evt_type = _evt->_e_type; |
11931 v3->timer_evt_ID = pEvent.uEventID; | 11936 v3->timer_evt_ID = pEvent.uEventID; |
12421 | 12426 |
12422 v0 = pFontArrus; | 12427 v0 = pFontArrus; |
12423 pFont = pFontArrus; | 12428 pFont = pFontArrus; |
12424 if ( ptr_F8B1E8 && !byte_5B0938[0] ) | 12429 if ( ptr_F8B1E8 && !byte_5B0938[0] ) |
12425 strcpy(byte_5B0938, ptr_F8B1E8); | 12430 strcpy(byte_5B0938, ptr_F8B1E8); |
12426 v5.uFrameWidth = 460; | 12431 v5.uFrameWidth = game_viewport_width; |
12427 v5.uFrameZ = 452; | 12432 v5.uFrameZ = 452; |
12428 v1 = pFontArrus->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; | 12433 v1 = pFontArrus->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; |
12429 if ( 352 - v1 < 8 ) | 12434 if ( 352 - v1 < 8 ) |
12430 { | 12435 { |
12431 pFont = pFontCreate; | 12436 pFont = pFontCreate; |
12674 break; | 12679 break; |
12675 } | 12680 } |
12676 | 12681 |
12677 if (pInString) | 12682 if (pInString) |
12678 { | 12683 { |
12679 pWindow.uFrameWidth = 460; | 12684 pWindow.uFrameWidth = game_viewport_width; |
12680 pWindow.uFrameZ = 452; | 12685 pWindow.uFrameZ = 452; |
12681 auto font = pFontArrus; | 12686 auto font = pFontArrus; |
12682 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; | 12687 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; |
12683 if ( 352 - v12 < 8 ) | 12688 if ( 352 - v12 < 8 ) |
12684 { | 12689 { |
13780 case 32: | 13785 case 32: |
13781 case 39: | 13786 case 39: |
13782 case 41: | 13787 case 41: |
13783 a1.stru_24.Reset(); | 13788 a1.stru_24.Reset(); |
13784 v16 = 0; | 13789 v16 = 0; |
13785 a1.field_48 = spellnum; | 13790 a1.spell_id = spellnum; |
13786 a1.field_4C = level; | 13791 a1.spell_level = level; |
13787 a1.field_50 = v15; | 13792 a1.spell_skill = v15; |
13788 if ( (signed int)pObjectList->uNumObjects <= 0 ) | 13793 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
13789 goto LABEL_34; | 13794 goto LABEL_34; |
13790 v17 = (char *)&pObjectList->pObjects->uObjectID; | 13795 v17 = (char *)&pObjectList->pObjects->uObjectID; |
13791 while ( (short)a1.uType != *(short *)v17 ) | 13796 while ( (short)a1.uType != *(short *)v17 ) |
13792 { | 13797 { |
13818 if ( v60 != 1 ) | 13823 if ( v60 != 1 ) |
13819 { | 13824 { |
13820 a8b = a7c / (v60 - 1); | 13825 a8b = a7c / (v60 - 1); |
13821 a1.stru_24.Reset(); | 13826 a1.stru_24.Reset(); |
13822 v21 = 0; | 13827 v21 = 0; |
13823 a1.field_48 = spellnum; | 13828 a1.spell_id = spellnum; |
13824 a1.field_4C = level; | 13829 a1.spell_level = level; |
13825 a1.field_50 = v15; | 13830 a1.spell_skill = v15; |
13826 if ( (signed int)pObjectList->uNumObjects <= 0 ) | 13831 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
13827 { | 13832 { |
13828 LABEL_41: | 13833 LABEL_41: |
13829 v23 = 0; | 13834 v23 = 0; |
13830 } | 13835 } |
13845 a1.vPosition.x = fromx; | 13850 a1.vPosition.x = fromx; |
13846 a1.uAttributes = 16; | 13851 a1.uAttributes = 16; |
13847 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | 13852 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); |
13848 a1.field_60_distance_related_prolly_lod = v55; | 13853 a1.field_60_distance_related_prolly_lod = v55; |
13849 a1.uSpriteFrameID = 0; | 13854 a1.uSpriteFrameID = 0; |
13850 a1.field_58_pid = 8000 | OBJECT_Item; | 13855 a1.spell_caster_pid = 8000 | OBJECT_Item; |
13851 a1.field_5C = 4; | 13856 a1.spell_target_pid = 4; |
13852 a1.uSoundID = 0; | 13857 a1.uSoundID = 0; |
13853 for ( i = a7c / -2; i <= a7c / 2; i += a8b ) | 13858 for ( i = a7c / -2; i <= a7c / 2; i += a8b ) |
13854 { | 13859 { |
13855 a1.uFacing = i + yaw; | 13860 a1.uFacing = i + yaw; |
13856 a1.Create( | 13861 a1.Create( |
13861 } | 13866 } |
13862 goto LABEL_139; | 13867 goto LABEL_139; |
13863 } | 13868 } |
13864 a1.stru_24.Reset(); | 13869 a1.stru_24.Reset(); |
13865 v16 = 0; | 13870 v16 = 0; |
13866 a1.field_48 = spellnum; | 13871 a1.spell_id = spellnum; |
13867 a1.field_4C = level; | 13872 a1.spell_level = level; |
13868 a1.field_50 = v15; | 13873 a1.spell_skill = v15; |
13869 if ( (signed int)pObjectList->uNumObjects <= 0 ) | 13874 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
13870 goto LABEL_34; | 13875 goto LABEL_34; |
13871 v19 = (char *)&pObjectList->pObjects->uObjectID; | 13876 v19 = (char *)&pObjectList->pObjects->uObjectID; |
13872 do | 13877 do |
13873 { | 13878 { |
13886 a1.uAttributes = 16; | 13891 a1.uAttributes = 16; |
13887 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | 13892 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); |
13888 a1.field_60_distance_related_prolly_lod = v55; | 13893 a1.field_60_distance_related_prolly_lod = v55; |
13889 v20 = yaw; | 13894 v20 = yaw; |
13890 a1.uSpriteFrameID = 0; | 13895 a1.uSpriteFrameID = 0; |
13891 a1.field_58_pid = 8000 | OBJECT_Item; | 13896 a1.spell_caster_pid = 8000 | OBJECT_Item; |
13892 a1.field_5C = 0; | 13897 a1.spell_target_pid = 0; |
13893 a1.uFacing = yaw; | 13898 a1.uFacing = yaw; |
13894 a1.uSoundID = 0; | 13899 a1.uSoundID = 0; |
13895 v51 = 0; | 13900 v51 = 0; |
13896 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 13901 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
13897 v47 = pitch; | 13902 v47 = pitch; |
13914 } | 13919 } |
13915 a7d = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | 13920 a7d = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
13916 a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1); | 13921 a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1); |
13917 a1.stru_24.Reset(); | 13922 a1.stru_24.Reset(); |
13918 v25 = 0; | 13923 v25 = 0; |
13919 a1.field_48 = spellnum; | 13924 a1.spell_id = spellnum; |
13920 a1.field_4C = level; | 13925 a1.spell_level = level; |
13921 a1.field_50 = v15; | 13926 a1.spell_skill = v15; |
13922 if ( (signed int)pObjectList->uNumObjects <= 0 ) | 13927 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
13923 goto LABEL_59; | 13928 goto LABEL_59; |
13924 v26 = (char *)&pObjectList->pObjects->uObjectID; | 13929 v26 = (char *)&pObjectList->pObjects->uObjectID; |
13925 while ( (short)a1.uType != *(short *)v26 ) | 13930 while ( (short)a1.uType != *(short *)v26 ) |
13926 { | 13931 { |
13940 a1.vPosition.x = fromx; | 13945 a1.vPosition.x = fromx; |
13941 a1.uAttributes = 16; | 13946 a1.uAttributes = 16; |
13942 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | 13947 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); |
13943 a1.field_60_distance_related_prolly_lod = v55; | 13948 a1.field_60_distance_related_prolly_lod = v55; |
13944 a1.uSpriteFrameID = 0; | 13949 a1.uSpriteFrameID = 0; |
13945 a1.field_58_pid = 8000 | OBJECT_Item; | 13950 a1.spell_caster_pid = 8000 | OBJECT_Item; |
13946 a1.field_5C = 4; | 13951 a1.spell_target_pid = 4; |
13947 a1.uSoundID = 0; | 13952 a1.uSoundID = 0; |
13948 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | 13953 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) |
13949 { | 13954 { |
13950 a1.uFacing = j + yaw; | 13955 a1.uFacing = j + yaw; |
13951 a1.Create( | 13956 a1.Create( |
13958 case 43: | 13963 case 43: |
13959 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | 13964 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
13960 return; | 13965 return; |
13961 a1.stru_24.Reset(); | 13966 a1.stru_24.Reset(); |
13962 v29 = 0; | 13967 v29 = 0; |
13963 a1.field_48 = spellnum; | 13968 a1.spell_id = spellnum; |
13964 a1.field_4C = level; | 13969 a1.spell_level = level; |
13965 a1.field_50 = v15; | 13970 a1.spell_skill = v15; |
13966 if ( (signed int)pObjectList->uNumObjects <= 0 ) | 13971 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
13967 goto LABEL_70; | 13972 goto LABEL_70; |
13968 v30 = (char *)&pObjectList->pObjects->uObjectID; | 13973 v30 = (char *)&pObjectList->pObjects->uObjectID; |
13969 break; | 13974 break; |
13970 | 13975 |
14094 a1.vPosition.x = fromx; | 14099 a1.vPosition.x = fromx; |
14095 a1.uAttributes = 16; | 14100 a1.uAttributes = 16; |
14096 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | 14101 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); |
14097 a1.field_60_distance_related_prolly_lod = v55; | 14102 a1.field_60_distance_related_prolly_lod = v55; |
14098 a1.uSpriteFrameID = 0; | 14103 a1.uSpriteFrameID = 0; |
14099 a1.field_58_pid = 8000 | OBJECT_Item; | 14104 a1.spell_caster_pid = 8000 | OBJECT_Item; |
14100 a1.field_5C = 4; | 14105 a1.spell_target_pid = 4; |
14101 a1.uSoundID = 0; | 14106 a1.uSoundID = 0; |
14102 v51 = 0; | 14107 v51 = 0; |
14103 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 14108 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; |
14104 v20 = yaw; | 14109 v20 = yaw; |
14105 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | 14110 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; |
14926 // 4F75D8: using guessed type int ai_arrays_size; | 14931 // 4F75D8: using guessed type int ai_arrays_size; |
14927 | 14932 |
14928 //----- (00401A91) -------------------------------------------------------- | 14933 //----- (00401A91) -------------------------------------------------------- |
14929 void __cdecl UpdateActorAI() | 14934 void __cdecl UpdateActorAI() |
14930 { | 14935 { |
14931 //unsigned int v0; // esi@4 | 14936 //unsigned int v0; // esi@4 |
14932 int v1; // eax@7 | 14937 int v1; // eax@7 |
14933 int v2; // ecx@7 | 14938 int v2; // ecx@7 |
14934 int v3; // eax@7 | 14939 int v3; // eax@7 |
14935 signed int v4; // edi@10 | 14940 signed int v4; // edi@10 |
14936 Actor *v5; // esi@12 | 14941 Actor *v5; // esi@12 |
14937 signed int v6; // eax@14 | 14942 signed int v6; // eax@14 |
14938 __int16 v7; // cx@14 | 14943 __int16 v7; // cx@14 |
14939 Player **v8; // esi@20 | 14944 Player **v8; // esi@20 |
14940 Player *pPlayer; // ecx@21 | 14945 Player *pPlayer; // ecx@21 |
14941 //Actor *pActor; // esi@34 | 14946 //Actor *pActor; // esi@34 |
14942 //__int16 v11; // ax@34 | 14947 //__int16 v11; // ax@34 |
14943 //unsigned int v12; // eax@47 | 14948 //unsigned int v12; // eax@47 |
14944 //signed int v13; // edi@47 | 14949 //signed int v13; // edi@47 |
14945 //SpellBuff *v14; // ebx@47 | 14950 //SpellBuff *v14; // ebx@47 |
14946 //unsigned int v15; // edi@67 | 14951 //unsigned int v15; // edi@67 |
14947 //char *v16; // eax@67 | 14952 //char *v16; // eax@67 |
14948 //unsigned int v17; // edx@67 | 14953 //unsigned int v17; // edx@67 |
14949 //unsigned int v18; // ecx@67 | 14954 //unsigned int v18; // ecx@67 |
14950 //unsigned __int16 v19; // ax@72 | 14955 //unsigned __int16 v19; // ax@72 |
14951 //int *v20; // esi@80 | 14956 //int *v20; // esi@80 |
14952 Actor *v21; // ebx@80 | 14957 Actor *v21; // ebx@80 |
14953 unsigned __int16 v22; // ax@86 | 14958 unsigned __int16 v22; // ax@86 |
14954 signed int v23; // eax@94 | 14959 //signed int v23; // eax@94 |
14955 unsigned int v24; // eax@102 | 14960 //unsigned int v24; // eax@102 |
14956 signed int v25; // edi@102 | 14961 signed int v25; // edi@102 |
14957 SpellBuff *v26; // esi@102 | 14962 SpellBuff *v26; // esi@102 |
14958 unsigned int v27; // ecx@123 | 14963 unsigned int v27; // ecx@123 |
14959 unsigned int v28; // eax@123 | 14964 unsigned int v28; // eax@123 |
14960 unsigned int v29; // eax@127 | 14965 unsigned int v29; // eax@127 |
14961 AIDirection *v30; // eax@129 | 14966 AIDirection *v30; // eax@129 |
14962 unsigned __int16 v31; // ax@132 | 14967 unsigned __int16 v31; // ax@132 |
14963 unsigned int v32; // esi@142 | 14968 unsigned int v32; // esi@142 |
14964 int v33; // eax@144 | 14969 int v33; // eax@144 |
14965 int v34; // eax@147 | 14970 int v34; // eax@147 |
14966 char v35; // al@150 | 14971 char v35; // al@150 |
14967 unsigned int v36; // edi@152 | 14972 unsigned int v36; // edi@152 |
14968 signed int v37; // eax@154 | 14973 signed int v37; // eax@154 |
14969 unsigned __int8 v38; // sf@158 | 14974 unsigned __int8 v38; // sf@158 |
14970 unsigned __int8 v39; // of@158 | 14975 unsigned __int8 v39; // of@158 |
14971 signed int v40; // edx@166 | 14976 signed int v40; // edx@166 |
14972 unsigned int v41; // ecx@166 | 14977 unsigned int v41; // ecx@166 |
14973 double v42; // st7@176 | 14978 double v42; // st7@176 |
14974 double v43; // st6@176 | 14979 double v43; // st6@176 |
14975 bool v44; // eax@189 | 14980 bool v44; // eax@189 |
14976 bool v45; // eax@192 | 14981 bool v45; // eax@192 |
14977 unsigned __int8 v46; // cl@197 | 14982 unsigned __int8 v46; // cl@197 |
14978 double v47; // st7@206 | 14983 double v47; // st7@206 |
14979 double v48; // st7@207 | 14984 double v48; // st7@207 |
14980 char v49; // zf@208 | 14985 char v49; // zf@208 |
14981 char v50; // zf@214 | 14986 char v50; // zf@214 |
14982 signed int v51; // edx@219 | 14987 signed int v51; // edx@219 |
14983 unsigned int v52; // ecx@219 | 14988 unsigned int v52; // ecx@219 |
14984 __int16 v53; // fps@224 | 14989 __int16 v53; // fps@224 |
14985 unsigned __int8 v54; // c0@224 | 14990 unsigned __int8 v54; // c0@224 |
14986 unsigned __int8 v55; // c3@224 | 14991 unsigned __int8 v55; // c3@224 |
14987 double v56; // st7@226 | 14992 double v56; // st7@226 |
14988 AIDirection *v57; // eax@246 | 14993 AIDirection *v57; // eax@246 |
14989 double v58; // st7@246 | 14994 double v58; // st7@246 |
14990 signed int v59; // [sp-18h] [bp-C8h]@213 | 14995 signed int v59; // [sp-18h] [bp-C8h]@213 |
14991 int v60; // [sp-14h] [bp-C4h]@144 | 14996 int v60; // [sp-14h] [bp-C4h]@144 |
14992 int v61; // [sp-14h] [bp-C4h]@168 | 14997 int v61; // [sp-14h] [bp-C4h]@168 |
14993 AIDirection *v62; // [sp-14h] [bp-C4h]@213 | 14998 AIDirection *v62; // [sp-14h] [bp-C4h]@213 |
14994 signed int v63; // [sp-14h] [bp-C4h]@216 | 14999 signed int v63; // [sp-14h] [bp-C4h]@216 |
14995 unsigned int v64; // [sp-14h] [bp-C4h]@219 | 15000 unsigned int v64; // [sp-14h] [bp-C4h]@219 |
14996 unsigned int v65; // [sp-10h] [bp-C0h]@144 | 15001 unsigned int v65; // [sp-10h] [bp-C0h]@144 |
14997 char v66; // [sp-10h] [bp-C0h]@147 | 15002 char v66; // [sp-10h] [bp-C0h]@147 |
14998 AIDirection *v67; // [sp-10h] [bp-C0h]@167 | 15003 AIDirection *v67; // [sp-10h] [bp-C0h]@167 |
14999 int v68; // [sp-10h] [bp-C0h]@168 | 15004 int v68; // [sp-10h] [bp-C0h]@168 |
15000 AIDirection *v69; // [sp-10h] [bp-C0h]@206 | 15005 AIDirection *v69; // [sp-10h] [bp-C0h]@206 |
15001 int v70; // [sp-10h] [bp-C0h]@213 | 15006 int v70; // [sp-10h] [bp-C0h]@213 |
15002 AIDirection *v71; // [sp-10h] [bp-C0h]@216 | 15007 AIDirection *v71; // [sp-10h] [bp-C0h]@216 |
15003 AIDirection v72; // [sp+0h] [bp-B0h]@246 | 15008 AIDirection v72; // [sp+0h] [bp-B0h]@246 |
15004 AIDirection a3; // [sp+1Ch] [bp-94h]@129 | 15009 AIDirection a3; // [sp+1Ch] [bp-94h]@129 |
15005 AIDirection v74; // [sp+38h] [bp-78h]@246 | 15010 AIDirection v74; // [sp+38h] [bp-78h]@246 |
15006 AIDirection v75; // [sp+54h] [bp-5Ch]@129 | 15011 AIDirection v75; // [sp+54h] [bp-5Ch]@129 |
15007 int v76; // [sp+70h] [bp-40h]@83 | 15012 int v76; // [sp+70h] [bp-40h]@83 |
15008 signed int a1; // [sp+74h] [bp-3Ch]@129 | 15013 signed int a1; // [sp+74h] [bp-3Ch]@129 |
15009 int v78; // [sp+78h] [bp-38h]@79 | 15014 int v78; // [sp+78h] [bp-38h]@79 |
15010 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 | 15015 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 |
15011 float v80; // [sp+98h] [bp-18h]@33 | 15016 float v80; // [sp+98h] [bp-18h]@33 |
15012 int v81; // [sp+9Ch] [bp-14h]@100 | 15017 int v81; // [sp+9Ch] [bp-14h]@100 |
15013 int v82; // [sp+A0h] [bp-10h]@45 | 15018 int v82; // [sp+A0h] [bp-10h]@45 |
15014 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 | 15019 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 |
15015 unsigned int v84; // [sp+A8h] [bp-8h]@11 | 15020 unsigned int v84; // [sp+A8h] [bp-8h]@11 |
15016 signed int a2; // [sp+ACh] [bp-4h]@83 | 15021 signed int a2; // [sp+ACh] [bp-4h]@83 |
15017 | 15022 |
15018 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 15023 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
15019 MakeActorAIList_ODM(); | 15024 MakeActorAIList_ODM(); |
15020 else | 15025 else |
15021 MakeActorAIList_BLV(); | 15026 MakeActorAIList_BLV(); |
15022 | 15027 |
15023 //v0 = 0; | 15028 //v0 = 0; |
15024 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) | 15029 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) |
15025 { | 15030 { |
15026 if ( pParty->armageddon_timer > 417 ) | 15031 if ( pParty->armageddon_timer > 417 ) |
15027 { | 15032 { |
15028 pParty->armageddon_timer = 0; | 15033 pParty->armageddon_timer = 0; |
15029 } | 15034 } |
15030 else | 15035 else |
15031 { | 15036 { |
15032 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); | 15037 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); |
15033 v1 = rand(); | 15038 v1 = rand(); |
15034 v2 = 128; | 15039 v2 = 128; |
15035 v3 = pParty->sRotationX + v1 % 16 - 8; | 15040 v3 = pParty->sRotationX + v1 % 16 - 8; |
15036 pParty->sRotationX = v3; | 15041 pParty->sRotationX = v3; |
15037 if ( v3 > 128 || (v2 = -128, v3 < -128) ) | 15042 if ( v3 > 128 || (v2 = -128, v3 < -128) ) |
15038 pParty->sRotationX = v2; | 15043 pParty->sRotationX = v2; |
15039 pParty->uFlags |= 2u; | 15044 pParty->uFlags |= 2u; |
15040 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; | 15045 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; |
15041 v4 = pParty->field_16140 + 50; | 15046 v4 = pParty->field_16140 + 50; |
15042 if ( pParty->armageddon_timer <= 0 ) | 15047 if ( pParty->armageddon_timer <= 0 ) |
15043 { | 15048 { |
15044 pParty->armageddon_timer = 0; | 15049 pParty->armageddon_timer = 0; |
15045 v84 = 0; | 15050 v84 = 0; |
15046 if ( (signed int)uNumActors > 0 ) | 15051 if ( (signed int)uNumActors > 0 ) |
15047 { | 15052 { |
15048 v5 = pActors;//[0].sCurrentHP; | 15053 v5 = pActors;//[0].sCurrentHP; |
15049 do | 15054 do |
15050 { | 15055 { |
15051 if ( v5->CanAct() ) | 15056 if ( v5->CanAct() ) |
15052 { | 15057 { |
15053 v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); | 15058 v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); |
15054 v7 = v5->sCurrentHP - v6; | 15059 v7 = v5->sCurrentHP - v6; |
15055 v5->sCurrentHP = v7; | 15060 v5->sCurrentHP = v7; |
15056 if ( v6 ) | 15061 if ( v6 ) |
15057 { | 15062 { |
15058 if ( v7 >= 0 ) | 15063 if ( v7 >= 0 ) |
15059 { | 15064 { |
15060 Actor::_4030AD(v84, 4, 0); | 15065 Actor::_4030AD(v84, 4, 0); |
15061 } | 15066 } |
15062 else | 15067 else |
15063 { | 15068 { |
15064 Actor::Die(v84); | 15069 Actor::Die(v84); |
15065 if ( v5->pMonsterInfo.uExp ) | 15070 if ( v5->pMonsterInfo.uExp ) |
15066 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); | 15071 GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); |
15067 } | 15072 } |
15068 } | 15073 } |
15069 } | 15074 } |
15070 ++v84; | 15075 ++v84; |
15071 ++v5; | 15076 ++v5; |
15072 } | 15077 } |
15073 while ( (signed int)v84 < (signed int)uNumActors ); | 15078 while ( (signed int)v84 < (signed int)uNumActors ); |
15074 } | 15079 } |
15075 v8 = &pPlayers[1]; | 15080 v8 = &pPlayers[1]; |
15076 do | 15081 do |
15077 { | 15082 { |
15078 pPlayer = *v8; | 15083 pPlayer = *v8; |
15079 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) | 15084 if ( !(*v8)->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) |
15080 pPlayer->ReceiveDamage(v4, 5); | 15085 pPlayer->ReceiveDamage(v4, 5); |
15081 ++v8; | 15086 ++v8; |
15082 } | 15087 } |
15083 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | 15088 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); |
15084 //v0 = 0; | 15089 //v0 = 0; |
15085 } | 15090 } |
15086 if (pTurnEngine->field_1C) | 15091 if (pTurnEngine->field_1C) |
15087 --pTurnEngine->field_1C; | 15092 --pTurnEngine->field_1C; |
15088 } | 15093 } |
15089 } | 15094 } |
15090 | 15095 |
15091 if (pParty->bTurnBasedModeOn) | 15096 if (pParty->bTurnBasedModeOn) |
15092 { | 15097 { |
15093 pTurnEngine->_405E14(); | 15098 pTurnEngine->_405E14(); |
15094 return; | 15099 return; |
15095 } | 15100 } |
15096 | 15101 |
15097 | 15102 |
15098 //uActorID = v0; | 15103 //uActorID = v0; |
15099 for (uint i = 0; i < uNumActors; ++i) | 15104 for (uint i = 0; i < uNumActors; ++i) |
15100 { | 15105 { |
15101 auto actor = pActors + i; | 15106 auto actor = pActors + i; |
15102 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState | 15107 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState |
15103 //do | 15108 //do |
15104 //{ | 15109 //{ |
15105 //pActor = (Actor *)(LODWORD(v80) - 176); | 15110 //pActor = (Actor *)(LODWORD(v80) - 176); |
15106 //v11 = *(unsigned int *)LODWORD(v80); | 15111 //v11 = *(unsigned int *)LODWORD(v80); |
15107 //v49 = *(unsigned int *)LODWORD(v80) == 5; | 15112 //v49 = *(unsigned int *)LODWORD(v80) == 5; |
15108 ai_near_actors_targets_pid[i] = OBJECT_Player; | 15113 ai_near_actors_targets_pid[i] = OBJECT_Player; |
15109 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) | 15114 if (actor->uAIState == Dead || actor->uAIState == Removed || actor->uAIState == Disabled || actor->uAttributes & 0x0400) |
15110 continue; | 15115 continue; |
15111 | 15116 |
15112 if (!actor->sCurrentHP && actor->uAIState != Dying) | 15117 if (!actor->sCurrentHP && actor->uAIState != Dying) |
15113 Actor::Die(i); | 15118 Actor::Die(i); |
15114 | 15119 |
15115 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; | 15120 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; |
15116 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; | 15121 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; |
15117 //v12 = 0; | 15122 //v12 = 0; |
15118 //v13 = 0; | 15123 //v13 = 0; |
15119 //v14 = (SpellBuff *)(LODWORD(v80) + 36); | 15124 //v14 = (SpellBuff *)(LODWORD(v80) + 36); |
15120 for (uint j = 0; j < 22; ++j) | 15125 for (uint j = 0; j < 22; ++j) |
15121 { | 15126 { |
15122 if (j != 10) | 15127 if (j != 10) |
15123 actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); | 15128 actor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); |
15124 } | 15129 } |
15125 /*do | 15130 /*do |
15126 { | 15131 { |
15127 if ( v13 != 10 ) | 15132 if ( v13 != 10 ) |
15128 { | 15133 { |
15129 v14->_4585CA(pParty->uTimePlayed); | 15134 v14->_4585CA(pParty->uTimePlayed); |
15130 v12 = 0; | 15135 v12 = 0; |
15131 } | 15136 } |
15132 ++v13; | 15137 ++v13; |
15133 ++v14; | 15138 ++v14; |
15134 } | 15139 } |
15135 while ( v13 < 22 );*/ | 15140 while ( v13 < 22 );*/ |
15136 if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) | 15141 if (!actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) |
15137 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 | 15142 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 |
15138 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | 15143 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) |
15139 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; | 15144 actor->uActorHeight = pMonsterList->pMonsters[actor->pMonsterInfo.uID - 1].uMonsterHeight; |
15140 if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) | 15145 if (actor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime) |
15141 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15146 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15142 else | 15147 else |
15143 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; | 15148 actor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[actor->pMonsterInfo.uID].uHostilityType; |
15144 | 15149 |
15145 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || | 15150 if (actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime || |
15146 actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) | 15151 actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) |
15147 continue; | 15152 continue; |
15148 | 15153 |
15149 //v15 = pMiscTimer->uTimeElapsed; | 15154 //v15 = pMiscTimer->uTimeElapsed; |
15150 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | 15155 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; |
15151 //v17 = pActor->uCurrentActionTime; | 15156 //v17 = pActor->uCurrentActionTime; |
15152 //v18 = pActor->pMonsterInfo.uRecoveryTime; | 15157 //v18 = pActor->pMonsterInfo.uRecoveryTime; |
15153 if (actor->pMonsterInfo.uRecoveryTime) | 15158 if (actor->pMonsterInfo.uRecoveryTime) |
15154 { | 15159 { |
15155 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) | 15160 if (actor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) |
15156 actor->pMonsterInfo.uRecoveryTime = 0; | 15161 actor->pMonsterInfo.uRecoveryTime = 0; |
15157 else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | 15162 else actor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; |
15158 } | 15163 } |
15159 | 15164 |
15160 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15165 actor->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
15161 if (actor->uCurrentActionTime < actor->uCurrentActionLength) | 15166 if (actor->uCurrentActionTime < actor->uCurrentActionLength) |
15162 continue; | 15167 continue; |
15163 | 15168 |
15164 //v19 = actor->uAIState; | 15169 //v19 = actor->uAIState; |
15165 if (actor->uAIState == Dying) | 15170 if (actor->uAIState == Dying) |
15166 actor->uAIState = Dead; | 15171 actor->uAIState = Dead; |
15167 else | 15172 else |
15168 { | 15173 { |
15169 if (actor->uAIState != Summoned) | 15174 if (actor->uAIState != Summoned) |
15170 { | 15175 { |
15171 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); | 15176 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); |
15172 continue; | 15177 continue; |
15173 } | 15178 } |
15174 actor->uAIState = Standing; | 15179 actor->uAIState = Standing; |
15175 } | 15180 } |
15176 | 15181 |
15177 actor->uCurrentActionTime = 0; | 15182 actor->uCurrentActionTime = 0; |
15178 actor->uCurrentActionLength = 0; | 15183 actor->uCurrentActionLength = 0; |
15179 actor->UpdateAnimation(); | 15184 actor->UpdateAnimation(); |
15180 //LABEL_78: | 15185 //LABEL_78: |
15181 //++uActorID; | 15186 //++uActorID; |
15182 //LODWORD(v80) += 836; | 15187 //LODWORD(v80) += 836; |
15183 //} | 15188 //} |
15184 //while ( (signed int)uActorID < (signed int)uNumActors ); | 15189 //while ( (signed int)uActorID < (signed int)uNumActors ); |
15185 } | 15190 } |
15186 | 15191 |
15187 | 15192 |
15188 v78 = 0; | 15193 v78 = 0; |
15189 int actor_id = -1; | 15194 int actor_id = -1; |
15190 if ( ai_arrays_size > 0 ) | 15195 if ( ai_arrays_size > 0 ) |
15191 { | 15196 { |
15192 while ( 1 ) | 15197 //while ( 1 ) |
15193 { | 15198 for(v78 = 0; v78 < ai_arrays_size; ++v78) |
15194 actor_id = ai_near_actors_ids[v78]; | 15199 { |
15195 assert(actor_id < uNumActors); | 15200 actor_id = ai_near_actors_ids[v78]; |
15196 | 15201 assert(actor_id < uNumActors); |
15197 //v20 = &ai_near_actors_targets_pid[actor_id]; | 15202 |
15198 v21 = &pActors[actor_id]; | 15203 //v20 = &ai_near_actors_targets_pid[actor_id]; |
15199 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); | 15204 v21 = &pActors[actor_id]; |
15200 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) | 15205 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); |
15201 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15206 if (v21->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) |
15202 a2 = ai_near_actors_targets_pid[actor_id]; | 15207 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15203 v76 = a2 & 7; | 15208 a2 = ai_near_actors_targets_pid[actor_id]; |
15204 if ( (a2 & 7) == OBJECT_Actor) | 15209 v76 = a2 & 7; |
15205 v80 = 0.5; | 15210 if ( (a2 & 7) == OBJECT_Actor) |
15206 else | 15211 v80 = 0.5; |
15207 v80 = 1.0; | 15212 else |
15208 v22 = v21->uAIState; | 15213 v80 = 1.0; |
15209 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) | 15214 v22 = v21->uAIState; |
15210 goto LABEL_254; | 15215 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) |
15211 if ( !v21->sCurrentHP ) | 15216 { |
15212 Actor::Die(actor_id); | 15217 continue; |
15213 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime <= 0 ) | 15218 } |
15214 { | 15219 else |
15215 v84 = 0; | 15220 { |
15216 v23 = 1; | 15221 if ( !v21->sCurrentHP ) |
15217 } | 15222 Actor::Die(actor_id); |
15218 else | 15223 v25 = 0; |
15219 { | 15224 v26 = v21->pActorBuffs; |
15220 v23 = 1; | 15225 do |
15221 v84 = 1; | 15226 { |
15222 } | 15227 if ( v25 != 10 ) |
15223 if ( (signed __int64)v21->pActorBuffs[1].uExpireTime <= 0 ) | 15228 { |
15224 v82 = 0; | 15229 v26->_4585CA(pParty->uTimePlayed); |
15225 else | 15230 //v24 = 0; |
15226 v82 = v23; | 15231 } |
15227 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime <= 0 ) | 15232 ++v25; |
15228 v81 = 0; | 15233 ++v26; |
15229 else | 15234 } |
15230 v81 = v23; | 15235 while ( v25 < 22 ); |
15231 v24 = 0; | 15236 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime > 0 |
15232 v25 = 0; | 15237 && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= 0 |
15233 v26 = v21->pActorBuffs; | 15238 && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < 0 |
15234 do | 15239 || LODWORD(v21->pActorBuffs[3].uExpireTime) <= 0) ) |
15235 { | 15240 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; |
15236 if ( v25 != 10 ) | 15241 if ( (signed __int64)v21->pActorBuffs[1].uExpireTime > 0 ) |
15237 { | 15242 { |
15238 v26->_4585CA(pParty->uTimePlayed); | 15243 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
15239 v24 = 0; | 15244 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) |
15240 } | 15245 { |
15241 ++v25; | 15246 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < 0 |
15242 ++v26; | 15247 || LODWORD(v21->pActorBuffs[1].uExpireTime) <= 0 ) |
15243 } | 15248 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; |
15244 while ( v25 < 22 ); | 15249 } |
15245 if ( v84 != v24 | 15250 } |
15246 && SHIDWORD(v21->pActorBuffs[3].uExpireTime) <= (signed int)v24 | 15251 if ( (signed __int64)v21->pActorBuffs[2].uExpireTime > 0 |
15247 && (SHIDWORD(v21->pActorBuffs[3].uExpireTime) < (signed int)v24 | 15252 && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= 0 |
15248 || LODWORD(v21->pActorBuffs[3].uExpireTime) <= v24) ) | 15253 && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < 0 |
15249 v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight; | 15254 || LODWORD(v21->pActorBuffs[2].uExpireTime) <= 0) ) |
15250 if ( v82 != v24 ) | 15255 { |
15251 { | 15256 v21->uAIState = Removed; |
15252 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 15257 continue; |
15253 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= (signed int)v24 ) | 15258 } |
15254 { | 15259 else if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) |
15255 if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < (signed int)v24 | 15260 { |
15256 || LODWORD(v21->pActorBuffs[1].uExpireTime) <= v24 ) | 15261 continue; |
15257 v21->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[v21->pMonsterInfo.uID].uHostilityType; | 15262 } |
15258 } | 15263 else |
15259 } | 15264 { |
15260 if ( v81 != v24 | 15265 v27 = pMiscTimer->uTimeElapsed; |
15261 && SHIDWORD(v21->pActorBuffs[2].uExpireTime) <= (signed int)v24 | 15266 v28 = v21->pMonsterInfo.uRecoveryTime; |
15262 && (SHIDWORD(v21->pActorBuffs[2].uExpireTime) < (signed int)v24 | 15267 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; |
15263 || LODWORD(v21->pActorBuffs[2].uExpireTime) <= v24) ) | 15268 if ( (signed int)v28 > 0 ) |
15264 { | 15269 v21->pMonsterInfo.uRecoveryTime = v28 - v27; |
15265 v21->uAIState = Removed; | 15270 if ( v21->pMonsterInfo.uRecoveryTime< 0 ) |
15266 goto LABEL_254; | 15271 v21->pMonsterInfo.uRecoveryTime = 0; |
15267 } | 15272 v29 = v21->uAttributes; |
15268 if ( v21->pActorBuffs[5].uExpireTime || v21->pActorBuffs[6].uExpireTime ) | 15273 if ( !(v29 & 0x8000) ) |
15269 goto LABEL_254; | 15274 v21->uAttributes = v29 | 0x8000; |
15270 v27 = pMiscTimer->uTimeElapsed; | 15275 a1 = 8 * actor_id | OBJECT_Actor; |
15271 v28 = v21->pMonsterInfo.uRecoveryTime; | 15276 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0); |
15272 v21->uCurrentActionTime += pMiscTimer->uTimeElapsed; | 15277 v49 = v21->pMonsterInfo.uHostilityType == 0; |
15273 if ( (signed int)v28 > 0 ) | 15278 memcpy(&v75, v30, sizeof(v75)); |
15274 v21->pMonsterInfo.uRecoveryTime = v28 - v27; | 15279 memcpy(&pDir, &v75, sizeof(pDir)); |
15275 if ( v21->pMonsterInfo.uRecoveryTime< 0 ) | 15280 if ( !v49 |
15276 v21->pMonsterInfo.uRecoveryTime = 0; | 15281 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 |
15277 v29 = v21->uAttributes; | 15282 && v80 * 307.2 >= (double)(signed int)v75.uDistance |
15278 if ( !(v29 & 0x8000) ) | 15283 && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9) |
15279 v21->uAttributes = v29 | 0x8000; | 15284 || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 ) |
15280 a1 = 8 * actor_id | OBJECT_Actor; | 15285 { |
15281 v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0); | 15286 v32 = actor_id; |
15282 v49 = v21->pMonsterInfo.uHostilityType == 0; | 15287 } |
15283 memcpy(&v75, v30, sizeof(v75)); | 15288 else |
15284 memcpy(&pDir, &v75, sizeof(pDir)); | 15289 { |
15285 if ( !v49 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 ) | 15290 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) |
15286 { | 15291 { |
15287 if ( v80 * 307.2 >= (double)(signed int)v75.uDistance | 15292 continue; |
15288 && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9) | 15293 } |
15289 || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 ) | 15294 else if ( v21->uAIState == 2 ) |
15290 { | 15295 { |
15291 v32 = actor_id; | 15296 v32 = actor_id; |
15292 goto LABEL_152; | 15297 v35 = stru_50C198.special_ability_use_check(v21, actor_id); |
15293 } | 15298 stru_50FE08.Add( |
15294 } | 15299 a1, |
15295 if ( (signed int)v21->uCurrentActionTime < v21->uCurrentActionLength ) | 15300 5120, |
15296 goto LABEL_254; | 15301 v21->vPosition.x, |
15297 if ( v21->uAIState == 2 ) | 15302 v21->vPosition.y, |
15298 { | 15303 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), |
15299 v32 = actor_id; | 15304 v35, |
15300 v35 = stru_50C198.special_ability_use_check(v21, actor_id); | 15305 1 |
15301 stru_50FE08.Add( | 15306 ); |
15302 a1, | 15307 } |
15303 5120, | 15308 else if ( v21->uAIState == 3 ) |
15304 v21->vPosition.x, | 15309 { |
15305 v21->vPosition.y, | 15310 v34 = v21->pMonsterInfo.uMissleAttack1Type; |
15306 v21->vPosition.z + ((signed int)v21->uActorHeight >> 1), | 15311 v66 = 0; |
15307 v35, | 15312 v32 = actor_id; |
15308 1); | 15313 Actor::_404874(actor_id, &pDir, v34, v66); |
15309 goto LABEL_152; | 15314 } |
15310 } | 15315 else if ( v21->uAIState == 12 ) |
15311 if ( v21->uAIState == 3 ) | 15316 { |
15312 { | 15317 v34 = v21->pMonsterInfo.uMissleAttack2Type; |
15313 v34 = v21->pMonsterInfo.uMissleAttack1Type; | 15318 v66 = 1; |
15314 v66 = 0; | 15319 v32 = actor_id; |
15315 goto LABEL_149; | 15320 Actor::_404874(actor_id, &pDir, v34, v66); |
15316 } | 15321 } |
15317 if ( v21->uAIState == 12 ) | 15322 else |
15318 { | 15323 { |
15319 v34 = v21->pMonsterInfo.uMissleAttack2Type; | 15324 v32 = actor_id; |
15320 v66 = 1; | 15325 if ( v21->uAIState == 13 ) |
15321 LABEL_149: | 15326 { |
15322 v32 = actor_id; | 15327 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; |
15323 Actor::_404874(actor_id, &pDir, v34, v66); | 15328 v60 = 2; |
15324 goto LABEL_152; | 15329 v33 = v21->pMonsterInfo.uSpell1ID; |
15325 } | 15330 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); |
15326 v32 = actor_id; | 15331 } |
15327 if ( v21->uAIState == 13 ) | 15332 else if ( v21->uAIState == 18 ) |
15328 break; | 15333 { |
15329 if ( v21->uAIState == 18 ) | 15334 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; |
15330 { | 15335 v60 = 3; |
15331 v65 = v21->pMonsterInfo.uSpellSkillAndMastery2; | 15336 v33 = v21->pMonsterInfo.uSpell2ID; |
15332 v60 = 3; | 15337 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); |
15333 v33 = v21->pMonsterInfo.uSpell2ID; | 15338 } |
15334 LABEL_146: | 15339 } |
15335 Actor::_404AC7(actor_id, &pDir, v33, v60, v65); | 15340 } |
15336 } | 15341 } |
15337 LABEL_152: | 15342 } |
15338 v36 = v75.uDistance; | 15343 v36 = v75.uDistance; |
15339 if ( v21->pMonsterInfo.uHostilityType ) | 15344 if ( !v21->pMonsterInfo.uHostilityType ) |
15340 goto LABEL_165; | 15345 { |
15341 if ( v76 == 3 ) | 15346 if ( v76 == 3 ) |
15342 { | 15347 { |
15343 v36 = v75.uDistance; | 15348 v36 = v75.uDistance; |
15344 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] | 15349 v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (v21->pMonsterInfo.uID - 1) / 3] |
15345 + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); | 15350 + (pActors[a2 >> 3].pMonsterInfo.uID - 1) / 3); |
15346 } | 15351 } |
15347 else | 15352 else |
15348 { | 15353 { |
15349 v37 = 4; | 15354 v37 = 4; |
15350 } | 15355 } |
15351 if ( v37 == 1 ) | 15356 if ( v37 == 2 ) |
15352 goto LABEL_257; | 15357 { |
15353 if ( v37 == 2 ) | 15358 v39 = __OFSUB__(v36, 1024); |
15354 { | 15359 v38 = ((v36 - 1024) & 0x80000000u) != 0; |
15355 v39 = __OFSUB__(v36, 1024); | 15360 } |
15356 v38 = ((v36 - 1024) & 0x80000000u) != 0; | 15361 else if ( v37 == 3 ) |
15357 } | 15362 { |
15358 else | 15363 v39 = __OFSUB__(v36, 2560); |
15359 { | 15364 v38 = ((v36 - 2560) & 0x80000000u) != 0; |
15360 if ( v37 == 3 ) | 15365 } |
15361 { | 15366 else if ( v37 == 4 ) |
15362 v39 = __OFSUB__(v36, 2560); | 15367 { |
15363 v38 = ((v36 - 2560) & 0x80000000u) != 0; | 15368 v39 = __OFSUB__(v36, 5120); |
15364 } | 15369 v38 = ((v36 - 5120) & 0x80000000u) != 0; |
15365 else | 15370 } |
15366 { | 15371 if ( v37 >= 1 && v37 <= 4 && v38 ^ v39 || v37 == 1 ) |
15367 if ( v37 != 4 ) | 15372 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
15368 goto LABEL_165; | 15373 } |
15369 v39 = __OFSUB__(v36, 5120); | 15374 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) |
15370 v38 = ((v36 - 5120) & 0x80000000u) != 0; | 15375 { |
15371 } | 15376 v40 = a2; |
15372 } | 15377 v41 = v32; |
15373 if ( v38 ^ v39 ) | 15378 if ( (signed int)v36 >= 10240 ) |
15374 LABEL_257: | 15379 { |
15375 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | 15380 v68 = 0; |
15376 LABEL_165: | 15381 v61 = 1024; |
15377 if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 ) | 15382 Actor::_4032B2(v41, v40, v61, v68); |
15378 { | 15383 continue; |
15379 v40 = a2; | 15384 } |
15380 v41 = v32; | 15385 v67 = &pDir; |
15381 if ( (signed int)v36 >= 10240 ) | 15386 Actor::_402968(v41, v40, 0, v67); |
15382 { | 15387 continue; |
15383 v68 = 0; | 15388 } |
15384 v61 = 1024; | 15389 if ( v21->pMonsterInfo.uHostilityType == 4 && a2 ) |
15385 goto LABEL_253; | 15390 { |
15386 } | 15391 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) |
15387 v67 = &pDir; | 15392 { |
15388 goto LABEL_182; | 15393 if ( v21->pMonsterInfo.uAIType == 1 ) |
15389 } | 15394 { |
15390 if ( v21->pMonsterInfo.uHostilityType != 4 || !a2 ) | 15395 v67 = &pDir; |
15391 goto LABEL_241; | 15396 if ( v21->pMonsterInfo.uMovementType != 5 ) |
15392 if ( !(v21->uAttributes & 0x020000) || v21->pMonsterInfo.uAIType == 1 ) | 15397 { |
15393 { | 15398 v40 = a2; |
15394 if ( v21->pMonsterInfo.uAIType == 1 ) | 15399 v41 = v32; |
15395 { | 15400 Actor::_402968(v41, v40, 0, v67); |
15396 v67 = &pDir; | 15401 continue; |
15397 if ( v21->pMonsterInfo.uMovementType != 5 ) | 15402 } |
15398 goto LABEL_181; | 15403 Actor::AI_Stand( |
15399 Actor::AI_Stand( | 15404 v32, |
15400 v32, | 15405 a2, |
15401 a2, | 15406 (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), |
15402 (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333), | 15407 &pDir); |
15403 &pDir); | 15408 } |
15404 } | 15409 else |
15405 else | 15410 { |
15406 { | 15411 if ( v21->pMonsterInfo.uAIType == 2 ) |
15407 if ( v21->pMonsterInfo.uAIType == 2 ) | 15412 { |
15408 { | 15413 v84 = v21->sCurrentHP; |
15409 v84 = v21->sCurrentHP; | 15414 v42 = (double)(signed int)v84; |
15410 v42 = (double)(signed int)v84; | 15415 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; |
15411 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.2; | 15416 } |
15412 } | 15417 else |
15413 else | 15418 { |
15414 { | 15419 v84 = v21->sCurrentHP; |
15415 if ( v21->pMonsterInfo.uAIType != 3 ) | 15420 v42 = (double)(signed int)v84; |
15416 goto LABEL_185; | 15421 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; |
15417 v84 = v21->sCurrentHP; | 15422 } |
15418 v42 = (double)(signed int)v84; | 15423 if ( v21->pMonsterInfo.uAIType == 2 || v21->pMonsterInfo.uAIType == 3 ) |
15419 v43 = (double)(signed int)v21->pMonsterInfo.uHP * 0.1; | 15424 if ( v43 > v42 && (signed int)v36 < 10240 ) |
15420 } | 15425 { |
15421 if ( v43 > v42 && (signed int)v36 < 10240 ) | 15426 v67 = &pDir; |
15422 { | 15427 v40 = a2; |
15423 v67 = &pDir; | 15428 v41 = v32; |
15424 LABEL_181: | 15429 Actor::_402968(v41, v40, 0, v67); |
15425 v40 = a2; | 15430 continue; |
15426 v41 = v32; | 15431 } |
15427 LABEL_182: | 15432 } |
15428 Actor::_402968(v41, v40, 0, v67); | 15433 } |
15429 goto LABEL_254; | 15434 v81 = v36 - v21->uActorRadius; |
15430 } | 15435 if ( v76 == 3 ) |
15431 } | 15436 v81 -= pActors[a2 >> 3].uActorRadius; |
15432 } | 15437 if ( v81 < 0 ) |
15433 LABEL_185: | 15438 v81 = 0; |
15434 v81 = v36 - v21->uActorRadius; | 15439 rand(); |
15435 if ( v76 == 3 ) | 15440 v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0; |
15436 v81 -= pActors[a2 >> 3].uActorRadius; | 15441 v21->uAttributes &= 0xFBFFFF; |
15437 if ( v81 < 0 ) | 15442 v82 = 0; |
15438 v81 = 0; | 15443 v49 = v21->pMonsterInfo.uMovementType == 5; |
15439 rand(); | 15444 v84 = v44; |
15440 v44 = (signed int)v21->pMonsterInfo.uRecoveryTime <= 0; | 15445 if ( v49 ) |
15441 v21->uAttributes &= 0xFBFFFF; | 15446 v82 = 1; |
15442 v82 = 0; | 15447 if ( v81 < 5120 ) |
15443 v49 = v21->pMonsterInfo.uMovementType == 5; | 15448 { |
15444 v84 = v44; | 15449 v45 = stru_50C198.special_ability_use_check(v21, v32); |
15445 if ( v49 ) | 15450 if ( !v45 ) |
15446 v82 = 1; | 15451 { |
15447 if ( v81 >= 5120 ) | 15452 if ( v21->pMonsterInfo.uMissleAttack1Type ) |
15448 goto LABEL_241; | 15453 { |
15449 v45 = stru_50C198.special_ability_use_check(v21, v32); | 15454 if ( v84 ) |
15450 if ( !v45 ) | 15455 { |
15451 { | 15456 Actor::_403476(v32, a2, &pDir); |
15452 if ( v21->pMonsterInfo.uMissleAttack1Type ) | 15457 continue; |
15453 { | 15458 |
15454 if ( v84 ) | 15459 } |
15455 { | 15460 if ( v82 ) |
15456 Actor::_403476(v32, a2, &pDir); | 15461 { |
15457 goto LABEL_254; | 15462 v69 = &pDir; |
15458 } | 15463 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15459 LABEL_223: | 15464 v51 = a2; |
15460 if ( v82 ) | 15465 v64 = (signed __int64)v47; |
15461 goto LABEL_217; | 15466 v52 = v32; |
15462 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15467 Actor::AI_Stand(v52, v51, v64, v69); |
15463 //UNDEF(v53); | 15468 continue; |
15464 v69 = &pDir; | 15469 } |
15465 if ( !(v54 | v55) ) | 15470 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15466 goto LABEL_219; | 15471 //UNDEF(v53); |
15467 LABEL_225: | 15472 v69 = &pDir; |
15468 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | 15473 if ( !(v54 | v55) ) |
15469 goto LABEL_254; | 15474 { |
15470 } | 15475 v51 = a2; |
15471 v56 = v80 * 307.2; | 15476 v64 = (signed __int64)v47; |
15472 if ( (double)v81 >= v56 ) | 15477 v52 = v32; |
15473 { | 15478 Actor::AI_Stand(v52, v51, v64, v69); |
15474 if ( v81 >= 1024 ) | 15479 continue; |
15475 { | 15480 } |
15476 if ( v82 ) | 15481 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); |
15477 goto LABEL_217; | 15482 continue; |
15478 v71 = &pDir; | 15483 } |
15479 v63 = 0; | 15484 v56 = v80 * 307.2; |
15480 goto LABEL_240; | 15485 if ( (double)v81 >= v56 ) |
15481 } | 15486 { |
15482 goto LABEL_235; | 15487 if ( v81 >= 1024 ) |
15483 } | 15488 { |
15484 goto LABEL_227; | 15489 if ( v82 ) |
15485 } | 15490 { |
15486 if ( v45 != 1 ) | 15491 v69 = &pDir; |
15487 { | 15492 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15488 if ( v45 > 1 && v45 <= 3 ) | 15493 v51 = a2; |
15489 { | 15494 v64 = (signed __int64)v47; |
15490 if ( v45 == 2 ) | 15495 v52 = v32; |
15491 v46 = v21->pMonsterInfo.uSpell1ID; | 15496 Actor::AI_Stand(v52, v51, v64, v69); |
15492 else | 15497 continue; |
15493 v46 = v21->pMonsterInfo.uSpell2ID; | 15498 } |
15494 if ( v46 ) | 15499 v71 = &pDir; |
15495 { | 15500 v63 = 0; |
15496 if ( v84 ) | 15501 |
15497 { | 15502 Actor::_402686(v32, a2, v63, v71); |
15498 if ( v45 == 2 ) | 15503 continue; |
15499 Actor::_403854(v32, a2, &pDir); | 15504 } |
15500 else | 15505 if ( v82 ) |
15501 Actor::_403A60(v32, a2, &pDir); | 15506 { |
15502 goto LABEL_254; | 15507 v69 = &pDir; |
15503 } | 15508 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15504 if ( v80 * 307.2 > (double)v81 || v82 ) | 15509 v51 = a2; |
15505 { | 15510 v64 = (signed __int64)v47; |
15506 LABEL_217: | 15511 v52 = v32; |
15507 v69 = &pDir; | 15512 Actor::AI_Stand(v52, v51, v64, v69); |
15508 LABEL_218: | 15513 continue; |
15509 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15514 } |
15510 LABEL_219: | 15515 v70 = (signed __int64)v56; |
15511 v51 = a2; | 15516 v62 = &pDir; |
15512 v64 = (signed __int64)v47; | 15517 v59 = 0; |
15513 v52 = v32; | 15518 Actor::_40281C(v32, a2, v59, v62, v70); |
15514 LABEL_247: | 15519 continue; |
15515 Actor::AI_Stand(v52, v51, v64, v69); | 15520 } |
15516 goto LABEL_254; | 15521 v49 = v84 == 0; |
15517 } | 15522 v69 = &pDir; |
15518 v69 = &pDir; | 15523 if ( v49 ) |
15519 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15524 { |
15520 goto LABEL_225; | 15525 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15521 } | 15526 v51 = a2; |
15522 v48 = v80 * 307.2; | 15527 v64 = (signed __int64)v47; |
15523 if ( (double)v81 >= v48 ) | 15528 v52 = v32; |
15524 { | 15529 Actor::AI_Stand(v52, v51, v64, v69); |
15525 if ( v81 >= 1024 ) | 15530 continue; |
15526 { | 15531 } |
15527 v50 = v82 == 0; | 15532 Actor::_403C6C(v32, a2, &pDir); |
15528 LABEL_215: | 15533 continue; |
15529 if ( !v50 ) | 15534 } |
15530 goto LABEL_217; | 15535 if ( v45 != 1 ) |
15531 v71 = &pDir; | 15536 { |
15532 v63 = 256; | 15537 if ( v45 > 1 && v45 <= 3 ) |
15533 LABEL_240: | 15538 { |
15534 Actor::_402686(v32, a2, v63, v71); | 15539 if ( v45 == 2 ) |
15535 goto LABEL_254; | 15540 v46 = v21->pMonsterInfo.uSpell1ID; |
15536 } | 15541 else |
15537 if ( v82 ) | 15542 v46 = v21->pMonsterInfo.uSpell2ID; |
15538 goto LABEL_217; | 15543 if ( v46 ) |
15539 v70 = (signed __int64)v48; | 15544 { |
15540 v62 = &pDir; | 15545 if ( v84 ) |
15541 v59 = 0; | 15546 { |
15542 goto LABEL_237; | 15547 if ( v45 == 2 ) |
15543 } | 15548 Actor::_403854(v32, a2, &pDir); |
15544 v49 = v84 == 0; | 15549 else |
15545 goto LABEL_209; | 15550 Actor::_403A60(v32, a2, &pDir); |
15546 } | 15551 continue; |
15547 LABEL_241: | 15552 } |
15548 if ( !v21->pMonsterInfo.uMovementType ) | 15553 if ( v80 * 307.2 > (double)v81 || v82 ) |
15549 { | 15554 { |
15550 v68 = 0; | 15555 v69 = &pDir; |
15551 v61 = 1024; | 15556 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15552 LABEL_252: | 15557 v51 = a2; |
15553 v41 = v32; | 15558 v64 = (signed __int64)v47; |
15554 v40 = 4; | 15559 v52 = v32; |
15555 LABEL_253: | 15560 Actor::AI_Stand(v52, v51, v64, v69); |
15556 Actor::_4032B2(v41, v40, v61, v68); | 15561 continue; |
15557 goto LABEL_254; | 15562 |
15558 } | 15563 } |
15559 if ( v21->pMonsterInfo.uMovementType == 1 ) | 15564 v69 = &pDir; |
15560 { | 15565 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15561 v68 = 0; | 15566 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); |
15562 v61 = 2560; | 15567 continue; |
15563 goto LABEL_252; | 15568 } |
15564 } | 15569 v48 = v80 * 307.2; |
15565 if ( v21->pMonsterInfo.uMovementType == 2 ) | 15570 if ( (double)v81 >= v48 ) |
15566 { | 15571 { |
15567 v68 = 0; | 15572 if ( v81 >= 1024 ) |
15568 v61 = 5120; | 15573 { |
15569 goto LABEL_252; | 15574 v50 = v82 == 0; |
15570 } | 15575 if ( !v50 ) |
15571 if ( v21->pMonsterInfo.uMovementType == 4 ) | 15576 { |
15572 { | 15577 v69 = &pDir; |
15573 v68 = 0; | 15578 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15574 v61 = 10240; | 15579 v51 = a2; |
15575 goto LABEL_252; | 15580 v64 = (signed __int64)v47; |
15576 } | 15581 v52 = v32; |
15577 if ( v21->pMonsterInfo.uMovementType == 5 ) | 15582 Actor::AI_Stand(v52, v51, v64, v69); |
15578 { | 15583 continue; |
15579 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | 15584 } |
15580 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | 15585 v71 = &pDir; |
15581 memcpy(&v74, v57, sizeof(v74)); | 15586 v63 = 256; |
15582 memcpy(&pDir, &v74, sizeof(pDir)); | 15587 Actor::_402686(v32, a2, v63, v71); |
15583 v69 = &pDir; | 15588 continue; |
15584 v52 = actor_id; | 15589 |
15585 v64 = (signed __int64)v58; | 15590 } |
15586 v51 = 4; | 15591 if ( v82 ) |
15587 goto LABEL_247; | 15592 { |
15588 } | 15593 v69 = &pDir; |
15589 goto LABEL_254; | 15594 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15590 } | 15595 v51 = a2; |
15591 if ( !v21->pMonsterInfo.uMissleAttack2Type ) | 15596 v64 = (signed __int64)v47; |
15592 { | 15597 v52 = v32; |
15593 v56 = v80 * 307.2; | 15598 Actor::AI_Stand(v52, v51, v64, v69); |
15594 if ( (double)v81 >= v56 ) | 15599 continue; |
15595 { | 15600 } |
15596 if ( v81 >= 1024 ) | 15601 v70 = (signed __int64)v48; |
15597 { | 15602 v62 = &pDir; |
15598 v50 = v82 == 0; | 15603 v59 = 0; |
15599 goto LABEL_215; | 15604 Actor::_40281C(v32, a2, v59, v62, v70); |
15600 } | 15605 continue; |
15601 LABEL_235: | 15606 } |
15602 if ( v82 ) | 15607 v49 = v84 == 0; |
15603 goto LABEL_217; | 15608 v69 = &pDir; |
15604 v70 = (signed __int64)v56; | 15609 if ( v49 ) |
15605 v62 = &pDir; | 15610 { |
15606 v59 = 0; | 15611 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; |
15607 LABEL_237: | 15612 v51 = a2; |
15608 Actor::_40281C(v32, a2, v59, v62, v70); | 15613 v64 = (signed __int64)v47; |
15609 goto LABEL_254; | 15614 v52 = v32; |
15610 } | 15615 Actor::AI_Stand(v52, v51, v64, v69); |
15611 LABEL_227: | 15616 continue; |
15612 v49 = v84 == 0; | 15617 } |
15613 LABEL_209: | 15618 Actor::_403C6C(v32, a2, &pDir); |
15614 v69 = &pDir; | 15619 continue; |
15615 if ( v49 ) | 15620 } |
15616 goto LABEL_218; | 15621 } |
15617 Actor::_403C6C(v32, a2, &pDir); | 15622 } |
15618 goto LABEL_254; | 15623 } |
15619 } | 15624 if ( v21->pMonsterInfo.uHostilityType != 4 || !a2 || v81 >= 5120 || v45 != 1 ) |
15620 if ( !v84 ) | 15625 { |
15621 goto LABEL_223; | 15626 if ( !v21->pMonsterInfo.uMovementType ) |
15622 Actor::_40368B(v32, a2, &pDir); | 15627 { |
15623 LABEL_254: | 15628 v68 = 0; |
15624 ++v78; | 15629 v61 = 1024; |
15625 if ( v78 >= ai_arrays_size ) | 15630 v41 = v32; |
15626 return; | 15631 v40 = 4; |
15627 } | 15632 Actor::_4032B2(v41, v40, v61, v68); |
15628 v65 = v21->pMonsterInfo.uSpellSkillAndMastery1; | 15633 continue; |
15629 v60 = 2; | 15634 |
15630 v33 = v21->pMonsterInfo.uSpell1ID; | 15635 } |
15631 goto LABEL_146; | 15636 if ( v21->pMonsterInfo.uMovementType == 1 ) |
15632 } | 15637 { |
15638 v68 = 0; | |
15639 v61 = 2560; | |
15640 v41 = v32; | |
15641 v40 = 4; | |
15642 Actor::_4032B2(v41, v40, v61, v68); | |
15643 continue; | |
15644 } | |
15645 if ( v21->pMonsterInfo.uMovementType == 2 ) | |
15646 { | |
15647 v68 = 0; | |
15648 v61 = 5120; | |
15649 v41 = v32; | |
15650 v40 = 4; | |
15651 Actor::_4032B2(v41, v40, v61, v68); | |
15652 continue; | |
15653 } | |
15654 if ( v21->pMonsterInfo.uMovementType == 4 ) | |
15655 { | |
15656 v68 = 0; | |
15657 v61 = 10240; | |
15658 v41 = v32; | |
15659 v40 = 4; | |
15660 Actor::_4032B2(v41, v40, v61, v68); | |
15661 continue; | |
15662 } | |
15663 if ( v21->pMonsterInfo.uMovementType == 5 ) | |
15664 { | |
15665 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | |
15666 v58 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15667 memcpy(&v74, v57, sizeof(v74)); | |
15668 memcpy(&pDir, &v74, sizeof(pDir)); | |
15669 v69 = &pDir; | |
15670 v52 = actor_id; | |
15671 v64 = (signed __int64)v58; | |
15672 v51 = 4; | |
15673 Actor::AI_Stand(v52, v51, v64, v69); | |
15674 continue; | |
15675 } | |
15676 continue; | |
15677 | |
15678 } | |
15679 if ( !v21->pMonsterInfo.uMissleAttack2Type ) | |
15680 { | |
15681 v56 = v80 * 307.2; | |
15682 if ( (double)v81 >= v56 ) | |
15683 { | |
15684 if ( v81 >= 1024 ) | |
15685 { | |
15686 v50 = v82 == 0; | |
15687 if ( !v50 ) | |
15688 { | |
15689 v69 = &pDir; | |
15690 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15691 v51 = a2; | |
15692 v64 = (signed __int64)v47; | |
15693 v52 = v32; | |
15694 Actor::AI_Stand(v52, v51, v64, v69); | |
15695 continue; | |
15696 } | |
15697 v71 = &pDir; | |
15698 v63 = 256; | |
15699 Actor::_402686(v32, a2, v63, v71); | |
15700 continue; | |
15701 } | |
15702 if ( v82 ) | |
15703 { | |
15704 v69 = &pDir; | |
15705 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15706 v51 = a2; | |
15707 v64 = (signed __int64)v47; | |
15708 v52 = v32; | |
15709 Actor::AI_Stand(v52, v51, v64, v69); | |
15710 continue; | |
15711 } | |
15712 v70 = (signed __int64)v56; | |
15713 v62 = &pDir; | |
15714 v59 = 0; | |
15715 Actor::_40281C(v32, a2, v59, v62, v70); | |
15716 continue; | |
15717 | |
15718 } | |
15719 v49 = v84 == 0; | |
15720 v69 = &pDir; | |
15721 if ( v49 ) | |
15722 { | |
15723 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15724 v51 = a2; | |
15725 v64 = (signed __int64)v47; | |
15726 v52 = v32; | |
15727 Actor::AI_Stand(v52, v51, v64, v69); | |
15728 continue; | |
15729 } | |
15730 Actor::_403C6C(v32, a2, &pDir); | |
15731 continue; | |
15732 } | |
15733 if ( !v84 ) | |
15734 { | |
15735 if ( v82 ) | |
15736 { | |
15737 v69 = &pDir; | |
15738 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15739 v51 = a2; | |
15740 v64 = (signed __int64)v47; | |
15741 v52 = v32; | |
15742 Actor::AI_Stand(v52, v51, v64, v69); | |
15743 continue; | |
15744 } | |
15745 v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15746 //UNDEF(v53); | |
15747 v69 = &pDir; | |
15748 if ( !(v54 | v55) ) | |
15749 { | |
15750 v51 = a2; | |
15751 v64 = (signed __int64)v47; | |
15752 v52 = v32; | |
15753 Actor::AI_Stand(v52, v51, v64, v69); | |
15754 continue; | |
15755 } | |
15756 Actor::_402AD7(v32, a2, v32, (signed __int64)v47, v69); | |
15757 continue; | |
15758 } | |
15759 Actor::_40368B(v32, a2, &pDir); | |
15760 } | |
15761 } | |
15633 } | 15762 } |
15634 | 15763 |
15635 //----- (0040261D) -------------------------------------------------------- | 15764 //----- (0040261D) -------------------------------------------------------- |
15636 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) | 15765 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) |
15637 { | 15766 { |
15976 v18 = 0; | 16105 v18 = 0; |
15977 if ( (signed int)v37 > (signed int)v2 ) | 16106 if ( (signed int)v37 > (signed int)v2 ) |
15978 { | 16107 { |
15979 do | 16108 do |
15980 { | 16109 { |
16110 __debugbreak(); | |
15981 *(&v31.uDistance + v18) = pParty->pPlayers[*(&v1->field_0 + 4 * (*(&a3.uDistance + v18) + 2)) >> 3].GetAttackRecoveryTime( | 16111 *(&v31.uDistance + v18) = pParty->pPlayers[*(&v1->field_0 + 4 * (*(&a3.uDistance + v18) + 2)) >> 3].GetAttackRecoveryTime( |
15982 v2); | 16112 v2); |
15983 ++v18; | 16113 ++v18; |
15984 } | 16114 } |
15985 while ( (signed int)v18 < (signed int)v37 ); | 16115 while ( (signed int)v18 < (signed int)v37 ); |