Mercurial > mm7
diff mm7_2.cpp @ 631:3d03a3a674bc
Merge
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 03:38:59 +0200 |
parents | 1b813023fcbd 59713bb36033 |
children | 71ecba604995 |
line wrap: on
line diff
--- a/mm7_2.cpp Mon Mar 11 03:37:48 2013 +0200 +++ b/mm7_2.cpp Mon Mar 11 03:38:59 2013 +0200 @@ -51,3000 +51,13 @@ #include "Events2D.h" #include "stru159.h" #include "Log.h" +#include "UIHouses.h" #include "texts.h" #include "mm7_data.h" #include "MM7.h" -//----- (004B4F4F) -------------------------------------------------------- -char *__cdecl JailDialog() -{ - const char *v0; // esi@1 - const char *v1; // ST10_4@1 - unsigned __int16 v2; // ST0C_2@1 - int v3; // eax@1 - GUIWindow v5; // [sp+8h] [bp-54h]@1 - - memcpy(&v5, window_SpeakInHouse, sizeof(v5)); - v0 = pGlobalTXT_LocalizationStrings[672]; - v1 = pGlobalTXT_LocalizationStrings[672]; - v5.uFrameX = 483; - v5.uFrameWidth = 148; - v5.uFrameZ = 334; - v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0); - return v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u); -} - - - -//----- (004B68EA) -------------------------------------------------------- -bool __fastcall sub_4B68EA(int a1) -{ - signed int v1; // edi@1 - int *v2; // esi@1 - int v3; // ecx@2 - - v1 = 0; - v2 = &dword_4F0E10[a1]; - while ( 1 ) - { - v3 = 8 * *((char *)v2 + v1); - if ( *(&byte_4F09B1[pParty->uDaysPlayed % 7] + v3 * 4) ) - { - if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v3])) ) - break; - } - ++v1; - if ( v1 >= 4 ) - return 0; - } - return 1; -} - - - -//----- (004B7911) -------------------------------------------------------- -void __cdecl TownHallDialog() -{ - GUIWindow *v0; // eax@4 - int v1; // eax@10 - int v2; // esi@10 - GUIFont *v3; // ST20_4@20 - int v4; // eax@20 - MonsterInfo *v5; // edi@21 - unsigned int v6; // ST20_4@21 - char *v7; // ST1C_4@21 - unsigned int v8; // eax@21 - int v9; // esi@21 - char *v10; // eax@23 - signed int v11; // ebx@24 - signed int i; // esi@26 - int v13; // eax@27 - GUIWindow *v14; // ecx@28 - __int64 v15; // qax@28 - signed int v16; // ebx@28 - int v17; // ebx@28 - unsigned __int8 v18; // sf@28 - char **v19; // edi@29 - GUIButton *v20; // eax@30 - GUIButton *v21; // esi@30 - int v22; // eax@30 - unsigned int v23; // ecx@30 - unsigned __int16 v24; // ax@30 - GUIWindow a1; // [sp+Ch] [bp-110h]@21 - GUIWindow w; // [sp+60h] [bp-BCh]@21 - GUIWindow _this; // [sp+B4h] [bp-68h]@1 - int v28; // [sp+108h] [bp-14h]@1 - int v29; // [sp+10Ch] [bp-10h]@28 - int v30; // [sp+110h] [bp-Ch]@1 - int v31; // [sp+114h] [bp-8h]@29 - GUIFont *pOutString; // [sp+118h] [bp-4h]@21 - - memcpy(&_this, window_SpeakInHouse, sizeof(_this)); - _this.uFrameX = 483; - _this.uFrameWidth = 148; - _this.uFrameZ = 334; - v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); - _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); - switch(dialog_menu_id) - { - 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; - -//----- (004B7D7E) -------------------------------------------------------- -void __cdecl BankDialog() -{ - GUIWindow *v0; // eax@4 - int v1; // ecx@5 - int v2; // eax@6 - unsigned int v3; // esi@6 - GUIFont *v4; // ST10_4@12 - int v5; // eax@12 - int v6; // eax@19 - unsigned int v7; // esi@19 - unsigned __int16 v8; // ax@27 - unsigned __int16 v9; // ax@29 - char *v10; // [sp-8h] [bp-70h]@11 - char *v11; // [sp-4h] [bp-6Ch]@11 - GUIWindow _this; // [sp+Ch] [bp-5Ch]@1 - __int16 v13[2]; // [sp+60h] [bp-8h]@1 - __int16 v14[2]; // [sp+64h] [bp-4h]@1 - - memcpy(&_this, window_SpeakInHouse, sizeof(_this)); - _this.uFrameX = 483; - _this.uFrameWidth = 148; - _this.uFrameZ = 334; - *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); - _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); - switch(dialog_menu_id) - { - 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; - -//----- (004B8285) -------------------------------------------------------- -void __cdecl TavernDialog() -{ - GUIWindow *v0; // ebx@1 - Player *v1; // edi@1 - double v2; // st7@1 - signed int v3; // ebx@1 - int v4; // ecx@1 - int v5; // esi@3 - signed int v6; // edi@5 - int v7; // ecx@5 - GUIWindow *v8; // edi@16 - signed int v9; // esi@16 - unsigned int v10; // esi@18 - int v11; // eax@18 - unsigned int v12; // eax@19 - int v13; // eax@21 - int v14; // ecx@26 - GUIButton *v15; // eax@28 - GUIButton *v16; // esi@28 - int v17; // eax@28 - char *v18; // eax@30 - int v19; // eax@30 - unsigned int v20; // ecx@30 - int v21; // edx@30 - int v22; // eax@30 - unsigned __int16 v23; // ax@30 - int v24; // eax@34 - int v25; // eax@34 - char *v26; // esi@36 - int v27; // edi@46 - unsigned int v28; // eax@53 - unsigned int v29; // eax@55 - unsigned int v30; // eax@57 - signed int v31; // eax@59 - unsigned int v32; // eax@61 - GUIWindow *v33; // edi@64 - int v34; // eax@64 - int v35; // ecx@64 - int v36; // esi@64 - char v37; // sf@64 - GUIButton *v38; // eax@65 - int v39; // edx@69 - int v40; // ecx@69 - int v41; // ecx@69 - int v42; // ecx@70 - unsigned int v43; // edx@70 - int v44; // edx@71 - int v45; // ecx@71 - int v46; // ecx@72 - int v47; // eax@74 - signed int v48; // edi@77 - signed int i; // esi@79 - int v50; // eax@80 - GUIWindow *v51; // ecx@81 - _QWORD v52; // qax@81 - signed int v53; // edi@81 - int v54; // edi@81 - GUIButton *v55; // esi@83 - const char **v56; // eax@83 - int v57; // eax@83 - unsigned int v58; // ecx@83 - Player *v59; // edx@83 - unsigned __int16 v60; // ax@83 - int v61; // eax@99 - int v62; // edi@99 - char *v63; // eax@99 - GUIFont *v64; // edx@99 - GUIFont *v65; // edi@100 - unsigned int v66; // [sp-10h] [bp-284h]@75 - unsigned __int16 v67; // [sp-Ch] [bp-280h]@75 - int v68; // [sp-Ch] [bp-280h]@99 - char *v69; // [sp-8h] [bp-27Ch]@75 - int v70; // [sp-8h] [bp-27Ch]@99 - unsigned int v71; // [sp-4h] [bp-278h]@75 - const char *v72; // [sp-4h] [bp-278h]@93 - unsigned int v73; // [sp-4h] [bp-278h]@99 - char Dest[100]; // [sp+Ch] [bp-268h]@55 - char v75[100]; // [sp+70h] [bp-204h]@59 - char a1[100]; // [sp+D4h] [bp-1A0h]@57 - char v77[100]; // [sp+138h] [bp-13Ch]@59 - GUIWindow v78; // [sp+19Ch] [bp-D8h]@99 - GUIWindow v79; // [sp+1F0h] [bp-84h]@1 - char *Str[2]; // [sp+244h] [bp-30h]@30 - unsigned int v81; // [sp+24Ch] [bp-28h]@1 - unsigned __int8 v82; // [sp+253h] [bp-21h]@59 - int v83; // [sp+254h] [bp-20h]@1 - __int16 v84[2]; // [sp+258h] [bp-1Ch]@1 - Player *v85; // [sp+25Ch] [bp-18h]@1 - int v86; // [sp+260h] [bp-14h]@18 - unsigned __int8 v87; // [sp+266h] [bp-Eh]@59 - unsigned __int8 v88; // [sp+267h] [bp-Dh]@57 - int v89; // [sp+268h] [bp-Ch]@1 - unsigned __int8 v90; // [sp+26Fh] [bp-5h]@55 - GUIFont *pOutString; // [sp+270h] [bp-4h]@3 - - v0 = window_SpeakInHouse; - memcpy(&v79, window_SpeakInHouse, sizeof(v79)); - v85 = pPlayers[uActiveCharacter]; - v1 = v85; - v79.uFrameX = 483; - v79.uFrameWidth = 148; - v79.uFrameZ = 334; - v81 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - *(int *)v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - //v2 = p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]; - v2 = p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier; - *(float *)&v83 = v2; - *(float *)&v89 = v2 * v2; - v3 = (signed __int64)(*(float *)&v89 * 0.1); - v4 = v3 * (100 - v1->GetMerchant()) / 100; - if ( v4 < v3 / 3 ) - v4 = v3 / 3; - v5 = 1; - pOutString = (GUIFont *)v4; - if ( v4 <= 0 ) - pOutString = (GUIFont *)1; - v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998); - v7 = v6 * (100 - v85->GetMerchant()) / 100; - if ( v7 < v6 / 3 ) - v7 = v6 / 3; - v83 = v7; - if ( v7 <= 0 ) - { - v7 = 1; - v83 = 1; - } - switch(dialog_menu_id) - { - 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 ) - { - if ( pArcomageGame->uGameResult == 1 ) - v72 = pGlobalTXT_LocalizationStrings[640];// You won! - else - v72 = pGlobalTXT_LocalizationStrings[641];// You lost! - } - else - { - v72 = pGlobalTXT_LocalizationStrings[639];// A tie! - } - strcpy(pTmpBuf, v72); -//LABEL_97: - 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); - break; - } - case 15: - { - if ( pParty->uNumGold >= (unsigned int)pOutString ) - { - Party::TakeGold((unsigned int)pOutString); - v27 = (int)window_SpeakInHouse->ptr_1C; - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - dialog_menu_id = 0; - while ( sub_4BD8B5() ) - ; - sub_4B1D27(); - pVideoPlayer->Unload(); - window_SpeakInHouse->Release(); - window_SpeakInHouse = 0; - - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI; - pMessageQueue_50CBD0->pMessages[0].param = v27; - pMessageQueue_50CBD0->pMessages[0].field_8 = 1; -//LABEL_51: - ++pMessageQueue_50CBD0->uNumMessages; - return; - } - 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 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); - return; - } - if ( pParty->uNumGold >= v7 ) - { - Party::TakeGold(v7); - //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - 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: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); - return; - //goto LABEL_51; - } - 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; - } - } -} - - -//----- (004B910F) -------------------------------------------------------- -char *__cdecl WeaponShopDialog() -{ - Player *v0; // ebx@1 - char *result; // eax@6 - signed int v2; // esi@8 - unsigned int v3; // ebx@10 - ItemGen *v4; // eax@11 - char *v5; // ecx@12 - unsigned __int8 v6; // dl@13 - char *v7; // edx@14 - int v8; // eax@15 - int v9; // ST08_4@16 - int v10; // eax@16 - signed int v11; // esi@18 - int v12; // ST08_4@21 - int v13; // eax@21 - int v14; // edi@23 - char **v15; // esi@23 - int v16; // eax@24 - GUIWindow *v17; // ecx@25 - int v18; // edx@25 - int v19; // edi@25 - unsigned __int8 v20; // sf@25 - GUIButton *v21; // esi@27 - const char **v22; // eax@27 - int v23; // eax@27 - unsigned int v24; // ecx@27 - int v25; // edx@27 - unsigned __int16 v26; // ax@27 - signed int v27; // esi@32 - int v28; // ST08_4@36 - int v29; // eax@36 - GUIWindow *v30; // edi@41 - void *v31; // eax@41 - signed int v32; // esi@41 - unsigned int v33; // esi@43 - int v34; // eax@43 - unsigned int v35; // eax@44 - int v36; // eax@46 - __int32 v37; // ecx@51 - GUIButton *v38; // eax@53 - GUIButton *v39; // esi@53 - int v40; // eax@53 - char *v41; // eax@55 - int v42; // eax@55 - unsigned int v43; // ecx@55 - const char **v44; // edx@55 - int v45; // eax@55 - unsigned __int16 v46; // ax@55 - int v47; // eax@59 - const char **v48; // eax@63 - unsigned int v49; // esi@65 - Texture *v50; // eax@65 - int v51; // edi@65 - int v52; // esi@70 - Texture *v53; // ST1C_4@70 - int v54; // edi@70 - signed int v55; // ecx@73 - SHORT v56; // di@82 - bool v57; // eax@82 - const char *v58; // ecx@84 - POINT *v59; // esi@89 - LONG v60; // ecx@90 - int v61; // eax@90 - int v62; // ecx@90 - ItemGen *v63; // esi@90 - int v64; // eax@95 - int v65; // esi@96 - char **v66; // edi@96 - int v67; // eax@97 - GUIWindow *v68; // ecx@98 - int v69; // edx@98 - int v70; // edi@98 - GUIButton *v71; // esi@100 - const char **v72; // eax@100 - int v73; // eax@100 - unsigned int v74; // ecx@100 - Player *v75; // edx@100 - unsigned __int16 v76; // ax@100 - GUIWindow *v77; // [sp-18h] [bp-110h]@14 - int v78; // [sp-14h] [bp-10Ch]@14 - ItemGen *v79; // [sp-10h] [bp-108h]@12 - int v80; // [sp-10h] [bp-108h]@14 - void *v81; // [sp-Ch] [bp-104h]@12 - unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 - int v83; // [sp-8h] [bp-100h]@11 - char *v84; // [sp-8h] [bp-100h]@14 - __int64 *v85; // [sp-4h] [bp-FCh]@11 - unsigned int v86; // [sp-4h] [bp-FCh]@14 - POINT v87; // [sp+Ch] [bp-ECh]@8 - POINT v88; // [sp+14h] [bp-E4h]@18 - POINT v89; // [sp+1Ch] [bp-DCh]@89 - POINT v90; // [sp+24h] [bp-D4h]@19 - POINT v91; // [sp+2Ch] [bp-CCh]@89 - POINT v92; // [sp+34h] [bp-C4h]@9 - POINT v93; // [sp+3Ch] [bp-BCh]@33 - POINT v94; // [sp+44h] [bp-B4h]@18 - POINT v95; // [sp+4Ch] [bp-ACh]@32 - POINT v96; // [sp+54h] [bp-A4h]@18 - POINT v97; // [sp+5Ch] [bp-9Ch]@32 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v99; // [sp+6Ch] [bp-8Ch]@32 - POINT v100; // [sp+74h] [bp-84h]@8 - GUIWindow v101; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@55 - __int32 v103; // [sp+D4h] [bp-24h]@25 - int v104; // [sp+D8h] [bp-20h]@1 - int v105; // [sp+DCh] [bp-1Ch]@1 - POINT v106; // [sp+E0h] [bp-18h]@8 - Player *_this; // [sp+E8h] [bp-10h]@1 - int v108; // [sp+ECh] [bp-Ch]@26 - const char **v109; // [sp+F0h] [bp-8h]@26 - unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v101, window_SpeakInHouse, sizeof(v101)); - v101.uFrameX = 483; - v101.uFrameWidth = 148; - v101.uFrameZ = 334; - v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch(dialog_menu_id) - { - case 94: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; - v65 = 0; - v66 = pShopOptions; - do - { - v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0); - ++v66; - v65 += v67; - } - while ( (signed int)v66 < (signed int)&pShopOptions[3] ); - v68 = pDialogueWindow; - v109 = (const char **)((174 - v65) / 3); - result = (char *)pDialogueWindow->pStartingPosActiveItem; - v69 = (int)&result[pDialogueWindow->pNumPresenceButton]; - v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v106.y = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__((int)result, (int)v69) ) - { - _this = (Player *)2; - v108 = (int)pShopOptions; - do - { - v71 = v68->GetControl(v106.y); - v72 = (const char **)v108; - v71->uY = (unsigned int)((char *)v109 + v70); - v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0); - v74 = v71->uY; - v75 = _this; - v71->uHeight = v73; - v70 = v73 + v74 - 1; - v71->uW = v70; - v76 = v104; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 ) - v76 = v105; - v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u); - v68 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - v108 += 4; - ++v106.y; - result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( v106.y < (signed int)result ); - } - break; - } - case 96: - { - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v30 = pDialogueWindow; - v3 = 0; - v31 = window_SpeakInHouse->ptr_1C; - v106.y = 0; - //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); - v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); - v108 = v32 * (100 - _this->GetMerchant()) / 100; - if ( v108 < v32 / 3 ) - v108 = v32 / 3; - v33 = v30->pStartingPosActiveItem; - v34 = v33 + v30->pNumPresenceButton; - v109 = 0; - if ( (signed int)v33 >= v34 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v7 = pTmpBuf; - v86 = 3; - v84 = pTmpBuf; - v82 = v104; - v80 = 0; - v78 = 0; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - do - { - v35 = v30->GetControl(v33)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v35] && !_this->pActiveSkills[v35] ) - { - v36 = pFontArrus->CalcTextHeight(pSkillNames[v35], &v101, 0, 0); - v106.y += v36; - v109 = (const char **)((char *)v109 + 1); - } - ++v33; - } - while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem ); - if ( !v109 ) - { -//LABEL_105: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v7 = pTmpBuf; - v86 = 3; - v84 = pTmpBuf; - v82 = v104; - v80 = 0; - v78 = 0; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); - v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v108 = (149 - v106.y) / (signed int)v109; - if ( (149 - v106.y) / (signed int)v109 > 32 ) - v108 = 32; - result = (char *)v30->pStartingPosActiveItem; - v37 = (149 - (signed int)v109 * v108 - v106.y) / 2 - v108 / 2 + 162; - v106.y = (LONG)result; - v103 = v37; - if ( (signed int)result < (signed int)&result[v30->pNumPresenceButton] ) - { - v109 = (const char **)2; - do - { - v38 = v30->GetControl(v106.y); - v39 = v38; - v40 = v38->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v40] || _this->pActiveSkills[v40] ) - { - v39->uW = 0; - v39->uHeight = 0; - v39->uY = 0; - } - else - { - v41 = pSkillNames[v40]; - v39->uY = v108 + v103; - Str = v41; - v42 = pFontArrus->CalcTextHeight(v41, &v101, 0, 0); - v43 = v39->uY; - v44 = v109; - v39->uHeight = v42; - v45 = v43 + v42 - 1; - v39->uW = v45; - v103 = v45; - v46 = v104; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 ) - v46 = v105; - v101.DrawTitleText(pFontArrus, 0, v43, v46, Str, 3u); - } - v47 = v30->pStartingPosActiveItem; - ++v106.y; - result = (char *)(v30->pNumPresenceButton + v47); - v109 = (const char **)((char *)v109 + 1); - } - while ( v106.y < (signed int)result ); - } - } - break; - } - case 95: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v109 = 0; - v108 = 0; - do - { - // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) - { - v52 = word_F8B158[(signed int)v109] + 30; - v53 = ItemsInShopTexture[(signed int)v109]; - v54 = 60 - ((signed int)v53->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53); - sub_40F92A( - &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52], - ItemsInShopTexture[(signed int)v109], - (int)((char *)v109 + 1)); - } - v109 = (const char **)((char *)v109 + 1); - v108 += 70; - } - while ( (signed int)v109 < 6 ); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v55 = 0; - v106.x = 0; - do - { - // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = _this->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != 2 ) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != 2 ) - v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v110 = uActiveCharacter - 1; - v64 = _this->_490EEE(v63, 1, v61, 2); - v6 = v110; - v5 = (char *)pMerchantsBuyPhrases[v64]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - v5 = pGlobalTXT_LocalizationStrings[181]; - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v6 = uActiveCharacter - 1; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - else - { - v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - result =0; //added - } - } - break; - } - case 2: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v48 = 0; - v108 = 0; - v109 = 0; - do - { - // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); - { - v49 = word_F8B158[(signed int)v48]; - v50 = ItemsInShopTexture[(signed int)v48]; - v49 += 30; - v51 = 60 - ((signed int)v50->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v51 + v108, v49, v50); - sub_40F92A( - &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49], - ItemsInShopTexture[(signed int)v109], - (int)((char *)v109 + 1)); - v48 = v109; - } - v108 += 70; - v48 = (const char **)((char *)v48 + 1); - v109 = v48; - } - while ( (signed int)v48 < 6 ); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v55 = 0; - v106.x = 0; - v106.x = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = _this->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != 2 ) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != 2 ) - v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v110 = uActiveCharacter - 1; - v64 = _this->_490EEE(v63, 1, v61, 2); - v6 = v110; - v5 = (char *)pMerchantsBuyPhrases[v64]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - v5 = pGlobalTXT_LocalizationStrings[181]; - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v6 = uActiveCharacter - 1; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - else - { - v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - result =0; //added - } - } - break; - } - case 3: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v11 = pMouse->GetCursorPos(&v96)->x - 14; - v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5); - result = (char *)pMouse->GetCursorPos(&v94); - if ( *(int *)result > 13 ) - { - result = (char *)pMouse->GetCursorPos(&v90); - if ( *(int *)result < 462 ) - { - result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); - v3 = 0; - if ( result ) - { - v85 = 0; - v83 = 3; - v81 = window_SpeakInHouse->ptr_1C; - v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v12 = (int)window_SpeakInHouse->ptr_1C; - v110 = uActiveCharacter - 1; - v13 = _this->_490EEE(v79, 1, v12, 3); - v6 = v110; - v5 = (char *)pMerchantsSellPhrases[v13]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - } - } - break; - } - case 4: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5); - result = (char *)pMouse->GetCursorPos(&v100); - if ( *(int *)result > 13 ) - { - result = (char *)pMouse->GetCursorPos(&v92); - if ( *(int *)result < 462 ) - { - result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); - v3 = 0; - if ( result ) - { - v85 = 0; - v83 = 4; - v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if (!v4->Identified()) - { - v81 = window_SpeakInHouse->ptr_1C; - v79 = v4; - v9 = (int)window_SpeakInHouse->ptr_1C; - v110 = uActiveCharacter - 1; - v10 = _this->_490EEE(v4, 1, v9, 4); - v6 = v110; - v5 = (char *)pMerchantsIdentifyPhrases[v10]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - v81 = window_SpeakInHouse->ptr_1C; - v5 = "%24"; - v79 = v4; - //LABEL_13: - v6 = uActiveCharacter - 1; - //LABEL_14: - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - //LABEL_15: - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - } - } - break; - } - case 1: - { - result = (char *)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]; - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v103 = (174 - v14) / 4; - result = (char *)pDialogueWindow->pStartingPosActiveItem; - v18 = (int)&result[pDialogueWindow->pNumPresenceButton]; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__((int)result, v18) ) - { - v108 = 2; - v109 = (const char **)pShopOptions; - do - { - v21 = v17->GetControl((unsigned int)_this); - v22 = v109; - v21->uY = v103 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0); - v24 = v21->uY; - v25 = v108; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = v104; - if ( pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = v105; - v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u); - v17 = pDialogueWindow; - ++v108; - ++v109; - _this = (Player *)((char *)_this + 1); - result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)_this < (signed int)result ); - } - } - break; - } - default: - { - if( dialog_menu_id > 5 ) - result = (char *)(dialog_menu_id - 96); - else - result = (char *)(dialog_menu_id - 4); - break; - } - } - return result; -} - - -//----- (004B9CC6) -------------------------------------------------------- -POINT *__cdecl AlchemistDialog() -{ - Player *v0; // ebx@1 - POINT *result; // eax@7 - GUIWindow *v2; // edi@9 - unsigned int v3; // ebx@9 - void *v4; // eax@9 - signed int v5; // esi@9 - unsigned int v6; // esi@11 - int v7; // eax@11 - unsigned int v8; // eax@12 - int v9; // eax@14 - int v10; // ecx@19 - GUIButton *v11; // eax@21 - GUIButton *v12; // esi@21 - int v13; // eax@21 - char *v14; // eax@23 - int v15; // eax@23 - unsigned int v16; // ecx@23 - int v17; // edx@23 - int v18; // eax@23 - unsigned __int16 v19; // ax@23 - int v20; // eax@27 - char *v21; // edx@29 - int v22; // esi@30 - char **v23; // edi@30 - int v24; // eax@31 - GUIWindow *v25; // ecx@32 - int v26; // edx@32 - int v27; // edi@32 - unsigned __int8 v28; // sf@32 - GUIButton *v29; // esi@34 - const char **v30; // eax@34 - int v31; // eax@34 - unsigned int v32; // ecx@34 - Player *v33; // edx@34 - int v34; // eax@34 - unsigned __int16 v35; // ax@34 - signed int v36; // esi@39 - ItemGen *v37; // eax@42 - char *v38; // ecx@43 - unsigned __int8 v39; // dl@44 - int v40; // eax@46 - int v41; // ST08_4@47 - int v42; // eax@47 - signed int v43; // esi@49 - int v44; // ST08_4@52 - int v45; // eax@52 - Texture *v46; // ecx@55 - unsigned int v47; // edi@55 - unsigned int v48; // esi@57 - int v49; // edx@61 - Texture *v50; // ecx@67 - unsigned int v51; // edi@67 - unsigned int v52; // esi@69 - int v53; // edx@73 - Texture *v54; // ecx@79 - unsigned int v55; // edi@79 - unsigned int v56; // esi@81 - int v57; // edx@85 - Texture *v58; // ecx@91 - unsigned int v59; // edi@91 - unsigned int v60; // esi@93 - int v61; // edx@97 - signed int v62; // ecx@102 - SHORT v63; // di@110 - bool v64; // eax@110 - const char *v65; // ecx@112 - POINT *v66; // esi@117 - int v67; // ecx@118 - int v68; // eax@118 - int v69; // ecx@118 - ItemGen *v70; // esi@118 - int v71; // eax@123 - int v72; // edi@125 - char **v73; // esi@125 - int v74; // eax@126 - GUIWindow *v75; // ecx@127 - int v76; // edx@127 - int v77; // edi@127 - GUIButton *v78; // esi@129 - const char **v79; // eax@129 - int v80; // eax@129 - unsigned int v81; // ecx@129 - Player *v82; // edx@129 - unsigned __int16 v83; // ax@129 - GUIWindow *v84; // [sp-18h] [bp-F0h]@29 - int v85; // [sp-14h] [bp-ECh]@29 - int v86; // [sp-10h] [bp-E8h]@29 - ItemGen *v87; // [sp-10h] [bp-E8h]@43 - unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 - void *v89; // [sp-Ch] [bp-E4h]@43 - char *v90; // [sp-8h] [bp-E0h]@29 - int v91; // [sp-8h] [bp-E0h]@42 - unsigned int v92; // [sp-4h] [bp-DCh]@29 - __int64 *v93; // [sp-4h] [bp-DCh]@42 - POINT v94; // [sp+Ch] [bp-CCh]@39 - POINT v95; // [sp+14h] [bp-C4h]@49 - POINT v96; // [sp+1Ch] [bp-BCh]@117 - POINT v97; // [sp+24h] [bp-B4h]@40 - POINT v98; // [sp+2Ch] [bp-ACh]@117 - POINT v99; // [sp+34h] [bp-A4h]@49 - POINT v100; // [sp+3Ch] [bp-9Ch]@50 - POINT v101; // [sp+44h] [bp-94h]@39 - POINT v102; // [sp+4Ch] [bp-8Ch]@49 - POINT a2; // [sp+54h] [bp-84h]@39 - GUIWindow v104; // [sp+5Ch] [bp-7Ch]@1 - int v105; // [sp+B0h] [bp-28h]@19 - int v106; // [sp+B4h] [bp-24h]@1 - char *Str; // [sp+B8h] [bp-20h]@23 - int v108; // [sp+BCh] [bp-1Ch]@1 - __int32 v109; // [sp+C0h] [bp-18h]@39 - Player *_this; // [sp+C4h] [bp-14h]@1 - const char **v111; // [sp+C8h] [bp-10h]@9 - unsigned int v112; // [sp+CCh] [bp-Ch]@9 - unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 - int v114; // [sp+D4h] [bp-4h]@11 - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v104, window_SpeakInHouse, sizeof(v104)); - v104.uFrameX = 483; - v104.uFrameWidth = 148; - v104.uFrameZ = 334; - v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch(dialog_menu_id) - { - 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); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( !result - || (v43 = pMouse->GetCursorPos(&v99)->x - 14, - v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), - result = pMouse->GetCursorPos(&v102), - result->x <= 13) - || (result = pMouse->GetCursorPos(&v100), result->x >= 462) - || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) - return result; - v93 = 0; - v91 = 3; - v89 = window_SpeakInHouse->ptr_1C; - v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v44 = (int)window_SpeakInHouse->ptr_1C; - v113 = uActiveCharacter - 1; - v45 = _this->_490EEE(v87, 4, v44, 3); - v39 = v113; - v38 = (char *)pMerchantsSellPhrases[v45]; - 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(); - if ( !result - || (v36 = pMouse->GetCursorPos(&a2)->x - 14, - v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), - result = pMouse->GetCursorPos(&v101), - result->x <= 13) - || (result = pMouse->GetCursorPos(&v97), result->x >= 462) - || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) - return result; - v93 = 0; - v91 = 4; - v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if (!v37->Identified()) - { - v89 = window_SpeakInHouse->ptr_1C; - v87 = v37; - v41 = (int)window_SpeakInHouse->ptr_1C; - v113 = uActiveCharacter - 1; - v42 = _this->_490EEE(v37, 4, v41, 4); - v39 = v113; - v38 = (char *)pMerchantsIdentifyPhrases[v42]; - } - 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; - 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 94: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - v22 = 0; - v23 = pShopOptions; - do - { - v24 = pFontArrus->CalcTextHeight(*v23, &v104, 0, 0); - ++v23; - v22 += v24; - } - while ( (signed int)v23 < (signed int)&pShopOptions[2] ); - Str = (char *)((174 - v22) / 2); - v25 = pDialogueWindow; - result = (POINT *)pDialogueWindow->pStartingPosActiveItem; - v26 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); - v27 = (2 * (87 - (174 - v22) / 2) - v22) / 2 - (174 - v22) / 2 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - v112 = pDialogueWindow->pStartingPosActiveItem; - if ( v28 ^ __OFSUB__((int)result, v26) ) - { - _this = (Player *)2; - v111 = (const char **)pShopOptions; - do - { - v29 = v25->GetControl(v112); - v30 = v111; - v29->uY = (unsigned int)&Str[v27]; - v31 = pFontArrus->CalcTextHeight(*v30, &v104, 0, 0); - v32 = v29->uY; - v33 = _this; - v29->uHeight = v31; - v34 = v31 + v32 - 1; - v29->uW = v34; - v27 = v34; - v35 = v106; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v33 ) - v35 = v108; - v104.DrawTitleText(pFontArrus, 0, v32, v35, *v111, 3u); - v25 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v111; - ++v112; - result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)v112 < (signed int)result ); - } - 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 ( dialog_menu_id == 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 ( dialog_menu_id != 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 ( dialog_menu_id != 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 ( dialog_menu_id != 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; - v112 = 0; - //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); - v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); - v111 = (const char **)(v5 * (100 - _this->GetMerchant()) / 100); - if ( (signed int)v111 < v5 / 3 ) - v111 = (const char **)(v5 / 3); - v6 = v2->pStartingPosActiveItem; - v7 = v6 + v2->pNumPresenceButton; - v114 = 0; - if ( (signed int)v6 < v7 ) - { - do - { - v8 = v2->GetControl(v6)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v8] && !_this->pActiveSkills[v8] ) - { - v9 = pFontArrus->CalcTextHeight(pSkillNames[v8], &v104, 0, 0); - v112 += v9; - ++v114; - } - ++v6; - } - while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); - if ( v114 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); - v104.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v111 = (const char **)((signed int)(149 - v112) / v114); - if ( (signed int)(149 - v112) / v114 > 32 ) - v111 = (const char **)32; - result = (POINT *)v2->pStartingPosActiveItem; - v10 = (signed int)(149 - v114 * (int)v111 - v112) / 2 - (signed int)v111 / 2 + 162; - v112 = (unsigned int)result; - v105 = v10; - if ( (signed int)result < (signed int)((char *)result + v2->pNumPresenceButton) ) - { - v114 = 2; - do - { - v11 = v2->GetControl(v112); - v12 = v11; - v13 = v11->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v13] || _this->pActiveSkills[v13] ) - { - v12->uW = 0; - v12->uHeight = 0; - v12->uY = 0; - } - else - { - v14 = pSkillNames[v13]; - v12->uY = (unsigned int)((char *)v111 + v105); - Str = v14; - v15 = pFontArrus->CalcTextHeight(v14, &v104, 0, 0); - v16 = v12->uY; - v17 = v114; - v12->uHeight = v15; - v18 = v16 + v15 - 1; - v12->uW = v18; - v105 = v18; - v19 = v106; - if ( pDialogueWindow->pCurrentPosActiveItem != v17 ) - v19 = v108; - v104.DrawTitleText(pFontArrus, 0, v16, v19, Str, 3u); - } - v20 = v2->pStartingPosActiveItem; - ++v112; - result = (POINT *)(v2->pNumPresenceButton + v20); - ++v114; - } - while ( (signed int)v112 < (signed int)result ); - } - return result; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v21 = pTmpBuf; - v92 = 3; - v90 = pTmpBuf; - v88 = v106; - v86 = 0; - v85 = 0; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - default: - { - return (POINT *)dialog_menu_id - 96; - } - } -} - - -//----- (004BA928) -------------------------------------------------------- -void __cdecl ArmorShopDialog() - { - Player *v0; // ebx@1 - signed int v1; // esi@8 - unsigned int v2; // eax@10 - ItemGen *v3; // eax@11 - unsigned __int8 v4; // dl@12 - char *v5; // ecx@12 - char *v6; // eax@13 - int v7; // ST08_4@15 - int v8; // eax@15 - signed int v9; // esi@17 - unsigned int v10; // eax@19 - char *v11; // edi@19 - int v12; // ST08_4@20 - int v13; // eax@20 - unsigned __int8 v14; // dl@20 - char *v15; // ecx@20 - char **v16; // edi@22 - int all_text_height; // ebx@22 - char **v18; // esi@22 - int v19; // eax@23 - GUIWindow *v20; // ecx@24 - int v21; // eax@24 - int v22; // edx@24 - int v23; // ebx@24 - unsigned __int8 v24; // sf@24 - GUIButton *control_button; // eax@26 - GUIButton *v26; // esi@26 - int v27; // eax@26 - unsigned int v28; // ecx@26 - int v29; // edx@26 - - signed int v31; // esi@31 - unsigned int v32; // eax@33 - int v33; // eax@34 - int v34; // ST08_4@35 - int v35; // eax@35 - char *v36; // edx@36 - GUIWindow *v37; // edi@42 - signed int v38; // esi@42 - unsigned int v39; // esi@44 - int v40; // eax@44 - unsigned int v41; // eax@45 - int v42; // eax@47 - int v43; // ecx@52 - GUIButton *v44; // eax@54 - GUIButton *v45; // esi@54 - int v46; // eax@54 - char *v47; // eax@56 - int v48; // eax@56 - unsigned int v49; // ecx@56 - int v50; // edx@56 - int v51; // eax@56 - unsigned __int16 v52; // ax@56 - int v53; // eax@60 - int textureH; // eax@60 - signed int textureW; // ebx@65 - Texture *v56; // eax@67 - unsigned int v57; // edi@68 - Texture *v58; // ST1C_4@68 - int v59; // eax@68 - int v60; // edi@69 - signed int v61; // ebx@73 - Texture *v62; // eax@75 - int v63; // edi@76 - Texture *v64; // ST1C_4@76 - unsigned int v65; // ST18_4@76 - int v66; // eax@76 - int v67; // edi@77 - signed int v68; // ecx@81 - SHORT v69; // bx@89 - bool v70; // eax@89 - const char *v71; // ecx@91 - void *v72; // eax@95 - POINT *v73; // esi@97 - int v74; // ecx@97 - int v75; // eax@98 - int v76; // ecx@98 - ItemGen *selected_item; // ecx@99 - unsigned __int8 v78; // bl@104 - char **v79; // edi@105 - int v80; // ebx@105 - char **v81; // esi@105 - int v82; // eax@106 - GUIWindow *v83; // ecx@107 - int v84; // eax@107 - int v85; // edx@107 - int v86; // ebx@107 - GUIButton *v87; // eax@109 - GUIButton *v88; // esi@109 - int v89; // eax@109 - unsigned int v90; // ecx@109 - int v91; // edx@109 - unsigned __int16 v92; // ax@109 - signed int v93; // edx@114 - POINT *v94; // edi@120 - __int32 v95; // ecx@120 - void *v96; // ST14_4@122 - unsigned __int8 v97; // bl@122 - ItemGen *v98; // ST10_4@122 - int v99; // eax@122 - char *v100; // eax@122 - const char *v101; // ST18_4@122 - unsigned __int16 v102; // ST14_2@122 - int v103; // eax@122 - signed int v104; // edi@123 - Texture *v105; // eax@125 - int v106; // ebx@126 - Texture *v107; // ST1C_4@126 - unsigned int v108; // ST18_4@126 - int v109; // eax@126 - int v110; // ebx@127 - GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 - unsigned int v112; // [sp-14h] [bp-118h]@13 - int v113; // [sp-14h] [bp-118h]@36 - ItemGen *v114; // [sp-10h] [bp-114h]@12 - unsigned int v115; // [sp-10h] [bp-114h]@13 - ItemGen *v116; // [sp-10h] [bp-114h]@20 - int v117; // [sp-10h] [bp-114h]@36 - void *v118; // [sp-Ch] [bp-110h]@12 - unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 - void *v120; // [sp-Ch] [bp-110h]@20 - char *v121; // [sp-8h] [bp-10Ch]@13 - int v122; // [sp-8h] [bp-10Ch]@20 - unsigned int v123; // [sp-4h] [bp-108h]@13 - __int64 *v124; // [sp-4h] [bp-108h]@20 - int v125; // [sp-4h] [bp-108h]@68 - int v126; // [sp-4h] [bp-108h]@76 - int v127; // [sp-4h] [bp-108h]@126 - POINT v128; // [sp+Ch] [bp-F8h]@8 - POINT v129; // [sp+14h] [bp-F0h]@18 - char v130; // [sp+1Ch] [bp-E8h]@120 - POINT a2; // [sp+24h] [bp-E0h]@8 - POINT v132; // [sp+2Ch] [bp-D8h]@120 - POINT v133; // [sp+34h] [bp-D0h]@17 - POINT v134; // [sp+3Ch] [bp-C8h]@97 - POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 - POINT v137; // [sp+54h] [bp-B0h]@17 - POINT v138; // [sp+5Ch] [bp-A8h]@32 - POINT v139; // [sp+64h] [bp-A0h]@17 - POINT v140; // [sp+6Ch] [bp-98h]@31 - POINT v141; // [sp+74h] [bp-90h]@8 - POINT v142; // [sp+7Ch] [bp-88h]@31 - POINT v143; // [sp+84h] [bp-80h]@9 - GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 - char *Str; // [sp+E0h] [bp-24h]@56 - int v146; // [sp+E4h] [bp-20h]@24 - int hilight_color; // [sp+E8h] [bp-1Ch]@1 - int m_text_color; // [sp+ECh] [bp-18h]@1 - __int32 v149; // [sp+F0h] [bp-14h]@8 - Player* _this; // [sp+F4h] [bp-10h]@1 - unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 - int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 - int th; - short text_color; - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch (dialog_menu_id) - { - case 1: //main shop text - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - - all_text_height = 0; - for(int i=0;i<4;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j=0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = v27; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } - } - } - break; - case 2: //buy standart - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - textureW = 0; - v153 = 0; - for(int i=0; i<8; ++i) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); - { - textureW = ItemsInShopTexture[i]->uTextureWidth; - textureH = ItemsInShopTexture[i]->uTextureHeight; - if ( i >= 4 ) //low row - { - v60 = 90 - (textureW/2); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; - } - else - { - v57 = 98 - textureH; - v152 = 86 - (textureW/2); - pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); - v59 = v153 + v152 + 640 * v57; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); - } - v153 += 105; - - } - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - - v149 = 0; - for(int i=0; i<8; ++i) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); - ++v149; - - } - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - //Str = (char *)v70; - if ( v69 == 0 || v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" - } - DrawTextAtStatusBar(v71, 0); - if ( v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - if ( v69 ==0 || v70 == 0) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - case 3: //sell - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - - if((v9 = pMouse->GetCursorPos(&v139)->x - 14, - v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), - pMouse->GetCursorPos(&v137)->x <= 13) - || pMouse->GetCursorPos(&v129)->x >= 462 - || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) - return; - - v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; - - v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); - - v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; - v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); - - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - break; - case 4: //identify - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v1 = pMouse->GetCursorPos(&a2)->x - 14; - v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&v141)->x > 13 ) - { - if ( pMouse->GetCursorPos(&v143)->x < 462 ) - { - v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); - if ( v2 ) - { - v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; - if (v3->Identified()) - { - v118 = window_SpeakInHouse->ptr_1C; - v4 = uActiveCharacter - 1; - v5 = "%24"; - v114 = v3; - } - else - { - v118 = window_SpeakInHouse->ptr_1C; - v114 = v3; - v7 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v8 = v0->_490EEE(v3, 2, v7, 4); - v4 = uPlayerID; - v5 = (char *)pMerchantsIdentifyPhrases[v8]; - } - v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3); - return; - } - } - } - } - } - break; - case 5: //repair - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - - if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, - v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), - pMouse->GetCursorPos(&v140)->x <= 13) - || pMouse->GetCursorPos(&v138)->x >= 462 - || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) - || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) - return; - - - v120 = window_SpeakInHouse->ptr_1C; - v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; - v34 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); - v14 = uPlayerID; - v15 = (char *)pMerchantsRepairPhrases[v35]; - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - break; - case 6: //buy standart - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v149 = 0; - for(int i=0;i<6;++i) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++v149; - - - if ( v149 ) - { - v94 = pMouse->GetCursorPos(&v132); - v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; - v95 = v149; - if ( v149 && v149 != -65536 ) - { - --v149; - - v97 = uActiveCharacter - 1; - - v99 = _this->_490EEE( - &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); - v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); - v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3); - } - v104 = 0; - v153 = 0; - do - { - //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) - { - v105 = ItemsInShopTexture[v104]; - if ( v104 >= 4 ) - { - v110 = 90 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); - v127 = v104 + 1; - v109 = v153 + v110 + 80220; - } - else - { - v106 = 98 - v105->uTextureHeight; - v107 = ItemsInShopTexture[v104]; - v108 = 98 - v105->uTextureHeight; - v152 = 86 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); - v127 = v104 + 1; - v109 = v152 + v153 + 640 * v106; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); - } - v153 += 105; - ++v104; - } - while ( v104 < 8 ); - return; - } - dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - break; - case 94: //character inventory - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - v79 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" - - all_text_height = 0; - for(int i=0;i<3;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v83 = pDialogueWindow; - v152 = (174 - all_text_height) / 3; - v84 = pDialogueWindow->pStartingPosActiveItem; - v85 = v84 + pDialogueWindow->pNumPresenceButton; - v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v84, v85) ) - { - v153 = 2; - do - { - v87 = v83->GetControl((unsigned int)_this); - v88 = v87; - v87->uY = v152 + v86; - v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); - v90 = v88->uY; - v91 = v153; - v88->uHeight = v89; - v86 = v90 + v89 - 1; - v88->uW = v86; - v92 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) - v92 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); - v83 = pDialogueWindow; - ++v153; - ++v79; - _this = (Player *)((char *)_this + 1); - } - while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; - } - break; - case 95: //buy spesial - { - - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - - v11 = 0; - v61 = 0; - v153 = 0; - do - { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) - { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) - { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v66 = v153 + v67 + 80220; - } - else - { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v66 = v152 + v153 + 640 * v63; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); - } - v153 += 105; - ++v61; - } - while ( v61 < 8 ); - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v68 = 0; - v149 = 0; - - do - { - // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) - ++v149; - ++v68; - } - while ( v68 < 6 ); - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - Str = (char *)v70; - if ( v69 == 0 || (char *)v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185]; - } - DrawTextAtStatusBar(v71, 0); - if ( (char *)v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - - if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - else - selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; - if ( v69 == 0 || Str == 0 ) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; - } - - break; - case 96: //skills - { - - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v152 = 0; - v37 = pDialogueWindow; - //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); - if ( (signed int)_this < v38 / 3 ) - _this = (Player *)(v38 / 3); - v39 = v37->pStartingPosActiveItem; - v40 = v37->pNumPresenceButton; - v153 = 0; - if ( (signed int)v39 < (signed int)(v39 + v40) ) - { - do - { - v41 = v37->GetControl(v39)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) - { - v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); - v152 += v42; - ++v153; - } - ++v39; - } - while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); - if ( v153 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - _this = (Player *)((149 - v152) / v153); - if ( (149 - v152) / v153 > 32 ) - _this = (Player *)32; - v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; - v152 = v37->pStartingPosActiveItem; - v146 = v43; - if ( v152 < v152 + v37->pNumPresenceButton ) - { - v153 = 2; - do - { - v44 = v37->GetControl(v152); - v45 = v44; - v46 = v44->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) - { - v45->uW = 0; - v45->uHeight = 0; - v45->uY = 0; - } - else - { - v47 = pSkillNames[v46]; - v45->uY = (unsigned int)((char *)_this + v146); - Str = v47; - v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0); - v49 = v45->uY; - v50 = v153; - v45->uHeight = v48; - v51 = v49 + v48 - 1; - v45->uW = v51; - v146 = v51; - v52 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) - v52 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); - } - v53 = v37->pStartingPosActiveItem; - ++v152; - textureH = v37->pNumPresenceButton + v53; - ++v153; - } - while ( v152 < textureH ); - } - return; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3); - return; - } - break; - - } - - } //----- (004BB756) -------------------------------------------------------- signed int __fastcall sub_4BB756(signed int a1)