comparison Outdoor.cpp @ 2085:52abdea20b9e

Door_switch_animation
author Ritor1
date Wed, 11 Dec 2013 23:12:54 +0600
parents a290d9fbdc95
children 3920278a2905
comparison
equal deleted inserted replaced
2068:a290d9fbdc95 2085:52abdea20b9e
3150 signed int v22; // edx@30 3150 signed int v22; // edx@30
3151 signed __int64 v23; // qtt@30 3151 signed __int64 v23; // qtt@30
3152 int v24; // eax@36 3152 int v24; // eax@36
3153 signed int v25; // ecx@38 3153 signed int v25; // ecx@38
3154 int result; // eax@42 3154 int result; // eax@42
3155 signed int v27; // ecx@43 3155 signed int current_floor_level; // ecx@43
3156 int v28; // edi@44 3156 int v28; // edi@44
3157 signed int v29; // edx@44 3157 signed int v29; // edx@44
3158 int v30; // esi@45 3158 int v30; // esi@45
3159 int v31; // eax@45 3159 int v31; // eax@45
3160 ODMFace *v32; // eax@57
3161 int v33; // ecx@59 3160 int v33; // ecx@59
3162 int v36; // [sp+14h] [bp-2Ch]@24 3161 int v36; // [sp+14h] [bp-2Ch]@24
3163 int v38; // [sp+1Ch] [bp-24h]@2 3162 int v38; // [sp+1Ch] [bp-24h]@2
3164 int v39; // [sp+20h] [bp-20h]@9 3163 int v39; // [sp+20h] [bp-20h]@9
3165 signed int pBModelNum; // [sp+28h] [bp-18h]@1 3164 signed int pBModelNum; // [sp+28h] [bp-18h]@1
3166 int pFaceNum; // [sp+2Ch] [bp-14h]@8 3165 int pFaceNum; // [sp+2Ch] [bp-14h]@8
3167 bool current_vertices_Y; // [sp+30h] [bp-10h]@22 3166 bool current_vertices_Y; // [sp+30h] [bp-10h]@22
3168 bool next_vertices_Y; // [sp+34h] [bp-Ch]@24 3167 bool next_vertices_Y; // [sp+34h] [bp-Ch]@24
3169 signed int v46; // [sp+3Ch] [bp-4h]@1 3168 signed int v46; // [sp+3Ch] [bp-4h]@1
3170 signed int number_hits; // [sp+58h] [bp+18h]@22 3169 signed int number_hits; // [sp+58h] [bp+18h]@22
3171 signed int v49; // [sp+58h] [bp+18h]@43 3170 signed int next_floor_level; // [sp+58h] [bp+18h]@43
3172 3171
3173 v46 = 1; 3172 v46 = 1;
3174 dword_721160[0] = -1; 3173 dword_721160[0] = -1;
3175 dword_721110[0] = -1; 3174 dword_721110[0] = -1;
3176 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); 3175 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk);
3185 { 3184 {
3186 v39 = 0; 3185 v39 = 0;
3187 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) 3186 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum )
3188 { 3187 {
3189 pFace = &pBModel->pFaces[pFaceNum]; 3188 pFace = &pBModel->pFaces[pFaceNum];
3189 if ( pFace->Ethereal() )
3190 continue;
3190 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) 3191 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall)
3191 && !(pFace->uAttributes & 0x20000000)
3192 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 3192 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1
3193 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) 3193 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 )
3194 { 3194 {
3195 3195
3196 for ( uint i = 0; i < pFace->uNumVertices; ++i) 3196 for ( uint i = 0; i < pFace->uNumVertices; ++i)
3197 { 3197 {
3198 FloorFaceVertCoord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; 3198 odm_floor_face_vert_coord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
3199 FloorFaceVertCoord_Y[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; 3199 odm_floor_face_vert_coord_Y[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
3200 FloorFaceVertCoord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; 3200 odm_floor_face_vert_coord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
3201 FloorFaceVertCoord_Y[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; 3201 odm_floor_face_vert_coord_Y[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
3202 } 3202 }
3203 FloorFaceVertCoord_X[2 * pFace->uNumVertices] = FloorFaceVertCoord_X[0]; 3203 odm_floor_face_vert_coord_X[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_X[0];
3204 FloorFaceVertCoord_Y[2 * pFace->uNumVertices] = FloorFaceVertCoord_Y[0]; 3204 odm_floor_face_vert_coord_Y[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_Y[0];
3205 3205
3206 current_vertices_Y = FloorFaceVertCoord_Y[0] >= Y; 3206 current_vertices_Y = odm_floor_face_vert_coord_Y[0] >= Y;
3207 number_hits = 0; 3207 number_hits = 0;
3208 if ( 2 * pFace->uNumVertices > 0 ) 3208 if ( 2 * pFace->uNumVertices > 0 )
3209 { 3209 {
3210 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) 3210 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i )
3211 { 3211 {
3212 if ( number_hits >= 2 ) 3212 if ( number_hits >= 2 )
3213 break; 3213 break;
3214 v36 = FloorFaceVertCoord_Y[i + 1]; 3214 //v36 = odm_floor_face_vert_coord_Y[i + 1];
3215 next_vertices_Y = FloorFaceVertCoord_Y[i + 1] >= Y; 3215 next_vertices_Y = odm_floor_face_vert_coord_Y[i + 1] >= Y;
3216 if ( current_vertices_Y != next_vertices_Y )//проверка по Y 3216 if ( current_vertices_Y != next_vertices_Y )//проверка по Y
3217 { 3217 {
3218 v18 = FloorFaceVertCoord_X[i + 1] >= X ? 0 : 2; 3218 v18 = odm_floor_face_vert_coord_X[i + 1] >= X ? 0 : 2;
3219 v19 = v18 | (FloorFaceVertCoord_X[i] < X); 3219 v19 = v18 | (odm_floor_face_vert_coord_X[i] < X);
3220 if ( v19 != 3 ) 3220 if ( v19 != 3 )
3221 { 3221 {
3222 if ( !v19 ) 3222 if ( !v19 )
3223 ++number_hits; 3223 ++number_hits;
3224 else 3224 else
3225 { 3225 {
3226 LODWORD(v23) = (Y - FloorFaceVertCoord_Y[i]) << 16; 3226 LODWORD(v23) = (Y - odm_floor_face_vert_coord_Y[i]) << 16;
3227 HIDWORD(v23) = (Y - FloorFaceVertCoord_Y[i]) >> 16; 3227 HIDWORD(v23) = (Y - odm_floor_face_vert_coord_Y[i]) >> 16;
3228 v22 = ((((FloorFaceVertCoord_X[i + 1] - FloorFaceVertCoord_X[i]) * v23 / (v36 - FloorFaceVertCoord_Y[i])) >> 16) + FloorFaceVertCoord_X[i]); 3228 v22 = ((((odm_floor_face_vert_coord_X[i + 1] - odm_floor_face_vert_coord_X[i]) * v23 / (odm_floor_face_vert_coord_Y[i + 1]
3229 - odm_floor_face_vert_coord_Y[i])) >> 16) + odm_floor_face_vert_coord_X[i]);
3229 if ( v22 >= X) 3230 if ( v22 >= X)
3230 ++number_hits; 3231 ++number_hits;
3231 } 3232 }
3232 } 3233 }
3233 } 3234 }
3257 if ( v46 == 1 ) 3258 if ( v46 == 1 )
3258 { 3259 {
3259 *bmodel_pid = 0; 3260 *bmodel_pid = 0;
3260 return odm_floor_level[0]; 3261 return odm_floor_level[0];
3261 } 3262 }
3262 v27 = 0; 3263 current_floor_level = 0;
3264 v29 = 0;
3263 if ( v46 <= 1 ) 3265 if ( v46 <= 1 )
3264 *bmodel_pid = 0; 3266 *bmodel_pid = 0;
3265 else 3267 else
3266 { 3268 {
3267 //v29 = 1; 3269 current_floor_level = odm_floor_level[0];
3268 for ( v49 = 1; v49 < v46; ++v49 ) 3270 for ( uint i = 1; i < v46; ++i )
3269 { 3271 {
3270 if ( odm_floor_level[v49] == odm_floor_level[0] ) 3272 next_floor_level = odm_floor_level[i];
3271 { 3273 if ( current_floor_level <= Z + 5 )
3272 v27 = v49; 3274 {
3273 //++v29; 3275 if ( next_floor_level > current_floor_level && next_floor_level <= Z + 5 )
3274 break;
3275 }
3276 if ( odm_floor_level[0] > Z + 5 )
3277 {
3278 if ( odm_floor_level[v49] >= odm_floor_level[0] )
3279 { 3276 {
3280 //++v29; 3277 current_floor_level = next_floor_level;
3281 break; 3278 v29 = i;
3282 } 3279 }
3283 v27 = v49; 3280 }
3284 //++v29; 3281 else if ( next_floor_level < current_floor_level )
3285 break; 3282 {
3286 } 3283 current_floor_level = next_floor_level;
3287 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) 3284 v29 = i;
3288 { 3285 }
3289 v27 = v49; 3286 }
3290 //++v29; 3287 if ( !v29 )
3291 }
3292 }
3293 if ( !v27 )
3294 *bmodel_pid = 0; 3288 *bmodel_pid = 0;
3295 else 3289 else
3296 *bmodel_pid = dword_721110[v27] | (dword_721160[v27] << 6); 3290 *bmodel_pid = dword_721110[v29] | (dword_721160[v29] << 6);
3297 } 3291 }
3298 if ( v27 ) 3292 if ( v29 )
3299 { 3293 {
3300 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]];
3301 *pIsOnWater = false; 3294 *pIsOnWater = false;
3302 if ( v32->Fluid()) 3295 if ( pOutdoor->pBModels[dword_721160[v29]].pFaces[dword_721110[v29]].Fluid())
3303 *pIsOnWater = true; 3296 *pIsOnWater = true;
3304 } 3297 }
3305 if ( odm_floor_level[v27] >= odm_floor_level[0] ) 3298 if ( odm_floor_level[v29] >= odm_floor_level[0] )
3306 odm_floor_level[0] = odm_floor_level[v27]; 3299 odm_floor_level[0] = odm_floor_level[v29];
3307 return odm_floor_level[0]; 3300 return odm_floor_level[0];
3308 } 3301 }
3309 3302
3310 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal 3303 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal
3311 // for a right-handed system, that would be an inverse normal 3304 // for a right-handed system, that would be an inverse normal
3650 //----- (00473893) -------------------------------------------------------- 3643 //----- (00473893) --------------------------------------------------------
3651 void ODM_ProcessPartyActions() 3644 void ODM_ProcessPartyActions()
3652 { 3645 {
3653 int v1; // edi@1 3646 int v1; // edi@1
3654 int v2; // ebx@1 3647 int v2; // ebx@1
3655 int v3; // eax@14 3648 int floor_level; // eax@14
3656 int v6; // esi@45 3649 int v6; // esi@45
3657 ODMFace *face; // ecx@45 3650 ODMFace *face; // ecx@45
3658 signed int v33; // eax@143 3651 signed int v33; // eax@143
3659 int v34; // esi@143 3652 int v34; // esi@143
3660 int v35; // esi@147 3653 int v35; // esi@147
3668 signed int v44; // edx@184 3661 signed int v44; // edx@184
3669 int v45; // ecx@200 3662 int v45; // ecx@200
3670 BSPModel *pModel; // eax@203 3663 BSPModel *pModel; // eax@203
3671 ODMFace *pODMFace; // esi@203 3664 ODMFace *pODMFace; // esi@203
3672 int v48; // eax@203 3665 int v48; // eax@203
3673 char v49; // zf@203
3674 char v50; // sf@203
3675 unsigned __int8 v51; // of@203
3676 int v52; // eax@203
3677 BSPModel *v54; // eax@215 3666 BSPModel *v54; // eax@215
3678 int v55; // eax@217 3667 int v55; // eax@217
3679 signed int v56; // ebx@228
3680 int v57; // eax@228
3681 BSPModel *v58; // eax@228 3668 BSPModel *v58; // eax@228
3682 unsigned __int64 v59; // qax@228 3669 unsigned __int64 v59; // qax@228
3683 BSPModel *v60; // eax@228 3670 BSPModel *v60; // eax@228
3684 unsigned __int64 v61; // qax@228 3671 unsigned __int64 v61; // qax@228
3685 int v62; // eax@241 3672 int v62; // eax@241
3686 unsigned int v65; // ebx@263
3687 unsigned int v66; // esi@263 3673 unsigned int v66; // esi@263
3688 int v67; // eax@263
3689 signed int v68; // ecx@263 3674 signed int v68; // ecx@263
3690 int v69; // eax@263 3675 int v69; // eax@263
3691 int v70; // ebx@271
3692 int v71; // esi@271
3693 int v72; // edi@271
3694 int v73; // eax@271
3695 unsigned int v76; // edi@293 3676 unsigned int v76; // edi@293
3696 bool v77; // edx@297 3677 bool v77; // edx@297
3697 bool v78; // ecx@303 3678 bool v78; // ecx@303
3698 int v79; // ecx@314 3679 int v79; // ecx@314
3699 __int16 v80; // dx@317 3680 __int16 v80; // dx@317
3715 int v102; // [sp+20h] [bp-74h]@1 3696 int v102; // [sp+20h] [bp-74h]@1
3716 int v103; // [sp+24h] [bp-70h]@1 3697 int v103; // [sp+24h] [bp-70h]@1
3717 bool bFeatherFall; // [sp+28h] [bp-6Ch]@4 3698 bool bFeatherFall; // [sp+28h] [bp-6Ch]@4
3718 int v105; // [sp+2Ch] [bp-68h]@24 3699 int v105; // [sp+2Ch] [bp-68h]@24
3719 bool bWaterWalk; // [sp+30h] [bp-64h]@1 3700 bool bWaterWalk; // [sp+30h] [bp-64h]@1
3720 int v109; // [sp+3Ch] [bp-58h]@28 3701 int ceiling_height; // [sp+3Ch] [bp-58h]@28
3721 int v110; // [sp+40h] [bp-54h]@180 3702 int v110; // [sp+40h] [bp-54h]@180
3722 int v111; // [sp+44h] [bp-50h]@14 3703 int v111; // [sp+44h] [bp-50h]@14
3723 bool hovering; // [sp+48h] [bp-4Ch]@1 3704 bool hovering; // [sp+48h] [bp-4Ch]@1
3724 int v113; // [sp+4Ch] [bp-48h]@1 3705 int v113; // [sp+4Ch] [bp-48h]@1
3725 bool party_running_flag; // [sp+50h] [bp-44h]@1 3706 bool party_running_flag; // [sp+50h] [bp-44h]@1
3730 int _angle_x; // [sp+68h] [bp-2Ch]@48 3711 int _angle_x; // [sp+68h] [bp-2Ch]@48
3731 unsigned int v122; // [sp+70h] [bp-24h]@180 3712 unsigned int v122; // [sp+70h] [bp-24h]@180
3732 int pZ; // [sp+74h] [bp-20h]@1 3713 int pZ; // [sp+74h] [bp-20h]@1
3733 bool party_walking_flag; // [sp+78h] [bp-1Ch]@1 3714 bool party_walking_flag; // [sp+78h] [bp-1Ch]@1
3734 int _angle_y; // [sp+7Ch] [bp-18h]@48 3715 int _angle_y; // [sp+7Ch] [bp-18h]@48
3735 int v126; // [sp+80h] [bp-14h]@48
3736 int v128; // [sp+88h] [bp-Ch]@1 3716 int v128; // [sp+88h] [bp-Ch]@1
3737 int v129; // [sp+8Ch] [bp-8h]@92 3717 int v129; // [sp+8Ch] [bp-8h]@92
3738 3718
3739 v1 = 0; 3719 v1 = 0;
3740 v103 = 0; 3720 v103 = 0;
3778 bWaterWalk = false; 3758 bWaterWalk = false;
3779 } 3759 }
3780 3760
3781 int bmodel_standing_on_pid; 3761 int bmodel_standing_on_pid;
3782 int is_on_water = false; 3762 int is_on_water = false;
3783 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk); 3763 floor_level = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
3784 int is_not_on_bmodel = bmodel_standing_on_pid == 0; 3764 int is_not_on_bmodel = bmodel_standing_on_pid == 0;
3785 3765
3786 v111 = v3; 3766 v111 = floor_level;
3787 if ( bFeatherFall ) 3767 if ( bFeatherFall )
3788 pParty->uFallStartY = v3; 3768 pParty->uFallStartY = floor_level;
3789 else 3769 else
3790 v3 = pParty->uFallStartY; 3770 floor_level = pParty->uFallStartY;
3791 if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 ) 3771
3772 if ( floor_level - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )//падение на 3D Model
3792 { 3773 {
3793 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) 3774 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
3794 { 3775 {
3795 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 3776 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
3796 } 3777 }
3801 pParty->pPlayers[i].ReceiveDamage( 3782 pParty->pPlayers[i].ReceiveDamage(
3802 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL); 3783 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL);
3803 v105 = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance()); 3784 v105 = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance());
3804 pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 3785 pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3805 } 3786 }
3806 //} 3787 }
3807 //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); 3788 }
3808 } 3789
3809 } 3790 ceiling_height = -1;
3810 v109 = -1;
3811 if ( pParty->bFlying ) 3791 if ( pParty->bFlying )
3812 v109 = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102); 3792 ceiling_height = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);//высота потолка
3813 //v107 = bmodel_standing_on_pid == 0; 3793 //v107 = bmodel_standing_on_pid == 0;
3814 v105 = v111 + 1; 3794 v105 = v111 + 1;
3815 if ( pZ <= v111 + 1 ) 3795 if ( pZ <= v111 + 1 )
3816 { 3796 {
3817 v109 = -1; 3797 ceiling_height = -1;
3818 pParty->bFlying = false; 3798 pParty->bFlying = false;
3819 } 3799 }
3820 else 3800 else
3821 hovering = true; 3801 hovering = true;
3822 high_fall_flag = pZ - v111 <= 32; 3802 high_fall_flag = pZ - v111 <= 32;
3847 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); 3827 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
3848 }*/ 3828 }*/
3849 if ( BYTE3(face[v6].uAttributes) & 4 ) 3829 if ( BYTE3(face[v6].uAttributes) & 4 )
3850 { 3830 {
3851 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); 3831 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
3852 v103 = face[v6].sCogTriggeredID; 3832 v103 = face[v6].sCogTriggeredID; //
3853 } 3833 }
3854 } 3834 }
3855 } 3835 }
3856 } 3836 }
3857 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); 3837 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
3858 } 3838 }
3859 _walk_speed = pParty->uWalkSpeed; 3839 _walk_speed = pParty->uWalkSpeed;
3860 _angle_y = pParty->sRotationY; 3840 _angle_y = pParty->sRotationY;
3861 _angle_x = pParty->sRotationX; 3841 _angle_x = pParty->sRotationX;
3862 v126 = pEventTimer->dt_in_some_format; 3842 //v126 = pEventTimer->dt_in_some_format;
3863 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format 3843 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
3864 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed 3844 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed
3865 * stru_5C6E00->uIntegerPi) 3845 * stru_5C6E00->uIntegerPi)
3866 / 180)) >> 16);*/ 3846 / 180)) >> 16);*/
3867 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; 3847 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16;
3892 } 3872 }
3893 v1 = 0; 3873 v1 = 0;
3894 v2 = 0; 3874 v2 = 0;
3895 pParty->uFallSpeed = 0; 3875 pParty->uFallSpeed = 0;
3896 *(float *)&v128 = 0.0; 3876 *(float *)&v128 = 0.0;
3897 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 )//сверить с ида(ошибка) 3877 if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком(ошибка)
3898 { 3878 {
3899 pParty->field_6E0 = 0; 3879 pParty->field_6E0 = 0;
3900 pParty->field_6E4 = 0; 3880 pParty->field_6E4 = 0;
3901 pPartyActionQueue->uNumActions = 0; 3881 pPartyActionQueue->uNumActions = 0;
3902 pParty->uFlags |= PARTY_FLAGS_1_LANDING; 3882 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
3903 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; 3883 pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31;
3904 pParty->field_6F0 = pZ; 3884 pParty->field_6F0 = pZ;
3905 pParty->bFlying = false; 3885 pParty->bFlying = false;
3906 pZ = v109 - pParty->uPartyHeight - 31; 3886 pZ = ceiling_height - pParty->uPartyHeight - 31;
3907 v113 = pParty->field_6F0; 3887 v113 = pParty->field_6F0;
3908 } 3888 }
3909 pParty->uFallSpeed = 0; 3889 pParty->uFallSpeed = 0;
3910 pModel = (BSPModel *)1; 3890 pModel = (BSPModel *)1;
3911 } 3891 }
4134 break; 4114 break;
4135 4115
4136 case PARTY_Jump: 4116 case PARTY_Jump:
4137 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !hovering && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) 4117 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !hovering && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
4138 { 4118 {
4139 v126 = pParty->field_24 << 6; 4119 //v126 = pParty->field_24 << 6;
4140 hovering = true; 4120 hovering = true;
4141 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); 4121 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
4142 } 4122 }
4143 break; 4123 break;
4144 4124
4157 4137
4158 4138
4159 } 4139 }
4160 } 4140 }
4161 4141
4162 //LABEL_123:
4163 pParty->sRotationY = _angle_y; 4142 pParty->sRotationY = _angle_y;
4164 pParty->sRotationX = _angle_x; 4143 pParty->sRotationX = _angle_x;
4165 if ( pZ < v111 || pParty->bFlying) 4144 if ( pZ < v111 || pParty->bFlying)
4166 { 4145 {
4167 if ( pParty->bFlying ) 4146 if ( pParty->bFlying )
4168 { 4147 {
4169 v126 = stru_5C6E00->Cos(GetTickCount()); 4148 //v126 = stru_5C6E00->Cos(GetTickCount());
4170 v129 = (unsigned __int64)(4i64 * v126) >> 16; 4149 v129 = (unsigned __int64)(4i64 * stru_5C6E00->Cos(GetTickCount())) >> 16;
4171 pZ = v113 + v129; 4150 pZ = v113 + v129;
4172 if ( pModel ) 4151 if ( pModel )
4173 pZ = v113; 4152 pZ = v113;
4174 if (pParty->FlyActive()) 4153 if (pParty->FlyActive())
4175 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; 4154 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
4242 } 4221 }
4243 } 4222 }
4244 } 4223 }
4245 } 4224 }
4246 else 4225 else
4247 { 4226 pParty->uFallStartY = pZ;
4248 //LABEL_150:
4249 pParty->uFallStartY = pZ;
4250 }
4251 4227
4252 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) 4228 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
4253 { 4229 {
4254 *(float *)&v128 = 0.0; 4230 *(float *)&v128 = 0.0;
4255 v2 = 0; 4231 v2 = 0;
4256 } 4232 }
4233 //---------------------------------------------------------------------
4257 stru_721530.field_84 = -1; 4234 stru_721530.field_84 = -1;
4258 stru_721530.field_70 = 0; 4235 stru_721530.field_70 = 0;
4259 stru_721530.prolly_normal_d = pParty->field_14_radius; 4236 stru_721530.prolly_normal_d = pParty->field_14_radius;
4260 stru_721530.field_8_radius = pParty->field_14_radius >> 1; 4237 stru_721530.field_8_radius = pParty->field_14_radius >> 1;
4261 v126 = 0;
4262 stru_721530.field_0 = 1; 4238 stru_721530.field_0 = 1;
4263 stru_721530.height = pParty->uPartyHeight - 32; 4239 stru_721530.height = pParty->uPartyHeight - 32;
4264 do 4240 for ( uint i = 0; i < 100; i++ )
4265 { 4241 {
4266 stru_721530.position.x = pX; 4242 stru_721530.position.x = pX;
4243 stru_721530.position.y = pY;
4244 stru_721530.position.z = stru_721530.height + pZ + 1;
4245
4267 stru_721530.normal.x = pX; 4246 stru_721530.normal.x = pX;
4268 stru_721530.velocity.x = v2;
4269 stru_721530.position.y = pY;
4270 stru_721530.normal.y = pY; 4247 stru_721530.normal.y = pY;
4271 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; 4248 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
4272 stru_721530.position.z = stru_721530.height + pZ + 1; 4249
4250 stru_721530.velocity.x = v2;
4273 stru_721530.velocity.y = v128; 4251 stru_721530.velocity.y = v128;
4274 stru_721530.velocity.z = pParty->uFallSpeed; 4252 stru_721530.velocity.z = pParty->uFallSpeed;
4253
4254 stru_721530.uSectorID = 0;
4275 v36 = 0; 4255 v36 = 0;
4276 stru_721530.uSectorID = 0; 4256 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == 3 )
4277 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
4278 v36 = 13312; 4257 v36 = 13312;
4279 if ( stru_721530._47050A(v36) ) 4258 if ( stru_721530._47050A(v36) )
4280 break; 4259 break;
4281 _46E889_collide_against_bmodels(1u); 4260 _46E889_collide_against_bmodels(1);
4282 v37 = WorldPosToGridCellZ(pParty->vPosition.y); 4261 v37 = WorldPosToGridCellZ(pParty->vPosition.y);
4283 v38 = WorldPosToGridCellX(pParty->vPosition.x); 4262 v38 = WorldPosToGridCellX(pParty->vPosition.x);
4284 _46E26D_collide_against_sprites(v38, v37); 4263 _46E26D_collide_against_sprites(v38, v37);
4285 _46ED8A_collide_against_sprite_objects(4u); 4264 _46ED8A_collide_against_sprite_objects(4);
4286 for ( i = 0; i < (signed int)uNumActors; ++i ) 4265 for ( i = 0; i < (signed int)uNumActors; ++i )
4287 Actor::_46DF1A_collide_against_actor(i, 0); 4266 Actor::_46DF1A_collide_against_actor(i, 0);
4288 if ( stru_721530.field_7C >= stru_721530.field_6C ) 4267 if ( stru_721530.field_7C >= stru_721530.field_6C )
4289 { 4268 {
4290 _angle_x = stru_721530.normal2.x; 4269 _angle_x = stru_721530.normal2.x;
4303 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0); 4282 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0);
4304 int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0); 4283 int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0);
4305 pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); 4284 pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
4306 v42 = IsTerrainSlopeTooHigh(pX, _angle_y); 4285 v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
4307 is_not_on_bmodel = false; 4286 is_not_on_bmodel = false;
4308 v118 = v42; 4287 //v118 = v42;
4309 if ( !v97 && !v110 && !bmodel_standing_on_pid ) 4288 if ( !v97 && !v110 && !bmodel_standing_on_pid )
4310 is_not_on_bmodel = true; 4289 is_not_on_bmodel = true;
4311 v43 = 1; 4290 v43 = 1;
4312 v44 = 1; 4291 v44 = 1;
4313 if ( bUnderwater || !is_not_on_bmodel ) 4292 if ( bUnderwater || !is_not_on_bmodel )
4314 { 4293 {
4315 pX = _angle_x; 4294 pX = _angle_x;
4316 if ( v43 ) 4295 if ( v43 )
4317 pY = _angle_y; 4296 pY = _angle_y;
4318 } 4297 }
4319 else 4298 else
4320 { 4299 {
4321 if ( pModel && v129 > pZ ) 4300 if ( pModel && v129 > pZ )
4322 v44 = 0; 4301 v44 = 0;
4323 if ( v118 && v119 > pZ ) 4302 if ( v42 && v119 > pZ )
4324 v43 = 0; 4303 v43 = 0;
4325 if ( v44 ) 4304 if ( v44 )
4326 { 4305 {
4327 pX = _angle_x; 4306 pX = _angle_x;
4328 if ( v43 ) 4307 if ( v43 )
4329 pY = _angle_y; 4308 pY = _angle_y;
4330 } 4309 }
4331 else if ( v43 ) 4310 else if ( v43 )
4332 pY = _angle_y; 4311 pY = _angle_y;
4333 else 4312 else
4334 { 4313 {
4335 pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); 4314 pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
4336 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ ) 4315 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ )
4337 { 4316 {
4338 v43 = 1; 4317 v43 = 1;
4339 pX = _angle_x; 4318 pX = _angle_x;
4340 if ( v43 ) 4319 if ( v43 )
4341 pY = _angle_y; 4320 pY = _angle_y;
4342 } 4321 }
4343 } 4322 }
4344 } 4323 }
4345 if ( stru_721530.field_7C >= stru_721530.field_6C ) 4324 if ( stru_721530.field_7C >= stru_721530.field_6C )
4346 { 4325 {
4347 if ( !is_not_on_bmodel ) 4326 if ( !is_not_on_bmodel )
4348 { 4327 {
4349 pX = stru_721530.normal2.x; 4328 pX = stru_721530.normal2.x;
4361 { 4340 {
4362 if (pParty->Invisible()) 4341 if (pParty->Invisible())
4363 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); 4342 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
4364 4343
4365 viewparams->bRedrawGameUI = true; 4344 viewparams->bRedrawGameUI = true;
4366 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 4345 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
4367 pModel = (BSPModel *)58500; 4346 pModel = (BSPModel *)58500;
4368 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 4347 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
4369 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4348 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4370 ++v126; 4349 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4371 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4350 continue;
4372 continue; 4351 }
4373 }
4374 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) 4352 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
4375 { 4353 {
4376 v56 = integer_sqrt(v2 * v2 + v128 * v128); 4354 //v118 = integer_sqrt(v2 * v2 + v128 * v128);
4377 v118 = v56; 4355 v129 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
4378 v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
4379 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); 4356 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y);
4380 v129 = v57; 4357 v59 = (signed int)stru_5C6E00->Cos(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128);
4381 v58 = (BSPModel *)stru_5C6E00->Cos(v57);
4382 pModel = v58;
4383 v59 = (signed int)v58 * (signed __int64)v56;
4384 v122 = v59 >> 16; 4358 v122 = v59 >> 16;
4385 v2 = v59 >> 16; 4359 v2 = v59 >> 16;
4386 v60 = (BSPModel *)stru_5C6E00->Sin(v129); 4360 v61 = (signed int)stru_5C6E00->Sin(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128);
4387 pModel = v60;
4388 v61 = (signed int)v60 * (signed __int64)v118;
4389 v122 = v61 >> 16; 4361 v122 = v61 >> 16;
4390 v128 = v61 >> 16; 4362 v128 = v61 >> 16;
4391 } 4363 }
4392 else 4364 else
4393 { 4365 {
4394 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) 4366 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
4395 { 4367 {
4396 pParty->bFlying = false; 4368 pParty->bFlying = false;
4397 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; 4369 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
4398 //v127 = v46;
4399 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; 4370 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
4400 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1; 4371 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1;
4401 v51 = __OFSUB__(v48, 32); 4372 v129 = v48 <= 32;
4402 v49 = v48 == 32; 4373 v119 = pODMFace->pFacePlane.vNormal.z < 46378;
4403 v50 = v48 - 32 < 0;
4404 v52 = pODMFace->pFacePlane.vNormal.z;
4405 v129 = (unsigned __int8)(v50 ^ v51 | v49);
4406 v119 = v52 < 46378;
4407 if ( bUnderwater == 1 ) 4374 if ( bUnderwater == 1 )
4408 v119 = 0; 4375 v119 = 0;
4409 if ( pODMFace->uPolygonType == POLYGON_Floor ) 4376 if ( pODMFace->uPolygonType == POLYGON_Floor )
4410 { 4377 {
4411 if ( pParty->uFallSpeed < 0 ) 4378 if ( pParty->uFallSpeed < 0 )
4417 *(float *)&v128 = 0.0; 4384 *(float *)&v128 = 0.0;
4418 } 4385 }
4419 if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE)) 4386 if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE))
4420 { 4387 {
4421 pParty->floor_face_pid = v45; 4388 pParty->floor_face_pid = v45;
4422 v103 = pODMFace->sCogTriggeredID; 4389 v103 = pODMFace->sCogTriggeredID; //
4423 } 4390 }
4424 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 4391 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
4425 pModel = (BSPModel *)58500; 4392 pModel = (BSPModel *)58500;
4426 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 4393 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
4427 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4394 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4428 ++v126;
4429 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4395 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4430 continue; 4396 continue;
4431 } 4397 }
4432 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб 4398 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб
4433 { 4399 {
4434 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; 4400 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y
4401 + pParty->uFallSpeed * pODMFace->pFacePlane.vNormal.z
4402 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
4435 if ((stru_721530.speed >> 3) > v118 ) 4403 if ((stru_721530.speed >> 3) > v118 )
4436 v118 = stru_721530.speed >> 3; 4404 v118 = stru_721530.speed >> 3;
4437 v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16; 4405 v2 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16;
4438 _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16; 4406 v128 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16;
4439 v54 = 0; 4407 v54 = 0;
4440 if ( !v119 ) 4408 if ( !v119 )
4441 { 4409 pParty->uFallSpeed += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.z) >> 16;
4442 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z;
4443 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
4444 v54 = pModel;
4445 }
4446 pParty->uFallSpeed += (int)v54;
4447 v128 += _walk_speed;
4448 v2 += v129;
4449 v55 = stru_721530.prolly_normal_d 4410 v55 = stru_721530.prolly_normal_d
4450 - ((signed int)(pODMFace->pFacePlane.dist 4411 - ((signed int)(pODMFace->pFacePlane.dist
4451 + v122 * pODMFace->pFacePlane.vNormal.z 4412 + v122 * pODMFace->pFacePlane.vNormal.z
4452 + _angle_y * pODMFace->pFacePlane.vNormal.y 4413 + _angle_y * pODMFace->pFacePlane.vNormal.y
4453 + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16); 4414 + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16);
4456 pX = _angle_x + (pODMFace->pFacePlane.vNormal.x * v55 >> 16); 4417 pX = _angle_x + (pODMFace->pFacePlane.vNormal.x * v55 >> 16);
4457 pY = _angle_y + (pODMFace->pFacePlane.vNormal.y * v55 >> 16); 4418 pY = _angle_y + (pODMFace->pFacePlane.vNormal.y * v55 >> 16);
4458 if ( !v119 ) 4419 if ( !v119 )
4459 pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16); 4420 pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16);
4460 } 4421 }
4461 //LABEL_220: 4422 if ( pParty->floor_face_pid != stru_721530.uFaceID && BYTE3(pODMFace->uAttributes) & 4 )
4462 v45 = stru_721530.uFaceID; 4423 {
4463 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 ) 4424 pParty->floor_face_pid = stru_721530.uFaceID;
4464 { 4425 v103 = pODMFace->sCogTriggeredID; //
4465 pParty->floor_face_pid = v45; 4426 }
4466 v103 = pODMFace->sCogTriggeredID; 4427 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
4467 } 4428 pModel = (BSPModel *)58500;
4468 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 4429 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
4469 pModel = (BSPModel *)58500; 4430 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4470 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 4431 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4471 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4432 continue;
4472 ++v126;
4473 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4474 continue;
4475 } 4433 }
4476 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; 4434 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y
4435 + pParty->uFallSpeed * pODMFace->pFacePlane.vNormal.z + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
4477 if ((stru_721530.speed >> 3) > v118 ) 4436 if ((stru_721530.speed >> 3) > v118 )
4478 v118 = stru_721530.speed >> 3; 4437 v118 = stru_721530.speed >> 3;
4479 v122 = pODMFace->pFacePlane.vNormal.x; 4438 v2 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.x) >> 16;
4480 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16; 4439 v128 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.y) >> 16;
4481 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y; 4440 pParty->uFallSpeed += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.z) >> 16;
4482 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
4483 v129 = pODMFace->pFacePlane.vNormal.z;
4484 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
4485 pParty->uFallSpeed += v129;
4486 v2 += v122;
4487 v128 += (int)pModel;
4488 if ( v2 * v2 + v128 * v128 >= 400 ) 4441 if ( v2 * v2 + v128 * v128 >= 400 )
4489 { 4442 {
4490 v45 = stru_721530.uFaceID; 4443 if ( pParty->floor_face_pid != stru_721530.uFaceID && BYTE3(pODMFace->uAttributes) & 4 )
4491 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 ) 4444 {
4492 { 4445 pParty->floor_face_pid = stru_721530.uFaceID;
4493 pParty->floor_face_pid = v45; 4446 v103 = pODMFace->sCogTriggeredID; //
4494 v103 = pODMFace->sCogTriggeredID; 4447 }
4495 } 4448 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
4496 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 4449 pModel = (BSPModel *)58500;
4497 pModel = (BSPModel *)58500; 4450 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
4498 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 4451 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4499 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4452 //++v126;
4500 ++v126; 4453 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4501 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4454 continue;
4502 continue; 4455 }
4503 }
4504 v2 = 0; 4456 v2 = 0;
4505 pParty->uFallSpeed = 0; 4457 pParty->uFallSpeed = 0;
4506 *(float *)&v128 = 0.0; 4458 *(float *)&v128 = 0.0;
4507 } 4459 }
4508 } 4460 }
4509 //LABEL_234:
4510 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 4461 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
4511 pModel = (BSPModel *)58500; 4462 pModel = (BSPModel *)58500;
4512 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 4463 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
4513 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4464 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4514 ++v126;
4515 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; 4465 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
4516 } 4466 }
4517 while ( v126 < 100 ); 4467
4518 4468 //Воспроизведение звуков ходьбы/бега------------------------
4469 v122 = abs(pParty->vPosition.x - pX);
4470 uint pY_ = abs(pParty->vPosition.y - pY);
4471 v62 = abs(pParty->vPosition.z - pZ);
4519 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) 4472 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
4520 { 4473 {
4521 v122 = abs(pParty->vPosition.x - pX); 4474 pAudioPlayer->_4AA258(804);//stop sound
4522 v126 = abs(pParty->vPosition.y - pY); 4475 if ( party_running_flag && (!hovering || high_fall_flag) )
4523 v62 = abs(pParty->vPosition.z - pZ); 4476 {
4524 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) >= 8 ) 4477 if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 16 )
4525 {
4526 if ( party_running_flag && (!hovering || !high_fall_flag) )
4527 { 4478 {
4528 if ( !is_not_on_bmodel 4479 if ( !is_not_on_bmodel
4529 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) 4480 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
4530 pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи 4481 pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи
4531 else 4482 else
4532 { 4483 {
4533 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1); 4484 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
4534 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле 4485 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле
4535 } 4486 }
4536 } 4487 pParty->walk_sound_timer = 96;//таймер для бега
4537 else if ( party_walking_flag && (!hovering || !high_fall_flag) ) 4488 }
4489 }
4490 else if( party_walking_flag && (!hovering || high_fall_flag) )
4491 {
4492 if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 8 )
4538 { 4493 {
4539 if ( is_not_on_bmodel 4494 if ( is_not_on_bmodel
4540 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) 4495 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
4541 { 4496 {
4542 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0); 4497 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
4543 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);// хождение по земле 4498 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);// хождение по земле
4544 } 4499 }
4545 else 4500 else
4546 pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи 4501 pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи
4547 } 4502 pParty->walk_sound_timer = 144;//таймер для ходьбы
4548 } 4503 }
4549 else 4504 }
4550 { 4505 }
4551 pAudioPlayer->_4AA258(804); 4506 if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) < 8 )//отключить звук ходьбы при остановке
4552 pParty->walk_sound_timer = 64; 4507 pAudioPlayer->_4AA258(804);
4553 } 4508 //------------------------------------------------------------------------
4554 }
4555
4556 if ( !hovering || !high_fall_flag ) 4509 if ( !hovering || !high_fall_flag )
4557 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; 4510 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
4558 else 4511 else
4559 pParty->uFlags |= PARTY_FLAGS_1_FALLING; 4512 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
4560 v126 = WorldPosToGridCellX(pParty->vPosition.x); 4513 int pMap_X = WorldPosToGridCellX(pParty->vPosition.x);
4561 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; 4514 int pMap_Y = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
4562 unsigned int v114_a = WorldPosToGridCellX(pX); 4515 unsigned int v114_a = WorldPosToGridCellX(pX);
4563 v66 = WorldPosToGridCellZ(pY) - 1; 4516 v66 = WorldPosToGridCellZ(pY) - 1;
4564 pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); 4517 pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) >> 1) & 1);
4565 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, v65) >> 1) & 1; 4518 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) >> 1) & 1;
4566 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66);
4567 v68 = 0; 4519 v68 = 0;
4568 v69 = (~(unsigned int)v67 >> 1) & 1; 4520 v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) >> 1) & 1;
4569 if ( v114_a == v126 && v66 == v65 && v122 && v69 ) 4521 if ( v114_a == pMap_X && v66 == pMap_Y && v122 && v69 )
4570 v68 = 1; 4522 v68 = 1;
4571 if ( !is_not_on_bmodel ) 4523 if ( !is_not_on_bmodel )
4572 v68 = 1; 4524 v68 = 1;
4573 if ( v68 ) 4525 if ( v68 )
4574 { 4526 {
4575 v70 = pZ;
4576 v71 = pX;
4577 v72 = pY;
4578 //pParty->uFallSpeed = v121;
4579 v73 = pZ;
4580 pParty->vPosition.x = pX; 4527 pParty->vPosition.x = pX;
4581 pParty->vPosition.y = pY; 4528 pParty->vPosition.y = pY;
4582 pParty->vPosition.z = pZ; 4529 pParty->vPosition.z = pZ;
4583 pParty->field_6F0 = v113; 4530 pParty->field_6F0 = v113;
4584 if ( pZ > 8160 ) 4531 if ( pZ > 8160 )
4585 { 4532 {
4586 v73 = 8160; 4533 pZ = 8160;
4587 pParty->uFallStartY = 8160; 4534 pParty->uFallStartY = 8160;
4588 pParty->vPosition.z = 8160; 4535 pParty->vPosition.z = 8160;
4589 } 4536 }
4590 if ( !v103 4537 if ( !v103 //падение на землю
4591 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71) 4538 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
4592 && pParty->vPosition.y == v72 4539 && pParty->vPosition.y == pY
4593 && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) ) 4540 && pParty->vPosition.z == pZ )
4594 { 4541 {
4595 if ( v73 < v111 ) 4542 if ( pParty->vPosition.z < v111 )
4596 { 4543 {
4597 pParty->uFallSpeed = 0; 4544 pParty->uFallSpeed = 0;
4598 v73 = v105; 4545 //v73 = v105;
4599 pParty->vPosition.z = v105; 4546 pParty->vPosition.z = v105;
4600 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )//Fall to the ground(падение на землю с высоты) 4547 if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= v105 && !bUnderwater )//Fall to the ground(падение на землю с высоты)
4601 { 4548 {
4602 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) 4549 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
4603 { 4550 {
4604 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 4551 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
4605 } 4552 }
4606 else 4553 else
4607 { 4554 {
4608 for ( uint i = 1; i <= 4; ++i ) 4555 for ( uint i = 1; i <= 4; ++i )
4609 { 4556 {
4610 v110 = pPlayers[i]->GetMaxHealth(); 4557 v110 = pPlayers[i]->GetMaxHealth();
4611 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, 4558 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
4612 DMGT_PHISYCAL); 4559 DMGT_PHISYCAL);
4613 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); 4560 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
4614 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 4561 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
4615 } 4562 }
4616 v73 = pParty->vPosition.z; 4563 //v73 = pParty->vPosition.z;
4617 } 4564 }
4618 } 4565 }
4619 pParty->uFallStartY = v70; 4566 pParty->uFallStartY = pZ;
4620 } 4567 }
4621 if ( v102 && v73 < v109 ) 4568 if ( v102 && pParty->vPosition.z < ceiling_height )
4622 { 4569 {
4623 if ( (signed int)(pParty->uPartyHeight + v73) >= v109 ) 4570 if ( (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height )
4624 { 4571 {
4625 pParty->vPosition.z = v109 - pParty->uPartyHeight - 1; 4572 pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 1;
4626 pParty->field_6F0 = v109 - pParty->uPartyHeight - 1; 4573 pParty->field_6F0 = ceiling_height - pParty->uPartyHeight - 1;
4627 } 4574 }
4628 } 4575 }
4629 pParty->uFlags &= ~0x204; 4576 pParty->uFlags &= ~0x204;
4630 } 4577 }
4631 return; 4578 return;
4637 v77 = v122 != 0; 4584 v77 = v122 != 0;
4638 bool party_drowning_flag = false; 4585 bool party_drowning_flag = false;
4639 if ( !pParty->bFlying && high_fall_flag && !bWaterWalk ) 4586 if ( !pParty->bFlying && high_fall_flag && !bWaterWalk )
4640 { 4587 {
4641 if ( pModel ) 4588 if ( pModel )
4642 {
4643 v78 = v69 != 0; 4589 v78 = v69 != 0;
4644 } 4590 else
4645 else 4591 {
4646 { 4592 party_drowning_flag = true;
4647 party_drowning_flag = true; 4593 v78 = true;
4648 v78 = 1; 4594 }
4649 }
4650 } 4595 }
4651 else 4596 else
4652 v78 = 1; 4597 v78 = true;
4653 //LABEL_306: 4598
4654 if ( v77 ) 4599 if ( v77 )
4655 {
4656 pParty->vPosition.x = pX; 4600 pParty->vPosition.x = pX;
4657 }
4658 if ( v78 ) 4601 if ( v78 )
4659 {
4660 pParty->vPosition.y = pY; 4602 pParty->vPosition.y = pY;
4661 } 4603
4662 if ( v78 || v77) 4604 if ( v78 || v77)
4663 { 4605 {
4664 if ( bWaterWalk ) 4606 if ( bWaterWalk )
4665 { 4607 {
4666 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; 4608 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
4682 else if ( bWalkSound && pParty->walk_sound_timer <= 0 ) 4624 else if ( bWalkSound && pParty->walk_sound_timer <= 0 )
4683 { 4625 {
4684 pAudioPlayer->_4AA258(804); 4626 pAudioPlayer->_4AA258(804);
4685 pParty->walk_sound_timer = 64; 4627 pParty->walk_sound_timer = 64;
4686 } 4628 }
4687 //LABEL_318: 4629
4688 v81 = pZ; 4630 v81 = pZ;
4689 v82 = pZ; 4631 v82 = pZ;
4690 pParty->vPosition.z = pZ; 4632 pParty->vPosition.z = pZ;
4691 if ( pZ > 8160 ) 4633 if ( pZ > 8160 )
4692 { 4634 {
4701 { 4643 {
4702 pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); 4644 pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1);
4703 if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1 4645 if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1
4704 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE; 4646 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE;
4705 } 4647 }
4706 if ( !v103 4648
4649 if ( !v103//падение на воду
4707 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) 4650 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
4708 && pParty->vPosition.y == pY 4651 && pParty->vPosition.y == pY
4709 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) 4652 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )
4710 { 4653 {
4711 if ( v82 < v111 ) 4654 if ( pParty->vPosition.z < v111 )
4712 { 4655 {
4713 v82 = v105; 4656 v82 = v105;
4714 pParty->uFallSpeed = 0; 4657 pParty->uFallSpeed = 0;
4715 pParty->vPosition.z = v105; 4658 pParty->vPosition.z = v105;
4716 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )//Fall to the water(падение на воду с высоты) 4659 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )//Fall to the water(падение на воду с высоты)
4732 v82 = pParty->vPosition.z; 4675 v82 = pParty->vPosition.z;
4733 } 4676 }
4734 } 4677 }
4735 pParty->uFallStartY = v81; 4678 pParty->uFallStartY = v81;
4736 } 4679 }
4737 if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 ) 4680 if ( v102 && v82 < ceiling_height && (signed int)(pParty->uPartyHeight + v82) >= ceiling_height )
4738 { 4681 {
4739 pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1; 4682 pParty->vPosition.z = v82 + pParty->uPartyHeight - ceiling_height + 1;
4740 pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1; 4683 pParty->field_6F0 = v82 + pParty->uPartyHeight - ceiling_height + 1;
4741 } 4684 }
4742 } 4685 }
4743 } 4686 }
4744 //----- (0046D8E3) -------------------------------------------------------- 4687 //----- (0046D8E3) --------------------------------------------------------
4745 int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight, int pFaceID) 4688 int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight, int pFaceID)