Mercurial > mm7
comparison UI/UIHouses.cpp @ 1411:2423bc2af692
+InitializaDialogueOptions
+InitializaDialogueOptions_Shops
+InitializaDialogueOptions_Tavern
author | Nomad |
---|---|
date | Fri, 26 Jul 2013 23:35:34 +0200 |
parents | d4f57df4c299 |
children | c7489dd19f88 b67a3e0d6fc3 |
comparison
equal
deleted
inserted
replaced
1410:38df78aba732 | 1411:2423bc2af692 |
---|---|
11 #include "..\Arcomage.h" | 11 #include "..\Arcomage.h" |
12 #include "..\LOD.h" | 12 #include "..\LOD.h" |
13 #include "..\Mouse.h" | 13 #include "..\Mouse.h" |
14 #include "..\GUIWindow.h" | 14 #include "..\GUIWindow.h" |
15 #include "..\GUIFont.h" | 15 #include "..\GUIFont.h" |
16 #include "..\Events2D.h" | |
17 #include "..\Overlays.h" | 16 #include "..\Overlays.h" |
18 #include "..\Outdoor.h" | 17 #include "..\Outdoor.h" |
19 #include "..\AudioPlayer.h" | 18 #include "..\AudioPlayer.h" |
20 #include "..\VideoPlayer.h" | 19 #include "..\VideoPlayer.h" |
21 #include "..\Monsters.h" | 20 #include "..\Monsters.h" |
29 #include "..\stru159.h" | 28 #include "..\stru159.h" |
30 int uHouse_ExitPic; // weak | 29 int uHouse_ExitPic; // weak |
31 | 30 |
32 int dword_591080; // weak | 31 int dword_591080; // weak |
33 | 32 |
34 int in_current_building_type; // 00F8B198 | 33 BuildingType in_current_building_type; // 00F8B198 |
35 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C | 34 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C |
36 | 35 |
37 #pragma pack(push, 1) | 36 #pragma pack(push, 1) |
38 struct stru365_travel_info | 37 struct stru365_travel_info |
39 { | 38 { |
313 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, | 312 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, |
314 {"Player Castle Bad", 0x24, 0, 25, 0, 0} | 313 {"Player Castle Bad", 0x24, 0, 25, 0, 0} |
315 }}; | 314 }}; |
316 | 315 |
317 | 316 |
317 | |
318 //----- (004B3A72) -------------------------------------------------------- | |
319 void InitializaDialogueOptions_Tavern(BuildingType type) | |
320 { | |
321 int num_buttons; // esi@1 | |
322 | |
323 num_buttons = 0; | |
324 if (type == BuildingType_Tavern) | |
325 { | |
326 num_buttons = 2; | |
327 CreateButtonInColumn(0, 102); | |
328 CreateButtonInColumn(1, 103); | |
329 if ( pParty->HasItem(651) ) //Arcomage Deck | |
330 { | |
331 num_buttons = 3; | |
332 CreateButtonInColumn(2, 104); | |
333 } | |
334 } | |
335 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); | |
336 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
337 } | |
338 // F8B1E0: using guessed type int dword_F8B1E0; | |
339 | |
340 //----- (004B3AD4) -------------------------------------------------------- | |
341 void InitializaDialogueOptions_Shops(BuildingType type) | |
342 { | |
343 switch (type) | |
344 { | |
345 case BuildingType_WeaponShop: | |
346 case BuildingType_ArmorShop: | |
347 case BuildingType_MagicShop: | |
348 { | |
349 CreateButtonInColumn(0, 3); | |
350 CreateButtonInColumn(1, 4); | |
351 CreateButtonInColumn(2, 5); | |
352 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
353 } | |
354 break; | |
355 | |
356 case BuildingType_AlchemistShop: | |
357 { | |
358 CreateButtonInColumn(0, 3); | |
359 CreateButtonInColumn(1, 4); | |
360 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
361 } | |
362 break; | |
363 } | |
364 | |
365 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
366 } | |
367 // F8B1E0: using guessed type int dword_F8B1E0; | |
368 | |
369 //----- (004B3B42) -------------------------------------------------------- | |
370 void InitializaDialogueOptions(BuildingType type) | |
371 { | |
372 /*int v1; // ecx@18 | |
373 int v2; // ecx@19 | |
374 int v3; // ecx@20 | |
375 signed int v4; // esi@22 | |
376 signed int v5; // eax@22 | |
377 unsigned int v6; // edx@24 | |
378 int v7; // ecx@24 | |
379 int result; // eax@43 | |
380 int v9; // [sp-10h] [bp-14h]@28 | |
381 int v10; // [sp-Ch] [bp-10h]@28 | |
382 int v11; // [sp-8h] [bp-Ch]@28 | |
383 unsigned int v12; // [sp-4h] [bp-8h]@4 | |
384 unsigned int v13; // [sp-4h] [bp-8h]@5 | |
385 unsigned int v14; // [sp-4h] [bp-8h]@9 | |
386 unsigned int v15; // [sp-4h] [bp-8h]@10 | |
387 unsigned int v16; // [sp-4h] [bp-8h]@14 | |
388 int v17; // [sp-4h] [bp-8h]@28*/ | |
389 | |
390 switch (type) | |
391 { | |
392 case BuildingType_WeaponShop: | |
393 case BuildingType_ArmorShop: | |
394 case BuildingType_MagicShop: | |
395 case BuildingType_AlchemistShop: | |
396 { | |
397 CreateButtonInColumn(0, 2); | |
398 CreateButtonInColumn(1, 95); | |
399 CreateButtonInColumn(2, 94); | |
400 CreateButtonInColumn(3, 96); | |
401 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
402 } | |
403 break; | |
404 | |
405 case BuildingType_FireGuild: | |
406 { | |
407 CreateButtonInColumn(0, 18); | |
408 CreateButtonInColumn(1, 48); | |
409 CreateButtonInColumn(2, 72); | |
410 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
411 } | |
412 break; | |
413 | |
414 case BuildingType_AirGuild: | |
415 { | |
416 CreateButtonInColumn(0, 18); | |
417 CreateButtonInColumn(1, 49); | |
418 CreateButtonInColumn(2, 72); | |
419 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
420 } | |
421 break; | |
422 | |
423 case BuildingType_WaterGuild: | |
424 { | |
425 CreateButtonInColumn(0, 18); | |
426 CreateButtonInColumn(1, 50); | |
427 CreateButtonInColumn(2, 72); | |
428 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
429 } | |
430 break; | |
431 | |
432 case BuildingType_EarthGuild: | |
433 { | |
434 CreateButtonInColumn(0, 18); | |
435 CreateButtonInColumn(1, 51); | |
436 CreateButtonInColumn(2, 72); | |
437 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
438 } | |
439 break; | |
440 | |
441 case BuildingType_SpiritGuild: | |
442 { | |
443 CreateButtonInColumn(0, 18); | |
444 CreateButtonInColumn(1, 52); | |
445 CreateButtonInColumn(2, 61); | |
446 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
447 } | |
448 break; | |
449 | |
450 case BuildingType_MindGuild: | |
451 { | |
452 CreateButtonInColumn(0, 18); | |
453 CreateButtonInColumn(1, 53); | |
454 CreateButtonInColumn(2, 61); | |
455 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
456 } | |
457 break; | |
458 | |
459 case BuildingType_BodyGuild: | |
460 { | |
461 CreateButtonInColumn(0, 18); | |
462 CreateButtonInColumn(1, 54); | |
463 CreateButtonInColumn(2, 61); | |
464 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
465 } | |
466 break; | |
467 | |
468 case BuildingType_LightGuild: | |
469 { | |
470 CreateButtonInColumn(0, 18); | |
471 CreateButtonInColumn(1, 55); | |
472 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
473 } | |
474 break; | |
475 | |
476 case BuildingType_DarkGuild: | |
477 { | |
478 CreateButtonInColumn(0, 18); | |
479 CreateButtonInColumn(1, 56); | |
480 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
481 } | |
482 break; | |
483 | |
484 case BuildingType_14: | |
485 { | |
486 CreateButtonInColumn(0, 18); | |
487 CreateButtonInColumn(1, 48); | |
488 CreateButtonInColumn(2, 49); | |
489 CreateButtonInColumn(3, 50); | |
490 CreateButtonInColumn(4, 51); | |
491 pDialogueWindow->_41D08F_set_keyboard_control_group(5, 1, 0, 2); | |
492 } | |
493 break; | |
494 | |
495 case BuildingType_15: | |
496 { | |
497 CreateButtonInColumn(0, 18); | |
498 CreateButtonInColumn(1, 52); | |
499 CreateButtonInColumn(2, 53); | |
500 CreateButtonInColumn(3, 54); | |
501 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
502 } | |
503 break; | |
504 | |
505 case BuildingType_16: | |
506 case BuildingType_TownHall: | |
507 { | |
508 int num_buttons = 1; | |
509 CreateButtonInColumn(0, 99); | |
510 | |
511 if (pParty->uFine) | |
512 { | |
513 num_buttons++; | |
514 CreateButtonInColumn(1, 100); | |
515 } | |
516 | |
517 pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); | |
518 } | |
519 break; | |
520 | |
521 case BuildingType_Bank: | |
522 { | |
523 CreateButtonInColumn(0, 7); | |
524 CreateButtonInColumn(1, 8); | |
525 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
526 } | |
527 break; | |
528 | |
529 case BuildingType_Temple: | |
530 { | |
531 CreateButtonInColumn(0, 10); | |
532 CreateButtonInColumn(1, 11); | |
533 CreateButtonInColumn(2, 96); | |
534 pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); | |
535 } | |
536 break; | |
537 | |
538 case BuildingType_Stables: | |
539 case BuildingType_Boats: | |
540 { | |
541 CreateButtonInColumn(0, 105); | |
542 CreateButtonInColumn(1, 106); | |
543 CreateButtonInColumn(2, 107); | |
544 CreateButtonInColumn(3, 108); | |
545 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); | |
546 } | |
547 break; | |
548 | |
549 case BuildingType_Training: | |
550 { | |
551 CreateButtonInColumn(0, 17); | |
552 CreateButtonInColumn(1, 96); | |
553 pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); | |
554 } | |
555 break; | |
556 | |
557 case BuildingType_18: | |
558 case BuildingType_19: | |
559 case BuildingType_Throne_Room: | |
560 case BuildingType_24: | |
561 case BuildingType_Unic: | |
562 case BuildingType_1A: | |
563 case BuildingType_House: | |
564 case BuildingType_Jail: | |
565 break; | |
566 | |
567 default: | |
568 assert(false && "Invalid enumeration value"); | |
569 } | |
570 | |
571 /* if ( a1 > 13 ) | |
572 { | |
573 if ( a1 > 22 ) | |
574 { | |
575 if ( a1 == 23 ) | |
576 { | |
577 CreateButtonInColumn(0, 0xAu); | |
578 CreateButtonInColumn(1, 0xBu); | |
579 v14 = 96; | |
580 LABEL_41: | |
581 CreateButtonInColumn(2, v14); | |
582 v17 = 2; | |
583 v11 = 0; | |
584 v10 = 1; | |
585 v9 = 3; | |
586 goto LABEL_42; | |
587 } | |
588 if ( a1 <= 26 ) | |
589 goto LABEL_43; | |
590 if ( a1 > 28 ) | |
591 { | |
592 if ( a1 != 30 ) | |
593 goto LABEL_43; | |
594 CreateButtonInColumn(0, 0x11u); | |
595 v16 = 96; | |
596 goto LABEL_37; | |
597 } | |
598 CreateButtonInColumn(0, 0x69u); | |
599 CreateButtonInColumn(1, 0x6Au); | |
600 CreateButtonInColumn(2, 0x6Bu); | |
601 v12 = 108; | |
602 } | |
603 else | |
604 { | |
605 if ( a1 == 22 ) | |
606 { | |
607 CreateButtonInColumn(0, 7u); | |
608 v16 = 8; | |
609 goto LABEL_37; | |
610 } | |
611 v1 = a1 - 14; | |
612 if ( !v1 ) // == 14 | |
613 { | |
614 CreateButtonInColumn(0, 0x12u); | |
615 CreateButtonInColumn(1, 0x30u); | |
616 CreateButtonInColumn(2, 0x31u); | |
617 CreateButtonInColumn(3, 0x32u); | |
618 CreateButtonInColumn(4, 0x33u); | |
619 v17 = 2; | |
620 v11 = 0; | |
621 v10 = 1; | |
622 v9 = 5; | |
623 goto LABEL_42; | |
624 } | |
625 v2 = v1 - 1; | |
626 if ( v2 ) // > 15 | |
627 { | |
628 v3 = v2 - 2; | |
629 if ( v3 ) // > 17 | |
630 { | |
631 if ( v3 != 4 ) // 18, 19, 20 | |
632 goto LABEL_43; | |
633 CreateButtonInColumn(0, 0xFu); // 21 | |
634 CreateButtonInColumn(1, 0x10u); | |
635 v4 = 3; | |
636 CreateButtonInColumn(2, 0x60u); | |
637 v5 = (signed int)window_SpeakInHouse->ptr_1C; | |
638 if ( v5 < 108 || v5 > 120 ) | |
639 goto LABEL_28; | |
640 v4 = 4; | |
641 v6 = 101; | |
642 v7 = 3; | |
643 } | |
644 else // 16, 17 | |
645 { | |
646 v4 = 1; | |
647 CreateButtonInColumn(0, 0x63u); | |
648 if ( !pParty->uFine ) | |
649 { | |
650 LABEL_28: | |
651 v17 = 2; | |
652 v11 = 0; | |
653 v10 = 1; | |
654 v9 = v4; | |
655 LABEL_42: | |
656 pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); | |
657 goto LABEL_43; | |
658 } | |
659 v4 = 2; | |
660 v7 = 1; | |
661 v6 = 100; | |
662 } | |
663 CreateButtonInColumn(v7, v6); | |
664 goto LABEL_28; | |
665 } | |
666 CreateButtonInColumn(0, 0x12u); // 15 | |
667 CreateButtonInColumn(1, 0x34u); | |
668 CreateButtonInColumn(2, 0x35u); | |
669 v12 = 54; | |
670 } | |
671 LABEL_39: | |
672 CreateButtonInColumn(3, v12); | |
673 v17 = 2; | |
674 v11 = 0; | |
675 v10 = 1; | |
676 v9 = 4; | |
677 goto LABEL_42; | |
678 } | |
679 if ( a1 == 13 ) | |
680 { | |
681 CreateButtonInColumn(0, 0x12u); | |
682 v16 = 56; | |
683 LABEL_37: | |
684 CreateButtonInColumn(1, v16); | |
685 v17 = 2; | |
686 v11 = 0; | |
687 v10 = 1; | |
688 v9 = 2; | |
689 goto LABEL_42; | |
690 } | |
691 switch ( a1 ) | |
692 { | |
693 case 1: | |
694 case 2: | |
695 case 3: | |
696 case 4: | |
697 CreateButtonInColumn(0, 2u); | |
698 CreateButtonInColumn(1, 0x5Fu); | |
699 CreateButtonInColumn(2, 0x5Eu); | |
700 v12 = 96; | |
701 goto LABEL_39; | |
702 case 5: | |
703 CreateButtonInColumn(0, 0x12u); | |
704 v13 = 48; | |
705 goto LABEL_9; | |
706 case 6: | |
707 CreateButtonInColumn(0, 0x12u); | |
708 v13 = 49; | |
709 goto LABEL_9; | |
710 case 7: | |
711 CreateButtonInColumn(0, 0x12u); | |
712 v13 = 50; | |
713 goto LABEL_9; | |
714 case 8: | |
715 CreateButtonInColumn(0, 0x12u); | |
716 v13 = 51; | |
717 LABEL_9: | |
718 CreateButtonInColumn(1, v13); | |
719 v14 = 72; | |
720 goto LABEL_41; | |
721 case 9: | |
722 CreateButtonInColumn(0, 0x12u); | |
723 v15 = 52; | |
724 goto LABEL_13; | |
725 case 10: | |
726 CreateButtonInColumn(0, 0x12u); | |
727 v15 = 53; | |
728 goto LABEL_13; | |
729 case 11: | |
730 CreateButtonInColumn(0, 0x12u); | |
731 v15 = 54; | |
732 LABEL_13: | |
733 CreateButtonInColumn(1, v15); | |
734 v14 = 61; | |
735 goto LABEL_41; | |
736 case 12: | |
737 CreateButtonInColumn(0, 0x12u); | |
738 v16 = 55; | |
739 goto LABEL_37; | |
740 default: | |
741 break; | |
742 } | |
743 LABEL_43:*/ | |
744 dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; | |
745 } | |
746 // F8B1E0: using guessed type int dword_F8B1E0; | |
747 | |
748 | |
318 //----- (004B1784) -------------------------------------------------------- | 749 //----- (004B1784) -------------------------------------------------------- |
319 bool __cdecl HouseUI_CheckIfPlayerCanInteract() | 750 bool __cdecl HouseUI_CheckIfPlayerCanInteract() |
320 { | 751 { |
321 Player *pPlayer; // ebx@1 | 752 Player *pPlayer; // ebx@1 |
322 bool result; // eax@2 | 753 bool result; // eax@2 |
439 } | 870 } |
440 } | 871 } |
441 pAudioPlayer->StopChannels(-1, -1); | 872 pAudioPlayer->StopChannels(-1, -1); |
442 | 873 |
443 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; | 874 uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; |
444 in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; | 875 in_current_building_type = (BuildingType)pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; |
445 if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail | 876 if ( in_current_building_type == BuildingType_Throne_Room && pParty->uFine ) // going 2 jail |
446 { | 877 { |
447 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; | 878 uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; |
448 uHouseID = HOUSE_JAIL; | 879 uHouseID = HOUSE_JAIL; |
449 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; | 880 pParty->uTimePlayed = pParty->uTimePlayed + 0x7620000; |
450 in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; | 881 in_current_building_type = (BuildingType)pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; |
451 ++pParty->uNumPrisonTerms; | 882 ++pParty->uNumPrisonTerms; |
452 pParty->uFine = 0; | 883 pParty->uFine = 0; |
453 for (uint i = 0; i < 4; ++i) | 884 for (uint i = 0; i < 4; ++i) |
454 { | 885 { |
455 pParty->pPlayers[i].uTimeToRecovery = 0; | 886 pParty->pPlayers[i].uTimeToRecovery = 0; |
662 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) | 1093 if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) |
663 v8 = window_SpeakInHouse; | 1094 v8 = window_SpeakInHouse; |
664 //else | 1095 //else |
665 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) | 1096 if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) |
666 { | 1097 { |
667 if ( in_current_building_type == BildingType_Training ) | 1098 if ( in_current_building_type == BuildingType_Training ) |
668 { | 1099 { |
669 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) | 1100 if ( uMessageParam == HOUSE_DIALOGUE_TRAININGHALL_TRAIN ) |
670 { | 1101 { |
671 v4 = 0; | 1102 v4 = 0; |
672 v5 = 0; | 1103 v5 = 0; |
690 // LABEL_10: | 1121 // LABEL_10: |
691 //v3 = dword_F8B198; | 1122 //v3 = dword_F8B198; |
692 v8 = window_SpeakInHouse; | 1123 v8 = window_SpeakInHouse; |
693 } | 1124 } |
694 //else | 1125 //else |
695 if ( in_current_building_type != BildingType_Training ) | 1126 if ( in_current_building_type != BuildingType_Training ) |
696 { | 1127 { |
697 v8 = window_SpeakInHouse; | 1128 v8 = window_SpeakInHouse; |
698 if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) && | 1129 if ((in_current_building_type == BuildingType_Stables || in_current_building_type == BuildingType_Boats) && |
699 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] | 1130 transport_schedule[transport_routes[(unsigned int)window_SpeakInHouse->ptr_1C - HOUSE_STABLES_HARMONDALE][uMessageParam - HOUSE_DIALOGUE_TRANSPORT_SCHEDULE_1]].pSchedule[pParty->uDaysPlayed % 7] |
700 || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) | 1131 || in_current_building_type != BuildingType_Temple || uMessageParam != BuildingType_MindGuild ) |
701 { | 1132 { |
702 //LABEL_9: | 1133 //LABEL_9: |
703 pDialogueWindow->Release(); | 1134 pDialogueWindow->Release(); |
704 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); | 1135 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); |
705 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" | 1136 pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" |
716 v8 = window_SpeakInHouse; | 1147 v8 = window_SpeakInHouse; |
717 } | 1148 } |
718 } | 1149 } |
719 //LABEL_11: | 1150 //LABEL_11: |
720 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | 1151 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; |
721 if ( in_current_building_type < BildingType_19 ) | 1152 if ( in_current_building_type < BuildingType_19 ) |
722 { | 1153 { |
723 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); | 1154 v9 = pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE); |
724 //v3 = dword_F8B198; | 1155 //v3 = dword_F8B198; |
725 ShopTexture = &pIcons_LOD->pTextures[v9]; | 1156 ShopTexture = &pIcons_LOD->pTextures[v9]; |
726 //LABEL_13: | 1157 //LABEL_13: |
727 v8 = window_SpeakInHouse; | 1158 v8 = window_SpeakInHouse; |
728 } | 1159 } |
729 } | 1160 } |
730 | 1161 |
731 //NEW | 1162 //NEW |
732 switch(in_current_building_type) | 1163 switch (in_current_building_type) |
733 { | 1164 { |
734 case BildingType_FireGuild: | 1165 case BuildingType_FireGuild: |
735 case BildingType_AirGuild: | 1166 case BuildingType_AirGuild: |
736 case BildingType_WaterGuild: | 1167 case BuildingType_WaterGuild: |
737 case BildingType_EarthGuild: | 1168 case BuildingType_EarthGuild: |
738 case BildingType_SpiritGuild: | 1169 case BuildingType_SpiritGuild: |
739 case BildingType_MindGuild: | 1170 case BuildingType_MindGuild: |
740 case BildingType_BodyGuild: | 1171 case BuildingType_BodyGuild: |
741 case BildingType_LightGuild: | 1172 case BuildingType_LightGuild: |
742 case BildingType_DarkGuild: | 1173 case BuildingType_DarkGuild: |
743 case BildingType_14: | 1174 case BuildingType_14: |
744 case BildingType_15: | 1175 case BuildingType_15: |
745 case BildingType_16: | 1176 case BuildingType_16: |
746 { | 1177 { |
747 if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && | 1178 if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && |
748 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) | 1179 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) |
749 { | 1180 { |
750 v32 = 0; | 1181 v32 = 0; |
773 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); | 1204 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); |
774 } | 1205 } |
775 //return; | 1206 //return; |
776 break; | 1207 break; |
777 } | 1208 } |
778 case BildingType_TownHall: | 1209 case BuildingType_TownHall: |
779 { | 1210 { |
780 if ( uMessageParam == 99 ) | 1211 if ( uMessageParam == 99 ) |
781 { | 1212 { |
782 v10 = (int)((char *)v8->ptr_1C - 102); | 1213 v10 = (int)((char *)v8->ptr_1C - 102); |
783 v56 = v10; | 1214 v56 = v10; |
979 { | 1410 { |
980 pKeyActionMap->EnterText(1, 10, v8); | 1411 pKeyActionMap->EnterText(1, 10, v8); |
981 } | 1412 } |
982 break; | 1413 break; |
983 } | 1414 } |
984 case BildingType_Bank: | 1415 case BuildingType_Bank: |
985 { | 1416 { |
986 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) | 1417 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) |
987 pKeyActionMap->EnterText(1, 10, v8); | 1418 pKeyActionMap->EnterText(1, 10, v8); |
988 return; | 1419 return; |
989 break; | 1420 break; |
990 } | 1421 } |
991 case BildingType_WeaponShop: | 1422 case BuildingType_WeaponShop: |
992 case BildingType_ArmorShop: | 1423 case BuildingType_ArmorShop: |
993 case BildingType_MagicShop: | 1424 case BuildingType_MagicShop: |
994 case BildingType_AlchemistShop: | 1425 case BuildingType_AlchemistShop: |
995 case BildingType_Tavern: | 1426 case BuildingType_Tavern: |
996 case BildingType_Temple: | 1427 case BuildingType_Temple: |
997 case BildingType_Training: | 1428 case BuildingType_Training: |
998 { | 1429 { |
999 break; | 1430 break; |
1000 } | 1431 } |
1001 default: | 1432 default: |
1002 { | 1433 { |
1004 break; | 1435 break; |
1005 } | 1436 } |
1006 } | 1437 } |
1007 | 1438 |
1008 /* | 1439 /* |
1009 if ( in_current_building_type > BildingType_Tavern ) | 1440 if ( in_current_building_type > BuildingType_Tavern ) |
1010 { | 1441 { |
1011 if ( in_current_building_type == BildingType_Bank ) | 1442 if ( in_current_building_type == BuildingType_Bank ) |
1012 { | 1443 { |
1013 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) | 1444 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) |
1014 pKeyActionMap->EnterText(1, 10, v8); | 1445 pKeyActionMap->EnterText(1, 10, v8); |
1015 return; | 1446 return; |
1016 } | 1447 } |
1017 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) | 1448 if ( in_current_building_type != BuildingType_Temple && in_current_building_type != BuildingType_Training ) |
1018 return; | 1449 return; |
1019 } | 1450 } |
1020 //else | 1451 //else |
1021 if ( in_current_building_type < BildingType_Tavern ) | 1452 if ( in_current_building_type < BuildingType_Tavern ) |
1022 { | 1453 { |
1023 if (in_current_building_type <= 0) | 1454 if (in_current_building_type <= 0) |
1024 return; | 1455 return; |
1025 if ( in_current_building_type > BildingType_AlchemistShop ) | 1456 if ( in_current_building_type > BuildingType_AlchemistShop ) |
1026 { | 1457 { |
1027 if ( in_current_building_type <= BildingType_16 ) | 1458 if ( in_current_building_type <= BuildingType_16 ) |
1028 { | 1459 { |
1029 if ( (signed __int64)__PAIR__( | 1460 if ( (signed __int64)__PAIR__( |
1030 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], | 1461 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], |
1031 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) | 1462 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468]) >= (signed __int64)pParty->uTimePlayed ) |
1032 { | 1463 { |
1057 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; | 1488 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; |
1058 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); | 1489 *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); |
1059 } | 1490 } |
1060 return; | 1491 return; |
1061 } | 1492 } |
1062 if ( in_current_building_type != BildingType_TownHall ) | 1493 if ( in_current_building_type != BuildingType_TownHall ) |
1063 return; | 1494 return; |
1064 if ( in_current_building_type == BildingType_TownHall ) | 1495 if ( in_current_building_type == BuildingType_TownHall ) |
1065 { | 1496 { |
1066 if ( uMessageParam == 99 ) | 1497 if ( uMessageParam == 99 ) |
1067 { | 1498 { |
1068 v10 = (int)((char *)v8->ptr_1C - 102); | 1499 v10 = (int)((char *)v8->ptr_1C - 102); |
1069 v56 = v10; | 1500 v56 = v10; |
1282 } | 1713 } |
1283 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | 1714 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: |
1284 { | 1715 { |
1285 pDialogueWindow->eWindowType = WINDOW_MainMenu; | 1716 pDialogueWindow->eWindowType = WINDOW_MainMenu; |
1286 UI_CreateEndConversationButton(); | 1717 UI_CreateEndConversationButton(); |
1287 sub_4B3A72(in_current_building_type); | 1718 InitializaDialogueOptions_Tavern(in_current_building_type); |
1288 break; | 1719 break; |
1289 } | 1720 } |
1290 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | 1721 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: |
1291 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | 1722 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: |
1292 { | 1723 { |
1326 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); | 1757 v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1327 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; | 1758 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; |
1328 } | 1759 } |
1329 } | 1760 } |
1330 } | 1761 } |
1331 if ( in_current_building_type == BildingType_WeaponShop ) | 1762 if ( in_current_building_type == BuildingType_WeaponShop ) |
1332 { | 1763 { |
1333 v48 = 0; | 1764 v48 = 0; |
1334 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | 1765 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) |
1335 { | 1766 { |
1336 do | 1767 do |
1354 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); | 1785 v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); |
1355 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; | 1786 ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; |
1356 } | 1787 } |
1357 } | 1788 } |
1358 } | 1789 } |
1359 if ( in_current_building_type == BildingType_WeaponShop ) | 1790 if ( in_current_building_type == BuildingType_WeaponShop ) |
1360 { | 1791 { |
1361 v53 = 0; | 1792 v53 = 0; |
1362 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) | 1793 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) |
1363 { | 1794 { |
1364 do | 1795 do |
1383 } | 1814 } |
1384 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | 1815 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: |
1385 { | 1816 { |
1386 pDialogueWindow->eWindowType = WINDOW_MainMenu; | 1817 pDialogueWindow->eWindowType = WINDOW_MainMenu; |
1387 UI_CreateEndConversationButton(); | 1818 UI_CreateEndConversationButton(); |
1388 sub_4B3AD4(in_current_building_type); | 1819 InitializaDialogueOptions_Shops(in_current_building_type); |
1389 break; | 1820 break; |
1390 } | 1821 } |
1391 default: | 1822 default: |
1392 { | 1823 { |
1393 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) | 1824 if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) |
1406 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) | 1837 if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) |
1407 { | 1838 { |
1408 if ( pParty->uNumGold < v37 ) | 1839 if ( pParty->uNumGold < v37 ) |
1409 { | 1840 { |
1410 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); | 1841 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); |
1411 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) | 1842 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) |
1412 v39 = 4; | 1843 v39 = 4; |
1413 else | 1844 else |
1414 v39 = 2; | 1845 v39 = 2; |
1415 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); | 1846 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); |
1416 } | 1847 } |
1469 if ( !*(short *)v38 ) | 1900 if ( !*(short *)v38 ) |
1470 { | 1901 { |
1471 if ( pParty->uNumGold < v37 ) | 1902 if ( pParty->uNumGold < v37 ) |
1472 { | 1903 { |
1473 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); | 1904 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); |
1474 if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) | 1905 if ( in_current_building_type == BuildingType_Training || in_current_building_type == BuildingType_Tavern ) |
1475 v39 = 4; | 1906 v39 = 4; |
1476 else | 1907 else |
1477 v39 = 2; | 1908 v39 = 2; |
1478 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); | 1909 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, v39); |
1479 } | 1910 } |
1491 { | 1922 { |
1492 if ( uMessageParam == 94 ) | 1923 if ( uMessageParam == 94 ) |
1493 { | 1924 { |
1494 pDialogueWindow->eWindowType = WINDOW_MainMenu; | 1925 pDialogueWindow->eWindowType = WINDOW_MainMenu; |
1495 UI_CreateEndConversationButton(); | 1926 UI_CreateEndConversationButton(); |
1496 sub_4B3AD4(in_current_building_type); | 1927 InitializaDialogueOptions_Shops(in_current_building_type); |
1497 } | 1928 } |
1498 } | 1929 } |
1499 } | 1930 } |
1500 return; | 1931 return; |
1501 } | 1932 } |
1541 ++v43; | 1972 ++v43; |
1542 } | 1973 } |
1543 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); | 1974 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); |
1544 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); | 1975 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); |
1545 } | 1976 } |
1546 if ( in_current_building_type == BildingType_WeaponShop ) | 1977 if ( in_current_building_type == BuildingType_WeaponShop ) |
1547 { | 1978 { |
1548 v47 = v8->ptr_1C; | 1979 v47 = v8->ptr_1C; |
1549 v48 = 0; | 1980 v48 = 0; |
1550 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) | 1981 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) |
1551 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) | 1982 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) |
1586 ++v43; | 2017 ++v43; |
1587 } | 2018 } |
1588 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); | 2019 //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); |
1589 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); | 2020 while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); |
1590 } | 2021 } |
1591 if ( in_current_building_type == BildingType_WeaponShop ) | 2022 if ( in_current_building_type == BuildingType_WeaponShop ) |
1592 { | 2023 { |
1593 v52 = v8->ptr_1C; | 2024 v52 = v8->ptr_1C; |
1594 v53 = 0; | 2025 v53 = 0; |
1595 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) | 2026 //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) |
1596 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) | 2027 if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) |
1695 v53.uFrameZ = 334; | 2126 v53.uFrameZ = 334; |
1696 auto color_default = TargetColor(255, 255, 255); | 2127 auto color_default = TargetColor(255, 255, 255); |
1697 auto color_selected = TargetColor(255, 255, 155); | 2128 auto color_selected = TargetColor(255, 255, 155); |
1698 v3 = 52 * (unsigned int)v0->ptr_1C; | 2129 v3 = 52 * (unsigned int)v0->ptr_1C; |
1699 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); | 2130 //v59 = (GUIWindow *)((((p2DEvents_minus1___00[v3 / 2] != 27) - 1) & 0xFFFFFFE7) + 50); |
1700 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BildingType_Stables) - 1) & 0xFFFFFFE7) + 50); | 2131 //v59 = (GUIWindow *)((((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != BuildingType_Stables) - 1) & 0xFFFFFFE7) + 50); |
1701 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); | 2132 //v4 = (signed __int64)((double)(signed int)v59 * p2DEvents_minus1__20[v3 / 4]); |
1702 | 2133 |
1703 v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BildingType_Stables ? 25 : 50; | 2134 v4 = p2DEvents[(unsigned int)v0->ptr_1C - 1].uType == BuildingType_Stables ? 25 : 50; |
1704 v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier; | 2135 v4 *= p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier; |
1705 | 2136 |
1706 s1 = v4 * (100 - v1->GetMerchant()) / 100; | 2137 s1 = v4 * (100 - v1->GetMerchant()) / 100; |
1707 if ( (signed int)s1 < v4 / 3 ) | 2138 if ( (signed int)s1 < v4 / 3 ) |
1708 s1 = v4 / 3; | 2139 s1 = v4 / 3; |