Mercurial > mm7
comparison UI/UIHouses.cpp @ 1393:28f87f5234a1
More hardcoded UI colors moved to varibables.
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 16:11:57 +0200 |
parents | ae6c8e1ddef4 |
children | e6908823897f |
comparison
equal
deleted
inserted
replaced
1392:e3e9c0467529 | 1393:28f87f5234a1 |
---|---|
311 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, | 311 {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, |
312 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, | 312 {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, |
313 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, | 313 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, |
314 {"Player Castle Bad", 0x24, 0, 25, 0, 0} | 314 {"Player Castle Bad", 0x24, 0, 25, 0, 0} |
315 }}; | 315 }}; |
316 | |
317 | |
318 //----- (004B1784) -------------------------------------------------------- | |
319 bool __cdecl HouseUI_CheckIfPlayerCanInteract() | |
320 { | |
321 Player *pPlayer; // ebx@1 | |
322 bool result; // eax@2 | |
323 int v3; // eax@3 | |
324 GUIWindow v4; // [sp+4h] [bp-54h]@3 | |
325 | |
326 pPlayer = pPlayers[uActiveCharacter]; | |
327 if ( pPlayer->CanAct() ) | |
328 { | |
329 pDialogueWindow->pNumPresenceButton = dword_F8B1E0; | |
330 result = 1; | |
331 } | |
332 else | |
333 { | |
334 pDialogueWindow->pNumPresenceButton = 0; | |
335 memcpy(&v4, pPrimaryWindow, sizeof(v4)); | |
336 v4.uFrameX = 483; | |
337 v4.uFrameWidth = 148; | |
338 v4.uFrameZ = 334; | |
339 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// | |
340 // "%s is in no condition to %s" | |
341 // "do anything" | |
342 v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0); | |
343 v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, ui_house_player_cant_interact_color, pTmpBuf.data(), 3u); | |
344 result = 0; | |
345 } | |
346 return result; | |
347 } | |
316 | 348 |
317 //----- (0044622E) -------------------------------------------------------- | 349 //----- (0044622E) -------------------------------------------------------- |
318 bool EnterHouse(enum HOUSE_ID uHouseID) | 350 bool EnterHouse(enum HOUSE_ID uHouseID) |
319 { | 351 { |
320 //enum HOUSE_ID v1; // edi@1 | 352 //enum HOUSE_ID v1; // edi@1 |
1677 s1 = v4 * (100 - v1->GetMerchant()) / 100; | 1709 s1 = v4 * (100 - v1->GetMerchant()) / 100; |
1678 if ( (signed int)s1 < v4 / 3 ) | 1710 if ( (signed int)s1 < v4 / 3 ) |
1679 s1 = v4 / 3; | 1711 s1 = v4 / 3; |
1680 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) | 1712 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) |
1681 { | 1713 { |
1682 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 1714 if ( HouseUI_CheckIfPlayerCanInteract() ) |
1683 { | 1715 { |
1684 v16 = pDialogueWindow; | 1716 v16 = pDialogueWindow; |
1685 v58 = 255; | 1717 v58 = 255; |
1686 v62 = 0; | 1718 v62 = 0; |
1687 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; | 1719 v17 = LOBYTE(pFontArrus->uFontHeight) - 3; |
2361 | 2393 |
2362 switch(dialog_menu_id) | 2394 switch(dialog_menu_id) |
2363 { | 2395 { |
2364 case HOUSE_DIALOGUE_MAIN: | 2396 case HOUSE_DIALOGUE_MAIN: |
2365 { | 2397 { |
2366 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 2398 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
2367 return; | 2399 return; |
2368 | 2400 |
2369 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite); | 2401 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? pColorYellow : pColorWhite); |
2370 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold | 2402 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold |
2371 strcat(pTopic1, pTmpBuf2.data()); | 2403 strcat(pTopic1, pTmpBuf2.data()); |
2524 break; | 2556 break; |
2525 } | 2557 } |
2526 | 2558 |
2527 case HOUSE_DIALOGUE_LEARN_SKILLS: | 2559 case HOUSE_DIALOGUE_LEARN_SKILLS: |
2528 { | 2560 { |
2529 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 2561 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
2530 return; | 2562 return; |
2531 v0 = 0; | 2563 v0 = 0; |
2532 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 2564 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
2533 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100; | 2565 pItemNum = v9 * (100 - pPlayer->GetMerchant()) / 100; |
2534 if ( pItemNum < v9 / 3 ) | 2566 if ( pItemNum < v9 / 3 ) |
2625 break; | 2657 break; |
2626 } | 2658 } |
2627 | 2659 |
2628 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | 2660 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: |
2629 { | 2661 { |
2630 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 2662 if ( HouseUI_CheckIfPlayerCanInteract() ) |
2631 { | 2663 { |
2632 v48 = 2; | 2664 v48 = 2; |
2633 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; | 2665 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; |
2634 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; | 2666 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; |
2635 pOutString = 0; | 2667 pOutString = 0; |
2762 { | 2794 { |
2763 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) | 2795 if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) |
2764 { | 2796 { |
2765 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | 2797 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) |
2766 { | 2798 { |
2767 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 2799 if ( HouseUI_CheckIfPlayerCanInteract() ) |
2768 { | 2800 { |
2769 v4 = pDialogueWindow; | 2801 v4 = pDialogueWindow; |
2770 v61 = pDialogueWindow; | 2802 v61 = pDialogueWindow; |
2771 v5 = window_SpeakInHouse->ptr_1C; | 2803 v5 = window_SpeakInHouse->ptr_1C; |
2772 v66 = 0; | 2804 v66 = 0; |
3169 if ( v11 < v10 / 3 ) | 3201 if ( v11 < v10 / 3 ) |
3170 v11 = v10 / 3; | 3202 v11 = v10 / 3; |
3171 //i = v11; | 3203 //i = v11; |
3172 } | 3204 } |
3173 | 3205 |
3174 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | 3206 if (HouseUI_CheckIfPlayerCanInteract()) |
3175 { | 3207 { |
3176 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) | 3208 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) |
3177 { | 3209 { |
3178 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | 3210 if ( dialog_menu_id != HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) |
3179 { | 3211 { |
3180 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) | 3212 if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) |
3181 { | 3213 { |
3182 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | 3214 if (HouseUI_CheckIfPlayerCanInteract()) |
3183 { | 3215 { |
3184 //i = 0; | 3216 //i = 0; |
3185 int _v0 = 0; | 3217 int _v0 = 0; |
3186 v13 = pDialogueWindow; | 3218 v13 = pDialogueWindow; |
3187 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); | 3219 //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); |
3266 } | 3298 } |
3267 } | 3299 } |
3268 } | 3300 } |
3269 return; | 3301 return; |
3270 } | 3302 } |
3271 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 3303 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
3272 { | 3304 { |
3273 //v31 = pNPCTopics[122].pText; | 3305 //v31 = pNPCTopics[122].pText; |
3274 //v32 = color2; | 3306 //v32 = color2; |
3275 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); | 3307 v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); |
3276 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3); | 3308 v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, color2, pNPCTopics[122].pText, 3); |
3359 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); | 3391 v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); |
3360 v63 = 3; | 3392 v63 = 3; |
3361 goto LABEL_55; | 3393 goto LABEL_55; |
3362 } | 3394 } |
3363 | 3395 |
3364 if (sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) | 3396 if (HouseUI_CheckIfPlayerCanInteract()) |
3365 { | 3397 { |
3366 v43 = pDialogueWindow; | 3398 v43 = pDialogueWindow; |
3367 v72 = 0; | 3399 v72 = 0; |
3368 pShopOptions[0] = pTmpBuf.data(); | 3400 pShopOptions[0] = pTmpBuf.data(); |
3369 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" | 3401 pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" |
3491 v4 = v3 / 3; | 3523 v4 = v3 / 3; |
3492 v32 = v3 / 3; | 3524 v32 = v3 / 3; |
3493 } | 3525 } |
3494 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) | 3526 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
3495 { | 3527 { |
3496 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 3528 if ( HouseUI_CheckIfPlayerCanInteract() ) |
3497 { | 3529 { |
3498 v5 = 0; | 3530 v5 = 0; |
3499 | 3531 |
3500 __debugbreak(); | 3532 __debugbreak(); |
3501 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] | 3533 //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] |
3550 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); | 3582 v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); |
3551 pDialogueWindow->pNumPresenceButton = 0; | 3583 pDialogueWindow->pNumPresenceButton = 0; |
3552 return ; | 3584 return ; |
3553 } | 3585 } |
3554 | 3586 |
3555 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) | 3587 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
3556 return; | 3588 return; |
3557 v8 = pDialogueWindow; | 3589 v8 = pDialogueWindow; |
3558 v33 = 0; | 3590 v33 = 0; |
3559 v34 = 0; | 3591 v34 = 0; |
3560 v29 = pDialogueWindow; | 3592 v29 = pDialogueWindow; |