Mercurial > mm7
comparison mm7_3.cpp @ 1295:86a83e12d795
moving files
author | Ritor1 |
---|---|
date | Mon, 17 Jun 2013 17:34:01 +0600 |
parents | 6bbd50bda571 |
children | 5450af4f57ef |
comparison
equal
deleted
inserted
replaced
1294:6bbd50bda571 | 1295:86a83e12d795 |
---|---|
3853 --uNumActions; | 3853 --uNumActions; |
3854 | 3854 |
3855 return result; | 3855 return result; |
3856 } | 3856 } |
3857 // 47730C: using guessed type int __stdcall const_1(int); | 3857 // 47730C: using guessed type int __stdcall const_1(int); |
3858 | |
3859 //----- (0047752B) -------------------------------------------------------- | |
3860 int __cdecl GetPartyReputation() | |
3861 { | |
3862 DDM_DLV_Header *v0; // ebx@1 | |
3863 signed int v1; // esi@3 | |
3864 | |
3865 v0 = &pOutdoor->ddm; | |
3866 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
3867 v0 = &pIndoor->dlv; | |
3868 v1 = 0; | |
3869 if ( CheckHiredNPCSpeciality(Pirate) ) | |
3870 v1 += 5; | |
3871 if ( CheckHiredNPCSpeciality(Burglar) ) | |
3872 v1 += 5; | |
3873 if ( CheckHiredNPCSpeciality(Gypsy) ) | |
3874 v1 += 5; | |
3875 if ( CheckHiredNPCSpeciality(Duper) ) | |
3876 v1 += 5; | |
3877 if ( CheckHiredNPCSpeciality(FallenWizard) ) | |
3878 v1 += 5; | |
3879 return v1 + v0->uReputation; | |
3880 } | |
3881 | 3858 |
3882 //----- (004775ED) -------------------------------------------------------- | 3859 //----- (004775ED) -------------------------------------------------------- |
3883 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) | 3860 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) |
3884 { | 3861 { |
3885 char *v2; // edi@1 | 3862 char *v2; // edi@1 |
7524 return result; | 7501 return result; |
7525 } | 7502 } |
7526 // 50B570: using guessed type int dword_50B570[]; | 7503 // 50B570: using guessed type int dword_50B570[]; |
7527 // 50B638: using guessed type int dword_50B638[]; | 7504 // 50B638: using guessed type int dword_50B638[]; |
7528 | 7505 |
7529 //----- (00481E55) -------------------------------------------------------- | |
7530 void OutdoorCamera::Project(unsigned int uNumVertices) | |
7531 { | |
7532 double v1; // st7@2 | |
7533 double v2; // st6@2 | |
7534 double v3; // st5@2 | |
7535 int v4; // eax@2 | |
7536 unsigned int v5; // edx@2 | |
7537 double v6; // st4@3 | |
7538 double v7; // st3@3 | |
7539 | |
7540 if ( (signed int)uNumVertices > 0 ) | |
7541 { | |
7542 v1 = (double)pOutdoorCamera->int_fov_rad; | |
7543 v2 = (double)pViewport->uScreenCenterX; | |
7544 v3 = (double)pViewport->uScreenCenterY; | |
7545 v4 = 0; | |
7546 v5 = uNumVertices; | |
7547 do | |
7548 { | |
7549 v6 = v1 * array_507D30[v4]._rhw; | |
7550 v7 = v6 * array_507D30[v4].vWorldViewPosition.y; | |
7551 memcpy(&array_50AC10[v4], &array_507D30[v4], sizeof(array_50AC10[v4])); | |
7552 array_50AC10[v4].vWorldViewProjX = v2 - v7; | |
7553 array_50AC10[v4].vWorldViewProjY = v3 - v6 * array_507D30[v4].vWorldViewPosition.z; | |
7554 ++v4; | |
7555 --v5; | |
7556 } | |
7557 while ( v5 ); | |
7558 } | |
7559 } | |
7560 | |
7561 //----- (00481EB7) -------------------------------------------------------- | 7506 //----- (00481EB7) -------------------------------------------------------- |
7562 void __cdecl ResetStru148s() | 7507 void __cdecl ResetStru148s() |
7563 { | 7508 { |
7564 int v0; // ecx@1 | 7509 int v0; // ecx@1 |
7565 char *v1; // eax@2 | 7510 char *v1; // eax@2 |
10424 ++v->y; | 10369 ++v->y; |
10425 if ( v->y > 1000 ) | 10370 if ( v->y > 1000 ) |
10426 v->y = 0; | 10371 v->y = 0; |
10427 } | 10372 } |
10428 | 10373 |
10429 //----- (00485F64) -------------------------------------------------------- | |
10430 void OutdoorCamera::_485F64() | |
10431 { | |
10432 int v1; // eax@1 | |
10433 int v2; // eax@2 | |
10434 signed __int64 v3; // qtt@4 | |
10435 int v4; // eax@4 | |
10436 | |
10437 this->uCameraFovInDegrees = 75; | |
10438 v1 = stru_5C6E00->uPiMask & 0xD5; | |
10439 if ( v1 >= (signed int)stru_5C6E00->uIntegerHalfPi ) | |
10440 v2 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v1]; | |
10441 else | |
10442 v2 = stru_5C6E00->pTanTable[v1]; | |
10443 LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31; | |
10444 HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16; | |
10445 v4 = (signed int)(v3 / v2) >> 16; | |
10446 this->int_fov_rad = v4; | |
10447 this->field_4C = 360000; | |
10448 this->int_fov_rad_inv = 65536 / v4; | |
10449 this->field_50 = 115; | |
10450 unnamed_6BE060[1] = 1; | |
10451 RotationToInts(); | |
10452 } | |
10453 | |
10454 //----- (0048600E) -------------------------------------------------------- | |
10455 void OutdoorCamera::RotationToInts() | |
10456 { | |
10457 camera_rotation_y_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
10458 camera_rotation_y_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
10459 camera_rotation_x_int_sine = stru_5C6E00->Sin(pIndoorCamera->sRotationX); | |
10460 camera_rotation_x_int_cosine = stru_5C6E00->Cos(pIndoorCamera->sRotationX); | |
10461 } | |
10462 | |
10463 //----- (0048607B) -------------------------------------------------------- | 10374 //----- (0048607B) -------------------------------------------------------- |
10464 void stru148::_48607B(stru149 *a2) | 10375 void stru148::_48607B(stru149 *a2) |
10465 { | 10376 { |
10466 this->pTexture = 0; | 10377 this->pTexture = 0; |
10467 this->ptr_38 = a2; | 10378 this->ptr_38 = a2; |
10622 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; | 10533 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; |
10623 this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); | 10534 this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); |
10624 return result; | 10535 return result; |
10625 } | 10536 } |
10626 | 10537 |
10627 //----- (0048653D) -------------------------------------------------------- | |
10628 int stru149::_48653D(int a2, int a3, int a4, int a5, int a6, int a7) | |
10629 { | |
10630 stru149 *v7; // esi@1 | |
10631 int v8; // edi@1 | |
10632 int v9; // eax@1 | |
10633 //int v10; // edx@1 | |
10634 //int v11; // ecx@1 | |
10635 int v12; // eax@1 | |
10636 int v13; // ebx@2 | |
10637 int v14; // ecx@2 | |
10638 int v15; // eax@2 | |
10639 int v16; // ST14_4@3 | |
10640 int v17; // ST10_4@3 | |
10641 int v18; // eax@5 | |
10642 int v19; // ST10_4@6 | |
10643 int v20; // eax@8 | |
10644 int v21; // ST10_4@9 | |
10645 int v22; // eax@10 | |
10646 int v23; // ecx@10 | |
10647 int v24; // eax@10 | |
10648 int result; // eax@10 | |
10649 //int v26; // [sp+14h] [bp-14h]@1 | |
10650 int v27; // [sp+18h] [bp-10h]@1 | |
10651 int v28; // [sp+1Ch] [bp-Ch]@1 | |
10652 int v29; // [sp+24h] [bp-4h]@1 | |
10653 int v30; // [sp+30h] [bp+8h]@10 | |
10654 int v31; // [sp+3Ch] [bp+14h]@10 | |
10655 | |
10656 v7 = this; | |
10657 v8 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotY); | |
10658 v29 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotY); | |
10659 v28 = stru_5C6E00->Cos(pBLVRenderParams->sPartyRotX); | |
10660 v9 = stru_5C6E00->Sin(pBLVRenderParams->sPartyRotX); | |
10661 //v11 = -pBLVRenderParams->vPartyPos.y; | |
10662 //v26 = -pBLVRenderParams->vPartyPos.x; | |
10663 v27 = v9; | |
10664 v12 = -pBLVRenderParams->vPartyPos.z; | |
10665 if ( pBLVRenderParams->sPartyRotX ) | |
10666 { | |
10667 v16 = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; | |
10668 v13 = v28; | |
10669 v17 = -65536 * pBLVRenderParams->vPartyPos.z; | |
10670 v7->field_0_party_dir_x = ((unsigned __int64)(v16 * (signed __int64)v28) >> 16) | |
10671 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)v27) >> 16); | |
10672 v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; | |
10673 v14 = v27; | |
10674 v15 = ((unsigned __int64)(v17 * (signed __int64)v28) >> 16) - ((unsigned __int64)(v16 * (signed __int64)v27) >> 16); | |
10675 } | |
10676 else | |
10677 { | |
10678 v7->field_0_party_dir_x = v8 * -pBLVRenderParams->vPartyPos.x + v29 * -pBLVRenderParams->vPartyPos.y; | |
10679 v13 = v28; | |
10680 v7->field_4_party_dir_y = v8 * -pBLVRenderParams->vPartyPos.y - v29 * -pBLVRenderParams->vPartyPos.x; | |
10681 v14 = v27; | |
10682 v15 = v12 << 16; | |
10683 } | |
10684 v7->field_8 = v15; | |
10685 if ( pBLVRenderParams->sPartyRotX ) | |
10686 { | |
10687 v19 = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); | |
10688 v7->field_C = ((unsigned __int64)(v19 * (signed __int64)v13) >> 16) | |
10689 + ((unsigned __int64)(a4 * (signed __int64)v14) >> 16); | |
10690 v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) | |
10691 - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); | |
10692 v18 = ((unsigned __int64)(a4 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v14) >> 16); | |
10693 } | |
10694 else | |
10695 { | |
10696 v7->field_C = ((unsigned __int64)(a2 * (signed __int64)v8) >> 16) | |
10697 + ((unsigned __int64)(a3 * (signed __int64)v29) >> 16); | |
10698 v7->field_10 = ((unsigned __int64)(a3 * (signed __int64)v8) >> 16) | |
10699 - ((unsigned __int64)(a2 * (signed __int64)v29) >> 16); | |
10700 v18 = a4; | |
10701 } | |
10702 v7->field_14 = v18; | |
10703 if ( pBLVRenderParams->sPartyRotX ) | |
10704 { | |
10705 v21 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); | |
10706 v7->field_18 = ((unsigned __int64)(v21 * (signed __int64)v13) >> 16) | |
10707 + ((unsigned __int64)(a7 * (signed __int64)v14) >> 16); | |
10708 v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) | |
10709 - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); | |
10710 v20 = ((unsigned __int64)(a7 * (signed __int64)v13) >> 16) - ((unsigned __int64)(v21 * (signed __int64)v14) >> 16); | |
10711 } | |
10712 else | |
10713 { | |
10714 v7->field_18 = ((unsigned __int64)(a5 * (signed __int64)v8) >> 16) | |
10715 + ((unsigned __int64)(a6 * (signed __int64)v29) >> 16); | |
10716 v7->field_1C = ((unsigned __int64)(a6 * (signed __int64)v8) >> 16) | |
10717 - ((unsigned __int64)(a5 * (signed __int64)v29) >> 16); | |
10718 v20 = a7; | |
10719 } | |
10720 v7->field_18 = -v7->field_18; | |
10721 v7->field_1C = -v7->field_1C; | |
10722 v7->field_20 = v20; | |
10723 v22 = v7->field_C; | |
10724 v7->field_20 = -v7->field_20; | |
10725 v23 = ((unsigned __int64)(v22 * (signed __int64)v7->field_0_party_dir_x) >> 16) | |
10726 + ((unsigned __int64)(v7->field_10 * (signed __int64)v7->field_4_party_dir_y) >> 16) | |
10727 + ((unsigned __int64)(v7->field_14 * (signed __int64)v7->field_8) >> 16); | |
10728 v30 = v7->field_18; | |
10729 v24 = v7->field_0_party_dir_x; | |
10730 v7->field_24 = v23; | |
10731 v31 = (unsigned __int64)(v30 * (signed __int64)v24) >> 16; | |
10732 result = (unsigned __int64)(v7->field_1C * (signed __int64)v7->field_4_party_dir_y) >> 16; | |
10733 v7->field_28 = v31 + result + ((unsigned __int64)(v7->field_20 * (signed __int64)v7->field_8) >> 16); | |
10734 return result; | |
10735 } | |
10736 | |
10737 //----- (0048694B) -------------------------------------------------------- | 10538 //----- (0048694B) -------------------------------------------------------- |
10738 int stru149::_48694B() | 10539 int stru149::_48694B() |
10739 { | 10540 { |
10740 int v1; // eax@1 | 10541 int v1; // eax@1 |
10741 int v2; // ST04_4@1 | 10542 int v2; // ST04_4@1 |
10756 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); | 10557 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); |
10757 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; | 10558 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; |
10758 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; | 10559 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; |
10759 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); | 10560 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); |
10760 return result; | 10561 return result; |
10761 } | |
10762 | |
10763 //----- (00486A28) -------------------------------------------------------- | |
10764 void OutdoorCamera::AllocSoftwareDrawBuffers() | |
10765 { | |
10766 if ( !this || !pSpans ) | |
10767 { | |
10768 ReleaseSoftwareDrawBuffers(); | |
10769 pSpans = (Span *)pAllocator->AllocNamedChunk(pSpans, 0x493E0u, "SPANS"); | |
10770 pEdges = (Edge *)pAllocator->AllocNamedChunk(pEdges, 0x4C2C0u, "EDGES"); | |
10771 pSurfs = (Surf *)pAllocator->AllocNamedChunk(pSurfs, 0x11940u, "SURFS"); | |
10772 pNewEdges = (Edge *)pAllocator->AllocNamedChunk(pNewEdges, 0x6180u, "NEWEDGES"); | |
10773 memset(pSpans, 0, 0x493E0u); | |
10774 memset(pEdges, 0, 0x4C2C0u); | |
10775 memset(pSurfs, 0, 0x11940u); | |
10776 memset(pNewEdges, 0, 0x6180u); | |
10777 } | |
10778 } | |
10779 | |
10780 //----- (00486AFC) -------------------------------------------------------- | |
10781 void OutdoorCamera::ReleaseSoftwareDrawBuffers() | |
10782 { | |
10783 pAllocator->FreeChunk(pSpans); | |
10784 pAllocator->FreeChunk(pEdges); | |
10785 pAllocator->FreeChunk(pSurfs); | |
10786 pAllocator->FreeChunk(pNewEdges); | |
10787 pSpans = 0; | |
10788 pEdges = 0; | |
10789 pSurfs = 0; | |
10790 pNewEdges = 0; | |
10791 } | 10562 } |
10792 | 10563 |
10793 //----- (00486B4E) -------------------------------------------------------- | 10564 //----- (00486B4E) -------------------------------------------------------- |
10794 char __fastcall sr_sub_486B4E_push_outdoor_edges(RenderVertexSoft *a1, int *a2, int *a3, stru148 *a4)//maybe DrawPolygonSW | 10565 char __fastcall sr_sub_486B4E_push_outdoor_edges(RenderVertexSoft *a1, int *a2, int *a3, stru148 *a4)//maybe DrawPolygonSW |
10795 { | 10566 { |
11006 } | 10777 } |
11007 } | 10778 } |
11008 return v7; | 10779 return v7; |
11009 } | 10780 } |
11010 | 10781 |
11011 //----- (0043F953) -------------------------------------------------------- | |
11012 void PrepareBspRenderList_BLV() | |
11013 { | |
11014 pBspRenderer->num_faces = 0; | |
11015 | |
11016 if (pBLVRenderParams->uPartySectorID) | |
11017 { | |
11018 pBspRenderer->nodes[0].uSectorID = pBLVRenderParams->uPartySectorID; | |
11019 pBspRenderer->nodes[0].uViewportW = pBLVRenderParams->uViewportW; | |
11020 pBspRenderer->nodes[0].uViewportZ = pBLVRenderParams->uViewportZ; | |
11021 pBspRenderer->nodes[0].uViewportY = pBLVRenderParams->uViewportY; | |
11022 pBspRenderer->nodes[0].uViewportX = pBLVRenderParams->uViewportX; | |
11023 pBspRenderer->nodes[0].field_C.GetViewportData(pBLVRenderParams->uViewportX, pBLVRenderParams->uViewportY, | |
11024 pBLVRenderParams->uViewportZ, pBLVRenderParams->uViewportW); | |
11025 pBspRenderer->nodes[0].uFaceID = -1; | |
11026 pBspRenderer->nodes[0].viewing_portal_id = -1; | |
11027 pBspRenderer->num_nodes = 1; | |
11028 AddBspNodeToRenderList(0); | |
11029 } | |
11030 | |
11031 pBspRenderer->MakeVisibleSectorList(); | |
11032 } | |
11033 | |
11034 //----- (0043F9E1) -------------------------------------------------------- | |
11035 void BspRenderer_stru2::GetViewportData(__int16 x, int y, __int16 z, int w) | |
11036 { | |
11037 _viewport_space_y = y; | |
11038 _viewport_space_w = w; | |
11039 | |
11040 for (uint i = 0; i < 480; ++i) | |
11041 { | |
11042 if ( i < y || i > w ) | |
11043 { | |
11044 viewport_left_side[i] = 640; | |
11045 viewport_right_side[i] = -1; | |
11046 } | |
11047 else | |
11048 { | |
11049 viewport_left_side[i] = x; | |
11050 viewport_right_side[i] = z; | |
11051 } | |
11052 } | |
11053 } | |
11054 | |
11055 //----- (0043FA33) -------------------------------------------------------- | |
11056 void __fastcall PrepareDecorationsRenderList_BLV(unsigned int uDecorationID, unsigned int uSectorID) | |
11057 { | |
11058 LevelDecoration *v2; // esi@1 | |
11059 DecorationDesc *v3; // ebx@2 | |
11060 __int16 v4; // ax@2 | |
11061 double v5; // st7@3 | |
11062 int v6; // eax@5 | |
11063 int v7; // edx@5 | |
11064 unsigned int v8; // edi@5 | |
11065 int v9; // edi@5 | |
11066 int v10; // eax@7 | |
11067 SpriteFrame *v11; // eax@7 | |
11068 SpriteFrame *v12; // esi@7 | |
11069 int v13; // eax@7 | |
11070 int v14; // ebx@16 | |
11071 RenderBillboard *v15; // ecx@17 | |
11072 char v16; // zf@18 | |
11073 IndoorCameraD3D **v17; // eax@19 | |
11074 double v18; // st7@19 | |
11075 //float v19; // eax@19 | |
11076 signed __int64 v20; // qtt@19 | |
11077 signed __int64 v21; // qtt@20 | |
11078 //int v22; // edx@21 | |
11079 //int v23; // eax@21 | |
11080 Particle_sw local_0; // [sp+Ch] [bp-A0h]@3 | |
11081 //double v25; // [sp+74h] [bp-38h]@19 | |
11082 //unsigned int v26; // [sp+7Ch] [bp-30h]@1 | |
11083 int a2; // [sp+80h] [bp-2Ch]@5 | |
11084 int a3; // [sp+84h] [bp-28h]@5 | |
11085 int a1; // [sp+88h] [bp-24h]@5 | |
11086 int v30; // [sp+8Ch] [bp-20h]@7 | |
11087 //float v31; // [sp+90h] [bp-1Ch]@1 | |
11088 int a5; // [sp+94h] [bp-18h]@17 | |
11089 int z; // [sp+98h] [bp-14h]@15 | |
11090 int a6; // [sp+9Ch] [bp-10h]@17 | |
11091 int y; // [sp+A0h] [bp-Ch]@15 | |
11092 int x; // [sp+A4h] [bp-8h]@15 | |
11093 int v37; // [sp+A8h] [bp-4h]@5 | |
11094 | |
11095 //v26 = uDecorationID; | |
11096 //LODWORD(v31) = uSectorID; | |
11097 v2 = &pLevelDecorations[uDecorationID]; | |
11098 if (v2->field_2 & 0x20) | |
11099 return; | |
11100 | |
11101 v3 = &pDecorationList->pDecorations[v2->uDecorationDescID]; | |
11102 v4 = v3->uFlags; | |
11103 if (v3->uFlags & DECORATION_EMITS_FIRE) | |
11104 { | |
11105 memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern | |
11106 v5 = (double)v2->vPosition.x; | |
11107 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; | |
11108 local_0.uDiffuse = 0xFF3C1E; | |
11109 local_0.x = v5; | |
11110 local_0.y = (double)v2->vPosition.y; | |
11111 local_0.z = (double)v2->vPosition.z; | |
11112 local_0.flt_10 = 0.0; | |
11113 local_0.flt_14 = 0.0; | |
11114 local_0.flt_18 = 0.0; | |
11115 local_0.flt_28 = 1.0; | |
11116 local_0.timeToLive = (rand() & 0x80) + 128; | |
11117 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); | |
11118 pGame->pParticleEngine->AddParticle(&local_0); | |
11119 return; | |
11120 } | |
11121 | |
11122 | |
11123 if (v4 & DECORATION_DONT_DRAW) | |
11124 return; | |
11125 | |
11126 v6 = v2->vPosition.x; | |
11127 v7 = v2->vPosition.z; | |
11128 a2 = v2->vPosition.y; | |
11129 a1 = v6; | |
11130 a3 = v7; | |
11131 v8 = v2->field_10_y_rot | |
11132 + ((signed int)stru_5C6E00->uIntegerPi >> 3) | |
11133 - stru_5C6E00->Atan2(v6 - pBLVRenderParams->vPartyPos.x, a2 - pBLVRenderParams->vPartyPos.y); | |
11134 v37 = pBLVRenderParams->field_0_timer_; | |
11135 v9 = ((signed int)(stru_5C6E00->uIntegerPi + v8) >> 8) & 7; | |
11136 if (pParty->bTurnBasedModeOn) | |
11137 v37 = pMiscTimer->uTotalGameTimeElapsed; | |
11138 v10 = abs(v2->vPosition.x + v2->vPosition.y); | |
11139 v11 = pSpriteFrameTable->GetFrame(v3->uSpriteID, v37 + v10); | |
11140 v30 = 0; | |
11141 v12 = v11; | |
11142 v13 = v11->uFlags; | |
11143 if ( v13 & 2 ) | |
11144 v30 = 2; | |
11145 if ( v13 & 0x40000 ) | |
11146 v30 |= 0x40u; | |
11147 if ( v13 & 0x20000 ) | |
11148 LOBYTE(v30) = v30 | 0x80; | |
11149 if ( (256 << v9) & v13 ) | |
11150 v30 |= 4u; | |
11151 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible(a1, a2, a3, &x, &y, &z, 1) ) | |
11152 { | |
11153 v14 = abs(x); | |
11154 if ( v14 >= abs(y) ) | |
11155 { | |
11156 pGame->pIndoorCameraD3D->Project(x, y, z, &a5, &a6); | |
11157 | |
11158 v15 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
11159 assert(uNumBillboardsToDraw < 500); | |
11160 | |
11161 ++uNumBillboardsToDraw; | |
11162 ++uNumDecorationsDrawnThisFrame; | |
11163 v16 = pRenderer->pRenderD3D == 0; | |
11164 v15->uHwSpriteID = v12->pHwSpriteIDs[v9]; | |
11165 v15->uPalette = v12->uPaletteIndex; | |
11166 v15->uIndoorSectorID = uSectorID; | |
11167 if ( v16 ) | |
11168 { | |
11169 LODWORD(v21) = pBLVRenderParams->field_40 << 16; | |
11170 HIDWORD(v21) = pBLVRenderParams->field_40 >> 16; | |
11171 v37 = v21 / x; | |
11172 //LODWORD(v31) = v12->scale; | |
11173 v37 = v21 / x; | |
11174 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v21 / x) >> 16; | |
11175 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16; | |
11176 } | |
11177 else | |
11178 { | |
11179 v17 = &pGame->pIndoorCameraD3D; | |
11180 v15->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
11181 v18 = (*v17)->fov_y; | |
11182 //v19 = v15->fov_x; | |
11183 v15->fov_y = v18; | |
11184 //v31 = v19; | |
11185 //v25 = v19 + 6.7553994e15; | |
11186 //v25 = floorf(v15->fov_x + 0.5f); | |
11187 LODWORD(v20) = 0; | |
11188 HIDWORD(v20) = floorf(v15->fov_x + 0.5f); | |
11189 v37 = v20 / x; | |
11190 //LODWORD(v31) = v12->scale; | |
11191 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
11192 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
11193 //v31 = v15->fov_y; | |
11194 //v25 = v31 + 6.7553994e15; | |
11195 //v25 = floorf(v15->fov_y + 0.5f); | |
11196 LODWORD(v20) = 0; | |
11197 HIDWORD(v20) = floorf(v15->fov_y + 0.5f); | |
11198 v37 = v20 / x; | |
11199 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; | |
11200 } | |
11201 //HIWORD(v22) = HIWORD(x); | |
11202 //LOWORD(v22) = 0; | |
11203 v15->_screenspace_y_scaler_packedfloat = v37; | |
11204 v15->field_1E = v30; | |
11205 v15->world_x = a1; | |
11206 v15->world_y = a2; | |
11207 v15->world_z = a3; | |
11208 v15->uScreenSpaceX = a5; | |
11209 v15->uScreenSpaceY = a6; | |
11210 //v23 = 8 * uDecorationID; | |
11211 //LOBYTE(v23) = PID(OBJECT_Decoration,uDecorationID); | |
11212 | |
11213 //v15->sZValue = v22 + v23; | |
11214 v15->actual_z = HIWORD(x); | |
11215 v15->object_pid = PID(OBJECT_Decoration,uDecorationID); | |
11216 | |
11217 v15->uTintColor = 0; | |
11218 v15->pSpriteFrame = v12; | |
11219 } | |
11220 } | |
11221 } | |
11222 | |
11223 //----- (0044028F) -------------------------------------------------------- | |
11224 void PrepareItemsRenderList_BLV() | |
11225 { | |
11226 ObjectDesc *v1; // ebx@4 | |
11227 __int16 v2; // ax@5 | |
11228 RenderBillboard *v3; // esi@12 | |
11229 SpriteFrame *v4; // eax@12 | |
11230 SpriteFrame *v5; // ebx@12 | |
11231 unsigned int v6; // eax@12 | |
11232 int v7; // ecx@12 | |
11233 int v8; // edx@12 | |
11234 int v9; // ecx@12 | |
11235 unsigned __int16 v10; // ax@12 | |
11236 int *v11; // eax@20 | |
11237 //char v12; // zf@26 | |
11238 __int64 v18; // ST5C_4@27 | |
11239 signed __int64 v19; // qtt@28 | |
11240 int v20; // ST5C_4@28 | |
11241 //int v21; // edx@29 | |
11242 __int16 v22; // ax@29 | |
11243 //int v23; // eax@29 | |
11244 SpriteFrame *v24; // [sp+1Ch] [bp-40h]@12 | |
11245 //__int16 a5; // [sp+28h] [bp-34h]@12 | |
11246 int a6; // [sp+2Ch] [bp-30h]@12 | |
11247 int a2; // [sp+30h] [bp-2Ch]@12 | |
11248 int a1; // [sp+34h] [bp-28h]@12 | |
11249 int v30; // [sp+38h] [bp-24h]@12 | |
11250 int v31; // [sp+38h] [bp-24h]@27 | |
11251 int a3; // [sp+40h] [bp-1Ch]@12 | |
11252 signed __int16 v34; // [sp+44h] [bp-18h]@14 | |
11253 int v35; // [sp+48h] [bp-14h]@25 | |
11254 int v36; // [sp+4Ch] [bp-10h]@25 | |
11255 signed int z; // [sp+50h] [bp-Ch]@24 | |
11256 signed int y; // [sp+54h] [bp-8h]@24 | |
11257 signed int x; // [sp+58h] [bp-4h]@24 | |
11258 | |
11259 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
11260 { | |
11261 auto p = &pSpriteObjects[i]; | |
11262 if (p->uObjectDescID) | |
11263 { | |
11264 v1 = &pObjectList->pObjects[p->uObjectDescID]; | |
11265 if ( !(v1->uFlags & 1) ) | |
11266 { | |
11267 if ( ((v2 = p->uType, v2 < 1000) || v2 >= 10000) | |
11268 && (v2 < 500 || v2 >= 600) | |
11269 && (v2 < 811 || v2 >= 815) | |
11270 || pGame->pStru6Instance->_4A81CA(p)) | |
11271 { | |
11272 //a5 = p->uSectorID; | |
11273 a1 = p->vPosition.x; | |
11274 a2 = p->vPosition.y; | |
11275 a3 = p->vPosition.z; | |
11276 v3 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
11277 v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, p->uSpriteFrameID); | |
11278 v5 = v4; | |
11279 v24 = v4; | |
11280 v30 = v4->uFlags; | |
11281 a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier; | |
11282 v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x, | |
11283 p->vPosition.y - pBLVRenderParams->vPartyPos.y); | |
11284 LOWORD(v7) = p->uFacing; | |
11285 v8 = v30; | |
11286 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; | |
11287 v10 = v5->pHwSpriteIDs[v9]; | |
11288 v3->uHwSpriteID = v10; | |
11289 if ( v30 & 0x20 ) | |
11290 { | |
11291 v8 = v30; | |
11292 a3 -= (signed int)((unsigned __int64)(v5->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
11293 } | |
11294 v34 = 0; | |
11295 if ( v8 & 2 ) | |
11296 v34 = 2; | |
11297 if ( v8 & 0x40000 ) | |
11298 v34 |= 0x40u; | |
11299 if ( v8 & 0x20000 ) | |
11300 LOBYTE(v34) = v34 | 0x80; | |
11301 v11 = (int *)(256 << v9); | |
11302 if ( (256 << v9) & v8 ) | |
11303 v34 |= 4u; | |
11304 if ( a6 ) | |
11305 { | |
11306 LOBYTE(v11) = byte_4E94D3; | |
11307 pMobileLightsStack->AddLight( | |
11308 a1, | |
11309 a2, | |
11310 a3, | |
11311 p->uSectorID, | |
11312 a6, | |
11313 v1->uParticleTrailColorR, | |
11314 v1->uParticleTrailColorG, | |
11315 v1->uParticleTrailColorB, | |
11316 byte_4E94D3); | |
11317 } | |
11318 if ( pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | |
11319 a1, | |
11320 a2, | |
11321 a3, | |
11322 &x, | |
11323 &y, | |
11324 &z, | |
11325 1) ) | |
11326 { | |
11327 pGame->pIndoorCameraD3D->Project(x, y, z, &v36, &v35); | |
11328 | |
11329 assert(uNumBillboardsToDraw < 500); | |
11330 //if ( (signed int)uNumBillboardsToDraw >= 500 ) | |
11331 // return; | |
11332 ++uNumBillboardsToDraw; | |
11333 ++uNumSpritesDrawnThisFrame; | |
11334 p->uAttributes |= 1u; | |
11335 //v12 = pRenderer->pRenderD3D == 0; | |
11336 v3->uPalette = v24->uPaletteIndex; | |
11337 v3->uIndoorSectorID = p->uSectorID; | |
11338 if ( pRenderer->pRenderD3D ) | |
11339 { | |
11340 v3->fov_x = pGame->pIndoorCameraD3D->fov_x; | |
11341 v3->fov_y = pGame->pIndoorCameraD3D->fov_y; | |
11342 LODWORD(v18) = 0; | |
11343 HIDWORD(v18) = (int)floorf(v3->fov_x + 0.5f); | |
11344 v18 = v18 / x; | |
11345 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v18) >> 16; | |
11346 v31 = (unsigned __int64)(v24->scale * v18) >> 16; | |
11347 } | |
11348 else | |
11349 { | |
11350 LODWORD(v19) = pBLVRenderParams->field_40 << 16; | |
11351 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; | |
11352 v20 = v19 / x; | |
11353 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16; | |
11354 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16; | |
11355 } | |
11356 //HIWORD(v21) = HIWORD(x); | |
11357 //LOWORD(v21) = 0; | |
11358 v3->_screenspace_y_scaler_packedfloat = v31; | |
11359 v3->field_1E = v34; | |
11360 v3->world_x = a1; | |
11361 v3->world_y = a2; | |
11362 v3->world_z = a3; | |
11363 v3->uScreenSpaceX = v36; | |
11364 v22 = v35; | |
11365 v3->uTintColor = 0; | |
11366 v3->uScreenSpaceY = v22; | |
11367 //v23 = 8 * i; | |
11368 //LOBYTE(v23) = PID(OBJECT_Item,i); | |
11369 v3->pSpriteFrame = v24; | |
11370 //v12 = (p->uAttributes & 0x20) == 0; | |
11371 //v3->sZValue = v21 + v23; | |
11372 v3->actual_z = HIWORD(x); | |
11373 v3->object_pid = PID(OBJECT_Item,i); | |
11374 if (p->uAttributes & 0x20) | |
11375 { | |
11376 if ( !pRenderer->pRenderD3D ) | |
11377 v3->sZValue = 0; | |
11378 } | |
11379 } | |
11380 } | |
11381 } | |
11382 } | |
11383 } | |
11384 } | |
11385 | |
11386 //----- (00440639) -------------------------------------------------------- | |
11387 void AddBspNodeToRenderList(unsigned int node_id) | |
11388 { | |
11389 BLVSector *pSector; // esi@1 | |
11390 | |
11391 pSector = &pIndoor->pSectors[pBspRenderer->nodes[node_id].uSectorID]; | |
11392 if ( pRenderer->pRenderD3D ) | |
11393 { | |
11394 for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) | |
11395 //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); | |
11396 pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]); | |
11397 } | |
11398 else | |
11399 { | |
11400 for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i) | |
11401 pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[i]); | |
11402 } | |
11403 if ( pSector->field_0 & 0x10 ) | |
11404 sub_4406BC(node_id, pSector->uFirstBSPNode); | |
11405 } | |
11406 | |
11407 //----- (004406BC) -------------------------------------------------------- | |
11408 void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode) | |
11409 { | |
11410 BLVSector *pSector; // esi@2 | |
11411 BSPNode *pNode; // edi@2 | |
11412 BLVFace *pFace; // eax@2 | |
11413 int v5; // ecx@2 | |
11414 __int16 v6; // ax@6 | |
11415 int v7; // ebp@10 | |
11416 int v8; // ebx@10 | |
11417 __int16 v9; // di@18 | |
11418 //int v10; // [sp+10h] [bp-Ch]@1 | |
11419 //bool v11; // [sp+14h] [bp-8h]@5 | |
11420 BspRenderer_stru0 *node; // [sp+18h] [bp-4h]@1 | |
11421 | |
11422 //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); | |
11423 | |
11424 //v10 = a1; | |
11425 node = &pBspRenderer->nodes[node_id]; | |
11426 while ( 1 ) | |
11427 { | |
11428 pSector = &pIndoor->pSectors[node->uSectorID]; | |
11429 pNode = &pIndoor->pNodes[uFirstNode]; | |
11430 pFace = &pIndoor->pFaces[pSector->pFaceIDs[pNode->uCoplanarOffset]]; | |
11431 v5 = pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x | |
11432 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z;//plane equation | |
11433 if (pFace->Portal() && pFace->uSectorID != node->uSectorID ) | |
11434 v5 = -v5; | |
11435 //v11 = v5 > 0; | |
11436 if ( v5 <= 0 ) | |
11437 v6 = pNode->uFront; | |
11438 else | |
11439 v6 = pNode->uBack; | |
11440 if ( v6 != -1 ) | |
11441 sub_4406BC(node_id, v6); | |
11442 v7 = pNode->uCoplanarOffset; | |
11443 v8 = v7 + pNode->uCoplanarSize; | |
11444 | |
11445 //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); | |
11446 | |
11447 if ( pRenderer->pRenderD3D ) | |
11448 { | |
11449 while ( v7 < v8 ) | |
11450 pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[v7++]); | |
11451 } | |
11452 else | |
11453 { | |
11454 while ( v7 < v8 ) | |
11455 pBspRenderer->AddFaceToRenderList_sw(node_id, pSector->pFaceIDs[v7++]); | |
11456 } | |
11457 v9 = v5 > 0 ? pNode->uFront : pNode->uBack; | |
11458 if ( v9 == -1 ) | |
11459 break; | |
11460 uFirstNode = v9; | |
11461 } | |
11462 } | |
11463 | |
11464 //----- (00440DF5) -------------------------------------------------------- | 10782 //----- (00440DF5) -------------------------------------------------------- |
11465 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr) | 10783 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr) |
11466 { | 10784 { |
11467 int result; // eax@1 | 10785 int result; // eax@1 |
11468 | 10786 |
12204 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); | 11522 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
12205 activeLevelDecoration = NULL; | 11523 activeLevelDecoration = NULL; |
12206 pEventTimer->Resume(); | 11524 pEventTimer->Resume(); |
12207 } | 11525 } |
12208 | 11526 |
12209 //----- (00445308) -------------------------------------------------------- | |
12210 const char *GetProfessionActionText(int a1) | |
12211 { | |
12212 if ( a1 == 10 | |
12213 || a1 == 11 | |
12214 || a1 == 12 | |
12215 || a1 == 33 | |
12216 || a1 == 34 | |
12217 || a1 == 39 | |
12218 || a1 == 40 | |
12219 || a1 == 41 | |
12220 || a1 == 42 | |
12221 || a1 == 43 | |
12222 || a1 == 52 ) | |
12223 return pNPCStats->pProfessions[a1 - 1].pActionText; | |
12224 else | |
12225 return pNPCTopics[407].pTopic; | |
12226 } | |
12227 | |
12228 | |
12229 //----- (00445C8B) -------------------------------------------------------- | |
12230 int __fastcall GetGreetType(signed int SpeakingNPC_ID) | |
12231 { | |
12232 signed int v1; // ebx@1 | |
12233 int v3; // edi@6 | |
12234 int v4; // ecx@6 | |
12235 int v5; // edx@6 | |
12236 NPCData *v6; // eax@6 | |
12237 char *v7; // ebp@11 | |
12238 NPCData *v8; // esi@11 | |
12239 | |
12240 v1 = 0; | |
12241 if ( SpeakingNPC_ID >= 0 ) | |
12242 { | |
12243 if ( SpeakingNPC_ID < 5000 ) | |
12244 return 1;//QuestNPC_greet | |
12245 return 2;//HiredNPC_greet | |
12246 } | |
12247 if ( SpeakingNPC_ID >= 5000 ) | |
12248 return 2; | |
12249 v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1; | |
12250 v4 = 0; | |
12251 v5 = 0; | |
12252 v6 = pParty->pHirelings; | |
12253 do | |
12254 { | |
12255 if ( v6->pName ) | |
12256 pTmpBuf[v4++] = v5; | |
12257 ++v6; | |
12258 ++v5; | |
12259 } | |
12260 while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); | |
12261 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
12262 { | |
12263 v7 = &pTmpBuf[v4]; | |
12264 v8 = pNPCStats->pNewNPCData; | |
12265 do | |
12266 { | |
12267 if (v8->Hired() && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName)) ) | |
12268 { | |
12269 if ( !pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName) ) | |
12270 *v7++ = v1 + 2; | |
12271 } | |
12272 ++v1; | |
12273 ++v8; | |
12274 } | |
12275 while ( v1 < (signed int)pNPCStats->uNumNewNPCs ); | |
12276 } | |
12277 return ((unsigned __int8)pTmpBuf[v3] < 2) + 1; | |
12278 } | |
12279 | |
12280 //----- (0044603D) -------------------------------------------------------- | |
12281 void __cdecl DialogueEnding() | |
12282 { | |
12283 sDialogue_SpeakingActorNPC_ID = 0; | |
12284 pDialogueWindow->Release(); | |
12285 pDialogueWindow = 0; | |
12286 pMiscTimer->Resume(); | |
12287 pEventTimer->Resume(); | |
12288 } | |
12289 | |
12290 //----- (004465DF) -------------------------------------------------------- | 11527 //----- (004465DF) -------------------------------------------------------- |
12291 int sub_4465DF_check_season(int a1) | 11528 int sub_4465DF_check_season(int a1) |
12292 { | 11529 { |
12293 unsigned int v1; // eax@1 | 11530 unsigned int v1; // eax@1 |
12294 unsigned int v2; // edx@1 | 11531 unsigned int v2; // edx@1 |
12352 } | 11589 } |
12353 } | 11590 } |
12354 if ( (signed int)v2 >= 21 ) | 11591 if ( (signed int)v2 >= 21 ) |
12355 return 1; | 11592 return 1; |
12356 return 0; | 11593 return 0; |
12357 } | |
12358 | |
12359 //----- (0044665D) -------------------------------------------------------- | |
12360 // uType: 0 -> any monster | |
12361 // 1 -> uParam is GroupID | |
12362 // 2 -> uParam is MonsterID | |
12363 // 3 -> uParam is ActorID | |
12364 // uNumAlive: 0 -> all must be alive | |
12365 int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive) | |
12366 { | |
12367 unsigned int uAliveActors; // eax@6 | |
12368 int v5; // ecx@10 | |
12369 unsigned int uTotalActors; // [sp+0h] [bp-4h]@1 | |
12370 | |
12371 uTotalActors = 0; | |
12372 if ( uType ) | |
12373 { | |
12374 if ( uType == 1 ) | |
12375 { | |
12376 uAliveActors = SearchActorByGroup(&uTotalActors, uParam); | |
12377 } | |
12378 else | |
12379 { | |
12380 if ( uType == 2 ) | |
12381 { | |
12382 uAliveActors = SearchActorByMonsterID(&uTotalActors, uParam); | |
12383 } | |
12384 else | |
12385 { | |
12386 if ( uType != 3 ) | |
12387 return 0; | |
12388 uAliveActors = SearchActorByID(&uTotalActors, uParam); | |
12389 } | |
12390 } | |
12391 } | |
12392 else | |
12393 { | |
12394 uAliveActors = SearchAliveActors(&uTotalActors); | |
12395 } | |
12396 v5 = 0; | |
12397 if ( uNumAlive ) | |
12398 LOBYTE(v5) = (signed int)uAliveActors >= (signed int)uNumAlive; | |
12399 else | |
12400 LOBYTE(v5) = uTotalActors == uAliveActors; | |
12401 return v5; | |
12402 } | |
12403 | |
12404 //----- (004466C4) -------------------------------------------------------- | |
12405 int NPC_EventProcessor(int npc_event_id, int entry_line) | |
12406 { | |
12407 signed int event_index; // ebp@1 | |
12408 int evt_seq_num; // esi@3 | |
12409 bool ready_to_exit; // [sp+Ch] [bp-Ch]@3 | |
12410 signed int npc_activity; // [sp+10h] [bp-8h]@3 | |
12411 int result; | |
12412 | |
12413 event_index = 0; | |
12414 if ( !npc_event_id ) | |
12415 return 0; | |
12416 evt_seq_num = entry_line; | |
12417 pSomeOtherEVT = pGlobalEVT.data(); | |
12418 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; | |
12419 memcpy(pSomeOtherEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); | |
12420 npc_activity = 1; | |
12421 ready_to_exit = false; | |
12422 if ( uSomeOtherEVT_NumEvents <= 0 ) | |
12423 return 2; | |
12424 do | |
12425 { | |
12426 if ( (pSomeOtherEVT_Events[event_index].uEventID == npc_event_id) && (pSomeOtherEVT_Events[event_index].event_sequence_num == evt_seq_num) ) | |
12427 { | |
12428 _evt_raw *_evt = (_evt_raw *)&pSomeOtherEVT[pSomeOtherEVT_Events[event_index].uEventOffsetInEVT]; | |
12429 switch(_evt->_e_type) | |
12430 { | |
12431 case EVENT_Exit: | |
12432 //exit | |
12433 if ( ready_to_exit ) | |
12434 result = npc_activity != 0; | |
12435 else | |
12436 result = 2; | |
12437 return result; | |
12438 break; | |
12439 case EVENT_OnCanShowDialogItemCmp: | |
12440 ready_to_exit = true; | |
12441 //v8 = (unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + (((unsigned __int8)v7[9] + ((unsigned __int8)v7[10] << 8)) << 8)) << 8); | |
12442 for(int i=0; i<4; ++i) | |
12443 { | |
12444 // if (pParty->pPlayers[i].CompareVariable((enum VariableType)((unsigned __int8)pSomeOtherEVT[v6 + 5] + ((unsigned __int8)pSomeOtherEVT[v6 + 6] << 8)), | |
12445 // v8)) | |
12446 if (pParty->pPlayers[i].CompareVariable((enum VariableType)EVT_WORD(_evt->v5), EVT_DWORD(_evt->v7))) | |
12447 { | |
12448 event_index = -1; | |
12449 evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; | |
12450 break; | |
12451 } | |
12452 } | |
12453 break; | |
12454 case EVENT_EndCanShowDialogItem : | |
12455 if ( ready_to_exit ) | |
12456 result = npc_activity != 0; | |
12457 else | |
12458 result = 2; | |
12459 return result; | |
12460 break; | |
12461 case EVENT_SetCanShowDialogItem : | |
12462 ready_to_exit = true; | |
12463 npc_activity = EVT_BYTE(_evt->v5); //(unsigned __int8)v7[5]; | |
12464 break; | |
12465 case EVENT_IsActorAssasinated : | |
12466 // if (IsActorAlive( (unsigned __int8)v7[5], | |
12467 // (unsigned __int8)v7[6] + (((unsigned __int8)v7[7] + (((unsigned __int8)v7[8] + ((unsigned __int8)v7[9] << 8)) << 8)) << 8), | |
12468 // (unsigned __int8)v7[10]) ) | |
12469 if (IsActorAlive( EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) | |
12470 { // drop linear sequense, going to new seq | |
12471 event_index = -1; | |
12472 evt_seq_num = EVT_BYTE(_evt->v11)-1;//(unsigned __int8)pSomeOtherEVT[v6 + 11] - 1; | |
12473 } | |
12474 break; | |
12475 } | |
12476 ++evt_seq_num; | |
12477 } | |
12478 ++event_index; | |
12479 } | |
12480 while ( event_index < uSomeOtherEVT_NumEvents ); | |
12481 if ( ready_to_exit ) | |
12482 result = npc_activity != 0; | |
12483 else | |
12484 result = 2; | |
12485 return result; | |
12486 } | 11594 } |
12487 | 11595 |
12488 //----- (0044861E) -------------------------------------------------------- | 11596 //----- (0044861E) -------------------------------------------------------- |
12489 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) | 11597 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) |
12490 { | 11598 { |
12945 } | 12053 } |
12946 } | 12054 } |
12947 } | 12055 } |
12948 } | 12056 } |
12949 | 12057 |
12950 //----- (00448DF8) -------------------------------------------------------- | |
12951 void __fastcall EventCastSpell(int spellnum, int uSkillLevel, int uSkill, int fromx, int fromy, int fromz, int tox, int toy, int toz)//sub_448DF8 | |
12952 { | |
12953 int v9; // esi@1 | |
12954 double v10; // st7@4 | |
12955 double v11; // st6@4 | |
12956 double v12; // st5@4 | |
12957 double v13; // st7@6 | |
12958 int v14; // ST44_4@7 | |
12959 signed int v15; // ebx@9 | |
12960 signed int v16; // edx@15 | |
12961 char *v17; // ecx@16 | |
12962 unsigned __int16 v18; // ax@20 | |
12963 char *v19; // ecx@31 | |
12964 int v20; // edx@35 | |
12965 signed int v21; // edx@37 | |
12966 char *v22; // ecx@38 | |
12967 unsigned __int16 v23; // ax@41 | |
12968 int i; // esi@42 | |
12969 signed int v25; // edx@55 | |
12970 char *v26; // ecx@56 | |
12971 unsigned __int16 v27; // ax@59 | |
12972 int j; // esi@60 | |
12973 signed int v29; // edx@66 | |
12974 char *v30; // ecx@67 | |
12975 unsigned __int16 v31; // ax@70 | |
12976 //Player *v32; // eax@80 | |
12977 //unsigned __int16 v33; // si@85 | |
12978 int v34; // eax@96 | |
12979 int v35; // eax@97 | |
12980 unsigned __int64 v36; // qax@99 | |
12981 SpellBuff *v37; // ecx@99 | |
12982 int v38; // esi@103 | |
12983 signed __int64 v39; // qax@105 | |
12984 int v40; // ebx@108 | |
12985 int v41; // ebx@109 | |
12986 int v42; // esi@111 | |
12987 int v43; // ebx@111 | |
12988 int v44; // eax@117 | |
12989 //unsigned __int16 v45; // si@137 | |
12990 unsigned __int16 v46; // [sp-8h] [bp-BCh]@99 | |
12991 int v47; // [sp-4h] [bp-B8h]@35 | |
12992 unsigned __int16 v48; // [sp-4h] [bp-B8h]@99 | |
12993 int v49; // [sp+0h] [bp-B4h]@35 | |
12994 int v50; // [sp+0h] [bp-B4h]@99 | |
12995 int v51; // [sp+4h] [bp-B0h]@35 | |
12996 unsigned __int8 v52; // [sp+4h] [bp-B0h]@99 | |
12997 float v53; // [sp+14h] [bp-A0h]@4 | |
12998 float v54; // [sp+18h] [bp-9Ch]@4 | |
12999 int v55; // [sp+28h] [bp-8Ch]@7 | |
13000 unsigned int yaw; // [sp+30h] [bp-84h]@7 | |
13001 int pitch; // [sp+34h] [bp-80h]@7 | |
13002 //SpriteObject a1; // [sp+38h] [bp-7Ch]@12 | |
13003 int v59; // [sp+A8h] [bp-Ch]@1 | |
13004 int v60; // [sp+ACh] [bp-8h]@1 | |
13005 //int spellnum_; // [sp+B0h] [bp-4h]@1 | |
13006 //signed int levela; // [sp+BCh] [bp+8h]@80 | |
13007 int a6_4; // [sp+C8h] [bp+14h]@117 | |
13008 float a7a; // [sp+CCh] [bp+18h]@6 | |
13009 signed int a7b; // [sp+CCh] [bp+18h]@12 | |
13010 int a7c; // [sp+CCh] [bp+18h]@29 | |
13011 int a7d; // [sp+CCh] [bp+18h]@55 | |
13012 float a8a; // [sp+D0h] [bp+1Ch]@6 | |
13013 int a8b; // [sp+D0h] [bp+1Ch]@37 | |
13014 int a8c; // [sp+D0h] [bp+1Ch]@55 | |
13015 float toza; // [sp+D4h] [bp+20h]@6 | |
13016 | |
13017 v9 = 0; | |
13018 v59 = uSkillLevel + 1; | |
13019 //spellnum_ = spellnum; | |
13020 v60 = 0; | |
13021 if ( tox || toy || toz ) | |
13022 { | |
13023 v10 = (double)tox - (double)fromx; | |
13024 v53 = v10; | |
13025 v11 = (double)toy - (double)fromy; | |
13026 v54 = v11; | |
13027 v12 = (double)toz; | |
13028 } | |
13029 else | |
13030 { | |
13031 v10 = (double)pParty->vPosition.x - (double)fromx; | |
13032 v53 = v10; | |
13033 v11 = (double)pParty->vPosition.y - (double)fromy; | |
13034 v54 = v11; | |
13035 v12 = (double)(pParty->vPosition.z + pParty->sEyelevel); | |
13036 } | |
13037 a7a = v12 - (double)fromz; | |
13038 toza = v11 * v11; | |
13039 a8a = v10 * v10; | |
13040 v13 = sqrt(a7a * a7a + a8a + toza); | |
13041 if ( v13 <= 1.0 ) | |
13042 { | |
13043 LOBYTE(v55) = 1; | |
13044 yaw = 0; | |
13045 pitch = 0; | |
13046 } | |
13047 else | |
13048 { | |
13049 v55 = (signed __int64)v13; | |
13050 v14 = (signed __int64)sqrt(a8a + toza); | |
13051 yaw = stru_5C6E00->Atan2((signed __int64)v53, (signed __int64)v54); | |
13052 pitch = stru_5C6E00->Atan2(v14, (signed __int64)a7a); | |
13053 } | |
13054 v15 = v59; | |
13055 if ( v59 <= 0 || v59 > 4 ) | |
13056 v15 = 1; | |
13057 a7b = v15; | |
13058 | |
13059 SpriteObject a1; // [sp+38h] [bp-7Ch]@12 | |
13060 //SpriteObject::SpriteObject(&a1); | |
13061 | |
13062 a1.uType = stru_4E3ACC[spellnum].uType; | |
13063 if ( spellnum > 58 ) | |
13064 { | |
13065 if ( spellnum == 69 ) | |
13066 goto LABEL_117; | |
13067 if ( spellnum != 83 ) | |
13068 return; | |
13069 v40 = v15 - 2; | |
13070 if ( v40 ) | |
13071 { | |
13072 v41 = v40 - 1; | |
13073 if ( !v41 ) | |
13074 { | |
13075 v42 = 14400 * uSkill; | |
13076 v43 = 4 * uSkill + 10; | |
13077 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); | |
13078 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); | |
13079 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); | |
13080 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); | |
13081 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | |
13082 v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; | |
13083 v36 = pParty->uTimePlayed + v39; | |
13084 v37->Apply(v36, a7b, v43, 0, 0); | |
13085 goto LABEL_139; | |
13086 } | |
13087 if ( v41 == 1 ) | |
13088 { | |
13089 v42 = 18000 * uSkill; | |
13090 v43 = 5 * uSkill + 10; | |
13091 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); | |
13092 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); | |
13093 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); | |
13094 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); | |
13095 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | |
13096 v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; | |
13097 v36 = pParty->uTimePlayed + v39; | |
13098 v37->Apply(v36, a7b, v43, 0, 0); | |
13099 goto LABEL_139; | |
13100 } | |
13101 } | |
13102 v42 = 10800 * uSkill; | |
13103 v43 = 3 * uSkill + 10; | |
13104 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 0); | |
13105 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 1u); | |
13106 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 2u); | |
13107 pGame->pStru6Instance->SetPlayerBuffAnim(0x53u, 3u); | |
13108 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | |
13109 v37 = &pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS]; | |
13110 v36 = pParty->uTimePlayed + v39; | |
13111 v37->Apply(v36, a7b, v43, 0, 0); | |
13112 goto LABEL_139; | |
13113 } | |
13114 if ( spellnum != 58 ) | |
13115 { | |
13116 switch ( spellnum ) | |
13117 { | |
13118 case 2: | |
13119 case 6: | |
13120 case 18: | |
13121 case 26: | |
13122 case 29: | |
13123 case 32: | |
13124 case 39: | |
13125 case 41: | |
13126 a1.stru_24.Reset(); | |
13127 v16 = 0; | |
13128 a1.spell_id = spellnum; | |
13129 a1.spell_level = uSkill; | |
13130 a1.spell_skill = v15; | |
13131 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
13132 { | |
13133 v18 = 0; | |
13134 a1.uObjectDescID = v18; | |
13135 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13136 a1.vPosition.x = fromx; | |
13137 a1.uAttributes = 16; | |
13138 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13139 a1.field_60_distance_related_prolly_lod = v55; | |
13140 v20 = yaw; | |
13141 a1.uSpriteFrameID = 0; | |
13142 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13143 a1.spell_target_pid = 0; | |
13144 a1.uFacing = yaw; | |
13145 a1.uSoundID = 0; | |
13146 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13147 a1.Create(v20, pitch, v49, 0); | |
13148 goto LABEL_139; | |
13149 } | |
13150 v17 = (char *)&pObjectList->pObjects->uObjectID; | |
13151 while ( (short)a1.uType != *(short *)v17 ) | |
13152 { | |
13153 ++v16; | |
13154 v17 += 56; | |
13155 if ( v16 >= (signed int)pObjectList->uNumObjects ) | |
13156 { | |
13157 v18 = 0; | |
13158 a1.uObjectDescID = v18; | |
13159 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13160 a1.vPosition.x = fromx; | |
13161 a1.uAttributes = 16; | |
13162 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13163 a1.field_60_distance_related_prolly_lod = v55; | |
13164 v20 = yaw; | |
13165 a1.uSpriteFrameID = 0; | |
13166 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13167 a1.spell_target_pid = 0; | |
13168 a1.uFacing = yaw; | |
13169 a1.uSoundID = 0; | |
13170 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13171 a1.Create(v20, pitch, v49, 0); | |
13172 goto LABEL_139; | |
13173 } | |
13174 } | |
13175 v18 = v16; | |
13176 a1.uObjectDescID = v18; | |
13177 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13178 a1.vPosition.x = fromx; | |
13179 a1.uAttributes = 16; | |
13180 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13181 a1.field_60_distance_related_prolly_lod = v55; | |
13182 v20 = yaw; | |
13183 a1.uSpriteFrameID = 0; | |
13184 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13185 a1.spell_target_pid = 0; | |
13186 a1.uFacing = yaw; | |
13187 a1.uSoundID = 0; | |
13188 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13189 a1.Create(v20, pitch, v49, 0); | |
13190 goto LABEL_139; | |
13191 case 24: | |
13192 switch ( v15 ) | |
13193 { | |
13194 case 1: | |
13195 v60 = 1; | |
13196 break; | |
13197 case 2: | |
13198 v60 = 3; | |
13199 break; | |
13200 case 3: | |
13201 v60 = 5; | |
13202 break; | |
13203 case 4: | |
13204 v60 = 7; | |
13205 break; | |
13206 } | |
13207 a7c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
13208 if ( v60 != 1 ) | |
13209 { | |
13210 a8b = a7c / (v60 - 1); | |
13211 a1.stru_24.Reset(); | |
13212 v21 = 0; | |
13213 a1.spell_id = spellnum; | |
13214 a1.spell_level = uSkill; | |
13215 a1.spell_skill = v15; | |
13216 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
13217 { | |
13218 v23 = 0; | |
13219 } | |
13220 else | |
13221 { | |
13222 v22 = (char *)&pObjectList->pObjects->uObjectID; | |
13223 while ( (short)a1.uType != *(short *)v22 ) | |
13224 { | |
13225 ++v21; | |
13226 v22 += 56; | |
13227 if ( v21 >= (signed int)pObjectList->uNumObjects ) | |
13228 { | |
13229 v23 = 0; | |
13230 a1.uObjectDescID = v23; | |
13231 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13232 a1.vPosition.x = fromx; | |
13233 a1.uAttributes = 16; | |
13234 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13235 a1.field_60_distance_related_prolly_lod = v55; | |
13236 a1.uSpriteFrameID = 0; | |
13237 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13238 a1.spell_target_pid = 4; | |
13239 a1.uSoundID = 0; | |
13240 for ( i = a7c / -2; i <= a7c / 2; i += a8b ) | |
13241 { | |
13242 a1.uFacing = i + yaw; | |
13243 a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
13244 } | |
13245 goto LABEL_139; | |
13246 } | |
13247 } | |
13248 v23 = v21; | |
13249 } | |
13250 a1.uObjectDescID = v23; | |
13251 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13252 a1.vPosition.x = fromx; | |
13253 a1.uAttributes = 16; | |
13254 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13255 a1.field_60_distance_related_prolly_lod = v55; | |
13256 a1.uSpriteFrameID = 0; | |
13257 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13258 a1.spell_target_pid = 4; | |
13259 a1.uSoundID = 0; | |
13260 for ( i = a7c / -2; i <= a7c / 2; i += a8b ) | |
13261 { | |
13262 a1.uFacing = i + yaw; | |
13263 a1.Create((signed __int16)(i + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
13264 } | |
13265 goto LABEL_139; | |
13266 } | |
13267 a1.stru_24.Reset(); | |
13268 v16 = 0; | |
13269 a1.spell_id = spellnum; | |
13270 a1.spell_level = uSkill; | |
13271 a1.spell_skill = v15; | |
13272 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
13273 { | |
13274 v18 = 0; | |
13275 a1.uObjectDescID = v18; | |
13276 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13277 a1.vPosition.x = fromx; | |
13278 a1.uAttributes = 16; | |
13279 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13280 a1.field_60_distance_related_prolly_lod = v55; | |
13281 v20 = yaw; | |
13282 a1.uSpriteFrameID = 0; | |
13283 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13284 a1.spell_target_pid = 0; | |
13285 a1.uFacing = yaw; | |
13286 a1.uSoundID = 0; | |
13287 v51 = 0; | |
13288 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13289 v47 = pitch; | |
13290 a1.Create(v20, v47, v49, v51); | |
13291 goto LABEL_139; | |
13292 } | |
13293 v19 = (char *)&pObjectList->pObjects->uObjectID; | |
13294 do | |
13295 { | |
13296 if ( (short)a1.uType == *(short *)v19 ) | |
13297 { | |
13298 v18 = v16; | |
13299 a1.uObjectDescID = v18; | |
13300 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13301 a1.vPosition.x = fromx; | |
13302 a1.uAttributes = 16; | |
13303 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13304 a1.field_60_distance_related_prolly_lod = v55; | |
13305 v20 = yaw; | |
13306 a1.uSpriteFrameID = 0; | |
13307 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13308 a1.spell_target_pid = 0; | |
13309 a1.uFacing = yaw; | |
13310 a1.uSoundID = 0; | |
13311 v51 = 0; | |
13312 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13313 v47 = pitch; | |
13314 a1.Create(v20, v47, v49, v51); | |
13315 goto LABEL_139; | |
13316 } | |
13317 ++v16; | |
13318 v19 += 56; | |
13319 } | |
13320 while ( v16 < (signed int)pObjectList->uNumObjects ); | |
13321 v18 = 0; | |
13322 a1.uObjectDescID = v18; | |
13323 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13324 a1.vPosition.x = fromx; | |
13325 a1.uAttributes = 16; | |
13326 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13327 a1.field_60_distance_related_prolly_lod = v55; | |
13328 v20 = yaw; | |
13329 a1.uSpriteFrameID = 0; | |
13330 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13331 a1.spell_target_pid = 0; | |
13332 a1.uFacing = yaw; | |
13333 a1.uSoundID = 0; | |
13334 v51 = 0; | |
13335 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13336 v47 = pitch; | |
13337 a1.Create(v20, v47, v49, v51); | |
13338 goto LABEL_139; | |
13339 case 15: | |
13340 switch ( v15 ) | |
13341 { | |
13342 case 1: | |
13343 v60 = 3; | |
13344 break; | |
13345 case 2: | |
13346 v60 = 5; | |
13347 break; | |
13348 case 3: | |
13349 v60 = 7; | |
13350 break; | |
13351 case 4: | |
13352 v60 = 9; | |
13353 break; | |
13354 } | |
13355 a7d = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | |
13356 a8c = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v60 - 1); | |
13357 a1.stru_24.Reset(); | |
13358 v25 = 0; | |
13359 a1.spell_id = spellnum; | |
13360 a1.spell_level = uSkill; | |
13361 a1.spell_skill = v15; | |
13362 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
13363 { | |
13364 v27 = 0; | |
13365 a1.uObjectDescID = v27; | |
13366 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13367 a1.vPosition.x = fromx; | |
13368 a1.uAttributes = 16; | |
13369 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13370 a1.field_60_distance_related_prolly_lod = v55; | |
13371 a1.uSpriteFrameID = 0; | |
13372 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13373 a1.spell_target_pid = 4; | |
13374 a1.uSoundID = 0; | |
13375 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | |
13376 { | |
13377 a1.uFacing = j + yaw; | |
13378 a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
13379 } | |
13380 goto LABEL_139; | |
13381 } | |
13382 v26 = (char *)&pObjectList->pObjects->uObjectID; | |
13383 while ( (short)a1.uType != *(short *)v26 ) | |
13384 { | |
13385 ++v25; | |
13386 v26 += 56; | |
13387 if ( v25 >= (signed int)pObjectList->uNumObjects ) | |
13388 { | |
13389 v27 = 0; | |
13390 a1.uObjectDescID = v27; | |
13391 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13392 a1.vPosition.x = fromx; | |
13393 a1.uAttributes = 16; | |
13394 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13395 a1.field_60_distance_related_prolly_lod = v55; | |
13396 a1.uSpriteFrameID = 0; | |
13397 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13398 a1.spell_target_pid = 4; | |
13399 a1.uSoundID = 0; | |
13400 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | |
13401 { | |
13402 a1.uFacing = j + yaw; | |
13403 a1.Create((signed __int16)(j + (short)yaw), pitch, pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, 0); | |
13404 } | |
13405 goto LABEL_139; | |
13406 } | |
13407 } | |
13408 v27 = v25; | |
13409 a1.uObjectDescID = v27; | |
13410 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13411 a1.vPosition.x = fromx; | |
13412 a1.uAttributes = 16; | |
13413 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13414 a1.field_60_distance_related_prolly_lod = v55; | |
13415 a1.uSpriteFrameID = 0; | |
13416 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13417 a1.spell_target_pid = 4; | |
13418 a1.uSoundID = 0; | |
13419 for ( j = a7d / -2; j <= a7d / 2; j += a8c ) | |
13420 { | |
13421 a1.uFacing = j + yaw; | |
13422 a1.Create( | |
13423 (signed __int16)(j + (short)yaw), | |
13424 pitch, | |
13425 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
13426 0); | |
13427 } | |
13428 goto LABEL_139; | |
13429 case 43: | |
13430 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
13431 return; | |
13432 a1.stru_24.Reset(); | |
13433 v29 = 0; | |
13434 a1.spell_id = spellnum; | |
13435 a1.spell_level = uSkill; | |
13436 a1.spell_skill = v15; | |
13437 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
13438 { | |
13439 v31 = 0; | |
13440 a1.uObjectDescID = v31; | |
13441 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13442 a1.vPosition.x = fromx; | |
13443 a1.uAttributes = 16; | |
13444 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13445 a1.field_60_distance_related_prolly_lod = v55; | |
13446 a1.uSpriteFrameID = 0; | |
13447 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13448 a1.spell_target_pid = 4; | |
13449 a1.uSoundID = 0; | |
13450 v51 = 0; | |
13451 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13452 v20 = yaw; | |
13453 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | |
13454 a1.Create(v20, v47, v49, v51); | |
13455 goto LABEL_139; | |
13456 } | |
13457 v30 = (char *)&pObjectList->pObjects->uObjectID; | |
13458 break; | |
13459 | |
13460 case SPELL_FIRE_HASTE: | |
13461 if ( v15 > 0 ) | |
13462 { | |
13463 if ( v15 <= 2 ) | |
13464 { | |
13465 v9 = 60 * (uSkill + 60); | |
13466 } | |
13467 else | |
13468 { | |
13469 if ( v15 == 3 ) | |
13470 { | |
13471 v9 = 180 * (uSkill + 20); | |
13472 } | |
13473 else | |
13474 { | |
13475 if ( v15 == 4 ) | |
13476 v9 = 240 * (uSkill + 15); | |
13477 } | |
13478 } | |
13479 } | |
13480 //levela = 1; | |
13481 //v32 = pParty->pPlayers;//[0].pConditions[1]; | |
13482 //do | |
13483 for (uint i = 0; i < 4; ++i) | |
13484 if (pParty->pPlayers[i].pConditions[Player::Condition_Weak]) | |
13485 return; | |
13486 //while ( v32 <= &pParty->pPlayers[3] ); | |
13487 //if ( !levela ) | |
13488 // return; | |
13489 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), | |
13490 v15, | |
13491 0, | |
13492 0, | |
13493 0); | |
13494 //v33 = spellnum_; | |
13495 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); | |
13496 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); | |
13497 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); | |
13498 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); | |
13499 goto LABEL_138; | |
13500 case 17: | |
13501 case 38: | |
13502 case 51: | |
13503 switch ( v15 ) | |
13504 { | |
13505 case 1: | |
13506 case 2: | |
13507 v9 = 300 * (uSkill + 12); | |
13508 break; | |
13509 case 3: | |
13510 v9 = 900 * (uSkill + 4); | |
13511 break; | |
13512 case 4: | |
13513 v9 = 3600 * (uSkill + 1); | |
13514 break; | |
13515 } | |
13516 switch ( spellnum ) | |
13517 { | |
13518 case 17: | |
13519 v60 = 0; | |
13520 uSkill = 14; | |
13521 break; | |
13522 case 38: | |
13523 v35 = uSkill + 5; | |
13524 uSkill = 15; | |
13525 v60 = v35; | |
13526 break; | |
13527 case 51: | |
13528 v34 = uSkill + 5; | |
13529 uSkill = 9; | |
13530 v60 = v34; | |
13531 break; | |
13532 } | |
13533 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); | |
13534 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); | |
13535 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); | |
13536 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); | |
13537 v52 = 0; | |
13538 v50 = 0; | |
13539 v48 = v60; | |
13540 v46 = v15; | |
13541 v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335); | |
13542 v37 = &pParty->pPartyBuffs[uSkill]; | |
13543 v37->Apply(v36, v46, v48, v50, v52); | |
13544 goto LABEL_139;; | |
13545 case 8: | |
13546 if ( v15 == 2 || v15 == 3 || v15 != 4 ) | |
13547 v38 = 60 * uSkill; | |
13548 else | |
13549 v38 = 600 * uSkill; | |
13550 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); | |
13551 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); | |
13552 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); | |
13553 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); | |
13554 v52 = 0; | |
13555 v50 = 0; | |
13556 v48 = uSkill; | |
13557 v46 = v15; | |
13558 v39 = (signed __int64)((double)(v38 << 7) * 0.033333335); | |
13559 v37 = &pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION]; | |
13560 v36 = pParty->uTimePlayed + v39; | |
13561 v37->Apply(v36, v46, v48, v50, v52); | |
13562 goto LABEL_139; | |
13563 case 3: | |
13564 case 14: | |
13565 case 25: | |
13566 case 36: | |
13567 goto LABEL_117; | |
13568 default: | |
13569 return; | |
13570 } | |
13571 while ( (short)a1.uType != *(short *)v30 ) | |
13572 { | |
13573 ++v29; | |
13574 v30 += 56; | |
13575 if ( v29 >= (signed int)pObjectList->uNumObjects ) | |
13576 { | |
13577 v31 = 0; | |
13578 a1.uObjectDescID = v31; | |
13579 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13580 a1.vPosition.x = fromx; | |
13581 a1.uAttributes = 16; | |
13582 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13583 a1.field_60_distance_related_prolly_lod = v55; | |
13584 a1.uSpriteFrameID = 0; | |
13585 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13586 a1.spell_target_pid = 4; | |
13587 a1.uSoundID = 0; | |
13588 v51 = 0; | |
13589 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13590 v20 = yaw; | |
13591 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | |
13592 a1.Create(v20, v47, v49, v51); | |
13593 goto LABEL_139; | |
13594 } | |
13595 } | |
13596 v31 = v29; | |
13597 a1.uObjectDescID = v31; | |
13598 *(_QWORD *)&a1.vPosition.y = __PAIR__(fromz, fromy); | |
13599 a1.vPosition.x = fromx; | |
13600 a1.uAttributes = 16; | |
13601 a1.uSectorID = pIndoor->GetSector(fromx, fromy, fromz); | |
13602 a1.field_60_distance_related_prolly_lod = v55; | |
13603 a1.uSpriteFrameID = 0; | |
13604 a1.spell_caster_pid = 8000 | OBJECT_Item; | |
13605 a1.spell_target_pid = 4; | |
13606 a1.uSoundID = 0; | |
13607 v51 = 0; | |
13608 v49 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | |
13609 v20 = yaw; | |
13610 v47 = (signed int)stru_5C6E00->uIntegerHalfPi / 2; | |
13611 a1.Create(v20, v47, v49, v51); | |
13612 goto LABEL_139; | |
13613 } | |
13614 LABEL_117: | |
13615 v44 = uSkill; | |
13616 a6_4 = 3600 * uSkill; | |
13617 if ( v15 == 1 ) | |
13618 { | |
13619 v60 = v44; | |
13620 goto LABEL_125; | |
13621 } | |
13622 if ( v15 == 2 ) | |
13623 { | |
13624 v44 = 2 * uSkill; | |
13625 v60 = v44; | |
13626 goto LABEL_125; | |
13627 } | |
13628 if ( v15 == 3 ) | |
13629 { | |
13630 v44 = 3 * uSkill; | |
13631 v60 = v44; | |
13632 goto LABEL_125; | |
13633 } | |
13634 if ( v15 == 4 ) | |
13635 { | |
13636 v44 = 4 * uSkill; | |
13637 v60 = v44; | |
13638 goto LABEL_125; | |
13639 } | |
13640 LABEL_125: | |
13641 switch ( spellnum ) | |
13642 { | |
13643 case 3: | |
13644 uSkill = 6; | |
13645 break; | |
13646 case 14: | |
13647 uSkill = 0; | |
13648 break; | |
13649 case 25: | |
13650 uSkill = 17; | |
13651 break; | |
13652 case 36: | |
13653 uSkill = 4; | |
13654 break; | |
13655 case 58: | |
13656 uSkill = 12; | |
13657 break; | |
13658 case 69: | |
13659 uSkill = 1; | |
13660 break; | |
13661 } | |
13662 //v45 = spellnum_; | |
13663 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 0); | |
13664 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 1); | |
13665 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 2); | |
13666 pGame->pStru6Instance->SetPlayerBuffAnim(spellnum, 3); | |
13667 pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), v15, v60, 0, 0); | |
13668 //levela = 1; | |
13669 LABEL_138: | |
13670 //if ( levela ) | |
13671 LABEL_139: | |
13672 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[spellnum], 0, 0, fromx, fromy, 0, 0, 0); | |
13673 } | |
13674 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | 12058 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; |
13675 | 12059 |
13676 //----- (0044987B) -------------------------------------------------------- | 12060 //----- (0044987B) -------------------------------------------------------- |
13677 void sub_44987B(const char *pMapName, MapStartPoint start_point) | 12061 void sub_44987B(const char *pMapName, MapStartPoint start_point) |
13678 { | 12062 { |
14019 } | 12403 } |
14020 while ( v5 ); | 12404 while ( v5 ); |
14021 } | 12405 } |
14022 } | 12406 } |
14023 | 12407 |
14024 //----- (004014E6) -------------------------------------------------------- | |
14025 void MakeActorAIList_ODM() | |
14026 { | |
14027 int v1; // eax@4 | |
14028 int v2; // ebx@4 | |
14029 unsigned int v3; // ecx@4 | |
14030 int v4; // edx@5 | |
14031 int v5; // edx@7 | |
14032 unsigned int v6; // edx@9 | |
14033 unsigned int v7; // ST20_4@10 | |
14034 int v9; // edi@10 | |
14035 int v10; // ebx@14 | |
14036 int v21; // [sp+Ch] [bp-14h]@4 | |
14037 int v22; // [sp+10h] [bp-10h]@4 | |
14038 | |
14039 pParty->uFlags &= 0xFFFFFFCFu; | |
14040 | |
14041 ai_arrays_size = 0; | |
14042 for (uint i = 0; i < uNumActors; ++i) | |
14043 { | |
14044 auto actor = &pActors[i]; | |
14045 | |
14046 actor->uAttributes &= 0xFFFFFBFF; | |
14047 if (!actor->CanAct()) | |
14048 { | |
14049 actor->uAttributes &= 0xFFFFBFFF; | |
14050 continue; | |
14051 } | |
14052 | |
14053 v22 = abs(pParty->vPosition.z - actor->vPosition.z); | |
14054 v21 = abs(pParty->vPosition.y - actor->vPosition.y); | |
14055 v1 = abs(pParty->vPosition.x - actor->vPosition.x); | |
14056 v2 = v21; | |
14057 v3 = v22; | |
14058 if ( v1 < v21 ) | |
14059 { | |
14060 v4 = v1; | |
14061 v1 = v21; | |
14062 v2 = v4; | |
14063 } | |
14064 if ( v1 < v22 ) | |
14065 { | |
14066 v5 = v1; | |
14067 v1 = v22; | |
14068 v3 = v5; | |
14069 } | |
14070 if ( v2 < (signed int)v3 ) | |
14071 { | |
14072 v6 = v3; | |
14073 v3 = v2; | |
14074 v2 = v6; | |
14075 } | |
14076 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | |
14077 //v8 = actor->uActorRadius; | |
14078 v9 = v7 - actor->uActorRadius; | |
14079 //v23 = v7 - v8; | |
14080 if ( v9 < 0 ) | |
14081 { | |
14082 v9 = 0; | |
14083 //v23 = 0; | |
14084 } | |
14085 | |
14086 if (v9 < 5632) | |
14087 { | |
14088 v10 = actor->uAttributes & 0xFEFFFFFF; | |
14089 actor->uAttributes = v10; | |
14090 if ( v10 & 0x80000 || actor->GetActorsRelation(0) ) | |
14091 { | |
14092 //v11 = (pParty->uFlags & 0x10) == 0; | |
14093 actor->uAttributes = v10 | 0x1000000; | |
14094 if (v9 < 5120 ) | |
14095 pParty->SetYellowAlert(); | |
14096 if (v9 < 307) | |
14097 pParty->SetRedAlert(); | |
14098 } | |
14099 actor->uAttributes |= 0x00004000; | |
14100 ai_near_actors_distances[ai_arrays_size] = v9; | |
14101 ai_near_actors_ids[ai_arrays_size++] = i; | |
14102 } | |
14103 else | |
14104 actor->uAttributes &= 0xFFFFBFFF; | |
14105 } | |
14106 | |
14107 /* | |
14108 result = v27; | |
14109 if ( v27 > 0 ) | |
14110 { | |
14111 v14 = 0; | |
14112 v15 = 1; | |
14113 v26 = 1; | |
14114 do | |
14115 { | |
14116 while ( 1 ) | |
14117 { | |
14118 v24 = v15; | |
14119 if ( v15 >= result ) | |
14120 break; | |
14121 v16 = ai_near_actors_distances[v14]; | |
14122 if ( v16 > ai_near_actors_distances[v15] ) | |
14123 { | |
14124 v17 = &ai_near_actors_ids[v15]; | |
14125 v18 = ai_near_actors_ids[v14]; | |
14126 ai_near_actors_ids[v14] = *v17; | |
14127 *v17 = v18; | |
14128 v15 = v24; | |
14129 ai_near_actors_distances[v14] = ai_near_actors_distances[v24]; | |
14130 ai_near_actors_distances[v24] = v16; | |
14131 } | |
14132 result = v27; | |
14133 ++v15; | |
14134 } | |
14135 ++v14; | |
14136 v15 = v26 + 1; | |
14137 v26 = v15; | |
14138 } | |
14139 while ( v15 - 1 < result ); | |
14140 }*/ | |
14141 | |
14142 for (uint i = 0; i < ai_arrays_size; ++i) | |
14143 for (uint j = 0; j < i; ++j) | |
14144 if (ai_near_actors_distances[j] > ai_near_actors_distances[i]) | |
14145 { | |
14146 int tmp = ai_near_actors_distances[j]; | |
14147 ai_near_actors_distances[j] = ai_near_actors_distances[i]; | |
14148 ai_near_actors_distances[i] = tmp; | |
14149 | |
14150 tmp = ai_near_actors_ids[j]; | |
14151 ai_near_actors_ids[j] = ai_near_actors_ids[i]; | |
14152 ai_near_actors_ids[i] = tmp; | |
14153 } | |
14154 | |
14155 | |
14156 if (ai_arrays_size > 30) | |
14157 ai_arrays_size = 30; | |
14158 | |
14159 for (uint i = 0; i < ai_arrays_size; ++i) | |
14160 pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400; | |
14161 } | |
14162 // 4F75D8: using guessed type int ai_arrays_size; | 12408 // 4F75D8: using guessed type int ai_arrays_size; |
14163 | 12409 |
14164 //----- (004016FA) -------------------------------------------------------- | |
14165 int __cdecl MakeActorAIList_BLV() | |
14166 { | |
14167 Actor *v0; // esi@2 | |
14168 int v1; // eax@4 | |
14169 int v2; // ebx@4 | |
14170 unsigned int v3; // ecx@4 | |
14171 int v4; // edx@5 | |
14172 int v5; // edx@7 | |
14173 unsigned int v6; // edx@9 | |
14174 unsigned int v7; // ST24_4@10 | |
14175 int v8; // eax@10 | |
14176 int v9; // edi@10 | |
14177 int v10; // ebx@14 | |
14178 char v11; // zf@16 | |
14179 int v12; // eax@22 | |
14180 int v13; // edx@24 | |
14181 int v14; // ecx@25 | |
14182 int v15; // ebx@26 | |
14183 unsigned int *v16; // ecx@27 | |
14184 unsigned int v17; // esi@27 | |
14185 int v18; // ecx@31 | |
14186 signed int v19; // edi@31 | |
14187 Actor *v20; // esi@32 | |
14188 bool v21; // eax@33 | |
14189 int v22; // eax@34 | |
14190 signed int v23; // ebx@36 | |
14191 Actor *v24; // esi@37 | |
14192 signed int v25; // eax@40 | |
14193 int v26; // eax@43 | |
14194 int v27; // ebx@45 | |
14195 int j; // edi@45 | |
14196 unsigned int v29; // eax@46 | |
14197 int v30; // eax@48 | |
14198 int v31; // ecx@51 | |
14199 int v32; // eax@51 | |
14200 signed int v33; // eax@53 | |
14201 __int64 v34; // qax@55 | |
14202 char *v35; // ecx@56 | |
14203 int v37; // [sp+Ch] [bp-18h]@1 | |
14204 int v38; // [sp+10h] [bp-14h]@4 | |
14205 int v39; // [sp+14h] [bp-10h]@4 | |
14206 int v40; // [sp+18h] [bp-Ch]@10 | |
14207 int v41; // [sp+18h] [bp-Ch]@29 | |
14208 int i; // [sp+18h] [bp-Ch]@31 | |
14209 signed int v43; // [sp+1Ch] [bp-8h]@1 | |
14210 signed int v44; // [sp+1Ch] [bp-8h]@25 | |
14211 int v45; // [sp+20h] [bp-4h]@1 | |
14212 | |
14213 // __debugbreak(); // refactor for blv ai | |
14214 pParty->uFlags &= 0xFFFFFFCFu; | |
14215 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
14216 v45 = 0; | |
14217 v43 = 0; | |
14218 if ( (signed int)uNumActors > 0 ) | |
14219 { | |
14220 v0 = pActors.data();//[0].uAttributes; | |
14221 do | |
14222 { | |
14223 BYTE1(v0->uAttributes) &= 0xFBu; | |
14224 if ( ! v0->CanAct() ) | |
14225 goto LABEL_60; | |
14226 v39 = abs(pParty->vPosition.z - v0->vPosition.z); | |
14227 v38 = abs(pParty->vPosition.y - v0->vPosition.y); | |
14228 v1 = abs(pParty->vPosition.x - v0->vPosition.x); | |
14229 v2 = v38; | |
14230 v3 = v39; | |
14231 if ( v1 < v38 ) | |
14232 { | |
14233 v4 = v1; | |
14234 v1 = v38; | |
14235 v2 = v4; | |
14236 } | |
14237 if ( v1 < v39 ) | |
14238 { | |
14239 v5 = v1; | |
14240 v1 = v39; | |
14241 v3 = v5; | |
14242 } | |
14243 if ( v2 < (signed int)v3 ) | |
14244 { | |
14245 v6 = v3; | |
14246 v3 = v2; | |
14247 v2 = v6; | |
14248 } | |
14249 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | |
14250 v8 = v0->uActorRadius; | |
14251 v9 = v7 - v8; | |
14252 v40 = v7 - v8; | |
14253 if ( v40 < 0 ) | |
14254 { | |
14255 v9 = 0; | |
14256 v40 = 0; | |
14257 } | |
14258 if ( v9 < 10240 ) | |
14259 { | |
14260 v10 = v0->uAttributes & 0xFEFFFFFF; | |
14261 v0->uAttributes = v10; | |
14262 if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) | |
14263 { | |
14264 v11 = (pParty->uFlags & 0x10) == 0; | |
14265 v0->uAttributes = v10 | 0x1000000; | |
14266 if ( v11 && (double)v40 < 307.2 ) | |
14267 pParty->uFlags |= 0x10u; | |
14268 if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) | |
14269 pParty->uFlags |= 0x20u; | |
14270 } | |
14271 v12 = v45++; | |
14272 ai_near_actors_distances[v12] = v9; | |
14273 ai_near_actors_ids[v12] = v43; | |
14274 } | |
14275 else | |
14276 { | |
14277 LABEL_60: | |
14278 BYTE1(v0->uAttributes) &= 0xBFu; | |
14279 } | |
14280 ++v43; | |
14281 ++v0; | |
14282 } | |
14283 while ( v43 < (signed int)uNumActors ); | |
14284 } | |
14285 v13 = 0; | |
14286 if ( v45 > 0 ) | |
14287 { | |
14288 v14 = 1; | |
14289 v44 = 1; | |
14290 do | |
14291 { | |
14292 while ( 1 ) | |
14293 { | |
14294 v41 = v14; | |
14295 if ( v14 >= v45 ) | |
14296 break; | |
14297 v15 = ai_near_actors_distances[v13]; | |
14298 if ( v15 > ai_near_actors_distances[v14] ) | |
14299 { | |
14300 v16 = &ai_near_actors_ids[v14]; | |
14301 v17 = ai_near_actors_ids[v13]; | |
14302 ai_near_actors_ids[v13] = *v16; | |
14303 *v16 = v17; | |
14304 v14 = v41; | |
14305 ai_near_actors_distances[v13] = ai_near_actors_distances[v41]; | |
14306 ai_near_actors_distances[v41] = v15; | |
14307 } | |
14308 ++v14; | |
14309 } | |
14310 ++v13; | |
14311 v14 = v44 + 1; | |
14312 v44 = v14; | |
14313 } | |
14314 while ( v14 - 1 < v45 ); | |
14315 } | |
14316 v18 = 0; | |
14317 v19 = 0; | |
14318 for ( i = 0; v18 < v45; i = v18 ) | |
14319 { | |
14320 v20 = &pActors[ai_near_actors_ids[v18]]; | |
14321 if ( v20->uAttributes & 0x8000 | |
14322 || (v21 = sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) | |
14323 { | |
14324 v22 = ai_near_actors_ids[v18]; | |
14325 v20->uAttributes |= 0x8000u; | |
14326 ai_array_4F6638_actor_ids[v19] = v22; | |
14327 ai_array_4F5E68[v19++] = ai_near_actors_distances[v18]; | |
14328 if ( v19 >= 30 ) | |
14329 break; | |
14330 } | |
14331 ++v18; | |
14332 } | |
14333 v23 = 0; | |
14334 ai_arrays_size = v19; | |
14335 if ( (signed int)uNumActors > 0 ) | |
14336 { | |
14337 v24 = pActors.data();//[0].uAttributes; | |
14338 do | |
14339 { | |
14340 if ( v24->CanAct() && v24->uSectorID == v37 ) | |
14341 { | |
14342 v25 = 0; | |
14343 if ( v19 <= 0 ) | |
14344 { | |
14345 LABEL_43: | |
14346 v26 = ai_arrays_size; | |
14347 BYTE1(v24->uAttributes) |= 0x40u; | |
14348 ++ai_arrays_size; | |
14349 ai_array_4F6638_actor_ids[v26] = v23; | |
14350 } | |
14351 else | |
14352 { | |
14353 while ( ai_array_4F6638_actor_ids[v25] != v23 ) | |
14354 { | |
14355 ++v25; | |
14356 if ( v25 >= v19 ) | |
14357 goto LABEL_43; | |
14358 } | |
14359 } | |
14360 } | |
14361 ++v23; | |
14362 ++v24; | |
14363 } | |
14364 while ( v23 < (signed int)uNumActors ); | |
14365 } | |
14366 v27 = ai_arrays_size; | |
14367 for ( j = 0; j < v45; ++j ) | |
14368 { | |
14369 v29 = ai_near_actors_ids[j]; | |
14370 if ( pActors[v29].uAttributes & 0xC000 && pActors[v29].CanAct() ) | |
14371 { | |
14372 v30 = 0; | |
14373 if ( v27 <= 0 ) | |
14374 { | |
14375 LABEL_51: | |
14376 v31 = ai_arrays_size; | |
14377 v32 = ai_near_actors_ids[j]; | |
14378 ++ai_arrays_size; | |
14379 ai_array_4F6638_actor_ids[v31] = v32; | |
14380 } | |
14381 else | |
14382 { | |
14383 while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] ) | |
14384 { | |
14385 ++v30; | |
14386 if ( v30 >= v27 ) | |
14387 goto LABEL_51; | |
14388 } | |
14389 } | |
14390 } | |
14391 } | |
14392 v33 = ai_arrays_size; | |
14393 if ( ai_arrays_size > 30 ) | |
14394 { | |
14395 v33 = 30; | |
14396 ai_arrays_size = 30; | |
14397 } | |
14398 memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * v33); | |
14399 memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size); | |
14400 v34 = (unsigned int)ai_arrays_size; | |
14401 if ( ai_arrays_size > 0 ) | |
14402 { | |
14403 do | |
14404 { | |
14405 v35 = (char *)&pActors[ai_near_actors_ids[HIDWORD(v34)]].uAttributes; | |
14406 v35[1] |= 4u; | |
14407 ++HIDWORD(v34); | |
14408 } | |
14409 while ( SHIDWORD(v34) < (signed int)v34 ); | |
14410 } | |
14411 return v34; | |
14412 } | |
14413 // 4F75D8: using guessed type int ai_arrays_size; | 12410 // 4F75D8: using guessed type int ai_arrays_size; |
14414 | |
14415 //----- (00401A91) -------------------------------------------------------- | |
14416 void __cdecl UpdateActorAI() | |
14417 { | |
14418 //unsigned int v0; // esi@4 | |
14419 int v1; // eax@7 | |
14420 //int v2; // ecx@7 | |
14421 //int v3; // eax@7 | |
14422 signed int v4; // edi@10 | |
14423 Actor *v5; // esi@12 | |
14424 signed int sDmg; // eax@14 | |
14425 __int16 v7; // cx@14 | |
14426 //Player **v8; // esi@20 | |
14427 Player *pPlayer; // ecx@21 | |
14428 Actor *pActor; // esi@34 | |
14429 //__int16 v11; // ax@34 | |
14430 //unsigned int v12; // eax@47 | |
14431 //signed int v13; // edi@47 | |
14432 //SpellBuff *v14; // ebx@47 | |
14433 //unsigned int v15; // edi@67 | |
14434 //char *v16; // eax@67 | |
14435 //unsigned int v17; // edx@67 | |
14436 //unsigned int v18; // ecx@67 | |
14437 //unsigned __int16 v19; // ax@72 | |
14438 //int *v20; // esi@80 | |
14439 //Actor *v21; // ebx@80 | |
14440 unsigned __int16 v22; // ax@86 | |
14441 //signed int v23; // eax@94 | |
14442 //unsigned int v24; // eax@102 | |
14443 //signed int v25; // edi@102 | |
14444 //SpellBuff *v26; // esi@102 | |
14445 unsigned int v27; // ecx@123 | |
14446 unsigned int v28; // eax@123 | |
14447 //unsigned int v29; // eax@127 | |
14448 AIDirection *v30; // eax@129 | |
14449 unsigned __int16 v31; // ax@132 | |
14450 //unsigned int v32; // esi@142 | |
14451 int v33; // eax@144 | |
14452 int v34; // eax@147 | |
14453 char v35; // al@150 | |
14454 unsigned int v36; // edi@152 | |
14455 signed int v37; // eax@154 | |
14456 //unsigned __int8 v38; // sf@158 | |
14457 //unsigned __int8 v39; // of@158 | |
14458 //signed int v40; // edx@166 | |
14459 //unsigned int v41; // ecx@166 | |
14460 double v42; // st7@176 | |
14461 double v43; // st6@176 | |
14462 //bool v44; // eax@189 | |
14463 bool v45; // eax@192 | |
14464 unsigned __int8 v46; // cl@197 | |
14465 double v47; // st7@206 | |
14466 //double v48; // st7@207 | |
14467 //char v49; // zf@208 | |
14468 //char v50; // zf@214 | |
14469 //signed int v51; // edx@219 | |
14470 //unsigned int v52; // ecx@219 | |
14471 __int16 v53; // fps@224 | |
14472 //unsigned __int8 v54; // c0@224 | |
14473 //unsigned __int8 v55; // c3@224 | |
14474 //double v56; // st7@226 | |
14475 AIDirection *v57; // eax@246 | |
14476 double v58; // st7@246 | |
14477 //signed int v59; // [sp-18h] [bp-C8h]@213 | |
14478 //int v60; // [sp-14h] [bp-C4h]@144 | |
14479 //int v61; // [sp-14h] [bp-C4h]@168 | |
14480 //AIDirection *v62; // [sp-14h] [bp-C4h]@213 | |
14481 //signed int v63; // [sp-14h] [bp-C4h]@216 | |
14482 unsigned int v64; // [sp-14h] [bp-C4h]@219 | |
14483 unsigned int v65; // [sp-10h] [bp-C0h]@144 | |
14484 char v66; // [sp-10h] [bp-C0h]@147 | |
14485 //AIDirection *v67; // [sp-10h] [bp-C0h]@167 | |
14486 //int v68; // [sp-10h] [bp-C0h]@168 | |
14487 //AIDirection *v69; // [sp-10h] [bp-C0h]@206 | |
14488 int v70; // [sp-10h] [bp-C0h]@213 | |
14489 //AIDirection *v71; // [sp-10h] [bp-C0h]@216 | |
14490 AIDirection v72; // [sp+0h] [bp-B0h]@246 | |
14491 AIDirection a3; // [sp+1Ch] [bp-94h]@129 | |
14492 AIDirection v74; // [sp+38h] [bp-78h]@246 | |
14493 AIDirection v75; // [sp+54h] [bp-5Ch]@129 | |
14494 int target_pid_type; // [sp+70h] [bp-40h]@83 | |
14495 signed int a1; // [sp+74h] [bp-3Ch]@129 | |
14496 int v78; // [sp+78h] [bp-38h]@79 | |
14497 AIDirection pDir; // [sp+7Ch] [bp-34h]@129 | |
14498 float v80; // [sp+98h] [bp-18h]@33 | |
14499 int v81; // [sp+9Ch] [bp-14h]@100 | |
14500 //int v82; // [sp+A0h] [bp-10h]@45 | |
14501 //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32 | |
14502 unsigned int v84; // [sp+A8h] [bp-8h]@11 | |
14503 signed int target_pid; // [sp+ACh] [bp-4h]@83 | |
14504 AIState uAIState; | |
14505 int v38; | |
14506 | |
14507 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
14508 MakeActorAIList_ODM(); | |
14509 else | |
14510 MakeActorAIList_BLV(); | |
14511 | |
14512 //v0 = 0; | |
14513 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor && pParty->armageddon_timer > 0 ) | |
14514 { | |
14515 if ( pParty->armageddon_timer > 417 ) | |
14516 { | |
14517 pParty->armageddon_timer = 0; | |
14518 } | |
14519 else | |
14520 { | |
14521 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (pParty->sRotationY + rand() % 16 - 8); | |
14522 pParty->sRotationX = pParty->sRotationX + rand() % 16 - 8; | |
14523 if ( pParty->sRotationX > 128) | |
14524 pParty->sRotationX = 128; | |
14525 else if ( pParty->sRotationX < -128 ) | |
14526 pParty->sRotationX = -128; | |
14527 | |
14528 pParty->uFlags |= 2u; | |
14529 pParty->armageddon_timer -= pMiscTimer->uTimeElapsed; | |
14530 v4 = pParty->field_16140 + 50; | |
14531 if ( pParty->armageddon_timer <= 0 ) | |
14532 { | |
14533 pParty->armageddon_timer = 0; | |
14534 for(int i = 0; i < uNumActors; i++) | |
14535 { | |
14536 pActor=&pActors[i]; | |
14537 if ( pActor->CanAct() ) | |
14538 { | |
14539 sDmg = stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); | |
14540 pActor->sCurrentHP -= stru_50C198.CalcMagicalDamageToActor(pActor, 5, v4); | |
14541 if ( sDmg ) | |
14542 { | |
14543 if ( pActor->sCurrentHP >= 0 ) | |
14544 { | |
14545 Actor::AI_Stun(i, 4, 0); | |
14546 } | |
14547 else | |
14548 { | |
14549 Actor::Die(i); | |
14550 if ( pActor->pMonsterInfo.uExp ) | |
14551 GivePartyExp(pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uExp); | |
14552 } | |
14553 } | |
14554 } | |
14555 } | |
14556 for(int i = 1; i <= 4; i++) | |
14557 { | |
14558 pPlayer = pPlayers[i]; | |
14559 if ( !pPlayer->pConditions[14] && !pPlayer->pConditions[15] && !pPlayer->pConditions[16] ) | |
14560 pPlayer->ReceiveDamage(v4, DMGT_5); | |
14561 } | |
14562 } | |
14563 if (pTurnEngine->field_1C) | |
14564 --pTurnEngine->field_1C; | |
14565 } | |
14566 } | |
14567 | |
14568 if (pParty->bTurnBasedModeOn) | |
14569 { | |
14570 pTurnEngine->_405E14(); | |
14571 return; | |
14572 } | |
14573 | |
14574 | |
14575 //uActorID = v0; | |
14576 for (uint i = 0; i < uNumActors; ++i) | |
14577 { | |
14578 pActor = &pActors[i]; | |
14579 //LODWORD(v80) = (int)(char *)pActors + 176; // uAIState | |
14580 //do | |
14581 //{ | |
14582 //pActor = (Actor *)(LODWORD(v80) - 176); | |
14583 //v11 = *(unsigned int *)LODWORD(v80); | |
14584 //v49 = *(unsigned int *)LODWORD(v80) == 5; | |
14585 ai_near_actors_targets_pid[i] = OBJECT_Player; | |
14586 if (pActor->uAIState == Dead || pActor->uAIState == Removed || pActor->uAIState == Disabled || pActor->uAttributes & 0x0400) | |
14587 continue; | |
14588 | |
14589 if (!pActor->sCurrentHP && pActor->uAIState != Dying) | |
14590 Actor::Die(i); | |
14591 | |
14592 //v84 = *(_QWORD *)(LODWORD(v80) + 84) <= 0i64 ? 0 : 1; | |
14593 //v82 = *(_QWORD *)(LODWORD(v80) + 52) <= 0i64 ? 0 : 1; | |
14594 //v12 = 0; | |
14595 //v13 = 0; | |
14596 //v14 = (SpellBuff *)(LODWORD(v80) + 36); | |
14597 for (uint j = 0; j < 22; ++j) | |
14598 { | |
14599 if (j != 10) | |
14600 pActor->pActorBuffs[j]._4585CA(pParty->uTimePlayed); | |
14601 } | |
14602 /*do | |
14603 { | |
14604 if ( v13 != 10 ) | |
14605 { | |
14606 v14->_4585CA(pParty->uTimePlayed); | |
14607 v12 = 0; | |
14608 } | |
14609 ++v13; | |
14610 ++v14; | |
14611 } | |
14612 while ( v13 < 22 );*/ | |
14613 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | |
14614 //&& SHIDWORD(pActor->pActorBuffs[3].uExpireTime) <= (signed int)v12 && (SHIDWORD(pActor->pActorBuffs[3].uExpireTime) < (signed int)v12 | |
14615 // || LODWORD(pActor->pActorBuffs[3].uExpireTime) <= v12) ) | |
14616 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; | |
14617 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | |
14618 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
14619 // not sure | |
14620 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | |
14621 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; | |
14622 | |
14623 if ((signed __int64)pActor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 | |
14624 || (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0) | |
14625 continue; | |
14626 | |
14627 //v15 = pMiscTimer->uTimeElapsed; | |
14628 //v16 = (char *)&pActor->pMonsterInfo.uRecoveryTime; | |
14629 //v17 = pActor->uCurrentActionTime; | |
14630 //v18 = pActor->pMonsterInfo.uRecoveryTime; | |
14631 if (pActor->pMonsterInfo.uRecoveryTime) | |
14632 { | |
14633 if (pActor->pMonsterInfo.uRecoveryTime < pMiscTimer->uTimeElapsed) | |
14634 pActor->pMonsterInfo.uRecoveryTime = 0; | |
14635 else | |
14636 pActor->pMonsterInfo.uRecoveryTime -= pMiscTimer->uTimeElapsed; | |
14637 } | |
14638 | |
14639 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
14640 if (pActor->uCurrentActionTime < pActor->uCurrentActionLength) | |
14641 continue; | |
14642 | |
14643 //v19 = actor->uAIState; | |
14644 if (pActor->uAIState == Dying) | |
14645 pActor->uAIState = Dead; | |
14646 else | |
14647 { | |
14648 if (pActor->uAIState != Summoned) | |
14649 { | |
14650 Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr); | |
14651 continue; | |
14652 } | |
14653 pActor->uAIState = Standing; | |
14654 } | |
14655 | |
14656 pActor->uCurrentActionTime = 0; | |
14657 pActor->uCurrentActionLength = 0; | |
14658 pActor->UpdateAnimation(); | |
14659 //LABEL_78: | |
14660 //++uActorID; | |
14661 //LODWORD(v80) += 836; | |
14662 //} | |
14663 //while ( (signed int)uActorID < (signed int)uNumActors ); | |
14664 } | |
14665 | |
14666 | |
14667 v78 = 0; | |
14668 int actor_id = -1; | |
14669 if ( ai_arrays_size > 0 ) | |
14670 { | |
14671 //while ( 1 ) | |
14672 for(v78 = 0; v78 < ai_arrays_size; ++v78) | |
14673 { | |
14674 actor_id = ai_near_actors_ids[v78]; | |
14675 assert(actor_id < uNumActors); | |
14676 | |
14677 //v20 = &ai_near_actors_targets_pid[actor_id]; | |
14678 pActor = &pActors[actor_id]; | |
14679 Actor::_SelectTarget(actor_id, &ai_near_actors_targets_pid[actor_id], true); | |
14680 if (pActor->pMonsterInfo.uHostilityType && !ai_near_actors_targets_pid[actor_id]) | |
14681 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
14682 target_pid = ai_near_actors_targets_pid[actor_id]; | |
14683 target_pid_type = PID_TYPE(target_pid); | |
14684 if ( target_pid_type == OBJECT_Actor) | |
14685 v80 = 0.5; | |
14686 else | |
14687 v80 = 1.0; | |
14688 v22 = pActor->uAIState; | |
14689 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned) | |
14690 { | |
14691 continue; | |
14692 } | |
14693 if ( !pActor->sCurrentHP ) | |
14694 Actor::Die(actor_id); | |
14695 for(int i=0;i<22;i++) | |
14696 { | |
14697 if ( i != 10 ) | |
14698 { | |
14699 pActor->pActorBuffs[i]._4585CA(pParty->uTimePlayed); | |
14700 } | |
14701 } | |
14702 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime < 0 ) | |
14703 pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight; | |
14704 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime > 0 ) | |
14705 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
14706 // not sure | |
14707 else if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_CHARM].uExpireTime < 0 ) | |
14708 pActor->pMonsterInfo.uHostilityType = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].uHostilityType; | |
14709 if ( (signed __int64)pActor->pActorBuffs[2].uExpireTime < 0 ) | |
14710 { | |
14711 pActor->uAIState = Removed; | |
14712 continue; | |
14713 } | |
14714 if ( (signed __int64)pActor->pActorBuffs[5].uExpireTime > 0 | |
14715 || (signed __int64)pActor->pActorBuffs[6].uExpireTime > 0) | |
14716 { | |
14717 continue; | |
14718 } | |
14719 v27 = pMiscTimer->uTimeElapsed; | |
14720 v28 = pActor->pMonsterInfo.uRecoveryTime; | |
14721 pActor->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
14722 if ( (signed int)v28 > 0 ) | |
14723 pActor->pMonsterInfo.uRecoveryTime = v28 - v27; | |
14724 if ( pActor->pMonsterInfo.uRecoveryTime < 0 ) | |
14725 pActor->pMonsterInfo.uRecoveryTime = 0; | |
14726 if ( !(pActor->uAttributes & 0x8000) ) | |
14727 pActor->uAttributes |= 0x8000; | |
14728 a1 = PID(OBJECT_Actor,actor_id); | |
14729 v30 = Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), target_pid, &a3, 0); | |
14730 memcpy(&v75, v30, sizeof(v75)); | |
14731 memcpy(&pDir, &v75, sizeof(pDir)); | |
14732 uAIState = pActor->uAIState; | |
14733 /*if ( v21->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Friendly | |
14734 && (signed int)v21->pMonsterInfo.uRecoveryTime <= 0 | |
14735 && v80 * 307.2 >= (double)(signed int)v75.uDistance | |
14736 && (uAIState == Pursuing || uAIState == Standing || uAIState == Tethered || uAIState == Fidgeting) | |
14737 || ( v21->pMonsterInfo.uMissleAttack1Type && uAIState == Stunned ) ) | |
14738 { | |
14739 v32 = actor_id; | |
14740 } | |
14741 else | |
14742 */ | |
14743 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly | |
14744 || (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 | |
14745 || v80 * 307.2 < (double)(signed int)v75.uDistance | |
14746 || uAIState != Pursuing && uAIState != Standing && uAIState != Tethered && uAIState != Fidgeting | |
14747 && !pActor->pMonsterInfo.uMissleAttack1Type || uAIState != Stunned ) | |
14748 { | |
14749 if ( (signed int)pActor->uCurrentActionTime < pActor->uCurrentActionLength ) | |
14750 { | |
14751 continue; | |
14752 } | |
14753 else if ( pActor->uAIState == AttackingMelee ) | |
14754 { | |
14755 v35 = stru_50C198.special_ability_use_check(pActor, actor_id); | |
14756 stru_50FE08.Add( | |
14757 a1, | |
14758 5120, | |
14759 pActor->vPosition.x, | |
14760 pActor->vPosition.y, | |
14761 pActor->vPosition.z + ((signed int)pActor->uActorHeight >> 1), | |
14762 v35, | |
14763 1 | |
14764 ); | |
14765 } | |
14766 else if ( pActor->uAIState == AttackingRanged1 ) | |
14767 { | |
14768 v34 = pActor->pMonsterInfo.uMissleAttack1Type; | |
14769 Actor::AI_RangedAttack(actor_id, &pDir, v34, 0); | |
14770 } | |
14771 else if ( pActor->uAIState == AttackingRanged2 ) | |
14772 { | |
14773 v34 = pActor->pMonsterInfo.uMissleAttack2Type; | |
14774 Actor::AI_RangedAttack(actor_id, &pDir, v34, 1); | |
14775 } | |
14776 else if ( pActor->uAIState == AttackingRanged3 ) | |
14777 { | |
14778 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery1; | |
14779 v33 = pActor->pMonsterInfo.uSpell1ID; | |
14780 Actor::AI_SpellAttack(actor_id, &pDir, v33, 2, v65); | |
14781 } | |
14782 else if ( pActor->uAIState == AttackingRanged4 ) | |
14783 { | |
14784 v65 = pActor->pMonsterInfo.uSpellSkillAndMastery2; | |
14785 v33 = pActor->pMonsterInfo.uSpell2ID; | |
14786 Actor::AI_SpellAttack(actor_id, &pDir, v33, 3, v65); | |
14787 } | |
14788 } | |
14789 | |
14790 v36 = v75.uDistance; | |
14791 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly) | |
14792 { | |
14793 if ( target_pid_type == OBJECT_Actor ) | |
14794 { | |
14795 v36 = v75.uDistance; | |
14796 //v37 = (unsigned __int8)*(&byte_5C8D1A[89 * (pActor->pMonsterInfo.uID - 1) / 3] | |
14797 // + (pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3); | |
14798 v37 =pFactionTable->relations[(pActor->pMonsterInfo.uID-1) / 3 + 1][(pActors[PID_ID(target_pid)].pMonsterInfo.uID - 1) / 3 + 1]; | |
14799 } | |
14800 else | |
14801 { | |
14802 v37 = 4; | |
14803 } | |
14804 v38=0; | |
14805 if ( v37 == 2 ) | |
14806 { | |
14807 //v39 = __OFSUB__(v36, 1024); | |
14808 //v38 = ((v36 - 1024) & 0x80000000u) != 0; | |
14809 v38 = 1024; | |
14810 } | |
14811 else if ( v37 == 3 ) | |
14812 { | |
14813 //v39 = __OFSUB__(v36, 2560); | |
14814 //v38 = ((v36 - 2560) & 0x80000000u) != 0; | |
14815 v38 = 2560; | |
14816 } | |
14817 else if ( v37 == 4 ) | |
14818 { | |
14819 //v39 = __OFSUB__(v36, 5120); | |
14820 //v38 = ((v36 - 5120) & 0x80000000u) != 0; | |
14821 v38 = 5120; | |
14822 } | |
14823 if ( v37 >= 1 && v37 <= 4 && v36 < v38 || v37 == 1 ) | |
14824 pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
14825 } | |
14826 | |
14827 if ( (signed __int64)pActor->pActorBuffs[4].uExpireTime > 0 ) | |
14828 { | |
14829 if ( (signed int)v36 >= 10240 ) | |
14830 { | |
14831 Actor::AI_4032B2(actor_id, target_pid, 1024, 0); | |
14832 } | |
14833 else | |
14834 { | |
14835 //peasents after attacked | |
14836 //guard after attacked | |
14837 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); | |
14838 } | |
14839 continue; | |
14840 } | |
14841 | |
14842 if ( pActor->pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Long && target_pid ) | |
14843 { | |
14844 | |
14845 if ( pActor->pMonsterInfo.uAIType == 1 ) | |
14846 { | |
14847 if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
14848 { | |
14849 Actor::AI_Stand(actor_id, target_pid, (signed __int64)((double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333), &pDir); | |
14850 } | |
14851 else | |
14852 { | |
14853 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); | |
14854 continue; | |
14855 } | |
14856 | |
14857 } | |
14858 if ( !(pActor->uAttributes & 0x020000) ) | |
14859 { | |
14860 if ( pActor->pMonsterInfo.uAIType == 2 || pActor->pMonsterInfo.uAIType == 3) | |
14861 { | |
14862 if ( pActor->pMonsterInfo.uAIType == 2 ) | |
14863 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.2; | |
14864 if ( pActor->pMonsterInfo.uAIType == 3 ) | |
14865 v43 = (double)(signed int)pActor->pMonsterInfo.uHP * 0.1; | |
14866 v84 = pActor->sCurrentHP; | |
14867 v42 = (double)(signed int)v84; | |
14868 if ( v43 > v42 && (signed int)v36 < 10240 ) | |
14869 { | |
14870 Actor::AI_Flee(actor_id, target_pid, 0, &pDir); | |
14871 continue; | |
14872 } | |
14873 } | |
14874 } | |
14875 | |
14876 v81 = v36 - pActor->uActorRadius; | |
14877 if ( target_pid_type == OBJECT_Actor ) | |
14878 v81 -= pActors[PID_ID(target_pid)].uActorRadius; | |
14879 if ( v81 < 0 ) | |
14880 v81 = 0; | |
14881 rand(); | |
14882 pActor->uAttributes &= 0xFFFBFFFF; | |
14883 if ( v81 < 5120 ) | |
14884 { | |
14885 v45 = stru_50C198.special_ability_use_check(pActor, actor_id); | |
14886 if ( v45 == 0 ) | |
14887 { | |
14888 if ( pActor->pMonsterInfo.uMissleAttack1Type ) | |
14889 { | |
14890 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) | |
14891 { | |
14892 Actor::AI_MissileAttack1(actor_id, target_pid, &pDir); | |
14893 } | |
14894 else if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
14895 { | |
14896 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14897 v64 = (signed __int64)v47; | |
14898 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14899 } | |
14900 else | |
14901 { | |
14902 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14903 if ( v80 * 307.2 > (double)v81 ) | |
14904 { | |
14905 v64 = (signed __int64)v47; | |
14906 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14907 } | |
14908 else | |
14909 { | |
14910 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | |
14911 } | |
14912 } | |
14913 } | |
14914 else | |
14915 { | |
14916 if ( (double)v81 >= v80 * 307.2 ) | |
14917 { | |
14918 if ( v81 >= 1024 ) | |
14919 { | |
14920 if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
14921 { | |
14922 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14923 v64 = (signed __int64)v47; | |
14924 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14925 } | |
14926 else | |
14927 { | |
14928 //monsters | |
14929 Actor::AI_Pursue3(actor_id, target_pid, 0, &pDir); | |
14930 } | |
14931 } | |
14932 else if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
14933 { | |
14934 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14935 v64 = (signed __int64)v47; | |
14936 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14937 } | |
14938 else | |
14939 { | |
14940 v70 = (signed __int64)v80 * 307.2; | |
14941 //monsters | |
14942 //guard after player runs away | |
14943 // follow player | |
14944 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
14945 } | |
14946 } | |
14947 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
14948 { | |
14949 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14950 v64 = (signed __int64)v47; | |
14951 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14952 } | |
14953 else | |
14954 { | |
14955 //monsters | |
14956 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); | |
14957 } | |
14958 } | |
14959 continue; | |
14960 } | |
14961 else if ( v45 == 2 || v45 == 3 ) | |
14962 { | |
14963 if ( v45 == 2 ) | |
14964 v46 = pActor->pMonsterInfo.uSpell1ID; | |
14965 else | |
14966 v46 = pActor->pMonsterInfo.uSpell2ID; | |
14967 if ( v46 ) | |
14968 { | |
14969 if ( (signed int)pActor->pMonsterInfo.uRecoveryTime <= 0 ) | |
14970 { | |
14971 if ( v45 == 2 ) | |
14972 Actor::AI_SpellAttack1(actor_id, target_pid, &pDir); | |
14973 else | |
14974 Actor::AI_SpellAttack2(actor_id, target_pid, &pDir); | |
14975 } | |
14976 else if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) | |
14977 { | |
14978 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14979 v64 = (signed __int64)v47; | |
14980 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14981 } | |
14982 else | |
14983 { | |
14984 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14985 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | |
14986 } | |
14987 } | |
14988 else | |
14989 { | |
14990 if ( (double)v81 >= v80 * 307.2 ) | |
14991 { | |
14992 if ( v81 >= 1024 ) | |
14993 { | |
14994 if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
14995 { | |
14996 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
14997 v64 = (signed __int64)v47; | |
14998 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
14999 } | |
15000 else | |
15001 { | |
15002 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); | |
15003 } | |
15004 } | |
15005 else if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
15006 { | |
15007 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15008 v64 = (signed __int64)v47; | |
15009 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15010 } | |
15011 else | |
15012 { | |
15013 v70 = (signed __int64)v80 * 307.2; | |
15014 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
15015 } | |
15016 } | |
15017 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
15018 { | |
15019 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15020 v64 = (signed __int64)v47; | |
15021 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15022 } | |
15023 else | |
15024 { | |
15025 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); | |
15026 } | |
15027 } | |
15028 continue; | |
15029 } | |
15030 } | |
15031 } | |
15032 | |
15033 if ( pActor->pMonsterInfo.uHostilityType != MonsterInfo::Hostility_Long || !target_pid || v81 >= 5120 || v45 != 1 ) | |
15034 { | |
15035 if ( !pActor->pMonsterInfo.uMovementType ) | |
15036 { | |
15037 Actor::AI_4032B2(actor_id, 4, 1024, 0); | |
15038 } | |
15039 else if ( pActor->pMonsterInfo.uMovementType == 1 ) | |
15040 { | |
15041 Actor::AI_4032B2(actor_id, 4, 2560, 0); | |
15042 } | |
15043 else if ( pActor->pMonsterInfo.uMovementType == 2 ) | |
15044 { | |
15045 Actor::AI_4032B2(actor_id, 4, 5120, 0); | |
15046 } | |
15047 else if ( pActor->pMonsterInfo.uMovementType == 4 ) | |
15048 { | |
15049 Actor::AI_4032B2(actor_id, 4, 10240, 0); | |
15050 } | |
15051 else if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
15052 { | |
15053 v57 = Actor::GetDirectionInfo(a1, 4u, &v72, 0); | |
15054 v58 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15055 memcpy(&v74, v57, sizeof(v74)); | |
15056 memcpy(&pDir, &v74, sizeof(pDir)); | |
15057 v64 = (signed __int64)v58; | |
15058 Actor::AI_Stand(actor_id, 4, v64, &pDir); | |
15059 } | |
15060 } | |
15061 else if ( !pActor->pMonsterInfo.uMissleAttack2Type ) | |
15062 { | |
15063 if ( (double)v81 >= v80 * 307.2 ) | |
15064 { | |
15065 if ( v81 >= 1024 ) | |
15066 { | |
15067 if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
15068 { | |
15069 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15070 v64 = (signed __int64)v47; | |
15071 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15072 } | |
15073 else | |
15074 { | |
15075 Actor::AI_Pursue3(actor_id, target_pid, 256, &pDir); | |
15076 } | |
15077 } | |
15078 else if ( pActor->pMonsterInfo.uMovementType == 5 ) | |
15079 { | |
15080 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15081 v64 = (signed __int64)v47; | |
15082 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15083 } | |
15084 else | |
15085 { | |
15086 v70 = (signed __int64)v80 * 307.2; | |
15087 Actor::AI_Pursue2(actor_id, target_pid, 0, &pDir, v70); | |
15088 } | |
15089 } | |
15090 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
15091 { | |
15092 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15093 v64 = (signed __int64)v47; | |
15094 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15095 } | |
15096 else | |
15097 { | |
15098 Actor::AI_MeleeAttack(actor_id, target_pid, &pDir); | |
15099 } | |
15100 } | |
15101 else if ( (signed int)pActor->pMonsterInfo.uRecoveryTime > 0 ) | |
15102 { | |
15103 v47 = (double)(signed int)pActor->pMonsterInfo.uRecoveryTime * 2.133333333333333; | |
15104 if ( v80 * 307.2 > (double)v81 || pActor->pMonsterInfo.uMovementType == 5 ) | |
15105 { | |
15106 v64 = (signed __int64)v47; | |
15107 Actor::AI_Stand(actor_id, target_pid, v64, &pDir); | |
15108 } | |
15109 else | |
15110 { | |
15111 Actor::AI_Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir); | |
15112 } | |
15113 } | |
15114 else | |
15115 { | |
15116 Actor::AI_MissileAttack2(actor_id, target_pid, &pDir); | |
15117 } | |
15118 } | |
15119 } | |
15120 } | |
15121 | 12411 |
15122 //----- (0040261D) -------------------------------------------------------- | 12412 //----- (0040261D) -------------------------------------------------------- |
15123 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) | 12413 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) |
15124 { | 12414 { |
15125 int result; // eax@1 | 12415 int result; // eax@1 |