comparison mm7_3.cpp @ 148:77ad59c17864

Слияние
author Ritor1
date Tue, 12 Feb 2013 09:11:19 +0600
parents 7eeea515f5ff
children f4d7a9a8c363 2b0c652cc165
comparison
equal deleted inserted replaced
147:c70fea5013aa 148:77ad59c17864
993 v4 = v0->pMonsterInfo.uFlying; 993 v4 = v0->pMonsterInfo.uFlying;
994 v0->uSectorID = 0; 994 v0->uSectorID = 0;
995 v74 = v4; 995 v74 = v4;
996 if ( !v0->CanAct() ) 996 if ( !v0->CanAct() )
997 v74 = 0; 997 v74 = 0;
998 v70 = GetTerrainHeightsAroundParty(v0->vPosition.x, v0->vPosition.y); 998 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y);
999 v5 = sub_46D49E_prolly_get_world_y_under_party( 999 v5 = sub_46D49E_prolly_get_world_y_under_party(
1000 v0->vPosition.x, 1000 v0->vPosition.x,
1001 v0->vPosition.y, 1001 v0->vPosition.y,
1002 v0->vPosition.z, 1002 v0->vPosition.z,
1003 v0->uActorHeight, 1003 v0->uActorHeight,
1086 if ( v70 && !v72 && v67 ) 1086 if ( v70 && !v72 && v67 )
1087 { 1087 {
1088 v18 = v0->vPosition.y; 1088 v18 = v0->vPosition.y;
1089 v19 = v0->vPosition.x; 1089 v19 = v0->vPosition.x;
1090 v0->vPosition.z = v7; 1090 v0->vPosition.z = v7;
1091 _46DCC8_get_gravity_direction_outdoor(v19, v18, &v62); 1091 ODM_GetTerrainNormalAt(v19, v18, &v62);
1092 v20 = GetGravityStrength(); 1092 v20 = GetGravityStrength();
1093 v21 = v62.y; 1093 v21 = v62.y;
1094 v22 = v62.z; 1094 v22 = v62.z;
1095 v23 = v62.y * v0->vVelocity.y; 1095 v23 = v62.y * v0->vVelocity.y;
1096 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; 1096 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20;
1824 1824
1825 uLayingItemID_ = uLayingItemID; 1825 uLayingItemID_ = uLayingItemID;
1826 v1 = &pLayingItems[uLayingItemID]; 1826 v1 = &pLayingItems[uLayingItemID];
1827 v58 = 0; 1827 v58 = 0;
1828 v2 = &pObjectList->pObjects[v1->uObjectDescID]; 1828 v2 = &pObjectList->pObjects[v1->uObjectDescID];
1829 v57 = GetTerrainHeightsAroundParty(v1->vPosition.x, v1->vPosition.y); 1829 v57 = IsTerrainSlopeTooHigh(v1->vPosition.x, v1->vPosition.y);
1830 v3 = v1->vPosition.y; 1830 v3 = v1->vPosition.y;
1831 v4 = v1->vPosition.x; 1831 v4 = v1->vPosition.x;
1832 v5 = v2->uHeight; 1832 v5 = v2->uHeight;
1833 v55 = 0; 1833 v55 = 0;
1834 v6 = sub_46D49E_prolly_get_world_y_under_party(v4, v3, v1->vPosition.z, v5, &v59, &v55, 0); 1834 v6 = sub_46D49E_prolly_get_world_y_under_party(v4, v3, v1->vPosition.z, v5, &v59, &v55, 0);
1862 if ( v57 ) 1862 if ( v57 )
1863 { 1863 {
1864 v11 = v1->vPosition.y; 1864 v11 = v1->vPosition.y;
1865 v12 = v1->vPosition.x; 1865 v12 = v1->vPosition.x;
1866 v1->vPosition.z = v8; 1866 v1->vPosition.z = v8;
1867 _46DCC8_get_gravity_direction_outdoor(v12, v11, &v51); 1867 ODM_GetTerrainNormalAt(v12, v11, &v51);
1868 v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); 1868 v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
1869 v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16; 1869 v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16;
1870 v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16); 1870 v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
1871 v1->vVelocity.x += (unsigned int)(v56 * v51.x) >> 16; 1871 v1->vVelocity.x += (unsigned int)(v56 * v51.x) >> 16;
1872 v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16); 1872 v60 = (Actor *)((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
2551 v71 = 1; 2551 v71 = 1;
2552 v81 = pParty->uWalkSpeed; 2552 v81 = pParty->uWalkSpeed;
2553 angle = pParty->sRotationY; 2553 angle = pParty->sRotationY;
2554 _view_angle = pParty->sRotationX; 2554 _view_angle = pParty->sRotationX;
2555 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format 2555 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format
2556 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed * stru_5C6E00->uIntegerPi) 2556 * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
2557 / 180)) >> 16; 2557 / 180)) >> 16;
2558 LABEL_87: 2558 LABEL_87:
2559 while ( pPartyActionQueue->uNumActions ) 2559 while ( pPartyActionQueue->uNumActions )
2560 { 2560 {
2561 switch ( pPartyActionQueue->Next() ) 2561 switch ( pPartyActionQueue->Next() )
2732 { 2732 {
2733 v41 = &pPlayers[1]; 2733 v41 = &pPlayers[1];
2734 do 2734 do
2735 { 2735 {
2736 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) ) 2736 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) )
2737 (*v41)->PlayEmotion(46, 0); 2737 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_46, 0);
2738 ++v41; 2738 ++v41;
2739 } 2739 }
2740 while ( (signed int)v41 <= (signed int)&pPlayers[4] ); 2740 while ( (signed int)v41 <= (signed int)&pPlayers[4] );
2741 } 2741 }
2742 goto LABEL_93; 2742 goto LABEL_93;
2992 2992
2993 2993
2994 //----- (00473893) -------------------------------------------------------- 2994 //----- (00473893) --------------------------------------------------------
2995 void __cdecl ODM_ProcessPartyActions() 2995 void __cdecl ODM_ProcessPartyActions()
2996 { 2996 {
2997 int _zero; // esi@1 2997 //int _zero; // esi@1
2998 int v1; // edi@1 2998 int v1; // edi@1
2999 int v2; // ebx@1 2999 int v2; // ebx@1
3000 int v3; // eax@14 3000 int v3; // eax@14
3001 Player **v4; // esi@21 3001 Player **v4; // esi@21
3002 int v5; // eax@24 3002 int v5; // eax@24
3003 int v6; // esi@45 3003 int v6; // esi@45
3004 ODMFace *v7; // ecx@45 3004 ODMFace *v7; // ecx@45
3005 unsigned int v8; // eax@71 3005 //unsigned int v8; // eax@71
3006 double v9; // st7@72 3006 //double v9; // st7@72
3007 signed __int64 v10; // qax@74 3007 //signed __int64 v10; // qax@74
3008 double v11; // st7@75 3008 //double v11; // st7@75
3009 int v12; // ecx@77 3009 //int v12; // ecx@77
3010 int v13; // eax@84 3010 //int v13; // eax@84
3011 double v14; // st7@84 3011 //double v14; // st7@84
3012 int v15; // eax@87 3012 //int v15; // eax@87
3013 double v16; // st7@87 3013 //double v16; // st7@87
3014 int v17; // eax@88 3014 int v17; // eax@88
3015 double v18; // st7@88 3015 double v18; // st7@88
3016 int v19; // eax@89 3016 int v19; // eax@89
3017 double v20; // st7@89 3017 double v20; // st7@89
3018 int v21; // eax@92 3018 int v21; // eax@92
3090 int v93; // [sp-8h] [bp-9Ch]@104 3090 int v93; // [sp-8h] [bp-9Ch]@104
3091 unsigned int v94; // [sp-8h] [bp-9Ch]@246 3091 unsigned int v94; // [sp-8h] [bp-9Ch]@246
3092 int v95; // [sp-4h] [bp-98h]@104 3092 int v95; // [sp-4h] [bp-98h]@104
3093 int v96; // [sp-4h] [bp-98h]@246 3093 int v96; // [sp-4h] [bp-98h]@246
3094 int v97; // [sp+Ch] [bp-88h]@180 3094 int v97; // [sp+Ch] [bp-88h]@180
3095 int v98; // [sp+10h] [bp-84h]@147 3095 Vec3_int_ v98;
3096 int v99; // [sp+14h] [bp-80h]@147 3096 //int v98; // [sp+10h] [bp-84h]@147
3097 int v100; // [sp+18h] [bp-7Ch]@147 3097 //int v99; // [sp+14h] [bp-80h]@147
3098 //int v100; // [sp+18h] [bp-7Ch]@147
3098 bool v101; // [sp+1Ch] [bp-78h]@33 3099 bool v101; // [sp+1Ch] [bp-78h]@33
3099 int v102; // [sp+20h] [bp-74h]@1 3100 int v102; // [sp+20h] [bp-74h]@1
3100 int v103; // [sp+24h] [bp-70h]@1 3101 int v103; // [sp+24h] [bp-70h]@1
3101 int bFeatherFall; // [sp+28h] [bp-6Ch]@4 3102 int bFeatherFall; // [sp+28h] [bp-6Ch]@4
3102 int v105; // [sp+2Ch] [bp-68h]@24 3103 int v105; // [sp+2Ch] [bp-68h]@24
3111 unsigned int v114; // [sp+50h] [bp-44h]@1 3112 unsigned int v114; // [sp+50h] [bp-44h]@1
3112 int _walk_speed; // [sp+54h] [bp-40h]@48 3113 int _walk_speed; // [sp+54h] [bp-40h]@48
3113 int v116; // [sp+58h] [bp-3Ch]@1 3114 int v116; // [sp+58h] [bp-3Ch]@1
3114 int v117; // [sp+5Ch] [bp-38h]@1 3115 int v117; // [sp+5Ch] [bp-38h]@1
3115 int v118; // [sp+60h] [bp-34h]@1 3116 int v118; // [sp+60h] [bp-34h]@1
3116 Player **v119; // [sp+64h] [bp-30h]@4 3117 //Player **v119; // [sp+64h] [bp-30h]@4
3117 int _angle_x; // [sp+68h] [bp-2Ch]@48 3118 int _angle_x; // [sp+68h] [bp-2Ch]@48
3118 int v121; // [sp+6Ch] [bp-28h]@1 3119 int v121; // [sp+6Ch] [bp-28h]@1
3119 unsigned int v122; // [sp+70h] [bp-24h]@180 3120 unsigned int v122; // [sp+70h] [bp-24h]@180
3120 int v123; // [sp+74h] [bp-20h]@1 3121 int v123; // [sp+74h] [bp-20h]@1
3121 int v124; // [sp+78h] [bp-1Ch]@1 3122 int v124; // [sp+78h] [bp-1Ch]@1
3126 int v129; // [sp+8Ch] [bp-8h]@92 3127 int v129; // [sp+8Ch] [bp-8h]@92
3127 int v130; // [sp+90h] [bp-4h]@14 3128 int v130; // [sp+90h] [bp-4h]@14
3128 3129
3129 v121 = pParty->uFallSpeed; 3130 v121 = pParty->uFallSpeed;
3130 v123 = pParty->vPosition.z; 3131 v123 = pParty->vPosition.z;
3131 _zero = 0;
3132 v1 = 0; 3132 v1 = 0;
3133 v103 = 0; 3133 v103 = 0;
3134 v2 = 0; 3134 v2 = 0;
3135 *(float *)&v128 = 0.0; 3135 *(float *)&v128 = 0.0;
3136 v116 = pParty->vPosition.x; 3136 v116 = pParty->vPosition.x;
3137 v117 = pParty->vPosition.y; 3137 v117 = pParty->vPosition.y;
3138 v113 = pParty->field_6F0; 3138 v113 = pParty->field_6F0;
3139 bJumping = 0; 3139 bJumping = 0;
3140 v118 = GetTerrainHeightsAroundParty(pParty->vPosition.x, pParty->vPosition.y); 3140 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
3141 v114 = 0; 3141 v114 = 0;
3142 v124 = 0; 3142 v124 = 0;
3143 v108 = 0; 3143 v108 = 0;
3144 v102 = 0; 3144 v102 = 0;
3145 v127 = 0; 3145 v127 = 0;
3146 bWaterWalk = 0; 3146 bWaterWalk = 0;
3147 if ( SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 3147 if (!pParty->FeatherFallActive())
3148 || SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 ) 3148 //SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0
3149 //|| SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 )
3149 { 3150 {
3150 bFeatherFall = 0; 3151 bFeatherFall = 0;
3151 v119 = &pPlayers[1]; 3152 /*v119 = &pPlayers[1];
3152 while ( !(*v119)->WearsItem(536, 16) ) 3153 while ( !(*v119)->WearsItem(536, 16) )
3153 { 3154 {
3154 ++v119; 3155 ++v119;
3155 if ( (signed int)v119 > (signed int)&pPlayers[4] ) 3156 if ( (signed int)v119 > (signed int)&pPlayers[4] )
3156 goto LABEL_9; 3157 goto LABEL_9;
3157 } 3158 }*/
3158 } 3159 for (int i = 0; i < 4; ++i)
3159 bFeatherFall = 1; 3160 if (pParty->pPlayers[i].WearsItem(536, 16)) // seems like flying boots
3160 LABEL_9: 3161 {
3161 if ( (signed __int64)pParty->pPartyBuffs[18].uExpireTime <= 0 ) 3162 bFeatherFall = 1;
3162 { 3163 break;
3163 LOBYTE(pParty->uFlags) &= 0x7Fu; 3164 }
3164 } 3165 }
3165 else 3166 // bFeatherFall = 1;
3166 { 3167 //LABEL_9:
3167 LOBYTE(pParty->uFlags) &= 0x7Fu; 3168 LOBYTE(pParty->uFlags) &= 0x7Fu;
3169 if (pParty->WaterWalkActive())
3170 {
3171 //LOBYTE(pParty->uFlags) &= 0x7Fu;
3168 bWaterWalk = 1; 3172 bWaterWalk = 1;
3169 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u; 3173 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
3170 if ( !(pParty->pPartyBuffs[18].uFlags & 1) 3174 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
3171 && pParty->pPlayers[pParty->pPartyBuffs[18].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 ) 3175 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
3172 bWaterWalk = 0; 3176 bWaterWalk = 0;
3173 } 3177 }
3174 v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk); 3178 v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
3175 v111 = v3; 3179 v111 = v3;
3176 if ( bFeatherFall ) 3180 if ( bFeatherFall )
3199 (*v4)->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 3203 (*v4)->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3200 } 3204 }
3201 ++v4; 3205 ++v4;
3202 } 3206 }
3203 while ( (signed int)v4 <= (signed int)&pPlayers[4] ); 3207 while ( (signed int)v4 <= (signed int)&pPlayers[4] );
3204 _zero = 0;
3205 } 3208 }
3206 } 3209 }
3207 v109 = -1; 3210 v109 = -1;
3208 if ( pParty->bFlying != _zero ) 3211 if ( pParty->bFlying )
3209 v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102); 3212 v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102);
3210 v107 = v108 == _zero; 3213 v107 = v108 == 0;
3211 v105 = v111 + 1; 3214 v105 = v111 + 1;
3212 if ( v123 <= v111 + 1 ) 3215 if ( v123 <= v111 + 1 )
3213 { 3216 {
3214 v109 = -1; 3217 v109 = -1;
3215 pParty->bFlying = _zero; 3218 pParty->bFlying = false;
3216 } 3219 }
3217 else 3220 else
3218 { 3221 {
3219 bJumping = 1; 3222 bJumping = 1;
3220 } 3223 }
3221 v101 = v123 - v111 <= 32; 3224 v101 = v123 - v111 <= 32;
3222 if ( bWalkSound != _zero && pParty->field_6F8 > _zero ) 3225 if ( bWalkSound && pParty->field_6F8 > 0 )
3223 pParty->field_6F8 -= pEventTimer->uTimeElapsed; 3226 pParty->field_6F8 -= pEventTimer->uTimeElapsed;
3224 if ( !bUnderwater 3227 if ( !bUnderwater
3225 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= _zero 3228 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0
3226 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < _zero || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= _zero) ) 3229 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) )
3227 pParty->bFlying = _zero; 3230 pParty->bFlying = false;
3228 if ( bJumping == _zero ) 3231 if (!bJumping)
3229 { 3232 {
3230 if ( pParty->field_6F4_packedid != (8 * v108 | OBJECT_BModel) ) 3233 if ( pParty->field_6F4_packedid != (8 * v108 | OBJECT_BModel) )
3231 { 3234 {
3232 if ( v108 != _zero ) 3235 if (v108)
3233 { 3236 {
3234 if ( v108 >> 6 < pOutdoor->uNumBModels ) 3237 if ( v108 >> 6 < pOutdoor->uNumBModels )
3235 { 3238 {
3236 v7 = pOutdoor->pBModels[v108 >> 6].pFaces; 3239 v7 = pOutdoor->pBModels[v108 >> 6].pFaces;
3237 v6 = v108 & 0x3F; 3240 v6 = v108 & 0x3F;
3252 } 3255 }
3253 _walk_speed = pParty->uWalkSpeed; 3256 _walk_speed = pParty->uWalkSpeed;
3254 _angle_y = pParty->sRotationY; 3257 _angle_y = pParty->sRotationY;
3255 _angle_x = pParty->sRotationX; 3258 _angle_x = pParty->sRotationX;
3256 v126 = pEventTimer->dt_in_some_format; 3259 v126 = pEventTimer->dt_in_some_format;
3257 v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format 3260 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
3258 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed 3261 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed
3259 * stru_5C6E00->uIntegerPi) 3262 * stru_5C6E00->uIntegerPi)
3260 / 180)) >> 16); 3263 / 180)) >> 16);*/
3264 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16;
3261 LABEL_118: 3265 LABEL_118:
3262 while ( pPartyActionQueue->uNumActions ) 3266 while ( pPartyActionQueue->uNumActions )
3263 { 3267 {
3264 switch ( pPartyActionQueue->Next() ) 3268 switch ( pPartyActionQueue->Next() )
3265 { 3269 {
3266 case PARTY_FlyUp: 3270 case PARTY_FlyUp:
3267 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) 3271 {
3268 { 3272 if (!pParty->FlyActive() && !bUnderwater)
3269 pParty->bFlying = 0; 3273 break;
3270 if ( bUnderwater 3274
3271 || pParty->pPartyBuffs[7].uFlags & 1 3275 pParty->bFlying = false;
3272 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) 3276 if (bUnderwater ||
3277 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
3278 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana <= 0 )
3273 { 3279 {
3274 if ( pParty->vPosition.z < 4000 || bJumping ) 3280 if ( pParty->vPosition.z < 4000 || bJumping )
3275 { 3281 {
3276 v123 += 30; 3282 v123 += 30;
3277 v113 += 30; 3283 v113 += 30;
3299 } 3305 }
3300 pParty->uFallSpeed = 0; 3306 pParty->uFallSpeed = 0;
3301 v127 = (BSPModel *)1; 3307 v127 = (BSPModel *)1;
3302 } 3308 }
3303 } 3309 }
3304 } 3310 }
3305 goto LABEL_118; 3311 break;
3312
3306 case PARTY_FlyDown: 3313 case PARTY_FlyDown:
3307 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) 3314 if (pParty->FlyActive() || bUnderwater)
3308 { 3315 {
3309 pParty->bFlying = 0; 3316 pParty->bFlying = 0;
3310 if ( bUnderwater 3317 if ( bUnderwater
3311 || pParty->pPartyBuffs[7].uFlags & 1 3318 || pParty->pPartyBuffs[7].uFlags & 1
3312 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) 3319 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
3322 pParty->bFlying = 0; 3329 pParty->bFlying = 0;
3323 pPartyActionQueue->uNumActions = 0; 3330 pPartyActionQueue->uNumActions = 0;
3324 } 3331 }
3325 } 3332 }
3326 } 3333 }
3327 goto LABEL_118; 3334 break;
3335
3328 case PARTY_TurnLeft: 3336 case PARTY_TurnLeft:
3329 v8 = uTurnSpeed; 3337 if (uTurnSpeed)
3330 if ( uTurnSpeed ) 3338 _angle_y += uTurnSpeed; //descrete turn
3331 goto LABEL_80; 3339 else
3332 v9 = (double)(signed int)v119 * fTurnSpeedMultiplier; 3340 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn
3333 goto LABEL_73; 3341
3342 _angle_y &= stru_5C6E00->uDoublePiMask;
3343 break;
3344
3334 case PARTY_TurnRight: 3345 case PARTY_TurnRight:
3335 LODWORD(v10) = uTurnSpeed; 3346 if (uTurnSpeed)
3336 if ( uTurnSpeed ) 3347 _angle_y -= uTurnSpeed;
3337 goto LABEL_77; 3348 else
3338 v11 = (double)(signed int)v119 * fTurnSpeedMultiplier; 3349 _angle_y -= dturn * fTurnSpeedMultiplier;
3339 goto LABEL_76; 3350
3351 _angle_y &= stru_5C6E00->uDoublePiMask;
3352 break;
3353
3340 case PARTY_FastTurnLeft: 3354 case PARTY_FastTurnLeft:
3341 v8 = uTurnSpeed; 3355 if (uTurnSpeed)
3342 if ( uTurnSpeed ) 3356 _angle_y += uTurnSpeed;
3343 {
3344 LABEL_80:
3345 v12 = v8 + _angle_y;
3346 LABEL_78:
3347 _angle_y = stru_5C6E00->uDoublePiMask & v12;
3348 }
3349 else 3357 else
3350 { 3358 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn;
3351 v9 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)(signed int)v119; 3359
3352 LABEL_73: 3360 _angle_y &= stru_5C6E00->uDoublePiMask;
3353 _angle_y = stru_5C6E00->uDoublePiMask & (_angle_y + (unsigned __int64)(signed __int64)v9); 3361 break;
3354 } 3362
3355 goto LABEL_118;
3356 case PARTY_FastTurnRight: 3363 case PARTY_FastTurnRight:
3357 LODWORD(v10) = uTurnSpeed; 3364 if (!uTurnSpeed)
3358 if ( !uTurnSpeed ) 3365 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
3359 { 3366 else
3360 v11 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)(signed int)v119; 3367 _angle_y -= uTurnSpeed;
3361 LABEL_76: 3368
3362 v10 = (signed __int64)v11; 3369 _angle_y &= stru_5C6E00->uDoublePiMask;
3363 } 3370 break;
3364 LABEL_77: 3371
3365 v12 = _angle_y - v10;
3366 goto LABEL_78;
3367 case PARTY_StrafeLeft: 3372 case PARTY_StrafeLeft:
3368 v13 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3373 {
3369 v14 = (double)_walk_speed; 3374 //v13 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3370 v126 = v13; 3375 //v14 = (double)_walk_speed;
3371 *(float *)&v128 = v14; 3376 *(float *)&v128 = pParty->uWalkSpeed;
3372 v124 = (unsigned __int64)(v13 * (signed __int64)((signed int)(signed __int64)(v14 * fWalkSpeedMultiplier) >> 1)) >> 16; 3377
3373 v2 -= v124; 3378 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
3374 v126 = stru_5C6E00->SinCos(_angle_y); 3379 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3375 v124 = (unsigned __int64)(v126 3380 v2 -= 3 * dx / 4;
3376 * (signed __int64)((signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier) >> 1)) >> 16; 3381
3377 goto LABEL_85; 3382 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3383 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3384 v1 += 3 * dy / 4;
3385
3386 v128 = v1;
3387 v124 = 1;
3388 }
3389 break;
3390
3378 case PARTY_StrafeRight: 3391 case PARTY_StrafeRight:
3379 v15 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3392 {
3380 v16 = (double)_walk_speed; 3393 //v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3381 v126 = v15; 3394 *(float *)&v128 = pParty->uWalkSpeed;
3382 *(float *)&v128 = v16; 3395 /*v124 = (unsigned __int64)(v126 * (signed __int64)((signed int)(signed __int64)(pParty->uWalkSpeed * fWalkSpeedMultiplier) >> 1)) >> 16;
3383 v124 = (unsigned __int64)(v15 * (signed __int64)((signed int)(signed __int64)(v16 * fWalkSpeedMultiplier) >> 1)) >> 16;
3384 v2 += v124; 3396 v2 += v124;
3385 v126 = stru_5C6E00->SinCos(_angle_y); 3397 v126 = stru_5C6E00->SinCos(_angle_y);
3386 v124 = (unsigned __int64)(v126 3398 v124 = (unsigned __int64)(v126
3387 * (signed __int64)((signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier) >> 1)) >> 16; 3399 * (signed __int64)((signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier) >> 1)) >> 16;
3388 goto LABEL_90; 3400 v1 -= v124;*/
3401 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
3402 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3403 v2 += 3 * dx / 4;
3404
3405 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3406 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3407 v1 -= 3 * dy / 4;
3408
3409 v128 = v1;
3410 v124 = 1;
3411 }
3412 break;
3413
3389 case PARTY_WalkForward: 3414 case PARTY_WalkForward:
3390 v17 = stru_5C6E00->SinCos(_angle_y); 3415 v17 = stru_5C6E00->SinCos(_angle_y);
3391 v18 = (double)_walk_speed; 3416 v18 = (double)_walk_speed;
3392 v126 = v17; 3417 v126 = v17;
3393 *(float *)&v128 = v18; 3418 *(float *)&v128 = v18;
3394 v124 = (unsigned __int64)(v17 * (signed __int64)(signed int)(signed __int64)(v18 * fWalkSpeedMultiplier)) >> 16; 3419 v124 = (unsigned __int64)(v17 * (signed __int64)(signed int)(signed __int64)(v18 * fWalkSpeedMultiplier)) >> 16;
3395 v2 += v124; 3420 v2 += v124;
3396 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3421 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3397 v124 = (unsigned __int64)(v126 3422 v124 = (unsigned __int64)(v126
3398 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16; 3423 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16;
3399 LABEL_85:
3400 v1 += v124; 3424 v1 += v124;
3401 goto LABEL_86; 3425 v128 = v1;
3426 v124 = 1;
3427 break;
3428
3402 case PARTY_WalkBackward: 3429 case PARTY_WalkBackward:
3403 v19 = stru_5C6E00->SinCos(_angle_y); 3430 v19 = stru_5C6E00->SinCos(_angle_y);
3404 v20 = (double)_walk_speed; 3431 v20 = (double)_walk_speed;
3405 v126 = v19; 3432 v126 = v19;
3406 *(float *)&v128 = v20; 3433 *(float *)&v128 = v20;
3409 v2 -= v124; 3436 v2 -= v124;
3410 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3437 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3411 v124 = (unsigned __int64)(v126 3438 v124 = (unsigned __int64)(v126
3412 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 3439 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
3413 * fBackwardWalkSpeedMultiplier)) >> 16; 3440 * fBackwardWalkSpeedMultiplier)) >> 16;
3414 LABEL_90:
3415 v1 -= v124; 3441 v1 -= v124;
3416 goto LABEL_86; 3442 v128 = v1;
3443 v124 = 1;
3444 break;
3445
3417 case PARTY_RunForward: 3446 case PARTY_RunForward:
3418 if ( pParty->bFlying ) 3447 if ( pParty->bFlying )
3419 { 3448 {
3420 v21 = stru_5C6E00->SinCos(_angle_y); 3449 v21 = stru_5C6E00->SinCos(_angle_y);
3421 v22 = (double)_walk_speed; 3450 v22 = (double)_walk_speed;
3432 * (unsigned __int64)(signed __int64)(*(float *)&v128 3461 * (unsigned __int64)(signed __int64)(*(float *)&v128
3433 * fWalkSpeedMultiplier))) >> 16; 3462 * fWalkSpeedMultiplier))) >> 16;
3434 v1 += v129; 3463 v1 += v129;
3435 goto LABEL_93; 3464 goto LABEL_93;
3436 } 3465 }
3437 if ( v118 && !v108 ) 3466 if ( partyAtHighSlope && !v108 )
3438 { 3467 {
3439 v23 = stru_5C6E00->SinCos(_angle_y); 3468 v23 = stru_5C6E00->SinCos(_angle_y);
3440 v24 = (double)_walk_speed; 3469 v24 = (double)_walk_speed;
3441 v126 = v23; 3470 v126 = v23;
3442 *(float *)&v128 = v24; 3471 *(float *)&v128 = v24;
3444 v2 += v129; 3473 v2 += v129;
3445 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3474 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3446 v129 = (unsigned __int64)(v126 3475 v129 = (unsigned __int64)(v126
3447 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16; 3476 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16;
3448 v1 += v129; 3477 v1 += v129;
3449 goto LABEL_86; 3478 v128 = v1;
3479 v124 = 1;
3480 break;
3450 } 3481 }
3451 v25 = stru_5C6E00->SinCos(_angle_y); 3482 v25 = stru_5C6E00->SinCos(_angle_y);
3452 v26 = (double)_walk_speed; 3483 v26 = (double)_walk_speed;
3453 v114 = v25; 3484 v114 = v25;
3454 *(float *)&v128 = v26; 3485 *(float *)&v128 = v26;
3464 * fWalkSpeedMultiplier))) >> 16; 3495 * fWalkSpeedMultiplier))) >> 16;
3465 v1 += v129; 3496 v1 += v129;
3466 v114 = 1; 3497 v114 = 1;
3467 v128 = v1; 3498 v128 = v1;
3468 break; 3499 break;
3500
3469 case PARTY_RunBackward: 3501 case PARTY_RunBackward:
3470 v27 = stru_5C6E00->SinCos(_angle_y); 3502 v27 = stru_5C6E00->SinCos(_angle_y);
3471 v28 = (double)_walk_speed; 3503 v28 = (double)_walk_speed;
3472 v126 = v27; 3504 v126 = v27;
3473 *(float *)&v128 = v28; 3505 *(float *)&v128 = v28;
3492 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3524 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3493 v129 = (unsigned __int64)(v126 3525 v129 = (unsigned __int64)(v126
3494 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 3526 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
3495 * fBackwardWalkSpeedMultiplier)) >> 16; 3527 * fBackwardWalkSpeedMultiplier)) >> 16;
3496 v1 -= v129; 3528 v1 -= v129;
3497 LABEL_86: 3529 //LABEL_86:
3498 v128 = v1; 3530 v128 = v1;
3499 v124 = 1; 3531 v124 = 1;
3500 } 3532 }
3501 break; 3533 break;
3502 case PARTY_LookUp: 3534 case PARTY_LookUp:
3524 goto LABEL_118; 3556 goto LABEL_118;
3525 case PARTY_CenterView: 3557 case PARTY_CenterView:
3526 _angle_x = 0; 3558 _angle_x = 0;
3527 goto LABEL_118; 3559 goto LABEL_118;
3528 case PARTY_Jump: 3560 case PARTY_Jump:
3529 if ( (!v118 || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) 3561 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
3530 { 3562 {
3531 v126 = pParty->field_24 << 6; 3563 v126 = pParty->field_24 << 6;
3532 bJumping = 1; 3564 bJumping = 1;
3533 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121); 3565 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121);
3534 } 3566 }
3585 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); 3617 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
3586 v34 = v121 + 2 * v33; 3618 v34 = v121 + 2 * v33;
3587 v121 += 2 * v33; 3619 v121 += 2 * v33;
3588 goto LABEL_149; 3620 goto LABEL_149;
3589 } 3621 }
3590 if ( !v118 ) 3622 if ( !partyAtHighSlope )
3591 { 3623 {
3592 v34 = v121; 3624 v34 = v121;
3593 LABEL_149: 3625 LABEL_149:
3594 if ( bJumping == v32 ) 3626 if ( bJumping == v32 )
3595 goto LABEL_150; 3627 goto LABEL_150;
3597 } 3629 }
3598 if ( !bJumping ) 3630 if ( !bJumping )
3599 { 3631 {
3600 if ( v108 ) 3632 if ( v108 )
3601 goto LABEL_150; 3633 goto LABEL_150;
3634
3635 // rolling down the hill
3636 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
3637 // and falling to the gravity, gradually sliding downwards. nice trick
3602 v123 = v111; 3638 v123 = v111;
3603 _46DCC8_get_gravity_direction_outdoor(v116, v117, (Vec3_int_ *)&v98); 3639 ODM_GetTerrainNormalAt(v116, v117, &v98);
3604 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); 3640 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
3605 v129 = abs((signed __int64)v2 * (signed __int64)v98 + (signed __int64)v1 * (signed __int64)v99 + (signed __int64)v35 * (signed __int64)v100) >> 16; 3641 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
3606 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98) >> 16); 3642 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.x) >> 16);
3607 v2 += (int)v127; 3643 v2 += (int)v127;
3608 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v99) >> 16); 3644 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.y) >> 16);
3609 v1 += (int)v127; 3645 v1 += (int)v127;
3610 v128 = v1; 3646 v128 = v1;
3611 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v100) >> 16); 3647 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
3612 v34 = (int)((char *)v127 + v35); 3648 v34 = (int)((char *)v127 + v35);
3613 v32 = 0; 3649 v32 = 0;
3614 v121 = v34; 3650 v121 = v34;
3615 goto LABEL_149; 3651 goto LABEL_149;
3616 } 3652 }
3636 goto LABEL_151; 3672 goto LABEL_151;
3637 } 3673 }
3638 LABEL_150: 3674 LABEL_150:
3639 pParty->uFallStartY = v123; 3675 pParty->uFallStartY = v123;
3640 LABEL_151: 3676 LABEL_151:
3641 if ( v2 * v2 + v1 * v1 < 400 && !v118 ) 3677 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
3642 { 3678 {
3643 *(float *)&v128 = 0.0; 3679 *(float *)&v128 = 0.0;
3644 v2 = 0; 3680 v2 = 0;
3645 } 3681 }
3646 stru_721530.field_84 = -1; 3682 stru_721530.field_84 = -1;
3688 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + v123; 3724 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + v123;
3689 } 3725 }
3690 v122 = v40; 3726 v122 = v40;
3691 sub_46D49E_prolly_get_world_y_under_party(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); 3727 sub_46D49E_prolly_get_world_y_under_party(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
3692 v129 = sub_46D49E_prolly_get_world_y_under_party(_angle_x, v117, v40, pParty->uPartyHeight, &v130, &v97, 0); 3728 v129 = sub_46D49E_prolly_get_world_y_under_party(_angle_x, v117, v40, pParty->uPartyHeight, &v130, &v97, 0);
3693 v119 = (Player **)sub_46D49E_prolly_get_world_y_under_party( 3729 auto v119 = sub_46D49E_prolly_get_world_y_under_party(
3694 v116, 3730 v116,
3695 _angle_y, 3731 _angle_y,
3696 v40, 3732 v40,
3697 pParty->uPartyHeight, 3733 pParty->uPartyHeight,
3698 &v130, 3734 &v130,
3699 &v110, 3735 &v110,
3700 0); 3736 0);
3701 v127 = (BSPModel *)GetTerrainHeightsAroundParty(_angle_x, v117); 3737 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, v117);
3702 v42 = GetTerrainHeightsAroundParty(v116, _angle_y); 3738 v42 = IsTerrainSlopeTooHigh(v116, _angle_y);
3703 v107 = 0; 3739 v107 = 0;
3704 v118 = v42; 3740 v118 = v42;
3705 if ( !v97 && !v110 && !v108 ) 3741 if ( !v97 && !v110 && !v108 )
3706 v107 = 1; 3742 v107 = 1;
3707 v43 = 1; 3743 v43 = 1;
3708 v44 = 1; 3744 v44 = 1;
3709 if ( bUnderwater || !v107 ) 3745 if ( bUnderwater || !v107 )
3710 goto LABEL_197; 3746 goto LABEL_197;
3711 if ( v127 && v129 > v123 ) 3747 if ( v127 && v129 > v123 )
3712 v44 = 0; 3748 v44 = 0;
3713 if ( v118 && (signed int)v119 > v123 ) 3749 if ( v118 && v119 > v123 )
3714 v43 = 0; 3750 v43 = 0;
3715 if ( v44 ) 3751 if ( v44 )
3716 goto LABEL_197; 3752 goto LABEL_197;
3717 if ( v43 ) 3753 if ( v43 )
3718 goto LABEL_198; 3754 goto LABEL_198;
3722 v40, 3758 v40,
3723 pParty->uPartyHeight, 3759 pParty->uPartyHeight,
3724 &v130, 3760 &v130,
3725 &v108, 3761 &v108,
3726 0); 3762 0);
3727 if ( GetTerrainHeightsAroundParty(_angle_x, _angle_y) && (signed int)v127 <= v123 ) 3763 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= v123 )
3728 { 3764 {
3729 v43 = 1; 3765 v43 = 1;
3730 LABEL_197: 3766 LABEL_197:
3731 v116 = _angle_x; 3767 v116 = _angle_x;
3732 if ( !v43 ) 3768 if ( !v43 )
3789 v51 = __OFSUB__(v48, 32); 3825 v51 = __OFSUB__(v48, 32);
3790 v49 = v48 == 32; 3826 v49 = v48 == 32;
3791 v50 = v48 - 32 < 0; 3827 v50 = v48 - 32 < 0;
3792 v52 = v47->pFacePlane.vNormal.z; 3828 v52 = v47->pFacePlane.vNormal.z;
3793 v129 = (unsigned __int8)(v50 ^ v51 | v49); 3829 v129 = (unsigned __int8)(v50 ^ v51 | v49);
3794 v119 = (Player **)(v52 < 46378); 3830 v119 = v52 < 46378;
3795 if ( bUnderwater == 1 ) 3831 if ( bUnderwater == 1 )
3796 v119 = 0; 3832 v119 = 0;
3797 v53 = v47->uPolygonType; 3833 v53 = v47->uPolygonType;
3798 if ( v53 == 3 ) 3834 if ( v53 == 3 )
3799 { 3835 {
9410 } 9446 }
9411 9447
9412 9448
9413 9449
9414 //----- (004823F4) -------------------------------------------------------- 9450 //----- (004823F4) --------------------------------------------------------
9415 bool __fastcall GetTerrainHeightsAroundParty(int a1, int a2) 9451 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
9416 { 9452 {
9417 unsigned int v2; // ebx@1 9453 //unsigned int v2; // ebx@1
9418 unsigned int v3; // edi@1 9454 //unsigned int v3; // edi@1
9419 int v4; // eax@1 9455 //int v4; // eax@1
9420 int v6; // esi@5 9456 //int v6; // esi@5
9421 int v7; // ecx@6 9457 //int v7; // ecx@6
9422 int v8; // edx@6 9458 //int v8; // edx@6
9423 int v9; // eax@6 9459 //int v9; // eax@6
9424 int v10; // esi@10 9460 //int v10; // esi@10
9425 int v11; // [sp+14h] [bp-8h]@1 9461 //int v11; // [sp+14h] [bp-8h]@1
9426 int v12; // [sp+18h] [bp-4h]@1 9462 //int v12; // [sp+18h] [bp-4h]@1
9427 9463
9428 v12 = a1; 9464 //v12 = a1;
9429 v11 = a2; 9465 //v11 = a2;
9430 v2 = WorldPosToGridCellX(a1); 9466 auto grid_x = WorldPosToGridCellX(pos_x);
9431 v3 = WorldPosToGridCellZ(v11) - 1; 9467 auto grid_z = WorldPosToGridCellZ(pos_z) - 1;
9432 dword_76D568_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2); 9468
9433 dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2 + 1); 9469 auto party_grid_x1 = GridCellToWorldPosX(grid_x);
9434 dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2 + 1); 9470 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
9435 dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2); 9471 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
9436 dword_76D558_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3); 9472 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x);
9437 dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3); 9473 auto party_grid_z1 = GridCellToWorldPosZ(grid_z);
9438 dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3 + 1); 9474 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z);
9439 dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3 + 1); 9475 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
9440 dword_76D548_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v2, v3); 9476 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
9441 dword_76D54C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v2 + 1, v3); 9477 auto party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
9442 dword_76D550_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v2 + 1, v3 + 1); 9478 auto party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
9443 v4 = pOutdoor->DoGetHeightOnTerrain(v2, v3 + 1); 9479 auto party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
9444 dword_76D554_terrain_cell_world_pos_around_party_y = v4; 9480 auto party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
9445 if ( dword_76D548_terrain_cell_world_pos_around_party_y == dword_76D54C_terrain_cell_world_pos_around_party_y 9481 //dword_76D554_terrain_cell_world_pos_around_party_y = v4;
9446 && dword_76D54C_terrain_cell_world_pos_around_party_y == dword_76D550_terrain_cell_world_pos_around_party_y 9482 if (party_x1z1_y == party_x2z1_y &&
9447 && dword_76D550_terrain_cell_world_pos_around_party_y == v4 ) 9483 party_x2z1_y == party_x2z2_y &&
9448 return 0; 9484 party_x2z2_y == party_x1z2_y )
9449 v6 = abs(v12 - dword_76D568_terrain_cell_world_pos_around_party_x); 9485 return false;
9450 if ( abs(dword_76D558_terrain_cell_world_pos_around_party_z - v11) >= v6 ) 9486
9451 { 9487 auto dx = abs(pos_x - party_grid_x1),
9452 v7 = dword_76D554_terrain_cell_world_pos_around_party_y; 9488 dz = abs(party_grid_z1 - pos_z);
9453 v8 = dword_76D550_terrain_cell_world_pos_around_party_y; 9489
9454 v9 = dword_76D548_terrain_cell_world_pos_around_party_y; 9490 int y1, y2, y3;
9491 if (dz >= dx)
9492 {
9493 y1 = party_x1z2_y; // lower-left triangle
9494 y2 = party_x2z2_y; // y3 | \
9495 y3 = party_x1z1_y; // | \
9496 /* | \
9497 |______ \
9498 y1 y2 */
9455 } 9499 }
9456 else 9500 else
9457 { 9501 {
9458 v7 = dword_76D54C_terrain_cell_world_pos_around_party_y; 9502 y1 = party_x2z1_y; // upper-right
9459 v8 = dword_76D548_terrain_cell_world_pos_around_party_y; 9503 y2 = party_x1z1_y; // y2_______ y1
9460 v9 = dword_76D550_terrain_cell_world_pos_around_party_y; 9504 y3 = party_x2z2_y; // \ |
9461 } 9505 /* \ |
9462 if ( v7 >= v8 ) 9506 \ |
9463 { 9507 y3 */
9464 v10 = v8; 9508 }
9465 if ( v8 < v9 ) 9509
9510 int y_min = min(y1, min(y2, y3)),
9511 y_max = max(y1, max(y2, y3));
9512 return y_max - y_min > 512;
9513
9514 /*if ( y1 >= y2 )
9515 {
9516 y_min = y2;
9517 if ( y2 < y3 )
9466 goto LABEL_13; 9518 goto LABEL_13;
9467 LABEL_12: 9519 LABEL_12:
9468 v10 = v9; 9520 y_min = y3;
9469 goto LABEL_13; 9521 goto LABEL_13;
9470 } 9522 }
9471 if ( v7 >= v9 ) 9523 else if ( y1 >= y3 )
9472 goto LABEL_12; 9524 goto LABEL_12;
9473 v10 = v7; 9525 else
9526 y_min = y1;
9527
9474 LABEL_13: 9528 LABEL_13:
9475 if ( v7 <= v8 ) 9529 if ( y1 <= y2 )
9476 { 9530 {
9477 if ( v8 > v9 ) 9531 if ( y2 > y3 )
9478 v9 = v8; 9532 y3 = y2;
9479 } 9533 }
9480 else 9534 else
9481 { 9535 {
9482 if ( v7 > v9 ) 9536 if ( y1 > y3 )
9483 v9 = v7; 9537 y3 = y1;
9484 } 9538 }
9485 return v9 - v10 > 512; 9539 return y3 - v10 > 512;*/
9486 } 9540 }
9487 9541
9488 9542
9489 //----- (0048257A) -------------------------------------------------------- 9543 //----- (0048257A) --------------------------------------------------------
9490 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4) 9544 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4)
16283 goto LABEL_63; 16337 goto LABEL_63;
16284 } 16338 }
16285 v20 = v19 - 1; 16339 v20 = v19 - 1;
16286 if ( !v20 ) 16340 if ( !v20 )
16287 { 16341 {
16288 v23 = v0->evtb; 16342 v23 = v0->_anim_current_time;
16289 goto LABEL_63; 16343 goto LABEL_63;
16290 } 16344 }
16291 v21 = v20 - 1; 16345 v21 = v20 - 1;
16292 if ( !v21 ) 16346 if ( !v21 )
16293 { 16347 {
16294 v23 = v0->evtc; 16348 v23 = v0->_anim_end_time;
16295 goto LABEL_63; 16349 goto LABEL_63;
16296 } 16350 }
16297 v22 = v21 - 1; 16351 v22 = v21 - 1;
16298 if ( !v22 ) 16352 if ( !v22 )
16299 { 16353 {
17207 v33->evtd = v30; 17261 v33->evtd = v30;
17208 } 17262 }
17209 } 17263 }
17210 else 17264 else
17211 { 17265 {
17212 v33->evtc = v30; 17266 v33->_anim_end_time = v30;
17213 } 17267 }
17214 } 17268 }
17215 else 17269 else
17216 { 17270 {
17217 v33->evtb = v30; 17271 v33->_anim_current_time = v30;
17218 } 17272 }
17219 } 17273 }
17220 else 17274 else
17221 { 17275 {
17222 v33->bDrawSomeAnim = v30; 17276 v33->bDrawSomeAnim = v30;
17364 v113 = _evt->v6; 17418 v113 = _evt->v6;
17365 v53 = rand() % 4; 17419 v53 = rand() % 4;
17366 LABEL_108: 17420 LABEL_108:
17367 v52 = &pParty->pPlayers[v53]; 17421 v52 = &pParty->pPlayers[v53];
17368 LABEL_109: 17422 LABEL_109:
17369 v52->PlayEmotion(v113, v117); 17423 v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117);
17370 goto LABEL_291; 17424 goto LABEL_291;
17371 } 17425 }
17372 v51 = pParty->pPlayers; 17426 v51 = pParty->pPlayers;
17373 do 17427 do
17374 { 17428 {
17375 v51->PlayEmotion(_evt->v6, 0); 17429 v51->PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
17376 ++v51; 17430 ++v51;
17377 } 17431 }
17378 while ( (signed int)v51 < (signed int)pParty->pHirelings ); 17432 while ( (signed int)v51 < (signed int)pParty->pHirelings );
17379 LABEL_291: 17433 LABEL_291:
17380 ++v122; 17434 ++v122;
19419 19473
19420 19474
19421 //----- (0044A56A) -------------------------------------------------------- 19475 //----- (0044A56A) --------------------------------------------------------
19422 void __cdecl sub_44A56A() 19476 void __cdecl sub_44A56A()
19423 { 19477 {
19424 signed int v0; // edi@1
19425 NPCData *v1; // esi@2
19426
19427 pParty->field_70A = 0; 19478 pParty->field_70A = 0;
19428 v0 = 0; 19479
19429 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) 19480 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
19430 { 19481 {
19431 v1 = pNPCStats->pNewNPCData; 19482 auto npc = pNPCStats->pNewNPCData + i;
19432 do 19483 if (npc->uFlags & 0x80 &&
19433 { 19484 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)))
19434 if ( v1->uFlags & 0x80 && (!pParty->pHirelings[0].pName || strcmp(v1->pName, pParty->pHirelings[0].pName)) ) 19485 {
19435 { 19486 if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName))
19436 if ( !pParty->pHirelings[1].pName || strcmp(v1->pName, pParty->pHirelings[1].pName) ) 19487 ++pParty->field_70A;
19437 ++pParty->field_70A; 19488 }
19438 }
19439 ++v0;
19440 ++v1;
19441 }
19442 while ( v0 < (signed int)pNPCStats->uNumNewNPCs );
19443 } 19489 }
19444 } 19490 }
19445 19491
19446 19492
19447 //----- (0044C175) -------------------------------------------------------- 19493 //----- (0044C175) --------------------------------------------------------