Mercurial > mm7
diff mm7_4.cpp @ 631:3d03a3a674bc
Merge
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 03:38:59 +0200 |
parents | 1b813023fcbd 59713bb36033 |
children | 35ce4761382c |
line wrap: on
line diff
--- a/mm7_4.cpp Mon Mar 11 03:37:48 2013 +0200 +++ b/mm7_4.cpp Mon Mar 11 03:38:59 2013 +0200 @@ -53,6 +53,7 @@ #include "stru159.h" #include "texts.h" #include "Log.h" +#include "UIHouses.h" #include "mm7_data.h" @@ -9242,16 +9243,7 @@ } } -//----- (004B1E92) -------------------------------------------------------- -void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) -{ - //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) - if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) - pAudioPlayer->PlaySound( - //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), - (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300), - 806, 0, -1, 0, 0, 0, 0); -} + //----- (004B1ECE) -------------------------------------------------------- void __cdecl sub_4B1ECE() @@ -10817,1120 +10809,6 @@ return 1000 * v1; } -//----- (004B4710) -------------------------------------------------------- -int __cdecl TrainingDialog() -{ - Player *v0; // ebx@1 - int color2; // eax@1 - unsigned int v2; // ecx@1 - int v3; // eax@1 - signed int v4; // edx@1 - int v5; // edi@3 - unsigned int v6; // esi@3 - void *v7; // ecx@3 - int v8; // edx@4 - double v9; // st7@6 - signed int v10; // esi@6 - int v11; // ecx@6 - int result; // eax@9 - GUIWindow *v13; // edi@14 - signed int v14; // esi@14 - unsigned int v15; // esi@16 - int v16; // eax@16 - unsigned int v17; // eax@17 - int v18; // eax@19 - int v19; // ecx@24 - GUIButton *v20; // eax@26 - GUIButton *v21; // esi@26 - int v22; // eax@26 - const char *v23; // eax@28 - int v24; // eax@28 - unsigned int v25; // ecx@28 - int v26; // eax@28 - unsigned __int16 v27; // ax@28 - int v28; // eax@32 - unsigned __int16 v29; // ST14_2@34 - int v30; // eax@34 - const char *v31; // ST18_4@36 - unsigned __int16 v32; // ST14_2@36 - int v33; // eax@36 - int v34; // eax@37 - unsigned int v35; // edi@38 - unsigned int v36; // eax@38 - int v37; // ecx@41 - char *v38; // eax@41 - int *v39; // eax@45 - unsigned int v40; // eax@46 - void *v41; // ecx@46 - unsigned int v42; // eax@46 - GUIWindow *v43; // ecx@59 - int v44; // edx@59 - char **v45; // esi@60 - int v46; // eax@62 - int v47; // eax@68 - int v48; // edx@69 - int v49; // ebx@69 - unsigned __int8 v50; // sf@69 - char **v51; // edi@70 - GUIButton *v52; // eax@71 - GUIButton *v53; // esi@71 - int v54; // eax@71 - unsigned int v55; // ecx@71 - int v56; // eax@71 - unsigned __int16 v57; // ax@71 - unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 - const char *v59; // [sp-Ch] [bp-90h]@63 - char *v60; // [sp-8h] [bp-8Ch]@38 - char *v61; // [sp-8h] [bp-8Ch]@63 - unsigned int v62; // [sp-4h] [bp-88h]@38 - int v63; // [sp-4h] [bp-88h]@52 - char *v64; // [sp-4h] [bp-88h]@63 - GUIWindow v65; // [sp+Ch] [bp-78h]@1 - __int64 v66; // [sp+60h] [bp-24h]@3 - unsigned int white; // [sp+68h] [bp-1Ch]@1 - int v68; // [sp+6Ch] [bp-18h]@3 - int v69; // [sp+70h] [bp-14h]@6 - unsigned int i; // [sp+74h] [bp-10h]@1 - int v71; // [sp+78h] [bp-Ch]@1 - int v72; // [sp+7Ch] [bp-8h]@16 - int v73; // [sp+80h] [bp-4h]@14 - - v0 = pPlayers[uActiveCharacter]; - memcpy(&v65, window_SpeakInHouse, sizeof(v65)); - v65.uFrameX = 483; - v65.uFrameWidth = 148; - v65.uFrameZ = 334; - white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - v2 = v0->uLevel; - v71 = color2; - v3 = 0; - v4 = 0; - for ( i = v2; v4 < (signed int)v2; ++v4 ) - v3 += v4 + 1; - v5 = 1000 * v3; - v6 = HIDWORD(v0->uExperience); - v7 = window_SpeakInHouse->ptr_1C; - v68 = (unsigned __int16)word_4F0866[(signed int)v7]; - v66 = 1000 * v3; - if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 ) - { - v8 = v0->classType % 4 + 1; - if ( v8 == 4 ) - v8 = 3; - v9 = (double)(signed int)i; - i = 0; - v69 = v8; - //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); - v10 = (signed __int64)(v9 * p2DEvents[(signed int)v7 - 1].fPriceMultiplier * (double)v8); - v11 = v10 * (100 - v0->GetMerchant()) / 100; - if ( v11 < v10 / 3 ) - v11 = v10 / 3; - i = v11; - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - if ( dialog_menu_id != 1 ) - { - if ( dialog_menu_id != 17 ) - { - result = dialog_menu_id - 96; - if ( dialog_menu_id == 96 ) - { - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - i = 0; - v13 = pDialogueWindow; - //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v73 = v14 * (100 - v0->GetMerchant()) / 100; - if ( v73 < v14 / 3 ) - v73 = v14 / 3; - v15 = v13->pStartingPosActiveItem; - v16 = v13->pNumPresenceButton; - v72 = 0; - if ( (signed int)v15 >= (signed int)(v15 + v16) ) - goto LABEL_76; - do - { - v17 = v13->GetControl(v15)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] ) - { - v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); - i += v18; - ++v72; - } - ++v15; - } - while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem ); - if ( v72 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" - v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v73 = (signed int)(149 - i) / v72; - if ( v73 > 32 ) - v73 = 32; - result = v13->pStartingPosActiveItem; - v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162; - i = result; - v68 = v19; - if ( result < result + v13->pNumPresenceButton ) - { - v72 = 2; - do - { - v20 = v13->GetControl(i); - v21 = v20; - v22 = v20->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] ) - { - v21->uW = 0; - v21->uHeight = 0; - v21->uY = 0; - } - else - { - v23 = pSkillNames[v22]; - v21->uY = v73 + v68; - HIDWORD(v66) = (int)v23; - v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0); - v25 = v21->uY; - v21->uHeight = v24; - v26 = v25 + v24 - 1; - v21->uW = v26; - v68 = v26; - v27 = v71; - if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) - v27 = white; - v65.DrawTitleText(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u); - } - v28 = v13->pStartingPosActiveItem; - ++i; - result = v13->pNumPresenceButton + v28; - ++v72; - } - while ( (signed int)i < result ); - } - } - else - { -LABEL_76: - 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." - v29 = v71; - v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0); - result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); - } - } - } - return result; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v31 = pNPCTopics[122].pText; - v32 = v71; - v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); - v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); - result = (int)pDialogueWindow; - pDialogueWindow->pNumPresenceButton = 0; - return result; - } - v34 = v0->uLevel; - if ( v34 < v68 ) - { - if ( (signed __int64)v0->uExperience >= v66 ) - { - if ( pParty->uNumGold >= i ) - { - Party::TakeGold(i); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - ++v0->uLevel; - v0->uSkillPoints += v0->uLevel / 10 + 5; - v0->sHealth = v0->GetMaxHealth(); - v0->sMana = v0->GetMaxMana(); - v37 = 0; - v38 = byte_F8B148; - do - { - if ( *(int *)v38 > v37 ) - v37 = *(int *)v38; - v38 += 4; - } - while ( (signed int)v38 < (signed int)word_F8B158 ); - v39 = &dword_F8B144 + uActiveCharacter; - ++*v39; - if ( *v39 > v37 ) - { - v40 = sub_494820(pParty->uCurrentHour); - v41 = window_SpeakInHouse->ptr_1C; - v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; - if ( v41 == (void *)94 || v41 == (void *)95 ) - v42 += 720; - RestAndHeal((signed int)(v42 + 10080)); - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoor->SetFog(); - } - v0->PlaySound(SPEECH_87, 0); - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// - // "%s is now Level %lu and has earned %lu Skill Points!" - ShowStatusBarString(pTmpBuf, 2u); - goto LABEL_56; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" - v63 = 4; -LABEL_55: - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); -LABEL_56: - /*result = pMessageQueue_50CBD0->uNumMessages; - if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; - *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - } - return result;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return 1; // void function actually - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// - // "You need %d more experience to train to level %d" - v35 = 0; - v62 = 3; - v60 = pTmpBuf; - v58 = v71; - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88; - } - else - { - sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// - // ""With your skills, you should be working here as a teacher."" - // ""Sorry, but we are unable to train you."" - v35 = 0; - v62 = 3; - v60 = pTmpBuf; - v58 = v71; - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101; - } - v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); - v63 = 3; - goto LABEL_55; - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v43 = pDialogueWindow; - v72 = 0; - pShopOptions[0] = pTmpBuf; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v44 = pDialogueWindow->pNumPresenceButton; - v73 = pDialogueWindow->pStartingPosActiveItem; - if ( v73 < v73 + v44 ) - { - v45 = pShopOptions; - do - { - if ( v43->GetControl(v73)->uControlParam == 17 ) - { - v46 = v0->uLevel; - if ( v46 < v68 ) - { - if ( (signed __int64)v0->uExperience < v66 ) - { - v64 = (char *)(v46 + 1); - v61 = (char *)(v5 - LODWORD(v0->uExperience)); - v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d" - } - else - { - v64 = (char *)i; - v61 = (char *)(v46 + 1); - v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold" - } - } - else - { - v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you."" - v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher."" - v59 = "%s\n \n%s"; - } - sprintf(*v45, v59, v61, v64); - } - v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); - v43 = pDialogueWindow; - v72 += v47; - ++v45; - ++v73; - } - while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - HIDWORD(v66) = (174 - v72) / 2; - result = v43->pStartingPosActiveItem; - v48 = result + v43->pNumPresenceButton; - v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; - v50 = -v43->pNumPresenceButton < 0; - v73 = v43->pStartingPosActiveItem; - if ( v50 ^ __OFSUB__(result, v48) ) - { - i = 2; - v51 = pShopOptions; - do - { - v52 = v43->GetControl(v73); - v53 = v52; - v52->uY = HIDWORD(v66) + v49; - v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0); - v55 = v53->uY; - v53->uHeight = v54; - v56 = v54 + v55 - 1; - v53->uW = v56; - v49 = v56; - v57 = v71; - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - v57 = white; - v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); - v43 = pDialogueWindow; - ++i; - ++v51; - ++v73; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v73 < result ); - } - } - } - return result; -} - - - - - - - - - -//----- (004B4FCF) -------------------------------------------------------- -void MagicShopDialog() - { - Player *v0; // ebx@1 - int result; // eax@6 - signed int v2; // esi@8 - unsigned int v3; // ebx@10 - char *v4; // eax@11 - char *v5; // eax@12 - unsigned int v6; // eax@12 - int v7; // ST08_4@14 - int v8; // eax@14 - unsigned __int8 v9; // dl@14 - char *v10; // ecx@14 - signed int v11; // esi@16 - int v12; // ST08_4@19 - int v13; // eax@19 - int all_text_height; // edi@21 - char **v15; // esi@21 - int v16; // eax@22 - GUIWindow *v17; // ecx@23 - int v18; // edx@23 - int v19; // edi@23 - unsigned __int8 v20; // sf@23 - GUIButton *control_button; // esi@25 - const char **v22; // eax@25 - int v23; // eax@25 - unsigned int v24; // ecx@25 - const char **v25; // edx@25 - unsigned __int16 text_color; // ax@25 - signed int v27; // esi@30 - int v28; // ST08_4@34 - int v29; // eax@34 - char *v30; // edx@35 - GUIWindow *v31; // edi@40 - void *v32; // eax@40 - signed int v33; // esi@40 - unsigned int v34; // esi@42 - int v35; // eax@42 - unsigned int v36; // eax@43 - int v37; // eax@45 - int v38; // ecx@50 - GUIButton *v39; // eax@52 - GUIButton *v40; // esi@52 - int v41; // eax@52 - char *v42; // eax@54 - int v43; // eax@54 - unsigned int v44; // ecx@54 - int v45; // edx@54 - int v46; // eax@54 - unsigned __int16 v47; // ax@54 - int v48; // eax@58 - signed int v49; // esi@62 - Texture *v50; // ecx@64 - unsigned int v51; // edi@64 - unsigned int v52; // esi@66 - int v53; // edx@70 - Texture *v54; // ecx@76 - unsigned int v55; // edi@76 - unsigned int v56; // esi@76 - int v57; // edx@80 - Texture *v58; // ecx@86 - unsigned int v59; // edi@86 - unsigned int v60; // esi@88 - int v61; // edx@92 - Texture *v62; // ecx@98 - unsigned int v63; // edi@98 - unsigned int v64; // esi@100 - int v65; // edx@104 - signed int v66; // ecx@109 - SHORT v67; // di@117 - bool v68; // eax@117 - const char *v69; // ecx@119 - POINT *v70; // esi@124 - int v71; // ecx@125 - int v72; // eax@125 - int v73; // ecx@125 - ItemGen *v74; // esi@125 - int v75; // eax@130 - int v76; // esi@131 - char **v77; // edi@131 - int v78; // eax@132 - GUIWindow *v79; // ecx@133 - int v80; // edx@133 - int v81; // edi@133 - GUIButton *v82; // esi@135 - const char **v83; // eax@135 - int v84; // eax@135 - unsigned int v85; // ecx@135 - int v86; // edx@135 - unsigned __int16 v87; // ax@135 - GUIWindow *v88; // [sp-18h] [bp-110h]@35 - int v89; // [sp-14h] [bp-10Ch]@35 - ItemGen *v90; // [sp-10h] [bp-108h]@14 - int v91; // [sp-10h] [bp-108h]@35 - unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 - void *v93; // [sp-Ch] [bp-104h]@14 - int v94; // [sp-8h] [bp-100h]@11 - char *v95; // [sp-8h] [bp-100h]@12 - __int64 *v96; // [sp-4h] [bp-FCh]@11 - unsigned int v97; // [sp-4h] [bp-FCh]@12 - POINT v98; // [sp+Ch] [bp-ECh]@8 - POINT v99; // [sp+14h] [bp-E4h]@16 - POINT v100; // [sp+1Ch] [bp-DCh]@124 - POINT v101; // [sp+24h] [bp-D4h]@17 - POINT v102; // [sp+2Ch] [bp-CCh]@124 - POINT v103; // [sp+34h] [bp-C4h]@9 - POINT v104; // [sp+3Ch] [bp-BCh]@31 - POINT v105; // [sp+44h] [bp-B4h]@16 - POINT v106; // [sp+4Ch] [bp-ACh]@30 - POINT v107; // [sp+54h] [bp-A4h]@16 - POINT v108; // [sp+5Ch] [bp-9Ch]@30 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v110; // [sp+6Ch] [bp-8Ch]@30 - POINT v111; // [sp+74h] [bp-84h]@8 - GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@54 - int v146; // [sp+D4h] [bp-24h]@23 - unsigned int hilight_color; // [sp+D8h] [bp-20h]@1 - unsigned int m_text_color; // [sp+DCh] [bp-1Ch]@1 - __int32 v117; // [sp+E0h] [bp-18h]@8 - int v118; // [sp+E4h] [bp-14h]@40 - const char **v119; // [sp+E8h] [bp-10h]@24 - Player *_this; // [sp+ECh] [bp-Ch]@1 - unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 - int v152; // [sp+F4h] [bp-4h]@23 - int v122; - int v114; - - 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); - if ( dialog_menu_id > 5 ) - { - if ( dialog_menu_id == 94 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" - v76 = 0; - v77 = pShopOptions; - do - { - v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0); - ++v77; - v76 += v78; - } - while ( (signed int)v77 < (signed int)&pShopOptions[3] ); - v79 = pDialogueWindow; - _this = (Player *)((174 - v76) / 3); - result = pDialogueWindow->pStartingPosActiveItem; - v80 = result + pDialogueWindow->pNumPresenceButton; - v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v118 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__(result, v80) ) - { - v122 = 2; - v119 = (const char **)pShopOptions; - do - { - v82 = v79->GetControl(v118); - v83 = v119; - v82->uY = (unsigned int)((char *)_this + v81); - v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0); - v85 = v82->uY; - v86 = v122; - v82->uHeight = v84; - v81 = v84 + v85 - 1; - v82->uW = v81; - v87 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v86 ) - v87 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u); - v79 = pDialogueWindow; - ++v122; - ++v119; - ++v118; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v118 < result ); - } - return; - } - if ( dialog_menu_id != 95 ) - { - result = dialog_menu_id - 96; - if ( dialog_menu_id == 96 ) - { - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v31 = pDialogueWindow; - v3 = 0; - v32 = window_SpeakInHouse->ptr_1C; - v118 = 0; - //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); - v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); - v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100); - if ( (signed int)v119 < v33 / 3 ) - v119 = (const char **)(v33 / 3); - v34 = v31->pStartingPosActiveItem; - v35 = v34 + v31->pNumPresenceButton; - v122 = 0; - if ( (signed int)v34 >= v35 ) - goto LABEL_140; - do - { - v36 = v31->GetControl(v34)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] ) - { - v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); - v118 += v37; - ++v122; - } - ++v34; - } - while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); - if ( !v122 ) - { -LABEL_140: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v30 = pTmpBuf; - v97 = 3; - v95 = pTmpBuf; - v92 = hilight_color; - v91 = 0; - v89 = 0; - v88 = &dialog_window; - goto LABEL_61; - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v119 = (const char **)((149 - v118) / v122); - if ( (149 - v118) / v122 > 32 ) - v119 = (const char **)32; - result = v31->pStartingPosActiveItem; - v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162; - v118 = result; - v114 = v38; - if ( result < result + v31->pNumPresenceButton ) - { - v122 = 2; - do - { - v39 = v31->GetControl(v118); - v40 = v39; - v41 = v39->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] ) - { - v40->uW = 0; - v40->uHeight = 0; - v40->uY = 0; - } - else - { - v42 = pSkillNames[v41]; - v40->uY = (unsigned int)((char *)v119 + v114); - Str = v42; - v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0); - v44 = v40->uY; - v45 = v122; - v40->uHeight = v43; - v46 = v44 + v43 - 1; - v40->uW = v46; - v114 = v46; - v47 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v45 ) - v47 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u); - } - v48 = v31->pStartingPosActiveItem; - ++v118; - result = v31->pNumPresenceButton + v48; - ++v122; - } - while ( v118 < result ); - } - } - } - return; - } - } - else - { - if ( dialog_menu_id == 5 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( !result - || (v27 = pMouse->GetCursorPos(&v110)->x - 14, - v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v106), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) - || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) - return; - v96 = 0; - v94 = 5; - v93 = window_SpeakInHouse->ptr_1C; - v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5]; - v28 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); - v9 = uPlayerID; - v10 = (char *)pMerchantsRepairPhrases[v29]; - goto LABEL_35; - } - if ( dialog_menu_id == 1 ) - { - /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory" - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v114 = (174 - v14) / 4; - result = pDialogueWindow->pStartingPosActiveItem; - v18 = result + pDialogueWindow->pNumPresenceButton; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v122 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__(result, v18) ) - { - v119 = (const char **)2; - _this = (Player *)pShopOptions; - do - { - v21 = v17->GetControl(v122); - v22 = (const char **)_this; - v21->uY = v114 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0); - v24 = v21->uY; - v25 = v119; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = color2; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = m_text_color; - dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); - v17 = pDialogueWindow; - v119 = (const char **)((char *)v119 + 1); - _this = (Player *)((char *)_this + 4); - ++v122; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v122 < result ); - } - }*/ - 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 ) - { - int 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; - } - } - - - return; - } - if ( dialog_menu_id != 2 ) - { - if ( dialog_menu_id != 3 ) - { - result = dialog_menu_id - 4; - if ( dialog_menu_id == 4 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); - result = (int)pMouse->GetCursorPos(&v111); - if ( *(int *)result > 13 ) - { - result = (int)pMouse->GetCursorPos(&v103); - if ( *(int *)result < 462 ) - { - result = v0->GetItemIDAtInventoryIndex((int *)&v117); - v3 = 0; - if ( result ) - { - v96 = 0; - v94 = 4; - v4 = (char *)&_this->pInventoryItems[result-1]; - if ( v4[20] & 1 ) - { - v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v97 = 3; - v95 = v5; - v92 = m_text_color; - v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; - - dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); - return; - } - v93 = window_SpeakInHouse->ptr_1C; - v90 = (ItemGen *)v4; - v7 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); - v9 = uPlayerID; - v10 = (char *)pMerchantsIdentifyPhrases[v8]; - goto LABEL_35; - } - } - } - } - } - return; - } - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( !result - || (v11 = pMouse->GetCursorPos(&v107)->x - 14, - v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v105), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) - return; - v96 = 0; - v94 = 3; - v93 = window_SpeakInHouse->ptr_1C; - v90 = (ItemGen *)&_this->pInventoryItems[result-1]; - v12 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v13 = _this->_490EEE(v90, 3, v12, 3); - v9 = uPlayerID; - v10 = (char *)pMerchantsSellPhrases[v13]; -LABEL_35: - v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); - v97 = 3; - v95 = v30; - v92 = m_text_color; - v91 = v3; - v89 = v3; - v88 = &dialog_window; -LABEL_61: - v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); - return; - } - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v49 = 0; - v122 = 0; - if ( dialog_menu_id == 2 ) - { - do - { - // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); - { - v50 = ItemsInShopTexture[v49]; - v51 = 152 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v53 = ItemsInShopTexture[5]->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[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); - { - v54 = ItemsInShopTexture[v122 + 6]; - v55 = 306 - v54->uTextureHeight; - v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v57 = ItemsInShopTexture[11]->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[v122 + 6], v122 + 7); - } - ++v122; - } - while ( v122 < 6 ); - } - else - { - do - { - // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) - { - v58 = ItemsInShopTexture[v49]; - v59 = 152 - v58->uTextureHeight; - if ( (signed int)v59 < 1 ) - v59 = 0; - v60 = 75 * v49 - v58->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v61 = ItemsInShopTexture[5]->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[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) - { - v62 = ItemsInShopTexture[v122 + 6]; - v63 = 306 - v62->uTextureHeight; - if ( (signed int)v63 < 1 ) - v63 = 0; - v64 = 75 * v122 - v62->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v65 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v64 > 457 - v65 ) - v64 = 457 - v65; - } - } - else - { - if ( (signed int)v64 < 18 ) - v64 = 18; - } - pRenderer->DrawTextureTransparent(v64, v63, v62); - sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); - } - ++v122; - } - while ( v122 < 6 ); - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v66 = 0; - v117 = 0; - if ( dialog_menu_id == 2 ) - { - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - else - { - do - { - //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - v67 = GetAsyncKeyState(VK_CONTROL); - v68 = _this->CanSteal(); - Str = (char *)v68; - if ( v67 && v68 ) - { - v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" - } - else - { - v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dialog_menu_id != 2 ) - v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" - } - DrawTextAtStatusBar(v69, 0); - if ( !v117 ) - { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - return; - } - v70 = pMouse->GetCursorPos(&v102); - result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; - v117 = v71; - v72 = (int)window_SpeakInHouse->ptr_1C; - // v73 = 9 * (v71 + 12 * v72); - v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; - if ( dialog_menu_id != 2 ) - // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; - v74 =&pParty->SpecialItemsInShops[v72][v71]; - if ( v67 && Str ) - { - v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" - v96 = 0; - v94 = 2; - v93 = window_SpeakInHouse->ptr_1C; - v90 = v74; - v9 = uActiveCharacter - 1; - } - else - { - v96 = 0; - v94 = 2; - v93 = window_SpeakInHouse->ptr_1C; - v90 = v74; - uPlayerID = uActiveCharacter - 1; - v75 = _this->_490EEE(v74, 3, v72, 2); - v9 = uPlayerID; - v10 = (char *)pMerchantsBuyPhrases[v75]; - } - goto LABEL_35; - } - } - return; -} //----- (004BC49B) -------------------------------------------------------- void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) @@ -12225,713 +11103,6 @@ -//----- (004B5D7C) -------------------------------------------------------- -void GuildDialog() -{ - GUIWindow *v0; // ebx@1 - Player *currPlayer; // edi@1 - signed int base_teach_price; // ebx@1 - int v3; // edi@6 - int result; // eax@11 - unsigned int v5; // ebx@13 - int v6; // esi@13 - signed int v7; // esi@17 - int v8; // esi@22 - signed int v9; // ecx@22 - char *v10; // eax@22 - const char *statusbar_string; // ecx@26 - POINT *v12; // esi@30 - int v13; // ecx@30 - void *v14; // ST1C_4@31 - ItemGen *v15; // ST18_4@31 - int v16; // ST10_4@31 - int v17; // eax@31 - char *v18; // edx@31 - int v19; // eax@32 - GUIWindow *v20; // edi@35 - int v21; // esi@35 - int v22; // eax@35 - unsigned int v23; // eax@36 - int v24; // eax@39 - int v25; // eax@40 - int v26; // ecx@47 - GUIButton *v27; // eax@49 - GUIButton *v28; // esi@49 - unsigned int v29; // eax@49 - char *v30; // eax@52 - int v31; // eax@55 - unsigned int v32; // ecx@55 - int v33; // eax@55 - unsigned __int16 v34; // ax@55 - int v35; // eax@58 - const char *v36; // ST20_4@61 - unsigned __int16 v37; // ST1C_2@61 - int v38; // eax@61 - GUIWindow *v39; // [sp-18h] [bp-304h]@31 - int v40; // [sp-14h] [bp-300h]@31 - int v41; // [sp-10h] [bp-2FCh]@31 - unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 - char *v43; // [sp-8h] [bp-2F4h]@31 - unsigned int v44; // [sp-4h] [bp-2F0h]@31 - char Dest[100]; // [sp+Ch] [bp-2E0h]@3 - char v46[100]; // [sp+70h] [bp-27Ch]@3 - char v47[100]; // [sp+D4h] [bp-218h]@3 - char v48[100]; // [sp+138h] [bp-1B4h]@3 - char v49[100]; // [sp+19Ch] [bp-150h]@3 - POINT v50; // [sp+264h] [bp-88h]@30 - POINT v51; // [sp+26Ch] [bp-80h]@30 - GUIWindow working_window; // [sp+274h] [bp-78h]@1 - signed int v53; // [sp+27Ch] [bp-70h]@1 - signed int v54; // [sp+284h] [bp-68h]@1 - int v55; // [sp+2C8h] [bp-24h]@47 - int main_text_color; // [sp+2CCh] [bp-20h]@1 - int hi_text_color; // [sp+2D0h] [bp-1Ch]@1 - Player *v58; // [sp+2D4h] [bp-18h]@1 - unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 - char *Str; // [sp+2DCh] [bp-10h]@35 - int v61; // [sp+2E0h] [bp-Ch]@35 - unsigned int v62; // [sp+2E4h] [bp-8h]@13 - int v63; // [sp+2E8h] [bp-4h]@1 - - v0 = window_SpeakInHouse; - memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); - v58 = pPlayers[uActiveCharacter]; - currPlayer = v58; - working_window.uFrameX = 483; - working_window.uFrameWidth = 148; - working_window.uFrameZ = 334; - main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); - base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0); - v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100; - if ( v63 < base_teach_price / 3 ) - v63 = base_teach_price / 3; - strcpy(Dest, ""); - strcpy(v46, ""); - strcpy(v47, ""); - strcpy(v48, ""); - strcpy(v49, ""); - if ( dialog_menu_id != 1 ) - { - if ( dialog_menu_id != 18 ) //buy skill - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill - if ( v58->pActiveSkills[dialog_menu_id-36] ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf, 2u); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - } - else - { - if ( pParty->uNumGold < v63 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - } - else - { - Party::TakeGold(v63); - v58->pActiveSkills[dialog_menu_id-36] = 1; - } - } - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v5 = 0; - v6 = 0; - v62 = 0; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) - // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) - - { - pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); - currPlayer = v58; - } - v63 += 70; - v62 += 280; - ++v6; - } - while ( v63 < 452 ); - - v62 = 1680; - v7 = 6; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) - // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) - { - pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); - currPlayer = v58; - } - v63 += 70; - v62 += 280; - ++v7; - } - while ( v63 < 452 ); - - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v8 = 0; - v9 = 12; - // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); - // v10 = - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) - ++v8; - // v10 += 36; - --v9; - } - while ( v9 ); - - GetAsyncKeyState(17); - statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - if ( dialog_menu_id != 2 ) - statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" - DrawTextAtStatusBar(statusbar_string, 0); - if ( !v8 ) - { - working_window.DrawCurrentTime( - __PAIR__( - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - - pParty->uTimePlayed); - return; - } - v12 = pMouse->GetCursorPos(&v51); - result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; - v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v14 = window_SpeakInHouse->ptr_1C; - v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); - v16 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); - v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); - v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3); - return; - } - } - return; - } - if ( !(unsigned __int16)_449B57_test_bit( - (unsigned __int8 *)currPlayer->_guilds_member_bits, - guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) - { //you must me member - v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v20 = pDialogueWindow; - v5 = 0; - v62 = 0; - Str = 0; - v21 = pDialogueWindow->pStartingPosActiveItem; - v22 = v21 + pDialogueWindow->pNumPresenceButton; - v61 = 0; - if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); - return; - } - do - { - v23 = v20->GetControl(v21)->uControlParam; - if ( v23 == 18 ) - { - v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" - v62 += v25; - ++v61; - } - else - { - - if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36])) - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - { - v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0); - v62 += v24; - ++v61; - ++Str; - } - } - ++v21; - } - while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem ); - if ( !v61 ) - { -LABEL_64: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); - return; - } - if ( Str ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" - working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - } - v63 = (signed int)(149 - v62) / v61; - if ( v63 > 32 ) - v63 = 32; - v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162; - v62 = v20->pStartingPosActiveItem; - v55 = v26; - if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton ) - { - v61 = 2; - while ( 1 ) - { - v27 = v20->GetControl(v62); - v28 = v27; - v29 = v27->uControlParam; - if ( v29 == 18 ) - break; - - // __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36])) - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - - { - v30 = pClassNames[v29 -16]; -LABEL_55: - Str = v30; - v28->uY = v63 + v55; - v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0); - v32 = v28->uY; - v28->uHeight = v31; - v33 = v32 + v31 - 1; - v28->uW = v33; - v55 = v33; - v34 = hi_text_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v61 ) - v34 = main_text_color; - working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u); - v35 = v20->pStartingPosActiveItem; - ++v62; - ++v61; - if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) - return; - } - v28->uW = 0; - v28->uHeight = 0; - v28->uY = 0; -LABEL_58: - v35 = v20->pStartingPosActiveItem; - ++v62; - ++v61; - if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) - return; - } - v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" - goto LABEL_55; - } - return; -} - - - -//----- (004B705E) -------------------------------------------------------- -void TempleDialog() - { - GUIWindow *v0; // ebx@1 - Player *v1; // esi@1 - int v2; // edi@1 - int result; // eax@4 - GUIWindow *v4; // edi@6 - void *v5; // eax@6 - int v6; // eax@6 - unsigned int v7; // eax@8 - int v8; // ecx@8 - unsigned int v9; // eax@9 - int v10; // eax@11 - int v11; // eax@12 - GUIWindow *v12; // ecx@16 - int v13; // edx@16 - GUIButton *v14; // eax@19 - GUIButton *v15; // edi@19 - int v16; // eax@19 - const char *v17; // eax@21 - int v18; // eax@21 - unsigned int v19; // ecx@21 - int v20; // eax@21 - unsigned __int16 v21; // ax@21 - unsigned __int16 v22; // ST14_2@27 - int v23; // eax@27 - double v24; // st7@28 - unsigned int v25; // ebx@28 - DDM_DLV_Header *v26; // edi@29 - int v27; // eax@31 - int v28; // eax@32 - //unsigned int v29; // ecx@34 - unsigned int v30; // edx@36 - unsigned int v31; // edx@38 - unsigned int v32; // edx@40 - unsigned int v33; // edx@42 - unsigned int v34; // edx@44 - int v35; // edi@50 - signed int v36; // eax@50 - unsigned __int8 v37; // al@54 - int v38; // ecx@54 - GUIWindow *v39; // eax@56 - unsigned __int8 v40; // al@61 - GUIButton *v41; // edi@64 - int v42; // esi@66 - GUIWindow *v43; // ecx@66 - int v44; // edi@66 - int v45; // eax@68 - signed int v46; // edi@69 - int v47; // edi@71 - GUIButton *v48; // eax@73 - const char *v49; // edx@73 - GUIButton *v50; // esi@73 - int v51; // eax@73 - unsigned int v52; // ecx@73 - unsigned __int16 v53; // ax@73 - char a1[300]; // [sp+10h] [bp-1B4h]@64 - GUIWindow v57; // [sp+13Ch] [bp-88h]@1 - __int64 v58; // [sp+190h] [bp-34h]@1 - __int64 v59; // [sp+198h] [bp-2Ch]@1 - __int64 v60; // [sp+1A0h] [bp-24h]@1 - GUIWindow *v61; // [sp+1ACh] [bp-18h]@6 - unsigned int v62; // [sp+1B0h] [bp-14h]@8 - unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 - int v64; // [sp+1B8h] [bp-Ch]@6 - unsigned int v65; // [sp+1BCh] [bp-8h]@6 - DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 - - v0 = window_SpeakInHouse; - memcpy(&v57, window_SpeakInHouse, sizeof(v57)); - v57.uFrameX = 483; - v57.uFrameWidth = 148; - v57.uFrameZ = 334; - HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v1 = pPlayers[uActiveCharacter]; - //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); - v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); - HIDWORD(v60) = v2; - if ( dialog_menu_id != 1 ) - { - if ( dialog_menu_id != 10 ) - { - if ( dialog_menu_id != 11 ) - { - - if ( dialog_menu_id == 96 ) - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v4 = pDialogueWindow; - v61 = pDialogueWindow; - v5 = window_SpeakInHouse->ptr_1C; - v66 = 0; - //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); - v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); - v6 = v1->GetMerchant(); - v64 = (signed int)(v65 * (100 - v6)) / 100; - if ( v64 < (signed int)v65 / 3 ) - v64 = (signed int)v65 / 3; - v7 = v4->pStartingPosActiveItem; - v8 = v7 + v4->pNumPresenceButton; - v65 = 0; - v62 = v7; - if ( (signed int)v7 >= v8 ) - goto LABEL_78; - do - { - v9 = v4->GetControl(v62)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) - { - v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v10); - ++v65; - } - v11 = v4->pStartingPosActiveItem; - ++v62; - } - while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); - if ( v65 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); - v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v64 = (149 - (signed int)v66) / (signed int)v65; - if ( v64 > 32 ) - v64 = 32; - v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; - v12 = v61; - result = v61->pStartingPosActiveItem; - v13 = result + v61->pNumPresenceButton; - v62 = v61->pStartingPosActiveItem; - if ( result < v13 ) - { - v66 = (DDM_DLV_Header *)2; - while ( 1 ) - { - v14 = v12->GetControl(v62); - v15 = v14; - v16 = v14->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) - { - v15->uW = 0; - v15->uHeight = 0; - v15->uY = 0; - } - else - { - v17 = pSkillNames[v16]; - v15->uY = v64 + v65; - HIDWORD(v60) = (uint32)v17; - v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); - v19 = v15->uY; - v15->uHeight = v18; - v20 = v19 + v18 - 1; - v15->uW = v20; - v65 = v20; - v21 = WORD2(v59); - if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) - v21 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); - } - result = (int)v61; - ++v62; - v66 = (DDM_DLV_Header *)((char *)v66 + 1); - if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) - break; - v12 = v61; - } - } - } - else - { -LABEL_78: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v22 = WORD2(v59); - v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); - result = (int)v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); - } - } - } - return; - } - - // DONATION - //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - v25 = 0; - if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) - { - Party::TakeGold((signed __int64)v24); - v26 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v26 = &pIndoor->dlv; - v27 = v26->uReputation; - v66 = v26; - if ( v27 > -5 ) - { - v28 = v27 - 1; - v26->uReputation = v28; - if ( v28 < -5 ) - v26->uReputation = -5; - } - if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) - { - if ( v26->uReputation <= -5 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -10 ) - { - v31 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v31) = v31 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -15 ) - { - v32 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v32) = v32 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -20 ) - { - v33 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v33) = v33 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -25 ) - { - v34 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v34) = v34 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0); - } - } - ++byte_F8B1EF[uActiveCharacter]; - v1->PlaySound(SPEECH_83, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" - goto LABEL_46; - } - goto LABEL_55; - } - if ( !v1->_4B6FF9() ) - return; - v25 = 0; - if ( pParty->uNumGold < v2 ) - { -LABEL_55: - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - goto LABEL_46; - } - Party::TakeGold(v2); - v35 = LODWORD(v1->pConditions[17]); - v59 = v1->pConditions[14]; - v58 = v1->pConditions[15]; - v60 = v1->pConditions[16]; - v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]); - memset(v1, 0, 0xA0u); - v1->sHealth = v1->GetMaxHealth(); - v1->sMana = v1->GetMaxMana(); - v36 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) - { - if ( (unsigned int)v61 | v35 ) - { - v37 = LOBYTE(v1->field_1928); - v38 = v1->field_1924; - v1->uFace = v37; - v1->uVoiceID = v38; - ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); - } - goto LABEL_63; - } - v39 = v61; - if ( (unsigned int)v61 | v35 ) - { - LODWORD(v1->pConditions[17]) = v35; - } - else - { - if ( !v60 && !v58 && !v59 ) - goto LABEL_63; - v1->field_1928 = v1->uFace; - v1->field_1924 = v1->uVoiceID; - v1->SetCondition(0x11u, 1); - v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23; - v40 = (v1->GetSexByVoice() != 0) + 23; - v1->uFace = v40; - ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); - LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed); - v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); - } - HIDWORD(v1->pConditions[17]) = (int)v39; -LABEL_63: - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - v1->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); -LABEL_46: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return ; // void func - } - v63 = 1; - v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); - strcpy(a1, ""); - v41->uHeight = 0; - v41->uY = 0; - if ( v1->_4B6FF9() ) - { - sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); - v63 = 0; - } - strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); - strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]); - v42 = v63; - v43 = pDialogueWindow; - v44 = v63; - v66 = 0; - if ( v63 < pDialogueWindow->pNumPresenceButton ) - { - v61 = (GUIWindow *)&a1[100 * v63]; - do - { - v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v45); - v43 = pDialogueWindow; - v61 = (GUIWindow *)((char *)v61 + 100); - ++v44; - } - while ( v44 < pDialogueWindow->pNumPresenceButton ); - } - v46 = v43->pNumPresenceButton - v42; - v64 = (174 - (signed int)v66) / v46; - if ( v64 > 32 ) - v64 = 32; - v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138; - v65 = v42 + v43->pStartingPosActiveItem; - if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton ) - { - v61 = (GUIWindow *)(v42 + 2); - v66 = (DDM_DLV_Header *)&a1[100 * v42]; - do - { - v48 = v43->GetControl(v65); - v49 = (const char *)v66; - v50 = v48; - v48->uY = v64 + v47; - v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0); - v52 = v50->uY; - v50->uHeight = v51; - v47 = v52 + v51 - 1; - v50->uW = v47; - v53 = WORD2(v59); - if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 ) - v53 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u); - v43 = pDialogueWindow; - v66 = (DDM_DLV_Header *)((char *)v66 + 100); - v61 = (GUIWindow *)((char *)v61 + 1); - ++v65; - } - while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; -} - - //----- (004B6478) -------------------------------------------------------- int __cdecl sub_4B6478() @@ -14116,284 +12287,3 @@ return result; } -//----- (0044606A) -------------------------------------------------------- -void PrepareHouse(HOUSE_ID house) -{ - //unsigned int v1; // ebx@1 - //signed int v2; // esi@1 - //int uExitPic; // edi@1 - __int16 uExitMapID; // ax@2 - //int result; // eax@5 - //unsigned int *v6; // ecx@8 - int v7; // ebx@11 - //int v8; // esi@16 - //unsigned int v9; // eax@16 - //unsigned int v10; // eax@19 - //int v11; // ecx@19 - //char pContainer[36]; // [sp+Ch] [bp-54h]@16 - int v13; // [sp+30h] [bp-30h]@11 - int Dst[6]; // [sp+34h] [bp-2Ch]@1 - //unsigned int v15; // [sp+4Ch] [bp-14h]@1 - int uAnimationID; // [sp+50h] [bp-10h]@1 - //unsigned int *v17; // [sp+54h] [bp-Ch]@3 - //unsigned int v18; // [sp+58h] [bp-8h]@1 - //int v19; // [sp+5Ch] [bp-4h]@7 - - //v15 = uHouseID; - //v1 = 52 * uHouseID; - //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; - uAnimationID = p2DEvents[house - 1].uAnimationID; - //v18 = 52 * uHouseID; - memset(Dst, 0, 0x18u); - //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); - //uExitPic = p2DEvents[uHouseID - 1].uExitPicID; - uNumDialogueNPCPortraits = 0; - uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; - if ( uHouse_ExitPic ) - { - //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); - uExitMapID = p2DEvents[house - 1]._quest_related; - if ( uExitMapID > 0 ) - { - //v17 = (unsigned int *)(uExitMapID - 1); - if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) - // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) ) - { - //uExitPic = 0; - uHouse_ExitPic = 0; - } - } - } - - dword_591080 = pAnimatedRooms[uAnimationID].field_8; - //result = dword_591080; - - //v2 = 0; - uNumDialogueNPCPortraits = 0; - if ( dword_591080 ) - { - //v2 = 1; - Dst[0] = dword_591080; - uNumDialogueNPCPortraits = 1; - } - - //v19 = 1; - for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) - { - auto npc = pNPCStats->pNewNPCData + i; - //v6 = &pNPCStats->pNewNPCData[1].uFlags; - //v17 = &pNPCStats->pNewNPCData[1].uFlags; - //do - //{ - if (npc->Location2D == house ) - { - if (~npc->uFlags & 0x80) - //if ( !(*(char *)v6 & 0x80) ) - { - v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; - HouseNPCData[v7] = npc; - //v6 = v17; - //*(&v13 + v2) = *(v17 - 1); - Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; - //v1 = v18; - if ((npc->uFlags & 3) != 2) - ++npc->uFlags; - } - } - //++v19; - //v6 += 19; - //v17 = v6; - //} - //while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); - } - //uNumDialogueNPCPortraits = v2; - - //v19 = 0; - for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) - //if ( v2 > 0 ) - { - //do - //{ - //v8 = v19; - char icon_name[128]; - sprintfex(icon_name, "npc%03u", Dst[i]); - //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - //++v19; - pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); - //result = v19; - //} - //while ( v19 < uNumDialogueNPCPortraits ); - //uExitPic = uHouse_ExitPic; - } - - if (uHouse_ExitPic) - { - //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); - //v11 = uNumDialogueNPCPortraits++; - pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); - //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); - //result = p2DEvents[house - 1].uExitMapID; - uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; - } - //return result; -} - - - -//----- (0044622E) -------------------------------------------------------- -bool EnterHouse(enum HOUSE_ID uHouseID) - { - //enum HOUSE_ID v1; // edi@1 - //int v2; // edi@5 - signed int uOpenTime; // eax@5 - signed int uCloseTime; // esi@5 - unsigned int v5; // esi@5 - int v6; // edx@5 - signed int am_pm_flag_open; // ecx@10 - signed int am_pm_flag_close; // eax@10 - int v9; // esi@10 - //unsigned int v10; // esi@16 - int v11; // ecx@17 - unsigned int v12; // kr00_4@25 - //Player *v13; // esi@25 - int v14; // eax@25 - //Player *v15; // esi@27 - //signed int v16; // eax@32 - unsigned int v17; // eax@37 - signed int v18; // edi@37 - signed int v19; // edi@41 - //unsigned int v20; // ecx@41 - //const char *v22; // [sp-4h] [bp-40h]@33 - char pContainer[40]; // [sp+Ch] [bp-30h]@32 - unsigned int v24; // [sp+34h] [bp-8h]@5 - //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1 - - //v1 = uHouseID; - //v25 = uHouseID; - GameUI_StatusBar_TimedString[0] = 0; - pStatusBarString[0] = 0; - ShowStatusBarString("", 2u); - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - viewparams->bRedrawGameUI = 1; - uDialogueType = 0; - pKeyActionMap->_459ED1(3); - pKeyActionMap->ResetKeys(); - if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) - { - GameOverMenu(0); - return 0; - } - uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; - uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; - ptr_F8B1E8 = 0; - dword_F8B1E4 = 0; - dword_F8B1F4 = 0; - memset(byte_F8B1F0, 0, 4); - memset(byte_F8B148, 0, 16); - pRenderer->ClearZBuffer(0, 479); - - if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| - ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) - - { - am_pm_flag_open = 0; - am_pm_flag_close = 0; - if (uOpenTime > 12 ) - { - uOpenTime -= 12; - am_pm_flag_open = 1; - } - if ( uCloseTime > 12 ) - { - uCloseTime -= 12; - am_pm_flag_close = 1; - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], - uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" - ShowStatusBarString(pTmpBuf, 2u); - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); - return 0; - } - else - { - //v10 = uHouseID; - if ( (signed int)uHouseID < 53 ) //entering shops and guilds - { - if ( !(pParty->field_3C._shop_ban_times[uHouseID]) - || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) - { - pParty->field_3C._shop_ban_times[uHouseID] = 0; - } - else - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" - return 0; - } - } - if ( !start_event_seq_number ) - pAudioPlayer->StopChannels(-1, -1); - - uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; - in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; - if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail - { - uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; - uHouseID = HOUSE_JAIL; - pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000; - in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType; - ++pParty->uNumPrisonTerms; - pParty->uFine = 0; - for (uint i = 0; i < 4; ++i) - { - pParty->pPlayers[i].uTimeToRecovery = 0; - pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; - pParty->pPlayers[i].SetVariable(VAR_Award, 87); - } - } - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; - default: assert(false); - } - - v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - pDialogueNPCCount = 0; - pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; - uTextureID_507B04 = uTextureID_right_panel; - PrepareHouse(uHouseID); - v18 = 1; - uTextureID_507B04 = uTextureID_right_panel; - if ( uNumDialogueNPCPortraits == 1 ) - pDialogueNPCCount = 1; - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); - dword_5C35D4 = 1; - if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) - { - if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) - { - return 1; - } - } - else - { //guilds - v19 = guild_mambership_flags[uHouseID-139]; //guilds flags - //v20 = uHouseID; - //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) - if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19)) - { - HousePlaySomeSound(uHouseID, 3); - return 1; - } - } - HousePlaySomeSound(uHouseID, 1); - dword_5C35D4 = 1; - return 1; - } - }