Mercurial > mm7
changeset 1530:dec48a151390
Слияние
author | Ritor1 |
---|---|
date | Fri, 06 Sep 2013 16:42:32 +0600 |
parents | 61458df2cb4f (diff) 270627b54ed4 (current diff) |
children | 2ae4c5a5b4e5 |
files | |
diffstat | 11 files changed, 404 insertions(+), 530 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/Actor.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -2985,8 +2985,8 @@ actor->UpdateAnimation(); for (uint i = 0; i < 5; ++i) - if (pParty->field_750[i] == actor->pMonsterInfo.uID) - pParty->field_75A[i] = true; + if (pParty->monster_id_for_hunting[i] == actor->pMonsterInfo.uID) + pParty->monster_for_hunting_killed[i] = true; for (uint i = 0; i < 22; ++i) actor->pActorBuffs[i].Reset();
--- a/NPC.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/NPC.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -1343,7 +1343,7 @@ OracleDialogue(); goto _return; case 311: - sub_4BBA85_bounties(); + CheckBountyRespawnAndAward(); goto _return; }*/ if ( pEventNumber < 200 || pEventNumber > 310 ) @@ -1358,7 +1358,7 @@ { if ( pEventNumber == 311 ) { - sub_4BBA85_bounties(); + CheckBountyRespawnAndAward(); } else {
--- a/Party.h Fri Sep 06 09:29:17 2013 +0200 +++ b/Party.h Fri Sep 06 16:42:32 2013 +0600 @@ -150,9 +150,10 @@ #pragma pack(push, 1) struct Party_stru0 { - int field_0[20]; + //__int64 field_0[10]; + __int64 bountyHunting_next_generation_time[10]; // int field_50[170]; - __int64 field_50[85]; + __int64 Shops_next_generation_time[85];//field_50 __int64 _shop_ban_times[53]; int field_4A0[20]; int field_4F0[38]; @@ -265,8 +266,8 @@ int uNumPrisonTerms; unsigned int uNumBountiesCollected; int field_74C; - __int16 field_750[5]; - __int16 field_75A[5]; + __int16 monster_id_for_hunting[5]; + __int16 monster_for_hunting_killed[5]; unsigned char days_played_without_rest; unsigned __int8 _quest_bits[64]; unsigned __int8 pArcomageWins[16];
--- a/UI/UIGuilds.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/UI/UIGuilds.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -160,7 +160,7 @@ DrawTextAtStatusBar(statusbar_string, 0); if ( !v8 ) { - working_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//" 14 " + working_window.DrawCurrentTime(pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] - pParty->uTimePlayed);//" 14 " return; } v12 = pMouse->GetCursorPos(&v51);
--- a/UI/UIHouses.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/UI/UIHouses.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -989,12 +989,7 @@ { int experience_for_next_level; // eax@5 GUIWindow *v8; // esi@10 - 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 v11; // edi@31 int v16; // eax@32 int v17; // eax@33 int v18; // eax@34 @@ -1004,15 +999,6 @@ __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 signed int v36; // esi@227 int v37; // ecx@227 @@ -1032,7 +1018,6 @@ void *v52; // eax@260 signed int v53; // edi@260 int v54; // eax@262 - int v56; // [sp+14h] [bp-Ch]@31 if ( !pDialogueWindow->pNumPresenceButton ) return; @@ -1041,54 +1026,54 @@ v8 = window_SpeakInHouse; if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { - if ( in_current_building_type == BuildingType_Training ) - { - if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) - { - experience_for_next_level = 0; - if ( pPlayers[uActiveCharacter]->uLevel > 0 ) - { - for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) - experience_for_next_level += i + 1; - } - if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && - (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level) - return; - } - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); - v8 = window_SpeakInHouse; - } - if ( in_current_building_type != BuildingType_Training ) - { - v8 = window_SpeakInHouse; - if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && - transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] - || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) - { - pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" - pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); - v8 = window_SpeakInHouse; - } - else if (uActiveCharacter) - { - if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) - return; - v8 = window_SpeakInHouse; - } - } - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - if ( in_current_building_type < BuildingType_19 ) - { - ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; - v8 = window_SpeakInHouse; - } + if ( in_current_building_type == BuildingType_Training ) + { + if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) + { + experience_for_next_level = 0; + if ( pPlayers[uActiveCharacter]->uLevel > 0 ) + { + for( uint i = 0; i < pPlayers[uActiveCharacter]->uLevel; i++ ) + experience_for_next_level += i + 1; + } + if (pPlayers[uActiveCharacter]->uLevel < pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89] && + (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * experience_for_next_level)//test experience + return; + } + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); + v8 = window_SpeakInHouse; + } + if ( in_current_building_type != BuildingType_Training ) + { + v8 = window_SpeakInHouse; + if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && + transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] + || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) + { + pDialogueWindow->Release(); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); + v8 = window_SpeakInHouse; + } + else if (uActiveCharacter) + { + if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) + return; + v8 = window_SpeakInHouse; + } + } + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + if ( in_current_building_type < BuildingType_19 ) + { + ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; + v8 = window_SpeakInHouse; + } } //NEW @@ -1107,7 +1092,7 @@ case BuildingType_15: case BuildingType_16: { - if ( pParty->field_3C.field_50[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) + if ( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] >= (signed __int64)pParty->uTimePlayed ) { for ( uint i = 0; i < 12; ++i ) { @@ -1119,221 +1104,178 @@ } } } - else + else//generation new books { SpellBookGenerator(); - pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 + pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); } - //return; break; } case BuildingType_TownHall: { - if ( uMessageParam == 99 ) + if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_MESSAGE ) { - v10 = (int)((char *)v8->ptr_1C - 102); - v56 = v10; - v11 = 8 * v10 + 11325428; - if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed - && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed ) + if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed )//new generation { - v13 = 0; + pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; + pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)v8->ptr_1C - 102)] = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + v16 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); + if ( !v16 ) + { + while ( 1 ) + { + v24 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + if ( (unsigned __int16)v24 < 115 || (unsigned __int16)v24 > 132 ) + { + if ( ((unsigned __int16)v24 < 235 || (unsigned __int16)v24 > 252) + && ((unsigned __int16)v24 < 133 || (unsigned __int16)v24 > 150) + && ((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->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 1 ) + { + while ( 1 ) + { + v23 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + if ( (unsigned __int16)v23 < 115 || (unsigned __int16)v23 > 132 ) + { + 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 < 4 || (unsigned __int16)v23 > 6) + && ((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->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 2 ) + { + while ( 1 ) + { + v22 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + 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->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 3 ) + { + while ( 1 ) + { + v21 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + 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->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + } + } + if ( v16 == 4 ) + { + while ( 1 ) + { + v20 = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + 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->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = rand() % 258 + 1; + } + } + } + bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]; + if ( !pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] ) + { + bountyHunting_text = pNPCTopics[351].pText;//" %s..." + if ( !pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] ) + bountyHunting_text = pNPCTopics[353].pText;//" " } 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 ) + if ( pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] > 0 )//get prize { - 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 == HOUSE_DIALOGUE_TOWNHALL_100 ) - { - pKeyActionMap->EnterText(1, 10, v8); - } - break; - } + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel, 0); + for ( uint i = 0; i < 4; ++i ) + pParty->pPlayers[i].SetVariable(VAR_Award, 86); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)]].uLevel; + pParty->monster_id_for_hunting[(int)((char *)v8->ptr_1C - 102)] = 0; + pParty->monster_for_hunting_killed[(int)((char *)v8->ptr_1C - 102)] = false; + } + bountyHunting_text = pNPCTopics[352].pText;//"! ..." + } + } + else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_PAY_FINE ) + pKeyActionMap->EnterText(1, 10, v8); + break; + } case BuildingType_Bank: { if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) @@ -1583,7 +1525,7 @@ v25 = v10; v26 = pParty->field_750[v25]; v27 = pParty->field_75A[v25] == v13; - word_F8B1A0 = pParty->field_750[v25]; + bountyHunting_monster_id_for_hunting = pParty->field_750[v25]; if ( v27 ) { //v1 = 0; @@ -1591,7 +1533,7 @@ v29 = (int)pNPCTopics[351].pText; if ( v27 ) v29 = (int)pNPCTopics[353].pText; - dword_F8B1A4 = (char *)v29; + bountyHunting_text = (char *)v29; } else { @@ -1610,7 +1552,7 @@ pParty->field_75A[v25] = v13; } //v1 = 0; - dword_F8B1A4 = pNPCTopics[352].pText; + bountyHunting_text = pNPCTopics[352].pText; } } else if ( uMessageParam == 100 ) @@ -1662,11 +1604,11 @@ case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { - if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) { GenerateStandartShopItems(); GenerateSpecialShopItems(); - pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); } if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) { @@ -1858,7 +1800,7 @@ sub_421B2C_PlaceInInventory_or_DropPickedItem(); return; } - if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + if ( pParty->field_3C.Shops_next_generation_time[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) { GenerateStandartShopItems(); GenerateSpecialShopItems(); @@ -1869,7 +1811,7 @@ //+ (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; + pParty->field_3C.Shops_next_generation_time[v40] = v41; } v42 = v8->ptr_1C; @@ -2300,177 +2242,131 @@ //----- (004B7911) -------------------------------------------------------- void TownHallDialog() { - GUIWindow *v0; // eax@4 int v1; // eax@10 int v2; // esi@10 - GUIFont *v3; // ST20_4@20 - int v4; // eax@20 - MonsterInfo *v5; // edi@21 - unsigned int v6; // ST20_4@21 - char *v7; // ST1C_4@21 - unsigned int v8; // eax@21 - int v9; // esi@21 - char *v10; // eax@23 - signed int v11; // ebx@24 - signed int i; // esi@26 - int v13; // eax@27 - GUIWindow *v14; // ecx@28 - __int64 v15; // qax@28 + signed int pStringSum; // ebx@24 signed int v16; // ebx@28 int v17; // ebx@28 - unsigned __int8 v18; // sf@28 - char **v19; // edi@29 - GUIButton *v20; // eax@30 - GUIButton *v21; // esi@30 - int v22; // eax@30 + GUIButton *pButton; // eax@30 + int pTextHeight; // eax@30 unsigned int v23; // ecx@30 - unsigned __int16 v24; // ax@30 - GUIWindow a1; // [sp+Ch] [bp-110h]@21 - GUIWindow w; // [sp+60h] [bp-BCh]@21 - GUIWindow _this; // [sp+B4h] [bp-68h]@1 - int v28; // [sp+108h] [bp-14h]@1 + unsigned __int16 pTextColor; // ax@30 + GUIWindow window; // [sp+60h] [bp-BCh]@21 + GUIWindow townHall_window; // [sp+B4h] [bp-68h]@1 int v29; // [sp+10Ch] [bp-10h]@28 - int v30; // [sp+110h] [bp-Ch]@1 int v31; // [sp+114h] [bp-8h]@29 GUIFont *pOutString; // [sp+118h] [bp-4h]@21 - memcpy(&_this, window_SpeakInHouse, sizeof(_this)); - _this.uFrameX = 483; - _this.uFrameWidth = 148; - _this.uFrameZ = 334; - v28 = TargetColor(0xFFu, 0xFFu, 0xFFu); - v30 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); - _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf.data(), 3u); + memcpy(&townHall_window, window_SpeakInHouse, sizeof(townHall_window)); + townHall_window.uFrameX = 483; + townHall_window.uFrameWidth = 148; + townHall_window.uFrameZ = 334; + sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);// + townHall_window.DrawTitleText(pFontArrus, 0, 260, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); switch(dialog_menu_id) { - case HOUSE_DIALOGUE_MAIN: - { - v11 = 1; - pOutString = 0; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; - if ( pParty->uFine ) - { - pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; - v11 = 2; - } - for ( i = 0; i < v11; ++i ) - { - v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); - pOutString = (GUIFont *)((char *)pOutString + v13); - } - v29 = (100 - (signed int)pOutString) / v11; - v14 = pDialogueWindow; - v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; - v16 = v15 - HIDWORD(v15); - LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; - HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; - v17 = (v16 >> 1) - v29 / 2 + 158; - v18 = -pDialogueWindow->pNumPresenceButton < 0; - pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; - if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) - { - v31 = 2; - v19 = pShopOptions.data(); - do - { - v20 = v14->GetControl((unsigned int)pOutString); - v21 = v20; - v20->uY = v29 + v17; - v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); - v23 = v21->uY; - v21->uHeight = v22; - v17 = v23 + v22 - 1; - v21->uW = v17; - v24 = v30; - if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) - v24 = v28; - _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); - v14 = pDialogueWindow; - ++v31; - ++v19; - pOutString = (GUIFont *)((char *)pOutString + 1); - } - while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - break; - } - - case HOUSE_DIALOGUE_TOWNHALL_99: - { - v5 = &pMonsterStats->pInfos[word_F8B1A0]; - v6 = TargetColor(0xFFu, 0xFFu, 0xFFu); - v7 = v5->pName; - v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", v8, v7, v6); - sprintf(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * v5->uLevel); - current_npc_text = pTmpBuf2.data(); - memcpy(&a1, pDialogueWindow, sizeof(a1)); - w.uFrameWidth = 458; - w.uFrameZ = 457; - pOutString = pFontArrus; - v9 = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &w, 13, 0) + 7; - if ( 352 - v9 < 8 ) - { - pOutString = pFontCreate; - v9 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; - } - - auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->GetLeather(8, 352 - v9, pTex, pTex->uTextureHeight - v9); - pRenderer->DrawTextureIndexed(8, 347 - v9, pTexture_591428); - v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 13, 0); - a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); - break; - } - case HOUSE_DIALOGUE_TOWNHALL_100: - { - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) - { - sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" - _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf.data(), 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3); - v3 = pFontArrus; - v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); - return; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) - { - v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v2 = v1; - if ( v1 <= 0 ) - { - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - if ( v1 > pParty->uNumGold ) - { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - v2 = pParty->uNumGold; - } - if ( v2 > pParty->uFine ) - v2 = pParty->uFine; - Party::TakeGold(v2); - pParty->uFine -= v2; - if ( pParty->uFine < 0 ) - pParty->uFine = 0; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - v0 = window_SpeakInHouse; - } - if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) - { - v0->receives_keyboard_input_2 = WINDOW_INPUT_NONE; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - } - break; - } - default: - { - break; - } + case HOUSE_DIALOGUE_MAIN: + { + pStringSum = 1; + pTextHeight = 0; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];// + if ( pParty->uFine > 0 ) + { + pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];// + pStringSum = 2; + } + for ( uint i = 0; i < pStringSum; ++i ) + pTextHeight += pFontArrus->CalcTextHeight(pShopOptions[i], &townHall_window, 0, 0); + v29 = (100 - pTextHeight) / pStringSum; + v16 = 80 - pStringSum * ((100 - pTextHeight) / pStringSum); + v17 = (v16 / 2) - v29 / 2 + 158; + if ( pDialogueWindow->pNumPresenceButton > 0 ) + { + v31 = 2; + uint j = 0; + for ( uint i = pDialogueWindow->pStartingPosActiveItem; + i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i ) + { + pButton = pDialogueWindow->GetControl(i); + pButton->uY = v29 + v17; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[j], &townHall_window, 0, 0); + v23 = pButton->uY; + pButton->uHeight = pTextHeight; + v17 = v23 + pTextHeight - 1; + pButton->uW = v17; + pTextColor = TargetColor(0xFFu, 0xFFu, 0x9Bu); + if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) + pTextColor = TargetColor(0xFFu, 0xFFu, 0xFFu); + townHall_window.DrawTitleText(pFontArrus, 0, v23, pTextColor, pShopOptions[j], 3); + ++v31; + ++j; + } + } + break; + } + case HOUSE_DIALOGUE_TOWNHALL_MESSAGE: + { + sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", TargetColor(0xFFu, 0xFFu, 0x9Bu), + pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName, TargetColor(0xFFu, 0xFFu, 0xFFu)); + sprintf(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].uLevel); + current_npc_text = pTmpBuf2.data(); + memcpy(&window, pDialogueWindow, sizeof(window)); + window.uFrameWidth = 458; + window.uFrameZ = 457; + pOutString = pFontArrus; + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf2.data(), &window, 13, 0) + 7; + if ( 352 - pTextHeight < 8 ) + { + pOutString = pFontCreate; + pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; + } + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); + break; + } + case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: + { + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) + { + sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?" + townHall_window.DrawTitleText(pFontArrus, 0, 146, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + townHall_window.DrawTitleText(pFontArrus, 0, 186, TargetColor(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3); + townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus); + return; + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) + { + v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + if ( v1 <= 0 ) + { + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 > pParty->uNumGold ) + { + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + v2 = pParty->uNumGold; + } + if ( v2 > pParty->uFine ) + v2 = pParty->uFine; + Party::TakeGold(v2); + pParty->uFine -= v2; + if ( pParty->uFine < 0 ) + pParty->uFine = 0; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + } + if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) + { + window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + } + break; + } + default: + break; } return; } @@ -4174,7 +4070,6 @@ v33 = _4B254D_SkillMasteryTeacher((int)v52.ptr_1C); LABEL_44: v15 = v33; -LABEL_45: v16 = (GUIButton *)pInString; goto LABEL_49; } @@ -4187,15 +4082,16 @@ v28 = v27 - 1; if ( !v28 ) { - v29 = (char *)&pMonsterStats + 88 * word_F8B1A0; + v29 = pMonsterStats->pInfos[bountyHunting_monster_id_for_hunting].pName; v30 = TargetColor(0xFFu, 0xFFu, 0xFFu); v31 = *(int *)v29; v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu); sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30); - sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); + sprintfex(pTmpBuf2.data(), bountyHunting_text, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]); current_npc_text = pTmpBuf2.data(); v15 = ""; - goto LABEL_45; + v16 = (GUIButton *)pInString; + goto LABEL_49; } if ( v28 != 10 ) goto LABEL_41; @@ -4237,7 +4133,8 @@ sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data()); current_npc_text = pTmpBuf2.data(); - goto LABEL_45; + v16 = (GUIButton *)pInString; + goto LABEL_49; } v21 = v20 - 1; if ( !v21 )
--- a/UI/UIHouses.h Fri Sep 06 09:29:17 2013 +0200 +++ b/UI/UIHouses.h Fri Sep 06 16:42:32 2013 +0600 @@ -32,8 +32,8 @@ HOUSE_DIALOGUE_LEARN_SKILLS = 96, HOUSE_DIALOGUE_97 = 97, HOUSE_DIALOGUE_98 = 98, - HOUSE_DIALOGUE_TOWNHALL_99 = 99, - HOUSE_DIALOGUE_TOWNHALL_100 = 100, + HOUSE_DIALOGUE_TOWNHALL_MESSAGE = 99, + HOUSE_DIALOGUE_TOWNHALL_PAY_FINE = 100, HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN = 101, HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES = 102, HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS = 103,
--- a/UI/UIShops.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/UI/UIShops.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -70,7 +70,7 @@ int v61; // eax@90 int v62; // ecx@90 ItemGen *pItemInShop; // esi@90 - int v64; // eax@95 + //int v64; // eax@95 int all_text_height; // esi@96 char **v66; // edi@96 int v67; // eax@97 @@ -233,8 +233,8 @@ pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60]; if ( !v56 || !Str ) { - v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2); - v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2)], + uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); } @@ -248,7 +248,7 @@ } else { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);// 7 pNumActiveItem = 0; //added } } @@ -424,22 +424,20 @@ pItemInShop = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { - v64 = pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2); - v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + v7 = BuildDialogueString((char *)pMerchantsBuyPhrases[pPlayer->SelectPhrasesTransaction(pItemInShop, BuildingType_WeaponShop, v61, 2)], + uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138, pColorWhite, v7, 3); } else { v7 = BuildDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, pItemInShop, (char *)window_SpeakInHouse->ptr_1C, 2, 0); - pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138, pColorWhite, v7, 3); } } } else { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); pNumActiveItem = 0; //added } } @@ -769,7 +767,7 @@ dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); return; } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); return; } break; @@ -841,7 +839,7 @@ dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); return; } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); return; } break; @@ -1018,7 +1016,7 @@ while ( v104 < 8 ); return; } - dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + dialog_window.DrawCurrentTime(pParty->field_3C.Shops_next_generation_time[window_SpeakInHouse->par1C]- pParty->uTimePlayed); return; } break; @@ -1351,7 +1349,7 @@ DrawTextAtStatusBar(v65, 0); if ( !v109 ) { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } v66 = pMouse->GetCursorPos(&v98); @@ -1551,7 +1549,7 @@ DrawTextAtStatusBar(v65, 0); if ( !v109 ) { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } v66 = pMouse->GetCursorPos(&v98); @@ -1932,7 +1930,7 @@ DrawTextAtStatusBar(v69, 0); if ( !v117 ) { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } v70 = pMouse->GetCursorPos(&v102); @@ -2063,7 +2061,7 @@ DrawTextAtStatusBar(v69, 0); if ( !v117 ) { - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + dialog_window.DrawCurrentTime( pParty->field_3C.Shops_next_generation_time[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); return; } v70 = pMouse->GetCursorPos(&v102);
--- a/mm7_2.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/mm7_2.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -218,81 +218,59 @@ } //----- (004BBA85) -------------------------------------------------------- -const char *sub_4BBA85_bounties() +void CheckBountyRespawnAndAward() { - int v0; // edi@1 - signed __int64 v1; // qax@2 int i; // eax@2 - int v3; // edx@3 - int v4; // edi@14 - __int16 v5; // ax@14 - char v6; // zf@14 - Player *v7; // ebx@16 - const char *result; // eax@19 + int rand_monster_id; // edx@3 uDialogueType = 83; pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" + pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" pIcons_LOD->GetTexture(uExitCancelTextureId), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); - pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0); + pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0); pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); dialog_menu_id = HOUSE_DIALOGUE_OTHER; - v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); - if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) - { - pParty->field_75A[v0] = 0; - __debugbreak(); // starting year-related constant here; - v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) - * 0.033333335); - pParty->field_3C.field_0[2 * v0] = v1; - pParty->field_3C.field_0[2 * v0 + 1] = HIDWORD(v1); + //get new monster for hunting + if ( pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed ) + { + pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; + pParty->field_3C.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); for ( i = rand(); ; i = rand() ) { - v3 = i % 258 + 1; - pParty->field_750[v0] = v3; - if ( (unsigned __int16)v3 < 0x73u || (unsigned __int16)v3 > 0x84u ) + rand_monster_id = i % 258 + 1; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand_monster_id; + if ( (unsigned __int16)rand_monster_id < 0x73u || (unsigned __int16)rand_monster_id > 0x84u ) { - if ( ((unsigned __int16)v3 < 0xEBu || (unsigned __int16)v3 > 0xFCu) - && ((unsigned __int16)v3 < 0x85u || (unsigned __int16)v3 > 0x96u) - && ((unsigned __int16)v3 < 0x97u || (unsigned __int16)v3 > 0xBAu) - && ((unsigned __int16)v3 < 0xC4u || (unsigned __int16)v3 > 0xC6u) ) + if ( ((unsigned __int16)rand_monster_id < 0xEBu || (unsigned __int16)rand_monster_id > 0xFCu) + && ((unsigned __int16)rand_monster_id < 0x85u || (unsigned __int16)rand_monster_id > 0x96u) + && ((unsigned __int16)rand_monster_id < 0x97u || (unsigned __int16)rand_monster_id > 0xBAu) + && ((unsigned __int16)rand_monster_id < 0xC4u || (unsigned __int16)rand_monster_id > 0xC6u) ) break; } } } - v4 = v0; - v5 = pParty->field_750[v4]; - v6 = pParty->field_75A[v4] == 0; - word_F8B1A0 = pParty->field_750[v4]; - if ( v6 ) - { - v6 = v5 == 0; - result = pNPCTopics[351].pText; - if ( v6 ) - result = pNPCTopics[353].pText; - } - else - { - if ( v5 ) + bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; + if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) + { + bountyHunting_text = pNPCTopics[351].pText; + if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) + bountyHunting_text = pNPCTopics[353].pText; + } + else//get prize + { + if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v5].uLevel, 0); - v7 = pParty->pPlayers; - do - { - v7->SetVariable(VAR_Award, 86); - ++v7; - } - while ( (signed int)v7 < (signed int)pParty->pHirelings ); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v4]].uLevel; - pParty->field_750[v4] = 0; - pParty->field_75A[v4] = 0; + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); + for ( uint i = 0; i < 4; ++i ) + pParty->pPlayers[i].SetVariable(VAR_Award, 86); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; + pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; + pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; } - result = pNPCTopics[352].pText; - } - dword_F8B1A4 = (char *)result; - return result; + bountyHunting_text = pNPCTopics[352].pText; + } } //----- (004BBCDD) -------------------------------------------------------- @@ -334,7 +312,7 @@ { uDialogueType = 91; v4 = pParty->pPlayers; - ++*((char *)&pParty->field_75A[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); + ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); do { v4->SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3);
--- a/mm7_4.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/mm7_4.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -3629,7 +3629,7 @@ OracleDialogue(); break; case 311: - sub_4BBA85_bounties(); + CheckBountyRespawnAndAward(); break; case 399: __debugbreak(); // what kind of dialogue is that?
--- a/mm7_data.cpp Fri Sep 06 09:29:17 2013 +0200 +++ b/mm7_data.cpp Fri Sep 06 16:42:32 2013 +0600 @@ -1349,8 +1349,8 @@ std::array<__int16, 777> word_F8B158; // weak struct Texture *ShopTexture; // idb std::array<struct Texture *, 12> ItemsInShopTexture; -__int16 word_F8B1A0; // weak -const char *dword_F8B1A4; // idb +__int16 bountyHunting_monster_id_for_hunting; // word_F8B1A0 +const char *bountyHunting_text; // word_F8B1A4 int contract_approved; // weak int dword_F8B1AC_award_bit_number; // idb int dword_F8B1B0; // weak
--- a/mm7_data.h Fri Sep 06 09:29:17 2013 +0200 +++ b/mm7_data.h Fri Sep 06 16:42:32 2013 +0600 @@ -1009,8 +1009,8 @@ extern std::array<__int16, 777> word_F8B158; // weak extern struct Texture *ShopTexture; // idb extern std::array<struct Texture *, 12> ItemsInShopTexture; -extern __int16 word_F8B1A0; // weak -extern const char *dword_F8B1A4; // idb +extern __int16 bountyHunting_monster_id_for_hunting; // weak +extern const char *bountyHunting_text; // idb extern int contract_approved; // weak extern int dword_F8B1AC_award_bit_number; // idb extern int dword_F8B1B0; // weak @@ -1243,7 +1243,7 @@ void _4B4224_UpdateNPCTopics(int _this); void __fastcall DrawTextAtStatusBar(const char *Str, int a5); __int64 GetExperienceRequiredForLevel(int a1); -const char *sub_4BBA85_bounties(); +void CheckBountyRespawnAndAward(); void sub_4BBCDD(); void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb void ArenaFight();