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