comparison mm7_2.cpp @ 775:7994986603d5

Moved some subs
author Nomad
date Sat, 23 Mar 2013 21:40:30 +0200
parents 45615cacad31
children c47efaf23642 b27dd658ea77
comparison
equal deleted inserted replaced
774:c319601893af 775:7994986603d5
820 pGlobalTXT_LocalizationStrings[74], //"End Conversation" 820 pGlobalTXT_LocalizationStrings[74], //"End Conversation"
821 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); 821 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
822 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); 822 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0);
823 } 823 }
824 824
825 //----- (004BCACC) --------------------------------------------------------
826 void __fastcall OnSelectShopDialogueOption(signed int uMessageParam)
827 {
828 //unsigned int v1; // edi@1
829 //signed int v2; // ebx@1
830 //signed int v3; // ecx@2
831 int v4; // eax@5
832 signed int v5; // esi@5
833 //Player *v6; // ecx@5
834 //signed int v7; // edx@5
835 GUIWindow *v8; // esi@10
836 unsigned int v9; // eax@12
837 int v10; // esi@31
838 int v11; // edi@31
839 int v12; // esi@32
840 __int16 v13; // bp@32
841 int v14; // edx@32
842 GUIWindow *v15; // eax@32
843 int v16; // eax@32
844 int v17; // eax@33
845 int v18; // eax@34
846 int v19; // eax@35
847 __int16 v20; // ax@37
848 __int16 v21; // ax@76
849 __int16 v22; // ax@107
850 __int16 v23; // ax@132
851 __int16 v24; // ax@163
852 int v25; // esi@190
853 __int16 v26; // ax@190
854 char v27; // zf@190
855 Player *v28; // edi@192
856 int v29; // eax@204
857 void *v30; // esi@208
858 unsigned __int64 v31; // qax@208
859 signed int v32; // edi@209
860 int v33; // eax@210
861 unsigned int v34; // eax@211
862 Player *v35; // edi@227
863 signed int v36; // esi@227
864 int v37; // ecx@227
865 int v38; // esi@230
866 int v39; // edx@235
867 int v40; // edi@243
868 unsigned __int64 v41; // qax@243
869 void *v42; // eax@244
870 signed int v43; // edi@244
871 int v44; // edx@244
872 int v45; // eax@246
873 unsigned int v46; // eax@247
874 void *v47; // eax@250
875 signed int v48; // edi@250
876 int v49; // eax@252
877 int v50; // eax@256
878 unsigned int v51; // eax@257
879 void *v52; // eax@260
880 signed int v53; // edi@260
881 int v54; // eax@262
882 //signed int v55; // [sp+10h] [bp-10h]@1
883 int v56; // [sp+14h] [bp-Ch]@31
884
885 //v1 = 0;
886 //v2 = a1;
887 //v55 = a1;
888 if ( !pDialogueWindow->pNumPresenceButton )
889 return;
890 pRenderer->ClearZBuffer(0, 479);
891 //v3 = dword_F8B198;
892 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
893 {
894 v8 = window_SpeakInHouse;
895 }
896 //else
897 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
898 {
899 if ( in_current_building_type == BildingType_Training )
900 {
901 if ( uMessageParam == 17 )
902 {
903 v4 = 0;
904 v5 = 0;
905 //v6 = pPlayers[uActiveCharacter];
906 //v7 = pPlayers[uActiveCharacter]->uLevel;
907 if ( pPlayers[uActiveCharacter]->uLevel > 0 )
908 {
909 do
910 v4 += v5++ + 1;
911 while ( v5 < pPlayers[uActiveCharacter]->uLevel );
912 }
913 if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] &&
914 (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4)
915 return;
916 }
917 pDialogueWindow->Release();
918 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
919 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
920 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
921 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
922 // LABEL_10:
923 //v3 = dword_F8B198;
924 v8 = window_SpeakInHouse;
925 }
926 //else
927 if ( in_current_building_type != BildingType_Training )
928 {
929 v8 = window_SpeakInHouse;
930 if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) &&
931 array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][uMessageParam - 1]].pSchedule[pParty->uDaysPlayed % 7]
932 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
933 {
934 //LABEL_9:
935 pDialogueWindow->Release();
936 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0);
937 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
938 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
939 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr);
940 // LABEL_10:
941 //v3 = dword_F8B198;
942 v8 = window_SpeakInHouse;
943 }
944 else if (uActiveCharacter)
945 {
946 if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
947 return;
948 v8 = window_SpeakInHouse;
949 }
950 }
951 //LABEL_11:
952 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
953 if ( in_current_building_type < BildingType_19 )
954 {
955 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
956 //v3 = dword_F8B198;
957 ShopTexture = &pIcons_LOD->pTextures[v9];
958 //LABEL_13:
959 v8 = window_SpeakInHouse;
960 }
961 }
962
963 //NEW
964 switch(in_current_building_type)
965 {
966 case 5:
967 case 6:
968 case 7:
969 case 8:
970 case 9:
971 case 10:
972 case 11:
973 case 12:
974 case 13:
975 case 14:
976 case 15:
977 case 16:
978 {
979 if ( (signed __int64)__PAIR__(
980 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
981 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
982 {
983 v32 = 0;
984 do
985 {
986 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
987 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
988 if ( v33 )
989 {
990 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
991 v8 = window_SpeakInHouse;
992 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
993 }
994 ++v32;
995 }
996 while ( v32 < 12 );
997 }
998 else
999 {
1000 SpellBookGenerator();
1001 v30 = window_SpeakInHouse->ptr_1C;
1002 v31 = pParty->uTimePlayed
1003 + (signed __int64)((double)(0xA8C000
1004 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
1005 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
1006 * 0.033333335);
1007 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
1008 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
1009 }
1010 return;
1011 break;
1012 }
1013 case 17:
1014 {
1015 if ( uMessageParam == 99 )
1016 {
1017 v10 = (int)((char *)v8->ptr_1C - 102);
1018 v56 = v10;
1019 v11 = 8 * v10 + 11325428;
1020 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
1021 {
1022 v13 = 0;
1023 }
1024 else
1025 {
1026 v12 = v10;
1027 v13 = 0;
1028 pParty->field_75A[v12] = 0;
1029 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
1030 v14 = rand() % 258;
1031 v15 = window_SpeakInHouse;
1032 pParty->field_750[v12] = v14 + 1;
1033 v16 = (int)((char *)v15->ptr_1C - 102);
1034 if ( v16 )
1035 {
1036 v17 = v16 - 1;
1037 if ( v17 )
1038 {
1039 v18 = v17 - 1;
1040 if ( v18 )
1041 {
1042 v19 = v18 - 1;
1043 if ( v19 )
1044 {
1045 if ( v19 == 1 )
1046 {
1047 while ( 1 )
1048 {
1049 v20 = pParty->field_750[v12];
1050 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
1051 {
1052 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
1053 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
1054 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
1055 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
1056 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
1057 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
1058 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
1059 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
1060 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
1061 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
1062 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
1063 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
1064 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
1065 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
1066 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
1067 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
1068 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
1069 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
1070 break;
1071 }
1072 pParty->field_750[v12] = rand() % 258 + 1;
1073 }
1074 }
1075 }
1076 else
1077 {
1078 while ( 1 )
1079 {
1080 v21 = pParty->field_750[v12];
1081 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
1082 {
1083 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
1084 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
1085 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
1086 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
1087 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
1088 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
1089 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
1090 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
1091 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
1092 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
1093 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
1094 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
1095 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
1096 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
1097 break;
1098 }
1099 pParty->field_750[v12] = rand() % 258 + 1;
1100 }
1101 }
1102 }
1103 else
1104 {
1105 while ( 1 )
1106 {
1107 v22 = pParty->field_750[v12];
1108 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
1109 {
1110 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
1111 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
1112 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
1113 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
1114 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
1115 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
1116 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
1117 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
1118 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
1119 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
1120 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
1121 break;
1122 }
1123 pParty->field_750[v12] = rand() % 258 + 1;
1124 }
1125 }
1126 }
1127 else
1128 {
1129 while ( 1 )
1130 {
1131 v23 = pParty->field_750[v12];
1132 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
1133 {
1134 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
1135 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
1136 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
1137 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
1138 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
1139 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
1140 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
1141 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
1142 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
1143 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
1144 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
1145 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
1146 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
1147 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
1148 break;
1149 }
1150 pParty->field_750[v12] = rand() % 258 + 1;
1151 }
1152 }
1153 }
1154 else
1155 {
1156 while ( 1 )
1157 {
1158 v24 = pParty->field_750[v12];
1159 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1160 {
1161 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
1162 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1163 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1164 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1165 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1166 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1167 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
1168 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
1169 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1170 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
1171 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
1172 break;
1173 }
1174 pParty->field_750[v12] = rand() % 258 + 1;
1175 }
1176 }
1177 v10 = v56;
1178 }
1179 v25 = v10;
1180 v26 = pParty->field_750[v25];
1181 v27 = pParty->field_75A[v25] == v13;
1182 word_F8B1A0 = pParty->field_750[v25];
1183 if ( v27 )
1184 {
1185 //v1 = 0;
1186 v27 = v26 == v13;
1187 v29 = (int)pNPCTopics[351].pText;
1188 if ( v27 )
1189 v29 = (int)pNPCTopics[353].pText;
1190 dword_F8B1A4 = (char *)v29;
1191 }
1192 else
1193 {
1194 if ( v26 != v13 )
1195 {
1196 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
1197 v28 = pParty->pPlayers;
1198 do
1199 {
1200 v28->SetVariable(VAR_Award, 86);
1201 ++v28;
1202 }
1203 while ( (signed int)v28 < (signed int)pParty->pHirelings );
1204 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
1205 pParty->field_750[v25] = v13;
1206 pParty->field_75A[v25] = v13;
1207 }
1208 //v1 = 0;
1209 dword_F8B1A4 = pNPCTopics[352].pText;
1210 }
1211 }
1212 else if ( uMessageParam == 100 )
1213 {
1214 pKeyActionMap->EnterText(1, 10, v8);
1215 }
1216 break;
1217 }
1218 case 22:
1219 {
1220 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
1221 pKeyActionMap->EnterText(1, 10, v8);
1222 return;
1223 break;
1224 }
1225 case 1:
1226 case 2:
1227 case 3:
1228 case 4:
1229 case 21:
1230 case 23:
1231 case 30:
1232 {
1233 break;
1234 }
1235 default:
1236 {
1237 return;
1238 break;
1239 }
1240 }
1241
1242 /*
1243 if ( in_current_building_type > BildingType_Tavern )
1244 {
1245 if ( in_current_building_type == BildingType_Bank )
1246 {
1247 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
1248 pKeyActionMap->EnterText(1, 10, v8);
1249 return;
1250 }
1251 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training )
1252 return;
1253 }
1254 //else
1255 if ( in_current_building_type < BildingType_Tavern )
1256 {
1257 if (in_current_building_type <= 0)
1258 return;
1259 if ( in_current_building_type > BildingType_AlchemistShop )
1260 {
1261 if ( in_current_building_type <= BildingType_16 )
1262 {
1263 if ( (signed __int64)__PAIR__(
1264 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472],
1265 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed )
1266 {
1267 v32 = 0;
1268 do
1269 {
1270 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C));
1271 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID;
1272 if ( v33 )
1273 {
1274 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE);
1275 v8 = window_SpeakInHouse;
1276 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34];
1277 }
1278 ++v32;
1279 }
1280 while ( v32 < 12 );
1281 }
1282 else
1283 {
1284 SpellBookGenerator();
1285 v30 = window_SpeakInHouse->ptr_1C;
1286 v31 = pParty->uTimePlayed
1287 + (signed __int64)((double)(0xA8C000
1288 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
1289 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
1290 * 0.033333335);
1291 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31;
1292 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31);
1293 }
1294 return;
1295 }
1296 if ( in_current_building_type != BildingType_TownHall )
1297 return;
1298 if ( in_current_building_type == BildingType_TownHall )
1299 {
1300 if ( uMessageParam == 99 )
1301 {
1302 v10 = (int)((char *)v8->ptr_1C - 102);
1303 v56 = v10;
1304 v11 = 8 * v10 + 11325428;
1305 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed )
1306 {
1307 v13 = 0;
1308 }
1309 else
1310 {
1311 v12 = v10;
1312 v13 = 0;
1313 pParty->field_75A[v12] = 0;
1314 *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
1315 v14 = rand() % 258;
1316 v15 = window_SpeakInHouse;
1317 pParty->field_750[v12] = v14 + 1;
1318 v16 = (int)((char *)v15->ptr_1C - 102);
1319 if ( v16 )
1320 {
1321 v17 = v16 - 1;
1322 if ( v17 )
1323 {
1324 v18 = v17 - 1;
1325 if ( v18 )
1326 {
1327 v19 = v18 - 1;
1328 if ( v19 )
1329 {
1330 if ( v19 == 1 )
1331 {
1332 while ( 1 )
1333 {
1334 v20 = pParty->field_750[v12];
1335 if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u )
1336 {
1337 if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u)
1338 && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u)
1339 && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu)
1340 && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u)
1341 && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u)
1342 && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du)
1343 && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu)
1344 && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u)
1345 && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u)
1346 && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu)
1347 && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u)
1348 && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u)
1349 && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u)
1350 && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du)
1351 && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu)
1352 && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu)
1353 && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u)
1354 && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) )
1355 break;
1356 }
1357 pParty->field_750[v12] = rand() % 258 + 1;
1358 }
1359 }
1360 }
1361 else
1362 {
1363 while ( 1 )
1364 {
1365 v21 = pParty->field_750[v12];
1366 if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u )
1367 {
1368 if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u)
1369 && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u)
1370 && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu)
1371 && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u)
1372 && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u)
1373 && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du)
1374 && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u)
1375 && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u)
1376 && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u)
1377 && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u)
1378 && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u)
1379 && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu)
1380 && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u)
1381 && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) )
1382 break;
1383 }
1384 pParty->field_750[v12] = rand() % 258 + 1;
1385 }
1386 }
1387 }
1388 else
1389 {
1390 while ( 1 )
1391 {
1392 v22 = pParty->field_750[v12];
1393 if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u )
1394 {
1395 if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u)
1396 && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u)
1397 && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu)
1398 && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u)
1399 && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u)
1400 && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du)
1401 && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u)
1402 && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u)
1403 && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu)
1404 && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u)
1405 && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) )
1406 break;
1407 }
1408 pParty->field_750[v12] = rand() % 258 + 1;
1409 }
1410 }
1411 }
1412 else
1413 {
1414 while ( 1 )
1415 {
1416 v23 = pParty->field_750[v12];
1417 if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u )
1418 {
1419 if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u)
1420 && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u)
1421 && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu)
1422 && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u)
1423 && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u)
1424 && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du)
1425 && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u)
1426 && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u)
1427 && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u)
1428 && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu)
1429 && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu)
1430 && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu)
1431 && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u)
1432 && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) )
1433 break;
1434 }
1435 pParty->field_750[v12] = rand() % 258 + 1;
1436 }
1437 }
1438 }
1439 else
1440 {
1441 while ( 1 )
1442 {
1443 v24 = pParty->field_750[v12];
1444 if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u )
1445 {
1446 if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu)
1447 && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u)
1448 && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu)
1449 && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u)
1450 && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u)
1451 && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du)
1452 && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu)
1453 && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u)
1454 && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu)
1455 && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu)
1456 && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) )
1457 break;
1458 }
1459 pParty->field_750[v12] = rand() % 258 + 1;
1460 }
1461 }
1462 v10 = v56;
1463 }
1464 v25 = v10;
1465 v26 = pParty->field_750[v25];
1466 v27 = pParty->field_75A[v25] == v13;
1467 word_F8B1A0 = pParty->field_750[v25];
1468 if ( v27 )
1469 {
1470 //v1 = 0;
1471 v27 = v26 == v13;
1472 v29 = (int)pNPCTopics[351].pText;
1473 if ( v27 )
1474 v29 = (int)pNPCTopics[353].pText;
1475 dword_F8B1A4 = (char *)v29;
1476 }
1477 else
1478 {
1479 if ( v26 != v13 )
1480 {
1481 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0);
1482 v28 = pParty->pPlayers;
1483 do
1484 {
1485 v28->SetVariable(VAR_Award, 86);
1486 ++v28;
1487 }
1488 while ( (signed int)v28 < (signed int)pParty->pHirelings );
1489 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel;
1490 pParty->field_750[v25] = v13;
1491 pParty->field_75A[v25] = v13;
1492 }
1493 //v1 = 0;
1494 dword_F8B1A4 = pNPCTopics[352].pText;
1495 }
1496 }
1497 else if ( uMessageParam == 100 )
1498 {
1499 pKeyActionMap->EnterText(1, 10, v8);
1500 }
1501 }
1502 }
1503 }
1504 */
1505
1506
1507 //LABEL_196:
1508 switch ( uMessageParam )
1509 {
1510 case 96:
1511 {
1512 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1513 UI_CreateEndConversationButton();
1514 FillAviableSkillsToTeach(in_current_building_type);
1515 break;
1516 }
1517 case 101:
1518 {
1519 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1520 UI_CreateEndConversationButton();
1521 sub_4B3A72(in_current_building_type);
1522 break;
1523 }
1524 case 102:
1525 case 103:
1526 {
1527 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1528 break;
1529 }
1530 case 104:
1531 {
1532 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
1533 {
1534 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29;
1535 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
1536 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
1537 ++pMessageQueue_50CBD0->uNumMessages;
1538 }*/
1539 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
1540 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
1541 break;
1542 }
1543 case 2:
1544 case 95:
1545 {
1546 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
1547 {
1548 GenerateStandartShopItems();
1549 GenerateSpecialShopItems();
1550 v8 = window_SpeakInHouse;
1551 v40 = window_SpeakInHouse->par1C;
1552 //v3 = dword_F8B198;
1553 v41 = pParty->uTimePlayed
1554 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
1555 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
1556 * 0.033333335);
1557 pParty->field_3C.field_50[v40] = v41;
1558 }
1559 v42 = v8->ptr_1C;
1560 v43 = 0;
1561 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
1562 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
1563 if ( uMessageParam == 2 )
1564 {
1565 if ( uItemsAmountPerShopType[v44] )
1566 {
1567 do
1568 {
1569 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
1570 if ( v45 )
1571 {
1572 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
1573 //v3 = dword_F8B198;
1574 v8 = window_SpeakInHouse;
1575 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
1576 }
1577 v42 = v8->ptr_1C;
1578 ++v43;
1579 }
1580 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1581 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1582 }
1583 if ( in_current_building_type == BildingType_WeaponShop )
1584 {
1585 v47 = v8->ptr_1C;
1586 v48 = 0;
1587 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1588 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1589 {
1590 do
1591 {
1592 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
1593 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID)
1594 {
1595 v49 = rand();
1596 v8 = window_SpeakInHouse;
1597 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
1598 }
1599 v47 = v8->ptr_1C;
1600 ++v48;
1601 }
1602 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1603 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1604 }
1605 }
1606 }
1607 if ( uMessageParam == 95 )
1608 {
1609 if ( uItemsAmountPerShopType[v44] )
1610 {
1611 do
1612 {
1613 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
1614 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
1615 if ( v50 )
1616 {
1617 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
1618 //v3 = dword_F8B198;
1619 v8 = window_SpeakInHouse;
1620 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
1621 }
1622 v42 = v8->ptr_1C;
1623 ++v43;
1624 }
1625 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1626 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1627 }
1628 if ( in_current_building_type == BildingType_WeaponShop )
1629 {
1630 v52 = v8->ptr_1C;
1631 v53 = 0;
1632 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1633 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1634 {
1635 do
1636 {
1637 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
1638 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
1639 {
1640 v54 = rand();
1641 v8 = window_SpeakInHouse;
1642 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
1643 }
1644 v52 = v8->ptr_1C;
1645 ++v53;
1646 }
1647 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1648 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
1649 }
1650 }
1651 }
1652 break;
1653 }
1654 case 3:
1655 case 4:
1656 case 5:
1657 {
1658 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1659 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1660 break;
1661 }
1662 case 94:
1663 {
1664 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1665 UI_CreateEndConversationButton();
1666 sub_4B3AD4(in_current_building_type);
1667 break;
1668 }
1669 default:
1670 {
1671 if( uMessageParam >= 36 && uMessageParam <= 72 )
1672 {
1673 v35 = pPlayers[uActiveCharacter];
1674 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
1675 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
1676 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1677 if ( v37 < v36 / 3 )
1678 v37 = v36 / 3;
1679
1680 __debugbreak();
1681 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
1682 // or
1683 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
1684 // or
1685 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
1686
1687 //if (false)
1688 if(byte_4ED970_skill_learn_ability_by_class_table[v35->classType][uMessageParam-36])
1689 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
1690 {
1691 v38 = (int)(&v35->uIntelligence + uMessageParam);
1692 if ( !*(short *)v38 )
1693 {
1694 if ( pParty->uNumGold < v37 )
1695 {
1696 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
1697 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
1698 v39 = 4;
1699 else
1700 v39 = 2;
1701 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39);
1702 }
1703 else
1704 {
1705 Party::TakeGold(v37);
1706 dword_F8B1E4 = 1;
1707 *(short *)v38 = 1;
1708 v35->PlaySound(SPEECH_78, 0);
1709 }
1710 }
1711 }
1712 }
1713 break;
1714 }
1715 }
1716 /*
1717 if ( uMessageParam != 95 && uMessageParam != 2 )
1718 {
1719 if ( uMessageParam == 3 )
1720 {
1721 dialog_menu_id = 3;
1722 }
1723 else
1724 {
1725 if ( uMessageParam == 4 )
1726 {
1727 dialog_menu_id = 4;
1728 }
1729 else
1730 {
1731 if ( uMessageParam != 5 )
1732 {
1733 if ( uMessageParam > 35 )
1734 {
1735 if ( uMessageParam <= 72 )
1736 {
1737 v35 = pPlayers[uActiveCharacter];
1738 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
1739 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
1740 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
1741 if ( v37 < v36 / 3 )
1742 v37 = v36 / 3;
1743
1744 __debugbreak();
1745 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
1746 // or
1747 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
1748 // or
1749 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
1750
1751 if (false)
1752 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
1753 {
1754 v38 = (int)(&v35->uIntelligence + uMessageParam);
1755 if ( !*(short *)v38 )
1756 {
1757 if ( pParty->uNumGold < v37 )
1758 {
1759 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
1760 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern )
1761 v39 = 4;
1762 else
1763 v39 = 2;
1764 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39);
1765 }
1766 else
1767 {
1768 Party::TakeGold(v37);
1769 dword_F8B1E4 = 1;
1770 *(short *)v38 = 1;
1771 v35->PlaySound(SPEECH_78, 0);
1772 }
1773 }
1774 }
1775 }
1776 else
1777 {
1778 if ( uMessageParam == 94 )
1779 {
1780 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1781 UI_CreateEndConversationButton();
1782 sub_4B3AD4(in_current_building_type);
1783 }
1784 }
1785 }
1786 return;
1787 }
1788 dialog_menu_id = 5;
1789 }
1790 }
1791 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1792 return;
1793 }
1794 if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed )
1795 {
1796 GenerateStandartShopItems();
1797 GenerateSpecialShopItems();
1798 v8 = window_SpeakInHouse;
1799 v40 = window_SpeakInHouse->par1C;
1800 //v3 = dword_F8B198;
1801 v41 = pParty->uTimePlayed
1802 //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C])
1803 + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C)
1804 * 0.033333335);
1805 pParty->field_3C.field_50[v40] = v41;
1806
1807 }
1808 v42 = v8->ptr_1C;
1809 v43 = 0;
1810 //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C];
1811 v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType;
1812 if ( uMessageParam == 2 )
1813 {
1814 if ( uItemsAmountPerShopType[v44] )
1815 {
1816 do
1817 {
1818 v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID;
1819 if ( v45 )
1820 {
1821 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE);
1822 //v3 = dword_F8B198;
1823 v8 = window_SpeakInHouse;
1824 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46];
1825 }
1826 v42 = v8->ptr_1C;
1827 ++v43;
1828 }
1829 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1830 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1831 }
1832 if ( in_current_building_type == BildingType_WeaponShop )
1833 {
1834 v47 = v8->ptr_1C;
1835 v48 = 0;
1836 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1837 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1838 {
1839 do
1840 {
1841 // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] )
1842 if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID);
1843 {
1844 v49 = rand();
1845 v8 = window_SpeakInHouse;
1846 word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight);
1847 }
1848 v47 = v8->ptr_1C;
1849 ++v48;
1850 }
1851 //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1852 while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1853 }
1854 }
1855 }
1856 if ( uMessageParam == 95 )
1857 {
1858 if ( uItemsAmountPerShopType[v44] )
1859 {
1860 do
1861 {
1862 //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724];
1863 v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID;
1864 if ( v50 )
1865 {
1866 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE);
1867 //v3 = dword_F8B198;
1868 v8 = window_SpeakInHouse;
1869 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51];
1870 }
1871 v42 = v8->ptr_1C;
1872 ++v43;
1873 }
1874 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1875 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] );
1876 }
1877 if ( in_current_building_type == BildingType_WeaponShop )
1878 {
1879 v52 = v8->ptr_1C;
1880 v53 = 0;
1881 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] )
1882 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] )
1883 {
1884 do
1885 {
1886 // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] )
1887 if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID)
1888 {
1889 v54 = rand();
1890 v8 = window_SpeakInHouse;
1891 word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight);
1892 }
1893 v52 = v8->ptr_1C;
1894 ++v53;
1895 }
1896 //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] );
1897 while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] );
1898 }
1899 }
1900 }
1901 */
1902 }
1903 825
1904 //----- (004BD8B5) -------------------------------------------------------- 826 //----- (004BD8B5) --------------------------------------------------------
1905 signed int __cdecl sub_4BD8B5() 827 signed int __cdecl sub_4BD8B5()
1906 { 828 {
1907 int v0; // eax@4 829 int v0; // eax@4