Mercurial > mm7
diff mm7_2.cpp @ 913:a8a3efd631de
CharacterUI_DrawPaperdollWithRingOverlay clean
author | Ritor1 |
---|---|
date | Mon, 22 Apr 2013 21:29:21 +0600 |
parents | 8cd0b155bebe |
children | 897b10712a1a |
line wrap: on
line diff
--- 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; } } }