comparison UI/UIPopup.cpp @ 1449:27b7ee003c7c

Merge
author Gloval
date Tue, 06 Aug 2013 00:56:33 +0400
parents 28f87f5234a1
children 934074e7fcc1
comparison
equal deleted inserted replaced
1448:5a5d0c713d47 1449:27b7ee003c7c
26 #include "..\texts.h" 26 #include "..\texts.h"
27 27
28 #include "..\mm7_data.h" 28 #include "..\mm7_data.h"
29 29
30 static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually 30 static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually
31
32
33 //----- (004179BC) --------------------------------------------------------
34 void CharacterUI_DrawTooltip(const char *a1, const char *a2)
35 {
36 //const char *v2; // ebx@1
37 //const char *v3; // edi@1
38 //unsigned int v4; // eax@1
39 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1
40 POINT v6; // [sp+60h] [bp-8h]@1
41
42 //v2 = a2;
43 //v3 = a1;
44 memset(&Dst, 0, 0x54u);
45 Dst.uFrameWidth = 384;
46 Dst.uFrameHeight = 256;
47 Dst.uFrameX = 128;
48 Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30;
49 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(a2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24;
50 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
51 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
52 Dst.DrawMessageBox(0);
53 Dst.uFrameX += 12;
54 Dst.uFrameWidth -= 24;
55 Dst.uFrameY += 12;
56 Dst.uFrameHeight -= 12;
57 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
58 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
59 sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, a1);
60 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
61 Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, a2, 0, 0, 0);
62 }
31 63
32 //----- (004151D9) -------------------------------------------------------- 64 //----- (004151D9) --------------------------------------------------------
33 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight) 65 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight)
34 { 66 {
35 unsigned int v4; // ebx@1 67 unsigned int v4; // ebx@1
1548 && (signed int)v0 <= (signed int)i->uZ 1580 && (signed int)v0 <= (signed int)i->uZ
1549 && (signed int)v1 >= (signed int)i->uY 1581 && (signed int)v1 >= (signed int)i->uY
1550 && (signed int)v1 <= (signed int)i->uW ) 1582 && (signed int)v1 <= (signed int)i->uW )
1551 { 1583 {
1552 v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param); 1584 v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param);
1553 sub_4179BC_draw_tooltip(pSkillNames[i->msg_param], v3); 1585 CharacterUI_DrawTooltip(pSkillNames[i->msg_param], v3);
1554 v1 = pY; 1586 v1 = pY;
1555 v0 = pX; 1587 v0 = pX;
1556 } 1588 }
1557 } 1589 }
1558 } 1590 }
1559 else 1591 else
1560 { 1592 {
1561 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); 1593 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
1562 } 1594 }
1563 1595
1564 } 1596 }
1565 1597
1566 //----- (00418083) -------------------------------------------------------- 1598 //----- (00418083) --------------------------------------------------------
1567 void __cdecl CharacterUI_StatsTab_ShowHint() 1599 void __cdecl CharacterUI_StatsTab_ShowHint()
1568 { 1600 {
1569 LONG _x; // esi@1
1570 LONG _y; // eax@1
1571 int pStringNum; // edi@1 1601 int pStringNum; // edi@1
1572 signed int pTextColor; // eax@15 1602 signed int pTextColor; // eax@15
1573 char *pHourWord; // ecx@17 1603 char *pHourWord; // ecx@17
1574 char *pDayWord; // eax@20 1604 char *pDayWord; // eax@20
1575 int v15; // ebx@28 1605 int v15; // ebx@28
1576 int v16; // eax@33 1606 int v16; // eax@33
1577 POINT a2; // [sp+Ch] [bp-24h]@1 1607 POINT a2; // [sp+Ch] [bp-24h]@1
1578 int pHour; // [sp+14h] [bp-1Ch]@15 1608 int pHour; // [sp+14h] [bp-1Ch]@15
1579 unsigned int pDay; // [sp+24h] [bp-Ch]@15 1609 unsigned int pDay; // [sp+24h] [bp-Ch]@15
1580 1610
1581 _x = pMouse->GetCursorPos(&a2)->x; 1611 pMouse->GetCursorPos(&a2);
1582 _y = pMouse->GetCursorPos(&a2)->y; 1612 for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum )
1583 for ( pStringNum = 0; pStringNum < (signed int)&off_4E2A12; ++pStringNum ) 1613 {
1584 { 1614 if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
1585 if ( _x >= stat_string_coord[pStringNum].x && _x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
1586 { 1615 {
1587 if ( _y >= stat_string_coord[pStringNum].y && _y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) 1616 if (a2.y >= stat_string_coord[pStringNum].y && a2.y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height )
1588 break; 1617 break;
1589 } 1618 }
1590 } 1619 }
1620
1591 switch ( pStringNum ) 1621 switch ( pStringNum )
1592 { 1622 {
1593 case 0:// Attributes 1623 case 0:// Attributes
1594 case 1: 1624 case 1:
1595 case 2: 1625 case 2:
1596 case 3: 1626 case 3:
1597 case 4: 1627 case 4:
1598 case 5: 1628 case 5:
1599 case 6: 1629 case 6:
1600 if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) 1630 if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] )
1601 sub_4179BC_draw_tooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); 1631 CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]);
1602 break; 1632 break;
1603 case 7:// Health Points 1633 case 7:// Health Points
1604 if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) 1634 if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription )
1605 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); 1635 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription);
1606 break; 1636 break;
1607 case 8:// Spell Points 1637 case 8:// Spell Points
1608 if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) 1638 if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription )
1609 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); 1639 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription);
1610 break; 1640 break;
1611 case 9:// Armor Class 1641 case 9:// Armor Class
1612 if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) 1642 if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription )
1613 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); 1643 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription);
1614 break; 1644 break;
1615 case 10:// Player Condition 1645 case 10:// Player Condition
1616 strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription); 1646 strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription);
1617 strcat(pTmpBuf2.data(), "\n"); 1647 strcat(pTmpBuf2.data(), "\n");
1618 extern std::array<unsigned int, 18> pConditionImportancyTable; 1648 extern std::array<unsigned int, 18> pConditionImportancyTable;
1637 sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); 1667 sprintfex(pTmpBuf.data(), "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord);
1638 strcat(pTmpBuf2.data(), pTmpBuf.data()); 1668 strcat(pTmpBuf2.data(), pTmpBuf.data());
1639 } 1669 }
1640 } 1670 }
1641 if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() ) 1671 if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() )
1642 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data()); 1672 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
1643 break; 1673 break;
1644 case 11:// Fast Spell 1674 case 11:// Fast Spell
1645 if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) 1675 if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription )
1646 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); 1676 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription);
1647 break; 1677 break;
1648 case 12:// Player Age 1678 case 12:// Player Age
1649 if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) 1679 if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription )
1650 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); 1680 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription);
1651 break; 1681 break;
1652 case 13:// Player Level 1682 case 13:// Player Level
1653 if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) 1683 if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription )
1654 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); 1684 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription);
1655 break; 1685 break;
1656 case 14://Experience 1686 case 14://Experience
1657 v15 = pPlayers[uActiveCharacter]->uLevel; 1687 v15 = pPlayers[uActiveCharacter]->uLevel;
1658 do 1688 do
1659 { 1689 {
1670 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); 1700 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
1671 strcat(pTmpBuf.data(), "\n"); 1701 strcat(pTmpBuf.data(), "\n");
1672 strcat(pTmpBuf.data(), pTmpBuf2.data()); 1702 strcat(pTmpBuf.data(), pTmpBuf2.data());
1673 sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data()); 1703 sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
1674 if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() ) 1704 if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() )
1675 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data()); 1705 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
1676 break; 1706 break;
1677 case 15:// Attack Bonus 1707 case 15:// Attack Bonus
1678 if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) 1708 if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription )
1679 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); 1709 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription);
1680 break; 1710 break;
1681 case 16:// Attack Damage 1711 case 16:// Attack Damage
1682 if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) 1712 if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription )
1683 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); 1713 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription);
1684 break; 1714 break;
1685 case 17:// Missle Bonus 1715 case 17:// Missle Bonus
1686 if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) 1716 if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription )
1687 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); 1717 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription);
1688 break; 1718 break;
1689 case 18:// Missle Damage 1719 case 18:// Missle Damage
1690 if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) 1720 if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription )
1691 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); 1721 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription);
1692 break; 1722 break;
1693 case 19:// Fire Resistance 1723 case 19:// Fire Resistance
1694 if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) 1724 if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription )
1695 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); 1725 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription);
1696 break; 1726 break;
1697 case 20:// Air Resistance 1727 case 20:// Air Resistance
1698 if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) 1728 if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription )
1699 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); 1729 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription);
1700 break; 1730 break;
1701 case 21:// Water Resistance 1731 case 21:// Water Resistance
1702 if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) 1732 if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription )
1703 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); 1733 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription);
1704 break; 1734 break;
1705 case 22:// Earth Resistance 1735 case 22:// Earth Resistance
1706 if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) 1736 if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription )
1707 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); 1737 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription);
1708 break; 1738 break;
1709 case 23:// Mind Resistance 1739 case 23:// Mind Resistance
1710 if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) 1740 if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription )
1711 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); 1741 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription);
1712 break; 1742 break;
1713 case 24:// Body Resistance 1743 case 24:// Body Resistance
1714 if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) 1744 if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription )
1715 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); 1745 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription);
1716 break; 1746 break;
1717 case 25: // Skill Points 1747 case 25: // Skill Points
1718 if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) 1748 if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription )
1719 sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); 1749 CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
1720 break; 1750 break;
1721 case 26: 1751 case 26: // Class description
1722 __debugbreak(); 1752 {
1723 //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType); 1753 auto v24 = pClassNames[pPlayers[uActiveCharacter]->classType];
1724 //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames); 1754 auto v7 = pClassDescriptions[pPlayers[uActiveCharacter]->classType];
1725 //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions); 1755 if (v7 && v24)
1726 //if ( v24 && v7 ) 1756 CharacterUI_DrawTooltip(v24, v7);
1727 //sub_4179BC_draw_tooltip(v24, v7); 1757 }
1728 break; 1758 break;
1759
1729 default: 1760 default:
1730 break; 1761 break;
1731 } 1762 }
1732 } 1763 }
1733 1764