comparison mm7_2.cpp @ 23:509744251c8e

Player-related members
author Nomad
date Sun, 14 Oct 2012 00:27:38 +0200
parents 17150bdf321e
children 93bf1d5f6a6d
comparison
equal deleted inserted replaced
22:e7ee737cd473 23:509744251c8e
1305 if ( _this->field_1F5[4 * (int)result + 15] & 2 ) 1305 if ( _this->field_1F5[4 * (int)result + 15] & 2 )
1306 { 1306 {
1307 v85 = 0; 1307 v85 = 0;
1308 v83 = 5; 1308 v83 = 5;
1309 v81 = ptr_507BC0->ptr_1C; 1309 v81 = ptr_507BC0->ptr_1C;
1310 v79 = (ItemGen *)&_this->pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5]; 1310 v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5];
1311 v28 = (int)ptr_507BC0->ptr_1C; 1311 v28 = (int)ptr_507BC0->ptr_1C;
1312 v110 = uActiveCharacter - 1; 1312 v110 = uActiveCharacter - 1;
1313 v29 = _this->_490EEE( 1313 v29 = _this->_490EEE(
1314 (ItemGen *)&_this->pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5], 1314 (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5],
1315 1, 1315 1,
1316 v28, 1316 v28,
1317 5); 1317 5);
1318 v6 = v110; 1318 v6 = v110;
1319 v5 = (char *)pMerchantsRepairPhrases[v29]; 1319 v5 = (char *)pMerchantsRepairPhrases[v29];
1403 if ( result ) 1403 if ( result )
1404 { 1404 {
1405 v85 = 0; 1405 v85 = 0;
1406 v83 = 3; 1406 v83 = 3;
1407 v81 = ptr_507BC0->ptr_1C; 1407 v81 = ptr_507BC0->ptr_1C;
1408 v79 = (ItemGen *)&_this->pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; 1408 v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
1409 v12 = (int)ptr_507BC0->ptr_1C; 1409 v12 = (int)ptr_507BC0->ptr_1C;
1410 v110 = uActiveCharacter - 1; 1410 v110 = uActiveCharacter - 1;
1411 v13 = _this->_490EEE(v79, 1, v12, 3); 1411 v13 = _this->_490EEE(v79, 1, v12, 3);
1412 v6 = v110; 1412 v6 = v110;
1413 v5 = (char *)pMerchantsSellPhrases[v13]; 1413 v5 = (char *)pMerchantsSellPhrases[v13];
1440 v3 = 0; 1440 v3 = 0;
1441 if ( result ) 1441 if ( result )
1442 { 1442 {
1443 v85 = 0; 1443 v85 = 0;
1444 v83 = 4; 1444 v83 = 4;
1445 v4 = (ItemGen *)&_this->pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; 1445 v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
1446 if ( !(v4->uAttributtes & 1) ) 1446 if ( !(v4->uAttributes & 1) )
1447 { 1447 {
1448 v81 = ptr_507BC0->ptr_1C; 1448 v81 = ptr_507BC0->ptr_1C;
1449 v79 = v4; 1449 v79 = v4;
1450 v9 = (int)ptr_507BC0->ptr_1C; 1450 v9 = (int)ptr_507BC0->ptr_1C;
1451 v110 = uActiveCharacter - 1; 1451 v110 = uActiveCharacter - 1;
1815 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) 1815 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) )
1816 return result; 1816 return result;
1817 v93 = 0; 1817 v93 = 0;
1818 v91 = 3; 1818 v91 = 3;
1819 v89 = ptr_507BC0->ptr_1C; 1819 v89 = ptr_507BC0->ptr_1C;
1820 v87 = (ItemGen *)&_this->pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; 1820 v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
1821 v44 = (int)ptr_507BC0->ptr_1C; 1821 v44 = (int)ptr_507BC0->ptr_1C;
1822 v113 = uActiveCharacter - 1; 1822 v113 = uActiveCharacter - 1;
1823 v45 = _this->_490EEE(v87, 4, v44, 3); 1823 v45 = _this->_490EEE(v87, 4, v44, 3);
1824 v39 = v113; 1824 v39 = v113;
1825 v38 = (char *)pMerchantsSellPhrases[v45]; 1825 v38 = (char *)pMerchantsSellPhrases[v45];
1839 || (result = pMouse->GetCursorPos(&v97), result->x >= 462) 1839 || (result = pMouse->GetCursorPos(&v97), result->x >= 462)
1840 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) 1840 || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) )
1841 return result; 1841 return result;
1842 v93 = 0; 1842 v93 = 0;
1843 v91 = 4; 1843 v91 = 4;
1844 v37 = (ItemGen *)&_this->pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; 1844 v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
1845 if ( !(v37->uAttributtes & 1) ) 1845 if ( !(v37->uAttributes & 1) )
1846 { 1846 {
1847 v89 = ptr_507BC0->ptr_1C; 1847 v89 = ptr_507BC0->ptr_1C;
1848 v87 = v37; 1848 v87 = v37;
1849 v41 = (int)ptr_507BC0->ptr_1C; 1849 v41 = (int)ptr_507BC0->ptr_1C;
1850 v113 = uActiveCharacter - 1; 1850 v113 = uActiveCharacter - 1;
2786 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) 2786 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) )
2787 return; 2787 return;
2788 v124 = 0; 2788 v124 = 0;
2789 v122 = 5; 2789 v122 = 5;
2790 v120 = ptr_507BC0->ptr_1C; 2790 v120 = ptr_507BC0->ptr_1C;
2791 v116 = (ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; 2791 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5];
2792 v34 = (int)ptr_507BC0->ptr_1C; 2792 v34 = (int)ptr_507BC0->ptr_1C;
2793 uPlayerID = uActiveCharacter - 1; 2793 uPlayerID = uActiveCharacter - 1;
2794 v35 = v0->_490EEE((ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); 2794 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5);
2795 v14 = uPlayerID; 2795 v14 = uPlayerID;
2796 v15 = (char *)pMerchantsRepairPhrases[v35]; 2796 v15 = (char *)pMerchantsRepairPhrases[v35];
2797 goto LABEL_36; 2797 goto LABEL_36;
2798 } 2798 }
2799 if ( dword_F8B19C == 1 ) 2799 if ( dword_F8B19C == 1 )
2864 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) 2864 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) )
2865 return; 2865 return;
2866 v124 = 0; 2866 v124 = 0;
2867 v122 = 3; 2867 v122 = 3;
2868 v120 = ptr_507BC0->ptr_1C; 2868 v120 = ptr_507BC0->ptr_1C;
2869 v116 = (ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5]; 2869 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5];
2870 v12 = (int)ptr_507BC0->ptr_1C; 2870 v12 = (int)ptr_507BC0->ptr_1C;
2871 uPlayerID = uActiveCharacter - 1; 2871 uPlayerID = uActiveCharacter - 1;
2872 v13 = v0->_490EEE(v116, 2, v12, 3); 2872 v13 = v0->_490EEE(v116, 2, v12, 3);
2873 v14 = uPlayerID; 2873 v14 = uPlayerID;
2874 v15 = (char *)pMerchantsSellPhrases[v13]; 2874 v15 = (char *)pMerchantsSellPhrases[v13];
2888 if ( pMouse->GetCursorPos(&v143)->x < 462 ) 2888 if ( pMouse->GetCursorPos(&v143)->x < 462 )
2889 { 2889 {
2890 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); 2890 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149);
2891 if ( v2 ) 2891 if ( v2 )
2892 { 2892 {
2893 v3 = (ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5]; 2893 v3 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5];
2894 if ( v3->uAttributtes & 1 ) 2894 if ( v3->uAttributes & 1 )
2895 { 2895 {
2896 v118 = ptr_507BC0->ptr_1C; 2896 v118 = ptr_507BC0->ptr_1C;
2897 v4 = uActiveCharacter - 1; 2897 v4 = uActiveCharacter - 1;
2898 v5 = "%24"; 2898 v5 = "%24";
2899 v114 = v3; 2899 v114 = v3;
4168 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); 4168 //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0);
4169 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); 4169 v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0);
4170 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; 4170 v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
4171 if ( v37 < v36 / 3 ) 4171 if ( v37 < v36 / 3 )
4172 v37 = v36 / 3; 4172 v37 = v36 / 3;
4173 if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) 4173
4174 __debugbreak();
4175 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
4176 // or
4177 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
4178 // or
4179 //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
4180
4181 if (false)
4182 //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) )
4174 { 4183 {
4175 v38 = (int)(&v35->uIntelligence + v55); 4184 v38 = (int)(&v35->uIntelligence + v55);
4176 if ( !*(short *)v38 ) 4185 if ( !*(short *)v38 )
4177 { 4186 {
4178 if ( pParty->uNumGold < v37 ) 4187 if ( pParty->uNumGold < v37 )
4606 } 4615 }
4607 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID); 4616 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID);
4608 if ( v25 ) 4617 if ( v25 )
4609 { 4618 {
4610 v26 = 1; 4619 v26 = 1;
4611 v20->uAttributtes |= 1u; 4620 v20->uAttributes |= 1u;
4612 memcpy(&v0->pDarkSpellbook.bIsSpellAvailable[36 * v25 + 5], v20, 0x24u); 4621 memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v25 + 5], v20, 0x24u);
4613 goto LABEL_42; 4622 goto LABEL_42;
4614 } 4623 }
4615 v0->PlaySound(15, 0); 4624 v0->PlaySound(15, 0);
4616 v54 = 5; 4625 v54 = 5;
4617 LABEL_70: 4626 LABEL_70:
4674 } 4683 }
4675 } 4684 }
4676 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); 4685 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
4677 if ( v39 ) 4686 if ( v39 )
4678 { 4687 {
4679 v32->uAttributtes |= 1u; 4688 v32->uAttributes |= 1u;
4680 v7 = v73 == 1; 4689 v7 = v73 == 1;
4681 v40 = (int)((char *)v0 + 36 * v39); 4690 v40 = (int)((char *)v0 + 36 * v39);
4682 memcpy((void *)(v40 + 496), v32, 0x24u); 4691 memcpy((void *)(v40 + 496), v32, 0x24u);
4683 if ( v7 ) 4692 if ( v7 )
4684 { 4693 {
4718 if ( pMouse->GetCursorPos(&v67)->x <= 13 4727 if ( pMouse->GetCursorPos(&v67)->x <= 13
4719 || pMouse->GetCursorPos(&v65)->x >= 462 4728 || pMouse->GetCursorPos(&v65)->x >= 462
4720 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) ) 4729 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) )
4721 return; 4730 return;
4722 v16 = ptr_507BC0; 4731 v16 = ptr_507BC0;
4723 if ( sub_4BDAAF((ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v15 + 5], (int)ptr_507BC0->ptr_1C) ) 4732 if ( sub_4BDAAF((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v15 + 5], (int)ptr_507BC0->ptr_1C) )
4724 { 4733 {
4725 dword_F8B1E4 = 1; 4734 dword_F8B1E4 = 1;
4726 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C); 4735 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C);
4727 viewparams->bRedrawGameUI = 1; 4736 viewparams->bRedrawGameUI = 1;
4728 pRenderer->ClearZBuffer(0, 479); 4737 pRenderer->ClearZBuffer(0, 479);
4753 v11 = v0->GetItemIDAtInventoryIndex((int *)&v79); 4762 v11 = v0->GetItemIDAtInventoryIndex((int *)&v79);
4754 if ( v11 ) 4763 if ( v11 )
4755 { 4764 {
4756 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]); 4765 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]);
4757 v80 = v0->_4B8179(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier); 4766 v80 = v0->_4B8179(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier);
4758 v12 = (int)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v11 + 5]; 4767 v12 = (int)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v11 + 5];
4759 if ( !(*(char *)(v12 + 20) & 1) ) 4768 if ( !(*(char *)(v12 + 20) & 1) )
4760 { 4769 {
4761 _this = (ItemGen *)ptr_507BC0->ptr_1C; 4770 _this = (ItemGen *)ptr_507BC0->ptr_1C;
4762 if ( sub_4BDAAF((ItemGen *)v12, (int)_this) ) 4771 if ( sub_4BDAAF((ItemGen *)v12, (int)_this) )
4763 { 4772 {
4795 if ( pMouse->GetCursorPos(&v72)->x < 462 ) 4804 if ( pMouse->GetCursorPos(&v72)->x < 462 )
4796 { 4805 {
4797 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79); 4806 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79);
4798 if ( v2 ) 4807 if ( v2 )
4799 { 4808 {
4800 v3 = (int)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5]; 4809 v3 = (int)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5];
4801 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; 4810 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
4802 v4 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; 4811 v4 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier;
4803 4812
4804 auto _v = (ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5]; 4813 auto _v = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5];
4805 v5 = _v->GetValue(); 4814 v5 = _v->GetValue();
4806 4815
4807 v6 = v0->_4B81C3(v5, v4); 4816 v6 = v0->_4B81C3(v5, v4);
4808 v7 = (*(char *)(v3 + 20) & 2) == 0; 4817 v7 = (*(char *)(v3 + 20) & 2) == 0;
4809 v80 = v6; 4818 v80 = v6;
8019 if ( v15 >= (signed int)pObjectList->uNumObjects ) 8028 if ( v15 >= (signed int)pObjectList->uNumObjects )
8020 goto LABEL_24; 8029 goto LABEL_24;
8021 } 8030 }
8022 v18 = v15; 8031 v18 = v15;
8023 } 8032 }
8024 a1a.stru_24.uAttributtes |= 1u; 8033 a1a.stru_24.uAttributes |= 1u;
8025 a1a.uObjectDescID = v18; 8034 a1a.uObjectDescID = v18;
8026 a1a.stru_24.uAdditionalValue = v34; 8035 a1a.stru_24.uAdditionalValue = v34;
8027 goto LABEL_35; 8036 goto LABEL_35;
8028 } 8037 }
8029 v14 = rand() % 3001 + 2000; 8038 v14 = rand() % 3001 + 2000;
8178 v10 = rand() % 3001 + 2000; 8187 v10 = rand() % 3001 + 2000;
8179 goto LABEL_15; 8188 goto LABEL_15;
8180 } 8189 }
8181 } 8190 }
8182 LABEL_23: 8191 LABEL_23:
8183 v3->uAttributtes |= 1u; 8192 v3->uAttributes |= 1u;
8184 v3->uAdditionalValue = v10; 8193 v3->uAdditionalValue = v10;
8185 LABEL_25: 8194 LABEL_25:
8186 v11 = v4 - 1; 8195 v11 = v4 - 1;
8187 v12 = 0; 8196 v12 = 0;
8188 if ( v11 > 0 ) 8197 if ( v11 > 0 )
15215 uCPUSpeed = Rect.bottom; 15224 uCPUSpeed = Rect.bottom;
15216 15225
15217 15226
15218 if (MM7_Initialize()) 15227 if (MM7_Initialize())
15219 { 15228 {
15229 Log::Warning(L"MM init: ok");
15230
15220 pEventTimer->Pause(); 15231 pEventTimer->Pause();
15221 if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) 15232 if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 )
15222 { 15233 {
15223 SetWindowPos(hWnd, (HWND)((int)HWND_MESSAGE|0x2), 320, 240, 640, 480, 0); 15234 SetWindowPos(hWnd, (HWND)((int)HWND_MESSAGE|0x2), 320, 240, 640, 480, 0);
15224 Rect.left = 325; 15235 Rect.left = 325;
15233 dword_6BE364_game_settings_1 |= 0x4000; 15244 dword_6BE364_game_settings_1 |= 0x4000;
15234 pGame->InitializeGammaController(); 15245 pGame->InitializeGammaController();
15235 SecondaryInitialization(); 15246 SecondaryInitialization();
15236 pRenderer->Clip_v2(0, 0, 639u, 479u); 15247 pRenderer->Clip_v2(0, 0, 639u, 479u);
15237 FinalInitialization(); 15248 FinalInitialization();
15249
15250 Log::Warning(L"MM: entering main loop");
15238 while ( 1 ) 15251 while ( 1 )
15239 { 15252 {
15240 MainMenu_Loop(); 15253 MainMenu_Loop();
15241 LABEL_21: 15254 LABEL_21:
15242 uGameState = 0; 15255 uGameState = 0;
15328 } 15341 }
15329 if ( uGameState == 4 ) 15342 if ( uGameState == 4 )
15330 { 15343 {
15331 v12 = 1; 15344 v12 = 1;
15332 LABEL_57: 15345 LABEL_57:
15333 SetCurrentMenuID(v12); 15346 SetCurrentMenuID((MENU_STATE)v12);
15334 goto LABEL_21; 15347 goto LABEL_21;
15335 } 15348 }
15336 if ( uGameState == 7 ) 15349 if ( uGameState == 7 )
15337 { 15350 {
15338 pAudioPlayer->StopChannels(-1, -1); 15351 pAudioPlayer->StopChannels(-1, -1);
15357 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xEu, &startms, &end_ms); 15370 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xEu, &startms, &end_ms);
15358 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); 15371 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms);
15359 } 15372 }
15360 } 15373 }
15361 } 15374 }
15375 else
15376 Log::Warning(L"MM init: failed");
15362 15377
15363 pGame->Deinitialize(); 15378 pGame->Deinitialize();
15364 } 15379 }
15365 15380
15366 15381
15623 MessageBoxA(0, pTmpBuf, "Error", 0x30u); 15638 MessageBoxA(0, pTmpBuf, "Error", 0x30u);
15624 Game_DeinitializeAndTerminate(1); 15639 Game_DeinitializeAndTerminate(1);
15625 } 15640 }
15626 15641
15627 //----- (00466C40) -------------------------------------------------------- 15642 //----- (00466C40) --------------------------------------------------------
15628 // #define MENU_MAIN 0 15643 const wchar_t *MENU_STATE_to_string(MENU_STATE m)
15629 // #define MENU_NEWGAME 1
15630 // #define MENU_CREDITS 2
15631 // #define MENU_LOAD 3
15632 // #define MENU_CREATEPARTY 6
15633 // #define MENU_MAINMENULOAD 9
15634 void __thiscall SetCurrentMenuID(unsigned int uMenu)
15635 { 15644 {
15636 unsigned int v1; // esi@1 15645 switch (m)
15637 15646 {
15638 v1 = uMenu; 15647 case -1: return L"-1";
15639 if ( uCurrentMenuID == -1 ) 15648 case MENU_MAIN: return L"MENU_MAIN";
15640 { 15649 case MENU_NEWGAME: return L"MENU_NEWGAME";
15641 if ( uMenu != -1 && LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) 15650 case MENU_CREDITS: return L"MENU_CREDITS";
15642 pAsyncKeyboard->Suspend(); 15651 case MENU_SAVELOAD: return L"MENU_SAVELOAD";
15643 } 15652 case MENU_FINISHED: return L"MENU_FINISHED";
15644 else 15653 case MENU_5: return L"MENU_5";
15645 { 15654 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY";
15646 if ( uMenu == -1 && LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) 15655 case MENU_7: return L"MENU_7";
15656 case MENU_Credits: return L"MENU_Credits";
15657 case MENU_LOAD: return L"MENU_LOAD";
15658 case MENU_10: return L"MENU_10";
15659 default: return L"unk";
15660 };
15661 };
15662 void SetCurrentMenuID(MENU_STATE uMenu)
15663 {
15664 if ((int)uCurrentMenuID != -1)
15665 {
15666 if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard)
15647 pAsyncKeyboard->Resume(); 15667 pAsyncKeyboard->Resume();
15648 } 15668 }
15649 uCurrentMenuID = v1; 15669 uCurrentMenuID = uMenu;
15670
15671 Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu));
15650 } 15672 }
15651 15673
15652 //----- (00466CA0) -------------------------------------------------------- 15674 //----- (00466CA0) --------------------------------------------------------
15653 unsigned int GetCurrentMenuID() 15675 MENU_STATE GetCurrentMenuID()
15654 { 15676 {
15655 return uCurrentMenuID; 15677 return uCurrentMenuID;
15656 } 15678 }
15657 15679
15658 15680
16359 v0 = pPlayers[uActiveCharacter]; 16381 v0 = pPlayers[uActiveCharacter];
16360 v1 = v0->pEquipment.uMainHand; 16382 v1 = v0->pEquipment.uMainHand;
16361 v2 = v0->pEquipment.uOffHand; 16383 v2 = v0->pEquipment.uOffHand;
16362 v54 = v0->pEquipment.uOffHand; 16384 v54 = v0->pEquipment.uOffHand;
16363 v53 = v1; 16385 v53 = v1;
16364 if ( v1 && pItemsTable->pItems[*(int *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uEquipType == 1 ) 16386 if ( v1 && pItemsTable->pItems[*(int *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uEquipType == 1 )
16365 v51 = v1; 16387 v51 = v1;
16366 v3 = pParty->pPickedItem.uItemID; 16388 v3 = pParty->pPickedItem.uItemID;
16367 if ( pParty->pPickedItem.uItemID ) 16389 if ( pParty->pPickedItem.uItemID )
16368 { 16390 {
16369 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; 16391 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType;
16386 } 16408 }
16387 else 16409 else
16388 { 16410 {
16389 if ( (v4 == 8 || v4 == 1 || v4 == 2) 16411 if ( (v4 == 8 || v4 == 1 || v4 == 2)
16390 && v1 16412 && v1
16391 && pItemsTable->pItems[*(int *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uSkillType == 4 ) 16413 && pItemsTable->pItems[*(int *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uSkillType == 4 )
16392 goto LABEL_7; 16414 goto LABEL_7;
16393 } 16415 }
16394 LABEL_16: 16416 LABEL_16:
16395 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) 16417 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) )
16396 goto LABEL_8; 16418 goto LABEL_8;
16731 else 16753 else
16732 { 16754 {
16733 v35 = v0->pEquipment.uBow; 16755 v35 = v0->pEquipment.uBow;
16734 if ( v35 ) 16756 if ( v35 )
16735 { 16757 {
16736 auto _a = (ItemGen *)&v0->pDarkSpellbook.bIsSpellAvailable[36 * v35 + 5]; 16758 auto _a = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v35 + 5];
16737 pParty->SetHoldingItem(_a); 16759 pParty->SetHoldingItem(_a);
16738 _a->Reset(); 16760 _a->Reset();
16739 v0->pEquipment.uBow = 0; 16761 v0->pEquipment.uBow = 0;
16740 } 16762 }
16741 } 16763 }