Mercurial > mm7
diff mm7_2.cpp @ 1529:61458df2cb4f
bountyHunting fix
author | Ritor1 |
---|---|
date | Fri, 06 Sep 2013 16:42:23 +0600 |
parents | c3da3c2985b8 |
children | 3c33f3e44f71 |
line wrap: on
line diff
--- a/mm7_2.cpp Thu Sep 05 18:05:50 2013 +0600 +++ b/mm7_2.cpp Fri Sep 06 16:42:23 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);