Mercurial > mm7
diff mm7_2.cpp @ 552:bee46636df95
Merge
author | Nomad |
---|---|
date | Mon, 04 Mar 2013 20:29:31 +0200 |
parents | 0ca16f606be8 |
children | b8339415fa98 9caf59edb1ee |
line wrap: on
line diff
--- a/mm7_2.cpp Mon Mar 04 20:28:08 2013 +0200 +++ b/mm7_2.cpp Mon Mar 04 20:29:31 2013 +0200 @@ -150,141 +150,144 @@ v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); - if ( dword_F8B19C == 1 ) - { - v11 = 1; - pOutString = 0; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; - if ( pParty->uFine ) - { - pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; - v11 = 2; - } - for ( i = 0; i < v11; ++i ) - { - v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); - pOutString = (GUIFont *)((char *)pOutString + v13); - } - v29 = (100 - (signed int)pOutString) / v11; - v14 = pDialogueWindow; - v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; - v16 = v15 - HIDWORD(v15); - LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; - HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; - v17 = (v16 >> 1) - v29 / 2 + 158; - v18 = -pDialogueWindow->pNumPresenceButton < 0; - pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; - if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) - { - v31 = 2; - v19 = pShopOptions; - do - { - v20 = v14->GetControl((unsigned int)pOutString); - v21 = v20; - v20->uY = v29 + v17; - v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); - v23 = v21->uY; - v21->uHeight = v22; - v17 = v23 + v22 - 1; - v21->uW = v17; - v24 = v30; - if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) - v24 = v28; - _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); - v14 = pDialogueWindow; - ++v31; - ++v19; - pOutString = (GUIFont *)((char *)pOutString + 1); - } - while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - } - else - { - if ( dword_F8B19C != 99 ) - { - if ( dword_F8B19C != 100 ) - return; - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 == 1 ) - { - sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); - _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); - v3 = pFontArrus; - v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); - return; - } - if ( window_SpeakInHouse->field_40 == 2 ) - { - v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v2 = v1; - if ( v1 <= 0 ) - { -LABEL_8: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return; - } - if ( v1 > pParty->uNumGold ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v2 = pParty->uNumGold; - } - if ( v2 > pParty->uFine ) - v2 = pParty->uFine; - Party::TakeGold(v2); - pParty->uFine -= v2; - if ( pParty->uFine < 0 ) - pParty->uFine = 0; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - v0 = window_SpeakInHouse; - } - else - { - if ( window_SpeakInHouse->field_40 != 3 ) - return; - } - v0->field_40 = 0; - goto LABEL_8; - } - v5 = &pMonsterStats->pInfos[word_F8B1A0]; - v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v7 = v5->pName; - v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); - sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); - ptr_F8B1E8 = pTmpBuf2; - memcpy(&a1, pDialogueWindow, sizeof(a1)); - w.uFrameWidth = 458; - w.uFrameZ = 457; - pOutString = pFontArrus; - v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7; - if ( 352 - v9 < 8 ) - { - pOutString = pFontCreate; - v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; - } - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); - pRenderer->_4A6A68( - 8u, - 352 - v9, - pTex, - (pTex ? pTex->uTextureHeight : 26) - v9); - pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); - v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); - a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); - } + switch(dword_F8B19C) + { + case 1: + { + v11 = 1; + pOutString = 0; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; + if ( pParty->uFine ) + { + pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; + v11 = 2; + } + for ( i = 0; i < v11; ++i ) + { + v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); + pOutString = (GUIFont *)((char *)pOutString + v13); + } + v29 = (100 - (signed int)pOutString) / v11; + v14 = pDialogueWindow; + v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; + v16 = v15 - HIDWORD(v15); + LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; + HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; + v17 = (v16 >> 1) - v29 / 2 + 158; + v18 = -pDialogueWindow->pNumPresenceButton < 0; + pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; + if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) + { + v31 = 2; + v19 = pShopOptions; + do + { + v20 = v14->GetControl((unsigned int)pOutString); + v21 = v20; + v20->uY = v29 + v17; + v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); + v23 = v21->uY; + v21->uHeight = v22; + v17 = v23 + v22 - 1; + v21->uW = v17; + v24 = v30; + if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) + v24 = v28; + _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); + v14 = pDialogueWindow; + ++v31; + ++v19; + pOutString = (GUIFont *)((char *)pOutString + 1); + } + while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + break; + } + case 99: + { + v5 = &pMonsterStats->pInfos[word_F8B1A0]; + v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + v7 = v5->pName; + v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); + sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); + ptr_F8B1E8 = pTmpBuf2; + memcpy(&a1, pDialogueWindow, sizeof(a1)); + w.uFrameWidth = 458; + w.uFrameZ = 457; + pOutString = pFontArrus; + v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7; + if ( 352 - v9 < 8 ) + { + pOutString = pFontCreate; + v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; + } + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); + pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9); + pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); + v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); + a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); + break; + } + case 100: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 == 1 ) + { + sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v3 = pFontArrus; + v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); + return; + } + if ( window_SpeakInHouse->field_40 == 2 ) + { + v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v2 = v1; + if ( v1 <= 0 ) + { + //LABEL_8: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + return; + } + if ( v1 > pParty->uNumGold ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v2 = pParty->uNumGold; + } + if ( v2 > pParty->uFine ) + v2 = pParty->uFine; + Party::TakeGold(v2); + pParty->uFine -= v2; + if ( pParty->uFine < 0 ) + pParty->uFine = 0; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + v0 = window_SpeakInHouse; + } + if ( window_SpeakInHouse->field_40 == 3 ) + { + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + } + break; + } + default: + { + break; + } + } + return; } // F8B19C: using guessed type int dword_F8B19C; // F8B1A0: using guessed type __int16 word_F8B1A0; @@ -316,105 +319,127 @@ *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C == 7 ) - { - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) - { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) - { - v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v7 = v6; - if ( !v6 ) - { -LABEL_17: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return; - } - if ( v6 > pParty->uNumGold ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v7 = pParty->uNumGold; - } - if ( v7 ) - { - Party::TakeGold(v7); - pParty->uNumGoldInBank += v7; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - } - v0 = window_SpeakInHouse; -LABEL_16: - v0->field_40 = 0; - goto LABEL_17; - } -LABEL_15: - if ( v1 != 1 ) - return; - goto LABEL_16; - } - v11 = pGlobalTXT_LocalizationStrings[112]; - v10 = pGlobalTXT_LocalizationStrings[60]; - } - else - { - if ( dword_F8B19C != 8 ) - return; - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) - { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) - { - window_SpeakInHouse->field_40 = 0; - v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v3 = v2; - if ( v2 ) - { - if ( v2 > pParty->uNumGoldInBank ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v3 = pParty->uNumGoldInBank; - } - if ( v3 ) - { - Party::SetGold(pParty->uNumGold + v3); - pParty->uNumGoldInBank -= v3; - } - } - goto LABEL_17; - } - goto LABEL_15; - } - v11 = pGlobalTXT_LocalizationStrings[112]; - v10 = pGlobalTXT_LocalizationStrings[244]; - } - sprintf(pTmpBuf, "%s\n%s", v10, v11); - _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); - v4 = pFontArrus; - v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); - return; - } - v8 = v14[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - v8 = v13[0]; - _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); - v9 = v14[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - v9 = v13[0]; - _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); + switch(dword_F8B19C) + { + case 1: + { + v8 = v14[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + v8 = v13[0]; + _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); + v9 = v14[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + v9 = v13[0]; + _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); + break; + } + case 7: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v7 = v6; + if ( !v6 ) + { +//LABEL_17: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + return; + } + if ( v6 > pParty->uNumGold ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v7 = pParty->uNumGold; + } + if ( v7 ) + { + Party::TakeGold(v7); + pParty->uNumGoldInBank += v7; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + } + v0 = window_SpeakInHouse; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 != 1 ) + return; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + v11 = pGlobalTXT_LocalizationStrings[112]; + v10 = pGlobalTXT_LocalizationStrings[60]; + sprintf(pTmpBuf, "%s\n%s", v10, v11); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v4 = pFontArrus; + v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); + break; + } + + case 8: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + window_SpeakInHouse->field_40 = 0; + v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v3 = v2; + if ( v2 ) + { + if ( v2 > pParty->uNumGoldInBank ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v3 = pParty->uNumGoldInBank; + } + if ( v3 ) + { + Party::SetGold(pParty->uNumGold + v3); + pParty->uNumGoldInBank -= v3; + } + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 != 1 ) + return; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + v11 = pGlobalTXT_LocalizationStrings[112]; + v10 = pGlobalTXT_LocalizationStrings[244]; + sprintf(pTmpBuf, "%s\n%s", v10, v11); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v4 = pFontArrus; + v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); + return; + break; + } + + default: + { + break; + } + } } // F8B19C: using guessed type int dword_F8B19C; @@ -545,41 +570,57 @@ v7 = 1; v83 = 1; } - if ( dword_F8B19C > 101 ) - { - if ( dword_F8B19C == 102 ) - { - v65 = pFontArrus; - pOutString = pFontArrus; - strcpy(pTmpBuf, pNPCTopics[354].pText); - v78.uFrameWidth = 460; - v78.uFrameZ = 452; - v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; - if ( 352 - v62 < 8 ) - { - pOutString = pFontCreate; - v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; - } - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); - pRenderer->_4A6A68( - 8u, - 352 - v62, - pTex, - (pTex ? pTex->uTextureHeight : 26) - v62); - - pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); - v73 = 0; - v70 = 0; - v68 = 0; - v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); - v64 = pOutString; - } - else - { - if ( dword_F8B19C != 103 ) - { - if ( dword_F8B19C != 104 || pArcomageGame->bGameInProgress == 1 ) + switch(dword_F8B19C) + { + case 102: + { + v65 = pFontArrus; + pOutString = pFontArrus; + strcpy(pTmpBuf, pNPCTopics[354].pText); + v78.uFrameWidth = 460; + v78.uFrameZ = 452; + v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; + if ( 352 - v62 < 8 ) + { + pOutString = pFontCreate; + v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; + } + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); + pRenderer->_4A6A68(8u, 352 - v62, pTex, (pTex ? pTex->uTextureHeight : 26) - v62); + + pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); + v73 = 0; + v70 = 0; + v68 = 0; + v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); + v64 = pOutString; + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + break; + } + case 103: + { + strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); + v78.uFrameWidth = 460; + v78.uFrameZ = 452; + v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); + v62 = v61 + 7; + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); + pRenderer->_4A6A68(8u, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7)); + + pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); + v73 = 0; + v70 = 0; + v68 = 0; + v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); + v64 = pFontArrus; + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + break; + } + case 104: + { + if ( pArcomageGame->bGameInProgress == 1 ) return; v26 = pTmpBuf; if ( pArcomageGame->uGameResult ) @@ -594,42 +635,16 @@ v72 = pGlobalTXT_LocalizationStrings[639];// A tie! } strcpy(pTmpBuf, v72); -LABEL_97: +//LABEL_97: v71 = 3; v69 = v26; v67 = v84[0]; v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; - goto LABEL_98; - } - strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); - v78.uFrameWidth = 460; - v78.uFrameZ = 452; - v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); - v62 = v61 + 7; - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); - pRenderer->_4A6A68( - 8u, - 352 - (v61 + 7), - pTex, - (pTex ? pTex->uTextureHeight : 26) - (v61 + 7)); - - pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); - v73 = 0; - v70 = 0; - v68 = 0; - v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); - v64 = pFontArrus; - } - window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); - return; - } - if ( dword_F8B19C != 101 ) - { - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C == 15 ) - { + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + break; + } + case 15: + { if ( pParty->uNumGold >= (unsigned int)pOutString ) { Party::TakeGold((unsigned int)pOutString); @@ -652,96 +667,106 @@ ++pMessageQueue_50CBD0->uNumMessages; return; } - } - else - { - if ( dword_F8B19C != 16 ) - { - if ( dword_F8B19C != 96 || !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v8 = pDialogueWindow; - *(float *)&v89 = 0.0; - - //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - - pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); - if ( (signed int)pOutString < v9 / 3 ) - pOutString = (GUIFont *)(v9 / 3); - v10 = v8->pStartingPosActiveItem; - v11 = v10 + v8->pNumPresenceButton; - v86 = 0; - if ( (signed int)v10 < v11 ) - { - do - { - v12 = v8->GetControl(v10)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) - { - v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); - v89 += v13; - ++v86; - } - ++v10; - } - while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); - if ( v86 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); - v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - pOutString = (GUIFont *)((149 - v89) / v86); - if ( (149 - v89) / v86 > 32 ) - pOutString = (GUIFont *)32; - v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; - v89 = v8->pStartingPosActiveItem; - v83 = v14; - if ( v89 < v89 + v8->pNumPresenceButton ) - { - v86 = 2; - do - { - v15 = v8->GetControl(v89); - v16 = v15; - v17 = v15->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) - { - v16->uW = 0; - v16->uHeight = 0; - v16->uY = 0; - } - else - { - v18 = pSkillNames[v17]; - v16->uY = (unsigned int)((char *)pOutString + v83); - Str[1] = v18; - v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); - v20 = v16->uY; - v21 = v86; - v16->uHeight = v19; - v22 = v19 + v20 - 1; - v16->uW = v22; - v83 = v22; - v23 = v84[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) - v23 = v81; - v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); - } - v24 = v8->pNumPresenceButton; - ++v89; - v25 = v8->pStartingPosActiveItem + v24; - ++v86; - } - while ( v89 < v25 ); - } - return; - } - } - v26 = pTmpBuf; - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - goto LABEL_97; - } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + break; + } + case 96: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v8 = pDialogueWindow; + *(float *)&v89 = 0.0; + + //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + + pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); + if ( (signed int)pOutString < v9 / 3 ) + pOutString = (GUIFont *)(v9 / 3); + v10 = v8->pStartingPosActiveItem; + v11 = v10 + v8->pNumPresenceButton; + v86 = 0; + if ( (signed int)v10 < v11 ) + { + do + { + v12 = v8->GetControl(v10)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) + { + v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); + v89 += v13; + ++v86; + } + ++v10; + } + while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); + if ( v86 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); + v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + pOutString = (GUIFont *)((149 - v89) / v86); + if ( (149 - v89) / v86 > 32 ) + pOutString = (GUIFont *)32; + v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; + v89 = v8->pStartingPosActiveItem; + v83 = v14; + if ( v89 < v89 + v8->pNumPresenceButton ) + { + v86 = 2; + do + { + v15 = v8->GetControl(v89); + v16 = v15; + v17 = v15->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) + { + v16->uW = 0; + v16->uHeight = 0; + v16->uY = 0; + } + else + { + v18 = pSkillNames[v17]; + v16->uY = (unsigned int)((char *)pOutString + v83); + Str[1] = v18; + v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); + v20 = v16->uY; + v21 = v86; + v16->uHeight = v19; + v22 = v19 + v20 - 1; + v16->uW = v22; + v83 = v22; + v23 = v84[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) + v23 = v81; + v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); + } + v24 = v8->pNumPresenceButton; + ++v89; + v25 = v8->pStartingPosActiveItem + v24; + ++v86; + } + while ( v89 < v25 ); + } + return; + } + } + v26 = pTmpBuf; + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v71 = 3; + v69 = v26; + v67 = v84[0]; + v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + break; + } + case 16: + { *(_QWORD *)Str = pParty->uNumFoodRations; //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) @@ -749,7 +774,8 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - goto LABEL_43; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + return; } if ( pParty->uNumGold >= v7 ) { @@ -758,172 +784,193 @@ pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); v5 = 1; -LABEL_43: +//LABEL_43: pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); return; //goto LABEL_51; } - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); - goto LABEL_43; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v28 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - v28 = v81; - sprintf(Dest, format_4E2DC8, v28); - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); - strcat(Dest, pTmpBuf2); - v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); - strcat(Dest, "\n \n"); - v29 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - v29 = v81; - sprintf(a1, format_4E2DC8, v29); - sprintf(pTmpBuf2, - pGlobalTXT_LocalizationStrings[86], - //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], - (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, - v83); - strcat(a1, pTmpBuf2); - v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); - strcat(a1, "\n \n"); - v30 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) - v30 = v81; - sprintf(v77, format_4E2DC8, v30); - strcat(v77, pGlobalTXT_LocalizationStrings[160]); - v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); - strcat(v77, "\n \n"); - v75[0] = 0; - v87 = 0; - v31 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v31 >= 108 && v31 <= 120 ) - { - v32 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) - v32 = v81; - sprintf(v75, format_4E2DC8, v32); - strcat(v75, pGlobalTXT_LocalizationStrings[611]); - v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); - } - v33 = pDialogueWindow; - Str[1] = (char *)pDialogueWindow; - v34 = pDialogueWindow->pStartingPosActiveItem; - v35 = v34 + pDialogueWindow->pNumPresenceButton; - v36 = LOBYTE(pFontArrus->uFontHeight) - 3; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; - if ( !(v37 ^ __OFSUB__(v34, v35)) ) - { -LABEL_75: - sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); - v71 = 3; - v69 = pTmpBuf; - v67 = 0; - v66 = 146; -LABEL_98: - v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); - return; - } - while ( 1 ) - { - v38 = v33->GetControl((unsigned int)pOutString); - if ( v38->uControlParam == 15 ) - { - v46 = v90; - v38->uHeight = v90; - v38->uY = 146; - v41 = v46 + 145; - goto LABEL_73; - } - if ( v38->uControlParam == 16 ) - { - v44 = v88; - v45 = v90 + v36 + 146; - v38->uHeight = v88; - v38->uY = v45; - v41 = v45 + v44 - 1; - goto LABEL_73; - } - if ( v38->uControlParam == 96 ) - break; - if ( v38->uControlParam == 101 ) - { - v39 = v90 + 3 * v36 + v87 + v88 + 146; - v33 = (GUIWindow *)Str[1]; - v40 = v87; - v38->uHeight = v87; - v38->uY = v39; - v41 = v39 + v40 - 1; -LABEL_73: - v38->uW = v41; - } - v47 = v33->pStartingPosActiveItem; - pOutString = (GUIFont *)((char *)pOutString + 1); - if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) - goto LABEL_75; - } - v42 = v90 + v88 + 2 * v36 + 146; - v43 = v82; - v38->uY = v42; - v38->uHeight = v43; - v41 = v43 + v42 - 1; - goto LABEL_73; - } - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v48 = 2; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; - pOutString = 0; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; - if ( pParty->HasItem(0x28Bu) ) - { - pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; - v48 = 3; - } - for ( i = 0; i < v48; ++i ) - { - v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); - pOutString = (GUIFont *)((char *)pOutString + v50); - } - v86 = (174 - (signed int)pOutString) / v48; - v51 = pDialogueWindow; - v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; - v53 = v52 - HIDWORD(v52); - LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; - HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; - v54 = (v53 >> 1) - v86 / 2 + 138; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - v89 = pDialogueWindow->pStartingPosActiveItem; - if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) - { - v85 = (Player *)2; - pOutString = (GUIFont *)pShopOptions; - do - { - v55 = v51->GetControl(v89); - v56 = (const char **)pOutString; - v55->uY = v86 + v54; - v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); - v58 = v55->uY; - v59 = v85; - v55->uHeight = v57; - v54 = v57 + v58 - 1; - v55->uW = v54; - v60 = v84[0]; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) - v60 = v81; - v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); - v51 = pDialogueWindow; - v85 = (Player *)((char *)v85 + 1); - pOutString = (GUIFont *)((char *)pOutString + 4); - ++v89; - } - while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + break; + } + case 1: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v28 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + v28 = v81; + sprintf(Dest, format_4E2DC8, v28); + sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); + strcat(Dest, pTmpBuf2); + v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); + strcat(Dest, "\n \n"); + v29 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + v29 = v81; + sprintf(a1, format_4E2DC8, v29); + sprintf(pTmpBuf2, + pGlobalTXT_LocalizationStrings[86], + //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], + (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, + v83); + strcat(a1, pTmpBuf2); + v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); + strcat(a1, "\n \n"); + v30 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) + v30 = v81; + sprintf(v77, format_4E2DC8, v30); + strcat(v77, pGlobalTXT_LocalizationStrings[160]); + v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); + strcat(v77, "\n \n"); + v75[0] = 0; + v87 = 0; + v31 = (signed int)window_SpeakInHouse->ptr_1C; + if ( v31 >= 108 && v31 <= 120 ) + { + v32 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) + v32 = v81; + sprintf(v75, format_4E2DC8, v32); + strcat(v75, pGlobalTXT_LocalizationStrings[611]); + v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); + } + v33 = pDialogueWindow; + Str[1] = (char *)pDialogueWindow; + v34 = pDialogueWindow->pStartingPosActiveItem; + v35 = v34 + pDialogueWindow->pNumPresenceButton; + v36 = LOBYTE(pFontArrus->uFontHeight) - 3; + v37 = -pDialogueWindow->pNumPresenceButton < 0; + pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; + if ( !(v37 ^ __OFSUB__(v34, v35)) ) + { + //LABEL_75: + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + v71 = 3; + v69 = pTmpBuf; + v67 = 0; + v66 = 146; + //LABEL_98: + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + } + while ( 1 ) + { + v38 = v33->GetControl((unsigned int)pOutString); + if ( v38->uControlParam == 15 ) + { + v46 = v90; + v38->uHeight = v90; + v38->uY = 146; + v41 = v46 + 145; + v38->uW = v41; + } + else if ( v38->uControlParam == 16 ) + { + v44 = v88; + v45 = v90 + v36 + 146; + v38->uHeight = v88; + v38->uY = v45; + v41 = v45 + v44 - 1; + v38->uW = v41; + } + else if ( v38->uControlParam == 96 ) + { + v42 = v90 + v88 + 2 * v36 + 146; + v43 = v82; + v38->uY = v42; + v38->uHeight = v43; + v41 = v43 + v42 - 1; + v38->uW = v41; + } + else if ( v38->uControlParam == 101 ) + { + v39 = v90 + 3 * v36 + v87 + v88 + 146; + v33 = (GUIWindow *)Str[1]; + v40 = v87; + v38->uHeight = v87; + v38->uY = v39; + v41 = v39 + v40 - 1; + //LABEL_73: + v38->uW = v41; + } + v47 = v33->pStartingPosActiveItem; + pOutString = (GUIFont *)((char *)pOutString + 1); + if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) + { + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + v71 = 3; + v69 = pTmpBuf; + v67 = 0; + v66 = 146; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + } + } + break; + } + case 101: + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v48 = 2; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; + pOutString = 0; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; + if ( pParty->HasItem(0x28Bu) ) + { + pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; + v48 = 3; + } + for ( i = 0; i < v48; ++i ) + { + v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); + pOutString = (GUIFont *)((char *)pOutString + v50); + } + v86 = (174 - (signed int)pOutString) / v48; + v51 = pDialogueWindow; + v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; + v53 = v52 - HIDWORD(v52); + LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; + HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; + v54 = (v53 >> 1) - v86 / 2 + 138; + v37 = -pDialogueWindow->pNumPresenceButton < 0; + v89 = pDialogueWindow->pStartingPosActiveItem; + if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) + { + v85 = (Player *)2; + pOutString = (GUIFont *)pShopOptions; + do + { + v55 = v51->GetControl(v89); + v56 = (const char **)pOutString; + v55->uY = v86 + v54; + v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); + v58 = v55->uY; + v59 = v85; + v55->uHeight = v57; + v54 = v57 + v58 - 1; + v55->uW = v54; + v60 = v84[0]; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) + v60 = v81; + v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); + v51 = pDialogueWindow; + v85 = (Player *)((char *)v85 + 1); + pOutString = (GUIFont *)((char *)pOutString + 4); + ++v89; + } + while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + } + break; + } + default: + { + break; + } } } @@ -1669,66 +1716,65 @@ v104.uFrameZ = 334; v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - if ( dword_F8B19C == 1 ) - { - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v72 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v73 = pShopOptions; - do - { - v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); - ++v73; - v72 += v74; - } - while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); - v75 = pDialogueWindow; - Str = (char *)((174 - v72) / 4); - result = (POINT *)pDialogueWindow->pStartingPosActiveItem; - v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); - v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - v112 = pDialogueWindow->pStartingPosActiveItem; - if ( v28 ^ __OFSUB__((int)result, v76) ) - { - _this = (Player *)2; - v111 = (const char **)pShopOptions; - do - { - v78 = v75->GetControl(v112); - v79 = v111; - v78->uY = (unsigned int)&Str[v77]; - v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); - v81 = v78->uY; - v82 = _this; - v78->uHeight = v80; - v77 = v81 + v80 - 1; - v78->uW = v77; - v83 = v106; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) - v83 = v108; - v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); - v75 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v111; - ++v112; - result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)v112 < (signed int)result ); - } - } - } - else - { - if ( dword_F8B19C != 2 ) - { - if ( dword_F8B19C == 3 ) - { + switch(dword_F8B19C) + { + case 1: + { + result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; + v72 = 0; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + v73 = pShopOptions; + do + { + v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); + ++v73; + v72 += v74; + } + while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); + v75 = pDialogueWindow; + Str = (char *)((174 - v72) / 4); + result = (POINT *)pDialogueWindow->pStartingPosActiveItem; + v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); + v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; + v28 = -pDialogueWindow->pNumPresenceButton < 0; + v112 = pDialogueWindow->pStartingPosActiveItem; + if ( v28 ^ __OFSUB__((int)result, v76) ) + { + _this = (Player *)2; + v111 = (const char **)pShopOptions; + do + { + v78 = v75->GetControl(v112); + v79 = v111; + v78->uY = (unsigned int)&Str[v77]; + v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); + v81 = v78->uY; + v82 = _this; + v78->uHeight = v80; + v77 = v81 + v80 - 1; + v78->uW = v77; + v83 = v106; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) + v83 = v108; + v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); + v75 = pDialogueWindow; + _this = (Player *)((char *)_this + 1); + ++v111; + ++v112; + result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); + } + while ( (signed int)v112 < (signed int)result ); + } + } + return result; + } + case 3: + { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); @@ -1750,11 +1796,19 @@ v45 = _this->_490EEE(v87, 4, v44, 3); v39 = v113; v38 = (char *)pMerchantsSellPhrases[v45]; - goto LABEL_45; - } - if ( dword_F8B19C == 4 ) - { - draw_leather(); + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + } + case 4: + { + draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); @@ -1778,14 +1832,14 @@ v42 = _this->_490EEE(v37, 4, v41, 4); v39 = v113; v38 = (char *)pMerchantsIdentifyPhrases[v42]; - goto LABEL_45; - } - v89 = window_SpeakInHouse->ptr_1C; - v38 = "%24"; - v87 = v37; -LABEL_44: - v39 = uActiveCharacter - 1; -LABEL_45: + } + else + { + v89 = window_SpeakInHouse->ptr_1C; + v38 = "%24"; + v87 = v37; + v39 = uActiveCharacter - 1; + } v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); v92 = 3; v90 = v21; @@ -1793,11 +1847,12 @@ v86 = v3; v85 = v3; v84 = &v104; - goto LABEL_46; - } - if ( dword_F8B19C == 94 ) - { - draw_leather(); + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + } + case 94: + { + draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; @@ -1846,13 +1901,294 @@ while ( (signed int)v112 < (signed int)result ); } return result; - } - if ( dword_F8B19C != 95 ) - { - result = (POINT *)(dword_F8B19C - 96); - if ( dword_F8B19C != 96 - || (result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) == 0 ) - return result; + } + case 2: + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v114 = 0; + do + { + // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); + { + v46 = ItemsInShopTexture[v114]; + v47 = 152 - v46->uTextureHeight; + if ( (signed int)v47 < 1 ) + v47 = 0; + v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v49 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v48 > 457 - v49 ) + v48 = 457 - v49; + } + } + else if ( (signed int)v48 < 18 ) + v48 = 18; + pRenderer->DrawTextureTransparent(v48, v47, v46); + sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); + } + ++v114; + } + while ( v114 < 6 ); + v114 = 0; + do + { + // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); + { + v50 = ItemsInShopTexture[v114 + 6]; + v51 = 308 - v50->uTextureHeight; + if ( (signed int)v51 < 1 ) + v51 = 0; + v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v53 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v52 > 457 - v53 ) + v52 = 457 - v53; + } + } + else + { + if ( (signed int)v52 < 18 ) + v52 = 18; + } + pRenderer->DrawTextureTransparent(v52, v51, v50); + sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); + } + ++v114; + } + while ( v114 < 6 ); + result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v62 = 0; + v109 = 0; + do + { + // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); + ++v109; + ++v62; + } + while ( v62 < 12 ); + v63 = GetAsyncKeyState(17); + v64 = _this->CanSteal(); + Str = (char *)v64; + if ( v63 && v64 ) + { + v65 = pGlobalTXT_LocalizationStrings[185]; + } + else if ( dword_F8B19C == 2 ) + { + v65 = pGlobalTXT_LocalizationStrings[195]; + } + else + { + v65 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v65, 0); + if ( !v109 ) + { + v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return 0; + } + v66 = pMouse->GetCursorPos(&v98); + result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); + if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) + { + v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; + v109 = v67; + v68 = (int)window_SpeakInHouse->ptr_1C; + // v69 = 9 * (v67 + 12 * v68); + v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; + if ( dword_F8B19C != 2 ) + v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + if ( !v63 || !Str ) + { + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v113 = uActiveCharacter - 1; + v71 = _this->_490EEE(v70, 4, v68, 2); + v39 = v113; + v38 = (char *)pMerchantsBuyPhrases[v71]; + } + else + { + v38 = pGlobalTXT_LocalizationStrings[181]; + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v39 = uActiveCharacter - 1; + } + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + } + } + return result; + } + case 95: + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v114 = 0; + do + { + //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) + { + v54 = ItemsInShopTexture[v114]; + v55 = 152 - v54->uTextureHeight; + if ( (signed int)v55 < 1 ) + v55 = 0; + v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v57 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v56 > 457 - v57 ) + v56 = 457 - v57; + } + } + else + { + if ( (signed int)v56 < 18 ) + v56 = 18; + } + pRenderer->DrawTextureTransparent(v56, v55, v54); + sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); + } + ++v114; + } + while ( v114 < 6 ); + v114 = 0; + do + { + // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid + { + v58 = ItemsInShopTexture[v114 + 6]; + v59 = 308 - v58->uTextureHeight; + if ( (signed int)v59 < 1 ) + v59 = 0; + v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v61 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v60 > 457 - v61 ) + v60 = 457 - v61; + } + } + else + { + if ( (signed int)v60 < 18 ) + v60 = 18; + } + pRenderer->DrawTextureTransparent(v60, v59, v58); + sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); + } + ++v114; + } + while ( v114 < 6 ); + result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v62 = 0; + v109 = 0; + do + { + //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) + ++v109; + ++v62; + } + while ( v62 < 12 ); + v63 = GetAsyncKeyState(17); + v64 = _this->CanSteal(); + Str = (char *)v64; + if ( v63 && v64 ) + { + v65 = pGlobalTXT_LocalizationStrings[185]; + } + else + { + v65 = pGlobalTXT_LocalizationStrings[195]; + if ( dword_F8B19C != 2 ) + v65 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v65, 0); + if ( !v109 ) + { + v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return 0; + } + v66 = pMouse->GetCursorPos(&v98); + result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); + if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) + { + v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; + v109 = v67; + v68 = (int)window_SpeakInHouse->ptr_1C; + // v69 = 9 * (v67 + 12 * v68); + v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; + if ( dword_F8B19C != 2 ) + v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + if ( !v63 || !Str ) + { + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v113 = uActiveCharacter - 1; + v71 = _this->_490EEE(v70, 4, v68, 2); + v39 = v113; + v38 = (char *)pMerchantsBuyPhrases[v71]; + } + else + { + v38 = pGlobalTXT_LocalizationStrings[181]; + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v39 = uActiveCharacter - 1; + } + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + } + } + return result; + } + case 96: + { + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return 0; v2 = pDialogueWindow; v3 = 0; v4 = window_SpeakInHouse->ptr_1C; @@ -1941,221 +2277,14 @@ v86 = 0; v85 = 0; v84 = &v104; -LABEL_46: v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v114 = 0; - if ( dword_F8B19C == 2 ) - { - do - { - // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); - { - v46 = ItemsInShopTexture[v114]; - v47 = 152 - v46->uTextureHeight; - if ( (signed int)v47 < 1 ) - v47 = 0; - v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v49 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v48 > 457 - v49 ) - v48 = 457 - v49; - } - } - else - { - if ( (signed int)v48 < 18 ) - v48 = 18; - } - pRenderer->DrawTextureTransparent(v48, v47, v46); - sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); - { - v50 = ItemsInShopTexture[v114 + 6]; - v51 = 308 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v53 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; - } - } - else - { - if ( (signed int)v52 < 18 ) - v52 = 18; - } - pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - } - else - { - do - { - //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) - { - v54 = ItemsInShopTexture[v114]; - v55 = 152 - v54->uTextureHeight; - if ( (signed int)v55 < 1 ) - v55 = 0; - v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v57 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; - } - } - else - { - if ( (signed int)v56 < 18 ) - v56 = 18; - } - pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid - { - v58 = ItemsInShopTexture[v114 + 6]; - v59 = 308 - v58->uTextureHeight; - if ( (signed int)v59 < 1 ) - v59 = 0; - v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v61 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else - { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - } - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v62 = 0; - v109 = 0; - if ( dword_F8B19C == 2 ) - { - do - { - // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); - ++v109; - ++v62; - } - while ( v62 < 12 ); - } - else - { - do - { - //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) - ++v109; - ++v62; - } - while ( v62 < 12 ); - } - v63 = GetAsyncKeyState(17); - v64 = _this->CanSteal(); - Str = (char *)v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return 0; - } - v66 = pMouse->GetCursorPos(&v98); - result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v109 = v67; - v68 = (int)window_SpeakInHouse->ptr_1C; - // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dword_F8B19C != 2 ) - v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; - if ( !v63 || !Str ) - { - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v113 = uActiveCharacter - 1; - v71 = _this->_490EEE(v70, 4, v68, 2); - v39 = v113; - v38 = (char *)pMerchantsBuyPhrases[v71]; - goto LABEL_45; - } - v38 = pGlobalTXT_LocalizationStrings[181]; - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - goto LABEL_44; - } - } - } - return result; + } + default: + { + return (POINT *)dword_F8B19C - 96; + } + } } @@ -2191,7 +2320,7 @@ GUIButton *v26; // esi@26 int v27; // eax@26 unsigned int v28; // ecx@26 - Player *v29; // edx@26 + int v29; // edx@26 unsigned __int16 v30; // ax@26 signed int v31; // esi@31 unsigned int v32; // eax@33 @@ -2360,12 +2489,12 @@ v25->uY = v146 + v23; v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); v28 = v26->uY; - v29 = _this; + v29 = th; v26->uHeight = v27; v23 = v28 + v27 - 1; v26->uW = v23; v30 = v147; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v29 ) + if ( pDialogueWindow->pCurrentPosActiveItem != v29 ) v30 = v148; v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); v20 = pDialogueWindow; @@ -3159,7 +3288,7 @@ pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" - (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); + (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); pDialogueWindow->_41D08F(1, 1, 0, 2); @@ -3301,7 +3430,7 @@ pDialogueWindow->pControlsTail = 0; pDialogueWindow->uNumControls = 0; pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); + (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x55u, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x56u, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x57u, 0, "", 0); @@ -3685,7 +3814,7 @@ pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74], //"End Conversation" - (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : NULL), + (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : NULL), 0); return pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); } @@ -9330,26 +9459,18 @@ const char **v4; // ebx@2 unsigned int result; // eax@6 - v2 = this; v3 = 1; - if ( (signed int)this->uNumMaps <= 1 ) - { -LABEL_6: - result = 0; - } - else - { - v4 = (const char **)&this->pInfos[1].pFilename; - while ( !*v4 || _strcmpi(*v4, Str2) ) + if ( (signed int)uNumMaps <= 1 ) + return 0; + + while ( !*this->pInfos[v3].pFilename || _strcmpi(this->pInfos[v3].pFilename, Str2) ) { ++v3; - v4 += 17; - if ( (signed int)v3 >= (signed int)v2->uNumMaps ) - goto LABEL_6; - } - result = v3; - } - return result; + if ( (signed int)v3 >= (signed int)uNumMaps ) + return 0; + } + return v3; + } //----- (004547E4) --------------------------------------------------------