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