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