changeset 913:a8a3efd631de

CharacterUI_DrawPaperdollWithRingOverlay clean
author Ritor1
date Mon, 22 Apr 2013 21:29:21 +0600
parents 22abf110163e
children 9efbe4bff7ac 47bbd8969f53
files UICharacter.cpp mm7_2.cpp
diffstat 2 files changed, 181 insertions(+), 304 deletions(-) [+]
line wrap: on
line diff
--- a/UICharacter.cpp	Mon Apr 22 20:22:56 2013 +0600
+++ b/UICharacter.cpp	Mon Apr 22 21:29:21 2013 +0600
@@ -2121,56 +2121,22 @@
 //----- (0043E825) --------------------------------------------------------
 void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID)
 {
-  //unsigned int v1; // ebx@1
-        //Player *pPlayer; // edi@1
-        int v3; // ecx@1
-        //int *v4; // edi@3
-        unsigned int pRingTextureNum; // ebx@3
-        //int v6; // eax@3
-        //LODFile_IconsBitmaps *v7; // ecx@7
-        double v8; // st7@16
-        int v9; // edi@17
-        //Texture *v10; // edi@18
-        //unsigned __int8 v11; // zf@19
-        Texture *v12; // eax@19
-        char v13; // sf@24
-        unsigned __int8 v14; // of@24
-        unsigned int pAmuletNum; // eax@25
-        unsigned int v16; // ebx@26
-        //int v17; // eax@26
-        LODFile_IconsBitmaps *v18; // ecx@30
-        double v19; // st7@39
-        int v20; // edi@40
-        int v21; // eax@41
-        //signed int v22; // ebx@41
-        //Texture *v23; // edi@41
-        //int v24; // eax@42
-        //char *v25; // eax@42
-        unsigned int v26; // eax@46
-        int v27; // edi@47
-        unsigned int v28; // ebx@47
-        int v29; // eax@47
-        LODFile_IconsBitmaps *v30; // ecx@51
-        Texture *v31; // esi@58
-        double v32; // st7@60
-        int v33; // esi@61
-        int v34; // esi@62
-        Texture *v35; // eax@63
-        const char *v36; // [sp-8h] [bp-38h]@8
-        const char *v37; // [sp-8h] [bp-38h]@31
-        const char *v38; // [sp-8h] [bp-38h]@52
-        //int v39; // [sp+10h] [bp-20h]@3
-        Texture *v40; // [sp+10h] [bp-20h]@14
-        int v41; // [sp+10h] [bp-20h]@26
-        Texture *v42; // [sp+10h] [bp-20h]@37
-        int v43; // [sp+10h] [bp-20h]@47
-        unsigned int pY_Ring; // [sp+14h] [bp-1Ch]@3
-        unsigned int pX_Ring; // [sp+18h] [bp-18h]@3
-        unsigned int uRingNum; // [sp+1Ch] [bp-14h]@1
-        //Player *v47; // [sp+20h] [bp-10h]@1
-        int v48; // [sp+24h] [bp-Ch]@1
-        ItemGen *item_amulet; // [sp+24h] [bp-Ch]@26
-        ItemGen *item_ring;
+  int v3; // ecx@1
+  unsigned int pItemTextureNum; // ebx@3
+  int v9; // edi@17
+  char v13; // sf@24
+  unsigned __int8 v14; // of@24
+  unsigned int pItemNum; // eax@25
+  int v20; // edi@40
+  int v21; // eax@41
+  int v33; // esi@61
+  const char *spell_texture_name; // [sp-8h] [bp-38h]@8
+  Texture *spell_texture; // [sp+10h] [bp-20h]@14
+  int v41; // [sp+10h] [bp-20h]@26
+  unsigned int pY_Ring; // [sp+14h] [bp-1Ch]@3
+  unsigned int pX_Ring; // [sp+18h] [bp-18h]@3
+  int v48; // [sp+24h] [bp-Ch]@1
+  ItemGen *item;
 
   pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE);
   CharacterUI_DrawPaperdoll(uPlayerID);
@@ -2182,96 +2148,93 @@
   v48 = 0;
   do
   {
-    uRingNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
+    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
     if ( pPlayers[uPlayerID]->pEquipment.uRings[v3] )
     {
-      item_ring = &pPlayers[uPlayerID]->pInventoryItems[uRingNum - 1];
+      item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
       pX_Ring = pPaperdollRingsX[v3];
       pY_Ring = pPaperdollRingsY[v3];
-      pRingTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_ring->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-      if ( item_ring->uAttributes & 0xF0 )
+      pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+      if ( item->uAttributes & 0xF0 )
       {
-        if ( (item_ring->uAttributes & 0xF0) == 16 )
-          v36 = "sptext01";
-        if ( (item_ring->uAttributes & 0xF0) == 32 )
-          v36 = "sp28a";
-        if ( (item_ring->uAttributes & 0xF0) == 64 )
-          v36 = "sp30a";
-        if ( (item_ring->uAttributes & 0xF0) == 128 )
-          v36 = "sp91a";
-        v40 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v36, TEXTURE_16BIT_PALETTE)];
+        if ( (item->uAttributes & 0xF0) == 16 )
+          spell_texture_name = "sptext01";
+        if ( (item->uAttributes & 0xF0) == 32 )
+          spell_texture_name = "sp28a";
+        if ( (item->uAttributes & 0xF0) == 64 )
+          spell_texture_name = "sp30a";
+        if ( (item->uAttributes & 0xF0) == 128 )
+          spell_texture_name = "sp91a";
+        spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
         dword_50C9A8 -= pEventTimer->uTimeElapsed;
         if ( dword_50C9A8 <= 0 )
         {
           dword_50C9A8 = 0;
-          item_ring->uAttributes &= 0xFu;
+          item->uAttributes &= 0xFu;
           ptr_50C9A4 = 0;
         }
-        v8 = (double)GetTickCount() * 0.1;
-        pRenderer->_4A63E6(pX_Ring, pY_Ring, (Texture *)(pRingTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pRingTextureNum] : 0), v40, (signed __int64)v8, 0, 255);
+        pRenderer->_4A63E6(pX_Ring, pY_Ring, (Texture *)(pItemTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), spell_texture, GetTickCount() * 0.1, 0, 255);
       }
       else
       {
-        v9 = pRingTextureNum + 1;
-        if ( item_ring->uAttributes & 2 )
-          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pRingTextureNum] : 0));
+        v9 = pItemTextureNum + 1;
+        if ( item->uAttributes & 2 )
+          pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
         else
         {
-          v12 = &pIcons_LOD->pTextures[pRingTextureNum];
-          if ( (item_ring->uAttributes & 1) == 0 )
-            pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)v12 : 0));
+          if ( (item->uAttributes & 1) == 0 )
+            pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
           else
-            pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)v12 : 0));
+            pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
         }
-        pRenderer->_4A601E(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)v12 : 0), uRingNum);
+        pRenderer->_4A601E(pX_Ring, pY_Ring, (Texture *)(v9 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), pItemNum);
       }
     }
     v3++;
-    uRingNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
+    pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3];
     v14 = (v48 + 1) > 5;
     v13 = v48 - 4 < 0;
     v48++;
   }
   while ( (unsigned __int8)(v13 ^ v14) | (v48 == 4) );
-  pAmuletNum = pPlayers[uPlayerID]->pEquipment.uAmulet;
-  if ( pAmuletNum )
+  pItemNum = pPlayers[uPlayerID]->pEquipment.uAmulet;
+  if ( pItemNum )
   {
     v41 = pPlayers[uPlayerID]->pEquipment.uAmulet;
-    item_amulet = &pPlayers[uPlayerID]->pInventoryItems[pAmuletNum - 1];
-    v16 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_amulet->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
-    if ( item_amulet->uAttributes & 0xF0 )
+    item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
+    pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+    if ( item->uAttributes & 0xF0 )
     {
-      if ( (item_amulet->uAttributes & 0xF0) == 16 )
-        v37 = "sptext01";
-      if ( (item_amulet->uAttributes & 0xF0) == 32 )
-        v37 = "sp28a";
-      if ( (item_amulet->uAttributes & 0xF0) == 64 )
-        v37 = "sp30a";
-      if ( (item_amulet->uAttributes & 0xF0) == 128 )
-        v37 = "sp91a";
-      v42 = &pIcons_LOD->pTextures[v18->LoadTexture(v37, TEXTURE_16BIT_PALETTE)];
+      if ( (item->uAttributes & 0xF0) == 16 )
+        spell_texture_name = "sptext01";
+      if ( (item->uAttributes & 0xF0) == 32 )
+        spell_texture_name = "sp28a";
+      if ( (item->uAttributes & 0xF0) == 64 )
+        spell_texture_name = "sp30a";
+      if ( (item->uAttributes & 0xF0) == 128 )
+        spell_texture_name = "sp91a";
+      spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
       dword_50C9A8 -= pEventTimer->uTimeElapsed;
       if ( dword_50C9A8 <= 0 )
       {
         dword_50C9A8 = 0;
-        item_amulet->uAttributes &= 0xFu;
+        item->uAttributes &= 0xFu;
         ptr_50C9A4 = 0;
       }
-      v19 = (double)GetTickCount() * 0.1;
-      pRenderer->_4A63E6(493, 91, (Texture *)(v16 != -1 ? (int)&pIcons_LOD->pTextures[v16] : 0), v42, (signed __int64)v19, 0, 255);
+      pRenderer->_4A63E6(493, 91, (Texture *)(pItemTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), spell_texture, GetTickCount() * 0.1, 0, 255);
     }
     else
     {
-      v20 = v16 + 1;
-      if ( item_amulet->uAttributes & 2 )
+      v20 = pItemTextureNum + 1;
+      if ( item->uAttributes & 2 )
       {
-        v21 = 9 * v16;
+        v21 = 9 * pItemTextureNum;
         pRenderer->DrawTransparentRedShade(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
       }
       else
       {
-        v21 = 9 * v16;
-        if ( !(item_amulet->uAttributes & 1) )
+        v21 = 9 * pItemTextureNum;
+        if ( !(item->uAttributes & 1) )
           pRenderer->DrawTransparentGreenShade(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
         else
           pRenderer->DrawTextureTransparent(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0));
@@ -2279,75 +2242,46 @@
       pRenderer->_4A601E(493, 91, (Texture *)(v20 != 0 ? (int)&pIcons_LOD->pTextures[8 * v21 / 0x48u] : 0), v41);
     }
   }
-            v26 = pPlayers[uPlayerID]->pEquipment.uGlove;
-            if ( !v26 )
-                return;
-            v43 = pPlayers[uPlayerID]->pEquipment.uGlove;
-            v27 = (int)&pPlayers[uPlayerID]->pInventoryItems[v26-1];
-            v28 = pIcons_LOD->LoadTexture(pItemsTable->pItems[*(int *)v27].pIconName, TEXTURE_16BIT_PALETTE);
-            v29 = *(int *)(v27 + 20);
-            if ( !(*(int *)(v27 + 20) & 0xF0) )
-                {
-                v33 = v28 + 1;
-                if ( v29 & 2 )
-                    {
-                    v34 = v33 != 0 ? (int)&pIcons_LOD->pTextures[v28] : 0;
-                    pRenderer->DrawTransparentRedShade(586, 88, (Texture *)v34);
-                    }
-                else
-                    {
-                    v35 = &pIcons_LOD->pTextures[v28];
-                    if ( !(v29 & 1) )
-                        {
-                        v34 = v33 != 0 ? (int)v35 : 0;
-                        pRenderer->DrawTransparentGreenShade(586, 88, (Texture *)v34);
-                        }
-                    else
-                        {
-                        v34 = v33 != 0 ? (int)v35 : 0;
-                        pRenderer->DrawTextureTransparent(586, 88, (Texture *)v34);
-                        }
-                    }
-                pRenderer->_4A601E(586, 88, (Texture *)v34, v43);
-                return;
-                }
-            if ( (*(int *)(v27 + 20) & 0xF0) == 16 )
-                {
-                v30 = pIcons_LOD;
-                goto LABEL_57;
-                }
-            if ( (*(int *)(v27 + 20) & 0xF0) == 32 )
-                {
-                v38 = "sp28a";
-                v30 = pIcons_LOD;
-                goto LABEL_58;
-                }
-            if ( (*(int *)(v27 + 20) & 0xF0) == 64 )
-                {
-                v38 = "sp30a";
-                v30 = pIcons_LOD;
-                goto LABEL_58;
-                }
-            v30 = pIcons_LOD;
-            if ( (*(int *)(v27 + 20) & 0xF0) == 128 )
-                {
-                v38 = "sp91a";
-                goto LABEL_58;
-                }
-LABEL_57:
-            v38 = "sptext01";
-LABEL_58:
-            v31 = &pIcons_LOD->pTextures[v30->LoadTexture(v38, TEXTURE_16BIT_PALETTE)];
-            dword_50C9A8 -= pEventTimer->uTimeElapsed;
-            if ( dword_50C9A8 <= 0 )
-                {
-                dword_50C9A8 = 0;
-                *(char *)(v27 + 20) &= 0xFu;
-                ptr_50C9A4 = 0;
-                }
-            v32 = (double)GetTickCount() * 0.1;
-            pRenderer->_4A63E6(586, 88, pIcons_LOD->GetTexture(v28), v31, (signed __int64)v32, 0, 255);
-        }
+  pItemNum = pPlayers[uPlayerID]->pEquipment.uGlove;
+  if ( !pItemNum )
+    return;
+  item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1];
+  pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
+  if ( !(item->uAttributes & 0xF0) )
+  {
+    v33 = pItemTextureNum + 1;
+    if ( item->uAttributes & 2 )
+      pRenderer->DrawTransparentRedShade(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
+    else
+    {
+      if ( !(item->uAttributes & 1) )
+        pRenderer->DrawTransparentGreenShade(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
+      else
+        pRenderer->DrawTextureTransparent(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0));
+    }
+    pRenderer->_4A601E(586, 88, (Texture *)(v33 != 0 ? (int)&pIcons_LOD->pTextures[pItemTextureNum] : 0), pItemNum);
+  }
+  else
+  {
+    if ( (item->uAttributes & 0xF0) == 16 )
+      spell_texture_name = "sptext01";
+    if ( (item->uAttributes & 0xF0) == 32 )
+      spell_texture_name = "sp28a";
+    if ( (item->uAttributes & 0xF0) == 64 )
+      spell_texture_name = "sp30a";
+    if ( (item->uAttributes & 0xF0) == 128 )
+      spell_texture_name = "sp91a";
+    spell_texture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(spell_texture_name, TEXTURE_16BIT_PALETTE)];
+    dword_50C9A8 -= pEventTimer->uTimeElapsed;
+    if ( dword_50C9A8 <= 0 )
+    {
+      dword_50C9A8 = 0;
+      item->uAttributes &= 0xFu;
+      ptr_50C9A4 = 0;
+    }
+    pRenderer->_4A63E6(586, 88, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255);
+  }
+}
 
 //----- (0043BCA7) --------------------------------------------------------
 void CharacterUI_LoadPaperdollTextures()
--- a/mm7_2.cpp	Mon Apr 22 20:22:56 2013 +0600
+++ b/mm7_2.cpp	Mon Apr 22 21:29:21 2013 +0600
@@ -9463,7 +9463,6 @@
 //----- (00468F8A) --------------------------------------------------------
 void __cdecl OnPaperdollLeftClick()
 {
-  Player *v0; // ebx@1
   int v1; // ecx@1
   unsigned int v2; // edi@1
   unsigned int v3; // edx@4
@@ -9503,13 +9502,6 @@
   int v37; // edi@93
   ItemGen *v38; // edi@93
   __int16 v39; // dx@99
-  signed int v40; // [sp-1Ch] [bp-68h]@80
-  unsigned int v41; // [sp-18h] [bp-64h]@80
-  signed int v42; // [sp-14h] [bp-60h]@80
-  signed int v43; // [sp-10h] [bp-5Ch]@80
-  int v44; // [sp-Ch] [bp-58h]@80
-  unsigned int v45; // [sp-8h] [bp-54h]@80
-  int v46; // [sp-4h] [bp-50h]@80
   ItemGen _this; // [sp+Ch] [bp-40h]@1
   unsigned int v48; // [sp+30h] [bp-1Ch]@88
   unsigned int v49; // [sp+34h] [bp-18h]@57
@@ -9521,12 +9513,12 @@
 
   v51 = 0;
   _this.Reset();
-  v0 = pPlayers[uActiveCharacter];
-  v1 = v0->pEquipment.uMainHand;
-  v2 = v0->pEquipment.uShield;
-  v54 = v0->pEquipment.uShield;
+  //v0 = pPlayers[uActiveCharacter];
+  v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand;
+  v2 = pPlayers[uActiveCharacter]->pEquipment.uShield;
+  v54 = pPlayers[uActiveCharacter]->pEquipment.uShield;
   v53 = v1;
-  if ( v1 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uEquipType == 1 )
+  if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uEquipType == 1 )
     v51 = v1;
   v3 = pParty->pPickedItem.uItemID;
   if ( pParty->pPickedItem.uItemID )
@@ -9537,10 +9529,10 @@
     {
       if ( v2 )
       {
-        LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
+        LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
         if ( (signed int)SkillToMastery(v5) < 3 )
         {
-          v0->PlaySound(SPEECH_39, 0);
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
         v3 = pParty->pPickedItem.uItemID;
@@ -9550,25 +9542,25 @@
     {
       if ( (v4 == 8 || v4 == 1 || v4 == 2)
         && v1
-        && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 )
+        && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 )
 	  {
-        LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
+        LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
         if ( (signed int)SkillToMastery(v5) < 3 )
         {
-          v0->PlaySound(SPEECH_39, 0);
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
 	  }
     }
-    if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) )
-    {
-
-        v0->PlaySound(SPEECH_39, 0);
+    if ( !pPlayers[uActiveCharacter]->CanEquip_RaceAndAlignmentCheck(v3) )
+    {
+
+        pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
         return;
     }
     if ( pParty->pPickedItem.uItemID == 604 )
     {
-      sub_467E7F_EquipBody(3u);
+      sub_467E7F_EquipBody(3);
       WetsuitOn(uActiveCharacter);
       return;
     }
@@ -9583,21 +9575,14 @@
       case 8u:
       case 9u:
       case 0xBu:
-        if ( !v0->HasSkill(v4) )
-        {
-          v0->PlaySound(SPEECH_39, 0);
+        if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
+        {
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
 		{
-			v46 = 0;
-			v45 = 0;
-			v44 = 0;
-			v43 = 0;
-			v42 = -1;
-			v41 = 0;
-			v40 = 0;
-			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
 		}
         sub_467E7F_EquipBody(v6);
@@ -9607,29 +9592,22 @@
       case 0xAu:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
 		{
-			v46 = 0;
-			v45 = 0;
-			v44 = 0;
-			v43 = 0;
-			v42 = -1;
-			v41 = 0;
-			v40 = 0;
-			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
 		}
         v52 = 10;
-        v7 = (int)&v0->pEquipment.uRings;
+        v7 = (int)&pPlayers[uActiveCharacter]->pEquipment.uRings;
         while ( 1 )
         {
           if ( !*(int *)v7 )
           {
-            v8 = v0->FindFreeInventorySlot();
+            v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
             if ( (v8 & 0x80000000u) == 0 )
 			{
 			  v9 = v52;
 			  pParty->pPickedItem.uBodyAnchor = v52 + 1;
-			  memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
-			  *(&v0->pEquipment.uShield + v9) = v8 + 1;
+			  memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8]));
+			  *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1;
 			  pMouse->RemoveHoldingItem();
               break;
 			}
@@ -9641,41 +9619,34 @@
         }
         if ( v52 == 16 )
         {
-          v52 = v0->pEquipment.uRings[6] - 1;
+          v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[6] - 1;
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-          v10 = (int)((char *)v0 + 36 * v52);
+          v10 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v52);
           *(char *)(v10 + 556) = 0;
           pParty->pPickedItem.Reset();
           pParty->SetHoldingItem((ItemGen *)(v10 + 532));
           _this.uBodyAnchor = 16;
           v11 = v52 + 1;
           memcpy((void *)(v10 + 532), &_this, 0x24u);
-          v0->pEquipment.uRings[6] = v11;
+          pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v11;
         }
         return;
       case 4u:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
 		{
-			v46 = 0;
-			v45 = 0;
-			v44 = 0;
-			v43 = 0;
-			v42 = -1;
-			v41 = 0;
-			v40 = 0;
-			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
 		}
-        if ( !v0->HasSkill(v4) )
-        {
-          v0->PlaySound(SPEECH_39, 0);
+        if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
+        {
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
         if ( v54 )
         {
           --v54;
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-          v12 = (int)((char *)v0 + 36 * v54);
+          v12 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v54);
           *(char *)(v12 + 556) = 0;
           pParty->pPickedItem.Reset();
           pParty->SetHoldingItem((ItemGen *)(v12 + 532));
@@ -9683,35 +9654,35 @@
           v13 = v54 + 1;
           v14 = v51 == 0;
           memcpy((void *)(v12 + 532), &_this, 0x24u);
-          v0->pEquipment.uShield = v13;
+          pPlayers[uActiveCharacter]->pEquipment.uShield = v13;
           if ( v14 )
             return;
         }
         else
         {
-          v52 = v0->FindFreeInventorySlot();
+          v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
           if ( (v52 & 0x80000000u) != 0 )
             return;
           if ( !v51 )
           {
             pParty->pPickedItem.uBodyAnchor = 1;
             v17 = v52 + 1;
-            memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
-            v0->pEquipment.uShield = v17;
+            memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
+            pPlayers[uActiveCharacter]->pEquipment.uShield = v17;
             pMouse->RemoveHoldingItem();
 	        return;
           }
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-          v15 = (int)((char *)v0 + 36 * (v53 - 1));
+          v15 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v53 - 1));
           *(char *)(v15 + 556) = 0;
           pParty->pPickedItem.Reset();
           pParty->SetHoldingItem((ItemGen *)(v15 + 532));
           _this.uBodyAnchor = 1;
           v16 = v52 + 1;
-          memcpy(&v0->pInventoryItems[v52], &_this, sizeof(v0->pInventoryItems[v52]));
-          v0->pEquipment.uShield = v16;
-        }
-        v0->pEquipment.uMainHand = 0;
+          memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
+          pPlayers[uActiveCharacter]->pEquipment.uShield = v16;
+        }
+        pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0;
         return;
       case 0u:
       case 0xCu:
@@ -9719,24 +9690,17 @@
           && pParty->pPickedItem.uItemID != 64
           && pParty->pPickedItem.uItemID != 65 )
 		{
-			v46 = 0;
-			v45 = 0;
-			v44 = 0;
-			v43 = 0;
-			v42 = -1;
-			v41 = 0;
-			v40 = 0;
-			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
 		}
-        if ( !v0->HasSkill(v4) )
-        {
-          v0->PlaySound(SPEECH_39, 0);
+        if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
+        {
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
         v50 = 0;
-        if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0)
-          || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 )
+        if ( v4 == 2 && (unsigned __int16)(pPlayers[uActiveCharacter]->pActiveSkills[2] & 0xFFC0)
+          || v4 == 1 && (signed int)SkillToMastery(pPlayers[uActiveCharacter]->pActiveSkills[1]) >= 3 )
         {
           if (pAsyncMouse)
           {
@@ -9757,7 +9721,7 @@
               {
                 --v54;
                 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-                v20 = (int)((char *)v0 + 36 * v54);
+                v20 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v54);
                 *(char *)(v20 + 556) = 0;
                 pParty->pPickedItem.Reset();
                 pParty->SetHoldingItem((ItemGen *)(v20 + 532));
@@ -9765,7 +9729,7 @@
                 v21 = v54 + 1;
                 v14 = v52 == 12;
                 memcpy((void *)(v20 + 532), &_this, 0x24u);
-                v0->pEquipment.uShield = v21;
+                pPlayers[uActiveCharacter]->pEquipment.uShield = v21;
                 if ( !v14 )
                   return;
                 v22 = _this.uItemID;
@@ -9779,13 +9743,13 @@
                 }
 				break;
               }
-              v23 = v0->FindFreeInventorySlot();
+              v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
               if ( (v23 & 0x80000000u) != 0 )
                 return;
               pParty->pPickedItem.uBodyAnchor = 1;
-              v50 = (unsigned int)&v0->pInventoryItems[v23];
-              memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23]));
-              v0->pEquipment.uShield = v23 + 1;
+              v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23];
+              memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23]));
+              pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1;
               pMouse->RemoveHoldingItem();
               if ( v52 != 12 )
                 return;
@@ -9803,13 +9767,13 @@
         }
         if ( !v53 )
         {
-          v26 = v0->FindFreeInventorySlot();
+          v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
           if ( (v26 & 0x80000000u) != 0 )
             return;
           pParty->pPickedItem.uBodyAnchor = 2;
-          v50 = (unsigned int)&v0->pInventoryItems[v26];
-          memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26]));
-          v0->pEquipment.uMainHand = v26 + 1;
+          v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26];
+          memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26]));
+          pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1;
               pMouse->RemoveHoldingItem();
               if ( v52 != 12 )
                 return;
@@ -9826,7 +9790,7 @@
         }
         --v53;
         memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-        v24 = (int)((char *)v0 + 36 * v53);
+        v24 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v53);
         *(char *)(v24 + 556) = 0;
         pParty->pPickedItem.Reset();
         pParty->SetHoldingItem((ItemGen *)(v24 + 532));
@@ -9834,11 +9798,11 @@
         v25 = v53 + 1;
         v14 = v52 == 12;
         memcpy((void *)(v24 + 532), &_this, 0x24u);
-        v0->pEquipment.uMainHand = v25;
+        pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25;
         if ( v14 )
           v50 = _this.uItemID;
         if ( v51 )
-          v0->pEquipment.uShield = 0;
+          pPlayers[uActiveCharacter]->pEquipment.uShield = 0;
         if ( v50 )
         {
                 __debugbreak();  // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
@@ -9850,77 +9814,63 @@
       case 1u:
         if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
 		{
-			v46 = 0;
-			v45 = 0;
-			v44 = 0;
-			v43 = 0;
-			v42 = -1;
-			v41 = 0;
-			v40 = 0;
-			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
 		}
-        if ( !v0->HasSkill(v4) )
-        {
-          v0->PlaySound(SPEECH_39, 0);
+        if ( !pPlayers[uActiveCharacter]->HasSkill(v4) )
+        {
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0);
           return;
         }
         if ( v53 )
         {
           if ( v54 )
           {
-            v46 = 0;
-            v45 = 0;
-            v44 = 0;
-            v43 = 0;
-            v42 = -1;
-            v41 = 0;
-            v40 = 0;
-			pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
           }
           --v53;
           memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-          v27 = (int)((char *)v0 + 36 * v53);
+          v27 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v53);
           *(char *)(v27 + 556) = 0;
           pParty->pPickedItem.Reset();
           pParty->SetHoldingItem((ItemGen *)(v27 + 532));
           _this.uBodyAnchor = 2;
           v28 = v53 + 1;
           memcpy((void *)(v27 + 532), &_this, 0x24u);
-          v0->pEquipment.uMainHand = v28;
+          pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28;
         }
         else
         {
-          v52 = v0->FindFreeInventorySlot();
+          v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot();
           if ( (v52 & 0x80000000u) == 0 )
           {
             if ( v54 )
             {
               memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
-              v29 = (int)((char *)v0 + 36 * (v54 - 1));
+              v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v54 - 1));
               *(char *)(v29 + 556) = 0;
               pParty->pPickedItem.Reset();
               pParty->SetHoldingItem((ItemGen *)(v29 + 532));
               _this.uBodyAnchor = 2;
               v30 = v52 + 1;
-              memcpy(&v0->pInventoryItems[v52], &_this, sizeof(v0->pInventoryItems[v52]));
-              v0->pEquipment.uShield = 0;
-              v0->pEquipment.uMainHand = v30;
+              memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
+              pPlayers[uActiveCharacter]->pEquipment.uShield = 0;
+              pPlayers[uActiveCharacter]->pEquipment.uMainHand = v30;
             }
             else
             {
               pParty->pPickedItem.uBodyAnchor = 2;
               v31 = v52 + 1;
-              memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
-              v0->pEquipment.uMainHand = v31;
+              memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52]));
+              pPlayers[uActiveCharacter]->pEquipment.uMainHand = v31;
               pMouse->RemoveHoldingItem();
             }
           }
         }
         return;
       default:
-        v0->UseItem_DrinkPotion_etc(uActiveCharacter, 0);
+        pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0);
         return;
     }
     return;
@@ -9941,7 +9891,7 @@
   if ( v34 )
   {
     v36 = v34 - 1;
-    v37 = (int)((char *)v0 + 36 * v36);
+    v37 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v36);
     v50 = v37;
     v38 = (ItemGen *)(v37 + 532);
     v14 = v38->uItemID == 604;
@@ -9950,14 +9900,7 @@
     {
       if ( bUnderwater )
       {
-        v46 = 0;
-        v45 = 0;
-        v44 = 0;
-        v43 = 0;
-        v42 = -1;
-        v41 = 0;
-        v40 = 0;
-        pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
+        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
         return;
       }
       WetsuitOff(uActiveCharacter);
@@ -9983,20 +9926,20 @@
       if ( !ptr_50C9A4 )
       {
         pParty->SetHoldingItem(v38);
-        *(&v0->uBirthYear + *(char *)(v50 + 556)) = 0;
+        *(&pPlayers[uActiveCharacter]->uBirthYear + *(char *)(v50 + 556)) = 0;
         v38->Reset();
       }
     }
   }
   else
   {
-    v35 = v0->pEquipment.uBow;
+    v35 = pPlayers[uActiveCharacter]->pEquipment.uBow;
     if ( v35 )
     {
-      auto _a = (ItemGen *)&v0->pInventoryItems[v35-1];
+      auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35-1];
       pParty->SetHoldingItem(_a);
       _a->Reset();
-      v0->pEquipment.uBow = 0;
+      pPlayers[uActiveCharacter]->pEquipment.uBow = 0;
     }
   }
 }