Mercurial > mm7
changeset 775:7994986603d5
Moved some subs
author | Nomad |
---|---|
date | Sat, 23 Mar 2013 21:40:30 +0200 |
parents | c319601893af |
children | 3dc4a9b13c1b b9f6dd6f1444 |
files | MM7.h UIHouses.cpp mm7_2.cpp mm7_4.cpp mm7_data.cpp |
diffstat | 5 files changed, 1453 insertions(+), 1446 deletions(-) [+] |
line wrap: on
line diff
--- a/MM7.h Sun Mar 24 00:32:13 2013 +0600 +++ b/MM7.h Sat Mar 23 21:40:30 2013 +0200 @@ -262,18 +262,3 @@ -#pragma pack(push, 1) -struct stru365_travel_info -{ - unsigned char uMapInfoID; - unsigned char pSchedule[7]; - unsigned char uTravelTime; - unsigned char field_9[3]; - int field_C; - int field_10; - int field_14; - int field_18; - unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 -}; -#pragma pack(pop) -extern stru365_travel_info array_4F09B0[]; \ No newline at end of file
--- a/UIHouses.cpp Sun Mar 24 00:32:13 2013 +0600 +++ b/UIHouses.cpp Sat Mar 23 21:40:30 2013 +0200 @@ -21,6 +21,8 @@ #include "Viewport.h" #include "Keyboard.h" #include "NPC.h" +#include "IndoorCamera.h" +#include "MapInfo.h" #include "MM7.h" #include "mm7_data.h" @@ -33,6 +35,50 @@ int in_current_building_type; // 00F8B198 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C + +#pragma pack(push, 1) +struct stru365_travel_info +{ + unsigned char uMapInfoID; + unsigned char pSchedule[7]; + unsigned char uTravelTime; + unsigned char field_9[3]; + int field_C; + int field_10; + int field_14; + int field_18; + unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 +}; +#pragma pack(pop) +stru365_travel_info array_4F09B0[25] = +{ + { 3, {1, 0, 1, 0, 1, 0, 0}, 2, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, + { 4, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFF621, 4294960523, 1153, 896, 0}, + {13, {1, 0, 1, 0, 1, 0, 0}, 2, {0, 0, 0}, 0x127A, 4294956716, 320, 1024, 0}, + { 2, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFE9C4, 11137, 1, 1024, 0}, + { 5, {1, 0, 0, 1, 0, 0, 0}, 3, {0, 0, 0}, 0x1C3B, 4294951289, 2625, 640, 0}, + { 6, {0, 0, 1, 0, 0, 1, 0}, 3, {0, 0, 0}, 0x22DB, 17191, 1, 512, 0}, + {14, {1, 0, 1, 0, 1, 0, 0}, 3, {0, 0, 0}, 0x42A3, 12331, 512, 1152, 0}, + { 5, {0, 1, 0, 0, 1, 0, 1}, 2, {0, 0, 0}, 0x1C3B, 4294951289, 2625, 640, 0}, + { 2, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFE9C4, 11137, 1, 1024, 0}, + { 3, {1, 0, 1, 0, 1, 0, 0}, 3, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, + { 4, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFF621, 4294960523, 1153, 896, 0}, + { 3, {1, 0, 1, 0, 1, 0, 1}, 3, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, + { 2, {0, 1, 0, 0, 0, 1, 0}, 5, {0, 0, 0}, 0xFFFFE9C4, 11137, 1, 1024, 0}, + { 3, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, + { 4, {0, 1, 0, 1, 0, 1, 0}, 3, {0, 0, 0}, 0xFFFFF621, 4294960523, 1153, 896, 0}, + { 5, {0, 0, 1, 0, 0, 0, 1}, 5, {0, 0, 0}, 0x1C3B, 4294951289, 2625, 640, 0}, + {13, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFF779, 4294960355, 97, 0, 0}, + {14, {1, 0, 0, 0, 1, 0, 0}, 4, {0, 0, 0}, 0x1EE9, 9476, 193, 0, 0}, + { 9, {0, 0, 0, 0, 0, 0, 1}, 7, {0, 0, 0}, 0x3D00, 6390, 193, 1536, 0x40}, + { 6, {0, 0, 1, 0, 0, 0, 0}, 6, {0, 0, 0}, 0x4AE3, 4294947574, 193, 1024, 0}, + {14, {0, 1, 0, 1, 0, 1, 0}, 3, {0, 0, 0}, 0x1EE9, 9476, 193, 0, 0}, + { 6, {1, 0, 1, 0, 0, 0, 0}, 6, {0, 0, 0}, 0x4AE3, 4294947574, 193, 1024, 0}, + {13, {1, 0, 1, 0, 1, 0, 0}, 4, {0, 0, 0}, 0xFFFFF779, 4294960355, 97, 0, 0}, + { 4, {0, 0, 0, 0, 0, 1, 0}, 6, {0, 0, 0}, 0xFFFFFD3B, 4294953209, 193, 1024, 0}, + { 3, {0, 0, 0, 0, 0, 0, 1}, 6, {0, 0, 0}, 0xFFFFD719, 13497, 193, 1536, 0}, +}; + const stru159 pAnimatedRooms[196] = //0x4E5F70 { {"", 0x4, 0x1F4, 0, 0, 0}, @@ -550,6 +596,1412 @@ + +//----- (004BCACC) -------------------------------------------------------- +void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) +{ + //unsigned int v1; // edi@1 + //signed int v2; // ebx@1 + //signed int v3; // ecx@2 + int v4; // eax@5 + signed int v5; // esi@5 + //Player *v6; // ecx@5 + //signed int v7; // edx@5 + GUIWindow *v8; // esi@10 + unsigned int v9; // eax@12 + int v10; // esi@31 + int v11; // edi@31 + int v12; // esi@32 + __int16 v13; // bp@32 + int v14; // edx@32 + GUIWindow *v15; // eax@32 + int v16; // eax@32 + int v17; // eax@33 + int v18; // eax@34 + int v19; // eax@35 + __int16 v20; // ax@37 + __int16 v21; // ax@76 + __int16 v22; // ax@107 + __int16 v23; // ax@132 + __int16 v24; // ax@163 + int v25; // esi@190 + __int16 v26; // ax@190 + char v27; // zf@190 + Player *v28; // edi@192 + int v29; // eax@204 + void *v30; // esi@208 + unsigned __int64 v31; // qax@208 + signed int v32; // edi@209 + int v33; // eax@210 + unsigned int v34; // eax@211 + Player *v35; // edi@227 + signed int v36; // esi@227 + int v37; // ecx@227 + int v38; // esi@230 + int v39; // edx@235 + int v40; // edi@243 + unsigned __int64 v41; // qax@243 + void *v42; // eax@244 + signed int v43; // edi@244 + int v44; // edx@244 + int v45; // eax@246 + unsigned int v46; // eax@247 + void *v47; // eax@250 + signed int v48; // edi@250 + int v49; // eax@252 + int v50; // eax@256 + unsigned int v51; // eax@257 + void *v52; // eax@260 + signed int v53; // edi@260 + int v54; // eax@262 + //signed int v55; // [sp+10h] [bp-10h]@1 + int v56; // [sp+14h] [bp-Ch]@31 + + //v1 = 0; + //v2 = a1; + //v55 = a1; + if ( !pDialogueWindow->pNumPresenceButton ) + return; + pRenderer->ClearZBuffer(0, 479); + //v3 = dword_F8B198; + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) + { + v8 = window_SpeakInHouse; + } + //else + if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( in_current_building_type == BildingType_Training ) + { + if ( uMessageParam == 17 ) + { + v4 = 0; + v5 = 0; + //v6 = pPlayers[uActiveCharacter]; + //v7 = pPlayers[uActiveCharacter]->uLevel; + if ( pPlayers[uActiveCharacter]->uLevel > 0 ) + { + do + v4 += v5++ + 1; + while ( v5 < pPlayers[uActiveCharacter]->uLevel ); + } + if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && + (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4) + return; + } + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); + pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr); +// LABEL_10: + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + } + //else + if ( in_current_building_type != BildingType_Training ) + { + v8 = window_SpeakInHouse; + if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) && + array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][uMessageParam - 1]].pSchedule[pParty->uDaysPlayed % 7] + || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) + { + //LABEL_9: + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); + pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr); + // LABEL_10: + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + } + else if (uActiveCharacter) + { + if ( !pPlayers[uActiveCharacter]->_4B6FF9() ) + return; + v8 = window_SpeakInHouse; + } + } + //LABEL_11: + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + if ( in_current_building_type < BildingType_19 ) + { + v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; + ShopTexture = &pIcons_LOD->pTextures[v9]; + //LABEL_13: + v8 = window_SpeakInHouse; + } + } + + //NEW + switch(in_current_building_type) + { + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + { + if ( (signed __int64)__PAIR__( + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) + { + v32 = 0; + do + { + //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); + v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; + if ( v33 ) + { + v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); + v8 = window_SpeakInHouse; + ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; + } + ++v32; + } + while ( v32 < 12 ); + } + else + { + SpellBookGenerator(); + v30 = window_SpeakInHouse->ptr_1C; + v31 = pParty->uTimePlayed + + (signed __int64)((double)(0xA8C000 + //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) + * 0.033333335); + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); + } + return; + break; + } + case 17: + { + if ( uMessageParam == 99 ) + { + v10 = (int)((char *)v8->ptr_1C - 102); + v56 = v10; + v11 = 8 * v10 + 11325428; + if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed ) + { + v13 = 0; + } + else + { + v12 = v10; + v13 = 0; + pParty->field_75A[v12] = 0; + *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + v14 = rand() % 258; + v15 = window_SpeakInHouse; + pParty->field_750[v12] = v14 + 1; + v16 = (int)((char *)v15->ptr_1C - 102); + if ( v16 ) + { + v17 = v16 - 1; + if ( v17 ) + { + v18 = v17 - 1; + if ( v18 ) + { + v19 = v18 - 1; + if ( v19 ) + { + if ( v19 == 1 ) + { + while ( 1 ) + { + v20 = pParty->field_750[v12]; + if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) + { + if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) + && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) + && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) + && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) + && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) + && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) + && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) + && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) + && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) + && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) + && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) + && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) + && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) + && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) + && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) + && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) + && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) + && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v21 = pParty->field_750[v12]; + if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) + { + if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) + && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) + && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) + && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) + && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) + && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) + && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) + && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) + && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) + && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) + && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) + && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) + && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) + && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v22 = pParty->field_750[v12]; + if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) + { + if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) + && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) + && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) + && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) + && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) + && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) + && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) + && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) + && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) + && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) + && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v23 = pParty->field_750[v12]; + if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) + { + if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) + && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) + && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) + && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) + && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) + && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) + && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) + && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) + && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) + && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) + && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) + && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) + && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) + && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v24 = pParty->field_750[v12]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + { + if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + v10 = v56; + } + v25 = v10; + v26 = pParty->field_750[v25]; + v27 = pParty->field_75A[v25] == v13; + word_F8B1A0 = pParty->field_750[v25]; + if ( v27 ) + { + //v1 = 0; + v27 = v26 == v13; + v29 = (int)pNPCTopics[351].pText; + if ( v27 ) + v29 = (int)pNPCTopics[353].pText; + dword_F8B1A4 = (char *)v29; + } + else + { + if ( v26 != v13 ) + { + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); + v28 = pParty->pPlayers; + do + { + v28->SetVariable(VAR_Award, 86); + ++v28; + } + while ( (signed int)v28 < (signed int)pParty->pHirelings ); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; + pParty->field_750[v25] = v13; + pParty->field_75A[v25] = v13; + } + //v1 = 0; + dword_F8B1A4 = pNPCTopics[352].pText; + } + } + else if ( uMessageParam == 100 ) + { + pKeyActionMap->EnterText(1, 10, v8); + } + break; + } + case 22: + { + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) + pKeyActionMap->EnterText(1, 10, v8); + return; + break; + } + case 1: + case 2: + case 3: + case 4: + case 21: + case 23: + case 30: + { + break; + } + default: + { + return; + break; + } + } + + /* + if ( in_current_building_type > BildingType_Tavern ) + { + if ( in_current_building_type == BildingType_Bank ) + { + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) + pKeyActionMap->EnterText(1, 10, v8); + return; + } + if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) + return; + } + //else + if ( in_current_building_type < BildingType_Tavern ) + { + if (in_current_building_type <= 0) + return; + if ( in_current_building_type > BildingType_AlchemistShop ) + { + if ( in_current_building_type <= BildingType_16 ) + { + if ( (signed __int64)__PAIR__( + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) + { + v32 = 0; + do + { + //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); + v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; + if ( v33 ) + { + v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); + v8 = window_SpeakInHouse; + ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; + } + ++v32; + } + while ( v32 < 12 ); + } + else + { + SpellBookGenerator(); + v30 = window_SpeakInHouse->ptr_1C; + v31 = pParty->uTimePlayed + + (signed __int64)((double)(0xA8C000 + //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) + * 0.033333335); + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); + } + return; + } + if ( in_current_building_type != BildingType_TownHall ) + return; + if ( in_current_building_type == BildingType_TownHall ) + { + if ( uMessageParam == 99 ) + { + v10 = (int)((char *)v8->ptr_1C - 102); + v56 = v10; + v11 = 8 * v10 + 11325428; + if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed ) + { + v13 = 0; + } + else + { + v12 = v10; + v13 = 0; + pParty->field_75A[v12] = 0; + *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + v14 = rand() % 258; + v15 = window_SpeakInHouse; + pParty->field_750[v12] = v14 + 1; + v16 = (int)((char *)v15->ptr_1C - 102); + if ( v16 ) + { + v17 = v16 - 1; + if ( v17 ) + { + v18 = v17 - 1; + if ( v18 ) + { + v19 = v18 - 1; + if ( v19 ) + { + if ( v19 == 1 ) + { + while ( 1 ) + { + v20 = pParty->field_750[v12]; + if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) + { + if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) + && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) + && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) + && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) + && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) + && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) + && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) + && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) + && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) + && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) + && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) + && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) + && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) + && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) + && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) + && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) + && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) + && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v21 = pParty->field_750[v12]; + if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) + { + if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) + && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) + && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) + && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) + && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) + && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) + && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) + && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) + && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) + && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) + && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) + && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) + && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) + && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v22 = pParty->field_750[v12]; + if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) + { + if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) + && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) + && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) + && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) + && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) + && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) + && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) + && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) + && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) + && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) + && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v23 = pParty->field_750[v12]; + if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) + { + if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) + && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) + && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) + && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) + && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) + && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) + && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) + && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) + && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) + && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) + && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) + && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) + && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) + && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + } + else + { + while ( 1 ) + { + v24 = pParty->field_750[v12]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + { + if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + break; + } + pParty->field_750[v12] = rand() % 258 + 1; + } + } + v10 = v56; + } + v25 = v10; + v26 = pParty->field_750[v25]; + v27 = pParty->field_75A[v25] == v13; + word_F8B1A0 = pParty->field_750[v25]; + if ( v27 ) + { + //v1 = 0; + v27 = v26 == v13; + v29 = (int)pNPCTopics[351].pText; + if ( v27 ) + v29 = (int)pNPCTopics[353].pText; + dword_F8B1A4 = (char *)v29; + } + else + { + if ( v26 != v13 ) + { + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); + v28 = pParty->pPlayers; + do + { + v28->SetVariable(VAR_Award, 86); + ++v28; + } + while ( (signed int)v28 < (signed int)pParty->pHirelings ); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; + pParty->field_750[v25] = v13; + pParty->field_75A[v25] = v13; + } + //v1 = 0; + dword_F8B1A4 = pNPCTopics[352].pText; + } + } + else if ( uMessageParam == 100 ) + { + pKeyActionMap->EnterText(1, 10, v8); + } + } + } + } + */ + + +//LABEL_196: + switch ( uMessageParam ) + { + case 96: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + FillAviableSkillsToTeach(in_current_building_type); + break; + } + case 101: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3A72(in_current_building_type); + break; + } + case 102: + case 103: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + break; + } + case 104: + { + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; + break; + } + case 2: + case 95: + { + if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + { + GenerateStandartShopItems(); + GenerateSpecialShopItems(); + v8 = window_SpeakInHouse; + v40 = window_SpeakInHouse->par1C; + //v3 = dword_F8B198; + v41 = pParty->uTimePlayed + //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) + * 0.033333335); + pParty->field_3C.field_50[v40] = v41; + } + v42 = v8->ptr_1C; + v43 = 0; + //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; + v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; + if ( uMessageParam == 2 ) + { + if ( uItemsAmountPerShopType[v44] ) + { + do + { + v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; + if ( v45 ) + { + v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; + } + v42 = v8->ptr_1C; + ++v43; + } + //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v47 = v8->ptr_1C; + v48 = 0; + //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) + { + do + { + // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) + if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID) + { + v49 = rand(); + v8 = window_SpeakInHouse; + word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); + } + v47 = v8->ptr_1C; + ++v48; + } + //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + } + } + } + if ( uMessageParam == 95 ) + { + if ( uItemsAmountPerShopType[v44] ) + { + do + { + //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; + v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; + if ( v50 ) + { + v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; + } + v42 = v8->ptr_1C; + ++v43; + } + //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v52 = v8->ptr_1C; + v53 = 0; + //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) + { + do + { + // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) + { + v54 = rand(); + v8 = window_SpeakInHouse; + word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); + } + v52 = v8->ptr_1C; + ++v53; + } + //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); + } + } + } + break; + } + case 3: + case 4: + case 5: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + break; + } + case 94: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3AD4(in_current_building_type); + break; + } + default: + { + if( uMessageParam >= 36 && uMessageParam <= 72 ) + { + v35 = pPlayers[uActiveCharacter]; + //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); + v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); + v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( v37 < v36 / 3 ) + v37 = v36 / 3; + + __debugbreak(); + //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] + + //if (false) + if(byte_4ED970_skill_learn_ability_by_class_table[v35->classType][uMessageParam-36]) + //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) + { + v38 = (int)(&v35->uIntelligence + uMessageParam); + if ( !*(short *)v38 ) + { + if ( pParty->uNumGold < v37 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) + v39 = 4; + else + v39 = 2; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); + } + else + { + Party::TakeGold(v37); + dword_F8B1E4 = 1; + *(short *)v38 = 1; + v35->PlaySound(SPEECH_78, 0); + } + } + } + } + break; + } + } + /* + if ( uMessageParam != 95 && uMessageParam != 2 ) + { + if ( uMessageParam == 3 ) + { + dialog_menu_id = 3; + } + else + { + if ( uMessageParam == 4 ) + { + dialog_menu_id = 4; + } + else + { + if ( uMessageParam != 5 ) + { + if ( uMessageParam > 35 ) + { + if ( uMessageParam <= 72 ) + { + v35 = pPlayers[uActiveCharacter]; + //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); + v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); + v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( v37 < v36 / 3 ) + v37 = v36 / 3; + + __debugbreak(); + //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] + + if (false) + //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) + { + v38 = (int)(&v35->uIntelligence + uMessageParam); + if ( !*(short *)v38 ) + { + if ( pParty->uNumGold < v37 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) + v39 = 4; + else + v39 = 2; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); + } + else + { + Party::TakeGold(v37); + dword_F8B1E4 = 1; + *(short *)v38 = 1; + v35->PlaySound(SPEECH_78, 0); + } + } + } + } + else + { + if ( uMessageParam == 94 ) + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3AD4(in_current_building_type); + } + } + } + return; + } + dialog_menu_id = 5; + } + } + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + return; + } + if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + { + GenerateStandartShopItems(); + GenerateSpecialShopItems(); + v8 = window_SpeakInHouse; + v40 = window_SpeakInHouse->par1C; + //v3 = dword_F8B198; + v41 = pParty->uTimePlayed + //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) + * 0.033333335); + pParty->field_3C.field_50[v40] = v41; + + } + v42 = v8->ptr_1C; + v43 = 0; + //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; + v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; + if ( uMessageParam == 2 ) + { + if ( uItemsAmountPerShopType[v44] ) + { + do + { + v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; + if ( v45 ) + { + v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; + } + v42 = v8->ptr_1C; + ++v43; + } + //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v47 = v8->ptr_1C; + v48 = 0; + //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) + { + do + { + // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) + if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID); + { + v49 = rand(); + v8 = window_SpeakInHouse; + word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); + } + v47 = v8->ptr_1C; + ++v48; + } + //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + } + } + } + if ( uMessageParam == 95 ) + { + if ( uItemsAmountPerShopType[v44] ) + { + do + { + //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; + v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; + if ( v50 ) + { + v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; + v8 = window_SpeakInHouse; + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; + } + v42 = v8->ptr_1C; + ++v43; + } + //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v52 = v8->ptr_1C; + v53 = 0; + //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) + { + do + { + // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) + { + v54 = rand(); + v8 = window_SpeakInHouse; + word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); + } + v52 = v8->ptr_1C; + ++v53; + } + //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); + while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); + } + } + } +*/ +} + + + +//----- (004B6943) -------------------------------------------------------- +void __cdecl TravelByTransport() +{ + GUIWindow *v0; // ebx@1 + Player *v1; // esi@1 + signed int v2; // edi@1 + unsigned int v3; // eax@1 + signed int v4; // ebx@1 + stru365_travel_info *v5; // esi@7 + int v6; // eax@9 + int v7; // eax@9 + int v8; // eax@12 + int v9; // edi@12 + int v10; // edx@12 + int v11; // ecx@12 + signed int v12; // esi@13 + signed int v13; // edi@14 + DWORD v14; // eax@26 + DWORD v15; // edi@26 + GUIWindow *v16; // ebx@36 + int v17; // esi@36 + int v18; // eax@36 + int v19; // ecx@36 + int v20; // esi@36 + int v21; // eax@36 + void *v22; // eax@39 + int v23; // esi@39 + GUIButton *v24; // ebx@39 + signed int v25; // eax@41 + //int v26; // esi@44 + const char *v27; // eax@46 + char *v28; // eax@62 + int v29; // eax@62 + unsigned int v30; // ecx@62 + char *v31; // eax@63 + MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 + /*int v33; // [sp-38h] [bp-2C8h]@62 + int v34; // [sp-34h] [bp-2C4h]@62 + int v35; // [sp-30h] [bp-2C0h]@62 + int v36; // [sp-2Ch] [bp-2BCh]@62 + int v37; // [sp-28h] [bp-2B8h]@62 + int v38; // [sp-24h] [bp-2B4h]@62 + int v39; // [sp-20h] [bp-2B0h]@62 + int v40; // [sp-1Ch] [bp-2ACh]@62 + int v41; // [sp-18h] [bp-2A8h]@62 + int v42; // [sp-14h] [bp-2A4h]@62 + char *v43; // [sp-10h] [bp-2A0h]@62 + char *v44; // [sp-Ch] [bp-29Ch]@62 + unsigned int v45; // [sp-8h] [bp-298h]@62 + char *v46; // [sp-4h] [bp-294h]@62 + const char *v47[5]; // [sp+0h] [bp-290h]@7*/ + char v48[100]; // [sp+14h] [bp-27Ch]@37 + char v49[100]; // [sp+78h] [bp-218h]@68 + char v50[100]; // [sp+DCh] [bp-1B4h]@68 + char v51[100]; // [sp+140h] [bp-150h]@68 + char Dest[100]; // [sp+1A4h] [bp-ECh]@36 + GUIWindow v53; // [sp+208h] [bp-88h]@1 + int v54; // [sp+25Ch] [bp-34h]@36 + int v55; // [sp+260h] [bp-30h]@36 + unsigned int v56; // [sp+264h] [bp-2Ch]@1 + int v57; // [sp+268h] [bp-28h]@1 + int v58; // [sp+26Ch] [bp-24h]@36 + GUIWindow *v59; // [sp+270h] [bp-20h]@1 + unsigned int v60; // [sp+274h] [bp-1Ch]@36 + //Player *v61; // [sp+278h] [bp-18h]@1 + int v62; // [sp+27Ch] [bp-14h]@36 + int v63; // [sp+280h] [bp-10h]@14 + char *a1; // [sp+284h] [bp-Ch]@37 + unsigned int s1; // [sp+288h] [bp-8h]@1 + int v66; // [sp+28Ch] [bp-4h]@48 + + v0 = window_SpeakInHouse; + memcpy(&v53, window_SpeakInHouse, sizeof(v53)); + v2 = 255; + //v61 = pPlayers[uActiveCharacter]; + v1 = pPlayers[uActiveCharacter]; + v53.uFrameX = 483; + v53.uFrameWidth = 148; + v53.uFrameZ = 334; + v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + v3 = 52 * (unsigned int)v0->ptr_1C; + //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); + v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); + //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); + v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); + s1 = v4 * (100 - v1->GetMerchant()) / 100; + if ( (signed int)s1 < v4 / 3 ) + s1 = v4 / 3; + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v16 = pDialogueWindow; + v58 = -1; + v62 = 0; + v17 = LOBYTE(pFontArrus->uFontHeight) - 3; + v59 = pDialogueWindow; + v54 = v17; + strcpy(Dest, ""); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold + v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); + v19 = v16->pNumPresenceButton; + v20 = v18 + v17 + 146; + v21 = v16->pStartingPosActiveItem; + v63 = v20; + v55 = v20; + v60 = v21; + if ( v21 >= v21 + v19 ) + goto LABEL_71; + s1 = 2; + a1 = v48; + while ( 1 ) + { + int v47 = v60; + v22 = window_SpeakInHouse->ptr_1C; + v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; + //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 + //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land + v24 = v16->GetControl(v60); + if ( v23 != v58 + && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]), + v25 + && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) ) + { + v58 = v23; + v27 = (const char *)v56; + if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) + v27 = (const char *)v57; + //v32.uRedbookTrackID = v27; + sprintf(a1, "\f%05d", v27); + v66 = array_4F09B0[v23].uTravelTime; + if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) + { + if ( CheckHiredNPCSpeciality(Sailor) ) + v66 -= 2; + if ( CheckHiredNPCSpeciality(Navigator) ) + v66 -= 3; + //v47 = Pirate; + if ( CheckHiredNPCSpeciality(Pirate) ) + v66 -= 2; + } + else + { + //v47 = Horseman; + if ( CheckHiredNPCSpeciality(Horseman) ) + v66 -= 2; + } + if ( CheckHiredNPCSpeciality(Explorer) ) + --v66; + if ( v66 < 1 ) + v66 = 1; + if ( v23 != v2 ) + { + memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s + v66, v32.pName); + strcat(a1, pTmpBuf); + v28 = a1; + a1 += 100; + ++v62; + ++s1; + strcat(v28, "\n \n"); + v24->uY = v63; + v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0); + v30 = v24->uY; + v24->uHeight = v29; + v2 = 255; + v24->uW = v30 + v29 - 1; + v63 += v54 + v29; + } + } + else + { + v31 = a1; + ++v62; + ++s1; + a1 += 100; + strcpy(v31, ""); + if ( v24 ) + { + v24->uW = 0; + v24->uHeight = 0; + v24->uY = 0; + } + } + ++v60; + if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem ) + break; + v16 = v59; + } + if ( v63 != v55 ) + { + /*v47[1] = &Dest; + v47[0] = &v51; + v46 = &v50; + v45 = (unsigned int)&v49; + v44 = &v48; + v43 = pTmpBuf2;*/ + sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest); + v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + } + else + { +LABEL_71: + v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, + v57, pGlobalTXT_LocalizationStrings[561], 3); + pAudioPlayer->StopChannels(-1, -1); + } + } + } + else + { + if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 ) + { + if ( pParty->uNumGold < s1 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) + return; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + goto LABEL_33;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + } + Party::TakeGold(s1); + //v47[1] = (const char *)7; + v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]]; + if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) + { + if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) + { + SaveGame(1, 0); + strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); + v8 = v5->field_18; + v9 = v5->field_14; + v10 = v5->field_10; + dword_6BE364_game_settings_1 |= 1u; + _5B65B8_npcdata_hiword_house_or_other = 0; + dword_5B65BC = 0; + _5B65B4_npcdata_loword_house_or_other = v8; + v11 = *((int *)v5 + 3); + uGameState = 2; + _5B65A8_npcdata_uflags_or_other = v11; + _5B65AC_npcdata_fame_or_other = v10; + _5B65B0_npcdata_rep_or_other = v9; + dword_5B65C0 = v11 | v10 | v9 | v8; + } + else + { + v6 = v5->field_C; + pParty->sRotationX = 0; + pParty->vPosition.x = v6; + v7 = v5->field_10; + pIndoorCamera->sRotationY = 0; + pParty->uFlags |= 2u; + pParty->vPosition.y = v7; + pParty->vPosition.z = v5->field_14; + pParty->uFallStartY = pParty->vPosition.z; + pParty->sRotationY = v5->field_18; + } + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + v12 = v5->uTravelTime; + int _v47; + if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) + { + v63 = SPEECH_SetSail; + v13 = 2500; + if ( CheckHiredNPCSpeciality(Sailor) ) + v12 -= 2; + if ( CheckHiredNPCSpeciality(Navigator) ) + v12 -= 3; + //_v47 = 45; + if ( CheckHiredNPCSpeciality(Pirate) ) + v12 -= 2; + } + else + { + v63 = SPEECH_CarriageReady; + v13 = 1500; + //_v47 = 35; + if ( CheckHiredNPCSpeciality(Horseman) ) + v12 -= 2; + } + if ( CheckHiredNPCSpeciality(Explorer) ) + --v12; + if ( v12 < 1 ) + v12 = 1; + RestAndHeal(1440 * v12); + v1->PlaySound((PlayerSpeech)v63, 0); + v14 = GetTickCount(); + v15 = v14 + v13; + if ( v15 < v14 ) + v15 = v14; + while ( GetTickCount() < v15 ) + sqrt(3.1415926); + while ( sub_4BD8B5() ) + ; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; +LABEL_33: + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + return; + }*/ + } + else + { + dialog_menu_id = HOUSE_DIALOGUE_MAIN; + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + } + } + } +} + + + + + + //----- (004B68EA) -------------------------------------------------------- bool __fastcall IsTravelAvailable(int a1) {
--- a/mm7_2.cpp Sun Mar 24 00:32:13 2013 +0600 +++ b/mm7_2.cpp Sat Mar 23 21:40:30 2013 +0200 @@ -822,1084 +822,6 @@ pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); } -//----- (004BCACC) -------------------------------------------------------- -void __fastcall OnSelectShopDialogueOption(signed int uMessageParam) -{ - //unsigned int v1; // edi@1 - //signed int v2; // ebx@1 - //signed int v3; // ecx@2 - int v4; // eax@5 - signed int v5; // esi@5 - //Player *v6; // ecx@5 - //signed int v7; // edx@5 - GUIWindow *v8; // esi@10 - unsigned int v9; // eax@12 - int v10; // esi@31 - int v11; // edi@31 - int v12; // esi@32 - __int16 v13; // bp@32 - int v14; // edx@32 - GUIWindow *v15; // eax@32 - int v16; // eax@32 - int v17; // eax@33 - int v18; // eax@34 - int v19; // eax@35 - __int16 v20; // ax@37 - __int16 v21; // ax@76 - __int16 v22; // ax@107 - __int16 v23; // ax@132 - __int16 v24; // ax@163 - int v25; // esi@190 - __int16 v26; // ax@190 - char v27; // zf@190 - Player *v28; // edi@192 - int v29; // eax@204 - void *v30; // esi@208 - unsigned __int64 v31; // qax@208 - signed int v32; // edi@209 - int v33; // eax@210 - unsigned int v34; // eax@211 - Player *v35; // edi@227 - signed int v36; // esi@227 - int v37; // ecx@227 - int v38; // esi@230 - int v39; // edx@235 - int v40; // edi@243 - unsigned __int64 v41; // qax@243 - void *v42; // eax@244 - signed int v43; // edi@244 - int v44; // edx@244 - int v45; // eax@246 - unsigned int v46; // eax@247 - void *v47; // eax@250 - signed int v48; // edi@250 - int v49; // eax@252 - int v50; // eax@256 - unsigned int v51; // eax@257 - void *v52; // eax@260 - signed int v53; // edi@260 - int v54; // eax@262 - //signed int v55; // [sp+10h] [bp-10h]@1 - int v56; // [sp+14h] [bp-Ch]@31 - - //v1 = 0; - //v2 = a1; - //v55 = a1; - if ( !pDialogueWindow->pNumPresenceButton ) - return; - pRenderer->ClearZBuffer(0, 479); - //v3 = dword_F8B198; - if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) - { - v8 = window_SpeakInHouse; - } - //else - if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( in_current_building_type == BildingType_Training ) - { - if ( uMessageParam == 17 ) - { - v4 = 0; - v5 = 0; - //v6 = pPlayers[uActiveCharacter]; - //v7 = pPlayers[uActiveCharacter]->uLevel; - if ( pPlayers[uActiveCharacter]->uLevel > 0 ) - { - do - v4 += v5++ + 1; - while ( v5 < pPlayers[uActiveCharacter]->uLevel ); - } - if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && - (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4) - return; - } - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr); -// LABEL_10: - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - } - //else - if ( in_current_building_type != BildingType_Training ) - { - v8 = window_SpeakInHouse; - if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) && - array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][uMessageParam - 1]].pSchedule[pParty->uDaysPlayed % 7] - || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) - { - //LABEL_9: - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", nullptr); - // LABEL_10: - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - } - else if (uActiveCharacter) - { - if ( !pPlayers[uActiveCharacter]->_4B6FF9() ) - return; - v8 = window_SpeakInHouse; - } - } - //LABEL_11: - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - if ( in_current_building_type < BildingType_19 ) - { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - ShopTexture = &pIcons_LOD->pTextures[v9]; - //LABEL_13: - v8 = window_SpeakInHouse; - } - } - - //NEW - switch(in_current_building_type) - { - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - { - if ( (signed __int64)__PAIR__( - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) - { - v32 = 0; - do - { - //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); - v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; - if ( v33 ) - { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); - v8 = window_SpeakInHouse; - ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; - } - ++v32; - } - while ( v32 < 12 ); - } - else - { - SpellBookGenerator(); - v30 = window_SpeakInHouse->ptr_1C; - v31 = pParty->uTimePlayed - + (signed __int64)((double)(0xA8C000 - //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); - } - return; - break; - } - case 17: - { - if ( uMessageParam == 99 ) - { - v10 = (int)((char *)v8->ptr_1C - 102); - v56 = v10; - v11 = 8 * v10 + 11325428; - if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed ) - { - v13 = 0; - } - else - { - v12 = v10; - v13 = 0; - pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - v14 = rand() % 258; - v15 = window_SpeakInHouse; - pParty->field_750[v12] = v14 + 1; - v16 = (int)((char *)v15->ptr_1C - 102); - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) - { - v18 = v17 - 1; - if ( v18 ) - { - v19 = v18 - 1; - if ( v19 ) - { - if ( v19 == 1 ) - { - while ( 1 ) - { - v20 = pParty->field_750[v12]; - if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) - { - if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) - && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) - && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) - && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) - && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) - && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) - && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) - && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) - && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) - && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) - && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) - && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) - && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) - && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) - && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) - && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) - && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) - && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v21 = pParty->field_750[v12]; - if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) - { - if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) - && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) - && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) - && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) - && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) - && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) - && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) - && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) - && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) - && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) - && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) - && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) - && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) - && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v22 = pParty->field_750[v12]; - if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) - { - if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) - && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) - && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) - && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) - && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) - && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) - && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) - && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) - && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) - && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) - && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v23 = pParty->field_750[v12]; - if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) - { - if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) - && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) - && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) - && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) - && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) - && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) - && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) - && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) - && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) - && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) - && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) - && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) - && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) - && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v24 = pParty->field_750[v12]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) - { - if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - v10 = v56; - } - v25 = v10; - v26 = pParty->field_750[v25]; - v27 = pParty->field_75A[v25] == v13; - word_F8B1A0 = pParty->field_750[v25]; - if ( v27 ) - { - //v1 = 0; - v27 = v26 == v13; - v29 = (int)pNPCTopics[351].pText; - if ( v27 ) - v29 = (int)pNPCTopics[353].pText; - dword_F8B1A4 = (char *)v29; - } - else - { - if ( v26 != v13 ) - { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); - v28 = pParty->pPlayers; - do - { - v28->SetVariable(VAR_Award, 86); - ++v28; - } - while ( (signed int)v28 < (signed int)pParty->pHirelings ); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; - pParty->field_750[v25] = v13; - pParty->field_75A[v25] = v13; - } - //v1 = 0; - dword_F8B1A4 = pNPCTopics[352].pText; - } - } - else if ( uMessageParam == 100 ) - { - pKeyActionMap->EnterText(1, 10, v8); - } - break; - } - case 22: - { - if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, v8); - return; - break; - } - case 1: - case 2: - case 3: - case 4: - case 21: - case 23: - case 30: - { - break; - } - default: - { - return; - break; - } - } - - /* - if ( in_current_building_type > BildingType_Tavern ) - { - if ( in_current_building_type == BildingType_Bank ) - { - if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, v8); - return; - } - if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) - return; - } - //else - if ( in_current_building_type < BildingType_Tavern ) - { - if (in_current_building_type <= 0) - return; - if ( in_current_building_type > BildingType_AlchemistShop ) - { - if ( in_current_building_type <= BildingType_16 ) - { - if ( (signed __int64)__PAIR__( - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) - { - v32 = 0; - do - { - //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); - v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; - if ( v33 ) - { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); - v8 = window_SpeakInHouse; - ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; - } - ++v32; - } - while ( v32 < 12 ); - } - else - { - SpellBookGenerator(); - v30 = window_SpeakInHouse->ptr_1C; - v31 = pParty->uTimePlayed - + (signed __int64)((double)(0xA8C000 - //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); - } - return; - } - if ( in_current_building_type != BildingType_TownHall ) - return; - if ( in_current_building_type == BildingType_TownHall ) - { - if ( uMessageParam == 99 ) - { - v10 = (int)((char *)v8->ptr_1C - 102); - v56 = v10; - v11 = 8 * v10 + 11325428; - if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v10 + 1], pParty->field_3C.field_0[2 * v10]) >= (signed __int64)pParty->uTimePlayed ) - { - v13 = 0; - } - else - { - v12 = v10; - v13 = 0; - pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - v14 = rand() % 258; - v15 = window_SpeakInHouse; - pParty->field_750[v12] = v14 + 1; - v16 = (int)((char *)v15->ptr_1C - 102); - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) - { - v18 = v17 - 1; - if ( v18 ) - { - v19 = v18 - 1; - if ( v19 ) - { - if ( v19 == 1 ) - { - while ( 1 ) - { - v20 = pParty->field_750[v12]; - if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) - { - if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) - && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) - && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) - && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) - && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) - && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) - && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) - && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) - && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) - && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) - && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) - && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) - && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) - && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) - && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) - && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) - && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) - && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v21 = pParty->field_750[v12]; - if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) - { - if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) - && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) - && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) - && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) - && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) - && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) - && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) - && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) - && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) - && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) - && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) - && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) - && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) - && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v22 = pParty->field_750[v12]; - if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) - { - if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) - && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) - && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) - && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) - && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) - && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) - && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) - && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) - && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) - && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) - && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v23 = pParty->field_750[v12]; - if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) - { - if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) - && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) - && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) - && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) - && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) - && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) - && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) - && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) - && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) - && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) - && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) - && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) - && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) - && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else - { - while ( 1 ) - { - v24 = pParty->field_750[v12]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) - { - if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - v10 = v56; - } - v25 = v10; - v26 = pParty->field_750[v25]; - v27 = pParty->field_75A[v25] == v13; - word_F8B1A0 = pParty->field_750[v25]; - if ( v27 ) - { - //v1 = 0; - v27 = v26 == v13; - v29 = (int)pNPCTopics[351].pText; - if ( v27 ) - v29 = (int)pNPCTopics[353].pText; - dword_F8B1A4 = (char *)v29; - } - else - { - if ( v26 != v13 ) - { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); - v28 = pParty->pPlayers; - do - { - v28->SetVariable(VAR_Award, 86); - ++v28; - } - while ( (signed int)v28 < (signed int)pParty->pHirelings ); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; - pParty->field_750[v25] = v13; - pParty->field_75A[v25] = v13; - } - //v1 = 0; - dword_F8B1A4 = pNPCTopics[352].pText; - } - } - else if ( uMessageParam == 100 ) - { - pKeyActionMap->EnterText(1, 10, v8); - } - } - } - } - */ - - -//LABEL_196: - switch ( uMessageParam ) - { - case 96: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - FillAviableSkillsToTeach(in_current_building_type); - break; - } - case 101: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3A72(in_current_building_type); - break; - } - case 102: - case 103: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - break; - } - case 104: - { - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; - break; - } - case 2: - case 95: - { - if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) - { - GenerateStandartShopItems(); - GenerateSpecialShopItems(); - v8 = window_SpeakInHouse; - v40 = window_SpeakInHouse->par1C; - //v3 = dword_F8B198; - v41 = pParty->uTimePlayed - //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - pParty->field_3C.field_50[v40] = v41; - } - v42 = v8->ptr_1C; - v43 = 0; - //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; - v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( uMessageParam == 2 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; - if ( v45 ) - { - v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v47 = v8->ptr_1C; - v48 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) - if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID) - { - v49 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); - } - v47 = v8->ptr_1C; - ++v48; - } - //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - } - } - if ( uMessageParam == 95 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; - if ( v50 ) - { - v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v52 = v8->ptr_1C; - v53 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) - { - v54 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); - } - v52 = v8->ptr_1C; - ++v53; - } - //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); - } - } - } - break; - } - case 3: - case 4: - case 5: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - break; - } - case 94: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3AD4(in_current_building_type); - break; - } - default: - { - if( uMessageParam >= 36 && uMessageParam <= 72 ) - { - v35 = pPlayers[uActiveCharacter]; - //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); - v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); - v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v37 < v36 / 3 ) - v37 = v36 / 3; - - __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - - //if (false) - if(byte_4ED970_skill_learn_ability_by_class_table[v35->classType][uMessageParam-36]) - //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) - { - v38 = (int)(&v35->uIntelligence + uMessageParam); - if ( !*(short *)v38 ) - { - if ( pParty->uNumGold < v37 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) - v39 = 4; - else - v39 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); - } - else - { - Party::TakeGold(v37); - dword_F8B1E4 = 1; - *(short *)v38 = 1; - v35->PlaySound(SPEECH_78, 0); - } - } - } - } - break; - } - } - /* - if ( uMessageParam != 95 && uMessageParam != 2 ) - { - if ( uMessageParam == 3 ) - { - dialog_menu_id = 3; - } - else - { - if ( uMessageParam == 4 ) - { - dialog_menu_id = 4; - } - else - { - if ( uMessageParam != 5 ) - { - if ( uMessageParam > 35 ) - { - if ( uMessageParam <= 72 ) - { - v35 = pPlayers[uActiveCharacter]; - //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); - v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); - v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v37 < v36 / 3 ) - v37 = v36 / 3; - - __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36] - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - - if (false) - //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) - { - v38 = (int)(&v35->uIntelligence + uMessageParam); - if ( !*(short *)v38 ) - { - if ( pParty->uNumGold < v37 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) - v39 = 4; - else - v39 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); - } - else - { - Party::TakeGold(v37); - dword_F8B1E4 = 1; - *(short *)v38 = 1; - v35->PlaySound(SPEECH_78, 0); - } - } - } - } - else - { - if ( uMessageParam == 94 ) - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3AD4(in_current_building_type); - } - } - } - return; - } - dialog_menu_id = 5; - } - } - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - return; - } - if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) - { - GenerateStandartShopItems(); - GenerateSpecialShopItems(); - v8 = window_SpeakInHouse; - v40 = window_SpeakInHouse->par1C; - //v3 = dword_F8B198; - v41 = pParty->uTimePlayed - //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - pParty->field_3C.field_50[v40] = v41; - - } - v42 = v8->ptr_1C; - v43 = 0; - //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; - v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( uMessageParam == 2 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; - if ( v45 ) - { - v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v47 = v8->ptr_1C; - v48 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) - if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID); - { - v49 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); - } - v47 = v8->ptr_1C; - ++v48; - } - //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - } - } - if ( uMessageParam == 95 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; - if ( v50 ) - { - v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v52 = v8->ptr_1C; - v53 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) - { - v54 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); - } - v52 = v8->ptr_1C; - ++v53; - } - //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); - } - } - } -*/ -} //----- (004BD8B5) -------------------------------------------------------- signed int __cdecl sub_4BD8B5()
--- a/mm7_4.cpp Sun Mar 24 00:32:13 2013 +0600 +++ b/mm7_4.cpp Sat Mar 23 21:40:30 2013 +0200 @@ -8658,327 +8658,6 @@ -//----- (004B6943) -------------------------------------------------------- -void __cdecl TravelByTransport() -{ - GUIWindow *v0; // ebx@1 - Player *v1; // esi@1 - signed int v2; // edi@1 - unsigned int v3; // eax@1 - signed int v4; // ebx@1 - stru365_travel_info *v5; // esi@7 - int v6; // eax@9 - int v7; // eax@9 - int v8; // eax@12 - int v9; // edi@12 - int v10; // edx@12 - int v11; // ecx@12 - signed int v12; // esi@13 - signed int v13; // edi@14 - DWORD v14; // eax@26 - DWORD v15; // edi@26 - GUIWindow *v16; // ebx@36 - int v17; // esi@36 - int v18; // eax@36 - int v19; // ecx@36 - int v20; // esi@36 - int v21; // eax@36 - void *v22; // eax@39 - int v23; // esi@39 - GUIButton *v24; // ebx@39 - signed int v25; // eax@41 - //int v26; // esi@44 - const char *v27; // eax@46 - char *v28; // eax@62 - int v29; // eax@62 - unsigned int v30; // ecx@62 - char *v31; // eax@63 - MapInfo v32; // [sp-3Ch] [bp-2CCh]@62 - /*int v33; // [sp-38h] [bp-2C8h]@62 - int v34; // [sp-34h] [bp-2C4h]@62 - int v35; // [sp-30h] [bp-2C0h]@62 - int v36; // [sp-2Ch] [bp-2BCh]@62 - int v37; // [sp-28h] [bp-2B8h]@62 - int v38; // [sp-24h] [bp-2B4h]@62 - int v39; // [sp-20h] [bp-2B0h]@62 - int v40; // [sp-1Ch] [bp-2ACh]@62 - int v41; // [sp-18h] [bp-2A8h]@62 - int v42; // [sp-14h] [bp-2A4h]@62 - char *v43; // [sp-10h] [bp-2A0h]@62 - char *v44; // [sp-Ch] [bp-29Ch]@62 - unsigned int v45; // [sp-8h] [bp-298h]@62 - char *v46; // [sp-4h] [bp-294h]@62 - const char *v47[5]; // [sp+0h] [bp-290h]@7*/ - char v48[100]; // [sp+14h] [bp-27Ch]@37 - char v49[100]; // [sp+78h] [bp-218h]@68 - char v50[100]; // [sp+DCh] [bp-1B4h]@68 - char v51[100]; // [sp+140h] [bp-150h]@68 - char Dest[100]; // [sp+1A4h] [bp-ECh]@36 - GUIWindow v53; // [sp+208h] [bp-88h]@1 - int v54; // [sp+25Ch] [bp-34h]@36 - int v55; // [sp+260h] [bp-30h]@36 - unsigned int v56; // [sp+264h] [bp-2Ch]@1 - int v57; // [sp+268h] [bp-28h]@1 - int v58; // [sp+26Ch] [bp-24h]@36 - GUIWindow *v59; // [sp+270h] [bp-20h]@1 - unsigned int v60; // [sp+274h] [bp-1Ch]@36 - //Player *v61; // [sp+278h] [bp-18h]@1 - int v62; // [sp+27Ch] [bp-14h]@36 - int v63; // [sp+280h] [bp-10h]@14 - char *a1; // [sp+284h] [bp-Ch]@37 - unsigned int s1; // [sp+288h] [bp-8h]@1 - int v66; // [sp+28Ch] [bp-4h]@48 - - v0 = window_SpeakInHouse; - memcpy(&v53, window_SpeakInHouse, sizeof(v53)); - v2 = 255; - //v61 = pPlayers[uActiveCharacter]; - v1 = pPlayers[uActiveCharacter]; - v53.uFrameX = 483; - v53.uFrameWidth = 148; - v53.uFrameZ = 334; - v57 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v56 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v3 = 52 * (unsigned int)v0->ptr_1C; - //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); - v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 27) - 1) & 0xFFFFFFE7) + 50); - //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); - v4 = (signed __int64)((double)(signed int)v59 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); - s1 = v4 * (100 - v1->GetMerchant()) / 100; - if ( (signed int)s1 < v4 / 3 ) - s1 = v4 / 3; - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v16 = pDialogueWindow; - v58 = -1; - v62 = 0; - v17 = LOBYTE(pFontArrus->uFontHeight) - 3; - v59 = pDialogueWindow; - v54 = v17; - strcpy(Dest, ""); - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[405], s1); // Price: %lu gold - v18 = pFontArrus->CalcTextHeight(pTmpBuf2, &v53, 0, 0); - v19 = v16->pNumPresenceButton; - v20 = v18 + v17 + 146; - v21 = v16->pStartingPosActiveItem; - v63 = v20; - v55 = v20; - v60 = v21; - if ( v21 >= v21 + v19 ) - goto LABEL_71; - s1 = 2; - a1 = v48; - while ( 1 ) - { - int v47 = v60; - v22 = window_SpeakInHouse->ptr_1C; - v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; - //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 - //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land - v24 = v16->GetControl(v60); - if ( v23 != v58 - && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]), - v25 - && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) ) - { - v58 = v23; - v27 = (const char *)v56; - if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) - v27 = (const char *)v57; - //v32.uRedbookTrackID = v27; - sprintf(a1, "\f%05d", v27); - v66 = array_4F09B0[v23].uTravelTime; - if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) - { - if ( CheckHiredNPCSpeciality(Sailor) ) - v66 -= 2; - if ( CheckHiredNPCSpeciality(Navigator) ) - v66 -= 3; - //v47 = Pirate; - if ( CheckHiredNPCSpeciality(Pirate) ) - v66 -= 2; - } - else - { - //v47 = Horseman; - if ( CheckHiredNPCSpeciality(Horseman) ) - v66 -= 2; - } - if ( CheckHiredNPCSpeciality(Explorer) ) - --v66; - if ( v66 < 1 ) - v66 = 1; - if ( v23 != v2 ) - { - memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u); - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s - v66, v32.pName); - strcat(a1, pTmpBuf); - v28 = a1; - a1 += 100; - ++v62; - ++s1; - strcat(v28, "\n \n"); - v24->uY = v63; - v29 = pFontArrus->CalcTextHeight(pTmpBuf, &v53, 0, 0); - v30 = v24->uY; - v24->uHeight = v29; - v2 = 255; - v24->uW = v30 + v29 - 1; - v63 += v54 + v29; - } - } - else - { - v31 = a1; - ++v62; - ++s1; - a1 += 100; - strcpy(v31, ""); - if ( v24 ) - { - v24->uW = 0; - v24->uHeight = 0; - v24->uY = 0; - } - } - ++v60; - if ( (signed int)v60 >= v59->pNumPresenceButton + v59->pStartingPosActiveItem ) - break; - v16 = v59; - } - if ( v63 != v55 ) - { - /*v47[1] = &Dest; - v47[0] = &v51; - v46 = &v50; - v45 = (unsigned int)&v49; - v44 = &v48; - v43 = pTmpBuf2;*/ - sprintf(pTmpBuf, "%s\n \n%s%s%s%s%s", pTmpBuf2, v48, v49, v50, v51, Dest); - v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - } - else - { -LABEL_71: - v53.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[561], &v53, 0, 0)) / 2 + 138, - v57, pGlobalTXT_LocalizationStrings[561], 3); - pAudioPlayer->StopChannels(-1, -1); - } - } - } - else - { - if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 ) - { - if ( pParty->uNumGold < s1 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) - return; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - goto LABEL_33;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - } - Party::TakeGold(s1); - //v47[1] = (const char *)7; - v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]]; - if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) - { - if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) - { - SaveGame(1, 0); - strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); - v8 = v5->field_18; - v9 = v5->field_14; - v10 = v5->field_10; - dword_6BE364_game_settings_1 |= 1u; - _5B65B8_npcdata_hiword_house_or_other = 0; - dword_5B65BC = 0; - _5B65B4_npcdata_loword_house_or_other = v8; - v11 = *((int *)v5 + 3); - uGameState = 2; - _5B65A8_npcdata_uflags_or_other = v11; - _5B65AC_npcdata_fame_or_other = v10; - _5B65B0_npcdata_rep_or_other = v9; - dword_5B65C0 = v11 | v10 | v9 | v8; - } - else - { - v6 = v5->field_C; - pParty->sRotationX = 0; - pParty->vPosition.x = v6; - v7 = v5->field_10; - pIndoorCamera->sRotationY = 0; - pParty->uFlags |= 2u; - pParty->vPosition.y = v7; - pParty->vPosition.z = v5->field_14; - pParty->uFallStartY = pParty->vPosition.z; - pParty->sRotationY = v5->field_18; - } - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - v12 = v5->uTravelTime; - int _v47; - if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) - { - v63 = SPEECH_SetSail; - v13 = 2500; - if ( CheckHiredNPCSpeciality(Sailor) ) - v12 -= 2; - if ( CheckHiredNPCSpeciality(Navigator) ) - v12 -= 3; - //_v47 = 45; - if ( CheckHiredNPCSpeciality(Pirate) ) - v12 -= 2; - } - else - { - v63 = SPEECH_CarriageReady; - v13 = 1500; - //_v47 = 35; - if ( CheckHiredNPCSpeciality(Horseman) ) - v12 -= 2; - } - if ( CheckHiredNPCSpeciality(Explorer) ) - --v12; - if ( v12 < 1 ) - v12 = 1; - RestAndHeal(1440 * v12); - v1->PlaySound((PlayerSpeech)v63, 0); - v14 = GetTickCount(); - v15 = v14 + v13; - if ( v15 < v14 ) - v15 = v14; - while ( GetTickCount() < v15 ) - sqrt(3.1415926); - while ( sub_4BD8B5() ) - ; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; -LABEL_33: - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - return; - }*/ - } - else - { - dialog_menu_id = HOUSE_DIALOGUE_MAIN; - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - } - } - } -} - - - //----- (00405CFF) --------------------------------------------------------
--- a/mm7_data.cpp Sun Mar 24 00:32:13 2013 +0600 +++ b/mm7_data.cpp Sat Mar 23 21:40:30 2013 +0200 @@ -1496,38 +1496,7 @@ int price_for_membership[11]={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak -stru365_travel_info array_4F09B0[25] = -{ - {3, {1, 0, 1, 0, 1, 0, 0}, 2, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, - {4, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFF621, 4294960523, 1153, 896, 0}, - {0xD, {1, 0, 1, 0, 1, 0, 0}, 2, {0, 0, 0}, 0x127A, 4294956716, 320, 1024, 0}, - {2, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFE9C4, 11137, 1, 1024, 0}, - {5, {1, 0, 0, 1, 0, 0, 0}, 3, {0, 0, 0}, 0x1C3B, 4294951289, 2625, 640, 0}, - {6, {0, 0, 1, 0, 0, 1, 0}, 3, {0, 0, 0}, 0x22DB, 17191, 1, 512, 0}, - {0xE, {1, 0, 1, 0, 1, 0, 0}, 3, {0, 0, 0}, 0x42A3, 12331, 512, 1152, 0}, - {5, {0, 1, 0, 0, 1, 0, 1}, 2, {0, 0, 0}, 0x1C3B, 4294951289, 2625, 640, 0}, - {2, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFE9C4, 11137, 1, 1024, 0}, - {3, {1, 0, 1, 0, 1, 0, 0}, 3, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, - {4, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFF621, 4294960523, 1153, 896, 0}, - {3, {1, 0, 1, 0, 1, 0, 1}, 3, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, - {2, {0, 1, 0, 0, 0, 1, 0}, 5, {0, 0, 0}, 0xFFFFE9C4, 11137, 1, 1024, 0}, - {3, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0}, - {4, {0, 1, 0, 1, 0, 1, 0}, 3, {0, 0, 0}, 0xFFFFF621, 4294960523, 1153, 896, 0}, - {5, {0, 0, 1, 0, 0, 0, 1}, 5, {0, 0, 0}, 0x1C3B, 4294951289, 2625, 640, 0}, - {0xD, {0, 1, 0, 1, 0, 1, 0}, 2, {0, 0, 0}, 0xFFFFF779, 4294960355, 97, 0, 0}, - {0xE, {1, 0, 0, 0, 1, 0, 0}, 4, {0, 0, 0}, 0x1EE9, 9476, 193, 0, 0}, - {9, {0, 0, 0, 0, 0, 0, 1}, 7, {0, 0, 0}, 0x3D00, 6390, 193, 1536, 0x40}, - {6, {0, 0, 1, 0, 0, 0, 0}, 6, {0, 0, 0}, 0x4AE3, 4294947574, 193, 1024, 0}, - {0xE, {0, 1, 0, 1, 0, 1, 0}, 3, {0, 0, 0}, 0x1EE9, 9476, 193, 0, 0}, - {6, {1, 0, 1, 0, 0, 0, 0}, 6, {0, 0, 0}, 0x4AE3, 4294947574, 193, 1024, 0}, - {0xD, {1, 0, 1, 0, 1, 0, 0}, 4, {0, 0, 0}, 0xFFFFF779, 4294960355, 97, 0, 0}, - {4, {0, 0, 0, 0, 0, 1, 0}, 6, {0, 0, 0}, 0xFFFFFD3B, 4294953209, 193, 1024, 0}, - {3, {0, 0, 0, 0, 0, 0, 1}, 6, {0, 0, 0}, 0xFFFFD719, 13497, 193, 1536, 0}, -}; -//char byte_4F09B0[777]; // weak -//char byte_4F09B1[777]; // weak -//char byte_4F09B8[777]; // weak -//int dword_4F09CC[192]; + unsigned char byte_4F0CD0[30][4] = {