Mercurial > mm7
changeset 753:e13ce1b0930d
Merge
author | Gloval |
---|---|
date | Sat, 23 Mar 2013 00:53:15 +0400 |
parents | 8b29c4121f6f (current diff) f39fbeb65b28 (diff) |
children | 5ba796adbf5e |
files | mm7_2.cpp |
diffstat | 12 files changed, 374 insertions(+), 188 deletions(-) [+] |
line wrap: on
line diff
--- a/Events.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/Events.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -1353,7 +1353,7 @@ if ( uGameState == 2 ) { pAudioPlayer->StopChannels(-1, -1); - dialog_menu_id = 0; + dialog_menu_id = HOUSE_DIALOGUE_NULL; while ( sub_4BD8B5() ) ; pVideoPlayer->Unload(); @@ -1365,7 +1365,7 @@ viewparams->bRedrawGameUI = 1; pDialogueNPCCount = 0; pDialogueWindow->Release(); - dialog_menu_id = 0; + dialog_menu_id = HOUSE_DIALOGUE_NULL; pDialogueWindow = 0; pIcons_LOD->_40F9C5(); }
--- a/Items.h Sat Mar 23 00:50:58 2013 +0400 +++ b/Items.h Sat Mar 23 00:53:15 2013 +0400 @@ -128,6 +128,7 @@ inline bool Identified() {return uAttributes & ITEM_IDENTIFIED;} inline void SetIdentified() {uAttributes |= ITEM_IDENTIFIED;} inline bool Stolen() {return uAttributes & ITEM_STOLEN;} + inline void SetStolen() {uAttributes |= ITEM_STOLEN;} bool GenerateArtifact(); unsigned int GetValue();
--- a/Player.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/Player.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -336,16 +336,14 @@ } //----- (004B8142) -------------------------------------------------------- -int Player::_4B8142(int a2, float a3) -{ - int result; // eax@1 - - result = (int)((100 - GetMerchant()) * (unsigned __int64)(signed __int64)((double)a2 * a3)) / 100; - if ( result < a2 ) - result = a2; - if ( result < 1 ) - result = 1; - return result; +int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier) +{ + uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100; + assert (price > 0); + + if (price < uRealValue) + price = uRealValue; + return price; } //----- (004B8179) -------------------------------------------------------- @@ -1858,7 +1856,7 @@ v14 = &p2DEvents[a4 - 1].fPriceMultiplier; v15 = *v14; v16 = pItem->GetValue(); - v17 = _4B8142(v16, v15); + v17 = GetBuyingPrice(v16, v15); if ( a5 == 3 ) { v23 = *v14;
--- a/Player.h Sat Mar 23 00:50:58 2013 +0400 +++ b/Player.h Sat Mar 23 00:53:15 2013 +0400 @@ -560,7 +560,7 @@ int _4B8213(int a2, float a3); int _4B81C3(int a2, float a3); int _4B8179(float a2); - int _4B8142(int a2, float a3); + int GetBuyingPrice(unsigned int uRealValue, float price_multiplier); int _4B8102(int a2, float a3); int _4B807C(float a2); int _4B8040_condition_time(unsigned int uCondition);
--- a/UIHouses.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/UIHouses.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -30,6 +30,9 @@ int dword_591080; // weak +int in_current_building_type; // 00F8B198 +HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C + const stru159 pAnimatedRooms[196] = //0x4E5F70 { {"", 0x4, 0x1F4, 0, 0, 0}, @@ -624,7 +627,7 @@ _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); switch(dialog_menu_id) { - case 1: + case HOUSE_DIALOGUE_MAIN: { v11 = 1; pOutString = 0; @@ -675,7 +678,8 @@ } break; } - case 99: + + case HOUSE_DIALOGUE_TOWNHALL_99: { v5 = &pMonsterStats->pInfos[word_F8B1A0]; v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); @@ -702,7 +706,7 @@ a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); break; } - case 100: + case HOUSE_DIALOGUE_TOWNHALL_100: { v0 = window_SpeakInHouse; if ( window_SpeakInHouse->field_40 == 1 ) @@ -793,7 +797,7 @@ _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); switch(dialog_menu_id) { - case 1: + case HOUSE_DIALOGUE_MAIN: { v8 = v14[0]; if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) @@ -805,7 +809,7 @@ _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); break; } - case 7: + case HOUSE_DIALOGUE_BANK_7: { v0 = window_SpeakInHouse; if ( window_SpeakInHouse->field_40 != 1 ) @@ -862,7 +866,7 @@ break; } - case 8: + case HOUSE_DIALOGUE_BANK_8: { v0 = window_SpeakInHouse; if ( window_SpeakInHouse->field_40 != 1 ) @@ -1036,9 +1040,10 @@ v7 = 1; v83 = 1; } + switch(dialog_menu_id) { - case DIALOG_SHOP_MAIN: + case HOUSE_DIALOGUE_MAIN: { if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -1126,9 +1131,10 @@ } break; } - case DIALOG_SHOP_ARCOMAGE_102: + + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_102: { - __debugbreak; + __debugbreak(); pOutString = pFontArrus; strcpy(pTmpBuf, pNPCTopics[354].pText); dialog_window.uFrameWidth = 460; @@ -1146,9 +1152,9 @@ window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); break; } - case DIALOG_SHOP_ARCOMAGE_103: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_103: { - __debugbreak; + __debugbreak(); strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); dialog_window.uFrameWidth = 460; dialog_window.uFrameZ = 452; @@ -1161,7 +1167,7 @@ window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); break; } - case DIALOG_SHOP_ARCOMAGE_RESULT: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: { if ( pArcomageGame->bGameInProgress == 1 ) return; @@ -1181,14 +1187,15 @@ dialog_window.DrawTitleText(pFontArrus, 0, v66, pColorYellow, pTmpBuf, 3); break; } - case DIALOG_SHOP_REST: + + case HOUSE_DIALOGUE_TAVERN_REST: { if ( pParty->uNumGold >= (unsigned int)pOutString ) { Party::TakeGold((unsigned int)pOutString); v27 = (int)window_SpeakInHouse->ptr_1C; PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); - dialog_menu_id = 0; + dialog_menu_id = HOUSE_DIALOGUE_NULL; sub_4BD8B5(); sub_4B1D27(); pVideoPlayer->Unload(); @@ -1207,7 +1214,8 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); break; } - case DIALOG_SHOP_SKILLS: + + case HOUSE_DIALOGUE_LEARN_SKILLS: { if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -1280,7 +1288,8 @@ dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorYellow, pTmpBuf, 3); return; } - case DIALOG_SHOP_BYE_FOOD: + + case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: { *(_QWORD *)Str = pParty->uNumFoodRations; //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) @@ -1306,7 +1315,8 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); break; } - case DIALOG_SHOP_ARCOMAGE_MAIN: + + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -1466,9 +1476,10 @@ dialog_window.uFrameZ = 334; pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch(dialog_menu_id) { - case DIALOG_SHOP_MAIN: + case HOUSE_DIALOGUE_MAIN: { pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( pNumActiveItem ) @@ -1509,7 +1520,8 @@ } break; } - case DIALOG_SHOP_BUY_STANDART: + + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v48 = 0; @@ -1556,7 +1568,7 @@ else { v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v58 = pGlobalTXT_LocalizationStrings[196]; } DrawTextAtStatusBar(v58, 0); @@ -1571,7 +1583,7 @@ v61 = (int)window_SpeakInHouse->ptr_1C; // v62 = 9 * (v60 + 12 * v61); v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { @@ -1596,7 +1608,8 @@ } break; } - case DIALOG_SHOP_SELL: + + case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -1614,7 +1627,8 @@ dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); break; } - case DIALOG_SHOP_IDENTIFY: + + case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -1641,7 +1655,8 @@ } break; } - case DIALOG_SHOP_REPAIR: + + case HOUSE_DIALOGUE_SHOP_REPAIR: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -1661,7 +1676,8 @@ return; } break; - case DIALOG_SHOP_DISPLAY_EQUIPMENT: + + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -1699,7 +1715,8 @@ } break; } - case DIALOG_SHOP_BUY_SPECIAL: + + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v109 = 0; @@ -1742,7 +1759,7 @@ else { v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v58 = pGlobalTXT_LocalizationStrings[196]; } DrawTextAtStatusBar(v58, 0); @@ -1757,7 +1774,7 @@ v61 = (int)window_SpeakInHouse->ptr_1C; // v62 = 9 * (v60 + 12 * v61); v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { @@ -1782,7 +1799,8 @@ } break; } - case DIALOG_SHOP_SKILLS: + + case HOUSE_DIALOGUE_LEARN_SKILLS: { if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; @@ -1864,7 +1882,7 @@ } default: { - if( dialog_menu_id > 5 ) + if( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR) pNumActiveItem = dialog_menu_id - 96; else pNumActiveItem = dialog_menu_id - 4; @@ -1991,7 +2009,7 @@ pColorYellow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); switch(dialog_menu_id) { - case DIALOG_SHOP_MAIN: + case HOUSE_DIALOGUE_MAIN: { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -2032,7 +2050,7 @@ } return; } - case DIALOG_SHOP_BUY_STANDART: + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v114 = 0; @@ -2110,7 +2128,7 @@ { v65 = pGlobalTXT_LocalizationStrings[185]; } - else if ( dialog_menu_id == 2 ) + else if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { v65 = pGlobalTXT_LocalizationStrings[195]; } @@ -2130,7 +2148,7 @@ { v67 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; v70 = (ItemGen *)&pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v70 = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { @@ -2149,7 +2167,7 @@ } return; } - case DIALOG_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2167,7 +2185,7 @@ dialog_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, pColorWhite, v21, 3); return; } - case DIALOG_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2193,7 +2211,7 @@ dialog_window.DrawTitleText(pFontArrus, 0, (174 - v40) / 2 + 138, pColorWhite, v21, 3); return; } - case DIALOG_SHOP_DISPLAY_EQUIPMENT: + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2231,7 +2249,7 @@ } return; } - case DIALOG_SHOP_BUY_SPECIAL: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v114 = 0; @@ -2315,7 +2333,7 @@ else { v65 = pGlobalTXT_LocalizationStrings[195]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v65 = pGlobalTXT_LocalizationStrings[196]; } DrawTextAtStatusBar(v65, 0); @@ -2333,7 +2351,7 @@ v68 = (int)window_SpeakInHouse->ptr_1C; // v69 = 9 * (v67 + 12 * v68); v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { @@ -2352,7 +2370,7 @@ } return; } - case DIALOG_SHOP_SKILLS: + case HOUSE_DIALOGUE_LEARN_SKILLS: { if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; @@ -2611,7 +2629,7 @@ hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); switch (dialog_menu_id) { - case DIALOG_SHOP_MAIN: + case HOUSE_DIALOGUE_MAIN: { if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -2648,14 +2666,14 @@ } } break; - case DIALOG_SHOP_BUY_STANDART: + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); textureW = 0; v153 = 0; for(int i=0; i<8; ++i) { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) { textureW = ItemsInShopTexture[i]->uTextureWidth; textureH = ItemsInShopTexture[i]->uTextureHeight; @@ -2728,7 +2746,7 @@ return; } break; - case DIALOG_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2750,7 +2768,7 @@ return; } break; - case DIALOG_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2794,7 +2812,7 @@ } } break; - case DIALOG_SHOP_REPAIR: + case HOUSE_DIALOGUE_SHOP_REPAIR: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2824,7 +2842,7 @@ return; } break; - case 6: //buy standart + case HOUSE_DIALOGUE_SHOP_6: //buy standart { pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" @@ -2890,7 +2908,7 @@ return; } break; - case DIALOG_SHOP_DISPLAY_EQUIPMENT: + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -2937,7 +2955,7 @@ return; } break; - case DIALOG_SHOP_BUY_SPECIAL: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { pRenderer->DrawTextureIndexed(8, 8, ShopTexture); v11 = 0; @@ -3027,7 +3045,7 @@ return; } break; - case DIALOG_SHOP_SKILLS: + case HOUSE_DIALOGUE_LEARN_SKILLS: { if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -3206,9 +3224,9 @@ strcpy(v47, ""); strcpy(v48, ""); strcpy(v49, ""); - if ( dialog_menu_id != 1 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) { - if ( dialog_menu_id != 18 ) //buy skill + if ( dialog_menu_id != HOUSE_DIALOGUE_GULD_BUY_BOOKS ) //buy skill { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -3292,7 +3310,7 @@ GetAsyncKeyState(17); statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" DrawTextAtStatusBar(statusbar_string, 0); if ( !v8 ) @@ -3533,14 +3551,14 @@ //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); HIDWORD(v60) = v2; - if ( dialog_menu_id != 1 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) { - if ( dialog_menu_id != 10 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) { - if ( dialog_menu_id != 11 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) { - if ( dialog_menu_id == 96 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -3940,12 +3958,12 @@ result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { - if ( dialog_menu_id != 1 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) { - if ( dialog_menu_id != 17 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_17 ) { result = dialog_menu_id - 96; - if ( dialog_menu_id == 96 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) { result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) @@ -4363,9 +4381,9 @@ dialog_window.uFrameZ = 334; m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - if ( dialog_menu_id > 5 ) + if ( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR ) { - if ( dialog_menu_id == 94 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -4417,10 +4435,10 @@ } return; } - if ( dialog_menu_id != 95 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) { - result = dialog_menu_id - 96; - if ( dialog_menu_id == 96 ) + result = dialog_menu_id - HOUSE_DIALOGUE_LEARN_SKILLS; + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) { result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) @@ -4521,7 +4539,7 @@ } else { - if ( dialog_menu_id == 5 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -4547,7 +4565,7 @@ v10 = (char *)pMerchantsRepairPhrases[v29]; goto LABEL_35; } - if ( dialog_menu_id == 1 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) { /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) @@ -4637,12 +4655,12 @@ return; } - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { - if ( dialog_menu_id != 3 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL) { - result = dialog_menu_id - 4; - if ( dialog_menu_id == 4 ) + result = dialog_menu_id - HOUSE_DIALOGUE_SHOP_IDENTIFY; + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); @@ -4730,7 +4748,7 @@ v3 = 0; v49 = 0; v122 = 0; - if ( dialog_menu_id == 2 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { do { @@ -4865,7 +4883,7 @@ { v66 = 0; v117 = 0; - if ( dialog_menu_id == 2 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { do { @@ -4896,7 +4914,7 @@ else { v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" } DrawTextAtStatusBar(v69, 0); @@ -4914,7 +4932,7 @@ v72 = (int)window_SpeakInHouse->ptr_1C; // v73 = 9 * (v71 + 12 * v72); v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; v74 =&pParty->SpecialItemsInShops[v72][v71]; if ( v67 && Str )
--- a/UIHouses.h Sat Mar 23 00:50:58 2013 +0400 +++ b/UIHouses.h Sat Mar 23 00:53:15 2013 +0400 @@ -2,23 +2,46 @@ #include "stru159.h" -enum DIALOG_MENU - { - DIALOG_SHOP_MAIN = 1, - DIALOG_SHOP_BUY_STANDART = 2, - DIALOG_SHOP_SELL = 3, - DIALOG_SHOP_IDENTIFY = 4, - DIALOG_SHOP_REPAIR = 5, - DIALOG_SHOP_REST = 15, - DIALOG_SHOP_BYE_FOOD = 16, - DIALOG_SHOP_DISPLAY_EQUIPMENT = 94, - DIALOG_SHOP_BUY_SPECIAL = 95, - DIALOG_SHOP_SKILLS = 96, - DIALOG_SHOP_ARCOMAGE_MAIN = 101, - DIALOG_SHOP_ARCOMAGE_102 = 102, - DIALOG_SHOP_ARCOMAGE_103 = 103, - DIALOG_SHOP_ARCOMAGE_RESULT = 104, - }; +enum HOUSE_DIALOGUE_MENU: unsigned __int32 +{ + HOUSE_DIALOGUE_NULL = 0, + HOUSE_DIALOGUE_MAIN = 1, + HOUSE_DIALOGUE_SHOP_BUY_STANDARD = 2, + HOUSE_DIALOGUE_SHOP_SELL = 3, + HOUSE_DIALOGUE_SHOP_IDENTIFY = 4, + HOUSE_DIALOGUE_SHOP_REPAIR = 5, + HOUSE_DIALOGUE_SHOP_6 = 6, + HOUSE_DIALOGUE_BANK_7 = 7, + HOUSE_DIALOGUE_BANK_8 = 8, + HOUSE_DIALOGUE_9 = 9, + HOUSE_DIALOGUE_TEMPLE_HEAL = 10, + HOUSE_DIALOGUE_TEMPLE_DONATE = 11, + HOUSE_DIALOGUE_12 = 12, + HOUSE_DIALOGUE_13 = 13, + HOUSE_DIALOGUE_14 = 14, + HOUSE_DIALOGUE_TAVERN_REST = 15, + HOUSE_DIALOGUE_TAVERN_BUY_FOOD = 16, + HOUSE_DIALOGUE_TRAININGHALL_17 = 17, + HOUSE_DIALOGUE_GULD_BUY_BOOKS = 18, + //... + HOUSE_DIALOGUE_GUILD_LEARN_SKILL = 72, + //... + HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT = 94, + HOUSE_DIALOGUE_SHOP_BUY_SPECIAL = 95, + 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_TAVERN_ARCOMAGE_MAIN = 101, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_102 = 102, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_103 = 103, + HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT = 104, + + HOUSE_DIALOGUE_108 = 108, + + HOUSE_DIALOGUE_OTHER = -1 +}; /* 349 */ enum HOUSE_ID @@ -83,4 +106,6 @@ extern int uHouse_ExitPic; // weak extern int dword_591080; // weak - extern const stru159 pAnimatedRooms[196]; +extern const stru159 pAnimatedRooms[196]; +extern int in_current_building_type; // 00F8B198 +extern HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C \ No newline at end of file
--- a/UiGame.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/UiGame.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -45,6 +45,7 @@ #include "Events2D.h" #include "texts.h" #include "stru351.h" +#include "UIHouses.h" #include "mm7_data.h" @@ -974,7 +975,7 @@ } if ( pCurrentScreen == SCREEN_HOUSE ) { - if ( dialog_menu_id != 2 + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) || v16 == -65536 ) //goto _return;
--- a/mm7_1.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/mm7_1.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -51,6 +51,7 @@ #include "Events2D.h" #include "texts.h" #include "stru351.h" +#include "UIHouses.h" #include "mm7_data.h" @@ -968,8 +969,9 @@ //goto LABEL_28; uActiveCharacter = uPlayerID; return; - if ( dialog_menu_id == 2 || dialog_menu_id == 6 ) + if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) { + __debugbreak(); // fix indexing pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; v5 = 14; //goto LABEL_22;
--- a/mm7_2.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/mm7_2.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -301,7 +301,7 @@ pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dialog_menu_id = -1; + 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 ) { @@ -889,12 +889,12 @@ return; pRenderer->ClearZBuffer(0, 479); //v3 = dword_F8B198; - if ( dialog_menu_id != 1 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) { v8 = window_SpeakInHouse; } //else - if ( dialog_menu_id == 1 ) + if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { if ( in_current_building_type == BildingType_Training ) { @@ -949,7 +949,7 @@ } } //LABEL_11: - dialog_menu_id = uMessageParam; + 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); @@ -1524,7 +1524,7 @@ case 102: case 103: { - dialog_menu_id = uMessageParam; + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; break; } case 104: @@ -1537,7 +1537,7 @@ ++pMessageQueue_50CBD0->uNumMessages; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); - dialog_menu_id = 104; + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; break; } case 2: @@ -1655,7 +1655,7 @@ case 4: case 5: { - dialog_menu_id = uMessageParam; + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; sub_421B2C_PlaceInInventory_or_DropPickedItem(); break; } @@ -1918,11 +1918,11 @@ if ( pDialogueNPCCount ) { v0 = dialog_menu_id; - if ( dialog_menu_id != 2 - && dialog_menu_id != 3 - && dialog_menu_id != 97 - && dialog_menu_id != 5 - && dialog_menu_id != 4 + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD + && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL + && dialog_menu_id != HOUSE_DIALOGUE_97 + && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR + && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY && ShopTexture ) { ShopTexture->Release(); @@ -1943,7 +1943,7 @@ if ( v0 == 3 || v0 == 5 || v0 == 4 ) { UI_CreateEndConversationButton(); - dialog_menu_id = 94; + dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; sub_4B3AD4(in_current_building_type); } else @@ -1952,26 +1952,26 @@ { pVideoPlayer->_4BF5B2(); //LABEL_28: - dialog_menu_id = 1; + dialog_menu_id = HOUSE_DIALOGUE_MAIN; sub_4B3B42(in_current_building_type); return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - dialog_menu_id = 101; + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; sub_4B3A72(in_current_building_type); } return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - dialog_menu_id = 1; + dialog_menu_id = HOUSE_DIALOGUE_MAIN; sub_4B3B42(in_current_building_type); return 1; } pDialogueNPCCount = 0; pDialogueWindow->Release(); - dialog_menu_id = 0; + dialog_menu_id = HOUSE_DIALOGUE_NULL; pDialogueWindow = 0; pIcons_LOD->_40F9C5(); v1 = uNumDialogueNPCPortraits; @@ -2039,14 +2039,14 @@ void *v30; // eax@50 int v31; // ecx@50 ItemGen *v32; // esi@51 - float v33; // ST1C_4@53 - signed int v34; // eax@53 - int v35; // eax@53 - bool v36; // eax@53 + //float v33; // ST1C_4@53 + //signed int v34; // eax@53 + //int v35; // eax@53 + //bool v36; // eax@53 unsigned int v37; // eax@53 int v38; // eax@55 int v39; // eax@63 - int v40; // eax@64 + //int v40; // eax@64 int v41; // edx@66 int v42; // esi@74 signed int v43; // ebx@74 @@ -2063,7 +2063,7 @@ unsigned int v54; // [sp+0h] [bp-B4h]@25 int v55; // [sp+0h] [bp-B4h]@26 int v56; // [sp+0h] [bp-B4h]@36 - POINT v57; // [sp+10h] [bp-A4h]@49 + //POINT v57; // [sp+10h] [bp-A4h]@49 //POINT v58; // [sp+18h] [bp-9Ch]@18 POINT v59; // [sp+20h] [bp-94h]@49 POINT v60; // [sp+28h] [bp-8Ch]@9 @@ -2079,7 +2079,7 @@ POINT v70; // [sp+78h] [bp-3Ch]@9 POINT v71; // [sp+80h] [bp-34h]@31 POINT v72; // [sp+88h] [bp-2Ch]@10 - bool v73; // [sp+90h] [bp-24h]@53 + //bool v73; // [sp+90h] [bp-24h]@53 int v74; // [sp+94h] [bp-20h]@53 int a6; // [sp+98h] [bp-1Ch]@57 int a3; // [sp+9Ch] [bp-18h]@53 @@ -2108,15 +2108,16 @@ pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); return; } + switch(dialog_menu_id) { - case 94: + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; sub_421EA6_OnInventoryLeftClick(); break; } - case 18: + case HOUSE_DIALOGUE_GULD_BUY_BOOKS: { v17 = pMouse->GetCursorPos(&v63); v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; @@ -2128,7 +2129,7 @@ v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier; _this = v20; v22 = v20->GetValue(); - v23 = v0->_4B8142(v22, v21); + v23 = v0->GetBuyingPrice(v22, v21); v80 = v23; GetAsyncKeyState(VK_CONTROL); if ( pParty->uNumGold < v23 ) @@ -2165,7 +2166,8 @@ ShowStatusBarString(v9, v54); break; } - case 3: + + case HOUSE_DIALOGUE_SHOP_SELL: { v14 = pMouse->GetCursorPos(&v71)->x - 14; v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); @@ -2199,7 +2201,7 @@ break; } - case 4: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: { pMouse->GetCursorPos(&v62); v10 = v62.x - 14; @@ -2250,7 +2252,9 @@ } break; } - case 5: + + + case HOUSE_DIALOGUE_SHOP_REPAIR: { v1 = pMouse->GetCursorPos(&a2)->x - 14; v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); @@ -2317,20 +2321,21 @@ } break; } - case 2: - case 95: + + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { //LABEL_49: v28 = pMouse->GetCursorPos(&v59); - v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; + v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[v28->y]] & 0xFFFF; if ( !v29 ) return; v30 = window_SpeakInHouse->ptr_1C; // v31 = 9 * (v29 - 1 + 12 * (int)v30); - if ( dialog_menu_id == 2 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { - v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1]; - _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1]; + v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1]; + _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1]; } else { @@ -2338,23 +2343,23 @@ v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; } //v33 = p2DEvents_minus1__20[13 * (signed int)v30]; - v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; - v34 = v32->GetValue(); - v80 = v0->_4B8142(v34, v33); - LOWORD(v35) = GetAsyncKeyState(VK_CONTROL); - v74 = v35; - v36 = v0->CanSteal(); + //v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; + //v34 = v32->GetValue(); + v80 = v0->GetBuyingPrice(v32->GetValue(), p2DEvents[(unsigned int)v30 - 1].fPriceMultiplier); + //LOWORD(v35) = GetAsyncKeyState(VK_CONTROL); + v74 = GetAsyncKeyState(VK_CONTROL); + //v36 = v0->CanSteal(); uNumSeconds = 0; a3 = 0; - v73 = v36; + //v73 = v0->CanSteal(); v37 = pMapStats->GetMapInfo(pCurrentMapName); if ( v37 ) a3 = pMapStats->pInfos[v37]._steal_perm; v38 = GetPartyReputation(); v26 = 1; - if ( v73 == 1 ) + if (v0->CanSteal()) { - if ( (short)v74 ) + if ( v74 ) { uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6); if ( !uNumSeconds ) @@ -2372,7 +2377,7 @@ if ( uNumSeconds != 1 ) { PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24); - v9 = pGlobalTXT_LocalizationStrings[155]; + v9 = pGlobalTXT_LocalizationStrings[155]; // "You don't have enough gold" v54 = 2; ShowStatusBarString(v9, v54); return; @@ -2383,17 +2388,19 @@ if ( v39 ) { v32->SetIdentified(); - v7 = v73 == 1; - v40 = (int)((char *)v0 + 36 * v39); - memcpy((void *)(v40 + 496), v32, 0x24u); + v7 = v0->CanSteal(); + //v40 = (int)((char *)v0 + 36 * v39); + //memcpy((void *)(v40 + 496), v32, 0x24u); + memcpy(&v0->pInventoryItems[v39 - 1], v32, sizeof(ItemGen)); if ( v7 ) { - if ( (short)v74 ) + if ( v74 ) { v41 = uNumSeconds; if ( uNumSeconds == 1 || uNumSeconds == 2 ) { - *(char *)(v40 + 517) |= 1u; + //*(char *)(v40 + 517) |= 1u; + v0->pInventoryItems[v39 - 1].SetStolen(); sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); viewparams->bRedrawGameUI = v26; _this->Reset(); @@ -2429,6 +2436,7 @@ default: { + __debugbreak(); // please do record these dialogue ids to the HOUSE_DIALOGUE_MENU enum if( dialog_menu_id >= 36 && dialog_menu_id <= 72 ) { v42 = dialog_menu_id - 36; @@ -9439,11 +9447,11 @@ uint uWinCenteredPosY = (uDesktopHeight - uTotalWinHeight) / 2; uWindowX = ReadWindowsRegistryInt("window X", uWinCenteredPosX); - uWindowX = 0; + uWindowX = uDesktopWidth / 2 - 640 / 2; WriteWindowsRegistryInt("window X", uWindowX); uWindowY = ReadWindowsRegistryInt("window Y", uWinCenteredPosY); - uWindowY = 0; + uWindowY = uDesktopHeight / 2 - 480 / 2; WriteWindowsRegistryInt("window Y", uWindowY); hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and MagicŪ VII", @@ -9457,7 +9465,144 @@ SetWindowTextW(hWnd, L"Might and MagicŪ VII"); HMENU menu = CreateMenu(); - AppendMenuW(menu, MF_ENABLED | MF_STRING, 0x101, L"Open level..."); + { + HMENU file = CreatePopupMenu(); + AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)file, L"&File"); + { + AppendMenuW(file, MF_ENABLED | MF_STRING, 40001, L"Exit"); + } + + HMENU debug = CreatePopupMenu(); + AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug, L"&Debug"); + { + HMENU debug_party = CreatePopupMenu(); + AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party, L"&Party"); + { + AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40007, L"Give Gold (10 000)"); + AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40008, L"Give Exp (20 000)"); + AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40059, L"Give Skills (50 each)"); + AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40013, L"Remove Gold"); + + HMENU debug_party_setconditions = CreatePopupMenu(); + AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_setconditions, L"Set Condition"); + { + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40044, L"Afraid"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40043, L"Asleep"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40037, L"Curse"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40036, L"Disease1"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40035, L"Disease2"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40034, L"Disease3"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40041, L"Dead"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40039, L"Drunk"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40042, L"Eradicated"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40038, L"Insane"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40045, L"Paralyzed"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40033, L"Poison1"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40032, L"Poison2"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40031, L"Poison3"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40029, L"&Stone"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40040, L"Unconscious"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40030, L"Weak"); + AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40073, L"Zombie"); + } + + AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40006, L"Set Food (20)"); + + HMENU debug_party_alignment = CreatePopupMenu(); + AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_alignment, L"Alignment"); + { + AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40062, L"Good"); + AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING | MF_CHECKED, 40063, L"Neutral"); + AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40064, L"Evil"); + } + } + + HMENU debug_time = CreatePopupMenu(); + AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_time, L"&Time"); + { + AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40009, L"Add 1 Day"); + AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40010, L"Add 1 Week"); + AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40011, L"Add 1 Month"); + AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40012, L"Add 1 Year"); + } + + HMENU debug_items = CreatePopupMenu(); + AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_items, L"&Items"); + { + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40015, L"Generate level &1 item"); + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40016, L"Generate level &2 item"); + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40017, L"Generate level &3 item"); + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40018, L"Generate level &4 item"); + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40019, L"Generate level &5 item"); + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40020, L"Generate level &6 item"); + AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40061, L"Generate special item"); + } + + HMENU debug_graphics = CreatePopupMenu(); + AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_graphics, L"&Graphics"); + { + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40023, L"Lighting Mode"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40024, L"Lighting Geometry"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40104, L"Lights Off"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40105, L"Colored Lights"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40025, L"Debug Lights"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40101, L"Debug Decals"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40027, L"HWID Portals"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40047, L"SWID Portals"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40051, L"OD Frustum"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40054, L"SWOD Constant Redraw"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40055, L"SWOD Lit Rasterizer"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40056, L"Party Light off"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40060, L"SWOD Nice Lighting off"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40067, L"HWOD Additive Fog Lights"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40072, L"HWID Nice Lighting"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40048, L"Wireframe"); + AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40049, L"Fog"); + } + + HMENU debug_misc = CreatePopupMenu(); + AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_misc, L"&Misc"); + { + AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40066, L"Object Viewcone Culling"); + AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40068, L"Red Tint"); + AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40071, L"Display Secrets"); + AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40102, L"Massive Bloodsplat"); + AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40103, L"Underwater Gravity"); + } + + HMENU debug_eax = CreatePopupMenu(); + AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_eax, L"EAX Environs"); + { + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40074, L"NONE"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40075, L"GENERIC"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40076, L"PADDEDCELL"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40077, L"ROOM"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40078, L"BATHROOM"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40079, L"LIVINGROOM"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40080, L"STONEROOM"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40081, L"AUDITORIUM"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40082, L"CONCERTHALL"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40083, L"CAVE"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40084, L"ARENA"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40085, L"HANGAR"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40086, L"CARPETEDHALLWAY"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40087, L"HALLWAY"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40088, L"STONECORRIDOR"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40089, L"ALLEY"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40090, L"FOREST"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40091, L"CITY"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40092, L"MOUNTAINS"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40093, L"QUARRY"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40094, L"PLAIN"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40095, L"PARKINGLOT"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40096, L"SEWERPIPE"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40097, L"UNDERWATER"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40098, L"DRUGGED"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40099, L"DIZZY"); + AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40100, L"PSICHOTIC"); + } + } + } SetMenu(hWnd, menu); SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
--- a/mm7_4.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/mm7_4.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -4666,7 +4666,7 @@ v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; v27 = *v26; v28 = a3->GetValue(); - v29 = pPlayer->_4B8142(v28, v27); + v29 = pPlayer->GetBuyingPrice(v28, v27); if ( a5 == 3 ) { v35 = *v26; @@ -7246,11 +7246,11 @@ return; if ( in_current_building_type <= BildingType_AlchemistShop ) { - if ( dialog_menu_id != 2 ) - { - if ( dialog_menu_id <= 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) + { + if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_BUY_STANDARD) return; - if ( dialog_menu_id <= 5 || dialog_menu_id == 94 ) + if ( dialog_menu_id <= HOUSE_DIALOGUE_SHOP_REPAIR || dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) { v8 = pMouse->GetCursorPos(&v15)->x - 14; v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); @@ -7263,7 +7263,7 @@ GameUI_DrawItemInfo(v7); return; } - if ( dialog_menu_id != 95 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) return; } v4 = pMouse->GetCursorPos(&v11); @@ -7273,12 +7273,12 @@ return; v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); - if ( dialog_menu_id != 2 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; goto LABEL_15; } - if ( in_current_building_type <= BildingType_16 && dialog_menu_id == BildingType_18 ) + if ( in_current_building_type <= BildingType_16 && dialog_menu_id == HOUSE_DIALOGUE_GULD_BUY_BOOKS ) { v1 = pMouse->GetCursorPos(&a2); v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; @@ -7786,7 +7786,7 @@ pParty->field_709 = 0; Party__CountHirelings(); PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); - dialog_menu_id = 1; + dialog_menu_id = HOUSE_DIALOGUE_MAIN; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -8772,7 +8772,7 @@ //----- (004B3EF0) -------------------------------------------------------- void DrawJoinGuildWindow( int pEventCode ) - { +{ uDialogueType = 81;//enum JoinGuildDialog ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; ContractSelectText(pEventCode); @@ -8783,7 +8783,7 @@ pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dialog_menu_id = -1; + dialog_menu_id = HOUSE_DIALOGUE_OTHER; } // F8B19C: using guessed type int dword_F8B19C; @@ -8809,7 +8809,7 @@ v2 = pGlobalTXT_LocalizationStrings[535]; pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dialog_menu_id = -1; + dialog_menu_id = HOUSE_DIALOGUE_OTHER; } // F8B19C: using guessed type int dword_F8B19C; // F8B1A8: using guessed type int dword_F8B1A8; @@ -8838,7 +8838,7 @@ pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0); //"Hire" pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); - dialog_menu_id = -1; + dialog_menu_id = HOUSE_DIALOGUE_OTHER; } @@ -8875,7 +8875,7 @@ else { v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; - if ( dialog_menu_id == -1 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_OTHER ) { pDialogueWindow->Release(); } @@ -8958,7 +8958,7 @@ pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } - dialog_menu_id = 1; + dialog_menu_id = HOUSE_DIALOGUE_MAIN; } } @@ -9381,7 +9381,7 @@ v4 = v3 / 3; v32 = v3 / 3; } - if ( dialog_menu_id != 1 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -9393,7 +9393,7 @@ //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] - + __debugbreak(); // whacky condition - fix if (false //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) @@ -9620,7 +9620,7 @@ s1 = v4 * (100 - v1->GetMerchant()) / 100; if ( (signed int)s1 < v4 / 3 ) s1 = v4 / 3; - if ( dialog_menu_id == 1 ) + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -9744,7 +9744,7 @@ } else { - if ( dialog_menu_id > 104 && dialog_menu_id <= 108 ) + if ( dialog_menu_id > HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT && dialog_menu_id <= HOUSE_DIALOGUE_108 ) { if ( pParty->uNumGold < s1 ) { @@ -9843,7 +9843,7 @@ } else { - dialog_menu_id = 1; + dialog_menu_id = HOUSE_DIALOGUE_MAIN; pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } }
--- a/mm7_data.cpp Sat Mar 23 00:50:58 2013 +0400 +++ b/mm7_data.cpp Sat Mar 23 00:53:15 2013 +0400 @@ -2227,8 +2227,6 @@ __int16 word_F8B158[777]; // weak struct Texture *ShopTexture; // idb struct Texture *ItemsInShopTexture[12]; -int in_current_building_type; // 0xF8B198 -int dialog_menu_id; // weak __int16 word_F8B1A0; // weak const char *dword_F8B1A4; // idb int contract_approved; // weak
--- a/mm7_data.h Sat Mar 23 00:50:58 2013 +0400 +++ b/mm7_data.h Sat Mar 23 00:53:15 2013 +0400 @@ -1683,8 +1683,6 @@ extern __int16 word_F8B158[]; // weak extern struct Texture *ShopTexture; // idb extern struct Texture *ItemsInShopTexture[12]; -extern int in_current_building_type; // weak -extern int dialog_menu_id; // weak extern __int16 word_F8B1A0; // weak extern const char *dword_F8B1A4; // idb extern int contract_approved; // weak