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