comparison Events.cpp @ 601:d59398528e4f

level events loading fix
author Gloval
date Thu, 07 Mar 2013 01:07:45 +0400
parents f451efdb7c8b
children 628694cd5744
comparison
equal deleted inserted replaced
600:db4a23580e6c 601:d59398528e4f
119 119
120 120
121 //----- (00443EF8) -------------------------------------------------------- 121 //----- (00443EF8) --------------------------------------------------------
122 void LoadLevel_InitializeLevelEvt() 122 void LoadLevel_InitializeLevelEvt()
123 { 123 {
124 struct raw_event_header
125 {
126 unsigned char evt_size;
127 unsigned char evt_id_l;
128 unsigned char evt_id_h;
129 unsigned char evt_sequence_num;
130 } ;
131 uint events_count;
132 unsigned int offset_in;
133 raw_event_header *current_hdr;
134
124 if (!uLevelEVT_Size) 135 if (!uLevelEVT_Size)
125 return; 136 return;
126 137
127 memset(array_5B5928_timers, 0, 3200); 138 memset(array_5B5928_timers, 0, 3200);
128 memset(pLevelEVT_Index, 80, sizeof(EventIndex)*4400); 139 memset(pLevelEVT_Index, 80, sizeof(EventIndex)*4400);
129 140
130 uLevelEVT_NumEvents = 0; 141 uLevelEVT_NumEvents = 0;
131 dword_5B65C8_timers_count = 0; 142 dword_5B65C8_timers_count = 0;
132 143
144 current_hdr=(raw_event_header *)pLevelEVT;
145 offset_in=0;
146 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count)
147 {
148 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8);
149 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
150 pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in;
151 offset_in+=current_hdr->evt_size+1;
152 current_hdr=(raw_event_header *)&pLevelEVT[offset_in];
153 }
154 uLevelEVT_NumEvents = events_count;
155
156 /*
133 for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i) 157 for (uint i = 0, j = 0; j < uLevelEVT_Size; ++i)
134 { 158 {
135 pLevelEVT_Index[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8); 159 pLevelEVT_Index[i].uEventID = pLevelEVT[j + 1] + ((unsigned short)pLevelEVT[j + 2] << 8);
136 pLevelEVT_Index[i].event_sequence_num = pLevelEVT[j + 3]; 160 pLevelEVT_Index[i].event_sequence_num = pLevelEVT[j + 3];
137 pLevelEVT_Index[i].uEventOffsetInEVT = j; 161 pLevelEVT_Index[i].uEventOffsetInEVT = j;
138 j += pLevelEVT[j] + 1; 162 j += pLevelEVT[j] + 1;
139 uLevelEVT_NumEvents++; 163 uLevelEVT_NumEvents++;
140 } 164 }*/
141 } 165 }
142 166
143 167
144 //----- (0044684A) -------------------------------------------------------- 168 //----- (0044684A) --------------------------------------------------------
145 void EventProcessor(int uEventID, int targetObj, int canShowMessages) 169 void EventProcessor(int uEventID, int targetObj, int canShowMessages)