Mercurial > mm7
comparison mm7_1.cpp @ 201:30aa44013f7a
On Items
author | Nomad |
---|---|
date | Sun, 17 Feb 2013 00:16:48 +0200 |
parents | 9b77686e2239 |
children | 1bd823f52e3a |
comparison
equal
deleted
inserted
replaced
200:1527f66fd81b | 201:30aa44013f7a |
---|---|
3430 } | 3430 } |
3431 v56 = pFontSmallnum; | 3431 v56 = pFontSmallnum; |
3432 a4 = (char *)v106.uViewportY; | 3432 a4 = (char *)v106.uViewportY; |
3433 if ( v119 ) | 3433 if ( v119 ) |
3434 { | 3434 { |
3435 __debugbreak(); // following format strings are decompiled incorrectly | |
3435 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); | 3436 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); |
3436 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | 3437 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); |
3437 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | 3438 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; |
3438 v79 = v121->pMonsterInfo.uAC; | 3439 v79 = v121->pMonsterInfo.uAC; |
3439 v75 = 0; | 3440 v75 = 0; |
3440 v70 = pGlobalTXT_LocalizationStrings[12]; | 3441 v70 = pGlobalTXT_LocalizationStrings[12]; |
3441 v67 = "%s"; | 3442 v67 = "%s"; |
3442 } | 3443 } |
3443 else | 3444 else |
3444 { | 3445 { |
3446 __debugbreak(); // following format strings are decompiled incorrectly | |
3445 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]); | 3447 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]); |
3446 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | 3448 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); |
3447 v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; | 3449 v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; |
3448 v75 = 0; | 3450 v75 = 0; |
3449 v70 = pGlobalTXT_LocalizationStrings[12]; | 3451 v70 = pGlobalTXT_LocalizationStrings[12]; |
3464 v103 = pGlobalTXT_LocalizationStrings[29]; | 3466 v103 = pGlobalTXT_LocalizationStrings[29]; |
3465 v104 = pGlobalTXT_LocalizationStrings[133]; | 3467 v104 = pGlobalTXT_LocalizationStrings[133]; |
3466 v105 = pGlobalTXT_LocalizationStrings[54]; | 3468 v105 = pGlobalTXT_LocalizationStrings[54]; |
3467 if ( v116 ) | 3469 if ( v116 ) |
3468 { | 3470 { |
3471 __debugbreak(); // following format strings are decompiled incorrectly | |
3469 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, (&v95)[4 * v121->pMonsterInfo.uAttack1Type]); | 3472 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, (&v95)[4 * v121->pMonsterInfo.uAttack1Type]); |
3470 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | 3473 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); |
3471 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | 3474 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; |
3472 v57 = v121->pMonsterInfo.uAttack1DamageBonus; | 3475 v57 = v121->pMonsterInfo.uAttack1DamageBonus; |
3473 if ( v57 ) | 3476 if ( v57 ) |
3488 v121->pMonsterInfo.uAttack1DamageDiceRolls, | 3491 v121->pMonsterInfo.uAttack1DamageDiceRolls, |
3489 v121->pMonsterInfo.uAttack1DamageDiceSides); | 3492 v121->pMonsterInfo.uAttack1DamageDiceSides); |
3490 } | 3493 } |
3491 else | 3494 else |
3492 { | 3495 { |
3496 __debugbreak(); // following format strings are decompiled incorrectly | |
3493 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); | 3497 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); |
3494 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | 3498 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); |
3495 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | 3499 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; |
3496 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); | 3500 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); |
3497 } | 3501 } |
3595 else | 3599 else |
3596 { | 3600 { |
3597 i = 0; | 3601 i = 0; |
3598 do | 3602 do |
3599 { | 3603 { |
3600 sprintf(pTmpBuf, "%s", (&v85)[4 * i], 0, pGlobalTXT_LocalizationStrings[630]); | 3604 __debugbreak(); // string argument is decompiled incorrectry |
3605 sprintf(pTmpBuf, "%s", (&v85)[4 * i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" | |
3601 a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); | 3606 a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); |
3602 v65 = LOBYTE(v56->uFontHeight); | 3607 v65 = LOBYTE(v56->uFontHeight); |
3603 ++i; | 3608 ++i; |
3604 result = &a4[v65 - 3]; | 3609 result = &a4[v65 - 3]; |
3605 a4 = result; | 3610 a4 = result; |
4088 } | 4093 } |
4089 LABEL_8: | 4094 LABEL_8: |
4090 if ( v22 == v5 ) | 4095 if ( v22 == v5 ) |
4091 { | 4096 { |
4092 if ( uActiveCharacter ) | 4097 if ( uActiveCharacter ) |
4093 pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); | 4098 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); |
4094 return 0; | 4099 return 0; |
4095 } | 4100 } |
4096 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | 4101 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
4097 HIWORD(v8) = 0; | 4102 HIWORD(v8) = 0; |
4098 v9 = v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0; | 4103 v9 = v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0; |
5727 | 5732 |
5728 | 5733 |
5729 //----- (00421D00) -------------------------------------------------------- | 5734 //----- (00421D00) -------------------------------------------------------- |
5730 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) | 5735 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) |
5731 { | 5736 { |
5732 unsigned int v1; // esi@1 | 5737 //unsigned int v1; // esi@1 |
5733 int v2; // eax@2 | 5738 //int v2; // eax@2 |
5734 Player *v3; // ecx@2 | 5739 //Player *v3; // ecx@2 |
5735 Player *v4; // ecx@5 | 5740 //Player *v4; // ecx@5 |
5736 unsigned int v5; // [sp-4h] [bp-10h]@21 | 5741 unsigned int v5; // [sp-4h] [bp-10h]@21 |
5737 | 5742 |
5738 v1 = uPlayerID; | 5743 //v1 = uPlayerID; |
5739 if ( pParty->pPickedItem.uItemID ) | 5744 auto player = &pParty->pPlayers[uPlayerID - 1]; |
5740 { | 5745 if (pParty->pPickedItem.uItemID) |
5741 v2 = pPlayers[uPlayerID]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); | 5746 { |
5742 v3 = pPlayers[v1]; | 5747 //v3 = player; |
5743 if ( v2 ) | 5748 if (auto slot = player->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) |
5744 { | 5749 { |
5745 memcpy(&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5], &pParty->pPickedItem, 0x24u); | 5750 __debugbreak(); // invalid inventory indexing |
5746 viewparams->bRedrawGameUI = 1; | 5751 memcpy(&player->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * slot + 5], &pParty->pPickedItem, 0x24u); |
5752 viewparams->bRedrawGameUI = true; | |
5747 pMouse->RemoveHoldingItem(); | 5753 pMouse->RemoveHoldingItem(); |
5748 return; | 5754 return; |
5749 } | 5755 } |
5750 if ( v3->CanAct() ) | 5756 |
5751 { | 5757 if (!player->CanAct()) |
5752 v4 = pPlayers[v1]; | 5758 { |
5753 } | 5759 if ( pPlayers[uActiveCharacter]->CanAct()) |
5754 else | |
5755 { | |
5756 if ( !pPlayers[uActiveCharacter]->CanAct() ) | |
5757 goto LABEL_9; | 5760 goto LABEL_9; |
5758 v4 = pPlayers[uActiveCharacter]; | 5761 player = pPlayers[uActiveCharacter]; |
5759 } | 5762 } |
5760 v4->PlaySound(SPEECH_15, 0); | 5763 player->PlaySound(SPEECH_NoRoom, 0); |
5761 } | 5764 } |
5765 | |
5762 LABEL_9: | 5766 LABEL_9: |
5763 if ( !pCurrentScreen ) | 5767 if (pCurrentScreen == SCREEN_GAME) |
5764 { | 5768 { |
5765 viewparams->bRedrawGameUI = 1; | 5769 viewparams->bRedrawGameUI = true; |
5766 if ( uActiveCharacter != v1 ) | 5770 if ( uActiveCharacter != uPlayerID ) |
5767 //goto LABEL_27; | 5771 //goto LABEL_27; |
5768 { | 5772 { |
5769 if ( pPlayers[v1]->uTimeToRecovery ) | 5773 if ( pPlayers[uPlayerID]->uTimeToRecovery ) |
5770 return; | 5774 return; |
5771 uActiveCharacter = v1; | 5775 |
5776 uActiveCharacter = uPlayerID; | |
5772 return; | 5777 return; |
5773 } | 5778 } |
5774 v5 = 7; | 5779 v5 = 7; |
5775 //LABEL_22: | 5780 //LABEL_22: |
5776 pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); | 5781 pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); |
5779 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) | 5784 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
5780 return; | 5785 return; |
5781 if ( pCurrentScreen == SCREEN_CHEST ) | 5786 if ( pCurrentScreen == SCREEN_CHEST ) |
5782 { | 5787 { |
5783 //LABEL_23: | 5788 //LABEL_23: |
5784 viewparams->bRedrawGameUI = 1; | 5789 viewparams->bRedrawGameUI = true; |
5785 if ( uActiveCharacter == v1 ) | 5790 if ( uActiveCharacter == uPlayerID ) |
5786 { | 5791 { |
5787 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | 5792 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
5788 pCurrentScreen = SCREEN_F; | 5793 pCurrentScreen = SCREEN_F; |
5789 //goto LABEL_28; | 5794 //goto LABEL_28; |
5790 uActiveCharacter = v1; | 5795 uActiveCharacter = uPlayerID; |
5791 return; | 5796 return; |
5792 } | 5797 } |
5793 //LABEL_27: | 5798 //LABEL_27: |
5794 if ( pPlayers[v1]->uTimeToRecovery ) | 5799 if ( pPlayers[uPlayerID]->uTimeToRecovery ) |
5795 return; | 5800 return; |
5796 //goto LABEL_28; | 5801 //goto LABEL_28; |
5797 uActiveCharacter = v1; | 5802 uActiveCharacter = uPlayerID; |
5798 return; | 5803 return; |
5799 } | 5804 } |
5800 if ( pCurrentScreen != SCREEN_HOUSE ) | 5805 if ( pCurrentScreen != SCREEN_HOUSE ) |
5801 { | 5806 { |
5802 if ( pCurrentScreen == SCREEN_E ) | 5807 if ( pCurrentScreen == SCREEN_E ) |
5803 { | 5808 { |
5804 //LABEL_28: | 5809 //LABEL_28: |
5805 uActiveCharacter = v1; | 5810 uActiveCharacter = uPlayerID; |
5806 return; | 5811 return; |
5807 } | 5812 } |
5808 if ( pCurrentScreen != SCREEN_F ) | 5813 if ( pCurrentScreen != SCREEN_F ) |
5809 { | 5814 { |
5810 viewparams->bRedrawGameUI = 1; | 5815 viewparams->bRedrawGameUI = true; |
5811 uActiveCharacter = v1; | 5816 uActiveCharacter = uPlayerID; |
5812 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) | 5817 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) |
5813 sub_419100(); | 5818 sub_419100(); |
5814 return; | 5819 return; |
5815 } | 5820 } |
5816 //goto LABEL_23; | 5821 //goto LABEL_23; |
5817 viewparams->bRedrawGameUI = 1; | 5822 viewparams->bRedrawGameUI = true; |
5818 if ( uActiveCharacter == v1 ) | 5823 if ( uActiveCharacter == uPlayerID ) |
5819 { | 5824 { |
5820 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | 5825 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
5821 pCurrentScreen = SCREEN_F; | 5826 pCurrentScreen = SCREEN_F; |
5822 //goto LABEL_28; | 5827 //goto LABEL_28; |
5823 uActiveCharacter = v1; | 5828 uActiveCharacter = uPlayerID; |
5824 return; | 5829 return; |
5825 } | 5830 } |
5826 //LABEL_27: | 5831 //LABEL_27: |
5827 if ( pPlayers[v1]->uTimeToRecovery ) | 5832 if ( pPlayers[uPlayerID]->uTimeToRecovery ) |
5828 return; | 5833 return; |
5829 //goto LABEL_28; | 5834 //goto LABEL_28; |
5830 uActiveCharacter = v1; | 5835 uActiveCharacter = uPlayerID; |
5831 return; | 5836 return; |
5832 } | 5837 } |
5833 if ( ptr_507BC0->field_40 == 1 ) | 5838 if ( ptr_507BC0->field_40 == 1 ) |
5834 return; | 5839 return; |
5835 viewparams->bRedrawGameUI = 1; | 5840 viewparams->bRedrawGameUI = true; |
5836 if ( uActiveCharacter != v1 ) | 5841 if ( uActiveCharacter != uPlayerID ) |
5837 //goto LABEL_28; | 5842 //goto LABEL_28; |
5838 uActiveCharacter = v1; | 5843 uActiveCharacter = uPlayerID; |
5839 return; | 5844 return; |
5840 if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) | 5845 if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) |
5841 { | 5846 { |
5842 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | 5847 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
5843 v5 = 14; | 5848 v5 = 14; |