comparison Events.cpp @ 514:0bbc39457b25

Merge
author Nomad
date Fri, 01 Mar 2013 18:23:49 +0200
parents 968f4053da7f
children 35f28d4c0ff9 f0eff7c35a2b
comparison
equal deleted inserted replaced
513:3ee1e351e710 514:0bbc39457b25
822 //v7 = ""; 822 //v7 = "";
823 break; 823 break;
824 case EVENT_Compare: 824 case EVENT_Compare:
825 pValue = EVT_DWORD(_evt->v7); 825 pValue = EVT_DWORD(_evt->v7);
826 if ( player_choose <= 3 ) 826 if ( player_choose <= 3 )
827 { 827 {
828 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 828 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
829 { 829 {
830 v124 = -1; 830 v124 = -1;
831 curr_seq_num = _evt->v11 - 1; 831 curr_seq_num = _evt->v11 - 1;
832 }; 832 }
833 } 833 }
834 else if ( player_choose == 4 ) //active 834 else if ( player_choose == 4 ) //active
835 { 835 {
836 if ( uActiveCharacter ) 836 if ( uActiveCharacter )
837 { 837 {
838 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 838 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
839 { 839 {
840 v124 = -1; 840 v124 = -1;
841 curr_seq_num = _evt->v11 - 1; 841 curr_seq_num = _evt->v11 - 1;
842 }; 842 }
843 } 843 }
844 } 844 }
845 else if ( player_choose == 5 )//all 845 else if ( player_choose == 5 )//all
846 { 846 {
847 v130=0; 847 v130=0;
848 for(int i=0; i<4; ++i) 848 for(int i = 0; i < 5; ++i)
849 { 849 {
850 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 850 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
851 { 851 {
852 v124 = -1; 852 v124 = -1;
853 curr_seq_num = _evt->v11 - 1; 853 curr_seq_num = _evt->v11 - 1;
854 break; 854 break;
855 }; 855 }
856
857 ++v130; 856 ++v130;
858 } 857 }
859 858 }
860 }
861 else if ( player_choose == 6 ) //random 859 else if ( player_choose == 6 ) //random
862 { 860 {
863 if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 861 if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
864 { 862 {
865 v124 = -1; 863 v124 = -1;
866 curr_seq_num = _evt->v11 - 1; 864 curr_seq_num = _evt->v11 - 1;
867 } 865 }
868 } 866 }
869
870 ++curr_seq_num; 867 ++curr_seq_num;
871 v4 = v124; 868 v4 = v124;
872 //v6 = v123; 869 //v6 = v123;
873 //v7 = ""; 870 //v7 = "";
874 break; 871 break;
976 //v7 = ""; 973 //v7 = "";
977 break; 974 break;
978 } 975 }
979 } 976 }
980 } 977 }
981 v75 = player_choose;
982 if ( player_choose <= 3 ) 978 if ( player_choose <= 3 )
983 { 979 {
984 pPlayer = &pParty->pPlayers[v75]; 980 pPlayer = &pParty->pPlayers[player_choose];
985 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 981 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
986 ++curr_seq_num; 982 ++curr_seq_num;
987 //v4 = v124; 983 v4 = v124;
988 break; 984 break;
989 } 985 }
990 else if ( player_choose == 4 ) //active 986 else if ( player_choose == 4 ) //active
991 { 987 {
992 if ( uActiveCharacter ) 988 if ( uActiveCharacter )
998 break; 994 break;
999 } 995 }
1000 } 996 }
1001 else if ( player_choose == 5 )//all 997 else if ( player_choose == 5 )//all
1002 { 998 {
1003 v130=0; 999 v130 = 0;
1004 for(int i=0; i<4; ++i) 1000 for(int i = 0; i < 4; ++i)
1005 { 1001 {
1006 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 1002 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
1007 { 1003 {
1008 ++curr_seq_num; 1004 ++curr_seq_num;
1009 break; 1005 break;
1012 ++v130; 1008 ++v130;
1013 break; 1009 break;
1014 } 1010 }
1015 else if ( player_choose == 6 ) //random 1011 else if ( player_choose == 6 ) //random
1016 { 1012 {
1017 v75 = rand() % 4; 1013 player_choose = rand() % 4;
1018 pPlayer = &pParty->pPlayers[v75]; 1014 pPlayer = &pParty->pPlayers[player_choose];
1019 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1015 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1020 ++curr_seq_num; 1016 ++curr_seq_num;
1021 v4 = v124; 1017 v4 = v124;
1022 break; 1018 break;
1023 } 1019 }
1024 /* if ( player_choose != 5 )
1025 {
1026 if ( player_choose < 0 )
1027 goto LABEL_183;
1028 //if ( player_choose > 3 )
1029 //{
1030 if ( player_choose != 4 )
1031 {
1032 if ( player_choose == 6 )
1033 goto LABEL_180;
1034 LABEL_183:
1035 ((Player *)v6)->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1036 ++curr_seq_num;
1037 v4 = v124;
1038
1039 //v6 = v123;
1040 //v7 = "";
1041 break;
1042 }
1043 if ( uActiveCharacter )
1044 {
1045 v6 = pPlayers[uActiveCharacter];
1046 goto LABEL_182;
1047 }
1048 LABEL_180:
1049 v75 = rand() % 4;
1050
1051 //}
1052 v6 = &pParty->pPlayers[v75];
1053 LABEL_182:
1054 //v123 = v6;
1055 goto LABEL_183;
1056 }
1057 v130=0;
1058 for(int i=0; i<4; ++i)
1059 {
1060 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
1061 {
1062 ++curr_seq_num;
1063 break;
1064 }
1065 }
1066 ++v130;
1067 break;*/
1068 case EVENT_Set: 1020 case EVENT_Set:
1069 v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); 1021 pValue = EVT_DWORD(_evt->v7);
1070 v78 = player_choose; 1022 if ( player_choose <= 3 )
1071 if ( player_choose != 5 ) 1023 {
1072 { 1024 pPlayer = &pParty->pPlayers[player_choose];
1073 if ( player_choose < 0 ) 1025 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1074 goto LABEL_197;
1075 if ( player_choose > 3 )
1076 {
1077 if ( player_choose != 4 )
1078 {
1079 if ( player_choose == 6 )
1080 goto LABEL_194;
1081 LABEL_197:
1082 ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77);
1083 ++curr_seq_num;
1084 v4 = v124;
1085
1086 //v6 = v123;
1087 //v7 = "";
1088 break;
1089 }
1090 if ( uActiveCharacter )
1091 {
1092 v6 = pPlayers[uActiveCharacter];
1093 goto LABEL_196;
1094 }
1095 LABEL_194:
1096 v78 = rand() % 4;
1097
1098 }
1099 v6 = &pParty->pPlayers[v78];
1100 LABEL_196:
1101 //v123 = v6;
1102 goto LABEL_197;
1103 }
1104 v79 = pParty->pPlayers;
1105 v130 = 4;
1106 do
1107 {
1108 v79->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77);
1109 ++v79;
1110 }
1111 while ( (signed int)v79 < (signed int)pParty->pHirelings );
1112 ++curr_seq_num; 1026 ++curr_seq_num;
1113 v4 = v124; 1027 v4 = v124;
1114
1115 //v6 = v123;
1116 //v7 = "";
1117 break; 1028 break;
1029 }
1030 else if ( player_choose == 4 ) //active
1031 {
1032 if ( uActiveCharacter )
1033 {
1034 pPlayer = pPlayers[uActiveCharacter];
1035 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1036 ++curr_seq_num;
1037 v4 = v124;
1038 break;
1039 }
1040 }
1041 else if ( player_choose == 5 )//all
1042 {
1043 for(int i = 1; i < 5; ++i)
1044 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1045 ++curr_seq_num;
1046 v4 = v124;
1047 break;
1048 }
1049 else if ( player_choose == 6 ) //random
1050 {
1051 player_choose = rand() % 4;
1052 pPlayer = &pParty->pPlayers[player_choose];
1053 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1054 ++curr_seq_num;
1055 v4 = v124;
1056 break;
1057 }
1118 case EVENT_Add: 1058 case EVENT_Add:
1119 pValue = EVT_DWORD(_evt->v7); 1059 pValue = EVT_DWORD(_evt->v7);
1120 //v81 = player_choose; 1060 if ( player_choose <= 3 )
1121 if ( player_choose != 5 ) 1061 {
1122 { 1062 pPlayer = &pParty->pPlayers[player_choose];
1123 if ( player_choose < 0 ) 1063 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1124 goto LABEL_211;
1125 if ( player_choose > 3 )
1126 {
1127 if ( player_choose != 4 )
1128 {
1129 if ( player_choose == 6 )
1130 goto LABEL_208;
1131 LABEL_211:
1132 ((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue);
1133 goto LABEL_212;
1134 }
1135 if ( uActiveCharacter )
1136 {
1137 v6 = pPlayers[uActiveCharacter];
1138 goto LABEL_210;
1139 }
1140 LABEL_208:
1141 player_choose = rand() % 4;
1142
1143 }
1144 v6 = &pParty->pPlayers[player_choose];
1145 LABEL_210:
1146 //v123 = v6;
1147 goto LABEL_211;
1148 }
1149 v130 = 0;
1150 for(int i=1; i<5; ++i)
1151 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1152 LABEL_212:
1153 v83 = EVT_WORD(_evt->v5); 1064 v83 = EVT_WORD(_evt->v5);
1154 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) 1065 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1155 viewparams->bRedrawGameUI = 1; 1066 viewparams->bRedrawGameUI = 1;
1156 ++curr_seq_num; 1067 ++curr_seq_num;
1157 v4 = v124; 1068 v4 = v124;
1158 break; 1069 break;
1070 }
1071 else if ( player_choose == 4 ) //active
1072 {
1073 if ( uActiveCharacter )
1074 {
1075 pPlayer = pPlayers[uActiveCharacter];
1076 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 }
1084 }
1085 else if ( player_choose == 5 )//all
1086 {
1087 //v130 = 0;
1088 for(int i = 1; i < 5; ++i)
1089 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1090 v83 = EVT_WORD(_evt->v5);
1091 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1092 viewparams->bRedrawGameUI = 1;
1093 ++curr_seq_num;
1094 v4 = v124;
1095 break;
1096 }
1097 else if ( player_choose == 6 ) //random
1098 {
1099 player_choose = rand() % 4;
1100 pPlayer = &pParty->pPlayers[player_choose];
1101 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1102 v83 = EVT_WORD(_evt->v5);
1103 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 )
1104 viewparams->bRedrawGameUI = 1;
1105 ++curr_seq_num;
1106 v4 = v124;
1107 break;
1108 }
1159 case EVENT_InputString: 1109 case EVENT_InputString:
1160 if ( !start_event_seq_number ) 1110 if ( !start_event_seq_number )
1161 { 1111 {
1162 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); 1112 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]);
1163 v105 = curr_seq_num; 1113 v105 = curr_seq_num;