comparison mm7_3.cpp @ 717:d5473972234d

m
author Ritor1
date Mon, 18 Mar 2013 01:50:50 +0600
parents c0bfb386b15f
children a5ee769b02c6
comparison
equal deleted inserted replaced
716:964323fa0d25 717:d5473972234d
54 54
55 55
56 //----- (0046E44E) -------------------------------------------------------- 56 //----- (0046E44E) --------------------------------------------------------
57 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1) 57 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1)
58 { 58 {
59 BLVSector *v1; // edi@1 59 BLVSector *pSector; // edi@1
60 signed int v2; // ebx@1 60 signed int v2; // ebx@1
61 BLVFace *v3; // esi@2 61 BLVFace *pFace; // esi@2
62 __int16 v4; // si@10 62 __int16 pNextSector; // si@10
63 int v5; // ecx@12 63 int pArrayNum; // ecx@12
64 unsigned __int8 v6; // sf@12 64 unsigned __int8 v6; // sf@12
65 unsigned __int8 v7; // of@12 65 unsigned __int8 v7; // of@12
66 int result; // eax@14 66 int result; // eax@14
67 BLVSector *v9; // ebx@15 67 //BLVSector *v9; // ebx@15
68 int v10; // ecx@15 68 int v10; // ecx@15
69 int v11; // eax@16 69 int pFloor; // eax@16
70 BLVFace *v12; // ebp@16 70 //BLVFace *v12; // ebp@16
71 int v13; // eax@24 71 int v13; // eax@24
72 int v14; // esi@24 72 int v14; // esi@24
73 int v15; // eax@24 73 int v15; // eax@24
74 int v16; // edx@25 74 int v16; // edx@25
75 int v17; // eax@29 75 int v17; // eax@29
86 int a10; // [sp+1Ch] [bp-3Ch]@1 86 int a10; // [sp+1Ch] [bp-3Ch]@1
87 int v29; // [sp+20h] [bp-38h]@14 87 int v29; // [sp+20h] [bp-38h]@14
88 int v30; // [sp+24h] [bp-34h]@35 88 int v30; // [sp+24h] [bp-34h]@35
89 int v31; // [sp+28h] [bp-30h]@24 89 int v31; // [sp+28h] [bp-30h]@24
90 int v32; // [sp+2Ch] [bp-2Ch]@15 90 int v32; // [sp+2Ch] [bp-2Ch]@15
91 int v33[10]; // [sp+30h] [bp-28h]@1 91 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1
92 92
93 v1 = &pIndoor->pSectors[stru_721530.uSectorID]; 93 pSector = &pIndoor->pSectors[stru_721530.uSectorID];
94 v2 = 0; 94 v2 = 0;
95 a10 = b1; 95 a10 = b1;
96 v33[0] = stru_721530.uSectorID; 96 pSectorsArray[0] = stru_721530.uSectorID;
97 for ( i = 1; v2 < v1->uNumPortals; ++v2 ) 97 for ( i = 1; v2 < pSector->uNumPortals; ++v2 )
98 { 98 {
99 v3 = &pIndoor->pFaces[v1->pPortals[v2]]; 99 pFace = &pIndoor->pFaces[pSector->pPortals[v2]];
100 if ( stru_721530.sMaxX <= v3->pBounding.x2 100 if ( stru_721530.sMaxX <= pFace->pBounding.x2
101 && stru_721530.sMinX >= v3->pBounding.x1 101 && stru_721530.sMinX >= pFace->pBounding.x1
102 && stru_721530.sMaxY <= v3->pBounding.y2 102 && stru_721530.sMaxY <= pFace->pBounding.y2
103 && stru_721530.sMinY >= v3->pBounding.y1 103 && stru_721530.sMinY >= pFace->pBounding.y1
104 && stru_721530.sMaxZ <= v3->pBounding.z2 104 && stru_721530.sMaxZ <= pFace->pBounding.z2
105 && stru_721530.sMinZ >= v3->pBounding.z1 105 && stru_721530.sMinZ >= pFace->pBounding.z1
106 && abs((v3->pFacePlane_old.dist 106 && abs((pFace->pFacePlane_old.dist
107 + stru_721530.normal.x * v3->pFacePlane_old.vNormal.x 107 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
108 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y 108 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
109 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) 109 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
110 { 110 {
111 v4 = v3->uSectorID == stru_721530.uSectorID ? v3->uBackSectorID : v3->uSectorID; 111 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID
112 v5 = i++; 112 pArrayNum = i++;
113 v7 = __OFSUB__(i, 10); 113 v7 = i < 10;
114 v6 = i - 10 < 0; 114 v6 = i - 10 < 0;
115 v33[v5] = v4; 115 pSectorsArray[pArrayNum] = pNextSector;
116 if ( !(v6 ^ v7) ) 116 if ( !(v6 ^ v7) )
117 break; 117 break;
118 } 118 }
119 } 119 }
120 result = 0; 120 result = 0;
121 v29 = 0; 121 v29 = 0;
122 if ( i > 0 ) 122 if ( i > 0 )
123 { 123 {
124 while ( 1 ) 124 while ( 1 )
125 { 125 {
126 v9 = &pIndoor->pSectors[v33[result]]; 126 pSector = &pIndoor->pSectors[pSectorsArray[result]];
127 v10 = 0; 127 v10 = 0;
128 v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings; 128 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings;
129 v26 = 0; 129 v26 = 0;
130 if ( v32 > 0 ) 130 if ( v32 > 0 )
131 break; 131 break;
132 LABEL_46: 132 LABEL_46:
133 result = v29++ + 1; 133 result = v29++ + 1;
134 if ( v29 >= i ) 134 if ( v29 >= i )
135 return result; 135 return result;
136 } 136 }
137 while ( 1 ) 137 while ( 1 )
138 { 138 {
139 v11 = v9->pFloors[v10]; 139 pFloor = pSector->pFloors[v10];
140 v12 = &pIndoor->pFaces[v11]; 140 pFace = &pIndoor->pFaces[pFloor];
141 if ( v12->Portal() 141 if ( pFace->Portal()
142 || stru_721530.sMaxX > v12->pBounding.x2 142 || stru_721530.sMaxX > pFace->pBounding.x2
143 || stru_721530.sMinX < v12->pBounding.x1 143 || stru_721530.sMinX < pFace->pBounding.x1
144 || stru_721530.sMaxY > v12->pBounding.y2 144 || stru_721530.sMaxY > pFace->pBounding.y2
145 || stru_721530.sMinY < v12->pBounding.y1 145 || stru_721530.sMinY < pFace->pBounding.y1
146 || stru_721530.sMaxZ > v12->pBounding.z2 146 || stru_721530.sMaxZ > pFace->pBounding.z2
147 || stru_721530.sMinZ < v12->pBounding.z1 147 || stru_721530.sMinZ < pFace->pBounding.z1
148 || v11 == stru_721530.field_84 ) 148 || pFloor == stru_721530.field_84 )
149 goto LABEL_45; 149 goto LABEL_45;
150 v13 = v12->pFacePlane_old.vNormal.y; 150 v13 = pFace->pFacePlane_old.vNormal.y;
151 v14 = v12->pFacePlane_old.dist; 151 v14 = pFace->pFacePlane_old.dist;
152 v31 = v13; 152 v31 = v13;
153 v15 = (stru_721530.normal.x * v12->pFacePlane_old.vNormal.x 153 v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13
154 + v14 154 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16;
155 + stru_721530.normal.y * v13
156 + stru_721530.normal.z * v12->pFacePlane_old.vNormal.z) >> 16;
157 if ( v15 > 0 ) 155 if ( v15 > 0 )
158 { 156 {
159 v16 = (stru_721530.normal2.y * v31 157 v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z
160 + v12->pFacePlane_old.dist 158 + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16;
161 + stru_721530.normal2.z * v12->pFacePlane_old.vNormal.z
162 + stru_721530.normal2.x * v12->pFacePlane_old.vNormal.x) >> 16;
163 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) 159 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
164 { 160 {
165 if ( v16 <= v15 ) 161 if ( v16 <= v15 )
166 { 162 {
167 a3 = stru_721530.field_6C; 163 a3 = stru_721530.field_6C;
168 if ( sub_47531C( 164 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
169 stru_721530.prolly_normal_d, 165 stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
170 &a3,
171 stru_721530.normal.x,
172 stru_721530.normal.y,
173 stru_721530.normal.z,
174 stru_721530.field_58.x,
175 stru_721530.field_58.y,
176 stru_721530.field_58.z,
177 v12,
178 a10) )
179 { 166 {
180 v17 = a3; 167 v17 = a3;
181 } 168 }
182 else 169 else
183 { 170 {
184 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d; 171 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
185 if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v12) ) 172 if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) )
186 goto LABEL_34; 173 goto LABEL_34;
187 v17 = a3 - stru_721530.prolly_normal_d; 174 v17 = a3 - stru_721530.prolly_normal_d;
188 a3 -= stru_721530.prolly_normal_d; 175 a3 -= stru_721530.prolly_normal_d;
189 } 176 }
190 if ( v17 < stru_721530.field_7C ) 177 if ( v17 < stru_721530.field_7C )
191 { 178 {
192 stru_721530.field_7C = v17; 179 stru_721530.field_7C = v17;
193 v18 = 8 * v9->pFloors[v26]; 180 v18 = 8 * pSector->pFloors[v26];
194 LOBYTE(v18) = v18 | 6; 181 LOBYTE(v18) = v18 | 6;
195 stru_721530.uFaceID = v18; 182 stru_721530.uFaceID = v18;
196 } 183 }
197 } 184 }
198 } 185 }
199 } 186 }
200 LABEL_34: 187 LABEL_34:
201 if ( !(stru_721530.field_0 & 1) 188 if ( !(stru_721530.field_0 & 1)
202 || (v19 = v12->pFacePlane_old.vNormal.x, 189 || (v19 = pFace->pFacePlane_old.vNormal.x,
203 v20 = v12->pFacePlane_old.vNormal.y, 190 v20 = pFace->pFacePlane_old.vNormal.y,
204 v30 = v19, 191 v30 = v19,
205 v21 = (stru_721530.field_34.x * v19 192 v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20
206 + v12->pFacePlane_old.dist 193 + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16,
207 + stru_721530.field_34.y * v20
208 + stru_721530.field_34.z * v12->pFacePlane_old.vNormal.z) >> 16,
209 v21 <= 0) 194 v21 <= 0)
210 || (v22 = (stru_721530.field_4C * v30 195 || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20
211 + v12->pFacePlane_old.dist 196 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16,
212 + stru_721530.field_50 * v20
213 + stru_721530.field_54 * v12->pFacePlane_old.vNormal.z) >> 16,
214 v21 > stru_721530.prolly_normal_d) 197 v21 > stru_721530.prolly_normal_d)
215 && v22 > stru_721530.prolly_normal_d 198 && v22 > stru_721530.prolly_normal_d
216 || v22 > v21 ) 199 || v22 > v21 )
217 goto LABEL_45; 200 goto LABEL_45;
218 a3 = stru_721530.field_6C; 201 a3 = stru_721530.field_6C;
219 if ( sub_47531C( 202 if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z,
220 stru_721530.field_8, 203 stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
221 &a3,
222 stru_721530.field_34.x,
223 stru_721530.field_34.y,
224 stru_721530.field_34.z,
225 stru_721530.field_58.x,
226 stru_721530.field_58.y,
227 stru_721530.field_58.z,
228 v12,
229 a10) )
230 { 204 {
231 v23 = a3; 205 v23 = a3;
232 goto LABEL_43; 206 goto LABEL_43;
233 } 207 }
234 a3 = stru_721530.field_6C + stru_721530.field_8; 208 a3 = stru_721530.field_6C + stru_721530.field_8;
235 if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, v12) ) 209 if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) )
236 { 210 {
237 v23 = a3 - stru_721530.prolly_normal_d; 211 v23 = a3 - stru_721530.prolly_normal_d;
238 a3 -= stru_721530.prolly_normal_d; 212 a3 -= stru_721530.prolly_normal_d;
239 LABEL_43: 213 LABEL_43:
240 if ( v23 < stru_721530.field_7C ) 214 if ( v23 < stru_721530.field_7C )
241 { 215 {
242 stru_721530.field_7C = v23; 216 stru_721530.field_7C = v23;
243 v24 = 8 * v9->pFloors[v26]; 217 v24 = 8 * pSector->pFloors[v26];
244 LOBYTE(v24) = v24 | 6; 218 LOBYTE(v24) = v24 | 6;
245 stru_721530.uFaceID = v24; 219 stru_721530.uFaceID = v24;
246 } 220 }
247 } 221 }
248 LABEL_45: 222 LABEL_45:
1629 int _view_angle; // [sp+40h] [bp-20h]@47 1603 int _view_angle; // [sp+40h] [bp-20h]@47
1630 int bJumping; // [sp+44h] [bp-1Ch]@1 1604 int bJumping; // [sp+44h] [bp-1Ch]@1
1631 int new_party_y; // [sp+48h] [bp-18h]@1 1605 int new_party_y; // [sp+48h] [bp-18h]@1
1632 int new_party_x; // [sp+4Ch] [bp-14h]@1 1606 int new_party_x; // [sp+4Ch] [bp-14h]@1
1633 int party_z; // [sp+50h] [bp-10h]@1 1607 int party_z; // [sp+50h] [bp-10h]@1
1634 int v89; // [sp+58h] [bp-8h]@1 1608 //int v89; // [sp+58h] [bp-8h]@1
1635 int angle; // [sp+5Ch] [bp-4h]@47 1609 int angle; // [sp+5Ch] [bp-4h]@47
1636 1610
1637 uFaceEvent = 0; 1611 uFaceEvent = 0;
1638 v89 = pParty->uFallSpeed; 1612 //v89 = pParty->uFallSpeed;
1639 v1 = 0; 1613 v1 = 0;
1640 new_party_y = pParty->vPosition.y;
1641 v2 = 0; 1614 v2 = 0;
1642 new_party_x = pParty->vPosition.x; 1615 new_party_x = pParty->vPosition.x;
1616 new_party_y = pParty->vPosition.y;
1643 party_z = pParty->vPosition.z; 1617 party_z = pParty->vPosition.z;
1644 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 1618 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
1645 v72 = 0; 1619 v72 = 0;
1646 v78 = 0; 1620 v78 = 0;
1647 v71 = 0; 1621 v71 = 0;
1728 pParty->uFallStartY = party_z; 1702 pParty->uFallStartY = party_z;
1729 if ( bWalkSound && pParty->field_6F8 > 0 ) 1703 if ( bWalkSound && pParty->field_6F8 > 0 )
1730 pParty->field_6F8 -= pEventTimer->uTimeElapsed; 1704 pParty->field_6F8 -= pEventTimer->uTimeElapsed;
1731 if ( party_z > v80 + 1 ) 1705 if ( party_z > v80 + 1 )
1732 { 1706 {
1733 LABEL_43:
1734 if ( bJumping ) 1707 if ( bJumping )
1735 goto LABEL_45; 1708 goto LABEL_45;
1736 goto LABEL_44; 1709 goto LABEL_44;
1737 } 1710 }
1738 party_z = v80 + 1; 1711 party_z = v80 + 1;
1743 { 1716 {
1744 auto pFace = &pIndoor->pFaces[uFaceID]; 1717 auto pFace = &pIndoor->pFaces[uFaceID];
1745 if (pFace->uAttributes & 0x04000000 ) 1718 if (pFace->uAttributes & 0x04000000 )
1746 { 1719 {
1747 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; 1720 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
1748 goto LABEL_43; 1721 if ( bJumping )
1722 goto LABEL_45;
1723 goto LABEL_44;
1749 } 1724 }
1750 } 1725 }
1751 LABEL_44: 1726 LABEL_44:
1752 pParty->field_6F4_packedid = uFaceID; 1727 pParty->field_6F4_packedid = uFaceID;
1753 LABEL_45: 1728 LABEL_45:
1768 case PARTY_TurnLeft: 1743 case PARTY_TurnLeft:
1769 v12 = uTurnSpeed; 1744 v12 = uTurnSpeed;
1770 if ( uTurnSpeed ) 1745 if ( uTurnSpeed )
1771 goto LABEL_58; 1746 goto LABEL_58;
1772 v13 = (double)v82 * fTurnSpeedMultiplier; 1747 v13 = (double)v82 * fTurnSpeedMultiplier;
1773 goto LABEL_51; 1748 v14 = angle + (unsigned __int64)(signed __int64)v13;
1749 angle = stru_5C6E00->uDoublePiMask & v14;
1750 goto LABEL_87;
1774 case PARTY_TurnRight: 1751 case PARTY_TurnRight:
1775 LODWORD(v15) = uTurnSpeed; 1752 LODWORD(v15) = uTurnSpeed;
1776 if ( uTurnSpeed ) 1753 if ( uTurnSpeed )
1777 goto LABEL_56; 1754 {
1755 angle = stru_5C6E00->uDoublePiMask & (angle - v15);
1756 goto LABEL_87;
1757 }
1778 v16 = (double)v82 * fTurnSpeedMultiplier; 1758 v16 = (double)v82 * fTurnSpeedMultiplier;
1779 goto LABEL_55; 1759 //{
1760 v15 = (signed __int64)v16;
1761 angle = stru_5C6E00->uDoublePiMask & (angle - v15);
1762 goto LABEL_87;
1763 //}
1780 case PARTY_FastTurnLeft: 1764 case PARTY_FastTurnLeft:
1781 v12 = uTurnSpeed; 1765 v12 = uTurnSpeed;
1782 if ( uTurnSpeed ) 1766 if ( uTurnSpeed )
1783 { 1767 {
1784 LABEL_58: 1768 LABEL_58:
1785 v14 = angle + v12; 1769 v14 = angle + v12;
1786 } 1770 }
1787 else 1771 else
1788 { 1772 {
1789 v13 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82; 1773 v13 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
1790 LABEL_51:
1791 v14 = angle + (unsigned __int64)(signed __int64)v13; 1774 v14 = angle + (unsigned __int64)(signed __int64)v13;
1792 } 1775 }
1793 angle = stru_5C6E00->uDoublePiMask & v14; 1776 angle = stru_5C6E00->uDoublePiMask & v14;
1794 goto LABEL_87; 1777 goto LABEL_87;
1795 case PARTY_FastTurnRight: 1778 case PARTY_FastTurnRight:
1796 LODWORD(v15) = uTurnSpeed; 1779 LODWORD(v15) = uTurnSpeed;
1797 if ( !uTurnSpeed ) 1780 if ( !uTurnSpeed )
1798 { 1781 {
1799 v16 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82; 1782 v16 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
1800 LABEL_55:
1801 v15 = (signed __int64)v16; 1783 v15 = (signed __int64)v16;
1802 } 1784 }
1803 LABEL_56:
1804 angle = stru_5C6E00->uDoublePiMask & (angle - v15); 1785 angle = stru_5C6E00->uDoublePiMask & (angle - v15);
1805 goto LABEL_87; 1786 goto LABEL_87;
1806 case PARTY_StrafeLeft: 1787 case PARTY_StrafeLeft://Ctrl + <-
1807 __debugbreak(); 1788 __debugbreak();
1808 v17 = stru_5C6E00->Sin(angle); 1789 v17 = stru_5C6E00->Sin(angle);
1809 v18 = (double)v81; 1790 v18 = (double)v81;
1810 //v88 = v18; 1791 //v88 = v18;
1811 v78 = (unsigned __int64)(v17 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; 1792 v78 = (unsigned __int64)(v17 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
1812 v2 -= v78; 1793 v2 -= v78;
1813 v19 = stru_5C6E00->Cos(angle); 1794 v19 = stru_5C6E00->Cos(angle);
1814 v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16; 1795 v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
1815 goto LABEL_63; 1796 v1 += v78;
1797 v78 = 1;
1798 goto LABEL_87;
1816 case PARTY_StrafeRight: 1799 case PARTY_StrafeRight:
1817 __debugbreak(); 1800 __debugbreak();
1818 v20 = stru_5C6E00->Sin(angle); 1801 v20 = stru_5C6E00->Sin(angle);
1819 v21 = (double)v81; 1802 v21 = (double)v81;
1820 //v88 = v21; 1803 //v88 = v21;
1821 v78 = (unsigned __int64)(v20 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; 1804 v78 = (unsigned __int64)(v20 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
1822 v2 += v78; 1805 v2 += v78;
1823 v22 = stru_5C6E00->Cos(angle); 1806 v22 = stru_5C6E00->Cos(angle);
1824 v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16; 1807 v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
1825 goto LABEL_68; 1808 //goto LABEL_68;
1809 v1 -= v78;
1810 v78 = 1;
1811 goto LABEL_87;
1826 case PARTY_WalkForward: 1812 case PARTY_WalkForward:
1827 __debugbreak(); 1813 __debugbreak();
1828 v23 = stru_5C6E00->Cos(angle); 1814 v23 = stru_5C6E00->Cos(angle);
1829 v24 = (double)v81; 1815 v24 = (double)v81;
1830 //v88 = v24; 1816 //v88 = v24;
1831 v78 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; 1817 v78 = (unsigned __int64)(v23 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
1832 v2 += v78; 1818 v2 += v78;
1833 v25 = stru_5C6E00->Sin(angle); 1819 v25 = stru_5C6E00->Sin(angle);
1834 v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16; 1820 v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
1835 LABEL_63:
1836 v1 += v78; 1821 v1 += v78;
1837 goto LABEL_64; 1822 v78 = 1;
1823 goto LABEL_87;
1838 case PARTY_WalkBackward: 1824 case PARTY_WalkBackward:
1839 __debugbreak(); 1825 __debugbreak();
1840 v26 = stru_5C6E00->Cos(angle); 1826 v26 = stru_5C6E00->Cos(angle);
1841 v27 = (double)v81; 1827 v27 = (double)v81;
1842 //v88 = v27; 1828 //v88 = v27;
1843 v78 = (unsigned __int64)(v26 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; 1829 v78 = (unsigned __int64)(v26 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
1844 v2 -= v78; 1830 v2 -= v78;
1845 v28 = stru_5C6E00->Sin(angle); 1831 v28 = stru_5C6E00->Sin(angle);
1846 v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; 1832 v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
1847 LABEL_68:
1848 v1 -= v78; 1833 v1 -= v78;
1849 LABEL_64:
1850 v78 = 1; 1834 v78 = 1;
1851 goto LABEL_87; 1835 goto LABEL_87;
1852 case PARTY_RunForward: 1836 case PARTY_RunForward:
1853 //v29 = stru_5C6E00->Cos(angle); 1837 //v29 = stru_5C6E00->Cos(angle);
1854 //v30 = (double)v81; 1838 //v30 = (double)v81;
1863 //v33 = (double)v81; 1847 //v33 = (double)v81;
1864 //v88 = (double)v81; 1848 //v88 = (double)v81;
1865 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; 1849 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
1866 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); 1850 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
1867 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; 1851 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
1868 //LABEL_70:
1869 v72 = 1; 1852 v72 = 1;
1870 goto LABEL_87; 1853 goto LABEL_87;
1871 case PARTY_LookUp: 1854 case PARTY_LookUp:
1872 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); 1855 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
1873 if ( _view_angle > 128 ) 1856 if ( _view_angle > 128 )
1874 _view_angle = 128; 1857 _view_angle = 128;
1875 v35 = uActiveCharacter; 1858 v35 = uActiveCharacter;
1876 if ( !uActiveCharacter ) 1859 if ( !uActiveCharacter )
1877 goto LABEL_87; 1860 goto LABEL_87;
1878 v65 = 0; 1861 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
1879 v63 = SPEECH_63; 1862 break;
1880 goto LABEL_76;
1881 case PARTY_LookDown: 1863 case PARTY_LookDown:
1882 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); 1864 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
1883 if ( _view_angle < -128 ) 1865 if ( _view_angle < -128 )
1884 _view_angle = -128; 1866 _view_angle = -128;
1885 v35 = uActiveCharacter; 1867 v35 = uActiveCharacter;
1886 if ( uActiveCharacter ) 1868 if ( uActiveCharacter )
1887 { 1869 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0);
1888 v65 = 0;
1889 v63 = SPEECH_64;
1890 LABEL_76:
1891 pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65);
1892 }
1893 break; 1870 break;
1894 case PARTY_CenterView: 1871 case PARTY_CenterView:
1895 _view_angle = 0; 1872 _view_angle = 0;
1896 break; 1873 break;
1897 case PARTY_Jump: 1874 case PARTY_Jump:
1898 if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 ) 1875 if ( (!bJumping || party_z <= v80 + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
1899 { 1876 {
1900 bJumping = 1; 1877 bJumping = 1;
1901 v89 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v89); 1878 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
1902 } 1879 }
1903 break; 1880 break;
1904 default: 1881 default:
1905 goto LABEL_87; 1882 goto LABEL_87;
1906 } 1883 }
1908 v36 = 0; 1885 v36 = 0;
1909 pParty->sRotationY = angle; 1886 pParty->sRotationY = angle;
1910 pParty->sRotationX = _view_angle; 1887 pParty->sRotationX = _view_angle;
1911 if ( bJumping ) 1888 if ( bJumping )
1912 { 1889 {
1913 v89 += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); 1890 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
1914 } 1891 }
1915 else 1892 else
1916 { 1893 {
1917 if ( pIndoor->pFaces[v68].pFacePlane_old.vNormal.z < 32768 ) 1894 if ( pIndoor->pFaces[v68].pFacePlane_old.vNormal.z < 32768 )
1918 { 1895 {
1919 v89 -= pEventTimer->uTimeElapsed * GetGravityStrength(); 1896 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
1920 goto LABEL_92; 1897 goto LABEL_92;
1921 } 1898 }
1922 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) 1899 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
1923 goto LABEL_92; 1900 goto LABEL_92;
1924 v89 = 0; 1901 pParty->uFallSpeed = 0;
1925 } 1902 }
1926 if ( bJumping != v36 && v89 <= v36 ) 1903 if ( bJumping != v36 && pParty->uFallSpeed <= v36 )
1927 { 1904 {
1928 if ( v89 < -500 && !pParty->bFlying ) 1905 if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
1929 { 1906 {
1930 v41 = &pPlayers[1]; 1907 v41 = &pPlayers[1];
1931 do 1908 do
1932 { 1909 {
1933 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) ) 1910 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) )
1962 stru_721530.field_34.y = new_party_y; 1939 stru_721530.field_34.y = new_party_y;
1963 stru_721530.normal.y = new_party_y; 1940 stru_721530.normal.y = new_party_y;
1964 stru_721530.field_20 = v1; 1941 stru_721530.field_20 = v1;
1965 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; 1942 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
1966 stru_721530.field_34.z = stru_721530.field_C + party_z + 1; 1943 stru_721530.field_34.z = stru_721530.field_C + party_z + 1;
1967 stru_721530.field_24 = v89; 1944 stru_721530.field_24 = pParty->uFallSpeed;
1968 stru_721530.uSectorID = uSectorID; 1945 stru_721530.uSectorID = uSectorID;
1969 v38 = 0; 1946 v38 = 0;
1970 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) 1947 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
1971 v38 = 13312; 1948 v38 = 13312;
1972 if ( stru_721530._47050A(v38) ) 1949 if ( stru_721530._47050A(v38) )
2021 } 1998 }
2022 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration) 1999 if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
2023 { 2000 {
2024 v53 = integer_sqrt(v2 * v2 + v1 * v1); 2001 v53 = integer_sqrt(v2 * v2 + v1 * v1);
2025 v80 = v53; 2002 v80 = v53;
2026 v54 = stru_5C6E00->Atan2( 2003 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
2027 new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
2028 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); 2004 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
2029 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; 2005 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16;
2030 v55 = stru_5C6E00->Sin(v54); 2006 v55 = stru_5C6E00->Sin(v54);
2031 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; 2007 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16;
2032 } 2008 }
2036 { 2012 {
2037 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; 2013 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
2038 v45 = v44->uPolygonType; 2014 v45 = v44->uPolygonType;
2039 if ( v45 == 3 ) 2015 if ( v45 == 3 )
2040 { 2016 {
2041 if ( v89 < 0 ) 2017 if ( pParty->uFallSpeed < 0 )
2042 v89 = 0; 2018 pParty->uFallSpeed = 0;
2043 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1; 2019 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1;
2044 if ( pParty->uFallStartY - v87 < 512 ) 2020 if ( pParty->uFallStartY - v87 < 512 )
2045 pParty->uFallStartY = v87; 2021 pParty->uFallStartY = v87;
2046 if ( v2 * v2 + v1 * v1 < 400 ) 2022 if ( v2 * v2 + v1 * v1 < 400 )
2047 { 2023 {
2048 v1 = 0; 2024 v1 = 0;
2049 v2 = 0; 2025 v2 = 0;
2050 } 2026 }
2051 goto LABEL_143; 2027 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
2028 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
2029 goto LABEL_152;
2052 } 2030 }
2053 v46 = v89 * v44->pFacePlane_old.vNormal.z; 2031 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
2054 v47 = v45 == 4; 2032 v47 = v45 == 4;
2055 v48 = v44->pFacePlane_old.vNormal.x; 2033 v48 = v44->pFacePlane_old.vNormal.x;
2056 if ( !v47 ) 2034 if ( !v47 )
2057 { 2035 {
2058 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; 2036 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
2062 v81 = v44->pFacePlane_old.vNormal.y; 2040 v81 = v44->pFacePlane_old.vNormal.y;
2063 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; 2041 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
2064 v82 = v44->pFacePlane_old.vNormal.z; 2042 v82 = v44->pFacePlane_old.vNormal.z;
2065 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; 2043 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
2066 v2 += v50; 2044 v2 += v50;
2067 v89 += v82; 2045 pParty->uFallSpeed += v82;
2068 v74 = v44->pFacePlane_old.vNormal.z; 2046 v74 = v44->pFacePlane_old.vNormal.z;
2069 v51 = v44->pFacePlane_old.vNormal.y; 2047 v51 = v44->pFacePlane_old.vNormal.y;
2070 v69 = v44->pFacePlane_old.vNormal.x; 2048 v69 = v44->pFacePlane_old.vNormal.x;
2071 v80 = v51; 2049 v80 = v51;
2072 v1 += v81; 2050 v1 += v81;
2075 { 2053 {
2076 new_party_x += v52 * v69 >> 16; 2054 new_party_x += v52 * v69 >> 16;
2077 new_party_y += v52 * v80 >> 16; 2055 new_party_y += v52 * v80 >> 16;
2078 v87 += v52 * v74 >> 16; 2056 v87 += v52 * v74 >> 16;
2079 } 2057 }
2080 LABEL_142:
2081 v43 = stru_721530.uFaceID; 2058 v43 = stru_721530.uFaceID;
2082 LABEL_143:
2083 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) 2059 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
2084 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; 2060 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
2085 goto LABEL_152; 2061 goto LABEL_152;
2086 } 2062 }
2087 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; 2063 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
2092 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; 2068 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
2093 v82 = v44->pFacePlane_old.vNormal.z; 2069 v82 = v44->pFacePlane_old.vNormal.z;
2094 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; 2070 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
2095 v2 += v49; 2071 v2 += v49;
2096 v1 += v81; 2072 v1 += v81;
2097 v89 += v82; 2073 pParty->uFallSpeed += v82;
2098 if ( v2 * v2 + v1 * v1 >= 400 ) 2074 if ( v2 * v2 + v1 * v1 >= 400 )
2099 goto LABEL_142; 2075 {
2076 v43 = stru_721530.uFaceID;
2077 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
2078 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
2079 goto LABEL_152;
2080 }
2100 v2 = 0; 2081 v2 = 0;
2101 v1 = 0; 2082 v1 = 0;
2102 v89 = 0; 2083 pParty->uFallSpeed = 0;
2103 } 2084 }
2104 } 2085 }
2105 LABEL_152: 2086 LABEL_152:
2106 v2 = (unsigned __int64)(58500i64 * v2) >> 16; 2087 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
2107 v1 = (unsigned __int64)(58500i64 * v1) >> 16; 2088 v1 = (unsigned __int64)(58500i64 * v1) >> 16;
2108 ++v83; 2089 ++v83;
2109 v89 = (unsigned __int64)(58500i64 * v89) >> 16; 2090 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
2110 if ( v83 >= 100 ) 2091 if ( v83 >= 100 )
2111 { 2092 {
2112 new_party_z = v87; 2093 new_party_z = v87;
2113 break; 2094 break;
2114 } 2095 }
2115 } 2096 }
2116 if ( bWalkSound && pParty->field_6F8 <= 0 ) 2097 if ( bWalkSound && pParty->field_6F8 <= 0 )
2117 { 2098 {
2118 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y) 2099 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y)
2119 * (pParty->vPosition.y - new_party_y) 2100 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z)
2120 + (pParty->vPosition.z - new_party_z) 2101 * (pParty->vPosition.z - new_party_z)) <= 16 )
2121 * (pParty->vPosition.z - new_party_z)) <= 16 )
2122 goto LABEL_188; 2102 goto LABEL_188;
2123 if ( v72 && (!bJumping || bFeatherFall) ) 2103 if ( v72 && (!bJumping || bFeatherFall) )
2124 { 2104 {
2125 v66 = 0; 2105 v66 = 0;
2126 v64 = 0; 2106 v64 = 0;
2137 else 2117 else
2138 v57 = (SoundID)64; 2118 v57 = (SoundID)64;
2139 goto LABEL_175; 2119 goto LABEL_175;
2140 } 2120 }
2141 v57 = (SoundID)63; 2121 v57 = (SoundID)63;
2142 LABEL_174:
2143 v56 = pAudioPlayer; 2122 v56 = pAudioPlayer;
2144 goto LABEL_175; 2123 goto LABEL_175;
2145 } 2124 }
2146 if ( v78 && (!bJumping || bFeatherFall) ) 2125 if ( v78 && (!bJumping || bFeatherFall) )
2147 { 2126 {
2153 v59 = 1; 2132 v59 = 1;
2154 v58 = 804; 2133 v58 = 804;
2155 if ( v71 ) 2134 if ( v71 )
2156 { 2135 {
2157 v57 = (SoundID)102; 2136 v57 = (SoundID)102;
2158 goto LABEL_174; 2137 v56 = pAudioPlayer;
2138 goto LABEL_175;
2159 } 2139 }
2160 v56 = pAudioPlayer; 2140 v56 = pAudioPlayer;
2161 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) 2141 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
2162 v57 = (SoundID)89; 2142 v57 = (SoundID)89;
2163 else 2143 else
2178 pParty->uFlags |= PARTY_FLAGS_1_FALLING; 2158 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
2179 pParty->uFlags &= ~0x200; 2159 pParty->uFlags &= ~0x200;
2180 pParty->vPosition.x = new_party_x; 2160 pParty->vPosition.x = new_party_x;
2181 pParty->vPosition.z = new_party_z; 2161 pParty->vPosition.z = new_party_z;
2182 pParty->vPosition.y = new_party_y; 2162 pParty->vPosition.y = new_party_y;
2183 pParty->uFallSpeed = v89; 2163 //pParty->uFallSpeed = v89;
2184 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) 2164 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
2185 pParty->uFlags |= 0x200; 2165 pParty->uFlags |= 0x200;
2186 if (uFaceEvent) 2166 if (uFaceEvent)
2187 EventProcessor(uFaceEvent, 0, 1); 2167 EventProcessor(uFaceEvent, 0, 1);
2188 } 2168 }