comparison mm7_4.cpp @ 355:bbf8efb5bfee

Слияние
author Ritor1
date Thu, 21 Feb 2013 09:25:50 +0600
parents bc7f77c694c3 ec6cc5cefa4b
children 4a236657a0be
comparison
equal deleted inserted replaced
354:bc7f77c694c3 355:bbf8efb5bfee
1 #include <io.h> 1 #include <io.h>
2 #include <direct.h> 2 #include <direct.h>
3 #include <assert.h> 3 #include <assert.h>
4
5 #include "MM7.h"
4 6
5 #include "MapInfo.h" 7 #include "MapInfo.h"
6 #include "Game.h" 8 #include "Game.h"
7 #include "GUIWindow.h" 9 #include "GUIWindow.h"
8 #include "GUIButton.h" 10 #include "GUIButton.h"
3724 } 3726 }
3725 3727
3726 3728
3727 3729
3728 //----- (00493F79) -------------------------------------------------------- 3730 //----- (00493F79) --------------------------------------------------------
3729 int sub_493F79(stru351 *_this, __int64 a2) 3731 void sub_493F79(stru351_summoned_item *_this, __int64 a2)
3730 { 3732 {
3731 signed __int64 v2; // ST2C_8@1 3733 signed __int64 v2; // ST2C_8@1
3732 signed __int64 v3; // qax@1 3734 signed __int64 v3; // qax@1
3733 signed __int64 v4; // ST1C_8@1 3735 //signed __int64 v4; // ST1C_8@1
3734 unsigned __int64 v5; // qax@1 3736 unsigned __int64 v5; // qax@1
3735 unsigned int v6; // ebx@1 3737 unsigned int v6; // ebx@1
3736 int result; // eax@1
3737 3738
3738 v2 = (signed __int64)((double)a2 * 0.234375); 3739 v2 = (signed __int64)((double)a2 * 0.234375);
3739 v3 = v2 / 60 / 60; 3740 v3 = v2 / 60 / 60;
3740 v4 = v3; 3741 //v4 = v3;
3741 v5 = (unsigned int)v3 / 0x18; 3742 v5 = (unsigned int)v3 / 0x18;
3742 v6 = (unsigned int)(v5 / 7) >> 2; 3743 v6 = (unsigned int)(v5 / 7) >> 2;
3743 _this->field_0 = v2 % 60; 3744 _this->field_0_expire_second = v2 % 60;
3744 _this->field_4 = v2 / 60 % 60; 3745 _this->field_4_expire_minute = v2 / 60 % 60;
3745 _this->field_8 = v4 % 24; 3746 _this->field_8_expire_hour = v3 % 24;
3746 _this->field_10 = v5 / 7 & 3; 3747 _this->field_10_expire_week = v5 / 7 & 3;
3747 _this->field_C = (unsigned int)v5 % 0x1C; 3748 _this->field_C_expire_day = (unsigned int)v5 % 0x1C;
3748 result = v6 / 0xC + 1168; 3749 _this->field_14_exprie_month = v6 % 0xC;
3749 _this->field_14 = v6 % 0xC; 3750 _this->field_18_expire_year = v6 / 0xC + game_starting_year;
3750 _this->field_18 = result;
3751 return result;
3752 } 3751 }
3753 3752
3754 3753
3755 3754
3756 3755
3839 pParty->uCurrentMinute = v1 % 60; 3838 pParty->uCurrentMinute = v1 % 60;
3840 pParty->uCurrentMonthWeek = v3 / 7 & 3; 3839 pParty->uCurrentMonthWeek = v3 / 7 & 3;
3841 pParty->uCurrentHour = v2 % 24; 3840 pParty->uCurrentHour = v2 % 24;
3842 pParty->uDaysPlayed = (unsigned int)v3 % 28; 3841 pParty->uDaysPlayed = (unsigned int)v3 % 28;
3843 pParty->uCurrentMonth = v4 % 12; 3842 pParty->uCurrentMonth = v4 % 12;
3844 pParty->uCurrentYear = v4 / 0xC + 1168; 3843 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
3845 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) 3844 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) )
3846 { 3845 {
3847 pParty->pHirelings[0].bHasUsedTheAbility = false; 3846 pParty->pHirelings[0].bHasUsedTheAbility = false;
3848 pParty->pHirelings[1].bHasUsedTheAbility = false; 3847 pParty->pHirelings[1].bHasUsedTheAbility = false;
3849 3848
4885 int v51; // eax@108 4884 int v51; // eax@108
4886 Player *v52; // eax@109 4885 Player *v52; // eax@109
4887 int v53; // [sp-4h] [bp-13Ch]@107 4886 int v53; // [sp-4h] [bp-13Ch]@107
4888 int v54; // [sp+0h] [bp-138h]@107 4887 int v54; // [sp+0h] [bp-138h]@107
4889 __int16 v55[56]; // [sp+10h] [bp-128h]@34 4888 __int16 v55[56]; // [sp+10h] [bp-128h]@34
4890 stru351 v56; // [sp+80h] [bp-B8h]@107 4889 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
4891 stru351 v57; // [sp+9Ch] [bp-9Ch]@115 4890 stru351_summoned_item v57; // [sp+9Ch] [bp-9Ch]@115
4892 char a1[100]; // [sp+B8h] [bp-80h]@3 4891 char a1[100]; // [sp+B8h] [bp-80h]@3
4893 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 4892 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
4894 //size_t v60; // [sp+120h] [bp-18h]@3 4893 //size_t v60; // [sp+120h] [bp-18h]@3
4895 //Player *v61; // [sp+124h] [bp-14h]@3 4894 //Player *v61; // [sp+124h] [bp-14h]@3
4896 //char *Str; // [sp+128h] [bp-10h]@1 4895 //char *Str; // [sp+128h] [bp-10h]@1
5235 case 30: 5234 case 30:
5236 { 5235 {
5237 if ( !a6 ) 5236 if ( !a6 )
5238 goto _continue_strcat; 5237 goto _continue_strcat;
5239 sub_493F79(&v57, *a6); 5238 sub_493F79(&v57, *a6);
5240 v54 = v57.field_18; 5239 v54 = v57.field_18_expire_year;
5241 v53 = v57.field_C + 1; 5240 v53 = v57.field_C_expire_day + 1;
5242 v50 = v57.field_14; 5241 v50 = v57.field_14_exprie_month;
5243 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); 5242 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5244 v11 = a1; 5243 v11 = a1;
5245 goto _continue_strcat; 5244 goto _continue_strcat;
5246 } 5245 }
5247 5246
5259 if ( v17 - 51 >= 20 ) 5258 if ( v17 - 51 >= 20 )
5260 goto _continue_strcat; 5259 goto _continue_strcat;
5261 HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1]; 5260 HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1];
5262 LODWORD(v49) = pParty->field_3C.field_440[2 * v17]; 5261 LODWORD(v49) = pParty->field_3C.field_440[2 * v17];
5263 sub_493F79(&v56, v49); 5262 sub_493F79(&v56, v49);
5264 v54 = v56.field_18; 5263 v54 = v56.field_18_expire_year;
5265 v53 = v56.field_C + 1; 5264 v53 = v56.field_C_expire_day + 1;
5266 v50 = v56.field_14; 5265 v50 = v56.field_14_exprie_month;
5267 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); 5266 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5268 v11 = a1; 5267 v11 = a1;
5269 goto _continue_strcat; 5268 goto _continue_strcat;
5270 } 5269 }
5271 } 5270 }
9111 v4 = pMouse->GetCursorPos((POINT *)&v11); 9110 v4 = pMouse->GetCursorPos((POINT *)&v11);
9112 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v10)->y]] & 0xFFFF; 9111 v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v10)->y]] & 0xFFFF;
9113 v18 = v5; 9112 v18 = v5;
9114 if ( !v5 ) 9113 if ( !v5 )
9115 return; 9114 return;
9116 v6 = 9 * (v5 + 12 * (unsigned int)ptr_507BC0->ptr_1C); 9115 v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C);
9117 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); 9116 v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4);
9118 if ( dword_F8B19C != 2 ) 9117 if ( dword_F8B19C != 2 )
9119 v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; 9118 v7 = (ItemGen *)&pParty->field_C59C[v6 + 715];
9120 goto LABEL_15; 9119 goto LABEL_15;
9121 } 9120 }
9124 v1 = pMouse->GetCursorPos(&a2); 9123 v1 = pMouse->GetCursorPos(&a2);
9125 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v16)->y]; 9124 v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v16)->y];
9126 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; 9125 v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
9127 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; 9126 v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF;
9128 if ( v18 ) 9127 if ( v18 )
9129 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)ptr_507BC0->ptr_1C)); 9128 sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
9130 } 9129 }
9131 } 9130 }
9132 // F8B198: using guessed type int dword_F8B198; 9131 // F8B198: using guessed type int dword_F8B198;
9133 // F8B19C: using guessed type int dword_F8B19C; 9132 // F8B19C: using guessed type int dword_F8B19C;
9134 9133
9154 pParty->uCurrentMinute = v1 / 60 % 60; 9153 pParty->uCurrentMinute = v1 / 60 % 60;
9155 pParty->uCurrentHour = v3 % 24; 9154 pParty->uCurrentHour = v3 % 24;
9156 pParty->uCurrentMonthWeek = v4 / 7 & 3; 9155 pParty->uCurrentMonthWeek = v4 / 7 & 3;
9157 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C; 9156 pParty->uDaysPlayed = (unsigned int)v4 % 0x1C;
9158 pParty->uCurrentMonth = v5 % 0xC; 9157 pParty->uCurrentMonth = v5 % 0xC;
9159 pParty->uCurrentYear = v5 / 0xC + 1168; 9158 pParty->uCurrentYear = v5 / 0xC + game_starting_year;
9160 pParty->RestAndHeal(); 9159 pParty->RestAndHeal();
9161 dword_507B94 = 1; 9160 dword_507B94 = 1;
9162 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; 9161 v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
9163 do 9162 do
9164 { 9163 {
9196 else 9195 else
9197 { 9196 {
9198 if ( dword_F8B198 != 23 ) 9197 if ( dword_F8B198 != 23 )
9199 return; 9198 return;
9200 } 9199 }
9201 v1 = (unsigned int)ptr_507BC0->ptr_1C; 9200 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
9202 LABEL_28: 9201 LABEL_28:
9203 HousePlaySomeSound(v1, v0); 9202 HousePlaySomeSound(v1, v0);
9204 return; 9203 return;
9205 } 9204 }
9206 v1 = (unsigned int)ptr_507BC0->ptr_1C; 9205 v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
9207 if ( (signed __int64)__PAIR__(pParty->field_3C._shop_ban_times[2 * v1 + 1], pParty->field_3C._shop_ban_times[2 * v1]) <= (signed __int64)pParty->uTimePlayed ) 9206 if ( (signed __int64)__PAIR__(pParty->field_3C._shop_ban_times[2 * v1 + 1], pParty->field_3C._shop_ban_times[2 * v1]) <= (signed __int64)pParty->uTimePlayed )
9208 { 9207 {
9209 if ( pParty->uNumGold <= 0x2710 ) 9208 if ( pParty->uNumGold <= 0x2710 )
9210 { 9209 {
9211 if ( !dword_F8B1E4 ) 9210 if ( !dword_F8B1E4 )
9647 v22 = pParty->pHireling1Name; 9646 v22 = pParty->pHireling1Name;
9648 } 9647 }
9649 strcpy(v22, v24); 9648 strcpy(v22, v24);
9650 pParty->field_709 = 0; 9649 pParty->field_709 = 0;
9651 sub_44A56A(); 9650 sub_44A56A();
9652 PrepareHouse((unsigned int)ptr_507BC0->ptr_1C); 9651 PrepareHouse((HOUSE_TYPE)(int)window_SpeakInHouse->ptr_1C);
9653 dword_F8B19C = 1; 9652 dword_F8B19C = 1;
9654 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 9653 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
9655 { 9654 {
9656 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 9655 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
9657 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 9656 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
10168 v52.uFrameWidth = 148; 10167 v52.uFrameWidth = 148;
10169 v52.uFrameZ = 334; 10168 v52.uFrameZ = 334;
10170 v56 = v52.pStartingPosActiveItem; 10169 v56 = v52.pStartingPosActiveItem;
10171 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton ) 10170 if ( v52.pStartingPosActiveItem < v52.pStartingPosActiveItem + v52.pNumPresenceButton )
10172 { 10171 {
10173 v15 = (char *)v54; 10172 v15 = "";//(char *)v54;
10174 while ( 1 ) 10173 while ( 1 )
10175 { 10174 {
10176 v16 = v52.GetControl(v56); 10175 v16 = v52.GetControl(v56);
10177 v17 = v16->uControlParam; 10176 v17 = v16->uControlParam;
10178 pInString = (char *)v16; 10177 pInString = (char *)v16;
10442 while ( 1 ) 10441 while ( 1 )
10443 { 10442 {
10444 v19 = 1; 10443 v19 = 1;
10445 do 10444 do
10446 { 10445 {
10447 v20 = (char *)ptr_507BC0->ptr_1C + 4 * (unsigned int)ptr_507BC0->ptr_1C + v19; 10446 v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19;
10448 if ( v1 ) 10447 if ( v1 )
10449 v21 = word_4F063E[(signed int)v20]; 10448 v21 = word_4F063E[(signed int)v20];
10450 else 10449 else
10451 v21 = word_4F03FE[(signed int)v20]; 10450 v21 = word_4F03FE[(signed int)v20];
10452 v22 = v21 - 23; 10451 v22 = v21 - 23;
10522 do 10521 do
10523 { 10522 {
10524 v12 = 1; 10523 v12 = 1;
10525 do 10524 do
10526 { 10525 {
10527 v13 = v11 + 2 * (unsigned int)ptr_507BC0->ptr_1C - 30; 10526 v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30;
10528 v14 = v12 + 4 * v13 + v13; 10527 v14 = v12 + 4 * v13 + v13;
10529 if ( v10 ) 10528 if ( v10 )
10530 v15 = word_4F06D8[v14]; 10529 v15 = word_4F06D8[v14];
10531 else 10530 else
10532 v15 = word_4F0498[v14]; 10531 v15 = word_4F0498[v14];
10922 goto LABEL_43; 10921 goto LABEL_43;
10923 sub_4B36CC(0, 0xFu); 10922 sub_4B36CC(0, 0xFu);
10924 sub_4B36CC(1, 0x10u); 10923 sub_4B36CC(1, 0x10u);
10925 v4 = 3; 10924 v4 = 3;
10926 sub_4B36CC(2, 0x60u); 10925 sub_4B36CC(2, 0x60u);
10927 v5 = (signed int)ptr_507BC0->ptr_1C; 10926 v5 = (signed int)window_SpeakInHouse->ptr_1C;
10928 if ( v5 < 108 || v5 > 120 ) 10927 if ( v5 < 108 || v5 > 120 )
10929 goto LABEL_28; 10928 goto LABEL_28;
10930 v4 = 4; 10929 v4 = 4;
10931 v6 = 101; 10930 v6 = 101;
10932 v7 = 3; 10931 v7 = 3;
11542 int v71; // [sp+78h] [bp-Ch]@1 11541 int v71; // [sp+78h] [bp-Ch]@1
11543 int v72; // [sp+7Ch] [bp-8h]@16 11542 int v72; // [sp+7Ch] [bp-8h]@16
11544 int v73; // [sp+80h] [bp-4h]@14 11543 int v73; // [sp+80h] [bp-4h]@14
11545 11544
11546 v0 = pPlayers[uActiveCharacter]; 11545 v0 = pPlayers[uActiveCharacter];
11547 memcpy(&v65, ptr_507BC0, sizeof(v65)); 11546 memcpy(&v65, window_SpeakInHouse, sizeof(v65));
11548 v65.uFrameX = 483; 11547 v65.uFrameX = 483;
11549 v65.uFrameWidth = 148; 11548 v65.uFrameWidth = 148;
11550 v65.uFrameZ = 334; 11549 v65.uFrameZ = 334;
11551 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 11550 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
11552 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 11551 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
11556 v4 = 0; 11555 v4 = 0;
11557 for ( i = v2; v4 < (signed int)v2; ++v4 ) 11556 for ( i = v2; v4 < (signed int)v2; ++v4 )
11558 v3 += v4 + 1; 11557 v3 += v4 + 1;
11559 v5 = 1000 * v3; 11558 v5 = 1000 * v3;
11560 v6 = HIDWORD(v0->uExperience); 11559 v6 = HIDWORD(v0->uExperience);
11561 v7 = ptr_507BC0->ptr_1C; 11560 v7 = window_SpeakInHouse->ptr_1C;
11562 v68 = (unsigned __int16)word_4F0866[(signed int)v7]; 11561 v68 = (unsigned __int16)word_4F0866[(signed int)v7];
11563 v66 = 1000 * v3; 11562 v66 = 1000 * v3;
11564 if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 ) 11563 if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 )
11565 { 11564 {
11566 v8 = v0->classType % 4 + 1; 11565 v8 = v0->classType % 4 + 1;
11590 if ( result ) 11589 if ( result )
11591 { 11590 {
11592 i = 0; 11591 i = 0;
11593 v13 = pDialogueWindow; 11592 v13 = pDialogueWindow;
11594 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 11593 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
11595 v14 = (signed __int64)(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].flt_24 * 500.0); 11594 v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
11596 v73 = v14 * (100 - v0->GetMerchant()) / 100; 11595 v73 = v14 * (100 - v0->GetMerchant()) / 100;
11597 if ( v73 < v14 / 3 ) 11596 if ( v73 < v14 / 3 )
11598 v73 = v14 / 3; 11597 v73 = v14 / 3;
11599 v15 = v13->pStartingPosActiveItem; 11598 v15 = v13->pStartingPosActiveItem;
11600 v16 = v13->pNumPresenceButton; 11599 v16 = v13->pNumPresenceButton;
11693 if ( (signed __int64)v0->uExperience >= v66 ) 11692 if ( (signed __int64)v0->uExperience >= v66 )
11694 { 11693 {
11695 if ( pParty->uNumGold >= i ) 11694 if ( pParty->uNumGold >= i )
11696 { 11695 {
11697 Party::TakeGold(i); 11696 Party::TakeGold(i);
11698 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); 11697 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
11699 ++v0->uLevel; 11698 ++v0->uLevel;
11700 v0->uSkillPoints += v0->uLevel / 10 + 5; 11699 v0->uSkillPoints += v0->uLevel / 10 + 5;
11701 v0->sHealth = v0->GetMaxHealth(); 11700 v0->sHealth = v0->GetMaxHealth();
11702 v0->sMana = v0->GetMaxMana(); 11701 v0->sMana = v0->GetMaxMana();
11703 v37 = 0; 11702 v37 = 0;
11712 v39 = &dword_F8B144 + uActiveCharacter; 11711 v39 = &dword_F8B144 + uActiveCharacter;
11713 ++*v39; 11712 ++*v39;
11714 if ( *v39 > v37 ) 11713 if ( *v39 > v37 )
11715 { 11714 {
11716 v40 = sub_494820(pParty->uCurrentHour); 11715 v40 = sub_494820(pParty->uCurrentHour);
11717 v41 = ptr_507BC0->ptr_1C; 11716 v41 = window_SpeakInHouse->ptr_1C;
11718 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; 11717 v42 = 60 * (v40 + 4) - pParty->uCurrentMinute;
11719 if ( v41 == (void *)94 || v41 == (void *)95 ) 11718 if ( v41 == (void *)94 || v41 == (void *)95 )
11720 v42 += 720; 11719 v42 += 720;
11721 RestAndHeal((signed int)(v42 + 10080)); 11720 RestAndHeal((signed int)(v42 + 10080));
11722 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 11721 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
11729 goto LABEL_56; 11728 goto LABEL_56;
11730 } 11729 }
11731 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" 11730 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
11732 v63 = 4; 11731 v63 = 4;
11733 LABEL_55: 11732 LABEL_55:
11734 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v63); 11733 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63);
11735 LABEL_56: 11734 LABEL_56:
11736 result = pMessageQueue_50CBD0->uNumMessages; 11735 result = pMessageQueue_50CBD0->uNumMessages;
11737 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 11736 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
11738 { 11737 {
11739 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 11738 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
11988 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 11987 unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14
11989 int v122; // [sp+F4h] [bp-4h]@23 11988 int v122; // [sp+F4h] [bp-4h]@23
11990 11989
11991 v0 = pPlayers[uActiveCharacter]; 11990 v0 = pPlayers[uActiveCharacter];
11992 _this = pPlayers[uActiveCharacter]; 11991 _this = pPlayers[uActiveCharacter];
11993 memcpy(&v112, ptr_507BC0, sizeof(v112)); 11992 memcpy(&v112, window_SpeakInHouse, sizeof(v112));
11994 v112.uFrameX = 483; 11993 v112.uFrameX = 483;
11995 v112.uFrameWidth = 148; 11994 v112.uFrameWidth = 148;
11996 v112.uFrameZ = 334; 11995 v112.uFrameZ = 334;
11997 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 11996 white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
11998 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 11997 color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
12058 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 12057 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
12059 if ( result ) 12058 if ( result )
12060 { 12059 {
12061 v31 = pDialogueWindow; 12060 v31 = pDialogueWindow;
12062 v3 = 0; 12061 v3 = 0;
12063 v32 = ptr_507BC0->ptr_1C; 12062 v32 = window_SpeakInHouse->ptr_1C;
12064 v118 = 0; 12063 v118 = 0;
12065 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); 12064 //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0);
12066 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); 12065 v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0);
12067 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100); 12066 v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100);
12068 if ( (signed int)v119 < v33 / 3 ) 12067 if ( (signed int)v119 < v33 / 3 )
12169 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) 12168 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result)
12170 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) 12169 || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) )
12171 return result; 12170 return result;
12172 v96 = 0; 12171 v96 = 0;
12173 v94 = 5; 12172 v94 = 5;
12174 v93 = ptr_507BC0->ptr_1C; 12173 v93 = window_SpeakInHouse->ptr_1C;
12175 v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5]; 12174 v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5];
12176 v28 = (int)ptr_507BC0->ptr_1C; 12175 v28 = (int)window_SpeakInHouse->ptr_1C;
12177 uPlayerID = uActiveCharacter - 1; 12176 uPlayerID = uActiveCharacter - 1;
12178 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); 12177 v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5);
12179 v9 = uPlayerID; 12178 v9 = uPlayerID;
12180 v10 = (char *)pMerchantsRepairPhrases[v29]; 12179 v10 = (char *)pMerchantsRepairPhrases[v29];
12181 goto LABEL_35; 12180 goto LABEL_35;
12263 v96 = 0; 12262 v96 = 0;
12264 v94 = 4; 12263 v94 = 4;
12265 v4 = (char *)&_this->pInventoryItems[result-1]; 12264 v4 = (char *)&_this->pInventoryItems[result-1];
12266 if ( v4[20] & 1 ) 12265 if ( v4[20] & 1 )
12267 { 12266 {
12268 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)ptr_507BC0->ptr_1C, 4, 0); 12267 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0);
12269 v97 = 3; 12268 v97 = 3;
12270 v95 = v5; 12269 v95 = v5;
12271 v92 = white; 12270 v92 = white;
12272 v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101; 12271 v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101;
12273 return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); 12272 return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
12274 } 12273 }
12275 v93 = ptr_507BC0->ptr_1C; 12274 v93 = window_SpeakInHouse->ptr_1C;
12276 v90 = (ItemGen *)v4; 12275 v90 = (ItemGen *)v4;
12277 v7 = (int)ptr_507BC0->ptr_1C; 12276 v7 = (int)window_SpeakInHouse->ptr_1C;
12278 uPlayerID = uActiveCharacter - 1; 12277 uPlayerID = uActiveCharacter - 1;
12279 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); 12278 v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4);
12280 v9 = uPlayerID; 12279 v9 = uPlayerID;
12281 v10 = (char *)pMerchantsIdentifyPhrases[v8]; 12280 v10 = (char *)pMerchantsIdentifyPhrases[v8];
12282 goto LABEL_35; 12281 goto LABEL_35;
12299 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) 12298 || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462)
12300 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) 12299 || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) )
12301 return result; 12300 return result;
12302 v96 = 0; 12301 v96 = 0;
12303 v94 = 3; 12302 v94 = 3;
12304 v93 = ptr_507BC0->ptr_1C; 12303 v93 = window_SpeakInHouse->ptr_1C;
12305 v90 = (ItemGen *)&_this->pInventoryItems[result-1]; 12304 v90 = (ItemGen *)&_this->pInventoryItems[result-1];
12306 v12 = (int)ptr_507BC0->ptr_1C; 12305 v12 = (int)window_SpeakInHouse->ptr_1C;
12307 uPlayerID = uActiveCharacter - 1; 12306 uPlayerID = uActiveCharacter - 1;
12308 v13 = _this->_490EEE(v90, 3, v12, 3); 12307 v13 = _this->_490EEE(v90, 3, v12, 3);
12309 v9 = uPlayerID; 12308 v9 = uPlayerID;
12310 v10 = (char *)pMerchantsSellPhrases[v13]; 12309 v10 = (char *)pMerchantsSellPhrases[v13];
12311 LABEL_35: 12310 LABEL_35:
12327 v122 = 0; 12326 v122 = 0;
12328 if ( dword_F8B19C == 2 ) 12327 if ( dword_F8B19C == 2 )
12329 { 12328 {
12330 do 12329 do
12331 { 12330 {
12332 if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) 12331 if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
12333 { 12332 {
12334 v50 = dword_F8B168[v49]; 12333 v50 = dword_F8B168[v49];
12335 v51 = 152 - v50->uTextureHeight; 12334 v51 = 152 - v50->uTextureHeight;
12336 if ( (signed int)v51 < 1 ) 12335 if ( (signed int)v51 < 1 )
12337 v51 = 0; 12336 v51 = 0;
12359 } 12358 }
12360 while ( v49 < 6 ); 12359 while ( v49 < 6 );
12361 v122 = 0; 12360 v122 = 0;
12362 do 12361 do
12363 { 12362 {
12364 if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 54] ) 12363 if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
12365 { 12364 {
12366 v54 = dword_F8B168[v122 + 6]; 12365 v54 = dword_F8B168[v122 + 6];
12367 v55 = 306 - v54->uTextureHeight; 12366 v55 = 306 - v54->uTextureHeight;
12368 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; 12367 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
12369 if ( v122 ) 12368 if ( v122 )
12389 } 12388 }
12390 else 12389 else
12391 { 12390 {
12392 do 12391 do
12393 { 12392 {
12394 if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) 12393 if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
12395 { 12394 {
12396 v58 = dword_F8B168[v49]; 12395 v58 = dword_F8B168[v49];
12397 v59 = 152 - v58->uTextureHeight; 12396 v59 = 152 - v58->uTextureHeight;
12398 if ( (signed int)v59 < 1 ) 12397 if ( (signed int)v59 < 1 )
12399 v59 = 0; 12398 v59 = 0;
12421 } 12420 }
12422 while ( v49 < 6 ); 12421 while ( v49 < 6 );
12423 v122 = 0; 12422 v122 = 0;
12424 do 12423 do
12425 { 12424 {
12426 if ( pParty->field_C59C[9 * (v122 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 778] ) 12425 if ( pParty->field_C59C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] )
12427 { 12426 {
12428 v62 = dword_F8B168[v122 + 6]; 12427 v62 = dword_F8B168[v122 + 6];
12429 v63 = 306 - v62->uTextureHeight; 12428 v63 = 306 - v62->uTextureHeight;
12430 if ( (signed int)v63 < 1 ) 12429 if ( (signed int)v63 < 1 )
12431 v63 = 0; 12430 v63 = 0;
12458 v117 = 0; 12457 v117 = 0;
12459 if ( dword_F8B19C == 2 ) 12458 if ( dword_F8B19C == 2 )
12460 { 12459 {
12461 do 12460 do
12462 { 12461 {
12463 if ( pParty->field_777C[9 * (v66 + 12 * (unsigned int)ptr_507BC0->ptr_1C)] ) 12462 if ( pParty->field_777C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
12464 ++v117; 12463 ++v117;
12465 ++v66; 12464 ++v66;
12466 } 12465 }
12467 while ( v66 < 12 ); 12466 while ( v66 < 12 );
12468 } 12467 }
12469 else 12468 else
12470 { 12469 {
12471 do 12470 do
12472 { 12471 {
12473 if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 724] ) 12472 if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
12474 ++v117; 12473 ++v117;
12475 ++v66; 12474 ++v66;
12476 } 12475 }
12477 while ( v66 < 12 ); 12476 while ( v66 < 12 );
12478 } 12477 }
12491 } 12490 }
12492 sub_4B46A5(v69, 0); 12491 sub_4B46A5(v69, 0);
12493 if ( !v117 ) 12492 if ( !v117 )
12494 return (int)v112._4B1854( 12493 return (int)v112._4B1854(
12495 __PAIR__( 12494 __PAIR__(
12496 pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C + 1], 12495 pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1],
12497 pParty->field_3C.field_50[2 * (unsigned int)ptr_507BC0->ptr_1C]) 12496 pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C])
12498 - pParty->uTimePlayed); 12497 - pParty->uTimePlayed);
12499 v70 = pMouse->GetCursorPos(&v102); 12498 v70 = pMouse->GetCursorPos(&v102);
12500 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; 12499 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
12501 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 12500 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
12502 { 12501 {
12503 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; 12502 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
12504 v117 = v71; 12503 v117 = v71;
12505 v72 = (int)ptr_507BC0->ptr_1C; 12504 v72 = (int)window_SpeakInHouse->ptr_1C;
12506 v73 = 9 * (v71 + 12 * v72); 12505 v73 = 9 * (v71 + 12 * v72);
12507 v74 = (ItemGen *)&pParty->field_777C[v73]; 12506 v74 = (ItemGen *)&pParty->field_777C[v73];
12508 if ( dword_F8B19C != 2 ) 12507 if ( dword_F8B19C != 2 )
12509 v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; 12508 v74 = (ItemGen *)&pParty->field_C59C[v73 + 724];
12510 if ( v67 && Str ) 12509 if ( v67 && Str )
12511 { 12510 {
12512 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" 12511 v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24"
12513 v96 = 0; 12512 v96 = 0;
12514 v94 = 2; 12513 v94 = 2;
12515 v93 = ptr_507BC0->ptr_1C; 12514 v93 = window_SpeakInHouse->ptr_1C;
12516 v90 = v74; 12515 v90 = v74;
12517 v9 = uActiveCharacter - 1; 12516 v9 = uActiveCharacter - 1;
12518 } 12517 }
12519 else 12518 else
12520 { 12519 {
12521 v96 = 0; 12520 v96 = 0;
12522 v94 = 2; 12521 v94 = 2;
12523 v93 = ptr_507BC0->ptr_1C; 12522 v93 = window_SpeakInHouse->ptr_1C;
12524 v90 = v74; 12523 v90 = v74;
12525 uPlayerID = uActiveCharacter - 1; 12524 uPlayerID = uActiveCharacter - 1;
12526 v75 = _this->_490EEE(v74, 3, v72, 2); 12525 v75 = _this->_490EEE(v74, 3, v72, 2);
12527 v9 = uPlayerID; 12526 v9 = uPlayerID;
12528 v10 = (char *)pMerchantsBuyPhrases[v75]; 12527 v10 = (char *)pMerchantsBuyPhrases[v75];
12925 char *Str; // [sp+2DCh] [bp-10h]@35 12924 char *Str; // [sp+2DCh] [bp-10h]@35
12926 int v61; // [sp+2E0h] [bp-Ch]@35 12925 int v61; // [sp+2E0h] [bp-Ch]@35
12927 unsigned int v62; // [sp+2E4h] [bp-8h]@13 12926 unsigned int v62; // [sp+2E4h] [bp-8h]@13
12928 int v63; // [sp+2E8h] [bp-4h]@1 12927 int v63; // [sp+2E8h] [bp-4h]@1
12929 12928
12930 v0 = ptr_507BC0; 12929 v0 = window_SpeakInHouse;
12931 memcpy(&v52, ptr_507BC0, sizeof(v52)); 12930 memcpy(&v52, window_SpeakInHouse, sizeof(v52));
12932 v58 = pPlayers[uActiveCharacter]; 12931 v58 = pPlayers[uActiveCharacter];
12933 v1 = v58; 12932 v1 = v58;
12934 v52.uFrameX = 483; 12933 v52.uFrameX = 483;
12935 v53 = 148; 12934 v53 = 148;
12936 v54 = 334; 12935 v54 = 334;
12962 else 12961 else
12963 { 12962 {
12964 if ( pParty->uNumGold < v63 ) 12963 if ( pParty->uNumGold < v63 )
12965 { 12964 {
12966 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 12965 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
12967 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); 12966 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
12968 } 12967 }
12969 else 12968 else
12970 { 12969 {
12971 Party::TakeGold(v63); 12970 Party::TakeGold(v63);
12972 *(short *)v3 = 1; 12971 *(short *)v3 = 1;
12989 v6 = 0; 12988 v6 = 0;
12990 v62 = 0; 12989 v62 = 0;
12991 v63 = 32; 12990 v63 = 32;
12992 do 12991 do
12993 { 12992 {
12994 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)ptr_507BC0->ptr_1C)) ) 12993 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
12995 { 12994 {
12996 pRenderer->DrawTextureTransparent(v63, 0x5Au, dword_F8B168[v6]); 12995 pRenderer->DrawTextureTransparent(v63, 0x5Au, dword_F8B168[v6]);
12997 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), dword_F8B168[v6], v6 + 1); 12996 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), dword_F8B168[v6], v6 + 1);
12998 v1 = v58; 12997 v1 = v58;
12999 } 12998 }
13005 v62 = 1680; 13004 v62 = 1680;
13006 v7 = 6; 13005 v7 = 6;
13007 v63 = 32; 13006 v63 = 32;
13008 do 13007 do
13009 { 13008 {
13010 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)ptr_507BC0->ptr_1C)) ) 13009 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
13011 { 13010 {
13012 pRenderer->DrawTextureTransparent(v63, 0xFAu, dword_F8B168[v7]); 13011 pRenderer->DrawTextureTransparent(v63, 0xFAu, dword_F8B168[v7]);
13013 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), dword_F8B168[v7], v7 + 1); 13012 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), dword_F8B168[v7], v7 + 1);
13014 v1 = v58; 13013 v1 = v58;
13015 } 13014 }
13021 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 13020 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
13022 if ( result ) 13021 if ( result )
13023 { 13022 {
13024 v8 = 0; 13023 v8 = 0;
13025 v9 = 12; 13024 v9 = 12;
13026 v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)ptr_507BC0->ptr_1C); 13025 v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C);
13027 do 13026 do
13028 { 13027 {
13029 if ( *(int *)v10 ) 13028 if ( *(int *)v10 )
13030 ++v8; 13029 ++v8;
13031 v10 += 36; 13030 v10 += 36;
13038 v11 = pGlobalTXT_LocalizationStrings[196]; 13037 v11 = pGlobalTXT_LocalizationStrings[196];
13039 sub_4B46A5(v11, 0); 13038 sub_4B46A5(v11, 0);
13040 if ( !v8 ) 13039 if ( !v8 )
13041 return (int)v52._4B1854( 13040 return (int)v52._4B1854(
13042 __PAIR__( 13041 __PAIR__(
13043 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)ptr_507BC0->ptr_1C + 44472], 13042 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
13044 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)ptr_507BC0->ptr_1C + 44468]) 13043 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468])
13045 - pParty->uTimePlayed); 13044 - pParty->uTimePlayed);
13046 v12 = pMouse->GetCursorPos(&v51); 13045 v12 = pMouse->GetCursorPos(&v51);
13047 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; 13046 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
13048 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; 13047 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
13049 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 13048 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
13050 { 13049 {
13051 v14 = ptr_507BC0->ptr_1C; 13050 v14 = window_SpeakInHouse->ptr_1C;
13052 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); 13051 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14));
13053 v16 = (int)ptr_507BC0->ptr_1C; 13052 v16 = (int)window_SpeakInHouse->ptr_1C;
13054 uPlayerID = uActiveCharacter - 1; 13053 uPlayerID = uActiveCharacter - 1;
13055 v17 = v1->_490EEE( 13054 v17 = v1->_490EEE(
13056 (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 13055 (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14,
13057 3, 13056 3,
13058 v16, 13057 v16,
13071 } 13070 }
13072 return result; 13071 return result;
13073 } 13072 }
13074 if ( !(unsigned __int16)_449B57_test_bit( 13073 if ( !(unsigned __int16)_449B57_test_bit(
13075 (unsigned __int8 *)v1->field_152, 13074 (unsigned __int8 *)v1->field_152,
13076 word_4F0704[2 * (unsigned int)ptr_507BC0->ptr_1C]) ) 13075 word_4F0704[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
13077 { 13076 {
13078 v36 = pNPCTopics[121].pText; 13077 v36 = pNPCTopics[121].pText;
13079 v37 = v57; 13078 v37 = v57;
13080 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &v52, 0, 0); 13079 v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &v52, 0, 0);
13081 v52.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u); 13080 v52.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u);
13275 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 13274 unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64
13276 int v64; // [sp+1B8h] [bp-Ch]@6 13275 int v64; // [sp+1B8h] [bp-Ch]@6
13277 unsigned int v65; // [sp+1BCh] [bp-8h]@6 13276 unsigned int v65; // [sp+1BCh] [bp-8h]@6
13278 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 13277 DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6
13279 13278
13280 v0 = ptr_507BC0; 13279 v0 = window_SpeakInHouse;
13281 memcpy(&v57, ptr_507BC0, sizeof(v57)); 13280 memcpy(&v57, window_SpeakInHouse, sizeof(v57));
13282 v57.uFrameX = 483; 13281 v57.uFrameX = 483;
13283 v57.uFrameWidth = 148; 13282 v57.uFrameWidth = 148;
13284 v57.uFrameZ = 334; 13283 v57.uFrameZ = 334;
13285 HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 13284 HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
13286 HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 13285 HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
13300 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 13299 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
13301 if ( result ) 13300 if ( result )
13302 { 13301 {
13303 v4 = pDialogueWindow; 13302 v4 = pDialogueWindow;
13304 v61 = pDialogueWindow; 13303 v61 = pDialogueWindow;
13305 v5 = ptr_507BC0->ptr_1C; 13304 v5 = window_SpeakInHouse->ptr_1C;
13306 v66 = 0; 13305 v66 = 0;
13307 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); 13306 //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0);
13308 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); 13307 v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0);
13309 v6 = v1->GetMerchant(); 13308 v6 = v1->GetMerchant();
13310 v64 = (signed int)(v65 * (100 - v6)) / 100; 13309 v64 = (signed int)(v65 * (100 - v6)) / 100;
13393 } 13392 }
13394 } 13393 }
13395 return result; 13394 return result;
13396 } 13395 }
13397 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; 13396 //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
13398 v24 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; 13397 v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
13399 v25 = 0; 13398 v25 = 0;
13400 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) 13399 if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 )
13401 { 13400 {
13402 Party::TakeGold((signed __int64)v24); 13401 Party::TakeGold((signed __int64)v24);
13403 v26 = &pOutdoor->ddm; 13402 v26 = &pOutdoor->ddm;
13467 v25 = 0; 13466 v25 = 0;
13468 if ( pParty->uNumGold < v2 ) 13467 if ( pParty->uNumGold < v2 )
13469 { 13468 {
13470 LABEL_55: 13469 LABEL_55:
13471 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 13470 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
13472 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); 13471 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
13473 goto LABEL_46; 13472 goto LABEL_46;
13474 } 13473 }
13475 Party::TakeGold(v2); 13474 Party::TakeGold(v2);
13476 v35 = LODWORD(v1->pConditions[17]); 13475 v35 = LODWORD(v1->pConditions[17]);
13477 v59 = v1->pConditions[14]; 13476 v59 = v1->pConditions[14];
13479 v60 = v1->pConditions[16]; 13478 v60 = v1->pConditions[16];
13480 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]); 13479 v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]);
13481 memset(v1, 0, 0xA0u); 13480 memset(v1, 0, 0xA0u);
13482 v1->sHealth = v1->GetMaxHealth(); 13481 v1->sHealth = v1->GetMaxHealth();
13483 v1->sMana = v1->GetMaxMana(); 13482 v1->sMana = v1->GetMaxMana();
13484 v36 = (signed int)ptr_507BC0->ptr_1C; 13483 v36 = (signed int)window_SpeakInHouse->ptr_1C;
13485 if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) 13484 if ( v36 != 78 && (v36 <= 80 || v36 > 82) )
13486 { 13485 {
13487 if ( (unsigned int)v61 | v35 ) 13486 if ( (unsigned int)v61 | v35 )
13488 { 13487 {
13489 v37 = LOBYTE(v1->field_1928); 13488 v37 = LOBYTE(v1->field_1928);
13613 int v9; // eax@5 13612 int v9; // eax@5
13614 int v10; // eax@10 13613 int v10; // eax@10
13615 void *result; // eax@15 13614 void *result; // eax@15
13616 signed int v12; // [sp-4h] [bp-18h]@7 13615 signed int v12; // [sp-4h] [bp-18h]@7
13617 13616
13618 v0 = ptr_507BC0; 13617 v0 = window_SpeakInHouse;
13619 v1 = 0; 13618 v1 = 0;
13620 v2 = (int)&ptr_507BC0->ptr_1C; 13619 v2 = (int)&window_SpeakInHouse->ptr_1C;
13621 v3 = (signed int)ptr_507BC0->ptr_1C; 13620 v3 = (signed int)window_SpeakInHouse->ptr_1C;
13622 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) 13621 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] )
13623 if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].uType] ) 13622 if ( _4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] )
13624 { 13623 {
13625 while ( v3 > 14 ) 13624 while ( v3 > 14 )
13626 { 13625 {
13627 if ( v3 <= 28 ) 13626 if ( v3 <= 28 )
13628 { 13627 {
13648 v12 = 44; 13647 v12 = 44;
13649 LABEL_12: 13648 LABEL_12:
13650 v6 = v12; 13649 v6 = v12;
13651 LABEL_13: 13650 LABEL_13:
13652 pItemsTable->GenerateItem(v5, v6, (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]); 13651 pItemsTable->GenerateItem(v5, v6, (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]);
13653 v0 = ptr_507BC0; 13652 v0 = window_SpeakInHouse;
13654 v2 = (int)&ptr_507BC0->ptr_1C; 13653 v2 = (int)&window_SpeakInHouse->ptr_1C;
13655 pParty->field_C59C[9 * (v1 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 729] = 1; 13654 pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1;
13656 goto LABEL_14; 13655 goto LABEL_14;
13657 } 13656 }
13658 auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]; 13657 auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724];
13659 _a->Reset(); 13658 _a->Reset();
13660 v2 = (int)&v0->ptr_1C; 13659 v2 = (int)&v0->ptr_1C;
13661 v10 = rand(); 13660 v10 = rand();
13662 v0 = ptr_507BC0; 13661 v0 = window_SpeakInHouse;
13663 pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740; 13662 pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740;
13664 } 13663 }
13665 LABEL_14: 13664 LABEL_14:
13666 v3 = *(int *)v2; 13665 v3 = *(int *)v2;
13667 ++v1; 13666 ++v1;
13720 int v32; // [sp+6Ch] [bp-10h]@1 13719 int v32; // [sp+6Ch] [bp-10h]@1
13721 int v33; // [sp+70h] [bp-Ch]@17 13720 int v33; // [sp+70h] [bp-Ch]@17
13722 int v34; // [sp+74h] [bp-8h]@17 13721 int v34; // [sp+74h] [bp-8h]@17
13723 int v35; // [sp+78h] [bp-4h]@17 13722 int v35; // [sp+78h] [bp-4h]@17
13724 13723
13725 v0 = ptr_507BC0; 13724 v0 = window_SpeakInHouse;
13726 memcpy(&v28, ptr_507BC0, sizeof(v28)); 13725 memcpy(&v28, window_SpeakInHouse, sizeof(v28));
13727 v1 = pPlayers[uActiveCharacter]; 13726 v1 = pPlayers[uActiveCharacter];
13728 v28.uFrameX = 483; 13727 v28.uFrameX = 483;
13729 v28.uFrameWidth = 148; 13728 v28.uFrameWidth = 148;
13730 v28.uFrameZ = 334; 13729 v28.uFrameZ = 334;
13731 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 13730 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
13772 { 13771 {
13773 Party::TakeGold(v4); 13772 Party::TakeGold(v4);
13774 *(short *)v6 = 1; 13773 *(short *)v6 = 1;
13775 v27 = 2; 13774 v27 = 2;
13776 } 13775 }
13777 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, v27); 13776 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v27);
13778 } 13777 }
13779 } 13778 }
13780 else 13779 else
13781 { 13780 {
13782 v5 = 0; 13781 v5 = 0;
13792 } 13791 }
13793 return result; 13792 return result;
13794 } 13793 }
13795 if ( !(unsigned __int16)_449B57_test_bit( 13794 if ( !(unsigned __int16)_449B57_test_bit(
13796 (unsigned __int8 *)v1->field_152, 13795 (unsigned __int8 *)v1->field_152,
13797 word_4F0754[2 * (unsigned int)ptr_507BC0->ptr_1C]) ) 13796 word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
13798 { 13797 {
13799 v24 = pNPCTopics[171].pText; 13798 v24 = pNPCTopics[171].pText;
13800 v25 = v31; 13799 v25 = v31;
13801 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); 13800 v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
13802 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); 13801 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
13963 int v63; // [sp+280h] [bp-10h]@14 13962 int v63; // [sp+280h] [bp-10h]@14
13964 char *a1; // [sp+284h] [bp-Ch]@37 13963 char *a1; // [sp+284h] [bp-Ch]@37
13965 unsigned int s1; // [sp+288h] [bp-8h]@1 13964 unsigned int s1; // [sp+288h] [bp-8h]@1
13966 int v66; // [sp+28Ch] [bp-4h]@48 13965 int v66; // [sp+28Ch] [bp-4h]@48
13967 13966
13968 v0 = ptr_507BC0; 13967 v0 = window_SpeakInHouse;
13969 memcpy(&v53, ptr_507BC0, sizeof(v53)); 13968 memcpy(&v53, window_SpeakInHouse, sizeof(v53));
13970 v2 = 255; 13969 v2 = 255;
13971 v61 = pPlayers[uActiveCharacter]; 13970 v61 = pPlayers[uActiveCharacter];
13972 v1 = v61; 13971 v1 = v61;
13973 v53.uFrameX = 483; 13972 v53.uFrameX = 483;
13974 v53.uFrameWidth = 148; 13973 v53.uFrameWidth = 148;
14007 s1 = 2; 14006 s1 = 2;
14008 a1 = &v48; 14007 a1 = &v48;
14009 while ( 1 ) 14008 while ( 1 )
14010 { 14009 {
14011 v47[1] = (const char *)v60; 14010 v47[1] = (const char *)v60;
14012 v22 = ptr_507BC0->ptr_1C; 14011 v22 = window_SpeakInHouse->ptr_1C;
14013 v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62); 14012 v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62);
14014 v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62); 14013 v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (signed int)v22] + v62);
14015 v24 = v16->GetControl(v60); 14014 v24 = v16->GetControl(v60);
14016 if ( v23 != v58 14015 if ( v23 != v58
14017 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23] 14016 && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23]
14025 if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) 14024 if ( pDialogueWindow->pCurrentPosActiveItem != s1 )
14026 v27 = *(const char **)v57; 14025 v27 = *(const char **)v57;
14027 v47[1] = v27; 14026 v47[1] = v27;
14028 sprintf(a1, format_4E2DC8, v27); 14027 sprintf(a1, format_4E2DC8, v27);
14029 v66 = (unsigned __int8)byte_4F09B8[v26 * 4]; 14028 v66 = (unsigned __int8)byte_4F09B8[v26 * 4];
14030 if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) 14029 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
14031 { 14030 {
14032 if ( CheckHiredNPCSpeciality(8u) ) 14031 if ( CheckHiredNPCSpeciality(8u) )
14033 v66 -= 2; 14032 v66 -= 2;
14034 if ( CheckHiredNPCSpeciality(9u) ) 14033 if ( CheckHiredNPCSpeciality(9u) )
14035 v66 -= 3; 14034 v66 -= 3;
14128 if ( dword_F8B19C > 104 && dword_F8B19C <= 108 ) 14127 if ( dword_F8B19C > 104 && dword_F8B19C <= 108 )
14129 { 14128 {
14130 if ( pParty->uNumGold < s1 ) 14129 if ( pParty->uNumGold < s1 )
14131 { 14130 {
14132 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 14131 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
14133 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 3); 14132 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3);
14134 if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) 14133 if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
14135 return; 14134 return;
14136 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 14135 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
14137 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 14136 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
14138 goto LABEL_33; 14137 goto LABEL_33;
14139 } 14138 }
14140 Party::TakeGold(s1); 14139 Party::TakeGold(s1);
14141 v47[1] = (const char *)7; 14140 v47[1] = (const char *)7;
14142 v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)ptr_507BC0->ptr_1C] + dword_F8B19C)]; 14141 v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dword_F8B19C)];
14143 if ( v5[pParty->uDaysPlayed % 7 + 1] ) 14142 if ( v5[pParty->uDaysPlayed % 7 + 1] )
14144 { 14143 {
14145 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) 14144 if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) )
14146 { 14145 {
14147 SaveGame(1, 0); 14146 SaveGame(1, 0);
14171 pParty->vPosition.y = v7; 14170 pParty->vPosition.y = v7;
14172 pParty->vPosition.z = *((int *)v5 + 5); 14171 pParty->vPosition.z = *((int *)v5 + 5);
14173 pParty->uFallStartY = pParty->vPosition.z; 14172 pParty->uFallStartY = pParty->vPosition.z;
14174 pParty->sRotationY = *((int *)v5 + 6); 14173 pParty->sRotationY = *((int *)v5 + 6);
14175 } 14174 }
14176 HousePlaySomeSound((unsigned int)ptr_507BC0->ptr_1C, 2); 14175 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
14177 v12 = (unsigned __int8)v5[8]; 14176 v12 = (unsigned __int8)v5[8];
14178 if ( (signed int)ptr_507BC0->ptr_1C >= 63 ) 14177 if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 )
14179 { 14178 {
14180 v63 = SPEECH_72; 14179 v63 = SPEECH_72;
14181 v13 = 2500; 14180 v13 = 2500;
14182 if ( CheckHiredNPCSpeciality(8u) ) 14181 if ( CheckHiredNPCSpeciality(8u) )
14183 v12 -= 2; 14182 v12 -= 2;
14866 return result; 14865 return result;
14867 } 14866 }
14868 14867
14869 14868
14870 //----- (0044606A) -------------------------------------------------------- 14869 //----- (0044606A) --------------------------------------------------------
14871 int __fastcall PrepareHouse(unsigned int uHouseID) 14870 void PrepareHouse(HOUSE_TYPE house)
14872 { 14871 {
14873 unsigned int v1; // ebx@1 14872 //unsigned int v1; // ebx@1
14874 signed int v2; // esi@1 14873 //signed int v2; // esi@1
14875 int uExitPic; // edi@1 14874 //int uExitPic; // edi@1
14876 __int16 uExitMapID; // ax@2 14875 __int16 uExitMapID; // ax@2
14877 int result; // eax@5 14876 //int result; // eax@5
14878 unsigned int *v6; // ecx@8 14877 //unsigned int *v6; // ecx@8
14879 int v7; // ebx@11 14878 int v7; // ebx@11
14880 int v8; // esi@16 14879 //int v8; // esi@16
14881 unsigned int v9; // eax@16 14880 //unsigned int v9; // eax@16
14882 unsigned int v10; // eax@19 14881 //unsigned int v10; // eax@19
14883 int v11; // ecx@19 14882 //int v11; // ecx@19
14884 char pContainer[36]; // [sp+Ch] [bp-54h]@16 14883 //char pContainer[36]; // [sp+Ch] [bp-54h]@16
14885 int v13; // [sp+30h] [bp-30h]@11 14884 int v13; // [sp+30h] [bp-30h]@11
14886 int Dst[6]; // [sp+34h] [bp-2Ch]@1 14885 int Dst[6]; // [sp+34h] [bp-2Ch]@1
14887 unsigned int v15; // [sp+4Ch] [bp-14h]@1 14886 //unsigned int v15; // [sp+4Ch] [bp-14h]@1
14888 int uAnimationID; // [sp+50h] [bp-10h]@1 14887 int uAnimationID; // [sp+50h] [bp-10h]@1
14889 unsigned int *v17; // [sp+54h] [bp-Ch]@3 14888 //unsigned int *v17; // [sp+54h] [bp-Ch]@3
14890 unsigned int v18; // [sp+58h] [bp-8h]@1 14889 //unsigned int v18; // [sp+58h] [bp-8h]@1
14891 int v19; // [sp+5Ch] [bp-4h]@7 14890 //int v19; // [sp+5Ch] [bp-4h]@7
14892 14891
14893 v15 = uHouseID; 14892 //v15 = uHouseID;
14894 v1 = 52 * uHouseID; 14893 //v1 = 52 * uHouseID;
14895 //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; 14894 //uAnimationID = p2DEvents_minus1___02[26 * uHouseID];
14896 uAnimationID = p2DEvents[uHouseID - 1].uAnimationID; 14895 uAnimationID = p2DEvents[house - 1].uAnimationID;
14897 v2 = 0; 14896 //v18 = 52 * uHouseID;
14898 v18 = 52 * uHouseID;
14899 memset(Dst, 0, 0x18u); 14897 memset(Dst, 0, 0x18u);
14900 //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); 14898 //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1);
14901 uExitPic = p2DEvents[uHouseID - 1].uExitPicID; 14899 //uExitPic = p2DEvents[uHouseID - 1].uExitPicID;
14902 uNumDialogueNPCPortraits = 0; 14900 uNumDialogueNPCPortraits = 0;
14903 uHouse_ExitPic = uExitPic; 14901 uHouse_ExitPic = p2DEvents[house - 1].uExitPicID;
14904 if ( uExitPic ) 14902 if ( uHouse_ExitPic )
14905 { 14903 {
14906 //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); 14904 //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1);
14907 uExitMapID = p2DEvents[uHouseID - 1]._quest_related; 14905 uExitMapID = p2DEvents[house - 1]._quest_related;
14908 if ( uExitMapID > 0 ) 14906 if ( uExitMapID > 0 )
14909 { 14907 {
14910 v17 = (unsigned int *)(uExitMapID - 1); 14908 //v17 = (unsigned int *)(uExitMapID - 1);
14911 if ( !((unsigned __int8)(0x80u >> (signed int)v17 % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) ) 14909 if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) )
14912 { 14910 {
14913 uExitPic = 0; 14911 //uExitPic = 0;
14914 uHouse_ExitPic = 0; 14912 uHouse_ExitPic = 0;
14915 } 14913 }
14916 } 14914 }
14917 } 14915 }
14916
14918 dword_591080 = pAnimatedRooms[uAnimationID].field_8; 14917 dword_591080 = pAnimatedRooms[uAnimationID].field_8;
14919 result = dword_591080; 14918 //result = dword_591080;
14919
14920 //v2 = 0;
14921 uNumDialogueNPCPortraits = 0;
14920 if ( dword_591080 ) 14922 if ( dword_591080 )
14921 { 14923 {
14922 v2 = 1; 14924 //v2 = 1;
14923 Dst[0] = dword_591080; 14925 Dst[0] = dword_591080;
14924 uNumDialogueNPCPortraits = 1; 14926 uNumDialogueNPCPortraits = 1;
14925 } 14927 }
14926 v19 = 1; 14928
14927 if ( (signed int)pNPCStats->uNumNewNPCs > 1 ) 14929 //v19 = 1;
14928 { 14930 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
14929 v6 = &pNPCStats->pNewNPCData[1].uFlags; 14931 {
14930 v17 = &pNPCStats->pNewNPCData[1].uFlags; 14932 auto npc = pNPCStats->pNewNPCData + i;
14931 do 14933 //v6 = &pNPCStats->pNewNPCData[1].uFlags;
14932 { 14934 //v17 = &pNPCStats->pNewNPCData[1].uFlags;
14933 if ( v6[3] == v15 ) 14935 //do
14934 { 14936 //{
14935 if ( !(*(char *)v6 & 0x80) ) 14937 if (npc->Location2D == house )
14936 { 14938 {
14937 v7 = v2++ - (result != 0); 14939 if (~npc->uFlags & 0x80)
14938 array_5913D8[v7] = (NPCData *)(v6 - 2); 14940 //if ( !(*(char *)v6 & 0x80) )
14939 v6 = v17; 14941 {
14940 *(&v13 + v2) = *(v17 - 1); 14942 v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0;
14941 v1 = v18; 14943 array_5913D8[v7] = npc;
14942 if ( (*v6 & 3) != 2 ) 14944 //v6 = v17;
14943 ++*v6; 14945 //*(&v13 + v2) = *(v17 - 1);
14944 } 14946 Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID;
14945 } 14947 //v1 = v18;
14946 ++v19; 14948 if ((npc->uFlags & 3) != 2)
14947 v6 += 19; 14949 ++npc->uFlags;
14948 v17 = v6; 14950 }
14949 } 14951 }
14950 while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); 14952 //++v19;
14951 uNumDialogueNPCPortraits = v2; 14953 //v6 += 19;
14952 } 14954 //v17 = v6;
14953 v19 = 0; 14955 //}
14954 if ( v2 > 0 ) 14956 //while ( v19 < (signed int)pNPCStats->uNumNewNPCs );
14955 { 14957 }
14956 do 14958 //uNumDialogueNPCPortraits = v2;
14957 { 14959
14958 v8 = v19; 14960 //v19 = 0;
14959 sprintf(pContainer, "npc%03u", Dst[v19]); 14961 for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
14960 v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 14962 //if ( v2 > 0 )
14961 ++v19; 14963 {
14962 pDialogueNPCPortraits[v8] = &pIcons_LOD->pTextures[v9]; 14964 //do
14963 result = v19; 14965 //{
14964 } 14966 //v8 = v19;
14965 while ( v19 < uNumDialogueNPCPortraits ); 14967 char icon_name[128];
14966 uExitPic = uHouse_ExitPic; 14968 sprintfex(icon_name, "npc%03u", Dst[i]);
14967 } 14969 //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
14968 if ( uExitPic ) 14970 //++v19;
14969 { 14971 pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE);
14970 v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uExitPic], TEXTURE_16BIT_PALETTE); 14972 //result = v19;
14971 v11 = uNumDialogueNPCPortraits++; 14973 //}
14972 pDialogueNPCPortraits[v11] = &pIcons_LOD->pTextures[v10]; 14974 //while ( v19 < uNumDialogueNPCPortraits );
14975 //uExitPic = uHouse_ExitPic;
14976 }
14977
14978 if (uHouse_ExitPic)
14979 {
14980 //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
14981 //v11 = uNumDialogueNPCPortraits++;
14982 pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE);
14973 //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); 14983 //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1);
14974 result = p2DEvents[uHouseID - 1].uExitMapID; 14984 //result = p2DEvents[house - 1].uExitMapID;
14975 uHouse_ExitPic = result; 14985 uHouse_ExitPic = p2DEvents[house - 1].uExitMapID;
14976 } 14986 }
14977 return result; 14987 //return result;
14978 } 14988 }
14979 14989
14980 14990
14981 14991
14982 14992
14983 //----- (0044622E) -------------------------------------------------------- 14993 //----- (0044622E) --------------------------------------------------------
14984 bool __fastcall EnterHouse(enum HOUSE_TYPE uHouseID) 14994 bool __fastcall EnterHouse(HOUSE_TYPE uHouseID)
14985 { 14995 {
14986 enum HOUSE_TYPE v1; // edi@1 14996 //enum HOUSE_TYPE v1; // edi@1
14987 int v2; // edi@5 14997 //int v2; // edi@5
14988 unsigned int uOpenTime; // eax@5 14998 unsigned int uOpenTime; // eax@5
14989 int uCloseTime; // esi@5 14999 int uCloseTime; // esi@5
14990 unsigned int v5; // esi@5 15000 unsigned int v5; // esi@5
14991 int v6; // edx@5 15001 int v6; // edx@5
14992 signed int v7; // ecx@10 15002 signed int v7; // ecx@10
14993 signed int v8; // eax@10 15003 signed int v8; // eax@10
14994 int v9; // esi@10 15004 int v9; // esi@10
14995 unsigned int v10; // esi@16 15005 //unsigned int v10; // esi@16
14996 int v11; // ecx@17 15006 int v11; // ecx@17
14997 unsigned int v12; // kr00_4@25 15007 unsigned int v12; // kr00_4@25
14998 Player *v13; // esi@25 15008 //Player *v13; // esi@25
14999 int v14; // eax@25 15009 int v14; // eax@25
15000 Player *v15; // esi@27 15010 //Player *v15; // esi@27
15001 signed int v16; // eax@32 15011 signed int v16; // eax@32
15002 unsigned int v17; // eax@37 15012 unsigned int v17; // eax@37
15003 signed int v18; // edi@37 15013 signed int v18; // edi@37
15004 signed int v19; // edi@41 15014 signed int v19; // edi@41
15005 unsigned int v20; // ecx@41 15015 //unsigned int v20; // ecx@41
15006 const char *v22; // [sp-4h] [bp-40h]@33 15016 const char *v22; // [sp-4h] [bp-40h]@33
15007 char pContainer[40]; // [sp+Ch] [bp-30h]@32 15017 char pContainer[40]; // [sp+Ch] [bp-30h]@32
15008 unsigned int v24; // [sp+34h] [bp-8h]@5 15018 unsigned int v24; // [sp+34h] [bp-8h]@5
15009 enum HOUSE_TYPE v25; // [sp+38h] [bp-4h]@1 15019 //enum HOUSE_TYPE v25; // [sp+38h] [bp-4h]@1
15010 15020
15011 v1 = uHouseID; 15021 //v1 = uHouseID;
15012 v25 = uHouseID; 15022 //v25 = uHouseID;
15013 GameUI_StatusBar_TimedString[0] = 0; 15023 GameUI_StatusBar_TimedString[0] = 0;
15014 pStatusBarString[0] = 0; 15024 pStatusBarString[0] = 0;
15015 ShowStatusBarString("", 2u); 15025 ShowStatusBarString("", 2u);
15016 if ( pMessageQueue_50CBD0->uNumMessages ) 15026 if ( pMessageQueue_50CBD0->uNumMessages )
15017 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 15027 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
15018 viewparams->bRedrawGameUI = 1; 15028 viewparams->bRedrawGameUI = 1;
15019 uDialogueType = 0; 15029 uDialogueType = 0;
15020 pKeyActionMap->_459ED1(3); 15030 pKeyActionMap->_459ED1(3);
15021 pKeyActionMap->ResetKeys(); 15031 pKeyActionMap->ResetKeys();
15022 if ( v1 == 600 || v1 == 601 ) 15032 if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601)
15023 { 15033 {
15024 GameOverMenu(0); 15034 GameOverMenu(0);
15025 return 0; 15035 return 0;
15026 } 15036 }
15027 v2 = 26 * v1; 15037 //v2 = 26 * v1;
15028 //uOpenTime = p2DEvents_minus1_::uOpenTime[v2]; 15038 //uOpenTime = p2DEvents_minus1_::uOpenTime[v2];
15029 uOpenTime = p2DEvents[v1 - 1].uOpenTime; 15039 uOpenTime = p2DEvents[uHouseID - 1].uOpenTime;
15030 //uCloseTime = p2DEvents_minus1_::uCloseTime[v2]; 15040 //uCloseTime = p2DEvents_minus1_::uCloseTime[v2];
15031 uCloseTime = p2DEvents[v1 - 1].uCloseTime; 15041 uCloseTime = p2DEvents[uHouseID - 1].uCloseTime;
15032 ptr_F8B1E8 = 0; 15042 ptr_F8B1E8 = 0;
15033 v24 = uOpenTime; 15043 v24 = uOpenTime;
15034 v5 = uCloseTime - 1; 15044 v5 = uCloseTime - 1;
15035 dword_F8B1E4 = 0; 15045 dword_F8B1E4 = 0;
15036 dword_F8B1F4 = 0; 15046 dword_F8B1F4 = 0;
15069 } 15079 }
15070 } 15080 }
15071 if ( pParty->uCurrentHour > v5 ) 15081 if ( pParty->uCurrentHour > v5 )
15072 goto LABEL_10; 15082 goto LABEL_10;
15073 LABEL_16: 15083 LABEL_16:
15074 v10 = v25; 15084 //v10 = uHouseID;
15075 if ( (signed int)v25 >= 53 ) 15085 if ( (signed int)uHouseID >= 53 )
15076 goto LABEL_21; 15086 goto LABEL_21;
15077 v11 = pParty->field_3C._shop_ban_times[2 * v25 + 1]; 15087 v11 = pParty->field_3C._shop_ban_times[2 * uHouseID + 1];
15078 if ( !(v11 | pParty->field_3C._shop_ban_times[2 * v25]) 15088 if ( !(v11 | pParty->field_3C._shop_ban_times[2 * uHouseID])
15079 || (signed __int64)__PAIR__(v11, pParty->field_3C._shop_ban_times[2 * v25]) <= (signed __int64)pParty->uTimePlayed ) 15089 || (signed __int64)__PAIR__(v11, pParty->field_3C._shop_ban_times[2 * uHouseID]) <= (signed __int64)pParty->uTimePlayed )
15080 { 15090 {
15081 pParty->field_3C._shop_ban_times[2 * v25] = 0; 15091 pParty->field_3C._shop_ban_times[2 * uHouseID] = 0;
15082 pParty->field_3C._shop_ban_times[2 * v10 + 1] = 0; 15092 pParty->field_3C._shop_ban_times[2 * uHouseID + 1] = 0;
15083 LABEL_21: 15093 LABEL_21:
15084 if ( !dword_597F18 ) 15094 if ( !start_event_seq_number )
15085 pAudioPlayer->StopChannels(-1, -1); 15095 pAudioPlayer->StopChannels(-1, -1);
15086 //uCurrentHouse_Animation = p2DEvents_minus1___02[v2]; 15096 //uCurrentHouse_Animation = p2DEvents_minus1___02[v2];
15087 uCurrentHouse_Animation = p2DEvents[v2 / sizeof(_2devent) - 1].uAnimationID; 15097 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
15088 dword_F8B198 = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C); 15098 dword_F8B198 = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C);
15089 if ( dword_F8B198 == 20 && pParty->uFine ) 15099 if ( dword_F8B198 == 20 && pParty->uFine ) // going 2 jail
15090 { 15100 {
15091 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; 15101 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
15092 v25 = (HOUSE_TYPE)187; 15102 //v25 = HOUSE_187;
15103 uHouseID = HOUSE_JAIL;
15093 v12 = LODWORD(pParty->uTimePlayed); 15104 v12 = LODWORD(pParty->uTimePlayed);
15094 LODWORD(pParty->uTimePlayed) += 0x7620000u; 15105 LODWORD(pParty->uTimePlayed) += 0x7620000u;
15095 v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; 15106 v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[HOUSE_186].uAnimationID].field_C);
15096 v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[186].uAnimationID].field_C);
15097 pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000; 15107 pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000;
15098 dword_F8B198 = v14; 15108 dword_F8B198 = v14;
15099 do 15109 //v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
15100 { 15110 //do
15101 v13->uTimeToRecovery = 0;
15102 memset(&v13->uTimeToRecovery, 0, 4u);
15103 ++v13;
15104 }
15105 while ( v13 <= &pParty->pPlayers[3] );
15106 ++pParty->uNumPrisonTerms; 15111 ++pParty->uNumPrisonTerms;
15107 pParty->uFine = 0; 15112 pParty->uFine = 0;
15108 v15 = pParty->pPlayers; 15113 for (uint i = 0; i < 4; ++i)
15114 {
15115 pParty->pPlayers[i].uTimeToRecovery = 0;
15116 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
15117 pParty->pPlayers[i].SetVariable(VAR_Award, 87);
15118 //v13->uTimeToRecovery = 0;
15119 //memset(&v13->uTimeToRecovery, 0, 4u);
15120 //++v13;
15121 }
15122 //while ( v13 <= &pParty->pPlayers[3] );
15123 /*v15 = pParty->pPlayers;
15109 do 15124 do
15110 { 15125 {
15111 v15->SetVariable(VAR_Award, 87);
15112 ++v15; 15126 ++v15;
15113 } 15127 }
15114 while ( v15 <= &pParty->pPlayers[3] ); 15128 while ( v15 <= &pParty->pPlayers[3] );*/
15115 v10 = v25; 15129 //v10 = v25;
15116 } 15130 }
15117 ++pIcons_LOD->uTexturePacksCount; 15131 ++pIcons_LOD->uTexturePacksCount;
15118 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 15132 if ( !pIcons_LOD->uNumPrevLoadedFiles )
15119 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 15133 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
15120 v16 = const_2(); 15134 v16 = const_2();
15133 LABEL_37: 15147 LABEL_37:
15134 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); 15148 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
15135 array_5913D8[6] = 0; 15149 array_5913D8[6] = 0;
15136 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; 15150 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17];
15137 uTextureID_507B04 = uTextureID_right_panel; 15151 uTextureID_507B04 = uTextureID_right_panel;
15138 PrepareHouse(v10); 15152 PrepareHouse(uHouseID);
15139 v18 = 1; 15153 v18 = 1;
15140 uTextureID_507B04 = uTextureID_right_panel; 15154 uTextureID_507B04 = uTextureID_right_panel;
15141 if ( uNumDialogueNPCPortraits == 1 ) 15155 if ( uNumDialogueNPCPortraits == 1 )
15142 array_5913D8[6] = (NPCData *)1; 15156 array_5913D8[6] = (NPCData *)1;
15143 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); 15157 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
15144 if ( (signed int)v10 < 139 || (signed int)v10 > 172 ) 15158 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 )
15145 { 15159 {
15146 if ( (signed int)v10 >= 54 && (signed int)v10 <= 73 && !sub_4B68EA(v10 - 54) ) 15160 if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) )
15147 goto LABEL_49; 15161 goto LABEL_49;
15148 v20 = v10; 15162 //v20 = uHouseID;
15149 } 15163 }
15150 else 15164 else
15151 { 15165 {
15152 v19 = word_4F0704[2 * v10] - 1; 15166 v19 = word_4F0704[2 * uHouseID] - 1;
15153 v20 = v10; 15167 //v20 = uHouseID;
15154 if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->field_152[v19 >> 3]) ) 15168 if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->field_152[v19 >> 3]) )
15155 { 15169 {
15156 HousePlaySomeSound(v10, 3); 15170 HousePlaySomeSound(uHouseID, 3);
15157 v18 = 1; 15171 v18 = 1;
15158 LABEL_49: 15172 LABEL_49:
15159 dword_5C35D4 = v18; 15173 dword_5C35D4 = v18;
15160 return v18; 15174 return v18;
15161 } 15175 }
15162 v18 = 1; 15176 v18 = 1;
15163 } 15177 }
15164 HousePlaySomeSound(v20, v18); 15178 HousePlaySomeSound(uHouseID, v18);
15165 goto LABEL_49; 15179 goto LABEL_49;
15166 } 15180 }
15167 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" 15181 ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!"
15168 return 0; 15182 return 0;
15169 } 15183 }