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