changeset 1727:2c38e17e5a3f

m
author Ritor1
date Wed, 25 Sep 2013 12:54:27 +0600
parents 9e81a9147752
children 7b6b4ce8da76
files mm7_5.cpp
diffstat 1 files changed, 51 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_5.cpp	Wed Sep 25 12:22:38 2013 +0600
+++ b/mm7_5.cpp	Wed Sep 25 12:54:27 2013 +0600
@@ -4941,10 +4941,7 @@
   if (a2.x <= 13 || a2.x >= 462)
     return;
 
-  auto player = pPlayers[uActiveCharacter];
-
   int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF;
-  //pMouse->GetClickPos(&pX, &pY);
   if (!item_pid)
   {
     int inventory_mouse_x = a2.x - 14;
@@ -4960,16 +4957,16 @@
     if (inventory_idx > 126)
       return;
 
-    v7 = player->GetItemIDAtInventoryIndex(&inventory_idx);
+    v7 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&inventory_idx);
     if (v7 == 0)
       return;
 
     item_pid = v7;
   }
 
-  if (!player->CanAct())
+  if (!pPlayers[uActiveCharacter]->CanAct())
   {
-    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], player->pName, pGlobalTXT_LocalizationStrings[541]);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]);//%s не в состоянии %s Опознать предметы
     v43.Hint = pTmpBuf.data();
     v43.uFrameWidth = 384;
     v43.uFrameHeight = 180;
@@ -4983,15 +4980,14 @@
   }
 
   --item_pid;
-  int alchemy_level = (int8_t)player->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY);
+  int alchemy_level = (int8_t)pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY);
   v9 = alchemy_level & 0x3F;
   //v45 = alchemy_level & 0x3F;
   int alchemy_skill = SkillToMastery(alchemy_level);
 
-  auto item = &player->pInventoryItemList[item_pid];
+  auto item = &pPlayers[uActiveCharacter]->pInventoryItemList[item_pid];
   if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE)
   {
-__show_item_desc:
     GameUI_DrawItemInfo(item);
     return;
   }
@@ -5019,7 +5015,8 @@
       no_rightlick_in_inventory = 1;
       return;
     }
-    goto __show_item_desc;
+    GameUI_DrawItemInfo(item);
+    return;
   }
 
   else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM)
@@ -5041,7 +5038,8 @@
       no_rightlick_in_inventory = true;
       return;
     }
-    goto __show_item_desc;
+    GameUI_DrawItemInfo(item);
+    return;
   }
 
   else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION &&
@@ -5086,25 +5084,27 @@
       no_rightlick_in_inventory = true;
       return;
     }
-    goto __show_item_desc;
+    GameUI_DrawItemInfo(item);
+    return;
   }
 
 
 
   if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES ||
       pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE ||
-      player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE)
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE)
   {
     if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST ||
         pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION ||
-        player->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST ||
-        player->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION)
+        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST ||
+        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION)
     {
       if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM &&
           (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) &&
           pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION &&
           pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM)
-        goto __show_item_desc;
+       GameUI_DrawItemInfo(item);
+       return;
     }
 
     // src not reagent,  dst not bottle
@@ -5176,7 +5176,7 @@
 LABEL_54:
     int pOut_y = 0;
     int pOut_x = item_pid + 1;
-    v17 = (int)player->pInventoryMatrix;
+    v17 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix;
     while ( *(int *)v17 != pOut_x )
     {
       ++pOut_y;
@@ -5190,12 +5190,13 @@
     v18 = pOut_y;
 LABEL_59:
     if ( !v51 )
-      goto __show_item_desc;;
+      GameUI_DrawItemInfo(item);
+      return;
     if ( v51 == 1 )
     {
-      player->RemoveItemAtInventoryIndex(v18);
+      pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
       v26 = rand();
-      player->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
+      pPlayers[uActiveCharacter]->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE);
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
@@ -5206,18 +5207,18 @@
     {
       if ( v51 == 2 )
       {
-        player->RemoveItemAtInventoryIndex(v18);
+        pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
         v25 = rand();
-        player->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE);
+        pPlayers[uActiveCharacter]->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE);
         v23 = 1;
       }
       else
       {
         if ( v51 == 3 )
         {
-          player->RemoveItemAtInventoryIndex(v18);
+          pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
           v24 = rand();
-          player->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE);
+          pPlayers[uActiveCharacter]->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE);
           v23 = 5;
         }
         else
@@ -5226,18 +5227,18 @@
           {
             if ( v51 != 5 )
             {
-              v19 = player->AddItem(-1, 0xDCu);
+              v19 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
               if ( v19 )
                // *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
-                 player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED;
+                 pPlayers[uActiveCharacter]->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED;
               v20 = v14 + 50 * v15;
-              player->pInventoryItemList[item_pid].uItemID = v51;
-              player->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
-                                                       + player->pInventoryItemList[item_pid].uEnchantmentType)
+              pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = v51;
+              pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
+                                                       + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType)
                                                       / 2;
-              player->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168  + 388
+              pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168  + 388
 LABEL_74:
-              v22 = (int)((char *)player + 36 * item_pid);
+              v22 = (int)((char *)pPlayers[uActiveCharacter] + 36 * item_pid);
               if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) )
                 *(int *)(v22 + 552) |= 1u;
               if ( !dword_4E455C )
@@ -5246,7 +5247,7 @@
 				no_rightlick_in_inventory = 1;
 				return;
 			  }
-              player->PlaySound(SPEECH_16, 0);
+              pPlayers[uActiveCharacter]->PlaySound(SPEECH_16, 0);
 			  dword_4E455C = 0;
 			  pMouse->RemoveHoldingItem();
 			  no_rightlick_in_inventory = 1;
@@ -5254,24 +5255,25 @@
             }
             if ( v9 )
             {
-              if ( *(int *)(player + 36 * item_pid + 532) == 221 )
-                *(int *)(player + 36 * item_pid + 532) = pParty->pPickedItem.uItemID;
+              if ( *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) == 221 )
+                *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 532) = pParty->pPickedItem.uItemID;
               else
-                *(int *)(player + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType;
-              v21 = player->AddItem(-1, 0xDCu);
+                *(int *)(pPlayers[uActiveCharacter] + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType;
+              v21 = pPlayers[uActiveCharacter]->AddItem(-1, 0xDCu);
               if ( v21 )
                 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
-                player->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
+                pPlayers[uActiveCharacter]->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
               goto LABEL_74;
             }
-            goto __show_item_desc;
+            GameUI_DrawItemInfo(item);
+            return;
           }
-          player->RemoveItemAtInventoryIndex(v18);
-          player->SetCondition(0x10u, 0);
+          pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v18);
+          pPlayers[uActiveCharacter]->SetCondition(0x10u, 0);
           v23 = 0;
         }
       }
-      player->ItemsEnchant(v23);
+      pPlayers[uActiveCharacter]->ItemsEnchant(v23);
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
@@ -5286,8 +5288,8 @@
     sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0);
     if ( dword_4E455C )
     {
-      if ( player->CanAct() )
-        player->PlaySound(SPEECH_17, 0);
+      if ( pPlayers[uActiveCharacter]->CanAct() )
+        pPlayers[uActiveCharacter]->PlaySound(SPEECH_17, 0);
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u);
       dword_4E455C = 0;
     }
@@ -5298,7 +5300,7 @@
 
   // end alchemy
 
-  player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice();
+  pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice();
   switch ( pParty->pPickedItem.uItemID )
   {
     case 0xC8u:
@@ -5306,28 +5308,28 @@
     case 0xCAu:
     case 0xCBu:
     case 0xCCu:
-      player->pInventoryItemList[item_pid].uItemID = 222;
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222;
       break;
     case 0xCDu:
     case 0xCEu:
     case 0xCFu:
     case 0xD0u:
     case 0xD1u:
-      player->pInventoryItemList[item_pid].uItemID = 223;
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223;
       break;
     case 0xD2u:
     case 0xD3u:
     case 0xD4u:
     case 0xD5u:
     case 0xD6u:
-      player->pInventoryItemList[item_pid].uItemID = 224;
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224;
       break;
     case 0xD7u:
     case 0xD8u:
     case 0xD9u:
     case 0xDAu:
     case 0xDBu:
-      player->pInventoryItemList[item_pid].uItemID = 221;
+      pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221;
       break;
     default:
       break;
@@ -5336,7 +5338,7 @@
   no_rightlick_in_inventory = 1;
   if ( dword_4E455C )
   {
-    player->PlaySound(SPEECH_16, 0);
+    pPlayers[uActiveCharacter]->PlaySound(SPEECH_16, 0);
     dword_4E455C = 0;
   }
   return;