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