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