diff UI/UIPopup.cpp @ 1449:27b7ee003c7c

Merge
author Gloval
date Tue, 06 Aug 2013 00:56:33 +0400
parents 28f87f5234a1
children 934074e7fcc1
line wrap: on
line diff
--- a/UI/UIPopup.cpp	Tue Aug 06 00:52:46 2013 +0400
+++ b/UI/UIPopup.cpp	Tue Aug 06 00:56:33 2013 +0400
@@ -29,6 +29,38 @@
 
 static char static_sub_417BB5_out_string[1200]; // static to a file, not sub actually
 
+
+//----- (004179BC) --------------------------------------------------------
+void CharacterUI_DrawTooltip(const char *a1, const char *a2)
+{
+  //const char *v2; // ebx@1
+  //const char *v3; // edi@1
+  //unsigned int v4; // eax@1
+  GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1
+  POINT v6; // [sp+60h] [bp-8h]@1
+
+  //v2 = a2;
+  //v3 = a1;
+  memset(&Dst, 0, 0x54u);
+  Dst.uFrameWidth = 384;
+  Dst.uFrameHeight = 256;
+  Dst.uFrameX = 128;
+  Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30;
+  Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(a2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24;
+  Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
+  Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
+  Dst.DrawMessageBox(0);
+  Dst.uFrameX += 12;
+  Dst.uFrameWidth -= 24;
+  Dst.uFrameY += 12;
+  Dst.uFrameHeight -= 12;
+  Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
+  Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
+  sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, a1);
+  Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
+  Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, a2, 0, 0, 0);
+}
+
 //----- (004151D9) --------------------------------------------------------
 void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight)
     {
@@ -1550,7 +1582,7 @@
                 && (signed int)v1 <= (signed int)i->uW )
                 {
                 v3 = CharacterUI_GetSkillDescText(uActiveCharacter - 1, (PLAYER_SKILL_TYPE)i->msg_param);
-                sub_4179BC_draw_tooltip(pSkillNames[i->msg_param], v3);
+                CharacterUI_DrawTooltip(pSkillNames[i->msg_param], v3);
                 v1 = pY;
                 v0 = pX;
                 }
@@ -1558,16 +1590,14 @@
         }
     else
         {
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
         }
     
     }
 
 //----- (00418083) --------------------------------------------------------
 void __cdecl CharacterUI_StatsTab_ShowHint()
-  {
-  LONG _x; // esi@1
-  LONG _y; // eax@1
+{
   int pStringNum; // edi@1
   signed int pTextColor; // eax@15
   char *pHourWord; // ecx@17
@@ -1578,16 +1608,16 @@
   int pHour; // [sp+14h] [bp-1Ch]@15
   unsigned int pDay; // [sp+24h] [bp-Ch]@15
 
-  _x = pMouse->GetCursorPos(&a2)->x;
-  _y = pMouse->GetCursorPos(&a2)->y;
-  for ( pStringNum = 0; pStringNum < (signed int)&off_4E2A12; ++pStringNum )
+  pMouse->GetCursorPos(&a2);
+  for ( pStringNum = 0; pStringNum < stat_string_coord.size(); ++pStringNum )
   {
-    if ( _x >= stat_string_coord[pStringNum].x  && _x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
+    if (a2.x >= stat_string_coord[pStringNum].x && a2.x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width )
     {
-      if ( _y >= stat_string_coord[pStringNum].y && _y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height )
+      if (a2.y >= stat_string_coord[pStringNum].y && a2.y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height )
         break;
     }
   }
+
   switch ( pStringNum )
   {
     case 0:// Attributes
@@ -1598,19 +1628,19 @@
     case 5:
     case 6:
       if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] )
-        sub_4179BC_draw_tooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]);
+        CharacterUI_DrawTooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]);
       break;
     case 7:// Health Points
       if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription);
       break;
     case 8:// Spell Points
       if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription);
       break;
     case 9:// Armor Class
       if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription);
       break;
     case 10:// Player Condition
       strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription);
@@ -1639,19 +1669,19 @@
         }
       }
       if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2.data() )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2.data());
       break;
     case 11:// Fast Spell
       if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription);
       break;
     case 12:// Player Age
       if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription);
       break;
     case 13:// Player Level
       if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription);
       break;
     case 14://Experience
       v15 = pPlayers[uActiveCharacter]->uLevel;
@@ -1672,60 +1702,61 @@
       strcat(pTmpBuf.data(), pTmpBuf2.data());
       sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
       if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
       break;
     case 15:// Attack Bonus
       if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription);
       break;
     case 16:// Attack Damage
       if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription);
       break;
     case 17:// Missle Bonus
       if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription);
       break;
     case 18:// Missle Damage
       if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription);
       break;
     case 19:// Fire Resistance
       if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription);
       break;
     case 20:// Air Resistance
       if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription);
       break;
     case 21:// Water Resistance
       if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription);
       break;
     case 22:// Earth Resistance
       if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription);
       break;
     case 23:// Mind Resistance
       if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription);
       break;
     case 24:// Body Resistance
       if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription);
       break;
     case 25: // Skill Points
       if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription )
-        sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
+        CharacterUI_DrawTooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
       break;
-    case 26:
-      __debugbreak();
-      //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType);
-      //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames);
-      //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions);
-      //if ( v24 && v7 )
-        //sub_4179BC_draw_tooltip(v24, v7);
-      break;
+    case 26: // Class description
+    {
+      auto v24 = pClassNames[pPlayers[uActiveCharacter]->classType];
+      auto v7 = pClassDescriptions[pPlayers[uActiveCharacter]->classType];
+      if (v7 && v24)
+        CharacterUI_DrawTooltip(v24, v7);
+    }
+    break;
+
     default:
       break;
   }