Mercurial > mm7
comparison mm7_4.cpp @ 631:3d03a3a674bc
Merge
author | Nomad |
---|---|
date | Mon, 11 Mar 2013 03:38:59 +0200 |
parents | 1b813023fcbd 59713bb36033 |
children | 35ce4761382c |
comparison
equal
deleted
inserted
replaced
630:1b813023fcbd | 631:3d03a3a674bc |
---|---|
51 #include "stru351.h" | 51 #include "stru351.h" |
52 #include "Events2D.h" | 52 #include "Events2D.h" |
53 #include "stru159.h" | 53 #include "stru159.h" |
54 #include "texts.h" | 54 #include "texts.h" |
55 #include "Log.h" | 55 #include "Log.h" |
56 #include "UIHouses.h" | |
56 | 57 |
57 #include "mm7_data.h" | 58 #include "mm7_data.h" |
58 | 59 |
59 | 60 |
60 | 61 |
9240 } | 9241 } |
9241 } | 9242 } |
9242 } | 9243 } |
9243 } | 9244 } |
9244 | 9245 |
9245 //----- (004B1E92) -------------------------------------------------------- | 9246 |
9246 void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) | |
9247 { | |
9248 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) | |
9249 if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) | |
9250 pAudioPlayer->PlaySound( | |
9251 //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), | |
9252 (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300), | |
9253 806, 0, -1, 0, 0, 0, 0); | |
9254 } | |
9255 | 9247 |
9256 //----- (004B1ECE) -------------------------------------------------------- | 9248 //----- (004B1ECE) -------------------------------------------------------- |
9257 void __cdecl sub_4B1ECE() | 9249 void __cdecl sub_4B1ECE() |
9258 { | 9250 { |
9259 __int16 *v0; // edi@1 | 9251 __int16 *v0; // edi@1 |
10815 for ( i = 0; i < a1; ++i ) | 10807 for ( i = 0; i < a1; ++i ) |
10816 v1 += i + 1; | 10808 v1 += i + 1; |
10817 return 1000 * v1; | 10809 return 1000 * v1; |
10818 } | 10810 } |
10819 | 10811 |
10820 //----- (004B4710) -------------------------------------------------------- | |
10821 int __cdecl TrainingDialog() | |
10822 { | |
10823 Player *v0; // ebx@1 | |
10824 int color2; // eax@1 | |
10825 unsigned int v2; // ecx@1 | |
10826 int v3; // eax@1 | |
10827 signed int v4; // edx@1 | |
10828 int v5; // edi@3 | |
10829 unsigned int v6; // esi@3 | |
10830 void *v7; // ecx@3 | |
10831 int v8; // edx@4 | |
10832 double v9; // st7@6 | |
10833 signed int v10; // esi@6 | |
10834 int v11; // ecx@6 | |
10835 int result; // eax@9 | |
10836 GUIWindow *v13; // edi@14 | |
10837 signed int v14; // esi@14 | |
10838 unsigned int v15; // esi@16 | |
10839 int v16; // eax@16 | |
10840 unsigned int v17; // eax@17 | |
10841 int v18; // eax@19 | |
10842 int v19; // ecx@24 | |
10843 GUIButton *v20; // eax@26 | |
10844 GUIButton *v21; // esi@26 | |
10845 int v22; // eax@26 | |
10846 const char *v23; // eax@28 | |
10847 int v24; // eax@28 | |
10848 unsigned int v25; // ecx@28 | |
10849 int v26; // eax@28 | |
10850 unsigned __int16 v27; // ax@28 | |
10851 int v28; // eax@32 | |
10852 unsigned __int16 v29; // ST14_2@34 | |
10853 int v30; // eax@34 | |
10854 const char *v31; // ST18_4@36 | |
10855 unsigned __int16 v32; // ST14_2@36 | |
10856 int v33; // eax@36 | |
10857 int v34; // eax@37 | |
10858 unsigned int v35; // edi@38 | |
10859 unsigned int v36; // eax@38 | |
10860 int v37; // ecx@41 | |
10861 char *v38; // eax@41 | |
10862 int *v39; // eax@45 | |
10863 unsigned int v40; // eax@46 | |
10864 void *v41; // ecx@46 | |
10865 unsigned int v42; // eax@46 | |
10866 GUIWindow *v43; // ecx@59 | |
10867 int v44; // edx@59 | |
10868 char **v45; // esi@60 | |
10869 int v46; // eax@62 | |
10870 int v47; // eax@68 | |
10871 int v48; // edx@69 | |
10872 int v49; // ebx@69 | |
10873 unsigned __int8 v50; // sf@69 | |
10874 char **v51; // edi@70 | |
10875 GUIButton *v52; // eax@71 | |
10876 GUIButton *v53; // esi@71 | |
10877 int v54; // eax@71 | |
10878 unsigned int v55; // ecx@71 | |
10879 int v56; // eax@71 | |
10880 unsigned __int16 v57; // ax@71 | |
10881 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 | |
10882 const char *v59; // [sp-Ch] [bp-90h]@63 | |
10883 char *v60; // [sp-8h] [bp-8Ch]@38 | |
10884 char *v61; // [sp-8h] [bp-8Ch]@63 | |
10885 unsigned int v62; // [sp-4h] [bp-88h]@38 | |
10886 int v63; // [sp-4h] [bp-88h]@52 | |
10887 char *v64; // [sp-4h] [bp-88h]@63 | |
10888 GUIWindow v65; // [sp+Ch] [bp-78h]@1 | |
10889 __int64 v66; // [sp+60h] [bp-24h]@3 | |
10890 unsigned int white; // [sp+68h] [bp-1Ch]@1 | |
10891 int v68; // [sp+6Ch] [bp-18h]@3 | |
10892 int v69; // [sp+70h] [bp-14h]@6 | |
10893 unsigned int i; // [sp+74h] [bp-10h]@1 | |
10894 int v71; // [sp+78h] [bp-Ch]@1 | |
10895 int v72; // [sp+7Ch] [bp-8h]@16 | |
10896 int v73; // [sp+80h] [bp-4h]@14 | |
10897 | |
10898 v0 = pPlayers[uActiveCharacter]; | |
10899 memcpy(&v65, window_SpeakInHouse, sizeof(v65)); | |
10900 v65.uFrameX = 483; | |
10901 v65.uFrameWidth = 148; | |
10902 v65.uFrameZ = 334; | |
10903 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
10904 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
10905 v2 = v0->uLevel; | |
10906 v71 = color2; | |
10907 v3 = 0; | |
10908 v4 = 0; | |
10909 for ( i = v2; v4 < (signed int)v2; ++v4 ) | |
10910 v3 += v4 + 1; | |
10911 v5 = 1000 * v3; | |
10912 v6 = HIDWORD(v0->uExperience); | |
10913 v7 = window_SpeakInHouse->ptr_1C; | |
10914 v68 = (unsigned __int16)word_4F0866[(signed int)v7]; | |
10915 v66 = 1000 * v3; | |
10916 if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 ) | |
10917 { | |
10918 v8 = v0->classType % 4 + 1; | |
10919 if ( v8 == 4 ) | |
10920 v8 = 3; | |
10921 v9 = (double)(signed int)i; | |
10922 i = 0; | |
10923 v69 = v8; | |
10924 //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); | |
10925 v10 = (signed __int64)(v9 * p2DEvents[(signed int)v7 - 1].fPriceMultiplier * (double)v8); | |
10926 v11 = v10 * (100 - v0->GetMerchant()) / 100; | |
10927 if ( v11 < v10 / 3 ) | |
10928 v11 = v10 / 3; | |
10929 i = v11; | |
10930 } | |
10931 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
10932 if ( result ) | |
10933 { | |
10934 if ( dialog_menu_id != 1 ) | |
10935 { | |
10936 if ( dialog_menu_id != 17 ) | |
10937 { | |
10938 result = dialog_menu_id - 96; | |
10939 if ( dialog_menu_id == 96 ) | |
10940 { | |
10941 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
10942 if ( result ) | |
10943 { | |
10944 i = 0; | |
10945 v13 = pDialogueWindow; | |
10946 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | |
10947 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | |
10948 v73 = v14 * (100 - v0->GetMerchant()) / 100; | |
10949 if ( v73 < v14 / 3 ) | |
10950 v73 = v14 / 3; | |
10951 v15 = v13->pStartingPosActiveItem; | |
10952 v16 = v13->pNumPresenceButton; | |
10953 v72 = 0; | |
10954 if ( (signed int)v15 >= (signed int)(v15 + v16) ) | |
10955 goto LABEL_76; | |
10956 do | |
10957 { | |
10958 v17 = v13->GetControl(v15)->uControlParam - 36; | |
10959 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] ) | |
10960 { | |
10961 v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); | |
10962 i += v18; | |
10963 ++v72; | |
10964 } | |
10965 ++v15; | |
10966 } | |
10967 while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem ); | |
10968 if ( v72 ) | |
10969 { | |
10970 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" | |
10971 v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
10972 v73 = (signed int)(149 - i) / v72; | |
10973 if ( v73 > 32 ) | |
10974 v73 = 32; | |
10975 result = v13->pStartingPosActiveItem; | |
10976 v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162; | |
10977 i = result; | |
10978 v68 = v19; | |
10979 if ( result < result + v13->pNumPresenceButton ) | |
10980 { | |
10981 v72 = 2; | |
10982 do | |
10983 { | |
10984 v20 = v13->GetControl(i); | |
10985 v21 = v20; | |
10986 v22 = v20->uControlParam - 36; | |
10987 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] ) | |
10988 { | |
10989 v21->uW = 0; | |
10990 v21->uHeight = 0; | |
10991 v21->uY = 0; | |
10992 } | |
10993 else | |
10994 { | |
10995 v23 = pSkillNames[v22]; | |
10996 v21->uY = v73 + v68; | |
10997 HIDWORD(v66) = (int)v23; | |
10998 v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0); | |
10999 v25 = v21->uY; | |
11000 v21->uHeight = v24; | |
11001 v26 = v25 + v24 - 1; | |
11002 v21->uW = v26; | |
11003 v68 = v26; | |
11004 v27 = v71; | |
11005 if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) | |
11006 v27 = white; | |
11007 v65.DrawTitleText(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u); | |
11008 } | |
11009 v28 = v13->pStartingPosActiveItem; | |
11010 ++i; | |
11011 result = v13->pNumPresenceButton + v28; | |
11012 ++v72; | |
11013 } | |
11014 while ( (signed int)i < result ); | |
11015 } | |
11016 } | |
11017 else | |
11018 { | |
11019 LABEL_76: | |
11020 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);// | |
11021 // "Seek knowledge elsewhere %s the %s" | |
11022 strcat(pTmpBuf, "\n \n"); | |
11023 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
11024 v29 = v71; | |
11025 v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0); | |
11026 result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); | |
11027 } | |
11028 } | |
11029 } | |
11030 return result; | |
11031 } | |
11032 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
11033 { | |
11034 v31 = pNPCTopics[122].pText; | |
11035 v32 = v71; | |
11036 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); | |
11037 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); | |
11038 result = (int)pDialogueWindow; | |
11039 pDialogueWindow->pNumPresenceButton = 0; | |
11040 return result; | |
11041 } | |
11042 v34 = v0->uLevel; | |
11043 if ( v34 < v68 ) | |
11044 { | |
11045 if ( (signed __int64)v0->uExperience >= v66 ) | |
11046 { | |
11047 if ( pParty->uNumGold >= i ) | |
11048 { | |
11049 Party::TakeGold(i); | |
11050 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); | |
11051 ++v0->uLevel; | |
11052 v0->uSkillPoints += v0->uLevel / 10 + 5; | |
11053 v0->sHealth = v0->GetMaxHealth(); | |
11054 v0->sMana = v0->GetMaxMana(); | |
11055 v37 = 0; | |
11056 v38 = byte_F8B148; | |
11057 do | |
11058 { | |
11059 if ( *(int *)v38 > v37 ) | |
11060 v37 = *(int *)v38; | |
11061 v38 += 4; | |
11062 } | |
11063 while ( (signed int)v38 < (signed int)word_F8B158 ); | |
11064 v39 = &dword_F8B144 + uActiveCharacter; | |
11065 ++*v39; | |
11066 if ( *v39 > v37 ) | |
11067 { | |
11068 v40 = sub_494820(pParty->uCurrentHour); | |
11069 v41 = window_SpeakInHouse->ptr_1C; | |
11070 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; | |
11071 if ( v41 == (void *)94 || v41 == (void *)95 ) | |
11072 v42 += 720; | |
11073 RestAndHeal((signed int)(v42 + 10080)); | |
11074 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
11075 pOutdoor->SetFog(); | |
11076 } | |
11077 v0->PlaySound(SPEECH_87, 0); | |
11078 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// | |
11079 // "%s is now Level %lu and has earned %lu Skill Points!" | |
11080 ShowStatusBarString(pTmpBuf, 2u); | |
11081 goto LABEL_56; | |
11082 } | |
11083 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" | |
11084 v63 = 4; | |
11085 LABEL_55: | |
11086 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); | |
11087 LABEL_56: | |
11088 /*result = pMessageQueue_50CBD0->uNumMessages; | |
11089 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
11090 { | |
11091 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; | |
11092 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
11093 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
11094 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
11095 ++pMessageQueue_50CBD0->uNumMessages; | |
11096 } | |
11097 return result;*/ | |
11098 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
11099 return 1; // void function actually | |
11100 } | |
11101 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// | |
11102 // "You need %d more experience to train to level %d" | |
11103 v35 = 0; | |
11104 v62 = 3; | |
11105 v60 = pTmpBuf; | |
11106 v58 = v71; | |
11107 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88; | |
11108 } | |
11109 else | |
11110 { | |
11111 sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// | |
11112 // ""With your skills, you should be working here as a teacher."" | |
11113 // ""Sorry, but we are unable to train you."" | |
11114 v35 = 0; | |
11115 v62 = 3; | |
11116 v60 = pTmpBuf; | |
11117 v58 = v71; | |
11118 v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101; | |
11119 } | |
11120 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); | |
11121 v63 = 3; | |
11122 goto LABEL_55; | |
11123 } | |
11124 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11125 if ( result ) | |
11126 { | |
11127 v43 = pDialogueWindow; | |
11128 v72 = 0; | |
11129 pShopOptions[0] = pTmpBuf; | |
11130 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" | |
11131 v44 = pDialogueWindow->pNumPresenceButton; | |
11132 v73 = pDialogueWindow->pStartingPosActiveItem; | |
11133 if ( v73 < v73 + v44 ) | |
11134 { | |
11135 v45 = pShopOptions; | |
11136 do | |
11137 { | |
11138 if ( v43->GetControl(v73)->uControlParam == 17 ) | |
11139 { | |
11140 v46 = v0->uLevel; | |
11141 if ( v46 < v68 ) | |
11142 { | |
11143 if ( (signed __int64)v0->uExperience < v66 ) | |
11144 { | |
11145 v64 = (char *)(v46 + 1); | |
11146 v61 = (char *)(v5 - LODWORD(v0->uExperience)); | |
11147 v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d" | |
11148 } | |
11149 else | |
11150 { | |
11151 v64 = (char *)i; | |
11152 v61 = (char *)(v46 + 1); | |
11153 v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold" | |
11154 } | |
11155 } | |
11156 else | |
11157 { | |
11158 v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you."" | |
11159 v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher."" | |
11160 v59 = "%s\n \n%s"; | |
11161 } | |
11162 sprintf(*v45, v59, v61, v64); | |
11163 } | |
11164 v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); | |
11165 v43 = pDialogueWindow; | |
11166 v72 += v47; | |
11167 ++v45; | |
11168 ++v73; | |
11169 } | |
11170 while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
11171 } | |
11172 HIDWORD(v66) = (174 - v72) / 2; | |
11173 result = v43->pStartingPosActiveItem; | |
11174 v48 = result + v43->pNumPresenceButton; | |
11175 v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; | |
11176 v50 = -v43->pNumPresenceButton < 0; | |
11177 v73 = v43->pStartingPosActiveItem; | |
11178 if ( v50 ^ __OFSUB__(result, v48) ) | |
11179 { | |
11180 i = 2; | |
11181 v51 = pShopOptions; | |
11182 do | |
11183 { | |
11184 v52 = v43->GetControl(v73); | |
11185 v53 = v52; | |
11186 v52->uY = HIDWORD(v66) + v49; | |
11187 v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0); | |
11188 v55 = v53->uY; | |
11189 v53->uHeight = v54; | |
11190 v56 = v54 + v55 - 1; | |
11191 v53->uW = v56; | |
11192 v49 = v56; | |
11193 v57 = v71; | |
11194 if ( pDialogueWindow->pCurrentPosActiveItem != i ) | |
11195 v57 = white; | |
11196 v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); | |
11197 v43 = pDialogueWindow; | |
11198 ++i; | |
11199 ++v51; | |
11200 ++v73; | |
11201 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
11202 } | |
11203 while ( v73 < result ); | |
11204 } | |
11205 } | |
11206 } | |
11207 return result; | |
11208 } | |
11209 | |
11210 | |
11211 | |
11212 | |
11213 | |
11214 | |
11215 | |
11216 | |
11217 | |
11218 //----- (004B4FCF) -------------------------------------------------------- | |
11219 void MagicShopDialog() | |
11220 { | |
11221 Player *v0; // ebx@1 | |
11222 int result; // eax@6 | |
11223 signed int v2; // esi@8 | |
11224 unsigned int v3; // ebx@10 | |
11225 char *v4; // eax@11 | |
11226 char *v5; // eax@12 | |
11227 unsigned int v6; // eax@12 | |
11228 int v7; // ST08_4@14 | |
11229 int v8; // eax@14 | |
11230 unsigned __int8 v9; // dl@14 | |
11231 char *v10; // ecx@14 | |
11232 signed int v11; // esi@16 | |
11233 int v12; // ST08_4@19 | |
11234 int v13; // eax@19 | |
11235 int all_text_height; // edi@21 | |
11236 char **v15; // esi@21 | |
11237 int v16; // eax@22 | |
11238 GUIWindow *v17; // ecx@23 | |
11239 int v18; // edx@23 | |
11240 int v19; // edi@23 | |
11241 unsigned __int8 v20; // sf@23 | |
11242 GUIButton *control_button; // esi@25 | |
11243 const char **v22; // eax@25 | |
11244 int v23; // eax@25 | |
11245 unsigned int v24; // ecx@25 | |
11246 const char **v25; // edx@25 | |
11247 unsigned __int16 text_color; // ax@25 | |
11248 signed int v27; // esi@30 | |
11249 int v28; // ST08_4@34 | |
11250 int v29; // eax@34 | |
11251 char *v30; // edx@35 | |
11252 GUIWindow *v31; // edi@40 | |
11253 void *v32; // eax@40 | |
11254 signed int v33; // esi@40 | |
11255 unsigned int v34; // esi@42 | |
11256 int v35; // eax@42 | |
11257 unsigned int v36; // eax@43 | |
11258 int v37; // eax@45 | |
11259 int v38; // ecx@50 | |
11260 GUIButton *v39; // eax@52 | |
11261 GUIButton *v40; // esi@52 | |
11262 int v41; // eax@52 | |
11263 char *v42; // eax@54 | |
11264 int v43; // eax@54 | |
11265 unsigned int v44; // ecx@54 | |
11266 int v45; // edx@54 | |
11267 int v46; // eax@54 | |
11268 unsigned __int16 v47; // ax@54 | |
11269 int v48; // eax@58 | |
11270 signed int v49; // esi@62 | |
11271 Texture *v50; // ecx@64 | |
11272 unsigned int v51; // edi@64 | |
11273 unsigned int v52; // esi@66 | |
11274 int v53; // edx@70 | |
11275 Texture *v54; // ecx@76 | |
11276 unsigned int v55; // edi@76 | |
11277 unsigned int v56; // esi@76 | |
11278 int v57; // edx@80 | |
11279 Texture *v58; // ecx@86 | |
11280 unsigned int v59; // edi@86 | |
11281 unsigned int v60; // esi@88 | |
11282 int v61; // edx@92 | |
11283 Texture *v62; // ecx@98 | |
11284 unsigned int v63; // edi@98 | |
11285 unsigned int v64; // esi@100 | |
11286 int v65; // edx@104 | |
11287 signed int v66; // ecx@109 | |
11288 SHORT v67; // di@117 | |
11289 bool v68; // eax@117 | |
11290 const char *v69; // ecx@119 | |
11291 POINT *v70; // esi@124 | |
11292 int v71; // ecx@125 | |
11293 int v72; // eax@125 | |
11294 int v73; // ecx@125 | |
11295 ItemGen *v74; // esi@125 | |
11296 int v75; // eax@130 | |
11297 int v76; // esi@131 | |
11298 char **v77; // edi@131 | |
11299 int v78; // eax@132 | |
11300 GUIWindow *v79; // ecx@133 | |
11301 int v80; // edx@133 | |
11302 int v81; // edi@133 | |
11303 GUIButton *v82; // esi@135 | |
11304 const char **v83; // eax@135 | |
11305 int v84; // eax@135 | |
11306 unsigned int v85; // ecx@135 | |
11307 int v86; // edx@135 | |
11308 unsigned __int16 v87; // ax@135 | |
11309 GUIWindow *v88; // [sp-18h] [bp-110h]@35 | |
11310 int v89; // [sp-14h] [bp-10Ch]@35 | |
11311 ItemGen *v90; // [sp-10h] [bp-108h]@14 | |
11312 int v91; // [sp-10h] [bp-108h]@35 | |
11313 unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 | |
11314 void *v93; // [sp-Ch] [bp-104h]@14 | |
11315 int v94; // [sp-8h] [bp-100h]@11 | |
11316 char *v95; // [sp-8h] [bp-100h]@12 | |
11317 __int64 *v96; // [sp-4h] [bp-FCh]@11 | |
11318 unsigned int v97; // [sp-4h] [bp-FCh]@12 | |
11319 POINT v98; // [sp+Ch] [bp-ECh]@8 | |
11320 POINT v99; // [sp+14h] [bp-E4h]@16 | |
11321 POINT v100; // [sp+1Ch] [bp-DCh]@124 | |
11322 POINT v101; // [sp+24h] [bp-D4h]@17 | |
11323 POINT v102; // [sp+2Ch] [bp-CCh]@124 | |
11324 POINT v103; // [sp+34h] [bp-C4h]@9 | |
11325 POINT v104; // [sp+3Ch] [bp-BCh]@31 | |
11326 POINT v105; // [sp+44h] [bp-B4h]@16 | |
11327 POINT v106; // [sp+4Ch] [bp-ACh]@30 | |
11328 POINT v107; // [sp+54h] [bp-A4h]@16 | |
11329 POINT v108; // [sp+5Ch] [bp-9Ch]@30 | |
11330 POINT a2; // [sp+64h] [bp-94h]@8 | |
11331 POINT v110; // [sp+6Ch] [bp-8Ch]@30 | |
11332 POINT v111; // [sp+74h] [bp-84h]@8 | |
11333 GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 | |
11334 char *Str; // [sp+D0h] [bp-28h]@54 | |
11335 int v146; // [sp+D4h] [bp-24h]@23 | |
11336 unsigned int hilight_color; // [sp+D8h] [bp-20h]@1 | |
11337 unsigned int m_text_color; // [sp+DCh] [bp-1Ch]@1 | |
11338 __int32 v117; // [sp+E0h] [bp-18h]@8 | |
11339 int v118; // [sp+E4h] [bp-14h]@40 | |
11340 const char **v119; // [sp+E8h] [bp-10h]@24 | |
11341 Player *_this; // [sp+ECh] [bp-Ch]@1 | |
11342 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 | |
11343 int v152; // [sp+F4h] [bp-4h]@23 | |
11344 int v122; | |
11345 int v114; | |
11346 | |
11347 v0 = pPlayers[uActiveCharacter]; | |
11348 _this = pPlayers[uActiveCharacter]; | |
11349 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | |
11350 dialog_window.uFrameX = 483; | |
11351 dialog_window.uFrameWidth = 148; | |
11352 dialog_window.uFrameZ = 334; | |
11353 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
11354 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); | |
11355 if ( dialog_menu_id > 5 ) | |
11356 { | |
11357 if ( dialog_menu_id == 94 ) | |
11358 { | |
11359 draw_leather(); | |
11360 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
11361 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" | |
11362 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" | |
11363 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" | |
11364 v76 = 0; | |
11365 v77 = pShopOptions; | |
11366 do | |
11367 { | |
11368 v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0); | |
11369 ++v77; | |
11370 v76 += v78; | |
11371 } | |
11372 while ( (signed int)v77 < (signed int)&pShopOptions[3] ); | |
11373 v79 = pDialogueWindow; | |
11374 _this = (Player *)((174 - v76) / 3); | |
11375 result = pDialogueWindow->pStartingPosActiveItem; | |
11376 v80 = result + pDialogueWindow->pNumPresenceButton; | |
11377 v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138; | |
11378 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
11379 v118 = pDialogueWindow->pStartingPosActiveItem; | |
11380 if ( v20 ^ __OFSUB__(result, v80) ) | |
11381 { | |
11382 v122 = 2; | |
11383 v119 = (const char **)pShopOptions; | |
11384 do | |
11385 { | |
11386 v82 = v79->GetControl(v118); | |
11387 v83 = v119; | |
11388 v82->uY = (unsigned int)((char *)_this + v81); | |
11389 v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0); | |
11390 v85 = v82->uY; | |
11391 v86 = v122; | |
11392 v82->uHeight = v84; | |
11393 v81 = v84 + v85 - 1; | |
11394 v82->uW = v81; | |
11395 v87 = hilight_color; | |
11396 if ( pDialogueWindow->pCurrentPosActiveItem != v86 ) | |
11397 v87 = m_text_color; | |
11398 dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u); | |
11399 v79 = pDialogueWindow; | |
11400 ++v122; | |
11401 ++v119; | |
11402 ++v118; | |
11403 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
11404 } | |
11405 while ( v118 < result ); | |
11406 } | |
11407 return; | |
11408 } | |
11409 if ( dialog_menu_id != 95 ) | |
11410 { | |
11411 result = dialog_menu_id - 96; | |
11412 if ( dialog_menu_id == 96 ) | |
11413 { | |
11414 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11415 if ( result ) | |
11416 { | |
11417 v31 = pDialogueWindow; | |
11418 v3 = 0; | |
11419 v32 = window_SpeakInHouse->ptr_1C; | |
11420 v118 = 0; | |
11421 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); | |
11422 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); | |
11423 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100); | |
11424 if ( (signed int)v119 < v33 / 3 ) | |
11425 v119 = (const char **)(v33 / 3); | |
11426 v34 = v31->pStartingPosActiveItem; | |
11427 v35 = v34 + v31->pNumPresenceButton; | |
11428 v122 = 0; | |
11429 if ( (signed int)v34 >= v35 ) | |
11430 goto LABEL_140; | |
11431 do | |
11432 { | |
11433 v36 = v31->GetControl(v34)->uControlParam - 36; | |
11434 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] ) | |
11435 { | |
11436 v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); | |
11437 v118 += v37; | |
11438 ++v122; | |
11439 } | |
11440 ++v34; | |
11441 } | |
11442 while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); | |
11443 if ( !v122 ) | |
11444 { | |
11445 LABEL_140: | |
11446 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// | |
11447 // "Seek knowledge elsewhere %s the %s" | |
11448 strcat(pTmpBuf, "\n \n"); | |
11449 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." | |
11450 v30 = pTmpBuf; | |
11451 v97 = 3; | |
11452 v95 = pTmpBuf; | |
11453 v92 = hilight_color; | |
11454 v91 = 0; | |
11455 v89 = 0; | |
11456 v88 = &dialog_window; | |
11457 goto LABEL_61; | |
11458 } | |
11459 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" | |
11460 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
11461 v119 = (const char **)((149 - v118) / v122); | |
11462 if ( (149 - v118) / v122 > 32 ) | |
11463 v119 = (const char **)32; | |
11464 result = v31->pStartingPosActiveItem; | |
11465 v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162; | |
11466 v118 = result; | |
11467 v114 = v38; | |
11468 if ( result < result + v31->pNumPresenceButton ) | |
11469 { | |
11470 v122 = 2; | |
11471 do | |
11472 { | |
11473 v39 = v31->GetControl(v118); | |
11474 v40 = v39; | |
11475 v41 = v39->uControlParam - 36; | |
11476 if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] ) | |
11477 { | |
11478 v40->uW = 0; | |
11479 v40->uHeight = 0; | |
11480 v40->uY = 0; | |
11481 } | |
11482 else | |
11483 { | |
11484 v42 = pSkillNames[v41]; | |
11485 v40->uY = (unsigned int)((char *)v119 + v114); | |
11486 Str = v42; | |
11487 v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0); | |
11488 v44 = v40->uY; | |
11489 v45 = v122; | |
11490 v40->uHeight = v43; | |
11491 v46 = v44 + v43 - 1; | |
11492 v40->uW = v46; | |
11493 v114 = v46; | |
11494 v47 = hilight_color; | |
11495 if ( pDialogueWindow->pCurrentPosActiveItem != v45 ) | |
11496 v47 = m_text_color; | |
11497 dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u); | |
11498 } | |
11499 v48 = v31->pStartingPosActiveItem; | |
11500 ++v118; | |
11501 result = v31->pNumPresenceButton + v48; | |
11502 ++v122; | |
11503 } | |
11504 while ( v118 < result ); | |
11505 } | |
11506 } | |
11507 } | |
11508 return; | |
11509 } | |
11510 } | |
11511 else | |
11512 { | |
11513 if ( dialog_menu_id == 5 ) | |
11514 { | |
11515 draw_leather(); | |
11516 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
11517 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" | |
11518 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11519 if ( !result | |
11520 || (v27 = pMouse->GetCursorPos(&v110)->x - 14, | |
11521 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), | |
11522 result = (int)pMouse->GetCursorPos(&v106), | |
11523 *(int *)result <= 13) | |
11524 || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) | |
11525 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) | |
11526 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) | |
11527 return; | |
11528 v96 = 0; | |
11529 v94 = 5; | |
11530 v93 = window_SpeakInHouse->ptr_1C; | |
11531 v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5]; | |
11532 v28 = (int)window_SpeakInHouse->ptr_1C; | |
11533 uPlayerID = uActiveCharacter - 1; | |
11534 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); | |
11535 v9 = uPlayerID; | |
11536 v10 = (char *)pMerchantsRepairPhrases[v29]; | |
11537 goto LABEL_35; | |
11538 } | |
11539 if ( dialog_menu_id == 1 ) | |
11540 { | |
11541 /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11542 if ( result ) | |
11543 { | |
11544 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" | |
11545 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special" | |
11546 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory" | |
11547 v14 = 0; | |
11548 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" | |
11549 v15 = pShopOptions; | |
11550 do | |
11551 { | |
11552 v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0); | |
11553 ++v15; | |
11554 v14 += v16; | |
11555 } | |
11556 while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); | |
11557 v17 = pDialogueWindow; | |
11558 v114 = (174 - v14) / 4; | |
11559 result = pDialogueWindow->pStartingPosActiveItem; | |
11560 v18 = result + pDialogueWindow->pNumPresenceButton; | |
11561 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; | |
11562 v20 = -pDialogueWindow->pNumPresenceButton < 0; | |
11563 v122 = pDialogueWindow->pStartingPosActiveItem; | |
11564 if ( v20 ^ __OFSUB__(result, v18) ) | |
11565 { | |
11566 v119 = (const char **)2; | |
11567 _this = (Player *)pShopOptions; | |
11568 do | |
11569 { | |
11570 v21 = v17->GetControl(v122); | |
11571 v22 = (const char **)_this; | |
11572 v21->uY = v114 + v19; | |
11573 v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0); | |
11574 v24 = v21->uY; | |
11575 v25 = v119; | |
11576 v21->uHeight = v23; | |
11577 v19 = v24 + v23 - 1; | |
11578 v21->uW = v19; | |
11579 v26 = color2; | |
11580 if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) | |
11581 v26 = m_text_color; | |
11582 dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); | |
11583 v17 = pDialogueWindow; | |
11584 v119 = (const char **)((char *)v119 + 1); | |
11585 _this = (Player *)((char *)_this + 4); | |
11586 ++v122; | |
11587 result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
11588 } | |
11589 while ( v122 < result ); | |
11590 } | |
11591 }*/ | |
11592 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
11593 return; | |
11594 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" | |
11595 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" | |
11596 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" | |
11597 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; | |
11598 | |
11599 all_text_height = 0; | |
11600 for(int i=0;i<4;++i) | |
11601 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | |
11602 v146 = (174 - all_text_height) / 4; | |
11603 | |
11604 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; | |
11605 int j=0; | |
11606 if ( pDialogueWindow->pNumPresenceButton>=0 ) | |
11607 { | |
11608 int th = 2; | |
11609 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) | |
11610 { | |
11611 control_button = pDialogueWindow->GetControl(v152); | |
11612 control_button->uY = v146 + v23; | |
11613 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); | |
11614 control_button->uHeight = v27; | |
11615 v23 = control_button->uY + control_button->uHeight - 1; | |
11616 control_button->uW = v23; | |
11617 text_color = hilight_color; | |
11618 if ( pDialogueWindow->pCurrentPosActiveItem != th ) | |
11619 text_color = m_text_color; | |
11620 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); | |
11621 ++th; | |
11622 ++j; | |
11623 } | |
11624 } | |
11625 | |
11626 | |
11627 return; | |
11628 } | |
11629 if ( dialog_menu_id != 2 ) | |
11630 { | |
11631 if ( dialog_menu_id != 3 ) | |
11632 { | |
11633 result = dialog_menu_id - 4; | |
11634 if ( dialog_menu_id == 4 ) | |
11635 { | |
11636 draw_leather(); | |
11637 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
11638 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" | |
11639 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11640 if ( result ) | |
11641 { | |
11642 v2 = pMouse->GetCursorPos(&a2)->x - 14; | |
11643 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); | |
11644 result = (int)pMouse->GetCursorPos(&v111); | |
11645 if ( *(int *)result > 13 ) | |
11646 { | |
11647 result = (int)pMouse->GetCursorPos(&v103); | |
11648 if ( *(int *)result < 462 ) | |
11649 { | |
11650 result = v0->GetItemIDAtInventoryIndex((int *)&v117); | |
11651 v3 = 0; | |
11652 if ( result ) | |
11653 { | |
11654 v96 = 0; | |
11655 v94 = 4; | |
11656 v4 = (char *)&_this->pInventoryItems[result-1]; | |
11657 if ( v4[20] & 1 ) | |
11658 { | |
11659 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); | |
11660 v97 = 3; | |
11661 v95 = v5; | |
11662 v92 = m_text_color; | |
11663 v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; | |
11664 | |
11665 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); | |
11666 return; | |
11667 } | |
11668 v93 = window_SpeakInHouse->ptr_1C; | |
11669 v90 = (ItemGen *)v4; | |
11670 v7 = (int)window_SpeakInHouse->ptr_1C; | |
11671 uPlayerID = uActiveCharacter - 1; | |
11672 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); | |
11673 v9 = uPlayerID; | |
11674 v10 = (char *)pMerchantsIdentifyPhrases[v8]; | |
11675 goto LABEL_35; | |
11676 } | |
11677 } | |
11678 } | |
11679 } | |
11680 } | |
11681 return; | |
11682 } | |
11683 draw_leather(); | |
11684 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); | |
11685 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" | |
11686 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11687 if ( !result | |
11688 || (v11 = pMouse->GetCursorPos(&v107)->x - 14, | |
11689 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), | |
11690 result = (int)pMouse->GetCursorPos(&v105), | |
11691 *(int *)result <= 13) | |
11692 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) | |
11693 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) | |
11694 return; | |
11695 v96 = 0; | |
11696 v94 = 3; | |
11697 v93 = window_SpeakInHouse->ptr_1C; | |
11698 v90 = (ItemGen *)&_this->pInventoryItems[result-1]; | |
11699 v12 = (int)window_SpeakInHouse->ptr_1C; | |
11700 uPlayerID = uActiveCharacter - 1; | |
11701 v13 = _this->_490EEE(v90, 3, v12, 3); | |
11702 v9 = uPlayerID; | |
11703 v10 = (char *)pMerchantsSellPhrases[v13]; | |
11704 LABEL_35: | |
11705 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); | |
11706 v97 = 3; | |
11707 v95 = v30; | |
11708 v92 = m_text_color; | |
11709 v91 = v3; | |
11710 v89 = v3; | |
11711 v88 = &dialog_window; | |
11712 LABEL_61: | |
11713 v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; | |
11714 dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); | |
11715 return; | |
11716 } | |
11717 } | |
11718 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
11719 v3 = 0; | |
11720 v49 = 0; | |
11721 v122 = 0; | |
11722 if ( dialog_menu_id == 2 ) | |
11723 { | |
11724 do | |
11725 { | |
11726 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
11727 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); | |
11728 { | |
11729 v50 = ItemsInShopTexture[v49]; | |
11730 v51 = 152 - v50->uTextureHeight; | |
11731 if ( (signed int)v51 < 1 ) | |
11732 v51 = 0; | |
11733 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; | |
11734 if ( v122 ) | |
11735 { | |
11736 if ( v122 == 5 ) | |
11737 { | |
11738 v53 = ItemsInShopTexture[5]->uTextureWidth; | |
11739 if ( (signed int)v52 > 457 - v53 ) | |
11740 v52 = 457 - v53; | |
11741 } | |
11742 } | |
11743 else | |
11744 { | |
11745 if ( (signed int)v52 < 18 ) | |
11746 v52 = 18; | |
11747 } | |
11748 pRenderer->DrawTextureTransparent(v52, v51, v50); | |
11749 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); | |
11750 v49 = v122; | |
11751 } | |
11752 ++v49; | |
11753 v122 = v49; | |
11754 } | |
11755 while ( v49 < 6 ); | |
11756 v122 = 0; | |
11757 do | |
11758 { | |
11759 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) | |
11760 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); | |
11761 { | |
11762 v54 = ItemsInShopTexture[v122 + 6]; | |
11763 v55 = 306 - v54->uTextureHeight; | |
11764 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; | |
11765 if ( v122 ) | |
11766 { | |
11767 if ( v122 == 5 ) | |
11768 { | |
11769 v57 = ItemsInShopTexture[11]->uTextureWidth; | |
11770 if ( (signed int)v56 > 457 - v57 ) | |
11771 v56 = 457 - v57; | |
11772 } | |
11773 } | |
11774 else | |
11775 { | |
11776 if ( (signed int)v56 < 18 ) | |
11777 v56 = 18; | |
11778 } | |
11779 pRenderer->DrawTextureTransparent(v56, v55, v54); | |
11780 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); | |
11781 } | |
11782 ++v122; | |
11783 } | |
11784 while ( v122 < 6 ); | |
11785 } | |
11786 else | |
11787 { | |
11788 do | |
11789 { | |
11790 // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
11791 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) | |
11792 { | |
11793 v58 = ItemsInShopTexture[v49]; | |
11794 v59 = 152 - v58->uTextureHeight; | |
11795 if ( (signed int)v59 < 1 ) | |
11796 v59 = 0; | |
11797 v60 = 75 * v49 - v58->uTextureWidth / 2 + 40; | |
11798 if ( v122 ) | |
11799 { | |
11800 if ( v122 == 5 ) | |
11801 { | |
11802 v61 = ItemsInShopTexture[5]->uTextureWidth; | |
11803 if ( (signed int)v60 > 457 - v61 ) | |
11804 v60 = 457 - v61; | |
11805 } | |
11806 } | |
11807 else | |
11808 { | |
11809 if ( (signed int)v60 < 18 ) | |
11810 v60 = 18; | |
11811 } | |
11812 pRenderer->DrawTextureTransparent(v60, v59, v58); | |
11813 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); | |
11814 v49 = v122; | |
11815 } | |
11816 ++v49; | |
11817 v122 = v49; | |
11818 } | |
11819 while ( v49 < 6 ); | |
11820 v122 = 0; | |
11821 do | |
11822 { | |
11823 //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak | |
11824 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) | |
11825 { | |
11826 v62 = ItemsInShopTexture[v122 + 6]; | |
11827 v63 = 306 - v62->uTextureHeight; | |
11828 if ( (signed int)v63 < 1 ) | |
11829 v63 = 0; | |
11830 v64 = 75 * v122 - v62->uTextureWidth / 2 + 40; | |
11831 if ( v122 ) | |
11832 { | |
11833 if ( v122 == 5 ) | |
11834 { | |
11835 v65 = ItemsInShopTexture[11]->uTextureWidth; | |
11836 if ( (signed int)v64 > 457 - v65 ) | |
11837 v64 = 457 - v65; | |
11838 } | |
11839 } | |
11840 else | |
11841 { | |
11842 if ( (signed int)v64 < 18 ) | |
11843 v64 = 18; | |
11844 } | |
11845 pRenderer->DrawTextureTransparent(v64, v63, v62); | |
11846 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); | |
11847 } | |
11848 ++v122; | |
11849 } | |
11850 while ( v122 < 6 ); | |
11851 } | |
11852 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); | |
11853 if ( result ) | |
11854 { | |
11855 v66 = 0; | |
11856 v117 = 0; | |
11857 if ( dialog_menu_id == 2 ) | |
11858 { | |
11859 do | |
11860 { | |
11861 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | |
11862 ++v117; | |
11863 ++v66; | |
11864 } | |
11865 while ( v66 < 12 ); | |
11866 } | |
11867 else | |
11868 { | |
11869 do | |
11870 { | |
11871 //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) | |
11872 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) | |
11873 ++v117; | |
11874 ++v66; | |
11875 } | |
11876 while ( v66 < 12 ); | |
11877 } | |
11878 v67 = GetAsyncKeyState(VK_CONTROL); | |
11879 v68 = _this->CanSteal(); | |
11880 Str = (char *)v68; | |
11881 if ( v67 && v68 ) | |
11882 { | |
11883 v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" | |
11884 } | |
11885 else | |
11886 { | |
11887 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" | |
11888 if ( dialog_menu_id != 2 ) | |
11889 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" | |
11890 } | |
11891 DrawTextAtStatusBar(v69, 0); | |
11892 if ( !v117 ) | |
11893 { | |
11894 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); | |
11895 return; | |
11896 } | |
11897 v70 = pMouse->GetCursorPos(&v102); | |
11898 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; | |
11899 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) | |
11900 { | |
11901 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; | |
11902 v117 = v71; | |
11903 v72 = (int)window_SpeakInHouse->ptr_1C; | |
11904 // v73 = 9 * (v71 + 12 * v72); | |
11905 v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; | |
11906 if ( dialog_menu_id != 2 ) | |
11907 // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; | |
11908 v74 =&pParty->SpecialItemsInShops[v72][v71]; | |
11909 if ( v67 && Str ) | |
11910 { | |
11911 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" | |
11912 v96 = 0; | |
11913 v94 = 2; | |
11914 v93 = window_SpeakInHouse->ptr_1C; | |
11915 v90 = v74; | |
11916 v9 = uActiveCharacter - 1; | |
11917 } | |
11918 else | |
11919 { | |
11920 v96 = 0; | |
11921 v94 = 2; | |
11922 v93 = window_SpeakInHouse->ptr_1C; | |
11923 v90 = v74; | |
11924 uPlayerID = uActiveCharacter - 1; | |
11925 v75 = _this->_490EEE(v74, 3, v72, 2); | |
11926 v9 = uPlayerID; | |
11927 v10 = (char *)pMerchantsBuyPhrases[v75]; | |
11928 } | |
11929 goto LABEL_35; | |
11930 } | |
11931 } | |
11932 return; | |
11933 } | |
11934 | 10812 |
11935 //----- (004BC49B) -------------------------------------------------------- | 10813 //----- (004BC49B) -------------------------------------------------------- |
11936 void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) | 10814 void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) |
11937 { | 10815 { |
11938 //unsigned int v1; // esi@1 | 10816 //unsigned int v1; // esi@1 |
12221 goto LABEL_23; | 11099 goto LABEL_23; |
12222 } | 11100 } |
12223 return 0; | 11101 return 0; |
12224 } | 11102 } |
12225 | 11103 |
12226 | |
12227 | |
12228 //----- (004B5D7C) -------------------------------------------------------- | |
12229 void GuildDialog() | |
12230 { | |
12231 GUIWindow *v0; // ebx@1 | |
12232 Player *currPlayer; // edi@1 | |
12233 signed int base_teach_price; // ebx@1 | |
12234 int v3; // edi@6 | |
12235 int result; // eax@11 | |
12236 unsigned int v5; // ebx@13 | |
12237 int v6; // esi@13 | |
12238 signed int v7; // esi@17 | |
12239 int v8; // esi@22 | |
12240 signed int v9; // ecx@22 | |
12241 char *v10; // eax@22 | |
12242 const char *statusbar_string; // ecx@26 | |
12243 POINT *v12; // esi@30 | |
12244 int v13; // ecx@30 | |
12245 void *v14; // ST1C_4@31 | |
12246 ItemGen *v15; // ST18_4@31 | |
12247 int v16; // ST10_4@31 | |
12248 int v17; // eax@31 | |
12249 char *v18; // edx@31 | |
12250 int v19; // eax@32 | |
12251 GUIWindow *v20; // edi@35 | |
12252 int v21; // esi@35 | |
12253 int v22; // eax@35 | |
12254 unsigned int v23; // eax@36 | |
12255 int v24; // eax@39 | |
12256 int v25; // eax@40 | |
12257 int v26; // ecx@47 | |
12258 GUIButton *v27; // eax@49 | |
12259 GUIButton *v28; // esi@49 | |
12260 unsigned int v29; // eax@49 | |
12261 char *v30; // eax@52 | |
12262 int v31; // eax@55 | |
12263 unsigned int v32; // ecx@55 | |
12264 int v33; // eax@55 | |
12265 unsigned __int16 v34; // ax@55 | |
12266 int v35; // eax@58 | |
12267 const char *v36; // ST20_4@61 | |
12268 unsigned __int16 v37; // ST1C_2@61 | |
12269 int v38; // eax@61 | |
12270 GUIWindow *v39; // [sp-18h] [bp-304h]@31 | |
12271 int v40; // [sp-14h] [bp-300h]@31 | |
12272 int v41; // [sp-10h] [bp-2FCh]@31 | |
12273 unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 | |
12274 char *v43; // [sp-8h] [bp-2F4h]@31 | |
12275 unsigned int v44; // [sp-4h] [bp-2F0h]@31 | |
12276 char Dest[100]; // [sp+Ch] [bp-2E0h]@3 | |
12277 char v46[100]; // [sp+70h] [bp-27Ch]@3 | |
12278 char v47[100]; // [sp+D4h] [bp-218h]@3 | |
12279 char v48[100]; // [sp+138h] [bp-1B4h]@3 | |
12280 char v49[100]; // [sp+19Ch] [bp-150h]@3 | |
12281 POINT v50; // [sp+264h] [bp-88h]@30 | |
12282 POINT v51; // [sp+26Ch] [bp-80h]@30 | |
12283 GUIWindow working_window; // [sp+274h] [bp-78h]@1 | |
12284 signed int v53; // [sp+27Ch] [bp-70h]@1 | |
12285 signed int v54; // [sp+284h] [bp-68h]@1 | |
12286 int v55; // [sp+2C8h] [bp-24h]@47 | |
12287 int main_text_color; // [sp+2CCh] [bp-20h]@1 | |
12288 int hi_text_color; // [sp+2D0h] [bp-1Ch]@1 | |
12289 Player *v58; // [sp+2D4h] [bp-18h]@1 | |
12290 unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 | |
12291 char *Str; // [sp+2DCh] [bp-10h]@35 | |
12292 int v61; // [sp+2E0h] [bp-Ch]@35 | |
12293 unsigned int v62; // [sp+2E4h] [bp-8h]@13 | |
12294 int v63; // [sp+2E8h] [bp-4h]@1 | |
12295 | |
12296 v0 = window_SpeakInHouse; | |
12297 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); | |
12298 v58 = pPlayers[uActiveCharacter]; | |
12299 currPlayer = v58; | |
12300 working_window.uFrameX = 483; | |
12301 working_window.uFrameWidth = 148; | |
12302 working_window.uFrameZ = 334; | |
12303 main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
12304 hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
12305 //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); | |
12306 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0); | |
12307 v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100; | |
12308 if ( v63 < base_teach_price / 3 ) | |
12309 v63 = base_teach_price / 3; | |
12310 strcpy(Dest, ""); | |
12311 strcpy(v46, ""); | |
12312 strcpy(v47, ""); | |
12313 strcpy(v48, ""); | |
12314 strcpy(v49, ""); | |
12315 if ( dialog_menu_id != 1 ) | |
12316 { | |
12317 if ( dialog_menu_id != 18 ) //buy skill | |
12318 { | |
12319 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
12320 { | |
12321 //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill | |
12322 if ( v58->pActiveSkills[dialog_menu_id-36] ) | |
12323 { | |
12324 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" | |
12325 ShowStatusBarString(pTmpBuf, 2u); | |
12326 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
12327 } | |
12328 else | |
12329 { | |
12330 if ( pParty->uNumGold < v63 ) | |
12331 { | |
12332 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" | |
12333 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); | |
12334 } | |
12335 else | |
12336 { | |
12337 Party::TakeGold(v63); | |
12338 v58->pActiveSkills[dialog_menu_id-36] = 1; | |
12339 } | |
12340 } | |
12341 } | |
12342 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
12343 return; | |
12344 } | |
12345 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); | |
12346 v5 = 0; | |
12347 v6 = 0; | |
12348 v62 = 0; | |
12349 v63 = 32; | |
12350 do | |
12351 { | |
12352 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) | |
12353 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) | |
12354 | |
12355 { | |
12356 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); | |
12357 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); | |
12358 currPlayer = v58; | |
12359 } | |
12360 v63 += 70; | |
12361 v62 += 280; | |
12362 ++v6; | |
12363 } | |
12364 while ( v63 < 452 ); | |
12365 | |
12366 v62 = 1680; | |
12367 v7 = 6; | |
12368 v63 = 32; | |
12369 do | |
12370 { | |
12371 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) | |
12372 // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) | |
12373 { | |
12374 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); | |
12375 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); | |
12376 currPlayer = v58; | |
12377 } | |
12378 v63 += 70; | |
12379 v62 += 280; | |
12380 ++v7; | |
12381 } | |
12382 while ( v63 < 452 ); | |
12383 | |
12384 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
12385 { | |
12386 v8 = 0; | |
12387 v9 = 12; | |
12388 // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); | |
12389 // v10 = | |
12390 do | |
12391 { | |
12392 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) | |
12393 ++v8; | |
12394 // v10 += 36; | |
12395 --v9; | |
12396 } | |
12397 while ( v9 ); | |
12398 | |
12399 GetAsyncKeyState(17); | |
12400 statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" | |
12401 if ( dialog_menu_id != 2 ) | |
12402 statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" | |
12403 DrawTextAtStatusBar(statusbar_string, 0); | |
12404 if ( !v8 ) | |
12405 { | |
12406 working_window.DrawCurrentTime( | |
12407 __PAIR__( | |
12408 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], | |
12409 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) | |
12410 - pParty->uTimePlayed); | |
12411 return; | |
12412 } | |
12413 v12 = pMouse->GetCursorPos(&v51); | |
12414 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; | |
12415 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; | |
12416 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) | |
12417 { | |
12418 v14 = window_SpeakInHouse->ptr_1C; | |
12419 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); | |
12420 v16 = (int)window_SpeakInHouse->ptr_1C; | |
12421 uPlayerID = uActiveCharacter - 1; | |
12422 v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); | |
12423 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); | |
12424 v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); | |
12425 working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3); | |
12426 return; | |
12427 } | |
12428 } | |
12429 return; | |
12430 } | |
12431 if ( !(unsigned __int16)_449B57_test_bit( | |
12432 (unsigned __int8 *)currPlayer->_guilds_member_bits, | |
12433 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) | |
12434 { //you must me member | |
12435 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); | |
12436 working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u); | |
12437 pDialogueWindow->pNumPresenceButton = 0; | |
12438 return; | |
12439 } | |
12440 | |
12441 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
12442 return; | |
12443 v20 = pDialogueWindow; | |
12444 v5 = 0; | |
12445 v62 = 0; | |
12446 Str = 0; | |
12447 v21 = pDialogueWindow->pStartingPosActiveItem; | |
12448 v22 = v21 + pDialogueWindow->pNumPresenceButton; | |
12449 v61 = 0; | |
12450 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton ) | |
12451 { | |
12452 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" | |
12453 strcat(pTmpBuf, "\n \n"); | |
12454 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | |
12455 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); | |
12456 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); | |
12457 return; | |
12458 } | |
12459 do | |
12460 { | |
12461 v23 = v20->GetControl(v21)->uControlParam; | |
12462 if ( v23 == 18 ) | |
12463 { | |
12464 v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" | |
12465 v62 += v25; | |
12466 ++v61; | |
12467 } | |
12468 else | |
12469 { | |
12470 | |
12471 if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36])) | |
12472 // or | |
12473 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
12474 { | |
12475 v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0); | |
12476 v62 += v24; | |
12477 ++v61; | |
12478 ++Str; | |
12479 } | |
12480 } | |
12481 ++v21; | |
12482 } | |
12483 while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem ); | |
12484 if ( !v61 ) | |
12485 { | |
12486 LABEL_64: | |
12487 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s" | |
12488 strcat(pTmpBuf, "\n \n"); | |
12489 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." | |
12490 v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); | |
12491 working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); | |
12492 return; | |
12493 } | |
12494 if ( Str ) | |
12495 { | |
12496 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" | |
12497 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
12498 } | |
12499 v63 = (signed int)(149 - v62) / v61; | |
12500 if ( v63 > 32 ) | |
12501 v63 = 32; | |
12502 v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162; | |
12503 v62 = v20->pStartingPosActiveItem; | |
12504 v55 = v26; | |
12505 if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton ) | |
12506 { | |
12507 v61 = 2; | |
12508 while ( 1 ) | |
12509 { | |
12510 v27 = v20->GetControl(v62); | |
12511 v28 = v27; | |
12512 v29 = v27->uControlParam; | |
12513 if ( v29 == 18 ) | |
12514 break; | |
12515 | |
12516 // __debugbreak(); | |
12517 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | |
12518 // or | |
12519 if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36])) | |
12520 // or | |
12521 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] | |
12522 | |
12523 { | |
12524 v30 = pClassNames[v29 -16]; | |
12525 LABEL_55: | |
12526 Str = v30; | |
12527 v28->uY = v63 + v55; | |
12528 v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0); | |
12529 v32 = v28->uY; | |
12530 v28->uHeight = v31; | |
12531 v33 = v32 + v31 - 1; | |
12532 v28->uW = v33; | |
12533 v55 = v33; | |
12534 v34 = hi_text_color; | |
12535 if ( pDialogueWindow->pCurrentPosActiveItem != v61 ) | |
12536 v34 = main_text_color; | |
12537 working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u); | |
12538 v35 = v20->pStartingPosActiveItem; | |
12539 ++v62; | |
12540 ++v61; | |
12541 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) | |
12542 return; | |
12543 } | |
12544 v28->uW = 0; | |
12545 v28->uHeight = 0; | |
12546 v28->uY = 0; | |
12547 LABEL_58: | |
12548 v35 = v20->pStartingPosActiveItem; | |
12549 ++v62; | |
12550 ++v61; | |
12551 if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) | |
12552 return; | |
12553 } | |
12554 v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" | |
12555 goto LABEL_55; | |
12556 } | |
12557 return; | |
12558 } | |
12559 | |
12560 | |
12561 | |
12562 //----- (004B705E) -------------------------------------------------------- | |
12563 void TempleDialog() | |
12564 { | |
12565 GUIWindow *v0; // ebx@1 | |
12566 Player *v1; // esi@1 | |
12567 int v2; // edi@1 | |
12568 int result; // eax@4 | |
12569 GUIWindow *v4; // edi@6 | |
12570 void *v5; // eax@6 | |
12571 int v6; // eax@6 | |
12572 unsigned int v7; // eax@8 | |
12573 int v8; // ecx@8 | |
12574 unsigned int v9; // eax@9 | |
12575 int v10; // eax@11 | |
12576 int v11; // eax@12 | |
12577 GUIWindow *v12; // ecx@16 | |
12578 int v13; // edx@16 | |
12579 GUIButton *v14; // eax@19 | |
12580 GUIButton *v15; // edi@19 | |
12581 int v16; // eax@19 | |
12582 const char *v17; // eax@21 | |
12583 int v18; // eax@21 | |
12584 unsigned int v19; // ecx@21 | |
12585 int v20; // eax@21 | |
12586 unsigned __int16 v21; // ax@21 | |
12587 unsigned __int16 v22; // ST14_2@27 | |
12588 int v23; // eax@27 | |
12589 double v24; // st7@28 | |
12590 unsigned int v25; // ebx@28 | |
12591 DDM_DLV_Header *v26; // edi@29 | |
12592 int v27; // eax@31 | |
12593 int v28; // eax@32 | |
12594 //unsigned int v29; // ecx@34 | |
12595 unsigned int v30; // edx@36 | |
12596 unsigned int v31; // edx@38 | |
12597 unsigned int v32; // edx@40 | |
12598 unsigned int v33; // edx@42 | |
12599 unsigned int v34; // edx@44 | |
12600 int v35; // edi@50 | |
12601 signed int v36; // eax@50 | |
12602 unsigned __int8 v37; // al@54 | |
12603 int v38; // ecx@54 | |
12604 GUIWindow *v39; // eax@56 | |
12605 unsigned __int8 v40; // al@61 | |
12606 GUIButton *v41; // edi@64 | |
12607 int v42; // esi@66 | |
12608 GUIWindow *v43; // ecx@66 | |
12609 int v44; // edi@66 | |
12610 int v45; // eax@68 | |
12611 signed int v46; // edi@69 | |
12612 int v47; // edi@71 | |
12613 GUIButton *v48; // eax@73 | |
12614 const char *v49; // edx@73 | |
12615 GUIButton *v50; // esi@73 | |
12616 int v51; // eax@73 | |
12617 unsigned int v52; // ecx@73 | |
12618 unsigned __int16 v53; // ax@73 | |
12619 char a1[300]; // [sp+10h] [bp-1B4h]@64 | |
12620 GUIWindow v57; // [sp+13Ch] [bp-88h]@1 | |
12621 __int64 v58; // [sp+190h] [bp-34h]@1 | |
12622 __int64 v59; // [sp+198h] [bp-2Ch]@1 | |
12623 __int64 v60; // [sp+1A0h] [bp-24h]@1 | |
12624 GUIWindow *v61; // [sp+1ACh] [bp-18h]@6 | |
12625 unsigned int v62; // [sp+1B0h] [bp-14h]@8 | |
12626 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 | |
12627 int v64; // [sp+1B8h] [bp-Ch]@6 | |
12628 unsigned int v65; // [sp+1BCh] [bp-8h]@6 | |
12629 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 | |
12630 | |
12631 v0 = window_SpeakInHouse; | |
12632 memcpy(&v57, window_SpeakInHouse, sizeof(v57)); | |
12633 v57.uFrameX = 483; | |
12634 v57.uFrameWidth = 148; | |
12635 v57.uFrameZ = 334; | |
12636 HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | |
12637 HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
12638 v1 = pPlayers[uActiveCharacter]; | |
12639 //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); | |
12640 v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); | |
12641 HIDWORD(v60) = v2; | |
12642 if ( dialog_menu_id != 1 ) | |
12643 { | |
12644 if ( dialog_menu_id != 10 ) | |
12645 { | |
12646 if ( dialog_menu_id != 11 ) | |
12647 { | |
12648 | |
12649 if ( dialog_menu_id == 96 ) | |
12650 { | |
12651 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | |
12652 { | |
12653 v4 = pDialogueWindow; | |
12654 v61 = pDialogueWindow; | |
12655 v5 = window_SpeakInHouse->ptr_1C; | |
12656 v66 = 0; | |
12657 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); | |
12658 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); | |
12659 v6 = v1->GetMerchant(); | |
12660 v64 = (signed int)(v65 * (100 - v6)) / 100; | |
12661 if ( v64 < (signed int)v65 / 3 ) | |
12662 v64 = (signed int)v65 / 3; | |
12663 v7 = v4->pStartingPosActiveItem; | |
12664 v8 = v7 + v4->pNumPresenceButton; | |
12665 v65 = 0; | |
12666 v62 = v7; | |
12667 if ( (signed int)v7 >= v8 ) | |
12668 goto LABEL_78; | |
12669 do | |
12670 { | |
12671 v9 = v4->GetControl(v62)->uControlParam - 36; | |
12672 if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) | |
12673 { | |
12674 v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); | |
12675 v66 = (DDM_DLV_Header *)((char *)v66 + v10); | |
12676 ++v65; | |
12677 } | |
12678 v11 = v4->pStartingPosActiveItem; | |
12679 ++v62; | |
12680 } | |
12681 while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); | |
12682 if ( v65 ) | |
12683 { | |
12684 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); | |
12685 v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); | |
12686 v64 = (149 - (signed int)v66) / (signed int)v65; | |
12687 if ( v64 > 32 ) | |
12688 v64 = 32; | |
12689 v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; | |
12690 v12 = v61; | |
12691 result = v61->pStartingPosActiveItem; | |
12692 v13 = result + v61->pNumPresenceButton; | |
12693 v62 = v61->pStartingPosActiveItem; | |
12694 if ( result < v13 ) | |
12695 { | |
12696 v66 = (DDM_DLV_Header *)2; | |
12697 while ( 1 ) | |
12698 { | |
12699 v14 = v12->GetControl(v62); | |
12700 v15 = v14; | |
12701 v16 = v14->uControlParam - 36; | |
12702 if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) | |
12703 { | |
12704 v15->uW = 0; | |
12705 v15->uHeight = 0; | |
12706 v15->uY = 0; | |
12707 } | |
12708 else | |
12709 { | |
12710 v17 = pSkillNames[v16]; | |
12711 v15->uY = v64 + v65; | |
12712 HIDWORD(v60) = (uint32)v17; | |
12713 v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); | |
12714 v19 = v15->uY; | |
12715 v15->uHeight = v18; | |
12716 v20 = v19 + v18 - 1; | |
12717 v15->uW = v20; | |
12718 v65 = v20; | |
12719 v21 = WORD2(v59); | |
12720 if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) | |
12721 v21 = WORD2(v58); | |
12722 v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); | |
12723 } | |
12724 result = (int)v61; | |
12725 ++v62; | |
12726 v66 = (DDM_DLV_Header *)((char *)v66 + 1); | |
12727 if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) | |
12728 break; | |
12729 v12 = v61; | |
12730 } | |
12731 } | |
12732 } | |
12733 else | |
12734 { | |
12735 LABEL_78: | |
12736 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); | |
12737 strcat(pTmpBuf, "\n \n"); | |
12738 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); | |
12739 v22 = WORD2(v59); | |
12740 v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); | |
12741 result = (int)v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); | |
12742 } | |
12743 } | |
12744 } | |
12745 return; | |
12746 } | |
12747 | |
12748 // DONATION | |
12749 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; | |
12750 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | |
12751 v25 = 0; | |
12752 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) | |
12753 { | |
12754 Party::TakeGold((signed __int64)v24); | |
12755 v26 = &pOutdoor->ddm; | |
12756 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) | |
12757 v26 = &pIndoor->dlv; | |
12758 v27 = v26->uReputation; | |
12759 v66 = v26; | |
12760 if ( v27 > -5 ) | |
12761 { | |
12762 v28 = v27 - 1; | |
12763 v26->uReputation = v28; | |
12764 if ( v28 < -5 ) | |
12765 v26->uReputation = -5; | |
12766 } | |
12767 if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) | |
12768 { | |
12769 if ( v26->uReputation <= -5 ) | |
12770 { | |
12771 v30 = pParty->uDaysPlayed % 7 + 1; | |
12772 LOBYTE(v30) = v30 | 0x80; | |
12773 _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); | |
12774 } | |
12775 if ( v26->uReputation <= -10 ) | |
12776 { | |
12777 v31 = pParty->uDaysPlayed % 7 + 1; | |
12778 LOBYTE(v31) = v31 | 0x80; | |
12779 _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0); | |
12780 v26 = v66; | |
12781 } | |
12782 if ( v26->uReputation <= -15 ) | |
12783 { | |
12784 v32 = pParty->uDaysPlayed % 7 + 1; | |
12785 LOBYTE(v32) = v32 | 0x80; | |
12786 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0); | |
12787 v26 = v66; | |
12788 } | |
12789 if ( v26->uReputation <= -20 ) | |
12790 { | |
12791 v33 = pParty->uDaysPlayed % 7 + 1; | |
12792 LOBYTE(v33) = v33 | 0x80; | |
12793 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0); | |
12794 v26 = v66; | |
12795 } | |
12796 if ( v26->uReputation <= -25 ) | |
12797 { | |
12798 v34 = pParty->uDaysPlayed % 7 + 1; | |
12799 LOBYTE(v34) = v34 | 0x80; | |
12800 _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0); | |
12801 } | |
12802 } | |
12803 ++byte_F8B1EF[uActiveCharacter]; | |
12804 v1->PlaySound(SPEECH_83, 0); | |
12805 ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" | |
12806 goto LABEL_46; | |
12807 } | |
12808 goto LABEL_55; | |
12809 } | |
12810 if ( !v1->_4B6FF9() ) | |
12811 return; | |
12812 v25 = 0; | |
12813 if ( pParty->uNumGold < v2 ) | |
12814 { | |
12815 LABEL_55: | |
12816 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | |
12817 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); | |
12818 goto LABEL_46; | |
12819 } | |
12820 Party::TakeGold(v2); | |
12821 v35 = LODWORD(v1->pConditions[17]); | |
12822 v59 = v1->pConditions[14]; | |
12823 v58 = v1->pConditions[15]; | |
12824 v60 = v1->pConditions[16]; | |
12825 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]); | |
12826 memset(v1, 0, 0xA0u); | |
12827 v1->sHealth = v1->GetMaxHealth(); | |
12828 v1->sMana = v1->GetMaxMana(); | |
12829 v36 = (signed int)window_SpeakInHouse->ptr_1C; | |
12830 if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) | |
12831 { | |
12832 if ( (unsigned int)v61 | v35 ) | |
12833 { | |
12834 v37 = LOBYTE(v1->field_1928); | |
12835 v38 = v1->field_1924; | |
12836 v1->uFace = v37; | |
12837 v1->uVoiceID = v38; | |
12838 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); | |
12839 } | |
12840 goto LABEL_63; | |
12841 } | |
12842 v39 = v61; | |
12843 if ( (unsigned int)v61 | v35 ) | |
12844 { | |
12845 LODWORD(v1->pConditions[17]) = v35; | |
12846 } | |
12847 else | |
12848 { | |
12849 if ( !v60 && !v58 && !v59 ) | |
12850 goto LABEL_63; | |
12851 v1->field_1928 = v1->uFace; | |
12852 v1->field_1924 = v1->uVoiceID; | |
12853 v1->SetCondition(0x11u, 1); | |
12854 v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23; | |
12855 v40 = (v1->GetSexByVoice() != 0) + 23; | |
12856 v1->uFace = v40; | |
12857 ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); | |
12858 LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed); | |
12859 v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); | |
12860 } | |
12861 HIDWORD(v1->pConditions[17]) = (int)v39; | |
12862 LABEL_63: | |
12863 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); | |
12864 v1->PlaySound(SPEECH_82, 0); | |
12865 pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); | |
12866 LABEL_46: | |
12867 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); | |
12868 return ; // void func | |
12869 } | |
12870 v63 = 1; | |
12871 v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); | |
12872 strcpy(a1, ""); | |
12873 v41->uHeight = 0; | |
12874 v41->uY = 0; | |
12875 if ( v1->_4B6FF9() ) | |
12876 { | |
12877 sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); | |
12878 v63 = 0; | |
12879 } | |
12880 strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); | |
12881 strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]); | |
12882 v42 = v63; | |
12883 v43 = pDialogueWindow; | |
12884 v44 = v63; | |
12885 v66 = 0; | |
12886 if ( v63 < pDialogueWindow->pNumPresenceButton ) | |
12887 { | |
12888 v61 = (GUIWindow *)&a1[100 * v63]; | |
12889 do | |
12890 { | |
12891 v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); | |
12892 v66 = (DDM_DLV_Header *)((char *)v66 + v45); | |
12893 v43 = pDialogueWindow; | |
12894 v61 = (GUIWindow *)((char *)v61 + 100); | |
12895 ++v44; | |
12896 } | |
12897 while ( v44 < pDialogueWindow->pNumPresenceButton ); | |
12898 } | |
12899 v46 = v43->pNumPresenceButton - v42; | |
12900 v64 = (174 - (signed int)v66) / v46; | |
12901 if ( v64 > 32 ) | |
12902 v64 = 32; | |
12903 v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138; | |
12904 v65 = v42 + v43->pStartingPosActiveItem; | |
12905 if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton ) | |
12906 { | |
12907 v61 = (GUIWindow *)(v42 + 2); | |
12908 v66 = (DDM_DLV_Header *)&a1[100 * v42]; | |
12909 do | |
12910 { | |
12911 v48 = v43->GetControl(v65); | |
12912 v49 = (const char *)v66; | |
12913 v50 = v48; | |
12914 v48->uY = v64 + v47; | |
12915 v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0); | |
12916 v52 = v50->uY; | |
12917 v50->uHeight = v51; | |
12918 v47 = v52 + v51 - 1; | |
12919 v50->uW = v47; | |
12920 v53 = WORD2(v59); | |
12921 if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 ) | |
12922 v53 = WORD2(v58); | |
12923 v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u); | |
12924 v43 = pDialogueWindow; | |
12925 v66 = (DDM_DLV_Header *)((char *)v66 + 100); | |
12926 v61 = (GUIWindow *)((char *)v61 + 1); | |
12927 ++v65; | |
12928 } | |
12929 while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); | |
12930 } | |
12931 return; | |
12932 } | |
12933 | 11104 |
12934 | 11105 |
12935 | 11106 |
12936 //----- (004B6478) -------------------------------------------------------- | 11107 //----- (004B6478) -------------------------------------------------------- |
12937 int __cdecl sub_4B6478() | 11108 int __cdecl sub_4B6478() |
14114 if ( v23 ) | 12285 if ( v23 ) |
14115 uCurrentHouse_Animation = v23; | 12286 uCurrentHouse_Animation = v23; |
14116 return result; | 12287 return result; |
14117 } | 12288 } |
14118 | 12289 |
14119 //----- (0044606A) -------------------------------------------------------- | |
14120 void PrepareHouse(HOUSE_ID house) | |
14121 { | |
14122 //unsigned int v1; // ebx@1 | |
14123 //signed int v2; // esi@1 | |
14124 //int uExitPic; // edi@1 | |
14125 __int16 uExitMapID; // ax@2 | |
14126 //int result; // eax@5 | |
14127 //unsigned int *v6; // ecx@8 | |
14128 int v7; // ebx@11 | |
14129 //int v8; // esi@16 | |
14130 //unsigned int v9; // eax@16 | |
14131 //unsigned int v10; // eax@19 | |
14132 //int v11; // ecx@19 | |
14133 //char pContainer[36]; // [sp+Ch] [bp-54h]@16 | |
14134 int v13; // [sp+30h] [bp-30h]@11 | |
14135 int Dst[6]; // [sp+34h] [bp-2Ch]@1 | |
14136 //unsigned int v15; // [sp+4Ch] [bp-14h]@1 | |
14137 int uAnimationID; // [sp+50h] [bp-10h]@1 | |
14138 //unsigned int *v17; // [sp+54h] [bp-Ch]@3 | |
14139 //unsigned int v18; // [sp+58h] [bp-8h]@1 | |
14140 //int v19; // [sp+5Ch] [bp-4h]@7 | |
14141 | |
14142 //v15 = uHouseID; | |
14143 //v1 = 52 * uHouseID; | |
14144 //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; | |
14145 uAnimationID = p2DEvents[house - 1].uAnimationID; | |
14146 //v18 = 52 * uHouseID; | |
14147 memset(Dst, 0, 0x18u); | |
14148 //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); | |
14149 //uExitPic = p2DEvents[uHouseID - 1].uExitPicID; | |
14150 uNumDialogueNPCPortraits = 0; | |
14151 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; | |
14152 if ( uHouse_ExitPic ) | |
14153 { | |
14154 //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); | |
14155 uExitMapID = p2DEvents[house - 1]._quest_related; | |
14156 if ( uExitMapID > 0 ) | |
14157 { | |
14158 //v17 = (unsigned int *)(uExitMapID - 1); | |
14159 if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) | |
14160 // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) ) | |
14161 { | |
14162 //uExitPic = 0; | |
14163 uHouse_ExitPic = 0; | |
14164 } | |
14165 } | |
14166 } | |
14167 | |
14168 dword_591080 = pAnimatedRooms[uAnimationID].field_8; | |
14169 //result = dword_591080; | |
14170 | |
14171 //v2 = 0; | |
14172 uNumDialogueNPCPortraits = 0; | |
14173 if ( dword_591080 ) | |
14174 { | |
14175 //v2 = 1; | |
14176 Dst[0] = dword_591080; | |
14177 uNumDialogueNPCPortraits = 1; | |
14178 } | |
14179 | |
14180 //v19 = 1; | |
14181 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
14182 { | |
14183 auto npc = pNPCStats->pNewNPCData + i; | |
14184 //v6 = &pNPCStats->pNewNPCData[1].uFlags; | |
14185 //v17 = &pNPCStats->pNewNPCData[1].uFlags; | |
14186 //do | |
14187 //{ | |
14188 if (npc->Location2D == house ) | |
14189 { | |
14190 if (~npc->uFlags & 0x80) | |
14191 //if ( !(*(char *)v6 & 0x80) ) | |
14192 { | |
14193 v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; | |
14194 HouseNPCData[v7] = npc; | |
14195 //v6 = v17; | |
14196 //*(&v13 + v2) = *(v17 - 1); | |
14197 Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; | |
14198 //v1 = v18; | |
14199 if ((npc->uFlags & 3) != 2) | |
14200 ++npc->uFlags; | |
14201 } | |
14202 } | |
14203 //++v19; | |
14204 //v6 += 19; | |
14205 //v17 = v6; | |
14206 //} | |
14207 //while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); | |
14208 } | |
14209 //uNumDialogueNPCPortraits = v2; | |
14210 | |
14211 //v19 = 0; | |
14212 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) | |
14213 //if ( v2 > 0 ) | |
14214 { | |
14215 //do | |
14216 //{ | |
14217 //v8 = v19; | |
14218 char icon_name[128]; | |
14219 sprintfex(icon_name, "npc%03u", Dst[i]); | |
14220 //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
14221 //++v19; | |
14222 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); | |
14223 //result = v19; | |
14224 //} | |
14225 //while ( v19 < uNumDialogueNPCPortraits ); | |
14226 //uExitPic = uHouse_ExitPic; | |
14227 } | |
14228 | |
14229 if (uHouse_ExitPic) | |
14230 { | |
14231 //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); | |
14232 //v11 = uNumDialogueNPCPortraits++; | |
14233 pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); | |
14234 //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); | |
14235 //result = p2DEvents[house - 1].uExitMapID; | |
14236 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; | |
14237 } | |
14238 //return result; | |
14239 } | |
14240 | |
14241 | |
14242 | |
14243 //----- (0044622E) -------------------------------------------------------- | |
14244 bool EnterHouse(enum HOUSE_ID uHouseID) | |
14245 { | |
14246 //enum HOUSE_ID v1; // edi@1 | |
14247 //int v2; // edi@5 | |
14248 signed int uOpenTime; // eax@5 | |
14249 signed int uCloseTime; // esi@5 | |
14250 unsigned int v5; // esi@5 | |
14251 int v6; // edx@5 | |
14252 signed int am_pm_flag_open; // ecx@10 | |
14253 signed int am_pm_flag_close; // eax@10 | |
14254 int v9; // esi@10 | |
14255 //unsigned int v10; // esi@16 | |
14256 int v11; // ecx@17 | |
14257 unsigned int v12; // kr00_4@25 | |
14258 //Player *v13; // esi@25 | |
14259 int v14; // eax@25 | |
14260 //Player *v15; // esi@27 | |
14261 //signed int v16; // eax@32 | |
14262 unsigned int v17; // eax@37 | |
14263 signed int v18; // edi@37 | |
14264 signed int v19; // edi@41 | |
14265 //unsigned int v20; // ecx@41 | |
14266 //const char *v22; // [sp-4h] [bp-40h]@33 | |
14267 char pContainer[40]; // [sp+Ch] [bp-30h]@32 | |
14268 unsigned int v24; // [sp+34h] [bp-8h]@5 | |
14269 //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1 | |
14270 | |
14271 //v1 = uHouseID; | |
14272 //v25 = uHouseID; | |
14273 GameUI_StatusBar_TimedString[0] = 0; | |
14274 pStatusBarString[0] = 0; | |
14275 ShowStatusBarString("", 2u); | |
14276 if ( pMessageQueue_50CBD0->uNumMessages ) | |
14277 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
14278 viewparams->bRedrawGameUI = 1; | |
14279 uDialogueType = 0; | |
14280 pKeyActionMap->_459ED1(3); | |
14281 pKeyActionMap->ResetKeys(); | |
14282 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) | |
14283 { | |
14284 GameOverMenu(0); | |
14285 return 0; | |
14286 } | |
14287 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; | |
14288 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; | |
14289 ptr_F8B1E8 = 0; | |
14290 dword_F8B1E4 = 0; | |
14291 dword_F8B1F4 = 0; | |
14292 memset(byte_F8B1F0, 0, 4); | |
14293 memset(byte_F8B148, 0, 16); | |
14294 pRenderer->ClearZBuffer(0, 479); | |
14295 | |
14296 if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| | |
14297 ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) | |
14298 | |
14299 { | |
14300 am_pm_flag_open = 0; | |
14301 am_pm_flag_close = 0; | |
14302 if (uOpenTime > 12 ) | |
14303 { | |
14304 uOpenTime -= 12; | |
14305 am_pm_flag_open = 1; | |
14306 } | |
14307 if ( uCloseTime > 12 ) | |
14308 { | |
14309 uCloseTime -= 12; | |
14310 am_pm_flag_close = 1; | |
14311 } | |
14312 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], | |
14313 uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" | |
14314 ShowStatusBarString(pTmpBuf, 2u); | |
14315 if ( uActiveCharacter ) | |
14316 pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); | |
14317 return 0; | |
14318 } | |
14319 else | |
14320 { | |
14321 //v10 = uHouseID; | |
14322 if ( (signed int)uHouseID < 53 ) //entering shops and guilds | |
14323 { | |
14324 if ( !(pParty->field_3C._shop_ban_times[uHouseID]) | |
14325 || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) | |
14326 { | |
14327 pParty->field_3C._shop_ban_times[uHouseID] = 0; | |
14328 } | |
14329 else | |
14330 { | |
14331 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" | |
14332 return 0; | |
14333 } | |
14334 } | |
14335 if ( !start_event_seq_number ) | |
14336 pAudioPlayer->StopChannels(-1, -1); | |
14337 | |
14338 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; | |
14339 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; | |
14340 if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail | |
14341 { | |
14342 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; | |
14343 uHouseID = HOUSE_JAIL; | |
14344 pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000; | |
14345 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType; | |
14346 ++pParty->uNumPrisonTerms; | |
14347 pParty->uFine = 0; | |
14348 for (uint i = 0; i < 4; ++i) | |
14349 { | |
14350 pParty->pPlayers[i].uTimeToRecovery = 0; | |
14351 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; | |
14352 pParty->pPlayers[i].SetVariable(VAR_Award, 87); | |
14353 } | |
14354 } | |
14355 ++pIcons_LOD->uTexturePacksCount; | |
14356 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
14357 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
14358 switch (pParty->alignment) | |
14359 { | |
14360 case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; | |
14361 case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; | |
14362 case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; | |
14363 default: assert(false); | |
14364 } | |
14365 | |
14366 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
14367 pDialogueNPCCount = 0; | |
14368 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; | |
14369 uTextureID_507B04 = uTextureID_right_panel; | |
14370 PrepareHouse(uHouseID); | |
14371 v18 = 1; | |
14372 uTextureID_507B04 = uTextureID_right_panel; | |
14373 if ( uNumDialogueNPCPortraits == 1 ) | |
14374 pDialogueNPCCount = 1; | |
14375 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
14376 dword_5C35D4 = 1; | |
14377 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) | |
14378 { | |
14379 if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) | |
14380 { | |
14381 return 1; | |
14382 } | |
14383 } | |
14384 else | |
14385 { //guilds | |
14386 v19 = guild_mambership_flags[uHouseID-139]; //guilds flags | |
14387 //v20 = uHouseID; | |
14388 //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) | |
14389 if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19)) | |
14390 { | |
14391 HousePlaySomeSound(uHouseID, 3); | |
14392 return 1; | |
14393 } | |
14394 } | |
14395 HousePlaySomeSound(uHouseID, 1); | |
14396 dword_5C35D4 = 1; | |
14397 return 1; | |
14398 } | |
14399 } |