diff mm7_5.cpp @ 289:92d443ed0cba

Слияние
author Ritor1
date Mon, 18 Feb 2013 19:16:38 +0600
parents e3b70ba42154 250e49fef6f6
children 0ea5fbd16edb
line wrap: on
line diff
--- a/mm7_5.cpp	Mon Feb 18 19:16:15 2013 +0600
+++ b/mm7_5.cpp	Mon Feb 18 19:16:38 2013 +0600
@@ -365,7 +365,7 @@
               auto npc = pNPCStats->pNewNPCData + i;
               //do
               //{
-                if (npc->uFlags & 0x80 &&
+                if (npc->Hired() &&
                     (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) &&
                     (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) )
                 {
@@ -398,8 +398,8 @@
         case UIMSG_195:
           sub_4BCACC_bounties(uMessageParam);
           continue;
-        case UIMSG_88:
-          sub_4BC49B(uMessageParam);
+        case UIMSG_SelectDialogueOption:
+          OnSelectDialogueOption((DIALOGUE_TYPE)uMessageParam);
           continue;
         case UIMSG_19A:
           _4B4224_UpdateNPCTopics(uMessageParam);
@@ -2729,7 +2729,8 @@
               Actor::StealFrom(uMessageParam);
           }
           continue;
-        case 0x17:
+
+        case UIMSG_Attack:
           if ( !uActiveCharacter )
             //goto LABEL_90;
           {
@@ -2901,13 +2902,13 @@
             if ( !v90 )
               v90 = rand() % (signed int)pMapStats->uNumMaps + 1;
             pMapInfo = &pMapStats->pInfos[v90];
-            if ( rand() % 100 + 1 <= pMapInfo->field_30 )
+            if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent )
             {
               v91 = rand() % 100;
-              v92 = pMapInfo->field_31;
+              v92 = pMapInfo->EncM1percent;
               v93 = v91 + 1;
               if ( v93 > v92 )
-                pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->field_32) + 2);
+                pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2);
               else
                 pNPCData4 = (NPCData *)v0;
               if ( !sub_45063B(pMapInfo, (int)pNPCData4) )
@@ -3479,7 +3480,7 @@
           v158 = pParty->uNumGold + pParty->uNumGoldInBank;
           v146 = pGlobalTXT_LocalizationStrings[489];// "You have %d total gold, %d in the Bank""
           //goto _sprintex_draw_status_and_continue;
-          sprintf(pTmpBuf, v146, v158, v174);
+          sprintfex(pTmpBuf, v146, v158, v174);
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
         case UIMSG_ShowStatus_DateTime:
@@ -3505,7 +3506,7 @@
           goto _sprintex_2args_draw_status_and_continue;
         case UIMSG_ShowStatus_Player:
           pPlayer5 = pPlayers[uMessageParam];
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s"
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s"
           strcat(pTmpBuf, ": ");
           v107 = pPlayer5->GetMajorConditionIdx();
           strcat(pTmpBuf, aCharacterConditionNames[v107]);
@@ -8586,7 +8587,7 @@
   unsigned int v1; // ebx@1
   Player *pPlayer; // edi@1
   int v3; // ecx@1
-  int v4; // edi@3
+  int *v4; // edi@3
   unsigned int v5; // ebx@3
   int v6; // eax@3
   LODFile_IconsBitmaps *v7; // ecx@7
@@ -8628,7 +8629,7 @@
   int v43; // [sp+10h] [bp-20h]@47
   unsigned int a3; // [sp+14h] [bp-1Ch]@3
   unsigned int a2; // [sp+18h] [bp-18h]@3
-  int v46; // [sp+1Ch] [bp-14h]@1
+  unsigned int *v46; // [sp+1Ch] [bp-14h]@1
   Player *v47; // [sp+20h] [bp-10h]@1
   int v48; // [sp+24h] [bp-Ch]@1
   int v49; // [sp+24h] [bp-Ch]@26
@@ -8643,17 +8644,17 @@
   pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY,
     (Texture *)(uTextureID_5118C8 != -1 ? &pIcons_LOD->pTextures[uTextureID_5118C8] : 0));
   v3 = 0;
-  v46 = (int)&pPlayer->pEquipment.field_28;
+  v46 = &pPlayer->pEquipment.field_28;
   v48 = 0;
   do
   {
-    if ( !*(int *)v46 )
+    if ( !*v46 )
       goto LABEL_24;
-    v39 = *(int *)v46;
-    v4 = (int)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v46 + 5];
+    v39 = *v46;
+	v4 = (int *)&pPlayer->pInventoryItems[*v46-1].uItemID;
     a3 = pPaperdollRingsY[v3];
     a2 = pPaperdollRingsX[v3];
-    v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[*(int *)v4].pIconName, TEXTURE_16BIT_PALETTE);
+    v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[*v4].pIconName, TEXTURE_16BIT_PALETTE);
     v6 = *(int *)(v4 + 20);
     if ( *(int *)(v4 + 20) & 0xF0 )
     {
@@ -13570,7 +13571,7 @@
   dword_506548 = 0;
   dword_506520 = 0;
   v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6);
-  v8 = sub_495461(
+  v8 = BuilDialogueString(
          pStorylineText->StoreLine[v6].pText,
          uActiveCharacter - 1,
          0,
@@ -16044,7 +16045,7 @@
       while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/
       for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
       {
-        if (pNPCStats->pNewNPCData[i].uFlags & 0x80)
+        if (pNPCStats->pNewNPCData[i].Hired())
         {
           if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
           {
@@ -16096,7 +16097,7 @@
         {
           v10 = v6->pName;
           v11 = pTmpBuf;
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
         }
         else
         {
@@ -16108,7 +16109,7 @@
         a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u);
         a1.uFrameWidth -= 24;
         a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
-        v14 = sub_495461((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0);
+        v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0);
         a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0);
       }
     }
@@ -16516,8 +16517,7 @@
     y = pY;
     x = pX;
   }
-  if ( pCurrentScreen
-    || !dword_507B98_ctrl_pressed )
+  if ( pCurrentScreen != SCREEN_GAME || !dword_507B98_ctrl_pressed )
     goto LABEL_30;
   v4 = GetCurrentMenuID();
   x = pX;
@@ -16564,7 +16564,7 @@
     if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW )
     {
 LABEL_50:
-      i->field_2C = 1;
+      i->field_2C_is_pushed = 1;
       v10 = pMessageQueue_50CBD0->uNumMessages;
       if ( pMessageQueue_50CBD0->uNumMessages )
       {
@@ -16764,76 +16764,55 @@
 }
 
 //----- (00417AD4) --------------------------------------------------------
-unsigned int __fastcall sub_417AD4(unsigned int uPlayerClass, enum PLAYER_SKILL_TYPE uPlayerSkillType, signed int a3)
-{
-  enum PLAYER_SKILL_TYPE v3; // ebx@1
-  signed int v4; // edi@1
-  unsigned int v5; // ecx@1
-  int v6; // edx@1
-  int v7; // eax@7
+unsigned int __fastcall GetSkillColor(unsigned int uPlayerClass, enum PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level)
+{
   int v8; // eax@10
-  unsigned __int8 v9; // sf@10
-  unsigned __int8 v10; // of@10
-  int v11; // eax@11
   int v12; // eax@14
   unsigned int yellow; // [sp+Ch] [bp-Ch]@1
   unsigned int red; // [sp+10h] [bp-8h]@1
   unsigned int white; // [sp+14h] [bp-4h]@1
 
-  v3 = uPlayerSkillType;
-  v4 = uPlayerClass;
   white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
   red = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
   yellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0);
-  v5 = 0;
-  v6 = v4 % 4;
-  if ( !(v4 % 4) )
-  {
-    v11 = 37 * v4 + v3;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[0][v11] >= a3 )
-      goto LABEL_8;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[1][v11] < a3
-      && byte_4ED970_skill_learn_ability_by_class_table[2][v11] < a3 )
-    {
-      v12 = byte_4ED970_skill_learn_ability_by_class_table[3][v11];
-      v10 = __OFSUB__(v12, a3);
-      v9 = v12 - a3 < 0;
-LABEL_15:
-      v5 = red;
-      if ( v9 ^ v10 )
-        return v5;
+  if ( !(uPlayerClass % 4) )
+  {
+    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level )
+      return white;
+    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level
+      && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level )
+    {
+      v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType];
+      if ( v12 < skill_level )
+        return red;
     }
     return yellow;
   }
-  if ( v6 == 1 )
-  {
-    v7 = 37 * v4 + v3;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[0][v7] >= a3 )
-      goto LABEL_8;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[1][v7] < a3 )
-    {
-      v8 = byte_4ED970_skill_learn_ability_by_class_table[2][v7];
-      v10 = __OFSUB__(v8, a3);
-      v9 = v8 - a3 < 0;
-      goto LABEL_15;
+  if ( (uPlayerClass % 4) == 1 )
+  {
+    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level )
+      return white;
+    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level )
+    {
+      v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType];
+      if ( v8 < skill_level)
+        return red;
     }
     return yellow;
   }
-  if ( v6 > 1 && v6 <= 3 )
-  {
-    if ( byte_4ED970_skill_learn_ability_by_class_table[v4][v3] < a3 )
+  if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 )
+  {
+    if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level )
       return red;
-LABEL_8:
-    v5 = white;
-  }
-  return v5;
+  }
+  return white;
 }
 
 //----- (00417BB5) --------------------------------------------------------
 const char *__fastcall CharacterUI_GetSkillDescText(unsigned int uPlayerID, enum PLAYER_SKILL_TYPE uPlayerSkillType)
 {
-  enum PLAYER_SKILL_TYPE v2; // esi@1
-  unsigned int v3; // ebx@1
+  //enum PLAYER_SKILL_TYPE v2; // esi@1
+  //unsigned int v3; // ebx@1
   int v4; // edi@1
   int v5; // eax@1
   Player *pPlayer; // ebx@7
@@ -16865,11 +16844,11 @@
   unsigned __int16 *v33; // [sp+534h] [bp-10h]@1
   int v34; // [sp+538h] [bp-Ch]@1
   unsigned __int16 *v35; // [sp+53Ch] [bp-8h]@1
-  enum PLAYER_SKILL_TYPE v36; // [sp+540h] [bp-4h]@1
-
-  v2 = uPlayerSkillType;
-  v3 = uPlayerID;
-  v36 = uPlayerSkillType;
+  //enum PLAYER_SKILL_TYPE v36; // [sp+540h] [bp-4h]@1
+
+  //v2 = uPlayerSkillType;
+  //v3 = uPlayerID;
+  //v36 = uPlayerSkillType;
   v4 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]);// Normal
   v34 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]);// Expert
   v33 = (unsigned __int16 *)pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]);// Master
@@ -16881,73 +16860,58 @@
     v35 = v33;
   if ( v5 > (signed int)v35 )
     v35 = (unsigned __int16 *)v5;
-  pPlayer = &pParty->pPlayers[v3];
-  v33 = &pPlayer->pActiveSkills[v2];
-  v7 = pPlayer->GetActualSkillLevel(v2);
-  v8 = LOBYTE(pPlayer->pActiveSkills[v2]);
+  pPlayer = &pParty->pPlayers[uPlayerID];
+  //v33 = &pPlayer->pActiveSkills[uPlayerSkillType];
+  v7 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
+  v8 = pPlayer->pActiveSkills[uPlayerSkillType];
   a2[0] = 0;
   Source[0] = 0;
   if ( (v8 & 0x3F) == (v7 & 0x3F) )
   {
     strcpy(a2, "%s\n\n");
-    v24 = sub_417AD4(pPlayer->classType, v2, 1);
+    v24 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
     sprintf(Source, format_4E2DC8, v24);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
-    v25 = sub_417AD4(pPlayer->classType, v36, 2);
+    v25 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
     sprintf(Source, format_4E2DC8, v25);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
-    v26 = sub_417AD4(pPlayer->classType, v36, 3);
+    v26 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
     sprintf(Source, format_4E2DC8, v26);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
     v27 = pPlayer->classType;
-    v28 = v36;
-    v29 = sub_417AD4(v27, v36, 4);
+    v28 = uPlayerSkillType;
+    v29 = GetSkillColor(v27, uPlayerSkillType, 4);
     sprintf(Source, format_4E2DC8, v29);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
 
     v23 = static_sub_417BB5_out_string;
-    sprintf(
-      static_sub_417BB5_out_string,
-      a2,
-      pSkillDesc[v28],
-      pGlobalTXT_LocalizationStrings[431],      // Normal
-      (char *)v35 + 3,
-      v35 + 5,
-      pNormalSkillDesc[v28],
-      pGlobalTXT_LocalizationStrings[433],      // Expert
-      (char *)v35 + 3,
-      v35 + 5,
-      pExpertSkillDesc[v28],
-      pGlobalTXT_LocalizationStrings[432],      // Master
-      (char *)v35 + 3,
-      v35 + 5,
-      pMasterSkillDesc[v28],
-      pGlobalTXT_LocalizationStrings[96],       // Grand
-      (char *)v35 + 3,
-      v35 + 5,
-      pGrandSkillDesc[v28]);
+    sprintf(static_sub_417BB5_out_string, a2, pSkillDesc[v28], pGlobalTXT_LocalizationStrings[431],      // Normal
+      (char *)v35 + 3, v35 + 5, pNormalSkillDesc[v28], pGlobalTXT_LocalizationStrings[433],      // Expert
+      (char *)v35 + 3, v35 + 5, pExpertSkillDesc[v28], pGlobalTXT_LocalizationStrings[432],      // Master
+      (char *)v35 + 3, v35 + 5, pMasterSkillDesc[v28], pGlobalTXT_LocalizationStrings[96],       // Grand
+      (char *)v35 + 3, v35 + 5, pGrandSkillDesc[v28]);
   }
   else
   {
     strcpy(a2, "%s\n\n");
-    v9 = sub_417AD4(pPlayer->classType, v2, 1);
+    v9 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 1);
     sprintf(Source, format_4E2DC8, v9);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
-    v10 = sub_417AD4(pPlayer->classType, v36, 2);
+    v10 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 2);
     sprintf(Source, format_4E2DC8, v10);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
-    v11 = sub_417AD4(pPlayer->classType, v36, 3);
+    v11 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 3);
     sprintf(Source, format_4E2DC8, v11);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n");
-    v12 = v36;
-    v13 = sub_417AD4(pPlayer->classType, v36, 4);
+    v12 = uPlayerSkillType;
+    v13 = GetSkillColor(pPlayer->classType, uPlayerSkillType, 4);
     sprintf(Source, format_4E2DC8, v13);
     strcat(a2, Source);
     strcat(a2, "%s\t%03d:\t%03d%s\t000\n\n");
@@ -16959,7 +16923,7 @@
     v16 = (int)(v35 + 5);
     v15 = (PLAYER_SKILL_TYPE)((int)v15 * 4);
     v34 = (int)((char *)v35 + 3);
-    v17 = pPlayer->GetActualSkillLevel(v36);
+    v17 = pPlayer->GetActualSkillLevel(uPlayerSkillType);
     v18 = *(int *)((char *)pGrandSkillDesc + v15);
     v19 = *(int *)((char *)pMasterSkillDesc + v15);
     v20 = *(int *)((char *)pExpertSkillDesc + v15);
@@ -17400,7 +17364,7 @@
   int v137; // [sp+1Ch] [bp-4h]@27
   int v138; // [sp+1Ch] [bp-4h]@33
 
-  pPlayer = &pParty->pPlayers[uPlayerID-1];//(Player *)&stru_AA1058[3].pSounds[6972 * uPlayerID + 40552];
+  pPlayer = &pParty->pPlayers[uPlayerID-1];
   v2 = pIcons_LOD->LoadTexture("fr_stats", TEXTURE_16BIT_PALETTE);
   pRenderer->DrawTextureIndexed(8, 8, (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0));
   v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
@@ -17857,7 +17821,7 @@
   }
   v12 = 0;
   a5 = pGUIWindow_CurrentMenu->uNumControls;
-  v18 = &pParty->pPlayers[v0-1];	  //&stru_AA1058[3].pSounds[6972 * v0 + 40552];
+  v18 = &pParty->pPlayers[v0-1];
   v2 = pFontLucida;
   v14 = pWeaponSkills;
   v3 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;