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