comparison Events.cpp @ 552:bee46636df95

Merge
author Nomad
date Mon, 04 Mar 2013 20:29:31 +0200
parents dde1083df4b7
children f451efdb7c8b
comparison
equal deleted inserted replaced
551:3b4a24fcd5a0 552:bee46636df95
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;
880 break; 847 break;
881 case EVENT_Substract: 848 case EVENT_Substract:
882 pValue = EVT_DWORD(_evt->v7); 849 pValue = EVT_DWORD(_evt->v7);
883 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) 850 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
884 { 851 {
885 v64 = 0; 852 if ( pParty->pPickedItem.uItemID == pValue )//In hand
886 if ( pParty->pPickedItem.uItemID == pValue )
887 { 853 {
888 pMouse->RemoveHoldingItem(); 854 pMouse->RemoveHoldingItem();
889 ++curr_seq_num; 855 ++curr_seq_num;
890 v4 = v124; 856 v4 = v124;
891
892 //v6 = v123;
893 //v7 = "";
894 break; 857 break;
895 } 858 }
896 v65 = 0; 859 v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices;
897 v66 = pPlayers[uActiveCharacter]; 860 for ( v65 = 0; v65 < 126; ++v65 )
898 v67 = (int)v66->pInventoryIndices; 861 {
899 do 862 if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue )
900 { 863 {
901 if ( (int)&v66->pInventoryItems[v67] == pValue ) 864 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65);
902 {
903 v66->RemoveItemAtInventoryIndex(v65);
904 ++curr_seq_num; 865 ++curr_seq_num;
905 v4 = v124; 866 v4 = v124;
906
907 //v6 = v123;
908 //v7 = "";
909 break; 867 break;
910 } 868 }
911 ++v65;
912 v67 += 4; 869 v67 += 4;
913 } 870 }
914 while ( (signed int)v65 < 126 ); 871 while ( (signed int)v65 < 126 );
915 v68 = 0; 872 v69 = (int)&pPlayers[uActiveCharacter]->pEquipment;
916 v69 = (int)&v66->pEquipment; 873 for ( v68 = 0; v68 < 16; ++v68 )
917 do 874 {
918 { 875 if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue )
919 if ( *(int *)v69 && (int)&v66->pInventoryItems[v69] == pValue ) 876 {
877 *(&pPlayers[uActiveCharacter]->pEquipment.uOffHand + v68) = 0;
878 ++curr_seq_num;
879 v4 = v124;
880 break;
881 }
882 v69 += 4;
883 }
884 for (int i = 1; i < 5; i++)
885 {
886 v72 = (int)pPlayers[i]->pInventoryIndices;
887 for ( int v71 = 0; v71 < 126; ++v71 )
888 {
889 if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue )
920 { 890 {
921 *(&v66->pEquipment.uOffHand + v68) = 0; 891 pPlayers[i]->RemoveItemAtInventoryIndex(v71);
922 ++curr_seq_num;
923 v4 = v124;
924
925 //v6 = v123;
926 //v7 = "";
927 break; 892 break;
928 } 893 }
929 ++v68; 894 v72 += 4;
930 v69 += 4; 895 }
931 } 896 v73 = 0;
932 while ( v68 < 16 ); 897 v74 = (int)&pPlayers[i]->pEquipment;
933 pPlayer = pPlayers[1]; 898 while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue )
934 while ( 1 ) 899 {
935 { 900 ++v73;
936 v70 = pPlayer; 901 v74 += 4;
937 if ( !v64 ) 902 if ( v73 >= 16 )
938 { 903 break;
939 v71 = 0; 904 }
940 v72 = (int)v70->pInventoryIndices; 905 *(&pPlayers[i]->pEquipment.uOffHand + v73) = 0;
941 do 906 }
942 { 907 }
943 if ( (int)&v70->pInventoryItems[v72] == pValue )
944 {
945 v70->RemoveItemAtInventoryIndex(v71);
946 goto LABEL_169;
947 }
948 ++v71;
949 v72 += 4;
950 }
951 while ( (signed int)v71 < 126 );
952 v73 = 0;
953 v74 = (int)&v70->pEquipment;
954 while ( !*(int *)v74 || (int)&v70->pInventoryItems[v74] != pValue )
955 {
956 ++v73;
957 v74 += 4;
958 if ( v73 >= 16 )
959 goto LABEL_170;
960 }
961 *(&v70->pEquipment.uOffHand + v73) = 0;
962 LABEL_169:
963 v64 = 1;
964 }
965 LABEL_170:
966 pPlayer += 4;
967 if ( pPlayer > pPlayers[4] )
968 {
969 //++curr_seq_num;
970 v4 = v124;
971
972 //v6 = v123;
973 //v7 = "";
974 break;
975 }
976 }
977 }
978 if ( player_choose <= 3 ) 908 if ( player_choose <= 3 )
979 { 909 {
980 pPlayer = &pParty->pPlayers[player_choose]; 910 pPlayer = &pParty->pPlayers[player_choose];
981 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 911 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
982 ++curr_seq_num;
983 v4 = v124;
984 break;
985 } 912 }
986 else if ( player_choose == 4 ) //active 913 else if ( player_choose == 4 ) //active
987 { 914 {
988 if ( uActiveCharacter ) 915 if ( uActiveCharacter )
989 { 916 {
990 pPlayer = pPlayers[uActiveCharacter]; 917 pPlayer = pPlayers[uActiveCharacter];
991 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 918 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
992 ++curr_seq_num;
993 v4 = v124;
994 break;
995 } 919 }
996 } 920 }
997 else if ( player_choose == 5 )//all 921 else if ( player_choose == 5 )//all
998 { 922 {
999 v130 = 0; 923 v130 = 0;
1000 for(int i = 0; i < 4; ++i) 924 for(int i = 0; i < 4; ++i)
1001 { 925 {
1002 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 926 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
1003 {
1004 ++curr_seq_num;
1005 break; 927 break;
1006 }
1007 } 928 }
1008 ++v130; 929 ++v130;
1009 break;
1010 } 930 }
1011 else if ( player_choose == 6 ) //random 931 else if ( player_choose == 6 ) //random
1012 { 932 {
1013 player_choose = rand() % 4; 933 player_choose = rand() % 4;
1014 pPlayer = &pParty->pPlayers[player_choose]; 934 pPlayer = &pParty->pPlayers[player_choose];
1015 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 935 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1016 ++curr_seq_num; 936 }
1017 v4 = v124; 937 ++curr_seq_num;
1018 break; 938 v4 = v124;
1019 } 939 break;
1020 case EVENT_Set: 940 case EVENT_Set:
1021 pValue = EVT_DWORD(_evt->v7); 941 pValue = EVT_DWORD(_evt->v7);
1022 if ( player_choose <= 3 ) 942 if ( player_choose <= 3 )
1023 { 943 {
1024 pPlayer = &pParty->pPlayers[player_choose]; 944 pPlayer = &pParty->pPlayers[player_choose];
1025 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 945 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1026 ++curr_seq_num;
1027 v4 = v124;
1028 break;
1029 } 946 }
1030 else if ( player_choose == 4 ) //active 947 else if ( player_choose == 4 ) //active
1031 { 948 {
1032 if ( uActiveCharacter ) 949 if ( uActiveCharacter )
1033 { 950 {
1034 pPlayer = pPlayers[uActiveCharacter]; 951 pPlayer = pPlayers[uActiveCharacter];
1035 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 952 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1036 ++curr_seq_num;
1037 v4 = v124;
1038 break;
1039 } 953 }
1040 } 954 }
1041 else if ( player_choose == 5 )//all 955 else if ( player_choose == 5 )//all
1042 { 956 {
957 //recheck v130
1043 for(int i = 1; i < 5; ++i) 958 for(int i = 1; i < 5; ++i)
1044 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 959 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1045 ++curr_seq_num; 960
1046 v4 = v124;
1047 break;
1048 } 961 }
1049 else if ( player_choose == 6 ) //random 962 else if ( player_choose == 6 ) //random
1050 { 963 {
1051 player_choose = rand() % 4; 964 player_choose = rand() % 4;
1052 pPlayer = &pParty->pPlayers[player_choose]; 965 pPlayer = &pParty->pPlayers[player_choose];
1053 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 966 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1054 ++curr_seq_num; 967
1055 v4 = v124; 968 }
1056 break; 969 ++curr_seq_num;
1057 } 970 v4 = v124;
971 break;
1058 case EVENT_Add: 972 case EVENT_Add:
1059 pValue = EVT_DWORD(_evt->v7); 973 pValue = EVT_DWORD(_evt->v7);
1060 if ( player_choose <= 3 ) 974 if ( player_choose <= 3 )
1061 { 975 {
1062 pPlayer = &pParty->pPlayers[player_choose]; 976 pPlayer = &pParty->pPlayers[player_choose];
1063 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 977 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1064 v83 = EVT_WORD(_evt->v5);
1065 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1066 viewparams->bRedrawGameUI = 1;
1067 ++curr_seq_num;
1068 v4 = v124;
1069 break;
1070 } 978 }
1071 else if ( player_choose == 4 ) //active 979 else if ( player_choose == 4 ) //active
1072 { 980 {
1073 if ( uActiveCharacter ) 981 if ( uActiveCharacter )
1074 { 982 {
1075 pPlayer = pPlayers[uActiveCharacter]; 983 pPlayer = pPlayers[uActiveCharacter];
1076 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 984 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1077 v83 = EVT_WORD(_evt->v5);
1078 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1079 viewparams->bRedrawGameUI = 1;
1080 ++curr_seq_num;
1081 v4 = v124;
1082 break;
1083 } 985 }
1084 } 986 }
1085 else if ( player_choose == 5 )//all 987 else if ( player_choose == 5 )//all
1086 { 988 {
1087 //v130 = 0; 989 //v130 = 0;
1088 for(int i = 1; i < 5; ++i) 990 for(int i = 1; i < 5; ++i)
1089 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 991 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1090 v83 = EVT_WORD(_evt->v5); 992
1091 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1092 viewparams->bRedrawGameUI = 1;
1093 ++curr_seq_num;
1094 v4 = v124;
1095 break;
1096 } 993 }
1097 else if ( player_choose == 6 ) //random 994 else if ( player_choose == 6 ) //random
1098 { 995 {
1099 player_choose = rand() % 4; 996 player_choose = rand() % 4;
1100 pPlayer = &pParty->pPlayers[player_choose]; 997 pPlayer = &pParty->pPlayers[player_choose];
1101 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 998 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1102 v83 = EVT_WORD(_evt->v5); 999 }
1103 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) 1000 v83 = EVT_WORD(_evt->v5);
1104 viewparams->bRedrawGameUI = 1; 1001 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1105 ++curr_seq_num; 1002 viewparams->bRedrawGameUI = 1;
1106 v4 = v124; 1003 ++curr_seq_num;
1107 break; 1004 v4 = v124;
1108 } 1005 break;
1109 case EVENT_InputString: 1006 case EVENT_InputString:
1110 if ( !start_event_seq_number ) 1007 if ( !start_event_seq_number )
1111 { 1008 {
1112 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); 1009 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
1113 v105 = curr_seq_num; 1010 v105 = curr_seq_num;
1114 v121 = 26; 1011 v121 = 26;
1115 LABEL_295: 1012 LABEL_295:
1116 sub_4451A8_press_any_key(uEventID, v105, v121); 1013 sub_4451A8_press_any_key(uEventID, v105, v121);
1117 LABEL_301: 1014 LABEL_301:
1138 break; 1035 break;
1139 case EVENT_RandomGoTo: 1036 case EVENT_RandomGoTo:
1140 //v124 = -1; 1037 //v124 = -1;
1141 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) 1038 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0)
1142 + (_evt->v10 != 0))); 1039 + (_evt->v10 != 0)));
1143 goto LABEL_131; 1040 curr_seq_num = v11 - 1;
1041 ++curr_seq_num;
1042 v4 = v124;
1144 case EVENT_ReceiveDamage: 1043 case EVENT_ReceiveDamage:
1145 v85 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); 1044 v85 = EVT_DWORD(_evt->v7 );
1146 v86 = _evt->v5; 1045 v86 = _evt->v5;
1147 if ( (unsigned __int8)v86 <= 3u ) 1046 if ( (unsigned __int8)v86 <= 3u )
1148 { 1047 {
1149 v119 = _evt->v6; 1048 v119 = _evt->v6;
1150 v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); 1049 v115 = EVT_DWORD(_evt->v7 );
1151 v89 = (unsigned __int8)v86; 1050 v89 = (unsigned __int8)v86;
1152 goto LABEL_233; 1051 goto LABEL_233;
1153 } 1052 }
1154 if ( v86 == 4 ) 1053 if ( v86 == 4 )
1155 { 1054 {
1162 //v7 = ""; 1061 //v7 = "";
1163 break; 1062 break;
1164 } 1063 }
1165 v119 = _evt->v6; 1064 v119 = _evt->v6;
1166 v88 = pPlayers[uActiveCharacter]; 1065 v88 = pPlayers[uActiveCharacter];
1167 v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); 1066 v115 = EVT_DWORD(_evt->v7 );
1168 goto LABEL_234; 1067 goto LABEL_234;
1169 } 1068 }
1170 if ( v86 != 5 ) 1069 if ( v86 != 5 )
1171 { 1070 {
1172 v119 = _evt->v6; 1071 v119 = _evt->v6;
1173 v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10<< 8)) << 8)) << 8); 1072 v115 = EVT_DWORD(_evt->v7 );
1174 v89 = rand() % 4; 1073 v89 = rand() % 4;
1175 LABEL_233: 1074 LABEL_233:
1176 v88 = &pParty->pPlayers[v89]; 1075 v88 = &pParty->pPlayers[v89];
1177 LABEL_234: 1076 LABEL_234:
1178 v88->ReceiveDamage(v115, v119); 1077 v88->ReceiveDamage(v115, v119);
1195 1094
1196 //v6 = v123; 1095 //v6 = v123;
1197 //v7 = ""; 1096 //v7 = "";
1198 break; 1097 break;
1199 case EVENT_ToggleIndoorLight: 1098 case EVENT_ToggleIndoorLight:
1200 pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); 1099 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9);
1201 ++curr_seq_num; 1100 ++curr_seq_num;
1202 v4 = v124; 1101 v4 = v124;
1203 1102
1204 //v6 = v123; 1103 //v6 = v123;
1205 //v7 = ""; 1104 //v7 = "";
1206 break; 1105 break;
1207 case EVENT_SetFacesBit: 1106 case EVENT_SetFacesBit:
1208 sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 1107 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
1209 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
1210 ++curr_seq_num; 1108 ++curr_seq_num;
1211 v4 = v124; 1109 v4 = v124;
1212 1110
1213 //v6 = v123; 1111 //v6 = v123;
1214 //v7 = ""; 1112 //v7 = "";
1215 break; 1113 break;
1216 case EVENT_ToggleChestFlag: 1114 case EVENT_ToggleChestFlag:
1217 Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 1115 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1218 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
1219 ++curr_seq_num; 1116 ++curr_seq_num;
1220 v4 = v124; 1117 v4 = v124;
1221 1118
1222 //v6 = v123; 1119 //v6 = v123;
1223 //v7 = ""; 1120 //v7 = "";
1224 break; 1121 break;
1225 case EVENT_ToggleActorFlag: 1122 case EVENT_ToggleActorFlag:
1226 Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 1123 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1227 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13);
1228 ++curr_seq_num; 1124 ++curr_seq_num;
1229 v4 = v124; 1125 v4 = v124;
1230 1126
1231 //v6 = v123; 1127 //v6 = v123;
1232 //v7 = ""; 1128 //v7 = "";
1233 break; 1129 break;
1234 case EVENT_ToggleActorGroupFlag: 1130 case EVENT_ToggleActorGroupFlag:
1235 ToggleActorGroupFlag( 1131 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1236 _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
1237 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
1238 _evt->v13);
1239 ++curr_seq_num; 1132 ++curr_seq_num;
1240 v4 = v124; 1133 v4 = v124;
1241 1134
1242 //v6 = v123; 1135 //v6 = v123;
1243 //v7 = ""; 1136 //v7 = "";
1250 1143
1251 //v6 = v123; 1144 //v6 = v123;
1252 //v7 = ""; 1145 //v7 = "";
1253 break; 1146 break;
1254 case EVENT_StatusText: 1147 case EVENT_StatusText:
1255 v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1148 v90 = EVT_DWORD(_evt->v5 );
1256 if ( activeLevelDecoration ) 1149 if ( activeLevelDecoration )
1257 { 1150 {
1258 if ( activeLevelDecoration == (void*)1 ) 1151 if ( activeLevelDecoration == (LevelDecoration*)1 )
1259 { 1152 {
1260 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; 1153 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
1261 ++curr_seq_num;
1262 v4 = v124;
1263
1264 //v6 = v123;
1265 //v7 = "";
1266 break;
1267 } 1154 }
1268 if ( canShowMessages == 1 ) 1155 if ( canShowMessages == 1 )
1269 { 1156 {
1270 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; 1157 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
1271 //LABEL_248: 1158 //LABEL_248:
1272 ShowStatusBarString(v91, 2u); 1159 ShowStatusBarString(v91, 2u);
1273 ++curr_seq_num;
1274 v4 = v124;
1275
1276 //v6 = v123;
1277 //v7 = "";
1278 break;
1279 } 1160 }
1280 } 1161 }
1281 else 1162 else
1282 { 1163 {
1283 if ( canShowMessages == 1 ) 1164 if ( canShowMessages == 1 )
1284 { 1165 {
1285 v91 = &pLevelStr[pLevelStrOffsets[v90]]; 1166 v91 = &pLevelStr[pLevelStrOffsets[v90]];
1286 ShowStatusBarString(v91, 2u); 1167 ShowStatusBarString(v91, 2u);
1287 ++curr_seq_num;
1288 v4 = v124;
1289
1290 //v6 = v123;
1291 //v7 = "";
1292 break;
1293 } 1168 }
1294 } 1169 }
1295 ++curr_seq_num; 1170 ++curr_seq_num;
1296 v4 = v124; 1171 v4 = v124;
1297 1172
1298 //v6 = v123; 1173 //v6 = v123;
1299 //v7 = ""; 1174 //v7 = "";
1300 break; 1175 break;
1301 case EVENT_ShowMessage: 1176 case EVENT_ShowMessage:
1302 v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1177 v92 = EVT_DWORD(_evt->v5 );
1303 if ( activeLevelDecoration ) 1178 if ( activeLevelDecoration )
1304 { 1179 {
1305 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; 1180 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
1306 byte_5B0938[0] = 0; 1181 byte_5B0938[0] = 0;
1307 ptr_F8B1E8 = v93; 1182 ptr_F8B1E8 = v93;
1315 1190
1316 //v6 = v123; 1191 //v6 = v123;
1317 //v7 = ""; 1192 //v7 = "";
1318 break; 1193 break;
1319 case EVENT_CastSpell: 1194 case EVENT_CastSpell:
1320 sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), 1195 sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ),
1321 _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), 1196 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
1322 _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), 1197 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 ));
1323 _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), 1198 ++curr_seq_num;
1324 _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), 1199 v4 = v124;
1325 _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); 1200
1326 ++curr_seq_num;
1327 v4 = v124;
1328
1329 //v6 = v123;
1330 //v7 = "";
1331 break; 1201 break;
1332 case EVENT_SetTexture: 1202 case EVENT_SetTexture:
1333 sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); 1203 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9);
1334 ++curr_seq_num; 1204 ++curr_seq_num;
1335 v4 = v124; 1205 v4 = v124;
1336 1206
1337 //v6 = v123; 1207 //v6 = v123;
1338 //v7 = ""; 1208 //v7 = "";
1339 break; 1209 break;
1340 case EVENT_SetSprite: 1210 case EVENT_SetSprite:
1341 SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); 1211 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10);
1342 ++curr_seq_num; 1212 ++curr_seq_num;
1343 v4 = v124; 1213 v4 = v124;
1344 1214
1345 //v6 = v123; 1215 //v6 = v123;
1346 //v7 = ""; 1216 //v7 = "";
1347 break; 1217 break;
1348 case EVENT_SummonMonsters: 1218 case EVENT_SummonMonsters:
1349 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7, 1219 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ),
1350 _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), 1220 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
1351 _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), 1221 EVT_DWORD(_evt->v24 ));
1352 _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8),
1353 _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8),
1354 _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8));
1355 ++curr_seq_num; 1222 ++curr_seq_num;
1356 v4 = v124; 1223 v4 = v124;
1357 1224
1358 //v6 = v123; 1225 //v6 = v123;
1359 //v7 = ""; 1226 //v7 = "";
1518 pRenderer->_49FD3A(); 1385 pRenderer->_49FD3A();
1519 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 1386 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
1520 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); 1387 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
1521 v104 = 187; 1388 v104 = 187;
1522 if ( uCurrentHouse_Animation != 167 ) 1389 if ( uCurrentHouse_Animation != 167 )
1523 v104 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1390 v104 = EVT_DWORD(_evt->v5);
1524 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); 1391 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
1525 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0); 1392 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0);
1526 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0); 1393 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0);
1527 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0); 1394 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0);
1528 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0); 1395 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0);
1529 window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); 1396 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
1530 } 1397 }
1531 ++curr_seq_num; 1398 ++curr_seq_num;
1532 v4 = v124; 1399 v4 = v124;
1533 1400
1534 //v6 = v123; 1401 //v6 = v123;