Mercurial > mm7
comparison Events.cpp @ 469:0dbf780e247f
CompareVariable part 1
author | Ritor1 |
---|---|
date | Mon, 25 Feb 2013 17:27:27 +0600 |
parents | e5cf03a3d98e |
children | 9fc37a2778d3 |
comparison
equal
deleted
inserted
replaced
468:8822405efad2 | 469:0dbf780e247f |
---|---|
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 //----- (0044684A) -------------------------------------------------------- | 143 //----- (0044684A) -------------------------------------------------------- |
144 void EventProcessor(int uEventID, int a2, int a3) | 144 void EventProcessor(int uEventID, int targetObj, int canShowMessages) |
145 { | 145 { |
146 unsigned int v3; // eax@5 | 146 unsigned int v3; // eax@5 |
147 signed int v4; // esi@7 | 147 signed int v4; // esi@7 |
148 //char *v5; // eax@8 | 148 //char *v5; // eax@8 |
149 Player *v6; // ecx@8 | 149 Player *v6; // ecx@8 |
196 int v53; // ecx@107 | 196 int v53; // ecx@107 |
197 char v54; // al@111 | 197 char v54; // al@111 |
198 Player *v55; // esi@114 | 198 Player *v55; // esi@114 |
199 Player *v56; // ecx@117 | 199 Player *v56; // ecx@117 |
200 int v57; // ecx@118 | 200 int v57; // ecx@118 |
201 signed int v58; // ebp@124 | 201 signed int pValue; // ebp@124 |
202 Player *v59; // esi@125 | 202 Player *pPlayer; // esi@125 |
203 int v60; // eax@126 | 203 int v60; // eax@126 |
204 int v61; // edx@133 | 204 int v61; // edx@133 |
205 int v62; // eax@139 | 205 int v62; // eax@139 |
206 void *v63; // ebp@145 | 206 void *v63; // ebp@145 |
207 signed int v64; // edi@146 | 207 signed int v64; // edi@146 |
285 char Str[120]; // [sp+ECh] [bp-3BCh]@21 | 285 char Str[120]; // [sp+ECh] [bp-3BCh]@21 |
286 Actor Dst; // [sp+164h] [bp-344h]@53 | 286 Actor Dst; // [sp+164h] [bp-344h]@53 |
287 | 287 |
288 //v131 = uEventID; | 288 //v131 = uEventID; |
289 v133 = 0; | 289 v133 = 0; |
290 dword_5B5920 = a2; | 290 EvtTargetObj = targetObj; |
291 dword_5B65C4 = 0; | 291 dword_5B65C4 = 0; |
292 if ( !a1 ) | 292 if ( !uEventID ) |
293 { | 293 { |
294 if ( !GameUI_StatusBar_TimedStringTimeLeft ) | 294 if ( !GameUI_StatusBar_TimedStringTimeLeft ) |
295 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here | 295 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here |
296 return; | 296 return; |
297 } | 297 } |
298 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 | 298 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 |
299 curr_seq_num = start_event_seq_number; | 299 curr_seq_num = start_event_seq_number; |
300 if ( _5C3420_pDecoration ) | 300 if ( GlobalEventInfo ) |
301 { | 301 { |
302 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; | 302 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; |
303 pSomeEVT = pGlobalEVT; | 303 pSomeEVT = pGlobalEVT; |
304 memcpy(pSomeEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); //4400 evts | 304 memcpy(pSomeEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); //4400 evts |
305 } | 305 } |
502 //v7 = ""; | 502 //v7 = ""; |
503 } | 503 } |
504 break; | 504 break; |
505 | 505 |
506 case EVENT_SpeakNPC: | 506 case EVENT_SpeakNPC: |
507 if ( a3 ) | 507 if ( canShowMessages ) |
508 { | 508 { |
509 //Actor::Actor(&Dst); | 509 //Actor::Actor(&Dst); |
510 memset(&Dst, 0, 0x344u); | 510 memset(&Dst, 0, 0x344u); |
511 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 | 511 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); |
512 + ((_evt->v6 | |
513 + ((_evt->v7 | |
514 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
515 Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; | 512 Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; |
516 Dst.InitializeDialogue(0); | 513 Dst.InitializeDialogue(0); |
517 } | 514 } |
518 else | 515 else |
519 { | 516 { |
520 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 | 517 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); |
521 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
522 } | 518 } |
523 ++curr_seq_num; | 519 ++curr_seq_num; |
524 v4 = v124; | 520 v4 = v124; |
525 | 521 |
526 //v6 = v123; | 522 //v6 = v123; |
528 break; | 524 break; |
529 case EVENT_ChangeEvent: | 525 case EVENT_ChangeEvent: |
530 v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | 526 v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); |
531 if ( v25 ) | 527 if ( v25 ) |
532 { | 528 { |
533 stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124; | 529 stru_5E4C90._decor_events[GlobalEventInfo + 28] = _evt->v5 - 124; |
534 } | 530 } |
535 else | 531 else |
536 { | 532 { |
537 v26 = _5C3420_pDecoration; | 533 v26 = (LevelDecoration *)GlobalEventInfo; |
538 stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; | 534 stru_5E4C90._decor_events[GlobalEventInfo + 28] = 0; |
539 LOBYTE(v26->field_2) |= 0x20u; | 535 LOBYTE(v26->field_2) |= 0x20u; |
540 } | 536 } |
541 ++curr_seq_num; | 537 ++curr_seq_num; |
542 v4 = v124; | 538 v4 = v124; |
543 | 539 |
723 { | 719 { |
724 sub_4BD8B5(); | 720 sub_4BD8B5(); |
725 pVideoPlayer->Unload(); | 721 pVideoPlayer->Unload(); |
726 window_SpeakInHouse->Release(); | 722 window_SpeakInHouse->Release(); |
727 pParty->uFlags &= 0xFFFFFFFDu; | 723 pParty->uFlags &= 0xFFFFFFFDu; |
728 _5C3420_pDecoration = (LevelDecoration *)1; | 724 GlobalEventInfo = 1; |
729 if ( EnterHouse((enum HOUSE_TYPE)165) ) | 725 if ( EnterHouse((enum HOUSE_TYPE)165) ) |
730 { | 726 { |
731 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | 727 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); |
732 v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); | 728 v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); |
733 window_SpeakInHouse = v47; | 729 window_SpeakInHouse = v47; |
822 v4 = v124; | 818 v4 = v124; |
823 | 819 |
824 //v6 = v123; | 820 //v6 = v123; |
825 //v7 = ""; | 821 //v7 = ""; |
826 break; | 822 break; |
827 case EVENT_Compare: | 823 case EVENT_Compare://_evt->_e_type == 14 cmp in Global.evt event 6 |
828 v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | 824 pValue = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); |
829 if ( player_choose == 5 ) | 825 if ( player_choose == 5 ) |
830 { | 826 { |
831 v130 = 0; | 827 v130 = 0; |
832 v59 = pParty->pPlayers; | 828 pPlayer = pParty->pPlayers; |
833 while ( 1 ) | 829 while ( 1 ) |
834 { | 830 { |
835 LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); | 831 v60 = pPlayer->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); |
836 if ( v60 ) | 832 if ( v60 ) |
837 break; | 833 break; |
838 ++v130; | 834 ++v130; |
839 ++v59; | 835 ++pPlayer; |
840 if ( (signed int)v59 >= (signed int)pParty->pHirelings ) | 836 if ( (signed int)pPlayer >= (signed int)pParty->pHirelings ) |
841 { | 837 { |
842 ++curr_seq_num; | 838 ++curr_seq_num; |
843 v4 = v124; | 839 v4 = v124; |
844 | 840 |
845 //v6 = v123; | 841 //v6 = v123; |
874 LABEL_137: | 870 LABEL_137: |
875 v6 = &pParty->pPlayers[v61]; | 871 v6 = &pParty->pPlayers[v61]; |
876 LABEL_138: | 872 LABEL_138: |
877 //v123 = v6; | 873 //v123 = v6; |
878 LABEL_139: | 874 LABEL_139: |
879 LOBYTE(v62) = ((Player *)v6)->CompareVariable( | 875 v62 = ((Player *)v6)->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); |
880 (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), | |
881 v58); | |
882 LABEL_140: | 876 LABEL_140: |
883 if ( v62 ) | 877 if ( v62 ) |
884 goto LABEL_129; | 878 goto LABEL_129; |
885 ++curr_seq_num; | 879 ++curr_seq_num; |
886 v4 = v124; | 880 v4 = v124; |
887 | 881 |
888 //v6 = v123; | 882 //v6 = v123; |
889 //v7 = ""; | 883 //v7 = ""; |
890 break; | 884 break; |
891 case EVENT_IsActorAlive: | 885 case EVENT_IsActorAlive: |
892 v62 = IsActorAlive( | 886 v62 = IsActorAlive(_evt->v5, _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), _evt->v10); |
893 _evt->v5, | |
894 _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), | |
895 _evt->v10); | |
896 goto LABEL_140; | 887 goto LABEL_140; |
897 case EVENT_Substract: | 888 case EVENT_Substract: |
898 v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); | 889 v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); |
899 if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands ) | 890 if ( _evt->v5 + ((uint)_evt->v6 << 8) == VAR_PlayerItemInHands ) |
900 { | 891 { |
1028 } | 1019 } |
1029 v76 = pParty->pPlayers; | 1020 v76 = pParty->pPlayers; |
1030 v130 = 4; | 1021 v130 = 4; |
1031 do | 1022 do |
1032 { | 1023 { |
1033 v76->SubtractVariable( | 1024 v76->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); |
1034 (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), | |
1035 v63); | |
1036 ++v76; | 1025 ++v76; |
1037 } | 1026 } |
1038 while ( (signed int)v76 < (signed int)pParty->pHirelings ); | 1027 while ( (signed int)v76 < (signed int)pParty->pHirelings ); |
1039 ++curr_seq_num; | 1028 ++curr_seq_num; |
1040 v4 = v124; | 1029 v4 = v124; |
1080 } | 1069 } |
1081 v79 = pParty->pPlayers; | 1070 v79 = pParty->pPlayers; |
1082 v130 = 4; | 1071 v130 = 4; |
1083 do | 1072 do |
1084 { | 1073 { |
1085 v79->SetVariable( | 1074 v79->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); |
1086 (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), | |
1087 v77); | |
1088 ++v79; | 1075 ++v79; |
1089 } | 1076 } |
1090 while ( (signed int)v79 < (signed int)pParty->pHirelings ); | 1077 while ( (signed int)v79 < (signed int)pParty->pHirelings ); |
1091 ++curr_seq_num; | 1078 ++curr_seq_num; |
1092 v4 = v124; | 1079 v4 = v124; |
1106 if ( player_choose != 4 ) | 1093 if ( player_choose != 4 ) |
1107 { | 1094 { |
1108 if ( player_choose == 6 ) | 1095 if ( player_choose == 6 ) |
1109 goto LABEL_208; | 1096 goto LABEL_208; |
1110 LABEL_211: | 1097 LABEL_211: |
1111 ((Player *)v6)->AddVariable( | 1098 ((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); |
1112 (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), | |
1113 v80); | |
1114 goto LABEL_212; | 1099 goto LABEL_212; |
1115 } | 1100 } |
1116 if ( uActiveCharacter ) | 1101 if ( uActiveCharacter ) |
1117 { | 1102 { |
1118 v6 = pPlayers[uActiveCharacter]; | 1103 v6 = pPlayers[uActiveCharacter]; |
1129 } | 1114 } |
1130 v82 = pParty->pPlayers; | 1115 v82 = pParty->pPlayers; |
1131 v130 = 4; | 1116 v130 = 4; |
1132 do | 1117 do |
1133 { | 1118 { |
1134 v82->AddVariable( | 1119 v82->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); |
1135 (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), | |
1136 v80); | |
1137 ++v82; | 1120 ++v82; |
1138 } | 1121 } |
1139 while ( (signed int)v82 < (signed int)pParty->pHirelings ); | 1122 while ( (signed int)v82 < (signed int)pParty->pHirelings ); |
1140 LABEL_212: | 1123 LABEL_212: |
1141 v83 = _evt->v5 + ((uint)_evt->v6 << 8); | 1124 v83 = _evt->v5 + ((uint)_evt->v6 << 8); |
1148 //v7 = ""; | 1131 //v7 = ""; |
1149 break; | 1132 break; |
1150 case EVENT_InputString: | 1133 case EVENT_InputString: |
1151 if ( !start_event_seq_number ) | 1134 if ( !start_event_seq_number ) |
1152 { | 1135 { |
1153 strcpy( | 1136 strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); |
1154 GameUI_StatusBar_TimedString, | |
1155 &pLevelStr[pLevelStrOffsets[_evt->v5 | |
1156 + ((_evt->v6 | |
1157 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); | |
1158 v105 = curr_seq_num; | 1137 v105 = curr_seq_num; |
1159 v121 = 26; | 1138 v121 = 26; |
1160 LABEL_295: | 1139 LABEL_295: |
1161 sub_4451A8_press_any_key(uEventID, v105, v121); | 1140 sub_4451A8_press_any_key(uEventID, v105, v121); |
1162 LABEL_301: | 1141 LABEL_301: |
1164 LABEL_302: | 1143 LABEL_302: |
1165 OnMapLeave(); | 1144 OnMapLeave(); |
1166 return; | 1145 return; |
1167 } | 1146 } |
1168 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | 1147 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); |
1169 if ( !_strcmpi( | 1148 if ( !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) |
1170 GameUI_StatusBar_TimedString, | |
1171 &pLevelStr[pLevelStrOffsets[_evt->v9 | |
1172 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) | |
1173 || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) | 1149 || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) |
1174 { | 1150 { |
1175 v11 = _evt->v17; | 1151 v11 = _evt->v17; |
1176 LABEL_130: | 1152 LABEL_130: |
1177 //v124 = -1; | 1153 //v124 = -1; |
1299 //v6 = v123; | 1275 //v6 = v123; |
1300 //v7 = ""; | 1276 //v7 = ""; |
1301 break; | 1277 break; |
1302 case EVENT_StatusText: | 1278 case EVENT_StatusText: |
1303 v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | 1279 v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); |
1304 if ( _5C3420_pDecoration ) | 1280 if ( GlobalEventInfo ) |
1305 { | 1281 { |
1306 if ( _5C3420_pDecoration == (LevelDecoration *)1 ) | 1282 if ( GlobalEventInfo == 1 ) |
1307 { | 1283 { |
1308 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | 1284 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; |
1309 ++curr_seq_num; | 1285 ++curr_seq_num; |
1310 v4 = v124; | 1286 v4 = v124; |
1311 | 1287 |
1312 //v6 = v123; | 1288 //v6 = v123; |
1313 //v7 = ""; | 1289 //v7 = ""; |
1314 break; | 1290 break; |
1315 } | 1291 } |
1316 if ( a3 == 1 ) | 1292 if ( canShowMessages == 1 ) |
1317 { | 1293 { |
1318 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | 1294 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; |
1319 //LABEL_248: | 1295 //LABEL_248: |
1320 ShowStatusBarString(v91, 2u); | 1296 ShowStatusBarString(v91, 2u); |
1321 ++curr_seq_num; | 1297 ++curr_seq_num; |
1326 break; | 1302 break; |
1327 } | 1303 } |
1328 } | 1304 } |
1329 else | 1305 else |
1330 { | 1306 { |
1331 if ( a3 == 1 ) | 1307 if ( canShowMessages == 1 ) |
1332 { | 1308 { |
1333 v91 = &pLevelStr[pLevelStrOffsets[v90]]; | 1309 v91 = &pLevelStr[pLevelStrOffsets[v90]]; |
1334 ShowStatusBarString(v91, 2u); | 1310 ShowStatusBarString(v91, 2u); |
1335 ++curr_seq_num; | 1311 ++curr_seq_num; |
1336 v4 = v124; | 1312 v4 = v124; |
1346 //v6 = v123; | 1322 //v6 = v123; |
1347 //v7 = ""; | 1323 //v7 = ""; |
1348 break; | 1324 break; |
1349 case EVENT_ShowMessage: | 1325 case EVENT_ShowMessage: |
1350 v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | 1326 v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); |
1351 if ( _5C3420_pDecoration ) | 1327 if ( GlobalEventInfo ) |
1352 { | 1328 { |
1353 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; | 1329 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; |
1354 byte_5B0938[0] = 0; | 1330 byte_5B0938[0] = 0; |
1355 ptr_F8B1E8 = v93; | 1331 ptr_F8B1E8 = v93; |
1356 } | 1332 } |
1499 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); | 1475 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); |
1500 } | 1476 } |
1501 } | 1477 } |
1502 else | 1478 else |
1503 { | 1479 { |
1504 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); | 1480 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((GlobalEventInfo == 0) + 1); |
1505 sub_44987B(v99, 0); | 1481 sub_44987B(v99, 0); |
1506 v133 = 1; | 1482 v133 = 1; |
1507 if ( pCurrentScreen == SCREEN_HOUSE ) | 1483 if ( pCurrentScreen == SCREEN_HOUSE ) |
1508 { | 1484 { |
1509 if ( uGameState == 2 ) | 1485 if ( uGameState == 2 ) |