comparison mm7_3.cpp @ 1052:d48c762de563

-nomarg
author Nomad
date Thu, 23 May 2013 18:26:05 +0200
parents ff2d888f8033
children 1c10b24a4159
comparison
equal deleted inserted replaced
1051:05c62d166182 1052:d48c762de563
11853 if ( uLevelEVT_NumEvents > 0 ) 11853 if ( uLevelEVT_NumEvents > 0 )
11854 { 11854 {
11855 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) 11855 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
11856 { 11856 {
11857 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; 11857 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
11858 if ( test_event->_e_type== EVENT_OnMapLeave ) 11858 if ( test_event->_e_type == EVENT_OnMapLeave )
11859 { 11859 {
11860 start_event_seq_number = pLevelEVT_Index[i].event_sequence_num; 11860 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
11861 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1);
11862 start_event_seq_number = 0;
11863 } 11861 }
11864 } 11862 }
11865 } 11863 }
11866 } 11864 }
11867 11865
11907 { 11905 {
11908 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); 11906 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
11909 } 11907 }
11910 else if (_evt->_e_type == EVENT_OnMapReload) 11908 else if (_evt->_e_type == EVENT_OnMapReload)
11911 { 11909 {
11912 start_event_seq_number = pEvent.event_sequence_num; 11910 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
11913 EventProcessor(pEvent.uEventID, 0, 0);
11914 start_event_seq_number = 0;
11915 } 11911 }
11916 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) 11912 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
11917 { 11913 {
11918 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; 11914 v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
11919 v20 = pOutdoor->loc_time.uLastVisitDay; 11915 v20 = pOutdoor->loc_time.uLastVisitDay;
11920 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) 11916 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
11921 v20 = pIndoor->stru1.uLastVisitDay; 11917 v20 = pIndoor->stru1.uLastVisitDay;
11934 11930
11935 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; 11931 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
11936 11932
11937 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; 11933 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
11938 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; 11934 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
11939 if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) 11935 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 )
11940 { 11936 {
11941 if ( v20 ) 11937 if ( v20 )
11942 v18 = pParty->uTimePlayed - v20; 11938 v18 = pParty->uTimePlayed - v20;
11943 else 11939 else
11944 v18 = 0i64; 11940 v18 = 0i64;
12155 v4 = a1; 12151 v4 = a1;
12156 if ( !pGUIWindow2 ) 12152 if ( !pGUIWindow2 )
12157 { 12153 {
12158 if ( pParty->uFlags & 2 ) 12154 if ( pParty->uFlags & 2 )
12159 pGame->Draw(); 12155 pGame->Draw();
12160 if ( !start_event_seq_number ) 12156 pAudioPlayer->StopChannels(-1, -1);
12161 pAudioPlayer->StopChannels(-1, -1);
12162 pMiscTimer->Pause(); 12157 pMiscTimer->Pause();
12163 pEventTimer->Pause(); 12158 pEventTimer->Pause();
12164 dword_5C3418 = v4; 12159 dword_5C3418 = v4;
12165 dword_5C341C = v3; 12160 dword_5C341C = v3;
12166 _591094_decoration = activeLevelDecoration; 12161 _591094_decoration = activeLevelDecoration;
12176 void __cdecl sub_4452BB() 12171 void __cdecl sub_4452BB()
12177 { 12172 {
12178 pGUIWindow2->Release(); 12173 pGUIWindow2->Release();
12179 pGUIWindow2 = 0; 12174 pGUIWindow2 = 0;
12180 activeLevelDecoration = _591094_decoration; 12175 activeLevelDecoration = _591094_decoration;
12181 start_event_seq_number = dword_5C341C; 12176 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
12182 EventProcessor(dword_5C3418, 0, 1);
12183 start_event_seq_number = 0;
12184 activeLevelDecoration = NULL; 12177 activeLevelDecoration = NULL;
12185 pEventTimer->Resume(); 12178 pEventTimer->Resume();
12186 } 12179 }
12187 12180
12188 //----- (00445308) -------------------------------------------------------- 12181 //----- (00445308) --------------------------------------------------------
12379 LOBYTE(v5) = uTotalActors == uAliveActors; 12372 LOBYTE(v5) = uTotalActors == uAliveActors;
12380 return v5; 12373 return v5;
12381 } 12374 }
12382 12375
12383 //----- (004466C4) -------------------------------------------------------- 12376 //----- (004466C4) --------------------------------------------------------
12384 int NPC_EventProcessor( int npc_event_id ) 12377 int NPC_EventProcessor(int npc_event_id, int entry_line)
12385 { 12378 {
12386 signed int event_index; // ebp@1 12379 signed int event_index; // ebp@1
12387 int evt_seq_num; // esi@3 12380 int evt_seq_num; // esi@3
12388 bool ready_to_exit; // [sp+Ch] [bp-Ch]@3 12381 bool ready_to_exit; // [sp+Ch] [bp-Ch]@3
12389 signed int npc_activity; // [sp+10h] [bp-8h]@3 12382 signed int npc_activity; // [sp+10h] [bp-8h]@3
12390 int result; 12383 int result;
12391 12384
12392 event_index = 0; 12385 event_index = 0;
12393 if ( !npc_event_id ) 12386 if ( !npc_event_id )
12394 return 0; 12387 return 0;
12395 evt_seq_num = start_event_seq_number; 12388 evt_seq_num = entry_line;
12396 pSomeOtherEVT = pGlobalEVT; 12389 pSomeOtherEVT = pGlobalEVT;
12397 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; 12390 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
12398 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); 12391 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400);
12399 npc_activity = 1; 12392 npc_activity = 1;
12400 ready_to_exit = false; 12393 ready_to_exit = false;
12840 if (v13 < timer->time_left_to_fire) 12833 if (v13 < timer->time_left_to_fire)
12841 timer->time_left_to_fire -= v13; 12834 timer->time_left_to_fire -= v13;
12842 else 12835 else
12843 { 12836 {
12844 timer->time_left_to_fire = timer->fire_interval; 12837 timer->time_left_to_fire = timer->fire_interval;
12845 12838 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
12846 start_event_seq_number = timer->timer_evt_seq_num;
12847 EventProcessor(timer->timer_evt_ID, 0, 1);
12848
12849 start_event_seq_number = 0;
12850 } 12839 }
12851 } 12840 }
12852 else 12841 else
12853 { 12842 {
12854 if (timer->next_fire_time < pParty->uTimePlayed) 12843 if (timer->next_fire_time < pParty->uTimePlayed)
12860 next_trigger_time = 28 * 60 * 60 * 24; // 1 month 12849 next_trigger_time = 28 * 60 * 60 * 24; // 1 month
12861 else if (timer->field_14) 12850 else if (timer->field_14)
12862 next_trigger_time = 7 * 60 * 60 * 24; // 1 week 12851 next_trigger_time = 7 * 60 * 60 * 24; // 1 week
12863 12852
12864 timer->next_fire_time += (next_trigger_time * 128) / 3.0f; 12853 timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
12865 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row is big time interval has lapsed 12854 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
12866 timer->next_fire_time = pParty->uTimePlayed; 12855 timer->next_fire_time = pParty->uTimePlayed;
12867 12856
12868 start_event_seq_number = timer->timer_evt_seq_num; 12857 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
12869 EventProcessor(timer->timer_evt_ID, 0, 1);
12870
12871 start_event_seq_number = 0;
12872 } 12858 }
12873 } 12859 }
12874 } 12860 }
12875 } 12861 }
12876 12862