Mercurial > mm7
comparison mm7_2.cpp @ 510:7c86030324a5
Слияние
author | Ritor1 |
---|---|
date | Fri, 01 Mar 2013 18:38:12 +0600 |
parents | 0e20e886365d |
children | cb0ad52d6a26 d2a55c0a8dda |
comparison
equal
deleted
inserted
replaced
509:dddedef7a98e | 510:7c86030324a5 |
---|---|
1402 } | 1402 } |
1403 } | 1403 } |
1404 return result; | 1404 return result; |
1405 } | 1405 } |
1406 } | 1406 } |
1407 pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); | 1407 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); |
1408 v3 = 0; | 1408 v3 = 0; |
1409 if ( dword_F8B19C == 2 ) | 1409 if ( dword_F8B19C == 2 ) |
1410 { | 1410 { |
1411 v48 = 0; | 1411 v48 = 0; |
1412 v108 = 0; | 1412 v108 = 0; |
1942 LABEL_46: | 1942 LABEL_46: |
1943 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); | 1943 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); |
1944 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); | 1944 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); |
1945 } | 1945 } |
1946 } | 1946 } |
1947 pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); | 1947 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); |
1948 v3 = 0; | 1948 v3 = 0; |
1949 v114 = 0; | 1949 v114 = 0; |
1950 if ( dword_F8B19C == 2 ) | 1950 if ( dword_F8B19C == 2 ) |
1951 { | 1951 { |
1952 do | 1952 do |
2376 } | 2376 } |
2377 } | 2377 } |
2378 break; | 2378 break; |
2379 case 2: //buy standart | 2379 case 2: //buy standart |
2380 { | 2380 { |
2381 pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); | 2381 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); |
2382 v55 = 0; | 2382 v55 = 0; |
2383 v153 = 0; | 2383 v153 = 0; |
2384 for(int i=0; i<8; ++i) | 2384 for(int i=0; i<8; ++i) |
2385 { | 2385 { |
2386 // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) | 2386 // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) |
2578 return; | 2578 return; |
2579 } | 2579 } |
2580 break; | 2580 break; |
2581 case 6: | 2581 case 6: |
2582 { | 2582 { |
2583 pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); | 2583 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); |
2584 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); | 2584 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); |
2585 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 2585 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) |
2586 return; | 2586 return; |
2587 v149 = 0; | 2587 v149 = 0; |
2588 v93 = 0; | 2588 v93 = 0; |
2707 } | 2707 } |
2708 break; | 2708 break; |
2709 case 95: //buy spesial | 2709 case 95: //buy spesial |
2710 { | 2710 { |
2711 | 2711 |
2712 pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); | 2712 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); |
2713 | 2713 |
2714 v11 = 0; | 2714 v11 = 0; |
2715 v61 = 0; | 2715 v61 = 0; |
2716 v153 = 0; | 2716 v153 = 0; |
2717 do | 2717 do |
3606 | 3606 |
3607 | 3607 |
3608 | 3608 |
3609 | 3609 |
3610 //----- (004BC8D5) -------------------------------------------------------- | 3610 //----- (004BC8D5) -------------------------------------------------------- |
3611 Texture *__cdecl sub_4BC8D5() | 3611 void SpellBookGenerator() |
3612 { | 3612 { |
3613 int v0; // esi@1 | 3613 int v0; // esi@1 |
3614 char *v1; // ebx@1 | 3614 int v1; // ebx@1 |
3615 signed int v2; // edi@1 | 3615 signed int v2; // edi@1 |
3616 signed int v3; // eax@2 | 3616 signed int v3; // eax@2 |
3617 int v4; // esi@7 | 3617 int v4; // esi@7 |
3618 GUIWindow *v5; // ebp@15 | 3618 GUIWindow *v5; // ebp@15 |
3619 Texture *result; // eax@15 | 3619 Texture *result; // eax@15 |
3620 int v7; // [sp+10h] [bp-4h]@0 | 3620 int v7; // [sp+10h] [bp-4h]@0 |
3621 | 3621 |
3622 v0 = v7; | 3622 // v0 = v7; |
3623 v1 = (char *)window_SpeakInHouse->ptr_1C - 139; | 3623 v1 = window_SpeakInHouse->par1C - 139; |
3624 v2 = 0; | 3624 v2 = 0; |
3625 do | 3625 for(int i=0; i<12; ++i) |
3626 { | 3626 { |
3627 //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; | 3627 //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
3628 v3 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType; | 3628 v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType; |
3629 if ( v3 < 5 ) | 3629 if ( v3 < 5 ) |
3630 goto LABEL_12; | 3630 goto LABEL_12; |
3631 if ( v3 <= 13 ) | 3631 if ( v3 <= 13 ) |
3632 { | 3632 { |
3633 v0 = rand() % word_4F0F30[(signed int)v1] | 3633 v0 = rand() % word_4F0F30[(signed int)v1] |
3662 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) | 3662 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) |
3663 v0 = 486; | 3663 v0 = 486; |
3664 } | 3664 } |
3665 v5 = window_SpeakInHouse; | 3665 v5 = window_SpeakInHouse; |
3666 | 3666 |
3667 auto _u = (ItemGen *)&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + v2 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C; | 3667 ItemGen * _u = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; |
3668 _u->Reset(); | 3668 _u->Reset(); |
3669 *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v2 + 12 * (unsigned int)v5->ptr_1C)) = v0; | 3669 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID= v0; |
3670 *(&pParty->pPlayers[1].pInstalledBeacons[1].field_10 + 9 * (v2++ + 12 * (unsigned int)v5->ptr_1C)) = 1; | 3670 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); |
3671 result = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[v0].pIconName, TEXTURE_16BIT_PALETTE)]; | 3671 |
3672 *(&dword_F8B164 + v2) = result; | 3672 ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[v0].pIconName, TEXTURE_16BIT_PALETTE)]; |
3673 } | 3673 } |
3674 while ( v2 < 12 ); | 3674 |
3675 return result; | 3675 return; |
3676 } | 3676 } |
3677 | 3677 |
3678 | 3678 |
3679 //----- (004BCA33) -------------------------------------------------------- | 3679 //----- (004BCA33) -------------------------------------------------------- |
3680 GUIButton *__cdecl UI_CreateEndConversationButton() | 3680 GUIButton *__cdecl UI_CreateEndConversationButton() |
3803 dword_F8B19C = uMessageParam; | 3803 dword_F8B19C = uMessageParam; |
3804 if ( in_current_building_type < BildingType_19 ) | 3804 if ( in_current_building_type < BildingType_19 ) |
3805 { | 3805 { |
3806 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); | 3806 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); |
3807 //v3 = dword_F8B198; | 3807 //v3 = dword_F8B198; |
3808 dword_F8B164 = &pIcons_LOD->pTextures[v9]; | 3808 ShopTexture = &pIcons_LOD->pTextures[v9]; |
3809 LABEL_13: | 3809 LABEL_13: |
3810 v8 = window_SpeakInHouse; | 3810 v8 = window_SpeakInHouse; |
3811 } | 3811 } |
3812 if ( in_current_building_type > BildingType_Tavern ) | 3812 if ( in_current_building_type > BildingType_Tavern ) |
3813 { | 3813 { |
3835 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) | 3835 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) |
3836 { | 3836 { |
3837 v32 = 0; | 3837 v32 = 0; |
3838 do | 3838 do |
3839 { | 3839 { |
3840 v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); | 3840 //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); |
3841 v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; | |
3841 if ( v33 ) | 3842 if ( v33 ) |
3842 { | 3843 { |
3843 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); | 3844 v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); |
3844 v8 = window_SpeakInHouse; | 3845 v8 = window_SpeakInHouse; |
3845 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; | 3846 ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; |
3848 } | 3849 } |
3849 while ( v32 < 12 ); | 3850 while ( v32 < 12 ); |
3850 } | 3851 } |
3851 else | 3852 else |
3852 { | 3853 { |
3853 sub_4BC8D5(); | 3854 SpellBookGenerator(); |
3854 v30 = window_SpeakInHouse->ptr_1C; | 3855 v30 = window_SpeakInHouse->ptr_1C; |
3855 v31 = pParty->uTimePlayed | 3856 v31 = pParty->uTimePlayed |
3856 + (signed __int64)((double)(0xA8C000 | 3857 + (signed __int64)((double)(0xA8C000 |
3857 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) | 3858 //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) |
3858 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) | 3859 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) |
4311 if ( dword_F8B19C != 2 | 4312 if ( dword_F8B19C != 2 |
4312 && dword_F8B19C != 3 | 4313 && dword_F8B19C != 3 |
4313 && dword_F8B19C != 97 | 4314 && dword_F8B19C != 97 |
4314 && dword_F8B19C != 5 | 4315 && dword_F8B19C != 5 |
4315 && dword_F8B19C != 4 | 4316 && dword_F8B19C != 4 |
4316 && dword_F8B164 ) | 4317 && ShopTexture ) |
4317 { | 4318 { |
4318 dword_F8B164->Release(); | 4319 ShopTexture->Release(); |
4319 v0 = dword_F8B19C; | 4320 v0 = dword_F8B19C; |
4320 dword_F8B164 = 0; | 4321 ShopTexture = 0; |
4321 } | 4322 } |
4322 if ( v0 && v0 != 1 ) | 4323 if ( v0 && v0 != 1 ) |
4323 { | 4324 { |
4324 if ( v0 == -1 ) | 4325 if ( v0 == -1 ) |
4325 { | 4326 { |
11419 } | 11420 } |
11420 pWindow_MainMenu->Release(); | 11421 pWindow_MainMenu->Release(); |
11421 pIcons_LOD->_4114F2(); | 11422 pIcons_LOD->_4114F2(); |
11422 } | 11423 } |
11423 | 11424 |
11424 | 11425 int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) |
11426 { | |
11427 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
11428 } | |
11425 | 11429 |
11426 | 11430 |
11427 //----- (004637EB) -------------------------------------------------------- | 11431 //----- (004637EB) -------------------------------------------------------- |
11428 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) | 11432 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) |
11429 { | 11433 { |
12690 nullptr, | 12694 nullptr, |
12691 hOSMenu = nullptr, | 12695 hOSMenu = nullptr, |
12692 wcxw.hInstance, | 12696 wcxw.hInstance, |
12693 nullptr); | 12697 nullptr); |
12694 SetWindowTextW(hWnd, L"Might and Magic VII"); | 12698 SetWindowTextW(hWnd, L"Might and Magic VII"); |
12695 | 12699 |
12696 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); | 12700 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); |
12697 | 12701 |
12698 pRenderer = Render::Create(); | 12702 pRenderer = Render::Create(); |
12699 if (!pRenderer) | 12703 if (!pRenderer) |
12700 { | 12704 { |
12713 { | 12717 { |
12714 Log::Warning(L"Render failed to initialize"); | 12718 Log::Warning(L"Render failed to initialize"); |
12715 return false; | 12719 return false; |
12716 } | 12720 } |
12717 } | 12721 } |
12718 | 12722 |
12719 pAllocator = Allocator::Create(); | 12723 pAllocator = Allocator::Create(); |
12720 if (!pAllocator->Initialize(26 * 1024)) | 12724 if (!pAllocator->Initialize(26 * 1024)) |
12721 { | 12725 { |
12722 MessageBoxW(nullptr, | 12726 MessageBoxW(nullptr, |
12723 L"Unable to Allocate 26Mb of RAM", | 12727 L"Unable to Allocate 26Mb of RAM", |
12724 L"More RAM Memory Required", MB_ICONEXCLAMATION); | 12728 L"More RAM Memory Required", MB_ICONEXCLAMATION); |
12725 return false; | 12729 return false; |
12726 } | 12730 } |
12727 | 12731 |
12728 game_starting_year = 1168; | 12732 game_starting_year = 1168; |
12729 | 12733 |
12730 pParty = new Party; | 12734 pParty = new Party; |
12731 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); | 12735 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); |
12732 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile); | 12736 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile); |
12929 pChestList->ToFile(); | 12933 pChestList->ToFile(); |
12930 pOverlayList->ToFile(); | 12934 pOverlayList->ToFile(); |
12931 pSoundList->ToFile(); | 12935 pSoundList->ToFile(); |
12932 } | 12936 } |
12933 | 12937 |
12934 | 12938 |
12935 if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// | 12939 if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// |
12936 // color depth != 16 | 12940 // color depth != 16 |
12937 // or | 12941 // or |
12938 // not in window | 12942 // not in window |
12939 { | 12943 { |
13265 { | 13269 { |
13266 uGameState = 0; | 13270 uGameState = 0; |
13267 } | 13271 } |
13268 else | 13272 else |
13269 __debugbreak(); | 13273 __debugbreak(); |
13270 /*{ | 13274 { |
13271 if (GetCurrentMenuID() != MENU_10) | 13275 /* if (GetCurrentMenuID() != MENU_10) |
13272 goto LABEL_49; | 13276 goto LABEL_49; |
13273 pMouse->Activate(0); | 13277 pMouse->Activate(0); |
13274 if (pAsyncMouse) | 13278 if (pAsyncMouse) |
13275 pAsyncMouse->Suspend(); | 13279 pAsyncMouse->Suspend(); |
13276 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) | 13280 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) |
13292 strcpy(pCurrentMapName, ofn.lpstrFileTitle); | 13296 strcpy(pCurrentMapName, ofn.lpstrFileTitle); |
13293 pMouse->Activate(1); | 13297 pMouse->Activate(1); |
13294 if (pAsyncMouse) | 13298 if (pAsyncMouse) |
13295 pAsyncMouse->Resume(); | 13299 pAsyncMouse->Resume(); |
13296 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) | 13300 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) |
13297 pAsyncKeyboard->Resume(); | 13301 pAsyncKeyboard->Resume();*/ |
13298 }*/ | 13302 } |
13299 //LABEL_48: | 13303 //LABEL_48: |
13300 pGame->Loop(); | 13304 pGame->Loop(); |
13301 LABEL_49: | 13305 LABEL_49: |
13302 if ( uGameState == 3 ) | 13306 if ( uGameState == 3 ) |
13303 __debugbreak(); | 13307 __debugbreak(); |
13333 } | 13337 } |
13334 } | 13338 } |
13335 else | 13339 else |
13336 Log::Warning(L"MM init: failed"); | 13340 Log::Warning(L"MM init: failed"); |
13337 pGame->Deinitialize(); | 13341 pGame->Deinitialize(); |
13342 return 1; | |
13338 } | 13343 } |
13339 | 13344 |
13340 | 13345 |
13341 | 13346 |
13342 | 13347 |
14574 if ( v51 ) | 14579 if ( v51 ) |
14575 v0->pEquipment.uOffHand = 0; | 14580 v0->pEquipment.uOffHand = 0; |
14576 LABEL_74: | 14581 LABEL_74: |
14577 if ( v50 ) | 14582 if ( v50 ) |
14578 stru_A750F8[uActiveCharacter - 1]._494836( | 14583 stru_A750F8[uActiveCharacter - 1]._494836( |
14579 *((int *)&pSpellDatas[66].field_8 + v50), | 14584 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), |
14580 uActiveCharacter - 1 + 9); | 14585 uActiveCharacter - 1 + 9); |
14581 break; | 14586 break; |
14582 case 1u: | 14587 case 1u: |
14583 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) | 14588 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) |
14584 goto LABEL_95; | 14589 goto LABEL_95; |