Mercurial > mm7
diff mm7_1.cpp @ 223:1bd823f52e3a
Merge
author | Gloval |
---|---|
date | Sun, 17 Feb 2013 11:41:44 +0400 |
parents | 8113753ed2ae 30aa44013f7a |
children | c879446b4a22 |
line wrap: on
line diff
--- a/mm7_1.cpp Sun Feb 17 11:29:10 2013 +0400 +++ b/mm7_1.cpp Sun Feb 17 11:41:44 2013 +0400 @@ -3432,6 +3432,7 @@ a4 = (char *)v106.uViewportY; if ( v119 ) { + __debugbreak(); // following format strings are decompiled incorrectly sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; @@ -3442,6 +3443,7 @@ } else { + __debugbreak(); // following format strings are decompiled incorrectly sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; @@ -3466,6 +3468,7 @@ v105 = pGlobalTXT_LocalizationStrings[54]; if ( v116 ) { + __debugbreak(); // following format strings are decompiled incorrectly sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, (&v95)[4 * v121->pMonsterInfo.uAttack1Type]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; @@ -3490,6 +3493,7 @@ } else { + __debugbreak(); // following format strings are decompiled incorrectly sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; @@ -3597,7 +3601,8 @@ i = 0; do { - sprintf(pTmpBuf, "%s", (&v85)[4 * i], 0, pGlobalTXT_LocalizationStrings[630]); + __debugbreak(); // string argument is decompiled incorrectry + sprintf(pTmpBuf, "%s", (&v85)[4 * i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); v65 = LOBYTE(v56->uFontHeight); ++i; @@ -4090,7 +4095,7 @@ if ( v22 == v5 ) { if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); return 0; } v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -5729,46 +5734,46 @@ //----- (00421D00) -------------------------------------------------------- void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) { - unsigned int v1; // esi@1 - int v2; // eax@2 - Player *v3; // ecx@2 - Player *v4; // ecx@5 + //unsigned int v1; // esi@1 + //int v2; // eax@2 + //Player *v3; // ecx@2 + //Player *v4; // ecx@5 unsigned int v5; // [sp-4h] [bp-10h]@21 - v1 = uPlayerID; - if ( pParty->pPickedItem.uItemID ) - { - v2 = pPlayers[uPlayerID]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); - v3 = pPlayers[v1]; - if ( v2 ) - { - memcpy(&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5], &pParty->pPickedItem, 0x24u); - viewparams->bRedrawGameUI = 1; + //v1 = uPlayerID; + auto player = &pParty->pPlayers[uPlayerID - 1]; + if (pParty->pPickedItem.uItemID) + { + //v3 = player; + if (auto slot = player->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) + { + __debugbreak(); // invalid inventory indexing + memcpy(&player->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * slot + 5], &pParty->pPickedItem, 0x24u); + viewparams->bRedrawGameUI = true; pMouse->RemoveHoldingItem(); return; } - if ( v3->CanAct() ) - { - v4 = pPlayers[v1]; - } - else - { - if ( !pPlayers[uActiveCharacter]->CanAct() ) + + if (!player->CanAct()) + { + if ( pPlayers[uActiveCharacter]->CanAct()) goto LABEL_9; - v4 = pPlayers[uActiveCharacter]; - } - v4->PlaySound(SPEECH_15, 0); - } + player = pPlayers[uActiveCharacter]; + } + player->PlaySound(SPEECH_NoRoom, 0); + } + LABEL_9: - if ( !pCurrentScreen ) - { - viewparams->bRedrawGameUI = 1; - if ( uActiveCharacter != v1 ) + if (pCurrentScreen == SCREEN_GAME) + { + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter != uPlayerID ) //goto LABEL_27; { - if ( pPlayers[v1]->uTimeToRecovery ) + if ( pPlayers[uPlayerID]->uTimeToRecovery ) return; - uActiveCharacter = v1; + + uActiveCharacter = uPlayerID; return; } v5 = 7; @@ -5781,20 +5786,20 @@ if ( pCurrentScreen == SCREEN_CHEST ) { //LABEL_23: - viewparams->bRedrawGameUI = 1; - if ( uActiveCharacter == v1 ) + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter == uPlayerID ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; pCurrentScreen = SCREEN_F; //goto LABEL_28; - uActiveCharacter = v1; + uActiveCharacter = uPlayerID; return; } //LABEL_27: - if ( pPlayers[v1]->uTimeToRecovery ) + if ( pPlayers[uPlayerID]->uTimeToRecovery ) return; //goto LABEL_28; - uActiveCharacter = v1; + uActiveCharacter = uPlayerID; return; } if ( pCurrentScreen != SCREEN_HOUSE ) @@ -5802,40 +5807,40 @@ if ( pCurrentScreen == SCREEN_E ) { //LABEL_28: - uActiveCharacter = v1; + uActiveCharacter = uPlayerID; return; } if ( pCurrentScreen != SCREEN_F ) { - viewparams->bRedrawGameUI = 1; - uActiveCharacter = v1; + viewparams->bRedrawGameUI = true; + uActiveCharacter = uPlayerID; if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) sub_419100(); return; } //goto LABEL_23; - viewparams->bRedrawGameUI = 1; - if ( uActiveCharacter == v1 ) + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter == uPlayerID ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; pCurrentScreen = SCREEN_F; //goto LABEL_28; - uActiveCharacter = v1; + uActiveCharacter = uPlayerID; return; } //LABEL_27: - if ( pPlayers[v1]->uTimeToRecovery ) + if ( pPlayers[uPlayerID]->uTimeToRecovery ) return; //goto LABEL_28; - uActiveCharacter = v1; + uActiveCharacter = uPlayerID; return; } if ( ptr_507BC0->field_40 == 1 ) return; - viewparams->bRedrawGameUI = 1; - if ( uActiveCharacter != v1 ) + viewparams->bRedrawGameUI = true; + if ( uActiveCharacter != uPlayerID ) //goto LABEL_28; - uActiveCharacter = v1; + uActiveCharacter = uPlayerID; return; if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) {