comparison mm7_3.cpp @ 157:8e0e2991f9d1

Слияние
author Ritor1
date Tue, 12 Feb 2013 18:16:34 +0600
parents c49af6426e37 86a2637ba125
children 933e2655c33d a0e7ad5425d4
comparison
equal deleted inserted replaced
156:2cb13d295f4b 157:8e0e2991f9d1
957 unsigned int v58; // edi@107 957 unsigned int v58; // edi@107
958 unsigned int v59; // ebx@107 958 unsigned int v59; // ebx@107
959 signed int v60; // eax@107 959 signed int v60; // eax@107
960 int v61; // eax@124 960 int v61; // eax@124
961 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42 961 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42
962 char v63; // [sp+18h] [bp-38h]@64 962 int v63; // [sp+18h] [bp-38h]@64
963 int v64; // [sp+1Ch] [bp-34h]@64 963 int v64; // [sp+1Ch] [bp-34h]@64
964 int v65; // [sp+20h] [bp-30h]@2 964 int v65; // [sp+20h] [bp-30h]@2
965 int v66; // [sp+24h] [bp-2Ch]@2 965 int v66; // [sp+24h] [bp-2Ch]@2
966 bool v67; // [sp+28h] [bp-28h]@10 966 bool v67; // [sp+28h] [bp-28h]@10
967 unsigned int v68; // [sp+2Ch] [bp-24h]@10 967 unsigned int v68; // [sp+2Ch] [bp-24h]@10
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;
1335 v71 = 58500; 1335 v71 = 58500;
1336 v0->vVelocity.y = v70; 1336 v0->vVelocity.y = v70;
1337 v70 = v0->vVelocity.z; 1337 v70 = v0->vVelocity.z;
1338 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; 1338 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16;
1339 ++v69; 1339 ++v69;
1340 v54 = __OFSUB__(v69, 100); 1340 v54 = v69 < 100;
1341 v10 = ((v69 - 100) & 0x80000000u) != 0; 1341 v10 = (v69 - 100) < 0;
1342 v0->vVelocity.z = v70; 1342 v0->vVelocity.z = v70;
1343 if ( !(v10 ^ v54) ) 1343 if ( !(v10 ^ v54) )
1344 break; 1344 break;
1345 v26 = stru_721530.prolly_normal_d; 1345 v26 = stru_721530.prolly_normal_d;
1346 } 1346 }
1481 v40 = v8; 1481 v40 = v8;
1482 do 1482 do
1483 { 1483 {
1484 _46E44E_collide_against_faces_and_portals(0); 1484 _46E44E_collide_against_faces_and_portals(0);
1485 _46E0B2_collide_against_decorations(); 1485 _46E0B2_collide_against_decorations();
1486 if ( (v1->field_58 & 7) != 4 ) 1486 if ( (v1->field_58 & 7) != OBJECT_Player)
1487 _46EF01_collision_chech_player(1); 1487 _46EF01_collision_chech_player(1);
1488 v13 = v1->field_58; 1488 v13 = v1->field_58;
1489 v42 = v8; 1489 v42 = v8;
1490 if ( (v13 & 7) == 3 ) 1490 if ( (v13 & 7) == OBJECT_Actor)
1491 { 1491 {
1492 if ( (signed int)uNumActors > v8 ) 1492 if ( (signed int)uNumActors > v8 )
1493 { 1493 {
1494 v39b = pActors;//[0].word_000086_some_monster_id; 1494 v39b = pActors;//[0].word_000086_some_monster_id;
1495 do 1495 do
1573 v1->uSectorID = LOWORD(stru_721530.uSectorID); 1573 v1->uSectorID = LOWORD(stru_721530.uSectorID);
1574 stru_721530.field_70 += stru_721530.field_7C; 1574 stru_721530.field_70 += stru_721530.field_7C;
1575 if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) 1575 if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) )
1576 return; 1576 return;
1577 v15 = (signed int)stru_721530.uFaceID >> 3; 1577 v15 = (signed int)stru_721530.uFaceID >> 3;
1578 if ( (stru_721530.uFaceID & 7) == 5 ) 1578 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
1579 { 1579 {
1580 v40 = sub_452A9E(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y); 1580 v40 = sub_452A9E(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y);
1581 v23 = stru_5C6E00->Atan2( 1581 v23 = stru_5C6E00->Atan2(
1582 v1->vPosition.x - pLevelDecorations[v15].vPosition.x, 1582 v1->vPosition.x - pLevelDecorations[v15].vPosition.x,
1583 v1->vPosition.y - pLevelDecorations[v15].vPosition.y); 1583 v1->vPosition.y - pLevelDecorations[v15].vPosition.y);
1591 v41 = v26 >> 16; 1591 v41 = v26 >> 16;
1592 v1->vVelocity.y = WORD1(v26); 1592 v1->vVelocity.y = WORD1(v26);
1593 } 1593 }
1594 else 1594 else
1595 { 1595 {
1596 if ( (stru_721530.uFaceID & 7) != 6 ) 1596 if ( (stru_721530.uFaceID & 7) != OBJECT_BModel)
1597 goto LABEL_64; 1597 goto LABEL_64;
1598 stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3; 1598 stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3;
1599 v16 = &pIndoor->pFaces[v15]; 1599 v16 = &pIndoor->pFaces[v15];
1600 if ( v16->uPolygonType != 3 ) 1600 if ( v16->uPolygonType != 3 )
1601 { 1601 {
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);
1985 v16 = WorldPosToGridCellZ(v1->vPosition.y); 1985 v16 = WorldPosToGridCellZ(v1->vPosition.y);
1986 v17 = v1->vPosition.x; 1986 v17 = v1->vPosition.x;
1987 v58 = v16; 1987 v58 = v16;
1988 v18 = WorldPosToGridCellX(v17); 1988 v18 = WorldPosToGridCellX(v17);
1989 _46E26D_collide_against_sprites(v18, v58); 1989 _46E26D_collide_against_sprites(v18, v58);
1990 if ( (v1->field_58 & 7) != 4 ) 1990 if ( (v1->field_58 & 7) != OBJECT_Player)
1991 _46EF01_collision_chech_player(0); 1991 _46EF01_collision_chech_player(0);
1992 if ( (v1->field_58 & 7) == 3 ) 1992 if ( (v1->field_58 & 7) == OBJECT_Actor)
1993 { 1993 {
1994 v19 = v1->field_58 >> 3; 1994 v19 = v1->field_58 >> 3;
1995 if ( v19 >= 0 ) 1995 if ( v19 >= 0 )
1996 { 1996 {
1997 if ( v19 < (signed int)(uNumActors - 1) ) 1997 if ( v19 < (signed int)(uNumActors - 1) )
2092 v1->vPosition.z = v54 + 1; 2092 v1->vPosition.z = v54 + 1;
2093 if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) ) 2093 if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) )
2094 return; 2094 return;
2095 } 2095 }
2096 v30 = (signed int)stru_721530.uFaceID >> 3; 2096 v30 = (signed int)stru_721530.uFaceID >> 3;
2097 if ( (stru_721530.uFaceID & 7) == 5 ) 2097 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
2098 break; 2098 break;
2099 if ( (stru_721530.uFaceID & 7) == 6 ) 2099 if ( (stru_721530.uFaceID & 7) == OBJECT_BModel)
2100 { 2100 {
2101 v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; 2101 v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
2102 v32 = &v31->pFaces[v30 & 0x3F]; 2102 v32 = &v31->pFaces[v30 & 0x3F];
2103 if ( v32->uPolygonType != 3 ) 2103 if ( v32->uPolygonType != 3 )
2104 { 2104 {
2812 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; 2812 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
2813 v43 = stru_721530.uFaceID; 2813 v43 = stru_721530.uFaceID;
2814 uSectorID = stru_721530.uSectorID; 2814 uSectorID = stru_721530.uSectorID;
2815 stru_721530.field_70 += stru_721530.field_7C; 2815 stru_721530.field_70 += stru_721530.field_7C;
2816 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z; 2816 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z;
2817 if ( (stru_721530.uFaceID & 7) == 3 ) 2817 if ( (stru_721530.uFaceID & 7) == OBJECT_Actor)
2818 { 2818 {
2819 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 2819 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
2820 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) ) 2820 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) )
2821 pParty->pPartyBuffs[11].Reset(); 2821 pParty->pPartyBuffs[11].Reset();
2822 viewparams->bRedrawGameUI = 1; 2822 viewparams->bRedrawGameUI = 1;
2823 goto LABEL_152; 2823 goto LABEL_152;
2824 } 2824 }
2825 if ( (stru_721530.uFaceID & 7) == 5 ) 2825 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
2826 { 2826 {
2827 v53 = sub_452A9E(v2 * v2 + v1 * v1); 2827 v53 = sub_452A9E(v2 * v2 + v1 * v1);
2828 v80 = v53; 2828 v80 = v53;
2829 v54 = stru_5C6E00->Atan2( 2829 v54 = stru_5C6E00->Atan2(
2830 new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, 2830 new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
2833 v55 = stru_5C6E00->SinCos(v54 - stru_5C6E00->uIntegerHalfPi); 2833 v55 = stru_5C6E00->SinCos(v54 - stru_5C6E00->uIntegerHalfPi);
2834 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; 2834 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16;
2835 } 2835 }
2836 else 2836 else
2837 { 2837 {
2838 if ( (stru_721530.uFaceID & 7) == 6 ) 2838 if ( (stru_721530.uFaceID & 7) == OBJECT_BModel)
2839 { 2839 {
2840 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; 2840 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
2841 v45 = v44->uPolygonType; 2841 v45 = v44->uPolygonType;
2842 if ( v45 == 3 ) 2842 if ( v45 == 3 )
2843 { 2843 {
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
3019 double v22; // st7@92 3019 //double v22; // st7@92
3020 int v23; // eax@96 3020 //int v23; // eax@96
3021 double v24; // st7@96 3021 //double v24; // st7@96
3022 int v25; // eax@97 3022 //int v25; // eax@97
3023 double v26; // st7@97 3023 //double v26; // st7@97
3024 int v27; // eax@98 3024 //int v27; // eax@98
3025 double v28; // st7@98 3025 //double v28; // st7@98
3026 signed __int64 v29; // qax@98 3026 //signed __int64 v29; // qax@98
3027 unsigned int v30; // eax@103 3027 //unsigned int v30; // eax@103
3028 int v31; // eax@130 3028 int v31; // eax@130
3029 int v32; // ecx@141 3029 //int v32; // ecx@141
3030 signed int v33; // eax@143 3030 signed int v33; // eax@143
3031 int v34; // esi@143 3031 int v34; // esi@143
3032 unsigned int v35; // esi@147 3032 int v35; // esi@147
3033 int v36; // eax@155 3033 int v36; // eax@155
3034 signed int v37; // esi@159 3034 signed int v37; // esi@159
3035 signed int v38; // eax@159 3035 signed int v38; // eax@159
3036 signed int i; // esi@159 3036 signed int i; // esi@159
3037 int v40; // esi@162 3037 int v40; // esi@162
3038 Player **v41; // esi@172 3038 //Player **v41; // esi@172
3039 bool v42; // eax@180 3039 bool v42; // eax@180
3040 signed int v43; // ecx@184 3040 signed int v43; // ecx@184
3041 signed int v44; // edx@184 3041 signed int v44; // edx@184
3042 int v45; // ecx@200 3042 int v45; // ecx@200
3043 BSPModel *v46; // eax@203 3043 BSPModel *v46; // eax@203
3085 signed int v88; // [sp-1Ch] [bp-B0h]@246 3085 signed int v88; // [sp-1Ch] [bp-B0h]@246
3086 unsigned int v89; // [sp-18h] [bp-ACh]@246 3086 unsigned int v89; // [sp-18h] [bp-ACh]@246
3087 signed int v90; // [sp-14h] [bp-A8h]@246 3087 signed int v90; // [sp-14h] [bp-A8h]@246
3088 signed int v91; // [sp-10h] [bp-A4h]@246 3088 signed int v91; // [sp-10h] [bp-A4h]@246
3089 int v92; // [sp-Ch] [bp-A0h]@246 3089 int v92; // [sp-Ch] [bp-A0h]@246
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
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;
3181 pParty->uFallStartY = v3; 3181 pParty->uFallStartY = v3;
3182 else 3182 else
3183 v3 = pParty->uFallStartY; 3183 v3 = pParty->uFallStartY;
3184 if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 ) 3184 if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 )
3185 { 3185 {
3186 if ( BYTE1(pParty->uFlags) & 1 ) 3186 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
3187 { 3187 {
3188 BYTE1(pParty->uFlags) &= 0xFEu; 3188 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
3189 } 3189 }
3190 else 3190 else for (int _i = 0; _i < 4; ++_i) // receive falling damage
3191 { 3191 {
3192 v4 = &pPlayers[1]; // receive falling damage 3192 auto player = pParty->pPlayers + _i;
3193 do 3193
3194 { 3194 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) )
3195 if ( !(*v4)->HasEnchantedItemEquipped(72) && !(*v4)->WearsItem(529, 8) ) 3195 {
3196 { 3196 player->ReceiveDamage(
3197 v105 = (*v4)->GetMaxHealth(); 3197 (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256,
3198 (*v4)->ReceiveDamage(
3199 (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(signed __int64)((double)v105 * 0.1)) / 256,
3200 4); 3198 4);
3201 v5 = (*v4)->GetActualEndurance(); 3199 v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance());
3202 v105 = 20 - (*v4)->_48EA1B_get_static_effect(v5); 3200 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
3203 (*v4)->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); 3201 }
3204 } 3202 //}
3205 ++v4; 3203 //while ( (signed int)v4 <= (signed int)&pPlayers[4] );
3206 }
3207 while ( (signed int)v4 <= (signed int)&pPlayers[4] );
3208 _zero = 0;
3209 } 3204 }
3210 } 3205 }
3211 v109 = -1; 3206 v109 = -1;
3212 if ( pParty->bFlying != _zero ) 3207 if ( pParty->bFlying )
3213 v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102); 3208 v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102);
3214 v107 = v108 == _zero; 3209 v107 = v108 == 0;
3215 v105 = v111 + 1; 3210 v105 = v111 + 1;
3216 if ( v123 <= v111 + 1 ) 3211 if ( v123 <= v111 + 1 )
3217 { 3212 {
3218 v109 = -1; 3213 v109 = -1;
3219 pParty->bFlying = _zero; 3214 pParty->bFlying = false;
3220 } 3215 }
3221 else 3216 else
3222 { 3217 {
3223 bJumping = 1; 3218 bJumping = 1;
3224 } 3219 }
3225 v101 = v123 - v111 <= 32; 3220 v101 = v123 - v111 <= 32;
3226 if ( bWalkSound != _zero && pParty->field_6F8 > _zero ) 3221 if ( bWalkSound && pParty->field_6F8 > 0 )
3227 pParty->field_6F8 -= pEventTimer->uTimeElapsed; 3222 pParty->field_6F8 -= pEventTimer->uTimeElapsed;
3228 if ( !bUnderwater 3223 if (!bUnderwater
3229 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= _zero 3224 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0
3230 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < _zero || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= _zero) ) 3225 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) )
3231 pParty->bFlying = _zero; 3226 pParty->bFlying = false;
3232 if ( bJumping == _zero ) 3227 if (!bJumping)
3233 { 3228 {
3234 if ( pParty->field_6F4_packedid != (8 * v108 | OBJECT_BModel) ) 3229 if ( pParty->field_6F4_packedid != (8 * v108 | OBJECT_BModel) )
3235 { 3230 {
3236 if ( v108 != _zero ) 3231 if (v108)
3237 { 3232 {
3238 if ( v108 >> 6 < pOutdoor->uNumBModels ) 3233 if ( v108 >> 6 < pOutdoor->uNumBModels )
3239 { 3234 {
3240 v7 = pOutdoor->pBModels[v108 >> 6].pFaces; 3235 v7 = pOutdoor->pBModels[v108 >> 6].pFaces;
3241 v6 = v108 & 0x3F; 3236 v6 = v108 & 0x3F;
3261 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format 3256 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
3262 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed 3257 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed
3263 * stru_5C6E00->uIntegerPi) 3258 * stru_5C6E00->uIntegerPi)
3264 / 180)) >> 16);*/ 3259 / 180)) >> 16);*/
3265 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; 3260 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16;
3266 LABEL_118: 3261 while (pPartyActionQueue->uNumActions)
3267 while ( pPartyActionQueue->uNumActions ) 3262 {
3268 { 3263 switch (pPartyActionQueue->Next())
3269 switch ( pPartyActionQueue->Next() )
3270 { 3264 {
3271 case PARTY_FlyUp: 3265 case PARTY_FlyUp:
3272 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) 3266 {
3273 { 3267 if (!pParty->FlyActive() && !bUnderwater)
3274 pParty->bFlying = 0; 3268 break;
3275 if ( bUnderwater 3269
3276 || pParty->pPartyBuffs[7].uFlags & 1 3270 pParty->bFlying = false;
3277 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) 3271 if (bUnderwater ||
3272 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
3273 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana <= 0 )
3278 { 3274 {
3279 if ( pParty->vPosition.z < 4000 || bJumping ) 3275 if ( pParty->vPosition.z < 4000 || bJumping )
3280 { 3276 {
3281 v123 += 30; 3277 v123 += 30;
3282 v113 += 30; 3278 v113 += 30;
3304 } 3300 }
3305 pParty->uFallSpeed = 0; 3301 pParty->uFallSpeed = 0;
3306 v127 = (BSPModel *)1; 3302 v127 = (BSPModel *)1;
3307 } 3303 }
3308 } 3304 }
3309 } 3305 }
3310 goto LABEL_118; 3306 break;
3307
3311 case PARTY_FlyDown: 3308 case PARTY_FlyDown:
3312 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 || bUnderwater == 1 ) 3309 if (pParty->FlyActive() || bUnderwater)
3313 { 3310 {
3314 pParty->bFlying = 0; 3311 pParty->bFlying = 0;
3315 if ( bUnderwater 3312 if ( bUnderwater
3316 || pParty->pPartyBuffs[7].uFlags & 1 3313 || pParty->pPartyBuffs[7].uFlags & 1
3317 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) 3314 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
3327 pParty->bFlying = 0; 3324 pParty->bFlying = 0;
3328 pPartyActionQueue->uNumActions = 0; 3325 pPartyActionQueue->uNumActions = 0;
3329 } 3326 }
3330 } 3327 }
3331 } 3328 }
3332 goto LABEL_118; 3329 break;
3330
3333 case PARTY_TurnLeft: 3331 case PARTY_TurnLeft:
3334 //v8 = uTurnSpeed; 3332 if (uTurnSpeed)
3335 if ( uTurnSpeed ) 3333 _angle_y += uTurnSpeed; //descrete turn
3336 {
3337 v12 = uTurnSpeed + _angle_y;
3338 _angle_y = stru_5C6E00->uDoublePiMask & v12;
3339 }
3340 else 3334 else
3341 { 3335 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn
3342 v9 = (double)dturn * fTurnSpeedMultiplier; 3336
3343 _angle_y = stru_5C6E00->uDoublePiMask & (_angle_y + (unsigned __int64)(signed __int64)v9); 3337 _angle_y &= stru_5C6E00->uDoublePiMask;
3344 } 3338 break;
3345 break;
3346 3339
3347 case PARTY_TurnRight: 3340 case PARTY_TurnRight:
3348 //LODWORD(v10) = uTurnSpeed; 3341 if (uTurnSpeed)
3349 if ( uTurnSpeed ) 3342 _angle_y -= uTurnSpeed;
3350 {
3351 v12 = _angle_y - uTurnSpeed;
3352 _angle_y = stru_5C6E00->uDoublePiMask & v12;
3353 }
3354 else 3343 else
3355 { 3344 _angle_y -= dturn * fTurnSpeedMultiplier;
3356 v11 = (double)dturn * fTurnSpeedMultiplier; 3345
3357 v12 = _angle_y - (signed __int64)v11; 3346 _angle_y &= stru_5C6E00->uDoublePiMask;
3358 _angle_y = stru_5C6E00->uDoublePiMask & v12; 3347 break;
3359 }
3360 break;
3361 3348
3362 case PARTY_FastTurnLeft: 3349 case PARTY_FastTurnLeft:
3363 if ( uTurnSpeed ) 3350 if (uTurnSpeed)
3364 { 3351 _angle_y += uTurnSpeed;
3365 v12 = uTurnSpeed + _angle_y;
3366 _angle_y = stru_5C6E00->uDoublePiMask & v12;
3367 }
3368 else 3352 else
3369 { 3353 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn;
3370 v9 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)dturn; 3354
3371 _angle_y = stru_5C6E00->uDoublePiMask & (_angle_y + (unsigned __int64)(signed __int64)v9); 3355 _angle_y &= stru_5C6E00->uDoublePiMask;
3372 } 3356 break;
3373 break;
3374 3357
3375 case PARTY_FastTurnRight: 3358 case PARTY_FastTurnRight:
3376 if ( !uTurnSpeed ) 3359 if (!uTurnSpeed)
3377 { 3360 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
3378 v11 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)dturn;
3379 v12 = _angle_y - (signed __int64)v11;
3380 _angle_y = stru_5C6E00->uDoublePiMask & v12;
3381 }
3382 else 3361 else
3383 { 3362 _angle_y -= uTurnSpeed;
3384 v12 = _angle_y - uTurnSpeed; 3363
3385 _angle_y = stru_5C6E00->uDoublePiMask & v12; 3364 _angle_y &= stru_5C6E00->uDoublePiMask;
3386 } 3365 break;
3387 break;
3388 3366
3389 case PARTY_StrafeLeft: 3367 case PARTY_StrafeLeft:
3390 v13 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3368 {
3391 v14 = (double)_walk_speed; 3369 *(float *)&v128 = pParty->uWalkSpeed;
3392 v126 = v13; 3370
3393 *(float *)&v128 = v14; 3371 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
3394 v124 = (unsigned __int64)(v13 * (signed __int64)((signed int)(signed __int64)(v14 * fWalkSpeedMultiplier) >> 1)) >> 16; 3372 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3395 v2 -= v124; 3373 v2 -= 3 * dx / 4;
3396 v126 = stru_5C6E00->SinCos(_angle_y); 3374
3397 v124 = (unsigned __int64)(v126 3375 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3398 * (signed __int64)((signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier) >> 1)) >> 16; 3376 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3399 goto LABEL_85; 3377 v1 += 3 * dy / 4;
3378
3379 v128 = v1;
3380 v124 = 1;
3381 }
3382 break;
3383
3400 case PARTY_StrafeRight: 3384 case PARTY_StrafeRight:
3401 v15 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3385 {
3402 v16 = (double)_walk_speed; 3386 *(float *)&v128 = pParty->uWalkSpeed;
3403 v126 = v15; 3387
3404 *(float *)&v128 = v16; 3388 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
3405 v124 = (unsigned __int64)(v15 * (signed __int64)((signed int)(signed __int64)(v16 * fWalkSpeedMultiplier) >> 1)) >> 16; 3389 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3406 v2 += v124; 3390 v2 += 3 * dx / 4;
3407 v126 = stru_5C6E00->SinCos(_angle_y); 3391
3408 v124 = (unsigned __int64)(v126 3392 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3409 * (signed __int64)((signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier) >> 1)) >> 16; 3393 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3410 goto LABEL_90; 3394 v1 -= 3 * dy / 4;
3395
3396 v128 = v1;
3397 v124 = 1;
3398 }
3399 break;
3400
3411 case PARTY_WalkForward: 3401 case PARTY_WalkForward:
3412 v17 = stru_5C6E00->SinCos(_angle_y); 3402 {
3413 v18 = (double)_walk_speed; 3403 *(float *)&v128 = _walk_speed;
3414 v126 = v17; 3404
3415 *(float *)&v128 = v18; 3405 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
3416 v124 = (unsigned __int64)(v17 * (signed __int64)(signed int)(signed __int64)(v18 * fWalkSpeedMultiplier)) >> 16; 3406 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3417 v2 += v124; 3407
3418 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3408 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3419 v124 = (unsigned __int64)(v126 3409 v2 += dx;
3420 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16; 3410
3421 LABEL_85: 3411 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3422 v1 += v124; 3412 v1 += dy;
3423 goto LABEL_86; 3413
3424 case PARTY_WalkBackward: 3414 v128 = v1;
3425 v19 = stru_5C6E00->SinCos(_angle_y); 3415 v124 = 1;
3426 v20 = (double)_walk_speed; 3416 }
3427 v126 = v19; 3417 break;
3428 *(float *)&v128 = v20; 3418
3429 v124 = (unsigned __int64)(v19
3430 * (signed __int64)(signed int)(signed __int64)(v20 * fBackwardWalkSpeedMultiplier)) >> 16;
3431 v2 -= v124;
3432 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3433 v124 = (unsigned __int64)(v126
3434 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
3435 * fBackwardWalkSpeedMultiplier)) >> 16;
3436 LABEL_90:
3437 v1 -= v124;
3438 goto LABEL_86;
3439 case PARTY_RunForward: 3419 case PARTY_RunForward:
3440 if ( pParty->bFlying ) 3420 {
3441 { 3421 *(float *)&v128 = _walk_speed;
3442 v21 = stru_5C6E00->SinCos(_angle_y); 3422
3443 v22 = (double)_walk_speed; 3423 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
3444 v126 = v21; 3424 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3445 *(float *)&v128 = v22; 3425
3446 v129 = (unsigned __int64)(v21 3426 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3447 * (signed __int64)(signed int)(4 3427 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
3448 * (unsigned __int64)(signed __int64)(v22 3428
3449 * fWalkSpeedMultiplier))) >> 16; 3429 if (pParty->bFlying)
3450 v2 += v129; 3430 {
3451 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3431 v2 += 4 * dx;
3452 v129 = (unsigned __int64)(v126 3432 v1 += 4 * dy;
3453 * (signed __int64)(signed int)(4 3433
3454 * (unsigned __int64)(signed __int64)(*(float *)&v128
3455 * fWalkSpeedMultiplier))) >> 16;
3456 v1 += v129;
3457 goto LABEL_93;
3458 }
3459 if ( v118 && !v108 )
3460 {
3461 v23 = stru_5C6E00->SinCos(_angle_y);
3462 v24 = (double)_walk_speed;
3463 v126 = v23;
3464 *(float *)&v128 = v24;
3465 v129 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
3466 v2 += v129;
3467 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3468 v129 = (unsigned __int64)(v126
3469 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128 * fWalkSpeedMultiplier)) >> 16;
3470 v1 += v129;
3471 goto LABEL_86;
3472 }
3473 v25 = stru_5C6E00->SinCos(_angle_y);
3474 v26 = (double)_walk_speed;
3475 v114 = v25;
3476 *(float *)&v128 = v26;
3477 v129 = (unsigned __int64)(v25
3478 * (signed __int64)(signed int)(2
3479 * (unsigned __int64)(signed __int64)(v26
3480 * fWalkSpeedMultiplier))) >> 16;
3481 v2 += v129;
3482 v114 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3483 v129 = (unsigned __int64)((signed int)v114
3484 * (signed __int64)(signed int)(2
3485 * (unsigned __int64)(signed __int64)(*(float *)&v128
3486 * fWalkSpeedMultiplier))) >> 16;
3487 v1 += v129;
3488 v114 = 1;
3489 v128 = v1;
3490 break;
3491 case PARTY_RunBackward:
3492 v27 = stru_5C6E00->SinCos(_angle_y);
3493 v28 = (double)_walk_speed;
3494 v126 = v27;
3495 *(float *)&v128 = v28;
3496 v29 = (signed __int64)(v28 * fBackwardWalkSpeedMultiplier);
3497 if ( pParty->bFlying )
3498 {
3499 v129 = (unsigned __int64)(v126 * (signed __int64)(4 * (signed int)v29)) >> 16;
3500 v2 -= v129;
3501 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
3502 v129 = (unsigned __int64)(v126
3503 * (signed __int64)(signed int)(4
3504 * (unsigned __int64)(signed __int64)(*(float *)&v128
3505 * fBackwardWalkSpeedMultiplier))) >> 16;
3506 v1 -= v129;
3507 LABEL_93:
3508 v128 = v1; 3434 v128 = v1;
3509 } 3435 }
3510 else 3436 else if (partyAtHighSlope && !v108)
3511 { 3437 {
3512 v129 = (unsigned __int64)(v126 * (signed __int64)(signed int)v29) >> 16; 3438 v2 += dx;
3513 v2 -= v129; 3439 v1 += dy;
3514 v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi); 3440
3515 v129 = (unsigned __int64)(v126
3516 * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
3517 * fBackwardWalkSpeedMultiplier)) >> 16;
3518 v1 -= v129;
3519 LABEL_86:
3520 v128 = v1; 3441 v128 = v1;
3521 v124 = 1; 3442 v124 = 1;
3522 } 3443 }
3523 break; 3444 else
3445 {
3446 v2 += 2 * dx;
3447 v1 += 2 * dy;
3448
3449 v128 = v1;
3450 v114 = 1;
3451 }
3452 }
3453 break;
3454
3455
3456 case PARTY_WalkBackward:
3457 {
3458 *(float *)&v128 = _walk_speed;
3459
3460 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
3461 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3462
3463 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
3464 v2 -= dx;
3465
3466 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
3467 v1 -= dy;
3468
3469 v128 = v1;
3470 v124 = 1;
3471 }
3472 break;
3473
3474
3475 case PARTY_RunBackward:
3476 {
3477 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
3478 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
3479
3480 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
3481 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
3482
3483 if (pParty->bFlying)
3484 {
3485 v2 -= 4 * dx;
3486 v1 -= 4 * dy;
3487 v128 = v1;
3488 }
3489 else
3490 {
3491 v2 -= dx;
3492 v1 -= dy;
3493
3494 v128 = v1;
3495 v124 = 1;
3496 }
3497 }
3498 break;
3499
3500
3501 case PARTY_CenterView:
3502 _angle_x = 0;
3503 break;
3504
3524 case PARTY_LookUp: 3505 case PARTY_LookUp:
3525 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); 3506 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
3526 if ( _angle_x > 128 ) 3507 if ( _angle_x > 128 )
3527 _angle_x = 128; 3508 _angle_x = 128;
3528 v30 = uActiveCharacter; 3509 if (uActiveCharacter)
3529 if ( !uActiveCharacter ) 3510 pPlayers[uActiveCharacter]->PlaySound(63, 0);
3530 goto LABEL_118; 3511 break;
3531 v95 = 0; 3512
3532 v93 = 63;
3533 goto _play_player_sound;
3534 case PARTY_LookDown: 3513 case PARTY_LookDown:
3535 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); 3514 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
3536 if ( _angle_x < -128 ) 3515 if ( _angle_x < -128 )
3537 _angle_x = -128; 3516 _angle_x = -128;
3538 v30 = uActiveCharacter; 3517 if (uActiveCharacter)
3539 if ( uActiveCharacter ) 3518 pPlayers[uActiveCharacter]->PlaySound(64, 0);
3540 { 3519 break;
3541 v95 = 0; 3520
3542 v93 = 64;
3543 _play_player_sound:
3544 pPlayers[v30]->PlaySound(v93, v95);
3545 }
3546 goto LABEL_118;
3547 case PARTY_CenterView:
3548 _angle_x = 0;
3549 goto LABEL_118;
3550 case PARTY_Jump: 3521 case PARTY_Jump:
3551 if ( (!v118 || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) 3522 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
3552 { 3523 {
3553 v126 = pParty->field_24 << 6; 3524 v126 = pParty->field_24 << 6;
3554 bJumping = 1; 3525 bJumping = 1;
3555 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121); 3526 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121);
3556 } 3527 }
3557 goto LABEL_118; 3528 break;
3529
3558 default: 3530 default:
3559 goto LABEL_118; 3531 assert(false);
3532
3560 case PARTY_Land: 3533 case PARTY_Land:
3561 if ( pParty->bFlying ) 3534 if (pParty->bFlying)
3562 { 3535 {
3563 BYTE1(pParty->uFlags) |= 1u; 3536 pParty->uFlags |= PARTY_FLAGS_1_LANDING;
3564 pParty->uFallSpeed = 0; 3537 pParty->uFallSpeed = 0;
3565 } 3538 }
3566 pParty->bFlying = 0; 3539 pParty->bFlying = false;
3567 pPartyActionQueue->uNumActions = 0; 3540 pPartyActionQueue->uNumActions = 0;
3568 goto LABEL_123; 3541 break;
3569 } 3542 }
3570 } 3543 }
3544
3571 LABEL_123: 3545 LABEL_123:
3572 pParty->sRotationY = _angle_y; 3546 pParty->sRotationY = _angle_y;
3573 pParty->sRotationX = _angle_x; 3547 pParty->sRotationX = _angle_x;
3574 if ( v123 < v111 ) 3548 if ( v123 < v111 )
3575 { 3549 {
3580 v126 = stru_5C6E00->SinCos(v31); 3554 v126 = stru_5C6E00->SinCos(v31);
3581 v129 = (unsigned __int64)(4i64 * v126) >> 16; 3555 v129 = (unsigned __int64)(4i64 * v126) >> 16;
3582 v123 = v113 + v129; 3556 v123 = v113 + v129;
3583 if ( v127 ) 3557 if ( v127 )
3584 v123 = v113; 3558 v123 = v113;
3585 if ( SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 3559 if (pParty->FlyActive())
3586 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime)) )
3587 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; 3560 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu;
3588 pParty->uFallStartY = v123; 3561 pParty->uFallStartY = v123;
3589 goto LABEL_141; 3562 goto LABEL_141;
3590 } 3563 }
3591 if ( v130 && v121 ) 3564 if ( v130 && v121 )
3595 pParty->uFallStartY = v111; 3568 pParty->uFallStartY = v111;
3596 } 3569 }
3597 if ( pParty->bFlying ) 3570 if ( pParty->bFlying )
3598 goto LABEL_130; 3571 goto LABEL_130;
3599 v113 = v123; 3572 v113 = v123;
3600 if ( SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 3573 if (pParty->FlyActive())
3601 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime)) )
3602 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; 3574 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
3575
3603 LABEL_141: 3576 LABEL_141:
3604 v32 = 0; 3577 if (bJumping && !pParty->bFlying)
3605 if ( bJumping && !pParty->bFlying )
3606 { 3578 {
3607 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); 3579 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
3608 v34 = v121 + 2 * v33; 3580 v34 = v121 + 2 * v33;
3609 v121 += 2 * v33; 3581 v121 += 2 * v33;
3610 goto LABEL_149; 3582 goto LABEL_164;
3611 } 3583 }
3612 if ( !v118 ) 3584 if (!partyAtHighSlope)
3613 { 3585 {
3614 v34 = v121; 3586 v34 = v121;
3615 LABEL_149: 3587 if (!bJumping)
3616 if ( bJumping == v32 )
3617 goto LABEL_150; 3588 goto LABEL_150;
3618 goto LABEL_164; 3589 goto LABEL_164;
3619 } 3590 }
3620 if ( !bJumping ) 3591 if (!bJumping)
3621 { 3592 {
3622 if ( v108 ) 3593 if ( v108 )
3623 goto LABEL_150; 3594 goto LABEL_150;
3595
3596 // rolling down the hill
3597 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
3598 // and falling to the gravity, gradually sliding downwards. nice trick
3624 v123 = v111; 3599 v123 = v111;
3625 _46DCC8_get_gravity_direction_outdoor(v116, v117, (Vec3_int_ *)&v98); 3600 ODM_GetTerrainNormalAt(v116, v117, &v98);
3626 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); 3601 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
3627 v129 = abs((signed __int64)v2 * (signed __int64)v98 + (signed __int64)v1 * (signed __int64)v99 + (signed __int64)v35 * (signed __int64)v100) >> 16; 3602 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
3628 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98) >> 16); 3603 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
3629 v2 += (int)v127; 3604 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
3630 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v99) >> 16); 3605 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
3631 v1 += (int)v127;
3632 v128 = v1; 3606 v128 = v1;
3633 v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v100) >> 16);
3634 v34 = (int)((char *)v127 + v35);
3635 v32 = 0;
3636 v121 = v34; 3607 v121 = v34;
3637 goto LABEL_149; 3608 if (!bJumping)
3609 goto LABEL_150;
3610 goto LABEL_164;
3638 } 3611 }
3639 v34 = v121; 3612 v34 = v121;
3613
3640 LABEL_164: 3614 LABEL_164:
3641 if ( !bUnderwater && v34 <= v32 ) 3615 if ( !bUnderwater && v34 <= 0)
3642 { 3616 {
3643 if ( v34 < -500 3617 if ( v34 < -500
3644 && !pParty->bFlying 3618 && !pParty->bFlying
3645 && pParty->vPosition.z - v111 > 1000 3619 && pParty->vPosition.z - v111 > 1000
3646 && SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 3620 && !pParty->FeatherFallActive())
3647 && (SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 || !LODWORD(pParty->pPartyBuffs[5].uExpireTime)) ) 3621 { // falling scream
3648 { 3622 for (int i = 0; i < 4; ++i)
3649 v41 = &pPlayers[1]; 3623 {
3650 do 3624 auto player = pParty->pPlayers + i;
3651 { 3625 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct())
3652 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) && (*v41)->CanAct() ) 3626 player->PlaySound(66, 0);
3653 (*v41)->PlaySound(66, 0); 3627 }
3654 ++v41; 3628 }
3655 } 3629 }
3656 while ( (signed int)v41 <= (signed int)&pPlayers[4] ); 3630 else
3657 } 3631 {
3658 goto LABEL_151;
3659 }
3660 LABEL_150: 3632 LABEL_150:
3661 pParty->uFallStartY = v123; 3633 pParty->uFallStartY = v123;
3662 LABEL_151: 3634 }
3663 if ( v2 * v2 + v1 * v1 < 400 && !v118 ) 3635
3636 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
3664 { 3637 {
3665 *(float *)&v128 = 0.0; 3638 *(float *)&v128 = 0.0;
3666 v2 = 0; 3639 v2 = 0;
3667 } 3640 }
3668 stru_721530.field_84 = -1; 3641 stru_721530.field_84 = -1;
3718 v40, 3691 v40,
3719 pParty->uPartyHeight, 3692 pParty->uPartyHeight,
3720 &v130, 3693 &v130,
3721 &v110, 3694 &v110,
3722 0); 3695 0);
3723 v127 = (BSPModel *)GetTerrainHeightsAroundParty(_angle_x, v117); 3696 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, v117);
3724 v42 = GetTerrainHeightsAroundParty(v116, _angle_y); 3697 v42 = IsTerrainSlopeTooHigh(v116, _angle_y);
3725 v107 = 0; 3698 v107 = 0;
3726 v118 = v42; 3699 v118 = v42;
3727 if ( !v97 && !v110 && !v108 ) 3700 if ( !v97 && !v110 && !v108 )
3728 v107 = 1; 3701 v107 = 1;
3729 v43 = 1; 3702 v43 = 1;
3744 v40, 3717 v40,
3745 pParty->uPartyHeight, 3718 pParty->uPartyHeight,
3746 &v130, 3719 &v130,
3747 &v108, 3720 &v108,
3748 0); 3721 0);
3749 if ( GetTerrainHeightsAroundParty(_angle_x, _angle_y) && (signed int)v127 <= v123 ) 3722 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= v123 )
3750 { 3723 {
3751 v43 = 1; 3724 v43 = 1;
3752 LABEL_197: 3725 LABEL_197:
3753 v116 = _angle_x; 3726 v116 = _angle_x;
3754 if ( !v43 ) 3727 if ( !v43 )
3770 stru_721530.field_70 += stru_721530.field_7C; 3743 stru_721530.field_70 += stru_721530.field_7C;
3771 v116 = _angle_x; 3744 v116 = _angle_x;
3772 v117 = _angle_y; 3745 v117 = _angle_y;
3773 v45 = stru_721530.uFaceID; 3746 v45 = stru_721530.uFaceID;
3774 v123 = v40; 3747 v123 = v40;
3775 if ( (stru_721530.uFaceID & 7) == 3 ) 3748 if ( (stru_721530.uFaceID & 7) == OBJECT_Actor)
3776 { 3749 {
3777 if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 3750 if (pParty->Invisible())
3778 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) ) 3751 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
3779 pParty->pPartyBuffs[11].Reset(); 3752
3780 viewparams->bRedrawGameUI = 1; 3753 viewparams->bRedrawGameUI = 1;
3781 goto LABEL_234; 3754 goto LABEL_234;
3782 } 3755 }
3783 if ( (stru_721530.uFaceID & 7) == 5 ) 3756 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
3784 { 3757 {
3785 v56 = sub_452A9E(v2 * v2 + v128 * v128); 3758 v56 = sub_452A9E(v2 * v2 + v128 * v128);
3786 v118 = v56; 3759 v118 = v56;
3787 v57 = stru_5C6E00->Atan2( 3760 v57 = stru_5C6E00->Atan2(
3788 _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, 3761 _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
3799 v122 = v61 >> 16; 3772 v122 = v61 >> 16;
3800 v128 = v61 >> 16; 3773 v128 = v61 >> 16;
3801 } 3774 }
3802 else 3775 else
3803 { 3776 {
3804 if ( (stru_721530.uFaceID & 7) == 6 ) 3777 if ( (stru_721530.uFaceID & 7) == OBJECT_BModel)
3805 { 3778 {
3806 pParty->bFlying = 0; 3779 pParty->bFlying = 0;
3807 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; 3780 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
3808 v127 = v46; 3781 v127 = v46;
3809 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; 3782 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
9428 } 9401 }
9429 9402
9430 9403
9431 9404
9432 //----- (004823F4) -------------------------------------------------------- 9405 //----- (004823F4) --------------------------------------------------------
9433 bool __fastcall GetTerrainHeightsAroundParty(int a1, int a2) 9406 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
9434 { 9407 {
9435 unsigned int v2; // ebx@1 9408 //unsigned int v2; // ebx@1
9436 unsigned int v3; // edi@1 9409 //unsigned int v3; // edi@1
9437 int v4; // eax@1 9410 //int v4; // eax@1
9438 int v6; // esi@5 9411 //int v6; // esi@5
9439 int v7; // ecx@6 9412 //int v7; // ecx@6
9440 int v8; // edx@6 9413 //int v8; // edx@6
9441 int v9; // eax@6 9414 //int v9; // eax@6
9442 int v10; // esi@10 9415 //int v10; // esi@10
9443 int v11; // [sp+14h] [bp-8h]@1 9416 //int v11; // [sp+14h] [bp-8h]@1
9444 int v12; // [sp+18h] [bp-4h]@1 9417 //int v12; // [sp+18h] [bp-4h]@1
9445 9418
9446 v12 = a1; 9419 //v12 = a1;
9447 v11 = a2; 9420 //v11 = a2;
9448 v2 = WorldPosToGridCellX(a1); 9421 auto grid_x = WorldPosToGridCellX(pos_x);
9449 v3 = WorldPosToGridCellZ(v11) - 1; 9422 auto grid_z = WorldPosToGridCellZ(pos_z) - 1;
9450 dword_76D568_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2); 9423
9451 dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2 + 1); 9424 auto party_grid_x1 = GridCellToWorldPosX(grid_x);
9452 dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2 + 1); 9425 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
9453 dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v2); 9426 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1);
9454 dword_76D558_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3); 9427 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x);
9455 dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3); 9428 auto party_grid_z1 = GridCellToWorldPosZ(grid_z);
9456 dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3 + 1); 9429 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z);
9457 dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v3 + 1); 9430 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
9458 dword_76D548_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v2, v3); 9431 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1);
9459 dword_76D54C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v2 + 1, v3); 9432 auto party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
9460 dword_76D550_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v2 + 1, v3 + 1); 9433 auto party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
9461 v4 = pOutdoor->DoGetHeightOnTerrain(v2, v3 + 1); 9434 auto party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
9462 dword_76D554_terrain_cell_world_pos_around_party_y = v4; 9435 auto party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
9463 if ( dword_76D548_terrain_cell_world_pos_around_party_y == dword_76D54C_terrain_cell_world_pos_around_party_y 9436 //dword_76D554_terrain_cell_world_pos_around_party_y = v4;
9464 && dword_76D54C_terrain_cell_world_pos_around_party_y == dword_76D550_terrain_cell_world_pos_around_party_y 9437 if (party_x1z1_y == party_x2z1_y &&
9465 && dword_76D550_terrain_cell_world_pos_around_party_y == v4 ) 9438 party_x2z1_y == party_x2z2_y &&
9466 return 0; 9439 party_x2z2_y == party_x1z2_y )
9467 v6 = abs(v12 - dword_76D568_terrain_cell_world_pos_around_party_x); 9440 return false;
9468 if ( abs(dword_76D558_terrain_cell_world_pos_around_party_z - v11) >= v6 ) 9441
9469 { 9442 auto dx = abs(pos_x - party_grid_x1),
9470 v7 = dword_76D554_terrain_cell_world_pos_around_party_y; 9443 dz = abs(party_grid_z1 - pos_z);
9471 v8 = dword_76D550_terrain_cell_world_pos_around_party_y; 9444
9472 v9 = dword_76D548_terrain_cell_world_pos_around_party_y; 9445 int y1, y2, y3;
9446 if (dz >= dx)
9447 {
9448 y1 = party_x1z2_y; // lower-left triangle
9449 y2 = party_x2z2_y; // y3 | \
9450 y3 = party_x1z1_y; // | \
9451 /* | \
9452 |______ \
9453 y1 y2 */
9473 } 9454 }
9474 else 9455 else
9475 { 9456 {
9476 v7 = dword_76D54C_terrain_cell_world_pos_around_party_y; 9457 y1 = party_x2z1_y; // upper-right
9477 v8 = dword_76D548_terrain_cell_world_pos_around_party_y; 9458 y2 = party_x1z1_y; // y2_______ y1
9478 v9 = dword_76D550_terrain_cell_world_pos_around_party_y; 9459 y3 = party_x2z2_y; // \ |
9479 } 9460 /* \ |
9480 if ( v7 >= v8 ) 9461 \ |
9481 { 9462 y3 */
9482 v10 = v8; 9463 }
9483 if ( v8 < v9 ) 9464
9465 int y_min = min(y1, min(y2, y3)),
9466 y_max = max(y1, max(y2, y3));
9467 return y_max - y_min > 512;
9468
9469 /*if ( y1 >= y2 )
9470 {
9471 y_min = y2;
9472 if ( y2 < y3 )
9484 goto LABEL_13; 9473 goto LABEL_13;
9485 LABEL_12: 9474 LABEL_12:
9486 v10 = v9; 9475 y_min = y3;
9487 goto LABEL_13; 9476 goto LABEL_13;
9488 } 9477 }
9489 if ( v7 >= v9 ) 9478 else if ( y1 >= y3 )
9490 goto LABEL_12; 9479 goto LABEL_12;
9491 v10 = v7; 9480 else
9481 y_min = y1;
9482
9492 LABEL_13: 9483 LABEL_13:
9493 if ( v7 <= v8 ) 9484 if ( y1 <= y2 )
9494 { 9485 {
9495 if ( v8 > v9 ) 9486 if ( y2 > y3 )
9496 v9 = v8; 9487 y3 = y2;
9497 } 9488 }
9498 else 9489 else
9499 { 9490 {
9500 if ( v7 > v9 ) 9491 if ( y1 > y3 )
9501 v9 = v7; 9492 y3 = y1;
9502 } 9493 }
9503 return v9 - v10 > 512; 9494 return y3 - v10 > 512;*/
9504 } 9495 }
9505 9496
9506 9497
9507 //----- (0048257A) -------------------------------------------------------- 9498 //----- (0048257A) --------------------------------------------------------
9508 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4) 9499 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *a3, int a4)
12926 LODWORD(v21) = pBLVRenderParams->field_40 << 16; 12917 LODWORD(v21) = pBLVRenderParams->field_40 << 16;
12927 HIDWORD(v21) = pBLVRenderParams->field_40 >> 16; 12918 HIDWORD(v21) = pBLVRenderParams->field_40 >> 16;
12928 v37 = v21 / x; 12919 v37 = v21 / x;
12929 LODWORD(v31) = v12->scale; 12920 LODWORD(v31) = v12->scale;
12930 v37 = v21 / x; 12921 v37 = v21 / x;
12931 v15->field_0 = (unsigned __int64)(SLODWORD(v31) * v21 / x) >> 16; 12922 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(SLODWORD(v31) * v21 / x) >> 16;
12932 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16; 12923 v37 = (unsigned __int64)(v12->scale * (signed __int64)v37) >> 16;
12933 } 12924 }
12934 else 12925 else
12935 { 12926 {
12936 v17 = &pGame->pIndoorCameraD3D; 12927 v17 = &pGame->pIndoorCameraD3D;
12943 LODWORD(v20) = 0; 12934 LODWORD(v20) = 0;
12944 HIDWORD(v20) = SLOWORD(v25); 12935 HIDWORD(v20) = SLOWORD(v25);
12945 v37 = v20 / x; 12936 v37 = v20 / x;
12946 LODWORD(v31) = v12->scale; 12937 LODWORD(v31) = v12->scale;
12947 v37 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16; 12938 v37 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16;
12948 v15->field_0 = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16; 12939 v15->_screenspace_x_scaler_packedfloat = (unsigned __int64)(SLODWORD(v31) * v20 / x) >> 16;
12949 v31 = v15->fov_y; 12940 v31 = v15->fov_y;
12950 v25 = v31 + 6.7553994e15; 12941 v25 = v31 + 6.7553994e15;
12951 LODWORD(v20) = 0; 12942 LODWORD(v20) = 0;
12952 HIDWORD(v20) = SLOWORD(v25); 12943 HIDWORD(v20) = SLOWORD(v25);
12953 v37 = v20 / x; 12944 v37 = v20 / x;
12954 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16; 12945 v37 = (unsigned __int64)(v12->scale * v20 / x) >> 16;
12955 } 12946 }
12956 HIWORD(v22) = HIWORD(x); 12947 HIWORD(v22) = HIWORD(x);
12957 v15->field_4 = v37; 12948 v15->_screenspace_y_scaler_packedfloat = v37;
12958 v15->field_1E = v30; 12949 v15->field_1E = v30;
12959 v15->some_x = a1; 12950 v15->some_x = a1;
12960 v15->some_y = a2; 12951 v15->some_y = a2;
12961 v15->some_z = a3; 12952 v15->some_z = a3;
12962 v15->uScreenSpaceX = a5; 12953 v15->uScreenSpaceX = a5;
13111 if ( v12 ) 13102 if ( v12 )
13112 { 13103 {
13113 LODWORD(v19) = pBLVRenderParams->field_40 << 16; 13104 LODWORD(v19) = pBLVRenderParams->field_40 << 16;
13114 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16; 13105 HIDWORD(v19) = pBLVRenderParams->field_40 >> 16;
13115 v20 = v19 / x; 13106 v20 = v19 / x;
13116 v3->field_0 = (unsigned __int64)(v24->scale * v19 / x) >> 16; 13107 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * v19 / x) >> 16;
13117 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16; 13108 v31 = (unsigned __int64)(v24->scale * (signed __int64)v20) >> 16;
13118 } 13109 }
13119 else 13110 else
13120 { 13111 {
13121 v3->fov_x = pGame->pIndoorCameraD3D->fov_x; 13112 v3->fov_x = pGame->pIndoorCameraD3D->fov_x;
13122 v3->fov_y = pGame->pIndoorCameraD3D->fov_y; 13113 v3->fov_y = pGame->pIndoorCameraD3D->fov_y;
13123 v18 = (int)floorf(v3->fov_x + 0.5f) / x; 13114 v18 = (int)floorf(v3->fov_x + 0.5f) / x;
13124 v3->field_0 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16; 13115 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v24->scale * (__int64)v18) >> 16;
13125 v31 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16; 13116 v31 = (unsigned __int64)(v24->scale * (__int64)v18) >> 16;
13126 } 13117 }
13127 HIWORD(v21) = HIWORD(x); 13118 HIWORD(v21) = HIWORD(x);
13128 v3->field_4 = v31; 13119 v3->_screenspace_y_scaler_packedfloat = v31;
13129 v3->field_1E = v34; 13120 v3->field_1E = v34;
13130 v3->some_x = a1; 13121 v3->some_x = a1;
13131 v3->some_y = a2; 13122 v3->some_y = a2;
13132 v3->some_z = a3; 13123 v3->some_z = a3;
13133 v3->uScreenSpaceX = v36; 13124 v3->uScreenSpaceX = v36;
13300 } 13291 }
13301 13292
13302 //----- (0044100D) -------------------------------------------------------- 13293 //----- (0044100D) --------------------------------------------------------
13303 bool __cdecl sub_44100D() 13294 bool __cdecl sub_44100D()
13304 { 13295 {
13305 return pCurrentScreen == 4 13296 return pCurrentScreen == SCREEN_NPC_DIALOGUE
13306 || pCurrentScreen == 7 13297 || pCurrentScreen == SCREEN_CHARACTERS
13307 || pCurrentScreen > 12 13298 || pCurrentScreen > SCREEN_LOADGAME
13308 && (pCurrentScreen <= 14 13299 && (pCurrentScreen <= SCREEN_E
13309 || pCurrentScreen > 16 13300 || pCurrentScreen > SCREEN_VIDEO
13310 && (pCurrentScreen <= 18 13301 && (pCurrentScreen <= SCREEN_INPUT_BLV
13311 || pCurrentScreen == 23)); 13302 || pCurrentScreen == SCREEN_CASTING));
13312 } 13303 }
13313 // 4E28F8: using guessed type int pCurrentScreen; 13304 // 4E28F8: using guessed type int pCurrentScreen;
13314 13305
13315 //----- (00441498) -------------------------------------------------------- 13306 //----- (00441498) --------------------------------------------------------
13316 void __cdecl GameUI_DrawTorchlightAndWizardEye() 13307 void __cdecl GameUI_DrawTorchlightAndWizardEye()
13319 IconFrame *v1; // eax@15 13310 IconFrame *v1; // eax@15
13320 unsigned int v2; // eax@19 13311 unsigned int v2; // eax@19
13321 IconFrame *v3; // eax@19 13312 IconFrame *v3; // eax@19
13322 13313
13323 if ( !pCurrentScreen 13314 if ( !pCurrentScreen
13324 || pCurrentScreen == 1 13315 || pCurrentScreen == SCREEN_MENU
13325 || pCurrentScreen == 2 13316 || pCurrentScreen == SCREEN_OPTIONS
13326 || pCurrentScreen == 5 13317 || pCurrentScreen == SCREEN_REST
13327 || pCurrentScreen == 8 13318 || pCurrentScreen == SCREEN_SPELL_BOOK
13328 || pCurrentScreen == 10 13319 || pCurrentScreen == SCREEN_CHEST
13329 || pCurrentScreen == 11 13320 || pCurrentScreen == SCREEN_SAVEGAME
13330 || pCurrentScreen == 12 13321 || pCurrentScreen == SCREEN_LOADGAME
13331 || pCurrentScreen == 15 13322 || pCurrentScreen == SCREEN_F
13332 || pCurrentScreen == 3 13323 || pCurrentScreen == SCREEN_BOOKS
13333 || pCurrentScreen == 19 ) 13324 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
13334 { 13325 {
13335 if ( SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) >= 0 13326 if ( SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) >= 0
13336 && (SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[16].uExpireTime)) ) 13327 && (SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[16].uExpireTime)) )
13337 { 13328 {
13338 v0 = pEventTimer->Time(); 13329 v0 = pEventTimer->Time();
13419 } 13410 }
13420 ++v1; 13411 ++v1;
13421 } 13412 }
13422 while ( v1 < 14 ); 13413 while ( v1 < 14 );
13423 if ( !pCurrentScreen 13414 if ( !pCurrentScreen
13424 || pCurrentScreen == 4 ) 13415 || pCurrentScreen == SCREEN_NPC_DIALOGUE )
13425 { 13416 {
13426 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 ) 13417 if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 )
13427 { 13418 {
13428 if ( pParty->bFlying ) 13419 if ( pParty->bFlying )
13429 v6 = v0; 13420 v6 = v0;
13534 v11 = *((int *)v3 + 1); 13525 v11 = *((int *)v3 + 1);
13535 v13 = v6->scale; 13526 v13 = v6->scale;
13536 v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16; 13527 v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16;
13537 v10.uScreenSpaceX = *((short *)v3 - 2); 13528 v10.uScreenSpaceX = *((short *)v3 - 2);
13538 v10.uScreenSpaceY = *((short *)v3 - 1); 13529 v10.uScreenSpaceY = *((short *)v3 - 1);
13539 v10.field_10 = v13; 13530 v10._screenspace_x_scaler_packedfloat = v13;
13540 v10.field_14 = v13; 13531 v10._screenspace_y_scaler_packedfloat = v13;
13541 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1); 13532 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1);
13542 v8 = *((short *)v3 - 5); 13533 v8 = *((short *)v3 - 5);
13543 v10.sZValue = 0; 13534 v10.sZValue = 0;
13544 v10.uFlags = 0; 13535 v10.uFlags = 0;
13545 v9 = pOverlayList->pOverlays[v8].uOverlayType; 13536 v9 = pOverlayList->pOverlays[v8].uOverlayType;
13560 } 13551 }
13561 13552
13562 13553
13563 13554
13564 //----- (00441D38) -------------------------------------------------------- 13555 //----- (00441D38) --------------------------------------------------------
13565 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags) 13556 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap)
13566 { 13557 {
13567 int uHeight; // ebx@6 13558 int uHeight; // ebx@6
13568 //unsigned int v9; // edx@9
13569 //unsigned int v10; // ebx@10
13570 __int16 v11; // cx@11 13559 __int16 v11; // cx@11
13571 //BLVFace *v12; // ecx@17
13572 //unsigned int v13; // ecx@21
13573 unsigned int v14; // ebx@23 13560 unsigned int v14; // ebx@23
13574 int v15; // eax@23 13561 int v15; // eax@23
13575 //unsigned int *v16; // ecx@28
13576 __int16 v17; // di@30 13562 __int16 v17; // di@30
13577 double v18; // st7@30 13563 double v18; // st7@30
13578 float v19; // ST38_4@30 13564 float v19; // ST38_4@30
13579 double v20; // st7@30 13565 double v20; // st7@30
13580 double v21; // st6@30 13566 double v21; // st6@30
13581 double v22; // st5@33 13567 double v22; // st5@33
13582 //unsigned __int16 *v26; // edx@37
13583 signed int v27; // eax@37 13568 signed int v27; // eax@37
13584 unsigned __int16 *v28; // ecx@37 13569 unsigned __int16 *v28; // ecx@37
13585 signed int v29; // edi@40 13570 signed int v29; // edi@40
13586 //int v30; // eax@42
13587 //unsigned __int16 *v31; // ebx@43
13588 //signed int v32; // edi@46
13589 signed int v33; // ebx@50 13571 signed int v33; // ebx@50
13590 unsigned int v34; // eax@50 13572 unsigned int v34; // eax@50
13591 signed int v35; // ecx@50 13573 signed int v35; // ecx@50
13592 unsigned __int16 v36; // di@66 13574 unsigned __int16 v36; // di@66
13593 int v37; // edi@72 13575 int v37; // edi@72
13601 char *v45; // ebx@106 13583 char *v45; // ebx@106
13602 int v46; // edi@108 13584 int v46; // edi@108
13603 int v47; // eax@108 13585 int v47; // eax@108
13604 unsigned int v48; // ebx@114 13586 unsigned int v48; // ebx@114
13605 unsigned int v49; // ST64_4@114 13587 unsigned int v49; // ST64_4@114
13606 //double v50; // ST20_8@117
13607 unsigned int v51; // [sp-10h] [bp-64h]@79 13588 unsigned int v51; // [sp-10h] [bp-64h]@79
13608 unsigned int v52; // [sp-10h] [bp-64h]@100 13589 unsigned int v52; // [sp-10h] [bp-64h]@100
13609 unsigned int v53; // [sp-Ch] [bp-60h]@79 13590 unsigned int v53; // [sp-Ch] [bp-60h]@79
13610 unsigned int v54; // [sp-Ch] [bp-60h]@100 13591 unsigned int v54; // [sp-Ch] [bp-60h]@100
13611 unsigned int v55; // [sp-8h] [bp-5Ch]@77 13592 unsigned int v55; // [sp-8h] [bp-5Ch]@77
13613 signed int v57; // [sp-4h] [bp-58h]@54 13594 signed int v57; // [sp-4h] [bp-58h]@54
13614 unsigned __int16 v58; // [sp-4h] [bp-58h]@77 13595 unsigned __int16 v58; // [sp-4h] [bp-58h]@77
13615 unsigned __int16 v59; // [sp-4h] [bp-58h]@100 13596 unsigned __int16 v59; // [sp-4h] [bp-58h]@100
13616 unsigned __int16 v60; // [sp+10h] [bp-44h]@66 13597 unsigned __int16 v60; // [sp+10h] [bp-44h]@66
13617 unsigned int v61; // [sp+10h] [bp-44h]@85 13598 unsigned int v61; // [sp+10h] [bp-44h]@85
13618 //unsigned __int16 *v62; // [sp+14h] [bp-40h]@30
13619 unsigned int v63; // [sp+14h] [bp-40h]@85 13599 unsigned int v63; // [sp+14h] [bp-40h]@85
13620 //int v64; // [sp+18h] [bp-3Ch]@39
13621 unsigned int v65; // [sp+18h] [bp-3Ch]@85 13600 unsigned int v65; // [sp+18h] [bp-3Ch]@85
13622 unsigned int lPitch; // [sp+20h] [bp-34h]@1 13601 unsigned int lPitch; // [sp+20h] [bp-34h]@1
13623 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 13602 unsigned int lPitcha; // [sp+20h] [bp-34h]@23
13624 char *lPitchb; // [sp+20h] [bp-34h]@106 13603 char *lPitchb; // [sp+20h] [bp-34h]@106
13625 unsigned int v69; // [sp+24h] [bp-30h]@23 13604 unsigned int v69; // [sp+24h] [bp-30h]@23
13626 signed int v70; // [sp+24h] [bp-30h]@37 13605 signed int v70; // [sp+24h] [bp-30h]@37
13627 unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 13606 unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1
13628 signed int uBluea; // [sp+28h] [bp-2Ch]@37 13607 signed int uBluea; // [sp+28h] [bp-2Ch]@37
13629 int v73; // [sp+2Ch] [bp-28h]@30 13608 int v73; // [sp+2Ch] [bp-28h]@30
13630 //unsigned __int8 *v74; // [sp+30h] [bp-24h]@30
13631 int v76; // [sp+34h] [bp-20h]@91 13609 int v76; // [sp+34h] [bp-20h]@91
13632 int v77; // [sp+34h] [bp-20h]@108 13610 int v77; // [sp+34h] [bp-20h]@108
13633 //signed int v78; // [sp+38h] [bp-1Ch]@37
13634 int v79; // [sp+38h] [bp-1Ch]@72 13611 int v79; // [sp+38h] [bp-1Ch]@72
13635 //signed int a2b; // [sp+40h] [bp-14h]@41
13636 char *a2c; // [sp+40h] [bp-14h]@68 13612 char *a2c; // [sp+40h] [bp-14h]@68
13637 //int a3a; // [sp+44h] [bp-10h]@40
13638 signed int uCenterY; // [sp+48h] [bp-Ch]@1 13613 signed int uCenterY; // [sp+48h] [bp-Ch]@1
13639 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 13614 signed int uCenterX; // [sp+4Ch] [bp-8h]@1
13640 //signed int uZb; // [sp+5Ch] [bp+8h]@27
13641 signed int uWidth; // [sp+5Ch] [bp+8h]@30 13615 signed int uWidth; // [sp+5Ch] [bp+8h]@30
13642 //signed int uZd; // [sp+5Ch] [bp+8h]@45
13643 signed int uZe; // [sp+5Ch] [bp+8h]@67 13616 signed int uZe; // [sp+5Ch] [bp+8h]@67
13644 signed int uZf; // [sp+5Ch] [bp+8h]@85 13617 signed int uZf; // [sp+5Ch] [bp+8h]@85
13645 signed int uZg; // [sp+5Ch] [bp+8h]@105 13618 signed int uZg; // [sp+5Ch] [bp+8h]@105
13646 unsigned int uWa; // [sp+60h] [bp+Ch]@23 13619 unsigned int uWa; // [sp+60h] [bp+Ch]@23
13647 float uWb; // [sp+60h] [bp+Ch]@30 13620 float uWb; // [sp+60h] [bp+Ch]@30
13648 //unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37
13649 unsigned int uWd; // [sp+60h] [bp+Ch]@95 13621 unsigned int uWd; // [sp+60h] [bp+Ch]@95
13650 float uZooma; // [sp+64h] [bp+10h]@117 13622 float uZooma; // [sp+64h] [bp+10h]@117
13651 //signed int flagsa; // [sp+68h] [bp+14h]@42
13652 unsigned int flagsb; // [sp+68h] [bp+14h]@66 13623 unsigned int flagsb; // [sp+68h] [bp+14h]@66
13653 Actor *flagsc; // [sp+68h] [bp+14h]@86 13624 Actor *flagsc; // [sp+68h] [bp+14h]@86
13654 unsigned int flagsd; // [sp+68h] [bp+14h]@105 13625 unsigned int flagsd; // [sp+68h] [bp+14h]@105
13655 13626
13656 //a3 = uY;
13657 //a2 = uX;
13658 uCenterX = (uX + uZ) / 2; 13627 uCenterX = (uX + uZ) / 2;
13659 uCenterY = (uY + uW) / 2; 13628 uCenterY = (uY + uW) / 2;
13660 lPitch = pRenderer->uTargetSurfacePitch; 13629 lPitch = pRenderer->uTargetSurfacePitch;
13661 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); 13630 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0);
13662 uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); 13631 uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
13708 } 13677 }
13709 break; 13678 break;
13710 13679
13711 default: assert(false); 13680 default: assert(false);
13712 } 13681 }
13713 //LABEL_37: 13682 assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short));
13714 //v23 = v20 * 65536.0; 13683
13715 //v24 = v23 + 6.7553994e15;
13716 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); 13684 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24);
13717 //uWe = uWb * 65536.0;
13718 //v25 = uWe + 6.7553994e15;
13719 //v78 = v70;
13720 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); 13685 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25);
13721 v27 = uBluea >> 16; 13686 v27 = uBluea >> 16;
13722 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; 13687 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch];
13723 if ( flags && pMapLod0) 13688 if (pMapLod0 && bRedrawOdmMinimap)
13724 { 13689 {
13725 auto pMinimap = (unsigned __int16 *)_56EFD8_minimap; 13690 assert(uWidth == 137 && uHeight == 117);
13726 //if ( v74 ) 13691 //auto pMinimap = (unsigned __int16 *)pOdmMinimap;
13727 //{ 13692
13728 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 13693 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
13729 //if ( uHeight > 0 ) 13694
13730 //{
13731 //a3a = uHeight;
13732 v29 = v70 >> 16; 13695 v29 = v70 >> 16;
13733 //do 13696
13734 for (int y = 0; y < uHeight; ++y) 13697 for (int y = 0; y < uHeight; ++y)
13735 { 13698 {
13736 //a2b = 0;
13737 //if ( uWidth > 0 )
13738 //{
13739 auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; 13699 auto pMapLod0Line = &pMapLod0[v27 * mapWidth];
13740 //flagsa = uWidth;
13741 //a2b = uWidth;
13742 for (int x = 0; x < uWidth; ++x) 13700 for (int x = 0; x < uWidth; ++x)
13743 //do
13744 { 13701 {
13745 //v31 = uWc; 13702 //*pMinimap++ = pPal[pMapLod0Line[v29]];
13746 //++uWc; 13703 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]];
13747 *pMinimap++ = pPal[pMapLod0Line[v29]];
13748 //v78 += v73;
13749 v29 = (v70 + x * v73) >> 16; 13704 v29 = (v70 + x * v73) >> 16;
13750 //--flagsa;
13751 } 13705 }
13752 //while ( flagsa ); 13706
13753 //}
13754 //v78 = v70;
13755 v29 = v70 >> 16; 13707 v29 = v70 >> 16;
13756 v28 += 137 - uWidth; 13708 v28 += 137 - uWidth;
13757 uBluea += v73; 13709 uBluea += v73;
13758 v27 = uBluea >> 16; 13710 v27 = uBluea >> 16;
13759 //--a3a;
13760 } 13711 }
13761 //while ( a3a ); 13712 }
13762 //} 13713
13763 //}
13764 }
13765
13766 auto pMinimap = (unsigned __int16 *)_56EFD8_minimap;
13767 //uZd = 117;
13768 //do
13769 for (int y = 0; y < 117; ++y) 13714 for (int y = 0; y < 117; ++y)
13770 { 13715 {
13771 //v32 = 137;
13772 //do
13773 for (int x = 0; x < 137; ++x) 13716 for (int x = 0; x < 137; ++x)
13774 { 13717 {
13775 *v28++ = *pMinimap++; 13718 *v28++ = pOdmMinimap[y][x];
13776 //++v28; 13719 }
13777 //++v26;
13778 //--v32;
13779 }
13780 //while ( v32 );
13781 v28 += lPitch - 137; 13720 v28 += lPitch - 137;
13782 //--uZd; 13721 }
13783 }
13784 //while ( uZd );
13785 uNumBlueFacesInBLVMinimap = 0; 13722 uNumBlueFacesInBLVMinimap = 0;
13786 } 13723 }
13787 else 13724 else
13788 { 13725 {
13789 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); 13726 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF);
13917 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, 13854 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3,
13918 (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0)); 13855 (Texture *)(pTextureIDs_pMapDirs[v35] != -1 ? &pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v35]] : 0));
13919 v36 = 255; 13856 v36 = 255;
13920 flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); 13857 flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
13921 v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); 13858 v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
13922 if ( bWizardEyeActive ) 13859 if ( bWizardEyeActive = true)
13923 { 13860 {
13924 uZe = 0; 13861 uZe = 0;
13925 //for (uint i = 0; i < uNumLayingItems; ++i) 13862 //for (uint i = 0; i < uNumLayingItems; ++i)
13926 if (uNumLayingItems > 0) 13863 if (uNumLayingItems > 0)
13927 { 13864 {
16340 v55 = (unsigned short *)&pActors[0].uAIState; 16277 v55 = (unsigned short *)&pActors[0].uAIState;
16341 *(int *)v54 = uNumActors; 16278 *(int *)v54 = uNumActors;
16342 do 16279 do
16343 { 16280 {
16344 v30 = *v55; 16281 v30 = *v55;
16345 if ( *v55 == 5 || v30 == 11 || v30 == 19 || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == 4 ) 16282 if ( *v55 == Dead || v30 == Removed || v30 == Disabled || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == OBJECT_Player)
16346 ++pInString; 16283 ++pInString;
16347 v55 += 418; 16284 v55 += 418;
16348 --*(int *)v54; 16285 --*(int *)v54;
16349 } 16286 }
16350 while ( *(int *)v54 ); 16287 while ( *(int *)v54 );
17995 else 17932 else
17996 { 17933 {
17997 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); 17934 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1);
17998 sub_44987B(v99, 0); 17935 sub_44987B(v99, 0);
17999 v133 = 1; 17936 v133 = 1;
18000 if ( pCurrentScreen == 13 ) 17937 if ( pCurrentScreen == SCREEN_HOUSE )
18001 { 17938 {
18002 if ( uGameState == 2 ) 17939 if ( uGameState == 2 )
18003 { 17940 {
18004 pAudioPlayer->StopChannels(-1, -1); 17941 pAudioPlayer->StopChannels(-1, -1);
18005 dword_F8B19C = 0; 17942 dword_F8B19C = 0;
18008 pVideoPlayer->Unload(); 17945 pVideoPlayer->Unload();
18009 ptr_507BC0->Release(); 17946 ptr_507BC0->Release();
18010 ptr_507BC0 = 0; 17947 ptr_507BC0 = 0;
18011 if ( pMessageQueue_50CBD0->uNumMessages ) 17948 if ( pMessageQueue_50CBD0->uNumMessages )
18012 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 17949 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
18013 pCurrentScreen = 0; 17950 pCurrentScreen = SCREEN_GAME;
18014 viewparams->bRedrawGameUI = 1; 17951 viewparams->bRedrawGameUI = 1;
18015 array_5913D8[6] = 0; 17952 array_5913D8[6] = 0;
18016 pDialogueWindow->Release(); 17953 pDialogueWindow->Release();
18017 dword_F8B19C = 0; 17954 dword_F8B19C = 0;
18018 pDialogueWindow = 0; 17955 pDialogueWindow = 0;
19498 _5B65B8_npcdata_hiword_house_or_other = 0; 19435 _5B65B8_npcdata_hiword_house_or_other = 0;
19499 dword_5B65BC = 0; 19436 dword_5B65BC = 0;
19500 dword_5B65C0 = 0; 19437 dword_5B65C0 = 0;
19501 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; 19438 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
19502 sub_44987B("nwc.blv", 0); 19439 sub_44987B("nwc.blv", 0);
19503 pCurrentScreen = 0; 19440 pCurrentScreen = SCREEN_GAME;
19504 result = 1; 19441 result = 1;
19505 } 19442 }
19506 return result; 19443 return result;
19507 } 19444 }
19508 19445
20440 Actor::_401221(uActorID, &dword_4F6E08[uActorID], 1u); 20377 Actor::_401221(uActorID, &dword_4F6E08[uActorID], 1u);
20441 if ( v21->pMonsterInfo.uHostilityType && !*v20 ) 20378 if ( v21->pMonsterInfo.uHostilityType && !*v20 )
20442 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 20379 v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
20443 a2 = *v20; 20380 a2 = *v20;
20444 v76 = a2 & 7; 20381 v76 = a2 & 7;
20445 if ( (a2 & 7) == 3 ) 20382 if ( (a2 & 7) == OBJECT_Actor)
20446 v80 = 0.5; 20383 v80 = 0.5;
20447 else 20384 else
20448 v80 = 1.0; 20385 v80 = 1.0;
20449 v22 = v21->uAIState; 20386 v22 = v21->uAIState;
20450 if ( v22 == 4 || v22 == 5 || v22 == 11 || v22 == 19 || v22 == 17 ) 20387 if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned)
20451 goto LABEL_254; 20388 goto LABEL_254;
20452 if ( !v21->sCurrentHP ) 20389 if ( !v21->sCurrentHP )
20453 Actor::Die(uActorID); 20390 Actor::Die(uActorID);
20454 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime <= 0 ) 20391 if ( (signed __int64)v21->pActorBuffs[3].uExpireTime <= 0 )
20455 { 20392 {
20963 if ( this->uActorQueueSize > 0 ) 20900 if ( this->uActorQueueSize > 0 )
20964 { 20901 {
20965 v2 = this->pQueue; 20902 v2 = this->pQueue;
20966 do 20903 do
20967 { 20904 {
20968 if ( (v2->uPackedID & 7) == 3 ) 20905 if ( (v2->uPackedID & 7) == OBJECT_Actor )
20969 { 20906 {
20970 v3 = &pActors[v2->uPackedID >> 3]; 20907 v3 = &pActors[v2->uPackedID >> 3];
20971 v4 = &pActors[v2->uPackedID >> 3]; 20908 v4 = &pActors[v2->uPackedID >> 3];
20972 LOBYTE(v4->uAttributes) |= 0x80u; 20909 LOBYTE(v4->uAttributes) |= 0x80u;
20973 if ( !v4->CanAct() ) 20910 if ( !v4->CanAct() )
20975 --v19; 20912 --v19;
20976 v2->field_4 = 1001; 20913 v2->field_4 = 1001;
20977 LOBYTE(v3->uAttributes) &= 0x7Fu; 20914 LOBYTE(v3->uAttributes) &= 0x7Fu;
20978 } 20915 }
20979 } 20916 }
20980 if ( (v2->uPackedID & 7) == 4 ) 20917 if ( (v2->uPackedID & 7) == OBJECT_Player)
20981 { 20918 {
20982 v5 = &pParty->pPlayers[v2->uPackedID >> 3]; 20919 v5 = &pParty->pPlayers[v2->uPackedID >> 3];
20983 if ( v5->pConditions[14] 20920 if ( v5->pConditions[14]
20984 || v5->pConditions[16] 20921 || v5->pConditions[16]
20985 || v5->pConditions[15] 20922 || v5->pConditions[15]
21011 { 20948 {
21012 v9 = v8->field_4; 20949 v9 = v8->field_4;
21013 v10 = v7->field_4; 20950 v10 = v7->field_4;
21014 if ( v9 < v10 20951 if ( v9 < v10
21015 || v9 == v10 20952 || v9 == v10
21016 && ((v11 = v8->uPackedID & 7, v11 == 4) && (v7->uPackedID & 7) == 3 20953 && ((v11 = v8->uPackedID & 7, v11 == OBJECT_Player) && (v7->uPackedID & 7) == OBJECT_Actor
21017 || v11 == (v7->uPackedID & 7) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) ) 20954 || v11 == (v7->uPackedID & 7) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) )
21018 { 20955 {
21019 v12 = v7->uPackedID; 20956 v12 = v7->uPackedID;
21020 v13 = v7->field_4; 20957 v13 = v7->field_4;
21021 v14 = v7->uActionLength; 20958 v14 = v7->uActionLength;
21040 } 20977 }
21041 while ( v21 - 1 < v6 ); 20978 while ( v21 - 1 < v6 );
21042 } 20979 }
21043 v1->uActorQueueSize = v19; 20980 v1->uActorQueueSize = v19;
21044 result = v1->pQueue[0].uPackedID; 20981 result = v1->pQueue[0].uPackedID;
21045 if ( (v1->pQueue[0].uPackedID & 7) == 4 ) 20982 if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player)
21046 { 20983 {
21047 result = (result >> 3) + 1; 20984 result = (result >> 3) + 1;
21048 uActiveCharacter = result; 20985 uActiveCharacter = result;
21049 v1->field_18 |= 4u; 20986 v1->field_18 |= 4u;
21050 } 20987 }
21057 if ( v1->uActorQueueSize > 0 ) 20994 if ( v1->uActorQueueSize > 0 )
21058 { 20995 {
21059 v17 = v1->pQueue; 20996 v17 = v1->pQueue;
21060 do 20997 do
21061 { 20998 {
21062 if ( (v17->uPackedID & 7) == 4 ) 20999 if ( (v17->uPackedID & 7) == OBJECT_Player)
21063 pParty->pPlayers[v17->uPackedID >> 3].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875); 21000 pParty->pPlayers[v17->uPackedID >> 3].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875);
21064 ++v22; 21001 ++v22;
21065 ++v17; 21002 ++v17;
21066 result = v22; 21003 result = v22;
21067 } 21004 }