comparison Events.cpp @ 1490:db0dfdb9871e

Fix indentation.
author yoctozepto
date Thu, 29 Aug 2013 22:36:48 +0200
parents a27cdb3d753e
children c4ab816fcc5e
comparison
equal deleted inserted replaced
1489:a27cdb3d753e 1490:db0dfdb9871e
63 63
64 64
65 //----- (00443CE1) -------------------------------------------------------- 65 //----- (00443CE1) --------------------------------------------------------
66 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) 66 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize)
67 { 67 {
68 FILE *pLodFile; // eax@1 68 FILE *pLodFile; // eax@1
69 unsigned int uTextureSize; // esi@3 69 unsigned int uTextureSize; // esi@3
70 char Args[60]; // [sp+8h] [bp-B4h]@6 70 char Args[60]; // [sp+8h] [bp-B4h]@6
71 void *ptr; // [sp+B8h] [bp-4h]@1 71 void *ptr; // [sp+B8h] [bp-4h]@1
72 Texture DstBuf; // [sp+6Ch] [bp-50h]@1 72 Texture DstBuf; // [sp+6Ch] [bp-50h]@1
73 73
74 ptr = pEvents_LOD->LoadRaw(pContainerName, 0); 74 ptr = pEvents_LOD->LoadRaw(pContainerName, 0);
75 pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); 75 pLodFile = pEvents_LOD->FindContainer(pContainerName, 0);
76 if ( !pLodFile ) 76 if ( !pLodFile )
77 Abortf("Unable to load %s", pContainerName); 77 Abortf("Unable to load %s", pContainerName);
78 fread(&DstBuf, 1, 48, pLodFile); 78 fread(&DstBuf, 1, 48, pLodFile);
79 uTextureSize = DstBuf.uDecompressedSize; 79 uTextureSize = DstBuf.uDecompressedSize;
80 if ( !DstBuf.uDecompressedSize ) 80 if ( !DstBuf.uDecompressedSize )
81 uTextureSize = DstBuf.uTextureSize; 81 uTextureSize = DstBuf.uTextureSize;
82 memset(&DstBuf, 0, 72); 82 memset(&DstBuf, 0, 72);
83 if ( uTextureSize >= (signed int)uBufferSize ) 83 if ( uTextureSize >= (signed int)uBufferSize )
84 { 84 {
85 sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); 85 sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize);
86 Abortf(Args); 86 Abortf(Args);
87 } 87 }
88 memcpy(pBuffer, ptr, uTextureSize); 88 memcpy(pBuffer, ptr, uTextureSize);
89 pAllocator->FreeChunk(ptr); 89 pAllocator->FreeChunk(ptr);
90 return uTextureSize; 90 return uTextureSize;
91 } 91 }
92 92
93 //----- (00443DA1) -------------------------------------------------------- 93 //----- (00443DA1) --------------------------------------------------------
94 void Initialize_GlobalEVT() 94 void Initialize_GlobalEVT()
95 { 95 {
96 struct raw_event_header 96 struct raw_event_header
97 { 97 {
98 unsigned char evt_size; 98 unsigned char evt_size;
99 unsigned char evt_id_l; 99 unsigned char evt_id_l;
100 unsigned char evt_id_h; 100 unsigned char evt_id_h;
101 unsigned char evt_sequence_num; 101 unsigned char evt_sequence_num;
102 } ; 102 } ;
103 uint events_count; 103 uint events_count;
104 unsigned int offset_in; 104 unsigned int offset_in;
105 raw_event_header *current_hdr; 105 raw_event_header *current_hdr;
106 uGlobalEVT_NumEvents = 0; 106 uGlobalEVT_NumEvents = 0;
107 uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080); 107 uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080);
108 if ( !uGlobalEVT_Size ) 108 if ( !uGlobalEVT_Size )
109 return; 109 return;
110 memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800 110 memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800
111 events_count = uGlobalEVT_NumEvents; 111 events_count = uGlobalEVT_NumEvents;
112 current_hdr=(raw_event_header *)pGlobalEVT.data(); 112 current_hdr=(raw_event_header *)pGlobalEVT.data();
113 offset_in=0; 113 offset_in=0;
114 for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) 114 for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count)
115 { 115 {
116 pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); 116 pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8);
117 pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; 117 pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
118 pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in; 118 pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in;
119 offset_in+=current_hdr->evt_size+1; 119 offset_in+=current_hdr->evt_size+1;
120 120
121 current_hdr=(raw_event_header *)&pGlobalEVT[offset_in]; 121 current_hdr=(raw_event_header *)&pGlobalEVT[offset_in];
122 } 122 }
123 uGlobalEVT_NumEvents = events_count; 123 uGlobalEVT_NumEvents = events_count;
124 124
125 assert(uGlobalEVT_NumEvents < 4400); 125 assert(uGlobalEVT_NumEvents < 4400);
126 } 126 }
127 127
128 128
129 129
130 //----- (00443EF8) -------------------------------------------------------- 130 //----- (00443EF8) --------------------------------------------------------
131 void LoadLevel_InitializeLevelEvt() 131 void LoadLevel_InitializeLevelEvt()
132 { 132 {
133 struct raw_event_header 133 struct raw_event_header
134 { 134 {
135 unsigned char evt_size; 135 unsigned char evt_size;
136 unsigned char evt_id_l; 136 unsigned char evt_id_l;
137 unsigned char evt_id_h; 137 unsigned char evt_id_h;
138 unsigned char evt_sequence_num; 138 unsigned char evt_sequence_num;
139 } ; 139 } ;
140 uint events_count; 140 uint events_count;
141 unsigned int offset_in; 141 unsigned int offset_in;
142 raw_event_header *current_hdr; 142 raw_event_header *current_hdr;
143 143
144 if (!uLevelEVT_Size) 144 if (!uLevelEVT_Size)
145 return; 145 return;
146 146
147 memset(array_5B5928_timers, 0, 3200); 147 memset(array_5B5928_timers, 0, 3200);
148 memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400); 148 memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400);
149 149
150 uLevelEVT_NumEvents = 0; 150 uLevelEVT_NumEvents = 0;
151 dword_5B65C8_timers_count = 0; 151 dword_5B65C8_timers_count = 0;
152 152
153 current_hdr=(raw_event_header *)pLevelEVT.data(); 153 current_hdr=(raw_event_header *)pLevelEVT.data();
154 offset_in=0; 154 offset_in=0;
155 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count) 155 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count)
156 { 156 {
157 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); 157 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8);
158 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; 158 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num;
159 pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in; 159 pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in;
160 offset_in+=current_hdr->evt_size+1; 160 offset_in+=current_hdr->evt_size+1;
161 161
162 current_hdr=(raw_event_header *)&pLevelEVT[offset_in]; 162 current_hdr=(raw_event_header *)&pLevelEVT[offset_in];
163 } 163 }
164 uLevelEVT_NumEvents = events_count; 164 uLevelEVT_NumEvents = events_count;
171 [3] Gold Fountain used this week 171 [3] Gold Fountain used this week
172 [4] Gold Fountain total uses 172 [4] Gold Fountain total uses
173 173
174 174
175 Emerald Isle #110 // Fire Resistance fountain 175 Emerald Isle #110 // Fire Resistance fountain
176 0 LocationName 176 0 LocationName
177 0 if (Player.FireResistance < 50) 177 0 if (Player.FireResistance < 50)
178 { 178 {
179 1 Set(Player.FireResistance, 50) 179 1 Set(Player.FireResistance, 50)
180 2 SetFooterString(22) // +50 Fire Resistance (temporarily) 180 2 SetFooterString(22) // +50 Fire Resistance (temporarily)
181 3 Add(Party.Autonotes, 2) 181 3 Add(Party.Autonotes, 2)
182 4 goto return 182 4 goto return
183 } 183 }
184 5 SetFooterString(11) // Refreshing! 184 5 SetFooterString(11) // Refreshing!
185 6 return 185 6 return
186 186
187 187
188 188
189 Emerald Isle #111 // ??? 189 Emerald Isle #111 // ???
190 Initialize 190 Initialize
191 Set(Map.Variables[0], 30) 191 Set(Map.Variables[0], 30)
192 Set(Map.Variables[1], 30) 192 Set(Map.Variables[1], 30)
193 193
194 194
195 Emerald Isle #114 // month timer - manage luck fountain 195 Emerald Isle #114 // month timer - manage luck fountain
196 0 LocationName 196 0 LocationName
197 0 if (Player.BaseLuck >= 15) 197 0 if (Player.BaseLuck >= 15)
198 { 198 {
199 2 SetFooterString(11) // Refreshing! 199 2 SetFooterString(11) // Refreshing!
200 3 return 200 3 return
201 } 201 }
202 else 202 else
203 { 203 {
204 1 if (Map.Variables[2] >= 1) 204 1 if (Map.Variables[2] >= 1)
205 { 205 {
206 4 Sub(Map.Variables[2], 1) 206 4 Sub(Map.Variables[2], 1)
207 5 Add(Player.BaseLuck, 2) 207 5 Add(Player.BaseLuck, 2)
208 6 SetFooterString(25) // +2 Luck (Permament) 208 6 SetFooterString(25) // +2 Luck (Permament)
209 7 return 209 7 return
210 } 210 }
211 else 211 else
212 { 212 {
213 2 SetFooterString(11) // Refreshing! 213 2 SetFooterString(11) // Refreshing!
214 3 return 214 3 return
215 } 215 }
216 } 216 }
217 217
218 8 Initialize 218 8 Initialize
219 9 Set Map.Variables[2], 8 219 9 Set Map.Variables[2], 8
220 220
221 221
222 222
223 Emerald Isle #115 // week timer - gold fountain in the center of town 223 Emerald Isle #115 // week timer - gold fountain in the center of town
224 0 LocationName 224 0 LocationName
225 0 if (Map.Variables[4] < 3) 225 0 if (Map.Variables[4] < 3)
226 { 226 {
227 1 if (Map.Variables[3] == 0) 227 1 if (Map.Variables[3] == 0)
228 { 228 {
229 2 if (Party.Gold < 201) 229 2 if (Party.Gold < 201)
230 { 230 {
231 3 if (Player.BaseLuck >= 15) 231 3 if (Player.BaseLuck >= 15)
232 { 232 {
233 5 Add(Map.Variables[3], 1) 233 5 Add(Map.Variables[3], 1)
234 6 Add(Party.Gold, 1000) 234 6 Add(Party.Gold, 1000)
235 7 Add(Map.Variables[4], 1) 235 7 Add(Map.Variables[4], 1)
236 8 goto return 236 8 goto return
237 } 237 }
238 else 238 else
239 { 239 {
240 4 goto 9 240 4 goto 9
241 } 241 }
242 } 242 }
243 } 243 }
244 } 244 }
245 9 SetFooterString(11) // Refreshing! 245 9 SetFooterString(11) // Refreshing!
246 10 return 246 10 return
247 247
248 11 Initialize 248 11 Initialize
249 12 Set(Map.Variables[3], 0) 249 12 Set(Map.Variables[3], 0)
250 250
251 251
252 252
253 253
254 254
255 Emerald Isle #220 // day timer - monster spawner 255 Emerald Isle #220 // day timer - monster spawner
256 0 LocationName 256 0 LocationName
257 0 Initialize 257 0 Initialize
258 1 if (NumAliveActors(group=20) != 0) 258 1 if (NumAliveActors(group=20) != 0)
259 2 return 259 2 return
260 3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20) 260 3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20)
261 4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20) 261 4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20)
262 5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20) 262 5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20)
263 263
264 264
265 265
266 Emerald Isle #200 // margareth dock tip 266 Emerald Isle #200 // margareth dock tip
267 0 if (!QBits.QuestDone[17]) 267 0 if (!QBits.QuestDone[17])
268 { 268 {
269 1 InitiateNPCDialogue(npc=19) 269 1 InitiateNPCDialogue(npc=19)
270 } 270 }
271 2 return 271 2 return
272 272
273 273
274 Emerald Isle #201 // margareth armoury tip 274 Emerald Isle #201 // margareth armoury tip
275 0 if (!QBits.QuestDone[17]) 275 0 if (!QBits.QuestDone[17])
276 { 276 {
277 1 InitiateNPCDialogue(npc=20) 277 1 InitiateNPCDialogue(npc=20)
278 } 278 }
279 2 return 279 2 return
280 */ 280 */
281 } 281 }
282 282
283 283
284 //----- (0044684A) -------------------------------------------------------- 284 //----- (0044684A) --------------------------------------------------------
285 void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line) 285 void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
286 { 286 {
287 unsigned int v3; // eax@5 287 unsigned int v3; // eax@5
288 signed int v4; // esi@7 288 signed int v4; // esi@7
289 //char *v5; // eax@8 289 //char *v5; // eax@8
290 Player *v6; // ecx@8 290 Player *v6; // ecx@8
291 //char *v7; // ebp@8 291 //char *v7; // ebp@8
292 //signed int v8; // edx@10 292 //signed int v8; // edx@10
293 //int v9; // edi@12 293 //int v9; // edi@12
294 //ByteArray *v10; // esi@12 294 //ByteArray *v10; // esi@12
295 int v11; // eax@14 295 int v11; // eax@14
296 char *v12; // eax@15 296 char *v12; // eax@15
297 //char *v13; // edi@21 297 //char *v13; // edi@21
298 int v14; // ebp@21 298 int v14; // ebp@21
299 int v15; // edi@21 299 int v15; // edi@21
300 const char *v16; // esi@21 300 const char *v16; // esi@21
301 bool v17; // edx@21 301 bool v17; // edx@21
302 int v18; // ecx@22 302 int v18; // ecx@22
303 int v19; // ebp@36 303 int v19; // ebp@36
304 signed int v20; // ecx@40 304 signed int v20; // ecx@40
305 int v21; // eax@40 305 int v21; // eax@40
306 int v22; // edx@40 306 int v22; // edx@40
307 int v23; // eax@40 307 int v23; // eax@40
308 unsigned __int16 v24; // ax@45 308 unsigned __int16 v24; // ax@45
309 int v25; // eax@54 309 int v25; // eax@54
310 LevelDecoration *v26; // eax@55 310 LevelDecoration *v26; // eax@55
311 int v27; // eax@57 311 int v27; // eax@57
312 int v28; // ecx@57 312 int v28; // ecx@57
313 //int v29; // edx@58 313 //int v29; // edx@58
314 int pEventID; // eax@58 314 int pEventID; // eax@58
315 int pNPC_ID; // ecx@58 315 int pNPC_ID; // ecx@58
316 int pIndex; // esi@58 316 int pIndex; // esi@58
317 NPCData *pNPC; // ecx@58 317 NPCData *pNPC; // ecx@58
318 int v34; // esi@59 318 int v34; // esi@59
319 int v35; // esi@60 319 int v35; // esi@60
320 int v36; // esi@61 320 int v36; // esi@61
321 int v37; // esi@62 321 int v37; // esi@62
322 int v38; // eax@78 322 int v38; // eax@78
323 int v39; // ecx@78 323 int v39; // ecx@78
324 size_t v40; // edx@78 324 size_t v40; // edx@78
325 Actor *v41; // esi@79 325 Actor *v41; // esi@79
326 int v42; // eax@84 326 int v42; // eax@84
327 int v43; // ecx@84 327 int v43; // ecx@84
328 size_t v44; // edx@84 328 size_t v44; // edx@84
329 Actor *v45; // esi@85 329 Actor *v45; // esi@85
330 void *v46; // eax@91 330 void *v46; // eax@91
331 GUIWindow *v47; // eax@93 331 GUIWindow *v47; // eax@93
332 GUIButton *v48; // ecx@93 332 GUIButton *v48; // ecx@93
333 GUIButton *v49; // esi@94 333 GUIButton *v49; // esi@94
334 char v50; // al@100 334 char v50; // al@100
335 Player *v51; // esi@103 335 Player *v51; // esi@103
336 Player *v52; // ecx@106 336 Player *v52; // ecx@106
337 int v53; // ecx@107 337 int v53; // ecx@107
338 char v54; // al@111 338 char v54; // al@111
339 Player *v55; // esi@114 339 Player *v55; // esi@114
340 Player *v56; // ecx@117 340 Player *v56; // ecx@117
341 int v57; // ecx@118 341 int v57; // ecx@118
342 signed int pValue; // ebp@124 342 signed int pValue; // ebp@124
343 Player *pPlayer; // esi@125 343 Player *pPlayer; // esi@125
344 int v60; // eax@126 344 int v60; // eax@126
345 int v61; // edx@133 345 int v61; // edx@133
346 int v62; // eax@139 346 int v62; // eax@139
347 int v63; // ebp@145 347 int v63; // ebp@145
348 signed int v64; // edi@146 348 signed int v64; // edi@146
349 unsigned int v65; // edx@148 349 unsigned int v65; // edx@148
350 Player *v66; // ecx@148 350 Player *v66; // ecx@148
351 int v67; // esi@148 351 int v67; // esi@148
352 signed int v68; // eax@151 352 signed int v68; // eax@151
353 int v69; // esi@151 353 int v69; // esi@151
354 Player *v70; // ecx@158 354 Player *v70; // ecx@158
355 unsigned int v71; // eax@159 355 unsigned int v71; // eax@159
356 int v72; // esi@159 356 int v72; // esi@159
357 signed int v73; // eax@162 357 signed int v73; // eax@162
358 int v74; // esi@162 358 int v74; // esi@162
359 int v75; // edx@172 359 int v75; // edx@172
360 Player *v76; // esi@173 360 Player *v76; // esi@173
361 signed int v77; // ebp@186 361 signed int v77; // ebp@186
362 int v78; // edx@186 362 int v78; // edx@186
363 Player *v79; // esi@187 363 Player *v79; // esi@187
364 //signed int v80; // ebp@200 364 //signed int v80; // ebp@200
365 //int v81; // edx@200 365 //int v81; // edx@200
366 Player *v82; // esi@201 366 Player *v82; // esi@201
367 int v83; // eax@212 367 int v83; // eax@212
368 int v84; // ebp@220 368 int v84; // ebp@220
369 signed int v85; // ebp@224 369 signed int v85; // ebp@224
370 char v86; // al@224 370 char v86; // al@224
371 Player *v87; // esi@227 371 Player *v87; // esi@227
372 Player *v88; // ecx@231 372 Player *v88; // ecx@231
373 int v89; // ecx@232 373 int v89; // ecx@232
374 int v90; // eax@243 374 int v90; // eax@243
375 const char *v91; // ecx@247 375 const char *v91; // ecx@247
376 int v92; // eax@251 376 int v92; // eax@251
377 char *v93; // eax@252 377 char *v93; // eax@252
378 int v94; // ecx@262 378 int v94; // ecx@262
379 int v95; // ebp@262 379 int v95; // ebp@262
380 int v96; // edx@262 380 int v96; // edx@262
381 int v97; // eax@262 381 int v97; // eax@262
382 unsigned int v98; // edx@265 382 unsigned int v98; // edx@265
383 const char *v99; // esi@267 383 const char *v99; // esi@267
384 int v100; // edx@267 384 int v100; // edx@267
385 //char *v101; // edi@281 385 //char *v101; // edi@281
386 unsigned int v102; // esi@281 386 unsigned int v102; // esi@281
387 int v103; // edi@284 387 int v103; // edi@284
388 int v104; // eax@288 388 int v104; // eax@288
389 int v105; // edx@294 389 int v105; // edx@294
390 int v106; // [sp-20h] [bp-4C8h]@278 390 int v106; // [sp-20h] [bp-4C8h]@278
391 signed int v107; // [sp-1Ch] [bp-4C4h]@278 391 signed int v107; // [sp-1Ch] [bp-4C4h]@278
392 unsigned int v108; // [sp-18h] [bp-4C0h]@278 392 unsigned int v108; // [sp-18h] [bp-4C0h]@278
393 signed int v109; // [sp-14h] [bp-4BCh]@278 393 signed int v109; // [sp-14h] [bp-4BCh]@278
394 signed int v110; // [sp-10h] [bp-4B8h]@278 394 signed int v110; // [sp-10h] [bp-4B8h]@278
395 int v111; // [sp-Ch] [bp-4B4h]@278 395 int v111; // [sp-Ch] [bp-4B4h]@278
396 // Event *v112; // [sp-8h] [bp-4B0h]@5 396 // Event *v112; // [sp-8h] [bp-4B0h]@5
397 int v113; // [sp-8h] [bp-4B0h]@106 397 int v113; // [sp-8h] [bp-4B0h]@106
398 int v114; // [sp-8h] [bp-4B0h]@117 398 int v114; // [sp-8h] [bp-4B0h]@117
399 signed int v115; // [sp-8h] [bp-4B0h]@231 399 signed int v115; // [sp-8h] [bp-4B0h]@231
400 unsigned int v116; // [sp-8h] [bp-4B0h]@278 400 unsigned int v116; // [sp-8h] [bp-4B0h]@278
401 int v117; // [sp-4h] [bp-4ACh]@106 401 int v117; // [sp-4h] [bp-4ACh]@106
402 int v118; // [sp-4h] [bp-4ACh]@117 402 int v118; // [sp-4h] [bp-4ACh]@117
403 int v119; // [sp-4h] [bp-4ACh]@231 403 int v119; // [sp-4h] [bp-4ACh]@231
404 int v120; // [sp-4h] [bp-4ACh]@278 404 int v120; // [sp-4h] [bp-4ACh]@278
405 int v121; // [sp-4h] [bp-4ACh]@294 405 int v121; // [sp-4h] [bp-4ACh]@294
406 int curr_seq_num; // [sp+10h] [bp-498h]@4 406 int curr_seq_num; // [sp+10h] [bp-498h]@4
407 //char *v123; // [sp+14h] [bp-494h]@0 407 //char *v123; // [sp+14h] [bp-494h]@0
408 signed int v124; // [sp+18h] [bp-490h]@7 408 signed int v124; // [sp+18h] [bp-490h]@7
409 //signed int v125; // [sp+1Ch] [bp-48Ch]@155 409 //signed int v125; // [sp+1Ch] [bp-48Ch]@155
410 int v126; // [sp+1Ch] [bp-48Ch]@262 410 int v126; // [sp+1Ch] [bp-48Ch]@262
411 int player_choose; // [sp+20h] [bp-488h]@4 411 int player_choose; // [sp+20h] [bp-488h]@4
412 int v128; // [sp+24h] [bp-484h]@21 412 int v128; // [sp+24h] [bp-484h]@21
413 int v129; // [sp+24h] [bp-484h]@262 413 int v129; // [sp+24h] [bp-484h]@262
414 signed int v130; // [sp+28h] [bp-480h]@0 414 signed int v130; // [sp+28h] [bp-480h]@0
415 //int v131; // [sp+2Ch] [bp-47Ch]@1 415 //int v131; // [sp+2Ch] [bp-47Ch]@1
416 int v132; // [sp+30h] [bp-478h]@262 416 int v132; // [sp+30h] [bp-478h]@262
417 signed int v133; // [sp+34h] [bp-474h]@1 417 signed int v133; // [sp+34h] [bp-474h]@1
418 int v134; // [sp+38h] [bp-470h]@262 418 int v134; // [sp+38h] [bp-470h]@262
419 int v135; // [sp+3Ch] [bp-46Ch]@262 419 int v135; // [sp+3Ch] [bp-46Ch]@262
420 int v136; // [sp+40h] [bp-468h]@40 420 int v136; // [sp+40h] [bp-468h]@40
421 int v137; // [sp+44h] [bp-464h]@40 421 int v137; // [sp+44h] [bp-464h]@40
422 int v138; // [sp+48h] [bp-460h]@40 422 int v138; // [sp+48h] [bp-460h]@40
423 int v139; // [sp+4Ch] [bp-45Ch]@40 423 int v139; // [sp+4Ch] [bp-45Ch]@40
424 ItemGen item; // [sp+50h] [bp-458h]@15 424 ItemGen item; // [sp+50h] [bp-458h]@15
425 char Source[120]; // [sp+74h] [bp-434h]@15 425 char Source[120]; // [sp+74h] [bp-434h]@15
426 char Str[120]; // [sp+ECh] [bp-3BCh]@21 426 char Str[120]; // [sp+ECh] [bp-3BCh]@21
427 Actor Dst; // [sp+164h] [bp-344h]@53 427 Actor Dst; // [sp+164h] [bp-344h]@53
428 428
429 //v131 = uEventID; 429 //v131 = uEventID;
430 v133 = 0; 430 v133 = 0;
431 EvtTargetObj = targetObj; 431 EvtTargetObj = targetObj;
432 dword_5B65C4 = 0; 432 dword_5B65C4 = 0;
433 if ( !uEventID ) 433 if ( !uEventID )
434 { 434 {
435 if ( !GameUI_Footer_TimeLeft ) 435 if ( !GameUI_Footer_TimeLeft )
436 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here 436 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
437 return; 437 return;
438 } 438 }
439 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 439 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0
440 curr_seq_num = entry_line; 440 curr_seq_num = entry_line;
441 441
442 if ( activeLevelDecoration ) 442 if ( activeLevelDecoration )
443 { 443 {
444 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; 444 uSomeEVT_NumEvents = uGlobalEVT_NumEvents;
445 pSomeEVT = pGlobalEVT.data(); 445 pSomeEVT = pGlobalEVT.data();
446 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts 446 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts
447 } 447 }
448 else 448 else
449 { 449 {
450 uSomeEVT_NumEvents = uLevelEVT_NumEvents; 450 uSomeEVT_NumEvents = uLevelEVT_NumEvents;
451 pSomeEVT = pLevelEVT.data(); 451 pSomeEVT = pLevelEVT.data();
452 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); 452 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400);
453 } 453 }
454 454
455 v4 = 0; 455 v4 = 0;
456 v124 = 0; 456 v124 = 0;
457 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) 457 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i)
458 // { 458 // {
459 //v6 = v123; 459 //v6 = v123;
460 //v7 = ""; 460 //v7 = "";
461 while ( 1 ) 461 while ( 1 )
462 { 462 {
463 if ( dword_5B65C4 ) 463 if ( dword_5B65C4 )
464 goto LABEL_301; 464 goto LABEL_301;
465 //v8 = v4; 465 //v8 = v4;
466 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) 466 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num )
467 { 467 {
468 //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; 468 //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT;
469 //v10 = (ByteArray *)&v5[v9]; 469 //v10 = (ByteArray *)&v5[v9];
470 auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); 470 auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT);
471 471
472 switch (_evt->_e_type) 472 switch (_evt->_e_type)
473 { 473 {
474 case EVENT_CheckSeason: 474 case EVENT_CheckSeason:
475 // 475 //
476 if ( !sub_4465DF_check_season(_evt->v5) ) 476 if ( !sub_4465DF_check_season(_evt->v5) )
477 { 477 {
478 ++curr_seq_num; 478 ++curr_seq_num;
479 v4 = v124; 479 v4 = v124;
480 break; 480 break;
481 } 481 }
482 v124 = -1; 482 v124 = -1;
483 curr_seq_num = _evt->v6 - 1; 483 curr_seq_num = _evt->v6 - 1;
484 ++curr_seq_num; 484 ++curr_seq_num;
485 break; 485 break;
486 case EVENT_ShowMovie: 486 case EVENT_ShowMovie:
487 { 487 {
488 strcpy(Source, (char *)&_evt->v7); 488 strcpy(Source, (char *)&_evt->v7);
489 v12 = (char *)&item.uExpireTime + strlen(Source) + 7; 489 v12 = (char *)&item.uExpireTime + strlen(Source) + 7;
490 if ( *v12 == 32 ) 490 if ( *v12 == 32 )
491 *v12 = 0; 491 *v12 = 0;
492 if ( pVideoPlayer->field_54 ) 492 if ( pVideoPlayer->field_54 )
493 pVideoPlayer->Unload(); 493 pVideoPlayer->Unload();
494 pVideoPlayer->bStopBeforeSchedule = 0; 494 pVideoPlayer->bStopBeforeSchedule = 0;
495 pVideoPlayer->pResetflag = 0; 495 pVideoPlayer->pResetflag = 0;
496 496
497 v128 = pCurrentScreen; 497 v128 = pCurrentScreen;
498 //v13 = &pSomeEVT[v9]; 498 //v13 = &pSomeEVT[v9];
499 //v14 = (unsigned __int8)v13[5]; 499 //v14 = (unsigned __int8)v13[5];
500 //v15 = (unsigned __int8)v13[6]; 500 //v15 = (unsigned __int8)v13[6];
501 v14 = _evt->v5; 501 v14 = _evt->v5;
502 v15 = _evt->v6; 502 v15 = _evt->v6;
503 strcpy(Str, Source); 503 strcpy(Str, Source);
504 v16 = RemoveQuotes(Str); 504 v16 = RemoveQuotes(Str);
505 VideoPlayer::MovieLoop(v16, 0, v14, 1); 505 VideoPlayer::MovieLoop(v16, 0, v14, 1);
506 if ( !_stricmp(v16, "arbiter good") ) 506 if ( !_stricmp(v16, "arbiter good") )
507 { 507 {
508 pParty->alignment = PartyAlignment_Good; 508 pParty->alignment = PartyAlignment_Good;
509 v18 = 0; 509 v18 = 0;
510 LOBYTE(v17) = 1; 510 LOBYTE(v17) = 1;
511 SetUserInterface(PartyAlignment_Good, v17); 511 SetUserInterface(PartyAlignment_Good, v17);
512 if ( !v15 || v128 == 3 ) 512 if ( !v15 || v128 == 3 )
513 { 513 {
514 pCurrentScreen = v128; 514 pCurrentScreen = v128;
515 if ( v128 == 3 ) 515 if ( v128 == 3 )
516 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; 516 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
517 if ( v128 == 13 ) 517 if ( v128 == 13 )
518 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); 518 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
519 } 519 }
520 520
521 ++curr_seq_num; 521 ++curr_seq_num;
522 v4 = v124; 522 v4 = v124;
523 523
524 //v6 = v123; 524 //v6 = v123;
525 //v7 = ""; 525 //v7 = "";
526 break; 526 break;
527 } 527 }
528 if ( !_stricmp(v16, "arbiter evil") ) 528 if ( !_stricmp(v16, "arbiter evil") )
529 { 529 {
530 v18 = 2; 530 v18 = 2;
531 pParty->alignment = PartyAlignment_Evil; 531 pParty->alignment = PartyAlignment_Evil;
532 LOBYTE(v17) = 1; 532 LOBYTE(v17) = 1;
533 SetUserInterface(PartyAlignment_Evil, v17); 533 SetUserInterface(PartyAlignment_Evil, v17);
534 if ( !v15 || v128 == 3 ) 534 if ( !v15 || v128 == 3 )
535 { 535 {
536 pCurrentScreen = v128; 536 pCurrentScreen = v128;
537 if ( v128 == 3 ) 537 if ( v128 == 3 )
538 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; 538 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
539 if ( v128 == 13 ) 539 if ( v128 == 13 )
540 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); 540 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
541 } 541 }
542 ++curr_seq_num; 542 ++curr_seq_num;
543 v4 = v124; 543 v4 = v124;
544 544
545 //v6 = v123; 545 //v6 = v123;
546 //v7 = ""; 546 //v7 = "";
547 547
548 break; 548 break;
549 } 549 }
550 if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle 550 if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle
551 { 551 {
552 Rest(0x2760u); 552 Rest(0x2760u);
553 pParty->RestAndHeal(); 553 pParty->RestAndHeal();
554 pParty->days_played_without_rest = 0; 554 pParty->days_played_without_rest = 0;
555 } 555 }
556 if ( !v15 || v128 == 3 ) 556 if ( !v15 || v128 == 3 )
557 { 557 {
558 pCurrentScreen = v128; 558 pCurrentScreen = v128;
559 if ( v128 == 3 ) 559 if ( v128 == 3 )
560 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; 560 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
561 if ( v128 == 13 ) 561 if ( v128 == 13 )
562 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); 562 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u);
563 } 563 }
564 ++curr_seq_num; 564 ++curr_seq_num;
565 v4 = v124; 565 v4 = v124;
566 566
567 //v6 = v123; 567 //v6 = v123;
568 //v7 = ""; 568 //v7 = "";
569 } 569 }
570 break; 570 break;
571 case EVENT_CheckSkill: 571 case EVENT_CheckSkill:
572 { 572 {
573 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); 573 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8);
574 if ( player_choose < 0 ) 574 if ( player_choose < 0 )
575 goto LABEL_47; 575 goto LABEL_47;
576 if ( player_choose <= 3 ) 576 if ( player_choose <= 3 )
577 { 577 {
578 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; 578 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5];
579 } 579 }
580 else 580 else
581 { 581 {
582 if ( player_choose == 4 ) 582 if ( player_choose == 4 )
583 { 583 {
584 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; 584 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5];
585 } 585 }
586 else 586 else
587 { 587 {
588 if ( player_choose == 5 ) 588 if ( player_choose == 5 )
589 { 589 {
590 v20 = 0; 590 v20 = 0;
591 v21 = 3486 * v130 + _evt->v5; 591 v21 = 3486 * v130 + _evt->v5;
592 v136 = 1; 592 v136 = 1;
593 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; 593 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21];
594 v137 = v21 & 0x40; 594 v137 = v21 & 0x40;
595 v138 = v21 & 0x80; 595 v138 = v21 & 0x80;
596 v22 = v21 & 0x100; 596 v22 = v21 & 0x100;
597 v23 = v21 & 0x3F; 597 v23 = v21 & 0x3F;
598 v139 = v22; 598 v139 = v22;
599 while ( v23 < v19 || !*(&v136 + _evt->v6) ) 599 while ( v23 < v19 || !*(&v136 + _evt->v6) )
600 { 600 {
601 ++v20; 601 ++v20;
602 if ( v20 >= 4 ) 602 if ( v20 >= 4 )
603 { 603 {
604 ++curr_seq_num; 604 ++curr_seq_num;
605 v4 = v124; 605 v4 = v124;
606 606
607 //v6 = v123; 607 //v6 = v123;
608 //v7 = ""; 608 //v7 = "";
609 break; 609 break;
610 } 610 }
611 } 611 }
612 v11 = _evt->v11; 612 v11 = _evt->v11;
613 goto LABEL_130; 613 goto LABEL_130;
614 } 614 }
615 LABEL_47: 615 LABEL_47:
616 //v10 = (ByteArray *)&v5[v9]; 616 //v10 = (ByteArray *)&v5[v9];
617 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; 617 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4];
618 } 618 }
619 } 619 }
620 v136 = 1; 620 v136 = 1;
621 v137 = v24 & 0x40; 621 v137 = v24 & 0x40;
622 v138 = v24 & 0x80; 622 v138 = v24 & 0x80;
623 v139 = v24 & 0x100; 623 v139 = v24 & 0x100;
624 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) 624 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) )
625 { 625 {
626 v11 = _evt->v11; 626 v11 = _evt->v11;
627 goto LABEL_130; 627 goto LABEL_130;
628 } 628 }
629 ++curr_seq_num; 629 ++curr_seq_num;
630 v4 = v124; 630 v4 = v124;
631 631
632 //v6 = v123; 632 //v6 = v123;
633 //v7 = ""; 633 //v7 = "";
634 } 634 }
635 break; 635 break;
636 636
637 case EVENT_SpeakNPC: 637 case EVENT_SpeakNPC:
638 if ( canShowMessages ) 638 if ( canShowMessages )
639 { 639 {
640 //Actor::Actor(&Dst); 640 //Actor::Actor(&Dst);
641 memset(&Dst, 0, 0x344u); 641 memset(&Dst, 0, 0x344u);
642 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); 642 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
643 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; 643 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id;
644 GameUI_InitializeDialogue(&Dst, false); 644 GameUI_InitializeDialogue(&Dst, false);
645 } 645 }
646 else 646 else
647 { 647 {
648 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); 648 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8);
649 } 649 }
650 ++curr_seq_num; 650 ++curr_seq_num;
651 v4 = v124; 651 v4 = v124;
652 652
653 //v6 = v123; 653 //v6 = v123;
654 //v7 = ""; 654 //v7 = "";
655 break; 655 break;
656 case EVENT_ChangeEvent: 656 case EVENT_ChangeEvent:
657 v25 = EVT_DWORD(_evt->v5); 657 v25 = EVT_DWORD(_evt->v5);
658 if ( v25 ) 658 if ( v25 )
659 { 659 {
660 stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; 660 stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124;
661 } 661 }
662 else 662 else
663 { 663 {
664 v26 = (LevelDecoration *)activeLevelDecoration; 664 v26 = (LevelDecoration *)activeLevelDecoration;
665 stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; 665 stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0;
666 v26->uFlags |= LEVEL_DECORATION_INVISIBLE; 666 v26->uFlags |= LEVEL_DECORATION_INVISIBLE;
667 } 667 }
668 ++curr_seq_num; 668 ++curr_seq_num;
669 v4 = v124; 669 v4 = v124;
670 670
671 break; 671 break;
672 case EVENT_SetNPCGreeting: 672 case EVENT_SetNPCGreeting:
673 v27 = EVT_DWORD(_evt->v5); 673 v27 = EVT_DWORD(_evt->v5);
674 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; 674 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu;
675 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); 675 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9);
676 ++curr_seq_num; 676 ++curr_seq_num;
677 v4 = v124; 677 v4 = v124;
678 678
679 //v6 = v123; 679 //v6 = v123;
680 //v7 = ""; 680 //v7 = "";
681 break; 681 break;
682 case EVENT_SetNPCTopic: 682 case EVENT_SetNPCTopic:
683 { 683 {
684 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 684 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
685 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); 685 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8);
686 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 686 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
720 } 720 }
721 ++curr_seq_num; 721 ++curr_seq_num;
722 } 722 }
723 v4 = v124; 723 v4 = v124;
724 break; 724 break;
725 case EVENT_NPCSetItem: 725 case EVENT_NPCSetItem:
726 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); 726 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
727 ++curr_seq_num; 727 ++curr_seq_num;
728 v4 = v124; 728 v4 = v124;
729 729
730 break; 730 break;
731 case EVENT_SetActorItem: 731 case EVENT_SetActorItem:
732 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); 732 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
733 ++curr_seq_num; 733 ++curr_seq_num;
734 v4 = v124; 734 v4 = v124;
735 break; 735 break;
736 case EVENT_SetNPCGroupNews: 736 case EVENT_SetNPCGroupNews:
737 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); 737 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8);
738 ++curr_seq_num; 738 ++curr_seq_num;
739 v4 = v124; 739 v4 = v124;
740 break; 740 break;
741 case EVENT_SetActorGroup: 741 case EVENT_SetActorGroup:
742 __debugbreak(); 742 __debugbreak();
743 *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 743 *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
744 ++curr_seq_num; 744 ++curr_seq_num;
745 v4 = v124; 745 v4 = v124;
746 break; 746 break;
747 case EVENT_ChangeGroup: 747 case EVENT_ChangeGroup:
748 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 748 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
749 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 749 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
750 v40 = uNumActors; 750 v40 = uNumActors;
751 __debugbreak(); 751 __debugbreak();
752 if ( (signed int)uNumActors > 0 ) 752 if ( (signed int)uNumActors > 0 )
753 { 753 {
754 v41 = pActors.data();//[0].uGroup; 754 v41 = pActors.data();//[0].uGroup;
755 do 755 do
756 { 756 {
757 if ( v41->uGroup == v38 ) 757 if ( v41->uGroup == v38 )
758 v41->uGroup = v39; 758 v41->uGroup = v39;
759 ++v41; 759 ++v41;
760 --v40; 760 --v40;
761 } 761 }
762 while ( v40 ); 762 while ( v40 );
763 } 763 }
764 ++curr_seq_num; 764 ++curr_seq_num;
765 v4 = v124; 765 v4 = v124;
766 766
767 //v6 = v123; 767 //v6 = v123;
768 //v7 = ""; 768 //v7 = "";
769 break; 769 break;
770 case EVENT_ChangeGroupAlly: 770 case EVENT_ChangeGroupAlly:
771 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 771 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
772 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 772 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
773 v44 = uNumActors; 773 v44 = uNumActors;
774 __debugbreak(); 774 __debugbreak();
775 if ( (signed int)uNumActors > 0 ) 775 if ( (signed int)uNumActors > 0 )
776 { 776 {
777 v45 = pActors.data();//[0].uAlly; 777 v45 = pActors.data();//[0].uAlly;
778 do 778 do
779 { 779 {
780 if ( v45->uGroup == v42 ) 780 if ( v45->uGroup == v42 )
781 v45->uAlly = v43; 781 v45->uAlly = v43;
782 ++v45; 782 ++v45;
783 --v44; 783 --v44;
784 } 784 }
785 while ( v44 ); 785 while ( v44 );
786 } 786 }
787 ++curr_seq_num; 787 ++curr_seq_num;
788 v4 = v124; 788 v4 = v124;
789 789
790 //v6 = v123; 790 //v6 = v123;
791 //v7 = ""; 791 //v7 = "";
792 break; 792 break;
793 case EVENT_MoveNPC: 793 case EVENT_MoveNPC:
794 { 794 {
795 795
796 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); 796 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9);
797 if ( window_SpeakInHouse ) 797 if ( window_SpeakInHouse )
798 { 798 {
799 799
800 if ( window_SpeakInHouse->par1C == 165 ) 800 if ( window_SpeakInHouse->par1C == 165 )
801 { 801 {
802 sub_4BD8B5(); 802 sub_4BD8B5();
803 pVideoPlayer->Unload(); 803 pVideoPlayer->Unload();
804 window_SpeakInHouse->Release(); 804 window_SpeakInHouse->Release();
805 pParty->uFlags &= ~2; 805 pParty->uFlags &= ~2;
806 activeLevelDecoration = (LevelDecoration*)1; 806 activeLevelDecoration = (LevelDecoration*)1;
807 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) 807 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) )
808 { 808 {
809 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 809 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
810 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); 810 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
811 v48 = window_SpeakInHouse->pControlsHead; 811 v48 = window_SpeakInHouse->pControlsHead;
812 if ( v48 ) 812 if ( v48 )
813 { 813 {
814 do 814 do
815 { 815 {
816 v49 = v48->pNext; 816 v49 = v48->pNext;
817 pAllocator->FreeChunk(v48); 817 pAllocator->FreeChunk(v48);
818 v48 = v49; 818 v48 = v49;
819 } 819 }
820 while ( v49 ); 820 while ( v49 );
821 } 821 }
822 window_SpeakInHouse->pControlsHead = 0; 822 window_SpeakInHouse->pControlsHead = 0;
823 window_SpeakInHouse->pControlsTail = 0; 823 window_SpeakInHouse->pControlsTail = 0;
824 window_SpeakInHouse->uNumControls = 0; 824 window_SpeakInHouse->uNumControls = 0;
825 } 825 }
826 } 826 }
827 else 827 else
828 { 828 {
829 if ( window_SpeakInHouse->par1C == 553 ) 829 if ( window_SpeakInHouse->par1C == 553 )
830 pVideoPlayer->bLoopPlaying = 0; 830 pVideoPlayer->bLoopPlaying = 0;
831 } 831 }
832 } 832 }
833 833
834 } 834 }
835 ++curr_seq_num; 835 ++curr_seq_num;
836 v4 = v124; 836 v4 = v124;
837 837
838 break; 838 break;
839 case EVENT_Jmp: 839 case EVENT_Jmp:
840 curr_seq_num = _evt->v5 - 1; 840 curr_seq_num = _evt->v5 - 1;
841 ++curr_seq_num; 841 ++curr_seq_num;
842 v4 = -1; 842 v4 = -1;
843 843
844 break; 844 break;
845 case EVENT_ShowFace: 845 case EVENT_ShowFace:
846 if ( _evt->v5 <= 3u ) //someone 846 if ( _evt->v5 <= 3u ) //someone
847 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); 847 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
848 else if ( _evt->v5 == 4 ) //active 848 else if ( _evt->v5 == 4 ) //active
849 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); 849 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
850 else if ( _evt->v5 == 5 ) //all players 850 else if ( _evt->v5 == 5 ) //all players
851 { 851 {
852 for(int i=0; i<4; ++i) 852 for(int i=0; i<4; ++i)
853 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); 853 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
854 } 854 }
855 else //random player 855 else //random player
856 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); 856 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0);
857 ++curr_seq_num; 857 ++curr_seq_num;
858 v4 = v124; 858 v4 = v124;
859 859
860 break; 860 break;
861 case EVENT_CharacterAnimation: 861 case EVENT_CharacterAnimation:
862 if ( _evt->v5 <= 3u ) //someone 862 if ( _evt->v5 <= 3u ) //someone
863 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); 863 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0);
864 else if ( _evt->v5 == 4 ) //active 864 else if ( _evt->v5 == 4 ) //active
865 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); 865 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0);
866 else if ( _evt->v5 == 5 ) //all 866 else if ( _evt->v5 == 5 ) //all
867 for(int i=0; i<4; ++i) 867 for(int i=0; i<4; ++i)
868 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); 868 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0);
869 else //random 869 else //random
870 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); 870 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0);
871 ++curr_seq_num; 871 ++curr_seq_num;
872 v4 = v124; 872 v4 = v124;
873 873
874 break; 874 break;
875 case EVENT_ForPartyMember: 875 case EVENT_ForPartyMember:
876 player_choose = _evt->v5; 876 player_choose = _evt->v5;
877 ++curr_seq_num; 877 ++curr_seq_num;
878 v4 = v124; 878 v4 = v124;
879 break; 879 break;
880 case EVENT_SummonItem: 880 case EVENT_SummonItem:
881 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), 881 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8),
882 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), 882 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8),
883 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), 883 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8),
884 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), 884 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8),
885 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), 885 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8),
886 _evt->v25, _evt->v26, 0, 0); 886 _evt->v25, _evt->v26, 0, 0);
887 ++curr_seq_num; 887 ++curr_seq_num;
888 v4 = v124; 888 v4 = v124;
889 889
890 //v6 = v123; 890 //v6 = v123;
891 //v7 = ""; 891 //v7 = "";
892 break; 892 break;
893 case EVENT_Compare: 893 case EVENT_Compare:
894 pValue = EVT_DWORD(_evt->v7); 894 pValue = EVT_DWORD(_evt->v7);
895 if ( player_choose <= 3 ) 895 if ( player_choose <= 3 )
896 { 896 {
897 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 897 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
898 { 898 {
899 v124 = -1; 899 v124 = -1;
900 curr_seq_num = _evt->v11 - 1; 900 curr_seq_num = _evt->v11 - 1;
901 } 901 }
902 } 902 }
903 else if ( player_choose == 4 ) //active 903 else if ( player_choose == 4 ) //active
904 { 904 {
905 if ( uActiveCharacter ) 905 if ( uActiveCharacter )
906 { 906 {
907 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 907 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
908 { 908 {
909 v124 = -1; 909 v124 = -1;
910 curr_seq_num = _evt->v11 - 1; 910 curr_seq_num = _evt->v11 - 1;
911 } 911 }
912 } 912 }
913 } 913 }
914 else if ( player_choose == 5 )//all 914 else if ( player_choose == 5 )//all
915 { 915 {
916 v130=0; 916 v130=0;
917 for(int i = 1; i < 5; ++i) 917 for(int i = 1; i < 5; ++i)
918 { 918 {
919 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 919 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
920 { 920 {
921 v124 = -1; 921 v124 = -1;
922 curr_seq_num = _evt->v11 - 1; 922 curr_seq_num = _evt->v11 - 1;
923 break; 923 break;
924 } 924 }
925 ++v130; 925 ++v130;
926 } 926 }
927 } 927 }
928 else if ( player_choose == 6 ) //random 928 else if ( player_choose == 6 ) //random
929 { 929 {
930 if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 930 if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
931 { 931 {
932 v124 = -1; 932 v124 = -1;
933 curr_seq_num = _evt->v11 - 1; 933 curr_seq_num = _evt->v11 - 1;
934 } 934 }
935 } 935 }
936 ++curr_seq_num; 936 ++curr_seq_num;
937 v4 = v124; 937 v4 = v124;
938 break; 938 break;
939 case EVENT_IsActorAlive: 939 case EVENT_IsActorAlive:
940 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) 940 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10)))
941 { 941 {
942 v124 = -1; 942 v124 = -1;
943 curr_seq_num = _evt->v11 - 1; 943 curr_seq_num = _evt->v11 - 1;
944 } 944 }
945 ++curr_seq_num; 945 ++curr_seq_num;
946 v4 = v124; 946 v4 = v124;
947 break; 947 break;
948 case EVENT_Substract: 948 case EVENT_Substract:
949 pValue = EVT_DWORD(_evt->v7); 949 pValue = EVT_DWORD(_evt->v7);
950 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) 950 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands )
951 { 951 {
952 if ( pParty->pPickedItem.uItemID == pValue )//In hand 952 if ( pParty->pPickedItem.uItemID == pValue )//In hand
953 { 953 {
954 pMouse->RemoveHoldingItem(); 954 pMouse->RemoveHoldingItem();
955 ++curr_seq_num; 955 ++curr_seq_num;
956 v4 = v124; 956 v4 = v124;
957 break; 957 break;
958 } 958 }
959 v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; 959 v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix;
960 for ( v65 = 0; v65 < 126; ++v65 ) 960 for ( v65 = 0; v65 < 126; ++v65 )
961 { 961 {
962 if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue ) 962 if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue )
963 { 963 {
964 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); 964 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65);
965 ++curr_seq_num; 965 ++curr_seq_num;
966 v4 = v124; 966 v4 = v124;
967 break; 967 break;
968 } 968 }
969 v67 += 4; 969 v67 += 4;
970 } 970 }
971 while ( (signed int)v65 < 126 ); 971 while ( (signed int)v65 < 126 );
972 v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; 972 v69 = (int)&pPlayers[uActiveCharacter]->pEquipment;
973 for ( v68 = 0; v68 < 16; ++v68 ) 973 for ( v68 = 0; v68 < 16; ++v68 )
974 { 974 {
975 if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue ) 975 if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue )
976 { 976 {
977 *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0; 977 *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0;
978 ++curr_seq_num; 978 ++curr_seq_num;
979 v4 = v124; 979 v4 = v124;
980 break; 980 break;
981 } 981 }
982 v69 += 4; 982 v69 += 4;
983 } 983 }
984 for (int i = 1; i < 5; i++) 984 for (int i = 1; i < 5; i++)
985 { 985 {
986 v72 = (int)pPlayers[i]->pInventoryMatrix; 986 v72 = (int)pPlayers[i]->pInventoryMatrix;
987 for ( int v71 = 0; v71 < 126; ++v71 ) 987 for ( int v71 = 0; v71 < 126; ++v71 )
988 { 988 {
989 if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue ) 989 if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue )
990 { 990 {
991 pPlayers[i]->RemoveItemAtInventoryIndex(v71); 991 pPlayers[i]->RemoveItemAtInventoryIndex(v71);
992 break; 992 break;
993 } 993 }
994 v72 += 4; 994 v72 += 4;
995 } 995 }
996 v73 = 0; 996 v73 = 0;
997 v74 = (int)&pPlayers[i]->pEquipment; 997 v74 = (int)&pPlayers[i]->pEquipment;
998 while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue ) 998 while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue )
999 { 999 {
1000 ++v73; 1000 ++v73;
1001 v74 += 4; 1001 v74 += 4;
1002 if ( v73 >= 16 ) 1002 if ( v73 >= 16 )
1003 break; 1003 break;
1004 } 1004 }
1005 *(&pPlayers[i]->pEquipment.uShield + v73) = 0; 1005 *(&pPlayers[i]->pEquipment.uShield + v73) = 0;
1006 } 1006 }
1007 } 1007 }
1008 if ( player_choose <= 3 ) 1008 if ( player_choose <= 3 )
1009 { 1009 {
1010 pPlayer = &pParty->pPlayers[player_choose]; 1010 pPlayer = &pParty->pPlayers[player_choose];
1011 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1011 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1012 } 1012 }
1013 else if ( player_choose == 4 ) //active 1013 else if ( player_choose == 4 ) //active
1014 { 1014 {
1015 if ( uActiveCharacter ) 1015 if ( uActiveCharacter )
1016 { 1016 {
1017 pPlayer = pPlayers[uActiveCharacter]; 1017 pPlayer = pPlayers[uActiveCharacter];
1018 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1018 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1019 } 1019 }
1020 } 1020 }
1021 else if ( player_choose == 5 )//all 1021 else if ( player_choose == 5 )//all
1022 { 1022 {
1023 v130 = 0; 1023 v130 = 0;
1024 for(int i = 1; i < 5; ++i) 1024 for(int i = 1; i < 5; ++i)
1025 { 1025 {
1026 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) 1026 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) )
1027 break; 1027 break;
1028 } 1028 }
1029 ++v130; 1029 ++v130;
1030 } 1030 }
1031 else if ( player_choose == 6 ) //random 1031 else if ( player_choose == 6 ) //random
1032 { 1032 {
1033 player_choose = rand() % 4; 1033 player_choose = rand() % 4;
1034 pPlayer = &pParty->pPlayers[player_choose]; 1034 pPlayer = &pParty->pPlayers[player_choose];
1035 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1035 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1036 } 1036 }
1037 ++curr_seq_num; 1037 ++curr_seq_num;
1038 v4 = v124; 1038 v4 = v124;
1039 break; 1039 break;
1040 case EVENT_Set: 1040 case EVENT_Set:
1041 pValue = EVT_DWORD(_evt->v7); 1041 pValue = EVT_DWORD(_evt->v7);
1042 if ( player_choose <= 3 ) 1042 if ( player_choose <= 3 )
1043 { 1043 {
1044 pPlayer = &pParty->pPlayers[player_choose]; 1044 pPlayer = &pParty->pPlayers[player_choose];
1045 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1045 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1046 } 1046 }
1047 else if ( player_choose == 4 ) //active 1047 else if ( player_choose == 4 ) //active
1048 { 1048 {
1049 if ( uActiveCharacter ) 1049 if ( uActiveCharacter )
1050 { 1050 {
1051 pPlayer = pPlayers[uActiveCharacter]; 1051 pPlayer = pPlayers[uActiveCharacter];
1052 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1052 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1053 } 1053 }
1054 } 1054 }
1055 else if ( player_choose == 5 )//all 1055 else if ( player_choose == 5 )//all
1056 { 1056 {
1057 //recheck v130 1057 //recheck v130
1058 for(int i = 1; i < 5; ++i) 1058 for(int i = 1; i < 5; ++i)
1059 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1059 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1060 1060
1061 } 1061 }
1062 else if ( player_choose == 6 ) //random 1062 else if ( player_choose == 6 ) //random
1063 { 1063 {
1064 player_choose = rand() % 4; 1064 player_choose = rand() % 4;
1065 pPlayer = &pParty->pPlayers[player_choose]; 1065 pPlayer = &pParty->pPlayers[player_choose];
1066 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1066 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1067 1067
1068 } 1068 }
1069 ++curr_seq_num; 1069 ++curr_seq_num;
1070 v4 = v124; 1070 v4 = v124;
1071 break; 1071 break;
1072 case EVENT_Add: 1072 case EVENT_Add:
1073 pValue = EVT_DWORD(_evt->v7); 1073 pValue = EVT_DWORD(_evt->v7);
1074 if ( player_choose <= 3 ) 1074 if ( player_choose <= 3 )
1075 { 1075 {
1076 pPlayer = &pParty->pPlayers[player_choose]; 1076 pPlayer = &pParty->pPlayers[player_choose];
1077 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1077 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1078 } 1078 }
1079 else if ( player_choose == 4 ) //active 1079 else if ( player_choose == 4 ) //active
1080 { 1080 {
1081 if ( uActiveCharacter ) 1081 if ( uActiveCharacter )
1082 { 1082 {
1083 pPlayer = pPlayers[uActiveCharacter]; 1083 pPlayer = pPlayers[uActiveCharacter];
1084 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1084 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1085 } 1085 }
1086 } 1086 }
1087 else if ( player_choose == 5 )//all 1087 else if ( player_choose == 5 )//all
1088 { 1088 {
1089 //v130 = 0; 1089 //v130 = 0;
1090 for(int i = 1; i < 5; ++i) 1090 for(int i = 1; i < 5; ++i)
1091 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1091 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1092 1092
1093 } 1093 }
1094 else if ( player_choose == 6 ) //random 1094 else if ( player_choose == 6 ) //random
1095 { 1095 {
1096 player_choose = rand() % 4; 1096 player_choose = rand() % 4;
1097 pPlayer = &pParty->pPlayers[player_choose]; 1097 pPlayer = &pParty->pPlayers[player_choose];
1098 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); 1098 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue);
1099 } 1099 }
1100 v83 = EVT_WORD(_evt->v5); 1100 v83 = EVT_WORD(_evt->v5);
1101 if (v83 == 21 || // gold well on emerald isle 1101 if (v83 == 21 || // gold well on emerald isle
1102 v83 == 22 || v83 == 23 || v83 == 24 ) 1102 v83 == 22 || v83 == 23 || v83 == 24 )
1103 { 1103 {
1104 //__debugbreak(); // bonfire 1104 //__debugbreak(); // bonfire
1105 viewparams->bRedrawGameUI = true; 1105 viewparams->bRedrawGameUI = true;
1106 } 1106 }
1107 ++curr_seq_num; 1107 ++curr_seq_num;
1108 v4 = v124; 1108 v4 = v124;
1109 break; 1109 break;
1110 case EVENT_InputString: 1110 case EVENT_InputString:
1111 if ( !entry_line ) 1111 if ( !entry_line )
1112 { 1112 {
1113 strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); 1113 strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]);
1114 v105 = curr_seq_num; 1114 v105 = curr_seq_num;
1115 v121 = 26; 1115 v121 = 26;
1116 LABEL_295: 1116 LABEL_295:
1117 sub_4451A8_press_any_key(uEventID, v105, v121); 1117 sub_4451A8_press_any_key(uEventID, v105, v121);
1118 LABEL_301: 1118 LABEL_301:
1119 if ( v133 == 1 ) 1119 if ( v133 == 1 )
1120 OnMapLeave(); 1120 OnMapLeave();
1121 return; 1121 return;
1122 } 1122 }
1123 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); 1123 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
1124 if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) 1124 if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]])
1125 || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) 1125 || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) )
1126 { 1126 {
1127 v11 = _evt->v17; 1127 v11 = _evt->v17;
1128 LABEL_130: 1128 LABEL_130:
1129 //v124 = -1; 1129 //v124 = -1;
1130 LABEL_131: 1130 LABEL_131:
1131 curr_seq_num = v11 - 1; 1131 curr_seq_num = v11 - 1;
1132 } 1132 }
1133 ++curr_seq_num; 1133 ++curr_seq_num;
1134 v4 = v124; 1134 v4 = v124;
1135 1135
1136 //v6 = v123; 1136 //v6 = v123;
1137 //v7 = ""; 1137 //v7 = "";
1138 break; 1138 break;
1139 case EVENT_RandomGoTo: 1139 case EVENT_RandomGoTo:
1140 //v124 = -1; 1140 //v124 = -1;
1141 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) 1141 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0)
1142 + (_evt->v10 != 0))); 1142 + (_evt->v10 != 0)));
1143 curr_seq_num = v11 - 1; 1143 curr_seq_num = v11 - 1;
1144 ++curr_seq_num; 1144 ++curr_seq_num;
1145 v4 = v124; 1145 v4 = v124;
1146 break; 1146 break;
1147 case EVENT_ReceiveDamage: 1147 case EVENT_ReceiveDamage:
1148 v85 = EVT_DWORD(_evt->v7 ); 1148 v85 = EVT_DWORD(_evt->v7 );
1149 v86 = _evt->v5; 1149 v86 = _evt->v5;
1150 if ( (unsigned __int8)v86 <= 3 ) 1150 if ( (unsigned __int8)v86 <= 3 )
1151 { 1151 {
1152 v119 = _evt->v6; 1152 v119 = _evt->v6;
1153 v115 = EVT_DWORD(_evt->v7 ); 1153 v115 = EVT_DWORD(_evt->v7 );
1154 v89 = (unsigned __int8)v86; 1154 v89 = (unsigned __int8)v86;
1155 v88 = &pParty->pPlayers[v89]; 1155 v88 = &pParty->pPlayers[v89];
1156 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); 1156 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
1157 ++curr_seq_num; 1157 ++curr_seq_num;
1158 v4 = v124; 1158 v4 = v124;
1159 break; 1159 break;
1160 } 1160 }
1161 if ( v86 == 4 ) 1161 if ( v86 == 4 )
1162 { 1162 {
1163 if ( !uActiveCharacter ) 1163 if ( !uActiveCharacter )
1164 { 1164 {
1165 ++curr_seq_num; 1165 ++curr_seq_num;
1166 v4 = v124; 1166 v4 = v124;
1167 1167
1168 //v6 = v123; 1168 //v6 = v123;
1169 //v7 = ""; 1169 //v7 = "";
1170 break; 1170 break;
1171 } 1171 }
1172 v119 = _evt->v6; 1172 v119 = _evt->v6;
1173 v88 = pPlayers[uActiveCharacter]; 1173 v88 = pPlayers[uActiveCharacter];
1174 v115 = EVT_DWORD(_evt->v7 ); 1174 v115 = EVT_DWORD(_evt->v7 );
1175 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); 1175 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
1176 ++curr_seq_num; 1176 ++curr_seq_num;
1177 v4 = v124; 1177 v4 = v124;
1178 break; 1178 break;
1179 } 1179 }
1180 if ( v86 != 5 ) 1180 if ( v86 != 5 )
1181 { 1181 {
1182 v119 = _evt->v6; 1182 v119 = _evt->v6;
1183 v115 = EVT_DWORD(_evt->v7 ); 1183 v115 = EVT_DWORD(_evt->v7 );
1184 v89 = rand() % 4; 1184 v89 = rand() % 4;
1185 v88 = &pParty->pPlayers[v89]; 1185 v88 = &pParty->pPlayers[v89];
1186 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); 1186 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119);
1187 ++curr_seq_num; 1187 ++curr_seq_num;
1188 v4 = v124; 1188 v4 = v124;
1189 1189
1190 //v6 = v123; 1190 //v6 = v123;
1191 //v7 = ""; 1191 //v7 = "";
1192 break; 1192 break;
1193 } 1193 }
1194 v87 = pParty->pPlayers; 1194 v87 = pParty->pPlayers;
1195 do 1195 do
1196 { 1196 {
1197 v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); 1197 v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6);
1198 ++v87; 1198 ++v87;
1199 } 1199 }
1200 while ( (signed int)v87 < (signed int)pParty->pHirelings ); 1200 while ( (signed int)v87 < (signed int)pParty->pHirelings );
1201 ++curr_seq_num; 1201 ++curr_seq_num;
1202 v4 = v124; 1202 v4 = v124;
1203 1203
1204 //v6 = v123; 1204 //v6 = v123;
1205 //v7 = ""; 1205 //v7 = "";
1206 break; 1206 break;
1207 case EVENT_ToggleIndoorLight: 1207 case EVENT_ToggleIndoorLight:
1208 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); 1208 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9);
1209 ++curr_seq_num; 1209 ++curr_seq_num;
1210 v4 = v124; 1210 v4 = v124;
1211 1211
1212 //v6 = v123; 1212 //v6 = v123;
1213 //v7 = ""; 1213 //v7 = "";
1214 break; 1214 break;
1215 case EVENT_SetFacesBit: 1215 case EVENT_SetFacesBit:
1216 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); 1216 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13);
1217 ++curr_seq_num; 1217 ++curr_seq_num;
1218 v4 = v124; 1218 v4 = v124;
1219 1219
1220 //v6 = v123; 1220 //v6 = v123;
1221 //v7 = ""; 1221 //v7 = "";
1222 break; 1222 break;
1223 case EVENT_ToggleChestFlag: 1223 case EVENT_ToggleChestFlag:
1224 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); 1224 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1225 ++curr_seq_num; 1225 ++curr_seq_num;
1226 v4 = v124; 1226 v4 = v124;
1227 1227
1228 //v6 = v123; 1228 //v6 = v123;
1229 //v7 = ""; 1229 //v7 = "";
1230 break; 1230 break;
1231 case EVENT_ToggleActorFlag: 1231 case EVENT_ToggleActorFlag:
1232 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); 1232 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1233 ++curr_seq_num; 1233 ++curr_seq_num;
1234 v4 = v124; 1234 v4 = v124;
1235 1235
1236 //v6 = v123; 1236 //v6 = v123;
1237 //v7 = ""; 1237 //v7 = "";
1238 break; 1238 break;
1239 case EVENT_ToggleActorGroupFlag: 1239 case EVENT_ToggleActorGroupFlag:
1240 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); 1240 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13);
1241 ++curr_seq_num; 1241 ++curr_seq_num;
1242 v4 = v124; 1242 v4 = v124;
1243 1243
1244 //v6 = v123; 1244 //v6 = v123;
1245 //v7 = ""; 1245 //v7 = "";
1246 break; 1246 break;
1247 case EVENT_SetSnow: 1247 case EVENT_SetSnow:
1248 if ( !_evt->v5 ) 1248 if ( !_evt->v5 )
1249 pWeather->bRenderSnow = _evt->v6 != 0; 1249 pWeather->bRenderSnow = _evt->v6 != 0;
1250 ++curr_seq_num; 1250 ++curr_seq_num;
1251 v4 = v124; 1251 v4 = v124;
1252 1252
1253 //v6 = v123; 1253 //v6 = v123;
1254 //v7 = ""; 1254 //v7 = "";
1255 break; 1255 break;
1256 case EVENT_StatusText: 1256 case EVENT_StatusText:
1257 v90 = EVT_DWORD(_evt->v5 ); 1257 v90 = EVT_DWORD(_evt->v5 );
1258 if ( activeLevelDecoration ) 1258 if ( activeLevelDecoration )
1259 { 1259 {
1260 if ( activeLevelDecoration == (LevelDecoration*)1 ) 1260 if ( activeLevelDecoration == (LevelDecoration*)1 )
1261 { 1261 {
1262 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; 1262 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
1263 } 1263 }
1264 if ( canShowMessages == 1 ) 1264 if ( canShowMessages == 1 )
1265 { 1265 {
1266 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; 1266 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90];
1267 //LABEL_248: 1267 //LABEL_248:
1268 ShowStatusBarString(v91, 2u); 1268 ShowStatusBarString(v91, 2u);
1269 } 1269 }
1270 } 1270 }
1271 else 1271 else
1272 { 1272 {
1273 if ( canShowMessages == 1 ) 1273 if ( canShowMessages == 1 )
1274 { 1274 {
1275 v91 = &pLevelStr[pLevelStrOffsets[v90]]; 1275 v91 = &pLevelStr[pLevelStrOffsets[v90]];
1276 ShowStatusBarString(v91, 2u); 1276 ShowStatusBarString(v91, 2u);
1277 } 1277 }
1278 } 1278 }
1279 ++curr_seq_num; 1279 ++curr_seq_num;
1280 v4 = v124; 1280 v4 = v124;
1281 1281
1282 //v6 = v123; 1282 //v6 = v123;
1283 //v7 = ""; 1283 //v7 = "";
1284 break; 1284 break;
1285 case EVENT_ShowMessage: 1285 case EVENT_ShowMessage:
1286 v92 = EVT_DWORD(_evt->v5 ); 1286 v92 = EVT_DWORD(_evt->v5 );
1287 if ( activeLevelDecoration ) 1287 if ( activeLevelDecoration )
1288 { 1288 {
1289 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; 1289 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92];
1290 byte_5B0938[0] = 0; 1290 byte_5B0938[0] = 0;
1291 current_npc_text = v93; 1291 current_npc_text = v93;
1292 } 1292 }
1293 else 1293 else
1294 { 1294 {
1295 strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); 1295 strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]);
1296 } 1296 }
1297 ++curr_seq_num; 1297 ++curr_seq_num;
1298 v4 = v124; 1298 v4 = v124;
1299 1299
1300 //v6 = v123; 1300 //v6 = v123;
1301 //v7 = ""; 1301 //v7 = "";
1302 break; 1302 break;
1303 case EVENT_CastSpell: 1303 case EVENT_CastSpell:
1304 EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), 1304 EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ),
1305 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), 1305 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
1306 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); 1306 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 ));
1307 ++curr_seq_num; 1307 ++curr_seq_num;
1308 v4 = v124; 1308 v4 = v124;
1309 break; 1309 break;
1310 case EVENT_SetTexture: 1310 case EVENT_SetTexture:
1311 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); 1311 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9);
1312 ++curr_seq_num; 1312 ++curr_seq_num;
1313 v4 = v124; 1313 v4 = v124;
1314 1314
1315 //v6 = v123; 1315 //v6 = v123;
1316 //v7 = ""; 1316 //v7 = "";
1317 break; 1317 break;
1318 case EVENT_SetSprite: 1318 case EVENT_SetSprite:
1319 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); 1319 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10);
1320 ++curr_seq_num; 1320 ++curr_seq_num;
1321 v4 = v124; 1321 v4 = v124;
1322 1322
1323 //v6 = v123; 1323 //v6 = v123;
1324 //v7 = ""; 1324 //v7 = "";
1325 break; 1325 break;
1326 case EVENT_SummonMonsters: 1326 case EVENT_SummonMonsters:
1327 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), 1327 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ),
1328 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), 1328 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ),
1329 EVT_DWORD(_evt->v24 )); 1329 EVT_DWORD(_evt->v24 ));
1330 ++curr_seq_num; 1330 ++curr_seq_num;
1331 v4 = v124; 1331 v4 = v124;
1332 1332
1333 //v6 = v123; 1333 //v6 = v123;
1334 //v7 = ""; 1334 //v7 = "";
1335 break; 1335 break;
1336 case EVENT_MouseOver: 1336 case EVENT_MouseOver:
1337 case EVENT_LocationName: 1337 case EVENT_LocationName:
1338 --curr_seq_num; 1338 --curr_seq_num;
1339 ++curr_seq_num; 1339 ++curr_seq_num;
1340 v4 = v124; 1340 v4 = v124;
1341 1341
1342 //v6 = v123; 1342 //v6 = v123;
1343 //v7 = ""; 1343 //v7 = "";
1344 break; 1344 break;
1345 case EVENT_ChangeDoorState: 1345 case EVENT_ChangeDoorState:
1346 sub_449A49_door_switch_animation(_evt->v5, _evt->v6); 1346 sub_449A49_door_switch_animation(_evt->v5, _evt->v6);
1347 ++curr_seq_num; 1347 ++curr_seq_num;
1348 v4 = v124; 1348 v4 = v124;
1349 1349
1350 //v6 = v123; 1350 //v6 = v123;
1351 //v7 = ""; 1351 //v7 = "";
1352 break; 1352 break;
1353 case EVENT_OpenChest: 1353 case EVENT_OpenChest:
1354 if ( !Chest::Open(_evt->v5) ) 1354 if ( !Chest::Open(_evt->v5) )
1355 goto LABEL_301; 1355 goto LABEL_301;
1356 ++curr_seq_num; 1356 ++curr_seq_num;
1357 v4 = v124; 1357 v4 = v124;
1358 1358
1359 //v6 = v123; 1359 //v6 = v123;
1360 //v7 = ""; 1360 //v7 = "";
1361 break; 1361 break;
1362 case EVENT_MoveToMap: 1362 case EVENT_MoveToMap:
1363 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1363 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
1364 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1364 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
1365 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 1365 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
1366 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); 1366 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
1367 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); 1367 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8);
1368 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); 1368 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8);
1369 v96 = _evt->v25; 1369 v96 = _evt->v25;
1370 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); 1370 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
1371 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); 1371 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8);
1372 if ( _evt->v29 || _evt->v30 ) 1372 if ( _evt->v29 || _evt->v30 )
1373 { 1373 {
1374 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) 1374 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
1375 pRenderer->_49FD3A(); 1375 pRenderer->_49FD3A();
1376 TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); 1376 TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31);
1377 dword_5C3418 = uEventID; 1377 dword_5C3418 = uEventID;
1378 dword_5C341C = curr_seq_num + 1; 1378 dword_5C341C = curr_seq_num + 1;
1379 goto LABEL_301; 1379 goto LABEL_301;
1380 } 1380 }
1381 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 1381 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
1382 _5B65A8_npcdata_uflags_or_other = v94; 1382 _5B65A8_npcdata_uflags_or_other = v94;
1383 _5B65B0_npcdata_rep_or_other = v126; 1383 _5B65B0_npcdata_rep_or_other = v126;
1384 if ( v129 == -1 ) 1384 if ( v129 == -1 )
1385 { 1385 {
1386 v98 = _5B65B4_npcdata_loword_house_or_other; 1386 v98 = _5B65B4_npcdata_loword_house_or_other;
1387 } 1387 }
1388 else 1388 else
1389 { 1389 {
1390 v98 = v129 & stru_5C6E00->uDoublePiMask; 1390 v98 = v129 & stru_5C6E00->uDoublePiMask;
1391 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; 1391 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask;
1392 } 1392 }
1393 v99 = (char *)&_evt->v31; 1393 v99 = (char *)&_evt->v31;
1394 _5B65B8_npcdata_hiword_house_or_other = v95; 1394 _5B65B8_npcdata_hiword_house_or_other = v95;
1395 dword_5B65BC = v97; 1395 dword_5B65BC = v97;
1396 v100 = v94 | v132 | v126 | v95 | v97 | v98; 1396 v100 = v94 | v132 | v126 | v95 | v97 | v98;
1397 dword_5B65C0 = v100; 1397 dword_5B65C0 = v100;
1398 if ( *v99 == 48 ) 1398 if ( *v99 == 48 )
1399 { 1399 {
1400 if ( v100 ) 1400 if ( v100 )
1401 { 1401 {
1402 pParty->vPosition.x = v135; 1402 pParty->vPosition.x = v135;
1403 pParty->vPosition.y = v132; 1403 pParty->vPosition.y = v132;
1404 pParty->vPosition.z = v126; 1404 pParty->vPosition.z = v126;
1405 pParty->uFallStartY = v126; 1405 pParty->uFallStartY = v126;
1406 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) 1406 if ( _5B65B4_npcdata_loword_house_or_other != -1 )
1407 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; 1407 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
1408 _5B65B4_npcdata_loword_house_or_other = -1; 1408 _5B65B4_npcdata_loword_house_or_other = -1;
1409 v120 = 0; 1409 v120 = 0;
1410 v116 = 0; 1410 v116 = 0;
1411 v111 = 0; 1411 v111 = 0;
1412 v110 = 0; 1412 v110 = 0;
1413 v109 = -1; 1413 v109 = -1;
1414 v108 = 0; 1414 v108 = 0;
1415 v107 = 0; 1415 v107 = 0;
1416 pParty->sRotationX = v95; 1416 pParty->sRotationX = v95;
1417 pParty->uFallSpeed = v134; 1417 pParty->uFallSpeed = v134;
1418 dword_5B65C0 = 0; 1418 dword_5B65C0 = 0;
1419 dword_5B65BC = 0; 1419 dword_5B65BC = 0;
1420 _5B65B8_npcdata_hiword_house_or_other = 0; 1420 _5B65B8_npcdata_hiword_house_or_other = 0;
1421 _5B65B0_npcdata_rep_or_other = 0; 1421 _5B65B0_npcdata_rep_or_other = 0;
1422 _5B65AC_npcdata_fame_or_other = 0; 1422 _5B65AC_npcdata_fame_or_other = 0;
1423 _5B65A8_npcdata_uflags_or_other = 0; 1423 _5B65A8_npcdata_uflags_or_other = 0;
1424 v106 = 232; 1424 v106 = 232;
1425 LABEL_280: 1425 LABEL_280:
1426 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); 1426 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120);
1427 } 1427 }
1428 } 1428 }
1429 else 1429 else
1430 { 1430 {
1431 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); 1431 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1);
1432 sub_44987B(v99, MapStartPoint_Party); 1432 sub_44987B(v99, MapStartPoint_Party);
1433 v133 = 1; 1433 v133 = 1;
1434 if ( pCurrentScreen == SCREEN_HOUSE ) 1434 if ( pCurrentScreen == SCREEN_HOUSE )
1435 { 1435 {
1436 if ( uGameState == GAME_STATE_2 ) 1436 if ( uGameState == GAME_STATE_2 )
1437 { 1437 {
1438 pAudioPlayer->StopChannels(-1, -1); 1438 pAudioPlayer->StopChannels(-1, -1);
1439 dialog_menu_id = HOUSE_DIALOGUE_NULL; 1439 dialog_menu_id = HOUSE_DIALOGUE_NULL;
1440 while ( sub_4BD8B5() ) 1440 while ( sub_4BD8B5() )
1441 ; 1441 ;
1442 pVideoPlayer->Unload(); 1442 pVideoPlayer->Unload();
1443 window_SpeakInHouse->Release(); 1443 window_SpeakInHouse->Release();
1444 window_SpeakInHouse = 0; 1444 window_SpeakInHouse = 0;
1445 if ( pMessageQueue_50CBD0->uNumMessages ) 1445 if ( pMessageQueue_50CBD0->uNumMessages )
1446 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 1446 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
1447 pCurrentScreen = SCREEN_GAME; 1447 pCurrentScreen = SCREEN_GAME;
1448 viewparams->bRedrawGameUI = 1; 1448 viewparams->bRedrawGameUI = 1;
1449 pDialogueNPCCount = 0; 1449 pDialogueNPCCount = 0;
1450 pDialogueWindow->Release(); 1450 pDialogueWindow->Release();
1451 dialog_menu_id = HOUSE_DIALOGUE_NULL; 1451 dialog_menu_id = HOUSE_DIALOGUE_NULL;
1452 pDialogueWindow = 0; 1452 pDialogueWindow = 0;
1453 pIcons_LOD->SyncLoadedFilesCount(); 1453 pIcons_LOD->SyncLoadedFilesCount();
1454 } 1454 }
1455 OnMapLeave(); 1455 OnMapLeave();
1456 return; 1456 return;
1457 } 1457 }
1458 } 1458 }
1459 ++curr_seq_num; 1459 ++curr_seq_num;
1460 v4 = v124; 1460 v4 = v124;
1461 1461
1462 //v6 = v123; 1462 //v6 = v123;
1463 //v7 = ""; 1463 //v7 = "";
1464 break; 1464 break;
1465 case EVENT_PlaySound: 1465 case EVENT_PlaySound:
1466 v120 = 0; 1466 v120 = 0;
1467 v116 = 0; 1467 v116 = 0;
1468 v111 = 0; 1468 v111 = 0;
1469 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); 1469 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8);
1470 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); 1470 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8);
1471 v108 = 0; 1471 v108 = 0;
1472 v107 = 0; 1472 v107 = 0;
1473 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); 1473 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8);
1474 goto LABEL_280; 1474 goto LABEL_280;
1475 case EVENT_GiveItem: 1475 case EVENT_GiveItem:
1476 item.Reset(); 1476 item.Reset();
1477 //v101 = &pSomeEVT[v9]; 1477 //v101 = &pSomeEVT[v9];
1478 v102 = _evt->v7 1478 v102 = _evt->v7
1479 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); 1479 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8);
1480 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); 1480 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item);
1481 if ( v102 ) 1481 if ( v102 )
1482 item.uItemID = v102; 1482 item.uItemID = v102;
1483 pParty->SetHoldingItem(&item); 1483 pParty->SetHoldingItem(&item);
1484 ++curr_seq_num; 1484 ++curr_seq_num;
1485 v4 = v124; 1485 v4 = v124;
1486 //v6 = v123; 1486 //v6 = v123;
1487 //v7 = ""; 1487 //v7 = "";
1488 break; 1488 break;
1489 case EVENT_SpeakInHouse: 1489 case EVENT_SpeakInHouse:
1490 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) 1490 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5)))
1491 { 1491 {
1492 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) 1492 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode )
1493 pRenderer->_49FD3A(); 1493 pRenderer->_49FD3A();
1494 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 1494 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
1495 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); 1495 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
1496 v104 = 187; 1496 v104 = 187;
1497 if ( uCurrentHouse_Animation != 167 ) 1497 if ( uCurrentHouse_Animation != 167 )
1498 v104 = EVT_DWORD(_evt->v5); 1498 v104 = EVT_DWORD(_evt->v5);
1499 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); 1499 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
1500 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); 1500 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
1501 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); 1501 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
1502 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); 1502 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
1503 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); 1503 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
1504 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); 1504 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
1505 } 1505 }
1506 ++curr_seq_num; 1506 ++curr_seq_num;
1507 v4 = v124; 1507 v4 = v124;
1508 1508
1509 //v6 = v123; 1509 //v6 = v123;
1510 //v7 = ""; 1510 //v7 = "";
1511 break; 1511 break;
1512 case EVENT_PressAnyKey: 1512 case EVENT_PressAnyKey:
1513 v121 = 33; 1513 v121 = 33;
1514 v105 = curr_seq_num + 1; 1514 v105 = curr_seq_num + 1;
1515 goto LABEL_295; 1515 goto LABEL_295;
1516 case EVENT_Exit: 1516 case EVENT_Exit:
1517 if ( v133 == 1 ) 1517 if ( v133 == 1 )
1518 OnMapLeave(); 1518 OnMapLeave();
1519 return; 1519 return;
1520 default: 1520 default:
1521 ++curr_seq_num; 1521 ++curr_seq_num;
1522 v4 = v124; 1522 v4 = v124;
1523 1523
1524 //v6 = v123; 1524 //v6 = v123;
1525 //v7 = ""; 1525 //v7 = "";
1526 break; 1526 break;
1527 } 1527 }
1528 } 1528 }
1529 ++v4; 1529 ++v4;
1530 v124 = v4; 1530 v124 = v4;
1531 if ( v4 >= uSomeEVT_NumEvents ) 1531 if ( v4 >= uSomeEVT_NumEvents )
1532 goto LABEL_301; 1532 goto LABEL_301;
1533 //} 1533 //}
1534 } 1534 }
1535 } 1535 }
1536 1536
1537 //----- (00444732) -------------------------------------------------------- 1537 //----- (00444732) --------------------------------------------------------
1538 char *GetEventHintString(unsigned int uEventID) 1538 char *GetEventHintString(unsigned int uEventID)
1539 { 1539 {
1540 signed int event_index; // edx@1 1540 signed int event_index; // edx@1
1546 _evt_raw* last_evt; 1546 _evt_raw* last_evt;
1547 1547
1548 event_index = 0; 1548 event_index = 0;
1549 if ( uLevelEVT_NumEvents <= 0 ) 1549 if ( uLevelEVT_NumEvents <= 0 )
1550 return NULL; 1550 return NULL;
1551 1551
1552 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; 1552 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT;
1553 while ( 1 ) 1553 while ( 1 )
1554 { 1554 {
1555 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) 1555 if ( pLevelEVT_Index[event_index].uEventID == uEventID )
1556 { 1556 {
1557 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; 1557 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT];
1558 last_evt=test_evt; 1558 last_evt=test_evt;
1559 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; 1559 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT;
1560 if ( test_evt->_e_type == EVENT_MouseOver ) 1560 if ( test_evt->_e_type == EVENT_MouseOver )
1561 break; 1561 break;
1562 } 1562 }
1563 ++event_index; 1563 ++event_index;
1564 if ( event_index >= uLevelEVT_NumEvents ) 1564 if ( event_index >= uLevelEVT_NumEvents )
1565 return NULL; 1565 return NULL;
1566 } 1566 }
1567 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; 1567 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
1568 if ( test_evt->_e_type== EVENT_SpeakInHouse ) 1568 if ( test_evt->_e_type== EVENT_SpeakInHouse )
1569 { 1569 {
1570 str_index = EVT_DWORD(test_evt->v5); 1570 str_index = EVT_DWORD(test_evt->v5);
1571 result = (char *)p2DEvents[str_index - 1].pName; 1571 result = (char *)p2DEvents[str_index - 1].pName;
1572 } 1572 }
1573 else 1573 else
1574 { 1574 {
1575 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) 1575 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i )
1576 { 1576 {
1577 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; 1577 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT;
1578 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; 1578 test_evt=(_evt_raw*)&pLevelEVT[event_pos];
1579 if ( test_evt->_e_type == EVENT_SpeakInHouse ) 1579 if ( test_evt->_e_type == EVENT_SpeakInHouse )
1580 { 1580 {
1581 str_index = EVT_DWORD(test_evt->v5); 1581 str_index = EVT_DWORD(test_evt->v5);
1582 if ( str_index < 600 ) 1582 if ( str_index < 600 )
1583 return (char *)p2DEvents[str_index - 1].pName; 1583 return (char *)p2DEvents[str_index - 1].pName;
1584 } 1584 }
1585 } 1585 }
1586 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; 1586 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]];
1587 } 1587 }
1588 1588
1589 return result; 1589 return result;
1590 } 1590 }