comparison Events.cpp @ 540:d6711da258f1

Слияние
author Ritor1
date Sat, 02 Mar 2013 20:14:20 +0600
parents 1d876589a030 e7b3fa10d58d
children dde1083df4b7
comparison
equal deleted inserted replaced
539:75e80fc74045 540:d6711da258f1
336 // 336 //
337 if ( !sub_4465DF_check_season(_evt->v5) ) 337 if ( !sub_4465DF_check_season(_evt->v5) )
338 { 338 {
339 ++curr_seq_num; 339 ++curr_seq_num;
340 v4 = v124; 340 v4 = v124;
341
342 //v6 = v123;
343 //v7 = "";
344 break; 341 break;
345 } 342 }
346 v124 = -1; 343 v124 = -1;
347 curr_seq_num = _evt->v6 - 1; 344 curr_seq_num = _evt->v6 - 1;
348 ++curr_seq_num; 345 ++curr_seq_num;
531 } 528 }
532 else 529 else
533 { 530 {
534 v26 = (LevelDecoration *)activeLevelDecoration; 531 v26 = (LevelDecoration *)activeLevelDecoration;
535 stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; 532 stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0;
536 LOBYTE(v26->field_2) |= 0x20u; 533 v26->field_2 |= 0x0020;
537 } 534 }
538 ++curr_seq_num; 535 ++curr_seq_num;
539 v4 = v124; 536 v4 = v124;
540 537
541 //v6 = v123;
542 //v7 = "";
543 break; 538 break;
544 case EVENT_SetNPCGreeting: 539 case EVENT_SetNPCGreeting:
545 v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 540 v27 = EVT_DWORD(_evt->v5);
546 v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
547 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; 541 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu;
548 pNPCStats->pNewNPCData[v27].greet = v28; 542 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9);
549 ++curr_seq_num; 543 ++curr_seq_num;
550 v4 = v124; 544 v4 = v124;
551 545
552 //v6 = v123; 546 //v6 = v123;
553 //v7 = ""; 547 //v7 = "";
627 621
628 //v6 = v123; 622 //v6 = v123;
629 //v7 = ""; 623 //v7 = "";
630 break; 624 break;
631 case EVENT_NPCSetItem: 625 case EVENT_NPCSetItem:
632 sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 626 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
633 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); 627 ++curr_seq_num;
634 ++curr_seq_num; 628 v4 = v124;
635 v4 = v124; 629
636
637 //v6 = v123;
638 //v7 = "";
639 break; 630 break;
640 case EVENT_SetActorItem: 631 case EVENT_SetActorItem:
641 Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 632 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
642 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); 633 ++curr_seq_num;
643 ++curr_seq_num; 634 v4 = v124;
644 v4 = v124;
645
646 //v6 = v123;
647 //v7 = "";
648 break; 635 break;
649 case EVENT_SetNPCGroupNews: 636 case EVENT_SetNPCGroupNews:
650 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); 637 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8);
651 ++curr_seq_num; 638 ++curr_seq_num;
652 v4 = v124; 639 v4 = v124;
653
654 //v6 = v123;
655 //v7 = "";
656 break; 640 break;
657 case EVENT_SetActorGroup: 641 case EVENT_SetActorGroup:
658 __debugbreak(); 642 __debugbreak();
659 *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 643 *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
660 ++curr_seq_num; 644 ++curr_seq_num;
661 v4 = v124; 645 v4 = v124;
662
663 //v6 = v123;
664 //v7 = "";
665 break; 646 break;
666 case EVENT_ChangeGroup: 647 case EVENT_ChangeGroup:
667 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 648 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
668 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 649 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
669 v40 = uNumActors; 650 v40 = uNumActors;
710 //v7 = ""; 691 //v7 = "";
711 break; 692 break;
712 case EVENT_MoveNPC: 693 case EVENT_MoveNPC:
713 { 694 {
714 695
715 pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].Location2D = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 696 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9);
716 if ( window_SpeakInHouse ) 697 if ( window_SpeakInHouse )
717 { 698 {
718 v46 = window_SpeakInHouse->ptr_1C; 699
719 if ( v46 == (void *)165 ) 700 if ( window_SpeakInHouse->par1C == 165 )
720 { 701 {
721 sub_4BD8B5(); 702 sub_4BD8B5();
722 pVideoPlayer->Unload(); 703 pVideoPlayer->Unload();
723 window_SpeakInHouse->Release(); 704 window_SpeakInHouse->Release();
724 pParty->uFlags &= 0xFFFFFFFDu; 705 pParty->uFlags &= 0xFFFFFFFDu;
725 activeLevelDecoration = (LevelDecoration*)1; 706 activeLevelDecoration = (LevelDecoration*)1;
726 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) 707 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) )
727 { 708 {
728 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 709 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
729 v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); 710 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
730 window_SpeakInHouse = v47; 711 v48 = window_SpeakInHouse->pControlsHead;
731 v48 = v47->pControlsHead;
732 if ( v48 ) 712 if ( v48 )
733 { 713 {
734 do 714 do
735 { 715 {
736 v49 = v48->pNext; 716 v49 = v48->pNext;
737 pAllocator->FreeChunk(v48); 717 pAllocator->FreeChunk(v48);
738 v48 = v49; 718 v48 = v49;
739 } 719 }
740 while ( v49 ); 720 while ( v49 );
741 v47 = window_SpeakInHouse;
742 } 721 }
743 v47->pControlsHead = 0; 722 window_SpeakInHouse->pControlsHead = 0;
744 window_SpeakInHouse->pControlsTail = 0; 723 window_SpeakInHouse->pControlsTail = 0;
745 window_SpeakInHouse->uNumControls = 0; 724 window_SpeakInHouse->uNumControls = 0;
746 } 725 }
747 } 726 }
748 else 727 else
749 { 728 {
750 if ( v46 == (void *)553 ) 729 if ( window_SpeakInHouse->par1C == 553 )
751 pVideoPlayer->bLoopPlaying = 0; 730 pVideoPlayer->bLoopPlaying = 0;
752 } 731 }
753 } 732 }
754 ++curr_seq_num; 733
755 } 734 }
756 v4 = v124; 735 ++curr_seq_num;
757 736 v4 = v124;
758 //v6 = v123; 737
759 //v7 = "";
760 break; 738 break;
761 case EVENT_Jmp: 739 case EVENT_Jmp:
762 curr_seq_num = _evt->v5 - 1; 740 curr_seq_num = _evt->v5 - 1;
763 ++curr_seq_num; 741 ++curr_seq_num;
764 //v4 = -1; 742 v4 = -1;
765 743
766 //v6 = v123;
767 //v7 = "";
768 break; 744 break;
769 case EVENT_ShowFace: 745 case EVENT_ShowFace:
770 if ( _evt->v5 <= 3u ) //someone 746 if ( _evt->v5 <= 3u ) //someone
771 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); 747 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
772 else if ( _evt->v5 == 4 ) //active 748 else if ( _evt->v5 == 4 ) //active
778 } 754 }
779 else //random player 755 else //random player
780 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); 756 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
781 ++curr_seq_num; 757 ++curr_seq_num;
782 v4 = v124; 758 v4 = v124;
783 759
784 //v6 = v123;
785 //v7 = "";
786 break; 760 break;
787 case EVENT_CharacterAnimation: 761 case EVENT_CharacterAnimation:
788 if ( _evt->v5 <= 3u ) //someone 762 if ( _evt->v5 <= 3u ) //someone
789 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); 763 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0);
790 else if ( _evt->v5 == 4 ) //active 764 else if ( _evt->v5 == 4 ) //active
793 for(int i=0; i<4; ++i) 767 for(int i=0; i<4; ++i)
794 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); 768 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0);
795 else //random 769 else //random
796 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); 770 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0);
797 ++curr_seq_num; 771 ++curr_seq_num;
798 v4 = v124; 772 v4 = v124;
799 773
800 //v6 = v123;
801 //v7 = "";
802 break; 774 break;
803 case EVENT_ForPartyMember: 775 case EVENT_ForPartyMember:
804 player_choose = _evt->v5; 776 player_choose = _evt->v5;
805 ++curr_seq_num; 777 ++curr_seq_num;
806 v4 = v124; 778 v4 = v124;
807
808 //v6 = v123;
809 //v7 = "";
810 break; 779 break;
811 case EVENT_SummonItem: 780 case EVENT_SummonItem:
812 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 781 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
813 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), 782 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
814 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), 783 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8),
864 curr_seq_num = _evt->v11 - 1; 833 curr_seq_num = _evt->v11 - 1;
865 } 834 }
866 } 835 }
867 ++curr_seq_num; 836 ++curr_seq_num;
868 v4 = v124; 837 v4 = v124;
869 //v6 = v123;
870 //v7 = "";
871 break; 838 break;
872 case EVENT_IsActorAlive: 839 case EVENT_IsActorAlive:
873 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) 840 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
874 { 841 {
875 v124 = -1; 842 v124 = -1;
886 if ( pParty->pPickedItem.uItemID == pValue ) 853 if ( pParty->pPickedItem.uItemID == pValue )
887 { 854 {
888 pMouse->RemoveHoldingItem(); 855 pMouse->RemoveHoldingItem();
889 ++curr_seq_num; 856 ++curr_seq_num;
890 v4 = v124; 857 v4 = v124;
858
859 //v6 = v123;
860 //v7 = "";
891 break; 861 break;
892 } 862 }
893 v65 = 0; 863 v65 = 0;
894 v66 = pPlayers[uActiveCharacter]; 864 v66 = pPlayers[uActiveCharacter];
895 v67 = (int)v66->pInventoryIndices; 865 v67 = (int)v66->pInventoryIndices;
898 if ( (int)&v66->pInventoryItems[v67] == pValue ) 868 if ( (int)&v66->pInventoryItems[v67] == pValue )
899 { 869 {
900 v66->RemoveItemAtInventoryIndex(v65); 870 v66->RemoveItemAtInventoryIndex(v65);
901 ++curr_seq_num; 871 ++curr_seq_num;
902 v4 = v124; 872 v4 = v124;
873
874 //v6 = v123;
875 //v7 = "";
903 break; 876 break;
904 } 877 }
905 ++v65; 878 ++v65;
906 v67 += 4; 879 v67 += 4;
907 } 880 }
908 while ( (signed int)v65 < 126 ); 881 while ( (signed int)v65 < 126 );
909 v68 = 0; 882 v68 = 0;
910 v69 = (int)&v66->pEquipment; 883 v69 = (int)&v66->pEquipment;
911 do 884 do
912 { 885 {
913 if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue ) 886 if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue )
914 {
915 *(&v66->pEquipment.uOffHand + v68) = 0;
916 ++curr_seq_num;
917 v4 = v124;
918 break;
919 }
920 ++v68;
921 v69 += 4;
922 }
923 while ( v68 < 16 );
924 pPlayer = pPlayers[1];
925 while ( 1 )
926 {
927 v70 = pPlayer;
928 if ( !v64 )
929 {
930 v71 = 0;
931 v72 = (int)v70->pInventoryIndices;
932 do
933 { 887 {
934 if ( (int)&v70->pInventoryItems[v72] == pValue ) 888 *(&v66->pEquipment.uOffHand + v68) = 0;
889 ++curr_seq_num;
890 v4 = v124;
891
892 //v6 = v123;
893 //v7 = "";
894 break;
895 }
896 ++v68;
897 v69 += 4;
898 }
899 while ( v68 < 16 );
900 pPlayer = pPlayers[1];
901 while ( 1 )
902 {
903 v70 = pPlayer;
904 if ( !v64 )
935 { 905 {
936 v70->RemoveItemAtInventoryIndex(v71); 906 v71 = 0;
937 goto LABEL_169; 907 v72 = (int)v70->pInventoryIndices;
908 do
909 {
910 if ( (int)&v70->pInventoryItems[v72] == pValue )
911 {
912 v70->RemoveItemAtInventoryIndex(v71);
913 goto LABEL_169;
914 }
915 ++v71;
916 v72 += 4;
917 }
918 while ( (signed int)v71 < 126 );
919 v73 = 0;
920 v74 = (int)&v70->pEquipment;
921 while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue )
922 {
923 ++v73;
924 v74 += 4;
925 if ( v73 >= 16 )
926 goto LABEL_170;
927 }
928 *(&v70->pEquipment.uOffHand + v73) = 0;
929 LABEL_169:
930 v64 = 1;
938 } 931 }
939 ++v71; 932 LABEL_170:
940 v72 += 4; 933 pPlayer += 4;
934 if ( pPlayer > pPlayers[4] )
935 {
936 //++curr_seq_num;
937 v4 = v124;
938
939 //v6 = v123;
940 //v7 = "";
941 break;
942 }
941 } 943 }
942 while ( (signed int)v71 < 126 ); 944 }
943 v73 = 0;
944 v74 = (int)&v70->pEquipment;
945 while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue )
946 {
947 ++v73;
948 v74 += 4;
949 if ( v73 >= 16 )
950 goto LABEL_170;
951 }
952 *(&v70->pEquipment.uOffHand + v73) = 0;
953 LABEL_169:
954 v64 = 1;
955 }
956 LABEL_170:
957 pPlayer += 4;
958 if ( pPlayer > pPlayers[4] )
959 {
960 //++curr_seq_num;
961 v4 = v124;
962 break;
963 }
964 }
965 }
966 if ( player_choose <= 3 ) 945 if ( player_choose <= 3 )
967 { 946 {
968 pPlayer = &pParty->pPlayers[player_choose]; 947 pPlayer = &pParty->pPlayers[player_choose];
969 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 948 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
970 ++curr_seq_num;
971 v4 = v124;
972 break;
973 } 949 }
974 else if ( player_choose == 4 ) //active 950 else if ( player_choose == 4 ) //active
975 { 951 {
976 if ( uActiveCharacter ) 952 if ( uActiveCharacter )
977 { 953 {
978 pPlayer = pPlayers[uActiveCharacter]; 954 pPlayer = pPlayers[uActiveCharacter];
979 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 955 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
980 ++curr_seq_num;
981 v4 = v124;
982 break;
983 } 956 }
984 } 957 }
985 else if ( player_choose == 5 )//all 958 else if ( player_choose == 5 )//all
986 { 959 {
987 v130 = 0; 960 v130 = 0;
992 ++curr_seq_num; 965 ++curr_seq_num;
993 break; 966 break;
994 } 967 }
995 } 968 }
996 ++v130; 969 ++v130;
997 break;
998 } 970 }
999 else if ( player_choose == 6 ) //random 971 else if ( player_choose == 6 ) //random
1000 { 972 {
1001 player_choose = rand() % 4; 973 player_choose = rand() % 4;
1002 pPlayer = &pParty->pPlayers[player_choose]; 974 pPlayer = &pParty->pPlayers[player_choose];
1003 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 975 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1004 ++curr_seq_num; 976 }
1005 v4 = v124; 977 ++curr_seq_num;
1006 break; 978 v4 = v124;
1007 } 979 break;
1008 case EVENT_Set: 980 case EVENT_Set:
1009 pValue = EVT_DWORD(_evt->v7); 981 pValue = EVT_DWORD(_evt->v7);
1010 if ( player_choose <= 3 ) 982 if ( player_choose <= 3 )
1011 { 983 {
1012 pPlayer = &pParty->pPlayers[player_choose]; 984 pPlayer = &pParty->pPlayers[player_choose];
1013 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 985 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1014 ++curr_seq_num;
1015 v4 = v124;
1016 break;
1017 } 986 }
1018 else if ( player_choose == 4 ) //active 987 else if ( player_choose == 4 ) //active
1019 { 988 {
1020 if ( uActiveCharacter ) 989 if ( uActiveCharacter )
1021 { 990 {
1022 pPlayer = pPlayers[uActiveCharacter]; 991 pPlayer = pPlayers[uActiveCharacter];
1023 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 992 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1024 ++curr_seq_num;
1025 v4 = v124;
1026 break;
1027 } 993 }
1028 } 994 }
1029 else if ( player_choose == 5 )//all 995 else if ( player_choose == 5 )//all
1030 { 996 {
997 //recheck v130
1031 for(int i = 1; i < 5; ++i) 998 for(int i = 1; i < 5; ++i)
1032 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 999 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1033 ++curr_seq_num; 1000
1034 v4 = v124;
1035 break;
1036 } 1001 }
1037 else if ( player_choose == 6 ) //random 1002 else if ( player_choose == 6 ) //random
1038 { 1003 {
1039 player_choose = rand() % 4; 1004 player_choose = rand() % 4;
1040 pPlayer = &pParty->pPlayers[player_choose]; 1005 pPlayer = &pParty->pPlayers[player_choose];
1041 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1006 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1042 ++curr_seq_num; 1007
1043 v4 = v124; 1008 }
1044 break; 1009 ++curr_seq_num;
1045 } 1010 v4 = v124;
1011 break;
1046 case EVENT_Add: 1012 case EVENT_Add:
1047 pValue = EVT_DWORD(_evt->v7); 1013 pValue = EVT_DWORD(_evt->v7);
1048 if ( player_choose <= 3 ) 1014 if ( player_choose <= 3 )
1049 { 1015 {
1050 pPlayer = &pParty->pPlayers[player_choose]; 1016 pPlayer = &pParty->pPlayers[player_choose];
1051 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1017 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1052 v83 = EVT_WORD(_evt->v5);
1053 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1054 viewparams->bRedrawGameUI = 1;
1055 ++curr_seq_num;
1056 v4 = v124;
1057 break;
1058 } 1018 }
1059 else if ( player_choose == 4 ) //active 1019 else if ( player_choose == 4 ) //active
1060 { 1020 {
1061 if ( uActiveCharacter ) 1021 if ( uActiveCharacter )
1062 { 1022 {
1063 pPlayer = pPlayers[uActiveCharacter]; 1023 pPlayer = pPlayers[uActiveCharacter];
1064 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1024 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1065 v83 = EVT_WORD(_evt->v5);
1066 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1067 viewparams->bRedrawGameUI = 1;
1068 ++curr_seq_num;
1069 v4 = v124;
1070 break;
1071 } 1025 }
1072 } 1026 }
1073 else if ( player_choose == 5 )//all 1027 else if ( player_choose == 5 )//all
1074 { 1028 {
1075 //v130 = 0; 1029 //v130 = 0;
1076 for(int i = 1; i < 5; ++i) 1030 for(int i = 1; i < 5; ++i)
1077 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1031 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1078 v83 = EVT_WORD(_evt->v5); 1032
1079 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1080 viewparams->bRedrawGameUI = 1;
1081 ++curr_seq_num;
1082 v4 = v124;
1083 break;
1084 } 1033 }
1085 else if ( player_choose == 6 ) //random 1034 else if ( player_choose == 6 ) //random
1086 { 1035 {
1087 player_choose = rand() % 4; 1036 player_choose = rand() % 4;
1088 pPlayer = &pParty->pPlayers[player_choose]; 1037 pPlayer = &pParty->pPlayers[player_choose];
1089 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1038 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1090 v83 = EVT_WORD(_evt->v5); 1039 }
1091 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) 1040 v83 = EVT_WORD(_evt->v5);
1092 viewparams->bRedrawGameUI = 1; 1041 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1093 ++curr_seq_num; 1042 viewparams->bRedrawGameUI = 1;
1094 v4 = v124; 1043 ++curr_seq_num;
1095 break; 1044 v4 = v124;
1096 } 1045 break;
1097 case EVENT_InputString: 1046 case EVENT_InputString:
1098 if ( !start_event_seq_number ) 1047 if ( !start_event_seq_number )
1099 { 1048 {
1100 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); 1049 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
1101 v105 = curr_seq_num; 1050 v105 = curr_seq_num;
1102 v121 = 26; 1051 v121 = 26;
1103 LABEL_295: 1052 LABEL_295:
1104 sub_4451A8_press_any_key(uEventID, v105, v121); 1053 sub_4451A8_press_any_key(uEventID, v105, v121);
1105 LABEL_301: 1054 LABEL_301:
1126 break; 1075 break;
1127 case EVENT_RandomGoTo: 1076 case EVENT_RandomGoTo:
1128 //v124 = -1; 1077 //v124 = -1;
1129 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) 1078 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0)
1130 + (_evt->v10 != 0))); 1079 + (_evt->v10 != 0)));
1131 goto LABEL_131; 1080 curr_seq_num = v11 - 1;
1081 ++curr_seq_num;
1082 v4 = v124;
1132 case EVENT_ReceiveDamage: 1083 case EVENT_ReceiveDamage:
1133 v85 = EVT_DWORD(_evt->v7); 1084 v85 = EVT_DWORD(_evt->v7 );
1134 v86 = _evt->v5; 1085 v86 = _evt->v5;
1135 if ( (unsigned __int8)v86 <= 3u ) 1086 if ( (unsigned __int8)v86 <= 3u )
1136 { 1087 {
1137 v119 = _evt->v6; 1088 v119 = _evt->v6;
1138 v115 = EVT_DWORD(_evt->v7); 1089 v115 = EVT_DWORD(_evt->v7 );
1139 v89 = (unsigned __int8)v86; 1090 v89 = (unsigned __int8)v86;
1140 goto LABEL_233; 1091 goto LABEL_233;
1141 } 1092 }
1142 if ( v86 == 4 ) 1093 if ( v86 == 4 )
1143 { 1094 {
1150 //v7 = ""; 1101 //v7 = "";
1151 break; 1102 break;
1152 } 1103 }
1153 v119 = _evt->v6; 1104 v119 = _evt->v6;
1154 v88 = pPlayers[uActiveCharacter]; 1105 v88 = pPlayers[uActiveCharacter];
1155 v115 = EVT_DWORD(_evt->v7); 1106 v115 = EVT_DWORD(_evt->v7 );
1156 goto LABEL_234; 1107 goto LABEL_234;
1157 } 1108 }
1158 if ( v86 != 5 ) 1109 if ( v86 != 5 )
1159 { 1110 {
1160 v119 = _evt->v6; 1111 v119 = _evt->v6;
1161 v115 = EVT_DWORD(_evt->v7); 1112 v115 = EVT_DWORD(_evt->v7 );
1162 v89 = rand() % 4; 1113 v89 = rand() % 4;
1163 LABEL_233: 1114 LABEL_233:
1164 v88 = &pParty->pPlayers[v89]; 1115 v88 = &pParty->pPlayers[v89];
1165 LABEL_234: 1116 LABEL_234:
1166 v88->ReceiveDamage(v115, v119); 1117 v88->ReceiveDamage(v115, v119);
1183 1134
1184 //v6 = v123; 1135 //v6 = v123;
1185 //v7 = ""; 1136 //v7 = "";
1186 break; 1137 break;
1187 case EVENT_ToggleIndoorLight: 1138 case EVENT_ToggleIndoorLight:
1188 pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); 1139 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9);
1189 ++curr_seq_num; 1140 ++curr_seq_num;
1190 v4 = v124; 1141 v4 = v124;
1191 1142
1192 //v6 = v123; 1143 //v6 = v123;
1193 //v7 = ""; 1144 //v7 = "";
1194 break; 1145 break;
1195 case EVENT_SetFacesBit: 1146 case EVENT_SetFacesBit:
1196 sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 1147 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
1197 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
1198 ++curr_seq_num; 1148 ++curr_seq_num;
1199 v4 = v124; 1149 v4 = v124;
1200 1150
1201 //v6 = v123; 1151 //v6 = v123;
1202 //v7 = ""; 1152 //v7 = "";
1203 break; 1153 break;
1204 case EVENT_ToggleChestFlag: 1154 case EVENT_ToggleChestFlag:
1205 Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 1155 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1206 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
1207 ++curr_seq_num; 1156 ++curr_seq_num;
1208 v4 = v124; 1157 v4 = v124;
1209 1158
1210 //v6 = v123; 1159 //v6 = v123;
1211 //v7 = ""; 1160 //v7 = "";
1212 break; 1161 break;
1213 case EVENT_ToggleActorFlag: 1162 case EVENT_ToggleActorFlag:
1214 Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 1163 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1215 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
1216 ++curr_seq_num; 1164 ++curr_seq_num;
1217 v4 = v124; 1165 v4 = v124;
1218 1166
1219 //v6 = v123; 1167 //v6 = v123;
1220 //v7 = ""; 1168 //v7 = "";
1221 break; 1169 break;
1222 case EVENT_ToggleActorGroupFlag: 1170 case EVENT_ToggleActorGroupFlag:
1223 ToggleActorGroupFlag( 1171 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1224 _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
1225 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
1226 _evt->v13);
1227 ++curr_seq_num; 1172 ++curr_seq_num;
1228 v4 = v124; 1173 v4 = v124;
1229 1174
1230 //v6 = v123; 1175 //v6 = v123;
1231 //v7 = ""; 1176 //v7 = "";
1238 1183
1239 //v6 = v123; 1184 //v6 = v123;
1240 //v7 = ""; 1185 //v7 = "";
1241 break; 1186 break;
1242 case EVENT_StatusText: 1187 case EVENT_StatusText:
1243 v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1188 v90 = EVT_DWORD(_evt->v5 );
1244 if ( activeLevelDecoration ) 1189 if ( activeLevelDecoration )
1245 { 1190 {
1246 if ( activeLevelDecoration == (void*)1 ) 1191 if ( activeLevelDecoration == (LevelDecoration*)1 )
1247 { 1192 {
1248 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; 1193 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
1249 ++curr_seq_num;
1250 v4 = v124;
1251
1252 //v6 = v123;
1253 //v7 = "";
1254 break;
1255 } 1194 }
1256 if ( canShowMessages == 1 ) 1195 if ( canShowMessages == 1 )
1257 { 1196 {
1258 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; 1197 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
1259 //LABEL_248: 1198 //LABEL_248:
1260 ShowStatusBarString(v91, 2u); 1199 ShowStatusBarString(v91, 2u);
1261 ++curr_seq_num;
1262 v4 = v124;
1263
1264 //v6 = v123;
1265 //v7 = "";
1266 break;
1267 } 1200 }
1268 } 1201 }
1269 else 1202 else
1270 { 1203 {
1271 if ( canShowMessages == 1 ) 1204 if ( canShowMessages == 1 )
1272 { 1205 {
1273 v91 = &pLevelStr[pLevelStrOffsets[v90]]; 1206 v91 = &pLevelStr[pLevelStrOffsets[v90]];
1274 ShowStatusBarString(v91, 2u); 1207 ShowStatusBarString(v91, 2u);
1275 ++curr_seq_num;
1276 v4 = v124;
1277
1278 //v6 = v123;
1279 //v7 = "";
1280 break;
1281 } 1208 }
1282 } 1209 }
1283 ++curr_seq_num; 1210 ++curr_seq_num;
1284 v4 = v124; 1211 v4 = v124;
1285 1212
1286 //v6 = v123; 1213 //v6 = v123;
1287 //v7 = ""; 1214 //v7 = "";
1288 break; 1215 break;
1289 case EVENT_ShowMessage: 1216 case EVENT_ShowMessage:
1290 v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1217 v92 = EVT_DWORD(_evt->v5 );
1291 if ( activeLevelDecoration ) 1218 if ( activeLevelDecoration )
1292 { 1219 {
1293 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; 1220 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
1294 byte_5B0938[0] = 0; 1221 byte_5B0938[0] = 0;
1295 ptr_F8B1E8 = v93; 1222 ptr_F8B1E8 = v93;
1303 1230
1304 //v6 = v123; 1231 //v6 = v123;
1305 //v7 = ""; 1232 //v7 = "";
1306 break; 1233 break;
1307 case EVENT_CastSpell: 1234 case EVENT_CastSpell:
1308 sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), 1235 sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ),
1309 _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), 1236 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
1310 _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), 1237 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 ));
1311 _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), 1238 ++curr_seq_num;
1312 _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), 1239 v4 = v124;
1313 _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); 1240
1314 ++curr_seq_num;
1315 v4 = v124;
1316
1317 //v6 = v123;
1318 //v7 = "";
1319 break; 1241 break;
1320 case EVENT_SetTexture: 1242 case EVENT_SetTexture:
1321 sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); 1243 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9);
1322 ++curr_seq_num; 1244 ++curr_seq_num;
1323 v4 = v124; 1245 v4 = v124;
1324 1246
1325 //v6 = v123; 1247 //v6 = v123;
1326 //v7 = ""; 1248 //v7 = "";
1327 break; 1249 break;
1328 case EVENT_SetSprite: 1250 case EVENT_SetSprite:
1329 SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); 1251 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10);
1330 ++curr_seq_num; 1252 ++curr_seq_num;
1331 v4 = v124; 1253 v4 = v124;
1332 1254
1333 //v6 = v123; 1255 //v6 = v123;
1334 //v7 = ""; 1256 //v7 = "";
1335 break; 1257 break;
1336 case EVENT_SummonMonsters: 1258 case EVENT_SummonMonsters:
1337 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7, 1259 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ),
1338 _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), 1260 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
1339 _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), 1261 EVT_DWORD(_evt->v24 ));
1340 _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8),
1341 _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8),
1342 _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8));
1343 ++curr_seq_num; 1262 ++curr_seq_num;
1344 v4 = v124; 1263 v4 = v124;
1345 1264
1346 //v6 = v123; 1265 //v6 = v123;
1347 //v7 = ""; 1266 //v7 = "";
1506 pRenderer->_49FD3A(); 1425 pRenderer->_49FD3A();
1507 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 1426 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
1508 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); 1427 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
1509 v104 = 187; 1428 v104 = 187;
1510 if ( uCurrentHouse_Animation != 167 ) 1429 if ( uCurrentHouse_Animation != 167 )
1511 v104 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1430 v104 = EVT_DWORD(_evt->v5);
1512 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); 1431 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
1513 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0); 1432 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0);
1514 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0); 1433 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0);
1515 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0); 1434 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0);
1516 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0); 1435 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0);
1517 window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); 1436 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
1518 } 1437 }
1519 ++curr_seq_num; 1438 ++curr_seq_num;
1520 v4 = v124; 1439 v4 = v124;
1521 1440
1522 //v6 = v123; 1441 //v6 = v123;