Mercurial > mm7
comparison mm7_3.cpp @ 336:ea55d6414029
Event_proceccor preliminary
author | Gloval |
---|---|
date | Thu, 21 Feb 2013 00:33:12 +0400 |
parents | f76027321087 |
children | 672b83584b0f |
comparison
equal
deleted
inserted
replaced
329:f76027321087 | 336:ea55d6414029 |
---|---|
14168 memset(pLevelStrOffsets, 0, 2000); | 14168 memset(pLevelStrOffsets, 0, 2000); |
14169 | 14169 |
14170 max_string_length = 0; | 14170 max_string_length = 0; |
14171 string_num = 1; | 14171 string_num = 1; |
14172 prev_string_offset = 0; | 14172 prev_string_offset = 0; |
14173 | 14173 pLevelStrOffsets[0]=0; |
14174 for (uint i = 0; i < uLevelStrFileSize; ++i) | 14174 for (uint i = 0; i < uLevelStrFileSize; ++i) |
14175 { | 14175 { |
14176 if ( !pLevelStr[i] ) | 14176 if ( !pLevelStr[i] ) |
14177 { | 14177 { |
14178 pLevelStrOffsets[string_num] = i + 1; | 14178 pLevelStrOffsets[string_num] = i + 1; |
14190 Abortf(Args); | 14190 Abortf(Args); |
14191 } | 14191 } |
14192 | 14192 |
14193 if ( uLevelStrNumStrings > 0 ) | 14193 if ( uLevelStrNumStrings > 0 ) |
14194 { | 14194 { |
14195 for(uint i = 1; i <uLevelStrNumStrings ; ++i) | 14195 for(uint i = 0; i <uLevelStrNumStrings ; ++i) |
14196 { | 14196 { |
14197 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) | 14197 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) |
14198 ++pLevelStrOffsets[i]; | 14198 ++pLevelStrOffsets[i]; |
14199 } | 14199 } |
14200 } | 14200 } |
14202 | 14202 |
14203 | 14203 |
14204 //----- (00443F95) -------------------------------------------------------- | 14204 //----- (00443F95) -------------------------------------------------------- |
14205 void __cdecl OnMapLeave() | 14205 void __cdecl OnMapLeave() |
14206 { | 14206 { |
14207 signed int v0; // edi@1 | 14207 _evt_raw *test_event; |
14208 char *v1; // esi@2 | 14208 if ( uLevelEVT_NumEvents > 0 ) |
14209 int v2; // ecx@4 | 14209 { |
14210 | 14210 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) |
14211 v0 = 0; | 14211 { |
14212 if ( (signed int)uLevelEVT_NumEvents > 0 ) | 14212 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; |
14213 { | 14213 if ( test_event->_e_type== EVENT_OnMapLeave ) |
14214 v1 = (char *)&pLevelEVT_Index[0].event_sequence_num; | 14214 { |
14215 do | 14215 start_event_seq_number = pLevelEVT_Index[i].event_sequence_num; |
14216 { | 14216 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1); |
14217 if ( pLevelEVT[*((short *)v1 + 2) + 4] == 53 ) | 14217 start_event_seq_number = 0; |
14218 { | 14218 } |
14219 v2 = *((int *)v1 - 1); | 14219 } |
14220 dword_597F18 = *(int *)v1; | |
14221 EventProcessor(v2, 0, 1); | |
14222 dword_597F18 = 0; | |
14223 } | |
14224 ++v0; | |
14225 v1 += 12; | |
14226 } | |
14227 while ( v0 < (signed int)uLevelEVT_NumEvents ); | |
14228 } | 14220 } |
14229 } | 14221 } |
14230 | 14222 |
14231 | 14223 |
14232 //----- (00443FDC) -------------------------------------------------------- | 14224 //----- (00443FDC) -------------------------------------------------------- |
14274 ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), | 14266 ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), |
14275 0); | 14267 0); |
14276 } | 14268 } |
14277 else if (_evt->_e_type == EVENT_OnMapReload) | 14269 else if (_evt->_e_type == EVENT_OnMapReload) |
14278 { | 14270 { |
14279 dword_597F18 = pEvent.event_sequence_num; | 14271 start_event_seq_number = pEvent.event_sequence_num; |
14280 EventProcessor(pEvent.uEventID, 0, 0); | 14272 EventProcessor(pEvent.uEventID, 0, 0); |
14281 dword_597F18 = 0; | 14273 start_event_seq_number = 0; |
14282 } | 14274 } |
14283 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) | 14275 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) |
14284 { | 14276 { |
14285 v3 = &array_5B5928[dword_5B65C8]; | 14277 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; |
14286 v20 = pOutdoor->uLastVisitDay; | 14278 v20 = pOutdoor->uLastVisitDay; |
14287 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | 14279 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
14288 v20 = pIndoor->stru1.uLastVisitDay; | 14280 v20 = pIndoor->stru1.uLastVisitDay; |
14289 | 14281 |
14290 v4 = _evt->_e_type; | 14282 v3->timer_evt_type = _evt->_e_type; |
14291 v3->field_1C = v4; | 14283 v3->timer_evt_ID = pEvent.uEventID; |
14292 v3->field_8 = pEvent.uEventID; | 14284 v3->timer_evt_seq_num = pEvent.event_sequence_num; |
14293 v3->field_A = pEvent.event_sequence_num; | 14285 |
14294 v33 = _evt->v6; | 14286 v3->field_10 = _evt->v5; |
14295 v3->field_12 = v33; | 14287 v3->field_12 = _evt->v6; |
14296 v32 = _evt->v7; | 14288 v3->field_14 = _evt->v7; |
14297 v3->field_14 = v32; | 14289 v3->field_16 = _evt->v8; |
14298 v31 = _evt->v8; | 14290 v3->field_18 = _evt->v9; |
14299 v3->field_16 = v31; | 14291 v3->field_1A = _evt->v10; |
14300 v5 = _evt->v5; | 14292 |
14301 v30 = _evt->v9; | |
14302 v3->field_18 = v30; | |
14303 v29 = _evt->v10; | |
14304 v3->field_1A = v29; | |
14305 | 14293 |
14306 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; | 14294 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
14307 v3->field_10 = v5; | 14295 |
14308 v3->field_C = v6; | 14296 v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
14309 v3->field_E = v6; | 14297 v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
14310 if ( v4 == 38 && !(short)v6 ) | 14298 if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) |
14311 { | 14299 { |
14312 if ( v20 ) | 14300 if ( v20 ) |
14313 v18 = pParty->uTimePlayed - v20; | 14301 v18 = pParty->uTimePlayed - v20; |
14314 else | 14302 else |
14315 v18 = 0i64; | 14303 v18 = 0i64; |
14317 | 14305 |
14318 if ( v26 / 7 / 4 / 12 ) | 14306 if ( v26 / 7 / 4 / 12 ) |
14319 { | 14307 { |
14320 if ( v5 ) | 14308 if ( v5 ) |
14321 { | 14309 { |
14322 ++dword_5B65C8; | 14310 ++dword_5B65C8_timers_count; |
14323 v3->field_0_time = 0; | 14311 v3->field_0_time = 0; |
14324 continue; | 14312 continue; |
14325 } | 14313 } |
14326 } | 14314 } |
14327 if (v26 / 7 / 4 != 0 && v33 != 0 || | 14315 if (v26 / 7 / 4 != 0 && v33 != 0 || |
14328 v26 / 7 != 0 && v32 != 0 || | 14316 v26 / 7 != 0 && v32 != 0 || |
14329 v26 != 0 || !v20) | 14317 v26 != 0 || !v20) |
14330 { | 14318 { |
14331 ++dword_5B65C8; | 14319 ++dword_5B65C8_timers_count; |
14332 v3->field_0_time = 0; | 14320 v3->field_0_time = 0; |
14333 continue; | 14321 continue; |
14334 } | 14322 } |
14335 } | 14323 } |
14336 | 14324 else |
14325 { | |
14337 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); | 14326 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); |
14338 v9 = v8; | 14327 v9 = v8; |
14339 v10 = (signed int)v8 / 60; | 14328 v10 = (signed int)v8 / 60; |
14340 minutes = v10 % 60; | 14329 minutes = v10 % 60; |
14341 v11 = (signed int)(v10 / 60); | 14330 v11 = (signed int)(v10 / 60); |
14389 + 0x93A80 * weeks | 14378 + 0x93A80 * weeks |
14390 + 0x15180 * days | 14379 + 0x15180 * days |
14391 + 0x24EA00 * (v28 + 12i64 * month)) << 7) | 14380 + 0x24EA00 * (v28 + 12i64 * month)) << 7) |
14392 * 0.033333335); | 14381 * 0.033333335); |
14393 | 14382 |
14394 ++dword_5B65C8; | 14383 ++dword_5B65C8_timers_count; |
14384 } | |
14395 } | 14385 } |
14396 } | 14386 } |
14397 } | 14387 } |
14398 | 14388 |
14399 //----- (00444360) -------------------------------------------------------- | 14389 //----- (00444360) -------------------------------------------------------- |
14878 v4 = a1; | 14868 v4 = a1; |
14879 if ( !pGUIWindow2 ) | 14869 if ( !pGUIWindow2 ) |
14880 { | 14870 { |
14881 if ( pParty->uFlags & 2 ) | 14871 if ( pParty->uFlags & 2 ) |
14882 pGame->Draw(); | 14872 pGame->Draw(); |
14883 if ( !dword_597F18 ) | 14873 if ( !start_event_seq_number ) |
14884 pAudioPlayer->StopChannels(-1, -1); | 14874 pAudioPlayer->StopChannels(-1, -1); |
14885 pMiscTimer->Pause(); | 14875 pMiscTimer->Pause(); |
14886 pEventTimer->Pause(); | 14876 pEventTimer->Pause(); |
14887 dword_5C3418 = v4; | 14877 dword_5C3418 = v4; |
14888 dword_5C341C = v3; | 14878 dword_5C341C = v3; |
14899 void __cdecl sub_4452BB() | 14889 void __cdecl sub_4452BB() |
14900 { | 14890 { |
14901 pGUIWindow2->Release(); | 14891 pGUIWindow2->Release(); |
14902 pGUIWindow2 = 0; | 14892 pGUIWindow2 = 0; |
14903 _5C3420_pDecoration = _591094_decoration; | 14893 _5C3420_pDecoration = _591094_decoration; |
14904 dword_597F18 = dword_5C341C; | 14894 start_event_seq_number = dword_5C341C; |
14905 EventProcessor(dword_5C3418, 0, 1); | 14895 EventProcessor(dword_5C3418, 0, 1); |
14906 dword_597F18 = 0; | 14896 start_event_seq_number = 0; |
14907 _5C3420_pDecoration = 0; | 14897 _5C3420_pDecoration = 0; |
14908 pEventTimer->Resume(); | 14898 pEventTimer->Resume(); |
14909 } | 14899 } |
14910 | 14900 |
14911 | 14901 |
15707 | 15697 |
15708 v1 = 0; | 15698 v1 = 0; |
15709 v13 = _this; | 15699 v13 = _this; |
15710 if ( !_this ) | 15700 if ( !_this ) |
15711 return 0; | 15701 return 0; |
15712 v3 = dword_597F18; | 15702 v3 = start_event_seq_number; |
15713 pSomeOtherEVT = pGlobalEVT; | 15703 pSomeOtherEVT = pGlobalEVT; |
15714 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; | 15704 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; |
15715 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); | 15705 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, 0xCE40u); |
15716 v4 = 1; | 15706 v4 = 1; |
15717 v12 = 1; | 15707 v12 = 1; |
16198 v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; | 16188 v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; |
16199 if ( v13 ) | 16189 if ( v13 ) |
16200 { | 16190 { |
16201 _5773B8_event_timer = pParty->uTimePlayed; | 16191 _5773B8_event_timer = pParty->uTimePlayed; |
16202 v12 = 0; | 16192 v12 = 0; |
16203 if ( dword_5B65C8 > 0 ) | 16193 if ( dword_5B65C8_timers_count > 0 ) |
16204 { | 16194 { |
16205 v4 = (char *)&array_5B5928[0].field_C; | 16195 v4 = (char *)&array_5B5928_timers[0].field_C; |
16206 while ( 1 ) | 16196 while ( 1 ) |
16207 { | 16197 { |
16208 v5 = *(short *)v4; | 16198 v5 = *(short *)v4; |
16209 if ( *(short *)v4 != (short)v1 ) | 16199 if ( *(short *)v4 != (short)v1 ) |
16210 break; | 16200 break; |
16234 { | 16224 { |
16235 *((int *)v4 - 3) = v2; | 16225 *((int *)v4 - 3) = v2; |
16236 *((int *)v4 - 2) = v3; | 16226 *((int *)v4 - 2) = v3; |
16237 } | 16227 } |
16238 v11 = *((short *)v4 - 2); | 16228 v11 = *((short *)v4 - 2); |
16239 dword_597F18 = *((short *)v4 - 1); | 16229 start_event_seq_number = *((short *)v4 - 1); |
16240 EventProcessor(v11, 0, 1); | 16230 EventProcessor(v11, 0, 1); |
16241 dword_597F18 = 0; | 16231 start_event_seq_number = 0; |
16242 LABEL_25: | 16232 LABEL_25: |
16243 v3 = HIDWORD(pParty->uTimePlayed); | 16233 v3 = HIDWORD(pParty->uTimePlayed); |
16244 v2 = LODWORD(pParty->uTimePlayed); | 16234 v2 = LODWORD(pParty->uTimePlayed); |
16245 } | 16235 } |
16246 LABEL_26: | 16236 LABEL_26: |
16247 ++v12; | 16237 ++v12; |
16248 v4 += 32; | 16238 v4 += 32; |
16249 if ( v12 >= dword_5B65C8 ) | 16239 if ( v12 >= dword_5B65C8_timers_count ) |
16250 return; | 16240 return; |
16251 v1 = 0; | 16241 v1 = 0; |
16252 } | 16242 } |
16253 if ( v13 < v5 ) | 16243 if ( v13 < v5 ) |
16254 { | 16244 { |
16255 *(short *)v4 = v5 - v13; | 16245 *(short *)v4 = v5 - v13; |
16256 goto LABEL_26; | 16246 goto LABEL_26; |
16257 } | 16247 } |
16258 v6 = *((short *)v4 - 2); | 16248 v6 = *((short *)v4 - 2); |
16259 *(short *)v4 = *((short *)v4 + 1); | 16249 *(short *)v4 = *((short *)v4 + 1); |
16260 dword_597F18 = *((short *)v4 - 1); | 16250 start_event_seq_number = *((short *)v4 - 1); |
16261 EventProcessor(v6, 0, 1); | 16251 EventProcessor(v6, 0, 1); |
16262 dword_597F18 = v1; | 16252 start_event_seq_number = v1; |
16263 goto LABEL_25; | 16253 goto LABEL_25; |
16264 } | 16254 } |
16265 } | 16255 } |
16266 } | 16256 } |
16267 } | 16257 } |