comparison mm7_3.cpp @ 1424:5930342f092b

fall to the water
author Ritor1
date Tue, 30 Jul 2013 15:14:46 +0600
parents 483b1b453986
children 1987f2cca08f
comparison
equal deleted inserted replaced
1423:350959f13283 1424:5930342f092b
2108 } 2108 }
2109 2109
2110 //----- (00473893) -------------------------------------------------------- 2110 //----- (00473893) --------------------------------------------------------
2111 void ODM_ProcessPartyActions() 2111 void ODM_ProcessPartyActions()
2112 { 2112 {
2113 //int _zero; // esi@1
2114 int v1; // edi@1 2113 int v1; // edi@1
2115 int v2; // ebx@1 2114 int v2; // ebx@1
2116 int v3; // eax@14 2115 int v3; // eax@14
2117 //Player **v4; // esi@21
2118 //int v5; // eax@24
2119 int v6; // esi@45 2116 int v6; // esi@45
2120 ODMFace *v7; // ecx@45 2117 ODMFace *v7; // ecx@45
2121 //unsigned int v8; // eax@71
2122 //double v9; // st7@72
2123 //signed __int64 v10; // qax@74
2124 //double v11; // st7@75
2125 //int v12; // ecx@77
2126 //int v13; // eax@84
2127 //double v14; // st7@84
2128 //int v15; // eax@87
2129 //double v16; // st7@87
2130 //int v17; // eax@88
2131 //double v18; // st7@88
2132 //int v19; // eax@89
2133 //double v20; // st7@89
2134 //int v21; // eax@92
2135 //double v22; // st7@92
2136 //int v23; // eax@96
2137 //double v24; // st7@96
2138 //int v25; // eax@97
2139 //double v26; // st7@97
2140 //int v27; // eax@98
2141 //double v28; // st7@98
2142 //signed __int64 v29; // qax@98
2143 //unsigned int v30; // eax@103
2144 int v31; // eax@130
2145 //int v32; // ecx@141
2146 signed int v33; // eax@143 2118 signed int v33; // eax@143
2147 int v34; // esi@143 2119 int v34; // esi@143
2148 int v35; // esi@147 2120 int v35; // esi@147
2149 int v36; // eax@155 2121 int v36; // eax@155
2150 signed int v37; // esi@159 2122 signed int v37; // esi@159
2151 signed int v38; // eax@159 2123 signed int v38; // eax@159
2152 signed int i; // esi@159 2124 signed int i; // esi@159
2153 int v40; // esi@162 2125 int v40; // esi@162
2154 //Player **v41; // esi@172
2155 bool v42; // eax@180 2126 bool v42; // eax@180
2156 signed int v43; // ecx@184 2127 signed int v43; // ecx@184
2157 signed int v44; // edx@184 2128 signed int v44; // edx@184
2158 int v45; // ecx@200 2129 int v45; // ecx@200
2159 BSPModel *v46; // eax@203 2130 BSPModel *pModel; // eax@203
2160 ODMFace *v47; // esi@203 2131 ODMFace *pODMFace; // esi@203
2161 int v48; // eax@203 2132 int v48; // eax@203
2162 char v49; // zf@203 2133 char v49; // zf@203
2163 char v50; // sf@203 2134 char v50; // sf@203
2164 unsigned __int8 v51; // of@203 2135 unsigned __int8 v51; // of@203
2165 int v52; // eax@203 2136 int v52; // eax@203
2166 unsigned __int8 v53; // dl@205
2167 BSPModel *v54; // eax@215 2137 BSPModel *v54; // eax@215
2168 int v55; // eax@217 2138 int v55; // eax@217
2169 signed int v56; // ebx@228 2139 signed int v56; // ebx@228
2170 int v57; // eax@228 2140 int v57; // eax@228
2171 BSPModel *v58; // eax@228 2141 BSPModel *v58; // eax@228
2172 unsigned __int64 v59; // qax@228 2142 unsigned __int64 v59; // qax@228
2173 BSPModel *v60; // eax@228 2143 BSPModel *v60; // eax@228
2174 unsigned __int64 v61; // qax@228 2144 unsigned __int64 v61; // qax@228
2175 int v62; // eax@241 2145 int v62; // eax@241
2176 signed int v63; // ST04_4@255
2177 signed int v64; // eax@255
2178 unsigned int v65; // ebx@263 2146 unsigned int v65; // ebx@263
2179 unsigned int v66; // esi@263 2147 unsigned int v66; // esi@263
2180 int v67; // eax@263 2148 int v67; // eax@263
2181 signed int v68; // ecx@263 2149 signed int v68; // ecx@263
2182 int v69; // eax@263 2150 int v69; // eax@263
2183 int v70; // ebx@271 2151 int v70; // ebx@271
2184 int v71; // esi@271 2152 int v71; // esi@271
2185 int v72; // edi@271 2153 int v72; // edi@271
2186 int v73; // eax@271 2154 int v73; // eax@271
2187 Player **v74; // esi@283
2188 int v75; // eax@284
2189 unsigned int v76; // edi@293 2155 unsigned int v76; // edi@293
2190 bool v77; // edx@297 2156 bool v77; // edx@297
2191 bool v78; // ecx@303 2157 bool v78; // ecx@303
2192 int v79; // ecx@314 2158 int v79; // ecx@314
2193 __int16 v80; // dx@317 2159 __int16 v80; // dx@317
2194 int v81; // ebx@318 2160 int v81; // ebx@318
2195 int v82; // ecx@318 2161 int v82; // ecx@318
2196 int v83; // eax@321 2162 int pTerrainHeight; // eax@321
2197 Player **v84; // esi@333
2198 int v85; // eax@334
2199 int v86; // [sp-20h] [bp-B4h]@246 2163 int v86; // [sp-20h] [bp-B4h]@246
2200 int v87; // [sp-20h] [bp-B4h]@248 2164 int v87; // [sp-20h] [bp-B4h]@248
2201 signed int v88; // [sp-1Ch] [bp-B0h]@246 2165 signed int v88; // [sp-1Ch] [bp-B0h]@246
2202 unsigned int v89; // [sp-18h] [bp-ACh]@246 2166 unsigned int v89; // [sp-18h] [bp-ACh]@246
2203 signed int v90; // [sp-14h] [bp-A8h]@246 2167 signed int v90; // [sp-14h] [bp-A8h]@246
2204 signed int v91; // [sp-10h] [bp-A4h]@246 2168 signed int v91; // [sp-10h] [bp-A4h]@246
2205 int v92; // [sp-Ch] [bp-A0h]@246 2169 int v92; // [sp-Ch] [bp-A0h]@246
2206 //int v93; // [sp-8h] [bp-9Ch]@104
2207 unsigned int v94; // [sp-8h] [bp-9Ch]@246 2170 unsigned int v94; // [sp-8h] [bp-9Ch]@246
2208 //int v95; // [sp-4h] [bp-98h]@104
2209 int v96; // [sp-4h] [bp-98h]@246 2171 int v96; // [sp-4h] [bp-98h]@246
2210 int v97; // [sp+Ch] [bp-88h]@180 2172 int v97; // [sp+Ch] [bp-88h]@180
2211 Vec3_int_ v98; 2173 Vec3_int_ v98;
2212 //int v98; // [sp+10h] [bp-84h]@147
2213 //int v99; // [sp+14h] [bp-80h]@147
2214 //int v100; // [sp+18h] [bp-7Ch]@147
2215 bool v101; // [sp+1Ch] [bp-78h]@33 2174 bool v101; // [sp+1Ch] [bp-78h]@33
2216 int v102; // [sp+20h] [bp-74h]@1 2175 int v102; // [sp+20h] [bp-74h]@1
2217 int v103; // [sp+24h] [bp-70h]@1 2176 int v103; // [sp+24h] [bp-70h]@1
2218 int bFeatherFall; // [sp+28h] [bp-6Ch]@4 2177 int bFeatherFall; // [sp+28h] [bp-6Ch]@4
2219 int v105; // [sp+2Ch] [bp-68h]@24 2178 int v105; // [sp+2Ch] [bp-68h]@24
2220 int bWaterWalk; // [sp+30h] [bp-64h]@1 2179 int bWaterWalk; // [sp+30h] [bp-64h]@1
2221 //bool v107; // [sp+34h] [bp-60h]@30
2222 //int v108; // [sp+38h] [bp-5Ch]@1
2223 int v109; // [sp+3Ch] [bp-58h]@28 2180 int v109; // [sp+3Ch] [bp-58h]@28
2224 int v110; // [sp+40h] [bp-54h]@180 2181 int v110; // [sp+40h] [bp-54h]@180
2225 int v111; // [sp+44h] [bp-50h]@14 2182 int v111; // [sp+44h] [bp-50h]@14
2226 int bJumping; // [sp+48h] [bp-4Ch]@1 2183 int bJumping; // [sp+48h] [bp-4Ch]@1
2227 int v113; // [sp+4Ch] [bp-48h]@1 2184 int v113; // [sp+4Ch] [bp-48h]@1
2228 unsigned int v114; // [sp+50h] [bp-44h]@1 2185 unsigned int v114; // [sp+50h] [bp-44h]@1
2229 int _walk_speed; // [sp+54h] [bp-40h]@48 2186 int _walk_speed; // [sp+54h] [bp-40h]@48
2230 int pX; // [sp+58h] [bp-3Ch]@1 2187 int pX; // [sp+58h] [bp-3Ch]@1
2231 int pY; // [sp+5Ch] [bp-38h]@1 2188 int pY; // [sp+5Ch] [bp-38h]@1
2232 int v118; // [sp+60h] [bp-34h]@1 2189 int v118; // [sp+60h] [bp-34h]@1
2233 //Player **v119; // [sp+64h] [bp-30h]@4
2234 int _angle_x; // [sp+68h] [bp-2Ch]@48 2190 int _angle_x; // [sp+68h] [bp-2Ch]@48
2235 int v121; // [sp+6Ch] [bp-28h]@1
2236 unsigned int v122; // [sp+70h] [bp-24h]@180 2191 unsigned int v122; // [sp+70h] [bp-24h]@180
2237 int pZ; // [sp+74h] [bp-20h]@1 2192 int pZ; // [sp+74h] [bp-20h]@1
2238 int v124; // [sp+78h] [bp-1Ch]@1 2193 int v124; // [sp+78h] [bp-1Ch]@1
2239 int _angle_y; // [sp+7Ch] [bp-18h]@48 2194 int _angle_y; // [sp+7Ch] [bp-18h]@48
2240 int v126; // [sp+80h] [bp-14h]@48 2195 int v126; // [sp+80h] [bp-14h]@48
2241 BSPModel *v127; // [sp+84h] [bp-10h]@1
2242 int v128; // [sp+88h] [bp-Ch]@1 2196 int v128; // [sp+88h] [bp-Ch]@1
2243 int v129; // [sp+8Ch] [bp-8h]@92 2197 int v129; // [sp+8Ch] [bp-8h]@92
2244 //int v130; // [sp+90h] [bp-4h]@14 2198
2245
2246 v121 = pParty->uFallSpeed;
2247 pZ = pParty->vPosition.z; 2199 pZ = pParty->vPosition.z;
2248 v1 = 0; 2200 v1 = 0;
2249 v103 = 0; 2201 v103 = 0;
2250 v2 = 0; 2202 v2 = 0;
2251 //*(float *)&v128 = 0.0; 2203 //*(float *)&v128 = 0.0;
2257 bJumping = 0; 2209 bJumping = 0;
2258 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); 2210 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
2259 v114 = 0; 2211 v114 = 0;
2260 v124 = 0; 2212 v124 = 0;
2261 v102 = 0; 2213 v102 = 0;
2262 v127 = 0; 2214 pModel = 0;
2263 bWaterWalk = 0; 2215 bWaterWalk = 0;
2264 if (!pParty->FeatherFallActive()) 2216 if (!pParty->FeatherFallActive())
2265 { 2217 {
2266 bFeatherFall = 0; 2218 bFeatherFall = 0;
2267 for (int i = 0; i < 4; ++i) 2219 for (int i = 0; i < 4; ++i)
2399 pZ = 4000; 2351 pZ = 4000;
2400 v113 = 4000; 2352 v113 = 4000;
2401 } 2353 }
2402 v1 = 0; 2354 v1 = 0;
2403 v2 = 0; 2355 v2 = 0;
2404 v121 = 0; 2356 pParty->uFallSpeed = 0;
2405 *(float *)&v128 = 0.0; 2357 *(float *)&v128 = 0.0;
2406 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 ) 2358 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 )
2407 { 2359 {
2408 pParty->field_6E0 = 0; 2360 pParty->field_6E0 = 0;
2409 pParty->field_6E4 = 0; 2361 pParty->field_6E4 = 0;
2414 pParty->bFlying = 0; 2366 pParty->bFlying = 0;
2415 pZ = v109 - pParty->uPartyHeight - 31; 2367 pZ = v109 - pParty->uPartyHeight - 31;
2416 v113 = pParty->field_6F0; 2368 v113 = pParty->field_6F0;
2417 } 2369 }
2418 pParty->uFallSpeed = 0; 2370 pParty->uFallSpeed = 0;
2419 v127 = (BSPModel *)1; 2371 pModel = (BSPModel *)1;
2420 } 2372 }
2421 } 2373 }
2422 } 2374 }
2423 break; 2375 break;
2424 2376
2431 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 ) 2383 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 )
2432 { 2384 {
2433 pZ -= 30; 2385 pZ -= 30;
2434 v113 -= 30; 2386 v113 -= 30;
2435 pParty->uFallSpeed = 0; 2387 pParty->uFallSpeed = 0;
2436 v121 = 0; 2388 //pParty->uFallSpeed = 0;
2437 pParty->bFlying = 1; 2389 pParty->bFlying = 1;
2438 v127 = (BSPModel *)1; 2390 pModel = (BSPModel *)1;
2439 if ( pZ <= v111 ) 2391 if ( pZ <= v111 )
2440 { 2392 {
2441 pParty->bFlying = 0; 2393 pParty->bFlying = 0;
2442 pPartyActionQueue->uNumActions = 0; 2394 pPartyActionQueue->uNumActions = 0;
2443 } 2395 }
2538 *(float *)&v128 = _walk_speed; 2490 *(float *)&v128 = _walk_speed;
2539 2491
2540 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), 2492 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
2541 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); 2493 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
2542 2494
2543 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 2495 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2544 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; 2496 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2545 2497
2546 if (pParty->bFlying) 2498 if (pParty->bFlying)
2547 { 2499 {
2548 v2 += 4 * dx; 2500 v2 += 4 * dx;
2612 v124 = 1; 2564 v124 = 1;
2613 } 2565 }
2614 } 2566 }
2615 break; 2567 break;
2616 2568
2617
2618 case PARTY_CenterView: 2569 case PARTY_CenterView:
2619 _angle_x = 0; 2570 _angle_x = 0;
2620 break; 2571 break;
2621 2572
2622 case PARTY_LookUp: 2573 case PARTY_LookUp:
2638 case PARTY_Jump: 2589 case PARTY_Jump:
2639 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) 2590 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
2640 { 2591 {
2641 v126 = pParty->field_24 << 6; 2592 v126 = pParty->field_24 << 6;
2642 bJumping = 1; 2593 bJumping = 1;
2643 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121); 2594 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
2644 } 2595 }
2645 break; 2596 break;
2646 2597
2647 default: 2598 default:
2648 assert(false); 2599 assert(false);
2664 pParty->sRotationX = _angle_x; 2615 pParty->sRotationX = _angle_x;
2665 if ( pZ < v111 || pParty->bFlying) 2616 if ( pZ < v111 || pParty->bFlying)
2666 { 2617 {
2667 if ( pParty->bFlying ) 2618 if ( pParty->bFlying )
2668 { 2619 {
2669 //LABEL_130: 2620 v126 = stru_5C6E00->Cos(GetTickCount());
2670 v31 = GetTickCount();
2671 v126 = stru_5C6E00->Cos(v31);
2672 v129 = (unsigned __int64)(4i64 * v126) >> 16; 2621 v129 = (unsigned __int64)(4i64 * v126) >> 16;
2673 pZ = v113 + v129; 2622 pZ = v113 + v129;
2674 if ( v127 ) 2623 if ( pModel )
2675 pZ = v113; 2624 pZ = v113;
2676 if (pParty->FlyActive()) 2625 if (pParty->FlyActive())
2677 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; 2626 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
2678 pParty->uFallStartY = pZ; 2627 pParty->uFallStartY = pZ;
2679 //goto LABEL_141; 2628 }
2680 } 2629 else
2681 else 2630 {
2682 { 2631 if ( is_on_water && pParty->uFallSpeed )
2683 if ( is_on_water && v121 ) 2632 sub_42F960_create_object(pX, pY, v111);
2684 sub_42F960_create_object(pX, pY, v111); 2633 pParty->uFallSpeed = 0;
2685 v121 = 0; 2634 pZ = v111;
2686 pZ = v111; 2635 pParty->uFallStartY = v111;
2687 pParty->uFallStartY = v111; 2636 v113 = pZ;
2688 v113 = pZ; 2637 if (pParty->FlyActive())
2689 if (pParty->FlyActive()) 2638 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
2690 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; 2639 }
2691
2692 }
2693 } 2640 }
2694 else 2641 else
2695 { 2642 {
2696 v113 = pZ; 2643 v113 = pZ;
2697 if (pParty->FlyActive()) 2644 if (pParty->FlyActive())
2699 } 2646 }
2700 //LABEL_141: 2647 //LABEL_141:
2701 if (bJumping && !pParty->bFlying) 2648 if (bJumping && !pParty->bFlying)
2702 { 2649 {
2703 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); 2650 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
2704 v34 = v121 + 2 * v33; 2651 v34 = pParty->uFallSpeed + 2 * v33;
2705 v121 += 2 * v33; 2652 pParty->uFallSpeed += 2 * v33;
2706 } 2653 }
2707 else if (!partyAtHighSlope) 2654 else if (!partyAtHighSlope)
2708 { 2655 {
2709 v34 = v121; 2656 v34 = pParty->uFallSpeed;
2710 } 2657 }
2711 else if (!bJumping) 2658 else if (!bJumping)
2712 { 2659 {
2713 if ( !bmodel_standing_on_pid ) 2660 if ( !bmodel_standing_on_pid )
2714 { 2661 {
2715 // rolling down the hill 2662 // rolling down the hill
2716 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air 2663 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
2717 // and falling to the gravity, gradually sliding downwards. nice trick 2664 // and falling to the gravity, gradually sliding downwards. nice trick
2718 pZ = v111; 2665 pZ = v111;
2719 ODM_GetTerrainNormalAt(pX, pY, &v98); 2666 ODM_GetTerrainNormalAt(pX, pY, &v98);
2720 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); 2667 v35 = pParty->uFallSpeed + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
2721 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; 2668 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
2722 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; 2669 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
2723 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; 2670 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
2724 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); 2671 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
2725 v128 = v1; 2672 v128 = v1;
2726 v121 = v34; 2673 pParty->uFallSpeed = v34;
2727 } 2674 }
2728 } 2675 }
2729 else 2676 else
2730 v34 = v121; 2677 v34 = pParty->uFallSpeed;
2731 2678
2732 //LABEL_164: 2679 //LABEL_164:
2733 if(bJumping) 2680 if(bJumping)
2734 { 2681 {
2735 if ( !bUnderwater && v34 <= 0) 2682 if ( !bUnderwater && v34 <= 0)
2774 stru_721530.field_34.y = pY; 2721 stru_721530.field_34.y = pY;
2775 stru_721530.normal.y = pY; 2722 stru_721530.normal.y = pY;
2776 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; 2723 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
2777 stru_721530.field_34.z = stru_721530.field_C + pZ + 1; 2724 stru_721530.field_34.z = stru_721530.field_C + pZ + 1;
2778 stru_721530.field_20 = v128; 2725 stru_721530.field_20 = v128;
2779 stru_721530.field_24 = v121; 2726 stru_721530.field_24 = pParty->uFallSpeed;
2780 v36 = 0; 2727 v36 = 0;
2781 stru_721530.uSectorID = 0; 2728 stru_721530.uSectorID = 0;
2782 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) 2729 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
2783 v36 = 13312; 2730 v36 = 13312;
2784 if ( stru_721530._47050A(v36) ) 2731 if ( stru_721530._47050A(v36) )
2798 } 2745 }
2799 else 2746 else
2800 { 2747 {
2801 _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); 2748 _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
2802 _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); 2749 _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
2803 v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); 2750 pModel = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
2804 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ; 2751 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ;
2805 } 2752 }
2806 v122 = v40; 2753 v122 = v40;
2807 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); 2754 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
2808 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0); 2755 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0);
2809 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0); 2756 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0);
2810 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); 2757 pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
2811 v42 = IsTerrainSlopeTooHigh(pX, _angle_y); 2758 v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
2812 is_not_on_bmodel = false; 2759 is_not_on_bmodel = false;
2813 v118 = v42; 2760 v118 = v42;
2814 if ( !v97 && !v110 && !bmodel_standing_on_pid ) 2761 if ( !v97 && !v110 && !bmodel_standing_on_pid )
2815 is_not_on_bmodel = true; 2762 is_not_on_bmodel = true;
2821 if ( v43 ) 2768 if ( v43 )
2822 pY = _angle_y; 2769 pY = _angle_y;
2823 } 2770 }
2824 else 2771 else
2825 { 2772 {
2826 if ( v127 && v129 > pZ ) 2773 if ( pModel && v129 > pZ )
2827 v44 = 0; 2774 v44 = 0;
2828 if ( v118 && v119 > pZ ) 2775 if ( v118 && v119 > pZ )
2829 v43 = 0; 2776 v43 = 0;
2830 if ( v44 ) 2777 if ( v44 )
2831 { 2778 {
2835 } 2782 }
2836 else if ( v43 ) 2783 else if ( v43 )
2837 pY = _angle_y; 2784 pY = _angle_y;
2838 else 2785 else
2839 { 2786 {
2840 v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); 2787 pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
2841 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) 2788 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ )
2842 { 2789 {
2843 v43 = 1; 2790 v43 = 1;
2844 pX = _angle_x; 2791 pX = _angle_x;
2845 if ( v43 ) 2792 if ( v43 )
2846 pY = _angle_y; 2793 pY = _angle_y;
2867 if (pParty->Invisible()) 2814 if (pParty->Invisible())
2868 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); 2815 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
2869 2816
2870 viewparams->bRedrawGameUI = 1; 2817 viewparams->bRedrawGameUI = 1;
2871 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 2818 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2872 v127 = (BSPModel *)58500; 2819 pModel = (BSPModel *)58500;
2873 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 2820 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2874 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 2821 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2875 ++v126; 2822 ++v126;
2876 v121 = (unsigned __int64)(58500i64 * v121) >> 16; 2823 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2877 continue; 2824 continue;
2878 } 2825 }
2879 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) 2826 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
2880 { 2827 {
2881 v56 = integer_sqrt(v2 * v2 + v128 * v128); 2828 v56 = integer_sqrt(v2 * v2 + v128 * v128);
2882 v118 = v56; 2829 v118 = v56;
2883 v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, 2830 v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
2884 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); 2831 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y);
2885 v129 = v57; 2832 v129 = v57;
2886 v58 = (BSPModel *)stru_5C6E00->Cos(v57); 2833 v58 = (BSPModel *)stru_5C6E00->Cos(v57);
2887 v127 = v58; 2834 pModel = v58;
2888 v59 = (signed int)v58 * (signed __int64)v56; 2835 v59 = (signed int)v58 * (signed __int64)v56;
2889 v122 = v59 >> 16; 2836 v122 = v59 >> 16;
2890 v2 = v59 >> 16; 2837 v2 = v59 >> 16;
2891 v60 = (BSPModel *)stru_5C6E00->Sin(v129); 2838 v60 = (BSPModel *)stru_5C6E00->Sin(v129);
2892 v127 = v60; 2839 pModel = v60;
2893 v61 = (signed int)v60 * (signed __int64)v118; 2840 v61 = (signed int)v60 * (signed __int64)v118;
2894 v122 = v61 >> 16; 2841 v122 = v61 >> 16;
2895 v128 = v61 >> 16; 2842 v128 = v61 >> 16;
2896 } 2843 }
2897 else 2844 else
2898 { 2845 {
2899 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) 2846 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
2900 { 2847 {
2901 pParty->bFlying = 0; 2848 pParty->bFlying = 0;
2902 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; 2849 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
2903 v127 = v46; 2850 //v127 = v46;
2904 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; 2851 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
2905 v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1; 2852 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1;
2906 v51 = __OFSUB__(v48, 32); 2853 v51 = __OFSUB__(v48, 32);
2907 v49 = v48 == 32; 2854 v49 = v48 == 32;
2908 v50 = v48 - 32 < 0; 2855 v50 = v48 - 32 < 0;
2909 v52 = v47->pFacePlane.vNormal.z; 2856 v52 = pODMFace->pFacePlane.vNormal.z;
2910 v129 = (unsigned __int8)(v50 ^ v51 | v49); 2857 v129 = (unsigned __int8)(v50 ^ v51 | v49);
2911 v119 = v52 < 46378; 2858 v119 = v52 < 46378;
2912 if ( bUnderwater == 1 ) 2859 if ( bUnderwater == 1 )
2913 v119 = 0; 2860 v119 = 0;
2914 v53 = v47->uPolygonType; 2861 if ( pODMFace->uPolygonType == POLYGON_Floor )
2915 if ( v53 == 3 )
2916 { 2862 {
2917 if ( v121 < 0 ) 2863 if ( pParty->uFallSpeed < 0 )
2918 v121 = 0; 2864 pParty->uFallSpeed = 0;
2919 pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; 2865 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1;
2920 if ( v2 * v2 + v128 * v128 < 400 ) 2866 if ( v2 * v2 + v128 * v128 < 400 )
2921 { 2867 {
2922 v2 = 0; 2868 v2 = 0;
2923 *(float *)&v128 = 0.0; 2869 *(float *)&v128 = 0.0;
2924 } 2870 }
2925 if ( pParty->floor_face_pid != v45 && (v47->uAttributes & FACE_PRESSURE_PLATE)) 2871 if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE))
2926 { 2872 {
2927 pParty->floor_face_pid = v45; 2873 pParty->floor_face_pid = v45;
2928 v103 = v47->sCogTriggeredID; 2874 v103 = pODMFace->sCogTriggeredID;
2929 } 2875 }
2930 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 2876 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2931 v127 = (BSPModel *)58500; 2877 pModel = (BSPModel *)58500;
2932 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 2878 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2933 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 2879 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2934 ++v126; 2880 ++v126;
2935 v121 = (unsigned __int64)(58500i64 * v121) >> 16; 2881 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2936 continue; 2882 continue;
2937 } 2883 }
2938 if ( !v129 && (v53 != 4 || v119) ) 2884 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб
2939 { 2885 {
2940 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; 2886 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
2941 if ( stru_721530.field_64 >> 3 > v118 ) 2887 if ( stru_721530.field_64 >> 3 > v118 )
2942 v118 = stru_721530.field_64 >> 3; 2888 v118 = stru_721530.field_64 >> 3;
2943 v129 = v47->pFacePlane.vNormal.x; 2889 v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16;
2944 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; 2890 _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16;
2945 _walk_speed = v47->pFacePlane.vNormal.y;
2946 _walk_speed = (unsigned __int64)(v118 * (signed __int64)_walk_speed) >> 16;
2947 v54 = 0; 2891 v54 = 0;
2948 if ( !v119 ) 2892 if ( !v119 )
2949 { 2893 {
2950 v127 = (BSPModel *)v47->pFacePlane.vNormal.z; 2894 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z;
2951 v127 = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)v127) >> 16); 2895 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
2952 v54 = v127; 2896 v54 = pModel;
2953 } 2897 }
2954 v121 += (int)v54; 2898 pParty->uFallSpeed += (int)v54;
2955 v128 += _walk_speed; 2899 v128 += _walk_speed;
2956 v2 += v129; 2900 v2 += v129;
2957 v55 = stru_721530.prolly_normal_d 2901 v55 = stru_721530.prolly_normal_d
2958 - ((signed int)(v47->pFacePlane.dist 2902 - ((signed int)(pODMFace->pFacePlane.dist
2959 + v122 * v47->pFacePlane.vNormal.z 2903 + v122 * pODMFace->pFacePlane.vNormal.z
2960 + _angle_y * v47->pFacePlane.vNormal.y 2904 + _angle_y * pODMFace->pFacePlane.vNormal.y
2961 + _angle_x * v47->pFacePlane.vNormal.x) >> 16); 2905 + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16);
2962 if ( v55 > 0 ) 2906 if ( v55 > 0 )
2963 { 2907 {
2964 pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); 2908 pX = _angle_x + (pODMFace->pFacePlane.vNormal.x * v55 >> 16);
2965 pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); 2909 pY = _angle_y + (pODMFace->pFacePlane.vNormal.y * v55 >> 16);
2966 if ( !v119 ) 2910 if ( !v119 )
2967 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); 2911 pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16);
2968 } 2912 }
2969 //LABEL_220: 2913 //LABEL_220:
2970 v45 = stru_721530.uFaceID; 2914 v45 = stru_721530.uFaceID;
2971 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) 2915 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 )
2972 { 2916 {
2973 pParty->floor_face_pid = v45; 2917 pParty->floor_face_pid = v45;
2974 v103 = v47->sCogTriggeredID; 2918 v103 = pODMFace->sCogTriggeredID;
2975 } 2919 }
2976 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 2920 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2977 v127 = (BSPModel *)58500; 2921 pModel = (BSPModel *)58500;
2978 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 2922 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
2979 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 2923 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2980 ++v126; 2924 ++v126;
2981 v121 = (unsigned __int64)(58500i64 * v121) >> 16; 2925 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2982 continue; 2926 continue;
2983 } 2927 }
2984 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; 2928 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
2985 if ( stru_721530.field_64 >> 3 > v118 ) 2929 if ( stru_721530.field_64 >> 3 > v118 )
2986 v118 = stru_721530.field_64 >> 3; 2930 v118 = stru_721530.field_64 >> 3;
2987 v122 = v47->pFacePlane.vNormal.x; 2931 v122 = pODMFace->pFacePlane.vNormal.x;
2988 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16; 2932 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16;
2989 v127 = (BSPModel *)v47->pFacePlane.vNormal.y; 2933 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y;
2990 v127 = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)v127) >> 16); 2934 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
2991 v129 = v47->pFacePlane.vNormal.z; 2935 v129 = pODMFace->pFacePlane.vNormal.z;
2992 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; 2936 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
2993 v121 += v129; 2937 pParty->uFallSpeed += v129;
2994 v2 += v122; 2938 v2 += v122;
2995 v128 += (int)v127; 2939 v128 += (int)pModel;
2996 if ( v2 * v2 + v128 * v128 >= 400 ) 2940 if ( v2 * v2 + v128 * v128 >= 400 )
2997 { 2941 {
2998 v45 = stru_721530.uFaceID; 2942 v45 = stru_721530.uFaceID;
2999 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) 2943 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 )
3000 { 2944 {
3001 pParty->floor_face_pid = v45; 2945 pParty->floor_face_pid = v45;
3002 v103 = v47->sCogTriggeredID; 2946 v103 = pODMFace->sCogTriggeredID;
3003 } 2947 }
3004 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 2948 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
3005 v127 = (BSPModel *)58500; 2949 pModel = (BSPModel *)58500;
3006 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 2950 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
3007 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 2951 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
3008 ++v126; 2952 ++v126;
3009 v121 = (unsigned __int64)(58500i64 * v121) >> 16; 2953 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
3010 continue; 2954 continue;
3011 } 2955 }
3012 v2 = 0; 2956 v2 = 0;
3013 v121 = 0; 2957 pParty->uFallSpeed = 0;
3014 *(float *)&v128 = 0.0; 2958 *(float *)&v128 = 0.0;
3015 } 2959 }
3016 } 2960 }
3017 //LABEL_234: 2961 //LABEL_234:
3018 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 2962 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
3019 v127 = (BSPModel *)58500; 2963 pModel = (BSPModel *)58500;
3020 v128 = (unsigned __int64)(58500i64 * v128) >> 16; 2964 v128 = (unsigned __int64)(58500i64 * v128) >> 16;
3021 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 2965 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
3022 ++v126; 2966 ++v126;
3023 v121 = (unsigned __int64)(58500i64 * v121) >> 16; 2967 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
3024 } 2968 }
3025 while ( v126 < 100 ); 2969 while ( v126 < 100 );
3026 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) 2970 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
3027 { 2971 {
3028 v122 = abs(pParty->vPosition.x - pX); 2972 v122 = abs(pParty->vPosition.x - pX);
3038 if ( v114 && (!bJumping || v101) ) 2982 if ( v114 && (!bJumping || v101) )
3039 { 2983 {
3040 if ( !is_not_on_bmodel 2984 if ( !is_not_on_bmodel
3041 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) 2985 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
3042 { 2986 {
3043 pAudioPlayer->PlaySound((SoundID)64, 804, 1, -1, 0, 0, 0, 0); 2987 pAudioPlayer->PlaySound(SOUND_64, 804, 1, -1, 0, 0, 0, 0);
3044 } 2988 }
3045 else 2989 else
3046 { 2990 {
3047 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; 2991 //v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
3048 v64 = WorldPosToGridCellX(pParty->vPosition.x); 2992 //v64 = WorldPosToGridCellX(pParty->vPosition.x);
3049 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, 1); 2993 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
3050 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0); 2994 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);
3051 } 2995 }
3052 } 2996 }
3053 else 2997 else
3054 { 2998 {
3055 if ( v124 && (!bJumping || v101) ) 2999 if ( v124 && (!bJumping || v101) )
3056 { 3000 {
3057 if ( is_not_on_bmodel 3001 if ( is_not_on_bmodel
3058 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) 3002 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
3059 { 3003 {
3060 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; 3004 //v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
3061 v64 = WorldPosToGridCellX(pParty->vPosition.x); 3005 //v64 = WorldPosToGridCellX(pParty->vPosition.x);
3062 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, 0); 3006 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
3063 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0); 3007 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);
3064 } 3008 }
3065 else 3009 else
3066 pAudioPlayer->PlaySound((SoundID)103, 804, 1, -1, 0, 0, 0, 0); 3010 pAudioPlayer->PlaySound(SOUND_103, 804, 1, -1, 0, 0, 0, 0);
3067 } 3011 }
3068 else 3012 else
3069 { 3013 {
3070 pAudioPlayer->_4AA258(804); 3014 pAudioPlayer->_4AA258(804);
3071 pParty->walk_sound_timer = 64; 3015 pParty->walk_sound_timer = 64;
3079 pParty->uFlags |= PARTY_FLAGS_1_FALLING; 3023 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
3080 v126 = WorldPosToGridCellX(pParty->vPosition.x); 3024 v126 = WorldPosToGridCellX(pParty->vPosition.x);
3081 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; 3025 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
3082 v114 = WorldPosToGridCellX(pX); 3026 v114 = WorldPosToGridCellX(pX);
3083 v66 = WorldPosToGridCellZ(pY) - 1; 3027 v66 = WorldPosToGridCellZ(pY) - 1;
3084 v127 = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); 3028 pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1);
3085 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1; 3029 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1;
3086 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); 3030 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66);
3087 v68 = 0; 3031 v68 = 0;
3088 v69 = (~(unsigned int)v67 >> 1) & 1; 3032 v69 = (~(unsigned int)v67 >> 1) & 1;
3089 if ( v114 == v126 && v66 == v65 && v122 && v69 ) 3033 if ( v114 == v126 && v66 == v65 && v122 && v69 )
3093 if ( v68 ) 3037 if ( v68 )
3094 { 3038 {
3095 v70 = pZ; 3039 v70 = pZ;
3096 v71 = pX; 3040 v71 = pX;
3097 v72 = pY; 3041 v72 = pY;
3098 pParty->uFallSpeed = v121; 3042 //pParty->uFallSpeed = v121;
3099 v73 = pZ; 3043 v73 = pZ;
3100 pParty->vPosition.x = pX; 3044 pParty->vPosition.x = pX;
3101 pParty->vPosition.y = pY; 3045 pParty->vPosition.y = pY;
3102 pParty->vPosition.z = pZ; 3046 pParty->vPosition.z = pZ;
3103 pParty->field_6F0 = v113; 3047 pParty->field_6F0 = v113;
3115 if ( v73 < v111 ) 3059 if ( v73 < v111 )
3116 { 3060 {
3117 pParty->uFallSpeed = 0; 3061 pParty->uFallSpeed = 0;
3118 v73 = v105; 3062 v73 = v105;
3119 pParty->vPosition.z = v105; 3063 pParty->vPosition.z = v105;
3120 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater ) 3064 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )//Fall to the ground(падение на землю с высоты)
3121 { 3065 {
3122 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) 3066 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
3123 { 3067 {
3124 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 3068 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
3125 } 3069 }
3126 else 3070 else
3127 { 3071 {
3128 v74 = &pPlayers[1]; 3072 for ( uint i = 1; i <= 4; ++i )
3129 do
3130 { 3073 {
3131 v110 = (*v74)->GetMaxHealth(); 3074 v110 = pPlayers[i]->GetMaxHealth();
3132 (*v74)->ReceiveDamage((signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, 3075 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
3133 DMGT_PHISYCAL); 3076 DMGT_PHISYCAL);
3134 v75 = (*v74)->GetActualEndurance(); 3077 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
3135 v110 = 20 - (*v74)->GetParameterBonus(v75); 3078 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3136 (*v74)->SetRecoveryTime(
3137 (signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3138 ++v74;
3139 } 3079 }
3140 while ( (signed int)v74 <= (signed int)&pPlayers[4] );
3141 v73 = pParty->vPosition.z; 3080 v73 = pParty->vPosition.z;
3142 } 3081 }
3143 } 3082 }
3144 pParty->uFallStartY = v70; 3083 pParty->uFallStartY = v70;
3145 } 3084 }
3154 pParty->uFlags &= ~0x204; 3093 pParty->uFlags &= ~0x204;
3155 } 3094 }
3156 return; 3095 return;
3157 } 3096 }
3158 v76 = pParty->bFlying; 3097 v76 = pParty->bFlying;
3159 if ( pParty->bFlying || v101 == 0 || bWaterWalk || !v127 ) 3098 if ( pParty->bFlying || v101 == 0 || bWaterWalk || !pModel )
3160 v77 = 1; 3099 v77 = 1;
3161 else 3100 else
3162 v77 = v122 != 0; 3101 v77 = v122 != 0;
3163 v114 = 0; 3102 v114 = 0;
3164 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk ) 3103 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk )
3165 { 3104 {
3166 if ( v127 ) 3105 if ( pModel )
3167 { 3106 {
3168 v78 = v69 != 0; 3107 v78 = v69 != 0;
3169 } 3108 }
3170 else 3109 else
3171 { 3110 {
3218 v82 = 8160; 3157 v82 = 8160;
3219 pParty->uFallStartY = 8160; 3158 pParty->uFallStartY = 8160;
3220 pParty->vPosition.z = 8160; 3159 pParty->vPosition.z = 8160;
3221 } 3160 }
3222 LOWORD(pParty->uFlags) &= 0xFDFBu; 3161 LOWORD(pParty->uFlags) &= 0xFDFBu;
3223 pParty->uFallSpeed = v121; 3162 //pParty->uFallSpeed = v121;
3224 pParty->field_6F0 = v113; 3163 pParty->field_6F0 = v113;
3225 if ( v114 ) 3164 if ( v114 )//party stand to the water(группа стоит на воде)
3226 { 3165 {
3227 v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); 3166 pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1);
3228 v82 = pParty->vPosition.z; 3167 if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1
3229 if ( pParty->vPosition.z <= v83 ) 3168 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE;
3230 pParty->uFlags |= 4u;
3231 } 3169 }
3232 if ( !v103 3170 if ( !v103
3233 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) 3171 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
3234 && pParty->vPosition.y == pY 3172 && pParty->vPosition.y == pY
3235 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) 3173 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )
3237 if ( v82 < v111 ) 3175 if ( v82 < v111 )
3238 { 3176 {
3239 v82 = v105; 3177 v82 = v105;
3240 pParty->uFallSpeed = 0; 3178 pParty->uFallSpeed = 0;
3241 pParty->vPosition.z = v105; 3179 pParty->vPosition.z = v105;
3242 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater ) 3180 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )//Fall to the water(падение на воду с высоты)
3243 { 3181 {
3244 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) 3182 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
3245 { 3183 {
3246 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 3184 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
3247 } 3185 }
3248 else 3186 else
3249 { 3187 {
3250 v84 = &pPlayers[1]; 3188 for ( uint i = 1; i <= 4; ++i )
3251 do
3252 { 3189 {
3253 v110 = (*v84)->GetMaxHealth(); 3190 v110 = pPlayers[i]->GetMaxHealth();
3254 (*v84)->ReceiveDamage( 3191 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
3255 (signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256,
3256 DMGT_PHISYCAL); 3192 DMGT_PHISYCAL);
3257 v85 = (*v84)->GetActualEndurance(); 3193 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
3258 v110 = 20 - (*v84)->GetParameterBonus(v85); 3194 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3259 (*v84)->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3260 ++v84;
3261 } 3195 }
3262 while ( (signed int)v84 <= (signed int)&pPlayers[4] );
3263 v82 = pParty->vPosition.z; 3196 v82 = pParty->vPosition.z;
3264 } 3197 }
3265 } 3198 }
3266 pParty->uFallStartY = v81; 3199 pParty->uFallStartY = v81;
3267 } 3200 }