diff mm7_3.cpp @ 1052:d48c762de563

-nomarg
author Nomad
date Thu, 23 May 2013 18:26:05 +0200
parents ff2d888f8033
children 1c10b24a4159
line wrap: on
line diff
--- a/mm7_3.cpp	Thu May 23 14:08:26 2013 +0200
+++ b/mm7_3.cpp	Thu May 23 18:26:05 2013 +0200
@@ -11855,11 +11855,9 @@
     for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
     {
 		test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
-      if ( test_event->_e_type== EVENT_OnMapLeave )
-      {
-        start_event_seq_number = pLevelEVT_Index[i].event_sequence_num;
-        EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1);
-        start_event_seq_number = 0;
+      if ( test_event->_e_type == EVENT_OnMapLeave )
+      {
+        EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
       }
     }
   }
@@ -11909,11 +11907,9 @@
 		}
 		else if (_evt->_e_type == EVENT_OnMapReload)
 		{
-			start_event_seq_number = pEvent.event_sequence_num;
-			EventProcessor(pEvent.uEventID, 0, 0);
-			start_event_seq_number = 0;
+			EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
 		}
-		else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
+		else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
 		{
 			v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
 			v20 = pOutdoor->loc_time.uLastVisitDay;
@@ -11936,7 +11932,7 @@
 
 			v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
             v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-			if (v3->timer_evt_type  == EVENT_OnLongTimer && !(short)v6 )
+			if (v3->timer_evt_type  == EVENT_Initialize && !(short)v6 )
 			{
 				if ( v20 )
 					v18 = pParty->uTimePlayed - v20;
@@ -12157,8 +12153,7 @@
   {
     if ( pParty->uFlags & 2 )
       pGame->Draw();
-    if ( !start_event_seq_number )
-      pAudioPlayer->StopChannels(-1, -1);
+    pAudioPlayer->StopChannels(-1, -1);
     pMiscTimer->Pause();
     pEventTimer->Pause();
     dword_5C3418 = v4;
@@ -12178,9 +12173,7 @@
   pGUIWindow2->Release();
   pGUIWindow2 = 0;
   activeLevelDecoration = _591094_decoration;
-  start_event_seq_number = dword_5C341C;
-  EventProcessor(dword_5C3418, 0, 1);
-  start_event_seq_number = 0;
+  EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
   activeLevelDecoration = NULL;
   pEventTimer->Resume();
 }
@@ -12381,7 +12374,7 @@
 }
 
 //----- (004466C4) --------------------------------------------------------
-int NPC_EventProcessor( int npc_event_id )
+int NPC_EventProcessor(int npc_event_id, int entry_line)
 	{
   signed int event_index; // ebp@1
   int evt_seq_num; // esi@3
@@ -12392,7 +12385,7 @@
   event_index = 0;
   if ( !npc_event_id )
     return 0;
-  evt_seq_num = start_event_seq_number;
+  evt_seq_num = entry_line;
   pSomeOtherEVT = pGlobalEVT;
   uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
   memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400);
@@ -12842,11 +12835,7 @@
       else
       {
         timer->time_left_to_fire = timer->fire_interval;
-
-        start_event_seq_number = timer->timer_evt_seq_num;
-        EventProcessor(timer->timer_evt_ID, 0, 1);
-
-        start_event_seq_number = 0;
+        EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
       }
     }
     else
@@ -12862,13 +12851,10 @@
           next_trigger_time = 7 * 60 * 60 * 24; // 1 week
 
         timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
-        if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row is big time interval has lapsed
+        if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
           timer->next_fire_time = pParty->uTimePlayed;
 
-        start_event_seq_number = timer->timer_evt_seq_num;
-        EventProcessor(timer->timer_evt_ID, 0, 1);
-
-        start_event_seq_number = 0;
+        EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
       }
     }
   }