changeset 1014:a704435d3285

comtinue player cleaning
author Gloval
date Sun, 19 May 2013 20:38:49 +0400
parents 9e823ad5eaa6
children c8c5224164da
files Party.cpp Player.cpp Player.h UICharacter.cpp UIHouses.cpp UIPartyCreation.cpp mm7_1.cpp mm7_2.cpp mm7_5.cpp
diffstat 9 files changed, 408 insertions(+), 490 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/Party.cpp	Sun May 19 20:38:49 2013 +0400
@@ -331,9 +331,9 @@
   memset(pHirelings, 0, 2 * sizeof(*pHirelings));
 
   strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan
-  pParty->pPlayers[0].field_1928 = 17;
-  pParty->pPlayers[0].uFace = 17;
-  pParty->pPlayers[0].field_1924 = 17;
+  pParty->pPlayers[0].uPrevFace = 17;
+  pParty->pPlayers[0].uCurrentFace = 17;
+  pParty->pPlayers[0].uPrevVoiceID = 17;
   pParty->pPlayers[0].uVoiceID = 17;
   pParty->pPlayers[0].uMight = 30;
   pParty->pPlayers[0].uIntelligence = 5;
@@ -346,9 +346,9 @@
   pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_ARMSMASTER] = 1;        // armsmaster
   pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_BOW] = 1;         // bow
   pParty->pPlayers[0].pActiveSkills[PLAYER_SKILL_SWORD] = 1;         // sword
-  pParty->pPlayers[1].field_1928 = 3;
-  pParty->pPlayers[1].uFace = 3;
-  pParty->pPlayers[1].field_1924 = 3;
+  pParty->pPlayers[1].uPrevFace = 3;
+  pParty->pPlayers[1].uCurrentFace = 3;
+  pParty->pPlayers[1].uPrevVoiceID = 3;
   pParty->pPlayers[1].uVoiceID = 3;
   strcpy(pParty->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); //Roderic
   pParty->pPlayers[1].uMight = 13;
@@ -362,9 +362,9 @@
   pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_STEALING] = 1;        // stealing
   pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_DAGGER] = 1;         // dagger
   pParty->pPlayers[1].pActiveSkills[PLAYER_SKILL_TRAP_DISARM] = 1;        // disarm trap
-  pParty->pPlayers[2].field_1928 = 14;
-  pParty->pPlayers[2].uFace = 14;
-  pParty->pPlayers[2].field_1924 = 14;
+  pParty->pPlayers[2].uPrevFace = 14;
+  pParty->pPlayers[2].uCurrentFace = 14;
+  pParty->pPlayers[2].uPrevVoiceID = 14;
   pParty->pPlayers[2].uVoiceID = 14;
   strcpy(pParty->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); // Serena
   pParty->pPlayers[2].uMight = 12;
@@ -380,13 +380,13 @@
   pParty->pPlayers[2].pActiveSkills[PLAYER_SKILL_MACE] = 1;         // mace
   strcpy(pParty->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); // Alexis
   v3 = 10;
-  pParty->pPlayers[3].field_1928 = 10;
-  pParty->pPlayers[3].uFace = 10;
+  pParty->pPlayers[3].uPrevFace = 10;
+  pParty->pPlayers[3].uCurrentFace = 10;
   //pResMagicBase = (int)&pParty->pPlayers[0].sResMagicBase;
   pParty->pPlayers[3].uEndurance = 13;
   pParty->pPlayers[3].uAccuracy = 13;
   pParty->pPlayers[3].uSpeed = 13;
-  pParty->pPlayers[3].field_1924 = 10;
+  pParty->pPlayers[3].uPrevVoiceID = 10;
   pParty->pPlayers[3].uVoiceID = 10;
   pParty->pPlayers[3].uMight = 5;
   pParty->pPlayers[3].uIntelligence = 30;
@@ -600,8 +600,8 @@
   pPlayers[1].Reset(PLAYER_CLASS_THEIF);
   pPlayers[2].Reset(PLAYER_CLASS_CLERIC);
   pPlayers[3].Reset(PLAYER_CLASS_SORCERER);
-  pPlayers[0].uFace = 17;
-  pPlayers[0].field_1924 = 17;
+  pPlayers[0].uCurrentFace = 17;
+  pPlayers[0].uPrevVoiceID = 17;
   pPlayers[0].uVoiceID = 17;
   pPlayers[0].SetInitialStats();
  
@@ -642,8 +642,8 @@
   strcpy(pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]);
 
 
-  pPlayers[1].uFace = 3;
-  pPlayers[1].field_1924 = 3;
+  pPlayers[1].uCurrentFace = 3;
+  pPlayers[1].uPrevVoiceID = 3;
   pPlayers[1].uVoiceID = 3;
   pPlayers[1].SetInitialStats();
   v7 = SEX_MALE;
@@ -683,8 +683,8 @@
   pPlayers[1].uSex = v7;
   pPlayers[1].RandomizeName();
   strcpy(pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]);
-  pPlayers[2].uFace = 14;
-  pPlayers[2].field_1924 = 14;
+  pPlayers[2].uCurrentFace = 14;
+  pPlayers[2].uPrevVoiceID = 14;
   pPlayers[2].uVoiceID = 14;
   pPlayers[2].SetInitialStats();
   v8 = SEX_MALE;
@@ -724,8 +724,8 @@
   pPlayers[2].uSex = v8;
   pPlayers[2].RandomizeName();
   strcpy(pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]);
-  pPlayers[3].uFace = 10;
-  pPlayers[3].field_1924 = 10;
+  pPlayers[3].uCurrentFace = 10;
+  pPlayers[3].uPrevVoiceID = 10;
   pPlayers[3].uVoiceID = 10;
   pPlayers[3].SetInitialStats();
   v9 = SEX_MALE;
--- a/Player.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/Player.cpp	Sun May 19 20:38:49 2013 +0400
@@ -222,27 +222,21 @@
 
 
 //----- (004BE2DD) --------------------------------------------------------
-void Player::SalesProcess(unsigned int a2, int a3, int _2devent_idx)
-{
-  Player *v4; // edi@1
-  char *v5; // esi@1
+void Player::SalesProcess( unsigned int inventory_idnx, int item_index, int _2devent_idx )
+    {
   float v6; // ST04_4@1
-  signed int v7; // eax@1
-  signed int v8; // ebx@1
-
-  auto a4 = _2devent_idx;
-  v4 = this;
-  v5 = (char *)this + 36 * a3;
-  v6 = p2DEvents[a4 - 1].fPriceMultiplier;
-  //v6 = p2DEvents_minus1__20[13 * a4];
-  v7 = ((ItemGen *)(v5 + 532))->GetValue();
-  v8 = GetPriceSell(v7, v6);
-  if ( v5[552] & 2 )
-    v8 = 1;
-  if ( v8 < 1 )
-    v8 = 1;
-  RemoveItemAtInventoryIndex(a2);
-  Party::SetGold(pParty->uNumGold + v8);
+  signed int item_value; // eax@1
+  signed int sell_price; // ebx@1
+
+  item_value =pOwnItems[item_index].GetValue();
+  v6 = p2DEvents[ _2devent_idx - 1].fPriceMultiplier;
+  sell_price = GetPriceSell(item_value, v6);
+  if ( pOwnItems[item_index].Broken() )
+    sell_price = 1;
+  if ( sell_price < 1 )
+    sell_price = 1;
+  RemoveItemAtInventoryIndex(inventory_idnx);
+  Party::SetGold(pParty->uNumGold + sell_price);
 }
 
 
@@ -250,35 +244,21 @@
 //----- (0043EEF3) --------------------------------------------------------
 bool Player::_43EEF3()
 {
-  signed int v1; // esi@1
-  PlayerEquipment *v2; // edx@1
-  bool result; // eax@2
-
-  v1 = 0;
-  v2 = &this->pEquipment;
-  while ( 1 )
-  {
-    result = v2->uShield;
-    if ( v2->uShield )
-    {
-      result = *(int *)&this->pInventoryItems[result-1];
-      if ( result )
-      {
-        if ( result != 64 && result != 65 )
-          break;
-      }
-    }
-    ++v1;
-    v2 = (PlayerEquipment *)((char *)v2 + 4);
-    if ( v1 >= 16 )
-    {
-      LOBYTE(result) = 1;
-      return result;
-    }
-  }
-  LOBYTE(result) = 0;
-  return result;
-}
+  signed int item_idx; // esi@1
+  signed int item_id; // esi@1
+  for (int i=0; i<16;++i)
+      {
+     item_idx=pEquipment.pIndices[i];
+     if (item_idx)
+         {
+         item_id=pOwnItems[item_idx-1].uItemID;
+         if (item_id!=64 &&  item_id!= 65 ) //blaster& blaster rifle
+             return false;
+         }
+      }
+      return true;
+  }
+  
 
 
 
@@ -458,7 +438,7 @@
 
   v1 = this;
   v2 = (signed int)window_SpeakInHouse->ptr_1C;
-  if ( v2 == 78 || v2 > 80 && v2 <= 82 )
+  if ( (v2 == 78 || v2 > 80) && v2 <= 82 )
   {
     if ( GetMajorConditionIdx() == 18 )
       goto LABEL_6;
@@ -669,7 +649,7 @@
       {
         if ( v3 > 11 )
         {
-          if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 )
+          if ( v3 == CHARACTER_EXPRESSION_PERTIFIED ||( v3 > 97 && v3 <= 99) )
             return;
           goto LABEL_15;
         }
@@ -1073,259 +1053,220 @@
 
 //----- (00492D65) --------------------------------------------------------
 int Player::SetCondition(unsigned int uConditionIdx, int a3)
-{
-  Player *v3; // esi@1
-  Player **v4; // ebx@2
-  Player *v5; // ecx@21
-  Player *v6; // ecx@22
-  Player *v7; // ecx@29
-  Player *v8; // ecx@29
- 
-  Player *v11; // ecx@45
-  Player *v12; // ecx@46
-  char *v13; // eax@49
-  Player *v14; // ecx@58
-  Player *v15; // ecx@59
-  Player *v16; // ecx@60
-  signed int result; // eax@76
-  signed int v18; // ecx@77
-  int v19; // eax@77
-  char v20; // al@80
-  signed int v21; // ebx@82
-  signed int v22; // esi@82
-  int v23; // [sp-8h] [bp-1Ch]@7
-  int v24; // [sp-8h] [bp-1Ch]@15
-  int v25; // [sp-8h] [bp-1Ch]@53
-  int v26; // [sp-4h] [bp-18h]@7
-  signed int v27; // [sp-4h] [bp-18h]@15
-  int v28; // [sp-4h] [bp-18h]@53
-  char *v29; // [sp+Ch] [bp-8h]@1
-  int v30; // [sp+10h] [bp-4h]@2
-  int v31; // [sp+20h] [bp+Ch]@82
-
-  v3 = this;
-  v29 = (char *)this + 8 * uConditionIdx;
-  if ( *(_QWORD *)v29 )
-  {
-LABEL_76:
-    result = 0;
-  }
-  else
-  {
-    v4 = &pPlayers[1];
-    v30 = 0;
-    do
-    {
-      if ( (*v4)->CanAct() )
-        ++v30;
-      ++v4;
-    }
-    while ( (signed int)v4 <= (signed int)&pPlayers[4] );
+    {
+
+    signed int player_sex; // ecx@77
+    char zombi_face; // al@80
+    signed int remainig_player; // ebx@82
+    int players_before; // [sp+10h] [bp-4h]@2
+    int players_after; // [sp+20h] [bp+Ch]@82
+
+    if ( pConditions[uConditionIdx] )
+        return 0;
+    players_before = 0;
+    for (int i=1;i<5;++i)
+        if ( pPlayers[i]->CanAct() )
+            ++players_before;
+
     switch ( uConditionIdx )
-    {
-      case 0u:
-        v26 = 0;
-        v23 = 30;
-        goto LABEL_81;
-      case 1u:
+        {
+    case Condition_Cursed:
+        PlaySound((PlayerSpeech)30, 0);
+        break;
+    case Condition_Weak:
         if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )
-          goto LABEL_10;
-        v26 = 0;
-        v23 = 25;
-        goto LABEL_81;
-      case 2u:
-        if ( a3 != 1 )
-          goto LABEL_82;
-        if ( v3->HasEnchantedItemEquipped(22) )
-          goto LABEL_76;
-        v27 = 3;
-        v24 = 505;
-        goto LABEL_16;
-      case 3u:
-        v26 = 0;
-        v23 = 26;
-        goto LABEL_81;
-      case 4u:
-        v26 = 0;
-        v23 = 31;
-        goto LABEL_81;
-      case 5u:
+            {--pParty->pPartyBuffs[13].uPower;
+        if ( pParty->pPartyBuffs[13].uPower < 1u )
+            pParty->pPartyBuffs[13].Reset();
+        return 0;
+            }
+
+        PlaySound((PlayerSpeech)25, 0);
+        break;
+    case Condition_Sleep:
+        if ( a3 == 1 &&(HasEnchantedItemEquipped(22)||WearsItem(505, 3))) 
+            return 0;
+        break;
+
+    case Condition_Fear:
+        PlaySound((PlayerSpeech)26, 0);
+        break;
+    case Condition_Drunk:
+        PlaySound((PlayerSpeech)31, 0);
+        break;
+
+    case Condition_Insane:
         if ( a3 == 1
-          && (v3->HasEnchantedItemEquipped(19) || v5->WearsItem(505, 3) || v6->WearsItem(530, 6)) )
-          goto LABEL_76;
-        v26 = 0;
-        v23 = 29;
-        goto LABEL_81;
-      case 6u:
-      case 8u:
-      case 0xAu:
+            && (HasEnchantedItemEquipped(19) || WearsItem(505, 3) || WearsItem(530, 6)) )
+            return 0;
+
+        PlaySound((PlayerSpeech)29, 0);
+        break;
+    case Condition_Poison1:
+    case Condition_Poison2:
+    case Condition_Poison3:
+        if ( a3 == 1 )
+            {
+            if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 )
+                {
+                --pParty->pPartyBuffs[13].uPower;
+                if ( pParty->pPartyBuffs[13].uPower < 1u )
+                    pParty->pPartyBuffs[13].Reset();
+                }
+            if ( HasEnchantedItemEquipped(21)
+                || WearsItem(505, 3)
+                || WearsItem(530, 6) )
+                //goto LABEL_76;
+                return 0;
+            }
+
+        //v23 = 27;
+        PlaySound((PlayerSpeech)27, 0);
+        break;
+
+    case Condition_Disease1:
+    case Condition_Disease2:
+    case Condition_Disease3:
         if ( a3 == 1 )
-        {
-          if ( (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )
-          {
+            {            
+            if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 )
+                {
+                --pParty->pPartyBuffs[13].uPower;
+                if ( pParty->pPartyBuffs[13].uPower < 1u )
+                    pParty->pPartyBuffs[13].Reset();
+                return 0;
+                }
+
+            if ( HasEnchantedItemEquipped(18) ||WearsItem(505, 3) || WearsItem(530, 6) )
+                return 0;
+            }
+        PlaySound((PlayerSpeech)28, 0);
+        break;
+    case Condition_Paralyzed:
+        if ( a3 == 1 )
+            {
+            if ( pParty->pPartyBuffs[13].uExpireTime > 0i64 )
+                {
+                --pParty->pPartyBuffs[13].uPower;
+                if ( pParty->pPartyBuffs[13].uPower < 1u )
+                    pParty->pPartyBuffs[13].Reset();
+                return 0;
+                }
+
+            if ( HasEnchantedItemEquipped(20)|| WearsItem(505, 3)|| WearsItem(507, 16)||WearsItem(530, 6))
+                return 0;
+            }
+        break;
+    case Condition_Unconcious:
+        PlaySound(SPEECH_32, 0);
+        if ( sHealth > 0 )
+            sHealth = 0;
+        break;
+    case Condition_Dead:
+        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0i64 && pParty->pPartyBuffs[13].uSkill >= 4u )
+            {
             --pParty->pPartyBuffs[13].uPower;
             if ( pParty->pPartyBuffs[13].uPower < 1u )
-              pParty->pPartyBuffs[13].Reset();
-          }
-          if ( v3->HasEnchantedItemEquipped(21)
-            || v7->WearsItem(505, 3)
-            || v8->WearsItem(530, 6) )
-            goto LABEL_76;
-        }
-        v26 = 0;
-        v23 = 27;
-        goto LABEL_81;
-      case 7u:
-      case 9u:
-      case 0xBu:
-        if ( a3 != 1 )
-          goto LABEL_40;
-        if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0
-          && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) )
-          goto LABEL_10;
-        if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) )
-          goto LABEL_76;
-LABEL_40:
-        v26 = 0;
-        v23 = 28;
-        goto LABEL_81;
-      case 0xCu:
-        if ( a3 != 1 )
-          goto LABEL_82;
-        if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0
-          && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) )
-          goto LABEL_10;
-        if ( v3->HasEnchantedItemEquipped(20)
-          || v11->WearsItem(505, 3)
-          || v12->WearsItem(507, 16) )
-          goto LABEL_76;
-        v27 = 6;
-        v24 = 530;
-LABEL_16:
-        if ( v3->WearsItem(v24, v27) )
-          goto LABEL_76;
-        goto LABEL_82;
-      case 0xDu:
-        v3->PlaySound(SPEECH_32, 0);
-        v13 = (char *)&v3->sHealth;
-        goto LABEL_70;
-      case 0xEu:
-        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u )
-          goto LABEL_10;
-        v28 = 0;
-        v25 = 33;
-        goto LABEL_67;
-      case 0xFu:
+                pParty->pPartyBuffs[13].Reset();
+            }
+
+        PlaySound((PlayerSpeech)33, 0);
+        if ( sHealth > 0 )
+            sHealth = 0;
+        if ( sMana > 0 )
+            sMana = 0;
+        break;
+    case Condition_Pertified:
         if ( a3 == 1
-          && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0
-           && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0)
-           || v3->HasEnchantedItemEquipped(23)
-           || v14->WearsItem(520, 16)
-           || v15->WearsItem(505, 3)
-           || v16->WearsItem(530, 6)) )
-          goto LABEL_76;
-        v26 = 0;
-        v23 = 34;
-        goto LABEL_81;
-      case 0x10u:
-        if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u )
-        {
-LABEL_10:
-          --pParty->pPartyBuffs[13].uPower;
-          if ( pParty->pPartyBuffs[13].uPower < 1u )
-            pParty->pPartyBuffs[13].Reset();
-          goto LABEL_76;
+            &&((pParty->pPartyBuffs[13].uExpireTime > 0i64)
+            || HasEnchantedItemEquipped(23)|| WearsItem(520, 16) || WearsItem(505, 3) || WearsItem(530, 6)) )
+
+            return 0;
+        PlaySound((PlayerSpeech)34, 0);
+        break;
+    case Condition_Eradicated:
+        if ( a3 == 1 && ((signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 )&&( pParty->pPartyBuffs[13].uSkill >= 4u ))
+            {
+            --pParty->pPartyBuffs[13].uPower;
+            if ( pParty->pPartyBuffs[13].uPower < 1u )
+                pParty->pPartyBuffs[13].Reset();
+            return 0;
+            }
+        PlaySound(SPEECH_35, 0);
+        if (sHealth > 0 )
+            sHealth = 0;
+        if ( sMana > 0 )
+            sMana = 0;
+        break;
+    case Condition_Zombie:
+        if ( classType == PLAYER_CLASS_LICH || Eradicated() ||Zombie() || !Dead())
+            return 0;
+        memset(&pConditions[0], 0, sizeof(pConditions));
+        sHealth = GetMaxHealth();
+        sMana = 0;
+        player_sex = 0;
+        uPrevFace = uCurrentFace;
+        uPrevVoiceID = uVoiceID;
+        switch ( uVoiceID )
+            {
+        case 0:
+        case 1:
+        case 2:
+        case 3:
+        case 8:
+        case 9:
+        case 12:
+        case 13:
+        case 16:
+        case 17:
+        case 20:
+        case 23:
+            player_sex = 0;
+            break;
+        case 4:
+        case 5:
+        case 6:
+        case 7:
+        case 10:
+        case 11:
+        case 14:
+        case 15:
+        case 18:
+        case 19:
+        case 21:
+        case 24:
+            player_sex = 1;
+            break;
+        default:
+            break;
+            }
+
+        zombi_face = (player_sex != 0) + 23;
+        uCurrentFace = zombi_face;
+        uVoiceID = zombi_face;
+        PlaySound((PlayerSpeech)SPEECH_99, 0);
+        break;
         }
-        v28 = 0;
-        v25 = SPEECH_35;
-LABEL_67:
-        v3->PlaySound((PlayerSpeech)v25, v28);
-        if ( v3->sHealth > 0 )
-          v3->sHealth = 0;
-        v13 = (char *)&v3->sMana;
-LABEL_70:
-        if ( *(int *)v13 > 0 )
-          *(int *)v13 = 0;
-LABEL_82:
-        v21 = 0;
-        *(_QWORD *)v29 = pParty->uTimePlayed;
-        v31 = 0;
-        v22 = 1;
-        do
-        {
-          if ( pPlayers[v22]->CanAct() )
-          {
-            ++v31;
-            v21 = v22;
-          }
-          ++v22;
-        }
-        while ( v22 <= 4 );
-        if ( v30 == 2 )
-        {
-          if ( v31 == 1 )
-            pPlayers[v21]->PlaySound(SPEECH_107, 0);
-        }
-        result = 1;
-        break;
-      case 0x11u:
-        if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() ||
-            v3->Zombie() || !v3->Dead())
-          goto LABEL_76;
-        memset(v3, 0, 0xA0u);
-        v3->sHealth = v3->GetMaxHealth();
-        v18 = 0;
-        v3->field_1928 = v3->uFace;
-        v19 = v3->uVoiceID;
-        v3->sMana = 0;
-        v3->field_1924 = v19;
-        switch ( v19 )
+
+    remainig_player = 0;
+    pConditions[uConditionIdx] = pParty->uTimePlayed;
+    players_after = 0;
+    for (int i=1;i<5;++i)
         {
-          case 0:
-          case 1:
-          case 2:
-          case 3:
-          case 8:
-          case 9:
-          case 12:
-          case 13:
-          case 16:
-          case 17:
-          case 20:
-          case 23:
-            v18 = 0;
-            break;
-          case 4:
-          case 5:
-          case 6:
-          case 7:
-          case 10:
-          case 11:
-          case 14:
-          case 15:
-          case 18:
-          case 19:
-          case 21:
-          case 24:
-            v18 = 1;
-            break;
-          default:
-            break;
+
+
+        if ( pPlayers[i]->CanAct() )
+            {
+            remainig_player=i;
+            ++players_after;
+            }
         }
-        v26 = 0;
-        v20 = (v18 != 0) + 23;
-        v23 = SPEECH_99;
-        v3->uFace = v20;
-        v3->uVoiceID = v20;
-LABEL_81:
-        v3->PlaySound((PlayerSpeech)v23, v26);
-        goto LABEL_82;
-      default:
-        goto LABEL_82;
-    }
-  }
-  return result;
-}
+    if (( players_before == 2 )&&( players_after == 1 ))
+        {
+        pPlayers[remainig_player]->PlaySound(SPEECH_107, 0);
+        }
+    return 1;
+    }
 
 //----- (00492528) --------------------------------------------------------
 bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID)
@@ -1506,7 +1447,7 @@
 }
 
 //----- (004927A8) --------------------------------------------------------
-int Player::AddItem(unsigned int uSlot, unsigned int uItemID)
+int Player::AddItem(int uSlot, unsigned int uItemID)
 {
   signed int v3; // ebx@2
   signed int v4; // edi@3
@@ -1519,7 +1460,7 @@
   if ( uSlot == -1 )
   {
     v3 = 0;
-    while ( 2 )
+    while ( true )
     {
       v4 = 0;
       v5 = v3;
@@ -1553,7 +1494,7 @@
 }
 
 //----- (00492826) --------------------------------------------------------
-int Player::AddItem2(unsigned int uSlot, ItemGen *Src)
+int Player::AddItem2(int uSlot, ItemGen *Src)
 {
   unsigned int v3; // ebx@1
   unsigned int v4; // esi@3
@@ -1569,7 +1510,7 @@
   if ( uSlot == -1 )
   {
     uSlota = 0;
-    while ( 2 )
+    while ( true )
     {
       v4 = uSlota;
       v5 = 0;
@@ -1606,13 +1547,13 @@
   ItemGen *v4; // eax@1
   int result; // eax@6
   //unsigned int v6; // eax@7
-  Texture *v7; // esi@7
+  Texture *item_texture; // esi@7
   unsigned int v8; // edx@9
-  void *v9; // esi@10
-  unsigned int v10; // [sp+4h] [bp-Ch]@7
-  unsigned int v11; // [sp+8h] [bp-8h]@7
+  int *pInvPos; // esi@10
+  unsigned int slot_width; // [sp+4h] [bp-Ch]@7
+  unsigned int slot_height; // [sp+8h] [bp-8h]@7
   Player *v12; // [sp+Ch] [bp-4h]@1
-  unsigned int uSlota; // [sp+18h] [bp+8h]@10
+
 
   v12 = this;
   v3 = 0;
@@ -1633,30 +1574,28 @@
   }
   else
   {
-    v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    v10 = GetSizeInInventorySlots(v7->uTextureWidth);
-    v11 = GetSizeInInventorySlots(v7->uTextureHeight);
+    item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
+    slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
     if ( !areWeLoadingTexture )
     {
-      v7->Release();
+      item_texture->Release();
       pIcons_LOD->SyncLoadedFilesCount();
     }
-    v8 = uSlot;
-    if ( (signed int)v11 > 0 )
-    {
-      uSlota = v11;
-      v9 = &v12->pInventoryIndices[v8];
+    if ( slot_height > 0 )
+    {
+      pInvPos = &pInventoryIndices[uSlot];
       do
       {
-        if ( (signed int)v10 > 0 )
-          memset32(v9, -1 - v8, v10);
-        v9 = (char *)v9 + 56;
-        --uSlota;
-      }
-      while ( uSlota );
-    }
-    v12->pInventoryIndices[v8] = v3 + 1;
-    memcpy(&v12->pInventoryItems[v3], Src, 0x24u);
+        if ( slot_width > 0 )
+          memset32(pInvPos, -1 - uSlot, slot_width);
+        pInvPos +=14;
+        --slot_height;
+      }
+      while ( slot_height );
+    }
+    pInventoryIndices[uSlot] = v3 + 1;
+    memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen));
     result = v3 + 1;
   }
   return result;
@@ -1664,36 +1603,36 @@
 // 506128: using guessed type int areWeLoadingTexture;
 
 //----- (0049298B) --------------------------------------------------------
-bool Player::_49298B(ItemGen *a2, int a3, int a4)
-{
+int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot )
+    {
   //Player *v4; // ebx@1
   //unsigned int v5; // eax@1
-  Texture *v6; // esi@1
-  void *v7; // esi@4
-  unsigned int v9; // [sp+Ch] [bp-4h]@1
-  unsigned int a2a; // [sp+18h] [bp+8h]@1
-
-  v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-  v9 = GetSizeInInventorySlots(v6->uTextureWidth);
-  a2a = GetSizeInInventorySlots(v6->uTextureHeight);
+  Texture *item_texture; // esi@1
+  int *pInvPos; // esi@4
+  unsigned int slot_width; // [sp+Ch] [bp-4h]@1
+  unsigned int slot_height; // [sp+18h] [bp+8h]@1
+
+  item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  slot_width =  GetSizeInInventorySlots(item_texture->uTextureWidth);
+  slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
   if ( !areWeLoadingTexture )
   {
-    v6->Release();
+    item_texture->Release();
     pIcons_LOD->SyncLoadedFilesCount();
   }
-  if ( (signed int)a2a > 0 )
-  {
-    v7 = &pInventoryIndices[a4];
+  if ( (signed int)slot_height > 0 )
+  {
+    pInvPos = &pInventoryIndices[uSlot]; //14x9
     do
     {
-      if ( (signed int)v9 > 0 )
-        memset32(v7, -1 - a4, v9);
-      v7 = (char *)v7 + 56;
-      --a2a;
-    }
-    while ( a2a );
-  }
-  pInventoryIndices[a4] = a3 + 1;
+      if ( (signed int)slot_width > 0 )
+        memset32(pInvPos, -1 - uSlot, slot_width);
+      pInvPos +=14;
+      --slot_height;
+    }
+    while ( slot_height );
+  }
+  pInventoryIndices[uSlot] = item_id + 1;
   return 1;
 }
 
@@ -1702,43 +1641,34 @@
 //----- (00492A36) --------------------------------------------------------
 void Player::RemoveItemAtInventoryIndex( unsigned int uSlot )
     {
-  int *pIndices; // edi@1
-  ItemGen *v3; // ecx@1
-  unsigned int v4; // esi@1
-  //unsigned int v5; // eax@1
-  Texture *v6; // esi@1
-  unsigned int result; // eax@1
-  unsigned int v8; // ebp@1
-  void *v9; // edx@4
-  unsigned int uSlota; // [sp+14h] [bp+4h]@1
-
-  pIndices = &this->pInventoryIndices[uSlot];
-  v3 = &this->pInventoryItems[*pIndices-1];
-  v4 = v3->uItemID;
-  v3->Reset();
-  v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE);
-  uSlota = GetSizeInInventorySlots(v6->uTextureWidth);
-  result = GetSizeInInventorySlots(v6->uTextureHeight);
-  v8 = result;
+
+  ItemGen *item_in_slot; // ecx@1
+  Texture *item_texture; // esi@1
+  unsigned int slot_height; // ebp@1
+  int *pInvPos; // edx@4
+  unsigned int slot_width; // [sp+14h] [bp+4h]@1
+
+  item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1];  
+  item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  item_in_slot->Reset();
+  slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth);
+  slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight);
   if ( !areWeLoadingTexture )
   {
-    v6->Release();
+    item_texture->Release();
     pIcons_LOD->SyncLoadedFilesCount();
   }
-  if ( (signed int)v8 > 0 )
-  {
-    v9 = pIndices;
+  if ( slot_height > 0 )
+  {
+    pInvPos = &pInventoryIndices[uSlot];
     do
     {
-      if ( (signed int)uSlota > 0 )
-      {
-        result = 0;
-        memset(v9, 0, 4 * uSlota);
-      }
-      v9 = (char *)v9 + 56;
-      --v8;
-    }
-    while ( v8 );
+      if (slot_width > 0 )
+        memset32(pInvPos, 0, slot_width);
+      pInvPos += 14;
+      --slot_height;
+    }
+    while ( slot_height );
   }
   
 }
@@ -2036,7 +1966,6 @@
   int v4; // eax@3
   int v5; // edi@7
   signed int v6; // ebp@7
-  char v8; // al@10
   signed int v10; // [sp-4h] [bp-14h]@2
 
   
@@ -2244,7 +2173,7 @@
   }
 
   pName[0] = 0;
-  uFace = 0;
+  uCurrentFace = 0;
   uVoiceID = 0;
   memset(pConditions, 0, 20 * sizeof(__int64));
 
@@ -2381,7 +2310,7 @@
     {
       v9 = &v20->pPlayers[v15[v8]];
       v19 = &v20->pPlayers[v15[v8]];
-      v10 = v19->AddItem(0xFFFFFFFFu, pItem->uItemID);
+      v10 = v19->AddItem(-1, pItem->uItemID);
       if ( v10 )
         break;
       ++v8;
@@ -4447,7 +4376,6 @@
   signed int v2; // edi@1
   Player *v3; // esi@1
   enum CHARACTER_RACE v4; // ebx@1
-  Player *v5; // ecx@8
   char v6; // zf@18
   int v7; // ebx@28
   int result; // eax@28
@@ -6295,31 +6223,29 @@
 //                     24   zombie female
 enum CHARACTER_RACE Player::GetRace()
 {
-  if ( uFace > 15 )
-  {
-    if ( uFace >= 16 && uFace <= 19 )
+  if ( uCurrentFace > 15 )
+  {
+    if ( uCurrentFace >= 16 && uCurrentFace <= 19 )
       return CHARACTER_RACE_GOBLIN;
   }
   else
   {
-    if ( uFace >= 12 )
+    if ( uCurrentFace >= 12 )
     {
       return CHARACTER_RACE_DWARF;
     }
     else
     {
-      if ( uFace >= 0 )
-      {
-        if ( uFace <= 7 )
+      
+        if ( uCurrentFace <= 7 )
         {
           return CHARACTER_RACE_HUMAN;
         }
         else
         {
-          if ( uFace <= 11 )
+          if ( uCurrentFace <= 11 )
             return CHARACTER_RACE_ELF;
         }
-      }
     }
   }
   return CHARACTER_RACE_HUMAN;
@@ -6863,9 +6789,9 @@
   __int16 uGreen; // [sp+8h] [bp-8h]@1
   __int16 uRed; // [sp+Ch] [bp-4h]@1
 
-  uRed = TargetColor(0xFFu, 0x23u, 0);
-  uGreen = TargetColor(0, 0xFFu, 0);
-  uWhite = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  uRed =   TargetColor(255,  35,   0);
+  uGreen = TargetColor(0,   255,   0);
+  uWhite = TargetColor(255, 255, 255);
   pBaseAttrValue = StatTable[GetRace()][uStat].uBaseValue;
 
   switch (uStat)
@@ -6890,20 +6816,13 @@
 //----- (004908A8) --------------------------------------------------------
 bool Player::DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime)
 {
-  unsigned __int64 *result; // eax@1
-
-  result = (unsigned __int64 *)((char *)this + 8 * uCondition);
-  if ( *result && (signed __int64)uTime < (signed __int64)*result )
-  {
-    *(int *)result = 0;
-    *((int *)result + 1) = 0;
-    LOBYTE(result) = 1;
+  if ( pConditions[uCondition] && (uTime < pConditions[uCondition]) )
+  {
+    pConditions[uCondition]=0i64;
+    return true;
   }
   else
-  {
-    LOBYTE(result) = 0;
-  }
-  return (bool)result;
+   return false;
 }
 
 //----- (004680ED) --------------------------------------------------------
@@ -8600,19 +8519,19 @@
       v4->sResMindBase = 200;
       v4->sResBodyBase = 200;
       v11 = v4->GetSexByVoice();
-      v4->field_1924 = v4->uVoiceID;
-      v4->field_1928 = v4->uFace;
+      v4->uPrevVoiceID = v4->uVoiceID;
+      v4->uPrevFace = v4->uCurrentFace;
       if ( v11 )
       {
-        v4->uFace = 21;
+        v4->uCurrentFace = 21;
         v4->uVoiceID = 21;
       }
       else
       {
-        v4->uFace = 20;
+        v4->uCurrentFace = 20;
         v4->uVoiceID = 20;
       }
-      ReloadPlayerPortraits(currPlayerId, v4->uFace);
+      ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace);
       goto LABEL_124;
     }
 LABEL_64:
--- a/Player.h	Sun May 19 12:13:42 2013 +0400
+++ b/Player.h	Sun May 19 20:38:49 2013 +0400
@@ -542,10 +542,10 @@
   int CreateItemInInventory(unsigned int uSlot, unsigned int uItemID);
   int HasSkill(unsigned int uSkillType);
   int WearItem(unsigned int uItemID);
-  int AddItem(unsigned int uSlot, unsigned int uItemID);
-  int AddItem2(unsigned int uSlot, ItemGen *Src);
+  int AddItem(int uSlot, unsigned int uItemID);
+  int AddItem2(int uSlot, ItemGen *Src);
   int CreateItemInInventory2(unsigned int uSlot, ItemGen *Src);
-  bool _49298B(ItemGen *a2, int a3, int a4);
+  int PutItemArInventoryIndex(ItemGen *item, int item_id, int uSlot);
   void RemoveItemAtInventoryIndex(unsigned int uSlot);
   bool CanAct();
   bool CanSteal();
@@ -568,7 +568,7 @@
   int _4B807C(float a2);
   int _4B8040_condition_time(unsigned int uCondition);
   bool _43EEF3();
-  void SalesProcess(unsigned int a2, int a3, int _2devent_idx);//0x4BE2DD
+  void SalesProcess(unsigned int inventory_idnx, int item_index, int _2devent_idx);//0x4BE2DD
   bool Recover(signed int a2);
   bool CanCastSpell(unsigned int uRequiredMana);
 
@@ -606,7 +606,7 @@
   char pName[16];
   PLAYER_SEX uSex;
   PLAYER_CLASS_TYPE classType;
-  unsigned __int8 uFace;
+  unsigned __int8 uCurrentFace;
   char field_BB;
   unsigned __int16 uMight;
   unsigned __int16 uMightBonus;
@@ -693,8 +693,7 @@
       ItemGen pOwnItems[138];
       };
   
-
-  int pInventoryIndices[126];
+    int pInventoryIndices[126];  
   __int16 sResFireBase;
   __int16 sResAirBase;
   __int16 sResWaterBase;
@@ -719,8 +718,8 @@
   __int16 sResDarkBonus;
   SpellBuff pPlayerBuffs[24];
   unsigned int uVoiceID;
-  int field_1924;
-  int field_1928;
+  int uPrevVoiceID;
+  int uPrevFace;
   int field_192C;
   int field_1930;
   unsigned __int16 uTimeToRecovery;
--- a/UICharacter.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/UICharacter.cpp	Sun May 19 20:38:49 2013 +0400
@@ -1081,7 +1081,7 @@
       {
         case 529:
           v60 = 5;
-          v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uFace];
+          v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uCurrentFace];
           break;
         case 512:
           v60 = 6;
@@ -1280,12 +1280,12 @@
           }
         }
       }
-      if ( pPlayers[uPlayerID]->uFace == 12 || pPlayers[uPlayerID]->uFace == 13 )
+      if ( pPlayers[uPlayerID]->uCurrentFace == 12 || pPlayers[uPlayerID]->uCurrentFace == 13 )
       {
-        v122 = papredoll_dbrds[pPlayers[uPlayerID]->uFace];
+        v122 = papredoll_dbrds[pPlayers[uPlayerID]->uCurrentFace];
         if ( v122 != pIcons_LOD->FindTextureByName("Pending") )
-          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 24],
-                     pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 23],
+          pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 24],
+                     pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uCurrentFace - 23],
                      pIcons_LOD->GetTexture(v122));
       }
     pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;//далее шлем
@@ -1738,33 +1738,33 @@
       wsprintfA(pContainer, "pc23v%dlhu", v3);
       papredoll_dlhus[v0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); // Left Fist 2
       pPlayer = pPlayers[v0 + 1];
-      v5 = pPlayer->uFace;
+      v5 = pPlayer->uCurrentFace;
       if ( v5 == 12 || v5 == 13 )
         papredoll_dbrds[(char)v5] = 0;
-      papredoll_flying_feet[pPlayer->uFace] = 0;
+      papredoll_flying_feet[pPlayer->uCurrentFace] = 0;
       IsPlayerWearingWatersuit[v30 + 1] = 1;
     }
     else
     {
       v6 = v30;
-      papredoll_dbods[v30] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlads[v30] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlaus[v30] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
-      papredoll_drhs[v30] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
-      papredoll_dlhs[v30] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
-      v7 = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dbods[v30] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlads[v30] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlaus[v30] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_drhs[v30] = pIcons_LOD->LoadTexture(drh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      papredoll_dlhs[v30] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
+      v7 = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[pPlayers[v30 + 1]->uCurrentFace], TEXTURE_16BIT_PALETTE);
       pPlayer2 = pPlayers[v30 + 1];
       papredoll_dlhus[v30] = v7;
-      v9 = (char *)&pPlayer2->uFace;
+      v9 = (char *)&pPlayer2->uCurrentFace;
       v10 = *v9;
       if ( *v9 == 12 || v10 == 13 )
       {
         wsprintfA(pContainer, "pc%02dbrd", v10 + 1);
-        v9 = (char *)&pPlayers[v6 + 1]->uFace;
+        v9 = (char *)&pPlayers[v6 + 1]->uCurrentFace;
         papredoll_dbrds[*v9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
       }
       wsprintfA(pContainer, "item281pc%02d", *v9 + 1);
-      papredoll_flying_feet[pPlayers[v6 + 1]->uFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+      papredoll_flying_feet[pPlayers[v6 + 1]->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
       IsPlayerWearingWatersuit[v30 + 1] = 0;
     }
     ++v30;
--- a/UIHouses.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/UIHouses.cpp	Sun May 19 20:38:49 2013 +0400
@@ -5000,9 +5000,9 @@
             {
             if ( (unsigned int)v61 | v35 )
                 {
-                v37 = LOBYTE(v1->field_1928);
-                v38 = v1->field_1924;
-                v1->uFace = v37;
+                v37 = LOBYTE(v1->uPrevFace);
+                v38 = v1->uPrevVoiceID;
+                v1->uCurrentFace = v37;
                 v1->uVoiceID = v38;
                 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37);
                 }
@@ -5027,12 +5027,12 @@
               pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25);
               return;
             }
-            v1->field_1928 = v1->uFace;
-            v1->field_1924 = v1->uVoiceID;
+            v1->uPrevFace = v1->uCurrentFace;
+            v1->uPrevVoiceID = v1->uVoiceID;
             v1->SetCondition(0x11u, 1);
             v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23;
             v40 = (v1->GetSexByVoice() != 0) + 23;
-            v1->uFace = v40;
+            v1->uCurrentFace = v40;
             ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40);
             LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed);
             v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed);
--- a/UIPartyCreation.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/UIPartyCreation.cpp	Sun May 19 20:38:49 2013 +0400
@@ -93,7 +93,7 @@
     for (uint i = 0; i < 4; ++i)
         for (uint j = 0; j < 56; ++j)
             {
-            sprintf(pTmpBuf, "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uFace], j + 1);
+            sprintf(pTmpBuf, "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uCurrentFace], j + 1);
             pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
             }
 
@@ -199,10 +199,10 @@
 
   pTextCenter = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]);
   pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, pGlobalTXT_LocalizationStrings[51], 0, 0, 0);
-  pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uFace]);
-  pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uFace]);
-  pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uFace]);
-  pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uFace]);
+  pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uCurrentFace]);
+  pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uCurrentFace]);
+  pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uCurrentFace]);
+  pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uCurrentFace]);
   pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime);
 
 
--- a/mm7_1.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/mm7_1.cpp	Sun May 19 20:38:49 2013 +0400
@@ -697,7 +697,7 @@
   v1 = pIcons_LOD->GetTexture(v0);
   v11 = areWeLoadingTexture;
   if ( uActiveCharacter
-    && (v2 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) != 0 )
+    && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 )
   {
     memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u);
 	pMouse->RemoveHoldingItem();
@@ -708,7 +708,7 @@
     v3 = pParty->pPlayers;
 	while ( v3 <= &pParty->pPlayers[3] )
     {
-      v4 = v3->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID);
+      v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID);
       if ( v4 )
 	  {
 		memcpy(&pParty->pPlayers[v12].pInventoryItems[v4], &pParty->pPickedItem, 0x24u);
@@ -782,7 +782,7 @@
   if (pParty->pPickedItem.uItemID)
   {
     //v3 = player;
-    if (auto slot = player->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID))
+    if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID))
     {
       memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u);
       viewparams->bRedrawGameUI = true;
@@ -974,7 +974,7 @@
             pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem);
             if ( !pX )
             {
-              v0->_49298B(&this_, v13 - 1, a4);
+              v0->PutItemArInventoryIndex(&this_, v13 - 1, a4);
               memcpy((void *)a2.y, &this_, sizeof(ItemGen));
               return;
             }
@@ -986,7 +986,7 @@
         }
         v10 = v0->AddItem(a4, v7);
         pX = v10;
-        if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
+        if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
         {
           memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u);
           pMouse->RemoveHoldingItem();
--- a/mm7_2.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/mm7_2.cpp	Sun May 19 20:38:49 2013 +0400
@@ -940,7 +940,7 @@
         ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
         return;
       }
-      taken_item = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, bought_item->uItemID);
+      taken_item = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
       if ( taken_item )
       {
         bought_item->SetIdentified();
@@ -1098,7 +1098,7 @@
           }
         }
       }
-      v39 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, bought_item->uItemID);
+      v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
       if ( v39 )
       {
         bought_item->SetIdentified();
--- a/mm7_5.cpp	Sun May 19 12:13:42 2013 +0400
+++ b/mm7_5.cpp	Sun May 19 20:38:49 2013 +0400
@@ -3400,11 +3400,11 @@
           break;
         case UIMSG_PlayerCreation_FacePrev:
           pPlayer = &pParty->pPlayers[pParam];
-          if (!pPlayer->uFace)
-            pPlayer->uFace = 19;
+          if (!pPlayer->uCurrentFace)
+            pPlayer->uCurrentFace = 19;
           else
-            pPlayer->uFace -= 1;
-          pPlayer->uVoiceID = pPlayer->uFace;
+            pPlayer->uCurrentFace -= 1;
+          pPlayer->uVoiceID = pPlayer->uCurrentFace;
           pPlayer->SetInitialStats();
           pPlayer->SetSexByVoice();
           pPlayer->RandomizeName();
@@ -3418,8 +3418,8 @@
           break;
         case UIMSG_PlayerCreation_FaceNext:
           pPlayer = &pParty->pPlayers[pParam];
-          v20 = (char)((int)pPlayer->uFace + 1) % 20;
-          pPlayer->uFace = v20;
+          v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20;
+          pPlayer->uCurrentFace = v20;
           pPlayer->uVoiceID = v20;
           pPlayer->SetInitialStats();
           pPlayer->SetSexByVoice();
@@ -6060,10 +6060,10 @@
     papredoll_dlhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     wsprintfA(pContainer, "pc23v%dlhu", v9);
     papredoll_dlhus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    v6 = pPlayers[v1 + 1]->uFace;
+    v6 = pPlayers[v1 + 1]->uCurrentFace;
     if ( v6 == 12 || v6 == 13 )
-      papredoll_dbrds[pPlayers[v8]->uFace] = 0;
-    papredoll_flying_feet[pPlayers[v8]->uFace] = 0;
+      papredoll_dbrds[pPlayers[v8]->uCurrentFace] = 0;
+    papredoll_flying_feet[pPlayers[v8]->uCurrentFace] = 0;
     IsPlayerWearingWatersuit[v8] = 1;
   }
 }
@@ -6085,22 +6085,22 @@
   {
     v2 = &pPlayers[uPlayerID];
     v3 = uPlayerID - 1;
-    papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    v4 = (int)&(*v2)->uFace;
+    papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    v4 = (int)&(*v2)->uCurrentFace;
     v5 = *(char *)v4;
     if ( *(char *)v4 == 12 || v5 == 13 )
     {
       wsprintfA(pContainer, "pc%02dbrd", v5 + 1);
-      v4 = (int)&(*v2)->uFace;
+      v4 = (int)&(*v2)->uCurrentFace;
       papredoll_dbrds[*(char *)v4] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     }
     wsprintfA(pContainer, "item281pc%02d", *(char *)v4 + 1);
-    papredoll_flying_feet[(*v2)->uFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    papredoll_flying_feet[(*v2)->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     result = v7;
     IsPlayerWearingWatersuit[v7] = 0;
   }
@@ -10860,7 +10860,7 @@
           {
             if ( v51 != 5 )
             {
-              v19 = v0->AddItem(0xFFFFFFFFu, 0xDCu);
+              v19 = v0->AddItem(-1, 0xDCu);
               if ( v19 )
                 *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
               v20 = v47 + 50 * v15;
@@ -10884,7 +10884,7 @@
                 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID;
               else
                 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType;
-              v21 = v0->AddItem(0xFFFFFFFFu, 0xDCu);
+              v21 = v0->AddItem(-1, 0xDCu);
               if ( v21 )
                 *(int *)&v0->field_1F5[36 * v21 + 15] = 1;
               goto LABEL_74;