comparison mm7_3.cpp @ 831:9c3f28b31b4a

Party actions in blv
author Nomad
date Wed, 27 Mar 2013 15:04:59 +0200
parents d5b1870df3ab
children dfd683c4f538 72f6df90df98
comparison
equal deleted inserted replaced
830:08d90b633131 831:9c3f28b31b4a
1479 //while ( v20 < (signed int)uNumSpriteObjects ); 1479 //while ( v20 < (signed int)uNumSpriteObjects );
1480 } 1480 }
1481 } 1481 }
1482 1482
1483 //----- (0047272C) -------------------------------------------------------- 1483 //----- (0047272C) --------------------------------------------------------
1484 int _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) 1484 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
1485 { 1485 {
1486 signed int v5; // ebx@1 1486 signed int v5; // ebx@1
1487 int result; // eax@1 1487 int result; // eax@1
1488 int v7; // [sp+10h] [bp-8h]@1 1488 int v7; // [sp+10h] [bp-8h]@1
1489 signed int v8; // [sp+14h] [bp-4h]@1 1489 signed int v8; // [sp+14h] [bp-4h]@1
1519 //----- (00472866) -------------------------------------------------------- 1519 //----- (00472866) --------------------------------------------------------
1520 void BLV_ProcessPartyActions() 1520 void BLV_ProcessPartyActions()
1521 { 1521 {
1522 int v1; // ebx@1 1522 int v1; // ebx@1
1523 int v2; // edi@1 1523 int v2; // edi@1
1524 int v6; // eax@18 1524 //int v6; // eax@18
1525 signed __int64 v8; // qax@27 1525 //signed __int64 v8; // qax@27
1526 int v9; // eax@27 1526 //int v9; // eax@27
1527 double v10; // st7@27 1527 double v10; // st7@27
1528 unsigned int v12; // eax@49 1528 unsigned int v12; // eax@49
1529 double v13; // st7@50 1529 double v13; // st7@50
1530 int v14; // eax@51 1530 //int v14; // eax@51
1531 signed __int64 v15; // qax@53 1531 //signed __int64 v15; // qax@53
1532 double v16; // st7@54 1532 //double v16; // st7@54
1533 int v17; // eax@62 1533 int v17; // eax@62
1534 double v18; // st7@62 1534 double v18; // st7@62
1535 int v19; // ST40_4@62 1535 int v19; // ST40_4@62
1536 int v20; // eax@65 1536 int v20; // eax@65
1537 double v21; // st7@65 1537 double v21; // st7@65
1572 int v62; // [sp-Ch] [bp-6Ch]@161 1572 int v62; // [sp-Ch] [bp-6Ch]@161
1573 int v63; // [sp-8h] [bp-68h]@75 1573 int v63; // [sp-8h] [bp-68h]@75
1574 unsigned int v64; // [sp-8h] [bp-68h]@161 1574 unsigned int v64; // [sp-8h] [bp-68h]@161
1575 int v65; // [sp-4h] [bp-64h]@75 1575 int v65; // [sp-4h] [bp-64h]@75
1576 int v66; // [sp-4h] [bp-64h]@161 1576 int v66; // [sp-4h] [bp-64h]@161
1577 int v68; // [sp+10h] [bp-50h]@45 1577 //int v68; // [sp+10h] [bp-50h]@45
1578 int v69; // [sp+10h] [bp-50h]@140 1578 int v69; // [sp+10h] [bp-50h]@140
1579 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 1579 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
1580 signed int v71; // [sp+18h] [bp-48h]@1 1580 //signed int v71; // [sp+18h] [bp-48h]@1
1581 signed int v72; // [sp+1Ch] [bp-44h]@1 1581 signed int v72; // [sp+1Ch] [bp-44h]@1
1582 signed int v73; // [sp+20h] [bp-40h]@100 1582 signed int v73; // [sp+20h] [bp-40h]@100
1583 int v74; // [sp+20h] [bp-40h]@140 1583 int v74; // [sp+20h] [bp-40h]@140
1584 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 1584 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
1585 unsigned int uSectorID; // [sp+28h] [bp-38h]@1 1585 unsigned int uSectorID; // [sp+28h] [bp-38h]@1
1604 new_party_y = pParty->vPosition.y; 1604 new_party_y = pParty->vPosition.y;
1605 party_z = pParty->vPosition.z; 1605 party_z = pParty->vPosition.z;
1606 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 1606 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
1607 v72 = 0; 1607 v72 = 0;
1608 v78 = 0; 1608 v78 = 0;
1609 v71 = 0;
1610 bJumping = 0; 1609 bJumping = 0;
1611 1610
1612 uFaceID = -1; 1611 uFaceID = -1;
1613 v80 = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); 1612 auto floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
1614 assert(uFaceID != -1);
1615
1616 for (uint i = 0; i < pIndoor->uNumFaces; ++i)
1617 pIndoor->pFaces[i].uAttributes &= ~FACE_OUTLINED;
1618 pIndoor->pFaces[uFaceID].uAttributes |= FACE_OUTLINED;
1619 1613
1620 if ( pParty->bFlying ) 1614 if ( pParty->bFlying )
1621 { 1615 {
1622 pParty->bFlying = false; 1616 pParty->bFlying = false;
1623 if (pParty->FlyActive()) 1617 if (pParty->FlyActive())
1624 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1; 1618 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
1625 //stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing] 1619 }
1626 } 1620
1627 if ( v80 == -30000 ) 1621 if ( floor_level == -30000 || uFaceID == -1)
1628 { 1622 {
1629 v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); 1623 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
1630 if ( v80 == -30000 ) 1624 if ( floor_level == -30000 || uFaceID == -1)
1631 { 1625 {
1626 __debugbreak(); // level built with errors
1632 pParty->vPosition.x = blv_prev_party_x; 1627 pParty->vPosition.x = blv_prev_party_x;
1633 pParty->vPosition.y = blv_prev_party_z; 1628 pParty->vPosition.y = blv_prev_party_z;
1634 pParty->vPosition.z = blv_prev_party_y; 1629 pParty->vPosition.z = blv_prev_party_y;
1635 pParty->uFallStartY = blv_prev_party_y; 1630 pParty->uFallStartY = blv_prev_party_y;
1636 return; 1631 return;
1637 } 1632 }
1638 } 1633 }
1634
1635 for (uint i = 0; i < pIndoor->uNumFaces; ++i)
1636 pIndoor->pFaces[i].uAttributes &= ~FACE_OUTLINED;
1637 pIndoor->pFaces[uFaceID].uAttributes |= FACE_OUTLINED;
1638
1639 blv_prev_party_x = pParty->vPosition.x; 1639 blv_prev_party_x = pParty->vPosition.x;
1640 blv_prev_party_z = pParty->vPosition.y; 1640 blv_prev_party_z = pParty->vPosition.y;
1641 blv_prev_party_y = pParty->vPosition.z; 1641 blv_prev_party_y = pParty->vPosition.z;
1642 if (!pParty->bTurnBasedModeOn) 1642 if (!pParty->bTurnBasedModeOn)
1643 { 1643 {
1650 if ( dword_4F8580[0] > 60 ) 1650 if ( dword_4F8580[0] > 60 )
1651 dword_4F8580[0] = 1; 1651 dword_4F8580[0] = 1;
1652 } 1652 }
1653 dword_720CDC = v67; 1653 dword_720CDC = v67;
1654 } 1654 }
1655
1656 uint fall_start;
1655 if (!pParty->FeatherFallActive()) 1657 if (!pParty->FeatherFallActive())
1656 { 1658 {
1657 bFeatherFall = false; 1659 bFeatherFall = false;
1658 if (!pParty->pPlayers[0].WearsItem(536, 16) && 1660 if (!pParty->pPlayers[0].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16) && // grants feather fall
1659 !pParty->pPlayers[1].WearsItem(536, 16) && 1661 !pParty->pPlayers[1].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16) &&
1660 !pParty->pPlayers[2].WearsItem(536, 16) && 1662 !pParty->pPlayers[2].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16) &&
1661 !pParty->pPlayers[3].WearsItem(536, 16)) 1663 !pParty->pPlayers[3].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, 16))
1662 { 1664 {
1663 v6 = pParty->uFallStartY; 1665 fall_start = pParty->uFallStartY;
1664 } 1666 }
1665 } 1667 }
1666 else 1668 else
1667 { 1669 {
1668 v6 = v80; 1670 fall_start = floor_level;
1669 bFeatherFall = true; 1671 bFeatherFall = true;
1670 pParty->uFallStartY = v80; 1672 pParty->uFallStartY = floor_level;
1671 } 1673 }
1672 LABEL_20: 1674
1673 if ( v6 - party_z > 512 && !bFeatherFall && party_z <= v80 + 1 ) 1675
1674 { 1676 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)
1677 {
1678 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor?
1675 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) 1679 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
1676 {
1677 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; 1680 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
1678 }
1679 else for (uint i = 0; i < 4; ++i) 1681 else for (uint i = 0; i < 4; ++i)
1680 { // receive falling damage 1682 { // receive falling damage
1681 auto pPlayer = pParty->pPlayers + i; 1683 auto player = pParty->pPlayers + i;
1682 1684 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, 8))
1683 if (!pPlayer->HasEnchantedItemEquipped(72) && 1685 {
1684 !pPlayer->WearsItem(529, 8)) 1686 player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, 4);
1685 { 1687 v10 = (double)(20 - player->_48EA1B_get_static_effect(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
1686 v8 = (signed __int64)((double)pPlayer->GetMaxHealth() * 0.1); 1688 player->SetRecoveryTime((signed __int64)v10);
1687 pPlayer->ReceiveDamage((pParty->uFallStartY - party_z) * (signed int)v8 / 256, 4); 1689 }
1688 v9 = pPlayer->GetActualEndurance(); 1690 }
1689 v10 = (double)(20 - pPlayer->_48EA1B_get_static_effect(v9)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; 1691 }
1690 pPlayer->SetRecoveryTime((signed __int64)v10); 1692
1691 } 1693 if ( party_z > floor_level + 1 )
1692 }
1693 }
1694 if ( party_z > v80 + 1 )
1695 bJumping = 1; 1694 bJumping = 1;
1696 bFeatherFall = party_z - v80 <= 32; 1695
1697 if ( party_z - v80 <= 32 ) 1696 bool jumping_up = false;
1697
1698 if ( party_z - floor_level <= 32 )
1699 {
1698 pParty->uFallStartY = party_z; 1700 pParty->uFallStartY = party_z;
1699 if ( bWalkSound && pParty->field_6F8 > 0 ) 1701 jumping_up = true;
1700 pParty->field_6F8 -= pEventTimer->uTimeElapsed; 1702 }
1701 if ( party_z > v80 + 1 ) 1703
1702 { 1704 if (bWalkSound && pParty->walk_sound_timer)
1703 if ( bJumping ) 1705 {
1704 goto LABEL_45; 1706 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed)
1705 goto LABEL_44; 1707 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
1706 } 1708 else pParty->walk_sound_timer = 0;
1707 party_z = v80 + 1; 1709 }
1708 pParty->uFallStartY = v80 + 1; 1710
1709 if ( bJumping ) 1711
1710 goto LABEL_45; 1712 if (party_z <= floor_level + 1)
1711 if (pParty->field_6F4_packedid != uFaceID) 1713 {
1712 { 1714 party_z = floor_level + 1;
1713 auto pFace = &pIndoor->pFaces[uFaceID]; 1715 pParty->uFallStartY = floor_level + 1;
1714 if (pFace->uAttributes & 0x04000000 ) 1716
1715 { 1717 if (!bJumping && pParty->floor_face_pid != uFaceID)
1716 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; 1718 {
1717 if ( bJumping ) 1719 auto pFace = &pIndoor->pFaces[uFaceID];
1718 goto LABEL_45; 1720 if (pFace->uAttributes & FACE_PRESSURE_PLATE)
1719 goto LABEL_44; 1721 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
1720 } 1722 }
1721 } 1723 }
1722 LABEL_44: 1724 if (!bJumping)
1723 pParty->field_6F4_packedid = uFaceID; 1725 pParty->floor_face_pid = uFaceID;
1724 LABEL_45: 1726
1725 v68 = uFaceID; 1727 bool on_water = false;
1726 if ( pIndoor->pFaces[uFaceID].uAttributes & 0x10 ) 1728 if ( pIndoor->pFaces[uFaceID].Fluid())
1727 v71 = 1; 1729 on_water = true;
1730
1728 v81 = pParty->uWalkSpeed; 1731 v81 = pParty->uWalkSpeed;
1729 angle = pParty->sRotationY; 1732 angle = pParty->sRotationY;
1730 _view_angle = pParty->sRotationX; 1733 _view_angle = pParty->sRotationX;
1731 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format 1734 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
1732 * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
1733 / 180)) >> 16; 1735 / 180)) >> 16;
1734 //LABEL_87: 1736 //LABEL_87:
1735 while ( pPartyActionQueue->uNumActions ) 1737 while ( pPartyActionQueue->uNumActions )
1736 { 1738 {
1737 switch ( pPartyActionQueue->Next() ) 1739 switch ( pPartyActionQueue->Next() )
1738 { 1740 {
1739 case PARTY_TurnLeft: 1741 case PARTY_TurnLeft:
1740 if ( uTurnSpeed ) 1742 if (uTurnSpeed)
1741 { 1743 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
1742 v14 = angle + uTurnSpeed; 1744 else
1743 angle = stru_5C6E00->uDoublePiMask & v14; 1745 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier));
1744 break;
1745 }
1746 v14 = angle + (unsigned __int64)(signed __int64)(double)v82 * fTurnSpeedMultiplier;
1747 angle = stru_5C6E00->uDoublePiMask & v14;
1748 break; 1746 break;
1749 case PARTY_TurnRight: 1747 case PARTY_TurnRight:
1750 if ( uTurnSpeed ) 1748 if (uTurnSpeed)
1751 {
1752 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); 1749 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
1753 break; 1750 else
1754 } 1751 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier));
1755 v16 = (double)v82 * fTurnSpeedMultiplier;
1756 angle = stru_5C6E00->uDoublePiMask & (angle - (signed __int64)v16);
1757 break; 1752 break;
1753
1758 case PARTY_FastTurnLeft: 1754 case PARTY_FastTurnLeft:
1759 if ( uTurnSpeed ) 1755 if (uTurnSpeed)
1760 { 1756 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
1761 v14 = angle + uTurnSpeed;
1762 }
1763 else 1757 else
1764 { 1758 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
1765 v14 = angle + (unsigned __int64)(signed __int64)(fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
1766 }
1767 angle = stru_5C6E00->uDoublePiMask & v14;
1768 break; 1759 break;
1760
1769 case PARTY_FastTurnRight: 1761 case PARTY_FastTurnRight:
1770 LODWORD(v15) = uTurnSpeed; 1762 if (uTurnSpeed)
1771 if ( !uTurnSpeed ) 1763 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
1772 { 1764 else
1773 v15 = (signed __int64)(fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82; 1765 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
1774 }
1775 angle = stru_5C6E00->uDoublePiMask & (angle - v15);
1776 break; 1766 break;
1767
1777 case PARTY_StrafeLeft: 1768 case PARTY_StrafeLeft:
1778 v2 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; 1769 v2 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
1779 v1 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; 1770 v1 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
1780 v78 = 1; 1771 v78 = 1;
1781 break; 1772 break;
1783 v2 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; 1774 v2 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
1784 v1 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; 1775 v1 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
1785 v78 = 1; 1776 v78 = 1;
1786 break; 1777 break;
1787 case PARTY_WalkForward: 1778 case PARTY_WalkForward:
1788 v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier)) >> 16; 1779 v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16;
1789 v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier)) >> 16; 1780 v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16;
1790 v78 = 1; 1781 v78 = 1;
1791 break; 1782 break;
1792 case PARTY_WalkBackward: 1783 case PARTY_WalkBackward:
1793 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; 1784 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
1794 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; 1785 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
1826 break; 1817 break;
1827 case PARTY_CenterView: 1818 case PARTY_CenterView:
1828 _view_angle = 0; 1819 _view_angle = 0;
1829 break; 1820 break;
1830 case PARTY_Jump: 1821 case PARTY_Jump:
1831 if ( (!bJumping || party_z <= v80 + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 ) 1822 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
1832 { 1823 {
1833 bJumping = 1; 1824 bJumping = 1;
1834 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); 1825 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
1835 } 1826 }
1836 break; 1827 break;
1845 { 1836 {
1846 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); 1837 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
1847 } 1838 }
1848 else 1839 else
1849 { 1840 {
1850 if ( pIndoor->pFaces[v68].pFacePlane_old.vNormal.z < 32768 ) 1841 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 )
1851 { 1842 {
1852 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength(); 1843 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
1853 goto LABEL_92; 1844 goto LABEL_92;
1854 } 1845 }
1855 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) 1846 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
1861 if ( pParty->uFallSpeed < -500 && !pParty->bFlying ) 1852 if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
1862 { 1853 {
1863 v41 = &pPlayers[1]; 1854 v41 = &pPlayers[1];
1864 do 1855 do
1865 { 1856 {
1866 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) ) 1857 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, 8) )
1867 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_46, 0); 1858 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0);
1868 ++v41; 1859 ++v41;
1869 } 1860 }
1870 while ( (signed int)v41 <= (signed int)&pPlayers[4] ); 1861 while ( (signed int)v41 <= (signed int)&pPlayers[4] );
1871 } 1862 }
1872 goto LABEL_93; 1863 goto LABEL_93;
1978 if ( v2 * v2 + v1 * v1 < 400 ) 1969 if ( v2 * v2 + v1 * v1 < 400 )
1979 { 1970 {
1980 v1 = 0; 1971 v1 = 0;
1981 v2 = 0; 1972 v2 = 0;
1982 } 1973 }
1983 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) 1974 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
1984 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; 1975 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
1985 goto LABEL_152; 1976 goto LABEL_152;
1986 } 1977 }
1987 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z; 1978 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
1988 v47 = v45 == 4; 1979 v47 = v45 == 4;
2010 new_party_x += v52 * v69 >> 16; 2001 new_party_x += v52 * v69 >> 16;
2011 new_party_y += v52 * v80 >> 16; 2002 new_party_y += v52 * v80 >> 16;
2012 v87 += v52 * v74 >> 16; 2003 v87 += v52 * v74 >> 16;
2013 } 2004 }
2014 v43 = stru_721530.uFaceID; 2005 v43 = stru_721530.uFaceID;
2015 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) 2006 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
2016 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; 2007 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
2017 goto LABEL_152; 2008 goto LABEL_152;
2018 } 2009 }
2019 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; 2010 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
2020 if ( stru_721530.field_64 >> 3 > v80 ) 2011 if ( stru_721530.field_64 >> 3 > v80 )
2028 v1 += v81; 2019 v1 += v81;
2029 pParty->uFallSpeed += v82; 2020 pParty->uFallSpeed += v82;
2030 if ( v2 * v2 + v1 * v1 >= 400 ) 2021 if ( v2 * v2 + v1 * v1 >= 400 )
2031 { 2022 {
2032 v43 = stru_721530.uFaceID; 2023 v43 = stru_721530.uFaceID;
2033 if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) 2024 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
2034 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; 2025 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
2035 goto LABEL_152; 2026 goto LABEL_152;
2036 } 2027 }
2037 v2 = 0; 2028 v2 = 0;
2038 v1 = 0; 2029 v1 = 0;
2048 { 2039 {
2049 new_party_z = v87; 2040 new_party_z = v87;
2050 break; 2041 break;
2051 } 2042 }
2052 } 2043 }
2053 if ( bWalkSound && pParty->field_6F8 <= 0 ) 2044 if ( bWalkSound && !pParty->walk_sound_timer)
2054 { 2045 {
2055 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y) 2046 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y)
2056 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z) 2047 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z)
2057 * (pParty->vPosition.z - new_party_z)) <= 16 ) 2048 * (pParty->vPosition.z - new_party_z)) <= 16 )
2058 goto LABEL_188; 2049 goto LABEL_188;
2059 if ( v72 && (!bJumping || bFeatherFall) ) 2050 if ( v72 && (!bJumping || jumping_up) )
2060 { 2051 {
2061 v66 = 0; 2052 v66 = 0;
2062 v64 = 0; 2053 v64 = 0;
2063 v62 = 0; 2054 v62 = 0;
2064 v61 = 0; 2055 v61 = 0;
2065 v60 = -1; 2056 v60 = -1;
2066 v59 = 1; 2057 v59 = 1;
2067 v58 = 804; 2058 v58 = 804;
2068 if ( !v71 ) 2059 if ( !on_water )
2069 { 2060 {
2070 v56 = pAudioPlayer; 2061 v56 = pAudioPlayer;
2071 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) 2062 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
2072 v57 = (SoundID)50; 2063 v57 = (SoundID)50;
2073 else 2064 else
2076 } 2067 }
2077 v57 = (SoundID)63; 2068 v57 = (SoundID)63;
2078 v56 = pAudioPlayer; 2069 v56 = pAudioPlayer;
2079 goto LABEL_175; 2070 goto LABEL_175;
2080 } 2071 }
2081 if ( v78 && (!bJumping || bFeatherFall) ) 2072 if ( v78 && (!bJumping || jumping_up) )
2082 { 2073 {
2083 v66 = 0; 2074 v66 = 0;
2084 v64 = 0; 2075 v64 = 0;
2085 v62 = 0; 2076 v62 = 0;
2086 v61 = 0; 2077 v61 = 0;
2087 v60 = -1; 2078 v60 = -1;
2088 v59 = 1; 2079 v59 = 1;
2089 v58 = 804; 2080 v58 = 804;
2090 if ( v71 ) 2081 if ( on_water )
2091 { 2082 {
2092 v57 = (SoundID)102; 2083 v57 = (SoundID)102;
2093 v56 = pAudioPlayer; 2084 v56 = pAudioPlayer;
2094 goto LABEL_175; 2085 goto LABEL_175;
2095 } 2086 }
2103 } 2094 }
2104 else 2095 else
2105 { 2096 {
2106 LABEL_188: 2097 LABEL_188:
2107 pAudioPlayer->_4AA258(804); 2098 pAudioPlayer->_4AA258(804);
2108 pParty->field_6F8 = 64; 2099 pParty->walk_sound_timer = 64;
2109 } 2100 }
2110 } 2101 }
2111 if ( !bJumping || bFeatherFall ) 2102 if ( !bJumping || jumping_up )
2112 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; 2103 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
2113 else 2104 else
2114 pParty->uFlags |= PARTY_FLAGS_1_FALLING; 2105 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
2115 pParty->uFlags &= ~0x200; 2106 pParty->uFlags &= ~0x200;
2116 pParty->vPosition.x = new_party_x; 2107 pParty->vPosition.x = new_party_x;
2349 else 2340 else
2350 { 2341 {
2351 bJumping = 1; 2342 bJumping = 1;
2352 } 2343 }
2353 v101 = pZ - v111 <= 32; 2344 v101 = pZ - v111 <= 32;
2354 if ( bWalkSound && pParty->field_6F8 > 0 ) 2345 if ( bWalkSound && pParty->walk_sound_timer)
2355 pParty->field_6F8 -= pEventTimer->uTimeElapsed; 2346 {
2347 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed)
2348 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
2349 else pParty->walk_sound_timer = 0;
2350 }
2356 if (!bUnderwater 2351 if (!bUnderwater
2357 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0 2352 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0
2358 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) ) 2353 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) )
2359 pParty->bFlying = false; 2354 pParty->bFlying = false;
2360 if (!bJumping) 2355 if (!bJumping)
2361 { 2356 {
2362 if ( pParty->field_6F4_packedid != (8 * v108 | OBJECT_BModel) ) 2357 if ( pParty->floor_face_pid != PID(OBJECT_BModel, v108) )
2363 { 2358 {
2364 if (v108) 2359 if (v108)
2365 { 2360 {
2366 if ( v108 >> 6 < pOutdoor->uNumBModels ) 2361 if ( v108 >> 6 < pOutdoor->uNumBModels )
2367 { 2362 {
2372 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; 2367 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel;
2373 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); 2368 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
2374 }*/ 2369 }*/
2375 if ( BYTE3(v7[v6].uAttributes) & 4 ) 2370 if ( BYTE3(v7[v6].uAttributes) & 4 )
2376 { 2371 {
2377 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; 2372 pParty->floor_face_pid = PID(OBJECT_BModel, v108);
2378 v103 = v7[v6].sCogTriggeredID; 2373 v103 = v7[v6].sCogTriggeredID;
2379 } 2374 }
2380 } 2375 }
2381 } 2376 }
2382 } 2377 }
2383 pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel; 2378 pParty->floor_face_pid = PID(OBJECT_BModel, v108);
2384 } 2379 }
2385 _walk_speed = pParty->uWalkSpeed; 2380 _walk_speed = pParty->uWalkSpeed;
2386 _angle_y = pParty->sRotationY; 2381 _angle_y = pParty->sRotationY;
2387 _angle_x = pParty->sRotationX; 2382 _angle_x = pParty->sRotationX;
2388 v126 = pEventTimer->dt_in_some_format; 2383 v126 = pEventTimer->dt_in_some_format;
2953 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); 2948 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16);
2954 } 2949 }
2955 LABEL_220: 2950 LABEL_220:
2956 v45 = stru_721530.uFaceID; 2951 v45 = stru_721530.uFaceID;
2957 LABEL_221: 2952 LABEL_221:
2958 if ( pParty->field_6F4_packedid != v45 && BYTE3(v47->uAttributes) & 4 ) 2953 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
2959 { 2954 {
2960 pParty->field_6F4_packedid = v45; 2955 pParty->floor_face_pid = v45;
2961 v103 = v47->sCogTriggeredID; 2956 v103 = v47->sCogTriggeredID;
2962 } 2957 }
2963 goto LABEL_234; 2958 goto LABEL_234;
2964 } 2959 }
2965 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; 2960 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16;
2988 v122 = (unsigned __int64)(58500i64 * v121) >> 16; 2983 v122 = (unsigned __int64)(58500i64 * v121) >> 16;
2989 ++v126; 2984 ++v126;
2990 v121 = (unsigned __int64)(58500i64 * v121) >> 16; 2985 v121 = (unsigned __int64)(58500i64 * v121) >> 16;
2991 } 2986 }
2992 while ( v126 < 100 ); 2987 while ( v126 < 100 );
2993 if ( bWalkSound && pParty->field_6F8 <= 0 ) 2988 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
2994 { 2989 {
2995 v122 = abs(pParty->vPosition.x - pX); 2990 v122 = abs(pParty->vPosition.x - pX);
2996 v126 = abs(pParty->vPosition.y - pY); 2991 v126 = abs(pParty->vPosition.y - pY);
2997 v62 = abs(pParty->vPosition.z - pZ); 2992 v62 = abs(pParty->vPosition.z - pZ);
2998 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) 2993 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
2999 goto LABEL_344; 2994 goto LABEL_344;
3000 if ( v114 && (!bJumping || v101) ) 2995 if ( v114 && (!bJumping || v101) )
3001 { 2996 {
3002 if ( !v107 2997 if ( !v107
3003 && !(BYTE1(pOutdoor->pBModels[pParty->field_6F4_packedid >> 9].pFaces[(pParty->field_6F4_packedid >> 3) & 0x3F].uAttributes) & 0x20) ) 2998 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
3004 { 2999 {
3005 3000
3006 v90 = -1; 3001 v90 = -1;
3007 v89 = 1; 3002 v89 = 1;
3008 v88 = 804; 3003 v88 = 804;
3021 goto LABEL_257; 3016 goto LABEL_257;
3022 } 3017 }
3023 if ( v124 && (!bJumping || v101) ) 3018 if ( v124 && (!bJumping || v101) )
3024 { 3019 {
3025 if ( v107 3020 if ( v107
3026 || BYTE1(pOutdoor->pBModels[pParty->field_6F4_packedid >> 9].pFaces[(pParty->field_6F4_packedid >> 3) & 0x3F].uAttributes) & 0x20 ) 3021 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
3027 { 3022 {
3028 3023
3029 v90 = -1; 3024 v90 = -1;
3030 v89 = 1; 3025 v89 = 1;
3031 v88 = 804; 3026 v88 = 804;
3041 } 3036 }
3042 else 3037 else
3043 { 3038 {
3044 LABEL_344: 3039 LABEL_344:
3045 pAudioPlayer->_4AA258(804); 3040 pAudioPlayer->_4AA258(804);
3046 pParty->field_6F8 = 64; 3041 pParty->walk_sound_timer = 64;
3047 } 3042 }
3048 } 3043 }
3049 if ( !bJumping || v101 ) 3044 if ( !bJumping || v101 )
3050 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; 3045 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
3051 else 3046 else
3175 } 3170 }
3176 } 3171 }
3177 } 3172 }
3178 goto LABEL_318; 3173 goto LABEL_318;
3179 } 3174 }
3180 if ( bWalkSound && pParty->field_6F8 <= 0 ) 3175 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
3181 { 3176 {
3182 pAudioPlayer->_4AA258(804); 3177 pAudioPlayer->_4AA258(804);
3183 pParty->field_6F8 = 64; 3178 pParty->walk_sound_timer = 64;
3184 } 3179 }
3185 LABEL_318: 3180 LABEL_318:
3186 v81 = pZ; 3181 v81 = pZ;
3187 v82 = pZ; 3182 v82 = pZ;
3188 pParty->vPosition.z = pZ; 3183 pParty->vPosition.z = pZ;