comparison mm7_2.cpp @ 599:deb559e4fe47

Merge
author Gloval
date Wed, 06 Mar 2013 22:47:21 +0400
parents f8a4a2e0b4c9 a463d7784d33
children 628694cd5744
comparison
equal deleted inserted replaced
598:f8a4a2e0b4c9 599:deb559e4fe47
3245 v24 = -1; 3245 v24 = -1;
3246 v23 = 0; 3246 v23 = 0;
3247 v22 = 0; 3247 v22 = 0;
3248 v21 = (SoundID)11090; 3248 v21 = (SoundID)11090;
3249 } 3249 }
3250 goto LABEL_40; 3250 pAudioPlayer->PlaySound(v21, v22, v23, v24, v25, v27, v29, v31);
3251 return 0;
3251 } 3252 }
3252 if ( a1 == 10 ) 3253 if ( a1 == 10 )
3253 { 3254 {
3254 v18 = pParty->pPlayers; 3255 v18 = pParty->pPlayers;
3255 do 3256 do
3826 v2 = 0; 3827 v2 = 0;
3827 for(int i=0; i<12; ++i) 3828 for(int i=0; i<12; ++i)
3828 { 3829 {
3829 //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; 3830 //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C];
3830 v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType; 3831 v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType;
3831 if ( v3 < 5 ) 3832 if ( v3 >= 5 )
3832 goto LABEL_12; 3833 {
3833 if ( v3 <= 13 ) 3834 if ( v3 <= 13 )
3834 { 3835 {
3835 v0 = rand() % word_4F0F30[(signed int)v1] 3836 v0 = rand() % word_4F0F30[(signed int)v1]
3836 //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C] 3837 //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]
3837 + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType 3838 + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType
3838 + 345; 3839 + 345;
3839 } 3840 }
3840 else 3841 else
3841 { 3842 {
3842 if ( v3 == 14 ) 3843 if ( v3 == 14 )
3843 { 3844 {
3844 v4 = rand() % 4; 3845 v4 = rand() % 4;
3845 } 3846 }
3846 else 3847 else if ( v3 == 15 )
3847 { 3848 {
3848 if ( v3 == 15 ) 3849 v4 = rand() % 3 + 4;
3849 { 3850 }
3850 v4 = rand() % 3 + 4; 3851 else if ( v3 == 16 )
3851 } 3852 v4 = rand() % 2 + 7;
3852 else 3853 if( v3 <= 16 )
3853 { 3854 v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400;
3854 if ( v3 != 16 ) 3855 }
3855 goto LABEL_12; 3856 }
3856 v4 = rand() % 2 + 7;
3857 }
3858 }
3859 v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400;
3860 }
3861 LABEL_12:
3862 if ( v0 == 487 ) 3857 if ( v0 == 487 )
3863 { 3858 {
3864 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) 3859 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
3865 v0 = 486; 3860 v0 = 486;
3866 } 3861 }
3956 if ( !pDialogueWindow->pNumPresenceButton ) 3951 if ( !pDialogueWindow->pNumPresenceButton )
3957 return; 3952 return;
3958 pRenderer->ClearZBuffer(0, 479); 3953 pRenderer->ClearZBuffer(0, 479);
3959 //v3 = dword_F8B198; 3954 //v3 = dword_F8B198;
3960 if ( dword_F8B19C != 1 ) 3955 if ( dword_F8B19C != 1 )
3961 goto LABEL_13; 3956 {
3962 if ( in_current_building_type == BildingType_Training ) 3957 v8 = window_SpeakInHouse;
3963 { 3958 }
3964 if ( uMessageParam == 17 ) 3959 else
3965 { 3960 {
3966 v4 = 0; 3961 if ( in_current_building_type == BildingType_Training )
3967 v5 = 0; 3962 {
3968 //v6 = pPlayers[uActiveCharacter]; 3963 if ( uMessageParam == 17 )
3969 //v7 = pPlayers[uActiveCharacter]->uLevel; 3964 {
3970 if ( pPlayers[uActiveCharacter]->uLevel > 0 ) 3965 v4 = 0;
3971 { 3966 v5 = 0;
3972 do 3967 //v6 = pPlayers[uActiveCharacter];
3973 v4 += v5++ + 1; 3968 //v7 = pPlayers[uActiveCharacter]->uLevel;
3974 while ( v5 < pPlayers[uActiveCharacter]->uLevel ); 3969 if ( pPlayers[uActiveCharacter]->uLevel > 0 )
3975 } 3970 {
3976 if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] 3971 do
3977 && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 ) 3972 v4 += v5++ + 1;
3978 return; 3973 while ( v5 < pPlayers[uActiveCharacter]->uLevel );
3979 } 3974 }
3980 goto LABEL_9; 3975 if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C]
3981 } 3976 && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 )
3982 v8 = window_SpeakInHouse; 3977 return;
3983 if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) 3978 }
3984 && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7)) 3979 pDialogueWindow->Release();
3985 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) 3980 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
3986 { 3981 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
3987 LABEL_9: 3982 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
3988 pDialogueWindow->Release(); 3983 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
3989 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); 3984 // LABEL_10:
3990 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation" 3985 //v3 = dword_F8B198;
3991 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1); 3986 v8 = window_SpeakInHouse;
3992 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); 3987 }
3993 LABEL_10: 3988 else
3994 //v3 = dword_F8B198; 3989 {
3995 v8 = window_SpeakInHouse; 3990 v8 = window_SpeakInHouse;
3996 goto LABEL_11; 3991 if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats)
3997 } 3992 && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7))
3998 if ( uActiveCharacter != v1 ) 3993 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild )
3999 { 3994 {
4000 if ( !pPlayers[uActiveCharacter]->_4B6FF9() ) 3995 //LABEL_9:
4001 return; 3996 pDialogueWindow->Release();
4002 goto LABEL_10; 3997 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1);
4003 } 3998 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation"
4004 LABEL_11: 3999 (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1);
4005 dword_F8B19C = uMessageParam; 4000 pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1);
4006 if ( in_current_building_type < BildingType_19 ) 4001 // LABEL_10:
4007 { 4002 //v3 = dword_F8B198;
4008 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); 4003 v8 = window_SpeakInHouse;
4009 //v3 = dword_F8B198; 4004 }
4010 ShopTexture = &pIcons_LOD->pTextures[v9]; 4005 else if ( uActiveCharacter != v1 )
4011 LABEL_13: 4006 {
4012 v8 = window_SpeakInHouse; 4007 if ( !pPlayers[uActiveCharacter]->_4B6FF9() )
4008 return;
4009 v8 = window_SpeakInHouse;
4010 }
4011 }
4012 //LABEL_11:
4013 dword_F8B19C = uMessageParam;
4014 if ( in_current_building_type < BildingType_19 )
4015 {
4016 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
4017 //v3 = dword_F8B198;
4018 ShopTexture = &pIcons_LOD->pTextures[v9];
4019 //LABEL_13:
4020 v8 = window_SpeakInHouse;
4021 }
4013 } 4022 }
4014 if ( in_current_building_type > BildingType_Tavern ) 4023 if ( in_current_building_type > BildingType_Tavern )
4015 { 4024 {
4016 if ( in_current_building_type == BildingType_Bank ) 4025 if ( in_current_building_type == BildingType_Bank )
4017 { 4026 {
4261 pParty->field_75A[v25] = v13; 4270 pParty->field_75A[v25] = v13;
4262 } 4271 }
4263 v1 = 0; 4272 v1 = 0;
4264 dword_F8B1A4 = pNPCTopics[352].pText; 4273 dword_F8B1A4 = pNPCTopics[352].pText;
4265 } 4274 }
4266 goto LABEL_196; 4275 }
4267 } 4276 else if ( uMessageParam == 100 )
4268 if ( uMessageParam == 100 )
4269 { 4277 {
4270 pKeyActionMap->EnterText(1, 10, v8); 4278 pKeyActionMap->EnterText(1, 10, v8);
4271 goto LABEL_196;
4272 } 4279 }
4273 } 4280 }
4274 } 4281 }
4275 } 4282 }
4276 if ( uMessageParam > 95 ) 4283 if ( uMessageParam > 95 )
4525 if ( v0 && v0 != 1 ) 4532 if ( v0 && v0 != 1 )
4526 { 4533 {
4527 if ( v0 == -1 ) 4534 if ( v0 == -1 )
4528 { 4535 {
4529 _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); 4536 _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1));
4530 LABEL_33: 4537 //LABEL_33:
4531 pVideoPlayer->_4BF5B2(); 4538 pVideoPlayer->_4BF5B2();
4532 return 1; 4539 return 1;
4533 } 4540 }
4534 if ( v0 != 94 && v0 != 96 && v0 != 101 ) 4541 if ( v0 != 94 && v0 != 96 && v0 != 101 )
4535 { 4542 {
4542 else 4549 else
4543 { 4550 {
4544 if ( v0 != 102 && v0 != 103 && v0 != 104 ) 4551 if ( v0 != 102 && v0 != 103 && v0 != 104 )
4545 { 4552 {
4546 pVideoPlayer->_4BF5B2(); 4553 pVideoPlayer->_4BF5B2();
4547 LABEL_28: 4554 //LABEL_28:
4548 dword_F8B19C = 1; 4555 dword_F8B19C = 1;
4549 sub_4B3B42(in_current_building_type); 4556 sub_4B3B42(in_current_building_type);
4550 return 1; 4557 return 1;
4551 } 4558 }
4552 pVideoPlayer->_4BF5B2(); 4559 pVideoPlayer->_4BF5B2();
4556 } 4563 }
4557 return 1; 4564 return 1;
4558 } 4565 }
4559 pVideoPlayer->_4BF5B2(); 4566 pVideoPlayer->_4BF5B2();
4560 UI_CreateEndConversationButton(); 4567 UI_CreateEndConversationButton();
4561 goto LABEL_28; 4568 dword_F8B19C = 1;
4569 sub_4B3B42(in_current_building_type);
4570 return 1;
4562 } 4571 }
4563 pDialogueNPCCount = 0; 4572 pDialogueNPCCount = 0;
4564 pDialogueWindow->Release(); 4573 pDialogueWindow->Release();
4565 dword_F8B19C = 0; 4574 dword_F8B19C = 0;
4566 pDialogueWindow = 0; 4575 pDialogueWindow = 0;
4581 ++v2; 4590 ++v2;
4582 v3 += 100; 4591 v3 += 100;
4583 } 4592 }
4584 while ( (signed int)v2 < uNumDialogueNPCPortraits ); 4593 while ( (signed int)v2 < uNumDialogueNPCPortraits );
4585 } 4594 }
4586 goto LABEL_33; 4595 pVideoPlayer->_4BF5B2();
4596 return 1;
4587 } 4597 }
4588 } 4598 }
4589 return 0; 4599 return 0;
4590 } 4600 }
4591 4601
4680 ItemGen *_this; // [sp+B0h] [bp-4h]@13 4690 ItemGen *_this; // [sp+B0h] [bp-4h]@13
4681 4691
4682 v0 = pPlayers[uActiveCharacter]; 4692 v0 = pPlayers[uActiveCharacter];
4683 v77 = pPlayers[uActiveCharacter]; 4693 v77 = pPlayers[uActiveCharacter];
4684 if ( pCurrentScreen == SCREEN_E ) 4694 if ( pCurrentScreen == SCREEN_E )
4685 goto LABEL_73; 4695 {
4696 sub_421EA6_OnInventoryLeftClick();
4697 return;
4698 }
4686 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 4699 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
4687 { 4700 {
4688 v56 = 0; 4701 v56 = 0;
4689 v52 = 0; 4702 v52 = 0;
4690 v50 = 0; 4703 v50 = 0;
4691 v49 = 0; 4704 v49 = 0;
4692 v48 = -1; 4705 v48 = -1;
4693 v47 = 0; 4706 v47 = 0;
4694 v46 = 0; 4707 v46 = 0;
4695 goto LABEL_87; 4708 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
4709 return;
4696 } 4710 }
4697 if ( dword_F8B19C > 18 ) 4711 if ( dword_F8B19C > 18 )
4698 { 4712 {
4699 if ( dword_F8B19C < 36 ) 4713 if ( dword_F8B19C < 36 )
4700 return; 4714 return;
4717 v13 = window_SpeakInHouse->ptr_1C; 4731 v13 = window_SpeakInHouse->ptr_1C;
4718 if ( in_current_building_type == BildingType_Training ) 4732 if ( in_current_building_type == BildingType_Training )
4719 v55 = 4; 4733 v55 = 4;
4720 else 4734 else
4721 v55 = 2; 4735 v55 = 2;
4722 goto LABEL_84; 4736 HousePlaySomeSound((unsigned int)v13, v55);
4737 return;
4723 } 4738 }
4724 Party::TakeGold(v44); 4739 Party::TakeGold(v44);
4725 v53 = 0; 4740 v53 = 0;
4726 dword_F8B1E4 = 1; 4741 dword_F8B1E4 = 1;
4727 *pSkill = 1; 4742 *pSkill = 1;
4728 v51 = 78; 4743 v51 = 78;
4729 goto LABEL_80; 4744 v27 = v0;
4745 v27->PlaySound((PlayerSpeech)v51, v53);
4746 return;
4730 } 4747 }
4731 } 4748 }
4732 return; 4749 return;
4733 } 4750 }
4734 if ( dword_F8B19C != 94 ) 4751 if ( dword_F8B19C != 94 )
4736 if ( dword_F8B19C != 95 ) 4753 if ( dword_F8B19C != 95 )
4737 return; 4754 return;
4738 goto LABEL_49; 4755 goto LABEL_49;
4739 } 4756 }
4740 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 4757 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
4741 LABEL_73: 4758 //LABEL_73:
4742 sub_421EA6_OnInventoryLeftClick(); 4759 sub_421EA6_OnInventoryLeftClick();
4743 return; 4760 return;
4744 } 4761 }
4745 if ( dword_F8B19C == 18 ) 4762 if ( dword_F8B19C == 18 )
4746 { 4763 {
4758 v80 = v23; 4775 v80 = v23;
4759 GetAsyncKeyState(VK_CONTROL); 4776 GetAsyncKeyState(VK_CONTROL);
4760 if ( pParty->uNumGold < v23 ) 4777 if ( pParty->uNumGold < v23 )
4761 { 4778 {
4762 v24 = 2; 4779 v24 = 2;
4763 LABEL_62: 4780 //LABEL_62:
4764 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24); 4781 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
4765 v9 = pGlobalTXT_LocalizationStrings[155]; 4782 v9 = pGlobalTXT_LocalizationStrings[155];
4766 v54 = 2; 4783 v54 = 2;
4767 goto LABEL_71; 4784 ShowStatusBarString(v9, v54);
4785 return;
4768 } 4786 }
4769 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID); 4787 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID);
4770 if ( v25 ) 4788 if ( v25 )
4771 { 4789 {
4772 v26 = 1; 4790 v26 = 1;
4773 v20->SetIdentified(); 4791 v20->SetIdentified();
4774 memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u); 4792 memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u);
4775 goto LABEL_42; 4793 dword_F8B1E4 = v26;
4794 Party::TakeGold(v80);
4795 viewparams->bRedrawGameUI = v26;
4796 _this->Reset();
4797 pRenderer->ClearZBuffer(0, 479);
4798 v27 = v77;
4799 v53 = 0;
4800 v51 = SPEECH_75;
4801 v27->PlaySound((PlayerSpeech)v51, v53);
4802 return;
4776 } 4803 }
4777 v0->PlaySound(SPEECH_NoRoom, 0); 4804 v0->PlaySound(SPEECH_NoRoom, 0);
4778 v54 = 5; 4805 v54 = 5;
4779 LABEL_70: 4806 //LABEL_70:
4780 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" 4807 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
4781 goto LABEL_71; 4808 ShowStatusBarString(v9, v54);
4809 return;
4782 } 4810 }
4783 if ( dword_F8B19C == 2 ) 4811 if ( dword_F8B19C == 2 )
4784 { 4812 {
4785 LABEL_49: 4813 LABEL_49:
4786 v28 = pMouse->GetCursorPos(&v59); 4814 v28 = pMouse->GetCursorPos(&v59);
4830 { 4858 {
4831 v24 = 2; 4859 v24 = 2;
4832 if ( uNumSeconds != 2 ) 4860 if ( uNumSeconds != 2 )
4833 { 4861 {
4834 if ( uNumSeconds != 1 ) 4862 if ( uNumSeconds != 1 )
4835 goto LABEL_62; 4863 {
4864 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
4865 v9 = pGlobalTXT_LocalizationStrings[155];
4866 v54 = 2;
4867 ShowStatusBarString(v9, v54);
4868 return;
4869 }
4836 } 4870 }
4837 } 4871 }
4838 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); 4872 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
4839 if ( v39 ) 4873 if ( v39 )
4840 { 4874 {
4849 v41 = uNumSeconds; 4883 v41 = uNumSeconds;
4850 if ( uNumSeconds == 1 || uNumSeconds == 2 ) 4884 if ( uNumSeconds == 1 || uNumSeconds == 2 )
4851 { 4885 {
4852 *(char *)(v40 + 517) |= 1u; 4886 *(char *)(v40 + 517) |= 1u;
4853 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); 4887 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6);
4854 goto LABEL_43; 4888 viewparams->bRedrawGameUI = v26;
4889 _this->Reset();
4890 pRenderer->ClearZBuffer(0, 479);
4891 v27 = v77;
4892 v53 = 0;
4893 v51 = SPEECH_75;
4894 v27->PlaySound((PlayerSpeech)v51, v53);
4895 return;
4855 } 4896 }
4856 } 4897 }
4857 } 4898 }
4858 LABEL_42: 4899 //LABEL_42:
4859 dword_F8B1E4 = v26; 4900 dword_F8B1E4 = v26;
4860 Party::TakeGold(v80); 4901 Party::TakeGold(v80);
4861 LABEL_43: 4902 //LABEL_43:
4862 viewparams->bRedrawGameUI = v26; 4903 viewparams->bRedrawGameUI = v26;
4863 _this->Reset(); 4904 _this->Reset();
4864 pRenderer->ClearZBuffer(0, 479); 4905 pRenderer->ClearZBuffer(0, 479);
4865 v27 = v77; 4906 v27 = v77;
4866 v53 = 0; 4907 v53 = 0;
4867 v51 = SPEECH_75; 4908 v51 = SPEECH_75;
4868 LABEL_81: 4909 //LABEL_81:
4869 v27->PlaySound((PlayerSpeech)v51, v53); 4910 v27->PlaySound((PlayerSpeech)v51, v53);
4870 return; 4911 return;
4871 } 4912 }
4872 v0->PlaySound(SPEECH_NoRoom, 0); 4913 v0->PlaySound(SPEECH_NoRoom, 0);
4873 v54 = 2; 4914 v54 = 2;
4874 goto LABEL_70; 4915 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
4916 ShowStatusBarString(v9, v54);
4917 return;
4875 } 4918 }
4876 if ( dword_F8B19C == 3 ) 4919 if ( dword_F8B19C == 3 )
4877 { 4920 {
4878 v14 = pMouse->GetCursorPos(&v71)->x - 14; 4921 v14 = pMouse->GetCursorPos(&v71)->x - 14;
4879 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); 4922 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5);
4888 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C); 4931 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C);
4889 viewparams->bRedrawGameUI = 1; 4932 viewparams->bRedrawGameUI = 1;
4890 pRenderer->ClearZBuffer(0, 479); 4933 pRenderer->ClearZBuffer(0, 479);
4891 v53 = 0; 4934 v53 = 0;
4892 v51 = 77; 4935 v51 = 77;
4893 goto LABEL_80; 4936 v27 = v0;
4894 } 4937 v27->PlaySound((PlayerSpeech)v51, v53);
4938 return;
4939 }
4895 v0->PlaySound(SPEECH_79, 0); 4940 v0->PlaySound(SPEECH_79, 0);
4896 v56 = 0; 4941 v56 = 0;
4897 v52 = 0; 4942 v52 = 0;
4898 v50 = 0; 4943 v50 = 0;
4899 v49 = 0; 4944 v49 = 0;
4900 v48 = -1; 4945 v48 = -1;
4901 v47 = 0; 4946 v47 = 0;
4902 v46 = 0; 4947 v46 = 0;
4903 LABEL_87: 4948 //LABEL_87:
4904 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); 4949 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
4905 return; 4950 return;
4906 } 4951 }
4907 if ( dword_F8B19C == 4 ) 4952 if ( dword_F8B19C == 4 )
4908 { 4953 {
4928 dword_F8B1E4 = 1; 4973 dword_F8B1E4 = 1;
4929 Party::TakeGold(v80); 4974 Party::TakeGold(v80);
4930 *(int *)(v12 + 20) |= 1u; 4975 *(int *)(v12 + 20) |= 1u;
4931 v0->PlaySound(SPEECH_73, 0); 4976 v0->PlaySound(SPEECH_73, 0);
4932 v9 = pGlobalTXT_LocalizationStrings[569]; 4977 v9 = pGlobalTXT_LocalizationStrings[569];
4933 goto LABEL_25; 4978 v54 = 2;
4979 ShowStatusBarString(v9, v54);
4980 return;
4934 } 4981 }
4935 goto LABEL_26; 4982 v13 = _this;
4983 v55 = 2;
4984 HousePlaySomeSound((unsigned int)v13, v55);
4985 return;
4936 } 4986 }
4937 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 4987 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
4938 v53 = 0; 4988 v53 = 0;
4939 goto LABEL_28; 4989 v51 = 79;
4990 v27 = v0;
4991 v27->PlaySound((PlayerSpeech)v51, v53);
4992 return;
4940 } 4993 }
4941 v53 = 0; 4994 v53 = 0;
4942 LABEL_30: 4995 //LABEL_30:
4943 v51 = 76; 4996 v51 = 76;
4944 goto LABEL_80; 4997 v27 = v0;
4945 } 4998 v27->PlaySound((PlayerSpeech)v51, v53);
4999 return;
5000 }
4946 } 5001 }
4947 } 5002 }
4948 } 5003 }
4949 else 5004 else
4950 { 5005 {
4981 v8 = *(int *)(v3 + 20); 5036 v8 = *(int *)(v3 + 20);
4982 LOBYTE(v8) = v8 & 0xFD; 5037 LOBYTE(v8) = v8 & 0xFD;
4983 *(int *)(v3 + 20) = v8 | 1; 5038 *(int *)(v3 + 20) = v8 | 1;
4984 v0->PlaySound(SPEECH_74, 0); 5039 v0->PlaySound(SPEECH_74, 0);
4985 v9 = pGlobalTXT_LocalizationStrings[570]; 5040 v9 = pGlobalTXT_LocalizationStrings[570];
4986 LABEL_25: 5041 //LABEL_25:
4987 v54 = 2; 5042 v54 = 2;
4988 LABEL_71: 5043 //LABEL_71:
4989 ShowStatusBarString(v9, v54); 5044 ShowStatusBarString(v9, v54);
4990 return; 5045 return;
4991 } 5046 }
4992 LABEL_26: 5047 //LABEL_26:
4993 v13 = _this; 5048 v13 = _this;
4994 v55 = 2; 5049 v55 = 2;
4995 LABEL_84: 5050 //LABEL_84:
4996 HousePlaySomeSound((unsigned int)v13, v55); 5051 HousePlaySomeSound((unsigned int)v13, v55);
4997 return; 5052 return;
4998 } 5053 }
4999 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); 5054 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
5000 v53 = 0; 5055 v53 = 0;
5001 LABEL_28: 5056 //LABEL_28:
5002 v51 = 79; 5057 v51 = 79;
5003 LABEL_80: 5058 //LABEL_80:
5004 v27 = v0; 5059 v27 = v0;
5005 goto LABEL_81; 5060 v27->PlaySound((PlayerSpeech)v51, v53);
5061 return;
5006 } 5062 }
5007 v53 = 0; 5063 v53 = 0;
5008 goto LABEL_30; 5064 v51 = 76;
5009 } 5065 v27 = v0;
5066 v27->PlaySound((PlayerSpeech)v51, v53);
5067 return;
5068 }
5010 } 5069 }
5011 } 5070 }
5012 } 5071 }
5013 } 5072 }
5014 } 5073 }
5128 { 5187 {
5129 v5 = v2[v7]; 5188 v5 = v2[v7];
5130 *v2 = v5; 5189 *v2 = v5;
5131 if ( !v5 ) 5190 if ( !v5 )
5132 { 5191 {
5133 LABEL_23: 5192 //LABEL_23:
5134 *v2 = 0; 5193 *v2 = 0;
5135 break; 5194 break;
5136 } 5195 }
5137 if ( v5 == ',' ) 5196 if ( v5 == ',' )
5138 { 5197 {
5139 if ( v3 ) 5198 if ( v3 )
5140 goto LABEL_18; 5199 {
5141 *v2 = 0; 5200 if ( v4 )
5201 {
5202 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
5203 ++stru_F8B5E8.field_0;
5204 }
5205 v4 = 0;
5206 }
5207 else
5208 {
5209 *v2 = 0;
5210 v4 = 1;
5211 }
5142 } 5212 }
5143 else 5213 else
5144 { 5214 {
5145 if ( v5 != '\t' ) 5215 if ( v5 != '\t' )
5146 { 5216 {
5159 { 5229 {
5160 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; 5230 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
5161 ++stru_F8B5E8.field_0; 5231 ++stru_F8B5E8.field_0;
5162 } 5232 }
5163 } 5233 }
5164 goto LABEL_21;
5165 } 5234 }
5166 LABEL_18: 5235 else
5167 if ( v4 ) 5236 {
5168 { 5237 //LABEL_18:
5169 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; 5238 if ( v4 )
5170 ++stru_F8B5E8.field_0; 5239 {
5171 } 5240 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
5172 v4 = 0; 5241 ++stru_F8B5E8.field_0;
5173 goto LABEL_21; 5242 }
5174 } 5243 v4 = 0;
5175 if ( v3 ) 5244 }
5176 goto LABEL_18; 5245 }
5177 *v2 = 0; 5246 else
5178 if ( v4 ) 5247 {
5179 { 5248 if ( v3 )
5180 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2; 5249 {
5181 ++stru_F8B5E8.field_0; 5250 if ( v4 )
5182 } 5251 {
5252 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
5253 ++stru_F8B5E8.field_0;
5254 }
5255 v4 = 0;
5256 }
5257 else
5258 {
5259 *v2 = 0;
5260 if ( v4 )
5261 {
5262 stru_F8B5E8.pProperties[stru_F8B5E8.field_0] = v2;
5263 ++stru_F8B5E8.field_0;
5264 }
5265 v4 = 1;
5266 }
5267 }
5183 } 5268 }
5184 v4 = 1; 5269 //LABEL_21:
5185 LABEL_21:
5186 if ( stru_F8B5E8.field_0 < 30 ) 5270 if ( stru_F8B5E8.field_0 < 30 )
5187 { 5271 {
5188 ++v2; 5272 ++v2;
5189 if ( (unsigned int)v2 < (unsigned int)&unk_F8B5E0 ) 5273 if ( (unsigned int)v2 < (unsigned int)&unk_F8B5E0 )
5190 continue; 5274 continue;
5191 } 5275 }
5192 goto LABEL_23; 5276 *v2 = 0;
5277 break;
5193 } 5278 }
5194 } 5279 }
5195 result = a2; 5280 result = a2;
5196 memcpy(a2, &stru_F8B5E8, 0x7Cu); 5281 memcpy(a2, &stru_F8B5E8, 0x7Cu);
5197 return result; 5282 return result;
11614 } 11699 }
11615 pWindow_MainMenu->Release(); 11700 pWindow_MainMenu->Release();
11616 pIcons_LOD->_4114F2(); 11701 pIcons_LOD->_4114F2();
11617 } 11702 }
11618 11703
11619 int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
11620 {
11621 return DefWindowProcA(hWnd, Msg, wParam, lParam);
11622 }
11623
11624
11625 //----- (004637EB) -------------------------------------------------------- 11704 //----- (004637EB) --------------------------------------------------------
11626 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) 11705 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
11627 { 11706 {
11628 unsigned int v4; // esi@1 11707 unsigned int v4; // esi@1
11629 Render *v5; // ecx@14 11708 Render *v5; // ecx@14
13166 if (uGammaPos < 0 || uGammaPos > 9) 13245 if (uGammaPos < 0 || uGammaPos > 9)
13167 uGammaPos = 4; 13246 uGammaPos = 4;
13168 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); 13247 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6);
13169 13248
13170 if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) 13249 if ( ReadWindowsRegistryInt("Bloodsplats", 1) )
13171 pGame->uFlags2 |= 0x20u; 13250 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS;
13172 else 13251 else
13173 pGame->uFlags2 &= 0xFFFFFFDFu; 13252 pGame->uFlags2 &= GAME_FLAGS_2_DRAW_BLOODSPLATS;
13174 13253
13175 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); 13254 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0);
13176 dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0); 13255 dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0);
13177 13256
13178 if (!bNoSound) 13257 if (!bNoSound)
13402 assert(sizeof(EventIndex) == 0xC); 13481 assert(sizeof(EventIndex) == 0xC);
13403 assert(sizeof(_2devent) == 0x34); 13482 assert(sizeof(_2devent) == 0x34);
13404 assert(sizeof(stru176) == 0x20); 13483 assert(sizeof(stru176) == 0x20);
13405 assert(sizeof(SavegameHeader) == 0x64); 13484 assert(sizeof(SavegameHeader) == 0x64);
13406 assert(sizeof(SavegameList) == 0x3138); 13485 assert(sizeof(SavegameList) == 0x3138);
13407 assert(sizeof(StorylineText) == 0x168); 13486 assert(sizeof(StorylineText) == 0x160);
13408 assert(sizeof(FactionTable) == 0x1EF1); 13487 assert(sizeof(FactionTable) == 0x1EF1);
13409 assert(sizeof(Decal) == 0xC20); 13488 assert(sizeof(Decal) == 0xC20);
13410 assert(sizeof(DecalBuilder) == 0x30C038); 13489 assert(sizeof(DecalBuilder) == 0x30C038);
13411 assert(sizeof(MonsterInfo) == 0x58); 13490 assert(sizeof(MonsterInfo) == 0x58);
13412 assert(sizeof(MonsterStats) == 0x5BA0); 13491 assert(sizeof(MonsterStats) == 0x5BA0);
14658 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; 14737 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType;
14659 if ( v4 == 4 ) 14738 if ( v4 == 4 )
14660 { 14739 {
14661 if ( v2 ) 14740 if ( v2 )
14662 { 14741 {
14663 LABEL_7:
14664 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR); 14742 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
14665 if ( (signed int)SkillToMastery(v5) < 3 ) 14743 if ( (signed int)SkillToMastery(v5) < 3 )
14666 { 14744 {
14667 LABEL_8:
14668 v0->PlaySound(SPEECH_39, 0); 14745 v0->PlaySound(SPEECH_39, 0);
14669 return; 14746 return;
14670 } 14747 }
14671 v3 = pParty->pPickedItem.uItemID; 14748 v3 = pParty->pPickedItem.uItemID;
14672 goto LABEL_16;
14673 } 14749 }
14674 } 14750 }
14675 else 14751 else
14676 { 14752 {
14677 if ( (v4 == 8 || v4 == 1 || v4 == 2) 14753 if ( (v4 == 8 || v4 == 1 || v4 == 2)
14678 && v1 14754 && v1
14679 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 ) 14755 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 )
14680 goto LABEL_7; 14756 {
14681 } 14757 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
14682 LABEL_16: 14758 if ( (signed int)SkillToMastery(v5) < 3 )
14759 {
14760 v0->PlaySound(SPEECH_39, 0);
14761 return;
14762 }
14763 }
14764 }
14683 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) 14765 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) )
14684 goto LABEL_8; 14766 {
14767
14768 v0->PlaySound(SPEECH_39, 0);
14769 return;
14770 }
14685 if ( pParty->pPickedItem.uItemID == 604 ) 14771 if ( pParty->pPickedItem.uItemID == 604 )
14686 { 14772 {
14687 sub_467E7F_EquipBody(3u); 14773 sub_467E7F_EquipBody(3u);
14688 WetsuitOn(uActiveCharacter); 14774 WetsuitOn(uActiveCharacter);
14689 return; 14775 return;
14698 case 7u: 14784 case 7u:
14699 case 8u: 14785 case 8u:
14700 case 9u: 14786 case 9u:
14701 case 0xBu: 14787 case 0xBu:
14702 if ( !v0->HasSkill(v4) ) 14788 if ( !v0->HasSkill(v4) )
14703 goto LABEL_8; 14789 {
14790 v0->PlaySound(SPEECH_39, 0);
14791 return;
14792 }
14704 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) 14793 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
14705 goto LABEL_95; 14794 {
14795 v46 = 0;
14796 v45 = 0;
14797 v44 = 0;
14798 v43 = 0;
14799 v42 = -1;
14800 v41 = 0;
14801 v40 = 0;
14802 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14803 return;
14804 }
14706 sub_467E7F_EquipBody(v6); 14805 sub_467E7F_EquipBody(v6);
14707 if ( pParty->pPickedItem.uItemID == 604 ) 14806 if ( pParty->pPickedItem.uItemID == 604 )
14708 WetsuitOff(uActiveCharacter); 14807 WetsuitOff(uActiveCharacter);
14709 return; 14808 return;
14710 case 0xAu: 14809 case 0xAu:
14711 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 14810 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
14712 goto LABEL_95; 14811 {
14812 v46 = 0;
14813 v45 = 0;
14814 v44 = 0;
14815 v43 = 0;
14816 v42 = -1;
14817 v41 = 0;
14818 v40 = 0;
14819 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14820 return;
14821 }
14713 v52 = 10; 14822 v52 = 10;
14714 v7 = (int)&v0->pEquipment.field_28; 14823 v7 = (int)&v0->pEquipment.field_28;
14715 while ( 1 ) 14824 while ( 1 )
14716 { 14825 {
14717 if ( !*(int *)v7 ) 14826 if ( !*(int *)v7 )
14718 { 14827 {
14719 v8 = v0->FindFreeInventorySlot(); 14828 v8 = v0->FindFreeInventorySlot();
14720 if ( (v8 & 0x80000000u) == 0 ) 14829 if ( (v8 & 0x80000000u) == 0 )
14830 {
14831 v9 = v52;
14832 pParty->pPickedItem.uBodyAnchor = v52 + 1;
14833 memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
14834 *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
14835 pMouse->RemoveHoldingItem();
14721 break; 14836 break;
14837 }
14722 } 14838 }
14723 ++v52; 14839 ++v52;
14724 v7 += 4; 14840 v7 += 4;
14725 if ( (signed int)v52 > 15 ) 14841 if ( (signed int)v52 > 15 )
14726 goto LABEL_33; 14842 break;
14727 } 14843 }
14728 v9 = v52;
14729 pParty->pPickedItem.uBodyAnchor = v52 + 1;
14730 memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
14731 *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
14732 pMouse->RemoveHoldingItem();
14733 LABEL_33:
14734 if ( v52 == 16 ) 14844 if ( v52 == 16 )
14735 { 14845 {
14736 v52 = v0->pEquipment.field_3C - 1; 14846 v52 = v0->pEquipment.field_3C - 1;
14737 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14847 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14738 v10 = (int)((char *)v0 + 36 * v52); 14848 v10 = (int)((char *)v0 + 36 * v52);
14745 v0->pEquipment.field_3C = v11; 14855 v0->pEquipment.field_3C = v11;
14746 } 14856 }
14747 return; 14857 return;
14748 case 4u: 14858 case 4u:
14749 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 14859 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
14750 goto LABEL_95; 14860 {
14861 v46 = 0;
14862 v45 = 0;
14863 v44 = 0;
14864 v43 = 0;
14865 v42 = -1;
14866 v41 = 0;
14867 v40 = 0;
14868 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14869 return;
14870 }
14751 if ( !v0->HasSkill(v4) ) 14871 if ( !v0->HasSkill(v4) )
14752 goto LABEL_8; 14872 {
14873 v0->PlaySound(SPEECH_39, 0);
14874 return;
14875 }
14753 if ( v54 ) 14876 if ( v54 )
14754 { 14877 {
14755 --v54; 14878 --v54;
14756 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14879 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14757 v12 = (int)((char *)v0 + 36 * v54); 14880 v12 = (int)((char *)v0 + 36 * v54);
14775 { 14898 {
14776 pParty->pPickedItem.uBodyAnchor = 1; 14899 pParty->pPickedItem.uBodyAnchor = 1;
14777 v17 = v52 + 1; 14900 v17 = v52 + 1;
14778 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); 14901 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
14779 v0->pEquipment.uOffHand = v17; 14902 v0->pEquipment.uOffHand = v17;
14780 goto LABEL_45; 14903 pMouse->RemoveHoldingItem();
14904 return;
14781 } 14905 }
14782 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14906 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14783 v15 = (int)((char *)v0 + 36 * (v53 - 1)); 14907 v15 = (int)((char *)v0 + 36 * (v53 - 1));
14784 *(char *)(v15 + 556) = 0; 14908 *(char *)(v15 + 556) = 0;
14785 pParty->pPickedItem.Reset(); 14909 pParty->pPickedItem.Reset();
14794 case 0u: 14918 case 0u:
14795 case 0xCu: 14919 case 0xCu:
14796 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) 14920 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter)
14797 && pParty->pPickedItem.uItemID != 64 14921 && pParty->pPickedItem.uItemID != 64
14798 && pParty->pPickedItem.uItemID != 65 ) 14922 && pParty->pPickedItem.uItemID != 65 )
14799 goto LABEL_95; 14923 {
14924 v46 = 0;
14925 v45 = 0;
14926 v44 = 0;
14927 v43 = 0;
14928 v42 = -1;
14929 v41 = 0;
14930 v40 = 0;
14931 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14932 return;
14933 }
14800 if ( !v0->HasSkill(v4) ) 14934 if ( !v0->HasSkill(v4) )
14801 goto LABEL_8; 14935 {
14936 v0->PlaySound(SPEECH_39, 0);
14937 return;
14938 }
14802 v50 = 0; 14939 v50 = 0;
14803 if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0) 14940 if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0)
14804 || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 ) 14941 || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 )
14805 { 14942 {
14806 if (pAsyncMouse) 14943 if (pAsyncMouse)
14832 memcpy((void *)(v20 + 532), &_this, 0x24u); 14969 memcpy((void *)(v20 + 532), &_this, 0x24u);
14833 v0->pEquipment.uOffHand = v21; 14970 v0->pEquipment.uOffHand = v21;
14834 if ( !v14 ) 14971 if ( !v14 )
14835 return; 14972 return;
14836 v22 = _this.uItemID; 14973 v22 = _this.uItemID;
14837 LABEL_73:
14838 v50 = v22; 14974 v50 = v22;
14839 goto LABEL_74; 14975 if ( v50 )
14976 stru_A750F8[uActiveCharacter - 1]._494836(
14977 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14978 uActiveCharacter - 1 + 9);
14979 break;
14840 } 14980 }
14841 v23 = v0->FindFreeInventorySlot(); 14981 v23 = v0->FindFreeInventorySlot();
14842 if ( (v23 & 0x80000000u) != 0 ) 14982 if ( (v23 & 0x80000000u) != 0 )
14843 return; 14983 return;
14844 pParty->pPickedItem.uBodyAnchor = 1; 14984 pParty->pPickedItem.uBodyAnchor = 1;
14845 v50 = (unsigned int)&v0->pInventoryItems[v23]; 14985 v50 = (unsigned int)&v0->pInventoryItems[v23];
14846 memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23])); 14986 memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23]));
14847 v0->pEquipment.uOffHand = v23 + 1; 14987 v0->pEquipment.uOffHand = v23 + 1;
14848 LABEL_71:
14849 pMouse->RemoveHoldingItem(); 14988 pMouse->RemoveHoldingItem();
14850 if ( v52 != 12 ) 14989 if ( v52 != 12 )
14851 return; 14990 return;
14852 v22 = *(int *)v50; 14991 v22 = *(int *)v50;
14853 goto LABEL_73; 14992 v50 = v22;
14993 if ( v50 )
14994 stru_A750F8[uActiveCharacter - 1]._494836(
14995 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14996 uActiveCharacter - 1 + 9);
14997 break;
14854 } 14998 }
14855 } 14999 }
14856 } 15000 }
14857 if ( !v53 ) 15001 if ( !v53 )
14858 { 15002 {
14861 return; 15005 return;
14862 pParty->pPickedItem.uBodyAnchor = 2; 15006 pParty->pPickedItem.uBodyAnchor = 2;
14863 v50 = (unsigned int)&v0->pInventoryItems[v26]; 15007 v50 = (unsigned int)&v0->pInventoryItems[v26];
14864 memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26])); 15008 memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26]));
14865 v0->pEquipment.uMainHand = v26 + 1; 15009 v0->pEquipment.uMainHand = v26 + 1;
14866 goto LABEL_71; 15010 pMouse->RemoveHoldingItem();
15011 if ( v52 != 12 )
15012 return;
15013 v22 = *(int *)v50;
15014 v50 = v22;
15015 if ( v50 )
15016 stru_A750F8[uActiveCharacter - 1]._494836(
15017 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
15018 uActiveCharacter - 1 + 9);
15019 break;
14867 } 15020 }
14868 --v53; 15021 --v53;
14869 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 15022 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14870 v24 = (int)((char *)v0 + 36 * v53); 15023 v24 = (int)((char *)v0 + 36 * v53);
14871 *(char *)(v24 + 556) = 0; 15024 *(char *)(v24 + 556) = 0;
14878 v0->pEquipment.uMainHand = v25; 15031 v0->pEquipment.uMainHand = v25;
14879 if ( v14 ) 15032 if ( v14 )
14880 v50 = _this.uItemID; 15033 v50 = _this.uItemID;
14881 if ( v51 ) 15034 if ( v51 )
14882 v0->pEquipment.uOffHand = 0; 15035 v0->pEquipment.uOffHand = 0;
14883 LABEL_74:
14884 if ( v50 ) 15036 if ( v50 )
14885 stru_A750F8[uActiveCharacter - 1]._494836( 15037 stru_A750F8[uActiveCharacter - 1]._494836(
14886 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), 15038 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14887 uActiveCharacter - 1 + 9); 15039 uActiveCharacter - 1 + 9);
14888 break; 15040 break;
14889 case 1u: 15041 case 1u:
14890 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 15042 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
14891 goto LABEL_95; 15043 {
15044 v46 = 0;
15045 v45 = 0;
15046 v44 = 0;
15047 v43 = 0;
15048 v42 = -1;
15049 v41 = 0;
15050 v40 = 0;
15051 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
15052 return;
15053 }
14892 if ( !v0->HasSkill(v4) ) 15054 if ( !v0->HasSkill(v4) )
14893 goto LABEL_8; 15055 {
15056 v0->PlaySound(SPEECH_39, 0);
15057 return;
15058 }
14894 if ( v53 ) 15059 if ( v53 )
14895 { 15060 {
14896 if ( v54 ) 15061 if ( v54 )
14897 { 15062 {
14898 v46 = 0; 15063 v46 = 0;
14900 v44 = 0; 15065 v44 = 0;
14901 v43 = 0; 15066 v43 = 0;
14902 v42 = -1; 15067 v42 = -1;
14903 v41 = 0; 15068 v41 = 0;
14904 v40 = 0; 15069 v40 = 0;
14905 goto LABEL_96; 15070 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
15071 return;
14906 } 15072 }
14907 --v53; 15073 --v53;
14908 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 15074 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14909 v27 = (int)((char *)v0 + 36 * v53); 15075 v27 = (int)((char *)v0 + 36 * v53);
14910 *(char *)(v27 + 556) = 0; 15076 *(char *)(v27 + 556) = 0;
14937 { 15103 {
14938 pParty->pPickedItem.uBodyAnchor = 2; 15104 pParty->pPickedItem.uBodyAnchor = 2;
14939 v31 = v52 + 1; 15105 v31 = v52 + 1;
14940 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); 15106 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
14941 v0->pEquipment.uMainHand = v31; 15107 v0->pEquipment.uMainHand = v31;
14942 LABEL_45:
14943 pMouse->RemoveHoldingItem(); 15108 pMouse->RemoveHoldingItem();
14944 } 15109 }
14945 } 15110 }
14946 } 15111 }
14947 return; 15112 return;
14974 v52 = pItemsTable->pItems[v38->uItemID].uEquipType; 15139 v52 = pItemsTable->pItems[v38->uItemID].uEquipType;
14975 if ( v14 ) 15140 if ( v14 )
14976 { 15141 {
14977 if ( bUnderwater ) 15142 if ( bUnderwater )
14978 { 15143 {
14979 LABEL_95:
14980 v46 = 0; 15144 v46 = 0;
14981 v45 = 0; 15145 v45 = 0;
14982 v44 = 0; 15146 v44 = 0;
14983 v43 = 0; 15147 v43 = 0;
14984 v42 = -1; 15148 v42 = -1;
14985 v41 = 0; 15149 v41 = 0;
14986 v40 = 0; 15150 v40 = 0;
14987 LABEL_96:
14988 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); 15151 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14989 return; 15152 return;
14990 } 15153 }
14991 WetsuitOff(uActiveCharacter); 15154 WetsuitOff(uActiveCharacter);
14992 } 15155 }
15107 if ( v1 != (int *)-1 ) 15270 if ( v1 != (int *)-1 )
15108 DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3); 15271 DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3);
15109 } 15272 }
15110 v22 = 0; 15273 v22 = 0;
15111 v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1); 15274 v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1);
15112 if ( (signed int)viewparams->uScreenY >= (signed int)viewparams->uScreenW ) 15275 if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW )
15113 goto LABEL_21; 15276 {
15114 v2 = (char *)v1 - 50; 15277 v2 = (char *)v1 - 50;
15115 v1 = (int *)((char *)v1 + 50); 15278 v1 = (int *)((char *)v1 + 50);
15116 v3 = 640 * viewparams->uScreenY; 15279 v3 = 640 * viewparams->uScreenY;
15117 v17 = v2; 15280 v17 = v2;
15118 v20 = v1; 15281 v20 = v1;
15119 v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1; 15282 v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
15120 do 15283 do
15121 { 15284 {
15122 if ( (signed int)v2 >= (signed int)v20 ) 15285 if ( (signed int)v2 < (signed int)v20 )
15123 goto LABEL_20; 15286 {
15124 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; 15287 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
15125 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; 15288 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
15126 v4 = v22; 15289 v4 = v22;
15127 v5 = (((char *)v20 - v2 - 1) >> 1) + 1; 15290 v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
15128 do 15291 do
15129 { 15292 {
15130 v6 = 0; 15293 v6 = 0;
15131 v7 = *v1 & 0xFFFF; 15294 v7 = *v1 & 0xFFFF;
15132 v19 = 0; 15295 v19 = 0;
15133 if ( v4 > 0 ) 15296 if ( v4 > 0 )
15134 { 15297 {
15135 do 15298 do
15136 { 15299 {
15137 if ( dword_7207F0[v6] == v7 ) 15300 if ( dword_7207F0[v6] == v7 )
15138 break; 15301 break;
15139 ++v6; 15302 ++v6;
15140 v19 = v6; 15303 v19 = v6;
15141 } 15304 }
15142 while ( v6 < v22 ); 15305 while ( v6 < v22 );
15143 } 15306 }
15144 if ( (v7 & 7) == OBJECT_Decoration) 15307 if ( (v7 & 7) == OBJECT_Decoration)
15145 { 15308 {
15146 v16 = (unsigned int)v7 >> 3; 15309 v16 = (unsigned int)v7 >> 3;
15147 if ( (signed int)(((unsigned int)*v21 >> 16) 15310 if ( (signed int)(((unsigned int)*v21 >> 16)
15148 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) > 512 ) 15311 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) <= 512 )
15149 goto LABEL_18; 15312 if ( v19 == v22 && v4 < 100 )
15150 } 15313 {
15151 else 15314 ++v22;
15152 { 15315 ++v4;
15153 if ( (unsigned int)*v21 > 0x2000000 ) 15316 v8 = *v21;
15154 goto LABEL_18; 15317 dword_7207EC[v4] = v7;
15155 } 15318 dword_72065C[v4] = v8;
15156 if ( v19 == v22 && v4 < 100 ) 15319 }
15157 { 15320 }
15158 ++v22; 15321 else if ( (unsigned int)*v21 <= 0x2000000 )
15159 ++v4; 15322 {
15160 v8 = *v21; 15323 if ( v19 == v22 && v4 < 100 )
15161 dword_7207EC[v4] = v7; 15324 {
15162 dword_72065C[v4] = v8; 15325 ++v22;
15163 } 15326 ++v4;
15164 LABEL_18: 15327 v8 = *v21;
15165 v1 = v21 + 2; 15328 dword_7207EC[v4] = v7;
15166 --v5; 15329 dword_72065C[v4] = v8;
15167 v21 += 2; 15330 }
15168 } 15331 }
15169 while ( v5 ); 15332 v1 = v21 + 2;
15170 v2 = v17; 15333 --v5;
15171 LABEL_20: 15334 v21 += 2;
15172 v3 += 1280; 15335 }
15173 --v18; 15336 while ( v5 );
15174 } 15337 v2 = v17;
15175 while ( v18 ); 15338 }
15176 LABEL_21: 15339 v3 += 1280;
15340 --v18;
15341 }
15342 while ( v18 );
15343 }
15177 if ( v22 > 0 ) 15344 if ( v22 > 0 )
15178 { 15345 {
15179 v9 = dword_720660; 15346 v9 = dword_720660;
15180 v10 = 1; 15347 v10 = 1;
15181 do 15348 do
15346 { 15513 {
15347 if ( a1 >> 9 >= pOutdoor->uNumBModels 15514 if ( a1 >> 9 >= pOutdoor->uNumBModels
15348 || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10) 15515 || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10)
15349 || (v6 = v7->sCogTriggeredID) == 0 ) 15516 || (v6 = v7->sCogTriggeredID) == 0 )
15350 return 1; 15517 return 1;
15351 LABEL_13:
15352 EventProcessor((signed __int16)v6, v2, 1); 15518 EventProcessor((signed __int16)v6, v2, 1);
15353 return 0; 15519 return 0;
15354 } 15520 }
15355 v4 = &pIndoor->pFaces[a1 >> 3]; 15521 v4 = &pIndoor->pFaces[a1 >> 3];
15356 v5 = v4->uAttributes; 15522 v5 = v4->uAttributes;
15360 return 1; 15526 return 1;
15361 } 15527 }
15362 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) 15528 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 )
15363 return 1; 15529 return 1;
15364 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) 15530 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
15365 goto LABEL_13; 15531 {
15532 EventProcessor((signed __int16)v6, v2, 1);
15533 return 0;
15534 }
15366 break; 15535 break;
15367 } 15536 }
15368 return 0; 15537 return 0;
15369 } 15538 }
15370 // 4E28F8: using guessed type int pCurrentScreen; 15539 // 4E28F8: using guessed type int pCurrentScreen;