Mercurial > mm7
diff UIHouses.cpp @ 772:6fef3dae2551
Слияние
author | Ritor1 |
---|---|
date | Sat, 23 Mar 2013 22:23:18 +0600 |
parents | b2468462a360 |
children | cf2fbac6edc9 |
line wrap: on
line diff
--- a/UIHouses.cpp Sat Mar 23 22:23:05 2013 +0600 +++ b/UIHouses.cpp Sat Mar 23 22:23:18 2013 +0600 @@ -409,7 +409,7 @@ dword_F8B1E4 = 0; dword_F8B1F4 = 0; memset(byte_F8B1F0, 0, 4); - memset(byte_F8B148, 0, 16); + memset(player_levels, 0, 16); pRenderer->ClearZBuffer(0, 479); if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| @@ -738,7 +738,7 @@ } if ( v1 > pParty->uNumGold ) { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); v2 = pParty->uNumGold; } if ( v2 > pParty->uFine ) @@ -834,7 +834,7 @@ } if ( v6 > pParty->uNumGold ) { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); v7 = pParty->uNumGold; } if ( v7 ) @@ -881,7 +881,7 @@ { if ( v2 > pParty->uNumGoldInBank ) { - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); v3 = pParty->uNumGoldInBank; } if ( v3 ) @@ -1194,7 +1194,7 @@ { Party::TakeGold((unsigned int)pOutString); v27 = (int)window_SpeakInHouse->ptr_1C; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); dialog_menu_id = HOUSE_DIALOGUE_NULL; sub_4BD8B5(); sub_4B1D27(); @@ -1553,7 +1553,7 @@ v106.x = 0; do { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v106.x; ++v55; } @@ -2056,7 +2056,7 @@ v114 = 0; do { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) { v46 = ItemsInShopTexture[v114]; v47 = 152 - v46->uTextureHeight; @@ -2083,7 +2083,7 @@ v114 = 0; do { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID) { v50 = ItemsInShopTexture[v114 + 6]; v51 = 308 - v50->uTextureHeight; @@ -2116,7 +2116,7 @@ v109 = 0; do { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) ++v109; ++v62; } @@ -2702,7 +2702,7 @@ v149 = 0; for(int i=0; i<8; ++i) { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) ++v149; } @@ -3242,7 +3242,7 @@ if ( pParty->uNumGold < v63 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); } else { @@ -3726,7 +3726,7 @@ { LABEL_55: ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); goto LABEL_46; } Party::TakeGold(v2); @@ -3844,7 +3844,7 @@ } //----- (004B4710) -------------------------------------------------------- -int __cdecl TrainingDialog() +void TrainingDialog() { //Player *v0; // ebx@1 int color2; // eax@1 @@ -3858,7 +3858,7 @@ double v9; // st7@6 signed int v10; // esi@6 int v11; // ecx@6 - int result; // eax@9 + //int result; // eax@9 GUIWindow *v13; // edi@14 signed int v14; // esi@14 unsigned int v15; // esi@16 @@ -3874,29 +3874,29 @@ unsigned int v25; // ecx@28 int v26; // eax@28 unsigned __int16 v27; // ax@28 - int v28; // eax@32 + //int v28; // eax@32 unsigned __int16 v29; // ST14_2@34 int v30; // eax@34 - const char *v31; // ST18_4@36 - unsigned __int16 v32; // ST14_2@36 + //const char *v31; // ST18_4@36 + //unsigned __int16 v32; // ST14_2@36 int v33; // eax@36 int v34; // eax@37 unsigned int v35; // edi@38 unsigned int v36; // eax@38 - int v37; // ecx@41 - char *v38; // eax@41 - int *v39; // eax@45 + //int v37; // ecx@41 + //char *v38; // eax@41 + //int *v39; // eax@45 unsigned int v40; // eax@46 - void *v41; // ecx@46 + //void *v41; // ecx@46 unsigned int v42; // eax@46 GUIWindow *v43; // ecx@59 int v44; // edx@59 char **v45; // esi@60 - int v46; // eax@62 + //int v46; // eax@62 int v47; // eax@68 - int v48; // edx@69 + //int v48; // edx@69 int v49; // ebx@69 - unsigned __int8 v50; // sf@69 + //unsigned __int8 v50; // sf@69 char **v51; // edi@70 GUIButton *v52; // eax@71 GUIButton *v53; // esi@71 @@ -3905,12 +3905,12 @@ int v56; // eax@71 unsigned __int16 v57; // ax@71 unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 - const char *v59; // [sp-Ch] [bp-90h]@63 + //const char *v59; // [sp-Ch] [bp-90h]@63 char *v60; // [sp-8h] [bp-8Ch]@38 - char *v61; // [sp-8h] [bp-8Ch]@63 + //char *v61; // [sp-8h] [bp-8Ch]@63 unsigned int v62; // [sp-4h] [bp-88h]@38 int v63; // [sp-4h] [bp-88h]@52 - char *v64; // [sp-4h] [bp-88h]@63 + //char *v64; // [sp-4h] [bp-88h]@63 GUIWindow v65; // [sp+Ch] [bp-78h]@1 //__int64 v66; // [sp+60h] [bp-24h]@3 unsigned int white; // [sp+68h] [bp-1Ch]@1 @@ -3926,7 +3926,7 @@ v65.uFrameX = 483; v65.uFrameWidth = 148; v65.uFrameZ = 334; - white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255); color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); //v71 = color2; //v2 = v0->uLevel; @@ -3938,7 +3938,7 @@ v5 = 1000ui64 * pPlayers[uActiveCharacter]->uLevel * (pPlayers[uActiveCharacter]->uLevel + 1) / 2; // E n = n(n + 1) / 2 //v6 = HIDWORD(v0->uExperience); //v7 = window_SpeakInHouse->ptr_1C; - v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - 89]; + v68 = pMaxLevelPerTrainingHallType[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_TRAINING_HALL_EMERALD_ISLE]; //v66 = 1000 * v3; if (pPlayers[uActiveCharacter]->uExperience >= v5) { @@ -3955,18 +3955,16 @@ v11 = v10 / 3; //i = v11; } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) + + if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) { if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_17 ) + if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) { - result = 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 ) + if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) { //i = 0; int _v0 = 0; @@ -4000,11 +3998,11 @@ v73 = (signed int)(149 - _v0) / v72; if ( v73 > 32 ) v73 = 32; - result = v13->pStartingPosActiveItem; + //result = v13->pStartingPosActiveItem; v19 = (signed int)(149 - v72 * v73 - _v0) / 2 - v73 / 2 + 162; - int _v1 = result; + int _v1 = v13->pStartingPosActiveItem; v68 = v19; - if ( result < result + v13->pNumPresenceButton ) + if (v13->pStartingPosActiveItem < v13->pStartingPosActiveItem + v13->pNumPresenceButton ) { v72 = 2; do @@ -4034,12 +4032,10 @@ v27 = white; v65.DrawTitleText(pFontArrus, 0, v25, v27, v23, 3u); } - v28 = v13->pStartingPosActiveItem; ++_v1; - result = v13->pNumPresenceButton + v28; ++v72; } - while ( (signed int)_v1 < result ); + while ( (signed int)_v1 < v13->pStartingPosActiveItem + v13->pNumPresenceButton ); } } else @@ -4051,21 +4047,20 @@ strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." v29 = color2; v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0); - result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); + (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); } } } - return result; + return; } if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { - v31 = pNPCTopics[122].pText; - v32 = color2; + //v31 = pNPCTopics[122].pText; + //v32 = color2; v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); - v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3); - result = (int)pDialogueWindow; + v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3); pDialogueWindow->pNumPresenceButton = 0; - return result; + return; } v34 = pPlayers[uActiveCharacter]->uLevel; if ( v34 < v68 ) @@ -4075,28 +4070,28 @@ if ( pParty->uNumGold >= v11) { Party::TakeGold(v11); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); ++pPlayers[uActiveCharacter]->uLevel; pPlayers[uActiveCharacter]->uSkillPoints += pPlayers[uActiveCharacter]->uLevel / 10 + 5; pPlayers[uActiveCharacter]->sHealth = pPlayers[uActiveCharacter]->GetMaxHealth(); pPlayers[uActiveCharacter]->sMana = pPlayers[uActiveCharacter]->GetMaxMana(); - v37 = 0; - v38 = byte_F8B148; - do + + uint max_level_in_party = player_levels[0]; + for (uint _it = 1; _it < 4; ++_it) { - if ( *(int *)v38 > v37 ) - v37 = *(int *)v38; - v38 += 4; + if (player_levels[_it] > max_level_in_party) + max_level_in_party = player_levels[_it]; } - while ( (signed int)v38 < (signed int)word_F8B158 ); - v39 = &dword_F8B144 + uActiveCharacter; - ++*v39; - if ( *v39 > v37 ) + + ++player_levels[uActiveCharacter - 1]; + if (player_levels[uActiveCharacter - 1] > max_level_in_party) // if we reach new maximum party level + // feature is broken thou, since this array is always zeroed in EnterHouse { - v40 = sub_494820(pParty->uCurrentHour); - v41 = window_SpeakInHouse->ptr_1C; + v40 = _494820_training_time(pParty->uCurrentHour); + //v41 = window_SpeakInHouse->ptr_1C; v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; - if ( v41 == (void *)94 || v41 == (void *)95 ) + if ((unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_94 || + (unsigned int)window_SpeakInHouse->ptr_1C == HOUSE_TRAINING_HALL_95) v42 += 720; RestAndHeal((signed int)(v42 + 10080)); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) @@ -4107,7 +4102,7 @@ // "%s is now Level %lu and has earned %lu Skill Points!" ShowStatusBarString(pTmpBuf, 2); pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return true; + return; } ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold" v63 = 4; @@ -4125,7 +4120,7 @@ } return result;*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return 1; // void function actually + return; } sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[538], (unsigned int)(v5 - pPlayers[uActiveCharacter]->uExperience), v34 + 1);// // "You need %d more experience to train to level %d" @@ -4150,8 +4145,8 @@ v63 = 3; goto LABEL_55; } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) + + if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) { v43 = pDialogueWindow; v72 = 0; @@ -4164,31 +4159,21 @@ v45 = pShopOptions; do { - if ( v43->GetControl(v73)->uControlParam == 17 ) + if ( v43->GetControl(v73)->uControlParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) { - v46 = pPlayers[uActiveCharacter]->uLevel; - if ( v46 < v68 ) - { - if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < v5 ) - { - v64 = (char *)(v46 + 1); - v61 = (char *)(v5 - LODWORD(pPlayers[uActiveCharacter]->uExperience)); - v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d" - } - else - { - v64 = (char *)v11; - v61 = (char *)(v46 + 1); - v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold" - } - } + //v46 = pPlayers[uActiveCharacter]->uLevel; + if (pPlayers[uActiveCharacter]->uLevel >= v68) + sprintfex(*v45, "%s\n \n%s", + pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]); //"With your skills, you should be working here as a teacher." "Sorry, but we are unable to train you." else { - v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you."" - v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher."" - v59 = "%s\n \n%s"; + if (pPlayers[uActiveCharacter]->uExperience < v5) + sprintfex(*v45, pGlobalTXT_LocalizationStrings[538], // "You need %d more experience to train to level %d" + (uint)(v5 - pPlayers[uActiveCharacter]->uExperience), pPlayers[uActiveCharacter]->uLevel + 1); + else + sprintfex(*v45, pGlobalTXT_LocalizationStrings[537], // "Train to level %d for %d gold" + pPlayers[uActiveCharacter]->uLevel + 1, v11); } - sprintfex(*v45, v59, v61, v64); } v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); v43 = pDialogueWindow; @@ -4198,13 +4183,10 @@ } while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); } - //HIDWORD(v66) = (174 - v72) / 2; - result = v43->pStartingPosActiveItem; - v48 = result + v43->pNumPresenceButton; + v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; - v50 = -v43->pNumPresenceButton < 0; v73 = v43->pStartingPosActiveItem; - if ( v50 ^ result < v48 ) + if (v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton) { int _v3 = 2; v51 = pShopOptions; @@ -4227,13 +4209,11 @@ ++_v3; ++v51; ++v73; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; } - while ( v73 < result ); + while ( v73 < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton); } } } - return result; } @@ -4753,7 +4733,7 @@ do { // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) { v50 = ItemsInShopTexture[v49]; v51 = 152 - v50->uTextureHeight; @@ -4786,7 +4766,7 @@ do { //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID) { v54 = ItemsInShopTexture[v122 + 6]; v55 = 306 - v54->uTextureHeight; @@ -4882,12 +4862,12 @@ if ( result ) { v66 = 0; - v117 = 0; + v117 = 0;\ if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { do { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) ++v117; ++v66; }