Mercurial > mm7
comparison UI/UIHouses.cpp @ 1630:ee4a65ac9d21
TavernDialog cleared
author | Ritor1 |
---|---|
date | Tue, 17 Sep 2013 13:20:58 +0600 |
parents | 2149b14614ad |
children | 08ebd0fee604 ccde94f02b75 |
comparison
equal
deleted
inserted
replaced
1629:2149b14614ad | 1630:ee4a65ac9d21 |
---|---|
2385 // F8B19C: using guessed type int dword_F8B19C; | 2385 // F8B19C: using guessed type int dword_F8B19C; |
2386 | 2386 |
2387 //----- (004B8285) -------------------------------------------------------- | 2387 //----- (004B8285) -------------------------------------------------------- |
2388 void TavernDialog() | 2388 void TavernDialog() |
2389 { | 2389 { |
2390 int v0; | 2390 int pPriceRoom; |
2391 int pPriceFood; | |
2392 int pPriceSkill; | |
2391 int pItemNum; | 2393 int pItemNum; |
2392 double v2; // st7@1 | 2394 double v2; // st7@1 |
2393 signed int v3; // ebx@1 | |
2394 int v4; // ecx@1 | |
2395 int v5; // esi@3 | |
2396 signed int v6; // edi@5 | |
2397 int v7; // ecx@5 | |
2398 int pNumString; // edi@16 | 2395 int pNumString; // edi@16 |
2399 signed int v9; // esi@16 | 2396 signed int v9; // esi@16 |
2400 unsigned int pNumActiveItem; // esi@18 | |
2401 int v11; // eax@18 | |
2402 unsigned int v12; // eax@19 | |
2403 int v13; // eax@21 | |
2404 int v14; // ecx@26 | |
2405 int v17; // eax@28 | |
2406 char *v18; // eax@30 | |
2407 int v19; // eax@30 | |
2408 unsigned int v20; // ecx@30 | |
2409 int v21; // edx@30 | |
2410 int v22; // eax@30 | |
2411 unsigned __int16 v23; // ax@30 | |
2412 int v24; // eax@34 | |
2413 int v25; // eax@34 | |
2414 char *v26; // esi@36 | |
2415 int v27; // edi@46 | |
2416 unsigned int pColorText; // eax@57 | 2397 unsigned int pColorText; // eax@57 |
2417 signed int v31; // eax@59 | |
2418 int v34; // eax@64 | |
2419 int v35; // ecx@64 | |
2420 int v36; // esi@64 | |
2421 GUIButton *pButton; // eax@65 | 2398 GUIButton *pButton; // eax@65 |
2422 int v39; // edx@69 | 2399 int pSkillCount; |
2423 int v40; // ecx@69 | 2400 signed int pOptionsCount; // edi@77 |
2424 int v41; // ecx@69 | |
2425 int v42; // ecx@70 | |
2426 unsigned int v43; // edx@70 | |
2427 int v44; // edx@71 | |
2428 int v45; // ecx@71 | |
2429 int v46; // ecx@72 | |
2430 int v47; // eax@74 | |
2431 signed int v48; // edi@77 | |
2432 signed int i; // esi@79 | 2401 signed int i; // esi@79 |
2433 int v50; // eax@80 | |
2434 _QWORD v52; // qax@81 | |
2435 signed int v53; // edi@81 | 2402 signed int v53; // edi@81 |
2436 int v54; // edi@81 | 2403 int v54; // edi@81 |
2437 const char **v56; // eax@83 | 2404 const char *pText; // [sp-4h] [bp-278h]@93 |
2438 int v57; // eax@83 | |
2439 unsigned int v58; // ecx@83 | |
2440 unsigned __int16 v60; // ax@83 | |
2441 int v61; // eax@99 | |
2442 char *v63; // eax@99 | |
2443 GUIFont *v64; // edx@99 | |
2444 GUIFont *v65; // edi@100 | |
2445 unsigned int v66; // [sp-10h] [bp-284h]@75 | |
2446 unsigned __int16 v67; // [sp-Ch] [bp-280h]@75 | |
2447 int v68; // [sp-Ch] [bp-280h]@99 | |
2448 char *v69; // [sp-8h] [bp-27Ch]@75 | |
2449 int v70; // [sp-8h] [bp-27Ch]@99 | |
2450 unsigned int v71; // [sp-4h] [bp-278h]@75 | |
2451 const char *v72; // [sp-4h] [bp-278h]@93 | |
2452 unsigned int v73; // [sp-4h] [bp-278h]@99 | |
2453 char pTopic1[100]; // [sp+Ch] [bp-268h]@55 | 2405 char pTopic1[100]; // [sp+Ch] [bp-268h]@55 |
2454 char pTopic4[100]; // [sp+70h] [bp-204h]@59 | 2406 char pTopic4[100]; // [sp+70h] [bp-204h]@59 |
2455 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 | 2407 char pTopic2[100]; // [sp+D4h] [bp-1A0h]@57 |
2456 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 | 2408 char pTopic3[100]; // [sp+138h] [bp-13Ch]@59 |
2457 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 | 2409 GUIWindow dialog_window; // [sp+1F0h] [bp-84h]@1 |
2458 char *Str[2]; // [sp+244h] [bp-30h]@30 | 2410 int v91; // [sp+270h] [bp-4h]@3 |
2411 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 | |
2412 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 | |
2459 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 | 2413 unsigned __int8 pTopic3Height; // [sp+253h] [bp-21h]@59 |
2460 int v83; // [sp+254h] [bp-20h]@1 | |
2461 int all_text_height; // [sp+260h] [bp-14h]@18 | |
2462 unsigned __int8 v87; // [sp+266h] [bp-Eh]@59 | |
2463 unsigned __int8 pTopic2Height; // [sp+267h] [bp-Dh]@57 | |
2464 int v89; // [sp+268h] [bp-Ch]@1 | |
2465 unsigned int pTopic1Height; // [sp+26Fh] [bp-5h]@55 | |
2466 int v91; // [sp+270h] [bp-4h]@3 | |
2467 GUIFont *pOutString; | |
2468 unsigned __int8 pTopic4Height; | 2414 unsigned __int8 pTopic4Height; |
2469 int pTextHeight; | 2415 int pTextHeight; |
2416 int all_text_height; // [sp+260h] [bp-14h]@18 | |
2417 GUIFont *pOutString; | |
2470 | 2418 |
2471 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); | 2419 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); |
2472 dialog_window.uFrameX = 483; | 2420 dialog_window.uFrameX = 483; |
2473 dialog_window.uFrameWidth = 148; | 2421 dialog_window.uFrameWidth = 148; |
2474 dialog_window.uFrameZ = 334; | 2422 dialog_window.uFrameZ = 334; |
2475 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | 2423 v2 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2476 *(float *)&v83 = v2; | 2424 |
2477 *(float *)&v89 = v2 * v2; | 2425 pPriceRoom = ((v2 * v2) / 10) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2478 v3 = (signed __int64)(*(float *)&v89 * 0.1); | 2426 if ( pPriceRoom < ((v2 * v2) / 10) / 3 ) |
2479 pItemNum = v3 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 2427 pPriceRoom = ((v2 * v2) / 10) / 3; |
2480 if ( pItemNum < v3 / 3 ) | 2428 if ( pPriceRoom <= 0 ) |
2481 pItemNum = v3 / 3; | 2429 pPriceRoom = 1; |
2482 v5 = 1; | 2430 |
2483 pOutString = (GUIFont *)pItemNum; | 2431 pPriceFood = ((v2 * v2) * v2 / 100) * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2484 if ( pItemNum <= 0 ) | 2432 if ( pPriceFood < ((v2 * v2) * v2 / 100) / 3 ) |
2485 pOutString = (GUIFont *)1; | 2433 pPriceFood = ((v2 * v2) * v2 / 100) / 3; |
2486 v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998); | 2434 if ( pPriceFood <= 0 ) |
2487 v7 = v6 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 2435 pPriceFood = 1; |
2488 if ( v7 < v6 / 3 ) | 2436 |
2489 v7 = v6 / 3; | |
2490 v83 = v7; | |
2491 if ( v7 <= 0 ) | |
2492 { | |
2493 v7 = 1; | |
2494 v83 = 1; | |
2495 } | |
2496 | 2437 |
2497 switch(dialog_menu_id) | 2438 switch(dialog_menu_id) |
2498 { | 2439 { |
2499 case HOUSE_DIALOGUE_MAIN: | 2440 case HOUSE_DIALOGUE_MAIN: |
2500 { | 2441 { |
2501 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 2442 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
2502 return; | 2443 return; |
2503 | 2444 |
2504 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); | 2445 sprintf(pTopic1, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 2 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
2505 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pOutString); // Rent room for %d gold | 2446 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[178], pPriceRoom); // Rent room for %d gold |
2506 strcat(pTopic1, pTmpBuf2.data()); | 2447 strcat(pTopic1, pTmpBuf2.data()); |
2507 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); | 2448 pTopic1Height = pFontArrus->CalcTextHeight(pTopic1, &dialog_window, 0, 0); |
2508 strcat(pTopic1, "\n \n"); | 2449 strcat(pTopic1, "\n \n"); |
2509 | 2450 |
2510 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); | 2451 sprintf(pTopic2, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 3 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
2511 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold | 2452 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[86], // Buy food for %d days for %d gold |
2512 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, v83); | 2453 (unsigned int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, pPriceFood); |
2513 strcat(pTopic2, pTmpBuf2.data()); | 2454 strcat(pTopic2, pTmpBuf2.data()); |
2514 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); | 2455 pTopic2Height = pFontArrus->CalcTextHeight(pTopic2, &dialog_window, 0, 0); |
2515 strcat(pTopic2, "\n \n"); | 2456 strcat(pTopic2, "\n \n"); |
2516 | 2457 |
2517 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); | 2458 sprintf(pTopic3, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 4 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
2524 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); | 2465 sprintf(pTopic4, "\f%05d", pDialogueWindow->pCurrentPosActiveItem == 5 ? TargetColor(0xFFu, 0xFFu, 0x9Bu) : TargetColor(0xFFu, 0xFFu, 0xFFu)); |
2525 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage | 2466 strcat(pTopic4, pGlobalTXT_LocalizationStrings[611]); // Play Arcomage |
2526 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); | 2467 pTopic4Height = pFontArrus->CalcTextHeight(pTopic4, &dialog_window, 0, 0); |
2527 } | 2468 } |
2528 | 2469 |
2529 v36 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
2530 if ( pDialogueWindow->pNumPresenceButton ) | 2470 if ( pDialogueWindow->pNumPresenceButton ) |
2531 { | 2471 { |
2532 for ( pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 2472 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
2533 pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pNumActiveItem ) | 2473 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) |
2534 { | 2474 { |
2535 pButton = pDialogueWindow->GetControl(pNumActiveItem); | 2475 pButton = pDialogueWindow->GetControl(pItemNum); |
2536 if ( pButton->msg_param == 15 ) | 2476 if ( pButton->msg_param == 15 ) |
2537 { | 2477 { |
2538 v46 = pTopic1Height; | |
2539 pButton->uHeight = pTopic1Height; | 2478 pButton->uHeight = pTopic1Height; |
2540 pButton->uY = 146; | 2479 pButton->uY = 146; |
2541 v41 = v46 + 145; | 2480 pButton->uW = pTopic1Height + 145; |
2542 pButton->uW = v41; | |
2543 } | 2481 } |
2544 else if ( pButton->msg_param == 16 ) | 2482 else if ( pButton->msg_param == 16 ) |
2545 { | 2483 { |
2546 v44 = pTopic2Height; | |
2547 v45 = pTopic1Height + v36 + 146; | |
2548 pButton->uHeight = pTopic2Height; | 2484 pButton->uHeight = pTopic2Height; |
2549 pButton->uY = v45; | 2485 pButton->uY = pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
2550 v41 = v45 + v44 - 1; | 2486 pButton->uW = (pTopic1Height + (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) + pTopic2Height - 1; |
2551 pButton->uW = v41; | |
2552 } | 2487 } |
2553 else if ( pButton->msg_param == 96 ) | 2488 else if ( pButton->msg_param == 96 ) |
2554 { | 2489 { |
2555 v42 = pTopic1Height + pTopic2Height + 2 * v36 + 146; | 2490 pButton->uY = pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146; |
2556 v43 = pTopic3Height; | 2491 pButton->uHeight = pTopic3Height; |
2557 pButton->uY = v42; | 2492 pButton->uW = pTopic3Height + (pTopic1Height + pTopic2Height + 2 * (LOBYTE(pFontArrus->uFontHeight) - 3) + 146) - 1; |
2558 pButton->uHeight = v43; | |
2559 v41 = v43 + v42 - 1; | |
2560 pButton->uW = v41; | |
2561 } | 2493 } |
2562 else if ( pButton->msg_param == 101 ) | 2494 else if ( pButton->msg_param == 101 ) |
2563 { | 2495 { |
2564 v39 = pTopic1Height + 3 * v36 + pTopic4Height + pTopic2Height + 146; | |
2565 v40 = pTopic4Height; | |
2566 pButton->uHeight = pTopic4Height; | 2496 pButton->uHeight = pTopic4Height; |
2567 pButton->uY = v39; | 2497 pButton->uY = pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146; |
2568 v41 = v39 + v40 - 1; | 2498 pButton->uW = (pTopic1Height + 3 * (LOBYTE(pFontArrus->uFontHeight) - 3) + pTopic4Height + pTopic2Height + 146) + pTopic4Height - 1; |
2569 pButton->uW = v41; | |
2570 } | 2499 } |
2571 } | 2500 } |
2572 sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); | 2501 sprintfex(pTmpBuf.data(), "%s%s%s%s", pTopic1, pTopic2, pTopic3, pTopic4); |
2573 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); | 2502 dialog_window.DrawTitleText(pFontArrus, 0, 146, 0, pTmpBuf.data(), 3); |
2574 } | 2503 } |
2584 if ( 352 - pTextHeight < 8 ) | 2513 if ( 352 - pTextHeight < 8 ) |
2585 { | 2514 { |
2586 pOutString = pFontCreate; | 2515 pOutString = pFontCreate; |
2587 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | 2516 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2588 } | 2517 } |
2589 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); | 2518 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
2590 pRenderer->GetLeather(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight); | |
2591 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | 2519 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
2592 v63 = FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0); | 2520 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); |
2593 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); | |
2594 break; | 2521 break; |
2595 } | 2522 } |
2596 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | 2523 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: |
2597 { | 2524 { |
2598 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); | 2525 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); |
2599 dialog_window.uFrameWidth = game_viewport_width; | 2526 dialog_window.uFrameWidth = game_viewport_width; |
2600 dialog_window.uFrameZ = 452; | 2527 dialog_window.uFrameZ = 452; |
2601 v61 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0); | 2528 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2602 pTextHeight = v61 + 7; | 2529 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
2603 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); | |
2604 pRenderer->GetLeather(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7)); | |
2605 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | 2530 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); |
2606 v63 = FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0); | 2531 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, |
2607 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); | 2532 FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); |
2608 break; | 2533 break; |
2609 } | 2534 } |
2610 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | 2535 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: |
2611 { | 2536 { |
2612 if ( pArcomageGame->bGameInProgress == 1 ) | 2537 if ( pArcomageGame->bGameInProgress == 1 ) |
2613 return; | 2538 return; |
2614 if ( pArcomageGame->uGameResult ) | 2539 if ( pArcomageGame->uGameResult ) |
2615 { | 2540 { |
2616 if ( pArcomageGame->uGameResult == 1 ) | 2541 if ( pArcomageGame->uGameResult == 1 ) |
2617 v72 = pGlobalTXT_LocalizationStrings[640];// You won! | 2542 pText = pGlobalTXT_LocalizationStrings[640];// You won! |
2618 else | 2543 else |
2619 v72 = pGlobalTXT_LocalizationStrings[641];// You lost! | 2544 pText = pGlobalTXT_LocalizationStrings[641];// You lost! |
2620 } | 2545 } |
2621 else | 2546 else |
2622 { | 2547 { |
2623 v72 = pGlobalTXT_LocalizationStrings[639];// A tie! | 2548 pText = pGlobalTXT_LocalizationStrings[639];// A tie! |
2624 } | 2549 } |
2625 strcpy(pTmpBuf.data(), v72); | 2550 strcpy(pTmpBuf.data(), pText); |
2626 v66 = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | 2551 dialog_window.DrawTitleText(pFontArrus, 0, (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138, |
2627 dialog_window.DrawTitleText(pFontArrus, 0, v66, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | 2552 TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
2628 break; | 2553 break; |
2629 } | 2554 } |
2630 case HOUSE_DIALOGUE_TAVERN_REST: | 2555 case HOUSE_DIALOGUE_TAVERN_REST: |
2631 { | 2556 { |
2632 if ( pParty->uNumGold >= (unsigned int)pOutString ) | 2557 if ( pParty->uNumGold >= pPriceRoom ) |
2633 { | 2558 { |
2634 Party::TakeGold((unsigned int)pOutString); | 2559 Party::TakeGold(pPriceRoom); |
2635 v27 = (int)window_SpeakInHouse->ptr_1C;//107 | |
2636 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); | 2560 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); |
2637 dialog_menu_id = HOUSE_DIALOGUE_NULL; | 2561 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
2638 sub_4BD8B5(); | 2562 sub_4BD8B5(); |
2639 GetHouseGoodbyeSpeech(); | 2563 GetHouseGoodbyeSpeech(); |
2640 pVideoPlayer->Unload(); | 2564 pVideoPlayer->Unload(); |
2641 window_SpeakInHouse->Release(); | |
2642 window_SpeakInHouse = 0; | |
2643 if ( pMessageQueue_50CBD0->uNumMessages ) | 2565 if ( pMessageQueue_50CBD0->uNumMessages ) |
2644 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 2566 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
2645 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; | 2567 pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_RentRoom; |
2646 pMessageQueue_50CBD0->pMessages[0].param = v27; | 2568 pMessageQueue_50CBD0->pMessages[0].param = (int)window_SpeakInHouse->ptr_1C;//107 |
2647 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; | 2569 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; |
2648 ++pMessageQueue_50CBD0->uNumMessages; | 2570 ++pMessageQueue_50CBD0->uNumMessages; |
2571 window_SpeakInHouse->Release(); | |
2572 window_SpeakInHouse = 0; | |
2649 return; | 2573 return; |
2650 } | 2574 } |
2651 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | 2575 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);//У вас не хватает золота |
2652 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); | 2576 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
2653 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | 2577 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2654 break; | 2578 break; |
2655 } | 2579 } |
2656 | 2580 |
2657 case HOUSE_DIALOGUE_LEARN_SKILLS: | 2581 case HOUSE_DIALOGUE_LEARN_SKILLS: |
2658 { | 2582 { |
2659 if ( !HouseUI_CheckIfPlayerCanInteract() ) | 2583 if ( !HouseUI_CheckIfPlayerCanInteract() ) |
2660 return; | 2584 return; |
2661 v0 = 0; | 2585 pSkillCount = 0; |
2662 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); | 2586 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); |
2663 pItemNum = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; | 2587 pPriceSkill = v9 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; |
2664 if ( pItemNum < v9 / 3 ) | 2588 if ( pPriceSkill < v9 / 3 ) |
2665 pItemNum = v9 / 3; | 2589 pPriceSkill = v9 / 3; |
2666 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | |
2667 all_text_height = 0; | 2590 all_text_height = 0; |
2668 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 2591 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
2669 { | 2592 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; ++pItemNum ) |
2670 do | 2593 { |
2671 { | 2594 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(pItemNum)->msg_param - 36] |
2672 v12 = pDialogueWindow->GetControl(pNumActiveItem)->msg_param - 36; | 2595 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(pItemNum)->msg_param - 36] ) |
2673 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v12] | 2596 { |
2674 && !pPlayers[uActiveCharacter]->pActiveSkills[v12] ) | 2597 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(pItemNum)->msg_param - 36], &dialog_window, 0, 0); |
2675 { | 2598 pSkillCount++; |
2676 all_text_height = pFontArrus->CalcTextHeight(pSkillNames[v12], &dialog_window, 0, 0); | 2599 } |
2677 v0++; | 2600 } |
2678 } | 2601 if ( pSkillCount ) |
2679 ++pNumActiveItem; | 2602 { |
2680 } | 2603 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPriceSkill);//Стоимость навыка: %lu |
2681 while ( pNumActiveItem < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ); | 2604 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); |
2682 if ( v0 ) | 2605 v91 = (149 - all_text_height) / pSkillCount; |
2683 { | 2606 if ( (149 - all_text_height) / pSkillCount > 32 ) |
2684 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pItemNum); | 2607 v91 = 32; |
2685 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3); | 2608 v54 = (149 - pSkillCount * v91 - all_text_height) / 2 - v91 / 2 + 162; |
2686 v91 = (149 - all_text_height) / v0; | 2609 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
2687 if ( (149 - all_text_height) / v0 > 32 ) | 2610 pItemNum < pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; pItemNum++ ) |
2688 v91 = 32; | 2611 { |
2689 v14 = (149 - v0 * v91 - all_text_height) / 2 - v91 / 2 + 162; | 2612 pButton = pDialogueWindow->GetControl(pItemNum); |
2690 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 2613 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36] |
2691 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 2614 || pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] ) |
2692 { | 2615 { |
2693 pItemNum = 2; | 2616 pButton->uW = 0; |
2694 do | 2617 pButton->uHeight = 0; |
2695 { | 2618 pButton->uY = 0; |
2696 pButton = pDialogueWindow->GetControl(pItemNum); | 2619 } |
2697 v17 = pButton->msg_param - 36; | 2620 else |
2698 if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v17] | 2621 { |
2699 || pPlayers[uActiveCharacter]->pActiveSkills[v17] ) | 2622 pButton->uY = v91 + v54; |
2700 { | 2623 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &dialog_window, 0, 0); |
2701 pButton->uW = 0; | 2624 pButton->uHeight = pTextHeight; |
2702 pButton->uHeight = 0; | 2625 v54 = pTextHeight + pButton->uY - 1; |
2703 pButton->uY = 0; | 2626 pButton->uW = v54; |
2704 } | 2627 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
2705 else | 2628 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) |
2706 { | 2629 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
2707 pButton->uY = v91 + v14; | 2630 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[pButton->msg_param - 36], 3); |
2708 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v17], &dialog_window, 0, 0); | 2631 } |
2709 pButton->uHeight = pTextHeight; | 2632 } |
2710 v14 = pTextHeight + pButton->uY - 1; | 2633 return; |
2711 pButton->uW = v14; | 2634 } |
2712 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); | 2635 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName,//Советую вам %s %s поискать знания еще где-нибудь |
2713 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | |
2714 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2715 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pSkillNames[v17], 3); | |
2716 } | |
2717 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton; | |
2718 pItemNum++; | |
2719 } | |
2720 while ( pItemNum < pNumActiveItem ); | |
2721 } | |
2722 return; | |
2723 } | |
2724 } | |
2725 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, | |
2726 pClassNames[pPlayers[uActiveCharacter]->classType]); | 2636 pClassNames[pPlayers[uActiveCharacter]->classType]); |
2727 strcat(pTmpBuf.data(), "\n \n"); | 2637 strcat(pTmpBuf.data(), "\n \n"); |
2728 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); | 2638 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);//Больше ничего не могу предложить. |
2729 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; | 2639 pTextHeight = (174 - pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 0, 0)) / 2 + 138; |
2730 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); | 2640 dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); |
2731 return; | 2641 return; |
2732 } | 2642 } |
2733 | 2643 |
2734 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: | 2644 case HOUSE_DIALOGUE_TAVERN_BUY_FOOD: |
2735 { | 2645 { |
2736 *(_QWORD *)Str = pParty->uNumFoodRations; | |
2737 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) | |
2738 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) | 2646 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) |
2739 { | 2647 { |
2740 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); | 2648 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2);//Вы уже купили еду! |
2741 if ( uActiveCharacter ) | 2649 if ( uActiveCharacter ) |
2742 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); | 2650 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); |
2743 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | 2651 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2744 return; | 2652 return; |
2745 } | 2653 } |
2746 if ( pParty->uNumGold >= v7 ) | 2654 if ( pParty->uNumGold >= pPriceFood ) |
2747 { | 2655 { |
2748 Party::TakeGold(v7); | 2656 Party::TakeGold(pPriceFood); |
2749 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; | |
2750 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; | 2657 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; |
2751 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); | 2658 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Greeting_2); |
2752 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | 2659 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2753 return; | 2660 return; |
2754 } | 2661 } |
2755 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" | 2662 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); // "You don't have enough gold" |
2756 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); | 2663 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_Goodbye); |
2757 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); | 2664 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
2758 break; | 2665 break; |
2759 } | 2666 } |
2760 | 2667 |
2761 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | 2668 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: |
2762 { | 2669 { |
2763 if ( HouseUI_CheckIfPlayerCanInteract() ) | 2670 if ( HouseUI_CheckIfPlayerCanInteract() ) |
2764 { | 2671 { |
2765 v48 = 2; | 2672 pOptionsCount = 2; |
2766 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; | 2673 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];//Правила |
2767 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; | 2674 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];//Условия победы |
2768 pOutString = 0; | 2675 if ( pParty->HasItem(651) )//651 - Колода для игры в АркоМэйдж в Items.txt |
2769 if ( pParty->HasItem(0x28Bu) ) | 2676 { |
2770 { | 2677 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];//Играть |
2771 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; | 2678 pOptionsCount = 3; |
2772 v48 = 3; | 2679 } |
2773 } | 2680 for ( i = 0; i < pOptionsCount; ++i ) |
2774 for ( i = 0; i < v48; ++i ) | |
2775 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); | 2681 all_text_height = pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); |
2776 all_text_height = (174 - all_text_height) / v48; | 2682 all_text_height = (174 - all_text_height) / pOptionsCount; |
2777 pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; | 2683 |
2778 v54 = (174 - v48 * (174 - all_text_height) / v48 - all_text_height) / 2 - (174 - all_text_height) / v48 / 2 + 138; | 2684 v54 = (174 - pOptionsCount * (174 - all_text_height) / pOptionsCount - all_text_height) / 2 - (174 - all_text_height) / pOptionsCount / 2 + 138; |
2779 //v37 = -pDialogueWindow->pNumPresenceButton < 0; | 2685 pNumString = 0; |
2780 if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) | 2686 for ( pItemNum = pDialogueWindow->pStartingPosActiveItem; |
2781 { | 2687 pItemNum < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ; pItemNum++ ) |
2782 pItemNum = 2; | 2688 { |
2783 pNumString = 0; | 2689 pButton = pDialogueWindow->GetControl(pItemNum); |
2784 do | 2690 pButton->uY = all_text_height + v54; |
2785 { | 2691 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); |
2786 pButton = pDialogueWindow->GetControl(pItemNum); | 2692 pButton->uHeight = pTextHeight; |
2787 pButton->uY = all_text_height + v54; | 2693 v54 = pButton->uY + pTextHeight - 1; |
2788 pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); | 2694 pButton->uW = v54; |
2789 pButton->uHeight = pTextHeight; | 2695 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
2790 v54 = pButton->uY + pTextHeight - 1; | 2696 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) |
2791 pButton->uW = v54; | 2697 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); |
2792 pColorText = TargetColor(0xFFu, 0xFFu, 0x9Bu); | 2698 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); |
2793 if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) | 2699 ++pNumString; |
2794 pColorText = TargetColor(0xFFu, 0xFFu, 0xFFu); | |
2795 dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3); | |
2796 pItemNum++; | |
2797 ++pNumString; | |
2798 pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; | |
2799 } | |
2800 while ( pItemNum < pNumActiveItem ); | |
2801 } | 2700 } |
2802 } | 2701 } |
2803 break; | 2702 break; |
2804 } | 2703 } |
2805 default: | 2704 default: |