comparison mm7_2.cpp @ 786:da80bd2922df

Слияние
author Ritor1
date Sun, 24 Mar 2013 09:19:36 +0600
parents a821bbace194 c47efaf23642
children f004c7ceb7bd
comparison
equal deleted inserted replaced
785:a821bbace194 786:da80bd2922df
51 #include "Events2D.h" 51 #include "Events2D.h"
52 #include "stru159.h" 52 #include "stru159.h"
53 #include "Log.h" 53 #include "Log.h"
54 #include "UIHouses.h" 54 #include "UIHouses.h"
55 #include "texts.h" 55 #include "texts.h"
56
57 #include "mm7_data.h" 56 #include "mm7_data.h"
58 #include "MM7.h" 57 #include "MM7.h"
59
60
61 58
62 //----- (004BB756) -------------------------------------------------------- 59 //----- (004BB756) --------------------------------------------------------
63 signed int __fastcall sub_4BB756(signed int a1) 60 signed int __fastcall sub_4BB756(signed int a1)
64 { 61 {
65 unsigned int v1; // esi@8 62 unsigned int v1; // esi@8
742 _4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1); 739 _4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1);
743 } 740 }
744 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); 741 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0);
745 } 742 }
746 743
747
748
749
750
751 //----- (004BC8D5) -------------------------------------------------------- 744 //----- (004BC8D5) --------------------------------------------------------
752 void SpellBookGenerator() 745 void SpellBookGenerator()
753 { 746 {
754 int v0; // esi@1 747 int v0; // esi@1
755 int v1; // ebx@1 748 int v1; // ebx@1
808 } 801 }
809 802
810 return; 803 return;
811 } 804 }
812 805
813
814 //----- (004BCA33) -------------------------------------------------------- 806 //----- (004BCA33) --------------------------------------------------------
815 void UI_CreateEndConversationButton() 807 void UI_CreateEndConversationButton()
816 { 808 {
817 pDialogueWindow->Release(); 809 pDialogueWindow->Release();
818 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); 810 pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
819 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, 811 pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0,
820 pGlobalTXT_LocalizationStrings[74], //"End Conversation" 812 pGlobalTXT_LocalizationStrings[74], //"End Conversation"
821 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); 813 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
822 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); 814 pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0);
823 }
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 travel_schedule[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 } 815 }
1903 816
1904 //----- (004BD8B5) -------------------------------------------------------- 817 //----- (004BD8B5) --------------------------------------------------------
1905 signed int __cdecl sub_4BD8B5() 818 signed int __cdecl sub_4BD8B5()
1906 { 819 {
1996 return 1; 909 return 1;
1997 } 910 }
1998 } 911 }
1999 return 0; 912 return 0;
2000 } 913 }
2001
2002
2003
2004
2005 914
2006 //----- (004BDB56) -------------------------------------------------------- 915 //----- (004BDB56) --------------------------------------------------------
2007 void __cdecl UIShop_Buy_Identify_Repair() 916 void __cdecl UIShop_Buy_Identify_Repair()
2008 { 917 {
2009 Player *v0; // edi@1 918 Player *v0; // edi@1
2475 break; 1384 break;
2476 } 1385 }
2477 } 1386 }
2478 } 1387 }
2479 1388
2480
2481
2482 //----- (004BE386) -------------------------------------------------------- 1389 //----- (004BE386) --------------------------------------------------------
2483 void __fastcall log_error(const char *pMessage) 1390 void __fastcall log_error(const char *pMessage)
2484 { 1391 {
2485 const char *v1; // edi@1 1392 const char *v1; // edi@1
2486 FILE *f; // eax@1 1393 FILE *f; // eax@1
2494 fprintf(f, "%s\n", v1); 1401 fprintf(f, "%s\n", v1);
2495 fclose(v3); 1402 fclose(v3);
2496 fflush(v3); 1403 fflush(v3);
2497 } 1404 }
2498 } 1405 }
2499
2500
2501
2502 1406
2503 //----- (004BF91E) -------------------------------------------------------- 1407 //----- (004BF91E) --------------------------------------------------------
2504 unsigned int __thiscall GameOverMenu(void *ecx0) 1408 unsigned int __thiscall GameOverMenu(void *ecx0)
2505 { 1409 {
2506 char *v1; // eax@2 1410 char *v1; // eax@2
2696 } 1600 }
2697 LABEL_43: 1601 LABEL_43:
2698 bGameoverLoop = 0; 1602 bGameoverLoop = 0;
2699 return result; 1603 return result;
2700 } 1604 }
2701
2702
2703
2704
2705
2706
2707 1605
2708 //----- (004D6FB0) -------------------------------------------------------- 1606 //----- (004D6FB0) --------------------------------------------------------
2709 int /*__usercall*/ sr_sub_4D6FB0/*<eax>*/(stru315 *a1/*<ebp>*/) 1607 int /*__usercall*/ sr_sub_4D6FB0/*<eax>*/(stru315 *a1/*<ebp>*/)
2710 { 1608 {
2711 int v1; // ebp@1 1609 int v1; // ebp@1
3468 v2 = v16 - 1; 2366 v2 = v16 - 1;
3469 } 2367 }
3470 while ( v16 != 1 ); 2368 while ( v16 != 1 );
3471 } 2369 }
3472 } 2370 }
3473
3474
3475
3476 2371
3477 //----- (00451007) -------------------------------------------------------- 2372 //----- (00451007) --------------------------------------------------------
3478 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, 2373 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch,
3479 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, 2374 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch,
3480 int a10, int a11) 2375 int a10, int a11)
4720 } 3615 }
4721 return result; 3616 return result;
4722 } 3617 }
4723 } 3618 }
4724 3619
4725
4726
4727
4728
4729
4730
4731 //----- (0044E1EC) -------------------------------------------------------- 3620 //----- (0044E1EC) --------------------------------------------------------
4732 int TextureFrameTable::FromFileTxt(const char *Args) 3621 int TextureFrameTable::FromFileTxt(const char *Args)
4733 { 3622 {
4734 TextureFrameTable *v2; // ebx@1 3623 TextureFrameTable *v2; // ebx@1
4735 FILE *v3; // eax@1 3624 FILE *v3; // eax@1
4843 } 3732 }
4844 ++j; 3733 ++j;
4845 } 3734 }
4846 return 1; 3735 return 1;
4847 } 3736 }
4848
4849
4850
4851
4852
4853
4854
4855 3737
4856 //----- (0044F57C) -------------------------------------------------------- 3738 //----- (0044F57C) --------------------------------------------------------
4857 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5) 3739 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5)
4858 { 3740 {
4859 //MapInfo *v5; // esi@1 3741 //MapInfo *v5; // esi@1
5132 //result = v53; 4014 //result = v53;
5133 } 4015 }
5134 //while ( (signed int)v53 < v56 ); 4016 //while ( (signed int)v53 < v56 );
5135 } 4017 }
5136 4018
5137
5138
5139
5140 //----- (0044FA4C) -------------------------------------------------------- 4019 //----- (0044FA4C) --------------------------------------------------------
5141 signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3) 4020 signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3)
5142 { 4021 {
5143 signed int v3; // ecx@6 4022 signed int v3; // ecx@6
5144 Actor *v4; // edx@7 4023 Actor *v4; // edx@7
5257 } 4136 }
5258 } 4137 }
5259 return result; 4138 return result;
5260 } 4139 }
5261 4140
5262
5263 //----- (0044FFD8) -------------------------------------------------------- 4141 //----- (0044FFD8) --------------------------------------------------------
5264 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2) 4142 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2)
5265 { 4143 {
5266 //MapInfo *v2; // ebx@1 4144 //MapInfo *v2; // ebx@1
5267 //SpawnPointMM7 *v3; // esi@1 4145 //SpawnPointMM7 *v3; // esi@1
5433 a1a.uSpriteFrameID = 0; 4311 a1a.uSpriteFrameID = 0;
5434 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; 4312 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
5435 return a1a.Create(0, 0, 0, 0); 4313 return a1a.Create(0, 0, 0, 0);
5436 } 4314 }
5437 4315
5438
5439 //----- (00450521) -------------------------------------------------------- 4316 //----- (00450521) --------------------------------------------------------
5440 signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) 4317 signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)
5441 { 4318 {
5442 int v6; // edi@1 4319 int v6; // edi@1
5443 int v7; // esi@1 4320 int v7; // esi@1
5478 a1.uAttributes = 0; 4355 a1.uAttributes = 0;
5479 a1.uSectorID = pIndoor->GetSector(a3, a4, a5); 4356 a1.uSectorID = pIndoor->GetSector(a3, a4, a5);
5480 a1.uSpriteFrameID = 0; 4357 a1.uSpriteFrameID = 0;
5481 return a1.Create(0, 0, 0, 0); 4358 return a1.Create(0, 0, 0, 0);
5482 } 4359 }
5483
5484
5485
5486 4360
5487 //----- (0045063B) -------------------------------------------------------- 4361 //----- (0045063B) --------------------------------------------------------
5488 int __fastcall sub_45063B(MapInfo *a1, int a2) 4362 int __fastcall sub_45063B(MapInfo *a1, int a2)
5489 { 4363 {
5490 signed int v2; // edi@1 4364 signed int v2; // edi@1
5634 SpawnEncounter(v21, &v19, 0, 0, 1); 4508 SpawnEncounter(v21, &v19, 0, 0, 1);
5635 result = v24; 4509 result = v24;
5636 } 4510 }
5637 return result; 4511 return result;
5638 } 4512 }
5639
5640
5641 4513
5642 //----- (00450929) -------------------------------------------------------- 4514 //----- (00450929) --------------------------------------------------------
5643 int LevelDecoration::GetGlobalEvent() 4515 int LevelDecoration::GetGlobalEvent()
5644 { 4516 {
5645 LevelDecoration *v1; // esi@1 4517 LevelDecoration *v1; // esi@1
5840 } 4712 }
5841 return result; 4713 return result;
5842 } 4714 }
5843 // 5C6DF8: using guessed type int dword_5C6DF8; 4715 // 5C6DF8: using guessed type int dword_5C6DF8;
5844 4716
5845
5846 //----- (00450DA3) -------------------------------------------------------- 4717 //----- (00450DA3) --------------------------------------------------------
5847 int __cdecl GetAlertStatus() 4718 int __cdecl GetAlertStatus()
5848 { 4719 {
5849 int result; // eax@2 4720 int result; // eax@2
5850 4721
5853 else 4724 else
5854 result = uCurrentlyLoadedLevelType == LEVEL_Outdoor ? pIndoor->dlv.field_C_alert : 0; 4725 result = uCurrentlyLoadedLevelType == LEVEL_Outdoor ? pIndoor->dlv.field_C_alert : 0;
5855 return result; 4726 return result;
5856 } 4727 }
5857 4728
5858
5859
5860 //----- (00450DDE) -------------------------------------------------------- 4729 //----- (00450DDE) --------------------------------------------------------
5861 stru350 *stru350::_450DDE() 4730 stru350 *stru350::_450DDE()
5862 { 4731 {
5863 _450DF1(&stru_4E82A4, &stru_4E82A4); 4732 _450DF1(&stru_4E82A4, &stru_4E82A4);
5864 return this; 4733 return this;
5865 } 4734 }
5866
5867 4735
5868 //----- (00450DF1) -------------------------------------------------------- 4736 //----- (00450DF1) --------------------------------------------------------
5869 bool stru350::_450DF1(const stru355 *p1, const stru355 *p2) 4737 bool stru350::_450DF1(const stru355 *p1, const stru355 *p2)
5870 { 4738 {
5871 //stru350 *v3; // esi@1 4739 //stru350 *v3; // esi@1
6063 while ( v36 & 1 ); 4931 while ( v36 & 1 );
6064 field_5C = v37 - v38 + 8; 4932 field_5C = v37 - v38 + 8;
6065 return true; 4933 return true;
6066 } 4934 }
6067 4935
6068
6069
6070
6071 //----- (00450F55) -------------------------------------------------------- 4936 //----- (00450F55) --------------------------------------------------------
6072 unsigned int stru350::_450F55(int a2) 4937 unsigned int stru350::_450F55(int a2)
6073 { 4938 {
6074 int v2 = a2 & stru_4E82A4.field_1C; 4939 int v2 = a2 & stru_4E82A4.field_1C;
6075 if (field_20.field_4 & 1) 4940 if (field_20.field_4 & 1)
6089 v2 = a2 & field_0.field_1C; 4954 v2 = a2 & field_0.field_1C;
6090 if ( v4 ) 4955 if ( v4 )
6091 v2 <<= field_40; 4956 v2 <<= field_40;
6092 return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58); 4957 return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58);
6093 } 4958 }
6094
6095 4959
6096 //----- (00452442) -------------------------------------------------------- 4960 //----- (00452442) --------------------------------------------------------
6097 unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4) 4961 unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4)
6098 { 4962 {
6099 int v4; // ebx@0 4963 int v4; // ebx@0
6124 + (v5 & 0x1C00) 4988 + (v5 & 0x1C00)
6125 + v9 4989 + v9
6126 + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00)); 4990 + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00));
6127 } 4991 }
6128 4992
6129
6130
6131 //----- (0045281E) -------------------------------------------------------- 4993 //----- (0045281E) --------------------------------------------------------
6132 // Calculates atan2(y/x) 4994 // Calculates atan2(y/x)
6133 // return value: angle in integer format (multiplier of Pi/1024) 4995 // return value: angle in integer format (multiplier of Pi/1024)
6134 unsigned int stru193_math::Atan2(int x, int y) 4996 unsigned int stru193_math::Atan2(int x, int y)
6135 { 4997 {
6235 if ( X < 0 ) //Y == 0, X < 0 5097 if ( X < 0 ) //Y == 0, X < 0
6236 return uIntegerPi; 5098 return uIntegerPi;
6237 5099
6238 return 0; 5100 return 0;
6239 } 5101 }
6240
6241
6242
6243 5102
6244 //----- (00452969) -------------------------------------------------------- 5103 //----- (00452969) --------------------------------------------------------
6245 stru193_math::stru193_math() 5104 stru193_math::stru193_math()
6246 { 5105 {
6247 stru193_math *v1; // esi@1 5106 stru193_math *v1; // esi@1
6399 { 5258 {
6400 result = 0; 5259 result = 0;
6401 } 5260 }
6402 return result; 5261 return result;
6403 } 5262 }
6404
6405
6406
6407
6408
6409 5263
6410 //----- (00453F62) -------------------------------------------------------- 5264 //----- (00453F62) --------------------------------------------------------
6411 void MapStats::Initialize() 5265 void MapStats::Initialize()
6412 { 5266 {
6413 char work_str[32]; // [sp+Ch] [bp-34h]@3 5267 char work_str[32]; // [sp+Ch] [bp-34h]@3
6733 5587
6734 uNumMaps = 77; 5588 uNumMaps = 77;
6735 } 5589 }
6736 // 453F62: using guessed type char Str[32]; 5590 // 453F62: using guessed type char Str[32];
6737 5591
6738
6739
6740
6741
6742
6743 //----- (004547A3) -------------------------------------------------------- 5592 //----- (004547A3) --------------------------------------------------------
6744 MAP_TYPE MapStats::GetMapInfo(const char *Str2) 5593 MAP_TYPE MapStats::GetMapInfo(const char *Str2)
6745 { 5594 {
6746 assert(uNumMaps >= 2); 5595 assert(uNumMaps >= 2);
6747 5596
6805 pAllocator->FreeChunk(pHostileTXT_Raw); 5654 pAllocator->FreeChunk(pHostileTXT_Raw);
6806 pHostileTXT_Raw = NULL; 5655 pHostileTXT_Raw = NULL;
6807 } 5656 }
6808 } 5657 }
6809 5658
6810
6811
6812
6813
6814
6815 //----- (00458244) -------------------------------------------------------- 5659 //----- (00458244) --------------------------------------------------------
6816 unsigned int __fastcall SkillToMastery(unsigned __int16 a1) 5660 unsigned int __fastcall SkillToMastery(unsigned __int16 a1)
6817 { 5661 {
6818 unsigned int result; // eax@1 5662 unsigned int result; // eax@1
6819 5663
6834 result = 3; // Master 5678 result = 3; // Master
6835 } 5679 }
6836 } 5680 }
6837 return result; 5681 return result;
6838 } 5682 }
6839
6840 5683
6841 //----- (0045828B) -------------------------------------------------------- 5684 //----- (0045828B) --------------------------------------------------------
6842 unsigned int __fastcall GetSpellColor(signed int a1) 5685 unsigned int __fastcall GetSpellColor(signed int a1)
6843 { 5686 {
6844 unsigned __int16 v1; // dx@3 5687 unsigned __int16 v1; // dx@3
6952 v1 = 212; 5795 v1 = 212;
6953 v2 = 150; 5796 v2 = 150;
6954 return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4); 5797 return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4);
6955 } 5798 }
6956 5799
6957
6958 //----- (004583B0) -------------------------------------------------------- 5800 //----- (004583B0) --------------------------------------------------------
6959 LevelDecoration::LevelDecoration() 5801 LevelDecoration::LevelDecoration()
6960 { 5802 {
6961 this->field_1A = 0; 5803 this->field_1A = 0;
6962 this->field_18 = 0; 5804 this->field_18 = 0;
6966 this->uDecorationDescID = 0; 5808 this->uDecorationDescID = 0;
6967 this->field_2 = 0; 5809 this->field_2 = 0;
6968 this->field_16_event_id = 0; 5810 this->field_16_event_id = 0;
6969 this->uCog = 0; 5811 this->uCog = 0;
6970 } 5812 }
6971
6972
6973
6974
6975
6976
6977
6978
6979 5813
6980 //----- (00458600) -------------------------------------------------------- 5814 //----- (00458600) --------------------------------------------------------
6981 void DecorationList::ToFile() 5815 void DecorationList::ToFile()
6982 { 5816 {
6983 DecorationList *v1; // esi@1 5817 DecorationList *v1; // esi@1
7205 } 6039 }
7206 fclose(File); 6040 fclose(File);
7207 return 1; 6041 return 1;
7208 } 6042 }
7209 6043
7210
7211
7212
7213
7214 //----- (00459064) -------------------------------------------------------- 6044 //----- (00459064) --------------------------------------------------------
7215 void ObjectList::InitializeSprites() 6045 void ObjectList::InitializeSprites()
7216 { 6046 {
7217 for (uint i = 0; i < uNumObjects; ++i) 6047 for (uint i = 0; i < uNumObjects; ++i)
7218 pSpriteFrameTable->InitializeSprite(pObjects[i].uSpriteID); 6048 pSpriteFrameTable->InitializeSprite(pObjects[i].uSpriteID);
7423 } 6253 }
7424 fclose(File); 6254 fclose(File);
7425 return 1; 6255 return 1;
7426 } 6256 }
7427 6257
7428
7429 //----- (0045E03A) -------------------------------------------------------- 6258 //----- (0045E03A) --------------------------------------------------------
7430 unsigned __int16 *__fastcall MakeScreenshot(signed int width, signed int height) 6259 unsigned __int16 *__fastcall MakeScreenshot(signed int width, signed int height)
7431 { 6260 {
7432 signed int v2; // edi@1 6261 signed int v2; // edi@1
7433 unsigned __int16 *v3; // ebx@1 6262 unsigned __int16 *v3; // ebx@1
7606 v2 = MakeScreenshot(92, 68); 6435 v2 = MakeScreenshot(92, 68);
7607 pRenderer->SavePCXImage(v1, (char *)v2, 92, 68); 6436 pRenderer->SavePCXImage(v1, (char *)v2, 92, 68);
7608 free(v2); 6437 free(v2);
7609 } 6438 }
7610 6439
7611
7612
7613
7614
7615 //----- (00460706) -------------------------------------------------------- 6440 //----- (00460706) --------------------------------------------------------
7616 void TryLoadLevelFromLOD() 6441 void TryLoadLevelFromLOD()
7617 { 6442 {
7618 FILE *v0; // eax@1 6443 FILE *v0; // eax@1
7619 FILE *v1; // esi@1 6444 FILE *v1; // esi@1
7665 pNew_LOD->AllocSubIndicesAndIO(300, 0x186A0u); 6490 pNew_LOD->AllocSubIndicesAndIO(300, 0x186A0u);
7666 return true; 6491 return true;
7667 } 6492 }
7668 return false; 6493 return false;
7669 } 6494 }
7670
7671
7672
7673
7674 6495
7675 //----- (0046086A) -------------------------------------------------------- 6496 //----- (0046086A) --------------------------------------------------------
7676 bool Autosave() 6497 bool Autosave()
7677 { 6498 {
7678 int flag; // esi@3 6499 int flag; // esi@3
7732 SaveGame(1, (__int16 *)1); 6553 SaveGame(1, (__int16 *)1);
7733 } 6554 }
7734 pAllocator->FreeChunk(pSave); 6555 pAllocator->FreeChunk(pSave);
7735 return flag; 6556 return flag;
7736 } 6557 }
7737
7738 6558
7739 //----- (004610AA) -------------------------------------------------------- 6559 //----- (004610AA) --------------------------------------------------------
7740 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) 6560 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2)
7741 { 6561 {
7742 unsigned int v2; // edi@1 6562 unsigned int v2; // edi@1
7927 pPaletteManager->LockTestAll(); 6747 pPaletteManager->LockTestAll();
7928 if ( pParty->pPickedItem.uItemID != 0 ) 6748 if ( pParty->pPickedItem.uItemID != 0 )
7929 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID); 6749 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID);
7930 } 6750 }
7931 6751
7932
7933
7934 //----- (004613C4) -------------------------------------------------------- 6752 //----- (004613C4) --------------------------------------------------------
7935 int __cdecl sub_4613C4() 6753 int __cdecl sub_4613C4()
7936 { 6754 {
7937 unsigned __int16 v0; // ax@1 6755 unsigned __int16 v0; // ax@1
7938 size_t v1; // ecx@1 6756 size_t v1; // ecx@1
7963 } 6781 }
7964 return result; 6782 return result;
7965 } 6783 }
7966 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; 6784 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
7967 6785
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980 //----- (004621DA) -------------------------------------------------------- 6786 //----- (004621DA) --------------------------------------------------------
7981 int __fastcall int_get_vector_length(signed int a1, signed int a2, signed int a3) 6787 int __fastcall int_get_vector_length(signed int a1, signed int a2, signed int a3)
7982 { 6788 {
7983 signed int v3; // eax@2 6789 signed int v3; // eax@2
7984 signed int v4; // eax@3 6790 signed int v4; // eax@3
8004 a2 = v4; 6810 a2 = v4;
8005 v4 = v6; 6811 v4 = v6;
8006 } 6812 }
8007 return (11 * a2 >> 5) + a1 + (v4 >> 2); 6813 return (11 * a2 >> 5) + a1 + (v4 >> 2);
8008 } 6814 }
8009
8010
8011
8012
8013
8014 6815
8015 OPENFILENAMEA ofn; 6816 OPENFILENAMEA ofn;
8016 //----- (0046271C) -------------------------------------------------------- 6817 //----- (0046271C) --------------------------------------------------------
8017 void __cdecl crt_init_globals_46271C() 6818 void __cdecl crt_init_globals_46271C()
8018 { 6819 {
8870 pParty->armageddon_timer = 0; 7671 pParty->armageddon_timer = 0;
8871 while ( v0 > 0 ) 7672 while ( v0 > 0 )
8872 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); 7673 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release();
8873 } 7674 }
8874 7675
8875
8876
8877 //----- (004646F0) -------------------------------------------------------- 7676 //----- (004646F0) --------------------------------------------------------
8878 void PrepareWorld(unsigned int this_) 7677 void PrepareWorld(unsigned int this_)
8879 { 7678 {
8880 unsigned int v1; // ebx@1 7679 unsigned int v1; // ebx@1
8881 7680
8937 void __cdecl SetUnderwaterFog() 7736 void __cdecl SetUnderwaterFog()
8938 { 7737 {
8939 day_fogrange_1 = 50; 7738 day_fogrange_1 = 50;
8940 day_fogrange_2 = 5000; 7739 day_fogrange_2 = 5000;
8941 } 7740 }
8942
8943
8944 7741
8945 //----- (00464866) -------------------------------------------------------- 7742 //----- (00464866) --------------------------------------------------------
8946 void __fastcall DoPrepareWorld(unsigned int bLoading, int a2) 7743 void __fastcall DoPrepareWorld(unsigned int bLoading, int a2)
8947 { 7744 {
8948 int v2; // esi@1 7745 int v2; // esi@1
9004 pGameLoadingUI_ProgressBar->Progress(); 7801 pGameLoadingUI_ProgressBar->Progress();
9005 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); 7802 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D));
9006 pGameLoadingUI_ProgressBar->Release(); 7803 pGameLoadingUI_ProgressBar->Release();
9007 _flushall(); 7804 _flushall();
9008 } 7805 }
9009
9010 7806
9011 //----- (004649EF) -------------------------------------------------------- 7807 //----- (004649EF) --------------------------------------------------------
9012 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue) 7808 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue)
9013 { 7809 {
9014 int v3; // [sp+4h] [bp-24h]@1 7810 int v3; // [sp+4h] [bp-24h]@1
9370 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", ::hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0)) 8166 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", ::hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0))
9371 continue; 8167 continue;
9372 return false; 8168 return false;
9373 } 8169 }
9374 } 8170 }
9375
9376
9377
9378 8171
9379 //----- (004651F4) -------------------------------------------------------- 8172 //----- (004651F4) --------------------------------------------------------
9380 bool MM7_Initialize() 8173 bool MM7_Initialize()
9381 { 8174 {
9382 initing=true; //ADDED Gloval 8175 initing=true; //ADDED Gloval
9909 8702
9910 initing = false; //ADDED Gloval 8703 initing = false; //ADDED Gloval
9911 return true; 8704 return true;
9912 } 8705 }
9913 8706
9914
9915
9916
9917 //----- (00465D0B) -------------------------------------------------------- 8707 //----- (00465D0B) --------------------------------------------------------
9918 void __cdecl SecondaryInitialization() 8708 void __cdecl SecondaryInitialization()
9919 { 8709 {
9920 __int16 v4; // ax@4 8710 __int16 v4; // ax@4
9921 signed int v5; // esi@5 8711 signed int v5; // esi@5
10014 8804
10015 Initialize_GamesLOD_NewLOD(); 8805 Initialize_GamesLOD_NewLOD();
10016 dword_576E2C = 512; 8806 dword_576E2C = 512;
10017 dword_576E28 = 9; 8807 dword_576E28 = 9;
10018 } 8808 }
10019
10020
10021
10022
10023
10024 8809
10025 void IntegrityTest() 8810 void IntegrityTest()
10026 { 8811 {
10027 assert(sizeof(RenderVertexSoft) == 0x30); 8812 assert(sizeof(RenderVertexSoft) == 0x30);
10028 assert(sizeof(RenderBillboard) == 0x34); 8813 assert(sizeof(RenderBillboard) == 0x34);
10363 9148
10364 pGame->Deinitialize(); 9149 pGame->Deinitialize();
10365 return 1; 9150 return 1;
10366 } 9151 }
10367 9152
10368
10369
10370
10371
10372 //----- (004637E0) -------------------------------------------------------- 9153 //----- (004637E0) --------------------------------------------------------
10373 char __cdecl sub_4637E0_is_there_popup_onscreen() 9154 char __cdecl sub_4637E0_is_there_popup_onscreen()
10374 { 9155 {
10375 return dword_507BF0_is_there_popup_onscreen == 1; 9156 return dword_507BF0_is_there_popup_onscreen == 1;
10376 } 9157 }
10377 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen; 9158 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen;
10378
10379
10380 9159
10381 //----- (00465F5A) -------------------------------------------------------- 9160 //----- (00465F5A) --------------------------------------------------------
10382 void __cdecl CreateAsyncMouse() 9161 void __cdecl CreateAsyncMouse()
10383 { 9162 {
10384 LOG_DECOMPILATION_WARNING(); 9163 LOG_DECOMPILATION_WARNING();
10588 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y); 9367 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y);
10589 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 9368 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
10590 pOutdoorCamera->_485F64(); 9369 pOutdoorCamera->_485F64();
10591 } 9370 }
10592 9371
10593
10594 //----- (00466B8C) -------------------------------------------------------- 9372 //----- (00466B8C) --------------------------------------------------------
10595 int __cdecl AbortWithError() 9373 int __cdecl AbortWithError()
10596 { 9374 {
10597 if ( !aborting_app ) 9375 if ( !aborting_app )
10598 { 9376 {
10661 //----- (00466CA0) -------------------------------------------------------- 9439 //----- (00466CA0) --------------------------------------------------------
10662 MENU_STATE GetCurrentMenuID() 9440 MENU_STATE GetCurrentMenuID()
10663 { 9441 {
10664 return uCurrentMenuID; 9442 return uCurrentMenuID;
10665 } 9443 }
10666
10667
10668
10669
10670 9444
10671 /* 9445 /*
10672 v17 = 0; 9446 v17 = 0;
10673 if ( v4 > -2005532222 ) 9447 if ( v4 > -2005532222 )
10674 { 9448 {
11168 } 9942 }
11169 goto LABEL_174; 9943 goto LABEL_174;
11170 } 9944 }
11171 }*/ 9945 }*/
11172 9946
11173
11174
11175 //----- (00467D5D) -------------------------------------------------------- 9947 //----- (00467D5D) --------------------------------------------------------
11176 int __thiscall sub_467D5D(int _this) 9948 int __thiscall sub_467D5D(int _this)
11177 { 9949 {
11178 return *(int *)(_this + 7204); 9950 return *(int *)(_this + 7204);
11179 } 9951 }
11180
11181
11182 9952
11183 //----- (00467E7F) -------------------------------------------------------- 9953 //----- (00467E7F) --------------------------------------------------------
11184 void __thiscall sub_467E7F_EquipBody(unsigned int uEquipType) 9954 void __thiscall sub_467E7F_EquipBody(unsigned int uEquipType)
11185 { 9955 {
11186 unsigned int v1; // esi@1 9956 unsigned int v1; // esi@1
11298 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], 10068 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C],
11299 0, 10069 0,
11300 0, 10070 0,
11301 0); 10071 0);
11302 } 10072 }
11303
11304
11305
11306 10073
11307 //----- (00468F8A) -------------------------------------------------------- 10074 //----- (00468F8A) --------------------------------------------------------
11308 void __cdecl OnPaperdollLeftClick() 10075 void __cdecl OnPaperdollLeftClick()
11309 { 10076 {
11310 Player *v0; // ebx@1 10077 Player *v0; // ebx@1
11831 _a->Reset(); 10598 _a->Reset();
11832 v0->pEquipment.uBow = 0; 10599 v0->pEquipment.uBow = 0;
11833 } 10600 }
11834 } 10601 }
11835 } 10602 }
11836
11837
11838
11839 10603
11840 //----- (0046A0A1) -------------------------------------------------------- 10604 //----- (0046A0A1) --------------------------------------------------------
11841 int __thiscall UnprojectX(int x) 10605 int __thiscall UnprojectX(int x)
11842 { 10606 {
11843 double v1; // st7@3 10607 double v1; // st7@3
12617 LABEL_51: 11381 LABEL_51:
12618 sub_41C0B8_set_status_string(v24); 11382 sub_41C0B8_set_status_string(v24);
12619 return v19; 11383 return v19;
12620 } 11384 }
12621 11385
12622
12623 //----- (0046BDA8) -------------------------------------------------------- 11386 //----- (0046BDA8) --------------------------------------------------------
12624 unsigned int __cdecl GetGravityStrength() 11387 unsigned int __cdecl GetGravityStrength()
12625 { 11388 {
12626 int v0; // eax@1 11389 int v0; // eax@1
12627 11390
12645 ODM_UpdateUserInputAndOther(); 11408 ODM_UpdateUserInputAndOther();
12646 11409
12647 _438F8F_area_of_effect__damage_evaluate(); 11410 _438F8F_area_of_effect__damage_evaluate();
12648 } 11411 }
12649 } 11412 }
12650
12651
12652 11413
12653 //----- (0046BDF1) -------------------------------------------------------- 11414 //----- (0046BDF1) --------------------------------------------------------
12654 void __cdecl BLV_UpdateUserInputAndOther() 11415 void __cdecl BLV_UpdateUserInputAndOther()
12655 { 11416 {
12656 UpdateObjects(); 11417 UpdateObjects();
12693 } 11454 }
12694 } 11455 }
12695 UpdateActors_ODM(); 11456 UpdateActors_ODM();
12696 _46CC4B_check_event_triggers(); 11457 _46CC4B_check_event_triggers();
12697 } 11458 }
12698
12699
12700
12701 11459
12702 //----- (0046BEF1) -------------------------------------------------------- 11460 //----- (0046BEF1) --------------------------------------------------------
12703 void SpriteObject::_46BEF1_apply_spells() 11461 void SpriteObject::_46BEF1_apply_spells()
12704 { 11462 {
12705 SpriteObject *v1; // edi@1 11463 SpriteObject *v1; // edi@1
12737 ++v2; 11495 ++v2;
12738 } 11496 }
12739 while ( v6 < (signed int)uNumActors ); 11497 while ( v6 < (signed int)uNumActors );
12740 } 11498 }
12741 } 11499 }
12742
12743 11500
12744 //----- (0046BFFA) -------------------------------------------------------- 11501 //----- (0046BFFA) --------------------------------------------------------
12745 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) 11502 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2)
12746 { 11503 {
12747 SpriteObject *v2; // esi@1 11504 SpriteObject *v2; // esi@1
13771 v125 = 8; 12528 v125 = 8;
13772 LABEL_29: 12529 LABEL_29:
13773 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); 12530 pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133);
13774 return 0; 12531 return 0;
13775 } 12532 }
13776