comparison mm7_2.cpp @ 770:02bfc82f429c

Слияние
author Ritor1
date Sat, 23 Mar 2013 09:26:07 +0600
parents e13ce1b0930d
children 0b3f4b854652
comparison
equal deleted inserted replaced
769:2f40f4b35ce0 770:02bfc82f429c
299 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" 299 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
300 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); 300 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
301 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); 301 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
302 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); 302 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0);
303 pDialogueWindow->_41D08F(1, 1, 0, 2); 303 pDialogueWindow->_41D08F(1, 1, 0, 2);
304 dialog_menu_id = -1; 304 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
305 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); 305 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
306 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) 306 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed )
307 { 307 {
308 pParty->field_75A[v0] = 0; 308 pParty->field_75A[v0] = 0;
309 __debugbreak(); // starting year-related constant here; 309 __debugbreak(); // starting year-related constant here;
887 //v55 = a1; 887 //v55 = a1;
888 if ( !pDialogueWindow->pNumPresenceButton ) 888 if ( !pDialogueWindow->pNumPresenceButton )
889 return; 889 return;
890 pRenderer->ClearZBuffer(0, 479); 890 pRenderer->ClearZBuffer(0, 479);
891 //v3 = dword_F8B198; 891 //v3 = dword_F8B198;
892 if ( dialog_menu_id != 1 ) 892 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
893 { 893 {
894 v8 = window_SpeakInHouse; 894 v8 = window_SpeakInHouse;
895 } 895 }
896 //else 896 //else
897 if ( dialog_menu_id == 1 ) 897 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
898 { 898 {
899 if ( in_current_building_type == BildingType_Training ) 899 if ( in_current_building_type == BildingType_Training )
900 { 900 {
901 if ( uMessageParam == 17 ) 901 if ( uMessageParam == 17 )
902 { 902 {
947 return; 947 return;
948 v8 = window_SpeakInHouse; 948 v8 = window_SpeakInHouse;
949 } 949 }
950 } 950 }
951 //LABEL_11: 951 //LABEL_11:
952 dialog_menu_id = uMessageParam; 952 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
953 if ( in_current_building_type < BildingType_19 ) 953 if ( in_current_building_type < BildingType_19 )
954 { 954 {
955 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); 955 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
956 //v3 = dword_F8B198; 956 //v3 = dword_F8B198;
957 ShopTexture = &pIcons_LOD->pTextures[v9]; 957 ShopTexture = &pIcons_LOD->pTextures[v9];
1522 break; 1522 break;
1523 } 1523 }
1524 case 102: 1524 case 102:
1525 case 103: 1525 case 103:
1526 { 1526 {
1527 dialog_menu_id = uMessageParam; 1527 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1528 break; 1528 break;
1529 } 1529 }
1530 case 104: 1530 case 104:
1531 { 1531 {
1532 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 1532 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
1535 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; 1535 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
1536 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; 1536 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
1537 ++pMessageQueue_50CBD0->uNumMessages; 1537 ++pMessageQueue_50CBD0->uNumMessages;
1538 }*/ 1538 }*/
1539 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); 1539 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0);
1540 dialog_menu_id = 104; 1540 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT;
1541 break; 1541 break;
1542 } 1542 }
1543 case 2: 1543 case 2:
1544 case 95: 1544 case 95:
1545 { 1545 {
1653 } 1653 }
1654 case 3: 1654 case 3:
1655 case 4: 1655 case 4:
1656 case 5: 1656 case 5:
1657 { 1657 {
1658 dialog_menu_id = uMessageParam; 1658 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam;
1659 sub_421B2C_PlaceInInventory_or_DropPickedItem(); 1659 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1660 break; 1660 break;
1661 } 1661 }
1662 case 94: 1662 case 94:
1663 { 1663 {
1916 activeLevelDecoration = NULL; 1916 activeLevelDecoration = NULL;
1917 ptr_F8B1E8 = 0; 1917 ptr_F8B1E8 = 0;
1918 if ( pDialogueNPCCount ) 1918 if ( pDialogueNPCCount )
1919 { 1919 {
1920 v0 = dialog_menu_id; 1920 v0 = dialog_menu_id;
1921 if ( dialog_menu_id != 2 1921 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
1922 && dialog_menu_id != 3 1922 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL
1923 && dialog_menu_id != 97 1923 && dialog_menu_id != HOUSE_DIALOGUE_97
1924 && dialog_menu_id != 5 1924 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR
1925 && dialog_menu_id != 4 1925 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY
1926 && ShopTexture ) 1926 && ShopTexture )
1927 { 1927 {
1928 ShopTexture->Release(); 1928 ShopTexture->Release();
1929 v0 = dialog_menu_id; 1929 v0 = dialog_menu_id;
1930 ShopTexture = 0; 1930 ShopTexture = 0;
1941 if ( v0 != 94 && v0 != 96 && v0 != 101 ) 1941 if ( v0 != 94 && v0 != 96 && v0 != 101 )
1942 { 1942 {
1943 if ( v0 == 3 || v0 == 5 || v0 == 4 ) 1943 if ( v0 == 3 || v0 == 5 || v0 == 4 )
1944 { 1944 {
1945 UI_CreateEndConversationButton(); 1945 UI_CreateEndConversationButton();
1946 dialog_menu_id = 94; 1946 dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT;
1947 sub_4B3AD4(in_current_building_type); 1947 sub_4B3AD4(in_current_building_type);
1948 } 1948 }
1949 else 1949 else
1950 { 1950 {
1951 if ( v0 != 102 && v0 != 103 && v0 != 104 ) 1951 if ( v0 != 102 && v0 != 103 && v0 != 104 )
1952 { 1952 {
1953 pVideoPlayer->_4BF5B2(); 1953 pVideoPlayer->_4BF5B2();
1954 //LABEL_28: 1954 //LABEL_28:
1955 dialog_menu_id = 1; 1955 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
1956 sub_4B3B42(in_current_building_type); 1956 sub_4B3B42(in_current_building_type);
1957 return 1; 1957 return 1;
1958 } 1958 }
1959 pVideoPlayer->_4BF5B2(); 1959 pVideoPlayer->_4BF5B2();
1960 UI_CreateEndConversationButton(); 1960 UI_CreateEndConversationButton();
1961 dialog_menu_id = 101; 1961 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN;
1962 sub_4B3A72(in_current_building_type); 1962 sub_4B3A72(in_current_building_type);
1963 } 1963 }
1964 return 1; 1964 return 1;
1965 } 1965 }
1966 pVideoPlayer->_4BF5B2(); 1966 pVideoPlayer->_4BF5B2();
1967 UI_CreateEndConversationButton(); 1967 UI_CreateEndConversationButton();
1968 dialog_menu_id = 1; 1968 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
1969 sub_4B3B42(in_current_building_type); 1969 sub_4B3B42(in_current_building_type);
1970 return 1; 1970 return 1;
1971 } 1971 }
1972 pDialogueNPCCount = 0; 1972 pDialogueNPCCount = 0;
1973 pDialogueWindow->Release(); 1973 pDialogueWindow->Release();
1974 dialog_menu_id = 0; 1974 dialog_menu_id = HOUSE_DIALOGUE_NULL;
1975 pDialogueWindow = 0; 1975 pDialogueWindow = 0;
1976 pIcons_LOD->_40F9C5(); 1976 pIcons_LOD->_40F9C5();
1977 v1 = uNumDialogueNPCPortraits; 1977 v1 = uNumDialogueNPCPortraits;
1978 if ( uNumDialogueNPCPortraits != 1 ) 1978 if ( uNumDialogueNPCPortraits != 1 )
1979 { 1979 {
2037 POINT *v28; // esi@49 2037 POINT *v28; // esi@49
2038 int v29; // ecx@49 2038 int v29; // ecx@49
2039 void *v30; // eax@50 2039 void *v30; // eax@50
2040 int v31; // ecx@50 2040 int v31; // ecx@50
2041 ItemGen *v32; // esi@51 2041 ItemGen *v32; // esi@51
2042 float v33; // ST1C_4@53 2042 //float v33; // ST1C_4@53
2043 signed int v34; // eax@53 2043 //signed int v34; // eax@53
2044 int v35; // eax@53 2044 //int v35; // eax@53
2045 bool v36; // eax@53 2045 //bool v36; // eax@53
2046 unsigned int v37; // eax@53 2046 unsigned int v37; // eax@53
2047 int v38; // eax@55 2047 int v38; // eax@55
2048 int v39; // eax@63 2048 int v39; // eax@63
2049 int v40; // eax@64 2049 //int v40; // eax@64
2050 int v41; // edx@66 2050 int v41; // edx@66
2051 int v42; // esi@74 2051 int v42; // esi@74
2052 signed int v43; // ebx@74 2052 signed int v43; // ebx@74
2053 int v44; // ecx@74 2053 int v44; // ecx@74
2054 unsigned __int16 *pSkill; // esi@77 2054 unsigned __int16 *pSkill; // esi@77
2061 unsigned int v52; // [sp-4h] [bp-B8h]@36 2061 unsigned int v52; // [sp-4h] [bp-B8h]@36
2062 int v53; // [sp+0h] [bp-B4h]@16 2062 int v53; // [sp+0h] [bp-B4h]@16
2063 unsigned int v54; // [sp+0h] [bp-B4h]@25 2063 unsigned int v54; // [sp+0h] [bp-B4h]@25
2064 int v55; // [sp+0h] [bp-B4h]@26 2064 int v55; // [sp+0h] [bp-B4h]@26
2065 int v56; // [sp+0h] [bp-B4h]@36 2065 int v56; // [sp+0h] [bp-B4h]@36
2066 POINT v57; // [sp+10h] [bp-A4h]@49 2066 //POINT v57; // [sp+10h] [bp-A4h]@49
2067 //POINT v58; // [sp+18h] [bp-9Ch]@18 2067 //POINT v58; // [sp+18h] [bp-9Ch]@18
2068 POINT v59; // [sp+20h] [bp-94h]@49 2068 POINT v59; // [sp+20h] [bp-94h]@49
2069 POINT v60; // [sp+28h] [bp-8Ch]@9 2069 POINT v60; // [sp+28h] [bp-8Ch]@9
2070 POINT v61; // [sp+30h] [bp-84h]@37 2070 POINT v61; // [sp+30h] [bp-84h]@37
2071 POINT v62; // [sp+38h] [bp-7Ch]@18 2071 POINT v62; // [sp+38h] [bp-7Ch]@18
2077 POINT a2; // [sp+68h] [bp-4Ch]@9 2077 POINT a2; // [sp+68h] [bp-4Ch]@9
2078 POINT v69; // [sp+70h] [bp-44h]@31 2078 POINT v69; // [sp+70h] [bp-44h]@31
2079 POINT v70; // [sp+78h] [bp-3Ch]@9 2079 POINT v70; // [sp+78h] [bp-3Ch]@9
2080 POINT v71; // [sp+80h] [bp-34h]@31 2080 POINT v71; // [sp+80h] [bp-34h]@31
2081 POINT v72; // [sp+88h] [bp-2Ch]@10 2081 POINT v72; // [sp+88h] [bp-2Ch]@10
2082 bool v73; // [sp+90h] [bp-24h]@53 2082 //bool v73; // [sp+90h] [bp-24h]@53
2083 int v74; // [sp+94h] [bp-20h]@53 2083 int v74; // [sp+94h] [bp-20h]@53
2084 int a6; // [sp+98h] [bp-1Ch]@57 2084 int a6; // [sp+98h] [bp-1Ch]@57
2085 int a3; // [sp+9Ch] [bp-18h]@53 2085 int a3; // [sp+9Ch] [bp-18h]@53
2086 Player *v77; // [sp+A0h] [bp-14h]@1 2086 Player *v77; // [sp+A0h] [bp-14h]@1
2087 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53 2087 unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
2106 v47 = 0; 2106 v47 = 0;
2107 v46 = 0; 2107 v46 = 0;
2108 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); 2108 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
2109 return; 2109 return;
2110 } 2110 }
2111
2111 switch(dialog_menu_id) 2112 switch(dialog_menu_id)
2112 { 2113 {
2113 case 94: 2114 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
2114 { 2115 {
2115 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 2116 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
2116 sub_421EA6_OnInventoryLeftClick(); 2117 sub_421EA6_OnInventoryLeftClick();
2117 break; 2118 break;
2118 } 2119 }
2119 case 18: 2120 case HOUSE_DIALOGUE_GULD_BUY_BOOKS:
2120 { 2121 {
2121 v17 = pMouse->GetCursorPos(&v63); 2122 v17 = pMouse->GetCursorPos(&v63);
2122 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; 2123 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF;
2123 if ( !v18 ) 2124 if ( !v18 )
2124 return; 2125 return;
2126 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19)); 2127 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19));
2127 //v21 = p2DEvents_minus1__20[13 * (signed int)v19]; 2128 //v21 = p2DEvents_minus1__20[13 * (signed int)v19];
2128 v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier; 2129 v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier;
2129 _this = v20; 2130 _this = v20;
2130 v22 = v20->GetValue(); 2131 v22 = v20->GetValue();
2131 v23 = v0->_4B8142(v22, v21); 2132 v23 = v0->GetBuyingPrice(v22, v21);
2132 v80 = v23; 2133 v80 = v23;
2133 GetAsyncKeyState(VK_CONTROL); 2134 GetAsyncKeyState(VK_CONTROL);
2134 if ( pParty->uNumGold < v23 ) 2135 if ( pParty->uNumGold < v23 )
2135 { 2136 {
2136 v24 = 2; 2137 v24 = 2;
2163 //LABEL_70: 2164 //LABEL_70:
2164 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" 2165 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
2165 ShowStatusBarString(v9, v54); 2166 ShowStatusBarString(v9, v54);
2166 break; 2167 break;
2167 } 2168 }
2168 case 3: 2169
2170 case HOUSE_DIALOGUE_SHOP_SELL:
2169 { 2171 {
2170 v14 = pMouse->GetCursorPos(&v71)->x - 14; 2172 v14 = pMouse->GetCursorPos(&v71)->x - 14;
2171 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); 2173 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5);
2172 if ( pMouse->GetCursorPos(&v67)->x <= 13 2174 if ( pMouse->GetCursorPos(&v67)->x <= 13
2173 || pMouse->GetCursorPos(&v65)->x >= 462 2175 || pMouse->GetCursorPos(&v65)->x >= 462
2197 //LABEL_87: 2199 //LABEL_87:
2198 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); 2200 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
2199 break; 2201 break;
2200 } 2202 }
2201 2203
2202 case 4: 2204 case HOUSE_DIALOGUE_SHOP_IDENTIFY:
2203 { 2205 {
2204 pMouse->GetCursorPos(&v62); 2206 pMouse->GetCursorPos(&v62);
2205 v10 = v62.x - 14; 2207 v10 = v62.x - 14;
2206 v79 = (v10 >> 5) + 14 * ((v62.y - 17) >> 5); 2208 v79 = (v10 >> 5) + 14 * ((v62.y - 17) >> 5);
2207 if (v62.x > 13 && v62.x < 462) 2209 if (v62.x > 13 && v62.x < 462)
2248 return; 2250 return;
2249 } 2251 }
2250 } 2252 }
2251 break; 2253 break;
2252 } 2254 }
2253 case 5: 2255
2256
2257 case HOUSE_DIALOGUE_SHOP_REPAIR:
2254 { 2258 {
2255 v1 = pMouse->GetCursorPos(&a2)->x - 14; 2259 v1 = pMouse->GetCursorPos(&a2)->x - 14;
2256 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); 2260 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5);
2257 if ( pMouse->GetCursorPos(&v60)->x > 13 ) 2261 if ( pMouse->GetCursorPos(&v60)->x > 13 )
2258 { 2262 {
2315 } 2319 }
2316 } 2320 }
2317 } 2321 }
2318 break; 2322 break;
2319 } 2323 }
2320 case 2: 2324
2321 case 95: 2325 case HOUSE_DIALOGUE_SHOP_BUY_STANDARD:
2326 case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL:
2322 { 2327 {
2323 //LABEL_49: 2328 //LABEL_49:
2324 v28 = pMouse->GetCursorPos(&v59); 2329 v28 = pMouse->GetCursorPos(&v59);
2325 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; 2330 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[v28->y]] & 0xFFFF;
2326 if ( !v29 ) 2331 if ( !v29 )
2327 return; 2332 return;
2328 v30 = window_SpeakInHouse->ptr_1C; 2333 v30 = window_SpeakInHouse->ptr_1C;
2329 // v31 = 9 * (v29 - 1 + 12 * (int)v30); 2334 // v31 = 9 * (v29 - 1 + 12 * (int)v30);
2330 if ( dialog_menu_id == 2 ) 2335 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
2331 { 2336 {
2332 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1]; 2337 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1];
2333 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1]; 2338 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1];
2334 } 2339 }
2335 else 2340 else
2336 { 2341 {
2337 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; 2342 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
2338 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; 2343 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
2339 } 2344 }
2340 //v33 = p2DEvents_minus1__20[13 * (signed int)v30]; 2345 //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
2341 v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; 2346 //v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
2342 v34 = v32->GetValue(); 2347 //v34 = v32->GetValue();
2343 v80 = v0->_4B8142(v34, v33); 2348 v80 = v0->GetBuyingPrice(v32->GetValue(), p2DEvents[(unsigned int)v30 - 1].fPriceMultiplier);
2344 LOWORD(v35) = GetAsyncKeyState(VK_CONTROL); 2349 //LOWORD(v35) = GetAsyncKeyState(VK_CONTROL);
2345 v74 = v35; 2350 v74 = GetAsyncKeyState(VK_CONTROL);
2346 v36 = v0->CanSteal(); 2351 //v36 = v0->CanSteal();
2347 uNumSeconds = 0; 2352 uNumSeconds = 0;
2348 a3 = 0; 2353 a3 = 0;
2349 v73 = v36; 2354 //v73 = v0->CanSteal();
2350 v37 = pMapStats->GetMapInfo(pCurrentMapName); 2355 v37 = pMapStats->GetMapInfo(pCurrentMapName);
2351 if ( v37 ) 2356 if ( v37 )
2352 a3 = pMapStats->pInfos[v37]._steal_perm; 2357 a3 = pMapStats->pInfos[v37]._steal_perm;
2353 v38 = GetPartyReputation(); 2358 v38 = GetPartyReputation();
2354 v26 = 1; 2359 v26 = 1;
2355 if ( v73 == 1 ) 2360 if (v0->CanSteal())
2356 { 2361 {
2357 if ( (short)v74 ) 2362 if ( v74 )
2358 { 2363 {
2359 uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6); 2364 uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6);
2360 if ( !uNumSeconds ) 2365 if ( !uNumSeconds )
2361 { 2366 {
2362 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6); 2367 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
2370 if ( uNumSeconds != 2 ) 2375 if ( uNumSeconds != 2 )
2371 { 2376 {
2372 if ( uNumSeconds != 1 ) 2377 if ( uNumSeconds != 1 )
2373 { 2378 {
2374 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24); 2379 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24);
2375 v9 = pGlobalTXT_LocalizationStrings[155]; 2380 v9 = pGlobalTXT_LocalizationStrings[155]; // "You don't have enough gold"
2376 v54 = 2; 2381 v54 = 2;
2377 ShowStatusBarString(v9, v54); 2382 ShowStatusBarString(v9, v54);
2378 return; 2383 return;
2379 } 2384 }
2380 } 2385 }
2381 } 2386 }
2382 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); 2387 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
2383 if ( v39 ) 2388 if ( v39 )
2384 { 2389 {
2385 v32->SetIdentified(); 2390 v32->SetIdentified();
2386 v7 = v73 == 1; 2391 v7 = v0->CanSteal();
2387 v40 = (int)((char *)v0 + 36 * v39); 2392 //v40 = (int)((char *)v0 + 36 * v39);
2388 memcpy((void *)(v40 + 496), v32, 0x24u); 2393 //memcpy((void *)(v40 + 496), v32, 0x24u);
2394 memcpy(&v0->pInventoryItems[v39 - 1], v32, sizeof(ItemGen));
2389 if ( v7 ) 2395 if ( v7 )
2390 { 2396 {
2391 if ( (short)v74 ) 2397 if ( v74 )
2392 { 2398 {
2393 v41 = uNumSeconds; 2399 v41 = uNumSeconds;
2394 if ( uNumSeconds == 1 || uNumSeconds == 2 ) 2400 if ( uNumSeconds == 1 || uNumSeconds == 2 )
2395 { 2401 {
2396 *(char *)(v40 + 517) |= 1u; 2402 //*(char *)(v40 + 517) |= 1u;
2403 v0->pInventoryItems[v39 - 1].SetStolen();
2397 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); 2404 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6);
2398 viewparams->bRedrawGameUI = v26; 2405 viewparams->bRedrawGameUI = v26;
2399 _this->Reset(); 2406 _this->Reset();
2400 pRenderer->ClearZBuffer(0, 479); 2407 pRenderer->ClearZBuffer(0, 479);
2401 v27 = v77; 2408 v27 = v77;
2427 break; 2434 break;
2428 } 2435 }
2429 2436
2430 default: 2437 default:
2431 { 2438 {
2439 __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum
2432 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) 2440 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 )
2433 { 2441 {
2434 v42 = dialog_menu_id - 36; 2442 v42 = dialog_menu_id - 36;
2435 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 2443 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
2436 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 2444 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
5051 v44 = "%s C"; 5059 v44 = "%s C";
5052 } 5060 }
5053 } 5061 }
5054 sprintf(Str2, v44, pTexture); 5062 sprintf(Str2, v44, pTexture);
5055 } 5063 }
5056 v26 = pMonsterList->GetMonsterByName(Str2); 5064 v50 = pMonsterList->GetMonsterIDByName(Str2);
5057 v50 = (signed __int16)v26;
5058 pTexture = Str2; 5065 pTexture = Str2;
5059 if ( (signed __int16)v26 == -1 ) 5066 if ( (signed __int16)v50 == -1 )
5060 { 5067 {
5061 sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture); 5068 sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture);
5062 MessageBoxA(nullptr, Str, nullptr, 0); 5069 MessageBoxA(nullptr, Str, nullptr, 0);
5063 ExitProcess(0); 5070 ExitProcess(0);
5064 } 5071 }
5065 v27 = &pMonsterList->pMonsters[(signed __int16)v26]; 5072 v27 = &pMonsterList->pMonsters[(signed __int16)v50];
5066 v28 = pMonsterStats->FindMonsterByName(pTexture); 5073 v28 = pMonsterStats->FindMonsterByTextureName(pTexture);
5067 if ( !v28 ) 5074 if ( !v28 )
5068 v28 = 1; 5075 v28 = 1;
5069 Src = &pMonsterStats->pInfos[v28]; 5076 Src = &pMonsterStats->pInfos[v28];
5070 strcpy(pMonster->pActorName, Src->pName); 5077 strcpy(pMonster->pActorName, Src->pName);
5071 pMonster->sCurrentHP = Src->uHP; 5078 pMonster->sCurrentHP = Src->uHP;
5166 if ( a2 == 3 ) 5173 if ( a2 == 3 )
5167 v15 = "Elemental Light B"; 5174 v15 = "Elemental Light B";
5168 else 5175 else
5169 v15 = "Elemental Light A"; 5176 v15 = "Elemental Light A";
5170 } 5177 }
5171 v23 = (signed __int16)pMonsterList->GetMonsterByName(v15); 5178 v23 = pMonsterList->GetMonsterIDByName(v15);
5172 v3 = 0; 5179 v3 = 0;
5173 v20 = uNumActors; 5180 v20 = uNumActors;
5174 if ( (signed int)uNumActors > 0 ) 5181 if ( (signed int)uNumActors > 0 )
5175 { 5182 {
5176 v4 = pActors;//[0].uAIState; 5183 v4 = pActors;//[0].uAIState;
9438 9445
9439 uint uWinCenteredPosX = (uDesktopWidth - uTotalWinWidth) / 2; 9446 uint uWinCenteredPosX = (uDesktopWidth - uTotalWinWidth) / 2;
9440 uint uWinCenteredPosY = (uDesktopHeight - uTotalWinHeight) / 2; 9447 uint uWinCenteredPosY = (uDesktopHeight - uTotalWinHeight) / 2;
9441 9448
9442 uWindowX = ReadWindowsRegistryInt("window X", uWinCenteredPosX); 9449 uWindowX = ReadWindowsRegistryInt("window X", uWinCenteredPosX);
9443 uWindowX = 0; 9450 uWindowX = uDesktopWidth / 2 - 640 / 2;
9444 WriteWindowsRegistryInt("window X", uWindowX); 9451 WriteWindowsRegistryInt("window X", uWindowX);
9445 9452
9446 uWindowY = ReadWindowsRegistryInt("window Y", uWinCenteredPosY); 9453 uWindowY = ReadWindowsRegistryInt("window Y", uWinCenteredPosY);
9447 uWindowY = 0; 9454 uWindowY = uDesktopHeight / 2 - 480 / 2;
9448 WriteWindowsRegistryInt("window Y", uWindowY); 9455 WriteWindowsRegistryInt("window Y", uWindowY);
9449 9456
9450 hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and Magic VII", 9457 hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and Magic VII",
9451 uWindowStyle = WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER, 9458 uWindowStyle = WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER,
9452 uWindowX, uWindowY, 9459 uWindowX, uWindowY,
9456 wcxw.hInstance, 9463 wcxw.hInstance,
9457 nullptr); 9464 nullptr);
9458 SetWindowTextW(hWnd, L"Might and Magic VII"); 9465 SetWindowTextW(hWnd, L"Might and Magic VII");
9459 9466
9460 HMENU menu = CreateMenu(); 9467 HMENU menu = CreateMenu();
9461 AppendMenuW(menu, MF_ENABLED | MF_STRING, 0x101, L"Open level..."); 9468 {
9469 HMENU file = CreatePopupMenu();
9470 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)file, L"&File");
9471 {
9472 AppendMenuW(file, MF_ENABLED | MF_STRING, 40001, L"Exit");
9473 }
9474
9475 HMENU debug = CreatePopupMenu();
9476 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug, L"&Debug");
9477 {
9478 HMENU debug_party = CreatePopupMenu();
9479 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party, L"&Party");
9480 {
9481 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40007, L"Give Gold (10 000)");
9482 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40008, L"Give Exp (20 000)");
9483 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40059, L"Give Skills (50 each)");
9484 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40013, L"Remove Gold");
9485
9486 HMENU debug_party_setconditions = CreatePopupMenu();
9487 AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_setconditions, L"Set Condition");
9488 {
9489 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40044, L"Afraid");
9490 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40043, L"Asleep");
9491 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40037, L"Curse");
9492 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40036, L"Disease1");
9493 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40035, L"Disease2");
9494 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40034, L"Disease3");
9495 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40041, L"Dead");
9496 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40039, L"Drunk");
9497 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40042, L"Eradicated");
9498 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40038, L"Insane");
9499 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40045, L"Paralyzed");
9500 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40033, L"Poison1");
9501 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40032, L"Poison2");
9502 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40031, L"Poison3");
9503 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40029, L"&Stone");
9504 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40040, L"Unconscious");
9505 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40030, L"Weak");
9506 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40073, L"Zombie");
9507 }
9508
9509 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40006, L"Set Food (20)");
9510
9511 HMENU debug_party_alignment = CreatePopupMenu();
9512 AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_alignment, L"Alignment");
9513 {
9514 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40062, L"Good");
9515 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING | MF_CHECKED, 40063, L"Neutral");
9516 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40064, L"Evil");
9517 }
9518 }
9519
9520 HMENU debug_time = CreatePopupMenu();
9521 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_time, L"&Time");
9522 {
9523 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40009, L"Add 1 Day");
9524 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40010, L"Add 1 Week");
9525 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40011, L"Add 1 Month");
9526 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40012, L"Add 1 Year");
9527 }
9528
9529 HMENU debug_items = CreatePopupMenu();
9530 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_items, L"&Items");
9531 {
9532 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40015, L"Generate level &1 item");
9533 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40016, L"Generate level &2 item");
9534 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40017, L"Generate level &3 item");
9535 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40018, L"Generate level &4 item");
9536 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40019, L"Generate level &5 item");
9537 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40020, L"Generate level &6 item");
9538 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40061, L"Generate special item");
9539 }
9540
9541 HMENU debug_graphics = CreatePopupMenu();
9542 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_graphics, L"&Graphics");
9543 {
9544 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40023, L"Lighting Mode");
9545 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40024, L"Lighting Geometry");
9546 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40104, L"Lights Off");
9547 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40105, L"Colored Lights");
9548 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40025, L"Debug Lights");
9549 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40101, L"Debug Decals");
9550 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40027, L"HWID Portals");
9551 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40047, L"SWID Portals");
9552 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40051, L"OD Frustum");
9553 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40054, L"SWOD Constant Redraw");
9554 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40055, L"SWOD Lit Rasterizer");
9555 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40056, L"Party Light off");
9556 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40060, L"SWOD Nice Lighting off");
9557 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40067, L"HWOD Additive Fog Lights");
9558 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40072, L"HWID Nice Lighting");
9559 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40048, L"Wireframe");
9560 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40049, L"Fog");
9561 }
9562
9563 HMENU debug_misc = CreatePopupMenu();
9564 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_misc, L"&Misc");
9565 {
9566 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40066, L"Object Viewcone Culling");
9567 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40068, L"Red Tint");
9568 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40071, L"Display Secrets");
9569 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40102, L"Massive Bloodsplat");
9570 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40103, L"Underwater Gravity");
9571 }
9572
9573 HMENU debug_eax = CreatePopupMenu();
9574 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_eax, L"EAX Environs");
9575 {
9576 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40074, L"NONE");
9577 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40075, L"GENERIC");
9578 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40076, L"PADDEDCELL");
9579 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40077, L"ROOM");
9580 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40078, L"BATHROOM");
9581 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40079, L"LIVINGROOM");
9582 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40080, L"STONEROOM");
9583 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40081, L"AUDITORIUM");
9584 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40082, L"CONCERTHALL");
9585 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40083, L"CAVE");
9586 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40084, L"ARENA");
9587 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40085, L"HANGAR");
9588 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40086, L"CARPETEDHALLWAY");
9589 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40087, L"HALLWAY");
9590 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40088, L"STONECORRIDOR");
9591 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40089, L"ALLEY");
9592 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40090, L"FOREST");
9593 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40091, L"CITY");
9594 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40092, L"MOUNTAINS");
9595 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40093, L"QUARRY");
9596 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40094, L"PLAIN");
9597 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40095, L"PARKINGLOT");
9598 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40096, L"SEWERPIPE");
9599 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40097, L"UNDERWATER");
9600 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40098, L"DRUGGED");
9601 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40099, L"DIZZY");
9602 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40100, L"PSICHOTIC");
9603 }
9604 }
9605 }
9462 SetMenu(hWnd, menu); 9606 SetMenu(hWnd, menu);
9463 9607
9464 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); 9608 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
9465 9609
9466 pRenderer = Render::Create(); 9610 pRenderer = Render::Create();